footprintjs 9.48.2 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +12 -10
- package/CLAUDE.md +21 -23
- package/README.md +1 -1
- package/dist/advanced.js +71 -128
- package/dist/esm/advanced.d.ts +24 -58
- package/dist/esm/advanced.js +13 -51
- package/dist/esm/index.d.ts +5 -8
- package/dist/esm/index.js +3 -3
- package/dist/esm/lib/builder/FlowChartBuilder.d.ts +1 -1
- package/dist/esm/lib/builder/FlowChartBuilder.js +3 -3
- package/dist/esm/lib/builder/structure/StructureRecorder.d.ts +1 -1
- package/dist/esm/lib/builder/structure/StructureRecorder.js +1 -1
- package/dist/esm/lib/capture/index.d.ts +0 -1
- package/dist/esm/lib/capture/index.js +1 -2
- package/dist/esm/lib/engine/graph/prefixNodeTree.js +2 -2
- package/dist/esm/lib/engine/handlers/ResumeEntry.d.ts +3 -3
- package/dist/esm/lib/engine/handlers/ResumeEntry.js +4 -4
- package/dist/esm/lib/engine/handlers/SubflowExecutor.d.ts +1 -2
- package/dist/esm/lib/engine/handlers/SubflowExecutor.js +4 -8
- package/dist/esm/lib/engine/index.d.ts +1 -1
- package/dist/esm/lib/engine/index.js +1 -1
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -4
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +1 -1
- package/dist/esm/lib/engine/narrative/index.d.ts +1 -1
- package/dist/esm/lib/engine/narrative/index.js +1 -1
- package/dist/esm/lib/engine/narrative/narrativeTypes.d.ts +1 -11
- package/dist/esm/lib/engine/narrative/narrativeTypes.js +1 -1
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +2 -10
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +4 -6
- package/dist/esm/lib/engine/traversalContext.d.ts +1 -1
- package/dist/esm/lib/engine/traversalContext.js +2 -2
- package/dist/esm/lib/engine/types.d.ts +2 -10
- package/dist/esm/lib/engine/types.js +1 -1
- package/dist/esm/lib/engine/walkSubflowSpec.js +2 -2
- package/dist/esm/lib/ids/reservedIds.js +2 -2
- package/dist/esm/lib/memory/DiagnosticCollector.js +2 -2
- package/dist/esm/lib/memory/StageContext.d.ts +2 -4
- package/dist/esm/lib/memory/StageContext.js +2 -2
- package/dist/esm/lib/memory/borrowedMutation.js +2 -2
- package/dist/esm/lib/memory/index.d.ts +6 -21
- package/dist/esm/lib/memory/index.js +4 -22
- package/dist/esm/lib/memory/redaction.d.ts +1 -1
- package/dist/esm/lib/memory/redaction.js +2 -2
- package/dist/esm/lib/memory/runPolicy.d.ts +3 -2
- package/dist/esm/lib/memory/runPolicy.js +1 -1
- package/dist/esm/lib/reactive/createTypedScope.js +2 -2
- package/dist/esm/lib/reactive/writeTraps.js +2 -2
- package/dist/esm/lib/recorder/ControlDepRecorder.d.ts +3 -2
- package/dist/esm/lib/recorder/ControlDepRecorder.js +3 -2
- package/dist/esm/lib/recorder/EmitRecorder.d.ts +1 -1
- package/dist/esm/lib/recorder/EmitRecorder.js +1 -1
- package/dist/esm/lib/recorder/InOutRecorder.js +2 -2
- package/dist/esm/lib/recorder/qualityTrace.d.ts +1 -1
- package/dist/esm/lib/recorder/qualityTrace.js +2 -2
- package/dist/esm/lib/runner/DeferredObserverTier.js +2 -2
- package/dist/esm/lib/runner/ExecutionRuntime.d.ts +4 -5
- package/dist/esm/lib/runner/ExecutionRuntime.js +2 -5
- package/dist/esm/lib/runner/FlowChartExecutor.d.ts +1 -1
- package/dist/esm/lib/runner/FlowChartExecutor.js +1 -1
- package/dist/esm/lib/runner/getSubtreeSnapshot.d.ts +1 -1
- package/dist/esm/lib/runner/getSubtreeSnapshot.js +4 -4
- package/dist/esm/lib/runner/resume.js +2 -2
- package/dist/esm/lib/runner/snapshot.js +3 -2
- package/dist/esm/lib/scope/ScopeFacade.js +2 -2
- package/dist/esm/lib/scope/state/zod/scopeFactory.js +2 -2
- package/dist/esm/recorders.d.ts +2 -3
- package/dist/esm/recorders.js +1 -1
- package/dist/esm/trace.d.ts +11 -57
- package/dist/esm/trace.js +10 -68
- package/dist/index.js +3 -3
- package/dist/lib/builder/FlowChartBuilder.js +5 -5
- package/dist/lib/builder/structure/StructureRecorder.js +1 -1
- package/dist/lib/capture/index.js +2 -4
- package/dist/lib/engine/graph/prefixNodeTree.js +5 -5
- package/dist/lib/engine/handlers/ResumeEntry.js +4 -4
- package/dist/lib/engine/handlers/SubflowExecutor.js +5 -9
- package/dist/lib/engine/index.js +1 -1
- package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +1 -1
- package/dist/lib/engine/narrative/index.js +1 -1
- package/dist/lib/engine/narrative/narrativeTypes.js +1 -1
- package/dist/lib/engine/traversal/FlowchartTraverser.js +8 -10
- package/dist/lib/engine/traversalContext.js +4 -4
- package/dist/lib/engine/types.js +1 -1
- package/dist/lib/engine/walkSubflowSpec.js +3 -3
- package/dist/lib/ids/reservedIds.js +5 -5
- package/dist/lib/memory/DiagnosticCollector.js +3 -3
- package/dist/lib/memory/StageContext.js +3 -3
- package/dist/lib/memory/borrowedMutation.js +3 -3
- package/dist/lib/memory/index.js +7 -42
- package/dist/lib/memory/redaction.js +3 -3
- package/dist/lib/memory/runPolicy.js +1 -1
- package/dist/lib/reactive/createTypedScope.js +3 -3
- package/dist/lib/reactive/writeTraps.js +4 -4
- package/dist/lib/recorder/ControlDepRecorder.js +3 -2
- package/dist/lib/recorder/EmitRecorder.js +1 -1
- package/dist/lib/recorder/InOutRecorder.js +3 -3
- package/dist/lib/recorder/qualityTrace.js +4 -4
- package/dist/lib/runner/DeferredObserverTier.js +3 -3
- package/dist/lib/runner/ExecutionRuntime.js +6 -9
- package/dist/lib/runner/FlowChartExecutor.js +1 -1
- package/dist/lib/runner/getSubtreeSnapshot.js +6 -6
- package/dist/lib/runner/resume.js +3 -3
- package/dist/lib/runner/snapshot.js +6 -5
- package/dist/lib/scope/ScopeFacade.js +3 -3
- package/dist/lib/scope/state/zod/scopeFactory.js +4 -4
- package/dist/recorders.js +1 -1
- package/dist/trace.js +18 -120
- package/dist/types/advanced.d.ts +24 -58
- package/dist/types/index.d.ts +5 -8
- package/dist/types/lib/builder/FlowChartBuilder.d.ts +1 -1
- package/dist/types/lib/builder/structure/StructureRecorder.d.ts +1 -1
- package/dist/types/lib/capture/index.d.ts +0 -1
- package/dist/types/lib/engine/handlers/ResumeEntry.d.ts +3 -3
- package/dist/types/lib/engine/handlers/SubflowExecutor.d.ts +1 -2
- package/dist/types/lib/engine/index.d.ts +1 -1
- package/dist/types/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -4
- package/dist/types/lib/engine/narrative/index.d.ts +1 -1
- package/dist/types/lib/engine/narrative/narrativeTypes.d.ts +1 -11
- package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +2 -10
- package/dist/types/lib/engine/traversalContext.d.ts +1 -1
- package/dist/types/lib/engine/types.d.ts +2 -10
- package/dist/types/lib/memory/StageContext.d.ts +2 -4
- package/dist/types/lib/memory/index.d.ts +6 -21
- package/dist/types/lib/memory/redaction.d.ts +1 -1
- package/dist/types/lib/memory/runPolicy.d.ts +3 -2
- package/dist/types/lib/recorder/ControlDepRecorder.d.ts +3 -2
- package/dist/types/lib/recorder/EmitRecorder.d.ts +1 -1
- package/dist/types/lib/recorder/qualityTrace.d.ts +1 -1
- package/dist/types/lib/runner/ExecutionRuntime.d.ts +4 -5
- package/dist/types/lib/runner/FlowChartExecutor.d.ts +1 -1
- package/dist/types/lib/runner/getSubtreeSnapshot.d.ts +1 -1
- package/dist/types/recorders.d.ts +2 -3
- package/dist/types/trace.d.ts +11 -57
- package/package.json +6 -15
- package/dist/esm/lib/capture/freeze.d.ts +0 -91
- package/dist/esm/lib/capture/freeze.js +0 -314
- package/dist/esm/lib/capture/ownData.d.ts +0 -7
- package/dist/esm/lib/capture/ownData.js +0 -15
- package/dist/esm/lib/capture/valueKinds.d.ts +0 -57
- package/dist/esm/lib/capture/valueKinds.js +0 -142
- package/dist/esm/lib/ids/runtimeStageId.d.ts +0 -173
- package/dist/esm/lib/ids/runtimeStageId.js +0 -194
- package/dist/esm/lib/memory/EventLog.d.ts +0 -105
- package/dist/esm/lib/memory/EventLog.js +0 -148
- package/dist/esm/lib/memory/RecordFrame.d.ts +0 -232
- package/dist/esm/lib/memory/RecordFrame.js +0 -296
- package/dist/esm/lib/memory/SharedMemory.d.ts +0 -46
- package/dist/esm/lib/memory/SharedMemory.js +0 -88
- package/dist/esm/lib/memory/TransactionBuffer.d.ts +0 -521
- package/dist/esm/lib/memory/TransactionBuffer.js +0 -946
- package/dist/esm/lib/memory/admission.d.ts +0 -81
- package/dist/esm/lib/memory/admission.js +0 -153
- package/dist/esm/lib/memory/backtrack.d.ts +0 -286
- package/dist/esm/lib/memory/backtrack.js +0 -457
- package/dist/esm/lib/memory/commitLogUtils.d.ts +0 -217
- package/dist/esm/lib/memory/commitLogUtils.js +0 -384
- package/dist/esm/lib/memory/deltaEncoding.d.ts +0 -66
- package/dist/esm/lib/memory/deltaEncoding.js +0 -122
- package/dist/esm/lib/memory/equality.d.ts +0 -93
- package/dist/esm/lib/memory/equality.js +0 -262
- package/dist/esm/lib/memory/eventPosition.d.ts +0 -18
- package/dist/esm/lib/memory/eventPosition.js +0 -2
- package/dist/esm/lib/memory/honesty.d.ts +0 -93
- package/dist/esm/lib/memory/honesty.js +0 -92
- package/dist/esm/lib/memory/keyPaths.d.ts +0 -125
- package/dist/esm/lib/memory/keyPaths.js +0 -227
- package/dist/esm/lib/memory/logModel.d.ts +0 -76
- package/dist/esm/lib/memory/logModel.js +0 -364
- package/dist/esm/lib/memory/merge.d.ts +0 -26
- package/dist/esm/lib/memory/merge.js +0 -60
- package/dist/esm/lib/memory/pathOps.d.ts +0 -115
- package/dist/esm/lib/memory/pathOps.js +0 -290
- package/dist/esm/lib/memory/paths.d.ts +0 -52
- package/dist/esm/lib/memory/paths.js +0 -57
- package/dist/esm/lib/memory/placeholders.d.ts +0 -39
- package/dist/esm/lib/memory/placeholders.js +0 -40
- package/dist/esm/lib/memory/recordCommit.d.ts +0 -45
- package/dist/esm/lib/memory/recordCommit.js +0 -61
- package/dist/esm/lib/memory/scrub.d.ts +0 -53
- package/dist/esm/lib/memory/scrub.js +0 -74
- package/dist/esm/lib/memory/types.d.ts +0 -209
- package/dist/esm/lib/memory/types.js +0 -10
- package/dist/esm/lib/memory/utils.d.ts +0 -73
- package/dist/esm/lib/memory/utils.js +0 -159
- package/dist/esm/lib/memory/verbs.d.ts +0 -333
- package/dist/esm/lib/memory/verbs.js +0 -427
- package/dist/esm/lib/recorder/CommitRangeIndex.d.ts +0 -147
- package/dist/esm/lib/recorder/CommitRangeIndex.js +0 -207
- package/dist/esm/lib/scope/detectCircular.d.ts +0 -13
- package/dist/esm/lib/scope/detectCircular.js +0 -14
- package/dist/esm/lib/scope/recorders/summarizeValue.d.ts +0 -5
- package/dist/esm/lib/scope/recorders/summarizeValue.js +0 -6
- package/dist/esm/lib/slice/elementProvenance.d.ts +0 -81
- package/dist/esm/lib/slice/elementProvenance.js +0 -190
- package/dist/esm/lib/slice/forwardSliceForKey.d.ts +0 -88
- package/dist/esm/lib/slice/forwardSliceForKey.js +0 -243
- package/dist/esm/lib/slice/index.d.ts +0 -25
- package/dist/esm/lib/slice/index.js +0 -25
- package/dist/esm/lib/slice/keyIndex.d.ts +0 -137
- package/dist/esm/lib/slice/keyIndex.js +0 -293
- package/dist/esm/lib/slice/keyTimeline.d.ts +0 -49
- package/dist/esm/lib/slice/keyTimeline.js +0 -113
- package/dist/esm/lib/slice/keysReadSources.d.ts +0 -51
- package/dist/esm/lib/slice/keysReadSources.js +0 -95
- package/dist/esm/lib/slice/serialize.d.ts +0 -78
- package/dist/esm/lib/slice/serialize.js +0 -278
- package/dist/esm/lib/slice/sliceForKey.d.ts +0 -47
- package/dist/esm/lib/slice/sliceForKey.js +0 -88
- package/dist/esm/lib/slice/types.d.ts +0 -567
- package/dist/esm/lib/slice/types.js +0 -25
- package/dist/esm/lib/time-travel/axis.d.ts +0 -119
- package/dist/esm/lib/time-travel/axis.js +0 -179
- package/dist/esm/lib/time-travel/bundles.d.ts +0 -77
- package/dist/esm/lib/time-travel/bundles.js +0 -136
- package/dist/esm/lib/time-travel/chain.d.ts +0 -93
- package/dist/esm/lib/time-travel/chain.js +0 -188
- package/dist/esm/lib/time-travel/commitStops.d.ts +0 -55
- package/dist/esm/lib/time-travel/commitStops.js +0 -202
- package/dist/esm/lib/time-travel/index.d.ts +0 -22
- package/dist/esm/lib/time-travel/index.js +0 -21
- package/dist/esm/lib/time-travel/stateAt.d.ts +0 -102
- package/dist/esm/lib/time-travel/stateAt.js +0 -153
- package/dist/esm/lib/time-travel/tagStops.d.ts +0 -72
- package/dist/esm/lib/time-travel/tagStops.js +0 -102
- package/dist/esm/lib/time-travel/timeTravel.d.ts +0 -70
- package/dist/esm/lib/time-travel/timeTravel.js +0 -360
- package/dist/esm/lib/time-travel/types.d.ts +0 -470
- package/dist/esm/lib/time-travel/types.js +0 -23
- package/dist/esm/write.d.ts +0 -47
- package/dist/esm/write.js +0 -46
- package/dist/lib/capture/freeze.js +0 -320
- package/dist/lib/capture/ownData.js +0 -19
- package/dist/lib/capture/valueKinds.js +0 -146
- package/dist/lib/ids/runtimeStageId.js +0 -210
- package/dist/lib/memory/EventLog.js +0 -152
- package/dist/lib/memory/RecordFrame.js +0 -300
- package/dist/lib/memory/SharedMemory.js +0 -92
- package/dist/lib/memory/TransactionBuffer.js +0 -950
- package/dist/lib/memory/admission.js +0 -159
- package/dist/lib/memory/backtrack.js +0 -463
- package/dist/lib/memory/commitLogUtils.js +0 -399
- package/dist/lib/memory/deltaEncoding.js +0 -128
- package/dist/lib/memory/equality.js +0 -266
- package/dist/lib/memory/eventPosition.js +0 -3
- package/dist/lib/memory/honesty.js +0 -95
- package/dist/lib/memory/keyPaths.js +0 -243
- package/dist/lib/memory/logModel.js +0 -372
- package/dist/lib/memory/merge.js +0 -64
- package/dist/lib/memory/pathOps.js +0 -306
- package/dist/lib/memory/paths.js +0 -62
- package/dist/lib/memory/placeholders.js +0 -43
- package/dist/lib/memory/recordCommit.js +0 -65
- package/dist/lib/memory/scrub.js +0 -79
- package/dist/lib/memory/types.js +0 -11
- package/dist/lib/memory/utils.js +0 -178
- package/dist/lib/memory/verbs.js +0 -444
- package/dist/lib/recorder/CommitRangeIndex.js +0 -211
- package/dist/lib/scope/detectCircular.js +0 -21
- package/dist/lib/scope/recorders/summarizeValue.js +0 -10
- package/dist/lib/slice/elementProvenance.js +0 -195
- package/dist/lib/slice/forwardSliceForKey.js +0 -247
- package/dist/lib/slice/index.js +0 -42
- package/dist/lib/slice/keyIndex.js +0 -313
- package/dist/lib/slice/keyTimeline.js +0 -117
- package/dist/lib/slice/keysReadSources.js +0 -101
- package/dist/lib/slice/serialize.js +0 -286
- package/dist/lib/slice/sliceForKey.js +0 -93
- package/dist/lib/slice/types.js +0 -26
- package/dist/lib/time-travel/axis.js +0 -184
- package/dist/lib/time-travel/bundles.js +0 -144
- package/dist/lib/time-travel/chain.js +0 -193
- package/dist/lib/time-travel/commitStops.js +0 -206
- package/dist/lib/time-travel/index.js +0 -32
- package/dist/lib/time-travel/stateAt.js +0 -160
- package/dist/lib/time-travel/tagStops.js +0 -106
- package/dist/lib/time-travel/timeTravel.js +0 -364
- package/dist/lib/time-travel/types.js +0 -24
- package/dist/types/lib/capture/freeze.d.ts +0 -91
- package/dist/types/lib/capture/ownData.d.ts +0 -7
- package/dist/types/lib/capture/valueKinds.d.ts +0 -57
- package/dist/types/lib/ids/runtimeStageId.d.ts +0 -173
- package/dist/types/lib/memory/EventLog.d.ts +0 -105
- package/dist/types/lib/memory/RecordFrame.d.ts +0 -232
- package/dist/types/lib/memory/SharedMemory.d.ts +0 -46
- package/dist/types/lib/memory/TransactionBuffer.d.ts +0 -521
- package/dist/types/lib/memory/admission.d.ts +0 -81
- package/dist/types/lib/memory/backtrack.d.ts +0 -286
- package/dist/types/lib/memory/commitLogUtils.d.ts +0 -217
- package/dist/types/lib/memory/deltaEncoding.d.ts +0 -66
- package/dist/types/lib/memory/equality.d.ts +0 -93
- package/dist/types/lib/memory/eventPosition.d.ts +0 -18
- package/dist/types/lib/memory/honesty.d.ts +0 -93
- package/dist/types/lib/memory/keyPaths.d.ts +0 -125
- package/dist/types/lib/memory/logModel.d.ts +0 -76
- package/dist/types/lib/memory/merge.d.ts +0 -26
- package/dist/types/lib/memory/pathOps.d.ts +0 -115
- package/dist/types/lib/memory/paths.d.ts +0 -52
- package/dist/types/lib/memory/placeholders.d.ts +0 -39
- package/dist/types/lib/memory/recordCommit.d.ts +0 -45
- package/dist/types/lib/memory/scrub.d.ts +0 -53
- package/dist/types/lib/memory/types.d.ts +0 -209
- package/dist/types/lib/memory/utils.d.ts +0 -73
- package/dist/types/lib/memory/verbs.d.ts +0 -333
- package/dist/types/lib/recorder/CommitRangeIndex.d.ts +0 -147
- package/dist/types/lib/scope/detectCircular.d.ts +0 -13
- package/dist/types/lib/scope/recorders/summarizeValue.d.ts +0 -5
- package/dist/types/lib/slice/elementProvenance.d.ts +0 -81
- package/dist/types/lib/slice/forwardSliceForKey.d.ts +0 -88
- package/dist/types/lib/slice/index.d.ts +0 -25
- package/dist/types/lib/slice/keyIndex.d.ts +0 -137
- package/dist/types/lib/slice/keyTimeline.d.ts +0 -49
- package/dist/types/lib/slice/keysReadSources.d.ts +0 -51
- package/dist/types/lib/slice/serialize.d.ts +0 -78
- package/dist/types/lib/slice/sliceForKey.d.ts +0 -47
- package/dist/types/lib/slice/types.d.ts +0 -567
- package/dist/types/lib/time-travel/axis.d.ts +0 -119
- package/dist/types/lib/time-travel/bundles.d.ts +0 -77
- package/dist/types/lib/time-travel/chain.d.ts +0 -93
- package/dist/types/lib/time-travel/commitStops.d.ts +0 -55
- package/dist/types/lib/time-travel/index.d.ts +0 -22
- package/dist/types/lib/time-travel/stateAt.d.ts +0 -102
- package/dist/types/lib/time-travel/tagStops.d.ts +0 -72
- package/dist/types/lib/time-travel/timeTravel.d.ts +0 -70
- package/dist/types/lib/time-travel/types.d.ts +0 -470
- package/dist/types/write.d.ts +0 -47
- package/dist/write.js +0 -52
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tagStops — the stops a chart DECLARED, read back off its commit log.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS FILE EXISTS. `commitStops` is the only stop grammar the substrate
|
|
5
|
-
* knows: one stop per executed stage. Every richer axis — milestones, turns,
|
|
6
|
-
* tool calls — was a consumer's classifier over `runtimeStageId`: a switch
|
|
7
|
-
* that parses `#` and `/`, lives outside the recording, and goes stale when
|
|
8
|
-
* a stage is renamed. Since 9.21.0 the author can put NAMES on a stage at
|
|
9
|
-
* build time (`FlowChartBuilder.tag` / `options.tags`) and the engine stamps
|
|
10
|
-
* them on the stage's commit bundle (`CommitBundle.tags`). This strategy
|
|
11
|
-
* reads them back: a stored recording from ANY chart scrubs by its own
|
|
12
|
-
* milestones, with no id conventions in the reader.
|
|
13
|
-
*
|
|
14
|
-
* WHAT IT IS. One expression over `filterStops(commitStops(...))`: keep the
|
|
15
|
-
* stops whose FIRST bundle carries a tag (any of the asked-for ones, or any
|
|
16
|
-
* tag at all when none are asked for), give the survivors the log back, and
|
|
17
|
-
* carry the bundle's whole tag array as `Stop.meta`. Everything a filtering
|
|
18
|
-
* axis owes — the bookend guard, the re-partition so a dropped stage's
|
|
19
|
-
* commits fold into the tagged stop BEFORE them, `prologue` on a start that
|
|
20
|
-
* absorbed stages — comes from `filterStops`, stated once, in `axis.ts`.
|
|
21
|
-
*
|
|
22
|
-
* WHAT IT IS NOT. Not a second vocabulary: the strings are the consumer's,
|
|
23
|
-
* carried verbatim. Not a derivation: a stage with no declared tag gets no
|
|
24
|
-
* stop here, however recognisable its id — a reader that wants ids classified
|
|
25
|
-
* writes that keep rule itself (`filterStops`), or reads the fold
|
|
26
|
-
* (`stateAt`) and keeps by what changed. And not a re-walk: only a tag the
|
|
27
|
-
* engine actually stamped can put a stop on this axis.
|
|
28
|
-
*/
|
|
29
|
-
import type { TimeTravelStrategy } from './types.js';
|
|
30
|
-
/**
|
|
31
|
-
* A {@link TimeTravelStrategy} whose stops are the stages that carry a
|
|
32
|
-
* declared tag.
|
|
33
|
-
*
|
|
34
|
-
* **Keep rule: any-of.** A stop survives when its bundle's `tags` shares at
|
|
35
|
-
* least one name with `tags`; with `tags` omitted (or empty), every tagged
|
|
36
|
-
* stop survives. All-of, or a rule over more than the tags, is a
|
|
37
|
-
* `filterStops` call away — the library owns no vocabulary, so it owns no
|
|
38
|
-
* richer rule either.
|
|
39
|
-
*
|
|
40
|
-
* **Attribution by precedence.** An untagged stage's commits fold into the
|
|
41
|
-
* tagged stop BEFORE it (what `filterStops` does); the commits before the
|
|
42
|
-
* first tagged stage are absorbed by `'start'`, which then says
|
|
43
|
-
* `prologue: true`. A run with no tagged stage yields the two bookends only.
|
|
44
|
-
*
|
|
45
|
-
* **`meta` is the array.** Each kept stop carries its bundle's full `tags`
|
|
46
|
-
* (not just the ones asked for), so a reader that filtered on
|
|
47
|
-
* `'milestone:llm-turn'` can still see the stage was also `'audit'`.
|
|
48
|
-
*
|
|
49
|
-
* **The equivalence law.** `stateAt(stop)` at every kept stop equals
|
|
50
|
-
* `commitStops`'s fold at the same commit index — a filtering axis moves the
|
|
51
|
-
* stops, never the log.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { flowChart } from 'footprintjs';
|
|
56
|
-
* import { tagStops, timeTravel } from 'footprintjs/trace';
|
|
57
|
-
*
|
|
58
|
-
* const chart = flowChart<State>('Seed', seedFn, 'seed')
|
|
59
|
-
* .addFunction('Call model', callFn, 'call-llm')
|
|
60
|
-
* .tag('milestone:llm-turn')
|
|
61
|
-
* .addFunction('Route', routeFn, 'route')
|
|
62
|
-
* .tag('milestone:decision')
|
|
63
|
-
* .build();
|
|
64
|
-
*
|
|
65
|
-
* // …run it, keep the snapshot…
|
|
66
|
-
* const cursor = timeTravel(snapshot, { strategy: tagStops(['milestone:llm-turn']) });
|
|
67
|
-
* cursor.stops.map((s) => s.label); // ['Run start', 'Call model', 'Run end']
|
|
68
|
-
* cursor.stops[1].meta; // ['milestone:llm-turn']
|
|
69
|
-
* cursor.stops[0].prologue; // true — 'seed' ran before the first turn
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare function tagStops(tags?: readonly string[]): TimeTravelStrategy<readonly string[]>;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tagStops — the stops a chart DECLARED, read back off its commit log.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS FILE EXISTS. `commitStops` is the only stop grammar the substrate
|
|
5
|
-
* knows: one stop per executed stage. Every richer axis — milestones, turns,
|
|
6
|
-
* tool calls — was a consumer's classifier over `runtimeStageId`: a switch
|
|
7
|
-
* that parses `#` and `/`, lives outside the recording, and goes stale when
|
|
8
|
-
* a stage is renamed. Since 9.21.0 the author can put NAMES on a stage at
|
|
9
|
-
* build time (`FlowChartBuilder.tag` / `options.tags`) and the engine stamps
|
|
10
|
-
* them on the stage's commit bundle (`CommitBundle.tags`). This strategy
|
|
11
|
-
* reads them back: a stored recording from ANY chart scrubs by its own
|
|
12
|
-
* milestones, with no id conventions in the reader.
|
|
13
|
-
*
|
|
14
|
-
* WHAT IT IS. One expression over `filterStops(commitStops(...))`: keep the
|
|
15
|
-
* stops whose FIRST bundle carries a tag (any of the asked-for ones, or any
|
|
16
|
-
* tag at all when none are asked for), give the survivors the log back, and
|
|
17
|
-
* carry the bundle's whole tag array as `Stop.meta`. Everything a filtering
|
|
18
|
-
* axis owes — the bookend guard, the re-partition so a dropped stage's
|
|
19
|
-
* commits fold into the tagged stop BEFORE them, `prologue` on a start that
|
|
20
|
-
* absorbed stages — comes from `filterStops`, stated once, in `axis.ts`.
|
|
21
|
-
*
|
|
22
|
-
* WHAT IT IS NOT. Not a second vocabulary: the strings are the consumer's,
|
|
23
|
-
* carried verbatim. Not a derivation: a stage with no declared tag gets no
|
|
24
|
-
* stop here, however recognisable its id — a reader that wants ids classified
|
|
25
|
-
* writes that keep rule itself (`filterStops`), or reads the fold
|
|
26
|
-
* (`stateAt`) and keeps by what changed. And not a re-walk: only a tag the
|
|
27
|
-
* engine actually stamped can put a stop on this axis.
|
|
28
|
-
*/
|
|
29
|
-
import { filterStops } from './axis.js';
|
|
30
|
-
import { commitStops } from './commitStops.js';
|
|
31
|
-
/**
|
|
32
|
-
* The tags a stop's first bundle carries, or `undefined` when it carries
|
|
33
|
-
* none. Reads the bundle at `stop.commitIdx` — the FIRST commit of the
|
|
34
|
-
* stage, which is where `StageContext.commit` records the stamp (a fork
|
|
35
|
-
* child's repeat and a mount's exit — the bundles with a `phase` — carry
|
|
36
|
-
* none).
|
|
37
|
-
*/
|
|
38
|
-
function tagsAt(log, stop) {
|
|
39
|
-
const raw = log[stop.commitIdx]?.tags;
|
|
40
|
-
// A stored row is `unknown[]`-shaped until narrowed: keep only the strings,
|
|
41
|
-
// so a damaged row can never put a non-name into `Stop.meta`.
|
|
42
|
-
const tags = Array.isArray(raw) ? raw.filter((t) => typeof t === 'string') : [];
|
|
43
|
-
return tags.length > 0 ? tags : undefined;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* A {@link TimeTravelStrategy} whose stops are the stages that carry a
|
|
47
|
-
* declared tag.
|
|
48
|
-
*
|
|
49
|
-
* **Keep rule: any-of.** A stop survives when its bundle's `tags` shares at
|
|
50
|
-
* least one name with `tags`; with `tags` omitted (or empty), every tagged
|
|
51
|
-
* stop survives. All-of, or a rule over more than the tags, is a
|
|
52
|
-
* `filterStops` call away — the library owns no vocabulary, so it owns no
|
|
53
|
-
* richer rule either.
|
|
54
|
-
*
|
|
55
|
-
* **Attribution by precedence.** An untagged stage's commits fold into the
|
|
56
|
-
* tagged stop BEFORE it (what `filterStops` does); the commits before the
|
|
57
|
-
* first tagged stage are absorbed by `'start'`, which then says
|
|
58
|
-
* `prologue: true`. A run with no tagged stage yields the two bookends only.
|
|
59
|
-
*
|
|
60
|
-
* **`meta` is the array.** Each kept stop carries its bundle's full `tags`
|
|
61
|
-
* (not just the ones asked for), so a reader that filtered on
|
|
62
|
-
* `'milestone:llm-turn'` can still see the stage was also `'audit'`.
|
|
63
|
-
*
|
|
64
|
-
* **The equivalence law.** `stateAt(stop)` at every kept stop equals
|
|
65
|
-
* `commitStops`'s fold at the same commit index — a filtering axis moves the
|
|
66
|
-
* stops, never the log.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* import { flowChart } from 'footprintjs';
|
|
71
|
-
* import { tagStops, timeTravel } from 'footprintjs/trace';
|
|
72
|
-
*
|
|
73
|
-
* const chart = flowChart<State>('Seed', seedFn, 'seed')
|
|
74
|
-
* .addFunction('Call model', callFn, 'call-llm')
|
|
75
|
-
* .tag('milestone:llm-turn')
|
|
76
|
-
* .addFunction('Route', routeFn, 'route')
|
|
77
|
-
* .tag('milestone:decision')
|
|
78
|
-
* .build();
|
|
79
|
-
*
|
|
80
|
-
* // …run it, keep the snapshot…
|
|
81
|
-
* const cursor = timeTravel(snapshot, { strategy: tagStops(['milestone:llm-turn']) });
|
|
82
|
-
* cursor.stops.map((s) => s.label); // ['Run start', 'Call model', 'Run end']
|
|
83
|
-
* cursor.stops[1].meta; // ['milestone:llm-turn']
|
|
84
|
-
* cursor.stops[0].prologue; // true — 'seed' ran before the first turn
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export function tagStops(tags) {
|
|
88
|
-
const wanted = tags && tags.length > 0 ? new Set(tags) : undefined;
|
|
89
|
-
return {
|
|
90
|
-
stopsFor(commitLog, executionTree, subflowResults) {
|
|
91
|
-
return filterStops(commitStops(commitLog, executionTree, subflowResults), (stop) => {
|
|
92
|
-
const stamped = tagsAt(commitLog, stop);
|
|
93
|
-
if (!stamped)
|
|
94
|
-
return null;
|
|
95
|
-
if (wanted && !stamped.some((t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yZWUsXG4gICAgICBzdWJmbG93UmVzdWx0cz86IHVua25vd24sXG4gICAgKTogU3RvcDxyZWFkb25seSBzdHJpbmdbXT5bXSB7XG4gICAgICByZXR1cm4gZmlsdGVyU3RvcHM8cmVhZG9ubHkgc3RyaW5nW10+KGNvbW1pdFN0b3BzKGNvbW1pdExvZywgZXhlY3V0aW9uVHJlZSwgc3ViZmxvd1Jlc3VsdHMpLCAoc3RvcCkgPT4ge1xuICAgICAgICBjb25zdCBzdGFtcGVkID0gdGFnc0F0KGNvbW1pdExvZywgc3RvcCk7XG4gICAgICAgIGlmICghc3RhbXBlZCkgcmV0dXJuIG51bGw7XG4gICAgICAgIGlmICh3YW50ZWQgJiYgIXN0YW1wZWQuc29tZSgodGFnKSA9PiB3YW50ZWQuaGFzKHRhZykpKSByZXR1cm4gbnVsbDtcbiAgICAgICAgcmV0dXJuIHsgbWV0YTogc3RhbXBlZCB9O1xuICAgICAgfSk7XG4gICAgfSxcbiAgfTtcbn1cbiJdfQ==
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* timeTravel — a reader's cursor over a finished trace.
|
|
3
|
-
*
|
|
4
|
-
* The five laws this file implements (and the folder README states with an
|
|
5
|
-
* example each):
|
|
6
|
-
*
|
|
7
|
-
* 1. ONE cursor. This object holds the only position. `drill()` returns a
|
|
8
|
-
* separate cursor over a separate log, never a second position here.
|
|
9
|
-
* 2. A miss never moves. Every refusal returns the reason and leaves the
|
|
10
|
-
* cursor exactly where it was.
|
|
11
|
-
* 3. A fold result is detached. `stateAt` returns frozen, cloned state that
|
|
12
|
-
* shares nothing with the engine.
|
|
13
|
-
* 4. Marks live beside the log. They are the reader's notes, never written
|
|
14
|
-
* into the run's record.
|
|
15
|
-
* 5. Stops are DERIVED from the recorded log — read-time queries over
|
|
16
|
-
* collected data, never a re-walk that invents what was not recorded.
|
|
17
|
-
*
|
|
18
|
-
* A CHAIN (9.18.0) does not add a sixth law and does not bend these five: it
|
|
19
|
-
* is still one cursor, over sources that are still only read. What it adds is
|
|
20
|
-
* that the STEPS run across a pause/resume — see `chain.ts` for the ordering
|
|
21
|
-
* and lineage checks, and for why commit indices stay run-local.
|
|
22
|
-
*/
|
|
23
|
-
import type { TimeTravel, TimeTravelOptions, TimeTravelSource } from './types.js';
|
|
24
|
-
/**
|
|
25
|
-
* Open a reader's cursor over a finished run.
|
|
26
|
-
*
|
|
27
|
-
* Nothing here executes anything: `snapshot` is a record of a run that already
|
|
28
|
-
* happened, and every question is answered by reading it. A stored JSON
|
|
29
|
-
* snapshot works exactly like a live one — since 9.18.0 its `commitLog` may be
|
|
30
|
-
* an unvalidated `unknown[]`, narrowed per bundle where the fold reads it, so
|
|
31
|
-
* a replayed recording needs no cast.
|
|
32
|
-
*
|
|
33
|
-
* @param snapshot `executor.getSnapshot()`, or any object with the same
|
|
34
|
-
* shape — including one round-tripped through JSON, or a subflow subtree
|
|
35
|
-
* (`getSubtreeSnapshot()`, whose log is spelled `history`). An ARRAY of them
|
|
36
|
-
* is a CHAIN: a pause and its resume read as one axis (see below).
|
|
37
|
-
* @param options `strategy` chooses how stops are derived (default:
|
|
38
|
-
* `commitStops`, one stop per executed stage); `marks` seeds the cursor with
|
|
39
|
-
* bookmarks, e.g. restored from a saved reading session.
|
|
40
|
-
*
|
|
41
|
-
* @throws when a chain is not in run order, or its legs are not from one
|
|
42
|
-
* lineage — three checks, each with its own reason (see `chain.ts`):
|
|
43
|
-
* no `runtimeStageId` may appear in two legs; each leg's first execution
|
|
44
|
-
* index must be past the previous leg's last (the engine never resets the
|
|
45
|
-
* counter across a resume); and each leg's `initialState` must deep-equal
|
|
46
|
-
* the state the legs before it fold to — on a resume that base IS the state
|
|
47
|
-
* at the pause, so a foreign leg whose indices merely happen to be higher
|
|
48
|
-
* is refused too. The third check runs only where the record allows it: the
|
|
49
|
-
* later leg must carry an `initialState` and the earlier legs must fold from
|
|
50
|
-
* a real base with no unreadable rows; otherwise (an older recording with
|
|
51
|
-
* no base) the chain rests on the two index checks alone, and the fold's
|
|
52
|
-
* `basis` says what it stood on.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const tt = timeTravel(executor.getSnapshot());
|
|
57
|
-
* tt.jumpTo('score-risk#4');
|
|
58
|
-
* console.log(tt.changedSince()); // ['riskScore', 'tier']
|
|
59
|
-
* console.log(tt.stateAt().state); // state as that stage left it
|
|
60
|
-
* tt.mark('the bad one');
|
|
61
|
-
* const inner = tt.drill('sf-payment#7'); // a separate cursor, its own log
|
|
62
|
-
*
|
|
63
|
-
* // A pause and its resume, read as ONE axis:
|
|
64
|
-
* const chained = timeTravel([pausedSnapshot, resumedSnapshot]);
|
|
65
|
-
* chained.last(); // the run's real end
|
|
66
|
-
* chained.at()!.sourceIdx; // 1 — which leg the indices are in
|
|
67
|
-
* chained.jumpTo('approve#3'); // finds it in either leg
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare function timeTravel<TMeta = unknown>(snapshot: TimeTravelSource | readonly TimeTravelSource[], options?: TimeTravelOptions<TMeta>): TimeTravel<TMeta>;
|