agents 0.13.3 → 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 (74) hide show
  1. package/README.md +6 -4
  2. package/dist/{agent-tool-types-l98LCbBl.d.ts → agent-tool-types-LInzZfLo.d.ts} +463 -116
  3. package/dist/agent-tool-types.d.ts +13 -11
  4. package/dist/{agent-tools-Bg5ilERh.d.ts → agent-tools-BE9xosUG.d.ts} +2 -2
  5. package/dist/agent-tools.d.ts +14 -20
  6. package/dist/agent-tools.js +10 -6
  7. package/dist/agent-tools.js.map +1 -1
  8. package/dist/browser/ai.d.ts +1 -1
  9. package/dist/browser/ai.js +1 -1
  10. package/dist/browser/index.d.ts +1 -1
  11. package/dist/browser/index.js +1 -1
  12. package/dist/browser/tanstack-ai.d.ts +1 -1
  13. package/dist/browser/tanstack-ai.js +1 -1
  14. package/dist/chat/index.d.ts +138 -19
  15. package/dist/chat/index.js +96 -12
  16. package/dist/chat/index.js.map +1 -1
  17. package/dist/chat-sdk/index.d.ts +4 -4
  18. package/dist/classPrivateMethodInitSpec-bG0tD96O.js +7 -0
  19. package/dist/{client-D1kFXo80.js → client-NradHZZz.js} +206 -75
  20. package/dist/client-NradHZZz.js.map +1 -0
  21. package/dist/client.d.ts +1 -1
  22. package/dist/{compaction-helpers-fJyf8j4m.js → compaction-helpers-BjT2NKRZ.js} +22 -3
  23. package/dist/compaction-helpers-BjT2NKRZ.js.map +1 -0
  24. package/dist/{compaction-helpers-B-pG5J22.d.ts → compaction-helpers-DpP_XP9J.d.ts} +59 -33
  25. package/dist/{do-oauth-client-provider-4OKQU9rT.d.ts → do-oauth-client-provider-CPm9rK5I.d.ts} +1 -1
  26. package/dist/{email-J0GGS3sa.d.ts → email-1fTSJwPm.d.ts} +1 -1
  27. package/dist/email.d.ts +2 -2
  28. package/dist/experimental/memory/session/index.d.ts +30 -25
  29. package/dist/experimental/memory/session/index.js +7 -2
  30. package/dist/experimental/memory/session/index.js.map +1 -1
  31. package/dist/experimental/memory/utils/index.d.ts +12 -10
  32. package/dist/experimental/memory/utils/index.js +2 -2
  33. package/dist/{index-DKey3P4s.d.ts → index-Brdu5nMI.d.ts} +270 -1
  34. package/dist/index.d.ts +74 -67
  35. package/dist/index.js +467 -63
  36. package/dist/index.js.map +1 -1
  37. package/dist/{internal_context-BZrMS0B5.d.ts → internal_context-CcZy2Em7.d.ts} +1 -1
  38. package/dist/internal_context.d.ts +1 -1
  39. package/dist/mcp/client.d.ts +17 -13
  40. package/dist/mcp/client.js +2 -2
  41. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  42. package/dist/mcp/index.d.ts +35 -27
  43. package/dist/mcp/index.js +402 -69
  44. package/dist/mcp/index.js.map +1 -1
  45. package/dist/observability/index.d.ts +1 -1
  46. package/dist/observability/index.js +15 -1
  47. package/dist/observability/index.js.map +1 -1
  48. package/dist/react.d.ts +3 -3
  49. package/dist/{retries-BVdRl5ZE.d.ts → retries-ClWwxADl.d.ts} +1 -1
  50. package/dist/retries.d.ts +1 -1
  51. package/dist/serializable.d.ts +1 -1
  52. package/dist/{shared-Cvj92byG.d.ts → shared-CpY1FLvm.d.ts} +1 -1
  53. package/dist/{shared-CiKaIK4h.js → shared-DdOn6sp4.js} +3 -7
  54. package/dist/{shared-CiKaIK4h.js.map → shared-DdOn6sp4.js.map} +1 -1
  55. package/dist/skills/index.d.ts +236 -0
  56. package/dist/skills/index.js +1326 -0
  57. package/dist/skills/index.js.map +1 -0
  58. package/dist/sub-routing.d.ts +6 -6
  59. package/dist/{tool-output-truncation-CH-khbZ3.js → tool-output-truncation-BF4AZQlw.js} +1 -1
  60. package/dist/{tool-output-truncation-CH-khbZ3.js.map → tool-output-truncation-BF4AZQlw.js.map} +1 -1
  61. package/dist/{types-_JjKmv-l.d.ts → types-B0GymtN_.d.ts} +1 -1
  62. package/dist/types.d.ts +1 -1
  63. package/dist/vite.d.ts +1 -1
  64. package/dist/vite.js +248 -2
  65. package/dist/vite.js.map +1 -1
  66. package/dist/{workflow-types-Dkzg4hAx.d.ts → workflow-types-DPkuBi--.d.ts} +1 -1
  67. package/dist/workflow-types.d.ts +1 -1
  68. package/dist/workflows.d.ts +13 -3
  69. package/dist/workflows.js +10 -1
  70. package/dist/workflows.js.map +1 -1
  71. package/package.json +21 -3
  72. package/skills-module.d.ts +22 -0
  73. package/dist/client-D1kFXo80.js.map +0 -1
  74. package/dist/compaction-helpers-fJyf8j4m.js.map +0 -1
