dispatch

package
v0.194.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0, MIT Imports: 34 Imported by: 0 modules, 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

Index

Constants

View Source
const (
	// EnvelopeStatusProposal: an isolated world was sealed and awaits a
	// verdict from the proposal tool.
	EnvelopeStatusProposal = "proposal"
	// EnvelopeStatusReport: an isolated report dispatch finished; the result
	// is the text, and nothing is left to settle.
	EnvelopeStatusReport = "report"
	// EnvelopeStatusShared: a dispatch ran directly on the shared workspace,
	// so whatever it wrote is already applied.
	EnvelopeStatusShared = "shared"
	// EnvelopeStatusRunning: a background dispatch was accepted; the work
	// arrives later as its own completion envelope.
	EnvelopeStatusRunning = "running"
	// EnvelopeStatusCompleted: a background dispatch finished and its result
	// is delivered in `result` (yaah-was9.1).
	EnvelopeStatusCompleted = "completed"
	// EnvelopeStatusError: the dispatch did not complete. `error` says why,
	// `stop_reason` names the kind where one is known, and `recovery` says
	// whether re-dispatching is worth it.
	EnvelopeStatusError = "error"
)

Envelope status values. The set is closed: a lane that cannot describe its outcome with one of these has found a new kind of completion, not a new word for one. The proposal lane keeps its own settlement vocabulary on top (settled, open, conflict), which is a verdict on a proposal rather than a dispatch outcome.

View Source
const (
	SchemaProposalSealed  = "yaah.proposal.sealed.v1"
	SchemaProposalSettled = "yaah.proposal.settled.v1"
)

Runtime-level proposal facts (not kernel ABI): the manifest is a world artifact, but its seal and settlement must still be legible in the causal record. The digest in the fact names exactly which bytes were persisted.

View Source
const NoteBudget = noteBudget

NoteBudget is the exported face of noteBudget for the tools layer.

View Source
const (

	// SchemaProposalConflict records a detected conflict on the parent owner
	// path. It is runtime-level proposal metadata, like the sealed/settled
	// facts, not a kernel ABI.
	SchemaProposalConflict = "yaah.proposal.conflict.v1"
)

Variables

View Source
var (
	WithSubAgentWorldPtr = jobs.WithSubAgentWorldPtr
	ErrStuckChild        = jobs.ErrStuckChild
	ErrDispatchStartup   = jobs.ErrDispatchStartup

	NewPathValidator = substrate.NewPathValidator

	ScrubConfinementScratch        = substrate.ScrubConfinementScratch
	DispatchWorkspace              = substrate.DispatchWorkspace
	OpenContainerdWorkspaceSandbox = substrate.OpenContainerdWorkspaceSandbox
	StartSessionSandbox            = substrate.StartSessionSandbox
	WithDispatchWorkspace          = substrate.WithDispatchWorkspace
	WriteSubAgentWorld             = jobs.WriteSubAgentWorld
	NotifySubAgentReady            = jobs.NotifySubAgentReady
)

Functions

func ContinueRetainedRun added in v0.149.0

func ContinueRetainedRun(ctx context.Context, rt RetainedRuntime, id string, extraTurns int, prompt string, consumeOriginal bool) (string, error)

ContinueRetainedRun re-runs an open worktree proposal with extraTurns more turns, seeded from its captured conversation and its sealed workspace state, and seals the result as a new proposal. When consumeOriginal is set the original is discarded so settlement stays consume-once ("continue"); when clear the original stays settle-able and the new proposal is a branch ("fork"). Container-lane proposals are refused: their world ended at seal.

The continuation's world is a fresh clone seeded with Apply(sealed state) — the same "fork = Create + Apply" recipe provisionRetainedBranch already uses — so each proposal owns its own world and is cleaned up when it settles.

func EnvelopeResultText added in v0.171.0

func EnvelopeResultText(text string) string

EnvelopeResultText returns the raw result text an envelope carries, or the input unchanged when it is not an envelope. RESERVED for yaah-was9.2: consumers that must read a dispatch's prose out of an already-rendered envelope (contract validation, quality-gate verdicts) will use it so the envelope does not hide the model's words behind JSON escaping. There is no production caller yet.

