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

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 (30) hide show
  1. package/dist/{__build_info__-fy6L1Mrd.mjs → __build_info__-BwrKe6yz.mjs} +2 -2
  2. package/dist/bin.mjs +63 -31
  3. package/dist/{clean-DaHjs__2.mjs → clean-hXSaN8BT.mjs} +1 -1
  4. package/dist/{completion-CSU5vkEt.mjs → completion-Cga01yQP.mjs} +5 -5
  5. package/dist/{context-DT8MfEIR.mjs → context-mCAwzFFM.mjs} +3 -3
  6. package/dist/{decide-CGyx9rv7.mjs → decide-BvZnKErW.mjs} +1 -1
  7. package/dist/{find-D6Gj1sxg.mjs → find-CbetS8I2.mjs} +1 -1
  8. package/dist/{format-Dnfv8zMT.mjs → format-D87bY6Ud.mjs} +2 -2
  9. package/dist/{in-a-run-pLAZeNys.mjs → in-a-run-Bs4Wv-Cz.mjs} +1 -1
  10. package/dist/{limits-B1-DYc3d.mjs → limits-RzKQ_zPk.mjs} +1 -1
  11. package/dist/{list-BrH8KRSJ.mjs → list-DX65Sbu7.mjs} +1 -1
  12. package/dist/{mcp-DE_EmyVm.mjs → mcp-DKrrxowo.mjs} +6 -6
  13. package/dist/{output-BLQWD6MJ.mjs → output-Q3TZ-Ave.mjs} +1 -1
  14. package/dist/{pause-CL6N_Xrj.mjs → pause-B5Z41lR3.mjs} +4 -4
  15. package/dist/{relay-0SD0erwf.mjs → relay-BLnjMdjT.mjs} +2 -2
  16. package/dist/{remove-BeGdqroy.mjs → remove-IbcZOemm.mjs} +3 -3
  17. package/dist/{send-C8tunWhv.mjs → send-CJKEhBL1.mjs} +3 -3
  18. package/dist/{src-BbyEoMn4.mjs → src-BTDzibW3.mjs} +7 -7
  19. package/dist/{src-Dujmvv4s.mjs → src-DnETlJ1r.mjs} +103 -22
  20. package/dist/{src-CCUKRX51.mjs → src-LSxjnWDH.mjs} +1 -1
  21. package/dist/{src-DOcK8Jfp.mjs → src-XDSRnAZV.mjs} +1 -1
  22. package/dist/ui/assets/{app-T7wVAhgx.js → app-BNElhp7Z.js} +1 -1
  23. package/dist/ui/assets/{index-9dFha9Qn.js → index-BkI68sr5.js} +2 -2
  24. package/dist/ui/index.html +1 -1
  25. package/dist/{ui-CTmO2Xzu.mjs → ui-fvrO7Gxd.mjs} +4 -4
  26. package/dist/{usage-DYUmP0i4.mjs → usage-bNdcBcj9.mjs} +5 -5
  27. package/dist/{watch-CtbgDAcz.mjs → watch-EhlO304A.mjs} +6 -6
  28. package/dist/{workflows-D1_WVukk.mjs → workflows-C5hYAVcE.mjs} +3 -3
  29. package/dist/{worktrees-DdMYoNOC.mjs → worktrees-BQFcpYz1.mjs} +5 -5
  30. package/package.json +1 -1
