@psimona/darkf 0.7.1 → 0.9.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.
Files changed (35) hide show
  1. package/docs/concepts/failure-modes.md +18 -5
  2. package/docs/concepts/handoff.md +8 -4
  3. package/docs/concepts/node-types.md +45 -21
  4. package/docs/guides/pick-an-agent-runner.md +143 -4
  5. package/docs/guides/plan-with-a-task-queue.md +18 -2
  6. package/docs/guides/run-detached-and-monitor.md +4 -3
  7. package/docs/guides/write-your-first-workflow.md +24 -5
  8. package/docs/reference/cli-commands.md +24 -6
  9. package/docs/reference/core-types.md +41 -6
  10. package/docs/start-here/quickstart.md +22 -2
  11. package/package.json +1 -1
  12. package/skills/darkf-usage/SKILL.md +17 -0
  13. package/skills/darkf-writing-workflows/SKILL.md +25 -18
  14. package/src/cli/detached.test.ts +92 -2
  15. package/src/cli/doctor.test.ts +224 -9
  16. package/src/cli/index.ts +83 -12
  17. package/src/cli/tarball.test.ts +8 -2
  18. package/src/core/graph.test.ts +266 -20
  19. package/src/core/graph.ts +61 -3
  20. package/src/core/types.ts +21 -0
  21. package/src/engine/run.test.ts +581 -17
  22. package/src/engine/run.ts +50 -7
  23. package/src/kit/agents/claude-code.test.ts +38 -2
  24. package/src/kit/agents/claude-code.ts +24 -3
  25. package/src/kit/agents/opencode.test.ts +89 -12
  26. package/src/kit/agents/opencode.ts +103 -8
  27. package/src/kit/status.test.ts +24 -0
  28. package/src/kit/status.ts +25 -8
  29. package/src/test/ok-output.ts +11 -0
  30. package/workflows/dev-loop/output-types.ts +43 -0
  31. package/workflows/dev-loop/scripts/begin.ts +2 -2
  32. package/workflows/dev-loop/scripts/finish.ts +2 -36
  33. package/workflows/dev-loop/workflow.ts +18 -4
  34. package/workflows/series-ordering/output-types.ts +9 -0
  35. package/workflows/series-ordering/workflow.ts +4 -0
@@ -1,5 +1,14 @@
1
1
  import { afterAll, expect, test } from "bun:test";
2
- import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
+ import {
3
+ cpSync,
4
+ existsSync,
5
+ mkdirSync,
6
+ mkdtempSync,
7
+ readdirSync,
8
+ readFileSync,
9
+ rmSync,
10
+ writeFileSync,
11
+ } from "node:fs";
3
12
  import { tmpdir } from "node:os";
4
13
  import { join, resolve } from "node:path";
5
14
  import { todayLocal, writeProbeState } from "./setup.ts";
@@ -160,19 +169,23 @@ import { claudeCodeRunner } from "${pkgDir}/src/kit/agents/claude-code.ts";
160
169
  export const agentRunner: AgentRunner = claudeCodeRunner;
