agentfootprint 11.0.0 → 11.1.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/CAPABILITIES.md +2 -0
- package/dist/debug.js +5 -3
- package/dist/debug.js.map +1 -1
- package/dist/esm/debug.d.ts +1 -1
- package/dist/esm/debug.js +1 -1
- package/dist/esm/debug.js.map +1 -1
- package/dist/esm/lib/boundedJson.d.ts +1 -1
- package/dist/esm/lib/boundedJson.js +4 -2
- package/dist/esm/lib/boundedJson.js.map +1 -1
- package/dist/esm/trace-toolpack/causeCapture.d.ts +5 -2
- package/dist/esm/trace-toolpack/causeCapture.js +32 -18
- package/dist/esm/trace-toolpack/causeCapture.js.map +1 -1
- package/dist/esm/trace-toolpack/causeContext.d.ts +14 -0
- package/dist/esm/trace-toolpack/causeContext.js +14 -0
- package/dist/esm/trace-toolpack/causeContext.js.map +1 -0
- package/dist/esm/trace-toolpack/causeProjection.d.ts +17 -0
- package/dist/esm/trace-toolpack/causeProjection.js +72 -0
- package/dist/esm/trace-toolpack/causeProjection.js.map +1 -0
- package/dist/esm/trace-toolpack/causeReader.d.ts +2 -3
- package/dist/esm/trace-toolpack/causeReader.js +21 -13
- package/dist/esm/trace-toolpack/causeReader.js.map +1 -1
- package/dist/esm/trace-toolpack/causeResponse.d.ts +5 -2
- package/dist/esm/trace-toolpack/causeResponse.js +26 -9
- package/dist/esm/trace-toolpack/causeResponse.js.map +1 -1
- package/dist/esm/trace-toolpack/causeSnapshot.d.ts +2 -8
- package/dist/esm/trace-toolpack/causeSnapshot.js +3 -63
- package/dist/esm/trace-toolpack/causeSnapshot.js.map +1 -1
- package/dist/esm/trace-toolpack/causeTools.d.ts +8 -1
- package/dist/esm/trace-toolpack/causeTools.js +33 -10
- package/dist/esm/trace-toolpack/causeTools.js.map +1 -1
- package/dist/esm/trace-toolpack/index.d.ts +3 -0
- package/dist/esm/trace-toolpack/index.js +2 -0
- package/dist/esm/trace-toolpack/index.js.map +1 -1
- package/dist/esm/trace-toolpack/storedCause.d.ts +8 -0
- package/dist/esm/trace-toolpack/storedCause.js +58 -0
- package/dist/esm/trace-toolpack/storedCause.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.d.ts +16 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.js +50 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.d.ts +5 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.js +53 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.d.ts +3 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.js +117 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseReader.d.ts +3 -0
- package/dist/esm/trace-toolpack/storedCauseReader.js +9 -0
- package/dist/esm/trace-toolpack/storedCauseReader.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseSources.d.ts +8 -0
- package/dist/esm/trace-toolpack/storedCauseSources.js +28 -0
- package/dist/esm/trace-toolpack/storedCauseSources.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.d.ts +48 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.js +2 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.js.map +1 -0
- package/dist/esm/trace-toolpack/traceToolpack.js +18 -0
- package/dist/esm/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/lib/boundedJson.js +4 -2
- package/dist/lib/boundedJson.js.map +1 -1
- package/dist/trace-toolpack/causeCapture.js +35 -20
- package/dist/trace-toolpack/causeCapture.js.map +1 -1
- package/dist/trace-toolpack/causeContext.js +18 -0
- package/dist/trace-toolpack/causeContext.js.map +1 -0
- package/dist/trace-toolpack/causeProjection.js +76 -0
- package/dist/trace-toolpack/causeProjection.js.map +1 -0
- package/dist/trace-toolpack/causeReader.js +21 -13
- package/dist/trace-toolpack/causeReader.js.map +1 -1
- package/dist/trace-toolpack/causeResponse.js +26 -9
- package/dist/trace-toolpack/causeResponse.js.map +1 -1
- package/dist/trace-toolpack/causeSnapshot.js +3 -63
- package/dist/trace-toolpack/causeSnapshot.js.map +1 -1
- package/dist/trace-toolpack/causeTools.js +36 -12
- package/dist/trace-toolpack/causeTools.js.map +1 -1
- package/dist/trace-toolpack/index.js +5 -1
- package/dist/trace-toolpack/index.js.map +1 -1
- package/dist/trace-toolpack/storedCause.js +85 -0
- package/dist/trace-toolpack/storedCause.js.map +1 -0
- package/dist/trace-toolpack/storedCauseBinding.js +55 -0
- package/dist/trace-toolpack/storedCauseBinding.js.map +1 -0
- package/dist/trace-toolpack/storedCauseOptions.js +58 -0
- package/dist/trace-toolpack/storedCauseOptions.js.map +1 -0
- package/dist/trace-toolpack/storedCauseProjection.js +121 -0
- package/dist/trace-toolpack/storedCauseProjection.js.map +1 -0
- package/dist/trace-toolpack/storedCauseReader.js +35 -0
- package/dist/trace-toolpack/storedCauseReader.js.map +1 -0
- package/dist/trace-toolpack/storedCauseSources.js +32 -0
- package/dist/trace-toolpack/storedCauseSources.js.map +1 -0
- package/dist/trace-toolpack/storedCauseTypes.js +3 -0
- package/dist/trace-toolpack/storedCauseTypes.js.map +1 -0
- package/dist/trace-toolpack/traceToolpack.js +18 -0
- package/dist/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/types/debug.d.ts +1 -1
- package/dist/types/debug.d.ts.map +1 -1
- package/dist/types/lib/boundedJson.d.ts +1 -1
- package/dist/types/lib/boundedJson.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeCapture.d.ts +5 -2
- package/dist/types/trace-toolpack/causeCapture.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeContext.d.ts +15 -0
- package/dist/types/trace-toolpack/causeContext.d.ts.map +1 -0
- package/dist/types/trace-toolpack/causeProjection.d.ts +18 -0
- package/dist/types/trace-toolpack/causeProjection.d.ts.map +1 -0
- package/dist/types/trace-toolpack/causeReader.d.ts +2 -3
- package/dist/types/trace-toolpack/causeReader.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeResponse.d.ts +5 -2
- package/dist/types/trace-toolpack/causeResponse.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeSnapshot.d.ts +2 -8
- package/dist/types/trace-toolpack/causeSnapshot.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeTools.d.ts +8 -1
- package/dist/types/trace-toolpack/causeTools.d.ts.map +1 -1
- package/dist/types/trace-toolpack/index.d.ts +3 -0
- package/dist/types/trace-toolpack/index.d.ts.map +1 -1
- package/dist/types/trace-toolpack/storedCause.d.ts +9 -0
- package/dist/types/trace-toolpack/storedCause.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseBinding.d.ts +17 -0
- package/dist/types/trace-toolpack/storedCauseBinding.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseOptions.d.ts +6 -0
- package/dist/types/trace-toolpack/storedCauseOptions.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseProjection.d.ts +4 -0
- package/dist/types/trace-toolpack/storedCauseProjection.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseReader.d.ts +4 -0
- package/dist/types/trace-toolpack/storedCauseReader.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseSources.d.ts +9 -0
- package/dist/types/trace-toolpack/storedCauseSources.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseTypes.d.ts +49 -0
- package/dist/types/trace-toolpack/storedCauseTypes.d.ts.map +1 -0
- package/dist/types/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/package.json +3 -3
package/CAPABILITIES.md
CHANGED
|
@@ -99,9 +99,11 @@ not in this table, search `src/index.ts` for the nearest noun before writing cod
|
|
|
99
99
|
| asking a debugging model "what did this run contradict itself about, and why?" — the Context Integrity findings, joined to the step that filed them | `find_context_errors` | `src/trace-toolpack/traceToolpack.ts` | 9.61.0 |
|
|
100
100
|
| reading abnormal nodes, recorded dependency roots and downstream impact with bounded public Foottrace queries, scoped proof IDs and explicit unknown coverage; optional host-authorized storage graph, including inner tool and subflow questions | `attention_list` / `root_cause` / `impact` + `TraceToolpackArtifacts.cause` + `TraceToolpackOptions.cause` | `src/trace-toolpack/causeTools.ts` | 10.7.0 |
|
|
101
101
|
| admitting a completed native root-log capture for read-only cause tools without a custom graph; partial, legacy, child and resumed coverage stays uncertain with fixed reasons | `assessCapture` | `src/trace-toolpack/causeCapture.ts` | 10.10.0 |
|
|
102
|
+
| loading one authorized, acknowledged saved root history and asking the existing bounded cause questions without a synthetic snapshot; separate native/storage assessments, privately bound graph identity, missing-value observations preserved; unproven source ownership stays unknown | `readStoredCauseArtifacts` + `traceCauseTools` (`/observe`) | `src/trace-toolpack/storedCause.ts` | 11.1.0 |
|
|
102
103
|
| the model inventing an id or a reading that no tool ever returned — a deterministic fabrication detector on the final answer, with a posture for how hard it pushes back | `.namesAndNumbersFromEvidence()` + `posture` (`'assist'` record+flag, the default / `'guard'` one revision then ship flagged / `'rails'` refuse instead) + `shapes` + `exempt` + `minDigits` (default 4) + `nudge` (default off) | `src/core/agent/evidence/` | 9.35.0 |
|
|
103
104
|
| plain decimal readings honestly rounded at the written precision (opt-in; one carried number only, no new unitless arithmetic), and exactly-two numeric range endpoints checked after declared ID shapes; short bare endpoints retain minDigits | `AgentBuilder.namesAndNumbersFromEvidence` + `NamesAndNumbersOptions` + `EvidenceVerdict` + `ComputedFigure` | `src/core/agent/evidence/` | 10.8.0 |
|
|
104
105
|
| counting a HUMAN-VERIFIED value as ground for the choice-seam check — the person clicked a row, the app verified the cells against the artifact, and the id the model takes from that selection is not fabricated; the source label travels onto the record | `externalGrounds` + `ExternalGround` + `external_ground_used` | `src/integrity/unsupported-argument/check.ts` | 9.72.0 |
|
|
106
|
+
| following exact read versions in an acknowledged saved root history using independently collected native namespace and invocation ownership; missing ownership stays unknown, partial capture keeps gaps, and recorded reads never prove output derivation | `readStoredCauseArtifacts` + `traceCauseTools` (`/observe`) | `src/trace-toolpack/storedCause.ts` | 11.1.0 |
|
|
105
107
|
| a lookup tool that answers "nothing found" for EVERY id because a filter broke, and an agent reporting that absence as fact — the run itself produced the id, the lookup came back empty, and that PAIR is worth a look | `noticeEmptyLookups` + `readLookupResult` + `EMPTY_LOOKUP_CEILING` (dial default OFF and needs a tool declaring `argumentsFrom` too — two halves; kind `empty-lookup` at seam `write`, always `advisory: true`; empty = a zero-length ARRAY or an `absent()` envelope, every other shape files `not-applicable` and no finding; the ceiling is quoted verbatim into every message) | `src/integrity/empty-lookup/` | 9.77.0 |
|
|
106
108
|
| an agent answering a NEW question out of an OLD turn's tool results — grounded, four turns stale, and the evidence gate approving it (`Tool calls 0` and "all 7 values were found in what the tools returned"). ALSO the bug half: the gate's two sentences claimed the flagged values "appear in no tool result FROM THIS TURN" while its index walked every `role:'tool'` turn — a boundary asserted and never measured; both now say "no tool result this run read" | `noticePriorTurnEvidence` + `PRIOR_TURN_EVIDENCE_CEILING` + `priorTurnEvidenceOf` + `AnswerGroundingReading` (dial default OFF and needs `.namesAndNumbersFromEvidence()` too — two halves, and the second is structural: the gate owns the extractor that decides which tokens are values; kind `prior-turn-evidence` at seam `claim`, always `advisory: true`; `EvidenceCorpus.values` became a `Map<form, turn>` stamped in the walk that was already happening, a TURN = each `role:'user'` message `isLibraryAuthoredTurn` did NOT write (counting the gate's own correction would file against every revised answer); fires when ≥1 value is grounded and NOT ONE came from the turn being answered — ONE current-turn value files nothing, which is what keeps an honest follow-up quiet and is the design's falsification test; the zero-tool-call turn is the SAME kind with a stronger witness, not a second kind; corpus is the LIVE WINDOW so ordinals are window-relative and the distance is a FLOOR, while the boundary stays exact (`'current-request'` is un-droppable); memory/RAG values are exempt from grounding and invisible — it can under-report, never over-report; the ceiling is quoted verbatim into every message) | `src/integrity/prior-turn-evidence/` | 9.83.0 |
|
|
107
109
|
| a tool's ROWS quietly disagreeing with what the tool promised — a LUN 0 stored as `""` because it is falsy, a numeric column arriving as quoted strings, a declared column present in no row at all | `Tool.resultColumns` + `checkColumnTypes` + `COLUMN_TYPE_CEILING` + `readRowset` (dial `'off'` (default) / `'warn'` (file findings, model reads the rows unchanged) / `'enforce'` (refuse the rows, `resultCeiling`'s teaching-sentence idiom, delivered status `'invalid'`) — the `toolArgsValidation` trio, this seam's mirror; needs a tool declaring `resultColumns` too — two halves; types `number`/`string`/`boolean`/`date`, bare word or `{type, nullable}`, deliberately NO `'unknown'`; OPEN — unlisted columns allowed and unjudged; TWO kinds at seam `write` — `column-type-mismatch` (there, wrong type) vs `missing-column` (declared, in no row); rowset = an ARRAY OF PLAIN OBJECTS with ≥1 row, everything else incl. the ZERO-ROW result files `not-applicable` (empty is `empty-lookup`'s subject); travels MCP `_meta`; the ceiling is quoted verbatim into every message) | `src/integrity/column-types/` | 9.78.0 |
|
package/dist/debug.js
CHANGED
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
* symbols, one door. Import from the door.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.recordedChat = exports.runCheckSemanticsCli = exports.formatSemanticsReport = exports.coerceSemanticsCatalog = exports.checkSemantics = 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 = void 0;
|
|
26
|
+
exports.applyAblations = exports.ablationForSuspect = exports.traceDebugAgent = exports.SelfExplainBinding = exports.SELF_EXPLAIN_MAX_EVENTS = exports.buildSelfExplainToolProvider = exports.buildSelfExplainSkill = exports.mergeInnerRuns = exports.innerRunsOf = exports.innerRunStore = exports.INNER_RUN_RECORDS = exports.DEFAULT_INNER_RUN_LIMIT = exports.openRecording = exports.readStoredCauseArtifacts = exports.traceCauseTools = exports.traceToolpack = exports.TRACE_TOOL_NAMES = 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;
|
|
27
|
+
exports.catalogFromTools = exports.analyzeToolCatalog = exports.variableToBacktrackTrace = exports.toBacktrackTrace = exports.sliceToBacktrackTrace = exports.verdictForArm = exports.validateStrategyArms = exports.scoreArmRuns = exports.RUN_CONFIGURED_EVENT = exports.nullBandFrom = exports.matchArm = exports.manifestFromEvents = exports.declaredFacetCount = exports.compareStrategyArms = exports.collectArmRuns = exports.checkArmApplied = exports.checkArmApplication = exports.armLabel = exports.armFacetsFromManifest = exports.armConfigKey = exports.applyArm = 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 = exports.classifySuspect = exports.DEFAULT_RECENCY_DECAY = exports.traceVariable = exports.joinVariableSlice = exports.buildWriterFrameIndex = exports.walkTrajectory = exports.walkToRoot = exports.shortlistEarlyCulprits = exports.bucketByAnchors = exports.bisectCulprits = exports.assignCostVerdicts = exports.assembleTrajectory = void 0;
|
|
28
|
+
exports.recordedChat = exports.runCheckSemanticsCli = exports.formatSemanticsReport = exports.coerceSemanticsCatalog = exports.checkSemantics = 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 = void 0;
|
|
29
29
|
// influence-core — the ONE embedding-based scoring engine (RFC-002/003
|
|
30
30
|
// block D6). Not a recorder: pure, embedder-injected scoring functions
|
|
31
31
|
// + the shared bounded embedding cache. Honest claim: every score is an
|
|
@@ -71,6 +71,8 @@ Object.defineProperty(exports, "NO_COMPLETED_RUN_MESSAGE", { enumerable: true, g
|
|
|
71
71
|
Object.defineProperty(exports, "TOOLPACK_HARD_CAPS", { enumerable: true, get: function () { return index_js_2.TOOLPACK_HARD_CAPS; } });
|
|
72
72
|
Object.defineProperty(exports, "TRACE_TOOL_NAMES", { enumerable: true, get: function () { return index_js_2.TRACE_TOOL_NAMES; } });
|
|
73
73
|
Object.defineProperty(exports, "traceToolpack", { enumerable: true, get: function () { return index_js_2.traceToolpack; } });
|
|
74
|
+
Object.defineProperty(exports, "traceCauseTools", { enumerable: true, get: function () { return index_js_2.traceCauseTools; } });
|
|
75
|
+
Object.defineProperty(exports, "readStoredCauseArtifacts", { enumerable: true, get: function () { return index_js_2.readStoredCauseArtifacts; } });
|
|
74
76
|
// `openRecording` — a saved run (`recordRun(...).toRecording()`, live or
|
|
75
77
|
// parsed back from JSON) reopened as toolpack artifacts. The one adapter
|
|
76
78
|
// between the recording shape the viewers read and the artifact bag the
|
package/dist/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;AAEH,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AACxE,4BAA4B;AAC5B,sDA8DmC;AA7DjC,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,
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.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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,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,wEAAwE;AACxE,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,kDAa8B;AAZ5B,2GAAA,cAAc,OAAA;AACd,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AAUtB,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,yCAAyC;AACzC,sDAakC;AAZhC,yGAAA,YAAY,OAAA"}
|
package/dist/esm/debug.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* symbols, one door. Import from the door.
|
|
23
23
|
*/
|
|
24
24
|
export { adaptWeights, averageRelevancy, compositeScore, contentHash, DEFAULT_CLEAR_WINNER_MARGIN, DEFAULT_CLEAR_WINNER_RATIO, DEFAULT_INFLUENCE_WEIGHTS, DEFAULT_MARGIN_THRESHOLD, DEFAULT_PERSISTENCE_THRESHOLD, DEFAULT_SHORTLIST_BAND, EmbeddingCache, embeddingCache, finalAnswerSimilarity, attributeChoice, explainChoice, lexicalOverlapStrategy, listInfluenceStrategies, marginStrategy, pairwiseSimilarity, persistence, rankingConfidence, ratioStrategy, scoreContrastiveInfluence, scoreInfluence, scoreLexicalInfluence, scoreMargin, semanticAlignmentStrategy, snippetUnits, structuralProximity, type AttributeChoiceArgs, type AttributionUnit, type CandidateScore, type ChannelVerdict, type ChoiceAttribution, type ChoiceExplanation, type ConfidenceStrategy, type Embedder, type EmbeddingCacheOptions, type EmbeddingCacheStats, type EvidenceInput, type ExplainChoiceArgs, type InfluenceScore, type InfluenceScorer, type InfluenceStrategy, type InfluenceStrategyRequirement, type InfluenceWeights, type MarginCandidate, type MarginResult, type PairwiseSimilarityArgs, type PairwiseSimilarityResult, type RankingConfidence, type RankingConfidenceOptions, type ScoreContrastiveInfluenceArgs, type ScoreInfluenceArgs, type ScoreLexicalInfluenceArgs, type ScoreMarginArgs, type SignalScores, type SimilarityItem, type SimilarityPair, type SnippetUnitsOptions, type UnitScore, } from './influence-core/index.js';
|
|
25
|
-
export { callTraceTool, lazyTraceToolpack, NO_COMPLETED_RUN_MESSAGE, TOOLPACK_HARD_CAPS, TRACE_TOOL_NAMES, traceToolpack, type TraceToolpackArtifacts, type TraceToolpackOptions, type TraceCauseArtifacts, type TraceCauseOptions, type TraceCauseOperation, } from './trace-toolpack/index.js';
|
|
25
|
+
export { callTraceTool, lazyTraceToolpack, NO_COMPLETED_RUN_MESSAGE, TOOLPACK_HARD_CAPS, TRACE_TOOL_NAMES, traceToolpack, traceCauseTools, readStoredCauseArtifacts, type TraceToolpackArtifacts, type TraceToolpackOptions, type TraceCauseArtifacts, type TraceCauseOptions, type TraceCauseOperation, type ReadStoredCauseOptions, type StoredCauseUnknown, type StoredCauseAdmission, type StoredCauseArtifacts, type StoredCauseResult, } from './trace-toolpack/index.js';
|
|
26
26
|
export { openRecording, type OpenableRecording } from './trace-toolpack/index.js';
|
|
27
27
|
export { DEFAULT_INNER_RUN_LIMIT, INNER_RUN_RECORDS, innerRunStore, innerRunsOf, mergeInnerRuns, type InnerRunLookup, type InnerRunOutcome, type InnerRunRecord, type InnerRunStore, type InnerRunSummary, type KeepsInnerRuns, } from './trace-toolpack/index.js';
|
|
28
28
|
export { buildSelfExplainSkill, buildSelfExplainToolProvider, SELF_EXPLAIN_MAX_EVENTS, SelfExplainBinding, traceDebugAgent, type SelfExplainInclude, type SelfExplainOptions, type SelfExplainServing, type SelfExplainSource, type TraceDebugAgentOptions, } from './trace-toolpack/index.js';
|
package/dist/esm/debug.js
CHANGED
|
@@ -30,7 +30,7 @@ export { adaptWeights, averageRelevancy, compositeScore, contentHash, DEFAULT_CL
|
|
|
30
30
|
// Introspection toolpack (RFC-003 Part C) — footprintjs trace evidence
|
|
31
31
|
// exposed as TOOLS a debugging LLM calls over a COMPLETED run's artifacts.
|
|
32
32
|
// Bounded, honest (⚠ markers), redaction-respecting, id-navigable.
|
|
33
|
-
export { callTraceTool, lazyTraceToolpack, NO_COMPLETED_RUN_MESSAGE, TOOLPACK_HARD_CAPS, TRACE_TOOL_NAMES, traceToolpack, } from './trace-toolpack/index.js';
|
|
33
|
+
export { callTraceTool, lazyTraceToolpack, NO_COMPLETED_RUN_MESSAGE, TOOLPACK_HARD_CAPS, TRACE_TOOL_NAMES, traceToolpack, traceCauseTools, readStoredCauseArtifacts, } from './trace-toolpack/index.js';
|
|
34
34
|
// `openRecording` — a saved run (`recordRun(...).toRecording()`, live or
|
|
35
35
|
// parsed back from JSON) reopened as toolpack artifacts. The one adapter
|
|
36
36
|
// between the recording shape the viewers read and the artifact bag the
|
package/dist/esm/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,2BAA2B,CAAC;AACnC,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,2BAA2B,CAAC;AACnC,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,wBAAwB,GAWzB,MAAM,2BAA2B,CAAC;AACnC,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,0EAA0E;AAC1E,OAAO,EAAE,aAAa,EAA0B,MAAM,2BAA2B,CAAC;AAClF,0EAA0E;AAC1E,sEAAsE;AACtE,wEAAwE;AACxE,uEAAuE;AACvE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,E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AACxE,8EAA8E;AAC9E,qEAAqE;AACrE,wEAAwE;AACxE,uEAAuE;AACvE,gEAAgE;AAChE,uEAAuE;AACvE,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,sBAAsB,CAAC;AAC9B,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,wEAAwE;AACxE,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GASrB,MAAM,sBAAsB,CAAC;AAC9B,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,8EAA8E;AAC9E,yCAAyC;AACzC,OAAO,EACL,YAAY,GAYb,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function ownData(value: unknown, allowed?: readonly string[]): Record<string, unknown>;
|
|
2
2
|
/** JSON copy without invoking toJSON/getters or silently dropping data. */
|
|
3
|
-
export declare function copyJson(value: unknown, maxBytes: number, freeze: boolean): unknown;
|
|
3
|
+
export declare function copyJson(value: unknown, maxBytes: number, freeze: boolean, maxDepth?: number): unknown;
|
|
@@ -18,7 +18,9 @@ export function ownData(value, allowed) {
|
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
20
|
/** JSON copy without invoking toJSON/getters or silently dropping data. */
|
|
21
|
-
export function copyJson(value, maxBytes, freeze) {
|
|
21
|
+
export function copyJson(value, maxBytes, freeze, maxDepth = 100) {
|
|
22
|
+
if (!Number.isSafeInteger(maxDepth) || maxDepth < 0 || maxDepth > 256)
|
|
23
|
+
throw new Error('JSON nesting limit.');
|
|
22
24
|
let budget = maxBytes;
|
|
23
25
|
const ancestors = new Set();
|
|
24
26
|
const spend = (bytes) => {
|
|
@@ -32,7 +34,7 @@ export function copyJson(value, maxBytes, freeze) {
|
|
|
32
34
|
spend(encoder.encode(JSON.stringify(item)).byteLength);
|
|
33
35
|
};
|
|
34
36
|
const copy = (item, depth) => {
|
|
35
|
-
if (depth >
|
|
37
|
+
if (depth > maxDepth)
|
|
36
38
|
throw new Error('JSON nesting limit.');
|
|
37
39
|
if (item === null) {
|
|
38
40
|
spend(4);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundedJson.js","sourceRoot":"","sources":["../../../src/lib/boundedJson.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,OAA2B;IACjE,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAEhE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,MAAM,MAAM,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAA4B,CAAC;IACvF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAChE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAA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cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;oBACjC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;oBACnC,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,IAAI;oBACd,YAAY,EAAE,IAAI;iBACnB,CAAC,CAAC;YACL,CAAC;YACD,MAAM,GAAG,MAAM,CAAC;QAClB,CAAC;QACD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACjD,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { LogAddress } from 'foottrace';
|
|
2
2
|
/** Fixed public reasons only; never stringify caller metadata or exceptions. */
|
|
3
3
|
export type CaptureReason = 'captured-root-log' | 'missing-attestation' | 'invalid-attestation' | 'run-mismatch' | 'scope-not-covered' | 'incomplete-extent' | 'run-not-completed' | 'modes-not-supported' | 'channel-not-captured' | 'capture-limited' | 'control-not-retained' | 'projection-incomplete';
|
|
4
|
+
export type SourceCaptureStatus = 'captured' | 'partial' | 'failed' | 'unknown';
|
|
4
5
|
export interface SnapshotCapture {
|
|
5
6
|
readonly status: 'admitted' | 'incomplete';
|
|
6
7
|
readonly reason: CaptureReason;
|
|
7
8
|
readonly scope: 'root-log';
|
|
8
9
|
readonly persistence: 'memory-only';
|
|
9
|
-
readonly readSources: 'not-collected';
|
|
10
|
+
readonly readSources: 'not-collected' | SourceCaptureStatus;
|
|
10
11
|
}
|
|
11
12
|
/** Own DATA only. A metadata getter is never a source of captured evidence. */
|
|
12
13
|
export declare function captureOwn(object: unknown, key: string): unknown;
|
|
13
|
-
export declare function captureAssessment(reason: CaptureReason): SnapshotCapture;
|
|
14
|
+
export declare function captureAssessment(reason: CaptureReason, readSources?: SnapshotCapture['readSources']): SnapshotCapture;
|
|
14
15
|
/** Admit only the native root/current-leg contract. This is not an authenticity or storage check. */
|
|
15
16
|
export declare function assessCapture(snapshot: unknown, commits: number): SnapshotCapture;
|
|
17
|
+
/** Saved-only: the public producer reader has separately admitted source ownership. */
|
|
18
|
+
export declare function assessSourceCapture(snapshot: unknown, commits: number, sources: SourceCaptureStatus): SnapshotCapture;
|
|
16
19
|
/** Root notes never authorize a child address, or a synthetic snapshot namespace. */
|
|
17
20
|
export declare function captureAddress(value: unknown): LogAddress | undefined;
|
|
@@ -9,13 +9,13 @@ export function captureOwn(object, key) {
|
|
|
9
9
|
throw new TypeError('cause tools: invalid capture metadata');
|
|
10
10
|
return field.value;
|
|
11
11
|
}
|
|
12
|
-
export function captureAssessment(reason) {
|
|
12
|
+
export function captureAssessment(reason, readSources = 'not-collected') {
|
|
13
13
|
return {
|
|
14
14
|
status: reason === 'captured-root-log' ? 'admitted' : 'incomplete',
|
|
15
15
|
reason,
|
|
16
16
|
scope: 'root-log',
|
|
17
17
|
persistence: 'memory-only',
|
|
18
|
-
readSources
|
|
18
|
+
readSources,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
const BASE_LIMITATIONS = new Set([
|
|
@@ -27,18 +27,28 @@ const BASE_LIMITATIONS = new Set([
|
|
|
27
27
|
]);
|
|
28
28
|
/** Admit only the native root/current-leg contract. This is not an authenticity or storage check. */
|
|
29
29
|
export function assessCapture(snapshot, commits) {
|
|
30
|
+
return assessCapturePolicy(snapshot, commits, 'not-collected');
|
|
31
|
+
}
|
|
32
|
+
/** Saved-only: the public producer reader has separately admitted source ownership. */
|
|
33
|
+
export function assessSourceCapture(snapshot, commits, sources) {
|
|
34
|
+
return assessCapturePolicy(snapshot, commits, sources);
|
|
35
|
+
}
|
|
36
|
+
function assessCapturePolicy(snapshot, commits, sources) {
|
|
37
|
+
const assessment = (reason) => captureAssessment(reason, sources);
|
|
38
|
+
const exact = sources !== 'not-collected';
|
|
30
39
|
try {
|
|
31
40
|
const note = captureOwn(snapshot, 'capture');
|
|
32
41
|
if (note === undefined)
|
|
33
|
-
return
|
|
34
|
-
if (captureOwn(note, 'version') !==
|
|
35
|
-
|
|
42
|
+
return assessment('missing-attestation');
|
|
43
|
+
if (captureOwn(note, 'version') !== (exact ? 2 : 1) ||
|
|
44
|
+
captureOwn(note, 'persistence') !== 'memory-only')
|
|
45
|
+
return assessment('invalid-attestation');
|
|
36
46
|
const runId = captureOwn(snapshot, 'runId');
|
|
37
47
|
if (typeof runId !== 'string' ||
|
|
38
48
|
runId.length === 0 ||
|
|
39
49
|
runId.length > 128 ||
|
|
40
50
|
captureOwn(note, 'runId') !== runId)
|
|
41
|
-
return
|
|
51
|
+
return assessment('run-mismatch');
|
|
42
52
|
const address = captureAddress(captureOwn(snapshot, 'logAddress'));
|
|
43
53
|
const covered = captureAddress(captureOwn(note, 'logAddress'));
|
|
44
54
|
if (captureOwn(note, 'scope') !== 'root-log' ||
|
|
@@ -46,12 +56,12 @@ export function assessCapture(snapshot, commits) {
|
|
|
46
56
|
!covered ||
|
|
47
57
|
address.logRunId !== runId ||
|
|
48
58
|
covered.logRunId !== address.logRunId)
|
|
49
|
-
return
|
|
59
|
+
return assessment('scope-not-covered');
|
|
50
60
|
const extent = captureOwn(note, 'commits');
|
|
51
61
|
if (captureOwn(extent, 'from') !== 0 || captureOwn(extent, 'to') !== commits)
|
|
52
|
-
return
|
|
62
|
+
return assessment('incomplete-extent');
|
|
53
63
|
if (captureOwn(captureOwn(note, 'boundary'), 'status') !== 'completed')
|
|
54
|
-
return
|
|
64
|
+
return assessment('run-not-completed');
|
|
55
65
|
const modes = captureOwn(note, 'modes');
|
|
56
66
|
const values = captureOwn(modes, 'commitValues');
|
|
57
67
|
if (captureOwn(modes, 'readTracking') !== 'full' ||
|
|
@@ -60,25 +70,29 @@ export function assessCapture(snapshot, commits) {
|
|
|
60
70
|
values !== captureOwn(snapshot, 'commitValues') ||
|
|
61
71
|
captureOwn(modes, 'writeProvenance') !== 'reads-prefix' ||
|
|
62
72
|
captureOwn(snapshot, 'writeProvenance') !== 'reads-prefix')
|
|
63
|
-
return
|
|
73
|
+
return assessment('modes-not-supported');
|
|
64
74
|
const channels = captureOwn(note, 'channels');
|
|
65
75
|
if (!['reads', 'writes', 'attention', 'control'].every((channel) => captureOwn(channels, channel) === 'captured') ||
|
|
66
|
-
captureOwn(channels, 'readSources') !==
|
|
67
|
-
|
|
76
|
+
captureOwn(channels, 'readSources') !== sources ||
|
|
77
|
+
(exact && sources !== 'captured'))
|
|
78
|
+
return assessment('channel-not-captured');
|
|
68
79
|
const limits = captureOwn(note, 'limitations');
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
const expected = exact
|
|
81
|
+
? new Set([...BASE_LIMITATIONS].filter((limit) => limit !== 'read-sources-not-collected'))
|
|
82
|
+
: BASE_LIMITATIONS;
|
|
83
|
+
if (!Array.isArray(limits) || limits.length !== expected.size)
|
|
84
|
+
return assessment('capture-limited');
|
|
71
85
|
const seen = new Set();
|
|
72
86
|
for (let index = 0; index < limits.length; index++) {
|
|
73
87
|
const limit = captureOwn(limits, String(index));
|
|
74
|
-
if (typeof limit !== 'string' || !
|
|
75
|
-
return
|
|
88
|
+
if (typeof limit !== 'string' || !expected.has(limit) || seen.has(limit))
|
|
89
|
+
return assessment('capture-limited');
|
|
76
90
|
seen.add(limit);
|
|
77
91
|
}
|
|
78
|
-
return
|
|
92
|
+
return assessment('captured-root-log');
|
|
79
93
|
}
|
|
80
94
|
catch {
|
|
81
|
-
return
|
|
95
|
+
return assessment('invalid-attestation');
|
|
82
96
|
}
|
|
83
97
|
}
|
|
84
98
|
/** Root notes never authorize a child address, or a synthetic snapshot namespace. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeCapture.js","sourceRoot":"","sources":["../../../src/trace-toolpack/causeCapture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"causeCap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,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5C,OAAO,OAAO,QAAQ,KAAK,QAAQ;QACjC,QAAQ,CAAC,MAAM,GAAG,CAAC;QACnB,QAAQ,CAAC,MAAM,IAAI,GAAG;QACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StageSnapshot } from 'footprintjs/advanced';
|
|
2
|
+
import type { TraceCauseArtifacts } from './causeTypes.js';
|
|
3
|
+
import type { TraceToolpackArtifacts } from './types.js';
|
|
4
|
+
/** The same three questions can read a graph directly or project a native snapshot. */
|
|
5
|
+
export type CauseContext = {
|
|
6
|
+
readonly kind: 'graph';
|
|
7
|
+
readonly cause: TraceCauseArtifacts;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'snapshot';
|
|
10
|
+
readonly artifacts: TraceToolpackArtifacts;
|
|
11
|
+
readonly nodes: ReadonlyMap<string, StageSnapshot>;
|
|
12
|
+
};
|
|
13
|
+
/** A saved assessment belongs only to graph-only serving, never a mixed snapshot bag. */
|
|
14
|
+
export declare function causeContextAssessment(context: CauseContext): import("./storedCauseBinding.js").StoredCauseAssessment;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { storedCauseAssessment } from './storedCauseBinding.js';
|
|
2
|
+
/** A saved assessment belongs only to graph-only serving, never a mixed snapshot bag. */
|
|
3
|
+
export function causeContextAssessment(context) {
|
|
4
|
+
try {
|
|
5
|
+
const assessed = storedCauseAssessment(context.kind === 'graph' ? context.cause : context.artifacts.cause);
|
|
6
|
+
return context.kind === 'snapshot' && assessed.kind !== 'none'
|
|
7
|
+
? { kind: 'invalid' }
|
|
8
|
+
: assessed;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return { kind: 'invalid' };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=causeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"causeContext.js","sourceRoot":"","sources":["../../../src/trace-toolpack/causeContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAWhE,yFAAyF;AACzF,MAAM,UAAU,sBAAsB,CAAC,OAAqB;IAC1D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,qBAAqB,CACpC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CACnE,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM;YAC5D,CAAC,CAAC,EAAE,IAAI,EAAE,SAAkB,EAAE;YAC9B,CAAC,CAAC,QAAQ,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,SAAkB,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RecordScope } from 'foottrace/cause';
|
|
2
|
+
import type { StageSnapshot } from 'footprintjs/advanced';
|
|
3
|
+
import type { ControlDepLookup } from 'foottrace';
|
|
4
|
+
import type { TraceCauseArtifacts } from './causeTypes.js';
|
|
5
|
+
import { type SnapshotCapture, type SourceCaptureStatus } from './causeCapture.js';
|
|
6
|
+
export interface SnapshotCauseArtifacts extends TraceCauseArtifacts {
|
|
7
|
+
readonly capture: SnapshotCapture;
|
|
8
|
+
}
|
|
9
|
+
/** A snapshot projection, not another dependence walker. The public reader owns all graph reasoning. */
|
|
10
|
+
export declare function projectCauseBasis(snapshot: unknown, nodes: ReadonlyMap<string, StageSnapshot>, controlDeps?: () => ControlDepLookup | undefined, extras?: {
|
|
11
|
+
readonly readKeys?: ReadonlyMap<string, readonly string[]>;
|
|
12
|
+
readonly initialState?: Record<string, unknown>;
|
|
13
|
+
readonly sources?: {
|
|
14
|
+
readonly status: SourceCaptureStatus;
|
|
15
|
+
readonly scope: NonNullable<RecordScope['readSources']>;
|
|
16
|
+
};
|
|
17
|
+
}): SnapshotCauseArtifacts | 'truncated' | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createRecordGraph } from 'foottrace/cause';
|
|
2
|
+
import { assessCapture, assessSourceCapture, captureAddress, captureAssessment, captureOwn as own, } from './causeCapture.js';
|
|
3
|
+
import { capturedControl } from './causeControl.js';
|
|
4
|
+
/** A snapshot projection, not another dependence walker. The public reader owns all graph reasoning. */
|
|
5
|
+
export function projectCauseBasis(snapshot, nodes, controlDeps, extras) {
|
|
6
|
+
// A snapshot-local namespace is not a storage address or a service-correlation claim.
|
|
7
|
+
const recordedAddress = own(snapshot, 'logAddress');
|
|
8
|
+
const runId = own(snapshot, 'runId');
|
|
9
|
+
const address = recordedAddress ??
|
|
10
|
+
(typeof runId === 'string' ? { logRunId: `snapshot:${runId}`, drillPath: [] } : undefined);
|
|
11
|
+
if (address === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
const log = own(snapshot, 'commitLog');
|
|
14
|
+
if (!Array.isArray(log))
|
|
15
|
+
return undefined;
|
|
16
|
+
if (log.length > 4096)
|
|
17
|
+
return 'truncated';
|
|
18
|
+
let capture = extras?.sources
|
|
19
|
+
? assessSourceCapture(snapshot, log.length, extras.sources.status)
|
|
20
|
+
: assessCapture(snapshot, log.length);
|
|
21
|
+
const nativeControl = capture.status === 'admitted' ? capturedControl(snapshot) : undefined;
|
|
22
|
+
if (capture.status === 'admitted' && nativeControl === undefined)
|
|
23
|
+
capture = captureAssessment('control-not-retained', capture.readSources);
|
|
24
|
+
const reads = Object.create(null);
|
|
25
|
+
const marks = Object.create(null);
|
|
26
|
+
const control = Object.create(null);
|
|
27
|
+
let visited = 0;
|
|
28
|
+
for (const [id, stage] of nodes) {
|
|
29
|
+
if (visited++ >= 4096)
|
|
30
|
+
return 'truncated';
|
|
31
|
+
const capturedReads = own(stage, 'stageReads');
|
|
32
|
+
if (capturedReads !== null && typeof capturedReads === 'object')
|
|
33
|
+
reads[id] = Object.keys(capturedReads);
|
|
34
|
+
else if (capture.status === 'admitted')
|
|
35
|
+
reads[id] = [];
|
|
36
|
+
const omitted = extras?.readKeys?.get(id);
|
|
37
|
+
if (omitted)
|
|
38
|
+
reads[id] = [...new Set([...(reads[id] ?? []), ...omitted])];
|
|
39
|
+
const attention = own(stage, 'attention');
|
|
40
|
+
if (attention !== undefined)
|
|
41
|
+
marks[id] = attention;
|
|
42
|
+
const parent = nativeControl === undefined ? controlDeps?.()?.(id) : nativeControl[id];
|
|
43
|
+
if (parent !== undefined)
|
|
44
|
+
control[id] = { deciderId: parent.deciderId };
|
|
45
|
+
}
|
|
46
|
+
if (capture.status === 'admitted' &&
|
|
47
|
+
log.some((bundle) => !nodes.has(own(bundle, 'runtimeStageId'))))
|
|
48
|
+
capture = captureAssessment('projection-incomplete', capture.readSources);
|
|
49
|
+
const complete = capture.status === 'admitted';
|
|
50
|
+
const scopeAddress = (complete && captureAddress(own(snapshot, 'logAddress'))) || address;
|
|
51
|
+
const scope = {
|
|
52
|
+
address: scopeAddress,
|
|
53
|
+
commitLog: log,
|
|
54
|
+
reads,
|
|
55
|
+
...(complete || Object.keys(marks).length
|
|
56
|
+
? { attention: marks }
|
|
57
|
+
: {}),
|
|
58
|
+
...(nativeControl === undefined && controlDeps?.() === undefined
|
|
59
|
+
? {}
|
|
60
|
+
: { controlDeps: control }),
|
|
61
|
+
complete,
|
|
62
|
+
...(extras?.initialState === undefined ? {} : { initialState: extras.initialState }),
|
|
63
|
+
...(extras?.sources === undefined ? {} : { readSources: extras.sources.scope }),
|
|
64
|
+
};
|
|
65
|
+
const graph = createRecordGraph([scope], { maxCommits: 4096 });
|
|
66
|
+
// The public scope reader admits untrusted commits and creates its own official IDs.
|
|
67
|
+
return {
|
|
68
|
+
graph: { ...graph, roots: (context) => graph.openScope(scopeAddress, context) },
|
|
69
|
+
capture,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=causeProjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"causeProjection.js","sourceRoot":"","sources":["../../../src/trace-toolpack/causeProjection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,iBAAiB,CAAC;AAItE,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,UAAU,IAAI,GAAG,GAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD,wGAAwG;AACxG,MAAM,UAAU,iBAAiB,CAC/B,QAAiB,EACjB,KAAyC,EACzC,WAAgD,EAChD,MAOC;IAED,sFAAsF;IACtF,MAAM,eAAe,GAAG,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAuC,CAAC;IAC1F,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,OAAO,GACX,eAAe;QACf,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7F,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,WAAW,CAA6B,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI;QAAE,OAAO,WAAW,CAAC;IAC1C,I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YACvC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAiC,EAAE;YAClD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,WAAW,EAAE,EAAE,KAAK,SAAS;YAC9D,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QAC7B,QAAQ;QACR,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;QACpF,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;KAChF,CAAC;IACF,MAAM,KAAK,GAAG,iBAAiB,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,qFAAqF;IACrF,OAAO;QACL,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;QAC/E,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { StageSnapshot } from 'footprintjs/advanced';
|
|
2
|
-
import type { TraceToolpackArtifacts } from './types.js';
|
|
3
1
|
import type { TraceCauseOperation, TraceCauseQuestion } from './causeTypes.js';
|
|
4
2
|
import type { CauseLimits } from './causeLimits.js';
|
|
3
|
+
import { type CauseContext } from './causeContext.js';
|
|
5
4
|
/** One public query, one cache/deadline/total ceiling. No model, rerun, storage URL or second walker. */
|
|
6
|
-
export declare function readCause(operation: TraceCauseOperation,
|
|
5
|
+
export declare function readCause(operation: TraceCauseOperation, context: CauseContext, question: TraceCauseQuestion, limits: CauseLimits, deadline: number, signal?: AbortSignal): Promise<string>;
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import { attentionList, explain } from 'foottrace/cause';
|
|
2
2
|
import { snapshotCauseArtifacts } from './causeSnapshot.js';
|
|
3
3
|
import { causeGap, causeResponse } from './causeResponse.js';
|
|
4
|
+
import { causeContextAssessment } from './causeContext.js';
|
|
4
5
|
/** One public query, one cache/deadline/total ceiling. No model, rerun, storage URL or second walker. */
|
|
5
|
-
export async function readCause(operation,
|
|
6
|
-
const
|
|
6
|
+
export async function readCause(operation, context, question, limits, deadline, signal) {
|
|
7
|
+
const assessed = causeContextAssessment(context);
|
|
8
|
+
if (assessed.kind === 'invalid')
|
|
9
|
+
return causeGap(operation, 'invalid-data');
|
|
10
|
+
const snapshotOnly = context.kind === 'snapshot' && context.artifacts.cause === undefined ? true : undefined;
|
|
11
|
+
const storedCapture = assessed.kind === 'stored' ? assessed.capture : undefined;
|
|
12
|
+
const storage = assessed.kind === 'stored' ? assessed.admission.storage : undefined;
|
|
7
13
|
if (signal?.aborted)
|
|
8
|
-
return causeGap(operation, 'cancelled', snapshotOnly);
|
|
14
|
+
return causeGap(operation, 'cancelled', storedCapture ?? snapshotOnly, storage, limits.maxChars);
|
|
9
15
|
if (performance.now() >= deadline)
|
|
10
|
-
return causeGap(operation, 'timeout', snapshotOnly);
|
|
11
|
-
const projection =
|
|
12
|
-
|
|
16
|
+
return causeGap(operation, 'timeout', storedCapture ?? snapshotOnly, storage, limits.maxChars);
|
|
17
|
+
const projection = context.kind === 'snapshot' && context.artifacts.cause === undefined
|
|
18
|
+
? snapshotCauseArtifacts(context.artifacts, context.nodes)
|
|
19
|
+
: undefined;
|
|
20
|
+
const source = context.kind === 'graph' ? context.cause : context.artifacts.cause ?? projection;
|
|
13
21
|
if (source === 'truncated')
|
|
14
22
|
return causeGap(operation, 'truncated', snapshotOnly);
|
|
15
23
|
if (source === undefined)
|
|
16
24
|
return causeGap(operation, 'not-collected', snapshotOnly);
|
|
17
|
-
const capture = projection && projection !== 'truncated' ? projection.capture : undefined;
|
|
25
|
+
const capture = storedCapture ?? (projection && projection !== 'truncated' ? projection.capture : undefined);
|
|
18
26
|
const remaining = Math.floor(deadline - performance.now());
|
|
19
27
|
if (signal?.aborted)
|
|
20
|
-
return causeGap(operation, 'cancelled', capture);
|
|
28
|
+
return causeGap(operation, 'cancelled', capture, storage, limits.maxChars);
|
|
21
29
|
if (remaining < 1)
|
|
22
|
-
return causeGap(operation, 'timeout', capture);
|
|
30
|
+
return causeGap(operation, 'timeout', capture, storage, limits.maxChars);
|
|
23
31
|
const { maxChars, backward, impact, maxNodes, maxDepth, maxEdges, maxCalls } = limits;
|
|
24
32
|
const options = { maxNodes, maxDepth, maxEdges, maxCalls, timeoutMs: remaining, signal };
|
|
25
33
|
if (operation === 'attention_list') {
|
|
@@ -37,21 +45,21 @@ export async function readCause(operation, artifacts, nodes, question, limits, d
|
|
|
37
45
|
: result;
|
|
38
46
|
return causeResponse(operation, finding, finding.confidence === 'incomplete'
|
|
39
47
|
? 'Not sure, because coverage is incomplete. An absent mark is not proof of a healthy or reached step.'
|
|
40
|
-
: 'Recorded attention within this query only. Cite the returned node and evidence IDs.', maxChars, capture);
|
|
48
|
+
: 'Recorded attention within this query only. Cite the returned node and evidence IDs.', maxChars, capture, storage);
|
|
41
49
|
}
|
|
42
50
|
// Each invocation projects one bounded query. Separate root/impact calls do not share a result yet.
|
|
43
51
|
if (question.nodeId === undefined)
|
|
44
|
-
return causeGap(operation, 'invalid-data', capture);
|
|
52
|
+
return causeGap(operation, 'invalid-data', capture, storage, limits.maxChars);
|
|
45
53
|
const finding = await explain(source.graph, question.nodeId, { ...options, backward, impact });
|
|
46
54
|
if (operation === 'impact') {
|
|
47
55
|
return causeResponse(operation, finding.impact, finding.impact.confidence === 'incomplete'
|
|
48
56
|
? 'Not sure of the full impact, because the returned gaps limit the recorded forward slice.'
|
|
49
|
-
: 'Recorded reachable impact only; this does not prove effects in unrecorded services or unreached branches.', maxChars, capture);
|
|
57
|
+
: 'Recorded reachable impact only; this does not prove effects in unrecorded services or unreached branches.', maxChars, capture, storage);
|
|
50
58
|
}
|
|
51
59
|
return causeResponse(operation, finding, finding.rootCause !== undefined
|
|
52
60
|
? 'A unique recorded dependency root is supported. Cite its node ID and path; this is not proof of a provider-internal physical cause.'
|
|
53
61
|
: finding.confidence === 'incomplete'
|
|
54
62
|
? 'Not sure, because the returned gaps prevent a unique supported root. Alternatives are not confirmed causes.'
|
|
55
|
-
: 'No unique marked root in the checked graph. Cite alternatives without selecting one as fact.', maxChars, capture);
|
|
63
|
+
: 'No unique marked root in the checked graph. Cite alternatives without selecting one as fact.', maxChars, capture, storage);
|
|
56
64
|
}
|
|
57
65
|
//# sourceMappingURL=causeReader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeReader.js","sourceRoot":"","sources":["../../../src/trace-toolpack/causeReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"causeReader.js","sourceRoot":"","sources":["../../../src/trace-toolpack/causeReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAqB,MAAM,mBAAmB,CAAC;AAE9E,yGAAyG;AACzG,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,SAA8B,EAC9B,OAAqB,EACrB,QAA4B,EAC5B,MAAmB,EACnB,QAAgB,EAChB,MAAoB;IAEpB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS;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,EACR,OAAO,EACP,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { GapCode } from 'foottrace/cause';
|
|
2
2
|
import type { TraceCauseOperation } from './causeTypes.js';
|
|
3
3
|
import type { SnapshotCapture } from './causeCapture.js';
|
|
4
|
+
import type { StoredCauseAdmission } from './storedCauseTypes.js';
|
|
5
|
+
type StoredAssessment = StoredCauseAdmission['storage'];
|
|
4
6
|
/** Fixed wording: no exception messages, state values or provider payloads cross this boundary. */
|
|
5
|
-
export declare function causeGap(tool: TraceCauseOperation, code: GapCode, capture?: SnapshotCapture | true): string;
|
|
7
|
+
export declare function causeGap(tool: TraceCauseOperation, code: GapCode, capture?: SnapshotCapture | true, storage?: StoredAssessment, maxChars?: number): string;
|
|
6
8
|
/** A clipped proof must never leave behind a seemingly supported root or apparently complete empty list. */
|
|
7
|
-
export declare function causeResponse(tool: TraceCauseOperation, finding: unknown, interpretation: string, maxChars: number, capture?: SnapshotCapture | true): string;
|
|
9
|
+
export declare function causeResponse(tool: TraceCauseOperation, finding: unknown, interpretation: string, maxChars: number, capture?: SnapshotCapture | true, storage?: StoredAssessment): string;
|
|
10
|
+
export {};
|