@ddlqhd/agent-sdk 0.1.1 → 0.2.1

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 (40) hide show
  1. package/README.md +2 -1
  2. package/dist/{chunk-742JTNYI.js → chunk-D3UZNLZO.js} +570 -77
  3. package/dist/chunk-D3UZNLZO.js.map +1 -0
  4. package/dist/{chunk-AJD3DTL7.cjs → chunk-JXAJQGV5.cjs} +756 -107
  5. package/dist/chunk-JXAJQGV5.cjs.map +1 -0
  6. package/dist/{chunk-DQFTAD3I.cjs → chunk-NYZD3THB.cjs} +573 -76
  7. package/dist/chunk-NYZD3THB.cjs.map +1 -0
  8. package/dist/{chunk-Q3L4GIBG.cjs → chunk-P2X3AMDK.cjs} +115 -117
  9. package/dist/chunk-P2X3AMDK.cjs.map +1 -0
  10. package/dist/{chunk-THKEF32L.js → chunk-TKUPLTGJ.js} +110 -114
  11. package/dist/chunk-TKUPLTGJ.js.map +1 -0
  12. package/dist/{chunk-DXMVWGLJ.js → chunk-UHENMHUS.js} +744 -100
  13. package/dist/chunk-UHENMHUS.js.map +1 -0
  14. package/dist/cli/index.cjs +40 -31
  15. package/dist/cli/index.cjs.map +1 -1
  16. package/dist/cli/index.js +14 -5
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/{index-DGPDMbW5.d.cts → index-CnrY1ZA2.d.ts} +36 -14
  19. package/dist/{index-nEfayAzD.d.ts → index-DzBt4ewK.d.cts} +36 -14
  20. package/dist/index.cjs +128 -88
  21. package/dist/index.d.cts +42 -22
  22. package/dist/index.d.ts +42 -22
  23. package/dist/index.js +3 -3
  24. package/dist/models/index.cjs +14 -10
  25. package/dist/models/index.d.cts +7 -2
  26. package/dist/models/index.d.ts +7 -2
  27. package/dist/models/index.js +1 -1
  28. package/dist/tools/index.cjs +65 -57
  29. package/dist/tools/index.d.cts +3 -3
  30. package/dist/tools/index.d.ts +3 -3
  31. package/dist/tools/index.js +1 -1
  32. package/dist/{types-BLf9IqRs.d.cts → types-BUwjMwNH.d.cts} +279 -13
  33. package/dist/{types-BLf9IqRs.d.ts → types-BUwjMwNH.d.ts} +279 -13
  34. package/package.json +11 -11
  35. package/dist/chunk-742JTNYI.js.map +0 -1
  36. package/dist/chunk-AJD3DTL7.cjs.map +0 -1
  37. package/dist/chunk-DQFTAD3I.cjs.map +0 -1
  38. package/dist/chunk-DXMVWGLJ.js.map +0 -1
  39. package/dist/chunk-Q3L4GIBG.cjs.map +0 -1
  40. package/dist/chunk-THKEF32L.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -2,9 +2,9 @@
2
2
  'use strict';
3
3
 
4
4
  require('./chunk-5Y56A64C.cjs');
5
- var chunkAJD3DTL7_cjs = require('./chunk-AJD3DTL7.cjs');
6
- var chunkDQFTAD3I_cjs = require('./chunk-DQFTAD3I.cjs');
7
- var chunkQ3L4GIBG_cjs = require('./chunk-Q3L4GIBG.cjs');
5
+ var chunkJXAJQGV5_cjs = require('./chunk-JXAJQGV5.cjs');
6
+ var chunkNYZD3THB_cjs = require('./chunk-NYZD3THB.cjs');
7
+ var chunkP2X3AMDK_cjs = require('./chunk-P2X3AMDK.cjs');
8
8
  require('./chunk-OZO7D77N.cjs');
9
9
 
10
10
  // src/streaming/event-emitter.ts