func LaneStatus added in v0.171.0

func LaneStatus(lane string) string

LaneStatus maps a lane onto the status a completed dispatch on it reports. An unset lane is a report: the result is text and nothing is left to settle.

func MarshalProposalEnvelope added in v0.167.1

func MarshalProposalEnvelope(env ProposalEnvelope) string

MarshalProposalEnvelope renders a typed envelope in the model-facing JSON shape. The fallback mirrors the historical behavior: a marshal failure still yields a syntactically valid status frame.

func NormalizeBrokerHosts

func NormalizeBrokerHosts(hosts []string) []string

NormalizeBrokerHosts puts allowlist entries into the form both egress brokers match: trimmed, lower-cased, and without a trailing dot. A padded or upper-cased entry must not behave differently in a container world than it does through the host broker.

func PathKey

func PathKey(p string) string

PathKey is the comparability key for a manifest path on this host. Windows and macOS volume defaults fold case, so two spellings that the host would treat as one file must compare equal — a path-disjoint check that missed that would let apply overwrite the host's own change.

func ProposalContentDigest

func ProposalContentDigest(data []byte) string

ProposalContentDigest is the exported face the tools layer calls through its dispatch_aliases seam.

Types

type DeltaChange

type DeltaChange struct {
	// Path is slash-separated and repo-relative.
	Path string `json:"path"`
	// Kind is "add", "modify", or "delete".
	Kind string `json:"kind"`
	// Mode is the post-image permission bits (the pre-image mode for a delete;
	// it is ignored on apply). The manifest carries regular files only.
	Mode fs.FileMode `json:"mode"`
	// Content is the post-image bytes; empty for a delete.
	Content []byte `json:"content,omitempty"`
}

DeltaChange is one changed path in a GitDelta. Content is the post-image and is empty for a delete.

type DispatchRequest added in v0.167.1

type DispatchRequest struct {
	// Description is a short human label for background jobs and results.
	Description string

	// Prompt is the single user message for the sub-agent.
	Prompt string

	// Lane selects the substrate/output pairing. Empty means proposal.
	Lane Lane

	// Params carries the role, budgets, provider/model, and seed settings.
	Params jobs.SubAgentParams

	// Timeout is the effective deadline. Zero means no timeout.
	Timeout time.Duration

	// Background dispatches asynchronously through BackgroundJobs.
	Background bool

	// Runner is the raw sub-agent runner for shared dispatches and background
	// jobs that do not use the retained runtime.
	Runner jobs.TaskRunner

	// Retained, when non-nil, routes proposal and report lanes through the
	// retained runtime. Nil keeps every dispatch on the shared runner.
	Retained *RetainedRuntime

	// BackgroundJobs manages asynchronous dispatches. Required when
	// Background is set.
	BackgroundJobs *jobs.BackgroundJobs

	// BackgroundContextSeeder, when non-nil, re-attaches caller-scoped context
	// (conflict attribution, inherited permissions) to the background job's
	// session-rooted context. The dispatch core does not inspect it.
	BackgroundContextSeeder func(context.Context) context.Context
}

DispatchRequest is the typed input to Run. The tool adapter parses and validates model-facing arguments, resolves the lane and timeout, then hands the resulting values here. Runtime dependencies travel with the request so the executor can call Run without importing internal/tools.

type DispatchResult added in v0.167.1

type DispatchResult struct {
	Status   DispatchStatus
	Role     string
	Timeout  time.Duration
	Result   string
	Partial  string
	JobID    string
	Label    string
	Proposal *ProposalEnvelope
	Err      error

	// Meta is the dispatch identity and the runner facts the lane could
	// observe (lane, world, model, duration). Envelope() stamps it onto the
	// one result shape every lane returns (yaah-was9.1).
	Meta EnvelopeMeta
}

DispatchResult is the typed outcome of Run. Result is set for a completed report; Partial is set for a run that stopped early; Proposal is set for a retained proposal lane (including a sealed error envelope).

func ClassifyRunnerResult added in v0.167.1

func ClassifyRunnerResult(result string, err error, role string, timeout time.Duration, runCtx context.Context) DispatchResult

ClassifyRunnerResult maps a runner outcome to the typed dispatch result. A non-empty result alongside an error is treated as the partial output the sub-agent produced before stopping.

