@sideboard-ai/core 0.1.332 → 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 (27) hide show
  1. package/dist/{agents-5FB756FF.js → agents-5NJ3FROS.js} +2 -2
  2. package/dist/{agents-XEVZ6RY2.js → agents-SRM6OVML.js} +2 -2
  3. package/dist/{chunk-KYHW5WYT.js → chunk-4J7R2BFU.js} +22 -9
  4. package/dist/{chunk-UEPTL7UG.js → chunk-6RUSADA7.js} +3 -3
  5. package/dist/{chunk-EHZ24J7U.js → chunk-ELDJBZ52.js} +2 -2
  6. package/dist/{chunk-5MJ7FCZ2.js → chunk-LEUAYFSG.js} +3 -3
  7. package/dist/{chunk-E5DFGOAA.js → chunk-QKJC725N.js} +21 -8
  8. package/dist/{chunk-5G5DTQ5N.js → chunk-RJT6JPNX.js} +2 -2
  9. package/dist/{chunk-3MOUHIA2.js → chunk-TLL2K2MY.js} +2 -2
  10. package/dist/{chunk-6HGTYZGL.js → chunk-WXOJSFGO.js} +2 -2
  11. package/dist/{conductor-5OTVFON5.js → conductor-LUPB6RBH.js} +2 -2
  12. package/dist/{conductor-CVQJEAKE.js → conductor-XSP3SOS2.js} +2 -2
  13. package/dist/{coordinator-prompt-OD6VYETQ.js → coordinator-prompt-EJJNJ5K7.js} +1 -1
  14. package/dist/{coordinator-prompt-XU5KFYI5.js → coordinator-prompt-O75QUEHP.js} +1 -1
  15. package/dist/{global-workspace-P2BW6MJ3.js → global-workspace-3IG44NAT.js} +1 -1
  16. package/dist/{global-workspace-EW54B2P4.js → global-workspace-Q4OURN7M.js} +1 -1
  17. package/dist/index.cjs +40 -8
  18. package/dist/index.d.cts +23 -3
  19. package/dist/index.d.ts +23 -3
  20. package/dist/index.js +28 -10
  21. package/dist/mcp/run-stdio.cjs +20 -7
  22. package/dist/mcp/run-stdio.js +6 -6
  23. package/dist/{orchestrator-5X62LJ2T.js → orchestrator-IYXIWNB5.js} +4 -4
  24. package/dist/{orchestrator-UKAXA5ZW.js → orchestrator-WHXHBNRS.js} +4 -4
  25. package/dist/{workspaces-OY7JIPDE.js → workspaces-ALUHOCWK.js} +1 -1
  26. package/dist/{workspaces-CB4SCKVH.js → workspaces-QGKSXA76.js} +1 -1
  27. package/package.json +1 -1