@@ -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-Dujmvv4s.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-DnETlJ1r.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.2";
614
+ const ORK_VERSION = "1.0.0-alpha.3";
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-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";
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, cr as experimentsOn, 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, lr as knownExperiments, 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, sr as EXPERIMENTS, 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-DnETlJ1r.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__-BwrKe6yz.mjs";
4
+ import { i as builtinWorkflowFile, n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-BvZnKErW.mjs";
5
+ import { n as newRunId, t as findRun } from "./find-CbetS8I2.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-Q3TZ-Ave.mjs";
7
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-DX65Sbu7.mjs";
8
+ import { a as planClean, t as applyClean } from "./clean-hXSaN8BT.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-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";
10
+ import { a as formatRunEvent, i as formatEvent, n as formatRuns, o as createTerminalHuman, r as formatTree, t as ago } from "./format-D87bY6Ud.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-C5hYAVcE.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-mCAwzFFM.mjs";
13
+ import { i as runLimits, r as limitsRefusal, t as chatNotice } from "./limits-RzKQ_zPk.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-XDSRnAZV.mjs";
15
+ import { i as decideRefusal, n as chatRefusal } from "./in-a-run-Bs4Wv-Cz.mjs";
16
16
  import path from "node:path";
17
17
  import { stringify } from "yaml";
18
18
  import { z } from "zod";
@@ -802,8 +802,8 @@ const versionCheck = (current, cache, checksOff) => {
802
802
  * @file The checks behind `ork doctor`: Ork's own version against the last
803
803
  * update check, each tool's presence and login status (the drivers' own
804
804
  * checks, which `ork run` also reads to pick the one ready), and whether a
805
- * run's socket path fits, through an injectable `exec` so tests need no real
806
- * tools. Never prints a token or an account.
805
+ * run's socket path fits, and which experiments are on, through an injectable
806
+ * `exec` so tests need no real tools. Never prints a token or an account.
807
807
  */
808
808
  const TIMEOUT_MS = 15e3;
809
809
  const exec = (program, args) => new Promise((resolve) => {
@@ -933,6 +933,35 @@ const triggerChecks = (home) => {
933
933
  store.close();
934
934
  }
935
935
  };
936
+ const SOURCE_NAMES = {
937
+ project: "project file",
938
+ environment: "environment"
939
+ };
940
+ /**
941
+ * Which experiments are on and who turned them on; an unknown name fails this
942
+ * check alone. Prints names only. Outside a project, only the environment
943
+ * counts.
944
+ */
945
+ const experimentsCheck = (place, env = process.env, registry = EXPERIMENTS) => {
946
+ const { project, where } = loadProject(place.root, placeFiles(place).rules);
947
+ const state = experimentsOn({
948
+ env,
949
+ project,
950
+ where,
951
+ registry
952
+ });
953
+ if (!state.ok) return {
954
+ name: "experiments",
955
+ status: "fail",
956
+ detail: `unknown: ${state.unknown.map((u) => `\`${u.name}\` (${u.where})`).join(", ")}`,
957
+ hint: `Fix or remove the name. Known experiments: ${knownExperiments(registry)}.`
958
+ };
959
+ return {
960
+ name: "experiments",
961
+ status: "ok",
962
+ detail: state.on.length === 0 ? "none on" : state.on.map(({ name, sources }) => `${name} (${sources.map((s) => SOURCE_NAMES[s]).join(" and ")})`).join(", ")
963
+ };
964
+ };
936
965
  // src/run/ready-driver.ts
937
966
  /**
938
967
  * @file The driver a run takes for the session nodes that name none (core's
@@ -1685,7 +1714,7 @@ const flagValues = (rawArgs, flag) => {
1685
1714
  };
1686
1715
  const isDriver = (value) => CLAUDE_DRIVERS.some((d) => d.id === value);
1687
1716
  /** Loads the drivers only when a run starts, so other commands stay fast. */
1688
- const loadRuntime = async (driver) => (await import("./src-CCUKRX51.mjs")).createRuntime(driver, sessionEnv(process.env));
1717
+ const loadRuntime = async (driver) => (await import("./src-LSxjnWDH.mjs")).createRuntime(driver, sessionEnv(process.env));
1689
1718
  /**
1690
1719
  * Ctrl-C asks the run to stop, and so does a terminal closing or a polite kill,
1691
1720
  * so that the run ends tidily and leaves no result unscrubbed.
@@ -2529,17 +2558,20 @@ const doctor = defineCommand({
2529
2558
  run: async () => {
2530
2559
  const { results, ok } = await runChecks(exec, process.env, process.versions.node);
2531
2560
  const place = projectAt(process.cwd());
2561
+ const experiments = experimentsCheck(place);
2532
2562
  for (const result of [
2533
2563
  orkCheck(),
2534
2564
  ...results,
2535
2565
  ...place.mode === "attached" ? [] : projectChecks(place.root),
2536
2566
  socketCheck(),
2537
- ...triggerChecks()
2567
+ ...triggerChecks(),
2568
+ experiments
2538
2569
  ]) for (const line of formatCheck(result)) write(line);
2539
2570
  if (!ok) {
2540
2571
  write(`\n${style("red", "Not ready:")} Ork needs Node, git, and at least one Claude driver.`);
2541
2572
  process.exitCode = 1;
2542
2573
  }
2574
+ if (experiments.status === "fail") process.exitCode = 1;
2543
2575
  }
2544
2576
  });
2545
2577
  /** The ids of runs still running anywhere on this machine. */
@@ -4575,27 +4607,27 @@ const main = defineCommand({
4575
4607
  ps,
4576
4608
  logs,
4577
4609
  tree,
4578
- usage: () => import("./usage-DYUmP0i4.mjs").then((module) => module.usage),
4579
- prune: () => import("./usage-DYUmP0i4.mjs").then((module) => module.prune),
4610
+ usage: () => import("./usage-bNdcBcj9.mjs").then((module) => module.usage),
4611
+ prune: () => import("./usage-bNdcBcj9.mjs").then((module) => module.prune),
4580
4612
  decide,
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),
4613
+ relay: () => import("./relay-BLnjMdjT.mjs").then((module) => module.relay),
4614
+ pause: () => import("./pause-B5Z41lR3.mjs").then((module) => module.pause),
4615
+ continue: () => import("./pause-B5Z41lR3.mjs").then((module) => module.continueRun),
4584
4616
  stop,
4585
4617
  chat,
4586
- send: () => import("./send-C8tunWhv.mjs").then((module) => module.send),
4618
+ send: () => import("./send-CJKEhBL1.mjs").then((module) => module.send),
4587
4619
  resume,
4588
4620
  feedback,
4589
4621
  context,
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),
4622
+ worktrees: () => import("./worktrees-BQFcpYz1.mjs").then((module) => module.worktrees),
4623
+ wt: () => import("./worktrees-BQFcpYz1.mjs").then((module) => module.worktrees),
4624
+ watch: () => import("./watch-EhlO304A.mjs").then((module) => module.watch),
4625
+ mcp: () => import("./mcp-DKrrxowo.mjs").then((module) => module.mcp),
4626
+ ui: () => import("./ui-fvrO7Gxd.mjs").then((module) => module.ui),
4595
4627
  doctor,
4596
4628
  upgrade,
4597
- completion: () => import("./completion-CSU5vkEt.mjs").then((module) => module.completion),
4598
- __complete: () => import("./completion-CSU5vkEt.mjs").then((module) => module.completeCommand(main))
4629
+ completion: () => import("./completion-Cga01yQP.mjs").then((module) => module.completion),
4630
+ __complete: () => import("./completion-Cga01yQP.mjs").then((module) => module.completeCommand(main))
4599
4631
  }
4600
4632
  });
4601
4633
  // src/bin.ts
@@ -4613,7 +4645,7 @@ const main = defineCommand({
4613
4645
  clearGitLocalEnv();
4614
4646
  const argv = process.argv.slice(2);
4615
4647
  if (argv[0] === "__complete") {
4616
- const { printCompletions } = await import("./completion-CSU5vkEt.mjs");
4648
+ const { printCompletions } = await import("./completion-Cga01yQP.mjs");
4617
4649
  await printCompletions(main, argv.slice(1));
4618
4650
  } else if (process.env["ORK_UPDATE_CHECK_CHILD"] === "1") await runUpdateChild();
4619
4651
  else {
@@ -1,4 +1,4 @@
1
- import { A as gitOk, O as removeWorktree } from "./src-Dujmvv4s.mjs";
1
+ import { A as gitOk, O as removeWorktree } from "./src-DnETlJ1r.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-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";
1
+ import { Qn as NodeIdSchema, ar as CLAUDE_DRIVERS, bn as placeFiles, ht as liveStatus, xn as placeFor } from "./src-DnETlJ1r.mjs";
2
+ import { a as builtinWorkflowNames, n as pendingDecisions, o as builtinWorkflowText, s as isBuiltinArg } from "./decide-BvZnKErW.mjs";
3
+ import { t as findRun } from "./find-CbetS8I2.mjs";
4
+ import { c as openStore, l as storePath, o as writeErr } from "./output-Q3TZ-Ave.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-D1_WVukk.mjs";
6
+ import { a as resolveWorkflowArg, n as WORKFLOW_SUFFIX } from "./workflows-C5hYAVcE.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-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";
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-DnETlJ1r.mjs";
2
+ import { a as write, i as style, r as plain } from "./output-Q3TZ-Ave.mjs";
3
+ import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-C5hYAVcE.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-Dujmvv4s.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-DnETlJ1r.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-Dujmvv4s.mjs";
1
+ import { xn as placeFor } from "./src-DnETlJ1r.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-Dujmvv4s.mjs";
2
- import { i as style, n as cost } from "./output-BLQWD6MJ.mjs";
1
+ import { ht as liveStatus } from "./src-DnETlJ1r.mjs";
2
+ import { i as style, n as cost } from "./output-Q3TZ-Ave.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-DOcK8Jfp.mjs";
1
+ import { p as runMarkerIn } from "./src-XDSRnAZV.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-Dujmvv4s.mjs";
1
+ import { a as limitsNow, i as NOT_STARTED, o as limitsReport, r as capsHere } from "./src-DnETlJ1r.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-Dujmvv4s.mjs";
1
+ import { A as gitOk, j as lines, k as git } from "./src-DnETlJ1r.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-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";
1
+ import { h as isNewer } from "./src-DnETlJ1r.mjs";
2
+ import { n as ORK_VERSION } from "./__build_info__-BwrKe6yz.mjs";
3
+ import { a as openMcp, c as refused, o as tool, s as answer } from "./src-BTDzibW3.mjs";
4
+ import { n as explainNode } from "./context-mCAwzFFM.mjs";
5
+ import { p as runMarkerIn } from "./src-XDSRnAZV.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.2") ? tooOld(all, options.expects) : all;
46
+ const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.3") ? 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-Dujmvv4s.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-DnETlJ1r.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-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";
1
+ import { G as requestContinue, K as requestPause } from "./src-DnETlJ1r.mjs";
2
+ import { t as findRun } from "./find-CbetS8I2.mjs";
3
+ import { a as write, c as openStore, i as style, o as writeErr } from "./output-Q3TZ-Ave.mjs";
4
+ import { r as continueRefusal } from "./in-a-run-Bs4Wv-Cz.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-Dujmvv4s.mjs";
2
- import { a as write, c as openStore, i as style, o as writeErr } from "./output-BLQWD6MJ.mjs";
1
+ import { B as linkNodes, L as addressOf, U as unlinkNodes } from "./src-DnETlJ1r.mjs";
2
+ import { a as write, c as openStore, i as style, o as writeErr } from "./output-Q3TZ-Ave.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-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";
1
+ import { ht as liveStatus, j as lines, k as git } from "./src-DnETlJ1r.mjs";
2
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-DX65Sbu7.mjs";
3
+ import { i as keyOf, n as applyStep, r as cleanStep, s as stepPrunes } from "./clean-hXSaN8BT.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-Dujmvv4s.mjs";
2
- import { c as openStore, o as writeErr } from "./output-BLQWD6MJ.mjs";
3
- import { u as inheritedScrubber } from "./src-DOcK8Jfp.mjs";
1
+ import { an as wakeRun, ht as liveStatus, kt as scriptContactsOf, rn as socketPath } from "./src-DnETlJ1r.mjs";
2
+ import { c as openStore, o as writeErr } from "./output-Q3TZ-Ave.mjs";
3
+ import { u as inheritedScrubber } from "./src-XDSRnAZV.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-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";
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-DnETlJ1r.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__-BwrKe6yz.mjs";
3
+ import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-BvZnKErW.mjs";
4
+ import { n as newRunId, t as findRun } from "./find-CbetS8I2.mjs";
5
+ import { c as openStore, l as storePath, s as nodeOf } from "./output-Q3TZ-Ave.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-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";
7
+ import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-hXSaN8BT.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-IbcZOemm.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";
@@ -8,6 +8,65 @@ import { createConnection, createServer } from "node:net";
8
8
  import { createInterface } from "node:readline";
9
9
  import { execFile, execFileSync, spawn } from "node:child_process";
10
10
  import { setImmediate, setTimeout as setTimeout$1 } from "node:timers/promises";
11
+ // ../core/src/graph/diagnostics.ts
12
+ const error = (code, message, path) => ({
13
+ severity: "error",
14
+ code,
15
+ message,
16
+ path
17
+ });
18
+ const warning = (code, message, path) => ({
19
+ severity: "warning",
20
+ code,
21
+ message,
22
+ path
23
+ });
24
+ // ../core/src/experiments.ts
25
+ /** The only list: an entry is added by the change that adds its experiment. */
26
+ const EXPERIMENTS = [];
27
+ const EXPERIMENTAL_ENV = "ORK_EXPERIMENTAL";
28
+ /** The registry's names, for a message. */
29
+ const knownExperiments = (registry = EXPERIMENTS) => registry.map(({ name }) => name).join(", ") || "none";
30
+ const envNames = (env) => [...new Set((env[EXPERIMENTAL_ENV] ?? "").split(",").map((name) => name.trim()).filter((name) => name !== ""))];
31
+ /**
32
+ * What is on, from the project file and the environment together. Any name the
33
+ * registry doesn't have makes it an error instead: a typo must not look like a
34
+ * running experiment.
35
+ */
36
+ const experimentsOn = ({ env = process.env, project, where, registry = EXPERIMENTS } = {}) => {
37
+ const inProject = project?.experimental ?? [];
38
+ const listed = [...[...new Set(inProject)].map((name) => ({
39
+ name,
40
+ source: "project",
41
+ at: where?.(["experimental", inProject.indexOf(name)]) ?? "project.yaml"
42
+ })), ...envNames(env).map((name) => ({
43
+ name,
44
+ source: "environment",
45
+ at: EXPERIMENTAL_ENV
46
+ }))];
47
+ const unknown = listed.filter(({ name }) => !registry.some((entry) => entry.name === name)).map(({ name, source, at }) => ({
48
+ name,
49
+ source,
50
+ where: at,
51
+ message: `${at}${source === "project" ? ":" : ""} names an unknown experiment \`${name}\`; known: ${knownExperiments(registry)}`
52
+ }));
53
+ if (unknown.length > 0) return {
54
+ ok: false,
55
+ unknown
56
+ };
57
+ return {
58
+ ok: true,
59
+ on: [...new Set(listed.map(({ name }) => name))].map((name) => ({
60
+ name,
61
+ sources: listed.filter((l) => l.name === name).map((l) => l.source)
62
+ }))
63
+ };
64
+ };
65
+ /** Unknown names as errors, for the checks every workflow goes through. */
66
+ const experimentDiagnostics = (options) => {
67
+ const state = experimentsOn(options);
68
+ return state.ok ? [] : state.unknown.map(({ message }) => error("experiment.unknown", message, []));
69
+ };
11
70
  // ../integrations/src/integration.ts