func Run added in v0.167.1

Run executes one sub-agent dispatch through the runtime's only scheduler and settlement path. It is the typed core behind the delegate tool and the workflow executor.

func (DispatchResult) Envelope added in v0.171.0

func (r DispatchResult) Envelope() ProposalEnvelope

Envelope renders the typed result in the one model-facing completion shape. Every lane goes through it: report and shared lanes for their status, failure lanes for status=error plus recovery, and the proposal lane for the metadata its own envelope does not know.

type DispatchStatus added in v0.167.1

type DispatchStatus string

DispatchStatus is the typed outcome of one dispatch. It is deliberately coarser than the model-facing envelope: the tool adapter renders the status into the existing JSON frames, while the workflow executor switches on it.

const (
	DispatchRunning   DispatchStatus = "running"
	DispatchCompleted DispatchStatus = "completed"
	DispatchProposal  DispatchStatus = "proposal"
	DispatchTimedOut  DispatchStatus = "timed_out"
	DispatchStuck     DispatchStatus = "stuck"
	DispatchCancelled DispatchStatus = "cancelled"
	DispatchFailed    DispatchStatus = "failed"
)

type DispatchWorlds

type DispatchWorlds struct {
	// Config is the workspace stanza (image, namespace, address, snapshotter,
	// fifo_dir, root).
	Config config.WorkspaceConfig
	// Opener constructs the sandbox. Wiring passes
	// OpenContainerdWorkspaceSandbox; tests pass a fake, so no test needs a
	// containerd daemon.
	Opener substrate.SandboxOpener
	// Deny is agents.default.workspace_deny_patterns with its defaults
	// already resolved. It is passed through rather than recomputed: the two
	// substrates must copy the same files in, or a secret readable in one
	// world would be absent from the other.
	Deny []string
	// SessionSandbox is the container session's own sandbox when this dispatch
	// setup belongs to a container session. Its current state seeds each
	// sibling container; a nil value means the host tree is the source (the
	// local-session lane).
	SessionSandbox *substrate.SessionSandbox
}

DispatchWorlds carries what a per-dispatch container world needs. The composition root builds it from the session's workspace config, so the dispatch container and the session container share one image contract and one set of connection settings rather than drifting apart.

type EnvelopeMeta added in v0.171.0

type EnvelopeMeta struct {
	// DispatchID is the per-dispatch id the conflict tracker minted
	// (label#n), or the background job id when the delivery has no other.
	DispatchID string
	// Role is the sub-agent role that ran.
	Role string
	// Lane is the dispatch lane: proposal, report, or shared.
	Lane string
	// World is the world the dispatch actually ran in: worktree, container,
	// or shared.
	World string
	// Model is the model the runner resolved for the child.
	Model string
	// Duration is the wall-clock span of the dispatch.
	Duration time.Duration
}

EnvelopeMeta is the dispatch identity and runner facts every completion envelope carries. It is populated from what the dispatch lane actually knows: a value the lane cannot observe is left empty and therefore omitted, never fabricated.

type GitDelta

type GitDelta struct {
	// BasisRevision is the container baseline's state revision (croft's snapshot
	// key). The manifest's changes are the difference between that state and the
	// workspace at seal time.
	BasisRevision string        `json:"basis_revision"`
	Changes       []DeltaChange `json:"changes"`
}

GitDelta is a container proposal's settlement artifact: the baseline state's revision it was measured against, and one whole-path post-image per changed path.

The name is historical: the artifact was once produced by git plumbing inside the container. It is now the snapshot differ's change set, and the JSON field is basis_revision; nothing about producing or settling it requires a repository.

func (*GitDelta) Paths

func (d *GitDelta) Paths() []string

Paths returns the manifest's changed paths, sorted and deduplicated. The producer emits them sorted, but a manifest read from disk or built by a caller is not assumed to be.

func (*GitDelta) RenderDiff

func (d *GitDelta) RenderDiff() string

RenderDiff renders the manifest as a per-file review. It is the fallback when the seal-time unified diff was not persisted (or is unavailable). The review is honest about what it is: the post-image content, not a reconstruction of the pre-image.