@@ -37,7 +37,7 @@ import {
37
37
  planModeTurnInstruction,
38
38
  resolveCursorModelId,
39
39
  resolveQuotaFallbackAgent
40
- } from "./chunk-3MOUHIA2.js";
40
+ } from "./chunk-TLL2K2MY.js";
41
41
  import {
42
42
  getAgentSetupInfo,
43
43
  installAgent,
@@ -53,7 +53,7 @@ import {
53
53
  import "./chunk-XOEKCE6L.js";
54
54
  import "./chunk-ZT5YPYZE.js";
55
55
  import "./chunk-OOXRMTU6.js";
56
- import "./chunk-5MJ7FCZ2.js";
56
+ import "./chunk-LEUAYFSG.js";
57
57
  import "./chunk-JJRTVB7D.js";
58
58
  import "./chunk-QVLDZWHZ.js";
59
59
  import "./chunk-BMRJNRQK.js";
@@ -46,7 +46,7 @@ import {
46
46
  resolveCursorSdkRoot,
47
47
  resolveQuotaFallbackAgent,
48
48
  turnCostUsdFromCursorUsage
49
- } from "./chunk-6HGTYZGL.js";
49
+ } from "./chunk-WXOJSFGO.js";
50
50
  import "./chunk-5MXLDDYF.js";
51
51
  import {
52
52
  getAgentSetupInfo,
@@ -60,7 +60,7 @@ import {
60
60
  resolveLoginCommand,
61
61
  whichOnPath
62
62
  } from "./chunk-CS6LQUL6.js";
63
- import "./chunk-UEPTL7UG.js";
63
+ import "./chunk-6RUSADA7.js";
64
64
  import "./chunk-P7S3XGKL.js";
65
65
  import "./chunk-I6RGRUNY.js";
66
66
  import "./chunk-E63AM3PW.js";
@@ -21,7 +21,7 @@ import {
21
21
  parseSessionQuotaResetAt,
22
22
  planModeTurnInstruction,
23
23
  resolveQuotaFallbackAgent
24
- } from "./chunk-3MOUHIA2.js";
24
+ } from "./chunk-TLL2K2MY.js";
25
25
  import {
26
26
  applyWorktreePkgCacheEnv,
27
27
  buildBrightsySessionSeed,
@@ -55,7 +55,7 @@ import {
55
55
  worktreeDevProcessKey,
56
56
  worktreeRunProcessKey,
57
57
  worktreeSetupProcessKey
58
- } from "./chunk-EHZ24J7U.js";
58
+ } from "./chunk-ELDJBZ52.js";
59
59
  import {
60
60
  applyAgentEvent,
61
61
  clipAgentEventForPaint,
@@ -98,7 +98,7 @@ import {
98
98
  stageAbsolutePathsAsAttachments,
99
99
  stageBuffersAsAttachments,
100
100
  syncWorkspacesFromThreads
101
- } from "./chunk-5MJ7FCZ2.js";
101
+ } from "./chunk-LEUAYFSG.js";
102
102
  import {
103
103
  addPrStackLayer,
104
104
  allocateTeamSlug,
@@ -517,9 +517,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
517
517
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
518
518
  );
519
519
  }
520
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-EW54B2P4.js");
520
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-Q4OURN7M.js");
521
521
  if (isGlobalThread2(thread)) {
522
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-XU5KFYI5.js");
522
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-O75QUEHP.js");
523
523
  ensureGlobalCoordinatorCwd2(
524
524
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
525
525
  );
@@ -891,11 +891,24 @@ function expandCanonicalGitRequest(prompt, opts) {
891
891
  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.";
892
892
  }
893
893
  if (!expansion) return prompt;
894
+ if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
894
895
  return `${trimmed}
895
896
 
896
897
  (Sideboard git request \u2014 do not ask for clarification: ${expansion})`;
897
898
  }
898
899
  var FIX_CI_RE = /^Fix CI: .+\.$/;
900
+ var 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.";
901
+ var CHECKS_LOOP_UNLESS_GOAL = / ?Do not start a checks loop unless a goal was given\./g;
902
+ function withPushReview(expansion) {
903
+ const base = expansion.replace(CHECKS_LOOP_UNLESS_GOAL, "").trim();
904
+ if (base.includes("third-party PR review")) return base;
905
+ return `${base} ${PUSH_WAKES_REVIEW}`;
906
+ }
907
+ function expansionPushes(action, prompt) {
908
+ if (action === "ready-for-review" || action === "merge") return false;
909
+ if (action) return true;
910
+ return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
911
+ }
899
912
 
900
913
  // src/git/pr-merge-archive.ts
