@sideboard-ai/core 0.1.349 → 0.1.351

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 (78) hide show
  1. package/dist/{abletime-CGFJZB7L.js → abletime-TX7BTTR2.js} +5 -5
  2. package/dist/{abletime-3HRWLQZJ.js → abletime-URSRZW7P.js} +4 -4
  3. package/dist/{abletime-oauth-QNJQLHR4.js → abletime-oauth-QS3WPSCC.js} +3 -3
  4. package/dist/{abletime-oauth-JQDSH5OL.js → abletime-oauth-SL3NMNEC.js} +4 -4
  5. package/dist/{abletime-rest-TANL5TMY.js → abletime-rest-GGQLUO55.js} +3 -3
  6. package/dist/{abletime-rest-UQA2CRZN.js → abletime-rest-JZU6JJCV.js} +4 -4
  7. package/dist/agents/acp-runner.cjs +491 -0
  8. package/dist/agents/acp-runner.d.cts +46 -0
  9. package/dist/agents/acp-runner.d.ts +46 -0
  10. package/dist/agents/acp-runner.js +323 -0
  11. package/dist/{agents-DMPBFF3F.js → agents-D5CL4CR4.js} +37 -7
  12. package/dist/{agents-AZ2PV6XP.js → agents-INTH7J3F.js} +42 -11
  13. package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
  14. package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
  15. package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
  16. package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
  17. package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
  18. package/dist/{chunk-Q4I6KDOL.js → chunk-7WPQAVS5.js} +60 -39
  19. package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
  20. package/dist/{chunk-ZXI5DR5S.js → chunk-AAKQU4UZ.js} +1624 -1487
  21. package/dist/{chunk-MVFFLU5V.js → chunk-AEEOYLVK.js} +12 -5
  22. package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
  23. package/dist/{chunk-IRFBD6GU.js → chunk-BDWVBEKN.js} +71 -47
  24. package/dist/chunk-BF6INES4.js +144 -0
  25. package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
  26. package/dist/{chunk-ROXM6QZV.js → chunk-C3E2DGDF.js} +12 -5
  27. package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
  28. package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
  29. package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
  30. package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
  31. package/dist/{chunk-3DBL2C45.js → chunk-FQ3JYUKI.js} +2 -2
  32. package/dist/{chunk-MHSBF3SO.js → chunk-HISSQICH.js} +4 -4
  33. package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
  34. package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
  35. package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
  36. package/dist/{chunk-6RIPZ73M.js → chunk-SMSD6U3N.js} +3 -1
  37. package/dist/{chunk-CATTIFSP.js → chunk-SZY23KGS.js} +4 -4
  38. package/dist/{chunk-RPHH4FNK.js → chunk-TCEUNSLX.js} +3 -1
  39. package/dist/chunk-TRMPDDVL.js +232 -0
  40. package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
  41. package/dist/{chunk-WHMLMCPU.js → chunk-UXAKH4AW.js} +1925 -1722
  42. package/dist/{chunk-QHXZKHUL.js → chunk-VHQ6OG3U.js} +2 -2
  43. package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
  44. package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
  45. package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
  46. package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
  47. package/dist/chunk-YE7Z5WH3.js +142 -0
  48. package/dist/{conductor-65VPUPOW.js → conductor-FWYWIHEW.js} +7 -6
  49. package/dist/{conductor-NHC6X74J.js → conductor-W2X7QUKZ.js} +6 -5
  50. package/dist/connected-teams-2YDE2EZ2.js +1 -1
  51. package/dist/{coordinator-prompt-R2PURZL3.js → coordinator-prompt-J57Q4Z4W.js} +4 -4
  52. package/dist/{coordinator-prompt-5GZWIVSY.js → coordinator-prompt-KIHNLENN.js} +5 -5
  53. package/dist/{global-workspace-UEECLWSX.js → global-workspace-CGB5CY4U.js} +4 -4
  54. package/dist/{global-workspace-64KC7PST.js → global-workspace-WXDWFZAN.js} +5 -5
  55. package/dist/index.cjs +1750 -950
  56. package/dist/index.d.cts +151 -895
  57. package/dist/index.d.ts +151 -895
  58. package/dist/index.js +582 -227
  59. package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
  60. package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
  61. package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
  62. package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
  63. package/dist/mcp/run-stdio.cjs +1247 -741
  64. package/dist/mcp/run-stdio.js +181 -44
  65. package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
  66. package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
  67. package/dist/{orchestrator-I5G5A5BV.js → orchestrator-DMEE7CEW.js} +11 -10
  68. package/dist/{orchestrator-Y5PYSMR6.js → orchestrator-MUD4FY7Q.js} +17 -15
  69. package/dist/thread-CJRchYLj.d.cts +856 -0
  70. package/dist/thread-CJRchYLj.d.ts +856 -0
  71. package/dist/{thread-store-HZ4U4OXB.js → thread-store-4YTOV2HL.js} +3 -3
  72. package/dist/{thread-store-QKNU5CHM.js → thread-store-LME2ICZP.js} +2 -2
  73. package/dist/{workspaces-6TIM2TM2.js → workspaces-7DPHDXNY.js} +4 -4
  74. package/dist/{workspaces-I2EHNTFE.js → workspaces-ZCTF4ECL.js} +5 -5
  75. package/dist/{worktree-7JFYDNUX.js → worktree-4ATMCYIE.js} +3 -3
  76. package/dist/{worktree-M2GJGK2P.js → worktree-DA6SKIU5.js} +4 -4
  77. package/package.json +3 -3
  78. /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