type Lane added in v0.167.1

type Lane string

Lane selects the substrate/output pairing for one dispatch: where the work runs, and what comes back. The delegate tool and the workflow executor share this vocabulary; a nil role resolver keeps the historical proposal lane.

const (
	// LaneProposal: isolated world, sealed delta, orchestrator settles it.
	LaneProposal Lane = "proposal"
	// LaneReport: isolated world, plain report result, world torn down
	// automatically — no proposal, nothing to settle.
	LaneReport Lane = "report"
	// LaneShared: runs directly on the shared workspace, plain report result.
	LaneShared Lane = "shared"
)

type Outcome

type Outcome struct {
	Work   string
	Scope  string
	Record string
	Notes  string
}

Outcome describes what a settle or lifecycle verb actually did, in four orthogonal fields rather than a single one-word status string.

  • Work: what happened to the files (integrated, destroyed, kept, …)
  • Scope: which tree or paths were affected
  • Record: what was persisted so the result is retryable (ids, paths, hashes)
  • Notes: caveats the caller must not ignore

A verb that has nothing to say in a field leaves it empty rather than inventing content, so the rendered form never lies by omission.

func (Outcome) String

func (o Outcome) String() string

String renders the outcome as a single multi-line block. Empty fields are omitted. The block is meant to be embedded in a tool's JSON envelope, so it deliberately avoids any trailing newline.

type PathValidator

type PathValidator = substrate.PathValidator

PathValidator is the substrate path validator.

type ProposalEnvelope

type ProposalEnvelope = proposalEnvelope

ProposalEnvelope is the exported face of proposalEnvelope for the tools layer's tests, which decode retained results through their dispatch seam.

func BackgroundCompletionEnvelope added in v0.171.0

func BackgroundCompletionEnvelope(st jobs.BackgroundJobStatus, result string, err error) ProposalEnvelope

BackgroundCompletionEnvelope renders the one completion envelope for a background dispatch from its terminal job snapshot and raw result. It is the single place that maps a background job's terminal status onto the envelope vocabulary, so the foreground and background lanes agree (yaah-was9.1).

func ParseEnvelopeResult added in v0.171.0

func ParseEnvelopeResult(text string) (ProposalEnvelope, bool)

ParseEnvelopeResult reparses a lane's already-rendered result as an envelope. The retained lanes render their own envelope to text (the background job contract carries a string), so a delivery that only has the final text must not wrap it a second time. RESERVED for yaah-was9.2 (response-contract validation), which must reparse a delivered envelope to check its fields; there is no production caller yet.

type ProposalRegistry

type ProposalRegistry struct {
	// contains filtered or unexported fields
}

ProposalRegistry is one session's registry of open proposals. A proposal outlives the dispatch call that sealed it — the orchestrator settles it later — but it never leaves the session that owns it: under `web` or `acp-serve`, one session's tool must not list, show (which prints the diff), or settle another session's work (yaah-yox).

func LoadProposalRegistry

func LoadProposalRegistry(repoPath string, mgr *goatherd.ScopeManager, rootScopeID, sessionID string) (*ProposalRegistry, []string)

LoadProposalRegistry rebuilds the container-proposal registry from the durable artifacts under <repo>/.yaah/proposals. It is scoped to one session by the durable session id recorded at seal (the old parent scope id is the fallback for artifacts written before that field existed), so two sessions in the same repository never see each other's proposals. The rehydrated proposal is bound to the *current* root scope, because a restart gives the session a new one while the host basis is persisted with the manifest.

Bad artifacts are reported and skipped, never applied: a manifest without a matching basis, a digest mismatch, or an interrupted-settlement marker is a reason to stop and inspect, not to guess. A proposal that was already settled (settled marker present, or its directory removed after the host write) is consumed rather than resurrected.

func NewProposalRegistry

func NewProposalRegistry() *ProposalRegistry

NewProposalRegistry returns an empty registry for one session.

func (*ProposalRegistry) PendingScopeIDs

func (r *ProposalRegistry) PendingScopeIDs() []string

PendingScopeIDs lists the scope IDs of open proposals awaiting settlement. The scope reaper's live set includes them: an open proposal keeps its scope active on purpose, so the reaper must not treat it as an orphan (yaah-95ri.4).

