api

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 68 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPaths

func CanonicalPaths(next http.Handler) http.Handler

CanonicalPaths serves each request on its canonical path, as the official service does (HP-17/HP-18), instead of the ServeMux redirect, which made clients resend a POST as a GET. It must wrap the complete server handler so that every routing, authentication and middleware decision sees only the rewritten path. The canonical path is built from the raw request path: bytes that are not valid in an escaped path are percent-encoded, percent-encoded unreserved characters (RFC 3986 section 2.3) are decoded, so an encoded dot segment resolves like a literal one, and empty and dot segments are resolved with ServeMux cleanPath semantics, keeping a trailing slash. Other escapes, such as %2F and %5C, stay encoded and never become separators. Path and RawPath are then set consistently, so chi (which prefers RawPath), the ServeMux (which uses EscapedPath) and every middleware see the same path, and every spelling reaches exactly the route and authentication of its canonical form written literally. It is idempotent.

func NewHandler

func NewHandler(deps Dependencies) (http.Handler, error)

NewHandler builds the HTTP handler from complete dependencies.

func ValidateCredentialSeparation

func ValidateCredentialSeparation(ctx context.Context, admin *DeploymentAuthenticator, keys projectKeyDigests) error

ValidateCredentialSeparation rejects Core key collisions with persisted API keys.

Types

type Admin

type Admin interface {
	ReadAdminSummary(context.Context, string, store.AdminSummaryFilter, func(sessions.Session, *string) error) (store.AdminAssetCounts, error)
	ListAdminRuntimeTargets(context.Context, []string, string, int, bool) (store.AdminRuntimeTargetPage, error)
}

Admin reads the administrator's cross-Project views: the asset summary and the Sessions whose Runtime is observed.

type AdminAudit

type AdminAudit interface {
	ListAdminAudit(context.Context, adminaudit.Filter) (adminaudit.Page, error)
}

AdminAudit reads the administrator audit log.

type AdminRuntimeObservation

type AdminRuntimeObservation struct {
	ProjectID   string                        `json:"project_id"`
	Observation AdminRuntimeObservationDetail `json:"observation"`
}

type AdminRuntimeObservationDetail

type AdminRuntimeObservationDetail struct {
	v1.RuntimeObservation
	// Current Runtime disk usage and capacity. E2B reports them; Docker and
	// microsandbox observations return null.
	Disk *RuntimeDiskObservation `json:"disk" extensions:"x-nullable" binding:"required"`
}

AdminRuntimeObservationDetail adds administrator-only measurements to the project observation shape, which stays unchanged.

type AdminRuntimeObservationList

type AdminRuntimeObservationList struct {
	Object  string                    `json:"object"`
	Data    []AdminRuntimeObservation `json:"data"`
	HasMore bool                      `json:"has_more"`
	FirstID *string                   `json:"first_id"`
	LastID  *string                   `json:"last_id"`
}

type AdminSessionArchiveRequest

type AdminSessionArchiveRequest struct {
	ExpectedGeneration uint64 `json:"expected_generation"`
}

type AdminSessionCounts

type AdminSessionCounts struct {
	Total          int64 `json:"total"`
	Idle           int64 `json:"idle"`
	InProgress     int64 `json:"in_progress"`
	RequiresAction int64 `json:"requires_action"`
	Failed         int64 `json:"failed"`
}

type AdminSummaryResponse

type AdminSummaryResponse struct {
	Data       []AdminSummaryRow `json:"data"`
	HasMore    bool              `json:"has_more"`
	NextCursor string            `json:"next_cursor"`
}

type AdminSummaryRow

type AdminSummaryRow struct {
	ProjectID    string                  `json:"project_id"`
	KeyID        *string                 `json:"key_id"`
	AgentID      *string                 `json:"agent_id"`
	Assets       *store.AdminAssetCounts `json:"assets"`
	Sessions     AdminSessionCounts      `json:"sessions"`
	Usage        v1.TokenUsage           `json:"usage"`
	Coverage     AdminUsageCoverage      `json:"coverage"`
	LastActiveAt *int64                  `json:"last_active_at"`
}

type AdminUsageCoverage

