@krapht/ork 1.0.0-alpha.0 → 1.0.0-alpha.2

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 (33) hide show
  1. package/README.md +2 -2
  2. package/dist/{__build_info__-DdTVd2p5.mjs → __build_info__-fy6L1Mrd.mjs} +2 -2
  3. package/dist/bin.mjs +54 -35
  4. package/dist/{clean-NnboOuz6.mjs → clean-DaHjs__2.mjs} +1 -1
  5. package/dist/{completion-snnYGjgK.mjs → completion-CSU5vkEt.mjs} +5 -5
  6. package/dist/{context-DO3sBy9v.mjs → context-DT8MfEIR.mjs} +3 -3
  7. package/dist/{decide-B81wCZQg.mjs → decide-CGyx9rv7.mjs} +1 -1
  8. package/dist/{find-BKW-uGey.mjs → find-D6Gj1sxg.mjs} +1 -1
  9. package/dist/{format-CmTlTOjT.mjs → format-Dnfv8zMT.mjs} +2 -2
  10. package/dist/{in-a-run-BPXX09Bs.mjs → in-a-run-pLAZeNys.mjs} +1 -1
  11. package/dist/{limits-JCve2QpI.mjs → limits-B1-DYc3d.mjs} +1 -1
  12. package/dist/{list-C7UEgmtd.mjs → list-BrH8KRSJ.mjs} +1 -1
  13. package/dist/{mcp-CKPyNaKD.mjs → mcp-DE_EmyVm.mjs} +6 -6
  14. package/dist/{output-B1V6ZJSx.mjs → output-BLQWD6MJ.mjs} +1 -1
  15. package/dist/{pause-B_SL_yDz.mjs → pause-CL6N_Xrj.mjs} +4 -4
  16. package/dist/{relay-o-Luee1c.mjs → relay-0SD0erwf.mjs} +2 -2
  17. package/dist/{remove-DAZ7ZCzt.mjs → remove-BeGdqroy.mjs} +3 -3
  18. package/dist/{send-3B64fBNB.mjs → send-C8tunWhv.mjs} +3 -3
  19. package/dist/{src-BJTegEzY.mjs → src-BbyEoMn4.mjs} +12 -9
  20. package/dist/{src-Dyz_Gy1q.mjs → src-CCUKRX51.mjs} +28 -7
  21. package/dist/{src-C38BPzit.mjs → src-DOcK8Jfp.mjs} +2 -1
  22. package/dist/{src-DHvWU4tX.mjs → src-Dujmvv4s.mjs} +23 -7
  23. package/dist/ui/assets/app-BNT0SuIz.css +1 -0
  24. package/dist/ui/assets/{app-C8nJ6NpT.js → app-T7wVAhgx.js} +13 -13
  25. package/dist/ui/assets/{index-D83F2OKZ.js → index-9dFha9Qn.js} +2 -2
  26. package/dist/ui/index.html +1 -1
  27. package/dist/{ui-CY4xxJUu.mjs → ui-CTmO2Xzu.mjs} +4 -4
  28. package/dist/{usage-CJnytoe4.mjs → usage-DYUmP0i4.mjs} +5 -5
  29. package/dist/{watch-BJB82ZJ7.mjs → watch-CtbgDAcz.mjs} +6 -6
  30. package/dist/{workflows-CiM7S3l0.mjs → workflows-D1_WVukk.mjs} +3 -3
  31. package/dist/{worktrees-86ySXxR6.mjs → worktrees-DdMYoNOC.mjs} +4 -4
  32. package/package.json +1 -1
  33. package/dist/ui/assets/app-CH7YC3in.css +0 -1
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  The `ork` command: orchestrate Claude agents on your machine with hierarchical,
4
4
  serializable workflows.
5
5
 