func (*ProposalRegistry) Summaries

func (r *ProposalRegistry) Summaries() string

Summaries is the exported face of summaries for the tools layer's tests.

type ProposalTool

type ProposalTool struct {
	// Proposals is the session's registry of open proposals, created by
	// runner.NewDelegateTool alongside the retained runtime and passed to this
	// tool at wiring. A session can only ever list, show, or settle its own
	// proposals (yaah-yox). Required: without it the tool refuses to execute
	// rather than falling back to a shared registry.
	Proposals *ProposalRegistry
	// Runtime is the session's retained runtime (runner + scopes), needed to
	// re-run a proposal for continue/fork. Nil leaves settlement available and
	// refuses continue/fork rather than guessing a runner.
	Runtime *RetainedRuntime
}

ProposalTool settles retained sub-agent proposals (Plan 7 Phase 2). A retained dispatch runs a sub-agent in its bound world — an isolated git worktree, or a per-dispatch container — and seals the work into a proposal; the orchestrator reads it and settles it once. A worktree proposal settles through the kernel's state-based verbs: select (fast-forward), apply (three-way, path-disjoint), release (export the delta, then tear the worktree down), or discard (throw it away and remove its worktree). A container proposal settles as a GitDelta manifest: select (fast-forward onto the dispatch basis), apply (whole-path, path-disjoint), release (export the manifest), or discard. The verbs mirror Shepherd's run select | apply | release | discard.

func (*ProposalTool) Description

func (*ProposalTool) Description() string

func (*ProposalTool) Execute

func (t *ProposalTool) Execute(ctx context.Context, args string) (string, error)

func (*ProposalTool) IsDangerous added in v0.166.0

func (t *ProposalTool) IsDangerous(argsJSON string) bool

IsDangerous reports whether the action settles or extends a proposal. list and show only read.

func (*ProposalTool) Name

func (*ProposalTool) Name() string

func (*ProposalTool) Schema

func (*ProposalTool) Schema() json.RawMessage

type ResultArtifacts added in v0.171.0

type ResultArtifacts struct {
	ProposalID string   `json:"proposal_id,omitempty"`
	Files      []string `json:"files,omitempty"`
	Diff       string   `json:"diff,omitempty"`
}

ResultArtifacts is the nested view of the work a dispatch produced. It duplicates the envelope's top-level proposal_id/files/diff on purpose: those flat fields are the settlement contract the proposal tool and the model already read, and a nested block is where a lane can add artifacts without widening that contract.

type ResultContract added in v0.171.0

type ResultContract struct {
	// Name is the contract the result is checked against, usually the role.
	Name string `json:"name,omitempty"`
	// Status is the contract's verdict: pass, fail, or incomplete.
	Status string `json:"status,omitempty"`
}

ResultContract is RESERVED for yaah-was9.2: the per-role completion contract a sub-agent result is checked against. Nothing populates it yet, so the field is absent from every envelope today. It is present in the type (and documented) so the child lands a field rather than a shape change, and so no caller reads its absence as "checked and passed".

type ResultRecovery added in v0.171.0

type ResultRecovery struct {
	// Retryable reports that dispatching again (or continuing an open
	// proposal) can make progress. False does not mean "fatal" — it means the
	// stop was deliberate (completed, halted) or already final.
	Retryable bool `json:"retryable"`
	// Recommended is short next-step guidance for a retryable stop.
	Recommended string `json:"recommended,omitempty"`
}

ResultRecovery answers the question every caller asks of a dispatch that did not simply complete: is re-running it worth anything, and what should the next call look like? It is derived from stop_reason, never guessed from prose.

func RecoveryFor added in v0.171.0

func RecoveryFor(stopReason string) *ResultRecovery

RecoveryFor derives retryable/recommended from a stop_reason. Budget and deadline stops are retryable through continue/fork (the sealed work survives); a cancelled or provider-errored run is worth re-dispatching; completed and halted runs are not automatically repeatable.

type RetainedRunError

type RetainedRunError struct {
	// contains filtered or unexported fields
}