type AdminUsageCoverage struct {
	MeasuredSessions int64    `json:"measured_sessions"`
	TotalSessions    int64    `json:"total_sessions"`
	Ratio            *float64 `json:"ratio"`
}

type Agents

Agents runs the saved Agent writes.

type AgentsReader

type AgentsReader interface {
	GetAgent(ctx context.Context, tenantID, agentID string) (agents.Agent, error)
	ListAgents(context.Context, agents.ListQuery) (agents.Page, error)
	GetAgentWithModelProvider(ctx context.Context, tenantID, agentID string) (agents.Agent, *v1.ModelProviderInput, error)
}

AgentsReader reads saved Agents. Session creation reads an Agent with GetAgentWithModelProvider when the Session inherits its model provider.

type Artifacts

type Artifacts interface {
	DeleteSessionArtifact(context.Context, sessions.DeleteSessionArtifactCommand) error
}

Artifacts deletes a Session's published Artifacts.

type ArtifactsReader

type ArtifactsReader interface {
	GetSessionArtifact(context.Context, string, string, string) (sessions.Artifact, error)
	ListSessionArtifacts(context.Context, string, string, string, string, int, bool) (sessions.ArtifactPage, error)
	ReadSessionArtifact(context.Context, string, string, string, func(sessions.Artifact, io.Reader) error) error
}

ArtifactsReader reads and streams a Session's published Artifacts.

type ConfigurationDiscovery

type ConfigurationDiscovery interface {
	DiscoverConfiguration(ctx context.Context, provider string, input sandbox.ConfigurationDiscoveryInput) (json.RawMessage, error)
}

ConfigurationDiscovery asks a Sandbox Provider which configuration values its credential can use.

type CoreAPIError

type CoreAPIError struct {
	Message string  `json:"message" binding:"required"`
	Type    string  `json:"type" binding:"required"`
	Code    *string `json:"code" extensions:"x-nullable"`
	Param   *string `json:"param" extensions:"x-nullable"`
	// Details contains only documented, Core-owned facts: string, finite number,
	// boolean, null or string array values. Never include request echoes, secrets
	// or native/provider error text. Empty or invalid details are omitted.
	Details CoreErrorDetails `json:"details,omitempty" swaggertype:"object"`
}

type CoreErrorDetail

type CoreErrorDetail struct {
	// contains filtered or unexported fields
}

CoreErrorDetail has a closed set of constructors so nested objects, arbitrary errors and provider responses cannot be passed as detail values. The zero value represents JSON null. Callers must choose documented fixed keys and safe facts; a string constructor is not a redaction mechanism.

func CoreErrorNull

func CoreErrorNull() CoreErrorDetail

func CoreErrorNumber

func CoreErrorNumber(value float64) CoreErrorDetail

func CoreErrorString

func CoreErrorString(value string) CoreErrorDetail

func CoreErrorStrings

func CoreErrorStrings(values ...string) CoreErrorDetail

func (CoreErrorDetail) MarshalJSON

func (value CoreErrorDetail) MarshalJSON() ([]byte, error)

type CoreErrorDetails

type CoreErrorDetails map[string]CoreErrorDetail

type CoreErrorResponse

type CoreErrorResponse struct {
	Error CoreAPIError `json:"error" binding:"required"`
}

CoreErrorResponse is the administration error envelope. Public and machine routes retain v1.ErrorResponse and never emit Details.

type CoreHarness

type CoreHarness struct {
	ModelConfigurationSupport v1.ModelConfigurationSupport `json:"model_configuration_support" binding:"required"`
	Object                    string                       `json:"object" enums:"core.harness" binding:"required"`
	ID                        string                       `json:"id" binding:"required"`
	Enabled                   bool                         `json:"enabled" binding:"required"`
	Default                   bool                         `json:"default" binding:"required"`
	ModelConfiguration        *HarnessModelConfiguration   `json:"model_configuration" extensions:"x-nullable" binding:"required"`
}

CoreHarness describes one harness this build supports. Enabled and default come from the process configuration; the model provider is the deployment default stored in Core, or null.

type CoreHarnessList

type CoreHarnessList struct {
	Object string        `json:"object" enums:"list" binding:"required"`
	Data   []CoreHarness `json:"data" binding:"required"`
}

type Dependencies

