agentfootprint 8.0.0 → 8.2.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 (148) hide show
  1. package/AGENTS.md +14 -9
  2. package/README.md +11 -7
  3. package/ai-instructions/claude-code/SKILL.md +1 -1
  4. package/ai-instructions/clinerules +1 -1
  5. package/ai-instructions/copilot-instructions.md +1 -1
  6. package/ai-instructions/cursor/agentfootprint.md +1 -1
  7. package/ai-instructions/kiro/agentfootprint.md +1 -1
  8. package/ai-instructions/windsurfrules +1 -1
  9. package/dist/adapters/llm/OllamaProvider.js +628 -0
  10. package/dist/adapters/llm/OllamaProvider.js.map +1 -0
  11. package/dist/adapters/llm/OpenAIProvider.js +12 -21
  12. package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
  13. package/dist/adapters/llm/createProvider.js +35 -6
  14. package/dist/adapters/llm/createProvider.js.map +1 -1
  15. package/dist/core/Agent.js +44 -1
  16. package/dist/core/Agent.js.map +1 -1
  17. package/dist/core/agent/stages/seed.js +10 -0
  18. package/dist/core/agent/stages/seed.js.map +1 -1
  19. package/dist/core/agent/stages/window.js +21 -0
  20. package/dist/core/agent/stages/window.js.map +1 -1
  21. package/dist/core/agent/window/errors.js +4 -3
  22. package/dist/core/agent/window/errors.js.map +1 -1
  23. package/dist/core/agent/window/folded.js +98 -0
  24. package/dist/core/agent/window/folded.js.map +1 -0
  25. package/dist/core/agent/window/index.js +9 -1
  26. package/dist/core/agent/window/index.js.map +1 -1
  27. package/dist/core/agent/window/options.js +18 -2
  28. package/dist/core/agent/window/options.js.map +1 -1
  29. package/dist/core/agent/window/strategies/slidingWindow.js +2 -2
  30. package/dist/core/agent/window/strategies/summarizeOldest.js +25 -2
  31. package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -1
  32. package/dist/core/agent/window/summarize.js +27 -1
  33. package/dist/core/agent/window/summarize.js.map +1 -1
  34. package/dist/core/agent/window/types.js +6 -0
  35. package/dist/core/agent/window/types.js.map +1 -1
  36. package/dist/core/runCheckpoint.js +9 -1
  37. package/dist/core/runCheckpoint.js.map +1 -1
  38. package/dist/esm/adapters/llm/OllamaProvider.d.ts +182 -0
  39. package/dist/esm/adapters/llm/OllamaProvider.js +622 -0
  40. package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -0
  41. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +0 -12
  42. package/dist/esm/adapters/llm/OpenAIProvider.js +11 -19
  43. package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
  44. package/dist/esm/adapters/llm/createProvider.d.ts +25 -8
  45. package/dist/esm/adapters/llm/createProvider.js +35 -6
  46. package/dist/esm/adapters/llm/createProvider.js.map +1 -1
  47. package/dist/esm/core/Agent.d.ts +17 -0
  48. package/dist/esm/core/Agent.js +44 -1
  49. package/dist/esm/core/Agent.js.map +1 -1
  50. package/dist/esm/core/agent/stages/seed.d.ts +11 -0
  51. package/dist/esm/core/agent/stages/seed.js +10 -0
  52. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  53. package/dist/esm/core/agent/stages/window.d.ts +13 -0
  54. package/dist/esm/core/agent/stages/window.js +21 -0
  55. package/dist/esm/core/agent/stages/window.js.map +1 -1
  56. package/dist/esm/core/agent/types.d.ts +15 -1
  57. package/dist/esm/core/agent/window/errors.js +4 -3
  58. package/dist/esm/core/agent/window/errors.js.map +1 -1
  59. package/dist/esm/core/agent/window/folded.d.ts +90 -0
  60. package/dist/esm/core/agent/window/folded.js +92 -0
  61. package/dist/esm/core/agent/window/folded.js.map +1 -0
  62. package/dist/esm/core/agent/window/index.d.ts +7 -1
  63. package/dist/esm/core/agent/window/index.js +6 -0
  64. package/dist/esm/core/agent/window/index.js.map +1 -1
  65. package/dist/esm/core/agent/window/options.d.ts +7 -1
  66. package/dist/esm/core/agent/window/options.js +17 -1
  67. package/dist/esm/core/agent/window/options.js.map +1 -1
  68. package/dist/esm/core/agent/window/strategies/slidingWindow.d.ts +2 -2
  69. package/dist/esm/core/agent/window/strategies/slidingWindow.js +2 -2
  70. package/dist/esm/core/agent/window/strategies/summarizeOldest.d.ts +4 -2
  71. package/dist/esm/core/agent/window/strategies/summarizeOldest.js +25 -2
  72. package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -1
  73. package/dist/esm/core/agent/window/strategy.d.ts +26 -1
  74. package/dist/esm/core/agent/window/summarize.d.ts +11 -0
  75. package/dist/esm/core/agent/window/summarize.js +27 -1
  76. package/dist/esm/core/agent/window/summarize.js.map +1 -1
  77. package/dist/esm/core/agent/window/types.d.ts +106 -1
  78. package/dist/esm/core/agent/window/types.js +6 -0
  79. package/dist/esm/core/agent/window/types.js.map +1 -1
  80. package/dist/esm/core/runCheckpoint.d.ts +32 -1
  81. package/dist/esm/core/runCheckpoint.js +9 -1
  82. package/dist/esm/core/runCheckpoint.js.map +1 -1
  83. package/dist/esm/index.d.ts +1 -1
  84. package/dist/esm/index.js +6 -1
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/providers.d.ts +13 -5
  87. package/dist/esm/providers.js +13 -5
  88. package/dist/esm/providers.js.map +1 -1
  89. package/dist/esm/thinking/OllamaThinkingHandler.d.ts +60 -0
  90. package/dist/esm/thinking/OllamaThinkingHandler.js +107 -0
  91. package/dist/esm/thinking/OllamaThinkingHandler.js.map +1 -0
  92. package/dist/esm/thinking/index.d.ts +1 -0
  93. package/dist/esm/thinking/index.js +1 -0
  94. package/dist/esm/thinking/index.js.map +1 -1
  95. package/dist/esm/thinking/registry.js +2 -0
  96. package/dist/esm/thinking/registry.js.map +1 -1
  97. package/dist/index.js +9 -2
  98. package/dist/index.js.map +1 -1
  99. package/dist/providers.js +16 -6
  100. package/dist/providers.js.map +1 -1
  101. package/dist/thinking/OllamaThinkingHandler.js +111 -0
  102. package/dist/thinking/OllamaThinkingHandler.js.map +1 -0
  103. package/dist/thinking/index.js +4 -1
  104. package/dist/thinking/index.js.map +1 -1
  105. package/dist/thinking/registry.js +2 -0
  106. package/dist/thinking/registry.js.map +1 -1
  107. package/dist/types/adapters/llm/OllamaProvider.d.ts +183 -0
  108. package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -0
  109. package/dist/types/adapters/llm/OpenAIProvider.d.ts +0 -12
  110. package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
  111. package/dist/types/adapters/llm/createProvider.d.ts +25 -8
  112. package/dist/types/adapters/llm/createProvider.d.ts.map +1 -1
  113. package/dist/types/core/Agent.d.ts +17 -0
  114. package/dist/types/core/Agent.d.ts.map +1 -1
  115. package/dist/types/core/agent/stages/seed.d.ts +11 -0
  116. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  117. package/dist/types/core/agent/stages/window.d.ts +13 -0
  118. package/dist/types/core/agent/stages/window.d.ts.map +1 -1
  119. package/dist/types/core/agent/types.d.ts +15 -1
  120. package/dist/types/core/agent/types.d.ts.map +1 -1
  121. package/dist/types/core/agent/window/errors.d.ts.map +1 -1
  122. package/dist/types/core/agent/window/folded.d.ts +91 -0
  123. package/dist/types/core/agent/window/folded.d.ts.map +1 -0
  124. package/dist/types/core/agent/window/index.d.ts +7 -1
  125. package/dist/types/core/agent/window/index.d.ts.map +1 -1
  126. package/dist/types/core/agent/window/options.d.ts +7 -1
  127. package/dist/types/core/agent/window/options.d.ts.map +1 -1
  128. package/dist/types/core/agent/window/strategies/slidingWindow.d.ts +2 -2
  129. package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts +4 -2
  130. package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -1
  131. package/dist/types/core/agent/window/strategy.d.ts +26 -1
  132. package/dist/types/core/agent/window/strategy.d.ts.map +1 -1
  133. package/dist/types/core/agent/window/summarize.d.ts +11 -0
  134. package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
  135. package/dist/types/core/agent/window/types.d.ts +106 -1
  136. package/dist/types/core/agent/window/types.d.ts.map +1 -1
  137. package/dist/types/core/runCheckpoint.d.ts +32 -1
  138. package/dist/types/core/runCheckpoint.d.ts.map +1 -1
  139. package/dist/types/index.d.ts +1 -1
  140. package/dist/types/index.d.ts.map +1 -1
  141. package/dist/types/providers.d.ts +13 -5
  142. package/dist/types/providers.d.ts.map +1 -1
  143. package/dist/types/thinking/OllamaThinkingHandler.d.ts +61 -0
  144. package/dist/types/thinking/OllamaThinkingHandler.d.ts.map +1 -0
  145. package/dist/types/thinking/index.d.ts +1 -0
  146. package/dist/types/thinking/index.d.ts.map +1 -1
  147. package/dist/types/thinking/registry.d.ts.map +1 -1
  148. package/package.json +3 -1
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * window/folded — join a summary sitting in a conversation back to what it
4
+ * stands for.
5
+ *
6
+ * Pattern: Pure lookup over recorded facts. No I/O, no inference.
7
+ * Role: core/ layer, and the ONE public door onto retained originals.
8
+ * Emits: N/A.
9
+ *
10
+ * ── Why a fingerprint and not an index ──────────────────────────────────────
11
+ * The obvious join key is "the summary is at `history[3]`". It is also wrong.
12
+ * A later fold swallows the span that CONTAINS an earlier summary, and every
13
+ * index after it moves; a conversation that folded four times would need its
14
+ * stored indices rewritten on every fold, and any reader holding an old one
15
+ * would silently be pointing at somebody else's message.
16
+ *
17
+ * So the join key is a fingerprint of the summary message's full content —
18
+ * authored frame included. Three things follow, and all three are the point:
19
+ *
20
+ * • it costs NO extra bytes on the wire (no id token planted in the frame);
21
+ * • it survives JSON, storage, and being read by a runtime that has never
22
+ * heard of this function;
23
+ * • it cannot be FORGED. A model that writes a message opening with the
24
+ * frame's own words produces different content, therefore a different
25
+ * fingerprint, therefore no match — `isCompactedSummary` alone says "this
26
+ * LOOKS like a frame", and this says "this IS the frame of a fold that was
27
+ * recorded". The two answers are different questions and the gap between
28
+ * them is exactly where a forgery would live.
29
+ *
30
+ * ── Absent is an answer ─────────────────────────────────────────────────────
31
+ * `undefined` means "no fold was recorded for this message" and never "there
32
+ * were no originals". A conversation stored by 8.1 has summaries and no spans
33
+ * at all; one folded under `retain: 'discard'` has a span whose `messages` is
34
+ * absent. Those are three different facts and the caller can tell them apart:
35
+ * no span, a span with no messages, a span with messages.
36
+ */
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.foldedMessages = exports.foldedSpanFor = exports.summaryFingerprint = void 0;
39
+ const helpers_js_1 = require("../../slots/helpers.js");
40
+ /**
41
+ * The join key for one summary message: a fingerprint of its whole content.
42
+ *
43
+ * @internal Consumers join through {@link foldedSpanFor}; this is exported for
44
+ * the strategy that stamps the span and for tests that pin the two agree.
45
+ */
46
+ function summaryFingerprint(content) {
47
+ return (0, helpers_js_1.fnv1a)(content);
48
+ }
49
+ exports.summaryFingerprint = summaryFingerprint;
50
+ /**
51
+ * What one summary message in a conversation stands for.
52
+ *
53
+ * Hand it the conversation you stored and a message out of its `history`; get
54
+ * back the fold that produced that message, with the original messages when
55
+ * the policy retained them.
56
+ *
57
+ * @returns the span, or `undefined` when this conversation recorded no fold
58
+ * for this message — see "Absent is an answer" above.
59
+ *
60
+ * @example Show a user what the agent actually saw last week
61
+ * ```ts
62
+ * import { foldedSpanFor, isCompactedSummary } from 'agentfootprint';
63
+ *
64
+ * const conversation = readEnvelope(await sessions.hydrate(sessionId));
65
+ * for (const message of conversation.history) {
66
+ * if (!isCompactedSummary(message)) continue;
67
+ * const span = foldedSpanFor(conversation, message);
68
+ * console.log(`summary of ${span?.messageCount ?? '?'} messages`);
69
+ * for (const original of span?.messages ?? []) {
70
+ * console.log(` ${original.role}: ${original.content}`);
71
+ * }
72
+ * }
73
+ * ```
74
+ */
75
+ function foldedSpanFor(conversation, message) {
76
+ const spans = conversation.folded;
77
+ if (spans === undefined || spans.length === 0)
78
+ return undefined;
79
+ const fingerprint = summaryFingerprint(message.content);
80
+ return spans.find((span) => span.summaryFingerprint === fingerprint);
81
+ }
82
+ exports.foldedSpanFor = foldedSpanFor;
83
+ /**
84
+ * Every message this conversation ever folded, oldest fold first, flattened.
85
+ *
86
+ * The transcript-shaped answer to `foldedSpanFor`'s message-shaped one: what
87
+ * a support view prints when somebody asks what the agent was told before the
88
+ * summaries. Spans that were discarded contribute nothing — they have nothing
89
+ * to contribute, and `foldedSpanFor` is where you find out that they existed.
90
+ */
91
+ function foldedMessages(conversation) {
92
+ const out = [];
93
+ for (const span of conversation.folded ?? [])
94
+ out.push(...(span.messages ?? []));
95
+ return out;
96
+ }
97
+ exports.foldedMessages = foldedMessages;
98
+ //# sourceMappingURL=folded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folded.js","sourceRoot":"","sources":["../../../../src/core/agent/window/folded.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AAEH,uDAA+C;AAI/C;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,OAAe;IAChD,OAAO,IAAA,kBAAK,EAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAFD,gDAEC;AAcD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,aAAa,CAC3B,YAAgC,EAChC,OAAmB;IAEnB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC;IAClC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,KAAK,WAAW,CAAC,CAAC;AACvE,CAAC;AARD,sCAQC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,YAAgC;IAC7D,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,MAAM,IAAI,EAAE;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;IACjF,OAAO,GAAG,CAAC;AACb,CAAC;AAJD,wCAIC"}
@@ -9,6 +9,11 @@
9
9
  * is a claim about the past, so this library files it as a claim — not as the
