@smithers-orchestrator/agents 0.16.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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +65 -0
  3. package/src/AgentLike.ts +28 -0
  4. package/src/AmpAgent.js +232 -0
  5. package/src/AmpAgentOptions.ts +26 -0
  6. package/src/AnthropicAgent.js +54 -0
  7. package/src/AnthropicAgentOptions.ts +8 -0
  8. package/src/BaseCliAgent/AgentCliActionKind.ts +10 -0
  9. package/src/BaseCliAgent/AgentCliEvent.ts +44 -0
  10. package/src/BaseCliAgent/BaseCliAgent.js +874 -0
  11. package/src/BaseCliAgent/BaseCliAgentOptions.ts +13 -0
  12. package/src/BaseCliAgent/CliOutputInterpreter.ts +8 -0
  13. package/src/BaseCliAgent/CliUsageInfo.ts +7 -0
  14. package/src/BaseCliAgent/CodexConfigOverrides.ts +3 -0
  15. package/src/BaseCliAgent/PiExtensionUiRequest.ts +10 -0
  16. package/src/BaseCliAgent/PiExtensionUiResponse.ts +7 -0
  17. package/src/BaseCliAgent/RunCommandResult.ts +5 -0
  18. package/src/BaseCliAgent/buildGenerateResult.js +57 -0
  19. package/src/BaseCliAgent/combineNonEmpty.js +8 -0
  20. package/src/BaseCliAgent/createAgentStdoutTextEmitter.js +198 -0
  21. package/src/BaseCliAgent/extractPrompt.js +88 -0
  22. package/src/BaseCliAgent/extractTextFromJsonValue.js +46 -0
  23. package/src/BaseCliAgent/index.js +32 -0
  24. package/src/BaseCliAgent/normalizeCodexConfig.js +22 -0
  25. package/src/BaseCliAgent/parseHelpers.js +111 -0
  26. package/src/BaseCliAgent/pushFlag.js +18 -0
  27. package/src/BaseCliAgent/pushList.js +10 -0
  28. package/src/BaseCliAgent/resolveTimeouts.js +24 -0
  29. package/src/BaseCliAgent/runCommandEffect.js +32 -0
  30. package/src/BaseCliAgent/runRpcCommandEffect.js +365 -0
  31. package/src/BaseCliAgent/truncateToBytes.js +13 -0
  32. package/src/BaseCliAgent/tryParseJson.js +18 -0
  33. package/src/ClaudeCodeAgent.js +455 -0
  34. package/src/ClaudeCodeAgentOptions.ts +52 -0
  35. package/src/CodexAgent.js +593 -0
  36. package/src/CodexAgentOptions.ts +23 -0
  37. package/src/ForgeAgent.js +128 -0
  38. package/src/ForgeAgentOptions.ts +14 -0
  39. package/src/GeminiAgent.js +273 -0
  40. package/src/GeminiAgentOptions.ts +20 -0
  41. package/src/KimiAgent.js +260 -0
  42. package/src/KimiAgentOptions.ts +21 -0
  43. package/src/OpenAIAgent.js +54 -0
  44. package/src/OpenAIAgentOptions.ts +8 -0
  45. package/src/PiAgent.js +468 -0
  46. package/src/PiAgentOptions.ts +40 -0
  47. package/src/SdkAgentOptions.ts +16 -0
  48. package/src/agent-contract/SmithersAgentContract.ts +10 -0
  49. package/src/agent-contract/SmithersAgentContractTool.ts +8 -0
  50. package/src/agent-contract/SmithersAgentToolCategory.ts +6 -0
  51. package/src/agent-contract/SmithersListedTool.ts +4 -0
  52. package/src/agent-contract/SmithersToolSurface.ts +1 -0
  53. package/src/agent-contract/createSmithersAgentContract.js +188 -0
  54. package/src/agent-contract/index.js +10 -0
  55. package/src/agent-contract/renderSmithersAgentPromptGuidance.js +81 -0
  56. package/src/capability-registry/AgentCapabilityRegistry.ts +22 -0
  57. package/src/capability-registry/AgentToolDescriptor.ts +4 -0
  58. package/src/capability-registry/hashCapabilityRegistry.js +43 -0
  59. package/src/capability-registry/index.js +8 -0
  60. package/src/capability-registry/normalizeCapabilityRegistry.js +52 -0
  61. package/src/capability-registry/normalizeCapabilityStringList.js +9 -0
  62. package/src/cli-capabilities/CliAgentCapabilityAdapterId.ts +6 -0
  63. package/src/cli-capabilities/CliAgentCapabilityDoctorReport.ts +18 -0
  64. package/src/cli-capabilities/CliAgentCapabilityReportEntry.ts +9 -0
  65. package/src/cli-capabilities/formatCliAgentCapabilityDoctorReport.js +24 -0
  66. package/src/cli-capabilities/getCliAgentCapabilityDoctorReport.js +92 -0
  67. package/src/cli-capabilities/getCliAgentCapabilityReport.js +52 -0
  68. package/src/cli-capabilities/index.js +11 -0
  69. package/src/diagnostics/DiagnosticCheck.ts +11 -0
  70. package/src/diagnostics/DiagnosticCheckId.ts +4 -0
  71. package/src/diagnostics/DiagnosticContext.ts +4 -0
  72. package/src/diagnostics/DiagnosticReport.ts +9 -0
  73. package/src/diagnostics/enrichReportWithErrorAnalysis.js +34 -0
  74. package/src/diagnostics/formatDiagnosticSummary.js +17 -0
  75. package/src/diagnostics/getDiagnosticStrategy.js +503 -0
  76. package/src/diagnostics/index.js +13 -0
  77. package/src/diagnostics/launchDiagnostics.js +16 -0
  78. package/src/diagnostics/runDiagnostics.js +52 -0
  79. package/src/index.d.ts +872 -0
  80. package/src/index.js +39 -0
  81. package/src/resolveSdkModel.js +9 -0
  82. package/src/sanitizeForOpenAI.js +47 -0
  83. package/src/streamResultToGenerateResult.js +70 -0
  84. package/src/zodToOpenAISchema.js +16 -0
