@krapht/ork 1.0.0-alpha.11 → 1.0.0-alpha.13

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 (40) hide show
  1. package/dist/{__build_info__-CIchF6nr.mjs → __build_info__-Da73_nBs.mjs} +4 -3
  2. package/dist/attach-E6NNyA3T.mjs +89 -0
  3. package/dist/bin.mjs +213 -1230
  4. package/dist/{decide-B6PnKeqo.mjs → builtin-files-n6o6oWpB.mjs} +3 -51
  5. package/dist/{chips-BA7SrrH5.mjs → chips-CyeB_rhR.mjs} +1 -1
  6. package/dist/{clean-Di-KT7Mf.mjs → clean-Bh4KZgzc.mjs} +1 -1
  7. package/dist/{completion-C5D0sEs5.mjs → completion-SNNNxnv9.mjs} +7 -6
  8. package/dist/{context-BaNshWr9.mjs → context-DHudLA5e.mjs} +6 -6
  9. package/dist/decide-DuIHACvH.mjs +50 -0
  10. package/dist/{find-BicBbGMg.mjs → find-CjsNYAAf.mjs} +1 -1
  11. package/dist/{format-lWhN-jYR.mjs → format-C60TFpRe.mjs} +5 -85
  12. package/dist/{help-groups-BwYoAWsh.mjs → help-groups-CyfPWlST.mjs} +8 -0
  13. package/dist/{in-a-run-CgkVouyG.mjs → in-a-run-BYjTXaST.mjs} +4 -2
  14. package/dist/{limits-jZQp9ZJC.mjs → limits-C5QKZNLT.mjs} +2 -2
  15. package/dist/{list-CEaJ07jd.mjs → list-BUb5Uc3H.mjs} +1 -1
  16. package/dist/{mcp-DYgVA9f5.mjs → mcp-bcctR-wc.mjs} +6 -6
  17. package/dist/once-DPQu5Q3H.mjs +76 -0
  18. package/dist/{output-CM95njYt.mjs → output-CnRzrbUM.mjs} +3 -1
  19. package/dist/{pause-D6PuSlNl.mjs → pause-BPvlDIvz.mjs} +4 -4
  20. package/dist/{relay-DNx7be9k.mjs → relay-C8W0t_zc.mjs} +2 -2
  21. package/dist/{remove-CpMb4NDl.mjs → remove-BkFWGVYo.mjs} +3 -3
  22. package/dist/run-CQIfq918.mjs +192 -0
  23. package/dist/{send-CLs_fyg7.mjs → send-CaZlGG5a.mjs} +3 -3
  24. package/dist/{src-D6_xjm-x.mjs → src-BeR6f70A.mjs} +595 -228
  25. package/dist/{src-B6KvTm7B.mjs → src-CGJGL1sZ.mjs} +7 -6
  26. package/dist/{src-BnZgZGrf.mjs → src-CqRqsb2t.mjs} +44 -7
  27. package/dist/{src-9iGkjnsy.mjs → src-D93tHZ5B.mjs} +110 -35
  28. package/dist/store-CM3cERGl.mjs +1365 -0
  29. package/dist/ui/THIRD_PARTY_LICENSES.txt +18 -0
  30. package/dist/ui/assets/app-DYRC0V4p.js +111 -0
  31. package/dist/ui/assets/{index-By_8KKG6.js → index-CWwm8HTG.js} +2 -2
  32. package/dist/ui/index.html +1 -1
  33. package/dist/{ui-CIci4UBW.mjs → ui-D2Ydofq0.mjs} +4 -4
  34. package/dist/{usage-GceBGMjU.mjs → usage-6WIowblz.mjs} +6 -6
  35. package/dist/verdict-CIy8tAyX.mjs +84 -0
  36. package/dist/{watch-BmoybMQg.mjs → watch-uOU_WeBI.mjs} +7 -7
  37. package/dist/{workflows-DZvW3i1e.mjs → workflows-7tQdMnrA.mjs} +3 -3
  38. package/dist/{worktrees-Be51E2rB.mjs → worktrees-ZCII298F.mjs} +5 -5
  39. package/package.json +1 -1
  40. package/dist/ui/assets/app-CxURph7a.js +0 -75
