@framers/agentos 0.15.55 → 0.15.57
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/cognition/memory/io/ChatGptImporter.d.ts +44 -5
- package/dist/cognition/memory/io/ChatGptImporter.d.ts.map +1 -1
- package/dist/cognition/memory/io/ChatGptImporter.js +101 -24
- package/dist/cognition/memory/io/ChatGptImporter.js.map +1 -1
- package/dist/cognition/memory/io/CsvImporter.d.ts +4 -1
- package/dist/cognition/memory/io/CsvImporter.d.ts.map +1 -1
- package/dist/cognition/memory/io/CsvImporter.js +10 -5
- package/dist/cognition/memory/io/CsvImporter.js.map +1 -1
- package/dist/cognition/memory/io/JsonImporter.d.ts +37 -6
- package/dist/cognition/memory/io/JsonImporter.d.ts.map +1 -1
- package/dist/cognition/memory/io/JsonImporter.js +88 -8
- package/dist/cognition/memory/io/JsonImporter.js.map +1 -1
- package/dist/cognition/memory/io/SqliteImporter.d.ts +31 -3
- package/dist/cognition/memory/io/SqliteImporter.d.ts.map +1 -1
- package/dist/cognition/memory/io/SqliteImporter.js +72 -18
- package/dist/cognition/memory/io/SqliteImporter.js.map +1 -1
- package/dist/cognition/memory/io/facade/types.d.ts +14 -10
- package/dist/cognition/memory/io/facade/types.d.ts.map +1 -1
- package/dist/cognition/memory/io/importScope.d.ts +62 -2
- package/dist/cognition/memory/io/importScope.d.ts.map +1 -1
- package/dist/cognition/memory/io/importScope.js +82 -2
- package/dist/cognition/memory/io/importScope.js.map +1 -1
- package/dist/orchestration/checkpoint/ICheckpointStore.d.ts +13 -1
- package/dist/orchestration/checkpoint/ICheckpointStore.d.ts.map +1 -1
- package/dist/orchestration/runtime/GraphRuntime.d.ts +18 -4
- package/dist/orchestration/runtime/GraphRuntime.d.ts.map +1 -1
- package/dist/orchestration/runtime/GraphRuntime.js +84 -19
- package/dist/orchestration/runtime/GraphRuntime.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-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AO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IAEzB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAE1B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* An importer files each trace under its scope and scope id and deduplicates inside that pair: a record whose text a
|
|
5
5
|
* trace of another scope id holds (another tenant's, user's or session's) is imported, and a record whose text a trace
|
|
6
6
|
* of its own scope and scope id holds is a duplicate, whichever writer stored that trace. The Markdown export writes
|
|
7
|
-
* the same scope id into a trace's front matter, so a note carries it out of one brain and into another.
|
|
7
|
+
* the same scope id into a trace's front matter, so a note carries it out of one brain and into another. An importer
|
|
8
|
+
* whose source marks forgotten traces reads the source's live records before its forgotten ones, so a text the source
|
|
9
|
+
* holds both forgotten and live arrives live. A trace's memory-graph node comes in with its trace alone, under its
|
|
10
|
+
* trace's id, so a record merged into another trace leaves no node behind that stands for a trace the brain does not
|
|
11
|
+
* hold.
|
|
8
12
|
*
|
|
9
13
|
* @module memory/io/importScope
|
|
10
14
|
*/
|
|
@@ -29,7 +33,9 @@ export declare function importedScopeId(metadata: unknown, scopeIdColumn?: unkno
|
|
|
29
33
|
* `import_hash` (an import stores it) or `content_hash` (`remember()`, `ingest()` and `memory_add` store it). A trace
|
|
30
34
|
* the cognitive memory store wrote carries neither hash, and its text finds it. A trace the brain forgot counts as any
|
|
31
35
|
* other, so an import does not bring it back: a forgotten row stays a record of what the brain let go, and a JSON or
|
|
32
|
-
* SQLite export carries it, so leaving it out would add another forgotten copy at each import of such a file.
|
|
36
|
+
* SQLite export carries it, so leaving it out would add another forgotten copy at each import of such a file. An
|
|
37
|
+
* importer reads a source's live records before its forgotten ones (see {@link liveRecordsFirst}), so a forgotten trace
|
|
38
|
+
* the same import writes is never what makes a live record of its text a duplicate.
|
|
33
39
|
*
|
|
34
40
|
* @param brain - The brain the query runs on; its dialect reads the metadata.
|
|
35
41
|
* @returns A parenthesised condition on `memory_traces` with the three placeholders {@link duplicateTraceParams}
|
|
@@ -44,4 +50,58 @@ export declare function duplicateTraceCondition(brain: Pick<Brain, 'features'>):
|
|
|
44
50
|
* @returns The hash twice, then the text.
|
|
45
51
|
*/
|
|
46
52
|
export declare function duplicateTraceParams(hash: string, content: string): [string, string, string];
|
|
53
|
+
/**
|
|
54
|
+
* A source's trace records in the order an importer reads them: its live records, then its forgotten ones, each group
|
|
55
|
+
* in the source's order. A source can hold a forgotten and a live trace of one text in one scope and scope id:
|
|
56
|
+
* `forget()` and then `remember()` of the text leave them, and so does a consolidation merge of two traces of it. An
|
|
57
|
+
* export holds its rows in no set order. Read first, the live record is imported and the forgotten one is its
|
|
58
|
+
* duplicate, so the text arrives live; read the other way round, the live record would be the duplicate of the
|
|
59
|
+
* forgotten trace the same import had just written, and the text would arrive forgotten.
|
|
60
|
+
*
|
|
61
|
+
* @param records - The source's trace records, in its order.
|
|
62
|
+
* @param isForgotten - Whether a record is of a trace its source forgot.
|
|
63
|
+
* @returns The live records, then the forgotten ones.
|
|
64
|
+
*/
|
|
65
|
+
export declare function liveRecordsFirst<T>(records: readonly T[], isForgotten: (record: T) => boolean): T[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether a JSON or SQLite trace record is of a trace its source forgot: its `deleted` is present and not zero. A
|
|
68
|
+
* record whose `deleted` is absent or `null` is stored as live, as one whose `deleted` is `0` is.
|
|
69
|
+
*
|
|
70
|
+
* @param record - A trace record as its source holds it; a value that is not an object is not forgotten.
|
|
71
|
+
* @returns `true` when the record's `deleted` is present and not zero.
|
|
72
|
+
*/
|
|
73
|
+
export declare function isForgottenRecord(record: unknown): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The `knowledge_nodes.type` of a memory-graph node (`SqlMemoryGraph`): the node of the trace whose id it carries as
|
|
76
|
+
* its own.
|
|
77
|
+
*/
|
|
78
|
+
export declare const MEMORY_GRAPH_NODE_TYPE = "memory_graph";
|
|
79
|
+
/** How an import takes a memory-graph node its file holds (see {@link memoryGraphNodeImport}). */
|
|
80
|
+
export type MemoryGraphNodeImport = {
|
|
81
|
+
action: 'write' | 'duplicate';
|
|
82
|
+
id: string;
|
|
83
|
+
} | {
|
|
84
|
+
action: 'skip';
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* How an import takes a memory-graph node its file holds, the node of the trace whose id it carries. The node comes in
|
|
88
|
+
* with its trace alone and under that id. It is skipped, and so are the edges that name it, when the file holds its
|
|
89
|
+
* trace and the import did not write that trace, or match it as a duplicate, under that id (the record merged into a
|
|
90
|
+
* trace of another id, was written under a new id, or failed), or when the brain holds no trace of that id; written
|
|
91
|
+
* there, the node would stand for a trace the brain does not hold. A node the brain holds under that id is the
|
|
92
|
+
* record's duplicate, and the edges that name the record's node name it; a node of another type under that id makes
|
|
93
|
+
* the record's node a skip, as it cannot take that id. Otherwise the node is written under that id.
|
|
94
|
+
*
|
|
95
|
+
* A record merged into a trace of another id brings no node and no edges: the brain's node of that trace keeps its own
|
|
96
|
+
* edges, and the record merged is most often a forgotten one (see {@link liveRecordsFirst}), whose edges its source no
|
|
97
|
+
* longer reads.
|
|
98
|
+
*
|
|
99
|
+
* @param trx - The import's transaction.
|
|
100
|
+
* @param brainId - The brain the import writes.
|
|
101
|
+
* @param nodeId - The node record's id, which is its trace's id.
|
|
102
|
+
* @param unfiled - Whether the file holds the trace of an id that the import did not write, or match as a duplicate,
|
|
103
|
+
* under that id.
|
|
104
|
+
* @returns `write` or `duplicate` with the id, or `skip`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function memoryGraphNodeImport(trx: Pick<Brain, 'get'>, brainId: string, nodeId: unknown, unfiled: (traceId: string) => boolean): Promise<MemoryGraphNodeImport>;
|
|
47
107
|
//# sourceMappingURL=importScope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importScope.d.ts","sourceRoot":"","sources":["../../../../src/cognition/memory/io/importScope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"importScope.d.ts","sourceRoot":"","sources":["../../../../src/cognition/memory/io/importScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CASlF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,MAAM,CAK9E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAE5F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,EAAE,CAKnG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAI1D;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,kGAAkG;AAClG,MAAM,MAAM,qBAAqB,GAAG;IAAE,MAAM,EAAE,OAAO,GAAG,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACpC,OAAO,CAAC,qBAAqB,CAAC,CAahC"}
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* An importer files each trace under its scope and scope id and deduplicates inside that pair: a record whose text a
|
|
5
5
|
* trace of another scope id holds (another tenant's, user's or session's) is imported, and a record whose text a trace
|
|
6
6
|
* of its own scope and scope id holds is a duplicate, whichever writer stored that trace. The Markdown export writes
|
|
7
|
-
* the same scope id into a trace's front matter, so a note carries it out of one brain and into another.
|
|
7
|
+
* the same scope id into a trace's front matter, so a note carries it out of one brain and into another. An importer
|
|
8
|
+
* whose source marks forgotten traces reads the source's live records before its forgotten ones, so a text the source
|
|
9
|
+
* holds both forgotten and live arrives live. A trace's memory-graph node comes in with its trace alone, under its
|
|
10
|
+
* trace's id, so a record merged into another trace leaves no node behind that stands for a trace the brain does not
|
|
11
|
+
* hold.
|
|
8
12
|
*
|
|
9
13
|
* @module memory/io/importScope
|
|
10
14
|
*/
|
|
@@ -39,7 +43,9 @@ export function importedScopeId(metadata, scopeIdColumn) {
|
|
|
39
43
|
* `import_hash` (an import stores it) or `content_hash` (`remember()`, `ingest()` and `memory_add` store it). A trace
|
|
40
44
|
* the cognitive memory store wrote carries neither hash, and its text finds it. A trace the brain forgot counts as any
|
|
41
45
|
* other, so an import does not bring it back: a forgotten row stays a record of what the brain let go, and a JSON or
|
|
42
|
-
* SQLite export carries it, so leaving it out would add another forgotten copy at each import of such a file.
|
|
46
|
+
* SQLite export carries it, so leaving it out would add another forgotten copy at each import of such a file. An
|
|
47
|
+
* importer reads a source's live records before its forgotten ones (see {@link liveRecordsFirst}), so a forgotten trace
|
|
48
|
+
* the same import writes is never what makes a live record of its text a duplicate.
|
|
43
49
|
*
|
|
44
50
|
* @param brain - The brain the query runs on; its dialect reads the metadata.
|
|
45
51
|
* @returns A parenthesised condition on `memory_traces` with the three placeholders {@link duplicateTraceParams}
|
|
@@ -61,4 +67,78 @@ export function duplicateTraceCondition(brain) {
|
|
|
61
67
|
export function duplicateTraceParams(hash, content) {
|
|
62
68
|
return [hash, hash, content];
|
|
63
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* A source's trace records in the order an importer reads them: its live records, then its forgotten ones, each group
|
|
72
|
+
* in the source's order. A source can hold a forgotten and a live trace of one text in one scope and scope id:
|
|
73
|
+
* `forget()` and then `remember()` of the text leave them, and so does a consolidation merge of two traces of it. An
|
|
74
|
+
* export holds its rows in no set order. Read first, the live record is imported and the forgotten one is its
|
|
75
|
+
* duplicate, so the text arrives live; read the other way round, the live record would be the duplicate of the
|
|
76
|
+
* forgotten trace the same import had just written, and the text would arrive forgotten.
|
|
77
|
+
*
|
|
78
|
+
* @param records - The source's trace records, in its order.
|
|
79
|
+
* @param isForgotten - Whether a record is of a trace its source forgot.
|
|
80
|
+
* @returns The live records, then the forgotten ones.
|
|
81
|
+
*/
|
|
82
|
+
export function liveRecordsFirst(records, isForgotten) {
|
|
83
|
+
const live = [];
|
|
84
|
+
const forgotten = [];
|
|
85
|
+
for (const record of records)
|
|
86
|
+
(isForgotten(record) ? forgotten : live).push(record);
|
|
87
|
+
return live.concat(forgotten);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Whether a JSON or SQLite trace record is of a trace its source forgot: its `deleted` is present and not zero. A
|
|
91
|
+
* record whose `deleted` is absent or `null` is stored as live, as one whose `deleted` is `0` is.
|
|
92
|
+
*
|
|
93
|
+
* @param record - A trace record as its source holds it; a value that is not an object is not forgotten.
|
|
94
|
+
* @returns `true` when the record's `deleted` is present and not zero.
|
|
95
|
+
*/
|
|
96
|
+
export function isForgottenRecord(record) {
|
|
97
|
+
if (typeof record !== 'object' || record === null)
|
|
98
|
+
return false;
|
|
99
|
+
const deleted = record.deleted;
|
|
100
|
+
return deleted !== undefined && deleted !== null && Number(deleted) !== 0;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The `knowledge_nodes.type` of a memory-graph node (`SqlMemoryGraph`): the node of the trace whose id it carries as
|
|
104
|
+
* its own.
|
|
105
|
+
*/
|
|
106
|
+
export const MEMORY_GRAPH_NODE_TYPE = 'memory_graph';
|
|
107
|
+
/**
|
|
108
|
+
* How an import takes a memory-graph node its file holds, the node of the trace whose id it carries. The node comes in
|
|
109
|
+
* with its trace alone and under that id. It is skipped, and so are the edges that name it, when the file holds its
|
|
110
|
+
* trace and the import did not write that trace, or match it as a duplicate, under that id (the record merged into a
|
|
111
|
+
* trace of another id, was written under a new id, or failed), or when the brain holds no trace of that id; written
|
|
112
|
+
* there, the node would stand for a trace the brain does not hold. A node the brain holds under that id is the
|
|
113
|
+
* record's duplicate, and the edges that name the record's node name it; a node of another type under that id makes
|
|
114
|
+
* the record's node a skip, as it cannot take that id. Otherwise the node is written under that id.
|
|
115
|
+
*
|
|
116
|
+
* A record merged into a trace of another id brings no node and no edges: the brain's node of that trace keeps its own
|
|
117
|
+
* edges, and the record merged is most often a forgotten one (see {@link liveRecordsFirst}), whose edges its source no
|
|
118
|
+
* longer reads.
|
|
119
|
+
*
|
|
120
|
+
* @param trx - The import's transaction.
|
|
121
|
+
* @param brainId - The brain the import writes.
|
|
122
|
+
* @param nodeId - The node record's id, which is its trace's id.
|
|
123
|
+
* @param unfiled - Whether the file holds the trace of an id that the import did not write, or match as a duplicate,
|
|
124
|
+
* under that id.
|
|
125
|
+
* @returns `write` or `duplicate` with the id, or `skip`.
|
|
126
|
+
*/
|
|
127
|
+
export async function memoryGraphNodeImport(trx, brainId, nodeId, unfiled) {
|
|
128
|
+
if (typeof nodeId !== 'string' || unfiled(nodeId))
|
|
129
|
+
return { action: 'skip' };
|
|
130
|
+
const trace = await trx.get('SELECT id FROM memory_traces WHERE brain_id = ? AND id = ? LIMIT 1', [
|
|
131
|
+
brainId,
|
|
132
|
+
nodeId,
|
|
133
|
+
]);
|
|
134
|
+
if (!trace)
|
|
135
|
+
return { action: 'skip' };
|
|
136
|
+
const held = await trx.get('SELECT type FROM knowledge_nodes WHERE brain_id = ? AND id = ? LIMIT 1', [
|
|
137
|
+
brainId,
|
|
138
|
+
nodeId,
|
|
139
|
+
]);
|
|
140
|
+
if (!held)
|
|
141
|
+
return { action: 'write', id: nodeId };
|
|
142
|
+
return held.type === MEMORY_GRAPH_NODE_TYPE ? { action: 'duplicate', id: nodeId } : { action: 'skip' };
|
|
143
|
+
}
|
|
64
144
|
//# sourceMappingURL=importScope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importScope.js","sourceRoot":"","sources":["../../../../src/cognition/memory/io/importScope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"importScope.js","sourceRoot":"","sources":["../../../../src/cogn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EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACzG,CAAC"}
|
|
@@ -65,7 +65,9 @@ export interface Checkpoint {
|
|
|
65
65
|
/**
|
|
66
66
|
* Results recorded when this checkpoint was taken, keyed by node id: those of the
|
|
67
67
|
* nodes in `visitedNodes` and, in the checkpoint of a run that a node interrupted,
|
|
68
|
-
* that node's
|
|
68
|
+
* that node's, as in the checkpoint saved before an expansion that came after a
|
|
69
|
+
* `write`, `external` or `human` node. A node that failed records none, so a
|
|
70
|
+
* resume runs it again.
|
|
69
71
|
*/
|
|
70
72
|
nodeResults: Record<string, {
|
|
71
73
|
/** The node's declared effect class. */
|
|
@@ -74,6 +76,16 @@ export interface Checkpoint {
|
|
|
74
76
|
output: unknown;
|
|
75
77
|
/** Wall-clock execution time in milliseconds. */
|
|
76
78
|
durationMs: number;
|
|
79
|
+
/**
|
|
80
|
+
* The target the node picked itself, as a router, a guardrail that reroutes or
|
|
81
|
+
* the exit of a voice node does. A resume that marks the node complete with this
|
|
82
|
+
* result, as it does a `write`, `external` or `human` node such as a voice node,
|
|
83
|
+
* goes there rather than evaluating the node's edges. `routerNode()` and
|
|
84
|
+
* `guardrailNode()` build `pure` nodes, which a resume never marks complete from
|
|
85
|
+
* a recorded result: one the checkpoint does not list as completed runs again and
|
|
86
|
+
* picks its target anew.
|
|
87
|
+
*/
|
|
88
|
+
routeTarget?: string;
|
|
77
89
|
}>;
|
|
78
90
|
/** Ordered list of node ids that had completed execution when this checkpoint was taken. */
|
|
79
91
|
visitedNodes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICheckpointStore.d.ts","sourceRoot":"","sources":["../../../src/orchestration/checkpoint/ICheckpointStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGnG,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMzD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,KAAK,EAAE;QACL,8DAA8D;QAC9D,KAAK,EAAE,OAAO,CAAC;QACf,uEAAuE;QACvE,OAAO,EAAE,OAAO,CAAC;QACjB,+DAA+D;QAC/D,SAAS,EAAE,OAAO,CAAC;QACnB,8DAA8D;QAC9D,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;IAEF;;;OAGG;IACH,cAAc,CAAC,EAAE;QACf,2EAA2E;QAC3E,KAAK,EAAE,KAAK,CAAC;YACX,4CAA4C;YAC5C,OAAO,EAAE,MAAM,CAAC;YAChB,oCAAoC;YACpC,OAAO,EAAE,MAAM,CAAC;YAChB,2CAA2C;YAC3C,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC,CAAC;QACH,mFAAmF;QACnF,aAAa,EAAE,KAAK,CAAC;YACnB,yDAAyD;YACzD,IAAI,EAAE,MAAM,CAAC;YACb,qCAAqC;YACrC,OAAO,EAAE,MAAM,CAAC;YAChB,gDAAgD;YAChD,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ,CAAC;IAEF
|
|
1
|
+
{"version":3,"file":"ICheckpointStore.d.ts","sourceRoot":"","sources":["../../../src/orchestration/checkpoint/ICheckpointStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGnG,YAAY,EAAE,kBAAkB,EAAE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oint the runtime saved after the node and before it handed any of
|
|
73
|
+
* this step's expansion requests to the handler. The node's edges are decided
|
|
74
|
+
* after the expansion, on the graph it leaves, so the checkpoint does not list
|
|
75
|
+
* the node in `visitedNodes`, and a resume from it routes the node once by its
|
|
76
|
+
* edges. A `write`, `external` or `human` node keeps its result and what it
|
|
77
|
+
* wrote, and a resume marks it complete with its recorded output; a `pure` or
|
|
78
|
+
* `read` node is saved as it was before it ran, and a resume runs it again.
|
|
79
|
+
* After a parallel batch, whose nodes' edges are decided before the expansion,
|
|
80
|
+
* the checkpoint lists every node of the batch.
|
|
81
|
+
*/
|
|
71
82
|
checkpointIdBefore?: string;
|
|
72
83
|
completedNodes: string[];
|
|
73
84
|
skippedNodes: string[];
|
|
@@ -142,8 +153,10 @@ export declare class GraphRuntime {
|
|
|
142
153
|
* node of the batch runs to the end first, none of the batch's events is yielded,
|
|
143
154
|
* and the error is the first in the order the nodes are declared; a node of the
|
|
144
155
|
* batch counts as completed only once its edges are decided, so a node whose edges
|
|
145
|
-
* threw is in no checkpoint as completed.
|
|
146
|
-
*
|
|
156
|
+
* threw is in no checkpoint as completed. The checkpoint saved before an expansion
|
|
157
|
+
* does not list the node the expansion came after as completed either (see
|
|
158
|
+
* {@link GraphExpansionContext.checkpointIdBefore}). A resume by the `runId` of
|
|
159
|
+
* `run_start` continues from the last checkpoint the store saved.
|
|
147
160
|
*
|
|
148
161
|
* @param graph - Compiled execution graph to run.
|
|
149
162
|
* @param input - Initial user-provided input; frozen into `GraphState.input`.
|
|
@@ -163,8 +176,9 @@ export declare class GraphRuntime {
|
|
|
163
176
|
* evaluated on the restored state with the node's visit recorded
|
|
164
177
|
* (`currentNodeId` names the node and `visitedNodes` lists it), as a node's
|
|
165
178
|
* are after it runs, so the run follows the targets they pick and skips the
|
|
166
|
-
* others
|
|
167
|
-
*
|
|
179
|
+
* others; a replayed node that picked its target itself, as the exit of a voice
|
|
180
|
+
* node does, goes to the target its recorded result names. A node that failed
|
|
181
|
+
* recorded no result and wrote nothing, so it runs again, from the state it ran on.
|
|
168
182
|
*
|
|
169
183
|
* @param graph - The same compiled graph that was originally invoked.
|
|
170
184
|
* @param runOrCheckpointId - Either the original run id or an exact checkpoint id.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphRuntime.d.ts","sourceRoot":"","sources":["../../../src/orchestration/runtime/GraphRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"GraphRuntime.d.ts","sourceRoot":"","sources":["../../../src/orchestration/runtime/GraphRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAwB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5G,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,mCAAmC,CAAC;AAGtF,OAAO,EAAE,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAO3E;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,eAAe,EAAE,gBAAgB,CAAC;IAClC,iEAAiE;IACjE,YAAY,EAAE,YAAY,CAAC;IAC3B,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,eAAe,CAAC,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;YAAE,OAAO,CAAC,EAAE,KAAK,CAAC;gBAAE,EAAE,CAAC,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,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,CAAC;IAQ7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACI,MAAM,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC;IAorBxF;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,MAAM,CAAC,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQxF;;;;;;;;;;;;;OAaG;IACI,YAAY,CACjB,KAAK,EAAE,sBAAsB,EAC7B,iBAAiB,EAAE,MAAM,GACxB,cAAc,CAAC,UAAU,CAAC;IAuB7B;;;;;;;;;;;;OAYG;YACY,sBAAsB;IAsQrC;;;;;;;;;;;OAWG;YACW,aAAa;IA4F3B;;;;;;;;;;;;;;OAcG;YACW,cAAc;IAgC5B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,qBAAqB;CAK9B"}
|
|
@@ -113,8 +113,10 @@ export class GraphRuntime {
|
|
|
113
113
|
* node of the batch runs to the end first, none of the batch's events is yielded,
|
|
114
114
|
* and the error is the first in the order the nodes are declared; a node of the
|
|
115
115
|
* batch counts as completed only once its edges are decided, so a node whose edges
|
|
116
|
-
* threw is in no checkpoint as completed.
|
|
117
|
-
*
|
|
116
|
+
* threw is in no checkpoint as completed. The checkpoint saved before an expansion
|
|
117
|
+
* does not list the node the expansion came after as completed either (see
|
|
118
|
+
* {@link GraphExpansionContext.checkpointIdBefore}). A resume by the `runId` of
|
|
119
|
+
* `run_start` continues from the last checkpoint the store saved.
|
|
118
120
|
*
|
|
119
121
|
* @param graph - Compiled execution graph to run.
|
|
120
122
|
* @param input - Initial user-provided input; frozen into `GraphState.input`.
|
|
@@ -212,7 +214,7 @@ export class GraphRuntime {
|
|
|
212
214
|
// no result, so a resume executes it again.
|
|
213
215
|
const failed = !result.success && !result.interrupt;
|
|
214
216
|
if (!failed) {
|
|
215
|
-
nodeResults[nodeId] =
|
|
217
|
+
nodeResults[nodeId] = recordedResult(node, result, durationMs);
|
|
216
218
|
}
|
|
217
219
|
const scratchWrite = failed ? undefined : result.scratchUpdate;
|
|
218
220
|
if (scratchWrite) {
|
|
@@ -494,12 +496,10 @@ export class GraphRuntime {
|
|
|
494
496
|
// node again, whatever its effect class.
|
|
495
497
|
const failed = !result.success && !result.interrupt;
|
|
496
498
|
if (!failed) {
|
|
497
|
-
nodeResults[nodeId] =
|
|
498
|
-
effectClass: node.effectClass,
|
|
499
|
-
output: result.output,
|
|
500
|
-
durationMs,
|
|
501
|
-
};
|
|
499
|
+
nodeResults[nodeId] = recordedResult(node, result, durationMs);
|
|
502
500
|
}
|
|
501
|
+
// The state the node ran on, for the checkpoint saved before an expansion.
|
|
502
|
+
const stateBeforeWrites = state;
|
|
503
503
|
// Apply state patches produced by the node.
|
|
504
504
|
if (result.scratchUpdate && !failed) {
|
|
505
505
|
state = stateManager.updateScratch(state, result.scratchUpdate);
|
|
@@ -586,7 +586,12 @@ export class GraphRuntime {
|
|
|
586
586
|
let checkpointIdBefore;
|
|
587
587
|
for (const request of expansionRequests) {
|
|
588
588
|
if (!checkpointIdBefore) {
|
|
589
|
-
|
|
589
|
+
// The node's edges are decided after the expansion, so this
|
|
590
|
+
// checkpoint does not list it as completed: a resume from it
|
|
591
|
+
// routes the node once, rather than making every target of its
|
|
592
|
+
// edges ready.
|
|
593
|
+
const beforeExpansion = checkpointBeforeExpansion(node, state, stateBeforeWrites, nodeResults, completedNodes);
|
|
594
|
+
checkpointIdBefore = await this.saveCheckpoint(activeGraph, runId, nodeId, beforeExpansion.state, beforeExpansion.nodeResults, beforeExpansion.visitedNodes, skippedNodes, []);
|
|
590
595
|
state = this.attachCheckpointMetadata(state, checkpointIdBefore);
|
|
591
596
|
yield { type: 'checkpoint_saved', checkpointId: checkpointIdBefore, nodeId };
|
|
592
597
|
yield { type: 'mission:checkpoint_saved', checkpointId: checkpointIdBefore, nodeId };
|
|
@@ -658,8 +663,9 @@ export class GraphRuntime {
|
|
|
658
663
|
* evaluated on the restored state with the node's visit recorded
|
|
659
664
|
* (`currentNodeId` names the node and `visitedNodes` lists it), as a node's
|
|
660
665
|
* are after it runs, so the run follows the targets they pick and skips the
|
|
661
|
-
* others
|
|
662
|
-
*
|
|
666
|
+
* others; a replayed node that picked its target itself, as the exit of a voice
|
|
667
|
+
* node does, goes to the target its recorded result names. A node that failed
|
|
668
|
+
* recorded no result and wrote nothing, so it runs again, from the state it ran on.
|
|
663
669
|
*
|
|
664
670
|
* @param graph - The same compiled graph that was originally invoked.
|
|
665
671
|
* @param runOrCheckpointId - Either the original run id or an exact checkpoint id.
|
|
@@ -745,10 +751,7 @@ export class GraphRuntime {
|
|
|
745
751
|
// Nodes with side-effects that were recorded are replayed from stored output
|
|
746
752
|
// to prevent duplicate writes/calls.
|
|
747
753
|
const recorded = checkpoint.nodeResults[nodeId];
|
|
748
|
-
if (recorded &&
|
|
749
|
-
(recorded.effectClass === 'write' ||
|
|
750
|
-
recorded.effectClass === 'external' ||
|
|
751
|
-
recorded.effectClass === 'human')) {
|
|
754
|
+
if (recorded && REPLAYED_EFFECT_CLASSES.has(recorded.effectClass)) {
|
|
752
755
|
yield { type: 'node_end', nodeId, output: recorded.output, durationMs: recorded.durationMs };
|
|
753
756
|
// The node does not run again, but its edges still decide where the
|
|
754
757
|
// run goes, as after a node that runs: a condition reads the state
|
|
@@ -756,10 +759,11 @@ export class GraphRuntime {
|
|
|
756
759
|
// checkpoint it forked, and the targets the node does not pick are
|
|
757
760
|
// skipped. That state records the node's visit, as the state after
|
|
758
761
|
// a node runs does: `currentNodeId` names the node and
|
|
759
|
-
// `visitedNodes` lists it.
|
|
762
|
+
// `visitedNodes` lists it. A node that picked its target itself, as
|
|
763
|
+
// a voice node's exit does, goes to the target its result recorded.
|
|
760
764
|
state = stateManager.recordNodeVisit(state, nodeId);
|
|
761
765
|
const replayedEdges = activeGraph.edges.filter(e => e.source === nodeId);
|
|
762
|
-
const replayedTargets = await this.evaluateEdges(replayedEdges, state, { success: true, output: recorded.output });
|
|
766
|
+
const replayedTargets = await this.evaluateEdges(replayedEdges, state, { success: true, output: recorded.output, routeTarget: recorded.routeTarget });
|
|
763
767
|
for (const potentialTarget of replayedEdges.map(e => e.target)) {
|
|
764
768
|
if (!replayedTargets.includes(potentialTarget) &&
|
|
765
769
|
!completedNodes.includes(potentialTarget) &&
|
|
@@ -800,8 +804,10 @@ export class GraphRuntime {
|
|
|
800
804
|
// result, so a later resume executes it again.
|
|
801
805
|
const failed = !result.success && !result.interrupt;
|
|
802
806
|
if (!failed) {
|
|
803
|
-
nodeResults[nodeId] =
|
|
807
|
+
nodeResults[nodeId] = recordedResult(node, result, durationMs);
|
|
804
808
|
}
|
|
809
|
+
// The state the node ran on, for the checkpoint saved before an expansion.
|
|
810
|
+
const stateBeforeWrites = state;
|
|
805
811
|
if (result.scratchUpdate && !failed)
|
|
806
812
|
state = stateManager.updateScratch(state, result.scratchUpdate);
|
|
807
813
|
if (result.artifactsUpdate && !failed) {
|
|
@@ -873,7 +879,12 @@ export class GraphRuntime {
|
|
|
873
879
|
let checkpointIdBefore;
|
|
874
880
|
for (const request of expansionRequests) {
|
|
875
881
|
if (!checkpointIdBefore) {
|
|
876
|
-
|
|
882
|
+
// The node's edges are decided after the expansion, so this
|
|
883
|
+
// checkpoint does not list it as completed: a resume from it
|
|
884
|
+
// routes the node once, rather than making every target of its
|
|
885
|
+
// edges ready.
|
|
886
|
+
const beforeExpansion = checkpointBeforeExpansion(node, state, stateBeforeWrites, nodeResults, completedNodes);
|
|
887
|
+
checkpointIdBefore = await this.saveCheckpoint(activeGraph, runId, nodeId, beforeExpansion.state, beforeExpansion.nodeResults, beforeExpansion.visitedNodes, skippedNodes, []);
|
|
877
888
|
state = this.attachCheckpointMetadata(state, checkpointIdBefore);
|
|
878
889
|
yield { type: 'checkpoint_saved', checkpointId: checkpointIdBefore, nodeId };
|
|
879
890
|
yield { type: 'mission:checkpoint_saved', checkpointId: checkpointIdBefore, nodeId };
|
|
@@ -1141,6 +1152,60 @@ function resultsOf(nodeResults, nodeIds) {
|
|
|
1141
1152
|
.filter((id) => Object.prototype.hasOwnProperty.call(nodeResults, id))
|
|
1142
1153
|
.map((id) => [id, nodeResults[id]]));
|
|
1143
1154
|
}
|
|
1155
|
+
/**
|
|
1156
|
+
* The result the run records for a node that completed or interrupted, with the
|
|
1157
|
+
* target the node picked itself, when it did, so that a resume that marks the
|
|
1158
|
+
* node complete from it goes there.
|
|
1159
|
+
*
|
|
1160
|
+
* @param node - The node that ran.
|
|
1161
|
+
* @param result - What its executor returned.
|
|
1162
|
+
* @param durationMs - How long its last attempt took.
|
|
1163
|
+
*/
|
|
1164
|
+
function recordedResult(node, result, durationMs) {
|
|
1165
|
+
return {
|
|
1166
|
+
effectClass: node.effectClass,
|
|
1167
|
+
output: result.output,
|
|
1168
|
+
durationMs,
|
|
1169
|
+
...(result.routeTarget ? { routeTarget: result.routeTarget } : {}),
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* The effect classes of the nodes a resume marks complete with their recorded
|
|
1174
|
+
* output instead of running them again: a `write` or `external` node would
|
|
1175
|
+
* repeat what it did outside the graph, and a `human` node would ask again.
|
|
1176
|
+
*/
|
|
1177
|
+
const REPLAYED_EFFECT_CLASSES = new Set(['write', 'external', 'human']);
|
|
1178
|
+
/**
|
|
1179
|
+
* What the checkpoint saved before an expansion holds for the node after which
|
|
1180
|
+
* the runtime hands expansion requests to the handler.
|
|
1181
|
+
*
|
|
1182
|
+
* The node's edges are decided after the expansion, on the graph it leaves, and
|
|
1183
|
+
* a node counts as completed once its edges are decided, so the checkpoint
|
|
1184
|
+
* leaves the node out of `visitedNodes`: a resume from it routes the node once
|
|
1185
|
+
* by its edges. A node a resume marks complete with its recorded output keeps
|
|
1186
|
+
* its result and what it wrote, as in the checkpoint of a node that interrupts.
|
|
1187
|
+
* Any other node is saved as it was before it ran, with neither its result nor
|
|
1188
|
+
* its writes, so a resume runs it again on the state it ran on, where a reducer
|
|
1189
|
+
* does not count its writes twice, and the expansion requests it makes then go
|
|
1190
|
+
* to the handler.
|
|
1191
|
+
*
|
|
1192
|
+
* @param node - The node the expansion requests came after.
|
|
1193
|
+
* @param stateAfterNode - The run's state after the node ran.
|
|
1194
|
+
* @param stateBeforeNode - The state the node ran on.
|
|
1195
|
+
* @param nodeResults - The results recorded in the run, the node's included.
|
|
1196
|
+
* @param completedNodes - The nodes completed in the run, the node included.
|
|
1197
|
+
*/
|
|
1198
|
+
function checkpointBeforeExpansion(node, stateAfterNode, stateBeforeNode, nodeResults, completedNodes) {
|
|
1199
|
+
const visitedNodes = completedNodes.filter((id) => id !== node.id);
|
|
1200
|
+
if (REPLAYED_EFFECT_CLASSES.has(node.effectClass)) {
|
|
1201
|
+
return { state: stateAfterNode, nodeResults, visitedNodes };
|
|
1202
|
+
}
|
|
1203
|
+
return {
|
|
1204
|
+
state: stateBeforeNode,
|
|
1205
|
+
nodeResults: Object.fromEntries(Object.entries(nodeResults).filter(([resultNodeId]) => resultNodeId !== node.id)),
|
|
1206
|
+
visitedNodes,
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1144
1209
|
/**
|
|
1145
1210
|
* Promise-based sleep utility for retry backoff delays.
|
|
1146
1211
|
*
|