10
10
  * past. A drop is an absence, and it is named the same way.
11
11
  *
12
+ * A commit log lives as long as the process. A conversation lives longer, so
13
+ * `.compaction({ retain })` also carries the folded originals on the
14
+ * conversation checkpoint — `foldedSpanFor(conversation, message)` is the door
15
+ * back to them, in this process or the one after the deploy.
16
+ *
12
17
  * Three strategies ship, all sharing one turn segmentation and one refusal
13
18
  * engine:
14
19
  * `summarizeOldest` fold the oldest span into a summary (`.compaction()`)
@@ -18,9 +23,12 @@
18
23
  * Public surface (re-exported from the package root).
19
24
  */
20
25
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.tokenBudget = exports.slidingWindow = exports.summarizeOldest = exports.isDropNotice = exports.DROP_NOTICE_PREFIX = exports.isCompactedSummary = exports.COMPACTED_FRAME_PREFIX = exports.CompactionUnmeasurableError = void 0;
26
+ exports.tokenBudget = exports.slidingWindow = exports.summarizeOldest = exports.isDropNotice = exports.DROP_NOTICE_PREFIX = exports.isCompactedSummary = exports.COMPACTED_FRAME_PREFIX = exports.foldedSpanFor = exports.foldedMessages = exports.CompactionUnmeasurableError = void 0;
22
27
  var errors_js_1 = require("./errors.js");