package/dist/index.js CHANGED
@@ -17,13 +17,16 @@ import {
17
17
  toAbleTimeIssueInfo,
18
18
  updateAbleTimeTask,
19
19
  verifyAbleTimeConnection
20
- } from "./chunk-RUIHNWRV.js";
20
+ } from "./chunk-37ZBEBP6.js";
21
+ import {
22
+ looksLikeAbleTimeUlid
23
+ } from "./chunk-CCWQ65VD.js";
21
24
  import {
22
25
  clearOptionalCliPresenceCache,
23
26
  detectOptionalServiceClis,
24
27
  installOptionalServiceCli,
25
28
  optionalCliPresence
26
- } from "./chunk-UJMCTGV7.js";
29
+ } from "./chunk-PXSWVZIL.js";
27
30
  import {
28
31
  AGENT_GIT_ACTIONS,
29
32
  BOARD_COLUMN_DEFS,
@@ -222,7 +225,7 @@ import {
222
225
  worktreeCleanupSettings,
223
226
  writeAgentBlock,
224
227
  writeWorktreeFile
225
- } from "./chunk-IRFBD6GU.js";
228
+ } from "./chunk-BDWVBEKN.js";
226
229
  import {
227
230
  OPTIONAL_SERVICES,
228
231
  OPTIONAL_SERVICE_IDS,
@@ -238,7 +241,7 @@ import {
238
241
  optionalServiceConnected,
239
242
  optionalServiceSpec,
240
243
  verifyOptionalService
241
- } from "./chunk-IVRWRYTH.js";
244
+ } from "./chunk-BZK62VPT.js";
242
245
  import {
243
246
  LEGACY_PLAN_FILE_REL,
244
247
  PLAN_FILE_NAME,
@@ -295,7 +298,7 @@ import {
295
298
  startLinearOAuth,
296
299
  updateLinearIssue,
297
300
  validateLinearApiKey
298
- } from "./chunk-PVCECFJK.js";
301
+ } from "./chunk-7ZD4OK6G.js";
299
302
  import {
300
303
  downloadAuthenticatedFile,
301
304
  extractHttpUrls,
@@ -322,6 +325,9 @@ import {
322
325
  WORKTREE_GITHUB_MCP_TOOLS,
323
326
  WORKTREE_LINEAR_MCP_TOOLS,
324
327
  WORKTREE_MCP_TOOLS,
328
+ acpAdapter,
329
+ acpHarnessDisplayName,
330
+ acpRunnerPath,
325
331
  allAdapters,
326
332
  brightsyAdapter,
327
333
  brightsyMcpAllowedTools,
@@ -383,7 +389,7 @@ import {
383
389
  userMcpNamesToDisable,
384
390
  worktreeMcpToolNames,
385
391
  writeInjectedMcpConfig
386
- } from "./chunk-ZXI5DR5S.js";
392
+ } from "./chunk-AAKQU4UZ.js";
387
393
  import {
388
394
  getAgentSetupInfo,
389
395
  installAgent,
@@ -395,7 +401,7 @@ import {
395
401
  prepareTerminalCommand,
396
402
  resolveLoginCommand,
397
403
  whichOnPath
398
- } from "./chunk-4NXGVJA6.js";
404
+ } from "./chunk-F4RFFE2H.js";
399
405
  import {
400
406
  brightsyMcpServerName,
401
407
  connectBrightsyTeam,
@@ -405,8 +411,21 @@ import {
405
411
  listBrightsyAccounts,
406
412
  listConnectedBrightsyTeams,
407
413
  switchBrightsyAccount
408
- } from "./chunk-XOEKCE6L.js";
409
- import "./chunk-5FUAOU3G.js";
414
+ } from "./chunk-OHXNGBC4.js";
415
+ import {
416
+ BRIGHTSY_OAUTH_CLIENT_ID,
417
+ BRIGHTSY_OAUTH_REDIRECT,
418
+ brightsyAccessTokenNeedsRefresh,
419
+ brightsyConfigPath,
420
+ ensureBrightsyLocalConfigFresh,
421
+ ensureBrightsyOAuthClientId,
422
+ loadBrightsyConfig,
423
+ normalizeBrightsyEndpoint,
424
+ refreshBrightsyAccessToken,
425
+ registerBrightsyOAuthClient,
426
+ saveBrightsyConfig
427
+ } from "./chunk-RSA47QYR.js";
428
+ import "./chunk-WB3G2LQO.js";
410
429
  import {
411
430
  BRIGHTSY_SUMMARIZE_CONTEXT_TOOL,
412
431
  CHARS_PER_CONTEXT_TOKEN,
@@ -518,7 +537,7 @@ import {
518
537
  workspaceAgentChatSummaries,
519
538
  worktreeRunPortsPath,
520
539
  wrapReviewSkillMarkdown
521
- } from "./chunk-ROXM6QZV.js";
540
+ } from "./chunk-C3E2DGDF.js";
522
541
  import {
523
542
  STDERR_EVENT_MAX_CHARS,
524
543
  STDOUT_EVENT_MAX_CHARS,
@@ -561,6 +580,19 @@ import {
561
580
  withEventParentId,
562
581
  withEventsParentId
563
582
  } from "./chunk-WWBPK7GB.js";
583
+ import {
584
+ ACP_HARNESSES,
585
+ ACP_HARNESS_IDS,
586
+ acpHarnessLabel,
587
+ acpHarnessLooksAuthenticated,
588
+ acpHarnessStatus,
589
+ agentSupportsAttach,
590
+ defaultAcpHarness,
591
+ detectAcpHarness,
592
+ detectAcpHarnesses,
593
+ isAcpHarnessId,
594
+ resolveAcpHarnessCommand
595
+ } from "./chunk-YE7Z5WH3.js";
564
596
  import "./chunk-7H655NEW.js";
565
597
  import {
566
598
  ABLETIME_OAUTH_CALLBACK_PATH,
@@ -584,10 +616,7 @@ import {
584
616
  parseAbleTimeOAuthCallbackUrl,
585
617
  resolveAbleTimeOAuthHost,
586
618
  startAbleTimeOAuth
587
- } from "./chunk-CEQ4Z32M.js";
588
- import {
589
- looksLikeAbleTimeUlid
590
- } from "./chunk-AJMERXZP.js";
619
+ } from "./chunk-J4EA5SHF.js";
591
620
  import {
592
621
  ABLETIME_MCP_PATH,
593
622
  ABLETIME_MCP_PM_PATH,
@@ -608,7 +637,20 @@ import {
608
637
  normalizeAbleTimeCredential,
609
638
  normalizeAbleTimeHost,
610
639
  rewriteAbleTimeError
611
- } from "./chunk-FDYMVJFU.js";
640
+ } from "./chunk-5WF54R3B.js";
641
+ import {
642
+ currentHttpFetch,
643
+ formatFetchError,
644
+ httpFetch,
645
+ setHttpFetchImpl
646
+ } from "./chunk-JAT3JFOS.js";
647
+ import {
648
+ caffeinateHoldPath,
649
+ getCaffeinateHold,
650
+ isThreadCaffeinated,
651
+ releaseCaffeinateHoldForThread,
652
+ setCaffeinateHold
653
+ } from "./chunk-LAWLUOWQ.js";
612
654
  import {
613
655
  CLOUD_COORDINATOR_BUSY_REPLY,
614
656
  CLOUD_COORDINATOR_CANCELED_REPLY,
@@ -661,7 +703,7 @@ import {
661
703
  stageBuffersAsAttachments,
662
704
  syncWorkspacesFromThreads,
663
705
  takenTeamSlugsForOrchestration
664
- } from "./chunk-MHSBF3SO.js";
706
+ } from "./chunk-HISSQICH.js";
665
707
  import {
666
708
  GITHUB_PR_BODY_MAX_CHARS,
667
709
  GITHUB_PR_BODY_SAFE_CHARS,
@@ -751,7 +793,7 @@ import {
751
793
  suggestSlug,
752
794
  switchWorktreeBranch,
753
795
  warmGithubAgentAuth
754
- } from "./chunk-3DBL2C45.js";
796
+ } from "./chunk-FQ3JYUKI.js";
755
797
  import {
756
798
  FAMOUS_SOCCER_TEAMS,
757
799
  SCHEDULE_RUN_HISTORY_LIMIT,
@@ -811,27 +853,9 @@ import {
811
853
  worktreeNameFromPath,
812
854
  worktreeSlugForTicket,
813
855
  writeThread
814
- } from "./chunk-RPHH4FNK.js";
856
+ } from "./chunk-TCEUNSLX.js";
815
857
  import "./chunk-BMRJNRQK.js";
816
- import {
817
- BRIGHTSY_OAUTH_CLIENT_ID,
818
- BRIGHTSY_OAUTH_REDIRECT,
819
- brightsyAccessTokenNeedsRefresh,
820
- brightsyConfigPath,
821
- ensureBrightsyLocalConfigFresh,
822
- ensureBrightsyOAuthClientId,
823
- loadBrightsyConfig,
824
- normalizeBrightsyEndpoint,
825
- refreshBrightsyAccessToken,
826
- registerBrightsyOAuthClient,
827
- saveBrightsyConfig
828
- } from "./chunk-RSA47QYR.js";
829
- import {
830
- currentHttpFetch,
831
- formatFetchError,
832
- httpFetch,
833
- setHttpFetchImpl
834
- } from "./chunk-JAT3JFOS.js";
858
+ import "./chunk-TRMPDDVL.js";
835
859
  import {
836
860
  PLAN_QUESTION_ANSWERS_PREFIX,
837
861
  askBlockStillWaiting,
@@ -1104,7 +1128,10 @@ import {
1104
1128
  withTurnScopedCost,
1105
1129
  writeSecureJson,
1106
1130
  writeViewerContext
1107
- } from "./chunk-6WMNIX2U.js";
1131
+ } from "./chunk-UFUAIVNV.js";
1132
+ import {
1133
+ writePrivateFile
1134
+ } from "./chunk-JT7R45JB.js";
1108
1135
  import {
1109
1136
  stripNestedElectronEnv
1110
1137
  } from "./chunk-4TR3HZFT.js";
@@ -1132,16 +1159,6 @@ import {
1132
1159
  withRemovedAccount,
1133
1160
  withSelectedAccount
1134
1161
  } from "./chunk-KI45T4DI.js";
1135
- import {
1136
- caffeinateHoldPath,
1137
- getCaffeinateHold,
1138
- isThreadCaffeinated,
1139
- releaseCaffeinateHoldForThread,
1140
- setCaffeinateHold
1141
- } from "./chunk-LAWLUOWQ.js";
1142
- import {
1143
- writePrivateFile
1144
- } from "./chunk-JT7R45JB.js";
1145
1162
  import {
1146
1163
  CONVENTION_SETUP_RELPATHS,
1147
1164
  activeRunPreview,
@@ -1954,6 +1971,53 @@ function buildWaterfall(rows) {
1954
1971
  )
1955
1972
  })).sort((a, b) => (a.nodes[0]?.label ?? "").localeCompare(b.nodes[0]?.label ?? ""));
1956
1973
  }
1974
+ function joinCapped(lines, max = 3) {
1975
+ if (lines.length <= max) return lines.join(". ");
1976
+ const extra = lines.length - max;
1977
+ return `${lines.slice(0, max).join(". ")}. ${extra} more`;
1978
+ }
1979
+ function planWatchCopy(chains) {
1980
+ const start = [];
1981
+ const waiting = [];
1982
+ const ready = [];
1983
+ for (const chain of chains) {
1984
+ const incoming = chain.nodes.flatMap((node) => node.incoming);
1985
+ for (const node of chain.nodes) {
1986
+ const gating = node.incoming.filter((edge) => !edge.loop);
1987
+ const blocked = gating.filter((edge) => !edge.met);
1988
+ if (blocked.length > 0) {
1989
+ const verb = blocked.some((edge2) => edge2.hold === "start") ? "start" : "merge";
1990
+ const edge = blocked.find((row2) => row2.hold === verb) ?? blocked[0];
1991
+ waiting.push(
1992
+ `${node.label} can ${verb} once ${edge.fromLabel} is ${gatePhrase(edge.gate)}`
1993
+ );
1994
+ if (verb === "merge") start.push(`${node.label} can start`);
1995
+ continue;
1996
+ }
1997
+ if (gating.length > 0) {
1998
+ const verb = gating.every((edge) => edge.hold === "merge") ? "merge" : "start";
1999
+ ready.push(`${node.label} can ${verb}`);
2000
+ continue;
2001
+ }
2002
+ const outgoing = incoming.filter((edge) => edge.fromKey === node.key && !edge.loop);
2003
+ if (outgoing.length > 0 && outgoing.every((edge) => edge.met)) continue;
2004
+ start.push(`${node.label} can start`);
2005
+ }
2006
+ }
2007
+ if (start.length === 0 && waiting.length === 0 && ready.length === 0) {
2008
+ return "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until you mark it.";
2009
+ }
2010
+ const sentences = [];
2011
+ if (start.length) sentences.push(joinCapped(start));
2012
+ if (ready.length) sentences.push(joinCapped(ready));
2013
+ if (waiting.length) {
2014
+ sentences.push(
2015
+ start.length || ready.length ? `Still waiting: ${joinCapped(waiting)}` : `Running and idle. ${joinCapped(waiting)}. A merge or a production mark is what moves the next step`
2016
+ );
2017
+ }
2018
+ const text6 = sentences.join(". ");
2019
+ return text6.endsWith(".") ? text6 : `${text6}.`;
2020
+ }
1957
2021
  function gatePhrase(gate) {
1958
2022
  return gate === "in-prod" ? "in production" : "in main";
1959
2023
  }
@@ -2094,10 +2158,72 @@ function formatOrderPlace(rows, you) {
2094
2158
  return lines.join("\n");
2095
2159
  }