12
71
  /** Declares an integration with its option types checked. */
13
72
  const defineIntegration = (integration) => integration;
@@ -894,7 +953,8 @@ const ProjectSchema = z.strictObject({
894
953
  defaults: DefaultsSchema.optional().describe("Defaults for every workflow in the project; a workflow's own win."),
895
954
  quotas: QuotasSchema.optional().describe("Most this project may spend on this machine. The user's own caps apply too."),
896
955
  calls: z.strictObject({ accept: z.array(z.string()).describe("The registered projects whose workflows may call this one's.") }).optional().describe("Default: any registered project may call this one's workflows."),
897
- context: z.array(z.string()).optional().describe("Context files every node reads, relative to the project root; they come before the workflow's.")
956
+ context: z.array(z.string()).optional().describe("Context files every node reads, relative to the project root; they come before the workflow's."),
957
+ experimental: z.array(z.string()).optional().describe("Experimental features this project turns on.")
898
958
  });
899
959
  /** `~/.ork/settings.yaml`: the user's own settings, and never a credential. */
900
960
  const UserSettingsSchema = z.strictObject({
@@ -2394,19 +2454,6 @@ const parseSkillRef = (ref) => {
2394
2454
  message: `\`${ref}\` is neither a built-in (ork:<name>) nor a path to a skill folder (./…); project skills load by themselves`
2395
2455
  };
2396
2456
  };
2397
- // ../core/src/graph/diagnostics.ts
2398
- const error = (code, message, path) => ({
2399
- severity: "error",
2400
- code,
2401
- message,
2402
- path
2403
- });
2404
- const warning = (code, message, path) => ({
2405
- severity: "warning",
2406
- code,
2407
- message,
2408
- path
2409
- });
2410
2457
  // ../core/src/practices/caveman.ts
2411
2458
  const CAVEMAN = `## Practice: caveman (terse voice)
2412
2459
 
@@ -4561,11 +4608,15 @@ const PROJECT_FILE = ".ork/project.yaml";
4561
4608
  const loadProject = (projectRoot, file = path.join(projectRoot, PROJECT_FILE)) => {
4562
4609
  if (!existsSync(file)) return { diagnostics: [] };
4563
4610
  const parsed = parseProject(readFileSync(file, "utf8"));
4611
+ const label = shownPath(file, projectRoot);
4564
4612
  if (parsed.ok) return {
4565
4613
  project: parsed.project,
4566
- diagnostics: []
4614
+ diagnostics: [],
4615
+ where: (at) => {
4616
+ const position = parsed.locate(at);
4617
+ return position === null ? label : `${label}:${position.line}:${position.column}`;
4618
+ }
4567
4619
  };
4568
- const label = shownPath(file, projectRoot);
4569
4620
  return { diagnostics: parsed.diagnostics.map((d) => {
4570
4621
  const at = d.line === void 0 ? "" : `:${d.line}:${d.column ?? 1}`;
4571
4622
  return error(d.code, `${label}${at}: ${d.message}`, []);
@@ -9028,6 +9079,10 @@ const checkWorkflowText = (text, { place, workflowDir, registered, home }) => {
9028
9079
  const diagnostics = [];
9029
9080
  for (const diagnostic of [
9030
9081
  ...loaded.diagnostics,
9082
+ ...experimentDiagnostics({
9083
+ project: loaded.project,
9084
+ where: loaded.where
9085
+ }),
9031
9086
  ...compiled.diagnostics,
9032
9087
  ...checkCallTargets(parsed.workflow, place, registered),
9033
9088
  ...graph === null ? [] : contextDiagnostics(graph.workflow, {
@@ -11383,7 +11438,7 @@ const runGit = (cwd, args) => new Promise((resolve) => {
11383
11438
  resolve({
11384
11439
  code: error === null ? 0 : typeof error.code === "number" ? error.code : -1,
11385
11440
  stdout,
11386
- stderr: stderr || (error?.message ?? "")
11441
+ stderr: error !== null && !existsSync(cwd) ? `the folder ${cwd} doesn't exist` : stderr || (error?.message ?? "")
11387
11442
  });