@@ -1,10 +1,11 @@
1
- import { $n as skillsIn, $t as endOf, At as nestItems, B as linkNodes, Bn as placeFiles, C as openStore, Ct as runStatus, Dt as processAlive, G as requestContinue, Gn as workflowDirOf, In as loadAgents, J as tellLiveRun, Jn as LESSON_CAP_TOKENS, K as requestPause, Kn as inside, S as isNodeEvent, St as pausedOf, U as unlinkNodes, Un as runDirOf, Ut as nodeSays, Vn as placeFor, X as detachResume, Z as resumable, a as releaseNotes, c as detectInstaller, cn as planPost, er as WorkflowEditSchema, et as detachRun, gt as walkSummary, hr as NodeSchema, ht as walkChecks, i as planUpgrade, it as limitsReport, ln as runGh, mt as checkWorkflowText, nn as END_KINDS, nr as newWorkflowText, o as runningRunIds, or as renderJsonSchema, p as triggersReport, pr as expandEdge, q as requestStop, r as capsHere, rr as readDocument, s as runningScript, sn as DISCUSSIONS, sr as parseWorkflow, st as explainWorkflowText, tr as applyEdits, tt as followEvents, un as sendPost, ur as EdgeInputSchema, w as storePath, x as activeTree, xt as liveStatus, yn as readCondition } from "./src-D6_xjm-x.mjs";
2
- import { C as feedbackActions, S as placeOf$1, _ as previewPost, a as registryShown, b as acceptItem, c as checkDue, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, o as updateSwitchOff, p as refreshUpdateCache, s as runInstall, u as newerVersion, w as openFixRun, x as lessonPlaceOf, y as recordNote } from "./__build_info__-CIchF6nr.mjs";
3
- import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-B6PnKeqo.mjs";
4
- import { n as newRunId, t as findRun } from "./find-BicBbGMg.mjs";
1
+ import { $ as followEvents, C as isNodeEvent, Ct as processAlive, Et as nestItems, G as requestStop, Gn as runDirOf, Gt as nodeSays, Hn as placeFiles, J as detachResume, Jn as inside, K as tellLiveRun, Q as detachRun, R as linkNodes, Rn as loadAgents, S as activeTree, T as storePath, U as requestContinue, Un as placeFor, V as unlinkNodes, W as requestPause, Xn as LESSON_CAP_TOKENS, Y as resumable, _t as liveStatus, a as planUpgrade, ar as readDocument, at as explainWorkflowText, c as runningScript, dn as runGh, dt as walkChecks, fn as sendPost, ft as walkSummary, gr as expandEdge, i as capsHere, in as END_KINDS, ir as newWorkflowText, l as detectInstaller, ln as DISCUSSIONS, lr as renderJsonSchema, m as triggersReport, nr as WorkflowEditSchema, nt as limitsReport, o as releaseNotes, pr as EdgeInputSchema, qn as workflowDirOf, rr as applyEdits, s as runningRunIds, tn as endOf, tr as skillsIn, un as planPost, ur as parseWorkflow, ut as checkWorkflowText, vr as NodeSchema, vt as pausedOf, w as openStore, xn as readCondition, yt as runStatus } from "./src-BeR6f70A.mjs";
2
+ import { C as feedbackActions, S as placeOf$1, _ as previewPost, a as registryShown, b as acceptItem, c as checkDue, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, o as updateSwitchOff, p as refreshUpdateCache, s as runInstall, u as newerVersion, w as openFixRun, x as lessonPlaceOf, y as recordNote } from "./__build_info__-Da73_nBs.mjs";
3
+ import { t as builtinProblem } from "./builtin-files-n6o6oWpB.mjs";
4
+ import { n as pendingDecisions, t as answerDecision } from "./decide-DuIHACvH.mjs";
5
+ import { n as newRunId, t as findRun } from "./find-CjsNYAAf.mjs";
5
6
  import { n as usageReport } from "./report-CEN8VoUb.mjs";
