@sideboard-ai/core 0.1.348 → 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 (84) 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/cursor-runner.js +3 -3
  12. package/dist/{agents-T4XBZZDA.js → agents-P5QIV24I.js} +38 -8
  13. package/dist/{agents-5MFGVK7C.js → agents-RGAV5OHD.js} +44 -13
  14. package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
  15. package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
  16. package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
  17. package/dist/{chunk-OH3BAUMC.js → chunk-2MESZ5XR.js} +273 -84
  18. package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
  19. package/dist/{chunk-Y6VQX2LY.js → chunk-5AHWUJRT.js} +1927 -1718
  20. package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
  21. package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
  22. package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
  23. package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
  24. package/dist/chunk-BF6INES4.js +144 -0
  25. package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
  26. package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
  27. package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
  28. package/dist/{chunk-6TV6L2DD.js → chunk-EZ2MUWNW.js} +7 -6
  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-NTY5WGRD.js → chunk-FQ3JYUKI.js} +2 -2
  32. package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
  33. package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
  34. package/dist/{chunk-XNGW4OYD.js → chunk-LFSTOECH.js} +7 -6
  35. package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
  36. package/dist/{chunk-ZJMYCDYQ.js → chunk-MANERA6F.js} +55 -10
  37. package/dist/{chunk-Q4TZA4MN.js → chunk-NDEVAA34.js} +1629 -1486
  38. package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
  39. package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
  40. package/dist/{chunk-MOUAM6ZC.js → chunk-SMSD6U3N.js} +135 -3
  41. package/dist/{chunk-ATS7SYHG.js → chunk-TCEUNSLX.js} +135 -3
  42. package/dist/chunk-TRMPDDVL.js +232 -0
  43. package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
  44. package/dist/{chunk-2HPVGTHF.js → chunk-VHQ6OG3U.js} +2 -2
  45. package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
  46. package/dist/{chunk-WMD77UCY.js → chunk-W5GHFT7E.js} +279 -87
  47. package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
  48. package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
  49. package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
  50. package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
  51. package/dist/chunk-YE7Z5WH3.js +142 -0
  52. package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
  53. package/dist/{chunk-GAGTEI6B.js → chunk-ZBSEJIOV.js} +56 -11
  54. package/dist/{conductor-LYQKONSA.js → conductor-HVOGBK63.js} +7 -6
  55. package/dist/{conductor-EMGMDNHL.js → conductor-VGCXUUG6.js} +9 -8
  56. package/dist/connected-teams-2YDE2EZ2.js +1 -1
  57. package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-DPO7L2JO.js} +5 -5
  58. package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-E736TJBS.js} +4 -4
  59. package/dist/{global-workspace-UG2A3CEM.js → global-workspace-4RDPAOTT.js} +5 -5
  60. package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-TG2TVLUF.js} +4 -4
  61. package/dist/index.cjs +2881 -1761
  62. package/dist/index.d.cts +140 -877
  63. package/dist/index.d.ts +140 -877
  64. package/dist/index.js +865 -559
  65. package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
  66. package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
  67. package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
  68. package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
  69. package/dist/mcp/run-stdio.cjs +2112 -1287
  70. package/dist/mcp/run-stdio.js +318 -230
  71. package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
  72. package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
  73. package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-3I2FLEZL.js} +20 -18
  74. package/dist/{orchestrator-4SXTORD2.js → orchestrator-QDHZ56LA.js} +12 -11
  75. package/dist/thread-CJRchYLj.d.cts +856 -0
  76. package/dist/thread-CJRchYLj.d.ts +856 -0
  77. package/dist/{thread-store-R3G5VBII.js → thread-store-4YTOV2HL.js} +3 -3
  78. package/dist/{thread-store-MEUWZDVV.js → thread-store-LME2ICZP.js} +2 -2
  79. package/dist/{workspaces-KWGTP7DI.js → workspaces-4PA24IX6.js} +4 -4
  80. package/dist/{workspaces-35T6FW57.js → workspaces-6TMYV4N2.js} +5 -5
  81. package/dist/{worktree-ROJXGBWS.js → worktree-4ATMCYIE.js} +3 -3
  82. package/dist/{worktree-5P7SCST3.js → worktree-DA6SKIU5.js} +4 -4
  83. package/package.json +3 -3
  84. /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
@@ -436,6 +436,7 @@ export {
436
436
  summarizeTurnStderr,
437
437
  looksLikeInvalidAgentSession,
438
438
  looksLikeBrightsyEmptyCompletion,
439
+ looksLikeRetryableRunnerCrash,
439
440
  shouldRetryFailedAgentTurn,
440
441
  looksLikeAgentFailureMessage,
441
442
  fallbackTurnFailDetail,
@@ -2,11 +2,11 @@ import {
2
2
  OPTIONAL_SERVICES,
3
3
  isOptionalServiceId,
4
4
  optionalServiceSpec
5
- } from "./chunk-IVRWRYTH.js";
5
+ } from "./chunk-BZK62VPT.js";
6
6
  import {
7
7
  installNpmGlobalPackage,
8
8
  whichOnPath
9
- } from "./chunk-4NXGVJA6.js";
9
+ } from "./chunk-F4RFFE2H.js";
10
10
  import {
11
11
  enrichPathWithNpmGlobalBin
12
12
  } from "./chunk-R4W4VQJZ.js";
