SharedOS API v0.1.0-alpha.0


SharedOS API / @aicoo/sharedos-runtime

@aicoo/sharedos-runtime

A fixed permission envelope with standard and replaceable one-turn agent runtimes.

npm install @aicoo/sharedos-runtime@next

SharedOS is runtime-agnostic, not runtime-less. The package exports two layers:

  • SharedOSExecutor validates and admits a turn, exposes only authorized tools, rechecks every exact call, applies cancellation, and records runtime provenance. Runtime plugins cannot replace this layer.
  • RuntimePlugin owns the agent loop inside that envelope. StandardRuntime is the included reference implementation over AgentTurnDriver.

Standard runtime

import { SharedOSExecutor, StandardRuntime } from "@aicoo/sharedos-runtime";

const runtime = new StandardRuntime(agentDriver);
const turns = new SharedOSExecutor(kernel, runtime, {
  defaultMaxSteps: 16,
  defaultMaxToolCalls: 16,
  defaultTimeoutMs: 120_000,
});

const result = await turns.execute(executionRequest);

The original API remains available as a compatibility shorthand:

import { TurnExecutor } from "@aicoo/sharedos-runtime";

const turns = new TurnExecutor(kernel, agentDriver);

Custom runtime

import type { RuntimePlugin } from "@aicoo/sharedos-runtime";

const codexRuntime: RuntimePlugin = {
  manifest: {
    id: "acme.codex",
    version: "1.0.0",
    protocolVersion: "1",
    metadata: { harness: "codex", backend: "vercel-sandbox" },
  },
  async run(request, host, signal) {
    // Translate the harness's native tool definitions to request.tools.
    // Every implementation must route actual effects through this broker.
    const result = await host.invokeTool({
      id: crypto.randomUUID(),
      tool: "files.search",
      arguments: { path: ["Projects"], query: "status" },
      traceId: request.context.traceId,
      requestedAt: request.context.now,
    });

    signal.throwIfAborted();
    return { type: "complete", output: { toolStatus: result.status } };
  },
};

const turns = new SharedOSExecutor(kernel, codexRuntime);

Embedded hosts can observe events as they are emitted without giving the plugin an authoritative event channel:

await turns.execute(executionRequest, {
  signal,
  onEvent: (event) => streamController.enqueue(event),
});

The callback receives a frozen snapshot. Callback failure does not replace the turn's protocol outcome; cancel the supplied signal when the consumer closes.

A plugin receives a frozen RuntimeTurnRequest without grants, issuing authority, or namespace-management state. Its RuntimeHost contains only:

  • effective step, tool-call, and deadline limits;
  • invokeTool, which checks the visible catalog and then re-authorizes through the kernel;
  • emit, which records plugin observations as wrapped runtime.event events.

The broker closes when run returns. A plugin cannot use a retained host handle for later tool calls or emit authoritative turn.* and tool.* events.

Trusted selection

RuntimeRegistry is an instance-scoped registry for trusted boot configuration:

const runtimes = new RuntimeRegistry([
  new StandardRuntime(agentDriver),
  codexRuntime,
]);
const runtime = runtimes.resolve(serverPolicy.runtimeId);
const turns = new SharedOSExecutor(kernel, runtime);

Do not resolve a runtime id directly from a message, model output, or unverified request metadata. In-process plugins have the ambient privileges of the host; isolate third-party runtimes behind a process, container, microVM, or remote adapter.

Product heartbeats, multi-turn retries, adaptive routing, benchmark scheduling, and network-level stopping remain host responsibilities.

SharedOS is currently an 0.x prerelease.

Classes

RuntimeNotFoundError

Defined in: packages/runtime/src/runtime-plugin.ts:66

Extends

  • Error

Constructors

Constructor

new RuntimeNotFoundError(runtimeId): RuntimeNotFoundError

Defined in: packages/runtime/src/runtime-plugin.ts:67

Parameters
ParameterType
runtimeIdstring
Returns

RuntimeNotFoundError

Overrides