type Dependencies struct {
	// Engine is the default Harness. Harnesses lists the other Harnesses this
	// deployment enables for explicit selection.
	Engine    string
	Harnesses []string
	// Policy is the immutable qualification shared with the execution
	// Dispatcher. The zero value uses the built-in engine registrations.
	Policy execution.Policy
	// CoreKeys authenticates /core/v1 and keeps Core keys out of Project key
	// authentication.
	CoreKeys *DeploymentAuthenticator
	// Installation holds the facts GET /core/v1/installation reports;
	// InstallationBindings counts what is bound to the current public URL.
	Installation         Installation
	InstallationBindings InstallationBindings

	Projects             Projects
	ProjectsReader       ProjectsReader
	Vaults               Vaults
	VaultsReader         VaultsReader
	ModelProviders       ModelProviders
	ModelProvidersReader ModelProvidersReader
	Files                Files
	FilesReader          FilesReader
	Skills               Skills
	SkillsReader         SkillsReader
	EnvironmentTemplates EnvironmentTemplates
	Agents               Agents
	AgentsReader         AgentsReader
	Sessions             Sessions
	SessionCreation      SessionCreation
	SessionEvents        SessionEvents
	Turns                Turns
	Items                Items
	Subagents            Subagents
	Artifacts            Artifacts
	ArtifactsReader      ArtifactsReader
	SessionAdmin         SessionAdmin
	Environments         Environments
	EnvironmentsReader   EnvironmentsReader
	ExecutorConnections  ExecutorConnections
	Admin                Admin
	AdminAudit           AdminAudit
	WriteAudit           WriteAudit
	Metrics              Metrics
	RuntimeObservations  RuntimeObservations
	RuntimeHistory       RuntimeHistory

	EnvironmentTemplatesReader EnvironmentTemplatesReader

	// Execution is nil when this Core runs without a Runtime gateway, and so
	// without an execution Worker. Work that needs one then answers 503
	// execution_unavailable.
	Execution *Execution
	// Sandboxes is nil when this Core has no managed sandbox installation. The
	// sandbox node and manager routes are then absent, and openai_hosted
	// Sessions answer 503 execution_unavailable. It requires Execution.
	Sandboxes *Sandboxes
}

Dependencies is everything the handler uses. Each application area is one field typed as an interface declared next to the area's handlers, listing exactly the methods they call. Every field is required unless its comment says what nil means; NewHandler rejects a missing one.

type Deployment

type Deployment interface {
	View(ctx context.Context) (deployment.View, error)
	ListNodes(ctx context.Context) ([]deployment.Node, error)
	NodeDetail(ctx context.Context, id, window string) (deployment.NodeDetail, error)
	UpdateNode(ctx context.Context, id string, update deployment.NodeUpdate) error
	RemoveNode(ctx context.Context, id string) error
	CreateEnrollment(ctx context.Context, capacity deployment.Capacity) (deployment.EnrollmentToken, error)
	Enroll(ctx context.Context, token string, input deployment.Enrollment) (deployment.NodeIdentity, error)
	NodeConfiguration(ctx context.Context, nodeID, token string, generation uint64) (deployment.NodeConfiguration, error)
	NodeStatus(ctx context.Context, nodeID, credential string) (deployment.NodeStatus, error)
	// DecodeConfiguration decodes a submitted provider configuration and
	// credential with the provider's declared codec.
	DecodeConfiguration(provider string, public, credential json.RawMessage) (sandbox.Configuration, error)
}

Deployment reads the sandbox deployment and manages its nodes: enrollment, identity, generation configuration, capacity and removal.

type DeploymentAuthenticator

type DeploymentAuthenticator struct {
	// contains filtered or unexported fields
}

DeploymentAuthenticator checks the Core key. It is deliberately separate from project API principals.

func NewDeploymentAuthenticator

func NewDeploymentAuthenticator(digests []string) (*DeploymentAuthenticator, error)

type DeploymentChanges

type DeploymentChanges interface {
	InitializeSandboxDeployment(ctx context.Context, input sandbox.Selection) (deployment.View, error)
	UpdateSandboxDeployment(ctx context.Context, input sandbox.Selection) (deployment.View, error)
}

DeploymentChanges sets up and updates the sandbox deployment through the execution owner.

type DeploymentReset

