Documentation
¶
Overview ¶
Package runtimeapi defines the wire contract of the platform runtime API (design §13.2). Three callers use separate authentication paths:
- Seats (seat-runner, steadmesh-tools, harnesses) call /v1/* with a projected ServiceAccount token whose only audience is steadmesh-gateway. The platform resolves the token to a seat with a TokenReview; clients cannot select a different principal. Mutating calls carry HeaderGeneration and are fenced.
- The controller calls /internal/v1/* with its own ServiceAccount token.
- Operators use orgctl, which reads Kubernetes status and calls /internal/v1 through the controller's verify flow.
Index ¶
- Constants
- type Bootstrap
- type CheckResult
- type Checkpoint
- type ConnectionInfo
- type ConsoleActivity
- type ConsoleActivityItem
- type ConsoleArtifact
- type ConsoleArtifactList
- type ConsoleCapability
- type ConsoleChannelBinding
- type ConsoleCheck
- type ConsoleConnection
- type ConsoleConversation
- type ConsoleConversationDetail
- type ConsoleConversationList
- type ConsoleDelivery
- type ConsoleEvent
- type ConsoleExecution
- type ConsoleExecutionDetail
- type ConsoleExecutionList
- type ConsoleMemoryStore
- type ConsoleMessage
- type ConsoleOperation
- type ConsoleOperationList
- type ConsoleOrganization
- type ConsoleSeatConfig
- type ConsoleSeatDetail
- type ConsoleSeatList
- type ConsoleSeatStatus
- type Envelope
- type Error
- type ExecutionEvent
- type FenceRequest
- type Handoff
- type InboxAckRequest
- type InboxDelivery
- type InstructionInfo
- type LeaseAcquireRequest
- type LeaseRenewRequest
- type LeaseResponse
- type MemoryStoreInfo
- type Operation
- type ProbeResponse
- type ProbeResult
- type RecipientInfo
- type Recovery
- type RuntimeResponse
- type SeatIdentity
- type SeatRuntime
- type Self
- type StateRequest
- type SyncRequest
- type SyncResponse
- type ToolCallRequest
- type ToolCallResult
- type ToolDescriptor
- type ToolList
- type VerifyResponse
Constants ¶
const ( PathConsoleOrgs = "/console/v1/organizations" // GET list; /{id}/{seats,conversations,operations,artifacts,activity} PathConsoleSeats = "/console/v1/seats/" // {id}, {id}/executions PathConsoleExecutions = "/console/v1/executions/" // {id} PathConsoleConversations = "/console/v1/conversations/" // {id} )
const ( ActivityMessage = "message" ActivityRunStarted = "run_started" ActivityRunFinished = "run_finished" ActivityToolRequest = "tool_request" ActivityToolResult = "tool_result" ActivityError = "error" ActivityOperation = "operation" )
Activity item kinds.
const ( // HeaderGeneration carries the caller's execution lease generation. HeaderGeneration = "X-Steadmesh-Generation" // HeaderExecution carries the current execution id, for event correlation. HeaderExecution = "X-Steadmesh-Execution" // Seat-facing paths. PathLeaseAcquire = "/v1/lease/acquire" PathLeaseRenew = "/v1/lease/renew" PathLeaseRelease = "/v1/lease/release" PathState = "/v1/state" PathSelf = "/v1/self" PathBootstrap = "/v1/bootstrap" PathTools = "/v1/tools" // GET: list descriptors PathToolCall = "/v1/tools/" // POST /v1/tools/{name} PathInboxNext = "/v1/inbox/next" // GET ?wait=<seconds> PathInboxAck = "/v1/inbox/" // POST /v1/inbox/{delivery_id}/ack PathExecEvents = "/v1/executions/" // POST /v1/executions/{id}/events PathCheckpoint = "/v1/checkpoint" // PUT PathModelProxy = "/v1/model/" // /v1/model/{connection}/... (Anthropic-compatible) // Controller-facing paths. PathInternalSync = "/internal/v1/organizations:sync" // POST PathInternalOrgs = "/internal/v1/organizations/" // {id}/runtime, {id}/verify, {id} DELETE PathInternalSeats = "/internal/v1/seats/" // {id}/fence, {id}/probe, {id}/probe/{probe_id} PathHealthz = "/healthz" PathReadyz = "/readyz" )
const EventProbeResult = "probe_result"
EventProbeResult is the ExecutionEvent.Kind the runner posts for an origin=probe delivery before acking it (outcome=completed). Data is a ProbeResult; the platform reads data.checks from any event kind.
const MaxEventDataBytes = 8 * 1024
MaxEventDataBytes is the largest ExecutionEvent.Data the platform stores. POST /v1/executions/{id}/events accepts one ExecutionEvent or a JSON array of them. The runner replaces larger payloads with {"truncated":true,"bytes":N,"preview":"..."}.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type Checkpoint ¶
type ConnectionInfo ¶
type ConsoleActivity ¶
type ConsoleActivity struct {
Items []ConsoleActivityItem `json:"items"`
}
ConsoleActivity is a page of activity after a cursor time, oldest first. Callers poll with after set slightly before the newest At they have seen and de-duplicate by Key, so late-committing rows are not missed.
type ConsoleActivityItem ¶
type ConsoleActivityItem struct {
// Key identifies the item for de-duplication across overlapping polls.
Key string `json:"key"`
Kind string `json:"kind"`
At time.Time `json:"at"`
SeatKey string `json:"seat_key,omitempty"`
PeerSeat string `json:"peer_seat,omitempty"`
Peer string `json:"peer,omitempty"` // binding or connection for non-seat peers
ExecutionID string `json:"execution_id,omitempty"`
MessageID string `json:"message_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
Status string `json:"status,omitempty"`
Summary string `json:"summary"`
}
ConsoleActivityItem is one entry of the organisation's activity feed.
type ConsoleArtifact ¶
type ConsoleArtifactList ¶
type ConsoleArtifactList struct {
Artifacts []ConsoleArtifact `json:"artifacts"`
}
type ConsoleCapability ¶
type ConsoleCapability struct {
Resource string `json:"resource"`
Operations []string `json:"operations"`
Sources []string `json:"sources,omitempty"`
}
ConsoleCapability is one resolved grant of a seat.
type ConsoleChannelBinding ¶
type ConsoleCheck ¶
type ConsoleConnection ¶
type ConsoleConnection struct {
Key string `json:"key"`
Adapter string `json:"adapter"`
Required bool `json:"required"`
SecretKind string `json:"secret_kind,omitempty"`
SecretPath string `json:"secret_path,omitempty"`
Check *ConsoleCheck `json:"check,omitempty"`
}
ConsoleConnection describes a connection and its last verification. The secret reference is reported as kind (vault, k8s) and path only.
type ConsoleConversation ¶
type ConsoleConversationDetail ¶
type ConsoleConversationDetail struct {
Conversation ConsoleConversation `json:"conversation"`
Messages []ConsoleMessage `json:"messages"`
}
type ConsoleConversationList ¶
type ConsoleConversationList struct {
Conversations []ConsoleConversation `json:"conversations"`
}
type ConsoleDelivery ¶
type ConsoleEvent ¶
type ConsoleExecution ¶
type ConsoleExecution struct {
ID string `json:"id"`
SeatID string `json:"seat_id"`
SeatKey string `json:"seat_key"`
LeaseGeneration int64 `json:"lease_generation"`
ConfigRevision string `json:"config_revision"`
HarnessAdapter string `json:"harness_adapter"`
TriggerMessageID string `json:"trigger_message_id,omitempty"`
TriggerSummary string `json:"trigger_summary,omitempty"`
TriggerOrigin string `json:"trigger_origin,omitempty"`
State string `json:"state"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Events int `json:"events"`
}
ConsoleExecution is one run of a seat. A seat keeps its id across Pod replacements; each run has its own id and the lease generation it ran under.
type ConsoleExecutionDetail ¶
type ConsoleExecutionDetail struct {
Execution ConsoleExecution `json:"execution"`
Trigger *ConsoleMessage `json:"trigger,omitempty"`
Events []ConsoleEvent `json:"events"`
Operations []ConsoleOperation `json:"operations"`
Sent []ConsoleMessage `json:"sent"`
}
ConsoleExecutionDetail is a run with its trigger, events, connector operations and the messages its seat sent while it ran.
type ConsoleExecutionList ¶
type ConsoleExecutionList struct {
Executions []ConsoleExecution `json:"executions"`
}
type ConsoleMemoryStore ¶
type ConsoleMemoryStore struct {
Key string `json:"key"`
Personal bool `json:"personal"`
Records int `json:"records"`
LastUpdatedAt *time.Time `json:"last_updated_at,omitempty"`
}
ConsoleMemoryStore is memory metadata only; record bodies are not exposed.
type ConsoleMessage ¶
type ConsoleMessage struct {
ID string `json:"id"`
ConversationID string `json:"conversation_id"`
ConversationKind string `json:"conversation_kind"`
Origin string `json:"origin"`
SenderSeat string `json:"sender_seat,omitempty"`
RecipientSeat string `json:"recipient_seat,omitempty"`
RecipientBinding string `json:"recipient_binding,omitempty"`
Route string `json:"route,omitempty"`
ParentID string `json:"parent_id,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
Deliveries []ConsoleDelivery `json:"deliveries,omitempty"`
// Outbox is the external delivery state of a reply to a human.
Outbox string `json:"outbox,omitempty"`
}
ConsoleMessage is a message with its delivery to each recipient seat.
type ConsoleOperation ¶
type ConsoleOperationList ¶
type ConsoleOperationList struct {
Operations []ConsoleOperation `json:"operations"`
}
type ConsoleOrganization ¶
type ConsoleOrganization struct {
ID string `json:"id"`
Key string `json:"key"`
Namespace string `json:"namespace"`
DisplayName string `json:"display_name"`
Revision string `json:"revision"`
Teams []string `json:"teams"`
Seats []ConsoleSeatConfig `json:"seats"`
Connections []ConsoleConnection `json:"connections"`
Bindings []ConsoleChannelBinding `json:"channel_bindings,omitempty"`
}
ConsoleOrganization is an organisation's committed configuration as the platform holds it.
type ConsoleSeatConfig ¶
type ConsoleSeatConfig struct {
SeatID string `json:"seat_id"`
OrganizationID string `json:"organization_id"`
Key string `json:"key"`
DisplayName string `json:"display_name"`
RoleRef string `json:"role_ref"`
Teams []string `json:"teams,omitempty"`
IsRepresentative bool `json:"is_representative"`
HarnessAdapter string `json:"harness_adapter"`
Model string `json:"model,omitempty"`
ConfigRevision string `json:"config_revision"`
PolicyRevision int64 `json:"policy_revision"`
PersistentWorkspace bool `json:"persistent_workspace"`
PersonalMemory string `json:"personal_memory,omitempty"`
SendTo []string `json:"send_to,omitempty"`
ChannelBindings []string `json:"channel_bindings,omitempty"`
Capabilities []ConsoleCapability `json:"capabilities,omitempty"`
CreatedAt time.Time `json:"created_at"`
AdoptedFrom string `json:"adopted_from,omitempty"`
}
ConsoleSeatConfig is a seat's committed configuration.
type ConsoleSeatDetail ¶
type ConsoleSeatDetail struct {
Config ConsoleSeatConfig `json:"config"`
Status ConsoleSeatStatus `json:"status"`
Handoff *Handoff `json:"handoff,omitempty"`
Checkpoint *Checkpoint `json:"checkpoint,omitempty"`
Memory []ConsoleMemoryStore `json:"memory,omitempty"`
Executions []ConsoleExecution `json:"executions"`
}
ConsoleSeatDetail is everything the platform records about one seat.
type ConsoleSeatList ¶
type ConsoleSeatList struct {
Seats []ConsoleSeatStatus `json:"seats"`
}
type ConsoleSeatStatus ¶
type ConsoleSeatStatus struct {
SeatRuntime
// Current is the running execution, if any.
Current *ConsoleExecution `json:"current,omitempty"`
// LastProgressAt is the time of the seat's latest tool result or output,
// as distinct from lease liveness.
LastProgressAt *time.Time `json:"last_progress_at,omitempty"`
// Unknown counts the seat's connector operations with unknown outcome.
UnknownOperations int `json:"unknown_operations"`
}
ConsoleSeatStatus is the live state of a seat from the platform's records.
type Envelope ¶
type Envelope struct {
MessageID string `json:"message_id"`
OrganizationID string `json:"organization_id"`
ConversationID string `json:"conversation_id"`
Origin string `json:"origin"` // human, seat, system, schedule, probe
// For human origin: the binding key and verified external user.
Binding string `json:"binding,omitempty"`
ExternalUserID string `json:"external_user_id,omitempty"`
SenderSeat string `json:"sender_seat,omitempty"`
SenderSeatID string `json:"sender_seat_id,omitempty"`
RecipientSeat string `json:"recipient_seat"`
ParentID string `json:"parent_id,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
// ReplyRoute describes how to reply: "binding:<key>" or "seat:<key>".
ReplyRoute string `json:"reply_route,omitempty"`
}
Envelope is the durable message envelope. Origin fields are assigned by trusted ingress; agent-authored text cannot overwrite them.
type Error ¶
type Error struct {
Code string `json:"code"` // unauthenticated, forbidden, fenced, conflict, not_found, invalid, blocked, unavailable
Message string `json:"message"`
}
Error is the JSON body of every non-2xx response.
type ExecutionEvent ¶
type FenceRequest ¶
type FenceRequest struct {
// ExpectedGeneration must match the current generation; the platform then
// increments it so the previous holder's calls are rejected.
ExpectedGeneration int64 `json:"expected_generation"`
}
type Handoff ¶
type Handoff struct {
Objective string `json:"objective"`
Unresolved []string `json:"unresolved,omitempty"`
RecordIDs []string `json:"record_ids,omitempty"`
PendingMessageIDs []string `json:"pending_message_ids,omitempty"`
OperationIDs []string `json:"operation_ids,omitempty"`
Notes string `json:"notes,omitempty"`
}
type InboxAckRequest ¶
type InboxDelivery ¶
type InstructionInfo ¶
type LeaseAcquireRequest ¶
type LeaseAcquireRequest struct {
// Holder is informational; the platform records the Pod UID from the token.
Holder string `json:"holder,omitempty"`
}
type LeaseRenewRequest ¶
type LeaseRenewRequest struct {
Generation int64 `json:"generation"`
}
type LeaseResponse ¶
type MemoryStoreInfo ¶
type Operation ¶
type Operation struct {
ID string `json:"id"`
Connection string `json:"connection"`
Operation string `json:"operation"`
Target string `json:"target,omitempty"`
IdempotencyKey string `json:"idempotency_key"`
Status string `json:"status"` // pending, succeeded, failed, unknown
ExternalReceipt string `json:"external_receipt,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type ProbeResponse ¶
type ProbeResult ¶
ProbeResult is the Data of an EventProbeResult event. Checks maps a check name (tool, workspace, model) to "ok" or "fail: <reason>"; a value starting with "fail" or equal to "false" fails the probe.
type RecipientInfo ¶
type Recovery ¶
type Recovery struct {
// Session is the harness checkpoint, if any.
Session *Checkpoint `json:"session,omitempty"`
Handoff *Handoff `json:"handoff,omitempty"`
// PendingMessages is the number of undelivered inbox messages.
PendingMessages int `json:"pending_messages"`
// UnknownOperations are external operations whose outcome is unknown and
// must be reconciled by the agent before being reissued (§6.3).
UnknownOperations []Operation `json:"unknown_operations,omitempty"`
// Note explains the recovery state, e.g. "native session not convertible;
// resumed from portable handoff" (§6.4).
Note string `json:"note,omitempty"`
}
type RuntimeResponse ¶
type RuntimeResponse struct {
Seats map[string]SeatRuntime `json:"seats"`
}
type SeatIdentity ¶
type SeatRuntime ¶
type SeatRuntime struct {
SeatID string `json:"seat_id"`
SeatKey string `json:"seat_key"`
PendingDeliveries int `json:"pending_deliveries"`
OldestPendingAge float64 `json:"oldest_pending_age_seconds"`
LeaseGeneration int64 `json:"lease_generation"`
LeaseHolder string `json:"lease_holder,omitempty"`
LeaseExpiresAt time.Time `json:"lease_expires_at"`
State string `json:"state"`
StateDetail string `json:"state_detail,omitempty"`
AdoptedRevision string `json:"adopted_revision,omitempty"`
LastActivity *time.Time `json:"last_activity,omitempty"`
LatestCheckpoint string `json:"latest_checkpoint,omitempty"`
DeadDeliveries int `json:"dead_deliveries"`
}
SeatRuntime is the platform's view of one seat, used for wake and idle decisions.
type Self ¶
type Self struct {
OrganizationID string `json:"organization_id"`
OrganizationKey string `json:"organization_key"`
OrganizationName string `json:"organization_name"`
SeatID string `json:"seat_id"`
SeatKey string `json:"seat_key"`
DisplayName string `json:"display_name"`
Teams []string `json:"teams,omitempty"`
IsRepresentative bool `json:"is_representative"`
ConfigRevision string `json:"config_revision"`
PolicyRevision int64 `json:"policy_revision"`
Instructions []InstructionInfo `json:"instructions"`
MemoryStores []MemoryStoreInfo `json:"memory_stores"`
Recipients []RecipientInfo `json:"recipients"`
Connections []ConnectionInfo `json:"connections"`
ChannelBindings []string `json:"channel_bindings,omitempty"`
}
type StateRequest ¶
type StateRequest struct {
Generation int64 `json:"generation"`
State string `json:"state"` // Warm, Executing, Quiescing, Stopped
Detail string `json:"detail,omitempty"`
// AdoptedRevision is the config revision the runner is executing with.
AdoptedRevision string `json:"adopted_revision,omitempty"`
}
type SyncRequest ¶
type SyncRequest struct {
Namespace string `json:"namespace"`
Key string `json:"key"`
SourceUID string `json:"source_uid"`
// Manifest is a compile.Manifest serialised as JSON.
Manifest json.RawMessage `json:"manifest"`
}
SyncRequest establishes durable identities for an organisation's resolved manifest. It is idempotent.
type SyncResponse ¶
type SyncResponse struct {
OrganizationID string `json:"organization_id"`
Seats map[string]SeatIdentity `json:"seats"`
// Retired lists seat keys retired by this sync.
Retired []string `json:"retired,omitempty"`
}
type ToolCallRequest ¶
type ToolCallRequest struct {
Arguments json.RawMessage `json:"arguments"`
}
type ToolCallResult ¶
type ToolCallResult struct {
// Content is the bounded JSON result.
Content json.RawMessage `json:"content"`
// IsError marks a tool-level failure the agent should see (denied,
// conflict, invalid). Transport errors use HTTP status codes instead.
IsError bool `json:"is_error,omitempty"`
}
type ToolDescriptor ¶
type ToolDescriptor struct {
Name string `json:"name"` // dotted, e.g. memory.search
Description string `json:"description"`
InputSchema json.RawMessage `json:"input_schema"`
}
type ToolList ¶
type ToolList struct {
Tools []ToolDescriptor `json:"tools"`
}
ToolList is the body of GET /v1/tools.
type VerifyResponse ¶
type VerifyResponse struct {
Connections map[string]CheckResult `json:"connections"`
Ingress map[string]CheckResult `json:"ingress"`
Bindings map[string]CheckResult `json:"bindings"`
}