Documentation
¶
Overview ¶
Package application owns SDD's protocol-neutral runtime, public request and result types, and the infrastructure ports implemented by embedding hosts.
Index ¶
- Constants
- Variables
- func AttachmentDirRelPath(entryID string) (string, error)
- func ClientLabel(name string) string
- func MutationBatchDigest(batch MutationBatch) (string, error)
- func SupportedSessionCodecVersion(version uint32) bool
- type Access
- type AccessResolver
- type AcquiredTarget
- type Application
- func (a *Application) AbandonWorkflowSession(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (WorkflowAbandonResult, error)
- func (a *Application) ApplyPrepared(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (TransitionResult, error)
- func (a *Application) CollectSessions(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (CollectSessionsResult, error)
- func (a *Application) CreateEntry(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (CreateEntryResult, error)
- func (a *Application) CurrentSnapshot(ctx context.Context, identity RequestIdentity, project ProjectID) (*Snapshot, error)
- func (a *Application) FinishWIP(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (MutationResult, error)
- func (a *Application) Info(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (InfoResult, error)
- func (a *Application) ListRecoveries(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (RecoveryList, error)
- func (a *Application) ListWorkflowSessions(ctx context.Context, identity RequestIdentity, project ProjectID) ([]WorkflowSessionSummary, error)
- func (a *Application) OpenWorkflow(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (*WorkflowSession, *WorkflowServe, error)
- func (a *Application) Procedures(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (ProcedureListResult, error)
- func (a *Application) ReadAttachment(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (ReadAttachmentResult, error)
- func (a *Application) ReconcileMutation(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (result RecoveryResult, err error)
- func (a *Application) RecoverMutation(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (result RecoveryResult, err error)
- func (a *Application) ReleaseSession(ctx context.Context, identity RequestIdentity, project ProjectID, ...) error
- func (a *Application) ReplaceSummary(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (MutationResult, error)
- func (a *Application) ResumeWorkflow(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (*WorkflowSession, WorkflowResumeResult, error)
- func (a *Application) Search(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (result SearchResult, err error)
- func (a *Application) Show(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (result ShowResult, err error)
- func (a *Application) StageBlob(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (StagedBlob, error)
- func (a *Application) StartWIP(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (string, MutationResult, error)
- func (a *Application) View(ctx context.Context, identity RequestIdentity, project ProjectID, ...) (result ViewResult, err error)
- func (a *Application) Vocabulary(ctx context.Context, identity RequestIdentity, project ProjectID) (string, error)
- type ApplicationError
- type AppliedMutation
- type ApplyResult
- type ApplyState
- type Attachment
- type AttachmentMaterialization
- type AttachmentPage
- type Author
- type BlobDigest
- type BranchValidator
- type BranchValidatorFunc
- type CanonicalChunk
- type ChooserKind
- type CollectSessionsCmd
- type CollectSessionsResult
- type CreateEntryResult
- type DocumentChange
- type DocumentIssue
- type EmbeddingExecutor
- type EmbeddingExecutorFuncs
- type EmbeddingInput
- type EmbeddingPurpose
- type EmbeddingSpec
- type EmbeddingVector
- type EntryDocument
- type EntryDraft
- type EntryRef
- type ErrorCode
- type FactIndex
- type FactIndexRow
- type FinalizerOutcome
- type Finding
- type FixedTargetAcquirer
- type GraphStore
- type IndexNamespace
- type IndexedChunk
- type InfoRequest
- type InfoResult
- type LLMExecutor
- type LLMExecutorFuncs
- type LLMRequest
- type LLMResult
- type LLMUsage
- type MutationBatch
- type MutationFinalizer
- type MutationResult
- type MutationTarget
- type PreparedTransition
- type Principal
- type ProcedureListRequest
- type ProcedureListResult
- type ProjectAction
- type ProjectConfigDocument
- type ProjectID
- type ProjectList
- type ProjectRef
- type ProjectRuntime
- type ProjectRuntimeOptions
- type ProjectState
- type ProjectSummary
- type ReadAttachmentRequest
- type ReadAttachmentResult
- type RecoveryAccessRequest
- type RecoveryAuthorizer
- type RecoveryAuthorizerFunc
- type RecoveryItem
- type RecoveryList
- type RecoveryReason
- type RecoveryReconcileRequest
- type RecoveryRequest
- type RecoveryResult
- type RecoveryState
- type RecoveryVerb
- type RegistryFunction
- type RequestIdentity
- type ScoredChunkHit
- type SearchIndexEntryManifest
- type SearchIndexStore
- type SearchIndexStoreFuncs
- func (f SearchIndexStoreFuncs) Manifest(ctx context.Context, namespace IndexNamespace) ([]StoredChunkRef, error)
- func (f SearchIndexStoreFuncs) Nearest(ctx context.Context, namespaces []IndexNamespace, vector []float32, limit int) ([]ScoredChunkHit, error)
- func (f SearchIndexStoreFuncs) Reconcile(ctx context.Context, namespace IndexNamespace, revision string, ...) error
- type SearchRequest
- type SearchResult
- type SessionAppend
- type SessionBinding
- type SessionEnd
- type SessionEndAct
- type SessionFilter
- type SessionID
- type SessionMetadata
- type SessionRef
- type SessionStore
- type ShowRequest
- type ShowResult
- type Snapshot
- type SnapshotData
- type StagedBlob
- type StagedBlobReader
- type StagedBlobStore
- type StoredChunkRef
- type StoredEntryRef
- type StoredEvent
- type StoredSession
- type TargetAcquirer
- type TargetAcquirerFunc
- type TransitionResult
- type ValidationError
- type ViewRequest
- type ViewResult
- type WIPDocument
- type WorkflowAbandonResult
- type WorkflowAdvanceRequest
- type WorkflowChooser
- type WorkflowChooserOption
- type WorkflowInstanceSummary
- type WorkflowOpenRequest
- type WorkflowParkResult
- type WorkflowResumeRequest
- type WorkflowResumeResult
- type WorkflowServe
- type WorkflowSession
- func (w *WorkflowSession) Abandon(ctx context.Context, identity RequestIdentity, instance, reason string) (WorkflowAbandonResult, error)
- func (w *WorkflowSession) Advance(ctx context.Context, identity RequestIdentity, request WorkflowAdvanceRequest) (*WorkflowServe, error)
- func (w *WorkflowSession) BindBranch(ctx context.Context, identity RequestIdentity, branch string, clear bool) error
- func (w *WorkflowSession) Binding() SessionBinding
- func (w *WorkflowSession) Branch() string
- func (w *WorkflowSession) Finished() bool
- func (w *WorkflowSession) Framing(ctx context.Context, identity RequestIdentity) ([]string, error)
- func (w *WorkflowSession) ID() SessionID
- func (w *WorkflowSession) IsShell(instance string) bool
- func (w *WorkflowSession) Leave(ctx context.Context, identity RequestIdentity) error
- func (w *WorkflowSession) LogRead(ctx context.Context, identity RequestIdentity, tool string, ...) error
- func (w *WorkflowSession) OpenInstances() []WorkflowInstanceSummary
- func (w *WorkflowSession) Park(ctx context.Context, identity RequestIdentity, instance, note string) (WorkflowParkResult, error)
- func (w *WorkflowSession) Project() ProjectID
- func (w *WorkflowSession) Reopen(ctx context.Context, identity RequestIdentity, label string) (*WorkflowServe, error)
- func (w *WorkflowSession) ServeAll(ctx context.Context, identity RequestIdentity) (WorkflowResumeResult, error)
- func (w *WorkflowSession) ServeShell(ctx context.Context, identity RequestIdentity) (*WorkflowServe, error)
- func (w *WorkflowSession) StageAttachment(ctx context.Context, identity RequestIdentity, filename string, content []byte) (string, error)
- func (w *WorkflowSession) Start(ctx context.Context, identity RequestIdentity, request WorkflowStartRequest) (*WorkflowServe, error)
- func (w *WorkflowSession) StillHeld(ctx context.Context, identity RequestIdentity) (bool, error)
- type WorkflowSessionSummary
- type WorkflowStartRequest
Constants ¶
const ( DefaultShowUpDepth = query.DefaultUpDepth DefaultShowDownDepth = query.DefaultDownDepth )
Default show expansion depths favor grounding context while keeping the typically wider consumer side shallow.
const ( LegacyPreparedTransitionVersion uint32 = 1 PreparedTransitionVersion uint32 = 2 )
const ( WorkflowEventCode = "workflow_event" BranchBoundEventCode = "branchBound" BranchClearedEventCode = "branchCleared" DefaultShellCanonical = "user-dialogue" WorkflowMaxLabelLength = 120 ExecutionForkPreferred = "fork-preferred" )
const FirstSessionCodecVersion uint32 = 1
FirstSessionCodecVersion is the oldest persisted session codec this binary still reads.
const NewSessionNote = "" /* 219-byte string literal not displayed */
NewSessionNote is the single statement of the way on from a dialogue that has ended: concluding is terminal, so continuing means a new session under a new handle rather than a revival of the spent one (d-tac-k4q). It is composed into the conclude serve and into every refusal an ended session answers with, so each surface names the same one path that works.
const RecordedStateOnlyNote = "" /* 127-byte string literal not displayed */
RecordedStateOnlyNote is the single statement of the takeover fidelity limit, composed into the consent refusal and the successful-attach note so both runtime surfaces read identically.
const SessionCodecVersion uint32 = 1
const SessionRecencyWindow = 15 * time.Minute
SessionRecencyWindow is the single threshold separating an active attachment from an idle one. Erring long is cheap, so it is generous.
Variables ¶
var ErrSessionNotFound = errors.New("sdd: session not found")
Functions ¶
func AttachmentDirRelPath ¶
AttachmentDirRelPath returns the graph-relative attachment directory for an entry ID.
func ClientLabel ¶
ClientLabel names a client for a conflict or consent message, falling back when the transport carried no client name (e.g. bare stdio).
func MutationBatchDigest ¶
func MutationBatchDigest(batch MutationBatch) (string, error)
MutationBatchDigest returns the SDD-owned digest over a storage-neutral batch. The Digest field itself is excluded.
func SupportedSessionCodecVersion ¶
SupportedSessionCodecVersion reports whether a persisted codec version is one this binary can read. Read-compatibility with every shape sdd has written is permanent (d-cpt-i2x), so the whole range through the current version is accepted and superseded shapes are converted at decode; only a version this binary predates is a migration error.
Types ¶
type AccessResolver ¶
type AccessResolver interface {
ResolvePrincipal(context.Context, RequestIdentity) (Principal, error)
ListProjects(context.Context, Principal) (ProjectList, error)
ResolveProject(context.Context, Principal, ProjectID, Access) (*ProjectRuntime, error)
ResolveDependency(context.Context, Principal, ProjectID, string) (*ProjectRuntime, error)
}
AccessResolver is the single identity, project-access, and dependency authorization boundary. Implementations must resolve current authorization from ctx on every call; previously returned principals and runtimes are not proof of current access.
type AcquiredTarget ¶
type AcquiredTarget struct {
Target MutationTarget
Graph GraphStore
Finalizers []MutationFinalizer
Release func() error
}
AcquiredTarget contains target-scoped adapters for one short operation. Release is mandatory and is called on every success and failure path.
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application resolves current access and dispatches protocol-neutral SDD operations. Every method resolves identity and project afresh.
func NewApplication ¶
func NewApplication(access AccessResolver) (*Application, error)
func (*Application) AbandonWorkflowSession ¶
func (a *Application) AbandonWorkflowSession(ctx context.Context, identity RequestIdentity, project ProjectID, request WorkflowResumeRequest, reason string) (WorkflowAbandonResult, error)
AbandonWorkflowSession tears down a session by handle without ever becoming its attachment: it replays into a buffering sink (no claim, no stamp, no displacement), abandons the instances, then records the terminal abandon and drops whatever stamp was held in one final append. A mid-teardown failure returns before that append, so the victim's attachment stays intact — honest state, no phantom hold. A session another client is actively driving is refused: destruction must not be cheaper than attachment (I5).
func (*Application) ApplyPrepared ¶
func (a *Application) ApplyPrepared(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, prepared PreparedTransition) (TransitionResult, error)
ApplyPrepared durably records intent before canonical apply and outcome afterward. Unknown apply outcomes retain staged blobs for reconciliation; definitive outcomes release them after all applied finalizers succeed.
func (*Application) CollectSessions ¶
func (a *Application) CollectSessions( ctx context.Context, identity RequestIdentity, project ProjectID, cmd CollectSessionsCmd, ) (CollectSessionsResult, error)
CollectSessions removes the sessions that are safe to remove and drains the pending declarations that can never converge.
The pass is lock-free and optimistic. An ended session is never written to again, so two processes starting at once derive the same target set and both simply delete; an already-deleted target is success. The target set is recomputed from scratch every run, so a partially removed session is finished by the next pass and there is nothing to reconcile after an interruption.
What it protects, and the whole of it: it never removes a session that has not ended, one inside its retention window, one an in-flight declaration still claims, or one this binary cannot read — an unreadable log may belong to a newer version, so it is left alone rather than treated as garbage.
func (*Application) CreateEntry ¶
func (a *Application) CreateEntry(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, draft EntryDraft) (CreateEntryResult, error)
CreateEntry runs SDD-owned validation and pre-flight, prepares canonical document/blob facts, then enters the durable transition protocol.
func (*Application) CurrentSnapshot ¶
func (a *Application) CurrentSnapshot(ctx context.Context, identity RequestIdentity, project ProjectID) (*Snapshot, error)
CurrentSnapshot resolves current read access and returns the opaque canonical snapshot for protocol adapters that host SDD's engine.
func (*Application) FinishWIP ¶
func (a *Application) FinishWIP(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, target MutationTarget, markerID string) (MutationResult, error)
func (*Application) Info ¶
func (a *Application) Info(ctx context.Context, identity RequestIdentity, project ProjectID, _ InfoRequest) (InfoResult, error)
func (*Application) ListRecoveries ¶
func (a *Application) ListRecoveries(ctx context.Context, identity RequestIdentity, project ProjectID, includeClosed bool) (RecoveryList, error)
ListRecoveries is a free read projection. Closed terminal history is included only when requested; actionable states never perform acquisition or replay.
func (*Application) ListWorkflowSessions ¶
func (a *Application) ListWorkflowSessions(ctx context.Context, identity RequestIdentity, project ProjectID) ([]WorkflowSessionSummary, error)
func (*Application) OpenWorkflow ¶
func (a *Application) OpenWorkflow(ctx context.Context, identity RequestIdentity, project ProjectID, request WorkflowOpenRequest) (*WorkflowSession, *WorkflowServe, error)
func (*Application) Procedures ¶
func (a *Application) Procedures(ctx context.Context, identity RequestIdentity, project ProjectID, _ ProcedureListRequest) (ProcedureListResult, error)
func (*Application) ReadAttachment ¶
func (a *Application) ReadAttachment(ctx context.Context, identity RequestIdentity, project ProjectID, request ReadAttachmentRequest) (ReadAttachmentResult, error)
func (*Application) ReconcileMutation ¶
func (a *Application) ReconcileMutation(ctx context.Context, identity RequestIdentity, project ProjectID, request RecoveryReconcileRequest) (result RecoveryResult, err error)
ReconcileMutation refreshes one actionable recovery projection without choosing a terminal or graph-affecting verb. It exists for interactive clients that must present actions from current target evidence instead of guessing from a durable projection that may predate reconciliation.
func (*Application) RecoverMutation ¶
func (a *Application) RecoverMutation(ctx context.Context, identity RequestIdentity, project ProjectID, request RecoveryRequest) (result RecoveryResult, err error)
RecoverMutation performs exactly one explicitly authorized verb. It always reconciles a freshly acquired concrete target before any graph-affecting or terminal action and never runs from startup, resume, or read surfaces.
func (*Application) ReleaseSession ¶
func (a *Application) ReleaseSession(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding) error
ReleaseSession clears this connection's own live attachment stamp so the session stops reading held. Nothing is recorded: stepping away is transport, not an act on the dialogue (d-cpt-rw7). Releasing means "clear MY stamp", so when the current attachment is absent or belongs to another MCP session — already displaced, ended, or taken over — it is a no-op.
func (*Application) ReplaceSummary ¶
func (a *Application) ReplaceSummary(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, target MutationTarget, entryID, summary string) (MutationResult, error)
func (*Application) ResumeWorkflow ¶
func (a *Application) ResumeWorkflow(ctx context.Context, identity RequestIdentity, project ProjectID, request WorkflowResumeRequest) (*WorkflowSession, WorkflowResumeResult, error)
ResumeWorkflow attaches this connection to an existing session, enforcing structural consent (I5): crossing into a session this connection does not already hold requires the user's verbatim ask, and displacing a recent attachment additionally requires an explicit takeover.
func (*Application) Search ¶
func (a *Application) Search(ctx context.Context, identity RequestIdentity, project ProjectID, request SearchRequest) (result SearchResult, err error)
func (*Application) Show ¶
func (a *Application) Show(ctx context.Context, identity RequestIdentity, project ProjectID, request ShowRequest) (result ShowResult, err error)
func (*Application) StageBlob ¶
func (a *Application) StageBlob(ctx context.Context, identity RequestIdentity, project ProjectID, ref SessionRef, filename string, content []byte) (StagedBlob, error)
StageBlob resolves current read access before placing immutable bytes in session-scoped scratch. Canonical write access is checked later at the mutation gate, so read-only principals can still conduct dialogue.
func (*Application) StartWIP ¶
func (a *Application) StartWIP(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, target MutationTarget, entryID, description string) (string, MutationResult, error)
func (*Application) View ¶
func (a *Application) View(ctx context.Context, identity RequestIdentity, project ProjectID, request ViewRequest) (result ViewResult, err error)
func (*Application) Vocabulary ¶
func (a *Application) Vocabulary(ctx context.Context, identity RequestIdentity, project ProjectID) (string, error)
type ApplicationError ¶
type ApplicationError struct {
Code ErrorCode
Message string
Project ProjectRef
Action *ProjectAction
ApplyState ApplyState
Revision string
Version uint32
Cause error
// Attachment and Ended carry the interpreted conflict on an
// ErrorSessionDisplaced, ErrorConsentRequired or ErrorSessionEnded: who holds
// the session now, or the act that ended it, so the caller can be told
// who/when/why.
Attachment *Attachment
Ended *SessionEnd
}
func (*ApplicationError) Error ¶
func (e *ApplicationError) Error() string
func (*ApplicationError) Unwrap ¶
func (e *ApplicationError) Unwrap() error
type AppliedMutation ¶
type AppliedMutation struct {
Project ProjectID
BatchID string
Revision string
Batch MutationBatch
}
type ApplyResult ¶
type ApplyResult struct {
State ApplyState
Revision string
}
type ApplyState ¶
type ApplyState string
const ( MutationNotApplied ApplyState = "not_applied" MutationApplied ApplyState = "applied" MutationUnknown ApplyState = "unknown" )
type Attachment ¶
type Attachment struct {
Subject string
ClientName string
ClientVersion string
MCPSessionID string
LastActivity time.Time
UserWords string `json:",omitempty"`
}
Attachment is the ephemeral stamp of the client currently driving the session: integrity comes from CAS on append, and status is derived from LastActivity recency. UserWords records the user's verbatim ask that authorized this attachment.
type AttachmentMaterialization ¶
type AttachmentMaterialization struct {
BlobID string
Digest BlobDigest
Size int64
SourceName string
LogicalPath string
}
type AttachmentPage ¶
type BlobDigest ¶
type BranchValidator ¶
type BranchValidator interface {
ValidateBranch(context.Context, MutationTarget) error
}
BranchValidator resolves branch authority without opening graph adapters or finalizers. It is the declare-time half of TargetAcquirer: local compositions use the same live checkout rule for both.
type BranchValidatorFunc ¶
type BranchValidatorFunc func(context.Context, MutationTarget) error
BranchValidatorFunc adapts a function to BranchValidator.
func (BranchValidatorFunc) ValidateBranch ¶
func (f BranchValidatorFunc) ValidateBranch(ctx context.Context, target MutationTarget) error
type CanonicalChunk ¶
type CanonicalChunk struct {
ID string
EntryID string
Ordinal int
// Revision is deprecated: graph revision is a mutation-concurrency token,
// never a vector-freshness token (d-cpt-65i). Reconciliation and hit
// validity ignore it. Retained only for source compatibility.
Revision string
ContentHash string
Text string
// The following persisted citation and identity fields carry everything a
// store needs to render a citation and answer entry-presence queries
// without re-deriving chunks. Both the CLI indexer and the application
// vector search populate them through the shared chunk-derivation helper.
Body string
Breadcrumb []string
Depth int
IsSummary bool
IsAttachment bool
SourceAttachmentPath string
// EntryHash is the entry-state hash (entry content + summary + attachment
// bytes) — the same definition as the CLI manifest state hash.
EntryHash string
}
type ChooserKind ¶
type ChooserKind string
ChooserKind classifies who answers a pending chooser, mirrored from the engine for the served workflow response.
type CollectSessionsCmd ¶
CollectSessionsCmd asks for one reclamation pass over a project's session store. Retention is how long an ended session is kept; zero means remove as soon as it has ended.
type CollectSessionsResult ¶
type CollectSessionsResult struct {
RemovedSessions []SessionID
RemovedStaged []SessionRef
DrainedIntents int
Skipped []SessionID
}
CollectSessionsResult reports what one pass did. Nothing here is actionable — the pass either removed something or deliberately left it, and the skips say which sessions it could not read so a caller can log them.
type CreateEntryResult ¶
type CreateEntryResult struct {
Project ProjectRef
Binding SessionBinding
EntryID string
Summary string
Findings []Finding
}
type DocumentChange ¶
type DocumentChange struct {
LogicalPath string
Document *EntryDocument
CanonicalBytes []byte
Delete bool
}
DocumentChange is storage-neutral. CanonicalBytes are rendered once by SDD; Document is present when the logical artifact has structured entry form.
type DocumentIssue ¶
DocumentIssue names one document a store could not decode: its logical path and the decode error message.
type EmbeddingExecutor ¶
type EmbeddingExecutor interface {
Spec(context.Context) (EmbeddingSpec, error)
Embed(context.Context, []EmbeddingInput) ([]EmbeddingVector, error)
}
type EmbeddingExecutorFuncs ¶
type EmbeddingExecutorFuncs struct {
SpecFunc func(context.Context) (EmbeddingSpec, error)
EmbedFunc func(context.Context, []EmbeddingInput) ([]EmbeddingVector, error)
}
EmbeddingExecutorFuncs adapts mechanical embedding functions to the public executor port.
func (EmbeddingExecutorFuncs) Embed ¶
func (f EmbeddingExecutorFuncs) Embed(ctx context.Context, inputs []EmbeddingInput) ([]EmbeddingVector, error)
func (EmbeddingExecutorFuncs) Spec ¶
func (f EmbeddingExecutorFuncs) Spec(ctx context.Context) (EmbeddingSpec, error)
type EmbeddingInput ¶
type EmbeddingInput struct {
ID string
Text string
Purpose EmbeddingPurpose
}
type EmbeddingPurpose ¶
type EmbeddingPurpose string
const ( EmbeddingDocument EmbeddingPurpose = "document" EmbeddingQuery EmbeddingPurpose = "query" )
type EmbeddingSpec ¶
type EmbeddingSpec struct {
Fingerprint string
}
EmbeddingSpec identifies the vector space an executor embeds into. The fingerprint must uniquely determine the embedding model and with it the vector dimensionality — dimensionality itself is discovered from the vectors on first real use, so lazy providers (ollama reports dimensions only with its first response) satisfy the contract without a probe call.
type EmbeddingVector ¶
type EntryDocument ¶
type EntryDocument struct {
LogicalPath string
Frontmatter map[string]any
Body string
Attachments []string
}
EntryDocument is the storage-neutral form of an entry. Frontmatter carries the canonical graph schema as structured values; SDD validates and normalizes it before constructing a Snapshot.
type EntryDraft ¶
type EntryDraft struct {
Target MutationTarget
Kind string
Layer string
Intent string
Body string
Refs []EntryRef
Closes []string
Supersedes []string
Participants []string
Confidence string
Topics []string
Index *FactIndex
AttachmentHandles []string
// Canonical and Aliases carry a kind: actor signal's identity; Actor carries
// a kind: role decision's bound actor canonical. Mirrors the CLI-side
// NewEntryCmd fields — ignored on other kinds, written onto the entry so the
// model-layer validator sees the required frontmatter.
Canonical string
Aliases []string
Actor string
// FocusActors, FocusWhen, and Involvement carry a kind: focus decision's
// advances list and its focus-level defaults. Mirrors the CLI-side
// NewEntryCmd fields — ignored on other kinds, written onto the entry so
// the model-layer validator sees the required involvement frontmatter.
FocusActors []string
FocusWhen *model.FocusWhen
Involvement []model.Involvement
SkipPreflight bool
}
type ErrorCode ¶
type ErrorCode string
const ( ErrorAuthenticationRequired ErrorCode = "authentication_required" ErrorInvalidArgument ErrorCode = "invalid_argument" ErrorProjectRequired ErrorCode = "project_required" ErrorActionRequired ErrorCode = "action_required" ErrorReadDenied ErrorCode = "read_denied" ErrorWriteDenied ErrorCode = "write_denied" ErrorSessionOwnership ErrorCode = "session_ownership_mismatch" ErrorSessionConflict ErrorCode = "session_conflict" ErrorSessionDisplaced ErrorCode = "session_displaced" ErrorSessionEnded ErrorCode = "session_ended" ErrorConsentRequired ErrorCode = "consent_required" ErrorGraphConflict ErrorCode = "graph_conflict" ErrorMigrationRequired ErrorCode = "migration_required" ErrorRecoveryRequired ErrorCode = "recovery_required" )
type FactIndexRow ¶
FactIndexRow is the application-boundary shape of an indexed fact: plain, serializable strings only. Topic carries the canonical slash-joined form (e.g. "cli/view"). ID and Title match the template keys the user-dialogue procedure renders from the factIndex inject result.
type FinalizerOutcome ¶
type FixedTargetAcquirer ¶
type FixedTargetAcquirer struct {
Target MutationTarget
Graph GraphStore
Finalizers []MutationFinalizer
}
FixedTargetAcquirer is a small composition adapter for stores whose one configured runtime already represents a concrete target. It exact-matches the target and never interprets cwd.
func (FixedTargetAcquirer) Acquire ¶
func (a FixedTargetAcquirer) Acquire(_ context.Context, target MutationTarget) (*AcquiredTarget, error)
type GraphStore ¶
type GraphStore interface {
Current(context.Context) (*Snapshot, error)
Apply(context.Context, string, MutationBatch, StagedBlobReader) (ApplyResult, error)
Reconcile(context.Context, string, string) (ApplyResult, error)
ReadAttachmentPage(context.Context, string, string, int64, int) (AttachmentPage, error)
}
GraphStore is the canonical graph authority: snapshot reads, atomic mutation, reconciliation, and canonical attachment bytes.
type IndexNamespace ¶
IndexNamespace keys one reconciled vector index. The fingerprint pins the embedding model (and thus the dimensionality), so dimensions are not part of the identity — stores enforce vector-length consistency per namespace at reconcile and query time instead.
type IndexedChunk ¶
type IndexedChunk struct {
Chunk CanonicalChunk
Vector []float32
}
type InfoRequest ¶
type InfoRequest struct{}
type InfoResult ¶
type InfoResult struct {
Project ProjectRef
Participant string
Language string
Search string
Recovery string
}
type LLMExecutor ¶
type LLMExecutorFuncs ¶
type LLMExecutorFuncs struct {
CapabilitiesFunc func(context.Context) ([]string, error)
ExecuteFunc func(context.Context, LLMRequest) (LLMResult, error)
}
LLMExecutorFuncs adapts a raw model executor without moving prompt, parsing, validation, or gate semantics out of SDD.
func (LLMExecutorFuncs) Capabilities ¶
func (f LLMExecutorFuncs) Capabilities(ctx context.Context) ([]string, error)
func (LLMExecutorFuncs) Execute ¶
func (f LLMExecutorFuncs) Execute(ctx context.Context, request LLMRequest) (LLMResult, error)
type LLMRequest ¶
type MutationBatch ¶
type MutationBatch struct {
ID string
Digest string
Changes []DocumentChange
Attachments []AttachmentMaterialization
Message string
Author Author
}
type MutationFinalizer ¶
type MutationFinalizer interface {
Name() string
Finalize(context.Context, AppliedMutation) error
}
MutationFinalizer is a named, idempotent post-apply effect. It cannot redefine or roll back the canonical MutationBatch.
type MutationResult ¶
type MutationResult struct {
Project ProjectRef
Binding SessionBinding
}
type MutationTarget ¶
MutationTarget is the immutable canonical authority for one graph mutation. Project identifies the session project in this delivery; Branch names the concrete Git branch whose registered checkout owns the write.
func (MutationTarget) Validate ¶
func (t MutationTarget) Validate(project ProjectID) error
type PreparedTransition ¶
type PreparedTransition struct {
Version uint32
Target MutationTarget
// ExpectedGraphRevision is prepare-time provenance only. The apply CAS
// operand is the freshly revalidated revision (see applyOnAcquired), so a
// concurrent unrelated append merges cleanly instead of failing the pin.
ExpectedGraphRevision string
Batch MutationBatch
// Staged keeps its persisted name so an in-flight intent stays replayable
// across an upgrade.
Staged SessionRef `json:"BlobOwner"`
BlobIDs []string
}
PreparedTransition is the storage-neutral write-gate output. It contains only pinned v1 facts; adapters never reconstruct application intent.
type Principal ¶
Principal is the stable identity and graph participant resolved from a current request. It is binding and audit data, never cached authorization.
type ProcedureListRequest ¶
type ProcedureListRequest struct{}
type ProcedureListResult ¶
type ProcedureListResult struct {
Project ProjectRef
Procedures string
}
type ProjectAction ¶
type ProjectAction struct {
ID string
DisplayName string
State ProjectState
ActionURL string
Reason string
}
type ProjectConfigDocument ¶
type ProjectList ¶
type ProjectList struct {
Actions []ProjectAction
Projects []ProjectSummary
}
type ProjectRef ¶
ProjectRef is the only project identity exposed in project-scoped results.
type ProjectRuntime ¶
type ProjectRuntime struct {
// contains filtered or unexported fields
}
ProjectRuntime owns the immutable ports and project configuration resolved for one application operation.
func NewProjectRuntime ¶
func NewProjectRuntime(options ProjectRuntimeOptions) (*ProjectRuntime, error)
func (*ProjectRuntime) Project ¶
func (r *ProjectRuntime) Project() ProjectRef
type ProjectRuntimeOptions ¶
type ProjectRuntimeOptions struct {
Project ProjectRef
DefaultBranch string
Language string
Dependencies []string
Graph GraphStore
Targets TargetAcquirer
Branches BranchValidator
Recovery RecoveryAuthorizer
Sessions SessionStore
StagedBlobs StagedBlobStore
Embeddings EmbeddingExecutor
SearchIndex SearchIndexStore
LLM LLMExecutor
Finalizers []MutationFinalizer
Now func() time.Time
// ExcludeEmbeddedFromIndex mirrors the CLI's excludeEmbedded semantics for
// the vector index: connected-repo runtimes set it so binary-shipped base
// entries embed once per machine (in the base store) rather than once per
// connected repo. The base runtime leaves it false — its store includes
// embedded entries. The rule is applied identically at index and read time.
ExcludeEmbeddedFromIndex bool
}
type ProjectState ¶
type ProjectState string
ProjectState describes whether a listed project can be used immediately.
const ( ProjectReady ProjectState = "ready" ProjectActionRequired ProjectState = "action_required" )
type ProjectSummary ¶
type ProjectSummary struct {
ProjectRef
SourceID string
CanRead bool
CanWrite bool
State ProjectState
}
type ReadAttachmentRequest ¶
type ReadAttachmentResult ¶
type ReadAttachmentResult struct {
Project ProjectRef
Page AttachmentPage
Available []string
}
type RecoveryAccessRequest ¶
type RecoveryAccessRequest struct {
Actor Principal
Target MutationTarget
Verb RecoveryVerb
OriginalSubject string
OriginalSession SessionID
}
type RecoveryAuthorizer ¶
type RecoveryAuthorizer interface {
AuthorizeRecovery(context.Context, RecoveryAccessRequest) error
}
type RecoveryAuthorizerFunc ¶
type RecoveryAuthorizerFunc func(context.Context, RecoveryAccessRequest) error
func (RecoveryAuthorizerFunc) AuthorizeRecovery ¶
func (f RecoveryAuthorizerFunc) AuthorizeRecovery(ctx context.Context, request RecoveryAccessRequest) error
type RecoveryItem ¶
type RecoveryItem struct {
Session SessionID
MutationID string
Digest string
Target MutationTarget
OriginalSubject string
State RecoveryState
// Reason qualifies State: what delivery waits on while pending, or which
// decision ended it while abandoned. Empty when delivered.
Reason RecoveryReason
// Recovered records that recovery machinery touched this mutation — a
// reconciliation or a verb. It is provenance, not state: a recovered write is
// delivered exactly like one that never needed help.
Recovered bool
LegacyUnroutable bool
EntryIDs []string
LastEvidence string
// Cause is the terminal's structured cause (e.g. graph-contention for an
// engine-recorded discard), empty for participant decisions and open items.
Cause string
}
func (RecoveryItem) Actionable ¶
func (i RecoveryItem) Actionable() bool
Actionable reports whether this item awaits a recovery decision. It is derived from State rather than stored beside it, so the two cannot disagree.
type RecoveryList ¶
type RecoveryList struct {
Project ProjectRef
Items []RecoveryItem
}
type RecoveryReason ¶
type RecoveryReason string
RecoveryReason qualifies a state that does not explain itself: what delivery is waiting on, or which decision ended it.
const ( RecoveryReasonOutcomeUnknown RecoveryReason = "outcome-unknown" RecoveryReasonNotApplied RecoveryReason = "not-applied" RecoveryReasonFinalizationOwed RecoveryReason = "finalization-owed" RecoveryReasonDiscarded RecoveryReason = "discarded" RecoveryReasonAbandonedUnknown RecoveryReason = "abandoned-unknown" )
type RecoveryRequest ¶
type RecoveryRequest struct {
Session SessionID
MutationID string
Verb RecoveryVerb
Reason string
Target MutationTarget
}
type RecoveryResult ¶
type RecoveryResult struct {
Project ProjectRef
Item RecoveryItem
Transition TransitionResult
}
type RecoveryState ¶
type RecoveryState string
const ( // RecoveryDelivered means the write reached its desired state: the batch // applied and finalization is proven. Nothing is owed. RecoveryDelivered RecoveryState = "delivered" // RecoveryPending means delivery is not proven yet. Pending is exactly the // actionable condition, and Reason names what is owed. RecoveryPending RecoveryState = "pending" // RecoveryAbandoned means a participant decided to stop pursuing delivery. // Reason names the decision. RecoveryAbandoned RecoveryState = "abandoned" )
State answers one question — has delivery been reached — so it carries the two durable conditions of the delivery contract plus the one outcome that is a participant's decision rather than a delivery result.
type RecoveryVerb ¶
type RecoveryVerb string
RecoveryVerb is deliberately finer-grained than write access. Runtime compositions authorize each recovery action and the nonterminal reconcile refresh afresh.
const ( RecoveryReconcile RecoveryVerb = "reconcile" RecoveryApply RecoveryVerb = "apply" RecoveryDiscard RecoveryVerb = "discard" RecoveryFinalizeRetry RecoveryVerb = "finalize-retry" RecoveryAbandonUnknown RecoveryVerb = "abandon-unknown" RecoveryBindTarget RecoveryVerb = "bind-target" )
type RegistryFunction ¶
func WorkflowRegistryDocs ¶
func WorkflowRegistryDocs(class string) ([]RegistryFunction, error)
type RequestIdentity ¶
RequestIdentity is current-request authentication material supplied by a transport composition. SDD treats Subject as opaque and does not interpret application-specific roles.
type ScoredChunkHit ¶
type ScoredChunkHit struct {
Namespace IndexNamespace
ChunkID string
EntryID string
// EntryHash is the version this hit belongs to, resolved by the store (row
// metadata, or the manifest for a legacy row). Read-time filtering keeps
// the hit only when it equals the current entry's state hash. Empty means
// the store cannot report a version, so the hit is not version-filtered.
EntryHash string
// Revision is deprecated and ignored by hit validity (see CanonicalChunk).
Revision string
ContentHash string
Score float64
// Persisted citation fields, rendered directly into search citations so a
// hit needs no re-derivation of its source chunk.
Body string
Breadcrumb []string
Depth int
IsSummary bool
IsAttachment bool
SourceAttachmentPath string
}
type SearchIndexEntryManifest ¶ added in v0.16.2
type SearchIndexEntryManifest interface {
IndexedEntries(context.Context, IndexNamespace) ([]StoredEntryRef, error)
}
SearchIndexEntryManifest is an optional capability a persistent store implements so the application can reconcile on entry presence (monotonic accumulation of immutable-entry chunks) instead of chunk-identity comparison. A store that does not implement it falls back to the compatibility reconciliation path in vector search.
type SearchIndexStore ¶
type SearchIndexStore interface {
Manifest(context.Context, IndexNamespace) ([]StoredChunkRef, error)
Reconcile(context.Context, IndexNamespace, string, []IndexedChunk, []string) error
Nearest(context.Context, []IndexNamespace, []float32, int) ([]ScoredChunkHit, error)
}
type SearchIndexStoreFuncs ¶
type SearchIndexStoreFuncs struct {
ManifestFunc func(context.Context, IndexNamespace) ([]StoredChunkRef, error)
ReconcileFunc func(context.Context, IndexNamespace, string, []IndexedChunk, []string) error
NearestFunc func(context.Context, []IndexNamespace, []float32, int) ([]ScoredChunkHit, error)
}
SearchIndexStoreFuncs adapts an index implementation while SDD retains chunking, embedding input, reconciliation decisions, filtering, and ranking.
func (SearchIndexStoreFuncs) Manifest ¶
func (f SearchIndexStoreFuncs) Manifest(ctx context.Context, namespace IndexNamespace) ([]StoredChunkRef, error)
func (SearchIndexStoreFuncs) Nearest ¶
func (f SearchIndexStoreFuncs) Nearest(ctx context.Context, namespaces []IndexNamespace, vector []float32, limit int) ([]ScoredChunkHit, error)
func (SearchIndexStoreFuncs) Reconcile ¶
func (f SearchIndexStoreFuncs) Reconcile(ctx context.Context, namespace IndexNamespace, revision string, upserts []IndexedChunk, deletes []string) error
type SearchRequest ¶
type SearchResult ¶
type SearchResult struct {
Project ProjectRef
Results string
EntryIDs []string
}
type SessionAppend ¶
type SessionAppend struct {
Metadata *SessionMetadata
Events []StoredEvent
}
type SessionBinding ¶
type SessionBinding struct {
SessionID SessionID
Subject string
Project ProjectID
MCPSessionID string
Version uint64
}
SessionBinding is a connection's write token for a durable session: identity plus the attachment it drives and the version it last observed. Append CAS on the version is the sole integrity mechanism.
type SessionEnd ¶
type SessionEnd struct {
Act SessionEndAct
EndedAt time.Time
Reason string `json:",omitempty"`
}
SessionEnd records the participant act that ended a session, written once and never revised. Reason records the abandon note, so a displaced writer's next call can be told why. Who ended it is the session's own participant; the ending client's stamp is transport and does not enter the durable record.
type SessionEndAct ¶
type SessionEndAct string
SessionEndAct is the closed set of participant acts that end a dialogue.
const ( SessionConcluded SessionEndAct = "concluded" SessionAbandoned SessionEndAct = "abandoned" )
type SessionFilter ¶
type SessionMetadata ¶
type SessionMetadata struct {
CodecVersion uint32
ID SessionID
Subject string
Project ProjectID
Participant string
Label string
// Branch is the session's explicit branch binding. Empty means unbound;
// compositions without a branch concept leave it empty.
Branch string `json:"branch,omitempty"`
Attachment *Attachment
// Ended is the session's single terminal record. Its presence is what makes
// a session ended; nothing else about a session ends it (d-cpt-rw7).
Ended *SessionEnd `json:",omitempty"`
UpdatedAt time.Time
}
SessionMetadata is structured routing and ownership data. Dialogue events remain opaque to the store.
func (*SessionMetadata) UnmarshalJSON ¶
func (m *SessionMetadata) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes stored metadata, recovering the terminal record from the attachment history superseded shapes carried it in. Decoding stays lenient about every other field in both directions (d-cpt-i2x).
type SessionRef ¶
SessionRef addresses one session inside a subject's namespace. Staged blobs are scoped to a session, so this is what names their area — there is no owner entity, just the two fields that identify whose scaffolding this is.
type SessionStore ¶
type SessionStore interface {
Create(context.Context, SessionMetadata) (StoredSession, error)
Load(context.Context, SessionID) (StoredSession, error)
List(context.Context, SessionFilter) ([]StoredSession, error)
Append(context.Context, SessionID, uint64, SessionAppend) (uint64, error)
Delete(context.Context, SessionID) error
}
SessionStore persists structured metadata plus ordered opaque events. Append is the sole mutation primitive and must compare ExpectedVersion atomically.
List is also the enumeration collection sweeps over, and Delete is what makes them possible against any implementation rather than only the local one. Delete must be idempotent: removing a session that is already gone is success, since two sweeps may derive the same target set.
type ShowRequest ¶
type ShowResult ¶
type ShowResult struct {
Project ProjectRef
Entries string
FullIDs []string
SummaryIDs []string
}
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is an immutable, validated SDD graph snapshot. Its indexed model remains private; structured and filesystem stores both enter through SnapshotData. The finder is the shared read authority over the snapshot's graph; the private graph field mirrors it so in-package seams (write-side resolution, the engine graph provider) keep reading a *model.Graph directly.
func BuildSnapshot ¶
func BuildSnapshot(_ context.Context, data SnapshotData) (*Snapshot, error)
BuildSnapshot is the single in-memory graph construction path. It adapts the canonical documents into a storage-neutral source and hands them to the shared GraphFinder, which applies the one semantic gate (parse, embedded-base merge, partial-read load issues) and holds the resulting graph. A malformed entry document no longer aborts the build — it surfaces as a load issue on the snapshot's graph (Snapshot.Health). Structural failures stay hard: missing project/revision, a malformed logical path, a WIP document outside wip/, and base-entry assembly.
func LoadSnapshotFS ¶
func LoadSnapshotFS(ctx context.Context, project ProjectID, revision string, fsys fs.FS, graphDir string) (*Snapshot, error)
LoadSnapshotFS parses canonical filesystem documents into SnapshotData and delegates all validation and indexing to BuildSnapshot.
func (*Snapshot) Health ¶
func (s *Snapshot) Health() model.GraphHealth
Health reports the snapshot graph's integrity problems — parse-failed (unreadable) documents and per-entry validation warnings — so external hosts can render graph health without reaching into the private model. A clean graph reports zero of each.
type SnapshotData ¶
type SnapshotData struct {
Project ProjectID
Revision string
Config ProjectConfigDocument
Entries []EntryDocument
WIP []WIPDocument
// Unreadable records documents a store could not decode into structured
// form — a file whose YAML frontmatter would not parse, for example. They
// are carried as data rather than aborting the load: BuildSnapshot turns
// each into a graph load issue surfaced through Snapshot.Health, so one
// malformed file no longer makes an entire graph (and every session over
// it) unopenable.
Unreadable []DocumentIssue
}
SnapshotData contains canonical stored document facts, never derived graph indexes, status, or traversal state.
type StagedBlob ¶
type StagedBlob struct {
ID string
Session SessionRef
Digest BlobDigest
Size int64
Filename string
CreatedAt time.Time
}
type StagedBlobReader ¶
StagedBlobReader limits Apply to the blobs named by its prepared batch.
type StagedBlobStore ¶
type StagedBlobStore interface {
Stage(context.Context, SessionRef, string, io.Reader) (StagedBlob, error)
Stat(context.Context, SessionRef, string) (StagedBlob, error)
Open(context.Context, SessionRef, string) (io.ReadCloser, error)
Retain(context.Context, SessionRef, string, []string) error
Release(context.Context, SessionRef, string) error
StagedSessions(context.Context) ([]SessionRef, error)
DeleteStaged(context.Context, SessionRef) error
}
StagedBlobStore owns immutable session-scoped scratch bytes and the retentions holding them. Nothing here is durable: a staged blob lives as long as its session does, and durability is earned only by a captured entry.
StagedSessions and DeleteStaged put reclamation inside the published contract, so a sweep enumerates staging areas and drops the ones whose session is gone through this interface rather than through local-only code. DeleteStaged must be idempotent, and removes a session's blobs together with its retentions.
type StoredChunkRef ¶
type StoredEntryRef ¶ added in v0.16.2
type StoredEntryRef struct {
EntryID string
// EntryHash is the entry-state hash of this stored version — the same
// definition as CanonicalChunk.EntryHash and the CLI manifest hash. Empty
// only for a store that cannot report per-version identity.
EntryHash string
}
StoredEntryRef identifies one stored (entry, version) pair in a persistent index. Presence is keyed by the pair: a store returns one ref per stored version of an entry, so a changed entry (a new EntryHash) reads as absent and is embedded as an added version rather than overwriting the old one.
type StoredEvent ¶
type StoredEvent struct {
CodecVersion uint32
Code string
Payload json.RawMessage
}
type StoredSession ¶
type StoredSession struct {
Metadata SessionMetadata
Version uint64
Events []StoredEvent
}
type TargetAcquirer ¶
type TargetAcquirer interface {
Acquire(context.Context, MutationTarget) (*AcquiredTarget, error)
}
TargetAcquirer resolves a concrete mutation authority to short-lived, target-scoped graph and finalizer adapters. Implementations rediscover the target on every call; checkout paths are not durable intent.
type TargetAcquirerFunc ¶
type TargetAcquirerFunc func(context.Context, MutationTarget) (*AcquiredTarget, error)
TargetAcquirerFunc adapts a function to TargetAcquirer.
func (TargetAcquirerFunc) Acquire ¶
func (f TargetAcquirerFunc) Acquire(ctx context.Context, target MutationTarget) (*AcquiredTarget, error)
type TransitionResult ¶
type TransitionResult struct {
Project ProjectRef
Binding SessionBinding
Apply ApplyResult
Finalizers []FinalizerOutcome
}
type ValidationError ¶
ValidationError reports that model.ValidateEntry rejected a draft at the write gate. It carries the structural warnings so the workflow gate can re-serve them as actionable findings — naming the violated rule and the field — and route the instance back to a step that can fix it, rather than wedging behind an opaque hard error (closes half of s-prc-g0j).
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ViewRequest ¶
type ViewResult ¶
type ViewResult struct {
Project ProjectRef
Sections string
// MatchedCount is the total primary units the layout produced across the
// local graph and any queried dependency repos. Zero means the pipeline
// matched nothing — surfaces distinguish an empty result from a failure
// (an agent over MCP cannot tell a blank string from a broken call).
MatchedCount int
// KnownParticipants names the graph's canonical participants, populated
// only when the result was empty and the layout carried a participant
// filter — so an empty participant() view can say what names exist rather
// than leaving an exact-match miss indistinguishable from no data.
KnownParticipants []string
}
type WIPDocument ¶
type WorkflowAbandonResult ¶
type WorkflowAbandonResult struct {
Abandoned bool
Session SessionID
Label string
Discarded []WorkflowInstanceSummary
HeldMarkers []string
Base *WorkflowServe
}
type WorkflowAdvanceRequest ¶
type WorkflowChooser ¶
type WorkflowChooser struct {
Chooser string
Kind ChooserKind
Options []WorkflowChooserOption
}
type WorkflowChooserOption ¶
type WorkflowInstanceSummary ¶
type WorkflowOpenRequest ¶
type WorkflowParkResult ¶
type WorkflowParkResult struct {
Instance string
Procedure string
Step string
Base *WorkflowServe
}
type WorkflowResumeRequest ¶
type WorkflowResumeRequest struct {
SessionID SessionID
MCPSessionID string
ClientName string
ClientVersion string
// UserWords is the user's verbatim request to move into the session, required
// to attach to a session this connection does not already hold. Takeover
// additionally authorizes displacing an attachment that is still recent.
UserWords string
Takeover bool
}
type WorkflowResumeResult ¶
type WorkflowResumeResult struct {
Session SessionID
Participant string
Label string
Branch string
Open []WorkflowServe
Instructions string
// Displaced names the attachment this attach ended (nil when the session was
// unheld); TookOver is true when that displaced attachment was still recent,
// so the caller can surface the fidelity limit of a takeover.
Displaced *Attachment
TookOver bool
}
type WorkflowServe ¶
type WorkflowServe struct {
Session SessionID
Branch string
Instance string
Procedure string
Status string
Step string
Goal string
Instructions string
Missing []string
ReportSchema map[string]any
PendingChooser *WorkflowChooser
Execution string
Produced map[string]any
Diagnostics []string
InstructionUnit string
Base *WorkflowServe
// Collected is the instance's already-gathered param and state values,
// projected only onto resume serves so a newly attached or reoriented
// agent sees what this instance holds — the anchor, chosen scope, and
// reported judgments that persist across a handover (d-cpt-0tm). Empty on
// door, next, and base-junction serves, which stay unchanged.
Collected map[string]any
}
func (*WorkflowServe) ReminderInstructions ¶
func (s *WorkflowServe) ReminderInstructions() string
ReminderInstructions composes the short reminder used when a host has already served this instruction unit, while retaining any gate diagnostics. The stub assumes the caller still holds the earlier full text; if a context compaction dropped it, the breadcrumb names the one-shot escape so an amnesiac agent is not left following instructions it no longer has.
type WorkflowSession ¶
type WorkflowSession struct {
// contains filtered or unexported fields
}
WorkflowSession is a protocol-neutral, durable engine session. It stores no authorization proof: every operation receives the current request identity and resolves access again before touching project state.
func (*WorkflowSession) Abandon ¶
func (w *WorkflowSession) Abandon(ctx context.Context, identity RequestIdentity, instance, reason string) (WorkflowAbandonResult, error)
func (*WorkflowSession) Advance ¶
func (w *WorkflowSession) Advance(ctx context.Context, identity RequestIdentity, request WorkflowAdvanceRequest) (*WorkflowServe, error)
func (*WorkflowSession) BindBranch ¶
func (w *WorkflowSession) BindBranch(ctx context.Context, identity RequestIdentity, branch string, clear bool) error
BindBranch changes the durable session-level branch declaration. Setting a binding resolves the branch against the runtime's live branch capability before the CAS append; clearing is store-only and works without that capability.
func (*WorkflowSession) Binding ¶
func (w *WorkflowSession) Binding() SessionBinding
func (*WorkflowSession) Branch ¶
func (w *WorkflowSession) Branch() string
func (*WorkflowSession) Finished ¶
func (w *WorkflowSession) Finished() bool
Finished reports whether this dialogue is over: the shell has left running, which is the act that wrote the terminal record. A finished session is spent — the door opens a new one rather than re-serving it, and no move may carry it on.
func (*WorkflowSession) Framing ¶
func (w *WorkflowSession) Framing(ctx context.Context, identity RequestIdentity) ([]string, error)
Framing composes the session framing as ordered, independently dedupable blocks: the engine-supplied info block (participant, language, search modes) first, then one block per declared shell lane, rendered through the injection mechanism. Returning the lanes as separate blocks — not one joined string — lets the host dedup each on its own, so a graph write that changes only the recent-moves lane re-serves that lane alone, never the stable aspirations or directives (I6, A1). A shell with no declared lanes yields the info block alone; there is no Go-constant fallback.
func (*WorkflowSession) ID ¶
func (w *WorkflowSession) ID() SessionID
func (*WorkflowSession) IsShell ¶
func (w *WorkflowSession) IsShell(instance string) bool
func (*WorkflowSession) Leave ¶
func (w *WorkflowSession) Leave(ctx context.Context, identity RequestIdentity) error
Leave clears the connection's attachment stamp when it steps away. A quiescent session — shell only, no open moves — auto-concludes its shell so it does not linger as an empty parked dialogue.
func (*WorkflowSession) LogRead ¶
func (w *WorkflowSession) LogRead(ctx context.Context, identity RequestIdentity, tool string, full, summary []string) error
func (*WorkflowSession) OpenInstances ¶
func (w *WorkflowSession) OpenInstances() []WorkflowInstanceSummary
func (*WorkflowSession) Park ¶
func (w *WorkflowSession) Park(ctx context.Context, identity RequestIdentity, instance, note string) (WorkflowParkResult, error)
func (*WorkflowSession) Project ¶
func (w *WorkflowSession) Project() ProjectID
func (*WorkflowSession) Reopen ¶
func (w *WorkflowSession) Reopen(ctx context.Context, identity RequestIdentity, label string) (*WorkflowServe, error)
func (*WorkflowSession) ServeAll ¶
func (w *WorkflowSession) ServeAll(ctx context.Context, identity RequestIdentity) (WorkflowResumeResult, error)
func (*WorkflowSession) ServeShell ¶
func (w *WorkflowSession) ServeShell(ctx context.Context, identity RequestIdentity) (*WorkflowServe, error)
func (*WorkflowSession) StageAttachment ¶
func (w *WorkflowSession) StageAttachment(ctx context.Context, identity RequestIdentity, filename string, content []byte) (string, error)
func (*WorkflowSession) Start ¶
func (w *WorkflowSession) Start(ctx context.Context, identity RequestIdentity, request WorkflowStartRequest) (*WorkflowServe, error)
func (*WorkflowSession) StillHeld ¶
func (w *WorkflowSession) StillHeld(ctx context.Context, identity RequestIdentity) (bool, error)
StillHeld reports whether this connection is still the store's current attachment. A false answer means the cached binding is stale — displaced by another client or torn down — so the connection must re-establish through the attach path rather than serve its now-poisoned in-memory session.
type WorkflowSessionSummary ¶
type WorkflowSessionSummary struct {
Session SessionID
Label string
Participant string
Branch string
Anchor string
Open []WorkflowInstanceSummary
LastActivity time.Time
Attachment *Attachment
Active bool
}