footprintjs 10.2.1 → 10.4.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.d.ts +7 -0
- package/dist/esm/lib/capture/absentEntries.js +81 -0
- package/dist/esm/lib/capture/checkpointCapture.d.ts +11 -0
- package/dist/esm/lib/capture/checkpointCapture.js +104 -0
- package/dist/esm/lib/capture/historyData.d.ts +9 -0
- package/dist/esm/lib/capture/historyData.js +79 -0
- package/dist/esm/lib/capture/historyNote.d.ts +4 -0
- package/dist/esm/lib/capture/historyNote.js +52 -0
- package/dist/esm/lib/capture/historyTarget.d.ts +5 -0
- package/dist/esm/lib/capture/historyTarget.js +35 -0
- package/dist/esm/lib/capture/historyTypes.d.ts +39 -0
- package/dist/esm/lib/capture/historyTypes.js +4 -0
- package/dist/esm/lib/capture/nativeCoverage.d.ts +69 -0
- package/dist/esm/lib/capture/nativeCoverage.js +140 -0
- package/dist/esm/lib/capture/noteShape.d.ts +10 -0
- package/dist/esm/lib/capture/noteShape.js +93 -0
- package/dist/esm/lib/capture/readSources.d.ts +43 -0
- package/dist/esm/lib/capture/readSources.js +78 -0
- package/dist/esm/lib/engine/handlers/SubflowExecutor.js +5 -2
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +1 -0
- package/dist/esm/lib/engine/types.d.ts +3 -0
- package/dist/esm/lib/engine/types.js +1 -1
- package/dist/esm/lib/memory/StageContext.d.ts +13 -0
- package/dist/esm/lib/memory/StageContext.js +110 -14
- package/dist/esm/lib/memory/attention.d.ts +2 -0
- package/dist/esm/lib/memory/attention.js +12 -5
- package/dist/esm/lib/memory/runPolicy.d.ts +5 -1
- package/dist/esm/lib/memory/runPolicy.js +2 -1
- package/dist/esm/lib/pause/record.js +8 -2
- package/dist/esm/lib/pause/types.d.ts +2 -0
- package/dist/esm/lib/pause/types.js +1 -1
- package/dist/esm/lib/recorder/ControlDepRecorder.d.ts +12 -1
- package/dist/esm/lib/recorder/ControlDepRecorder.js +23 -1
- package/dist/esm/lib/recorder/snapshot.d.ts +1 -1
- package/dist/esm/lib/recorder/snapshot.js +7 -2
- package/dist/esm/lib/runner/ExecutionRuntime.d.ts +24 -1
- package/dist/esm/lib/runner/ExecutionRuntime.js +45 -4
- package/dist/esm/lib/runner/FlowChartExecutor.d.ts +5 -0
- package/dist/esm/lib/runner/FlowChartExecutor.js +74 -7
- package/dist/esm/lib/runner/attach.js +6 -2
- package/dist/esm/lib/runner/captureHistory.d.ts +8 -0
- package/dist/esm/lib/runner/captureHistory.js +106 -0
- package/dist/esm/lib/runner/checkpoint.d.ts +2 -0
- package/dist/esm/lib/runner/checkpoint.js +3 -1
- package/dist/esm/lib/runner/index.d.ts +1 -0
- package/dist/esm/lib/runner/index.js +1 -1
- package/dist/esm/lib/runner/options.d.ts +3 -0
- package/dist/esm/lib/runner/options.js +46 -3
- package/dist/esm/lib/runner/readStoredCapture.d.ts +39 -0
- package/dist/esm/lib/runner/readStoredCapture.js +36 -0
- package/dist/esm/lib/runner/recordSink.d.ts +11 -0
- package/dist/esm/lib/runner/recordSink.js +47 -4
- package/dist/esm/lib/runner/snapshot.d.ts +3 -1
- package/dist/esm/lib/runner/snapshot.js +35 -4
- package/dist/esm/lib/runner/storedCaptureAdmission.d.ts +4 -0
- package/dist/esm/lib/runner/storedCaptureAdmission.js +97 -0
- package/dist/esm/lib/scope/ScopeFacade.js +4 -2
- package/dist/esm/lib/scope/runtime.d.ts +2 -0
- package/dist/esm/lib/scope/runtime.js +9 -1
- package/dist/esm/lib/sinks/fileSink.d.ts +2 -1
- package/dist/esm/lib/sinks/fileSink.js +8 -2
- package/dist/esm/trace.d.ts +2 -0
- package/dist/esm/trace.js +2 -1
- package/dist/index.js +1 -1
- package/dist/lib/capture/absentEntries.js +86 -0
- package/dist/lib/capture/checkpointCapture.js +110 -0
- package/dist/lib/capture/historyData.js +85 -0
- package/dist/lib/capture/historyNote.js +56 -0
- package/dist/lib/capture/historyTarget.js +40 -0
- package/dist/lib/capture/historyTypes.js +7 -0
- package/dist/lib/capture/nativeCoverage.js +146 -0
- package/dist/lib/capture/noteShape.js +103 -0
- package/dist/lib/capture/readSources.js +83 -0
- package/dist/lib/engine/handlers/SubflowExecutor.js +5 -2
- package/dist/lib/engine/types.js +1 -1
- package/dist/lib/memory/StageContext.js +110 -14
- package/dist/lib/memory/attention.js +12 -5
- package/dist/lib/memory/runPolicy.js +2 -1
- package/dist/lib/pause/record.js +8 -2
- package/dist/lib/pause/types.js +1 -1
- package/dist/lib/recorder/ControlDepRecorder.js +23 -1
- package/dist/lib/recorder/snapshot.js +7 -2
- package/dist/lib/runner/ExecutionRuntime.js +44 -3
- package/dist/lib/runner/FlowChartExecutor.js +77 -10
- package/dist/lib/runner/attach.js +5 -1
- package/dist/lib/runner/captureHistory.js +110 -0
- package/dist/lib/runner/checkpoint.js +3 -1
- package/dist/lib/runner/index.js +1 -1
- package/dist/lib/runner/options.js +46 -3
- package/dist/lib/runner/readStoredCapture.js +40 -0
- package/dist/lib/runner/recordSink.js +47 -4
- package/dist/lib/runner/snapshot.js +35 -4
- package/dist/lib/runner/storedCaptureAdmission.js +101 -0
- package/dist/lib/scope/ScopeFacade.js +3 -1
- package/dist/lib/scope/runtime.js +12 -2
- package/dist/lib/sinks/fileSink.js +8 -2
- package/dist/trace.js +4 -2
- package/dist/types/index.d.ts +3 -0
- package/dist/types/lib/capture/absentEntries.d.ts +7 -0
- package/dist/types/lib/capture/checkpointCapture.d.ts +11 -0
- package/dist/types/lib/capture/historyData.d.ts +9 -0
- package/dist/types/lib/capture/historyNote.d.ts +4 -0
- package/dist/types/lib/capture/historyTarget.d.ts +5 -0
- package/dist/types/lib/capture/historyTypes.d.ts +39 -0
- package/dist/types/lib/capture/nativeCoverage.d.ts +69 -0
- package/dist/types/lib/capture/noteShape.d.ts +10 -0
- package/dist/types/lib/capture/readSources.d.ts +43 -0
- package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +1 -0
- package/dist/types/lib/engine/types.d.ts +3 -0
- package/dist/types/lib/memory/StageContext.d.ts +13 -0
- package/dist/types/lib/memory/attention.d.ts +2 -0
- package/dist/types/lib/memory/runPolicy.d.ts +5 -1
- package/dist/types/lib/pause/types.d.ts +2 -0
- package/dist/types/lib/recorder/ControlDepRecorder.d.ts +12 -1
- package/dist/types/lib/recorder/snapshot.d.ts +1 -1
- package/dist/types/lib/runner/ExecutionRuntime.d.ts +24 -1
- package/dist/types/lib/runner/FlowChartExecutor.d.ts +5 -0
- package/dist/types/lib/runner/captureHistory.d.ts +8 -0
- package/dist/types/lib/runner/checkpoint.d.ts +2 -0
- package/dist/types/lib/runner/index.d.ts +1 -0
- package/dist/types/lib/runner/options.d.ts +3 -0
- package/dist/types/lib/runner/readStoredCapture.d.ts +39 -0
- package/dist/types/lib/runner/recordSink.d.ts +11 -0
- package/dist/types/lib/runner/snapshot.d.ts +3 -1
- package/dist/types/lib/runner/storedCaptureAdmission.d.ts +4 -0
- package/dist/types/lib/scope/runtime.d.ts +2 -0
- package/dist/types/lib/sinks/fileSink.d.ts +2 -1
- package/dist/types/trace.d.ts +2 -0
- package/package.json +2 -2
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* its own store when `mirror` is set.
|
|
31
31
|
*/
|
|
32
32
|
import type { CommitValuesMode } from 'foottrace';
|
|
33
|
-
import type { WriteProvenanceMode } from 'foottrace/write';
|
|
33
|
+
import type { ReadSourceLimits, WriteProvenanceMode } from 'foottrace/write';
|
|
34
34
|
import type { ReadTrackingMode, WriteTrackingMode } from './frameTypes.js';
|
|
35
35
|
import type { RedactionRule } from './redaction.js';
|
|
36
36
|
/**
|
|
@@ -38,6 +38,10 @@ import type { RedactionRule } from './redaction.js';
|
|
|
38
38
|
* one is its default. `FlowChartExecutorOptions` extends this interface.
|
|
39
39
|
*/
|
|
40
40
|
export interface RunDials {
|
|
41
|
+
/** Native, bounded scalar read-source occurrences (#113). Default false; memory-only in packet 3. */
|
|
42
|
+
readSources?: boolean | {
|
|
43
|
+
readonly limits: Partial<ReadSourceLimits>;
|
|
44
|
+
};
|
|
41
45
|
/**
|
|
42
46
|
* Policy for `StageSnapshot.stageReads` (#14). Default `'full'` — every
|
|
43
47
|
* tracked read `structuredClone`s the value into the stage's read view
|
|
@@ -267,6 +267,8 @@ export interface PauseResult {
|
|
|
267
267
|
* ```
|
|
268
268
|
*/
|
|
269
269
|
export interface FlowchartCheckpoint {
|
|
270
|
+
/** Paused root-leg observation only. No history/recorder data or storage acknowledgement is included. */
|
|
271
|
+
readonly capture?: import('../capture/readSources.js').NativeCaptureObservation;
|
|
270
272
|
/**
|
|
271
273
|
* The checkpoint FORMAT: `2`, the lean checkpoint (`1` from 9.39.0; absent
|
|
272
274
|
* before). `resume()` reads every older one through the one upcaster
|
|
@@ -89,6 +89,8 @@ export interface ControlDecisionRecord {
|
|
|
89
89
|
ruleLabel?: string;
|
|
90
90
|
}
|
|
91
91
|
export interface ControlDepRecorderOptions {
|
|
92
|
+
/** Opt in to a same-run collection acknowledgement in the snapshot bundle. */
|
|
93
|
+
captureCoverage?: boolean;
|
|
92
94
|
/** Recorder id. Defaults to `control-deps-N` (auto-incremented). */
|
|
93
95
|
id?: string;
|
|
94
96
|
}
|
|
@@ -115,7 +117,11 @@ export declare class ControlDepRecorder implements FlowRecorder {
|
|
|
115
117
|
private readonly consumedSlots;
|
|
116
118
|
/** Convention 4 — runId of the run currently being recorded. */
|
|
117
119
|
private lastRunId?;
|
|
120
|
+
private readonly captureCoverage;
|
|
121
|
+
private captureRunId?;
|
|
122
|
+
private captureIntact;
|
|
118
123
|
constructor(options?: ControlDepRecorderOptions);
|
|
124
|
+
onRunStart(event: import('../engine/narrative/types.js').FlowRunEvent): void;
|
|
119
125
|
onDecision(event: FlowDecisionEvent): void;
|
|
120
126
|
onAttempt(event: FlowAttemptEvent): void;
|
|
121
127
|
onSelected(event: FlowSelectedEvent): void;
|
|
@@ -146,13 +152,18 @@ export declare class ControlDepRecorder implements FlowRecorder {
|
|
|
146
152
|
* Parentless roots cannot have a governing control edge.
|
|
147
153
|
*/
|
|
148
154
|
toSnapshot(): {
|
|
149
|
-
name: string;
|
|
150
155
|
data: {
|
|
151
156
|
decisions: ControlDecisionRecord[];
|
|
152
157
|
controlDeps: {
|
|
153
158
|
[k: string]: ControlDependency;
|
|
154
159
|
};
|
|
155
160
|
};
|
|
161
|
+
capture?: {
|
|
162
|
+
version: 1;
|
|
163
|
+
runId: string;
|
|
164
|
+
control: "captured" | "partial";
|
|
165
|
+
} | undefined;
|
|
166
|
+
name: string;
|
|
156
167
|
};
|
|
157
168
|
/** Reset all state (also happens automatically on runId change). */
|
|
158
169
|
clear(): void;
|
|
@@ -16,4 +16,4 @@ import type { RecorderSnapshot } from '../runner/ExecutionRuntime.js';
|
|
|
16
16
|
/** What `toSnapshot()` returns: a snapshot row without the `id` the attach site owns. */
|
|
17
17
|
export type RecorderBundle = Omit<RecorderSnapshot, 'id'>;
|
|
18
18
|
/** Rebuild `bundle` as the snapshot row for the recorder attached under `id`. */
|
|
19
|
-
export declare function copyBundle(id: string, bundle: RecorderBundle): RecorderSnapshot;
|
|
19
|
+
export declare function copyBundle(id: string, bundle: RecorderBundle, includeCapture?: boolean): RecorderSnapshot;
|
|
@@ -13,6 +13,11 @@ import type { CommitBundle, CommitValuesMode, LogAddress, LogOutcome, Meta } fro
|
|
|
13
13
|
import type { RecordSink, WriteProvenanceMode } from 'foottrace/write';
|
|
14
14
|
import { EventLog, SharedMemory } from 'foottrace/write';
|
|
15
15
|
import type { RunCorrelation } from '../attempt/types.js';
|
|
16
|
+
import type { CaptureHistoryStatus } from '../capture/historyTypes.js';
|
|
17
|
+
import type { CaptureChannelStatus, RecorderCaptureAcknowledgement } from '../capture/nativeCoverage.js';
|
|
18
|
+
import { NativeCapture } from '../capture/nativeCoverage.js';
|
|
19
|
+
import type { EngineReadSources, NativeCaptureObservation, SourceLimitation } from '../capture/readSources.js';
|
|
20
|
+
import { EngineReadSourceCapture } from '../capture/readSources.js';
|
|
16
21
|
import type { StageSnapshot } from '../memory/frameTypes.js';
|
|
17
22
|
import type { RunPolicy } from '../memory/runPolicy.js';
|
|
18
23
|
import { StageContext } from '../memory/StageContext.js';
|
|
@@ -43,6 +48,8 @@ export interface RecorderSnapshot {
|
|
|
43
48
|
* keep the values JSON-safe, since this rides the snapshot out to disk.
|
|
44
49
|
*/
|
|
45
50
|
meta?: Readonly<Record<string, unknown>>;
|
|
51
|
+
/** Optional current-run capture acknowledgement from the recorder contract. */
|
|
52
|
+
capture?: RecorderCaptureAcknowledgement;
|
|
46
53
|
}
|
|
47
54
|
export type RuntimeSnapshot = {
|
|
48
55
|
/**
|
|
@@ -57,6 +64,10 @@ export type RuntimeSnapshot = {
|
|
|
57
64
|
* snapshot carries a DIFFERENT runId than the paused run's snapshot.
|
|
58
65
|
*/
|
|
59
66
|
readonly runId: string;
|
|
67
|
+
/** Opt-in native observation; root log and current leg only, never durable storage. */
|
|
68
|
+
readonly capture?: NativeCaptureObservation;
|
|
69
|
+
/** Opt-in ordered native occurrences. Unknown ownership has no record; never infer observed-empty. */
|
|
70
|
+
readonly readSources?: EngineReadSources;
|
|
60
71
|
/**
|
|
61
72
|
* The run's correlation (10.1) — `env.traceparent`, or `env.traceId` + `env.operationId`, resolved once per
|
|
62
73
|
* leg; the same frozen object every event of the leg carries (`TraversalContext.correlation`, a scope event's
|
|
@@ -140,6 +151,8 @@ export type RuntimeSnapshot = {
|
|
|
140
151
|
};
|
|
141
152
|
/** `getSnapshot().sink` — what the run handed its sink, and what the sink did not take (10.1, P6). */
|
|
142
153
|
export interface RecordSinkStats {
|
|
154
|
+
/** Present only when explicit capture persistence was requested. Never inferred from an ordinary flush. */
|
|
155
|
+
readonly capture?: CaptureHistoryStatus;
|
|
143
156
|
/** Entries handed to the adapter (each `opened`, `commit`, `note`, `closed` call). */
|
|
144
157
|
readonly entries: number;
|
|
145
158
|
/**
|
|
@@ -161,6 +174,13 @@ export interface RuntimeRecord {
|
|
|
161
174
|
readonly meta?: Meta;
|
|
162
175
|
}
|
|
163
176
|
export declare class ExecutionRuntime {
|
|
177
|
+
readSources?: EngineReadSourceCapture;
|
|
178
|
+
/** Present only for the current opted-in root leg. Never inherited by a subflow runtime. */
|
|
179
|
+
capture?: NativeCapture;
|
|
180
|
+
beginCapture(runId: string): NativeCapture;
|
|
181
|
+
/** A reused log cannot be retrofitted or relabelled as the new leg's base. */
|
|
182
|
+
resumeReadSources(runId: string): void;
|
|
183
|
+
captureSnapshot(to: number, control?: CaptureChannelStatus, redact?: boolean): NativeCaptureObservation | undefined;
|
|
164
184
|
globalStore: SharedMemory;
|
|
165
185
|
/**
|
|
166
186
|
* Parallel redacted mirror of `globalStore`. Populated by every commit that
|
|
@@ -192,7 +212,10 @@ export declare class ExecutionRuntime {
|
|
|
192
212
|
* every frame after inherits the same reference. Default: every dial at
|
|
193
213
|
* its default, no rule, no mirror.
|
|
194
214
|
*/
|
|
195
|
-
constructor(rootName: string, rootId: string, defaultValues?: unknown, initialState?: unknown, policy?: RunPolicy, record?: RuntimeRecord
|
|
215
|
+
constructor(rootName: string, rootId: string, defaultValues?: unknown, initialState?: unknown, policy?: RunPolicy, record?: RuntimeRecord, source?: {
|
|
216
|
+
readonly runId: string;
|
|
217
|
+
readonly unavailable?: SourceLimitation;
|
|
218
|
+
});
|
|
196
219
|
/**
|
|
197
220
|
* A fresh root frame for this runtime — `globalStore`, `executionHistory`,
|
|
198
221
|
* the run's policy and (when kept) the mirror. Also how `SubflowExecutor`
|
|
@@ -65,6 +65,8 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
65
65
|
* See docs/guides/execution-model.md.
|
|
66
66
|
*/
|
|
67
67
|
private _isExecuting;
|
|
68
|
+
private captureSignal?;
|
|
69
|
+
private captureHistoryLease?;
|
|
68
70
|
private failureState;
|
|
69
71
|
/** Safe native context for the latest rejected leg; undefined before, during, after success or pause. */
|
|
70
72
|
getFailureContext(): TerminalFailureContext | undefined;
|
|
@@ -188,6 +190,9 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
188
190
|
* the `RecordSinkError`.
|
|
189
191
|
*/
|
|
190
192
|
private settleRecorded;
|
|
193
|
+
private settleRecordedLeg;
|
|
194
|
+
private saveCaptureHistory;
|
|
195
|
+
private finishCapture;
|
|
191
196
|
/**
|
|
192
197
|
* What a new root log opens with: names and numbers the run already serves — the run, the chart, the correlation,
|
|
193
198
|
* the deadline, the declared budget, and the run a fresh-executor resume continues. Served by the record.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionRuntime, RuntimeSnapshot } from './ExecutionRuntime.js';
|
|
2
|
+
import type { RunRecord } from './recordSink.js';
|
|
3
|
+
/** @internal Keeps a timed-out operation leased until its actual settlement. */
|
|
4
|
+
export interface CaptureHistoryLease {
|
|
5
|
+
pending: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** 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>;
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
* DESCRIPTIVE contract error naming the field (`describeCheckpointCloneFailure`)
|
|
37
37
|
* instead of a naked `DataCloneError`.
|
|
38
38
|
*/
|
|
39
|
+
import type { NativeCaptureObservation } from '../capture/readSources.js';
|
|
39
40
|
import type { FlowchartTraverser } from '../engine/traversal/FlowchartTraverser.js';
|
|
40
41
|
import type { FlowchartCheckpoint, PauseSignal, RedactionMarks } from '../pause/types.js';
|
|
41
42
|
/** The paused run's counters, as the executor holds them at the pause. */
|
|
42
43
|
export interface PausedRun {
|
|
44
|
+
readonly capture?: NativeCaptureObservation;
|
|
43
45
|
readonly runId: string;
|
|
44
46
|
readonly executionCount: number;
|
|
45
47
|
readonly visitCounts: ReadonlyMap<string, number>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { CaptureHistoryOptions, CaptureHistoryReceipt, CaptureHistoryStatus, CaptureHistoryTarget, } from '../capture/historyTypes.js';
|
|
1
2
|
export type { ComposableRunner } from './ComposableRunner.js';
|
|
2
3
|
export type { AttachRecorderOptions, ObserverDelivery, ObserverDrainResult, ObserverStats, } from './DeferredObserverTier.js';
|
|
3
4
|
export type { RecorderSnapshot, RecordSinkStats, RuntimeSnapshot } from './ExecutionRuntime.js';
|
|
@@ -59,6 +59,8 @@ export interface FlowChartExecutorOptions<TScope = any> extends RunDials {
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
sink?: RecordSinkOption;
|
|
62
|
+
/** Opt in to a versioned, memory-only root-log capture note on snapshots (#111 stage 1). */
|
|
63
|
+
captureCoverage?: boolean;
|
|
62
64
|
/**
|
|
63
65
|
* Custom error classifier for throttling detection. Return `true` if a fork
|
|
64
66
|
* child's error represents a rate-limit or backpressure condition; the
|
|
@@ -87,6 +89,7 @@ export interface ExecutorArgs<TOut, TScope> {
|
|
|
87
89
|
dials: RunDials;
|
|
88
90
|
/** The record sink, resolved and checked at construction (10.1, P6). */
|
|
89
91
|
sink?: ResolvedRecordSink;
|
|
92
|
+
captureCoverage?: boolean;
|
|
90
93
|
}
|
|
91
94
|
/**
|
|
92
95
|
* Resolve either constructor form. The 2-param form is the options form with
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CommitBundle, StoredRecordLimits } from 'foottrace';
|
|
2
|
+
import type { CaptureHistoryReceipt } from '../capture/historyTypes.js';
|
|
3
|
+
import type { NativeCaptureNote } from '../capture/nativeCoverage.js';
|
|
4
|
+
import type { StageSnapshot } from '../memory/frameTypes.js';
|
|
5
|
+
import type { RecorderSnapshot } from './ExecutionRuntime.js';
|
|
6
|
+
/** Engine history whose storage evidence matched. Channels and native limitations retain their original meanings. */
|
|
7
|
+
export interface StoredCaptureHistory {
|
|
8
|
+
readonly runId: string;
|
|
9
|
+
readonly capture: NativeCaptureNote;
|
|
10
|
+
readonly executionTree: StageSnapshot;
|
|
11
|
+
/**
|
|
12
|
+
* Sorted literal paths of own undefined stageReads/stageWrites entries omitted by JSON.
|
|
13
|
+
* Read alongside executionTree; this is not proof that the underlying state key never existed.
|
|
14
|
+
* At most 4096 paths of 256 segments, within the evidence byte limit. No entries are truncated.
|
|
15
|
+
*/
|
|
16
|
+
readonly absent?: readonly (readonly string[])[];
|
|
17
|
+
readonly recorders?: readonly RecorderSnapshot[];
|
|
18
|
+
readonly commitLog: readonly CommitBundle[];
|
|
19
|
+
readonly initialState?: Record<string, unknown>;
|
|
20
|
+
readonly receipt: CaptureHistoryReceipt;
|
|
21
|
+
}
|
|
22
|
+
export type StoredCaptureResult = {
|
|
23
|
+
readonly status: 'acknowledged';
|
|
24
|
+
readonly history: StoredCaptureHistory;
|
|
25
|
+
} | {
|
|
26
|
+
readonly status: 'unknown';
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
readonly history?: never;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Read authorized stored entries using Foottrace's sequence/gap checks, then validate FootPrint's opaque metadata.
|
|
32
|
+
* A receipt is a host-adapter assertion, not a signature. Callers still own storage authorization and trust.
|
|
33
|
+
* Never performs causal analysis or upgrades partial native capture to complete.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readStoredCapture(entries: Iterable<unknown>, options: {
|
|
36
|
+
runId: string;
|
|
37
|
+
limits?: StoredRecordLimits;
|
|
38
|
+
maxBytes?: number;
|
|
39
|
+
}): Promise<StoredCaptureResult>;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import type { Meta } from 'foottrace';
|
|
25
25
|
import type { RecordSink } from 'foottrace/write';
|
|
26
|
+
import type { CaptureHistoryOptions, CaptureHistoryStatus } from '../capture/historyTypes.js';
|
|
26
27
|
import type { RedactionRule } from '../memory/redaction.js';
|
|
27
28
|
import type { RecordSinkStats } from './ExecutionRuntime.js';
|
|
28
29
|
/** What a lost entry does to the run: `'report'` counts it and goes on; `'fail'` fails the run. */
|
|
@@ -44,6 +45,8 @@ export interface RecordSinkOptions {
|
|
|
44
45
|
readonly onFailure?: RecordSinkFailureMode;
|
|
45
46
|
/** `'auto'` (default): `run()` awaits the adapter's `flush()` after the closing entry. `'manual'`: `flushRecord()`. */
|
|
46
47
|
readonly flush?: RecordSinkFlushMode;
|
|
48
|
+
/** Opt-in capture evidence and explicit host acknowledgement; ordinary flush never implies durability. */
|
|
49
|
+
readonly capture?: CaptureHistoryOptions;
|
|
47
50
|
}
|
|
48
51
|
/** The executor's `sink` option: an adapter, or {@link RecordSinkOptions}. */
|
|
49
52
|
export type RecordSinkOption = RecordSink | RecordSinkOptions;
|
|
@@ -70,6 +73,7 @@ export interface ResolvedRecordSink {
|
|
|
70
73
|
readonly adapter: RecordSink;
|
|
71
74
|
readonly onFailure: RecordSinkFailureMode;
|
|
72
75
|
readonly flush: RecordSinkFlushMode;
|
|
76
|
+
readonly capture?: CaptureHistoryOptions;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Resolve the executor's `sink` option, or refuse it with a `TypeError` naming what is wrong — a wiring mistake
|
|
@@ -92,6 +96,8 @@ export declare class RunRecord {
|
|
|
92
96
|
/** Aborted at the first loss under `'fail'` — composed into the leg's signal; fresh per leg ({@link beginLeg}). */
|
|
93
97
|
private stopper?;
|
|
94
98
|
private failure?;
|
|
99
|
+
private capturePending;
|
|
100
|
+
private captureStatus?;
|
|
95
101
|
/** Opaque error identities only: no raw entry or adapter error is enumerable on the transport error. */
|
|
96
102
|
private readonly invocationFailures;
|
|
97
103
|
constructor(resolved: ResolvedRecordSink);
|
|
@@ -113,6 +119,11 @@ export declare class RunRecord {
|
|
|
113
119
|
/** The loss that fails the run under `'fail'`; absent while nothing was lost (and always under `'report'`). */
|
|
114
120
|
get fatal(): RecordSinkError | undefined;
|
|
115
121
|
stats(): RecordSinkStats;
|
|
122
|
+
get captureOptions(): CaptureHistoryOptions | undefined;
|
|
123
|
+
get pendingCaptureDeliveries(): number;
|
|
124
|
+
captureResult(result: CaptureHistoryStatus): void;
|
|
125
|
+
/** Same served seed as opened; a history digest never sees a seeded policy secret. */
|
|
126
|
+
captureInitialState(state: Record<string, unknown>): Record<string, unknown>;
|
|
116
127
|
/**
|
|
117
128
|
* Await the adapter's `flush()`, at most `timeoutMs` when given. A flush that throws or rejects is a loss
|
|
118
129
|
* (counted, and fatal under `'fail'`); one still running at the deadline is `pending` and keeps running — and,
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* served subflow results (each subflow's own mirror under `redact: true`), one
|
|
6
6
|
* recorder row per recorder id, and the deferred tier's accounting.
|
|
7
7
|
*/
|
|
8
|
+
import type { FlowRecorder } from '../engine/narrative/types.js';
|
|
8
9
|
import type { FlowchartTraverser } from '../engine/traversal/FlowchartTraverser.js';
|
|
10
|
+
import type { ScopeRecorder } from '../scope/types.js';
|
|
9
11
|
import type { RunObservers } from './attach.js';
|
|
10
12
|
import type { RecorderSnapshot, RecordSinkStats, RuntimeSnapshot } from './ExecutionRuntime.js';
|
|
11
13
|
/**
|
|
@@ -38,4 +40,4 @@ export declare function servedSnapshot(traverser: FlowchartTraverser<any, any>,
|
|
|
38
40
|
* recorder cannot smuggle an `id` of its own choosing into the snapshot (the
|
|
39
41
|
* id is the executor's, and consumers index by it).
|
|
40
42
|
*/
|
|
41
|
-
export declare function collectRecorderSnapshots(observers: RunObservers): RecorderSnapshot[];
|
|
43
|
+
export declare function collectRecorderSnapshots(observers: RunObservers, collected?: (recorder: ScopeRecorder | FlowRecorder, row: RecorderSnapshot) => void, includeCapture?: boolean): RecorderSnapshot[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StoredLog } from 'foottrace';
|
|
2
|
+
import type { StoredCaptureResult } from './readStoredCapture.js';
|
|
3
|
+
/** @internal Engine-metadata admission after Foottrace's generic record validation. */
|
|
4
|
+
export declare function admitStoredCapture(log: StoredLog, runId: string, maxBytes: number): Promise<StoredCaptureResult>;
|
|
@@ -49,3 +49,5 @@ export declare function scopeRuntimeFor(scope: unknown): Readonly<ScopeRuntime>
|
|
|
49
49
|
export declare function requireScopeRuntime(scope: unknown, message?: string): Readonly<ScopeRuntime>;
|
|
50
50
|
/** @internal decide()/select() asked outside a stage: name THEM, not the custom-factory migration. */
|
|
51
51
|
export declare function requireDecisionScopeRuntime(scope: unknown): Readonly<ScopeRuntime>;
|
|
52
|
+
export declare function registerNativeCaptureTarget(target: object, context: object): void;
|
|
53
|
+
export declare function hasNativeCaptureTarget(target: object, context: object): boolean;
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
* `readStoredRecord`); for richer values, bring an adapter with a richer encoding.
|
|
43
43
|
*/
|
|
44
44
|
import type { RecordSink } from 'foottrace/write';
|
|
45
|
+
import type { CaptureHistoryOptions } from '../capture/historyTypes.js';
|
|
45
46
|
/** The default cap on a record file: 64 MiB. */
|
|
46
47
|
export declare const DEFAULT_FILE_SINK_MAX_BYTES: number;
|
|
47
48
|
/** The default cap on ONE entry's line: 8 MiB. */
|
|
@@ -69,7 +70,7 @@ export interface FileSinkOptions {
|
|
|
69
70
|
readonly flushTimeoutMs?: number;
|
|
70
71
|
}
|
|
71
72
|
/** A record sink that appends to one file — `RecordSink` plus what the app needs to manage the file. */
|
|
72
|
-
export interface FileSink extends RecordSink {
|
|
73
|
+
export interface FileSink extends RecordSink, Pick<CaptureHistoryOptions, 'acknowledge'> {
|
|
73
74
|
/** The absolute path the sink writes to — resolved once, when it was made. */
|
|
74
75
|
readonly path: string;
|
|
75
76
|
/**
|
package/dist/types/trace.d.ts
CHANGED
|
@@ -21,3 +21,5 @@ export { formatQualityTrace, qualityTrace } from './lib/recorder/qualityTrace.js
|
|
|
21
21
|
export { SequenceStore } from './lib/recorder/SequenceStore.js';
|
|
22
22
|
export type { Topology, TopologyEdge, TopologyIncomingKind, TopologyNode, TopologyNodeKind, TopologyRecorderOptions, } from './lib/recorder/TopologyRecorder.js';
|
|
23
23
|
export { TopologyRecorder, topologyRecorder } from './lib/recorder/TopologyRecorder.js';
|
|
24
|
+
export type { StoredCaptureHistory, StoredCaptureResult } from './lib/runner/readStoredCapture.js';
|
|
25
|
+
export { readStoredCapture } from './lib/runner/readStoredCapture.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "footprintjs",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "Explainable backend flows — automatic causal traces, decision evidence, and MCP tool generation for AI agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sanjay Krishna Anbalagan",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
},
|
|
190
190
|
"sideEffects": false,
|
|
191
191
|
"dependencies": {
|
|
192
|
-
"foottrace": "^1.
|
|
192
|
+
"foottrace": "^1.7.0"
|
|
193
193
|
},
|
|
194
194
|
"peerDependencies": {
|
|
195
195
|
"zod": "^3.0.0 || ^4.0.0"
|