footprintjs 11.0.1 → 11.2.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 (186) hide show
  1. package/AGENTS.md +220 -1085
  2. package/dist/advanced.js +9 -2
  3. package/dist/detach.js +6 -4
  4. package/dist/esm/advanced.d.ts +8 -1
  5. package/dist/esm/advanced.js +9 -2
  6. package/dist/esm/detach.d.ts +5 -3
  7. package/dist/esm/detach.js +6 -4
  8. package/dist/esm/index.d.ts +5 -5
  9. package/dist/esm/index.js +3 -6
  10. package/dist/esm/lib/capture/absentEntries.js +15 -13
  11. package/dist/esm/lib/capture/evidenceInput/index.d.ts +4 -0
  12. package/dist/esm/lib/capture/evidenceInput/index.js +8 -0
  13. package/dist/esm/lib/capture/historyData.d.ts +10 -2
  14. package/dist/esm/lib/capture/historyData.js +19 -10
  15. package/dist/esm/lib/capture/historyNote.d.ts +1 -1
  16. package/dist/esm/lib/capture/historyNote.js +1 -1
  17. package/dist/esm/lib/capture/nativeClosure/evidence.d.ts +8 -0
  18. package/dist/esm/lib/capture/nativeClosure/evidence.js +71 -0
  19. package/dist/esm/lib/capture/nativeClosure/format.d.ts +35 -0
  20. package/dist/esm/lib/capture/nativeClosure/format.js +141 -0
  21. package/dist/esm/lib/capture/nativeClosure/invocations.d.ts +11 -0
  22. package/dist/esm/lib/capture/nativeClosure/invocations.js +24 -0
  23. package/dist/esm/lib/capture/nativeExtent/collector.d.ts +30 -0
  24. package/dist/esm/lib/capture/nativeExtent/collector.js +91 -0
  25. package/dist/esm/lib/capture/nativeExtent/format.d.ts +48 -0
  26. package/dist/esm/lib/capture/nativeExtent/format.js +143 -0
  27. package/dist/esm/lib/detach/spawn.d.ts +2 -0
  28. package/dist/esm/lib/detach/spawn.js +6 -1
  29. package/dist/esm/lib/engine/handlers/ChildrenExecutor.js +2 -1
  30. package/dist/esm/lib/engine/handlers/SelectorHandler.js +2 -2
  31. package/dist/esm/lib/engine/handlers/StageRunner.js +63 -14
  32. package/dist/esm/lib/engine/handlers/commitStage.js +2 -2
  33. package/dist/esm/lib/engine/handlers/stageError.d.ts +1 -1
  34. package/dist/esm/lib/engine/handlers/stageError.js +4 -2
  35. package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +0 -2
  36. package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +5 -63
  37. package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.d.ts +3 -0
  38. package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.js +77 -0
  39. package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +24 -1
  40. package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +6 -6
  41. package/dist/esm/lib/engine/traversal/touchesRefusal/index.d.ts +3 -0
  42. package/dist/esm/lib/engine/traversal/touchesRefusal/index.js +7 -0
  43. package/dist/esm/lib/errors/callsEnded/index.d.ts +2 -0
  44. package/dist/esm/lib/errors/callsEnded/index.js +6 -0
  45. package/dist/esm/lib/errors/terminalFailure.d.ts +26 -0
  46. package/dist/esm/lib/errors/terminalFailure.js +49 -1
  47. package/dist/esm/lib/memory/StageContext.d.ts +11 -17
  48. package/dist/esm/lib/memory/StageContext.js +35 -41
  49. package/dist/esm/lib/memory/frameTypes.d.ts +2 -0
  50. package/dist/esm/lib/memory/frameTypes.js +1 -1
  51. package/dist/esm/lib/memory/retainedValue/index.d.ts +16 -0
  52. package/dist/esm/lib/memory/retainedValue/index.js +25 -0
  53. package/dist/esm/lib/recorder/CompositeRecorder.js +17 -9
  54. package/dist/esm/lib/recorder/ControlDepRecorder.js +4 -3
  55. package/dist/esm/lib/recorder/captureSnapshot/index.d.ts +17 -0
  56. package/dist/esm/lib/recorder/captureSnapshot/index.js +29 -0
  57. package/dist/esm/lib/recorder/snapshot.d.ts +1 -1
  58. package/dist/esm/lib/recorder/snapshot.js +19 -8
  59. package/dist/esm/lib/runner/ExecutionRuntime.d.ts +6 -1
  60. package/dist/esm/lib/runner/ExecutionRuntime.js +11 -2
  61. package/dist/esm/lib/runner/FlowChartExecutor.d.ts +7 -7
  62. package/dist/esm/lib/runner/FlowChartExecutor.js +46 -54
  63. package/dist/esm/lib/runner/NativeRunLifecycle.js +86 -34
  64. package/dist/esm/lib/runner/RunLifecycle.d.ts +13 -1
  65. package/dist/esm/lib/runner/RunLifecycle.js +1 -1
  66. package/dist/esm/lib/runner/attach.d.ts +3 -0
  67. package/dist/esm/lib/runner/attach.js +12 -1
  68. package/dist/esm/lib/runner/captureHistory.d.ts +2 -1
  69. package/dist/esm/lib/runner/captureHistory.js +21 -6
  70. package/dist/esm/lib/runner/nativeClosure/cut.d.ts +14 -0
  71. package/dist/esm/lib/runner/nativeClosure/cut.js +25 -0
  72. package/dist/esm/lib/runner/nativeClosure/record.d.ts +31 -0
  73. package/dist/esm/lib/runner/nativeClosure/record.js +68 -0
  74. package/dist/esm/lib/runner/nativeClosure/state.d.ts +8 -0
  75. package/dist/esm/lib/runner/nativeClosure/state.js +18 -0
  76. package/dist/esm/lib/runner/options.d.ts +29 -1
  77. package/dist/esm/lib/runner/options.js +19 -1
  78. package/dist/esm/lib/runner/readStoredCapture.d.ts +6 -0
  79. package/dist/esm/lib/runner/readStoredCapture.js +1 -1
  80. package/dist/esm/lib/runner/recordMetadata/index.d.ts +12 -0
  81. package/dist/esm/lib/runner/recordMetadata/index.js +25 -0
  82. package/dist/esm/lib/runner/runCleanup/index.d.ts +5 -0
  83. package/dist/esm/lib/runner/runCleanup/index.js +17 -0
  84. package/dist/esm/lib/runner/snapshot.d.ts +2 -2
  85. package/dist/esm/lib/runner/snapshot.js +12 -8
  86. package/dist/esm/lib/runner/storedCaptureAdmission.js +19 -1
  87. package/dist/esm/lib/scope/ScopeFacade.js +7 -7
  88. package/dist/esm/recorders.d.ts +2 -2
  89. package/dist/esm/recorders.js +3 -3
  90. package/dist/esm/sinks.d.ts +4 -2
  91. package/dist/esm/sinks.js +5 -3
  92. package/dist/esm/trace.d.ts +3 -1
  93. package/dist/esm/trace.js +4 -2
  94. package/dist/esm/zod.d.ts +6 -5
  95. package/dist/esm/zod.js +7 -6
  96. package/dist/index.js +3 -6
  97. package/dist/lib/capture/absentEntries.js +15 -13
  98. package/dist/lib/capture/evidenceInput/index.js +12 -0
  99. package/dist/lib/capture/historyData.js +20 -11
  100. package/dist/lib/capture/historyNote.js +1 -1
  101. package/dist/lib/capture/nativeClosure/evidence.js +75 -0
  102. package/dist/lib/capture/nativeClosure/format.js +145 -0
  103. package/dist/lib/capture/nativeClosure/invocations.js +28 -0
  104. package/dist/lib/capture/nativeExtent/collector.js +95 -0
  105. package/dist/lib/capture/nativeExtent/format.js +147 -0
  106. package/dist/lib/detach/spawn.js +8 -2
  107. package/dist/lib/engine/handlers/ChildrenExecutor.js +2 -1
  108. package/dist/lib/engine/handlers/SelectorHandler.js +2 -2
  109. package/dist/lib/engine/handlers/StageRunner.js +63 -14
  110. package/dist/lib/engine/handlers/commitStage.js +2 -2
  111. package/dist/lib/engine/handlers/stageError.js +4 -2
  112. package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +4 -62
  113. package/dist/lib/engine/narrative/formatting/ruleEvidence/index.js +82 -0
  114. package/dist/lib/engine/traversal/FlowchartTraverser.js +7 -7
  115. package/dist/lib/engine/traversal/touchesRefusal/index.js +11 -0
  116. package/dist/lib/errors/callsEnded/index.js +10 -0
  117. package/dist/lib/errors/terminalFailure.js +49 -1
  118. package/dist/lib/memory/StageContext.js +35 -41
  119. package/dist/lib/memory/frameTypes.js +1 -1
  120. package/dist/lib/memory/retainedValue/index.js +30 -0
  121. package/dist/lib/recorder/CompositeRecorder.js +17 -9
  122. package/dist/lib/recorder/ControlDepRecorder.js +4 -3
  123. package/dist/lib/recorder/captureSnapshot/index.js +35 -0
  124. package/dist/lib/recorder/snapshot.js +19 -8
  125. package/dist/lib/runner/ExecutionRuntime.js +11 -2
  126. package/dist/lib/runner/FlowChartExecutor.js +52 -60
  127. package/dist/lib/runner/NativeRunLifecycle.js +85 -33
  128. package/dist/lib/runner/RunLifecycle.js +1 -1
  129. package/dist/lib/runner/attach.js +12 -1
  130. package/dist/lib/runner/captureHistory.js +21 -6
  131. package/dist/lib/runner/nativeClosure/cut.js +29 -0
  132. package/dist/lib/runner/nativeClosure/record.js +72 -0
  133. package/dist/lib/runner/nativeClosure/state.js +22 -0
  134. package/dist/lib/runner/options.js +19 -1
  135. package/dist/lib/runner/readStoredCapture.js +1 -1
  136. package/dist/lib/runner/recordMetadata/index.js +30 -0
  137. package/dist/lib/runner/runCleanup/index.js +22 -0
  138. package/dist/lib/runner/snapshot.js +12 -8
  139. package/dist/lib/runner/storedCaptureAdmission.js +19 -1
  140. package/dist/lib/scope/ScopeFacade.js +8 -8
  141. package/dist/recorders.js +3 -3
  142. package/dist/sinks.js +5 -3
  143. package/dist/trace.js +4 -2
  144. package/dist/types/advanced.d.ts +8 -1
  145. package/dist/types/detach.d.ts +5 -3
  146. package/dist/types/index.d.ts +5 -5
  147. package/dist/types/lib/capture/evidenceInput/index.d.ts +4 -0
  148. package/dist/types/lib/capture/historyData.d.ts +10 -2
  149. package/dist/types/lib/capture/historyNote.d.ts +1 -1
  150. package/dist/types/lib/capture/nativeClosure/evidence.d.ts +8 -0
  151. package/dist/types/lib/capture/nativeClosure/format.d.ts +35 -0
  152. package/dist/types/lib/capture/nativeClosure/invocations.d.ts +11 -0
  153. package/dist/types/lib/capture/nativeExtent/collector.d.ts +30 -0
  154. package/dist/types/lib/capture/nativeExtent/format.d.ts +48 -0
  155. package/dist/types/lib/detach/spawn.d.ts +2 -0
  156. package/dist/types/lib/engine/handlers/stageError.d.ts +1 -1
  157. package/dist/types/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +0 -2
  158. package/dist/types/lib/engine/narrative/formatting/ruleEvidence/index.d.ts +3 -0
  159. package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +24 -1
  160. package/dist/types/lib/engine/traversal/touchesRefusal/index.d.ts +3 -0
  161. package/dist/types/lib/errors/callsEnded/index.d.ts +2 -0
  162. package/dist/types/lib/errors/terminalFailure.d.ts +26 -0
  163. package/dist/types/lib/memory/StageContext.d.ts +11 -17
  164. package/dist/types/lib/memory/frameTypes.d.ts +2 -0
  165. package/dist/types/lib/memory/retainedValue/index.d.ts +16 -0
  166. package/dist/types/lib/recorder/captureSnapshot/index.d.ts +17 -0
  167. package/dist/types/lib/recorder/snapshot.d.ts +1 -1
  168. package/dist/types/lib/runner/ExecutionRuntime.d.ts +6 -1
  169. package/dist/types/lib/runner/FlowChartExecutor.d.ts +7 -7
  170. package/dist/types/lib/runner/RunLifecycle.d.ts +13 -1
  171. package/dist/types/lib/runner/attach.d.ts +3 -0
  172. package/dist/types/lib/runner/captureHistory.d.ts +2 -1
  173. package/dist/types/lib/runner/nativeClosure/cut.d.ts +14 -0
  174. package/dist/types/lib/runner/nativeClosure/record.d.ts +31 -0
  175. package/dist/types/lib/runner/nativeClosure/state.d.ts +8 -0
  176. package/dist/types/lib/runner/options.d.ts +29 -1
  177. package/dist/types/lib/runner/readStoredCapture.d.ts +6 -0
  178. package/dist/types/lib/runner/recordMetadata/index.d.ts +12 -0
  179. package/dist/types/lib/runner/runCleanup/index.d.ts +5 -0
  180. package/dist/types/lib/runner/snapshot.d.ts +2 -2
  181. package/dist/types/recorders.d.ts +2 -2
  182. package/dist/types/sinks.d.ts +4 -2
  183. package/dist/types/trace.d.ts +3 -1
  184. package/dist/types/zod.d.ts +6 -5
  185. package/dist/zod.js +7 -6
  186. package/package.json +4 -1
