application

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 30 Imported by: 0

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

View Source
const (
	DefaultShowUpDepth   = query.DefaultUpDepth
	DefaultShowDownDepth = query.DefaultDownDepth
)

Default show expansion depths favor grounding context while keeping the typically wider consumer side shallow.

View Source
const (
	WorkflowEventCode = "workflow_event"

	DefaultShellCanonical  = "user-dialogue"
	WorkflowMaxLabelLength = 120
	ExecutionForkPreferred = "fork-preferred"
)
View Source
const PreparedTransitionVersion uint32 = 1
View Source
const SessionCodecVersion uint32 = 1

Variables

View Source
var ErrSessionNotFound = errors.New("sdd: session not found")

Functions

func AttachmentDirRelPath

func AttachmentDirRelPath(entryID string) (string, error)

AttachmentDirRelPath returns the graph-relative attachment directory for an entry ID.

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.

Types

type Access

type Access string

Access is the permission required for the current operation.

const (
	AccessRead  Access = "read"
	AccessWrite Access = "write"
)

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 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)

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) BindSession

func (a *Application) BindSession(ctx context.Context, identity RequestIdentity, project ProjectID, request BindSessionRequest) (BindSessionResult, error)

BindSession establishes the user-level exclusive holder above SessionStore CAS. Expired holders are replaced and recorded; replacing a live holder requires an explicit takeover request.

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, markerID string) (MutationResult, error)

func (*Application) Info

func (a *Application) Info(ctx context.Context, identity RequestIdentity, project ProjectID, _ InfoRequest) (InfoResult, error)

func (*Application) ListSessions

func (a *Application) ListSessions(ctx context.Context, identity RequestIdentity, project ProjectID) (ListSessionsResult, error)

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 (*Application) ReadAttachment

func (a *Application) ReadAttachment(ctx context.Context, identity RequestIdentity, project ProjectID, request ReadAttachmentRequest) (ReadAttachmentResult, error)

func (*Application) RecoverPrepared

func (a *Application) RecoverPrepared(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, mutationID string) (TransitionResult, error)

RecoverPrepared reconciles an intent that has no durable definitive outcome. It is safe after process restart and retries unfinished finalizers.

func (*Application) ReleaseSession

func (a *Application) ReleaseSession(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding) error

func (*Application) ReplaceSummary

func (a *Application) ReplaceSummary(ctx context.Context, identity RequestIdentity, project ProjectID, binding SessionBinding, entryID, summary string) (MutationResult, error)

func (*Application) ResumeWorkflow

func (*Application) Search

func (a *Application) Search(ctx context.Context, identity RequestIdentity, project ProjectID, request SearchRequest) (SearchResult, error)

func (*Application) Show

func (a *Application) Show(ctx context.Context, identity RequestIdentity, project ProjectID, request ShowRequest) (ShowResult, error)

func (*Application) StageBlob

func (a *Application) StageBlob(ctx context.Context, identity RequestIdentity, project ProjectID, owner BlobOwner, 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, entryID, description string) (string, MutationResult, error)

func (*Application) View

func (a *Application) View(ctx context.Context, identity RequestIdentity, project ProjectID, request ViewRequest) (ViewResult, 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
	Holder     *SessionHolder
	Cause      error
}

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 AttachmentMaterialization

type AttachmentMaterialization struct {
	BlobID      string
	Digest      BlobDigest
	Size        int64
	SourceName  string
	LogicalPath string
}

type AttachmentPage

type AttachmentPage struct {
	Filename   string
	Content    []byte
	Offset     int64
	NextOffset int64
	TotalSize  int64
	More       bool
	Digest     BlobDigest
}

type Author

type Author struct {
	Name  string
	Email string
}

type BindSessionRequest

type BindSessionRequest struct {
	SessionID     SessionID
	MCPSessionID  string
	ClientName    string
	ClientVersion string
	Chooser       ChooserKind
	Takeover      bool
}

type BindSessionResult

type BindSessionResult struct {
	Project ProjectRef
	Binding SessionBinding
	Created bool
}

type BlobDigest

type BlobDigest struct {
	Algorithm string
	Value     string
}

type BlobOwner

type BlobOwner struct {
	Subject string
	Session SessionID
}

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
const (
	ChooserGate  ChooserKind = "gate"
	ChooserAgent ChooserKind = "agent"
	ChooserUser  ChooserKind = "user"
)

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 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 (EmbeddingExecutorFuncs) Spec

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 EmbeddingVector struct {
	ID     string
	Values []float32
}

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 {
	Kind              string
	Layer             string
	Intent            string
	Body              string
	Refs              []EntryRef
	Closes            []string
	Supersedes        []string
	Participants      []string
	Confidence        string
	Topics            []string
	AttachmentHandles []string
	SkipPreflight     bool
}

type EntryRef

type EntryRef struct {
	ID   string
	Kind string
	Desc string
}

type ErrorCode