2096
2160
  function executionSlice(rows) {
2097
- return {
2098
- ready: rows.filter((row2) => row2.met || row2.loop),
2099
- waiting: rows.filter((row2) => !row2.met && !row2.loop)
2161
+ const byKey = /* @__PURE__ */ new Map();
2162
+ const touch = (target, label, depth, asSubject) => {
2163
+ const key = targetKey(target);
2164
+ const found = byKey.get(key);
2165
+ if (!found) {
2166
+ byKey.set(key, {
2167
+ target,
2168
+ label,
2169
+ depth: asSubject ? depth : Number.POSITIVE_INFINITY,
2170
+ asSubject,
2171
+ incoming: [],
2172
+ outgoing: []
2173
+ });
2174
+ return;
2175
+ }
2176
+ if (asSubject || !found.asSubject) found.label = label;
2177
+ if (asSubject) {
2178
+ found.asSubject = true;
2179
+ found.depth = Math.min(found.depth, depth);
2180
+ }
2100
2181
  };
2182
+ for (const row2 of rows) {
2183
+ touch(row2.subject, row2.subjectLabel, row2.depth, true);
2184
+ touch(row2.waitsOn, row2.waitsOnLabel, row2.depth, false);
2185
+ if (row2.loop) continue;
2186
+ byKey.get(targetKey(row2.subject)).incoming.push(row2);
2187
+ byKey.get(targetKey(row2.waitsOn)).outgoing.push(row2);
2188
+ }
2189
+ const start = [];
2190
+ const waiting = [];
2191
+ const mergeHeld = [];
2192
+ const gateName = (row2) => row2.gate === "in-prod" ? "in prod" : "in main";
2193
+ const items = [...byKey.values()].sort((a, b) => {
2194
+ const depthA = Number.isFinite(a.depth) ? a.depth : 0;
2195
+ const depthB = Number.isFinite(b.depth) ? b.depth : 0;
2196
+ return depthA - depthB || a.label.localeCompare(b.label);
2197
+ });
2198
+ for (const item of items) {
2199
+ const startBlocked = item.incoming.filter((row2) => !row2.met && row2.hold === "start");
2200
+ const mergeBlocked = item.incoming.filter((row2) => !row2.met && row2.hold === "merge");
2201
+ const settled = item.outgoing.length > 0 && item.outgoing.every((row2) => row2.met) && startBlocked.length === 0 && mergeBlocked.length === 0;
2202
+ if (startBlocked.length > 0) {
2203
+ const edge = startBlocked[0];
2204
+ waiting.push({
2205
+ target: item.target,
2206
+ label: item.label,
2207
+ detail: `${edge.waitsOnLabel} must be ${gateName(edge)} before this can start`
2208
+ });
2209
+ } else if (!settled) {
2210
+ const pending = item.outgoing.find((row2) => !row2.met);
2211
+ start.push({
2212
+ target: item.target,
2213
+ label: item.label,
2214
+ detail: pending ? `Start this so it can reach ${pending.gate === "in-prod" ? "production" : "main"}` : "Start this"
2215
+ });
2216
+ }
2217
+ if (mergeBlocked.length > 0 && startBlocked.length === 0) {
2218
+ const edge = mergeBlocked[0];
2219
+ mergeHeld.push({
2220
+ target: item.target,
2221
+ label: item.label,
2222
+ detail: `Do not merge until ${edge.waitsOnLabel} is ${gateName(edge)}`
2223
+ });
2224
+ }
2225
+ }
2226
+ return { start, waiting, mergeHeld };
2101
2227
  }
2102
2228
  function orderEdgeTouches(edge, you) {
2103
2229
  return orderTargetMatches(edge.subject, you) || orderTargetMatches(edge.waitsOn, you);
@@ -2118,7 +2244,7 @@ function formatOrderText(rows, plan) {
2118
2244
  rows.forEach((row2, index) => {
2119
2245
  const gate = row2.gate === "in-prod" ? "in prod" : "in main";
2120
2246
  const hold = row2.hold === "merge" ? "merge" : "start";
2121
- const state = row2.loop ? "loop" : row2.met ? "clear" : "waiting";
2247
+ const state = row2.loop ? "loop" : row2.met ? "clear" : row2.hold === "merge" ? "merge" : "waiting";
2122
2248
  lines.push(
2123
2249
  row2.loop ? `${index + 1}. ${state} ${row2.subjectLabel} returns to ${row2.waitsOnLabel} once it is ${gate}` : `${index + 1}. ${state} ${row2.waitsOnLabel} must be ${gate} before ${row2.subjectLabel} can ${hold}`
2124
2250
  );
@@ -2126,6 +2252,17 @@ function formatOrderText(rows, plan) {
2126
2252
  if (row2.note) lines.push(` ${row2.note}`);
2127
2253
  lines.push(` id: ${row2.id.slice(0, 8)}`);
2128
2254
  });
2255
+ if (plan?.status === "active") {
2256
+ const slice = executionSlice(rows);
2257
+ const section = (title, items) => {
2258
+ if (!items.length) return;
2259
+ lines.push("", title);
2260
+ for (const item of items) lines.push(`- ${item.label}. ${item.detail}`);
2261
+ };
2262
+ section("Start now:", slice.start);
2263
+ section("Do not start:", slice.waiting);
2264
+ section("Do not merge:", slice.mergeHeld);
2265
+ }
2129
2266
  return lines.join("\n");
2130
2267
  }
2131
2268
  function escapeHtml(value) {
@@ -2158,6 +2295,15 @@ function markWorkingChains(chains, threads) {
2158
2295
  })
2159
2296
  }));
2160
2297
  }
