@conveno/cli 0.2.0-rc.13 → 0.2.0-rc.15
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-DZf0zyNC.js} +3 -3
- package/dist/{agy-relay-BJLRYbFp.js → agy-relay-DSRJtMz3.js} +3 -2
- package/dist/{args-C4rVCVXx.js → args-CpAvszNY.js} +13 -6
- package/dist/bin.js +2 -2
- package/dist/daemon.js +120 -12
- package/dist/{daemonError-CjxG2yUl.js → daemonError-Bj22X-4V.js} +1 -1
- package/dist/{dist-D4sb5RQD.js → dist-Bv1bmmme.js} +1 -1
- package/dist/{dist-CoRBNycn.js → dist-Bx22a5AV.js} +1 -1
- package/dist/{dist-B14ldKRS.js → dist-C4KljaIP.js} +1 -1
- package/dist/{dist-Ca3P7aN-.js → dist-C59LTq60.js} +9 -5
- package/dist/{dist-C9Z1EMlM.js → dist-DDzIkwf9.js} +1 -1
- package/dist/{dist-DnNuDzEA.js → dist-ZL7d4_97.js} +187 -75
- package/dist/{dist-BkhKEexU.js → dist-fI_XSoCQ.js} +192 -24
- package/dist/{hook-C60hXJdg.js → hook-BFZTvd7M.js} +1 -1
- package/dist/hook-entry-CmuvppGf.js +1 -0
- package/dist/{hook-entry-WlJSM5aD.js → hook-entry-CvzyjOo4.js} +6 -6
- package/dist/{main-I2RMN7XN.js → main-1QSm5UjR.js} +34 -60
- package/dist/{pick-Colav8Wm.js → pick-DaCRjuyz.js} +1 -1
- package/dist/{run-BuDbmxx_.js → run-CKiYjNqx.js} +276 -19
- package/dist/{runtime-CPmrhPFJ.js → runtime-CeFKWoIL.js} +37 -12
- package/dist/{uninstall-812XZDTG.js → uninstall-DK25hyWX.js} +80 -8
- package/dist/{watch-DXbOOc20.js → watch-De3wbdQL.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-jOfjq-0A.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as connect } from "./dist-
|
|
2
|
-
import {
|
|
1
|
+
import { n as connect } from "./dist-C59LTq60.js";
|
|
2
|
+
import { $ as formatContinuation, Pn as RpcErrorCode, Rn as SessionId, g as accessAllows, hn as updateSpawnRecord, i as ConvenoError, ln as takeAcpLaunchFile, wn as CliKind } from "./dist-ZL7d4_97.js";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { existsSync, rmSync } from "node:fs";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
@@ -13,13 +13,17 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
13
13
|
*/
|
|
14
14
|
function answer(ask, allow) {
|
|
15
15
|
const want = allow ? "allow_once" : "reject_once";
|
|
16
|
-
const
|
|
16
|
+
const candidates = ask.options.filter((o) => o.kind === want);
|
|
17
|
+
const option = allow ? candidates[0] : candidates.find((o) => {
|
|
18
|
+
const text = `${o.optionId} ${o.name}`;
|
|
19
|
+
return /decline|continue/i.test(text) && !/cancel|abort|differently/i.test(text);
|
|
20
|
+
}) ?? candidates[0];
|
|
17
21
|
return option ? {
|
|
18
22
|
outcome: "selected",
|
|
19
23
|
optionId: option.optionId
|
|
20
24
|
} : { outcome: "cancelled" };
|
|
21
25
|
}
|
|
22
|
-
const CONVENO_TOOL_TITLE = new RegExp(`^(?:tool\\s*[:\\-]\\s*)?(?:mcp[_\\-.:/ ]{1,3})?conveno[_\\-.:/ ]{1,3}(${[
|
|
26
|
+
const CONVENO_TOOL_TITLE = new RegExp(`^(?:(?:running|run|calling|call|using|use|execute|invoke)\\s+)?(?:tool\\s*[:\\-]\\s*)?(?:mcp[_\\-.:/ ]{1,3})?conveno[_\\-.:/ ]{1,3}(${[
|
|
23
27
|
"whoami",
|
|
24
28
|
"list_sessions",
|
|
25
29
|
"send",
|
|
@@ -30,8 +34,29 @@ const CONVENO_TOOL_TITLE = new RegExp(`^(?:tool\\s*[:\\-]\\s*)?(?:mcp[_\\-.:/ ]{
|
|
|
30
34
|
"become_lead",
|
|
31
35
|
"orchestrate",
|
|
32
36
|
"handoff",
|
|
33
|
-
"spawn_session"
|
|
37
|
+
"spawn_session",
|
|
38
|
+
"answer_permission"
|
|
34
39
|
].join("|")})$`, "i");
|
|
40
|
+
/** The hidden subcommand that starts Antigravity's idle-wake relay (`RELAY_SUBCOMMAND` of its adapter). */
|
|
41
|
+
const RELAY_SUBCOMMAND = "agy-relay";
|
|
42
|
+
/** One word of a command line: quoted (no quote, `$` or backtick inside), or bare without shell metacharacters. */
|
|
43
|
+
const WORD = String.raw`"[^"'\r\n$\`]+"|'[^"'\r\n$\`]+'|[^\s"'\r\n$\`&|;<>()^%!*?{}]+`;
|
|
44
|
+
const unquote = (w) => /^["']/.test(w) ? w.slice(1, -1) : w;
|
|
45
|
+
const baseName = (w) => unquote(w).split(/[\\/]/).pop() ?? "";
|
|
46
|
+
const RELAY_TITLE = new RegExp(`^(?:(?:running|run|calling|call|using|use|execute|invoke)\\s+)?(\`?)(?:&\\s+)?(${WORD})(?:\\s+(${WORD}))?\\s+${RELAY_SUBCOMMAND}\\1$`, "i");
|
|
47
|
+
/**
|
|
48
|
+
* Is this execute call exactly Conveno's relay command: `conveno agy-relay`, with a path, a
|
|
49
|
+
* `.cmd`, `.exe` or `.ps1` ending, or `node <path>/bin.js agy-relay`, and nothing chained after it.
|
|
50
|
+
*/
|
|
51
|
+
function isRelayCommand(call) {
|
|
52
|
+
if (call.kind !== "execute") return false;
|
|
53
|
+
const m = RELAY_TITLE.exec((call.title ?? "").trim());
|
|
54
|
+
if (!m) return false;
|
|
55
|
+
const first = m[2] ?? "";
|
|
56
|
+
const second = m[3];
|
|
57
|
+
if (second === void 0) return /^conveno(?:\.(?:cmd|exe|ps1))?$/i.test(baseName(first));
|
|
58
|
+
return /^node(?:\.exe)?$/i.test(baseName(first)) && /^bin\.js$/i.test(baseName(second));
|
|
59
|
+
}
|
|
35
60
|
/** Kinds whose title is a command line or a path, so a title that looks like a tool name is not one. */
|
|
36
61
|
const COMMAND_OR_FILE_KINDS = /* @__PURE__ */ new Set([
|
|
37
62
|
"execute",
|
|
@@ -50,14 +75,14 @@ function convenoToolOf(call) {
|
|
|
50
75
|
return m ? m[1]?.toLowerCase() : void 0;
|
|
51
76
|
}
|
|
52
77
|
var AllowListPolicy = class {
|
|
53
|
-
|
|
54
|
-
constructor(
|
|
55
|
-
this.
|
|
78
|
+
allows;
|
|
79
|
+
constructor(allows) {
|
|
80
|
+
this.allows = allows;
|
|
56
81
|
}
|
|
57
82
|
async decide(ask, _signal) {
|
|
58
83
|
const what = `${ask.title ?? "a tool call"} (${ask.kind ?? "other"})`;
|
|
59
|
-
const own = convenoToolOf(ask) !== void 0;
|
|
60
|
-
if (own ||
|
|
84
|
+
const own = convenoToolOf(ask) !== void 0 || isRelayCommand(ask);
|
|
85
|
+
if (own || this.allows({
|
|
61
86
|
kind: ask.kind,
|
|
62
87
|
title: ask.title
|
|
63
88
|
})) {
|
|
@@ -80,6 +105,84 @@ var AllowListPolicy = class {
|
|
|
80
105
|
};
|
|
81
106
|
}
|
|
82
107
|
};
|
|
108
|
+
/** "45 s", "2 min". */
|
|
109
|
+
const waitText = (ms) => ms >= 6e4 && ms % 6e4 === 0 ? `${ms / 6e4} min` : `${Math.round(ms / 1e3)} s`;
|
|
110
|
+
/**
|
|
111
|
+
* What the inner policy denies is put to the spawner. Its answer decides; with no answer, or no
|
|
112
|
+
* spawner, `unanswered` does. "Always" is remembered for this policy's lifetime, per kind and exact
|
|
113
|
+
* title. The agent only ever gets allow-once or reject-once (see `answer`).
|
|
114
|
+
*/
|
|
115
|
+
var AskSpawnerPolicy = class {
|
|
116
|
+
inner;
|
|
117
|
+
deps;
|
|
118
|
+
always = /* @__PURE__ */ new Set();
|
|
119
|
+
constructor(inner, deps) {
|
|
120
|
+
this.inner = inner;
|
|
121
|
+
this.deps = deps;
|
|
122
|
+
}
|
|
123
|
+
async decide(ask, signal) {
|
|
124
|
+
const first = await this.inner.decide(ask, signal);
|
|
125
|
+
if (first.allowed) return first;
|
|
126
|
+
const what = `${ask.title ?? "a tool call"} (${ask.kind ?? "other"})`;
|
|
127
|
+
const key = ask.title === void 0 ? void 0 : `${ask.kind ?? ""}\0${ask.title}`;
|
|
128
|
+
if (key !== void 0 && this.always.has(key)) return this.allow(ask, what, `allowed ${what}: always allowed earlier`);
|
|
129
|
+
const { deps } = this;
|
|
130
|
+
const timeoutMs = deps.timeoutMs ?? 12e4;
|
|
131
|
+
await deps.waiting?.(ask.title ?? what);
|
|
132
|
+
let reply;
|
|
133
|
+
try {
|
|
134
|
+
reply = await Promise.race([deps.ask({
|
|
135
|
+
...ask.title !== void 0 ? { title: ask.title.slice(0, 500) } : {},
|
|
136
|
+
...ask.kind !== void 0 ? { kind: ask.kind.slice(0, 100) } : {},
|
|
137
|
+
timeoutMs,
|
|
138
|
+
unanswered: deps.unanswered
|
|
139
|
+
}).catch((e) => {
|
|
140
|
+
deps.log?.(`could not ask the spawner: ${e instanceof Error ? e.message : String(e)}`);
|
|
141
|
+
return { answer: "no_spawner" };
|
|
142
|
+
}), new Promise((r) => {
|
|
143
|
+
if (signal.aborted) r(null);
|
|
144
|
+
else signal.addEventListener("abort", () => r(null), { once: true });
|
|
145
|
+
})]);
|
|
146
|
+
} finally {
|
|
147
|
+
await deps.waiting?.(null);
|
|
148
|
+
}
|
|
149
|
+
if (reply === null) return {
|
|
150
|
+
allowed: false,
|
|
151
|
+
outcome: { outcome: "cancelled" },
|
|
152
|
+
reason: `cancelled ${what}`
|
|
153
|
+
};
|
|
154
|
+
switch (reply.answer) {
|
|
155
|
+
case "allow_once": return this.allow(ask, what, `allowed ${what}: ${deps.spawnerName} said yes`);
|
|
156
|
+
case "allow_always":
|
|
157
|
+
if (key !== void 0) this.always.add(key);
|
|
158
|
+
return this.allow(ask, what, `allowed ${what}: ${deps.spawnerName} said always`);
|
|
159
|
+
case "deny": return this.deny(ask, what, `denied by ${deps.spawnerName}`);
|
|
160
|
+
case "unanswered":
|
|
161
|
+
case "worker_offline":
|
|
162
|
+
case "no_spawner": {
|
|
163
|
+
const why = reply.answer === "unanswered" ? `no answer in ${waitText(timeoutMs)}` : reply.answer === "worker_offline" ? "the worker went offline while waiting" : "no spawner to ask";
|
|
164
|
+
return deps.unanswered === "allow" ? this.allow(ask, what, `allowed ${what}: ${why}`) : this.deny(ask, what, why);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
allow(ask, what, reason) {
|
|
169
|
+
const outcome = answer(ask, true);
|
|
170
|
+
if (outcome.outcome === "selected") return {
|
|
171
|
+
allowed: true,
|
|
172
|
+
outcome,
|
|
173
|
+
reason
|
|
174
|
+
};
|
|
175
|
+
return this.deny(ask, what, "the agent offered no allow-once option");
|
|
176
|
+
}
|
|
177
|
+
deny(ask, what, why) {
|
|
178
|
+
return {
|
|
179
|
+
allowed: false,
|
|
180
|
+
outcome: answer(ask, false),
|
|
181
|
+
reason: `denied ${what}: ${why}`,
|
|
182
|
+
why
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
};
|
|
83
186
|
/** Calls remembered at most; the oldest are dropped. */
|
|
84
187
|
const TOOLS_MAX = 1e3;
|
|
85
188
|
var ToolTracker = class {
|
|
@@ -102,7 +205,7 @@ var ToolTracker = class {
|
|
|
102
205
|
return u.sessionUpdate === "tool_call" ? next.title ?? next.kind ?? "tool" : void 0;
|
|
103
206
|
}
|
|
104
207
|
};
|
|
105
|
-
const HOST_VERSION = "0.2.0-rc.
|
|
208
|
+
const HOST_VERSION = "0.2.0-rc.15";
|
|
106
209
|
/** A stop request file: `conveno stop` writes it next to the spawn record. */
|
|
107
210
|
const stopRequestPath = (recordPath) => recordPath.replace(/\.json$/, ".stop");
|
|
108
211
|
function withTimeout(p, ms, what) {
|
|
@@ -157,8 +260,14 @@ var AcpHost = class {
|
|
|
157
260
|
/** The status line after a failed prompt, kept until the next prompt starts. */
|
|
158
261
|
failedText;
|
|
159
262
|
denials = [];
|
|
263
|
+
/** A denied call of a worker nobody spawned, shown until the next turn starts. */
|
|
264
|
+
deniedText;
|
|
160
265
|
/** The worker called Conveno's `send` (or `handoff`) in the turn that is running. */
|
|
161
266
|
sentThisTurn = false;
|
|
267
|
+
/** The daemon's `lastSentAt` of this session when the turn began. */
|
|
268
|
+
sentAtTurnStart;
|
|
269
|
+
/** Status updates go out one after another, so a late one cannot overwrite a newer one. */
|
|
270
|
+
statusChain = Promise.resolve();
|
|
162
271
|
lastStatus;
|
|
163
272
|
timers = [];
|
|
164
273
|
constructor(spec, deps) {
|
|
@@ -166,9 +275,17 @@ var AcpHost = class {
|
|
|
166
275
|
this.deps = deps;
|
|
167
276
|
this.client = deps.client;
|
|
168
277
|
this.log = deps.log ?? ((line) => process.stderr.write(`[conveno acp-host] ${line}\n`));
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
278
|
+
this.policy = deps.policy ?? new AskSpawnerPolicy(new AllowListPolicy((call) => accessAllows(spec.access, call)), {
|
|
279
|
+
spawnerName: spec.from,
|
|
280
|
+
unanswered: spec.unanswered ?? "deny",
|
|
281
|
+
timeoutMs: deps.askTimeoutMs ?? spec.askTimeoutMs ?? 12e4,
|
|
282
|
+
ask: (p) => this.client["permission.ask"]({
|
|
283
|
+
sessionId: this.me,
|
|
284
|
+
...p
|
|
285
|
+
}),
|
|
286
|
+
waiting: (title) => this.waitingFor(title),
|
|
287
|
+
log: this.log
|
|
288
|
+
});
|
|
172
289
|
}
|
|
173
290
|
/** Ask the host to stop. The first reason wins. */
|
|
174
291
|
stop(reason) {
|
|
@@ -260,11 +377,19 @@ var AcpHost = class {
|
|
|
260
377
|
}), timeout, "session/new"));
|
|
261
378
|
this.acpSessionId = created.sessionId;
|
|
262
379
|
this.log(`session/new: ${created.sessionId}`);
|
|
263
|
-
const mode = spec.
|
|
380
|
+
const mode = spec.mode;
|
|
264
381
|
if (mode && created.modes?.availableModes.some((m) => m.id === mode)) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setMode, {
|
|
265
382
|
sessionId: created.sessionId,
|
|
266
383
|
modeId: mode
|
|
267
384
|
}), timeout, "session/set_mode")).then(() => this.log(`mode: ${mode}`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
|
|
385
|
+
else if (mode) {
|
|
386
|
+
const configId = modeConfigId(created.configOptions, mode);
|
|
387
|
+
if (configId) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setConfigOption, {
|
|
388
|
+
sessionId: created.sessionId,
|
|
389
|
+
configId,
|
|
390
|
+
value: mode
|
|
391
|
+
}), timeout, "session/set_config_option")).then(() => this.log(`mode: ${mode} (config option ${configId})`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
|
|
392
|
+
}
|
|
268
393
|
const spawnedBy = SessionId.safeParse(spec.spawnedBy);
|
|
269
394
|
const { session } = await this.client["session.register"]({
|
|
270
395
|
name: spec.name,
|
|
@@ -308,7 +433,7 @@ var AcpHost = class {
|
|
|
308
433
|
allowContinue: true
|
|
309
434
|
});
|
|
310
435
|
const next = formatContinuation(r.messages, r.orchestrator, r.remaining) || null;
|
|
311
|
-
if (next === null) await this.status(void 0, this.failedText ?? null);
|
|
436
|
+
if (next === null) await this.status(void 0, this.failedText ?? this.deniedText ?? null);
|
|
312
437
|
return next;
|
|
313
438
|
} catch (e) {
|
|
314
439
|
if (e instanceof ConvenoError && e.code === RpcErrorCode.NotFound) {
|
|
@@ -319,7 +444,7 @@ var AcpHost = class {
|
|
|
319
444
|
return null;
|
|
320
445
|
}
|
|
321
446
|
this.log(`turn.end failed: ${errText(e)}`);
|
|
322
|
-
await this.status("idle", null);
|
|
447
|
+
await this.status("idle", this.failedText ?? this.deniedText ?? null);
|
|
323
448
|
return null;
|
|
324
449
|
}
|
|
325
450
|
}
|
|
@@ -334,7 +459,9 @@ var AcpHost = class {
|
|
|
334
459
|
this.turnCtl = new AbortController();
|
|
335
460
|
this.failedText = void 0;
|
|
336
461
|
this.denials = [];
|
|
462
|
+
this.deniedText = void 0;
|
|
337
463
|
this.sentThisTurn = false;
|
|
464
|
+
this.sentAtTurnStart = await this.lastSentAt();
|
|
338
465
|
await this.status("busy", null);
|
|
339
466
|
const turn = conn.agent.request(methods.agent.session.prompt, {
|
|
340
467
|
sessionId: sid,
|
|
@@ -429,7 +556,7 @@ var AcpHost = class {
|
|
|
429
556
|
if (id !== void 0) this.noteConvenoCall(this.tools.tools.get(id));
|
|
430
557
|
if (doing !== void 0 && doing !== this.lastStatus) {
|
|
431
558
|
this.lastStatus = doing;
|
|
432
|
-
this.status(void 0, doing);
|
|
559
|
+
this.status(void 0, this.deniedText ?? doing);
|
|
433
560
|
}
|
|
434
561
|
}
|
|
435
562
|
async onPermission(p) {
|
|
@@ -449,9 +576,16 @@ var AcpHost = class {
|
|
|
449
576
|
};
|
|
450
577
|
const signal = this.turnCtl.signal;
|
|
451
578
|
const decision = await Promise.race([this.policy.decide(ask, signal), new Promise((r) => signal.addEventListener("abort", () => r(null), { once: true }))]);
|
|
452
|
-
if (decision === null) return { outcome: { outcome: "cancelled" } };
|
|
579
|
+
if (decision === null || signal.aborted) return { outcome: { outcome: "cancelled" } };
|
|
453
580
|
this.log(`permission: ${decision.reason}`);
|
|
454
|
-
if (!decision.allowed)
|
|
581
|
+
if (!decision.allowed) {
|
|
582
|
+
const what = `${title ?? "a tool call"} (${kind ?? "other"})`;
|
|
583
|
+
this.denials.push(`${what}: ${decision.why ?? "it was not allowed"}`);
|
|
584
|
+
if (!this.spec.spawnedBy) {
|
|
585
|
+
this.deniedText = `denied: ${title ?? what}`;
|
|
586
|
+
this.status(void 0, this.deniedText);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
455
589
|
return { outcome: decision.outcome };
|
|
456
590
|
}
|
|
457
591
|
get me() {
|
|
@@ -462,11 +596,29 @@ var AcpHost = class {
|
|
|
462
596
|
if (!this.sessionId) return;
|
|
463
597
|
const text = typeof statusText === "string" ? statusText.slice(0, 200) : statusText;
|
|
464
598
|
if (status === void 0 && text === void 0) return;
|
|
465
|
-
|
|
466
|
-
|
|
599
|
+
const sessionId = this.sessionId;
|
|
600
|
+
const send = () => this.client["session.setStatus"]({
|
|
601
|
+
sessionId,
|
|
467
602
|
...status ? { status } : {},
|
|
468
603
|
...text !== void 0 ? { statusText: text } : {}
|
|
469
604
|
}).catch(() => void 0);
|
|
605
|
+
const done = this.statusChain.then(send, send);
|
|
606
|
+
this.statusChain = done;
|
|
607
|
+
await done;
|
|
608
|
+
}
|
|
609
|
+
/** When the daemon last saw this session send a message; undefined if never, or unknown. */
|
|
610
|
+
async lastSentAt() {
|
|
611
|
+
if (!this.sessionId) return void 0;
|
|
612
|
+
try {
|
|
613
|
+
const { sessions } = await this.client["session.list"]({ includeOffline: true });
|
|
614
|
+
return sessions.find((x) => x.id === this.sessionId)?.lastSentAt;
|
|
615
|
+
} catch {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/** Show that the worker waits for its spawner's answer; null puts the usual status back. */
|
|
620
|
+
async waitingFor(title) {
|
|
621
|
+
await this.status(void 0, title === null ? this.deniedText ?? this.lastStatus ?? null : `waiting for permission: ${title}`);
|
|
470
622
|
}
|
|
471
623
|
async heartbeat() {
|
|
472
624
|
if (!this.sessionId) return;
|
|
@@ -515,7 +667,8 @@ var AcpHost = class {
|
|
|
515
667
|
const denials = this.denials;
|
|
516
668
|
this.denials = [];
|
|
517
669
|
if (!this.spec.spawnedBy) return;
|
|
518
|
-
|
|
670
|
+
let silent = finished && !this.sentThisTurn;
|
|
671
|
+
if (silent && await this.lastSentAt() !== this.sentAtTurnStart) silent = false;
|
|
519
672
|
if (denials.length === 0 && !silent) return;
|
|
520
673
|
const who = `[conveno] Worker ${this.spec.name} (${this.spec.cli}, over ACP)`;
|
|
521
674
|
const lines = [];
|
|
@@ -523,7 +676,7 @@ var AcpHost = class {
|
|
|
523
676
|
if (denials.length > 0) {
|
|
524
677
|
const list = denials.slice(0, 5).map((d) => `- ${d}`);
|
|
525
678
|
if (denials.length > 5) list.push(`- and ${denials.length - 5} more`);
|
|
526
|
-
lines.push(silent ? "
|
|
679
|
+
lines.push(silent ? "These tool calls were not allowed in its last turn:" : `${who} had tool calls that were not allowed in its last turn:`, ...list);
|
|
527
680
|
}
|
|
528
681
|
await this.tell(lines.join("\n"));
|
|
529
682
|
}
|
|
@@ -586,6 +739,21 @@ var AcpHost = class {
|
|
|
586
739
|
this.log(`stopped: ${describeStop(reason)}`);
|
|
587
740
|
}
|
|
588
741
|
};
|
|
742
|
+
/**
|
|
743
|
+
* The id of a session config option in the `mode` category (or with id `mode`) that offers `value`,
|
|
744
|
+
* from `session/new`'s `configOptions`. Undefined when there is none.
|
|
745
|
+
*/
|
|
746
|
+
function modeConfigId(options, value) {
|
|
747
|
+
if (!Array.isArray(options)) return void 0;
|
|
748
|
+
for (const o of options) {
|
|
749
|
+
if (o?.category !== "mode" && o?.id !== "mode") continue;
|
|
750
|
+
const values = (Array.isArray(o.options) ? o.options : []).flatMap((x) => {
|
|
751
|
+
const item = x;
|
|
752
|
+
return Array.isArray(item?.options) ? item.options : [item];
|
|
753
|
+
});
|
|
754
|
+
if (typeof o.id === "string" && values.some((v) => v?.value === value)) return o.id;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
589
757
|
/** Set on every agent the ACP host starts. `conveno hook` exits at once when it is set. */
|
|
590
758
|
const ACP_WORKER_ENV = "CONVENO_ACP_WORKER";
|
|
591
759
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { appendFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { S as appendHookLog, it as hookLogLine } from "./dist-ZL7d4_97.js";
|
|
3
3
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
4
4
|
// src/hook.ts
|
|
5
5
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as runHookEntry } from "./hook-entry-CvzyjOo4.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
|
-
import { n as antigravityAdapter } from "./dist-
|
|
2
|
+
import { n as antigravityAdapter } from "./dist-Bv1bmmme.js";
|
|
3
3
|
import { isAbsolute, join } from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { At as pendingHookContext, B as dataDir, Gt as readSettings, J as endTurnContinuation, Tt as parseCliVersion, V as dataPaths, Vt as readAncestry, Zt as requeueMessages, _n as waitForWork, at as hookLogPath, jt as pendingTurn, ot as hostAlive, r as CLAUDE_PENDING_TURN_FOLDER, sn as startTurnContext, vn as waitForWorkBatch, wt as ownSession } from "./dist-ZL7d4_97.js";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
7
|
-
import { t as codexAdapter } from "./dist-
|
|
8
|
-
import { t as grokAdapter } from "./dist-
|
|
9
|
-
import { n as connect } from "./dist-
|
|
10
|
-
import { t as runHook } from "./hook-
|
|
7
|
+
import { t as codexAdapter } from "./dist-DDzIkwf9.js";
|
|
8
|
+
import { t as grokAdapter } from "./dist-C4KljaIP.js";
|
|
9
|
+
import { n as connect } from "./dist-C59LTq60.js";
|
|
10
|
+
import { t as runHook } from "./hook-BFZTvd7M.js";
|
|
11
11
|
// ../adapters/claude/dist/index.js
|
|
12
12
|
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
13
13
|
/** Read a JSON object file. Missing or blank files give `{}`; anything else that is not a JSON object throws. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as runAccount,
|
|
3
|
-
import { a as parseFlags, i as commandHelp, n as COMMANDS, r as COMMAND_NAMES, t as ALL_COMMAND_NAMES } from "./args-
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
1
|
+
import { Cn as CLI_KINDS, Ot as parseWorkerAccess, V as dataPaths, d as SPAWN_TABLE, f as SpawnError, on as spawnSession, p as WORKER_ACCESS, qt as realSpawnDeps, tn as runLaunchFile, u as SPAWN_CLIS } from "./dist-ZL7d4_97.js";
|
|
2
|
+
import { A as runRelay, I as runAccount, L as runLogin, M as runDaemon, P as VERSION, R as runLogout, b as workerAccessLine, i as runDoctor, k as runDevices, m as runSetup, p as runInit, t as runUninstall } from "./uninstall-DK25hyWX.js";
|
|
3
|
+
import { a as parseFlags, i as commandHelp, n as COMMANDS, r as COMMAND_NAMES, t as ALL_COMMAND_NAMES } from "./args-CpAvszNY.js";
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-Bj22X-4V.js";
|
|
5
5
|
import { chmod, mkdir, writeFile } from "node:fs/promises";
|
|
6
6
|
import { join, resolve } from "node:path";
|
|
7
7
|
import { a as fail, c as plural, d as warnBlock, n as cmd, r as columns, s as plainError, t as closest, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
8
|
-
import { t as runHook } from "./hook-
|
|
8
|
+
import { t as runHook } from "./hook-BFZTvd7M.js";
|
|
9
9
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
10
|
-
import { t as findSession } from "./pick-
|
|
10
|
+
import { t as findSession } from "./pick-DaCRjuyz.js";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
12
|
// src/errorLog.ts
|
|
13
13
|
/** The message of an unexpected error, as it is. Not the softened text `plainError` gives. */
|
|
@@ -96,7 +96,10 @@ async function runLead(ctx, argv) {
|
|
|
96
96
|
exit: 1,
|
|
97
97
|
ref: "e_session"
|
|
98
98
|
});
|
|
99
|
-
await client["orchestrator.claim"]({
|
|
99
|
+
await client["orchestrator.claim"]({
|
|
100
|
+
sessionId: found.id,
|
|
101
|
+
via: "cli"
|
|
102
|
+
});
|
|
100
103
|
ctx.out(`${t.status("ok")} ${t.bold(found.name)} is the lead now.\n`);
|
|
101
104
|
return 0;
|
|
102
105
|
} catch (e) {
|
|
@@ -238,47 +241,6 @@ function readTaskFile(ctx, path) {
|
|
|
238
241
|
});
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
|
-
/** Is this word the start of an allow pattern: a tool kind or `*`, then maybe `:<title glob>`? */
|
|
242
|
-
const isAllowItem = (word) => {
|
|
243
|
-
const kind = word.split(":")[0]?.trim() ?? "";
|
|
244
|
-
return kind === "*" || ACP_TOOL_KINDS.includes(kind);
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Fold every way of writing `--allow` into one `--allow=<a,b,c>`: comma separated, space separated
|
|
248
|
-
* (`--allow read search`, which is what PowerShell's shim turns `--allow read,search` into), and
|
|
249
|
-
* repeated. Words after `--allow` are taken as more patterns only while they look like one, so a
|
|
250
|
-
* CLI name or another flag ends the list. Nothing is changed when `--allow` is not used.
|
|
251
|
-
*/
|
|
252
|
-
function normalizeAllowArgs(argv) {
|
|
253
|
-
const rest = [];
|
|
254
|
-
const allow = [];
|
|
255
|
-
let used = false;
|
|
256
|
-
for (let i = 0; i < argv.length; i++) {
|
|
257
|
-
const a = argv[i];
|
|
258
|
-
if (a === "--") {
|
|
259
|
-
rest.push(...argv.slice(i));
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
if (a.startsWith("--allow=")) {
|
|
263
|
-
used = true;
|
|
264
|
-
allow.push(a.slice(8));
|
|
265
|
-
} else if (a === "--allow") {
|
|
266
|
-
used = true;
|
|
267
|
-
const value = argv[i + 1];
|
|
268
|
-
if (value === void 0) {
|
|
269
|
-
rest.push(a);
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
allow.push(value);
|
|
273
|
-
i++;
|
|
274
|
-
while (i + 1 < argv.length && isAllowItem(argv[i + 1]) && !argv[i + 1]?.startsWith("-")) {
|
|
275
|
-
allow.push(argv[i + 1]);
|
|
276
|
-
i++;
|
|
277
|
-
}
|
|
278
|
-
} else rest.push(a);
|
|
279
|
-
}
|
|
280
|
-
return used ? [...rest, `--allow=${allow.join(",")}`] : argv;
|
|
281
|
-
}
|
|
282
244
|
/**
|
|
283
245
|
* `conveno spawn <cli> ...`: start a worker session of any CLI with a first task, and print the
|
|
284
246
|
* name it registers under.
|
|
@@ -287,7 +249,14 @@ async function runSpawn(ctx, argv) {
|
|
|
287
249
|
const t = ctx.theme;
|
|
288
250
|
const spec = COMMANDS.find((c) => c.name === "spawn");
|
|
289
251
|
if (!spec) return 2;
|
|
290
|
-
|
|
252
|
+
if (argv.slice(0, argv.indexOf("--") === -1 ? void 0 : argv.indexOf("--")).some((a) => a === "--allow" || a.startsWith("--allow="))) return fail(ctx, {
|
|
253
|
+
what: "--allow was removed",
|
|
254
|
+
detail: ["Use --access read, edit or full."],
|
|
255
|
+
fix: `Run ${cmd(ctx.theme, "conveno spawn --help")} to see the options.`,
|
|
256
|
+
exit: 2,
|
|
257
|
+
ref: "e_usage"
|
|
258
|
+
});
|
|
259
|
+
const parsed = parseFlags(ctx, spec, argv);
|
|
291
260
|
if (typeof parsed === "number") return parsed;
|
|
292
261
|
const help = `Run ${cmd(t, "conveno spawn --help")} to see the options.`;
|
|
293
262
|
const [cli, ...extra] = parsed.positionals;
|
|
@@ -319,9 +288,16 @@ async function runSpawn(ctx, argv) {
|
|
|
319
288
|
if (typeof text === "number") return text;
|
|
320
289
|
task = text;
|
|
321
290
|
}
|
|
291
|
+
const accessFlag = str("access");
|
|
292
|
+
const access = accessFlag === void 0 ? void 0 : parseWorkerAccess(accessFlag);
|
|
293
|
+
if (accessFlag !== void 0 && access === void 0) return fail(ctx, {
|
|
294
|
+
what: `"${accessFlag}" is not an access preset`,
|
|
295
|
+
detail: [`Use one of: ${WORKER_ACCESS.join(", ")}.`],
|
|
296
|
+
fix: help,
|
|
297
|
+
exit: 2,
|
|
298
|
+
ref: "e_usage"
|
|
299
|
+
});
|
|
322
300
|
const window = parsed.values.window === true;
|
|
323
|
-
const allowFlag = str("allow");
|
|
324
|
-
const allow = allowFlag === void 0 ? void 0 : [allowFlag];
|
|
325
301
|
const yes = parsed.values.yes === true;
|
|
326
302
|
const adapter = ctx.adapters.find((a) => a.cli === cli);
|
|
327
303
|
if (adapter && !(await adapter.detect(adapterEnv(ctx))).installed) return fail(ctx, {
|
|
@@ -359,8 +335,6 @@ async function runSpawn(ctx, argv) {
|
|
|
359
335
|
});
|
|
360
336
|
}
|
|
361
337
|
try {
|
|
362
|
-
const { hostPid } = await ctx.ancestry(2e3);
|
|
363
|
-
const requester = hostPid === void 0 ? void 0 : (await client["session.byHost"]({ pid: hostPid }).catch(() => void 0))?.session ?? void 0;
|
|
364
338
|
const runner = ctx.spawnRunner ?? [process.execPath, process.argv[1] ?? "conveno"];
|
|
365
339
|
const deps = realSpawnDeps({
|
|
366
340
|
platform: ctx.platform,
|
|
@@ -377,8 +351,7 @@ async function runSpawn(ctx, argv) {
|
|
|
377
351
|
name: str("name"),
|
|
378
352
|
task,
|
|
379
353
|
window,
|
|
380
|
-
|
|
381
|
-
requester,
|
|
354
|
+
access,
|
|
382
355
|
confineToHome: false,
|
|
383
356
|
onProgress: (line) => ctx.err(`${t.paint("quiet", line)}\n`)
|
|
384
357
|
});
|
|
@@ -522,6 +495,7 @@ async function runStatus(ctx, argv = []) {
|
|
|
522
495
|
const projects = new Set(sessions.map((s) => s.repo?.root ?? s.cwd)).size;
|
|
523
496
|
const relay = await (async () => client["relay.status"]({}))().catch(() => void 0);
|
|
524
497
|
ctx.out(`${t.status("ok")} Conveno is running. ${plural(sessions.length, "session")} online.\n`);
|
|
498
|
+
ctx.out(` ${t.paint("quiet", workerAccessLine(ctx))}\n`);
|
|
525
499
|
if (relay && [
|
|
526
500
|
"connected",
|
|
527
501
|
"connecting",
|
|
@@ -611,11 +585,11 @@ async function dispatch(name, rest, ctx) {
|
|
|
611
585
|
case "rename": return runRename(ctx, rest);
|
|
612
586
|
case "lead": return runLead(ctx, rest);
|
|
613
587
|
case "spawn": return runSpawn(ctx, rest);
|
|
614
|
-
case "acp-host": return (await import("./acp-
|
|
615
|
-
case "stop": return (await import("./acp-
|
|
588
|
+
case "acp-host": return (await import("./acp-DZf0zyNC.js")).runAcpHostCmd(ctx, rest);
|
|
589
|
+
case "stop": return (await import("./acp-DZf0zyNC.js")).runStop(ctx, rest);
|
|
616
590
|
case "spawn-run": return runSpawnRun(ctx, rest);
|
|
617
|
-
case "agy-relay": return (await import("./agy-relay-
|
|
618
|
-
case "watch": return (await import("./watch-
|
|
591
|
+
case "agy-relay": return (await import("./agy-relay-DSRJtMz3.js")).runAgyRelay(ctx, rest);
|
|
592
|
+
case "watch": return (await import("./watch-De3wbdQL.js")).runWatch(ctx, rest);
|
|
619
593
|
case "devices": return runDevices(ctx, rest);
|
|
620
594
|
case "relay": return runRelay(ctx, rest);
|
|
621
595
|
case "doctor": return runDoctor(ctx, rest);
|
|
@@ -654,7 +628,7 @@ function opensApp(env, tty = {
|
|
|
654
628
|
async function main(argv, ctx) {
|
|
655
629
|
const [command, ...rest] = argv;
|
|
656
630
|
if (command === void 0 && opensApp(ctx.env)) try {
|
|
657
|
-
return await (await import("./run-
|
|
631
|
+
return await (await import("./run-CKiYjNqx.js")).runTui(ctx);
|
|
658
632
|
} catch (e) {
|
|
659
633
|
ctx.err(`The app could not start (${rawMessage(e)}). Showing the help instead.\n`);
|
|
660
634
|
ctx.out(helpText(ctx));
|