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
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* selectedObjects.ts — the objects a stage read under a hidden name, and where it puts them.
|
|
3
|
+
*
|
|
4
|
+
* Redaction selects by NAME (`docs/guides/scope.md`, "The one law"). A value copied under another name
|
|
5
|
+
* is selected by that other name only. There is one case a library can keep without guessing: the
|
|
6
|
+
* SAME OBJECT. An object a stage read under a hidden name is still that object when the stage writes
|
|
7
|
+
* it somewhere else, so it keeps its rule there.
|
|
8
|
+
*
|
|
9
|
+
* WHY THIS FILE EXISTS. Before it, that held for exactly one shape: the whole value of a hidden key
|
|
10
|
+
* written as the whole value of a top key (`scope.copy = scope.secret`). Every other way of passing
|
|
11
|
+
* the object on went into the commit log in the clear:
|
|
12
|
+
*
|
|
13
|
+
* - an object INSIDE the hidden value: `scope.copy = scope.secret.inner`, an element of a hidden
|
|
14
|
+
* list, a record below a hidden field;
|
|
15
|
+
* - the object put INSIDE another value: `scope.a.b = scope.secret`,
|
|
16
|
+
* `scope.box = { p: scope.secret }`, `scope.list.push(scope.secret)`, `$update('a', { b: … })`.
|
|
17
|
+
*
|
|
18
|
+
* So this file keeps two things for one stage:
|
|
19
|
+
*
|
|
20
|
+
* 1. REMEMBER. A value read under a hidden name is remembered together with every object inside
|
|
21
|
+
* it, each with the rule its place gives it: hidden whole, or the fields below it that are.
|
|
22
|
+
* (Read from state by any door, or taken from the stage's input: `StageContext · noteInputRead`.)
|
|
23
|
+
* 2. FIND. A value about to be written is searched for remembered objects, and each one found is
|
|
24
|
+
* reported with the path it sits at. The caller hides those paths under the key being written.
|
|
25
|
+
*
|
|
26
|
+
* WHY ONLY WHAT IS NEW IS SEARCHED. A write through the typed scope hands the frame the whole next
|
|
27
|
+
* value of a key: a list with one more item is the whole list. Searching all of it at every write
|
|
28
|
+
* costs the square of the list. A part that is the SAME OBJECT as in the value it replaces was there
|
|
29
|
+
* before this write, so this write did not put it there: it is skipped. What is left is the copied
|
|
30
|
+
* path down to the change and the new value itself. Two cases are searched whole all the same: the
|
|
31
|
+
* same object written back (a stage does that after changing it in place), and a container that was
|
|
32
|
+
* compared at one place and turns up at a second one, where everything in it is new.
|
|
33
|
+
*
|
|
34
|
+
* WHY EVERY WRITTEN KEY IS SEARCHED ONCE MORE AT COMMIT (`hiddenObjectTrail.ts`). The record takes a
|
|
35
|
+
* value as it stands when the stage commits, not when it was written: `s.box = o; o.p = s.secret`
|
|
36
|
+
* records `p`, and no write ever showed it. So each key a stage wrote is searched again then, against
|
|
37
|
+
* the committed value the stage started from. That search has one job: to find a hidden object the
|
|
38
|
+
* stage put in AFTER the write. So it passes over three things, each for its own reason:
|
|
39
|
+
*
|
|
40
|
+
* - a place its own name hides already (`named`): nothing can be added there;
|
|
41
|
+
* - an object that sat at a public place of that key when the stage wrote it, and was not hidden
|
|
42
|
+
* then (`shown`): `s.public = h; s.hidden = h` is one object at two places of the stage's own
|
|
43
|
+
* making. The write judged it by what was known then, and the search at commit does not go back
|
|
44
|
+
* in time. Put anywhere else after it was read back, it is found;
|
|
45
|
+
* - a place that holds what the committed state held there when the stage began (`same`): a read
|
|
46
|
+
* after the stage's first write hands out a private copy, so the object is new and its content is
|
|
47
|
+
* not. Nothing shows there that did not show before.
|
|
48
|
+
*
|
|
49
|
+
* WHY A PLACE CARRIES WHAT ITS NAME HIDES (`named`). The search walks a value together with the rule
|
|
50
|
+
* its key has by name (the policy's fields, and the fields earlier writes handed it). Below a place
|
|
51
|
+
* hidden whole nothing is searched. A remembered object is reported only where it adds to what the
|
|
52
|
+
* name hides already, so a record written back to its own key reports nothing, and a second search of
|
|
53
|
+
* the same value reports nothing new. And only an object at a place where the name hides nothing, at
|
|
54
|
+
* it or below it, counts as shown.
|
|
55
|
+
*
|
|
56
|
+
* WHY THE KEY'S OWN OLD VALUE IS NOT WALKED WHEN IT MOVES (`history = { prev: history }`). It would
|
|
57
|
+
* be walked again at every write, and the cost would be the square of the chain. What it hides is
|
|
58
|
+
* known without a walk: what the key's name hides in it. And the place it moved to is hidden WHOLE,
|
|
59
|
+
* not field by field: it moves one step down again at the next write, and a field path that follows
|
|
60
|
+
* it would grow by one at every step, in every record of the key. (The same reason as for a list.)
|
|
61
|
+
*
|
|
62
|
+
* WHY A LIST IS HIDDEN WHOLE. A hidden object found in a list has an index today and another one
|
|
63
|
+
* after the next `unshift`. A rule by index would then hide the wrong item. So the list is hidden: in
|
|
64
|
+
* a list of lists, the outermost one. The same holds for a `Map` and a `Set`, whose entries a path
|
|
65
|
+
* cannot name, and for an `Error` that carries one as its cause.
|
|
66
|
+
*
|
|
67
|
+
* HOW LONG A PLACE STAYS HIDDEN. Until its top key is deleted (`markPlaces.ts`), like every rule the
|
|
68
|
+
* library keeps by name. Taking the hidden object out again does not end it: `a.b` stays hidden after
|
|
69
|
+
* `a.b = 'plain'` and after `delete a.b`, and a list stays hidden after its hidden item is removed.
|
|
70
|
+
* The library knows that a hidden object went in. It does not prove that all of it came out.
|
|
71
|
+
*
|
|
72
|
+
* WHY THE SECOND PLACE OF ONE CONTAINER IS HIDDEN WHOLE. A new object can sit at two places of the
|
|
73
|
+
* value a stage writes (`{ first: part, second: part }`). It is searched once. At the second place it
|
|
74
|
+
* is known to hold a hidden object, and where exactly is not worth a second walk: with enough shared
|
|
75
|
+
* parts the number of paths doubles at every level.
|
|
76
|
+
*
|
|
77
|
+
* WHAT IS NOT FOLLOWED, and cannot be: a text or a number has no identity, so a copy of one is hidden
|
|
78
|
+
* by its own name only (`{ ...scope.profile }` copies the profile's texts). Nor is a copy made by the
|
|
79
|
+
* stage's own code (`structuredClone`, a JSON round trip): it is a new value. An object carried from
|
|
80
|
+
* one stage to the next in a closure is outside this stage's memory.
|
|
81
|
+
*
|
|
82
|
+
* WHAT A RECORDER MAY STILL SEE. The record is searched at commit; an event is made at its write. So
|
|
83
|
+
* what a recorder is handed at a write is the value as it stood then, and a recorder that keeps the
|
|
84
|
+
* reference sees what the stage puts into it later (the borrowed-reference rule of every event; a
|
|
85
|
+
* narrative entry's `rawValue` is such a reference). One more case follows from searching only what
|
|
86
|
+
* is new: a stage that changes a written object in place and then writes the same key again, with
|
|
87
|
+
* that object still at its place, is not searched there at that second write. Its event shows the
|
|
88
|
+
* object as it stands. The commit search finds it, so the record does not show it, and neither does
|
|
89
|
+
* what the stage keeps of its writes for the execution tree (`hiddenObjectTrail.ts · keep`).
|
|
90
|
+
*
|
|
91
|
+
* WHY A VALUE THAT HOLDS ITSELF IS HIDDEN WHOLE (`w.self = w`). A field is hidden by writing over it
|
|
92
|
+
* in a copy of the value, and the edge back still leads to the value the copy was made of. So a
|
|
93
|
+
* hidden object inside such a container cannot be hidden as a field: the container's place is hidden
|
|
94
|
+
* whole. What this file does NOT cover is a field the POLICY names inside such a value, with no hidden
|
|
95
|
+
* object in it: that scrub is the record's (foottrace), and it shows the field through the edge today.
|
|
96
|
+
*
|
|
97
|
+
* WHAT IT COSTS (`bench/hidden-object-writes.ts`, 12 Nov 2026, lists of 10,000 records, read tracking
|
|
98
|
+
* off). Nothing for a stage that read nothing hidden. After a hidden read, each write through the
|
|
99
|
+
* typed scope pays one comparison for each item of the list it writes: 10,000 pushes went from 72 to
|
|
100
|
+
* 156 ms, one field set on each of 10,000 records from 91 to 286 ms. A whole new list of 10,000
|
|
101
|
+
* records, assigned 100 times, went from 103 to 259 ms: every record in it is new, so each is looked
|
|
102
|
+
* at and noted. A key that nests its old value 1,000 times costs what it did (50 ms). Remembering a
|
|
103
|
+
* hidden list of 10,000 records at its first read did not show above the noise. The list traps know
|
|
104
|
+
* exactly what they put in; if this ever matters, they can say so and the comparison goes away.
|
|
105
|
+
*
|
|
106
|
+
* The idea is plain taint tracking by object identity, kept for one stage. No outside source.
|
|
107
|
+
*
|
|
108
|
+
* A leaf: it imports nothing. The frame owns one for each stage (`hiddenObjectTrail.ts`), and the
|
|
109
|
+
* write decision asks it (`redaction.ts · inheritByIdentity`).
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* The rule a remembered object carries: hidden whole, or the dot-paths inside it that are. `key` is
|
|
113
|
+
* the name that decided it. (The two hiding arms of `redaction.ts · RedactionVerdict`, spelled here
|
|
114
|
+
* so that this file stays a leaf.)
|
|
115
|
+
*/
|
|
116
|
+
export type SelectedRule = {
|
|
117
|
+
readonly kind: 'whole';
|
|
118
|
+
readonly key: string;
|
|
119
|
+
} | {
|
|
120
|
+
readonly kind: 'fields';
|
|
121
|
+
readonly key: string;
|
|
122
|
+
readonly paths: readonly string[];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* A remembered object found in a searched value. `path` is where to hide, inside that value. `whole`
|
|
126
|
+
* says to hide everything at `path`: the object sits in a list, a `Map` or a `Set` there, or is
|
|
127
|
+
* hidden whole itself. Otherwise `rule.paths` are the fields to hide below `path`.
|
|
128
|
+
*/
|
|
129
|
+
export interface FoundSelected {
|
|
130
|
+
readonly path: readonly string[];
|
|
131
|
+
readonly rule: SelectedRule;
|
|
132
|
+
readonly whole: boolean;
|
|
133
|
+
}
|
|
134
|
+
/** What a search knows of the key it searches (file header, why each). */
|
|
135
|
+
export interface Search {
|
|
136
|
+
/** What the NAME of the searched place hides in its value already: the key's own fields. */
|
|
137
|
+
readonly named?: SelectedRule;
|
|
138
|
+
/**
|
|
139
|
+
* The objects that sat at a public place of this key when the stage wrote it, and were not hidden
|
|
140
|
+
* then. A search at a write adds to it; the search at commit passes them over.
|
|
141
|
+
*/
|
|
142
|
+
readonly shown?: ShownObjects;
|
|
143
|
+
/** The value is a merge patch: a list in it is added to the one there, so its indexes name no place. */
|
|
144
|
+
readonly patch?: boolean;
|
|
145
|
+
/** The value is the key's whole new value (a `set` of the key itself, not of a path below it). */
|
|
146
|
+
readonly replaces?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/** What one key showed when the stage wrote it ({@link Search.shown}; file header, why it is kept). */
|
|
149
|
+
export declare class ShownObjects {
|
|
150
|
+
private objects;
|
|
151
|
+
has(value: object): boolean;
|
|
152
|
+
/** `more` showed too. */
|
|
153
|
+
add(more: readonly object[]): void;
|
|
154
|
+
/**
|
|
155
|
+
* The key's whole value was replaced and nothing of the old one was kept: `all` is what it shows now.
|
|
156
|
+
* WHY not `add`: a weak set that only grows, while most of what it holds is garbage, slows every
|
|
157
|
+
* collection (`bench/hidden-object-writes.ts`, a whole list assigned 100 times: 590 ms against 230).
|
|
158
|
+
*/
|
|
159
|
+
replace(all: readonly object[]): void;
|
|
160
|
+
}
|
|
161
|
+
/** Do two objects hold the same content? Asked by the search at commit, of an object and the committed one at its place. */
|
|
162
|
+
export type SameContent = (now: object, before: object) => boolean;
|
|
163
|
+
export declare class SelectedObjects {
|
|
164
|
+
private readonly rules;
|
|
165
|
+
/** The rule `value` carries, when the stage read it under a hidden name (or inside such a value). */
|
|
166
|
+
get(value: object): SelectedRule | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* `handed` stands in for `value` (a view handed to user code in its place): it carries the same rule.
|
|
169
|
+
* The view alone: its members are read on demand, and reading them here would count as reads.
|
|
170
|
+
*/
|
|
171
|
+
sameRuleFor(handed: object, value: object): void;
|
|
172
|
+
/**
|
|
173
|
+
* `copy` is a full copy the scope itself made of `value` (`$batchArray` hands a stage one): the copy
|
|
174
|
+
* and every object inside it carry what `value` carries.
|
|
175
|
+
*/
|
|
176
|
+
copyOf(copy: object, value: object): void;
|
|
177
|
+
/**
|
|
178
|
+
* Remember `value`, read under a hidden name, and every object inside it. Once for each object: a
|
|
179
|
+
* second read of the same value costs one lookup. No recursion, so a long chain cannot overflow.
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* selected.remember(profile, { kind: 'fields', key: 'profile', paths: ['contact.email'] });
|
|
183
|
+
* selected.get(profile.contact); // { kind: 'fields', key: 'profile', paths: ['email'] }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
remember(value: object, rule: SelectedRule): void;
|
|
187
|
+
/**
|
|
188
|
+
* AT A WRITE: the remembered objects in `value`, about to be written over `base` (what the key holds
|
|
189
|
+
* now, or what a merge adds to). A part that is the same object as in `base` is not searched: it
|
|
190
|
+
* was there before this write. Empty when the value is, or holds, no remembered object that adds to
|
|
191
|
+
* what the key's name hides already. Every other new object at a public place is added to
|
|
192
|
+
* `search.shown`.
|
|
193
|
+
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* selected.findIn({ x: 1, b: secret }, { x: 1 }); // [{ path: ['b'], rule: …, whole: true }]
|
|
196
|
+
* selected.findIn([...list, secret], list); // [{ path: [], rule: …, whole: true }] the list
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
findIn(value: unknown, base: unknown, search?: Search): FoundSelected[];
|
|
200
|
+
/**
|
|
201
|
+
* What `value` shows, with nothing reported: every object in it that is new against `base`, sits at
|
|
202
|
+
* a public place and is not remembered goes into `search.shown`. For a value the stage wrote that no
|
|
203
|
+
* search at a write walked: a key written before the stage's first hidden read, and the containers a
|
|
204
|
+
* merge makes (the record builds them; the patch that was searched is not what the key then holds).
|
|
205
|
+
*/
|
|
206
|
+
noteShown(value: unknown, base: unknown, search: Search): void;
|
|
207
|
+
/**
|
|
208
|
+
* AT COMMIT: the remembered objects the stage put into `value` after it wrote it. `base` is the
|
|
209
|
+
* committed value the stage started from. Passed over: what `search.shown` holds, and an object
|
|
210
|
+
* that `same` says holds what the committed one at its place held (file header, why).
|
|
211
|
+
*/
|
|
212
|
+
findPlanted(value: unknown, base: unknown, search: Search, same: SameContent): FoundSelected[];
|
|
213
|
+
/** The one walk behind the three searches. `quiet` reports nothing; `same` makes it the search at commit. */
|
|
214
|
+
private walk;
|
|
215
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* servedPlaces.ts — the places a redaction rule hides in a record it serves whole, as paths.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS FILE EXISTS. A stage is handed its input (`$getArgs()`), and what the library hides when it
|
|
5
|
+
* SHOWS that input is what the stage must not pass on under another name
|
|
6
|
+
* (`hiddenObjectTrail.ts · rememberInput`). The rule that shows it is `RedactionRule · retainBoundary`:
|
|
7
|
+
* a selected name at any depth, a dotted key, a path pattern, a declared field. This file asks that
|
|
8
|
+
* rule and reads its answer back as paths, so the policy is read in one place. The first cut walked
|
|
9
|
+
* the input by itself and matched names only: a dotted key and a path pattern were missed, and a long
|
|
10
|
+
* list ended the walk.
|
|
11
|
+
*
|
|
12
|
+
* HOW. The record is served with a marker where the rule would put its placeholder. The rule copies
|
|
13
|
+
* only the parts it changes (copy-on-write, one decision for each path), so the served record is
|
|
14
|
+
* walked beside the original and only where the two differ. One object can sit at two paths and be
|
|
15
|
+
* served differently at each: a part is passed over only when the SAME served copy comes back (a
|
|
16
|
+
* loop), never because the original was seen at another path.
|
|
17
|
+
*
|
|
18
|
+
* WHY THE ANSWER IS KEPT, AND FOR WHAT. Every stage of a run is handed the same input, and one look at
|
|
19
|
+
* 200,000 records takes about 150 ms (`bench/input-under-policy.ts`, 12 Nov 2026: a run of one stage
|
|
20
|
+
* that asks for its input went from 292 to 434 ms). Asked again for each stage, that would be paid
|
|
21
|
+
* once a stage; kept, twenty stages cost what one does (280 to 430 ms). It is kept only where it
|
|
22
|
+
* cannot go stale:
|
|
23
|
+
* - for a record that cannot change: every container in it is frozen and plain, with no accessor.
|
|
24
|
+
* The run's own snapshot of an input is that; a capability or a caller's frozen wrapper inside it
|
|
25
|
+
* is borrowed and may change, and then nothing is kept;
|
|
26
|
+
* - while the rule's policy and marks are the same: a rule can be handed a new policy, and a name
|
|
27
|
+
* marked later hides that key of the input too.
|
|
28
|
+
*
|
|
29
|
+
* No outside source. A leaf beside the rule: it imports the rule's type and asks its one public door.
|
|
30
|
+
*/
|
|
31
|
+
import type { RedactionRule } from './redaction.js';
|
|
32
|
+
/**
|
|
33
|
+
* The places `rule` hides in `record` when it serves it whole, as dot-paths from the top. Empty: it
|
|
34
|
+
* hides nothing. `undefined`: the rule cannot serve it (its keys cannot be read), and the caller
|
|
35
|
+
* takes the safe side.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* placesHiddenIn(new RedactionRule({ keys: ['secret'] }), { order: { secret: { token: 't' } } }); // ['order.secret']
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function placesHiddenIn(rule: RedactionRule, record: object): readonly string[] | undefined;
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* `runner/attach.ts · RunObservers` creates the tier on the first deferred
|
|
14
14
|
* attach. Public use is through the executor's attach options, with delivery
|
|
15
15
|
* types re-exported by `src/index.ts` (see docs/guides/observers-deferred.md).
|
|
16
|
-
* Zero engine imports: this directory may import only `../capture
|
|
17
|
-
*
|
|
16
|
+
* Zero engine imports: this directory may import only `../capture/`, the
|
|
17
|
+
* `../timers/` leaf (`setLongTimeout`, for the dispatcher's drain limit) and
|
|
18
|
+
* its own files; the runner imports the pipeline, never the reverse.
|
|
18
19
|
*/
|
|
19
20
|
export type { CaptureChannel, CaptureEnvelope, CaptureHooks, CapturePolicy, CaptureRequest, PayloadSummary, PayloadSummaryNode, PayloadSummaryType, } from '../capture/envelope.js';
|
|
20
21
|
export { capture, PAYLOAD_SUMMARY_MAX_DEPTH, PAYLOAD_SUMMARY_MAX_ENTRIES, PAYLOAD_SUMMARY_MAX_NODES, summarizePayload, } from '../capture/envelope.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pause/Resume — serializable checkpoint for long-running or human-in-the-loop flows.
|
|
3
3
|
*
|
|
4
|
-
* A stage
|
|
4
|
+
* A stage pauses through a pausable stage's return value (`addPausableFunction`) or
|
|
5
|
+
* `interrupt(scope, payload)`; `StageRunner` turns either into a thrown PauseSignal.
|
|
5
6
|
* The signal bubbles up through SubflowExecutor → FlowchartTraverser → FlowChartExecutor,
|
|
6
7
|
* each level adding its subflow ID to the path.
|
|
7
8
|
*
|
|
@@ -53,16 +54,17 @@ export interface RedactionMarks {
|
|
|
53
54
|
/** True for a well-formed {@link PausedExecution} (two non-empty strings). */
|
|
54
55
|
export declare function isPausedExecution(value: unknown): value is PausedExecution;
|
|
55
56
|
/**
|
|
56
|
-
* Thrown by `
|
|
57
|
-
*
|
|
57
|
+
* Thrown by `StageRunner` when a stage pauses (a pausable stage's return value,
|
|
58
|
+
* or `interrupt(scope, payload)`) to signal that execution should stop and
|
|
59
|
+
* create a serializable checkpoint.
|
|
58
60
|
*
|
|
59
61
|
* Bubbles up through SubflowExecutor (which prepends subflow ID to path)
|
|
60
62
|
* and is caught by FlowchartTraverser/FlowChartExecutor.
|
|
61
63
|
*/
|
|
62
64
|
export declare class PauseSignal extends Error {
|
|
63
|
-
/**
|
|
65
|
+
/** The pause payload (the pausable stage's return value or the `interrupt()` payload) — question, reason, metadata. */
|
|
64
66
|
readonly pauseData: unknown;
|
|
65
|
-
/** ID of the stage that
|
|
67
|
+
/** ID of the stage that paused. */
|
|
66
68
|
readonly stageId: string;
|
|
67
69
|
/**
|
|
68
70
|
* HOW the pause was raised — `'interrupt'` when a stage body called
|
|
@@ -301,7 +303,7 @@ export interface FlowchartCheckpoint {
|
|
|
301
303
|
/** Path through subflows to the paused stage (e.g., ['sf-payment', 'sf-validation']).
|
|
302
304
|
* Empty array when paused at the top level. */
|
|
303
305
|
readonly subflowPath: readonly string[];
|
|
304
|
-
/**
|
|
306
|
+
/** The pause payload (the pausable stage's return value or the `interrupt()` payload) — question, reason, metadata. */
|
|
305
307
|
readonly pauseData?: unknown;
|
|
306
308
|
/**
|
|
307
309
|
* HOW the pause was raised. `'interrupt'` means a stage body called
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
* so proxying a Date and calling .getTime() throws "this is not a Date object".
|
|
10
10
|
* Vue 3 and MobX both use the same allowlist approach.
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* Is `value` a plain object: its prototype is `Object.prototype` or `null`?
|
|
14
|
+
*
|
|
15
|
+
* Decided by the PROTOTYPE, never by a `.constructor` read: `constructor` is an
|
|
16
|
+
* ordinary key, so state such as `{ constructor: 'Foo' }` is data and must still
|
|
17
|
+
* count as a plain object. The one plain-object rule for reactive/ (the
|
|
18
|
+
* allowlist, the JSON projection and the handle walk).
|
|
19
|
+
*/
|
|
20
|
+
export declare function isPlainObject(value: object): boolean;
|
|
12
21
|
/**
|
|
13
22
|
* Returns true if the value should be wrapped in a deep Proxy.
|
|
14
23
|
*
|
|
@@ -19,12 +28,12 @@
|
|
|
19
28
|
* 1. Primitives and null -> false (fast exit)
|
|
20
29
|
* 2. Frozen/sealed objects -> false (nested set traps would silently fail)
|
|
21
30
|
* 3. Arrays -> true (fast exit)
|
|
22
|
-
* 4.
|
|
31
|
+
* 4. Prototype check -> plain objects ({@link isPlainObject}) are wrappable
|
|
23
32
|
* 5. Tag check -> catch built-ins with internal slots (Date, Map, Set, etc.)
|
|
24
33
|
* 6. Everything else -> class instance, not wrappable
|
|
25
34
|
*
|
|
26
|
-
*
|
|
35
|
+
* Prototype check comes BEFORE tag check to prevent Symbol.toStringTag spoofing:
|
|
27
36
|
* a plain object with { [Symbol.toStringTag]: 'Date' } would fool the tag check
|
|
28
|
-
* but is correctly identified as a plain object by
|
|
37
|
+
* but is correctly identified as a plain object by its prototype.
|
|
29
38
|
*/
|
|
30
39
|
export declare function shouldWrapWithProxy(value: unknown): boolean;
|
|
@@ -64,7 +64,7 @@ import { type WriteSink } from './writeTraps.js';
|
|
|
64
64
|
* through the sink and commits the WHOLE new array back through it, so
|
|
65
65
|
* `push` three levels down and `arr[i].x = v` at the top share a funnel.
|
|
66
66
|
*/
|
|
67
|
-
export declare function arrayProxyAt(sink: WriteSink, path: readonly string[]): unknown[];
|
|
67
|
+
export declare function arrayProxyAt(sink: WriteSink, path: readonly string[], captured: unknown[]): unknown[];
|
|
68
68
|
/**
|
|
69
69
|
* Creates a Proxy over an array that intercepts mutating operations.
|
|
70
70
|
*
|
|
@@ -74,8 +74,16 @@ export declare function arrayProxyAt(sink: WriteSink, path: readonly string[]):
|
|
|
74
74
|
* the proxy returns a new proxy (via cache invalidation) with the fresh array
|
|
75
75
|
* as target.
|
|
76
76
|
*
|
|
77
|
+
* READS are live while the key holds an array and answer from the array the
|
|
78
|
+
* handle was made over once it does not; WRITES are refused then, with a
|
|
79
|
+
* `TypeError` that names the key (see {@link liveArray}).
|
|
80
|
+
*
|
|
77
81
|
* @param getCurrent - Returns the current array snapshot from state
|
|
78
82
|
* @param commit - Called with the new array after a mutation (triggers setValue)
|
|
83
|
+
* @param name - The value's name in state, used in error messages
|
|
84
|
+
* @param captured - The array the handle is made over, when the caller already
|
|
85
|
+
* holds it (a member read off a captured object whose path is gone). Default:
|
|
86
|
+
* what `getCurrent` returns now.
|
|
79
87
|
* @returns Proxied array with copy-on-write semantics
|
|
80
88
|
*/
|
|
81
|
-
export declare function createArrayProxy<T>(getCurrent: () => T[], commit: (newArray: T[]) => void): T[];
|
|
89
|
+
export declare function createArrayProxy<T>(getCurrent: () => T[], commit: (newArray: T[]) => void, name?: string, captured?: T[]): T[];
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
*
|
|
13
13
|
* ## Why a projection is needed at all
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* `toJSON` hands JSON.stringify the raw, un-proxied value behind the proxy. Raw
|
|
16
|
+
* state can be cyclic, and JSON.stringify throws on a cycle. Reading a circular
|
|
17
|
+
* value through the property path must not throw (the contract below), so the
|
|
18
|
+
* view prunes each back-edge before handing the value over.
|
|
19
19
|
*
|
|
20
20
|
* ## Cycle handling: prune the back-edge, not the data
|
|
21
21
|
*
|
|
@@ -69,6 +69,9 @@ export declare function liveGetTrap(live: () => Record<string, unknown>, segment
|
|
|
69
69
|
* target must report exactly its own keys, and a property the target lacks
|
|
70
70
|
* must be reported configurable — is honoured: the allowlist already refuses
|
|
71
71
|
* frozen and sealed values, so the `preventExtensions`-only corner answers
|
|
72
|
-
* from the target
|
|
72
|
+
* from the target. A property the target itself owns as non-configurable
|
|
73
|
+
* (an `Object.defineProperty` field) is answered from the target, which is
|
|
74
|
+
* the only descriptor the invariant accepts; any other live descriptor is
|
|
75
|
+
* reported configurable.
|
|
73
76
|
*/
|
|
74
77
|
export declare function liveInspectionTraps(live: () => object): Pick<ProxyHandler<object>, 'has' | 'ownKeys' | 'getOwnPropertyDescriptor'>;
|
|
@@ -30,6 +30,12 @@ export interface ReactiveTarget {
|
|
|
30
30
|
* each nested access then fires onRead — provide it (ScopeFacade does).
|
|
31
31
|
*/
|
|
32
32
|
getValueSilent?(key?: string): unknown;
|
|
33
|
+
/**
|
|
34
|
+
* `copy` is a full copy the scope made of `value`, a value it read, and hands to user code in its
|
|
35
|
+
* place (`$batchArray`). A target that keeps rules by object identity (redaction) lets the copy carry
|
|
36
|
+
* what the value carries. Optional: a target without such rules has nothing to do.
|
|
37
|
+
*/
|
|
38
|
+
copyOf?(copy: unknown, value: unknown): void;
|
|
33
39
|
getArgs<T = Record<string, unknown>>(): T;
|
|
34
40
|
getEnv(): Readonly<ExecutionEnv>;
|
|
35
41
|
/** The attempt the stage function runs in — its signal, its cap and the time left (P1b). */
|
|
@@ -25,6 +25,8 @@ export interface WriteSink {
|
|
|
25
25
|
put(path: readonly string[], value: unknown): void;
|
|
26
26
|
/** Remove the key at `path`. */
|
|
27
27
|
remove(path: readonly string[]): void;
|
|
28
|
+
/** The name of the value at `path` as a stage author writes it (`order.lines[0].qty`), for messages. */
|
|
29
|
+
nameOf(path: readonly string[]): string;
|
|
28
30
|
}
|
|
29
31
|
/** The two ways a value reaches a state key: what the sink writes through. */
|
|
30
32
|
export interface RootKeyTarget {
|
|
@@ -45,7 +47,7 @@ export declare function rootKeySink(target: RootKeyTarget, readSilent: (key: str
|
|
|
45
47
|
* commit, the funnel `push` already uses. `path` is measured from the
|
|
46
48
|
* element; `[]` is the element slot itself.
|
|
47
49
|
*/
|
|
48
|
-
export declare function elementSink(getCurrent: () => unknown[], commit: (next: unknown[]) => void, index: number): WriteSink;
|
|
50
|
+
export declare function elementSink(getCurrent: () => unknown[], commit: (next: unknown[]) => void, index: number, arrayName?: string, forWrite?: () => unknown[]): WriteSink;
|
|
49
51
|
/**
|
|
50
52
|
* WHY one set trap: the assigned value is taken as a VALUE here (a handle
|
|
51
53
|
* becomes what it stands for, `handles.ts`; nothing else is copied — the
|
|
@@ -58,3 +60,20 @@ export declare function sinkSetTrap(sink: WriteSink, segments: readonly string[]
|
|
|
58
60
|
* `undefined` reads as absent), so a delete always rebuilds through the sink.
|
|
59
61
|
*/
|
|
60
62
|
export declare function sinkDeleteTrap(sink: WriteSink, segments: readonly string[]): ProxyHandler<object>['deleteProperty'];
|
|
63
|
+
/** Why a define, a prototype change or a lock is refused. One wording for every proxy kind. */
|
|
64
|
+
export declare function refuseDoor(what: string, path: string): never;
|
|
65
|
+
/**
|
|
66
|
+
* Is `descriptor` exactly what an assignment makes? Either all-open
|
|
67
|
+
* (`value` with writable, enumerable and configurable all true), or a bare
|
|
68
|
+
* `{ value }` for a key that already exists (the shape `Reflect.set` sends to a
|
|
69
|
+
* receiver). An accessor, or any attribute set to false, is not.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isAssignmentDescriptor(descriptor: PropertyDescriptor, exists: boolean): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* WHY three more traps: the doors above, closed for every object proxy over a
|
|
74
|
+
* {@link WriteSink}. A define that is an assignment goes to the sink (a row);
|
|
75
|
+
* any other define, a prototype change and a lock are refused. A symbol key is
|
|
76
|
+
* not state (a record never holds one) and passes through to the target, as it
|
|
77
|
+
* always did.
|
|
78
|
+
*/
|
|
79
|
+
export declare function sinkDoorTraps(sink: WriteSink, segments: readonly string[]): Pick<ProxyHandler<object>, 'defineProperty' | 'setPrototypeOf' | 'preventExtensions'>;
|
|
@@ -80,13 +80,15 @@ export declare class BoundaryStateStore<TState> {
|
|
|
80
80
|
* Evolve the transient state of an active boundary using a pure
|
|
81
81
|
* updater function. Silent no-op if no boundary is active for `key`
|
|
82
82
|
* (defensive against out-of-order events). Dev mode logs a rate-
|
|
83
|
-
* limited warning.
|
|
83
|
+
* limited warning. A boundary is active from `start` to `stop`
|
|
84
|
+
* whatever its state holds: one started with `undefined` is updated.
|
|
84
85
|
*/
|
|
85
86
|
update(key: string, updater: (prev: TState) => TState): void;
|
|
86
87
|
/**
|
|
87
88
|
* Close the boundary identified by `key` and return its FINAL
|
|
88
89
|
* transient state (so the consumer can do any cleanup — e.g., emit
|
|
89
|
-
* a snapshot to a SequenceStore for durable storage).
|
|
90
|
+
* a snapshot to a SequenceStore for durable storage). The dropped-update
|
|
91
|
+
* count for `key` restarts, as it does on `start`.
|
|
90
92
|
*/
|
|
91
93
|
stop(key: string): TState | undefined;
|
|
92
94
|
/** Current transient state of ONE active boundary. `undefined` if no
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CombinedRecorder — a single observer that can hook into MULTIPLE event
|
|
3
|
-
* streams (
|
|
3
|
+
* streams (scope data-flow, control-flow and emit). One object, one `id`,
|
|
4
4
|
* one consistent view of the execution.
|
|
5
5
|
*
|
|
6
6
|
* ## Why this exists
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* ## Forward compatibility
|
|
24
24
|
*
|
|
25
|
-
* When
|
|
25
|
+
* When another observer type is added (e.g. an `OperationRecorder`), the
|
|
26
26
|
* `CombinedRecorder` type gains an `& Partial<OperationRecorder>` clause and
|
|
27
27
|
* `attachCombinedRecorder` gains one more runtime branch in its dispatch.
|
|
28
28
|
* Consumers writing a `CombinedRecorder` today are NOT affected — their
|
|
@@ -74,6 +74,7 @@ type SharedLifecycle = 'id' | 'clear' | 'toSnapshot';
|
|
|
74
74
|
* Today's streams:
|
|
75
75
|
* - Scope data-flow (`ScopeRecorder`: onRead/onWrite/onCommit/onStageStart/…)
|
|
76
76
|
* - Control-flow (`FlowRecorder`: onDecision/onSubflowEntry/onLoop/…)
|
|
77
|
+
* - Emit (`EmitRecorder`: onEmit)
|
|
77
78
|
*
|
|
78
79
|
* All event handlers are optional — implement only what you care about.
|
|
79
80
|
* `id` is required so the library can deduplicate re-attaches.
|
|
@@ -88,7 +89,7 @@ type SharedLifecycle = 'id' | 'clear' | 'toSnapshot';
|
|
|
88
89
|
*
|
|
89
90
|
* ## Forward compatibility
|
|
90
91
|
*
|
|
91
|
-
* When
|
|
92
|
+
* When another observer type ships (e.g. `OperationRecorder`), the type
|
|
92
93
|
* gains another `& Partial<…>` clause. Because every clause is `Partial`,
|
|
93
94
|
* existing `CombinedRecorder` implementations remain type-valid.
|
|
94
95
|
*/
|
|
@@ -54,7 +54,7 @@ export interface CompositeSnapshot {
|
|
|
54
54
|
children: RecorderSnapshot[];
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
/** One fan-out method per registry hook (`recorder/hooks.ts · HOOKS`) —
|
|
57
|
+
/** One fan-out method per registry hook (`recorder/hooks.ts · HOOKS`) — 25 names, 28 channel slots. */
|
|
58
58
|
type HookMethods = {
|
|
59
59
|
[K in HookName]: (event: HookPayload<K>) => void;
|
|
60
60
|
};
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
* @example
|
|
53
53
|
* ```typescript
|
|
54
54
|
* import { controlDepRecorder } from 'footprintjs/trace';
|
|
55
|
-
import { causalChain } from 'foottrace';
|
|
55
|
+
* import { causalChain } from 'foottrace';
|
|
56
56
|
*
|
|
57
57
|
* const ctrl = controlDepRecorder();
|
|
58
58
|
* executor.attachCombinedRecorder(ctrl); // auto-routes to FlowRecorder channel
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* |-----------------|------------------------------------|------------------------|
|
|
37
37
|
* | `ScopeRecorder` | scope read/write/commit | DebugRecorder, MetricRecorder |
|
|
38
38
|
* | `FlowRecorder` | traversal transitions | NarrativeFlowRecorder, etc. |
|
|
39
|
-
* | `EmitRecorder` | consumer calls `scope.$emit(...)` |
|
|
39
|
+
* | `EmitRecorder` | consumer calls `scope.$emit(...)` | CombinedNarrativeRecorder |
|
|
40
40
|
*
|
|
41
41
|
* `CombinedRecorder` (from `./CombinedRecorder.ts`) intersects all three
|
|
42
42
|
* via `Partial<...>`. A consumer can write ONE object implementing any
|
|
@@ -259,7 +259,7 @@ export declare class ExecutionRuntime {
|
|
|
259
259
|
* safe because it is deeply frozen, so no holder can mutate it or reach the
|
|
260
260
|
* engine through it; a base holding a Date, Map, buffer … (what freezing
|
|
261
261
|
* cannot seal) is served by the public snapshot as a copy of its open paths
|
|
262
|
-
* (`runner/snapshot.ts · servedSnapshot`, `
|
|
262
|
+
* (`runner/snapshot.ts · servedSnapshot`, `foottrace · serveRecord`,
|
|
263
263
|
* 9.44.2).
|
|
264
264
|
*/
|
|
265
265
|
private getFoldBase;
|
|
@@ -281,8 +281,7 @@ export declare class ExecutionRuntime {
|
|
|
281
281
|
* @param options.redact When `true`, returns `sharedState` from the
|
|
282
282
|
* parallel redacted mirror (if one was enabled). This is the safe view
|
|
283
283
|
* for sharing traces externally — paste into a viewer, ship to support,
|
|
284
|
-
* etc. When the mirror was never enabled, falls back to raw `globalStore
|
|
285
|
-
* and a dev-mode warning is emitted (silent in production).
|
|
284
|
+
* etc. When the mirror was never enabled, falls back to raw `globalStore`.
|
|
286
285
|
*
|
|
287
286
|
* Default `false` preserves the runtime view — necessary for pause /
|
|
288
287
|
* resume (resumption must replay against the real values, not
|
|
@@ -39,6 +39,7 @@ import { type RuntimeSnapshot } from './ExecutionRuntime.js';
|
|
|
39
39
|
import { type NativeClosedCaptureResult } from './nativeClosure/record.js';
|
|
40
40
|
import { type FlowChartExecutorOptions } from './options.js';
|
|
41
41
|
import { type RecordFlushResult } from './recordSink.js';
|
|
42
|
+
import type { ResumeOptions } from './RunLifecycle.js';
|
|
42
43
|
export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
43
44
|
private traverser;
|
|
44
45
|
/** Shared execution counter and per-stage visit counts (loopIteration) — shared BY
|
|
@@ -179,7 +180,12 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
179
180
|
* const result = await executor.resume(restored, { approved: true });
|
|
180
181
|
* ```
|
|
181
182
|
*/
|
|
182
|
-
resume(checkpoint: FlowchartCheckpoint, resumeInput?: unknown, options?:
|
|
183
|
+
resume(checkpoint: FlowchartCheckpoint, resumeInput?: unknown, options?: ResumeOptions): Promise<ExecutorResult>;
|
|
184
|
+
/**
|
|
185
|
+
* Whether `stored` is this executor's latest pause — the one its live runtime is still paused at. The same
|
|
186
|
+
* object, or a copy naming the same paused execution (runId + runtimeStageId).
|
|
187
|
+
*/
|
|
188
|
+
private isLatestPause;
|
|
183
189
|
/** The one terminal law for run and resume; no promise or extra await without cleanup. */
|
|
184
190
|
private finishNativeLeg;
|
|
185
191
|
/**
|
|
@@ -332,10 +338,11 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
332
338
|
/**
|
|
333
339
|
* Flush the record sink (10.1, P6): await the adapter's `flush()` — for an executor built with
|
|
334
340
|
* `sink: { adapter, flush: 'manual' }`, or before a serverless process freezes. `timeoutMs` bounds the wait; a
|
|
335
|
-
* flush still running then is `pending` (and keeps running).
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
341
|
+
* flush still running then is `pending` (and keeps running). Without `timeoutMs` it waits until the flush settles,
|
|
342
|
+
* with no limit (unlike `drainObservers`, whose default is 30 000). A given limit follows the one long-timer law:
|
|
343
|
+
* `Infinity` waits for the flush and arms no timer, a limit past 2^31 − 1 ms is waited in full, and a value that
|
|
344
|
+
* is not a number > 0 (`0`, `NaN`, a negative, `-Infinity`) gives up at once. A failed flush is counted on
|
|
345
|
+
* `getSnapshot().sink`.
|
|
339
346
|
* Done at once without a sink, or with an adapter that has no `flush`.
|
|
340
347
|
*
|
|
341
348
|
* @example
|