agentfootprint 10.9.0 → 10.10.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 (134) hide show
  1. package/CAPABILITIES.md +2 -0
  2. package/dist/core/Agent.js +25 -29
  3. package/dist/core/Agent.js.map +1 -1
  4. package/dist/core/agent/AgentBuilder.js +12 -16
  5. package/dist/core/agent/AgentBuilder.js.map +1 -1
  6. package/dist/core/agent/buildAgentChart.js +3 -17
  7. package/dist/core/agent/buildAgentChart.js.map +1 -1
  8. package/dist/core/agent/buildDynamicAgentChart.js +1 -12
  9. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  10. package/dist/core/agent/evidence/frames.js +3 -1
  11. package/dist/core/agent/evidence/frames.js.map +1 -1
  12. package/dist/core/agent/findings/context.js +163 -0
  13. package/dist/core/agent/findings/context.js.map +1 -0
  14. package/dist/core/agent/findings/instruction.js +26 -0
  15. package/dist/core/agent/findings/instruction.js.map +1 -0
  16. package/dist/core/agent/findings/offer.js +9 -57
  17. package/dist/core/agent/findings/offer.js.map +1 -1
  18. package/dist/core/agent/findings/reserved.js +12 -83
  19. package/dist/core/agent/findings/reserved.js.map +1 -1
  20. package/dist/core/agent/stages/callLLM.js +24 -25
  21. package/dist/core/agent/stages/callLLM.js.map +1 -1
  22. package/dist/core/agent/stages/seed.js +6 -20
  23. package/dist/core/agent/stages/seed.js.map +1 -1
  24. package/dist/core/slots/buildToolsSlot.js +3 -24
  25. package/dist/core/slots/buildToolsSlot.js.map +1 -1
  26. package/dist/esm/core/Agent.js +10 -14
  27. package/dist/esm/core/Agent.js.map +1 -1
  28. package/dist/esm/core/agent/AgentBuilder.d.ts +0 -8
  29. package/dist/esm/core/agent/AgentBuilder.js +7 -11
  30. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  31. package/dist/esm/core/agent/buildAgentChart.d.ts +3 -12
  32. package/dist/esm/core/agent/buildAgentChart.js +3 -17
  33. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  34. package/dist/esm/core/agent/buildDynamicAgentChart.js +1 -12
  35. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  36. package/dist/esm/core/agent/evidence/frames.js +4 -2
  37. package/dist/esm/core/agent/evidence/frames.js.map +1 -1
  38. package/dist/esm/core/agent/findings/context.d.ts +13 -0
  39. package/dist/esm/core/agent/findings/context.js +158 -0
  40. package/dist/esm/core/agent/findings/context.js.map +1 -0
  41. package/dist/esm/core/agent/findings/instruction.d.ts +12 -0
  42. package/dist/esm/core/agent/findings/instruction.js +22 -0
  43. package/dist/esm/core/agent/findings/instruction.js.map +1 -0
  44. package/dist/esm/core/agent/findings/offer.d.ts +9 -57
  45. package/dist/esm/core/agent/findings/offer.js +9 -57
  46. package/dist/esm/core/agent/findings/offer.js.map +1 -1
  47. package/dist/esm/core/agent/findings/reserved.d.ts +7 -31
  48. package/dist/esm/core/agent/findings/reserved.js +12 -83
  49. package/dist/esm/core/agent/findings/reserved.js.map +1 -1
  50. package/dist/esm/core/agent/stages/callLLM.d.ts +1 -0
  51. package/dist/esm/core/agent/stages/callLLM.js +25 -26
  52. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  53. package/dist/esm/core/agent/stages/seed.d.ts +1 -0
  54. package/dist/esm/core/agent/stages/seed.js +6 -20
  55. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  56. package/dist/esm/core/agent/types.d.ts +7 -0
  57. package/dist/esm/core/slots/buildToolsSlot.d.ts +2 -10
  58. package/dist/esm/core/slots/buildToolsSlot.js +3 -24
  59. package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
  60. package/dist/esm/lib/saidByPerson.d.ts +2 -0
  61. package/dist/esm/lib/saidByPerson.js +3 -0
  62. package/dist/esm/lib/saidByPerson.js.map +1 -1
  63. package/dist/esm/time-travel/servedView.d.ts +1 -1
  64. package/dist/esm/time-travel/servedView.js +44 -154
  65. package/dist/esm/time-travel/servedView.js.map +1 -1
  66. package/dist/esm/trace-toolpack/causeCapture.d.ts +17 -0
  67. package/dist/esm/trace-toolpack/causeCapture.js +96 -0
  68. package/dist/esm/trace-toolpack/causeCapture.js.map +1 -0
  69. package/dist/esm/trace-toolpack/causeControl.d.ts +6 -0
  70. package/dist/esm/trace-toolpack/causeControl.js +45 -0
  71. package/dist/esm/trace-toolpack/causeControl.js.map +1 -0
  72. package/dist/esm/trace-toolpack/causeReader.js +11 -9
  73. package/dist/esm/trace-toolpack/causeReader.js.map +1 -1
  74. package/dist/esm/trace-toolpack/causeResponse.d.ts +3 -2
  75. package/dist/esm/trace-toolpack/causeResponse.js +27 -7
  76. package/dist/esm/trace-toolpack/causeResponse.js.map +1 -1
  77. package/dist/esm/trace-toolpack/causeSnapshot.d.ts +6 -1
  78. package/dist/esm/trace-toolpack/causeSnapshot.js +26 -15
  79. package/dist/esm/trace-toolpack/causeSnapshot.js.map +1 -1
  80. package/dist/esm/trace-toolpack/causeTools.js +1 -1
  81. package/dist/esm/trace-toolpack/causeTools.js.map +1 -1
  82. package/dist/lib/saidByPerson.js +4 -1
  83. package/dist/lib/saidByPerson.js.map +1 -1
  84. package/dist/time-travel/servedView.js +44 -154
  85. package/dist/time-travel/servedView.js.map +1 -1
  86. package/dist/trace-toolpack/causeCapture.js +103 -0
  87. package/dist/trace-toolpack/causeCapture.js.map +1 -0
  88. package/dist/trace-toolpack/causeControl.js +49 -0
  89. package/dist/trace-toolpack/causeControl.js.map +1 -0
  90. package/dist/trace-toolpack/causeReader.js +11 -9
  91. package/dist/trace-toolpack/causeReader.js.map +1 -1
  92. package/dist/trace-toolpack/causeResponse.js +27 -7
  93. package/dist/trace-toolpack/causeResponse.js.map +1 -1
  94. package/dist/trace-toolpack/causeSnapshot.js +31 -20
  95. package/dist/trace-toolpack/causeSnapshot.js.map +1 -1
  96. package/dist/trace-toolpack/causeTools.js +1 -1
  97. package/dist/trace-toolpack/causeTools.js.map +1 -1
  98. package/dist/types/core/Agent.d.ts.map +1 -1
  99. package/dist/types/core/agent/AgentBuilder.d.ts +0 -8
  100. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  101. package/dist/types/core/agent/buildAgentChart.d.ts +3 -12
  102. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  103. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  104. package/dist/types/core/agent/evidence/frames.d.ts.map +1 -1
  105. package/dist/types/core/agent/findings/context.d.ts +14 -0
  106. package/dist/types/core/agent/findings/context.d.ts.map +1 -0
  107. package/dist/types/core/agent/findings/instruction.d.ts +13 -0
  108. package/dist/types/core/agent/findings/instruction.d.ts.map +1 -0
  109. package/dist/types/core/agent/findings/offer.d.ts +9 -57
  110. package/dist/types/core/agent/findings/offer.d.ts.map +1 -1
  111. package/dist/types/core/agent/findings/reserved.d.ts +7 -31
  112. package/dist/types/core/agent/findings/reserved.d.ts.map +1 -1
  113. package/dist/types/core/agent/stages/callLLM.d.ts +1 -0
  114. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  115. package/dist/types/core/agent/stages/seed.d.ts +1 -0
  116. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  117. package/dist/types/core/agent/types.d.ts +7 -0
  118. package/dist/types/core/agent/types.d.ts.map +1 -1
  119. package/dist/types/core/slots/buildToolsSlot.d.ts +2 -10
  120. package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
  121. package/dist/types/lib/saidByPerson.d.ts +2 -0
  122. package/dist/types/lib/saidByPerson.d.ts.map +1 -1
  123. package/dist/types/time-travel/servedView.d.ts +1 -1
  124. package/dist/types/time-travel/servedView.d.ts.map +1 -1
  125. package/dist/types/trace-toolpack/causeCapture.d.ts +18 -0
  126. package/dist/types/trace-toolpack/causeCapture.d.ts.map +1 -0
  127. package/dist/types/trace-toolpack/causeControl.d.ts +7 -0
  128. package/dist/types/trace-toolpack/causeControl.d.ts.map +1 -0
  129. package/dist/types/trace-toolpack/causeReader.d.ts.map +1 -1
  130. package/dist/types/trace-toolpack/causeResponse.d.ts +3 -2
  131. package/dist/types/trace-toolpack/causeResponse.d.ts.map +1 -1
  132. package/dist/types/trace-toolpack/causeSnapshot.d.ts +6 -1
  133. package/dist/types/trace-toolpack/causeSnapshot.d.ts.map +1 -1
  134. package/package.json +3 -2
