push

package
v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package push hands one item that the service holds straight to a program on this machine. psyche is the one such program. Its relate reads the item's parse, the findings of the scan that read it and, where asked, what the service derived from the parse, as one parse-input document on stdin.

Index

Constants

View Source
const (
	FromQualityGate = "the quality gate"
	FromModelRead   = "the model read"
)

The stages that --enriched reads, as a person names them.

View Source
const Connector = "cli-push"

Connector is the push connector that a new link lands through, where the push names no other.

View Source
const Program = "psyche"

Program is the program that a push to psyche runs, found on PATH. A link that a push lands is placed at the destination of the same name.

View Source
const SchemaVersion = 1

SchemaVersion is the version of psyche's parse-input schema that Write writes, the one that testdata/parse-input.schema.json holds.

View Source
const Wait = 10 * time.Minute

Wait is how long a push waits for an item's parse and the scan of it, where it names no other wait. A captions parse waits its turn at ypl's door before its read, so Wait leaves room for the longest door wait and captions read that ypl publishes, with the claims and the scan after them.

Variables

View Source
var ErrNoText = errors.New("the parse holds no text")

ErrNoText is a parse whose text is whitespace alone, which leaves psyche nothing to relate.

View Source
var ErrNotScanned = errors.New("no scan has read the parse")

ErrNotScanned is a parse that no scan has read, which a push never hands on.

Functions

func Relate

func Relate(ctx context.Context, doc Document, asJSON bool, stdout, stderr io.Writer) error

Relate runs `psyche relate --parse -` on this machine with doc on its stdin, adding --json where asJSON is set. psyche writes to stdout and stderr as it runs.

func WaitingOn added in v0.31.0

func WaitingOn(item server.ItemAnswer) (stage, ended string)

WaitingOn names the stage that item waits at on its way to a scanned parse, store.StageParse until a parse is done and store.StageScan after, as the service's progress of each reads. Where no run of that stage is left to end it, ended says how it ended, so a push stops waiting: it failed, or nothing queued it.

Types

type Document

type Document struct {
	SchemaVersion    int                   `json:"schema_version"`
	Key              string                `json:"key"`
	URL              *string               `json:"url"`
	Title            *string               `json:"title"`
	Zone             store.Zone            `json:"zone"`
	MediaType        string                `json:"media_type"`
	Extractor        string                `json:"extractor"`
	ExtractorVersion string                `json:"extractor_version"`
	Text             string                `json:"text"`
	Units            []store.Unit          `json:"units"`
	RulesVersion     *string               `json:"rules_version"`
	Findings         []server.ParseFinding `json:"findings"`
	Suggested        []Suggestion          `json:"suggested"`
	Enriched         *Enriched             `json:"enriched,omitempty"`
}

Document is one parsed source as `psyche relate --parse` reads it.

func Write

func Write(parse server.ParseAnswer, enriched *Enriched) (Document, error)

Write is the document for parse, carrying enriched where it is not nil. Each finding of a rule that scan.Suggests names moves to Suggested, and every other stays a finding.

type Enriched

type Enriched struct {
	Summary    *string  `json:"summary,omitempty"`
	Idea       *string  `json:"idea,omitempty"`
	Suggestion *string  `json:"suggestion,omitempty"`
	Genre      *string  `json:"genre,omitempty"`
	Domains    []string `json:"domains,omitempty"`
	Themes     []string `json:"themes,omitempty"`
	Quality    *int     `json:"quality,omitempty"`
}

Enriched is what the service derived from the parse. Each field is absent where no stage answered it.

type Enrichment

type Enrichment struct {
	// Enriched is nil where no stage's answer could be read.
	Enriched *Enriched
	// From names each stage whose answer Enriched carries.
	From []string
	// Left says, in a sentence each, which part was left out and why.
	Left []string
}

Enrichment is what --enriched adds to the document, and why each part that it leaves out is missing.

func Enrich

func Enrich(item server.ItemAnswer) Enrichment

Enrich is what the service's current answers on item add: the quality gate's answer and the model read's summary and suggestion. The model read's sentence goes only where no scan finding lies over it, because psyche's document holds no place for a finding in it. The summary and the quality gate's words go unscanned. Each restates the source text, which psyche reads whole beside its findings.

type Suggestion

type Suggestion struct {
	Kind string `json:"kind"`
	Text string `json:"text"`
	Unit *int   `json:"unit"`
}

Suggestion is one command, link or piece of code that the text suggests, from the scan's finding that matched it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL