Documentation
¶
Overview ¶
Package agentexec owns transport-independent, audited asset operations.
Index ¶
- Variables
- func NormalizeIssuer(value string) (string, error)
- type Action
- type Core
- type CoreClient
- type CoreError
- type Event
- type HTTP
- type Journal
- func (j *Journal) Ack(event Event) error
- func (j *Journal) Action(id string) (rec record, err error)
- func (j *Journal) ActionEvents(id string, after uint64, limit int) ([]Event, error)
- func (j *Journal) Append(id, state string, payload map[string]any) error
- func (j *Journal) Close() error
- func (j *Journal) DeleteSession(id string) error
- func (j *Journal) Intent(id string) error
- func (j *Journal) NextSession() (*Session, error)
- func (j *Journal) Pending(limit int) (events []Event, err error)
- func (j *Journal) Prune(now time.Time) ([]string, error)
- func (j *Journal) PutAction(action Action, sessionToken string) error
- func (j *Journal) Recover() error
- func (j *Journal) SaveSession(session Session) error
- func (j *Journal) SyncCore(action Action) (bool, error)
- func (j *Journal) Unfinished(limit int) (records []record, more bool, err error)
- type Options
- type OutputStream
- type Principal
- type Runtime
- func (r *Runtime) Cancel(ctx context.Context, p Principal, id string) (Action, error)
- func (r *Runtime) Close() error
- func (r *Runtime) Connect(ctx context.Context, p Principal, ...) (map[string]any, error)
- func (r *Runtime) Disconnect(ctx context.Context, p Principal, id string) (map[string]any, error)
- func (r *Runtime) Download(ctx context.Context, p Principal, id string) (*os.File, int64, string, error)
- func (r *Runtime) FindAction(ctx context.Context, p Principal, key, sessionID string) (string, error)
- func (r *Runtime) Get(ctx context.Context, p Principal, id string, offset, limit int64) (Action, error)
- func (r *Runtime) GetPage(ctx context.Context, p Principal, id string, offset, limit int64, value string) (Action, error)
- func (r *Runtime) Introspect(ctx context.Context, token, resource string) (p Principal, err error)
- func (r *Runtime) ListResources(ctx context.Context, p Principal, sessions bool, sessionID, status string, ...) (map[string]any, error)
- func (r *Runtime) RecoverSession(ctx context.Context, p Principal, id, key string) (map[string]any, error)
- func (r *Runtime) Search(ctx context.Context, p Principal, query, assetID string, ...) (map[string]any, error)
- func (r *Runtime) String() string
- func (r *Runtime) Submit(ctx context.Context, p Principal, sessionID, kind, key string, ...) (Action, error)
- func (r *Runtime) Upload(ctx context.Context, p Principal, id string, body io.Reader, length int64, ...) (Action, error)
- type Session
- type ToolError
- type Transfer
Constants ¶
This section is empty.
Variables ¶
var ( ErrJournalFull = errors.New("audit journal is full; new operations are disabled") ErrEvidenceLimit = errors.New("operation evidence limit reached") )
Functions ¶
func NormalizeIssuer ¶
Types ¶
type Action ¶
type Action struct {
ID string `json:"id"`
ActionID string `json:"action_id"`
SessionID string `json:"session_id"`
Kind string `json:"kind"`
Status string `json:"status"`
Request map[string]any `json:"request,omitempty"`
RequestHash string `json:"request_hash,omitempty"`
Result map[string]any `json:"result,omitempty"`
ApprovalURL string `json:"approval_url,omitempty"`
CancelRequested bool `json:"cancel_requested,omitempty"`
AuditStatus string `json:"audit_status,omitempty"`
Events []Event `json:"events,omitempty"`
NextOffset *int64 `json:"next_offset"`
EvidencePending bool `json:"evidence_pending"`
LastSequence uint64 `json:"last_sequence,omitempty"`
HandoffURL string `json:"handoff_url,omitempty"`
ResultExpiresAt *time.Time `json:"result_expires_at,omitempty"`
NextStep string `json:"next_step,omitempty"`
Terminal bool `json:"is_terminal"`
OutputComplete bool `json:"output_complete"`
PollAfterMS int `json:"poll_after_ms,omitempty"`
NextCursor string `json:"next_cursor,omitempty"`
Output []OutputStream `json:"output,omitempty"`
OutputLossy bool `json:"output_lossy,omitempty"`
OutputRequiresCursor bool `json:"output_requires_cursor,omitempty"`
Transfer *Transfer `json:"transfer,omitempty"`
}
type CoreClient ¶
type CoreClient struct {
// contains filtered or unexported fields
}
func NewCoreClient ¶
func NewCoreClient(base string, key model.AccessKey) (*CoreClient, error)
type Event ¶
type Event struct {
EventID string `json:"event_id"`
ActionID string `json:"action_id"`
Sequence uint64 `json:"sequence"`
State string `json:"state"`
Payload map[string]any `json:"payload"`
OccurredAt time.Time `json:"occurred_at"`
SessionToken string `json:"session_token,omitempty"`
Key uint64 `json:"-"`
}
type HTTP ¶
type Journal ¶
type Journal struct {
// contains filtered or unexported fields
}
Journal atomically persists each state change and its outbound audit event. Values are encrypted because retry records include scoped Core capabilities. bbolt's default synchronous commits are intentionally never disabled.
func (*Journal) ActionEvents ¶
ActionEvents exposes only bounded, undelivered output. Core authorizes the corresponding action before the runtime merges this page with delivered data.
func (*Journal) DeleteSession ¶
func (*Journal) NextSession ¶
NextSession advances only one record so a slow close cannot skip the rest of a prefetched page. A nil result ends this pass and resets the cursor.
func (*Journal) Pending ¶
Pending rotates between actions while preserving each action's event order. The index avoids scanning a failed action's entire backlog to reach another.
func (*Journal) Prune ¶
Prune scans at most 128 records per call, only deleting after every audit event was acknowledged and its 24-hour retention elapsed. Returned artifact paths may be deleted by the runtime after the transaction commits.
func (*Journal) SaveSession ¶
type OutputStream ¶
type Principal ¶
type Principal struct {
UserID string `json:"user_id"`
AllOrganizations bool `json:"all_organizations,omitempty"`
ClientID string `json:"client_id"`
ContextToken string `json:"context_token"`
ExpiresAt time.Time `json:"expires_at"`
Resource string `json:"resource"`
Scopes []string `json:"scopes"`
RemoteAddr string `json:"-"`
}
Principal is issued by Core after validating a resource-bound OAuth token. ContextToken must never be returned to an MCP client or included in logs.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) Disconnect ¶
func (*Runtime) FindAction ¶
func (*Runtime) Introspect ¶
func (*Runtime) ListResources ¶
func (*Runtime) RecoverSession ¶
type Session ¶
type Session struct {
ID string `json:"id"`
Status string `json:"status"`
AuthorizationStatus string `json:"authorization_status,omitempty"`
ActionID string `json:"action_id"`
SessionToken string `json:"session_token,omitempty"`
TerminalSessionID string `json:"terminal_session_id,omitempty"`
Protocol string `json:"protocol,omitempty"`
ApprovalURL string `json:"approval_url,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
RequiresTerminal bool `json:"requires_terminal,omitempty"`
Capabilities map[string]any `json:"capabilities,omitempty"`
}
type Transfer ¶
type Transfer struct {
URL string `json:"url"`
Method string `json:"method"`
Headers map[string]string `json:"headers"`
RequiresBearer bool `json:"requires_bearer"`
RequiresClientTransfer bool `json:"requires_client_transfer"`
Ready bool `json:"ready"`
Size any `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
ContentLengthRequired bool `json:"content_length_required,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}