Error.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
<a id="property-cause"></a> cause?publicunknown-Error.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
<a id="property-message"></a> messagepublicstring-Error.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
<a id="property-name"></a> namepublicstring-Error.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
<a id="property-stack"></a> stack?publicstring-Error.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
<a id="property-stacktracelimit"></a> stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.Error.stackTraceLimitnode_modules/.pnpm/@types+node@22.20.1/node_modules/@types/node/globals.d.ts:68

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@22.20.1/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from

Error.captureStackTrace

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@22.20.1/node_modules/@types/node/globals.d.ts:56

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


RuntimeRegistry

Defined in: packages/runtime/src/runtime-plugin.ts:77

An instance-scoped registry populated by trusted host configuration. Runtime selection is intentionally absent from model-visible execution requests.

Constructors

Constructor

new RuntimeRegistry(runtimes?): RuntimeRegistry

Defined in: packages/runtime/src/runtime-plugin.ts:80

Parameters
ParameterTypeDefault value
runtimesreadonly RuntimePlugin[][]
Returns

RuntimeRegistry

Methods

has()

has(runtimeId): boolean

Defined in: packages/runtime/src/runtime-plugin.ts:107

Parameters
ParameterType
runtimeIdstring
Returns

boolean

list()

list(): readonly object[]

Defined in: packages/runtime/src/runtime-plugin.ts:119

Returns

readonly object[]

register()

register(runtime): void

Defined in: packages/runtime/src/runtime-plugin.ts:86

Parameters
ParameterType
runtimeRuntimePlugin
Returns

void

resolve()

resolve(runtimeId): RuntimePlugin

Defined in: packages/runtime/src/runtime-plugin.ts:111

Parameters
ParameterType
runtimeIdstring
Returns

RuntimePlugin


SharedOSExecutor

Defined in: packages/runtime/src/executor.ts:73

The non-replaceable security envelope around one replaceable RuntimePlugin. Scheduling, retries, and network-level stopping remain host responsibilities.

Implements

Constructors

Constructor

new SharedOSExecutor(kernel, runtime, options?): SharedOSExecutor

Defined in: packages/runtime/src/executor.ts:83

Parameters
ParameterType
kernelTurnKernel
runtimeRuntimePlugin
optionsSharedOSExecutorOptions
Returns

SharedOSExecutor

Accessors

runtimeManifest
Get Signature

get runtimeManifest(): object

Defined in: packages/runtime/src/executor.ts:124

Returns

object

id

id: string

metadata?

optional metadata?: JsonObject

protocolVersion

protocolVersion: "1"

version

version: string

Methods

execute()

execute(input, options?): Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>

Defined in: packages/runtime/src/executor.ts:128