@@ -1,17 +1,18 @@
1
1
  import {
2
- A as SessionMessage,
3
- a as alignBoundaryForward,
4
- c as createCompactFunction,
5
- d as sanitizeToolPairs,
6
- i as alignBoundaryBackward,
7
- l as findTailCutByTokens,
2
+ M as SessionMessage,
3
+ a as alignBoundaryBackward,
4
+ c as computeSummaryBudget,
5
+ d as isCompactionMessage,
6
+ f as sanitizeToolPairs,
7
+ i as CompactTokenCounter,
8
+ l as createCompactFunction,
8
9
  n as CompactOptions,
9
- o as buildSummaryPrompt,
10
+ o as alignBoundaryForward,
10
11
  r as CompactResult,
11
- s as computeSummaryBudget,
12
+ s as buildSummaryPrompt,
12
13
  t as COMPACTION_PREFIX,
13
- u as isCompactionMessage
14
- } from "../../../compaction-helpers-B-pG5J22.js";
14
+ u as findTailCutByTokens
15
+ } from "../../../compaction-helpers-DpP_XP9J.js";
15
16
 
16
17
  //#region src/experimental/memory/utils/tokens.d.ts
17
18
  /** Approximate characters per token for English text */
@@ -76,6 +77,7 @@ export {
76
77
  COMPACTION_PREFIX,
77
78
  type CompactOptions,
78
79
  type CompactResult,
80
+ type CompactTokenCounter,
79
81
  TOKENS_PER_MESSAGE,
80
82
  type TruncateOptions,
81
83
  WORDS_TOKEN_MULTIPLIER,
@@ -1,5 +1,5 @@
1
- import { t as truncateToolOutput } from "../../../tool-output-truncation-CH-khbZ3.js";
2
- import { a as computeSummaryBudget, c as isCompactionMessage, d as TOKENS_PER_MESSAGE, f as WORDS_TOKEN_MULTIPLIER, i as buildSummaryPrompt, l as sanitizeToolPairs, m as estimateStringTokens, n as alignBoundaryBackward, o as createCompactFunction, p as estimateMessageTokens, r as alignBoundaryForward, s as findTailCutByTokens, t as COMPACTION_PREFIX, u as CHARS_PER_TOKEN } from "../../../compaction-helpers-fJyf8j4m.js";
1
+ import { t as truncateToolOutput } from "../../../tool-output-truncation-BF4AZQlw.js";
2
+ import { a as computeSummaryBudget, c as isCompactionMessage, d as TOKENS_PER_MESSAGE, f as WORDS_TOKEN_MULTIPLIER, i as buildSummaryPrompt, l as sanitizeToolPairs, m as estimateStringTokens, n as alignBoundaryBackward, o as createCompactFunction, p as estimateMessageTokens, r as alignBoundaryForward, s as findTailCutByTokens, t as COMPACTION_PREFIX, u as CHARS_PER_TOKEN } from "../../../compaction-helpers-BjT2NKRZ.js";
3
3
  //#region src/experimental/memory/utils/compaction.ts
4
4
  /**
5
5
  * Read-time context truncation.
@@ -225,6 +225,242 @@ type AgentObservabilityEvent =
225
225
  error: string;
226
226
  }
227
227
  >
228
+ | BaseEvent<
229
+ "fiber:run:started",
230
+ {
231
+ fiberId: string;
232
+ fiberName: string;
233
+ managed?: boolean;
234
+ }
235
+ >
236
+ | BaseEvent<
237
+ "fiber:run:completed",
238
+ {
239
+ fiberId: string;
240
+ fiberName: string;
241
+ elapsedMs?: number;
242
+ managed?: boolean;
243
+ }
244
+ >
245
+ | BaseEvent<
246
+ "fiber:run:failed",
247
+ {
248
+ fiberId: string;
249
+ fiberName: string;
250
+ error: string;
251
+ elapsedMs?: number;
252
+ managed?: boolean;
253
+ }
254
+ >
255
+ | BaseEvent<
256
+ "fiber:run:interrupted",
257
+ {
258
+ fiberId: string;
259
+ fiberName: string;
260
+ elapsedMs?: number;
261
+ managed?: boolean;
262
+ recoveryReason: "interrupted";
263
+ }
264
+ >
265
+ | BaseEvent<
266
+ "fiber:recovery:detected",
267
+ {
268
+ fiberId: string;
269
+ fiberName: string;
270
+ elapsedMs?: number;
271
+ managed?: boolean;
272
+ recoveryReason: "interrupted";
273
+ }
274
+ >
275
+ | BaseEvent<
276
+ "fiber:recovery:attempt",
277
+ {
278
+ fiberId: string;
279
+ fiberName: string;
280
+ managed?: boolean;
281
+ recoveryReason: "interrupted";
282
+ }
283
+ >
284
+ | BaseEvent<
285
+ "fiber:recovery:handled",
286
+ {
287
+ fiberId: string;
288
+ fiberName: string;
289
+ status?: string;
290
+ elapsedMs?: number;
291
+ managed?: boolean;
292
+ }
293
+ >
294
+ | BaseEvent<
295
+ "fiber:recovery:skipped",
296
+ {
297
+ fiberId: string;
298
+ fiberName: string;
299
+ reason: string;
300
+ elapsedMs?: number;
301
+ managed?: boolean;
302
+ }
303
+ >
304
+ | BaseEvent<
305
+ "fiber:recovery:failed",
306
+ {
307
+ fiberId: string;
308
+ fiberName: string;
309
+ error: string;
310
+ elapsedMs?: number;
311
+ reason?: string;
312
+ }
313
+ >
314
+ | BaseEvent<
315
+ "chat:request:failed",
316
+ {
317
+ requestId?: string;
318
+ stage:
319
+ | "parse"
320
+ | "persist"
321
+ | "turn"
322
+ | "stream"
323
+ | "recovery"
324
+ | "transcript";
325
+ messagesPersisted?: boolean;
326
+ error: string;
327
+ }
328
+ >
329
+ | BaseEvent<
330
+ "chat:recovery:detected",
331
+ {
332
+ incidentId: string;
333
+ requestId: string;
334
+ attempt: number;
335
+ maxAttempts: number;
336
+ recoveryKind: "retry" | "continue";
337
+ }
338
+ >
339
+ | BaseEvent<
340
+ "chat:recovery:scheduled",
341
+ {
342
+ incidentId: string;
343
+ requestId: string;
344
+ attempt: number;
345
+ maxAttempts: number;
346
+ recoveryKind: "retry" | "continue";
347
+ }
348
+ >
349
+ | BaseEvent<
350
+ "chat:recovery:attempt",
351
+ {
352
+ incidentId: string;
353
+ requestId: string;
354
+ attempt: number;
355
+ maxAttempts: number;
356
+ recoveryKind: "retry" | "continue";
357
+ }
358
+ >
359
+ | BaseEvent<
360
+ "chat:recovery:completed",
361
+ {
362
+ incidentId: string;
363
+ requestId: string;
364
+ attempt: number;
365
+ maxAttempts: number;
366
+ recoveryKind: "retry" | "continue";
367
+ }
368
+ >
369
+ | BaseEvent<
370
+ "chat:recovery:skipped",
371
+ {
372
+ incidentId: string;
373
+ requestId: string;
374
+ attempt: number;
375
+ maxAttempts: number;
376
+ recoveryKind: "retry" | "continue";
377
+ reason?: string;
378
+ }
379
+ >
380
+ | BaseEvent<
381
+ "chat:recovery:exhausted",
382
+ {
383
+ incidentId: string;
384
+ requestId: string;
385
+ attempt: number;
386
+ maxAttempts: number;
387
+ recoveryKind: "retry" | "continue";
388
+ reason: string;
389
+ }
390
+ >
391
+ | BaseEvent<
392
+ "chat:recovery:failed",
393
+ {
394
+ incidentId: string;
395
+ requestId: string;
396
+ attempt: number;
397
+ maxAttempts: number;
398
+ recoveryKind: "retry" | "continue";
399
+ reason?: string;
400
+ }
401
+ >
402
+ | BaseEvent<
403
+ "chat:transcript:repaired",
404
+ {
405
+ requestId?: string;
406
+ removedToolCalls: number;
407
+ normalizedInputs: number;
408
+ toolCallIds?: string[];
409
+ }
410
+ >
411
+ | BaseEvent<
412
+ "chat:stream:stalled",
413
+ {
414
+ requestId: string /** Inactivity window that elapsed with no stream chunk, in ms. */;
415
+ timeoutMs: number;
416
+ }
417
+ >
418
+ | BaseEvent<
419
+ "agent_tool:recovery:begin",
420
+ {
421
+ runCount: number;
422
+ totalTimeoutMs?: number;
423
+ }
424
+ >
425
+ | BaseEvent<
426
+ "agent_tool:recovery:row",
427
+ {
428
+ runId: string;
429
+ agentType: string;
430
+ status: string;
431
+ reason?: string;
432
+ elapsedMs?: number;
433
+ }
434
+ >
435
+ | BaseEvent<
436
+ "agent_tool:recovery:deadline",
437
+ {
438
+ runId: string;
439
+ agentType: string;
440
+ elapsedMs?: number;
441
+ }
442
+ >
443
+ | BaseEvent<
444
+ "agent_tool:recovery:reattach",
445
+ {
446
+ runId: string;
447
+ agentType: string;
448
+ budgetMs: number;
449
+ }
450
+ >
451
+ | BaseEvent<
452
+ "agent_tool:recovery:complete",
453
+ {
454
+ runCount: number;
455
+ elapsedMs?: number;
456
+ }
457
+ >
458
+ | BaseEvent<
459
+ "agent_tool:recovery:failed",
460
+ {
461
+ error: string;
462
+ }
463
+ >
228
464
  | BaseEvent<"destroy">