type DeploymentReset interface {
	StartSandboxReset(ctx context.Context, input deployment.ResetRequest) (deployment.View, error)
	CancelSandboxReset(ctx context.Context, generation uint64) (deployment.View, error)
}

DeploymentReset starts and cancels a sandbox deployment reset through the execution owner.

type DiagnosticFailure

type DiagnosticFailure struct {
	Code     string           `` /* 528-byte string literal not displayed */
	Params   CoreErrorDetails `json:"params" swaggertype:"object"`
	FailedAt *time.Time       `json:"failed_at" extensions:"x-nullable"`
}

type EnvironmentExecutorCredentialRequest

type EnvironmentExecutorCredentialRequest struct {
	KeyID  string `json:"key_id" format:"uuid"`
	Rotate bool   `json:"rotate,omitempty"`
}

type EnvironmentTemplates

EnvironmentTemplates runs the Environment Template write use cases.

type EnvironmentTemplatesReader

type EnvironmentTemplatesReader interface {
	Get(ctx context.Context, tenantID, templateID string) (environmenttemplates.Template, error)
	List(ctx context.Context, tenantID string, query environmenttemplates.ListQuery) (environmenttemplates.Page, error)
	Resolve(ctx context.Context, tenantID, templateID string) (environmenttemplates.Resolved, error)
}

EnvironmentTemplatesReader reads Environment Templates. Resolve also returns the decrypted configuration that Session creation composes.

type EnvironmentWorkspaces

type EnvironmentWorkspaces interface {
	ReadEnvironmentDirectory(context.Context, sessions.Environment, string) (proto.WorkspaceDirectoryResult, error)
	WriteEnvironmentFile(context.Context, sessions.Environment, string, []byte) (int64, error)
}

EnvironmentWorkspaces reads and writes a connected Environment's live workspace through its Runtime.

type Environments

type Environments interface {
	AuthorizeEnvironmentInstallation(context.Context, identity.Principal, string, string) (string, int64, error)
	ValidateEnvironmentInstallation(context.Context, string, string) (sessions.InstallationAuthorization, error)
	ClaimEnvironmentInstallation(context.Context, string, string, string) error
	IssueProjectExecutorCredential(context.Context, identity.Principal, string, string, bool) (sessions.IssuedExecutorCredential, error)
	RevokeProjectExecutorCredential(context.Context, identity.Principal, string, string) error
}

Environments grants and claims native installations, and manages the executor credentials of a Project's self_hosted Environments. The Project's principal is an executor credential's execution principal; the Core key that authorizes the request is not.

type EnvironmentsReader

type EnvironmentsReader interface {
	GetEnvironment(context.Context, string, string) (sessions.Environment, error)
	ProjectExecutorCredentialState(context.Context, identity.Principal, string) (sessions.ExecutorCredentialState, error)
}

EnvironmentsReader reads Environments and the executor credentials of a Project's self_hosted Environments.

type Execution

type Execution struct {
	// ExecutorURL is the validated daemon WebSocket URL that self-hosted
	// Sessions report and executors connect to.
	ExecutorURL      string
	SessionAdmission SessionAdmission
	InputAdmission   InputAdmission
	SessionArchive   SessionArchive
	Workspaces       EnvironmentWorkspaces
	// NativeInstaller is nil for a build without a source revision: the native
	// installation routes are then absent and Sessions carry no installation.
	NativeInstaller *NativeInstaller
}

Execution is the execution Worker's surface. Every field is required unless its comment says what nil means.

type ExecutorConnection

type ExecutorConnection struct {
	Status     string     `json:"status" binding:"required" enums:"never_enrolled,connected,disconnected"`
	BoundKeyID *string    `json:"bound_key_id" binding:"required" extensions:"x-nullable" format:"uuid"`
	EnrolledAt *time.Time `json:"enrolled_at" binding:"required" format:"date-time" extensions:"x-nullable"`
	LastSeenAt *time.Time `json:"last_seen_at" binding:"required" format:"date-time" extensions:"x-nullable"`
}

ExecutorConnection reports binding history and current Core-observed connectivity. Heartbeat times are observations, not execution or native readiness.

type ExecutorConnections

type ExecutorConnections interface {
	ExecutorConnected(ctx context.Context, environmentID, credentialDigest string) (bool, error)
}