@@ -9,7 +9,7 @@ import {
9
9
  isOrchestratorCapableAgent,
10
10
  normalizeThinkingEffort,
11
11
  updateAdvancedSettings
12
- } from "./chunk-WWU4SYZR.js";
12
+ } from "./chunk-VL6F2KRE.js";
13
13
  import {
14
14
  writePrivateFile
15
15
  } from "./chunk-NSTQ6QKD.js";
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-WOU343SI.js";
22
22
 
23
23
  // src/store/thread-store.ts
24
- import { randomUUID as randomUUID2 } from "crypto";
24
+ import { randomUUID as randomUUID3 } from "crypto";
25
25
 
26
26
  // src/review/review-write-gate.ts
27
27
  var REVIEW_TAB_TITLE = "Review";
@@ -1471,6 +1471,130 @@ function recordScheduleRun(id, result) {
1471
1471
  return next;
1472
1472
  }
1473
1473
 
1474
+ // src/threads/chat-follow-ups.ts
1475
+ import { randomUUID as randomUUID2 } from "crypto";
1476
+ var MAX_CHAT_FOLLOW_UPS = 10;
1477
+ var DEFAULT_FOLLOW_UP_DEADLINE_MS = 7 * 24 * 60 * 60 * 1e3;
1478
+ function ciChecksSettled(checks) {
1479
+ if (!checks) return "none";
1480
+ if (checks.length === 0) return "none";
1481
+ if (checks.some((check) => (check.bucket ?? "pending") === "pending")) return "pending";
1482
+ return "done";
1483
+ }
1484
+ function parseFollowUpAt(raw, now) {
1485
+ const text = raw.trim();
1486
+ const rel = /^(\d+)(m|h|d)$/i.exec(text);
1487
+ if (rel) {
1488
+ const n = Number(rel[1]);
1489
+ if (!Number.isFinite(n) || n <= 0) return null;
1490
+ const unit = rel[2].toLowerCase();
1491
+ const ms2 = unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5;
1492
+ return new Date(now.getTime() + n * ms2).toISOString();
1493
+ }
1494
+ const ms = Date.parse(text);
1495
+ if (!Number.isFinite(ms)) return null;
1496
+ return new Date(ms).toISOString();
1497
+ }
1498
+ function normalizeChatFollowUps(raw) {
1499
+ if (!Array.isArray(raw)) return [];
1500
+ const out = [];
1501
+ for (const item of raw) {
1502
+ if (!item || typeof item !== "object") continue;
1503
+ const row = item;
1504
+ if (row.kind !== "ci" && row.kind !== "at") continue;
1505
+ if (typeof row.prompt !== "string" || !row.prompt.trim()) continue;
1506
+ if (typeof row.deadline !== "string" || !row.deadline.trim()) continue;
1507
+ if (typeof row.createdAt !== "string" || !row.createdAt.trim()) continue;
1508
+ if (typeof row.id !== "string" || !row.id.trim()) continue;
1509
+ const baseline = row.ciBaseline;
1510
+ const followUp = {
1511
+ id: row.id.trim(),
1512
+ kind: row.kind,
1513
+ prompt: row.prompt.trim(),
1514
+ deadline: row.deadline.trim(),
1515
+ createdAt: row.createdAt.trim()
1516
+ };
1517
+ if (typeof row.at === "string" && row.at.trim()) followUp.at = row.at.trim();
1518
+ if (baseline === "pending" || baseline === "done" || baseline === "none" || baseline === "unknown") {
1519
+ followUp.ciBaseline = baseline;
1520
+ }
1521
+ if (row.ciSawPending === true) followUp.ciSawPending = true;
1522
+ out.push(followUp);
1523
+ if (out.length >= MAX_CHAT_FOLLOW_UPS) break;
1524
+ }
1525
+ return out;
1526
+ }
1527
+ function addChatFollowUp(existing, draft, now) {
1528
+ if (existing.length >= MAX_CHAT_FOLLOW_UPS) {
1529
+ return { ok: false, error: "This chat already has 10 follow-ups." };
1530
+ }
1531
+ const prompt = draft.prompt.trim();
1532
+ if (!prompt) return { ok: false, error: "prompt is required" };
1533
+ let at;
1534
+ let deadline;
1535
+ if (draft.kind === "at") {
1536
+ if (!draft.at?.trim()) return { ok: false, error: "at is required for a time follow-up" };
1537
+ const parsed = parseFollowUpAt(draft.at, now);
1538
+ if (!parsed) return { ok: false, error: "at must be 30m, 2h, 1d, or an ISO time" };
1539
+ at = parsed;
1540
+ deadline = draft.deadline?.trim() ? parseFollowUpAt(draft.deadline, now) ?? "" : parsed;
1541
+ if (!deadline) return { ok: false, error: "deadline must be 30m, 2h, 1d, or an ISO time" };
1542
+ } else {
1543
+ deadline = draft.deadline?.trim() ? parseFollowUpAt(draft.deadline, now) ?? "" : new Date(now.getTime() + DEFAULT_FOLLOW_UP_DEADLINE_MS).toISOString();
1544
+ if (!deadline) return { ok: false, error: "deadline must be 30m, 2h, 1d, or an ISO time" };
1545
+ }
1546
+ const followUp = {
1547
+ id: randomUUID2(),
1548
+ kind: draft.kind,
1549
+ prompt,
1550
+ deadline,
1551
+ createdAt: now.toISOString(),
1552
+ ...at ? { at } : {},
1553
+ ...draft.kind === "ci" && draft.ciBaseline ? { ciBaseline: draft.ciBaseline } : {}
1554
+ };
1555
+ return { ok: true, followUps: [...existing, followUp] };
1556
+ }
1557
+ function decideFollowUps(input) {
1558
+ const fire = [];
1559
+ const keep = [];
1560
+ const nowMs = input.now.getTime();
1561
+ for (const item of input.followUps) {
1562
+ if (item.kind === "at") {
1563
+ const atMs = Date.parse(item.at ?? item.deadline);
1564
+ if (Number.isFinite(atMs) && nowMs >= atMs) fire.push(item);
1565
+ else keep.push(item);
1566
+ continue;
1567
+ }
1568
+ const sawPending = item.ciSawPending === true || input.ci === "pending" || item.ciBaseline === "pending";
1569
+ const next = sawPending ? { ...item, ciSawPending: true } : item;
1570
+ const alreadyFinished = item.ciBaseline === "done" && item.ciSawPending !== true && input.ci === "done";
1571
+ const baselineCanFinish = item.ciBaseline === "pending" || item.ciBaseline === "none" || item.ciSawPending === true;
1572
+ const ready = input.ci === "done" && !alreadyFinished && baselineCanFinish;
1573
+ if (ready) {
1574
+ fire.push(item);
1575
+ continue;
1576
+ }
1577
+ const deadlineMs = Date.parse(item.deadline);
1578
+ if (Number.isFinite(deadlineMs) && nowMs >= deadlineMs) continue;
1579
+ keep.push(next);
1580
+ }
1581
+ return { fire, keep };
1582
+ }
1583
+ function mergeFollowUpPoll(input) {
1584
+ const fired = new Set(input.firedIds);
1585
+ const keepById = new Map(input.keep.map((item) => [item.id, item]));
1586
+ const beforeIds = new Set(input.before.map((item) => item.id));
1587
+ return input.after.flatMap((item) => {
1588
+ if (fired.has(item.id)) return [];
1589
+ const fromPoll = keepById.get(item.id);
1590
+ if (beforeIds.has(item.id) && !fromPoll) return [];
1591
+ if (fromPoll?.ciSawPending && item.ciSawPending !== true) {
1592
+ return [{ ...item, ciSawPending: true }];
1593
+ }
1594
+ return [item];
1595
+ });
1596
+ }
1597
+
1474
1598
  // src/store/thread-store.ts
