deepagentsdk 0.12.0 → 0.14.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 (37) hide show
  1. package/dist/adapters/elements/index.cjs +478 -288
  2. package/dist/adapters/elements/index.cjs.map +1 -1
  3. package/dist/adapters/elements/index.d.cts +107 -172
  4. package/dist/adapters/elements/index.d.mts +107 -172
  5. package/dist/adapters/elements/index.mjs +471 -284
  6. package/dist/adapters/elements/index.mjs.map +1 -1
  7. package/dist/{types-4g9UvXal.d.mts → agent-D0bKkNI-.d.mts} +352 -3
  8. package/dist/{types-IulnvhFg.d.cts → agent-DwAj5emJ.d.cts} +352 -3
  9. package/dist/{chunk-CbDLau6x.cjs → chunk-C5azi7Hr.cjs} +33 -0
  10. package/dist/cli/index.cjs +12 -12
  11. package/dist/cli/index.cjs.map +1 -1
  12. package/dist/cli/index.mjs +2 -2
  13. package/dist/cli/index.mjs.map +1 -1
  14. package/dist/{agent-Cuks-Idh.cjs → file-saver-BYPKakT4.cjs} +799 -205
  15. package/dist/file-saver-BYPKakT4.cjs.map +1 -0
  16. package/dist/{agent-CrH-He58.mjs → file-saver-Hj5so3dV.mjs} +793 -199
  17. package/dist/file-saver-Hj5so3dV.mjs.map +1 -0
  18. package/dist/index.cjs +83 -73
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +5 -353
  21. package/dist/index.d.mts +5 -353
  22. package/dist/index.mjs +13 -3
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{load-B6CA5js_.mjs → load-BBYEnMwz.mjs} +1 -1
  25. package/dist/{load-B6CA5js_.mjs.map → load-BBYEnMwz.mjs.map} +1 -1
  26. package/dist/{load-94gjHorc.mjs → load-BDxe6Cet.mjs} +1 -1
  27. package/dist/{load-79a2H4m0.cjs → load-BrRAKlO6.cjs} +2 -2
  28. package/dist/{load-79a2H4m0.cjs.map → load-BrRAKlO6.cjs.map} +1 -1
  29. package/dist/load-DqllBbDc.cjs +4 -0
  30. package/package.json +1 -1
  31. package/dist/agent-CrH-He58.mjs.map +0 -1
  32. package/dist/agent-Cuks-Idh.cjs.map +0 -1
  33. package/dist/file-saver-BJCqMIb5.mjs +0 -655
  34. package/dist/file-saver-BJCqMIb5.mjs.map +0 -1
  35. package/dist/file-saver-C6O2LAvg.cjs +0 -679
  36. package/dist/file-saver-C6O2LAvg.cjs.map +0 -1
  37. package/dist/load-C2qVmZMp.cjs +0 -3
@@ -1,5 +1,5 @@
1
1
  import * as ai18 from "ai";
