@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.
- package/dist/{abletime-CGFJZB7L.js → abletime-TX7BTTR2.js} +5 -5
- package/dist/{abletime-3HRWLQZJ.js → abletime-URSRZW7P.js} +4 -4
- package/dist/{abletime-oauth-QNJQLHR4.js → abletime-oauth-QS3WPSCC.js} +3 -3
- package/dist/{abletime-oauth-JQDSH5OL.js → abletime-oauth-SL3NMNEC.js} +4 -4
- package/dist/{abletime-rest-TANL5TMY.js → abletime-rest-GGQLUO55.js} +3 -3
- package/dist/{abletime-rest-UQA2CRZN.js → abletime-rest-JZU6JJCV.js} +4 -4
- package/dist/agents/acp-runner.cjs +491 -0
- package/dist/agents/acp-runner.d.cts +46 -0
- package/dist/agents/acp-runner.d.ts +46 -0
- package/dist/agents/acp-runner.js +323 -0
- package/dist/{agents-DMPBFF3F.js → agents-D5CL4CR4.js} +37 -7
- package/dist/{agents-AZ2PV6XP.js → agents-INTH7J3F.js} +42 -11
- package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
- package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
- package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
- package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
- package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
- package/dist/{chunk-Q4I6KDOL.js → chunk-7WPQAVS5.js} +60 -39
- package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
- package/dist/{chunk-ZXI5DR5S.js → chunk-AAKQU4UZ.js} +1624 -1487
- package/dist/{chunk-MVFFLU5V.js → chunk-AEEOYLVK.js} +12 -5
- package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
- package/dist/{chunk-IRFBD6GU.js → chunk-BDWVBEKN.js} +71 -47
- package/dist/chunk-BF6INES4.js +144 -0
- package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
- package/dist/{chunk-ROXM6QZV.js → chunk-C3E2DGDF.js} +12 -5
- package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
- package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
- package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
- package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
- package/dist/{chunk-3DBL2C45.js → chunk-FQ3JYUKI.js} +2 -2
- package/dist/{chunk-MHSBF3SO.js → chunk-HISSQICH.js} +4 -4
- package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
- package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
- package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
- package/dist/{chunk-6RIPZ73M.js → chunk-SMSD6U3N.js} +3 -1
- package/dist/{chunk-CATTIFSP.js → chunk-SZY23KGS.js} +4 -4
- package/dist/{chunk-RPHH4FNK.js → chunk-TCEUNSLX.js} +3 -1
- package/dist/chunk-TRMPDDVL.js +232 -0
- package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
- package/dist/{chunk-WHMLMCPU.js → chunk-UXAKH4AW.js} +1925 -1722
- package/dist/{chunk-QHXZKHUL.js → chunk-VHQ6OG3U.js} +2 -2
- package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
- package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
- package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
- package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
- package/dist/chunk-YE7Z5WH3.js +142 -0
- package/dist/{conductor-65VPUPOW.js → conductor-FWYWIHEW.js} +7 -6
- package/dist/{conductor-NHC6X74J.js → conductor-W2X7QUKZ.js} +6 -5
- package/dist/connected-teams-2YDE2EZ2.js +1 -1
- package/dist/{coordinator-prompt-R2PURZL3.js → coordinator-prompt-J57Q4Z4W.js} +4 -4
- package/dist/{coordinator-prompt-5GZWIVSY.js → coordinator-prompt-KIHNLENN.js} +5 -5
- package/dist/{global-workspace-UEECLWSX.js → global-workspace-CGB5CY4U.js} +4 -4
- package/dist/{global-workspace-64KC7PST.js → global-workspace-WXDWFZAN.js} +5 -5
- package/dist/index.cjs +1750 -950
- package/dist/index.d.cts +151 -895
- package/dist/index.d.ts +151 -895
- package/dist/index.js +582 -227
- package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
- package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
- package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
- package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
- package/dist/mcp/run-stdio.cjs +1247 -741
- package/dist/mcp/run-stdio.js +181 -44
- package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
- package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
- package/dist/{orchestrator-I5G5A5BV.js → orchestrator-DMEE7CEW.js} +11 -10
- package/dist/{orchestrator-Y5PYSMR6.js → orchestrator-MUD4FY7Q.js} +17 -15
- package/dist/thread-CJRchYLj.d.cts +856 -0
- package/dist/thread-CJRchYLj.d.ts +856 -0
- package/dist/{thread-store-HZ4U4OXB.js → thread-store-4YTOV2HL.js} +3 -3
- package/dist/{thread-store-QKNU5CHM.js → thread-store-LME2ICZP.js} +2 -2
- package/dist/{workspaces-6TIM2TM2.js → workspaces-7DPHDXNY.js} +4 -4
- package/dist/{workspaces-I2EHNTFE.js → workspaces-ZCTF4ECL.js} +5 -5
- package/dist/{worktree-7JFYDNUX.js → worktree-4ATMCYIE.js} +3 -3
- package/dist/{worktree-M2GJGK2P.js → worktree-DA6SKIU5.js} +4 -4
- package/package.json +3 -3
- /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { A as AcpHarnessId, a as AgentEvent } from '../thread-CJRchYLj.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Agent Client Protocol (JSON-RPC over stdio) helpers shared by the runner
|
|
6
|
+
* and tests. No process spawn here.
|
|
7
|
+
*
|
|
8
|
+
* Session resume: a harness is resumed only when `initialize` reports
|
|
9
|
+
* `loadSession`. Otherwise each turn is a new session and Sideboard replays
|
|
10
|
+
* the prior transcript into the prompt. The harness process does not stay
|
|
11
|
+
* alive between turns.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type AcpMcpServer = {
|
|
15
|
+
name: string;
|
|
16
|
+
command: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
env: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
type AcpTranscriptTurn = {
|
|
24
|
+
role: 'user' | 'agent' | 'summary';
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AcpTurnRequest = {
|
|
29
|
+
prompt: string;
|
|
30
|
+
/** Prompt without the cached prefix. Used only after a successful session/load. */
|
|
31
|
+
resumePrompt: string;
|
|
32
|
+
transcript?: AcpTranscriptTurn[];
|
|
33
|
+
cwd: string;
|
|
34
|
+
sessionId?: string | null;
|
|
35
|
+
harness: AcpHarnessId;
|
|
36
|
+
command: string;
|
|
37
|
+
args: string[];
|
|
38
|
+
mcpServers?: AcpMcpServer[];
|
|
39
|
+
planMode?: boolean;
|
|
40
|
+
autonomy?: 'default' | 'full';
|
|
41
|
+
/** Extra env for the harness (tests). Inherited env is always passed through. */
|
|
42
|
+
env?: Record<string, string>;
|
|
43
|
+
};
|
|
44
|
+
declare function runAcpTurn(req: AcpTurnRequest, emit: (event: AgentEvent) => void): Promise<number>;
|
|
45
|
+
|
|
46
|
+
export { type AcpTurnRequest, runAcpTurn };
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
ACP_PROTOCOL_VERSION,
|
|
4
|
+
acpSessionOpenPlan,
|
|
5
|
+
acpUsageFromUnknown,
|
|
6
|
+
buildAcpReplayPrompt,
|
|
7
|
+
selectAcpPermissionOption,
|
|
8
|
+
sessionUpdateToEvents
|
|
9
|
+
} from "../chunk-TRMPDDVL.js";
|
|
10
|
+
|
|
11
|
+
// src/agents/acp-runner.ts
|
|
12
|
+
import { spawn } from "child_process";
|
|
13
|
+
import { createInterface } from "readline";
|
|
14
|
+
import { resolve } from "path";
|
|
15
|
+
function emitLine(emit, event) {
|
|
16
|
+
emit(event);
|
|
17
|
+
}
|
|
18
|
+
function permissionMode(req) {
|
|
19
|
+
if (req.planMode) return "plan";
|
|
20
|
+
if (req.autonomy === "full") return "full";
|
|
21
|
+
return "default";
|
|
22
|
+
}
|
|
23
|
+
function asRecord(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
var AcpConnection = class {
|
|
28
|
+
constructor(stdin, stdout, onRequest, onNotification) {
|
|
29
|
+
this.stdin = stdin;
|
|
30
|
+
this.onRequest = onRequest;
|
|
31
|
+
this.onNotification = onNotification;
|
|
32
|
+
stdout.setEncoding("utf8");
|
|
33
|
+
stdout.on("data", (chunk) => this.ingest(chunk));
|
|
34
|
+
stdout.on("end", () => {
|
|
35
|
+
this.failAll(new Error("ACP harness closed stdout"));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
stdin;
|
|
39
|
+
onRequest;
|
|
40
|
+
onNotification;
|
|
41
|
+
nextId = 1;
|
|
42
|
+
pending = /* @__PURE__ */ new Map();
|
|
43
|
+
buffer = "";
|
|
44
|
+
ingest(chunk) {
|
|
45
|
+
this.buffer += chunk;
|
|
46
|
+
while (true) {
|
|
47
|
+
const nl = this.buffer.indexOf("\n");
|
|
48
|
+
if (nl < 0) break;
|
|
49
|
+
const line = this.buffer.slice(0, nl).replace(/\r$/, "").trim();
|
|
50
|
+
this.buffer = this.buffer.slice(nl + 1);
|
|
51
|
+
if (!line) continue;
|
|
52
|
+
let msg;
|
|
53
|
+
try {
|
|
54
|
+
msg = JSON.parse(line);
|
|
55
|
+
} catch {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
void this.dispatch(msg);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async dispatch(msg) {
|
|
62
|
+
if (msg.method && (msg.id === void 0 || msg.id === null)) {
|
|
63
|
+
this.onNotification(msg.method, msg.params);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (msg.method && msg.id != null) {
|
|
67
|
+
try {
|
|
68
|
+
const result = await this.onRequest(msg.method, msg.params);
|
|
69
|
+
this.send({ jsonrpc: "2.0", id: msg.id, result });
|
|
70
|
+
} catch (err) {
|
|
71
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
72
|
+
this.send({
|
|
73
|
+
jsonrpc: "2.0",
|
|
74
|
+
id: msg.id,
|
|
75
|
+
error: { code: -32603, message }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (msg.id == null) return;
|
|
81
|
+
const pending = this.pending.get(String(msg.id));
|
|
82
|
+
if (!pending) return;
|
|
83
|
+
this.pending.delete(String(msg.id));
|
|
84
|
+
if (msg.error) {
|
|
85
|
+
const data = asRecord(msg.error.data);
|
|
86
|
+
const code = typeof data?.code === "string" ? data.code : "";
|
|
87
|
+
const message = msg.error.message || code || "ACP request failed";
|
|
88
|
+
pending.reject(new Error(code ? `${message} (${code})` : message));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
pending.resolve(msg.result);
|
|
92
|
+
}
|
|
93
|
+
request(method, params) {
|
|
94
|
+
const id = this.nextId++;
|
|
95
|
+
const promise = new Promise((resolve2, reject) => {
|
|
96
|
+
this.pending.set(String(id), { resolve: resolve2, reject });
|
|
97
|
+
});
|
|
98
|
+
this.send({ jsonrpc: "2.0", id, method, params });
|
|
99
|
+
return promise;
|
|
100
|
+
}
|
|
101
|
+
notify(method, params) {
|
|
102
|
+
this.send({ jsonrpc: "2.0", method, params });
|
|
103
|
+
}
|
|
104
|
+
send(value) {
|
|
105
|
+
this.stdin.write(`${JSON.stringify(value)}
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
failAll(error) {
|
|
109
|
+
for (const pending of this.pending.values()) pending.reject(error);
|
|
110
|
+
this.pending.clear();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function permissionOptions(value) {
|
|
114
|
+
if (!Array.isArray(value)) return [];
|
|
115
|
+
const options = [];
|
|
116
|
+
for (const entry of value) {
|
|
117
|
+
const record = asRecord(entry);
|
|
118
|
+
if (!record || typeof record.optionId !== "string" || typeof record.kind !== "string") continue;
|
|
119
|
+
options.push({
|
|
120
|
+
optionId: record.optionId,
|
|
121
|
+
kind: record.kind,
|
|
122
|
+
...typeof record.name === "string" ? { name: record.name } : {}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return options;
|
|
126
|
+
}
|
|
127
|
+
async function readStdinJson() {
|
|
128
|
+
const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
129
|
+
const chunks = [];
|
|
130
|
+
for await (const line of rl) chunks.push(line);
|
|
131
|
+
const raw = chunks.join("\n").trim();
|
|
132
|
+
if (!raw) throw new Error("acp-runner: empty stdin (expected JSON AcpTurnRequest)");
|
|
133
|
+
return JSON.parse(raw);
|
|
134
|
+
}
|
|
135
|
+
function exitWhenDone(child) {
|
|
136
|
+
return new Promise((resolveExit) => {
|
|
137
|
+
if (child.exitCode != null) {
|
|
138
|
+
resolveExit(child.exitCode);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
child.once("exit", (code) => resolveExit(code));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async function runAcpTurn(req, emit) {
|
|
145
|
+
if (!req.prompt?.trim()) {
|
|
146
|
+
emitLine(emit, { type: "stderr", data: "acp-runner: prompt is required" });
|
|
147
|
+
return 1;
|
|
148
|
+
}
|
|
149
|
+
if (!req.cwd?.trim() || !req.command?.trim()) {
|
|
150
|
+
emitLine(emit, { type: "stderr", data: "acp-runner: cwd and command are required" });
|
|
151
|
+
return 1;
|
|
152
|
+
}
|
|
153
|
+
const cwd = resolve(req.cwd);
|
|
154
|
+
const child = spawn(req.command, req.args ?? [], {
|
|
155
|
+
cwd,
|
|
156
|
+
env: { ...process.env, ...req.env },
|
|
157
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
158
|
+
});
|
|
159
|
+
child.stderr.setEncoding("utf8");
|
|
160
|
+
let stderrBuf = "";
|
|
161
|
+
child.stderr.on("data", (chunk) => {
|
|
162
|
+
stderrBuf += chunk;
|
|
163
|
+
while (stderrBuf.includes("\n")) {
|
|
164
|
+
const nl = stderrBuf.indexOf("\n");
|
|
165
|
+
const line = stderrBuf.slice(0, nl).replace(/\r$/, "");
|
|
166
|
+
stderrBuf = stderrBuf.slice(nl + 1);
|
|
167
|
+
if (line.trim()) emitLine(emit, { type: "stderr", data: line });
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
let suppressUpdates = false;
|
|
171
|
+
let sessionId = req.sessionId?.trim() || null;
|
|
172
|
+
const mode = permissionMode(req);
|
|
173
|
+
const mcpServers = req.mcpServers ?? [];
|
|
174
|
+
const conn = new AcpConnection(
|
|
175
|
+
child.stdin,
|
|
176
|
+
child.stdout,
|
|
177
|
+
async (method, params) => {
|
|
178
|
+
if (method === "session/request_permission") {
|
|
179
|
+
const record = asRecord(params);
|
|
180
|
+
const tool = asRecord(record?.toolCall);
|
|
181
|
+
const toolKind = typeof tool?.kind === "string" ? tool.kind : null;
|
|
182
|
+
const selected = selectAcpPermissionOption(permissionOptions(record?.options), mode, toolKind);
|
|
183
|
+
return { outcome: selected };
|
|
184
|
+
}
|
|
185
|
+
throw new Error(`ACP client method not implemented: ${method}`);
|
|
186
|
+
},
|
|
187
|
+
(method, params) => {
|
|
188
|
+
if (method !== "session/update" || suppressUpdates) return;
|
|
189
|
+
for (const event of sessionUpdateToEvents(params)) emitLine(emit, event);
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
let stopWatching = false;
|
|
193
|
+
const earlyFailure = new Promise((resolveExit) => {
|
|
194
|
+
child.once("error", (err) => {
|
|
195
|
+
if (stopWatching) return;
|
|
196
|
+
stopWatching = true;
|
|
197
|
+
emitLine(emit, { type: "stderr", data: err.message });
|
|
198
|
+
resolveExit(1);
|
|
199
|
+
});
|
|
200
|
+
child.once("exit", (code2) => {
|
|
201
|
+
if (stopWatching) return;
|
|
202
|
+
stopWatching = true;
|
|
203
|
+
emitLine(emit, {
|
|
204
|
+
type: "stderr",
|
|
205
|
+
data: `ACP harness exited (${code2 ?? "null"}) before the turn finished`
|
|
206
|
+
});
|
|
207
|
+
resolveExit(1);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
const turn = (async () => {
|
|
211
|
+
const init = asRecord(
|
|
212
|
+
await conn.request("initialize", {
|
|
213
|
+
protocolVersion: ACP_PROTOCOL_VERSION,
|
|
214
|
+
clientCapabilities: {
|
|
215
|
+
fs: { readTextFile: false, writeTextFile: false },
|
|
216
|
+
terminal: false
|
|
217
|
+
},
|
|
218
|
+
clientInfo: { name: "sideboard", version: "0" }
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
const capabilities = asRecord(init?.agentCapabilities);
|
|
222
|
+
const loadSession = capabilities?.loadSession === true;
|
|
223
|
+
let loaded = false;
|
|
224
|
+
if (acpSessionOpenPlan({ loadSession, sessionId }) === "load" && sessionId) {
|
|
225
|
+
suppressUpdates = true;
|
|
226
|
+
try {
|
|
227
|
+
await conn.request("session/load", { sessionId, cwd, mcpServers });
|
|
228
|
+
loaded = true;
|
|
229
|
+
emitLine(emit, { type: "session_id", data: sessionId });
|
|
230
|
+
} catch (err) {
|
|
231
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
232
|
+
emitLine(emit, {
|
|
233
|
+
type: "stderr",
|
|
234
|
+
data: `ACP session/load failed (${message}). Starting a new session and replaying the transcript.`
|
|
235
|
+
});
|
|
236
|
+
sessionId = null;
|
|
237
|
+
} finally {
|
|
238
|
+
suppressUpdates = false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (!loaded) {
|
|
242
|
+
const created = asRecord(await conn.request("session/new", { cwd, mcpServers }));
|
|
243
|
+
const createdId = typeof created?.sessionId === "string" ? created.sessionId.trim() : "";
|
|
244
|
+
if (!createdId) throw new Error("ACP session/new did not return a sessionId");
|
|
245
|
+
sessionId = createdId;
|
|
246
|
+
emitLine(emit, { type: "session_id", data: createdId });
|
|
247
|
+
}
|
|
248
|
+
const text = loaded ? req.resumePrompt || req.prompt : buildAcpReplayPrompt(req.transcript ?? [], req.prompt);
|
|
249
|
+
const result = asRecord(
|
|
250
|
+
await conn.request("session/prompt", {
|
|
251
|
+
sessionId,
|
|
252
|
+
prompt: [{ type: "text", text }]
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
const usage = acpUsageFromUnknown(result?.usage);
|
|
256
|
+
if (usage) emitLine(emit, { type: "usage", data: usage, scope: "turn" });
|
|
257
|
+
const stop = typeof result?.stopReason === "string" ? result.stopReason : "end_turn";
|
|
258
|
+
if (stop === "refusal" || stop === "cancelled") {
|
|
259
|
+
emitLine(emit, { type: "stderr", data: `ACP turn stopped: ${stop}` });
|
|
260
|
+
return 2;
|
|
261
|
+
}
|
|
262
|
+
if (stop !== "end_turn") {
|
|
263
|
+
emitLine(emit, { type: "stderr", data: `ACP stop reason: ${stop}` });
|
|
264
|
+
}
|
|
265
|
+
return 0;
|
|
266
|
+
})();
|
|
267
|
+
const settled = turn.then(
|
|
268
|
+
(value) => ({ ok: true, value }),
|
|
269
|
+
(err) => ({ ok: false, err })
|
|
270
|
+
);
|
|
271
|
+
const raced = await Promise.race([
|
|
272
|
+
settled.then((result) => {
|
|
273
|
+
stopWatching = true;
|
|
274
|
+
return result;
|
|
275
|
+
}),
|
|
276
|
+
earlyFailure.then((value) => ({ ok: true, value, early: true }))
|
|
277
|
+
]);
|
|
278
|
+
const code = "early" in raced ? raced.value : raced.ok ? raced.value : 1;
|
|
279
|
+
if (!("early" in raced) && !raced.ok) {
|
|
280
|
+
const message = raced.err instanceof Error ? raced.err.message : String(raced.err);
|
|
281
|
+
emitLine(emit, { type: "stderr", data: message });
|
|
282
|
+
}
|
|
283
|
+
stopWatching = true;
|
|
284
|
+
if (code !== 0 && sessionId) {
|
|
285
|
+
try {
|
|
286
|
+
conn.notify("session/cancel", { sessionId });
|
|
287
|
+
} catch {
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
child.stdin.end();
|
|
291
|
+
const finished = exitWhenDone(child);
|
|
292
|
+
const timed = await Promise.race([
|
|
293
|
+
finished,
|
|
294
|
+
new Promise((resolveExit) => {
|
|
295
|
+
setTimeout(() => resolveExit(null), 3e3);
|
|
296
|
+
})
|
|
297
|
+
]);
|
|
298
|
+
if (timed == null) child.kill("SIGTERM");
|
|
299
|
+
return code;
|
|
300
|
+
}
|
|
301
|
+
function isDirectRun() {
|
|
302
|
+
const argv1 = process.argv[1] ?? "";
|
|
303
|
+
const base = argv1.split(/[/\\]/).pop() ?? "";
|
|
304
|
+
return base === "acp-runner.ts" || base === "acp-runner.js" || base === "acp-runner.cjs";
|
|
305
|
+
}
|
|
306
|
+
if (isDirectRun()) {
|
|
307
|
+
readStdinJson().then(
|
|
308
|
+
(req) => runAcpTurn(req, (event) => {
|
|
309
|
+
process.stdout.write(`${JSON.stringify(event)}
|
|
310
|
+
`);
|
|
311
|
+
})
|
|
312
|
+
).then((code) => {
|
|
313
|
+
process.exitCode = code;
|
|
314
|
+
}).catch((err) => {
|
|
315
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
316
|
+
process.stdout.write(`${JSON.stringify({ type: "stderr", data: message })}
|
|
317
|
+
`);
|
|
318
|
+
process.exitCode = 1;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
export {
|
|
322
|
+
runAcpTurn
|
|
323
|
+
};
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
CURSOR_SDK_INSTALL_HINT,
|
|
6
6
|
PLAN_MODE_INSTRUCTION,
|
|
7
7
|
PLAN_MODE_OFF_INSTRUCTION,
|
|
8
|
+
acpAdapter,
|
|
9
|
+
acpHarnessDisplayName,
|
|
10
|
+
acpRunnerPath,
|
|
8
11
|
allAdapters,
|
|
9
12
|
brightsyAdapter,
|
|
10
13
|
claudeAdapter,
|
|
@@ -46,7 +49,7 @@ import {
|
|
|
46
49
|
resolveCursorSdkRoot,
|
|
47
50
|
resolveQuotaFallbackAgent,
|
|
48
51
|
turnCostUsdFromCursorUsage
|
|
49
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-UXAKH4AW.js";
|
|
50
53
|
import "./chunk-LESWJ7L4.js";
|
|
51
54
|
import {
|
|
52
55
|
getAgentSetupInfo,
|
|
@@ -59,14 +62,27 @@ import {
|
|
|
59
62
|
prepareTerminalCommand,
|
|
60
63
|
resolveLoginCommand,
|
|
61
64
|
whichOnPath
|
|
62
|
-
} from "./chunk-
|
|
63
|
-
import
|
|
64
|
-
|
|
65
|
+
} from "./chunk-5TCMXEYL.js";
|
|
66
|
+
import {
|
|
67
|
+
ACP_HARNESSES,
|
|
68
|
+
ACP_HARNESS_IDS,
|
|
69
|
+
acpHarnessLabel,
|
|
70
|
+
acpHarnessLooksAuthenticated,
|
|
71
|
+
acpHarnessStatus,
|
|
72
|
+
agentSupportsAttach,
|
|
73
|
+
defaultAcpHarness,
|
|
74
|
+
detectAcpHarness,
|
|
75
|
+
detectAcpHarnesses,
|
|
76
|
+
isAcpHarnessId,
|
|
77
|
+
resolveAcpHarnessCommand
|
|
78
|
+
} from "./chunk-BF6INES4.js";
|
|
79
|
+
import "./chunk-SZY23KGS.js";
|
|
80
|
+
import "./chunk-VHQ6OG3U.js";
|
|
65
81
|
import "./chunk-I6RGRUNY.js";
|
|
66
82
|
import "./chunk-E63AM3PW.js";
|
|
67
83
|
import "./chunk-N2WW62LF.js";
|
|
68
84
|
import "./chunk-2GPQZZLY.js";
|
|
69
|
-
import "./chunk-
|
|
85
|
+
import "./chunk-WFX4ZVSZ.js";
|
|
70
86
|
import "./chunk-GK7H3SY7.js";
|
|
71
87
|
import {
|
|
72
88
|
conductorBundledBinDir,
|
|
@@ -79,25 +95,34 @@ import {
|
|
|
79
95
|
resolveCommandBinarySync,
|
|
80
96
|
withExportedPath
|
|
81
97
|
} from "./chunk-TL2HK6LZ.js";
|
|
82
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-SMSD6U3N.js";
|
|
83
99
|
import "./chunk-WMZIANPV.js";
|
|
84
100
|
import {
|
|
85
101
|
ORCHESTRATOR_AGENT_KINDS,
|
|
86
102
|
assertOrchestratorCapableAgent,
|
|
87
103
|
coerceOrchestratorAgent,
|
|
88
104
|
isOrchestratorCapableAgent
|
|
89
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-VL6F2KRE.js";
|
|
90
106
|
import "./chunk-NSTQ6QKD.js";
|
|
91
107
|
import "./chunk-WWUABK6B.js";
|
|
92
108
|
import "./chunk-FJZWM2ON.js";
|
|
93
109
|
import "./chunk-J2LNLI4S.js";
|
|
94
110
|
import "./chunk-WOU343SI.js";
|
|
95
111
|
export {
|
|
112
|
+
ACP_HARNESSES,
|
|
113
|
+
ACP_HARNESS_IDS,
|
|
96
114
|
CLAUDE_MODEL_CATALOG,
|
|
97
115
|
CURSOR_SDK_INSTALL_HINT,
|
|
98
116
|
ORCHESTRATOR_AGENT_KINDS,
|
|
99
117
|
PLAN_MODE_INSTRUCTION,
|
|
100
118
|
PLAN_MODE_OFF_INSTRUCTION,
|
|
119
|
+
acpAdapter,
|
|
120
|
+
acpHarnessDisplayName,
|
|
121
|
+
acpHarnessLabel,
|
|
122
|
+
acpHarnessLooksAuthenticated,
|
|
123
|
+
acpHarnessStatus,
|
|
124
|
+
acpRunnerPath,
|
|
125
|
+
agentSupportsAttach,
|
|
101
126
|
allAdapters,
|
|
102
127
|
assertOrchestratorCapableAgent,
|
|
103
128
|
brightsyAdapter,
|
|
@@ -109,6 +134,9 @@ export {
|
|
|
109
134
|
cursorAdapter,
|
|
110
135
|
cursorSdkMessageToEvents,
|
|
111
136
|
decodeBrightsyTarget,
|
|
137
|
+
defaultAcpHarness,
|
|
138
|
+
detectAcpHarness,
|
|
139
|
+
detectAcpHarnesses,
|
|
112
140
|
encodeBrightsyTarget,
|
|
113
141
|
enrichPathWithNpmGlobalBin,
|
|
114
142
|
ensureAgentPath,
|
|
@@ -126,6 +154,7 @@ export {
|
|
|
126
154
|
hottestClaudeWindow,
|
|
127
155
|
installAgent,
|
|
128
156
|
installNpmGlobalPackage,
|
|
157
|
+
isAcpHarnessId,
|
|
129
158
|
isConductorBundledCli,
|
|
130
159
|
isCursorApiKeyConfigured,
|
|
131
160
|
isCursorAutoModel,
|
|
@@ -153,6 +182,7 @@ export {
|
|
|
153
182
|
posixShellSingleQuote,
|
|
154
183
|
preferredCursorCostCents,
|
|
155
184
|
prepareTerminalCommand,
|
|
185
|
+
resolveAcpHarnessCommand,
|
|
156
186
|
resolveCommandBinarySync,
|
|
157
187
|
resolveCursorModelId,
|
|
158
188
|
resolveCursorSdkRoot,
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
CLAUDE_MODEL_CATALOG,
|
|
3
3
|
PLAN_MODE_INSTRUCTION,
|
|
4
4
|
PLAN_MODE_OFF_INSTRUCTION,
|
|
5
|
+
acpAdapter,
|
|
6
|
+
acpHarnessDisplayName,
|
|
7
|
+
acpRunnerPath,
|
|
5
8
|
allAdapters,
|
|
6
9
|
brightsyAdapter,
|
|
7
10
|
claudeAdapter,
|
|
@@ -37,7 +40,7 @@ import {
|
|
|
37
40
|
planModeTurnInstruction,
|
|
38
41
|
resolveCursorModelId,
|
|
39
42
|
resolveQuotaFallbackAgent
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-AAKQU4UZ.js";
|
|
41
44
|
import {
|
|
42
45
|
getAgentSetupInfo,
|
|
43
46
|
installAgent,
|
|
@@ -49,16 +52,30 @@ import {
|
|
|
49
52
|
prepareTerminalCommand,
|
|
50
53
|
resolveLoginCommand,
|
|
51
54
|
whichOnPath
|
|
52
|
-
} from "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-5FUAOU3G.js";
|
|
55
|
-
import "./chunk-WWBPK7GB.js";
|
|
56
|
-
import "./chunk-MHSBF3SO.js";
|
|
57
|
-
import "./chunk-3DBL2C45.js";
|
|
58
|
-
import "./chunk-RPHH4FNK.js";
|
|
59
|
-
import "./chunk-BMRJNRQK.js";
|
|
55
|
+
} from "./chunk-F4RFFE2H.js";
|
|
56
|
+
import "./chunk-OHXNGBC4.js";
|
|
60
57
|
import "./chunk-RSA47QYR.js";
|
|
58
|
+
import "./chunk-WB3G2LQO.js";
|
|
59
|
+
import "./chunk-WWBPK7GB.js";
|
|
60
|
+
import {
|
|
61
|
+
ACP_HARNESSES,
|
|
62
|
+
ACP_HARNESS_IDS,
|
|
63
|
+
acpHarnessLabel,
|
|
64
|
+
acpHarnessLooksAuthenticated,
|
|
65
|
+
acpHarnessStatus,
|
|
66
|
+
agentSupportsAttach,
|
|
67
|
+
defaultAcpHarness,
|
|
68
|
+
detectAcpHarness,
|
|
69
|
+
detectAcpHarnesses,
|
|
70
|
+
isAcpHarnessId,
|
|
71
|
+
resolveAcpHarnessCommand
|
|
72
|
+
} from "./chunk-YE7Z5WH3.js";
|
|
61
73
|
import "./chunk-JAT3JFOS.js";
|
|
74
|
+
import "./chunk-HISSQICH.js";
|
|
75
|
+
import "./chunk-FQ3JYUKI.js";
|
|
76
|
+
import "./chunk-TCEUNSLX.js";
|
|
77
|
+
import "./chunk-BMRJNRQK.js";
|
|
78
|
+
import "./chunk-TRMPDDVL.js";
|
|
62
79
|
import "./chunk-N6ZF3XRP.js";
|
|
63
80
|
import {
|
|
64
81
|
CURSOR_SDK_INSTALL_HINT,
|
|
@@ -89,18 +106,27 @@ import {
|
|
|
89
106
|
assertOrchestratorCapableAgent,
|
|
90
107
|
coerceOrchestratorAgent,
|
|
91
108
|
isOrchestratorCapableAgent
|
|
92
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-UFUAIVNV.js";
|
|
110
|
+
import "./chunk-JT7R45JB.js";
|
|
93
111
|
import "./chunk-4TR3HZFT.js";
|
|
94
112
|
import "./chunk-WDRMZKVB.js";
|
|
95
113
|
import "./chunk-KI45T4DI.js";
|
|
96
|
-
import "./chunk-JT7R45JB.js";
|
|
97
114
|
import "./chunk-H4UEFJRI.js";
|
|
98
115
|
export {
|
|
116
|
+
ACP_HARNESSES,
|
|
117
|
+
ACP_HARNESS_IDS,
|
|
99
118
|
CLAUDE_MODEL_CATALOG,
|
|
100
119
|
CURSOR_SDK_INSTALL_HINT,
|
|
101
120
|
ORCHESTRATOR_AGENT_KINDS,
|
|
102
121
|
PLAN_MODE_INSTRUCTION,
|
|
103
122
|
PLAN_MODE_OFF_INSTRUCTION,
|
|
123
|
+
acpAdapter,
|
|
124
|
+
acpHarnessDisplayName,
|
|
125
|
+
acpHarnessLabel,
|
|
126
|
+
acpHarnessLooksAuthenticated,
|
|
127
|
+
acpHarnessStatus,
|
|
128
|
+
acpRunnerPath,
|
|
129
|
+
agentSupportsAttach,
|
|
104
130
|
allAdapters,
|
|
105
131
|
assertOrchestratorCapableAgent,
|
|
106
132
|
brightsyAdapter,
|
|
@@ -112,6 +138,9 @@ export {
|
|
|
112
138
|
cursorAdapter,
|
|
113
139
|
cursorSdkMessageToEvents,
|
|
114
140
|
decodeBrightsyTarget,
|
|
141
|
+
defaultAcpHarness,
|
|
142
|
+
detectAcpHarness,
|
|
143
|
+
detectAcpHarnesses,
|
|
115
144
|
encodeBrightsyTarget,
|
|
116
145
|
enrichPathWithNpmGlobalBin,
|
|
117
146
|
ensureAgentPath,
|
|
@@ -129,6 +158,7 @@ export {
|
|
|
129
158
|
hottestClaudeWindow,
|
|
130
159
|
installAgent,
|
|
131
160
|
installNpmGlobalPackage,
|
|
161
|
+
isAcpHarnessId,
|
|
132
162
|
isConductorBundledCli,
|
|
133
163
|
isCursorApiKeyConfigured,
|
|
134
164
|
isCursorAutoModel,
|
|
@@ -156,6 +186,7 @@ export {
|
|
|
156
186
|
posixShellSingleQuote,
|
|
157
187
|
preferredCursorCostCents,
|
|
158
188
|
prepareTerminalCommand,
|
|
189
|
+
resolveAcpHarnessCommand,
|
|
159
190
|
resolveCommandBinarySync,
|
|
160
191
|
resolveCursorModelId,
|
|
161
192
|
resolveCursorSdkRoot,
|
|
@@ -113,11 +113,11 @@ import {
|
|
|
113
113
|
usageOnLimit,
|
|
114
114
|
wakeOrchestratorOnGithubEdgesEnabled,
|
|
115
115
|
writeViewerContext
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-UFUAIVNV.js";
|
|
117
|
+
import "./chunk-JT7R45JB.js";
|
|
117
118
|
import "./chunk-4TR3HZFT.js";
|
|
118
119
|
import "./chunk-WDRMZKVB.js";
|
|
119
120
|
import "./chunk-KI45T4DI.js";
|
|
120
|
-
import "./chunk-JT7R45JB.js";
|
|
121
121
|
import "./chunk-H4UEFJRI.js";
|
|
122
122
|
export {
|
|
123
123
|
AGENT_DONE_SOUNDS,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
usageOnLimit,
|
|
116
116
|
wakeOrchestratorOnGithubEdgesEnabled,
|
|
117
117
|
writeViewerContext
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-VL6F2KRE.js";
|
|
119
119
|
import "./chunk-NSTQ6QKD.js";
|
|
120
120
|
import "./chunk-WWUABK6B.js";
|
|
121
121
|
import "./chunk-FJZWM2ON.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
abletimeRestUrl,
|
|
3
|
+
textFromAbleTimeDoc
|
|
4
|
+
} from "./chunk-CCWQ65VD.js";
|
|
1
5
|
import {
|
|
2
6
|
downloadAuthenticatedFile,
|
|
3
7
|
extractHttpUrls,
|
|
@@ -7,16 +11,12 @@ import {
|
|
|
7
11
|
looksLikeHttpUrl,
|
|
8
12
|
mergeIssueAttachments
|
|
9
13
|
} from "./chunk-DBKHL7NC.js";
|
|
10
|
-
import {
|
|
11
|
-
abletimeRestUrl,
|
|
12
|
-
textFromAbleTimeDoc
|
|
13
|
-
} from "./chunk-AJMERXZP.js";
|
|
14
14
|
import {
|
|
15
15
|
assertAbleTimeCredential,
|
|
16
16
|
callAbleTimeTool,
|
|
17
17
|
normalizeAbleTimeHost,
|
|
18
18
|
rewriteAbleTimeError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5WF54R3B.js";
|
|
20
20
|
import {
|
|
21
21
|
httpFetch
|
|
22
22
|
} from "./chunk-JAT3JFOS.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
getAbleTimeHost,
|
|
26
26
|
isAbleTimeConnected,
|
|
27
27
|
saveAbleTimeConnection
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-UFUAIVNV.js";
|
|
29
29
|
|
|
30
30
|
// src/integrations/abletime-attachments.ts
|
|
31
31
|
function asRecord(value) {
|