ExecutorConnections observes current executor authority and its actual gateway peer. The observer runs after the Environments snapshot closes and must recheck authority after inspecting the peer. Without a gateway peer, no binding is connected.

type ExecutorCredentialList

type ExecutorCredentialList struct {
	Data       []sessions.ExecutorCredential `json:"data" binding:"required"`
	Connection ExecutorConnection            `json:"connection" binding:"required"`
}

ExecutorCredentialList holds credential metadata only, never a secret.

type Files

type Files interface {
	Create(context.Context, files.CreateCommand) (files.File, error)
	Delete(context.Context, files.DeleteCommand) error
}

Files creates and deletes project-owned source Files.

type FilesReader

type FilesReader interface {
	Get(ctx context.Context, tenantID, fileID string) (files.File, error)
	List(ctx context.Context, tenantID string, query files.ListQuery) (files.Page, error)
	Read(ctx context.Context, tenantID, fileID string, consume func(files.File, io.Reader) error) error
}

FilesReader reads source File metadata and streams their bytes.

type Handler

type Handler struct {
	Dependencies
	// contains filtered or unexported fields
}

type HarnessModelConfiguration

type HarnessModelConfiguration struct {
	Object  string `json:"object" enums:"core.model_configuration" binding:"required"`
	Harness string `json:"harness" binding:"required"`
	v1.ModelConfigurationView
	LastUsedAt    *time.Time `json:"last_used_at" format:"date-time" extensions:"x-nullable" binding:"required"`
	LastErrorCode *string    `` /* 235-byte string literal not displayed */
	LastErrorAt   *time.Time `json:"last_error_at" format:"date-time" extensions:"x-nullable" binding:"required"`
	UpdatedAt     time.Time  `json:"updated_at" binding:"required"`
}

HarnessModelConfiguration is a harness's deployment default model provider. It never contains the API key, only whether one is configured.

type InputAdmission

type InputAdmission interface {
	SubmitInputs(context.Context, string, string, string, []sessions.Input) ([]sessions.InputReceipt, error)
}

InputAdmission submits Session input through the execution Worker, which validates execution support first.

type Installation

type Installation struct {
	Object string `json:"object" enums:"core.installation"`
	// OAC_INSTALLATION_ID; null when Core runs without the sandbox manager.
	InstallationID *string `json:"installation_id" extensions:"x-nullable"`
	// OAC_PUBLIC_URL: the origin applications, nodes, sandboxes and self-hosted executors use. Null when unset.
	PublicURL *string `json:"public_url" extensions:"x-nullable"`
	// public_url followed by /v1; null when public_url is null.
	APIBaseURL *string `json:"api_base_url" extensions:"x-nullable"`
	// True when public_url names a loopback host, reachable only from the Core host.
	LocalOnly bool `json:"local_only"`
	// Full source commit Core was built from; null for development builds.
	SourceCommit *string `json:"source_commit" extensions:"x-nullable"`
	// The installer's settings snapshot (OAC_SETTINGS_FILE); null when the installer did not start Core.
	Configuration   *InstallationConfiguration `json:"configuration" extensions:"x-nullable"`
	AddressBindings deployment.AddressBindings `json:"address_bindings"`
}

Installation reports Core's installation facts. Core reads them from its environment and build; configuration is the installer's settings snapshot.

type InstallationBindings

type InstallationBindings interface {
	AddressBindings(context.Context) (deployment.AddressBindings, error)
}

InstallationBindings counts what is bound to the current public URL.

type InstallationConfiguration

type InstallationConfiguration struct {
	// Absolute host path of the installation's config.json.
	Path string `json:"path"`
	// Command that applies config.json changes.
	ApplyCommand string                `json:"apply_command"`
	AppliedAt    time.Time             `json:"applied_at"`
	Settings     []InstallationSetting `json:"settings"`
}

InstallationConfiguration says where process settings are changed and what the last applied values were. Sensitive values are never included.

func ParseInstallationConfiguration

func ParseInstallationConfiguration(raw []byte) (*InstallationConfiguration, error)

ParseInstallationConfiguration validates the installer's settings snapshot. A sensitive setting that carries a value is rejected, so the snapshot cannot leak a secret through this read.

