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.
Files changed (369) hide show
  1. package/dist/esm/index.d.ts +4 -20
  2. package/dist/esm/index.js +2 -2
  3. package/dist/esm/lib/attempt/policy.d.ts +1 -1
  4. package/dist/esm/lib/attempt/policy.js +2 -2
  5. package/dist/esm/lib/attempt/types.d.ts +2 -1
  6. package/dist/esm/lib/attempt/types.js +1 -1
  7. package/dist/esm/lib/budget/timeBudget.d.ts +13 -5
  8. package/dist/esm/lib/budget/timeBudget.js +28 -13
  9. package/dist/esm/lib/builder/FlowChartBuilder.d.ts +74 -35
  10. package/dist/esm/lib/builder/FlowChartBuilder.js +164 -112
  11. package/dist/esm/lib/builder/index.d.ts +3 -2
  12. package/dist/esm/lib/builder/index.js +4 -3
  13. package/dist/esm/lib/builder/retryLoop.d.ts +1 -1
  14. package/dist/esm/lib/builder/retryLoop.js +1 -1
  15. package/dist/esm/lib/builder/structure/StructureRecorder.d.ts +11 -14
  16. package/dist/esm/lib/builder/structure/StructureRecorder.js +3 -4
  17. package/dist/esm/lib/builder/structure/StructureRecorderDispatcher.js +18 -3
  18. package/dist/esm/lib/builder/types.d.ts +5 -4
  19. package/dist/esm/lib/builder/types.js +4 -3
  20. package/dist/esm/lib/capture/checkpointCapture.d.ts +1 -0
  21. package/dist/esm/lib/capture/checkpointCapture.js +10 -4
  22. package/dist/esm/lib/capture/envelope.d.ts +6 -3
  23. package/dist/esm/lib/capture/envelope.js +25 -10
  24. package/dist/esm/lib/capture/historyNote.js +3 -3
  25. package/dist/esm/lib/capture/nativeCoverage.d.ts +6 -0
  26. package/dist/esm/lib/capture/nativeCoverage.js +11 -1
  27. package/dist/esm/lib/capture/policies.d.ts +2 -2
  28. package/dist/esm/lib/capture/policies.js +3 -3
  29. package/dist/esm/lib/capture/summarize.d.ts +2 -1
  30. package/dist/esm/lib/capture/summarize.js +36 -8
  31. package/dist/esm/lib/contract/schema.js +14 -5
  32. package/dist/esm/lib/decide/types.d.ts +11 -8
  33. package/dist/esm/lib/decide/types.js +1 -1
  34. package/dist/esm/lib/detach/drivers/batch.js +2 -15
  35. package/dist/esm/lib/detach/drivers/immediate.js +3 -2
  36. package/dist/esm/lib/detach/drivers/sendBeacon.d.ts +4 -4
  37. package/dist/esm/lib/detach/drivers/sendBeacon.js +7 -6
  38. package/dist/esm/lib/detach/drivers/workerThread.d.ts +20 -1
  39. package/dist/esm/lib/detach/drivers/workerThread.js +56 -12
  40. package/dist/esm/lib/detach/errors.d.ts +7 -0
  41. package/dist/esm/lib/detach/errors.js +21 -0
  42. package/dist/esm/lib/detach/registry.d.ts +19 -18
  43. package/dist/esm/lib/detach/registry.js +20 -19
  44. package/dist/esm/lib/detach/spawn.d.ts +1 -2
  45. package/dist/esm/lib/detach/spawn.js +2 -3
  46. package/dist/esm/lib/detach/types.d.ts +6 -5
  47. package/dist/esm/lib/detach/types.js +5 -4
  48. package/dist/esm/lib/engine/handlers/ChildrenExecutor.js +3 -2
  49. package/dist/esm/lib/engine/handlers/DeciderHandler.js +8 -2
  50. package/dist/esm/lib/engine/handlers/NodeResolver.d.ts +9 -1
  51. package/dist/esm/lib/engine/handlers/NodeResolver.js +15 -8
  52. package/dist/esm/lib/engine/handlers/ParallelForEachHandler.d.ts +6 -1
  53. package/dist/esm/lib/engine/handlers/ParallelForEachHandler.js +150 -58
  54. package/dist/esm/lib/engine/handlers/RuntimeStructureManager.d.ts +9 -1
  55. package/dist/esm/lib/engine/handlers/RuntimeStructureManager.js +28 -17
  56. package/dist/esm/lib/engine/handlers/SelectorHandler.js +10 -3
  57. package/dist/esm/lib/engine/handlers/SubflowExecutor.d.ts +4 -2
  58. package/dist/esm/lib/engine/handlers/SubflowExecutor.js +55 -17
  59. package/dist/esm/lib/engine/handlers/SubflowInputMapper.js +33 -15
  60. package/dist/esm/lib/engine/handlers/mapperEdits.d.ts +23 -0
  61. package/dist/esm/lib/engine/handlers/mapperEdits.js +95 -0
  62. package/dist/esm/lib/engine/handlers/mapperScope.d.ts +81 -0
  63. package/dist/esm/lib/engine/handlers/mapperScope.js +151 -0
  64. package/dist/esm/lib/engine/handlers/plainObject.d.ts +15 -0
  65. package/dist/esm/lib/engine/handlers/plainObject.js +21 -0
  66. package/dist/esm/lib/engine/handlers/selectionProblem.d.ts +9 -0
  67. package/dist/esm/lib/engine/handlers/selectionProblem.js +15 -0
  68. package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -2
  69. package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +18 -10
  70. package/dist/esm/lib/engine/narrative/FlowRecorderDispatcher.d.ts +2 -2
  71. package/dist/esm/lib/engine/narrative/FlowRecorderDispatcher.js +1 -1
  72. package/dist/esm/lib/engine/narrative/NarrativeFlowRecorder.d.ts +3 -5
  73. package/dist/esm/lib/engine/narrative/NarrativeFlowRecorder.js +8 -25
  74. package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.js +10 -2
  75. package/dist/esm/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.d.ts +5 -1
  76. package/dist/esm/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.js +9 -5
  77. package/dist/esm/lib/engine/narrative/recorders/ManifestFlowRecorder.d.ts +9 -1
  78. package/dist/esm/lib/engine/narrative/recorders/ManifestFlowRecorder.js +27 -6
  79. package/dist/esm/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.d.ts +4 -0
  80. package/dist/esm/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.js +8 -1
  81. package/dist/esm/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.d.ts +2 -0
  82. package/dist/esm/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.js +6 -1
  83. package/dist/esm/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.d.ts +1 -1
  84. package/dist/esm/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.js +2 -2
  85. package/dist/esm/lib/engine/narrative/types.d.ts +1 -1
  86. package/dist/esm/lib/engine/narrative/types.js +1 -1
  87. package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +41 -44
  88. package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +74 -27
  89. package/dist/esm/lib/engine/types.d.ts +14 -4
  90. package/dist/esm/lib/engine/types.js +1 -1
  91. package/dist/esm/lib/filter/evaluator.d.ts +6 -0
  92. package/dist/esm/lib/filter/evaluator.js +144 -20
  93. package/dist/esm/lib/ids/reservedIds.d.ts +2 -2
  94. package/dist/esm/lib/ids/reservedIds.js +3 -3
  95. package/dist/esm/lib/memory/StageContext.d.ts +140 -10
  96. package/dist/esm/lib/memory/StageContext.js +292 -36
  97. package/dist/esm/lib/memory/borrowedMutation.d.ts +18 -0
  98. package/dist/esm/lib/memory/borrowedMutation.js +40 -1
  99. package/dist/esm/lib/memory/frameTypes.d.ts +6 -4
  100. package/dist/esm/lib/memory/frameTypes.js +2 -2
  101. package/dist/esm/lib/memory/hiddenObjectTrail.d.ts +118 -0
  102. package/dist/esm/lib/memory/hiddenObjectTrail.js +221 -0
  103. package/dist/esm/lib/memory/keptReads.d.ts +62 -0
  104. package/dist/esm/lib/memory/keptReads.js +79 -0
  105. package/dist/esm/lib/memory/markPlaces.d.ts +98 -0
  106. package/dist/esm/lib/memory/markPlaces.js +124 -0
  107. package/dist/esm/lib/memory/pathTargets.d.ts +48 -0
  108. package/dist/esm/lib/memory/pathTargets.js +89 -0
  109. package/dist/esm/lib/memory/redaction.d.ts +142 -24
  110. package/dist/esm/lib/memory/redaction.js +276 -87
  111. package/dist/esm/lib/memory/retainedValue/index.js +13 -2
  112. package/dist/esm/lib/memory/runPolicy.d.ts +10 -8
  113. package/dist/esm/lib/memory/runPolicy.js +3 -3
  114. package/dist/esm/lib/memory/selectedObjects.d.ts +215 -0
  115. package/dist/esm/lib/memory/selectedObjects.js +603 -0
  116. package/dist/esm/lib/memory/servedPlaces.d.ts +41 -0
  117. package/dist/esm/lib/memory/servedPlaces.js +138 -0
  118. package/dist/esm/lib/observer-queue/index.d.ts +3 -2
  119. package/dist/esm/lib/observer-queue/index.js +4 -3
  120. package/dist/esm/lib/pause/types.d.ts +8 -6
  121. package/dist/esm/lib/pause/types.js +8 -6
  122. package/dist/esm/lib/reactive/allowlist.d.ts +12 -3
  123. package/dist/esm/lib/reactive/allowlist.js +17 -6
  124. package/dist/esm/lib/reactive/arrayTraps.d.ts +10 -2
  125. package/dist/esm/lib/reactive/arrayTraps.js +117 -19
  126. package/dist/esm/lib/reactive/createTypedScope.js +35 -9
  127. package/dist/esm/lib/reactive/handles.js +3 -5
  128. package/dist/esm/lib/reactive/jsonProjection.d.ts +4 -4
  129. package/dist/esm/lib/reactive/jsonProjection.js +7 -9
  130. package/dist/esm/lib/reactive/liveView.d.ts +4 -1
  131. package/dist/esm/lib/reactive/liveView.js +10 -3
  132. package/dist/esm/lib/reactive/structuralWrite.js +23 -5
  133. package/dist/esm/lib/reactive/types.d.ts +6 -0
  134. package/dist/esm/lib/reactive/types.js +1 -1
  135. package/dist/esm/lib/reactive/writeTraps.d.ts +20 -1
  136. package/dist/esm/lib/reactive/writeTraps.js +78 -6
  137. package/dist/esm/lib/recorder/AttemptRecorder.js +2 -2
  138. package/dist/esm/lib/recorder/BoundaryStateStore.d.ts +4 -2
  139. package/dist/esm/lib/recorder/BoundaryStateStore.js +9 -6
  140. package/dist/esm/lib/recorder/CombinedRecorder.d.ts +4 -3
  141. package/dist/esm/lib/recorder/CombinedRecorder.js +3 -3
  142. package/dist/esm/lib/recorder/CompositeRecorder.d.ts +1 -1
  143. package/dist/esm/lib/recorder/CompositeRecorder.js +1 -1
  144. package/dist/esm/lib/recorder/ControlDepRecorder.d.ts +1 -1
  145. package/dist/esm/lib/recorder/ControlDepRecorder.js +2 -2
  146. package/dist/esm/lib/recorder/EmitRecorder.d.ts +1 -1
  147. package/dist/esm/lib/recorder/EmitRecorder.js +2 -2
  148. package/dist/esm/lib/recorder/QualityRecorder.js +5 -2
  149. package/dist/esm/lib/recorder/TopologyRecorder.js +14 -7
  150. package/dist/esm/lib/runner/ExecutionRuntime.d.ts +2 -3
  151. package/dist/esm/lib/runner/ExecutionRuntime.js +3 -4
  152. package/dist/esm/lib/runner/FlowChartExecutor.d.ts +12 -5
  153. package/dist/esm/lib/runner/FlowChartExecutor.js +43 -22
  154. package/dist/esm/lib/runner/RunContext.d.ts +25 -3
  155. package/dist/esm/lib/runner/RunContext.js +14 -5
  156. package/dist/esm/lib/runner/RunnableChart.d.ts +10 -3
  157. package/dist/esm/lib/runner/RunnableChart.js +45 -25
  158. package/dist/esm/lib/runner/deadline.d.ts +1 -0
  159. package/dist/esm/lib/runner/deadline.js +1 -1
  160. package/dist/esm/lib/runner/options.d.ts +6 -6
  161. package/dist/esm/lib/runner/options.js +1 -1
  162. package/dist/esm/lib/runner/recordSink.js +4 -2
  163. package/dist/esm/lib/runner/snapshot.js +3 -3
  164. package/dist/esm/lib/runner/stringifySnapshot.d.ts +4 -3
  165. package/dist/esm/lib/runner/stringifySnapshot.js +38 -4
  166. package/dist/esm/lib/schema/detect.d.ts +1 -6
  167. package/dist/esm/lib/schema/detect.js +2 -7
  168. package/dist/esm/lib/schema/validate.js +13 -3
  169. package/dist/esm/lib/scope/ScopeFacade.d.ts +4 -2
  170. package/dist/esm/lib/scope/ScopeFacade.js +17 -8
  171. package/dist/esm/lib/scope/protection/createProtectedScope.js +6 -19
  172. package/dist/esm/lib/scope/recorders/DebugRecorder.d.ts +1 -1
  173. package/dist/esm/lib/scope/recorders/DebugRecorder.js +2 -2
  174. package/dist/esm/lib/scope/state/zod/scopeFactory.js +33 -10
  175. package/dist/esm/lib/scope/state/zod/utils/validateHelper.js +1 -15
  176. package/dist/esm/lib/sinks/fileSink.d.ts +4 -1
  177. package/dist/esm/lib/sinks/fileSink.js +57 -28
  178. package/dist/esm/lib/sinks/indexedAdmission.d.ts +2 -0
  179. package/dist/esm/lib/sinks/indexedAdmission.js +11 -1
  180. package/dist/esm/lib/sinks/indexedRecordFile.js +3 -3
  181. package/dist/esm/lib/sinks/indexedScan.js +3 -4
  182. package/dist/esm/recorders.js +1 -1
  183. package/dist/index.js +3 -3
  184. package/dist/lib/attempt/policy.js +2 -2
  185. package/dist/lib/attempt/types.js +1 -1
  186. package/dist/lib/budget/timeBudget.js +28 -13
  187. package/dist/lib/builder/FlowChartBuilder.js +163 -111
  188. package/dist/lib/builder/index.js +4 -3
  189. package/dist/lib/builder/retryLoop.js +1 -1
  190. package/dist/lib/builder/structure/StructureRecorder.js +3 -4
  191. package/dist/lib/builder/structure/StructureRecorderDispatcher.js +18 -3
  192. package/dist/lib/builder/types.js +4 -3
  193. package/dist/lib/capture/checkpointCapture.js +9 -3
  194. package/dist/lib/capture/envelope.js +25 -10
  195. package/dist/lib/capture/historyNote.js +2 -2
  196. package/dist/lib/capture/nativeCoverage.js +13 -2
  197. package/dist/lib/capture/policies.js +3 -3
  198. package/dist/lib/capture/summarize.js +36 -8
  199. package/dist/lib/contract/schema.js +14 -5
  200. package/dist/lib/decide/types.js +1 -1
  201. package/dist/lib/detach/drivers/batch.js +4 -17
  202. package/dist/lib/detach/drivers/immediate.js +3 -2
  203. package/dist/lib/detach/drivers/sendBeacon.js +7 -6
  204. package/dist/lib/detach/drivers/workerThread.js +56 -12
  205. package/dist/lib/detach/errors.js +25 -0
  206. package/dist/lib/detach/registry.js +20 -19
  207. package/dist/lib/detach/spawn.js +2 -3
  208. package/dist/lib/detach/types.js +5 -4
  209. package/dist/lib/engine/handlers/ChildrenExecutor.js +3 -2
  210. package/dist/lib/engine/handlers/DeciderHandler.js +8 -2
  211. package/dist/lib/engine/handlers/NodeResolver.js +15 -8
  212. package/dist/lib/engine/handlers/ParallelForEachHandler.js +150 -58
  213. package/dist/lib/engine/handlers/RuntimeStructureManager.js +28 -17
  214. package/dist/lib/engine/handlers/SelectorHandler.js +10 -3
  215. package/dist/lib/engine/handlers/SubflowExecutor.js +55 -17
  216. package/dist/lib/engine/handlers/SubflowInputMapper.js +35 -17
  217. package/dist/lib/engine/handlers/mapperEdits.js +99 -0
  218. package/dist/lib/engine/handlers/mapperScope.js +157 -0
  219. package/dist/lib/engine/handlers/plainObject.js +25 -0
  220. package/dist/lib/engine/handlers/selectionProblem.js +19 -0
  221. package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +18 -10
  222. package/dist/lib/engine/narrative/FlowRecorderDispatcher.js +1 -1
  223. package/dist/lib/engine/narrative/NarrativeFlowRecorder.js +8 -25
  224. package/dist/lib/engine/narrative/formatting/ruleEvidence/index.js +10 -2
  225. package/dist/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.js +9 -5
  226. package/dist/lib/engine/narrative/recorders/ManifestFlowRecorder.js +27 -6
  227. package/dist/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.js +8 -1
  228. package/dist/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.js +6 -1
  229. package/dist/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.js +2 -2
  230. package/dist/lib/engine/narrative/types.js +1 -1
  231. package/dist/lib/engine/traversal/FlowchartTraverser.js +74 -27
  232. package/dist/lib/engine/types.js +1 -1
  233. package/dist/lib/filter/evaluator.js +144 -20
  234. package/dist/lib/ids/reservedIds.js +3 -3
  235. package/dist/lib/memory/StageContext.js +290 -34
  236. package/dist/lib/memory/borrowedMutation.js +42 -2
  237. package/dist/lib/memory/frameTypes.js +2 -2
  238. package/dist/lib/memory/hiddenObjectTrail.js +225 -0
  239. package/dist/lib/memory/keptReads.js +83 -0
  240. package/dist/lib/memory/markPlaces.js +132 -0
  241. package/dist/lib/memory/pathTargets.js +95 -0
  242. package/dist/lib/memory/redaction.js +281 -90
  243. package/dist/lib/memory/retainedValue/index.js +13 -2
  244. package/dist/lib/memory/runPolicy.js +3 -3
  245. package/dist/lib/memory/selectedObjects.js +608 -0
  246. package/dist/lib/memory/servedPlaces.js +142 -0
  247. package/dist/lib/observer-queue/index.js +4 -3
  248. package/dist/lib/pause/types.js +8 -6
  249. package/dist/lib/reactive/allowlist.js +19 -7
  250. package/dist/lib/reactive/arrayTraps.js +116 -18
  251. package/dist/lib/reactive/createTypedScope.js +34 -8
  252. package/dist/lib/reactive/handles.js +3 -5
  253. package/dist/lib/reactive/jsonProjection.js +7 -9
  254. package/dist/lib/reactive/liveView.js +10 -3
  255. package/dist/lib/reactive/structuralWrite.js +23 -5
  256. package/dist/lib/reactive/types.js +1 -1
  257. package/dist/lib/reactive/writeTraps.js +82 -7
  258. package/dist/lib/recorder/AttemptRecorder.js +2 -2
  259. package/dist/lib/recorder/BoundaryStateStore.js +9 -6
  260. package/dist/lib/recorder/CombinedRecorder.js +3 -3
  261. package/dist/lib/recorder/CompositeRecorder.js +1 -1
  262. package/dist/lib/recorder/ControlDepRecorder.js +2 -2
  263. package/dist/lib/recorder/EmitRecorder.js +2 -2
  264. package/dist/lib/recorder/QualityRecorder.js +5 -2
  265. package/dist/lib/recorder/TopologyRecorder.js +14 -7
  266. package/dist/lib/runner/ExecutionRuntime.js +3 -4
  267. package/dist/lib/runner/FlowChartExecutor.js +43 -22
  268. package/dist/lib/runner/RunContext.js +14 -5
  269. package/dist/lib/runner/RunnableChart.js +47 -26
  270. package/dist/lib/runner/deadline.js +1 -1
  271. package/dist/lib/runner/options.js +1 -1
  272. package/dist/lib/runner/recordSink.js +4 -2
  273. package/dist/lib/runner/snapshot.js +3 -3
  274. package/dist/lib/runner/stringifySnapshot.js +38 -4
  275. package/dist/lib/schema/detect.js +2 -7
  276. package/dist/lib/schema/validate.js +13 -3
  277. package/dist/lib/scope/ScopeFacade.js +17 -8
  278. package/dist/lib/scope/protection/createProtectedScope.js +6 -19
  279. package/dist/lib/scope/recorders/DebugRecorder.js +2 -2
  280. package/dist/lib/scope/state/zod/scopeFactory.js +32 -9
  281. package/dist/lib/scope/state/zod/utils/validateHelper.js +1 -15
  282. package/dist/lib/sinks/fileSink.js +57 -28
  283. package/dist/lib/sinks/indexedAdmission.js +13 -2
  284. package/dist/lib/sinks/indexedRecordFile.js +2 -2
  285. package/dist/lib/sinks/indexedScan.js +2 -3
  286. package/dist/recorders.js +1 -1
  287. package/dist/types/index.d.ts +4 -20
  288. package/dist/types/lib/attempt/policy.d.ts +1 -1
  289. package/dist/types/lib/attempt/types.d.ts +2 -1
  290. package/dist/types/lib/budget/timeBudget.d.ts +13 -5
  291. package/dist/types/lib/builder/FlowChartBuilder.d.ts +74 -35
  292. package/dist/types/lib/builder/index.d.ts +3 -2
  293. package/dist/types/lib/builder/retryLoop.d.ts +1 -1
  294. package/dist/types/lib/builder/structure/StructureRecorder.d.ts +11 -14
  295. package/dist/types/lib/builder/types.d.ts +5 -4
  296. package/dist/types/lib/capture/checkpointCapture.d.ts +1 -0
  297. package/dist/types/lib/capture/envelope.d.ts +6 -3
  298. package/dist/types/lib/capture/nativeCoverage.d.ts +6 -0
  299. package/dist/types/lib/capture/policies.d.ts +2 -2
  300. package/dist/types/lib/capture/summarize.d.ts +2 -1
  301. package/dist/types/lib/decide/types.d.ts +11 -8
  302. package/dist/types/lib/detach/drivers/sendBeacon.d.ts +4 -4
  303. package/dist/types/lib/detach/drivers/workerThread.d.ts +20 -1
  304. package/dist/types/lib/detach/errors.d.ts +7 -0
  305. package/dist/types/lib/detach/registry.d.ts +19 -18
  306. package/dist/types/lib/detach/spawn.d.ts +1 -2
  307. package/dist/types/lib/detach/types.d.ts +6 -5
  308. package/dist/types/lib/engine/handlers/NodeResolver.d.ts +9 -1
  309. package/dist/types/lib/engine/handlers/ParallelForEachHandler.d.ts +6 -1
  310. package/dist/types/lib/engine/handlers/RuntimeStructureManager.d.ts +9 -1
  311. package/dist/types/lib/engine/handlers/SubflowExecutor.d.ts +4 -2
  312. package/dist/types/lib/engine/handlers/mapperEdits.d.ts +23 -0
  313. package/dist/types/lib/engine/handlers/mapperScope.d.ts +81 -0
  314. package/dist/types/lib/engine/handlers/plainObject.d.ts +15 -0
  315. package/dist/types/lib/engine/handlers/selectionProblem.d.ts +9 -0
  316. package/dist/types/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +4 -2
  317. package/dist/types/lib/engine/narrative/FlowRecorderDispatcher.d.ts +2 -2
  318. package/dist/types/lib/engine/narrative/NarrativeFlowRecorder.d.ts +3 -5
  319. package/dist/types/lib/engine/narrative/recorders/AdaptiveNarrativeFlowRecorder.d.ts +5 -1
  320. package/dist/types/lib/engine/narrative/recorders/ManifestFlowRecorder.d.ts +9 -1
  321. package/dist/types/lib/engine/narrative/recorders/MilestoneNarrativeFlowRecorder.d.ts +4 -0
  322. package/dist/types/lib/engine/narrative/recorders/ProgressiveNarrativeFlowRecorder.d.ts +2 -0
  323. package/dist/types/lib/engine/narrative/recorders/SeparateNarrativeFlowRecorder.d.ts +1 -1
  324. package/dist/types/lib/engine/narrative/types.d.ts +1 -1
  325. package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +41 -44
  326. package/dist/types/lib/engine/types.d.ts +14 -4
  327. package/dist/types/lib/filter/evaluator.d.ts +6 -0
  328. package/dist/types/lib/ids/reservedIds.d.ts +2 -2
  329. package/dist/types/lib/memory/StageContext.d.ts +140 -10
  330. package/dist/types/lib/memory/borrowedMutation.d.ts +18 -0
  331. package/dist/types/lib/memory/frameTypes.d.ts +6 -4
  332. package/dist/types/lib/memory/hiddenObjectTrail.d.ts +118 -0
  333. package/dist/types/lib/memory/keptReads.d.ts +62 -0
  334. package/dist/types/lib/memory/markPlaces.d.ts +98 -0
  335. package/dist/types/lib/memory/pathTargets.d.ts +48 -0
  336. package/dist/types/lib/memory/redaction.d.ts +142 -24
  337. package/dist/types/lib/memory/runPolicy.d.ts +10 -8
  338. package/dist/types/lib/memory/selectedObjects.d.ts +215 -0
  339. package/dist/types/lib/memory/servedPlaces.d.ts +41 -0
  340. package/dist/types/lib/observer-queue/index.d.ts +3 -2
  341. package/dist/types/lib/pause/types.d.ts +8 -6
  342. package/dist/types/lib/reactive/allowlist.d.ts +12 -3
  343. package/dist/types/lib/reactive/arrayTraps.d.ts +10 -2
  344. package/dist/types/lib/reactive/jsonProjection.d.ts +4 -4
  345. package/dist/types/lib/reactive/liveView.d.ts +4 -1
  346. package/dist/types/lib/reactive/types.d.ts +6 -0
  347. package/dist/types/lib/reactive/writeTraps.d.ts +20 -1
  348. package/dist/types/lib/recorder/BoundaryStateStore.d.ts +4 -2
  349. package/dist/types/lib/recorder/CombinedRecorder.d.ts +4 -3
  350. package/dist/types/lib/recorder/CompositeRecorder.d.ts +1 -1
  351. package/dist/types/lib/recorder/ControlDepRecorder.d.ts +1 -1
  352. package/dist/types/lib/recorder/EmitRecorder.d.ts +1 -1
  353. package/dist/types/lib/runner/ExecutionRuntime.d.ts +2 -3
  354. package/dist/types/lib/runner/FlowChartExecutor.d.ts +12 -5
  355. package/dist/types/lib/runner/RunContext.d.ts +25 -3
  356. package/dist/types/lib/runner/RunnableChart.d.ts +10 -3
  357. package/dist/types/lib/runner/deadline.d.ts +1 -0
  358. package/dist/types/lib/runner/options.d.ts +6 -6
  359. package/dist/types/lib/runner/stringifySnapshot.d.ts +4 -3
  360. package/dist/types/lib/schema/detect.d.ts +1 -6
  361. package/dist/types/lib/scope/ScopeFacade.d.ts +4 -2
  362. package/dist/types/lib/scope/recorders/DebugRecorder.d.ts +1 -1
  363. package/dist/types/lib/sinks/fileSink.d.ts +4 -1
  364. package/dist/types/lib/sinks/indexedAdmission.d.ts +2 -0
  365. package/package.json +6 -8
  366. package/dist/esm/lib/scope/state/installResolvers.d.ts +0 -4
  367. package/dist/esm/lib/scope/state/installResolvers.js +0 -15
  368. package/dist/lib/scope/state/installResolvers.js +0 -19
  369. package/dist/types/lib/scope/state/installResolvers.d.ts +0 -4