161
170
  `;
162
171
 
163
- function writeFixture(env: Env, name: string, states: string): string {
172
+ function writeFixture(env: Env, name: string, states: string, extra = ""): string {
164
173
  const dir = join(env.cwd, name);
165
174
  mkdirSync(dir, { recursive: true });
166
175
  writeFileSync(
167
176
  join(dir, "workflow.ts"),
168
- `${RUNNER_IMPORTS}\nexport const workflow: WorkflowDef = {\n initial: "A",\n states: { ${states} },\n};\n`,
177
+ `${RUNNER_IMPORTS}\nexport const workflow: WorkflowDef = {\n initial: "A",\n ${extra}\n states: { ${states} },\n};\n`,
169
178
  );
170
179
  return dir;
171
180
  }
172
181
 
173
182
  test("validate inherits the workflow checks: happy path, same lines, exit 0", async () => {
174
183
  const env = makeEnv();
175
- const dir = writeFixture(env, "happy", `A: { type: "agent", prompt: "p", on: { done: EXIT } }`);
184
+ const dir = writeFixture(
185
+ env,
186
+ "happy",
187
+ `A: { type: "agent", agent: { model: "claude-test-model" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) }, on: { done: EXIT } }`,
188
+ );
176
189
 
177
190
  const res = await runCli(["validate", dir], env);
178
191
 
@@ -182,7 +195,7 @@ test("validate inherits the workflow checks: happy path, same lines, exit 0", as
182
195
  `ok workflow resolves — ${dir}`,
183
196
  "ok workflow.ts loads",
184
197
  "ok exports `workflow`",
185
- "ok exports `agentRunner` — agent states need a runner; built-ins live in src/kit/agents/",
198
+ "ok agent runners",
186
199
  "ok workflow structure",
187
200
  ]);
188
201
  expect(res.code).toBe(0);
@@ -193,16 +206,214 @@ test("validate reports unresolved targets", async () => {
193
206
  const dir = writeFixture(
194
207
  env,
195
208
  "unresolved",
196
- `A: { type: "agent", prompt: "p", on: { done: "nope" } }`,
209
+ `A: { type: "agent", agent: { model: "claude-test-model" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) }, on: { done: "nope" } }`,
197
210
  );
198
211
  const res = await runCli(["validate", dir], env);
199
212
  expect(lines(res.stdout)).toContain('FAIL workflow structure — A -> "nope": no such state');
200
213
  expect(res.code).toBe(1);
201
214
  });
202
215
 
216
+ test("validate reports an agent state with no model, and accepts the workflow default", async () => {
217
+ const env = makeEnv();
218
+ const bare = writeFixture(
219
+ env,
220
+ "no-model",
221
+ `A: { type: "agent", prompt: "p", outputType: { safeParse: () => ({ success: true }) }, on: { done: EXIT } }`,
222
+ );
223
+
224
+ const res = await runCli(["validate", bare], env);
225
+
226
+ expect(lines(res.stdout)).toContain(
227
+ 'FAIL workflow structure — "A": no model, pin agent: { model } on the state or, without a runner, on the workflow',
228
+ );
229
+ expect(res.code).toBe(1);
230
+
231
+ const defaulted = writeFixture(
232
+ env,
233
+ "default-model",
234
+ `A: { type: "agent", prompt: "p", outputType: { safeParse: () => ({ success: true }) }, on: { done: EXIT } }`,
235
+ `agent: { model: "claude-test-model" },`,
236
+ );
237
+ expect((await runCli(["validate", defaulted], env)).code).toBe(0);
238
+ });
239
+
240
+ // --- validate: per-state runners (stub runners, never dispatched) ---
241
+
242
+ const STUB = `{ async run() { return { event: "done" }; } }`;
243
+
244
+ /** A workflow module with exactly the runner exports given, none implied. */
245
+ function writeRunnerFixture(env: Env, name: string, exports: string, states: string): string {
246
+ const dir = join(env.cwd, name);
247
+ mkdirSync(dir, { recursive: true });
248
+ writeFileSync(
249
+ join(dir, "workflow.ts"),
250
+ `import { EXIT, type WorkflowDef } from "${pkgDir}/src/core/index.ts";\n${exports}\nexport const workflow: WorkflowDef = {\n initial: "A",\n states: { ${states} },\n};\n`,
251
+ );
252
+ return dir;
253
+ }
254
+
255
+ function agentState(runner?: string, next = "EXIT"): string {
256
+ const selected = runner === undefined ? "" : `runner: "${runner}", `;
257
+ return `{ type: "agent", ${selected}agent: { model: "claude-test-model" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) }, next: ${next} }`;
258
+ }
259
+
260
+ test("validate reports an unknown runner name with the state and the known names", async () => {
261
+ const env = makeEnv();
262
+ const dir = writeRunnerFixture(
263
+ env,
264
+ "unknown-runner",
265
+ `export const agentRunner = ${STUB};\nexport const agentRunners = { claude: ${STUB}, other: ${STUB} };`,
266
+ `A: ${agentState("typo", `"B"`)}, B: ${agentState("toString")}`,
267
+ );
268
+
269
+ const res = await runCli(["validate", dir], env);
270
+
271
+ const out = lines(res.stdout);
272
+ expect(out).toContain(
273
+ 'FAIL workflow structure — "A": unknown runner "typo", known: claude, other',
274
+ );
275
+ expect(out).toContain(
276
+ 'FAIL workflow structure — "B": unknown runner "toString", known: claude, other',
277
+ );
278
+ expect(res.code).toBe(1);
279
+ });
280
+
281
+ test("validate needs no default runner when every agent state names a registered one", async () => {
282
+ const env = makeEnv();
283
+ const exports = `export const agentRunners = { claude: ${STUB} };`;
284
+ const named = writeRunnerFixture(env, "all-named", exports, `A: ${agentState("claude")}`);
285
+
286
+ const passing = await runCli(["validate", named], env);
287
+
288
+ expect(lines(passing.stdout)).toContain("ok agent runners");
289
+ expect(passing.code).toBe(0);
290
+
291
+ const bare = writeRunnerFixture(
292
+ env,
293
+ "one-bare",
294
+ exports,
295
+ `A: ${agentState("claude", `"B"`)}, B: ${agentState()}`,
296
+ );
297
+
298
+ const failing = await runCli(["validate", bare], env);
299
+
300
+ expect(lines(failing.stdout)).toContain(
301
+ 'FAIL workflow structure — "B": names no runner and the workflow has no default agentRunner',
302
+ );
303
+ expect(failing.code).toBe(1);
304
+ });
305
+
306
+ test("validate needs no runner for a workflow without agent states", async () => {
307
+ const env = makeEnv();
308
+ const dir = writeRunnerFixture(
309
+ env,
310
+ "scripts-only",
311
+ "",
312
+ `A: { type: "script", file: "a.ts", next: EXIT }`,
313
+ );
314
+
315
+ expect((await runCli(["validate", dir], env)).code).toBe(0);
316
+ });
317
+
318
+ test("validate fails each present runner export that has no run function", async () => {
319
+ const env = makeEnv();
320
+ const dir = writeRunnerFixture(
321
+ env,
322
+ "no-run",
323
+ `export const agentRunner = {};\nexport const agentRunners = { good: ${STUB}, bad: { kind: "x" }, empty: undefined };`,
324
+ `A: ${agentState("good")}`,
325
+ );
326
+
327
+ const res = await runCli(["validate", dir], env);
328
+
329
+ expect(lines(res.stdout).filter((l) => l.includes("agent runners"))).toEqual([
330
+ "FAIL agent runners — agentRunner has no run function",
331
+ "FAIL agent runners — agentRunners.bad has no run function",
332
+ "FAIL agent runners — agentRunners.empty has no run function",
333
+ ]);
334
+ expect(res.code).toBe(1);
335
+ });
336
+
337
+ // --- validate: advisory model checks (a fake `opencode` on PATH) ---
338
+
339
+ /** PATH extension holding an `opencode` stand-in that runs `script`. */
340
+ function fakeOpencode(script: string): Record<string, string> {
341
+ const bin = tempDir();
342
+ writeFileSync(join(bin, "opencode"), `#!/bin/sh\n${script}\n`, { mode: 0o755 });
343
+ return { PATH: `${bin}:${process.env.PATH}` };
344
+ }
345
+
346
+ function writeModelFixture(env: Env): string {
347
+ const state = (model: string, next: string, runner = "") =>
348
+ `{ type: "agent", ${runner}agent: { model: "${model}" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) }, next: ${next} }`;
349
+ return writeRunnerFixture(
350
+ env,
351
+ "models",
352
+ [
353
+ `import { claudeCodeRunner } from "${pkgDir}/src/kit/agents/claude-code.ts";`,
354
+ `import { opencodeRunner } from "${pkgDir}/src/kit/agents/opencode.ts";`,
355
+ "export const agentRunner = opencodeRunner;",
356
+ "export const agentRunners = { claude: claudeCodeRunner };",
357
+ ].join("\n"),
358
+ [
359
+ `A: ${state("acme/listed#high", '"B"')}`,
360
+ `B: ${state("acme/typo", '"C"')}`,
361
+ `C: ${state("acme/listed", '"D"', 'runner: "claude", ')}`,
362
+ `D: ${state("claude-sonnet-5-5", "EXIT", 'runner: "claude", ')}`,
363
+ ].join(", "),
364
+ );
365
+ }
366
+
367
+ test("validate warns about unrecognized models without failing", async () => {
368
+ const env = makeEnv();
369
+ const dir = writeModelFixture(env);
370
+
371
+ const res = await runCli(["validate", dir], env, fakeOpencode("echo acme/listed"));
372
+
373
+ expect(lines(res.stdout).filter((l) => l.startsWith("warn"))).toEqual([
374
+ 'warn agent models — "B": model "acme/typo" is not in `opencode models`',
375
+ 'warn agent models — "C": model "acme/listed" is neither a Claude Code alias nor a "claude-" id',
376
+ ]);
377
+ expect(res.code).toBe(0);
378
+ });
379
+
380
+ test("validate warns when the model list is unavailable", async () => {
381
+ const env = makeEnv();
382
+ const dir = writeModelFixture(env);
383
+
384
+ const res = await runCli(["validate", dir], env, fakeOpencode("exit 3"));
385
+
386
+ expect(lines(res.stdout)).toContain(
387
+ 'warn agent models — "A", "B": could not check the model: `opencode models` exited 3 with 0 models',
388
+ );
389
+ expect(res.code).toBe(0);
390
+ });
391
+
392
+ test("every shipped workflow and example passes validate", async () => {
393
+ const env = makeEnv();
394
+ // Keeps the suite off the real opencode CLI.
395
+ const path = fakeOpencode("echo zai-coding-plan/glm-5.3-flash");
396
+ const dirs = ["workflows", "examples"].flatMap((root) =>
397
+ readdirSync(join(pkgDir, root))
398
+ .map((name) => join(pkgDir, root, name))
399
+ .filter((dir) => existsSync(join(dir, "workflow.ts"))),
400
+ );
401
+ expect(dirs.length).toBeGreaterThan(0);
402
+
403
+ const results = await Promise.all(
404
+ dirs.map(async (dir) => ({ dir, ...(await runCli(["validate", dir], env, path)) })),
405
+ );
406
+
407
+ expect(results.filter((r) => r.code !== 0).map((r) => `${r.dir}\n${r.stdout}`)).toEqual([]);
408
+ }, 30_000);
409
+
203
410
  test("validate reports dead-end leaves", async () => {
204
411
  const env = makeEnv();
205
- const dir = writeFixture(env, "dead-end", `A: { type: "agent", prompt: "p" }`);
412
+ const dir = writeFixture(
413
+ env,
414
+ "dead-end",
415
+ `A: { type: "agent", agent: { model: "claude-test-model" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) } }`,
416
+ );
206
417
  const res = await runCli(["validate", dir], env);
207
418
  expect(lines(res.stdout)).toContain('FAIL workflow structure — "A": dead end, no on/next');
208
419
  expect(res.code).toBe(1);
@@ -244,7 +455,7 @@ test("validate with an unresolvable ref skips the load and exports checks", asyn
244
455
  expect(out[0]).toContain("FAIL workflow resolves");
245
456
  expect(out).toContain("FAIL workflow.ts loads — skipped — no resolved workflow");
246
457
  expect(out).toContain("FAIL exports `workflow` — skipped — no resolved workflow");
247
- expect(out).toContain("FAIL exports `agentRunner` — skipped — no resolved workflow");
458
+ expect(out).toContain("FAIL agent runners — skipped — no resolved workflow");
248
459
  expect(out).toHaveLength(4);
249
460
  expect(res.code).toBe(1);
250
461
  });
@@ -252,7 +463,11 @@ test("validate with an unresolvable ref skips the load and exports checks", asyn
252
463
  test("validate does not check skills — stale copies never touch its verdict", async () => {
253
464
  const env = makeEnv();
254
465
  seedStale(env, ".claude", "darkf-usage");
255
- const dir = writeFixture(env, "happy", `A: { type: "agent", prompt: "p", on: { done: EXIT } }`);
466
+ const dir = writeFixture(
467
+ env,
468
+ "happy",
469
+ `A: { type: "agent", agent: { model: "claude-test-model" }, prompt: "p", outputType: { safeParse: () => ({ success: true }) }, on: { done: EXIT } }`,
470
+ );
256
471
 
257
472
  const res = await runCli(["validate", dir], env);
258
473
 
package/src/cli/index.ts CHANGED
@@ -9,6 +9,8 @@ import {
9
9
  type AgentRunner,
10
10
  buildRegistry,
11
11
  DONE,
12
+ effectiveAgent,
13
+ isComposite,
12
14
  type NodeEvent,
13
15
  type NodeResult,
14
16
  parseEventLog,
@@ -19,7 +21,7 @@ import {
19
21
  type WorkflowDef,
20
22
  type WorkflowValidationError,
21
23
  } from "../core/index.ts";
22
- import { run } from "../engine/index.ts";
24
+ import { run, selectRunner } from "../engine/index.ts";
23
25
  import {
24
26
  currentBootId,
25
27
  detectSupervisorSignal,
@@ -73,7 +75,10 @@ const WORKER_LOG_TAIL_CHARS = 2000;
73
75
  interface WorkflowModule {
74
76
  workflow: WorkflowDef;
75
77
  input?: NodeResult;
78
+ /** Default runner, for agent states that name none. */
76
79
  agentRunner?: AgentRunner;
80
+ /** Runners an agent state selects by name through `runner`. */
81
+ agentRunners?: Record<string, AgentRunner>;
77
82
  /** Opt-in override for run-aware script dispatch — e.g. a script needing
78
83
  * `.darkf/run/<runId>/...` for its own artifacts (see DispatchInfo's own
79
84
  * docs in darkf-core). Omitted: falls back to darkf-engine's default,
@@ -185,7 +190,9 @@ async function reportCmd(args: string[]): Promise<void> {
185
190
  : d.phase === "failed"
186
191
  ? `-> FAILED${d.event ? ` ${d.event}` : ""}`
187
192
  : `-> CRASHED ${d.reason ? JSON.stringify(d.reason) : ""}`;
188
- console.log(` ${d.state.padEnd(12)} ${seconds(d.durationMs).padStart(9)} ${outcome}`);
193
+ const ran =
194
+ (d.runner ? ` runner=${d.runner}` : "") + (d.runnerKind ? ` kind=${d.runnerKind}` : "");
195
+ console.log(` ${d.state.padEnd(12)} ${seconds(d.durationMs).padStart(9)} ${outcome}${ran}`);
189
196
  }
190
197
  if (report.crashReasons.length) {
191
198
  console.log(`crashes: ${report.crashReasons.length}`);
@@ -235,6 +242,14 @@ function describeValidationError(err: WorkflowValidationError): string {
235
242
  return `initial cycle: ${err.cycle.join(" -> ")} -> ${err.cycle[0]}`;
236
243
  case "dead-end-leaf":
237
244
  return `"${err.state}": dead end, no on/next`;
245
+ case "unknown-runner":
246
+ return `"${err.state}": unknown runner "${err.runner}", known: ${err.known.join(", ") || "none"}`;
247
+ case "missing-runner":
248
+ return `"${err.state}": names no runner and the workflow has no default agentRunner`;
249
+ case "missing-model":
250
+ return `"${err.state}": no model, pin agent: { model } on the state or, without a runner, on the workflow`;
251
+ case "missing-output-type":
252
+ return `"${err.state}": agent leaf has no outputType — declare the schema of its handoff output (OutputSchema, see output-validation)`;
238
253
  }
239
254
  }
240
255
 
@@ -259,6 +274,50 @@ function makeChecker(): {
259
274
  return { check, failed: () => fail };
260
275
  }
261
276
 
277
+ /** Every runner export that is present but cannot be dispatched to. */
278
+ function unrunnableRunners({ agentRunner, agentRunners }: WorkflowModule): string[] {
279
+ const present: Array<[string, unknown]> = Object.entries(agentRunners ?? {}).map(
280
+ ([name, runner]) => [`agentRunners.${name}`, runner],
281
+ );
282
+ if (agentRunner !== undefined) present.unshift(["agentRunner", agentRunner]);
283
+ return present
284
+ .filter(([, runner]) => typeof (runner as Partial<AgentRunner> | null)?.run !== "function")
285
+ .map(([name]) => name);
286
+ }
287
+
288
+ /** Asks each runner about the models its agent states use, one call per runner. */
289
+ async function modelWarnings(
290
+ mod: WorkflowModule,
291
+ registry: ReturnType<typeof buildRegistry>,
292
+ rootDir: string,
293
+ ): Promise<string[]> {
294
+ // runner -> model -> the states that use it
295
+ const used = new Map<AgentRunner, Map<string, string[]>>();
296
+ for (const [state, { def }] of registry) {
297
+ if (isComposite(def) || def.type !== "agent") continue;
298
+ const runner = selectRunner(mod, def);
299
+ const { model } = effectiveAgent(def, mod.workflow.agent);
300
+ if (typeof runner?.checkModels !== "function" || typeof model !== "string" || !model) continue;
301
+ const models = used.get(runner) ?? new Map<string, string[]>();
302
+ models.set(model, [...(models.get(model) ?? []), state]);
303
+ used.set(runner, models);
304
+ }
305
+
306
+ const warnings: string[] = [];
307
+ for (const [runner, models] of used) {
308
+ try {
309
+ for (const { model, message } of await runner.checkModels!([...models.keys()], rootDir)) {
310
+ for (const state of models.get(model) ?? []) warnings.push(`"${state}": ${message}`);
311
+ }
312
+ } catch (err) {
313
+ const states = [...models.values()].flat().map((state) => `"${state}"`);
314
+ const detail = err instanceof Error ? err.message : String(err);
315
+ warnings.push(`${states.join(", ")}: could not check the model: ${detail}`);
316
+ }
317
+ }
318
+ return warnings;
319
+ }
320
+
262
321
  async function validateCmd(args: string[]): Promise<number> {
263
322
  const ref = args[0];
264
323
  const { check, failed } = makeChecker();
@@ -287,15 +346,21 @@ async function validateCmd(args: string[]): Promise<number> {
287
346
  "exports `workflow`",
288
347
  typeof mod.workflow?.states === "object" && typeof mod.workflow?.initial === "string",
289
348
  );
290
- check(
291
- "exports `agentRunner`",
292
- typeof mod.agentRunner?.run === "function",
293
- "agent states need a runner; built-ins live in src/kit/agents/",
294
- );
349
+ const unrunnable = unrunnableRunners(mod);
350
+ if (unrunnable.length === 0) {
351
+ check("agent runners", true);
352
+ } else {
353
+ for (const name of unrunnable) {
354
+ check("agent runners", false, `${name} has no run function`);
355
+ }
356
+ }
295
357
  if (typeof mod.workflow?.states === "object" && typeof mod.workflow?.initial === "string") {
296
358
  try {
297
359
  const registry = buildRegistry(mod.workflow);
298
- const errors = validateWorkflow(registry, mod.workflow.initial);
360
+ const errors = validateWorkflow(registry, mod.workflow, {
361
+ names: Object.keys(mod.agentRunners ?? {}),
362
+ hasDefault: mod.agentRunner !== undefined,
363
+ });
299
364
  if (errors.length === 0) {
300
365
  check("workflow structure", true);
301
366
  } else {
@@ -303,6 +368,10 @@ async function validateCmd(args: string[]): Promise<number> {
303
368
  check("workflow structure", false, describeValidationError(err));
304
369
  }
305
370
  }
371
+ // Advisory only: a warning never changes the exit code.
372
+ for (const warning of await modelWarnings(mod, registry, process.cwd())) {
373
+ console.log(`warn agent models — ${warning}`);
374
+ }
306
375
  } catch (err) {
307
376
  check("workflow structure", false, err instanceof Error ? err.message : String(err));
308
377
  }
@@ -312,13 +381,13 @@ async function validateCmd(args: string[]): Promise<number> {
312
381
  } catch (err) {
313
382
  check("workflow.ts loads", false, err instanceof Error ? err.message : String(err));
314
383
  check("exports `workflow`", false, "skipped — module failed to load");
315
- check("exports `agentRunner`", false, "skipped — module failed to load");
384
+ check("agent runners", false, "skipped — module failed to load");
316
385
  check("workflow structure", false, "skipped — module failed to load");
317
386
  }
318
387
  } else {
319
388
  check("workflow.ts loads", false, "skipped — no resolved workflow");
320
389
  check("exports `workflow`", false, "skipped — no resolved workflow");
321
- check("exports `agentRunner`", false, "skipped — no resolved workflow");
390
+ check("agent runners", false, "skipped — no resolved workflow");
322
391
  }
323
392
 
324
393
  return Promise.resolve(failed() ? 1 : 0);
@@ -442,7 +511,7 @@ function inputFor(
442
511
  }
443
512
 
444
513
  async function runCmd(dir: string, message?: string): Promise<void> {
445
- const { workflow, input, agentRunner, scriptRunner } = await loadWorkflow(dir);
514
+ const { workflow, input, agentRunner, agentRunners, scriptRunner } = await loadWorkflow(dir);
446
515
 
447
516
  // Pre-generated (rather than left to `run()`'s own default) and written to
448
517
  // the registry *before* dispatch starts, mirroring `startCmd`'s own
@@ -471,6 +540,7 @@ async function runCmd(dir: string, message?: string): Promise<void> {
471
540
  workflow,
472
541
  input: inputFor(message, input),
473
542
  agentRunner,
543
+ agentRunners,
474
544
  scriptRunner,
475
545
  baseDir: resolve(dir, "scripts"),
476
546
  // Run artifacts live under the invocation cwd (RunOptions' documented
@@ -640,7 +710,7 @@ async function startCmd(
640
710
  // one durable record — so a registry-update failure is swallowed, not fatal.
641
711
  async function workerCmd(dir: string, runId: string, message?: string): Promise<void> {
642
712
  const rootDir = process.cwd();
643
- const { workflow, input, agentRunner, scriptRunner } = await loadWorkflow(dir);
713
+ const { workflow, input, agentRunner, agentRunners, scriptRunner } = await loadWorkflow(dir);
644
714
 
645
715
  // The one piece of positive evidence `startCmd`'s readiness wait is
646
716
  // watching for — written only once the workflow module has actually
@@ -665,6 +735,7 @@ async function workerCmd(dir: string, runId: string, message?: string): Promise<
665
735
  workflow,
666
736
  input: inputFor(message, input),
667
737
  agentRunner,
738
+ agentRunners,
668
739
  scriptRunner,
669
740
  baseDir: resolve(dir, "scripts"),
670
741
  rootDir,
@@ -13,8 +13,14 @@ const pkgDir = resolve(import.meta.dir, "..", "..");
13
13
 
14
14
  test("tarball smoke: allowlist ships the runtime dirs and the installed CLI works", async () => {
15
15
  const npm = Bun.which("npm");
16
- if (!npm) {
17
- console.warn("npm not on PATH — skipping tarball smoke test");
16
+ // Some boxes carry an npm shim that only forwards run/test/build to bun
17
+ // (node/npm not installed). The smoke test needs a real `npm pack`, so a
18
+ // shim that cannot even report a version skips it, same as no npm.
19
+ const probe = npm
20
+ ? Bun.spawnSync([npm, "--version"], { stdout: "pipe", stderr: "pipe" })
21
+ : undefined;
22
+ if (!npm || probe?.exitCode !== 0) {
23
+ console.warn("npm not usable — skipping tarball smoke test");
18
24
  return;
19
25
  }
20
26