type InstallationSetting

type InstallationSetting struct {
	// Dotted config.json key, such as ports.core.
	Key string `json:"key"`
	// Applied value; always null for a sensitive setting.
	Value   any `json:"value" extensions:"x-nullable"`
	Default any `json:"default" extensions:"x-nullable"`
	// Present only for a sensitive setting: whether it has a value.
	Configured *bool `json:"configured,omitempty"`
	// False for settings fixed at installation.
	Changeable bool `json:"changeable"`
	Sensitive  bool `json:"sensitive"`
	// Services that restart when the setting changes.
	Restarts []string `json:"restarts"`
}

type ItemDiagnosticTiming

type ItemDiagnosticTiming struct {
	ItemID             string     `json:"item_id"`
	StartedAt          time.Time  `json:"started_at"`
	CompletedAt        *time.Time `json:"completed_at" extensions:"x-nullable"`
	ObservedDurationMS *int64     `json:"observed_duration_ms" extensions:"x-nullable"`
}

type Items

type Items interface {
	ListItems(context.Context, string, string, string, int, bool) (sessions.ItemPage, error)
}

Items reads a Session's root Items.

type Metrics

type Metrics interface {
	Read(context.Context, string) (coremetrics.View, error)
	RecordUnavailable()
}

Metrics reads Core's process and job metrics and counts rejected execution.

type ModelProviders

ModelProviders replaces and removes each harness's deployment default model configuration. Resolve opens a harness's default at Session creation, before the encrypted Session snapshot is committed; it returns nil when the harness has none.

type ModelProvidersReader

type ModelProvidersReader interface {
	List(context.Context) ([]modelconfiguration.Configuration, error)
}

ModelProvidersReader lists the deployment defaults' safe views.

type NativeInstallationClaim

type NativeInstallationClaim struct {
	ExecutorToken string `json:"executor_token"`
}

type NativeInstaller

type NativeInstaller struct {
	// Version is the build revision executors install and claim.
	Version string
	// Catalog holds the matching installation artifacts. It is nil when the
	// operator installed none: installations then report unavailable and the
	// grant routes answer 503 installation_unavailable.
	Catalog *nativeinstaller.Catalog
}

NativeInstaller serves the self-hosted native installation of this build.

type NodeAllocations

type NodeAllocations interface {
	NodeAllocations(ctx context.Context, nodeID string) ([]deployment.NodeAllocation, error)
}

NodeAllocations lists the allocations a sandbox node holds.

type ProjectAPIKeyRequest

type ProjectAPIKeyRequest struct {
	Name string `json:"name"`
}

type ProjectRequest

type ProjectRequest struct {
	Name string `json:"name"`
}

type Projects

Projects runs the Project and API key administration use cases.

type ProjectsReader

type ProjectsReader interface {
	GetProject(context.Context, string) (projects.Binding, error)
	ListProjects(context.Context, projects.ListQuery) (projects.Page, error)
	ListAPIKeys(context.Context, string, projects.ListQuery) (projects.KeyPage, error)
	ResolveAPIKey(context.Context, [sha256.Size]byte) (projects.KeyBinding, error)
}

ProjectsReader reads Projects and their API keys, and resolves a Project API key digest to its current binding for authentication.

type ResourceOwnerList

type ResourceOwnerList struct {
	Data []writeaudit.ResourceOwner `json:"data"`
}

type RuntimeDiskObservation

type RuntimeDiskObservation struct {
	UsageBytes *uint64 `json:"usage_bytes" extensions:"x-nullable" binding:"required" minimum:"0"`
	LimitBytes *uint64 `json:"limit_bytes" extensions:"x-nullable" binding:"required" minimum:"1"`
}

RuntimeDiskObservation has the memory observation's shape and null rules.

type RuntimeHistory

type RuntimeHistory interface {
	Capabilities() runtimehistory.Capabilities
	QuerySession(context.Context, string, string, runtimehistory.Range) (runtimehistory.Response, error)
}

RuntimeHistory queries durable Runtime history. Its capabilities declare whether this Core collects any; one that does not answers 503 runtime_history_unavailable.

type RuntimeObservations