@@ -0,0 +1,124 @@
1
+ /**
2
+ * markPlaces.ts — where the value of a redaction mark lives.
3
+ *
4
+ * A mark is a NAME (`redaction.ts · RedactionRule`): a value that came from a hidden key and was
5
+ * written under another name stays hidden under that name for the rest of the run. The law lets a
6
+ * delete end a mark, because a key that is gone holds nothing to hide.
7
+ *
8
+ * WHY THIS FILE EXISTS. A run has more than one key of a name: every sub-flowchart has its own state,
9
+ * and every parallel branch its own namespace. "The key was deleted" is true of ONE of them. The mark
10
+ * was kept by name alone, so the first delete of the name anywhere ended it everywhere: a
11
+ * sub-flowchart that deleted its own `copy` un-hid the parent's `copy`, which still held the secret,
12
+ * and the parent's next write of it went into the commit log in the clear.
13
+ *
14
+ * So a mark remembers every PLACE a hidden value under its name landed: the state it landed in and the
15
+ * address under it. THE LAW: a delete ends a mark only by taking away its LAST place. A delete at a
16
+ * place where no value of that name ever landed takes nothing, and changes nothing.
17
+ *
18
+ * A value can also be ON ITS WAY: decided hidden, and written later. The fan-out over hidden items
19
+ * marks `item` and its results key before any branch runs, and the values land as the branches are
20
+ * mounted and when the last one is done. Until then the one who decided holds a place of its own
21
+ * ({@link pendingPlace}) and lets go of it once the values have landed, so nothing that runs in
22
+ * between can end the mark first.
23
+ *
24
+ * And a delete ends nothing while it is only STAGED. A retry may throw the try away, the commit may
25
+ * fail, and the stage may write the key again before it commits. So the frame asks the state once its
26
+ * commit has landed, and takes the place away only when the key is really gone
27
+ * (`StageContext · endMarksOfLandedDeletes`).
28
+ *
29
+ * WHY A LEDGER BESIDE THE MARKS, and not one mark for each place. Marking stays run-wide and by name,
30
+ * exactly as it was: a name hidden in one place is hidden in every place, which errs on the hiding
31
+ * side. Only the way a mark ENDS changed: it ends when no value it stands for is left, or still to
32
+ * come.
33
+ *
34
+ * WHAT THIS COSTS IN HIDING. A place is taken away only by a delete that lands there, so a name stays
35
+ * hidden for the rest of the run once a hidden value under it landed in a place nothing deletes:
36
+ * - a sub-flowchart's state (also after the sub-flowchart is over, and whatever its parent deletes);
37
+ * - a parallel branch's namespace (a branch that only CHANGED a hidden list wrote its own copy there);
38
+ * - each branch of a fan-out over hidden items (`item` stays hidden after the fan-out);
39
+ * - a place a failed try wrote to, and both names of a fan-out that failed (it never lets go);
40
+ * - anything that came over a pause (the checkpoint carries names, not places).
41
+ * And a stage that deletes a key and writes it again keeps the name hidden: to show a new value,
42
+ * delete in one stage and write in a later one.
43
+ *
44
+ * WHERE IT HIDES LESS THAN BEFORE, the one case: a mark that never had a value ends when its asker
45
+ * lets go. A fan-out over hidden items that handed out NO items used to leave `item` marked with
46
+ * nothing under it; now that mark ends with the fan-out.
47
+ *
48
+ * In memory it costs one short text for each place a hidden name landed, kept until the run's rule is
49
+ * gone (measured by the second reader of this change: about 94 bytes a place on a fan-out of 5,000).
50
+ *
51
+ * The idea is plain reference counting: a mark is held by its places. No outside source.
52
+ *
53
+ * A leaf: it imports nothing, and only the rule and the frame ask it.
54
+ */
55
+ const heapNumbers = new WeakMap();
56
+ let heapsNumbered = 0;
57
+ /**
58
+ * The place a staged write lands, as text: the state (heap) it lands in and the address under it.
59
+ * Two writes are at the same place exactly when both are the same. The heap is named by a number, not
60
+ * held, so a mark keeps no state alive.
61
+ *
62
+ * ```ts
63
+ * placeOf(parentState, []) === placeOf(parentState, []); // the parent's own keys
64
+ * placeOf(parentState, []) !== placeOf(subflowState, []); // a sub-flowchart has its own state
65
+ * placeOf(parentState, []) !== placeOf(parentState, ['runs', 'a']); // a parallel branch has its own namespace
66
+ * ```
67
+ */
68
+ export function placeOf(heap, address) {
69
+ let number = heapNumbers.get(heap);
70
+ if (number === undefined)
71
+ heapNumbers.set(heap, (number = ++heapsNumbered));
72
+ return `${number}\u0000${address.join('\u001f')}`;
73
+ }
74
+ /**
75
+ * The place of a mark that came over a pause. The names travel in the checkpoint; where their values
76
+ * live in the resumed state does not. No write lands here, so no delete can take it away.
77
+ */
78
+ export const CARRIED_OVER_A_PAUSE = '\u0000carried over a pause';
79
+ let pendingNumbered = 0;
80
+ /**
81
+ * A place for a value that is on its way: decided hidden, not yet written. No write lands here, so no
82
+ * delete can take it. Whoever asked for it marks the name with it (`RedactionRule · mark`) and lets go
83
+ * of it (`RedactionRule · unmark`, with this place) once the value has landed.
84
+ *
85
+ * ```ts
86
+ * const pending = pendingPlace();
87
+ * rule.mark('results', pending); // decided: what lands under `results` is hidden
88
+ * // … other stages run; one of them deletes its own `results` — the mark stays …
89
+ * // … the value lands under `results` (the write funnel notes its place) …
90
+ * rule.unmark('results', pending); // let go: the mark now ends with the key that holds the value
91
+ * ```
92
+ */
93
+ export function pendingPlace() {
94
+ return `\u0000on its way ${++pendingNumbered}`;
95
+ }
96
+ /** Name → the places a hidden value under it landed. Kept for one shared set of marked names: rules that share the set share this. */
97
+ const placesByMarkedSet = new WeakMap();
98
+ /** A hidden value under `key` landed at `place`. */
99
+ export function notePlace(marked, key, place) {
100
+ let places = placesByMarkedSet.get(marked);
101
+ if (places === undefined)
102
+ placesByMarkedSet.set(marked, (places = new Map()));
103
+ const at = places.get(key);
104
+ if (at === undefined)
105
+ places.set(key, new Set([place]));
106
+ else
107
+ at.add(place);
108
+ }
109
+ /**
110
+ * A delete of `key` at `place`: take that place away. Says whether the place was one of the key's
111
+ * (`taken`) and whether another place still holds a value under the name (`held`). A key with no
112
+ * known place answers `{ taken: false, held: false }`.
113
+ */
114
+ export function takePlace(marked, key, place) {
115
+ const at = placesByMarkedSet.get(marked)?.get(key);
116
+ if (at === undefined)
117
+ return { taken: false, held: false };
118
+ return { taken: at.delete(place), held: at.size > 0 };
119
+ }
120
+ /** The mark of `key` ended: it has no places any more. */
121
+ export function forgetPlaces(marked, key) {
122
+ placesByMarkedSet.get(marked)?.delete(key);
123
+ }
124
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFya1BsYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvbWVtb3J5L21hcmtQbGFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUR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5cbi8qKlxuICogQSBkZWxldGUgb2YgYGtleWAgYXQgYHBsYWNlYDogdGFrZSB0aGF0IHBsYWNlIGF3YXkuIFNheXMgd2hldGhlciB0aGUgcGxhY2Ugd2FzIG9uZSBvZiB0aGUga2V5J3NcbiAqIChgdGFrZW5gKSBhbmQgd2hldGhlciBhbm90aGVyIHBsYWNlIHN0aWxsIGhvbGRzIGEgdmFsdWUgdW5kZXIgdGhlIG5hbWUgKGBoZWxkYCkuIEEga2V5IHdpdGggbm9cbiAqIGtub3duIHBsYWNlIGFuc3dlcnMgYHsgdGFrZW46IGZhbHNlLCBoZWxkOiBmYWxzZSB9YC5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHRha2VQbGFjZShtYXJrZWQ6IFNldDxzdHJpbmc+LCBrZXk6IHN0cmluZywgcGxhY2U6IHN0cmluZyk6IHsgdGFrZW46IGJvb2xlYW47IGhlbGQ6IGJvb2xlYW4gfSB7XG4gIGNvbnN0IGF0ID0gcGxhY2VzQnlNYXJrZWRTZXQuZ2V0KG1hcmtlZCk/LmdldChrZXkpO1xuICBpZiAoYXQgPT09IHVuZGVmaW5lZCkgcmV0dXJuIHsgdGFrZW46IGZhbHNlLCBoZWxkOiBmYWxzZSB9O1xuICByZXR1cm4geyB0YWtlbjogYXQuZGVsZXRlKHBsYWNlKSwgaGVsZDogYXQuc2l6ZSA+IDAgfTtcbn1cblxuLyoqIFRoZSBtYXJrIG9mIGBrZXlgIGVuZGVkOiBpdCBoYXMgbm8gcGxhY2VzIGFueSBtb3JlLiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZvcmdldFBsYWNlcyhtYXJrZWQ6IFNldDxzdHJpbmc+LCBrZXk6IHN0cmluZyk6IHZvaWQge1xuICBwbGFjZXNCeU1hcmtlZFNldC5nZXQobWFya2VkKT8uZGVsZXRlKGtleSk7XG59XG4iXX0=
@@ -0,0 +1,48 @@
1
+ /**
2
+ * pathTargets.ts — the field paths still to reach below a node of a served record, and what they say
3
+ * about each key of that node.
4
+ *
5
+ * WHY THIS FILE EXISTS. The walk that serves a record under a redaction rule (`redaction.ts`, "the
6
+ * path walk") carries, for each node, the fields still to reach below it: its TARGETS. For each key
7
+ * of the node it asks which targets start at that key: is the value masked here, and which targets
8
+ * go on below it. That was a scan of every target for every key, so a record with N keys and N
9
+ * targets cost N × N.
10
+ *
11
+ * A policy seldom declares many fields for one key. But a key takes one field for each hidden object
12
+ * a stage puts below it (`redaction.ts · inheritByIdentity`), so the number of targets comes from
13
+ * data. Measured with `bench/hidden-object-scaling.ts` (the `declared` shape, 12 Nov 2026): a record
14
+ * with 8,000 hidden fields took 348 ms to copy under its policy, and four times the fields took
15
+ * fourteen times as long. Here a long list of targets is grouped by its first key ONCE for the node,
16
+ * and each key is one lookup: keys + targets. The same record takes 50 ms.
17
+ *
18
+ * WHY A SHORT LIST IS STILL SCANNED. Almost every node of every served record has no target, or a
19
+ * few. Grouping builds a map for each node; a scan of three targets is cheaper than that.
20
+ *
21
+ * No outside source. A leaf: it imports nothing.
22
+ */
23
+ /** A field still to reach below a node: the path segments left to walk. */
24
+ export type Target = readonly string[];
25
+ /** What the targets of a node say about one of its keys. */
26
+ export interface Step {
27
+ /** A target ends at this key: the value under it is masked here. */
28
+ readonly masked: boolean;
29
+ /** The targets that go on below this key, each without the key. */
30
+ readonly below: readonly Target[];
31
+ }
32
+ /** From this many targets on, a node groups them by first key before its keys are asked. */
33
+ export declare const MANY_TARGETS = 16;
34
+ /** Each field path as one literal key and, when dotted, as its segments. */
35
+ export declare function targetsOf(paths: readonly string[] | undefined): Target[];
36
+ /** The memo key of a target state — order-free. */
37
+ export declare function signatureOf(targets: readonly Target[]): string;
38
+ /**
39
+ * The targets of ONE node, ready to be asked key by key. Ask it once for each key of the node.
40
+ *
41
+ * ```ts
42
+ * const steps = stepsOf([['card', 'number'], ['pin']]);
43
+ * steps('card'); // { masked: false, below: [['number']] }
44
+ * steps('pin'); // { masked: true, below: [] }
45
+ * steps('name'); // { masked: false, below: [] }
46
+ * ```
47
+ */
48
+ export declare function stepsOf(targets: readonly Target[]): (key: string) => Step;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * pathTargets.ts — the field paths still to reach below a node of a served record, and what they say
3
+ * about each key of that node.
4
+ *
5
+ * WHY THIS FILE EXISTS. The walk that serves a record under a redaction rule (`redaction.ts`, "the
6
+ * path walk") carries, for each node, the fields still to reach below it: its TARGETS. For each key
7
+ * of the node it asks which targets start at that key: is the value masked here, and which targets
8
+ * go on below it. That was a scan of every target for every key, so a record with N keys and N
9
+ * targets cost N × N.
10
+ *
11
+ * A policy seldom declares many fields for one key. But a key takes one field for each hidden object
12
+ * a stage puts below it (`redaction.ts · inheritByIdentity`), so the number of targets comes from
13
+ * data. Measured with `bench/hidden-object-scaling.ts` (the `declared` shape, 12 Nov 2026): a record
14
+ * with 8,000 hidden fields took 348 ms to copy under its policy, and four times the fields took
15
+ * fourteen times as long. Here a long list of targets is grouped by its first key ONCE for the node,
16
+ * and each key is one lookup: keys + targets. The same record takes 50 ms.
17
+ *
18
+ * WHY A SHORT LIST IS STILL SCANNED. Almost every node of every served record has no target, or a
19
+ * few. Grouping builds a map for each node; a scan of three targets is cheaper than that.
20
+ *
21
+ * No outside source. A leaf: it imports nothing.
22
+ */
23
+ /** From this many targets on, a node groups them by first key before its keys are asked. */
24
+ export const MANY_TARGETS = 16;
25
+ const NO_TARGETS = Object.freeze([]);
26
+ /** The step of a key no target starts at. Shared and frozen: nobody may add to it. */
27
+ const NO_STEP = Object.freeze({ masked: false, below: NO_TARGETS });
28
+ const noSteps = () => NO_STEP;
29
+ /** Each field path as one literal key and, when dotted, as its segments. */
30
+ export function targetsOf(paths) {
31
+ const out = [];
32
+ for (const path of paths ?? []) {
33
+ out.push([path]);
34
+ if (path.includes('.'))
35
+ out.push(path.split('.'));
36
+ }
37
+ return out;
38
+ }
39
+ /** The memo key of a target state — order-free. */
40
+ export function signatureOf(targets) {
41
+ return targets.length === 0
42
+ ? ''
43
+ : targets
44
+ .map((t) => t.join('\u001f'))
45
+ .sort()
46
+ .join('\u001e');
47
+ }
48
+ /**
49
+ * The targets of ONE node, ready to be asked key by key. Ask it once for each key of the node.
50
+ *
51
+ * ```ts
52
+ * const steps = stepsOf([['card', 'number'], ['pin']]);
53
+ * steps('card'); // { masked: false, below: [['number']] }
54
+ * steps('pin'); // { masked: true, below: [] }
55
+ * steps('name'); // { masked: false, below: [] }
56
+ * ```
57
+ */
58
+ export function stepsOf(targets) {
59
+ if (targets.length === 0)
60
+ return noSteps;
61
+ if (targets.length < MANY_TARGETS)
62
+ return (key) => scan(targets, key);
63
+ const byKey = new Map();
64
+ for (const target of targets) {
65
+ let step = byKey.get(target[0]);
66
+ if (step === undefined)
67
+ byKey.set(target[0], (step = { masked: false, below: [] }));
68
+ if (target.length === 1)
69
+ step.masked = true;
70
+ else
71
+ step.below.push(target.slice(1));
72
+ }
73
+ return (key) => byKey.get(key) ?? NO_STEP;
74
+ }
75
+ /** The step of `key` by reading every target: for a short list. */
76
+ function scan(targets, key) {
77
+ const below = [];
78
+ let masked = false;
79
+ for (const target of targets) {
80
+ if (target[0] !== key)
81
+ continue;
82
+ if (target.length === 1)
83
+ masked = true;
84
+ else
85
+ below.push(target.slice(1));
86
+ }
87
+ return { masked, below };
88
+ }
89
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0aFRhcmdldHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL21lbW9yeS9wYXRoVGFyZ2V0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBYUgsNEZBQTRGO0FBQzVGLE1BQU0sQ0FBQyxNQUFNLFlBQVksR0FBRyxFQUFFLENBQUM7QUFFL0IsTUFBTSxVQUFVLEdBQXNCLE1BQU0sQ0FBQyxNQUFNLENBQUMsRUFB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HJ1ZTtcbiAgICBlbHNlIHN0ZXAuYmVsb3cucHVzaCh0YXJnZXQuc2xpY2UoMSkpO1xuICB9XG4gIHJldHVybiAoa2V5KSA9PiBieUtleS5nZXQoa2V5KSA/PyBOT19TVEVQO1xufVxuXG4vKiogVGhlIHN0ZXAgb2YgYGtleWAgYnkgcmVhZGluZyBldmVyeSB0YXJnZXQ6IGZvciBhIHNob3J0IGxpc3QuICovXG5mdW5jdGlvbiBzY2FuKHRhcmdldHM6IHJlYWRvbmx5IFRhcmdldFtdLCBrZXk6IHN0cmluZyk6IFN0ZXAge1xuICBjb25zdCBiZWxvdzogVGFyZ2V0W10gPSBbXTtcbiAgbGV0IG1hc2tlZCA9IGZhbHNlO1xuICBmb3IgKGNvbnN0IHRhcmdldCBvZiB0YXJnZXRzKSB7XG4gICAgaWYgKHRhcmdldFswXSAhPT0ga2V5KSBjb250aW51ZTtcbiAgICBpZiAodGFyZ2V0Lmxlbmd0aCA9PT0gMSkgbWFza2VkID0gdHJ1ZTtcbiAgICBlbHNlIGJlbG93LnB1c2godGFyZ2V0LnNsaWNlKDEpKTtcbiAgfVxuICByZXR1cm4geyBtYXNrZWQsIGJlbG93IH07XG59XG4iXX0=
@@ -50,27 +50,29 @@
50
50
  * the engine's (L4, beside the run policy that carries the rule). The BYTES of a
51
51
  * verdict are the record's: the frame hands its scrub (`whole`, or the
52
52
  * `fields` inside the value — {@link scrubOf}) to `RecordFrame · write`, and
