agentfootprint 18.3.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAPABILITIES.md +2 -0
- package/dist/core/agent/runtime/configuration/configure.js +6 -0
- package/dist/core/agent/runtime/configuration/configure.js.map +1 -1
- package/dist/core/agent/runtime/configuration/values.js.map +1 -1
- package/dist/core/agent/runtime/native/initialize.js +1 -0
- package/dist/core/agent/runtime/native/initialize.js.map +1 -1
- package/dist/esm/core/agent/runtime/configuration/configure.js +6 -0
- package/dist/esm/core/agent/runtime/configuration/configure.js.map +1 -1
- package/dist/esm/core/agent/runtime/configuration/types.d.ts +5 -1
- package/dist/esm/core/agent/runtime/configuration/values.d.ts +1 -0
- package/dist/esm/core/agent/runtime/configuration/values.js.map +1 -1
- package/dist/esm/core/agent/runtime/native/initialize.js +1 -0
- package/dist/esm/core/agent/runtime/native/initialize.js.map +1 -1
- package/dist/esm/core/agent/types/observation.d.ts +34 -1
- package/dist/esm/hosting/durability.d.ts +10 -0
- package/dist/esm/hosting/durability.js +54 -30
- package/dist/esm/hosting/durability.js.map +1 -1
- package/dist/esm/hosting/standingAgent/artifacts/accountParts.d.ts +3 -2
- package/dist/esm/hosting/standingAgent/artifacts/accountParts.js +9 -4
- package/dist/esm/hosting/standingAgent/artifacts/accountParts.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/observe.d.ts +1 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +8 -120
- package/dist/esm/recorders/observability/FlowchartRecorder.js +16 -0
- package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/boundaryRecorder/domainEvents.d.ts +9 -0
- package/dist/esm/recorders/observability/recordingParts/format.d.ts +87 -12
- package/dist/esm/recorders/observability/recordingParts/format.js +136 -17
- package/dist/esm/recorders/observability/recordingParts/format.js.map +1 -1
- package/dist/esm/recorders/observability/recordingParts/open.d.ts +41 -7
- package/dist/esm/recorders/observability/recordingParts/open.js +32 -6
- package/dist/esm/recorders/observability/recordingParts/open.js.map +1 -1
- package/dist/esm/recorders/observability/recordingParts/partReader.d.ts +25 -2
- package/dist/esm/recorders/observability/recordingParts/partReader.js +183 -15
- package/dist/esm/recorders/observability/recordingParts/partReader.js.map +1 -1
- package/dist/esm/recorders/observability/recordingParts/split.d.ts +13 -0
- package/dist/esm/recorders/observability/recordingParts/split.js +135 -26
- package/dist/esm/recorders/observability/recordingParts/split.js.map +1 -1
- package/dist/esm/recorders/observability/recordingParts/subflowPayloads.d.ts +124 -0
- package/dist/esm/recorders/observability/recordingParts/subflowPayloads.js +389 -0
- package/dist/esm/recorders/observability/recordingParts/subflowPayloads.js.map +1 -0
- package/dist/esm/recorders/observability/stepGraphTypes.d.ts +139 -0
- package/dist/esm/recorders/observability/stepGraphTypes.js +10 -0
- package/dist/esm/recorders/observability/stepGraphTypes.js.map +1 -0
- package/dist/hosting/durability.js +54 -30
- package/dist/hosting/durability.js.map +1 -1
- package/dist/hosting/standingAgent/artifacts/accountParts.js +9 -4
- package/dist/hosting/standingAgent/artifacts/accountParts.js.map +1 -1
- package/dist/observe.js.map +1 -1
- package/dist/recorders/observability/FlowchartRecorder.js +16 -0
- package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/recorders/observability/recordingParts/format.js +139 -18
- package/dist/recorders/observability/recordingParts/format.js.map +1 -1
- package/dist/recorders/observability/recordingParts/open.js +30 -4
- package/dist/recorders/observability/recordingParts/open.js.map +1 -1
- package/dist/recorders/observability/recordingParts/partReader.js +182 -14
- package/dist/recorders/observability/recordingParts/partReader.js.map +1 -1
- package/dist/recorders/observability/recordingParts/split.js +134 -25
- package/dist/recorders/observability/recordingParts/split.js.map +1 -1
- package/dist/recorders/observability/recordingParts/subflowPayloads.js +396 -0
- package/dist/recorders/observability/recordingParts/subflowPayloads.js.map +1 -0
- package/dist/recorders/observability/stepGraphTypes.js +11 -0
- package/dist/recorders/observability/stepGraphTypes.js.map +1 -0
- package/dist/types/core/agent/runtime/configuration/configure.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/configuration/types.d.ts +5 -1
- package/dist/types/core/agent/runtime/configuration/types.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/configuration/values.d.ts +1 -0
- package/dist/types/core/agent/runtime/configuration/values.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/native/initialize.d.ts.map +1 -1
- package/dist/types/core/agent/types/observation.d.ts +34 -1
- package/dist/types/core/agent/types/observation.d.ts.map +1 -1
- package/dist/types/hosting/durability.d.ts +10 -0
- package/dist/types/hosting/durability.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent/artifacts/accountParts.d.ts +3 -2
- package/dist/types/hosting/standingAgent/artifacts/accountParts.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/observe.d.ts +1 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts +8 -120
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/boundaryRecorder/domainEvents.d.ts +9 -0
- package/dist/types/recorders/observability/boundaryRecorder/domainEvents.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingParts/format.d.ts +87 -12
- package/dist/types/recorders/observability/recordingParts/format.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingParts/open.d.ts +41 -7
- package/dist/types/recorders/observability/recordingParts/open.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingParts/partReader.d.ts +25 -2
- package/dist/types/recorders/observability/recordingParts/partReader.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingParts/split.d.ts +13 -0
- package/dist/types/recorders/observability/recordingParts/split.d.ts.map +1 -1
- package/dist/types/recorders/observability/recordingParts/subflowPayloads.d.ts +125 -0
- package/dist/types/recorders/observability/recordingParts/subflowPayloads.d.ts.map +1 -0
- package/dist/types/recorders/observability/stepGraphTypes.d.ts +140 -0
- package/dist/types/recorders/observability/stepGraphTypes.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
* `readInvocation` the one part holding that invocation. Both layouts answer
|
|
17
17
|
* through the same part reader, so both serve the same values.
|
|
18
18
|
*
|
|
19
|
+
* ── Two index formats ───────────────────────────────────────────────────────
|
|
20
|
+
* Format 2 (what the writer writes) keeps a sub-flow invocation's entry and
|
|
21
|
+
* exit payloads with the invocation (`subflowPayloads.ts`): `readRoot` serves the
|
|
22
|
+
* base as stored (marked, without them), `readInvocation` serves them beside
|
|
23
|
+
* the result, `readWhole` puts them back. Format 1 (filed by 18.2 and 18.3)
|
|
24
|
+
* keeps them in the base row and reads as it always did; so does a whole
|
|
25
|
+
* recording, whose in-memory cut is format 1. An index of a format this reader
|
|
26
|
+
* does not know is `unsupported-format`, never a corrupt part.
|
|
27
|
+
*
|
|
19
28
|
* ── Honesty ─────────────────────────────────────────────────────────────────
|
|
20
29
|
* A missing, changed or oversized part is unavailable for exactly the
|
|
21
30
|
* invocations it holds; every other invocation still reads. Nothing falls
|
|
@@ -23,10 +32,10 @@
|
|
|
23
32
|
*/
|
|
24
33
|
import type { ArtifactRef } from '../../../artifacts/types.js';
|
|
25
34
|
import type { Recording } from '../recordRun.js';
|
|
26
|
-
import { type SavedRecordingPartUnavailable } from './partReader.js';
|
|
35
|
+
import { type SavedInvocationPayloads, type SavedRecordingPartUnavailable } from './partReader.js';
|
|
27
36
|
import { type SavedRecordingArtifacts } from './source.js';
|
|
28
37
|
export type { SavedRecordingArtifacts } from './source.js';
|
|
29
|
-
export type { SavedRecordingPartUnavailable } from './partReader.js';
|
|
38
|
+
export type { SavedInvocationPayloads, SavedPayloadSlot, SavedRecordingPartUnavailable, } from './partReader.js';
|
|
30
39
|
/** How much {@link openSavedRecording} agrees to read. Every cap is checked from metadata first. */
|
|
31
40
|
export interface OpenSavedRecordingOptions {
|
|
32
41
|
/** Cancels the open, and every later read that is not given its own signal. */
|
|
@@ -71,6 +80,15 @@ export interface SavedInvocation {
|
|
|
71
80
|
export interface SavedRecordingSizes {
|
|
72
81
|
/** Every stored byte of this recording. */
|
|
73
82
|
readonly storedBytes: number;
|
|
83
|
+
/**
|
|
84
|
+
* `storedBytes` plus the plain JSON bytes `readWhole` restores from results
|
|
85
|
+
* (an index-format-2 recording's `'same'` sub-flow payloads, stored once, in
|
|
86
|
+
* the result), as the index states them. What a whole read holds: a band
|
|
87
|
+
* decided from it is provisional, since `readWhole` measures what it
|
|
88
|
+
* restores and refuses a figure that does not match. Equal to `storedBytes`
|
|
89
|
+
* for a format-1 or whole recording.
|
|
90
|
+
*/
|
|
91
|
+
readonly restoredBytes: number;
|
|
74
92
|
/** How many artifacts hold it. */
|
|
75
93
|
readonly artifacts: number;
|
|
76
94
|
/** The index's bytes (parts layout only). */
|
|
@@ -87,7 +105,9 @@ export interface SavedRecordingSizes {
|
|
|
87
105
|
/** Why a saved recording could not be opened. */
|
|
88
106
|
export interface SavedRecordingUnavailable {
|
|
89
107
|
readonly status: 'unavailable';
|
|
90
|
-
readonly reason: 'not-found' | 'not-a-recording' | 'too-large' | 'invalid-index' | 'invalid-recording'
|
|
108
|
+
readonly reason: 'not-found' | 'not-a-recording' | 'too-large' | 'invalid-index' | 'invalid-recording'
|
|
109
|
+
/** An index of a format this reader does not know (`agentfootprint.recording.index.v<N>`). */
|
|
110
|
+
| 'unsupported-format';
|
|
91
111
|
}
|
|
92
112
|
/** An opened saved recording. Only its index (or, for a whole recording, the whole) has been read. */
|
|
93
113
|
export interface SavedRecording {
|
|
@@ -117,11 +137,20 @@ export interface SavedRecording {
|
|
|
117
137
|
* is the stored one, proven by digest and key set. Its SHAPE was checked when
|
|
118
138
|
* the recording was cut: on a recording that is not `complete`, a `ready`
|
|
119
139
|
* result may be one the lazy viewer would refuse, so check `complete` first.
|
|
140
|
+
*
|
|
141
|
+
* `payloads` (index format 2): what the invocation was handed (`entry`) and
|
|
142
|
+
* handed back (`exit`), present exactly when that payload moved out of the
|
|
143
|
+
* base row (whose event then carries `payloadWith: 'invocation'`). A
|
|
144
|
+
* `'same'` payload is the result's own object, shared; its bytes are measured,
|
|
145
|
+
* and differ from the index's `restoredBytes` only on a part that does not
|
|
146
|
+
* match its index (`part-changed`). Absent for a format-1 or whole
|
|
147
|
+
* recording, whose payloads are in the base row.
|
|
120
148
|
*/
|
|
121
149
|
readInvocation(key: string, options?: SavedRecordingReadOptions): Promise<{
|
|
122
150
|
readonly status: 'ready';
|
|
123
151
|
readonly invocation: SavedInvocation;
|
|
124
152
|
readonly result: unknown;
|
|
153
|
+
readonly payloads?: SavedInvocationPayloads;
|
|
125
154
|
} | SavedRecordingPartUnavailable>;
|
|
126
155
|
/**
|
|
127
156
|
* Whether every stored part is still there as the index names it: a `head`
|
|
@@ -136,10 +165,15 @@ export interface SavedRecording {
|
|
|
136
165
|
readonly status: 'ready';
|
|
137
166
|
} | SavedRecordingPartUnavailable>;
|
|
138
167
|
/**
|
|
139
|
-
* The whole recording, with every result
|
|
140
|
-
* any part is. It deep-equals the recording that
|
|
141
|
-
* byte-equal to it: `subflowResults` comes last in the
|
|
142
|
-
* in part order,
|
|
168
|
+
* The whole recording, with every result, alias and moved sub-flow payload
|
|
169
|
+
* restored; refused whole if any part is. It deep-equals the recording that
|
|
170
|
+
* was saved but is not byte-equal to it: `subflowResults` comes last in the
|
|
171
|
+
* snapshot, its keys are in part order, a proven alias shares its key's
|
|
172
|
+
* result object, and so does a `'same'` payload. The payloads restored from
|
|
173
|
+
* results are measured and charged against `maxBytes` as they are restored
|
|
174
|
+
* (`too-large` the moment it is spent); the index's own figure for them only
|
|
175
|
+
* decides an early refusal, and a figure that differs from what was measured
|
|
176
|
+
* is `part-changed`.
|
|
143
177
|
*/
|
|
144
178
|
readWhole(options?: SavedRecordingWholeOptions): Promise<{
|
|
145
179
|
readonly status: 'ready';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/open.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/open.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAcjD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EACnC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAKL,KAAK,uBAAuB,EAC7B,MAAM,aAAa,CAAC;AAIrB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EACV,uBAAuB,EACvB,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AAIzB,oGAAoG;AACpG,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,oDAAoD;AACpD,MAAM,WAAW,0BAA2B,SAAQ,yBAAyB;IAC3E;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,QAAQ,CAAC,GAAG,EAA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AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,uBAAuB,EAClC,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,cAAc,GAAG,yBAAyB,CAAC,CA8CrD"}
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Role: Lens. The one place a part's bytes become values: the size cap
|
|
6
6
|
* before any store call, the source's metadata and digest checks,
|
|
7
|
-
* bounded unpacking, then the payload's own fields — its format
|
|
8
|
-
*
|
|
7
|
+
* bounded unpacking, then the payload's own fields — its format (the
|
|
8
|
+
* one the index's format names: a v2 index v2 parts, a v1 index v1
|
|
9
|
+
* parts), its run, its position and its exact key set, and in format 2
|
|
10
|
+
* its stored sub-flow payloads, exactly the ones the index places there.
|
|
9
11
|
* Reads: the part source it is handed.
|
|
10
12
|
* Emits: N/A.
|
|
11
13
|
*/
|
|
@@ -18,12 +20,32 @@ export interface SavedRecordingPartUnavailable {
|
|
|
18
20
|
readonly reason: 'not-recorded' | 'part-missing' | 'part-changed' | 'too-large';
|
|
19
21
|
}
|
|
20
22
|
type Unavailable = SavedRecordingPartUnavailable;
|
|
23
|
+
/** One invocation's stored payloads (format 2), each present exactly when the index places it in the part. */
|
|
24
|
+
export interface StoredPayloads {
|
|
25
|
+
readonly entry?: unknown;
|
|
26
|
+
readonly exit?: unknown;
|
|
27
|
+
}
|
|
21
28
|
/** One invocation part's contents, keyed, and the plain JSON bytes they took. */
|
|
22
29
|
export interface PartContents {
|
|
23
30
|
readonly results: ReadonlyMap<string, unknown>;
|
|
24
31
|
readonly aliases: ReadonlyMap<string, unknown>;
|
|
32
|
+
/** Format 2: stored payloads by execution key (empty for format 1). */
|
|
33
|
+
readonly payloads: ReadonlyMap<string, StoredPayloads>;
|
|
25
34
|
readonly plainBytes: number;
|
|
26
35
|
}
|
|
36
|
+
/** One payload as a read serves it: its value, or why it has none. */
|
|
37
|
+
export type SavedPayloadSlot = {
|
|
38
|
+
readonly status: 'ready';
|
|
39
|
+
readonly value: unknown;
|
|
40
|
+
} | {
|
|
41
|
+
readonly status: 'unavailable';
|
|
42
|
+
readonly reason: SavedRecordingPartUnavailable['reason'];
|
|
43
|
+
};
|
|
44
|
+
/** An invocation's moved payloads, as a read serves them (format 2). */
|
|
45
|
+
export interface SavedInvocationPayloads {
|
|
46
|
+
readonly entry?: SavedPayloadSlot;
|
|
47
|
+
readonly exit?: SavedPayloadSlot;
|
|
48
|
+
}
|
|
27
49
|
/** Reads the parts of one admitted index through one source. */
|
|
28
50
|
export declare function partReader(index: RecordingIndex, source: PartSource, caps: {
|
|
29
51
|
readonly root: number;
|
|
@@ -34,6 +56,7 @@ export declare function partReader(index: RecordingIndex, source: PartSource, ca
|
|
|
34
56
|
readonly plainBytes: number;
|
|
35
57
|
} | Unavailable>;
|
|
36
58
|
invocations: (part: number, signal: AbortSignal | undefined, budget?: number) => Promise<PartContents | Unavailable>;
|
|
59
|
+
payloadsOf: (key: string, contents: PartContents) => SavedInvocationPayloads | Unavailable | undefined;
|
|
37
60
|
whole: (signal: AbortSignal | undefined, maxBytes: number) => Promise<{
|
|
38
61
|
readonly status: 'ready';
|
|
39
62
|
readonly recording: Recording;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partReader.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/partReader.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"partReader.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/partReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMjD,OAAO,EAOL,KAAK,cAAc,EAEpB,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8DAA8D;AAC9D,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,E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5C,WAAW,GAAG,SAAS,sBAE9B,QAAQ;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW,CAAC;wBA6BhF,MAAM,UACJ,WAAW,GAAG,SAAS,sBAE9B,QAAQ,YAAY,GAAG,WAAW,CAAC;sBAuC/B,MAAM,YACD,YAAY,KACrB,uBAAuB,GAAG,WAAW,GAAG,SAAS;oBAuC1C,WAAW,GAAG,SAAS,YACrB,MAAM,KACf,QAAQ;QAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;KAAE,GAAG,WAAW,CAAC;oBAkG3E,WAAW,GAAG,SAAS,KAC9B,QAAQ;QAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,WAAW,CAAC;EAWvD"}
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
* • A path alias whose JSON text equals one stored result's text is stored
|
|
21
21
|
* only as `{ name, key }`: byte equality is the proof, so nothing the
|
|
22
22
|
* whole recording held is lost.
|
|
23
|
+
* • Format 2 (what the writer writes): a sub-flow invocation's entry and
|
|
24
|
+
* exit payloads leave the base row for the invocation's part, on proof
|
|
25
|
+
* only (`subflowPayloads.ts`). A stored payload is grouped WITH its result: the
|
|
26
|
+
* two are one unit for the target, never split across parts. A reader
|
|
27
|
+
* of a whole recording cuts format 1 (`subflowPayloads: 'in-row'`), so
|
|
28
|
+
* every read of a whole recording is what it was before format 2.
|
|
23
29
|
*
|
|
24
30
|
* ── Determinism ─────────────────────────────────────────────────────────────
|
|
25
31
|
* Every part's text is a function of the recording, the run id and `packed`
|
|
@@ -50,6 +56,13 @@ export interface SplitRecordingOptions {
|
|
|
50
56
|
readonly packed?: boolean;
|
|
51
57
|
/** The part size target. Default {@link RECORDING_PART_TARGET_BYTES}. */
|
|
52
58
|
readonly targetBytes?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Where sub-flow boundary payloads go. `'with-invocation'` (the default, and
|
|
61
|
+
* all the writer writes) cuts format 2; `'in-row'` cuts format 1, every
|
|
62
|
+
* payload in the base row: what a reader of a WHOLE recording uses, so its
|
|
63
|
+
* reads stay what they were.
|
|
64
|
+
*/
|
|
65
|
+
readonly subflowPayloads?: 'with-invocation' | 'in-row';
|
|
53
66
|
}
|
|
54
67
|
/**
|
|
55
68
|
* Cut a live recording (`recordRun` · `toRecording()`), through the wire rule
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/split.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/split.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAWL,KAAK,UAAU,EAKhB,MAAM,aAAa,CAAC;AAMrB,gCAAgC;AAChC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,0FAA0F;AAC1F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,kBAAkB;AAClB,MAAM,WAAW,qBAAqB;IACpC,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,iBAAiB,GAAG,QAAQ,CAAC;CACzD;AAgCD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,OAAO,EAClB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,cAAc,CAAC,CAczB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,cAAc,CAAC,CAqOzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACjE,MAAM,CAmER"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* recordingParts/subflowPayloads — what a sub-flow invocation was handed and what it
|
|
3
|
+
* handed back belong to that invocation's part, not to the base part.
|
|
4
|
+
*
|
|
5
|
+
* Role: Codec. Pure. `cutPayloads` decides, at the cut, which `payload` of a
|
|
6
|
+
* `subflow.entry` / `subflow.exit` boundary event leaves the base row
|
|
7
|
+
* and how it is kept; `restorePayloads` puts every one back for a whole
|
|
8
|
+
* read; `resultValueFor` is the one place a `'same'` payload is found
|
|
9
|
+
* inside its result.
|
|
10
|
+
* Reads: its arguments (plain JSON data).
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*
|
|
13
|
+
* ── The rule: a payload moves only on proof ─────────────────────────────────
|
|
14
|
+
* An event's `payload` moves only when ALL hold:
|
|
15
|
+
* • its row is a BoundaryEvents row in full mode (`name: 'BoundaryEvents'`,
|
|
16
|
+
* `meta.mode: 'full'`) and no event of that row already holds the mark key;
|
|
17
|
+
* • the BoundaryEvents rows hold exactly ONE `subflow.entry` and at most ONE
|
|
18
|
+
* `subflow.exit` with that `runtimeStageId`, all with the index's
|
|
19
|
+
* `subflowId` for it — one recorder can be shared by a second executor,
|
|
20
|
+
* whose own counter writes the same id, so an id alone does not name the
|
|
21
|
+
* invocation; with that rule restore is keyed by (id, type);
|
|
22
|
+
* • `payload` is the event's last key (`eventBuilders.ts · buildSubflowEvent`
|
|
23
|
+
* spreads it last; the cut proves it per event);
|
|
24
|
+
* • the invocation has a part (a paused mount has none: `part: null`, and
|
|
25
|
+
* such a recording is `complete: false`, which a host refuses whole).
|
|
26
|
+
* Anything else stays whole in the base and is counted, by why.
|
|
27
|
+
*
|
|
28
|
+
* ── How a moved payload is kept ─────────────────────────────────────────────
|
|
29
|
+
* • `'same'`: equal JSON text to the result's own value (entry:
|
|
30
|
+
* `treeContext.history[0].overwrite`, exit: `treeContext.globalContext`),
|
|
31
|
+
* the alias law used again. Nothing is stored; a whole read restores the
|
|
32
|
+
* result's own object, shared, as a proven alias is.
|
|
33
|
+
* • `'stored'`: the texts differ (a policy that selects a seeded key spells
|
|
34
|
+
* the placeholder differently on the two sides; a nested name rule; an
|
|
35
|
+
* empty seed; a resumed mount). The payload is stored in the invocation's
|
|
36
|
+
* part BESIDE its result, never inside it: the alias proof compares
|
|
37
|
+
* result text.
|
|
38
|
+
*
|
|
39
|
+
* ── How the base row says so ────────────────────────────────────────────────
|
|
40
|
+
* A moved event loses `payload` and gains `payloadWith: 'invocation'` as its
|
|
41
|
+
* last key; a row that lost one gains `meta.subflowPayloads:
|
|
42
|
+
* 'with-invocation'` (appended; `meta.mode` stays `'full'`), and the index
|
|
43
|
+
* lists the row's position (`subflowPayloads.rows`). Restoring touches only
|
|
44
|
+
* the listed rows: it drops both and appends `payload`, so the text is exactly
|
|
45
|
+
* the text before the cut. A row that arrived holding the fact key or the mark
|
|
46
|
+
* key is never marked, never listed and never touched: it reads back whole.
|
|
47
|
+
*/
|
|
48
|
+
import { type IndexPayloadPlace, type IndexSubflowPayloads } from './format.js';
|
|
49
|
+
import type { WalkedInvocation } from './invocations.js';
|
|
50
|
+
/** The row `meta` key a base part's BoundaryEvents row gains when one of its payloads moved. */
|
|
51
|
+
export declare const SUBFLOW_PAYLOADS_META_KEY = "subflowPayloads";
|
|
52
|
+
/** Its one value. */
|
|
53
|
+
export declare const SUBFLOW_PAYLOADS_WITH_INVOCATION = "with-invocation";
|
|
54
|
+
/** The key a moved event carries in place of `payload`, as its last key. */
|
|
55
|
+
export declare const PAYLOAD_MARK_KEY = "payloadWith";
|
|
56
|
+
/** Its one value. */
|
|
57
|
+
export declare const PAYLOAD_MARK = "invocation";
|
|
58
|
+
/** Which boundary payload: `subflow.entry`'s or `subflow.exit`'s. */
|
|
59
|
+
export type PayloadKind = 'entry' | 'exit';
|
|
60
|
+
/** One payload that left the base row. */
|
|
61
|
+
export interface MovedPayload {
|
|
62
|
+
readonly place: IndexPayloadPlace;
|
|
63
|
+
readonly value: unknown;
|
|
64
|
+
/** Compact JSON text of the payload (stored payloads are written from it). */
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly bytes: number;
|
|
67
|
+
}
|
|
68
|
+
/** An invocation's moved payloads. */
|
|
69
|
+
export interface MovedPayloads {
|
|
70
|
+
entry?: MovedPayload;
|
|
71
|
+
exit?: MovedPayload;
|
|
72
|
+
}
|
|
73
|
+
/** The cut's verdict over one snapshot. */
|
|
74
|
+
export interface PayloadCut {
|
|
75
|
+
/** `snapshot.recorders` with the moved payloads replaced by marks; absent when nothing moved. */
|
|
76
|
+
readonly recorders?: readonly unknown[];
|
|
77
|
+
/** Per invocation key, the payloads that moved. */
|
|
78
|
+
readonly moved: ReadonlyMap<string, MovedPayloads>;
|
|
79
|
+
readonly counts: IndexSubflowPayloads;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The result's own value a payload of `kind` is compared with and, when
|
|
83
|
+
* `'same'`, restored from: `treeContext.history[0].overwrite` for an entry,
|
|
84
|
+
* `treeContext.globalContext` for an exit. `undefined` when the result holds none.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resultValueFor(result: unknown, kind: PayloadKind): unknown;
|
|
87
|
+
/** Why one sub-flow payload stays in the base row (the index's `kept` reasons), or that it may move. */
|
|
88
|
+
export type PayloadVerdict = 'move' | keyof IndexSubflowPayloads['kept'];
|
|
89
|
+
/**
|
|
90
|
+
* Decide which boundary payloads leave the base row (see the file header for
|
|
91
|
+
* the rule). Pure: the snapshot is not changed; the rows that change are
|
|
92
|
+
* copied, every other value is shared.
|
|
93
|
+
*/
|
|
94
|
+
export declare function cutPayloads(snapshot: unknown, invocations: readonly WalkedInvocation[]): PayloadCut;
|
|
95
|
+
/** What the rule says about a (restored) snapshot: the payloads that may move, and why the rest stay. */
|
|
96
|
+
export interface PayloadClaims {
|
|
97
|
+
/** `kind:id` of every payload the rule moves. */
|
|
98
|
+
readonly moved: ReadonlySet<string>;
|
|
99
|
+
readonly kept: IndexSubflowPayloads['kept'];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The rule run again over a snapshot a whole read restored, with the index's
|
|
103
|
+
* own invocations as owners: what the index must have said about moves and
|
|
104
|
+
* kept payloads. No value is serialised; `same` vs `stored` and the restored
|
|
105
|
+
* bytes are checked by measuring as they are restored.
|
|
106
|
+
*/
|
|
107
|
+
export declare function payloadClaims(snapshot: unknown, owners: ReadonlyMap<string, string>): PayloadClaims;
|
|
108
|
+
/** A moved payload's value, or `undefined` when the index or its part has none. */
|
|
109
|
+
export type PayloadResolver = (key: string, kind: PayloadKind) => {
|
|
110
|
+
readonly value: unknown;
|
|
111
|
+
} | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Put every moved payload back into a v2 base recording, IN PLACE (the reader
|
|
114
|
+
* owns the freshly parsed base). `rows` is the index's list of the rows the cut
|
|
115
|
+
* marked, and `expected` its `same + stored`. Only those rows are touched:
|
|
116
|
+
* any other row, even one whose `meta` holds a `subflowPayloads` key or whose
|
|
117
|
+
* events hold a `payloadWith` key, is the recording's own data and stays as
|
|
118
|
+
* stored. Returns `false`, having proven nothing, when the base and the index
|
|
119
|
+
* disagree: a listed row the cut could not have marked (not a BoundaryEvents
|
|
120
|
+
* row in full mode, its fact missing or not last, no mark in it), a mark that
|
|
121
|
+
* resolves to nothing, a mark twice, a mark not in the last place or beside a
|
|
122
|
+
* `payload`, or a count that differs. The caller answers that `part-changed`.
|
|
123
|
+
*/
|
|
124
|
+
export declare function restorePayloads(recording: Record<string, unknown>, resolve: PayloadResolver, expected: number, rows: readonly number[]): boolean;
|
|
125
|
+
//# sourceMappingURL=subflowPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subflowPayloads.d.ts","sourceRoot":"","sources":["../../../../../src/recorders/observability/recordingParts/subflowPayloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,qBAAqB;AACrB,eAAO,MAAM,gCAAgC,oBAAoB,CAAC;AAClE,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,qBAAqB;AACrB,eAAO,MAAM,YAAY,eAAe,CAAC;AAIzC,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,sCAAs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M,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,OAAO,CA+CT"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stepGraphTypes — the step graph's public shapes: what
|
|
3
|
+
* `FlowchartRecorder.ts · buildStepGraphFromEvents` folds a boundary event
|
|
4
|
+
* stream into, and what Lens and the strategies read.
|
|
5
|
+
*
|
|
6
|
+
* Role: Types only. Re-exported from `FlowchartRecorder.ts`, the module every
|
|
7
|
+
* consumer imports them from; kept apart so the fold stays small.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One node in the step-level flowchart. Node kind drives rendering
|
|
11
|
+
* (actor icon, color). ReAct steps carry token + tool details; topology
|
|
12
|
+
* nodes (subflow / fork-branch / decision-branch) mirror the footprintjs
|
|
13
|
+
* composition events and exist so composition structure (Loop, Parallel,
|
|
14
|
+
* Conditional, Swarm) stays visible in the graph.
|
|
15
|
+
*/
|
|
16
|
+
export interface StepNode {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly kind: 'user->llm' | 'llm->tool' | 'tool->llm' | 'llm->user' | 'subflow' | 'fork-branch' | 'decision-branch';
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly startOffsetMs: number;
|
|
21
|
+
readonly endOffsetMs?: number;
|
|
22
|
+
/** LLM step: token usage of the call that bounded this step. */
|
|
23
|
+
readonly tokens?: {
|
|
24
|
+
readonly in: number;
|
|
25
|
+
readonly out: number;
|
|
26
|
+
};
|
|
27
|
+
/** llm->tool / tool->llm: the tool name. */
|
|
28
|
+
readonly toolName?: string;
|
|
29
|
+
/** user->llm / tool->llm: the model that was invoked. */
|
|
30
|
+
readonly llmModel?: string;
|
|
31
|
+
/** Decomposition of the underlying subflowId (rooted under '__root__'). */
|
|
32
|
+
readonly subflowPath: readonly string[];
|
|
33
|
+
/** Context injections attributed to this step (LLM steps only). */
|
|
34
|
+
readonly injections?: readonly ContextInjection[];
|
|
35
|
+
/** 1-based ReAct iteration this step belongs to. Undefined for
|
|
36
|
+
* topology / composition nodes. */
|
|
37
|
+
readonly iterationIndex?: number;
|
|
38
|
+
/** Which slot the step's input updated. ReAct steps only. */
|
|
39
|
+
readonly slotUpdated?: 'system-prompt' | 'messages' | 'tools';
|
|
40
|
+
/** True ONLY for `subflow` StepNodes whose primitiveKind is `'Agent'`.
|
|
41
|
+
* Narrow flag for callers that distinguish ReAct agents from other
|
|
42
|
+
* composition primitives (cost / iteration / token attribution). */
|
|
43
|
+
readonly isAgentBoundary?: boolean;
|
|
44
|
+
/** Primitive kind from the subflow root description prefix
|
|
45
|
+
* (`'Agent'` / `'LLMCall'` / `'Sequence'` / etc.). */
|
|
46
|
+
readonly primitiveKind?: string;
|
|
47
|
+
/** True for `subflow` StepNodes representing any KNOWN primitive
|
|
48
|
+
* (Agent / LLMCall / Sequence / Parallel / Conditional / Loop) —
|
|
49
|
+
* drives Lens's drill-in container treatment. */
|
|
50
|
+
readonly isPrimitiveBoundary?: boolean;
|
|
51
|
+
/** `inputMapper` payload at the subflow's entry. Subflow nodes only. */
|
|
52
|
+
readonly entryPayload?: unknown;
|
|
53
|
+
/** Subflow shared state at exit. Subflow nodes only.
|
|
54
|
+
* Undefined for in-progress / paused subflows. */
|
|
55
|
+
readonly exitPayload?: unknown;
|
|
56
|
+
/** Set instead of `entryPayload` when the recording keeps that payload with
|
|
57
|
+
* the invocation (a recording saved in parts, index format 2): ask for the
|
|
58
|
+
* invocation `runtimeStageId` names. Neither field = none was recorded. */
|
|
59
|
+
readonly entryPayloadWith?: 'invocation';
|
|
60
|
+
/** The same, instead of `exitPayload`. */
|
|
61
|
+
readonly exitPayloadWith?: 'invocation';
|
|
62
|
+
/** LLM's text content. Set on `llm->tool` (the reasoning emitted with the
|
|
63
|
+
* tool_use blocks) and on `llm->user` (the terminal answer). */
|
|
64
|
+
readonly assistantText?: string;
|
|
65
|
+
/** Tool input arguments the LLM produced. Set on `llm->tool` from the
|
|
66
|
+
* matching `tool.start` event payload. */
|
|
67
|
+
readonly toolArgs?: unknown;
|
|
68
|
+
/** Tool result returned to the LLM. Set on `tool->llm` from the
|
|
69
|
+
* preceding `tool.end` event payload. */
|
|
70
|
+
readonly toolResult?: unknown;
|
|
71
|
+
/** Stable per-execution key — same `runtimeStageId` Trace view uses. */
|
|
72
|
+
readonly runtimeStageId?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Slot boundary payloads composed for THIS LLM step.
|
|
75
|
+
*
|
|
76
|
+
* Set ONLY for `kind === 'user->llm'` and `kind === 'tool->llm'`
|
|
77
|
+
* StepNodes — the moments where context flows INTO the LLM. Each
|
|
78
|
+
* entry carries the slot subflow's `inputMapper` result (entryPayload)
|
|
79
|
+
* and rendered slot output (exitPayload).
|
|
80
|
+
*
|
|
81
|
+
* Attribution: any slot subflow that fired BETWEEN the previous LLM
|
|
82
|
+
* end (or run start) and THIS LLM start is attributed to this call.
|
|
83
|
+
* Done at projection time over `boundary.getEvents()`; no consumer-
|
|
84
|
+
* side correlation required.
|
|
85
|
+
*
|
|
86
|
+
* Lens uses this to make the 3 slot rows inside the LLM card
|
|
87
|
+
* clickable — clicking a slot reveals its entry/exit payloads in
|
|
88
|
+
* the right-pane detail panel without needing direct BoundaryRecorder
|
|
89
|
+
* access.
|
|
90
|
+
*/
|
|
91
|
+
readonly slotBoundaries?: {
|
|
92
|
+
readonly systemPrompt?: SlotBoundary;
|
|
93
|
+
readonly messages?: SlotBoundary;
|
|
94
|
+
readonly tools?: SlotBoundary;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** One slot's boundary pair attributed to a specific LLM step. */
|
|
98
|
+
export interface SlotBoundary {
|
|
99
|
+
/** runtimeStageId of the slot subflow execution. */
|
|
100
|
+
readonly runtimeStageId: string;
|
|
101
|
+
/** `inputMapper` payload — the data the slot was COMPOSED FROM
|
|
102
|
+
* (RAG hits, skill content, user message, tool result, etc). */
|
|
103
|
+
readonly entryPayload?: unknown;
|
|
104
|
+
/** Subflow shared state at exit — the rendered slot content
|
|
105
|
+
* (system prompt string, messages array, tools array). */
|
|
106
|
+
readonly exitPayload?: unknown;
|
|
107
|
+
/** Set instead of `entryPayload` when the recording keeps that payload with
|
|
108
|
+
* the slot invocation `runtimeStageId` names (index format 2). */
|
|
109
|
+
readonly entryPayloadWith?: 'invocation';
|
|
110
|
+
/** The same, instead of `exitPayload`. */
|
|
111
|
+
readonly exitPayloadWith?: 'invocation';
|
|
112
|
+
}
|
|
113
|
+
/** Consumer-facing context injection (5 axes of context engineering). */
|
|
114
|
+
export interface ContextInjection {
|
|
115
|
+
readonly slot: 'system-prompt' | 'messages' | 'tools';
|
|
116
|
+
readonly asRole?: 'system' | 'user' | 'assistant' | 'tool';
|
|
117
|
+
readonly source: string;
|
|
118
|
+
readonly sourceId?: string;
|
|
119
|
+
readonly contentSummary?: string;
|
|
120
|
+
readonly reason?: string;
|
|
121
|
+
readonly sectionTag?: string;
|
|
122
|
+
readonly upstreamRef?: string;
|
|
123
|
+
readonly retrievalScore?: number;
|
|
124
|
+
readonly rankPosition?: number;
|
|
125
|
+
readonly budgetTokens?: number;
|
|
126
|
+
readonly budgetFraction?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface StepEdge {
|
|
129
|
+
readonly id: string;
|
|
130
|
+
readonly from: string;
|
|
131
|
+
readonly to: string;
|
|
132
|
+
readonly kind: 'next' | 'loop-iteration' | 'fork-branch' | 'decision-branch';
|
|
133
|
+
readonly iteration?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface StepGraph {
|
|
136
|
+
readonly nodes: readonly StepNode[];
|
|
137
|
+
readonly edges: readonly StepEdge[];
|
|
138
|
+
readonly activeNodeId?: string;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=stepGraphTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepGraphTypes.d.ts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,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,GAAG,iBAAiB,CAAC;IAC7E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "The explainable agent framework \u2014 backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|