agentfootprint 7.5.0 → 7.6.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 CHANGED
@@ -299,6 +299,26 @@ again.answer; // 'HOLD …'
299
299
  again.whatChanged.summary; // 'Removing sources [social-sentiment] changed the answer in 3/3 seeded re-runs …'
300
300
  ```
301
301
 
302
+ ### Chat sessions that can explain themselves
303
+
304
+ `recordedChat` wraps your agent factory into a recorded conversation. Every `send()`
305
+ freezes that turn's evidence. `reason(k)` shows what influenced reply K. `rerunTurn(k,
306
+ { ignore })` re-runs that exact turn — same recorded history, byte for byte — without a
307
+ source, and returns the same honest result `rerunWithoutSources` gives you. `fork(k,
308
+ { fromRerun })` continues the conversation from the what-if as a new recorded session.
309
+ Branch, never rewrite.
310
+
311
+ ```ts
312
+ import { recordedChat } from 'agentfootprint/debug';
313
+
314
+ const chat = recordedChat({ makeAgent }); // your factory, specs applied at construction
315
+ await chat.send('Should we BUY or HOLD?'); // recorded turn (frozen evidence)
316
+ const rerun = await chat.rerunTurn(1, { // that turn, minus one source
317
+ ignore: ['social-sentiment'], embedder, checkBaseline: true,
318
+ });
319
+ const fork = chat.fork(1, { fromRerun: rerun }); // continue from the what-if
320
+ ```
321
+
302
322
  ---
303
323
 
304
324
  ## Pick your door
package/dist/debug.js CHANGED
@@ -20,7 +20,7 @@
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.classifySuspect = exports.DEFAULT_RECENCY_DECAY = exports.buildWriterFrameIndex = exports.walkTrajectory = exports.walkToRoot = exports.shortlistEarlyCulprits = exports.bucketByAnchors = exports.bisectCulprits = exports.assignCostVerdicts = exports.assembleTrajectory = exports.applyAblations = exports.ablationForSuspect = exports.traceDebugAgent = exports.SelfExplainBinding = exports.buildSelfExplainToolProvider = exports.buildSelfExplainSkill = exports.traceToolpack = exports.TOOLPACK_HARD_CAPS = exports.NO_COMPLETED_RUN_MESSAGE = exports.lazyTraceToolpack = exports.callTraceTool = exports.structuralProximity = exports.snippetUnits = exports.semanticAlignmentStrategy = exports.scoreMargin = exports.scoreLexicalInfluence = exports.scoreInfluence = exports.scoreContrastiveInfluence = exports.ratioStrategy = exports.rankingConfidence = exports.persistence = exports.pairwiseSimilarity = exports.marginStrategy = exports.listInfluenceStrategies = exports.lexicalOverlapStrategy = exports.explainChoice = exports.attributeChoice = exports.finalAnswerSimilarity = exports.embeddingCache = exports.EmbeddingCache = exports.DEFAULT_SHORTLIST_BAND = exports.DEFAULT_PERSISTENCE_THRESHOLD = exports.DEFAULT_MARGIN_THRESHOLD = exports.DEFAULT_INFLUENCE_WEIGHTS = exports.DEFAULT_CLEAR_WINNER_RATIO = exports.DEFAULT_CLEAR_WINNER_MARGIN = exports.contentHash = exports.compositeScore = exports.averageRelevancy = exports.adaptWeights = void 0;
23
- exports.saysWhatNotWhenRule = exports.runToolLintCli = exports.optionalParamRule = exports.MOCK_EMBEDDER_CALIBRATION = exports.formatToolCatalogReport = exports.enumInProseRule = exports.differentiationHint = exports.descriptionRule = exports.defaultStructuralRules = exports.DEFAULT_WHEN_CUES = exports.DEFAULT_WATCH_BAND = exports.DEFAULT_OMISSION_CUES = exports.DEFAULT_CONFUSABILITY_THRESHOLD = exports.confusabilityText = exports.coerceCatalog = exports.catalogFromTools = exports.analyzeToolCatalog = exports.toBacktrackTrace = exports.sliceToBacktrackTrace = exports.verdictFor = exports.suspectLabel = exports.stepOutputText = exports.runRestorationProbe = exports.runAblationProbe = exports.rerunWithoutSources = exports.removableSources = exports.probeFlipped = exports.localizeContextBug = exports.llmEdgeWeigher = exports.llmCallIdsFromEvents = exports.formatContextBugReport = exports.findDroppedContext = exports.defaultSuspectClassifier = exports.defaultOutcomeComparator = exports.CONTEXT_BISECT_DEFAULTS = exports.findLoopHeads = void 0;
23
+ exports.recordedChat = exports.saysWhatNotWhenRule = exports.runToolLintCli = exports.optionalParamRule = exports.MOCK_EMBEDDER_CALIBRATION = exports.formatToolCatalogReport = exports.enumInProseRule = exports.differentiationHint = exports.descriptionRule = exports.defaultStructuralRules = exports.DEFAULT_WHEN_CUES = exports.DEFAULT_WATCH_BAND = exports.DEFAULT_OMISSION_CUES = exports.DEFAULT_CONFUSABILITY_THRESHOLD = exports.confusabilityText = exports.coerceCatalog = exports.catalogFromTools = exports.analyzeToolCatalog = exports.toBacktrackTrace = exports.sliceToBacktrackTrace = exports.verdictFor = exports.suspectLabel = exports.stepOutputText = exports.runRestorationProbe = exports.runAblationProbe = exports.rerunWithoutSources = exports.removableSources = exports.probeFlipped = exports.localizeContextBug = exports.llmEdgeWeigher = exports.llmCallIdsFromEvents = exports.formatContextBugReport = exports.findDroppedContext = exports.defaultSuspectClassifier = exports.defaultOutcomeComparator = exports.CONTEXT_BISECT_DEFAULTS = exports.findLoopHeads = void 0;
24
24
  // influence-core — the ONE embedding-based scoring engine (RFC-002/003
25
25
  // block D6). Not a recorder: pure, embedder-injected scoring functions
26
26
  // + the shared bounded embedding cache. Honest claim: every score is an
@@ -141,4 +141,13 @@ Object.defineProperty(exports, "MOCK_EMBEDDER_CALIBRATION", { enumerable: true,
141
141
  Object.defineProperty(exports, "optionalParamRule", { enumerable: true, get: function () { return index_js_6.optionalParamRule; } });
142
142
  Object.defineProperty(exports, "runToolLintCli", { enumerable: true, get: function () { return index_js_6.runToolLintCli; } });
143
143
  Object.defineProperty(exports, "saysWhatNotWhenRule", { enumerable: true, get: function () { return index_js_6.saysWhatNotWhenRule; } });
144
+ // recorded-chat — the session-scoped turn recorder. Wraps a consumer agent
145
+ // factory into a recorded conversation: send() freezes each turn's evidence,
146
+ // reason(k)/rerunTurn(k)/fork(k) are the per-turn transparency loop. Absorbs
147
+ // the three glue traps (per-turn artifact freezing, byte-exact history
148
+ // threading, same-factory runner derivation) while COMPOSING with the loop
149
+ // above (localizeContextBug + rerunWithoutSources returned UNMODIFIED), never
150
+ // duplicating it. Branch, never rewrite.
151
+ var index_js_7 = require("./lib/recorded-chat/index.js");
152
+ Object.defineProperty(exports, "recordedChat", { enumerable: true, get: function () { return index_js_7.recordedChat; } });
144
153
  //# sourceMappingURL=debug.js.map
package/dist/debug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;AAEH,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,4BAA4B;AAC5B,0DA8DuC;AA7DrC,wGAAA,YAAY,OAAA;AACZ,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AACX,uHAAA,2BAA2B,OAAA;AAC3B,sHAAA,0BAA0B,OAAA;AAC1B,qHAAA,yBAAyB,OAAA;AACzB,oHAAA,wBAAwB,OAAA;AACxB,yHAAA,6BAA6B,OAAA;AAC7B,kHAAA,sBAAsB,OAAA;AACtB,0GAAA,cAAc,OAAA;AACd,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,2GAAA,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AACb,kHAAA,sBAAsB,OAAA;AACtB,mHAAA,uBAAuB,OAAA;AACvB,0GAAA,cAAc,OAAA;AACd,8GAAA,kBAAkB,OAAA;AAClB,uGAAA,WAAW,OAAA;AACX,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AACb,qHAAA,yBAAyB,OAAA;AACzB,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,uGAAA,WAAW,OAAA;AACX,qHAAA,yBAAyB,OAAA;AACzB,wGAAA,YAAY,OAAA;AACZ,+GAAA,mBAAmB,OAAA;AAkCrB,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,0DAQuC;AAPrC,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,oHAAA,wBAAwB,OAAA;AACxB,8GAAA,kBAA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ACtB,gHAAA,oBAAoB,OAAA;AACpB,0GAAA,cAAc,OAAA;AACd,8GAAA,kBAAkB,OAAA;AAClB,wGAAA,YAAY,OAAA;AACZ,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,0GAAA,cAAc,OAAA;AACd,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AA8DZ,sEAAsE;AACtE,uEAAuE;AACvE,mEAAmE;AACnE,0DAUuC;AATrC,iHAAA,qBAAqB,OAAA;AACrB,4GAAA,gBAAgB,OAAA;AASlB,wEAAwE;AACxE,8EAA8E;AAC9E,qEAAqE;AACrE,wEAAwE;AACxE,uEAAuE;AACvE,gEAAgE;AAChE,gDAAgD;AAChD,qDAgCkC;AA/BhC,8GAAA,kBAAkB,OAAA;AAClB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,2HAAA,+BAA+B,OAAA;AAC/B,iHAAA,qBAAqB,OAAA;AACrB,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,kHAAA,sBAAsB,OAAA;AACtB,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AACnB,2GAAA,eAAe,OAAA;AACf,mHAAA,uBAAuB,OAAA;AACvB,qHAAA,yBAAyB,OAAA;AACzB,6GAAA,iBAAiB,OAAA;AACjB,0GAAA,cAAc,OAAA;AACd,+GAAA,mBAAmB,OAAA;AAgBrB,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,yCAAyC;AACzC,yDAasC;AAZpC,wGAAA,YAAY,OAAA"}
@@ -23,3 +23,4 @@ export { buildSelfExplainSkill, buildSelfExplainToolProvider, SelfExplainBinding
23
23
  export { ablationForSuspect, applyAblations, assembleTrajectory, assignCostVerdicts, bisectCulprits, bucketByAnchors, shortlistEarlyCulprits, walkToRoot, walkTrajectory, buildWriterFrameIndex, DEFAULT_RECENCY_DECAY, classifySuspect, findLoopHeads, CONTEXT_BISECT_DEFAULTS, defaultOutcomeComparator, defaultSuspectClassifier, findDroppedContext, formatContextBugReport, llmCallIdsFromEvents, llmEdgeWeigher, localizeContextBug, probeFlipped, removableSources, rerunWithoutSources, runAblationProbe, runRestorationProbe, stepOutputText, suspectLabel, verdictFor, type AblationRerun, type AblationRunner, type AblationRunStats, type AblationSpec, type AblationTargets, type AblationVerdict, type AblationVerdictKind, type AnchorBucket, type AssembleTrajectoryOptions, type LoopCandidate, type LoopRecallShortlist, type ShortlistEarlyCulpritsOptions, type RootCauseHop, type RootCauseNote, type RootCausePath, type WalkToRootOptions, type BisectCulpritsOptions, type BisectionProbe, type BisectionResult, type CapturedEventLike, type ClassifyContext, type ContextBugArtifacts, type ContextBugReport, type ContextSource, type ContextUnit, type CostRange, type CostStats, type CostVerdict, type DroppedUnit, type EdgePathStep, type LoopFrame, type HonestyFlag, type HonestyFlagKind, type IgnoredSource, type LlmEdgeWeigherHandle, type LlmEdgeWeigherOptions, type LocalizeContextBugOptions, type MissingContextResult, type OutcomeComparator, type QualityTriggerLookup, type RankedParentEdge, type RemovableSource, type RerunWithoutSourcesOptions, type RerunWithoutSourcesResult, type RestorationProbeConfig, type RestorationRerun, type RestorationRunner, type RestoredCandidate, type RunCost, type SimilarityStats, type SliceStats, type Suspect, type SuspectClass, type SuspectClassifier, type SuspectDetail, type SuspectKind, type SuspectSeed, type SyntheticQuestionNode, type Trajectory, type WhatChanged, } from './lib/context-bisect/index.js';
24
24
  export { sliceToBacktrackTrace, toBacktrackTrace, type BacktrackCustodyHop, type BacktrackHop, type BacktrackSuspectCard, type BacktrackTrace, type BacktrackTrail, type SliceToBacktrackTraceOptions, type ToBacktrackTraceOptions, } from './lib/context-bisect/index.js';
25
25
  export { analyzeToolCatalog, catalogFromTools, coerceCatalog, confusabilityText, DEFAULT_CONFUSABILITY_THRESHOLD, DEFAULT_OMISSION_CUES, DEFAULT_WATCH_BAND, DEFAULT_WHEN_CUES, defaultStructuralRules, descriptionRule, differentiationHint, enumInProseRule, formatToolCatalogReport, MOCK_EMBEDDER_CALIBRATION, optionalParamRule, runToolLintCli, saysWhatNotWhenRule, type AnalyzeToolCatalogOptions, type CatalogTool, type ConfusablePairFinding, type DescriptionRuleOptions, type FormatReportOptions, type LintRule, type LintSeverity, type OptionalParamRuleOptions, type PairVerdict, type SaysWhatNotWhenRuleOptions, type SimilarityReport, type StructuralFinding, type ToolCatalogReport, type ToolLintCliIO, } from './lib/tool-lint/index.js';
26
+ export { recordedChat, type ChatFormat, type ChatMessage, type ChatTurn, type ForkOptions, type ForkOrigin, type MakeChatAgent, type ReasonOptions, type RecordedChat, type RecordedChatOptions, type RerunTurnOptions, type SendOptions, } from './lib/recorded-chat/index.js';
package/dist/esm/debug.js CHANGED
@@ -51,4 +51,12 @@ export { sliceToBacktrackTrace, toBacktrackTrace, } from './lib/context-bisect/i
51
51
  // injected with our defaults. Bin: `agentfootprint-lint-tools`.
52
52
  // Front door: docs/guides/tool-catalog-lint.md.
53
53
  export { analyzeToolCatalog, catalogFromTools, coerceCatalog, confusabilityText, DEFAULT_CONFUSABILITY_THRESHOLD, DEFAULT_OMISSION_CUES, DEFAULT_WATCH_BAND, DEFAULT_WHEN_CUES, defaultStructuralRules, descriptionRule, differentiationHint, enumInProseRule, formatToolCatalogReport, MOCK_EMBEDDER_CALIBRATION, optionalParamRule, runToolLintCli, saysWhatNotWhenRule, } from './lib/tool-lint/index.js';
54
+ // recorded-chat — the session-scoped turn recorder. Wraps a consumer agent
55
+ // factory into a recorded conversation: send() freezes each turn's evidence,
56
+ // reason(k)/rerunTurn(k)/fork(k) are the per-turn transparency loop. Absorbs
57
+ // the three glue traps (per-turn artifact freezing, byte-exact history
58
+ // threading, same-factory runner derivation) while COMPOSING with the loop
59
+ // above (localizeContextBug + rerunWithoutSources returned UNMODIFIED), never
60
+ // duplicating it. Branch, never rewrite.
61
+ export { recordedChat, } from './lib/recorded-chat/index.js';
54
62
  //# sourceMappingURL=debug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,4BAA4B;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,YAAY,EACZ,mBAAmB,GAiCpB,MAAM,+BAA+B,CAAC;AACvC,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,GAGd,MAAM,+BAA+B,CAAC;AACvC,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,kEAAkE;AAClE,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AACvC,qEAAqE;AACrE,sEAAsE;AACtE,sEAAsE;AACtE,+DAA+D;AAC/D,oEAAoE;AACpE,mEAAmE;AACnE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,UAAU,GA6DX,MAAM,+BAA+B,CAAC;AACvC,sEAAsE;AACtE,uEAAuE;AACvE,mEAAmE;AACnE,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GAQjB,MAAM,+BAA+B,CAAC;AACvC,wEAAwE;AACxE,8EAA8E;AAC9E,qEAAqE;AACrE,wEAAwE;AACxE,uEAAuE;AACvE,gEAAgE;AAChE,gDAAgD;AAChD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,+BAA+B,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GAepB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,4BAA4B;AAC5B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAA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B,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GAepB,MAAM,0BAA0B,CAAC;AAClC,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,yCAAyC;AACzC,OAAO,EACL,YAAY,GAYb,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * recorded-chat — the session-scoped turn recorder over the context-bisect
3
+ * product loop. Absorbs the three correctness traps every chat host re-writes
4
+ * (per-turn artifact freezing, byte-exact history threading, same-factory
5
+ * runner derivation) while COMPOSING with the 7.5 surface, not duplicating it.
6
+ *
7
+ * Exported from `agentfootprint/debug` (every symbol it composes with lives
8
+ * there). Named exports — `export *` is not the house style.
9
+ */
10
+ export { recordedChat } from './recordedChat.js';
11
+ export type { ChatFormat, ChatMessage, ChatTurn, ForkOptions, ForkOrigin, MakeChatAgent, ReasonOptions, RecordedChat, RecordedChatOptions, RerunTurnOptions, SendOptions, } from './types.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * recorded-chat — the session-scoped turn recorder over the context-bisect
3
+ * product loop. Absorbs the three correctness traps every chat host re-writes
4
+ * (per-turn artifact freezing, byte-exact history threading, same-factory
5
+ * runner derivation) while COMPOSING with the 7.5 surface, not duplicating it.
6
+ *
7
+ * Exported from `agentfootprint/debug` (every symbol it composes with lives
8
+ * there). Named exports — `export *` is not the house style.
9
+ */
10
+ export { recordedChat } from './recordedChat.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * recordedChat — the session-scoped turn recorder.
3
+ *
4
+ * `recordedChat({ makeAgent })` returns a `RecordedChat`: `send()` runs one
5
+ * recorded turn through the consumer's agent factory and freezes that turn's
6
+ * evidence immediately; `reason(k)` / `rerunTurn(k)` / `fork(k)` are the
7
+ * per-turn transparency loop, composing with the existing context-bisect
8
+ * surface (`localizeContextBug`, `rerunWithoutSources`) rather than
9
+ * duplicating it. See `./types.ts` for the three traps this owns.
10
+ *
11
+ * Compose-don't-inherit house style: a module-private session class,
12
+ * factory-returned; no base classes.
13
+ */
14
+ import type { RecordedChat, RecordedChatOptions } from './types.js';
15
+ /**
16
+ * Record a chat turn-by-turn so any reply can be explained, counterfactually
17
+ * re-run, and forked — without re-writing the correctness-critical glue every
18
+ * chat host gets subtly wrong. See the [recordedChat guide](doc:recorded-chat).
19
+ */
20
+ export declare function recordedChat(options: RecordedChatOptions): RecordedChat;
@@ -0,0 +1,240 @@
1
+ /**
2
+ * recordedChat — the session-scoped turn recorder.
3
+ *
4
+ * `recordedChat({ makeAgent })` returns a `RecordedChat`: `send()` runs one
5
+ * recorded turn through the consumer's agent factory and freezes that turn's
6
+ * evidence immediately; `reason(k)` / `rerunTurn(k)` / `fork(k)` are the
7
+ * per-turn transparency loop, composing with the existing context-bisect
8
+ * surface (`localizeContextBug`, `rerunWithoutSources`) rather than
9
+ * duplicating it. See `./types.ts` for the three traps this owns.
10
+ *
11
+ * Compose-don't-inherit house style: a module-private session class,
12
+ * factory-returned; no base classes.
13
+ */
14
+ import { llmCallIdsFromEvents, localizeContextBug, rerunWithoutSources, } from '../context-bisect/index.js';
15
+ const DEFAULT_HEADER = 'Recent conversation:';
16
+ const DEFAULT_USER_LABEL = 'User';
17
+ const DEFAULT_ASSISTANT_LABEL = 'Assistant';
18
+ /** Deterministic key for spec dedup — recursively sorts object keys. */
19
+ function canonicalKey(value) {
20
+ return JSON.stringify(value, (_key, val) => {
21
+ if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
22
+ const sorted = {};
23
+ for (const k of Object.keys(val).sort()) {
24
+ sorted[k] = val[k];
25
+ }
26
+ return sorted;
27
+ }
28
+ return val;
29
+ });
30
+ }
31
+ /** Union of ablation specs, deduped by canonical JSON (order-preserving, first wins). */
32
+ function dedupeSpecs(specs) {
33
+ const seen = new Set();
34
+ const out = [];
35
+ for (const spec of specs) {
36
+ const key = canonicalKey(spec);
37
+ if (seen.has(key))
38
+ continue;
39
+ seen.add(key);
40
+ out.push(spec);
41
+ }
42
+ return out;
43
+ }
44
+ class RecordedChatSession {
45
+ makeAgentFn;
46
+ formatOpt;
47
+ header;
48
+ userLabel;
49
+ assistantLabel;
50
+ /** seed + one (user, assistant) pair per recorded turn. */
51
+ entries;
52
+ seedMessages;
53
+ removedSpecs;
54
+ turnsInternal = [];
55
+ reports = new Map();
56
+ /** result -> turnIndex, the in-process fork-provenance guard. */
57
+ rerunOwner = new WeakMap();
58
+ sending = false;
59
+ forkedFromValue = undefined;
60
+ constructor(options) {
61
+ this.makeAgentFn = options.makeAgent;
62
+ this.formatOpt = options.format;
63
+ this.header = options.format?.header ?? DEFAULT_HEADER;
64
+ this.userLabel = options.format?.userLabel ?? DEFAULT_USER_LABEL;
65
+ this.assistantLabel = options.format?.assistantLabel ?? DEFAULT_ASSISTANT_LABEL;
66
+ this.seedMessages = Object.freeze((options.seed ?? []).map((m) => ({ ...m })));
67
+ this.entries = [...this.seedMessages];
68
+ this.removedSpecs = Object.freeze([...(options.removed ?? [])]);
69
+ }
70
+ get turns() {
71
+ return this.turnsInternal;
72
+ }
73
+ get seed() {
74
+ return this.seedMessages;
75
+ }
76
+ get removed() {
77
+ return this.removedSpecs;
78
+ }
79
+ get forkedFrom() {
80
+ return this.forkedFromValue;
81
+ }
82
+ renderLine(message) {
83
+ const label = message.role === 'user' ? this.userLabel : this.assistantLabel;
84
+ return `${label}: ${message.text}`;
85
+ }
86
+ composeMessage(lines, userMessage) {
87
+ if (lines.length === 0)
88
+ return `${this.userLabel}: ${userMessage}`;
89
+ return `${this.header}\n${lines.join('\n')}\n\n${this.userLabel}: ${userMessage}`;
90
+ }
91
+ async send(userMessage, options) {
92
+ if (this.sending) {
93
+ throw new Error('recordedChat.send: a turn is already in flight — one turn at a time; await the previous send');
94
+ }
95
+ this.sending = true;
96
+ try {
97
+ // Compose the message ONCE, at record time, from the frozen transcript
98
+ // (trap 2 — byte-exact history is threaded HERE and replayed verbatim).
99
+ const transcriptBefore = Object.freeze(this.entries.map((m) => this.renderLine(m)));
100
+ const message = this.composeMessage(transcriptBefore, userMessage);
101
+ const agent = await this.makeAgentFn({ specs: this.removedSpecs, seed: 0 });
102
+ const events = [];
103
+ // Attach the tap BEFORE run() — listener-presence gating drops events
104
+ // otherwise (agentfootprint invariant). Unsubscribe in finally.
105
+ const off = agent.on('*', (event) => {
106
+ events.push(event);
107
+ });
108
+ let out;
109
+ try {
110
+ const raw = await agent.run({
111
+ message,
112
+ ...(options?.identity !== undefined ? { identity: options.identity } : {}),
113
+ });
114
+ if (typeof raw !== 'string') {
115
+ throw new Error("recordedChat.send: the run paused (askHuman/checkIn) — recorded chat turns don't " +
116
+ 'support pauses; drive pausing agents with agent.run() directly');
117
+ }
118
+ out = raw;
119
+ }
120
+ finally {
121
+ off();
122
+ }
123
+ // Capture IMMEDIATELY (trap 1) — getLastSnapshot() is last-run-only, but
124
+ // the per-turn agent is discarded here, so clobbering is impossible.
125
+ const snapshot = agent.getLastSnapshot();
126
+ if (snapshot === undefined) {
127
+ throw new Error('recordedChat.send: the run produced no snapshot — cannot record the turn');
128
+ }
129
+ const lastLlmCallId = llmCallIdsFromEvents(events).at(-1);
130
+ const index = this.turnsInternal.length;
131
+ this.entries.push({ role: 'user', text: userMessage }, { role: 'assistant', text: out });
132
+ const turn = Object.freeze({
133
+ index,
134
+ userMessage,
135
+ reply: out,
136
+ message,
137
+ transcriptBefore,
138
+ artifacts: Object.freeze({ snapshot, events: Object.freeze(events) }),
139
+ lastLlmCallId,
140
+ identity: options?.identity,
141
+ });
142
+ this.turnsInternal.push(turn);
143
+ return turn;
144
+ }
145
+ finally {
146
+ this.sending = false;
147
+ }
148
+ }
149
+ turn(k) {
150
+ const n = this.turnsInternal.length;
151
+ if (!Number.isInteger(k) || k < 0 || k >= n) {
152
+ const range = n === 0 ? '(no turns recorded yet)' : `0..${n - 1}`;
153
+ throw new RangeError(`recordedChat.turn: no turn ${k} — valid range is ${range}`);
154
+ }
155
+ return this.turnsInternal[k];
156
+ }
157
+ async reason(k, options) {
158
+ const turn = this.turn(k);
159
+ const { fresh, atStep, ...rest } = options;
160
+ const memo = this.reports.get(k);
161
+ if (memo !== undefined && fresh !== true)
162
+ return memo;
163
+ const resolvedAtStep = atStep ?? turn.lastLlmCallId;
164
+ const report = await localizeContextBug({
165
+ ...rest,
166
+ artifacts: turn.artifacts,
167
+ ...(resolvedAtStep !== undefined ? { atStep: resolvedAtStep } : {}),
168
+ });
169
+ this.reports.set(k, report);
170
+ return report;
171
+ }
172
+ async rerunTurn(k, options) {
173
+ const turn = this.turn(k);
174
+ const { report: reportOption, ...rerunRest } = options;
175
+ let report = reportOption ?? this.reports.get(k);
176
+ if (report === undefined) {
177
+ report = await this.reason(k, { embedder: options.embedder });
178
+ }
179
+ // Derive the runner from the SAME factory (traps 2 + 3): the frozen
180
+ // message bytes are replayed verbatim, and the session's persistent
181
+ // removals ALWAYS apply on top of the probe's specs (empty specs = the
182
+ // baseline probe, which replays the identical turn).
183
+ const runner = async (specs, run) => {
184
+ const agent = await this.makeAgentFn({
185
+ specs: [...this.removedSpecs, ...specs],
186
+ seed: run.seed,
187
+ });
188
+ const out = await agent.run({
189
+ message: turn.message,
190
+ ...(turn.identity !== undefined ? { identity: turn.identity } : {}),
191
+ });
192
+ if (typeof out !== 'string') {
193
+ throw new Error('recordedChat.rerunTurn: a probe run paused (askHuman/checkIn) — recorded chat re-runs ' +
194
+ "don't support pauses");
195
+ }
196
+ return out;
197
+ };
198
+ const result = await rerunWithoutSources({
199
+ ...rerunRest,
200
+ report,
201
+ runner,
202
+ originalAnswer: turn.reply,
203
+ });
204
+ this.rerunOwner.set(result, k);
205
+ return result;
206
+ }
207
+ fork(k, options) {
208
+ const turn = this.turn(k);
209
+ const fromRerun = options?.fromRerun;
210
+ if (fromRerun !== undefined && this.rerunOwner.get(fromRerun) !== k) {
211
+ throw new Error(`recordedChat.fork: that result was not produced by this session's rerunTurn for turn ${k} — ` +
212
+ 're-run this turn first, then fork');
213
+ }
214
+ const reply = fromRerun?.answer ?? turn.reply;
215
+ const cut = this.seedMessages.length + 2 * k;
216
+ const seed = [
217
+ ...this.entries.slice(0, cut).map((m) => ({ ...m })),
218
+ { role: 'user', text: turn.userMessage },
219
+ { role: 'assistant', text: reply },
220
+ ];
221
+ const removed = dedupeSpecs([...this.removedSpecs, ...(fromRerun?.removed ?? [])]);
222
+ const child = new RecordedChatSession({
223
+ makeAgent: this.makeAgentFn,
224
+ ...(this.formatOpt !== undefined ? { format: this.formatOpt } : {}),
225
+ seed,
226
+ removed,
227
+ });
228
+ child.forkedFromValue = { parent: this, turnIndex: k, viaRerun: fromRerun !== undefined };
229
+ return child;
230
+ }
231
+ }
232
+ /**
233
+ * Record a chat turn-by-turn so any reply can be explained, counterfactually
234
+ * re-run, and forked — without re-writing the correctness-critical glue every
235
+ * chat host gets subtly wrong. See the [recordedChat guide](doc:recorded-chat).
236
+ */
237
+ export function recordedChat(options) {
238
+ return new RecordedChatSession(options);
239
+ }
240
+ //# sourceMappingURL=recordedChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordedChat.js","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/recordedChat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GAMpB,MAAM,4BAA4B,CAAC;AAepC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,kBAAkB,GAAG,M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,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YACpD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE;YACxC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE;SACnC,CAAC;QACF,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,SAAS,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEnF,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,WAAW;YAC3B,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnE,IAAI;YACJ,OAAO;SACR,CAAC,CAAC;QACH,KAAK,CAAC,eAAe,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1F,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * recorded-chat types — the session-scoped turn recorder over the existing
3
+ * context-bisect product loop (localizeContextBug + rerunWithoutSources +
4
+ * removableSources).
5
+ *
6
+ * WHY THIS EXISTS: multi-turn chat on agentfootprint is a HOST convention —
7
+ * `AgentInput` has no history field, so hosts thread the transcript into the
8
+ * `message` string themselves. Every chat host that wanted per-turn
9
+ * transparency then re-wrote the same correctness-critical glue and got three
10
+ * things subtly wrong:
11
+ *
12
+ * 1. `agent.getLastSnapshot()` is last-run-only — a second `run()` clobbers
13
+ * it, so reasoning about turn K after turn K+1 ran silently attributes
14
+ * the wrong run.
15
+ * 2. History is a convention — the transcript preamble must be BYTE-identical
16
+ * between the recorded turn and its counterfactual re-run, or the re-run
17
+ * ablates a subtly different scenario without failing anything.
18
+ * 3. The `AblationRunner` duplicates turn construction — the re-run is only
19
+ * valid if the rebuilt turn matches the recorded one (same system, facts,
20
+ * preamble).
21
+ *
22
+ * `recordedChat({ makeAgent })` owns exactly those three: per-turn artifact
23
+ * freezing (1), byte-exact history threading (2), and deriving the turn-K
24
+ * runner from the SAME `makeAgent` that ran the turn (3). It COMPOSES with the
25
+ * 7.5 surface — `reason()` calls `localizeContextBug`, `rerunTurn()` delegates
26
+ * to `rerunWithoutSources` and returns its result UNMODIFIED (the honesty
27
+ * tiers are not hidden). Session registries, UI joins, comparators and
28
+ * persistence stay host-side by design (see the guide's "What stays yours").
29
+ */
30
+ import type { RuntimeSnapshot } from 'footprintjs';
31
+ import type { Agent } from '../../core/Agent.js';
32
+ import type { MemoryIdentity } from '../../memory/identity/types.js';
33
+ import type { AblationSpec, CapturedEventLike, ContextBugReport, LocalizeContextBugOptions, RerunWithoutSourcesOptions, RerunWithoutSourcesResult } from '../context-bisect/index.js';
34
+ /**
35
+ * The ONE agent factory — live turns, rerun probes, baseline probes, and
36
+ * fork turns all go through it (the single source of truth the
37
+ * `AblationRunner` contract already demands).
38
+ *
39
+ * Contract (the `AblationRunner` contract, now enforced-by-shape for live
40
+ * turns too):
41
+ * - Return a FRESH agent with a FRESH provider on every call — scripted
42
+ * mock providers are stateful (replies consume in order).
43
+ * - Apply `specs` at CONSTRUCTION (the documented seam): filter facts /
44
+ * tools / memory entries with `applyAblations(specs, { ... })` before
45
+ * building. `specs` is ALWAYS the union of the session's persistent
46
+ * removals (forks carry these) and the probe's ablation specs; it is
47
+ * empty for a plain live turn in an unforked session.
48
+ * - `seed` varies 0..N-1 across a probe's samples (always 0 for live
49
+ * turns). Thread it into any stochastic knob; ignore it when the agent
50
+ * is deterministic.
51
+ */
52
+ export type MakeChatAgent = (build: {
53
+ readonly specs: readonly AblationSpec[];
54
+ readonly seed: number;
55
+ }) => Agent | Promise<Agent>;
56
+ /** How transcript lines and the per-turn message string are rendered. */
57
+ export interface ChatFormat {
58
+ /** Preamble header line. Default `'Recent conversation:'`. */
59
+ readonly header?: string;
60
+ /** Label for user lines (`'<userLabel>: ...'`). Default `'User'`. */
61
+ readonly userLabel?: string;
62
+ /** Label for reply lines. Default `'Assistant'`. */
63
+ readonly assistantLabel?: string;
64
+ }
65
+ /** One transcript entry — the structured form of a rendered line. */
66
+ export interface ChatMessage {
67
+ readonly role: 'user' | 'assistant';
68
+ readonly text: string;
69
+ }
70
+ export interface RecordedChatOptions {
71
+ readonly makeAgent: MakeChatAgent;
72
+ readonly format?: ChatFormat;
73
+ /**
74
+ * Transcript the session OPENS with (frozen; rendered as the seed
75
+ * preamble of every turn). `fork()` fills this; hosts may also pass a
76
+ * persisted transcript to rehydrate a session — authenticity of a
77
+ * hand-supplied seed is then the host's responsibility.
78
+ */
79
+ readonly seed?: readonly ChatMessage[];
80
+ /**
81
+ * Session-persistent removals: every turn (and every probe) in this
82
+ * session runs with these specs applied. `fork()` fills this so the
83
+ * what-if world STAYS the what-if world.
84
+ */
85
+ readonly removed?: readonly AblationSpec[];
86
+ }
87
+ /** One recorded turn — everything frozen at record time. */
88
+ export interface ChatTurn {
89
+ /** 0-based position in `turns`. */
90
+ readonly index: number;
91
+ readonly userMessage: string;
92
+ /** The agent's reply (agentfootprint `AgentOutput` string). */
93
+ readonly reply: string;
94
+ /**
95
+ * The EXACT message string `agent.run()` received — composed once at
96
+ * record time. Re-runs of this turn replay these bytes verbatim; the
97
+ * byte-exact-history guarantee lives here.
98
+ */
99
+ readonly message: string;
100
+ /** Rendered transcript lines the turn opened with (frozen copy). */
101
+ readonly transcriptBefore: readonly string[];
102
+ /**
103
+ * Localize-ready evidence: pass straight to
104
+ * `localizeContextBug({ artifacts: turn.artifacts, ... })`.
105
+ */
106
+ readonly artifacts: {
107
+ readonly snapshot: RuntimeSnapshot;
108
+ readonly events: readonly CapturedEventLike[];
109
+ };
110
+ /** runtimeStageId of the turn's LAST LLM call — the default `atStep`. */
111
+ readonly lastLlmCallId: string | undefined;
112
+ /** The identity `send()` was given, threaded into re-runs unchanged. */
113
+ readonly identity: MemoryIdentity | undefined;
114
+ }
115
+ export interface SendOptions {
116
+ /** Multi-tenant memory scope, passed through to `agent.run()`. */
117
+ readonly identity?: MemoryIdentity;
118
+ }
119
+ /** `reason(k)` options — localize passthrough minus what the turn provides. */
120
+ export interface ReasonOptions extends Omit<LocalizeContextBugOptions, 'artifacts' | 'rerun'> {
121
+ /** Recompute even if a memoized report exists (e.g. a new scorer). */
122
+ readonly fresh?: boolean;
123
+ }
124
+ /** `rerunTurn(k)` options — `rerunWithoutSources` minus what the turn provides. */
125
+ export interface RerunTurnOptions extends Omit<RerunWithoutSourcesOptions, 'report' | 'runner' | 'originalAnswer'> {
126
+ /**
127
+ * The report to resolve `ignore` against. Default: the turn's memoized
128
+ * `reason(k)` report (computed with this call's `embedder` + the default
129
+ * scorer if none exists yet).
130
+ */
131
+ readonly report?: ContextBugReport;
132
+ }
133
+ export interface ForkOptions {
134
+ /**
135
+ * Seed the fork's last reply with this counterfactual answer. MUST be a
136
+ * result produced by THIS session's `rerunTurn(k, ...)` for the SAME k
137
+ * (identity-checked) — a fabricated fork would be a lie. Omitted: the
138
+ * fork continues from the ORIGINAL reply (a plain branch, no ablation).
139
+ */
140
+ readonly fromRerun?: RerunWithoutSourcesResult;
141
+ }
142
+ export interface ForkOrigin {
143
+ readonly parent: RecordedChat;
144
+ readonly turnIndex: number;
145
+ /** True when the fork was seeded from a re-run's counterfactual answer. */
146
+ readonly viaRerun: boolean;
147
+ }
148
+ export interface RecordedChat {
149
+ /** Runs one recorded turn. One send at a time — concurrent sends throw. */
150
+ send(userMessage: string, options?: SendOptions): Promise<ChatTurn>;
151
+ /** Turn K's frozen record. Out-of-range throws (names the valid range). */
152
+ turn(k: number): ChatTurn;
153
+ readonly turns: readonly ChatTurn[];
154
+ /** The transcript the session opened with (forks / rehydration; else `[]`). */
155
+ readonly seed: readonly ChatMessage[];
156
+ /** The session's persistent removals (forks carry these; else `[]`). */
157
+ readonly removed: readonly AblationSpec[];
158
+ /** Set on sessions created by `fork()`; `undefined` otherwise. */
159
+ readonly forkedFrom: ForkOrigin | undefined;
160
+ /**
161
+ * Turn K's `ContextBugReport` (agentfootprint's, unmodified) via
162
+ * `localizeContextBug` over the frozen artifacts, `atStep` defaulted to
163
+ * the turn's last LLM call. Memoized per turn; `fresh: true` recomputes.
164
+ */
165
+ reason(k: number, options: ReasonOptions): Promise<ContextBugReport>;
166
+ /**
167
+ * Re-run turn K without the named sources — same recorded history bytes,
168
+ * same user message, minus the sources — delegating to
169
+ * `rerunWithoutSources` with a runner derived from `makeAgent`. Returns
170
+ * agentfootprint's `RerunWithoutSourcesResult` UNMODIFIED (a `verdict`
171
+ * only when `checkBaseline: true` — the honesty tiers are not hidden).
172
+ */
173
+ rerunTurn(k: number, options: RerunTurnOptions): Promise<RerunWithoutSourcesResult>;
174
+ /**
175
+ * Branch, never rewrite: a NEW `RecordedChat` (same `makeAgent`, same
176
+ * format) whose seed is the conversation through turn K with the reply
177
+ * swapped for the re-run's counterfactual answer (or kept, without
178
+ * `fromRerun`), and whose `removed` is this session's removals plus the
179
+ * re-run's `removed` specs. The original session is never touched.
180
+ */
181
+ fork(k: number, options?: ForkOptions): RecordedChat;
182
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * recorded-chat types — the session-scoped turn recorder over the existing
3
+ * context-bisect product loop (localizeContextBug + rerunWithoutSources +
4
+ * removableSources).
5
+ *
6
+ * WHY THIS EXISTS: multi-turn chat on agentfootprint is a HOST convention —
7
+ * `AgentInput` has no history field, so hosts thread the transcript into the
8
+ * `message` string themselves. Every chat host that wanted per-turn
9
+ * transparency then re-wrote the same correctness-critical glue and got three
10
+ * things subtly wrong:
11
+ *
12
+ * 1. `agent.getLastSnapshot()` is last-run-only — a second `run()` clobbers
13
+ * it, so reasoning about turn K after turn K+1 ran silently attributes
14
+ * the wrong run.
15
+ * 2. History is a convention — the transcript preamble must be BYTE-identical
16
+ * between the recorded turn and its counterfactual re-run, or the re-run
17
+ * ablates a subtly different scenario without failing anything.
18
+ * 3. The `AblationRunner` duplicates turn construction — the re-run is only
19
+ * valid if the rebuilt turn matches the recorded one (same system, facts,
20
+ * preamble).
21
+ *
22
+ * `recordedChat({ makeAgent })` owns exactly those three: per-turn artifact
23
+ * freezing (1), byte-exact history threading (2), and deriving the turn-K
24
+ * runner from the SAME `makeAgent` that ran the turn (3). It COMPOSES with the
25
+ * 7.5 surface — `reason()` calls `localizeContextBug`, `rerunTurn()` delegates
26
+ * to `rerunWithoutSources` and returns its result UNMODIFIED (the honesty
27
+ * tiers are not hidden). Session registries, UI joins, comparators and
28
+ * persistence stay host-side by design (see the guide's "What stays yours").
29
+ */
30
+ export {};
31
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * recorded-chat — the session-scoped turn recorder over the context-bisect
4
+ * product loop. Absorbs the three correctness traps every chat host re-writes
5
+ * (per-turn artifact freezing, byte-exact history threading, same-factory
6
+ * runner derivation) while COMPOSING with the 7.5 surface, not duplicating it.
7
+ *
8
+ * Exported from `agentfootprint/debug` (every symbol it composes with lives
9
+ * there). Named exports — `export *` is not the house style.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.recordedChat = void 0;
13
+ var recordedChat_js_1 = require("./recordedChat.js");
14
+ Object.defineProperty(exports, "recordedChat", { enumerable: true, get: function () { return recordedChat_js_1.recordedChat; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/recorded-chat/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,qDAAiD;AAAxC,+GAAA,YAAY,OAAA"}
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ /**
3
+ * recordedChat — the session-scoped turn recorder.
4
+ *
5
+ * `recordedChat({ makeAgent })` returns a `RecordedChat`: `send()` runs one
6
+ * recorded turn through the consumer's agent factory and freezes that turn's
7
+ * evidence immediately; `reason(k)` / `rerunTurn(k)` / `fork(k)` are the
8
+ * per-turn transparency loop, composing with the existing context-bisect
9
+ * surface (`localizeContextBug`, `rerunWithoutSources`) rather than
10
+ * duplicating it. See `./types.ts` for the three traps this owns.
11
+ *
12
+ * Compose-don't-inherit house style: a module-private session class,
13
+ * factory-returned; no base classes.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.recordedChat = void 0;
17
+ const index_js_1 = require("../context-bisect/index.js");
18
+ const DEFAULT_HEADER = 'Recent conversation:';
19
+ const DEFAULT_USER_LABEL = 'User';
20
+ const DEFAULT_ASSISTANT_LABEL = 'Assistant';
21
+ /** Deterministic key for spec dedup — recursively sorts object keys. */
22
+ function canonicalKey(value) {
23
+ return JSON.stringify(value, (_key, val) => {
24
+ if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
25
+ const sorted = {};
26
+ for (const k of Object.keys(val).sort()) {
27
+ sorted[k] = val[k];
28
+ }
29
+ return sorted;
30
+ }
31
+ return val;
32
+ });
33
+ }
34
+ /** Union of ablation specs, deduped by canonical JSON (order-preserving, first wins). */
35
+ function dedupeSpecs(specs) {
36
+ const seen = new Set();
37
+ const out = [];
38
+ for (const spec of specs) {
39
+ const key = canonicalKey(spec);
40
+ if (seen.has(key))
41
+ continue;
42
+ seen.add(key);
43
+ out.push(spec);
44
+ }
45
+ return out;
46
+ }
47
+ class RecordedChatSession {
48
+ makeAgentFn;
49
+ formatOpt;
50
+ header;
51
+ userLabel;
52
+ assistantLabel;
53
+ /** seed + one (user, assistant) pair per recorded turn. */
54
+ entries;
55
+ seedMessages;
56
+ removedSpecs;
57
+ turnsInternal = [];
58
+ reports = new Map();
59
+ /** result -> turnIndex, the in-process fork-provenance guard. */
60
+ rerunOwner = new WeakMap();
61
+ sending = false;
62
+ forkedFromValue = undefined;
63
+ constructor(options) {
64
+ this.makeAgentFn = options.makeAgent;
65
+ this.formatOpt = options.format;
66
+ this.header = options.format?.header ?? DEFAULT_HEADER;
67
+ this.userLabel = options.format?.userLabel ?? DEFAULT_USER_LABEL;
68
+ this.assistantLabel = options.format?.assistantLabel ?? DEFAULT_ASSISTANT_LABEL;
69
+ this.seedMessages = Object.freeze((options.seed ?? []).map((m) => ({ ...m })));
70
+ this.entries = [...this.seedMessages];
71
+ this.removedSpecs = Object.freeze([...(options.removed ?? [])]);
72
+ }
73
+ get turns() {
74
+ return this.turnsInternal;
75
+ }
76
+ get seed() {
77
+ return this.seedMessages;
78
+ }
79
+ get removed() {
80
+ return this.removedSpecs;
81
+ }
82
+ get forkedFrom() {
83
+ return this.forkedFromValue;
84
+ }
85
+ renderLine(message) {
86
+ const label = message.role === 'user' ? this.userLabel : this.assistantLabel;
87
+ return `${label}: ${message.text}`;
88
+ }
89
+ composeMessage(lines, userMessage) {
90
+ if (lines.length === 0)
91
+ return `${this.userLabel}: ${userMessage}`;
92
+ return `${this.header}\n${lines.join('\n')}\n\n${this.userLabel}: ${userMessage}`;
93
+ }
94
+ async send(userMessage, options) {
95
+ if (this.sending) {
96
+ throw new Error('recordedChat.send: a turn is already in flight — one turn at a time; await the previous send');
97
+ }
98
+ this.sending = true;
99
+ try {
100
+ // Compose the message ONCE, at record time, from the frozen transcript
101
+ // (trap 2 — byte-exact history is threaded HERE and replayed verbatim).
102
+ const transcriptBefore = Object.freeze(this.entries.map((m) => this.renderLine(m)));
103
+ const message = this.composeMessage(transcriptBefore, userMessage);
104
+ const agent = await this.makeAgentFn({ specs: this.removedSpecs, seed: 0 });
105
+ const events = [];
106
+ // Attach the tap BEFORE run() — listener-presence gating drops events
107
+ // otherwise (agentfootprint invariant). Unsubscribe in finally.
108
+ const off = agent.on('*', (event) => {
109
+ events.push(event);
110
+ });
111
+ let out;
112
+ try {
113
+ const raw = await agent.run({
114
+ message,
115
+ ...(options?.identity !== undefined ? { identity: options.identity } : {}),
116
+ });
117
+ if (typeof raw !== 'string') {
118
+ throw new Error("recordedChat.send: the run paused (askHuman/checkIn) — recorded chat turns don't " +
119
+ 'support pauses; drive pausing agents with agent.run() directly');
120
+ }
121
+ out = raw;
122
+ }
123
+ finally {
124
+ off();
125
+ }
126
+ // Capture IMMEDIATELY (trap 1) — getLastSnapshot() is last-run-only, but
127
+ // the per-turn agent is discarded here, so clobbering is impossible.
128
+ const snapshot = agent.getLastSnapshot();
129
+ if (snapshot === undefined) {
130
+ throw new Error('recordedChat.send: the run produced no snapshot — cannot record the turn');
131
+ }
132
+ const lastLlmCallId = (0, index_js_1.llmCallIdsFromEvents)(events).at(-1);
133
+ const index = this.turnsInternal.length;
134
+ this.entries.push({ role: 'user', text: userMessage }, { role: 'assistant', text: out });
135
+ const turn = Object.freeze({
136
+ index,
137
+ userMessage,
138
+ reply: out,
139
+ message,
140
+ transcriptBefore,
141
+ artifacts: Object.freeze({ snapshot, events: Object.freeze(events) }),
142
+ lastLlmCallId,
143
+ identity: options?.identity,
144
+ });
145
+ this.turnsInternal.push(turn);
146
+ return turn;
147
+ }
148
+ finally {
149
+ this.sending = false;
150
+ }
151
+ }
152
+ turn(k) {
153
+ const n = this.turnsInternal.length;
154
+ if (!Number.isInteger(k) || k < 0 || k >= n) {
155
+ const range = n === 0 ? '(no turns recorded yet)' : `0..${n - 1}`;
156
+ throw new RangeError(`recordedChat.turn: no turn ${k} — valid range is ${range}`);
157
+ }
158
+ return this.turnsInternal[k];
159
+ }
160
+ async reason(k, options) {
161
+ const turn = this.turn(k);
162
+ const { fresh, atStep, ...rest } = options;
163
+ const memo = this.reports.get(k);
164
+ if (memo !== undefined && fresh !== true)
165
+ return memo;
166
+ const resolvedAtStep = atStep ?? turn.lastLlmCallId;
167
+ const report = await (0, index_js_1.localizeContextBug)({
168
+ ...rest,
169
+ artifacts: turn.artifacts,
170
+ ...(resolvedAtStep !== undefined ? { atStep: resolvedAtStep } : {}),
171
+ });
172
+ this.reports.set(k, report);
173
+ return report;
174
+ }
175
+ async rerunTurn(k, options) {
176
+ const turn = this.turn(k);
177
+ const { report: reportOption, ...rerunRest } = options;
178
+ let report = reportOption ?? this.reports.get(k);
179
+ if (report === undefined) {
180
+ report = await this.reason(k, { embedder: options.embedder });
181
+ }
182
+ // Derive the runner from the SAME factory (traps 2 + 3): the frozen
183
+ // message bytes are replayed verbatim, and the session's persistent
184
+ // removals ALWAYS apply on top of the probe's specs (empty specs = the
185
+ // baseline probe, which replays the identical turn).
186
+ const runner = async (specs, run) => {
187
+ const agent = await this.makeAgentFn({
188
+ specs: [...this.removedSpecs, ...specs],
189
+ seed: run.seed,
190
+ });
191
+ const out = await agent.run({
192
+ message: turn.message,
193
+ ...(turn.identity !== undefined ? { identity: turn.identity } : {}),
194
+ });
195
+ if (typeof out !== 'string') {
196
+ throw new Error('recordedChat.rerunTurn: a probe run paused (askHuman/checkIn) — recorded chat re-runs ' +
197
+ "don't support pauses");
198
+ }
199
+ return out;
200
+ };
201
+ const result = await (0, index_js_1.rerunWithoutSources)({
202
+ ...rerunRest,
203
+ report,
204
+ runner,
205
+ originalAnswer: turn.reply,
206
+ });
207
+ this.rerunOwner.set(result, k);
208
+ return result;
209
+ }
210
+ fork(k, options) {
211
+ const turn = this.turn(k);
212
+ const fromRerun = options?.fromRerun;
213
+ if (fromRerun !== undefined && this.rerunOwner.get(fromRerun) !== k) {
214
+ throw new Error(`recordedChat.fork: that result was not produced by this session's rerunTurn for turn ${k} — ` +
215
+ 're-run this turn first, then fork');
216
+ }
217
+ const reply = fromRerun?.answer ?? turn.reply;
218
+ const cut = this.seedMessages.length + 2 * k;
219
+ const seed = [
220
+ ...this.entries.slice(0, cut).map((m) => ({ ...m })),
221
+ { role: 'user', text: turn.userMessage },
222
+ { role: 'assistant', text: reply },
223
+ ];
224
+ const removed = dedupeSpecs([...this.removedSpecs, ...(fromRerun?.removed ?? [])]);
225
+ const child = new RecordedChatSession({
226
+ makeAgent: this.makeAgentFn,
227
+ ...(this.formatOpt !== undefined ? { format: this.formatOpt } : {}),
228
+ seed,
229
+ removed,
230
+ });
231
+ child.forkedFromValue = { parent: this, turnIndex: k, viaRerun: fromRerun !== undefined };
232
+ return child;
233
+ }
234
+ }
235
+ /**
236
+ * Record a chat turn-by-turn so any reply can be explained, counterfactually
237
+ * re-run, and forked — without re-writing the correctness-critical glue every
238
+ * chat host gets subtly wrong. See the [recordedChat guide](doc:recorded-chat).
239
+ */
240
+ function recordedChat(options) {
241
+ return new RecordedChatSession(options);
242
+ }
243
+ exports.recordedChat = recordedChat;
244
+ //# sourceMappingURL=recordedChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordedChat.js","sourceRoot":"","sources":["../../../src/lib/recorded-chat/recordedChat.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAGH,yDASoC;AAepC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAE5C,wEAAwE;AACxE,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACzC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACnE,MAAM,MAAM,GAA4B,EAAE,CAAC;YAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAA8B,CAAC,CAAC,IAAI,EAA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I,CAAC,WAAW;YAC3B,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnE,IAAI;YACJ,OAAO;SACR,CAAC,CAAC;QACH,KAAK,CAAC,eAAe,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1F,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,OAA4B;IACvD,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC;AAFD,oCAEC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * recorded-chat types — the session-scoped turn recorder over the existing
4
+ * context-bisect product loop (localizeContextBug + rerunWithoutSources +
5
+ * removableSources).
6
+ *
7
+ * WHY THIS EXISTS: multi-turn chat on agentfootprint is a HOST convention —
8
+ * `AgentInput` has no history field, so hosts thread the transcript into the
9
+ * `message` string themselves. Every chat host that wanted per-turn
10
+ * transparency then re-wrote the same correctness-critical glue and got three
11
+ * things subtly wrong:
12
+ *
13
+ * 1. `agent.getLastSnapshot()` is last-run-only — a second `run()` clobbers
14
+ * it, so reasoning about turn K after turn K+1 ran silently attributes
15
+ * the wrong run.
16
+ * 2. History is a convention — the transcript preamble must be BYTE-identical
17
+ * between the recorded turn and its counterfactual re-run, or the re-run
18
+ * ablates a subtly different scenario without failing anything.
19
+ * 3. The `AblationRunner` duplicates turn construction — the re-run is only
20
+ * valid if the rebuilt turn matches the recorded one (same system, facts,
21
+ * preamble).
22
+ *
23
+ * `recordedChat({ makeAgent })` owns exactly those three: per-turn artifact
24
+ * freezing (1), byte-exact history threading (2), and deriving the turn-K
25
+ * runner from the SAME `makeAgent` that ran the turn (3). It COMPOSES with the
26
+ * 7.5 surface — `reason()` calls `localizeContextBug`, `rerunTurn()` delegates
27
+ * to `rerunWithoutSources` and returns its result UNMODIFIED (the honesty
28
+ * tiers are not hidden). Session registries, UI joins, comparators and
29
+ * persistence stay host-side by design (see the guide's "What stays yours").
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/recorded-chat/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG"}
@@ -23,4 +23,5 @@ export { buildSelfExplainSkill, buildSelfExplainToolProvider, SelfExplainBinding
23
23
  export { ablationForSuspect, applyAblations, assembleTrajectory, assignCostVerdicts, bisectCulprits, bucketByAnchors, shortlistEarlyCulprits, walkToRoot, walkTrajectory, buildWriterFrameIndex, DEFAULT_RECENCY_DECAY, classifySuspect, findLoopHeads, CONTEXT_BISECT_DEFAULTS, defaultOutcomeComparator, defaultSuspectClassifier, findDroppedContext, formatContextBugReport, llmCallIdsFromEvents, llmEdgeWeigher, localizeContextBug, probeFlipped, removableSources, rerunWithoutSources, runAblationProbe, runRestorationProbe, stepOutputText, suspectLabel, verdictFor, type AblationRerun, type AblationRunner, type AblationRunStats, type AblationSpec, type AblationTargets, type AblationVerdict, type AblationVerdictKind, type AnchorBucket, type AssembleTrajectoryOptions, type LoopCandidate, type LoopRecallShortlist, type ShortlistEarlyCulpritsOptions, type RootCauseHop, type RootCauseNote, type RootCausePath, type WalkToRootOptions, type BisectCulpritsOptions, type BisectionProbe, type BisectionResult, type CapturedEventLike, type ClassifyContext, type ContextBugArtifacts, type ContextBugReport, type ContextSource, type ContextUnit, type CostRange, type CostStats, type CostVerdict, type DroppedUnit, type EdgePathStep, type LoopFrame, type HonestyFlag, type HonestyFlagKind, type IgnoredSource, type LlmEdgeWeigherHandle, type LlmEdgeWeigherOptions, type LocalizeContextBugOptions, type MissingContextResult, type OutcomeComparator, type QualityTriggerLookup, type RankedParentEdge, type RemovableSource, type RerunWithoutSourcesOptions, type RerunWithoutSourcesResult, type RestorationProbeConfig, type RestorationRerun, type RestorationRunner, type RestoredCandidate, type RunCost, type SimilarityStats, type SliceStats, type Suspect, type SuspectClass, type SuspectClassifier, type SuspectDetail, type SuspectKind, type SuspectSeed, type SyntheticQuestionNode, type Trajectory, type WhatChanged, } from './lib/context-bisect/index.js';
24
24
  export { sliceToBacktrackTrace, toBacktrackTrace, type BacktrackCustodyHop, type BacktrackHop, type BacktrackSuspectCard, type BacktrackTrace, type BacktrackTrail, type SliceToBacktrackTraceOptions, type ToBacktrackTraceOptions, } from './lib/context-bisect/index.js';
25
25
  export { analyzeToolCatalog, catalogFromTools, coerceCatalog, confusabilityText, DEFAULT_CONFUSABILITY_THRESHOLD, DEFAULT_OMISSION_CUES, DEFAULT_WATCH_BAND, DEFAULT_WHEN_CUES, defaultStructuralRules, descriptionRule, differentiationHint, enumInProseRule, formatToolCatalogReport, MOCK_EMBEDDER_CALIBRATION, optionalParamRule, runToolLintCli, saysWhatNotWhenRule, type AnalyzeToolCatalogOptions, type CatalogTool, type ConfusablePairFinding, type DescriptionRuleOptions, type FormatReportOptions, type LintRule, type LintSeverity, type OptionalParamRuleOptions, type PairVerdict, type SaysWhatNotWhenRuleOptions, type SimilarityReport, type StructuralFinding, type ToolCatalogReport, type ToolLintCliIO, } from './lib/tool-lint/index.js';
26
+ export { recordedChat, type ChatFormat, type ChatMessage, type ChatTurn, type ForkOptions, type ForkOrigin, type MakeChatAgent, type ReasonOptions, type RecordedChat, type RecordedChatOptions, type RerunTurnOptions, type SendOptions, } from './lib/recorded-chat/index.js';
26
27
  //# sourceMappingURL=debug.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd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W,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * recorded-chat — the session-scoped turn recorder over the context-bisect
3
+ * product loop. Absorbs the three correctness traps every chat host re-writes
4
+ * (per-turn artifact freezing, byte-exact history threading, same-factory
5
+ * runner derivation) while COMPOSING with the 7.5 surface, not duplicating it.
6
+ *
7
+ * Exported from `agentfootprint/debug` (every symbol it composes with lives
8
+ * there). Named exports — `export *` is not the house style.
9
+ */
10
+ export { recordedChat } from './recordedChat.js';
11
+ export type { ChatFormat, ChatMessage, ChatTurn, ForkOptions, ForkOrigin, MakeChatAgent, ReasonOptions, RecordedChat, RecordedChatOptions, RerunTurnOptions, SendOptions, } from './types.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * recordedChat — the session-scoped turn recorder.
3
+ *
4
+ * `recordedChat({ makeAgent })` returns a `RecordedChat`: `send()` runs one
5
+ * recorded turn through the consumer's agent factory and freezes that turn's
6
+ * evidence immediately; `reason(k)` / `rerunTurn(k)` / `fork(k)` are the
7
+ * per-turn transparency loop, composing with the existing context-bisect
8
+ * surface (`localizeContextBug`, `rerunWithoutSources`) rather than
9
+ * duplicating it. See `./types.ts` for the three traps this owns.
10
+ *
11
+ * Compose-don't-inherit house style: a module-private session class,
12
+ * factory-returned; no base classes.
13
+ */
14
+ import type { RecordedChat, RecordedChatOptions } from './types.js';
15
+ /**
16
+ * Record a chat turn-by-turn so any reply can be explained, counterfactually
17
+ * re-run, and forked — without re-writing the correctness-critical glue every
18
+ * chat host gets subtly wrong. See the [recordedChat guide](doc:recorded-chat).
19
+ */
20
+ export declare function recordedChat(options: RecordedChatOptions): RecordedChat;
21
+ //# sourceMappingURL=recordedChat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordedChat.d.ts","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/recordedChat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,OAAO,KAAK,EAQV,YAAY,EACZ,mBAAmB,EAGpB,MAAM,YAAY,CAAC;AAwPpB;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAEvE"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * recorded-chat types — the session-scoped turn recorder over the existing
3
+ * context-bisect product loop (localizeContextBug + rerunWithoutSources +
4
+ * removableSources).
5
+ *
6
+ * WHY THIS EXISTS: multi-turn chat on agentfootprint is a HOST convention —
7
+ * `AgentInput` has no history field, so hosts thread the transcript into the
8
+ * `message` string themselves. Every chat host that wanted per-turn
9
+ * transparency then re-wrote the same correctness-critical glue and got three
10
+ * things subtly wrong:
11
+ *
12
+ * 1. `agent.getLastSnapshot()` is last-run-only — a second `run()` clobbers
13
+ * it, so reasoning about turn K after turn K+1 ran silently attributes
14
+ * the wrong run.
15
+ * 2. History is a convention — the transcript preamble must be BYTE-identical
16
+ * between the recorded turn and its counterfactual re-run, or the re-run
17
+ * ablates a subtly different scenario without failing anything.
18
+ * 3. The `AblationRunner` duplicates turn construction — the re-run is only
19
+ * valid if the rebuilt turn matches the recorded one (same system, facts,
20
+ * preamble).
21
+ *
22
+ * `recordedChat({ makeAgent })` owns exactly those three: per-turn artifact
23
+ * freezing (1), byte-exact history threading (2), and deriving the turn-K
24
+ * runner from the SAME `makeAgent` that ran the turn (3). It COMPOSES with the
25
+ * 7.5 surface — `reason()` calls `localizeContextBug`, `rerunTurn()` delegates
26
+ * to `rerunWithoutSources` and returns its result UNMODIFIED (the honesty
27
+ * tiers are not hidden). Session registries, UI joins, comparators and
28
+ * persistence stay host-side by design (see the guide's "What stays yours").
29
+ */
30
+ import type { RuntimeSnapshot } from 'footprintjs';
31
+ import type { Agent } from '../../core/Agent.js';
32
+ import type { MemoryIdentity } from '../../memory/identity/types.js';
33
+ import type { AblationSpec, CapturedEventLike, ContextBugReport, LocalizeContextBugOptions, RerunWithoutSourcesOptions, RerunWithoutSourcesResult } from '../context-bisect/index.js';
34
+ /**
35
+ * The ONE agent factory — live turns, rerun probes, baseline probes, and
36
+ * fork turns all go through it (the single source of truth the
37
+ * `AblationRunner` contract already demands).
38
+ *
39
+ * Contract (the `AblationRunner` contract, now enforced-by-shape for live
40
+ * turns too):
41
+ * - Return a FRESH agent with a FRESH provider on every call — scripted
42
+ * mock providers are stateful (replies consume in order).
43
+ * - Apply `specs` at CONSTRUCTION (the documented seam): filter facts /
44
+ * tools / memory entries with `applyAblations(specs, { ... })` before
45
+ * building. `specs` is ALWAYS the union of the session's persistent
46
+ * removals (forks carry these) and the probe's ablation specs; it is
47
+ * empty for a plain live turn in an unforked session.
48
+ * - `seed` varies 0..N-1 across a probe's samples (always 0 for live
49
+ * turns). Thread it into any stochastic knob; ignore it when the agent
50
+ * is deterministic.
51
+ */
52
+ export type MakeChatAgent = (build: {
53
+ readonly specs: readonly AblationSpec[];
54
+ readonly seed: number;
55
+ }) => Agent | Promise<Agent>;
56
+ /** How transcript lines and the per-turn message string are rendered. */
57
+ export interface ChatFormat {
58
+ /** Preamble header line. Default `'Recent conversation:'`. */
59
+ readonly header?: string;
60
+ /** Label for user lines (`'<userLabel>: ...'`). Default `'User'`. */
61
+ readonly userLabel?: string;
62
+ /** Label for reply lines. Default `'Assistant'`. */
63
+ readonly assistantLabel?: string;
64
+ }
65
+ /** One transcript entry — the structured form of a rendered line. */
66
+ export interface ChatMessage {
67
+ readonly role: 'user' | 'assistant';
68
+ readonly text: string;
69
+ }
70
+ export interface RecordedChatOptions {
71
+ readonly makeAgent: MakeChatAgent;
72
+ readonly format?: ChatFormat;
73
+ /**
74
+ * Transcript the session OPENS with (frozen; rendered as the seed
75
+ * preamble of every turn). `fork()` fills this; hosts may also pass a
76
+ * persisted transcript to rehydrate a session — authenticity of a
77
+ * hand-supplied seed is then the host's responsibility.
78
+ */
79
+ readonly seed?: readonly ChatMessage[];
80
+ /**
81
+ * Session-persistent removals: every turn (and every probe) in this
82
+ * session runs with these specs applied. `fork()` fills this so the
83
+ * what-if world STAYS the what-if world.
84
+ */
85
+ readonly removed?: readonly AblationSpec[];
86
+ }
87
+ /** One recorded turn — everything frozen at record time. */
88
+ export interface ChatTurn {
89
+ /** 0-based position in `turns`. */
90
+ readonly index: number;
91
+ readonly userMessage: string;
92
+ /** The agent's reply (agentfootprint `AgentOutput` string). */
93
+ readonly reply: string;
94
+ /**
95
+ * The EXACT message string `agent.run()` received — composed once at
96
+ * record time. Re-runs of this turn replay these bytes verbatim; the
97
+ * byte-exact-history guarantee lives here.
98
+ */
99
+ readonly message: string;
100
+ /** Rendered transcript lines the turn opened with (frozen copy). */
101
+ readonly transcriptBefore: readonly string[];
102
+ /**
103
+ * Localize-ready evidence: pass straight to
104
+ * `localizeContextBug({ artifacts: turn.artifacts, ... })`.
105
+ */
106
+ readonly artifacts: {
107
+ readonly snapshot: RuntimeSnapshot;
108
+ readonly events: readonly CapturedEventLike[];
109
+ };
110
+ /** runtimeStageId of the turn's LAST LLM call — the default `atStep`. */
111
+ readonly lastLlmCallId: string | undefined;
112
+ /** The identity `send()` was given, threaded into re-runs unchanged. */
113
+ readonly identity: MemoryIdentity | undefined;
114
+ }
115
+ export interface SendOptions {
116
+ /** Multi-tenant memory scope, passed through to `agent.run()`. */
117
+ readonly identity?: MemoryIdentity;
118
+ }
119
+ /** `reason(k)` options — localize passthrough minus what the turn provides. */
120
+ export interface ReasonOptions extends Omit<LocalizeContextBugOptions, 'artifacts' | 'rerun'> {
121
+ /** Recompute even if a memoized report exists (e.g. a new scorer). */
122
+ readonly fresh?: boolean;
123
+ }
124
+ /** `rerunTurn(k)` options — `rerunWithoutSources` minus what the turn provides. */
125
+ export interface RerunTurnOptions extends Omit<RerunWithoutSourcesOptions, 'report' | 'runner' | 'originalAnswer'> {
126
+ /**
127
+ * The report to resolve `ignore` against. Default: the turn's memoized
128
+ * `reason(k)` report (computed with this call's `embedder` + the default
129
+ * scorer if none exists yet).
130
+ */
131
+ readonly report?: ContextBugReport;
132
+ }
133
+ export interface ForkOptions {
134
+ /**
135
+ * Seed the fork's last reply with this counterfactual answer. MUST be a
136
+ * result produced by THIS session's `rerunTurn(k, ...)` for the SAME k
137
+ * (identity-checked) — a fabricated fork would be a lie. Omitted: the
138
+ * fork continues from the ORIGINAL reply (a plain branch, no ablation).
139
+ */
140
+ readonly fromRerun?: RerunWithoutSourcesResult;
141
+ }
142
+ export interface ForkOrigin {
143
+ readonly parent: RecordedChat;
144
+ readonly turnIndex: number;
145
+ /** True when the fork was seeded from a re-run's counterfactual answer. */
146
+ readonly viaRerun: boolean;
147
+ }
148
+ export interface RecordedChat {
149
+ /** Runs one recorded turn. One send at a time — concurrent sends throw. */
150
+ send(userMessage: string, options?: SendOptions): Promise<ChatTurn>;
151
+ /** Turn K's frozen record. Out-of-range throws (names the valid range). */
152
+ turn(k: number): ChatTurn;
153
+ readonly turns: readonly ChatTurn[];
154
+ /** The transcript the session opened with (forks / rehydration; else `[]`). */
155
+ readonly seed: readonly ChatMessage[];
156
+ /** The session's persistent removals (forks carry these; else `[]`). */
157
+ readonly removed: readonly AblationSpec[];
158
+ /** Set on sessions created by `fork()`; `undefined` otherwise. */
159
+ readonly forkedFrom: ForkOrigin | undefined;
160
+ /**
161
+ * Turn K's `ContextBugReport` (agentfootprint's, unmodified) via
162
+ * `localizeContextBug` over the frozen artifacts, `atStep` defaulted to
163
+ * the turn's last LLM call. Memoized per turn; `fresh: true` recomputes.
164
+ */
165
+ reason(k: number, options: ReasonOptions): Promise<ContextBugReport>;
166
+ /**
167
+ * Re-run turn K without the named sources — same recorded history bytes,
168
+ * same user message, minus the sources — delegating to
169
+ * `rerunWithoutSources` with a runner derived from `makeAgent`. Returns
170
+ * agentfootprint's `RerunWithoutSourcesResult` UNMODIFIED (a `verdict`
171
+ * only when `checkBaseline: true` — the honesty tiers are not hidden).
172
+ */
173
+ rerunTurn(k: number, options: RerunTurnOptions): Promise<RerunWithoutSourcesResult>;
174
+ /**
175
+ * Branch, never rewrite: a NEW `RecordedChat` (same `makeAgent`, same
176
+ * format) whose seed is the conversation through turn K with the reply
177
+ * swapped for the re-run's counterfactual answer (or kept, without
178
+ * `fromRerun`), and whose `removed` is this session's removals plus the
179
+ * re-run's `removed` specs. The original session is never touched.
180
+ */
181
+ fork(k: number, options?: ForkOptions): RecordedChat;
182
+ }
183
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/recorded-chat/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,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IACpC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IAC5C;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrE;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACpF;;;;;;OAMG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;CACtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "7.5.0",
3
+ "version": "7.6.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
  "author": "Sanjay Krishna Anbalagan",