type RuntimeObservations interface {
	ObserveSession(context.Context, string, string) (runtimeobs.Observation, error)
	ObserveSessions(context.Context, []runtimeobs.SessionIdentity, runtimeobs.PageOptions) ([]runtimeobs.Observation, []error)
}

RuntimeObservations samples the current Runtime of one or more Sessions.

type SandboxAllocationList

type SandboxAllocationList struct {
	Data []deployment.NodeAllocation `json:"data"`
}

type SandboxDeploymentChangeInput

type SandboxDeploymentChangeInput struct {
	SandboxDeploymentInput
}

type SandboxDeploymentInput

type SandboxDeploymentInput struct {
	ExpectedGeneration *uint64 `json:"expected_generation" binding:"required"`
	// Per-sandbox limits, required for Docker and microsandbox. E2B may omit
	// them; Core then uses the validated template build's cpus and memory_mib.
	Resources     sandbox.Resources       `json:"resources"`
	Runtime       *sandbox.RuntimeRelease `json:"runtime,omitempty"`
	Provider      string                  `json:"provider"`
	Configuration json.RawMessage         `json:"configuration" swaggertype:"object"`
	Credential    json.RawMessage         `json:"credential,omitempty" swaggertype:"object"`
}

type SandboxEnrollmentToken

type SandboxEnrollmentToken struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
	// Public, non-secret handle of this command; never a credential. The node it registers reports the same value as enrollment_id.
	EnrollmentID string `json:"enrollment_id"`
}

type SandboxEnrollmentTokenRequest

type SandboxEnrollmentTokenRequest struct {
	MaxActive *int `json:"max_active,omitempty"`
	// Docker never suspends, so Core replaces this with max_active; microsandbox uses both limits.
	MaxRetained *int `json:"max_retained,omitempty"`
}

type SandboxMutationResponse

type SandboxMutationResponse struct {
	ID      string `json:"id"`
	Deleted bool   `json:"deleted,omitempty"`
	Updated bool   `json:"updated,omitempty"`
}

type SandboxNodeList

type SandboxNodeList struct {
	Data []deployment.Node `json:"data"`
}

type Sandboxes

type Sandboxes struct {
	Deployment             Deployment
	NodeAllocations        NodeAllocations
	DeploymentChanges      DeploymentChanges
	DeploymentReset        DeploymentReset
	ConfigurationDiscovery ConfigurationDiscovery
}

Sandboxes is the managed sandbox deployment's surface. Every field is required.

type SessionAdmin

type SessionAdmin interface {
	GetSessionDiagnosticsSnapshot(context.Context, string, string) (sessions.Session, error)
	GetTurnDiagnosticsSnapshot(context.Context, string, string, string) (sessions.TurnDiagnosticsSnapshot, error)
	GetSessionExecutionConfiguration(context.Context, string, string) (v1.SessionExecutionConfiguration, error)
	GetManagedSessionArchive(context.Context, string, string) (sessions.ManagedArchive, error)
}

SessionAdmin serves the administrator's per-Session reads: diagnostics snapshots, the execution configuration and the managed archive state.

type SessionAdmission

type SessionAdmission interface {
	CreateSession(context.Context, string, sessions.CreateSession) (sessions.Session, error)
	CreateSessionStream(context.Context, string, sessions.CreateSession) (sessions.Creation, error)
}

SessionAdmission creates Sessions that admit work through the execution Worker, which validates execution support first.

type SessionArchive

type SessionArchive interface {
	ArchiveManagedSession(context.Context, string, string, uint64) (sessions.ManagedArchive, error)
}

SessionArchive archives a managed Session through the execution owner; SessionAdmin reads its archive state.

type SessionCreation

type SessionCreation interface {
	CreateSession(context.Context, string, sessions.CreateSession) (sessions.Session, error)
	CreateSessionStream(context.Context, string, sessions.CreateSession) (sessions.Creation, error)
	FindSessionCreation(context.Context, string, string, json.RawMessage, identity.Subject) (sessions.Creation, error)
}

SessionCreation creates Sessions without execution work and finds an earlier creation by its retry identity. Creation that admits work goes through Execution.SessionAdmission.

type SessionDiagnosticFailure

type SessionDiagnosticFailure struct {
	DiagnosticFailure
	Source string `json:"source" enums:"turn,environment,environment_input"`
	TurnID string `json:"turn_id,omitempty"`
}