11388
11443
  });
11389
11444
  });
@@ -12560,6 +12615,14 @@ const upstreamPlace = (graph, id, placeOf, root) => {
12560
12615
  return other === void 0 ? only : void 0;
12561
12616
  };
12562
12617
  // ../core/src/worktree/handoff.ts
12618
+ /**
12619
+ * @file A node's worktree under the project's git rules (ADR-032): opening it
12620
+ * (named by the rules, on a branch or detached, taking its owner's work),
12621
+ * bringing it up to its owner's work on a later run, and handing a passing
12622
+ * child's work to its owner: a `--no-ff` merge, or a patch applied
12623
+ * uncommitted. Also what a session is told about its checkout, and the
12624
+ * artifacts carried into a new worktree.
12625
+ */
12563
12626
  /** Where a child's work goes: its owner's branch, or its folder. */
12564
12627
  const nameOf = (worktree) => worktree.branch ?? worktree.path;
12565
12628
  const headTree = async (worktree) => (await gitOk(worktree, ["rev-parse", "HEAD^{tree}"])).trim();
@@ -12611,6 +12674,16 @@ const openWorktree = async (options) => {
12611
12674
  };
12612
12675
  };
12613
12676
  /**
12677
+ * Whether a node's worktree is still on disk. One removed outside Ork (an agent
12678
+ * ran `git worktree remove`) is forgotten by git too, so it can be opened again
12679
+ * from its owner's work rather than failing the node's next run.
12680
+ */
12681
+ const stillThere = async (root, worktree) => {
12682
+ if (existsSync(worktree.path)) return true;
12683
+ await gitOk(root, ["worktree", "prune"]);
12684
+ return false;
12685
+ };
12686
+ /**
12614
12687
  * A later run (a loop, another delegation) starts from the owner's work. With
12615
12688
  * commits, the branch fast-forwards when it has nothing of its own; under
12616
12689
  * `commit: never`, a child whose work reached its owner takes the owner's
@@ -12625,6 +12698,15 @@ const refreshWorktree = async (rules, worktree, host, handedOver) => {
12625
12698
  worktree.snapshot = await syncFrom(worktree.path, host.path);
12626
12699
  return true;
12627
12700
  };
12701
+ /**
12702
+ * A node's worktree when it runs again: `gone` when its folder was removed
12703
+ * outside Ork (it is opened anew), `synced` when it took its owner's work, or
12704
+ * `same`.
12705
+ */
12706
+ const reenter = async (root, rules, worktree, host, handedOver) => {
12707
+ if (!await stillThere(root, worktree)) return "gone";
12708
+ return host !== void 0 && await refreshWorktree(rules, worktree, host, handedOver) ? "synced" : "same";
12709
+ };
12628
12710
  /** Hands a passing child's work to its owner's worktree: merged or patched. */