2
- import { LanguageModel, LanguageModel as LanguageModel$2, LanguageModelMiddleware, ModelMessage, ModelMessage as ModelMessage$1, StopCondition, ToolLoopAgentSettings, ToolSet } from "ai";
2
+ import { LanguageModel, LanguageModel as LanguageModel$2, LanguageModelMiddleware, ModelMessage, ModelMessage as ModelMessage$1, StopCondition, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/checkpointer/types.d.ts
@@ -1147,5 +1147,354 @@ declare function getStructuredOutput<T>(result: any): T | undefined;
1147
1147
  */
1148
1148
  declare function getEventOutput<T>(event: any): T | undefined;
1149
1149
  //#endregion
1150
- export { createReadFileTool as $, TodosChangedEvent as A, InterruptData as At, InterruptOnConfig as B, HttpRequestStartEvent as C, GrepMatch as Ct, SubagentFinishEvent as D, BaseCheckpointSaver as Dt, StreamWithEventsOptions as E, isSandboxBackend as Et, AgentMemoryOptions as F, execute as G, CreateExecuteToolOptions as H, CreateDeepAgentParams as I, createEditFileTool as J, createTodosTool as K, SummarizationConfig as L, ToolResultEvent as M, ResumeOptions as Mt, WebSearchFinishEvent as N, SubagentStartEvent as O, Checkpoint as Ot, WebSearchStartEvent as P, createLsTool as Q, TodoItem as R, HttpRequestFinishEvent as S, FileInfo as St, StepStartEvent as T, WriteResult as Tt, createExecuteTool as U, SubAgent as V, createExecuteToolFromBackend as W, createGlobTool as X, createFilesystemTools as Y, createGrepTool as Z, FetchUrlFinishEvent as _, BackendProtocol as _t, getStructuredOutput as a, read_file as at, FileWriteStartEvent as b, ExecuteResponse as bt, ApprovalResponseEvent as c, createFetchUrlTool as ct, DeepAgentEvent as d, createWebTools as dt, createWriteFileTool as et, DoneEvent as f, fetch_url as ft, ExecuteStartEvent as g, BackendFactory as gt, ExecuteFinishEvent as h, web_search as ht, getEventOutput as i, ls as it, ToolCallEvent as j, ResumeDecision as jt, TextEvent as k, CheckpointSaverOptions as kt, CheckpointLoadedEvent as l, createHttpRequestTool as lt, EventCallback as m, http_request as mt, StructuredAgentResult as n, glob as nt, hasStructuredOutput as o, write_file as ot, ErrorEvent as p, htmlToMarkdown as pt, write_todos as q, eventHasStructuredOutput as r, grep as rt, ApprovalRequestedEvent as s, CreateWebToolsOptions as st, ModelMessage$1 as t, edit_file as tt, CheckpointSavedEvent as u, createWebSearchTool as ut, FetchUrlStartEvent as v, DeepAgentState as vt, StepFinishEvent as w, SandboxBackendProtocol as wt, FileWrittenEvent as x, FileData as xt, FileEditedEvent as y, EditResult as yt, DynamicApprovalConfig as z };
1151
- //# sourceMappingURL=types-IulnvhFg.d.cts.map
1150
+ //#region src/agent.d.ts
1151
+ /**
1152
+ * Deep Agent wrapper class that provides generate() and stream() methods.
1153
+ * Uses ToolLoopAgent from AI SDK v6 for the agent loop.
1154
+ */
1155
+ declare class DeepAgent {
1156
+ private model;
1157
+ private systemPrompt;
1158
+ private userTools;
1159
+ private maxSteps;
1160
+ private backend;
1161
+ private subagentOptions;
1162
+ private toolResultEvictionLimit?;
1163
+ private enablePromptCaching;
1164
+ private summarizationConfig?;
1165
+ private hasSandboxBackend;
1166
+ private interruptOn?;
1167
+ private checkpointer?;
1168
+ private skillsMetadata;
1169
+ private outputConfig?;
1170
+ private loopControl?;
1171
+ private generationOptions?;
1172
+ private advancedOptions?;
1173
+ constructor(params: CreateDeepAgentParams);
1174
+ /**
1175
+ * Create core tools (todos and filesystem).
1176
+ * @private
1177
+ */
1178
+ private createCoreTools;
1179
+ /**
1180
+ * Create web tools if TAVILY_API_KEY is available.
1181
+ * Uses dynamic import to avoid bundling Node.js dependencies in client builds.
1182
+ * @private
1183
+ */
1184
+ private createWebToolSet;
1185
+ /**
1186
+ * Create execute tool if backend is a sandbox.
1187
+ * @private
1188
+ */
1189
+ private createExecuteToolSet;
1190
+ /**
1191
+ * Create subagent tool if configured.
1192
+ * @private
1193
+ */
1194
+ private createSubagentToolSet;
1195
+ /**
1196
+ * Create all tools for the agent, combining core, web, execute, and subagent tools.
1197
+ * @private
1198
+ */
1199
+ private createTools;
1200
+ /**
1201
+ * Build stop conditions with maxSteps safety limit.
1202
+ * Combines user-provided stop conditions with the maxSteps limit.
1203
+ */
1204
+ private buildStopConditions;
1205
+ /**
1206
+ * Build agent settings by combining passthrough options with defaults.
1207
+ */
1208
+ private buildAgentSettings;
1209
+ /**
1210
+ * Create a ToolLoopAgent for a given state.
1211
+ * @param state - The shared agent state
1212
+ * @param maxSteps - Optional max steps override
1213
+ * @param onEvent - Optional callback for emitting events
1214
+ */
1215
+ private createAgent;
1216
+ /**
1217
+ * Load skills from directory asynchronously.
1218
+ * Supports both legacy skillsDir and new agentId modes.
1219
+ */
1220
+ private loadSkills;
1221
+ /**
1222
+ * Generate a response (non-streaming).
1223
+ */
1224
+ generate(options: {
1225
+ prompt: string;
1226
+ maxSteps?: number;
1227
+ }): Promise<ai18.GenerateTextResult<{}, never> & {
1228
+ state: DeepAgentState;
1229
+ }>;
1230
+ /**
1231
+ * Stream a response.
1232
+ */
1233
+ stream(options: {
1234
+ prompt: string;
1235
+ maxSteps?: number;
1236
+ }): Promise<ai18.StreamTextResult<{}, never> & {
1237
+ state: DeepAgentState;
1238
+ }>;
1239
+ /**
1240
+ * Generate with an existing state (for continuing conversations).
1241
+ */
1242
+ generateWithState(options: {
1243
+ prompt: string;
1244
+ state: DeepAgentState;
1245
+ maxSteps?: number;
1246
+ }): Promise<ai18.GenerateTextResult<{}, never> & {
1247
+ state: DeepAgentState;
1248
+ }>;
1249
+ /**
1250
+ * Get the underlying ToolLoopAgent for advanced usage.
1251
+ * This allows using AI SDK's createAgentUIStream and other utilities.
1252
+ */
1253
+ getAgent(state?: DeepAgentState): ToolLoopAgent<never, {}, never>;
1254
+ /**
1255
+ * Stream a response with real-time events.
1256
+ * This is an async generator that yields DeepAgentEvent objects.
1257
+ *
1258
+ * Supports conversation history via the `messages` option for multi-turn conversations.
1259
+ *
1260
+ * @example
1261
+ * ```typescript
1262
+ * // Single turn
1263
+ * for await (const event of agent.streamWithEvents({ prompt: "..." })) {
1264
+ * switch (event.type) {
1265
+ * case 'text':
1266
+ * process.stdout.write(event.text);
1267
+ * break;
1268
+ * case 'done':
1269
+ * // event.messages contains the updated conversation history
1270
+ * console.log('Messages:', event.messages);
1271
+ * break;
1272
+ * }
1273
+ * }
1274
+ *
1275
+ * // Multi-turn conversation
1276
+ * let messages = [];
1277
+ * for await (const event of agent.streamWithEvents({ prompt: "Hello", messages })) {
1278
+ * if (event.type === 'done') {
1279
+ * messages = event.messages; // Save for next turn
1280
+ * }
1281
+ * }
1282
+ * for await (const event of agent.streamWithEvents({ prompt: "Follow up", messages })) {
1283
+ * // Agent now has context from previous turn
1284
+ * }
1285
+ * ```
1286
+ */
1287
+ /**
1288
+ * Compose user's onStepFinish callback with DeepAgent's internal checkpointing logic.
1289
+ * User callback executes first, errors are caught to prevent breaking checkpointing.
1290
+ */
1291
+ private composeOnStepFinish;
1292
+ /**
1293
+ * Compose user's onFinish callback with DeepAgent's internal cleanup logic.
1294
+ */
1295
+ private composeOnFinish;
1296
+ /**
1297
+ * Compose user's prepareStep callback with DeepAgent's internal step preparation.
1298
+ * Returns a function typed as `any` to avoid AI SDK's strict toolName inference.
1299
+ */
1300
+ private composePrepareStep;
1301
+ /**
1302
+ * Build streamText options with callbacks for step tracking and checkpointing.
1303
+ *
1304
+ * @private
1305
+ */
1306
+ private buildStreamTextOptions;
1307
+ /**
1308
+ * Build message array from options, handling validation and priority logic.
1309
+ * Priority: explicit messages > prompt > checkpoint history.
1310
+ *
1311
+ * @private
1312
+ */
1313
+ private buildMessageArray;
1314
+ /**
1315
+ * Load checkpoint context if threadId is provided.
1316
+ * Handles checkpoint restoration and resume from interrupt.
1317
+ *
1318
+ * @private
1319
+ */
1320
+ private loadCheckpointContext;
1321
+ streamWithEvents(options: StreamWithEventsOptions): AsyncGenerator<DeepAgentEvent, void, unknown>;
1322
+ /**
1323
+ * Stream with a simple callback interface.
1324
+ * This is a convenience wrapper around streamWithEvents.
1325
+ */
1326
+ streamWithCallback(options: StreamWithEventsOptions, onEvent: EventCallback): Promise<{
1327
+ state: DeepAgentState;
1328
+ text?: string;
1329
+ messages?: ModelMessage$1[];
1330
+ }>;
1331
+ }
1332
+ /**
1333
+ * Create a Deep Agent with planning, filesystem, and subagent capabilities.
1334
+ *
1335
+ * @param params - Configuration object for the Deep Agent
1336
+ * @param params.model - **Required.** AI SDK LanguageModel instance (e.g., `anthropic('claude-sonnet-4-20250514')`, `openai('gpt-4o')`)
1337
+ * @param params.systemPrompt - Optional custom system prompt for the agent
1338
+ * @param params.tools - Optional custom tools to add to the agent (AI SDK ToolSet)
1339
+ * @param params.subagents - Optional array of specialized subagent configurations for task delegation
1340
+ * @param params.backend - Optional backend for filesystem operations (default: StateBackend for in-memory storage)
1341
+ * @param params.maxSteps - Optional maximum number of steps for the agent loop (default: 100)
1342
+ * @param params.includeGeneralPurposeAgent - Optional flag to include general-purpose subagent (default: true)
1343
+ * @param params.toolResultEvictionLimit - Optional token limit before evicting large tool results to filesystem (default: disabled)
1344
+ * @param params.enablePromptCaching - Optional flag to enable prompt caching for improved performance (Anthropic only, default: false)
1345
+ * @param params.summarization - Optional summarization configuration for automatic conversation summarization
1346
+ * @returns A configured DeepAgent instance
1347
+ *
1348
+ * @see {@link CreateDeepAgentParams} for detailed parameter types
1349
+ *
1350
+ * @example Basic usage
1351
+ * ```typescript
1352
+ * import { createDeepAgent } from 'deepagentsdk';
1353
+ * import { anthropic } from '@ai-sdk/anthropic';
1354
+ *
1355
+ * const agent = createDeepAgent({
1356
+ * model: anthropic('claude-sonnet-4-20250514'),
1357
+ * systemPrompt: 'You are a research assistant...',
1358
+ * });
1359
+ *
1360
+ * const result = await agent.generate({
1361
+ * prompt: 'Research the topic and write a report',
1362
+ * });
1363
+ * ```
1364
+ *
1365
+ * @example With custom tools
1366
+ * ```typescript
1367
+ * import { tool } from 'ai';
1368
+ * import { z } from 'zod';
1369
+ *
1370
+ * const customTool = tool({
1371
+ * description: 'Get current time',
1372
+ * inputSchema: z.object({}),
1373
+ * execute: async () => new Date().toISOString(),
1374
+ * });
1375
+ *
1376
+ * const agent = createDeepAgent({
1377
+ * model: anthropic('claude-sonnet-4-20250514'),
1378
+ * tools: { get_time: customTool },
1379
+ * });
1380
+ * ```
1381
+ *
1382
+ * @example With subagents
1383
+ * ```typescript
1384
+ * const agent = createDeepAgent({
1385
+ * model: anthropic('claude-sonnet-4-20250514'),
1386
+ * subagents: [{
1387
+ * name: 'research-agent',
1388
+ * description: 'Specialized for research tasks',
1389
+ * systemPrompt: 'You are a research specialist...',
1390
+ * }],
1391
+ * });
1392
+ * ```
1393
+ *
1394
+ * @example With StateBackend (default, explicit)
1395
+ * ```typescript
1396
+ * import { StateBackend } from 'deepagentsdk';
1397
+ *
1398
+ * const state = { todos: [], files: {} };
1399
+ * const agent = createDeepAgent({
1400
+ * model: anthropic('claude-sonnet-4-20250514'),
1401
+ * backend: new StateBackend(state), // Ephemeral in-memory storage
1402
+ * });
1403
+ * ```
1404
+ *
1405
+ * @example With FilesystemBackend
1406
+ * ```typescript
1407
+ * import { FilesystemBackend } from 'deepagentsdk';
1408
+ *
1409
+ * const agent = createDeepAgent({
1410
+ * model: anthropic('claude-sonnet-4-20250514'),
1411
+ * backend: new FilesystemBackend({ rootDir: './workspace' }), // Persist to disk
1412
+ * });
1413
+ * ```
1414
+ *
1415
+ * @example With PersistentBackend
1416
+ * ```typescript
1417
+ * import { PersistentBackend, InMemoryStore } from 'deepagentsdk';
1418
+ *
1419
+ * const store = new InMemoryStore();
1420
+ * const agent = createDeepAgent({
1421
+ * model: anthropic('claude-sonnet-4-20250514'),
1422
+ * backend: new PersistentBackend({ store, namespace: 'project-1' }), // Cross-session persistence
1423
+ * });
1424
+ * ```
1425
+ *
1426
+ * @example With CompositeBackend
1427
+ * ```typescript
1428
+ * import { CompositeBackend, FilesystemBackend, StateBackend } from 'deepagentsdk';
1429
+ *
1430
+ * const state = { todos: [], files: {} };
1431
+ * const agent = createDeepAgent({
1432
+ * model: anthropic('claude-sonnet-4-20250514'),
1433
+ * backend: new CompositeBackend(
1434
+ * new StateBackend(state),
1435
+ * { '/persistent/': new FilesystemBackend({ rootDir: './persistent' }) }
1436
+ * ), // Route files by path prefix
1437
+ * });
1438
+ * ```
1439
+ *
1440
+ * @example With middleware for logging and caching
1441
+ * ```typescript
1442
+ * import { createDeepAgent } from 'deepagentsdk';
1443
+ * import { anthropic } from '@ai-sdk/anthropic';
1444
+ *
1445
+ * const loggingMiddleware = {
1446
+ * wrapGenerate: async ({ doGenerate, params }) => {
1447
+ * console.log('Model called with:', params.prompt);
1448
+ * const result = await doGenerate();
1449
+ * console.log('Model returned:', result.text);
1450
+ * return result;
1451
+ * },
1452
+ * };
1453
+ *
1454
+ * const agent = createDeepAgent({
1455
+ * model: anthropic('claude-sonnet-4-20250514'),
1456
+ * middleware: [loggingMiddleware],
1457
+ * });
1458
+ * ```
1459
+ *
1460
+ * @example With middleware factory for context access
1461
+ * ```typescript
1462
+ * import { FilesystemBackend } from 'deepagentsdk';
1463
+ *
1464
+ * function createContextMiddleware(backend: BackendProtocol) {
1465
+ * return {
1466
+ * wrapGenerate: async ({ doGenerate }) => {
1467
+ * const state = await backend.read('state');
1468
+ * const result = await doGenerate();
1469
+ * await backend.write('state', { ...state, lastCall: result });
1470
+ * return result;
1471
+ * },
1472
+ * };
1473
+ * }
1474
+ *
1475
+ * const backend = new FilesystemBackend({ rootDir: './workspace' });
1476
+ * const agent = createDeepAgent({
1477
+ * model: anthropic('claude-sonnet-4-20250514'),
1478
+ * backend,
1479
+ * middleware: createContextMiddleware(backend),
1480
+ * });
1481
+ * ```
1482
+ *
1483
+ * @example With performance optimizations
1484
+ * ```typescript
1485
+ * const agent = createDeepAgent({
1486
+ * model: anthropic('claude-sonnet-4-20250514'),
1487
+ * enablePromptCaching: true,
1488
+ * toolResultEvictionLimit: 20000,
1489
+ * summarization: {
1490
+ * enabled: true,
1491
+ * tokenThreshold: 170000,
1492
+ * keepMessages: 6,
1493
+ * },
1494
+ * });
1495
+ * ```
1496
+ */
1497
+ declare function createDeepAgent(params: CreateDeepAgentParams): DeepAgent;
1498
+ //#endregion
1499
+ export { createLsTool as $, TextEvent as A, CheckpointSaverOptions as At, DynamicApprovalConfig as B, FileWrittenEvent as C, FileInfo as Ct, StepStartEvent as D, isSandboxBackend as Dt, StepFinishEvent as E, WriteResult as Et, WebSearchStartEvent as F, createExecuteToolFromBackend as G, SubAgent as H, AgentMemoryOptions as I, write_todos as J, execute as K, CreateDeepAgentParams as L, ToolCallEvent as M, ResumeDecision as Mt, ToolResultEvent as N, ResumeOptions as Nt, SubagentFinishEvent as O, BaseCheckpointSaver as Ot, WebSearchFinishEvent as P, createGrepTool as Q, SummarizationConfig as R, FileWriteStartEvent as S, FileData as St, HttpRequestStartEvent as T, SandboxBackendProtocol as Tt, CreateExecuteToolOptions as U, InterruptOnConfig as V, createExecuteTool as W, createFilesystemTools as X, createEditFileTool as Y, createGlobTool as Z, ExecuteFinishEvent as _, BackendFactory as _t, eventHasStructuredOutput as a, ls as at, FetchUrlStartEvent as b, EditResult as bt, hasStructuredOutput as c, CreateWebToolsOptions as ct, CheckpointLoadedEvent as d, createWebSearchTool as dt, createReadFileTool as et, CheckpointSavedEvent as f, createWebTools as ft, EventCallback as g, web_search as gt, ErrorEvent as h, http_request as ht, StructuredAgentResult as i, grep as it, TodosChangedEvent as j, InterruptData as jt, SubagentStartEvent as k, Checkpoint as kt, ApprovalRequestedEvent as l, createFetchUrlTool as lt, DoneEvent as m, htmlToMarkdown as mt, createDeepAgent as n, edit_file as nt, getEventOutput as o, read_file as ot, DeepAgentEvent as p, fetch_url as pt, createTodosTool as q, ModelMessage$1 as r, glob as rt, getStructuredOutput as s, write_file as st, DeepAgent as t, createWriteFileTool as tt, ApprovalResponseEvent as u, createHttpRequestTool as ut, ExecuteStartEvent as v, BackendProtocol as vt, HttpRequestFinishEvent as w, GrepMatch as wt, FileEditedEvent as x, ExecuteResponse as xt, FetchUrlFinishEvent as y, DeepAgentState as yt, TodoItem as z };
1500
+ //# sourceMappingURL=agent-DwAj5emJ.d.cts.map
@@ -5,6 +5,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __exportAll = (all, symbols) => {
10
+ let target = {};
11
+ for (var name in all) {
12
+ __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ }
17
+ if (symbols) {
18
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
19
+ }
20
+ return target;
21
+ };
8
22
  var __copyProps = (to, from, except, desc) => {
9
23
  if (from && typeof from === "object" || typeof from === "function") {
10
24
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -23,9 +37,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
37
  value: mod,
24
38
  enumerable: true
25
39
  }) : target, mod));