RetainedRunError is a report-lane body failure carrying the lane's caveat out of band. The caveat used to be appended to the result and parsed back out with a "note: " search, but the result is model output: a report that legitimately contains (or opens with) a "note: " line was cut there and the remainder re-labelled as the caveat. An error wrapper keeps the two apart.

Error renders body failure plus caveat so a caller that only sees the error (the background lane delivers result and error separately) still keeps the caveat; Unwrap exposes the cause for errors.Is/As classification.

func NewRetainedRunError

func NewRetainedRunError(cause error, note string) *RetainedRunError

NewRetainedRunError builds a retained failure with its caveat. The tools layer (and its tests) construct failures through this because the fields stay unexported.

func (*RetainedRunError) Cause

func (e *RetainedRunError) Cause() error

Cause returns the underlying failure a retained note rides with. The tools layer reads it through this accessor because the fields stay unexported.

func (*RetainedRunError) Error

func (e *RetainedRunError) Error() string

func (*RetainedRunError) Note

func (e *RetainedRunError) Note() string

Note returns the caveat (a stranded worktree, a provisioning problem) the retained failure carries out of band.

func (*RetainedRunError) Unwrap

func (e *RetainedRunError) Unwrap() error

type RetainedRuntime

type RetainedRuntime struct {
	// Runner is the sub-agent execution closure (the same one delegate
	// uses). Required.
	Runner jobs.TaskRunner
	// RepoPath is the git repository the worktree is cut from.
	RepoPath string
	// ScopeManager is the session's scope registry. Required: a retained run
	// forks an isolated scope through it.
	ScopeManager *goatherd.ScopeManager
	// RootScopeID is the session's root scope — the fork parent, and the merge
	// target a settlement applies to. Required.
	RootScopeID string
	// SessionID is the durable session identity. Container proposals persist
	// it so a resumed session can rehydrate its own artifacts without another
	// session in the same repository claiming them.
	SessionID string
	// WorktreeRoot is the parent directory for retained worktrees. Empty
	// defaults to ".yaah/shepherd-worktrees" inside the repository working
	// tree (project-local).
	WorktreeRoot string
	// WorktreeBootstrap runs inside each worktree after creation, for repos
	// whose build needs gitignored artifacts.
	WorktreeBootstrap string
	// Proposals is the session's registry of open proposals: the dispatch
	// records a sealed proposal here and the proposal tool settles it from
	// here. Required when the retained lane is live: runner.NewDelegateTool
	// creates one per session at construction (yaah-yox), so isolation is a
	// property of building the runtime rather than of a later wiring step.
	Proposals *ProposalRegistry

	// MaxDispatchScopes caps concurrently ACTIVE dispatch scopes (0 =
	// jobs.DefaultMaxDispatchScopes). A container or worktree fork refused
	// at the cap fails fast with jobs.ErrScopeExhausted instead of
	// provisioning into a saturated scope tree (yaah-95ri.4).
	MaxDispatchScopes int

	// ResumedScopes is the scope-ID set startup recovery re-admitted from
	// the trace (yaah-95ri.7). Those scopes hold no loop and provision no
	// world in this process, so the dispatch cap must not count them —
	// dead work from a crashed run must never refuse a live dispatch. Nil
	// means none.
	ResumedScopes map[string]bool

	// World is the configured dispatch world (agents.subagent.world:
	// auto | worktree | container). Empty means auto. WorldForRole supplies a
	// per-role override; nil means no override.
	World        string
	WorldForRole func(role string) string

	// Containment and Network are the configured authority axes for a
	// confined dispatch. They participate in world resolution because a
	// fallback is legal only when it can still enforce them. NetworkHosts is
	// the broker allowlist and matters only with Network "broker".
	Containment  string
	Network      string
	NetworkHosts []string

	// Grants is the configured dispatch grant set; GrantsForRole supplies a
	// per-role override. They participate in world resolution because an
	// advisory world cannot enforce a restrictive set.
	Grants        []config.GrantConfig
	GrantsForRole func(role string) []config.GrantConfig

	// ContainerWorlds reports whether this session can attempt a per-dispatch
	// container world (yaah-ihfh.3). It is true only in a host session whose
	// config names a container image; a session that offers no container world
	// degrades silently to the worktree, while an explicitly requested
	// container fails closed.
	ContainerWorlds bool

	// DispatchWorlds is the setup a per-dispatch container needs: the same
	// workspace.containerd stanza the session container uses, the backend
	// opener, and the resolved copy-in deny list. Nil when this session cannot
	// offer one, in which case a report dispatch runs in the worktree world.
	DispatchWorlds *DispatchWorlds
	// contains filtered or unexported fields
}