12629
12711
  const handOver = async (rules, child, owner, message) => {
12630
12712
  if (rules.merge === "patch" || child.branch === void 0) {
@@ -12789,10 +12871,9 @@ const createWorkspace = (options) => {
12789
12871
  const host = hostOf(id);
12790
12872
  const hosted = host === void 0 ? void 0 : worktrees.get(host);
12791
12873
  const existing = worktrees.get(id);
12792
- if (existing !== void 0) {
12793
- if (hosted !== void 0 && await refreshWorktree(rules, existing, hosted, merged.has(id))) event(id, "synced", existing, `from ${nameOf(hosted)}`);
12794
- return existing;
12795
- }
12874
+ const again = existing === void 0 ? "new" : await reenter(root, rules, existing, hosted, merged.has(id));
12875
+ if (again === "synced" && existing !== void 0 && hosted !== void 0) event(id, "synced", existing, `from ${nameOf(hosted)}`);
12876
+ if (existing !== void 0 && again !== "gone") return existing;
12796
12877
  const { worktree, copied } = await openWorktree({
12797
12878
  rules,
12798
12879
  root,
@@ -12937,4 +13018,4 @@ const createWorkspace = (options) => {
12937
13018
  close
12938
13019
  };
12939
13020
  };
12940
- export { text as $, timeoutMs as $n, parseTemplate as $t, gitOk as A, guardedBase as An, runScope as At, linkNodes as B, serializeWorkflow as Bn, FEEDBACK_TARGETS as Bt, workflowTextHash as C, runDirOf as Cn, walkChecks as Ct, inspectProject as D, projectRootOf as Dn, userMessageText as Dt, BRANCH_PREFIX as E, inside as En, MESSAGE_LIMIT as Et, declaredProblem as F, applyEdits as Fn, PROJECT_FILE as Ft, requestContinue as G, expandEdge as Gn, publishPost as Gt, tellNode as H, EdgeInputSchema as Hn, planPost as Ht, createCalls as I, newWorkflowText as In, gitRulesOf as It, tellLiveRun as J, beforeOf as Jn, normalizeTitle as Jt, requestPause as K, settingsOf as Kn, createFeedback as Kt, addressOf as L, readDocument as Ln, loadProject as Lt, clearGitLocalEnv as M, writePlainFile as Mn, envReadsOf as Mt, parseInputPairs as N, skillsIn as Nn, nodeSays as Nt, removeWorktree as O, LESSON_CAP_TOKENS as On, heldTimeout as Ot, resolveInputs as P, WorkflowEditSchema as Pn, declaredOutputOf as Pt, inTransaction as Q, NodeIdSchema as Qn, evaluate as Qt, endLink as R, renderJsonSchema as Rn, FEEDBACK_KINDS as Rt, readProjectTriggers as S, projectsHome as Sn, checkWorkflowText as St, watchingPid as T, workflowDirOf as Tn, startRun as Tt, unlinkNodes as U, WorkflowSchema as Un, runGh as Ut, peerOf as V, markValue as Vn, DISCUSSIONS as Vt, flattenTree as W, CheckReportSchema as Wn, sendPost as Wt, usageQueries as X, isToolNode as Xn, maskReplacer as Xt, backfillUsage as Y, isClaudeNode as Yn, targetOf as Yt, eventOf as Z, programsRunBy as Zn, maskSecrets as Zt, lateTriggers as _, hasInRepoFiles as _n, runStatus as _t, limitsNow as a, wakeRun as an, CLAUDE_DRIVERS as ar, DETACHED_ENV as at, triggerStanding as b, placeFiles as bn, processAlive as bt, usd as c, planMoveInto as cn, explainWorkflowText as ct, runningRunIds as d, toolsInUse as dn, namingNoDriver as dt, renderTemplate as en, INTEGRATIONS as er, adoptedCalls as et, runningScript as f, createAgent as fn, sessionDriver as ft, parseVersion as g, PROJECT_MODES as gn, pausedOf as gt, isNewer as h, loadAgents as hn, liveStatus as ht, NOT_STARTED as i, socketRoom as in, ORK_LAYOUT as ir, replayLoopAnswers as it, lines as j, plainPathInside as jn, calledWorkflows as jt, git as k, estimateTokens as kn, scriptContactsOf as kt, planUpgrade as l, linkTools as ln, explainSession as lt, compareVersions as m, catalogAgent as mn, reportSchemaFor as mt, resolveBase as n, serveRun as nn, integrationFor as nr, resumable as nt, limitsReport as o, planAgentMigration as on, firstLine as or, detachRun as ot, detectInstaller as p, deleteAgent as pn, parseReport as pt, requestStop as q, NodeSchema as qn, fingerprint as qt, capsHere as r, socketPath as rn, AGENT_TOOL_LAYOUTS as rr, createReplay as rt, planReason as s, applySteps as sn, followEvents as st, createWorkspace as t, readCondition as tn, TOOL_PREFIX as tr, detachResume as tt, releaseNotes as u, toolLinks as un, planNodeSession as ut, triggersReport as v, inRepoPlace as vn, runTree as vt, takeWatchLock as w, shownPath as wn, walkSummary as wt, declaredTriggers as x, placeFor as xn, stillTheSameProcess as xt, createWatcher as y, newProjectId as yn, ownProcessStart as yt, endLinksOf as z, parseWorkflow as zn, FEEDBACK_SEVERITIES as zt };
13021
+ export { text as $, timeoutMs as $n, parseTemplate as $t, gitOk as A, guardedBase as An, runScope as At, linkNodes as B, serializeWorkflow as Bn, FEEDBACK_TARGETS as Bt, workflowTextHash as C, runDirOf as Cn, walkChecks as Ct, inspectProject as D, projectRootOf as Dn, userMessageText as Dt, BRANCH_PREFIX as E, inside as En, MESSAGE_LIMIT as Et, declaredProblem as F, applyEdits as Fn, PROJECT_FILE as Ft, requestContinue as G, expandEdge as Gn, publishPost as Gt, tellNode as H, EdgeInputSchema as Hn, planPost as Ht, createCalls as I, newWorkflowText as In, gitRulesOf as It, tellLiveRun as J, beforeOf as Jn, normalizeTitle as Jt, requestPause as K, settingsOf as Kn, createFeedback as Kt, addressOf as L, readDocument as Ln, loadProject as Lt, clearGitLocalEnv as M, writePlainFile as Mn, envReadsOf as Mt, parseInputPairs as N, skillsIn as Nn, nodeSays as Nt, removeWorktree as O, LESSON_CAP_TOKENS as On, heldTimeout as Ot, resolveInputs as P, WorkflowEditSchema as Pn, declaredOutputOf as Pt, inTransaction as Q, NodeIdSchema as Qn, evaluate as Qt, endLink as R, renderJsonSchema as Rn, FEEDBACK_KINDS as Rt, readProjectTriggers as S, projectsHome as Sn, checkWorkflowText as St, watchingPid as T, workflowDirOf as Tn, startRun as Tt, unlinkNodes as U, WorkflowSchema as Un, runGh as Ut, peerOf as V, markValue as Vn, DISCUSSIONS as Vt, flattenTree as W, CheckReportSchema as Wn, sendPost as Wt, usageQueries as X, isToolNode as Xn, maskReplacer as Xt, backfillUsage as Y, isClaudeNode as Yn, targetOf as Yt, eventOf as Z, programsRunBy as Zn, maskSecrets as Zt, lateTriggers as _, hasInRepoFiles as _n, runStatus as _t, limitsNow as a, wakeRun as an, CLAUDE_DRIVERS as ar, DETACHED_ENV as at, triggerStanding as b, placeFiles as bn, processAlive as bt, usd as c, planMoveInto as cn, experimentsOn as cr, explainWorkflowText as ct, runningRunIds as d, toolsInUse as dn, namingNoDriver as dt, renderTemplate as en, INTEGRATIONS as er, adoptedCalls as et, runningScript as f, createAgent as fn, sessionDriver as ft, parseVersion as g, PROJECT_MODES as gn, pausedOf as gt, isNewer as h, loadAgents as hn, liveStatus as ht, NOT_STARTED as i, socketRoom as in, ORK_LAYOUT as ir, replayLoopAnswers as it, lines as j, plainPathInside as jn, calledWorkflows as jt, git as k, estimateTokens as kn, scriptContactsOf as kt, planUpgrade as l, linkTools as ln, knownExperiments as lr, explainSession as lt, compareVersions as m, catalogAgent as mn, reportSchemaFor as mt, resolveBase as n, serveRun as nn, integrationFor as nr, resumable as nt, limitsReport as o, planAgentMigration as on, firstLine as or, detachRun as ot, detectInstaller as p, deleteAgent as pn, parseReport as pt, requestStop as q, NodeSchema as qn, fingerprint as qt, capsHere as r, socketPath as rn, AGENT_TOOL_LAYOUTS as rr, createReplay as rt, planReason as s, applySteps as sn, EXPERIMENTS as sr, followEvents as st, createWorkspace as t, readCondition as tn, TOOL_PREFIX as tr, detachResume as tt, releaseNotes as u, toolLinks as un, planNodeSession as ut, triggersReport as v, inRepoPlace as vn, runTree as vt, takeWatchLock as w, shownPath as wn, walkSummary as wt, declaredTriggers as x, placeFor as xn, stillTheSameProcess as xt, createWatcher as y, newProjectId as yn, ownProcessStart as yt, endLinksOf as z, parseWorkflow as zn, FEEDBACK_SEVERITIES as zt };
@@ -1,4 +1,4 @@
1
- import { Bt as FEEDBACK_TARGETS, Rt as FEEDBACK_KINDS, pt as parseReport, zt as FEEDBACK_SEVERITIES } from "./src-Dujmvv4s.mjs";
1
+ import { Bt as FEEDBACK_TARGETS, Rt as FEEDBACK_KINDS, pt as parseReport, zt as FEEDBACK_SEVERITIES } from "./src-DnETlJ1r.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomBytes, timingSafeEqual } from "node:crypto";
4
4
  import { createInterface } from "node:readline";
@@ -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-Dujmvv4s.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-DnETlJ1r.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";