1475
1599
  function nowIso2() {
1476
1600
  return (/* @__PURE__ */ new Date()).toISOString();
@@ -1523,6 +1647,7 @@ function normalizeThread(raw) {
1523
1647
  return {
1524
1648
  ...raw,
1525
1649
  model: raw.model ?? null,
1650
+ acpHarness: raw.acpHarness === "gemini" || raw.acpHarness === "copilot" ? raw.acpHarness : void 0,
1526
1651
  effort: resolveThreadEffort(raw),
1527
1652
  fast: Boolean(raw.fast),
1528
1653
  planMode: Boolean(raw.planMode),
@@ -1545,6 +1670,7 @@ function normalizeThread(raw) {
1545
1670
  prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
1546
1671
  prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
1547
1672
  wakeOnGithubEdges: raw.wakeOnGithubEdges === true ? true : void 0,
1673
+ followUps: normalizeChatFollowUps(raw.followUps),
1548
1674
  issueBlockedBy: sanitizeIssueBlockedBy(raw.issueBlockedBy),
1549
1675
  skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
1550
1676
  cowboy: Boolean(raw.cowboy),
@@ -1564,7 +1690,7 @@ function normalizeThread(raw) {
1564
1690
  function createEmptyThread(partial) {
1565
1691
  const ts = nowIso2();
1566
1692
  return {
1567
- id: randomUUID2(),
1693
+ id: randomUUID3(),
1568
1694
  sessionId: partial.sessionId ?? null,
1569
1695
  autonomy: partial.autonomy ?? "default",
1570
1696
  model: partial.model ?? null,
@@ -1610,6 +1736,7 @@ function createEmptyThread(partial) {
1610
1736
  worktreePath: partial.worktreePath,
1611
1737
  repoPath: partial.repoPath,
1612
1738
  agent: partial.agent,
1739
+ ...partial.acpHarness === "gemini" || partial.acpHarness === "copilot" ? { acpHarness: partial.acpHarness } : {},
1613
1740
  lastError: null,
1614
1741
  agentPid: null,
1615
1742
  agentPidStartedAt: null,
@@ -1805,6 +1932,11 @@ export {
1805
1932
  updateSchedule,
1806
1933
  deleteSchedule,
1807
1934
  recordScheduleRun,
1935
+ ciChecksSettled,
1936
+ normalizeChatFollowUps,
1937
+ addChatFollowUp,
1938
+ decideFollowUps,
1939
+ mergeFollowUpPoll,
1808
1940
  resolveThreadEffort,
1809
1941
  normalizeThread,
1810
1942
  createEmptyThread,
@@ -10,7 +10,7 @@ import {
10
10
  isOrchestratorCapableAgent,
11
11
  normalizeThinkingEffort,
12
12
  updateAdvancedSettings
13
- } from "./chunk-6WMNIX2U.js";
13
+ } from "./chunk-UFUAIVNV.js";
14
14
  import {
15
15
  writePrivateFile
16
16
  } from "./chunk-JT7R45JB.js";
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-H4UEFJRI.js";
23
23
 
24
24
  // src/store/thread-store.ts
25
- import { randomUUID as randomUUID2 } from "crypto";
25
+ import { randomUUID as randomUUID3 } from "crypto";
26
26
 
27
27
  // src/review/review-write-gate.ts
28
28
  var REVIEW_TAB_TITLE = "Review";
@@ -1490,6 +1490,130 @@ function recordScheduleRun(id, result) {
1490
1490
  return next;
1491
1491
  }
1492
1492
 
1493
+ // src/threads/chat-follow-ups.ts
1494
+ import { randomUUID as randomUUID2 } from "crypto";
1495
+ var MAX_CHAT_FOLLOW_UPS = 10;
1496
+ var DEFAULT_FOLLOW_UP_DEADLINE_MS = 7 * 24 * 60 * 60 * 1e3;
1497
+ function ciChecksSettled(checks) {
1498
+ if (!checks) return "none";
1499
+ if (checks.length === 0) return "none";
1500
+ if (checks.some((check) => (check.bucket ?? "pending") === "pending")) return "pending";
1501
+ return "done";
1502
+ }
1503
+ function parseFollowUpAt(raw, now) {
1504
+ const text = raw.trim();
1505
+ const rel = /^(\d+)(m|h|d)$/i.exec(text);
1506
+ if (rel) {
1507
+ const n = Number(rel[1]);
1508
+ if (!Number.isFinite(n) || n <= 0) return null;
1509
+ const unit = rel[2].toLowerCase();
1510
+ const ms2 = unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5;
1511
+ return new Date(now.getTime() + n * ms2).toISOString();
1512
+ }
1513
+ const ms = Date.parse(text);
1514
+ if (!Number.isFinite(ms)) return null;
1515
+ return new Date(ms).toISOString();
1516
+ }
1517
+ function normalizeChatFollowUps(raw) {
1518
+ if (!Array.isArray(raw)) return [];
1519
+ const out = [];
1520
+ for (const item of raw) {
1521
+ if (!item || typeof item !== "object") continue;
1522
+ const row = item;
1523
+ if (row.kind !== "ci" && row.kind !== "at") continue;
1524
+ if (typeof row.prompt !== "string" || !row.prompt.trim()) continue;
1525
+ if (typeof row.deadline !== "string" || !row.deadline.trim()) continue;
1526
+ if (typeof row.createdAt !== "string" || !row.createdAt.trim()) continue;
1527
+ if (typeof row.id !== "string" || !row.id.trim()) continue;
1528
+ const baseline = row.ciBaseline;
1529
+ const followUp = {
1530
+ id: row.id.trim(),
1531
+ kind: row.kind,
1532
+ prompt: row.prompt.trim(),
1533
+ deadline: row.deadline.trim(),
1534
+ createdAt: row.createdAt.trim()
1535
+ };
1536
+ if (typeof row.at === "string" && row.at.trim()) followUp.at = row.at.trim();
1537
+ if (baseline === "pending" || baseline === "done" || baseline === "none" || baseline === "unknown") {
1538
+ followUp.ciBaseline = baseline;
1539
+ }
1540
+ if (row.ciSawPending === true) followUp.ciSawPending = true;
1541
+ out.push(followUp);
1542
+ if (out.length >= MAX_CHAT_FOLLOW_UPS) break;
1543
+ }
1544
+ return out;
1545
+ }
1546
+ function addChatFollowUp(existing, draft, now) {
1547
+ if (existing.length >= MAX_CHAT_FOLLOW_UPS) {
1548
+ return { ok: false, error: "This chat already has 10 follow-ups." };
1549
+ }
1550
+ const prompt = draft.prompt.trim();
1551
+ if (!prompt) return { ok: false, error: "prompt is required" };
1552
+ let at;
1553
+ let deadline;
1554
+ if (draft.kind === "at") {
1555
+ if (!draft.at?.trim()) return { ok: false, error: "at is required for a time follow-up" };
1556
+ const parsed = parseFollowUpAt(draft.at, now);
1557
+ if (!parsed) return { ok: false, error: "at must be 30m, 2h, 1d, or an ISO time" };
1558
+ at = parsed;
1559
+ deadline = draft.deadline?.trim() ? parseFollowUpAt(draft.deadline, now) ?? "" : parsed;
1560
+ if (!deadline) return { ok: false, error: "deadline must be 30m, 2h, 1d, or an ISO time" };
1561
+ } else {
1562
+ deadline = draft.deadline?.trim() ? parseFollowUpAt(draft.deadline, now) ?? "" : new Date(now.getTime() + DEFAULT_FOLLOW_UP_DEADLINE_MS).toISOString();
1563
+ if (!deadline) return { ok: false, error: "deadline must be 30m, 2h, 1d, or an ISO time" };
1564
+ }
1565
+ const followUp = {
1566
+ id: randomUUID2(),
1567
+ kind: draft.kind,
1568
+ prompt,
1569
+ deadline,
1570
+ createdAt: now.toISOString(),
1571
+ ...at ? { at } : {},
1572
+ ...draft.kind === "ci" && draft.ciBaseline ? { ciBaseline: draft.ciBaseline } : {}
1573
+ };
1574
+ return { ok: true, followUps: [...existing, followUp] };
1575
+ }
1576
+ function decideFollowUps(input) {
1577
+ const fire = [];
1578
+ const keep = [];
1579
+ const nowMs = input.now.getTime();
1580
+ for (const item of input.followUps) {
1581
+ if (item.kind === "at") {
1582
+ const atMs = Date.parse(item.at ?? item.deadline);
1583
+ if (Number.isFinite(atMs) && nowMs >= atMs) fire.push(item);
1584
+ else keep.push(item);
1585
+ continue;
1586
+ }
1587
+ const sawPending = item.ciSawPending === true || input.ci === "pending" || item.ciBaseline === "pending";
1588
+ const next = sawPending ? { ...item, ciSawPending: true } : item;
1589
+ const alreadyFinished = item.ciBaseline === "done" && item.ciSawPending !== true && input.ci === "done";
1590
+ const baselineCanFinish = item.ciBaseline === "pending" || item.ciBaseline === "none" || item.ciSawPending === true;
1591
+ const ready = input.ci === "done" && !alreadyFinished && baselineCanFinish;
1592
+ if (ready) {
1593
+ fire.push(item);
1594
+ continue;
1595
+ }
1596
+ const deadlineMs = Date.parse(item.deadline);
1597
+ if (Number.isFinite(deadlineMs) && nowMs >= deadlineMs) continue;
1598
+ keep.push(next);
1599
+ }
1600
+ return { fire, keep };
1601
+ }
1602
+ function mergeFollowUpPoll(input) {
1603
+ const fired = new Set(input.firedIds);
1604
+ const keepById = new Map(input.keep.map((item) => [item.id, item]));
1605
+ const beforeIds = new Set(input.before.map((item) => item.id));
1606
+ return input.after.flatMap((item) => {
1607
+ if (fired.has(item.id)) return [];
1608
+ const fromPoll = keepById.get(item.id);
1609
+ if (beforeIds.has(item.id) && !fromPoll) return [];
1610
+ if (fromPoll?.ciSawPending && item.ciSawPending !== true) {
1611
+ return [{ ...item, ciSawPending: true }];
1612
+ }
1613
+ return [item];
1614
+ });
1615
+ }
1616
+
1493
1617
  // src/store/thread-store.ts
1494
1618
  function nowIso2() {
1495
1619
  return (/* @__PURE__ */ new Date()).toISOString();
@@ -1542,6 +1666,7 @@ function normalizeThread(raw) {
1542
1666
  return {
1543
1667
  ...raw,
1544
1668
  model: raw.model ?? null,
1669
+ acpHarness: raw.acpHarness === "gemini" || raw.acpHarness === "copilot" ? raw.acpHarness : void 0,
1545
1670
  effort: resolveThreadEffort(raw),
1546
1671
  fast: Boolean(raw.fast),
1547
1672
  planMode: Boolean(raw.planMode),
@@ -1564,6 +1689,7 @@ function normalizeThread(raw) {
1564
1689
  prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
1565
1690
  prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
1566
1691
  wakeOnGithubEdges: raw.wakeOnGithubEdges === true ? true : void 0,
1692
+ followUps: normalizeChatFollowUps(raw.followUps),
1567
1693
  issueBlockedBy: sanitizeIssueBlockedBy(raw.issueBlockedBy),
1568
1694
  skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
1569
1695
  cowboy: Boolean(raw.cowboy),
@@ -1583,7 +1709,7 @@ function normalizeThread(raw) {
1583
1709
  function createEmptyThread(partial) {
1584
1710
  const ts = nowIso2();
1585
1711
  return {
1586
- id: randomUUID2(),
1712
+ id: randomUUID3(),
1587
1713
  sessionId: partial.sessionId ?? null,
1588
1714
  autonomy: partial.autonomy ?? "default",
1589
1715
  model: partial.model ?? null,
@@ -1629,6 +1755,7 @@ function createEmptyThread(partial) {
1629
1755
  worktreePath: partial.worktreePath,
1630
1756
  repoPath: partial.repoPath,
1631
1757
  agent: partial.agent,
1758
+ ...partial.acpHarness === "gemini" || partial.acpHarness === "copilot" ? { acpHarness: partial.acpHarness } : {},
1632
1759
  lastError: null,
1633
1760
  agentPid: null,
1634
1761
  agentPidStartedAt: null,
@@ -1835,6 +1962,11 @@ export {
1835
1962
  deleteSchedulesForThread,
1836
1963
  deleteSchedule,
1837
1964
  recordScheduleRun,
1965
+ ciChecksSettled,
1966
+ normalizeChatFollowUps,
1967
+ addChatFollowUp,
1968
+ decideFollowUps,
1969
+ mergeFollowUpPoll,
1838
1970
  resolveThreadEffort,
1839
1971
  normalizeThread,
1840
1972
  createEmptyThread,
@@ -0,0 +1,232 @@
1
+ // src/agents/acp-protocol.ts
2
+ var ACP_PROTOCOL_VERSION = 1;
3
+ var ACP_REPLAY_CHAR_BUDGET = 16e3;
4
+ var PLAN_READ_TOOL_KINDS = /* @__PURE__ */ new Set(["read", "search", "think"]);
5
+ function acpStdioServerFromEntry(name, entry) {
6
+ const trimmed = name.trim();
7
+ if (!trimmed) return null;
8
+ const type = typeof entry.type === "string" ? entry.type : "";
9
+ if (type === "http" || type === "sse" || typeof entry.url === "string") return null;
10
+ const command = typeof entry.command === "string" ? entry.command.trim() : "";
11
+ if (!command) return null;
12
+ const args = Array.isArray(entry.args) ? entry.args.filter((item) => typeof item === "string") : [];
13
+ const env = [];
14
+ const rawEnv = entry.env;
15
+ if (rawEnv && typeof rawEnv === "object" && !Array.isArray(rawEnv)) {
16
+ for (const [key, value] of Object.entries(rawEnv)) {
17
+ if (key === "ELECTRON_RUN_AS_NODE" || typeof value !== "string") continue;
18
+ env.push({ name: key, value });
19
+ }
20
+ }
21
+ return { name: trimmed, command, args, env };
22
+ }
23
+ function acpUserStdioServers(entries, taken) {
24
+ const out = [];
25
+ for (const [name, entry] of Object.entries(entries)) {
26
+ if (taken.has(name.trim())) continue;
27
+ const server = acpStdioServerFromEntry(name, entry);
28
+ if (server) out.push(server);
29
+ }
30
+ return out;
31
+ }
32
+ function toAcpMcpServers(servers) {
33
+ return servers.map((server) => ({
34
+ name: server.name,
35
+ command: server.command,
36
+ args: server.args ?? [],
37
+ env: Object.entries(server.env ?? {}).map(([name, value]) => ({ name, value }))
38
+ }));
39
+ }
40
+ function acpSessionOpenPlan(input) {
41
+ if (input.loadSession && input.sessionId?.trim()) return "load";
42
+ return "new";
43
+ }
44
+ function acpPriorTranscript(messages) {
45
+ const rows = [];
46
+ for (const message of messages) {
47
+ if (message.role !== "user" && message.role !== "agent" && message.role !== "summary") {
48
+ continue;
49
+ }
50
+ const text = message.text?.trim() ?? "";
51
+ if (!text) continue;
52
+ rows.push({ role: message.role, text });
53
+ }
54
+ const last = rows[rows.length - 1];
55
+ if (last?.role === "user") rows.pop();
56
+ return rows;
57
+ }
58
+ function buildAcpReplayPrompt(prior, prompt) {
59
+ if (prior.length === 0) return prompt;
60
+ const lines = prior.map((turn) => {
61
+ const who = turn.role === "user" ? "User" : turn.role === "agent" ? "Assistant" : "Note";
62
+ return `${who}:
63
+ ${turn.text}`;
64
+ });
65
+ let body = lines.join("\n\n");
66
+ if (body.length > ACP_REPLAY_CHAR_BUDGET) {
67
+ body = `\u2026(earlier turns omitted)
68
+
69
+ ${body.slice(body.length - ACP_REPLAY_CHAR_BUDGET)}`;
70
+ }
71
+ return [
72
+ "Previous conversation (this harness cannot load a saved session, so Sideboard replayed the transcript):",
73
+ body,
74
+ "Current request:",
75
+ prompt
76
+ ].join("\n\n");
77
+ }
78
+ function selectAcpPermissionOption(options, mode, toolKind) {
79
+ const allowAlways = options.find((option) => option.kind === "allow_always");
80
+ const allowOnce = options.find((option) => option.kind === "allow_once");
81
+ const rejectOnce = options.find((option) => option.kind === "reject_once");
82
+ const rejectAlways = options.find((option) => option.kind === "reject_always");
83
+ if (mode === "plan") {
84
+ if (toolKind && PLAN_READ_TOOL_KINDS.has(toolKind)) {
85
+ const allow2 = allowOnce ?? allowAlways;
86
+ if (allow2) return { outcome: "selected", optionId: allow2.optionId };
87
+ }
88
+ const reject2 = rejectOnce ?? rejectAlways;
89
+ if (reject2) return { outcome: "selected", optionId: reject2.optionId };
90
+ return { outcome: "cancelled" };
91
+ }
92
+ if (mode === "full") {
93
+ const allow2 = allowAlways ?? allowOnce;
94
+ if (allow2) return { outcome: "selected", optionId: allow2.optionId };
95
+ }
96
+ const allow = allowOnce ?? allowAlways;
97
+ if (allow) return { outcome: "selected", optionId: allow.optionId };
98
+ const reject = rejectOnce ?? rejectAlways;
99
+ if (reject) return { outcome: "selected", optionId: reject.optionId };
100
+ return { outcome: "cancelled" };
101
+ }
102
+ function clip(text, max = 8e3) {
103
+ if (text.length <= max) return text;
104
+ return `${text.slice(0, max)}
105
+ \u2026(${text.length - max} more characters)`;
106
+ }
107
+ function blockToText(block) {
108
+ if (!block || typeof block !== "object") return "";
109
+ const record = block;
110
+ if (record.type === "text" && typeof record.text === "string") return record.text;
111
+ if (typeof record.path === "string" && (record.type === "diff" || record.type === "resource")) {
112
+ return record.path;
113
+ }
114
+ return "";
115
+ }
116
+ function acpContentToText(content) {
117
+ if (typeof content === "string") return content;
118
+ const blocks = Array.isArray(content) ? content : content ? [content] : [];
119
+ return blocks.map(blockToText).filter(Boolean).join("\n");
120
+ }
121
+ function asRecord(value) {
122
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
123
+ return value;
124
+ }
125
+ function num(value) {
126
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
127
+ }
128
+ function acpUsageFromUnknown(value) {
129
+ const record = asRecord(value);
130
+ if (!record) return null;
131
+ const input = num(record.inputTokens ?? record.input_tokens);
132
+ const output = num(record.outputTokens ?? record.output_tokens);
133
+ if (input == null && output == null) return null;
134
+ const cacheRead = num(record.cacheReadTokens ?? record.cachedReadTokens ?? record.cached_read_tokens);
135
+ const cacheWrite = num(
136
+ record.cacheWriteTokens ?? record.cachedWriteTokens ?? record.cached_write_tokens
137
+ );
138
+ return {
139
+ inputTokens: input ?? 0,
140
+ outputTokens: output ?? 0,
141
+ ...cacheRead != null ? { cacheReadTokens: cacheRead } : {},
142
+ ...cacheWrite != null ? { cacheWriteTokens: cacheWrite } : {}
143
+ };
144
+ }
145
+ function toolInput(raw) {
146
+ const record = asRecord(raw);
147
+ return record ?? void 0;
148
+ }
149
+ function sessionUpdateToEvents(params) {
150
+ const root = asRecord(params);
151
+ const update = asRecord(root?.update) ?? root;
152
+ if (!update) return [];
153
+ const kind = typeof update.sessionUpdate === "string" ? update.sessionUpdate : "";
154
+ if (kind === "user_message_chunk") return [];
155
+ if (kind === "agent_message_chunk") {
156
+ const text = acpContentToText(update.content);
157
+ return text ? [{ type: "stdout", data: text }] : [];
158
+ }
159
+ if (kind === "agent_thought_chunk") {
160
+ const text = acpContentToText(update.content);
161
+ return text ? [{ type: "thinking", data: text }] : [];
162
+ }
163
+ if (kind === "plan") {
164
+ const entries = Array.isArray(update.entries) ? update.entries : [];
165
+ const text = entries.map((entry) => {
166
+ const record = asRecord(entry);
167
+ return typeof record?.content === "string" ? record.content : "";
168
+ }).filter(Boolean).join("\n");
169
+ return text ? [{ type: "thinking", data: text }] : [];
170
+ }
171
+ if (kind === "tool_call" || kind === "tool_call_update") {
172
+ const id = typeof update.toolCallId === "string" ? update.toolCallId : "";
173
+ if (!id) return [];
174
+ const name = typeof update.title === "string" && update.title || typeof update.kind === "string" && update.kind || "tool";
175
+ const status = typeof update.status === "string" ? update.status : "";
176
+ const content = clip(acpContentToText(update.content ?? update.rawOutput));
177
+ const events = [];
178
+ if (kind === "tool_call") {
179
+ events.push({
180
+ type: "tool_use",
181
+ id,
182
+ name,
183
+ ...toolInput(update.rawInput) ? { input: toolInput(update.rawInput) } : {}
184
+ });
185
+ }
186
+ if (status === "completed" || status === "failed" || kind === "tool_call_update" && content) {
187
+ events.push({
188
+ type: "tool_result",
189
+ id,
190
+ ...content ? { content } : {},
191
+ isError: status === "failed",
192
+ partial: status !== "completed" && status !== "failed"
193
+ });
194
+ }
195
+ return events;
196
+ }
197
+ return [];
198
+ }
199
+ var AGENT_EVENT_TYPES = /* @__PURE__ */ new Set([
200
+ "stdout",
201
+ "stderr",
202
+ "session_id",
203
+ "thinking",
204
+ "tool_use",
205
+ "tool_result",
206
+ "usage",
207
+ "exit"
208
+ ]);
209
+ function parseAcpRunnerLine(line) {
210
+ const trimmed = line.trim();
211
+ if (!trimmed.startsWith("{")) return null;
212
+ try {
213
+ const parsed = JSON.parse(trimmed);
214
+ if (typeof parsed.type !== "string" || !AGENT_EVENT_TYPES.has(parsed.type)) return null;
215
+ return parsed;
216
+ } catch {
217
+ return null;
218
+ }
219
+ }
220
+
221
+ export {
222
+ ACP_PROTOCOL_VERSION,
223
+ acpUserStdioServers,
224
+ toAcpMcpServers,
225
+ acpSessionOpenPlan,
226
+ acpPriorTranscript,
227
+ buildAcpReplayPrompt,
228
+ selectAcpPermissionOption,
229
+ acpUsageFromUnknown,
230
+ sessionUpdateToEvents,
231
+ parseAcpRunnerLine
232
+ };
@@ -1,3 +1,7 @@
1
+ import {
2
+ chmodOwnerOnly,
3
+ writePrivateFile
4
+ } from "./chunk-JT7R45JB.js";
1
5
  import {
2
6
  stripNestedElectronEnv
3
7
  } from "./chunk-4TR3HZFT.js";
@@ -12,10 +16,6 @@ import {
12
16
  withRemovedAccount,
13
17
  withSelectedAccount
14
18
  } from "./chunk-KI45T4DI.js";
15
- import {
16
- chmodOwnerOnly,
17
- writePrivateFile
18
- } from "./chunk-JT7R45JB.js";
19
19
  import {
20
20
  appDataDir
21
21
  } from "./chunk-H4UEFJRI.js";
@@ -1076,7 +1076,8 @@ var DEFAULT_AGENTS = /* @__PURE__ */ new Set([
1076
1076
  "codex",
1077
1077
  "opencode",
1078
1078
  "brightsy",
1079
- "cursor"
1079
+ "cursor",
1080
+ "acp"
1080
1081
  ]);
1081
1082
  var GITHUB_GIT_AUTH_MODES = ["auto", "gh", "ssh", "token"];
1082
1083
  var FOLLOW_UP_BEHAVIORS = ["steer", "queue"];
@@ -1426,6 +1427,7 @@ function normalizeDefaults(raw) {
1426
1427
  if (typeof source.agent === "string" && DEFAULT_AGENTS.has(source.agent)) {
1427
1428
  out.agent = source.agent;
1428
1429
  }
1430
+ if (source.acpHarness === "gemini" || source.acpHarness === "copilot") out.acpHarness = source.acpHarness;
1429
1431
  if (typeof source.model === "string") {
1430
1432
  const model = source.model.trim();
1431
1433
  if (model) out.model = model;
@@ -2134,6 +2136,8 @@ function updateDefaultsSettings(patch) {
2134
2136
  defaults.agent = patch.agent;
2135
2137
  }
2136
2138
  }
2139
+ if (patch.acpHarness === "gemini" || patch.acpHarness === "copilot") defaults.acpHarness = patch.acpHarness;
2140
+ else if ("acpHarness" in patch) delete defaults.acpHarness;
2137
2141
  if ("model" in patch) {
2138
2142
  if (patch.model == null || patch.model.trim() === "") {
2139
2143
  delete defaults.model;