Documentation
¶
Overview ¶
Package kernel owns deterministic Agent, Session, Input, Turn, and Product-event transitions.
Index ¶
- type IDSource
- type Kernel
- func (kernel *Kernel) CancelSession(ctx context.Context, scope Scope, request agentruntime.CancelSessionRequest) (agentruntime.Session, error)
- func (kernel *Kernel) CancelTurn(ctx context.Context, scope Scope, request agentruntime.CancelTurnRequest) (agentruntime.Turn, error)
- func (kernel *Kernel) CloseSession(ctx context.Context, scope Scope, request agentruntime.CloseSessionRequest) (agentruntime.Session, error)
- func (kernel *Kernel) CompactEvents(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, keep int) error
- func (kernel *Kernel) CompleteTurn(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, ...) (agentruntime.Turn, error)
- func (kernel *Kernel) CreateAgent(ctx context.Context, scope Scope, request agentruntime.CreateAgentRequest) (agentruntime.AgentSpecification, error)
- func (kernel *Kernel) CreateSession(ctx context.Context, scope Scope, request agentruntime.CreateSessionRequest) (agentruntime.Session, error)
- func (kernel *Kernel) CreateSessionFromRevision(ctx context.Context, scope Scope, request agentruntime.CreateSessionRequest, ...) (agentruntime.Session, error)
- func (kernel *Kernel) Events(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, ...) (agentruntime.EventPage, error)
- func (kernel *Kernel) GetAgentRevision(ctx context.Context, scope Scope, agentID agentruntime.AgentID, ...) (agentruntime.AgentSpecification, error)
- func (kernel *Kernel) InspectSession(ctx context.Context, scope Scope, sessionID agentruntime.SessionID) (agentruntime.SessionView, error)
- func (kernel *Kernel) InspectTurn(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, ...) (agentruntime.Turn, error)
- func (kernel *Kernel) ResolveAgentRevision(ctx context.Context, scope Scope, revisionID agentruntime.AgentRevisionID) (agentruntime.AgentSpecification, error)
- func (kernel *Kernel) ReviseAgent(ctx context.Context, scope Scope, request agentruntime.ReviseAgentRequest) (agentruntime.AgentSpecification, error)
- func (kernel *Kernel) SendInput(ctx context.Context, scope Scope, request agentruntime.SendInputRequest) (agentruntime.SendInputResult, error)
- type MemoryRepository
- type Repository
- type Scope
- type TenantState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel coordinates deterministic transitions through one atomic Repository port.
func New ¶
New constructs a valid Kernel with explicit time, entropy, state, and model-profile dependencies.
func (*Kernel) CancelSession ¶
func (kernel *Kernel) CancelSession(ctx context.Context, scope Scope, request agentruntime.CancelSessionRequest) (agentruntime.Session, error)
CancelSession terminally cancels an owner Session after accepted work drained.
func (*Kernel) CancelTurn ¶
func (kernel *Kernel) CancelTurn(ctx context.Context, scope Scope, request agentruntime.CancelTurnRequest) (agentruntime.Turn, error)
CancelTurn records explicit cancellation exactly once and advances remaining work.
func (*Kernel) CloseSession ¶
func (kernel *Kernel) CloseSession(ctx context.Context, scope Scope, request agentruntime.CloseSessionRequest) (agentruntime.Session, error)
CloseSession stops new Input admission and drains all previously accepted work.
func (*Kernel) CompactEvents ¶
func (kernel *Kernel) CompactEvents(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, keep int) error
CompactEvents applies a deterministic retention boundary for cursor-gap tests and adapters.
func (*Kernel) CompleteTurn ¶
func (kernel *Kernel) CompleteTurn(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, turnID agentruntime.TurnID, failure *agentruntime.Failure) (agentruntime.Turn, error)
CompleteTurn records one terminal outcome and advances the next queued Turn.
func (*Kernel) CreateAgent ¶
func (kernel *Kernel) CreateAgent(ctx context.Context, scope Scope, request agentruntime.CreateAgentRequest) (agentruntime.AgentSpecification, error)
CreateAgent registers the first immutable revision of an Agent specification.
func (*Kernel) CreateSession ¶
func (kernel *Kernel) CreateSession(ctx context.Context, scope Scope, request agentruntime.CreateSessionRequest) (agentruntime.Session, error)
CreateSession creates a durable Session pinned to one exact Agent revision.
func (*Kernel) CreateSessionFromRevision ¶
func (kernel *Kernel) CreateSessionFromRevision(ctx context.Context, scope Scope, request agentruntime.CreateSessionRequest, revision agentruntime.AgentSpecification) (agentruntime.Session, error)
CreateSessionFromRevision pins a principal-owned Session to a revision resolved by an authorized catalog boundary.
func (*Kernel) Events ¶
func (kernel *Kernel) Events(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, after agentruntime.Cursor, limit int) (agentruntime.EventPage, error)
Events returns a bounded ordered page after an opaque Cursor or an explicit Gap.
func (*Kernel) GetAgentRevision ¶
func (kernel *Kernel) GetAgentRevision(ctx context.Context, scope Scope, agentID agentruntime.AgentID, revisionID agentruntime.AgentRevisionID) (agentruntime.AgentSpecification, error)
GetAgentRevision returns one immutable revision from its owning Agent catalog.
func (*Kernel) InspectSession ¶
func (kernel *Kernel) InspectSession(ctx context.Context, scope Scope, sessionID agentruntime.SessionID) (agentruntime.SessionView, error)
InspectSession returns an immutable runtime-owned view with no backend identifiers.
func (*Kernel) InspectTurn ¶
func (kernel *Kernel) InspectTurn(ctx context.Context, scope Scope, sessionID agentruntime.SessionID, turnID agentruntime.TurnID) (agentruntime.Turn, error)
InspectTurn returns one immutable Turn snapshot from its owning Session.
func (*Kernel) ResolveAgentRevision ¶
func (kernel *Kernel) ResolveAgentRevision(ctx context.Context, scope Scope, revisionID agentruntime.AgentRevisionID) (agentruntime.AgentSpecification, error)
ResolveAgentRevision returns one immutable revision when its opaque revision ID is already authorized by the caller's catalog scope.
func (*Kernel) ReviseAgent ¶
func (kernel *Kernel) ReviseAgent(ctx context.Context, scope Scope, request agentruntime.ReviseAgentRequest) (agentruntime.AgentSpecification, error)
ReviseAgent creates another immutable revision without changing existing Sessions.
func (*Kernel) SendInput ¶
func (kernel *Kernel) SendInput(ctx context.Context, scope Scope, request agentruntime.SendInputRequest) (agentruntime.SendInputResult, error)
SendInput idempotently admits bounded content and creates exactly one ordered Turn.
type MemoryRepository ¶
type MemoryRepository struct {
// contains filtered or unexported fields
}
MemoryRepository is a deterministic Repository for kernel and composition tests.
func NewMemoryRepository ¶
func NewMemoryRepository() *MemoryRepository
NewMemoryRepository creates an empty isolated in-memory Repository.
func (*MemoryRepository) Transact ¶
func (repository *MemoryRepository) Transact(ctx context.Context, scope Scope, change func(*TenantState) error) error
Transact applies and atomically commits one transition unless the context is cancelled.
func (*MemoryRepository) View ¶
func (repository *MemoryRepository) View(ctx context.Context, scope Scope, inspect func(*TenantState) error) error
View reads an isolated snapshot without permitting mutation of stored state.
type Repository ¶
type Repository interface {
Transact(context.Context, Scope, func(*TenantState) error) error
View(context.Context, Scope, func(*TenantState) error) error
}
Repository atomically commits one tenant aggregate transition.
Adapters must execute change against an isolated copy and commit only when it returns nil and ctx remains active. This keeps state-machine decisions in the kernel while allowing PostgreSQL to become the durable authority.
type Scope ¶
type Scope string
Scope is an authenticated ownership boundary; its value is never exposed as an object ID.
func ParseScope ¶
ParseScope validates a bounded composition-root ownership scope.
type TenantState ¶
type TenantState struct {
// contains filtered or unexported fields
}
TenantState is the kernel-owned aggregate passed only through the Repository transaction port.
Persistence adapters treat this type as opaque transition state and must not implement domain decisions outside Kernel.