@conveno/cli 0.1.1-rc.2 → 0.1.1-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +62 -15
- package/dist/daemon.js +2 -2
- package/dist/{dist-C_wVdDv5.js → dist-WPVVRVUh.js} +2 -0
- package/package.json +10 -10
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as EventPayload, D as readAncestry, E as proofsMatch, F as validateRename, G as RpcResponse, H as MessageId, I as CLI_KINDS, J as createLineDecoder, K as SessionId, O as readCommandLine, Q as isSocketPathTooLong, S as parseCliVersion, T as planSpawn, U as PROTOCOL_VERSION, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, Z as ipcMethods, c as clientProof, d as dataPaths, f as detectRepo, h as formatInbox, j as resolveWindowsCommand, l as daemonProof, n as HEARTBEAT_INTERVAL_MS, o as baseName, q as SessionNamePattern, r as NOT_FROM_USER_NOTICE, st as socketPathTooLongMessage, t as ConvenoError, u as dataDir, w as pendingHookContext, x as newAuthNonce } from "./dist-
|
|
2
|
+
import { B as EventPayload, D as readAncestry, E as proofsMatch, F as validateRename, G as RpcResponse, H as MessageId, I as CLI_KINDS, J as createLineDecoder, K as SessionId, O as readCommandLine, Q as isSocketPathTooLong, S as parseCliVersion, T as planSpawn, U as PROTOCOL_VERSION, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, Z as ipcMethods, c as clientProof, d as dataPaths, f as detectRepo, h as formatInbox, j as resolveWindowsCommand, l as daemonProof, n as HEARTBEAT_INTERVAL_MS, o as baseName, q as SessionNamePattern, r as NOT_FROM_USER_NOTICE, st as socketPathTooLongMessage, t as ConvenoError, u as dataDir, w as pendingHookContext, x as newAuthNonce } from "./dist-WPVVRVUh.js";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import { access, chmod, mkdir, open, readFile, readdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { execFile, spawn } from "node:child_process";
|
|
@@ -308,7 +308,7 @@ const connectOpts = (ctx, autoStart) => ({
|
|
|
308
308
|
});
|
|
309
309
|
// ../client/dist/index.js
|
|
310
310
|
const DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
311
|
-
const DEFAULT_START_TIMEOUT_MS =
|
|
311
|
+
const DEFAULT_START_TIMEOUT_MS = 1e4;
|
|
312
312
|
const LOCK_STALE_MS = 1e4;
|
|
313
313
|
const CLIENT_METHODS = [
|
|
314
314
|
"session.register",
|
|
@@ -541,14 +541,50 @@ function requireDaemonEntry(entry) {
|
|
|
541
541
|
if (entry) return entry;
|
|
542
542
|
throw new ClientError("Cannot find the Conveno daemon program. Pass daemonEntry to connect(), or run \"conveno daemon start\" yourself.", { kind: "daemon_missing" });
|
|
543
543
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
544
|
+
/**
|
|
545
|
+
* Start the daemon detached, with its stdout and stderr in `logPath`, truncated at each start. The
|
|
546
|
+
* daemon writes its own `daemon.log` once it runs; this file catches what it prints before that,
|
|
547
|
+
* such as a crash at startup, which would otherwise be lost.
|
|
548
|
+
*/
|
|
549
|
+
async function spawnDaemon(entry, logPath) {
|
|
550
|
+
await mkdir(dirname(logPath), { recursive: true });
|
|
551
|
+
const fh = await open(logPath, "w", 384);
|
|
552
|
+
try {
|
|
553
|
+
const child = spawn(process.execPath, [entry], {
|
|
554
|
+
detached: true,
|
|
555
|
+
stdio: [
|
|
556
|
+
"ignore",
|
|
557
|
+
fh.fd,
|
|
558
|
+
fh.fd
|
|
559
|
+
],
|
|
560
|
+
windowsHide: true
|
|
561
|
+
});
|
|
562
|
+
const spawned = { child };
|
|
563
|
+
child.on("error", (e) => {
|
|
564
|
+
spawned.spawnError = e;
|
|
565
|
+
});
|
|
566
|
+
child.on("exit", (code, signal) => {
|
|
567
|
+
spawned.exit = {
|
|
568
|
+
code,
|
|
569
|
+
signal
|
|
570
|
+
};
|
|
571
|
+
});
|
|
572
|
+
child.unref();
|
|
573
|
+
return spawned;
|
|
574
|
+
} finally {
|
|
575
|
+
await fh.close();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/** The last lines the daemon printed at startup, for an error message. */
|
|
579
|
+
async function startLogTail(logPath, lines = 12) {
|
|
580
|
+
try {
|
|
581
|
+
return (await readFile(logPath, "utf8")).trimEnd().split(/\r?\n/).slice(-lines).join("\n");
|
|
582
|
+
} catch {
|
|
583
|
+
return "";
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function startFailureDetail(logPath, tail) {
|
|
587
|
+
return tail ? ` Its output, from ${logPath}:\n${tail}` : ` It printed nothing; its output would be in ${logPath}.`;
|
|
552
588
|
}
|
|
553
589
|
/** Take the start lock. Returns a release function, or null if another client holds it. */
|
|
554
590
|
async function acquireStartLock(path) {
|
|
@@ -567,27 +603,33 @@ async function acquireStartLock(path) {
|
|
|
567
603
|
}
|
|
568
604
|
async function startAndConnect(entry, dir, attempt, socketPath, startTimeout) {
|
|
569
605
|
await mkdir(dir, { recursive: true });
|
|
606
|
+
const logPath = dataPaths(process.platform, dir).daemonStartLog;
|
|
570
607
|
const release = await acquireStartLock(join(dir, "client-start.lock"));
|
|
571
|
-
if (release) spawnDaemon(entry);
|
|
572
608
|
const deadline = Date.now() + startTimeout;
|
|
573
609
|
let delay = 25;
|
|
574
610
|
let last;
|
|
575
611
|
try {
|
|
612
|
+
const spawned = release ? await spawnDaemon(entry, logPath) : void 0;
|
|
576
613
|
for (;;) {
|
|
577
614
|
await sleep$1(delay);
|
|
578
615
|
delay = Math.min(delay * 2, 250);
|
|
616
|
+
const ended = spawned?.exit ?? spawned?.spawnError;
|
|
579
617
|
try {
|
|
580
618
|
return await attempt();
|
|
581
619
|
} catch (e) {
|
|
582
620
|
if (!isMissingDaemon(e)) throw e;
|
|
583
621
|
last = e;
|
|
584
622
|
}
|
|
623
|
+
if (spawned && ended) throw new ClientError(`The Conveno daemon ${spawned.spawnError ? `could not be started (${spawned.spawnError.message})` : `exited with ${spawned.exit?.signal ? `signal ${spawned.exit.signal}` : `code ${spawned.exit?.code}`} before it listened on ${socketPath}`}.${startFailureDetail(logPath, await startLogTail(logPath))}`, {
|
|
624
|
+
cause: spawned.spawnError ?? last,
|
|
625
|
+
kind: "start_exited"
|
|
626
|
+
});
|
|
585
627
|
if (Date.now() >= deadline) break;
|
|
586
628
|
}
|
|
587
629
|
} finally {
|
|
588
630
|
await release?.();
|
|
589
631
|
}
|
|
590
|
-
throw new ClientError(`The Conveno daemon did not start within ${startTimeout} ms (socket ${socketPath})
|
|
632
|
+
throw new ClientError(`The Conveno daemon did not start within ${startTimeout} ms (socket ${socketPath}).${startFailureDetail(logPath, await startLogTail(logPath))}`, {
|
|
591
633
|
cause: last,
|
|
592
634
|
kind: "start_timeout"
|
|
593
635
|
});
|
|
@@ -747,6 +789,11 @@ function daemonProblem(t, e) {
|
|
|
747
789
|
fix: `Run ${status} to see whether it came up, or ${cmd(t, "conveno doctor")} to check the install.`,
|
|
748
790
|
notRunning: false
|
|
749
791
|
};
|
|
792
|
+
case "start_exited": return {
|
|
793
|
+
why,
|
|
794
|
+
fix: `Fix what its output above shows, then run ${start}. If it is unclear, report it with that output.`,
|
|
795
|
+
notRunning: false
|
|
796
|
+
};
|
|
750
797
|
case "connection": return {
|
|
751
798
|
why,
|
|
752
799
|
fix: `Run ${status}, then try again.`,
|
|
@@ -1097,7 +1144,7 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1097
1144
|
return problems > 0 ? 1 : 0;
|
|
1098
1145
|
}
|
|
1099
1146
|
// src/version.ts
|
|
1100
|
-
const VERSION = "0.1.1-rc.
|
|
1147
|
+
const VERSION = "0.1.1-rc.3";
|
|
1101
1148
|
// src/errorLog.ts
|
|
1102
1149
|
/** The message of an unexpected error, as it is. Not the softened text `plainError` gives. */
|
|
1103
1150
|
function rawMessage(e) {
|
|
@@ -3803,7 +3850,7 @@ function createTheme(opts = {}) {
|
|
|
3803
3850
|
spinner
|
|
3804
3851
|
};
|
|
3805
3852
|
}
|
|
3806
|
-
// ../daemon/dist/server-
|
|
3853
|
+
// ../daemon/dist/server-LGouDx5G.js
|
|
3807
3854
|
/** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
|
|
3808
3855
|
function defaultIsAlive(pid) {
|
|
3809
3856
|
try {
|
|
@@ -3815,7 +3862,7 @@ function defaultIsAlive(pid) {
|
|
|
3815
3862
|
}
|
|
3816
3863
|
SessionId.parse("0".repeat(26));
|
|
3817
3864
|
// ../mcp/dist/index.js
|
|
3818
|
-
const SERVER_VERSION = "0.1.1-rc.
|
|
3865
|
+
const SERVER_VERSION = "0.1.1-rc.3";
|
|
3819
3866
|
const ok = (text) => ({ content: [{
|
|
3820
3867
|
type: "text",
|
|
3821
3868
|
text
|
package/dist/daemon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { $ as makeError, A as resolveRecipient, C as pendingForInjection, E as proofsMatch, F as validateRename, J as createLineDecoder, K as SessionId, L as DeviceId, M as statusAfterLiveness, N as takeWithinBytes, P as tooManyUnreadMessage, Q as isSocketPathTooLong, R as EVENT_NAMES, U as PROTOCOL_VERSION, V as Message, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, _ as holderAfterDeparture, a as ackEntries, at as parseIpcRequest, b as nameMatchesPattern, c as clientProof, d as dataPaths, et as makeEventNotification, f as detectRepo, g as generateSessionName, i as RESPONSE_BUDGET_BYTES, it as newSessionId, k as readInbox, l as daemonProof, m as evaluateLiveness, nt as newDeviceId, o as baseName, ot as sanitizeLine, p as effectiveHolder, rt as newMessageId, s as claimOrchestrator, st as socketPathTooLongMessage, t as ConvenoError, tt as makeResult, u as dataDir, v as isOnline, x as newAuthNonce, y as markDelivered } from "./dist-
|
|
3
|
+
import { $ as makeError, A as resolveRecipient, C as pendingForInjection, E as proofsMatch, F as validateRename, J as createLineDecoder, K as SessionId, L as DeviceId, M as statusAfterLiveness, N as takeWithinBytes, P as tooManyUnreadMessage, Q as isSocketPathTooLong, R as EVENT_NAMES, U as PROTOCOL_VERSION, V as Message, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, _ as holderAfterDeparture, a as ackEntries, at as parseIpcRequest, b as nameMatchesPattern, c as clientProof, d as dataPaths, et as makeEventNotification, f as detectRepo, g as generateSessionName, i as RESPONSE_BUDGET_BYTES, it as newSessionId, k as readInbox, l as daemonProof, m as evaluateLiveness, nt as newDeviceId, o as baseName, ot as sanitizeLine, p as effectiveHolder, rt as newMessageId, s as claimOrchestrator, st as socketPathTooLongMessage, t as ConvenoError, tt as makeResult, u as dataDir, v as isOnline, x as newAuthNonce, y as markDelivered } from "./dist-WPVVRVUh.js";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { connect, createServer } from "node:net";
|
|
@@ -419,7 +419,7 @@ var Store = class {
|
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
// ../daemon/src/server.ts
|
|
422
|
-
const DAEMON_VERSION = "0.1.1-rc.
|
|
422
|
+
const DAEMON_VERSION = "0.1.1-rc.3";
|
|
423
423
|
/** A connection that has not finished the handshake by then is closed. */
|
|
424
424
|
const AUTH_TIMEOUT_MS = 5e3;
|
|
425
425
|
/** Unread messages one session may hold. */
|
|
@@ -1174,6 +1174,8 @@ function dataPaths(platform, dir) {
|
|
|
1174
1174
|
/** The CLI writes its error logs here, and the daemon writes `daemon.log`. */
|
|
1175
1175
|
logs: p.join(dir, "logs"),
|
|
1176
1176
|
daemonLog: p.join(dir, "logs", "daemon.log"),
|
|
1177
|
+
/** What the daemon printed to stdout and stderr, from the last time a client started it. */
|
|
1178
|
+
daemonStartLog: p.join(dir, "logs", "daemon-start.log"),
|
|
1177
1179
|
manifest: p.join(dir, "install-manifest.json")
|
|
1178
1180
|
};
|
|
1179
1181
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conveno/cli",
|
|
3
|
-
"version": "0.1.1-rc.
|
|
3
|
+
"version": "0.1.1-rc.3",
|
|
4
4
|
"description": "Connect AI coding CLI sessions so they can message each other.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"zod": "4.6.7"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@conveno/adapter-claude": "0.1.1-rc.
|
|
50
|
-
"@conveno/adapter-codex": "0.1.1-rc.
|
|
51
|
-
"@conveno/adapter-opencode": "0.1.1-rc.
|
|
52
|
-
"@conveno/brand": "0.1.1-rc.
|
|
53
|
-
"@conveno/client": "0.1.1-rc.
|
|
54
|
-
"@conveno/core": "0.1.1-rc.
|
|
55
|
-
"@conveno/daemon": "0.1.1-rc.
|
|
56
|
-
"@conveno/mcp": "0.1.1-rc.
|
|
57
|
-
"@conveno/protocol": "0.1.1-rc.
|
|
49
|
+
"@conveno/adapter-claude": "0.1.1-rc.3",
|
|
50
|
+
"@conveno/adapter-codex": "0.1.1-rc.3",
|
|
51
|
+
"@conveno/adapter-opencode": "0.1.1-rc.3",
|
|
52
|
+
"@conveno/brand": "0.1.1-rc.3",
|
|
53
|
+
"@conveno/client": "0.1.1-rc.3",
|
|
54
|
+
"@conveno/core": "0.1.1-rc.3",
|
|
55
|
+
"@conveno/daemon": "0.1.1-rc.3",
|
|
56
|
+
"@conveno/mcp": "0.1.1-rc.3",
|
|
57
|
+
"@conveno/protocol": "0.1.1-rc.3"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown",
|