type ErrorCode string
const (
	ErrorAuthenticationRequired ErrorCode = "authentication_required"
	ErrorInvalidArgument        ErrorCode = "invalid_argument"
	ErrorProjectRequired        ErrorCode = "project_required"
	ErrorProjectUnavailable     ErrorCode = "project_unavailable"
	ErrorActionRequired         ErrorCode = "action_required"
	ErrorReadDenied             ErrorCode = "read_denied"
	ErrorWriteDenied            ErrorCode = "write_denied"
	ErrorSessionOwnership       ErrorCode = "session_ownership_mismatch"
	ErrorSessionInUse           ErrorCode = "session_in_use"
	ErrorSessionConflict        ErrorCode = "session_conflict"
	ErrorGraphConflict          ErrorCode = "graph_conflict"
	ErrorMigrationRequired      ErrorCode = "migration_required"
	ErrorRecoveryRequired       ErrorCode = "recovery_required"
)

type FinalizerOutcome

type FinalizerOutcome struct {
	Name      string
	Succeeded bool
	Message   string
}

type Finding

type Finding struct {
	Severity    string
	Category    string
	Observation string
}

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

type IndexNamespace struct {
	Project     ProjectID
	Fingerprint string
	Metric      string
}

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
}

type LLMExecutor

type LLMExecutor interface {
	Capabilities(context.Context) ([]string, error)
	Execute(context.Context, LLMRequest) (LLMResult, error)
}

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 LLMRequest struct {
	Purpose              string
	SystemPrompt         string
	Prompt               string
	OutputSchema         json.RawMessage
	RequiredCapabilities []string
	Routing              map[string]string
	PromptDigest         string
	IdempotencyKey       string
}

type LLMResult

type LLMResult struct {
	Output              []byte
	ExecutorFingerprint string
	FinishReason        string
	Usage               LLMUsage
}

type LLMUsage

type LLMUsage struct {
	InputTokens  int64
	OutputTokens int64
}

type ListSessionsResult

type ListSessionsResult struct {
	Project  ProjectRef
	Sessions []SessionSummary
}

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 PreparedTransition

type PreparedTransition struct {
	Version               uint32
	ExpectedGraphRevision string
	Batch                 MutationBatch
	BlobOwner             BlobOwner
	BlobIDs               []string
}

PreparedTransition is the storage-neutral write-gate output. It contains only pinned v1 facts; adapters never reconstruct application intent.

type Principal

type Principal struct {
	Subject     string
	Participant string
}

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 ProjectConfigDocument struct {
	LogicalPath string
	Fields      map[string]any
}

type ProjectID

type ProjectID string

ProjectID is a composition's stable project identity.

type ProjectList

type ProjectList struct {
	Actions  []ProjectAction
	Projects []ProjectSummary
}

type ProjectRef

type ProjectRef struct {
	ID          ProjectID
	DisplayName string
}

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
	Language     string
	Dependencies []string
	Graph        GraphStore
	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"
	ProjectUnavailable    ProjectState = "unavailable"
)

type ProjectSummary

type ProjectSummary struct {
	ProjectRef
	SourceID string
	CanRead  bool
	CanWrite bool
	State    ProjectState
}

type ReadAttachmentRequest

type ReadAttachmentRequest struct {
	EntryID  string
	Filename string
	Offset   int64
	MaxBytes int
}

type ReadAttachmentResult

type ReadAttachmentResult struct {
	Project   ProjectRef
	Page      AttachmentPage
	Available []string
}

type RegistryFunction

type RegistryFunction struct {
	Name   string
	Class  string
	Doc    string
	Reads  []string
	Writes []string
}

func WorkflowRegistryDocs

func WorkflowRegistryDocs(class string) ([]RegistryFunction, error)

type RequestIdentity

type RequestIdentity struct {
	Subject    string
	Scopes     []string
	Attributes map[string]any
}

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
	// 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 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 SearchRequest struct {
	Terms             []string
	Phrase            string
	Type              string
	Layer             string
	Kind              string
	IncludeSuperseded bool
	Limit             int
	MaxCitations      int
	Repos             []string
	AllRepos          bool
}

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
	Generation   uint64
	Version      uint64
}

type SessionFilter

type SessionFilter struct {
	Subject string
	Project ProjectID
}

type SessionHolder

type SessionHolder struct {
	Subject       string
	MCPSessionID  string
	ClientName    string
	ClientVersion string
	Generation    uint64
	LastActivity  time.Time
	ExpiresAt     time.Time
}

type SessionHolderRecord

type SessionHolderRecord struct {
	Holder  SessionHolder
	EndedAt time.Time
	Reason  string
}

type SessionID

type SessionID string

type SessionMetadata

type SessionMetadata struct {
	CodecVersion  uint32
	ID            SessionID
	Subject       string
	Project       ProjectID
	Participant   string
	Label         string
	Holder        *SessionHolder
	HolderHistory []SessionHolderRecord
	UpdatedAt     time.Time
}

SessionMetadata is structured routing and ownership data. Dialogue events remain opaque to the store.

type SessionStore

SessionStore persists structured metadata plus ordered opaque events. Append is the sole mutation primitive and must compare ExpectedVersion atomically.

