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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge — orchestration layer between flow framework and external consumers (API, CLI).
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* - Launch: concurrency check, dedup, dir creation, scheduler.run()
|
|
6
|
+
* - Stop: abort signal, mark running nodes as killed
|
|
7
|
+
* - Resume: rebuild ResumeState from projection, computeFrontier, run
|
|
8
|
+
* - Retry: reset target + downstream, assemble RetryContext, computeFrontier, run
|
|
9
|
+
* - Skip: emit node:skipped
|
|
10
|
+
* - Approve gate: resolve pending gate, emit gate:resolved
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentRuntime, ExecutionProjection, FlowGraph } from '../src/types';
|
|
13
|
+
import type { StateRuntime } from '../state/state-runtime';
|
|
14
|
+
export interface BridgeApi {
|
|
15
|
+
launch(params: LaunchParams): Promise<string>;
|
|
16
|
+
stop(executionId: string): Promise<void>;
|
|
17
|
+
resume(executionId: string, graph: FlowGraph): Promise<{
|
|
18
|
+
resumingFrom: string[];
|
|
19
|
+
} | null>;
|
|
20
|
+
retryNode(executionId: string, nodeId: string, graph: FlowGraph, override?: string): Promise<void>;
|
|
21
|
+
skipNode(executionId: string, nodeId: string): Promise<void>;
|
|
22
|
+
approveGate(executionId: string, nodeId: string, resolution: string, reason?: string): Promise<void>;
|
|
23
|
+
getExecution(executionId: string): ExecutionProjection | null;
|
|
24
|
+
listExecutions(): ExecutionProjection[];
|
|
25
|
+
isRunning(executionId: string): boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface LaunchParams {
|
|
28
|
+
readonly executionId: string;
|
|
29
|
+
readonly graph: FlowGraph;
|
|
30
|
+
readonly dir: string;
|
|
31
|
+
readonly params: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createBridge(runtime: AgentRuntime, stateRuntime: StateRuntime): BridgeApi;
|
|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,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAMD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,YAAY,GACzB,SAAS,CAgTX"}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bridge — orchestration layer between flow framework and external consumers (API, CLI).
|
|
4
|
+
*
|
|
5
|
+
* Responsibilities:
|
|
6
|
+
* - Launch: concurrency check, dedup, dir creation, scheduler.run()
|
|
7
|
+
* - Stop: abort signal, mark running nodes as killed
|
|
8
|
+
* - Resume: rebuild ResumeState from projection, computeFrontier, run
|
|
9
|
+
* - Retry: reset target + downstream, assemble RetryContext, computeFrontier, run
|
|
10
|
+
* - Skip: emit node:skipped
|
|
11
|
+
* - Approve gate: resolve pending gate, emit gate:resolved
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.createBridge = createBridge;
|
|
48
|
+
const fs = __importStar(require("node:fs"));
|
|
49
|
+
const path = __importStar(require("node:path"));
|
|
50
|
+
const types_1 = require("../src/types");
|
|
51
|
+
const scheduler_1 = require("../src/scheduler");
|
|
52
|
+
const nodes_1 = require("../src/nodes");
|
|
53
|
+
const MAX_CONCURRENT = 10;
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Bridge factory
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
function createBridge(runtime, stateRuntime) {
|
|
58
|
+
// ARCH-2: Track running executions per-bridge (not module-level)
|
|
59
|
+
const runningExecutions = new Map();
|
|
60
|
+
async function launch(params) {
|
|
61
|
+
const { executionId, graph, dir } = params;
|
|
62
|
+
// Concurrency check
|
|
63
|
+
if (runningExecutions.size >= MAX_CONCURRENT) {
|
|
64
|
+
throw new Error(`Concurrency limit: ${MAX_CONCURRENT} executions already running`);
|
|
65
|
+
}
|
|
66
|
+
// Dedup check — reject if same executionId is already running
|
|
67
|
+
if (runningExecutions.has(executionId)) {
|
|
68
|
+
throw new Error(`Execution '${executionId}' is already running`);
|
|
69
|
+
}
|
|
70
|
+
// Ensure working directory exists
|
|
71
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
72
|
+
const controller = new AbortController();
|
|
73
|
+
// C4 fix: persist working directory in params for resume (SWE-6: use __flow namespace)
|
|
74
|
+
const paramsWithDir = { ...params.params, __flow: { dir } };
|
|
75
|
+
const runOptions = {
|
|
76
|
+
executionId,
|
|
77
|
+
dir,
|
|
78
|
+
params: paramsWithDir,
|
|
79
|
+
runtime,
|
|
80
|
+
emitState: async (event) => {
|
|
81
|
+
await stateRuntime.handleEvent(event);
|
|
82
|
+
},
|
|
83
|
+
emitOutput: (event) => {
|
|
84
|
+
stateRuntime.handleOutput(event);
|
|
85
|
+
},
|
|
86
|
+
signal: controller.signal,
|
|
87
|
+
};
|
|
88
|
+
// Start flow execution (non-blocking — runs in background)
|
|
89
|
+
const promise = (async () => {
|
|
90
|
+
try {
|
|
91
|
+
await (0, scheduler_1.run)(graph, runOptions);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof types_1.FlowAbortedError) {
|
|
95
|
+
// Already handled by scheduler (run:completed with 'stopped')
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// Unexpected error — emit run:completed with 'failed'
|
|
99
|
+
await stateRuntime.handleEvent({
|
|
100
|
+
type: 'run:completed',
|
|
101
|
+
executionId,
|
|
102
|
+
status: 'failed',
|
|
103
|
+
ts: Date.now(),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
runningExecutions.delete(executionId);
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
runningExecutions.set(executionId, { controller, promise });
|
|
111
|
+
return executionId;
|
|
112
|
+
}
|
|
113
|
+
async function stop(executionId) {
|
|
114
|
+
const running = runningExecutions.get(executionId);
|
|
115
|
+
if (!running) {
|
|
116
|
+
throw new Error(`Execution '${executionId}' is not running`);
|
|
117
|
+
}
|
|
118
|
+
// Abort the flow — scheduler will emit node:killed + run:completed
|
|
119
|
+
running.controller.abort();
|
|
120
|
+
// Wait for the flow to actually stop
|
|
121
|
+
try {
|
|
122
|
+
await running.promise;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Expected — abort causes errors
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function resume(executionId, graph) {
|
|
129
|
+
const projection = stateRuntime.getProjection(executionId);
|
|
130
|
+
if (!projection)
|
|
131
|
+
return null;
|
|
132
|
+
if (projection.status !== 'crashed' && projection.status !== 'failed' && projection.status !== 'stopped') {
|
|
133
|
+
throw new Error(`Cannot resume execution in '${projection.status}' status`);
|
|
134
|
+
}
|
|
135
|
+
// Build ResumeState from projection
|
|
136
|
+
const resumeState = buildResumeState(projection);
|
|
137
|
+
const frontier = (0, scheduler_1.computeFrontier)(graph, resumeState);
|
|
138
|
+
if (frontier.length === 0)
|
|
139
|
+
return null;
|
|
140
|
+
// C4 fix: use persisted working directory from params (SWE-6: __flow namespace)
|
|
141
|
+
const flowMeta = projection.params.__flow;
|
|
142
|
+
const dir = flowMeta?.dir ?? '.';
|
|
143
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
144
|
+
const controller = new AbortController();
|
|
145
|
+
const runOptions = {
|
|
146
|
+
executionId,
|
|
147
|
+
dir,
|
|
148
|
+
params: projection.params,
|
|
149
|
+
runtime,
|
|
150
|
+
emitState: async (event) => {
|
|
151
|
+
await stateRuntime.handleEvent(event);
|
|
152
|
+
},
|
|
153
|
+
emitOutput: (event) => {
|
|
154
|
+
stateRuntime.handleOutput(event);
|
|
155
|
+
},
|
|
156
|
+
signal: controller.signal,
|
|
157
|
+
resumeFrom: resumeState,
|
|
158
|
+
};
|
|
159
|
+
const promise = (async () => {
|
|
160
|
+
try {
|
|
161
|
+
await (0, scheduler_1.run)(graph, runOptions);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
if (!(err instanceof types_1.FlowAbortedError)) {
|
|
165
|
+
await stateRuntime.handleEvent({
|
|
166
|
+
type: 'run:completed',
|
|
167
|
+
executionId,
|
|
168
|
+
status: 'failed',
|
|
169
|
+
ts: Date.now(),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
runningExecutions.delete(executionId);
|
|
175
|
+
}
|
|
176
|
+
})();
|
|
177
|
+
runningExecutions.set(executionId, { controller, promise });
|
|
178
|
+
return { resumingFrom: frontier };
|
|
179
|
+
}
|
|
180
|
+
async function retryNode(executionId, nodeId, graph, override) {
|
|
181
|
+
// I4 fix: prevent concurrent schedulers on same execution
|
|
182
|
+
if (runningExecutions.has(executionId)) {
|
|
183
|
+
throw new Error(`Execution '${executionId}' is still running. Stop it before retrying.`);
|
|
184
|
+
}
|
|
185
|
+
const projection = stateRuntime.getProjection(executionId);
|
|
186
|
+
if (!projection)
|
|
187
|
+
throw new Error(`Execution '${executionId}' not found`);
|
|
188
|
+
const node = projection.graph.nodes.find(n => n.id === nodeId);
|
|
189
|
+
if (!node)
|
|
190
|
+
throw new Error(`Node '${nodeId}' not found`);
|
|
191
|
+
if (!['failed', 'killed', 'completed'].includes(node.status)) {
|
|
192
|
+
throw new Error(`Cannot retry node in '${node.status}' status`);
|
|
193
|
+
}
|
|
194
|
+
// Emit retry event
|
|
195
|
+
await stateRuntime.handleEvent({
|
|
196
|
+
type: 'node:retrying',
|
|
197
|
+
executionId,
|
|
198
|
+
nodeId,
|
|
199
|
+
attempt: (node.attempt ?? 0) + 1,
|
|
200
|
+
override,
|
|
201
|
+
ts: Date.now(),
|
|
202
|
+
});
|
|
203
|
+
// Build ResumeState: mark this node + downstream as pending
|
|
204
|
+
const resumeState = buildResumeState(projection);
|
|
205
|
+
// Remove the retried node and its downstream from completedNodes
|
|
206
|
+
resetNodeAndDownstream(resumeState, nodeId, graph);
|
|
207
|
+
const frontier = (0, scheduler_1.computeFrontier)(graph, resumeState);
|
|
208
|
+
// PARITY-1: Assemble RetryContext for the retried node
|
|
209
|
+
let priorOutput = null;
|
|
210
|
+
if (node.output) {
|
|
211
|
+
const artifactPath = path.join(projection.params.__flow?.dir ?? '.', node.output);
|
|
212
|
+
try {
|
|
213
|
+
priorOutput = fs.readFileSync(artifactPath, 'utf-8');
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
priorOutput = null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const retryContext = {
|
|
220
|
+
priorOutput,
|
|
221
|
+
feedback: `Retry attempt ${(node.attempt ?? 0) + 1}`,
|
|
222
|
+
override,
|
|
223
|
+
};
|
|
224
|
+
const controller = new AbortController();
|
|
225
|
+
const runOptions = {
|
|
226
|
+
executionId,
|
|
227
|
+
dir: projection.params.__flow?.dir ?? '.',
|
|
228
|
+
params: projection.params,
|
|
229
|
+
runtime,
|
|
230
|
+
emitState: async (event) => {
|
|
231
|
+
await stateRuntime.handleEvent(event);
|
|
232
|
+
},
|
|
233
|
+
emitOutput: (event) => {
|
|
234
|
+
stateRuntime.handleOutput(event);
|
|
235
|
+
},
|
|
236
|
+
signal: controller.signal,
|
|
237
|
+
resumeFrom: resumeState,
|
|
238
|
+
retryContexts: { [nodeId]: retryContext },
|
|
239
|
+
};
|
|
240
|
+
const promise = (async () => {
|
|
241
|
+
try {
|
|
242
|
+
await (0, scheduler_1.run)(graph, runOptions);
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
if (!(err instanceof types_1.FlowAbortedError)) {
|
|
246
|
+
await stateRuntime.handleEvent({
|
|
247
|
+
type: 'run:completed',
|
|
248
|
+
executionId,
|
|
249
|
+
status: 'failed',
|
|
250
|
+
ts: Date.now(),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
finally {
|
|
255
|
+
runningExecutions.delete(executionId);
|
|
256
|
+
}
|
|
257
|
+
})();
|
|
258
|
+
runningExecutions.set(executionId, { controller, promise });
|
|
259
|
+
}
|
|
260
|
+
async function skipNode(executionId, nodeId) {
|
|
261
|
+
const projection = stateRuntime.getProjection(executionId);
|
|
262
|
+
if (!projection)
|
|
263
|
+
throw new Error(`Execution '${executionId}' not found`);
|
|
264
|
+
const node = projection.graph.nodes.find(n => n.id === nodeId);
|
|
265
|
+
if (!node)
|
|
266
|
+
throw new Error(`Node '${nodeId}' not found`);
|
|
267
|
+
if (node.status !== 'pending' && node.status !== 'gated' && node.status !== 'failed') {
|
|
268
|
+
throw new Error(`Cannot skip node in '${node.status}' status`);
|
|
269
|
+
}
|
|
270
|
+
await stateRuntime.handleEvent({
|
|
271
|
+
type: 'node:skipped',
|
|
272
|
+
executionId,
|
|
273
|
+
nodeId,
|
|
274
|
+
ts: Date.now(),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
async function approveGate(executionId, nodeId, resolution, reason) {
|
|
278
|
+
const resolved = (0, nodes_1.resolveGate)(executionId, nodeId, resolution);
|
|
279
|
+
if (!resolved) {
|
|
280
|
+
throw new Error(`No pending gate found for node '${nodeId}' in execution '${executionId}'`);
|
|
281
|
+
}
|
|
282
|
+
await stateRuntime.handleEvent({
|
|
283
|
+
type: 'gate:resolved',
|
|
284
|
+
executionId,
|
|
285
|
+
nodeId,
|
|
286
|
+
resolution,
|
|
287
|
+
reason,
|
|
288
|
+
ts: Date.now(),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function getExecution(executionId) {
|
|
292
|
+
return stateRuntime.getProjection(executionId);
|
|
293
|
+
}
|
|
294
|
+
function listExecutions() {
|
|
295
|
+
return stateRuntime.listExecutions();
|
|
296
|
+
}
|
|
297
|
+
function isRunning(executionId) {
|
|
298
|
+
return runningExecutions.has(executionId);
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
launch,
|
|
302
|
+
stop,
|
|
303
|
+
resume,
|
|
304
|
+
retryNode,
|
|
305
|
+
skipNode,
|
|
306
|
+
approveGate,
|
|
307
|
+
getExecution,
|
|
308
|
+
listExecutions,
|
|
309
|
+
isRunning,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
// ---------------------------------------------------------------------------
|
|
313
|
+
// Helpers
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
function buildResumeState(projection) {
|
|
316
|
+
const completedNodes = new Map();
|
|
317
|
+
const firedEdges = new Map();
|
|
318
|
+
const nodeStatuses = new Map();
|
|
319
|
+
for (const node of projection.graph.nodes) {
|
|
320
|
+
nodeStatuses.set(node.id, node.status);
|
|
321
|
+
if (node.status === 'completed' && node.finishedAt) {
|
|
322
|
+
completedNodes.set(node.id, {
|
|
323
|
+
action: node.action ?? 'default',
|
|
324
|
+
finishedAt: node.finishedAt,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// Reconstruct firedEdges from taken edges
|
|
329
|
+
for (const edge of projection.graph.edges) {
|
|
330
|
+
if (edge.state === 'taken') {
|
|
331
|
+
if (!firedEdges.has(edge.target)) {
|
|
332
|
+
firedEdges.set(edge.target, new Set());
|
|
333
|
+
}
|
|
334
|
+
firedEdges.get(edge.target).add(edge.source);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return { completedNodes, firedEdges, nodeStatuses };
|
|
338
|
+
}
|
|
339
|
+
function resetNodeAndDownstream(state, nodeId, graph) {
|
|
340
|
+
// Reset this node
|
|
341
|
+
state.completedNodes.delete(nodeId);
|
|
342
|
+
state.nodeStatuses.set(nodeId, 'pending');
|
|
343
|
+
// Find and reset downstream nodes (BFS)
|
|
344
|
+
const queue = [nodeId];
|
|
345
|
+
const visited = new Set();
|
|
346
|
+
while (queue.length > 0) {
|
|
347
|
+
const current = queue.shift();
|
|
348
|
+
if (visited.has(current))
|
|
349
|
+
continue;
|
|
350
|
+
visited.add(current);
|
|
351
|
+
const edges = graph.edges[current];
|
|
352
|
+
if (!edges)
|
|
353
|
+
continue;
|
|
354
|
+
for (const target of Object.values(edges)) {
|
|
355
|
+
if (target !== 'end' && !visited.has(target)) {
|
|
356
|
+
state.completedNodes.delete(target);
|
|
357
|
+
state.nodeStatuses.set(target, 'pending');
|
|
358
|
+
// Also clear fired edges to this target
|
|
359
|
+
state.firedEdges.delete(target);
|
|
360
|
+
queue.push(target);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../bridge/bridge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CH,oCAmTC;AAhWD,4CAA8B;AAC9B,gDAAkC;AASlC,wCAAgD;AAChD,gDAAwD;AACxD,wCAA2C;AAI3C,MAAM,cAAc,GAAG,EAAE,CAAC;AAyB1B,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,SAAgB,YAAY,CAC1B,OAAqB,EACrB,YAA0B;IAG1B,iEAAiE;IACjE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAG7B,CAAC;IAEL,KAAK,UAAU,MAAM,CAAC,MAAoB;QACxC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;QAE3C,oBAAoB;QACpB,IAAI,iBAAiB,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,sBAAsB,cAAc,6BAA6B,CAAC,CAAC;QACrF,CAAC;QAED,8DAA8D;QAC9D,IAAI,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,cAAc,WAAW,sBAAsB,CAAC,CAAC;QACnE,CAAC;QAED,kCAAkC;QAClC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvC,MAAM,U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C,GAAG,CAAC,OAAO,CAAC,CAAC;QAErB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,SAAS;QAErB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1C,IAAI,MAAM,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5C,KAAK,CAAC,cAAuC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC7D,KAAK,CAAC,YAAoC,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBACnE,wCAAwC;gBACvC,KAAK,CAAC,UAAuC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC9D,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBridge = void 0;
|
|
4
|
+
var bridge_1 = require("./bridge");
|
|
5
|
+
Object.defineProperty(exports, "createBridge", { enumerable: true, get: function () { return bridge_1.createBridge; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../bridge/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAA/B,sGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CopilotBackend → AgentRuntime adapter.
|
|
3
|
+
*
|
|
4
|
+
* The existing SubprocessBackend implements CopilotBackend. The flow
|
|
5
|
+
* framework expects AgentRuntime. This thin adapter bridges the two
|
|
6
|
+
* interfaces — they are structurally identical, this just maps the types.
|
|
7
|
+
*
|
|
8
|
+
* This adapter allows the flow framework to use the existing proven
|
|
9
|
+
* SubprocessBackend (PATH hardening, NODE_OPTIONS stripping, heartbeat
|
|
10
|
+
* timeout, process kill tree) without any modifications.
|
|
11
|
+
*/
|
|
12
|
+
import type { CopilotBackend } from './copilot-backend';
|
|
13
|
+
import type { AgentRuntime } from '../../src/types';
|
|
14
|
+
/**
|
|
15
|
+
* Wraps a CopilotBackend as an AgentRuntime for the flow framework.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { SubprocessBackend } from './subprocess-backend';
|
|
20
|
+
* import { adaptCopilotBackend } from './copilot-adapter';
|
|
21
|
+
*
|
|
22
|
+
* const backend = new SubprocessBackend();
|
|
23
|
+
* const runtime = adaptCopilotBackend(backend);
|
|
24
|
+
* const bridge = createBridge(runtime, stateRuntime);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function adaptCopilotBackend(backend: CopilotBackend): AgentRuntime;
|
|
28
|
+
//# sourceMappingURL=copilot-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-adapter.d.ts","sourceRoot":"","sources":["../../../runtimes/copilot/copilot-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAA+B,MAAM,iBAAiB,CAAC;AAEjF;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,CAyBzE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CopilotBackend → AgentRuntime adapter.
|
|
4
|
+
*
|
|
5
|
+
* The existing SubprocessBackend implements CopilotBackend. The flow
|
|
6
|
+
* framework expects AgentRuntime. This thin adapter bridges the two
|
|
7
|
+
* interfaces — they are structurally identical, this just maps the types.
|
|
8
|
+
*
|
|
9
|
+
* This adapter allows the flow framework to use the existing proven
|
|
10
|
+
* SubprocessBackend (PATH hardening, NODE_OPTIONS stripping, heartbeat
|
|
11
|
+
* timeout, process kill tree) without any modifications.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.adaptCopilotBackend = adaptCopilotBackend;
|
|
15
|
+
/**
|
|
16
|
+
* Wraps a CopilotBackend as an AgentRuntime for the flow framework.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { SubprocessBackend } from './subprocess-backend';
|
|
21
|
+
* import { adaptCopilotBackend } from './copilot-adapter';
|
|
22
|
+
*
|
|
23
|
+
* const backend = new SubprocessBackend();
|
|
24
|
+
* const runtime = adaptCopilotBackend(backend);
|
|
25
|
+
* const bridge = createBridge(runtime, stateRuntime);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function adaptCopilotBackend(backend) {
|
|
29
|
+
return {
|
|
30
|
+
name: backend.name,
|
|
31
|
+
isAvailable() {
|
|
32
|
+
return backend.isAvailable();
|
|
33
|
+
},
|
|
34
|
+
async createSession(config) {
|
|
35
|
+
// Map flow SessionConfig → CopilotBackend SessionConfig
|
|
36
|
+
const copilotConfig = {
|
|
37
|
+
model: config.model,
|
|
38
|
+
cwd: config.cwd,
|
|
39
|
+
addDirs: config.addDirs,
|
|
40
|
+
timeout: config.timeout,
|
|
41
|
+
heartbeatTimeout: config.heartbeatTimeout,
|
|
42
|
+
};
|
|
43
|
+
const session = await backend.createSession(copilotConfig);
|
|
44
|
+
// CopilotSession and AgentSession are structurally identical —
|
|
45
|
+
// same methods, same event signatures. Direct pass-through.
|
|
46
|
+
return session;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=copilot-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../../runtimes/copilot/copilot-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAkBH,kDAyBC;AAtCD;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CAAC,OAAuB;IACzD,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAElB,WAAW;YACT,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;QAC/B,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,MAAqB;YACvC,wDAAwD;YACxD,MAAM,aAAa,GAAG;gBACpB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;aAC1C,CAAC;YAEF,MAAM,OAAO,GAAmB,MAAM,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YAE3E,+DAA+D;YAC/D,4DAA4D;YAC5D,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CopilotBackend interface -- the abstraction over how we talk to copilot CLI.
|
|
3
|
+
*
|
|
4
|
+
* Three implementations planned:
|
|
5
|
+
* - SubprocessBackend: Proven, works today (child_process.spawn)
|
|
6
|
+
* - AcpBackend: Structured events via ACP protocol (copilot --acp)
|
|
7
|
+
* - SdkBackend: Future, when @github/copilot-sdk stabilizes
|
|
8
|
+
*
|
|
9
|
+
* The orchestrator depends on this interface, not on any implementation.
|
|
10
|
+
*/
|
|
11
|
+
export interface SessionConfig {
|
|
12
|
+
/** Model to use: "claude-opus-4.6", "gpt-5.3-codex", etc. */
|
|
13
|
+
readonly model: string;
|
|
14
|
+
/** Working directory for the agent (repo root) */
|
|
15
|
+
readonly cwd: string;
|
|
16
|
+
/** Additional directories the agent can access. [] = isolation (step 2a) */
|
|
17
|
+
readonly addDirs: readonly string[];
|
|
18
|
+
/** Hard timeout -- kill after this many seconds */
|
|
19
|
+
readonly timeout: number;
|
|
20
|
+
/** Heartbeat timeout -- kill if no output for this many seconds */
|
|
21
|
+
readonly heartbeatTimeout: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CopilotSession {
|
|
24
|
+
/** Subprocess PID (if applicable) for kill operations */
|
|
25
|
+
readonly pid: number | null;
|
|
26
|
+
/** Send a prompt to the agent. Agent begins working. */
|
|
27
|
+
send(prompt: string): void;
|
|
28
|
+
/** Subscribe to streaming text output from the agent */
|
|
29
|
+
on(event: 'text', handler: (text: string) => void): void;
|
|
30
|
+
/** Subscribe to tool execution start (file read, bash, Kusto, etc.) */
|
|
31
|
+
on(event: 'tool_start', handler: (tool: string, input: string) => void): void;
|
|
32
|
+
/** Subscribe to tool execution completion */
|
|
33
|
+
on(event: 'tool_complete', handler: (tool: string, output: string) => void): void;
|
|
34
|
+
/** Agent finished all work */
|
|
35
|
+
on(event: 'idle', handler: () => void): void;
|
|
36
|
+
/** Agent encountered an error */
|
|
37
|
+
on(event: 'error', handler: (err: Error) => void): void;
|
|
38
|
+
/** Abort the session -- kill the agent process */
|
|
39
|
+
abort(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface CopilotBackend {
|
|
42
|
+
/** Create a new agent session with the given configuration */
|
|
43
|
+
createSession(config: SessionConfig): Promise<CopilotSession>;
|
|
44
|
+
/** Check if copilot CLI is available */
|
|
45
|
+
isAvailable(): Promise<boolean>;
|
|
46
|
+
/** Get the backend type name (for logging) */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=copilot-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-backend.d.ts","sourceRoot":"","sources":["../../../runtimes/copilot/copilot-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,wDAAwD;IACxD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,wDAAwD;IACxD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACzD,uEAAuE;IACvE,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAC9E,6CAA6C;IAC7C,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAClF,8BAA8B;IAC9B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC7C,iCAAiC;IACjC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAExD,kDAAkD;IAClD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9D,wCAAwC;IACxC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhC,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CopilotBackend interface -- the abstraction over how we talk to copilot CLI.
|
|
4
|
+
*
|
|
5
|
+
* Three implementations planned:
|
|
6
|
+
* - SubprocessBackend: Proven, works today (child_process.spawn)
|
|
7
|
+
* - AcpBackend: Structured events via ACP protocol (copilot --acp)
|
|
8
|
+
* - SdkBackend: Future, when @github/copilot-sdk stabilizes
|
|
9
|
+
*
|
|
10
|
+
* The orchestrator depends on this interface, not on any implementation.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
//# sourceMappingURL=copilot-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-backend.js","sourceRoot":"","sources":["../../../runtimes/copilot/copilot-backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { CopilotBackend, CopilotSession, SessionConfig as CopilotSessionConfig } from './copilot-backend';
|
|
2
|
+
export { SubprocessBackend } from './subprocess-backend';
|
|
3
|
+
export { adaptCopilotBackend } from './copilot-adapter';
|
|
4
|
+
export { isProcessAlive, killProcessTree } from './process-killer';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../runtimes/copilot/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.killProcessTree = exports.isProcessAlive = exports.adaptCopilotBackend = exports.SubprocessBackend = void 0;
|
|
4
|
+
var subprocess_backend_1 = require("./subprocess-backend");
|
|
5
|
+
Object.defineProperty(exports, "SubprocessBackend", { enumerable: true, get: function () { return subprocess_backend_1.SubprocessBackend; } });
|
|
6
|
+
var copilot_adapter_1 = require("./copilot-adapter");
|
|
7
|
+
Object.defineProperty(exports, "adaptCopilotBackend", { enumerable: true, get: function () { return copilot_adapter_1.adaptCopilotBackend; } });
|
|
8
|
+
var process_killer_1 = require("./process-killer");
|
|
9
|
+
Object.defineProperty(exports, "isProcessAlive", { enumerable: true, get: function () { return process_killer_1.isProcessAlive; } });
|
|
10
|
+
Object.defineProperty(exports, "killProcessTree", { enumerable: true, get: function () { return process_killer_1.killProcessTree; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../runtimes/copilot/index.ts"],"names":[],"mappings":";;;AACA,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,qDAAwD;AAA/C,sHAAA,mBAAmB,OAAA;AAC5B,mDAAmE;AAA1D,gHAAA,cAAc,OAAA;AAAE,iHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a process with the given PID is alive.
|
|
3
|
+
* Uses `process.kill(pid, 0)` which sends signal 0 (no-op) to probe existence.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Kill a process and its entire tree.
|
|
8
|
+
* On Windows, uses `taskkill /T /F /PID <pid>`.
|
|
9
|
+
* On other platforms, uses `kill -9 <pid>`.
|
|
10
|
+
* Does not throw if the process does not exist.
|
|
11
|
+
*/
|
|
12
|
+
export declare function killProcessTree(pid: number): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=process-killer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-killer.d.ts","sourceRoot":"","sources":["../../../runtimes/copilot/process-killer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhE"}
|