@conveno/cli 0.2.0-rc.13 → 0.2.0-rc.14
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/README.md +1 -1
- package/dist/{acp-Bs6XS61j.js → acp-OHqthTVC.js} +3 -3
- package/dist/{agy-relay-BJLRYbFp.js → agy-relay-DLP2H1Rj.js} +2 -2
- package/dist/{args-C4rVCVXx.js → args-DmUsbNu9.js} +12 -6
- package/dist/bin.js +2 -2
- package/dist/daemon.js +109 -10
- package/dist/{daemonError-CjxG2yUl.js → daemonError-CUE_dVn-.js} +1 -1
- package/dist/{dist-DnNuDzEA.js → dist-1k5b8UGF.js} +184 -75
- package/dist/{dist-Ca3P7aN-.js → dist-BYkDv29h.js} +9 -5
- package/dist/{dist-BkhKEexU.js → dist-BiV6HopA.js} +140 -17
- package/dist/{dist-CoRBNycn.js → dist-C4Ey9THP.js} +1 -1
- package/dist/{dist-C9Z1EMlM.js → dist-Cv5et1iE.js} +1 -1
- package/dist/{dist-B14ldKRS.js → dist-D-PhGsuL.js} +1 -1
- package/dist/{dist-D4sb5RQD.js → dist-vefQHFb-.js} +1 -1
- package/dist/{hook-entry-WlJSM5aD.js → hook-entry-Cxh3yIdT.js} +6 -6
- package/dist/hook-entry-De06GWme.js +1 -0
- package/dist/{hook-C60hXJdg.js → hook-mvifUk0K.js} +1 -1
- package/dist/{main-I2RMN7XN.js → main-BY7Kcf9S.js} +36 -59
- package/dist/{pick-Colav8Wm.js → pick-ClIK4l8K.js} +1 -1
- package/dist/{run-BuDbmxx_.js → run-BYmOjvDF.js} +276 -18
- package/dist/{runtime-CPmrhPFJ.js → runtime-PeEPWwix.js} +37 -12
- package/dist/{uninstall-812XZDTG.js → uninstall-CQoGVhp3.js} +80 -8
- package/dist/{watch-DXbOOc20.js → watch-CaC2G2cT.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-jOfjq-0A.js +0 -1
|
@@ -6501,12 +6501,51 @@ const ipcMethods = {
|
|
|
6501
6501
|
result: object({ sessions: array(Session) })
|
|
6502
6502
|
},
|
|
6503
6503
|
"orchestrator.claim": {
|
|
6504
|
-
params: object(
|
|
6504
|
+
params: object({
|
|
6505
|
+
...sid,
|
|
6506
|
+
via: _enum([
|
|
6507
|
+
"tool",
|
|
6508
|
+
"cli",
|
|
6509
|
+
"home"
|
|
6510
|
+
]).optional()
|
|
6511
|
+
}),
|
|
6505
6512
|
result: object({
|
|
6506
6513
|
orchestrator: SessionId,
|
|
6507
6514
|
previous: SessionId.nullable()
|
|
6508
6515
|
})
|
|
6509
6516
|
},
|
|
6517
|
+
"permission.ask": {
|
|
6518
|
+
params: object({
|
|
6519
|
+
...sid,
|
|
6520
|
+
title: string().max(500).optional(),
|
|
6521
|
+
kind: string().max(100).optional(),
|
|
6522
|
+
timeoutMs: number().int().min(1).max(3e5),
|
|
6523
|
+
/** What happens when nobody answers, for the notice to the spawner. Default deny. */
|
|
6524
|
+
unanswered: _enum(["deny", "allow"]).optional()
|
|
6525
|
+
}),
|
|
6526
|
+
result: object({
|
|
6527
|
+
answer: _enum([
|
|
6528
|
+
"allow_once",
|
|
6529
|
+
"allow_always",
|
|
6530
|
+
"deny",
|
|
6531
|
+
"unanswered",
|
|
6532
|
+
"no_spawner"
|
|
6533
|
+
]),
|
|
6534
|
+
by: SessionId.optional()
|
|
6535
|
+
})
|
|
6536
|
+
},
|
|
6537
|
+
"permission.answer": {
|
|
6538
|
+
params: object({
|
|
6539
|
+
...sid,
|
|
6540
|
+
requestId: string().min(1).max(64),
|
|
6541
|
+
answer: _enum([
|
|
6542
|
+
"allow_once",
|
|
6543
|
+
"allow_always",
|
|
6544
|
+
"deny"
|
|
6545
|
+
])
|
|
6546
|
+
}),
|
|
6547
|
+
result: object({ ok: literal(true) })
|
|
6548
|
+
},
|
|
6510
6549
|
"orchestrator.clear": {
|
|
6511
6550
|
params: object({}),
|
|
6512
6551
|
result: object({ previous: SessionId.nullable() })
|
|
@@ -8026,19 +8065,26 @@ async function waitForWorkBatch(ctx, opts = {}) {
|
|
|
8026
8065
|
const HOOK_LOG_MAX_BYTES = 1e6;
|
|
8027
8066
|
/** `<data dir>/logs/hooks.log`. */
|
|
8028
8067
|
const hookLogPath = (dataDir) => join(dataDir, "logs", "hooks.log");
|
|
8068
|
+
/** `<data dir>/logs/lead.log`: one line per change of the lead (see `leadLogLine`). */
|
|
8069
|
+
const leadLogPath = (dataDir) => join(dataDir, "logs", "lead.log");
|
|
8029
8070
|
/** Keep a logged word to plain characters, so one entry is one line and nothing is injected. */
|
|
8030
8071
|
const plain = (v, max, extra = "") => v.replace(new RegExp(`[^A-Za-z0-9_.@:${extra}-]`, "g"), "_").slice(0, max);
|
|
8031
8072
|
/** A duration in whole ms, or `-` when there is none. */
|
|
8032
8073
|
const num = (v) => v === void 0 || !Number.isFinite(v) ? "-" : String(Math.max(0, Math.round(v)));
|
|
8033
8074
|
/**
|
|
8034
|
-
* One line: `<iso time> cli=<cli> event=<event> conv=<
|
|
8075
|
+
* One line: `<iso time> cli=<cli> event=<event> conv=<the conversation id> session=<name
|
|
8035
8076
|
* or none> result=<result> host_ms=<n or -> ms=<n or ->`. No message text and no tokens: only ids the CLI hands to hooks and the
|
|
8036
8077
|
* session's name.
|
|
8037
8078
|
*/
|
|
8038
8079
|
function hookLogLine(e) {
|
|
8039
|
-
const conv = e.conversationId ? plain(e.conversationId,
|
|
8080
|
+
const conv = e.conversationId ? plain(e.conversationId, 64) : "-";
|
|
8040
8081
|
return `${(e.at ?? /* @__PURE__ */ new Date()).toISOString()} cli=${plain(e.cli, 16)} event=${plain(e.event, 32)} conv=${conv} session=${e.session ? plain(e.session, 64) : "none"} result=${plain(e.result, 40, " ")} host_ms=${num(e.hostMs)} ms=${num(e.ms)}\n`;
|
|
8041
8082
|
}
|
|
8083
|
+
/** One line: `<iso time> lead=<name or none> previous=<name or none> via=<how>`. */
|
|
8084
|
+
function leadLogLine(e) {
|
|
8085
|
+
const name = (v) => v ? plain(v, 64) : "none";
|
|
8086
|
+
return `${(e.at ?? /* @__PURE__ */ new Date()).toISOString()} lead=${name(e.lead)} previous=${name(e.previous)} via=${plain(e.via, 16)}\n`;
|
|
8087
|
+
}
|
|
8042
8088
|
/**
|
|
8043
8089
|
* Append one line to the hook log, rotating at `HOOK_LOG_MAX_BYTES`. Synchronous and tiny so a hook
|
|
8044
8090
|
* is not made slower, and it never throws: a log that cannot be written must not change a hook.
|
|
@@ -9095,6 +9141,103 @@ async function detectRepo(cwd, fs) {
|
|
|
9095
9141
|
basename: baseName(cwd)
|
|
9096
9142
|
};
|
|
9097
9143
|
}
|
|
9144
|
+
function globMatch(glob, text) {
|
|
9145
|
+
return new RegExp(`^${glob.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*")}$`, "s").test(text);
|
|
9146
|
+
}
|
|
9147
|
+
/** Does any rule allow a tool call of this kind and title? A call with no kind is `other`. */
|
|
9148
|
+
function isAllowed(rules, call) {
|
|
9149
|
+
const kind = call.kind ?? "other";
|
|
9150
|
+
const title = call.title ?? "";
|
|
9151
|
+
return rules.some((r) => (r.kind === "*" || r.kind === kind) && (r.title === void 0 || globMatch(r.title, title)));
|
|
9152
|
+
}
|
|
9153
|
+
const WORKER_ACCESS = [
|
|
9154
|
+
"read",
|
|
9155
|
+
"edit",
|
|
9156
|
+
"full"
|
|
9157
|
+
];
|
|
9158
|
+
function parseWorkerAccess(s) {
|
|
9159
|
+
const v = s.trim().toLowerCase();
|
|
9160
|
+
return WORKER_ACCESS.includes(v) ? v : void 0;
|
|
9161
|
+
}
|
|
9162
|
+
const READ_KINDS = [
|
|
9163
|
+
"read",
|
|
9164
|
+
"search",
|
|
9165
|
+
"think"
|
|
9166
|
+
];
|
|
9167
|
+
const EDIT_KINDS = [
|
|
9168
|
+
...READ_KINDS,
|
|
9169
|
+
"edit",
|
|
9170
|
+
"move",
|
|
9171
|
+
"fetch"
|
|
9172
|
+
];
|
|
9173
|
+
/** The allow rules a preset stands for. */
|
|
9174
|
+
function accessRules(access) {
|
|
9175
|
+
if (access === "full") return [{ kind: "*" }];
|
|
9176
|
+
return (access === "read" ? READ_KINDS : EDIT_KINDS).map((kind) => ({ kind }));
|
|
9177
|
+
}
|
|
9178
|
+
const SAFE_READ_COMMANDS = new Set([
|
|
9179
|
+
"ls",
|
|
9180
|
+
"dir",
|
|
9181
|
+
"pwd",
|
|
9182
|
+
"cat",
|
|
9183
|
+
"type",
|
|
9184
|
+
"head",
|
|
9185
|
+
"tail",
|
|
9186
|
+
"wc",
|
|
9187
|
+
"tree",
|
|
9188
|
+
"stat",
|
|
9189
|
+
"Get-ChildItem",
|
|
9190
|
+
"gci",
|
|
9191
|
+
"Get-Content",
|
|
9192
|
+
"Get-Item",
|
|
9193
|
+
"Get-Location",
|
|
9194
|
+
"Test-Path",
|
|
9195
|
+
"Resolve-Path"
|
|
9196
|
+
].map((c) => c.toLowerCase()));
|
|
9197
|
+
const MAX_COMMAND_CHARS = 500;
|
|
9198
|
+
const TITLE_VERB = /^(?:execute|executing|run|running|command|shell)\b:?\s+/i;
|
|
9199
|
+
const SHELL_WRAPPER = /^(?:cmd\s+\/c|powershell\s+-command|pwsh\s+-c|bash\s+-lc|sh\s+-c)\s+/i;
|
|
9200
|
+
/**
|
|
9201
|
+
* Is the whole title one simple read-only command, such as `ls -la` or `bash -lc "cat a.txt"`?
|
|
9202
|
+
* Anything that chains, redirects, pipes or substitutes is not.
|
|
9203
|
+
*/
|
|
9204
|
+
function isSafeReadCommand(title) {
|
|
9205
|
+
if (title.length > MAX_COMMAND_CHARS) return false;
|
|
9206
|
+
let inner = title.trim();
|
|
9207
|
+
inner = inner.replace(TITLE_VERB, "");
|
|
9208
|
+
if (/^`[^`]+`$/.test(inner)) inner = inner.slice(1, -1).trim();
|
|
9209
|
+
if (/[;&|><`()\n\r]/.test(inner) || inner.includes("${")) return false;
|
|
9210
|
+
if (/-exec/i.test(inner)) return false;
|
|
9211
|
+
const wrapper = SHELL_WRAPPER.exec(inner);
|
|
9212
|
+
if (wrapper) {
|
|
9213
|
+
inner = inner.slice(wrapper[0].length).trim();
|
|
9214
|
+
const q = inner[0];
|
|
9215
|
+
if ((q === "\"" || q === "'") && inner.length >= 2 && inner.endsWith(q)) inner = inner.slice(1, -1).trim();
|
|
9216
|
+
}
|
|
9217
|
+
const first = inner.split(/\s+/)[0] ?? "";
|
|
9218
|
+
return SAFE_READ_COMMANDS.has(first.toLowerCase());
|
|
9219
|
+
}
|
|
9220
|
+
/** May a worker with this access, make this tool call without asking? */
|
|
9221
|
+
function accessAllows(access, call) {
|
|
9222
|
+
if (access === "full") return true;
|
|
9223
|
+
return isAllowed(accessRules(access), call) || call.kind === "execute" && isSafeReadCommand(call.title ?? "");
|
|
9224
|
+
}
|
|
9225
|
+
const WORKER_UNANSWERED = ["deny", "allow"];
|
|
9226
|
+
/** What workers may do, with the default when it was never chosen. */
|
|
9227
|
+
function workerAccessOf(s) {
|
|
9228
|
+
return s.workerAccess ?? "edit";
|
|
9229
|
+
}
|
|
9230
|
+
/** What happens to an unanswered request, with the default when it was never chosen. */
|
|
9231
|
+
function workerUnansweredOf(s) {
|
|
9232
|
+
return s.workerUnanswered ?? "deny";
|
|
9233
|
+
}
|
|
9234
|
+
const WORKER_ASK_TIMEOUT_CHOICES = [
|
|
9235
|
+
60,
|
|
9236
|
+
120,
|
|
9237
|
+
300
|
|
9238
|
+
];
|
|
9239
|
+
/** Seconds a worker waits for its spawner's answer. */
|
|
9240
|
+
const workerAskTimeoutOf = (s) => s.workerAskTimeoutSec ?? 120;
|
|
9098
9241
|
/** Read the settings. A missing, unreadable or malformed file gives no settings. */
|
|
9099
9242
|
function readSettings(path) {
|
|
9100
9243
|
try {
|
|
@@ -9105,7 +9248,10 @@ function readSettings(path) {
|
|
|
9105
9248
|
...typeof o.acpAdapterNpx === "boolean" ? { acpAdapterNpx: o.acpAdapterNpx } : {},
|
|
9106
9249
|
...typeof o.leadCli === "string" && CLI_KINDS.includes(o.leadCli) ? { leadCli: o.leadCli } : {},
|
|
9107
9250
|
...Array.isArray(o.tools) ? { tools: [...new Set(o.tools.filter((t) => typeof t === "string" && CLI_KINDS.includes(t)))] } : {},
|
|
9108
|
-
...typeof o.wakeBeforeFirstPrompt === "boolean" ? { wakeBeforeFirstPrompt: o.wakeBeforeFirstPrompt } : {}
|
|
9251
|
+
...typeof o.wakeBeforeFirstPrompt === "boolean" ? { wakeBeforeFirstPrompt: o.wakeBeforeFirstPrompt } : {},
|
|
9252
|
+
...typeof o.workerAccess === "string" && parseWorkerAccess(o.workerAccess) ? { workerAccess: parseWorkerAccess(o.workerAccess) } : {},
|
|
9253
|
+
...WORKER_ASK_TIMEOUT_CHOICES.includes(o.workerAskTimeoutSec) ? { workerAskTimeoutSec: o.workerAskTimeoutSec } : {},
|
|
9254
|
+
...WORKER_UNANSWERED.includes(o.workerUnanswered) ? { workerUnanswered: o.workerUnanswered } : {}
|
|
9109
9255
|
};
|
|
9110
9256
|
} catch {
|
|
9111
9257
|
return {};
|
|
@@ -9321,7 +9467,6 @@ function decodeAcpLaunchSpec(text) {
|
|
|
9321
9467
|
return x;
|
|
9322
9468
|
};
|
|
9323
9469
|
if (!strings(o.args)) throw new Error("The ACP launch file has no \"args\".");
|
|
9324
|
-
if (!strings(o.allow)) throw new Error("The ACP launch file has no \"allow\".");
|
|
9325
9470
|
const mcp = o.mcp;
|
|
9326
9471
|
return {
|
|
9327
9472
|
file: str("file"),
|
|
@@ -9334,12 +9479,14 @@ function decodeAcpLaunchSpec(text) {
|
|
|
9334
9479
|
...typeof o.task === "string" && o.task !== "" ? { task: o.task } : {},
|
|
9335
9480
|
...typeof o.spawnedBy === "string" ? { spawnedBy: o.spawnedBy } : {},
|
|
9336
9481
|
from: str("from"),
|
|
9337
|
-
|
|
9338
|
-
...typeof o.
|
|
9482
|
+
access: (typeof o.access === "string" ? parseWorkerAccess(o.access) : void 0) ?? "edit",
|
|
9483
|
+
...typeof o.mode === "string" && o.mode !== "" ? { mode: o.mode } : {},
|
|
9339
9484
|
...mcp && typeof mcp.command === "string" && strings(mcp.args) ? { mcp: {
|
|
9340
9485
|
command: mcp.command,
|
|
9341
9486
|
args: mcp.args
|
|
9342
9487
|
} } : {},
|
|
9488
|
+
askTimeoutMs: typeof o.askTimeoutMs === "number" && o.askTimeoutMs > 0 ? o.askTimeoutMs : 12e4,
|
|
9489
|
+
...o.unanswered === "allow" || o.unanswered === "deny" ? { unanswered: o.unanswered } : {},
|
|
9343
9490
|
...typeof o.setupTimeoutMs === "number" && o.setupTimeoutMs > 0 ? { setupTimeoutMs: o.setupTimeoutMs } : {}
|
|
9344
9491
|
};
|
|
9345
9492
|
}
|
|
@@ -9353,65 +9500,6 @@ function takeAcpLaunchFile(path) {
|
|
|
9353
9500
|
rmSync(path, { force: true });
|
|
9354
9501
|
return spec;
|
|
9355
9502
|
}
|
|
9356
|
-
const ACP_TOOL_KINDS = [
|
|
9357
|
-
"read",
|
|
9358
|
-
"edit",
|
|
9359
|
-
"delete",
|
|
9360
|
-
"move",
|
|
9361
|
-
"search",
|
|
9362
|
-
"execute",
|
|
9363
|
-
"think",
|
|
9364
|
-
"fetch",
|
|
9365
|
-
"switch_mode",
|
|
9366
|
-
"other"
|
|
9367
|
-
];
|
|
9368
|
-
const MAX_RULES = 32;
|
|
9369
|
-
/**
|
|
9370
|
-
* Parse `--allow` patterns: comma separated, each `<kind>` or `<kind>:<title glob>`, where kind is
|
|
9371
|
-
* an ACP tool kind or `*`. Examples: `read,search`, `execute:npm test*`, `*`.
|
|
9372
|
-
*/
|
|
9373
|
-
function parseAllowPatterns(input) {
|
|
9374
|
-
const rules = [];
|
|
9375
|
-
for (const raw of input.flatMap((s) => s.split(","))) {
|
|
9376
|
-
const item = raw.trim();
|
|
9377
|
-
if (item === "") continue;
|
|
9378
|
-
const colon = item.indexOf(":");
|
|
9379
|
-
const kind = (colon === -1 ? item : item.slice(0, colon)).trim();
|
|
9380
|
-
const title = colon === -1 ? void 0 : item.slice(colon + 1).trim();
|
|
9381
|
-
if (kind !== "*" && !ACP_TOOL_KINDS.includes(kind)) return {
|
|
9382
|
-
ok: false,
|
|
9383
|
-
message: `"${kind}" is not a tool kind. Use one of: ${ACP_TOOL_KINDS.join(", ")}, or *.`
|
|
9384
|
-
};
|
|
9385
|
-
if (title === "") return {
|
|
9386
|
-
ok: false,
|
|
9387
|
-
message: `"${item}" has an empty title pattern.`
|
|
9388
|
-
};
|
|
9389
|
-
rules.push({
|
|
9390
|
-
kind,
|
|
9391
|
-
...title !== void 0 ? { title } : {}
|
|
9392
|
-
});
|
|
9393
|
-
}
|
|
9394
|
-
if (rules.length > MAX_RULES) return {
|
|
9395
|
-
ok: false,
|
|
9396
|
-
message: `At most ${MAX_RULES} allow patterns.`
|
|
9397
|
-
};
|
|
9398
|
-
return {
|
|
9399
|
-
ok: true,
|
|
9400
|
-
rules
|
|
9401
|
-
};
|
|
9402
|
-
}
|
|
9403
|
-
const formatAllowRule = (r) => r.title === void 0 ? r.kind : `${r.kind}:${r.title}`;
|
|
9404
|
-
function globMatch(glob, text) {
|
|
9405
|
-
return new RegExp(`^${glob.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*")}$`, "s").test(text);
|
|
9406
|
-
}
|
|
9407
|
-
/** Does any rule allow a tool call of this kind and title? A call with no kind is `other`. */
|
|
9408
|
-
function isAllowed(rules, call) {
|
|
9409
|
-
const kind = call.kind ?? "other";
|
|
9410
|
-
const title = call.title ?? "";
|
|
9411
|
-
return rules.some((r) => (r.kind === "*" || r.kind === kind) && (r.title === void 0 || globMatch(r.title, title)));
|
|
9412
|
-
}
|
|
9413
|
-
/** The allow rules a worker gets when none were given: every kind of tool call. */
|
|
9414
|
-
const DEFAULT_ALLOW_RULES = [{ kind: "*" }];
|
|
9415
9503
|
/** Why a CLI cannot be started the way the caller asked. The message is shown to the user. */
|
|
9416
9504
|
var SpawnError = class extends Error {
|
|
9417
9505
|
fix;
|
|
@@ -9675,6 +9763,9 @@ function realSpawnDeps(opts) {
|
|
|
9675
9763
|
isDir: isDirectory,
|
|
9676
9764
|
which: (name) => findOnPath(name, env, platform, platform === "win32" ? entryExists : void 0),
|
|
9677
9765
|
acpNpxConsent: () => readSettings(dataPaths(platform, opts.dataDir).settings).acpAdapterNpx === true,
|
|
9766
|
+
workerAccess: () => readSettings(dataPaths(platform, opts.dataDir).settings).workerAccess,
|
|
9767
|
+
workerUnanswered: () => readSettings(dataPaths(platform, opts.dataDir).settings).workerUnanswered ?? "deny",
|
|
9768
|
+
workerAskTimeoutSec: () => workerAskTimeoutOf(readSettings(dataPaths(platform, opts.dataDir).settings)),
|
|
9678
9769
|
repoExists: existsSync,
|
|
9679
9770
|
killProcess: (pid) => killProcessTree(pid, platform),
|
|
9680
9771
|
prepareFiles: (dataDir) => {
|
|
@@ -9761,7 +9852,11 @@ const SPAWN_TABLE = {
|
|
|
9761
9852
|
binaries: ["claude-agent-acp"],
|
|
9762
9853
|
args: [],
|
|
9763
9854
|
adapterPackage: "@agentclientprotocol/claude-agent-acp",
|
|
9764
|
-
|
|
9855
|
+
modes: {
|
|
9856
|
+
read: "plan",
|
|
9857
|
+
edit: "acceptEdits",
|
|
9858
|
+
full: "bypassPermissions"
|
|
9859
|
+
},
|
|
9765
9860
|
note: "Claude Code has no ACP server of its own. The ACP project's npm package @agentclientprotocol/claude-agent-acp provides one and uses the Claude Code sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
9766
9861
|
docs: ["https://github.com/agentclientprotocol/claude-agent-acp (Apache-2.0, maintained by the ACP project)", "https://www.npmjs.com/package/@agentclientprotocol/claude-agent-acp (bin claude-agent-acp)"]
|
|
9767
9862
|
}
|
|
@@ -9775,7 +9870,11 @@ const SPAWN_TABLE = {
|
|
|
9775
9870
|
binaries: ["codex-acp"],
|
|
9776
9871
|
args: [],
|
|
9777
9872
|
adapterPackage: "@agentclientprotocol/codex-acp",
|
|
9778
|
-
|
|
9873
|
+
modes: {
|
|
9874
|
+
read: "read-only",
|
|
9875
|
+
edit: "workspace-write",
|
|
9876
|
+
full: "agent-full-access"
|
|
9877
|
+
},
|
|
9779
9878
|
note: "Codex has no ACP server of its own. The ACP project's npm package @agentclientprotocol/codex-acp provides one and uses the Codex sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
|
|
9780
9879
|
docs: [
|
|
9781
9880
|
"https://github.com/agentclientprotocol/codex-acp (Apache-2.0, built on the Codex app server)",
|
|
@@ -9792,6 +9891,11 @@ const SPAWN_TABLE = {
|
|
|
9792
9891
|
acp: {
|
|
9793
9892
|
binaries: ["opencode"],
|
|
9794
9893
|
args: ["acp"],
|
|
9894
|
+
modes: {
|
|
9895
|
+
read: "plan",
|
|
9896
|
+
edit: "build",
|
|
9897
|
+
full: "build"
|
|
9898
|
+
},
|
|
9795
9899
|
note: "",
|
|
9796
9900
|
docs: ["https://opencode.ai/docs/cli/acp/ (opencode acp, stdio, protocol version 1)", "reference/src/opencode/packages/opencode/src/cli/cmd/acp.ts"]
|
|
9797
9901
|
}
|
|
@@ -9804,6 +9908,11 @@ const SPAWN_TABLE = {
|
|
|
9804
9908
|
acp: {
|
|
9805
9909
|
binaries: ["agy"],
|
|
9806
9910
|
args: ["acp"],
|
|
9911
|
+
modes: {
|
|
9912
|
+
read: "plan",
|
|
9913
|
+
edit: "accept-edits",
|
|
9914
|
+
full: "default"
|
|
9915
|
+
},
|
|
9807
9916
|
note: "Uses the sign-in cached by an interactive `agy`.",
|
|
9808
9917
|
docs: ["https://antigravity.google/docs/cli/acp (agy acp, stdio)"]
|
|
9809
9918
|
}
|
|
@@ -10061,10 +10170,8 @@ async function spawnSession(deps, req) {
|
|
|
10061
10170
|
isDir: deps.isDir,
|
|
10062
10171
|
confineToHome: req.confineToHome
|
|
10063
10172
|
});
|
|
10064
|
-
const allow = parseAllowPatterns(req.allow ?? []);
|
|
10065
|
-
if (!allow.ok) throw new SpawnError(allow.message, "Fix the --allow patterns.");
|
|
10066
10173
|
const window = req.window === true;
|
|
10067
|
-
|
|
10174
|
+
const access = req.access ?? deps.workerAccess?.() ?? "edit";
|
|
10068
10175
|
const acpResolved = spec.acp ? resolveAcpProgram(cli, spec.acp, {
|
|
10069
10176
|
env: deps.env,
|
|
10070
10177
|
which: deps.which,
|
|
@@ -10134,8 +10241,8 @@ async function spawnSession(deps, req) {
|
|
|
10134
10241
|
...task !== void 0 ? { task } : {},
|
|
10135
10242
|
...req.requester ? { spawnedBy: req.requester.id } : {},
|
|
10136
10243
|
from: req.requester?.name ?? "the user",
|
|
10137
|
-
|
|
10138
|
-
...
|
|
10244
|
+
access,
|
|
10245
|
+
...spec.acp?.modes?.[access] ? { mode: spec.acp.modes[access] } : {},
|
|
10139
10246
|
mcp: {
|
|
10140
10247
|
command: node,
|
|
10141
10248
|
args: [
|
|
@@ -10145,6 +10252,8 @@ async function spawnSession(deps, req) {
|
|
|
10145
10252
|
cli
|
|
10146
10253
|
]
|
|
10147
10254
|
},
|
|
10255
|
+
unanswered: deps.workerUnanswered?.() === "allow" ? "allow" : "deny",
|
|
10256
|
+
askTimeoutMs: (deps.workerAskTimeoutSec?.() ?? 120) * 1e3,
|
|
10148
10257
|
...acpRun?.source.startsWith("npx:") ? { setupTimeoutMs: NPX_SETUP_TIMEOUT_MS } : {}
|
|
10149
10258
|
});
|
|
10150
10259
|
run = await deps.launchBackground({
|
|
@@ -10191,7 +10300,7 @@ async function spawnSession(deps, req) {
|
|
|
10191
10300
|
}
|
|
10192
10301
|
req.onProgress?.(window ? `Opened ${terminal}. Waiting for ${cli} to register.` : `Started ${cli} over ACP in the background (host pid ${run?.pid}). Waiting for it to register.`);
|
|
10193
10302
|
const viaNpx = !window && acpRun?.source.startsWith("npx:") === true;
|
|
10194
|
-
if (viaNpx) req.onProgress?.(`
|
|
10303
|
+
if (viaNpx) req.onProgress?.(`Starting the ${cli} adapter with npx (only the first run downloads it).`);
|
|
10195
10304
|
const session = await waitForRegistration(deps, {
|
|
10196
10305
|
name,
|
|
10197
10306
|
cli,
|
|
@@ -10272,4 +10381,4 @@ async function waitForRegistration(deps, w) {
|
|
|
10272
10381
|
await deps.sleep(250);
|
|
10273
10382
|
}
|
|
10274
10383
|
}
|
|
10275
|
-
export {
|
|
10384
|
+
export { formatContinuation as $, sanitizeLine as $n, resolveRecipient as $t, claimOrchestrator as A, MessageId as An, pendingHookContext as At, dataDir as B, defaultSocketPath as Bn, readAccountTokens as Bt, askedKey as C, CLI_KINDS as Cn, oneWindowPerHost as Ct, autoLimitsFromEnv as D, EVENT_NOTIFICATION_METHOD as Dn, parsePs1ShimTarget as Dt, autoCandidates as E, EVENT_NAMES as En, parseCmdShimTarget as Et, compatStatus as F, RpcResponse as Fn, planProgram as Ft, dropFromList as G, makeEventNotification as Gn, readSettings as Gt, decideAutoContinue as H, ipcMethods as Hn, readCommandLine as Ht, completeLogin as I, SESSION_ENDED_TEXT as In, planSpawn as It, endTurnContinuation as J, newMessageId as Jn, renderBody as Jt, editJson as K, makeResult as Kn, readSpawnRecord as Kt, createWmiWalker as L, SESSION_NAME_PATTERN as Ln, pollDeviceCode as Lt, clearOrchestrator as M, PROTOCOL_VERSION as Mn, pidAlive as Mt, clientProof as N, RelayPayload as Nn, pinnedAdapter as Nt, baseName as O, EventPayload as On, parseWorkerAccess as Ot, compareVersions as P, RpcErrorCode as Pn, planLauncher as Pt, findOnPath as Q, safeParse as Qn, resolveAcpProgram as Qt, currentAccessToken as R, SessionId as Rn, proofsMatch as Rt, appendHookLog as S, writeSettings as Sn, newAuthNonce as St, attachAcpSession as T, DeviceId as Tn, parseCliVersion as Tt, defaultProcessIo as U, isSocketPathTooLong as Un, readInbox as Ut, dataPaths as V, encodeFrame as Vn, readAncestry as Vt, detectRepo as W, makeError as Wn, readProcessList as Wt, existedBefore as X, parseIpcRequest as Xn, requeueEntries as Xt, evaluateLiveness as Y, newSessionId as Yn, requestDeviceCode as Yt, fetchAccountStatus as Z, parseRelayFrame as Zn, requeueMessages as Zt, ackEntries as _, waitForWork as _n, leadLogPath as _t, FROM_USER_NOTICE as a, spawnRecordPath as an, literal as ar, hookLogPath as at, adapterNpxCommand as b, workerAskTimeoutOf as bn, markDelivered as bt, ORCHESTRATOR_TASK_NOTICE as c, statusAfterLiveness as cn, string as cr, isAntigravityApp as ct, SPAWN_TABLE as d, takeWithinChars as dn, isOnline as dt, resolveWindowsCommand as en, socketPathTooLongMessage as er, formatHookContext as et, SpawnError as f, tooManyUnreadMessage as fn, jwtClaim as ft, accessAllows as g, validateRename as gn, leadLogLine as gt, WORKER_UNANSWERED as h, updateSpawnRecord as hn, launcherText as ht, ConvenoError as i, senderOf as in, discriminatedUnion as ir, hookLogLine as it, claimSpawnRecord as j, OWNER_SESSION_ID as jn, pendingTurn as jt, bindAccountDevice as k, Message as kn, pendingForInjection as kt, RESPONSE_BUDGET_BYTES as l, takeAcpLaunchFile as ln, isFromOwner as lt, WORKER_ASK_TIMEOUT_CHOICES as m, uninstallLauncher as mn, launcherPath as mt, AccountError as n, runWaker as nn, array as nr, generateSessionName as nt, HEARTBEAT_INTERVAL_MS as o, spawnSession as on, number as or, hostAlive as ot, WORKER_ACCESS as p, turnHops as pn, late as pt, effectiveHolder as q, newDeviceId as qn, realSpawnDeps as qt, CLAUDE_PENDING_TURN_FOLDER as r, sameJson as rn, boolean as rr, holderAfterDeparture as rt, NOT_FROM_USER_NOTICE as s, startTurnContext as sn, object as sr, hostPidOf as st, ACCOUNT_API as t, runLaunchFile as tn, _enum as tr, formatInbox as tt, SPAWN_CLIS as u, takeWithinBytes as un, isObject as ut, acpOverrideVar as v, waitForWorkBatch as vn, loadJson as vt, askedMarker as w, CliKind as wn, ownSession as wt, agentCommand as x, workerUnansweredOf as xn, needsQuoting as xt, adapterInstallCommand as y, workerAccessOf as yn, logoutAccount as yt, daemonProof as z, createLineDecoder as zn, putInList as zt };
|
|
@@ -3,7 +3,7 @@ import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
|
|
|
3
3
|
import { createConnection } from "node:net";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
|
-
import {
|
|
6
|
+
import { B as dataDir, Bn as defaultSocketPath, Fn as RpcResponse, Hn as ipcMethods, Mn as PROTOCOL_VERSION, N as clientProof, On as EventPayload, Pn as RpcErrorCode, Rt as proofsMatch, St as newAuthNonce, Un as isSocketPathTooLong, V as dataPaths, Vn as encodeFrame, er as socketPathTooLongMessage, i as ConvenoError, z as daemonProof, zn as createLineDecoder } from "./dist-1k5b8UGF.js";
|
|
7
7
|
// ../client/dist/index.js
|
|
8
8
|
const DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
9
9
|
const DEFAULT_START_TIMEOUT_MS = 1e4;
|
|
@@ -26,6 +26,8 @@ const CLIENT_METHODS = [
|
|
|
26
26
|
"session.list",
|
|
27
27
|
"orchestrator.claim",
|
|
28
28
|
"orchestrator.clear",
|
|
29
|
+
"permission.ask",
|
|
30
|
+
"permission.answer",
|
|
29
31
|
"message.send",
|
|
30
32
|
"message.inbox",
|
|
31
33
|
"message.deliver",
|
|
@@ -54,6 +56,7 @@ const NOT_REPLAYABLE = /* @__PURE__ */ new Set([
|
|
|
54
56
|
"daemon.shutdown",
|
|
55
57
|
"turn.end",
|
|
56
58
|
"turn.wake",
|
|
59
|
+
"permission.ask",
|
|
57
60
|
"devices.pair",
|
|
58
61
|
"devices.pairConfirm",
|
|
59
62
|
"devices.revoke",
|
|
@@ -186,14 +189,14 @@ var Connection = class {
|
|
|
186
189
|
p.reject(e);
|
|
187
190
|
}
|
|
188
191
|
}
|
|
189
|
-
call(method, params) {
|
|
192
|
+
call(method, params, timeoutMs = this.timeoutMs) {
|
|
190
193
|
if (this.closed) return Promise.reject(new ConnectionLost("Connection to the Conveno daemon is closed.", false));
|
|
191
194
|
const id = this.nextId++;
|
|
192
195
|
return new Promise((resolve, reject) => {
|
|
193
196
|
const timer = setTimeout(() => {
|
|
194
197
|
this.pending.delete(id);
|
|
195
|
-
reject(new ClientError(`Request ${method} timed out after ${
|
|
196
|
-
},
|
|
198
|
+
reject(new ClientError(`Request ${method} timed out after ${timeoutMs} ms. Check that the daemon is running with "conveno daemon status".`, { kind: "connection" }));
|
|
199
|
+
}, timeoutMs);
|
|
197
200
|
this.pending.set(id, {
|
|
198
201
|
resolve,
|
|
199
202
|
reject,
|
|
@@ -397,8 +400,9 @@ var Link = class {
|
|
|
397
400
|
if (this.closed) throw new ClientError("The Conveno client is closed.");
|
|
398
401
|
const used = this.conn;
|
|
399
402
|
let result;
|
|
403
|
+
const wait = method === "permission.ask" ? wire.timeoutMs + 1e4 : void 0;
|
|
400
404
|
try {
|
|
401
|
-
result = await used.call(method, wire);
|
|
405
|
+
result = await used.call(method, wire, wait);
|
|
402
406
|
} catch (e) {
|
|
403
407
|
if (!(e instanceof ConnectionLost) || this.closed) throw plainError(e, this.socketPath);
|
|
404
408
|
if (e.sent && NOT_REPLAYABLE.has(method)) {
|