Documentation
¶
Overview ¶
Package domain holds the research domain model of the reference application (design doc §5). These objects live in the application layer on purpose: the Fenced kernel never sees them, and every state they carry is derived from observable kernel surfaces (workflow documents, memory namespaces), never from kernel internals.
Index ¶
- Constants
- Variables
- func ResearchDecompositionBudget() int64
- func SumRoleBudgetTokens() int64
- func ValidateRequestBudget(maxTasks, maxTokens int64) error
- type Evidence
- type Finding
- type Report
- type ResearchGap
- type ResearchQuestion
- type ResearchRun
- type RunState
- type Source
- type StepView
- type WorkflowBudgetDefaults
- type WorkflowView
Constants ¶
const ( PlannerMaxQuestions = 8 SearchMaxSourcesPerQuesiton = 8 ReaderMaxSourceBytes = 2 << 20 // 2 MiB CriticMaxRounds = 3 WorkflowMaxTasks = 80 )
Hard limits of design doc §10. PlannerMaxQuestions is the application decoder bound (the runtime truncates at 6, inside this ceiling).
const WorkflowBudgetExhaustedCode = "WORKFLOW_BUDGET_EXHAUSTED"
WorkflowBudgetExhaustedCode is the kernel failure code the orchestrator stamps when the workflow budget reservation loop rejects further work.
Variables ¶
var RoleBudgetTokens = map[string]int64{
"planner": 20000,
"search": 5000,
"reader": 6000,
"analyst": 30000,
"critic": 20000,
"writer": 30000,
"citation-validator": 15000,
}
Role budget reference of design doc §10. The workflow template's defaultTaskSpec stays the operational truth for kernel admission (the kernel reserves each declared step's task ceiling against the workflow budget), so these values document the per-role intent and drive the budget-calculation unit tests of the test matrix (§16).
Functions ¶
func ResearchDecompositionBudget ¶
func ResearchDecompositionBudget() int64
ResearchDecompositionBudget returns the token ceiling the planner may spend for one research run per §10.
func SumRoleBudgetTokens ¶
func SumRoleBudgetTokens() int64
SumRoleBudgetTokens adds the per-role budgets (§16 "Research Budget Calculation" unit subject).
func ValidateRequestBudget ¶
ValidateRequestBudget range-checks the §13 request budget override before it is applied to the workflow document. Zero leaves the template default.
Types ¶
type Evidence ¶
type Evidence struct {
ID string `json:"id"`
SourceID string `json:"sourceId"`
QuestionID string `json:"questionId"`
Claim string `json:"claim"`
Evidence string `json:"evidence"`
Confidence float64 `json:"confidence"`
}
Evidence is one grounded claim extracted from a source (§5).
type Finding ¶
type Finding struct {
ID string `json:"id"`
Statement string `json:"statement"`
EvidenceIDs []string `json:"evidenceIds"`
Confidence float64 `json:"confidence"`
}
Finding is one analyst synthesis backed by evidence IDs (§5).
type Report ¶
type Report struct {
ID string `json:"id"`
ResearchRunID string `json:"researchRunId"`
ArtifactRef string `json:"artifactRef"`
CitationCoverage float64 `json:"citationCoverage"`
}
Report is the final deliverable reference (§5). The artifactRef points at the content-addressed artifact store entry that holds the rendered Markdown report.
type ResearchGap ¶
type ResearchGap struct {
ID string `json:"id"`
Question string `json:"question"`
Severity string `json:"severity"`
Resolved bool `json:"resolved"`
}
ResearchGap is one critic-identified hole (§5).
type ResearchQuestion ¶
type ResearchQuestion struct {
ID string `json:"id"`
ResearchRunID string `json:"researchRunId"`
Question string `json:"question"`
Priority int `json:"priority"`
Status string `json:"status"`
}
ResearchQuestion is one planner decomposition unit (§5).
type ResearchRun ¶
type ResearchRun struct {
ID string `json:"id"`
WorkflowID string `json:"workflowId"`
Goal string `json:"goal"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
CompletedAt *time.Time `json:"completedAt"`
}
ResearchRun is one research submission (§5). The ID is the stable application-level handle ("research-<workflowId>") so the mapping between the application surface and the kernel WorkflowRun is deterministic and survives process restarts.
type RunState ¶
type RunState string
RunState is the application-layer research state machine of design doc §9. These states describe the research run for operators and the CLI; they are derived from the kernel WorkflowRun and its steps and are never written back into kernel state.
const ( StateCreated RunState = "CREATED" StatePlanning RunState = "PLANNING" StateResearching RunState = "RESEARCHING" StateAnalyzing RunState = "ANALYZING" StateCritiquing RunState = "CRITIQUING" StateWriting RunState = "WRITING" StateValidating RunState = "VALIDATING" StateCompleted RunState = "COMPLETED" StateFailed RunState = "FAILED" StateCancelled RunState = "CANCELLED" StateBudgetExhaust RunState = "BUDGET_EXHAUSTED" )
func DeriveRunState ¶
func DeriveRunState(view WorkflowView) RunState
DeriveRunState maps one kernel workflow observation onto the §9 state machine. The mapping is pure so the CLI, the API server and the tests all render identical statuses from identical observations.
type Source ¶
type Source struct {
ID string `json:"id"`
QuestionID string `json:"questionId"`
URL string `json:"url"`
Title string `json:"title"`
PublishedAt string `json:"publishedAt"`
RetrievedAt string `json:"retrievedAt"`
}
Source is one discovered document (§5).
type WorkflowBudgetDefaults ¶
type WorkflowBudgetDefaults struct {
MaxTasks int64
MaxTokens int64
MaxToolCalls int64
MaxCostMicroUSD int64
}
WorkflowBudgetDefaults are the §10 workflow-level defaults. Note the kernel's budget-commitment rule (every declared step reserves its task ceiling) makes the illustrative 250k token default unreachable for the 11-step research template; the API server therefore validates request overrides against the kernel decoder and fails closed with the computed floor instead of silently raising the number.
func DefaultWorkflowBudget ¶
func DefaultWorkflowBudget() WorkflowBudgetDefaults
DefaultWorkflowBudget returns the §10 defaults.
type WorkflowView ¶
WorkflowView is the slice of one kernel workflow the state machine needs.