@@ -36,6 +36,7 @@ import type { EmitRecorder } from '../recorder/EmitRecorder.js';
36
36
  import type { RedactionPolicy, RedactionReport, ScopeRecorder } from '../scope/types.js';
37
37
  import type { AttachRecorderOptions, ObserverDrainResult } from './DeferredObserverTier.js';
38
38
  import { type RuntimeSnapshot } from './ExecutionRuntime.js';
39
+ import { type NativeClosedCaptureResult } from './nativeClosure/record.js';
39
40
  import { type FlowChartExecutorOptions } from './options.js';
40
41
  import { type RecordFlushResult } from './recordSink.js';
41
42
  export declare class FlowChartExecutor<TOut = any, TScope = any> {
@@ -68,6 +69,12 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
68
69
  private captureSignal?;
69
70
  private captureHistoryLease?;
70
71
  private failureState;
72
+ private nativeClosure?;
73
+ /**
74
+ * The opted-in immutable recorded native prefix. Ordinary snapshots remain live observations.
75
+ * A closed failed prefix stays failed; channel coverage, outside work and semantic causes are separate.
76
+ */
77
+ getClosedCapture(): NativeClosedCaptureResult;
71
78
  /** Safe native context for the latest rejected leg; undefined before, during, after success or pause. */
72
79
  getFailureContext(): TerminalFailureContext | undefined;
73
80
  private readonly flowChartArgs;
@@ -195,13 +202,6 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
195
202
  private settleRecordedLeg;
196
203
  private saveCaptureHistory;
197
204
  private finishCapture;
198
- /**
199
- * What a new root log opens with: names and numbers the run already serves — the run, the chart, the correlation,
200
- * the deadline, the declared budget, and the run a fresh-executor resume continues. Served by the record.
201
- */
202
- private openingMeta;
203
- /** The closing entry's error: the run's SERVED form of it, its name, message and code only (never `raw`). */
204
- private closingError;
205
205
  /**
206
206
  * Attach a ScopeRecorder to observe data operations (reads, writes, commits)
207
207
  * on every stage scope. Call before run(). **Idempotent by `id`** (replaced,
@@ -84,7 +84,19 @@ export interface RunSetup {
84
84
  export interface OwnedRun extends RunCells {
85
85
  readonly origin: NativeRunOrigin | undefined;
86
86
  execute(entry: RunEntry, setup?: RunSetup): Promise<ExecutorResult>;
87
- onFinalize(cleanup: () => void | Promise<void>): void;
87
+ /** Cleanup joined once, in reverse order, under the lease; it receives the run's end. Refused after `finish()`. */
88
+ onFinalize(cleanup: (end: ComponentEnd) => void | Promise<void>): void;
89
+ /**
90
+ * Run the finalizers now, from inside the body, while the lease is still held.
91
+ * WHY: cleanup that files the run's results then runs in the body's own async context,
92
+ * and resolves before the body's caller continues.
93
+ * It waits for a started execution, then decides the end from it: failed (cancellation
94
+ * included), paused or completed. Calling it is the body's word that its own part did not
95
+ * fail; a body that throws afterwards still rejects `withRun`, but the end stays as given.
96
+ * Once only: a second call shares the first. Rejects with the first cleanup failure unless
97
+ * the run paused. Afterwards `execute` and `onFinalize` refuse; `withRun` finalizes nothing again.
98
+ */
99
+ finish(): Promise<void>;
88
100
  snapshot(options?: {
89
101
  redact?: boolean;
90
102
  }): RuntimeSnapshot | undefined;
@@ -18,6 +18,7 @@
18
18
  import type { RunCorrelation } from '../attempt/types.js';
19
19
  import type { CombinedNarrativeRecorderOptions } from '../engine/narrative/CombinedNarrativeRecorder.js';
20
20
  import { CombinedNarrativeRecorder } from '../engine/narrative/CombinedNarrativeRecorder.js';
21
+ import { type ManifestEntry } from '../engine/narrative/recorders/ManifestFlowRecorder.js';
21
22
  import type { FlowRecorder } from '../engine/narrative/types.js';
22
23
  import type { ScopeFactory } from '../engine/types.js';
23
24
  import type { CombinedRecorder } from '../recorder/CombinedRecorder.js';
@@ -88,6 +89,8 @@ export declare class RunObservers {
88
89
  flowRecordersList(): FlowRecorder[] | undefined;
89
90
  /** The inline flow listeners of an executor-made event (`onResume`): the narrative recorder first. */
90
91
  inlineFlowListeners(): FlowRecorder[];
92
+ getSubflowManifest(): ManifestEntry[];
93
+ getSubflowSpec(subflowId: string): unknown | undefined;
91
94
  /**
92
95
  * Lazily create the executor's ONE deferred-observer tier (one merged
93
96
  * queue, total event order across all three channels). The FIRST deferred
@@ -1,8 +1,9 @@
1
1
  import type { ExecutionRuntime, RuntimeSnapshot } from './ExecutionRuntime.js';
2
+ import type { NativeClosedCaptureResult } from './nativeClosure/record.js';
2
3
  import type { RunRecord } from './recordSink.js';
3
4
  /** @internal Keeps a timed-out operation leased until its actual settlement. */
4
5
  export interface CaptureHistoryLease {
5
6
  pending: boolean;
6
7
  }
7
8
  /** Persist one terminal native root segment, without changing its memory-only engine observation. */
8
- export declare function persistCaptureHistory(runtime: ExecutionRuntime, record: RunRecord, snapshot: () => RuntimeSnapshot, lease: CaptureHistoryLease): Promise<void>;
9
+ export declare function persistCaptureHistory(runtime: ExecutionRuntime, record: RunRecord, snapshot: () => RuntimeSnapshot, lease: CaptureHistoryLease, closed?: NativeClosedCaptureResult): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import type { Meta } from 'foottrace';
2
+ import type { SelectedNativeFailure } from '../../errors/terminalFailure.js';
3
+ import type { ExecutionRuntime, RuntimeSnapshot } from '../ExecutionRuntime.js';
4
+ import { type NativeClosedCaptureResult } from './record.js';
5
+ /** Short-lived lazy ports: called synchronously and never retained by the cut state. */
6
+ export interface NativeCutPort {
7
+ snapshot(): RuntimeSnapshot;
8
+ initialState(value: Record<string, unknown>): Record<string, unknown>;
9
+ selected(): SelectedNativeFailure | undefined;
10
+ serve(value: Meta): Meta;
11
+ maxBytes(): number;
12
+ }
13
+ /** Assemble only once through NativeClosureState; preserve the original getter order and catch boundary. */
14
+ export declare function cutNativeCapture(runtime: Pick<ExecutionRuntime, 'captureExtent'>, port: NativeCutPort): NativeClosedCaptureResult;
@@ -0,0 +1,31 @@
1
+ import type { CommitBundle, Meta } from 'foottrace';
2
+ import { type NativeCaptureClosure } from '../../capture/nativeClosure/format.js';
3
+ import type { NativeCaptureExtent } from '../../capture/nativeExtent/format.js';
4
+ import type { EngineReadSources, NativeCaptureObservation } from '../../capture/readSources.js';
5
+ import type { SelectedNativeFailure } from '../../errors/terminalFailure.js';
6
+ import type { StageSnapshot } from '../../memory/frameTypes.js';
7
+ import type { RecorderSnapshot, RuntimeSnapshot } from '../ExecutionRuntime.js';
8
+ /** The same immutable recorded prefix is served in memory and bound into its saved history. No live state. */
9
+ export interface NativeClosedCaptureRecord {
10
+ readonly closure: NativeCaptureClosure;
11
+ readonly capture: NativeCaptureObservation;
12
+ readonly captureExtent: NativeCaptureExtent;
13
+ readonly executionTree: StageSnapshot;
14
+ readonly readSources?: EngineReadSources;
15
+ readonly recorders?: readonly RecorderSnapshot[];
16
+ readonly absent?: readonly (readonly string[])[];
17
+ readonly commitLog: readonly CommitBundle[];
18
+ readonly initialState?: Record<string, unknown>;
19
+ }
20
+ export type NativeClosedCaptureResult = {
21
+ readonly status: 'closed';
22
+ readonly record: NativeClosedCaptureRecord;
23
+ } | {
24
+ readonly status: 'unknown';
25
+ readonly reason: string;
26
+ readonly record?: never;
27
+ };
28
+ /** @internal Shared absent result; the default-off path allocates no per-run cut. */
29
+ export declare const NO_CLOSED_CAPTURE: NativeClosedCaptureResult;
30
+ /** @internal Copy and validate collected evidence; never re-execute stages or reconstruct uncollected events. */
31
+ export declare function closeNativeCapture(view: RuntimeSnapshot, selected: SelectedNativeFailure | undefined, serve: (value: Meta) => Meta, maxBytes?: number): NativeClosedCaptureResult;
@@ -0,0 +1,8 @@
1
+ import { type NativeClosedCaptureResult } from './record.js';
2
+ /** One executor's once-only immutable cut; no frame, callback or live runtime is retained here. */
3
+ export declare class NativeClosureState {
4
+ sealed: boolean;
5
+ result: NativeClosedCaptureResult;
6
+ reset(): void;
7
+ closeOnce(cut: () => NativeClosedCaptureResult): void;
8
+ }
@@ -5,11 +5,16 @@
5
5
  * `resolveExecutorArgs` turns either constructor form (options object, or a
6
6
  * bare `ScopeFactory`) into the `ExecutorArgs` the executor keeps for every leg.
7
7
  */
8
+ import type { Meta } from 'foottrace';
9
+ import type { RunCorrelation } from '../attempt/types.js';
8
10
  import type { FlowChart } from '../builder/types.js';
11
+ import type { ResumeEntry } from '../engine/handlers/ResumeEntry.js';
9
12
  import type { ScopeFactory, StreamHandlers } from '../engine/types.js';
10
13
  import type { RunDials } from '../memory/runPolicy.js';
14
+ import type { RedactionMarks } from '../pause/types.js';
11
15
  import type { ScopeProtectionMode } from '../scope/protection/types.js';
12
- import { type RecordSinkOption, type ResolvedRecordSink } from './recordSink.js';
16
+ import type { ExecutionRuntime } from './ExecutionRuntime.js';
17
+ import { type RecordSinkOption, type ResolvedRecordSink, type RunRecord } from './recordSink.js';
13
18
  /**
14
19
  * Options object for `FlowChartExecutor` — preferred over positional params.
15
20
  *
@@ -61,6 +66,10 @@ export interface FlowChartExecutorOptions<TScope = any> extends RunDials {
61
66
  sink?: RecordSinkOption;
62
67
  /** Opt in to a versioned, memory-only root-log capture note on snapshots (#111 stage 1). */
63
68
  captureCoverage?: boolean;
69
+ /** Opt in to bounded native invocation bookkeeping. Requires captureCoverage; never attests closed capture. */
70
+ captureExtent?: boolean;
71
+ /** Preserve a bounded immutable native root prefix, separately from live snapshots. Requires both capture options. */
72
+ captureClosure?: boolean;
64
73
  /**
65
74
  * Custom error classifier for throttling detection. Return `true` if a fork
66
75
  * child's error represents a rate-limit or backpressure condition; the
@@ -90,6 +99,8 @@ export interface ExecutorArgs<TOut, TScope> {
90
99
  /** The record sink, resolved and checked at construction (10.1, P6). */
91
100
  sink?: ResolvedRecordSink;
92
101
  captureCoverage?: boolean;
102
+ captureExtent?: boolean;
103
+ captureClosure?: boolean;
93
104
  }
94
105
  /**
95
106
  * Resolve either constructor form. The 2-param form is the options form with
@@ -97,3 +108,20 @@ export interface ExecutorArgs<TOut, TScope> {
97
108
  * plain `ScopeFacade`.
98
109
  */
99
110
  export declare function resolveExecutorArgs<TOut, TScope>(flowChart: FlowChart<TOut, TScope>, factoryOrOptions: ScopeFactory<TScope> | FlowChartExecutorOptions<TScope> | undefined): ExecutorArgs<TOut, TScope>;
111
+ /** @internal Construction-only overrides for a native traversal leg; never an application option. */
112
+ export interface TraverserOverrides<TOut = any, TScope = any> {
113
+ initialContext?: unknown;
114
+ preserveRecorders?: boolean;
115
+ existingRuntime?: InstanceType<typeof ExecutionRuntime>;
116
+ /** The resume's one-shot re-entry (`resume.ts`); the traverser still walks the REAL chart. */
117
+ resume?: ResumeEntry<TOut, TScope>;
118
+ /** The redaction the paused run had made (names only) — the resumed leg's rule starts from it. */
119
+ redactionMarks?: RedactionMarks;
120
+ /** The leg's correlation, resolved from its env before anything moved (`resolveCorrelation`). */
121
+ correlation?: RunCorrelation;
122
+ /** The leg's record (10.1, P6): its sink, and the meta a NEW root log opens with. */
123
+ record?: {
124
+ link: RunRecord;
125
+ meta?: Meta;
126
+ };
127
+ }
@@ -1,5 +1,7 @@
1
1
  import type { CommitBundle, StoredRecordLimits } from 'foottrace';
2
2
  import type { CaptureHistoryReceipt } from '../capture/historyTypes.js';
3
+ import type { NativeCaptureClosure } from '../capture/nativeClosure/format.js';
4
+ import type { NativeCaptureExtent } from '../capture/nativeExtent/format.js';
3
5
  import type { EngineReadSources, NativeCaptureObservation } from '../capture/readSources.js';
4
6
  import type { StageSnapshot } from '../memory/frameTypes.js';
5
7
  import type { RecorderSnapshot } from './ExecutionRuntime.js';
@@ -7,6 +9,10 @@ import type { RecorderSnapshot } from './ExecutionRuntime.js';
7
9
  export interface StoredCaptureHistory {
8
10
  readonly runId: string;
9
11
  readonly capture: NativeCaptureObservation;
12
+ /** Exact persisted native work observation; storage cannot make an unverified extent closed. */
13
+ readonly captureExtent?: NativeCaptureExtent;
14
+ /** Descriptor for this exact immutable saved native prefix; never authority over a live snapshot. */
15
+ readonly closure?: NativeCaptureClosure;
10
16
  /** Original memory observation covered by this history receipt, never storage authority by itself. */
11
17
  readonly readSources?: EngineReadSources;
12
18
  readonly executionTree: StageSnapshot;
@@ -0,0 +1,12 @@
1
+ import type { Meta } from 'foottrace';
2
+ import type { RunCorrelation } from '../../attempt/types.js';
3
+ import type { StageNode } from '../../engine/types.js';
4
+ import type { RedactionRule } from '../../memory/redaction.js';
5
+ import type { ExecutorArgs } from '../options.js';
6
+ /**
7
+ * What a new root log opens with: names and numbers the run already serves — the run, the chart, the correlation,
8
+ * the deadline, the declared budget, and the run a fresh-executor resume continues. Served by the record.
9
+ */
10
+ export declare function openingMeta<TOut, TScope>(args: ExecutorArgs<TOut, TScope>, readRunId: () => string, root: StageNode<TOut, TScope>, correlation: RunCorrelation | undefined, deadline: number | undefined, resumedFrom?: string): Meta;
11
+ /** The closing entry's error: the run's SERVED form of it, its name, message and code only (never `raw`). */
12
+ export declare function closingError(error: unknown, rule: RedactionRule): Meta;
@@ -0,0 +1,5 @@
1
+ import type { ArmedRun } from '../deadline.js';
2
+ /** How long a run's own flush may take: the run's time left (at least 1 s), never past {@link AUTO_FLUSH_MS}. */
3
+ export declare function autoFlushMs(deadline: number | undefined): number;
4
+ /** Run `build`; if it throws, release the armed run first (no deadline timer outlives a refused entry). */
5
+ export declare function disposeOnThrow<T>(armed: ArmedRun, build: () => T): T;
@@ -17,7 +17,7 @@ import type { RecorderSnapshot, RecordSinkStats, RuntimeSnapshot } from './Execu
17
17
  */
18
18
  export declare function servedSnapshot(traverser: FlowchartTraverser<any, any>, observers: RunObservers, options?: {
19
19
  redact?: boolean;
20
- }, sink?: RecordSinkStats): RuntimeSnapshot;
20
+ }, sink?: RecordSinkStats, captureOnly?: boolean): RuntimeSnapshot;
21
21
  /**
22
22
  * Collect `toSnapshot()` bundles from every attached recorder — ONE entry
23
23
  * per recorder id, across all channels and both delivery tiers.
@@ -40,4 +40,4 @@ export declare function servedSnapshot(traverser: FlowchartTraverser<any, any>,
40
40
  * recorder cannot smuggle an `id` of its own choosing into the snapshot (the
41
41
  * id is the executor's, and consumers index by it).
42
42
  */
