package wire // The Research specialist's sources, card and scheduling (Research spec // ยง2, slice R2). The coordinator's research tool only requests a run; the // instance starts it at the task's next fixed point (task start, or the // boundary before the next Engineering round), holds that Engineering // round while Research is pending or running, and releases it when // Research ends, however it ends. // ToolResearch requests a Research run on the person's task: question // (what to look for) and urls (the coordinator's proposals). One per // fixed point, at most MaxResearchRuns per task. const ToolResearch = "research" // SpecialistResearch is the Research step: on the primary only, with no // repository, branch or SHA. const SpecialistResearch = "research" // CardResearchSources asks the task's creator whether the proposed URLs // may be requested ("Look at these pages?"): ChoiceAllow approves those // exact URLs, ChoiceSkip drops them. const ( CardResearchSources = "research_sources" ChoiceAllow = "allow" ChoiceSkip = "skip" ) // A source's origin: the task creator's own words on the task, or the // coordinator's proposal (only fetched after Allow). The spec calls the // first "paul"; the code names no person. const ( ResearchOriginPerson = "person" ResearchOriginProposed = "proposed" ) // Waiting states (Step.Placement) of a Research step that has not been // dispatched, and of the Engineering step it holds. const ( // PlacementBoundary: requested, waiting for the task's next fixed // point. PlacementBoundary = "waiting_boundary" // PlacementSources: at its fixed point, waiting for the answer on its // sources card. PlacementSources = "waiting_sources" // PlacementInventory: waiting until the primary's site inventory is // confirmed (slice R3). PlacementInventory = "waiting_inventory" // PlacementResearch: an Engineering step held while the task's // Research is pending or running. PlacementResearch = "waiting_research" ) // Reasons a Research step ends without running: nothing left to read // after Skip (done, a gap); Research is not approved now (cancelled); the // primary speaks below ProtocolResearch (it never gets the dispatch); the // primary has no address at all for a site inventory (failed: its hello // says it has no public address and none was observed, so there is // nothing an owner could confirm). const ( ReasonResearchNoSources = "research_no_sources" ReasonResearchNoGrant = "research_no_grant" ReasonResearchUnsupported = "research_unsupported" ReasonResearchNoInventory = "research_no_inventory" ) // Bounds of a research request. const ( MaxResearchRuns = 3 MaxResearchQuestion = 1000 MaxResearchProposals = 10 // MaxResearchPersonSources bounds the sources taken from the person's // own words, in the order they wrote them. MaxResearchPersonSources = 20 ) // ResearchDispatch is a Research step's inputs (protocol 13): the // coordinator's question, the person's own words on the task verbatim, // the approved sources in canonical form, the primary's confirmed site // inventory (prefixes; slice R3 fills it, and a step whose inventory is // not confirmed is never dispatched; a family with no prefix is a family // whose egress is unknown, and the fetcher refuses it), and the approved // specialist's brief at the revision the step was dispatched under (at // most specialist.MaxBrief bytes; a labelled input of Research's prompt). type ResearchDispatch struct { Question string `json:"question"` PersonWords []string `json:"person_words"` Sources []ResearchSource `json:"sources"` Inventory []string `json:"inventory"` SpecialistBrief string `json:"specialist_brief"` SpecialistRevision int64 `json:"specialist_revision"` } // ResearchSource is one approved source: its id within the step, its // canonical URL (websource.URL.String) and its origin. type ResearchSource struct { ID string `json:"id"` URL string `json:"url"` Origin string `json:"origin"` } // CardResearchView is what a sources card shows: the step it is bound to, // what Research is asked to look for, and every proposed URL in full. type CardResearchView struct { StepID string `json:"step_id"` Question string `json:"question"` URLs []string `json:"urls"` }