package/CAPABILITIES.md CHANGED
@@ -35,6 +35,7 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
35
35
  | replaying Anthropic thinking in its original content order; refusing known unsafe active-tool replay, observing each permitted completed-turn omission before sending, and retaining that decision across checkpoints | `LLMMessage.replay` + `UnsafeThinkingReplayError` + `LLMCallHooks.onReplayPrepared` + `agentfootprint.agent.thinking_omitted` | `src/adapters/llm/anthropicThinkingReplay.ts` | 10.1.0 |
36
36
  | keeping personal data out of an agent's saved records — snapshot, narrative, every event, recordings, bug reports, answer accounts, the exporters — while the model, the tools and the caller keep the real values; the library's own list of the names the conversation travels under (proven per feature), joined with the fields your tools name; it reaches compositions (members' policies adopted) and runs a tool starts (`ctx.redact`), and readers of the record say "kept out", never "not recorded" or "no tool ran" | `Agent.create({ redact })` (a footprintjs `RedactionPolicy`) + `conversationRedaction` + `ToolExecutionContext.redact` | `src/redaction/` | 9.140.0 |
37
37
  | prompt caching that keeps hitting behind `withRetry`, `withFallback` or your own provider wrapper — the cache strategy chosen from what the adapter DECLARES (explicit breakpoints / automatic / none), never from its name, plus a moving breakpoint on the conversation tail so each call reads back what the last one sent | `LLMProvider.promptCaching` (`PromptCaching`) + `cacheStrategyFor` + `BreakpointCacheStrategy` / `AutomaticCacheStrategy` / `NoOpCacheStrategy` | `src/cache/cacheStrategyFor.ts` | 9.138.0 |
38
+ | findings with stable tool contracts and immutable instructions, bounded late DATA outside cached history, unchanged citation admission, and call-scoped saved/resumed layout evidence | `.findings({ maxContextBytes })` + `findingsContext` + `servedAt` / `findings-layout` | `src/core/agent/findings/context.ts` | 10.10.0 |
38
39
  | Bedrock Converse prompt caching for exact verified models and geography profiles, field/TTL restrictions and four-checkpoint limit; cache read/write counts on both transports; model-aware capabilities through resilience decorators; one build warning and fixed run metadata when requested caching is unavailable; the meter accepts real engine events from `.watch()` | `bedrock` + `BedrockProvider` | `src/adapters/llm/BedrockProvider.ts` | 10.8.0 |
39
40
  | reading a static or model-aware prompt-cache capability before inspecting its mode, with unknown models failing closed | `promptCachingFor` | `src/cache/cacheStrategyFor.ts` | 10.8.0 |
40
41
  | asking a model to think in the shape THAT model takes — budget tokens on Claude 4.6 and earlier, adaptive on 4.7 and later (and on any id the table does not know), a build-time refusal for a model that cannot think; one table per wire, an adapter option for an id the table cannot read, forwarded by every wrapper, answered per side by `withFallback` | `.thinking({ budget })` + `LLMProvider.thinkingMode` + the adapters' `thinkingMode` option + `ThinkingMode` + `UnsupportedThinkingError` | `src/adapters/llm/anthropicModels.ts` | 9.141.0 |
@@ -95,6 +96,7 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
95
96
  | a value that must say how it knows itself — an unknown count that can never render as zero | `Claim<T>` (`known`/`unknown`/`notApplicable`) | `src/lib/claim/claim.ts` | 9.58.0 |
96
97
  | asking a debugging model "what did this run contradict itself about, and why?" — the Context Integrity findings, joined to the step that filed them | `find_context_errors` | `src/trace-toolpack/traceToolpack.ts` | 9.61.0 |
97
98
  | reading abnormal nodes, recorded dependency roots and downstream impact with bounded public Foottrace queries, scoped proof IDs and explicit unknown coverage; optional host-authorized storage graph, including inner tool and subflow questions | `attention_list` / `root_cause` / `impact` + `TraceToolpackArtifacts.cause` + `TraceToolpackOptions.cause` | `src/trace-toolpack/causeTools.ts` | 10.7.0 |
99
+ | admitting a completed native root-log capture for read-only cause tools without a custom graph; partial, legacy, child and resumed coverage stays uncertain with fixed reasons | `assessCapture` | `src/trace-toolpack/causeCapture.ts` | 10.10.0 |
98
100
  | the model inventing an id or a reading that no tool ever returned — a deterministic fabrication detector on the final answer, with a posture for how hard it pushes back | `.namesAndNumbersFromEvidence()` + `posture` (`'assist'` record+flag, the default / `'guard'` one revision then ship flagged / `'rails'` refuse instead) + `shapes` + `exempt` + `minDigits` (default 4) + `nudge` (default off) | `src/core/agent/evidence/` | 9.35.0 |
99
101
  | plain decimal readings honestly rounded at the written precision (opt-in; one carried number only, no new unitless arithmetic), and exactly-two numeric range endpoints checked after declared ID shapes; short bare endpoints retain minDigits | `AgentBuilder.namesAndNumbersFromEvidence` + `NamesAndNumbersOptions` + `EvidenceVerdict` + `ComputedFigure` | `src/core/agent/evidence/` | 10.8.0 |
100
102
  | counting a HUMAN-VERIFIED value as ground for the choice-seam check — the person clicked a row, the app verified the cells against the artifact, and the id the model takes from that selection is not fabricated; the source label travels onto the record | `externalGrounds` + `ExternalGround` + `external_ground_used` | `src/integrity/unsupported-argument/check.ts` | 9.72.0 |
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Agent — ReAct primitive (LLM + tools + iteration loop).
4
- *
5
- * Pattern: Builder (GoF) → produces a Runner backed by a footprintjs FlowChart.
6
- * Role: Layer-5 primitive (core/). Assembles the 3-slot context
7
- * pipeline + callLLM + route decider + tool-calls subflow +
8
- * loopTo. Composition nestable anywhere that accepts a Runner.
9
- * Emits: Via internal recorders:
10
- * agentfootprint.agent.turn_start / turn_end
11
- * agentfootprint.agent.iteration_start / iteration_end
12
- * agentfootprint.agent.route_decided
13
- * agentfootprint.stream.llm_start / llm_end
14
- * agentfootprint.stream.tool_start / tool_end
15
- * agentfootprint.context.* (via ContextRecorder)
16
- */
17
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
3
  if (k2 === undefined) k2 = k;
19
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -39,6 +24,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
24
  };
