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.
- package/AGENTS.md +14 -9
- package/README.md +11 -7
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/ai-instructions/clinerules +1 -1
- package/ai-instructions/copilot-instructions.md +1 -1
- package/ai-instructions/cursor/agentfootprint.md +1 -1
- package/ai-instructions/kiro/agentfootprint.md +1 -1
- package/ai-instructions/windsurfrules +1 -1
- package/dist/adapters/llm/OllamaProvider.js +628 -0
- package/dist/adapters/llm/OllamaProvider.js.map +1 -0
- package/dist/adapters/llm/OpenAIProvider.js +12 -21
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/createProvider.js +35 -6
- package/dist/adapters/llm/createProvider.js.map +1 -1
- package/dist/core/Agent.js +44 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/stages/seed.js +10 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/window.js +21 -0
- package/dist/core/agent/stages/window.js.map +1 -1
- package/dist/core/agent/window/errors.js +4 -3
- package/dist/core/agent/window/errors.js.map +1 -1
- package/dist/core/agent/window/folded.js +98 -0
- package/dist/core/agent/window/folded.js.map +1 -0
- package/dist/core/agent/window/index.js +9 -1
- package/dist/core/agent/window/index.js.map +1 -1
- package/dist/core/agent/window/options.js +18 -2
- package/dist/core/agent/window/options.js.map +1 -1
- package/dist/core/agent/window/strategies/slidingWindow.js +2 -2
- package/dist/core/agent/window/strategies/summarizeOldest.js +25 -2
- package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -1
- package/dist/core/agent/window/summarize.js +27 -1
- package/dist/core/agent/window/summarize.js.map +1 -1
- package/dist/core/agent/window/types.js +6 -0
- package/dist/core/agent/window/types.js.map +1 -1
- package/dist/core/runCheckpoint.js +9 -1
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/esm/adapters/llm/OllamaProvider.d.ts +182 -0
- package/dist/esm/adapters/llm/OllamaProvider.js +622 -0
- package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -0
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +0 -12
- package/dist/esm/adapters/llm/OpenAIProvider.js +11 -19
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/createProvider.d.ts +25 -8
- package/dist/esm/adapters/llm/createProvider.js +35 -6
- package/dist/esm/adapters/llm/createProvider.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +17 -0
- package/dist/esm/core/Agent.js +44 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +11 -0
- package/dist/esm/core/agent/stages/seed.js +10 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/window.d.ts +13 -0
- package/dist/esm/core/agent/stages/window.js +21 -0
- package/dist/esm/core/agent/stages/window.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +15 -1
- package/dist/esm/core/agent/window/errors.js +4 -3
- package/dist/esm/core/agent/window/errors.js.map +1 -1
- package/dist/esm/core/agent/window/folded.d.ts +90 -0
- package/dist/esm/core/agent/window/folded.js +92 -0
- package/dist/esm/core/agent/window/folded.js.map +1 -0
- package/dist/esm/core/agent/window/index.d.ts +7 -1
- package/dist/esm/core/agent/window/index.js +6 -0
- package/dist/esm/core/agent/window/index.js.map +1 -1
- package/dist/esm/core/agent/window/options.d.ts +7 -1
- package/dist/esm/core/agent/window/options.js +17 -1
- package/dist/esm/core/agent/window/options.js.map +1 -1
- package/dist/esm/core/agent/window/strategies/slidingWindow.d.ts +2 -2
- package/dist/esm/core/agent/window/strategies/slidingWindow.js +2 -2
- package/dist/esm/core/agent/window/strategies/summarizeOldest.d.ts +4 -2
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js +25 -2
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -1
- package/dist/esm/core/agent/window/strategy.d.ts +26 -1
- package/dist/esm/core/agent/window/summarize.d.ts +11 -0
- package/dist/esm/core/agent/window/summarize.js +27 -1
- package/dist/esm/core/agent/window/summarize.js.map +1 -1
- package/dist/esm/core/agent/window/types.d.ts +106 -1
- package/dist/esm/core/agent/window/types.js +6 -0
- package/dist/esm/core/agent/window/types.js.map +1 -1
- package/dist/esm/core/runCheckpoint.d.ts +32 -1
- package/dist/esm/core/runCheckpoint.js +9 -1
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers.d.ts +13 -5
- package/dist/esm/providers.js +13 -5
- package/dist/esm/providers.js.map +1 -1
- package/dist/esm/thinking/OllamaThinkingHandler.d.ts +60 -0
- package/dist/esm/thinking/OllamaThinkingHandler.js +107 -0
- package/dist/esm/thinking/OllamaThinkingHandler.js.map +1 -0
- package/dist/esm/thinking/index.d.ts +1 -0
- package/dist/esm/thinking/index.js +1 -0
- package/dist/esm/thinking/index.js.map +1 -1
- package/dist/esm/thinking/registry.js +2 -0
- package/dist/esm/thinking/registry.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/providers.js +16 -6
- package/dist/providers.js.map +1 -1
- package/dist/thinking/OllamaThinkingHandler.js +111 -0
- package/dist/thinking/OllamaThinkingHandler.js.map +1 -0
- package/dist/thinking/index.js +4 -1
- package/dist/thinking/index.js.map +1 -1
- package/dist/thinking/registry.js +2 -0
- package/dist/thinking/registry.js.map +1 -1
- package/dist/types/adapters/llm/OllamaProvider.d.ts +183 -0
- package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -0
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +0 -12
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/createProvider.d.ts +25 -8
- package/dist/types/adapters/llm/createProvider.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +17 -0
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +11 -0
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/window.d.ts +13 -0
- package/dist/types/core/agent/stages/window.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +15 -1
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/agent/window/errors.d.ts.map +1 -1
- package/dist/types/core/agent/window/folded.d.ts +91 -0
- package/dist/types/core/agent/window/folded.d.ts.map +1 -0
- package/dist/types/core/agent/window/index.d.ts +7 -1
- package/dist/types/core/agent/window/index.d.ts.map +1 -1
- package/dist/types/core/agent/window/options.d.ts +7 -1
- package/dist/types/core/agent/window/options.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategies/slidingWindow.d.ts +2 -2
- package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts +4 -2
- package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategy.d.ts +26 -1
- package/dist/types/core/agent/window/strategy.d.ts.map +1 -1
- package/dist/types/core/agent/window/summarize.d.ts +11 -0
- package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
- package/dist/types/core/agent/window/types.d.ts +106 -1
- package/dist/types/core/agent/window/types.d.ts.map +1 -1
- package/dist/types/core/runCheckpoint.d.ts +32 -1
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/providers.d.ts +13 -5
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/thinking/OllamaThinkingHandler.d.ts +61 -0
- package/dist/types/thinking/OllamaThinkingHandler.d.ts.map +1 -0
- package/dist/types/thinking/index.d.ts +1 -0
- package/dist/types/thinking/index.d.ts.map +1 -1
- package/dist/types/thinking/registry.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -17,8 +17,14 @@
|
|
|
17
17
|
* filed as a claim — its own recorded step, naming every `runtimeStageId` it
|
|
18
18
|
* folded. A drop is an ABSENCE, and it is filed the same way: the record and
|
|
19
19
|
* the eviction events name what left, by id.
|
|
20
|
+
*
|
|
21
|
+
* That law holds for as long as the PROCESS holds — a commit log is memory.
|
|
22
|
+
* A conversation outlives its process, so the durable half of the same law
|
|
23
|
+
* lives on the conversation checkpoint: `.compaction({ retain })` carries the
|
|
24
|
+
* folded originals there, beside the summary that stands for them. See
|
|
25
|
+
* {@link CompactionRetention} and {@link FoldedSpan}.
|
|
20
26
|
*/
|
|
21
|
-
import type { LLMProvider } from '../../../adapters/types.js';
|
|
27
|
+
import type { LLMMessage, LLMProvider } from '../../../adapters/types.js';
|
|
22
28
|
/**
|
|
23
29
|
* Why a turn refused to leave the window. Every one of these is NAMED in the
|
|
24
30
|
* commit — a removal that took less than it could have has to say why, or the
|
|
@@ -169,6 +175,87 @@ export interface TokenBudgetRecord extends WindowRecord {
|
|
|
169
175
|
/** How many recent turns were off-limits to this visit. */
|
|
170
176
|
readonly keepRecentTurns: number;
|
|
171
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* What becomes of the messages a fold removes from the window.
|
|
180
|
+
*
|
|
181
|
+
* The commit log keeps them for as long as the PROCESS keeps them, and that
|
|
182
|
+
* is the whole of what 8.1 offered. A standing agent outlives its process, so
|
|
183
|
+
* "the folded turns are still in the commit log" stops being true the moment
|
|
184
|
+
* the run ends — and the summary sitting in the restored conversation went on
|
|
185
|
+
* claiming otherwise. Retention is the fix: the originals ride with the
|
|
186
|
+
* CONVERSATION, which is the thing that actually survives.
|
|
187
|
+
*
|
|
188
|
+
* The trade is stated rather than hidden: **compaction shrinks the wire, not
|
|
189
|
+
* the record.** A stored session grows as it folds. That is the right way
|
|
190
|
+
* round — the model's context window is scarce and a session row is not.
|
|
191
|
+
*/
|
|
192
|
+
export type CompactionRetention =
|
|
193
|
+
/**
|
|
194
|
+
* The folded messages ride with the conversation checkpoint, so a restart —
|
|
195
|
+
* a new process, a new machine, a deploy — can still produce them verbatim.
|
|
196
|
+
* The default: originals are never destroyed unless you say so.
|
|
197
|
+
*/
|
|
198
|
+
'conversation'
|
|
199
|
+
/**
|
|
200
|
+
* The folded messages are NOT carried forward. The span is still recorded,
|
|
201
|
+
* naming what left and how much of it, because a discard is an absence and
|
|
202
|
+
* this family files absences the same way it files claims. Choose it when
|
|
203
|
+
* the conversation is the only thing you want to keep and the storage cost
|
|
204
|
+
* of the transcript is not worth paying.
|
|
205
|
+
*/
|
|
206
|
+
| 'discard';
|
|
207
|
+
/**
|
|
208
|
+
* One fold, as it survives the process: the summary's fingerprint, what it
|
|
209
|
+
* stands for, and — under `retain: 'conversation'` — the messages themselves.
|
|
210
|
+
*
|
|
211
|
+
* These accumulate on the conversation checkpoint across every turn and every
|
|
212
|
+
* restart, so a standing agent that folded week one in April can still produce
|
|
213
|
+
* week one in July.
|
|
214
|
+
*
|
|
215
|
+
* ## Joining a span to its summary
|
|
216
|
+
*
|
|
217
|
+
* By CONTENT FINGERPRINT, never by index: a later fold can swallow an earlier
|
|
218
|
+
* summary, and every index in the window moves when it does. {@link
|
|
219
|
+
* foldedSpanFor} does the join for you.
|
|
220
|
+
*/
|
|
221
|
+
export interface FoldedSpan {
|
|
222
|
+
/**
|
|
223
|
+
* Fingerprint of the summary message this span was folded into — the join
|
|
224
|
+
* key back to the message sitting in `history`.
|
|
225
|
+
*
|
|
226
|
+
* It is a hash of the message's full content (authored frame included), so
|
|
227
|
+
* it costs no extra bytes on the wire and cannot be forged by a summary that
|
|
228
|
+
* merely copies the frame's opening words: different content, different
|
|
229
|
+
* fingerprint, no match.
|
|
230
|
+
*/
|
|
231
|
+
readonly summaryFingerprint: string;
|
|
232
|
+
/**
|
|
233
|
+
* The run whose commit log held these messages. Diagnostic, and the honest
|
|
234
|
+
* answer to "where else could I have found this?" — that log is gone with
|
|
235
|
+
* the process, which is why the messages are here.
|
|
236
|
+
*/
|
|
237
|
+
readonly runId: string;
|
|
238
|
+
/** ReAct iteration the fold happened at, in that run. */
|
|
239
|
+
readonly iteration: number;
|
|
240
|
+
/** Wall clock of the fold. */
|
|
241
|
+
readonly foldedAtMs: number;
|
|
242
|
+
/** The model that wrote the summary — a claim's author is part of the claim. */
|
|
243
|
+
readonly model: string;
|
|
244
|
+
/** How many messages the summary stands for. Always recorded, both policies. */
|
|
245
|
+
readonly messageCount: number;
|
|
246
|
+
/** `runtimeStageId`s of the stages that appended those messages. */
|
|
247
|
+
readonly removedStageIds: readonly string[];
|
|
248
|
+
/** Which policy this fold ran under. */
|
|
249
|
+
readonly retained: CompactionRetention;
|
|
250
|
+
/**
|
|
251
|
+
* The folded messages, verbatim and in order. Present exactly when
|
|
252
|
+
* `retained` is `'conversation'`.
|
|
253
|
+
*
|
|
254
|
+
* Absent under `'discard'` — and absent is the honest shape there, rather
|
|
255
|
+
* than an empty array that reads like "there were none".
|
|
256
|
+
*/
|
|
257
|
+
readonly messages?: readonly LLMMessage[];
|
|
258
|
+
}
|
|
172
259
|
/**
|
|
173
260
|
* What `.compaction({...})` — and `summarizeOldest({...})` — accepts.
|
|
174
261
|
*
|
|
@@ -210,6 +297,23 @@ export interface CompactionOptions {
|
|
|
210
297
|
* `summarizer: anthropic()` alone works; name a cheap model to spend less.
|
|
211
298
|
*/
|
|
212
299
|
readonly model?: string;
|
|
300
|
+
/**
|
|
301
|
+
* What happens to the messages a fold removes. Default `'conversation'` —
|
|
302
|
+
* they ride with the conversation checkpoint and survive the process.
|
|
303
|
+
*
|
|
304
|
+
* Pass `'discard'` to opt out. Nothing is ever destroyed silently: the only
|
|
305
|
+
* way to lose the originals is to name this.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* .compaction({
|
|
310
|
+
* thresholdTokens: 120_000,
|
|
311
|
+
* summarizer: anthropic(),
|
|
312
|
+
* retain: 'conversation', // the default, spelled out
|
|
313
|
+
* })
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
readonly retain?: CompactionRetention;
|
|
213
317
|
}
|
|
214
318
|
/** Resolved form — defaults applied at build time, validated once. */
|
|
215
319
|
export interface ResolvedCompaction {
|
|
@@ -217,6 +321,7 @@ export interface ResolvedCompaction {
|
|
|
217
321
|
readonly keepRecentTurns: number;
|
|
218
322
|
readonly summarizer: LLMProvider;
|
|
219
323
|
readonly model: string | undefined;
|
|
324
|
+
readonly retain: CompactionRetention;
|
|
220
325
|
}
|
|
221
326
|
/**
|
|
222
327
|
* What `slidingWindow({...})` accepts.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM1E;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB;AAC7B,4EAA4E;AAC1E,iBAAiB;AACnB;;;;GAIG;GACD,sBAAsB;AACxB,oEAAoE;GAClE,aAAa;AACf,uEAAuE;GACrE,kBAAkB;AACpB,yEAAyE;GACvE,oBAAoB;AACtB;;;;GAIG;GACD,uBAAuB;AACzB,0EAA0E;GACxE,mBAAmB;AACrB;;;;;;;;;;GAUG;GACD,qBAAqB,CAAC;AAE1B,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,MA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;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;CACvC;AAED,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
* DFS stage).
|
|
55
55
|
*/
|
|
56
56
|
import type { LLMMessage } from '../adapters/types.js';
|
|
57
|
+
import type { FoldedSpan } from './agent/window/types.js';
|
|
57
58
|
/**
|
|
58
59
|
* JSON-serializable checkpoint of an in-progress agent run. Persist
|
|
59
60
|
* to ANY durable store (Redis / Postgres / S3 / disk / queue) and
|
|
@@ -85,6 +86,29 @@ export interface AgentRunCheckpoint {
|
|
|
85
86
|
};
|
|
86
87
|
/** Wall-clock when the checkpoint was captured. Diagnostic only. */
|
|
87
88
|
readonly checkpointedAt: number;
|
|
89
|
+
/**
|
|
90
|
+
* Every span this conversation folded into a summary, oldest first — what
|
|
91
|
+
* makes a compacted conversation still a provable one after the process
|
|
92
|
+
* that compacted it is gone.
|
|
93
|
+
*
|
|
94
|
+
* Written by `.compaction()`; absent on a conversation that never folded,
|
|
95
|
+
* and absent on one stored by a runtime older than 8.2. Under the default
|
|
96
|
+
* `retain: 'conversation'` each span carries the folded messages verbatim;
|
|
97
|
+
* under `retain: 'discard'` the span is still here, naming what left, and
|
|
98
|
+
* only `messages` is absent.
|
|
99
|
+
*
|
|
100
|
+
* Join a summary in {@link history} to its span with `foldedSpanFor(...)` —
|
|
101
|
+
* by content fingerprint, never by index, because a later fold moves every
|
|
102
|
+
* index after it.
|
|
103
|
+
*
|
|
104
|
+
* **Version 1 still, deliberately.** An optional field is not a format
|
|
105
|
+
* change: a runtime that has never heard of `folded` reads this checkpoint,
|
|
106
|
+
* ignores it, and continues the conversation correctly — the summary is an
|
|
107
|
+
* ordinary message in `history` either way. Bumping the version would make
|
|
108
|
+
* an older deployment REFUSE a session it can serve perfectly well, which is
|
|
109
|
+
* the opposite of what the version field is for.
|
|
110
|
+
*/
|
|
111
|
+
readonly folded?: readonly FoldedSpan[];
|
|
88
112
|
/** Where the failure happened. Diagnostic — surfaces in oncall
|
|
89
113
|
* triage so you can tell "LLM 500 mid-iteration" from "tool
|
|
90
114
|
* threw" from "validation kept failing". */
|
|
@@ -159,7 +183,14 @@ export declare function buildCheckpoint(tracker: RunCheckpointTracker, failurePo
|
|
|
159
183
|
phase: AgentRunCheckpoint['failurePoint'] extends infer F ? F extends {
|
|
160
184
|
phase: infer P;
|
|
161
185
|
} ? P : never : never;
|
|
162
|
-
}
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* Spans this run folded, read from committed state by the caller. Passed in
|
|
189
|
+
* rather than tracked, because the tracker follows `history` through events
|
|
190
|
+
* and a fold's span is committed state — and because the same reader then
|
|
191
|
+
* serves both checkpoint carriers, so neither can lose what the other keeps.
|
|
192
|
+
*/
|
|
193
|
+
folded?: readonly FoldedSpan[]): AgentRunCheckpoint;
|
|
163
194
|
/**
|
|
164
195
|
* Validate a checkpoint at deserialization time. Catches forward-
|
|
165
196
|
* incompatible payloads (someone tries to resume a v3 checkpoint on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCheckpoint.d.ts","sourceRoot":"","sources":["../../../src/core/runCheckpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"runCheckpoint.d.ts","sourceRoot":"","sources":["../../../src/core/runCheckpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB;;;qEAGiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;gEAC4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC;;;uCAGmC;IACnC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC;+DAC2D;IAC3D,QAAQ,CAAC,aAAa,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,M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,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,GAC7B,kBAAkB,CAWpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CA0BrE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,KAAK,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAmBzF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { LLMCall, LLMCallBuilder, type LLMCallInput, type LLMCallOptions, type L
|
|
|
31
31
|
export { type MessageApiChartDeps } from './core/agent/buildMessageApiChart.js';
|
|
32
32
|
export { buildAgentMessageApiChart, type AgentMessageApiChartDeps, } from './core/agent/buildAgentMessageApiChart.js';
|
|
33
33
|
export { Agent, AgentBuilder, type AgentInput, type AgentOptions, type AgentOutput, type ObserverDeliveryOptions, } from './core/Agent.js';
|
|
34
|
-
export { CompactionUnmeasurableError, COMPACTED_FRAME_PREFIX, DROP_NOTICE_PREFIX, isCompactedSummary, isDropNotice, slidingWindow, summarizeOldest, tokenBudget, type CompactionOptions, type CompactionRecord, type FoldRefusal, type FoldRefusalReason, type RemovalFacts, type RemovalPlan, type SlidingWindowOptions, type SlidingWindowRecord, type TokenBudgetOptions, type TokenBudgetRecord, type Turn, type WindowEviction, type WindowRecord, type WindowRefusal, type WindowRefusalReason, type WindowStrategy, type WindowStrategyInput, type WindowStrategyResult, } from './core/agent/window/index.js';
|
|
34
|
+
export { CompactionUnmeasurableError, COMPACTED_FRAME_PREFIX, DROP_NOTICE_PREFIX, foldedMessages, foldedSpanFor, isCompactedSummary, isDropNotice, slidingWindow, summarizeOldest, tokenBudget, type CompactionOptions, type CompactionRecord, type CompactionRetention, type FoldedConversation, type FoldedSpan, type FoldRefusal, type FoldRefusalReason, type RemovalFacts, type RemovalPlan, type SlidingWindowOptions, type SlidingWindowRecord, type TokenBudgetOptions, type TokenBudgetRecord, type Turn, type WindowEviction, type WindowRecord, type WindowRefusal, type WindowRefusalReason, type WindowStrategy, type WindowStrategyInput, type WindowStrategyResult, } from './core/agent/window/index.js';
|
|
35
35
|
export type { SelfExplainOptions } from './lib/trace-toolpack/selfExplain.js';
|
|
36
36
|
export type { ObserverDrainResult, ObserverStats } from 'footprintjs';
|
|
37
37
|
export type { ToolArgValidationMode } from './core/agent/toolArgsValidation.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,4CAA4C,CAAC;AAOpD,YAAY,EAEV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EAEV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAEhB,SAAS,EAET,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,cAAc,qBAAqB,CAAC;AAIpC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,YAAY,EAKjB,SAAS,EACT,KAAK,SAAS,EAKd,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAWxD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,E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KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAkB9B,OAAO,EACL,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,kCAAkC,CAAC;AAS1C,cAAc,qBAAqB,CAAC;AAWpC,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -14,18 +14,26 @@
|
|
|
14
14
|
*
|
|
15
15
|
* What's here today:
|
|
16
16
|
* • `mock` / `MockProvider` — deterministic + realistic-mode mock
|
|
17
|
+
* • `ollama` / `OllamaProvider` — local models, free, no API key
|
|
17
18
|
* • `anthropic` / `AnthropicProvider` — real provider (Claude)
|
|
18
19
|
* • `openai` / `OpenAIProvider` — real provider (GPT)
|
|
20
|
+
* • `bedrock`, `azureOpenai`, and the `browser*` variants
|
|
21
|
+
*
|
|
22
|
+
* The ladder these are FOR: `mock()` while you shape the logic →
|
|
23
|
+
* `ollama('<model>')` for a real model that costs nothing and needs no
|
|
24
|
+
* key → a paid API in production. The agent code above them does not
|
|
25
|
+
* change between the three; that is the whole point of the port.
|
|
19
26
|
*
|
|
20
27
|
* Bring your own (BYO):
|
|
21
|
-
* For
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* For Cohere / on-prem / fine-tuned models, implement the
|
|
29
|
+
* `LLMProvider` interface (see `LLMProvider` exported from the main
|
|
30
|
+
* barrel) — `complete()` is required, `stream()` is optional. The
|
|
31
|
+
* `MockProvider` source is the canonical reference.
|
|
25
32
|
*/
|
|
26
33
|
export { MockProvider, mock, type MockProviderOptions, type MockReply, type LatencyMs, } from './adapters/llm/MockProvider.js';
|
|
27
34
|
export { anthropic, AnthropicProvider, type AnthropicProviderOptions, } from './adapters/llm/AnthropicProvider.js';
|
|
28
|
-
export { openai, OpenAIProvider,
|
|
35
|
+
export { openai, OpenAIProvider, azureOpenai, type OpenAIProviderOptions, type AzureOpenAIProviderOptions, } from './adapters/llm/OpenAIProvider.js';
|
|
36
|
+
export { ollama, OllamaProvider, OllamaUnavailableError, type OllamaProviderOptions, type ThinkLevel, } from './adapters/llm/OllamaProvider.js';
|
|
29
37
|
export { bedrock, BedrockProvider, type BedrockProviderOptions, } from './adapters/llm/BedrockProvider.js';
|
|
30
38
|
export { browserAnthropic, BrowserAnthropicProvider, type BrowserAnthropicProviderOptions, } from './adapters/llm/BrowserAnthropicProvider.js';
|
|
31
39
|
export { browserOpenai, BrowserOpenAIProvider, type BrowserOpenAIProviderOptions, browserAzureOpenai, BrowserAzureOpenAIProvider, type BrowserAzureOpenAIProviderOptions, } from './adapters/llm/BrowserOpenAIProvider.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,SAAS,GACf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,MAAM,EACN,cAAc,EACd,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,OAAO,EACP,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,+BAA+B,GACrC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,iCAAiC,GACvC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,EAIb,YAAY,EACZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OllamaThinkingHandler — normalizes a local reasoning model's thinking
|
|
3
|
+
* into the framework's `ThinkingBlock[]` contract.
|
|
4
|
+
*
|
|
5
|
+
* Local reasoning models (deepseek-r1, qwen3, gpt-oss, …) reason in the
|
|
6
|
+
* open, and where that reasoning LANDS depends on how they were asked:
|
|
7
|
+
*
|
|
8
|
+
* 1. ASKED (`ollama('qwen3', { think: true })`, or the agent's
|
|
9
|
+
* `.thinking({ budget })`) — Ollama lifts the reasoning out of the
|
|
10
|
+
* answer into `message.thinking`. The adapter forwards it as
|
|
11
|
+
* `{ kind: 'field', thinking }`. This is the good path.
|
|
12
|
+
*
|
|
13
|
+
* 2. NOT ASKED — the same model writes `<think>…</think>` straight into
|
|
14
|
+
* the answer text. The adapter recognizes the shape and forwards the
|
|
15
|
+
* whole answer as `{ kind: 'inline', content }`.
|
|
16
|
+
*
|
|
17
|
+
* **The library recognizes the inline shape; it never rewrites the
|
|
18
|
+
* answer.** Blocks produced from case 2 describe text that is STILL
|
|
19
|
+
* present, verbatim, in `LLMResponse.content` — because silently editing
|
|
20
|
+
* a model's answer is a meaning change, and that is the application's
|
|
21
|
+
* decision to make, not this library's. If you want the reasoning out of
|
|
22
|
+
* the answer, ask for it: turn `think` on, and the model stops putting it
|
|
23
|
+
* there.
|
|
24
|
+
*
|
|
25
|
+
* **No signature** — nothing on this wire is signed, so there is no
|
|
26
|
+
* round-trip integrity invariant (unlike Anthropic). `signature` stays
|
|
27
|
+
* undefined.
|
|
28
|
+
*
|
|
29
|
+
* **No `summary` flag** — this is raw reasoning, not a structured summary
|
|
30
|
+
* (unlike OpenAI's `reasoning_summary`).
|
|
31
|
+
*
|
|
32
|
+
* **`parseChunk`** — the adapter already emits `LLMChunk.thinkingDelta`
|
|
33
|
+
* directly while streaming (Ollama sends `message.thinking` deltas frame
|
|
34
|
+
* by frame), so the framework does not need this to see live reasoning.
|
|
35
|
+
* It is implemented anyway for consumers driving the handler themselves.
|
|
36
|
+
*/
|
|
37
|
+
import type { ThinkingHandler } from './types.js';
|
|
38
|
+
/**
|
|
39
|
+
* What `OllamaProvider` puts on `LLMResponse.rawThinking`.
|
|
40
|
+
*
|
|
41
|
+
* Tagged rather than a bare string so the handler never has to GUESS which
|
|
42
|
+
* of the two situations it is looking at — and so a consumer reading the
|
|
43
|
+
* raw value can tell whether the reasoning is also sitting in the answer.
|
|
44
|
+
*/
|
|
45
|
+
export type OllamaRawThinking = {
|
|
46
|
+
readonly kind: 'field';
|
|
47
|
+
readonly thinking: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'inline';
|
|
50
|
+
readonly content: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Pull the reasoning out of text that carries `<think>` tags.
|
|
54
|
+
*
|
|
55
|
+
* All tag PARSING lives here, in the handler — the adapter only notices
|
|
56
|
+
* that a `<think` substring is present and tags the payload accordingly.
|
|
57
|
+
* Exported so a consumer driving normalization by hand can reuse it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function extractInlineThinking(text: string): readonly string[];
|
|
60
|
+
export declare const ollamaThinkingHandler: ThinkingHandler;
|
|
61
|
+
//# sourceMappingURL=OllamaThinkingHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OllamaThinkingHandler.d.ts","sourceRoot":"","sources":["../../../src/thinking/OllamaThinkingHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAK1D;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAUrE;AAMD,eAAO,MAAM,qBAAqB,EAAE,eAkCnC,CAAC"}
|
|
@@ -52,5 +52,6 @@ export type { ThinkingBlock, ThinkingHandler } from './types.js';
|
|
|
52
52
|
export { mockThinkingHandler, mockAnthropicRaw, mockOpenAIRaw } from './MockThinkingHandler.js';
|
|
53
53
|
export { anthropicThinkingHandler } from './AnthropicThinkingHandler.js';
|
|
54
54
|
export { openAIThinkingHandler } from './OpenAIThinkingHandler.js';
|
|
55
|
+
export { ollamaThinkingHandler, extractInlineThinking, type OllamaRawThinking, } from './OllamaThinkingHandler.js';
|
|
55
56
|
export { SHIPPED_THINKING_HANDLERS, findThinkingHandler } from './registry.js';
|
|
56
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/thinking/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/thinking/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/thinking/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/thinking/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,eAAe,EAK/D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAKrF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"claude",
|
|
39
39
|
"openai",
|
|
40
40
|
"bedrock",
|
|
41
|
+
"ollama",
|
|
42
|
+
"local-llm",
|
|
41
43
|
"mcp",
|
|
42
44
|
"a2a",
|
|
43
45
|
"human-in-the-loop",
|