Documentation
¶
Overview ¶
Package agent defines stable, provider-neutral AgentSlot domain values.
It intentionally contains no storage, model, tool, UI, or runtime implementation. Contract packages may depend on these values without creating a dependency cycle through the fixed AgentRuntime layer.
Index ¶
- func IsCode(err error, code ErrorCode) bool
- func IsKind(err error, kind ErrorKind) bool
- func NewCodedError(kind ErrorKind, code ErrorCode, op, message string, cause error) error
- func NewError(kind ErrorKind, op, message string, cause error) error
- type ActorIdentity
- type ActorKind
- type Agent
- type AgentID
- type AttemptID
- type ClassifiedError
- type ClientMessageID
- type ErrorCode
- type ErrorKind
- type FactID
- type Message
- type MessageID
- type MessageInput
- type MessagePart
- type MessagePartKind
- type ModelContinuation
- type Revision
- type Role
- type Run
- type RunID
- type Session
- type SessionID
- type Step
- type StepID
- type ToolCall
- type ToolCallID
- type Workspace
- type WorkspaceID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCodedError ¶
NewCodedError creates a classified error with a stable domain reason.
Types ¶
type ActorIdentity ¶
ActorIdentity records who caused a durable fact without carrying secrets.
func (ActorIdentity) Valid ¶
func (a ActorIdentity) Valid() bool
type ActorKind ¶
type ActorKind string
ActorKind is the finite origin vocabulary attached to durable Session facts. Authentication remains the GatewayChannel's responsibility; this value contains no credential or authorization decision.
type AgentID ¶
type AgentID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type AttemptID ¶
type AttemptID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type ClassifiedError ¶
ClassifiedError carries a safe operation-level message and an optional implementation cause for logs and errors.Is. Callers should branch on Kind, not on provider or database error strings.
func (*ClassifiedError) Error ¶
func (e *ClassifiedError) Error() string
func (*ClassifiedError) Unwrap ¶
func (e *ClassifiedError) Unwrap() error
type ClientMessageID ¶ added in v0.0.3
type ClientMessageID string
ClientMessageID is an optional caller-generated correlation identity for reconciling an optimistic submission with the Runtime-assigned MessageID. It is not a substitute for the durable MessageID.
func (ClientMessageID) Valid ¶ added in v0.0.3
func (id ClientMessageID) Valid() bool
type ErrorCode ¶
type ErrorCode string
ErrorCode is the stable domain reason inside a broad reaction category.
const ( CodeRevisionConflict ErrorCode = "revision_conflict" CodeQueueItemClaimed ErrorCode = "queue_item_claimed" CodeNoActiveRun ErrorCode = "no_active_run" CodeNoPendingWork ErrorCode = "no_pending_work" CodeRuntimeClosed ErrorCode = "runtime_closed" CodeCanceled ErrorCode = "canceled" CodeSessionUnrecoverable ErrorCode = "session_unrecoverable" CodeApplicationNotStarted ErrorCode = "application_not_started" CodeSessionNotOpen ErrorCode = "session_not_open" CodeSessionAlreadyOpen ErrorCode = "session_already_open" CodeCommandNotFound ErrorCode = "command_not_found" CodeSessionNotFound ErrorCode = "session_not_found" CodeSessionAlreadyExists ErrorCode = "session_already_exists" CodeActiveRun ErrorCode = "active_run" CodeQueueItemNotFound ErrorCode = "queue_item_not_found" CodeQueueItemAlreadyExists ErrorCode = "queue_item_already_exists" CodeJournalInvariant ErrorCode = "journal_invariant" CodeHistoryInvariant ErrorCode = "history_invariant" CodeContextLimitExceeded ErrorCode = "context_limit_exceeded" CodeModelNotSupported ErrorCode = "model_not_supported" CodeCompatibilityConfirmationRequired ErrorCode = "compatibility_confirmation_required" CodeModelExecutionFailed ErrorCode = "model_execution_failed" CodeModelStreamInvalid ErrorCode = "model_stream_invalid" CodeContextPreparationFailed ErrorCode = "context_preparation_failed" CodeLoopFailed ErrorCode = "loop_failed" CodeLoopProtocolViolation ErrorCode = "loop_protocol_violation" CodeToolExecutionFailed ErrorCode = "tool_execution_failed" CodeRunTokenBudgetExceeded ErrorCode = "run_token_budget_exceeded" CodeRunWaiting ErrorCode = "run_waiting" CodeSessionOperationFailed ErrorCode = "session_operation_failed" CodeRuntimeFailed ErrorCode = "runtime_failed" CodeRuntimeInterrupted ErrorCode = "runtime_interrupted" )
type ErrorKind ¶
type ErrorKind string
ErrorKind is the provider-neutral classification used at component boundaries. It describes how a caller may react, not an implementation's private diagnostic.
type FactID ¶
type FactID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type Message ¶
type Message struct {
ID MessageID
ClientMessageID ClientMessageID
SessionID SessionID
RunID RunID
StepID StepID
Role Role
Parts []MessagePart
ModelContinuation *ModelContinuation
CreatedAt time.Time
}
Message is a durable message fact. Provider-neutral content stays in Parts; an optional opaque continuation preserves provider protocol state without pretending that state is user-visible message content.
type MessageID ¶
type MessageID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type MessageInput ¶
type MessageInput struct {
Parts []MessagePart
}
MessageInput is unpersisted inbound content. It deliberately has no MessageID, SessionID, RunID, StepID, role, or timestamp: only the fixed Runtime may allocate durable identity and containment during commit.
func (MessageInput) Valid ¶
func (m MessageInput) Valid() bool
Valid reports whether every inbound content part is provider-neutral and the input is non-empty.
type MessagePart ¶
type MessagePart struct {
Kind MessagePartKind
Text string
AttachmentID string
MediaType string
Name string
}
MessagePart is one text fragment or durable attachment reference. Provider adapters project these facts into their own wire blocks.
func (MessagePart) Valid ¶
func (p MessagePart) Valid() bool
Valid reports whether a message part has exactly the payload required by its kind.
type MessagePartKind ¶
type MessagePartKind string
MessagePartKind is the finite provider-neutral content vocabulary. Binary data is never embedded in History; attachment parts carry stable references.
const ( PartText MessagePartKind = "text" PartAttachment MessagePartKind = "attachment" )
type ModelContinuation ¶ added in v0.0.5
type ModelContinuation struct {
ProviderKey string
ModelID string
State json.RawMessage
}
ModelContinuation is provider-owned protocol state that must survive an interrupted model turn unchanged. Runtime and Context may copy and persist it, but must never inspect, render, edit, or send it to a different selected model. State contains one syntactically valid JSON value defined by the ModelExecutor implementation.
func (ModelContinuation) Valid ¶ added in v0.0.5
func (c ModelContinuation) Valid() bool
type Revision ¶
type Revision uint64
Revision is the monotonically increasing version of a durable aggregate.
type RunID ¶
type RunID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type Session ¶
type Session struct {
ID SessionID
AgentID AgentID
WorkspaceID WorkspaceID
ParentSessionID SessionID
ParentRevision Revision
Revision Revision
}
Session identifies one isolated conversation and execution aggregate.
type SessionID ¶
type SessionID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type Step ¶
Step identifies one model call or tool batch inside one Run. The concrete step kind vocabulary is intentionally kept small until execution contracts are introduced in a later round.
type StepID ¶
type StepID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
type ToolCall ¶
type ToolCall struct {
ID ToolCallID
// CorrelationID is the model protocol's call/result correlation token. It
// is content supplied by ModelExecutor, not the durable ToolCall identity.
CorrelationID string
MessageID MessageID
SessionID SessionID
RunID RunID
StepID StepID
Name string
Arguments json.RawMessage
}
ToolCall is the durable identity, arguments, and containment record for one model-requested tool invocation.
type ToolCallID ¶
type ToolCallID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
func (ToolCallID) Valid ¶
func (id ToolCallID) Valid() bool
type Workspace ¶
type Workspace struct {
ID WorkspaceID
AgentID AgentID
}
Workspace identifies a product-owned scope under one Agent.
type WorkspaceID ¶
type WorkspaceID string
The identity types are deliberately distinct even though they use the same wire representation. This prevents accidentally passing a SessionID where a RunID is required.
func (WorkspaceID) Valid ¶
func (id WorkspaceID) Valid() bool