codex-taskflow 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.
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Codex subagent runner — the Codex host's `SubagentRunner` implementation.
3
+ *
4
+ * Spawns an isolated `codex exec --json` process per task and folds its JSONL
5
+ * event stream into the same host-neutral `RunResult` the pi runner produces,
6
+ * so the engine (runtime.ts) treats a Codex subagent identically to a pi one.
7
+ *
8
+ * Real codex JSONL schema (codex-cli ≥ 0.142), observed empirically:
9
+ * {"type":"thread.started","thread_id":"…"}
10
+ * {"type":"turn.started"}
11
+ * {"type":"item.started", "item":{"id","type":"command_execution","command","status":"in_progress",…}}
12
+ * {"type":"item.completed","item":{"id","type":"command_execution","command","exit_code","status":"completed",…}}
13
+ * {"type":"item.completed","item":{"id","type":"agent_message","text":"…"}} ← final answer
14
+ * {"type":"item.completed","item":{"id","type":"error","message":"…"}} ← warning OR fatal
15
+ * {"type":"turn.completed","usage":{"input_tokens","cached_input_tokens","output_tokens","reasoning_output_tokens"}}
16
+ *
17
+ * Mapping to the pi contract:
18
+ * - output = text of the LAST `agent_message` item
19
+ * - usage.input = input_tokens; usage.output = output_tokens + reasoning_output_tokens;
20
+ * usage.cacheRead = cached_input_tokens; turns = number of `turn.completed`
21
+ * - lastActivity for streaming = latest agent_message text or a one-line
22
+ * command summary
23
+ * - benign warnings (the "Under-development features" / "Skill descriptions"
24
+ * notices) are NOT treated as failures — only a fatal error item or a
25
+ * non-zero exit is.
26
+ *
27
+ * Process handling (idle watchdog, abort, signal-kill detection, stderr cap,
28
+ * error sanitization) mirrors the pi runner so behavior is uniform across hosts.
29
+ */
30
+ import { type AgentConfig, type LiveUpdate, type RunOptions, type RunResult, type SubagentRunner, type UsageStats } from "taskflow-core";
31
+ /** Accumulated state folded from a codex JSONL event stream. */
32
+ export interface CodexAccumulator {
33
+ usage: UsageStats;
34
+ model?: string;
35
+ /** Final answer = text of the last agent_message item seen. */
36
+ finalText: string;
37
+ lastActivity: string;
38
+ /** Set when a fatal (non-benign) error item is seen. */
39
+ fatalError?: string;
40
+ }
41
+ export declare function newCodexAccumulator(model?: string): CodexAccumulator;
42
+ /**
43
+ * Fold one codex JSONL line into the accumulator. Returns a LiveUpdate when the
44
+ * stream produced new activity (for streaming), else null. Empty/malformed
45
+ * lines are ignored — robust to partial buffers and noise, unit-testable
46
+ * without spawning a process.
47
+ */
48
+ export declare function foldCodexEventLine(acc: CodexAccumulator, line: string): LiveUpdate | null;
49
+ /**
50
+ * Run a single subagent task via `codex exec --json`. Resolves the agent from
51
+ * `agents` by name; returns the same structured `RunResult` the pi runner does.
52
+ */
53
+ export declare function runCodexAgentTask(defaultCwd: string, agents: AgentConfig[], agentName: string, task: string, opts: RunOptions, globalThinking?: string): Promise<RunResult>;
54
+ /**
55
+ * The Codex host's `SubagentRunner`. Drops into `RuntimeDeps.runTask` exactly
56
+ * like `piSubagentRunner`, so the engine runs unchanged on Codex.
57
+ */
58
+ export declare const codexSubagentRunner: SubagentRunner<AgentConfig>;
59
+ //# sourceMappingURL=codex-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-runner.d.ts","sourceRoot":"","sources":["../src/codex-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAKN,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAwBvB,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAEpE;AAOD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA+CzF;AAqBD;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,WAAW,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,CAAC,CA4KpB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,WAAW,CAE3D,CAAC"}
@@ -0,0 +1,322 @@
1
+ /**
2
+ * Codex subagent runner — the Codex host's `SubagentRunner` implementation.
3
+ *
4
+ * Spawns an isolated `codex exec --json` process per task and folds its JSONL
5
+ * event stream into the same host-neutral `RunResult` the pi runner produces,
6
+ * so the engine (runtime.ts) treats a Codex subagent identically to a pi one.
7
+ *
8
+ * Real codex JSONL schema (codex-cli ≥ 0.142), observed empirically:
9
+ * {"type":"thread.started","thread_id":"…"}
10
+ * {"type":"turn.started"}
11
+ * {"type":"item.started", "item":{"id","type":"command_execution","command","status":"in_progress",…}}
12
+ * {"type":"item.completed","item":{"id","type":"command_execution","command","exit_code","status":"completed",…}}
13
+ * {"type":"item.completed","item":{"id","type":"agent_message","text":"…"}} ← final answer
14
+ * {"type":"item.completed","item":{"id","type":"error","message":"…"}} ← warning OR fatal
15
+ * {"type":"turn.completed","usage":{"input_tokens","cached_input_tokens","output_tokens","reasoning_output_tokens"}}
16
+ *
17
+ * Mapping to the pi contract:
18
+ * - output = text of the LAST `agent_message` item
19
+ * - usage.input = input_tokens; usage.output = output_tokens + reasoning_output_tokens;
20
+ * usage.cacheRead = cached_input_tokens; turns = number of `turn.completed`
21
+ * - lastActivity for streaming = latest agent_message text or a one-line
22
+ * command summary
23
+ * - benign warnings (the "Under-development features" / "Skill descriptions"
24
+ * notices) are NOT treated as failures — only a fatal error item or a
25
+ * non-zero exit is.
26
+ *
27
+ * Process handling (idle watchdog, abort, signal-kill detection, stderr cap,
28
+ * error sanitization) mirrors the pi runner so behavior is uniform across hosts.
29
+ */
30
+ import { spawn } from "node:child_process";
31
+ import { emptyUsage, isFailed, sanitizeErrorMessage, TRANSPORT_ERROR_PLACEHOLDER, } from "taskflow-core";
32
+ const activeChildren = new Set();
33
+ const killAll = () => {
34
+ for (const pid of activeChildren) {
35
+ try {
36
+ process.kill(pid, "SIGKILL");
37
+ }
38
+ catch { /* already dead */ }
39
+ }
40
+ };
41
+ process.on("exit", killAll);
42
+ /** Same idle window as the pi runner: a child silent this long is wedged. */
43
+ const DEFAULT_IDLE_TIMEOUT_MS = 5 * 60_000;
44
+ /** Benign codex `error` items that are warnings, not failures. Matched as a
45
+ * prefix/substring so version drift in the message tail still classifies. */
46
+ const BENIGN_ERROR_MARKERS = [
47
+ "Under-development features",
48
+ "Skill descriptions were shortened",
49
+ ];
50
+ function isBenignCodexError(message) {
51
+ return BENIGN_ERROR_MARKERS.some((m) => message.includes(m));
52
+ }
53
+ export function newCodexAccumulator(model) {
54
+ return { usage: emptyUsage(), model, finalText: "", lastActivity: "" };
55
+ }
56
+ function shortCmd(cmd) {
57
+ const s = String(cmd ?? "").replace(/\s+/g, " ").trim();
58
+ return s.length > 64 ? `${s.slice(0, 64)}…` : s;
59
+ }
60
+ /**
61
+ * Fold one codex JSONL line into the accumulator. Returns a LiveUpdate when the
62
+ * stream produced new activity (for streaming), else null. Empty/malformed
63
+ * lines are ignored — robust to partial buffers and noise, unit-testable
64
+ * without spawning a process.
65
+ */
66
+ export function foldCodexEventLine(acc, line) {
67
+ if (!line.trim())
68
+ return null;
69
+ let event;
70
+ try {
71
+ event = JSON.parse(line);
72
+ }
73
+ catch {
74
+ return null;
75
+ }
76
+ let activity = "";
77
+ if (event.type === "turn.completed" && event.usage) {
78
+ const u = event.usage;
79
+ acc.usage.turns++;
80
+ acc.usage.input += u.input_tokens || 0;
81
+ acc.usage.output += (u.output_tokens || 0) + (u.reasoning_output_tokens || 0);
82
+ acc.usage.cacheRead += u.cached_input_tokens || 0;
83
+ acc.usage.contextTokens = (u.input_tokens || 0) + (u.output_tokens || 0);
84
+ }
85
+ else if (event.type === "item.completed" || event.type === "item.started") {
86
+ const item = event.item;
87
+ if (!item)
88
+ return null;
89
+ switch (item.type) {
90
+ case "agent_message":
91
+ if (typeof item.text === "string" && item.text.trim()) {
92
+ // Final answer is the LAST agent_message; keep overwriting.
93
+ if (event.type === "item.completed")
94
+ acc.finalText = item.text;
95
+ activity = item.text.trim();
96
+ }
97
+ break;
98
+ case "command_execution":
99
+ activity = `$ ${shortCmd(item.command)}`;
100
+ break;
101
+ case "error":
102
+ if (typeof item.message === "string" && !isBenignCodexError(item.message)) {
103
+ acc.fatalError = item.message;
104
+ activity = `error: ${item.message}`;
105
+ }
106
+ break;
107
+ default:
108
+ // file_change / reasoning / mcp_tool_call / etc. — note generically.
109
+ if (typeof item.type === "string")
110
+ activity = item.type;
111
+ }
112
+ }
113
+ else {
114
+ return null; // thread.started / turn.started — nothing to fold.
115
+ }
116
+ if (activity)
117
+ acc.lastActivity = activity.replace(/\s+/g, " ").trim();
118
+ return { text: acc.lastActivity, usage: { ...acc.usage }, model: acc.model };
119
+ }
120
+ /** Override the codex binary (tests / unusual installs). */
121
+ function codexBin() {
122
+ return process.env.PI_TASKFLOW_CODEX_BIN || "codex";
123
+ }
124
+ /**
125
+ * Map a phase's tool whitelist to a codex sandbox mode. Codex has no per-tool
126
+ * whitelist; it has sandbox policies. The conservative mapping: a phase that
127
+ * only reads (no write/edit/bash in its whitelist) gets `read-only`; anything
128
+ * else gets `workspace-write`. No whitelist → workspace-write (the engine's
129
+ * default-capable agent). `danger-full-access` is never selected automatically.
130
+ */
131
+ function sandboxForTools(tools) {
132
+ if (!tools || tools.length === 0)
133
+ return "workspace-write";
134
+ const mutating = new Set(["write", "edit", "bash", "apply_patch"]);
135
+ const canMutate = tools.some((t) => mutating.has(t));
136
+ return canMutate ? "workspace-write" : "read-only";
137
+ }
138
+ /**
139
+ * Run a single subagent task via `codex exec --json`. Resolves the agent from
140
+ * `agents` by name; returns the same structured `RunResult` the pi runner does.
141
+ */
142
+ export async function runCodexAgentTask(defaultCwd, agents, agentName, task, opts, globalThinking) {
143
+ const agent = agents.find((a) => a.name === agentName);
144
+ if (!agent) {
145
+ const available = agents.map((a) => `"${a.name}"`).join(", ") || "none";
146
+ return {
147
+ agent: agentName,
148
+ task,
149
+ exitCode: 1,
150
+ output: "",
151
+ stderr: `Unknown agent: "${agentName}". Available: ${available}.`,
152
+ usage: emptyUsage(),
153
+ errorMessage: `Unknown agent: ${agentName}`,
154
+ stopReason: "error",
155
+ };
156
+ }
157
+ const model = opts.model ?? agent.model;
158
+ const tools = opts.tools ?? agent.tools;
159
+ const sandbox = sandboxForTools(tools);
160
+ void globalThinking; // codex has no thinking-level flag on exec; reserved.
161
+ // codex exec [PROMPT] --json --skip-git-repo-check -s <sandbox> [-m model] [-C cwd]
162
+ // The agent's system prompt is prepended to the task as guidance, since
163
+ // `codex exec` has no separate append-system-prompt flag. We keep it compact.
164
+ const fullPrompt = agent.systemPrompt.trim()
165
+ ? `${agent.systemPrompt.trim()}\n\n---\n\nTask: ${task}`
166
+ : `Task: ${task}`;
167
+ const args = ["exec", "--json", "--skip-git-repo-check", "-s", sandbox];
168
+ if (model)
169
+ args.push("-m", model);
170
+ const cwd = opts.cwd ?? defaultCwd;
171
+ if (cwd)
172
+ args.push("-C", cwd);
173
+ args.push(fullPrompt);
174
+ const acc = newCodexAccumulator(model);
175
+ const result = {
176
+ agent: agentName,
177
+ task,
178
+ exitCode: 0,
179
+ output: "",
180
+ stderr: "",
181
+ usage: emptyUsage(),
182
+ model,
183
+ };
184
+ let wasAborted = false;
185
+ let idleTimedOut = false;
186
+ let killedBySignal;
187
+ const exitCode = await new Promise((resolve) => {
188
+ const proc = spawn(codexBin(), args, {
189
+ cwd,
190
+ shell: false,
191
+ stdio: ["ignore", "pipe", "pipe"],
192
+ env: { ...process.env },
193
+ });
194
+ if (proc.pid)
195
+ activeChildren.add(proc.pid);
196
+ let buffer = "";
197
+ let idleTimer;
198
+ let forceTimer;
199
+ const idleMs = opts.idleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS;
200
+ const clearTimers = () => {
201
+ if (idleTimer)
202
+ clearTimeout(idleTimer);
203
+ if (forceTimer)
204
+ clearTimeout(forceTimer);
205
+ };
206
+ const hardKill = () => {
207
+ idleTimedOut = true;
208
+ proc.kill("SIGTERM");
209
+ forceTimer = setTimeout(() => proc.kill("SIGKILL"), 5000);
210
+ forceTimer.unref();
211
+ };
212
+ const armIdle = () => {
213
+ if (idleTimer)
214
+ clearTimeout(idleTimer);
215
+ if (idleMs <= 0)
216
+ return;
217
+ idleTimer = setTimeout(hardKill, idleMs);
218
+ idleTimer.unref();
219
+ };
220
+ armIdle();
221
+ const processLine = (line) => {
222
+ const live = foldCodexEventLine(acc, line);
223
+ if (live && opts.onLive)
224
+ opts.onLive(live);
225
+ };
226
+ proc.stdout.on("data", (data) => {
227
+ armIdle();
228
+ buffer += data.toString();
229
+ const lines = buffer.split("\n");
230
+ buffer = lines.pop() || "";
231
+ for (const line of lines)
232
+ processLine(line);
233
+ });
234
+ const STDERR_MAX_LEN = 64 * 1024;
235
+ let stderrCapped = false;
236
+ proc.stderr.on("data", (data) => {
237
+ if (!stderrCapped) {
238
+ result.stderr += data.toString();
239
+ if (result.stderr.length >= STDERR_MAX_LEN) {
240
+ result.stderr = result.stderr.slice(0, STDERR_MAX_LEN) + "\n[...stderr truncated at 64KB]";
241
+ stderrCapped = true;
242
+ }
243
+ }
244
+ });
245
+ proc.on("close", (code, signal) => {
246
+ if (proc.pid)
247
+ activeChildren.delete(proc.pid);
248
+ clearTimers();
249
+ if (buffer.trim())
250
+ processLine(buffer);
251
+ if (code === null && signal)
252
+ killedBySignal = signal;
253
+ resolve(code ?? 0);
254
+ });
255
+ proc.on("error", (err) => {
256
+ clearTimers();
257
+ if (!result.stderr)
258
+ result.stderr = err.message;
259
+ if (!result.errorMessage)
260
+ result.errorMessage = err.message;
261
+ resolve(1);
262
+ });
263
+ if (opts.signal) {
264
+ const kill = () => {
265
+ wasAborted = true;
266
+ proc.kill("SIGTERM");
267
+ const forceKill = setTimeout(() => proc.kill("SIGKILL"), 5000);
268
+ forceKill.unref();
269
+ };
270
+ if (opts.signal.aborted)
271
+ kill();
272
+ else
273
+ opts.signal.addEventListener("abort", kill, { once: true });
274
+ }
275
+ });
276
+ result.exitCode = exitCode;
277
+ result.usage = acc.usage;
278
+ result.model = acc.model;
279
+ result.output = acc.finalText;
280
+ if (acc.fatalError) {
281
+ result.exitCode = result.exitCode || 1;
282
+ result.stopReason = "error";
283
+ result.errorMessage = acc.fatalError;
284
+ }
285
+ else {
286
+ result.stopReason = exitCode === 0 ? "end" : "error";
287
+ }
288
+ if (exitCode === 0 && killedBySignal && !idleTimedOut && !wasAborted) {
289
+ result.exitCode = 1;
290
+ result.stopReason = "error";
291
+ result.errorMessage = `Subagent killed by signal ${killedBySignal}`;
292
+ }
293
+ if (idleTimedOut) {
294
+ result.stopReason = "error";
295
+ result.idleTimeout = true;
296
+ result.errorMessage = `Subagent stalled: no output for ${Math.round((opts.idleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS) / 1000)}s (idle timeout) — killed`;
297
+ }
298
+ else if (wasAborted) {
299
+ result.stopReason = "aborted";
300
+ result.errorMessage = "Subagent was aborted";
301
+ }
302
+ if (isFailed(result)) {
303
+ if (!result.output) {
304
+ result.output = TRANSPORT_ERROR_PLACEHOLDER;
305
+ if (!result.errorMessage) {
306
+ result.errorMessage =
307
+ result.stderr || `Subagent exited with code ${result.exitCode} (stopReason: ${result.stopReason ?? "unknown"})`;
308
+ }
309
+ }
310
+ if (result.errorMessage)
311
+ result.errorMessage = sanitizeErrorMessage(result.errorMessage);
312
+ }
313
+ return result;
314
+ }
315
+ /**
316
+ * The Codex host's `SubagentRunner`. Drops into `RuntimeDeps.runTask` exactly
317
+ * like `piSubagentRunner`, so the engine runs unchanged on Codex.
318
+ */
319
+ export const codexSubagentRunner = {
320
+ runTask: runCodexAgentTask,
321
+ };
322
+ //# sourceMappingURL=codex-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-runner.js","sourceRoot":"","sources":["../src/codex-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACN,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,2BAA2B,GAO3B,MAAM,eAAe,CAAC;AAEvB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;AACzC,MAAM,OAAO,GAAG,GAAG,EAAE;IACpB,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAClC,IAAI,CAAC;YAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACnE,CAAC;AACF,CAAC,CAAC;AACF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B,6EAA6E;AAC7E,MAAM,uBAAuB,GAAG,CAAC,GAAG,MAAM,CAAC;AAE3C;8EAC8E;AAC9E,MAAM,oBAAoB,GAAG;IAC5B,4BAA4B;IAC5B,mCAAmC;CACnC,CAAC;AAEF,SAAS,kBAAkB,CAAC,OAAe;IAC1C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAaD,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,O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AAC,WAAW,GAAG,IAAI,CAAC;QAC1B,MAAM,CAAC,YAAY,GAAG,mCAAmC,IAAI,CAAC,KAAK,CAClE,CAAC,IAAI,CAAC,aAAa,IAAI,uBAAuB,CAAC,GAAG,IAAI,CACtD,2BAA2B,CAAC;IAC9B,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACvB,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,MAAM,CAAC,YAAY,GAAG,sBAAsB,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBAC1B,MAAM,CAAC,YAAY;oBAClB,MAAM,CAAC,MAAM,IAAI,6BAA6B,MAAM,CAAC,QAAQ,iBAAiB,MAAM,CAAC,UAAU,IAAI,SAAS,GAAG,CAAC;YAClH,CAAC;QACF,CAAC;QACD,IAAI,MAAM,CAAC,YAAY;YAAE,MAAM,CAAC,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC1F,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC/D,OAAO,EAAE,iBAAiB;CAC1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Executable entry for the pi-taskflow MCP server.
4
+ *
5
+ * Register with Codex:
6
+ * codex mcp add taskflow -- node --experimental-strip-types \
7
+ * /abs/path/to/extensions/mcp/bin.ts
8
+ *
9
+ * (or point at a compiled .js). Codex then launches this as a stdio MCP server
10
+ * and the taskflow_* tools become available inside codex. The server discovers
11
+ * saved flows + agents from its launch cwd, and runs each subagent as a codex
12
+ * session, so no pi process is required.
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/mcp/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Executable entry for the pi-taskflow MCP server.
4
+ *
5
+ * Register with Codex:
6
+ * codex mcp add taskflow -- node --experimental-strip-types \
7
+ * /abs/path/to/extensions/mcp/bin.ts
8
+ *
9
+ * (or point at a compiled .js). Codex then launches this as a stdio MCP server
10
+ * and the taskflow_* tools become available inside codex. The server discovers
11
+ * saved flows + agents from its launch cwd, and runs each subagent as a codex
12
+ * session, so no pi process is required.
13
+ */
14
+ import { startMcpServer } from "./server.js";
15
+ startMcpServer(process.cwd())
16
+ .then(() => process.exit(0))
17
+ .catch((e) => {
18
+ // Never write non-JSON to stdout (it would corrupt the MCP stream); log to
19
+ // stderr and exit non-zero so the client sees the transport drop.
20
+ process.stderr.write(`pi-taskflow mcp server fatal: ${e instanceof Error ? e.stack ?? e.message : String(e)}\n`);
21
+ process.exit(1);
22
+ });
23
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/mcp/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;KAC3B,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3B,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACZ,2EAA2E;IAC3E,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Minimal, dependency-free stdio JSON-RPC 2.0 transport for an MCP server.
3
+ *
4
+ * pi-taskflow ships ZERO runtime dependencies (a core selling point), so we do
5
+ * NOT pull in `@modelcontextprotocol/sdk`. MCP's stdio transport is just
6
+ * newline-delimited JSON-RPC 2.0 over stdin/stdout — small enough to implement
7
+ * on Node built-ins. This module handles framing + dispatch only; the MCP
8
+ * method semantics live in server.ts.
9
+ *
10
+ * Wire format: one JSON object per line on stdin (a request or notification),
11
+ * one JSON object per line on stdout (a response). Notifications (no `id`) get
12
+ * no response. Anything we can't parse is answered with a JSON-RPC parse error
13
+ * when an id is recoverable, else dropped (never crash the loop).
14
+ */
15
+ export interface JsonRpcRequest {
16
+ jsonrpc: "2.0";
17
+ id?: string | number | null;
18
+ method: string;
19
+ params?: unknown;
20
+ }
21
+ export interface JsonRpcError {
22
+ code: number;
23
+ message: string;
24
+ data?: unknown;
25
+ }
26
+ /** Standard JSON-RPC / MCP error codes we use. */
27
+ export declare const RPC: {
28
+ readonly PARSE_ERROR: -32700;
29
+ readonly INVALID_REQUEST: -32600;
30
+ readonly METHOD_NOT_FOUND: -32601;
31
+ readonly INVALID_PARAMS: -32602;
32
+ readonly INTERNAL_ERROR: -32603;
33
+ };
34
+ /** Thrown by a handler to return a structured JSON-RPC error to the client. */
35
+ export declare class RpcError extends Error {
36
+ code: number;
37
+ data?: unknown;
38
+ constructor(code: number, message: string, data?: unknown);
39
+ }
40
+ /**
41
+ * A method handler. Return a JSON-serializable result, or throw `RpcError` for
42
+ * a structured failure. Returning `undefined` for a request (has id) sends
43
+ * `result: null`; for a notification it is ignored.
44
+ */
45
+ export type RpcHandler = (params: unknown) => Promise<unknown> | unknown;
46
+ /**
47
+ * Run a JSON-RPC stdio loop over the given streams (defaults to process
48
+ * stdin/stdout). Resolves when the input stream ends (client disconnect).
49
+ */
50
+ export declare function serveStdio(handlers: Record<string, RpcHandler>, io?: {
51
+ input?: NodeJS.ReadableStream;
52
+ output?: NodeJS.WritableStream;
53
+ }): Promise<void>;
54
+ //# sourceMappingURL=jsonrpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonrpc.d.ts","sourceRoot":"","sources":["../../src/mcp/jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,kDAAkD;AAClD,eAAO,MAAM,GAAG;;;;;;CAMN,CAAC;AAEX,+EAA+E;AAC/E,qBAAa,QAAS,SAAQ,KAAK;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;gBACH,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAMzD;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;CAAO,GACxE,OAAO,CAAC,IAAI,CAAC,CA+Ef"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Minimal, dependency-free stdio JSON-RPC 2.0 transport for an MCP server.
3
+ *
4
+ * pi-taskflow ships ZERO runtime dependencies (a core selling point), so we do
5
+ * NOT pull in `@modelcontextprotocol/sdk`. MCP's stdio transport is just
6
+ * newline-delimited JSON-RPC 2.0 over stdin/stdout — small enough to implement
7
+ * on Node built-ins. This module handles framing + dispatch only; the MCP
8
+ * method semantics live in server.ts.
9
+ *
10
+ * Wire format: one JSON object per line on stdin (a request or notification),
11
+ * one JSON object per line on stdout (a response). Notifications (no `id`) get
12
+ * no response. Anything we can't parse is answered with a JSON-RPC parse error
13
+ * when an id is recoverable, else dropped (never crash the loop).
14
+ */
15
+ /** Standard JSON-RPC / MCP error codes we use. */
16
+ export const RPC = {
17
+ PARSE_ERROR: -32700,
18
+ INVALID_REQUEST: -32600,
19
+ METHOD_NOT_FOUND: -32601,
20
+ INVALID_PARAMS: -32602,
21
+ INTERNAL_ERROR: -32603,
22
+ };
23
+ /** Thrown by a handler to return a structured JSON-RPC error to the client. */
24
+ export class RpcError extends Error {
25
+ code;
26
+ data;
27
+ constructor(code, message, data) {
28
+ super(message);
29
+ this.name = "RpcError";
30
+ this.code = code;
31
+ this.data = data;
32
+ }
33
+ }
34
+ /**
35
+ * Run a JSON-RPC stdio loop over the given streams (defaults to process
36
+ * stdin/stdout). Resolves when the input stream ends (client disconnect).
37
+ */
38
+ export function serveStdio(handlers, io = {}) {
39
+ const input = io.input ?? process.stdin;
40
+ const output = io.output ?? process.stdout;
41
+ const write = (obj) => {
42
+ output.write(JSON.stringify(obj) + "\n");
43
+ };
44
+ const respondOk = (id, result) => {
45
+ write({ jsonrpc: "2.0", id, result: result === undefined ? null : result });
46
+ };
47
+ const respondErr = (id, err) => {
48
+ write({ jsonrpc: "2.0", id, error: err });
49
+ };
50
+ const handleLine = async (line) => {
51
+ const trimmed = line.trim();
52
+ if (!trimmed)
53
+ return;
54
+ let msg;
55
+ try {
56
+ msg = JSON.parse(trimmed);
57
+ }
58
+ catch {
59
+ // No recoverable id — per JSON-RPC, a parse error uses id:null.
60
+ respondErr(null, { code: RPC.PARSE_ERROR, message: "Parse error" });
61
+ return;
62
+ }
63
+ const isNotification = msg.id === undefined || msg.id === null;
64
+ const id = (msg.id ?? null);
65
+ if (msg.jsonrpc !== "2.0" || typeof msg.method !== "string") {
66
+ if (!isNotification)
67
+ respondErr(id, { code: RPC.INVALID_REQUEST, message: "Invalid Request" });
68
+ return;
69
+ }
70
+ const handler = handlers[msg.method];
71
+ if (!handler) {
72
+ // Unknown notifications are silently ignored (e.g. notifications/*).
73
+ if (!isNotification)
74
+ respondErr(id, { code: RPC.METHOD_NOT_FOUND, message: `Method not found: ${msg.method}` });
75
+ return;
76
+ }
77
+ try {
78
+ const result = await handler(msg.params);
79
+ if (!isNotification)
80
+ respondOk(id, result);
81
+ }
82
+ catch (e) {
83
+ if (isNotification)
84
+ return; // can't report errors for notifications
85
+ if (e instanceof RpcError) {
86
+ respondErr(id, { code: e.code, message: e.message, data: e.data });
87
+ }
88
+ else {
89
+ const message = e instanceof Error ? e.message : String(e);
90
+ respondErr(id, { code: RPC.INTERNAL_ERROR, message });
91
+ }
92
+ }
93
+ };
94
+ return new Promise((resolve) => {
95
+ let buffer = "";
96
+ // Serialize line handling so responses are emitted in request order even
97
+ // when handlers are async (MCP clients tolerate interleaving, but ordered
98
+ // output is simpler to reason about and test).
99
+ let chain = Promise.resolve();
100
+ input.on("data", (data) => {
101
+ buffer += data.toString();
102
+ let i;
103
+ while ((i = buffer.indexOf("\n")) >= 0) {
104
+ const line = buffer.slice(0, i);
105
+ buffer = buffer.slice(i + 1);
106
+ chain = chain.then(() => handleLine(line));
107
+ }
108
+ });
109
+ input.on("end", () => {
110
+ chain = chain.then(() => {
111
+ if (buffer.trim())
112
+ return handleLine(buffer);
113
+ }).then(() => resolve());
114
+ });
115
+ input.on("close", () => resolve());
116
+ });
117
+ }
118
+ //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ACd,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAChC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC7B,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5C,CAAC;QACF,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACpB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvB,IAAI,MAAM,CAAC,IAAI,EAAE;oBAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * pi-taskflow as an MCP server for Codex (and any MCP client).
3
+ *
4
+ * Exposes the taskflow engine as MCP tools so a Codex user can declare and run
5
+ * verifiable task DAGs from inside codex — the mirror of codex-runner.ts (which
6
+ * lets taskflow *call* codex). Here taskflow is *called by* codex: each subagent
7
+ * a flow spawns is itself a `codex exec` process (via codexSubagentRunner), so
8
+ * the whole thing closes the loop with no pi process required.
9
+ *
10
+ * Protocol: MCP over stdio, JSON-RPC 2.0 (newline-delimited). Implemented on the
11
+ * dependency-free transport in ./jsonrpc.ts — pi-taskflow keeps its zero-runtime
12
+ * -deps guarantee; we do NOT use @modelcontextprotocol/sdk.
13
+ *
14
+ * Tools exposed:
15
+ * - taskflow_run : run an inline or saved flow, return the final output
16
+ * - taskflow_list : list saved flows discoverable in this cwd
17
+ * - taskflow_show : show a saved flow's definition
18
+ * - taskflow_verify : statically verify a flow (no execution)
19
+ * - taskflow_compile : render a flow as a Mermaid diagram + verify report
20
+ */
21
+ import { type RpcHandler } from "./jsonrpc.ts";
22
+ /**
23
+ * Build the per-call tool handlers. `cwd` is the directory the server was
24
+ * launched in (where saved flows + agents are discovered, and where codex
25
+ * subagents run).
26
+ */
27
+ export declare function makeToolHandlers(cwd: string): Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
28
+ /** Build the full MCP method dispatch table (protocol + tools). */
29
+ export declare function makeMcpHandlers(cwd: string): Record<string, RpcHandler>;
30
+ /** Start the stdio MCP server. Resolves when the client disconnects. */
31
+ export declare function startMcpServer(cwd?: string): Promise<void>;
32
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AA0H1E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CA+DjH;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA2BvE;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE"}
@@ -0,0 +1,215 @@
1
+ /**
2
+ * pi-taskflow as an MCP server for Codex (and any MCP client).
3
+ *
4
+ * Exposes the taskflow engine as MCP tools so a Codex user can declare and run
5
+ * verifiable task DAGs from inside codex — the mirror of codex-runner.ts (which
6
+ * lets taskflow *call* codex). Here taskflow is *called by* codex: each subagent
7
+ * a flow spawns is itself a `codex exec` process (via codexSubagentRunner), so
8
+ * the whole thing closes the loop with no pi process required.
9
+ *
10
+ * Protocol: MCP over stdio, JSON-RPC 2.0 (newline-delimited). Implemented on the
11
+ * dependency-free transport in ./jsonrpc.ts — pi-taskflow keeps its zero-runtime
12
+ * -deps guarantee; we do NOT use @modelcontextprotocol/sdk.
13
+ *
14
+ * Tools exposed:
15
+ * - taskflow_run : run an inline or saved flow, return the final output
16
+ * - taskflow_list : list saved flows discoverable in this cwd
17
+ * - taskflow_show : show a saved flow's definition
18
+ * - taskflow_verify : statically verify a flow (no execution)
19
+ * - taskflow_compile : render a flow as a Mermaid diagram + verify report
20
+ */
21
+ import { RpcError, RPC, serveStdio } from "./jsonrpc.js";
22
+ import { codexSubagentRunner } from "../codex-runner.js";
23
+ import { discoverAgents, executeTaskflow, getFlow, listFlows, compileTaskflow, verifyTaskflow, desugar, isShorthand, validateTaskflow, } from "taskflow-core";
24
+ const PROTOCOL_VERSION = "2025-06-18";
25
+ const SERVER_INFO = { name: "pi-taskflow", title: "pi-taskflow", version: "0.0.28" };
26
+ /** MCP tools/call content block (text only — sufficient for our outputs). */
27
+ function textContent(text, isError = false) {
28
+ return { content: [{ type: "text", text }], isError };
29
+ }
30
+ const TOOLS = [
31
+ {
32
+ name: "taskflow_run",
33
+ title: "Run a taskflow",
34
+ description: "Run a taskflow DAG and return its final output. Provide EITHER `name` (a saved flow) OR `define` (an inline flow definition: {name, phases:[…]} or a shorthand {task} / {tasks} / {chain}). Subagents execute as codex sessions. Intermediate phase outputs stay in the runtime; only the final phase output is returned.",
35
+ inputSchema: {
36
+ type: "object",
37
+ additionalProperties: false,
38
+ properties: {
39
+ name: { type: "string", description: "Name of a saved flow to run." },
40
+ define: { type: "object", description: "Inline flow definition (full DAG or shorthand)." },
41
+ args: { type: "object", description: "Invocation arguments interpolated as {args.X}." },
42
+ incremental: { type: "boolean", description: "Default every phase to cross-run cache reuse." },
43
+ },
44
+ },
45
+ },
46
+ {
47
+ name: "taskflow_list",
48
+ title: "List saved taskflows",
49
+ description: "List the saved taskflows discoverable from the current working directory (user + project scope).",
50
+ inputSchema: { type: "object", additionalProperties: false, properties: {} },
51
+ },
52
+ {
53
+ name: "taskflow_show",
54
+ title: "Show a saved taskflow",
55
+ description: "Show a saved flow's full definition as JSON.",
56
+ inputSchema: {
57
+ type: "object",
58
+ additionalProperties: false,
59
+ properties: { name: { type: "string", description: "Name of the saved flow." } },
60
+ required: ["name"],
61
+ },
62
+ },
63
+ {
64
+ name: "taskflow_verify",
65
+ title: "Verify a taskflow",
66
+ description: "Statically verify a flow (cycles, missing deps, undefined refs, …) WITHOUT executing it. Provide `name` or `define`.",
67
+ inputSchema: {
68
+ type: "object",
69
+ additionalProperties: false,
70
+ properties: {
71
+ name: { type: "string" },
72
+ define: { type: "object" },
73
+ },
74
+ },
75
+ },
76
+ {
77
+ name: "taskflow_compile",
78
+ title: "Compile a taskflow to a diagram",
79
+ description: "Render a flow as a Mermaid flowchart + a static verification report (markdown). No execution. Provide `name` or `define`.",
80
+ inputSchema: {
81
+ type: "object",
82
+ additionalProperties: false,
83
+ properties: {
84
+ name: { type: "string" },
85
+ define: { type: "object" },
86
+ },
87
+ },
88
+ },
89
+ ];
90
+ /** Resolve a flow from params: inline `define` (desugared) or saved `name`. */
91
+ function resolveFlow(cwd, params) {
92
+ if (params.define !== undefined && params.define !== null) {
93
+ return isShorthand(params.define) ? desugar(params.define) : params.define;
94
+ }
95
+ if (params.name) {
96
+ const saved = getFlow(cwd, params.name);
97
+ if (!saved)
98
+ throw new RpcError(RPC.INVALID_PARAMS, `No saved flow named "${params.name}" found from ${cwd}.`);
99
+ return saved.def;
100
+ }
101
+ throw new RpcError(RPC.INVALID_PARAMS, "Provide either `name` (a saved flow) or `define` (an inline flow).");
102
+ }
103
+ function mkRunState(def, args, cwd) {
104
+ return {
105
+ runId: `mcp-${def.name ?? "flow"}-${Date.now()}`,
106
+ flowName: def.name ?? "flow",
107
+ def,
108
+ args,
109
+ status: "running",
110
+ phases: {},
111
+ createdAt: Date.now(),
112
+ updatedAt: Date.now(),
113
+ cwd,
114
+ };
115
+ }
116
+ /**
117
+ * Build the per-call tool handlers. `cwd` is the directory the server was
118
+ * launched in (where saved flows + agents are discovered, and where codex
119
+ * subagents run).
120
+ */
121
+ export function makeToolHandlers(cwd) {
122
+ return {
123
+ taskflow_run: async (args) => {
124
+ const def = resolveFlow(cwd, args);
125
+ const v = validateTaskflow(def);
126
+ if (!v.ok)
127
+ return textContent(`Flow is invalid:\n- ${v.errors.join("\n- ")}`, true);
128
+ const { agents } = discoverAgents(cwd, "both");
129
+ const deps = {
130
+ cwd,
131
+ agents,
132
+ runTask: codexSubagentRunner.runTask,
133
+ };
134
+ const state = mkRunState(def, args.args ?? {}, cwd);
135
+ if (args.incremental === true)
136
+ deps.cacheScopeDefault = "cross-run";
137
+ const res = await executeTaskflow(state, deps);
138
+ const header = res.ok ? "✓ taskflow complete" : "✗ taskflow did not fully succeed";
139
+ const usage = res.totalUsage;
140
+ const usageLine = `\n\n— usage: ${usage.turns} turns, in ${usage.input}, out ${usage.output}`;
141
+ return textContent(`${header}\n\n${res.finalOutput}${usageLine}`, !res.ok);
142
+ },
143
+ taskflow_list: async () => {
144
+ const flows = listFlows(cwd);
145
+ if (flows.length === 0)
146
+ return textContent("No saved taskflows found from this directory.");
147
+ const lines = flows.map((f) => `- ${f.name} (${f.scope}) — ${f.def.phases.length} phase(s)`);
148
+ return textContent(`Saved taskflows:\n${lines.join("\n")}`);
149
+ },
150
+ taskflow_show: async (args) => {
151
+ const name = String(args.name ?? "");
152
+ const saved = getFlow(cwd, name);
153
+ if (!saved)
154
+ return textContent(`No saved flow named "${name}".`, true);
155
+ return textContent("```json\n" + JSON.stringify(saved.def, null, 2) + "\n```");
156
+ },
157
+ taskflow_verify: async (args) => {
158
+ const def = resolveFlow(cwd, args);
159
+ // Two layers: validateTaskflow catches structural errors (cycles, missing
160
+ // deps, undefined refs); verifyTaskflow adds the deeper static-quality
161
+ // issues. Combine both so the tool matches the `/tf verify` behavior.
162
+ const val = validateTaskflow(def);
163
+ const result = verifyTaskflow(def);
164
+ const errors = result.issues.filter((i) => i.severity === "error");
165
+ const warnings = result.issues.filter((i) => i.severity === "warning");
166
+ const passed = val.ok && result.ok && errors.length === 0;
167
+ const ok = passed ? "✓ verification PASSED" : "✗ verification FAILED";
168
+ const fmt = (i) => `- ${i.category}${i.phaseId ? ` [${i.phaseId}]` : ""}: ${i.message}`;
169
+ const valErrs = val.errors.length ? `\n\nErrors:\n- ${val.errors.join("\n- ")}` : "";
170
+ const errs = errors.length ? `${valErrs ? "" : "\n\nErrors:"}\n${errors.map(fmt).join("\n")}` : "";
171
+ const allWarn = [...val.warnings.map((w) => `- ${w}`), ...warnings.map(fmt)];
172
+ const warns = allWarn.length ? `\n\nWarnings:\n${allWarn.join("\n")}` : "";
173
+ return textContent(`${ok}${valErrs}${errs}${warns}`, !passed);
174
+ },
175
+ taskflow_compile: async (args) => {
176
+ const def = resolveFlow(cwd, args);
177
+ const result = compileTaskflow(def);
178
+ return textContent(result.markdown, !result.verification.ok);
179
+ },
180
+ };
181
+ }
182
+ /** Build the full MCP method dispatch table (protocol + tools). */
183
+ export function makeMcpHandlers(cwd) {
184
+ const tools = makeToolHandlers(cwd);
185
+ let initialized = false;
186
+ return {
187
+ initialize: () => {
188
+ initialized = true;
189
+ return {
190
+ protocolVersion: PROTOCOL_VERSION,
191
+ capabilities: { tools: { listChanged: false } },
192
+ serverInfo: SERVER_INFO,
193
+ };
194
+ },
195
+ // Client tells us it's ready — notification, no response.
196
+ "notifications/initialized": () => {
197
+ initialized = true;
198
+ },
199
+ ping: () => ({}),
200
+ "tools/list": () => ({ tools: TOOLS }),
201
+ "tools/call": async (params) => {
202
+ const p = (params ?? {});
203
+ const tool = tools[p.name ?? ""];
204
+ if (!tool)
205
+ throw new RpcError(RPC.INVALID_PARAMS, `Unknown tool: ${p.name}`);
206
+ void initialized; // tolerant: we don't hard-gate on initialize ordering
207
+ return await tool(p.arguments ?? {});
208
+ },
209
+ };
210
+ }
211
+ /** Start the stdio MCP server. Resolves when the client disconnects. */
212
+ export function startMcpServer(cwd = process.cwd()) {
213
+ return serveStdio(makeMcpHandlers(cwd));
214
+ }
215
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACN,cAAc,EACd,eAAe,EACf,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,OAAO,EACP,WAAW,EACX,gBAAgB,GAIhB,MAAM,eAAe,CAAC;AAEvB,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAW,CAAC;AAU9F,6EAA6E;AAC7E,SAAS,WAAW,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK;IACjD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,KAAK,GAAc;IACxB;QACC,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACV,2TAA2T;QAC5T,WAAW,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACX,IAAI,EAAE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MAAM,IAAI,EAAE,CAA2D,CAAC;YACnF,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACjC,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7E,KAAK,WAAW,CAAC,CAAC,sDAAsD;YACxE,OAAO,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;KACD,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACzD,OAAO,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "codex-taskflow",
3
+ "version": "0.1.0",
4
+ "description": "Run pi-taskflow on OpenAI Codex: a Codex subagent runner plus an MCP server that exposes taskflow_* tools to Codex users.",
5
+ "keywords": [
6
+ "codex",
7
+ "codex-cli",
8
+ "mcp",
9
+ "taskflow",
10
+ "orchestration",
11
+ "subagents",
12
+ "workflow"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "heggria <bshengtao@gmail.com>",
16
+ "homepage": "https://github.com/heggria/pi-taskflow#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/heggria/pi-taskflow/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/heggria/pi-taskflow.git",
23
+ "directory": "packages/codex-taskflow"
24
+ },
25
+ "type": "module",
26
+ "main": "./dist/codex-runner.js",
27
+ "types": "./dist/codex-runner.d.ts",
28
+ "bin": {
29
+ "codex-taskflow-mcp": "./dist/mcp/bin.js"
30
+ },
31
+ "files": ["dist"],
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.build.json",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "taskflow-core": "0.1.0"
41
+ }
42
+ }