901
914
  function normalizePrState(state) {
@@ -3383,7 +3396,7 @@ async function createThread(input, _onSetupLine) {
3383
3396
  return readThread(thread.id) ?? thread;
3384
3397
  }
3385
3398
  async function listLinearIssues(agent, repoPath) {
3386
- const { getAdapter: getAdapter2 } = await import("./agents-5FB756FF.js");
3399
+ const { getAdapter: getAdapter2 } = await import("./agents-5NJ3FROS.js");
3387
3400
  await requireAgent(agent, { requireLinear: true });
3388
3401
  const adapter = getAdapter2(agent);
3389
3402
  if (!adapter.listLinearIssues) {
@@ -4166,7 +4179,7 @@ async function adoptThread(input) {
4166
4179
  messages: input.messages ?? []
4167
4180
  });
4168
4181
  writeThread(thread);
4169
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-CB4SCKVH.js");
4182
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-QGKSXA76.js");
4170
4183
  await addWorkspace2(repoPath);
4171
4184
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-YQBN43QD.js");
4172
4185
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6704,7 +6717,7 @@ function formatPrGateDirective() {
6704
6717
  "If a goal is given (not after every push):",
6705
6718
  "- 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.",
6706
6719
  "- 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.",
6707
- "- 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."
6720
+ "- 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."
6708
6721
  ].join("\n");
6709
6722
  }
6710
6723
  function formatProcessGuideDirective(opts) {
@@ -7155,7 +7168,7 @@ function formatScheduledPrompt(name, prompt) {
7155
7168
  ${prompt}`;
7156
7169
  }
7157
7170
  async function defaultDeps() {
7158
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-5X62LJ2T.js");
7171
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-IYXIWNB5.js");
7159
7172
  const orch = getOrchestrator2();
7160
7173
  return {
7161
7174
  findThread: (id) => findThreadByRef(id),
@@ -356,7 +356,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
356
356
  "- 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.",
357
357
  "- 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.",
358
358
  "- 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.",
359
- "- 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.",
359
+ "- 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.",
360
360
  "- 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.",
361
361
  "Projects:",
362
362
  "- add_project / remove_project \u2014 register or unregister a git repo",
@@ -382,7 +382,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
382
382
  "- get_diff \u2014 compact diff summary",
383
383
  "- 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.",
384
384
  '- 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.',
385
- "- 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.",
385
+ "- 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.",
386
386
  '- 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.',
387
387
  '- 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.',
388
388
  "Process guides:",
@@ -515,7 +515,7 @@ function ensureGlobalCoordinatorCwd(opts) {
515
515
  "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.",
516
516
  '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.',
517
517
  "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.",
518
- "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."
518
+ "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."
519
519
  ].join("\n");
520
520
  try {
521
521
  writeFileSync2(join2(dir, "AGENTS.md"), `${body}
@@ -8,7 +8,7 @@ import {
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-5MJ7FCZ2.js";
11
+ } from "./chunk-LEUAYFSG.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
@@ -1664,7 +1664,7 @@ var PORT_RANGE_SIZE = 10;
1664
1664
  var RECLAIM_RETRY_DELAY_MS = 40;
1665
1665
  var RECLAIM_TRIES = 8;
1666
1666
  async function killReclaimable(ports, worktreePath, signal) {
1667
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-5OTVFON5.js");
1667
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-LUPB6RBH.js");
1668
1668
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1669
1669
  else killListenersOnPorts2(ports);
1670
1670
  }
@@ -401,7 +401,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
401
401
  "- 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.",
402
402
  "- 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.",
403
403
  "- 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.",
404
- "- 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.",
404
+ "- 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.",
405
405
  "- 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.",
406
406
  "Projects:",
407
407
  "- add_project / remove_project \u2014 register or unregister a git repo",
@@ -427,7 +427,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
427
427
  "- get_diff \u2014 compact diff summary",
428
428
  "- 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.",
429
429
  '- 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.',
430
- "- 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.",
430
+ "- 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.",
431
431
  '- 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.',
432
432
  '- 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.',
433
433
  "Process guides:",
@@ -560,7 +560,7 @@ function ensureGlobalCoordinatorCwd(opts) {
560
560
  "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.",
561
561
  '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.',
562
562
  "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.",
563
- "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."
563
+ "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."
564
564
  ].join("\n");
565
565
  try {
566
566
  writeFileSync2(join2(dir, "AGENTS.md"), `${body}
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-6HGTYZGL.js";
17
+ } from "./chunk-WXOJSFGO.js";
18
18
  import {
19
19
  applyWorktreePkgCacheEnv,
20
20
  askBlockStillWaiting,
@@ -53,7 +53,7 @@ import {
53
53
  worktreeDevProcessKey,
54
54
  worktreeRunProcessKey,
55
55
  worktreeSetupProcessKey
56
- } from "./chunk-5G5DTQ5N.js";
56
+ } from "./chunk-RJT6JPNX.js";
57
57
  import {
58
58
  applyAgentEvent,
59
59
  clipAgentEventForPaint,
@@ -118,7 +118,7 @@ import {
118
118
  stageAbsolutePathsAsAttachments,
119
119
  stageBuffersAsAttachments,
120
120
  syncWorkspacesFromThreads
121
- } from "./chunk-UEPTL7UG.js";
121
+ } from "./chunk-6RUSADA7.js";
122
122
  import {
123
123
  addPrStackLayer,
124
124
  allocateTeamSlug,
@@ -561,9 +561,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
561
561
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
562
562
  );
563
563
  }
564
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-P2BW6MJ3.js");
564
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-3IG44NAT.js");
565
565
  if (isGlobalThread2(thread)) {
566
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-OD6VYETQ.js");
566
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-EJJNJ5K7.js");
567
567
  ensureGlobalCoordinatorCwd2(
568
568
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
569
569
  );
@@ -935,11 +935,24 @@ function expandCanonicalGitRequest(prompt, opts) {
935
935
  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.";
936
936
  }
937
937
  if (!expansion) return prompt;
938
+ if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
938
939
  return `${trimmed}
939
940
 
940
941
  (Sideboard git request \u2014 do not ask for clarification: ${expansion})`;
941
942
  }
942
943
  var FIX_CI_RE = /^Fix CI: .+\.$/;
944
+ var 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.";
945
+ var CHECKS_LOOP_UNLESS_GOAL = / ?Do not start a checks loop unless a goal was given\./g;
946
+ function withPushReview(expansion) {
947
+ const base = expansion.replace(CHECKS_LOOP_UNLESS_GOAL, "").trim();
948
+ if (base.includes("third-party PR review")) return base;
949
+ return `${base} ${PUSH_WAKES_REVIEW}`;
950
+ }
951
+ function expansionPushes(action, prompt) {
952
+ if (action === "ready-for-review" || action === "merge") return false;
953
+ if (action) return true;
954
+ return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
955
+ }
943
956
 
944
957
  // src/git/pr-merge-archive.ts
945
958
  function normalizePrState(state) {
@@ -3851,7 +3864,7 @@ async function adoptThread(input) {
3851
3864
  messages: input.messages ?? []
3852
3865
  });
3853
3866
  writeThread(thread);
3854
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-OY7JIPDE.js");
3867
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-ALUHOCWK.js");
3855
3868
  await addWorkspace2(repoPath);
3856
3869
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-KMZQXZKP.js");
3857
3870
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6354,7 +6367,7 @@ function formatPrGateDirective() {
6354
6367
  "If a goal is given (not after every push):",
6355
6368
  "- 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.",
6356
6369
  "- 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.",
6357
- "- 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."
6370
+ "- 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."
6358
6371
  ].join("\n");
6359
6372
  }
6360
6373
  function formatProcessGuideDirective(opts) {
@@ -6805,7 +6818,7 @@ function formatScheduledPrompt(name, prompt) {
6805
6818
  ${prompt}`;
6806
6819
  }
6807
6820
  async function defaultDeps() {
6808
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-UKAXA5ZW.js");
6821
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-WHXHBNRS.js");
6809
6822
  const orch = getOrchestrator2();
6810
6823
  return {
6811
6824
  findThread: (id) => findThreadByRef(id),
@@ -11,7 +11,7 @@ import {
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-UEPTL7UG.js";
14
+ } from "./chunk-6RUSADA7.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
@@ -1696,7 +1696,7 @@ var PORT_RANGE_SIZE = 10;
1696
1696
  var RECLAIM_RETRY_DELAY_MS = 40;
1697
1697
  var RECLAIM_TRIES = 8;
1698
1698
  async function killReclaimable(ports, worktreePath, signal) {
1699
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-CVQJEAKE.js");
1699
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-XSP3SOS2.js");
1700
1700
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1701
1701
  else killListenersOnPorts2(ports);
1702
1702
  }
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-OOXRMTU6.js";
16
16
  import {
17
17
  isOrchestratorThread
18
- } from "./chunk-5MJ7FCZ2.js";
18
+ } from "./chunk-LEUAYFSG.js";
19
19
  import {
20
20
  codexUnattendedGitConfigArgs,
21
21
  mergeAgentGitAuthEnv,
@@ -2659,7 +2659,7 @@ var claudeAdapter = {
2659
2659
  );
2660
2660
  }
2661
2661
  const mode = permissionMode(thread);
2662
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-EW54B2P4.js");
2662
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-Q4OURN7M.js");
2663
2663
  const isOrchestrator = isOrchestratorThread2(thread);
2664
2664
  const rpc = worktreeAgentRpc(isOrchestrator);
2665
2665
  const injectedServers = await buildInjectedMcpServers({
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-5MXLDDYF.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-UEPTL7UG.js";
15
+ } from "./chunk-6RUSADA7.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
@@ -2966,7 +2966,7 @@ var claudeAdapter = {
2966
2966
  );
2967
2967
  }
2968
2968
  const mode = permissionMode(thread);
2969
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-P2BW6MJ3.js");
2969
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-3IG44NAT.js");
2970
2970
  const isOrchestrator = isOrchestratorThread2(thread);
2971
2971
  const rpc = worktreeAgentRpc(isOrchestrator);
2972
2972
  const injectedServers = await buildInjectedMcpServers({
@@ -32,9 +32,9 @@ import {
32
32
  tryReservePort,
33
33
  tryReservePorts,
34
34
  worktreeRunPortsPath
35
- } from "./chunk-EHZ24J7U.js";
35
+ } from "./chunk-ELDJBZ52.js";
36
36
  import "./chunk-OOXRMTU6.js";
37
- import "./chunk-5MJ7FCZ2.js";
37
+ import "./chunk-LEUAYFSG.js";
38
38
  import "./chunk-JJRTVB7D.js";
39
39
  import "./chunk-QVLDZWHZ.js";
40
40
  import "./chunk-BMRJNRQK.js";
@@ -34,9 +34,9 @@ import {
34
34
  tryReservePort,
35
35
  tryReservePorts,
36
36
  worktreeRunPortsPath
37
- } from "./chunk-5G5DTQ5N.js";
37
+ } from "./chunk-RJT6JPNX.js";
38
38
  import "./chunk-5MXLDDYF.js";
39
- import "./chunk-UEPTL7UG.js";
39
+ import "./chunk-6RUSADA7.js";
40
40
  import "./chunk-P7S3XGKL.js";
41
41
  import "./chunk-N2WW62LF.js";
42
42
  import "./chunk-GK7H3SY7.js";
@@ -9,7 +9,7 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-UEPTL7UG.js";
12
+ } from "./chunk-6RUSADA7.js";
13
13
  import "./chunk-P7S3XGKL.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-GK7H3SY7.js";
@@ -7,7 +7,7 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-5MJ7FCZ2.js";
10
+ } from "./chunk-LEUAYFSG.js";
11
11
  import "./chunk-JJRTVB7D.js";
12
12
  import "./chunk-QVLDZWHZ.js";
13
13
  import "./chunk-BMRJNRQK.js";
@@ -20,7 +20,7 @@ import {
20
20
  remoteCoordinatorSourceRef,
21
21
  slackCoordinatorSourceRef,
22
22
  takenTeamSlugsForOrchestration
23
- } from "./chunk-UEPTL7UG.js";
23
+ } from "./chunk-6RUSADA7.js";
24
24
  import "./chunk-P7S3XGKL.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-GK7H3SY7.js";
@@ -18,7 +18,7 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-5MJ7FCZ2.js";
21
+ } from "./chunk-LEUAYFSG.js";
22
22
  import "./chunk-JJRTVB7D.js";
23
23
  import "./chunk-QVLDZWHZ.js";
24
24
  import "./chunk-BMRJNRQK.js";
package/dist/index.cjs CHANGED
@@ -13127,7 +13127,7 @@ function ensureGlobalCoordinatorCwd(opts) {
13127
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.",
13128
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.',
13129
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.",
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. 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."
13131
13131
  ].join("\n");
13132
13132
  try {
13133
13133
  (0, import_node_fs25.writeFileSync)((0, import_node_path29.join)(dir, "AGENTS.md"), `${body}
@@ -13193,7 +13193,7 @@ var init_coordinator_prompt = __esm({
13193
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.",
13194
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.",
13195
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.",
13196
- "- 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.",
13197
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.",
13198
13198
  "Projects:",
13199
13199
  "- add_project / remove_project \u2014 register or unregister a git repo",
@@ -13219,7 +13219,7 @@ var init_coordinator_prompt = __esm({
13219
13219
  "- get_diff \u2014 compact diff summary",
13220
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.",
13221
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.',
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.",
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.",
13223
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.',
13224
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.',
13225
13225
  "Process guides:",
@@ -22811,11 +22811,22 @@ function expandCanonicalGitRequest(prompt, opts) {
22811
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.";
22812
22812
  }
22813
22813
  if (!expansion) return prompt;
22814
+ if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
22814
22815
  return `${trimmed}
22815
22816
 
22816
22817
  (Sideboard git request \u2014 do not ask for clarification: ${expansion})`;
22817
22818
  }
22818
- 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;
22819
22830
  var init_agent_git_actions = __esm({
22820
22831
  "src/git/agent-git-actions.ts"() {
22821
22832
  "use strict";
@@ -22830,6 +22841,8 @@ var init_agent_git_actions = __esm({
22830
22841
  RESOLVE_CONFLICTS_RE = /^Merge the remote branch(?: \(([^)]+)\))? into your branch and resolve conflicts\. Then, commit and push your changes\.$/;
22831
22842
  MERGE_INTO_RE = /^Merge PR into (.+)\.$/;
22832
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;
22833
22846
  }
22834
22847
  });
22835
22848
 
@@ -31703,7 +31716,7 @@ function formatPrGateDirective() {
31703
31716
  "If a goal is given (not after every push):",
31704
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.",
31705
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.",
31706
- "- 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."
31707
31720
  ].join("\n");
31708
31721
  }
31709
31722
  function formatProcessGuideDirective(opts) {
@@ -36329,6 +36342,7 @@ __export(index_exports, {
36329
36342
  healOrchestrationSoccerTitles: () => healOrchestrationSoccerTitles,
36330
36343
  historyMaxCount: () => historyMaxCount,
36331
36344
  historyMaxDays: () => historyMaxDays,
36345
+ hostKeepsMacAwake: () => hostKeepsMacAwake,
36332
36346
  hottestClaudeWindow: () => hottestClaudeWindow,
36333
36347
  httpFetch: () => httpFetch,
36334
36348
  importAgentDoneCustomSound: () => importAgentDoneCustomSound,
@@ -37365,6 +37379,15 @@ init_run_log();
37365
37379
  init_schedules();
37366
37380
  init_schedule_runner();
37367
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
+
37368
37391
  // src/host/serve.ts
37369
37392
  var import_node_child_process8 = require("child_process");
37370
37393
  var import_node_os22 = require("os");
@@ -43557,7 +43580,15 @@ async function startHeadlessHost(opts) {
43557
43580
  }
43558
43581
  };
43559
43582
  const refreshAwake = () => {
43560
- 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
+ });
43561
43592
  if (keep && !caffeinate && process.platform === "darwin") {
43562
43593
  try {
43563
43594
  caffeinate = (0, import_node_child_process8.spawn)("caffeinate", ["-dimsu"], { stdio: "ignore" });
@@ -46826,7 +46857,7 @@ async function startMcpServer() {
46826
46857
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
46827
46858
  server.tool(
46828
46859
  "set_caffeinate",
46829
- "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.",
46830
46861
  {
46831
46862
  enabled: import_zod11.z.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
46832
46863
  },
@@ -47144,7 +47175,7 @@ async function startMcpServer() {
47144
47175
  );
47145
47176
  server.tool(
47146
47177
  "ask_git",
47147
- "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.",
47148
47179
  {
47149
47180
  ref: import_zod11.z.string().describe("Worktree thread id/ref"),
47150
47181
  action: import_zod11.z.enum(AGENT_GIT_ACTIONS).describe(
@@ -50478,6 +50509,7 @@ async function pollSlackOutboundWatches(opts) {
50478
50509
  healOrchestrationSoccerTitles,
50479
50510
  historyMaxCount,
50480
50511
  historyMaxDays,
50512
+ hostKeepsMacAwake,
50481
50513
  hottestClaudeWindow,
50482
50514
  httpFetch,
50483
50515
  importAgentDoneCustomSound,