6
- import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-Di-KT7Mf.mjs";
7
- import { a as readWorktrees, c as mergeStateOf, d as stateParts, i as projectHead, l as planLine, n as lostWork, r as planRemove, s as labelOf, t as applyRemove, u as removeRefusal } from "./remove-CpMb4NDl.mjs";
7
+ import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-Bh4KZgzc.mjs";
8
+ import { a as readWorktrees, c as mergeStateOf, d as stateParts, i as projectHead, l as planLine, n as lostWork, r as planRemove, s as labelOf, t as applyRemove, u as removeRefusal } from "./remove-BkFWGVYo.mjs";
8
9
  import path from "node:path";
9
10
  import { z } from "zod";
10
11
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { Ar as AGENT_DRIVERS, Bt as lowerChild, En as maskSecrets, Vt as startAt, an as FEEDBACK_SEVERITIES, en as outcomeEnd, ft as parseReport, in as FEEDBACK_KINDS, nn as END_KINDS, on as FEEDBACK_TARGETS, rn as endFor, wn as MASK } from "./src-D6_xjm-x.mjs";
1
+ import { En as MASK, It as lowerChild, Lt as startAt, Nr as AGENT_DRIVERS, On as maskSecrets, an as endFor, cn as FEEDBACK_TARGETS, ct as parseReport, in as END_KINDS, nn as outcomeEnd, on as FEEDBACK_KINDS, sn as FEEDBACK_SEVERITIES } from "./src-BeR6f70A.mjs";
2
2
  import path from "node:path";
3
3
  import { z } from "zod";