40
25
  Object.defineProperty(exports, "__esModule", { value: true });
41
26
  exports.Agent = exports.AgentBuilder = void 0;
27
+ const context_js_1 = require("./agent/findings/context.js");
28
+ /**
29
+ * Agent — ReAct primitive (LLM + tools + iteration loop).
30
+ *
31
+ * Pattern: Builder (GoF) → produces a Runner backed by a footprintjs FlowChart.
32
+ * Role: Layer-5 primitive (core/). Assembles the 3-slot context
33
+ * pipeline + callLLM + route decider + tool-calls subflow +
34
+ * loopTo. Composition nestable anywhere that accepts a Runner.
35
+ * Emits: Via internal recorders:
36
+ * agentfootprint.agent.turn_start / turn_end
37
+ * agentfootprint.agent.iteration_start / iteration_end
38
+ * agentfootprint.agent.route_decided
39
+ * agentfootprint.stream.llm_start / llm_end
40
+ * agentfootprint.stream.tool_start / tool_end
41
+ * agentfootprint.context.* (via ContextRecorder)
42
+ */
42
43
  const footprintjs_1 = require("footprintjs");
43
44
  const types_js_1 = require("../reliability/types.js");
44
45
  const extractSequence_js_1 = require("../security/extractSequence.js");
