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,29 +1,30 @@
1
1
  import {
2
- A as SessionMessage,
3
- C as AgentSessionProvider,
4
- D as StoredCompaction,
5
- E as SessionProvider,
6
- M as SessionOptions,
7
- N as SessionTokenCounter,
8
- O as CompactAfterOptions,
9
- P as SessionTokenCounterInput,
10
- S as isSearchProvider,
11
- T as SearchResult,
12
- _ as R2SkillProvider,
13
- b as AgentSearchProvider,
14
- f as ContextBlock,
15
- g as isWritableProvider,
16
- h as WritableContextProvider,
17
- j as SessionMessagePart,
18
- k as CompactionErrorHandler,
19
- m as ContextProvider,
20
- p as ContextConfig,
2
+ A as CompactContext,
3
+ C as isSearchProvider,
4
+ D as SessionProvider,
5
+ E as SearchResult,
6
+ F as SessionTokenCounter,
7
+ I as SessionTokenCounterInput,
8
+ M as SessionMessage,
9
+ N as SessionMessagePart,
10
+ O as StoredCompaction,
11
+ P as SessionOptions,
12
+ S as SearchProvider,
13
+ T as SqlProvider,
14
+ _ as isWritableProvider,
15
+ b as isSkillProvider,
16
+ g as WritableContextProvider,
17
+ h as ContextProvider,
18
+ j as CompactionErrorHandler,
19
+ k as CompactAfterOptions,
20
+ m as ContextConfig,
21
+ p as ContextBlock,
21
22
  r as CompactResult,
22
- v as SkillProvider,
23
- w as SqlProvider,
24
- x as SearchProvider,
25
- y as isSkillProvider
26
- } from "../../../compaction-helpers-B-pG5J22.js";
23
+ v as R2SkillProvider,
24
+ w as AgentSessionProvider,
25
+ x as AgentSearchProvider,
26
+ y as SkillProvider
27
+ } from "../../../compaction-helpers-DpP_XP9J.js";
27
28
  import { ToolSet } from "ai";
28
29
 
29
30
  //#region src/experimental/memory/session/session.d.ts
@@ -59,6 +60,7 @@ declare class Session {
59
60
  private _pending?;
60
61
  private _cachedPrompt?;
61
62
  private _compactionFn?;
63
+ private _warnedCompactionNoOp;
62
64
  private _tokenThreshold?;
63
65
  private _tokenCounter?;
64
66
  private _compactionErrorHandler?;
@@ -105,7 +107,10 @@ declare class Session {
105
107
  * message history into a summary overlay.
106
108
  */
107
109
  onCompaction(
108
- fn: (messages: SessionMessage[]) => Promise<CompactResult | null>
110
+ fn: (
111
+ messages: SessionMessage[],
112
+ context?: CompactContext
113
+ ) => Promise<CompactResult | null>
109
114
  ): this;
110
115
  /**
111
116
  * Auto-compact when estimated token count exceeds the threshold.
@@ -1,5 +1,5 @@
1
1
  import "../../../types.js";
2
- import { m as estimateStringTokens, p as estimateMessageTokens, t as COMPACTION_PREFIX } from "../../../compaction-helpers-fJyf8j4m.js";
2
+ import { m as estimateStringTokens, p as estimateMessageTokens, t as COMPACTION_PREFIX } from "../../../compaction-helpers-BjT2NKRZ.js";
3
3
  import { z } from "zod";
4
4
  //#region src/experimental/memory/session/search.ts
5
5
  /**
@@ -1021,6 +1021,7 @@ function isSqlProvider(arg) {
1021
1021
  }
1022
1022
  var Session = class Session {
1023
1023
  constructor(storage, options) {
1024
+ this._warnedCompactionNoOp = false;
1024
1025
  this._ready = false;
1025
1026
  this.storage = storage;
1026
1027
  this.context = new ContextBlocks(options?.context ?? [], options?.promptStore);
@@ -1327,6 +1328,10 @@ var Session = class Session {
1327
1328
  let compacted = false;
1328
1329
  if (this._tokenThreshold != null && this._compactionFn && tokenEstimate > this._tokenThreshold) try {
1329
1330
  compacted = Boolean(await this.compact());
1331
+ if (!compacted && !this._warnedCompactionNoOp) {
1332
+ this._warnedCompactionNoOp = true;
1333
+ console.warn(`[Session] Auto-compaction fired (~${tokenEstimate} tokens > ${this._tokenThreshold}) but the compaction function returned null, so history was not shortened. ` + (this._tokenCounter ? `A tokenCounter is configured and now flows to the boundary logic, but it is invoked per-message there — a whole-prompt/usage counter (e.g. returning a fixed usage.inputTokens regardless of which messages are passed) degrades the tail budget to minTailMessages and can still no-op. Pass a per-message CompactOptions.tokenCounter for precise tail budgeting.` : `If your history is tool-heavy, configure a tokenCounter on compactAfter() — it flows to createCompactFunction's boundary logic automatically.`));
1334
+ } else if (compacted) this._warnedCompactionNoOp = false;
1330
1335
  } catch (err) {
1331
1336
  await this._handleAutoCompactionError(err);
1332
1337
  }
@@ -1381,7 +1386,7 @@ var Session = class Session {
1381
1386
  const tokensBefore = await this._emitStatus("compacting");
1382
1387
  let result;
1383
1388
  try {
1384
- result = await this._compactionFn(await this.getHistory());
1389
+ result = await this._compactionFn(await this.getHistory(), { tokenCounter: this._tokenCounter });
1385
1390
  } catch (err) {
1386
1391
  this._emitError(err instanceof Error ? err.message : String(err));
1387
1392
  return null;