type SessionSummary

type SessionSummary struct {
	ID          SessionID
	Label       string
	Participant string
	UpdatedAt   time.Time
	Holder      *SessionHolder
	HolderLive  bool
}

type ShowRequest

type ShowRequest struct {
	IDs       []string
	UpDepth   int
	DownDepth int
}

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.

func BuildSnapshot

func BuildSnapshot(_ context.Context, data SnapshotData) (*Snapshot, error)

BuildSnapshot is the single in-memory graph construction path. It validates canonical documents, joins embedded base procedures, and constructs the private indexed model without requiring a filesystem.

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) Project

func (s *Snapshot) Project() ProjectID

func (*Snapshot) Revision

func (s *Snapshot) Revision() string

type SnapshotData

type SnapshotData struct {
	Project  ProjectID
	Revision string
	Config   ProjectConfigDocument
	Entries  []EntryDocument
	WIP      []WIPDocument
}

SnapshotData contains canonical stored document facts, never derived graph indexes, status, or traversal state.

type StagedBlob

type StagedBlob struct {
	ID        string
	Owner     BlobOwner
	Digest    BlobDigest
	Size      int64
	Filename  string
	CreatedAt time.Time
}

type StagedBlobReader

type StagedBlobReader interface {
	Open(context.Context, string) (io.ReadCloser, error)
}

StagedBlobReader limits Apply to the blobs named by its prepared batch.

type StagedBlobStore

StagedBlobStore owns immutable session-scoped scratch bytes and durable retention. Sweeping is deliberately composition-side operations work.

type StoredChunkRef

type StoredChunkRef struct {
	ID string
	// Revision is deprecated and ignored by reconciliation (see CanonicalChunk).
	Revision    string
	ContentHash string
}

type StoredEntryRef added in v0.16.2

type StoredEntryRef struct {
	EntryID string
}

StoredEntryRef identifies one graph entry represented in a persistent index. Slice 1 keys presence by entry ID alone.

type StoredEvent

type StoredEvent struct {
	CodecVersion uint32
	Code         string
	Payload      json.RawMessage
}

type StoredSession

type StoredSession struct {
	Metadata SessionMetadata
	Version  uint64
	Events   []StoredEvent
}

type TransitionResult

type TransitionResult struct {
	Project    ProjectRef
	Binding    SessionBinding
	Apply      ApplyResult
	Finalizers []FinalizerOutcome
}

type ViewRequest

type ViewRequest struct {
	Layout   string
	Repos    []string
	AllRepos bool
}

type ViewResult

type ViewResult struct {
	Project  ProjectRef
	Sections string
}

type WIPDocument

type WIPDocument struct {
	LogicalPath string
	Content     string
}

type WorkflowAbandonResult

type WorkflowAbandonResult struct {
	Abandoned   bool
	Session     SessionID
	Label       string
	Discarded   []WorkflowInstanceSummary
	HeldMarkers []string
	Base        *WorkflowServe
}

type WorkflowAdvanceRequest

type WorkflowAdvanceRequest struct {
	Instance string
	Report   map[string]any
	Label    string
}

type WorkflowChooser

type WorkflowChooser struct {
	Chooser string
	Kind    ChooserKind
	Options []WorkflowChooserOption
}

type WorkflowChooserOption

type WorkflowChooserOption struct {
	Choice  string
	Collect []string
}

type WorkflowInstanceSummary

type WorkflowInstanceSummary struct {
	Instance  string
	Procedure string
	Step      string
}

type WorkflowOpenRequest

type WorkflowOpenRequest struct {
	MCPSessionID  string
	ClientName    string
	ClientVersion string
	Shell         string
	Label         string
}

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
	Takeover      bool
}

type WorkflowResumeResult

type WorkflowResumeResult struct {
	Session      SessionID
	Participant  string
	Label        string
	Open         []WorkflowServe
	Instructions string
}

type WorkflowServe

type WorkflowServe struct {
	Session         SessionID
	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
}

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.

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 (*WorkflowSession) Binding

func (w *WorkflowSession) Binding() SessionBinding

func (*WorkflowSession) Framing

func (w *WorkflowSession) Framing(ctx context.Context, identity RequestIdentity) (string, error)

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 releases the durable holder. A session with no open moves is also auto-concluded so it does not remain 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) Release

func (w *WorkflowSession) Release(ctx context.Context, identity RequestIdentity) error

func (*WorkflowSession) Reopen

func (w *WorkflowSession) Reopen(ctx context.Context, identity RequestIdentity, label string) (*WorkflowServe, error)

func (*WorkflowSession) ServeAll

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

type WorkflowSessionSummary

type WorkflowSessionSummary struct {
	Session      SessionID
	Label        string
	Participant  string
	Anchor       string
	Open         []WorkflowInstanceSummary
	LastActivity time.Time
	Holder       *SessionHolder
	HolderLive   bool
}

type WorkflowStartRequest

type WorkflowStartRequest struct {
	Canonical string
	Params    map[string]any
	Label     string
	Parent    string
}

Jump to

Keyboard shortcuts

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