RetainedRuntime carries the wiring a retained dispatch needs. It is injected by the composition root.

func (*RetainedRuntime) BeginDispatchScope

func (rt *RetainedRuntime) BeginDispatchScope(id string)

BeginDispatchScope marks a container or worktree dispatch scope as in flight so the scope reaper spares it for as long as the dispatch runs (yaah-95ri.6). Accepts either the raw owner id or the kernel scope-ID form.

func (*RetainedRuntime) EndDispatchScope

func (rt *RetainedRuntime) EndDispatchScope(id string)

EndDispatchScope clears a dispatch scope's in-flight mark. Accepts either form; see dispatchScopeKey.

func (*RetainedRuntime) EnsureInFlight

func (rt *RetainedRuntime) EnsureInFlight()

EnsureInFlight initializes the shared in-flight live set. Call once at construction, before the runtime is copied into the dispatch paths (yaah-95ri.6).

func (*RetainedRuntime) InFlightDispatchScopeIDs

func (rt *RetainedRuntime) InFlightDispatchScopeIDs() []string

InFlightDispatchScopeIDs returns the in-flight dispatch scope IDs unioned with pending retained-proposal scope IDs — the scope reaper's live-set complement: these scopes are mid-dispatch or awaiting settlement and must never be reaped, however long the dispatch runs (yaah-95ri.6).

func (*RetainedRuntime) PendingProposalScopeIDs

func (rt *RetainedRuntime) PendingProposalScopeIDs() []string

PendingProposalScopeIDs exposes the open proposals' scope IDs for the scope reaper's live set (yaah-95ri.4).

type SandboxOpener

type SandboxOpener = substrate.SandboxOpener

SandboxOpener opens a sandbox for a session world.

type SettleOpts added in v0.167.1

type SettleOpts struct {
	// Strategy is "path_disjoint" (default) or "three_way" (worktree apply
	// only).
	Strategy string
}

SettleOpts carries the only settlement choice a caller may make: the apply strategy. Other settlement behavior is fixed by the world.

type SettleVerb added in v0.167.1

type SettleVerb string

SettleVerb is the fixed settlement vocabulary. There is no extension point: every world settles with exactly these four verbs.

const (
	SettleSelect  SettleVerb = "select"
	SettleApply   SettleVerb = "apply"
	SettleRelease SettleVerb = "release"
	SettleDiscard SettleVerb = "discard"
)

type Settlement added in v0.167.1

type Settlement struct {
	ProposalEnvelope
	Action  SettleVerb
	Outcome Outcome
}

Settlement is the typed outcome of one settlement. The envelope fields are the model-facing record; Outcome is the typed work/scope/record/notes block, not a prose status the caller has to re-parse. A conflict is an outcome, not an error: the envelope names the overlap and the proposal stays open.

func Settle added in v0.167.1

func Settle(ctx context.Context, registry *ProposalRegistry, id string, verb SettleVerb, opts SettleOpts) (Settlement, error)

Settle settles one proposal through the registry's only settlement path. The proposal id, verb, and strategy are the complete input; the registry owns all world-specific behavior.

func (Settlement) Envelope added in v0.167.1

func (s Settlement) Envelope() ProposalEnvelope

Envelope renders the model-facing JSON shape, with the typed outcome folded into the single rendered block the proposal schema advertises.

type SubAgentParams

type SubAgentParams = jobs.SubAgentParams

SubAgentParams is the sub-agent dispatch parameter set.

type SubAgentWorld

type SubAgentWorld = jobs.SubAgentWorld

SubAgentWorld is the jobs I/O contract descriptor.

type TaskRunner

type TaskRunner = jobs.TaskRunner

TaskRunner is the sub-agent run function signature.

type Workspace

type Workspace = substrate.Workspace

Workspace is the substrate workspace port.

Jump to

Keyboard shortcuts

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