43
- export declare function collectRecorderSnapshots(observers: RunObservers, collected?: (recorder: ScopeRecorder | FlowRecorder, row: RecorderSnapshot) => void, includeCapture?: boolean): RecorderSnapshot[];
43
+ export declare function collectRecorderSnapshots(observers: RunObservers, collected?: (recorder: ScopeRecorder | FlowRecorder, row: RecorderSnapshot) => void, includeCapture?: boolean, captureOnly?: boolean): RecorderSnapshot[];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * footprintjs/recorders — Factory functions for built-in recorders.
2
+ * Recorder factories.
3
3
  *
4
4
  * Prefer these factory functions over constructing recorder classes directly.
5
5
  * Each factory returns the recorder instance enriched with short convenience methods.
@@ -13,7 +13,7 @@
13
13
  * .run();
14
14
  * ```
15
15
  *
16
- * @module recorders
16
+ * @module footprintjs/recorders
17
17
  */
18
18
  /**
19
19
  * footprintjs/recorders -- Factory functions for built-in recorders.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * footprintjs/sinks — where a run's crash-safe record goes on a Node host (10.1, design §3.5).
2
+ * Node only. The crash-safe record as a JSON-lines file.
3
3
  *
4
- * NODE ONLY. This door imports `node:fs`; it is the one door that does (`test/architecture/layering.test.ts`), so
4
+ * This door imports `node:fs`; it is the one door that does (`test/architecture/layering.test.ts`), so
5
5
  * every other door stays loadable in a browser. The port itself — `RecordSink`, and the reference `memorySink()` —
6
6
  * is foottrace's (`foottrace/write`); the reader is `readStoredRecord` (`foottrace`).
7
7
  *
@@ -18,6 +18,8 @@
18
18
  * const record = readStoredRecord(readRecordFile('/var/footprint/orders.jsonl').entries);
19
19
  * for (const log of record.logs.values()) if (!log.complete) console.log('never finished:', log.address);
20
20
  * ```