229
465
  | BaseEvent<
230
466
  "connect",
@@ -352,6 +588,10 @@ declare const channels: {
352
588
  readonly state: Channel<unknown, unknown>;
353
589
  readonly rpc: Channel<unknown, unknown>;
354
590
  readonly message: Channel<unknown, unknown>;
591
+ readonly chat: Channel<unknown, unknown>;
592
+ readonly transcript: Channel<unknown, unknown>;
593
+ readonly fiber: Channel<unknown, unknown>;
594
+ readonly agentTool: Channel<unknown, unknown>;
355
595
  readonly schedule: Channel<unknown, unknown>;
356
596
  readonly lifecycle: Channel<unknown, unknown>;
357
597
  readonly workflow: Channel<unknown, unknown>;
@@ -387,6 +627,35 @@ type ChannelEventMap = {
387
627
  type: `message:${string}` | `tool:${string}` | `submission:${string}`;
388
628
  }
389
629
  >;
630
+ chat: Exclude<
631
+ Extract<
632
+ ObservabilityEvent,
633
+ {
634
+ type: `chat:${string}`;
635
+ }
636
+ >,
637
+ {
638
+ type: `chat:transcript:${string}`;
639
+ }
640
+ >;
641
+ transcript: Extract<
642
+ ObservabilityEvent,
643
+ {
644
+ type: `transcript:${string}` | `chat:transcript:${string}`;
645
+ }
646
+ >;
647
+ fiber: Extract<
648
+ ObservabilityEvent,
649
+ {
650
+ type: `fiber:${string}`;
651
+ }
652
+ >;
653
+ agentTool: Extract<
654
+ ObservabilityEvent,
655
+ {
656
+ type: `agent_tool:${string}`;
657
+ }
658
+ >;
390
659
  schedule: Extract<
391
660
  ObservabilityEvent,
392
661
  {
@@ -445,4 +714,4 @@ export {
445
714
  MCPObservabilityEvent as s,
446
715
  ChannelEventMap as t
447
716
  };
448
- //# sourceMappingURL=index-DKey3P4s.d.ts.map
717
+ //# sourceMappingURL=index-Brdu5nMI.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,80 +1,84 @@
1
- import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-BZrMS0B5.js";
1
+ /// <reference path="../skills-module.d.ts" />
2
+ import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-CcZy2Em7.js";
2
3
  import {
3
- $ as SubAgentStub,
4
- A as EmailSendBinding,
5
- B as QueueItem,
6
- Bt as SubAgentPathMatch,
7
- C as AgentStaticOptions,
8
- D as DEFAULT_AGENT_STATIC_OPTIONS,
9
- E as ConnectionContext,
10
- F as FiberStatus,
11
- G as ScheduleCriteria,
12
- H as RPCResponse,
13
- Ht as parseSubAgentPath,
14
- I as ListFibersOptions,
15
- J as StartFiberOptions,
16
- K as SendEmailOptions,
17
- L as MCPServer,
18
- M as FiberInspection,
19
- N as FiberRecoveryContext,
20
- O as DeleteFibersOptions,
21
- P as FiberRecoveryResult,
22
- Q as SubAgentClass,
23
- R as MCPServerMessage,
24
- Rt as TransportType,
25
- S as AgentOptions,
26
- T as Connection,
27
- U as RoutingRetryOptions,
28
- Ut as routeSubAgentRequest,
29
- V as RPCRequest,
30
- Vt as getSubAgentByName,
31
- W as Schedule,
32
- X as StateUpdateMessage,
33
- Y as StartFiberResult,
34
- Z as StreamingResponse,
35
- _ as AddRpcMcpServerOptions,
4
+ $ as SubAgentClass,
5
+ A as EmailRoutingOptions,
6
+ B as MCPServersState,
7
+ C as AgentOptions,
8
+ D as ConnectionContext,
9
+ E as Connection,
10
+ F as FiberRecoveryResult,
11
+ G as Schedule,
12
+ Gt as SubAgentPathMatch,
13
+ H as RPCRequest,
14
+ I as FiberStatus,
15
+ J as SqlError,
16
+ Jt as routeSubAgentRequest,
17
+ K as ScheduleCriteria,
18
+ Kt as getSubAgentByName,
19
+ L as ListFibersOptions,
20
+ M as FiberContext,
21
+ N as FiberInspection,
22
+ O as DEFAULT_AGENT_STATIC_OPTIONS,
23
+ P as FiberRecoveryContext,
24
+ Q as StreamingResponse,
25
+ R as MCPServer,
26
+ S as AgentNamespace,
27
+ T as CallableMetadata,
28
+ U as RPCResponse,
29
+ Ut as TransportType,
30
+ V as QueueItem,
31
+ W as RoutingRetryOptions,
32
+ Wt as SUB_PREFIX,
33
+ X as StartFiberResult,
34
+ Y as StartFiberOptions,
35
+ Z as StateUpdateMessage,
36
+ _ as AddMcpServerOptions,
37
+ _t as MCP_SERVER_ID_MAX_LENGTH,
36
38
  a as AgentToolEventState,
37
- at as routeAgentRequest,
38
- b as AgentGetOptions,
39
- c as AgentToolRunInspection,
40
- d as AgentToolStoredChunk,
41
- et as WSMessage,
42
- f as AgentToolTerminalStatus,
43
- g as AddMcpServerOptions,
44
- h as RunAgentToolResult,
39
+ at as routeAgentEmail,
40
+ b as AgentContext,
41
+ bt as normalizeServerId,
42
+ c as AgentToolRunInfo,
43
+ d as AgentToolRunStatus,
44
+ et as SubAgentStub,
45
+ f as AgentToolStoredChunk,
46
+ g as RunAgentToolResult,
47
+ h as RunAgentToolOptions,
45
48
  i as AgentToolEventMessage,
46
- it as routeAgentEmail,
47
- j as FiberContext,
48
- k as EmailRoutingOptions,
49
- l as AgentToolRunState,
50
- m as RunAgentToolOptions,
49
+ it as getCurrentAgent,
50
+ j as EmailSendBinding,
51
+ k as DeleteFibersOptions,
52
+ l as AgentToolRunInspection,
53
+ m as ChatCapableAgentClass,
51
54
  n as AgentToolDisplayMetadata,
52
- nt as getAgentByName,
53
- o as AgentToolLifecycleResult,
54
- ot as unstable_callable,
55
- p as ChatCapableAgentClass,
56
- q as SqlError,
55
+ nt as callable,
56
+ o as AgentToolFailure,
57
+ ot as routeAgentRequest,
58
+ p as AgentToolTerminalStatus,
59
+ q as SendEmailOptions,
60
+ qt as parseSubAgentPath,
57
61
  r as AgentToolEvent,
58
- rt as getCurrentAgent,
59
- s as AgentToolRunInfo,
62
+ rt as getAgentByName,
63
+ s as AgentToolLifecycleResult,
64
+ st as unstable_callable,
60
65
  t as AgentToolChildAdapter,
61
- tt as callable,
62
- u as AgentToolRunStatus,
63
- v as Agent,
64
- w as CallableMetadata,
65
- x as AgentNamespace,
66
- y as AgentContext,
67
- z as MCPServersState,
68
- zt as SUB_PREFIX
69
- } from "./agent-tool-types-l98LCbBl.js";
70
- import { t as RetryOptions } from "./retries-BVdRl5ZE.js";
66
+ tt as WSMessage,
67
+ u as AgentToolRunState,
68
+ v as AddRpcMcpServerOptions,
69
+ w as AgentStaticOptions,
70
+ x as AgentGetOptions,
71
+ y as Agent,
72
+ z as MCPServerMessage
73
+ } from "./agent-tool-types-LInzZfLo.js";
74
+ import { t as RetryOptions } from "./retries-ClWwxADl.js";
71
75
  import {
72
76
  n as AgentsOAuthProvider,
73
77
  r as DurableObjectOAuthClientProvider,
74
78
  t as AgentMcpOAuthProvider
75
- } from "./do-oauth-client-provider-4OKQU9rT.js";
76
- import { t as MessageType } from "./types-_JjKmv-l.js";
77
- import { l as createHeaderBasedEmailResolver } from "./email-J0GGS3sa.js";
79
+ } from "./do-oauth-client-provider-CPm9rK5I.js";
80
+ import { t as MessageType } from "./types-B0GymtN_.js";
81
+ import { l as createHeaderBasedEmailResolver } from "./email-1fTSJwPm.js";
78
82
  export {
79
83
  AddMcpServerOptions,
80
84
  AddRpcMcpServerOptions,
@@ -90,6 +94,7 @@ export {
90
94
  type AgentToolEvent,
91
95
  type AgentToolEventMessage,
92
96
  type AgentToolEventState,
97
+ type AgentToolFailure,
93
98
  type AgentToolLifecycleResult,
94
99
  type AgentToolRunInfo,
95
100
  type AgentToolRunInspection,
@@ -116,6 +121,7 @@ export {
116
121
  MCPServer,
117
122
  MCPServerMessage,
118
123
  MCPServersState,
124
+ MCP_SERVER_ID_MAX_LENGTH,
119
125
  MessageType,
120
126
  QueueItem,
121
127
  RPCRequest,
@@ -144,6 +150,7 @@ export {
144
150
  getAgentByName,
145
151
  getCurrentAgent,
146
152
  getSubAgentByName,
153
+ normalizeServerId,
147
154
  parseSubAgentPath,
148
155
  routeAgentEmail,
149
156
  routeAgentRequest,