@agent-api/cli 0.2.0 → 0.3.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 (61) hide show
  1. package/README.md +11 -5
  2. package/dist/index.js +8 -6
  3. package/dist/runtime.d.ts +4 -0
  4. package/dist/runtime.js +4 -0
  5. package/dist/tui/ink/app.d.ts +1 -1
  6. package/dist/tui/ink/app.js +27 -126
  7. package/dist/tui/ink/components.d.ts +1 -2
  8. package/dist/tui/ink/components.js +1 -3
  9. package/package.json +9 -6
  10. package/dist/agent/runner.d.ts +0 -117
  11. package/dist/agent/runner.js +0 -486
  12. package/dist/agent.d.ts +0 -2
  13. package/dist/agent.js +0 -2
  14. package/dist/chat-options.d.ts +0 -37
  15. package/dist/chat-options.js +0 -42
  16. package/dist/config.d.ts +0 -66
  17. package/dist/config.js +0 -201
  18. package/dist/conversation/index.d.ts +0 -17
  19. package/dist/conversation/index.js +0 -54
  20. package/dist/profile.d.ts +0 -57
  21. package/dist/profile.js +0 -211
  22. package/dist/runtime/index.d.ts +0 -5
  23. package/dist/runtime/index.js +0 -104
  24. package/dist/tui/workbench.d.ts +0 -187
  25. package/dist/tui/workbench.js +0 -392
  26. package/dist/update.d.ts +0 -16
  27. package/dist/update.js +0 -74
  28. package/dist/workbench/auth-controller.d.ts +0 -43
  29. package/dist/workbench/auth-controller.js +0 -84
  30. package/dist/workbench/auth-gate-controller.d.ts +0 -62
  31. package/dist/workbench/auth-gate-controller.js +0 -231
  32. package/dist/workbench/command-controller.d.ts +0 -29
  33. package/dist/workbench/command-controller.js +0 -426
  34. package/dist/workbench/conversation-controller.d.ts +0 -32
  35. package/dist/workbench/conversation-controller.js +0 -53
  36. package/dist/workbench/engine.d.ts +0 -66
  37. package/dist/workbench/engine.js +0 -291
  38. package/dist/workbench/input-controller.d.ts +0 -44
  39. package/dist/workbench/input-controller.js +0 -71
  40. package/dist/workbench/isolator-installer.d.ts +0 -29
  41. package/dist/workbench/isolator-installer.js +0 -208
  42. package/dist/workbench/lifecycle-controller.d.ts +0 -30
  43. package/dist/workbench/lifecycle-controller.js +0 -75
  44. package/dist/workbench/local-controller.d.ts +0 -21
  45. package/dist/workbench/local-controller.js +0 -94
  46. package/dist/workbench/render-model.d.ts +0 -46
  47. package/dist/workbench/render-model.js +0 -61
  48. package/dist/workbench/runtime-controller.d.ts +0 -12
  49. package/dist/workbench/runtime-controller.js +0 -57
  50. package/dist/workbench/session.d.ts +0 -27
  51. package/dist/workbench/session.js +0 -42
  52. package/dist/workbench/settings-controller.d.ts +0 -79
  53. package/dist/workbench/settings-controller.js +0 -288
  54. package/dist/workbench/shell-isolation.d.ts +0 -20
  55. package/dist/workbench/shell-isolation.js +0 -13
  56. package/dist/workbench/turn-controller.d.ts +0 -25
  57. package/dist/workbench/turn-controller.js +0 -164
  58. package/dist/workbench/view-model.d.ts +0 -34
  59. package/dist/workbench/view-model.js +0 -121
  60. package/dist/workdir/index.d.ts +0 -22
  61. package/dist/workdir/index.js +0 -46
package/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Agent API CLI
2
2
 
3
- First-class command line interface for Agent API. The CLI is built on `@agent-api/sdk@^1.2.2` with Commander for command routing and Ink for interactive terminal UI.
3
+ First-class command line interface for Agent API. The CLI shell is built on `@agent-api/app-engine`, which wraps `@agent-api/sdk@^1.3.0` behind a renderer-neutral application core. Commander handles command routing, and Ink renders the current terminal UI.
4
+
5
+ This repository publishes two packages:
6
+
7
+ - `@agent-api/app-engine`: reusable application core for agent apps.
8
+ - `@agent-api/cli`: command-line shell and Ink TUI renderer.
4
9
 
5
10
  ## Development
6
11
 