21
+ *
22
+ * @module footprintjs/sinks
21
23
  */
22
24
  export type { FileSink, FileSinkOptions, RecordFile } from './lib/sinks/fileSink.js';
23
25
  export { DEFAULT_FILE_SINK_FLUSH_TIMEOUT_MS, DEFAULT_FILE_SINK_MAX_BYTES, DEFAULT_FILE_SINK_MAX_ENTRY_BYTES, DEFAULT_FILE_SINK_MAX_QUEUED_BYTES, fileSink, readRecordFile, } from './lib/sinks/fileSink.js';
@@ -1,9 +1,11 @@
1
1
  /**
2
- * footprintjs/trace — recorder stores, topology, chart boundaries and control dependencies.
2
+ * Engine recorders, recorder stores and structure walkers. Not the record.
3
3
  *
4
4
  * Record readers, types and runtime-ID grammar belong to `foottrace`; record path helpers belong
5
5
  * to `foottrace/paths`, and record writers to `foottrace/write`. This door exports only engine-owned
6
6
  * observer tools. Record symbols are never re-exported across the package boundary.
7
+ *
8
+ * @module footprintjs/trace
7
9
  */
8
10
  export type { WalkerItem, WalkerOptions } from './lib/engine/walkSubflowSpec.js';
9
11
  export { walkSubflowSpec } from './lib/engine/walkSubflowSpec.js';
