Documentation
¶
Overview ¶
Package runtime composes built-in domain services and owns scope, operation, scheduler, readiness, and resource lifecycles.
Index ¶
- Constants
- func ReportEmbeddingUsage(delegate inference.EmbeddingModel) inference.EmbeddingModel
- func ReportStructuredUsage[I, O any](delegate inference.StructuredGenerator[I, O]) inference.StructuredGenerator[I, O]
- func TraceMemoryReranker(runtime *Runtime, delegate memory.Reranker) memory.Reranker
- func ValidateScopeID(scopeID string) (string, error)
- type BackgroundTracing
- type CachedProbe
- type Capabilities
- func (c Capabilities) ArtifactFamilies() []string
- func (c Capabilities) ContextVersions() []string
- func (c Capabilities) ExperienceGeneration() bool
- func (c Capabilities) ExternalSkillRegistry() bool
- func (c Capabilities) HandoffGeneration() bool
- func (c Capabilities) ManagedSkillGeneration() bool
- func (c Capabilities) MemoryExtraction() bool
- func (c Capabilities) SearchModes() []memory.SearchMode
- func (c Capabilities) SourceTypes() []string
- type CapabilityOptions
- type CheckStatus
- type Clock
- type ContextApplication
- type CreateHandoffReportProject
- type DependencyOperation
- type ExperienceIncubationApplication
- type ExperienceIncubationBackend
- type ExperienceIncubationBackendFactory
- type ExperienceIncubationResult
- type ExperienceRecall
- type ExperienceRecallFunc
- type ExternalSkillApplication
- func (a *ExternalSkillApplication) Import(ctx context.Context, scopeID, externalSkillID, fingerprint string, ...) (review.GeneratedCandidateResult, error)
- func (a *ExternalSkillApplication) List(ctx context.Context, scopeID string, includeUnavailable bool) ([]skill.Resolution, error)
- func (a *ExternalSkillApplication) Resolve(ctx context.Context, scopeID, externalSkillID, fingerprint string) (skill.Resolution, error)
- func (a *ExternalSkillApplication) Scan(ctx context.Context, scopeID string) (skill.ProviderScan, error)
- type ExternalSkillRegistryFactory
- type ExternalSkillSnapshotStore
- type GenerationApplication
- func (a *GenerationApplication) GenerateExperience(ctx context.Context, scopeID string, sources []source.Ref, ...) (review.GeneratedCandidateResult, error)
- func (a *GenerationApplication) GenerateSkill(ctx context.Context, scopeID string, origin review.SkillGenerationOrigin, ...) (review.GeneratedCandidateResult, error)
- type GenerationServiceFactory
- type GetHandoffReport
- type HandoffActivationBackend
- type HandoffActivationResult
- type HandoffActivationStatus
- type HandoffApplication
- func (a *HandoffApplication) Activate(ctx context.Context, scopeID string, activation handoff.Activate) (HandoffActivationResult, error)
- func (a *HandoffApplication) Commit(ctx context.Context, scopeID string, prepared handoff.Prepared) (handoff.Handoff, error)
- func (a *HandoffApplication) ContinueLatest(ctx context.Context, scopeID string) (handoff.Resolution, error)
- func (a *HandoffApplication) ContinuePrepared(ctx context.Context, scopeID string, prepared handoff.Prepared) (handoff.Resolution, error)
- func (a *HandoffApplication) ContinueRevision(ctx context.Context, scopeID string, ref artifact.Ref) (handoff.Resolution, error)
- func (a *HandoffApplication) Finalize(ctx context.Context, scopeID string, draft handoff.Draft) (handoff.Prepared, error)
- func (a *HandoffApplication) Prepare(ctx context.Context, scopeID string, action handoff.Prepare) (handoff.Draft, error)
- type HandoffReportActivityList
- type HandoffReportApplication
- func (a *HandoffReportApplication) AttachWorkspaceBinding(ctx context.Context, id, project string, ...) (handoffreport.WorkspaceBinding, error)
- func (a *HandoffReportApplication) CreateProject(ctx context.Context, input CreateHandoffReportProject) (handoffreport.ProjectDescriptor, error)
- func (a *HandoffReportApplication) DetachWorkspaceBinding(ctx context.Context, id string, expected int) (handoffreport.WorkspaceBinding, error)
- func (a *HandoffReportApplication) GetProject(ctx context.Context, id string) (handoffreport.ProjectDescriptor, error)
- func (a *HandoffReportApplication) GetReport(ctx context.Context, input GetHandoffReport) (handoffreport.Report, error)
- func (a *HandoffReportApplication) GetWorkspaceBinding(ctx context.Context, id string) (handoffreport.WorkspaceBinding, error)
- func (a *HandoffReportApplication) ListActivities(ctx context.Context, query HandoffReportActivityList) (handoffreport.ActivityPage, error)
- func (a *HandoffReportApplication) ListKnownScopes(ctx context.Context, cursor *string, limit int) (KnownHandoffScopePage, error)
- func (a *HandoffReportApplication) ListProjects(ctx context.Context, cursor *string, limit int, archived bool) (handoffreport.Page[handoffreport.ProjectDescriptor], error)
- func (a *HandoffReportApplication) ListWorkstreams(ctx context.Context, project string, cursor *string, limit int, archived bool) (handoffreport.Page[handoffreport.WorkstreamDescriptor], error)
- func (a *HandoffReportApplication) PurgeActivities(ctx context.Context, project string, before time.Time) (int64, error)
- func (a *HandoffReportApplication) RecordActivity(ctx context.Context, input RecordHandoffReportActivity) (handoffreport.StoredActivity, error)
- func (a *HandoffReportApplication) RegisterWorkstream(ctx context.Context, input RegisterHandoffReportWorkstream) (handoffreport.WorkstreamDescriptor, error)
- func (a *HandoffReportApplication) UpdateProject(ctx context.Context, value handoffreport.ProjectDescriptor, expected int) (handoffreport.ProjectDescriptor, error)
- func (a *HandoffReportApplication) UpdateWorkstream(ctx context.Context, value handoffreport.WorkstreamDescriptor, expected int) (handoffreport.WorkstreamDescriptor, error)
- type HandoffReportBackend
- type HandoffReportIDFactory
- type HandoffReportPeriod
- type HandoffReportReader
- func (*HandoffReportReader) CheckEvidence(context.Context, string, artifact.Ref) ([]handoff.EvidenceCheck, error)
- func (r *HandoffReportReader) Get(ctx context.Context, scope string, ref artifact.Ref) (handoff.Handoff, error)
- func (r *HandoffReportReader) Latest(ctx context.Context, scope string) (handoff.Handoff, bool, error)
- func (r *HandoffReportReader) Revisions(ctx context.Context, scope string) ([]handoff.Handoff, error)
- type HandoffScopeIDs
- type HandoffServiceFactory
- type InvalidScopeError
- type KnownHandoffScopePage
- type MemoryApplication
- func (a *MemoryApplication) Changes(ctx context.Context, scopeID string, sinceRevision *int64) (MemoryChangesPage, error)
- func (a *MemoryApplication) Flush(ctx context.Context, scopeID string) (MemoryFlushResult, error)
- func (a *MemoryApplication) Get(ctx context.Context, scopeID string, citation memory.Citation) (MemoryEntryRecord, error)
- func (a *MemoryApplication) List(ctx context.Context, scopeID string, includeInactive bool) (MemoryEntriesPage, error)
- func (a *MemoryApplication) Remember(ctx context.Context, scopeID string, request RememberMemoryRequest) (MemoryMutationResult, error)
- func (a *MemoryApplication) Retire(ctx context.Context, scopeID string, citation memory.Citation, reason *string) (MemoryMutationResult, error)
- func (a *MemoryApplication) Revise(ctx context.Context, scopeID string, citation memory.Citation, ...) (MemoryMutationResult, error)
- func (a *MemoryApplication) Search(ctx context.Context, scopeID, query string, limit int, mode memory.SearchMode) (MemorySearchPage, error)
- type MemoryChangesPage
- type MemoryEntriesPage
- type MemoryEntryRecord
- type MemoryFlushBackend
- type MemoryFlushBackendFactory
- type MemoryFlushResult
- type MemoryMutationResult
- type MemorySearchPage
- type MemoryServiceFactory
- type ModelUsageRecorder
- type ModelUsageRecorderFunc
- type Probe
- type ProbeDefinition
- type Readiness
- type ReadinessChecks
- type ReadinessStatus
- type RecallStatistics
- type RecallStatisticsFunc
- type RecordHandoffReportActivity
- type RegisterHandoffReportWorkstream
- type RememberMemoryRequest
- type Resource
- type ReviewApplication
- func (a *ReviewApplication) Approve(ctx context.Context, scopeID, candidateID string, expectedVersion int64) (review.Snapshot, error)
- func (a *ReviewApplication) GetCandidate(ctx context.Context, scopeID, candidateID string) (review.Snapshot, error)
- func (a *ReviewApplication) GetExperience(ctx context.Context, scopeID string, ref artifact.Ref) (experience.Experience, error)
- func (a *ReviewApplication) GetSkill(ctx context.Context, scopeID string, ref artifact.Ref) (skill.Skill, error)
- func (a *ReviewApplication) ListCandidates(ctx context.Context, scopeID string, status review.Status, ...) (review.Page, error)
- func (a *ReviewApplication) ProposeExperience(ctx context.Context, scopeID string, proposal experience.Content, ...) (review.Snapshot, error)
- func (a *ReviewApplication) ProposeSkill(ctx context.Context, scopeID string, proposal skill.Content, ...) (review.Snapshot, error)
- func (a *ReviewApplication) Reject(ctx context.Context, scopeID, candidateID string, expectedVersion int64, ...) (review.Snapshot, error)
- func (a *ReviewApplication) Revise(ctx context.Context, scopeID, candidateID string, expectedVersion int64, ...) (review.Snapshot, error)
- type ReviewServiceFactory
- type Runtime
- func (r *Runtime) AttachScheduler(scheduler SchedulerLifecycle) error
- func (r *Runtime) Background(ctx context.Context, fn func(context.Context) error) error
- func (r *Runtime) BackgroundOperation(ctx context.Context, name string, fn func(context.Context) (string, error)) (err error)
- func (r *Runtime) Close(ctx context.Context) error
- func (r *Runtime) Operation(ctx context.Context, fn func(context.Context) error) error
- func (r *Runtime) ScopedRead(ctx context.Context, scopeID string, fn func(context.Context, string) error) error
- func (r *Runtime) ScopedWrite(ctx context.Context, scopeID string, fn func(context.Context, string) error) error
- type RuntimeOptions
- type ScheduledObservation
- type ScheduledObserver
- type ScheduledProcessor
- type ScheduledScopeLister
- type SchedulerLifecycle
- type ScopeCacheObserver
- type ScopeEvictor
- type SourceApplication
- type SourceCaptureBackend
- type SourceReceipt
- type StageSpan
- type StageTracing
- type StageTracingFunc
- type StateError
- type StatisticsApplication
- type StatisticsReader
- type StatisticsReaderFactory
- type TraceAttribute
- type WorkApplication
- func (a *WorkApplication) Acknowledge(ctx context.Context, scopeID string, request work.Acknowledge) (work.Acknowledgement, error)
- func (a *WorkApplication) Continuity(ctx context.Context, scopeID string, selected *artifact.Ref) (work.Continuity, error)
- func (a *WorkApplication) CreateContract(ctx context.Context, scopeID string, request work.CreateContract) (work.SourceReceipt, error)
- func (a *WorkApplication) HandoffCurrent(ctx context.Context, scopeID string, request work.HandoffCurrent) (work.PreparedHandoff, error)
- func (a *WorkApplication) RecordOutcome(ctx context.Context, scopeID string, request work.RecordOutcome) (work.SourceReceipt, error)
- type WorkSourceBackend
Constants ¶
const ( DefaultMemoryArtifactID = "memory" DefaultSourceWindowLimit = int64(100) )
const ( DefaultReadinessProbeTimeout = 2 * time.Second DefaultReadinessCacheTTL = 5 * time.Minute TransientReadinessCacheTTL = 30 * time.Second )
const ( ProcessSourceWindowOperation = "process_source_window" IncubateExperienceOperation = "incubate_experience_candidates" ScheduledProcessingSuccess = "success" ScheduledProcessingNoop = "noop" ScheduledProcessingFailure = "failure" ScheduledProcessingCancelled = "cancelled" )
const DefaultHandoffArtifactID = "handoff"
const DefaultScopeCacheSize = 128
const MaxScopeIDLength = 256
const PreparedContextV1 = "powercontext.prepared-context.v1"
Variables ¶
This section is empty.
Functions ¶
func ReportEmbeddingUsage ¶
func ReportEmbeddingUsage(delegate inference.EmbeddingModel) inference.EmbeddingModel
ReportEmbeddingUsage decorates an embedding model while preserving its immutable profile. Empty and failed calls retain the delegate's behavior.
func ReportStructuredUsage ¶
func ReportStructuredUsage[I, O any]( delegate inference.StructuredGenerator[I, O], ) inference.StructuredGenerator[I, O]
ReportStructuredUsage decorates a structured generator without changing its provider contract. Only successful results are reported, and attribution is resolved from the admitted Runtime operation's context.
func TraceMemoryReranker ¶
TraceMemoryReranker records the bounded rerank stage around the actual model call, so provider spans remain children of memory.rerank and no query or candidate text becomes an attribute.
func ValidateScopeID ¶
ValidateScopeID validates the opaque runtime partition. Like the frozen Python runtime it accepts nonblank leading/trailing whitespace; individual persistence adapters may impose their stricter storage identity contract.
Types ¶
type BackgroundTracing ¶
type BackgroundTracing interface {
StartBackground(context.Context, string, map[string]TraceAttribute) (context.Context, StageSpan)
}
BackgroundTracing is an optional consumer-owned boundary for work that has no request parent. Runtime remains transport-agnostic while a consumer such as the server can export an independent operation root.
type CachedProbe ¶
type CachedProbe struct {
// contains filtered or unexported fields
}
CachedProbe caches stable and transient outcomes with separate TTLs and collapses concurrent refreshes without holding a mutex during I/O.
func NewCachedProbe ¶
func (*CachedProbe) Probe ¶
func (p *CachedProbe) Probe(ctx context.Context) (CheckStatus, error)
type Capabilities ¶
type Capabilities struct {
// contains filtered or unexported fields
}
func EmptyCapabilities ¶
func EmptyCapabilities() Capabilities
func NewCapabilities ¶
func NewCapabilities(options CapabilityOptions) (Capabilities, error)
func (Capabilities) ArtifactFamilies ¶
func (c Capabilities) ArtifactFamilies() []string
func (Capabilities) ContextVersions ¶
func (c Capabilities) ContextVersions() []string
func (Capabilities) ExperienceGeneration ¶
func (c Capabilities) ExperienceGeneration() bool
func (Capabilities) ExternalSkillRegistry ¶
func (c Capabilities) ExternalSkillRegistry() bool
func (Capabilities) HandoffGeneration ¶
func (c Capabilities) HandoffGeneration() bool
func (Capabilities) ManagedSkillGeneration ¶
func (c Capabilities) ManagedSkillGeneration() bool
func (Capabilities) MemoryExtraction ¶
func (c Capabilities) MemoryExtraction() bool
func (Capabilities) SearchModes ¶
func (c Capabilities) SearchModes() []memory.SearchMode
func (Capabilities) SourceTypes ¶
func (c Capabilities) SourceTypes() []string
type CapabilityOptions ¶
type CheckStatus ¶
type CheckStatus string
const ( CheckReady CheckStatus = "ready" CheckTimeout CheckStatus = "timeout" CheckMisconfigured CheckStatus = "misconfigured" )
type ContextApplication ¶
type ContextApplication struct {
// contains filtered or unexported fields
}
ContextApplication owns the composite preparation use case. Memory and Experience candidates are selected under one admitted per-scope gate, then the pure Builder owns final selection, trust labeling, and the byte budget.
func NewContextApplication ¶
func NewContextApplication( runtime *Runtime, memoryApplication *MemoryApplication, experiences ExperienceRecall, ) (*ContextApplication, error)
func NewContextApplicationWithRecall ¶
func NewContextApplicationWithRecall( runtime *Runtime, memoryApplication *MemoryApplication, experiences ExperienceRecall, recall RecallStatistics, ) (*ContextApplication, error)
func (*ContextApplication) Prepare ¶
func (a *ContextApplication) Prepare( ctx context.Context, scopeID string, request contextpack.Request, ) (contextpack.Prepared, error)
type CreateHandoffReportProject ¶
type CreateHandoffReportProject struct {
ProjectKey, Title string
Description *string
DefaultLocale handoffreport.Locale
Timezone string
}
type DependencyOperation ¶
type ExperienceIncubationApplication ¶
type ExperienceIncubationApplication struct {
// contains filtered or unexported fields
}
func NewExperienceIncubationApplication ¶
func NewExperienceIncubationApplication( runtime *Runtime, backends ExperienceIncubationBackendFactory, pipeline experience.CandidatePipeline, idFactory review.IDFactory, ) (*ExperienceIncubationApplication, error)
func (*ExperienceIncubationApplication) Incubate ¶
func (a *ExperienceIncubationApplication) Incubate( ctx context.Context, scopeID string, limit int64, ) (ExperienceIncubationResult, error)
type ExperienceIncubationBackend ¶
type ExperienceIncubationBackend interface {
ObserveWindow(context.Context, string, int64) (
previous source.Cursor,
next source.Cursor,
generation *int64,
highWatermark int64,
values []source.Value,
available []source.Ref,
err error,
)
ApplyWindow(
context.Context,
string,
[]string,
[]experience.CandidateInput,
source.Cursor,
*int64,
) error
}
ExperienceIncubationBackend is the use-case-shaped two-transaction port. ObserveWindow commits before model inference; ApplyWindow atomically creates every Candidate and advances the independent Source cursor.
type ExperienceIncubationBackendFactory ¶
type ExperienceIncubationBackendFactory func(string) (ExperienceIncubationBackend, error)
type ExperienceIncubationResult ¶
type ExperienceIncubationResult struct {
PreviousCursor int64
HighWatermark int64
CurrentCursor int64
ProcessedSourceCount int
CandidateCount int
}
func (ExperienceIncubationResult) Processed ¶
func (r ExperienceIncubationResult) Processed() bool
type ExperienceRecall ¶
type ExperienceRecall interface {
Search(context.Context, string, string, int) ([]experience.SearchHit, error)
}
ExperienceRecall is the narrow read surface Context preparation consumes. Persistence implementations remain free to use SQLite FTS, OceanBase FULLTEXT, or a deterministic fake without leaking those details here.
type ExperienceRecallFunc ¶
type ExperienceRecallFunc func(context.Context, string, string, int) ([]experience.SearchHit, error)
func (ExperienceRecallFunc) Search ¶
func (f ExperienceRecallFunc) Search( ctx context.Context, scopeID, query string, limit int, ) ([]experience.SearchHit, error)
type ExternalSkillApplication ¶
type ExternalSkillApplication struct {
// contains filtered or unexported fields
}
func NewExternalSkillApplication ¶
func NewExternalSkillApplication( runtime *Runtime, registries ExternalSkillRegistryFactory, generations GenerationServiceFactory, snapshots ExternalSkillSnapshotStore, ) (*ExternalSkillApplication, error)
func (*ExternalSkillApplication) Import ¶
func (a *ExternalSkillApplication) Import( ctx context.Context, scopeID, externalSkillID, fingerprint string, mode skill.ImportMode, reason *string, ) (review.GeneratedCandidateResult, error)
func (*ExternalSkillApplication) List ¶
func (a *ExternalSkillApplication) List( ctx context.Context, scopeID string, includeUnavailable bool, ) ([]skill.Resolution, error)
func (*ExternalSkillApplication) Resolve ¶
func (a *ExternalSkillApplication) Resolve( ctx context.Context, scopeID, externalSkillID, fingerprint string, ) (skill.Resolution, error)
func (*ExternalSkillApplication) Scan ¶
func (a *ExternalSkillApplication) Scan(ctx context.Context, scopeID string) (skill.ProviderScan, error)
type ExternalSkillRegistryFactory ¶
type ExternalSkillRegistryFactory func(string) (*skill.RegistryService, error)
type GenerationApplication ¶
type GenerationApplication struct {
// contains filtered or unexported fields
}
func NewGenerationApplication ¶
func NewGenerationApplication(runtime *Runtime, services GenerationServiceFactory) (*GenerationApplication, error)
func (*GenerationApplication) GenerateExperience ¶
func (*GenerationApplication) GenerateSkill ¶
type GenerationServiceFactory ¶
type GenerationServiceFactory func(string) (*review.GenerationService, error)
type GetHandoffReport ¶
type GetHandoffReport struct {
ScopeID string
Locale *handoffreport.Locale
IncludeEvidenceChecks bool
Format handoffreport.Format
IncludeArchived bool
Period *HandoffReportPeriod
}
type HandoffActivationBackend ¶
type HandoffActivationBackend interface {
LoadBoundary(context.Context, string, source.Ref, string) (int64, source.Cursor, *int64, error)
SaveBoundary(context.Context, string, string, source.Cursor, *int64) error
}
HandoffActivationBackend brackets generation with short transactional boundary reads and cursor CAS writes.
type HandoffActivationResult ¶
type HandoffActivationResult = handoff.Activation
type HandoffActivationStatus ¶
type HandoffActivationStatus = handoff.ActivationStatus
const ( HandoffGenerated HandoffActivationStatus = handoff.ActivationGenerated HandoffIgnored HandoffActivationStatus = handoff.ActivationIgnored )
type HandoffApplication ¶
type HandoffApplication struct {
// contains filtered or unexported fields
}
func NewHandoffApplication ¶
func NewHandoffApplication( runtime *Runtime, services HandoffServiceFactory, activation HandoffActivationBackend, ) (*HandoffApplication, error)
func (*HandoffApplication) Activate ¶
func (a *HandoffApplication) Activate( ctx context.Context, scopeID string, activation handoff.Activate, ) (HandoffActivationResult, error)
func (*HandoffApplication) ContinueLatest ¶
func (a *HandoffApplication) ContinueLatest( ctx context.Context, scopeID string, ) (handoff.Resolution, error)
func (*HandoffApplication) ContinuePrepared ¶
func (a *HandoffApplication) ContinuePrepared( ctx context.Context, scopeID string, prepared handoff.Prepared, ) (handoff.Resolution, error)
func (*HandoffApplication) ContinueRevision ¶
func (a *HandoffApplication) ContinueRevision( ctx context.Context, scopeID string, ref artifact.Ref, ) (handoff.Resolution, error)
type HandoffReportActivityList ¶
type HandoffReportActivityList struct {
ProjectID string
PeriodStart, PeriodEnd *time.Time
Sources []handoffreport.ActivitySource
AfterCursor int64
ThroughCursor *int64
Limit int
}
type HandoffReportApplication ¶
type HandoffReportApplication struct {
// contains filtered or unexported fields
}
func NewHandoffReportApplication ¶
func NewHandoffReportApplication( runtime *Runtime, backend HandoffReportBackend, reader handoffreport.HandoffReader, continuity handoffreport.WorkContinuityReader, clock Clock, ids HandoffReportIDFactory, scopeProviders ...HandoffScopeIDs, ) (*HandoffReportApplication, error)
func (*HandoffReportApplication) AttachWorkspaceBinding ¶
func (a *HandoffReportApplication) AttachWorkspaceBinding(ctx context.Context, id, project string, repository handoffreport.RepositoryRef, expected *int) (handoffreport.WorkspaceBinding, error)
func (*HandoffReportApplication) CreateProject ¶
func (a *HandoffReportApplication) CreateProject(ctx context.Context, input CreateHandoffReportProject) (handoffreport.ProjectDescriptor, error)
func (*HandoffReportApplication) DetachWorkspaceBinding ¶
func (a *HandoffReportApplication) DetachWorkspaceBinding(ctx context.Context, id string, expected int) (handoffreport.WorkspaceBinding, error)
func (*HandoffReportApplication) GetProject ¶
func (a *HandoffReportApplication) GetProject(ctx context.Context, id string) (handoffreport.ProjectDescriptor, error)
func (*HandoffReportApplication) GetReport ¶
func (a *HandoffReportApplication) GetReport(ctx context.Context, input GetHandoffReport) (handoffreport.Report, error)
func (*HandoffReportApplication) GetWorkspaceBinding ¶
func (a *HandoffReportApplication) GetWorkspaceBinding(ctx context.Context, id string) (handoffreport.WorkspaceBinding, error)
func (*HandoffReportApplication) ListActivities ¶
func (a *HandoffReportApplication) ListActivities(ctx context.Context, query HandoffReportActivityList) (handoffreport.ActivityPage, error)
func (*HandoffReportApplication) ListKnownScopes ¶
func (a *HandoffReportApplication) ListKnownScopes(ctx context.Context, cursor *string, limit int) (KnownHandoffScopePage, error)
func (*HandoffReportApplication) ListProjects ¶
func (a *HandoffReportApplication) ListProjects(ctx context.Context, cursor *string, limit int, archived bool) (handoffreport.Page[handoffreport.ProjectDescriptor], error)
func (*HandoffReportApplication) ListWorkstreams ¶
func (a *HandoffReportApplication) ListWorkstreams(ctx context.Context, project string, cursor *string, limit int, archived bool) (handoffreport.Page[handoffreport.WorkstreamDescriptor], error)
func (*HandoffReportApplication) PurgeActivities ¶
func (*HandoffReportApplication) RecordActivity ¶
func (a *HandoffReportApplication) RecordActivity(ctx context.Context, input RecordHandoffReportActivity) (handoffreport.StoredActivity, error)
func (*HandoffReportApplication) RegisterWorkstream ¶
func (a *HandoffReportApplication) RegisterWorkstream(ctx context.Context, input RegisterHandoffReportWorkstream) (handoffreport.WorkstreamDescriptor, error)
func (*HandoffReportApplication) UpdateProject ¶
func (a *HandoffReportApplication) UpdateProject(ctx context.Context, value handoffreport.ProjectDescriptor, expected int) (handoffreport.ProjectDescriptor, error)
func (*HandoffReportApplication) UpdateWorkstream ¶
func (a *HandoffReportApplication) UpdateWorkstream(ctx context.Context, value handoffreport.WorkstreamDescriptor, expected int) (handoffreport.WorkstreamDescriptor, error)
type HandoffReportBackend ¶
type HandoffReportBackend interface {
CreateProject(context.Context, handoffreport.ProjectDescriptor, time.Time) (handoffreport.ProjectDescriptor, error)
GetProject(context.Context, string) (handoffreport.ProjectDescriptor, error)
UpdateProject(context.Context, handoffreport.ProjectDescriptor, int, time.Time) (handoffreport.ProjectDescriptor, error)
ListProjects(context.Context, *string, int, bool) (handoffreport.Page[handoffreport.ProjectDescriptor], error)
RegisterWorkstream(context.Context, handoffreport.WorkstreamDescriptor, time.Time) (handoffreport.WorkstreamDescriptor, error)
UpdateWorkstream(context.Context, handoffreport.WorkstreamDescriptor, int, time.Time) (handoffreport.WorkstreamDescriptor, error)
ListWorkstreams(context.Context, string, *string, int, bool) (handoffreport.Page[handoffreport.WorkstreamDescriptor], error)
RecordActivity(context.Context, handoffreport.ActivityEvent) (handoffreport.StoredActivity, error)
ListActivities(context.Context, string, *time.Time, *time.Time, []handoffreport.ActivitySource, int64, *int64, int) (handoffreport.ActivityPage, error)
PurgeActivities(context.Context, string, time.Time) (int64, error)
GetWorkspaceBinding(context.Context, string) (handoffreport.WorkspaceBinding, error)
AttachWorkspaceBinding(context.Context, string, string, handoffreport.RepositoryRef, *int, time.Time) (handoffreport.WorkspaceBinding, error)
DetachWorkspaceBinding(context.Context, string, int) (handoffreport.WorkspaceBinding, error)
ReadHandoffReportInputs(context.Context, string, bool, *time.Time, *time.Time, *time.Time, *time.Time) (handoffreport.ProjectDescriptor, []handoffreport.WorkstreamDescriptor, []handoffreport.ActivityEvent, int64, int, error)
}
type HandoffReportIDFactory ¶
type HandoffReportPeriod ¶
type HandoffReportReader ¶
type HandoffReportReader struct {
// contains filtered or unexported fields
}
HandoffReportReader exposes only committed exact reads. Evidence checking is explicitly unavailable because reusing Continue would cross its trust and telemetry boundary.
func NewHandoffReportReader ¶
func NewHandoffReportReader(services HandoffServiceFactory) (*HandoffReportReader, error)
func (*HandoffReportReader) CheckEvidence ¶
func (*HandoffReportReader) CheckEvidence(context.Context, string, artifact.Ref) ([]handoff.EvidenceCheck, error)
type InvalidScopeError ¶
type InvalidScopeError struct{ Detail string }
func (*InvalidScopeError) Error ¶
func (e *InvalidScopeError) Error() string
type KnownHandoffScopePage ¶
type MemoryApplication ¶
type MemoryApplication struct {
// contains filtered or unexported fields
}
func NewMemoryApplication ¶
func NewMemoryApplication(runtime *Runtime, services MemoryServiceFactory, memoryArtifactID string) (*MemoryApplication, error)
func NewMemoryApplicationWithFlush ¶
func NewMemoryApplicationWithFlush( runtime *Runtime, services MemoryServiceFactory, flushes MemoryFlushBackendFactory, memoryArtifactID string, sourceWindowLimit int64, ) (*MemoryApplication, error)
NewMemoryApplicationWithFlush constructs the complete Memory application. The simpler constructor remains useful for deployments that intentionally expose only explicit Memory operations.
func (*MemoryApplication) Changes ¶
func (a *MemoryApplication) Changes( ctx context.Context, scopeID string, sinceRevision *int64, ) (MemoryChangesPage, error)
func (*MemoryApplication) Flush ¶
func (a *MemoryApplication) Flush(ctx context.Context, scopeID string) (MemoryFlushResult, error)
Flush advances the stable Memory Source window. Planning may invoke models and is intentionally performed after ObserveWindow has committed and before ApplyWindow opens the final transaction.
func (*MemoryApplication) Get ¶
func (a *MemoryApplication) Get( ctx context.Context, scopeID string, citation memory.Citation, ) (MemoryEntryRecord, error)
func (*MemoryApplication) List ¶
func (a *MemoryApplication) List( ctx context.Context, scopeID string, includeInactive bool, ) (MemoryEntriesPage, error)
func (*MemoryApplication) Remember ¶
func (a *MemoryApplication) Remember( ctx context.Context, scopeID string, request RememberMemoryRequest, ) (MemoryMutationResult, error)
func (*MemoryApplication) Retire ¶
func (a *MemoryApplication) Retire( ctx context.Context, scopeID string, citation memory.Citation, reason *string, ) (MemoryMutationResult, error)
func (*MemoryApplication) Revise ¶
func (a *MemoryApplication) Revise( ctx context.Context, scopeID string, citation memory.Citation, kind, text string, reason *string, ) (MemoryMutationResult, error)
func (*MemoryApplication) Search ¶
func (a *MemoryApplication) Search( ctx context.Context, scopeID, query string, limit int, mode memory.SearchMode, ) (MemorySearchPage, error)
type MemoryChangesPage ¶
type MemoryChangesPage struct {
MemoryRef *artifact.Ref
Revisions []memory.RevisionChanges
}
type MemoryEntriesPage ¶
type MemoryEntriesPage struct {
MemoryRef *artifact.Ref
Entries []MemoryEntryRecord
}
type MemoryEntryRecord ¶
type MemoryEntryRecord struct {
MemoryRef artifact.Ref
State memory.EntryState
Entry memory.EntryVersion
}
func (MemoryEntryRecord) Clone ¶
func (r MemoryEntryRecord) Clone() MemoryEntryRecord
type MemoryFlushBackend ¶
type MemoryFlushBackend interface {
ObserveWindow(context.Context, string, int64) (
previous source.Cursor,
next source.Cursor,
generation *int64,
highWatermark int64,
values []source.Value,
err error,
)
ApplyWindow(context.Context, string, memory.WritePlan, source.Cursor, *int64) (*memory.Memory, error)
}
MemoryFlushBackend is the use-case-shaped persistence port for the two transaction boundaries surrounding extraction. ObserveWindow returns one relational snapshot; ApplyWindow must atomically apply the Memory plan and cursor CAS.
type MemoryFlushBackendFactory ¶
type MemoryFlushBackendFactory func(string) (MemoryFlushBackend, error)
type MemoryFlushResult ¶
type MemoryFlushResult struct {
PreviousCursor int64
CurrentCursor int64
HighWatermark int64
ProcessedSourceCount int
MemoryRef *artifact.Ref
}
func (MemoryFlushResult) Processed ¶
func (r MemoryFlushResult) Processed() bool
type MemoryMutationResult ¶
type MemoryMutationResult struct {
PreviousRevision *int64
MemoryRef artifact.Ref
Entry *MemoryEntryRecord
}
type MemorySearchPage ¶
type MemorySearchPage struct {
MemoryRef *artifact.Ref
Mode *memory.SearchMode
Hits []memory.Hit
Rerank *memory.RerankTrace
}
type ModelUsageRecorder ¶
type ModelUsageRecorder interface {
RecordModelUsage(
context.Context,
string,
stats.ModelPurpose,
stats.ModelOperation,
inference.Usage,
)
}
ModelUsageRecorder is the best-effort application-side sink used by inference decorators. Implementations own persistence failure handling so a statistics outage can never turn a successful model call into a failed business operation.
type ModelUsageRecorderFunc ¶
type ModelUsageRecorderFunc func( context.Context, string, stats.ModelPurpose, stats.ModelOperation, inference.Usage, )
func (ModelUsageRecorderFunc) RecordModelUsage ¶
func (f ModelUsageRecorderFunc) RecordModelUsage( ctx context.Context, scopeID string, purpose stats.ModelPurpose, operation stats.ModelOperation, usage inference.Usage, )
type Probe ¶
type Probe func(context.Context) (CheckStatus, error)
func DependencyProbe ¶
func DependencyProbe(operation DependencyOperation, timeout time.Duration) Probe
DependencyProbe bounds one dependency call and maps only safe readiness categories; provider messages and credentials never escape into checks.
type ProbeDefinition ¶
type Readiness ¶
type Readiness struct {
// contains filtered or unexported fields
}
func (Readiness) CheckOrder ¶
func (Readiness) Checks ¶
func (r Readiness) Checks() map[string]CheckStatus
func (Readiness) Status ¶
func (r Readiness) Status() ReadinessStatus
type ReadinessChecks ¶
type ReadinessChecks struct {
// contains filtered or unexported fields
}
func NewReadinessChecks ¶
func NewReadinessChecks(definitions []ProbeDefinition) (*ReadinessChecks, error)
type ReadinessStatus ¶
type ReadinessStatus string
const ( Ready ReadinessStatus = "ready" Degraded ReadinessStatus = "degraded" NotReady ReadinessStatus = "not_ready" )
type RecallStatistics ¶
type RecallStatistics interface {
ObservePreparedContext(context.Context, string, contextpack.Build)
}
RecallStatistics observes one final Context Pack after the per-scope gate is released but before lifecycle admission ends. Implementations are best-effort: persistence or estimation failures must be handled internally.
type RecallStatisticsFunc ¶
type RecallStatisticsFunc func(context.Context, string, contextpack.Build)
func (RecallStatisticsFunc) ObservePreparedContext ¶
func (f RecallStatisticsFunc) ObservePreparedContext( ctx context.Context, scopeID string, build contextpack.Build, )
type RecordHandoffReportActivity ¶
type RecordHandoffReportActivity struct {
ProjectID string
ScopeID *string
Source handoffreport.ActivitySource
SourceEventID string
SourceRef *handoffreport.ExternalReference
OccurredAt *time.Time
TimeBasis handoffreport.TimeBasis
Title, Summary *string
Agent *handoffreport.ActivityAgent
SessionID *string
VCSContext *handoffreport.ActivityVCSContext
EvidenceRefs []handoffreport.ExternalReference
}
type RegisterHandoffReportWorkstream ¶
type RegisterHandoffReportWorkstream struct {
ProjectID, ScopeID string
Key *string
Title string
Kind handoffreport.WorkstreamKind
CatalogState handoffreport.CatalogState
ExternalRefs []handoffreport.ExternalReference
Labels []string
}
type RememberMemoryRequest ¶
type Resource ¶
Resource is an explicitly owned Runtime dependency closed after scheduled work and admitted operations have drained.
type ReviewApplication ¶
type ReviewApplication struct {
// contains filtered or unexported fields
}
func NewReviewApplication ¶
func NewReviewApplication(runtime *Runtime, services ReviewServiceFactory) (*ReviewApplication, error)
func (*ReviewApplication) GetCandidate ¶
func (*ReviewApplication) GetExperience ¶
func (a *ReviewApplication) GetExperience( ctx context.Context, scopeID string, ref artifact.Ref, ) (experience.Experience, error)
func (*ReviewApplication) ListCandidates ¶
func (*ReviewApplication) ProposeExperience ¶
func (*ReviewApplication) ProposeSkill ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns operation admission and per-scope write serialization. Domain services remain lifecycle-free and are invoked inside these boundaries by endpoint-facing application methods.
func NewConfigured ¶
func NewConfigured( options RuntimeOptions, recorder ModelUsageRecorder, resources ...Resource, ) (*Runtime, error)
NewConfigured constructs a Runtime with bounded Scope retention and optional low-cardinality observation. A zero ScopeCacheSize selects the current compatibility default.
func NewWithModelUsageRecorder ¶
func NewWithModelUsageRecorder(recorder ModelUsageRecorder, resources ...Resource) *Runtime
NewWithModelUsageRecorder constructs a Runtime whose admitted operations can attribute successful inference calls. The recorder is deliberately best-effort and does not participate in Runtime resource ownership.
func (*Runtime) AttachScheduler ¶
func (r *Runtime) AttachScheduler(scheduler SchedulerLifecycle) error
AttachScheduler transfers lifecycle ownership after a scheduler has been opened with handlers that dispatch through this Runtime.
func (*Runtime) Background ¶
Background serializes scheduled processors across all Scopes while keeping their execution visible to lifecycle admission.
func (*Runtime) BackgroundOperation ¶
func (r *Runtime) BackgroundOperation( ctx context.Context, name string, fn func(context.Context) (string, error), ) (err error)
BackgroundOperation serializes one named background operation and lets the owning transport trace it as a root. The callback returns its observable outcome separately because scheduled scope failures may be isolated rather than returned as the dispatch error.
func (*Runtime) Close ¶
Close atomically rejects new operations and waits for every admitted read, writer, lock waiter, and background processor. If ctx is canceled before the drain completes, admission is restored so the owner can retry shutdown.
func (*Runtime) Operation ¶
Operation admits one unscoped read/use case and tracks it through close.
func (*Runtime) ScopedRead ¶
func (r *Runtime) ScopedRead(ctx context.Context, scopeID string, fn func(context.Context, string) error) error
ScopedRead admits one scoped operation without serializing it against other reads. It is still drained during shutdown.
func (*Runtime) ScopedWrite ¶
func (r *Runtime) ScopedWrite(ctx context.Context, scopeID string, fn func(context.Context, string) error) error
ScopedWrite admits one operation then acquires the reference-counted lock for its exact Scope. Waiting writers are active operations, so Close waits until each either runs or observes cancellation.
type RuntimeOptions ¶
type RuntimeOptions struct {
ScopeCacheSize int
ScopeEvictor ScopeEvictor
ScopeObserver ScopeCacheObserver
Tracing StageTracing
}
type ScheduledObservation ¶
type ScheduledObserver ¶
type ScheduledObserver func(context.Context, ScheduledObservation)
type ScheduledProcessor ¶
type ScheduledProcessor struct {
// contains filtered or unexported fields
}
ScheduledProcessor serializes both persisted jobs globally, then visits Source-backed Scopes deterministically. Each Scope keeps its normal write gate, while one failure is observed and isolated from later Scopes.
func NewScheduledProcessor ¶
func NewScheduledProcessor( runtime *Runtime, scopes ScheduledScopeLister, memory *MemoryApplication, experience *ExperienceIncubationApplication, observer ScheduledObserver, clock func() time.Time, ) (*ScheduledProcessor, error)
func (*ScheduledProcessor) IncubateExperiences ¶
func (p *ScheduledProcessor) IncubateExperiences(ctx context.Context) error
func (*ScheduledProcessor) ProcessSourceWindows ¶
func (p *ScheduledProcessor) ProcessSourceWindows(ctx context.Context) error
type ScheduledScopeLister ¶
type SchedulerLifecycle ¶
SchedulerLifecycle is the consumer-shaped shutdown surface required by the Runtime. Pause prevents new scheduled dispatch; Close drains its loop.
type ScopeCacheObserver ¶
type ScopeCacheObserver func(cached, active int)
type ScopeEvictor ¶
type ScopeEvictor func(scopeID string)
type SourceApplication ¶
type SourceApplication struct {
// contains filtered or unexported fields
}
func NewSourceApplication ¶
func NewSourceApplication(runtime *Runtime, backend SourceCaptureBackend) (*SourceApplication, error)
func (*SourceApplication) CaptureContent ¶
func (a *SourceApplication) CaptureContent( ctx context.Context, scopeID, sourceID, content string, metadata map[string]any, ) (SourceReceipt, error)
type SourceCaptureBackend ¶
type SourceReceipt ¶
type StageSpan ¶
type StageSpan interface {
SetAttributes(map[string]TraceAttribute)
Finish(outcome string, err error)
}
StageSpan is the minimal tracing surface consumed by Runtime operations. Implementations must treat attributes as operational metadata only.
type StageTracing ¶
type StageTracingFunc ¶
type StageTracingFunc func(context.Context, string, map[string]TraceAttribute) (context.Context, StageSpan)
func (StageTracingFunc) StartStage ¶
func (f StageTracingFunc) StartStage( ctx context.Context, name string, attributes map[string]TraceAttribute, ) (context.Context, StageSpan)
type StateError ¶
type StateError struct{ Code string }
func (*StateError) Error ¶
func (e *StateError) Error() string
type StatisticsApplication ¶
type StatisticsApplication struct {
// contains filtered or unexported fields
}
func NewStatisticsApplication ¶
func NewStatisticsApplication( runtime *Runtime, readers StatisticsReaderFactory, clock Clock, ) (*StatisticsApplication, error)
type StatisticsReader ¶
type StatisticsReader interface {
Overview(context.Context, stats.Period, time.Time) (stats.Statistics, error)
}
StatisticsReader is the exact read surface needed by the product-facing application. Persistence implementations may additionally record usage, but the HTTP operation does not depend on those mutation methods.
type StatisticsReaderFactory ¶
type StatisticsReaderFactory func(string) (StatisticsReader, error)
type TraceAttribute ¶
type TraceAttribute = any
TraceAttribute values are validated by the tracing adapter before export. Runtime call sites use only string, bool, int, int64, and float64 values.
type WorkApplication ¶
type WorkApplication struct {
// contains filtered or unexported fields
}
WorkApplication orchestrates the delegation, Handoff, acknowledgement, and outcome loop over the existing Source journal and Handoff authority.
func NewWorkApplication ¶
func NewWorkApplication(runtime *Runtime, sources WorkSourceBackend, handoffs HandoffServiceFactory) (*WorkApplication, error)
func (*WorkApplication) Acknowledge ¶
func (a *WorkApplication) Acknowledge(ctx context.Context, scopeID string, request work.Acknowledge) (work.Acknowledgement, error)
func (*WorkApplication) Continuity ¶
func (a *WorkApplication) Continuity(ctx context.Context, scopeID string, selected *artifact.Ref) (work.Continuity, error)
func (*WorkApplication) CreateContract ¶
func (a *WorkApplication) CreateContract(ctx context.Context, scopeID string, request work.CreateContract) (work.SourceReceipt, error)
func (*WorkApplication) HandoffCurrent ¶
func (a *WorkApplication) HandoffCurrent(ctx context.Context, scopeID string, request work.HandoffCurrent) (work.PreparedHandoff, error)
func (*WorkApplication) RecordOutcome ¶
func (a *WorkApplication) RecordOutcome(ctx context.Context, scopeID string, request work.RecordOutcome) (work.SourceReceipt, error)
Source Files
¶
- capabilities.go
- context_application.go
- doc.go
- experience_incubation.go
- external_skill_application.go
- generation_application.go
- handoff_application.go
- handoff_report_application.go
- lifecycle.go
- memory_application.go
- memory_commands.go
- memory_queries.go
- memory_tracing.go
- memory_types.go
- model_usage.go
- readiness.go
- review_application.go
- scheduled_processor.go
- scope_cache.go
- source_application.go
- statistics_application.go
- tracing.go
- work_application.go