23
28
  Object.defineProperty(exports, "CompactionUnmeasurableError", { enumerable: true, get: function () { return errors_js_1.CompactionUnmeasurableError; } });
29
+ var folded_js_1 = require("./folded.js");
30
+ Object.defineProperty(exports, "foldedMessages", { enumerable: true, get: function () { return folded_js_1.foldedMessages; } });
31
+ Object.defineProperty(exports, "foldedSpanFor", { enumerable: true, get: function () { return folded_js_1.foldedSpanFor; } });
24
32
  var summarize_js_1 = require("./summarize.js");
25
33
  Object.defineProperty(exports, "COMPACTED_FRAME_PREFIX", { enumerable: true, get: function () { return summarize_js_1.COMPACTED_FRAME_PREFIX; } });
26
34
  Object.defineProperty(exports, "isCompactedSummary", { enumerable: true, get: function () { return summarize_js_1.isCompactedSummary; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/agent/window/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,yCAA0D;AAAjD,wHAAA,2BAA2B,OAAA;AAuBpC,+CAA4E;AAAnE,sHAAA,sBAAsB,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AACnD,yCAA+D;AAAtD,+GAAA,kBAAkB,OAAA;AAAE,yGAAA,YAAY,OAAA;AACzC,sEAAkE;AAAzD,qHAAA,eAAe,OAAA;AACxB,kEAA8D;AAArD,iHAAA,aAAa,OAAA;AACtB,8DAA0D;AAAjD,6GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/agent/window/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH,yCAA0D;AAAjD,wHAAA,2BAA2B,OAAA;AAiBpC,yCAAqF;AAA5E,2GAAA,cAAc,OAAA;AAAE,0GAAA,aAAa,OAAA;AAStC,+CAA4E;AAAnE,sHAAA,sBAAsB,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AACnD,yCAA+D;AAAtD,+GAAA,kBAAkB,OAAA;AAAE,yGAAA,YAAY,OAAA;AACzC,sEAAkE;AAAzD,qHAAA,eAAe,OAAA;AACxB,kEAA8D;AAArD,iHAAA,aAAa,OAAA;AACtB,8DAA0D;AAAjD,6GAAA,WAAW,OAAA"}
@@ -15,9 +15,16 @@
15
15
  * money to discover.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.resolveTokenBudgetOptions = exports.resolveSlidingWindowOptions = exports.resolveCompactionOptions = exports.DEFAULT_KEEP_RECENT_TURNS = void 0;
18
+ exports.resolveTokenBudgetOptions = exports.resolveSlidingWindowOptions = exports.resolveCompactionOptions = exports.DEFAULT_RETENTION = exports.DEFAULT_KEEP_RECENT_TURNS = void 0;
19
19
  /** Default depth of the "never touch this" recent window. */
20
20
  exports.DEFAULT_KEEP_RECENT_TURNS = 6;
21
+ /**
22
+ * What happens to folded messages when nobody said. The originals ride with
23
+ * the conversation: losing them has to be a choice somebody typed, not a
24
+ * default they inherited.
25
+ */
26
+ exports.DEFAULT_RETENTION = 'conversation';
27
+ const RETENTIONS = ['conversation', 'discard'];
21
28
  function requireObject(options, label, shape) {
22
29
  if (options === null || typeof options !== 'object') {
23
30
  throw new Error(`${label}: expected an options object (${shape}), got ${typeof options}.`);
@@ -46,7 +53,7 @@ function requireKeepRecentTurns(keepRecentTurns, label) {
46
53
  */
47
54
  function resolveCompactionOptions(options, label) {
48
55
  requireObject(options, label, '{ thresholdTokens, summarizer, ... }');
49
- const { thresholdTokens, summarizer, keepRecentTurns, model } = options;
56
+ const { thresholdTokens, summarizer, keepRecentTurns, model, retain } = options;
50
57
  requireThreshold(thresholdTokens, label);
51
58
  if (summarizer === null ||
52
59
  typeof summarizer !== 'object' ||
@@ -60,11 +67,20 @@ function resolveCompactionOptions(options, label) {
60
67
  if (model !== undefined && (typeof model !== 'string' || model.length === 0)) {
61
68
  throw new Error(`${label}: model must be a non-empty model id, got ${String(model)}.`);
62
69
  }
70
+ if (retain !== undefined && !RETENTIONS.includes(retain)) {
71
+ throw new Error(`${label}: retain must be ${RETENTIONS.map((r) => `'${r}'`).join(' or ')}, got ` +
72
+ `${String(retain)}. It decides what happens to the messages a fold removes: ` +
73
+ `'conversation' (the default) carries them on the conversation checkpoint so a ` +
74
+ `restart can still produce them, and 'discard' does not. A value this library does ` +
75
+ `not recognise is refused rather than treated as one of them — guessing here would ` +
76
+ `mean guessing whether to keep somebody's transcript.`);
77
+ }
63
78
  return {
64
79
  thresholdTokens,
65
80
  keepRecentTurns: keepRecentTurns ?? exports.DEFAULT_KEEP_RECENT_TURNS,
66
81
  summarizer,
67
82
  model,
83
+ retain: retain ?? exports.DEFAULT_RETENTION,
68
84
  };
69
85
  }
70
86
  exports.resolveCompactionOptions = resolveCompactionOptions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C,MAAM,CAAC,4DAA4D;YAC7E,gFAAgF;YAChF,oFAAoF;YACpF,oFAAoF;YACpF,sDAAsD,CACzD,CAAC;IACJ,CAAC;IACD,OAAO;QACL,eAAe;QACf,eAAe,EAAE,eAAe,IAAI,iCAAyB;QAC7D,UAAU;QACV,KAAK;QACL,MAAM,EAAE,MAAM,IAAI,yBAAiB;KACpC,CAAC;AACJ,CAAC;AAvCD,4DAuCC;AAED,0CAA0C;AAC1C,SAAgB,2BAA2B,CACzC,OAA6B,EAC7B,KAAa;IAEb,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC;IACrD,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACpC,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,gFAAgF;YACtF,2EAA2E,CAC9E,CAAC;IACJ,CAAC;IACD,sBAAsB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAC7B,CAAC;AAdD,kEAcC;AAED,wCAAwC;AACxC,SAAgB,yBAAyB,CACvC,OAA2B,EAC3B,KAAa;IAEb,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,uCAAuC,CAAC,CAAC;IACvE,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACrD,gBAAgB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACzC,IAAI,eAAe,KAAK,SAAS;QAAE,sBAAsB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAClF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,IAAI,iCAAyB,EAAE,CAAC;AAC5F,CAAC;AATD,8DASC"}
@@ -40,10 +40,10 @@ exports.SLIDING_WINDOW = 'sliding-window';
40
40
  * @example
41
41
  * ```ts
42
42
  * import { Agent, slidingWindow } from 'agentfootprint';
43
- * import { ollama } from 'agentfootprint/llm-providers';
43
+ * import { ollama } from 'agentfootprint/providers';
44
44
  *
45
45
  * // Works on a provider that reports no usage at all: the trigger is turns.
46
- * const agent = Agent.create({ provider: ollama(), model: 'llama3' })
46
+ * const agent = Agent.create({ provider: ollama('llama3.2'), model: 'llama3.2' })
47
47
  * .window(slidingWindow({ keepRecentTurns: 12 }))
48
48
  * .build();
49
49
  * ```
@@ -11,8 +11,10 @@
11
11
  * This is what `.compaction({...})` configures, and the market's familiar
12
12
  * move (Claude Code / the Claude Agent SDK call it compaction). What is
13
13
  * different here is not the fold — it is that the fold is filed as a claim:
14
- * a summary is a claim ABOUT the past, and the past itself stays in the
15
- * commit log, byte for byte.
14
+ * a summary is a claim ABOUT the past, and the past itself stays. In the
15
+ * commit log for as long as the process lives, and since 8.2, under
16
+ * `retain: 'conversation'` — on the conversation checkpoint for as long as
17
+ * the conversation does, which is the half a standing agent actually needs.
16
18
  *
17
19
  * Everything it decides, it explains. Every engaged path returns a record —
18
20
  * including the paths that change nothing, which are the ones a person
@@ -21,6 +23,7 @@
21
23
  Object.defineProperty(exports, "__esModule", { value: true });
22
24
  exports.summarizeOldest = exports.SUMMARIZE_OLDEST = void 0;
23
25
  const errors_js_1 = require("../errors.js");
26
+ const folded_js_1 = require("../folded.js");
24
27
  const options_js_1 = require("../options.js");
25
28
  const removal_js_1 = require("../removal.js");
26
29
  const summarize_js_1 = require("../summarize.js");
@@ -125,6 +128,7 @@ function summarizeOldest(options) {
125
128
  foldedMessageCount: span.length,
126
129
  iteration,
127
130
  model,
131
+ retain: config.retain,
128
132
  });
129
133
  const spend = { model, usage: summary.usage };
130
134
  // Would the fold actually help? A summary plus its authored frame can be
@@ -143,6 +147,24 @@ function summarizeOldest(options) {
143
147
  const foldedAtMs = input.now();
144
148
  const facts = input.removalFacts((0, removal_js_1.indexRange)(spanStart, spanEnd), foldedAtMs);
145
149
  const window = [...head, summaryMessage, ...tail];
150
+ // The durable half. It rides the SAME result the window change rides,
151
+ // so the stage commits both together — there is no ordering in which
152
+ // the messages leave and the record of what they were does not follow.
153
+ // Under 'discard' the span is still filed: a discard is an absence, and
154
+ // this family files absences the same way it files claims.
155
+ const foldedSpan = {
156
+ summaryFingerprint: (0, folded_js_1.summaryFingerprint)(summaryMessage.content),
157
+ runId: input.runId,
158
+ iteration,
159
+ foldedAtMs,
160
+ model,
161
+ messageCount: span.length,
162
+ removedStageIds: facts.removedStageIds,
163
+ retained: config.retain,
164
+ // Detached before it is handed on: `history` came off a live scope and
165
+ // a stored conversation must never hold a reference into the heap.
166
+ ...(config.retain === 'conversation' && { messages: span.map((m) => ({ ...m })) }),
167
+ };
146
168
  const record = {
147
169
  ...base,
148
170
  removedStageIds: facts.removedStageIds,
@@ -164,6 +186,7 @@ function summarizeOldest(options) {
164
186
  },
165
187
  record,
166
188
  evictions: facts.evictions,
189
+ folded: [foldedSpan],
167
190
  budgetPressure: {
168
191
  capTokens: config.thresholdTokens,
169
192
  projectedTokens: measured.input,
@@ -1 +1 @@
1
- {"version":3,"file":"summarizeOldest.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategies/summarizeOldest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,4CAA2D;AAC3D,8CAAyD;AACzD,8CAA2C;AAE3C,kDAAyF;AACzF,0CAA0C;AAG1C,2EAA2E;AAC9D,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,eAAe,CAAC,OAA0B;IACxD,MAAM,MAAM,GAAG,IAAA,qCAAwB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAEpE,OAAO;QACL,IAAI,EAAE,wBAAgB;QAEtB,KAAK,CAAC,IAAI,CAAC,KAA0B;YACnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;YAEtD,qEAAqE;YACrE,+CAA+C;YAC/C,IAAI,QAAQ,KAAK,S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YAClD,MAAM,MAAM,GAAqB;gBAC/B,GAAG,IAAI;gBACP,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,mBAAmB,EAAE,IAAI,CAAC,MAAM;gBAChC,gEAAgE;gBAChE,cAAc,EAAE,KAAK,CAAC,eAAe;gBACrC,kBAAkB,EAAE,IAAI,CAAC,MAAM;gBAC/B,gBAAgB,EAAE,IAAA,sBAAW,EAAC,MAAM,CAAC;gBACrC,YAAY,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM;gBAC3C,gBAAgB,EAAE,OAAO,CAAC,KAAK;gBAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC;YAEF,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE;oBACN,SAAS,EAAE,IAAI,CAAC,MAAM;oBACtB,aAAa,EAAE,IAAI,CAAC,MAAM;oBAC1B,YAAY,EAAE,UAAU;iBACzB;gBACD,MAAM;gBACN,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,cAAc,EAAE;oBACd,SAAS,EAAE,MAAM,CAAC,eAAe;oBACjC,eAAe,EAAE,QAAQ,CAAC,KAAK;oBAC/B,UAAU,EAAE,WAAW;iBACxB;gBACD,KAAK;aACN,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAjJD,0CAiJC"}
1
+ {"version":3,"file":"summarizeOldest.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategies/summarizeOldest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA2D;AAC3D,4CAAkD;AAClD,8CAAyD;AACzD,8CAA2C;AAE3C,kDAAyF;AACzF,0CAA0C;AAG1C,2EAA2E;AAC9D,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,eAAe,CAAC,OAA0B;IACxD,MAAM,MAAM,GAAG,IAAA,qCAAwB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAA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AAQ;aACxB,CAAC;YAEF,OAAO;gBACL,MAAM;gBACN,MAAM,EAAE;oBACN,SAAS,EAAE,IAAI,CAAC,MAAM;oBACtB,aAAa,EAAE,IAAI,CAAC,MAAM;oBAC1B,YAAY,EAAE,UAAU;iBACzB;gBACD,MAAM;gBACN,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,MAAM,EAAE,CAAC,UAAU,CAAC;gBACpB,cAAc,EAAE;oBACd,SAAS,EAAE,MAAM,CAAC,eAAe;oBACjC,eAAe,EAAE,QAAQ,CAAC,KAAK;oBAC/B,UAAU,EAAE,WAAW;iBACxB;gBACD,KAAK;aACN,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAvKD,0CAuKC"}
@@ -18,6 +18,11 @@
18
18
  *
19
19
  * The frame is authored. The summary is data. Neither can become
20
20
  * the other.
21
+ *
22
+ * A third rule joined them in 8.2: the frame may only claim what is
23
+ * true. It names where the folded messages went, and it reads that
24
+ * from the resolved retention policy rather than asserting a
25
+ * constant — see {@link retentionSentence}.
21
26
  * Emits: N/A (the stage emits; this file only builds and calls).
22
27
  */
23
28
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -60,6 +65,23 @@ function renderTranscript(messages) {
60
65
  return [TRANSCRIPT_OPEN, ...messages.map(renderMessage), TRANSCRIPT_CLOSE].join('\n');
61
66
  }
62
67
  exports.renderTranscript = renderTranscript;
68
+ /**
69
+ * Where the folded messages went, said in the frame itself.
70
+ *
71
+ * Through 8.1 this sentence was a constant: *"The folded messages are retained
72
+ * verbatim in this run's commit log."* True inside the process, and false the
73
+ * moment the run ended — which is exactly when a standing agent reads it back
74
+ * out of storage. A library asserting something false inside the model's own
75
+ * context is worse than saying nothing, so the sentence is now written FROM
76
+ * the resolved retention policy and can only say what actually happened.
77
+ */
78
+ function retentionSentence(retain) {
79
+ return retain === 'conversation'
80
+ ? `The folded messages are retained verbatim with this conversation and can be produced ` +
81
+ `on request.`
82
+ : `The folded messages were not retained beyond the run that folded them; only this ` +
83
+ `summary carries them forward.`;
84
+ }
63
85
  /**
64
86
  * Build the message that replaces the folded span IN THE WINDOW.
65
87
  *
@@ -69,12 +91,16 @@ exports.renderTranscript = renderTranscript;
69
91
  * The label is written by this function and always comes first. `summary` is
70
92
  * appended to it verbatim: the library never edits model output, and it never
71
93
  * lets model output speak in the library's voice either.
94
+ *
95
+ * The label states the retention policy, and states it truthfully — see
96
+ * {@link retentionSentence}. `COMPACTED_FRAME_PREFIX` is unchanged: it is what
97
+ * every reader and every test matches on, and it stays put.
72
98
  */
73
99
  function buildSummaryMessage(summary, facts) {
74
100
  const label = `${exports.COMPACTED_FRAME_PREFIX} — ${facts.foldedMessageCount} earlier message(s) were folded ` +
75
101
  `out of this window at iteration ${facts.iteration}. The text after this line is a SUMMARY ` +
76
102
  `written by ${facts.model}; it is a claim about the conversation, not the conversation. ` +
77
- `The folded messages are retained verbatim in this run's commit log.]`;
103
+ `${retentionSentence(facts.retain)}]`;
78
104
  return { role: 'user', content: `${label}\n\n${summary}` };
79
105
  }
80
106
  exports.buildSummaryMessage = buildSummaryMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../../../src/core/agent/window/summarize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAIH,6EAA6E;AAChE,QAAA,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,kFAAkF;AAClF,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAC3C,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD;;;;GAIG;AACU,QAAA,wBAAwB,GAAG;IACtC,wFAAwF;IACxF,kCAAkC;IAClC,EAAE;IACF,kCAAkC,eAAe,QAAQ,gBAAgB,sBAAsB;IAC/F,8FAA8F;IAC9F,6FAA6F;IAC7F,EAAE;IACF,4FAA4F;IAC5F,6FAA6F;IAC7F,gGAAgG;IAChG,yEAAyE;CAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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KAAK,gEAAgE;QACzF,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,OAAO,EAAE,EAAE,CAAC;AAC7D,CAAC;AAfD,kDAeC;AAED,+DAA+D;AAC/D,SAAgB,kBAAkB,CAAC,GAA2B;IAC5D,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,8BAAsB,CAAC,CAAC;AACpG,CAAC;AAFD,gDAEC;AAOD;;;;;;GAMG;AACI,KAAK,UAAU,aAAa,CACjC,QAAqB,EACrB,KAAa,EACb,IAA2B,EAC3B,MAA+B;IAE/B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC;QACvC,YAAY,EAAE,gCAAwB;QACtC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,KAAK;QACL,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;KACxC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC3D,CAAC;AAbD,sCAaC"}
@@ -18,6 +18,12 @@
18
18
  * filed as a claim — its own recorded step, naming every `runtimeStageId` it
19
19
  * folded. A drop is an ABSENCE, and it is filed the same way: the record and
20
20
  * the eviction events name what left, by id.
21
+ *
22
+ * That law holds for as long as the PROCESS holds — a commit log is memory.
23
+ * A conversation outlives its process, so the durable half of the same law
24
+ * lives on the conversation checkpoint: `.compaction({ retain })` carries the
25
+ * folded originals there, beside the summary that stands for them. See
26
+ * {@link CompactionRetention} and {@link FoldedSpan}.
21
27
  */
22
28
  Object.defineProperty(exports, "__esModule", { value: true });
23
29
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/agent/window/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/agent/window/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
@@ -107,7 +107,14 @@ exports.RunCheckpointError = RunCheckpointError;
107
107
  *
108
108
  * @internal
109
109
  */
110
- function buildCheckpoint(tracker, failurePoint) {
110
+ function buildCheckpoint(tracker, failurePoint,
111
+ /**
112
+ * Spans this run folded, read from committed state by the caller. Passed in
113
+ * rather than tracked, because the tracker follows `history` through events
114
+ * and a fold's span is committed state — and because the same reader then
115
+ * serves both checkpoint carriers, so neither can lose what the other keeps.
116
+ */
117
+ folded) {
111
118
  return {
112
119
  version: 1,
113
120
  runId: tracker.runId,
@@ -116,6 +123,7 @@ function buildCheckpoint(tracker, failurePoint) {
116
123
  originalInput: tracker.originalInput,
117
124
  checkpointedAt: Date.now(),
118
125
  ...(failurePoint && { failurePoint }),
126
+ ...(folded !== undefined && folded.length > 0 && { folded }),
119
127
  };
120
128
  }
121
129
  exports.buildCheckpoint = buildCheckpoint;
@@ -1 +1 @@
1
- {"version":3,"file":"runCheckpoint.js","sourceRoot":"","sources":["../../src/core/runCheckpoint.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;AA4CH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,oBAA6B,CAAC;IAC9C;;6BAEyB;IACP,KAAK,CAAQ;IAC/B;mEAC+D;IACtD,UAAU,CAAqB;IAExC,YAAY,KAAY,EAAE,UAA8B;QACtD,MAAM,KAAK,G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0B;QACzD,IAAI,KAAK,gBAAgB;QACzB,IAAI,KAAK,aAAa;QACtB,IAAI,KAAK,cAAc;QACvB,8CAA8C,CAAC,IAAI,CAAC,GAAG,CAAC,EACxD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,WAAW,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC;AAnBD,oDAmBC"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * OllamaProvider — local models over Ollama's native `/api/chat`.
3
+ *
4
+ * Pattern: Adapter (GoF) + Ports-and-Adapters (Cockburn 2005).
5
+ * Role: Outer ring — translates `LLMRequest`/`LLMResponse` to/from
6
+ * Ollama's native chat wire. Knows nothing about agents,
7
+ * recorders, or compositions.
8
+ * Emits: N/A.
9
+ *
10
+ * ─── Why this exists, and why it talks the native wire ───────────────
11
+ *
12
+ * The adapter ladder is `mock()` → a local model → a paid API, and the
13
+ * strongest version of "the test run and the production run are the same
14
+ * code path" is one where the middle step costs nothing and needs no API
15
+ * key. Through 8.0.0 the middle step needed BOTH a competitor's SDK
16
+ * (`npm install openai`, because `ollama()` was a thin wrapper over
17
+ * `openai({ baseURL })`) and a tolerance for failures labelled `[openai]`.
18
+ * That is not a free rung.
19
+ *
20
+ * So this file owns the wire:
21
+ *
22
+ * • ZERO dependencies — one `fetch` POST and NDJSON. Nothing to install
23
+ * beyond Ollama itself. (Same choice, same reasons, as the two
24
+ * `Browser*Provider` adapters.)
25
+ * • HONEST REFUSALS — a typed {@link OllamaUnavailableError} that names
26
+ * the address it tried and the command to run. Owning the fetch and
27
+ * the status code is what makes that possible; through an SDK you get
28
+ * whatever the SDK decided to throw.
29
+ * • REAL TOKEN COUNTS — `/api/chat` returns `prompt_eval_count` /
30
+ * `eval_count` on every response, streaming or not, with no opt-in
31
+ * flag. Through the OpenAI-compatible endpoint a streamed local call
32
+ * reported ZERO tokens, which silently disarmed `.compaction()` and
33
+ * `costBudget` (see `CompactionUnmeasurableError`, whose message names
34
+ * this exact case).
35
+ * • STRUCTURED THINKING — `message.thinking` is a first-class field on
36
+ * this wire; the OpenAI-compatible layer renames it to a non-standard
37
+ * `reasoning` key that no OpenAI adapter reads. See
38
+ * `OllamaThinkingHandler`.
39
+ *
40
+ * Want the SDK path instead? It is still there and still supported:
41
+ * `openai({ baseURL: 'http://localhost:11434/v1', apiKey: 'ollama' })`.
42
+ *
43
+ * ─── Ceilings (stated, not worked around) ────────────────────────────
44
+ *
45
+ * • TOOL CALLING IS MODEL-DEPENDENT. Ollama forwards a `tools` array to
46
+ * any model; a model that was not trained for tools simply answers in
47
+ * prose and no tool call ever arrives. This adapter does not preflight
48
+ * `/api/show` capabilities to refuse first — a wrong refusal is worse
49
+ * than a weak answer, and the metadata is less reliable than the
50
+ * ceiling being written down. Pick a tool-capable model.
51
+ * • NO FORCED TOOL CHOICE. Ollama does not support `tool_choice` on
52
+ * either wire, so `carriesForcedToolChoice` is `false` and an agent
53
+ * using `.outputSchema(parser, { strategy: 'tool-forced' })` refuses at
54
+ * run start, naming this provider.
55
+ * • NO MULTI-MODAL. The wire carries `images`; `LLMMessage.content` is a
56
+ * string. Same ceiling as every other adapter here.
57
+ * • NO PROMPT CACHING — resolves to the NoOp cache strategy.
58
+ * • NO `providerRef`. The native wire returns no response id, and a
59
+ * fabricated one would point at nothing.
60
+ */
61
+ import type { LLMCallHooks, LLMChunk, LLMProvider, LLMRequest, LLMResponse, WireRole } from '../types.js';
62
+ /** How hard a thinking model should think. Ollama's own vocabulary. */
63
+ export type ThinkLevel = 'low' | 'medium' | 'high' | 'max';
64
+ /**
65
+ * The two failures a local runtime actually has, told in words that
66
+ * contain the fix.
67
+ *
68
+ * Both are things the person at the keyboard can resolve in one command,
69
+ * which is exactly why they get a type instead of a wrapped
70
+ * `ECONNREFUSED` or a bare `404`. `reason` is the discriminator; the
71
+ * message already reads as instructions.
72
+ */
73
+ export declare class OllamaUnavailableError extends Error {
74
+ readonly name = "OllamaUnavailableError";
75
+ /** Which of the two situations this is. */
76
+ readonly reason: 'daemon-unreachable' | 'model-not-pulled';
77
+ /** The address that was tried — the thing to check or change. */
78
+ readonly baseUrl: string;
79
+ /** The model asked for. Absent when the daemon never answered at all. */
80
+ readonly model?: string;
81
+ /** Models this machine DOES have, when the daemon could tell us. */
82
+ readonly availableModels?: readonly string[];
83
+ constructor(init: {
84
+ reason: 'daemon-unreachable' | 'model-not-pulled';
85
+ baseUrl: string;
86
+ model?: string;
87
+ availableModels?: readonly string[];
88
+ cause?: unknown;
89
+ });
90
+ }
91
+ export interface OllamaProviderOptions {
92
+ /**
93
+ * Where Ollama is listening. Defaults to `OLLAMA_HOST` when set,
94
+ * otherwise `http://localhost:11434`. A bare `host:port` gets `http://`.
95
+ *
96
+ * Point it at the ROOT, not at a path — this adapter talks to
97
+ * `/api/chat` and `/api/tags` itself. A URL ending in `/v1` (the
98
+ * OpenAI-compatible path) is accepted and trimmed, so a config written
99
+ * for the 8.0.0 factory keeps working.
100
+ */
101
+ readonly baseUrl?: string;
102
+ /** Shipped-in-8.0.0 spelling of {@link baseUrl}. Still honored. */
103
+ readonly host?: string;
104
+ /** Shipped-in-8.0.0 spelling of {@link baseUrl}. Still honored. */
105
+ readonly baseURL?: string;
106
+ /**
107
+ * Model used when `LLMRequest.model` is the `'ollama'` shorthand.
108
+ * Prefer the positional form: `ollama('qwen3')`.
109
+ */
110
+ readonly defaultModel?: string;
111
+ /** Default token cap when the request doesn't set one. Maps to `num_predict`. */
112
+ readonly defaultMaxTokens?: number;
113
+ /**
114
+ * Ask a thinking model to reason before answering. `true` turns it on;
115
+ * `'low' | 'medium' | 'high' | 'max'` sets how hard.
116
+ *
117
+ * Worth setting on reasoning models (deepseek-r1, qwen3, gpt-oss, …):
118
+ * with `think` on, Ollama lifts the reasoning OUT of the answer into
119
+ * `message.thinking`, where `ollamaThinkingHandler` normalizes it.
120
+ * With it off, the same model leaves `<think>…</think>` sitting in the
121
+ * answer text.
122
+ *
123
+ * A per-request `LLMRequest.thinking` (what `AgentBuilder.thinking()`
124
+ * sets) also turns it on; this option is the always-on default and the
125
+ * only way to name a level.
126
+ */
127
+ readonly think?: boolean | ThinkLevel;
128
+ /** How long Ollama keeps the model in memory after a call, e.g. `'5m'`. */
129
+ readonly keepAlive?: string | number;
130
+ /**
131
+ * How long to wait for the daemon to ANSWER, in ms. Default 10000.
132
+ *
133
+ * This bounds the wait for response headers, NOT generation: a laptop
134
+ * model may take minutes to finish a long answer and that is fine. What
135
+ * it prevents is the failure this whole file exists to avoid — a run
136
+ * that hangs because nothing is listening.
137
+ */
138
+ readonly timeoutMs?: number;
139
+ /** Accepted and ignored — Ollama needs no key. Kept so 8.0.0 configs still typecheck. */
140
+ readonly apiKey?: string;
141
+ /** @internal Custom fetch implementation for tests. */
142
+ readonly _fetch?: typeof fetch;
143
+ }
144
+ /**
145
+ * Build an `LLMProvider` backed by a local Ollama runtime.
146
+ *
147
+ * Free, offline, no API key. The rung between `mock()` and a paid API —
148
+ * and the agent code above it does not change between the three.
149
+ *
150
+ * @example
151
+ * import { Agent } from 'agentfootprint';
152
+ * import { ollama } from 'agentfootprint/providers';
153
+ *
154
+ * const agent = Agent.create({
155
+ * provider: ollama('qwen3'),
156
+ * model: 'qwen3',
157
+ * }).build();
158
+ *
159
+ * @example // reasoning model, thinking lifted out of the answer
160
+ * ollama('deepseek-r1', { think: 'high' });
161
+ *
162
+ * @example // a runtime on another machine
163
+ * ollama('llama3.2', { baseUrl: 'http://192.168.1.20:11434' });
164
+ */
165
+ export declare function ollama(model: string, options?: OllamaProviderOptions): LLMProvider;
166
+ /**
167
+ * Object form, as shipped in 8.0.0. Still supported — `host` / `baseURL` /
168
+ * `defaultModel` / `apiKey` all keep their meaning.
169
+ */
170
+ export declare function ollama(options?: OllamaProviderOptions): LLMProvider;
171
+ /**
172
+ * Class form for consumers who prefer `new OllamaProvider(...)`.
173
+ */
174
+ export declare class OllamaProvider implements LLMProvider {
175
+ readonly name = "ollama";
176
+ readonly carriesInMessages: readonly WireRole[];
177
+ readonly carriesForcedToolChoice = false;
178
+ private readonly inner;
179
+ constructor(model?: string | OllamaProviderOptions, options?: OllamaProviderOptions);
180
+ complete(req: LLMRequest, hooks?: LLMCallHooks): Promise<LLMResponse>;
181
+ stream(req: LLMRequest, hooks?: LLMCallHooks): AsyncIterable<LLMChunk>;
182
+ }