@@ -1,15 +1,16 @@
1
1
  /**
2
- * `footprintjs/zod` — opt-in Zod integration.
2
+ * Opt-in zod scope helpers. zod is an optional peer.
3
3
  *
4
- * Zod is an OPTIONAL peer dependency. The core (`footprintjs`, `footprintjs/advanced`)
5
- * never imports it, so a plain install needs no zod and never crashes. The
6
- * zod-based scope helpers live HERE — import them from `'footprintjs/zod'` and
7
- * add `zod` to your own dependencies:
4
+ * The core (`footprintjs`, `footprintjs/advanced`) never imports zod, so a plain
5
+ * install needs no zod and never crashes. The zod-based scope helpers live here.
6
+ * Import them from `'footprintjs/zod'` and add `zod` to your own dependencies:
8
7
  *
9
8
  * import { defineScopeFromZod, defineScopeSchema } from 'footprintjs/zod';
10
9
  *
11
10
  * (`ZodScopeResolver` is exported here too if you register it yourself via
12
11
  * `registerScopeResolver` from `footprintjs/advanced`.)
12
+ *
13
+ * @module footprintjs/zod
13
14
  */
14
15
  export type { DefineScopeOptions } from './lib/scope/state/zod/defineScopeFromZod.js';
15
16
  export { defineScopeFromZod } from './lib/scope/state/zod/defineScopeFromZod.js';