53
- * the record's own scrub (`memory/scrub.ts`, L2) writes the log's placeholder
53
+ * the record's own scrub (in foottrace) writes the log's placeholder
54
54
  * at commit. Before C4 the scrub lived here too, so the record imported the
55
55
  * engine's policy module to write a string.
56
56
  *
57
57
  * TWO PLACEHOLDERS, BOTH HISTORICAL, ONE PER OWNER: the commit log and the
58
- * mirror carry `'REDACTED'` (`LOG_PLACEHOLDER`, `memory/placeholders.ts` — a
59
- * record byte, written by `memory/scrub.ts`); every scope-tier view — scope
58
+ * mirror carry `'REDACTED'` (foottrace's `LOG_PLACEHOLDER` — a
59
+ * record byte, written by foottrace's scrub); every scope-tier view — scope
60
60
  * recorder events, `stageReads`/`stageWrites`, narrative — carries
61
61
  * `'[REDACTED]'` ({@link SCOPE_PLACEHOLDER}, below — the verdict's own).
62
- * Neither string changed in 9.19.0 or since; each is spelled once in `src/`.
62
+ * Neither string changed in 9.19.0 or since; the scope one is spelled once in
63
+ * `src/`, the log one once in foottrace.
63
64
  */
64
65
  import type { WriteScrub, WriteVerb } from 'foottrace/write';
65
66
  import type { StructuredErrorInfo } from '../errors/errorInfo.js';
66
67
  import type { RedactionMarks } from '../pause/types.js';
68
+ import type { FoundSelected, SameContent, SelectedObjects, ShownObjects } from './selectedObjects.js';
67
69
  /**
68
70
  * What the SCOPE CHANNEL carries where a value was scrubbed: a scope recorder's read, write and
69
71
  * commit events, the `stageReads` / `stageWrites` retention, the narrative, a decision's evidence, an
70
72
  * emit payload matched by `emitPatterns`, a pause payload's served form and a subflow's narrated seed
71
73
  * (`onSubflowEntry`) — every value this verdict serves, unless its caller passes the log's string.
72
74
  *
73
- * Its twin is the RECORD's `LOG_PLACEHOLDER` (`'REDACTED'`, `memory/placeholders.ts`): the commit log,
75
+ * Its twin is the RECORD's `LOG_PLACEHOLDER` (`'REDACTED'`, in foottrace): the commit log,
74
76
  * the redacted mirror and everything served from them. So NOT every recorder event carries this one:
75
77
  * `onSubflowExit.outputState` serves the subflow's redacted mirror when a policy keeps one, and so
76
78
  * carries the log's string (without a mirror — per-call marks alone — it is the subflow's heap
@@ -94,6 +96,11 @@ export interface RedactionPolicy {
94
96
  * Pattern matching is skipped for keys that exceed an internal length cap
95
97
  * (designed to prevent ReDoS on pathological patterns). For very long key
96
98
  * names, use `keys` (exact match) instead of patterns.
99
+ *
100
+ * A pattern that depends on a dotted PATH (for example `/auth\.token/`) is
101
+ * tested against paths inside a value handed out whole. A path past the same
102
+ * cap cannot be tested, so the value at it is served as the placeholder: the
103
+ * safe side. Use `keys` or `fields` for values that deep.
97
104
  */
98
105
  patterns?: RegExp[];
99
106
  /** Field-level redaction within objects — key → array of fields to scrub.
@@ -195,6 +202,17 @@ export interface EvidenceRule {
195
202
  * common top-level key. (The record spells the same name for `readKeys`, `RecordFrame · noteRead`.)
196
203
  */
197
204
  export declare function userKeyOf(path: readonly string[], key: string): string;
205
+ /**
206
+ * A staged delete's claim on a mark (`markStagedWrite`): which rule keeps the name, the name, and where
207
+ * the delete lands. A delete is only STAGED until its frame commits, so nothing ends here. The frame
208
+ * ends the mark ({@link RedactionRule.unmark}) once the delete has landed and the key is gone from the
209
+ * state (`StageContext · endMarksOfLandedDeletes`).
210
+ */
211
+ export interface StagedDelete {
212
+ readonly rule: RedactionRule;
213
+ readonly key: string;
214
+ readonly place?: string;
215
+ }
198
216
  export declare class RedactionRule {
199
217
  private policy;
200
218
  private diagnosticRule;
@@ -204,6 +222,7 @@ export declare class RedactionRule {
204
222
  /** The policy's patterns that can depend on a whole dotted path ({@link needsPath}) — per `setPolicy`. */
205
223
  private pathPatterns;
206
224
  private walkLimitWarned;
225
+ private pathCapWarned;
207
226
  /**
208
227
  * Keys marked secret for the rest of the run — by a per-call
209
228
  * `setValue(key, value, true)`, or by any write the policy redacted whole.
@@ -218,6 +237,8 @@ export declare class RedactionRule {
218
237
  * Run-wide, by name, like {@link marked}.
219
238
  */
220
239
  private inherited;
240
+ /** For a key with BOTH declared and inherited fields: the one list of them all ({@link fieldsOf}, why it is kept). */
241
+ private joined;
221
242
  /** This run's thrown values served masked (their text selected, or a selected key inside them) → their served form. */
222
243
  private maskedErrors;
223
244
  constructor(policy?: RedactionPolicy, marked?: Set<string>);
@@ -234,9 +255,32 @@ export declare class RedactionRule {
234
255
  /** The shared marked-keys set — for the `@internal` sharing protocol and `decide()`. */
235
256
  markedKeys(): Set<string>;
236
257
  useMarkedKeys(shared: Set<string>): void;
237
- mark(key: string): void;
238
- /** Deleting a key clears its per-call mark and any fields a mapper gave it; a policy verdict survives it. */
239
- unmark(key: string): void;
258
+ /**
259
+ * Mark `key` for the rest of the run. `place`, when the caller knows it, is where the hidden value
260
+ * landed (`markPlaces.ts · placeOf`); without one the name is marked and its place follows with the write
261
+ * that lands the value ({@link landed}).
262
+ */
263
+ mark(key: string, place?: string): void;
264
+ /**
265
+ * Whether this rule ITSELF keeps `key` hidden: a mark, or fields a mapper handed it. Not what the
266
+ * policy selects: no delete ends that, so it needs no place.
267
+ */
268
+ keeps(key: string): boolean;
269
+ /** A value landed at `place`, at or under `key`. Noted only for a name this rule itself {@link keeps}. */
270
+ landed(key: string, place: string): void;
271
+ /**
272
+ * The key is gone: end its mark, and take back any fields a mapper gave it. A policy verdict
273
+ * survives it.
274
+ *
275
+ * With `place` (where the delete landed), only that place is taken away, and the mark ends when it
276
+ * was the LAST one: another key of the same name, in another sub-flowchart or parallel branch, may
277
+ * still hold the hidden value. A delete at a place where no value of that name landed takes nothing
278
+ * and changes nothing — it removed no value this mark stands for (and a value may still be on its
279
+ * way, `markPlaces.ts · pendingPlace`). Without `place` the caller does not say where, and the mark
280
+ * ends whatever places it has: that is for a direct caller who knows what it deleted. The engine
281
+ * always says where.
282
+ */
283
+ unmark(key: string, place?: string): void;
240
284
  /** Key-level verdict: marked, listed in `policy.keys`, or matching a pattern. */
241
285
  isKeyRedacted(key: string): boolean;
242
286
  /**
@@ -359,6 +403,12 @@ export declare class RedactionRule {
359
403
  * `rootDecided`: the root's own keys were already decided (`retainRecord`).
360
404
  */
361
405
  private namesWalk;
406
+ /**
407
+ * WHY: a path pattern cannot be tested against a path past the cap (the cap bounds the regex's cost), and an
408
+ * untested path must never be served raw: the value at it is the placeholder, the same safe side the walk
409
+ * limit takes. Warned once per rule, in dev mode.
410
+ */
411
+ private maskPastPathCap;
362
412
  /** Once per rule, in dev mode: a path walk passed its limit and served its remainder as the placeholder. */
363
413
  private warnWalkLimit;
364
414
  /**
@@ -403,7 +453,16 @@ export declare class RedactionRule {
403
453
  verdictAt(path: readonly string[], key: string): RedactionVerdict;
404
454
  /** The single-segment verdict: key-level hit → whole; declared or inherited fields → fields. */
405
455
  private verdictOfKey;
406
- /** The secret fields of a top key: the policy's, plus any a mapper handed it ({@link MapperTaint}). */
456
+ /**
457
+ * The secret fields of a top key: the policy's, plus any it was handed ({@link MapperTaint}, or a
458
+ * hidden object a stage put below it).
459
+ *
460
+ * A key with both gets ONE list of them all, made once for the two lists it is made from. WHY: this
461
+ * is asked at every read and write of the key, and the search behind it knows a list it has seen by
462
+ * the list itself (`selectedObjects.ts`). A new list at every ask made each member a stage looked up
463
+ * through such a key cost all of the key's fields. The policy's list is the caller's and may change,
464
+ * so it is compared by content each time: it is short, the handed fields are the long list.
465
+ */
407
466
  private fieldsOf;
408
467
  /**
409
468
  * The run's marks and the fields mappers handed to new keys, as NAMES — what
@@ -515,14 +574,57 @@ export declare class RedactionRule {
515
574
  */
516
575
  export declare function decideWrite(active: RedactionRule | undefined, path: readonly string[], key: string, explicit: boolean | undefined): RedactionVerdict;
517
576
  /**
518
- * Step 2 — IDENTITY: an OBJECT the stage read under a selected name (`selected` — the frame's selected
519
- * reads, filled by its tracked reads), written under another name (`s.person = s.profile`), keeps that
520
- * read's rule, matched by identity: a whole read marks the new key, a `fields` read hands it the fields
521
- * (re-based under the written path), and the verdict is asked again. A new object, a primitive, or a
522
- * write already whole is selected by its own name only — `verdict` comes back as it is. Decided BEFORE
523
- * the write, because the verdict needs it: an inheritance stays even if the write then fails to stage.
577
+ * Step 2 — IDENTITY: an OBJECT the stage read under a selected name, or an object inside such a value
578
+ * (`selected` — the frame's `selectedObjects.ts · SelectedObjects`, filled by its tracked reads), keeps
579
+ * its rule wherever the stage writes it:
580
+ *
581
+ * - as the whole value of a top key (`s.person = s.profile`): a whole read marks the new key, a
582
+ * `fields` read hands it the fields;
583
+ * - anywhere below a top key: at a nested path (`s.a.b = s.profile`), inside a new object
584
+ * (`s.box = { p: s.profile }`), in a list (`s.list.push(s.profile)`). The place is handed to the
585
+ * TOP key as a field (`a` hides `b`), never as a mark of the dotted name: the typed scope writes a
586
+ * nested change as a write of the top key, and only a field of the top key covers that write. A
587
+ * list (and a `Map`, a `Set`) that holds such an object is hidden whole, because an index moves.
588
+ *
589
+ * Only what is NEW in the value is searched: `how.base` is what the key holds now, and a part that is
590
+ * the same object there was not put there by this write (`selectedObjects.ts`, why). And only what
591
+ * ADDS to the rule the key has by name: `verdict`'s own fields are hidden already.
592
+ *
593
+ * With `how.sameAsBefore` it is the second search, at commit (`hiddenObjectTrail.ts`): the value as it
594
+ * stands then, against the committed value the stage started from. It reports only what the stage put
595
+ * in after the write (`selectedObjects.ts`, the three things it passes over).
596
+ *
597
+ * A new object built from a selected one's texts and numbers, or a primitive, is selected by its own
598
+ * name only — `verdict` comes back as it is. So is a write already whole. Decided BEFORE the write,
599
+ * because the verdict needs it: an inheritance stays even if the write then fails to stage.
524
600
  */
525
- export declare function inheritByIdentity(active: RedactionRule | undefined, verdict: RedactionVerdict, selected: WeakMap<object, RedactionVerdict> | undefined, path: readonly string[], key: string, value: unknown): RedactionVerdict;
601
+ export declare function inheritByIdentity(active: RedactionRule | undefined, verdict: RedactionVerdict, selected: SelectedObjects | undefined, path: readonly string[], key: string, value: unknown, how?: IdentitySearch): RedactionVerdict;
602
+ /** What {@link inheritByIdentity} is told about the key it searches (`selectedObjects.ts · Search`, why each). */
603
+ export interface IdentitySearch {
604
+ /** What the key holds now (at a write), or held when the stage began (at commit). */
605
+ readonly base?: unknown;
606
+ /** The objects this key showed when the stage wrote it: added to at a write, passed over at commit. */
607
+ readonly shown?: ShownObjects;
608
+ /** The value is a merge patch. */
609
+ readonly patch?: boolean;
610
+ /** The value is the key's whole new value. */
611
+ readonly replaces?: boolean;
612
+ /** Makes it the search at commit: does an object hold what the committed one at its place held? */
613
+ readonly sameAsBefore?: SameContent;
614
+ }
615
+ /**
616
+ * The verdict a value is KEPT under, given the verdict its name gives it (`verdict`) and the selected
617
+ * objects found in it (`found`, their paths below the value). For what a frame keeps of a write
618
+ * (`hiddenObjectTrail.ts · followAtCommit`): the kept value of a merge is the caller's patch, not what
619
+ * the record holds, so what is found in it is hidden in the kept form and changes no rule.
620
+ *
621
+ * ```ts
622
+ * keptUnder(CLEAR, [{ path: ['row', 'owner'], rule: whole, whole: true }], 'a'); // { kind: 'fields', key: 'a', paths: ['row.owner'] }
623
+ * ```
624
+ */
625
+ export declare function keptUnder(verdict: RedactionVerdict, found: readonly FoundSelected[], key: string): RedactionVerdict;
626
+ /** Do two verdicts hide the same: both clear, both whole, or the same fields? */
627
+ export declare function sameVerdict(a: RedactionVerdict, b: RedactionVerdict): boolean;
526
628
  /**
527
629
  * Step 3's input — a verdict's BYTES for the record (`RecordFrame · write`): nothing when clear, the
528
630
  * whole value, or the fields inside it. No allocation on the default path (clear) or for a whole verdict.
@@ -530,15 +632,24 @@ export declare function inheritByIdentity(active: RedactionRule | undefined, ver
530
632
  export declare function scrubOf(verdict: RedactionVerdict): WriteScrub | undefined;
531
633
  /**
532
634
  * Step 4 — the MARKS a staged write leaves; call it only once the write staged, so a write that fails to
533
- * stage marks nothing. A delete clears its key's mark (and any fields a mapper handed it) on `active`,
534
- * the rule that was active as the write BEGAN — none when it was inert, even if user code marked the key
535
- * during the write. A whole verdict marks its key — the key that DECIDED it (`verdict.key`: an ancestor
536
- * for a nested write under a whole-selected key) — for the rest of the run on `rule`, the run's rule as
537
- * it stands NOW (user code during the write may have installed one; an explicit mark is what makes an
538
- * inert rule active). A mark is a run-wide NAME: it stays when the stage's commit fails or a retry
539
- * discards the attempt — the safe side; only a staged delete removes one.
635
+ * stage marks nothing. A whole verdict marks its key — the key that DECIDED it (`verdict.key`: an
636
+ * ancestor for a nested write under a whole-selected key) — for the rest of the run on `rule`, the
637
+ * run's rule as it stands NOW (user code during the write may have installed one; an explicit mark is
638
+ * what makes an inert rule active). A mark is a run-wide NAME: it stays when the stage's commit fails
639
+ * or a retry discards the attempt — the safe side.
640
+ *
641
+ * A DELETE ends nothing here, because it is only staged: a retry may throw the try away, the commit may
642
+ * fail, and the stage may write the key again before it commits. It returns the delete's claim on a
643
+ * mark instead: on `active`, the rule that was active as the write BEGAN (none when it was inert, even
644
+ * if user code marked the key during the write), and only for a name that rule keeps. The frame ends the
645
+ * mark once the delete has landed and the key is gone (`StageContext · endMarksOfLandedDeletes`).
646
+ *
647
+ * `place` is where the write lands (`markPlaces.ts · placeOf`); the frame passes it for every delete, every
648
+ * write with a verdict, and every write under a top key the rule {@link RedactionRule.keeps}. With it a
649
+ * mark knows where its values live, and a delete ends the mark only when it takes away the last of them
650
+ * (`markPlaces.ts`, the law).
540
651
  */
541
- export declare function markStagedWrite(active: RedactionRule | undefined, rule: RedactionRule | undefined, verdict: RedactionVerdict, path: readonly string[], key: string, verb: WriteVerb): void;
652
+ export declare function markStagedWrite(active: RedactionRule | undefined, rule: RedactionRule | undefined, verdict: RedactionVerdict, path: readonly string[], key: string, verb: WriteVerb, place?: string): StagedDelete | undefined;
542
653
  /**
543
654
  * Path visits one walk may make — reachable only under a PATH-dependent
544
655
  * pattern over a value whose paths outnumber its objects (a linked history, a
@@ -644,6 +755,13 @@ export declare class MapperTaint {
644
755
  * live record behind it. Anything but a plain record is handed over as it is.
645
756
  */
646
757
  watch<T>(record: T): T;
758
+ /**
759
+ * The same law for a record that reports its own reads (the view a subflow mapper is handed,
760
+ * `engine/handlers/mapperScope.ts`): hand each read to the function returned here, and give the
761
+ * mapper what it returns. No second view is built, so the cost is the keys read, not the keys held.
762
+ * The record is remembered as one the mapper was handed: passed on whole, it hands on its selected keys.
763
+ */
764
+ reads(record: object): (key: string, value: unknown) => unknown;
647
765
  /**
648
766
  * The mapper returned `output`: every key it wrote inherits what it copied
649
767
  * (see the class). Returns the output to use — the same object unless a view