Parameters
ParameterType
input{ agent: { agentId: string; kind: "agent"; }; context: { actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }; executionId: string; message: { createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }; metadata?: JsonObject; options?: { maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }; state?: JsonObject; tools: object[]; version: "1"; }
input.agent{ agentId: string; kind: "agent"; }
input.agent.agentIdstring
input.agent.kind"agent"
input.context{ actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }
input.context.actor{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.authority{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.enabledToolNamespacesstring[]
input.context.grantsobject[]
input.context.namespaceIdstring
input.context.nowstring
input.context.owner{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.purposestring
input.context.traceIdstring
input.executionIdstring
input.message{ createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }
input.message.createdAtstring
input.message.idstring
input.message.intentstring
input.message.payloadJsonValue
input.message.provenance?{ metadata?: JsonObject; parentIds: string[]; source: string; }
input.message.provenance.metadata?JsonObject
input.message.provenance.parentIdsstring[]
input.message.provenance.sourcestring
input.message.purposestring
input.message.receiver{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.replyTo?string
input.message.sender{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.traceIdstring
input.message.version"1"
input.metadata?JsonObject
input.options?{ maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }
input.options.maxSteps?number
input.options.maxToolCalls?number
input.options.timeoutMs?number
input.state?JsonObject
input.toolsobject[]
input.version"1"
optionsExecuteTurnOptions
Returns

Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>

Implementation of

TurnExecutionPort.execute


StandardRuntime

Defined in: packages/runtime/src/standard-runtime.ts:66

The reference SharedOS loop. Hosts may replace it with another RuntimePlugin.

Implements

Constructors

Constructor

new StandardRuntime(driver, options?): StandardRuntime

Defined in: packages/runtime/src/standard-runtime.ts:71

Parameters
ParameterType
driverAgentTurnDriver
optionsStandardRuntimeOptions
Returns

StandardRuntime

Properties

PropertyModifierTypeDefault valueDefined in
<a id="property-manifest"></a> manifestreadonlyobjectSTANDARD_RUNTIME_MANIFESTpackages/runtime/src/standard-runtime.ts:67
manifest.idpublicstringundefinedpackages/contracts/dist/runtime.d.ts:9
manifest.metadata?publicJsonObjectundefinedpackages/contracts/dist/runtime.d.ts:12
manifest.protocolVersionpublic"1"undefinedpackages/contracts/dist/runtime.d.ts:11
manifest.versionpublicstringundefinedpackages/contracts/dist/runtime.d.ts:10

Methods

run()

run(request, host, signal): Promise<{ metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; type: "fail"; }>

Defined in: packages/runtime/src/standard-runtime.ts:79

Parameters
ParameterType
requestRuntimeTurnRequest
hostRuntimeHost
signalAbortSignal
Returns

Promise<{ metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; type: "fail"; }>

Implementation of

RuntimePlugin.run


TurnExecutor

Defined in: packages/runtime/src/executor.ts:332

Compatibility facade for the original driver-based API. New harnesses should implement RuntimePlugin and use SharedOSExecutor directly.

Implements

Constructors

Constructor

new TurnExecutor(kernel, driver, options?): TurnExecutor

Defined in: packages/runtime/src/executor.ts:335

Parameters
ParameterType
kernelTurnKernel
driverAgentTurnDriver
optionsTurnExecutorOptions
Returns

TurnExecutor

Accessors

runtimeManifest
Get Signature

get runtimeManifest(): object

Defined in: packages/runtime/src/executor.ts:359

Returns

object

id

id: string

metadata?

optional metadata?: JsonObject

protocolVersion

protocolVersion: "1"

version

version: string

Methods

execute()

execute(input, options?): Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>

Defined in: packages/runtime/src/executor.ts:363

Parameters
ParameterType
input{ agent: { agentId: string; kind: "agent"; }; context: { actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }; executionId: string; message: { createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }; metadata?: JsonObject; options?: { maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }; state?: JsonObject; tools: object[]; version: "1"; }
input.agent{ agentId: string; kind: "agent"; }
input.agent.agentIdstring
input.agent.kind"agent"
input.context{ actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }
input.context.actor{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.authority{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.enabledToolNamespacesstring[]
input.context.grantsobject[]
input.context.namespaceIdstring
input.context.nowstring
input.context.owner{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.purposestring
input.context.traceIdstring
input.executionIdstring
input.message{ createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }
input.message.createdAtstring
input.message.idstring
input.message.intentstring
input.message.payloadJsonValue
input.message.provenance?{ metadata?: JsonObject; parentIds: string[]; source: string; }
input.message.provenance.metadata?JsonObject
input.message.provenance.parentIdsstring[]
input.message.provenance.sourcestring
input.message.purposestring
input.message.receiver{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.replyTo?string
input.message.sender{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.traceIdstring
input.message.version"1"
input.metadata?JsonObject
input.options?{ maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }
input.options.maxSteps?number
input.options.maxToolCalls?number
input.options.timeoutMs?number
input.state?JsonObject
input.toolsobject[]
input.version"1"
optionsExecuteTurnOptions
Returns

Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>

Implementation of

TurnExecutionPort.execute

Interfaces

AgentTurnDriver

Defined in: packages/runtime/src/standard-runtime.ts:44

Model/provider-specific code implements this port inside the standard runtime.

Methods

open()

open(request, signal): Promise<AgentTurnSession>>

Defined in: packages/runtime/src/standard-runtime.ts:45

Parameters
ParameterType
requestRuntimeTurnRequest
signalAbortSignal
Returns

Promise<AgentTurnSession>


AgentTurnSession

Defined in: packages/runtime/src/standard-runtime.ts:38

Methods

close()?

optional close(outcome, signal): void | Promise<void>>

Defined in: packages/runtime/src/standard-runtime.ts:40

Parameters
ParameterType
outcome"succeeded" | "denied" | "failed" | "cancelled"
signalAbortSignal
Returns

void | Promise<void>

next()

next(input, signal): Promise<AgentTurnDecision>>

Defined in: packages/runtime/src/standard-runtime.ts:39

Parameters
ParameterType
inputAgentTurnInput
signalAbortSignal
Returns

Promise<AgentTurnDecision>


ExecuteTurnOptions

Defined in: packages/runtime/src/executor.ts:48

Properties

PropertyTypeDescriptionDefined in
<a id="property-onevent"></a> onEvent?(event) => voidSynchronous observation hook for streaming an immutable event snapshot.packages/runtime/src/executor.ts:51
<a id="property-signal"></a> signal?AbortSignal-packages/runtime/src/executor.ts:49

RuntimeHost

Defined in: packages/runtime/src/runtime-plugin.ts:46

The only effectful surface supplied to a runtime plugin. Every tool call is checked against the effective catalog and re-authorized by the kernel.

Properties

PropertyModifierTypeDefined in
<a id="property-limits"></a> limitsreadonlyRuntimeLimitspackages/runtime/src/runtime-plugin.ts:47

Methods

emit()

emit(event): void

Defined in: packages/runtime/src/runtime-plugin.ts:49

Parameters
ParameterType
event{ data: JsonValue; type: string; }
event.dataJsonValue
event.typestring
Returns

void

invokeTool()

invokeTool(call, options?): Promise<{ callId: string; completedAt: string; metadata?: JsonObject; output: JsonValue; status: "succeeded"; tool: string; } | { callId: string; completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; status: "denied"; tool: string; } | { callId: string; completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; status: "failed"; tool: string; }>

Defined in: packages/runtime/src/runtime-plugin.ts:48

Parameters
ParameterType
call{ arguments: JsonObject; id: string; requestedAt: string; tool: string; traceId: string; }
call.argumentsJsonObject
call.id?string
call.requestedAt?string
call.tool?string
call.traceId?string
options?RuntimeToolInvocationOptions
Returns

Promise<{ callId: string; completedAt: string; metadata?: JsonObject; output: JsonValue; status: "succeeded"; tool: string; } | { callId: string; completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; status: "denied"; tool: string; } | { callId: string; completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; status: "failed"; tool: string; }>


RuntimeLimits

Defined in: packages/runtime/src/runtime-plugin.ts:31

Properties

PropertyModifierTypeDefined in
<a id="property-maxsteps"></a> maxStepsreadonlynumberpackages/runtime/src/runtime-plugin.ts:32
<a id="property-maxtoolcalls"></a> maxToolCallsreadonlynumberpackages/runtime/src/runtime-plugin.ts:33
<a id="property-timeoutms"></a> timeoutMsreadonlynumberpackages/runtime/src/runtime-plugin.ts:34

RuntimePlugin

Defined in: packages/runtime/src/runtime-plugin.ts:57

A replaceable one-turn harness running inside the SharedOS security envelope. Implementations must keep per-turn state inside run and support concurrent calls when one plugin instance is shared by a RuntimeRegistry.

Properties

PropertyModifierTypeDefined in
<a id="property-manifest-1"></a> manifestreadonlyobjectpackages/runtime/src/runtime-plugin.ts:58
manifest.idpublicstringpackages/contracts/dist/runtime.d.ts:9
manifest.metadata?publicJsonObjectpackages/contracts/dist/runtime.d.ts:12
manifest.protocolVersionpublic"1"packages/contracts/dist/runtime.d.ts:11
manifest.versionpublicstringpackages/contracts/dist/runtime.d.ts:10

Methods

run()

run(request, host, signal): Promise<{ metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; type: "fail"; }>

Defined in: packages/runtime/src/runtime-plugin.ts:59

Parameters
ParameterType
requestRuntimeTurnRequest
hostRuntimeHost
signalAbortSignal
Returns

Promise<{ metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; type: "fail"; }>


RuntimeToolInvocationOptions

Defined in: packages/runtime/src/runtime-plugin.ts:37

Properties

PropertyModifierTypeDescriptionDefined in
<a id="property-step"></a> step?readonlynumberOptional diagnostic position within the runtime's own loop.packages/runtime/src/runtime-plugin.ts:39

RuntimeVisibleContext

Defined in: packages/runtime/src/runtime-plugin.ts:14

Properties

PropertyModifierTypeDefined in
<a id="property-actor"></a> actorreadonly{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }packages/runtime/src/runtime-plugin.ts:15
<a id="property-namespaceid"></a> namespaceIdreadonlystringpackages/runtime/src/runtime-plugin.ts:17
<a id="property-now"></a> nowreadonlystringpackages/runtime/src/runtime-plugin.ts:20
<a id="property-owner"></a> ownerreadonly{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }packages/runtime/src/runtime-plugin.ts:16
<a id="property-purpose"></a> purposereadonlystringpackages/runtime/src/runtime-plugin.ts:18
<a id="property-traceid"></a> traceIdreadonlystringpackages/runtime/src/runtime-plugin.ts:19

SharedOSExecutorOptions

Defined in: packages/runtime/src/executor.ts:40

Extended by

Properties

PropertyTypeDefined in
<a id="property-clock"></a> clock?() => stringpackages/runtime/src/executor.ts:41
<a id="property-createid"></a> createId?() => stringpackages/runtime/src/executor.ts:42
<a id="property-defaultmaxsteps"></a> defaultMaxSteps?numberpackages/runtime/src/executor.ts:43
<a id="property-defaultmaxtoolcalls"></a> defaultMaxToolCalls?numberpackages/runtime/src/executor.ts:44
<a id="property-defaulttimeoutms"></a> defaultTimeoutMs?numberpackages/runtime/src/executor.ts:45

StandardRuntimeOptions

Defined in: packages/runtime/src/standard-runtime.ts:48

Extended by

Properties

PropertyTypeDefined in
<a id="property-closetimeoutms"></a> closeTimeoutMs?numberpackages/runtime/src/standard-runtime.ts:49

TurnExecutionPort

Defined in: packages/runtime/src/executor.ts:54

Methods

execute()

execute(input, options?): Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>

Defined in: packages/runtime/src/executor.ts:55

Parameters
ParameterType
input{ agent: { agentId: string; kind: "agent"; }; context: { actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }; executionId: string; message: { createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }; metadata?: JsonObject; options?: { maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }; state?: JsonObject; tools: object[]; version: "1"; }
input.agent{ agentId: string; kind: "agent"; }
input.agent.agentId?string
input.agent.kind?"agent"
input.context?{ actor: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; authority: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; enabledToolNamespaces: string[]; grants: object[]; namespaceId: string; now: string; owner: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; purpose: string; traceId: string; }
input.context.actor?{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.authority?{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.enabledToolNamespaces?string[]
input.context.grants?object[]
input.context.namespaceId?string
input.context.now?string
input.context.owner?{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.context.purpose?string
input.context.traceId?string
input.executionId?string
input.message?{ createdAt: string; id: string; intent: string; payload: JsonValue; provenance?: { metadata?: JsonObject; parentIds: string[]; source: string; }; purpose: string; receiver: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; replyTo?: string; sender: { kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }; traceId: string; version: "1"; }
input.message.createdAt?string
input.message.id?string
input.message.intent?string
input.message.payload?JsonValue
input.message.provenance?{ metadata?: JsonObject; parentIds: string[]; source: string; }
input.message.provenance.metadata?JsonObject
input.message.provenance.parentIds?string[]
input.message.provenance.source?string
input.message.purpose?string
input.message.receiver?{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.replyTo?string
input.message.sender?{ kind: "human"; userId: string; } | { agentId: string; kind: "agent"; } | { conversationId: string; kind: "group"; } | { kind: "service"; serviceId: string; }
input.message.traceId?string
input.message.version?"1"
input.metadata?JsonObject
input.options?{ maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; }
input.options.maxSteps?number
input.options.maxToolCalls?number
input.options.timeoutMs?number
input.state?JsonObject
input.tools?object[]
input.version?"1"
options?ExecuteTurnOptions
Returns

Promise<{ completedAt: string; events: object[]; executionId: string; metadata?: JsonObject; output: JsonValue; startedAt: string; status: "succeeded"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "denied"; traceId: string; version: "1"; } | { completedAt: string; error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "failed"; traceId: string; version: "1"; } | { completedAt: string; error?: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; events: object[]; executionId: string; metadata?: JsonObject; startedAt: string; status: "cancelled"; traceId: string; version: "1"; }>


TurnExecutorOptions

Defined in: packages/runtime/src/executor.ts:58

Extends

Properties

PropertyTypeInherited fromDefined in
<a id="property-clock-1"></a> clock?() => stringSharedOSExecutorOptions.clockpackages/runtime/src/executor.ts:41
<a id="property-closetimeoutms-1"></a> closeTimeoutMs?numberStandardRuntimeOptions.closeTimeoutMspackages/runtime/src/standard-runtime.ts:49
<a id="property-createid-1"></a> createId?() => stringSharedOSExecutorOptions.createIdpackages/runtime/src/executor.ts:42
<a id="property-defaultmaxsteps-1"></a> defaultMaxSteps?numberSharedOSExecutorOptions.defaultMaxStepspackages/runtime/src/executor.ts:43
<a id="property-defaultmaxtoolcalls-1"></a> defaultMaxToolCalls?numberSharedOSExecutorOptions.defaultMaxToolCallspackages/runtime/src/executor.ts:44
<a id="property-defaulttimeoutms-1"></a> defaultTimeoutMs?numberSharedOSExecutorOptions.defaultTimeoutMspackages/runtime/src/executor.ts:45

Type Aliases

AgentTurnDecision

AgentTurnDecision = { call: ToolCall; type: "tool_call"; } | { metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: ProtocolError; type: "fail"; }

Defined in: packages/runtime/src/standard-runtime.ts:27


AgentTurnInput

AgentTurnInput = { type: "start"; } | { result: ToolResult; type: "tool_result"; }

Defined in: packages/runtime/src/standard-runtime.ts:24


AgentTurnRequest

AgentTurnRequest = RuntimeTurnRequest

Defined in: packages/runtime/src/standard-runtime.ts:36

Backwards-compatible name for the request visible to a standard driver.


AgentVisibleContext

AgentVisibleContext = RuntimeVisibleContext

Defined in: packages/runtime/src/standard-runtime.ts:33

Backwards-compatible name for the context visible to a standard driver.


RuntimeTurnRequest

RuntimeTurnRequest = Omit<ExecutionRequest, "context"> > & object

Defined in: packages/runtime/src/runtime-plugin.ts:27

A runtime sees task input and the effective tool catalog, but never grants, issuing authority, or namespace-management state.

Type Declaration

context

readonly context: RuntimeVisibleContext


TurnKernel

TurnKernel = Pick<SharedOSKernel, "admitTurn" | "listTools" | "invokeTool">>

Defined in: packages/runtime/src/executor.ts:67

The minimal deny-by-default kernel surface required by a turn executor.

Hosts normally pass a SharedOSKernel. Keeping this port explicit also permits narrow test doubles without granting a runtime direct access to registries, namespace settings, or other host policy state.

Variables

STANDARD_RUNTIME_MANIFEST

const STANDARD_RUNTIME_MANIFEST: RuntimeManifest

Defined in: packages/runtime/src/standard-runtime.ts:55


STANDARD_RUNTIME_VERSION

const STANDARD_RUNTIME_VERSION: "0.1.0-alpha.0" = "0.1.0-alpha.0"

Defined in: packages/runtime/src/standard-runtime.ts:53

Kept equal to the synchronized package version by the release gate.