@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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 William Cory
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@smithers-orchestrator/agents",
3
+ "version": "0.16.0",
4
+ "description": "AI SDK and CLI agent adapters for Smithers",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "import": "./src/index.js",
11
+ "default": "./src/index.js"
12
+ },
13
+ "./BaseCliAgent": {
14
+ "types": "./src/index.d.ts",
15
+ "import": "./src/BaseCliAgent/index.js",
16
+ "default": "./src/BaseCliAgent/index.js"
17
+ },
18
+ "./agent-contract": {
19
+ "types": "./src/index.d.ts",
20
+ "import": "./src/agent-contract/index.js",
21
+ "default": "./src/agent-contract/index.js"
22
+ },
23
+ "./diagnostics": {
24
+ "types": "./src/index.d.ts",
25
+ "import": "./src/diagnostics/index.js",
26
+ "default": "./src/diagnostics/index.js"
27
+ },
28
+ "./capability-registry": {
29
+ "types": "./src/index.d.ts",
30
+ "import": "./src/capability-registry/index.js",
31
+ "default": "./src/capability-registry/index.js"
32
+ },
33
+ "./cli-capabilities": {
34
+ "types": "./src/index.d.ts",
35
+ "import": "./src/cli-capabilities/index.js",
36
+ "default": "./src/cli-capabilities/index.js"
37
+ },
38
+ "./*": {
39
+ "types": "./src/index.d.ts",
40
+ "import": "./src/*.js",
41
+ "default": "./src/*.js"
42
+ }
43
+ },
44
+ "files": [
45
+ "src/"
46
+ ],
47
+ "dependencies": {
48
+ "@ai-sdk/anthropic": "^3.0.36",
49
+ "@ai-sdk/openai": "^3.0.41",
50
+ "ai": "^6.0.69",
51
+ "zod": "^4.3.6",
52
+ "@smithers-orchestrator/driver": "0.16.0",
53
+ "@smithers-orchestrator/errors": "0.16.0",
54
+ "@smithers-orchestrator/observability": "0.16.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/bun": "latest",
58
+ "typescript": "~5.9.3"
59
+ },
60
+ "scripts": {
61
+ "test": "bun test tests",
62
+ "typecheck": "tsc -p tsconfig.json --noEmit",
63
+ "build": "tsup --dts-only"
64
+ }
65
+ }
@@ -0,0 +1,28 @@
1
+ import type { AgentCapabilityRegistry } from "./capability-registry";
2
+
3
+ /**
4
+ * Represents an entity capable of generating responses or actions based on prompts.
5
+ * This is typically an AI agent interface.
6
+ */
7
+ export type AgentLike = {
8
+ /** Optional unique identifier for the agent */
9
+ id?: string;
10
+ /** Available tools the agent can use */
11
+ tools?: Record<string, unknown>;
12
+ /** Optional structured capability registry for cache and diagnostics */
13
+ capabilities?: AgentCapabilityRegistry;
14
+ /**
15
+ * Generates a response or action based on the provided arguments.
16
+ *
17
+ * @param args - The arguments for generation
18
+ * @param args.options - Optional provider-specific configuration
19
+ * @param args.abortSignal - Signal to abort the generation request
20
+ * @param args.prompt - The input text prompt to generate from
21
+ * @param args.timeout - Optional timeout configuration in milliseconds
22
+ * @param args.onStdout - Callback for streaming standard output text
23
+ * @param args.onStderr - Callback for streaming standard error text
24
+ * @param args.outputSchema - Optional Zod schema defining the expected structured output format
25
+ * @returns A promise resolving to the generated output
26
+ */
27
+ generate: (args: unknown) => Promise<unknown>;
28
+ };
@@ -0,0 +1,232 @@
1
+ // @smithers-type-exports-begin
2
+ /** @typedef {import("./AmpAgentOptions.ts").AmpAgentOptions} AmpAgentOptions */
3
+ // @smithers-type-exports-end
4
+
5
+ import { BaseCliAgent, pushFlag, isRecord, asString, toolKindFromName, createSyntheticIdGenerator, } from "./BaseCliAgent/index.js";
6
+ /** @typedef {import("./BaseCliAgent/CliOutputInterpreter.ts").CliOutputInterpreter} CliOutputInterpreter */
7
+
8
+ /**
9
+ * Agent implementation that wraps the 'amp' CLI executable.
10
+ * It translates generation requests into CLI arguments and executes the process.
11
+ */
12
+ export class AmpAgent extends BaseCliAgent {
13
+ opts;
14
+ capabilities;
15
+ cliEngine = "amp";
16
+ /**
17
+ * Initializes a new AmpAgent with the given options.
18
+ *
19
+ * @param {AmpAgentOptions} [opts] - Configuration options for the agent
20
+ */
21
+ constructor(opts = {}) {
22
+ super(opts);
23
+ this.opts = opts;
24
+ this.capabilities = {
25
+ version: 1,
26
+ engine: "amp",
27
+ runtimeTools: {},
28
+ mcp: {
29
+ bootstrap: "project-config",
30
+ supportsProjectScope: true,
31
+ supportsUserScope: false,
32
+ },
33
+ skills: {
34
+ supportsSkills: false,
35
+ smithersSkillIds: [],
36
+ },
37
+ humanInteraction: {
38
+ supportsUiRequests: false,
39
+ methods: [],
40
+ },
41
+ builtIns: ["default"],
42
+ };
43
+ }
44
+ /**
45
+ * @returns {CliOutputInterpreter}
46
+ */
47
+ createOutputInterpreter() {
48
+ let sessionId;
49
+ let finalAnswer = "";
50
+ let didEmitCompleted = false;
51
+ const nextSyntheticId = createSyntheticIdGenerator();
52
+ /**
53
+ * @param {string} line
54
+ * @returns {AgentCliEvent[]}
55
+ */
56
+ const parseLine = (line) => {
57
+ const trimmed = line.trim();
58
+ if (!trimmed)
59
+ return [];
60
+ let payload;
61
+ try {
62
+ payload = JSON.parse(trimmed);
63
+ }
64
+ catch {
65
+ return [];
66
+ }
67
+ if (!isRecord(payload))
68
+ return [];
69
+ const type = asString(payload.type);
70
+ if (!type)
71
+ return [];
72
+ if (type === "system" && asString(payload.subtype) === "init") {
73
+ sessionId = asString(payload.session_id);
74
+ return [{
75
+ type: "started",
76
+ engine: this.cliEngine,
77
+ title: "Amp",
78
+ resume: sessionId,
79
+ detail: {
80
+ cwd: asString(payload.cwd),
81
+ tools: payload.tools,
82
+ },
83
+ }];
84
+ }
85
+ if (type === "assistant") {
86
+ const message = isRecord(payload.message) ? payload.message : undefined;
87
+ const content = Array.isArray(message?.content) ? message.content : [];
88
+ const events = [];
89
+ for (const block of content) {
90
+ if (!isRecord(block))
91
+ continue;
92
+ if (block.type === "text" && typeof block.text === "string") {
93
+ finalAnswer += block.text;
94
+ continue;
95
+ }
96
+ if (block.type === "tool_use") {
97
+ const name = asString(block.name) ?? "tool";
98
+ const id = asString(block.id) ?? nextSyntheticId("amp-tool");
99
+ events.push({
100
+ type: "action",
101
+ engine: this.cliEngine,
102
+ phase: "started",
103
+ entryType: "thought",
104
+ action: {
105
+ id,
106
+ kind: toolKindFromName(name),
107
+ title: name,
108
+ detail: {
109
+ input: block.input,
110
+ parentToolUseId: payload.parent_tool_use_id,
111
+ },
112
+ },
113
+ message: `Running ${name}`,
114
+ level: "info",
115
+ });
116
+ }
117
+ }
118
+ return events;
119
+ }
120
+ if (type === "user") {
121
+ const message = isRecord(payload.message) ? payload.message : undefined;
122
+ const content = Array.isArray(message?.content) ? message.content : [];
123
+ const events = [];
124
+ for (const block of content) {
125
+ if (!isRecord(block) || block.type !== "tool_result")
126
+ continue;
127
+ const id = asString(block.tool_use_id) ?? nextSyntheticId("amp-tool");
128
+ events.push({
129
+ type: "action",
130
+ engine: this.cliEngine,
131
+ phase: "completed",
132
+ entryType: "thought",
133
+ action: {
134
+ id,
135
+ kind: "tool",
136
+ title: "tool result",
137
+ detail: {
138
+ parentToolUseId: payload.parent_tool_use_id,
139
+ },
140
+ },
141
+ message: asString(block.content),
142
+ ok: block.is_error !== true,
143
+ level: block.is_error === true ? "warning" : "info",
144
+ });
145
+ }
146
+ return events;
147
+ }
148
+ if (type === "result") {
149
+ if (didEmitCompleted)
150
+ return [];
151
+ didEmitCompleted = true;
152
+ const ok = payload.is_error !== true;
153
+ return [{
154
+ type: "completed",
155
+ engine: this.cliEngine,
156
+ ok,
157
+ answer: finalAnswer || asString(payload.result),
158
+ error: ok ? undefined : asString(payload.error),
159
+ resume: asString(payload.session_id) ?? sessionId,
160
+ usage: isRecord(payload.usage) ? payload.usage : undefined,
161
+ }];
162
+ }
163
+ return [];
164
+ };
165
+ return {
166
+ onStdoutLine: parseLine,
167
+ onExit: (result) => {
168
+ if (didEmitCompleted)
169
+ return [];
170
+ if (result.exitCode === 0)
171
+ return [];
172
+ didEmitCompleted = true;
173
+ return [{
174
+ type: "completed",
175
+ engine: this.cliEngine,
176
+ ok: false,
177
+ answer: finalAnswer || undefined,
178
+ error: result.stderr.trim() || `Amp exited with code ${result.exitCode}`,
179
+ resume: sessionId,
180
+ }];
181
+ },
182
+ };
183
+ }
184
+ /**
185
+ * @param {{ prompt: string; systemPrompt?: string; cwd: string; options: any; }} params
186
+ */
187
+ async buildCommand(params) {
188
+ const args = [];
189
+ const yoloEnabled = this.opts.yolo ?? this.yolo;
190
+ // Dangerous allow all (yolo mode) — must come before --execute
191
+ if (this.opts.dangerouslyAllowAll || yoloEnabled) {
192
+ args.push("--dangerously-allow-all");
193
+ }
194
+ // Model / mode
195
+ pushFlag(args, "--model", this.opts.model ?? this.model);
196
+ // Visibility for new threads
197
+ pushFlag(args, "--visibility", this.opts.visibility);
198
+ // MCP config
199
+ pushFlag(args, "--mcp-config", this.opts.mcpConfig);
200
+ // Settings file
201
+ pushFlag(args, "--settings-file", this.opts.settingsFile);
202
+ // Log level
203
+ pushFlag(args, "--log-level", this.opts.logLevel);
204
+ // Log file
205
+ pushFlag(args, "--log-file", this.opts.logFile);
206
+ // IDE integration — disable by default for headless execution
207
+ args.push("--no-ide");
208
+ args.push("--no-jetbrains");
209
+ // Color handling
210
+ args.push("--no-color");
211
+ // Archive thread after execution to keep things clean
212
+ args.push("--archive");
213
+ if (this.extraArgs?.length)
214
+ args.push(...this.extraArgs);
215
+ // Build prompt with system prompt prepended
216
+ const systemPrefix = params.systemPrompt
217
+ ? `${params.systemPrompt}\n\n`
218
+ : "";
219
+ const fullPrompt = `${systemPrefix}${params.prompt ?? ""}`;
220
+ // Execute mode with prompt as argument
221
+ args.push("--execute", fullPrompt);
222
+ const useStreamJson = Boolean(params.options?.onEvent);
223
+ if (useStreamJson) {
224
+ args.push("--stream-json");
225
+ }
226
+ return {
227
+ command: "amp",
228
+ args,
229
+ outputFormat: useStreamJson ? "stream-json" : "text",
230
+ };
231
+ }
232
+ }
@@ -0,0 +1,26 @@
1
+ import type { BaseCliAgentOptions } from "./BaseCliAgent/BaseCliAgentOptions";
2
+
3
+ /**
4
+ * Configuration options for the AmpAgent.
5
+ */
6
+ export type AmpAgentOptions = BaseCliAgentOptions & {
7
+ /** Visibility setting for the new thread (e.g., private, public) */
8
+ visibility?: "private" | "public" | "workspace" | "group";
9
+ /** Path to a specific MCP configuration file */
10
+ mcpConfig?: string;
11
+ /** Path to a specific settings file */
12
+ settingsFile?: string;
13
+ /** Logging severity level */
14
+ logLevel?: "error" | "warn" | "info" | "debug" | "audit";
15
+ /** File path to write logs to */
16
+ logFile?: string;
17
+ /**
18
+ * If true, dangerously allows all commands without asking for permission.
19
+ * Equivalent to yolo mode but explicit.
20
+ */
21
+ dangerouslyAllowAll?: boolean;
22
+ /** Whether to enable IDE integrations (disabled by default in AmpAgent) */
23
+ ide?: boolean;
24
+ /** Whether to enable JetBrains IDE integration */
25
+ jetbrains?: boolean;
26
+ };
@@ -0,0 +1,54 @@
1
+ import { anthropic } from "@ai-sdk/anthropic";
2
+ import { ToolLoopAgent, } from "ai";
3
+ import { resolveSdkModel } from "./resolveSdkModel.js";
4
+ import { streamResultToGenerateResult } from "./streamResultToGenerateResult.js";
5
+ /** @typedef {import("ai").AgentCallParameters} AgentCallParameters */
6
+
7
+ /**
8
+ * @template [CALL_OPTIONS=never], [TOOLS=import("ai").ToolSet]
9
+ * @typedef {import("./AnthropicAgentOptions.ts").AnthropicAgentOptions<CALL_OPTIONS, TOOLS>} AnthropicAgentOptions
10
+ */
11
+ /**
12
+ * @template CALL_OPTIONS, TOOLS
13
+ * @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
14
+ */
15
+ /** @typedef {import("ai").GenerateTextResult} GenerateTextResult */
16
+
17
+ export class AnthropicAgent extends ToolLoopAgent {
18
+ hijackEngine = "anthropic-sdk";
19
+ /**
20
+ * @param {AnthropicAgentOptions<CALL_OPTIONS, TOOLS>} opts
21
+ */
22
+ constructor(opts) {
23
+ const { model, ...rest } = opts;
24
+ super({
25
+ ...rest,
26
+ model: resolveSdkModel(model, anthropic),
27
+ });
28
+ }
29
+ /**
30
+ * @param {ExtendedGenerateArgs<CALL_OPTIONS, TOOLS>} args
31
+ * @returns {Promise<GenerateTextResult<TOOLS, never>>}
32
+ */
33
+ generate(args) {
34
+ const promptArgs = "messages" in args
35
+ ? { messages: args.messages }
36
+ : { prompt: args.prompt };
37
+ if (!args.onStdout) {
38
+ return super.generate({
39
+ options: args.options,
40
+ abortSignal: args.abortSignal,
41
+ ...promptArgs,
42
+ timeout: args.timeout,
43
+ onStepFinish: args.onStepFinish,
44
+ });
45
+ }
46
+ return super.stream({
47
+ options: args.options,
48
+ abortSignal: args.abortSignal,
49
+ ...promptArgs,
50
+ timeout: args.timeout,
51
+ onStepFinish: args.onStepFinish,
52
+ }).then((stream) => streamResultToGenerateResult(stream, args.onStdout));
53
+ }
54
+ }
@@ -0,0 +1,8 @@
1
+ import type { anthropic } from "@ai-sdk/anthropic";
2
+ import type { ToolSet } from "ai";
3
+ import type { SdkAgentOptions } from "./SdkAgentOptions";
4
+
5
+ export type AnthropicAgentOptions<
6
+ CALL_OPTIONS = never,
7
+ TOOLS extends ToolSet = {},
8
+ > = SdkAgentOptions<CALL_OPTIONS, TOOLS, ReturnType<typeof anthropic>>;
@@ -0,0 +1,10 @@
1
+ export type AgentCliActionKind =
2
+ | "turn"
3
+ | "command"
4
+ | "tool"
5
+ | "file_change"
6
+ | "web_search"
7
+ | "todo_list"
8
+ | "reasoning"
9
+ | "warning"
10
+ | "note";
@@ -0,0 +1,44 @@
1
+ import type { AgentCliActionKind } from "./AgentCliActionKind";
2
+
3
+ export type AgentCliActionPhase = "started" | "updated" | "completed";
4
+
5
+ export type AgentCliEventLevel = "debug" | "info" | "warning" | "error";
6
+
7
+ export type AgentCliStartedEvent = {
8
+ type: "started";
9
+ engine: string;
10
+ title: string;
11
+ resume?: string;
12
+ detail?: Record<string, unknown>;
13
+ };
14
+
15
+ export type AgentCliActionEvent = {
16
+ type: "action";
17
+ engine: string;
18
+ phase: AgentCliActionPhase;
19
+ entryType?: "thought" | "message";
20
+ action: {
21
+ id: string;
22
+ kind: AgentCliActionKind;
23
+ title: string;
24
+ detail?: Record<string, unknown>;
25
+ };
26
+ message?: string;
27
+ ok?: boolean;
28
+ level?: AgentCliEventLevel;
29
+ };
30
+
31
+ export type AgentCliCompletedEvent = {
32
+ type: "completed";
33
+ engine: string;
34
+ ok: boolean;
35
+ answer?: string;
36
+ error?: string;
37
+ resume?: string;
38
+ usage?: Record<string, unknown>;
39
+ };
40
+
41
+ export type AgentCliEvent =
42
+ | AgentCliStartedEvent
43
+ | AgentCliActionEvent
44
+ | AgentCliCompletedEvent;