type SessionDiagnostics

type SessionDiagnostics struct {
	Object    string                    `json:"object" enums:"core.session_diagnostics"`
	SessionID string                    `json:"session_id"`
	Status    string                    `json:"status" enums:"idle,in_progress,requires_action,failed"`
	Failure   *SessionDiagnosticFailure `json:"failure" extensions:"x-nullable"`
}

type SessionEvents

type SessionEvents interface {
	SessionEventCursor(context.Context, string, string) (int64, error)
	ListSessionEvents(context.Context, string, string, int64) ([]sessions.SessionChange, error)
	SessionStreamSnapshot(context.Context, string, string) (sessions.Session, int64, error)
}

SessionEvents reads a Session's committed event journal, and the Session projection with its event cursor from one snapshot.

type Sessions

type Sessions interface {
	GetSession(context.Context, string, string) (sessions.Session, error)
	ListSessions(context.Context, string, string, int, bool, *string) (sessions.Page, error)
	UpdateSessionMetadata(context.Context, string, string, map[string]string) (sessions.Session, error)
	DeleteSession(context.Context, string, string) error
	AuditSessionOperation(context.Context, string, string, string) error
}

Sessions reads, updates and deletes Sessions, and records their public write audit.

type Skills

Skills runs the Skill use cases: uploads, the default pointer, deletion, lists and content reads.

type SkillsReader

type SkillsReader interface {
	Skill(ctx context.Context, tenantID string, id uuid.UUID) (skills.Skill, error)
	Version(ctx context.Context, tenantID string, skillID uuid.UUID, version int64) (skills.Version, error)
}

SkillsReader reads Skill and version metadata.

type Subagents

type Subagents interface {
	GetSubagent(context.Context, string, string, string) (v1.Subagent, error)
	ListSubagents(context.Context, string, string, string, int, bool) (v1.SubagentList, error)
	ListSubagentItems(context.Context, string, string, string, string, int, bool) (v1.ItemList, error)
	GetSubagentTurn(context.Context, string, string, string, string) (v1.Turn, error)
	ListSubagentTurns(context.Context, string, string, string, string, int, bool) (v1.TurnList, error)
	ListSubagentTurnItems(context.Context, string, string, string, string, string, int, bool) (v1.ItemList, error)
}

Subagents reads tenant-authorized, persisted public resources. Implementations must enforce every supplied parent scope, including the pagination cursor.

type TurnDiagnostics

type TurnDiagnostics struct {
	Object         string                 `json:"object" enums:"core.turn_diagnostics"`
	SessionID      string                 `json:"session_id"`
	TurnID         string                 `json:"turn_id"`
	Status         string                 `json:"status"`
	Failure        *DiagnosticFailure     `json:"failure" extensions:"x-nullable"`
	Items          []ItemDiagnosticTiming `json:"items"`
	ItemsTruncated bool                   `json:"items_truncated"`
}

type Turns

type Turns interface {
	GetTurn(context.Context, string, string, string) (sessions.Turn, error)
	ListTurns(context.Context, string, string, string, int, bool) (sessions.TurnPage, error)
}

Turns reads a Session's root Turns.

type Vaults

Vaults runs the Vault and Credential use cases, and selects the Credentials a Session's MCP servers use at creation.

type VaultsReader

type VaultsReader interface {
	GetVault(ctx context.Context, tenantID, vaultID string) (vaults.Vault, error)
	ListVaults(ctx context.Context, tenantID string, query vaults.PageQuery) (vaults.VaultPage, error)
	GetCredential(ctx context.Context, tenantID, vaultID, credentialID string) (vaults.Credential, error)
	ListCredentials(ctx context.Context, tenantID, vaultID string, query vaults.PageQuery) (vaults.CredentialPage, error)
}

VaultsReader reads Vaults and the public metadata of their Credentials.

type WriteAudit

type WriteAudit interface {
	GetResourceOwners(context.Context, string, string, []string) ([]writeaudit.ResourceOwner, error)
	ListWriteOperations(context.Context, string, writeaudit.Filter) (writeaudit.Page, error)
}

WriteAudit reads public write provenance as safe read models, never request bodies or credentials.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL