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:
SharedOSExecutorvalidates and admits a turn, exposes only authorized tools, rechecks every exact call, applies cancellation, and records runtime provenance. Runtime plugins cannot replace this layer.RuntimePluginowns the agent loop inside that envelope.StandardRuntimeis the included reference implementation overAgentTurnDriver.
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 wrappedruntime.eventevents.
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
| Parameter | Type |
|---|---|
runtimeId | string |
Returns
Overrides
Error.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
<a id="property-cause"></a> cause? | public | unknown | - | Error.cause | node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26 |
<a id="property-message"></a> message | public | string | - | Error.message | node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077 |
<a id="property-name"></a> name | public | string | - | Error.name | node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
<a id="property-stack"></a> stack? | public | string | - | Error.stack | node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078 |
<a id="property-stacktracelimit"></a> stackTraceLimit | static | number | The 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.stackTraceLimit | node_modules/.pnpm/@types+node@22.20.1/node_modules/@types/node/globals.d.ts:68 |
Methods
captureStackTrace()
staticcaptureStackTrace(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
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
staticprepareStackTrace(err,stackTraces):any
Defined in: node_modules/.pnpm/@types+node@22.20.1/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
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
| Parameter | Type | Default value |
|---|---|---|
runtimes | readonly RuntimePlugin[] | [] |
Returns
Methods
has()
has(
runtimeId):boolean
Defined in: packages/runtime/src/runtime-plugin.ts:107
Parameters
| Parameter | Type |
|---|---|
runtimeId | string |
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
| Parameter | Type |
|---|---|
runtime | RuntimePlugin |
Returns
void
resolve()
resolve(
runtimeId):RuntimePlugin
Defined in: packages/runtime/src/runtime-plugin.ts:111
Parameters
| Parameter | Type |
|---|---|
runtimeId | string |
Returns
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
| Parameter | Type |
|---|---|
kernel | TurnKernel |
runtime | RuntimePlugin |
options | SharedOSExecutorOptions |
Returns
Accessors
runtimeManifest
Get Signature
get runtimeManifest():
object
Defined in: packages/runtime/src/executor.ts:124
Returns
object
id
id:
string
metadata?
optionalmetadata?: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
| Parameter | Type |
|---|---|
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"; }>
Implementation of
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
| Parameter | Type |
|---|---|
driver | AgentTurnDriver |
options | StandardRuntimeOptions |
Returns
Properties
| Property | Modifier | Type | Default value | Defined in |
|---|---|---|---|---|
<a id="property-manifest"></a> manifest | readonly | object | STANDARD_RUNTIME_MANIFEST | packages/runtime/src/standard-runtime.ts:67 |
manifest.id | public | string | undefined | packages/contracts/dist/runtime.d.ts:9 |
manifest.metadata? | public | JsonObject | undefined | packages/contracts/dist/runtime.d.ts:12 |
manifest.protocolVersion | public | "1" | undefined | packages/contracts/dist/runtime.d.ts:11 |
manifest.version | public | string | undefined | packages/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
| Parameter | Type |
|---|---|
request | RuntimeTurnRequest |
host | RuntimeHost |
signal | AbortSignal |
Returns
Promise<{ metadata?: JsonObject; output: JsonValue; type: "complete"; } | { error: { code: string; details?: JsonObject; message: string; retryable?: boolean; }; metadata?: JsonObject; type: "fail"; }>
Implementation of
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
| Parameter | Type |
|---|---|
kernel | TurnKernel |
driver | AgentTurnDriver |
options | TurnExecutorOptions |
Returns
Accessors
runtimeManifest
Get Signature
get runtimeManifest():
object
Defined in: packages/runtime/src/executor.ts:359
Returns
object
id
id:
string
metadata?
optionalmetadata?: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
| Parameter | Type |
|---|---|
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"; }>
Implementation of
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
| Parameter | Type |
|---|---|
request | RuntimeTurnRequest |
signal | AbortSignal |
Returns
Promise<AgentTurnSession>
AgentTurnSession
Defined in: packages/runtime/src/standard-runtime.ts:38
Methods
close()?
optionalclose(outcome,signal):void|Promise<void>>
Defined in: packages/runtime/src/standard-runtime.ts:40
Parameters
| Parameter | Type |
|---|---|
outcome | "succeeded" | "denied" | "failed" | "cancelled" |
signal | AbortSignal |
Returns
void | Promise<void>
next()
next(
input,signal):Promise<AgentTurnDecision>>
Defined in: packages/runtime/src/standard-runtime.ts:39
Parameters
| Parameter | Type |
|---|---|
input | AgentTurnInput |
signal | AbortSignal |
Returns
Promise<AgentTurnDecision>
ExecuteTurnOptions
Defined in: packages/runtime/src/executor.ts:48
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
<a id="property-onevent"></a> onEvent? | (event) => void | Synchronous 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
| Property | Modifier | Type | Defined in |
|---|---|---|---|
<a id="property-limits"></a> limits | readonly | RuntimeLimits | packages/runtime/src/runtime-plugin.ts:47 |
Methods
emit()
emit(
event):void
Defined in: packages/runtime/src/runtime-plugin.ts:49
Parameters
| Parameter | Type |
|---|---|
event | { data: JsonValue; type: string; } |
event.data | JsonValue |
event.type | string |
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
| Parameter | Type |
|---|---|
call | { arguments: JsonObject; id: string; requestedAt: string; tool: string; traceId: string; } |
call.arguments | JsonObject |
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
| Property | Modifier | Type | Defined in |
|---|---|---|---|
<a id="property-maxsteps"></a> maxSteps | readonly | number | packages/runtime/src/runtime-plugin.ts:32 |
<a id="property-maxtoolcalls"></a> maxToolCalls | readonly | number | packages/runtime/src/runtime-plugin.ts:33 |
<a id="property-timeoutms"></a> timeoutMs | readonly | number | packages/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
| Property | Modifier | Type | Defined in |
|---|---|---|---|
<a id="property-manifest-1"></a> manifest | readonly | object | packages/runtime/src/runtime-plugin.ts:58 |
manifest.id | public | string | packages/contracts/dist/runtime.d.ts:9 |
manifest.metadata? | public | JsonObject | packages/contracts/dist/runtime.d.ts:12 |
manifest.protocolVersion | public | "1" | packages/contracts/dist/runtime.d.ts:11 |
manifest.version | public | string | packages/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
| Parameter | Type |
|---|---|
request | RuntimeTurnRequest |
host | RuntimeHost |
signal | AbortSignal |
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
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
<a id="property-step"></a> step? | readonly | number | Optional 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
| Property | Modifier | Type | Defined in |
|---|---|---|---|
<a id="property-actor"></a> actor | readonly | { 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> namespaceId | readonly | string | packages/runtime/src/runtime-plugin.ts:17 |
<a id="property-now"></a> now | readonly | string | packages/runtime/src/runtime-plugin.ts:20 |
<a id="property-owner"></a> owner | readonly | { 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> purpose | readonly | string | packages/runtime/src/runtime-plugin.ts:18 |
<a id="property-traceid"></a> traceId | readonly | string | packages/runtime/src/runtime-plugin.ts:19 |
SharedOSExecutorOptions
Defined in: packages/runtime/src/executor.ts:40
Extended by
Properties
| Property | Type | Defined in |
|---|---|---|
<a id="property-clock"></a> clock? | () => string | packages/runtime/src/executor.ts:41 |
<a id="property-createid"></a> createId? | () => string | packages/runtime/src/executor.ts:42 |
<a id="property-defaultmaxsteps"></a> defaultMaxSteps? | number | packages/runtime/src/executor.ts:43 |
<a id="property-defaultmaxtoolcalls"></a> defaultMaxToolCalls? | number | packages/runtime/src/executor.ts:44 |
<a id="property-defaulttimeoutms"></a> defaultTimeoutMs? | number | packages/runtime/src/executor.ts:45 |
StandardRuntimeOptions
Defined in: packages/runtime/src/standard-runtime.ts:48
Extended by
Properties
| Property | Type | Defined in |
|---|---|---|
<a id="property-closetimeoutms"></a> closeTimeoutMs? | number | packages/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
| Parameter | Type |
|---|---|
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
| Property | Type | Inherited from | Defined in |
|---|---|---|---|
<a id="property-clock-1"></a> clock? | () => string | SharedOSExecutorOptions.clock | packages/runtime/src/executor.ts:41 |
<a id="property-closetimeoutms-1"></a> closeTimeoutMs? | number | StandardRuntimeOptions.closeTimeoutMs | packages/runtime/src/standard-runtime.ts:49 |
<a id="property-createid-1"></a> createId? | () => string | SharedOSExecutorOptions.createId | packages/runtime/src/executor.ts:42 |
<a id="property-defaultmaxsteps-1"></a> defaultMaxSteps? | number | SharedOSExecutorOptions.defaultMaxSteps | packages/runtime/src/executor.ts:43 |
<a id="property-defaultmaxtoolcalls-1"></a> defaultMaxToolCalls? | number | SharedOSExecutorOptions.defaultMaxToolCalls | packages/runtime/src/executor.ts:44 |
<a id="property-defaulttimeoutms-1"></a> defaultTimeoutMs? | number | SharedOSExecutorOptions.defaultTimeoutMs | packages/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
readonlycontext: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
constSTANDARD_RUNTIME_MANIFEST:RuntimeManifest
Defined in: packages/runtime/src/standard-runtime.ts:55
STANDARD_RUNTIME_VERSION
constSTANDARD_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.