6
- > **Pre-alpha.** Workflows of Claude agents and tools, run from the terminal or
7
- > the browser (`ork ui`). Expect changes between 0.x releases. See the
6
+ > **Alpha.** Workflows of Claude agents and tools, run from the terminal or the
7
+ > browser (`ork ui`). Expect changes until 1.0.0. See the
8
8
  > [project README](https://github.com/mimshins/ork#readme), the
9
9
  > [guides](https://github.com/mimshins/ork/tree/main/docs#readme) and
10
10
  > [what's new](https://github.com/mimshins/ork/blob/main/docs/whats-new.md).
@@ -1,4 +1,4 @@
1
- import { An as guardedBase, En as inside, Gt as publishPost, Mn as writePlainFile, On as LESSON_CAP_TOKENS, Rt as FEEDBACK_KINDS, Yt as targetOf, Zt as maskSecrets, bn as placeFiles, g as parseVersion, h as isNewer, jn as plainPathInside, kn as estimateTokens, m as compareVersions, qt as fingerprint, xn as placeFor, zt as FEEDBACK_SEVERITIES } from "./src-DHvWU4tX.mjs";
1
+ import { An as guardedBase, En as inside, Gt as publishPost, Mn as writePlainFile, On as LESSON_CAP_TOKENS, Rt as FEEDBACK_KINDS, Yt as targetOf, Zt as maskSecrets, bn as placeFiles, g as parseVersion, h as isNewer, jn as plainPathInside, kn as estimateTokens, m as compareVersions, qt as fingerprint, xn as placeFor, zt as FEEDBACK_SEVERITIES } from "./src-Dujmvv4s.mjs";
2
2
  import path from "node:path";
3
3
  import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
4
4
  import { homedir } from "node:os";
@@ -611,5 +611,5 @@ const registryShown = (registry) => {
611
611
  * fails when it is stale.
612
612
  */
613
613
  const ORK_NAME = "@krapht/ork";
614
- const ORK_VERSION = "1.0.0-alpha.0";
614
+ const ORK_VERSION = "1.0.0-alpha.2";
615
615
  export { feedbackActions as C, placeOf as S, previewPost as _, registryShown as a, acceptItem as b, checkDue as c, pendingNotice as d, readUpdateCache as f, nodeSession as g, writeUpdateCache as h, registryOf as i, fetchLatest as l, updateCachePath as m, ORK_VERSION as n, updateSwitchOff as o, refreshUpdateCache as p, isSwitchedOn as r, runInstall as s, ORK_NAME as t, newerVersion as u, checkNote as v, openFixRun as w, lessonPlaceOf as x, recordNote as y };
package/dist/bin.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { Bn as serializeWorkflow, Bt as FEEDBACK_TARGETS, Cn as runDirOf, D as inspectProject, Dn as projectRootOf, Dt as userMessageText, En as inside, Ft as PROJECT_FILE, H as tellNode, Ht as planPost, I as createCalls, It as gitRulesOf, J as tellLiveRun, Jn as beforeOf, Jt as normalizeTitle, Kn as settingsOf, Kt as createFeedback, L as addressOf, Lt as loadProject, M as clearGitLocalEnv, N as parseInputPairs, P as resolveInputs, R as endLink, Rt as FEEDBACK_KINDS, Sn as projectsHome, Tt as startRun, Un as WorkflowSchema, V as peerOf, W as flattenTree, Wt as sendPost, Xt as maskReplacer, Yn as isClaudeNode, _ as lateTriggers, _n as hasInRepoFiles, _t as runStatus, an as wakeRun, ar as CLAUDE_DRIVERS, bn as placeFiles, cn as planMoveInto, d as runningRunIds, dn as toolsInUse, dt as namingNoDriver, er as INTEGRATIONS, et as adoptedCalls, f as runningScript, fn as createAgent, ft as sessionDriver, h as isNewer, hn as loadAgents, ht as liveStatus, i as NOT_STARTED, in as socketRoom, ir as ORK_LAYOUT, it as replayLoopAnswers, l as planUpgrade, ln as linkTools, mn as catalogAgent, n as resolveBase, nn as serveRun, nt as resumable, on as planAgentMigration, or as firstLine, ot as detachRun, pn as deleteAgent, q as requestStop, qt as fingerprint, rn as socketPath, rr as AGENT_TOOL_LAYOUTS, rt as createReplay, sn as applySteps, st as followEvents, t as createWorkspace, tt as detachResume, u as releaseNotes, un as toolLinks, ut as planNodeSession, v as triggersReport, vn as inRepoPlace, vt as runTree, wn as shownPath, wt as walkSummary, xn as placeFor, yn as newProjectId, z as endLinksOf, zt as FEEDBACK_SEVERITIES } from "./src-DHvWU4tX.mjs";
3
- import { C as feedbackActions, S as placeOf, _ as previewPost, b as acceptItem, c as checkDue, d as pendingNotice, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, n as ORK_VERSION, o as updateSwitchOff, p as refreshUpdateCache, r as isSwitchedOn, s as runInstall, t as ORK_NAME, u as newerVersion$1, v as checkNote, w as openFixRun, y as recordNote } from "./__build_info__-DdTVd2p5.mjs";
4
- import { i as builtinWorkflowFile, n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-B81wCZQg.mjs";
5
- import { n as newRunId, t as findRun } from "./find-BKW-uGey.mjs";
6
- import { a as write, c as openStore, i as style, l as storePath, n as cost, o as writeErr, s as nodeOf, t as confirm } from "./output-B1V6ZJSx.mjs";
7
- import { n as listOrkWorktrees, t as createdWorktrees } from "./list-C7UEgmtd.mjs";
8
- import { a as planClean, t as applyClean } from "./clean-NnboOuz6.mjs";
2
+ import { Bn as serializeWorkflow, Bt as FEEDBACK_TARGETS, Cn as runDirOf, D as inspectProject, Dn as projectRootOf, Dt as userMessageText, En as inside, Ft as PROJECT_FILE, H as tellNode, Ht as planPost, I as createCalls, It as gitRulesOf, J as tellLiveRun, Jn as beforeOf, Jt as normalizeTitle, Kn as settingsOf, Kt as createFeedback, L as addressOf, Lt as loadProject, M as clearGitLocalEnv, N as parseInputPairs, P as resolveInputs, R as endLink, Rt as FEEDBACK_KINDS, Sn as projectsHome, Tt as startRun, Un as WorkflowSchema, V as peerOf, W as flattenTree, Wt as sendPost, Xt as maskReplacer, Yn as isClaudeNode, _ as lateTriggers, _n as hasInRepoFiles, _t as runStatus, an as wakeRun, ar as CLAUDE_DRIVERS, bn as placeFiles, cn as planMoveInto, d as runningRunIds, dn as toolsInUse, dt as namingNoDriver, er as INTEGRATIONS, et as adoptedCalls, f as runningScript, fn as createAgent, ft as sessionDriver, h as isNewer, hn as loadAgents, ht as liveStatus, i as NOT_STARTED, in as socketRoom, ir as ORK_LAYOUT, it as replayLoopAnswers, l as planUpgrade, ln as linkTools, mn as catalogAgent, n as resolveBase, nn as serveRun, nt as resumable, on as planAgentMigration, or as firstLine, ot as detachRun, pn as deleteAgent, q as requestStop, qt as fingerprint, rn as socketPath, rr as AGENT_TOOL_LAYOUTS, rt as createReplay, sn as applySteps, st as followEvents, t as createWorkspace, tt as detachResume, u as releaseNotes, un as toolLinks, ut as planNodeSession, v as triggersReport, vn as inRepoPlace, vt as runTree, wn as shownPath, wt as walkSummary, xn as placeFor, yn as newProjectId, z as endLinksOf, zt as FEEDBACK_SEVERITIES } from "./src-Dujmvv4s.mjs";
3
+ import { C as feedbackActions, S as placeOf, _ as previewPost, b as acceptItem, c as checkDue, d as pendingNotice, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, n as ORK_VERSION, o as updateSwitchOff, p as refreshUpdateCache, r as isSwitchedOn, s as runInstall, t as ORK_NAME, u as newerVersion$1, v as checkNote, w as openFixRun, y as recordNote } from "./__build_info__-fy6L1Mrd.mjs";
4
+ import { i as builtinWorkflowFile, n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-CGyx9rv7.mjs";
5
+ import { n as newRunId, t as findRun } from "./find-D6Gj1sxg.mjs";
6
+ import { a as write, c as openStore, i as style, l as storePath, n as cost, o as writeErr, s as nodeOf, t as confirm } from "./output-BLQWD6MJ.mjs";
7
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-BrH8KRSJ.mjs";
8
+ import { a as planClean, t as applyClean } from "./clean-DaHjs__2.mjs";
9
9
  import { c as subcommandsOf, i as argsOf, n as groupedEntries, o as publicArgs, s as resolved, t as groupOf } from "./help-groups-BwYoAWsh.mjs";
10
- import { a as formatRunEvent, i as formatEvent, n as formatRuns, o as createTerminalHuman, r as formatTree, t as ago } from "./format-CmTlTOjT.mjs";
11
- import { c as registeredProjects, i as refusedBuiltin, n as WORKFLOW_SUFFIX, o as workflowArg, s as projectAt, t as WORKFLOW_DIR } from "./workflows-CiM7S3l0.mjs";
12
- import { a as validate, c as warningLines, i as loadWorkflow, o as validateFile, r as formatReport, s as walkLoaded, t as context } from "./context-DO3sBy9v.mjs";
13
- import { i as runLimits, r as limitsRefusal, t as chatNotice } from "./limits-JCve2QpI.mjs";
14
- import { _ as resultOf, a as builtinExecutors, d as maskedEnv, f as maskedNamesOfRun, g as clearOutputFiles, h as sessionEnv, i as onPath, l as clearStateFiles, m as runScrubber, n as missingProgramMessage, r as missingPrograms, t as envProblems } from "./src-C38BPzit.mjs";
15
- import { i as decideRefusal, n as chatRefusal } from "./in-a-run-BPXX09Bs.mjs";
10
+ import { a as formatRunEvent, i as formatEvent, n as formatRuns, o as createTerminalHuman, r as formatTree, t as ago } from "./format-Dnfv8zMT.mjs";
11
+ import { c as registeredProjects, i as refusedBuiltin, n as WORKFLOW_SUFFIX, o as workflowArg, s as projectAt, t as WORKFLOW_DIR } from "./workflows-D1_WVukk.mjs";
12
+ import { a as validate, c as warningLines, i as loadWorkflow, o as validateFile, r as formatReport, s as walkLoaded, t as context } from "./context-DT8MfEIR.mjs";
13
+ import { i as runLimits, r as limitsRefusal, t as chatNotice } from "./limits-B1-DYc3d.mjs";
14
+ import { _ as resultOf, a as builtinExecutors, d as maskedEnv, f as maskedNamesOfRun, g as clearOutputFiles, h as sessionEnv, i as onPath, l as clearStateFiles, m as runScrubber, n as missingProgramMessage, r as missingPrograms, t as envProblems } from "./src-DOcK8Jfp.mjs";
15
+ import { i as decideRefusal, n as chatRefusal } from "./in-a-run-pLAZeNys.mjs";
16
16
  import path from "node:path";
17
17
  import { stringify } from "yaml";
18
18
  import { z } from "zod";
@@ -991,7 +991,8 @@ const runReadyDriver = async (workflow, options) => {
991
991
  * the store and the run's socket, and the run's bus pushes it into the node's
992
992
  * session (specs/messaging.md#chat; `tellLiveRun` and `nodeSession` are in
993
993
  * core). A node of a finished run gets it by resuming its last Claude session
994
- * where it ran, and the exchange is added to the run's record.
994
+ * where it ran, as the run's sessions were set up (ADR-065), and the exchange
995
+ * is added to the run's record.
995
996
  */
996
997
  /** The declared node a spawned worker (`<template>-<n>`) is an instance of. */
997
998
  const templateOf = (nodes, id) => {
@@ -999,13 +1000,16 @@ const templateOf = (nodes, id) => {
999
1000
  const template = id.replace(/-\d+$/u, "");
1000
1001
  return template in nodes ? template : void 0;
1001
1002
  };
1003
+ /** The run's sessions loaded the machine's Claude setup, so this one does. */
1004
+ const machineClaudeOf = (events) => events.some(({ event }) => event.type === "run.started" && event.settings?.machineClaude === true) ? { machineClaude: true } : {};
1002
1005
  /**
1003
1006
  * Resumes a finished node's last session with the user's message, prints the
1004
1007
  * session, and adds it to the run's record. Returns why it could not.
1005
1008
  */
1006
1009
  const resumeChat = async (options) => {
1007
1010
  const { store, run, node } = options;
1008
- const { session, outputs } = nodeSession(store.events(run.id, 0), node);
1011
+ const events = store.events(run.id, 0);
1012
+ const { session, outputs } = nodeSession(events, node);
1009
1013
  if (!session.known) return `${node} is not a node of run ${run.id}.`;
1010
1014
  if (!session.chattable) return `${node} is not a leader or worker; only they have sessions to talk to.`;
1011
1015
  if (session.sessionId === void 0) return `${node} has no Claude session to resume in run ${run.id}.`;
@@ -1047,7 +1051,8 @@ const resumeChat = async (options) => {
1047
1051
  const started = (await options.runtime(driver)).start({
1048
1052
  ...plan.spec,
1049
1053
  resume: session.sessionId,
1050
- prompt: options.body
1054
+ prompt: options.body,
1055
+ ...machineClaudeOf(events)
1051
1056
  }, { human: options.human });
1052
1057
  if (options.signal?.aborted === true) started.interrupt();
1053
1058
  options.signal?.addEventListener("abort", () => {
@@ -1223,7 +1228,8 @@ const runNode = async (options) => {
1223
1228
  nodes: [{
1224
1229
  id,
1225
1230
  type: nodeType
1226
- }]
1231
+ }],
1232
+ ...options.machineClaude === true ? { settings: { machineClaude: true } } : {}
1227
1233
  });
1228
1234
  record({
1229
1235
  type: "node.started",
@@ -1231,7 +1237,9 @@ const runNode = async (options) => {
1231
1237
  nodeType,
1232
1238
  round: 1
1233
1239
  });
1234
- const session = (await options.runtime(driver)).start(plan.spec, {
1240
+ const runtime = await options.runtime(driver);
1241
+ if (options.machineClaude === true) plan.spec.machineClaude = true;
1242
+ const session = runtime.start(plan.spec, {
1235
1243
  human: control.human,
1236
1244
  ...graph === null ? {} : { feedback: createFeedback({
1237
1245
  graph,
@@ -1295,7 +1303,8 @@ const runNode = async (options) => {
1295
1303
  * @file What a run needs to reach other runs: its port for `workflow.call`
1296
1304
  * nodes (RFC-004), its relay when links are on (RFC-003), and the budget a
1297
1305
  * caller has capped it to. A called run being resumed keeps its caller and
1298
- * its cap, which the run recorded.
1306
+ * its cap, which the run recorded, and a run's called runs load the machine's
1307
+ * Claude setup when it does (ADR-065).
1299
1308
  */
1300
1309
  const callPorts = (options) => {
1301
1310
  const { graph, store, runId, home, human, runtime, out } = options;
@@ -1305,6 +1314,7 @@ const callPorts = (options) => {
1305
1314
  const baseRef = options.baseRef ?? options.resume?.settings.baseRef;
1306
1315
  const trigger = options.trigger ?? options.resume?.settings.trigger;
1307
1316
  const untrusted = options.untrusted ?? options.resume?.settings.untrusted;
1317
+ const machineClaude = options.machineClaude ?? options.resume?.settings.machineClaude ?? false;
1308
1318
  const own = graph.workflow.limits?.budgetUsd;
1309
1319
  const budgetUsd = cap === void 0 ? own : Math.min(cap, own ?? Number.POSITIVE_INFINITY);
1310
1320
  return {
@@ -1326,6 +1336,7 @@ const callPorts = (options) => {
1326
1336
  home,
1327
1337
  adopt: adoptedCalls(store, runId),
1328
1338
  newId: () => newRunId(store),
1339
+ machineClaude,
1329
1340
  env: maskedEnv(maskedNamesOfRun(graph.workflow, options.place, store.projects())),
1330
1341
  resumeSession: (run, node, body, signal) => {
1331
1342
  const { blocked, leftUsd } = runLimits(store, options.place, home).now();
@@ -1355,7 +1366,8 @@ const callPorts = (options) => {
1355
1366
  ...calledBy === void 0 ? {} : { calledBy },
1356
1367
  ...baseRef === void 0 ? {} : { baseRef },
1357
1368
  ...trigger === void 0 ? {} : { trigger },
1358
- ...untrusted === void 0 ? {} : { untrusted }
1369
+ ...untrusted === void 0 ? {} : { untrusted },
1370
+ ...machineClaude ? { machineClaude } : {}
1359
1371
  }
1360
1372
  };
1361
1373
  };
@@ -1615,6 +1627,7 @@ const runWorkflowFile = async (options) => {
1615
1627
  human: control.human,
1616
1628
  emit: onEvent
1617
1629
  });
1630
+ if (ports.settings.machineClaude === true) executorOptions.machineClaude = true;
1618
1631
  clearOutputFiles(runDir, options.err);
1619
1632
  const handle = startRun({
1620
1633
  graph: ports.graph,
@@ -1672,7 +1685,7 @@ const flagValues = (rawArgs, flag) => {
1672
1685
  };
1673
1686
  const isDriver = (value) => CLAUDE_DRIVERS.some((d) => d.id === value);
1674
1687
  /** Loads the drivers only when a run starts, so other commands stay fast. */
1675
- const loadRuntime = async (driver) => (await import("./src-Dyz_Gy1q.mjs")).createRuntime(driver, sessionEnv(process.env));
1688
+ const loadRuntime = async (driver) => (await import("./src-CCUKRX51.mjs")).createRuntime(driver, sessionEnv(process.env));
1676
1689
  /**
1677
1690
  * Ctrl-C asks the run to stop, and so does a terminal closing or a polite kill,
1678
1691
  * so that the run ends tidily and leaves no result unscrubbed.
@@ -1728,6 +1741,11 @@ const run = defineCommand({
1728
1741
  description: "Run although instructions or skills have uncommitted changes (worktrees get the committed versions)",
1729
1742
  default: false
1730
1743
  },
1744
+ "machine-claude": {
1745
+ type: "boolean",
1746
+ description: "Sessions load this machine's Claude setup: its MCP servers and Claude's memory (default: clean sessions)",
1747
+ default: false
1748
+ },
1731
1749
  json: {
1732
1750
  type: "boolean",
1733
1751
  description: "Print the events as JSON lines",
@@ -1812,6 +1830,7 @@ const run = defineCommand({
1812
1830
  cwd,
1813
1831
  inputs: flagValues(rawArgs, "--input"),
1814
1832
  inPlace: args["in-place"],
1833
+ ...args["machine-claude"] ? { machineClaude: true } : {},
1815
1834
  json: args.json,
1816
1835
  runtime: loadRuntime,
1817
1836
  store,
@@ -4556,27 +4575,27 @@ const main = defineCommand({
4556
4575
  ps,
4557
4576
  logs,
4558
4577
  tree,
4559
- usage: () => import("./usage-CJnytoe4.mjs").then((module) => module.usage),
4560
- prune: () => import("./usage-CJnytoe4.mjs").then((module) => module.prune),
4578
+ usage: () => import("./usage-DYUmP0i4.mjs").then((module) => module.usage),
4579
+ prune: () => import("./usage-DYUmP0i4.mjs").then((module) => module.prune),
4561
4580
  decide,
4562
- relay: () => import("./relay-o-Luee1c.mjs").then((module) => module.relay),
4563
- pause: () => import("./pause-B_SL_yDz.mjs").then((module) => module.pause),
4564
- continue: () => import("./pause-B_SL_yDz.mjs").then((module) => module.continueRun),
4581
+ relay: () => import("./relay-0SD0erwf.mjs").then((module) => module.relay),
4582
+ pause: () => import("./pause-CL6N_Xrj.mjs").then((module) => module.pause),
4583
+ continue: () => import("./pause-CL6N_Xrj.mjs").then((module) => module.continueRun),
4565
4584
  stop,
4566
4585
  chat,
4567
- send: () => import("./send-3B64fBNB.mjs").then((module) => module.send),
4586
+ send: () => import("./send-C8tunWhv.mjs").then((module) => module.send),
4568
4587
  resume,
4569
4588
  feedback,
4570
4589
  context,
4571
- worktrees: () => import("./worktrees-86ySXxR6.mjs").then((module) => module.worktrees),
4572
- wt: () => import("./worktrees-86ySXxR6.mjs").then((module) => module.worktrees),
4573
- watch: () => import("./watch-BJB82ZJ7.mjs").then((module) => module.watch),
4574
- mcp: () => import("./mcp-CKPyNaKD.mjs").then((module) => module.mcp),
4575
- ui: () => import("./ui-CY4xxJUu.mjs").then((module) => module.ui),
4590
+ worktrees: () => import("./worktrees-DdMYoNOC.mjs").then((module) => module.worktrees),
4591
+ wt: () => import("./worktrees-DdMYoNOC.mjs").then((module) => module.worktrees),
4592
+ watch: () => import("./watch-CtbgDAcz.mjs").then((module) => module.watch),
4593
+ mcp: () => import("./mcp-DE_EmyVm.mjs").then((module) => module.mcp),
4594
+ ui: () => import("./ui-CTmO2Xzu.mjs").then((module) => module.ui),
4576
4595
  doctor,
4577
4596
  upgrade,
4578
- completion: () => import("./completion-snnYGjgK.mjs").then((module) => module.completion),
4579
- __complete: () => import("./completion-snnYGjgK.mjs").then((module) => module.completeCommand(main))
4597
+ completion: () => import("./completion-CSU5vkEt.mjs").then((module) => module.completion),
4598
+ __complete: () => import("./completion-CSU5vkEt.mjs").then((module) => module.completeCommand(main))
4580
4599
  }
4581
4600
  });
4582
4601
  // src/bin.ts
@@ -4594,7 +4613,7 @@ const main = defineCommand({
4594
4613
  clearGitLocalEnv();
4595
4614
  const argv = process.argv.slice(2);
4596
4615
  if (argv[0] === "__complete") {
4597
- const { printCompletions } = await import("./completion-snnYGjgK.mjs");
4616
+ const { printCompletions } = await import("./completion-CSU5vkEt.mjs");
4598
4617
  await printCompletions(main, argv.slice(1));
4599
4618
  } else if (process.env["ORK_UPDATE_CHECK_CHILD"] === "1") await runUpdateChild();
4600
4619
  else {
@@ -1,4 +1,4 @@
1
- import { A as gitOk, O as removeWorktree } from "./src-DHvWU4tX.mjs";
1
+ import { A as gitOk, O as removeWorktree } from "./src-Dujmvv4s.mjs";
2
2
  // ../core/src/worktree/clean.ts
3
3
  /**
4
4
  * @file What `ork worktrees clean` and `ork worktrees remove` do with what
@@ -1,9 +1,9 @@
1
- import { Qn as NodeIdSchema, ar as CLAUDE_DRIVERS, bn as placeFiles, ht as liveStatus, xn as placeFor } from "./src-DHvWU4tX.mjs";
2
- import { a as builtinWorkflowNames, n as pendingDecisions, o as builtinWorkflowText, s as isBuiltinArg } from "./decide-B81wCZQg.mjs";
3
- import { t as findRun } from "./find-BKW-uGey.mjs";
4
- import { c as openStore, l as storePath, o as writeErr } from "./output-B1V6ZJSx.mjs";
1
+ import { Qn as NodeIdSchema, ar as CLAUDE_DRIVERS, bn as placeFiles, ht as liveStatus, xn as placeFor } from "./src-Dujmvv4s.mjs";
2
+ import { a as builtinWorkflowNames, n as pendingDecisions, o as builtinWorkflowText, s as isBuiltinArg } from "./decide-CGyx9rv7.mjs";
3
+ import { t as findRun } from "./find-D6Gj1sxg.mjs";
4
+ import { c as openStore, l as storePath, o as writeErr } from "./output-BLQWD6MJ.mjs";
5
5
  import { a as findEntry, c as subcommandsOf, d as SHELL_SCRIPTS, l as COMPLETE_COMMAND, n as groupedEntries, r as argInfoOf, t as groupOf, u as SHELLS } from "./help-groups-BwYoAWsh.mjs";
6
- import { a as resolveWorkflowArg, n as WORKFLOW_SUFFIX } from "./workflows-CiM7S3l0.mjs";
6
+ import { a as resolveWorkflowArg, n as WORKFLOW_SUFFIX } from "./workflows-D1_WVukk.mjs";
7
7
  import path from "node:path";
8
8
  import { parse } from "yaml";
9
9
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
@@ -1,6 +1,6 @@
1
- import { C as workflowTextHash, Ct as walkChecks, On as LESSON_CAP_TOKENS, S as readProjectTriggers, St as checkWorkflowText, Tn as workflowDirOf, bn as placeFiles, lt as explainSession, wt as walkSummary, xn as placeFor } from "./src-DHvWU4tX.mjs";
2
- import { a as write, i as style, r as plain } from "./output-B1V6ZJSx.mjs";
3
- import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-CiM7S3l0.mjs";
1
+ import { C as workflowTextHash, Ct as walkChecks, On as LESSON_CAP_TOKENS, S as readProjectTriggers, St as checkWorkflowText, Tn as workflowDirOf, bn as placeFiles, lt as explainSession, wt as walkSummary, xn as placeFor } from "./src-Dujmvv4s.mjs";
2
+ import { a as write, i as style, r as plain } from "./output-BLQWD6MJ.mjs";
3
+ import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-D1_WVukk.mjs";
4
4
  import path from "node:path";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { defineCommand } from "citty";
@@ -1,4 +1,4 @@
1
- import { An as guardedBase, Mn as writePlainFile, an as wakeRun, bn as placeFiles, ht as liveStatus, jn as plainPathInside, rn as socketPath } from "./src-DHvWU4tX.mjs";
1
+ import { An as guardedBase, Mn as writePlainFile, an as wakeRun, bn as placeFiles, ht as liveStatus, jn as plainPathInside, rn as socketPath } from "./src-Dujmvv4s.mjs";
2
2
  import path from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { createHash } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { xn as placeFor } from "./src-DHvWU4tX.mjs";
1
+ import { xn as placeFor } from "./src-Dujmvv4s.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  // ../core/src/remote/find.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { ht as liveStatus } from "./src-DHvWU4tX.mjs";
2
- import { i as style, n as cost } from "./output-B1V6ZJSx.mjs";
1
+ import { ht as liveStatus } from "./src-Dujmvv4s.mjs";
2
+ import { i as style, n as cost } from "./output-BLQWD6MJ.mjs";
3
3
  import { createInterface } from "node:readline/promises";
4
4
  // src/human.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { p as runMarkerIn } from "./src-C38BPzit.mjs";
1
+ import { p as runMarkerIn } from "./src-DOcK8Jfp.mjs";
2
2
  // src/commands/in-a-run.ts
3
3
  /**
4
4
  * @file The commands that act as the user refuse a program or an agent in a run
@@ -1,4 +1,4 @@
1
- import { a as limitsNow, i as NOT_STARTED, o as limitsReport, r as capsHere } from "./src-DHvWU4tX.mjs";
1
+ import { a as limitsNow, i as NOT_STARTED, o as limitsReport, r as capsHere } from "./src-Dujmvv4s.mjs";
2
2
  // src/run/limits.ts
3
3
  /**
4
4
  * @file The limits across runs that apply here (RFC-007): the user's settings
@@ -1,4 +1,4 @@
1
- import { A as gitOk, j as lines, k as git } from "./src-DHvWU4tX.mjs";
1
+ import { A as gitOk, j as lines, k as git } from "./src-Dujmvv4s.mjs";
2
2
  import { existsSync } from "node:fs";
3
3
  // ../core/src/worktree/list.ts
4
4
  /**
@@ -1,8 +1,8 @@
1
- import { h as isNewer } from "./src-DHvWU4tX.mjs";
2
- import { n as ORK_VERSION } from "./__build_info__-DdTVd2p5.mjs";
3
- import { a as openMcp, c as refused, o as tool, s as answer } from "./src-BJTegEzY.mjs";
4
- import { n as explainNode } from "./context-DO3sBy9v.mjs";
5
- import { p as runMarkerIn } from "./src-C38BPzit.mjs";
1
+ import { h as isNewer } from "./src-Dujmvv4s.mjs";
2
+ import { n as ORK_VERSION } from "./__build_info__-fy6L1Mrd.mjs";
3
+ import { a as openMcp, c as refused, o as tool, s as answer } from "./src-BbyEoMn4.mjs";
4
+ import { n as explainNode } from "./context-DT8MfEIR.mjs";
5
+ import { p as runMarkerIn } from "./src-DOcK8Jfp.mjs";
6
6
  import { z } from "zod";
7
7
  import { defineCommand } from "citty";
8
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -43,7 +43,7 @@ const orkMcpServer = (options = {}) => {
43
43
  ...options.script === void 0 ? {} : { script: options.script }
44
44
  });
45
45
  const all = [...opened.tools, explainTool(opened, options.home)];
46
- const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.0") ? tooOld(all, options.expects) : all;
46
+ const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.2") ? tooOld(all, options.expects) : all;
47
47
  const server = new McpServer({
48
48
  name: "ork",
49
49
  version: ORK_VERSION
@@ -1,4 +1,4 @@
1
- import { $ as text, Bt as FEEDBACK_TARGETS, Q as inTransaction, Rt as FEEDBACK_KINDS, X as usageQueries, Xt as maskReplacer, Y as backfillUsage, Z as eventOf, Zt as maskSecrets, gn as PROJECT_MODES, yt as ownProcessStart, zt as FEEDBACK_SEVERITIES } from "./src-DHvWU4tX.mjs";
1
+ import { $ as text, Bt as FEEDBACK_TARGETS, Q as inTransaction, Rt as FEEDBACK_KINDS, X as usageQueries, Xt as maskReplacer, Y as backfillUsage, Z as eventOf, Zt as maskSecrets, gn as PROJECT_MODES, yt as ownProcessStart, zt as FEEDBACK_SEVERITIES } from "./src-Dujmvv4s.mjs";
2
2
  import path from "node:path";
3
3
  import { mkdirSync } from "node:fs";
4
4
  import { homedir } from "node:os";
@@ -1,7 +1,7 @@
1
- import { G as requestContinue, K as requestPause } from "./src-DHvWU4tX.mjs";
2
- import { t as findRun } from "./find-BKW-uGey.mjs";
3
- import { a as write, c as openStore, i as style, o as writeErr } from "./output-B1V6ZJSx.mjs";
4
- import { r as continueRefusal } from "./in-a-run-BPXX09Bs.mjs";
1
+ import { G as requestContinue, K as requestPause } from "./src-Dujmvv4s.mjs";
2
+ import { t as findRun } from "./find-D6Gj1sxg.mjs";
3
+ import { a as write, c as openStore, i as style, o as writeErr } from "./output-BLQWD6MJ.mjs";
4
+ import { r as continueRefusal } from "./in-a-run-pLAZeNys.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  // src/commands/pause.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { B as linkNodes, L as addressOf, U as unlinkNodes } from "./src-DHvWU4tX.mjs";
2
- import { a as write, c as openStore, i as style, o as writeErr } from "./output-B1V6ZJSx.mjs";
1
+ import { B as linkNodes, L as addressOf, U as unlinkNodes } from "./src-Dujmvv4s.mjs";
2
+ import { a as write, c as openStore, i as style, o as writeErr } from "./output-BLQWD6MJ.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  // src/commands/relay.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
- import { ht as liveStatus, j as lines, k as git } from "./src-DHvWU4tX.mjs";
2
- import { n as listOrkWorktrees, t as createdWorktrees } from "./list-C7UEgmtd.mjs";
3
- import { i as keyOf, n as applyStep, r as cleanStep, s as stepPrunes } from "./clean-NnboOuz6.mjs";
1
+ import { ht as liveStatus, j as lines, k as git } from "./src-Dujmvv4s.mjs";
2
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-BrH8KRSJ.mjs";
3
+ import { i as keyOf, n as applyStep, r as cleanStep, s as stepPrunes } from "./clean-DaHjs__2.mjs";
4
4
  // ../core/src/worktree/words.ts
5
5
  /**
6
6
  * @file The plain words for what `ork worktrees` shows, in one place, so the
@@ -1,6 +1,6 @@
1
- import { an as wakeRun, ht as liveStatus, kt as scriptContactsOf, rn as socketPath } from "./src-DHvWU4tX.mjs";
2
- import { c as openStore, o as writeErr } from "./output-B1V6ZJSx.mjs";
3
- import { u as inheritedScrubber } from "./src-C38BPzit.mjs";
1
+ import { an as wakeRun, ht as liveStatus, kt as scriptContactsOf, rn as socketPath } from "./src-Dujmvv4s.mjs";
2
+ import { c as openStore, o as writeErr } from "./output-BLQWD6MJ.mjs";
3
+ import { u as inheritedScrubber } from "./src-DOcK8Jfp.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  // ../core/src/remote/send.ts
6
6
  /**
@@ -1,11 +1,11 @@
1
- import { B as linkNodes, Cn as runDirOf, Ct as walkChecks, En as inside, Fn as applyEdits, G as requestContinue, Gn as expandEdge, Hn as EdgeInputSchema, Ht as planPost, In as newWorkflowText, J as tellLiveRun, K as requestPause, Ln as readDocument, Nn as skillsIn, Nt as nodeSays, On as LESSON_CAP_TOKENS, Pn as WorkflowEditSchema, Rn as renderJsonSchema, St as checkWorkflowText, Tn as workflowDirOf, U as unlinkNodes, Ut as runGh, Vt as DISCUSSIONS, Wt as sendPost, _t as runStatus, bn as placeFiles, bt as processAlive, ct as explainWorkflowText, d as runningRunIds, f as runningScript, gt as pausedOf, hn as loadAgents, ht as liveStatus, l as planUpgrade, nt as resumable, o as limitsReport, ot as detachRun, p as detectInstaller, q as requestStop, qn as NodeSchema, r as capsHere, st as followEvents, tn as readCondition, tt as detachResume, u as releaseNotes, v as triggersReport, vt as runTree, wt as walkSummary, xn as placeFor, zn as parseWorkflow } from "./src-DHvWU4tX.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__-DdTVd2p5.mjs";
3
- import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-B81wCZQg.mjs";
4
- import { n as newRunId, t as findRun } from "./find-BKW-uGey.mjs";
5
- import { c as openStore, l as storePath, s as nodeOf } from "./output-B1V6ZJSx.mjs";
1
+ import { B as linkNodes, Cn as runDirOf, Ct as walkChecks, En as inside, Fn as applyEdits, G as requestContinue, Gn as expandEdge, Hn as EdgeInputSchema, Ht as planPost, In as newWorkflowText, J as tellLiveRun, K as requestPause, Ln as readDocument, Nn as skillsIn, Nt as nodeSays, On as LESSON_CAP_TOKENS, Pn as WorkflowEditSchema, Rn as renderJsonSchema, St as checkWorkflowText, Tn as workflowDirOf, U as unlinkNodes, Ut as runGh, Vt as DISCUSSIONS, Wt as sendPost, _t as runStatus, bn as placeFiles, bt as processAlive, ct as explainWorkflowText, d as runningRunIds, f as runningScript, gt as pausedOf, hn as loadAgents, ht as liveStatus, l as planUpgrade, nt as resumable, o as limitsReport, ot as detachRun, p as detectInstaller, q as requestStop, qn as NodeSchema, r as capsHere, st as followEvents, tn as readCondition, tt as detachResume, u as releaseNotes, v as triggersReport, vt as runTree, wt as walkSummary, xn as placeFor, zn as parseWorkflow } from "./src-Dujmvv4s.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__-fy6L1Mrd.mjs";
3
+ import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-CGyx9rv7.mjs";
4
+ import { n as newRunId, t as findRun } from "./find-D6Gj1sxg.mjs";
5
+ import { c as openStore, l as storePath, s as nodeOf } from "./output-BLQWD6MJ.mjs";
6
6
  import { n as usageReport } from "./report-DK4LGqwF.mjs";
7
- import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-NnboOuz6.mjs";
8
- import { a as readWorktrees, c as planLine, i as projectHead, l as removeRefusal, n as lostWork, o as labelOf, r as planRemove, s as mergeStateOf, t as applyRemove, u as stateParts } from "./remove-DAZ7ZCzt.mjs";
7
+ import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-DaHjs__2.mjs";
8
+ import { a as readWorktrees, c as planLine, i as projectHead, l as removeRefusal, n as lostWork, o as labelOf, r as planRemove, s as mergeStateOf, t as applyRemove, u as stateParts } from "./remove-BeGdqroy.mjs";
9
9
  import path from "node:path";
10
10
  import { z } from "zod";
11
11
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -367,7 +367,9 @@ const StartRunSchema = z.strictObject({
367
367
  project: z.string().min(1),
368
368
  /** A workflow's name in the project, or a path inside the project. */
369
369
  workflow: z.string().min(1),
370
- ...RunFlags
370
+ ...RunFlags,
371
+ /** Its sessions load the machine's Claude setup (`--machine-claude`). */
372
+ machineClaude: z.boolean().optional()
371
373
  });
372
374
  const ResumeRunSchema = z.strictObject(RunFlags);
373
375
  const MessageSchema = z.strictObject({
@@ -941,7 +943,8 @@ const flagsOf = (options) => [
941
943
  ...Object.entries(options.inputs ?? {}).flatMap(([name, value]) => ["--input", `${name}=${value}`]),
942
944
  ...options.driver === void 0 ? [] : ["--driver", options.driver],
943
945
  ...options.inPlace === void 0 ? [] : [options.inPlace ? "--in-place" : "--no-in-place"],
944
- ...options.allowDirty === true ? ["--allow-dirty"] : []
946
+ ...options.allowDirty === true ? ["--allow-dirty"] : [],
947
+ ...options.machineClaude === true ? ["--machine-claude"] : []
945
948
  ];
946
949
  const WORKFLOW_SUFFIX = ".ork.yaml";
947
950
  /**
@@ -1,4 +1,4 @@
1
- import { Bt as FEEDBACK_TARGETS, Rt as FEEDBACK_KINDS, pt as parseReport, zt as FEEDBACK_SEVERITIES } from "./src-DHvWU4tX.mjs";
1
+ import { Bt as FEEDBACK_TARGETS, Rt as FEEDBACK_KINDS, pt as parseReport, zt as FEEDBACK_SEVERITIES } from "./src-Dujmvv4s.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomBytes, timingSafeEqual } from "node:crypto";
4
4
  import { createInterface } from "node:readline";
@@ -10,6 +10,24 @@ import { createSdkMcpServer, query, tool } from "@anthropic-ai/claude-agent-sdk"
10
10
  const PROMPT_CACHE_1H = "ENABLE_PROMPT_CACHING_1H";
11
11
  /** The variables a session adds to its driver's environment. */
12
12
  const cacheEnv = (spec) => spec.promptCache === "1h" ? { [PROMPT_CACHE_1H]: "1" } : {};
13
+ // ../runtime-claude/src/clean.ts
14
+ /** Claude Code's switch that turns its auto-memory off. */
15
+ const NO_AUTO_MEMORY = "CLAUDE_CODE_DISABLE_AUTO_MEMORY";
16
+ /**
17
+ * The CLI flag that moves the per-machine sections (working directory, memory
18
+ * path, git status) out of the system prompt; the SDK's
19
+ * `excludeDynamicSections`.
20
+ */
21
+ const EXCLUDE_DYNAMIC_SECTIONS = "--exclude-dynamic-system-prompt-sections";
22
+ /** Whether the session loads no MCP server but Ork's. */
23
+ const strictMcpOf = (spec) => spec.tools.strictMcp === true || spec.machineClaude !== true;
24
+ /** The variables that keep the machine's auto-memory out of a session. */
25
+ const memoryEnv = (spec) => spec.machineClaude === true ? {} : { [NO_AUTO_MEMORY]: "1" };
26
+ /** Everything a session adds to its driver's environment. */
27
+ const driverEnv = (spec) => ({
28
+ ...cacheEnv(spec),
29
+ ...memoryEnv(spec)
30
+ });
13
31
  // ../runtime-claude/src/normalize.ts
14
32
  /**
15
33
  * @file Both drivers emit the same message JSON (the Agent SDK's messages are
@@ -817,6 +835,7 @@ const buildCliArgs = (spec, mcp, allowed) => {
817
835
  spec.settingSources.join(","),
818
836
  "--append-system-prompt",
819
837
  spec.systemAppend,
838
+ EXCLUDE_DYNAMIC_SECTIONS,
820
839
  "--permission-mode",
821
840
  spec.permissionMode,
822
841
  "--json-schema",
@@ -829,7 +848,7 @@ const buildCliArgs = (spec, mcp, allowed) => {
829
848
  [...spec.tools.allow, ...allowed].join(",")
830
849
  ];
831
850
  if (spec.tools.only !== void 0) args.push("--tools", spec.tools.only.join(","));
832
- if (spec.tools.strictMcp === true) args.push("--strict-mcp-config");
851
+ if (strictMcpOf(spec)) args.push("--strict-mcp-config");
833
852
  if (spec.agents !== void 0) args.push("--agents", JSON.stringify(spec.agents));
834
853
  if (spec.tools.deny.length > 0) args.push("--disallowedTools", spec.tools.deny.join(","));
835
854
  if (spec.model !== void 0) args.push("--model", spec.model);
@@ -876,7 +895,7 @@ const createCliRuntime = (options = {}) => ({
876
895
  bin: options.bin ?? "claude",
877
896
  env: {
878
897
  ...options.env ?? process.env,
879
- ...cacheEnv(spec)
898
+ ...driverEnv(spec)
880
899
  },
881
900
  cwd: spec.cwd,
882
901
  args,
@@ -976,7 +995,8 @@ const createQueue = () => {
976
995
  // ../runtime-claude/src/sdk.ts
977
996
  /**
978
997
  * @file The SDK driver: runs a session in-process with the Claude Agent SDK,
979
- * only with an API key or a cloud provider, never a claude.ai login. A node
998
+ * only with an API key or a cloud provider, never a claude.ai login, clean of
999
+ * the machine's Claude setup unless the run asks for it (ADR-065). A node
980
1000
  * that can be paused gets a `PreToolUse` callback hook: a short pause holds
981
1001
  * the call, a long one defers it and resumes the session when the node
982
1002
  * continues (ADR-041).
@@ -1038,13 +1058,14 @@ const buildSdkOptions = (spec, ports, env, held) => {
1038
1058
  cwd: spec.cwd,
1039
1059
  env: definedEnv({
1040
1060
  ...env,
1041
- ...cacheEnv(spec)
1061
+ ...driverEnv(spec)
1042
1062
  }),
1043
1063
  settingSources: spec.settingSources,
1044
1064
  systemPrompt: {
1045
1065
  type: "preset",
1046
1066
  preset: "claude_code",
1047
- append: spec.systemAppend
1067
+ append: spec.systemAppend,
1068
+ excludeDynamicSections: true
1048
1069
  },
1049
1070
  permissionMode: spec.permissionMode,
1050
1071
  allowedTools: [...spec.tools.allow, ...preapprovedTools(tools)],
@@ -1070,7 +1091,7 @@ const buildSdkOptions = (spec, ports, env, held) => {
1070
1091
  }
1071
1092
  };
1072
1093
  if (spec.tools.only !== void 0) options.tools = spec.tools.only;
1073
- if (spec.tools.strictMcp === true) options.strictMcpConfig = true;
1094
+ if (strictMcpOf(spec)) options.strictMcpConfig = true;
1074
1095
  if (spec.agents !== void 0) options.agents = spec.agents;
1075
1096
  if (spec.model !== void 0) options.model = spec.model;
1076
1097
  if (spec.effort !== void 0) options.effort = spec.effort;
@@ -1,4 +1,4 @@
1
- import { $n as timeoutMs, $t as parseTemplate, At as runScope, F as declaredProblem, Jn as beforeOf, Mt as envReadsOf, Ot as heldTimeout, Pt as declaredOutputOf, Qt as evaluate, Vn as markValue, Xn as isToolNode, Zn as programsRunBy, en as renderTemplate, er as INTEGRATIONS, ft as sessionDriver, jt as calledWorkflows, mt as reportSchemaFor, nr as integrationFor, s as planReason, tr as TOOL_PREFIX, ut as planNodeSession } from "./src-DHvWU4tX.mjs";
1
+ import { $n as timeoutMs, $t as parseTemplate, At as runScope, F as declaredProblem, Jn as beforeOf, Mt as envReadsOf, Ot as heldTimeout, Pt as declaredOutputOf, Qt as evaluate, Vn as markValue, Xn as isToolNode, Zn as programsRunBy, en as renderTemplate, er as INTEGRATIONS, ft as sessionDriver, jt as calledWorkflows, mt as reportSchemaFor, nr as integrationFor, s as planReason, tr as TOOL_PREFIX, ut as planNodeSession } from "./src-Dujmvv4s.mjs";
2
2
  import path from "node:path";
3
3
  import { accessSync, constants, existsSync, lstatSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { spawn } from "node:child_process";
@@ -1590,6 +1590,7 @@ const claudeExecutor = (options) => async (context) => {
1590
1590
  error: plan.error
1591
1591
  };
1592
1592
  const spec = specFor(plan.spec, context);
1593
+ if (options.machineClaude === true) spec.machineClaude = true;
1593
1594
  const driver = sessionDriver({
1594
1595
  override: options.driver,
1595
1596
  named: plan.driver,
@@ -10445,7 +10445,7 @@ const adoptedCalls = (store, runId) => {
10445
10445
  return adopted;
10446
10446
  };
10447
10447
  /** What the called run's own `limits.budgetUsd` is capped to, and so on. */
10448
- const argsOf = (file, id, caller, request) => [
10448
+ const argsOf = (file, id, caller, request, machineClaude) => [
10449
10449
  "run",
10450
10450
  file,
10451
10451
  "--run-id",
@@ -10454,7 +10454,8 @@ const argsOf = (file, id, caller, request) => [
10454
10454
  caller,
10455
10455
  ...Object.entries(request.inputs).flatMap(([name, value]) => ["--input", `${name}=${value}`]),
10456
10456
  ...request.budgetLeftUsd === void 0 ? [] : ["--budget-cap", String(request.budgetLeftUsd)],
10457
- ...request.ref === void 0 ? [] : ["--base-ref", request.ref]
10457
+ ...request.ref === void 0 ? [] : ["--base-ref", request.ref],
10458
+ ...machineClaude ? ["--machine-claude"] : []
10458
10459
  ];
10459
10460
  /** Why the target's `calls.accept` shuts this project out, or `null`. */
10460
10461
  const notAccepted = (options, request, target) => {
@@ -10498,7 +10499,7 @@ const startCall = async (options, request) => {
10498
10499
  const detached = await (options.detach ?? detachRun)({
10499
10500
  store,
10500
10501
  runId: id,
10501
- args: argsOf(file, id, `${runId}/${request.callId}`, request),
10502
+ args: argsOf(file, id, `${runId}/${request.callId}`, request, options.machineClaude === true),
10502
10503
  cwd: target.root,
10503
10504
  runDir: runDirOf(target, id),
10504
10505
  env: options.env
@@ -11356,10 +11357,23 @@ const clearGitLocalEnv = (env = process.env) => {
11356
11357
  * @file A minimal `git` runner for the worktree manager: arguments without a
11357
11358
  * shell, results that never throw, and none of git's local variables (a
11358
11359
  * hook's `GIT_DIR` or `GIT_INDEX_FILE`), so it acts on the repository at
11359
- * `cwd` (specs/worktrees.md).
11360
- */
11361
- /** Runs `git` with arguments (no shell) in `cwd`. Never throws. */
11362
- const git = (cwd, args) => new Promise((resolve) => {
11360
+ * `cwd` (specs/worktrees.md). Commands in one folder run one at a time: two
11361
+ * children handed their owner's work at once both stage it (`git add -A`),
11362
+ * and git refuses the second while the first holds the index's lock.
11363
+ */
11364
+ /** The last command queued in each folder, so the next one waits for it. */
11365
+ const queues = /* @__PURE__ */ new Map();
11366
+ /** Runs `task` after every command queued earlier in the same folder. */
11367
+ const inTurn = (cwd, task) => {
11368
+ const key = path.resolve(cwd);
11369
+ const next = (queues.get(key) ?? Promise.resolve()).then(task, task);
11370
+ queues.set(key, next);
11371
+ next.finally(() => {
11372
+ if (queues.get(key) === next) queues.delete(key);
11373
+ });
11374
+ return next;
11375
+ };
11376
+ const runGit = (cwd, args) => new Promise((resolve) => {
11363
11377
  execFile("git", args, {
11364
11378
  cwd,
11365
11379
  env: withoutGitLocalEnv(process.env),
@@ -11373,6 +11387,8 @@ const git = (cwd, args) => new Promise((resolve) => {
11373
11387
  });
11374
11388
  });
11375
11389
  });
11390
+ /** Runs `git` with arguments (no shell) in `cwd`. Never throws. */
11391
+ const git = (cwd, args) => inTurn(cwd, () => runGit(cwd, args));
11376
11392
  /** Like `git`, but rejects with git's message when the command fails. */
11377
11393
  const gitOk = async (cwd, args) => {
11378
11394
  const result = await git(cwd, args);