@@ -867,7 +868,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
867
868
  if (opts.toolArgValidation !== undefined)
868
869
  this.toolArgValidation = opts.toolArgValidation;
869
870
  if (opts.findings !== undefined)
870
- this.findingsOptions = opts.findings;
871
+ this.findingsOptions = {
872
+ ...opts.findings,
873
+ maxContextBytes: (0, context_js_1.findingsContextBytes)(opts.findings.maxContextBytes),
874
+ };
871
875
  // The inputs layer's door (honesty layer 2): `true`, or `{ argumentSources }`
872
876
  // — either form mounts the layer; the object form may also arm declared
873
877
  // sources without the findings ledger.
@@ -1003,20 +1007,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
1003
1007
  if (opts.keepLedgerFacts !== undefined)
1004
1008
  requireKeepLedgerFacts(opts.keepLedgerFacts, 'Agent');
1005
1009
  if (this.findingsOptions !== undefined) {
1006
- // The ledger needs the tools slot recomposed every call: from the second
1007
- // call on, the served `_findings` property binds the ids the model may
1008
- // name (`findings/offer.ts · offeredResultIds`, bound at the Tools
1009
- // mount) — and on a hosted model that binding is what makes a standing
1010
- // resolve at all (docs/design/2026-09-findings-ledger-real-model.md).
1011
- // `reactMode: 'classic'` selects the Tools branch on turn 1 only, so an
1012
- // armed classic agent would serve the offer-less base on every call and
1013
- // file every standing as `unknownId`. Refused loud, here at build, the
1014
- // `AgentBuilder.selfExplain` twin — never a silent degrade.
1010
+ // Keep the supported findings execution modes explicit. This change
1011
+ // restores prefix caching; it does not add findings support to classic.
1015
1012
  if (this.reactMode === 'classic') {
1016
- throw new Error("Agent: .findings() requires per-iteration slot recomposition — reactMode 'classic' " +
1017
- 'caches the tools slot on turn 1, so the ids the model may name (bound into every ' +
1018
- 'served tool schema from the second call on) would never reach it and every standing ' +
1019
- "would file as unknownId. Use the default 'dynamic' mode (or 'dynamic-grouped').");
1013
+ throw new Error("Agent: .findings() is supported in 'dynamic' and 'dynamic-grouped' modes only; reactMode 'classic' is not supported.");
1020
1014
  }
1021
1015
  this.keepLedgerFacts = resolveKeepLedgerFacts(this.findingsOptions.keepLedgerFacts ?? opts.keepLedgerFacts);
1022
1016
  }
@@ -4204,6 +4198,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
4204
4198
  ...(this.findingsOptions !== undefined && {
4205
4199
  findings: true,
4206
4200
  findingsServe: this.findingsOptions.serve ?? 'ledger-and-facts',
4201
+ findingsContextBytes: this.findingsOptions.maxContextBytes,
4207
4202
  // The answer-turn ask (9.103.0): VALUE-conditional inside the arm —
4208
4203
  // the default `'none'` threads nothing and writes no key.
4209
4204
  ...(this.findingsOptions.answerAsk === 'quote-facts' && {
@@ -4706,6 +4701,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
4706
4701
  findings: true,
4707
4702
  hasFindingsLedger: true,
4708
4703
  findingsServe: this.findingsOptions.serve ?? 'ledger-and-facts',
4704
+ findingsContextBytes: this.findingsOptions.maxContextBytes,
4709
4705
  // The answer-turn ask (9.103.0): the same value seed records, so the
4710
4706
  // wire and the rebuild append it from one fact; absent on `'none'`.
4711
4707
  ...(this.findingsOptions.answerAsk === 'quote-facts' && {