condukt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge/bridge.d.ts +34 -0
- package/dist/bridge/bridge.d.ts.map +1 -0
- package/dist/bridge/bridge.js +365 -0
- package/dist/bridge/bridge.js.map +1 -0
- package/dist/bridge/index.d.ts +3 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +6 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/runtimes/copilot/copilot-adapter.d.ts +28 -0
- package/dist/runtimes/copilot/copilot-adapter.d.ts.map +1 -0
- package/dist/runtimes/copilot/copilot-adapter.js +50 -0
- package/dist/runtimes/copilot/copilot-adapter.js.map +1 -0
- package/dist/runtimes/copilot/copilot-backend.d.ts +49 -0
- package/dist/runtimes/copilot/copilot-backend.d.ts.map +1 -0
- package/dist/runtimes/copilot/copilot-backend.js +13 -0
- package/dist/runtimes/copilot/copilot-backend.js.map +1 -0
- package/dist/runtimes/copilot/index.d.ts +5 -0
- package/dist/runtimes/copilot/index.d.ts.map +1 -0
- package/dist/runtimes/copilot/index.js +11 -0
- package/dist/runtimes/copilot/index.js.map +1 -0
- package/dist/runtimes/copilot/process-killer.d.ts +13 -0
- package/dist/runtimes/copilot/process-killer.d.ts.map +1 -0
- package/dist/runtimes/copilot/process-killer.js +77 -0
- package/dist/runtimes/copilot/process-killer.js.map +1 -0
- package/dist/runtimes/copilot/subprocess-backend.d.ts +26 -0
- package/dist/runtimes/copilot/subprocess-backend.d.ts.map +1 -0
- package/dist/runtimes/copilot/subprocess-backend.js +308 -0
- package/dist/runtimes/copilot/subprocess-backend.js.map +1 -0
- package/dist/runtimes/mock/index.d.ts +3 -0
- package/dist/runtimes/mock/index.d.ts.map +1 -0
- package/dist/runtimes/mock/index.js +6 -0
- package/dist/runtimes/mock/index.js.map +1 -0
- package/dist/runtimes/mock/mock-runtime.d.ts +43 -0
- package/dist/runtimes/mock/mock-runtime.d.ts.map +1 -0
- package/dist/runtimes/mock/mock-runtime.js +153 -0
- package/dist/runtimes/mock/mock-runtime.js.map +1 -0
- package/dist/src/agent.d.ts +35 -0
- package/dist/src/agent.d.ts.map +1 -0
- package/dist/src/agent.js +257 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/events.d.ts +153 -0
- package/dist/src/events.d.ts.map +1 -0
- package/dist/src/events.js +11 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/nodes.d.ts +63 -0
- package/dist/src/nodes.d.ts.map +1 -0
- package/dist/src/nodes.js +120 -0
- package/dist/src/nodes.js.map +1 -0
- package/dist/src/scheduler.d.ts +11 -0
- package/dist/src/scheduler.d.ts.map +1 -0
- package/dist/src/scheduler.js +478 -0
- package/dist/src/scheduler.js.map +1 -0
- package/dist/src/types.d.ts +201 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +38 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/verify.d.ts +51 -0
- package/dist/src/verify.d.ts.map +1 -0
- package/dist/src/verify.js +126 -0
- package/dist/src/verify.js.map +1 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +14 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/reducer.d.ts +11 -0
- package/dist/state/reducer.d.ts.map +1 -0
- package/dist/state/reducer.js +223 -0
- package/dist/state/reducer.js.map +1 -0
- package/dist/state/state-runtime.d.ts +30 -0
- package/dist/state/state-runtime.d.ts.map +1 -0
- package/dist/state/state-runtime.js +131 -0
- package/dist/state/state-runtime.js.map +1 -0
- package/dist/state/storage-memory.d.ts +24 -0
- package/dist/state/storage-memory.d.ts.map +1 -0
- package/dist/state/storage-memory.js +91 -0
- package/dist/state/storage-memory.js.map +1 -0
- package/dist/state/storage.d.ts +29 -0
- package/dist/state/storage.d.ts.map +1 -0
- package/dist/state/storage.js +175 -0
- package/dist/state/storage.js.map +1 -0
- package/dist/theme/index.d.ts +128 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +59 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/ui/ansi.d.ts +9 -0
- package/dist/ui/ansi.d.ts.map +1 -0
- package/dist/ui/ansi.js +78 -0
- package/dist/ui/ansi.js.map +1 -0
- package/dist/ui/components/FlowEdge.d.ts +5 -0
- package/dist/ui/components/FlowEdge.d.ts.map +1 -0
- package/dist/ui/components/FlowEdge.js +33 -0
- package/dist/ui/components/FlowEdge.js.map +1 -0
- package/dist/ui/components/FlowGraph.d.ts +10 -0
- package/dist/ui/components/FlowGraph.d.ts.map +1 -0
- package/dist/ui/components/FlowGraph.js +124 -0
- package/dist/ui/components/FlowGraph.js.map +1 -0
- package/dist/ui/components/FlowStatusBar.d.ts +7 -0
- package/dist/ui/components/FlowStatusBar.d.ts.map +1 -0
- package/dist/ui/components/FlowStatusBar.js +27 -0
- package/dist/ui/components/FlowStatusBar.js.map +1 -0
- package/dist/ui/components/MiniPipeline.d.ts +10 -0
- package/dist/ui/components/MiniPipeline.d.ts.map +1 -0
- package/dist/ui/components/MiniPipeline.js +155 -0
- package/dist/ui/components/MiniPipeline.js.map +1 -0
- package/dist/ui/components/NodeCard.d.ts +5 -0
- package/dist/ui/components/NodeCard.d.ts.map +1 -0
- package/dist/ui/components/NodeCard.js +39 -0
- package/dist/ui/components/NodeCard.js.map +1 -0
- package/dist/ui/components/NodeDetailPanel.d.ts +10 -0
- package/dist/ui/components/NodeDetailPanel.d.ts.map +1 -0
- package/dist/ui/components/NodeDetailPanel.js +38 -0
- package/dist/ui/components/NodeDetailPanel.js.map +1 -0
- package/dist/ui/components/node-panel/Controls.d.ts +16 -0
- package/dist/ui/components/node-panel/Controls.d.ts.map +1 -0
- package/dist/ui/components/node-panel/Controls.js +28 -0
- package/dist/ui/components/node-panel/Controls.js.map +1 -0
- package/dist/ui/components/node-panel/ErrorBar.d.ts +6 -0
- package/dist/ui/components/node-panel/ErrorBar.d.ts.map +1 -0
- package/dist/ui/components/node-panel/ErrorBar.js +14 -0
- package/dist/ui/components/node-panel/ErrorBar.js.map +1 -0
- package/dist/ui/components/node-panel/Gate.d.ts +13 -0
- package/dist/ui/components/node-panel/Gate.d.ts.map +1 -0
- package/dist/ui/components/node-panel/Gate.js +40 -0
- package/dist/ui/components/node-panel/Gate.js.map +1 -0
- package/dist/ui/components/node-panel/Header.d.ts +10 -0
- package/dist/ui/components/node-panel/Header.d.ts.map +1 -0
- package/dist/ui/components/node-panel/Header.js +19 -0
- package/dist/ui/components/node-panel/Header.js.map +1 -0
- package/dist/ui/components/node-panel/Info.d.ts +7 -0
- package/dist/ui/components/node-panel/Info.d.ts.map +1 -0
- package/dist/ui/components/node-panel/Info.js +23 -0
- package/dist/ui/components/node-panel/Info.js.map +1 -0
- package/dist/ui/components/node-panel/Output.d.ts +27 -0
- package/dist/ui/components/node-panel/Output.d.ts.map +1 -0
- package/dist/ui/components/node-panel/Output.js +66 -0
- package/dist/ui/components/node-panel/Output.js.map +1 -0
- package/dist/ui/components/node-panel/index.d.ts +47 -0
- package/dist/ui/components/node-panel/index.d.ts.map +1 -0
- package/dist/ui/components/node-panel/index.js +54 -0
- package/dist/ui/components/node-panel/index.js.map +1 -0
- package/dist/ui/components/node-panel/types.d.ts +23 -0
- package/dist/ui/components/node-panel/types.d.ts.map +1 -0
- package/dist/ui/components/node-panel/types.js +24 -0
- package/dist/ui/components/node-panel/types.js.map +1 -0
- package/dist/ui/core/components/Badge.d.ts +6 -0
- package/dist/ui/core/components/Badge.d.ts.map +1 -0
- package/dist/ui/core/components/Badge.js +11 -0
- package/dist/ui/core/components/Badge.js.map +1 -0
- package/dist/ui/core/components/Button.d.ts +9 -0
- package/dist/ui/core/components/Button.d.ts.map +1 -0
- package/dist/ui/core/components/Button.js +18 -0
- package/dist/ui/core/components/Button.js.map +1 -0
- package/dist/ui/core/components/ConfirmDialog.d.ts +11 -0
- package/dist/ui/core/components/ConfirmDialog.d.ts.map +1 -0
- package/dist/ui/core/components/ConfirmDialog.js +23 -0
- package/dist/ui/core/components/ConfirmDialog.js.map +1 -0
- package/dist/ui/core/components/ExecutionCard.d.ts +12 -0
- package/dist/ui/core/components/ExecutionCard.d.ts.map +1 -0
- package/dist/ui/core/components/ExecutionCard.js +15 -0
- package/dist/ui/core/components/ExecutionCard.js.map +1 -0
- package/dist/ui/core/components/NodeListItem.d.ts +10 -0
- package/dist/ui/core/components/NodeListItem.d.ts.map +1 -0
- package/dist/ui/core/components/NodeListItem.js +27 -0
- package/dist/ui/core/components/NodeListItem.js.map +1 -0
- package/dist/ui/core/components/PageHeader.d.ts +10 -0
- package/dist/ui/core/components/PageHeader.d.ts.map +1 -0
- package/dist/ui/core/components/PageHeader.js +9 -0
- package/dist/ui/core/components/PageHeader.js.map +1 -0
- package/dist/ui/core/components/SectionLabel.d.ts +6 -0
- package/dist/ui/core/components/SectionLabel.d.ts.map +1 -0
- package/dist/ui/core/components/SectionLabel.js +9 -0
- package/dist/ui/core/components/SectionLabel.js.map +1 -0
- package/dist/ui/core/components/Skeleton.d.ts +7 -0
- package/dist/ui/core/components/Skeleton.d.ts.map +1 -0
- package/dist/ui/core/components/Skeleton.js +26 -0
- package/dist/ui/core/components/Skeleton.js.map +1 -0
- package/dist/ui/core/components/Stat.d.ts +8 -0
- package/dist/ui/core/components/Stat.d.ts.map +1 -0
- package/dist/ui/core/components/Stat.js +9 -0
- package/dist/ui/core/components/Stat.js.map +1 -0
- package/dist/ui/core/components/Toast.d.ts +7 -0
- package/dist/ui/core/components/Toast.d.ts.map +1 -0
- package/dist/ui/core/components/Toast.js +28 -0
- package/dist/ui/core/components/Toast.js.map +1 -0
- package/dist/ui/core/components/__tests__/primitives.test.d.ts +2 -0
- package/dist/ui/core/components/__tests__/primitives.test.d.ts.map +1 -0
- package/dist/ui/core/components/__tests__/primitives.test.js +3 -0
- package/dist/ui/core/components/__tests__/primitives.test.js.map +1 -0
- package/dist/ui/core/components/index.d.ts +21 -0
- package/dist/ui/core/components/index.d.ts.map +1 -0
- package/dist/ui/core/components/index.js +24 -0
- package/dist/ui/core/components/index.js.map +1 -0
- package/dist/ui/core/index.d.ts +17 -0
- package/dist/ui/core/index.d.ts.map +1 -0
- package/dist/ui/core/index.js +56 -0
- package/dist/ui/core/index.js.map +1 -0
- package/dist/ui/core/utils.d.ts +6 -0
- package/dist/ui/core/utils.d.ts.map +1 -0
- package/dist/ui/core/utils.js +32 -0
- package/dist/ui/core/utils.js.map +1 -0
- package/dist/ui/graph/index.d.ts +4 -0
- package/dist/ui/graph/index.d.ts.map +1 -0
- package/dist/ui/graph/index.js +11 -0
- package/dist/ui/graph/index.js.map +1 -0
- package/dist/ui/hooks/useAutoSelectNode.d.ts +3 -0
- package/dist/ui/hooks/useAutoSelectNode.d.ts.map +1 -0
- package/dist/ui/hooks/useAutoSelectNode.js +36 -0
- package/dist/ui/hooks/useAutoSelectNode.js.map +1 -0
- package/dist/ui/hooks/useFlowExecution.d.ts +32 -0
- package/dist/ui/hooks/useFlowExecution.d.ts.map +1 -0
- package/dist/ui/hooks/useFlowExecution.js +113 -0
- package/dist/ui/hooks/useFlowExecution.js.map +1 -0
- package/dist/ui/hooks/useNodeNavigation.d.ts +3 -0
- package/dist/ui/hooks/useNodeNavigation.d.ts.map +1 -0
- package/dist/ui/hooks/useNodeNavigation.js +38 -0
- package/dist/ui/hooks/useNodeNavigation.js.map +1 -0
- package/dist/ui/hooks/useNodeOutput.d.ts +21 -0
- package/dist/ui/hooks/useNodeOutput.d.ts.map +1 -0
- package/dist/ui/hooks/useNodeOutput.js +75 -0
- package/dist/ui/hooks/useNodeOutput.js.map +1 -0
- package/dist/ui/index.d.ts +16 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +37 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/utils.d.ts +3 -0
- package/dist/ui/utils.d.ts.map +1 -0
- package/dist/ui/utils.js +9 -0
- package/dist/ui/utils.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Non-agent node factories: deterministic() and gate().
|
|
4
|
+
*
|
|
5
|
+
* deterministic() — wraps a pure function as a NodeFn (ignores ExecutionContext).
|
|
6
|
+
* gate() — returns a blocking NodeFn resolved externally via resolveGate().
|
|
7
|
+
*
|
|
8
|
+
* Gate mechanism:
|
|
9
|
+
* 1. gate() creates a Promise + resolver, stores in module-level gateRegistry
|
|
10
|
+
* 2. The scheduler dispatches the gate node; it blocks on the Promise
|
|
11
|
+
* 3. External code (bridge/API) calls resolveGate() to unblock
|
|
12
|
+
* 4. The scheduler sees the gate complete normally and proceeds
|
|
13
|
+
*
|
|
14
|
+
* Gate nodes listen for abort signals so they can be cleanly cancelled.
|
|
15
|
+
* The gate registry is module-level (survives across requests but not restarts).
|
|
16
|
+
* Restart recovery: the scheduler re-dispatches gate nodes, creating fresh resolvers (CR4).
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.deterministic = deterministic;
|
|
20
|
+
exports._getGateRegistryForTesting = _getGateRegistryForTesting;
|
|
21
|
+
exports.gate = gate;
|
|
22
|
+
exports.resolveGate = resolveGate;
|
|
23
|
+
const types_1 = require("./types");
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Deterministic node factory
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Wraps a pure async function as a NodeFn.
|
|
29
|
+
* The ExecutionContext is available but typically unused — deterministic nodes
|
|
30
|
+
* don't need runtime services or streaming output.
|
|
31
|
+
*
|
|
32
|
+
* @param _name - Display name (used for logging/debugging, not stored here)
|
|
33
|
+
* @param fn - The computation. Receives NodeInput, returns NodeOutput.
|
|
34
|
+
*/
|
|
35
|
+
function deterministic(_name, fn) {
|
|
36
|
+
return async (input, _ctx) => {
|
|
37
|
+
return fn(input);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const GATE_REGISTRY_KEY = Symbol.for('__flow_gate_registry__');
|
|
41
|
+
/** globalThis-backed registry: survives HMR, separate entry points, bundler dedup. */
|
|
42
|
+
function getGateRegistry() {
|
|
43
|
+
const g = globalThis;
|
|
44
|
+
if (!g[GATE_REGISTRY_KEY]) {
|
|
45
|
+
g[GATE_REGISTRY_KEY] = new Map();
|
|
46
|
+
}
|
|
47
|
+
return g[GATE_REGISTRY_KEY];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Expose the registry for testing purposes only.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
function _getGateRegistryForTesting() {
|
|
54
|
+
return getGateRegistry();
|
|
55
|
+
}
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Gate node factory
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* Creates a NodeFn that blocks until externally resolved via resolveGate().
|
|
61
|
+
*
|
|
62
|
+
* The gate:
|
|
63
|
+
* - Registers a Promise resolver in the module-level gateRegistry
|
|
64
|
+
* - Blocks (awaits the Promise) until resolveGate() is called
|
|
65
|
+
* - Listens for abort signal to clean up on cancellation
|
|
66
|
+
* - Returns { action: resolution } when resolved (e.g., 'approved', 'rejected')
|
|
67
|
+
*
|
|
68
|
+
* The scheduler emits node:gated after dispatching gate-type nodes.
|
|
69
|
+
* The bridge emits gate:resolved when calling resolveGate().
|
|
70
|
+
*
|
|
71
|
+
* @param name - Optional gate type name (e.g., 'approval', 'quality-review').
|
|
72
|
+
* Used by the scheduler for the node:gated event's gateType field.
|
|
73
|
+
*/
|
|
74
|
+
function gate(name) {
|
|
75
|
+
// The name is captured in the closure but only used for documentation/debugging.
|
|
76
|
+
// The scheduler reads the nodeType from NodeEntry to determine gate behavior.
|
|
77
|
+
void name;
|
|
78
|
+
return async (_input, ctx) => {
|
|
79
|
+
const key = `${ctx.executionId}:${ctx.nodeId}`;
|
|
80
|
+
// Abort check: bail early if already aborted
|
|
81
|
+
if (ctx.signal.aborted) {
|
|
82
|
+
throw new types_1.FlowAbortedError('Gate aborted before registration');
|
|
83
|
+
}
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
const registry = getGateRegistry();
|
|
86
|
+
// Register resolver in the gate registry
|
|
87
|
+
registry.set(key, { resolve, reject });
|
|
88
|
+
// Listen for abort signal — clean up and reject if cancelled (AI-3: prevents memory leak)
|
|
89
|
+
const onAbort = () => {
|
|
90
|
+
registry.delete(key);
|
|
91
|
+
reject(new types_1.FlowAbortedError('Gate aborted'));
|
|
92
|
+
};
|
|
93
|
+
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Gate resolution (called by bridge from API endpoint)
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
/**
|
|
101
|
+
* Resolves a waiting gate node, unblocking the scheduler.
|
|
102
|
+
*
|
|
103
|
+
* @param executionId - The execution containing the gate
|
|
104
|
+
* @param nodeId - The gate node's ID
|
|
105
|
+
* @param resolution - The action string (e.g., 'approved', 'rejected')
|
|
106
|
+
* @param _reason - Optional human-readable reason (for audit, not used in output)
|
|
107
|
+
* @returns true if the gate was found and resolved, false otherwise
|
|
108
|
+
*/
|
|
109
|
+
function resolveGate(executionId, nodeId, resolution, _reason) {
|
|
110
|
+
const key = `${executionId}:${nodeId}`;
|
|
111
|
+
const registry = getGateRegistry();
|
|
112
|
+
const entry = registry.get(key);
|
|
113
|
+
if (!entry) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
entry.resolve({ action: resolution });
|
|
117
|
+
registry.delete(key);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,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3
|
+
*
|
|
4
|
+
* Stateless: emits events via callbacks, reads/writes artifacts to dir.
|
|
5
|
+
* The only mutable state is the per-run tracking (completed, firedEdges, pending).
|
|
6
|
+
*/
|
|
7
|
+
import type { FlowGraph, RunOptions, RunResult, ResumeState } from './types';
|
|
8
|
+
export declare function validateGraph(graph: FlowGraph): void;
|
|
9
|
+
export declare function computeFrontier(graph: FlowGraph, state: ResumeState): string[];
|
|
10
|
+
export declare function run(graph: FlowGraph, options: RunOptions): Promise<RunResult>;
|
|
11
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/scheduler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,SAAS,EAKT,UAAU,EACV,SAAS,EACT,WAAW,EACZ,MAAM,SAAS,CAAC;AAYjB,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CA2CpD;AAMD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,WAAW,GACjB,MAAM,EAAE,CA8BV;AAyED,wBAAsB,GAAG,CACvB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,SAAS,CAAC,CAuWpB"}
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Flow scheduler — graph walker, node dispatcher, fan-in tracker.
|
|
4
|
+
*
|
|
5
|
+
* Stateless: emits events via callbacks, reads/writes artifacts to dir.
|
|
6
|
+
* The only mutable state is the per-run tracking (completed, firedEdges, pending).
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.validateGraph = validateGraph;
|
|
43
|
+
exports.computeFrontier = computeFrontier;
|
|
44
|
+
exports.run = run;
|
|
45
|
+
const fs = __importStar(require("node:fs"));
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const types_1 = require("./types");
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Validation
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
function validateGraph(graph) {
|
|
52
|
+
const issues = [];
|
|
53
|
+
const nodeIds = new Set(Object.keys(graph.nodes));
|
|
54
|
+
// Start nodes must exist
|
|
55
|
+
for (const startId of graph.start) {
|
|
56
|
+
if (!nodeIds.has(startId)) {
|
|
57
|
+
issues.push(`Start node '${startId}' does not exist in graph.nodes`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Edge sources and targets must exist (target may be 'end')
|
|
61
|
+
for (const [source, actionMap] of Object.entries(graph.edges)) {
|
|
62
|
+
if (!nodeIds.has(source)) {
|
|
63
|
+
issues.push(`Edge source '${source}' does not exist in graph.nodes`);
|
|
64
|
+
}
|
|
65
|
+
for (const [action, target] of Object.entries(actionMap)) {
|
|
66
|
+
if (target !== 'end' && !nodeIds.has(target)) {
|
|
67
|
+
issues.push(`Edge target '${target}' (from '${source}' via '${action}') does not exist in graph.nodes`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// No duplicate output filenames across nodes
|
|
72
|
+
const outputs = new Map();
|
|
73
|
+
for (const [nodeId, entry] of Object.entries(graph.nodes)) {
|
|
74
|
+
if (entry.output) {
|
|
75
|
+
const existing = outputs.get(entry.output);
|
|
76
|
+
if (existing) {
|
|
77
|
+
issues.push(`Duplicate output filename '${entry.output}' on nodes '${existing}' and '${nodeId}'`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
outputs.set(entry.output, nodeId);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (issues.length > 0) {
|
|
85
|
+
throw new types_1.FlowValidationError(issues);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Frontier computation (used by bridge for resume/retry)
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
function computeFrontier(graph, state) {
|
|
92
|
+
const frontier = [];
|
|
93
|
+
const completedSet = new Set(state.completedNodes.keys());
|
|
94
|
+
// Start nodes that haven't completed
|
|
95
|
+
for (const startId of graph.start) {
|
|
96
|
+
if (!completedSet.has(startId)) {
|
|
97
|
+
frontier.push(startId);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Nodes reachable via fired edges where all sources completed
|
|
101
|
+
for (const [target, sources] of state.firedEdges) {
|
|
102
|
+
if (completedSet.has(target))
|
|
103
|
+
continue;
|
|
104
|
+
// Already in frontier from start check
|
|
105
|
+
if (frontier.includes(target))
|
|
106
|
+
continue;
|
|
107
|
+
let allSourcesCompleted = true;
|
|
108
|
+
for (const src of sources) {
|
|
109
|
+
if (!completedSet.has(src)) {
|
|
110
|
+
allSourcesCompleted = false;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (allSourcesCompleted) {
|
|
115
|
+
frontier.push(target);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return frontier;
|
|
119
|
+
}
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Graph skeleton extraction
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
function extractSkeleton(graph) {
|
|
124
|
+
const nodes = Object.entries(graph.nodes).map(([id, entry]) => ({
|
|
125
|
+
id,
|
|
126
|
+
displayName: entry.displayName,
|
|
127
|
+
nodeType: entry.nodeType,
|
|
128
|
+
model: entry.model,
|
|
129
|
+
output: entry.output,
|
|
130
|
+
}));
|
|
131
|
+
const edges = [];
|
|
132
|
+
for (const [source, actionMap] of Object.entries(graph.edges)) {
|
|
133
|
+
for (const [action, target] of Object.entries(actionMap)) {
|
|
134
|
+
edges.push({ source, action, target });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return { nodes, edges };
|
|
138
|
+
}
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Timeout helper
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
function rejectAfterTimeout(seconds, signal) {
|
|
143
|
+
let timer;
|
|
144
|
+
const promise = new Promise((_resolve, reject) => {
|
|
145
|
+
timer = setTimeout(() => reject(new Error(`Node timed out after ${seconds}s`)), seconds * 1000);
|
|
146
|
+
// Also clear timer on abort to prevent leaks
|
|
147
|
+
signal.addEventListener('abort', () => clearTimeout(timer), { once: true });
|
|
148
|
+
});
|
|
149
|
+
return { promise, clear: () => clearTimeout(timer) };
|
|
150
|
+
}
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Artifact path resolver
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
function resolveArtifactPaths(reads, dir, outputMap) {
|
|
155
|
+
const result = {};
|
|
156
|
+
if (!reads)
|
|
157
|
+
return result;
|
|
158
|
+
for (const filename of reads) {
|
|
159
|
+
if (outputMap.has(filename)) {
|
|
160
|
+
result[filename] = path.join(dir, filename);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Main run loop
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
async function run(graph, options) {
|
|
169
|
+
validateGraph(graph);
|
|
170
|
+
const { executionId, dir, params, runtime, emitState, emitOutput, signal, resumeFrom, retryContexts, } = options;
|
|
171
|
+
const skeleton = extractSkeleton(graph);
|
|
172
|
+
const startTime = Date.now();
|
|
173
|
+
// I5 fix: Only emit run:started for fresh runs, not resume/retry
|
|
174
|
+
if (!resumeFrom) {
|
|
175
|
+
await emitState({
|
|
176
|
+
type: 'run:started',
|
|
177
|
+
executionId,
|
|
178
|
+
flowId: '',
|
|
179
|
+
params: { ...params },
|
|
180
|
+
graph: skeleton,
|
|
181
|
+
ts: Date.now(),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// Build output map: filename → nodeId (for artifact resolution)
|
|
185
|
+
const outputMap = new Map();
|
|
186
|
+
for (const [nodeId, entry] of Object.entries(graph.nodes)) {
|
|
187
|
+
if (entry.output) {
|
|
188
|
+
outputMap.set(entry.output, nodeId);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Internal state
|
|
192
|
+
const completed = new Map();
|
|
193
|
+
const firedEdges = new Map(); // target → sources
|
|
194
|
+
const nodeStatuses = new Map();
|
|
195
|
+
const failedNodes = new Set();
|
|
196
|
+
let pending;
|
|
197
|
+
if (resumeFrom) {
|
|
198
|
+
// Pre-populate from resume state
|
|
199
|
+
for (const [nodeId, info] of resumeFrom.completedNodes) {
|
|
200
|
+
completed.set(nodeId, info);
|
|
201
|
+
}
|
|
202
|
+
for (const [target, sources] of resumeFrom.firedEdges) {
|
|
203
|
+
firedEdges.set(target, new Set(sources));
|
|
204
|
+
}
|
|
205
|
+
for (const [nodeId, status] of resumeFrom.nodeStatuses) {
|
|
206
|
+
nodeStatuses.set(nodeId, status);
|
|
207
|
+
}
|
|
208
|
+
// Compute frontier for resume
|
|
209
|
+
pending = computeFrontier(graph, resumeFrom);
|
|
210
|
+
await emitState({
|
|
211
|
+
type: 'run:resumed',
|
|
212
|
+
executionId,
|
|
213
|
+
resumingFrom: [...pending],
|
|
214
|
+
ts: Date.now(),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
pending = [...graph.start];
|
|
219
|
+
}
|
|
220
|
+
// Main loop
|
|
221
|
+
while (pending.length > 0) {
|
|
222
|
+
// Check abort before each batch
|
|
223
|
+
if (signal.aborted) {
|
|
224
|
+
for (const nodeId of pending) {
|
|
225
|
+
await emitState({
|
|
226
|
+
type: 'node:killed',
|
|
227
|
+
executionId,
|
|
228
|
+
nodeId,
|
|
229
|
+
ts: Date.now(),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
await emitState({
|
|
233
|
+
type: 'run:completed',
|
|
234
|
+
executionId,
|
|
235
|
+
status: 'stopped',
|
|
236
|
+
ts: Date.now(),
|
|
237
|
+
});
|
|
238
|
+
throw new types_1.FlowAbortedError('Flow aborted');
|
|
239
|
+
}
|
|
240
|
+
// Emit node:started for all pending nodes first
|
|
241
|
+
for (const nodeId of pending) {
|
|
242
|
+
await emitState({
|
|
243
|
+
type: 'node:started',
|
|
244
|
+
executionId,
|
|
245
|
+
nodeId,
|
|
246
|
+
ts: Date.now(),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
// C2 fix: emit node:gated for gate-type nodes so frontend knows they're waiting
|
|
250
|
+
for (const nodeId of pending) {
|
|
251
|
+
const entry = graph.nodes[nodeId];
|
|
252
|
+
if (entry.nodeType === 'gate') {
|
|
253
|
+
await emitState({
|
|
254
|
+
type: 'node:gated',
|
|
255
|
+
executionId,
|
|
256
|
+
nodeId,
|
|
257
|
+
gateType: 'approval',
|
|
258
|
+
ts: Date.now(),
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// Dispatch all pending nodes in parallel
|
|
263
|
+
const batchResults = await Promise.allSettled(pending.map(async (nodeId) => {
|
|
264
|
+
const entry = graph.nodes[nodeId];
|
|
265
|
+
// Delete stale artifact before dispatch
|
|
266
|
+
if (entry.output) {
|
|
267
|
+
const artifactPath = path.join(dir, entry.output);
|
|
268
|
+
try {
|
|
269
|
+
if (fs.existsSync(artifactPath)) {
|
|
270
|
+
fs.unlinkSync(artifactPath);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
// ignore
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// Resolve artifact paths for reads
|
|
278
|
+
const artifactPaths = resolveArtifactPaths(entry.reads, dir, outputMap);
|
|
279
|
+
// PARITY-1: Build NodeInput with retryContext from RunOptions if present
|
|
280
|
+
const nodeInput = {
|
|
281
|
+
dir,
|
|
282
|
+
params,
|
|
283
|
+
artifactPaths,
|
|
284
|
+
retryContext: retryContexts?.[nodeId],
|
|
285
|
+
};
|
|
286
|
+
// Build ExecutionContext
|
|
287
|
+
const execCtx = {
|
|
288
|
+
executionId,
|
|
289
|
+
nodeId,
|
|
290
|
+
runtime,
|
|
291
|
+
emitOutput,
|
|
292
|
+
signal,
|
|
293
|
+
};
|
|
294
|
+
const nodeStart = Date.now();
|
|
295
|
+
const timeoutSecs = entry.timeout ?? 3600;
|
|
296
|
+
// Dispatch with timeout (CR3: applies to ALL node types)
|
|
297
|
+
// C3 fix: clear timer when node completes to prevent leaks
|
|
298
|
+
const timeout = rejectAfterTimeout(timeoutSecs, signal);
|
|
299
|
+
try {
|
|
300
|
+
const output = await Promise.race([
|
|
301
|
+
entry.fn(nodeInput, execCtx),
|
|
302
|
+
timeout.promise,
|
|
303
|
+
]);
|
|
304
|
+
timeout.clear();
|
|
305
|
+
const elapsedMs = Date.now() - nodeStart;
|
|
306
|
+
return { nodeId, output, elapsedMs, entry };
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
timeout.clear();
|
|
310
|
+
throw err;
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
313
|
+
// Abort check after batch: if signal was aborted during batch (e.g., gate abort),
|
|
314
|
+
// treat all rejected nodes as killed and stop
|
|
315
|
+
if (signal.aborted) {
|
|
316
|
+
for (let i = 0; i < pending.length; i++) {
|
|
317
|
+
const nodeId = pending[i];
|
|
318
|
+
const result = batchResults[i];
|
|
319
|
+
if (result.status === 'rejected') {
|
|
320
|
+
await emitState({
|
|
321
|
+
type: 'node:killed',
|
|
322
|
+
executionId,
|
|
323
|
+
nodeId,
|
|
324
|
+
ts: Date.now(),
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
const { output, elapsedMs, entry } = result.value;
|
|
329
|
+
await emitState({
|
|
330
|
+
type: 'node:completed',
|
|
331
|
+
executionId,
|
|
332
|
+
nodeId,
|
|
333
|
+
action: output.action,
|
|
334
|
+
elapsedMs,
|
|
335
|
+
ts: Date.now(),
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
await emitState({
|
|
340
|
+
type: 'run:completed',
|
|
341
|
+
executionId,
|
|
342
|
+
status: 'stopped',
|
|
343
|
+
ts: Date.now(),
|
|
344
|
+
});
|
|
345
|
+
throw new types_1.FlowAbortedError('Flow aborted');
|
|
346
|
+
}
|
|
347
|
+
// Phase 1: Record completions + fire edges
|
|
348
|
+
const newlyCompleted = [];
|
|
349
|
+
for (let i = 0; i < pending.length; i++) {
|
|
350
|
+
const nodeId = pending[i];
|
|
351
|
+
const result = batchResults[i];
|
|
352
|
+
if (result.status === 'fulfilled') {
|
|
353
|
+
const { output, elapsedMs, entry } = result.value;
|
|
354
|
+
// Emit node:completed
|
|
355
|
+
await emitState({
|
|
356
|
+
type: 'node:completed',
|
|
357
|
+
executionId,
|
|
358
|
+
nodeId,
|
|
359
|
+
action: output.action,
|
|
360
|
+
elapsedMs,
|
|
361
|
+
ts: Date.now(),
|
|
362
|
+
});
|
|
363
|
+
// Write artifact if present
|
|
364
|
+
if (output.artifact && entry.output) {
|
|
365
|
+
const artifactPath = path.join(dir, entry.output);
|
|
366
|
+
fs.writeFileSync(artifactPath, output.artifact, 'utf-8');
|
|
367
|
+
await emitState({
|
|
368
|
+
type: 'artifact:written',
|
|
369
|
+
executionId,
|
|
370
|
+
nodeId,
|
|
371
|
+
path: artifactPath,
|
|
372
|
+
size: output.artifact.length,
|
|
373
|
+
ts: Date.now(),
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
// Emit metadata events
|
|
377
|
+
if (output.metadata) {
|
|
378
|
+
for (const [key, value] of Object.entries(output.metadata)) {
|
|
379
|
+
await emitState({
|
|
380
|
+
type: 'metadata',
|
|
381
|
+
executionId,
|
|
382
|
+
key,
|
|
383
|
+
value,
|
|
384
|
+
ts: Date.now(),
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
completed.set(nodeId, {
|
|
389
|
+
action: output.action,
|
|
390
|
+
finishedAt: Date.now(),
|
|
391
|
+
});
|
|
392
|
+
nodeStatuses.set(nodeId, 'completed');
|
|
393
|
+
newlyCompleted.push({ nodeId, output, elapsedMs, entry });
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
// Node failed
|
|
397
|
+
const error = result.reason instanceof Error
|
|
398
|
+
? result.reason.message
|
|
399
|
+
: String(result.reason);
|
|
400
|
+
await emitState({
|
|
401
|
+
type: 'node:failed',
|
|
402
|
+
executionId,
|
|
403
|
+
nodeId,
|
|
404
|
+
error,
|
|
405
|
+
ts: Date.now(),
|
|
406
|
+
});
|
|
407
|
+
failedNodes.add(nodeId);
|
|
408
|
+
nodeStatuses.set(nodeId, 'failed');
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// Phase 1b: Fire edges for all completed nodes
|
|
412
|
+
for (const { nodeId, output } of newlyCompleted) {
|
|
413
|
+
const edgeMap = graph.edges[nodeId];
|
|
414
|
+
if (!edgeMap)
|
|
415
|
+
continue; // terminal node, no outgoing edges
|
|
416
|
+
let target = edgeMap[output.action];
|
|
417
|
+
if (!target) {
|
|
418
|
+
target = edgeMap['default'];
|
|
419
|
+
}
|
|
420
|
+
if (target && target !== 'end') {
|
|
421
|
+
// Record fired edge
|
|
422
|
+
let sources = firedEdges.get(target);
|
|
423
|
+
if (!sources) {
|
|
424
|
+
sources = new Set();
|
|
425
|
+
firedEdges.set(target, sources);
|
|
426
|
+
}
|
|
427
|
+
sources.add(nodeId);
|
|
428
|
+
await emitState({
|
|
429
|
+
type: 'edge:traversed',
|
|
430
|
+
executionId,
|
|
431
|
+
source: nodeId,
|
|
432
|
+
target,
|
|
433
|
+
action: output.action,
|
|
434
|
+
ts: Date.now(),
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
// If no matching edge at all: terminal node (flow ends here for this path)
|
|
438
|
+
}
|
|
439
|
+
// Phase 2: Determine which nodes are newly ready
|
|
440
|
+
const nextPending = [];
|
|
441
|
+
const completedSet = new Set(completed.keys());
|
|
442
|
+
const pendingSet = new Set(pending);
|
|
443
|
+
for (const [target, sources] of firedEdges) {
|
|
444
|
+
if (completedSet.has(target))
|
|
445
|
+
continue;
|
|
446
|
+
if (pendingSet.has(target))
|
|
447
|
+
continue;
|
|
448
|
+
if (nextPending.includes(target))
|
|
449
|
+
continue;
|
|
450
|
+
// Check: all sources that fired toward this target must be completed
|
|
451
|
+
let allReady = true;
|
|
452
|
+
for (const src of sources) {
|
|
453
|
+
if (!completedSet.has(src)) {
|
|
454
|
+
allReady = false;
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (allReady) {
|
|
459
|
+
nextPending.push(target);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
pending = nextPending;
|
|
463
|
+
}
|
|
464
|
+
// Determine final status
|
|
465
|
+
const status = failedNodes.size > 0 ? 'failed' : 'completed';
|
|
466
|
+
const durationMs = Date.now() - startTime;
|
|
467
|
+
await emitState({
|
|
468
|
+
type: 'run:completed',
|
|
469
|
+
executionId,
|
|
470
|
+
status,
|
|
471
|
+
ts: Date.now(),
|
|
472
|
+
});
|
|
473
|
+
return {
|
|
474
|
+
completed: status === 'completed',
|
|
475
|
+
durationMs,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/scheduler.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,sCA2CC;AAMD,0CAiCC;AAyED,kBA0WC;AA5hBD,4CAA8B;AAC9B,gDAAkC;AAWlC,mCAAgE;AAOhE,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,SAAgB,aAAa,CAAC,KAAgB;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElD,yBAAyB;IACzB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,EA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