package/src/index.d.ts ADDED
@@ -0,0 +1,872 @@
1
+ import { openai } from '@ai-sdk/openai';
2
+ import * as ai from 'ai';
3
+ import { ToolLoopAgent, ToolSet, ToolLoopAgentSettings } from 'ai';
4
+ import { anthropic } from '@ai-sdk/anthropic';
5
+ import { Effect } from 'effect';
6
+ import { SmithersError } from '@smithers-orchestrator/errors/SmithersError';
7
+ import * as zod from 'zod';
8
+ import * as zod_v4_core from 'zod/v4/core';
9
+
10
+ type SmithersToolSurface$2 = "raw" | "semantic";
11
+
12
+ type SmithersListedTool$2 = {
13
+ name: string;
14
+ description?: string | null;
15
+ };
16
+
17
+ type SmithersAgentToolCategory$1 = "runs" | "approvals" | "workflows" | "debug" | "admin";
18
+
19
+ type SmithersAgentContractTool$1 = {
20
+ name: string;
21
+ description: string;
22
+ destructive: boolean;
23
+ category: SmithersAgentToolCategory$1;
24
+ };
25
+
26
+ type SmithersAgentContract$3 = {
27
+ toolSurface: SmithersToolSurface$2;
28
+ serverName: string;
29
+ tools: SmithersAgentContractTool$1[];
30
+ promptGuidance: string;
31
+ docsGuidance: string;
32
+ };
33
+
34
+ type PiExtensionUiResponse$1 = {
35
+ type: "extension_ui_response";
36
+ id: string;
37
+ value?: string;
38
+ cancelled?: boolean;
39
+ [key: string]: unknown;
40
+ };
41
+
42
+ type PiExtensionUiRequest$1 = {
43
+ type: "extension_ui_request";
44
+ id: string;
45
+ method: string;
46
+ title?: string;
47
+ placeholder?: string;
48
+ [key: string]: unknown;
49
+ };
50
+
51
+ type BaseCliAgentOptions$1 = {
52
+ id?: string;
53
+ model?: string;
54
+ systemPrompt?: string;
55
+ instructions?: string;
56
+ cwd?: string;
57
+ env?: Record<string, string>;
58
+ yolo?: boolean;
59
+ timeoutMs?: number;
60
+ idleTimeoutMs?: number;
61
+ maxOutputBytes?: number;
62
+ extraArgs?: string[];
63
+ };
64
+
65
+ type PiAgentOptions$2 = BaseCliAgentOptions$1 & {
66
+ provider?: string;
67
+ model?: string;
68
+ apiKey?: string;
69
+ systemPrompt?: string;
70
+ appendSystemPrompt?: string;
71
+ mode?: "text" | "json" | "rpc";
72
+ print?: boolean;
73
+ continue?: boolean;
74
+ resume?: boolean;
75
+ session?: string;
76
+ sessionDir?: string;
77
+ noSession?: boolean;
78
+ models?: string | string[];
79
+ listModels?: boolean | string;
80
+ tools?: string[];
81
+ noTools?: boolean;
82
+ extension?: string[];
83
+ noExtensions?: boolean;
84
+ skill?: string[];
85
+ noSkills?: boolean;
86
+ promptTemplate?: string[];
87
+ noPromptTemplates?: boolean;
88
+ theme?: string[];
89
+ noThemes?: boolean;
90
+ thinking?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
91
+ export?: string;
92
+ files?: string[];
93
+ verbose?: boolean;
94
+ onExtensionUiRequest?: (request: PiExtensionUiRequest$1) => Promise<PiExtensionUiResponse$1 | null> | PiExtensionUiResponse$1 | null;
95
+ };
96
+
97
+ type SdkAgentOptions<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, MODEL = any> = Omit<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS>, "model"> & {
98
+ /**
99
+ * Either a provider model id string or a preconstructed AI SDK language model.
100
+ * Passing a model instance is mainly useful for tests and advanced provider setup.
101
+ */
102
+ model: string | MODEL;
103
+ };
104
+
105
+ type OpenAIAgentOptions$2<CALL_OPTIONS = never, TOOLS extends ToolSet = {}> = SdkAgentOptions<CALL_OPTIONS, TOOLS, ReturnType<typeof openai>>;
106
+
107
+ type AnthropicAgentOptions$2<CALL_OPTIONS = never, TOOLS extends ToolSet = {}> = SdkAgentOptions<CALL_OPTIONS, TOOLS, ReturnType<typeof anthropic>>;
108
+
109
+ type AgentToolDescriptor$1 = {
110
+ description?: string;
111
+ source?: "builtin" | "mcp" | "extension" | "skill" | "runtime";
112
+ };
113
+
114
+ type AgentCapabilityRegistry$3 = {
115
+ version: 1;
116
+ engine: "claude-code" | "codex" | "gemini" | "kimi" | "pi" | "amp" | "forge";
117
+ runtimeTools: Record<string, AgentToolDescriptor$1>;
118
+ mcp: {
119
+ bootstrap: "inline-config" | "project-config" | "allow-list" | "unsupported";
120
+ supportsProjectScope: boolean;
121
+ supportsUserScope: boolean;
122
+ };
123
+ skills: {
124
+ supportsSkills: boolean;
125
+ installMode?: "files" | "dir" | "plugin";
126
+ smithersSkillIds: string[];
127
+ };
128
+ humanInteraction: {
129
+ supportsUiRequests: boolean;
130
+ methods: string[];
131
+ };
132
+ builtIns: string[];
133
+ };
134
+
135
+ /**
136
+ * @param {AgentCapabilityRegistry | null | undefined} registry
137
+ * @returns {string}
138
+ */
139
+ declare function hashCapabilityRegistry(registry: AgentCapabilityRegistry$2 | null | undefined): string;
140
+ type AgentCapabilityRegistry$2 = AgentCapabilityRegistry$3;
141
+
142
+ type AgentCapabilityRegistry$1 = AgentCapabilityRegistry$3;
143
+
144
+ /**
145
+ * Represents an entity capable of generating responses or actions based on prompts.
146
+ * This is typically an AI agent interface.
147
+ */
148
+ type AgentLike$1 = {
149
+ /** Optional unique identifier for the agent */
150
+ id?: string;
151
+ /** Available tools the agent can use */
152
+ tools?: Record<string, unknown>;
153
+ /** Optional structured capability registry for cache and diagnostics */
154
+ capabilities?: AgentCapabilityRegistry$1;
155
+ /**
156
+ * Generates a response or action based on the provided arguments.
157
+ *
158
+ * @param args - The arguments for generation
159
+ * @param args.options - Optional provider-specific configuration
160
+ * @param args.abortSignal - Signal to abort the generation request
161
+ * @param args.prompt - The input text prompt to generate from
162
+ * @param args.timeout - Optional timeout configuration in milliseconds
163
+ * @param args.onStdout - Callback for streaming standard output text
164
+ * @param args.onStderr - Callback for streaming standard error text
165
+ * @param args.outputSchema - Optional Zod schema defining the expected structured output format
166
+ * @returns A promise resolving to the generated output
167
+ */
168
+ generate: (args: unknown) => Promise<unknown>;
169
+ };
170
+
171
+ type RunCommandResult = {
172
+ stdout: string;
173
+ stderr: string;
174
+ exitCode: number | null;
175
+ };
176
+
177
+ type CodexConfigOverrides = Record<string, string | number | boolean | object | null> | string[];
178
+
179
+ type AgentCliActionKind = "turn" | "command" | "tool" | "file_change" | "web_search" | "todo_list" | "reasoning" | "warning" | "note";
180
+
181
+ type AgentCliActionPhase = "started" | "updated" | "completed";
182
+ type AgentCliEventLevel = "debug" | "info" | "warning" | "error";
183
+ type AgentCliStartedEvent = {
184
+ type: "started";
185
+ engine: string;
186
+ title: string;
187
+ resume?: string;
188
+ detail?: Record<string, unknown>;
189
+ };
190
+ type AgentCliActionEvent = {
191
+ type: "action";
192
+ engine: string;
193
+ phase: AgentCliActionPhase;
194
+ entryType?: "thought" | "message";
195
+ action: {
196
+ id: string;
197
+ kind: AgentCliActionKind;
198
+ title: string;
199
+ detail?: Record<string, unknown>;
200
+ };
201
+ message?: string;
202
+ ok?: boolean;
203
+ level?: AgentCliEventLevel;
204
+ };
205
+ type AgentCliCompletedEvent = {
206
+ type: "completed";
207
+ engine: string;
208
+ ok: boolean;
209
+ answer?: string;
210
+ error?: string;
211
+ resume?: string;
212
+ usage?: Record<string, unknown>;
213
+ };
214
+ type AgentCliEvent$2 = AgentCliStartedEvent | AgentCliActionEvent | AgentCliCompletedEvent;
215
+
216
+ type CliOutputInterpreter$8 = {
217
+ onStdoutLine?: (line: string) => AgentCliEvent$2[] | AgentCliEvent$2 | null | undefined;
218
+ onStderrLine?: (line: string) => AgentCliEvent$2[] | AgentCliEvent$2 | null | undefined;
219
+ onExit?: (result: RunCommandResult) => AgentCliEvent$2[] | AgentCliEvent$2 | null | undefined;
220
+ };
221
+
222
+ declare class BaseCliAgent {
223
+ /**
224
+ * @param {BaseCliAgentOptions} opts
225
+ */
226
+ constructor(opts: BaseCliAgentOptions);
227
+ version: string;
228
+ tools: {};
229
+ capabilities: any;
230
+ id: string;
231
+ model: string | undefined;
232
+ systemPrompt: string | undefined;
233
+ cwd: string | undefined;
234
+ env: Record<string, string> | undefined;
235
+ yolo: boolean;
236
+ timeoutMs: number | undefined;
237
+ idleTimeoutMs: number | undefined;
238
+ maxOutputBytes: number | undefined;
239
+ extraArgs: string[] | undefined;
240
+ /**
241
+ * @param {AgentGenerateOptions} [options]
242
+ * @param {AgentInvocationOperation} operation
243
+ * @returns {Effect.Effect<GenerateTextResult<Record<string, never>, unknown>, SmithersError>}
244
+ */
245
+ runGenerateEffect(options?: AgentGenerateOptions, operation: AgentInvocationOperation): Effect.Effect<GenerateTextResult$3<Record<string, never>, unknown>, SmithersError>;
246
+ /**
247
+ * @param {AgentGenerateOptions} [options]
248
+ * @returns {Promise<GenerateTextResult<Record<string, never>, unknown>>}
249
+ */
250
+ generate(options?: AgentGenerateOptions): Promise<GenerateTextResult$3<Record<string, never>, unknown>>;
251
+ /**
252
+ * @param {AgentGenerateOptions} [options]
253
+ * @returns {Promise<StreamTextResult<Record<string, never>, unknown>>}
254
+ */
255
+ stream(options?: AgentGenerateOptions): Promise<StreamTextResult<Record<string, never>, unknown>>;
256
+ /**
257
+ * @returns {CliOutputInterpreter | undefined}
258
+ */
259
+ createOutputInterpreter(): CliOutputInterpreter$7 | undefined;
260
+ }
261
+ type AgentCliEvent$1 = AgentCliEvent$2;
262
+ type BaseCliAgentOptions = BaseCliAgentOptions$1;
263
+ type CliOutputInterpreter$7 = CliOutputInterpreter$8;
264
+ type GenerateTextResult$3 = ai.GenerateTextResult<any, any>;
265
+ type StreamTextResult = ai.StreamTextResult<any, any>;
266
+ type AgentInvocationOperation = "generate" | "stream";
267
+ /**
268
+ * Loosely-typed generation options. The AI SDK passes a dynamic shape here
269
+ * (GenerateTextOptions / StreamTextOptions and provider-specific extensions)
270
+ * so we keep this permissive but avoid raw `any`.
271
+ */
272
+ type AgentGenerateOptions = {
273
+ prompt?: unknown;
274
+ messages?: unknown;
275
+ timeout?: unknown;
276
+ abortSignal?: AbortSignal;
277
+ rootDir?: string;
278
+ resumeSession?: string;
279
+ maxOutputBytes?: number;
280
+ onStdout?: (text: string) => void;
281
+ onStderr?: (text: string) => void;
282
+ onEvent?: (event: AgentCliEvent$1) => unknown;
283
+ retry?: unknown;
284
+ isRetry?: unknown;
285
+ retryAttempt?: unknown;
286
+ schemaRetry?: unknown;
287
+ [key: string]: unknown;
288
+ };
289
+
290
+ /** @typedef {import("ai").AgentCallParameters} AgentCallParameters */
291
+ /**
292
+ * @template [CALL_OPTIONS=never], [TOOLS=import("ai").ToolSet]
293
+ * @typedef {import("./AnthropicAgentOptions.ts").AnthropicAgentOptions<CALL_OPTIONS, TOOLS>} AnthropicAgentOptions
294
+ */
295
+ /**
296
+ * @template CALL_OPTIONS, TOOLS
297
+ * @typedef {AgentCallParameters<CALL_OPTIONS, TOOLS> & { onStdout?: (text: string) => void; onStderr?: (text: string) => void; onEvent?: (event: unknown) => Promise<void> | void; outputSchema?: import("zod").ZodTypeAny; resumeSession?: string; }} ExtendedGenerateArgs
298
+ */
299
+ /** @typedef {import("ai").GenerateTextResult} GenerateTextResult */
300
+ declare class AnthropicAgent extends ToolLoopAgent<never, any, never> {
301
+ /**
302
+ * @param {AnthropicAgentOptions<CALL_OPTIONS, TOOLS>} opts
303
+ */
304
+ constructor(opts: AnthropicAgentOptions$1<CALL_OPTIONS, TOOLS>);
305
+ hijackEngine: string;
306
+ /**
307
+ * @param {ExtendedGenerateArgs<CALL_OPTIONS, TOOLS>} args
308
+ * @returns {Promise<GenerateTextResult<TOOLS, never>>}
309
+ */
310
+ generate(args: ExtendedGenerateArgs$1<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult$2<TOOLS, never>>;
311
+ }
312
+ type AgentCallParameters$1 = any;
313
+ type AnthropicAgentOptions$1<CALL_OPTIONS = never, TOOLS = ai.ToolSet> = AnthropicAgentOptions$2<CALL_OPTIONS, TOOLS>;
314
+ type ExtendedGenerateArgs$1<CALL_OPTIONS, TOOLS> = AgentCallParameters$1<CALL_OPTIONS, TOOLS> & {
315
+ onStdout?: (text: string) => void;
316
+ onStderr?: (text: string) => void;
317
+ onEvent?: (event: unknown) => Promise<void> | void;
318
+ outputSchema?: zod.ZodTypeAny;
319
+ resumeSession?: string;
320
+ };
321
+ type GenerateTextResult$2 = ai.GenerateTextResult<any, any>;
322
+
323
+ /** @typedef {import("ai").AgentCallParameters} AgentCallParameters */
324
+ /**
325
+ * @template CALL_OPTIONS, TOOLS
326
+ * @typedef {AgentCallParameters<CALL_OPTIONS, TOOLS> & { onStdout?: (text: string) => void; onStderr?: (text: string) => void; onEvent?: (event: unknown) => Promise<void> | void; outputSchema?: import("zod").ZodTypeAny; resumeSession?: string; }} ExtendedGenerateArgs
327
+ */
328
+ /** @typedef {import("ai").GenerateTextResult} GenerateTextResult */
329
+ /**
330
+ * @template [CALL_OPTIONS=never], [TOOLS=import("ai").ToolSet]
331
+ * @typedef {import("./OpenAIAgentOptions.ts").OpenAIAgentOptions<CALL_OPTIONS, TOOLS>} OpenAIAgentOptions
332
+ */
333
+ declare class OpenAIAgent extends ToolLoopAgent<never, any, never> {
334
+ /**
335
+ * @param {OpenAIAgentOptions<CALL_OPTIONS, TOOLS>} opts
336
+ */
337
+ constructor(opts: OpenAIAgentOptions$1<CALL_OPTIONS, TOOLS>);
338
+ hijackEngine: string;
339
+ /**
340
+ * @param {ExtendedGenerateArgs<CALL_OPTIONS, TOOLS>} args
341
+ * @returns {Promise<GenerateTextResult<TOOLS, never>>}
342
+ */
343
+ generate(args: ExtendedGenerateArgs<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult$1<TOOLS, never>>;
344
+ }
345
+ type AgentCallParameters = any;
346
+ type ExtendedGenerateArgs<CALL_OPTIONS, TOOLS> = AgentCallParameters<CALL_OPTIONS, TOOLS> & {
347
+ onStdout?: (text: string) => void;
348
+ onStderr?: (text: string) => void;
349
+ onEvent?: (event: unknown) => Promise<void> | void;
350
+ outputSchema?: zod.ZodTypeAny;
351
+ resumeSession?: string;
352
+ };
353
+ type GenerateTextResult$1 = ai.GenerateTextResult<any, any>;
354
+ type OpenAIAgentOptions$1<CALL_OPTIONS = never, TOOLS = ai.ToolSet> = OpenAIAgentOptions$2<CALL_OPTIONS, TOOLS>;
355
+
356
+ /**
357
+ * Configuration options for the AmpAgent.
358
+ */
359
+ type AmpAgentOptions$1 = BaseCliAgentOptions$1 & {
360
+ /** Visibility setting for the new thread (e.g., private, public) */
361
+ visibility?: "private" | "public" | "workspace" | "group";
362
+ /** Path to a specific MCP configuration file */
363
+ mcpConfig?: string;
364
+ /** Path to a specific settings file */
365
+ settingsFile?: string;
366
+ /** Logging severity level */
367
+ logLevel?: "error" | "warn" | "info" | "debug" | "audit";
368
+ /** File path to write logs to */
369
+ logFile?: string;
370
+ /**
371
+ * If true, dangerously allows all commands without asking for permission.
372
+ * Equivalent to yolo mode but explicit.
373
+ */
374
+ dangerouslyAllowAll?: boolean;
375
+ /** Whether to enable IDE integrations (disabled by default in AmpAgent) */
376
+ ide?: boolean;
377
+ /** Whether to enable JetBrains IDE integration */
378
+ jetbrains?: boolean;
379
+ };
380
+
381
+ /** @typedef {import("./BaseCliAgent/CliOutputInterpreter.ts").CliOutputInterpreter} CliOutputInterpreter */
382
+ /**
383
+ * Agent implementation that wraps the 'amp' CLI executable.
384
+ * It translates generation requests into CLI arguments and executes the process.
385
+ */
386
+ declare class AmpAgent extends BaseCliAgent {
387
+ /**
388
+ * Initializes a new AmpAgent with the given options.
389
+ *
390
+ * @param {AmpAgentOptions} [opts] - Configuration options for the agent
391
+ */
392
+ constructor(opts?: AmpAgentOptions);
393
+ opts: AmpAgentOptions$1;
394
+ capabilities: {
395
+ version: number;
396
+ engine: string;
397
+ runtimeTools: {};
398
+ mcp: {
399
+ bootstrap: string;
400
+ supportsProjectScope: boolean;
401
+ supportsUserScope: boolean;
402
+ };
403
+ skills: {
404
+ supportsSkills: boolean;
405
+ smithersSkillIds: never[];
406
+ };
407
+ humanInteraction: {
408
+ supportsUiRequests: boolean;
409
+ methods: never[];
410
+ };
411
+ builtIns: string[];
412
+ };
413
+ cliEngine: string;
414
+ /**
415
+ * @returns {CliOutputInterpreter}
416
+ */
417
+ createOutputInterpreter(): CliOutputInterpreter$6;
418
+ /**
419
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
420
+ */
421
+ buildCommand(params: {
422
+ prompt: string;
423
+ systemPrompt?: string;
424
+ cwd: string;
425
+ options: any;
426
+ }): Promise<{
427
+ command: string;
428
+ args: string[];
429
+ outputFormat: string;
430
+ }>;
431
+ }
432
+ type AmpAgentOptions = AmpAgentOptions$1;
433
+ type CliOutputInterpreter$6 = CliOutputInterpreter$8;
434
+
435
+ type ClaudeCodeAgentOptions$1 = BaseCliAgentOptions$1 & {
436
+ addDir?: string[];
437
+ agent?: string;
438
+ agents?: Record<string, {
439
+ description?: string;
440
+ prompt?: string;
441
+ }> | string;
442
+ allowDangerouslySkipPermissions?: boolean;
443
+ allowedTools?: string[];
444
+ appendSystemPrompt?: string;
445
+ betas?: string[];
446
+ chrome?: boolean;
447
+ continue?: boolean;
448
+ dangerouslySkipPermissions?: boolean;
449
+ debug?: boolean | string;
450
+ debugFile?: string;
451
+ disableSlashCommands?: boolean;
452
+ disallowedTools?: string[];
453
+ fallbackModel?: string;
454
+ file?: string[];
455
+ forkSession?: boolean;
456
+ fromPr?: string;
457
+ ide?: boolean;
458
+ includePartialMessages?: boolean;
459
+ inputFormat?: "text" | "stream-json";
460
+ jsonSchema?: string;
461
+ maxBudgetUsd?: number;
462
+ mcpConfig?: string[];
463
+ mcpDebug?: boolean;
464
+ model?: string;
465
+ noChrome?: boolean;
466
+ noSessionPersistence?: boolean;
467
+ outputFormat?: "text" | "json" | "stream-json";
468
+ permissionMode?: "acceptEdits" | "bypassPermissions" | "default" | "delegate" | "dontAsk" | "plan";
469
+ pluginDir?: string[];
470
+ replayUserMessages?: boolean;
471
+ resume?: string;
472
+ sessionId?: string;
473
+ settingSources?: string;
474
+ settings?: string;
475
+ strictMcpConfig?: boolean;
476
+ systemPrompt?: string;
477
+ tools?: string[] | "default" | "";
478
+ verbose?: boolean;
479
+ };
480
+
481
+ declare class ClaudeCodeAgent extends BaseCliAgent {
482
+ /**
483
+ * @param {ClaudeCodeAgentOptions} [opts]
484
+ */
485
+ constructor(opts?: ClaudeCodeAgentOptions);
486
+ opts: ClaudeCodeAgentOptions$1;
487
+ capabilities: AgentCapabilityRegistry$3;
488
+ cliEngine: string;
489
+ /**
490
+ * @returns {CliOutputInterpreter}
491
+ */
492
+ createOutputInterpreter(): CliOutputInterpreter$5;
493
+ /**
494
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
495
+ */
496
+ buildCommand(params: {
497
+ prompt: string;
498
+ systemPrompt?: string;
499
+ cwd: string;
500
+ options: any;
501
+ }): Promise<{
502
+ command: string;
503
+ args: string[];
504
+ outputFormat: "stream-json" | "text" | "json";
505
+ }>;
506
+ }
507
+ type ClaudeCodeAgentOptions = ClaudeCodeAgentOptions$1;
508
+ type CliOutputInterpreter$5 = CliOutputInterpreter$8;
509
+
510
+ type CodexAgentOptions$1 = BaseCliAgentOptions$1 & {
511
+ config?: CodexConfigOverrides;
512
+ enable?: string[];
513
+ disable?: string[];
514
+ image?: string[];
515
+ model?: string;
516
+ oss?: boolean;
517
+ localProvider?: string;
518
+ sandbox?: "read-only" | "workspace-write" | "danger-full-access";
519
+ profile?: string;
520
+ fullAuto?: boolean;
521
+ dangerouslyBypassApprovalsAndSandbox?: boolean;
522
+ cd?: string;
523
+ skipGitRepoCheck?: boolean;
524
+ addDir?: string[];
525
+ outputSchema?: string;
526
+ color?: "always" | "never" | "auto";
527
+ json?: boolean;
528
+ outputLastMessage?: string;
529
+ };
530
+
531
+ declare class CodexAgent extends BaseCliAgent {
532
+ /**
533
+ * @param {CodexAgentOptions} [opts]
534
+ */
535
+ constructor(opts?: CodexAgentOptions);
536
+ opts: CodexAgentOptions$1;
537
+ capabilities: AgentCapabilityRegistry$3;
538
+ cliEngine: string;
539
+ /**
540
+ * @returns {CliOutputInterpreter}
541
+ */
542
+ createOutputInterpreter(): CliOutputInterpreter$4;
543
+ /**
544
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
545
+ */
546
+ buildCommand(params: {
547
+ prompt: string;
548
+ systemPrompt?: string;
549
+ cwd: string;
550
+ options: any;
551
+ }): Promise<{
552
+ command: string;
553
+ args: any[];
554
+ stdin: string;
555
+ outputFile: string;
556
+ outputFormat: string;
557
+ stdoutBannerPatterns: RegExp[];
558
+ cleanup: () => Promise<void>;
559
+ }>;
560
+ }
561
+ type CliOutputInterpreter$4 = CliOutputInterpreter$8;
562
+ type CodexAgentOptions = CodexAgentOptions$1;
563
+
564
+ type GeminiAgentOptions$1 = BaseCliAgentOptions$1 & {
565
+ debug?: boolean;
566
+ model?: string;
567
+ sandbox?: boolean;
568
+ yolo?: boolean;
569
+ approvalMode?: "default" | "auto_edit" | "yolo" | "plan";
570
+ experimentalAcp?: boolean;
571
+ allowedMcpServerNames?: string[];
572
+ allowedTools?: string[];
573
+ extensions?: string[];
574
+ listExtensions?: boolean;
575
+ resume?: string;
576
+ listSessions?: boolean;
577
+ deleteSession?: string;
578
+ includeDirectories?: string[];
579
+ screenReader?: boolean;
580
+ outputFormat?: "text" | "json" | "stream-json";
581
+ };
582
+
583
+ declare class GeminiAgent extends BaseCliAgent {
584
+ /**
585
+ * @param {GeminiAgentOptions} [opts]
586
+ */
587
+ constructor(opts?: GeminiAgentOptions);
588
+ opts: GeminiAgentOptions$1;
589
+ capabilities: AgentCapabilityRegistry$3;
590
+ cliEngine: string;
591
+ /**
592
+ * @returns {CliOutputInterpreter}
593
+ */
594
+ createOutputInterpreter(): CliOutputInterpreter$3;
595
+ /**
596
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
597
+ */
598
+ buildCommand(params: {
599
+ prompt: string;
600
+ systemPrompt?: string;
601
+ cwd: string;
602
+ options: any;
603
+ }): Promise<{
604
+ command: string;
605
+ args: string[];
606
+ outputFormat: "stream-json" | "text" | "json";
607
+ }>;
608
+ }
609
+ type CliOutputInterpreter$3 = CliOutputInterpreter$8;
610
+ type GeminiAgentOptions = GeminiAgentOptions$1;
611
+
612
+ declare class PiAgent extends BaseCliAgent {
613
+ /**
614
+ * @param {PiAgentOptions} [opts]
615
+ */
616
+ constructor(opts?: PiAgentOptions$1);
617
+ opts: PiAgentOptions$2;
618
+ capabilities: AgentCapabilityRegistry$3;
619
+ cliEngine: string;
620
+ issuedSessionRef: any;
621
+ /**
622
+ * @param {PiGenerateOptions} [options]
623
+ * @returns {PiMode}
624
+ */
625
+ resolveMode(options?: PiGenerateOptions): PiMode;
626
+ /**
627
+ * @param {{ prompt: string; cwd: string; options?: PiGenerateOptions; mode: PiMode; }} params
628
+ * @returns {string[]}
629
+ */
630
+ buildArgs(params: {
631
+ prompt: string;
632
+ cwd: string;
633
+ options?: PiGenerateOptions;
634
+ mode: PiMode;
635
+ }): string[];
636
+ /**
637
+ * @returns {CliOutputInterpreter}
638
+ */
639
+ createOutputInterpreter(): CliOutputInterpreter$2;
640
+ /**
641
+ * @param {PiGenerateOptions} [options]
642
+ * @returns {Promise<GenerateTextResult>}
643
+ */
644
+ generate(options?: PiGenerateOptions): Promise<GenerateTextResult>;
645
+ /**
646
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options?: PiGenerateOptions; }} params
647
+ * @returns {Promise<{ command: string; args: string[]; stdin?: string; outputFormat?: string; outputFile?: string; cleanup?: () => Promise<void>; }>}
648
+ */
649
+ buildCommand(params: {
650
+ prompt: string;
651
+ systemPrompt?: string;
652
+ cwd: string;
653
+ options?: PiGenerateOptions;
654
+ }): Promise<{
655
+ command: string;
656
+ args: string[];
657
+ stdin?: string;
658
+ outputFormat?: string;
659
+ outputFile?: string;
660
+ cleanup?: () => Promise<void>;
661
+ }>;
662
+ }
663
+ type CliOutputInterpreter$2 = CliOutputInterpreter$8;
664
+ type AgentCliEvent = AgentCliEvent$2;
665
+ type GenerateTextResult = ai.GenerateTextResult<Record<string, never>, unknown>;
666
+ type PiAgentOptions$1 = PiAgentOptions$2;
667
+ type PiMode = "text" | "json" | "stream-json" | "rpc";
668
+ type PiGenerateOptions = {
669
+ prompt?: unknown;
670
+ messages?: unknown;
671
+ onEvent?: (event: AgentCliEvent) => unknown;
672
+ resumeSession?: unknown;
673
+ rootDir?: string;
674
+ timeout?: unknown;
675
+ abortSignal?: AbortSignal;
676
+ maxOutputBytes?: number;
677
+ onStdout?: (text: string) => void;
678
+ onStderr?: (text: string) => void;
679
+ [key: string]: unknown;
680
+ };
681
+
682
+ type KimiAgentOptions$1 = BaseCliAgentOptions$1 & {
683
+ workDir?: string;
684
+ session?: string;
685
+ continue?: boolean;
686
+ thinking?: boolean;
687
+ outputFormat?: "text" | "stream-json";
688
+ finalMessageOnly?: boolean;
689
+ quiet?: boolean;
690
+ agent?: "default" | "okabe";
691
+ agentFile?: string;
692
+ mcpConfigFile?: string[];
693
+ mcpConfig?: string[];
694
+ skillsDir?: string;
695
+ maxStepsPerTurn?: number;
696
+ maxRetriesPerStep?: number;
697
+ maxRalphIterations?: number;
698
+ verbose?: boolean;
699
+ debug?: boolean;
700
+ };
701
+
702
+ declare class KimiAgent extends BaseCliAgent {
703
+ /**
704
+ * @param {KimiAgentOptions} [opts]
705
+ */
706
+ constructor(opts?: KimiAgentOptions);
707
+ opts: KimiAgentOptions$1;
708
+ capabilities: AgentCapabilityRegistry$3;
709
+ cliEngine: string;
710
+ issuedSessionId: any;
711
+ /**
712
+ * @returns {CliOutputInterpreter}
713
+ */
714
+ createOutputInterpreter(): CliOutputInterpreter$1;
715
+ /**
716
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
717
+ */
718
+ buildCommand(params: {
719
+ prompt: string;
720
+ systemPrompt?: string;
721
+ cwd: string;
722
+ options: any;
723
+ }): Promise<{
724
+ command: string;
725
+ args: string[];
726
+ outputFormat: "stream-json" | "text";
727
+ env: {
728
+ KIMI_SHARE_DIR: string;
729
+ } | undefined;
730
+ cleanup: (() => Promise<void>) | undefined;
731
+ stdoutBannerPatterns: RegExp[];
732
+ stdoutErrorPatterns: RegExp[];
733
+ errorOnBannerOnly: boolean;
734
+ }>;
735
+ }
736
+ type CliOutputInterpreter$1 = CliOutputInterpreter$8;
737
+ type KimiAgentOptions = KimiAgentOptions$1;
738
+
739
+ type ForgeAgentOptions$1 = BaseCliAgentOptions$1 & {
740
+ directory?: string;
741
+ provider?: string;
742
+ agent?: string;
743
+ conversationId?: string;
744
+ sandbox?: string;
745
+ restricted?: boolean;
746
+ verbose?: boolean;
747
+ workflow?: string;
748
+ event?: string;
749
+ conversation?: string;
750
+ };
751
+
752
+ /** @typedef {import("./BaseCliAgent/BaseCliAgentOptions.ts").BaseCliAgentOptions} BaseCliAgentOptions */
753
+ /** @typedef {import("./BaseCliAgent/CliOutputInterpreter.ts").CliOutputInterpreter} CliOutputInterpreter */
754
+ /** @typedef {import("./ForgeAgentOptions.ts").ForgeAgentOptions} ForgeAgentOptions */
755
+ declare class ForgeAgent extends BaseCliAgent {
756
+ /**
757
+ * @param {ForgeAgentOptions} [opts]
758
+ */
759
+ constructor(opts?: ForgeAgentOptions);
760
+ opts: ForgeAgentOptions$1;
761
+ capabilities: {
762
+ version: number;
763
+ engine: string;
764
+ runtimeTools: {};
765
+ mcp: {
766
+ bootstrap: string;
767
+ supportsProjectScope: boolean;
768
+ supportsUserScope: boolean;
769
+ };
770
+ skills: {
771
+ supportsSkills: boolean;
772
+ smithersSkillIds: never[];
773
+ };
774
+ humanInteraction: {
775
+ supportsUiRequests: boolean;
776
+ methods: never[];
777
+ };
778
+ builtIns: string[];
779
+ };
780
+ cliEngine: string;
781
+ issuedConversationId: any;
782
+ /**
783
+ * @returns {CliOutputInterpreter}
784
+ */
785
+ createOutputInterpreter(): CliOutputInterpreter;
786
+ /**
787
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
788
+ */
789
+ buildCommand(params: {
790
+ prompt: string;
791
+ systemPrompt?: string;
792
+ cwd: string;
793
+ options: any;
794
+ }): Promise<{
795
+ command: string;
796
+ args: string[];
797
+ outputFormat: string;
798
+ }>;
799
+ }
800
+ type CliOutputInterpreter = CliOutputInterpreter$8;
801
+ type ForgeAgentOptions = ForgeAgentOptions$1;
802
+
803
+ /**
804
+ * @param {CreateSmithersAgentContractOptions} options
805
+ * @returns {SmithersAgentContract}
806
+ */
807
+ declare function createSmithersAgentContract(options: CreateSmithersAgentContractOptions): SmithersAgentContract$2;
808
+ type SmithersListedTool$1 = SmithersListedTool$2;
809
+ type SmithersToolSurface$1 = SmithersToolSurface$2;
810
+ type CreateSmithersAgentContractOptions = {
811
+ toolSurface?: SmithersToolSurface$1;
812
+ serverName?: string;
813
+ tools: SmithersListedTool$1[];
814
+ };
815
+ type SmithersAgentContract$2 = SmithersAgentContract$3;
816
+
817
+ /**
818
+ * @param {SmithersAgentContract} contract
819
+ * @param {RenderGuidanceOptions} [options]
820
+ */
821
+ declare function renderSmithersAgentPromptGuidance(contract: SmithersAgentContract$1, options?: RenderGuidanceOptions): string;
822
+ type RenderGuidanceOptions = {
823
+ available?: boolean;
824
+ toolNamePrefix?: string;
825
+ };
826
+ type SmithersAgentContract$1 = SmithersAgentContract$3;
827
+
828
+ /**
829
+ * Convert a Zod schema to an OpenAI-safe JSON Schema object.
830
+ *
831
+ * Usage:
832
+ * ```ts
833
+ * import { zodToOpenAISchema } from "./zodToOpenAISchema";
834
+ * const jsonSchema = zodToOpenAISchema(myZodSchema);
835
+ * ```
836
+ */
837
+ declare function zodToOpenAISchema(zodSchema: any): Promise<zod_v4_core.ZodStandardJSONSchemaPayload<any>>;
838
+
839
+ /**
840
+ * Sanitize a JSON Schema for OpenAI's structured-output API.
841
+ *
842
+ * OpenAI's `response_format` imposes constraints beyond standard JSON Schema:
843
+ *
844
+ * 1. Every object node **must** include `"type": "object"`.
845
+ * 2. `additionalProperties` must be a boolean or a valid sub-schema with a
846
+ * `type` key -- bare `{}` is rejected.
847
+ * 3. `additionalProperties: true` is accepted but tells the model it can
848
+ * return extra keys -- set to `false` if you want strict conformance.
849
+ *
850
+ * Zod v4's `toJSONSchema()` can violate (1) when `z.looseObject()` is used:
851
+ * it emits `{ additionalProperties: true }` without `"type": "object"`.
852
+ *
853
+ * This function fixes these issues in-place so any agent (Codex, future
854
+ * OpenAI-backed agents, etc.) can safely use a JSON Schema for OpenAI.
855
+ */
856
+ declare function sanitizeForOpenAI(node: any): void;
857
+
858
+ type AgentCapabilityRegistry = AgentCapabilityRegistry$3;
859
+ type AgentLike = AgentLike$1;
860
+ type AgentToolDescriptor = AgentToolDescriptor$1;
861
+ type AnthropicAgentOptions<CALL_OPTIONS = never, TOOLS = ai.ToolSet> = AnthropicAgentOptions$2<CALL_OPTIONS, TOOLS>;
862
+ type OpenAIAgentOptions<CALL_OPTIONS = never, TOOLS = ai.ToolSet> = OpenAIAgentOptions$2<CALL_OPTIONS, TOOLS>;
863
+ type PiAgentOptions = PiAgentOptions$2;
864
+ type PiExtensionUiRequest = PiExtensionUiRequest$1;
865
+ type PiExtensionUiResponse = PiExtensionUiResponse$1;
866
+ type SmithersAgentContract = SmithersAgentContract$3;
867
+ type SmithersAgentContractTool = SmithersAgentContractTool$1;
868
+ type SmithersAgentToolCategory = SmithersAgentToolCategory$1;
869
+ type SmithersListedTool = SmithersListedTool$2;
870
+ type SmithersToolSurface = SmithersToolSurface$2;
871
+
872
+ export { type AgentCapabilityRegistry, type AgentLike, type AgentToolDescriptor, AmpAgent, AnthropicAgent, type AnthropicAgentOptions, BaseCliAgent, ClaudeCodeAgent, CodexAgent, ForgeAgent, GeminiAgent, KimiAgent, OpenAIAgent, type OpenAIAgentOptions, PiAgent, type PiAgentOptions, type PiExtensionUiRequest, type PiExtensionUiResponse, type SmithersAgentContract, type SmithersAgentContractTool, type SmithersAgentToolCategory, type SmithersListedTool, type SmithersToolSurface, createSmithersAgentContract, hashCapabilityRegistry, renderSmithersAgentPromptGuidance, sanitizeForOpenAI, zodToOpenAISchema };