package/dist/zod.js CHANGED
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  /**
3
- * `footprintjs/zod` — opt-in Zod integration.
3
+ * Opt-in zod scope helpers. zod is an optional peer.
4
4
  *
5
- * Zod is an OPTIONAL peer dependency. The core (`footprintjs`, `footprintjs/advanced`)
6
- * never imports it, so a plain install needs no zod and never crashes. The
7
- * zod-based scope helpers live HERE — import them from `'footprintjs/zod'` and
8
- * add `zod` to your own dependencies:
5
+ * The core (`footprintjs`, `footprintjs/advanced`) never imports zod, so a plain
6
+ * install needs no zod and never crashes. The zod-based scope helpers live here.
7
+ * Import them from `'footprintjs/zod'` and add `zod` to your own dependencies:
9
8
  *
10
9
  * import { defineScopeFromZod, defineScopeSchema } from 'footprintjs/zod';
11
10
  *
12
11
  * (`ZodScopeResolver` is exported here too if you register it yourself via
13
12
  * `registerScopeResolver` from `footprintjs/advanced`.)
13
+ *
14
+ * @module footprintjs/zod
14
15
  */
15
16
  Object.defineProperty(exports, "__esModule", { value: true });
16
17
  exports.createScopeProxyFromZod = exports.isScopeSchema = exports.defineScopeSchema = exports.ZodScopeResolver = exports.defineScopeFromZod = void 0;