4
4
  import { existsSync, linkSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -969,7 +969,7 @@ const permissionTool = defineTool({
969
969
  * kept as the session's report, and the session runner ends the session with
970
970
  * it instead of what the tool's last line says.
971
971
  */
972
- const REPORT_TOOL = "report";
972
+ const REPORT_TOOL$1 = "report";
973
973
  /** Whether the driver holds a session's final answer to its schema itself. */
974
974
  const checksItsReport = (driver) => AGENT_DRIVERS.find((d) => d.id === driver)?.capabilities.reportSchema ?? true;
975
975
  /**
@@ -985,13 +985,13 @@ const reportValidator = (schema) => {
985
985
  }
986
986
  };
987
987
  const failed = (why) => ({
988
- ...text(`The report was not accepted; fix it and call ${REPORT_TOOL} again.\n${why}`),
988
+ ...text(`The report was not accepted; fix it and call ${REPORT_TOOL$1} again.\n${why}`),
989
989
  isError: true
990
990
  });
991
991
  const bound = (report) => {
992
992
  const schema = reportValidator(report.schema);
993
993
  return {
994
- name: REPORT_TOOL,
994
+ name: REPORT_TOOL$1,
995
995
  description: "Hand in your final report: call this once your work is done, as your last step, with the report the task asks for. A report that does not fit comes back with what to fix; call again with the fixed report. The last report accepted is the one your owner gets.",
996
996
  shape: schema instanceof z.ZodObject ? schema.shape : {},
997
997
  schema,
@@ -1025,7 +1025,7 @@ const ORK_TOOLS = [
1025
1025
  releaseTool,
1026
1026
  feedbackTool,
1027
1027
  {
1028
- name: REPORT_TOOL,
1028
+ name: REPORT_TOOL$1,
1029
1029
  bind: (context) => context.report === void 0 || checksItsReport(context.driver) ? null : bound(context.report)
1030
1030
  }
1031
1031
  ];
@@ -1135,7 +1135,7 @@ const createSessionRuntime = (adapter, options = {}) => ({
1135
1135
  }
1136
1136
  }
1137
1137
  });
1138
- const byTool = tools.some((tool) => tool.name === REPORT_TOOL);
1138
+ const byTool = tools.some((tool) => tool.name === REPORT_TOOL$1);
1139
1139
  const mcp = await startOrkMcpHttp(tools, hold === void 0 || hook === void 0 ? void 0 : toolHook({
1140
1140
  hold,
1141
1141
  heavy,
@@ -1243,7 +1243,8 @@ const createSessionRuntime = (adapter, options = {}) => ({
1243
1243
  /**
1244
1244
  * @file The `claude-code` adapter's `EventDecoder` and `UsageReader`: maps the
1245
1245
  * `claude` CLI's `stream-json` lines to Ork's runtime events, marks the
1246
- * result of a turn the hold hook deferred, and adds up a session's legs.
1246
+ * result of a turn the hold hook deferred, and adds up a session's legs. Its
1247
+ * leg decoder keeps a report the session handed in and then wrote past.
1247
1248
  */
1248
1249
  const isObject$2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
1249
1250
  const get$1 = (value, key) => isObject$2(value) ? value[key] : void 0;
@@ -1378,6 +1379,41 @@ const decodeClaudeLine = (line) => {
1378
1379
  deferred: isDeferredResult(message)
1379
1380
  };
1380
1381
  };
1382
+ /** The tool `claude` hands a `--json-schema` report in with. */
1383
+ const REPORT_TOOL = "StructuredOutput";
1384
+ /**
1385
+ * A leg's decoder that keeps the last report `claude` accepted (a
1386
+ * `StructuredOutput` call whose result was not an error). When the session
1387
+ * writes on after it, `claude`'s result can come without `structured_output`;
1388
+ * the kept report is then the result's, so a session that reported is not read
1389
+ * as one that didn't.
1390
+ */
1391
+ const claudeDecoder = () => {
1392
+ const calls = /* @__PURE__ */ new Map();
1393
+ let accepted;
1394
+ return {
1395
+ decode: (line) => {
1396
+ const message = parseLine$2(line);
1397
+ for (const block of blocks(message)) {
1398
+ if (block["type"] === "tool_use" && block["name"] === REPORT_TOOL) calls.set(str$2(block["id"]), block["input"]);
1399
+ const id = str$2(block["tool_use_id"]);
1400
+ if (block["type"] === "tool_result" && calls.has(id)) {
1401
+ if (block["is_error"] !== true) accepted = calls.get(id);
1402
+ calls.delete(id);
1403
+ }
1404
+ }
1405
+ const kept = isObject$2(message) && message["type"] === "result" && (message["structured_output"] ?? null) === null && accepted !== void 0 ? {
1406
+ ...message,
1407
+ structured_output: accepted
1408
+ } : message;
1409
+ return {
1410
+ events: normalize(kept),
1411
+ deferred: isDeferredResult(message)
1412
+ };
1413
+ },
1414
+ exit: () => []
1415
+ };
1416
+ };
1381
1417
  /**
1382
1418
  * Two legs of one session, as one: the tokens of both, and the later leg's
1383
1419
  * cost, which is already the session's total (ADR-046).
@@ -1540,6 +1576,7 @@ const claudeCodeAdapter = {
1540
1576
  input: userLine
1541
1577
  },
1542
1578
  decode: decodeClaudeLine,
1579
+ legDecoder: claudeDecoder,
1543
1580
  mcp: {
1544
1581
  kind: "flag",
1545
1582
  wire: () => Promise.resolve({
@@ -1,4 +1,5 @@
1
- import { $t as endOf, Bt as lowerChild, Cr as TOOL_PREFIX, Ft as failedWith, Ht as envReadsOf, It as stoppedEnd, Lt as calledWorkflows, Mt as runScope, Nt as declaredProblem, Pt as endedWith, Rt as slotClock, Sr as INTEGRATIONS, Vt as startAt, Wt as declaredOutputOf, Xt as mcpNotText, Yt as MCP_FILE, Zt as serversIn, _n as parseTemplate, _r as isToolNode, ar as programsRunBy, at as planReason, bt as heldTimeout, dt as sessionDriver, en as outcomeEnd, gn as evaluate, gr as isClaudeNode, ir as beforeOf, lr as markValue, lt as planNodeSession, pt as reportSchemaFor, rn as endFor, tn as END_DETAIL_LIMIT, vn as renderTemplate, wr as integrationFor, xr as timeoutMs } from "./src-D6_xjm-x.mjs";
1
+ import { $t as serversIn, At as endedWith, Dr as integrationFor, Er as TOOL_PREFIX, Ht as envReadsOf, It as lowerChild, Kt as declaredOutputOf, Lt as startAt, M as sessionRefusals, Mt as stoppedEnd, Nr as AGENT_DRIVERS, Nt as calledWorkflows, Ot as runScope, Pt as slotClock, Qt as mcpNotText, Tr as INTEGRATIONS, Wt as sessionDriver, Zt as MCP_FILE, an as endFor, bn as renderTemplate, br as isToolNode, cr as programsRunBy, fr as markValue, gt as heldTimeout, jt as failedWith, kt as declaredProblem, lt as reportSchemaFor, nn as outcomeEnd, rn as END_DETAIL_LIMIT, rt as planReason, sr as beforeOf, st as planNodeSession, tn as endOf, vn as evaluate, wr as timeoutMs, yn as parseTemplate, yr as isClaudeNode } from "./src-BeR6f70A.mjs";
2
+ import { t as runOnce } from "./run-CQIfq918.mjs";
2
3
  import path from "node:path";
3
4
  import { accessSync, constants, lstatSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
5
  import { spawn } from "node:child_process";
@@ -323,7 +324,7 @@ const forkPrompt = (question, passOn) => [
323
324
  /** The fork's report: one of the options or the pass-on, and a note. */
324
325
  const forkReportSchema = (ids) => {
325
326
  const node = {
326
- type: "claude.worker",
327
+ type: "agent.worker",
327
328
  prompt: "",
328
329
  output: { schema: {
329
330
  choice: [...ids],
@@ -628,6 +629,34 @@ const notStarted = (kind, reason, limited) => ({
628
629
  }),
629
630
  ...limited === void 0 ? {} : { limited }
630
631
  });
632
+ // ../nodes/src/session-driver.ts
633
+ /**
634
+ * @file The driver a Claude node's session starts on (core's `sessionDriver`),
635
+ * and, when its model names that driver (`command-code.deepseek/…`, RFC-015),
636
+ * the fit check on the value an item rendered: the run's own check before it
637
+ * started saw only the written model.
638
+ */
639
+ /** What stops the node from running on `driver`, in one line, or nothing. */
640
+ const refusalOn = (context, driver, drivers) => {
641
+ const id = context.template ?? context.id;
642
+ const node = context.workflow.nodes[id];
643
+ const descriptor = drivers.find((d) => d.id === driver);
644
+ if (node === void 0 || descriptor === void 0) return void 0;
645
+ const refusals = sessionRefusals(id, node, context.workflow, descriptor);
646
+ return refusals.length === 0 ? void 0 : refusals.map((r) => r.message).join("; ");
647
+ };
648
+ /** The session's driver, or the node's result when none fits. */
649
+ const sessionDriverOf = (context, plan, options) => {
650
+ const driver = sessionDriver({
651
+ pinned: plan.pinned,
652
+ override: options.driver,
653
+ named: plan.driver,
654
+ ready: options.readyDriver
655
+ });
656
+ if (driver === void 0) return notStarted("tool_missing", "no agent driver is ready; see `ork doctor`");
657
+ const unfit = plan.pinned === void 0 ? void 0 : refusalOn(context, driver, options.drivers ?? AGENT_DRIVERS);
658
+ return unfit === void 0 ? driver : notStarted("invalid_node", unfit);
659
+ };
631
660
  // ../nodes/src/tool-output.ts
632
661
  /**
633
662
  * @file A tool node's structured result (`output: { format: json }`): the file
@@ -870,6 +899,28 @@ const tokenize = (command) => {
870
899
  args
871
900
  };
872
901
  };
902
+ /**
903
+ * Runs `execute`, or, with `once: true`, skips it after a pass on these files:
904
+ * `null` then, and `verify.skipped` is recorded. `shown` is the scrubbed
905
+ * command.
906
+ */
907
+ const runUnlessPassed = async ({ node, context, cwd, shown, environ, execute }) => {
908
+ if (node.once !== true) return execute();
909
+ const done = {};
910
+ const once = await runOnce({
911
+ cwd,
912
+ name: node.script === void 0 ? shown : `${shown}\n${node.script}`,
913
+ who: `${context.runId}/${context.id}`,
914
+ env: environ,
915
+ run: async () => {
916
+ done.run = await execute();
917
+ return done.run.exitCode;
918
+ }
919
+ });
920
+ if (!once.skipped) return done.run ?? execute();
921
+ context.skipped?.(shown, once.pass);
922
+ return null;
923
+ };
873
924
  // ../nodes/src/tool-ends.ts
874
925
  /**
875
926
  * @file How a tool node ended (specs/runtime/session-ends.md): a node that
@@ -915,6 +966,18 @@ const exitEnd = (output, run, context, program, signedOut) => {
915
966
  output
916
967
  }, end);
917
968
  };
969
+ /** The result of a skipped check: it passed, and printed nothing this time. */
970
+ const skippedCheck = (outputFile) => {
971
+ if (outputFile !== void 0) removeOutputFile(outputFile);
972
+ return endedWith({
973
+ ok: true,
974
+ output: {
975
+ exitCode: 0,
976
+ stdout: "",
977
+ stderr: ""
978
+ }
979
+ }, endFor("done"));
980
+ };
918
981
  // ../nodes/src/tool-scrub.ts
919
982
  /**
920
983
  * @file Masking a secret in what a program prints. A plain search, so a value
@@ -1245,7 +1308,8 @@ const clearStateFiles = (runDir, warn) => {
1245
1308
  * without a shell, checked against `allow` (or the integration's default),
1246
1309
  * its arguments and observed output fields from the integration's adapter,
1247
1310
  * long output kept in run files. It sees who it is and the node's `env:`
1248
- * (`tool-env.ts`), and may return JSON (`tool-output.ts`).
1311
+ * (`tool-env.ts`), may return JSON (`tool-output.ts`), and may run once per
1312
+ * set of files (`runUnlessPassed` in `tool-command.ts`).
1249
1313
  */
1250
1314
  /** How much of stdout and stderr a node's output keeps. */
1251
1315
  const OUTPUT_LIMIT = 65536;
@@ -1346,29 +1410,43 @@ const toolExecutor = (given, options = {}) => async (context) => {
1346
1410
  ...node.watch === void 0 ? {} : { [STATE_ENV]: prepareStateFile(context.runDir, context.id) }
1347
1411
  };
1348
1412
  const names = Object.keys(nodeEnv.values);
1349
- const release = await context.machine?.slot([command.program, ...command.args].join(" "), context.signal);
1350
- context.emit({
1351
- type: "tool.called",
1352
- id: context.id,
1353
- name: scrub(command.program),
1354
- input: {
1355
- command: scrub([
1356
- command.program,
1357
- ...command.args,
1358
- ...node.script === void 0 ? [] : ["<script>"]
1359
- ].join(" ")),
1360
- ...names.length === 0 ? {} : { env: names }
1361
- }
1362
- });
1363
- const scriptFile = node.script === void 0 ? void 0 : writeScriptFile(context.runDir, context.id, context.round, node.script);
1364
- const priority = context.machine?.priority;
1365
- const raw = await runner(command.program, scriptFile === void 0 ? command.args : [...command.args, scriptFile], {
1413
+ const shown = scrub([
1414
+ command.program,
1415
+ ...command.args,
1416
+ ...node.script === void 0 ? [] : ["<script>"]
1417
+ ].join(" "));
1418
+ const execute = async () => {
1419
+ const release = await context.machine?.slot([command.program, ...command.args].join(" "), context.signal);
1420
+ context.emit({
1421
+ type: "tool.called",
1422
+ id: context.id,
1423
+ name: scrub(command.program),
1424
+ input: {
1425
+ command: shown,
1426
+ ...names.length === 0 ? {} : { env: names }
1427
+ }
1428
+ });
1429
+ const scriptFile = node.script === void 0 ? void 0 : writeScriptFile(context.runDir, context.id, context.round, node.script);
1430
+ const priority = context.machine?.priority;
1431
+ return runner(command.program, scriptFile === void 0 ? command.args : [...command.args, scriptFile], {
1432
+ cwd,
1433
+ signal: context.signal,
1434
+ env,
1435
+ ...priority === void 0 ? {} : { priority }
1436
+ }).finally(() => {
1437
+ release?.();
1438
+ if (scriptFile !== void 0) removeOutputFile(scriptFile);
1439
+ });
1440
+ };
1441
+ const raw = await runUnlessPassed({
1442
+ node,
1443
+ context,
1366
1444
  cwd,
1367
- signal: context.signal,
1368
- env,
1369
- ...priority === void 0 ? {} : { priority }
1370
- }).finally(() => release?.());
1371
- if (scriptFile !== void 0) removeOutputFile(scriptFile);
1445
+ shown,
1446
+ environ,
1447
+ execute
1448
+ });
1449
+ if (raw === null) return skippedCheck(outputFile);
1372
1450
  const run = {
1373
1451
  exitCode: raw.exitCode,
1374
1452
  stdout: scrub(raw.stdout),
@@ -1597,7 +1675,7 @@ const checkedResult = (result, { check, resumes }) => {
1597
1675
  };
1598
1676
  // ../nodes/src/claude.ts
1599
1677
  /**
1600
- * @file The Claude node type: runs a `claude.leader` or `claude.worker` as one
1678
+ * @file The Claude node type: runs an `agent.leader` or `agent.worker` as one
1601
1679
  * session, planned with the run's outputs (and the brief its owner gave it),
1602
1680
  * and turns its report into the node's output. A leader gets its children
1603
1681
  * through the session's ports, and resumes its session on re-entry
@@ -1640,7 +1718,7 @@ const specFor = (spec, context) => {
1640
1718
  };
1641
1719
  return spec;
1642
1720
  };
1643
- /** Runs a `claude.leader` or `claude.worker` as one session. */
1721
+ /** Runs an `agent.leader` or `agent.worker` as one session. */
1644
1722
  const claudeExecutor = (options) => async (context) => {
1645
1723
  const planOptions = planOptionsOf(context, options.inPlace);
1646
1724
  const before = beforeOf(context.node, context.workflow.defaults);
@@ -1676,12 +1754,8 @@ const claudeExecutor = (options) => async (context) => {
1676
1754
  ...servers.value
1677
1755
  };
1678
1756
  if (options.machineClaude === true) spec.machineClaude = true;
1679
- const driver = sessionDriver({
1680
- override: options.driver,
1681
- named: plan.driver,
1682
- ready: options.readyDriver
1683
- });
1684
- if (driver === void 0) return notStarted("tool_missing", "no agent driver is ready; see `ork doctor`");
1757
+ const driver = sessionDriverOf(context, plan, options);
1758
+ if (typeof driver !== "string") return driver;
1685
1759
  const runtime = await options.runtimeFor(driver);
1686
1760
  const ports = { human: context.owner === void 0 ? withdrawnOnStop(context) : ownerFirst(context, context.owner, {
1687
1761
  runtimeFor: options.runtimeFor,
@@ -1824,6 +1898,7 @@ const gateExecutor = async (context) => {
1824
1898
  nodeId: context.id,
1825
1899
  question,
1826
1900
  options,
1901
+ waits: true,
1827
1902
  signal: withdraw.signal,
1828
1903
  onNote: (given) => {
1829
1904
  note = given;
@@ -2143,8 +2218,8 @@ const builtinExecutors = (options) => {
2143
2218
  steps: tool
2144
2219
  });
2145
2220
  const executors = {
2146
- "claude.leader": claude,
2147
- "claude.worker": claude,
2221
+ "agent.leader": claude,
2222
+ "agent.worker": claude,
2148
2223
  "human.gate": gateExecutor,
2149
2224
  "workflow.call": callExecutor,
2150
2225
  "mcp.call": mcpCallExecutor(options.maskedNames === void 0 ? {} : { maskedNames: options.maskedNames })