@@ -203,315 +203,355 @@ function fromAsyncIterable(iterable) {
203
203
 
204
204
  Object.defineProperty(exports, "Agent", {
205
205
  enumerable: true,
206
- get: function () { return chunkAJD3DTL7_cjs.Agent; }
206
+ get: function () { return chunkJXAJQGV5_cjs.Agent; }
207
+ });
208
+ Object.defineProperty(exports, "DEFAULT_MAX_ITERATIONS", {
209
+ enumerable: true,
210
+ get: function () { return chunkJXAJQGV5_cjs.DEFAULT_MAX_ITERATIONS; }
207
211
  });
208
212
  Object.defineProperty(exports, "DEFAULT_SYSTEM_PROMPT", {
209
213
  enumerable: true,
210
- get: function () { return chunkAJD3DTL7_cjs.DEFAULT_SYSTEM_PROMPT; }
214
+ get: function () { return chunkJXAJQGV5_cjs.DEFAULT_SYSTEM_PROMPT; }
211
215
  });
212
216
  Object.defineProperty(exports, "JsonlStorage", {
213
217
  enumerable: true,
214
- get: function () { return chunkAJD3DTL7_cjs.JsonlStorage; }
218
+ get: function () { return chunkJXAJQGV5_cjs.JsonlStorage; }
215
219
  });
216
220
  Object.defineProperty(exports, "MCPAdapter", {
217
221
  enumerable: true,
218
- get: function () { return chunkAJD3DTL7_cjs.MCPAdapter; }
222
+ get: function () { return chunkJXAJQGV5_cjs.MCPAdapter; }
219
223
  });
220
224
  Object.defineProperty(exports, "MCPClient", {
221
225
  enumerable: true,
222
- get: function () { return chunkAJD3DTL7_cjs.MCPClient; }
226
+ get: function () { return chunkJXAJQGV5_cjs.MCPClient; }
227
+ });
228
+ Object.defineProperty(exports, "MODEL_STREAM_EVENT_TYPES", {
229
+ enumerable: true,
230
+ get: function () { return chunkJXAJQGV5_cjs.MODEL_STREAM_EVENT_TYPES; }
223
231
  });
224
232
  Object.defineProperty(exports, "MemoryManager", {
225
233
  enumerable: true,
226
- get: function () { return chunkAJD3DTL7_cjs.MemoryManager; }
234
+ get: function () { return chunkJXAJQGV5_cjs.MemoryManager; }
227
235
  });
228
236
  Object.defineProperty(exports, "MemoryStorage", {
229
237
  enumerable: true,
230
- get: function () { return chunkAJD3DTL7_cjs.MemoryStorage; }
238
+ get: function () { return chunkJXAJQGV5_cjs.MemoryStorage; }
231
239
  });
232
240
  Object.defineProperty(exports, "PACKAGE_VERSION", {
233
241
  enumerable: true,
234
- get: function () { return chunkAJD3DTL7_cjs.PACKAGE_VERSION; }
242
+ get: function () { return chunkJXAJQGV5_cjs.PACKAGE_VERSION; }
235
243
  });
236
244
  Object.defineProperty(exports, "SessionManager", {
237
245
  enumerable: true,
238
- get: function () { return chunkAJD3DTL7_cjs.SessionManager; }
246
+ get: function () { return chunkJXAJQGV5_cjs.SessionManager; }
239
247
  });
240
248
  Object.defineProperty(exports, "SkillLoader", {
241
249
  enumerable: true,
242
- get: function () { return chunkAJD3DTL7_cjs.SkillLoader; }
250
+ get: function () { return chunkJXAJQGV5_cjs.SkillLoader; }
243
251
  });
244
252
  Object.defineProperty(exports, "SkillRegistry", {
245
253
  enumerable: true,
246
- get: function () { return chunkAJD3DTL7_cjs.SkillRegistry; }
254
+ get: function () { return chunkJXAJQGV5_cjs.SkillRegistry; }
247
255
  });
248
256
  Object.defineProperty(exports, "StreamChunkProcessor", {
249
257
  enumerable: true,
250
- get: function () { return chunkAJD3DTL7_cjs.StreamChunkProcessor; }
258
+ get: function () { return chunkJXAJQGV5_cjs.StreamChunkProcessor; }
251
259
  });
252
260
  Object.defineProperty(exports, "createAgent", {
253
261
  enumerable: true,
254
- get: function () { return chunkAJD3DTL7_cjs.createAgent; }
262
+ get: function () { return chunkJXAJQGV5_cjs.createAgent; }
255
263
  });
256
264
  Object.defineProperty(exports, "createJsonlStorage", {
257
265
  enumerable: true,
258
- get: function () { return chunkAJD3DTL7_cjs.createJsonlStorage; }
266
+ get: function () { return chunkJXAJQGV5_cjs.createJsonlStorage; }
259
267
  });
260
268
  Object.defineProperty(exports, "createMCPAdapter", {
261
269
  enumerable: true,
262
- get: function () { return chunkAJD3DTL7_cjs.createMCPAdapter; }
270
+ get: function () { return chunkJXAJQGV5_cjs.createMCPAdapter; }
263
271
  });
264
272
  Object.defineProperty(exports, "createMCPClient", {
265
273
  enumerable: true,
266
- get: function () { return chunkAJD3DTL7_cjs.createMCPClient; }
274
+ get: function () { return chunkJXAJQGV5_cjs.createMCPClient; }
267
275
  });
268
276
  Object.defineProperty(exports, "createMemoryStorage", {
269
277
  enumerable: true,
270
- get: function () { return chunkAJD3DTL7_cjs.createMemoryStorage; }
278
+ get: function () { return chunkJXAJQGV5_cjs.createMemoryStorage; }
271
279
  });
272
280
  Object.defineProperty(exports, "createSessionManager", {
273
281
  enumerable: true,
274
- get: function () { return chunkAJD3DTL7_cjs.createSessionManager; }
282
+ get: function () { return chunkJXAJQGV5_cjs.createSessionManager; }
275
283
  });
276
284
  Object.defineProperty(exports, "createSkillLoader", {
277
285
  enumerable: true,
278
- get: function () { return chunkAJD3DTL7_cjs.createSkillLoader; }
286
+ get: function () { return chunkJXAJQGV5_cjs.createSkillLoader; }
279
287
  });
280
288
  Object.defineProperty(exports, "createSkillRegistry", {
281
289
  enumerable: true,
282
- get: function () { return chunkAJD3DTL7_cjs.createSkillRegistry; }
290
+ get: function () { return chunkJXAJQGV5_cjs.createSkillRegistry; }
283
291
  });
284
292
  Object.defineProperty(exports, "createStorage", {
285
293
  enumerable: true,
286
- get: function () { return chunkAJD3DTL7_cjs.createStorage; }
294
+ get: function () { return chunkJXAJQGV5_cjs.createStorage; }
295
+ });
296
+ Object.defineProperty(exports, "formatMcpToolName", {
297
+ enumerable: true,
298
+ get: function () { return chunkJXAJQGV5_cjs.formatMcpToolName; }
287
299
  });
288
300
  Object.defineProperty(exports, "getLatestSessionId", {
289
301
  enumerable: true,
290
- get: function () { return chunkAJD3DTL7_cjs.getLatestSessionId; }
302
+ get: function () { return chunkJXAJQGV5_cjs.getLatestSessionId; }
291
303
  });
292
304
  Object.defineProperty(exports, "getSessionStoragePath", {
293
305
  enumerable: true,
294
- get: function () { return chunkAJD3DTL7_cjs.getSessionStoragePath; }
306
+ get: function () { return chunkJXAJQGV5_cjs.getSessionStoragePath; }
307
+ });
308
+ Object.defineProperty(exports, "isMcpPrefixedToolName", {
309
+ enumerable: true,
310
+ get: function () { return chunkJXAJQGV5_cjs.isMcpPrefixedToolName; }
311
+ });
312
+ Object.defineProperty(exports, "isModelStreamEventType", {
313
+ enumerable: true,
314
+ get: function () { return chunkJXAJQGV5_cjs.isModelStreamEventType; }
295
315
  });
296
316
  Object.defineProperty(exports, "loadMCPConfig", {
297
317
  enumerable: true,
298
- get: function () { return chunkAJD3DTL7_cjs.loadMCPConfig; }
318
+ get: function () { return chunkJXAJQGV5_cjs.loadMCPConfig; }
299
319
  });
300
320
  Object.defineProperty(exports, "parseSkillMd", {
301
321
  enumerable: true,
302
- get: function () { return chunkAJD3DTL7_cjs.parseSkillMd; }
322
+ get: function () { return chunkJXAJQGV5_cjs.parseSkillMd; }
303
323
  });
304
324
  Object.defineProperty(exports, "validateMCPConfig", {
305
325
  enumerable: true,
306
- get: function () { return chunkAJD3DTL7_cjs.validateMCPConfig; }
326
+ get: function () { return chunkJXAJQGV5_cjs.validateMCPConfig; }
307
327
  });
308
328
  Object.defineProperty(exports, "AnthropicAdapter", {
309
329
  enumerable: true,
310
- get: function () { return chunkDQFTAD3I_cjs.AnthropicAdapter; }
330
+ get: function () { return chunkNYZD3THB_cjs.AnthropicAdapter; }
331
+ });
332
+ Object.defineProperty(exports, "DEFAULT_ADAPTER_CAPABILITIES", {
333
+ enumerable: true,
334
+ get: function () { return chunkNYZD3THB_cjs.DEFAULT_ADAPTER_CAPABILITIES; }
311
335
  });
312
336
  Object.defineProperty(exports, "OllamaAdapter", {
313
337
  enumerable: true,
314
- get: function () { return chunkDQFTAD3I_cjs.OllamaAdapter; }
338
+ get: function () { return chunkNYZD3THB_cjs.OllamaAdapter; }
315
339
  });
316
340
  Object.defineProperty(exports, "OpenAIAdapter", {
317
341
  enumerable: true,
318
- get: function () { return chunkDQFTAD3I_cjs.OpenAIAdapter; }
342
+ get: function () { return chunkNYZD3THB_cjs.OpenAIAdapter; }
319
343
  });
320
344
  Object.defineProperty(exports, "createAnthropic", {
321
345
  enumerable: true,
322
- get: function () { return chunkDQFTAD3I_cjs.createAnthropic; }
346
+ get: function () { return chunkNYZD3THB_cjs.createAnthropic; }
347
+ });
348
+ Object.defineProperty(exports, "createConsoleSDKLogger", {
349
+ enumerable: true,
350
+ get: function () { return chunkNYZD3THB_cjs.createConsoleSDKLogger; }
323
351
  });
324
352
  Object.defineProperty(exports, "createModel", {
325
353
  enumerable: true,
326
- get: function () { return chunkDQFTAD3I_cjs.createModel; }
354
+ get: function () { return chunkNYZD3THB_cjs.createModel; }
327
355
  });
328
356
  Object.defineProperty(exports, "createOllama", {
329
357
  enumerable: true,
330
- get: function () { return chunkDQFTAD3I_cjs.createOllama; }
358
+ get: function () { return chunkNYZD3THB_cjs.createOllama; }
331
359
  });
332
360
  Object.defineProperty(exports, "createOpenAI", {
333
361
  enumerable: true,
334
- get: function () { return chunkDQFTAD3I_cjs.createOpenAI; }
362
+ get: function () { return chunkNYZD3THB_cjs.createOpenAI; }
363
+ });
364
+ Object.defineProperty(exports, "formatSDKLog", {
365
+ enumerable: true,
366
+ get: function () { return chunkNYZD3THB_cjs.formatSDKLog; }
335
367
  });
336
368
  Object.defineProperty(exports, "mergeMcpStdioEnv", {
337
369
  enumerable: true,
338
- get: function () { return chunkDQFTAD3I_cjs.mergeMcpStdioEnv; }
370
+ get: function () { return chunkNYZD3THB_cjs.mergeMcpStdioEnv; }
339
371
  });
340
372
  Object.defineProperty(exports, "mergeProcessEnv", {
341
373
  enumerable: true,
342
- get: function () { return chunkDQFTAD3I_cjs.mergeProcessEnv; }
374
+ get: function () { return chunkNYZD3THB_cjs.mergeProcessEnv; }
343
375
  });
344
376
  Object.defineProperty(exports, "DEFAULT_GREP_HEAD_LIMIT", {
345
377
  enumerable: true,
346
- get: function () { return chunkQ3L4GIBG_cjs.DEFAULT_GREP_HEAD_LIMIT; }
378
+ get: function () { return chunkP2X3AMDK_cjs.DEFAULT_GREP_HEAD_LIMIT; }
347
379
  });
348
380
  Object.defineProperty(exports, "HookManager", {
349
381
  enumerable: true,
350
- get: function () { return chunkQ3L4GIBG_cjs.HookManager; }
382
+ get: function () { return chunkP2X3AMDK_cjs.HookManager; }
351
383
  });
352
384
  Object.defineProperty(exports, "MAX_LINE_LENGTH", {
353
385
  enumerable: true,
354
- get: function () { return chunkQ3L4GIBG_cjs.MAX_LINE_LENGTH; }
386
+ get: function () { return chunkP2X3AMDK_cjs.MAX_LINE_LENGTH; }
387
+ });
388
+ Object.defineProperty(exports, "SUBAGENT_EXPLORE_DEFAULT_TOOL_NAMES", {
389
+ enumerable: true,
390
+ get: function () { return chunkP2X3AMDK_cjs.SUBAGENT_EXPLORE_DEFAULT_TOOL_NAMES; }
391
+ });
392
+ Object.defineProperty(exports, "SUBAGENT_TYPES", {
393
+ enumerable: true,
394
+ get: function () { return chunkP2X3AMDK_cjs.SUBAGENT_TYPES; }
355
395
  });
356
396
  Object.defineProperty(exports, "ToolRegistry", {
357
397
  enumerable: true,
358
- get: function () { return chunkQ3L4GIBG_cjs.ToolRegistry; }
398
+ get: function () { return chunkP2X3AMDK_cjs.ToolRegistry; }
359
399
  });
360
400
  Object.defineProperty(exports, "agentTool", {
361
401
  enumerable: true,
362
- get: function () { return chunkQ3L4GIBG_cjs.agentTool; }
402
+ get: function () { return chunkP2X3AMDK_cjs.agentTool; }
363
403
  });
364
404
  Object.defineProperty(exports, "bashTool", {
365
405
  enumerable: true,
366
- get: function () { return chunkQ3L4GIBG_cjs.bashTool; }
406
+ get: function () { return chunkP2X3AMDK_cjs.bashTool; }
367
407
  });
368
408
  Object.defineProperty(exports, "buildHookEnv", {
369
409
  enumerable: true,
370
- get: function () { return chunkQ3L4GIBG_cjs.buildHookEnv; }
410
+ get: function () { return chunkP2X3AMDK_cjs.buildHookEnv; }
371
411
  });
372
412
  Object.defineProperty(exports, "createAgentTool", {
373
413
  enumerable: true,
374
- get: function () { return chunkQ3L4GIBG_cjs.createAgentTool; }
414
+ get: function () { return chunkP2X3AMDK_cjs.createAgentTool; }
375
415
  });
376
416
  Object.defineProperty(exports, "createAskUserQuestionTool", {
377
417
  enumerable: true,
378
- get: function () { return chunkQ3L4GIBG_cjs.createAskUserQuestionTool; }
418
+ get: function () { return chunkP2X3AMDK_cjs.createAskUserQuestionTool; }
379
419
  });
380
420
  Object.defineProperty(exports, "createFunctionHook", {
381
421
  enumerable: true,
382
- get: function () { return chunkQ3L4GIBG_cjs.createFunctionHook; }
422
+ get: function () { return chunkP2X3AMDK_cjs.createFunctionHook; }
383
423
  });
384
424
  Object.defineProperty(exports, "createSkillTool", {
385
425
  enumerable: true,
386
- get: function () { return chunkQ3L4GIBG_cjs.createSkillTool; }
426
+ get: function () { return chunkP2X3AMDK_cjs.createSkillTool; }
387
427
  });
388
428
  Object.defineProperty(exports, "createTool", {
389
429
  enumerable: true,
390
- get: function () { return chunkQ3L4GIBG_cjs.createTool; }
430
+ get: function () { return chunkP2X3AMDK_cjs.createTool; }
391
431
  });
392
432
  Object.defineProperty(exports, "editTool", {
393
433
  enumerable: true,
394
- get: function () { return chunkQ3L4GIBG_cjs.editTool; }
434
+ get: function () { return chunkP2X3AMDK_cjs.editTool; }
395
435
  });
396
436
  Object.defineProperty(exports, "formatAnswerSummary", {
397
437
  enumerable: true,
398
- get: function () { return chunkQ3L4GIBG_cjs.formatAnswerSummary; }
438
+ get: function () { return chunkP2X3AMDK_cjs.formatAnswerSummary; }
399
439
  });
400
440
  Object.defineProperty(exports, "formatAskUserQuestionPrompt", {
401
441
  enumerable: true,
402
- get: function () { return chunkQ3L4GIBG_cjs.formatAskUserQuestionPrompt; }
442
+ get: function () { return chunkP2X3AMDK_cjs.formatAskUserQuestionPrompt; }
403
443
  });
404
444
  Object.defineProperty(exports, "getAllBuiltinTools", {
405
445
  enumerable: true,
406
- get: function () { return chunkQ3L4GIBG_cjs.getAllBuiltinTools; }
446
+ get: function () { return chunkP2X3AMDK_cjs.getAllBuiltinTools; }
407
447
  });
408
448
  Object.defineProperty(exports, "getFileSystemTools", {
409
449
  enumerable: true,
410
- get: function () { return chunkQ3L4GIBG_cjs.getFileSystemTools; }
450
+ get: function () { return chunkP2X3AMDK_cjs.getFileSystemTools; }
411
451
  });
412
452
  Object.defineProperty(exports, "getGlobalRegistry", {
413
453
  enumerable: true,
414
- get: function () { return chunkQ3L4GIBG_cjs.getGlobalRegistry; }
454
+ get: function () { return chunkP2X3AMDK_cjs.getGlobalRegistry; }
415
455
  });
416
456
  Object.defineProperty(exports, "getGrepTools", {
417
457
  enumerable: true,
418
- get: function () { return chunkQ3L4GIBG_cjs.getGrepTools; }
458
+ get: function () { return chunkP2X3AMDK_cjs.getGrepTools; }
419
459
  });
420
460
  Object.defineProperty(exports, "getInteractionTools", {
421
461
  enumerable: true,
422
- get: function () { return chunkQ3L4GIBG_cjs.getInteractionTools; }
462
+ get: function () { return chunkP2X3AMDK_cjs.getInteractionTools; }
463
+ });
464
+ Object.defineProperty(exports, "getPlanningTools", {
465
+ enumerable: true,
466
+ get: function () { return chunkP2X3AMDK_cjs.getPlanningTools; }
423
467
  });
424
468
  Object.defineProperty(exports, "getSafeBuiltinTools", {
425
469
  enumerable: true,
426
- get: function () { return chunkQ3L4GIBG_cjs.getSafeBuiltinTools; }
470
+ get: function () { return chunkP2X3AMDK_cjs.getSafeBuiltinTools; }
427
471
  });
428
472
  Object.defineProperty(exports, "getShellTools", {
429
473
  enumerable: true,
430
- get: function () { return chunkQ3L4GIBG_cjs.getShellTools; }
474
+ get: function () { return chunkP2X3AMDK_cjs.getShellTools; }
431
475
  });
432
476
  Object.defineProperty(exports, "getSkillTools", {
433
477
  enumerable: true,
434
- get: function () { return chunkQ3L4GIBG_cjs.getSkillTools; }
478
+ get: function () { return chunkP2X3AMDK_cjs.getSkillTools; }
435
479
  });
436
480
  Object.defineProperty(exports, "getSubagentTools", {
437
481
  enumerable: true,
438
- get: function () { return chunkQ3L4GIBG_cjs.getSubagentTools; }
439
- });
440
- Object.defineProperty(exports, "getTaskTools", {
441
- enumerable: true,
442
- get: function () { return chunkQ3L4GIBG_cjs.getTaskTools; }
482
+ get: function () { return chunkP2X3AMDK_cjs.getSubagentTools; }
443
483
  });
444
484
  Object.defineProperty(exports, "getWebTools", {
445
485
  enumerable: true,
446
- get: function () { return chunkQ3L4GIBG_cjs.getWebTools; }
486
+ get: function () { return chunkP2X3AMDK_cjs.getWebTools; }
447
487
  });
448
488
  Object.defineProperty(exports, "globTool", {
449
489
  enumerable: true,
450
- get: function () { return chunkQ3L4GIBG_cjs.globTool; }
490
+ get: function () { return chunkP2X3AMDK_cjs.globTool; }
451
491
  });
452
492
  Object.defineProperty(exports, "grepTool", {
453
493
  enumerable: true,
454
- get: function () { return chunkQ3L4GIBG_cjs.grepTool; }
494
+ get: function () { return chunkP2X3AMDK_cjs.grepTool; }
455
495
  });
456
496
  Object.defineProperty(exports, "loadHooksSettingsFromProject", {
457
497
  enumerable: true,
458
- get: function () { return chunkQ3L4GIBG_cjs.loadHooksSettingsFromProject; }
498
+ get: function () { return chunkP2X3AMDK_cjs.loadHooksSettingsFromProject; }
459
499
  });
460
500
  Object.defineProperty(exports, "loadHooksSettingsFromUser", {
461
501
  enumerable: true,
462
- get: function () { return chunkQ3L4GIBG_cjs.loadHooksSettingsFromUser; }
502
+ get: function () { return chunkP2X3AMDK_cjs.loadHooksSettingsFromUser; }
463
503
  });
464
504
  Object.defineProperty(exports, "matchTool", {
465
505
  enumerable: true,
466
- get: function () { return chunkQ3L4GIBG_cjs.matchTool; }
506
+ get: function () { return chunkP2X3AMDK_cjs.matchTool; }
467
507
  });
468
508
  Object.defineProperty(exports, "mergeCommandHookLayers", {
469
509
  enumerable: true,
470
- get: function () { return chunkQ3L4GIBG_cjs.mergeCommandHookLayers; }
510
+ get: function () { return chunkP2X3AMDK_cjs.mergeCommandHookLayers; }
471
511
  });
472
512
  Object.defineProperty(exports, "parseHooksSettingsFile", {
473
513
  enumerable: true,
474
- get: function () { return chunkQ3L4GIBG_cjs.parseHooksSettingsFile; }
514
+ get: function () { return chunkP2X3AMDK_cjs.parseHooksSettingsFile; }
475
515
  });
476
516
  Object.defineProperty(exports, "questionTool", {
477
517
  enumerable: true,
478
- get: function () { return chunkQ3L4GIBG_cjs.questionTool; }
518
+ get: function () { return chunkP2X3AMDK_cjs.questionTool; }
479
519
  });
480
520
  Object.defineProperty(exports, "readFileTool", {
481
521
  enumerable: true,
482
- get: function () { return chunkQ3L4GIBG_cjs.readFileTool; }
522
+ get: function () { return chunkP2X3AMDK_cjs.readFileTool; }
483
523
  });
484
- Object.defineProperty(exports, "subagentRequestSchema", {
524
+ Object.defineProperty(exports, "resolveSubagentTypeAppend", {
485
525
  enumerable: true,
486
- get: function () { return chunkQ3L4GIBG_cjs.subagentRequestSchema; }
526
+ get: function () { return chunkP2X3AMDK_cjs.resolveSubagentTypeAppend; }
487
527
  });
488
- Object.defineProperty(exports, "taskCreateTool", {
528
+ Object.defineProperty(exports, "subagentExploreDefaultsUnavailableMessage", {
489
529
  enumerable: true,
490
- get: function () { return chunkQ3L4GIBG_cjs.taskCreateTool; }
530
+ get: function () { return chunkP2X3AMDK_cjs.subagentExploreDefaultsUnavailableMessage; }
491
531
  });
492
- Object.defineProperty(exports, "taskListTool", {
532
+ Object.defineProperty(exports, "subagentRequestSchema", {
493
533
  enumerable: true,
494
- get: function () { return chunkQ3L4GIBG_cjs.taskListTool; }
534
+ get: function () { return chunkP2X3AMDK_cjs.subagentRequestSchema; }
495
535
  });
496
- Object.defineProperty(exports, "taskUpdateTool", {
536
+ Object.defineProperty(exports, "todoWriteTool", {
497
537
  enumerable: true,
498
- get: function () { return chunkQ3L4GIBG_cjs.taskUpdateTool; }
538
+ get: function () { return chunkP2X3AMDK_cjs.todoWriteTool; }
499
539
  });
500
540
  Object.defineProperty(exports, "truncateMatchLineForDisplay", {
501
541
  enumerable: true,
502
- get: function () { return chunkQ3L4GIBG_cjs.truncateMatchLineForDisplay; }
542
+ get: function () { return chunkP2X3AMDK_cjs.truncateMatchLineForDisplay; }
503
543
  });
504
544
  Object.defineProperty(exports, "webFetchTool", {
505
545
  enumerable: true,
506
- get: function () { return chunkQ3L4GIBG_cjs.webFetchTool; }
546
+ get: function () { return chunkP2X3AMDK_cjs.webFetchTool; }
507
547
  });
508
548
  Object.defineProperty(exports, "webSearchTool", {
509
549
  enumerable: true,
510
- get: function () { return chunkQ3L4GIBG_cjs.webSearchTool; }
550
+ get: function () { return chunkP2X3AMDK_cjs.webSearchTool; }
511
551
  });
512
552
  Object.defineProperty(exports, "writeFileTool", {
513
553
  enumerable: true,
514
- get: function () { return chunkQ3L4GIBG_cjs.writeFileTool; }
554
+ get: function () { return chunkP2X3AMDK_cjs.writeFileTool; }
515
555
  });
516
556
  exports.AgentStream = AgentStream;
517
557
  exports.createStream = createStream;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { S as StorageConfig, M as Message, a as SessionInfo, b as StorageAdapter, T as ToolResult, c as ToolDefinition, A as AgentConfig, d as SystemPrompt, e as StreamEvent, f as AgentResult, g as ModelAdapter, h as MCPServerConfig, i as SessionTokenUsage, j as TokenUsage, k as StreamChunk, P as ParsedSkill, l as MemoryConfig } from './types-BLf9IqRs.cjs';
2
- export { m as AgentCallbacks, n as AgentModelConfig, o as AskUserQuestionAnswer, p as AskUserQuestionItem, q as AskUserQuestionResolver, r as AssistantMessage, C as CLIConfig, s as CanUseToolCallback, t as ChatOptions, u as CommandHookConfig, v as CompletionResult, w as ContentPart, x as ContextManagerConfig, y as CreateAskUserQuestionToolOptions, F as FlatCommandHookEntry, z as FunctionHook, H as HookContext, B as HookEventType, D as HookGroupConfig, E as HookManager, G as HookResult, I as HooksSettings, J as HooksSettingsFile, K as ImageContent, L as MCPOptions, N as MCPPromptArgument, O as MCPResourceContent, Q as MessageRole, R as ModelCapabilities, U as ModelParams, V as RunOptions, W as SessionListOptions, X as SkillConfig, Y as SkillDefinition, Z as SkillMetadata, _ as SkillOptions, $ as StreamChunkType, a0 as StreamEventAnnotations, a1 as StreamEventType, a2 as SystemMessage, a3 as SystemPromptConfig, a4 as TextContent, a5 as ThinkingContent, a6 as ToolCall, a7 as ToolExecutionContext, a8 as ToolExecutionPolicy, a9 as ToolHandler, aa as ToolListOptions, ab as ToolMessage, ac as ToolResultMetadata, ad as ToolSchema, ae as UserMessage, af as buildHookEnv, ag as createAskUserQuestionTool, ah as createFunctionHook, ai as formatAnswerSummary, aj as formatAskUserQuestionPrompt, ak as getInteractionTools, al as matchTool, am as mergeCommandHookLayers, an as questionTool } from './types-BLf9IqRs.cjs';
3
- import { T as ToolRegistry, S as SkillRegistry } from './index-DGPDMbW5.cjs';
4
- export { C as CreateAgentToolOptions, D as DEFAULT_GREP_HEAD_LIMIT, M as MAX_LINE_LENGTH, a as SkillLoader, b as SkillLoaderConfig, c as SubagentRequest, d as SubagentRunner, e as ToolExecuteOptions, f as ToolRegistryConfig, g as agentTool, h as bashTool, i as createAgentTool, j as createSkillLoader, k as createSkillRegistry, l as createSkillTool, m as createTool, n as editTool, o as getAllBuiltinTools, p as getFileSystemTools, q as getGlobalRegistry, r as getGrepTools, s as getSafeBuiltinTools, t as getShellTools, u as getSkillTools, v as getSubagentTools, w as getTaskTools, x as getWebTools, y as globTool, z as grepTool, A as loadHooksSettingsFromProject, B as loadHooksSettingsFromUser, E as parseHooksSettingsFile, F as readFileTool, G as subagentRequestSchema, H as taskCreateTool, I as taskListTool, J as taskUpdateTool, K as truncateMatchLineForDisplay, L as webFetchTool, N as webSearchTool, O as writeFileTool } from './index-DGPDMbW5.cjs';
5
- export { AnthropicAdapter, AnthropicConfig, AnthropicFetchRetryOptions, CreateModelConfig, ModelProvider, OllamaAdapter, OllamaConfig, OpenAIAdapter, OpenAIConfig, createAnthropic, createModel, createOllama, createOpenAI } from './models/index.cjs';
1
+ import { S as StorageConfig, M as Message, a as SessionInfo, b as StorageAdapter, c as MCPServerConfig, T as ToolResult, d as ToolDefinition, A as AgentConfig, e as SystemPrompt, f as StreamEvent, g as AgentResult, h as ModelAdapter, i as SessionTokenUsage, j as SDKLogger, L as LogEvent, k as TokenUsage, l as StreamChunk, P as ParsedSkill, m as MemoryConfig } from './types-BUwjMwNH.cjs';
2
+ export { n as AgentCallbacks, o as AgentErrorContext, p as AgentLifecycleCallbacks, q as AgentModelConfig, r as AgentRunContext, s as AgentRunEndContext, t as AgentRunEndReason, u as AgentRunStartContext, v as AskUserQuestionAnswer, w as AskUserQuestionItem, x as AskUserQuestionResolver, y as AssistantMessage, C as CLIConfig, z as CanUseToolCallback, B as ChatOptions, D as CommandHookConfig, E as CompletionResult, F as ContentPart, G as ContextManagerConfig, H as CreateAskUserQuestionToolOptions, I as FlatCommandHookEntry, J as FunctionHook, K as HookContext, N as HookDecisionContext, O as HookEventType, Q as HookGroupConfig, R as HookManager, U as HookObservationContext, V as HookResult, W as HooksSettings, X as HooksSettingsFile, Y as ImageContent, Z as LogRedactionConfig, _ as MCPOptions, $ as MCPPromptArgument, a0 as MCPResourceContent, a1 as MODEL_STREAM_EVENT_TYPES, a2 as MessageObservationContext, a3 as MessageRole, a4 as ModelCapabilities, a5 as ModelParams, a6 as ModelRequestStartContext, a7 as RunOptions, a8 as SDKLogLevel, a9 as SessionListOptions, aa as SkillConfig, ab as SkillDefinition, ac as SkillMetadata, ad as SkillOptions, ae as StreamChunkType, af as StreamEventAnnotations, ag as StreamEventType, ah as SystemMessage, ai as SystemMessageSource, aj as SystemPromptConfig, ak as TextContent, al as ThinkingContent, am as ToolCall, an as ToolExecutionBaseContext, ao as ToolExecutionContext, ap as ToolExecutionEndContext, aq as ToolExecutionPolicy, ar as ToolHandler, as as ToolHookObserver, at as ToolListOptions, au as ToolMessage, av as ToolResultMetadata, aw as ToolResultObservationContext, ax as ToolSchema, ay as UserMessage, az as UserMessageSource, aA as buildHookEnv, aB as createAskUserQuestionTool, aC as createFunctionHook, aD as formatAnswerSummary, aE as formatAskUserQuestionPrompt, aF as getInteractionTools, aG as isModelStreamEventType, aH as matchTool, aI as mergeCommandHookLayers, aJ as questionTool } from './types-BUwjMwNH.cjs';
3
+ import { T as ToolRegistry, S as SkillRegistry } from './index-DzBt4ewK.cjs';
4
+ export { C as CreateAgentToolOptions, D as DEFAULT_GREP_HEAD_LIMIT, M as MAX_LINE_LENGTH, a as SUBAGENT_EXPLORE_DEFAULT_TOOL_NAMES, b as SUBAGENT_TYPES, c as SkillLoader, d as SkillLoaderConfig, e as SubagentRequest, f as SubagentRunner, g as SubagentType, h as ToolExecuteOptions, i as ToolRegistryConfig, j as agentTool, k as bashTool, l as createAgentTool, m as createSkillLoader, n as createSkillRegistry, o as createSkillTool, p as createTool, q as editTool, r as getAllBuiltinTools, s as getFileSystemTools, t as getGlobalRegistry, u as getGrepTools, v as getPlanningTools, w as getSafeBuiltinTools, x as getShellTools, y as getSkillTools, z as getSubagentTools, A as getWebTools, B as globTool, E as grepTool, F as loadHooksSettingsFromProject, G as loadHooksSettingsFromUser, H as parseHooksSettingsFile, I as readFileTool, J as resolveSubagentTypeAppend, K as subagentExploreDefaultsUnavailableMessage, L as subagentRequestSchema, N as todoWriteTool, O as truncateMatchLineForDisplay, P as webFetchTool, Q as webSearchTool, R as writeFileTool } from './index-DzBt4ewK.cjs';
5
+ export { AnthropicAdapter, AnthropicConfig, AnthropicFetchRetryOptions, CreateModelConfig, DEFAULT_ADAPTER_CAPABILITIES, ModelProvider, OllamaAdapter, OllamaConfig, OpenAIAdapter, OpenAIConfig, createAnthropic, createModel, createOllama, createOpenAI } from './models/index.cjs';
6
6
  import 'zod';
7
7
 
8
8
  /** Published package version, read from package root `package.json`. */
@@ -76,18 +76,6 @@ declare class SessionManager {
76
76
  */
77
77
  declare function createSessionManager(config?: StorageConfig): SessionManager;
78
78
 
79
- interface StdioMCPConfig {
80
- name: string;
81
- command: string;
82
- args?: string[];
83
- env?: Record<string, string>;
84
- }
85
- interface HttpMCPConfig {
86
- name: string;
87
- url: string;
88
- headers?: Record<string, string>;
89
- }
90
- type MCPClientConfig = StdioMCPConfig | HttpMCPConfig;
91
79
  interface MCPTool {
92
80
  name: string;
93
81
  description?: string;
@@ -123,7 +111,7 @@ declare class MCPClient {
123
111
  private _connected;
124
112
  private _tools;
125
113
  private _serverInfo?;
126
- constructor(config: MCPClientConfig);
114
+ constructor(config: MCPServerConfig);
127
115
  connect(): Promise<void>;
128
116
  disconnect(): Promise<void>;
129
117
  listTools(): Promise<MCPTool[]>;
@@ -142,12 +130,12 @@ declare class MCPClient {
142
130
  } | undefined;
143
131
  get tools(): MCPTool[];
144
132
  }
145
- declare function createMCPClient(config: MCPClientConfig): MCPClient;
133
+ declare function createMCPClient(config: MCPServerConfig): MCPClient;
146
134
 
147
135
  declare class MCPAdapter {
148
136
  private clients;
149
137
  private toolMap;
150
- addServer(config: MCPClientConfig): Promise<void>;
138
+ addServer(config: MCPServerConfig): Promise<void>;
151
139
  removeServer(name: string): Promise<void>;
152
140
  getToolDefinitions(): ToolDefinition[];
153
141
  executeTool(fullName: string, args: unknown): Promise<ToolResult>;
@@ -161,6 +149,8 @@ declare class MCPAdapter {
161
149
  }
162
150
  declare function createMCPAdapter(): MCPAdapter;
163
151
 
152
+ /** Default upper bound for model↔tool rounds per user turn when `AgentConfig.maxIterations` is omitted. */
153
+ declare const DEFAULT_MAX_ITERATIONS = 400;
164
154
  /**
165
155
  * 流式执行选项
166
156
  */
@@ -190,6 +180,7 @@ declare class Agent {
190
180
  private sessionUsage;
191
181
  private static resolveModel;
192
182
  constructor(config: AgentConfig);
183
+ private log;
193
184
  /**
194
185
  * 注册内置 + 自定义工具,或仅 {@link AgentConfig.exclusiveTools}。
195
186
  */
@@ -208,6 +199,16 @@ declare class Agent {
208
199
  */
209
200
  private initializeMCP;
210
201
  private annotateStreamEvent;
202
+ private baseRunContext;
203
+ /**
204
+ * 分发流式事件到 `callbacks.onEvent` 与 `lifecycle.onModelEvent` / `onModelUsage`。
205
+ */
206
+ private emitStreamEvent;
207
+ /** 标注、触发观察回调并返回供 `yield` 的事件 */
208
+ private streamOut;
209
+ private emitAgentError;
210
+ private safeLifecycleVoid;
211
+ private emitRunEnd;
211
212
  private static createEmptySessionUsage;
212
213
  private resetSessionState;
213
214
  /**
@@ -379,7 +380,10 @@ declare function mergeMcpStdioEnv(agentEnv?: Record<string, string>, serverEnv?:
379
380
  * 占位符说明:
380
381
  * - {{SKILL_LIST}}: 会被运行时注入的skill列表替换
381
382
  */
382
- declare const DEFAULT_SYSTEM_PROMPT = "You are an AI assistant powered by the Agent SDK. You can help users with various tasks by using your built-in tools and capabilities.\n\n## Core Capabilities\n\n### Tools\nYou have access to a set of tools that allow you to:\n- **File Operations**: read, write, list, delete files and directories\n- **Code Execution**: run shell commands, Python scripts, Node.js code\n- **Web Access**: make HTTP requests, fetch webpages, download files\n- **Custom Tools**: additional tools registered by the user or skills\n\nWhen to use tools:\n- Use tools when the task requires real-world actions (file I/O, computation, API calls)\n- Prefer reading files before modifying them\n- Use the simplest tool that gets the job done\n- Run multiple independent tool calls in parallel when possible\n\n**Prefer dedicated tools over Bash:** Do not use `Bash` to do work that has a first-class tool. This keeps actions reviewable and consistent.\n- **Read** for file contents \u2014 not `cat`, `head`, `tail`, or `sed` to print files\n- **Write** to create or overwrite files \u2014 not shell redirection or heredocs\n- **Edit** for targeted file changes \u2014 not `sed`, `awk`, or ad-hoc scripts to patch files\n- **Glob** to find paths by pattern \u2014 not `find` or `ls` for discovery\n- **Grep** to search file contents \u2014 not `grep` or `rg` in the shell (built-in line-by-line regex search; correct integration)\n- **WebFetch** / **WebSearch** when the task needs HTTP or web search (when configured)\n\nReserve **Bash** for real shell needs: `git`, package managers, build commands, compilers, and other operations that require a shell or are not covered above.\n\n### Skills\nSkills are instruction guides for specialized tasks. When activated, you receive the skill's full content including any referenced file paths.\n\n{{SKILL_LIST}}\n\n**Usage:**\n- **Listing skills**: When the user asks about available skills (e.g., \"what skills do you have\", \"\u4F60\u6709\u54EA\u4E9B\u6280\u80FD\", \"list your skills\") \u2192 Simply describe the skills listed above. Do NOT activate any skill.\n- **Activating skills**: When the user has a specific task that matches a skill's purpose \u2192 Call `Skill` with the skill name, then follow the returned instructions.\n- After activation, use the provided Base Path to read any referenced files.\n\n### Sessions\n- Conversations are persisted in sessions\n- Use session IDs to maintain context across multiple interactions\n- Previous messages provide important context for current tasks\n\n## Task Execution Principles\n\n1. **Plan First for Complex Tasks**: For multi-step tasks, you MUST call `TaskCreate` BEFORE any other tool. Do NOT skip this step.\n2. **Be Direct**: Go straight to the point. Try the simplest approach first.\n3. **Be Concise**: If you can say it in one sentence, don't use three.\n4. **Read Before Modify**: Always understand existing code before changing it.\n5. **No Over-Engineering**: Only make changes directly requested or clearly necessary.\n6. **Prefer Edit Over Create**: Modify existing files rather than creating new ones when appropriate.\n7. **Handle Errors Gracefully**: Report errors clearly with actionable suggestions.\n\n## Task Management with Todo List\n\n**MANDATORY**: For multi-step tasks, call `TaskCreate` FIRST.\n\n**Workflow:**\n1. Receive complex task -> call `TaskCreate` immediately\n2. Start first task (in_progress) -> complete -> mark completed\n3. Move to next task -> repeat\n4. Cancel tasks that become irrelevant\n\n**Example:**\nUser: \"Open Google, search X, summarize results, open first link, extract info\"\n-> Multi-step task detected -> call `TaskCreate` FIRST, then execute.\n\n## Output Format\n\n- Lead with the answer or action, not the reasoning\n- Skip filler words and unnecessary preamble\n- Use code blocks with language hints for code\n- Structure longer responses with headers and lists\n- Reference file paths with line numbers when relevant (e.g., `src/index.ts:42`)\n\n## Security Guidelines\n\n- Do not introduce security vulnerabilities (injection, XSS, etc.)\n- Validate user inputs at boundaries\n- Do not execute untrusted code without sandboxing\n- Respect file system permissions and access controls\n\n### High-risk actions (confirm with the user first)\n\nThere is no automatic approval UI: **ask in the conversation** (or use `AskUserQuestion`) before proceeding when an action is destructive, hard to reverse, or affects others. Examples:\n- Deleting files or branches, dropping data, `rm -rf`, overwriting uncommitted work\n- Hard-to-reverse git: force-push, `reset --hard`, rewriting published history, amending shared commits\n- Actions visible outside this machine: pushing code, opening/closing/commenting on PRs or issues, sending messages, posting to external services, changing shared CI/CD or cloud permissions\n- Broad dependency or infrastructure changes (e.g. major version bumps, lockfile rewrites) when impact is unclear\n\nDefault to explaining what you intend and getting explicit agreement unless the user already directed that exact action.\n\n## Tool hooks\n\nWhen hooks are configured (e.g. PreToolUse), a tool call may be **blocked** or its **inputs adjusted** before execution. If a tool fails with a message indicating a hook blocked or rejected the call, **do not** retry the identical tool call unchanged \u2014 read the reason, change your approach, or ask the user. Treat hook feedback as binding policy from the environment.\n\n## Interaction Style\n\n- Be helpful and proactive\n- Ask clarifying questions when instructions are ambiguous\n- Provide suggestions when you see opportunities for improvement\n- Acknowledge limitations honestly\n- Maintain a professional, friendly tone";
383
+ declare const DEFAULT_SYSTEM_PROMPT = "You are an AI assistant powered by the Agent SDK. You can help users with various tasks by using your built-in tools and capabilities.\n\n## Core Capabilities\n\n### Tools\nYou have access to a set of tools that allow you to:\n- **File Operations**: read, write, list, delete files and directories\n- **Code Execution**: run shell commands, Python scripts, Node.js code\n- **Web Access**: make HTTP requests, fetch webpages, download files\n- **Custom Tools**: additional tools registered by the user or skills\n\nWhen to use tools:\n- Use tools when the task requires real-world actions (file I/O, computation, API calls)\n- Prefer reading files before modifying them\n- Use the simplest tool that gets the job done\n- Run multiple independent tool calls in parallel when possible\n\n**Prefer dedicated tools over Bash:** Do not use `Bash` to do work that has a first-class tool. This keeps actions reviewable and consistent.\n- **Read** for file contents \u2014 not `cat`, `head`, `tail`, or `sed` to print files\n- **Write** to create or overwrite files \u2014 not shell redirection or heredocs\n- **Edit** for targeted file changes \u2014 not `sed`, `awk`, or ad-hoc scripts to patch files\n- **Glob** to find paths by pattern \u2014 not `find` or `ls` for discovery\n- **Grep** to search file contents \u2014 not `grep` or `rg` in the shell (built-in line-by-line regex search; correct integration)\n- **WebFetch** / **WebSearch** when the task needs HTTP or web search (when configured)\n- **TodoWrite** for structured multi-step task lists (see **Task Management with Todo List** below)\n\nReserve **Bash** for real shell needs: `git`, package managers, build commands, compilers, and other operations that require a shell or are not covered above.\n\n### Skills\nSkills are instruction guides for specialized tasks. When activated, you receive the skill's full content including any referenced file paths.\n\n{{SKILL_LIST}}\n\n**Usage:**\n- **Listing skills**: When the user asks about available skills (e.g., \"what skills do you have\", \"\u4F60\u6709\u54EA\u4E9B\u6280\u80FD\", \"list your skills\") \u2192 Simply describe the skills listed above. Do NOT activate any skill.\n- **Activating skills**: When the user has a specific task that matches a skill's purpose \u2192 Call `Skill` with the skill name, then follow the returned instructions.\n- After activation, use the provided Base Path to read any referenced files.\n\n### Sessions\n- Conversations are persisted in sessions\n- Use session IDs to maintain context across multiple interactions\n- Previous messages provide important context for current tasks\n\n## Task Execution Principles\n\n1. **Plan First for Complex Tasks**: For multi-step tasks, you MUST call `TodoWrite` BEFORE any other tool. Do NOT skip this step.\n2. **Be Direct**: Go straight to the point. Try the simplest approach first.\n3. **Be Concise**: If you can say it in one sentence, don't use three.\n4. **Read Before Modify**: Always understand existing code before changing it.\n5. **No Over-Engineering**: Only make changes directly requested or clearly necessary.\n6. **Prefer Edit Over Create**: Modify existing files rather than creating new ones when appropriate.\n7. **Handle Errors Gracefully**: Report errors clearly with actionable suggestions.\n\n## Task Management with Todo List\n\n**MANDATORY**: For multi-step tasks, call `TodoWrite` FIRST.\n\n**Workflow:**\n1. Receive complex task -> call `TodoWrite` immediately\n2. Mark tasks `in_progress` / `completed` as you work; several items may be `in_progress` at once when work is parallel\n3. **Replan freely:** if the plan was wrong or incomplete, call `TodoWrite` again with a revised full list (add, remove, reorder, or rewrite steps)\n4. **Before you finish your response** for a multi-step request, ensure **every** todo is `completed` via `TodoWrite` (unless you intentionally pause for a follow-up turn). Do not leave `pending` / `in_progress` items when the work is done\n\n**Example:**\nUser: \"Open Google, search X, summarize results, open first link, extract info\"\n-> Multi-step task detected -> call `TodoWrite` FIRST, then execute.\n\n## Output Format\n\n- Lead with the answer or action, not the reasoning\n- Skip filler words and unnecessary preamble\n- Use code blocks with language hints for code\n- Structure longer responses with headers and lists\n- Reference file paths with line numbers when relevant (e.g., `src/index.ts:42`)\n\n## Security Guidelines\n\n- Do not introduce security vulnerabilities (injection, XSS, etc.)\n- Validate user inputs at boundaries\n- Do not execute untrusted code without sandboxing\n- Respect file system permissions and access controls\n\n### High-risk actions (confirm with the user first)\n\nThere is no automatic approval UI: **ask in the conversation** (or use `AskUserQuestion`) before proceeding when an action is destructive, hard to reverse, or affects others. Examples:\n- Deleting files or branches, dropping data, `rm -rf`, overwriting uncommitted work\n- Hard-to-reverse git: force-push, `reset --hard`, rewriting published history, amending shared commits\n- Actions visible outside this machine: pushing code, opening/closing/commenting on PRs or issues, sending messages, posting to external services, changing shared CI/CD or cloud permissions\n- Broad dependency or infrastructure changes (e.g. major version bumps, lockfile rewrites) when impact is unclear\n\nDefault to explaining what you intend and getting explicit agreement unless the user already directed that exact action.\n\n## Tool hooks\n\nWhen hooks are configured (e.g. PreToolUse), a tool call may be **blocked** or its **inputs adjusted** before execution. If a tool fails with a message indicating a hook blocked or rejected the call, **do not** retry the identical tool call unchanged \u2014 read the reason, change your approach, or ask the user. Treat hook feedback as binding policy from the environment.\n\n## Interaction Style\n\n- Be helpful and proactive\n- Ask clarifying questions when instructions are ambiguous\n- Provide suggestions when you see opportunities for improvement\n- Acknowledge limitations honestly\n- Maintain a professional, friendly tone";
384
+
385
+ declare function formatSDKLog(event: LogEvent): string;
386
+ declare function createConsoleSDKLogger(): SDKLogger;
383
387
 
384
388
  /**
385
389
  * Same directory as {@link Agent} session storage: `<userBase>/.claude/sessions`.
@@ -582,6 +586,8 @@ declare function fromAsyncIterable(iterable: AsyncIterable<StreamEvent>): AgentS
582
586
  interface StreamChunkProcessorOptions {
583
587
  /** Emit `text_start` / `text_end` around assistant text deltas (Claude-style content blocks). Default true. */
584
588
  emitTextBoundaries?: boolean;
589
+ /** Emit `thinking_start` / `thinking_end` around assistant thinking deltas. Default true. */
590
+ emitThinkingBoundaries?: boolean;
585
591
  }
586
592
  /**
587
593
  * Stateful conversion from model `StreamChunk` to normalized `StreamEvent`s.
@@ -591,7 +597,9 @@ declare class StreamChunkProcessor {
591
597
  private currentToolCall;
592
598
  private lastUsage;
593
599
  private inTextBlock;
600
+ private inThinkingBlock;
594
601
  private readonly emitTextBoundaries;
602
+ private readonly emitThinkingBoundaries;
595
603
  constructor(options?: StreamChunkProcessorOptions);
596
604
  processChunk(chunk: StreamChunk): StreamEvent[];
597
605
  /** End open text block and finalize any in-progress streamed tool call. */
@@ -601,6 +609,16 @@ declare class StreamChunkProcessor {
601
609
  private safeParseJSON;
602
610
  }
603
611
 
612
+ /**
613
+ * Builds the Agent-facing tool name for an MCP tool: `mcp__<serverName>__<toolName>`.
614
+ * Avoid `__` inside `serverName` or `toolName`; those segments are not escaped and would make parsing ambiguous.
615
+ */
616
+ declare function formatMcpToolName(serverName: string, toolName: string): string;
617
+ /**
618
+ * True if `name` matches the MCP-prefixed tool naming convention (at least `mcp__<server>__<tool>`).
619
+ */
620
+ declare function isMcpPrefixedToolName(name: string): boolean;
621
+
604
622
  /**
605
623
  * 解析 SKILL.md 文件
606
624
  * 格式:
@@ -652,6 +670,8 @@ interface MCPConfigFile {
652
670
  args?: string[];
653
671
  /** 环境变量 */
654
672
  env?: Record<string, string>;
673
+ /** stdio 子进程工作目录 */
674
+ cwd?: string;
655
675
  /** URL (HTTP transport) */
656
676
  url?: string;
657
677
  /** HTTP headers */
@@ -681,4 +701,4 @@ declare function loadMCPConfig(configPath?: string, startDir?: string, userBaseP
681
701
  */
682
702
  declare function validateMCPConfig(config: MCPConfigFile): string[];
683
703
 
684
- export { Agent, AgentConfig, AgentResult, AgentStream, DEFAULT_SYSTEM_PROMPT, type HttpMCPConfig, JsonlStorage, MCPAdapter, MCPClient, type MCPClientConfig, type MCPConfigFile, type MCPConfigLoadResult, type MCPPrompt, type MCPResource, MCPServerConfig, type MCPTool, MemoryConfig, MemoryManager, MemoryStorage, Message, ModelAdapter, PACKAGE_VERSION, ParsedSkill, type PromptMessage, SessionInfo, SessionManager, SessionTokenUsage, SkillRegistry, type StdioMCPConfig, StorageAdapter, StorageConfig, StreamChunk, StreamChunkProcessor, type StreamChunkProcessorOptions, StreamEvent, type StreamOptions, SystemPrompt, TokenUsage, ToolDefinition, ToolRegistry, ToolResult, createAgent, createJsonlStorage, createMCPAdapter, createMCPClient, createMemoryStorage, createSessionManager, createStorage, createStream, fromAsyncIterable, getLatestSessionId, getSessionStoragePath, loadMCPConfig, mergeMcpStdioEnv, mergeProcessEnv, parseSkillMd, validateMCPConfig };
704
+ export { Agent, AgentConfig, AgentResult, AgentStream, DEFAULT_MAX_ITERATIONS, DEFAULT_SYSTEM_PROMPT, JsonlStorage, LogEvent, MCPAdapter, MCPClient, type MCPConfigFile, type MCPConfigLoadResult, type MCPPrompt, type MCPResource, MCPServerConfig, type MCPTool, MemoryConfig, MemoryManager, MemoryStorage, Message, ModelAdapter, PACKAGE_VERSION, ParsedSkill, type PromptMessage, SDKLogger, SessionInfo, SessionManager, SessionTokenUsage, SkillRegistry, StorageAdapter, StorageConfig, StreamChunk, StreamChunkProcessor, type StreamChunkProcessorOptions, StreamEvent, type StreamOptions, SystemPrompt, TokenUsage, ToolDefinition, ToolRegistry, ToolResult, createAgent, createConsoleSDKLogger, createJsonlStorage, createMCPAdapter, createMCPClient, createMemoryStorage, createSessionManager, createStorage, createStream, formatMcpToolName, formatSDKLog, fromAsyncIterable, getLatestSessionId, getSessionStoragePath, isMcpPrefixedToolName, loadMCPConfig, mergeMcpStdioEnv, mergeProcessEnv, parseSkillMd, validateMCPConfig };