@mono-agent/agent-runtime 0.20.11 → 0.21.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.
Files changed (148) hide show
  1. package/ARCHITECTURE.md +50 -11
  2. package/MIGRATION.md +288 -26
  3. package/README.md +352 -477
  4. package/package.json +13 -44
  5. package/src/agent/tool-bloat.js +145 -9
  6. package/src/agent/tools/agent-tool.js +108 -9
  7. package/src/agent/tools/bash.js +11 -26
  8. package/src/agent/tools/codex-subscription-search.js +123 -29
  9. package/src/agent/tools/exec.js +10 -2
  10. package/src/agent/tools/index.js +7 -0
  11. package/src/agent/tools/monitor.js +149 -0
  12. package/src/agent/tools/pi-bridge.js +123 -19
  13. package/src/agent/tools/shared/bash-environment.js +31 -0
  14. package/src/agent/tools/shared/monitors.js +293 -0
  15. package/src/agent/tools/shared/path-resolver.js +25 -6
  16. package/src/agent/tools/shared/process-jobs.js +6 -1
  17. package/src/agent/tools/shared/process-runner.js +26 -6
  18. package/src/agent/tools/shared/tool-context.js +8 -0
  19. package/src/agent/tools/web-access-interstitial.js +70 -0
  20. package/src/agent/tools/web-browser-render.js +83 -58
  21. package/src/agent/tools/web-controller.js +112 -21
  22. package/src/agent/tools/web-document-extractor.js +379 -0
  23. package/src/agent/tools/web-fetch.js +271 -243
  24. package/src/agent/tools/web-request.js +65 -0
  25. package/src/agent/tools/web-search-output.js +165 -0
  26. package/src/agent/tools/web-search-state.js +75 -0
  27. package/src/agent/tools/web-search.js +532 -71
  28. package/src/ai/cost.js +13 -68
  29. package/src/ai/failure.js +3 -3
  30. package/src/ai/index.js +5 -17
  31. package/src/ai/observer.js +8 -0
  32. package/src/ai/pi-interop.js +221 -1
  33. package/src/ai/pi-oauth-compat.js +1 -1
  34. package/src/ai/provider-check.js +131 -0
  35. package/src/ai/providers/codex/app-server-client.js +592 -0
  36. package/src/ai/providers/pi-models.js +18 -10
  37. package/src/ai/providers/pi-native/compaction-driver.js +94 -42
  38. package/src/ai/providers/pi-native/compaction-summary.js +140 -0
  39. package/src/ai/providers/pi-native/harness-adapter.js +376 -0
  40. package/src/ai/providers/pi-native/prompt-cache-diagnostics.js +103 -0
  41. package/src/ai/providers/pi-native/provider-attribution.js +102 -0
  42. package/src/ai/providers/pi-native/result-builder.js +38 -14
  43. package/src/ai/providers/pi-native/session-lifecycle.js +253 -55
  44. package/src/ai/providers/pi-native/stream-subscriber.js +52 -6
  45. package/src/ai/providers/pi-native/terminal-recovery.js +40 -0
  46. package/src/ai/providers/pi-native/turn-runner.js +279 -28
  47. package/src/ai/providers/pi-native.js +206 -61
  48. package/src/ai/runtime/capabilities.js +11 -56
  49. package/src/ai/runtime/live-input-events.js +250 -54
  50. package/src/ai/runtime/model-refs.js +118 -153
  51. package/src/ai/runtime/registry.js +22 -56
  52. package/src/ai/runtime/router.js +76 -417
  53. package/src/ai/runtime/session-liveness.js +3 -4
  54. package/src/ai/runtime/sessions.js +4 -5
  55. package/src/ai/runtime/tool-policy.js +0 -2
  56. package/src/ai/tool-lifecycle.js +32 -18
  57. package/src/ai/types.js +37 -112
  58. package/src/index.js +0 -6
  59. package/src/runtime.js +29 -16
  60. package/types/agent/tool-bloat.d.ts +1 -1
  61. package/types/agent/tools/agent-tool.d.ts +4 -2
  62. package/types/agent/tools/bash.d.ts +5 -3
  63. package/types/agent/tools/codex-subscription-search.d.ts +7 -3
  64. package/types/agent/tools/exec.d.ts +5 -3
  65. package/types/agent/tools/index.d.ts +1 -0
  66. package/types/agent/tools/monitor.d.ts +47 -0
  67. package/types/agent/tools/pi-bridge.d.ts +7 -4
  68. package/types/agent/tools/shared/bash-environment.d.ts +4 -0
  69. package/types/agent/tools/shared/monitors.d.ts +98 -0
  70. package/types/agent/tools/shared/process-jobs.d.ts +5 -1
  71. package/types/agent/tools/shared/process-runner.d.ts +14 -4
  72. package/types/agent/tools/shared/tool-context.d.ts +2 -0
  73. package/types/agent/tools/web-access-interstitial.d.ts +23 -0
  74. package/types/agent/tools/web-browser-render.d.ts +4 -1
  75. package/types/agent/tools/web-controller.d.ts +4 -2
  76. package/types/agent/tools/web-document-extractor.d.ts +27 -0
  77. package/types/agent/tools/web-fetch.d.ts +19 -24
  78. package/types/agent/tools/web-request.d.ts +20 -0
  79. package/types/agent/tools/web-search-output.d.ts +31 -0
  80. package/types/agent/tools/web-search-state.d.ts +21 -0
  81. package/types/agent/tools/web-search.d.ts +10 -45
  82. package/types/ai/cost.d.ts +1 -2
  83. package/types/ai/index.d.ts +2 -4
  84. package/types/ai/observer.d.ts +6 -0
  85. package/types/ai/pi-interop.d.ts +81 -0
  86. package/types/ai/provider-check.d.ts +53 -0
  87. package/types/ai/providers/codex/app-server-client.d.ts +37 -0
  88. package/types/ai/providers/pi-native/compaction-driver.d.ts +2 -1
  89. package/types/ai/providers/pi-native/compaction-summary.d.ts +19 -0
  90. package/types/ai/providers/pi-native/harness-adapter.d.ts +58 -0
  91. package/types/ai/providers/pi-native/prompt-cache-diagnostics.d.ts +3 -0
  92. package/types/ai/providers/pi-native/provider-attribution.d.ts +26 -0
  93. package/types/ai/providers/pi-native/result-builder.d.ts +14 -4
  94. package/types/ai/providers/pi-native/session-lifecycle.d.ts +25 -6
  95. package/types/ai/providers/pi-native/stream-subscriber.d.ts +2 -2
  96. package/types/ai/providers/pi-native/terminal-recovery.d.ts +2 -0
  97. package/types/ai/providers/pi-native/turn-runner.d.ts +68 -10
  98. package/types/ai/providers/pi-native.d.ts +21 -4
  99. package/types/ai/runtime/capabilities.d.ts +21 -70
  100. package/types/ai/runtime/live-input-events.d.ts +32 -8
  101. package/types/ai/runtime/model-refs.d.ts +0 -24
  102. package/types/ai/runtime/router.d.ts +3 -10
  103. package/types/ai/runtime/tool-policy.d.ts +0 -2
  104. package/types/ai/tool-lifecycle.d.ts +4 -3
  105. package/types/ai/types.d.ts +162 -256
  106. package/types/index.d.ts +0 -1
  107. package/src/ai/providers/acp-client.js +0 -1149
  108. package/src/ai/providers/acp-privacy.js +0 -124
  109. package/src/ai/providers/acp-public.js +0 -21
  110. package/src/ai/providers/acp-session-tokens.js +0 -282
  111. package/src/ai/providers/acp-transport.js +0 -356
  112. package/src/ai/providers/acp.js +0 -543
  113. package/src/ai/providers/claude-cli.js +0 -883
  114. package/src/ai/providers/claude-sandbox.js +0 -71
  115. package/src/ai/providers/claude-sdk-discovery-worker.js +0 -53
  116. package/src/ai/providers/claude-sdk-discovery.js +0 -352
  117. package/src/ai/providers/claude-sdk.js +0 -1127
  118. package/src/ai/providers/claude-subagent-activity.js +0 -719
  119. package/src/ai/providers/claude-subagents.js +0 -88
  120. package/src/ai/providers/codex-app.js +0 -2946
  121. package/src/ai/providers/opencode-app.js +0 -1109
  122. package/src/ai/providers/opencode-discovery.js +0 -39
  123. package/src/ai/providers/opencode-server.js +0 -508
  124. package/src/ai/runtime/context-windows.js +0 -46
  125. package/src/ai/runtime/fast-mode.js +0 -8
  126. package/src/ai/streaming/codex-events.js +0 -146
  127. package/src/ai/streaming/opencode-events.js +0 -59
  128. package/types/ai/providers/acp-client.d.ts +0 -227
  129. package/types/ai/providers/acp-privacy.d.ts +0 -25
  130. package/types/ai/providers/acp-public.d.ts +0 -7
  131. package/types/ai/providers/acp-session-tokens.d.ts +0 -41
  132. package/types/ai/providers/acp-transport.d.ts +0 -45
  133. package/types/ai/providers/acp.d.ts +0 -93
  134. package/types/ai/providers/claude-cli.d.ts +0 -305
  135. package/types/ai/providers/claude-sandbox.d.ts +0 -79
  136. package/types/ai/providers/claude-sdk-discovery-worker.d.ts +0 -1
  137. package/types/ai/providers/claude-sdk-discovery.d.ts +0 -97
  138. package/types/ai/providers/claude-sdk.d.ts +0 -138
  139. package/types/ai/providers/claude-subagent-activity.d.ts +0 -53
  140. package/types/ai/providers/claude-subagents.d.ts +0 -18
  141. package/types/ai/providers/codex-app.d.ts +0 -151
  142. package/types/ai/providers/opencode-app.d.ts +0 -96
  143. package/types/ai/providers/opencode-discovery.d.ts +0 -4
  144. package/types/ai/providers/opencode-server.d.ts +0 -20
  145. package/types/ai/runtime/context-windows.d.ts +0 -9
  146. package/types/ai/runtime/fast-mode.d.ts +0 -2
  147. package/types/ai/streaming/codex-events.d.ts +0 -40
  148. package/types/ai/streaming/opencode-events.d.ts +0 -42