2298
+ function waterfallBar(node, chain) {
2299
+ const gating = node.incoming.filter((edge) => !edge.loop);
2300
+ const startBlocked = gating.some((edge) => !edge.met && edge.hold === "start");
2301
+ const outgoing = chain.nodes.flatMap((other) => other.incoming).filter((edge) => edge.fromKey === node.key && !edge.loop);
2302
+ const settled = outgoing.length > 0 && outgoing.every((edge) => edge.met) && !startBlocked;
2303
+ if (startBlocked) return " waiting";
2304
+ if (settled || gating.length > 0 && gating.every((edge) => edge.met)) return " clear";
2305
+ return " start";
2306
+ }
2161
2307
  function nodeIsYou(node, you) {
2162
2308
  if (!you) return false;
2163
2309
  return orderTargetMatches(
@@ -2173,20 +2319,20 @@ function formatWaterfallHtml(chains, opts) {
2173
2319
  const plan = opts?.plan ?? null;
2174
2320
  const you = opts?.you ?? null;
2175
2321
  const title = plan?.title?.trim() || "Planner";
2176
- const status = plan ? plan.status === "active" ? "Running. Ready steps can start. Waiting steps stay held." : "Draft. Discuss this and change it. Nothing runs until you agree." : "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
2322
+ const watch2 = chains.length ? planWatchCopy(chains) : "";
2323
+ const status = plan ? plan.status === "active" ? watch2 || "Running. Start the steps that are free. Leave held steps alone." : watch2 ? `Draft. Nothing runs until you agree. ${watch2}` : "Draft. Discuss this and change it. Nothing runs until you agree." : watch2 || "Later steps wait until the one above reaches its gate. In main clears when that pull request is merged. In production stays waiting until it is marked.";
2177
2324
  const body = chains.length === 0 ? '<p class="empty">No order yet.</p>' : chains.map((chain) => {
2178
2325
  const nodes = chain.nodes.map((node) => {
2179
- const waiting = node.incoming.some((edge) => !edge.met && !edge.loop);
2180
- const clear = node.incoming.some((edge) => !edge.loop) && !waiting;
2181
2326
  const yours = nodeIsYou(node, you);
2182
2327
  const working = node.working === true;
2183
- const state = `${waiting ? " waiting" : clear ? " clear" : ""}${yours ? " you" : ""}${working ? " current" : ""}`;
2328
+ const bar = waterfallBar(node, chain);
2329
+ const state = `${working ? " current" : ""}${bar}${yours ? " you" : ""}`;
2184
2330
  const drops = node.incoming.map((edge) => {
2185
2331
  const tone = edge.loop ? "loop" : edge.met ? "clear" : "waiting";
2186
2332
  const note = edge.note ? `<span>${escapeHtml(edge.note)}</span>` : "";
2187
2333
  return `<div class="drop"><span>After ${escapeHtml(edge.fromLabel)} is ${escapeHtml(gatePhrase(edge.gate))}, this ${escapeHtml(holdPhrase(edge.hold))}</span><span class="${tone}">${escapeHtml(edge.detail)}</span>${note}</div>`;
2188
2334
  }).join("");
2189
- const kicker = `${WATERFALL_KIND[node.kind]}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
2335
+ const kicker = `${WATERFALL_KIND[node.kind]}${bar === " start" ? " \xB7 Start" : ""}${working ? " \xB7 Working" : ""}${yours ? " \xB7 You" : ""}`;
2190
2336
  return `<li class="node" style="margin-left:${node.depth * 28}px">${drops}<div class="bar${state}"><span class="kicker">${kicker}</span><strong>${escapeHtml(node.label)}</strong></div></li>`;
2191
2337
  }).join("");
2192
2338
  return `<ol class="chain">${nodes}</ol>`;
@@ -2209,6 +2355,7 @@ h1 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
2209
2355
  .bar { border: 1px solid #333; border-radius: 10px; padding: 10px 12px; background: #1c1c1c; display: flex; flex-direction: column; gap: 2px; }
2210
2356
  .bar.waiting { border-color: #6a5420; background: #221c10; }
2211
2357
  .bar.clear { border-color: #2d5a32; background: #142016; }
2358
+ .bar.start { border-color: #2a4a7a; background: #141c28; }
2212
2359
  .bar.you { outline: 1px solid #8ab4ff; }
2213
2360
  .bar.current { border-color: #8ab4ff; box-shadow: inset 3px 0 0 #8ab4ff; }
2214
2361
  .bar.current .kicker { color: #ececec; }
@@ -2420,7 +2567,7 @@ function executeOrderPlan(ownerThreadId) {
2420
2567
  const ids = new Set(edges.map((edge) => edge.id));
2421
2568
  const rows = resolveOrchestrationGates(file.plans, file.edges, threadSnapshots(), file.marks);
2422
2569
  const slice = executionSlice(rows.filter((row2) => ids.has(row2.id)));
2423
- return { plan, ready: slice.ready, waiting: slice.waiting };
2570
+ return { plan, start: slice.start, waiting: slice.waiting, mergeHeld: slice.mergeHeld };
2424
2571
  }
2425
2572
  function listOrderEdges() {
2426
2573
  return readFile().edges;
@@ -3480,11 +3627,12 @@ function listPhoneHistory(opts) {
3480
3627
  updatedAt: historyStamp(thread),
3481
3628
  where: isGlobalThread(thread) ? "Orchestration" : repoName(thread.repoPath),
3482
3629
  agent: thread.agent,
3630
+ ...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
3483
3631
  ...workspace ? { workspace } : {}
3484
3632
  };
3485
3633
  }).filter((chat) => {
3486
3634
  if (!query) return true;
3487
- return `${chat.title} ${chat.where} ${chat.agent} ${chat.workspace ?? ""} ${chat.preview}`.toLowerCase().includes(query);
3635
+ return `${chat.title} ${chat.where} ${chat.agent} ${chat.acpHarness ?? ""} ${chat.workspace ?? ""} ${chat.preview}`.toLowerCase().includes(query);
3488
3636
  });
3489
3637
  let start = 0;
3490
3638
  if (after) {
@@ -3501,10 +3649,116 @@ function listPhoneHistory(opts) {
3501
3649
  };
3502
3650
  }
3503
3651
 
3652
+ // src/remote/phone-create.ts
3653
+ function phoneAcpHarness(agent, raw) {
3654
+ if (agent !== "acp") return null;
3655
+ if (raw === "gemini" || raw === "copilot") return raw;
3656
+ return defaultAcpHarness();
3657
+ }
3658
+ function draftAgentOptions(draft, defaults) {
3659
+ const agent = draft?.agent ?? defaults.agent;
3660
+ return {
3661
+ agent,
3662
+ acpHarness: phoneAcpHarness(agent, draft?.acpHarness),
3663
+ model: draft && "model" in draft ? draft.model ?? null : defaults.model,
3664
+ effort: draft?.effort ?? defaults.effort,
3665
+ fast: draft?.fast ?? defaults.fast,
3666
+ planMode: Boolean(draft?.planMode),
3667
+ autonomy: draft?.autonomy ?? defaults.autonomy
3668
+ };
3669
+ }
3670
+ function createPhoneChat(agent) {
3671
+ const defaults = resolveOrchestratorDefaults();
3672
+ const thread = createGlobalChat({
3673
+ agent: agent ?? defaults.agent,
3674
+ model: defaults.model,
3675
+ effort: defaults.effort,
3676
+ fast: defaults.fast
3677
+ });
3678
+ return openedFrom(thread, { kind: "orchestration" });
3679
+ }
3680
+ async function createPhoneOrchestration(draft) {
3681
+ const goal = (draft?.goal ?? draft?.prompt ?? "").trim();
3682
+ const attachments = phoneTurnAttachments(draft ?? {});
3683
+ if (!goal && attachments.length === 0) return createPhoneChat(draft?.agent);
3684
+ const defaults = resolveOrchestratorDefaults();
3685
+ const options = draftAgentOptions(draft, defaults);
3686
+ const thread = await startOrchestration({
3687
+ goal: goal || "See the attached files.",
3688
+ agent: options.agent,
3689
+ model: options.model,
3690
+ effort: options.effort,
3691
+ fast: options.fast,
3692
+ planMode: options.planMode,
3693
+ autonomy: options.autonomy,
3694
+ attachments
3695
+ });
3696
+ return openedFrom(thread, { kind: "orchestration" });
3697
+ }
3698
+ function createPhoneWorktreeAgent(fromChatId, draft) {
3699
+ const source = readPhoneThread(fromChatId);
3700
+ if (!source || isGlobalThread(source)) throw new Error("That worktree is not on this Mac.");
3701
+ const defaults = resolveNewThreadOptions();
3702
+ const options = draftAgentOptions(draft, defaults);
3703
+ const attachments = persistPendingFileAttachments(
3704
+ source.worktreePath,
3705
+ phoneTurnAttachments(draft ?? {})
3706
+ );
3707
+ const thread = createChatTab({
3708
+ fromThreadId: source.id,
3709
+ agent: options.agent,
3710
+ ...options.agent === "acp" ? { acpHarness: options.acpHarness ?? void 0 } : {},
3711
+ model: options.model,
3712
+ effort: options.effort,
3713
+ fast: options.fast,
3714
+ autonomy: options.autonomy,
3715
+ attachments
3716
+ });
3717
+ if (draft?.planMode !== void 0) updateThread(thread.id, { planMode: draft.planMode });
3718
+ return openedFrom(thread, projectPlace(readThread(thread.id) ?? thread));
3719
+ }
3720
+ async function createPhoneProjectWorktree(repoPathOrInput) {
3721
+ const input = typeof repoPathOrInput === "string" ? { repoPath: repoPathOrInput } : repoPathOrInput;
3722
+ const path2 = assertKnownProject(input.repoPath);
3723
+ const defaults = resolveNewThreadOptions();
3724
+ const options = draftAgentOptions(input, defaults);
3725
+ const thread = await createThread({
3726
+ sourceType: input.sourceType ?? "branch",
3727
+ sourceRef: input.sourceRef || "default",
3728
+ repoPath: path2,
3729
+ title: input.title,
3730
+ cowboy: input.cowboy,
3731
+ agent: options.agent,
3732
+ ...options.agent === "acp" ? { acpHarness: options.acpHarness ?? void 0 } : {},
3733
+ model: options.model,
3734
+ effort: options.effort,
3735
+ fast: options.fast,
3736
+ planMode: options.planMode,
3737
+ autonomy: options.autonomy,
3738
+ attachments: phoneTurnAttachments(input),
3739
+ prompt: input.prompt,
3740
+ reuseExisting: false
3741
+ });
3742
+ return openedFrom(thread, projectPlace(thread));
3743
+ }
3744
+ async function listPhoneModels(agent) {
3745
+ const catalogs = await listModelsForAgent(agent);
3746
+ return (catalogs[0]?.models ?? []).slice(0, 40).map((model) => ({
3747
+ id: model.id,
3748
+ label: model.displayName || model.id
3749
+ }));
3750
+ }
3751
+ function archivePhoneChat(chatId) {
3752
+ const thread = readPhoneThread(chatId);
3753
+ if (!thread) return false;
3754
+ updateThread(thread.id, { status: "archived" });
3755
+ return true;
3756
+ }
3757
+
3504
3758
  // src/remote/phone-chats.ts
3505
3759
  var PHONE_CONTROL_PREFIX = "\0sb.phone\n";
3506
3760
  var PREVIEW_LIMIT2 = 90;
3507
- var AGENT_KINDS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "brightsy", "cursor"]);
3761
+ var AGENT_KINDS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
3508
3762
  var MAX_PHONE_FILES = 8;
3509
3763
  var MAX_PHONE_FILE_CHARS = Math.ceil(8 * 1024 * 1024 * 4 / 3);
3510
3764
  var MAX_PHONE_FILES_CHARS = Math.ceil(20 * 1024 * 1024 * 4 / 3);
@@ -3619,6 +3873,12 @@ function parsePhoneDraft(value) {
3619
3873
  if (!agent) return "invalid";
3620
3874
  draft.agent = agent;
3621
3875
  }
3876
+ if ("acpHarness" in value) {
3877
+ const harness = value.acpHarness;
3878
+ if (harness === null || harness === "") draft.acpHarness = null;
3879
+ else if (harness === "gemini" || harness === "copilot") draft.acpHarness = harness;
3880
+ else return "invalid";
3881
+ }
3622
3882
  if ("model" in value) {
3623
3883
  const model = value.model;
3624
3884
  if (model === null || model === "") draft.model = null;
@@ -3741,6 +4001,7 @@ function summarize(thread) {
3741
4001
  preview: previewOf2(thread),
3742
4002
  updatedAt: thread.updatedAt,
3743
4003
  agent: thread.agent,
4004
+ ...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
3744
4005
  ...pr?.url ? { prUrl: pr.url } : {},
3745
4006
  ...pr?.number ? { prNumber: pr.number } : {},
3746
4007
  ...pr?.status ? { prStatus: pr.status } : {},
@@ -3817,6 +4078,7 @@ function readPhoneThread(chatId) {
3817
4078
  function phoneComposerOptions(thread) {
3818
4079
  return {
3819
4080
  agent: thread.agent,
4081
+ ...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
3820
4082
  model: thread.model ?? null,
3821
4083
  effort: thread.effort,
3822
4084
  fast: Boolean(thread.fast),
@@ -3875,101 +4137,6 @@ function assertKnownProject(repoPath) {
3875
4137
  if (!known) throw new Error("That project is not on this Mac.");
3876
4138
  return path2;
3877
4139
  }
3878
- function draftAgentOptions(draft, defaults) {
3879
- return {
3880
- agent: draft?.agent ?? defaults.agent,
3881
- model: draft && "model" in draft ? draft.model ?? null : defaults.model,
3882
- effort: draft?.effort ?? defaults.effort,
3883
- fast: draft?.fast ?? defaults.fast,
3884
- planMode: Boolean(draft?.planMode),
3885
- autonomy: draft?.autonomy ?? defaults.autonomy
3886
- };
3887
- }
3888
- function createPhoneChat(agent) {
3889
- const defaults = resolveOrchestratorDefaults();
3890
- const thread = createGlobalChat({
3891
- agent: agent ?? defaults.agent,
3892
- model: defaults.model,
3893
- effort: defaults.effort,
3894
- fast: defaults.fast
3895
- });
3896
- return openedFrom(thread, { kind: "orchestration" });
3897
- }
3898
- async function createPhoneOrchestration(draft) {
3899
- const goal = (draft?.goal ?? draft?.prompt ?? "").trim();
3900
- const attachments = phoneTurnAttachments(draft ?? {});
3901
- if (!goal && attachments.length === 0) return createPhoneChat(draft?.agent);
3902
- const defaults = resolveOrchestratorDefaults();
3903
- const options = draftAgentOptions(draft, defaults);
3904
- const thread = await startOrchestration({
3905
- goal: goal || "See the attached files.",
3906
- agent: options.agent,
3907
- model: options.model,
3908
- effort: options.effort,
3909
- fast: options.fast,
3910
- planMode: options.planMode,
3911
- autonomy: options.autonomy,
3912
- attachments
3913
- });
3914
- return openedFrom(thread, { kind: "orchestration" });
3915
- }
3916
- function createPhoneWorktreeAgent(fromChatId, draft) {
3917
- const source = readPhoneThread(fromChatId);
3918
- if (!source || isGlobalThread(source)) throw new Error("That worktree is not on this Mac.");
3919
- const defaults = resolveNewThreadOptions();
3920
- const options = draftAgentOptions(draft, defaults);
3921
- const attachments = persistPendingFileAttachments(
3922
- source.worktreePath,
3923
- phoneTurnAttachments(draft ?? {})
3924
- );
3925
- const thread = createChatTab({
3926
- fromThreadId: source.id,
3927
- agent: options.agent,
3928
- model: options.model,
3929
- effort: options.effort,
3930
- fast: options.fast,
3931
- autonomy: options.autonomy,
3932
- attachments
3933
- });
3934
- if (draft?.planMode !== void 0) updateThread(thread.id, { planMode: draft.planMode });
3935
- return openedFrom(thread, projectPlace(readThread(thread.id) ?? thread));
3936
- }
3937
- async function createPhoneProjectWorktree(repoPathOrInput) {
3938
- const input = typeof repoPathOrInput === "string" ? { repoPath: repoPathOrInput } : repoPathOrInput;
3939
- const path2 = assertKnownProject(input.repoPath);
3940
- const defaults = resolveNewThreadOptions();
3941
- const options = draftAgentOptions(input, defaults);
3942
- const thread = await createThread({
3943
- sourceType: input.sourceType ?? "branch",
3944
- sourceRef: input.sourceRef || "default",
3945
- repoPath: path2,
3946
- title: input.title,
3947
- cowboy: input.cowboy,
3948
- agent: options.agent,
3949
- model: options.model,
3950
- effort: options.effort,
3951
- fast: options.fast,
3952
- planMode: options.planMode,
3953
- autonomy: options.autonomy,
3954
- attachments: phoneTurnAttachments(input),
3955
- prompt: input.prompt,
3956
- reuseExisting: false
3957
- });
3958
- return openedFrom(thread, projectPlace(thread));
3959
- }
3960
- async function listPhoneModels(agent) {
3961
- const catalogs = await listModelsForAgent(agent);
3962
- return (catalogs[0]?.models ?? []).slice(0, 40).map((model) => ({
3963
- id: model.id,
3964
- label: model.displayName || model.id
3965
- }));
3966
- }
3967
- function archivePhoneChat(chatId) {
3968
- const thread = readPhoneThread(chatId);
3969
- if (!thread) return false;
3970
- updateThread(thread.id, { status: "archived" });
3971
- return true;
3972
- }
3973
4140
 
3974
4141
  // src/orchestrator/outbound-turn-reply.ts
3975
4142
  function outboundReplyFromTurn(result, copy) {
@@ -5433,6 +5600,8 @@ function publishOpenedChat(opts, chatId) {
5433
5600
  function applyPhoneOptions(chatId, draft) {
5434
5601
  const patch = {};
5435
5602
  if (draft.agent) patch.agent = draft.agent;
5603
+ if (draft.acpHarness !== void 0) patch.acpHarness = draft.acpHarness;
5604
+ else if (draft.agent) patch.acpHarness = draft.agent === "acp" ? "gemini" : null;
5436
5605
  if ("model" in draft) patch.model = draft.model ?? null;
5437
5606
  if (draft.effort) patch.effort = draft.effort;
5438
5607
  if (draft.fast !== void 0) patch.fast = draft.fast;
@@ -5823,6 +5992,7 @@ function chatKey(row2) {
5823
5992
  row2.title,
5824
5993
  row2.status,
5825
5994
  row2.agent,
5995
+ row2.acpHarness ?? "",
5826
5996
  row2.preview,
5827
5997
  row2.needsYou ? "1" : "0",
5828
5998
  row2.blockedReason ?? ""
@@ -6144,12 +6314,12 @@ function runRemoteHost(opts) {
6144
6314
  refreshViewerLogin: () => refreshPhoneViewerLogin(true)
6145
6315
  });
6146
6316
  };
6147
- const send3 = (msg) => {
6317
+ const send4 = (msg) => {
6148
6318
  if (!socket || socket.readyState !== socket.OPEN) return;
6149
6319
  socket.send(JSON.stringify(msg));
6150
6320
  };
6151
6321
  const sendRegister = () => {
6152
- send3({
6322
+ send4({
6153
6323
  type: "host_register",
6154
6324
  deviceId: opts.deviceId,
6155
6325
  deviceLabel,
@@ -6214,11 +6384,11 @@ function runRemoteHost(opts) {
6214
6384
  log(`Remote connected \xB7 ${deviceLabel}`);
6215
6385
  opts.onStatus?.({ connected: true, phoneConnected: false });
6216
6386
  sendRegister();
6217
- if (wantPair) send3({ type: "host_pair" });
6387
+ if (wantPair) send4({ type: "host_pair" });
6218
6388
  keepalive = createRemoteKeepalive({
6219
6389
  intervalMs: opts.pingIntervalMs ?? REMOTE_PING_INTERVAL_MS,
6220
6390
  pongTimeoutMs: opts.pongTimeoutMs ?? REMOTE_PONG_TIMEOUT_MS,
6221
- sendPing: () => send3({ type: "ping" }),
6391
+ sendPing: () => send4({ type: "ping" }),
6222
6392
  onTimeout: () => {
6223
6393
  log("remote error: ping timeout");
6224
6394
  finish(new Error("remote ping timeout"));
@@ -6270,8 +6440,8 @@ function runRemoteHost(opts) {
6270
6440
  clientPublicKey: msg.clientPublicKey,
6271
6441
  clientNonce: msg.clientNonce
6272
6442
  });
6273
- if (ready) send3({ type: "e2ee_ready", ...ready });
6274
- else send3({ type: "e2ee_fail" });
6443
+ if (ready) send4({ type: "e2ee_ready", ...ready });
6444
+ else send4({ type: "e2ee_fail" });
6275
6445
  return;
6276
6446
  }
6277
6447
  if (msg.type === "e2ee") {
@@ -6279,18 +6449,18 @@ function runRemoteHost(opts) {
6279
6449
  if (!opened) return;
6280
6450
  if (opened.reject) {
6281
6451
  hostSeal.reset();
6282
- send3({ type: "e2ee_fail" });
6452
+ send4({ type: "e2ee_fail" });
6283
6453
  return;
6284
6454
  }
6285
6455
  if (opened.okFrame) {
6286
- send3({ type: "e2ee", frame: opened.okFrame });
6456
+ send4({ type: "e2ee", frame: opened.okFrame });
6287
6457
  try {
6288
6458
  startBoardSync();
6289
6459
  } catch (err) {
6290
6460
  log(`remote error: ${err instanceof Error ? err.message : err}`);
6291
6461
  }
6292
6462
  opts.onPairingCode?.(null);
6293
- send3({ type: "pairing_done" });
6463
+ send4({ type: "pairing_done" });
6294
6464
  opts.onStatus?.({ connected: true, phoneConnected: true });
6295
6465
  log("phone joined");
6296
6466
  return;
@@ -6336,7 +6506,7 @@ function runRemoteHost(opts) {
6336
6506
  outbound.type === "assistant" ? { type: "assistant", text: outbound.text } : { type: "ask_user", text: outbound.text, questions: outbound.questions }
6337
6507
  );
6338
6508
  if (!frame) return;
6339
- send3({ type: "e2ee", frame });
6509
+ send4({ type: "e2ee", frame });
6340
6510
  };
6341
6511
  setPhonePermissionPush((chatId, prompt) => {
6342
6512
  if (getPhoneOpenChat() !== chatId) return;
@@ -6344,7 +6514,7 @@ function runRemoteHost(opts) {
6344
6514
  });
6345
6515
  const stopPush = hostedPushRelay(opts.url) ? startPhonePushWatch({
6346
6516
  enabled: () => Boolean(socket && socket.readyState === socket.OPEN),
6347
- send: (note) => send3({ type: "push_notify", chatId: note.chatId, kind: note.kind })
6517
+ send: (note) => send4({ type: "push_notify", chatId: note.chatId, kind: note.kind })
6348
6518
  }) : null;
6349
6519
  opts.signal?.addEventListener("abort", () => stopPush?.(), { once: true });
6350
6520
  void loop();
@@ -6352,7 +6522,7 @@ function runRemoteHost(opts) {
6352
6522
  requestPairingCode() {
6353
6523
  pendingPhoneToken = { token: generatePhoneToken(), expiresAt: Date.now() + PAIR_TTL_MS };
6354
6524
  wantPair = true;
6355
- send3({ type: "host_pair" });
6525
+ send4({ type: "host_pair" });
6356
6526
  },
6357
6527
  updateIdentity(label) {
6358
6528
  const next = label.trim();
@@ -8424,9 +8594,49 @@ async function tryServeStatic(req, res, root) {
8424
8594
 
8425
8595
  // src/remote/hub.ts
8426
8596
  import { randomBytes as randomBytes8 } from "crypto";
8597
+
8598
+ // src/remote/hub-forget.ts
8599
+ function dropForgottenMac(deviceId, hosts, remembered, codes, phonesByToken, bySocket, pushTokenBySocket) {
8600
+ const id = deviceId.trim();
8601
+ if (!id) return;
8602
+ remembered.delete(id);
8603
+ for (const [code, row2] of codes) {
8604
+ if (row2.deviceId === id) codes.delete(code);
8605
+ }
8606
+ for (const [token, session] of phonesByToken) {
8607
+ if (session.deviceId === id) phonesByToken.delete(token);
8608
+ }
8609
+ const host = hosts.get(id);
8610
+ if (!host) return;
8611
+ const phone = host.phone;
8612
+ hosts.delete(id);
8613
+ bySocket.delete(host.socket);
8614
+ if (phone) {
8615
+ bySocket.delete(phone);
8616
+ pushTokenBySocket.delete(phone);
8617
+ send(phone, { type: "host_offline" });
8618
+ try {
8619
+ phone.close();
8620
+ } catch {
8621
+ }
8622
+ }
8623
+ send(host.socket, { type: "error", message: "This Mac was removed from the account." });
8624
+ try {
8625
+ host.socket.close();
8626
+ } catch {
8627
+ }
8628
+ }
8629
+ function send(socket, msg) {
8630
+ try {
8631
+ socket.send(JSON.stringify(msg));
8632
+ } catch {
8633
+ }
8634
+ }
8635
+
8636
+ // src/remote/hub.ts
8427
8637
  var CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
8428
8638
  var CODE_TTL_MS = 10 * 60 * 1e3;
8429
- function send(socket, msg) {
8639
+ function send2(socket, msg) {
8430
8640
  try {
8431
8641
  socket.send(JSON.stringify(msg));
8432
8642
  } catch {
@@ -8454,15 +8664,18 @@ var RemoteHub = class {
8454
8664
  handleClientMessage(socket, raw) {
8455
8665
  const msg = parseRemoteClientMessage(raw);
8456
8666
  if (!msg) {
8457
- send(socket, { type: "error", message: "invalid message" });
8667
+ send2(socket, { type: "error", message: "invalid message" });
8458
8668
  return;
8459
8669
  }
8460
8670
  if (msg.type === "ping") {
8461
- send(socket, { type: "pong" });
8671
+ send2(socket, { type: "pong" });
8462
8672
  return;
8463
8673
  }
8464
8674
  this.dispatch(socket, msg);
8465
8675
  }
8676
+ forgetDevice(deviceId) {
8677
+ dropForgottenMac(deviceId, this.hosts, this.remembered, this.codes, this.phonesByToken, this.bySocket, this.pushTokenBySocket);
8678
+ }
8466
8679
  detachSocket(socket) {
8467
8680
  const bound = this.bySocket.get(socket);
8468
8681
  if (!bound) return;
@@ -8471,7 +8684,7 @@ var RemoteHub = class {
8471
8684
  if (!host) return;
8472
8685
  if (bound.role === "host" && host.socket === socket) {
8473
8686
  if (host.phone) {
8474
- send(host.phone, { type: "host_offline" });
8687
+ send2(host.phone, { type: "host_offline" });
8475
8688
  this.bySocket.delete(host.phone);
8476
8689
  }
8477
8690
  this.hosts.delete(bound.deviceId);
@@ -8480,7 +8693,7 @@ var RemoteHub = class {
8480
8693
  if (bound.role === "phone" && host.phone === socket) {
8481
8694
  host.phone = null;
8482
8695
  this.pushTokenBySocket.delete(socket);
8483
- send(host.socket, { type: "phone_left" });
8696
+ send2(host.socket, { type: "phone_left" });
8484
8697
  }
8485
8698
  }
8486
8699
  dispatch(socket, msg) {
@@ -8533,36 +8746,36 @@ var RemoteHub = class {
8533
8746
  const bound = this.bySocket.get(socket);
8534
8747
  const host = bound ? this.hosts.get(bound.deviceId) : null;
8535
8748
  if (!bound || !host) {
8536
- send(socket, { type: "error", message: "pair this phone first" });
8749
+ send2(socket, { type: "error", message: "pair this phone first" });
8537
8750
  return;
8538
8751
  }
8539
8752
  if (bound.role === "phone") {
8540
8753
  if (host.phone !== socket || msg.type === "e2ee_ready" || msg.type === "e2ee_fail") {
8541
- send(socket, { type: "error", message: "pair this phone first" });
8754
+ send2(socket, { type: "error", message: "pair this phone first" });
8542
8755
  return;
8543
8756
  }
8544
- send(host.socket, msg);
8757
+ send2(host.socket, msg);
8545
8758
  return;
8546
8759
  }
8547
8760
  if (host.socket !== socket || !host.phone || msg.type === "e2ee_hello") return;
8548
8761
  if (msg.type === "e2ee_fail") {
8549
- send(host.phone, { type: "error", message: "phone session expired \u2014 pair again" });
8762
+ send2(host.phone, { type: "error", message: "phone session expired \u2014 pair again" });
8550
8763
  return;
8551
8764
  }
8552
- send(host.phone, msg);
8765
+ send2(host.phone, msg);
8553
8766
  }
8554
8767
  registerHost(socket, deviceId, deviceLabel, hostSecret, accountToken) {
8555
8768
  if (this.opts.authorizeHost) {
8556
8769
  const decision = this.opts.authorizeHost({ accountToken, deviceId, deviceLabel, hostSecret });
8557
8770
  if (!decision.ok) {
8558
- send(socket, { type: "error", message: decision.message });
8771
+ send2(socket, { type: "error", message: decision.message });
8559
8772
  return;
8560
8773
  }
8561
8774
  }
8562
8775
  const prior = this.remembered.get(deviceId);
8563
8776
  const existing = this.hosts.get(deviceId);
8564
8777
  if (prior && prior.hostSecret !== hostSecret || existing && existing.hostSecret !== hostSecret) {
8565
- send(socket, { type: "error", message: "host secret rejected" });
8778
+ send2(socket, { type: "error", message: "host secret rejected" });
8566
8779
  return;
8567
8780
  }
8568
8781
  if (existing && existing.socket !== socket) {
@@ -8572,7 +8785,7 @@ var RemoteHub = class {
8572
8785
  } catch {
8573
8786
  }
8574
8787
  if (existing.phone) {
8575
- send(existing.phone, { type: "host_offline" });
8788
+ send2(existing.phone, { type: "host_offline" });
8576
8789
  this.pushTokenBySocket.delete(existing.phone);
8577
8790
  this.bySocket.delete(existing.phone);
8578
8791
  }
@@ -8590,15 +8803,15 @@ var RemoteHub = class {
8590
8803
  this.hosts.set(deviceId, host);
8591
8804
  this.remembered.set(deviceId, { hostSecret, sessionToken, deviceLabel });
8592
8805
  this.bySocket.set(socket, { role: "host", deviceId });
8593
- send(socket, { type: "registered", deviceId, deviceLabel });
8594
- if (host.phone) send(socket, { type: "phone_joined" });
8806
+ send2(socket, { type: "registered", deviceId, deviceLabel });
8807
+ if (host.phone) send2(socket, { type: "phone_joined" });
8595
8808
  this.opts.onAuthorized?.(socket);
8596
8809
  }
8597
8810
  issueCode(socket) {
8598
8811
  const bound = this.bySocket.get(socket);
8599
8812
  const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
8600
8813
  if (!host || host.socket !== socket) {
8601
- send(socket, { type: "error", message: "register this Mac before pairing" });
8814
+ send2(socket, { type: "error", message: "register this Mac before pairing" });
8602
8815
  return;
8603
8816
  }
8604
8817
  for (const [code2, row2] of this.codes) {
@@ -8607,18 +8820,18 @@ var RemoteHub = class {
8607
8820
  const code = newCode();
8608
8821
  const expiresAt = Date.now() + CODE_TTL_MS;
8609
8822
  this.codes.set(code, { code, deviceId: host.deviceId, expiresAt });
8610
- send(socket, { type: "pairing_code", code, expiresAt });
8823
+ send2(socket, { type: "pairing_code", code, expiresAt });
8611
8824
  }
8612
8825
  pairPhone(socket, code) {
8613
8826
  const row2 = this.codes.get(code);
8614
8827
  if (!row2 || row2.expiresAt < Date.now()) {
8615
8828
  this.codes.delete(code);
8616
- send(socket, { type: "error", message: "pairing code expired" });
8829
+ send2(socket, { type: "error", message: "pairing code expired" });
8617
8830
  return;
8618
8831
  }
8619
8832
  const host = this.hosts.get(row2.deviceId);
8620
8833
  if (!host) {
8621
- send(socket, { type: "error", message: "Mac is offline" });
8834
+ send2(socket, { type: "error", message: "Mac is offline" });
8622
8835
  return;
8623
8836
  }
8624
8837
  this.attachPhone(socket, host, void 0, code);
@@ -8667,12 +8880,12 @@ var RemoteHub = class {
8667
8880
  resumePhone(socket, sessionToken) {
8668
8881
  const known = this.knownSession(sessionToken);
8669
8882
  if (!known) {
8670
- send(socket, { type: "error", message: "phone session expired \u2014 pair again" });
8883
+ send2(socket, { type: "error", message: "phone session expired \u2014 pair again" });
8671
8884
  return;
8672
8885
  }
8673
8886
  const host = this.hosts.get(known.deviceId);
8674
8887
  if (!host) {
8675
- send(socket, { type: "host_offline" });
8888
+ send2(socket, { type: "host_offline" });
8676
8889
  return;
8677
8890
  }
8678
8891
  this.attachPhone(socket, host, sessionToken);
@@ -8690,7 +8903,7 @@ var RemoteHub = class {
8690
8903
  };
8691
8904
  });
8692
8905
  if (hosts.some((host) => host.deviceId)) this.opts.onAuthorized?.(socket);
8693
- send(socket, { type: "hosts", hosts });
8906
+ send2(socket, { type: "hosts", hosts });
8694
8907
  }
8695
8908
  releasePhoneSocket(socket) {
8696
8909
  const bound = this.bySocket.get(socket);
@@ -8700,7 +8913,7 @@ var RemoteHub = class {
8700
8913
  if (prev?.phone === socket) {
8701
8914
  prev.phone = null;
8702
8915
  this.pushTokenBySocket.delete(socket);
8703
- send(prev.socket, { type: "phone_left" });
8916
+ send2(prev.socket, { type: "phone_left" });
8704
8917
  }
8705
8918
  }
8706
8919
  attachPhone(socket, host, sessionToken, pairingCode) {
@@ -8735,36 +8948,36 @@ var RemoteHub = class {
8735
8948
  if (created) this.opts.phoneSessions?.save(host.deviceId, token);
8736
8949
  this.bySocket.set(socket, { role: "phone", deviceId: host.deviceId });
8737
8950
  this.opts.onAuthorized?.(socket);
8738
- send(socket, {
8951
+ send2(socket, {
8739
8952
  type: "paired",
8740
8953
  deviceId: host.deviceId,
8741
8954
  deviceLabel: host.deviceLabel,
8742
8955
  sessionToken: token
8743
8956
  });
8744
- if (!already) send(host.socket, { type: "phone_joined" });
8957
+ if (!already) send2(host.socket, { type: "phone_joined" });
8745
8958
  }
8746
8959
  fromPhone(socket, msg) {
8747
8960
  const bound = this.bySocket.get(socket);
8748
8961
  const host = bound?.role === "phone" ? this.hosts.get(bound.deviceId) : null;
8749
8962
  if (!host || host.phone !== socket) {
8750
- send(socket, { type: "error", message: "pair this phone first" });
8963
+ send2(socket, { type: "error", message: "pair this phone first" });
8751
8964
  return;
8752
8965
  }
8753
8966
  if (msg.type === "stop") {
8754
- send(host.socket, { type: "stop" });
8967
+ send2(host.socket, { type: "stop" });
8755
8968
  return;
8756
8969
  }
8757
- send(host.socket, { type: "inbound", text: msg.text });
8970
+ send2(host.socket, { type: "inbound", text: msg.text });
8758
8971
  }
8759
8972
  fromHost(socket, msg) {
8760
8973
  const bound = this.bySocket.get(socket);
8761
8974
  const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
8762
8975
  if (!host || host.socket !== socket || !host.phone) return;
8763
8976
  if (msg.type === "assistant") {
8764
- send(host.phone, { type: "assistant", text: msg.text });
8977
+ send2(host.phone, { type: "assistant", text: msg.text });
8765
8978
  return;
8766
8979
  }
8767
- send(host.phone, { type: "ask_user", text: msg.text, questions: msg.questions });
8980
+ send2(host.phone, { type: "ask_user", text: msg.text, questions: msg.questions });
8768
8981
  }
8769
8982
  registerPush(socket, token, sessionTokens) {
8770
8983
  const deviceIds = [];
@@ -9025,6 +9238,47 @@ var RelayAccountStore = class {
9025
9238
  throw err;
9026
9239
  }
9027
9240
  }
9241
+ /**
9242
+ * Macs registered on the account that owns `accountToken`.
9243
+ * `null` means the credential is missing or no longer valid.
9244
+ */
9245
+ listMacs(accountToken) {
9246
+ const accountId = this.verifyCredential(accountToken);
9247
+ if (!accountId) return null;
9248
+ const rows = this.db.prepare(
9249
+ "SELECT device_id, device_label, created_at FROM devices WHERE account_id = ? ORDER BY created_at, device_id"
9250
+ ).all(accountId);
9251
+ return rows.map((row2) => ({
9252
+ deviceId: row2.device_id,
9253
+ deviceLabel: row2.device_label,
9254
+ createdAt: row2.created_at
9255
+ }));
9256
+ }
9257
+ /**
9258
+ * Remove one Mac from the signed-in account. The row no longer counts
9259
+ * toward the cap. The account and its other credentials stay.
9260
+ */
9261
+ forgetMac(accountToken, deviceId) {
9262
+ const id = deviceId.trim();
9263
+ const accountId = this.verifyCredential(accountToken);
9264
+ if (!accountId) return { ok: false, message: "sign in required" };
9265
+ if (!id) return { ok: false, message: "Mac not found" };
9266
+ this.db.exec("BEGIN");
9267
+ try {
9268
+ const device = this.db.prepare("SELECT account_id FROM devices WHERE device_id = ?").get(id);
9269
+ if (!device || device.account_id !== accountId) {
9270
+ this.db.exec("ROLLBACK");
9271
+ return { ok: false, message: "Mac not found" };
9272
+ }
9273
+ this.db.prepare("DELETE FROM push_tokens WHERE device_id = ?").run(id);
9274
+ this.db.prepare("DELETE FROM devices WHERE device_id = ?").run(id);
9275
+ this.db.exec("COMMIT");
9276
+ return { ok: true };
9277
+ } catch (err) {
9278
+ this.db.exec("ROLLBACK");
9279
+ throw err;
9280
+ }
9281
+ }
9028
9282
  /** Store a phone pairing when it is created. A later process looks it up on a memory miss. */
9029
9283
  savePhoneSession(deviceId, sessionToken) {
9030
9284
  const id = deviceId.trim();
@@ -9290,6 +9544,8 @@ var REMOTE_LOGIN_PATH = "/remote/login";
9290
9544
  var REMOTE_OAUTH_CALLBACK_PATH = "/remote/oauth/callback";
9291
9545
  var REMOTE_OAUTH_RESULT_PATH = "/remote/oauth/result";
9292
9546
  var REMOTE_LOGOUT_PATH = "/remote/logout";
9547
+ var REMOTE_MACS_PATH = "/remote/macs";
9548
+ var REMOTE_MACS_FORGET_PATH = "/remote/macs/forget";
9293
9549
  var STATE_RE = /^[A-Za-z0-9_-]{16,128}$/;
9294
9550
  var LOGIN_TTL_MS = 10 * 60 * 1e3;
9295
9551
  var EMPTY_AUTH = { codeVerifier: null, issuer: null };
@@ -9433,6 +9689,12 @@ function sendHtml2(res, status, title, body) {
9433
9689
  res.writeHead(status, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" });
9434
9690
  res.end(oauthReturnPage(title, body));
9435
9691
  }
9692
+ function bearerToken(req) {
9693
+ const header2 = req.headers.authorization;
9694
+ if (typeof header2 !== "string") return "";
9695
+ const match = /^Bearer\s+(\S+)/i.exec(header2.trim());
9696
+ return match?.[1]?.trim() ?? "";
9697
+ }
9436
9698
  async function handleRelayAccountHttp(opts) {
9437
9699
  const reqUrl = opts.req.url || "/";
9438
9700
  const path2 = reqUrl.split("?")[0];
@@ -9557,6 +9819,38 @@ async function handleRelayAccountHttp(opts) {
9557
9819
  });
9558
9820
  return true;
9559
9821
  }
9822
+ if (method === "GET" && path2 === REMOTE_MACS_PATH) {
9823
+ const macs = opts.store.listMacs(bearerToken(opts.req));
9824
+ if (!macs) {
9825
+ sendJson2(opts.res, 401, { ok: false, error: "sign in required" });
9826
+ return true;
9827
+ }
9828
+ sendJson2(opts.res, 200, { ok: true, macs });
9829
+ return true;
9830
+ }
9831
+ if (method === "POST" && path2 === REMOTE_MACS_FORGET_PATH) {
9832
+ let body;
9833
+ try {
9834
+ body = await readBody2(opts.req);
9835
+ } catch {
9836
+ sendJson2(opts.res, 400, { ok: false, error: "invalid request" });
9837
+ return true;
9838
+ }
9839
+ const token = (typeof body.accountToken === "string" ? body.accountToken.trim() : "") || bearerToken(opts.req);
9840
+ const deviceId = typeof body.deviceId === "string" ? body.deviceId : "";
9841
+ const result = opts.store.forgetMac(token, deviceId);
9842
+ if (!result.ok) {
9843
+ const status = result.message === "sign in required" ? 401 : 404;
9844
+ sendJson2(opts.res, status, { ok: false, error: result.message });
9845
+ return true;
9846
+ }
9847
+ try {
9848
+ opts.onMacForgotten?.(deviceId.trim());
9849
+ } catch {
9850
+ }
9851
+ sendJson2(opts.res, 200, { ok: true });
9852
+ return true;
9853
+ }
9560
9854
  if (method === "POST" && path2 === REMOTE_LOGOUT_PATH) {
9561
9855
  let body;
9562
9856
  try {
@@ -9693,7 +9987,8 @@ async function startRelayServer(opts) {
9693
9987
  oauth: relayOAuth,
9694
9988
  sessions: accountSessions,
9695
9989
  publicOrigin: publicOrigin(),
9696
- fetchImpl: opts.fetchImpl
9990
+ fetchImpl: opts.fetchImpl,
9991
+ onMacForgotten: (deviceId) => remoteHub.forgetDevice(deviceId)
9697
9992
  })) {
9698
9993
  return;
9699
9994
  }
@@ -9961,7 +10256,7 @@ async function startHeadlessHost(opts) {
9961
10256
  };
9962
10257
  const refreshRunning = async () => {
9963
10258
  try {
9964
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
10259
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
9965
10260
  agentsRunning = getOrchestrator2().getRuntime().running;
9966
10261
  } catch {
9967
10262
  agentsRunning = 0;
@@ -10738,6 +11033,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
10738
11033
  sourceType: args.sourceType,
10739
11034
  sourceRef: args.sourceRef,
10740
11035
  agent: opts.agent,
11036
+ ...opts.agent === "acp" ? { acpHarness: args.acpHarness } : {},
10741
11037
  model: opts.model,
10742
11038
  effort: opts.effort,
10743
11039
  fast: opts.fast,
@@ -10762,6 +11058,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
10762
11058
  branchName: thread.branchName,
10763
11059
  worktreePath: thread.worktreePath,
10764
11060
  agent: thread.agent,
11061
+ ...thread.acpHarness ? { acpHarness: thread.acpHarness } : {},
10765
11062
  model: thread.model,
10766
11063
  status: thread.status,
10767
11064
  cowboy: Boolean(thread.cowboy),
@@ -12477,7 +12774,7 @@ function registerOrderTools(server) {
12477
12774
  );
12478
12775
  server.tool(
12479
12776
  "execute_plan",
12480
- "Mark the plan active after the user has seen it and told you to run it. Returns ready steps (start those with create_workspace or send_to_chat) and waiting steps (leave them alone). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
12777
+ "Mark the plan active after the user has seen it and told you to run it. Returns start (open or continue these, including the first step others wait on), waiting (hold=start is still unmet; leave them alone), and mergeHeld (work may proceed; do not merge). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
12481
12778
  {
12482
12779
  agreed: z9.literal(true).describe("True only after the user has seen the plan and told you to run it")
12483
12780
  },
@@ -12485,21 +12782,20 @@ function registerOrderTools(server) {
12485
12782
  try {
12486
12783
  const result = executeOrderPlan(orchestrationOwnerId(false));
12487
12784
  const brief = (row2) => ({
12488
- id: row2.id,
12489
- hold: row2.hold,
12490
- gate: row2.gate,
12491
- waitsOn: row2.waitsOnLabel,
12492
- subject: row2.subjectLabel,
12493
- detail: row2.detail,
12494
- ...row2.loop ? { loop: true } : {}
12785
+ kind: row2.target.kind,
12786
+ ref: row2.target.ref,
12787
+ ...row2.target.repoPath ? { repoPath: row2.target.repoPath } : {},
12788
+ label: row2.label,
12789
+ detail: row2.detail
12495
12790
  });
12496
12791
  return mcpJson({
12497
12792
  ok: true,
12498
12793
  status: result.plan.status,
12499
12794
  title: result.plan.title,
12500
- ready: result.ready.map(brief),
12795
+ start: result.start.map(brief),
12501
12796
  waiting: result.waiting.map(brief),
12502
- message: "Plan is active. Start ready steps with create_workspace or send_to_chat. Leave waiting steps alone. Merge only if the user asked."
12797
+ mergeHeld: result.mergeHeld.map(brief),
12798
+ message: "Plan is active. Start every step in start with create_workspace (kind pr or issue; pass repoPath when set) or send_to_chat (kind workspace or orchestration). create_workspace returns a checkout that already exists. Leave waiting alone. Steps in mergeHeld can proceed; do not merge them. Merge only if the user asked."
12503
12799
  });
12504
12800
  } catch (err) {
12505
12801
  return mcpJson({ error: err instanceof Error ? err.message : String(err) }, true);
@@ -12767,7 +13063,7 @@ async function handleJobStop(params, _ctx) {
12767
13063
  return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
12768
13064
  }
12769
13065
  async function defaultTurnWait(ref, timeoutMs) {
12770
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
13066
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
12771
13067
  const orch = getOrchestrator2();
12772
13068
  const thread = await orch.waitForTurn(ref, timeoutMs, {
12773
13069
  resolveIfStillRunning: true
@@ -13121,7 +13417,7 @@ async function startMcpServer() {
13121
13417
  );
13122
13418
  }
13123
13419
  try {
13124
- const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-SNOPJ7P5.js");
13420
+ const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-IA7ZZKWQ.js");
13125
13421
  orch.setMaxConcurrent(maxConcurrentAgents2());
13126
13422
  } catch {
13127
13423
  }
@@ -13701,7 +13997,7 @@ async function startMcpServer() {
13701
13997
  if (!worktreeProfile) {
13702
13998
  registerConnectedIssueVendorTools(server);
13703
13999
  const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-ZNUEZGHB.js");
13704
- const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-SNOPJ7P5.js");
14000
+ const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-IA7ZZKWQ.js");
13705
14001
  const accountDefaults = resolveThreadDefaults2();
13706
14002
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
13707
14003
  server.tool(
@@ -13736,9 +14032,10 @@ async function startMcpServer() {
13736
14032
  {
13737
14033
  sourceType: z10.enum(["branch", "pr", "ticket"]),
13738
14034
  sourceRef: z10.string(),
13739
- agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
13740
- `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
14035
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]).optional().describe(
14036
+ `Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored. Pass agent=acp and acpHarness=gemini or copilot for Gemini CLI or Copilot CLI.`
13741
14037
  ),
14038
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini (Gemini CLI) or copilot (GitHub Copilot CLI)."),
13742
14039
  model: z10.string().nullable().optional().describe(
13743
14040
  `Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
13744
14041
  ),
@@ -14058,7 +14355,7 @@ async function startMcpServer() {
14058
14355
  }
14059
14356
  }
14060
14357
  );
14061
- const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
14358
+ const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
14062
14359
  server.tool(
14063
14360
  "list_models",
14064
14361
  "List models for an agent. Prefer Auto: do not call this unless you have a reason to pin a specific model (user request, cost/latency, capability). Omit agent to list all.",
@@ -14082,10 +14379,11 @@ async function startMcpServer() {
14082
14379
  ref: z10.string().describe("Worktree thread id/ref to fork"),
14083
14380
  through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
14084
14381
  agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
14382
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
14085
14383
  model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
14086
14384
  title: z10.string().optional()
14087
14385
  },
14088
- async ({ ref, through_index, agent, model, title }) => {
14386
+ async ({ ref, through_index, agent, model, title, acpHarness }) => {
14089
14387
  try {
14090
14388
  const source = orch.getThread(ref);
14091
14389
  if (source) await orch.reconcile(source.repoPath, { drainQueues: false });
@@ -14093,6 +14391,7 @@ async function startMcpServer() {
14093
14391
  threadId: ref,
14094
14392
  throughIndex: through_index,
14095
14393
  agent,
14394
+ acpHarness,
14096
14395
  model,
14097
14396
  title
14098
14397
  });
@@ -14119,11 +14418,12 @@ async function startMcpServer() {
14119
14418
  {
14120
14419
  ref: z10.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
14121
14420
  through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
14122
- agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
14421
+ agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source). agent=acp with acpHarness=gemini or copilot opens Gemini CLI or Copilot CLI. An orchestration fork cannot use acp."),
14422
+ acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
14123
14423
  model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
14124
14424
  title: z10.string().optional()
14125
14425
  },
14126
- async ({ ref, through_index, agent, model, title }) => {
14426
+ async ({ ref, through_index, agent, model, title, acpHarness }) => {
14127
14427
  try {
14128
14428
  const source = orch.getThread(ref);
14129
14429
  if (!source) {
@@ -14136,6 +14436,7 @@ async function startMcpServer() {
14136
14436
  threadId: source.id,
14137
14437
  throughIndex: through_index,
14138
14438
  agent,
14439
+ acpHarness,
14139
14440
  model,
14140
14441
  title
14141
14442
  });
@@ -14188,7 +14489,7 @@ async function startMcpServer() {
14188
14489
  "Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
14189
14490
  {
14190
14491
  prompt: z10.string(),
14191
- agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"])),
14492
+ agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"])),
14192
14493
  repoPath: z10.string(),
14193
14494
  sourceType: z10.enum(["branch", "pr", "ticket"]).optional(),
14194
14495
  sourceRef: z10.string().optional(),
@@ -14333,7 +14634,7 @@ async function startMcpServer() {
14333
14634
  {
14334
14635
  repoPath: z10.string(),
14335
14636
  branches: z10.array(z10.string()).min(1),
14336
- agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]),
14637
+ agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]),
14337
14638
  base: z10.string().optional(),
14338
14639
  title: z10.string().optional()
14339
14640
  },
@@ -15348,7 +15649,7 @@ function wait3(ms, signal) {
15348
15649
  );
15349
15650
  });
15350
15651
  }
15351
- function send2(ws, msg) {
15652
+ function send3(ws, msg) {
15352
15653
  ws.send(JSON.stringify(msg));
15353
15654
  }
15354
15655
  async function runSlackRelayClient(opts) {
@@ -15458,7 +15759,7 @@ function connectSession2(ws, opts, log) {
15458
15759
  };
15459
15760
  const pingOnce = () => {
15460
15761
  try {
15461
- send2(ws, { type: "ping" });
15762
+ send3(ws, { type: "ping" });
15462
15763
  armPongTimeout();
15463
15764
  } catch (err) {
15464
15765
  finish(err instanceof Error ? err : new Error("relay ping failed"));
@@ -15468,7 +15769,7 @@ function connectSession2(ws, opts, log) {
15468
15769
  const label = opts.deviceLabel?.trim() || opts.deviceId.trim();
15469
15770
  log(`Relay connected \xB7 ${label}`);
15470
15771
  for (const wsInfo of opts.workspaces) {
15471
- send2(ws, {
15772
+ send3(ws, {
15472
15773
  type: "register",
15473
15774
  teamId: wsInfo.teamId,
15474
15775
  userId: wsInfo.userId,
@@ -15521,7 +15822,7 @@ function connectSession2(ws, opts, log) {
15521
15822
  return;
15522
15823
  }
15523
15824
  pending.set(msg.eventId, msg.message);
15524
- send2(ws, { type: "claim", eventId: msg.eventId });
15825
+ send3(ws, { type: "claim", eventId: msg.eventId });
15525
15826
  if (!relayAnswersClaims) {
15526
15827
  const eventId = msg.eventId;
15527
15828
  const timer = setTimeout(() => {
@@ -16194,13 +16495,13 @@ async function relayFetch(fetchImpl, url, init) {
16194
16495
  throw relayFetchError(err, url);
16195
16496
  }
16196
16497
  }
16197
- async function readJson4(res, url) {
16498
+ async function readJson4(res, url, what = "sign-in") {
16198
16499
  try {
16199
16500
  return await res.json();
16200
16501
  } catch {
16201
16502
  const kind = (res.headers.get("content-type") ?? "").includes("html") ? "an HTML page" : "a non-JSON body";
16202
16503
  throw new Error(
16203
- `Relay sign-in returned HTTP ${res.status} with ${kind} (${url}). A work proxy or allowlist often answers with a block page instead of the relay.`
16504
+ `Relay ${what} returned HTTP ${res.status} with ${kind} (${url}). A work proxy or allowlist often answers with a block page instead of the relay.`
16204
16505
  );
16205
16506
  }
16206
16507
  }
@@ -16267,6 +16568,44 @@ async function disconnectRemoteAccount(opts) {
16267
16568
  body: JSON.stringify({ accountToken: opts.accountToken })
16268
16569
  });
16269
16570
  }
16571
+ function macRows(value) {
16572
+ if (!Array.isArray(value)) return [];
16573
+ const macs = [];
16574
+ for (const row2 of value) {
16575
+ if (!row2 || typeof row2 !== "object") continue;
16576
+ const deviceId = "deviceId" in row2 && typeof row2.deviceId === "string" ? row2.deviceId.trim() : "";
16577
+ const deviceLabel = "deviceLabel" in row2 && typeof row2.deviceLabel === "string" ? row2.deviceLabel : "";
16578
+ const createdAt = "createdAt" in row2 && typeof row2.createdAt === "number" ? row2.createdAt : 0;
16579
+ if (!deviceId) continue;
16580
+ macs.push({ deviceId, deviceLabel, createdAt });
16581
+ }
16582
+ return macs;
16583
+ }
16584
+ async function listRemoteAccountMacs(opts) {
16585
+ const origin = (opts.origin ?? remoteAccountHttpOrigin()).replace(/\/+$/, "");
16586
+ const url = `${origin}${REMOTE_MACS_PATH}`;
16587
+ const res = await relayFetch(opts.fetchImpl, url, {
16588
+ headers: { Authorization: `Bearer ${opts.accountToken}` }
16589
+ });
16590
+ const body = await readJson4(res, url, "Mac list");
16591
+ if (!res.ok || !body.ok) {
16592
+ throw new Error(body.error || `Could not list Macs (HTTP ${res.status}).`);
16593
+ }
16594
+ return macRows(body.macs);
16595
+ }
16596
+ async function forgetRemoteAccountMac(opts) {
16597
+ const origin = (opts.origin ?? remoteAccountHttpOrigin()).replace(/\/+$/, "");
16598
+ const url = `${origin}${REMOTE_MACS_FORGET_PATH}`;
16599
+ const res = await relayFetch(opts.fetchImpl, url, {
16600
+ method: "POST",
16601
+ headers: { "Content-Type": "application/json" },
16602
+ body: JSON.stringify({ accountToken: opts.accountToken, deviceId: opts.deviceId })
16603
+ });
16604
+ const body = await readJson4(res, url, "forget Mac");
16605
+ if (!res.ok || !body.ok) {
16606
+ throw new Error(body.error || `Could not forget that Mac (HTTP ${res.status}).`);
16607
+ }
16608
+ }
16270
16609
 
16271
16610
  // src/slack/outbound-watch.ts
16272
16611
  import { existsSync as existsSync6, readFileSync as readFileSync8 } from "fs";
@@ -16345,7 +16684,7 @@ async function continueSourceThread(threadId, prompt) {
16345
16684
  await continueOnReply(threadId, prompt);
16346
16685
  return;
16347
16686
  }
16348
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
16687
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MUD4FY7Q.js");
16349
16688
  await getOrchestrator2().send(threadId, prompt);
16350
16689
  } catch {
16351
16690
  }
@@ -16616,6 +16955,8 @@ export {
16616
16955
  ABLETIME_ORG_KEY_PREFIX,
16617
16956
  ABLETIME_PAT_PREFIX,
16618
16957
  ABLETIME_PM_TOOL_NAMES,
16958
+ ACP_HARNESSES,
16959
+ ACP_HARNESS_IDS,
16619
16960
  AGENT_DONE_CUSTOM_SOUND_EXTENSIONS,
16620
16961
  AGENT_DONE_CUSTOM_SOUND_MAX_BYTES,
16621
16962
  AGENT_DONE_SOUNDS,
@@ -16781,6 +17122,12 @@ export {
16781
17122
  abletimeToolUsesPm,
16782
17123
  accountIdToPin,
16783
17124
  ackSlackInboundSeen,
17125
+ acpAdapter,
17126
+ acpHarnessDisplayName,
17127
+ acpHarnessLabel,
17128
+ acpHarnessLooksAuthenticated,
17129
+ acpHarnessStatus,
17130
+ acpRunnerPath,
16784
17131
  activeAccountId,
16785
17132
  activeRunPreview,
16786
17133
  addBoardPin,
@@ -16794,6 +17141,7 @@ export {
16794
17141
  agentDoneSoundsDir,
16795
17142
  agentGitPrompt,
16796
17143
  agentRpcConnectFromMetadata,
17144
+ agentSupportsAttach,
16797
17145
  alignQueueAttachments,
16798
17146
  allAdapters,
16799
17147
  allocatePort,
@@ -16955,6 +17303,7 @@ export {
16955
17303
  cursorIssuesUnavailableReason,
16956
17304
  cursorSdkMessageToEvents,
16957
17305
  decodeBrightsyTarget,
17306
+ defaultAcpHarness,
16958
17307
  defaultOrderSubject,
16959
17308
  defaultScheduleName,
16960
17309
  deleteBranchOnPurgeEnabled,
@@ -16963,6 +17312,8 @@ export {
16963
17312
  deleteThreadRecord,
16964
17313
  deriveTaskState,
16965
17314
  desktopHostPidPath,
17315
+ detectAcpHarness,
17316
+ detectAcpHarnesses,
16966
17317
  detectAgents,
16967
17318
  detectGhStack,
16968
17319
  detectLocalMergeConflicts,
@@ -17040,6 +17391,7 @@ export {
17040
17391
  flipLinearRelationType,
17041
17392
  foldLegacyRolesIntoNotes,
17042
17393
  followUpBehavior,
17394
+ forgetRemoteAccountMac,
17043
17395
  forkChatTab,
17044
17396
  forkMessageSlice,
17045
17397
  forkThreadWorktree,
@@ -17208,6 +17560,7 @@ export {
17208
17560
  isAbleTimeConnected,
17209
17561
  isAbleTimeOAuthCancelled,
17210
17562
  isAbleTimeRejectedCredential,
17563
+ isAcpHarnessId,
17211
17564
  isAdoptableRunScriptRequest,
17212
17565
  isAgentDoneSound,
17213
17566
  isAskUserToolName,
@@ -17340,6 +17693,7 @@ export {
17340
17693
  listOrderPlans,
17341
17694
  listOrderRows,
17342
17695
  listPrs,
17696
+ listRemoteAccountMacs,
17343
17697
  listRunScripts,
17344
17698
  listSchedules,
17345
17699
  listSlackOutboundWatches,
@@ -17537,6 +17891,7 @@ export {
17537
17891
  resolveAccountForThread,
17538
17892
  resolveAccountProfile,
17539
17893
  resolveAccountProfileFromSettings,
17894
+ resolveAcpHarnessCommand,
17540
17895
  resolveAgentExecutable,
17541
17896
  resolveAgentGitAuthEnv,
17542
17897
  resolveClaudeExecutable,