@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
@@ -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;