agentfootprint 6.27.0 → 6.28.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/README.md +65 -108
- package/dist/core/agent/AgentBuilder.js +75 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +75 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/context-bisect/toBacktrackTrace.js +2 -7
- package/dist/esm/lib/context-bisect/toBacktrackTrace.js.map +1 -1
- package/dist/esm/lib/trace-toolpack/debugPrompt.js +36 -0
- package/dist/esm/lib/trace-toolpack/debugPrompt.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/index.js +11 -0
- package/dist/esm/lib/trace-toolpack/index.js.map +1 -1
- package/dist/esm/lib/trace-toolpack/lazyToolpack.js +72 -0
- package/dist/esm/lib/trace-toolpack/lazyToolpack.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/selfExplain.js +174 -0
- package/dist/esm/lib/trace-toolpack/selfExplain.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/traceDebugAgent.js +40 -0
- package/dist/esm/lib/trace-toolpack/traceDebugAgent.js.map +1 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.js +11 -0
- package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/esm/observe.js +6 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/context-bisect/toBacktrackTrace.js +2 -7
- package/dist/lib/context-bisect/toBacktrackTrace.js.map +1 -1
- package/dist/lib/trace-toolpack/debugPrompt.js +39 -0
- package/dist/lib/trace-toolpack/debugPrompt.js.map +1 -0
- package/dist/lib/trace-toolpack/index.js +18 -1
- package/dist/lib/trace-toolpack/index.js.map +1 -1
- package/dist/lib/trace-toolpack/lazyToolpack.js +76 -0
- package/dist/lib/trace-toolpack/lazyToolpack.js.map +1 -0
- package/dist/lib/trace-toolpack/selfExplain.js +203 -0
- package/dist/lib/trace-toolpack/selfExplain.js.map +1 -0
- package/dist/lib/trace-toolpack/traceDebugAgent.js +44 -0
- package/dist/lib/trace-toolpack/traceDebugAgent.js.map +1 -0
- package/dist/lib/trace-toolpack/traceToolpack.js +11 -0
- package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/observe.js +49 -38
- package/dist/observe.js.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +25 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/context-bisect/toBacktrackTrace.d.ts.map +1 -1
- package/dist/types/lib/trace-toolpack/debugPrompt.d.ts +20 -0
- package/dist/types/lib/trace-toolpack/debugPrompt.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/index.d.ts +11 -0
- package/dist/types/lib/trace-toolpack/index.d.ts.map +1 -1
- package/dist/types/lib/trace-toolpack/lazyToolpack.d.ts +36 -0
- package/dist/types/lib/trace-toolpack/lazyToolpack.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/selfExplain.d.ts +101 -0
- package/dist/types/lib/trace-toolpack/selfExplain.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/traceDebugAgent.d.ts +43 -0
- package/dist/types/lib/trace-toolpack/traceDebugAgent.d.ts.map +1 -0
- package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/dist/types/observe.d.ts +2 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1 align="center">Agentfootprint</h1>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<strong>Your agent
|
|
6
|
+
<strong>Your agent gave an answer that <em>looks</em> right — and it's wrong.<br/>The logs can't tell you who influenced it. Agentfootprint can.</strong>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -43,10 +43,20 @@ domain knowledge to fix either:
|
|
|
43
43
|
| **Business logic** — wrong branch, wrong math | the code | stack trace, debugger, `console.log` |
|
|
44
44
|
| **Contextual** — wrong tool chosen, wrong fact believed, stale memory trusted | **what the model was given** | **nothing. Until now.** |
|
|
45
45
|
|
|
46
|
-
Agents introduced the third class. The code is correct, the infra is healthy
|
|
47
|
-
the run is still wrong, because
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
Agents introduced the third class. The code is correct, the infra is healthy, the
|
|
47
|
+
answer even reads well — and the run is still wrong, because something influenced
|
|
48
|
+
the model:
|
|
49
|
+
|
|
50
|
+
| The model… | because… |
|
|
51
|
+
|---|---|
|
|
52
|
+
| picked the wrong tool | two descriptions read nearly alike — it chose between twins |
|
|
53
|
+
| believed a wrong "fact" | a tool returned it, or an injected fact planted it |
|
|
54
|
+
| followed the wrong instruction | the wrong skill / steering fired — or fired one iteration too early |
|
|
55
|
+
| answered from the past | a previous turn or stale memory bled into this one |
|
|
56
|
+
|
|
57
|
+
Classical logs can't explain any of it: **they record what the code did, never
|
|
58
|
+
what the context did.** The debugging question changed — no longer *"what did my
|
|
59
|
+
code do?"* but **"who influenced the model?"**
|
|
50
60
|
|
|
51
61
|
## The idea
|
|
52
62
|
|
|
@@ -333,46 +343,6 @@ So we used the budget those abstractions would have cost us to invest deeply in
|
|
|
333
343
|
> **We abstract context engineering — and hand back the trace.**
|
|
334
344
|
> Live to develop · offline to monitor · detailed to improve.
|
|
335
345
|
|
|
336
|
-
### The reason — agents have a new class of bug
|
|
337
|
-
|
|
338
|
-
For fifty years, software bugs have been **logic errors**. A wrong condition, a missed edge case, an off-by-one. You step through the code until you find the bad branch.
|
|
339
|
-
|
|
340
|
-
LLM-powered apps add a second class of bug: **contextual errors.** The code is correct. The model is correct. The answer is wrong because **the LLM's decision rests on context that was ambiguous, confusing, or misleading at the moment of inference.**
|
|
341
|
-
|
|
342
|
-
Tracking *which content the model actually saw, and why,* is the entire debugging job. Without it, the failure mode is invisible:
|
|
343
|
-
|
|
344
|
-
| What got injected wrong | What the model did |
|
|
345
|
-
|---|---|
|
|
346
|
-
| Wrong instruction landed in the `system` slot | Followed the wrong rule |
|
|
347
|
-
| Predicate fired one iteration too early | Reasoned with stale assumptions |
|
|
348
|
-
| Skill body missing when the LLM called `read_skill` | Invented its own |
|
|
349
|
-
| Cache prefix invalidated mid-iteration | Saw a silently rewritten stale version |
|
|
350
|
-
| Tool returned but the `on-tool-return` injection didn't fire | Couldn't interpret the result |
|
|
351
|
-
|
|
352
|
-
> [!IMPORTANT]
|
|
353
|
-
> **The model doesn't tell you which of these went wrong. It just gives you the wrong answer.**
|
|
354
|
-
|
|
355
|
-
You can't step through that with a debugger. By the time you read the response, the context that produced it is gone unless something recorded it.
|
|
356
|
-
|
|
357
|
-
That's the gap agentfootprint fills. A framework that owns the control flow can debug logic errors. A framework that owns the *injection* can debug contextual errors — because every injection is a typed event with a where, when, why, and how-it-cached.
|
|
358
|
-
|
|
359
|
-
### What that buys you
|
|
360
|
-
|
|
361
|
-
Because we own the injection, every LLM call backtracks to four typed answers:
|
|
362
|
-
|
|
363
|
-
- **What** was injected
|
|
364
|
-
- **Who** triggered it (which rule)
|
|
365
|
-
- **When** it fired
|
|
366
|
-
- **How** it landed — slot, position, cache
|
|
367
|
-
|
|
368
|
-
Same trace, three workflows:
|
|
369
|
-
|
|
370
|
-
- **Live — debug as you build.** See exactly which injection produced which token, which predicate fired this iteration, which prefix actually got cached.
|
|
371
|
-
- **Offline — monitor what shipped.** Replay any past run from its trace. Alert on drift. Attribute cost per injection.
|
|
372
|
-
- **Detailed — improve via export.** Every successful trajectory is labeled training data for SFT, DPO, or RL — no separate data-collection phase.
|
|
373
|
-
|
|
374
|
-
And a fourth, novel: **the agent can read its own trace.** Six months after the agent rejected loan #42, *"why did you reject it?"* answers from the recorded evidence — the tool calls (`credit_score_check → 580`), the decisions, the rules that fired — not a rerun. Causal memory turns the trace into the agent's working memory.
|
|
375
|
-
|
|
376
346
|
---
|
|
377
347
|
|
|
378
348
|
## How do I design my agent or system of agents?
|
|
@@ -531,7 +501,7 @@ The patterns the field knows reduce to the same alphabet:
|
|
|
531
501
|
| **Router** | `Conditional → Agent_A \| Agent_B \| Agent_C` |
|
|
532
502
|
| **Hierarchical** | `Agent_planner → Sequence( Agent_worker×N ) → synth` |
|
|
533
503
|
|
|
534
|
-
Same trick as
|
|
504
|
+
Same trick as the injection model: instead of N libraries for N patterns, we found the M building blocks all N patterns are made of.
|
|
535
505
|
|
|
536
506
|
> 📖 Compare: [hand-rolled vs declarative](https://footprintjs.github.io/agentfootprint/getting-started/why/) · [migration from LangChain / CrewAI / LangGraph](https://footprintjs.github.io/agentfootprint/getting-started/vs/)
|
|
537
507
|
|
|
@@ -546,15 +516,7 @@ Same trick as Beat 1: instead of N libraries for N patterns, we found the M buil
|
|
|
546
516
|
<sub>One real run, fully explained — the <a href="https://github.com/footprintjs/agentfootprint-lens"><b>Lens</b></a> (<code>npm i agentfootprint-lens</code>): conversation · executed path · per-step timeline · stats, every pixel from the trace.</sub>
|
|
547
517
|
</p>
|
|
548
518
|
|
|
549
|
-
Because we own the loop
|
|
550
|
-
|
|
551
|
-
<p align="center">
|
|
552
|
-
<picture>
|
|
553
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/causal-memory-dark.svg">
|
|
554
|
-
<source media="(prefers-color-scheme: light)" srcset="docs/assets/causal-memory-light.svg">
|
|
555
|
-
<img alt="agentfootprint causal memory — Each agent run produces a JSON-portable causal trace: a scrubbable timeline of every stage with reads, writes, and captured decision evidence. The trace card shows a time-travel slider (Step 5 of 17, Live), an execution timeline with stage-duration bars, and the captured decision evidence pill (riskTier eq high → reject). Two built-in lenses view it: Lens (agent-centric) and Explainable Trace (structural). Three programmatic consumers fan out from it: audit replay (GDPR Article 22 adverse-action notice answered from chain, no LLM call, $15/1M to $0.25/1M tokens), cheap-model triage (Sonnet trace fed to Haiku for follow-ups), and training data export (every chain is a labeled trajectory ready for SFT/DPO/process-RL). One recording, two lenses, three consumers, zero extra instrumentation. Powered by footprintjs causalChain()." src="docs/assets/causal-memory-light.svg" width="100%"/>
|
|
556
|
-
</picture>
|
|
557
|
-
</p>
|
|
519
|
+
Because we own the loop, every decision and execution is captured during traversal — not bolted on. The default capture is the **causal trace**: every stage, read, write, and decision evidence as a JSON-portable, scrubbable, queryable, exportable artifact — and every LLM call backtracks to four typed answers: **what** was injected, **who** triggered it (which rule), **when** it fired, **how** it landed (slot · position · cache). Beyond the default, wire custom recorders for cost, latency, or quality scoring — any observation hook fires on the same stream.
|
|
558
520
|
|
|
559
521
|
The same trace serves three downstream consumers — no extra instrumentation:
|
|
560
522
|
|
|
@@ -564,74 +526,60 @@ The same trace serves three downstream consumers — no extra instrumentation:
|
|
|
564
526
|
|
|
565
527
|
3. **Training data — the substrate is already there.** Every successful chain is a labeled trajectory. SFT pairs (`{prompt, completion}`) fall out of the snapshot's history field; the export wrapper is roadmap work tracked in [GitHub issues](https://github.com/footprintjs/agentfootprint/issues). DPO and process-RL need additional collection layers (preference feedback, per-step reward annotation) that don't ship today.
|
|
566
528
|
|
|
567
|
-
|
|
529
|
+
Four views, one trace — pick by question:
|
|
568
530
|
|
|
569
|
-
|
|
|
531
|
+
| View | Shows | When to use |
|
|
570
532
|
|---|---|---|
|
|
571
|
-
| **
|
|
533
|
+
| **AgentThinkingUI** (the hero up top) | The run replayed as an animated, scrubbable story — the brain, the tools, the reasoning | Show anyone *what the agent did* |
|
|
534
|
+
| **BacktrackView** ([the board above](#one-contextual-error-walked-end-to-end)) | A decision walked backwards — suspects, influence meters, ablation stamps, custody rewind | Answer *why it decided that* |
|
|
535
|
+
| **Lens** | Agent-centric — User/Agent[3 slots]/Tool flowchart with iteration scrubber and round commentary | Live debugging, "what did the agent see at step 5?" |
|
|
572
536
|
| **Explainable Trace** | Structural — subflow tree, full flowchart, memory inspector, per-stage execution timeline | Architecture review, root-cause analysis |
|
|
573
537
|
|
|
538
|
+
And two **conversational** doors over the same evidence — ask instead of look:
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
// dedicated: a cheap model debugs an expensive run by id — pays for what it opens
|
|
542
|
+
const debuggerAi = traceDebugAgent({ artifacts, provider: anthropic(), model: 'claude-haiku-4-5' });
|
|
543
|
+
await debuggerAi.run({ message: 'Why was loan APP-7 approved?' });
|
|
544
|
+
|
|
545
|
+
// in-conversation: the agent answers "why did you…?" from its OWN previous turn
|
|
546
|
+
Agent.create({ provider, model }).tool(lookupOrder)
|
|
547
|
+
.selfExplain({ delegate: { provider: anthropic(), model: 'claude-haiku-4-5' } })
|
|
548
|
+
.build();
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
`.selfExplain()` mounts one skill: the catalog stays clean until the LLM activates
|
|
552
|
+
it, evidence binds only to **completed** runs (never in-flight), and `delegate`
|
|
553
|
+
answers at the cheap model's price inside the expensive conversation.
|
|
554
|
+
[Guide](docs/guides/trace-debugging.md) · examples
|
|
555
|
+
[`07`](examples/observability/07-trace-debug-agent.ts) ·
|
|
556
|
+
[`08`](examples/observability/08-self-explain.ts).
|
|
557
|
+
|
|
574
558
|
> 📖 Powered by [footprintjs `causalChain()`](https://footprintjs.github.io/footPrint/blog/backward-causal-chain/) — backward thin-slicing on the commit log. [Causal memory deep dive](https://footprintjs.github.io/agentfootprint/causal-deep-dive/) · [Explainability & compliance](https://footprintjs.github.io/footPrint/blog/explainability-compliance/)
|
|
575
559
|
|
|
576
560
|
**One recording. Two lenses. Three consumers. Zero extra instrumentation.**
|
|
577
561
|
|
|
578
|
-
###
|
|
562
|
+
### Observers stay off the hot path
|
|
579
563
|
|
|
580
|
-
By default every `agent.on()` listener runs
|
|
581
|
-
|
|
582
|
-
iteration of the ReAct loop. One option moves observation off the hot path:
|
|
564
|
+
By default every `agent.on()` listener runs synchronously inside the producing
|
|
565
|
+
statement. One option moves observation off the hot path:
|
|
583
566
|
|
|
584
567
|
```ts
|
|
585
|
-
|
|
586
|
-
provider,
|
|
587
|
-
model,
|
|
588
|
-
observerDelivery: 'deferred', // default 'inline' — byte-identical to prior releases
|
|
589
|
-
})
|
|
590
|
-
.system('…')
|
|
591
|
-
.build();
|
|
592
|
-
|
|
593
|
-
await agent.run({ message });
|
|
568
|
+
Agent.create({ provider, model, observerDelivery: 'deferred' }) // default 'inline'
|
|
594
569
|
// serverless / shutdown: settle async listener work before the freeze
|
|
595
570
|
await agent.drainObservers({ timeoutMs: 5_000 });
|
|
596
571
|
```
|
|
597
572
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
**The measured deal** — 50-iteration full-feature agent, 3 747 events, a
|
|
610
|
-
deliberately slow 5 ms-per-event wildcard listener, 100 ms mock LLM latency
|
|
611
|
-
([`examples/features/21-deferred-observers.ts`](examples/features/21-deferred-observers.ts)):
|
|
612
|
-
|
|
613
|
-
| Streaming cadence | Mode | Wall | p95 / iteration | Drops |
|
|
614
|
-
|---|---|---|---|---|
|
|
615
|
-
| — | no listener (the floor) | 5.6 s | 115 ms | — |
|
|
616
|
-
| 0 ms (back-to-back chunks) | inline + listener | 24.5 s | 727 ms | — |
|
|
617
|
-
| 0 ms (back-to-back chunks) | **deferred** + listener | 24.0 s | 710 ms | 0 |
|
|
618
|
-
| 20 ms (realistic streaming) | inline + listener | 34.8 s | 926 ms | — |
|
|
619
|
-
| 20 ms (realistic streaming) | **deferred** + listener | **32.1 s (−2.7 s, −8%)** | **868 ms** | 0 |
|
|
620
|
-
|
|
621
|
-
Honest mechanism: on a single thread a CPU-burning listener's total work is
|
|
622
|
-
conserved — deferral recovers wall time where waits sit **adjacent** to the
|
|
623
|
-
producing events (`llm_start` before the provider wait, `tool_start` before
|
|
624
|
-
tool I/O, tokens between stream chunks). Back-to-back streaming
|
|
625
|
-
(`chunkDelayMs: 0`) is the worst case (~2% wall saved); realistic streaming
|
|
626
|
-
cadence makes token events wait-adjacent and the saving grows several-fold.
|
|
627
|
-
What never depends on shape: the **bounded** queue (no OOM), **error
|
|
628
|
-
isolation** (a throwing listener can't kill the run), **per-listener stats**,
|
|
629
|
-
**zero loss** (`drops: 0`, gap-detectable), and **terminal completeness**.
|
|
630
|
-
Not opting in costs nothing — the default path attaches exactly as before and
|
|
631
|
-
allocates no queue.
|
|
632
|
-
|
|
633
|
-
> 📖 Full semantics (capture policies, backpressure, `'block'` overflow):
|
|
634
|
-
> [footprintjs deferred-observers guide](https://github.com/footprintjs/footPrint/blob/main/docs/guides/observers-deferred.md)
|
|
573
|
+
Events are captured into a bounded queue (≈ microseconds on the hot path) and
|
|
574
|
+
delivered one beat behind — same typed events, same order, zero loss, a throwing
|
|
575
|
+
listener can't kill the run, and per-listener stats land on
|
|
576
|
+
`getLastSnapshot()?.observerStats` to name the hog. Terminal boundaries (resolve,
|
|
577
|
+
crash, pause) drain synchronously first, so checkpoints are always complete.
|
|
578
|
+
Measured: −8% wall on a 50-iteration agent with a deliberately slow listener
|
|
579
|
+
([example 21](examples/features/21-deferred-observers.ts)).
|
|
580
|
+
|
|
581
|
+
> 📖 Full semantics (capture policies, backpressure, overflow):
|
|
582
|
+
> [deferred-observers guide](https://github.com/footprintjs/footPrint/blob/main/docs/guides/observers-deferred.md)
|
|
635
583
|
|
|
636
584
|
### Lint your tool catalog — before the model picks the wrong twin
|
|
637
585
|
|
|
@@ -713,7 +661,16 @@ The flowchart, recorders, and tests don't change between dev and prod.
|
|
|
713
661
|
- Resilience primitives — `withRetry`, `withFallback`, `withCircuitBreaker`, `.outputFallback`, `agent.resumeOnError`
|
|
714
662
|
- 60+ typed observability events — `agent` · `composition` · `context` · `stream` · `tools` · `skill` · `memory` · `cache` · `cost` · `permission` · `eval` · `embedding` · `pause` · `error` · `fallback` · `resilience` · `reliability` · `risk`
|
|
715
663
|
|
|
664
|
+
**Debugging & compliance** (`agentfootprint/observe`)
|
|
665
|
+
- Tool-catalog lint — `npx agentfootprint-lint-tools` (any framework's tool list) + runtime `toolChoiceRecorder` margins
|
|
666
|
+
- Contextual-bug localizer — `localizeContextBug` (causal slice → influence ranking → counterfactual ablation) + `bisectCulprits`
|
|
667
|
+
- `toBacktrackTrace` — render any decision as the BacktrackView "why?" board
|
|
668
|
+
- Trace toolpack — 6 bounded, LLM-callable tools so a debugger model walks the trace by id
|
|
669
|
+
- `traceDebugAgent` (dedicated debugger session) · `.selfExplain()` (in-conversation why-questions, skill-gated, with a cheap-model `delegate` switch)
|
|
670
|
+
- OTel GenAI span export · hash-chained tamper-evident audit bundles with an offline verifier
|
|
671
|
+
|
|
716
672
|
**Tooling**
|
|
673
|
+
- **AgentThinkingUI** — animated run player + BacktrackView why-board (separate `agentthinkingui` package)
|
|
717
674
|
- **Lens** · **Explainable Trace** — two visual replays of the causal trace (separate `agentfootprint-lens` package)
|
|
718
675
|
- AI-coding-tool support — Claude Code · Cursor · Windsurf · Cline · Kiro · Copilot
|
|
719
676
|
|
|
@@ -14,6 +14,7 @@ const outputFallback_js_1 = require("../outputFallback.js");
|
|
|
14
14
|
const defineInstruction_js_1 = require("../../lib/injection-engine/factories/defineInstruction.js");
|
|
15
15
|
const commentaryTemplates_js_1 = require("../../recorders/observability/commentary/commentaryTemplates.js");
|
|
16
16
|
const statusTemplates_js_1 = require("../../recorders/observability/status/statusTemplates.js");
|
|
17
|
+
const selfExplain_js_1 = require("../../lib/trace-toolpack/selfExplain.js");
|
|
17
18
|
const Agent_js_1 = require("../Agent.js");
|
|
18
19
|
/**
|
|
19
20
|
* Fluent builder. `tool()` accepts any Tool<TArgs, TResult> and registers
|
|
@@ -107,6 +108,7 @@ class AgentBuilder {
|
|
|
107
108
|
* `.thinkingHandler()` (response-side normalization choice).
|
|
108
109
|
*/
|
|
109
110
|
thinkingBudgetValue;
|
|
111
|
+
selfExplainConfig;
|
|
110
112
|
constructor(opts) {
|
|
111
113
|
this.opts = opts;
|
|
112
114
|
// Cache layer: opts.caching === 'off' propagates to scope's
|
|
@@ -659,6 +661,44 @@ class AgentBuilder {
|
|
|
659
661
|
this.thinkingBudgetValue = opts.budget;
|
|
660
662
|
return this;
|
|
661
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Let this agent answer why-questions about its OWN previous completed
|
|
666
|
+
* turn, from its recorded trace. Mounts one skill: day to day the tool
|
|
667
|
+
* catalog carries only the skill's activation row; when the user asks
|
|
668
|
+
* "why did you…", the LLM activates it and that iteration alone gets
|
|
669
|
+
* the trace tools (inline mode) or a single `explain_run` tool that
|
|
670
|
+
* runs a nested trace debugger on a cheaper model (delegate mode).
|
|
671
|
+
*
|
|
672
|
+
* Evidence binds LATE — always to the previous COMPLETED run, never
|
|
673
|
+
* the in-flight one — and includes control edges (a per-run
|
|
674
|
+
* control-dependence recorder is attached automatically).
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* Agent.create({ provider, model })
|
|
678
|
+
* .system('You are a refunds assistant.')
|
|
679
|
+
* .tool(lookupOrder)
|
|
680
|
+
* .selfExplain() // inline, zero config
|
|
681
|
+
* .build();
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* .selfExplain({ delegate: { provider: anthropic(), model: 'claude-haiku-4-5' } })
|
|
685
|
+
*/
|
|
686
|
+
selfExplain(opts = {}) {
|
|
687
|
+
if (this.selfExplainConfig !== undefined) {
|
|
688
|
+
throw new Error('AgentBuilder.selfExplain: already enabled.');
|
|
689
|
+
}
|
|
690
|
+
if (this.opts.reactMode === 'classic') {
|
|
691
|
+
// Classic ReAct caches the tools slot on turn 1 — a mid-turn skill
|
|
692
|
+
// activation could never surface the trace tools. Fail loud at
|
|
693
|
+
// build-time rather than silently never answering why-questions.
|
|
694
|
+
throw new Error('AgentBuilder.selfExplain: requires per-iteration slot recomposition — ' +
|
|
695
|
+
"reactMode 'classic' caches the tools slot, so the activated trace tools " +
|
|
696
|
+
"would never reach the model. Use the default 'dynamic' mode (or " +
|
|
697
|
+
"'dynamic-grouped'), or use traceDebugAgent() as a separate session instead.");
|
|
698
|
+
}
|
|
699
|
+
this.selfExplainConfig = opts;
|
|
700
|
+
return this;
|
|
701
|
+
}
|
|
662
702
|
build() {
|
|
663
703
|
// Resolve the voice config: bundled defaults + consumer overrides.
|
|
664
704
|
// Templates flow through the same barrel exports the rest of the
|
|
@@ -671,13 +711,47 @@ class AgentBuilder {
|
|
|
671
711
|
const opts = this.maxIterationsOverride !== undefined
|
|
672
712
|
? { ...this.opts, maxIterations: this.maxIterationsOverride }
|
|
673
713
|
: this.opts;
|
|
674
|
-
|
|
714
|
+
// .selfExplain(): a fresh binding per build() — two built agents never
|
|
715
|
+
// share evidence. One mounted skill (methodology body only) + the trace
|
|
716
|
+
// tools on a skill-scoped ToolProvider composed with the consumer's own,
|
|
717
|
+
// so the catalog gains them ONLY on the activated iteration.
|
|
718
|
+
//
|
|
719
|
+
// Name reservation (mirrors the read_skill rule): the tools slot dedupes
|
|
720
|
+
// by name with first-occurrence-wins and the static registry merges
|
|
721
|
+
// FIRST — a consumer tool named like a trace tool would silently shadow
|
|
722
|
+
// it, and the skill body would instruct the model into the wrong tool.
|
|
723
|
+
if (this.selfExplainConfig) {
|
|
724
|
+
const reserved = this.selfExplainConfig.delegate
|
|
725
|
+
? ['explain_run']
|
|
726
|
+
: ['run_overview', 'trace_node', 'trace_slice', 'who_wrote', 'get_value'];
|
|
727
|
+
const clash = this.registry.find((entry) => reserved.includes(entry.name));
|
|
728
|
+
if (clash) {
|
|
729
|
+
throw new Error(`AgentBuilder.selfExplain: tool name '${clash.name}' is reserved by .selfExplain() ` +
|
|
730
|
+
`(${this.selfExplainConfig.delegate ? 'delegate' : 'inline'} mode). The tools slot ` +
|
|
731
|
+
`dedupes by name (first wins), so your tool would silently shadow the trace tool. ` +
|
|
732
|
+
`Rename it, or reserved names: ${reserved.join(', ')}.`);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const selfExplainBinding = this.selfExplainConfig ? new selfExplain_js_1.SelfExplainBinding() : undefined;
|
|
736
|
+
const injections = selfExplainBinding
|
|
737
|
+
? [...this.injectionList, (0, selfExplain_js_1.buildSelfExplainSkill)(this.selfExplainConfig)]
|
|
738
|
+
: this.injectionList;
|
|
739
|
+
const toolProvider = selfExplainBinding
|
|
740
|
+
? (0, selfExplain_js_1.buildSelfExplainToolProvider)(selfExplainBinding, this.selfExplainConfig, this.toolProviderRef)
|
|
741
|
+
: this.toolProviderRef;
|
|
742
|
+
const agent = new Agent_js_1.Agent(opts, this.systemPromptValue, this.registry, voice, injections, this.memoryList, this.outputSchemaParser, toolProvider, this.systemPromptCachePolicy, this.cachingDisabledValue, this.cacheStrategyOverride, this.outputFallbackCfg, this.reliabilityConfig, this.thinkingHandlerValue, this.thinkingBudgetValue);
|
|
675
743
|
// Attach builder-collected recorders so they receive events from
|
|
676
744
|
// the very first run. Mirrors what consumers would do post-build
|
|
677
745
|
// via `agent.attach(rec)`; the builder method is purely sugar.
|
|
678
746
|
for (const rec of this.recorderList) {
|
|
679
747
|
agent.attach(rec);
|
|
680
748
|
}
|
|
749
|
+
if (selfExplainBinding) {
|
|
750
|
+
// Late binding: capture fires at each run's terminal flush, when
|
|
751
|
+
// getLastSnapshot() IS the just-completed run (never in-flight).
|
|
752
|
+
selfExplainBinding.bindTo(() => agent.getLastSnapshot());
|
|
753
|
+
agent.attach(selfExplainBinding.recorder());
|
|
754
|
+
}
|
|
681
755
|
return agent;
|
|
682
756
|
}
|
|
683
757
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.js","sourceRoot":"","sources":["../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,wDAI4B;AAC5B,4DAK8B;AAG9B,oGAA8F;AAM9F,4GAA6G;AAC7G,gGAAiG;AACjG,0CAAoC;AAGpC;;;GAGG;AACH,MAAa,YAAY;IACN,IAAI,CAAe;IA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+D;QAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,IAAI,kBAAkB,EAAE,CAAC;YACvB,iEAAiE;YACjE,iEAAiE;YACjE,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAryBD,oCAqyBC"}
|
|
@@ -11,6 +11,7 @@ import { validateCannedAgainstSchema, } from '../outputFallback.js';
|
|
|
11
11
|
import { defineInstruction } from '../../lib/injection-engine/factories/defineInstruction.js';
|
|
12
12
|
import { defaultCommentaryTemplates } from '../../recorders/observability/commentary/commentaryTemplates.js';
|
|
13
13
|
import { defaultStatusTemplates } from '../../recorders/observability/status/statusTemplates.js';
|
|
14
|
+
import { buildSelfExplainSkill, buildSelfExplainToolProvider, SelfExplainBinding, } from '../../lib/trace-toolpack/selfExplain.js';
|
|
14
15
|
import { Agent } from '../Agent.js';
|
|
15
16
|
/**
|
|
16
17
|
* Fluent builder. `tool()` accepts any Tool<TArgs, TResult> and registers
|
|
@@ -104,6 +105,7 @@ export class AgentBuilder {
|
|
|
104
105
|
* `.thinkingHandler()` (response-side normalization choice).
|
|
105
106
|
*/
|
|
106
107
|
thinkingBudgetValue;
|
|
108
|
+
selfExplainConfig;
|
|
107
109
|
constructor(opts) {
|
|
108
110
|
this.opts = opts;
|
|
109
111
|
// Cache layer: opts.caching === 'off' propagates to scope's
|
|
@@ -656,6 +658,44 @@ export class AgentBuilder {
|
|
|
656
658
|
this.thinkingBudgetValue = opts.budget;
|
|
657
659
|
return this;
|
|
658
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Let this agent answer why-questions about its OWN previous completed
|
|
663
|
+
* turn, from its recorded trace. Mounts one skill: day to day the tool
|
|
664
|
+
* catalog carries only the skill's activation row; when the user asks
|
|
665
|
+
* "why did you…", the LLM activates it and that iteration alone gets
|
|
666
|
+
* the trace tools (inline mode) or a single `explain_run` tool that
|
|
667
|
+
* runs a nested trace debugger on a cheaper model (delegate mode).
|
|
668
|
+
*
|
|
669
|
+
* Evidence binds LATE — always to the previous COMPLETED run, never
|
|
670
|
+
* the in-flight one — and includes control edges (a per-run
|
|
671
|
+
* control-dependence recorder is attached automatically).
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* Agent.create({ provider, model })
|
|
675
|
+
* .system('You are a refunds assistant.')
|
|
676
|
+
* .tool(lookupOrder)
|
|
677
|
+
* .selfExplain() // inline, zero config
|
|
678
|
+
* .build();
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* .selfExplain({ delegate: { provider: anthropic(), model: 'claude-haiku-4-5' } })
|
|
682
|
+
*/
|
|
683
|
+
selfExplain(opts = {}) {
|
|
684
|
+
if (this.selfExplainConfig !== undefined) {
|
|
685
|
+
throw new Error('AgentBuilder.selfExplain: already enabled.');
|
|
686
|
+
}
|
|
687
|
+
if (this.opts.reactMode === 'classic') {
|
|
688
|
+
// Classic ReAct caches the tools slot on turn 1 — a mid-turn skill
|
|
689
|
+
// activation could never surface the trace tools. Fail loud at
|
|
690
|
+
// build-time rather than silently never answering why-questions.
|
|
691
|
+
throw new Error('AgentBuilder.selfExplain: requires per-iteration slot recomposition — ' +
|
|
692
|
+
"reactMode 'classic' caches the tools slot, so the activated trace tools " +
|
|
693
|
+
"would never reach the model. Use the default 'dynamic' mode (or " +
|
|
694
|
+
"'dynamic-grouped'), or use traceDebugAgent() as a separate session instead.");
|
|
695
|
+
}
|
|
696
|
+
this.selfExplainConfig = opts;
|
|
697
|
+
return this;
|
|
698
|
+
}
|
|
659
699
|
build() {
|
|
660
700
|
// Resolve the voice config: bundled defaults + consumer overrides.
|
|
661
701
|
// Templates flow through the same barrel exports the rest of the
|
|
@@ -668,13 +708,47 @@ export class AgentBuilder {
|
|
|
668
708
|
const opts = this.maxIterationsOverride !== undefined
|
|
669
709
|
? { ...this.opts, maxIterations: this.maxIterationsOverride }
|
|
670
710
|
: this.opts;
|
|
671
|
-
|
|
711
|
+
// .selfExplain(): a fresh binding per build() — two built agents never
|
|
712
|
+
// share evidence. One mounted skill (methodology body only) + the trace
|
|
713
|
+
// tools on a skill-scoped ToolProvider composed with the consumer's own,
|
|
714
|
+
// so the catalog gains them ONLY on the activated iteration.
|
|
715
|
+
//
|
|
716
|
+
// Name reservation (mirrors the read_skill rule): the tools slot dedupes
|
|
717
|
+
// by name with first-occurrence-wins and the static registry merges
|
|
718
|
+
// FIRST — a consumer tool named like a trace tool would silently shadow
|
|
719
|
+
// it, and the skill body would instruct the model into the wrong tool.
|
|
720
|
+
if (this.selfExplainConfig) {
|
|
721
|
+
const reserved = this.selfExplainConfig.delegate
|
|
722
|
+
? ['explain_run']
|
|
723
|
+
: ['run_overview', 'trace_node', 'trace_slice', 'who_wrote', 'get_value'];
|
|
724
|
+
const clash = this.registry.find((entry) => reserved.includes(entry.name));
|
|
725
|
+
if (clash) {
|
|
726
|
+
throw new Error(`AgentBuilder.selfExplain: tool name '${clash.name}' is reserved by .selfExplain() ` +
|
|
727
|
+
`(${this.selfExplainConfig.delegate ? 'delegate' : 'inline'} mode). The tools slot ` +
|
|
728
|
+
`dedupes by name (first wins), so your tool would silently shadow the trace tool. ` +
|
|
729
|
+
`Rename it, or reserved names: ${reserved.join(', ')}.`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
const selfExplainBinding = this.selfExplainConfig ? new SelfExplainBinding() : undefined;
|
|
733
|
+
const injections = selfExplainBinding
|
|
734
|
+
? [...this.injectionList, buildSelfExplainSkill(this.selfExplainConfig)]
|
|
735
|
+
: this.injectionList;
|
|
736
|
+
const toolProvider = selfExplainBinding
|
|
737
|
+
? buildSelfExplainToolProvider(selfExplainBinding, this.selfExplainConfig, this.toolProviderRef)
|
|
738
|
+
: this.toolProviderRef;
|
|
739
|
+
const agent = new Agent(opts, this.systemPromptValue, this.registry, voice, injections, this.memoryList, this.outputSchemaParser, toolProvider, this.systemPromptCachePolicy, this.cachingDisabledValue, this.cacheStrategyOverride, this.outputFallbackCfg, this.reliabilityConfig, this.thinkingHandlerValue, this.thinkingBudgetValue);
|
|
672
740
|
// Attach builder-collected recorders so they receive events from
|
|
673
741
|
// the very first run. Mirrors what consumers would do post-build
|
|
674
742
|
// via `agent.attach(rec)`; the builder method is purely sugar.
|
|
675
743
|
for (const rec of this.recorderList) {
|
|
676
744
|
agent.attach(rec);
|
|
677
745
|
}
|
|
746
|
+
if (selfExplainBinding) {
|
|
747
|
+
// Late binding: capture fires at each run's terminal flush, when
|
|
748
|
+
// getLastSnapshot() IS the just-completed run (never in-flight).
|
|
749
|
+
selfExplainBinding.bindTo(() => agent.getLastSnapshot());
|
|
750
|
+
agent.attach(selfExplainBinding.recorder());
|
|
751
|
+
}
|
|
678
752
|
return agent;
|
|
679
753
|
}
|
|
680
754
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.js","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2BAA2B,GAI5B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAC;AAM9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,iEAAiE,CAAC;AAC7G,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;GAGG;AACH,MAAM,OAAO,YAAY;IACN,IAAI,CAAe;IAC5B,iBAAiB,GAAG,EAAE,CAAC;IAC/B;;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I,CAAC,uBAAuB,EAC5B,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,mBAAmB,CACzB,CAAC;QACF,iEAAiE;QACjE,iEAAiE;QACjE,+DAA+D;QAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QACD,IAAI,kBAAkB,EAAE,CAAC;YACvB,iEAAiE;YACjE,iEAAiE;YACjE,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oEAAoE;AACpE,8DAA8D;AAC9D,uEAAuE;AACvE,kEAAkE;AAClE,sEAAsE;AACtE,sDAAsD;AACtD,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,4CAA4C,CAAC;AAsCpD,qCAAqC;AACrC,cAAc,mBAAmB,CAAC;AAMlC,OAAO,EACL,WAAW,EACX,eAAe,GAIhB,MAAM,sBAAsB,CAAC;AAE9B,aAAa;AACb,OAAO,EACL,eAAe,GAQhB,MAAM,wBAAwB,CAAC;AAEhC,6BAA6B;AAC7B,cAAc,qBAAqB,CAAC;AAEpC,yEAAyE;AACzE,uDAAuD;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc;AAEd,yEAAyE;AAC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AAS,EACT,aAAa,GASd,MAAM,oBAAoB,CAAC;AAE5B,wEAAwE;AACxE,qEAAqE;AACrE,mEAAmE;AACnE,sEAAsE;AACtE,sEAAsE;AACtE,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,GAIjB,MAAM,2BAA2B,CAAC;AAEnC,wEAAwE;AACxE,wEAAwE;AACxE,uDAAuD;AACvD,OAAO,EACL,gBAAgB,EAChB,eAAe,GAIhB,MAAM,qBAAqB,CAAC;AAE7B,mEAAmE;AACnE,oEAAoE;AACpE,sDAAsD;AACtD,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -99,9 +99,7 @@ export function toBacktrackTrace(report, opts) {
|
|
|
99
99
|
const folded = dropped.length > 0
|
|
100
100
|
? `${dropped.length} more suspect${dropped.length === 1 ? '' : 's'} folded — ` +
|
|
101
101
|
dropped.map((e) => `#${e.trueRank} ${e.s.source}`).join(' · ') +
|
|
102
|
-
(dropped.every((e) => !e.s.hasContentEvidence)
|
|
103
|
-
? ' (path-only upper bounds)'
|
|
104
|
-
: '') +
|
|
102
|
+
(dropped.every((e) => !e.s.hasContentEvidence) ? ' (path-only upper bounds)' : '') +
|
|
105
103
|
' — every id drillable with the trace toolpack'
|
|
106
104
|
: undefined;
|
|
107
105
|
// auto tie-warning: only when the report's top two genuinely crowd each other
|
|
@@ -112,10 +110,7 @@ export function toBacktrackTrace(report, opts) {
|
|
|
112
110
|
scoreNote = `top-2 margin ${margin.toFixed(2)} — proxy scores alone cannot separate them${report.mode === 'causal' ? '; the ablation test can' : ''}.`;
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
const honesty = [
|
|
116
|
-
...report.honestyFlags.map((f) => `⚠ ${f.flag}: ${f.note}`),
|
|
117
|
-
...CLAIMS_LINES,
|
|
118
|
-
];
|
|
113
|
+
const honesty = [...report.honestyFlags.map((f) => `⚠ ${f.flag}: ${f.note}`), ...CLAIMS_LINES];
|
|
119
114
|
return {
|
|
120
115
|
claim: opts.claim ?? `Why did ${report.stepName} (${report.step}) decide this?`,
|
|
121
116
|
mode: report.mode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toBacktrackTrace.js","sourceRoot":"","sources":["../../../../src/lib/context-bisect/toBacktrackTrace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"toBacktrackTrace.js","sourceRoot":"","sources":["../../../../src/lib/context-bisect/toBacktrackTrace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAwHH,6EAA6E;AAE7E,MAAM,QAAQ,GAAuC;IACnD,SAAS,EAAE,kBAAkB;IAC7B,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,0BAA0B;IAC/B,KAAK,EAAE,cAAc;CACtB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,YAAY,GAAsB;IACtC,wGAAwG;IACxG,4CAA4C;CAC7C,CAAC;AAEF,SAAS,WAAW,CAAC,CAAU;IAC7B,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC;AACjE,CAAC;AAED,SAAS,MAAM,CACb,CAAU,EACV,QAAgB,EAChB,OAA4C;IAE5C,sEAAsE;IACtE,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvF,MAAM,OAAO,GACX,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,cAAc;QAC/C,CAAC,CAAC;YACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OA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