@@ -23,4 +24,4 @@ Object.defineProperty(exports, "defineScopeSchema", { enumerable: true, get: fun
23
24
  Object.defineProperty(exports, "isScopeSchema", { enumerable: true, get: function () { return builder_js_1.isScopeSchema; } });
24
25
  var scopeFactory_js_1 = require("./lib/scope/state/zod/scopeFactory.js");
25
26
  Object.defineProperty(exports, "createScopeProxyFromZod", { enumerable: true, get: function () { return scopeFactory_js_1.createScopeProxyFromZod; } });
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiem9kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3pvZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7OztHQVlHOzs7QUFHSCxxRkFBaUY7QUFBeEUsMkhBQUEsa0JBQWtCLE9BQUE7QUFDM0IsaUVBQXFFO0FBQTVELCtHQUFBLGdCQUFnQixPQUFBO0FBQ3pCLHNFQUEyRjtBQUFsRiwrR0FBQSxpQkFBaUIsT0FBQTtBQUFFLDJHQUFBLGFBQWEsT0FBQTtBQUN6Qyx5RUFBZ0Y7QUFBdkUsMEhBQUEsdUJBQXVCLE9BQUEiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIGBmb290cHJpbnRqcy96b2RgIOKAlCBvcHQtaW4gWm9kIGludGVncmF0aW9uLlxuICpcbiAqIFpvZCBpcyBhbiBPUFRJT05BTCBwZWVyIGRlcGVuZGVuY3kuIFRoZSBjb3JlIChgZm9vdHByaW50anNgLCBgZm9vdHByaW50anMvYWR2YW5jZWRgKVxuICogbmV2ZXIgaW1wb3J0cyBpdCwgc28gYSBwbGFpbiBpbnN0YWxsIG5lZWRzIG5vIHpvZCBhbmQgbmV2ZXIgY3Jhc2hlcy4gVGhlXG4gKiB6b2QtYmFzZWQgc2NvcGUgaGVscGVycyBsaXZlIEhFUkUg4oCUIGltcG9ydCB0aGVtIGZyb20gYCdmb290c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HlwZSB7IERlZmluZVNjb3BlT3B0aW9ucyB9IGZyb20gJy4vbGliL3Njb3BlL3N0YXRlL3pvZC9kZWZpbmVTY29wZUZyb21ab2QuanMnO1xuZXhwb3J0IHsgZGVmaW5lU2NvcGVGcm9tWm9kIH0gZnJvbSAnLi9saWIvc2NvcGUvc3RhdGUvem9kL2RlZmluZVNjb3BlRnJvbVpvZC5qcyc7XG5leHBvcnQgeyBab2RTY29wZVJlc29sdmVyIH0gZnJvbSAnLi9saWIvc2NvcGUvc3RhdGUvem9kL3Jlc29sdmVyLmpzJztcbmV4cG9ydCB7IGRlZmluZVNjb3BlU2NoZW1hLCBpc1Njb3BlU2NoZW1hIH0gZnJvbSAnLi9saWIvc2NvcGUvc3RhdGUvem9kL3NjaGVtYS9idWlsZGVyLmpzJztcbmV4cG9ydCB7IGNyZWF0ZVNjb3BlUHJveHlGcm9tWm9kIH0gZnJvbSAnLi9saWIvc2NvcGUvc3RhdGUvem9kL3Njb3BlRmFjdG9yeS5qcyc7XG4iXX0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "footprintjs",
3
- "version": "11.0.1",
3
+ "version": "11.2.0",
4
4
  "description": "TypeScript workflow engine that records each run's stages, state changes and decision evidence, so AI agents and people can explain and debug what happened.",
5
5
  "license": "MIT",
6
6
  "author": "Sanjay Krishna Anbalagan",
@@ -55,6 +55,9 @@
55
55
  "check:trace-ready": "node scripts/trace-ready.mjs --check-extracted",
56
56
  "trace:ready": "node scripts/trace-ready.mjs",
57
57
  "check:doc-snippets": "node scripts/check-doc-snippets.mjs",
58
+ "ai:generate": "node scripts/ai-instructions/generate.mjs",
59
+ "check:ai-instructions": "node scripts/ai-instructions/generate.mjs --check",
60
+ "check:api-doors": "node scripts/api-doors/check.mjs",
58
61
  "audit:family": "node scripts/audit-family-versions.mjs",
59
62
  "audit:consumers": "node scripts/audit-consumers.mjs",
60
63
  "lint": "eslint '{src,test}/**/*.ts' --ext .ts",