footprintjs 11.1.0 → 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.
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/capture/absentEntries.js +15 -13
- package/dist/esm/lib/capture/evidenceInput/index.d.ts +4 -0
- package/dist/esm/lib/capture/evidenceInput/index.js +8 -0
- package/dist/esm/lib/capture/historyData.d.ts +10 -2
- package/dist/esm/lib/capture/historyData.js +19 -10
- package/dist/esm/lib/capture/historyNote.d.ts +1 -1
- package/dist/esm/lib/capture/historyNote.js +1 -1
- package/dist/esm/lib/capture/nativeClosure/evidence.d.ts +8 -0
- package/dist/esm/lib/capture/nativeClosure/evidence.js +71 -0
- package/dist/esm/lib/capture/nativeClosure/format.d.ts +35 -0
- package/dist/esm/lib/capture/nativeClosure/format.js +141 -0
- package/dist/esm/lib/capture/nativeClosure/invocations.d.ts +11 -0
- package/dist/esm/lib/capture/nativeClosure/invocations.js +24 -0
- package/dist/esm/lib/capture/nativeExtent/collector.d.ts +30 -0
- package/dist/esm/lib/capture/nativeExtent/collector.js +91 -0
- package/dist/esm/lib/capture/nativeExtent/format.d.ts +48 -0
- package/dist/esm/lib/capture/nativeExtent/format.js +143 -0
- package/dist/esm/lib/detach/spawn.d.ts +2 -0
- package/dist/esm/lib/detach/spawn.js +6 -1
- package/dist/esm/lib/engine/handlers/ChildrenExecutor.js +2 -1
- package/dist/esm/lib/engine/handlers/SelectorHandler.js +2 -2
- package/dist/esm/lib/engine/handlers/StageRunner.js +63 -14
- package/dist/esm/lib/engine/handlers/commitStage.js +2 -2
- package/dist/esm/lib/engine/handlers/stageError.d.ts +1 -1
- package/dist/esm/lib/engine/handlers/stageError.js +4 -2
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +0 -2
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +5 -63
- package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.d.ts +3 -0
- package/dist/esm/lib/engine/narrative/formatting/ruleEvidence/index.js +77 -0
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +24 -1
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +6 -6
- package/dist/esm/lib/engine/traversal/touchesRefusal/index.d.ts +3 -0
- package/dist/esm/lib/engine/traversal/touchesRefusal/index.js +7 -0
- package/dist/esm/lib/errors/callsEnded/index.d.ts +2 -0
- package/dist/esm/lib/errors/callsEnded/index.js +6 -0
- package/dist/esm/lib/errors/terminalFailure.d.ts +26 -0
- package/dist/esm/lib/errors/terminalFailure.js +49 -1
- package/dist/esm/lib/memory/StageContext.d.ts +11 -17
- package/dist/esm/lib/memory/StageContext.js +35 -41
- package/dist/esm/lib/memory/frameTypes.d.ts +2 -0
- package/dist/esm/lib/memory/frameTypes.js +1 -1
- package/dist/esm/lib/memory/retainedValue/index.d.ts +16 -0
- package/dist/esm/lib/memory/retainedValue/index.js +25 -0
- package/dist/esm/lib/recorder/CompositeRecorder.js +17 -9
- package/dist/esm/lib/recorder/ControlDepRecorder.js +4 -3
- package/dist/esm/lib/recorder/captureSnapshot/index.d.ts +17 -0
- package/dist/esm/lib/recorder/captureSnapshot/index.js +29 -0
- package/dist/esm/lib/recorder/snapshot.d.ts +1 -1
- package/dist/esm/lib/recorder/snapshot.js +19 -8
- package/dist/esm/lib/runner/ExecutionRuntime.d.ts +6 -1
- package/dist/esm/lib/runner/ExecutionRuntime.js +11 -2
- package/dist/esm/lib/runner/FlowChartExecutor.d.ts +7 -7
- package/dist/esm/lib/runner/FlowChartExecutor.js +46 -54
- package/dist/esm/lib/runner/attach.d.ts +3 -0
- package/dist/esm/lib/runner/attach.js +12 -1
- package/dist/esm/lib/runner/captureHistory.d.ts +2 -1
- package/dist/esm/lib/runner/captureHistory.js +21 -6
- package/dist/esm/lib/runner/nativeClosure/cut.d.ts +14 -0
- package/dist/esm/lib/runner/nativeClosure/cut.js +25 -0
- package/dist/esm/lib/runner/nativeClosure/record.d.ts +31 -0
- package/dist/esm/lib/runner/nativeClosure/record.js +68 -0
- package/dist/esm/lib/runner/nativeClosure/state.d.ts +8 -0
- package/dist/esm/lib/runner/nativeClosure/state.js +18 -0
- package/dist/esm/lib/runner/options.d.ts +29 -1
- package/dist/esm/lib/runner/options.js +19 -1
- package/dist/esm/lib/runner/readStoredCapture.d.ts +6 -0
- package/dist/esm/lib/runner/readStoredCapture.js +1 -1
- package/dist/esm/lib/runner/recordMetadata/index.d.ts +12 -0
- package/dist/esm/lib/runner/recordMetadata/index.js +25 -0
- package/dist/esm/lib/runner/runCleanup/index.d.ts +5 -0
- package/dist/esm/lib/runner/runCleanup/index.js +17 -0
- package/dist/esm/lib/runner/snapshot.d.ts +2 -2
- package/dist/esm/lib/runner/snapshot.js +12 -8
- package/dist/esm/lib/runner/storedCaptureAdmission.js +19 -1
- package/dist/esm/lib/scope/ScopeFacade.js +7 -7
- package/dist/index.js +1 -1
- package/dist/lib/capture/absentEntries.js +15 -13
- package/dist/lib/capture/evidenceInput/index.js +12 -0
- package/dist/lib/capture/historyData.js +20 -11
- package/dist/lib/capture/historyNote.js +1 -1
- package/dist/lib/capture/nativeClosure/evidence.js +75 -0
- package/dist/lib/capture/nativeClosure/format.js +145 -0
- package/dist/lib/capture/nativeClosure/invocations.js +28 -0
- package/dist/lib/capture/nativeExtent/collector.js +95 -0
- package/dist/lib/capture/nativeExtent/format.js +147 -0
- package/dist/lib/detach/spawn.js +8 -2
- package/dist/lib/engine/handlers/ChildrenExecutor.js +2 -1
- package/dist/lib/engine/handlers/SelectorHandler.js +2 -2
- package/dist/lib/engine/handlers/StageRunner.js +63 -14
- package/dist/lib/engine/handlers/commitStage.js +2 -2
- package/dist/lib/engine/handlers/stageError.js +4 -2
- package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +4 -62
- package/dist/lib/engine/narrative/formatting/ruleEvidence/index.js +82 -0
- package/dist/lib/engine/traversal/FlowchartTraverser.js +7 -7
- package/dist/lib/engine/traversal/touchesRefusal/index.js +11 -0
- package/dist/lib/errors/callsEnded/index.js +10 -0
- package/dist/lib/errors/terminalFailure.js +49 -1
- package/dist/lib/memory/StageContext.js +35 -41
- package/dist/lib/memory/frameTypes.js +1 -1
- package/dist/lib/memory/retainedValue/index.js +30 -0
- package/dist/lib/recorder/CompositeRecorder.js +17 -9
- package/dist/lib/recorder/ControlDepRecorder.js +4 -3
- package/dist/lib/recorder/captureSnapshot/index.js +35 -0
- package/dist/lib/recorder/snapshot.js +19 -8
- package/dist/lib/runner/ExecutionRuntime.js +11 -2
- package/dist/lib/runner/FlowChartExecutor.js +52 -60
- package/dist/lib/runner/attach.js +12 -1
- package/dist/lib/runner/captureHistory.js +21 -6
- package/dist/lib/runner/nativeClosure/cut.js +29 -0
- package/dist/lib/runner/nativeClosure/record.js +72 -0
- package/dist/lib/runner/nativeClosure/state.js +22 -0
- package/dist/lib/runner/options.js +19 -1
- package/dist/lib/runner/readStoredCapture.js +1 -1
- package/dist/lib/runner/recordMetadata/index.js +30 -0
- package/dist/lib/runner/runCleanup/index.js +22 -0
- package/dist/lib/runner/snapshot.js +12 -8
- package/dist/lib/runner/storedCaptureAdmission.js +19 -1
- package/dist/lib/scope/ScopeFacade.js +8 -8
- package/dist/types/index.d.ts +3 -0
- package/dist/types/lib/capture/evidenceInput/index.d.ts +4 -0
- package/dist/types/lib/capture/historyData.d.ts +10 -2
- package/dist/types/lib/capture/historyNote.d.ts +1 -1
- package/dist/types/lib/capture/nativeClosure/evidence.d.ts +8 -0
- package/dist/types/lib/capture/nativeClosure/format.d.ts +35 -0
- package/dist/types/lib/capture/nativeClosure/invocations.d.ts +11 -0
- package/dist/types/lib/capture/nativeExtent/collector.d.ts +30 -0
- package/dist/types/lib/capture/nativeExtent/format.d.ts +48 -0
- package/dist/types/lib/detach/spawn.d.ts +2 -0
- package/dist/types/lib/engine/handlers/stageError.d.ts +1 -1
- package/dist/types/lib/engine/narrative/CombinedNarrativeRecorder.d.ts +0 -2
- package/dist/types/lib/engine/narrative/formatting/ruleEvidence/index.d.ts +3 -0
- package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +24 -1
- package/dist/types/lib/engine/traversal/touchesRefusal/index.d.ts +3 -0
- package/dist/types/lib/errors/callsEnded/index.d.ts +2 -0
- package/dist/types/lib/errors/terminalFailure.d.ts +26 -0
- package/dist/types/lib/memory/StageContext.d.ts +11 -17
- package/dist/types/lib/memory/frameTypes.d.ts +2 -0
- package/dist/types/lib/memory/retainedValue/index.d.ts +16 -0
- package/dist/types/lib/recorder/captureSnapshot/index.d.ts +17 -0
- package/dist/types/lib/recorder/snapshot.d.ts +1 -1
- package/dist/types/lib/runner/ExecutionRuntime.d.ts +6 -1
- package/dist/types/lib/runner/FlowChartExecutor.d.ts +7 -7
- package/dist/types/lib/runner/attach.d.ts +3 -0
- package/dist/types/lib/runner/captureHistory.d.ts +2 -1
- package/dist/types/lib/runner/nativeClosure/cut.d.ts +14 -0
- package/dist/types/lib/runner/nativeClosure/record.d.ts +31 -0
- package/dist/types/lib/runner/nativeClosure/state.d.ts +8 -0
- package/dist/types/lib/runner/options.d.ts +29 -1
- package/dist/types/lib/runner/readStoredCapture.d.ts +6 -0
- package/dist/types/lib/runner/recordMetadata/index.d.ts +12 -0
- package/dist/types/lib/runner/runCleanup/index.d.ts +5 -0
- package/dist/types/lib/runner/snapshot.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LogAddress } from 'foottrace';
|
|
2
|
+
import type { SelectedNativeFailure } from '../../errors/terminalFailure.js';
|
|
3
|
+
import { type NativeCaptureExtent } from '../nativeExtent/format.js';
|
|
4
|
+
import type { NativeCaptureObservation } from '../readSources.js';
|
|
5
|
+
/** Fixed policy limits, retained even when the copied native prefix has no recording gaps. */
|
|
6
|
+
export declare const CAPTURE_CLOSURE_LIMITATIONS: readonly ["unobserved-work-not-attested", "external-work-not-attested", "storage-not-attested", "producer-not-authenticated"];
|
|
7
|
+
/**
|
|
8
|
+
* A descriptor for a separately copied immutable native prefix, not a closure claim about a live snapshot.
|
|
9
|
+
* Outcome and closure are independent: a failed execution remains failed. This grants no semantic cause,
|
|
10
|
+
* remote cancellation or authenticity authority; required channel coverage is assessed separately.
|
|
11
|
+
*/
|
|
12
|
+
export interface NativeCaptureClosure {
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
readonly policy: 'native-root-prefix-v1';
|
|
15
|
+
readonly scope: 'root-log';
|
|
16
|
+
readonly runId: string;
|
|
17
|
+
readonly logAddress: LogAddress;
|
|
18
|
+
readonly commits: {
|
|
19
|
+
readonly from: number;
|
|
20
|
+
readonly to: number;
|
|
21
|
+
};
|
|
22
|
+
readonly status: 'closed';
|
|
23
|
+
readonly boundary: 'completed' | 'failed';
|
|
24
|
+
/** Captured at the actual invocation; never inferred from the last error or a sole attempt. */
|
|
25
|
+
readonly selectedFailure?: Extract<SelectedNativeFailure, {
|
|
26
|
+
readonly kind: 'invocation';
|
|
27
|
+
}>;
|
|
28
|
+
readonly limitations: readonly (typeof CAPTURE_CLOSURE_LIMITATIONS)[number][];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Copy only an exact inert descriptor bound to an already admitted note and native work book. The caller
|
|
32
|
+
* separately supplies the fixed copied evidence and refuses unsupported work. These consistency checks are
|
|
33
|
+
* not a signature or a sandbox for executable Proxies; a coherent stored rewrite remains unauthenticated.
|
|
34
|
+
*/
|
|
35
|
+
export declare function copyCaptureClosure(value: unknown, binding: NativeCaptureObservation, extent: NativeCaptureExtent): NativeCaptureClosure | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AttemptContext } from '../../attempt/types.js';
|
|
2
|
+
import type { SelectedNativeFailure, TerminalFailureContext } from '../../errors/terminalFailure.js';
|
|
3
|
+
/** Bounded actual-entry count only; identities and live owners are never retained. */
|
|
4
|
+
export declare class NativeClosureInvocations {
|
|
5
|
+
private entered;
|
|
6
|
+
get count(): number;
|
|
7
|
+
reset(): void;
|
|
8
|
+
begin(identity: NonNullable<TerminalFailureContext['stage']>, attempt: AttemptContext | undefined): Extract<SelectedNativeFailure, {
|
|
9
|
+
kind: 'invocation';
|
|
10
|
+
}> | 'counter-saturated';
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LogAddress } from 'foottrace';
|
|
2
|
+
import { type NativeCaptureExtent, type NativeCaptureExtentLimitation } from './format.js';
|
|
3
|
+
/** @internal Captures only its own book; no stage, scope, business value or exception is retained. */
|
|
4
|
+
export interface NativeInvocationObservation {
|
|
5
|
+
/** Called where an existing native continuation observes settlement. */
|
|
6
|
+
settle(): void;
|
|
7
|
+
abandon(): void;
|
|
8
|
+
}
|
|
9
|
+
/** @internal One bounded native book per explicitly enabled root leg, never shared into a child runtime. */
|
|
10
|
+
export declare class NativeExtent {
|
|
11
|
+
private readonly runId;
|
|
12
|
+
private readonly address;
|
|
13
|
+
private readonly from;
|
|
14
|
+
private started;
|
|
15
|
+
private settled;
|
|
16
|
+
private pending;
|
|
17
|
+
private abandoned;
|
|
18
|
+
private readonly gaps;
|
|
19
|
+
private terminal?;
|
|
20
|
+
private closureGap?;
|
|
21
|
+
/** Separate eligibility for a frozen prefix; never changes the version-1 bookkeeping observation. */
|
|
22
|
+
refuseClosure(reason: string): void;
|
|
23
|
+
get closureRefusal(): string | undefined;
|
|
24
|
+
constructor(runId: string, address: LogAddress, from: number);
|
|
25
|
+
limit(gap: NativeCaptureExtentLimitation): void;
|
|
26
|
+
begin(): NativeInvocationObservation | undefined;
|
|
27
|
+
seal(to: number): void;
|
|
28
|
+
snapshot(to: number): NativeCaptureExtent;
|
|
29
|
+
private view;
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LogAddress } from 'foottrace';
|
|
2
|
+
import type { NativeCaptureNote } from '../nativeCoverage.js';
|
|
3
|
+
export declare const BASE_LIMITATIONS: readonly ["closure-not-attested", "channels-not-fenced", "external-work-not-attested"];
|
|
4
|
+
/** This vocabulary describes bookkeeping gaps, never permission to admit a complete capture. */
|
|
5
|
+
declare const EXTENT_LIMITATIONS: readonly ["closure-not-attested", "channels-not-fenced", "external-work-not-attested", "pending-native-invocations", "abandoned-native-invocations", "counter-saturated", "child-work-not-tracked", "fanout-work-not-attested", "detached-work-not-tracked", "custom-scope", "resumed-segment"];
|
|
6
|
+
export type NativeCaptureExtentLimitation = (typeof EXTENT_LIMITATIONS)[number];
|
|
7
|
+
export declare const RUNNING_STATUS = "running";
|
|
8
|
+
export declare const TERMINAL_STATUS = "unverified";
|
|
9
|
+
declare const EXTENT_STATUSES: readonly ["running", "unverified"];
|
|
10
|
+
/** @internal Fixed counter/active-token ceiling; overflow is disclosed rather than silently wrapping. */
|
|
11
|
+
export declare const NATIVE_EXTENT_MAX_INVOCATIONS = 1000000;
|
|
12
|
+
/**
|
|
13
|
+
* Value-free native function bookkeeping for one root-log leg. An unverified terminal observation is immutable;
|
|
14
|
+
* neither zero pending invocations nor storage acknowledgement establishes closed capture or remote cancellation.
|
|
15
|
+
* Version 1 has no closed state; a future closure attestation requires a separately reviewed version.
|
|
16
|
+
*/
|
|
17
|
+
export interface NativeCaptureExtent {
|
|
18
|
+
readonly version: 1;
|
|
19
|
+
/** One extent per native leg; deliberately the same identifier as runId. */
|
|
20
|
+
readonly extentId: string;
|
|
21
|
+
readonly runId: string;
|
|
22
|
+
readonly scope: 'root-log';
|
|
23
|
+
readonly logAddress: LogAddress;
|
|
24
|
+
/** Half-open root-log segment observed at this cut. */
|
|
25
|
+
readonly commits: {
|
|
26
|
+
readonly from: number;
|
|
27
|
+
readonly to: number;
|
|
28
|
+
};
|
|
29
|
+
readonly status: (typeof EXTENT_STATUSES)[number];
|
|
30
|
+
readonly invocations: {
|
|
31
|
+
readonly started: number;
|
|
32
|
+
/** Synchronous return/throw, or Promise settlement observed by an existing native continuation. */
|
|
33
|
+
readonly settled: number;
|
|
34
|
+
/** No settlement observed at the sampled cut; not an inspection of a Promise's internal state. */
|
|
35
|
+
readonly pending: number;
|
|
36
|
+
/** Native waits aborted before settlement was observed; may overlap settled. */
|
|
37
|
+
readonly abandoned: number;
|
|
38
|
+
};
|
|
39
|
+
readonly persistence: 'memory-only';
|
|
40
|
+
readonly limitations: readonly NativeCaptureExtentLimitation[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The one producer-owned admission boundary, after the history copier's bounded inert-data projection. Refuses
|
|
44
|
+
* unknown versions, accessors, extras and inconsistent counts. It is not a sandbox for executable live Proxies;
|
|
45
|
+
* matching inert data is not producer authentication or closure proof.
|
|
46
|
+
*/
|
|
47
|
+
export declare function copyNativeCaptureExtent(value: unknown, binding: Pick<NativeCaptureNote, 'runId' | 'logAddress' | 'commits'>, terminalOnly?: boolean): NativeCaptureExtent | undefined;
|
|
48
|
+
export {};
|
|
@@ -62,3 +62,5 @@ export declare function detachAndJoinLater(driver: DetachDriver, child: FlowChar
|
|
|
62
62
|
* T7 for recommended observability patterns for "forget" detach.
|
|
63
63
|
*/
|
|
64
64
|
export declare function detachAndForget(driver: DetachDriver, child: FlowChart, input: unknown, sourcePrefix: string): void;
|
|
65
|
+
/** The name a late detach is recorded under: the child chart's root id — a name, never its input. */
|
|
66
|
+
export declare function detachKey(child: FlowChart): string;
|
|
@@ -15,7 +15,7 @@ export declare function recordStageError(context: StageContext, error: unknown):
|
|
|
15
15
|
structuredError: StructuredErrorInfo;
|
|
16
16
|
};
|
|
17
17
|
/** Capture before commit observers or diagnostic serving can change the raw value. */
|
|
18
|
-
export declare function captureStageFailure(context: StageContext, error: unknown): void;
|
|
18
|
+
export declare function captureStageFailure(context: StageContext, error: unknown, commit?: boolean): void;
|
|
19
19
|
/** The served form of a thrown value at any other report of a stage failure (retry, throttle). */
|
|
20
20
|
export declare function servedStageError(context: StageContext, error: unknown): StructuredErrorInfo;
|
|
21
21
|
/** What the logger is handed: the thrown value, or its masked form when the policy masked its text. */
|
|
@@ -195,9 +195,7 @@ export declare class CombinedNarrativeRecorder implements CombinedRecorder {
|
|
|
195
195
|
private flushOps;
|
|
196
196
|
private defaultRenderStage;
|
|
197
197
|
private defaultRenderOp;
|
|
198
|
-
private defaultRenderDecision;
|
|
199
198
|
private defaultRenderFork;
|
|
200
|
-
private defaultRenderSelected;
|
|
201
199
|
private defaultRenderSubflow;
|
|
202
200
|
private defaultRenderLoop;
|
|
203
201
|
private defaultRenderBreak;
|
|
@@ -348,7 +348,30 @@ export declare class FlowchartTraverser<TOut = any, TScope = any> {
|
|
|
348
348
|
commitLog: unknown[];
|
|
349
349
|
readSources?: import("../../capture/readSources.js").EngineReadSources | undefined;
|
|
350
350
|
logAddress?: import("foottrace").LogAddress | undefined;
|
|
351
|
-
subflowResults?: Record<string, unknown> | undefined;
|
|
351
|
+
subflowResults?: Record<string, unknown> | undefined; /**
|
|
352
|
+
* Default maximum nested executeNode depth before an error is thrown.
|
|
353
|
+
*
|
|
354
|
+
* **What counts as depth (trampoline model):** `executeNode` is an iterative
|
|
355
|
+
* driver — linear `next` hops, loop edges (`loopTo`/dynamic next), and
|
|
356
|
+
* dynamic-subflow re-entry are followed in a flat loop and consume NO depth.
|
|
357
|
+
* Depth grows only with true tree nesting: one tick per fork child, one per
|
|
358
|
+
* decider/selector branch dispatch that must return to its invoker (decider
|
|
359
|
+
* with its own `next`), one per subflow mount frame in the parent (the
|
|
360
|
+
* subflow body itself runs on a FRESH traverser with its own budget).
|
|
361
|
+
*
|
|
362
|
+
* 500 therefore covers any realistic chart — it bounds recursive
|
|
363
|
+
* COMPOSITION, not chain length or loop count. Loops are bounded by
|
|
364
|
+
* `ContinuationResolver`'s independent iteration limit (default 1000,
|
|
365
|
+
* configurable via `RunOptions.maxIterations`), which is now the binding
|
|
366
|
+
* constraint for loop-heavy pipelines.
|
|
367
|
+
*
|
|
368
|
+
* Parallel siblings share their parent's depth + 1 — a fork or selector of any width is
|
|
369
|
+
* one level, never one level per child.
|
|
370
|
+
*
|
|
371
|
+
* @remarks Not safe for concurrent `.execute()` calls on the same instance (the break flag
|
|
372
|
+
* and the resolver's loop counts are per instance). Use a separate `FlowchartTraverser` per
|
|
373
|
+
* concurrent execution. `FlowChartExecutor.run()` always creates a fresh traverser per call.
|
|
374
|
+
*/
|
|
352
375
|
recorders?: {
|
|
353
376
|
id: string;
|
|
354
377
|
name: string;
|
|
@@ -8,6 +8,23 @@ export interface TerminalFailureContext {
|
|
|
8
8
|
readonly runtimeStageId: string;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal Safe native operation selected by the exact escaping error. This is distinct from the legacy
|
|
13
|
+
* served context: an invocation identifies an actual call, while a commit must never borrow that call's id.
|
|
14
|
+
*/
|
|
15
|
+
export type SelectedNativeFailure = {
|
|
16
|
+
readonly kind: 'invocation';
|
|
17
|
+
readonly runId: string;
|
|
18
|
+
readonly runtimeStageId: string;
|
|
19
|
+
readonly attemptId: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'commit';
|
|
22
|
+
readonly runId: string;
|
|
23
|
+
readonly runtimeStageId: string;
|
|
24
|
+
};
|
|
25
|
+
type InvocationFailure = Extract<SelectedNativeFailure, {
|
|
26
|
+
readonly kind: 'invocation';
|
|
27
|
+
}>;
|
|
11
28
|
/**
|
|
12
29
|
* @internal One execution chain's failure ownership, not an error history.
|
|
13
30
|
* Sequential frames share it; forks and subflows do not. Only an explicitly
|
|
@@ -17,7 +34,15 @@ export interface TerminalFailureContext {
|
|
|
17
34
|
export declare class NativeFailureState {
|
|
18
35
|
#private;
|
|
19
36
|
get result(): TerminalFailureContext | undefined;
|
|
37
|
+
/** @internal Published separately; ordinary failure contexts and off-path snapshots retain their shape. */
|
|
38
|
+
get selected(): SelectedNativeFailure | undefined;
|
|
39
|
+
/** @internal An existing native catch observed this invocation's own error, before any serving callbacks. */
|
|
40
|
+
observeInvocationFailure(error: unknown, invocation: InvocationFailure): void;
|
|
41
|
+
/** @internal A new attempt's preparation cannot inherit a recovered invocation's error. */
|
|
42
|
+
clearInvocationFailure(): void;
|
|
20
43
|
capture(error: unknown, category: AttemptCategory, stage: NonNullable<TerminalFailureContext['stage']>): void;
|
|
44
|
+
/** @internal A commit is a different operation, even if it throws the very same object as the function. */
|
|
45
|
+
selectCommit(error: unknown, stage: NonNullable<TerminalFailureContext['stage']>): void;
|
|
21
46
|
/** A runner already classified this exact native failure before it was served. */
|
|
22
47
|
owns(error: unknown): boolean;
|
|
23
48
|
adopt(child: NativeFailureState, error: unknown): void;
|
|
@@ -27,3 +52,4 @@ export declare class NativeFailureState {
|
|
|
27
52
|
/** Success or pause has no terminal failure. Also closes contained branch ownership. */
|
|
28
53
|
complete(): void;
|
|
29
54
|
}
|
|
55
|
+
export {};
|
|
@@ -15,13 +15,13 @@ import type { CommitPhase, EmitSourcePosition, UntrackedSource } from 'foottrace
|
|
|
15
15
|
import type { EventLog, SharedMemory } from 'foottrace/write';
|
|
16
16
|
import type { AttemptContext, AttemptRecord, AttemptSummary, LateWrite } from '../attempt/types.js';
|
|
17
17
|
import type { NativeCapture } from '../capture/nativeCoverage.js';
|
|
18
|
+
import type { NativeExtent } from '../capture/nativeExtent/collector.js';
|
|
18
19
|
import type { EngineReadSourceCapture } from '../capture/readSources.js';
|
|
19
20
|
import type { StructuredErrorInfo } from '../errors/errorInfo.js';
|
|
20
|
-
import { type TerminalFailureContext, NativeFailureState } from '../errors/terminalFailure.js';
|
|
21
|
+
import { type SelectedNativeFailure, type TerminalFailureContext, NativeFailureState } from '../errors/terminalFailure.js';
|
|
21
22
|
import { type DiagnosticChannel, DiagnosticCollector } from './DiagnosticCollector.js';
|
|
22
23
|
import type { FlowControlType, StageSnapshot } from './frameTypes.js';
|
|
23
|
-
import type
|
|
24
|
-
import { RedactionRule } from './redaction.js';
|
|
24
|
+
import { type RedactionRule, type RedactionVerdict } from './redaction.js';
|
|
25
25
|
import type { RunPolicy } from './runPolicy.js';
|
|
26
26
|
/**
|
|
27
27
|
* How many call and observed attempt records one stage execution keeps (P2) — a stage that calls in a loop must
|
|
@@ -33,6 +33,9 @@ export declare class StageContext {
|
|
|
33
33
|
#private;
|
|
34
34
|
/** @internal Ownership of an escaping failure. Shared only by sequential frames, never serialized. */
|
|
35
35
|
failureState: NativeFailureState;
|
|
36
|
+
/** @internal Default-off producer seam. It grants no closure or capture completeness by itself. */
|
|
37
|
+
captureClosureTracking?: boolean;
|
|
38
|
+
private closureInvocations?;
|
|
36
39
|
/** @internal The native frame stamp, independent of mutable recorder event context. */
|
|
37
40
|
get failureIdentity(): NonNullable<TerminalFailureContext['stage']> | undefined;
|
|
38
41
|
/** @internal Stamped before observers; never inherited by another frame or persisted. */
|
|
@@ -61,6 +64,7 @@ export declare class StageContext {
|
|
|
61
64
|
private emitRunId?;
|
|
62
65
|
/** The native root-log collector; copied to same-log frames, never child runtimes. */
|
|
63
66
|
capture?: NativeCapture;
|
|
67
|
+
captureExtent?: NativeExtent;
|
|
64
68
|
/** Source coverage, shared only by frames of this runtime. */
|
|
65
69
|
readSources?: EngineReadSourceCapture;
|
|
66
70
|
private sourceReadCounter?;
|
|
@@ -287,20 +291,6 @@ export declare class StageContext {
|
|
|
287
291
|
* commit observer see the finished record.
|
|
288
292
|
*/
|
|
289
293
|
private materialiseWrites;
|
|
290
|
-
/**
|
|
291
|
-
* The form of a value the engine RETAINS (reads and writes retention):
|
|
292
|
-
* the placeholder beats every dial; a field-level scrub happens before the
|
|
293
|
-
* dial sees the value; a clear value is summarized or cloned as the dial
|
|
294
|
-
* says. Callers handle `undefined` before asking.
|
|
295
|
-
*/
|
|
296
|
-
private retainedForm;
|
|
297
|
-
/**
|
|
298
|
-
* The rule with something to say — `undefined` on the no-policy path (no
|
|
299
|
-
* rule installed, or a rule with no policy entries and no marked keys), so
|
|
300
|
-
* a tracked read or a staged write there pays no verdict call and no path
|
|
301
|
-
* allocation. The default run is byte-identical AND cost-identical.
|
|
302
|
-
*/
|
|
303
|
-
private activeRule;
|
|
304
294
|
/**
|
|
305
295
|
* THE ONE FUNNEL every staged write passes through — facade writes AND
|
|
306
296
|
* the paths that bypass the facade (subflow seed, `outputMapper`
|
|
@@ -553,6 +543,10 @@ export declare class StageContext {
|
|
|
553
543
|
useAttempt(attempt: AttemptContext | undefined, runSignal: AbortSignal | undefined): void;
|
|
554
544
|
/** Native function-entry fact, including the direct one-call path with no retry runner. */
|
|
555
545
|
beginSourceInvocation(attempt: AttemptContext | undefined): void;
|
|
546
|
+
/** @internal Called only immediately before an actual native function entry, never reconstructed from rows. */
|
|
547
|
+
beginClosureInvocation(attempt: AttemptContext | undefined): Extract<SelectedNativeFailure, {
|
|
548
|
+
kind: 'invocation';
|
|
549
|
+
}> | undefined;
|
|
556
550
|
/** The attempt now running; `undefined` for a stage the attempt runner does not run. */
|
|
557
551
|
get attempt(): AttemptContext | undefined;
|
|
558
552
|
/** The run's signal, as `StageRunner` last saw it. */
|
|
@@ -97,6 +97,8 @@ export type StageSnapshot = {
|
|
|
97
97
|
readSourceCounts?: SourceReadCounts;
|
|
98
98
|
/** Number of native stage-function entries, independent of read retention and ownership-list budgets. */
|
|
99
99
|
readSourceInvocations?: number;
|
|
100
|
+
/** Actual native function entries collected for this execution only when immutable-prefix capture is enabled. */
|
|
101
|
+
nativeInvocations?: number;
|
|
100
102
|
logs: Record<string, unknown>;
|
|
101
103
|
errors: Record<string, unknown>;
|
|
102
104
|
metrics: Record<string, unknown>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReadTrackingMode, WriteTrackingMode } from '../frameTypes.js';
|
|
2
|
+
import { type RedactionVerdict, RedactionRule } from '../redaction.js';
|
|
3
|
+
/**
|
|
4
|
+
* The form of a value the engine RETAINS (reads and writes retention):
|
|
5
|
+
* the placeholder beats every dial; a field-level scrub happens before the
|
|
6
|
+
* dial sees the value; a clear value is summarized or cloned as the dial
|
|
7
|
+
* says. Callers handle `undefined` before asking.
|
|
8
|
+
*/
|
|
9
|
+
export declare function retainedForm(verdict: RedactionVerdict, value: unknown, mode: ReadTrackingMode | WriteTrackingMode, summarize: (value: unknown) => unknown): unknown;
|
|
10
|
+
/**
|
|
11
|
+
* The rule with something to say — `undefined` on the no-policy path (no
|
|
12
|
+
* rule installed, or a rule with no policy entries and no marked keys), so
|
|
13
|
+
* a tracked read or a staged write there pays no verdict call and no path
|
|
14
|
+
* allocation. The default run is byte-identical AND cost-identical.
|
|
15
|
+
*/
|
|
16
|
+
export declare function activeRule(rule: RedactionRule | undefined): RedactionRule | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RecorderBundle } from '../snapshot.js';
|
|
2
|
+
/** One synchronous automatic collection; never retained by the registry. */
|
|
3
|
+
export interface CaptureSnapshotContext {
|
|
4
|
+
rows: number;
|
|
5
|
+
depth: number;
|
|
6
|
+
readonly active: Set<object>;
|
|
7
|
+
}
|
|
8
|
+
type SnapshotOwner = {
|
|
9
|
+
toSnapshot?: () => RecorderBundle;
|
|
10
|
+
};
|
|
11
|
+
type CaptureSnapshotStrategy = (owner: object, context: CaptureSnapshotContext) => RecorderBundle;
|
|
12
|
+
/** Built-in method identity only: overrides remain the recorder author's own hook. */
|
|
13
|
+
export declare function registerCaptureSnapshot(method: object, strategy: CaptureSnapshotStrategy): void;
|
|
14
|
+
export declare function createCaptureSnapshotContext(): CaptureSnapshotContext;
|
|
15
|
+
/** Bound library-owned composite expansion before invoking the next synchronous hook. */
|
|
16
|
+
export declare function captureRecorderSnapshot(owner: SnapshotOwner, context: CaptureSnapshotContext): RecorderBundle;
|
|
17
|
+
export {};
|
|
@@ -28,5 +28,5 @@ export type RecorderBundle = {
|
|
|
28
28
|
[K in keyof BundleFields]: Pick<BundleFields, K> extends Required<Pick<BundleFields, K>> ? BundleFields[K] : BundleFields[K] | undefined;
|
|
29
29
|
};
|
|
30
30
|
/** Rebuild `bundle` as the snapshot row for the recorder attached under `id`. */
|
|
31
|
-
export declare function copyBundle(id: string, bundle: RecorderBundle, includeCapture?: boolean): RecorderSnapshot;
|
|
31
|
+
export declare function copyBundle(id: string, bundle: RecorderBundle, includeCapture?: boolean, captureOnly?: boolean): RecorderSnapshot;
|
|
32
32
|
export {};
|
|
@@ -16,6 +16,8 @@ import type { RunCorrelation } from '../attempt/types.js';
|
|
|
16
16
|
import type { CaptureHistoryStatus } from '../capture/historyTypes.js';
|
|
17
17
|
import type { CaptureChannelStatus, RecorderCaptureAcknowledgement } from '../capture/nativeCoverage.js';
|
|
18
18
|
import { NativeCapture } from '../capture/nativeCoverage.js';
|
|
19
|
+
import { NativeExtent } from '../capture/nativeExtent/collector.js';
|
|
20
|
+
import type { NativeCaptureExtent } from '../capture/nativeExtent/format.js';
|
|
19
21
|
import type { EngineReadSources, NativeCaptureObservation, SourceLimitation } from '../capture/readSources.js';
|
|
20
22
|
import { EngineReadSourceCapture } from '../capture/readSources.js';
|
|
21
23
|
import type { StageSnapshot } from '../memory/frameTypes.js';
|
|
@@ -67,6 +69,8 @@ export type RuntimeSnapshot = {
|
|
|
67
69
|
readonly runId: string;
|
|
68
70
|
/** Opt-in native observation; root log and current leg only, never durable storage. */
|
|
69
71
|
readonly capture?: NativeCaptureObservation;
|
|
72
|
+
/** Opt-in native work counts; terminal unverified observations never authorize complete capture. */
|
|
73
|
+
readonly captureExtent?: NativeCaptureExtent;
|
|
70
74
|
/** Opt-in ordered native occurrences. Unknown ownership has no record; never infer observed-empty. */
|
|
71
75
|
readonly readSources?: EngineReadSources;
|
|
72
76
|
/**
|
|
@@ -180,7 +184,8 @@ export declare class ExecutionRuntime {
|
|
|
180
184
|
readSources?: EngineReadSourceCapture;
|
|
181
185
|
/** Present only for the current opted-in root leg. Never inherited by a subflow runtime. */
|
|
182
186
|
capture?: NativeCapture;
|
|
183
|
-
|
|
187
|
+
captureExtent?: NativeExtent;
|
|
188
|
+
beginCapture(runId: string, extent?: boolean): NativeCapture;
|
|
184
189
|
/** A reused log cannot be retrofitted or relabelled as the new leg's base. */
|
|
185
190
|
resumeReadSources(runId: string): void;
|
|
186
191
|
captureSnapshot(to: number, control?: CaptureChannelStatus, redact?: boolean): NativeCaptureObservation | undefined;
|
|
@@ -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,
|
|
@@ -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
|
|
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;
|