@@ -40,10 +45,11 @@ If your npm account requires two-factor auth for publish:
40
45
  npm run release:local -- --otp 123456
41
46
  ```
42
47
 
43
- The local release script runs `npm ci`, builds and tests the package, creates an
44
- npm tarball in `artifacts/`, installs that tarball into a temporary npm prefix,
45
- smoke-tests the published bin aliases, and then publishes the verified tarball
46
- with `npm publish --access public`.
48
+ The local release script runs `npm ci`, builds and tests both packages, creates
49
+ npm tarballs in `artifacts/`, installs the app-engine and CLI tarballs into a
50
+ temporary npm prefix, smoke-tests the published bin aliases, and then publishes
51
+ `@agent-api/app-engine` before `@agent-api/cli` with
52
+ `npm publish --access public`.
47
53
 
48
54
  For a no-publish rehearsal:
49
55
 
package/dist/index.js CHANGED
@@ -4,13 +4,15 @@ import { stat } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { render } from "ink";
6
6
  import React from "react";
7
- import { conversationSummary, deleteConversation, getConversation, listConversations, runAgent } from "./agent.js";
8
- import { normalizeChatOptions } from "./chat-options.js";
7
+ import { activeProfile, configureAgentAppRuntime, conversationSummary, deleteConversation, deleteProfile, getConversation, listConversations, listProfiles, loadConfig, loadConversationConfiguration, loginWithAPIKey, loginWithBrowser, normalizeChatOptions, openWorkdir, profileSummary, redactSecret, resolveRuntimeProfile, runAgent, runtime, useProfile, } from "@agent-api/app-engine";
9
8
  import { ChatApp } from "./tui/chat.js";
10
- import { activeProfile, loadConfig, loadConversationConfiguration, redactSecret } from "./config.js";
11
- import { cliVersion, runtime } from "./runtime/index.js";
12
- import { openWorkdir } from "./workdir/index.js";
13
- import { deleteProfile, listProfiles, loginWithAPIKey, loginWithBrowser, profileSummary, resolveRuntimeProfile, useProfile, } from "./profile.js";
9
+ import { cliAuthor, cliName, cliVersion, legacyCliName } from "./runtime.js";
10
+ configureAgentAppRuntime({
11
+ appName: cliName,
12
+ appAuthor: cliAuthor,
13
+ appVersion: cliVersion,
14
+ legacyAppName: legacyCliName,
15
+ });
14
16
  const program = new Command();
15
17
  program
16
18
  .name("agent-api")
@@ -0,0 +1,4 @@
1
+ export declare const cliName = "agent-tui";
2
+ export declare const cliAuthor = "AgentsWay";
3
+ export declare const cliVersion = "0.3.0";
4
+ export declare const legacyCliName = "agent-api-cli";
@@ -0,0 +1,4 @@
1
+ export const cliName = "agent-tui";
2
+ export const cliAuthor = "AgentsWay";
3
+ export const cliVersion = "0.3.0";
4
+ export const legacyCliName = "agent-api-cli";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { type AgentRunOptions } from "../../agent.js";
2
+ import { type AgentRunOptions } from "@agent-api/app-engine";
3
3
  export declare function ChatApp({ options }: {
4
4
  options: AgentRunOptions;
5
5
  }): React.JSX.Element;
@@ -1,12 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { useApp, useInput, useStdout } from "ink";
4
- import { defaultBaseURL } from "../../config.js";
5
- import { createWorkbenchAuthController } from "../../workbench/auth-controller.js";
6
- import { createWorkbenchAuthGateController, } from "../../workbench/auth-gate-controller.js";
7
- import { createWorkbenchCommandController } from "../../workbench/command-controller.js";
8
- import { buildWorkbenchRenderModel, } from "../../workbench/render-model.js";
9
- import { createWorkbenchSession } from "../../workbench/session.js";
4
+ import { buildWorkbenchRenderModel, createAgentEngine, createWorkbenchAuthController, createWorkbenchAuthGateController, defaultBaseURL, } from "@agent-api/app-engine";
10
5
  import { InkAuthGate, InkWorkbenchScreen } from "./components.js";
11
6
  export function ChatApp({ options }) {
12
7
  return _jsx(AuthenticatedChatApp, { options: options });
@@ -113,38 +108,24 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
113
108
  const [draft, setDraft] = useState("");
114
109
  const [spinnerFrame, setSpinnerFrame] = useState(0);
115
110
  const [transcriptOffset, setTranscriptOffset] = useState(0);
116
- const sessionRef = useRef(null);
117
- if (!sessionRef.current) {
118
- sessionRef.current = createWorkbenchSession({
111
+ const agentEngineRef = useRef(null);
112
+ if (!agentEngineRef.current) {
113
+ agentEngineRef.current = createAgentEngine({
119
114
  authController,
120
115
  baseOptions: options,
116
+ profileName,
117
+ onDeleteProfile,
118
+ onExit: app.exit,
119
+ onLogin,
120
+ onLogout,
121
+ onSwitchProfile,
121
122
  });
122
123
  }
123
- const session = sessionRef.current;
124
- const engine = session.engine;
125
- const conversationController = session.conversation;
124
+ const agentEngine = agentEngineRef.current;
125
+ const session = agentEngine.session;
126
126
  const inputController = session.input;
127
- const lifecycleController = session.lifecycle;
128
- const localController = session.local;
129
- const settingsController = session.settings;
130
- const turnController = session.turn;
131
- const state = useSyncExternalStore(engine.subscribe, engine.snapshot, engine.snapshot);
132
- const dispatch = engine.dispatch;
133
- const commandController = createWorkbenchCommandController({
134
- authController,
135
- conversationController,
136
- engine,
137
- localController,
138
- options,
139
- profileName,
140
- settingsController,
141
- turnController,
142
- onDeleteProfile,
143
- onExit: app.exit,
144
- onLogin,
145
- onLogout,
146
- onSwitchProfile,
147
- });
127
+ const state = useSyncExternalStore(agentEngine.subscribe, agentEngine.snapshot, agentEngine.snapshot);
128
+ const dispatch = agentEngine.dispatch;
148
129
  const renderModel = useMemo(() => buildWorkbenchRenderModel({
149
130
  draft,
150
131
  profileName,
@@ -171,70 +152,27 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
171
152
  }
172
153
  useEffect(() => {
173
154
  let mounted = true;
174
- lifecycleController.maybeCheckForUpdate()
175
- .then((effects) => {
176
- if (mounted)
177
- runLifecycleEffects(effects, () => mounted);
178
- });
179
- settingsController.loadInitial({
180
- modelExplicit: options.modelExplicit,
181
- preset: options.preset,
182
- presetExplicit: options.presetExplicit,
183
- })
184
- .then((settings) => {
185
- if (!mounted)
186
- return;
187
- dispatch({ type: "settings.set", settings });
188
- if (settings.activity) {
189
- dispatch({ type: "activity.add", level: "success", text: settings.activity });
190
- }
191
- if (settings.warning) {
192
- dispatch({ type: "activity.add", level: "warning", text: settings.warning });
193
- }
194
- })
195
- .catch((error) => {
196
- if (!mounted)
197
- return;
198
- dispatch({ type: "activity.add", level: "warning", text: `Config preferences unavailable: ${userFacingError(error)}` });
199
- });
155
+ void agentEngine.maybeCheckForUpdate({ isMounted: () => mounted });
156
+ void agentEngine.loadInitialSettings({ isMounted: () => mounted });
200
157
  return () => {
201
158
  mounted = false;
202
159
  };
203
- }, [dispatch, lifecycleController, options.modelExplicit, options.preset, options.presetExplicit, settingsController]);
160
+ }, [agentEngine]);
204
161
  useEffect(() => {
205
162
  if (!state.contextEnabled || state.workdir)
206
163
  return;
207
164
  let mounted = true;
208
- dispatch({ type: "activity.add", text: "Loading workdir" });
209
- localController.load(options.workdir || process.cwd())
210
- .then((workdir) => {
211
- if (!mounted)
212
- return;
213
- dispatch({
214
- type: "workdir.set",
215
- workdir,
216
- });
217
- })
218
- .catch((error) => {
219
- if (!mounted)
220
- return;
221
- dispatch({
222
- type: "activity.add",
223
- level: "error",
224
- text: `Workdir unavailable: ${error instanceof Error ? error.message : String(error)}`,
225
- });
226
- });
165
+ void agentEngine.loadWorkdir(options.workdir || process.cwd(), { isMounted: () => mounted });
227
166
  return () => {
228
167
  mounted = false;
229
168
  };
230
- }, [dispatch, localController, options.workdir, state.contextEnabled, state.workdir]);
169
+ }, [agentEngine, options.workdir, state.contextEnabled, state.workdir]);
231
170
  useEffect(() => {
232
171
  let mounted = true;
233
172
  const refreshIntervalMs = 60_000;
234
173
  const refreshAuth = async () => {
235
- const effects = await lifecycleController.refreshAuth(options.profile);
236
174
  if (mounted)
237
- runLifecycleEffects(effects, () => mounted);
175
+ await agentEngine.refreshAuth(options.profile, { isMounted: () => mounted });
238
176
  };
239
177
  void refreshAuth();
240
178
  const interval = setInterval(refreshAuth, refreshIntervalMs);
@@ -242,7 +180,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
242
180
  mounted = false;
243
181
  clearInterval(interval);
244
182
  };
245
- }, [lifecycleController, options.profile]);
183
+ }, [agentEngine, options.profile]);
246
184
  useInput((input, key) => {
247
185
  const result = inputController.handle(input, key, {
248
186
  busy: state.busy,
@@ -266,10 +204,10 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
266
204
  scrollTranscriptToBottom();
267
205
  break;
268
206
  case "abort":
269
- void turnController.abort("Abort requested.");
207
+ void agentEngine.abortActiveTurn("Abort requested.");
270
208
  break;
271
209
  case "submit":
272
- void submit(effect.input);
210
+ void agentEngine.submit(effect.input);
273
211
  break;
274
212
  case "ignored_busy":
275
213
  dispatch({ type: "message.add", role: "system", text: "Agent turn is running. Use /abort or Esc to cancel it." });
@@ -279,15 +217,8 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
279
217
  }
280
218
  });
281
219
  useEffect(() => {
282
- const initialPrompt = lifecycleController.initialPrompt({
283
- busy: state.busy,
284
- promptParts: options.promptParts,
285
- requiresWorkdir: state.contextEnabled,
286
- workdir: state.workdir,
287
- });
288
- if (initialPrompt)
289
- void turnController.startPrompt(initialPrompt);
290
- }, [lifecycleController, options.promptParts, state.busy, state.contextEnabled, state.workdir, turnController]);
220
+ void agentEngine.startInitialPrompt();
221
+ }, [agentEngine, state.busy, state.contextEnabled, state.workdir]);
291
222
  useEffect(() => {
292
223
  if (!state.busy) {
293
224
  setSpinnerFrame(0);
@@ -299,37 +230,7 @@ function WorkbenchApp({ authController, onLogin, onLogout, onDeleteProfile, onSw
299
230
  return () => clearInterval(interval);
300
231
  }, [state.busy]);
301
232
  useEffect(() => {
302
- return () => session.runtime.dispose();
303
- }, [session.runtime]);
304
- function runLifecycleEffects(effects, isMounted) {
305
- for (const effect of effects) {
306
- switch (effect.type) {
307
- case "dispatch":
308
- dispatch(effect.action);
309
- break;
310
- case "close":
311
- setTimeout(() => {
312
- if (isMounted())
313
- app.exit();
314
- }, effect.delayMs);
315
- break;
316
- }
317
- }
318
- }
319
- async function submit(input) {
320
- const submission = engine.submit(input);
321
- if (submission.kind === "command") {
322
- await commandController.run(submission.command);
323
- return;
324
- }
325
- if (submission.kind === "prompt") {
326
- await turnController.startPrompt(submission.prompt);
327
- }
328
- }
233
+ return () => agentEngine.dispose();
234
+ }, [agentEngine]);
329
235
  return _jsx(InkWorkbenchScreen, { renderModel: renderModel, spinnerFrame: spinnerFrame });
330
236
  }
331
- function userFacingError(error) {
332
- if (error instanceof Error)
333
- return error.message;
334
- return String(error);
335
- }
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { type AuthGateState } from "../../workbench/auth-gate-controller.js";
3
- import { type WorkbenchRenderModel } from "../../workbench/render-model.js";
2
+ import { type AuthGateState, type WorkbenchRenderModel } from "@agent-api/app-engine";
4
3
  export declare function InkWorkbenchScreen({ renderModel, spinnerFrame, }: {
5
4
  renderModel: WorkbenchRenderModel;
6
5
  spinnerFrame: number;
@@ -1,8 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
- import { authMethods } from "../../workbench/auth-gate-controller.js";
4
- import { busySpinner } from "../../workbench/render-model.js";
5
- import { activityColor, } from "../workbench.js";
3
+ import { activityColor, authMethods, busySpinner, } from "@agent-api/app-engine";
6
4
  export function InkWorkbenchScreen({ renderModel, spinnerFrame, }) {
7
5
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Header, { contextEnabled: renderModel.header.contextEnabled, conversation: renderModel.header.conversation, model: renderModel.header.model, accessMode: renderModel.header.accessMode, pendingLocalLabel: renderModel.header.pendingLocalLabel, preset: renderModel.header.preset, profile: renderModel.header.profile, renderMode: renderModel.header.renderMode, workdir: renderModel.header.workdir }), _jsxs(Box, { marginTop: 1, height: renderModel.viewportHeight, children: [_jsxs(Box, { flexDirection: "column", width: "72%", paddingRight: 1, children: [renderModel.transcript.visibleLines.map((line) => (_jsx(Text, { bold: line.bold, color: line.color, inverse: line.inverse, wrap: "truncate", children: line.text || " " }, line.id))), renderModel.transcript.visibleLines.length === 0 && _jsx(Text, { color: "gray", children: "No transcript lines." })] }), _jsxs(Box, { flexDirection: "column", width: "28%", height: renderModel.activityHeight, borderStyle: "single", borderColor: "gray", paddingX: 1, children: [_jsx(Text, { bold: true, wrap: "truncate", children: "Activity" }), renderModel.visibleActivities.map((activity) => (_jsxs(Text, { color: activityColor(activity.level), wrap: "truncate", children: [new Date(activity.timestamp).toLocaleTimeString(), " ", activity.text] }, activity.id)))] })] }), _jsxs(Box, { borderStyle: "single", borderColor: renderModel.input.busy ? "yellow" : "green", paddingX: 1, children: [renderModel.input.fullAccess && (_jsx(Text, { color: "red", bold: true, inverse: true, children: "FULL ACCESS" })), renderModel.input.fullAccess && _jsx(Text, { children: " " }), _jsxs(Text, { color: renderModel.input.busy ? "yellow" : "green", children: [renderModel.input.label, " "] }), renderModel.input.busy ? (_jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: "yellow", children: busySpinner(spinnerFrame) }), " ", renderModel.input.waitingText] })) : (_jsxs(Text, { wrap: "truncate", children: [renderModel.input.draft, _jsx(Cursor, { visible: true })] }))] }), _jsx(Box, { paddingX: 1, children: _jsx(Text, { color: "gray", wrap: "truncate", children: renderModel.footerText }) })] }));
8
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-api/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "First-class command line interface for Agent API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/scalebox-dev/agent-tui#readme",
@@ -12,6 +12,9 @@
12
12
  "url": "https://github.com/scalebox-dev/agent-tui/issues"
13
13
  },
14
14
  "type": "module",
15
+ "workspaces": [
16
+ "packages/app-engine"
17
+ ],
15
18
  "bin": {
16
19
  "agent-api": "dist/index.js",
17
20
  "agentsway": "dist/index.js",
@@ -20,7 +23,8 @@
20
23
  "scripts": {
21
24
  "sync-version": "node scripts/sync-version.mjs",
22
25
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
23
- "build": "npm run clean && tsc -p tsconfig.json && node scripts/prepare-bin.mjs",
26
+ "build:app-engine": "npm run build -w @agent-api/app-engine",
27
+ "build": "npm run build:app-engine && npm run clean && tsc -p tsconfig.json && node scripts/prepare-bin.mjs",
24
28
  "dev": "npm run build && node dist/index.js",
25
29
  "dev:link": "node scripts/dev-link.mjs",
26
30
  "start": "node dist/index.js",
@@ -28,14 +32,13 @@
28
32
  "pack:local": "npm pack --pack-destination ./artifacts",
29
33
  "release:local": "node scripts/release-local.mjs",
30
34
  "prepack": "npm run sync-version && npm run build",
31
- "test": "npm run sync-version && npm run build && node --test test/*.test.mjs"
35
+ "test": "npm run sync-version && npm run build && npm run smoke -w @agent-api/app-engine && node --test test/*.test.mjs"
32
36
  },
33
37
  "dependencies": {
34
- "@agent-api/sdk": "^1.3.0",
38
+ "@agent-api/app-engine": "^0.0.1",
35
39
  "commander": "^14.0.3",
36
40
  "ink": "^6.8.0",
37
- "react": "^19.2.7",
38
- "zod": "^4.4.3"
41
+ "react": "^19.2.7"
39
42
  },
40
43
  "devDependencies": {
41
44
  "@types/node": "^24.0.0",
@@ -1,117 +0,0 @@
1
- import { type AgentResponse, type PresetToolCatalogClient, type ResponseStreamEvent, type Tool } from "@agent-api/sdk";
2
- import type { ShellIsolationPreferences } from "../workbench/shell-isolation.js";
3
- export interface AgentRunOptions {
4
- profile?: string;
5
- promptParts: string[];
6
- file?: string;
7
- stdin?: boolean;
8
- preset?: string;
9
- presetExplicit?: boolean;
10
- model?: string;
11
- modelExplicit?: boolean;
12
- stream?: boolean;
13
- conversation?: string;
14
- continueConversation?: boolean;
15
- restartConversation?: boolean;
16
- previousResponseId?: string;
17
- workdir?: string;
18
- includeLocalContext?: boolean;
19
- contextQuery?: string;
20
- maxContextFiles?: number;
21
- maxContextBytes?: number;
22
- accessMode?: WorkdirAccessMode;
23
- shellIsolation?: ShellIsolationPreferences;
24
- abortSignal?: AbortSignal;
25
- }
26
- export type WorkdirAccessMode = "off" | "approval" | "full";
27
- export interface AgentTurnResult {
28
- text: string;
29
- responseID?: string;
30
- }
31
- export interface LocalToolApprovalRequest {
32
- name: string;
33
- action?: string;
34
- arguments: Record<string, unknown>;
35
- preview?: unknown;
36
- callID: string;
37
- responseID: string;
38
- }
39
- export type AgentTurnEvent = {
40
- type: "text.delta";
41
- delta: string;
42
- } | {
43
- type: "response.started";
44
- responseID?: string;
45
- } | {
46
- type: "response.completed";
47
- responseID?: string;
48
- } | {
49
- type: "response.failed";
50
- message: string;
51
- } | {
52
- type: "reasoning.started";
53
- } | {
54
- type: "reasoning.stopped";
55
- thought?: string;
56
- } | {
57
- type: "reasoning.search_queries";
58
- queries: string[];
59
- } | {
60
- type: "reasoning.search_results";
61
- count: number;
62
- } | {
63
- type: "reasoning.fetch_url_queries";
64
- urls: string[];
65
- } | {
66
- type: "reasoning.fetch_url_results";
67
- count: number;
68
- } | {
69
- type: "tool.completed";
70
- name: string;
71
- status?: string;
72
- } | {
73
- type: "local_tool.completed";
74
- name: string;
75
- action?: string;
76
- requiresApproval?: boolean;
77
- } | ({
78
- type: "local_tool.approval_requested";
79
- } & LocalToolApprovalRequest) | {
80
- type: "model.requested";
81
- model?: string;
82
- provider?: string;
83
- } | {
84
- type: "model.completed";
85
- model?: string;
86
- provider?: string;
87
- } | {
88
- type: "model.failed";
89
- model?: string;
90
- provider?: string;
91
- } | {
92
- type: "step.completed";
93
- stepType?: string;
94
- } | {
95
- type: "step.failed";
96
- stepType?: string;
97
- } | {
98
- type: "raw";
99
- eventType: string;
100
- };
101
- export interface ResolveAgentRequestToolsOptions {
102
- baseURL?: string;
103
- cacheTTLMS?: number;
104
- }
105
- export interface PresetSummary {
106
- preset: string;
107
- description?: string;
108
- }
109
- export declare function runAgent(options: AgentRunOptions): Promise<void>;
110
- export declare function runAgentTurn(options: AgentRunOptions, onEvent?: (event: AgentTurnEvent) => void): Promise<AgentTurnResult>;
111
- export declare function resumeAgentAfterLocalApproval(options: AgentRunOptions, approval: LocalToolApprovalRequest, output: string | Record<string, unknown>, onEvent?: (event: AgentTurnEvent) => void): Promise<AgentTurnResult>;
112
- export declare function listAvailablePresets(profileName?: string): Promise<PresetSummary[]>;
113
- export declare function isAvailablePreset(profileName: string | undefined, preset: string): Promise<boolean>;
114
- export declare function agentResponseFailureMessage(response: AgentResponse): string;
115
- export declare function agentTurnEventFromStreamEvent(event: ResponseStreamEvent): AgentTurnEvent | null;
116
- export declare function resolveAgentRequestTools(client: PresetToolCatalogClient, preset?: string, tools?: readonly Tool[], options?: ResolveAgentRequestToolsOptions): Promise<Tool[] | undefined>;
117
- export declare function clearPresetToolCatalogCache(baseURL?: string): void;