@sideboard-ai/core 0.1.349 → 0.1.350

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-P5QIV24I.js} +37 -7
  12. package/dist/{agents-AZ2PV6XP.js → agents-RGAV5OHD.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-Q4I6KDOL.js → chunk-2MESZ5XR.js} +60 -39
  16. package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
  17. package/dist/{chunk-WHMLMCPU.js → chunk-5AHWUJRT.js} +1925 -1722
  18. package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
  19. package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
  20. package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
  21. package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
  22. package/dist/chunk-BF6INES4.js +144 -0
  23. package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
  24. package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
  25. package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
  26. package/dist/{chunk-CATTIFSP.js → chunk-EZ2MUWNW.js} +3 -3
  27. package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
  28. package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
  29. package/dist/{chunk-3DBL2C45.js → chunk-FQ3JYUKI.js} +2 -2
  30. package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
  31. package/dist/{chunk-MHSBF3SO.js → chunk-LFSTOECH.js} +3 -3
  32. package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
  33. package/dist/{chunk-MVFFLU5V.js → chunk-MANERA6F.js} +12 -5
  34. package/dist/{chunk-ZXI5DR5S.js → chunk-NDEVAA34.js} +1624 -1487
  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-RPHH4FNK.js → chunk-TCEUNSLX.js} +3 -1
  38. package/dist/chunk-TRMPDDVL.js +232 -0
  39. package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
  40. package/dist/{chunk-QHXZKHUL.js → chunk-VHQ6OG3U.js} +2 -2
  41. package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
  42. package/dist/{chunk-IRFBD6GU.js → chunk-W5GHFT7E.js} +71 -47
  43. package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
  44. package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
  45. package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
  46. package/dist/chunk-YE7Z5WH3.js +142 -0
  47. package/dist/{chunk-ROXM6QZV.js → chunk-ZBSEJIOV.js} +12 -5
  48. package/dist/{conductor-NHC6X74J.js → conductor-HVOGBK63.js} +6 -5
  49. package/dist/{conductor-65VPUPOW.js → conductor-VGCXUUG6.js} +7 -6
  50. package/dist/connected-teams-2YDE2EZ2.js +1 -1
  51. package/dist/{coordinator-prompt-5GZWIVSY.js → coordinator-prompt-DPO7L2JO.js} +5 -5
  52. package/dist/{coordinator-prompt-R2PURZL3.js → coordinator-prompt-E736TJBS.js} +4 -4
  53. package/dist/{global-workspace-64KC7PST.js → global-workspace-4RDPAOTT.js} +5 -5
  54. package/dist/{global-workspace-UEECLWSX.js → global-workspace-TG2TVLUF.js} +4 -4
  55. package/dist/index.cjs +1600 -929
  56. package/dist/index.d.cts +132 -891
  57. package/dist/index.d.ts +132 -891
  58. package/dist/index.js +433 -207
  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 +1097 -720
  64. package/dist/mcp/run-stdio.js +32 -24
  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-Y5PYSMR6.js → orchestrator-3I2FLEZL.js} +17 -15
  68. package/dist/{orchestrator-I5G5A5BV.js → orchestrator-QDHZ56LA.js} +11 -10
  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-4PA24IX6.js} +4 -4
  74. package/dist/{workspaces-I2EHNTFE.js → workspaces-6TMYV4N2.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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  formatOptionalServicesDirectiveForTurn,
3
3
  formatOptionalServicesReminderForTurn
4
- } from "./chunk-IVRWRYTH.js";
4
+ } from "./chunk-BZK62VPT.js";
5
5
  import {
6
6
  extractPresentedPlan,
7
7
  isPresentPlanToolName,
@@ -21,7 +21,7 @@ import {
21
21
  parseSessionQuotaResetAt,
22
22
  planModeTurnInstruction,
23
23
  resolveQuotaFallbackAgent
24
- } from "./chunk-ZXI5DR5S.js";
24
+ } from "./chunk-NDEVAA34.js";
25
25
  import {
26
26
  applyWorktreePkgCacheEnv,
27
27
  buildBrightsySessionSeed,
@@ -56,7 +56,7 @@ import {
56
56
  worktreeDevProcessKey,
57
57
  worktreeRunProcessKey,
58
58
  worktreeSetupProcessKey
59
- } from "./chunk-ROXM6QZV.js";
59
+ } from "./chunk-ZBSEJIOV.js";
60
60
  import {
61
61
  applyAgentEvent,
62
62
  clipAgentEventForPaint,
@@ -72,9 +72,17 @@ import {
72
72
  stripBrightsyNdjsonNoise,
73
73
  toolDescription
74
74
  } from "./chunk-WWBPK7GB.js";
75
+ import {
76
+ defaultAcpHarness,
77
+ detectAcpHarness,
78
+ detectAcpHarnesses
79
+ } from "./chunk-YE7Z5WH3.js";
75
80
  import {
76
81
  titleFromPrompt
77
82
  } from "./chunk-7H655NEW.js";
83
+ import {
84
+ releaseCaffeinateHoldForThread
85
+ } from "./chunk-LAWLUOWQ.js";
78
86
  import {
79
87
  SLACK_REPLY_FORMATTING,
80
88
  addWorkspace,
@@ -101,7 +109,7 @@ import {
101
109
  stageAbsolutePathsAsAttachments,
102
110
  stageBuffersAsAttachments,
103
111
  syncWorkspacesFromThreads
104
- } from "./chunk-MHSBF3SO.js";
112
+ } from "./chunk-LFSTOECH.js";
105
113
  import {
106
114
  addPrStackLayer,
107
115
  allocateTeamSlug,
@@ -154,7 +162,7 @@ import {
154
162
  resolveRepoRoot,
155
163
  switchWorktreeBranch,
156
164
  withRepoGitLock
157
- } from "./chunk-3DBL2C45.js";
165
+ } from "./chunk-FQ3JYUKI.js";
158
166
  import {
159
167
  REVIEW_TAB_TITLE,
160
168
  agentNicknameFromWorktreePath,
@@ -190,7 +198,7 @@ import {
190
198
  worktreeNameFromPath,
191
199
  worktreeSlugForTicket,
192
200
  writeThread
193
- } from "./chunk-RPHH4FNK.js";
201
+ } from "./chunk-TCEUNSLX.js";
194
202
  import {
195
203
  askBlockStillWaiting,
196
204
  extractPendingPlanQuestions,
@@ -268,7 +276,10 @@ import {
268
276
  wakeOrchestratorOnGithubEdgesEnabled,
269
277
  withTurnScopedCost,
270
278
  writeViewerContext
271
- } from "./chunk-6WMNIX2U.js";
279
+ } from "./chunk-UFUAIVNV.js";
280
+ import {
281
+ writePrivateFile
282
+ } from "./chunk-JT7R45JB.js";
272
283
  import {
273
284
  examplePrefixedBranch,
274
285
  sanitizeGitBranchPrefix
@@ -279,12 +290,6 @@ import {
279
290
  nextManagedAccount,
280
291
  resolveAccountForThread
281
292
  } from "./chunk-KI45T4DI.js";
282
- import {
283
- releaseCaffeinateHoldForThread
284
- } from "./chunk-LAWLUOWQ.js";
285
- import {
286
- writePrivateFile
287
- } from "./chunk-JT7R45JB.js";
288
293
  import {
289
294
  annotateDevAccessRuns,
290
295
  appDataDir,
@@ -531,9 +536,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
531
536
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
532
537
  );
533
538
  }
534
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-64KC7PST.js");
539
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-4RDPAOTT.js");
535
540
  if (isGlobalThread2(thread)) {
536
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-5GZWIVSY.js");
541
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-DPO7L2JO.js");
537
542
  ensureGlobalCoordinatorCwd2(
538
543
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
539
544
  );
@@ -2576,14 +2581,16 @@ import { existsSync as existsSync5 } from "fs";
2576
2581
  async function detectAgents() {
2577
2582
  ensureAgentPath();
2578
2583
  enrichPathWithNpmGlobalBin();
2579
- return Promise.all(allAdapters().map((a) => a.detect()));
2584
+ const adapters = allAdapters().filter((adapter) => adapter.kind !== "acp");
2585
+ const rows = await Promise.all(adapters.map((adapter) => adapter.detect()));
2586
+ return [...rows, ...await detectAcpHarnesses()];
2580
2587
  }
2581
2588
  var REQUIRE_AGENT_TIMEOUT_MS = 8e3;
2582
2589
  async function requireAgent(agent, opts) {
2583
2590
  ensureAgentPath();
2584
2591
  enrichPathWithNpmGlobalBin();
2585
2592
  const status = await Promise.race([
2586
- getAdapter(agent).detect(),
2593
+ agent === "acp" ? detectAcpHarness(opts?.acpHarness ?? defaultAcpHarness()) : getAdapter(agent).detect(),
2587
2594
  new Promise((_, reject) => {
2588
2595
  setTimeout(() => {
2589
2596
  reject(
@@ -3398,9 +3405,10 @@ async function createThread(input, _onSetupLine) {
3398
3405
  fast: input.fast,
3399
3406
  autonomy: input.autonomy
3400
3407
  });
3401
- await requireAgent(resolved.agent);
3408
+ const acpHarness = resolved.agent === "acp" ? input.acpHarness === "gemini" || input.acpHarness === "copilot" ? input.acpHarness : defaultAcpHarness() : void 0;
3409
+ await requireAgent(resolved.agent, { acpHarness });
3402
3410
  if (input.cowboy) {
3403
- const { cowboyModeEnabled } = await import("./app-settings-SNOPJ7P5.js");
3411
+ const { cowboyModeEnabled } = await import("./app-settings-IA7ZZKWQ.js");
3404
3412
  if (!cowboyModeEnabled()) {
3405
3413
  throw new Error(
3406
3414
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3435,6 +3443,7 @@ async function createThread(input, _onSetupLine) {
3435
3443
  worktreePath: repoPath,
3436
3444
  repoPath,
3437
3445
  agent: resolved.agent,
3446
+ ...acpHarness ? { acpHarness } : {},
3438
3447
  autonomy: resolved.autonomy,
3439
3448
  model: resolved.model,
3440
3449
  effort: resolved.effort,
@@ -3459,7 +3468,7 @@ async function createThread(input, _onSetupLine) {
3459
3468
  let sourceIsFork = false;
3460
3469
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3461
3470
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3462
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-CGFJZB7L.js");
3471
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-TX7BTTR2.js");
3463
3472
  const task = await ensureAbleTimeTask({
3464
3473
  title: title?.trim() || "Untitled work",
3465
3474
  description: input.prompt?.trim() || void 0
@@ -3549,6 +3558,7 @@ async function createThread(input, _onSetupLine) {
3549
3558
  worktreePath,
3550
3559
  repoPath,
3551
3560
  agent: resolved.agent,
3561
+ ...acpHarness ? { acpHarness } : {},
3552
3562
  autonomy: resolved.autonomy,
3553
3563
  model: resolved.model,
3554
3564
  effort: resolved.effort,
@@ -3570,7 +3580,7 @@ async function createThread(input, _onSetupLine) {
3570
3580
  return readThread(thread.id) ?? thread;
3571
3581
  }
3572
3582
  async function listLinearIssues(agent, repoPath) {
3573
- const { getAdapter: getAdapter2 } = await import("./agents-AZ2PV6XP.js");
3583
+ const { getAdapter: getAdapter2 } = await import("./agents-RGAV5OHD.js");
3574
3584
  await requireAgent(agent, { requireLinear: true });
3575
3585
  const adapter = getAdapter2(agent);
3576
3586
  if (!adapter.listLinearIssues) {
@@ -3602,6 +3612,28 @@ function shouldRemoveWorktreeOnTeardown(thread) {
3602
3612
  return !isCowboyThread(thread) && !isPrimaryCheckoutThread(thread);
3603
3613
  }
3604
3614
 
3615
+ // src/orchestrator/thread-agent-patch.ts
3616
+ function applyThreadAgentPatch(thread, patch, next) {
3617
+ const agent = patch.agent ?? thread.agent;
3618
+ const harness = agent === "acp" ? patch.acpHarness === "gemini" || patch.acpHarness === "copilot" ? patch.acpHarness : thread.acpHarness === "gemini" || thread.acpHarness === "copilot" ? thread.acpHarness : defaultAcpHarness() : null;
3619
+ const providerChanged = agent !== thread.agent || agent === "acp" && harness !== (thread.acpHarness ?? null);
3620
+ if (providerChanged) {
3621
+ if (thread.messages.length > 0) {
3622
+ const from = thread.agent === "acp" ? thread.acpHarness === "copilot" ? "copilot" : "gemini" : thread.agent;
3623
+ const to = agent === "acp" ? harness === "copilot" ? "copilot" : "gemini" : agent;
3624
+ throw new Error(
3625
+ `Cannot switch agent provider mid-chat (${from} \u2192 ${to}). Start a new chat tab instead.`
3626
+ );
3627
+ }
3628
+ if (isOrchestratorThread(thread)) assertOrchestratorCapableAgent(agent);
3629
+ next.agent = agent;
3630
+ if (agent !== "claude" && patch.model === void 0) next.model = null;
3631
+ next.sessionId = null;
3632
+ }
3633
+ if (agent === "acp") next.acpHarness = harness;
3634
+ else if (thread.acpHarness) next.acpHarness = null;
3635
+ }
3636
+
3605
3637
  // src/archive/fleet-archive.ts
3606
3638
  import { basename as basename2 } from "path";
3607
3639
  var DEFAULT_LIMIT = 40;
@@ -4070,6 +4102,7 @@ async function forkThreadWorktree(input, onSetupLine) {
4070
4102
  sourceRef: from.branchName,
4071
4103
  repoPath: from.repoPath,
4072
4104
  agent: nextAgent,
4105
+ acpHarness: nextAgent === "acp" ? input.acpHarness === "gemini" || input.acpHarness === "copilot" ? input.acpHarness : from.acpHarness : void 0,
4073
4106
  autonomy: from.autonomy,
4074
4107
  model: nextModel,
4075
4108
  effort: from.effort,
@@ -4349,11 +4382,14 @@ async function adoptThread(input) {
4349
4382
  worktreePath: input.worktreePath,
4350
4383
  repoPath,
4351
4384
  agent: input.agent,
4385
+ ...input.agent === "acp" ? {
4386
+ acpHarness: input.acpHarness === "gemini" || input.acpHarness === "copilot" ? input.acpHarness : void 0
4387
+ } : {},
4352
4388
  sessionId: input.sessionId ?? null,
4353
4389
  messages: input.messages ?? []
4354
4390
  });
4355
4391
  writeThread(thread);
4356
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-I2EHNTFE.js");
4392
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-6TMYV4N2.js");
4357
4393
  await addWorkspace2(repoPath);
4358
4394
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-YQBN43QD.js");
4359
4395
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -7990,11 +8026,11 @@ function realDeps() {
7990
8026
  parentIdForThread,
7991
8027
  designatedId: designatedOrchestratorId,
7992
8028
  send: async (threadId, prompt) => {
7993
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
8029
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
7994
8030
  await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
7995
8031
  },
7996
8032
  startOrchestration: async (prompt) => {
7997
- const { startOrchestration: startOrchestration2 } = await import("./orchestrator-Y5PYSMR6.js");
8033
+ const { startOrchestration: startOrchestration2 } = await import("./orchestrator-3I2FLEZL.js");
7998
8034
  const defaults = resolveOrchestratorDefaults();
7999
8035
  await startOrchestration2({
8000
8036
  goal: prompt,
@@ -8021,7 +8057,7 @@ function formatScheduledPrompt(name, prompt) {
8021
8057
  ${prompt}`;
8022
8058
  }
8023
8059
  async function defaultDeps() {
8024
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-Y5PYSMR6.js");
8060
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-3I2FLEZL.js");
8025
8061
  const orch = getOrchestrator2();
8026
8062
  return {
8027
8063
  findThread: (id) => findThreadByRef(id),
@@ -8222,7 +8258,7 @@ ${item.prompt}`);
8222
8258
  }
8223
8259
  }
8224
8260
  async function defaultSend(id, prompt) {
8225
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
8261
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
8226
8262
  await getOrchestrator2().send(id, prompt, { followUp: "join" });
8227
8263
  }
8228
8264
  function armChatFollowUps() {
@@ -8447,7 +8483,7 @@ var Orchestrator = class {
8447
8483
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
8448
8484
  });
8449
8485
  }
8450
- const { autoCleanupOrphansEnabled } = await import("./app-settings-SNOPJ7P5.js");
8486
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-IA7ZZKWQ.js");
8451
8487
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
8452
8488
  await cleanupOrphanWorktrees({ repoPaths });
8453
8489
  }
@@ -8837,7 +8873,7 @@ var Orchestrator = class {
8837
8873
  }
8838
8874
  await setup;
8839
8875
  if (skipSetup) return;
8840
- const { autoRunAfterSetupEnabled } = await import("./app-settings-SNOPJ7P5.js");
8876
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-IA7ZZKWQ.js");
8841
8877
  if (autoRunAfterSetupEnabled()) {
8842
8878
  try {
8843
8879
  await this.startDev(threadId);
@@ -9221,7 +9257,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
9221
9257
  }
9222
9258
  const isBrightsy = fresh.agent === "brightsy";
9223
9259
  const isOrchestration = isOrchestratorThread(fresh);
9224
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-SNOPJ7P5.js");
9260
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-IA7ZZKWQ.js");
9225
9261
  const gitAuthMode = getGithubGitAuthMode();
9226
9262
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
9227
9263
  githubSlug: turnOrigin?.forge === "github" ? turnOrigin.slug : await withTimeout(resolveGithubRepoSlug(fresh.worktreePath), 8e3, "resolveGithubRepoSlug").catch(() => null),
@@ -10562,7 +10598,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10562
10598
  if (Object.keys(patch).length === 0) continue;
10563
10599
  updateThread(t.id, patch);
10564
10600
  }
10565
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-SNOPJ7P5.js");
10601
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-IA7ZZKWQ.js");
10566
10602
  const latest = this.requireThread(thread.id);
10567
10603
  if (!shouldAutoArchiveOnPrMerge({
10568
10604
  previousPrState: prevState || null,
@@ -10736,20 +10772,8 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10736
10772
  if (patch.fast !== void 0) next.fast = patch.fast;
10737
10773
  if (patch.planMode !== void 0) next.planMode = patch.planMode;
10738
10774
  if (patch.model !== void 0) next.model = patch.model;
10739
- if (patch.agent !== void 0) {
10740
- if (patch.agent !== thread.agent) {
10741
- if (thread.messages.length > 0) {
10742
- throw new Error(
10743
- `Cannot switch agent provider mid-chat (${thread.agent} \u2192 ${patch.agent}). Start a new chat tab instead.`
10744
- );
10745
- }
10746
- if (isOrchestratorThread(thread)) {
10747
- assertOrchestratorCapableAgent(patch.agent);
10748
- }
10749
- next.agent = patch.agent;
10750
- if (patch.agent !== "claude" && patch.model === void 0) next.model = null;
10751
- next.sessionId = null;
10752
- }
10775
+ if (patch.agent !== void 0 || patch.acpHarness !== void 0) {
10776
+ applyThreadAgentPatch(thread, patch, next);
10753
10777
  }
10754
10778
  return updateThread(thread.id, next);
10755
10779
  }
@@ -10886,7 +10910,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
10886
10910
  await runArchiveScript(thread.repoPath, thread.worktreePath);
10887
10911
  } catch {
10888
10912
  }
10889
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-SNOPJ7P5.js");
10913
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-IA7ZZKWQ.js");
10890
10914
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
10891
10915
  await removeWorktreeDroppingLeftovers(thread, deleteBranch ? thread.branchName : void 0);
10892
10916
  }
@@ -11023,7 +11047,7 @@ async function startOrchestration(opts) {
11023
11047
  sourceRef: "default",
11024
11048
  ...createOpts
11025
11049
  }).catch(async () => {
11026
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-M2GJGK2P.js");
11050
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-DA6SKIU5.js");
11027
11051
  const repo = await resolveRepoRoot2(repoPath);
11028
11052
  const def = await resolveDefaultBranch2(repo);
11029
11053
  return orch.createThread({
@@ -11033,7 +11057,7 @@ async function startOrchestration(opts) {
11033
11057
  repoPath: repo
11034
11058
  });
11035
11059
  });
11036
- const { updateThread: upd } = await import("./thread-store-HZ4U4OXB.js");
11060
+ const { updateThread: upd } = await import("./thread-store-4YTOV2HL.js");
11037
11061
  const updated = upd(thread.id, {
11038
11062
  sourceType: "orchestration",
11039
11063
  sourceRef: goal
@@ -2,7 +2,7 @@
2
2
  var LIST_TIMEOUT_MS = 15e3;
3
3
  async function listAssignedLinearIssues(opts) {
4
4
  try {
5
- const { listLinearIssuesDirect } = await import("./linear-MIJO6DCV.js");
5
+ const { listLinearIssuesDirect } = await import("./linear-WG23LBCX.js");
6
6
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
7
7
  let timer;
8
8
  try {
@@ -5,7 +5,7 @@
5
5
  var LIST_TIMEOUT_MS = 15e3;
6
6
  async function listAssignedLinearIssues(opts) {
7
7
  try {
8
- const { listLinearIssuesDirect } = await import("./linear-PKYJH4WK.js");
8
+ const { listLinearIssuesDirect } = await import("./linear-E3BX5PX5.js");
9
9
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
10
10
  let timer;
11
11
  try {
@@ -128,7 +128,7 @@ async function connectedCliPresence(integrations) {
128
128
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
129
129
  if (ids.length === 0) return void 0;
130
130
  try {
131
- const { optionalCliPresence } = await import("./optional-cli-4GTEDEYJ.js");
131
+ const { optionalCliPresence } = await import("./optional-cli-K6HX2X5O.js");
132
132
  return await optionalCliPresence(ids);
133
133
  } catch {
134
134
  return void 0;
@@ -0,0 +1,142 @@
1
+ import {
2
+ run
3
+ } from "./chunk-R4W4VQJZ.js";
4
+ import {
5
+ loadAppSettings
6
+ } from "./chunk-UFUAIVNV.js";
7
+
8
+ // src/agents/acp-harness.ts
9
+ import { existsSync, readFileSync } from "fs";
10
+ import { homedir } from "os";
11
+ import { join } from "path";
12
+ var ACP_HARNESSES = {
13
+ gemini: {
14
+ id: "gemini",
15
+ label: "Gemini CLI",
16
+ bin: "gemini",
17
+ args: ["--acp"],
18
+ npmPackage: "@google/gemini-cli",
19
+ installCommand: "npm install -g @google/gemini-cli",
20
+ loginCommand: "gemini",
21
+ docsUrl: "https://geminicli.com/docs/cli/acp-mode/",
22
+ authHint: "Gemini CLI is on PATH but no API key or ~/.gemini login was found. Set GEMINI_API_KEY or run `gemini` once to sign in."
23
+ },
24
+ copilot: {
25
+ id: "copilot",
26
+ label: "Copilot CLI",
27
+ bin: "copilot",
28
+ args: ["--acp", "--stdio"],
29
+ npmPackage: "@github/copilot",
30
+ installCommand: "npm install -g @github/copilot",
31
+ loginCommand: "copilot",
32
+ docsUrl: "https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server",
33
+ authHint: "Copilot CLI is on PATH but no GitHub login was found. Run `gh auth login` or `copilot`, or set GH_TOKEN."
34
+ }
35
+ };
36
+ var ACP_HARNESS_IDS = Object.keys(ACP_HARNESSES);
37
+ function isAcpHarnessId(value) {
38
+ return value === "gemini" || value === "copilot";
39
+ }
40
+ function acpHarnessLabel(id) {
41
+ if (isAcpHarnessId(id)) return ACP_HARNESSES[id].label;
42
+ return "ACP";
43
+ }
44
+ function defaultAcpHarness() {
45
+ const stored = loadAppSettings().defaults?.acpHarness;
46
+ return isAcpHarnessId(stored) ? stored : "gemini";
47
+ }
48
+ function agentSupportsAttach(agent) {
49
+ return agent !== "acp";
50
+ }
51
+ var AUTH_READ_MAX = 64e3;
52
+ function envSet(env, ...keys) {
53
+ return keys.some((key) => Boolean(env[key]?.trim()));
54
+ }
55
+ function fileMentionsCredential(path) {
56
+ try {
57
+ if (!existsSync(path)) return false;
58
+ const text = readFileSync(path, "utf8").slice(0, AUTH_READ_MAX);
59
+ return /"(access_token|refresh_token|oauth_token|api_key|apiKey)"\s*:/i.test(text) || /oauth_token\s*:/i.test(text);
60
+ } catch {
61
+ return false;
62
+ }
63
+ }
64
+ function acpHarnessLooksAuthenticated(id, env = process.env, home = homedir(), opts) {
65
+ if (id === "gemini") {
66
+ if (envSet(env, "GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_GENAI_API_KEY")) return true;
67
+ return fileMentionsCredential(join(home, ".gemini", "oauth_creds.json")) || fileMentionsCredential(join(home, ".gemini", "google_accounts.json"));
68
+ }
69
+ if (envSet(env, "COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN")) return true;
70
+ if (fileMentionsCredential(join(home, ".copilot", "config.json")) || fileMentionsCredential(join(home, ".config", "gh", "hosts.yml"))) {
71
+ return true;
72
+ }
73
+ return opts?.ghLoggedIn === true;
74
+ }
75
+ async function copilotGhLoggedIn() {
76
+ const status = await run("gh", ["auth", "status"], { reject: false, timeoutMs: 5e3 });
77
+ return status.exitCode === 0;
78
+ }
79
+ function acpHarnessStatus(input) {
80
+ const spec = ACP_HARNESSES[input.id];
81
+ if (!input.binPath) {
82
+ return {
83
+ agent: "acp",
84
+ acpHarness: input.id,
85
+ label: spec.label,
86
+ installed: false,
87
+ authenticated: false,
88
+ linearMcp: false,
89
+ warnings: [],
90
+ reason: `${spec.label} is not on PATH (\`${spec.bin}\`). ${spec.installCommand}`
91
+ };
92
+ }
93
+ const authenticated = acpHarnessLooksAuthenticated(
94
+ input.id,
95
+ input.env ?? process.env,
96
+ input.home ?? homedir(),
97
+ { ghLoggedIn: input.ghLoggedIn }
98
+ );
99
+ return {
100
+ agent: "acp",
101
+ acpHarness: input.id,
102
+ label: spec.label,
103
+ installed: true,
104
+ authenticated,
105
+ linearMcp: false,
106
+ warnings: [],
107
+ ...authenticated ? {} : { reason: spec.authHint }
108
+ };
109
+ }
110
+ async function resolveAcpHarnessCommand(id) {
111
+ const spec = ACP_HARNESSES[id];
112
+ const which = await run("which", [spec.bin], { reject: false, timeoutMs: 3e3 });
113
+ const file = which.exitCode === 0 ? which.stdout.trim().split("\n")[0]?.trim() ?? "" : "";
114
+ if (!file) {
115
+ throw new Error(`${spec.label} is not on PATH. ${spec.installCommand}`);
116
+ }
117
+ return { file, args: [...spec.args] };
118
+ }
119
+ async function detectAcpHarness(id) {
120
+ const spec = ACP_HARNESSES[id];
121
+ const which = await run("which", [spec.bin], { reject: false, timeoutMs: 3e3 });
122
+ const file = which.exitCode === 0 ? which.stdout.trim().split("\n")[0]?.trim() ?? "" : "";
123
+ const ghLoggedIn = id === "copilot" && file && !acpHarnessLooksAuthenticated(id) ? await copilotGhLoggedIn() : false;
124
+ return acpHarnessStatus({ id, binPath: file || null, ghLoggedIn });
125
+ }
126
+ async function detectAcpHarnesses() {
127
+ return Promise.all(ACP_HARNESS_IDS.map((id) => detectAcpHarness(id)));
128
+ }
129
+
130
+ export {
131
+ ACP_HARNESSES,
132
+ ACP_HARNESS_IDS,
133
+ isAcpHarnessId,
134
+ acpHarnessLabel,
135
+ defaultAcpHarness,
136
+ agentSupportsAttach,
137
+ acpHarnessLooksAuthenticated,
138
+ acpHarnessStatus,
139
+ resolveAcpHarnessCommand,
140
+ detectAcpHarness,
141
+ detectAcpHarnesses
142
+ };
@@ -3,16 +3,19 @@ import {
3
3
  isInternalAgentStatusText,
4
4
  lastAssistantMessageText
5
5
  } from "./chunk-WWBPK7GB.js";
6
+ import {
7
+ defaultAcpHarness
8
+ } from "./chunk-YE7Z5WH3.js";
6
9
  import {
7
10
  isCloudCoordinatorThread,
8
11
  isGlobalThread,
9
12
  isOrchestratorThread,
10
13
  isSlackCoordinatorThread
11
- } from "./chunk-MHSBF3SO.js";
14
+ } from "./chunk-LFSTOECH.js";
12
15
  import {
13
16
  mergeAgentGitAuthEnv,
14
17
  resolveAgentGitAuthEnv
15
- } from "./chunk-3DBL2C45.js";
18
+ } from "./chunk-FQ3JYUKI.js";
16
19
  import {
17
20
  REVIEW_TAB_TITLE,
18
21
  allocateTeamName,
@@ -24,7 +27,7 @@ import {
24
27
  updateThread,
25
28
  worktreeNameFromPath,
26
29
  writeThread
27
- } from "./chunk-RPHH4FNK.js";
30
+ } from "./chunk-TCEUNSLX.js";
28
31
  import {
29
32
  ensureWorktreeSideboardIgnored
30
33
  } from "./chunk-BMRJNRQK.js";
@@ -52,7 +55,7 @@ import {
52
55
  import {
53
56
  assertOrchestratorCapableAgent,
54
57
  contextTokens
55
- } from "./chunk-6WMNIX2U.js";
58
+ } from "./chunk-UFUAIVNV.js";
56
59
  import {
57
60
  stripNestedElectronEnv
58
61
  } from "./chunk-4TR3HZFT.js";
@@ -724,6 +727,7 @@ function workspaceAgentChatSummaries(worktreePath) {
724
727
  id: t.id,
725
728
  title: t.title,
726
729
  agent: t.agent,
730
+ ...t.acpHarness ? { acpHarness: t.acpHarness } : {},
727
731
  status: t.status,
728
732
  link: `sideboard://chat/${t.id}`,
729
733
  ...t.agentBlock?.reason ? { blockedReason: t.agentBlock.reason, blockedSource: t.agentBlock.source } : {}
@@ -752,6 +756,7 @@ function createChatTab(input) {
752
756
  const explicitTitle = input.title?.trim();
753
757
  const title = explicitTitle || allocateTeamName(takenTeamSlugsForChatTab(binding.worktreePath)).name;
754
758
  const nextAgent = input.agent ?? from.agent;
759
+ const nextHarness = nextAgent === "acp" ? input.acpHarness === "gemini" || input.acpHarness === "copilot" ? input.acpHarness : from.agent === "acp" && (from.acpHarness === "gemini" || from.acpHarness === "copilot") ? from.acpHarness : defaultAcpHarness() : void 0;
755
760
  if (isOrchestratorThread(from) || binding.sourceType === "orchestration") {
756
761
  assertOrchestratorCapableAgent(nextAgent);
757
762
  }
@@ -768,6 +773,7 @@ function createChatTab(input) {
768
773
  // the connected chat.
769
774
  sourceRef: singletonInbox ? title : binding.sourceRef,
770
775
  agent: nextAgent,
776
+ ...nextHarness ? { acpHarness: nextHarness } : {},
771
777
  model: input.model !== void 0 ? input.model : input.agent && input.agent !== from.agent ? null : from.model,
772
778
  effort: input.effort !== void 0 ? input.effort : from.effort,
773
779
  fast: input.fast !== void 0 ? Boolean(input.fast) : from.fast,
@@ -788,6 +794,7 @@ function forkChatTab(input) {
788
794
  const tab = createChatTab({
789
795
  fromThreadId: input.threadId,
790
796
  agent: input.agent ?? from.agent,
797
+ acpHarness: input.acpHarness,
791
798
  model: input.model,
792
799
  title: input.title?.trim() || void 0,
793
800
  attachments: [attachment]
@@ -1742,7 +1749,7 @@ var PORT_RANGE_SIZE = 10;
1742
1749
  var RECLAIM_RETRY_DELAY_MS = 40;
1743
1750
  var RECLAIM_TRIES = 8;
1744
1751
  async function killReclaimable(ports, worktreePath, signal) {
1745
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-65VPUPOW.js");
1752
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-VGCXUUG6.js");
1746
1753
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1747
1754
  else killListenersOnPorts2(ports);
1748
1755
  }
@@ -34,16 +34,17 @@ import {
34
34
  tryReservePort,
35
35
  tryReservePorts,
36
36
  worktreeRunPortsPath
37
- } from "./chunk-MVFFLU5V.js";
37
+ } from "./chunk-MANERA6F.js";
38
38
  import "./chunk-LESWJ7L4.js";
39
- import "./chunk-CATTIFSP.js";
40
- import "./chunk-QHXZKHUL.js";
39
+ import "./chunk-BF6INES4.js";
40
+ import "./chunk-EZ2MUWNW.js";
41
+ import "./chunk-VHQ6OG3U.js";
41
42
  import "./chunk-N2WW62LF.js";
42
43
  import "./chunk-GK7H3SY7.js";
43
44
  import "./chunk-TL2HK6LZ.js";
44
- import "./chunk-6RIPZ73M.js";
45
+ import "./chunk-SMSD6U3N.js";
45
46
  import "./chunk-WMZIANPV.js";
46
- import "./chunk-WWU4SYZR.js";
47
+ import "./chunk-VL6F2KRE.js";
47
48
  import "./chunk-NSTQ6QKD.js";
48
49
  import {
49
50
  stripNestedElectronEnv
@@ -32,11 +32,12 @@ import {
32
32
  tryReservePort,
33
33
  tryReservePorts,
34
34
  worktreeRunPortsPath
35
- } from "./chunk-ROXM6QZV.js";
35
+ } from "./chunk-ZBSEJIOV.js";
36
36
  import "./chunk-WWBPK7GB.js";
37
- import "./chunk-MHSBF3SO.js";
38
- import "./chunk-3DBL2C45.js";
39
- import "./chunk-RPHH4FNK.js";
37
+ import "./chunk-YE7Z5WH3.js";
38
+ import "./chunk-LFSTOECH.js";
39
+ import "./chunk-FQ3JYUKI.js";
40
+ import "./chunk-TCEUNSLX.js";
40
41
  import "./chunk-BMRJNRQK.js";
41
42
  import "./chunk-NJV5YEKI.js";
42
43
  import "./chunk-N6ZF3XRP.js";
@@ -44,13 +45,13 @@ import "./chunk-PWOFUPYM.js";
44
45
  import "./chunk-6K64FJDD.js";
45
46
  import "./chunk-LG6RJBIY.js";
46
47
  import "./chunk-R4W4VQJZ.js";
47
- import "./chunk-6WMNIX2U.js";
48
+ import "./chunk-UFUAIVNV.js";
49
+ import "./chunk-JT7R45JB.js";
48
50
  import {
49
51
  stripNestedElectronEnv
50
52
  } from "./chunk-4TR3HZFT.js";
51
53
  import "./chunk-WDRMZKVB.js";
52
54
  import "./chunk-KI45T4DI.js";
53
- import "./chunk-JT7R45JB.js";
54
55
  import {
55
56
  hasConductorHook,
56
57
  hasRepoHook,
@@ -8,7 +8,7 @@ import {
8
8
  ensureConnectedBrightsyTeamTokens,
9
9
  getConnectedBrightsyTeamsRaw,
10
10
  listConnectedBrightsyTeams
11
- } from "./chunk-XOEKCE6L.js";
11
+ } from "./chunk-OHXNGBC4.js";
12
12
  import "./chunk-RSA47QYR.js";
13
13
  import "./chunk-JAT3JFOS.js";
14
14
  import "./chunk-R4W4VQJZ.js";