@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as connect } from "./dist-
|
|
2
|
-
import {
|
|
1
|
+
import { n as connect } from "./dist-BYkDv29h.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-1k5b8UGF.js";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { existsSync, rmSync } from "node:fs";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
@@ -19,7 +19,7 @@ function answer(ask, allow) {
|
|
|
19
19
|
optionId: option.optionId
|
|
20
20
|
} : { outcome: "cancelled" };
|
|
21
21
|
}
|
|
22
|
-
const CONVENO_TOOL_TITLE = new RegExp(`^(?:tool\\s*[:\\-]\\s*)?(?:mcp[_\\-.:/ ]{1,3})?conveno[_\\-.:/ ]{1,3}(${[
|
|
22
|
+
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
23
|
"whoami",
|
|
24
24
|
"list_sessions",
|
|
25
25
|
"send",
|
|
@@ -30,7 +30,8 @@ const CONVENO_TOOL_TITLE = new RegExp(`^(?:tool\\s*[:\\-]\\s*)?(?:mcp[_\\-.:/ ]{
|
|
|
30
30
|
"become_lead",
|
|
31
31
|
"orchestrate",
|
|
32
32
|
"handoff",
|
|
33
|
-
"spawn_session"
|
|
33
|
+
"spawn_session",
|
|
34
|
+
"answer_permission"
|
|
34
35
|
].join("|")})$`, "i");
|
|
35
36
|
/** Kinds whose title is a command line or a path, so a title that looks like a tool name is not one. */
|
|
36
37
|
const COMMAND_OR_FILE_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -50,14 +51,14 @@ function convenoToolOf(call) {
|
|
|
50
51
|
return m ? m[1]?.toLowerCase() : void 0;
|
|
51
52
|
}
|
|
52
53
|
var AllowListPolicy = class {
|
|
53
|
-
|
|
54
|
-
constructor(
|
|
55
|
-
this.
|
|
54
|
+
allows;
|
|
55
|
+
constructor(allows) {
|
|
56
|
+
this.allows = allows;
|
|
56
57
|
}
|
|
57
58
|
async decide(ask, _signal) {
|
|
58
59
|
const what = `${ask.title ?? "a tool call"} (${ask.kind ?? "other"})`;
|
|
59
60
|
const own = convenoToolOf(ask) !== void 0;
|
|
60
|
-
if (own ||
|
|
61
|
+
if (own || this.allows({
|
|
61
62
|
kind: ask.kind,
|
|
62
63
|
title: ask.title
|
|
63
64
|
})) {
|
|
@@ -80,6 +81,83 @@ var AllowListPolicy = class {
|
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
};
|
|
84
|
+
/** "45 s", "2 min". */
|
|
85
|
+
const waitText = (ms) => ms >= 6e4 && ms % 6e4 === 0 ? `${ms / 6e4} min` : `${Math.round(ms / 1e3)} s`;
|
|
86
|
+
/**
|
|
87
|
+
* What the inner policy denies is put to the spawner. Its answer decides; with no answer, or no
|
|
88
|
+
* spawner, `unanswered` does. "Always" is remembered for this policy's lifetime, per kind and exact
|
|
89
|
+
* title. The agent only ever gets allow-once or reject-once (see `answer`).
|
|
90
|
+
*/
|
|
91
|
+
var AskSpawnerPolicy = class {
|
|
92
|
+
inner;
|
|
93
|
+
deps;
|
|
94
|
+
always = /* @__PURE__ */ new Set();
|
|
95
|
+
constructor(inner, deps) {
|
|
96
|
+
this.inner = inner;
|
|
97
|
+
this.deps = deps;
|
|
98
|
+
}
|
|
99
|
+
async decide(ask, signal) {
|
|
100
|
+
const first = await this.inner.decide(ask, signal);
|
|
101
|
+
if (first.allowed) return first;
|
|
102
|
+
const what = `${ask.title ?? "a tool call"} (${ask.kind ?? "other"})`;
|
|
103
|
+
const key = ask.title === void 0 ? void 0 : `${ask.kind ?? ""}\0${ask.title}`;
|
|
104
|
+
if (key !== void 0 && this.always.has(key)) return this.allow(ask, what, `allowed ${what}: always allowed earlier`);
|
|
105
|
+
const { deps } = this;
|
|
106
|
+
const timeoutMs = deps.timeoutMs ?? 12e4;
|
|
107
|
+
await deps.waiting?.(ask.title ?? what);
|
|
108
|
+
let reply;
|
|
109
|
+
try {
|
|
110
|
+
reply = await Promise.race([deps.ask({
|
|
111
|
+
...ask.title !== void 0 ? { title: ask.title.slice(0, 500) } : {},
|
|
112
|
+
...ask.kind !== void 0 ? { kind: ask.kind.slice(0, 100) } : {},
|
|
113
|
+
timeoutMs,
|
|
114
|
+
unanswered: deps.unanswered
|
|
115
|
+
}).catch((e) => {
|
|
116
|
+
deps.log?.(`could not ask the spawner: ${e instanceof Error ? e.message : String(e)}`);
|
|
117
|
+
return { answer: "no_spawner" };
|
|
118
|
+
}), new Promise((r) => {
|
|
119
|
+
if (signal.aborted) r(null);
|
|
120
|
+
else signal.addEventListener("abort", () => r(null), { once: true });
|
|
121
|
+
})]);
|
|
122
|
+
} finally {
|
|
123
|
+
await deps.waiting?.(null);
|
|
124
|
+
}
|
|
125
|
+
if (reply === null) return {
|
|
126
|
+
allowed: false,
|
|
127
|
+
outcome: { outcome: "cancelled" },
|
|
128
|
+
reason: `cancelled ${what}`
|
|
129
|
+
};
|
|
130
|
+
switch (reply.answer) {
|
|
131
|
+
case "allow_once": return this.allow(ask, what, `allowed ${what}: ${deps.spawnerName} said yes`);
|
|
132
|
+
case "allow_always":
|
|
133
|
+
if (key !== void 0) this.always.add(key);
|
|
134
|
+
return this.allow(ask, what, `allowed ${what}: ${deps.spawnerName} said always`);
|
|
135
|
+
case "deny": return this.deny(ask, what, `denied by ${deps.spawnerName}`);
|
|
136
|
+
case "unanswered":
|
|
137
|
+
case "no_spawner": {
|
|
138
|
+
const why = reply.answer === "unanswered" ? `no answer in ${waitText(timeoutMs)}` : "no spawner to ask";
|
|
139
|
+
return deps.unanswered === "allow" ? this.allow(ask, what, `allowed ${what}: ${why}`) : this.deny(ask, what, why);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
allow(ask, what, reason) {
|
|
144
|
+
const outcome = answer(ask, true);
|
|
145
|
+
if (outcome.outcome === "selected") return {
|
|
146
|
+
allowed: true,
|
|
147
|
+
outcome,
|
|
148
|
+
reason
|
|
149
|
+
};
|
|
150
|
+
return this.deny(ask, what, "the agent offered no allow-once option");
|
|
151
|
+
}
|
|
152
|
+
deny(ask, what, why) {
|
|
153
|
+
return {
|
|
154
|
+
allowed: false,
|
|
155
|
+
outcome: answer(ask, false),
|
|
156
|
+
reason: `denied ${what}: ${why}`,
|
|
157
|
+
why
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
83
161
|
/** Calls remembered at most; the oldest are dropped. */
|
|
84
162
|
const TOOLS_MAX = 1e3;
|
|
85
163
|
var ToolTracker = class {
|
|
@@ -102,7 +180,7 @@ var ToolTracker = class {
|
|
|
102
180
|
return u.sessionUpdate === "tool_call" ? next.title ?? next.kind ?? "tool" : void 0;
|
|
103
181
|
}
|
|
104
182
|
};
|
|
105
|
-
const HOST_VERSION = "0.2.0-rc.
|
|
183
|
+
const HOST_VERSION = "0.2.0-rc.14";
|
|
106
184
|
/** A stop request file: `conveno stop` writes it next to the spawn record. */
|
|
107
185
|
const stopRequestPath = (recordPath) => recordPath.replace(/\.json$/, ".stop");
|
|
108
186
|
function withTimeout(p, ms, what) {
|
|
@@ -157,6 +235,8 @@ var AcpHost = class {
|
|
|
157
235
|
/** The status line after a failed prompt, kept until the next prompt starts. */
|
|
158
236
|
failedText;
|
|
159
237
|
denials = [];
|
|
238
|
+
/** A denied call of a worker nobody spawned, shown until the next turn starts. */
|
|
239
|
+
deniedText;
|
|
160
240
|
/** The worker called Conveno's `send` (or `handoff`) in the turn that is running. */
|
|
161
241
|
sentThisTurn = false;
|
|
162
242
|
lastStatus;
|
|
@@ -166,9 +246,17 @@ var AcpHost = class {
|
|
|
166
246
|
this.deps = deps;
|
|
167
247
|
this.client = deps.client;
|
|
168
248
|
this.log = deps.log ?? ((line) => process.stderr.write(`[conveno acp-host] ${line}\n`));
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
249
|
+
this.policy = deps.policy ?? new AskSpawnerPolicy(new AllowListPolicy((call) => accessAllows(spec.access, call)), {
|
|
250
|
+
spawnerName: spec.from,
|
|
251
|
+
unanswered: spec.unanswered ?? "deny",
|
|
252
|
+
timeoutMs: deps.askTimeoutMs ?? spec.askTimeoutMs ?? 12e4,
|
|
253
|
+
ask: (p) => this.client["permission.ask"]({
|
|
254
|
+
sessionId: this.me,
|
|
255
|
+
...p
|
|
256
|
+
}),
|
|
257
|
+
waiting: (title) => this.waitingFor(title),
|
|
258
|
+
log: this.log
|
|
259
|
+
});
|
|
172
260
|
}
|
|
173
261
|
/** Ask the host to stop. The first reason wins. */
|
|
174
262
|
stop(reason) {
|
|
@@ -260,11 +348,19 @@ var AcpHost = class {
|
|
|
260
348
|
}), timeout, "session/new"));
|
|
261
349
|
this.acpSessionId = created.sessionId;
|
|
262
350
|
this.log(`session/new: ${created.sessionId}`);
|
|
263
|
-
const mode = spec.
|
|
351
|
+
const mode = spec.mode;
|
|
264
352
|
if (mode && created.modes?.availableModes.some((m) => m.id === mode)) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setMode, {
|
|
265
353
|
sessionId: created.sessionId,
|
|
266
354
|
modeId: mode
|
|
267
355
|
}), timeout, "session/set_mode")).then(() => this.log(`mode: ${mode}`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
|
|
356
|
+
else if (mode) {
|
|
357
|
+
const configId = modeConfigId(created.configOptions, mode);
|
|
358
|
+
if (configId) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setConfigOption, {
|
|
359
|
+
sessionId: created.sessionId,
|
|
360
|
+
configId,
|
|
361
|
+
value: mode
|
|
362
|
+
}), timeout, "session/set_config_option")).then(() => this.log(`mode: ${mode} (config option ${configId})`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
|
|
363
|
+
}
|
|
268
364
|
const spawnedBy = SessionId.safeParse(spec.spawnedBy);
|
|
269
365
|
const { session } = await this.client["session.register"]({
|
|
270
366
|
name: spec.name,
|
|
@@ -308,7 +404,7 @@ var AcpHost = class {
|
|
|
308
404
|
allowContinue: true
|
|
309
405
|
});
|
|
310
406
|
const next = formatContinuation(r.messages, r.orchestrator, r.remaining) || null;
|
|
311
|
-
if (next === null) await this.status(void 0, this.failedText ?? null);
|
|
407
|
+
if (next === null) await this.status(void 0, this.failedText ?? this.deniedText ?? null);
|
|
312
408
|
return next;
|
|
313
409
|
} catch (e) {
|
|
314
410
|
if (e instanceof ConvenoError && e.code === RpcErrorCode.NotFound) {
|
|
@@ -334,6 +430,7 @@ var AcpHost = class {
|
|
|
334
430
|
this.turnCtl = new AbortController();
|
|
335
431
|
this.failedText = void 0;
|
|
336
432
|
this.denials = [];
|
|
433
|
+
this.deniedText = void 0;
|
|
337
434
|
this.sentThisTurn = false;
|
|
338
435
|
await this.status("busy", null);
|
|
339
436
|
const turn = conn.agent.request(methods.agent.session.prompt, {
|
|
@@ -449,9 +546,16 @@ var AcpHost = class {
|
|
|
449
546
|
};
|
|
450
547
|
const signal = this.turnCtl.signal;
|
|
451
548
|
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" } };
|
|
549
|
+
if (decision === null || signal.aborted) return { outcome: { outcome: "cancelled" } };
|
|
453
550
|
this.log(`permission: ${decision.reason}`);
|
|
454
|
-
if (!decision.allowed)
|
|
551
|
+
if (!decision.allowed) {
|
|
552
|
+
const what = `${title ?? "a tool call"} (${kind ?? "other"})`;
|
|
553
|
+
this.denials.push(`${what}: ${decision.why ?? "it was not allowed"}`);
|
|
554
|
+
if (!this.spec.spawnedBy) {
|
|
555
|
+
this.deniedText = `denied: ${title ?? what}`;
|
|
556
|
+
this.status(void 0, this.deniedText);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
455
559
|
return { outcome: decision.outcome };
|
|
456
560
|
}
|
|
457
561
|
get me() {
|
|
@@ -468,6 +572,10 @@ var AcpHost = class {
|
|
|
468
572
|
...text !== void 0 ? { statusText: text } : {}
|
|
469
573
|
}).catch(() => void 0);
|
|
470
574
|
}
|
|
575
|
+
/** Show that the worker waits for its spawner's answer; null puts the usual status back. */
|
|
576
|
+
async waitingFor(title) {
|
|
577
|
+
await this.status(void 0, title === null ? this.deniedText ?? this.lastStatus ?? null : `waiting for permission: ${title}`);
|
|
578
|
+
}
|
|
471
579
|
async heartbeat() {
|
|
472
580
|
if (!this.sessionId) return;
|
|
473
581
|
try {
|
|
@@ -523,7 +631,7 @@ var AcpHost = class {
|
|
|
523
631
|
if (denials.length > 0) {
|
|
524
632
|
const list = denials.slice(0, 5).map((d) => `- ${d}`);
|
|
525
633
|
if (denials.length > 5) list.push(`- and ${denials.length - 5} more`);
|
|
526
|
-
lines.push(silent ? "
|
|
634
|
+
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
635
|
}
|
|
528
636
|
await this.tell(lines.join("\n"));
|
|
529
637
|
}
|
|
@@ -586,6 +694,21 @@ var AcpHost = class {
|
|
|
586
694
|
this.log(`stopped: ${describeStop(reason)}`);
|
|
587
695
|
}
|
|
588
696
|
};
|
|
697
|
+
/**
|
|
698
|
+
* The id of a session config option in the `mode` category (or with id `mode`) that offers `value`,
|
|
699
|
+
* from `session/new`'s `configOptions`. Undefined when there is none.
|
|
700
|
+
*/
|
|
701
|
+
function modeConfigId(options, value) {
|
|
702
|
+
if (!Array.isArray(options)) return void 0;
|
|
703
|
+
for (const o of options) {
|
|
704
|
+
if (o?.category !== "mode" && o?.id !== "mode") continue;
|
|
705
|
+
const values = (Array.isArray(o.options) ? o.options : []).flatMap((x) => {
|
|
706
|
+
const item = x;
|
|
707
|
+
return Array.isArray(item?.options) ? item.options : [item];
|
|
708
|
+
});
|
|
709
|
+
if (typeof o.id === "string" && values.some((v) => v?.value === value)) return o.id;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
589
712
|
/** Set on every agent the ACP host starts. `conveno hook` exits at once when it is set. */
|
|
590
713
|
const ACP_WORKER_ENV = "CONVENO_ACP_WORKER";
|
|
591
714
|
/**
|
|
@@ -2,7 +2,7 @@ import { randomBytes as randomBytes$1 } from "@noble/ciphers/utils.js";
|
|
|
2
2
|
import { equalBytes } from "@noble/curves/utils.js";
|
|
3
3
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
4
4
|
import { bytesToHex, concatBytes, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Tn as DeviceId, ar as literal, cr as string, ir as discriminatedUnion, nr as array, or as number, sr as object, tr as _enum } from "./dist-1k5b8UGF.js";
|
|
6
6
|
import { ed25519, x25519 } from "@noble/curves/ed25519.js";
|
|
7
7
|
import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
8
8
|
import { expand, extract } from "@noble/hashes/hkdf.js";
|
|
@@ -2,7 +2,7 @@ import { execFile, spawn } from "node:child_process";
|
|
|
2
2
|
import { readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { At as pendingHookContext, Ft as planProgram, It as planSpawn, J as endTurnContinuation, Q as findOnPath, Tt as parseCliVersion, sn as startTurnContext, wt as ownSession } from "./dist-1k5b8UGF.js";
|
|
6
6
|
import { n as cs, t as Za } from "./toml-patch-DGzVRdd1.js";
|
|
7
7
|
// ../adapters/codex/dist/index.js
|
|
8
8
|
const SERVER_NAME = "conveno";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { At as pendingHookContext, C as askedKey, G as dropFromList, Ht as readCommandLine, J as endTurnContinuation, K as editJson, Pt as planLauncher, Tt as parseCliVersion, U as defaultProcessIo, X as existedBefore, a as FROM_USER_NOTICE, c as ORCHESTRATOR_TASK_NOTICE, mn as uninstallLauncher, pt as late, rn as sameJson, s as NOT_FROM_USER_NOTICE, st as hostPidOf, ut as isObject, vt as loadJson, w as askedMarker, wt as ownSession, x as agentCommand, xt as needsQuoting, zt as putInList } from "./dist-1k5b8UGF.js";
|
|
4
4
|
import { n as cs, t as Za } from "./toml-patch-DGzVRdd1.js";
|
|
5
5
|
// ../adapters/grok/dist/index.js
|
|
6
6
|
const SERVER_NAME = "conveno";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { At as pendingHookContext, B as dataDir, G as dropFromList, J as endTurnContinuation, K as editJson, P as compareVersions, Pt as planLauncher, Tt as parseCliVersion, X as existedBefore, mn as uninstallLauncher, pt as late, rn as sameJson, ut as isObject, vt as loadJson, w as askedMarker, wt as ownSession, x as agentCommand, xt as needsQuoting } from "./dist-1k5b8UGF.js";
|
|
4
4
|
// ../adapters/antigravity/dist/index.js
|
|
5
5
|
const SERVER_NAME = "conveno";
|
|
6
6
|
/** The name of our entry in hooks.json. Antigravity keys hooks by an arbitrary name. */
|
|
@@ -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-vefQHFb-.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-1k5b8UGF.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-Cv5et1iE.js";
|
|
8
|
+
import { t as grokAdapter } from "./dist-D-PhGsuL.js";
|
|
9
|
+
import { n as connect } from "./dist-BYkDv29h.js";
|
|
10
|
+
import { t as runHook } from "./hook-mvifUk0K.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. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as runHookEntry } from "./hook-entry-Cxh3yIdT.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { appendFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { S as appendHookLog, it as hookLogLine } from "./dist-1k5b8UGF.js";
|
|
3
3
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
4
4
|
// src/hook.ts
|
|
5
5
|
/**
|
|
@@ -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-1k5b8UGF.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-CQoGVhp3.js";
|
|
3
|
+
import { a as parseFlags, i as commandHelp, n as COMMANDS, r as COMMAND_NAMES, t as ALL_COMMAND_NAMES } from "./args-DmUsbNu9.js";
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-CUE_dVn-.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-mvifUk0K.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-ClIK4l8K.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,7 +335,7 @@ async function runSpawn(ctx, argv) {
|
|
|
359
335
|
});
|
|
360
336
|
}
|
|
361
337
|
try {
|
|
362
|
-
const { hostPid } = await ctx.ancestry(
|
|
338
|
+
const { hostPid } = await ctx.ancestry(8e3);
|
|
363
339
|
const requester = hostPid === void 0 ? void 0 : (await client["session.byHost"]({ pid: hostPid }).catch(() => void 0))?.session ?? void 0;
|
|
364
340
|
const runner = ctx.spawnRunner ?? [process.execPath, process.argv[1] ?? "conveno"];
|
|
365
341
|
const deps = realSpawnDeps({
|
|
@@ -377,13 +353,13 @@ async function runSpawn(ctx, argv) {
|
|
|
377
353
|
name: str("name"),
|
|
378
354
|
task,
|
|
379
355
|
window,
|
|
380
|
-
|
|
356
|
+
access,
|
|
381
357
|
requester,
|
|
382
358
|
confineToHome: false,
|
|
383
359
|
onProgress: (line) => ctx.err(`${t.paint("quiet", line)}\n`)
|
|
384
360
|
});
|
|
385
361
|
const how = res.window ? res.terminal ?? "terminal" : "background";
|
|
386
|
-
ctx.out(`${t.status("ok")} ${t.bold(`Started ${res.name}`)} ${t.paint("quiet", `(${res.cli}, ${how}) in ${tilde(res.cwd, ctx.home)}`)}\n`);
|
|
362
|
+
ctx.out(`${t.status("ok")} ${t.bold(`Started ${res.name}`)} ${t.paint("quiet", `(${res.cli}, ${how}) in ${tilde(res.cwd, ctx.home)}${requester ? ` for ${requester.name}` : ""}`)}\n`);
|
|
387
363
|
if (res.task === "message") ctx.out(` The first task was sent to it as a Conveno message.\n`);
|
|
388
364
|
if (!res.window) {
|
|
389
365
|
ctx.out(` End it with ${cmd(t, `conveno stop ${res.name}`)}.\n`);
|
|
@@ -522,6 +498,7 @@ async function runStatus(ctx, argv = []) {
|
|
|
522
498
|
const projects = new Set(sessions.map((s) => s.repo?.root ?? s.cwd)).size;
|
|
523
499
|
const relay = await (async () => client["relay.status"]({}))().catch(() => void 0);
|
|
524
500
|
ctx.out(`${t.status("ok")} Conveno is running. ${plural(sessions.length, "session")} online.\n`);
|
|
501
|
+
ctx.out(` ${t.paint("quiet", workerAccessLine(ctx))}\n`);
|
|
525
502
|
if (relay && [
|
|
526
503
|
"connected",
|
|
527
504
|
"connecting",
|
|
@@ -611,11 +588,11 @@ async function dispatch(name, rest, ctx) {
|
|
|
611
588
|
case "rename": return runRename(ctx, rest);
|
|
612
589
|
case "lead": return runLead(ctx, rest);
|
|
613
590
|
case "spawn": return runSpawn(ctx, rest);
|
|
614
|
-
case "acp-host": return (await import("./acp-
|
|
615
|
-
case "stop": return (await import("./acp-
|
|
591
|
+
case "acp-host": return (await import("./acp-OHqthTVC.js")).runAcpHostCmd(ctx, rest);
|
|
592
|
+
case "stop": return (await import("./acp-OHqthTVC.js")).runStop(ctx, rest);
|
|
616
593
|
case "spawn-run": return runSpawnRun(ctx, rest);
|
|
617
|
-
case "agy-relay": return (await import("./agy-relay-
|
|
618
|
-
case "watch": return (await import("./watch-
|
|
594
|
+
case "agy-relay": return (await import("./agy-relay-DLP2H1Rj.js")).runAgyRelay(ctx, rest);
|
|
595
|
+
case "watch": return (await import("./watch-CaC2G2cT.js")).runWatch(ctx, rest);
|
|
619
596
|
case "devices": return runDevices(ctx, rest);
|
|
620
597
|
case "relay": return runRelay(ctx, rest);
|
|
621
598
|
case "doctor": return runDoctor(ctx, rest);
|
|
@@ -654,7 +631,7 @@ function opensApp(env, tty = {
|
|
|
654
631
|
async function main(argv, ctx) {
|
|
655
632
|
const [command, ...rest] = argv;
|
|
656
633
|
if (command === void 0 && opensApp(ctx.env)) try {
|
|
657
|
-
return await (await import("./run-
|
|
634
|
+
return await (await import("./run-BYmOjvDF.js")).runTui(ctx);
|
|
658
635
|
} catch (e) {
|
|
659
636
|
ctx.err(`The app could not start (${rawMessage(e)}). Showing the help instead.\n`);
|
|
660
637
|
ctx.out(helpText(ctx));
|