@mono-agent/agent-runtime 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -16
- package/package.json +14 -7
- package/src/agent/approval.js +52 -17
- package/src/agent/sandbox-seam.js +1 -0
- package/src/agent/tools/pi-bridge.js +15 -42
- package/src/agent/tools/shared/ripgrep.js +12 -8
- package/src/ai/file-change-stats.js +0 -21
- package/src/ai/index.js +8 -0
- package/src/ai/providers/claude-cli.js +109 -5
- package/src/ai/providers/claude-sandbox.js +71 -0
- package/src/ai/providers/claude-sdk-discovery-worker.js +53 -0
- package/src/ai/providers/claude-sdk-discovery.js +352 -0
- package/src/ai/providers/claude-sdk.js +315 -163
- package/src/ai/providers/codex-app.js +823 -78
- package/src/ai/providers/opencode-app.js +682 -96
- package/src/ai/providers/opencode-server.js +508 -0
- package/src/ai/providers/pi-native/stream-subscriber.js +9 -0
- package/src/ai/runtime/capabilities.js +12 -0
- package/src/ai/runtime/context-windows.js +8 -0
- package/src/ai/runtime/registry.js +8 -2
- package/src/ai/runtime/router.js +627 -29
- package/src/ai/streaming/codex-events.js +7 -15
- package/src/ai/types.js +29 -2
- package/src/index.js +6 -0
- package/src/runtime.js +17 -1
- package/types/agent/approval.d.ts +4 -7
- package/types/agent/sandbox-seam.d.ts +5 -0
- package/types/ai/backend.d.ts +16 -0
- package/types/ai/file-change-stats.d.ts +0 -24
- package/types/ai/index.d.ts +1 -0
- package/types/ai/providers/claude-cli.d.ts +116 -0
- package/types/ai/providers/claude-sandbox.d.ts +79 -0
- package/types/ai/providers/claude-sdk-discovery-worker.d.ts +1 -0
- package/types/ai/providers/claude-sdk-discovery.d.ts +97 -0
- package/types/ai/providers/claude-sdk.d.ts +81 -5
- package/types/ai/providers/codex-app.d.ts +11 -7
- package/types/ai/providers/opencode-app.d.ts +15 -16
- package/types/ai/providers/opencode-server.d.ts +20 -0
- package/types/ai/runtime/capabilities.d.ts +19 -0
- package/types/ai/runtime/context-windows.d.ts +1 -0
- package/types/ai/runtime/router.d.ts +24 -23
- package/types/ai/streaming/codex-events.d.ts +15 -6
- package/types/ai/types.d.ts +75 -2
- package/types/index.d.ts +1 -0
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {{command?: string, args?: string[], cwd?: any, env?: any, onNotification?: (msg: any) => void}} [options]
|
|
2
|
+
* @param {{command?: string, args?: string[], cwd?: any, env?: any, redactionValues?: string[], onNotification?: (msg: any) => void, onServerRequest?: (msg: any) => Promise<any> | any, shutdownGraceMs?: number, killGraceMs?: number}} [options]
|
|
3
3
|
*/
|
|
4
|
-
export function createCodexAppServerClient({ command, args, cwd, env, onNotification, }?: {
|
|
4
|
+
export function createCodexAppServerClient({ command, args, cwd, env, redactionValues, onNotification, onServerRequest, shutdownGraceMs, killGraceMs, }?: {
|
|
5
5
|
command?: string;
|
|
6
6
|
args?: string[];
|
|
7
7
|
cwd?: any;
|
|
8
8
|
env?: any;
|
|
9
|
+
redactionValues?: string[];
|
|
9
10
|
onNotification?: (msg: any) => void;
|
|
11
|
+
onServerRequest?: (msg: any) => Promise<any> | any;
|
|
12
|
+
shutdownGraceMs?: number;
|
|
13
|
+
killGraceMs?: number;
|
|
10
14
|
}): {
|
|
11
15
|
request: (method: any, params: any, { timeoutMs }?: {
|
|
12
16
|
timeoutMs?: number;
|
|
13
17
|
}) => Promise<any>;
|
|
14
|
-
close: () => void
|
|
18
|
+
close: () => Promise<void>;
|
|
15
19
|
child: import("child_process").ChildProcessWithoutNullStreams;
|
|
16
20
|
closed: Promise<any>;
|
|
17
21
|
};
|
|
@@ -64,7 +68,7 @@ export function generateCodexAppResponse(systemPrompt: any, options?: {}): Promi
|
|
|
64
68
|
providerSessionId: any;
|
|
65
69
|
provider_session_id: any;
|
|
66
70
|
cancelled: boolean;
|
|
67
|
-
error:
|
|
71
|
+
error: string;
|
|
68
72
|
failureKind: string;
|
|
69
73
|
diagnostics: {
|
|
70
74
|
had_partial_progress?: boolean;
|
|
@@ -94,16 +98,16 @@ export function generateCodexAppResponse(systemPrompt: any, options?: {}): Promi
|
|
|
94
98
|
providerSessionId: any;
|
|
95
99
|
provider_session_id: any;
|
|
96
100
|
cancelled: boolean;
|
|
97
|
-
error:
|
|
101
|
+
error: string;
|
|
98
102
|
failureKind: string;
|
|
99
103
|
diagnostics: {
|
|
100
104
|
had_partial_progress?: boolean;
|
|
101
105
|
codex_error_code?: undefined;
|
|
102
106
|
} | {
|
|
103
107
|
had_partial_progress?: boolean;
|
|
104
|
-
stderr_tail?:
|
|
108
|
+
stderr_tail?: string;
|
|
105
109
|
codex_error_code: string;
|
|
106
|
-
codex_request_method:
|
|
110
|
+
codex_request_method: string;
|
|
107
111
|
codex_request_timeout_ms: any;
|
|
108
112
|
} | {
|
|
109
113
|
had_partial_progress?: boolean;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Extract only SDK-declared human-readable fields. In particular, never
|
|
3
|
+
* stringify API error objects: `responseBody`, response headers, and metadata
|
|
4
|
+
* can contain provider credentials or echoed request secrets.
|
|
5
|
+
*/
|
|
6
|
+
export function safeOpenCodeErrorMessage(error: any, fallback?: string): any;
|
|
7
|
+
export function mapErrorFailureKind(error: any): "usage_limit" | "provider_unavailable" | "provider_auth" | "cancelled";
|
|
3
8
|
export function mapSpawnFailureKind(err: any): "spawn" | "provider_unavailable";
|
|
4
9
|
export namespace opencodeAppRuntimeBridge {
|
|
5
10
|
export let id: string;
|
|
@@ -24,17 +29,11 @@ declare namespace OPENCODE_APP_CAPABILITIES {
|
|
|
24
29
|
export let supports_fast_mode: boolean;
|
|
25
30
|
}
|
|
26
31
|
declare function generateOpencodeAppResponse(systemPrompt: any, options?: {}): Promise<{
|
|
27
|
-
text:
|
|
32
|
+
text: any;
|
|
28
33
|
structuredResult: any;
|
|
29
34
|
structuredResultSource: any;
|
|
30
35
|
events: any[];
|
|
31
|
-
usage: {
|
|
32
|
-
cost_usd: any;
|
|
33
|
-
input_tokens?: any;
|
|
34
|
-
output_tokens?: any;
|
|
35
|
-
cache_read_tokens?: any;
|
|
36
|
-
cache_creation_tokens?: any;
|
|
37
|
-
};
|
|
36
|
+
usage: {};
|
|
38
37
|
durationMs: number;
|
|
39
38
|
numTurns: number;
|
|
40
39
|
model: any;
|
|
@@ -45,7 +44,9 @@ declare function generateOpencodeAppResponse(systemPrompt: any, options?: {}): P
|
|
|
45
44
|
cancelled: boolean;
|
|
46
45
|
error: any;
|
|
47
46
|
failureKind: string;
|
|
48
|
-
diagnostics: {
|
|
47
|
+
diagnostics: {
|
|
48
|
+
opencode_error_code: any;
|
|
49
|
+
};
|
|
49
50
|
capabilitiesUsed: {
|
|
50
51
|
prompt_cache_active: any;
|
|
51
52
|
thinking_enabled: any;
|
|
@@ -63,10 +64,6 @@ declare function generateOpencodeAppResponse(systemPrompt: any, options?: {}): P
|
|
|
63
64
|
events: any[];
|
|
64
65
|
usage: {
|
|
65
66
|
cost_usd: number;
|
|
66
|
-
input_tokens: any;
|
|
67
|
-
output_tokens: any;
|
|
68
|
-
cache_read_tokens: any;
|
|
69
|
-
cache_creation_tokens: any;
|
|
70
67
|
};
|
|
71
68
|
durationMs: number;
|
|
72
69
|
numTurns: number;
|
|
@@ -77,8 +74,10 @@ declare function generateOpencodeAppResponse(systemPrompt: any, options?: {}): P
|
|
|
77
74
|
provider_session_id: any;
|
|
78
75
|
cancelled: boolean;
|
|
79
76
|
error: any;
|
|
80
|
-
failureKind:
|
|
77
|
+
failureKind: any;
|
|
81
78
|
diagnostics: {
|
|
79
|
+
opencode_permission_id?: any;
|
|
80
|
+
opencode_error_code?: any;
|
|
82
81
|
had_partial_progress?: boolean;
|
|
83
82
|
};
|
|
84
83
|
capabilitiesUsed: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start one OpenCode server with mono-agent-owned process state.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode stores sessions and project-wide permission approvals in SQLite. A
|
|
5
|
+
* unique per-run DB prevents pre-existing user approvals and other conversations
|
|
6
|
+
* from entering this tool environment. The normal OpenCode data home remains
|
|
7
|
+
* mounted so auth refresh rotation persists; global/repo config, external
|
|
8
|
+
* plugins, and external skills are disabled below. State is deleted after close.
|
|
9
|
+
*/
|
|
10
|
+
export function createIsolatedOpencode(options?: {}): Promise<{
|
|
11
|
+
client: import("@opencode-ai/sdk/v2").OpencodeClient;
|
|
12
|
+
server: {
|
|
13
|
+
url: any;
|
|
14
|
+
close: () => any;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
/** Internal test cleanup for any server state left by an interrupted test/process. */
|
|
18
|
+
export function disposeIsolatedOpenCodeState(): Promise<void>;
|
|
19
|
+
/** Cached security preflight for the CLI features/event contract this bridge requires. */
|
|
20
|
+
export function verifyOpenCodeVersion(): any;
|
|
@@ -9,6 +9,7 @@ export namespace COMMON_CAPABILITIES {
|
|
|
9
9
|
let supports_builtin_tools: boolean;
|
|
10
10
|
let supports_live_input: boolean;
|
|
11
11
|
let supports_native_subagents: boolean;
|
|
12
|
+
let supports_fast_mode: boolean;
|
|
12
13
|
}
|
|
13
14
|
export namespace RUNTIME_CAPABILITIES {
|
|
14
15
|
namespace claude {
|
|
@@ -27,7 +28,25 @@ export namespace RUNTIME_CAPABILITIES {
|
|
|
27
28
|
namespace codex {
|
|
28
29
|
let supports_session_resume_3: boolean;
|
|
29
30
|
export { supports_session_resume_3 as supports_session_resume };
|
|
31
|
+
let supports_fast_mode_1: boolean;
|
|
32
|
+
export { supports_fast_mode_1 as supports_fast_mode };
|
|
30
33
|
let runtime_2: string;
|
|
31
34
|
export { runtime_2 as runtime };
|
|
32
35
|
}
|
|
36
|
+
namespace opencode {
|
|
37
|
+
let structured_output_1: boolean;
|
|
38
|
+
export { structured_output_1 as structured_output };
|
|
39
|
+
let supports_session_resume_4: boolean;
|
|
40
|
+
export { supports_session_resume_4 as supports_session_resume };
|
|
41
|
+
let supports_mcp_1: boolean;
|
|
42
|
+
export { supports_mcp_1 as supports_mcp };
|
|
43
|
+
let supports_skills_1: boolean;
|
|
44
|
+
export { supports_skills_1 as supports_skills };
|
|
45
|
+
let supports_live_input_1: boolean;
|
|
46
|
+
export { supports_live_input_1 as supports_live_input };
|
|
47
|
+
let supports_native_subagents_2: boolean;
|
|
48
|
+
export { supports_native_subagents_2 as supports_native_subagents };
|
|
49
|
+
let runtime_3: string;
|
|
50
|
+
export { runtime_3 as runtime };
|
|
51
|
+
}
|
|
33
52
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export function normalizeContextWindow(value: any): "default" | "1m";
|
|
2
2
|
export function stripContextWindowSuffix(model: any): string;
|
|
3
|
+
export function hasExplicitOneMillionContextWindow(model: any): boolean;
|
|
3
4
|
export function claudeModelSupportsOneMillionContext(model: any): boolean;
|
|
4
5
|
export function claudeModelSupportsContextWindow(model: any, contextWindow: any): boolean;
|
|
5
6
|
export function modelWithContextWindow(model: any, contextWindow: any): string;
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('../types.js').RuntimeModelRef} RuntimeModelRef
|
|
3
|
-
* @typedef {import('../types.js').AgentRuntimeHostOptions} AgentRuntimeHostOptions
|
|
4
|
-
* @typedef {import('../types.js').AgentRuntimeInstance} AgentRuntimeInstance
|
|
5
|
-
* @typedef {import('../types.js').RuntimeRunOptions} RuntimeRunOptions
|
|
6
|
-
* @typedef {import('../types.js').RuntimeResult} RuntimeResult
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {Object} RouterChainEntryInput
|
|
10
|
-
* A chain entry as accepted by createRouterRuntime: either the shorthand bare
|
|
11
|
-
* RuntimeModelRef, or the full `{model, executionMode?, requires?}` form.
|
|
12
|
-
* @property {RuntimeModelRef} model
|
|
13
|
-
* @property {string} [executionMode]
|
|
14
|
-
* @property {Object<string, *>} [requires]
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Object} RouterChainEntry
|
|
18
|
-
* @property {RuntimeModelRef} model
|
|
19
|
-
* @property {string|null} executionMode
|
|
20
|
-
* @property {Object<string, *>|null} requires
|
|
21
|
-
*/
|
|
22
1
|
/**
|
|
23
2
|
* @param {Object} [options]
|
|
24
3
|
* @param {AgentRuntimeHostOptions} [options.host]
|
|
25
4
|
* @param {ReadonlyArray<RuntimeModelRef|RouterChainEntryInput>} [options.chain]
|
|
5
|
+
* @param {"uniform"|"per-route-native"} [options.routeSafety]
|
|
6
|
+
* @param {(input: {model: RuntimeModelRef, executionMode: string|null, attemptIndex: number, routeSafety: "uniform"|"per-route-native"}) => (RouterAttemptResolution|Promise<RouterAttemptResolution>)} [options.resolveAttempt]
|
|
26
7
|
* @returns {AgentRuntimeInstance & {chain: () => Array<RouterChainEntry>}}
|
|
27
8
|
*/
|
|
28
|
-
export function createRouterRuntime({ host, chain }?: {
|
|
9
|
+
export function createRouterRuntime({ host, chain, routeSafety, resolveAttempt }?: {
|
|
29
10
|
host?: AgentRuntimeHostOptions;
|
|
30
11
|
chain?: ReadonlyArray<RuntimeModelRef | RouterChainEntryInput>;
|
|
12
|
+
routeSafety?: "uniform" | "per-route-native";
|
|
13
|
+
resolveAttempt?: (input: {
|
|
14
|
+
model: RuntimeModelRef;
|
|
15
|
+
executionMode: string | null;
|
|
16
|
+
attemptIndex: number;
|
|
17
|
+
routeSafety: "uniform" | "per-route-native";
|
|
18
|
+
}) => (RouterAttemptResolution | Promise<RouterAttemptResolution>);
|
|
31
19
|
}): AgentRuntimeInstance & {
|
|
32
20
|
chain: () => Array<RouterChainEntry>;
|
|
33
21
|
};
|
|
@@ -38,11 +26,12 @@ export type RuntimeRunOptions = import("../types.js").RuntimeRunOptions;
|
|
|
38
26
|
export type RuntimeResult = import("../types.js").RuntimeResult;
|
|
39
27
|
/**
|
|
40
28
|
* A chain entry as accepted by createRouterRuntime: either the shorthand bare
|
|
41
|
-
* RuntimeModelRef, or the full `{model, executionMode?, requires?}` form.
|
|
29
|
+
* RuntimeModelRef, or the full `{model, executionMode?, effort?, requires?}` form.
|
|
42
30
|
*/
|
|
43
31
|
export type RouterChainEntryInput = {
|
|
44
32
|
model: RuntimeModelRef;
|
|
45
33
|
executionMode?: string;
|
|
34
|
+
effort?: string | null;
|
|
46
35
|
requires?: {
|
|
47
36
|
[x: string]: any;
|
|
48
37
|
};
|
|
@@ -50,7 +39,19 @@ export type RouterChainEntryInput = {
|
|
|
50
39
|
export type RouterChainEntry = {
|
|
51
40
|
model: RuntimeModelRef;
|
|
52
41
|
executionMode: string | null;
|
|
42
|
+
effort: string | null | undefined;
|
|
53
43
|
requires: {
|
|
54
44
|
[x: string]: any;
|
|
55
45
|
} | null;
|
|
56
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Private host seam for route-specific provider options/runtime ownership.
|
|
49
|
+
* Returned options are never copied into router telemetry.
|
|
50
|
+
*/
|
|
51
|
+
export type RouterAttemptResolution = {
|
|
52
|
+
runtime?: AgentRuntimeInstance;
|
|
53
|
+
options?: {
|
|
54
|
+
[x: string]: any;
|
|
55
|
+
};
|
|
56
|
+
cleanup?: () => (void | Promise<void>);
|
|
57
|
+
};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export function normalizeCodexItemType(type: any): any;
|
|
2
2
|
export function normalizeCodexItemEvent(raw: any, context?: {}): {
|
|
3
|
+
is_error: boolean;
|
|
4
|
+
error?: any;
|
|
5
|
+
summary?: any;
|
|
6
|
+
type: string;
|
|
7
|
+
id: any;
|
|
8
|
+
status: any;
|
|
9
|
+
changes: any;
|
|
10
|
+
message?: undefined;
|
|
11
|
+
} | {
|
|
3
12
|
type: string;
|
|
4
13
|
message: {
|
|
5
14
|
content: {
|
|
6
15
|
type: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
id: any;
|
|
17
|
+
name: any;
|
|
18
|
+
input: any;
|
|
10
19
|
}[];
|
|
11
20
|
};
|
|
12
21
|
} | {
|
|
@@ -14,9 +23,9 @@ export function normalizeCodexItemEvent(raw: any, context?: {}): {
|
|
|
14
23
|
message: {
|
|
15
24
|
content: {
|
|
16
25
|
type: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
tool_use_id: any;
|
|
27
|
+
content: any;
|
|
28
|
+
is_error: boolean;
|
|
20
29
|
}[];
|
|
21
30
|
};
|
|
22
31
|
} | {
|
package/types/ai/types.d.ts
CHANGED
|
@@ -25,6 +25,23 @@
|
|
|
25
25
|
* every event kind (tool_approval_pending, provider_failover_started,
|
|
26
26
|
* context_compaction_applied, ...) adds its own extra fields.
|
|
27
27
|
*/
|
|
28
|
+
/** @typedef {"uniform"|"per-route-native"} RuntimeRouteSafetyMode */
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {"mono-agent-monotonic"|"disabled"|"mono-agent-srt"|"mono-agent-srt-unsafe-host-fallback"|"provider-native"|"codex-native"|"unsupported"} RuntimeRouteSandboxContract
|
|
31
|
+
* Fixed telemetry vocabulary for a route's sandbox posture. The
|
|
32
|
+
* `mono-agent-srt-unsafe-host-fallback` describes a policy that prefers SRT but
|
|
33
|
+
* explicitly permits host execution if unavailable; it does not claim which
|
|
34
|
+
* branch ran for a particular command.
|
|
35
|
+
*/
|
|
36
|
+
/** @typedef {"mono-agent-monotonic"|"mono-agent-policy"|"provider-representable"|"exact-allow-all"|"unsupported"} RuntimeRouteToolsContract */
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {Object} RuntimeRouteSafetyContract
|
|
39
|
+
* Bounded, credential-free description of the sandbox/tool contract applied
|
|
40
|
+
* to one fallback route.
|
|
41
|
+
* @property {RuntimeRouteSafetyMode} mode
|
|
42
|
+
* @property {RuntimeRouteSandboxContract} sandbox
|
|
43
|
+
* @property {RuntimeRouteToolsContract} tools
|
|
44
|
+
*/
|
|
28
45
|
/**
|
|
29
46
|
* @typedef {Object} RuntimeObserver
|
|
30
47
|
* Per-call or host-level observer merged by createObserverHub (ai/observer.js).
|
|
@@ -82,6 +99,10 @@
|
|
|
82
99
|
* The options object a host passes to `createRuntime(host).run(systemPrompt, options)`.
|
|
83
100
|
* @property {RuntimeModelRef} model Resolved model reference; see parseRuntimeModelReference.
|
|
84
101
|
* @property {string} [executionMode] "sdk" (default) or "cli"; selects which bridge variant handles the model.
|
|
102
|
+
* @property {string} [sessionId] Host conversation/session key for resumable bridges.
|
|
103
|
+
* @property {string} [providerSessionId] Provider-owned resume id for resumable bridges.
|
|
104
|
+
* @property {boolean} [sessionKeepAlive] Keep resumable provider state alive after the turn.
|
|
105
|
+
* @property {number} [sessionIdleTimeoutMs] Idle TTL for resumable provider state.
|
|
85
106
|
* @property {boolean} [liveInput] Whether this run expects a live/streaming input channel.
|
|
86
107
|
* @property {ReadonlyArray<*>} [observers] Per-call observers (see RuntimeObserver) merged with host-level (createRuntime) observers.
|
|
87
108
|
* @property {(event: RuntimeEvent) => void} [onEvent]
|
|
@@ -90,6 +111,7 @@
|
|
|
90
111
|
* @property {boolean} [fastMode]
|
|
91
112
|
* @property {string} [cwd]
|
|
92
113
|
* @property {Object<string, Object>} [mcpServers]
|
|
114
|
+
* @property {ReadonlyArray<Object>} [skills] Runtime skill metadata for progressive disclosure.
|
|
93
115
|
* @property {ReadonlyArray<string>} [allowedTools]
|
|
94
116
|
* @property {ReadonlyArray<string>} [disallowedTools]
|
|
95
117
|
* @property {string} [permissionMode]
|
|
@@ -146,7 +168,8 @@
|
|
|
146
168
|
* @property {Array<Object>} [runtimeWarnings]
|
|
147
169
|
* @property {Object} [diagnostics]
|
|
148
170
|
* @property {Object} [capabilitiesUsed]
|
|
149
|
-
* @property {Array<{model: RuntimeModelRef, failureKind: (string|null), requestId?: (string|null), retryableSubkind?: (string|null), requirements?: Object}>} [failoverHistory] Set by createRouterRuntime (ai/runtime/router.js) on every attempt
|
|
171
|
+
* @property {Array<{model: RuntimeModelRef, failureKind: (string|null), requestId?: (string|null), retryableSubkind?: (string|null), requirements?: Object, routeSafety?: RuntimeRouteSafetyMode, safetyContract?: RuntimeRouteSafetyContract}>} [failoverHistory] Set by createRouterRuntime (ai/runtime/router.js) on every failed/skipped attempt.
|
|
172
|
+
* @property {Array<{attemptIndex: number, model: RuntimeModelRef, routeSafety: RuntimeRouteSafetyMode, safetyContract: RuntimeRouteSafetyContract, status: string}>} [routeSafetyHistory] Bounded route-safety audit emitted by createRouterRuntime.
|
|
150
173
|
*/
|
|
151
174
|
/**
|
|
152
175
|
* @typedef {Object} RuntimeCapabilities
|
|
@@ -304,6 +327,24 @@ export type RuntimeEvent = {
|
|
|
304
327
|
type: string;
|
|
305
328
|
[key: string]: any;
|
|
306
329
|
};
|
|
330
|
+
export type RuntimeRouteSafetyMode = "uniform" | "per-route-native";
|
|
331
|
+
/**
|
|
332
|
+
* Fixed telemetry vocabulary for a route's sandbox posture. The
|
|
333
|
+
* `mono-agent-srt-unsafe-host-fallback` describes a policy that prefers SRT but
|
|
334
|
+
* explicitly permits host execution if unavailable; it does not claim which
|
|
335
|
+
* branch ran for a particular command.
|
|
336
|
+
*/
|
|
337
|
+
export type RuntimeRouteSandboxContract = "mono-agent-monotonic" | "disabled" | "mono-agent-srt" | "mono-agent-srt-unsafe-host-fallback" | "provider-native" | "codex-native" | "unsupported";
|
|
338
|
+
export type RuntimeRouteToolsContract = "mono-agent-monotonic" | "mono-agent-policy" | "provider-representable" | "exact-allow-all" | "unsupported";
|
|
339
|
+
/**
|
|
340
|
+
* Bounded, credential-free description of the sandbox/tool contract applied
|
|
341
|
+
* to one fallback route.
|
|
342
|
+
*/
|
|
343
|
+
export type RuntimeRouteSafetyContract = {
|
|
344
|
+
mode: RuntimeRouteSafetyMode;
|
|
345
|
+
sandbox: RuntimeRouteSandboxContract;
|
|
346
|
+
tools: RuntimeRouteToolsContract;
|
|
347
|
+
};
|
|
307
348
|
/**
|
|
308
349
|
* Per-call or host-level observer merged by createObserverHub (ai/observer.js).
|
|
309
350
|
* Loose on purpose: observer.js is not a kernel seam file.
|
|
@@ -426,6 +467,22 @@ export type RuntimeRunOptions = {
|
|
|
426
467
|
* "sdk" (default) or "cli"; selects which bridge variant handles the model.
|
|
427
468
|
*/
|
|
428
469
|
executionMode?: string;
|
|
470
|
+
/**
|
|
471
|
+
* Host conversation/session key for resumable bridges.
|
|
472
|
+
*/
|
|
473
|
+
sessionId?: string;
|
|
474
|
+
/**
|
|
475
|
+
* Provider-owned resume id for resumable bridges.
|
|
476
|
+
*/
|
|
477
|
+
providerSessionId?: string;
|
|
478
|
+
/**
|
|
479
|
+
* Keep resumable provider state alive after the turn.
|
|
480
|
+
*/
|
|
481
|
+
sessionKeepAlive?: boolean;
|
|
482
|
+
/**
|
|
483
|
+
* Idle TTL for resumable provider state.
|
|
484
|
+
*/
|
|
485
|
+
sessionIdleTimeoutMs?: number;
|
|
429
486
|
/**
|
|
430
487
|
* Whether this run expects a live/streaming input channel.
|
|
431
488
|
*/
|
|
@@ -442,6 +499,10 @@ export type RuntimeRunOptions = {
|
|
|
442
499
|
mcpServers?: {
|
|
443
500
|
[x: string]: any;
|
|
444
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Runtime skill metadata for progressive disclosure.
|
|
504
|
+
*/
|
|
505
|
+
skills?: ReadonlyArray<any>;
|
|
445
506
|
allowedTools?: ReadonlyArray<string>;
|
|
446
507
|
disallowedTools?: ReadonlyArray<string>;
|
|
447
508
|
permissionMode?: string;
|
|
@@ -535,7 +596,7 @@ export type RuntimeResult = {
|
|
|
535
596
|
diagnostics?: any;
|
|
536
597
|
capabilitiesUsed?: any;
|
|
537
598
|
/**
|
|
538
|
-
* Set by createRouterRuntime (ai/runtime/router.js) on every attempt
|
|
599
|
+
* Set by createRouterRuntime (ai/runtime/router.js) on every failed/skipped attempt.
|
|
539
600
|
*/
|
|
540
601
|
failoverHistory?: Array<{
|
|
541
602
|
model: RuntimeModelRef;
|
|
@@ -543,6 +604,18 @@ export type RuntimeResult = {
|
|
|
543
604
|
requestId?: (string | null);
|
|
544
605
|
retryableSubkind?: (string | null);
|
|
545
606
|
requirements?: any;
|
|
607
|
+
routeSafety?: RuntimeRouteSafetyMode;
|
|
608
|
+
safetyContract?: RuntimeRouteSafetyContract;
|
|
609
|
+
}>;
|
|
610
|
+
/**
|
|
611
|
+
* Bounded route-safety audit emitted by createRouterRuntime.
|
|
612
|
+
*/
|
|
613
|
+
routeSafetyHistory?: Array<{
|
|
614
|
+
attemptIndex: number;
|
|
615
|
+
model: RuntimeModelRef;
|
|
616
|
+
routeSafety: RuntimeRouteSafetyMode;
|
|
617
|
+
safetyContract: RuntimeRouteSafetyContract;
|
|
618
|
+
status: string;
|
|
546
619
|
}>;
|
|
547
620
|
};
|
|
548
621
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export * from "./ai/index.js";
|
|
|
5
5
|
export * from "./agent/index.js";
|
|
6
6
|
export { configureToolRuntime, readToolRuntime, readRuntimeBrand, resetToolRuntime } from "./agent/tools/shared/runtime-context.js";
|
|
7
7
|
export { DEFAULT_RUNTIME_BRAND, resolveRuntimeBrand } from "./runtime-brand.js";
|
|
8
|
+
export { CLAUDE_SDK_CATALOG_VERSION, discoverClaudeSdkModels, normalizeClaudeSdkCatalog, normalizeClaudeSdkModelId } from "./ai/providers/claude-sdk-discovery.js";
|