@@ -1,305 +0,0 @@
1
- export function createThinkingBuffer(): {
2
- isStreamShape: (raw: any) => boolean;
3
- onStreamEvent: (raw: any) => void;
4
- rehydrate: (assistantRaw: any) => any;
5
- };
6
- export function normalizeCliEvent(raw: any, context?: {}): any;
7
- export function buildCliCommand({ sdk, model, effort, cwd, schemaPath, outputSchema, systemPrompt, prompt, mcpConfigPath, mcpServers, allowedTools, disallowedTools, permissionMode, maxTurns, skillDirs, resumeSessionId, nativeSubagents, contextWindow, }: {
8
- sdk: any;
9
- model: any;
10
- effort: any;
11
- cwd: any;
12
- schemaPath: any;
13
- outputSchema: any;
14
- systemPrompt: any;
15
- prompt: any;
16
- mcpConfigPath: any;
17
- mcpServers: any;
18
- allowedTools: any;
19
- disallowedTools: any;
20
- permissionMode: any;
21
- maxTurns: any;
22
- skillDirs: any;
23
- resumeSessionId: any;
24
- nativeSubagents: any;
25
- contextWindow: any;
26
- }): {
27
- command: string;
28
- args: any[];
29
- cwd: any;
30
- };
31
- export function generateCliResponse(systemPrompt: any, options?: {}): Promise<{
32
- text: any;
33
- structuredResult: any;
34
- structuredResultSource: any;
35
- events: any[];
36
- usage: {};
37
- durationMs: number;
38
- numTurns: number;
39
- model: any;
40
- effort: any;
41
- sdk: any;
42
- providerSessionId: any;
43
- provider_session_id: any;
44
- cancelled: boolean;
45
- error: any;
46
- failureKind: string;
47
- diagnostics: {
48
- claude_error_code: any;
49
- };
50
- capabilitiesUsed: {
51
- prompt_cache_active: any;
52
- thinking_enabled: any;
53
- structured_output_enforced: boolean;
54
- subagent_invoked: any;
55
- mcp_servers_used: any[];
56
- native_subagents_used: any[];
57
- tool_compaction_applied: boolean;
58
- context_compaction_applied: any;
59
- };
60
- } | {
61
- text: any;
62
- structuredResult: any;
63
- structuredResultSource: any;
64
- events: any[];
65
- usage: {};
66
- durationMs: number;
67
- numTurns: number;
68
- model: any;
69
- effort: any;
70
- sdk: string;
71
- providerSessionId: any;
72
- provider_session_id: any;
73
- cancelled: boolean;
74
- error: any;
75
- failureKind: string;
76
- diagnostics: {
77
- codex_error_code: any;
78
- };
79
- capabilitiesUsed: {
80
- prompt_cache_active: any;
81
- thinking_enabled: any;
82
- structured_output_enforced: boolean;
83
- subagent_invoked: any;
84
- mcp_servers_used: any[];
85
- native_subagents_used: any[];
86
- tool_compaction_applied: boolean;
87
- context_compaction_applied: any;
88
- };
89
- } | {
90
- text: any;
91
- structuredResult: undefined;
92
- structuredResultSource: string;
93
- events: any[];
94
- usage: {
95
- input_tokens: any;
96
- output_tokens: any;
97
- cache_read_tokens: any;
98
- cache_creation_tokens: any;
99
- cost_usd: number;
100
- };
101
- durationMs: number;
102
- numTurns: number;
103
- model: string;
104
- effort: any;
105
- sdk: any;
106
- providerSessionId: any;
107
- provider_session_id: any;
108
- cancelled: boolean;
109
- error: any;
110
- failureKind: string;
111
- stderrTail: string;
112
- diagnostics: {
113
- had_partial_progress?: boolean;
114
- pi_error_code?: string;
115
- };
116
- capabilitiesUsed: {
117
- prompt_cache_active: any;
118
- thinking_enabled: any;
119
- structured_output_enforced: boolean;
120
- subagent_invoked: any;
121
- mcp_servers_used: any[];
122
- native_subagents_used: any[];
123
- tool_compaction_applied: boolean;
124
- context_compaction_applied: any;
125
- };
126
- } | {
127
- text: any;
128
- structuredResult: undefined;
129
- structuredResultSource: string;
130
- events: any[];
131
- usage: {};
132
- durationMs: number;
133
- numTurns: number;
134
- model: any;
135
- effort: any;
136
- sdk: any;
137
- providerSessionId: any;
138
- provider_session_id: any;
139
- cancelled: boolean;
140
- error: any;
141
- failureKind: string;
142
- stderrTail: string;
143
- diagnostics: {
144
- had_partial_progress?: boolean;
145
- pi_error_code?: string;
146
- };
147
- capabilitiesUsed: {
148
- prompt_cache_active: any;
149
- thinking_enabled: any;
150
- structured_output_enforced: boolean;
151
- subagent_invoked: any;
152
- mcp_servers_used: any[];
153
- native_subagents_used: any[];
154
- tool_compaction_applied: boolean;
155
- context_compaction_applied: any;
156
- };
157
- }>;
158
- export namespace claudeCodeRuntimeBridge {
159
- let id: string;
160
- let kind: string;
161
- namespace capabilities {
162
- export let streaming: boolean;
163
- export let structured_output: boolean;
164
- export let supports_session_resume: boolean;
165
- export let native_runtime_config: any;
166
- export let supports_mcp: boolean;
167
- export let supports_skills: boolean;
168
- export let supports_builtin_tools: boolean;
169
- export let supports_live_input: boolean;
170
- export let supports_native_subagents: boolean;
171
- export { TOOL_POLICY_PROJECTED as tool_policy };
172
- let kind_1: string;
173
- export { kind_1 as kind };
174
- export let runtime: string;
175
- }
176
- function supports(ref: any, options: any): boolean;
177
- function execute(systemPrompt: any, options: any): Promise<{
178
- text: any;
179
- structuredResult: any;
180
- structuredResultSource: any;
181
- events: any[];
182
- usage: {};
183
- durationMs: number;
184
- numTurns: number;
185
- model: any;
186
- effort: any;
187
- sdk: any;
188
- providerSessionId: any;
189
- provider_session_id: any;
190
- cancelled: boolean;
191
- error: any;
192
- failureKind: string;
193
- diagnostics: {
194
- claude_error_code: any;
195
- };
196
- capabilitiesUsed: {
197
- prompt_cache_active: any;
198
- thinking_enabled: any;
199
- structured_output_enforced: boolean;
200
- subagent_invoked: any;
201
- mcp_servers_used: any[];
202
- native_subagents_used: any[];
203
- tool_compaction_applied: boolean;
204
- context_compaction_applied: any;
205
- };
206
- } | {
207
- text: any;
208
- structuredResult: any;
209
- structuredResultSource: any;
210
- events: any[];
211
- usage: {};
212
- durationMs: number;
213
- numTurns: number;
214
- model: any;
215
- effort: any;
216
- sdk: string;
217
- providerSessionId: any;
218
- provider_session_id: any;
219
- cancelled: boolean;
220
- error: any;
221
- failureKind: string;
222
- diagnostics: {
223
- codex_error_code: any;
224
- };
225
- capabilitiesUsed: {
226
- prompt_cache_active: any;
227
- thinking_enabled: any;
228
- structured_output_enforced: boolean;
229
- subagent_invoked: any;
230
- mcp_servers_used: any[];
231
- native_subagents_used: any[];
232
- tool_compaction_applied: boolean;
233
- context_compaction_applied: any;
234
- };
235
- } | {
236
- text: any;
237
- structuredResult: undefined;
238
- structuredResultSource: string;
239
- events: any[];
240
- usage: {
241
- input_tokens: any;
242
- output_tokens: any;
243
- cache_read_tokens: any;
244
- cache_creation_tokens: any;
245
- cost_usd: number;
246
- };
247
- durationMs: number;
248
- numTurns: number;
249
- model: string;
250
- effort: any;
251
- sdk: any;
252
- providerSessionId: any;
253
- provider_session_id: any;
254
- cancelled: boolean;
255
- error: any;
256
- failureKind: string;
257
- stderrTail: string;
258
- diagnostics: {
259
- had_partial_progress?: boolean;
260
- pi_error_code?: string;
261
- };
262
- capabilitiesUsed: {
263
- prompt_cache_active: any;
264
- thinking_enabled: any;
265
- structured_output_enforced: boolean;
266
- subagent_invoked: any;
267
- mcp_servers_used: any[];
268
- native_subagents_used: any[];
269
- tool_compaction_applied: boolean;
270
- context_compaction_applied: any;
271
- };
272
- } | {
273
- text: any;
274
- structuredResult: undefined;
275
- structuredResultSource: string;
276
- events: any[];
277
- usage: {};
278
- durationMs: number;
279
- numTurns: number;
280
- model: any;
281
- effort: any;
282
- sdk: any;
283
- providerSessionId: any;
284
- provider_session_id: any;
285
- cancelled: boolean;
286
- error: any;
287
- failureKind: string;
288
- stderrTail: string;
289
- diagnostics: {
290
- had_partial_progress?: boolean;
291
- pi_error_code?: string;
292
- };
293
- capabilitiesUsed: {
294
- prompt_cache_active: any;
295
- thinking_enabled: any;
296
- structured_output_enforced: boolean;
297
- subagent_invoked: any;
298
- mcp_servers_used: any[];
299
- native_subagents_used: any[];
300
- tool_compaction_applied: boolean;
301
- context_compaction_applied: any;
302
- };
303
- }>;
304
- }
305
- import { TOOL_POLICY_PROJECTED } from "../runtime/tool-policy.js";
@@ -1,79 +0,0 @@
1
- /**
2
- * Claude owns its built-in tool subprocesses, so mono-agent's runtime tool
3
- * context cannot wrap them with the configured srt engine. An explicit `off`
4
- * policy is inert and remains valid; every enforcing mono-agent mode must fail
5
- * before the provider starts instead of silently running outside that policy.
6
- */
7
- export function claudeSandboxPolicyProblem(options: any): string;
8
- /** Typed provider result used by Claude bridges for fail-closed capability paths. */
9
- export function claudeCapabilityMismatchResult({ model, effort, sdk, providerSessionId, durationMs, outputSchema, error, errorCode, }: {
10
- model: any;
11
- effort: any;
12
- sdk: any;
13
- providerSessionId?: any;
14
- durationMs?: number;
15
- outputSchema: any;
16
- error: any;
17
- errorCode: any;
18
- }): {
19
- text: any;
20
- structuredResult: any;
21
- structuredResultSource: any;
22
- events: any[];
23
- usage: {};
24
- durationMs: number;
25
- numTurns: number;
26
- model: any;
27
- effort: any;
28
- sdk: any;
29
- providerSessionId: any;
30
- provider_session_id: any;
31
- cancelled: boolean;
32
- error: any;
33
- failureKind: string;
34
- diagnostics: {
35
- claude_error_code: any;
36
- };
37
- capabilitiesUsed: {
38
- prompt_cache_active: any;
39
- thinking_enabled: any;
40
- structured_output_enforced: boolean;
41
- subagent_invoked: any;
42
- mcp_servers_used: any[];
43
- native_subagents_used: any[];
44
- tool_compaction_applied: boolean;
45
- context_compaction_applied: any;
46
- };
47
- };
48
- /** Typed provider result used by both Claude bridges for the sandbox path. */
49
- export function claudeSandboxCapabilityMismatchResult(options: any): {
50
- text: any;
51
- structuredResult: any;
52
- structuredResultSource: any;
53
- events: any[];
54
- usage: {};
55
- durationMs: number;
56
- numTurns: number;
57
- model: any;
58
- effort: any;
59
- sdk: any;
60
- providerSessionId: any;
61
- provider_session_id: any;
62
- cancelled: boolean;
63
- error: any;
64
- failureKind: string;
65
- diagnostics: {
66
- claude_error_code: any;
67
- };
68
- capabilitiesUsed: {
69
- prompt_cache_active: any;
70
- thinking_enabled: any;
71
- structured_output_enforced: boolean;
72
- subagent_invoked: any;
73
- mcp_servers_used: any[];
74
- native_subagents_used: any[];
75
- tool_compaction_applied: boolean;
76
- context_compaction_applied: any;
77
- };
78
- };
79
- export const CLAUDE_SANDBOX_POLICY_UNSUPPORTED: "Claude SDK/CLI cannot enforce mono-agent's native srt sandbox scopes. Remove the mono-agent sandbox policy or use a Pi runtime for exact readableRoots, writableRoots, denyWrite, and network rules.";
@@ -1 +0,0 @@
1
- export {};
@@ -1,97 +0,0 @@
1
- /**
2
- * Return the versioned, SDK-matched fallback without exposing mutable shared
3
- * objects to callers.
4
- */
5
- export function curatedClaudeSdkModels(): {
6
- supportedEfforts: ClaudeSdkEffort[];
7
- /**
8
- * Exact model id accepted by the SDK.
9
- */
10
- model: string;
11
- /**
12
- * Canonical mono-agent reference.
13
- */
14
- reference: `claude:${string}`;
15
- displayName: string;
16
- description: string;
17
- supportsAdaptiveThinking: boolean;
18
- supportsFastMode: boolean;
19
- source: "discovered" | "cached";
20
- catalogVersion: typeof CLAUDE_SDK_CATALOG_VERSION;
21
- }[];
22
- /**
23
- * Normalize only exact Claude model ids. CLI convenience aliases are rejected
24
- * so persisted configuration never changes meaning when an alias advances.
25
- * Exact dated ids and a canonical `[1m]` suffix are preserved.
26
- * @param {unknown} value
27
- * @returns {string|null}
28
- */
29
- export function normalizeClaudeSdkModelId(value: unknown): string | null;
30
- /**
31
- * Whitelist the SDK initialization catalog into the public mono-agent shape.
32
- * No account, organization, token source, raw error, or unknown SDK field can
33
- * cross this boundary.
34
- * @param {unknown} rows
35
- * @param {"discovered"|"cached"} [source]
36
- * @returns {ClaudeSdkCatalogModel[]}
37
- */
38
- export function normalizeClaudeSdkCatalog(rows: unknown, source?: "discovered" | "cached"): ClaudeSdkCatalogModel[];
39
- /** @internal Exported for deterministic isolation tests. */
40
- export function createClaudeSdkDiscoveryIsolation({ baseEnvironment }?: {
41
- baseEnvironment?: NodeJS.ProcessEnv;
42
- }): Promise<{
43
- root: string;
44
- cwd: string;
45
- env: {
46
- HOME: string;
47
- CLAUDE_CONFIG_DIR: string;
48
- XDG_CONFIG_HOME: string;
49
- XDG_CACHE_HOME: string;
50
- XDG_DATA_HOME: string;
51
- XDG_STATE_HOME: string;
52
- TMPDIR: string;
53
- TMP: string;
54
- TEMP: string;
55
- CLAUDE_AGENT_SDK_CLIENT_APP: string;
56
- MCP_CONNECTION_NONBLOCKING: string;
57
- };
58
- cleanup: () => Promise<void>;
59
- }>;
60
- /**
61
- * Discover Claude's current model catalog in a throwaway, no-auth process.
62
- * Failure is deliberately non-fatal: the exact SDK-versioned curated catalog
63
- * remains available with `source: "cached"`.
64
- *
65
- * @param {Object} [options]
66
- * @param {number} [options.timeoutMs]
67
- * @param {readonly string[]} [options.authoredModelRefs]
68
- * @param {typeof fork} [options.forkProcess]
69
- * @param {(isolation: Awaited<ReturnType<typeof createClaudeSdkDiscoveryIsolation>>) => void} [options.onIsolation]
70
- * @returns {Promise<ClaudeSdkCatalogModel[]>}
71
- */
72
- export function discoverClaudeSdkModels({ timeoutMs, authoredModelRefs, forkProcess, onIsolation, }?: {
73
- timeoutMs?: number;
74
- authoredModelRefs?: readonly string[];
75
- forkProcess?: typeof fork;
76
- onIsolation?: (isolation: Awaited<ReturnType<typeof createClaudeSdkDiscoveryIsolation>>) => void;
77
- }): Promise<ClaudeSdkCatalogModel[]>;
78
- export const CLAUDE_SDK_CATALOG_VERSION: "claude-agent-sdk-0.3.206";
79
- export type ClaudeSdkEffort = "low" | "medium" | "high" | "xhigh" | "max";
80
- export type ClaudeSdkCatalogModel = {
81
- /**
82
- * Exact model id accepted by the SDK.
83
- */
84
- model: string;
85
- /**
86
- * Canonical mono-agent reference.
87
- */
88
- reference: `claude:${string}`;
89
- displayName: string;
90
- description: string;
91
- supportedEfforts: readonly ClaudeSdkEffort[];
92
- supportsAdaptiveThinking: boolean;
93
- supportsFastMode: boolean;
94
- source: "discovered" | "cached";
95
- catalogVersion: typeof CLAUDE_SDK_CATALOG_VERSION;
96
- };
97
- import { fork } from "node:child_process";
@@ -1,138 +0,0 @@
1
- /**
2
- * Preserve the provider default when effort is omitted. The current Agent SDK
3
- * public effort contract accepts the five values below. Its shipped JavaScript
4
- * currently forwards out-of-contract values to Claude Code, so mono-agent keeps
5
- * this route inside the pinned public contract rather than relying on that
6
- * untyped pass-through. Mono-agent must not infer thinking enablement/disablement
7
- * from a requested effort level.
8
- * @param {unknown} effort
9
- * @returns {{effort?: "low" | "medium" | "high" | "xhigh" | "max"}}
10
- */
11
- export function claudeEffortOptions(effort: unknown): {
12
- effort?: "low" | "medium" | "high" | "xhigh" | "max";
13
- };
14
- /** @param {string} model @param {unknown} contextWindow */
15
- export function claudeSdkModelForQuery(model: string, contextWindow: unknown): string;
16
- export function toolPayloadLimit(options: any): {
17
- bytes: number;
18
- usedSettings: boolean;
19
- };
20
- export function generateClaudeResponse(systemPrompt: any, options: any): Promise<{
21
- text: any;
22
- structuredResult: any;
23
- structuredResultSource: any;
24
- events: any[];
25
- usage: {};
26
- durationMs: number;
27
- numTurns: number;
28
- model: any;
29
- effort: any;
30
- sdk: any;
31
- providerSessionId: any;
32
- provider_session_id: any;
33
- cancelled: boolean;
34
- error: any;
35
- failureKind: string;
36
- diagnostics: {
37
- claude_error_code: any;
38
- };
39
- capabilitiesUsed: {
40
- prompt_cache_active: any;
41
- thinking_enabled: any;
42
- structured_output_enforced: boolean;
43
- subagent_invoked: any;
44
- mcp_servers_used: any[];
45
- native_subagents_used: any[];
46
- tool_compaction_applied: boolean;
47
- context_compaction_applied: any;
48
- };
49
- } | {
50
- text: string;
51
- structuredResult: any;
52
- structuredResultSource: any;
53
- events: any[];
54
- usage: {};
55
- durationMs: number;
56
- numTurns: number;
57
- model: any;
58
- effort: any;
59
- sdk: string;
60
- cancelled: boolean;
61
- error: string;
62
- errorDetails: {
63
- claude_error_code: string;
64
- claude_error_category: string;
65
- retryable: boolean;
66
- };
67
- failureKind: string;
68
- providerSessionId: string;
69
- runtimeWarnings: any[];
70
- capabilitiesUsed: {
71
- prompt_cache_active: any;
72
- thinking_enabled: any;
73
- structured_output_enforced: boolean;
74
- subagent_invoked: any;
75
- mcp_servers_used: any[];
76
- native_subagents_used: any[];
77
- tool_compaction_applied: boolean;
78
- context_compaction_applied: any;
79
- };
80
- } | {
81
- text: string;
82
- structuredResult: any;
83
- structuredResultSource: string;
84
- events: any[];
85
- usage: {
86
- input_tokens: any;
87
- output_tokens: any;
88
- cache_read_tokens: any;
89
- cache_creation_tokens: any;
90
- cost_usd: number;
91
- };
92
- durationMs: number;
93
- numTurns: number;
94
- model: any;
95
- effort: any;
96
- sdk: string;
97
- cancelled: boolean;
98
- error: any;
99
- errorDetails: {
100
- claude_error_subtype: string;
101
- last_text_excerpt: string;
102
- last_tool_name: string;
103
- had_partial_progress: boolean;
104
- tool_results_seen: number;
105
- turn_count: number;
106
- max_turns_hit: boolean;
107
- structured_output_retry_exhausted: boolean;
108
- last_structured_output_rejection: string;
109
- provider_session_id: string;
110
- claude_error_code: string;
111
- claude_error_category: any;
112
- retryable: boolean;
113
- request_id: any;
114
- };
115
- failureKind: any;
116
- providerSessionId: string;
117
- runtimeWarnings: {
118
- warning_kind: string;
119
- message: any;
120
- }[];
121
- capabilitiesUsed: {
122
- prompt_cache_active: any;
123
- thinking_enabled: any;
124
- structured_output_enforced: boolean;
125
- subagent_invoked: any;
126
- mcp_servers_used: any[];
127
- native_subagents_used: any[];
128
- tool_compaction_applied: boolean;
129
- context_compaction_applied: any;
130
- };
131
- }>;
132
- export namespace claudeRuntimeBridge {
133
- export let id: string;
134
- export let kind: string;
135
- export let capabilities: any;
136
- export function supports(ref: any): boolean;
137
- export { generateClaudeResponse as execute };
138
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Correlate Claude's live native-agent stream into provider-neutral
3
- * `subagent_activity` events.
4
- *
5
- * `observe()` returns `consumed: true` for every event owned by a native
6
- * subagent. Provider bridges must not additionally forward or interpret those
7
- * records as parent events. Non-agent background tasks are consumed without
8
- * creating activity.
9
- */
10
- export function createClaudeSubagentActivityNormalizer(): {
11
- observe: (raw: Record<string, any>) => {
12
- consumed: boolean;
13
- events: {
14
- type: string;
15
- subagent: {
16
- label?: any;
17
- nativeId?: any;
18
- id: any;
19
- name: any;
20
- callIndex: any;
21
- };
22
- }[];
23
- forwarded?: undefined;
24
- } | {
25
- consumed: boolean;
26
- events: {
27
- type: string;
28
- subagent: {
29
- label?: any;
30
- nativeId?: any;
31
- id: any;
32
- name: any;
33
- callIndex: any;
34
- };
35
- }[];
36
- forwarded: {
37
- message: any;
38
- };
39
- };
40
- /** Close every still-open child and its tools exactly once. */
41
- drain(reason?: string): {
42
- type: string;
43
- subagent: {
44
- label?: any;
45
- nativeId?: any;
46
- id: any;
47
- name: any;
48
- callIndex: any;
49
- };
50
- }[];
51
- subagentInvoked: () => boolean;
52
- nativeSubagentsUsed: () => any[];
53
- };
@@ -1,18 +0,0 @@
1
- export function claudeNativeAgentDefinitions(nativeSubagents: any): {};
2
- export function claudeToolsWithNativeSubagents(allowedTools: any, nativeSubagents: any): any;
3
- /**
4
- * Resolve the effective allowed-tools list for the Claude bridges, honoring the
5
- * `"*"` allow-all sentinel. Returns `{ allowAll, tools }` where `tools` is the
6
- * native-subagent-composed list with any bare `"*"` stripped, so a literal `"*"`
7
- * never reaches a CLI flag value or the SDK `query()`. When `allowAll` is true
8
- * the caller MUST defer to Claude's default toolset (omit `--tools` / pass
9
- * `allowedTools: undefined`) rather than pass `tools` as the tool set — the
10
- * default already carries every tool, incl. `Task`, so it is not double-added.
11
- * @param {any} allowedTools
12
- * @param {any} nativeSubagents
13
- * @returns {{allowAll: boolean, tools: any}}
14
- */
15
- export function resolveClaudeAllowedTools(allowedTools: any, nativeSubagents: any): {
16
- allowAll: boolean;
17
- tools: any;
18
- };