footprintjs 14.3.0 → 14.5.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/AGENTS.md +2 -1
- package/dist/esm/lib/capture/explainCoverage.d.ts +2 -0
- package/dist/esm/lib/capture/explainCoverage.js +1 -1
- package/dist/esm/lib/capture/explainWitness.js +5 -3
- package/dist/esm/lib/engine/graph/detachTopology.d.ts +12 -0
- package/dist/esm/lib/engine/graph/detachTopology.js +93 -0
- package/dist/esm/lib/engine/graph/skippedProjection.d.ts +46 -0
- package/dist/esm/lib/engine/graph/skippedProjection.js +336 -0
- package/dist/esm/lib/engine/handlers/ContinuationResolver.js +5 -1
- package/dist/esm/lib/engine/handlers/DeciderHandler.js +16 -20
- package/dist/esm/lib/engine/handlers/SelectorHandler.js +27 -27
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.d.ts +3 -4
- package/dist/esm/lib/engine/traversal/FlowchartTraverser.js +6 -3
- package/dist/esm/lib/engine/types.d.ts +5 -0
- package/dist/esm/lib/engine/types.js +1 -1
- package/dist/esm/lib/filter/firstMatch.d.ts +1 -4
- package/dist/esm/lib/filter/firstMatch.js +51 -7
- package/dist/esm/lib/memory/StageContext.js +8 -2
- package/dist/esm/lib/memory/storedControlEvidence.d.ts +23 -0
- package/dist/esm/lib/memory/storedControlEvidence.js +110 -0
- package/dist/esm/lib/memory/storedControlLifecycle.d.ts +30 -0
- package/dist/esm/lib/memory/storedControlLifecycle.js +8 -0
- package/dist/esm/lib/runner/ExecutionRuntime.d.ts +4 -1
- package/dist/esm/lib/runner/ExecutionRuntime.js +2 -1
- package/dist/esm/lib/runner/FlowChartExecutor.d.ts +4 -4
- package/dist/esm/lib/runner/FlowChartExecutor.js +32 -14
- package/dist/esm/lib/runner/NativeRunAdapter.d.ts +2 -4
- package/dist/esm/lib/runner/NativeRunAdapter.js +1 -1
- package/dist/esm/lib/runner/NativeRunLifecycle.js +1 -1
- package/dist/esm/lib/runner/RunLifecycle.d.ts +3 -7
- package/dist/esm/lib/runner/RunLifecycle.js +1 -1
- package/dist/esm/lib/runner/options.d.ts +12 -1
- package/dist/esm/lib/runner/options.js +1 -1
- package/dist/esm/lib/runner/recordSink.d.ts +3 -2
- package/dist/esm/lib/runner/recordSink.js +5 -2
- package/dist/esm/lib/runner/snapshot.d.ts +2 -3
- package/dist/esm/lib/runner/snapshot.js +1 -1
- package/dist/esm/skipped-writer-capture.d.ts +4 -0
- package/dist/esm/skipped-writer-capture.js +171 -0
- package/dist/esm/skipped-writer-state.d.ts +35 -0
- package/dist/esm/skipped-writer-state.js +7 -0
- package/dist/esm/skipped-writers.d.ts +18 -0
- package/dist/esm/skipped-writers.js +60 -0
- package/dist/lib/capture/explainCoverage.js +1 -1
- package/dist/lib/capture/explainWitness.js +5 -3
- package/dist/lib/engine/graph/detachTopology.js +97 -0
- package/dist/lib/engine/graph/skippedProjection.js +340 -0
- package/dist/lib/engine/handlers/ContinuationResolver.js +5 -1
- package/dist/lib/engine/handlers/DeciderHandler.js +16 -20
- package/dist/lib/engine/handlers/SelectorHandler.js +27 -27
- package/dist/lib/engine/traversal/FlowchartTraverser.js +6 -3
- package/dist/lib/engine/types.js +1 -1
- package/dist/lib/filter/firstMatch.js +51 -7
- package/dist/lib/memory/StageContext.js +8 -2
- package/dist/lib/memory/storedControlEvidence.js +121 -0
- package/dist/lib/memory/storedControlLifecycle.js +13 -0
- package/dist/lib/runner/ExecutionRuntime.js +2 -1
- package/dist/lib/runner/FlowChartExecutor.js +32 -14
- package/dist/lib/runner/NativeRunAdapter.js +1 -1
- package/dist/lib/runner/NativeRunLifecycle.js +1 -1
- package/dist/lib/runner/RunLifecycle.js +1 -1
- package/dist/lib/runner/options.js +1 -1
- package/dist/lib/runner/recordSink.js +5 -2
- package/dist/lib/runner/snapshot.js +1 -1
- package/dist/skipped-writer-capture.js +175 -0
- package/dist/skipped-writer-state.js +11 -0
- package/dist/skipped-writers.js +88 -0
- package/dist/types/lib/capture/explainCoverage.d.ts +2 -0
- package/dist/types/lib/engine/graph/detachTopology.d.ts +12 -0
- package/dist/types/lib/engine/graph/skippedProjection.d.ts +46 -0
- package/dist/types/lib/engine/traversal/FlowchartTraverser.d.ts +3 -4
- package/dist/types/lib/engine/types.d.ts +5 -0
- package/dist/types/lib/filter/firstMatch.d.ts +1 -4
- package/dist/types/lib/memory/storedControlEvidence.d.ts +23 -0
- package/dist/types/lib/memory/storedControlLifecycle.d.ts +30 -0
- package/dist/types/lib/runner/ExecutionRuntime.d.ts +4 -1
- package/dist/types/lib/runner/FlowChartExecutor.d.ts +4 -4
- package/dist/types/lib/runner/NativeRunAdapter.d.ts +2 -4
- package/dist/types/lib/runner/RunLifecycle.d.ts +3 -7
- package/dist/types/lib/runner/options.d.ts +12 -1
- package/dist/types/lib/runner/recordSink.d.ts +3 -2
- package/dist/types/lib/runner/snapshot.d.ts +2 -3
- package/dist/types/skipped-writer-capture.d.ts +4 -0
- package/dist/types/skipped-writer-state.d.ts +35 -0
- package/dist/types/skipped-writers.d.ts +18 -0
- package/package.json +15 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.skippedWriterCaptureOptions = exports.declareSkippedWriterPaths = exports.readSkippedWriters = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Skipped writers. Query evidence on an exact live FootPrint capture.
|
|
29
|
+
*
|
|
30
|
+
* @module footprintjs/skipped-writers
|
|
31
|
+
*/
|
|
32
|
+
const explainWitness_js_1 = require("./lib/capture/explainWitness.js");
|
|
33
|
+
const skipped_writer_state_js_1 = require("./skipped-writer-state.js");
|
|
34
|
+
let optionalEvaluator;
|
|
35
|
+
function evaluator() {
|
|
36
|
+
return (optionalEvaluator ??= Promise.resolve().then(() => __importStar(require('foottrace/cause'))).then((reader) => {
|
|
37
|
+
const capability = reader;
|
|
38
|
+
const { evaluateSkippedPaths, savedChartDigest } = capability;
|
|
39
|
+
if (typeof evaluateSkippedPaths !== 'function')
|
|
40
|
+
return undefined;
|
|
41
|
+
return {
|
|
42
|
+
evaluateSkippedPaths,
|
|
43
|
+
savedChartDigest: typeof savedChartDigest === 'function' ? savedChartDigest : undefined,
|
|
44
|
+
};
|
|
45
|
+
})
|
|
46
|
+
.catch(() => undefined));
|
|
47
|
+
}
|
|
48
|
+
const declarations = new WeakMap();
|
|
49
|
+
function unavailable(gap) {
|
|
50
|
+
return { candidates: [], gaps: [gap] };
|
|
51
|
+
}
|
|
52
|
+
/** Only an exact served snapshot can supply the native chart and retained writer entries. */
|
|
53
|
+
async function readSkippedWriters(snapshot, key, beforeIdx) {
|
|
54
|
+
const capability = await evaluator();
|
|
55
|
+
if (!capability)
|
|
56
|
+
return unavailable('not-collected');
|
|
57
|
+
const capture = skipped_writer_state_js_1.liveCaptures.get(snapshot);
|
|
58
|
+
if (!capture) {
|
|
59
|
+
const witness = (0, explainWitness_js_1.captureWitnessOf)(snapshot);
|
|
60
|
+
return unavailable(witness?.boundary === 'completed' && witness.commits.from > 0 ? 'not-collected' : 'chart-binding');
|
|
61
|
+
}
|
|
62
|
+
if (capture.gap)
|
|
63
|
+
return unavailable(capture.gap);
|
|
64
|
+
const result = capability.evaluateSkippedPaths(capture.rows.map((row) => JSON.parse(row)), key, beforeIdx, capture.evidence);
|
|
65
|
+
return {
|
|
66
|
+
candidates: result.candidates.map((candidate) => ({ ...candidate, binding: 'native' })),
|
|
67
|
+
gaps: result.gaps,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.readSkippedWriters = readSkippedWriters;
|
|
71
|
+
/** Declare the exhaustive write paths for an exact authored stage placement. */
|
|
72
|
+
function declareSkippedWriterPaths(placement, paths) {
|
|
73
|
+
declarations.set(placement, Object.freeze([...paths]));
|
|
74
|
+
}
|
|
75
|
+
exports.declareSkippedWriterPaths = declareSkippedWriterPaths;
|
|
76
|
+
/**
|
|
77
|
+
* Enable bounded skipped-writer capture when the installed Foottrace supplies the evaluator.
|
|
78
|
+
* Use the returned options with a same-instance executor configured with a record sink.
|
|
79
|
+
*/
|
|
80
|
+
async function skippedWriterCaptureOptions(options = {}) {
|
|
81
|
+
const capability = await evaluator();
|
|
82
|
+
if (!capability)
|
|
83
|
+
return options;
|
|
84
|
+
const { configureSkippedWriterCapture } = await Promise.resolve().then(() => __importStar(require('./skipped-writer-capture.js')));
|
|
85
|
+
return configureSkippedWriterCapture(options, capability, (placement) => declarations.get(placement), (snapshot, capture) => skipped_writer_state_js_1.liveCaptures.set(snapshot, capture));
|
|
86
|
+
}
|
|
87
|
+
exports.skippedWriterCaptureOptions = skippedWriterCaptureOptions;
|
|
88
|
+
//# sourceMapping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BsaXZlQ2FwdHVyZXMuc2V0KHNuYXBzaG90LCBjYXB0dXJlKSxcbiAgKTtcbn1cbiJdfQ==
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LogAddress } from 'foottrace';
|
|
2
|
+
import type { ExplainCaptureWitness } from './explainWitness.js';
|
|
2
3
|
import type { CaptureChannelStatus, NativeCaptureNote } from './nativeCoverage.js';
|
|
3
4
|
import type { EngineReadSources } from './readSources.js';
|
|
4
5
|
import type { FanoutCollections } from './subflowHandoff.js';
|
|
@@ -40,6 +41,7 @@ export declare function createExplainCapture(switches: Switches): ExplainCapture
|
|
|
40
41
|
/** @internal Bounded fixed-vocabulary facts, accumulated at the native owners of this log. */
|
|
41
42
|
export declare class ExplainCapture {
|
|
42
43
|
private readonly switches;
|
|
44
|
+
onWitness?: (record: object, witness: ExplainCaptureWitness) => void;
|
|
43
45
|
private readonly observations;
|
|
44
46
|
private readonly observedHandoffs;
|
|
45
47
|
private untrackedNestedRead;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StageNode } from './StageNode.js';
|
|
2
|
+
export interface DetachedStageTopology<TOut, TScope> {
|
|
3
|
+
readonly root: StageNode<TOut, TScope>;
|
|
4
|
+
detachedOf(authored: object): StageNode<TOut, TScope> | undefined;
|
|
5
|
+
authoredOf(detached: object): StageNode<TOut, TScope> | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A private immutable topology for a captured leg. Shared placements remain shared.
|
|
9
|
+
* Functions and operational configuration keep their references. Author-owned
|
|
10
|
+
* declarations can be read through the original placement while building the projection.
|
|
11
|
+
*/
|
|
12
|
+
export declare function detachStageTopology<TOut, TScope>(root: StageNode<TOut, TScope>, work?: number): DetachedStageTopology<TOut, TScope> | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { StageNode } from './StageNode.js';
|
|
2
|
+
type Role = 'stage' | 'mount' | 'loop-reference' | 'join';
|
|
3
|
+
type ControlKind = 'decider' | 'selector';
|
|
4
|
+
type ProjectionGap = 'graph-ambiguous' | 'truncated';
|
|
5
|
+
interface Choice {
|
|
6
|
+
readonly entry: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly fallback?: true;
|
|
9
|
+
readonly loopBack?: {
|
|
10
|
+
readonly body: string;
|
|
11
|
+
readonly exit: string;
|
|
12
|
+
readonly owner: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** The version-1 Foottrace chart description. No stage function is carried. */
|
|
16
|
+
export interface SkippedChartProjection {
|
|
17
|
+
readonly stages: readonly {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly stageId: string;
|
|
20
|
+
readonly role: Role;
|
|
21
|
+
readonly edges: readonly string[];
|
|
22
|
+
readonly writes?: readonly string[];
|
|
23
|
+
}[];
|
|
24
|
+
readonly controls: readonly {
|
|
25
|
+
readonly placementId: string;
|
|
26
|
+
readonly kind: ControlKind;
|
|
27
|
+
readonly choices: readonly Choice[];
|
|
28
|
+
readonly continuation: string | null;
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
export interface SkippedProjectionOptions {
|
|
32
|
+
/** Exhaustive paths for this exact placement, with undefined indicating no declaration. */
|
|
33
|
+
readonly writesOf?: (placement: StageNode) => readonly string[] | undefined;
|
|
34
|
+
/** Resolve a stage's function from the same stage map as the traverser, without invoking it. */
|
|
35
|
+
readonly hasStageFunction?: (placement: StageNode) => boolean;
|
|
36
|
+
readonly work?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Project only the static scope. A producer must separately verify it against the traversed run. */
|
|
39
|
+
export declare function projectSkippedChart(root: StageNode, options?: SkippedProjectionOptions): {
|
|
40
|
+
readonly status: 'ready';
|
|
41
|
+
readonly graph: SkippedChartProjection;
|
|
42
|
+
} | {
|
|
43
|
+
readonly status: 'unknown';
|
|
44
|
+
readonly reason: ProjectionGap;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -32,7 +32,7 @@ import type { ScopeProtectionMode } from '../../scope/protection/types.js';
|
|
|
32
32
|
import type { QueuedPause, ResumeEntry } from '../handlers/ResumeEntry.js';
|
|
33
33
|
import { FlowRecorderDispatcher } from '../narrative/FlowRecorderDispatcher.js';
|
|
34
34
|
import type { FlowRecorder, IControlFlowNarrative } from '../narrative/types.js';
|
|
35
|
-
import type { IExecutionRuntime, ILogger, ReturnedSubflowDefinition, ScopeFactory, Selector, SerializedPipelineStructure, StageFunction, StageNode, StreamHandlers, SubflowMountOptions, SubflowResult, TraversalResult } from '../types.js';
|
|
35
|
+
import type { IExecutionRuntime, ILogger, ReturnedSubflowDefinition, ScopeFactory, Selector, SerializedPipelineStructure, SnapshotOptions, StageFunction, StageNode, StreamHandlers, SubflowMountOptions, SubflowResult, TraversalResult } from '../types.js';
|
|
36
36
|
export interface TraverserOptions<TOut = any, TScope = any> {
|
|
37
37
|
/**
|
|
38
38
|
* The graph this traverser walks — and the graph every id resolves against
|
|
@@ -350,10 +350,9 @@ export declare class FlowchartTraverser<TOut = any, TScope = any> {
|
|
|
350
350
|
reason?: string;
|
|
351
351
|
};
|
|
352
352
|
getRuntimeStructure(): SerializedPipelineStructure | undefined;
|
|
353
|
-
getSnapshot(options?: {
|
|
354
|
-
redact?: boolean;
|
|
355
|
-
}): {
|
|
353
|
+
getSnapshot(options?: SnapshotOptions): {
|
|
356
354
|
correlation?: RunCorrelation | undefined;
|
|
355
|
+
resumePrefixGap?: "resume-prefix-unavailable" | undefined;
|
|
357
356
|
runId: string;
|
|
358
357
|
sharedState: Record<string, unknown>;
|
|
359
358
|
executionTree: unknown;
|
|
@@ -369,6 +369,11 @@ export interface SubflowTraverserHandle<TOut = any, TScope = any> {
|
|
|
369
369
|
reason?: string;
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
|
+
export interface SnapshotOptions {
|
|
373
|
+
redact?: boolean;
|
|
374
|
+
/** Include any gap in the resumed traversal's child settlement history. */
|
|
375
|
+
resumePrefix?: boolean;
|
|
376
|
+
}
|
|
372
377
|
/**
|
|
373
378
|
* IExecutionRuntime — Interface for the runtime environment.
|
|
374
379
|
*
|
|
@@ -64,10 +64,7 @@ interface RuleHead {
|
|
|
64
64
|
readonly then: string;
|
|
65
65
|
readonly label?: string;
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
* A function rule's row. `matched` is `!!returned`: whether the rule's return was truthy, which is all that routes a
|
|
69
|
-
* decision. The return itself is never stored, so a rule that returns a value (`(f) => f.token`) leaves no value here.
|
|
70
|
-
*/
|
|
67
|
+
/** A function rule's row. Only synchronous return truthiness routes a decision. */
|
|
71
68
|
export declare function functionRow(rule: RuleHead, index: number, returned: unknown, inputs: ReadInput[], matchError: string | undefined): FunctionRuleEvidence;
|
|
72
69
|
/** A filter rule's row. */
|
|
73
70
|
export declare function filterRow(rule: RuleHead, index: number, matched: boolean, conditions: FilterCondition[], matchError: string | undefined): FilterRuleEvidence;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CommitAbout, EventLog, RunDecisionNote } from 'foottrace/write';
|
|
2
|
+
import { type StoredControlLifecycle } from './storedControlLifecycle.js';
|
|
3
|
+
interface ControlExecution {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly parent?: string;
|
|
6
|
+
readonly resumes?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Private producer state. An unresolved dispatch cannot certify a served recording's chart. */
|
|
9
|
+
export declare function canBindStoredControl(log: EventLog): boolean;
|
|
10
|
+
/** Install once on the opted-in native log. An ordinary writer stays on its existing path. */
|
|
11
|
+
export declare function installStoredControl(log: EventLog, seal?: StoredControlLifecycle['seal']): void;
|
|
12
|
+
/** Bind the native identity at entry. An ordinary log creates no frame evidence. */
|
|
13
|
+
export declare function beginStoredControl(frame: object, log: EventLog, execution: ControlExecution): void;
|
|
14
|
+
/** The first substantive bundle owns ancestry, including an explicit empty root stamp. */
|
|
15
|
+
export declare function storedControlAbout(frame: object): CommitAbout | undefined;
|
|
16
|
+
export declare function storedControlLanded(frame: object): void;
|
|
17
|
+
/** A native entry without an owning bundle can supply its edge, but no settled choice. */
|
|
18
|
+
export declare function noteStoredControlStage(frame: object): void;
|
|
19
|
+
/** Only an admitted, actually dispatched choice follows the owning commit. */
|
|
20
|
+
export declare function noteStoredControlDecision(frame: object, decision: Omit<RunDecisionNote, 'id'>): void;
|
|
21
|
+
/** The exact resolved static target is known before the next execution begins. */
|
|
22
|
+
export declare function noteStoredControlLoop(frame: object, target: string): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta } from 'foottrace';
|
|
2
|
+
import type { CommitAbout, EventLog } from 'foottrace/write';
|
|
3
|
+
import type { StageContext } from './StageContext.js';
|
|
4
|
+
/** The stage lifecycle seam. The optional producer owns all evidence storage and validation. */
|
|
5
|
+
export interface StoredControlLifecycle {
|
|
6
|
+
begin(frame: {
|
|
7
|
+
readonly parent?: {
|
|
8
|
+
readonly runtimeStageId: string;
|
|
9
|
+
};
|
|
10
|
+
}, id: string, parentLog?: EventLog): void;
|
|
11
|
+
about(frame: object): CommitAbout | undefined;
|
|
12
|
+
landed(frame: object): void;
|
|
13
|
+
dynamic(): void;
|
|
14
|
+
seal?(runId: string): Promise<{
|
|
15
|
+
readonly skippedChart: Meta;
|
|
16
|
+
} | undefined>;
|
|
17
|
+
decision(frame: StageContext, children: readonly {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
}[], chosen: string, fellBack: boolean, fromRules: boolean): void;
|
|
20
|
+
selection(frame: StageContext, children: readonly {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
}[], chosen: readonly string[]): void;
|
|
23
|
+
loop(frame: StageContext, source: {
|
|
24
|
+
readonly next?: {
|
|
25
|
+
readonly isLoopRef?: boolean;
|
|
26
|
+
};
|
|
27
|
+
}, reference: object | string, target: string): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function registerStoredControl(owner: object, lifecycle: StoredControlLifecycle): void;
|
|
30
|
+
export declare function storedControlFor(owner: object | undefined): StoredControlLifecycle | undefined;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* After execution, consumers query it for the full execution state.
|
|
11
11
|
*/
|
|
12
12
|
import type { CommitBundle, CommitValuesMode, LogAddress, LogOutcome, Meta } from 'foottrace';
|
|
13
|
-
import type { RecordSink, WriteProvenanceMode } from 'foottrace/write';
|
|
13
|
+
import type { LogCollects, RecordSink, WriteProvenanceMode } from 'foottrace/write';
|
|
14
14
|
import { EventLog, SharedMemory } from 'foottrace/write';
|
|
15
15
|
import type { RunCorrelation } from '../attempt/types.js';
|
|
16
16
|
import type { ExplainCapture, ExplainCaptureFactory, ExplainCaptureNote } from '../capture/explainCoverage.js';
|
|
@@ -58,6 +58,8 @@ export interface RecorderSnapshot {
|
|
|
58
58
|
capture?: RecorderCaptureAcknowledgement;
|
|
59
59
|
}
|
|
60
60
|
export type RuntimeSnapshot = {
|
|
61
|
+
/** Present only when resume-prefix evidence was requested on a resumed traversal. */
|
|
62
|
+
readonly resumePrefixGap?: 'resume-prefix-unavailable';
|
|
61
63
|
/**
|
|
62
64
|
* The run this snapshot belongs to — the same `runId` stamped on every
|
|
63
65
|
* `TraversalContext` (and thus every recorder event) of the run, so a
|
|
@@ -167,6 +169,7 @@ export interface RuntimeRecord {
|
|
|
167
169
|
readonly sink: RecordSink;
|
|
168
170
|
readonly address: LogAddress;
|
|
169
171
|
readonly meta?: Meta;
|
|
172
|
+
readonly collects?: Pick<LogCollects, 'reads'>;
|
|
170
173
|
}
|
|
171
174
|
export declare class ExecutionRuntime {
|
|
172
175
|
/** Installed only for explicit handoff capture. It is not the app's persistence sink. */
|
|
@@ -27,7 +27,7 @@ import type { CombinedNarrativeRecorderOptions } from '../engine/narrative/Combi
|
|
|
27
27
|
import type { CombinedNarrativeEntry } from '../engine/narrative/narrativeTypes.js';
|
|
28
28
|
import type { ManifestEntry } from '../engine/narrative/recorders/ManifestFlowRecorder.js';
|
|
29
29
|
import type { FlowRecorder } from '../engine/narrative/types.js';
|
|
30
|
-
import { type ExecutorResult, type RunOptions, type ScopeFactory, type SerializedPipelineStructure, type StageNode, type SubflowResult } from '../engine/types.js';
|
|
30
|
+
import { type ExecutorResult, type RunOptions, type ScopeFactory, type SerializedPipelineStructure, type SnapshotOptions, type StageNode, type SubflowResult } from '../engine/types.js';
|
|
31
31
|
import { type TerminalFailureContext } from '../errors/terminalFailure.js';
|
|
32
32
|
import type { ReadTrackingMode, WriteTrackingMode } from '../memory/frameTypes.js';
|
|
33
33
|
import type { FlowchartCheckpoint } from '../pause/types.js';
|
|
@@ -54,6 +54,7 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
54
54
|
/** The run's ONE redaction rule (`memory/redaction.ts`), built fresh per leg. */
|
|
55
55
|
private redactionRule;
|
|
56
56
|
private lastCheckpoint;
|
|
57
|
+
private storedControl?;
|
|
57
58
|
/**
|
|
58
59
|
* `true` once run() (or a resume) executed here. `resume()` branches on it:
|
|
59
60
|
* true → reuse the runtime (execution tree, recorders, narrative accumulate);
|
|
@@ -363,13 +364,12 @@ export declare class FlowChartExecutor<TOut = any, TScope = any> {
|
|
|
363
364
|
* `globalContext`) from the redacted mirror — the safe view to export. A
|
|
364
365
|
* no-op without a redaction policy. The commit log is redacted at write
|
|
365
366
|
* time regardless. Default `false`.
|
|
367
|
+
* @param options.resumePrefix `true` exposes missing pre-resume child settlement history.
|
|
366
368
|
*
|
|
367
369
|
* **Treat `sharedState` as READ-ONLY.** In production it is a live view of
|
|
368
370
|
* engine memory; in dev mode a deep-frozen clone, so a mutation throws.
|
|
369
371
|
*/
|
|
370
|
-
getSnapshot(options?:
|
|
371
|
-
redact?: boolean;
|
|
372
|
-
}): RuntimeSnapshot;
|
|
372
|
+
getSnapshot(options?: SnapshotOptions): RuntimeSnapshot;
|
|
373
373
|
/** @internal */
|
|
374
374
|
getRuntime(): import("../engine/types.js").IExecutionRuntime;
|
|
375
375
|
/** @internal */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FlowChart } from '../builder/types.js';
|
|
2
|
-
import { type ExecutorResult, type RunOptions } from '../engine/types.js';
|
|
2
|
+
import { type ExecutorResult, type RunOptions, type SnapshotOptions } from '../engine/types.js';
|
|
3
3
|
import type { RunBanks, RunFrame } from '../memory/RunFrame.js';
|
|
4
4
|
import type { FlowchartCheckpoint } from '../pause/types.js';
|
|
5
5
|
import type { FinalizationBook } from '../recorder/FinalizationBook.js';
|
|
@@ -30,9 +30,7 @@ export declare class NativeRunAdapter {
|
|
|
30
30
|
constructor(chart: FlowChart, options?: FlowChartExecutorOptions);
|
|
31
31
|
execute(entry: NativeEntry, setup: RunSetup | undefined, admission: NativeAdmission): Promise<ExecutorResult>;
|
|
32
32
|
ready(frame: RunFrame | undefined): boolean;
|
|
33
|
-
snapshot(frame: RunFrame | undefined, options?:
|
|
34
|
-
redact?: boolean;
|
|
35
|
-
}): import("./ExecutionRuntime.js").RuntimeSnapshot | undefined;
|
|
33
|
+
snapshot(frame: RunFrame | undefined, options?: SnapshotOptions): import("./ExecutionRuntime.js").RuntimeSnapshot | undefined;
|
|
36
34
|
narrative(frame: RunFrame | undefined): import("../engine/index.js").CombinedNarrativeEntry[];
|
|
37
35
|
commits(frame: RunFrame | undefined): number;
|
|
38
36
|
paused(frame: RunFrame | undefined): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CombinedNarrativeRecorderOptions } from '../engine/narrative/CombinedNarrativeRecorder.js';
|
|
2
2
|
import type { CombinedNarrativeEntry } from '../engine/narrative/narrativeTypes.js';
|
|
3
|
-
import type { ExecutorResult, RunOptions } from '../engine/types.js';
|
|
3
|
+
import type { ExecutorResult, RunOptions, SnapshotOptions } from '../engine/types.js';
|
|
4
4
|
import type { NativeComponentEntry, NativeRunOrigin } from '../memory/RunFrame.js';
|
|
5
5
|
import type { FlowchartCheckpoint } from '../pause/types.js';
|
|
6
6
|
import type { CombinedRecorder } from '../recorder/CombinedRecorder.js';
|
|
@@ -97,18 +97,14 @@ export interface OwnedRun extends RunCells {
|
|
|
97
97
|
* the run paused. Afterwards `execute` and `onFinalize` refuse; `withRun` finalizes nothing again.
|
|
98
98
|
*/
|
|
99
99
|
finish(): Promise<void>;
|
|
100
|
-
snapshot(options?:
|
|
101
|
-
redact?: boolean;
|
|
102
|
-
}): RuntimeSnapshot | undefined;
|
|
100
|
+
snapshot(options?: SnapshotOptions): RuntimeSnapshot | undefined;
|
|
103
101
|
}
|
|
104
102
|
export type RunPhase = 'preparing' | 'executing' | 'postprocessing' | 'settled';
|
|
105
103
|
/** Captures one execution; methods refuse after its executor begins another native leg. */
|
|
106
104
|
export interface RunView {
|
|
107
105
|
readonly phase: RunPhase;
|
|
108
106
|
readonly origin: NativeRunOrigin | undefined;
|
|
109
|
-
snapshot(options?:
|
|
110
|
-
redact?: boolean;
|
|
111
|
-
}): RuntimeSnapshot | undefined;
|
|
107
|
+
snapshot(options?: SnapshotOptions): RuntimeSnapshot | undefined;
|
|
112
108
|
getNarrativeEntries(): readonly CombinedNarrativeEntry[];
|
|
113
109
|
getCommitCount(): number;
|
|
114
110
|
isPaused(): boolean;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* bare `ScopeFactory`) into the `ExecutorArgs` the executor keeps for every leg.
|
|
7
7
|
*/
|
|
8
8
|
import type { Meta } from 'foottrace';
|
|
9
|
+
import type { RecordEntry } from 'foottrace/write';
|
|
9
10
|
import type { RunCorrelation } from '../attempt/types.js';
|
|
10
11
|
import type { FlowChart } from '../builder/types.js';
|
|
11
12
|
import type { ExplainCaptureFactory } from '../capture/explainCoverage.js';
|
|
@@ -102,10 +103,19 @@ export interface ExecutorArgs<TOut, TScope> {
|
|
|
102
103
|
/** The record sink, resolved and checked at construction (10.1, P6). */
|
|
103
104
|
sink?: ResolvedRecordSink;
|
|
104
105
|
captureCoverage?: boolean;
|
|
105
|
-
explainCapture?: ExplainCaptureFactory
|
|
106
|
+
explainCapture?: ExplainCaptureFactory & {
|
|
107
|
+
prepareStoredControl?(chart: FlowChart<TOut, TScope>): PreparedStoredControl<TOut, TScope> | undefined;
|
|
108
|
+
};
|
|
106
109
|
captureExtent?: boolean;
|
|
107
110
|
captureClosure?: boolean;
|
|
108
111
|
}
|
|
112
|
+
/** Private result prepared by the optional producer before host callbacks. */
|
|
113
|
+
export interface PreparedStoredControl<TOut, TScope> {
|
|
114
|
+
readonly root: FlowChart<TOut, TScope>['root'];
|
|
115
|
+
readonly stageMap: FlowChart<TOut, TScope>['stageMap'];
|
|
116
|
+
retain(entry: RecordEntry): void;
|
|
117
|
+
attach(runtime: ExecutionRuntime): void;
|
|
118
|
+
}
|
|
109
119
|
/**
|
|
110
120
|
* Resolve either constructor form. The 2-param form is the options form with
|
|
111
121
|
* only `scopeFactory`; the scope factory falls back to the chart's, then to a
|
|
@@ -114,6 +124,7 @@ export interface ExecutorArgs<TOut, TScope> {
|
|
|
114
124
|
export declare function resolveExecutorArgs<TOut, TScope>(flowChart: FlowChart<TOut, TScope>, factoryOrOptions: ScopeFactory<TScope> | FlowChartExecutorOptions<TScope> | undefined): ExecutorArgs<TOut, TScope>;
|
|
115
125
|
/** @internal Construction-only overrides for a native traversal leg; never an application option. */
|
|
116
126
|
export interface TraverserOverrides<TOut = any, TScope = any> {
|
|
127
|
+
storedControl?: PreparedStoredControl<TOut, TScope>;
|
|
117
128
|
initialContext?: unknown;
|
|
118
129
|
preserveRecorders?: boolean;
|
|
119
130
|
existingRuntime?: InstanceType<typeof ExecutionRuntime>;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* log's to count (`EventLog · sinkFailures`), never the run's — so nothing here throws to the engine.
|
|
23
23
|
*/
|
|
24
24
|
import type { Meta } from 'foottrace';
|
|
25
|
-
import type { RecordSink } from 'foottrace/write';
|
|
25
|
+
import type { RecordEntry, RecordSink } from 'foottrace/write';
|
|
26
26
|
import type { CaptureHistoryOptions, CaptureHistoryStatus } from '../capture/historyTypes.js';
|
|
27
27
|
import type { RedactionRule } from '../memory/redaction.js';
|
|
28
28
|
import type { RecordSinkStats } from './ExecutionRuntime.js';
|
|
@@ -86,6 +86,7 @@ export declare function resolveRecordSink(option: unknown): ResolvedRecordSink |
|
|
|
86
86
|
*/
|
|
87
87
|
export declare class RunRecord {
|
|
88
88
|
private readonly resolved;
|
|
89
|
+
private readonly retain?;
|
|
89
90
|
/** Hand this to every `EventLog` of the run. */
|
|
90
91
|
readonly sink: RecordSink;
|
|
91
92
|
private entries;
|
|
@@ -100,7 +101,7 @@ export declare class RunRecord {
|
|
|
100
101
|
private captureStatus?;
|
|
101
102
|
/** Opaque error identities only: no raw entry or adapter error is enumerable on the transport error. */
|
|
102
103
|
private readonly invocationFailures;
|
|
103
|
-
constructor(resolved: ResolvedRecordSink);
|
|
104
|
+
constructor(resolved: ResolvedRecordSink, retain?: ((entry: RecordEntry) => void) | undefined);
|
|
104
105
|
/** Capture the served entry now; an asynchronous failure keeps this leg's rule, not a later resume's rule. */
|
|
105
106
|
private invoke;
|
|
106
107
|
/** A sink error is the diagnostic errors.recordSinkError; raw causes belong only to the caller's exception. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FlowRecorder } from '../engine/narrative/types.js';
|
|
2
2
|
import type { FlowchartTraverser } from '../engine/traversal/FlowchartTraverser.js';
|
|
3
|
+
import type { SnapshotOptions } from '../engine/types.js';
|
|
3
4
|
import type { ScopeRecorder } from '../scope/types.js';
|
|
4
5
|
import type { RunObservers } from './attach.js';
|
|
5
6
|
import type { RecorderSnapshot, RecordSinkStats, RuntimeSnapshot } from './ExecutionRuntime.js';
|
|
@@ -8,9 +9,7 @@ import type { RecorderSnapshot, RecordSinkStats, RuntimeSnapshot } from './Execu
|
|
|
8
9
|
* copy); in dev mode it is a deep-frozen CLONE, so a consumer mutation throws
|
|
9
10
|
* instead of corrupting engine state.
|
|
10
11
|
*/
|
|
11
|
-
export declare function servedSnapshot(traverser: FlowchartTraverser<any, any>, observers: RunObservers, options?:
|
|
12
|
-
redact?: boolean;
|
|
13
|
-
}, sink?: RecordSinkStats, captureOnly?: boolean): RuntimeSnapshot;
|
|
12
|
+
export declare function servedSnapshot(traverser: FlowchartTraverser<any, any>, observers: RunObservers, options?: SnapshotOptions, sink?: RecordSinkStats, captureOnly?: boolean): RuntimeSnapshot;
|
|
14
13
|
/**
|
|
15
14
|
* Collect `toSnapshot()` bundles from every attached recorder — ONE entry
|
|
16
15
|
* per recorder id, across all channels and both delivery tiers.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StageNode } from './lib/engine/graph/StageNode.js';
|
|
2
|
+
import type { FlowChartExecutorOptions } from './lib/runner/options.js';
|
|
3
|
+
import type { Evaluator, LiveCapture } from './skipped-writer-state.js';
|
|
4
|
+
export declare function configureSkippedWriterCapture<TScope>(options: FlowChartExecutorOptions<TScope>, capability: Evaluator, writesOf: (placement: StageNode) => readonly string[] | undefined, bind: (snapshot: object, capture: LiveCapture) => void): FlowChartExecutorOptions<TScope>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LogAddress, StoredDecision } from 'foottrace';
|
|
2
|
+
import type { SkippedChartProjection } from './lib/engine/graph/skippedProjection.js';
|
|
3
|
+
export interface SkippedCandidate {
|
|
4
|
+
readonly decision: StoredDecision;
|
|
5
|
+
readonly skippedEntry: string;
|
|
6
|
+
readonly writers: readonly {
|
|
7
|
+
readonly placementId: string;
|
|
8
|
+
readonly stageId: string;
|
|
9
|
+
readonly basis: 'declared' | 'observed';
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
interface SkippedEvidence {
|
|
13
|
+
readonly address: LogAddress;
|
|
14
|
+
readonly chart: SkippedChartProjection;
|
|
15
|
+
readonly from: number;
|
|
16
|
+
readonly to: number;
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export interface Evaluator {
|
|
20
|
+
readonly evaluateSkippedPaths: (entries: readonly unknown[], key: string, beforeIdx: number, options: SkippedEvidence) => {
|
|
21
|
+
readonly candidates: readonly SkippedCandidate[];
|
|
22
|
+
readonly gaps: readonly string[];
|
|
23
|
+
};
|
|
24
|
+
readonly savedChartDigest?: (chart: unknown) => Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
export interface LiveCapture {
|
|
28
|
+
readonly evidence: SkippedEvidence;
|
|
29
|
+
readonly rows: readonly string[];
|
|
30
|
+
readonly gap: 'truncated' | 'not-collected' | 'declaration-mismatch' | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare const liveCaptures: WeakMap<object, LiveCapture>;
|
|
33
|
+
/** @internal Exact live chart admission for parity tests. */
|
|
34
|
+
export declare function liveSkippedChartOf(snapshot: object): SkippedChartProjection | undefined;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StageNode } from './lib/engine/graph/StageNode.js';
|
|
2
|
+
import type { FlowChartExecutorOptions } from './lib/runner/options.js';
|
|
3
|
+
import { type SkippedCandidate } from './skipped-writer-state.js';
|
|
4
|
+
export interface NativeSkippedWritersResult {
|
|
5
|
+
readonly candidates: readonly (SkippedCandidate & {
|
|
6
|
+
readonly binding: 'native';
|
|
7
|
+
})[];
|
|
8
|
+
readonly gaps: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** Only an exact served snapshot can supply the native chart and retained writer entries. */
|
|
11
|
+
export declare function readSkippedWriters(snapshot: object, key: string, beforeIdx: number): Promise<NativeSkippedWritersResult>;
|
|
12
|
+
/** Declare the exhaustive write paths for an exact authored stage placement. */
|
|
13
|
+
export declare function declareSkippedWriterPaths(placement: StageNode, paths: readonly string[]): void;
|
|
14
|
+
/**
|
|
15
|
+
* Enable bounded skipped-writer capture when the installed Foottrace supplies the evaluator.
|
|
16
|
+
* Use the returned options with a same-instance executor configured with a record sink.
|
|
17
|
+
*/
|
|
18
|
+
export declare function skippedWriterCaptureOptions<TScope>(options?: FlowChartExecutorOptions<TScope>): Promise<FlowChartExecutorOptions<TScope>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "footprintjs",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.5.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",
|
|
@@ -138,6 +138,16 @@
|
|
|
138
138
|
"default": "./dist/explain.js"
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
+
"./skipped-writers": {
|
|
142
|
+
"import": {
|
|
143
|
+
"types": "./dist/esm/skipped-writers.d.ts",
|
|
144
|
+
"default": "./dist/esm/skipped-writers.js"
|
|
145
|
+
},
|
|
146
|
+
"require": {
|
|
147
|
+
"types": "./dist/types/skipped-writers.d.ts",
|
|
148
|
+
"default": "./dist/skipped-writers.js"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
141
151
|
"./detach": {
|
|
142
152
|
"import": {
|
|
143
153
|
"types": "./dist/esm/detach.d.ts",
|
|
@@ -204,6 +214,9 @@
|
|
|
204
214
|
"explain": [
|
|
205
215
|
"./dist/types/explain.d.ts"
|
|
206
216
|
],
|
|
217
|
+
"skipped-writers": [
|
|
218
|
+
"./dist/types/skipped-writers.d.ts"
|
|
219
|
+
],
|
|
207
220
|
"detach": [
|
|
208
221
|
"./dist/types/detach.d.ts"
|
|
209
222
|
],
|
|
@@ -229,7 +242,7 @@
|
|
|
229
242
|
},
|
|
230
243
|
"sideEffects": false,
|
|
231
244
|
"peerDependencies": {
|
|
232
|
-
"foottrace": "^2.3.1",
|
|
245
|
+
"foottrace": "^2.3.1 || ^3.1.0",
|
|
233
246
|
"zod": "^3.0.0 || ^4.0.0"
|
|
234
247
|
},
|
|
235
248
|
"peerDependenciesMeta": {
|