@conveno/cli 0.2.0-rc.12 → 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-CIzgcCp9.js → acp-OHqthTVC.js} +3 -3
- package/dist/{agy-relay-Y9o-Pw9U.js → agy-relay-DLP2H1Rj.js} +2 -2
- package/dist/{args-C1eX8Ixk.js → args-DmUsbNu9.js} +13 -5
- package/dist/bin.js +16 -2
- package/dist/daemon.js +235 -12
- package/dist/{daemonError-0KnkgIRo.js → daemonError-CUE_dVn-.js} +1 -1
- package/dist/{dist-CRj_cuHc.js → dist-1k5b8UGF.js} +295 -88
- package/dist/{dist-B3YYLzKS.js → dist-BYkDv29h.js} +17 -5
- package/dist/{dist-4iJnF07i.js → dist-BiV6HopA.js} +223 -31
- package/dist/{dist-DeN0jR3I.js → dist-C4Ey9THP.js} +1 -1
- package/dist/{dist-BjATai4T.js → dist-Cv5et1iE.js} +26 -5
- package/dist/{dist-DF0nL8wE.js → dist-D-PhGsuL.js} +3 -2
- package/dist/{dist-Du1hwaux.js → dist-vefQHFb-.js} +37 -1
- package/dist/{hook-entry-DWa1oppt.js → hook-entry-Cxh3yIdT.js} +9 -9
- package/dist/hook-entry-De06GWme.js +1 -0
- package/dist/{hook-ByduyOom.js → hook-mvifUk0K.js} +46 -12
- package/dist/{main-WIfawg60.js → main-BY7Kcf9S.js} +36 -20
- package/dist/{pick-BmZuv9yQ.js → pick-ClIK4l8K.js} +1 -1
- package/dist/{run-Df6vFm9n.js → run-BYmOjvDF.js} +435 -41
- package/dist/{runtime-BKPod_ZQ.js → runtime-PeEPWwix.js} +65 -17
- package/dist/{uninstall-MaS5t1CK.js → uninstall-CQoGVhp3.js} +204 -8
- package/dist/{watch-CPkilo9L.js → watch-CaC2G2cT.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-ajdMBSpY.js +0 -1
|
@@ -4,18 +4,18 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { delimiter, join, win32 } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { n as antigravityAdapter } from "./dist-
|
|
8
|
-
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-
|
|
9
|
-
import { t as codexAdapter } from "./dist-
|
|
10
|
-
import { t as grokAdapter } from "./dist-
|
|
7
|
+
import { n as antigravityAdapter } from "./dist-vefQHFb-.js";
|
|
8
|
+
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-Cxh3yIdT.js";
|
|
9
|
+
import { t as codexAdapter } from "./dist-Cv5et1iE.js";
|
|
10
|
+
import { t as grokAdapter } from "./dist-D-PhGsuL.js";
|
|
11
11
|
import { t as createTheme } from "./dist-BRjg9CLd.js";
|
|
12
|
-
import { n as connect$1 } from "./dist-
|
|
13
|
-
import {
|
|
14
|
-
import "./dist-
|
|
12
|
+
import { n as connect$1 } from "./dist-BYkDv29h.js";
|
|
13
|
+
import { An as MessageId, B as dataDir, Cn as CLI_KINDS, Dt as parsePs1ShimTarget, Et as parseCmdShimTarget, Ht as readCommandLine, It as planSpawn, Mt as pidAlive, O as baseName, Pn as RpcErrorCode, Rn as SessionId, T as attachAcpSession, Vt as readAncestry, W as detectRepo, cr as string, ct as isAntigravityApp, en as resolveWindowsCommand, f as SpawnError, gn as validateRename, ht as launcherText, i as ConvenoError, j as claimSpawnRecord, jn as OWNER_SESSION_ID, jt as pendingTurn, mt as launcherPath, nr as array, o as HEARTBEAT_INTERVAL_MS, on as spawnSession, or as number, qt as realSpawnDeps, rr as boolean, s as NOT_FROM_USER_NOTICE, tr as _enum, tt as formatInbox, u as SPAWN_CLIS, xt as needsQuoting } from "./dist-1k5b8UGF.js";
|
|
14
|
+
import "./dist-C4Ey9THP.js";
|
|
15
15
|
import { access } from "node:fs/promises";
|
|
16
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
// ../daemon/dist/server-
|
|
18
|
+
// ../daemon/dist/server-BoGpufaz.js
|
|
19
19
|
/** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
|
|
20
20
|
function defaultIsAlive(pid) {
|
|
21
21
|
try {
|
|
@@ -28,7 +28,7 @@ function defaultIsAlive(pid) {
|
|
|
28
28
|
`${OWNER_SESSION_ID}`;
|
|
29
29
|
SessionId.parse("0".repeat(26));
|
|
30
30
|
// ../mcp/dist/index.js
|
|
31
|
-
const SERVER_VERSION = "0.2.0-rc.
|
|
31
|
+
const SERVER_VERSION = "0.2.0-rc.14";
|
|
32
32
|
const ok = (text) => ({ content: [{
|
|
33
33
|
type: "text",
|
|
34
34
|
text
|
|
@@ -106,6 +106,8 @@ function whoamiText(s) {
|
|
|
106
106
|
}
|
|
107
107
|
/** The daemon no longer knows this session (restart, pruned, name taken). Recipient errors do not match. */
|
|
108
108
|
const isSessionGone = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && /No session with id|not registered|Register the session again/.test(err.message);
|
|
109
|
+
/** The daemon retired this session: it will not take heartbeats from it again. */
|
|
110
|
+
const isSessionEnded = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && err.message.includes("has ended and will not come back");
|
|
109
111
|
const SESSION_LOST_TEXT = "Conveno lost this session and could not restore it automatically. Tell the user that Conveno is not available in this session right now; restarting the CLI session reconnects it.";
|
|
110
112
|
/**
|
|
111
113
|
* Sent in the `instructions` field of the initialize result. MCP clients put it in the model's
|
|
@@ -149,10 +151,12 @@ function createServer(opts) {
|
|
|
149
151
|
/** The conversation this process last bound, so a tool call binds only when it changes. */
|
|
150
152
|
let boundConversation;
|
|
151
153
|
let binding = Promise.resolve();
|
|
154
|
+
const isAlive = opts.isAlive ?? pidAlive;
|
|
155
|
+
const parentGone = () => opts.parentPid !== void 0 && !isAlive(opts.parentPid);
|
|
152
156
|
const register = async () => {
|
|
153
157
|
const repo = await detectRepo(cwd, { exists: pathExists });
|
|
154
158
|
const cliVersion = process.env.CONVENO_CLI_VERSION?.trim().slice(0, 64);
|
|
155
|
-
const { hostPid, hostPids } = await host;
|
|
159
|
+
const { hostPid, hostPids, variant } = await host;
|
|
156
160
|
const record = claimSpawnRecord(spawnDataDir, cli, hostPids);
|
|
157
161
|
if (record?.acp) {
|
|
158
162
|
attached = true;
|
|
@@ -166,6 +170,7 @@ function createServer(opts) {
|
|
|
166
170
|
...hostPid !== void 0 ? { hostPid } : {},
|
|
167
171
|
...hostPids.length > 0 ? { hostPids: hostPids.slice(0, 8) } : {},
|
|
168
172
|
...cliVersion ? { cliVersion } : {},
|
|
173
|
+
...variant ? { variant } : {},
|
|
169
174
|
...repo.root ? { repo: { root: repo.root } } : {},
|
|
170
175
|
...spawnedBy.success ? { spawnedBy: spawnedBy.data } : {},
|
|
171
176
|
...record ? { spawned: true } : {}
|
|
@@ -186,10 +191,25 @@ function createServer(opts) {
|
|
|
186
191
|
if (await pendingTurn(spawnDataDir, "claude-pending-turn").take(claudeId)) await client["turn.start"]({ sessionId: session.id }).catch(() => {});
|
|
187
192
|
}
|
|
188
193
|
const beat = setInterval(() => {
|
|
189
|
-
if (actingId)
|
|
194
|
+
if (!actingId) return;
|
|
195
|
+
if (parentGone()) {
|
|
196
|
+
shutdown().then(() => opts.onExit?.());
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
client["session.heartbeat"]({
|
|
190
200
|
sessionId: actingId,
|
|
191
201
|
pid: process.pid
|
|
192
|
-
}).catch(() => {
|
|
202
|
+
}).catch((err) => {
|
|
203
|
+
if (isSessionEnded(err)) {
|
|
204
|
+
if (timer) clearInterval(timer);
|
|
205
|
+
timer = void 0;
|
|
206
|
+
opts.onExit?.();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!isSessionGone(err)) return;
|
|
210
|
+
forgetSession();
|
|
211
|
+
ensure().catch(() => {});
|
|
212
|
+
});
|
|
193
213
|
}, HEARTBEAT_INTERVAL_MS);
|
|
194
214
|
beat.unref();
|
|
195
215
|
if (timer) clearInterval(timer);
|
|
@@ -371,6 +391,24 @@ function createServer(opts) {
|
|
|
371
391
|
const plural = (n, one, many) => n === 1 ? one : many;
|
|
372
392
|
return [`Acknowledged ${res.acked} ${plural(res.acked, "message", "messages")}.`, unknown > 0 ? `${unknown} ${plural(unknown, "id was", "ids were")} not found.` : ""].filter(Boolean).join(" ");
|
|
373
393
|
}));
|
|
394
|
+
mcp.registerTool("answer_permission", {
|
|
395
|
+
description: "Answer a worker's permission request (sent to you as a 'wants to run' notice).",
|
|
396
|
+
inputSchema: {
|
|
397
|
+
request: string().min(1).max(64).describe("The request id from the notice."),
|
|
398
|
+
answer: _enum([
|
|
399
|
+
"allow",
|
|
400
|
+
"always",
|
|
401
|
+
"deny"
|
|
402
|
+
]).describe("allow: this once. always: also for the same call later. deny.")
|
|
403
|
+
}
|
|
404
|
+
}, tool(async (me, a) => {
|
|
405
|
+
await client["permission.answer"]({
|
|
406
|
+
sessionId: me.id,
|
|
407
|
+
requestId: a.request,
|
|
408
|
+
answer: a.answer === "allow" ? "allow_once" : a.answer === "always" ? "allow_always" : "deny"
|
|
409
|
+
});
|
|
410
|
+
return `Answered request ${a.request}: ${a.answer}.`;
|
|
411
|
+
}));
|
|
374
412
|
mcp.registerTool("rename", {
|
|
375
413
|
description: "Change this session's name. Use it when the user wants a name others can remember, such as `api-worker`.",
|
|
376
414
|
inputSchema: { name: string().min(1).describe("New name: 1 to 64 characters of lowercase letters, digits, '.', '_', '@' or '-'.") }
|
|
@@ -397,7 +435,10 @@ function createServer(opts) {
|
|
|
397
435
|
return a.text === "" ? "Status cleared." : "Status set.";
|
|
398
436
|
}));
|
|
399
437
|
const becomeLead = tool(async (me) => {
|
|
400
|
-
const res = await client["orchestrator.claim"]({
|
|
438
|
+
const res = await client["orchestrator.claim"]({
|
|
439
|
+
sessionId: me.id,
|
|
440
|
+
via: "tool"
|
|
441
|
+
});
|
|
401
442
|
if (!res.previous) return "You are now the lead. There was no previous holder.";
|
|
402
443
|
const { sessions } = await client["session.list"]({ includeOffline: true });
|
|
403
444
|
return `You are now the lead. Previous holder: ${sessions.find((s) => s.id === res.previous)?.name ?? res.previous}.`;
|
|
@@ -438,7 +479,11 @@ function createServer(opts) {
|
|
|
438
479
|
name: string().min(1).optional().describe("Session name: lowercase letters, digits, '.', '_', '@' or '-'."),
|
|
439
480
|
task: string().min(1).optional().describe("The first task for the new session."),
|
|
440
481
|
window: boolean().optional().describe("Open it in a visible terminal window instead of the background."),
|
|
441
|
-
|
|
482
|
+
access: _enum([
|
|
483
|
+
"read",
|
|
484
|
+
"edit",
|
|
485
|
+
"full"
|
|
486
|
+
]).optional().describe("Optional. What the worker may do without asking: read (look only), edit (also change files; the default) or full (everything). Not for window workers.")
|
|
442
487
|
}
|
|
443
488
|
}, tool(async (me, a) => {
|
|
444
489
|
const deps = opts.spawnDeps ?? realSpawnDeps({
|
|
@@ -457,7 +502,7 @@ function createServer(opts) {
|
|
|
457
502
|
name: a.name,
|
|
458
503
|
task: a.task,
|
|
459
504
|
window: a.window ?? false,
|
|
460
|
-
|
|
505
|
+
access: a.access,
|
|
461
506
|
requester: me,
|
|
462
507
|
confineToHome: true,
|
|
463
508
|
timeoutMs: 45e3
|
|
@@ -483,7 +528,8 @@ async function runStdio(opts) {
|
|
|
483
528
|
launcherPaths: process.argv[1] ? [process.argv[1]] : []
|
|
484
529
|
}).then((a) => ({
|
|
485
530
|
hostPid: a.hostPid,
|
|
486
|
-
hostPids: a.pids
|
|
531
|
+
hostPids: a.pids,
|
|
532
|
+
variant: opts.cli === "antigravity" && isAntigravityApp(a.entries) ? "app" : void 0
|
|
487
533
|
}));
|
|
488
534
|
const client = await connect$1({
|
|
489
535
|
kind: "mcp",
|
|
@@ -494,7 +540,9 @@ async function runStdio(opts) {
|
|
|
494
540
|
cli: opts.cli,
|
|
495
541
|
client,
|
|
496
542
|
host,
|
|
497
|
-
cwd: process.cwd()
|
|
543
|
+
cwd: process.cwd(),
|
|
544
|
+
...process.ppid > 1 ? { parentPid: process.ppid } : {},
|
|
545
|
+
onExit: () => void stop().then(() => process.exit(0))
|
|
498
546
|
});
|
|
499
547
|
let stopping;
|
|
500
548
|
const stop = () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Bt as
|
|
1
|
+
import { Bt as readAccountTokens, Cn as CLI_KINDS, F as compatStatus, Gt as readSettings, I as completeLogin, It as planSpawn, Lt as pollDeviceCode, Nt as pinnedAdapter, Q as findOnPath, Qt as resolveAcpProgram, Sn as writeSettings, V as dataPaths, Yt as requestDeviceCode, Z as fetchAccountStatus, b as adapterNpxCommand, bn as workerAskTimeoutOf, d as SPAWN_TABLE, n as AccountError, p as WORKER_ACCESS, v as acpOverrideVar, xn as workerUnansweredOf, y as adapterInstallCommand, yn as workerAccessOf, yt as logoutAccount } from "./dist-1k5b8UGF.js";
|
|
2
2
|
import { a as fail, c as plural, d as warnBlock, i as errorBlock, l as seconds, n as cmd, o as localStamp, r as columns, s as plainError, t as closest, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
3
|
-
import { a as parseFlags, n as COMMANDS } from "./args-
|
|
3
|
+
import { a as parseFlags, n as COMMANDS } from "./args-DmUsbNu9.js";
|
|
4
4
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
5
|
-
import { t as daemonProblem } from "./daemonError-
|
|
5
|
+
import { t as daemonProblem } from "./daemonError-CUE_dVn-.js";
|
|
6
6
|
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
7
|
-
import { spawn } from "node:child_process";
|
|
7
|
+
import { execFile, spawn } from "node:child_process";
|
|
8
8
|
import { access, chmod, mkdir, open, readFile, readdir, realpath, rename as rename$1, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
9
9
|
import { createHash, randomBytes } from "node:crypto";
|
|
10
10
|
// src/account.ts
|
|
@@ -140,6 +140,8 @@ async function runAccount(ctx, argv, io = {}) {
|
|
|
140
140
|
return accountFailure(ctx, e, "Could not read your account");
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
// src/version.ts
|
|
144
|
+
const VERSION = "0.2.0-rc.14";
|
|
143
145
|
// src/daemon.ts
|
|
144
146
|
async function lockPid(ctx) {
|
|
145
147
|
try {
|
|
@@ -276,6 +278,29 @@ async function stopDaemonIfRunning(ctx) {
|
|
|
276
278
|
}
|
|
277
279
|
return stopDaemon(ctx, true);
|
|
278
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* For the commands a person runs (`conveno`, `conveno setup`): when a daemon is running from a
|
|
283
|
+
* different version than this CLI (an upgrade left the old one up), stop it so the next connect
|
|
284
|
+
* starts this version's. Says nothing itself; the returned line is for the setup details. Never
|
|
285
|
+
* starts a daemon, and never throws. MCP servers and hooks must not call this: an old MCP would
|
|
286
|
+
* take the daemon back to its own version.
|
|
287
|
+
*/
|
|
288
|
+
async function replaceStaleDaemon(ctx) {
|
|
289
|
+
let running;
|
|
290
|
+
try {
|
|
291
|
+
const c = await ctx.connect(connectOpts(ctx, false));
|
|
292
|
+
running = c.daemonVersion;
|
|
293
|
+
await c.close().catch(() => void 0);
|
|
294
|
+
} catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
if (running === void 0 || running === "0.2.0-rc.14") return null;
|
|
298
|
+
return await stopDaemon({
|
|
299
|
+
...ctx,
|
|
300
|
+
out: () => void 0,
|
|
301
|
+
err: () => void 0
|
|
302
|
+
}, true).catch(() => 1) === 0 ? `Restarted the background service: it was ${running}, now ${VERSION}.` : `The background service is still ${running} (this is ${VERSION}). Run conveno daemon stop.`;
|
|
303
|
+
}
|
|
279
304
|
const SUBCOMMANDS = [
|
|
280
305
|
"start",
|
|
281
306
|
"stop",
|
|
@@ -762,6 +787,90 @@ ${missing.map((m) => ` ${pinnedAdapter(m.pkg) ?? m.pkg}\n`).join("")}`);
|
|
|
762
787
|
printManual(ctx, missing);
|
|
763
788
|
}
|
|
764
789
|
}
|
|
790
|
+
function realWarmRunner(ctx) {
|
|
791
|
+
return { run: (file, args, timeoutMs) => {
|
|
792
|
+
const plan = planSpawn(file, args);
|
|
793
|
+
return new Promise((resolve) => {
|
|
794
|
+
execFile(plan.file, plan.args, {
|
|
795
|
+
timeout: timeoutMs,
|
|
796
|
+
windowsHide: true,
|
|
797
|
+
env: {
|
|
798
|
+
...ctx.env,
|
|
799
|
+
npm_config_update_notifier: "false"
|
|
800
|
+
},
|
|
801
|
+
maxBuffer: 16777216,
|
|
802
|
+
...plan.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
803
|
+
}, (err) => {
|
|
804
|
+
if (!err) return resolve(0);
|
|
805
|
+
const code = err.code;
|
|
806
|
+
resolve(typeof code === "number" ? code : null);
|
|
807
|
+
});
|
|
808
|
+
});
|
|
809
|
+
} };
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* The pinned `<pkg>@<version>` of every adapter these tools need that is not on PATH (nor
|
|
813
|
+
* overridden), when the person allowed on-demand adapters. Empty otherwise.
|
|
814
|
+
*/
|
|
815
|
+
function adaptersToWarm(ctx, clis) {
|
|
816
|
+
if (!(readSettings(dataPaths(ctx.platform, ctx.dataDir).settings).acpAdapterNpx === true)) return [];
|
|
817
|
+
const out = [];
|
|
818
|
+
for (const cli of clis) {
|
|
819
|
+
const acp = SPAWN_TABLE[cli]?.acp;
|
|
820
|
+
if (!acp?.adapterPackage) continue;
|
|
821
|
+
const found = resolveAcpProgram(cli, acp, {
|
|
822
|
+
env: ctx.env,
|
|
823
|
+
which: (n) => findOnPath(n, ctx.env, ctx.platform),
|
|
824
|
+
npxConsent: false
|
|
825
|
+
});
|
|
826
|
+
const pinned = pinnedAdapter(acp.adapterPackage);
|
|
827
|
+
if (!found.ok && pinned && !out.includes(pinned)) out.push(pinned);
|
|
828
|
+
}
|
|
829
|
+
return out;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Download the adapters now. `onStart` is called once, before the first download, and only when
|
|
833
|
+
* there is something to download. Never throws.
|
|
834
|
+
*/
|
|
835
|
+
async function warmAcpAdapters(ctx, clis, opts = {}) {
|
|
836
|
+
const packages = adaptersToWarm(ctx, clis);
|
|
837
|
+
if (packages.length === 0) return { status: "none" };
|
|
838
|
+
opts.onStart?.();
|
|
839
|
+
const runner = opts.runner ?? ctx.warmRunner ?? realWarmRunner(ctx);
|
|
840
|
+
const failed = [];
|
|
841
|
+
for (const pkg of packages) {
|
|
842
|
+
const args = [
|
|
843
|
+
"exec",
|
|
844
|
+
"--yes",
|
|
845
|
+
`--package=${pkg}`,
|
|
846
|
+
"--",
|
|
847
|
+
"node",
|
|
848
|
+
"-e",
|
|
849
|
+
"0"
|
|
850
|
+
];
|
|
851
|
+
opts.onLine?.(`$ npm ${args.join(" ")}`);
|
|
852
|
+
let code = null;
|
|
853
|
+
try {
|
|
854
|
+
code = await runner.run("npm", args, opts.timeoutMs ?? 3e5);
|
|
855
|
+
} catch {
|
|
856
|
+
code = null;
|
|
857
|
+
}
|
|
858
|
+
if (code !== 0) {
|
|
859
|
+
failed.push(pkg);
|
|
860
|
+
opts.onLine?.(`Could not fetch ${pkg} now (${code === null ? "no answer" : `exit ${code}`}).`);
|
|
861
|
+
} else opts.onLine?.(`${pkg} is ready.`);
|
|
862
|
+
}
|
|
863
|
+
if (failed.length === 0) return {
|
|
864
|
+
status: "ready",
|
|
865
|
+
packages
|
|
866
|
+
};
|
|
867
|
+
return {
|
|
868
|
+
status: "failed",
|
|
869
|
+
packages,
|
|
870
|
+
failed,
|
|
871
|
+
reason: "It will download the first time a worker starts."
|
|
872
|
+
};
|
|
873
|
+
}
|
|
765
874
|
// src/diff.ts
|
|
766
875
|
const splitLines = (s) => {
|
|
767
876
|
if (s === "") return [];
|
|
@@ -1236,6 +1345,61 @@ function saveChoice(ctx, tools, lead) {
|
|
|
1236
1345
|
leadCli: next && tools.includes(next) ? next : null
|
|
1237
1346
|
});
|
|
1238
1347
|
}
|
|
1348
|
+
// src/worker-access.ts
|
|
1349
|
+
/** "1 min", "2 min", "5 min". */
|
|
1350
|
+
const waitText = (sec) => `${Math.round(sec / 60)} min`;
|
|
1351
|
+
/** Plain words for each level. */
|
|
1352
|
+
const ACCESS_TEXT = {
|
|
1353
|
+
read: {
|
|
1354
|
+
label: "Read only",
|
|
1355
|
+
hint: "read and search files, list folders"
|
|
1356
|
+
},
|
|
1357
|
+
edit: {
|
|
1358
|
+
label: "Read and edit",
|
|
1359
|
+
hint: "also edit files; commands are asked"
|
|
1360
|
+
},
|
|
1361
|
+
full: {
|
|
1362
|
+
label: "Everything",
|
|
1363
|
+
hint: "anything, no questions"
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
const UNANSWERED_TEXT = {
|
|
1367
|
+
deny: {
|
|
1368
|
+
label: "Deny it",
|
|
1369
|
+
hint: "the worker is told no"
|
|
1370
|
+
},
|
|
1371
|
+
allow: {
|
|
1372
|
+
label: "Allow it",
|
|
1373
|
+
hint: "the worker goes ahead"
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
const isWorkerAccess = (v) => WORKER_ACCESS.includes(v);
|
|
1377
|
+
/** The saved choices, or the defaults. */
|
|
1378
|
+
function readWorkerAccess(ctx) {
|
|
1379
|
+
const path = settingsFile(ctx);
|
|
1380
|
+
const s = path ? readSettings(path) : {};
|
|
1381
|
+
return {
|
|
1382
|
+
access: workerAccessOf(s),
|
|
1383
|
+
unanswered: workerUnansweredOf(s),
|
|
1384
|
+
waitSec: workerAskTimeoutOf(s)
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
/** Save some or all. Does nothing when the settings path is not a real path (faked platform). */
|
|
1388
|
+
function saveWorkerAccess(ctx, patch) {
|
|
1389
|
+
const path = settingsFile(ctx);
|
|
1390
|
+
if (!path) return;
|
|
1391
|
+
writeSettings(path, {
|
|
1392
|
+
...patch.access ? { workerAccess: patch.access } : {},
|
|
1393
|
+
...patch.unanswered ? { workerUnanswered: patch.unanswered } : {},
|
|
1394
|
+
...patch.waitSec ? { workerAskTimeoutSec: patch.waitSec } : {}
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
/** One quiet line for `conveno status` and `conveno doctor`. */
|
|
1398
|
+
function workerAccessLine(ctx) {
|
|
1399
|
+
const { access, unanswered, waitSec } = readWorkerAccess(ctx);
|
|
1400
|
+
if (access === "full") return "Workers: full · no questions";
|
|
1401
|
+
return `Workers: ${access} · asks wait ${waitText(waitSec)}, then ${unanswered}`;
|
|
1402
|
+
}
|
|
1239
1403
|
// src/init.ts
|
|
1240
1404
|
const CODEX_NOTE = "Codex asks you to approve Conveno once: run /hooks inside Codex.";
|
|
1241
1405
|
/** Detect every adapter. A detection that throws counts as not installed. */
|
|
@@ -1558,9 +1722,18 @@ async function runInit(ctx, argv, name = "init") {
|
|
|
1558
1722
|
ref: "e_usage"
|
|
1559
1723
|
});
|
|
1560
1724
|
}
|
|
1725
|
+
if (early?.values["dry-run"] !== true) {
|
|
1726
|
+
const restarted = await replaceStaleDaemon(ctx);
|
|
1727
|
+
if (restarted) ctx.out(`${ctx.theme.status("info")} ${restarted}\n`);
|
|
1728
|
+
}
|
|
1561
1729
|
const outcome = {};
|
|
1562
1730
|
const code = await initSetup(ctx, argv, outcome, name);
|
|
1563
1731
|
if (code !== 0) return code;
|
|
1732
|
+
const access = early?.values["worker-access"];
|
|
1733
|
+
if (isWorkerAccess(access) && early?.values["dry-run"] !== true) {
|
|
1734
|
+
saveWorkerAccess(ctx, { access });
|
|
1735
|
+
ctx.out(`${ctx.theme.status("ok")} Workers get ${access} access.\n`);
|
|
1736
|
+
}
|
|
1564
1737
|
if (typeof lead === "string" && early?.values["dry-run"] !== true) {
|
|
1565
1738
|
writeSettings(dataPaths(ctx.platform, ctx.dataDir).settings, { leadCli: lead });
|
|
1566
1739
|
const shown = ctx.adapters.find((a) => a.cli === lead)?.displayName ?? lead;
|
|
@@ -1575,6 +1748,10 @@ async function runInit(ctx, argv, name = "init") {
|
|
|
1575
1748
|
flag: values["acp-adapters"] === true ? true : values["no-acp-adapters"] === true ? false : void 0,
|
|
1576
1749
|
yes: values.yes === true
|
|
1577
1750
|
});
|
|
1751
|
+
const t = ctx.theme;
|
|
1752
|
+
const warmed = await warmAcpAdapters(ctx, outcome.offer.map((a) => a.cli), { onStart: () => ctx.out(`${t.status("info")} Getting workers ready (the first download can take a minute).\n`) }).catch(() => void 0);
|
|
1753
|
+
if (warmed?.status === "ready") ctx.out(`${t.status("ok")} Workers are ready.\n`);
|
|
1754
|
+
else if (warmed?.status === "failed") ctx.out(`${t.status("info")} Couldn't get workers ready now. They download the first time one starts.\n`);
|
|
1578
1755
|
return 0;
|
|
1579
1756
|
}
|
|
1580
1757
|
async function initSetup(ctx, argv, outcome, name) {
|
|
@@ -1738,7 +1915,18 @@ async function runSetup(ctx, argv) {
|
|
|
1738
1915
|
const parsed = parseFlags(ctx, spec, argv);
|
|
1739
1916
|
if (typeof parsed === "number") return parsed;
|
|
1740
1917
|
const v = parsed.values;
|
|
1741
|
-
|
|
1918
|
+
const access = v["worker-access"];
|
|
1919
|
+
if (access !== void 0 && !isWorkerAccess(access)) return fail(ctx, {
|
|
1920
|
+
what: `Unknown worker access "${String(access)}"`,
|
|
1921
|
+
detail: ["Choose read, edit or full."],
|
|
1922
|
+
fix: `Pass ${cmd(ctx.theme, "--worker-access edit")} or leave it out.`,
|
|
1923
|
+
exit: 2,
|
|
1924
|
+
ref: "e_usage"
|
|
1925
|
+
});
|
|
1926
|
+
if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) {
|
|
1927
|
+
if (isWorkerAccess(access)) saveWorkerAccess(ctx, { access });
|
|
1928
|
+
return (await import("./run-BYmOjvDF.js")).runTui(ctx, { start: "setup" });
|
|
1929
|
+
}
|
|
1742
1930
|
return runInit(ctx, argv, "setup");
|
|
1743
1931
|
}
|
|
1744
1932
|
// src/doctor.ts
|
|
@@ -1857,8 +2045,15 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1857
2045
|
const client = await ctx.connect(connectOpts(ctx, false));
|
|
1858
2046
|
try {
|
|
1859
2047
|
const { sessions } = await client["session.list"]({});
|
|
1860
|
-
|
|
1861
|
-
|
|
2048
|
+
const running = client.daemonVersion;
|
|
2049
|
+
if (running !== void 0 && running !== "0.2.0-rc.14") {
|
|
2050
|
+
daemonLine = [` ${t.status("warn")} daemon`, `running ${running}, this is ${VERSION}`];
|
|
2051
|
+
warnings++;
|
|
2052
|
+
notes.push(warnBlock(t, "Conveno's background service is from an older version.", `Run ${cmd(t, "conveno")} to restart it, or ${cmd(t, "conveno daemon stop")} and open your AI tools again.`, `The service running now is ${running}; this install is ${VERSION}. ${cmd(t, "conveno")} and ${cmd(t, "conveno setup")} restart it for you.`));
|
|
2053
|
+
} else {
|
|
2054
|
+
daemonLine = [` ${t.status("ok")} daemon`, `running, ${plural(sessions.length, "session")}`];
|
|
2055
|
+
ok++;
|
|
2056
|
+
}
|
|
1862
2057
|
} finally {
|
|
1863
2058
|
await client.close().catch(() => void 0);
|
|
1864
2059
|
}
|
|
@@ -1969,6 +2164,7 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1969
2164
|
ctx.out(`${columns(table).join("\n")}\n`);
|
|
1970
2165
|
const acpLines = acpDoctorLines(ctx, rows.filter((r) => r.detection.installed).map((r) => r.adapter.cli));
|
|
1971
2166
|
if (acpLines.length > 0) ctx.out(`${acpLines.join("\n")}\n`);
|
|
2167
|
+
ctx.out(`${t.paint("quiet", workerAccessLine(ctx))}\n`);
|
|
1972
2168
|
if (!rows.some((r) => r.detection.installed)) {
|
|
1973
2169
|
notes.push(warnBlock(t, "No supported AI coding CLI was found on PATH.", "Install Claude Code, Codex CLI or OpenCode, then run conveno init."));
|
|
1974
2170
|
warnings++;
|
|
@@ -2121,4 +2317,4 @@ async function runUninstall(ctx, argv) {
|
|
|
2121
2317
|
ctx.out(" Removed the Conveno entries. Restart open sessions to drop Conveno.\n");
|
|
2122
2318
|
return 0;
|
|
2123
2319
|
}
|
|
2124
|
-
export {
|
|
2320
|
+
export { runRelay as A, saveChoice as C, warmAcpAdapters as D, unifiedDiff as E, openInBrowser as F, runAccount as I, runLogin as L, runDaemon as M, stopDaemonIfRunning as N, PAIR_TIMEOUT_MS as O, VERSION as P, runLogout as R, connectedTools as S, applyChanges as T, readWorkerAccess as _, applyOptions as a, workerAccessLine as b, collectPlans as c, refreshManifest as d, renewedApprovals as f, UNANSWERED_TEXT as g, ACCESS_TEXT as h, runDoctor as i, replaceStaleDaemon as j, runDevices as k, detectAll as l, runSetup as m, inspect as n, approvalWrites as o, runInit as p, partState as r, approvedBySetup as s, runUninstall as t, pendingOptions as u, saveWorkerAccess as v, StaleError as w, chosenTools as x, waitText as y, showCode as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as isOneShotGrok } from "./dist-
|
|
2
|
-
import {
|
|
1
|
+
import { n as isOneShotGrok } from "./dist-D-PhGsuL.js";
|
|
2
|
+
import { Jt as renderBody, in as senderOf, lt as isFromOwner, nn as runWaker } from "./dist-1k5b8UGF.js";
|
|
3
3
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
5
|
-
import { t as findSession } from "./pick-
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-CUE_dVn-.js";
|
|
5
|
+
import { t as findSession } from "./pick-ClIK4l8K.js";
|
|
6
6
|
// src/watch.ts
|
|
7
7
|
const CONNECT_MAX_RETRY_MS = 3e4;
|
|
8
8
|
const CONNECT_GIVE_UP_MS = 3e5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conveno/cli",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.14",
|
|
4
4
|
"description": "Connect AI coding CLI sessions so they can message each other.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"zod": "4.6.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@conveno/acp": "0.2.0-rc.
|
|
56
|
-
"@conveno/adapter-antigravity": "0.2.0-rc.
|
|
57
|
-
"@conveno/adapter-claude": "0.2.0-rc.
|
|
58
|
-
"@conveno/adapter-codex": "0.2.0-rc.
|
|
59
|
-
"@conveno/adapter-grok": "0.2.0-rc.
|
|
60
|
-
"@conveno/adapter-opencode": "0.2.0-rc.
|
|
61
|
-
"@conveno/brand": "0.2.0-rc.
|
|
62
|
-
"@conveno/client": "0.2.0-rc.
|
|
63
|
-
"@conveno/core": "0.2.0-rc.
|
|
64
|
-
"@conveno/daemon": "0.2.0-rc.
|
|
65
|
-
"@conveno/mcp": "0.2.0-rc.
|
|
66
|
-
"@conveno/protocol": "0.2.0-rc.
|
|
55
|
+
"@conveno/acp": "0.2.0-rc.14",
|
|
56
|
+
"@conveno/adapter-antigravity": "0.2.0-rc.14",
|
|
57
|
+
"@conveno/adapter-claude": "0.2.0-rc.14",
|
|
58
|
+
"@conveno/adapter-codex": "0.2.0-rc.14",
|
|
59
|
+
"@conveno/adapter-grok": "0.2.0-rc.14",
|
|
60
|
+
"@conveno/adapter-opencode": "0.2.0-rc.14",
|
|
61
|
+
"@conveno/brand": "0.2.0-rc.14",
|
|
62
|
+
"@conveno/client": "0.2.0-rc.14",
|
|
63
|
+
"@conveno/core": "0.2.0-rc.14",
|
|
64
|
+
"@conveno/daemon": "0.2.0-rc.14",
|
|
65
|
+
"@conveno/mcp": "0.2.0-rc.14",
|
|
66
|
+
"@conveno/protocol": "0.2.0-rc.14",
|
|
67
67
|
"@types/react": "19.3.0",
|
|
68
68
|
"ink-testing-library": "4.0.0"
|
|
69
69
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { i as runHookEntry } from "./hook-entry-DWa1oppt.js";
|