footprintjs 11.2.0 → 12.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/dist/esm/index.d.ts +4 -20
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/attempt/policy.d.ts +1 -1
- package/dist/esm/lib/attempt/policy.js +2 -2
- package/dist/esm/lib/attempt/types.d.ts +2 -1
- package/dist/esm/lib/attempt/types.js +1 -1
- package/dist/esm/lib/budget/timeBudget.d.ts +13 -5
- package/dist/esm/lib/budget/timeBudget.js +28 -13
- package/dist/esm/lib/builder/FlowChartBuilder.d.ts +74 -35
- package/dist/esm/lib/builder/FlowChartBuilder.js +164 -112
- package/dist/esm/lib/builder/index.d.ts +3 -2
- package/dist/esm/lib/builder/index.js +4 -3
- package/dist/esm/lib/builder/retryLoop.d.ts +1 -1
- package/dist/esm/lib/builder/retryLoop.js +1 -1
- package/dist/esm/lib/builder/structure/StructureRecorder.d.ts +11 -14
- package/dist/esm/lib/builder/structure/StructureRecorder.js +3 -4
- package/dist/esm/lib/builder/structure/StructureRecorderDispatcher.js +18 -3
- package/dist/esm/lib/builder/types.d.ts +5 -4
- package/dist/esm/lib/builder/types.js +4 -3
- package/dist/esm/lib/capture/checkpointCapture.d.ts +1 -0
- package/dist/esm/lib/capture/checkpointCapture.js +10 -4
- package/dist/esm/lib/capture/envelope.d.ts +6 -3
- package/dist/esm/lib/capture/envelope.js +25 -10
- package/dist/esm/lib/capture/historyNote.js +3 -3
- package/dist/esm/lib/capture/nativeCoverage.d.ts +6 -0
- package/dist/esm/lib/capture/nativeCoverage.js +11 -1
- package/dist/esm/lib/capture/policies.d.ts +2 -2
- package/dist/esm/lib/capture/policies.js +3 -3
- package/dist/esm/lib/capture/summarize.d.ts +2 -1
- package/dist/esm/lib/capture/summarize.js +36 -8
- package/dist/esm/lib/contract/schema.js +14 -5
- package/dist/esm/lib/decide/types.d.ts +11 -8
- package/dist/esm/lib/decide/types.js +1 -1
- package/dist/esm/lib/detach/drivers/batch.js +2 -15
- package/dist/esm/lib/detach/drivers/immediate.js +3 -2
- package/dist/esm/lib/detach/drivers/sendBeacon.d.ts +4 -4
- package/dist/esm/lib/detach/drivers/sendBeacon.js +7 -6
- package/dist/esm/lib/detach/drivers/workerThread.d.ts +20 -1
- package/dist/esm/lib/detach/drivers/workerThread.js +56 -12
- package/dist/esm/lib/detach/errors.d.ts +7 -0
- package/dist/esm/lib/detach/errors.js +21 -0
- package/dist/esm/lib/detach/registry.d.ts +19 -18
- package/dist/esm/lib/detach/registry.js +20 -19
- package/dist/esm/lib/detach/spawn.d.ts +1 -2
- package/dist/esm/lib/detach/spawn.js +2 -3
- package/dist/esm/lib/detach/types.d.ts +6 -5
- package/dist/esm/lib/detach/types.js +5 -4
- package/dist/esm/lib/engine/handlers/ChildrenExecutor.js +3 -2
- package/dist/esm/lib/engine/handlers/DeciderHandler.js +8 -2
- package/dist/esm/lib/engine/handlers/NodeResolver.d.ts +9 -1
- package/dist/esm/lib/engine/handlers/NodeResolver.js +15 -8
- package/dist/esm/lib/engine/handlers/ParallelForEachHandler.d.ts +6 -1
- package/dist/esm/lib/engine/handlers/ParallelForEachHandler.js +150 -58
- package/dist/esm/lib/engine/handlers/RuntimeStructureManager.d.ts +9 -1
- package/dist/esm/lib/engine/handlers/RuntimeStructureManager.js +28 -17
- package/dist/esm/lib/engine/handlers/SelectorHandler.js +10 -3
- package/dist/esm/lib/engine/handlers/SubflowExecutor.d.ts +4 -2
- package/dist/esm/lib/engine/handlers/SubflowExecutor.js +55 -17
- package/dist/esm/lib/engine/handlers/SubflowInputMapper.js +33 -15
- package/dist/esm/lib/engine/handlers/mapperEdits.d.ts +23 -0
- package/dist/esm/lib/engine/handlers/mapperEdits.js +95 -0
- package/dist/esm/lib/engine/handlers/mapperScope.d.ts +81 -0
- package/dist/esm/lib/engine/handlers/mapperScope.js +151 -0
- package/dist/esm/lib/engine/handlers/plainObject.d.ts +15 -0
- package/dist/esm/lib/engine/handlers/plainObject.js +21 -0
- package/dist/esm/lib/engine/handlers/selectionProblem.d.ts +9 -0
- package/dist/esm/lib/engine/handlers/selectionProblem.js +15 -0
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -2
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +18 -10
- package/dist/esm/lib/engine/narrative/FlowRecorderDispatcher.d.ts +2 -2
- package/dist/esm/lib/engine/narrative/FlowRecorderDispatcher.js +1 -1
- package/dist/esm/lib/engine/narrative/NarrativeFlowRecorder.d.ts +3 -5
- package/dist/esm/lib/engine/narrative/NarrativeFlowRecorder.js +8 -25
- package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.js +10 -2
- package/dist/esm/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.d.ts +5 -1
- package/dist/esm/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.js +9 -5
- package/dist/esm/lib/engine/narrative/recorders/ManifestFlowRecorder.d.ts +9 -1
- package/dist/esm/lib/engine/narrative/recorders/ManifestFlowRecorder.js +27 -6
- package/dist/esm/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.d.ts +4 -0
- package/dist/esm/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.js +8 -1
- package/dist/esm/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.d.ts +2 -0
- package/dist/esm/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.js +6 -1
- package/dist/esm/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.d.ts +1 -1
- package/dist/esm/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.js +2 -2
- package/dist/esm/lib/engine/narrative/types.d.ts +1 -1
- package/dist/esm/lib/engine/narrative/types.js +1 -1
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +41 -44
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +74 -27
- package/dist/esm/lib/engine/types.d.ts +14 -4
- package/dist/esm/lib/engine/types.js +1 -1
- package/dist/esm/lib/filter/evaluator.d.ts +6 -0
- package/dist/esm/lib/filter/evaluator.js +144 -20
- package/dist/esm/lib/ids/reservedIds.d.ts +2 -2
- package/dist/esm/lib/ids/reservedIds.js +3 -3
- package/dist/esm/lib/memory/StageContext.d.ts +140 -10
- package/dist/esm/lib/memory/StageContext.js +292 -36
- package/dist/esm/lib/memory/borrowedMutation.d.ts +18 -0
- package/dist/esm/lib/memory/borrowedMutation.js +40 -1
- package/dist/esm/lib/memory/frameTypes.d.ts +6 -4
- package/dist/esm/lib/memory/frameTypes.js +2 -2
- package/dist/esm/lib/memory/hiddenObjectTrail.d.ts +118 -0
- package/dist/esm/lib/memory/hiddenObjectTrail.js +221 -0
- package/dist/esm/lib/memory/keptReads.d.ts +62 -0
- package/dist/esm/lib/memory/keptReads.js +79 -0
- package/dist/esm/lib/memory/markPlaces.d.ts +98 -0
- package/dist/esm/lib/memory/markPlaces.js +124 -0
- package/dist/esm/lib/memory/pathTargets.d.ts +48 -0
- package/dist/esm/lib/memory/pathTargets.js +89 -0
- package/dist/esm/lib/memory/redaction.d.ts +142 -24
- package/dist/esm/lib/memory/redaction.js +276 -87
- package/dist/esm/lib/memory/retainedValue/index.js +13 -2
- package/dist/esm/lib/memory/runPolicy.d.ts +10 -8
- package/dist/esm/lib/memory/runPolicy.js +3 -3
- package/dist/esm/lib/memory/selectedObjects.d.ts +215 -0
- package/dist/esm/lib/memory/selectedObjects.js +603 -0
- package/dist/esm/lib/memory/servedPlaces.d.ts +41 -0
- package/dist/esm/lib/memory/servedPlaces.js +138 -0
- package/dist/esm/lib/observer-queue/index.d.ts +3 -2
- package/dist/esm/lib/observer-queue/index.js +4 -3
- package/dist/esm/lib/pause/types.d.ts +8 -6
- package/dist/esm/lib/pause/types.js +8 -6
- package/dist/esm/lib/reactive/allowlist.d.ts +12 -3
- package/dist/esm/lib/reactive/allowlist.js +17 -6
- package/dist/esm/lib/reactive/arrayTraps.d.ts +10 -2
- package/dist/esm/lib/reactive/arrayTraps.js +117 -19
- package/dist/esm/lib/reactive/createTypedScope.js +35 -9
- package/dist/esm/lib/reactive/handles.js +3 -5
- package/dist/esm/lib/reactive/jsonProjection.d.ts +4 -4
- package/dist/esm/lib/reactive/jsonProjection.js +7 -9
- package/dist/esm/lib/reactive/liveView.d.ts +4 -1
- package/dist/esm/lib/reactive/liveView.js +10 -3
- package/dist/esm/lib/reactive/structuralWrite.js +23 -5
- package/dist/esm/lib/reactive/types.d.ts +6 -0
- package/dist/esm/lib/reactive/types.js +1 -1
- package/dist/esm/lib/reactive/writeTraps.d.ts +20 -1
- package/dist/esm/lib/reactive/writeTraps.js +78 -6
- package/dist/esm/lib/recorder/AttemptRecorder.js +2 -2
- package/dist/esm/lib/recorder/BoundaryStateStore.d.ts +4 -2
- package/dist/esm/lib/recorder/BoundaryStateStore.js +9 -6
- package/dist/esm/lib/recorder/CombinedRecorder.d.ts +4 -3
- package/dist/esm/lib/recorder/CombinedRecorder.js +3 -3
- package/dist/esm/lib/recorder/CompositeRecorder.d.ts +1 -1
- package/dist/esm/lib/recorder/CompositeRecorder.js +1 -1
- package/dist/esm/lib/recorder/ControlDepRecorder.d.ts +1 -1
- package/dist/esm/lib/recorder/ControlDepRecorder.js +2 -2
- package/dist/esm/lib/recorder/EmitRecorder.d.ts +1 -1
- package/dist/esm/lib/recorder/EmitRecorder.js +2 -2
- package/dist/esm/lib/recorder/QualityRecorder.js +5 -2
- package/dist/esm/lib/recorder/TopologyRecorder.js +14 -7
- package/dist/esm/lib/runner/ExecutionRuntime.d.ts +2 -3
- package/dist/esm/lib/runner/ExecutionRuntime.js +3 -4
- package/dist/esm/lib/runner/FlowChartExecutor.d.ts +12 -5
- package/dist/esm/lib/runner/FlowChartExecutor.js +43 -22
- package/dist/esm/lib/runner/RunContext.d.ts +25 -3
- package/dist/esm/lib/runner/RunContext.js +14 -5
- package/dist/esm/lib/runner/RunnableChart.d.ts +10 -3
- package/dist/esm/lib/runner/RunnableChart.js +45 -25
- package/dist/esm/lib/runner/deadline.d.ts +1 -0
- package/dist/esm/lib/runner/deadline.js +1 -1
- package/dist/esm/lib/runner/options.d.ts +6 -6
- package/dist/esm/lib/runner/options.js +1 -1
- package/dist/esm/lib/runner/recordSink.js +4 -2
- package/dist/esm/lib/runner/snapshot.js +3 -3
- package/dist/esm/lib/runner/stringifySnapshot.d.ts +4 -3
- package/dist/esm/lib/runner/stringifySnapshot.js +38 -4
- package/dist/esm/lib/schema/detect.d.ts +1 -6
- package/dist/esm/lib/schema/detect.js +2 -7
- package/dist/esm/lib/schema/validate.js +13 -3
- package/dist/esm/lib/scope/ScopeFacade.d.ts +4 -2
- package/dist/esm/lib/scope/ScopeFacade.js +17 -8
- package/dist/esm/lib/scope/protection/createProtectedScope.js +6 -19
- package/dist/esm/lib/scope/recorders/DebugRecorder.d.ts +1 -1
- package/dist/esm/lib/scope/recorders/DebugRecorder.js +2 -2
- package/dist/esm/lib/scope/state/zod/scopeFactory.js +33 -10
- package/dist/esm/lib/scope/state/zod/utils/validateHelper.js +1 -15
- package/dist/esm/lib/sinks/fileSink.d.ts +4 -1
- package/dist/esm/lib/sinks/fileSink.js +57 -28
- package/dist/esm/lib/sinks/indexedAdmission.d.ts +2 -0
- package/dist/esm/lib/sinks/indexedAdmission.js +11 -1
- package/dist/esm/lib/sinks/indexedRecordFile.js +3 -3
- package/dist/esm/lib/sinks/indexedScan.js +3 -4
- package/dist/esm/recorders.js +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/attempt/policy.js +2 -2
- package/dist/lib/attempt/types.js +1 -1
- package/dist/lib/budget/timeBudget.js +28 -13
- package/dist/lib/builder/FlowChartBuilder.js +163 -111
- package/dist/lib/builder/index.js +4 -3
- package/dist/lib/builder/retryLoop.js +1 -1
- package/dist/lib/builder/structure/StructureRecorder.js +3 -4
- package/dist/lib/builder/structure/StructureRecorderDispatcher.js +18 -3
- package/dist/lib/builder/types.js +4 -3
- package/dist/lib/capture/checkpointCapture.js +9 -3
- package/dist/lib/capture/envelope.js +25 -10
- package/dist/lib/capture/historyNote.js +2 -2
- package/dist/lib/capture/nativeCoverage.js +13 -2
- package/dist/lib/capture/policies.js +3 -3
- package/dist/lib/capture/summarize.js +36 -8
- package/dist/lib/contract/schema.js +14 -5
- package/dist/lib/decide/types.js +1 -1
- package/dist/lib/detach/drivers/batch.js +4 -17
- package/dist/lib/detach/drivers/immediate.js +3 -2
- package/dist/lib/detach/drivers/sendBeacon.js +7 -6
- package/dist/lib/detach/drivers/workerThread.js +56 -12
- package/dist/lib/detach/errors.js +25 -0
- package/dist/lib/detach/registry.js +20 -19
- package/dist/lib/detach/spawn.js +2 -3
- package/dist/lib/detach/types.js +5 -4
- package/dist/lib/engine/handlers/ChildrenExecutor.js +3 -2
- package/dist/lib/engine/handlers/DeciderHandler.js +8 -2
- package/dist/lib/engine/handlers/NodeResolver.js +15 -8
- package/dist/lib/engine/handlers/ParallelForEachHandler.js +150 -58
- package/dist/lib/engine/handlers/RuntimeStructureManager.js +28 -17
- package/dist/lib/engine/handlers/SelectorHandler.js +10 -3
- package/dist/lib/engine/handlers/SubflowExecutor.js +55 -17
- package/dist/lib/engine/handlers/SubflowInputMapper.js +35 -17
- package/dist/lib/engine/handlers/mapperEdits.js +99 -0
- package/dist/lib/engine/handlers/mapperScope.js +157 -0
- package/dist/lib/engine/handlers/plainObject.js +25 -0
- package/dist/lib/engine/handlers/selectionProblem.js +19 -0
- package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +18 -10
- package/dist/lib/engine/narrative/FlowRecorderDispatcher.js +1 -1
- package/dist/lib/engine/narrative/NarrativeFlowRecorder.js +8 -25
- package/dist/lib/engine/narrative/formatting/ruleEvidence/index.js +10 -2
- package/dist/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.js +9 -5
- package/dist/lib/engine/narrative/recorders/ManifestFlowRecorder.js +27 -6
- package/dist/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.js +8 -1
- package/dist/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.js +6 -1
- package/dist/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.js +2 -2
- package/dist/lib/engine/narrative/types.js +1 -1
- package/dist/lib/engine/traversal/FlowchartTraverser.js +74 -27
- package/dist/lib/engine/types.js +1 -1
- package/dist/lib/filter/evaluator.js +144 -20
- package/dist/lib/ids/reservedIds.js +3 -3
- package/dist/lib/memory/StageContext.js +290 -34
- package/dist/lib/memory/borrowedMutation.js +42 -2
- package/dist/lib/memory/frameTypes.js +2 -2
- package/dist/lib/memory/hiddenObjectTrail.js +225 -0
- package/dist/lib/memory/keptReads.js +83 -0
- package/dist/lib/memory/markPlaces.js +132 -0
- package/dist/lib/memory/pathTargets.js +95 -0
- package/dist/lib/memory/redaction.js +281 -90
- package/dist/lib/memory/retainedValue/index.js +13 -2
- package/dist/lib/memory/runPolicy.js +3 -3
- package/dist/lib/memory/selectedObjects.js +608 -0
- package/dist/lib/memory/servedPlaces.js +142 -0
- package/dist/lib/observer-queue/index.js +4 -3
- package/dist/lib/pause/types.js +8 -6
- package/dist/lib/reactive/allowlist.js +19 -7
- package/dist/lib/reactive/arrayTraps.js +116 -18
- package/dist/lib/reactive/createTypedScope.js +34 -8
- package/dist/lib/reactive/handles.js +3 -5
- package/dist/lib/reactive/jsonProjection.js +7 -9
- package/dist/lib/reactive/liveView.js +10 -3
- package/dist/lib/reactive/structuralWrite.js +23 -5
- package/dist/lib/reactive/types.js +1 -1
- package/dist/lib/reactive/writeTraps.js +82 -7
- package/dist/lib/recorder/AttemptRecorder.js +2 -2
- package/dist/lib/recorder/BoundaryStateStore.js +9 -6
- package/dist/lib/recorder/CombinedRecorder.js +3 -3
- package/dist/lib/recorder/CompositeRecorder.js +1 -1
- package/dist/lib/recorder/ControlDepRecorder.js +2 -2
- package/dist/lib/recorder/EmitRecorder.js +2 -2
- package/dist/lib/recorder/QualityRecorder.js +5 -2
- package/dist/lib/recorder/TopologyRecorder.js +14 -7
- package/dist/lib/runner/ExecutionRuntime.js +3 -4
- package/dist/lib/runner/FlowChartExecutor.js +43 -22
- package/dist/lib/runner/RunContext.js +14 -5
- package/dist/lib/runner/RunnableChart.js +47 -26
- package/dist/lib/runner/deadline.js +1 -1
- package/dist/lib/runner/options.js +1 -1
- package/dist/lib/runner/recordSink.js +4 -2
- package/dist/lib/runner/snapshot.js +3 -3
- package/dist/lib/runner/stringifySnapshot.js +38 -4
- package/dist/lib/schema/detect.js +2 -7
- package/dist/lib/schema/validate.js +13 -3
- package/dist/lib/scope/ScopeFacade.js +17 -8
- package/dist/lib/scope/protection/createProtectedScope.js +6 -19
- package/dist/lib/scope/recorders/DebugRecorder.js +2 -2
- package/dist/lib/scope/state/zod/scopeFactory.js +32 -9
- package/dist/lib/scope/state/zod/utils/validateHelper.js +1 -15
- package/dist/lib/sinks/fileSink.js +57 -28
- package/dist/lib/sinks/indexedAdmission.js +13 -2
- package/dist/lib/sinks/indexedRecordFile.js +2 -2
- package/dist/lib/sinks/indexedScan.js +2 -3
- package/dist/recorders.js +1 -1
- package/dist/types/index.d.ts +4 -20
- package/dist/types/lib/attempt/policy.d.ts +1 -1
- package/dist/types/lib/attempt/types.d.ts +2 -1
- package/dist/types/lib/budget/timeBudget.d.ts +13 -5
- package/dist/types/lib/builder/FlowChartBuilder.d.ts +74 -35
- package/dist/types/lib/builder/index.d.ts +3 -2
- package/dist/types/lib/builder/retryLoop.d.ts +1 -1
- package/dist/types/lib/builder/structure/StructureRecorder.d.ts +11 -14
- package/dist/types/lib/builder/types.d.ts +5 -4
- package/dist/types/lib/capture/checkpointCapture.d.ts +1 -0
- package/dist/types/lib/capture/envelope.d.ts +6 -3
- package/dist/types/lib/capture/nativeCoverage.d.ts +6 -0
- package/dist/types/lib/capture/policies.d.ts +2 -2
- package/dist/types/lib/capture/summarize.d.ts +2 -1
- package/dist/types/lib/decide/types.d.ts +11 -8
- package/dist/types/lib/detach/drivers/sendBeacon.d.ts +4 -4
- package/dist/types/lib/detach/drivers/workerThread.d.ts +20 -1
- package/dist/types/lib/detach/errors.d.ts +7 -0
- package/dist/types/lib/detach/registry.d.ts +19 -18
- package/dist/types/lib/detach/spawn.d.ts +1 -2
- package/dist/types/lib/detach/types.d.ts +6 -5
- package/dist/types/lib/engine/handlers/NodeResolver.d.ts +9 -1
- package/dist/types/lib/engine/handlers/ParallelForEachHandler.d.ts +6 -1
- package/dist/types/lib/engine/handlers/RuntimeStructureManager.d.ts +9 -1
- package/dist/types/lib/engine/handlers/SubflowExecutor.d.ts +4 -2
- package/dist/types/lib/engine/handlers/mapperEdits.d.ts +23 -0
- package/dist/types/lib/engine/handlers/mapperScope.d.ts +81 -0
- package/dist/types/lib/engine/handlers/plainObject.d.ts +15 -0
- package/dist/types/lib/engine/handlers/selectionProblem.d.ts +9 -0
- package/dist/types/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -2
- package/dist/types/lib/engine/narrative/FlowRecorderDispatcher.d.ts +2 -2
- package/dist/types/lib/engine/narrative/NarrativeFlowRecorder.d.ts +3 -5
- package/dist/types/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.d.ts +5 -1
- package/dist/types/lib/engine/narrative/recorders/ManifestFlowRecorder.d.ts +9 -1
- package/dist/types/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.d.ts +4 -0
- package/dist/types/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.d.ts +2 -0
- package/dist/types/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.d.ts +1 -1
- package/dist/types/lib/engine/narrative/types.d.ts +1 -1
- package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +41 -44
- package/dist/types/lib/engine/types.d.ts +14 -4
- package/dist/types/lib/filter/evaluator.d.ts +6 -0
- package/dist/types/lib/ids/reservedIds.d.ts +2 -2
- package/dist/types/lib/memory/StageContext.d.ts +140 -10
- package/dist/types/lib/memory/borrowedMutation.d.ts +18 -0
- package/dist/types/lib/memory/frameTypes.d.ts +6 -4
- package/dist/types/lib/memory/hiddenObjectTrail.d.ts +118 -0
- package/dist/types/lib/memory/keptReads.d.ts +62 -0
- package/dist/types/lib/memory/markPlaces.d.ts +98 -0
- package/dist/types/lib/memory/pathTargets.d.ts +48 -0
- package/dist/types/lib/memory/redaction.d.ts +142 -24
- package/dist/types/lib/memory/runPolicy.d.ts +10 -8
- package/dist/types/lib/memory/selectedObjects.d.ts +215 -0
- package/dist/types/lib/memory/servedPlaces.d.ts +41 -0
- package/dist/types/lib/observer-queue/index.d.ts +3 -2
- package/dist/types/lib/pause/types.d.ts +8 -6
- package/dist/types/lib/reactive/allowlist.d.ts +12 -3
- package/dist/types/lib/reactive/arrayTraps.d.ts +10 -2
- package/dist/types/lib/reactive/jsonProjection.d.ts +4 -4
- package/dist/types/lib/reactive/liveView.d.ts +4 -1
- package/dist/types/lib/reactive/types.d.ts +6 -0
- package/dist/types/lib/reactive/writeTraps.d.ts +20 -1
- package/dist/types/lib/recorder/BoundaryStateStore.d.ts +4 -2
- package/dist/types/lib/recorder/CombinedRecorder.d.ts +4 -3
- package/dist/types/lib/recorder/CompositeRecorder.d.ts +1 -1
- package/dist/types/lib/recorder/ControlDepRecorder.d.ts +1 -1
- package/dist/types/lib/recorder/EmitRecorder.d.ts +1 -1
- package/dist/types/lib/runner/ExecutionRuntime.d.ts +2 -3
- package/dist/types/lib/runner/FlowChartExecutor.d.ts +12 -5
- package/dist/types/lib/runner/RunContext.d.ts +25 -3
- package/dist/types/lib/runner/RunnableChart.d.ts +10 -3
- package/dist/types/lib/runner/deadline.d.ts +1 -0
- package/dist/types/lib/runner/options.d.ts +6 -6
- package/dist/types/lib/runner/stringifySnapshot.d.ts +4 -3
- package/dist/types/lib/schema/detect.d.ts +1 -6
- package/dist/types/lib/scope/ScopeFacade.d.ts +4 -2
- package/dist/types/lib/scope/recorders/DebugRecorder.d.ts +1 -1
- package/dist/types/lib/sinks/fileSink.d.ts +4 -1
- package/dist/types/lib/sinks/indexedAdmission.d.ts +2 -0
- package/package.json +6 -8
- package/dist/esm/lib/scope/state/installResolvers.d.ts +0 -4
- package/dist/esm/lib/scope/state/installResolvers.js +0 -15
- package/dist/lib/scope/state/installResolvers.js +0 -19
- package/dist/types/lib/scope/state/installResolvers.d.ts +0 -4
|
@@ -4,7 +4,26 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Pattern: Adapter — translates the consumer's child flowchart into
|
|
6
6
|
* a worker message + lifecycle handoff. The worker is owned
|
|
7
|
-
* by the driver instance
|
|
7
|
+
* by the driver instance (a given `worker`, or one built from
|
|
8
|
+
* `workerScript` on first use).
|
|
9
|
+
*
|
|
10
|
+
* When the worker stops:
|
|
11
|
+
* - Node (`worker.on`): `error` or `exit` means the worker is gone.
|
|
12
|
+
* Every in-flight handle fails and is unregistered, and the worker
|
|
13
|
+
* is dropped. The lost work is NOT retried. The next `schedule()`
|
|
14
|
+
* builds a fresh worker from `workerScript`; a given `worker`
|
|
15
|
+
* cannot be rebuilt, so its later handles fail. A late reply for a
|
|
16
|
+
* handle that already failed is ignored.
|
|
17
|
+
* - Web Worker (`addEventListener`): there is no stop signal. An
|
|
18
|
+
* uncaught error does not end a Web Worker, and its `error` event
|
|
19
|
+
* cannot be tied to one task, so the driver listens to `message`
|
|
20
|
+
* only. The worker must answer every message, failures included;
|
|
21
|
+
* a message it never answers leaves its handle `running`.
|
|
22
|
+
* - The driver never calls `terminate()`, on a worker you passed in or
|
|
23
|
+
* on one it built.
|
|
24
|
+
* - With `addDetachAndForget` nobody holds the handle, so a crash is
|
|
25
|
+
* visible only to code that keeps the handle or flushes
|
|
26
|
+
* (`flushAllDetached`).
|
|
8
27
|
* Role: CPU-isolation driver — when detached work is genuinely
|
|
9
28
|
* expensive (heavy parsing, hashing, image processing) and
|
|
10
29
|
* you don't want it blocking the main thread's event loop
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one rule every detach driver uses to turn a thrown value into the
|
|
3
|
+
* `Error` a failed handle carries. It never throws: a value that cannot even
|
|
4
|
+
* be described (a null-prototype object, a hostile or revoked Proxy) still
|
|
5
|
+
* settles the handle as failed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function asError(error: unknown): Error;
|
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pattern: Registry (GoF). Same shape as the cache strategy registry
|
|
5
5
|
* in agentfootprint v2.6 — a Map keyed by stable string id.
|
|
6
|
-
* Role: Glue between drivers and
|
|
7
|
-
* work it `register`s the handle here; later
|
|
8
|
-
*
|
|
6
|
+
* Role: Glue between drivers and `flushAllDetached`. When a driver
|
|
7
|
+
* schedules work it `register`s the handle here; later
|
|
8
|
+
* `flushAllDetached` and diagnostics `lookup` it by refId.
|
|
9
9
|
*
|
|
10
10
|
* Why a singleton?
|
|
11
|
-
* - refIds are minted per detach call
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* - refIds are minted per detach call (`spawn.ts`:
|
|
12
|
+
* `${runtimeStageId}:detach:${n}`, or `__executor__:detach:${n}`
|
|
13
|
+
* outside a stage)
|
|
14
|
+
* - handles are reached from MULTIPLE call sites (each driver
|
|
15
|
+
* registers and unregisters, `flushAllDetached` reads, tests reset)
|
|
16
|
+
* without each one
|
|
15
17
|
* having to thread a Registry instance through ten layers
|
|
16
18
|
* - one-source-of-truth simplifies "is this handle still alive?"
|
|
17
19
|
* queries during debugging
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
*
|
|
25
27
|
* Cleanup contract:
|
|
26
28
|
* - Drivers call `register(handle)` synchronously inside `schedule()`
|
|
27
|
-
* - Drivers
|
|
29
|
+
* - Drivers call `unregister(refId)` once the
|
|
28
30
|
* handle is terminal AND the consumer has had a chance to observe it
|
|
29
31
|
* - `_resetForTests()` clears every entry — tests only
|
|
30
32
|
*
|
|
@@ -42,10 +44,10 @@ import type { DetachHandle } from './types.js';
|
|
|
42
44
|
* inside `schedule()` so the handle is observable from the moment it
|
|
43
45
|
* exists.
|
|
44
46
|
*
|
|
45
|
-
* Replacing an existing registration is
|
|
46
|
-
*
|
|
47
|
-
* could
|
|
48
|
-
*
|
|
47
|
+
* Replacing an existing registration is a programming error (refIds are
|
|
48
|
+
* supposed to be unique). It does not throw — throwing inside a driver's
|
|
49
|
+
* hot path could cascade into the parent stage — and it does not warn:
|
|
50
|
+
* the new handle silently replaces the old one.
|
|
49
51
|
*/
|
|
50
52
|
export declare function register(handle: DetachHandle): void;
|
|
51
53
|
/**
|
|
@@ -53,16 +55,15 @@ export declare function register(handle: DetachHandle): void;
|
|
|
53
55
|
* caller decides whether that's an error or just a stale reference.
|
|
54
56
|
*
|
|
55
57
|
* Used by:
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
58
|
-
*
|
|
58
|
+
* - `flushAllDetached` (`flush.ts`: the handles still in flight)
|
|
59
|
+
* - Diagnostic tooling (`lookupDetachedHandle`: dump handle state for a
|
|
60
|
+
* refId in a log line)
|
|
59
61
|
*/
|
|
60
62
|
export declare function lookup(refId: string): DetachHandle | undefined;
|
|
61
63
|
/**
|
|
62
64
|
* Drop a handle from the registry. Idempotent — calling on an already-
|
|
63
65
|
* removed refId is a no-op (matches `Map.delete` semantics; useful when
|
|
64
|
-
* cleanup may
|
|
65
|
-
* post-terminal cleanup).
|
|
66
|
+
* cleanup may run more than once).
|
|
66
67
|
*/
|
|
67
68
|
export declare function unregister(refId: string): void;
|
|
68
69
|
/**
|
|
@@ -72,7 +73,7 @@ export declare function unregister(refId: string): void;
|
|
|
72
73
|
export declare function size(): number;
|
|
73
74
|
/**
|
|
74
75
|
* Diagnostic — every live refId. Use for "what's still in flight?"
|
|
75
|
-
* dumps during
|
|
76
|
+
* dumps during shutdown or oncall debugging.
|
|
76
77
|
*/
|
|
77
78
|
export declare function ids(): readonly string[];
|
|
78
79
|
/**
|
|
@@ -58,8 +58,7 @@ export declare function detachAndJoinLater(driver: DetachDriver, child: FlowChar
|
|
|
58
58
|
*
|
|
59
59
|
* Errors raised by the child are STILL routed to the handle's failed
|
|
60
60
|
* state (the driver does that). They just go unobserved unless something
|
|
61
|
-
* else (a recorder, logging) is wired to surface them.
|
|
62
|
-
* T7 for recommended observability patterns for "forget" detach.
|
|
61
|
+
* else (a recorder, logging) is wired to surface them.
|
|
63
62
|
*/
|
|
64
63
|
export declare function detachAndForget(driver: DetachDriver, child: FlowChart, input: unknown, sourcePrefix: string): void;
|
|
65
64
|
/** The name a late detach is recorded under: the child chart's root id — a name, never its input. */
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* Two sibling concepts:
|
|
10
10
|
*
|
|
11
11
|
* 1. `DetachDriver` — the algorithm that decides WHEN/HOW the work runs.
|
|
12
|
-
* Six built-in algorithms ship
|
|
13
|
-
*
|
|
14
|
-
* `
|
|
12
|
+
* Six built-in algorithms ship, algorithm-named: the singletons
|
|
13
|
+
* `microtaskBatchDriver`, `setImmediateDriver`, `setTimeoutDriver`,
|
|
14
|
+
* `immediateDriver`, and the factories `createSendBeaconDriver` and
|
|
15
|
+
* `createWorkerThreadDriver` (which need a URL or a worker).
|
|
15
16
|
* Consumers can implement their own (BYOS — bring your own driver).
|
|
16
17
|
*
|
|
17
18
|
* 2. `DetachHandle` — the consumer-facing handle returned by
|
|
@@ -74,8 +75,8 @@ export interface DetachWaitResult {
|
|
|
74
75
|
* to `failed`, without starting the child.
|
|
75
76
|
*/
|
|
76
77
|
export interface DetachHandle {
|
|
77
|
-
/** Stable id assigned at detach time.
|
|
78
|
-
* `
|
|
78
|
+
/** Stable id assigned at detach time. The key of the in-flight
|
|
79
|
+
* registry (`lookupDetachedHandle`). */
|
|
79
80
|
readonly id: string;
|
|
80
81
|
/** Current state. Read directly for sync access. */
|
|
81
82
|
readonly status: 'queued' | 'running' | 'done' | 'failed';
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Responsibilities:
|
|
5
5
|
* - Find nodes by ID via recursive depth-first search (for back-edge/loop support)
|
|
6
6
|
* - Resolve subflow reference nodes to actual subflow structures
|
|
7
|
-
* - Evaluate deciders to determine next node in branching scenarios
|
|
8
7
|
*/
|
|
9
8
|
import type { StageNode } from '../graph/StageNode.js';
|
|
10
9
|
import type { HandlerDeps } from '../types.js';
|
|
@@ -38,4 +37,13 @@ export declare class NodeResolver<TOut = any, TScope = any> {
|
|
|
38
37
|
* The actual structure lives in the subflows dictionary.
|
|
39
38
|
*/
|
|
40
39
|
resolveSubflowReference(node: StageNode<TOut, TScope>): StageNode<TOut, TScope>;
|
|
40
|
+
/**
|
|
41
|
+
* The node a mount runs: the definition's `root` under the mount's own identity.
|
|
42
|
+
* `resolveSubflowReference` builds it from the dictionary; a stage that RETURNS a
|
|
43
|
+
* sub-flowchart hands its definition's root here directly (`FlowchartTraverser`, Phase 0).
|
|
44
|
+
*
|
|
45
|
+
* `id` comes from the inner root (the actual stage identity for trace matching),
|
|
46
|
+
* not the mount node (which is the subflow entry point in the parent).
|
|
47
|
+
*/
|
|
48
|
+
mountOf(node: StageNode<TOut, TScope>, root: StageNode<TOut, TScope>): StageNode<TOut, TScope>;
|
|
41
49
|
}
|
|
@@ -9,7 +9,7 @@ import type { ChildrenExecutor } from './ChildrenExecutor.js';
|
|
|
9
9
|
* other handler in this directory.
|
|
10
10
|
*/
|
|
11
11
|
export interface ParallelForEachHooks<TOut = any, TScope = any> {
|
|
12
|
-
/** The traverser's `prefixNodeTree
|
|
12
|
+
/** The traverser's `prefixNodeTree`, which calls the one `engine/graph/prefixNodeTree.ts` the builder also uses. */
|
|
13
13
|
prefixNodeTree(node: StageNode<TOut, TScope>, prefix: string): StageNode<TOut, TScope>;
|
|
14
14
|
/** Register (OVERWRITING) a generated branch subflow + its stage functions. */
|
|
15
15
|
registerBranchSubflow(subflowId: string, root: StageNode<TOut, TScope>, chart: BranchChart): void;
|
|
@@ -28,6 +28,11 @@ export declare class ParallelForEachHandler<TOut = any, TScope = any> {
|
|
|
28
28
|
* Returns the results array (the stage's output).
|
|
29
29
|
*/
|
|
30
30
|
run(node: StageNode<TOut, TScope>, context: StageContext, branchPath: string | undefined, traversalContext: TraversalContext): Promise<unknown[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The stage's error path — see "A stage that fails still leaves its bundle"
|
|
33
|
+
* in the file header. The caller rethrows the original value.
|
|
34
|
+
*/
|
|
35
|
+
private endFailed;
|
|
31
36
|
/**
|
|
32
37
|
* Evaluate the items selector against the live scope. A non-array return is
|
|
33
38
|
* a chart bug, not a runtime condition — it fails loudly, naming the stage.
|
|
@@ -22,7 +22,15 @@ export declare class RuntimeStructureManager {
|
|
|
22
22
|
/** Returns the current runtime structure (mutated during execution). */
|
|
23
23
|
getStructure(): SerializedPipelineStructure | undefined;
|
|
24
24
|
private static readonly MAX_NODE_MAP_DEPTH;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Registers all nodes in the O(1) lookup map. Walks with an explicit stack
|
|
27
|
+
* (like the traverser's `buildNodeIdMap`), in pre-order: a node, its
|
|
28
|
+
* children, its `next`, then its subflow structure. A later node with the
|
|
29
|
+
* same id replaces an earlier one. A `next` hop adds no depth, so a chain
|
|
30
|
+
* of any length is mapped; children and subflow structures nest one level
|
|
31
|
+
* each, capped at MAX_NODE_MAP_DEPTH. A node object already visited is
|
|
32
|
+
* skipped, so a cyclic structure ends.
|
|
33
|
+
*/
|
|
26
34
|
private buildNodeMap;
|
|
27
35
|
/** Convert a runtime StageNode into a SerializedPipelineStructure node. */
|
|
28
36
|
stageNodeToStructure(node: StageNode): SerializedPipelineStructure;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import type { StageContext } from '../../memory/StageContext.js';
|
|
16
16
|
import type { StageNode } from '../graph/StageNode.js';
|
|
17
17
|
import type { TraversalContext } from '../narrative/types.js';
|
|
18
|
-
import type { HandlerDeps, SubflowResult, SubflowTraverserFactory } from '../types.js';
|
|
18
|
+
import type { HandlerDeps, ReturnedSubflowDefinition, SubflowResult, SubflowTraverserFactory } from '../types.js';
|
|
19
19
|
import type { BreakFlag } from './types.js';
|
|
20
20
|
export declare class SubflowExecutor<TOut = any, TScope = any> {
|
|
21
21
|
private deps;
|
|
@@ -35,5 +35,7 @@ export declare class SubflowExecutor<TOut = any, TScope = any> {
|
|
|
35
35
|
* 4. Applies output mapping to write results back to parent scope
|
|
36
36
|
* 5. Stores execution data for debugging/visualization
|
|
37
37
|
*/
|
|
38
|
-
executeSubflow(node: StageNode<TOut, TScope>, parentContext: StageContext, breakFlag: BreakFlag, branchPath: string | undefined, subflowResultsMap: Map<string, SubflowResult>, parentTraversalContext?: TraversalContext
|
|
38
|
+
executeSubflow(node: StageNode<TOut, TScope>, parentContext: StageContext, breakFlag: BreakFlag, branchPath: string | undefined, subflowResultsMap: Map<string, SubflowResult>, parentTraversalContext?: TraversalContext,
|
|
39
|
+
/** The definition a stage returned for this mount; absent for a mount the chart was built with. */
|
|
40
|
+
returned?: ReturnedSubflowDefinition<TOut, TScope>): Promise<any>;
|
|
39
41
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Which of a mount's two mappers a view was opened for. */
|
|
2
|
+
export type MapperRole = 'inputMapper' | 'outputMapper';
|
|
3
|
+
/** The watch over one mapper call. */
|
|
4
|
+
export interface MapperEditWatch {
|
|
5
|
+
/** The mapper is about to be handed `value` for the root key `key`. */
|
|
6
|
+
saw(key: string, value: unknown): void;
|
|
7
|
+
/** The call is over: report every value that no longer equals its copy. Does it once. */
|
|
8
|
+
report(): void;
|
|
9
|
+
}
|
|
10
|
+
/** What the watch asks of the mount: its name, and whether the run has a redaction rule that selects anything. */
|
|
11
|
+
export interface WatchedMount {
|
|
12
|
+
readonly stageName: string;
|
|
13
|
+
getPolicy(): {
|
|
14
|
+
readonly redaction?: {
|
|
15
|
+
isInert(): boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A watch for one call of `mapper` on `mount`, or `undefined` outside development mode: then no copy
|
|
21
|
+
* is taken and nothing is kept.
|
|
22
|
+
*/
|
|
23
|
+
export declare function watchForEdits(mount: WatchedMount, mapper: MapperRole): MapperEditWatch | undefined;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mapperScope.ts — what a subflow mapper is handed in place of the parent's state.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS FILE EXISTS. A subflow's `inputMapper` and `outputMapper` are user code that reads the
|
|
5
|
+
* parent's state. They used to be handed the state object itself, so what they read left no trace:
|
|
6
|
+
* the mount had no reads in the execution tree, and with per-write provenance its merge-back rows
|
|
7
|
+
* said they read nothing. A walk back from a value a subflow produced named the mount and stopped
|
|
8
|
+
* there, with no warning. Every stage before the mount was missing.
|
|
9
|
+
*
|
|
10
|
+
* WHAT IS HANDED NOW. A view of the parent's root keys. Reading a key gives the same live committed
|
|
11
|
+
* value as before, and is recorded as a read of the MOUNT through the one tracked-read funnel
|
|
12
|
+
* (`StageContext · readLiveRoot`): the read prefix, the rule's verdict, the taint count and
|
|
13
|
+
* `stageReads`. So the mount is a step like any other: it read these keys and then wrote its
|
|
14
|
+
* merge-back, and the walk back goes on through it.
|
|
15
|
+
*
|
|
16
|
+
* WHY A PROXY. The view must cost what the mapper READS, not what the state HOLDS. The first cut of
|
|
17
|
+
* this file defined one accessor per root key for every mapper call; a mount in a loop over a state
|
|
18
|
+
* of 500 keys ran 9 times slower although its mapper read one key (measured by the second reader of
|
|
19
|
+
* the change: 9.8 ms became 89 ms for 200 passes). A proxy is built in constant time and does work
|
|
20
|
+
* only for the keys that are asked for.
|
|
21
|
+
*
|
|
22
|
+
* WHAT A PROXY COSTS, AND HOW IT IS PAID. A proxy cannot be cloned, and a mapper may hand the view
|
|
23
|
+
* itself on (`(parent) => parent`, `{ everything: parent }`). So the view is registered as a HANDLE
|
|
24
|
+
* (`reactive/handles.ts`), the library's one law for its own proxies: wherever a mapper's result
|
|
25
|
+
* enters the record (`SubflowInputMapper` asks `unwrapHandles` for both mappers) the view is
|
|
26
|
+
* replaced by a plain record of its keys, every one of them read. Two things stay out of reach, and
|
|
27
|
+
* both fail loudly with a clone error, as they do for every handle of a typed scope: user code that
|
|
28
|
+
* clones the view itself (`structuredClone(parent)`), and a result that holds the view inside a
|
|
29
|
+
* `Map`, a `Set` or a class instance (the unwrapping walks plain objects and arrays only; walking
|
|
30
|
+
* every Map a run records would cost what the Map holds, at every boundary). `{ ...parent }` copies
|
|
31
|
+
* the view, and can be put anywhere.
|
|
32
|
+
*
|
|
33
|
+
* THE VIEW IS OPEN WHILE ITS MAPPER'S RESULT IS BEING TAKEN, and closed after (`close`). A view kept
|
|
34
|
+
* past that point would hand a later stage live state with no tracked read behind it, and record
|
|
35
|
+
* the read on a mount that committed long before (the second reader showed both). A closed view
|
|
36
|
+
* refuses a read with a message that says what to do.
|
|
37
|
+
*
|
|
38
|
+
* WHAT IS NOT RECORDED. A key listing (`Object.keys`, `in`) reads no value, so it records nothing;
|
|
39
|
+
* neither does a key the state does not hold (it reads `undefined`, as before), nor printing the view
|
|
40
|
+
* (`console.log(parent)` shows its key names). A read inside a value (`parent.profile.name`) is a read
|
|
41
|
+
* of the root key `profile`, as for any stage. An assignment, a definition or a deletion lands on the
|
|
42
|
+
* view, never on the state behind it.
|
|
43
|
+
*
|
|
44
|
+
* WHAT THE VIEW CANNOT STOP. The values it hands out are the live committed ones, so a change INSIDE a
|
|
45
|
+
* value (`parent.profile.name = 'x'`, `parent.list.push(1)`) edits committed state itself, and no row
|
|
46
|
+
* records it. Stopping that would mean wrapping every value a mapper reads. As for a stage, it is
|
|
47
|
+
* reported instead: development mode names the mount, the mapper, the key and the path. The view tells
|
|
48
|
+
* the watch what it hands out and when the call is over (`mapperEdits.ts`, which says why the judging
|
|
49
|
+
* is done per call).
|
|
50
|
+
*/
|
|
51
|
+
import type { StageContext } from '../../memory/StageContext.js';
|
|
52
|
+
import { type MapperRole } from './mapperEdits.js';
|
|
53
|
+
/** The view a mapper of one mount is handed, and the end of its life. */
|
|
54
|
+
export interface MapperScope<TParentScope> {
|
|
55
|
+
/** What the mapper is handed: the parent's root keys, each read tracked as the mount's. */
|
|
56
|
+
readonly scope: TParentScope;
|
|
57
|
+
/**
|
|
58
|
+
* The mapper's result has been taken: from now on a read of the parent's state is refused. In
|
|
59
|
+
* development mode this is also when the call is judged for a change it made in place.
|
|
60
|
+
*/
|
|
61
|
+
close(): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* What sees each read of a view, and hands the mapper its value: the redaction rule's taint
|
|
65
|
+
* (`memory/redaction.ts · MapperTaint · reads`), which may hand out a view of a record whose fields
|
|
66
|
+
* are selected in place of the record.
|
|
67
|
+
*/
|
|
68
|
+
export type MapperReadWatcher = (key: string, value: unknown) => unknown;
|
|
69
|
+
/** Is `scope` a view made by {@link mapperScope}? (The mapping helpers are also handed plain records.) */
|
|
70
|
+
export declare function isMapperView(scope: unknown): scope is object;
|
|
71
|
+
/**
|
|
72
|
+
* Have `watcher` see every read of the view `scope` from now on.
|
|
73
|
+
*
|
|
74
|
+
* WHY THE VIEW REPORTS ITS OWN READS. The taint used to learn what a mapper read by wrapping what it
|
|
75
|
+
* was handed in a second record with one accessor per key, for every mapper call. That is the cost
|
|
76
|
+
* this file exists to avoid: under a redaction policy a mount in a loop over a state of 500 keys paid
|
|
77
|
+
* for 500 accessors per mapper call to watch the one key that was read.
|
|
78
|
+
*/
|
|
79
|
+
export declare function watchMapperReads(scope: object, watcher: MapperReadWatcher): void;
|
|
80
|
+
/** Open the view of the parent's state for one call of `mapper` on `mount`. */
|
|
81
|
+
export declare function mapperScope<TParentScope>(mount: StageContext, mapper: MapperRole): MapperScope<TParentScope>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* plainObject.ts — what a subflow boundary treats as "an object with fields".
|
|
3
|
+
*
|
|
4
|
+
* A plain object is the only shape that is spread into per-field writes at a subflow boundary
|
|
5
|
+
* (`setObject([key], field, …)`, a row and a redaction verdict per field). A `Date`, `Map`, `Set` or
|
|
6
|
+
* class instance has no fields to spread and is a value in its own right: it lands WHOLE (until
|
|
7
|
+
* 9.24.0 it was spread into zero writes and silently vanished at both boundaries).
|
|
8
|
+
*
|
|
9
|
+
* WHY ITS OWN FILE. Two places must give the same answer: the merge-back (`SubflowInputMapper`), which
|
|
10
|
+
* merges what this calls a plain object and replaces everything else, and the report of a mapper that
|
|
11
|
+
* edits in place (`mapperEdits`), whose advice says what handing a value back will do. With two copies
|
|
12
|
+
* of the test the advice drifts from the merge-back (the third reader of that report found a `Map`
|
|
13
|
+
* told it would be merged). `mapperScope` sits between the two files, so neither can import the other.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* selectionProblem — what a selector's refused answer got wrong, for its error message.
|
|
3
|
+
*
|
|
4
|
+
* A selection is refused when an id names no child or names one child twice.
|
|
5
|
+
* The unknown ids are named first; with none, the ids named more than once.
|
|
6
|
+
* Used by `SelectorHandler · handleScopeBased` and
|
|
7
|
+
* `ChildrenExecutor · executeSelectedChildren`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function selectionProblem(selectedIds: readonly unknown[], unknownIds: readonly unknown[]): string;
|
|
@@ -48,7 +48,8 @@ export declare class CombinedNarrativeRecorder implements CombinedRecorder {
|
|
|
48
48
|
/** Dual-indexed ordered storage (Convention 1 — composed, not inherited). */
|
|
49
49
|
private readonly store;
|
|
50
50
|
/**
|
|
51
|
-
* Pending scope ops keyed by runtimeStageId. Flushed in onStageExecuted/onDecision
|
|
51
|
+
* Pending scope ops keyed by runtimeStageId. Flushed in onStageExecuted/onDecision;
|
|
52
|
+
* released untold for a selector stage and for a failed stage.
|
|
52
53
|
*
|
|
53
54
|
* Keying by runtimeStageId (not stageName) ensures correctness when parallel fork
|
|
54
55
|
* branches contain stages with the same name — each execution step has a unique ID.
|
|
@@ -107,7 +108,8 @@ export declare class CombinedNarrativeRecorder implements CombinedRecorder {
|
|
|
107
108
|
* before retry existed, kept. Its ATTEMPT lines are the exception (10.1):
|
|
108
109
|
* the stop reason is the point, so they follow the error line, in order,
|
|
109
110
|
* as its depth-1 sub-items. A stage with no retry policy buffers no attempt
|
|
110
|
-
* lines, so its failure narrates exactly as before.
|
|
111
|
+
* lines, so its failure narrates exactly as before. The stage's buffer is
|
|
112
|
+
* then released: nothing will narrate it later.
|
|
111
113
|
*/
|
|
112
114
|
private flushAttempts;
|
|
113
115
|
/** One attempt line — the consumer's `renderAttempt` first; `null` drops it, `undefined` falls back. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FlowRecorderDispatcher — Fans out control flow events to N attached FlowRecorders.
|
|
3
3
|
*
|
|
4
|
-
* Implements IControlFlowNarrative
|
|
5
|
-
*
|
|
4
|
+
* Implements IControlFlowNarrative, the shape of `HandlerDeps.narrativeGenerator`
|
|
5
|
+
* in the traverser.
|
|
6
6
|
*
|
|
7
7
|
* Every event goes through `recorder/hooks.ts · fire` (the one per-recorder loop): a failing
|
|
8
8
|
* recorder is warned about in dev mode and never breaks execution — even when what it threw
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NarrativeFlowRecorder — Default FlowRecorder that generates plain-English narrative.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A pluggable FlowRecorder: it can be swapped, extended, or composed. The
|
|
5
|
+
* sentence bodies it shares with the combined narrative live in
|
|
6
|
+
* `formatting/sentences.ts`.
|
|
7
7
|
*
|
|
8
8
|
* Consumers who want different narrative behavior (windowed loops, adaptive
|
|
9
9
|
* summarization, etc.) can replace this with a different FlowRecorder.
|
|
@@ -12,8 +12,6 @@ import type { FlowAttemptEvent, FlowBreakEvent, FlowDecisionEvent, FlowErrorEven
|
|
|
12
12
|
export declare class NarrativeFlowRecorder implements FlowRecorder {
|
|
13
13
|
readonly id: string;
|
|
14
14
|
private sentences;
|
|
15
|
-
/** Parallel array: the actual stage name that produced each sentence. */
|
|
16
|
-
private stageNames;
|
|
17
15
|
/**
|
|
18
16
|
* The stage whose arrival `onLoop` / `onResume` just narrated. Its completion
|
|
19
17
|
* line would repeat that arrival ("Next, it moved on to X."), so the next
|
|
@@ -15,8 +15,12 @@ import type { FlowLoopEvent } from '../types.js';
|
|
|
15
15
|
export declare class AdaptiveNarrativeFlowRecorder extends NarrativeFlowRecorder {
|
|
16
16
|
private readonly threshold;
|
|
17
17
|
private readonly sampleRate;
|
|
18
|
-
private totalPerTarget;
|
|
19
18
|
private suppressedCount;
|
|
19
|
+
/**
|
|
20
|
+
* @param threshold - Passes told in full before sampling starts.
|
|
21
|
+
* @param sampleRate - After the threshold, tell every `sampleRate`-th pass.
|
|
22
|
+
* @throws RangeError when `sampleRate` is 0 or NaN: every pass after the threshold would be suppressed.
|
|
23
|
+
*/
|
|
20
24
|
constructor(threshold?: number, sampleRate?: number, id?: string);
|
|
21
25
|
onLoop(event: FlowLoopEvent): void;
|
|
22
26
|
/** Returns the number of suppressed loop sentences. */
|
|
@@ -57,8 +57,10 @@ export interface ManifestEntry {
|
|
|
57
57
|
}
|
|
58
58
|
export declare class ManifestFlowRecorder implements FlowRecorder {
|
|
59
59
|
readonly id: string;
|
|
60
|
-
/**
|
|
60
|
+
/** Open entries in entry order — the last one is the most recently entered. */
|
|
61
61
|
private stack;
|
|
62
|
+
/** The entry each open entry is nested in (absent for a root). Recorded at entry. */
|
|
63
|
+
private parents;
|
|
62
64
|
/** Root-level subflows (not nested inside another subflow). */
|
|
63
65
|
private roots;
|
|
64
66
|
/** Full specs stored from dynamic registration events. */
|
|
@@ -73,7 +75,13 @@ export declare class ManifestFlowRecorder implements FlowRecorder {
|
|
|
73
75
|
/** Per-series tallies of the series that retried, gave up or timed out. */
|
|
74
76
|
private readonly attemptBook;
|
|
75
77
|
constructor(id?: string);
|
|
78
|
+
/**
|
|
79
|
+
* The parent is the open entry of the subflow the mount stage ran in, read from the mount's
|
|
80
|
+
* `runtimeStageId`, so parallel sibling subflows are never nested under each other. An event
|
|
81
|
+
* without a traversal context nests under the most recently entered open entry.
|
|
82
|
+
*/
|
|
76
83
|
onSubflowEntry(event: FlowSubflowEvent): void;
|
|
84
|
+
/** Closes the open entry of the exiting subflow (the most recently entered one when no entry matches it). */
|
|
77
85
|
onSubflowExit(event: FlowSubflowEvent): void;
|
|
78
86
|
/**
|
|
79
87
|
* A series' row lands once, when it ends, on the open entry of the subflow the stage ran in; a top-level
|
|
@@ -16,6 +16,10 @@ export declare class MilestoneNarrativeFlowRecorder extends NarrativeFlowRecorde
|
|
|
16
16
|
private readonly interval;
|
|
17
17
|
private readonly alwaysEmitFirst;
|
|
18
18
|
private suppressedCount;
|
|
19
|
+
/**
|
|
20
|
+
* @param interval - Tell every `interval`-th pass.
|
|
21
|
+
* @throws RangeError when `interval` is 0 or NaN: no pass number is a multiple of it, so every pass would be suppressed.
|
|
22
|
+
*/
|
|
19
23
|
constructor(interval?: number, alwaysEmitFirst?: boolean, id?: string);
|
|
20
24
|
onLoop(event: FlowLoopEvent): void;
|
|
21
25
|
/** Returns the number of suppressed loop sentences. */
|
|
@@ -20,6 +20,8 @@ export declare class ProgressiveNarrativeFlowRecorder extends NarrativeFlowRecor
|
|
|
20
20
|
private suppressedCount;
|
|
21
21
|
/**
|
|
22
22
|
* @param base - The exponential base. Default 2 means emit at 1, 2, 4, 8, 16...
|
|
23
|
+
* @throws RangeError when `base` is NaN or between -1 and 1 inclusive: its powers never pass the
|
|
24
|
+
* iteration, so the pass check would never end.
|
|
23
25
|
*/
|
|
24
26
|
constructor(base?: number, id?: string);
|
|
25
27
|
onLoop(event: FlowLoopEvent): void;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* executor.attachFlowRecorder(recorder);
|
|
14
14
|
* await executor.run();
|
|
15
15
|
*
|
|
16
|
-
* const
|
|
16
|
+
* const mainSentences = recorder.getSentences(); // No loop sentences
|
|
17
17
|
* const loopDetail = recorder.getLoopSentences(); // All loop detail
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* IControlFlowNarrative — Public flow-observation strategy contract; no live producer binding.
|
|
3
3
|
*
|
|
4
4
|
* Captures FLOW events during traversal: decisions, forks, loops, subflows.
|
|
5
|
-
*
|
|
5
|
+
* DATA events (reads, writes) arrive on the ScopeRecorder channel; `CombinedNarrativeRecorder` merges both.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|