@sideboard-ai/core 0.1.331 → 0.1.333

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 (52) hide show
  1. package/dist/agents/cursor-runner.js +2 -2
  2. package/dist/{agents-JXQKHY7Q.js → agents-5NJ3FROS.js} +8 -8
  3. package/dist/{agents-JH4WV2ZH.js → agents-SRM6OVML.js} +7 -7
  4. package/dist/{chunk-NQHTYX35.js → chunk-25KXB7W6.js} +1 -1
  5. package/dist/{chunk-QHKNPN55.js → chunk-4J7R2BFU.js} +31 -18
  6. package/dist/{chunk-G45SGI57.js → chunk-6RUSADA7.js} +4 -4
  7. package/dist/{chunk-QKHEVSB5.js → chunk-BMRJNRQK.js} +1 -1
  8. package/dist/{chunk-JQWCZGSO.js → chunk-CS6LQUL6.js} +110 -11
  9. package/dist/{chunk-KUD24QYI.js → chunk-ELDJBZ52.js} +5 -5
  10. package/dist/{chunk-4YXZOXMT.js → chunk-GK7H3SY7.js} +1 -1
  11. package/dist/{chunk-6U6QRUHY.js → chunk-I6RGRUNY.js} +1 -1
  12. package/dist/{chunk-P4QRDXRY.js → chunk-JJRTVB7D.js} +2 -2
  13. package/dist/{chunk-O7JSWISN.js → chunk-LEUAYFSG.js} +4 -4
  14. package/dist/{chunk-U7EANR52.js → chunk-P7S3XGKL.js} +2 -2
  15. package/dist/{chunk-OOSAMSTE.js → chunk-QKJC725N.js} +29 -16
  16. package/dist/{chunk-XOIJJRAQ.js → chunk-QNKJCD7B.js} +110 -11
  17. package/dist/{chunk-2TUE6JKQ.js → chunk-R4W4VQJZ.js} +2 -0
  18. package/dist/{chunk-7L36GZA4.js → chunk-RCRDNOAT.js} +1 -1
  19. package/dist/{chunk-PZ5MVD27.js → chunk-RJT6JPNX.js} +5 -5
  20. package/dist/{chunk-YBTSZ2SW.js → chunk-TL2HK6LZ.js} +2 -0
  21. package/dist/{chunk-DFKLWWLY.js → chunk-TLL2K2MY.js} +6 -6
  22. package/dist/{chunk-NURZOXGN.js → chunk-UGUWFONI.js} +1 -1
  23. package/dist/{chunk-3DJQLQWU.js → chunk-UV33UCV6.js} +3 -3
  24. package/dist/{chunk-DBRQ5NNB.js → chunk-WXOJSFGO.js} +5 -5
  25. package/dist/{chunk-S5CJUIPY.js → chunk-XOEKCE6L.js} +5 -5
  26. package/dist/{conductor-FA27ZGCV.js → conductor-LUPB6RBH.js} +5 -5
  27. package/dist/{conductor-6DIR7A4N.js → conductor-XSP3SOS2.js} +5 -5
  28. package/dist/{connected-teams-H4LZOJDC.js → connected-teams-2YDE2EZ2.js} +2 -2
  29. package/dist/{connected-teams-XYRZMQO4.js → connected-teams-6756SMAW.js} +2 -2
  30. package/dist/{coordinator-prompt-B6RHGEJK.js → coordinator-prompt-EJJNJ5K7.js} +4 -4
  31. package/dist/{coordinator-prompt-KAZXK5FZ.js → coordinator-prompt-O75QUEHP.js} +4 -4
  32. package/dist/{global-workspace-IOKHZCXD.js → global-workspace-3IG44NAT.js} +4 -4
  33. package/dist/{global-workspace-JKINHUY3.js → global-workspace-Q4OURN7M.js} +4 -4
  34. package/dist/index.cjs +314 -174
  35. package/dist/index.d.cts +23 -3
  36. package/dist/index.d.ts +23 -3
  37. package/dist/index.js +36 -18
  38. package/dist/mcp/run-stdio.cjs +206 -154
  39. package/dist/mcp/run-stdio.js +12 -12
  40. package/dist/{optional-cli-FOSC4NVE.js → optional-cli-KWIII44P.js} +3 -3
  41. package/dist/{optional-cli-NSQZ2DYK.js → optional-cli-XJE4BELL.js} +4 -4
  42. package/dist/{orchestrator-EKG7FUFK.js → orchestrator-IYXIWNB5.js} +11 -11
  43. package/dist/{orchestrator-L44O3JPD.js → orchestrator-WHXHBNRS.js} +10 -10
  44. package/dist/{run-7QMRYP3F.js → run-ARDGUXUN.js} +1 -1
  45. package/dist/{run-UPNCCRCN.js → run-ZKK3VGO5.js} +1 -1
  46. package/dist/{workspaces-FJL3TL3K.js → workspaces-ALUHOCWK.js} +4 -4
  47. package/dist/{workspaces-OLONQF2C.js → workspaces-QGKSXA76.js} +4 -4
  48. package/dist/{worktree-TX4WXQZV.js → worktree-6WWUWH4K.js} +3 -3
  49. package/dist/{worktree-QSQJ2POO.js → worktree-N435EXSP.js} +3 -3
  50. package/dist/{worktree-exclude-P5NJODWP.js → worktree-exclude-KMZQXZKP.js} +2 -2
  51. package/dist/{worktree-exclude-INRDQFWV.js → worktree-exclude-YQBN43QD.js} +2 -2
  52. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -9394,6 +9394,8 @@ var init_path = __esm({
9394
9394
  import_node_path21 = require("path");
9395
9395
  EXTRA_BIN_DIRS = [
9396
9396
  ".local/bin",
9397
+ // Official OpenCode installer (`curl https://opencode.ai/install | bash`).
9398
+ ".opencode/bin",
9397
9399
  ".cargo/bin",
9398
9400
  ".nvm/current/bin",
9399
9401
  ".asdf/shims",
@@ -13125,7 +13127,7 @@ function ensureGlobalCoordinatorCwd(opts) {
13125
13127
  "Typical flow (find work): list_projects \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_workspace + send_to_chat when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
13126
13128
  'Typical flow (review inbox): list_projects \u2192 list_prs(queue=review, limit=N) \u2192 show those PRs (ticket ids in the title when present). create_workspace sourceType=pr only when they asked to start / do the work. Do not list_issues for "tickets to review". The child writes the review in chat and stops \u2014 do not ask_user after it. Do not github_comment / linear_comment / update the PR or ticket, and do not tell the child to post, until the user types a next step. They should work through the feedback in chat first. The PR or ticket author sees those writes immediately.',
13127
13129
  "Typical flow (new app): Bash create/clone under repos dir \u2192 add_project \u2192 create_workspace \u2192 send_to_chat (implement) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
13128
- "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_chat`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
13130
+ "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_chat`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. A push can wake a third-party PR review; acknowledge it only inside that goal. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
13129
13131
  ].join("\n");
13130
13132
  try {
13131
13133
  (0, import_node_fs25.writeFileSync)((0, import_node_path29.join)(dir, "AGENTS.md"), `${body}
@@ -13191,7 +13193,7 @@ var init_coordinator_prompt = __esm({
13191
13193
  "- ask_user \u2014 composer multiple-choice only when blocked on a concrete choice (approach fork, which API, Save this context / Do not save). Never for hellos, check-ins, invented \u201Cwhat should we do?\u201D menus, or after a review \u2014 reply in chat. Explain options first, description on every option, then wait.",
13192
13194
  "- get_viewer_context / update_viewer_context \u2014 read or replace Settings \u2192 Agents (account) and Settings \u2192 Projects (per-repo) context. You can update a project: pass scope=project and repoPath from list_projects (this cwd is not a project). update_viewer_context requires confirmed=true after ask_user. Never write context unprompted.",
13193
13195
  "- list_env / set_env / delete_env \u2014 Settings \u2192 Environment. scope=project requires repoPath from list_projects and stores the key under that project prefix (the project name, uppercased, plus _). APPLE_ID for sideboard is SIDEBOARD_APPLE_ID. scope=account is shared by every project and is not prefixed. list_env returns names only.",
13194
- "- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). Turn on for phone remote / away-from-keyboard work, overnight schedules, or when the user will be away. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
13196
+ "- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn on for overnight work, or when the user will be away and no phone is connected. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
13195
13197
  "- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived runs for that automation. Worktree agents have the same tools (`chatId=self` continues that coding chat and is removed when that chat is archived). Jobs fire only while Sideboard.app is running; sleep skips until wake. Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled (or call set_caffeinate). The desktop lists them in the sidebar after Board.",
13196
13198
  "Projects:",
13197
13199
  "- add_project / remove_project \u2014 register or unregister a git repo",
@@ -13217,7 +13219,7 @@ var init_coordinator_prompt = __esm({
13217
13219
  "- get_diff \u2014 compact diff summary",
13218
13220
  "- get_pr_checks \u2014 snapshot of a worktree thread's PR checks (null = no PR). Use this to inspect status. If the user gave a goal, the worktree agent watches with `gh pr checks --watch` on GitHub, `origin pr watch` on Cursor, or `entire trail watch` on Entire \u2014 do not poll for the human.",
13219
13221
  '- request_review \u2014 run a Review on a worktree thread. Reuses the only unused idle agent when the checkout has a single chat with no messages; otherwise opens a Review tab (attaches .claude/skills/review/SKILL.md when present, else .context/review.md copied from .sideboard/review.md / stock; sends "Review changes in this workspace."); then wait_for_turn (loop while stillRunning) / get_turn_result on the returned id. The review stays in that chat so they can read it and type next steps \u2014 do not tell the child to comment or update the PR or ticket.',
13220
- "- ask_git \u2014 commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (Resolve, Create PR, \u2026). Always steers the worktree agent; then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing. If the user gave a goal (Greptile 5/5, CI green), send_to_chat that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll.",
13222
+ "- ask_git \u2014 commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (Resolve, Create PR, \u2026). Always steers the worktree agent; then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing. If the user gave a goal (Greptile 5/5, CI green), send_to_chat that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll. A push can wake a third-party PR review; the worktree agent acknowledges that review only inside an existing goal, not on a plain push.",
13221
13223
  '- Merge (`ask_git` action=merge / send_to_chat "Merge PR.") only when the user explicitly asked to merge that PR. Do not merge because the work looks done, CI is green, or a typical flow includes it.',
13222
13224
  '- Or send_to_chat with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Ready for review.", "Merge PR." Prefer ask_git resolve-conflicts (it names the actual PR base \u2014 not always main) over paraphrasing. Draft PRs follow that workspace origin: GitHub (`github:`) uses `gh pr create --draft --assignee @me -R <slug>`; Cursor (`cursor:`) uses `origin pr create --draft --push -R <slug>`; Entire (`entire:`) uses `entire trail create --title` (Trails have no draft state). Never upstream. Never run git, gh, origin, or entire from this orchestration cwd, and never merge the PR yourself.',
13223
13225
  "Process guides:",
@@ -21659,6 +21661,83 @@ var init_claude_usage_client = __esm({
21659
21661
  }
21660
21662
  });
21661
21663
 
21664
+ // src/agents/install-native.ts
21665
+ async function installCurlScript(opts) {
21666
+ const result = await run("bash", ["-c", opts.command], {
21667
+ reject: false,
21668
+ timeoutMs: 3e5
21669
+ });
21670
+ if (result.exitCode === 0) {
21671
+ const binPath = await whichOnPath(opts.bin);
21672
+ if (binPath) {
21673
+ return {
21674
+ ok: true,
21675
+ command: opts.command,
21676
+ exitCode: 0,
21677
+ stdout: result.stdout,
21678
+ stderr: result.stderr,
21679
+ message: `Installed ${opts.label} \u2192 ${binPath}`
21680
+ };
21681
+ }
21682
+ return {
21683
+ ok: false,
21684
+ command: opts.command,
21685
+ exitCode: result.exitCode,
21686
+ stdout: result.stdout,
21687
+ stderr: result.stderr,
21688
+ message: `${opts.label} installer finished, but \`${opts.bin}\` is not on PATH. Expected ${opts.expected}.`
21689
+ };
21690
+ }
21691
+ const detail = result.stderr.trim() || result.stdout.trim();
21692
+ try {
21693
+ await openInSystemTerminal(opts.command);
21694
+ return {
21695
+ ok: false,
21696
+ openedTerminal: true,
21697
+ command: opts.command,
21698
+ exitCode: result.exitCode,
21699
+ stdout: result.stdout,
21700
+ stderr: result.stderr,
21701
+ message: `${opts.label} install failed (exit ${result.exitCode}). Opened Terminal with: ${opts.command}`
21702
+ };
21703
+ } catch {
21704
+ return {
21705
+ ok: false,
21706
+ command: opts.command,
21707
+ exitCode: result.exitCode,
21708
+ stdout: result.stdout,
21709
+ stderr: result.stderr,
21710
+ message: detail ? `${opts.label} install failed (exit ${result.exitCode}). ${detail}` : `${opts.label} install failed (exit ${result.exitCode})`
21711
+ };
21712
+ }
21713
+ }
21714
+ function installClaudeNative() {
21715
+ return installCurlScript({
21716
+ command: CLAUDE_NATIVE_INSTALL,
21717
+ bin: "claude",
21718
+ label: "Claude Code",
21719
+ expected: "~/.local/bin/claude"
21720
+ });
21721
+ }
21722
+ function installOpenCodeNative() {
21723
+ return installCurlScript({
21724
+ command: OPENCODE_NATIVE_INSTALL,
21725
+ bin: "opencode",
21726
+ label: "OpenCode",
21727
+ expected: "~/.opencode/bin/opencode"
21728
+ });
21729
+ }
21730
+ var CLAUDE_NATIVE_INSTALL, OPENCODE_NATIVE_INSTALL;
21731
+ var init_install_native = __esm({
21732
+ "src/agents/install-native.ts"() {
21733
+ "use strict";
21734
+ init_run();
21735
+ init_install();
21736
+ CLAUDE_NATIVE_INSTALL = "curl -fsSL https://claude.ai/install.sh | bash";
21737
+ OPENCODE_NATIVE_INSTALL = "curl -fsSL https://opencode.ai/install | bash";
21738
+ }
21739
+ });
21740
+
21662
21741
  // src/agents/install.ts
21663
21742
  function getAgentSetupInfo(agent) {
21664
21743
  return SETUP[agent];
@@ -21763,7 +21842,17 @@ async function installNpmGlobalPackage(opts) {
21763
21842
  }
21764
21843
  }
21765
21844
  enrichPathWithNpmGlobalBin();
21766
- const binPath = opts.cliBin ? await whichOnPath(opts.cliBin) : null;
21845
+ const binPath = opts.cliBin ? await resolveCliAfterNpmInstall(opts.cliBin) : null;
21846
+ if (opts.cliBin && !binPath) {
21847
+ return {
21848
+ ok: false,
21849
+ command: opts.installCommand,
21850
+ exitCode: 0,
21851
+ stdout: result.stdout,
21852
+ stderr: result.stderr,
21853
+ message: `Installed ${opts.npmPackage}, but \`${opts.cliBin}\` is not on PATH.`
21854
+ };
21855
+ }
21767
21856
  return {
21768
21857
  ok: true,
21769
21858
  command: opts.installCommand,
@@ -21771,9 +21860,25 @@ async function installNpmGlobalPackage(opts) {
21771
21860
  stdout: result.stdout,
21772
21861
  stderr: result.stderr,
21773
21862
  // Library-only packages (`@cursor/sdk`) have no CLI to look for.
21774
- message: !opts.cliBin ? `Installed ${opts.npmPackage}` : binPath ? `Installed ${opts.npmPackage} \u2192 ${binPath}` : `Installed ${opts.npmPackage} (CLI not yet on PATH)`
21863
+ message: !opts.cliBin ? `Installed ${opts.npmPackage}` : `Installed ${opts.npmPackage} \u2192 ${binPath}`
21775
21864
  };
21776
21865
  }
21866
+ async function resolveCliAfterNpmInstall(cliBin) {
21867
+ const found = await whichOnPath(cliBin);
21868
+ if (found) return found;
21869
+ const prefix = await run("npm", ["prefix", "-g"], { reject: false, timeoutMs: 8e3 });
21870
+ if (prefix.exitCode !== 0) return null;
21871
+ const root = prefix.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("/")).pop();
21872
+ if (!root) return null;
21873
+ const candidate = (0, import_node_path51.join)(root, "bin", cliBin);
21874
+ if (!(0, import_node_fs49.existsSync)(candidate)) return null;
21875
+ try {
21876
+ (0, import_node_fs49.chmodSync)(candidate, 493);
21877
+ } catch {
21878
+ }
21879
+ enrichPathWithNpmGlobalBin();
21880
+ return whichOnPath(cliBin);
21881
+ }
21777
21882
  async function resolveExistingCli(agent) {
21778
21883
  if (agent === "cursor") return null;
21779
21884
  const exe = resolveAgentExecutable(agent);
@@ -21816,6 +21921,8 @@ async function installAgent(agent) {
21816
21921
  if (existing && info.updateArgs?.length) {
21817
21922
  return runVendorUpdate(existing, info.updateArgs);
21818
21923
  }
21924
+ if (agent === "claude") return installClaudeNative();
21925
+ if (agent === "opencode") return installOpenCodeNative();
21819
21926
  if (info.npmPackage && !isCurlInstaller(info.installCommand)) {
21820
21927
  const cliBin = agent === "cursor" ? null : CLI_BIN[agent];
21821
21928
  return installNpmGlobalPackage({
@@ -21871,23 +21978,24 @@ async function loginManagedAccount(accountId) {
21871
21978
  message: `Opened Terminal to run: ${prefixed}`
21872
21979
  };
21873
21980
  }
21874
- var import_node_fs49, SETUP, CLI_BIN, CLI_LOGIN_AGENTS;
21981
+ var import_node_fs49, import_node_path51, SETUP, CLI_BIN, CLI_LOGIN_AGENTS;
21875
21982
  var init_install = __esm({
21876
21983
  "src/agents/install.ts"() {
21877
21984
  "use strict";
21878
21985
  import_node_fs49 = require("fs");
21986
+ import_node_path51 = require("path");
21879
21987
  init_run();
21880
21988
  init_app_settings();
21989
+ init_install_native();
21881
21990
  init_path();
21882
21991
  SETUP = {
21883
21992
  claude: {
21884
21993
  agent: "claude",
21885
21994
  kind: "cli",
21886
- summary: "Install the Claude Code CLI, then complete login in a terminal.",
21995
+ summary: "Install Claude Code, then complete login in a terminal.",
21887
21996
  docsUrl: "https://code.claude.com/docs/en/install",
21888
- installCommand: "npm install -g @anthropic-ai/claude-code",
21997
+ installCommand: CLAUDE_NATIVE_INSTALL,
21889
21998
  loginCommand: "claude auth login",
21890
- npmPackage: "@anthropic-ai/claude-code",
21891
21999
  updateArgs: ["update"]
21892
22000
  },
21893
22001
  codex: {
@@ -21903,12 +22011,12 @@ var init_install = __esm({
21903
22011
  opencode: {
21904
22012
  agent: "opencode",
21905
22013
  kind: "cli",
21906
- summary: "Install OpenCode (curl installer or npm), then authenticate providers.",
22014
+ summary: "Install OpenCode, then authenticate providers.",
21907
22015
  docsUrl: "https://opencode.ai/docs",
21908
- // Prefer the official installer; npm package name is opencode-ai.
21909
- installCommand: "curl -fsSL https://opencode.ai/install | bash",
22016
+ // npm package `opencode-ai` ships the same kind of non-executable native stub
22017
+ // as Claude. The curl installer writes ~/.opencode/bin/opencode.
22018
+ installCommand: OPENCODE_NATIVE_INSTALL,
21910
22019
  loginCommand: "opencode auth login",
21911
- npmPackage: "opencode-ai@latest",
21912
22020
  updateArgs: ["upgrade"]
21913
22021
  },
21914
22022
  cursor: {
@@ -22116,7 +22224,7 @@ function isAgentHostEnvKey(key) {
22116
22224
  }
22117
22225
  function stripHostToolingPath(pathValue) {
22118
22226
  if (!pathValue?.trim()) return "";
22119
- return pathValue.split(import_node_path51.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path51.delimiter);
22227
+ return pathValue.split(import_node_path52.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path52.delimiter);
22120
22228
  }
22121
22229
  function sanitizeAgentHostEnv(env, cwd) {
22122
22230
  for (const key of Object.keys(env)) {
@@ -22130,11 +22238,11 @@ function sanitizeAgentHostEnv(env, cwd) {
22130
22238
  }
22131
22239
  return env;
22132
22240
  }
22133
- var import_node_path51, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
22241
+ var import_node_path52, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
22134
22242
  var init_agent_host_env = __esm({
22135
22243
  "src/hook/agent-host-env.ts"() {
22136
22244
  "use strict";
22137
- import_node_path51 = require("path");
22245
+ import_node_path52 = require("path");
22138
22246
  DROP_EXACT = /* @__PURE__ */ new Set([
22139
22247
  "NODE_PATH",
22140
22248
  "NODE_ENV_ELECTRON_VITE",
@@ -22173,15 +22281,15 @@ var init_agent_host_env = __esm({
22173
22281
 
22174
22282
  // src/hook/worktree-pkg-cache.ts
22175
22283
  function worktreePkgCacheRoot(worktreePath) {
22176
- return (0, import_node_path52.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
22284
+ return (0, import_node_path53.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
22177
22285
  }
22178
22286
  function worktreePkgCacheEnv(worktreePath) {
22179
22287
  const root = worktreePkgCacheRoot(worktreePath);
22180
- const store = (0, import_node_path52.join)(root, "pnpm-store");
22181
- const pnpmCache = (0, import_node_path52.join)(root, "pnpm");
22182
- const npmCache = (0, import_node_path52.join)(root, "npm");
22183
- const nodeGyp = (0, import_node_path52.join)(root, "node-gyp");
22184
- const electron = (0, import_node_path52.join)(root, "electron");
22288
+ const store = (0, import_node_path53.join)(root, "pnpm-store");
22289
+ const pnpmCache = (0, import_node_path53.join)(root, "pnpm");
22290
+ const npmCache = (0, import_node_path53.join)(root, "npm");
22291
+ const nodeGyp = (0, import_node_path53.join)(root, "node-gyp");
22292
+ const electron = (0, import_node_path53.join)(root, "electron");
22185
22293
  return {
22186
22294
  npm_config_store_dir: store,
22187
22295
  PNPM_STORE_DIR: store,
@@ -22217,12 +22325,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
22217
22325
  fillGroup(env, ["electron_config_cache"], next);
22218
22326
  ensureWorktreePkgCacheDirs(cwd);
22219
22327
  }
22220
- var import_node_fs50, import_node_path52, WORKTREE_PKG_CACHE_REL;
22328
+ var import_node_fs50, import_node_path53, WORKTREE_PKG_CACHE_REL;
22221
22329
  var init_worktree_pkg_cache = __esm({
22222
22330
  "src/hook/worktree-pkg-cache.ts"() {
22223
22331
  "use strict";
22224
22332
  import_node_fs50 = require("fs");
22225
- import_node_path52 = require("path");
22333
+ import_node_path53 = require("path");
22226
22334
  WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
22227
22335
  }
22228
22336
  });
@@ -22703,11 +22811,22 @@ function expandCanonicalGitRequest(prompt, opts) {
22703
22811
  expansion = forge === "cursor" ? "Investigate that failing check (`origin pr checks`, `origin pr watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : forge === "entire" ? "Investigate the blocking gate (`entire trail merge --dry-run`, `entire trail finding list`, `entire trail watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : "Investigate that failing check (`gh pr checks`, `gh run view --log-failed`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given.";
22704
22812
  }
22705
22813
  if (!expansion) return prompt;
22814
+ if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
22706
22815
  return `${trimmed}
22707
22816
 
22708
22817
  (Sideboard git request \u2014 do not ask for clarification: ${expansion})`;
22709
22818
  }
22710
- var AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE;
22819
+ function withPushReview(expansion) {
22820
+ const base = expansion.replace(CHECKS_LOOP_UNLESS_GOAL, "").trim();
22821
+ if (base.includes("third-party PR review")) return base;
22822
+ return `${base} ${PUSH_WAKES_REVIEW}`;
22823
+ }
22824
+ function expansionPushes(action, prompt) {
22825
+ if (action === "ready-for-review" || action === "merge") return false;
22826
+ if (action) return true;
22827
+ return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
22828
+ }
22829
+ var AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
22711
22830
  var init_agent_git_actions = __esm({
22712
22831
  "src/git/agent-git-actions.ts"() {
22713
22832
  "use strict";
@@ -22722,6 +22841,8 @@ var init_agent_git_actions = __esm({
22722
22841
  RESOLVE_CONFLICTS_RE = /^Merge the remote branch(?: \(([^)]+)\))? into your branch and resolve conflicts\. Then, commit and push your changes\.$/;
22723
22842
  MERGE_INTO_RE = /^Merge PR into (.+)\.$/;
22724
22843
  FIX_CI_RE = /^Fix CI: .+\.$/;
22844
+ PUSH_WAKES_REVIEW = "A push can start or refresh a third-party PR review (whichever bot this repo runs). If this chat already has a goal to keep going until CI or that review is clean, read the reviewer\u2019s latest comment and unresolved threads and address them. Do not start that loop on a plain push.";
22845
+ CHECKS_LOOP_UNLESS_GOAL = / ?Do not start a checks loop unless a goal was given\./g;
22725
22846
  }
22726
22847
  });
22727
22848
 
@@ -23709,12 +23830,12 @@ function readTextIfPresent(abs) {
23709
23830
  }
23710
23831
  }
23711
23832
  function readLocalGuidelines(worktreePath) {
23712
- const localAbs = (0, import_node_path53.join)(worktreePath, REVIEW_REQUEST_PATH);
23833
+ const localAbs = (0, import_node_path54.join)(worktreePath, REVIEW_REQUEST_PATH);
23713
23834
  const localContent = readTextIfPresent(localAbs);
23714
23835
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
23715
23836
  return { path: REVIEW_REQUEST_PATH, content: localContent };
23716
23837
  }
23717
- const legacyAbs = (0, import_node_path53.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
23838
+ const legacyAbs = (0, import_node_path54.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
23718
23839
  const legacyContent = readTextIfPresent(legacyAbs);
23719
23840
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
23720
23841
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -23738,27 +23859,27 @@ function contextGuidelines(content, source) {
23738
23859
  };
23739
23860
  }
23740
23861
  function writeContextGuidelines(worktreePath, content) {
23741
- const abs = (0, import_node_path53.join)(worktreePath, CONTEXT_REVIEW_PATH);
23742
- (0, import_node_fs52.mkdirSync)((0, import_node_path53.dirname)(abs), { recursive: true });
23862
+ const abs = (0, import_node_path54.join)(worktreePath, CONTEXT_REVIEW_PATH);
23863
+ (0, import_node_fs52.mkdirSync)((0, import_node_path54.dirname)(abs), { recursive: true });
23743
23864
  const body = content.endsWith("\n") ? content : `${content}
23744
23865
  `;
23745
23866
  (0, import_node_fs52.writeFileSync)(abs, body, "utf8");
23746
23867
  return body;
23747
23868
  }
23748
23869
  function readSideboardReview(worktreePath, repoPath) {
23749
- const fromWorktree = readTextIfPresent((0, import_node_path53.join)(worktreePath, REPO_REVIEW_PATH));
23870
+ const fromWorktree = readTextIfPresent((0, import_node_path54.join)(worktreePath, REPO_REVIEW_PATH));
23750
23871
  if (fromWorktree) return fromWorktree;
23751
23872
  const repo = repoPath?.replace(/\/+$/, "");
23752
23873
  const wt = worktreePath.replace(/\/+$/, "");
23753
23874
  if (!repo || repo === wt) return null;
23754
- return readTextIfPresent((0, import_node_path53.join)(repo, REPO_REVIEW_PATH));
23875
+ return readTextIfPresent((0, import_node_path54.join)(repo, REPO_REVIEW_PATH));
23755
23876
  }
23756
23877
  function ensureReviewGuidelinesFile(worktreePath, repoPath) {
23757
- const skillContent = readTextIfPresent((0, import_node_path53.join)(worktreePath, REVIEW_SKILL_PATH));
23878
+ const skillContent = readTextIfPresent((0, import_node_path54.join)(worktreePath, REVIEW_SKILL_PATH));
23758
23879
  if (skillContent) {
23759
23880
  return { ...skillGuidelines(skillContent, "skill"), wrote: false };
23760
23881
  }
23761
- const contextContent = readTextIfPresent((0, import_node_path53.join)(worktreePath, CONTEXT_REVIEW_PATH));
23882
+ const contextContent = readTextIfPresent((0, import_node_path54.join)(worktreePath, CONTEXT_REVIEW_PATH));
23762
23883
  if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
23763
23884
  return { ...contextGuidelines(contextContent, "local"), wrote: false };
23764
23885
  }
@@ -23796,7 +23917,7 @@ function buildReviewRequestAttachment(content, opts) {
23796
23917
  };
23797
23918
  }
23798
23919
  function readExistingReviewRequestFile(worktreePath) {
23799
- return readTextIfPresent((0, import_node_path53.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path53.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path53.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path53.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path53.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
23920
+ return readTextIfPresent((0, import_node_path54.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path54.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path54.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path54.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path54.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
23800
23921
  }
23801
23922
  function canReuseIdleWorktreeAgentForReview(from, siblings) {
23802
23923
  const live = siblings.filter((t) => t.status !== "archived");
@@ -23844,13 +23965,13 @@ async function requestReview(threadRef, send3) {
23844
23965
  const started = await send3(tab.id, REVIEW_REQUEST_PREFILL);
23845
23966
  return { tab: started, from };
23846
23967
  }
23847
- var import_node_crypto16, import_node_fs52, import_node_path53, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
23968
+ var import_node_crypto16, import_node_fs52, import_node_path54, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
23848
23969
  var init_request_review = __esm({
23849
23970
  "src/review/request-review.ts"() {
23850
23971
  "use strict";
23851
23972
  import_node_crypto16 = require("crypto");
23852
23973
  import_node_fs52 = require("fs");
23853
- import_node_path53 = require("path");
23974
+ import_node_path54 = require("path");
23854
23975
  init_global_workspace();
23855
23976
  init_chat_tabs();
23856
23977
  init_thread_store();
@@ -23873,7 +23994,7 @@ var init_request_review = __esm({
23873
23994
 
23874
23995
  // src/hook/worktree-run-ports.ts
23875
23996
  function worktreeRunPortsPath(worktreePath) {
23876
- return (0, import_node_path54.join)(worktreePath, RUN_PORTS_REL);
23997
+ return (0, import_node_path55.join)(worktreePath, RUN_PORTS_REL);
23877
23998
  }
23878
23999
  function isPort(value) {
23879
24000
  return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 65535;
@@ -23931,16 +24052,16 @@ function saveWorktreeRunPorts(worktreePath, scriptName, ports) {
23931
24052
  }
23932
24053
  const scripts = { ...current.scripts ?? {} };
23933
24054
  scripts[scriptName] = cleaned;
23934
- (0, import_node_fs53.mkdirSync)((0, import_node_path54.dirname)(path2), { recursive: true });
24055
+ (0, import_node_fs53.mkdirSync)((0, import_node_path55.dirname)(path2), { recursive: true });
23935
24056
  (0, import_node_fs53.writeFileSync)(path2, `${JSON.stringify({ scripts }, null, 2)}
23936
24057
  `, "utf8");
23937
24058
  }
23938
- var import_node_fs53, import_node_path54, RUN_PORTS_REL;
24059
+ var import_node_fs53, import_node_path55, RUN_PORTS_REL;
23939
24060
  var init_worktree_run_ports = __esm({
23940
24061
  "src/hook/worktree-run-ports.ts"() {
23941
24062
  "use strict";
23942
24063
  import_node_fs53 = require("fs");
23943
- import_node_path54 = require("path");
24064
+ import_node_path55 = require("path");
23944
24065
  RUN_PORTS_REL = ".context/.sideboard/run-ports.json";
23945
24066
  }
23946
24067
  });
@@ -23992,7 +24113,7 @@ function readIntFile(file) {
23992
24113
  return Number.isInteger(n) ? n : null;
23993
24114
  }
23994
24115
  function jobDir(root, id, legacy = false) {
23995
- return (0, import_node_path55.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
24116
+ return (0, import_node_path56.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
23996
24117
  }
23997
24118
  function resolveJobDir(root, id) {
23998
24119
  const modern = jobDir(root, id, false);
@@ -24002,7 +24123,7 @@ function resolveJobDir(root, id) {
24002
24123
  return modern;
24003
24124
  }
24004
24125
  function listJobIdsIn(root, rel) {
24005
- const dir = (0, import_node_path55.join)(root, rel);
24126
+ const dir = (0, import_node_path56.join)(root, rel);
24006
24127
  if (!(0, import_node_fs54.existsSync)(dir)) return [];
24007
24128
  return (0, import_node_fs54.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
24008
24129
  }
@@ -24016,7 +24137,7 @@ function listRunningDetachedJobs(worktreePath) {
24016
24137
  const running2 = [];
24017
24138
  for (const id of ids) {
24018
24139
  const dir = resolveJobDir(root, id);
24019
- const pid = readIntFile((0, import_node_path55.join)(dir, "pid"));
24140
+ const pid = readIntFile((0, import_node_path56.join)(dir, "pid"));
24020
24141
  if (jobTreeAlive(pid)) running2.push(id);
24021
24142
  }
24022
24143
  return running2.sort();
@@ -24123,15 +24244,15 @@ function takeDelta(logFile, cursorFile) {
24123
24244
  return { delta: capJobLogDelta(lines.slice(start).join("\n")), nextCursor: lines.length };
24124
24245
  }
24125
24246
  function snapshotJob(dir) {
24126
- const pid = readIntFile((0, import_node_path55.join)(dir, "pid"));
24247
+ const pid = readIntFile((0, import_node_path56.join)(dir, "pid"));
24127
24248
  const running2 = jobTreeAlive(pid);
24128
24249
  return {
24129
24250
  pid,
24130
24251
  running: running2,
24131
- exitCode: readIntFile((0, import_node_path55.join)(dir, "exit")),
24132
- log: (0, import_node_path55.join)(dir, "log"),
24133
- cursor: (0, import_node_path55.join)(dir, "present.cursor"),
24134
- progress: tailProgress((0, import_node_path55.join)(dir, "log"))
24252
+ exitCode: readIntFile((0, import_node_path56.join)(dir, "exit")),
24253
+ log: (0, import_node_path56.join)(dir, "log"),
24254
+ cursor: (0, import_node_path56.join)(dir, "present.cursor"),
24255
+ progress: tailProgress((0, import_node_path56.join)(dir, "log"))
24135
24256
  };
24136
24257
  }
24137
24258
  function toResult(id, snap, extra) {
@@ -24140,7 +24261,7 @@ function toResult(id, snap, extra) {
24140
24261
  const stillRunning = snap.running && !ok;
24141
24262
  const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
24142
24263
  try {
24143
- (0, import_node_fs54.mkdirSync)((0, import_node_path55.dirname)(snap.cursor), { recursive: true });
24264
+ (0, import_node_fs54.mkdirSync)((0, import_node_path56.dirname)(snap.cursor), { recursive: true });
24144
24265
  (0, import_node_fs54.writeFileSync)(snap.cursor, `${nextCursor}
24145
24266
  `);
24146
24267
  } catch {
@@ -24216,7 +24337,7 @@ function killProcessTree(pid, signal) {
24216
24337
  }
24217
24338
  function appendJobLog(logFile, line) {
24218
24339
  try {
24219
- (0, import_node_fs54.mkdirSync)((0, import_node_path55.dirname)(logFile), { recursive: true });
24340
+ (0, import_node_fs54.mkdirSync)((0, import_node_path56.dirname)(logFile), { recursive: true });
24220
24341
  const body = line.endsWith("\n") ? line : `${line}
24221
24342
  `;
24222
24343
  (0, import_node_fs54.appendFileSync)(logFile, body);
@@ -24265,7 +24386,7 @@ async function stopDetachedJob(cwd, id, opts) {
24265
24386
  killProcessTree(targetPid, "SIGKILL");
24266
24387
  await sleep3(100);
24267
24388
  }
24268
- const exitFile = (0, import_node_path55.join)(dir, "exit");
24389
+ const exitFile = (0, import_node_path56.join)(dir, "exit");
24269
24390
  if (!(0, import_node_fs54.existsSync)(exitFile)) {
24270
24391
  try {
24271
24392
  (0, import_node_fs54.writeFileSync)(exitFile, "1\n");
@@ -24288,12 +24409,12 @@ async function stopDetachedJob(cwd, id, opts) {
24288
24409
  hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
24289
24410
  };
24290
24411
  }
24291
- var import_node_fs54, import_node_path55, MAX_JOB_CONTINUES, MAX_JOB_DELTA_LINES, MAX_JOB_DELTA_CHARS, DEFERRED_DONE_MAX_CHARS, GH_WATCH_REFRESH, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
24412
+ var import_node_fs54, import_node_path56, MAX_JOB_CONTINUES, MAX_JOB_DELTA_LINES, MAX_JOB_DELTA_CHARS, DEFERRED_DONE_MAX_CHARS, GH_WATCH_REFRESH, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
24292
24413
  var init_wait_for_job = __esm({
24293
24414
  "src/mcp/wait-for-job.ts"() {
24294
24415
  "use strict";
24295
24416
  import_node_fs54 = require("fs");
24296
- import_node_path55 = require("path");
24417
+ import_node_path56 = require("path");
24297
24418
  init_workspace_scratch();
24298
24419
  init_job_process();
24299
24420
  init_wait_for_turn();
@@ -24569,7 +24690,7 @@ function matchSimpleGlob(pattern, name) {
24569
24690
  return new RegExp(`^${escaped}$`).test(name);
24570
24691
  }
24571
24692
  function readWorktreeInclude(repoPath) {
24572
- const path2 = (0, import_node_path56.join)(repoPath, ".worktreeinclude");
24693
+ const path2 = (0, import_node_path57.join)(repoPath, ".worktreeinclude");
24573
24694
  if (!(0, import_node_fs55.existsSync)(path2)) return [];
24574
24695
  return (0, import_node_fs55.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
24575
24696
  }
@@ -24584,7 +24705,7 @@ function resolveFilesToCopy(repoPath) {
24584
24705
  for (const entry of (0, import_node_fs55.readdirSync)(repoPath, { withFileTypes: true })) {
24585
24706
  if (!entry.isFile()) continue;
24586
24707
  for (const glob of settings.fileIncludeGlobs) {
24587
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path56.basename)(glob), entry.name)) {
24708
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path57.basename)(glob), entry.name)) {
24588
24709
  matched.push(entry.name);
24589
24710
  break;
24590
24711
  }
@@ -24610,10 +24731,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
24610
24731
  const patterns = resolveFilesToCopy(repoPath);
24611
24732
  const copied = [];
24612
24733
  for (const rel of patterns) {
24613
- const src = (0, import_node_path56.join)(repoPath, rel);
24734
+ const src = (0, import_node_path57.join)(repoPath, rel);
24614
24735
  if (!(0, import_node_fs55.existsSync)(src)) continue;
24615
- const dest = (0, import_node_path56.join)(worktreePath, rel);
24616
- (0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(dest), { recursive: true });
24736
+ const dest = (0, import_node_path57.join)(worktreePath, rel);
24737
+ (0, import_node_fs55.mkdirSync)((0, import_node_path57.dirname)(dest), { recursive: true });
24617
24738
  (0, import_node_fs55.copyFileSync)(src, dest);
24618
24739
  copied.push(rel);
24619
24740
  }
@@ -24627,7 +24748,7 @@ function linkSharedDirectories(repoPath, worktreePath) {
24627
24748
  for (const rel of dirs) {
24628
24749
  if (!isSafeRelativeDir(rel)) continue;
24629
24750
  if (!isGitignored(repoPath, rel)) continue;
24630
- const src = (0, import_node_path56.join)(repoPath, rel);
24751
+ const src = (0, import_node_path57.join)(repoPath, rel);
24631
24752
  let srcStat;
24632
24753
  try {
24633
24754
  srcStat = (0, import_node_fs55.lstatSync)(src);
@@ -24635,9 +24756,9 @@ function linkSharedDirectories(repoPath, worktreePath) {
24635
24756
  continue;
24636
24757
  }
24637
24758
  if (!srcStat.isDirectory()) continue;
24638
- const dest = (0, import_node_path56.join)(worktreePath, rel);
24759
+ const dest = (0, import_node_path57.join)(worktreePath, rel);
24639
24760
  if ((0, import_node_fs55.existsSync)(dest)) continue;
24640
- (0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(dest), { recursive: true });
24761
+ (0, import_node_fs55.mkdirSync)((0, import_node_path57.dirname)(dest), { recursive: true });
24641
24762
  try {
24642
24763
  (0, import_node_fs55.symlinkSync)(src, dest);
24643
24764
  } catch {
@@ -24651,11 +24772,11 @@ function samePath(a, b) {
24651
24772
  try {
24652
24773
  return (0, import_node_fs55.realpathSync)(a) === (0, import_node_fs55.realpathSync)(b);
24653
24774
  } catch {
24654
- return (0, import_node_path56.resolve)(a) === (0, import_node_path56.resolve)(b);
24775
+ return (0, import_node_path57.resolve)(a) === (0, import_node_path57.resolve)(b);
24655
24776
  }
24656
24777
  }
24657
24778
  function isSafeRelativeDir(rel) {
24658
- if (!rel || (0, import_node_path56.isAbsolute)(rel)) return false;
24779
+ if (!rel || (0, import_node_path57.isAbsolute)(rel)) return false;
24659
24780
  const parts = rel.split(/[\\/]/).filter(Boolean);
24660
24781
  return parts.length > 0 && parts.every((part) => part !== "." && part !== "..");
24661
24782
  }
@@ -24697,7 +24818,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
24697
24818
  const env = stripNestedElectronEnv({
24698
24819
  ...baseEnv ?? process.env
24699
24820
  });
24700
- const name = opts.workspaceName ?? (0, import_node_path56.basename)(opts.worktreePath);
24821
+ const name = opts.workspaceName ?? (0, import_node_path57.basename)(opts.worktreePath);
24701
24822
  const ports = opts.ports ?? [];
24702
24823
  const primary = ports[0];
24703
24824
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -24768,18 +24889,18 @@ function realpathOrResolve(path2) {
24768
24889
  try {
24769
24890
  return (0, import_node_fs55.realpathSync)(path2);
24770
24891
  } catch {
24771
- return (0, import_node_path56.resolve)(path2);
24892
+ return (0, import_node_path57.resolve)(path2);
24772
24893
  }
24773
24894
  }
24774
24895
  function isOtherWorktreeListenerCwd(cwd, worktreePath) {
24775
24896
  const wt = realpathOrResolve(worktreePath);
24776
24897
  const c = realpathOrResolve(cwd);
24777
- if (c === wt || c.startsWith(wt + import_node_path56.sep)) return false;
24778
- const parent = (0, import_node_path56.dirname)(wt);
24779
- const thisName = (0, import_node_path56.basename)(wt);
24898
+ if (c === wt || c.startsWith(wt + import_node_path57.sep)) return false;
24899
+ const parent = (0, import_node_path57.dirname)(wt);
24900
+ const thisName = (0, import_node_path57.basename)(wt);
24780
24901
  if (!thisName || c === parent) return false;
24781
- if (!c.startsWith(parent + import_node_path56.sep)) return false;
24782
- const first = c.slice(parent.length + 1).split(import_node_path56.sep)[0];
24902
+ if (!c.startsWith(parent + import_node_path57.sep)) return false;
24903
+ const first = c.slice(parent.length + 1).split(import_node_path57.sep)[0];
24783
24904
  return Boolean(first) && first !== thisName;
24784
24905
  }
24785
24906
  function signalPid(pid, signal) {
@@ -24791,7 +24912,7 @@ function signalPid(pid, signal) {
24791
24912
  function isThisWorktreeListenerCwd(cwd, worktreePath) {
24792
24913
  const wt = realpathOrResolve(worktreePath);
24793
24914
  const c = realpathOrResolve(cwd);
24794
- return c === wt || c.startsWith(wt + import_node_path56.sep);
24915
+ return c === wt || c.startsWith(wt + import_node_path57.sep);
24795
24916
  }
24796
24917
  function killDetachedRunTree(pid, worktreePath) {
24797
24918
  if (!Number.isFinite(pid) || pid <= 1 || pid === process.pid) return;
@@ -25043,13 +25164,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
25043
25164
  throw err;
25044
25165
  }
25045
25166
  }
25046
- var import_node_fs55, import_node_child_process6, import_node_path56, import_execa4, import_node_readline3, cachedLoginEnv;
25167
+ var import_node_fs55, import_node_child_process6, import_node_path57, import_execa4, import_node_readline3, cachedLoginEnv;
25047
25168
  var init_conductor = __esm({
25048
25169
  "src/hook/conductor.ts"() {
25049
25170
  "use strict";
25050
25171
  import_node_fs55 = require("fs");
25051
25172
  import_node_child_process6 = require("child_process");
25052
- import_node_path56 = require("path");
25173
+ import_node_path57 = require("path");
25053
25174
  import_execa4 = require("execa");
25054
25175
  import_node_readline3 = require("readline");
25055
25176
  init_settings();
@@ -25116,9 +25237,9 @@ async function findOrphanWorktrees(repoPaths) {
25116
25237
  if ((0, import_node_fs56.existsSync)(root)) {
25117
25238
  for (const entry of (0, import_node_fs56.readdirSync)(root, { withFileTypes: true })) {
25118
25239
  if (!entry.isDirectory()) continue;
25119
- const path2 = (0, import_node_path57.join)(root, entry.name).replace(/\/$/, "");
25240
+ const path2 = (0, import_node_path58.join)(root, entry.name).replace(/\/$/, "");
25120
25241
  if (known.has(path2) || seen.has(path2)) continue;
25121
- if (!(0, import_node_fs56.existsSync)((0, import_node_path57.join)(path2, ".git"))) continue;
25242
+ if (!(0, import_node_fs56.existsSync)((0, import_node_path58.join)(path2, ".git"))) continue;
25122
25243
  seen.add(path2);
25123
25244
  let mtimeMs = 0;
25124
25245
  try {
@@ -25183,12 +25304,12 @@ function worktreeCleanupSettings() {
25183
25304
  autoCleanupOrphans: a.autoCleanupOrphans
25184
25305
  };
25185
25306
  }
25186
- var import_node_fs56, import_node_path57;
25307
+ var import_node_fs56, import_node_path58;
25187
25308
  var init_orphan_cleanup = __esm({
25188
25309
  "src/git/orphan-cleanup.ts"() {
25189
25310
  "use strict";
25190
25311
  import_node_fs56 = require("fs");
25191
- import_node_path57 = require("path");
25312
+ import_node_path58 = require("path");
25192
25313
  init_worktree();
25193
25314
  init_thread_store();
25194
25315
  init_paths();
@@ -25364,11 +25485,11 @@ async function cloneRepoIntoSideboard(opts) {
25364
25485
  if (!url) throw new Error("Clone URL is required");
25365
25486
  let name = opts.name?.trim();
25366
25487
  if (!name) {
25367
- const leaf = (0, import_node_path58.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
25488
+ const leaf = (0, import_node_path59.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
25368
25489
  name = leaf || "repo";
25369
25490
  }
25370
25491
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
25371
- const dest = (0, import_node_path58.join)(sideboardReposDir(), name);
25492
+ const dest = (0, import_node_path59.join)(sideboardReposDir(), name);
25372
25493
  if ((0, import_node_fs57.existsSync)(dest)) {
25373
25494
  const repoPath2 = await resolveRepoRoot(dest);
25374
25495
  const workspace2 = await addWorkspace(repoPath2);
@@ -25384,12 +25505,12 @@ async function cloneRepoIntoSideboard(opts) {
25384
25505
  const workspace = await addWorkspace(repoPath);
25385
25506
  return { repoPath, workspace };
25386
25507
  }
25387
- var import_node_fs57, import_node_path58, import_execa6;
25508
+ var import_node_fs57, import_node_path59, import_execa6;
25388
25509
  var init_clone_repo = __esm({
25389
25510
  "src/git/clone-repo.ts"() {
25390
25511
  "use strict";
25391
25512
  import_node_fs57 = require("fs");
25392
- import_node_path58 = require("path");
25513
+ import_node_path59 = require("path");
25393
25514
  import_execa6 = require("execa");
25394
25515
  init_paths();
25395
25516
  init_workspaces();
@@ -28153,7 +28274,7 @@ function stampOf(thread) {
28153
28274
  function repoLabel(thread) {
28154
28275
  if (isOrchestratorThread(thread)) return "Orchestration";
28155
28276
  const path2 = thread.repoPath?.trim() ?? "";
28156
- return path2 && (0, import_node_path59.basename)(path2) || path2 || "project";
28277
+ return path2 && (0, import_node_path60.basename)(path2) || path2 || "project";
28157
28278
  }
28158
28279
  function toAgent(thread, flags) {
28159
28280
  const prUrl = thread.prUrl?.trim();
@@ -28352,11 +28473,11 @@ function formatFleetArchive(view) {
28352
28473
  }
28353
28474
  return lines.join("\n");
28354
28475
  }
28355
- var import_node_path59, DEFAULT_LIMIT, MAX_LIMIT;
28476
+ var import_node_path60, DEFAULT_LIMIT, MAX_LIMIT;
28356
28477
  var init_fleet_archive = __esm({
28357
28478
  "src/archive/fleet-archive.ts"() {
28358
28479
  "use strict";
28359
- import_node_path59 = require("path");
28480
+ import_node_path60 = require("path");
28360
28481
  init_global_workspace();
28361
28482
  init_worktree_labels();
28362
28483
  DEFAULT_LIMIT = 40;
@@ -28856,7 +28977,7 @@ var init_quota_failover = __esm({
28856
28977
  // src/threads/adopt.ts
28857
28978
  function thisModuleFile2() {
28858
28979
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
28859
- return cjsFile || process.argv[1] || (0, import_node_path60.join)(process.cwd(), "package.json");
28980
+ return cjsFile || process.argv[1] || (0, import_node_path61.join)(process.cwd(), "package.json");
28860
28981
  }
28861
28982
  function openReadonlySqlite(file) {
28862
28983
  const req = (0, import_node_module6.createRequire)(thisModuleFile2());
@@ -28884,7 +29005,7 @@ function resolveConductorCursorAgentId(workspacePath) {
28884
29005
  return null;
28885
29006
  }
28886
29007
  for (const hash of hashes) {
28887
- const agentsFile = (0, import_node_path60.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
29008
+ const agentsFile = (0, import_node_path61.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
28888
29009
  if (!(0, import_node_fs60.existsSync)(agentsFile)) continue;
28889
29010
  let text7;
28890
29011
  try {
@@ -28944,8 +29065,8 @@ function listConductorWorkspaces() {
28944
29065
  if (!(0, import_node_fs60.existsSync)(CONDUCTOR_DB)) {
28945
29066
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
28946
29067
  }
28947
- const tmp = (0, import_node_fs60.mkdtempSync)((0, import_node_path60.join)((0, import_node_os19.tmpdir)(), "sideboard-conductor-"));
28948
- const snapshot = (0, import_node_path60.join)(tmp, "conductor.db");
29068
+ const tmp = (0, import_node_fs60.mkdtempSync)((0, import_node_path61.join)((0, import_node_os19.tmpdir)(), "sideboard-conductor-"));
29069
+ const snapshot = (0, import_node_path61.join)(tmp, "conductor.db");
28949
29070
  try {
28950
29071
  (0, import_node_fs60.copyFileSync)(CONDUCTOR_DB, snapshot);
28951
29072
  for (const suffix of ["-wal", "-shm"]) {
@@ -29035,8 +29156,8 @@ function importConductorWorkspace(workspaceId) {
29035
29156
  if (!(0, import_node_fs60.existsSync)(CONDUCTOR_DB)) {
29036
29157
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
29037
29158
  }
29038
- const tmp = (0, import_node_fs60.mkdtempSync)((0, import_node_path60.join)((0, import_node_os19.tmpdir)(), "sideboard-conductor-"));
29039
- const snapshot = (0, import_node_path60.join)(tmp, "conductor.db");
29159
+ const tmp = (0, import_node_fs60.mkdtempSync)((0, import_node_path61.join)((0, import_node_os19.tmpdir)(), "sideboard-conductor-"));
29160
+ const snapshot = (0, import_node_path61.join)(tmp, "conductor.db");
29040
29161
  try {
29041
29162
  (0, import_node_fs60.copyFileSync)(CONDUCTOR_DB, snapshot);
29042
29163
  for (const suffix of ["-wal", "-shm"]) {
@@ -29130,25 +29251,25 @@ function importConductorWorkspace(workspaceId) {
29130
29251
  async function importConductorWorkspaceAsync(workspaceId) {
29131
29252
  return importConductorWorkspace(workspaceId);
29132
29253
  }
29133
- var import_node_child_process7, import_node_fs60, import_node_os19, import_node_path60, import_node_module6, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
29254
+ var import_node_child_process7, import_node_fs60, import_node_os19, import_node_path61, import_node_module6, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
29134
29255
  var init_adopt = __esm({
29135
29256
  "src/threads/adopt.ts"() {
29136
29257
  "use strict";
29137
29258
  import_node_child_process7 = require("child_process");
29138
29259
  import_node_fs60 = require("fs");
29139
29260
  import_node_os19 = require("os");
29140
- import_node_path60 = require("path");
29261
+ import_node_path61 = require("path");
29141
29262
  import_node_module6 = require("module");
29142
29263
  init_worktree();
29143
29264
  init_thread_store();
29144
- CONDUCTOR_APP_SUPPORT = (0, import_node_path60.join)(
29265
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path61.join)(
29145
29266
  process.env.HOME ?? "",
29146
29267
  "Library",
29147
29268
  "Application Support",
29148
29269
  "com.conductor.app"
29149
29270
  );
29150
- CONDUCTOR_DB = (0, import_node_path60.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
29151
- CURSOR_SDK_STORE = (0, import_node_path60.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
29271
+ CONDUCTOR_DB = (0, import_node_path61.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
29272
+ CURSOR_SDK_STORE = (0, import_node_path61.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
29152
29273
  }
29153
29274
  });
29154
29275
 
@@ -29488,7 +29609,7 @@ async function formatPrCreateFailure(raw, cwd, ctx) {
29488
29609
  }
29489
29610
  async function createCursorPullRequest(worktreePath, slug, opts) {
29490
29611
  const bodyText = (opts.body ?? opts.title).trim() || opts.title;
29491
- const bodyFile = (0, import_node_path61.join)(
29612
+ const bodyFile = (0, import_node_path62.join)(
29492
29613
  (0, import_node_os20.tmpdir)(),
29493
29614
  `sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
29494
29615
  );
@@ -29530,7 +29651,7 @@ async function createOrUpdatePr(worktreePath, opts) {
29530
29651
  const headRef = ghHeadRef(slug, opts.head);
29531
29652
  const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
29532
29653
  const bodyText = clampGithubPrBody(opts.body ?? opts.title);
29533
- const bodyFile = (0, import_node_path61.join)(
29654
+ const bodyFile = (0, import_node_path62.join)(
29534
29655
  (0, import_node_os20.tmpdir)(),
29535
29656
  `sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
29536
29657
  );
@@ -29623,14 +29744,14 @@ async function createOrUpdatePrWithBodyFile(worktreePath, opts) {
29623
29744
  const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
29624
29745
  return url;
29625
29746
  }
29626
- var import_node_crypto20, import_node_fs62, import_node_os20, import_node_path61;
29747
+ var import_node_crypto20, import_node_fs62, import_node_os20, import_node_path62;
29627
29748
  var init_pr_write = __esm({
29628
29749
  "src/git/pr-write.ts"() {
29629
29750
  "use strict";
29630
29751
  import_node_crypto20 = require("crypto");
29631
29752
  import_node_fs62 = require("fs");
29632
29753
  import_node_os20 = require("os");
29633
- import_node_path61 = require("path");
29754
+ import_node_path62 = require("path");
29634
29755
  init_gh_errors();
29635
29756
  init_run();
29636
29757
  init_cursor_pr();
@@ -29782,7 +29903,7 @@ new file mode 100644
29782
29903
  };
29783
29904
  }
29784
29905
  async function untrackedPatch(worktreePath, path2, maxHunk) {
29785
- const abs = (0, import_node_path62.join)(worktreePath, path2);
29906
+ const abs = (0, import_node_path63.join)(worktreePath, path2);
29786
29907
  try {
29787
29908
  const st = (0, import_node_fs63.statSync)(abs);
29788
29909
  if (st.isFile() && st.size > maxHunk) {
@@ -30253,7 +30374,7 @@ async function getDiff(worktreePath, repoPath, opts) {
30253
30374
  }
30254
30375
  function statWorktreePath(worktreePath, relativePath) {
30255
30376
  assertSafeRelativePath(relativePath);
30256
- const abs = (0, import_node_path62.join)(worktreePath, relativePath);
30377
+ const abs = (0, import_node_path63.join)(worktreePath, relativePath);
30257
30378
  if (!(0, import_node_fs63.existsSync)(abs)) return "missing";
30258
30379
  const st = (0, import_node_fs63.statSync)(abs);
30259
30380
  if (st.isDirectory()) return "dir";
@@ -30284,7 +30405,7 @@ function isImageRelativePath(relativePath) {
30284
30405
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
30285
30406
  assertSafeRelativePath(relativePath);
30286
30407
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
30287
- const abs = (0, import_node_path62.join)(worktreePath, relativePath);
30408
+ const abs = (0, import_node_path63.join)(worktreePath, relativePath);
30288
30409
  const st = (0, import_node_fs63.statSync)(abs);
30289
30410
  if (!st.isFile()) {
30290
30411
  throw new Error(`Not a file: ${relativePath}`);
@@ -30304,7 +30425,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
30304
30425
  function readWorktreeFile(worktreePath, relativePath, opts) {
30305
30426
  assertSafeRelativePath(relativePath);
30306
30427
  const maxBytes = opts?.maxBytes ?? 2e5;
30307
- const abs = (0, import_node_path62.join)(worktreePath, relativePath);
30428
+ const abs = (0, import_node_path63.join)(worktreePath, relativePath);
30308
30429
  const st = (0, import_node_fs63.statSync)(abs);
30309
30430
  if (!st.isFile()) {
30310
30431
  throw new Error(`Not a file: ${relativePath}`);
@@ -30352,8 +30473,8 @@ function assertSafeRelativePath(relativePath) {
30352
30473
  }
30353
30474
  function writeWorktreeFile(worktreePath, relativePath, content) {
30354
30475
  assertSafeRelativePath(relativePath);
30355
- const abs = (0, import_node_path62.join)(worktreePath, relativePath);
30356
- (0, import_node_fs63.mkdirSync)((0, import_node_path62.dirname)(abs), { recursive: true });
30476
+ const abs = (0, import_node_path63.join)(worktreePath, relativePath);
30477
+ (0, import_node_fs63.mkdirSync)((0, import_node_path63.dirname)(abs), { recursive: true });
30357
30478
  (0, import_node_fs63.writeFileSync)(abs, content, "utf8");
30358
30479
  return { path: relativePath };
30359
30480
  }
@@ -30394,12 +30515,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
30394
30515
  truncated: full.files.length > maxFiles
30395
30516
  };
30396
30517
  }
30397
- var import_node_fs63, import_node_path62, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
30518
+ var import_node_fs63, import_node_path63, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
30398
30519
  var init_diff = __esm({
30399
30520
  "src/diff/diff.ts"() {
30400
30521
  "use strict";
30401
30522
  import_node_fs63 = require("fs");
30402
- import_node_path62 = require("path");
30523
+ import_node_path63 = require("path");
30403
30524
  init_run();
30404
30525
  init_worktree();
30405
30526
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -30622,7 +30743,7 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
30622
30743
  if (!relativePath || relativePath.includes("..") || relativePath.startsWith("/")) {
30623
30744
  throw new Error("Invalid path");
30624
30745
  }
30625
- const abs = (0, import_node_path63.join)(worktreePath, relativePath);
30746
+ const abs = (0, import_node_path64.join)(worktreePath, relativePath);
30626
30747
  const fd = (0, import_node_fs64.openSync)(abs, "r");
30627
30748
  try {
30628
30749
  const st = (0, import_node_fs64.fstatSync)(fd);
@@ -30652,12 +30773,12 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
30652
30773
  (0, import_node_fs64.closeSync)(fd);
30653
30774
  }
30654
30775
  }
30655
- var import_node_fs64, import_node_path63, WORKTREE_TAIL_BYTES;
30776
+ var import_node_fs64, import_node_path64, WORKTREE_TAIL_BYTES;
30656
30777
  var init_read_worktree_tail = __esm({
30657
30778
  "src/diff/read-worktree-tail.ts"() {
30658
30779
  "use strict";
30659
30780
  import_node_fs64 = require("fs");
30660
- import_node_path63 = require("path");
30781
+ import_node_path64 = require("path");
30661
30782
  WORKTREE_TAIL_BYTES = 2e5;
30662
30783
  }
30663
30784
  });
@@ -30834,7 +30955,7 @@ function scanSkillsDir(dir, source, out) {
30834
30955
  }
30835
30956
  for (const entry of entries) {
30836
30957
  if (entry.startsWith(".")) continue;
30837
- const skillMd = (0, import_node_path64.join)(dir, entry, "SKILL.md");
30958
+ const skillMd = (0, import_node_path65.join)(dir, entry, "SKILL.md");
30838
30959
  if (!(0, import_node_fs65.existsSync)(skillMd)) continue;
30839
30960
  try {
30840
30961
  if (!(0, import_node_fs65.statSync)(skillMd).isFile()) continue;
@@ -30856,12 +30977,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
30856
30977
  return;
30857
30978
  }
30858
30979
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
30859
- const skill = readSkill((0, import_node_path64.join)(dir, "SKILL.md"), "cli");
30980
+ const skill = readSkill((0, import_node_path65.join)(dir, "SKILL.md"), "cli");
30860
30981
  if (skill) out.push(skill);
30861
30982
  }
30862
30983
  for (const entry of entries) {
30863
30984
  if (entry === "node_modules" || entry === ".git") continue;
30864
- const full = (0, import_node_path64.join)(dir, entry);
30985
+ const full = (0, import_node_path65.join)(dir, entry);
30865
30986
  try {
30866
30987
  if (!(0, import_node_fs65.statSync)(full).isDirectory()) continue;
30867
30988
  } catch {
@@ -30881,17 +31002,17 @@ function discoverSkills(worktreePath) {
30881
31002
  const home = (0, import_node_os21.homedir)();
30882
31003
  const collected = [];
30883
31004
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
30884
- scanSkillsDir((0, import_node_path64.join)(worktreePath, rel), "workspace", collected);
31005
+ scanSkillsDir((0, import_node_path65.join)(worktreePath, rel), "workspace", collected);
30885
31006
  }
30886
31007
  for (const abs of [
30887
- (0, import_node_path64.join)(home, ".claude/skills"),
30888
- (0, import_node_path64.join)(home, ".cursor/skills"),
30889
- (0, import_node_path64.join)(home, ".sideboard/skills"),
30890
- (0, import_node_path64.join)(home, ".brightsy/skills")
31008
+ (0, import_node_path65.join)(home, ".claude/skills"),
31009
+ (0, import_node_path65.join)(home, ".cursor/skills"),
31010
+ (0, import_node_path65.join)(home, ".sideboard/skills"),
31011
+ (0, import_node_path65.join)(home, ".brightsy/skills")
30891
31012
  ]) {
30892
31013
  scanSkillsDir(abs, "user", collected);
30893
31014
  }
30894
- scanClaudePluginSkills((0, import_node_path64.join)(home, ".claude/plugins"), collected);
31015
+ scanClaudePluginSkills((0, import_node_path65.join)(home, ".claude/plugins"), collected);
30895
31016
  collected.push(...bundledSkills());
30896
31017
  const rank = {
30897
31018
  workspace: 0,
@@ -30931,13 +31052,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
30931
31052
 
30932
31053
  \u2026(truncated)` : raw;
30933
31054
  }
30934
- var import_node_fs65, import_node_os21, import_node_path64, BUNDLED_SKILL_PREFIX;
31055
+ var import_node_fs65, import_node_os21, import_node_path65, BUNDLED_SKILL_PREFIX;
30935
31056
  var init_discover = __esm({
30936
31057
  "src/skills/discover.ts"() {
30937
31058
  "use strict";
30938
31059
  import_node_fs65 = require("fs");
30939
31060
  import_node_os21 = require("os");
30940
- import_node_path64 = require("path");
31061
+ import_node_path65 = require("path");
30941
31062
  init_long_running();
30942
31063
  BUNDLED_SKILL_PREFIX = "bundled:";
30943
31064
  }
@@ -31302,7 +31423,7 @@ function compiledModuleDir() {
31302
31423
  try {
31303
31424
  const url = import_meta8.url;
31304
31425
  if (typeof url === "string" && url.length > 0) {
31305
- return (0, import_node_path65.dirname)((0, import_node_url6.fileURLToPath)(url));
31426
+ return (0, import_node_path66.dirname)((0, import_node_url6.fileURLToPath)(url));
31306
31427
  }
31307
31428
  } catch {
31308
31429
  }
@@ -31310,7 +31431,7 @@ function compiledModuleDir() {
31310
31431
  }
31311
31432
  function detachedJobScriptIn(dir) {
31312
31433
  for (const name of DETACHED_JOB_FILENAMES) {
31313
- const script = (0, import_node_path65.join)(dir, "scripts", name);
31434
+ const script = (0, import_node_path66.join)(dir, "scripts", name);
31314
31435
  if ((0, import_node_fs66.existsSync)(script)) return script;
31315
31436
  }
31316
31437
  return null;
@@ -31328,7 +31449,7 @@ function resolveDetachedJobScript() {
31328
31449
  for (let i = 0; i < 8; i++) {
31329
31450
  const candidate = detachedJobScriptIn(dir);
31330
31451
  if (candidate) return candidate;
31331
- const parent = (0, import_node_path65.dirname)(dir);
31452
+ const parent = (0, import_node_path66.dirname)(dir);
31332
31453
  if (parent === dir) break;
31333
31454
  dir = parent;
31334
31455
  }
@@ -31339,12 +31460,12 @@ function formatDetachedJobInvoke(scriptPath) {
31339
31460
  if (resolved) return `node ${JSON.stringify(resolved)}`;
31340
31461
  return "node scripts/detached-job.cjs";
31341
31462
  }
31342
- var import_node_fs66, import_node_path65, import_node_url6, import_meta8, DETACHED_JOB_FILENAMES;
31463
+ var import_node_fs66, import_node_path66, import_node_url6, import_meta8, DETACHED_JOB_FILENAMES;
31343
31464
  var init_detached_job_path = __esm({
31344
31465
  "src/skills/detached-job-path.ts"() {
31345
31466
  "use strict";
31346
31467
  import_node_fs66 = require("fs");
31347
- import_node_path65 = require("path");
31468
+ import_node_path66 = require("path");
31348
31469
  import_node_url6 = require("url");
31349
31470
  init_packaged_runtime();
31350
31471
  import_meta8 = {};
@@ -31595,14 +31716,14 @@ function formatPrGateDirective() {
31595
31716
  "If a goal is given (not after every push):",
31596
31717
  "- Enter a watch-fix-push loop and stay in it until that goal is met or you are blocked (examples: \u201CGreptile 5/5\u201D, \u201CCI green\u201D, \u201Cuntil checks pass\u201D). Do not stop after one red run or one review cycle.",
31597
31718
  "- Wait with `/long-running`: detach `gh pr checks --watch` (add `-R <origin>` when needed), then loop `wait_for_job` until stillRunning is false. Do not end the turn \u2014 a native CLI Task or bash notify does not resume this chat. Do not ask the human to poll.",
31598
- "- Greptile 5/5: wait for the greptile check; read the latest `N/5` from the PR body or Greptile\u2019s most recently *updated* issue comment; also fetch unresolved review comments / the \u201CPrompt to fix all with AI\u201D block. Done = **5/5 and zero unresolved Greptile comments**. If Greptile is idle, comment `@greptile review`. Cap about 5 iterations, then report leftovers. Do not merge unless asked."
31719
+ "- A commit or push can start or refresh a third-party PR review (Greptile, CodeRabbit, Bugbot, Copilot, or another bot on the PR). Read that reviewer\u2019s latest comment and unresolved threads, including any score or fix-it block they posted. Acknowledge it: make the requested changes, push, and wait for the refreshed review. Done = the goal the user named, with that reviewer\u2019s unresolved comments addressed. Do not invent a vendor trigger. Cap about 5 iterations, then report leftovers. Do not merge unless asked."
31599
31720
  ].join("\n");
31600
31721
  }
31601
31722
  function formatProcessGuideDirective(opts) {
31602
31723
  const worktree = opts?.worktreePath?.trim();
31603
- const hasGraphSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
31604
- const hasReviewSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/review/SKILL.md"));
31605
- const hasInstallSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
31724
+ const hasGraphSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path67.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
31725
+ const hasReviewSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path67.join)(worktree, ".claude/skills/review/SKILL.md"));
31726
+ const hasInstallSkill = !!worktree && (0, import_node_fs67.existsSync)((0, import_node_path67.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
31606
31727
  return [
31607
31728
  "Process guides (recurring work only):",
31608
31729
  hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
@@ -31642,12 +31763,12 @@ function formatArtifactDirective() {
31642
31763
  function formatUiReminder() {
31643
31764
  return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). Chat links: `[name](sideboard://artifact/<id-or-title>)` opens that pane; `[name](sideboard://file/path#L12-L40)` opens a file. ask_user only for a real multiple-choice (not hellos, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. ask_user wakes the parent orchestrator; notify_orchestrator if blocked without a picker. Do not say artifacts/CMS UI are unavailable. Dev / preview: run_dev_script (same as the Dev button; pass name \u2014 several scripts can run at once) returns {url, port, preview} (SIDEBOARD_PORT \u2014 never guess :3000). preview=url \u2192 open url; preview=window \u2192 Electron window is the app, url is renderer/HMR only. list_run_scripts active[].url if already running; get_run_log for that script\u2019s Run-tab terminal; stop_dev_script to stop one.";
31644
31765
  }
31645
- var import_node_fs67, import_node_path66, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
31766
+ var import_node_fs67, import_node_path67, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
31646
31767
  var init_instructions = __esm({
31647
31768
  "src/agents/instructions.ts"() {
31648
31769
  "use strict";
31649
31770
  import_node_fs67 = require("fs");
31650
- import_node_path66 = require("path");
31771
+ import_node_path67 = require("path");
31651
31772
  init_git_auth_mode();
31652
31773
  init_forge_git_directives();
31653
31774
  init_branch_prefix();
@@ -32457,13 +32578,13 @@ __export(plan_file_exports, {
32457
32578
  writePlanFile: () => writePlanFile
32458
32579
  });
32459
32580
  function ensureAttachmentsGitignore(worktreePath) {
32460
- const gitignoreAbs = (0, import_node_path67.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
32581
+ const gitignoreAbs = (0, import_node_path68.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
32461
32582
  if ((0, import_node_fs68.existsSync)(gitignoreAbs)) return;
32462
- (0, import_node_fs68.mkdirSync)((0, import_node_path67.dirname)(gitignoreAbs), { recursive: true });
32583
+ (0, import_node_fs68.mkdirSync)((0, import_node_path68.dirname)(gitignoreAbs), { recursive: true });
32463
32584
  (0, import_node_fs68.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
32464
32585
  }
32465
32586
  function planFileAbs(worktreePath) {
32466
- return (0, import_node_path67.join)(worktreePath, PLAN_FILE_REL);
32587
+ return (0, import_node_path68.join)(worktreePath, PLAN_FILE_REL);
32467
32588
  }
32468
32589
  function readTextIfPresent2(abs) {
32469
32590
  if (!(0, import_node_fs68.existsSync)(abs)) return null;
@@ -32475,22 +32596,22 @@ function readTextIfPresent2(abs) {
32475
32596
  }
32476
32597
  }
32477
32598
  function readPlanFile(worktreePath) {
32478
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path67.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path67.join)(worktreePath, LEGACY_PLAN_FILE_REL));
32599
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path68.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path68.join)(worktreePath, LEGACY_PLAN_FILE_REL));
32479
32600
  }
32480
32601
  function writePlanFile(worktreePath, content) {
32481
32602
  ensureAttachmentsGitignore(worktreePath);
32482
32603
  const abs = planFileAbs(worktreePath);
32483
- (0, import_node_fs68.mkdirSync)((0, import_node_path67.dirname)(abs), { recursive: true });
32604
+ (0, import_node_fs68.mkdirSync)((0, import_node_path68.dirname)(abs), { recursive: true });
32484
32605
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
32485
32606
  (0, import_node_fs68.writeFileSync)(abs, body, "utf8");
32486
32607
  return PLAN_FILE_REL;
32487
32608
  }
32488
- var import_node_fs68, import_node_path67;
32609
+ var import_node_fs68, import_node_path68;
32489
32610
  var init_plan_file = __esm({
32490
32611
  "src/plan/plan-file.ts"() {
32491
32612
  "use strict";
32492
32613
  import_node_fs68 = require("fs");
32493
- import_node_path67 = require("path");
32614
+ import_node_path68 = require("path");
32494
32615
  init_workspace_scratch();
32495
32616
  init_plan_present();
32496
32617
  init_plan_present();
@@ -36221,6 +36342,7 @@ __export(index_exports, {
36221
36342
  healOrchestrationSoccerTitles: () => healOrchestrationSoccerTitles,
36222
36343
  historyMaxCount: () => historyMaxCount,
36223
36344
  historyMaxDays: () => historyMaxDays,
36345
+ hostKeepsMacAwake: () => hostKeepsMacAwake,
36224
36346
  hottestClaudeWindow: () => hottestClaudeWindow,
36225
36347
  httpFetch: () => httpFetch,
36226
36348
  importAgentDoneCustomSound: () => importAgentDoneCustomSound,
@@ -37257,6 +37379,15 @@ init_run_log();
37257
37379
  init_schedules();
37258
37380
  init_schedule_runner();
37259
37381
 
37382
+ // src/host/awake.ts
37383
+ function hostKeepsMacAwake(input) {
37384
+ if (input.phoneConnected) return true;
37385
+ if (input.caffeinateWhilePhoneRemote && input.phoneRemoteArmed) return true;
37386
+ if (input.caffeinateWhileRunning && input.agentsRunning > 0) return true;
37387
+ if (input.caffeinateWhileSchedules && input.schedulesEnabled) return true;
37388
+ return false;
37389
+ }
37390
+
37260
37391
  // src/host/serve.ts
37261
37392
  var import_node_child_process8 = require("child_process");
37262
37393
  var import_node_os22 = require("os");
@@ -38923,7 +39054,7 @@ init_turn_live();
38923
39054
 
38924
39055
  // src/remote/phone-media.ts
38925
39056
  var import_node_fs71 = require("fs");
38926
- var import_node_path68 = require("path");
39057
+ var import_node_path69 = require("path");
38927
39058
  init_diff();
38928
39059
  var PHONE_IMAGE_MAX_BYTES = 15e5;
38929
39060
  var PHONE_TEXT_MAX_BYTES = 18e4;
@@ -38976,7 +39107,7 @@ function phoneImageDataUrl(worktreePath, raw) {
38976
39107
  }
38977
39108
  function phoneDirectoryListing(worktreePath, relative2) {
38978
39109
  try {
38979
- const entries = (0, import_node_fs71.readdirSync)((0, import_node_path68.join)(worktreePath, relative2), { withFileTypes: true });
39110
+ const entries = (0, import_node_fs71.readdirSync)((0, import_node_path69.join)(worktreePath, relative2), { withFileTypes: true });
38980
39111
  const dirs = new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
38981
39112
  const names = entries.map((entry) => entry.name).filter((name) => name && !name.includes("/") && !name.includes("\0")).sort((a, b) => a.localeCompare(b));
38982
39113
  const shown = names.slice(0, PHONE_DIR_MAX);
@@ -39002,7 +39133,7 @@ function phoneFilePreview(worktreePath, relative2, kind) {
39002
39133
  }
39003
39134
  if (relative2.toLowerCase().endsWith(".svg")) {
39004
39135
  try {
39005
- const buf = (0, import_node_fs71.readFileSync)((0, import_node_path68.join)(worktreePath, relative2));
39136
+ const buf = (0, import_node_fs71.readFileSync)((0, import_node_path69.join)(worktreePath, relative2));
39006
39137
  const truncated = buf.length > PHONE_TEXT_MAX_BYTES;
39007
39138
  return {
39008
39139
  content: buf.subarray(0, PHONE_TEXT_MAX_BYTES).toString("utf8"),
@@ -40511,7 +40642,7 @@ function handleRemoteInbound(text7, opts) {
40511
40642
  }
40512
40643
 
40513
40644
  // src/remote/phone-board-sync.ts
40514
- var import_node_path69 = require("path");
40645
+ var import_node_path70 = require("path");
40515
40646
  var import_chokidar = require("chokidar");
40516
40647
  init_orchestrator();
40517
40648
  init_paths();
@@ -40564,7 +40695,7 @@ function subscribePhoneBoard(notify) {
40564
40695
  threads.on("error", () => void 0);
40565
40696
  const data = (0, import_chokidar.watch)(appDataDir(), { ignoreInitial: true, depth: 0 });
40566
40697
  const onData = (changed) => {
40567
- const name = (0, import_node_path69.basename)(changed);
40698
+ const name = (0, import_node_path70.basename)(changed);
40568
40699
  if (name !== "workspaces.json" && name !== "removed-workspaces.json" && name !== "settings.json") return;
40569
40700
  notify();
40570
40701
  };
@@ -41813,7 +41944,7 @@ var SlackRelayHub = class {
41813
41944
  // src/relay/static.ts
41814
41945
  var import_node_fs72 = require("fs");
41815
41946
  var import_promises = require("fs/promises");
41816
- var import_node_path70 = __toESM(require("path"), 1);
41947
+ var import_node_path71 = __toESM(require("path"), 1);
41817
41948
  var TYPES = {
41818
41949
  ".css": "text/css; charset=utf-8",
41819
41950
  ".html": "text/html; charset=utf-8",
@@ -41844,9 +41975,9 @@ function resolveStaticPath(root, requestUrl) {
41844
41975
  return null;
41845
41976
  }
41846
41977
  if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
41847
- const rootResolved = import_node_path70.default.resolve(root);
41848
- const candidate = import_node_path70.default.resolve(rootResolved, `.${pathname}`);
41849
- if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path70.default.sep)) {
41978
+ const rootResolved = import_node_path71.default.resolve(root);
41979
+ const candidate = import_node_path71.default.resolve(rootResolved, `.${pathname}`);
41980
+ if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path71.default.sep)) {
41850
41981
  return null;
41851
41982
  }
41852
41983
  return candidate;
@@ -41860,7 +41991,7 @@ async function fileSize(file) {
41860
41991
  }
41861
41992
  }
41862
41993
  function sendFile(req, res, file, size) {
41863
- const ext = import_node_path70.default.extname(file).toLowerCase();
41994
+ const ext = import_node_path71.default.extname(file).toLowerCase();
41864
41995
  res.writeHead(200, {
41865
41996
  "Content-Type": TYPES[ext] ?? "application/octet-stream",
41866
41997
  "Content-Length": size,
@@ -41879,7 +42010,7 @@ async function tryServeStatic(req, res, root) {
41879
42010
  if (!candidate) return false;
41880
42011
  const direct = await fileSize(candidate);
41881
42012
  if (direct != null) return sendFile(req, res, candidate, direct);
41882
- const asIndex = import_node_path70.default.join(candidate, "index.html");
42013
+ const asIndex = import_node_path71.default.join(candidate, "index.html");
41883
42014
  const indexSize = await fileSize(asIndex);
41884
42015
  if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
41885
42016
  return false;
@@ -42224,13 +42355,13 @@ init_protocol();
42224
42355
  var import_node_crypto25 = require("crypto");
42225
42356
  var import_node_fs73 = require("fs");
42226
42357
  var import_node_module7 = require("module");
42227
- var import_node_path71 = require("path");
42358
+ var import_node_path72 = require("path");
42228
42359
  var GITHUB_ACCOUNT_ISSUER = "https://github.com";
42229
42360
  var CURSOR_ACCOUNT_ISSUER = "https://api.cursor.com/v1/origin";
42230
42361
  var RELAY_DEVICE_CAP = 3;
42231
42362
  function thisModuleFile3() {
42232
42363
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
42233
- return cjsFile || process.argv[1] || (0, import_node_path71.join)(process.cwd(), "package.json");
42364
+ return cjsFile || process.argv[1] || (0, import_node_path72.join)(process.cwd(), "package.json");
42234
42365
  }
42235
42366
  function openDatabase(filePath) {
42236
42367
  const req = (0, import_node_module7.createRequire)(thisModuleFile3());
@@ -42267,7 +42398,7 @@ function assertRelayAccountsDurable(filePath) {
42267
42398
  if (process.env.SIDEBOARD_RELAY_ACCOUNTS_EPHEMERAL === "1") return;
42268
42399
  if (process.env.NODE_ENV !== "production") return;
42269
42400
  if (process.platform !== "linux") return;
42270
- const dir = (0, import_node_fs73.realpathSync)((0, import_node_path71.dirname)(filePath));
42401
+ const dir = (0, import_node_fs73.realpathSync)((0, import_node_path72.dirname)(filePath));
42271
42402
  const mounts = (0, import_node_fs73.readFileSync)("/proc/mounts", "utf8");
42272
42403
  const point = longestMountPoint(dir, mounts);
42273
42404
  if (point === "/") {
@@ -42279,7 +42410,7 @@ function assertRelayAccountsDurable(filePath) {
42279
42410
  var RelayAccountStore = class {
42280
42411
  db;
42281
42412
  constructor(filePath) {
42282
- (0, import_node_fs73.mkdirSync)((0, import_node_path71.dirname)(filePath), { recursive: true });
42413
+ (0, import_node_fs73.mkdirSync)((0, import_node_path72.dirname)(filePath), { recursive: true });
42283
42414
  this.db = openDatabase(filePath);
42284
42415
  this.db.exec(`
42285
42416
  CREATE TABLE IF NOT EXISTS accounts (
@@ -43449,7 +43580,15 @@ async function startHeadlessHost(opts) {
43449
43580
  }
43450
43581
  };
43451
43582
  const refreshAwake = () => {
43452
- const keep = caffeinateWhileSchedulesEnabled() && hasEnabledSchedules() || caffeinateWhileSlackListenEnabled() && phoneConnected || caffeinateWhileRunningEnabled() && agentsRunning > 0;
43583
+ const keep = hostKeepsMacAwake({
43584
+ phoneConnected,
43585
+ phoneRemoteArmed: true,
43586
+ caffeinateWhilePhoneRemote: caffeinateWhileSlackListenEnabled(),
43587
+ agentsRunning,
43588
+ caffeinateWhileRunning: caffeinateWhileRunningEnabled(),
43589
+ schedulesEnabled: hasEnabledSchedules(),
43590
+ caffeinateWhileSchedules: caffeinateWhileSchedulesEnabled()
43591
+ });
43453
43592
  if (keep && !caffeinate && process.platform === "darwin") {
43454
43593
  try {
43455
43594
  caffeinate = (0, import_node_child_process8.spawn)("caffeinate", ["-dimsu"], { stdio: "ignore" });
@@ -43845,20 +43984,20 @@ init_cursor_stream_cutoff();
43845
43984
 
43846
43985
  // src/agents/tool-result-clip.ts
43847
43986
  var import_node_fs74 = require("fs");
43848
- var import_node_path72 = require("path");
43987
+ var import_node_path73 = require("path");
43849
43988
  init_workspace_scratch();
43850
43989
  init_error_detail();
43851
43990
  function spillPath(cwd, prefix) {
43852
43991
  const stamp = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
43853
43992
  const safe = prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 40) || "tool";
43854
- return (0, import_node_path72.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
43993
+ return (0, import_node_path73.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
43855
43994
  }
43856
43995
  function spillToolResultToCli(content, opts) {
43857
43996
  const cwd = opts?.cwd?.trim();
43858
43997
  if (!cwd || !content) return null;
43859
43998
  const file = spillPath(cwd, opts?.prefix ?? "tool-result");
43860
43999
  try {
43861
- (0, import_node_fs74.mkdirSync)((0, import_node_path72.join)(cwd, CLI_DIR), { recursive: true });
44000
+ (0, import_node_fs74.mkdirSync)((0, import_node_path73.join)(cwd, CLI_DIR), { recursive: true });
43862
44001
  (0, import_node_fs74.writeFileSync)(file, content, "utf8");
43863
44002
  return file;
43864
44003
  } catch {
@@ -43946,7 +44085,7 @@ function createClippedMcpServer() {
43946
44085
  // src/mcp/server.ts
43947
44086
  var import_zod11 = require("zod");
43948
44087
  var import_node_crypto31 = require("crypto");
43949
- var import_node_path76 = require("path");
44088
+ var import_node_path77 = require("path");
43950
44089
  init_orchestrator();
43951
44090
  init_task_state();
43952
44091
  init_worktree();
@@ -45628,7 +45767,7 @@ function registerScheduleTools(server) {
45628
45767
 
45629
45768
  // src/agent-rpc/handlers.ts
45630
45769
  var import_node_crypto29 = require("crypto");
45631
- var import_node_path73 = require("path");
45770
+ var import_node_path74 = require("path");
45632
45771
  init_wait_for_job();
45633
45772
  init_wait_for_turn();
45634
45773
 
@@ -45735,7 +45874,7 @@ function invalidParams2(message) {
45735
45874
  function jobCwd(rec) {
45736
45875
  const raw = str7(rec.cwd).trim();
45737
45876
  if (!raw) throw invalidParams2("cwd is required");
45738
- if (!(0, import_node_path73.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
45877
+ if (!(0, import_node_path74.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
45739
45878
  return raw;
45740
45879
  }
45741
45880
  async function handleRuntimePing(_params, _ctx) {
@@ -45869,20 +46008,20 @@ init_git_auth_mode();
45869
46008
 
45870
46009
  // src/board/load-home-board.ts
45871
46010
  var import_node_fs76 = require("fs");
45872
- var import_node_path75 = require("path");
46011
+ var import_node_path76 = require("path");
45873
46012
  init_worktree();
45874
46013
  init_paths();
45875
46014
 
45876
46015
  // src/board/board-pins.ts
45877
46016
  var import_node_crypto30 = require("crypto");
45878
46017
  var import_node_fs75 = require("fs");
45879
- var import_node_path74 = require("path");
46018
+ var import_node_path75 = require("path");
45880
46019
  init_paths();
45881
46020
  init_home_board();
45882
46021
  var FILE = "home-board-pins.json";
45883
46022
  var VERSION = 1;
45884
46023
  function pinsFile() {
45885
- return (0, import_node_path74.join)(appDataDir(), FILE);
46024
+ return (0, import_node_path75.join)(appDataDir(), FILE);
45886
46025
  }
45887
46026
  function readDisk() {
45888
46027
  const path2 = pinsFile();
@@ -45966,7 +46105,7 @@ function homeBoardWorkspaceKey(workspaces) {
45966
46105
  return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
45967
46106
  }
45968
46107
  function cacheFile() {
45969
- return (0, import_node_path75.join)(appDataDir(), "home-board-cache.json");
46108
+ return (0, import_node_path76.join)(appDataDir(), "home-board-cache.json");
45970
46109
  }
45971
46110
  function emptyInputs() {
45972
46111
  return {
@@ -46231,7 +46370,7 @@ async function startMcpServer() {
46231
46370
  async () => {
46232
46371
  const threads = orch.getThreads();
46233
46372
  const lines = threads.map((t) => {
46234
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path76.basename)(t.repoPath) || t.repoPath;
46373
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path77.basename)(t.repoPath) || t.repoPath;
46235
46374
  const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
46236
46375
  const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
46237
46376
  const preview = lastMessagePreview(t.messages, 80);
@@ -46718,7 +46857,7 @@ async function startMcpServer() {
46718
46857
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
46719
46858
  server.tool(
46720
46859
  "set_caffeinate",
46721
- "Keep this Mac awake with caffeinate (like Claude Code) across turns \u2014 independent of Settings toggles. Turn ON when the user will be away from the keyboard, is driving work from Slack, or asks you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
46860
+ "Keep this Mac awake with caffeinate across turns \u2014 independent of Settings toggles. A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn ON when the user will be away and no phone is connected, or they ask you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
46722
46861
  {
46723
46862
  enabled: import_zod11.z.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
46724
46863
  },
@@ -47036,7 +47175,7 @@ async function startMcpServer() {
47036
47175
  );
47037
47176
  server.tool(
47038
47177
  "ask_git",
47039
- "Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (Greptile 5/5, CI green). Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
47178
+ "Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (CI green, a review score, until checks pass). A push can wake a third-party PR review; the worktree agent acknowledges it only inside that goal. Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
47040
47179
  {
47041
47180
  ref: import_zod11.z.string().describe("Worktree thread id/ref"),
47042
47181
  action: import_zod11.z.enum(AGENT_GIT_ACTIONS).describe(
@@ -48245,11 +48384,11 @@ init_model_context();
48245
48384
  init_meta();
48246
48385
 
48247
48386
  // src/slack/workspaces.ts
48248
- var import_node_path77 = require("path");
48387
+ var import_node_path78 = require("path");
48249
48388
  init_paths();
48250
48389
  init_secure_file();
48251
48390
  function storePath2() {
48252
- return (0, import_node_path77.join)(appDataDir(), "slack-workspaces.json");
48391
+ return (0, import_node_path78.join)(appDataDir(), "slack-workspaces.json");
48253
48392
  }
48254
48393
  function readStore2() {
48255
48394
  try {
@@ -48497,12 +48636,12 @@ init_thread_store();
48497
48636
 
48498
48637
  // src/slack/reply-target.ts
48499
48638
  var import_node_fs77 = require("fs");
48500
- var import_node_path78 = require("path");
48639
+ var import_node_path79 = require("path");
48501
48640
  init_paths();
48502
48641
  init_private_file();
48503
48642
  init_secure_file();
48504
48643
  function storePath3() {
48505
- return (0, import_node_path78.join)(appDataDir(), "slack-reply-to.json");
48644
+ return (0, import_node_path79.join)(appDataDir(), "slack-reply-to.json");
48506
48645
  }
48507
48646
  function readStore3() {
48508
48647
  const path2 = storePath3();
@@ -49474,7 +49613,7 @@ async function disconnectRemoteAccount(opts) {
49474
49613
 
49475
49614
  // src/slack/outbound-watch.ts
49476
49615
  var import_node_fs78 = require("fs");
49477
- var import_node_path79 = require("path");
49616
+ var import_node_path80 = require("path");
49478
49617
  init_paths();
49479
49618
  init_private_file();
49480
49619
  init_secure_file();
@@ -49487,7 +49626,7 @@ var POLL_INTERVAL_MS = 12e3;
49487
49626
  var lastPollMs = 0;
49488
49627
  var nameCache = /* @__PURE__ */ new Map();
49489
49628
  function storePath4() {
49490
- return (0, import_node_path79.join)(appDataDir(), "slack-outbound-watch.json");
49629
+ return (0, import_node_path80.join)(appDataDir(), "slack-outbound-watch.json");
49491
49630
  }
49492
49631
  function watchId(teamId, channelId, ts) {
49493
49632
  return `${teamId}:${channelId}:${ts}`;
@@ -50370,6 +50509,7 @@ async function pollSlackOutboundWatches(opts) {
50370
50509
  healOrchestrationSoccerTitles,
50371
50510
  historyMaxCount,
50372
50511
  historyMaxDays,
50512
+ hostKeepsMacAwake,
50373
50513
  hottestClaudeWindow,
50374
50514
  httpFetch,
50375
50515
  importAgentDoneCustomSound,