40
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
41
 
27
42
  //#endregion
28
43
 
44
+ Object.defineProperty(exports, '__esmMin', {
45
+ enumerable: true,
46
+ get: function () {
47
+ return __esmMin;
48
+ }
49
+ });
50
+ Object.defineProperty(exports, '__exportAll', {
51
+ enumerable: true,
52
+ get: function () {
53
+ return __exportAll;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, '__toCommonJS', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return __toCommonJS;
60
+ }
61
+ });
29
62
  Object.defineProperty(exports, '__toESM', {
30
63
  enumerable: true,
31
64
  get: function () {
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- const require_chunk = require('../chunk-CbDLau6x.cjs');
3
- const require_agent = require('../agent-Cuks-Idh.cjs');
4
- const require_file_saver = require('../file-saver-C6O2LAvg.cjs');
2
+ const require_chunk = require('../chunk-C5azi7Hr.cjs');
3
+ const require_file_saver = require('../file-saver-BYPKakT4.cjs');
5
4
  let react = require("react");
6
5
  react = require_chunk.__toESM(react);
7
6
  let ink = require("ink");
@@ -9,6 +8,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
9
8
  let _inkjs_ui = require("@inkjs/ui");
10
9
 
11
10
  //#region src/cli/hooks/useAgent.ts
11
+ require_file_saver.init_limits();
12
12
  /**
13
13
  * Hook for managing agent streaming and events.
14
14
  */
@@ -72,7 +72,7 @@ function useAgent(options) {
72
72
  eviction: evictionLimit > 0,
73
73
  summarization: summarizationEnabled
74
74
  };
75
- const agentRef = (0, react.useRef)(require_agent.createDeepAgent({
75
+ const agentRef = (0, react.useRef)(require_file_saver.createDeepAgent({
76
76
  model: require_file_saver.parseModelString(currentModel),
77
77
  maxSteps: options.maxSteps,
78
78
  systemPrompt: options.systemPrompt,
@@ -497,7 +497,7 @@ function useAgent(options) {
497
497
  if (overrides.interruptOn === null) newInterruptOn = void 0;
498
498
  else if (overrides.interruptOn !== void 0) newInterruptOn = overrides.interruptOn;
499
499
  else newInterruptOn = autoApproveEnabled ? void 0 : options.interruptOn ?? DEFAULT_CLI_INTERRUPT_ON;
500
- agentRef.current = require_agent.createDeepAgent({
500
+ agentRef.current = require_file_saver.createDeepAgent({
501
501
  model: require_file_saver.parseModelString(newModel),
502
502
  maxSteps: options.maxSteps,
503
503
  systemPrompt: options.systemPrompt,
@@ -2396,10 +2396,10 @@ function ToolApproval({ toolName, args, onApprove, onDeny, onApproveAll }) {
2396
2396
  * ANTHROPIC_API_KEY=xxx bunx deep-agent-ink --model anthropic/claude-sonnet-4-20250514
2397
2397
  */
2398
2398
  const DEFAULT_PROMPT_CACHING = true;
2399
- const DEFAULT_EVICTION_LIMIT = require_agent.DEFAULT_EVICTION_TOKEN_LIMIT$1;
2399
+ const DEFAULT_EVICTION_LIMIT = require_file_saver.DEFAULT_EVICTION_TOKEN_LIMIT$1;
2400
2400
  const DEFAULT_SUMMARIZATION = true;
2401
- const DEFAULT_SUMMARIZATION_THRESHOLD_VALUE = require_agent.DEFAULT_SUMMARIZATION_THRESHOLD$1;
2402
- const DEFAULT_SUMMARIZATION_KEEP = require_agent.DEFAULT_KEEP_MESSAGES$1;
2401
+ const DEFAULT_SUMMARIZATION_THRESHOLD_VALUE = require_file_saver.DEFAULT_SUMMARIZATION_THRESHOLD$1;
2402
+ const DEFAULT_SUMMARIZATION_KEEP = require_file_saver.DEFAULT_KEEP_MESSAGES$1;
2403
2403
  function parseArgs() {
2404
2404
  const args = process.argv.slice(2);
2405
2405
  const options = {
@@ -2610,7 +2610,7 @@ function App({ options, backend }) {
2610
2610
  case "tok":
2611
2611
  setPanel({
2612
2612
  view: "tokens",
2613
- tokenCount: require_agent.estimateMessagesTokens(agent.messages)
2613
+ tokenCount: require_file_saver.estimateMessagesTokens(agent.messages)
2614
2614
  });
2615
2615
  break;
2616
2616
  case "sessions":
@@ -3029,9 +3029,9 @@ function FeaturesPanel({ features, options }) {
3029
3029
  color: colors.success,
3030
3030
  children: [
3031
3031
  "enabled (",
3032
- options.summarizationThreshold || require_agent.DEFAULT_SUMMARIZATION_THRESHOLD$1,
3032
+ options.summarizationThreshold || require_file_saver.DEFAULT_SUMMARIZATION_THRESHOLD$1,
3033
3033
  " tokens, keep ",
3034
- options.summarizationKeepMessages || require_agent.DEFAULT_KEEP_MESSAGES$1,
3034
+ options.summarizationKeepMessages || require_file_saver.DEFAULT_KEEP_MESSAGES$1,
3035
3035
  " msgs)"
3036
3036
  ]
3037
3037
  })
@@ -3060,7 +3060,7 @@ function FeaturesPanel({ features, options }) {
3060
3060
  }
3061
3061
  function TokensPanel({ tokenCount, messageCount }) {
3062
3062
  const formatNumber = (n) => n.toLocaleString();
3063
- const percentage = Math.round(tokenCount / require_agent.CONTEXT_WINDOW * 100);
3063
+ const percentage = Math.round(tokenCount / require_file_saver.CONTEXT_WINDOW * 100);
3064
3064
  let usageColor = colors.success;
3065
3065
  if (percentage > 80) usageColor = colors.error;
3066
3066
  else if (percentage > 50) usageColor = colors.warning;