@conveno/cli 0.2.0-rc.16 → 0.2.0-rc.17
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/{acp-BtwJHwcr.js → acp-C-o3rtAB.js} +3 -3
- package/dist/{agy-relay-KS1DbLqD.js → agy-relay-D17zTd_Z.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/daemon.js +71 -65
- package/dist/{daemonError-DUP5zkiR.js → daemonError-BwdtKOCy.js} +1 -1
- package/dist/{dist-fwpPA9AY.js → dist-B1pfP_d5.js} +1 -1
- package/dist/{dist-CkqMgCGl.js → dist-BOwFdixw.js} +8 -46
- package/dist/{dist-BqfYxlVP.js → dist-Bb2opAjB.js} +3 -3
- package/dist/{dist-Ch3ohbIk.js → dist-BgAfkqeX.js} +1 -1
- package/dist/{dist-XoKXwG-y.js → dist-CTw3arJP.js} +5 -5
- package/dist/{dist-X1bpJWck.js → dist-CvKAege3.js} +1 -1
- package/dist/{dist-DnWOZkAu.js → dist-Dc50_P_f.js} +323 -147
- package/dist/{dist-DVLAWfDg.js → dist-hyKfBSdF.js} +10 -5
- package/dist/{hook-DHMu72Vf.js → hook-BLSrNkFF.js} +2 -2
- package/dist/hook-entry-B1Yt2cwr.js +1 -0
- package/dist/{hook-entry-CLAuy_HJ.js → hook-entry-DYXjVztc.js} +8 -8
- package/dist/{main-DVIyOy85.js → main-CQx2xc_w.js} +15 -10
- package/dist/{pick-UDFASnAn.js → pick-iuG24FX9.js} +1 -1
- package/dist/{run-B-UMVEQs.js → run-B01nDeos.js} +73 -31
- package/dist/{runtime-CU-5JQvj.js → runtime-hZwjrEPc.js} +11 -13
- package/dist/{uninstall-jwneyeJm.js → uninstall-B-deU_wY.js} +32 -18
- package/dist/{watch-Cpp4Uwsd.js → watch-CPZ2X-yt.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-DY-CMxKE.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { writeFileSync } from "node:fs";
|
|
2
|
-
import { i as stopRequestPath, r as runAcpHostFromFile, t as killProcessTree } from "./dist-
|
|
3
|
-
import { Qt as readSpawnRecord,
|
|
2
|
+
import { i as stopRequestPath, r as runAcpHostFromFile, t as killProcessTree } from "./dist-hyKfBSdF.js";
|
|
3
|
+
import { Qt as readSpawnRecord, hn as spawnRecordPath, mn as spawnRecordOfSession } from "./dist-Dc50_P_f.js";
|
|
4
4
|
import { a as parseFlags, n as COMMANDS } from "./args-CtyKPZuN.js";
|
|
5
5
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
6
6
|
import { a as fail, n as cmd } from "./fmt-C2SsP5Y0.js";
|
|
7
|
-
import { t as findSession } from "./pick-
|
|
7
|
+
import { t as findSession } from "./pick-iuG24FX9.js";
|
|
8
8
|
// src/acp.ts
|
|
9
9
|
/** How long `conveno stop` waits for a worker to end by itself before it ends the process tree. */
|
|
10
10
|
const STOP_WAIT_MS = 1e4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
-
import { t as RELAY_SUBCOMMAND } from "./dist-
|
|
3
|
-
import {
|
|
2
|
+
import { t as RELAY_SUBCOMMAND } from "./dist-CTw3arJP.js";
|
|
3
|
+
import { un as runWaker } from "./dist-Dc50_P_f.js";
|
|
4
4
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
5
5
|
// src/agy-relay.ts
|
|
6
6
|
/**
|
package/dist/bin.js
CHANGED
|
@@ -40,9 +40,9 @@ for (const stream of [process.stdout, process.stderr]) stream.on("error", (err)
|
|
|
40
40
|
});
|
|
41
41
|
try {
|
|
42
42
|
let code;
|
|
43
|
-
if (isHook) code = await (await import("./hook-entry-
|
|
43
|
+
if (isHook) code = await (await import("./hook-entry-B1Yt2cwr.js")).runHookEntry(argv.slice(1));
|
|
44
44
|
else {
|
|
45
|
-
const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-
|
|
45
|
+
const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-CQx2xc_w.js"), import("./runtime-hZwjrEPc.js")]);
|
|
46
46
|
code = await main(argv, createRuntimeCtx());
|
|
47
47
|
}
|
|
48
48
|
if (isHook) process.exit(code);
|
package/dist/daemon.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { homedir, hostname
|
|
3
|
-
import { t as codexAdapter } from "./dist-
|
|
4
|
-
import { $n as
|
|
2
|
+
import { homedir, hostname } from "node:os";
|
|
3
|
+
import { t as codexAdapter } from "./dist-CvKAege3.js";
|
|
4
|
+
import { $n as defaultSocketPath, A as claimOrchestrator, B as daemonProof, Cn as turnHops, Ct as markDelivered, D as autoLimitsFromEnv, Dt as newAuthNonce, E as autoCandidates, En as validateRename, G as detectRepo, Gn as RELAY_CLIENT_NAME, Gt as readAccountTokens, H as dataPaths, J as effectiveHolder, Jt as readInbox, Kn as RelayPayload, Kt as readAncestry, Ln as DeviceId, N as clearOrchestrator, Nn as writePrivateFileSync, O as baseName, Ot as oneWindowPerHost, P as clientProof, Pt as pendingForInjection, Qn as createLineDecoder, R as createWmiWalker, Rn as EVENT_NAMES, S as appendHookLog, Sn as tooManyUnreadMessage, U as decideAutoContinue, Un as OWNER_SESSION_ID, Ut as proofsMatch, V as dataDir, Vn as Message, W as defaultProcessIo, Wn as PROTOCOL_VERSION, X as evaluateLiveness, Yn as SESSION_ENDED_TEXT, Zn as SessionId, Zt as readSettings, _ as ackEntries, ar as makeResult, at as holderAfterDeparture, bn as takeWithinBytes, cn as restrictToUser, cr as newSessionId, dr as safeParse, en as relayUrl, er as encodeFrame, fr as sanitizeLine, ir as makeEventNotification, it as generateSessionName, k as bindAccountDevice, l as RESPONSE_BUDGET_BYTES, lr as parseIpcRequest, mt as jwtClaim, nr as isSocketPathTooLong, nt as formatHookContext, on as resolveRecipient, or as newDeviceId, pn as signedInAccountApi, pr as socketPathTooLongMessage, pt as isOnline, qn as RpcErrorCode, r as ConvenoError, rn as requeueEntries, rr as makeError, sr as newMessageId, t as AccountError, tt as formatContinuation, ur as parseRelayFrame, vn as statusAfterLiveness, vt as leadLogLine, xn as takeWithinChars, yt as leadLogPath, z as currentAccessToken } from "./dist-Dc50_P_f.js";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { connect, createServer } from "node:net";
|
|
8
8
|
import { dirname, join, posix, win32 } from "node:path";
|
|
9
|
-
import { _ as sasMatches, a as JoinerPairing, b as signRelayHello, c as decodePairMessage, d as forkPoint, f as generateIdentity, g as publicRecord, h as parseIdentity, i as InviterPairing, l as deviceFingerprint, m as openEnvelope, n as ENVELOPE_MAX_AGE_MS, o as appendRevoke, p as headMatches, r as ENVELOPE_MAX_FUTURE_MS, s as chainHead, t as CryptoError, u as encodePairMessage, v as sealEnvelope, x as verifyChain, y as serializeIdentity } from "./dist-
|
|
10
|
-
import { execFileSync } from "node:child_process";
|
|
9
|
+
import { _ as sasMatches, a as JoinerPairing, b as signRelayHello, c as decodePairMessage, d as forkPoint, f as generateIdentity, g as publicRecord, h as parseIdentity, i as InviterPairing, l as deviceFingerprint, m as openEnvelope, n as ENVELOPE_MAX_AGE_MS, o as appendRevoke, p as headMatches, r as ENVELOPE_MAX_FUTURE_MS, s as chainHead, t as CryptoError, u as encodePairMessage, v as sealEnvelope, x as verifyChain, y as serializeIdentity } from "./dist-B1pfP_d5.js";
|
|
11
10
|
import { DatabaseSync } from "node:sqlite";
|
|
12
11
|
// ../daemon/src/lifecycle.ts
|
|
13
12
|
/** Thrown when another Conveno daemon already owns the lock file or answers on the socket. */
|
|
@@ -98,8 +97,8 @@ async function clearStaleSocket(socketPath) {
|
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
/**
|
|
101
|
-
* Read the auth token, creating it (32 random bytes, hex) with mode 0600 on first start
|
|
102
|
-
*
|
|
100
|
+
* Read the auth token, creating it (32 random bytes, hex) with mode 0600 on first start, or a
|
|
101
|
+
* user-only ACL on Windows, where the mode is ignored.
|
|
103
102
|
*/
|
|
104
103
|
function loadOrCreateToken(tokenPath) {
|
|
105
104
|
if (existsSync(tokenPath)) {
|
|
@@ -110,8 +109,7 @@ function loadOrCreateToken(tokenPath) {
|
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
const token = randomBytes(32).toString("hex");
|
|
113
|
-
|
|
114
|
-
if (process.platform !== "win32") chmodSync(tokenPath, 384);
|
|
112
|
+
writePrivateFileSync(tokenPath, `${token}\n`);
|
|
115
113
|
return token;
|
|
116
114
|
}
|
|
117
115
|
function ensureDir(dir) {
|
|
@@ -120,6 +118,8 @@ function ensureDir(dir) {
|
|
|
120
118
|
mode: 448
|
|
121
119
|
});
|
|
122
120
|
}
|
|
121
|
+
// ../daemon/package.json
|
|
122
|
+
var version = "0.2.0-rc.17";
|
|
123
123
|
const describeError = (e) => e instanceof Error ? e.stack ?? `${e.name}: ${e.message}` : String(e);
|
|
124
124
|
/**
|
|
125
125
|
* The daemon's own log, for errors it did not expect and for events the owner should be able to
|
|
@@ -158,6 +158,7 @@ function createDaemonLog(path, opts = {}) {
|
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
+
// ../daemon/src/relay/connection.ts
|
|
161
162
|
const HANDSHAKE_TIMEOUT_MS = 15e3;
|
|
162
163
|
/**
|
|
163
164
|
* One WebSocket to the relay: challenge, signed hello, then frames. It does not reconnect by
|
|
@@ -172,6 +173,7 @@ var RelayConnection = class {
|
|
|
172
173
|
stateValue = "idle";
|
|
173
174
|
stopped = false;
|
|
174
175
|
explaining = false;
|
|
176
|
+
loggedVersion = false;
|
|
175
177
|
constructor(o) {
|
|
176
178
|
this.o = o;
|
|
177
179
|
}
|
|
@@ -218,12 +220,26 @@ var RelayConnection = class {
|
|
|
218
220
|
} catch {
|
|
219
221
|
return;
|
|
220
222
|
}
|
|
223
|
+
const v = json?.v;
|
|
224
|
+
if (typeof v === "number" && v !== 1) {
|
|
225
|
+
if (!this.loggedVersion) {
|
|
226
|
+
this.loggedVersion = true;
|
|
227
|
+
this.o.log?.(`relay: dropped a frame of relay protocol version ${v}; this client speaks 1`);
|
|
228
|
+
}
|
|
229
|
+
if (this.stateValue === "connecting") this.fail("The relay speaks a newer protocol than this version of Conveno.", "upgrade_required");
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
221
232
|
const r = parseRelayFrame(json);
|
|
222
233
|
if (!r.ok) return;
|
|
223
234
|
const f = r.value;
|
|
224
235
|
if (this.stateValue === "connecting") {
|
|
225
|
-
if (f.t === "challenge")
|
|
226
|
-
|
|
236
|
+
if (f.t === "challenge") {
|
|
237
|
+
const hello = signRelayHello(this.o.identity, f.nonce);
|
|
238
|
+
this.ws?.send(JSON.stringify(this.o.client ? {
|
|
239
|
+
...hello,
|
|
240
|
+
client: this.o.client
|
|
241
|
+
} : hello));
|
|
242
|
+
} else if (f.t === "ready") {
|
|
227
243
|
if (this.handshake) clearTimeout(this.handshake);
|
|
228
244
|
this.stateValue = "ready";
|
|
229
245
|
this.pinger = setInterval(() => {
|
|
@@ -233,7 +249,7 @@ var RelayConnection = class {
|
|
|
233
249
|
}, this.o.pingMs ?? 3e4);
|
|
234
250
|
this.pinger.unref();
|
|
235
251
|
this.o.events.ready(f.online);
|
|
236
|
-
} else if (f.t === "error") this.fail(f.message, f.code);
|
|
252
|
+
} else if (f.t === "error") this.fail(f.message, f.code, f.minVersion);
|
|
237
253
|
return;
|
|
238
254
|
}
|
|
239
255
|
this.o.events.frame(f);
|
|
@@ -252,11 +268,11 @@ var RelayConnection = class {
|
|
|
252
268
|
this.fail("The relay could not be reached.");
|
|
253
269
|
}
|
|
254
270
|
}
|
|
255
|
-
fail(detail, code) {
|
|
271
|
+
fail(detail, code, minVersion) {
|
|
256
272
|
if (this.stopped || this.stateValue === "disconnected") return;
|
|
257
273
|
this.stateValue = "disconnected";
|
|
258
274
|
this.cleanup();
|
|
259
|
-
this.o.events.down(detail, code);
|
|
275
|
+
this.o.events.down(detail, code, minVersion);
|
|
260
276
|
}
|
|
261
277
|
cleanup() {
|
|
262
278
|
if (this.handshake) clearTimeout(this.handshake);
|
|
@@ -276,46 +292,6 @@ function relayPaths(join, dataDir) {
|
|
|
276
292
|
database: join(dataDir, "relay.db")
|
|
277
293
|
};
|
|
278
294
|
}
|
|
279
|
-
/**
|
|
280
|
-
* The icacls command that leaves only the current user with access to `path`: inherited entries
|
|
281
|
-
* removed (`/inheritance:r`), full control granted to the user, replacing any earlier grant
|
|
282
|
-
* (`/grant:r`). For a directory, `inherit` makes the grant apply to files and folders created in
|
|
283
|
-
* it (`(OI)(CI)`), so they are user-only from the moment they exist.
|
|
284
|
-
* See https://learn.microsoft.com/windows-server/administration/windows-commands/icacls.
|
|
285
|
-
* icacls is run from System32 by absolute path, never looked up on PATH.
|
|
286
|
-
*/
|
|
287
|
-
function userOnlyAclPlan(path, env, user, isFile, inherit = false) {
|
|
288
|
-
const systemRoot = env.SystemRoot ?? env.SYSTEMROOT ?? "C:\\Windows";
|
|
289
|
-
const icacls = win32.join(systemRoot, "System32", "icacls.exe");
|
|
290
|
-
const domain = env.USERDOMAIN;
|
|
291
|
-
const grant = `${domain ? `${domain}\\${user}` : user}:${inherit ? "(OI)(CI)" : ""}F`;
|
|
292
|
-
return planSpawn(icacls, [
|
|
293
|
-
path,
|
|
294
|
-
"/inheritance:r",
|
|
295
|
-
"/grant:r",
|
|
296
|
-
grant
|
|
297
|
-
], {
|
|
298
|
-
platform: "win32",
|
|
299
|
-
env,
|
|
300
|
-
...isFile ? { isFile } : {}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Make a file readable by the current user only: mode 0600 on POSIX, a user-only ACL on Windows
|
|
305
|
-
* (where the mode is ignored).
|
|
306
|
-
*/
|
|
307
|
-
function restrictToUser(path, platform = process.platform, directory = false) {
|
|
308
|
-
if (platform !== "win32") {
|
|
309
|
-
chmodSync(path, directory ? 448 : 384);
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
const plan = userOnlyAclPlan(path, process.env, userInfo().username, void 0, directory);
|
|
313
|
-
execFileSync(plan.file, plan.args, {
|
|
314
|
-
stdio: "ignore",
|
|
315
|
-
windowsHide: true,
|
|
316
|
-
...plan.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
295
|
const restrictIfPresent = (path) => {
|
|
320
296
|
if (process.platform !== "win32" && existsSync(path)) chmodSync(path, 384);
|
|
321
297
|
};
|
|
@@ -354,7 +330,12 @@ function keyStagingDir(path, o, platform) {
|
|
|
354
330
|
}
|
|
355
331
|
return dir;
|
|
356
332
|
}
|
|
357
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* The identity stored at `path`, or undefined. Upgrades an old Windows key file's ACL once (a
|
|
335
|
+
* marker file `<key>.acl` records it). The relay device id is separate from the session store's,
|
|
336
|
+
* so deleting this file (with relay.db) gives the machine a fresh identity that can be paired
|
|
337
|
+
* again after a revocation.
|
|
338
|
+
*/
|
|
358
339
|
function loadIdentity(path, o = {}) {
|
|
359
340
|
if (!existsSync(path)) return void 0;
|
|
360
341
|
const platform = o.platform ?? process.platform;
|
|
@@ -556,6 +537,11 @@ const AUTH_CODES = /* @__PURE__ */ new Set([
|
|
|
556
537
|
"device_mismatch",
|
|
557
538
|
"device_revoked"
|
|
558
539
|
]);
|
|
540
|
+
/** What the owner sees when the relay refuses this version of Conveno. */
|
|
541
|
+
function upgradeText(clientVersion, minVersion) {
|
|
542
|
+
const pkg = clientVersion?.includes("-") ? "@conveno/cli@next" : "@conveno/cli@latest";
|
|
543
|
+
return `${minVersion ? `The relay needs Conveno ${minVersion} or newer. ` : ""}Update Conveno to keep using your other computers: npm i -g ${pkg}`;
|
|
544
|
+
}
|
|
559
545
|
/** Messages that arrive before the sending device's session list wait this long for it. */
|
|
560
546
|
const HELD_MESSAGES_PER_DEVICE = 50;
|
|
561
547
|
const HELD_MESSAGE_MS = 12e4;
|
|
@@ -626,6 +612,8 @@ var RelayHub = class {
|
|
|
626
612
|
pendingList;
|
|
627
613
|
/** The relay refused this device because its list revokes it. */
|
|
628
614
|
relayRevoked = false;
|
|
615
|
+
/** The relay refused this version of Conveno: what to tell the owner. No retry until restart. */
|
|
616
|
+
upgradeRequired;
|
|
629
617
|
sent = /* @__PURE__ */ new Map();
|
|
630
618
|
sessionSeq = /* @__PURE__ */ new Map();
|
|
631
619
|
publishSeq = 0;
|
|
@@ -636,6 +624,7 @@ var RelayHub = class {
|
|
|
636
624
|
failures = 0;
|
|
637
625
|
/** The code of the last `error` frame, for the close that usually follows it. */
|
|
638
626
|
lastErrorCode;
|
|
627
|
+
lastErrorMin;
|
|
639
628
|
online = /* @__PURE__ */ new Set();
|
|
640
629
|
remote = /* @__PURE__ */ new Map();
|
|
641
630
|
pairing;
|
|
@@ -653,13 +642,14 @@ var RelayHub = class {
|
|
|
653
642
|
this.identitySaved = stored !== void 0;
|
|
654
643
|
this.state = new RelayState(paths.database);
|
|
655
644
|
this.now = o.now ?? (() => /* @__PURE__ */ new Date());
|
|
656
|
-
this.url = o.relayUrl ??
|
|
645
|
+
this.url = o.relayUrl ?? relayUrl();
|
|
657
646
|
const accountFile = dataPaths(platform, o.dataDir).account;
|
|
658
647
|
this.accessToken = o.accessToken ?? (async (refresh, deviceId) => {
|
|
659
648
|
if (!refresh) return (await readAccountTokens(accountFile))?.accessToken ?? null;
|
|
660
|
-
const
|
|
649
|
+
const io = { apiBase: signedInAccountApi(accountFile) };
|
|
650
|
+
const token = await currentAccessToken(accountFile, io);
|
|
661
651
|
if (token === null || jwtClaim(token, "did") === deviceId) return token;
|
|
662
|
-
return bindAccountDevice(accountFile, deviceId);
|
|
652
|
+
return bindAccountDevice(accountFile, deviceId, io);
|
|
663
653
|
});
|
|
664
654
|
this.connectImpl = o.connect ?? ((c) => new RelayConnection(c));
|
|
665
655
|
this.publishMs = o.publishIntervalMs ?? 6e4;
|
|
@@ -776,6 +766,7 @@ var RelayHub = class {
|
|
|
776
766
|
async evaluateOnce() {
|
|
777
767
|
if (this.stopped) return;
|
|
778
768
|
if (this.isRevoked()) return this.idle("revoked", "This device was removed from the device list.");
|
|
769
|
+
if (this.upgradeRequired) return this.idle("upgrade_required", this.upgradeRequired);
|
|
779
770
|
const want = this.paired() || this.pairingActive();
|
|
780
771
|
const self = this.identity.deviceId;
|
|
781
772
|
if (!want) {
|
|
@@ -805,13 +796,18 @@ var RelayHub = class {
|
|
|
805
796
|
const events = {
|
|
806
797
|
ready: (online) => this.onReady(online),
|
|
807
798
|
frame: (f) => this.onFrame(f),
|
|
808
|
-
down: (detail, code) => this.onDown(detail, code)
|
|
799
|
+
down: (detail, code, min) => this.onDown(detail, code, min)
|
|
809
800
|
};
|
|
810
801
|
this.link = this.connectImpl({
|
|
811
802
|
url: this.url,
|
|
812
803
|
identity: this.identity,
|
|
813
804
|
token,
|
|
814
|
-
events
|
|
805
|
+
events,
|
|
806
|
+
...this.o.clientVersion ? { client: {
|
|
807
|
+
name: RELAY_CLIENT_NAME,
|
|
808
|
+
version: this.o.clientVersion
|
|
809
|
+
} } : {},
|
|
810
|
+
log: (line) => this.o.host.log.note(line)
|
|
815
811
|
});
|
|
816
812
|
this.link.start();
|
|
817
813
|
}
|
|
@@ -844,9 +840,11 @@ var RelayHub = class {
|
|
|
844
840
|
for (const d of online) this.online.add(d);
|
|
845
841
|
this.pairingTick();
|
|
846
842
|
}
|
|
847
|
-
onDown(detail, frameCode) {
|
|
843
|
+
onDown(detail, frameCode, frameMin) {
|
|
848
844
|
const code = frameCode ?? this.lastErrorCode;
|
|
845
|
+
const min = frameMin ?? this.lastErrorMin;
|
|
849
846
|
this.lastErrorCode = void 0;
|
|
847
|
+
this.lastErrorMin = void 0;
|
|
850
848
|
this.link = void 0;
|
|
851
849
|
this.linkReady = false;
|
|
852
850
|
this.listReceived = false;
|
|
@@ -859,6 +857,12 @@ var RelayHub = class {
|
|
|
859
857
|
this.idle("revoked", "The relay says the device list revokes this device.");
|
|
860
858
|
return;
|
|
861
859
|
}
|
|
860
|
+
if (code === "upgrade_required") {
|
|
861
|
+
this.upgradeRequired = upgradeText(this.o.clientVersion, min);
|
|
862
|
+
this.o.host.log.note(`relay: refused this version of Conveno (${detail})`);
|
|
863
|
+
this.idle("upgrade_required", this.upgradeRequired);
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
862
866
|
this.connState = "disconnected";
|
|
863
867
|
this.detail = detail;
|
|
864
868
|
this.failures++;
|
|
@@ -896,6 +900,7 @@ var RelayHub = class {
|
|
|
896
900
|
case "error":
|
|
897
901
|
this.detail = `The relay reported: ${f.message}`;
|
|
898
902
|
this.lastErrorCode = f.code;
|
|
903
|
+
this.lastErrorMin = f.minVersion;
|
|
899
904
|
if (f.code === "list_rejected") this.failPendingList(f.message);
|
|
900
905
|
return;
|
|
901
906
|
default: return;
|
|
@@ -1983,7 +1988,7 @@ var Store = class {
|
|
|
1983
1988
|
}
|
|
1984
1989
|
};
|
|
1985
1990
|
// ../daemon/src/server.ts
|
|
1986
|
-
const DAEMON_VERSION =
|
|
1991
|
+
const DAEMON_VERSION = version;
|
|
1987
1992
|
/** A connection that has not finished the handshake by then is closed. */
|
|
1988
1993
|
const AUTH_TIMEOUT_MS = 5e3;
|
|
1989
1994
|
/** Unread messages one session may hold. */
|
|
@@ -3008,7 +3013,7 @@ var Daemon = class {
|
|
|
3008
3013
|
return this.sendToRemote(make(p.to), remote, sender.hops);
|
|
3009
3014
|
}
|
|
3010
3015
|
const targetRow = rows.find((r) => r.id === target.id);
|
|
3011
|
-
if (this.store.unreadCount(targetRow.id) >=
|
|
3016
|
+
if (this.store.unreadCount(targetRow.id) >= MAX_UNREAD_PER_SESSION) throw new ConvenoError(RpcErrorCode.LimitExceeded, tooManyUnreadMessage(targetRow.name, MAX_UNREAD_PER_SESSION));
|
|
3012
3017
|
const message = make(p.to);
|
|
3013
3018
|
this.store.insertMessage(message, targetRow.id, at, sender.hops);
|
|
3014
3019
|
this.emitMessage(message, targetRow.id);
|
|
@@ -3426,7 +3431,7 @@ var Daemon = class {
|
|
|
3426
3431
|
if (!row) return "session_gone";
|
|
3427
3432
|
if (row.status === "offline") return "session_offline";
|
|
3428
3433
|
if (this.store.hasMessage(m.id)) return void 0;
|
|
3429
|
-
if (this.store.unreadCount(row.id) >=
|
|
3434
|
+
if (this.store.unreadCount(row.id) >= MAX_UNREAD_PER_SESSION) return "mailbox_full";
|
|
3430
3435
|
this.store.insertMessage(m, row.id, this.iso(), hops);
|
|
3431
3436
|
this.emitMessage(m, row.id);
|
|
3432
3437
|
},
|
|
@@ -3505,6 +3510,7 @@ const unauthorizedMessage = "Finish the handshake first: call hello, then auth.
|
|
|
3505
3510
|
function startRelay(daemon, opts, relayOpts) {
|
|
3506
3511
|
try {
|
|
3507
3512
|
const hub = new RelayHub({
|
|
3513
|
+
clientVersion: DAEMON_VERSION,
|
|
3508
3514
|
...relayOpts,
|
|
3509
3515
|
dataDir: opts.dataDir,
|
|
3510
3516
|
host: daemon.relayHost()
|
|
@@ -3544,7 +3550,7 @@ async function startDaemon(opts) {
|
|
|
3544
3550
|
close().then(() => opts.onIdleExit?.());
|
|
3545
3551
|
}, () => {
|
|
3546
3552
|
close().then(() => opts.onShutdown?.());
|
|
3547
|
-
}, daemonLog, opts.authTimeoutMs ??
|
|
3553
|
+
}, daemonLog, opts.authTimeoutMs ?? AUTH_TIMEOUT_MS, opts.autoLimits ?? autoLimitsFromEnv(process.env), processIo, opts.platform, opts.wakers ?? {}, paths.settings, leadLogPath(opts.dataDir));
|
|
3548
3554
|
daemon.removeAllOffline();
|
|
3549
3555
|
const srv = createServer((socket) => daemon.attach(socket));
|
|
3550
3556
|
server = srv;
|
|
@@ -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 { Ln as DeviceId, _r as discriminatedUnion, br as object, hr as array, mr as _enum, vr as literal, xr as string, yr as number } from "./dist-Dc50_P_f.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";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "node:url";
|
|
2
1
|
import { release } from "node:os";
|
|
3
2
|
// ../brand/dist/index.js
|
|
4
3
|
const tokens = {
|
|
@@ -51,7 +50,7 @@ const tokens = {
|
|
|
51
50
|
},
|
|
52
51
|
"roles": {
|
|
53
52
|
"entry": "The one accent. The point in the mark, the orchestrator, links, primary actions, 'live'. Never used for decoration.",
|
|
54
|
-
"stamp": "Attention that needs the owner:
|
|
53
|
+
"stamp": "Attention that needs the owner: waiting on a question. Not an error.",
|
|
55
54
|
"ok/warn/error/info": "Semantic state only. Never as brand accents."
|
|
56
55
|
},
|
|
57
56
|
"derived": {
|
|
@@ -258,9 +257,9 @@ const tokens = {
|
|
|
258
257
|
"c--- *"
|
|
259
258
|
],
|
|
260
259
|
"showAfterMs": 400,
|
|
261
|
-
"noMotion": "Static 'c─── ●' line when
|
|
260
|
+
"noMotion": "Static 'c─── ●' line when CONVENO_REDUCED_MOTION=1, NO_COLOR is set, or stdout is not a TTY."
|
|
262
261
|
},
|
|
263
|
-
"env": "NO_COLOR disables colour; FORCE_COLOR=0..3 forces level; COLORTERM=truecolor|24bit enables truecolor;
|
|
262
|
+
"env": "NO_COLOR disables colour; FORCE_COLOR=0..3 forces level; COLORTERM=truecolor|24bit enables truecolor; CONVENO_REDUCED_MOTION disables spinners."
|
|
264
263
|
},
|
|
265
264
|
"naming": {
|
|
266
265
|
"cssVariables": "All CSS custom properties use the --cv- prefix (e.g. --cv-ink, --cv-ease-enter, --cv-dur-quick, --cv-fs-sm, --cv-s-4, --cv-r-md). The icon accent point colour is --cv-point.",
|
|
@@ -292,7 +291,6 @@ const tokens = {
|
|
|
292
291
|
"exempt": ["icons/sprite.svg (bundle)", "assets/social-preview*.svg (source for the PNG; outlined text)"]
|
|
293
292
|
}
|
|
294
293
|
};
|
|
295
|
-
import.meta.url;
|
|
296
294
|
const terminalTheme = {
|
|
297
295
|
"name": "Conveno terminal theme",
|
|
298
296
|
"version": "1.0.0-lock",
|
|
@@ -303,7 +301,7 @@ const terminalTheme = {
|
|
|
303
301
|
"light": "#FBFCFD"
|
|
304
302
|
},
|
|
305
303
|
"attributes": {
|
|
306
|
-
"bold": "SGR 1. Used for names
|
|
304
|
+
"bold": "SGR 1. Used for names and the one key phrase of a line. Never the only signal.",
|
|
307
305
|
"dim": "Not used. 'quiet' is a colour, because SGR 2 is unreliable across terminals.",
|
|
308
306
|
"underline": "SGR 4. URLs only.",
|
|
309
307
|
"reset": "SGR 0 at the end of every coloured span and every line."
|
|
@@ -325,7 +323,7 @@ const terminalTheme = {
|
|
|
325
323
|
}
|
|
326
324
|
},
|
|
327
325
|
"stamp": {
|
|
328
|
-
"use": "Needs the owner:
|
|
326
|
+
"use": "Needs the owner: waiting on a question. Not an error.",
|
|
329
327
|
"truecolor": {
|
|
330
328
|
"dark": "#FFB547",
|
|
331
329
|
"light": "#9A5700"
|
|
@@ -539,7 +537,7 @@ const terminalTheme = {
|
|
|
539
537
|
"COLORTERM",
|
|
540
538
|
"TERM"
|
|
541
539
|
],
|
|
542
|
-
"
|
|
540
|
+
"CONVENO_REDUCED_MOTION": "1 disables the spinner and prints the static 'c─── ●' line. NO_COLOR or a non-TTY stdout do the same."
|
|
543
541
|
},
|
|
544
542
|
"status": {
|
|
545
543
|
"shapes": {
|
|
@@ -586,12 +584,7 @@ const terminalTheme = {
|
|
|
586
584
|
"note": "The c and the entry line are quiet; only the final point is entry (the mark's point)."
|
|
587
585
|
},
|
|
588
586
|
"staticLine": "c─── ●",
|
|
589
|
-
"noMotion": "Static 'c─── ●' line when
|
|
590
|
-
},
|
|
591
|
-
"redaction": {
|
|
592
|
-
"unicode": "[redacted]",
|
|
593
|
-
"ascii": "[redacted]",
|
|
594
|
-
"note": "Fixed text, inverse video when colour is on."
|
|
587
|
+
"noMotion": "Static 'c─── ●' line when CONVENO_REDUCED_MOTION=1, NO_COLOR is set, or stdout is not a TTY."
|
|
595
588
|
}
|
|
596
589
|
};
|
|
597
590
|
const ESC = "\x1B[";
|
|
@@ -660,15 +653,6 @@ function detectUnicode(ctx = currentContext()) {
|
|
|
660
653
|
if (set(locale)) return /utf-?8/i.test(locale);
|
|
661
654
|
return true;
|
|
662
655
|
}
|
|
663
|
-
/** Spinner gate from tokens.terminal.spinner.noMotion: CONVENO_NO_MOTION, CI, non-TTY, TERM=dumb. */
|
|
664
|
-
function detectMotion(ctx = currentContext()) {
|
|
665
|
-
const { env } = ctx;
|
|
666
|
-
if (!falsy(env.CONVENO_NO_MOTION)) return false;
|
|
667
|
-
if (!falsy(env.CI)) return false;
|
|
668
|
-
if (!ctx.isTTY) return false;
|
|
669
|
-
if (env.TERM === "dumb") return false;
|
|
670
|
-
return true;
|
|
671
|
-
}
|
|
672
656
|
function sgr(role, level, bg) {
|
|
673
657
|
const r = terminalTheme.roles[role];
|
|
674
658
|
if (level === 3) {
|
|
@@ -690,7 +674,6 @@ function createTheme(opts = {}) {
|
|
|
690
674
|
const colorLevel = detectColorLevel(ctx, opts.color);
|
|
691
675
|
const background = opts.background ?? detectBackground(ctx.env);
|
|
692
676
|
const unicode = opts.ascii ? false : detectUnicode(ctx);
|
|
693
|
-
const motion = detectMotion(ctx);
|
|
694
677
|
const wrap = (codes, text) => `${ESC}${codes}m${text}${RESET}`;
|
|
695
678
|
const paint = (role, text, o) => {
|
|
696
679
|
if (colorLevel === 0 || text === "") return text;
|
|
@@ -707,36 +690,15 @@ function createTheme(opts = {}) {
|
|
|
707
690
|
const status = (name) => paint(tokens.terminal.glyphColors[name], glyph(name));
|
|
708
691
|
const point = unicode ? "●" : tokens.terminal.asciiFallback["●"] ?? "*";
|
|
709
692
|
const mark = () => `${paint("ink", "c")}${paint("entry", point)}`;
|
|
710
|
-
const spinner = () => {
|
|
711
|
-
const sp = tokens.terminal.spinner;
|
|
712
|
-
const raw = unicode ? sp.frames : sp.asciiFrames;
|
|
713
|
-
const dot = unicode ? "●" : "*";
|
|
714
|
-
const paintFrame = (f) => {
|
|
715
|
-
const i = f.indexOf(dot);
|
|
716
|
-
const line = i === -1 ? f : f.slice(0, i);
|
|
717
|
-
const tail = i === -1 ? "" : paint("entry", dot);
|
|
718
|
-
return paint("quiet", line.trimEnd()) + " ".repeat(line.length - line.trimEnd().length) + tail;
|
|
719
|
-
};
|
|
720
|
-
const frames = raw.map(paintFrame);
|
|
721
|
-
return {
|
|
722
|
-
animated: motion,
|
|
723
|
-
intervalMs: sp.intervalMs,
|
|
724
|
-
showAfterMs: sp.showAfterMs,
|
|
725
|
-
frames,
|
|
726
|
-
staticLine: paintFrame(raw[raw.length - 1])
|
|
727
|
-
};
|
|
728
|
-
};
|
|
729
693
|
return {
|
|
730
694
|
colorLevel,
|
|
731
695
|
background,
|
|
732
696
|
unicode,
|
|
733
|
-
motion,
|
|
734
697
|
paint,
|
|
735
698
|
bold,
|
|
736
699
|
glyph,
|
|
737
700
|
status,
|
|
738
|
-
mark
|
|
739
|
-
spinner
|
|
701
|
+
mark
|
|
740
702
|
};
|
|
741
703
|
}
|
|
742
704
|
export { tokens as i, detectColorLevel as n, detectUnicode as r, createTheme as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { At as parseCliVersion,
|
|
3
|
+
import { At as parseCliVersion, C as askedKey, Et as needsQuoting, Ft as pendingHookContext, K as dropFromList, W as defaultProcessIo, Wt as putInList, Y as endTurnContinuation, Z as existedBefore, bt as loadJson, c as ORCHESTRATOR_TASK_NOTICE, dn as sameJson, ft as isObject, ht as late, i as FROM_USER_NOTICE, kt as ownSession, lt as hostPidOf, o as NOT_FROM_USER_NOTICE, q as editJson, qt as readCommandLine, w as askedMarker, wn as uninstallLauncher, x as agentCommand, zt as planLauncher } from "./dist-Dc50_P_f.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";
|
|
@@ -273,7 +273,7 @@ const hookCommand = (env, event) => [
|
|
|
273
273
|
* `UserPromptSubmit` is ignored with a warning, 10-hooks.md, matcher).
|
|
274
274
|
*/
|
|
275
275
|
const desiredGroup = (env, event) => ({
|
|
276
|
-
...event ===
|
|
276
|
+
...event === IDLE_EVENT ? { matcher: IDLE_MATCHER } : {},
|
|
277
277
|
hooks: [{
|
|
278
278
|
type: "command",
|
|
279
279
|
command: hookCommand(env, event),
|
|
@@ -660,7 +660,7 @@ async function stopHook(input, ctx) {
|
|
|
660
660
|
*/
|
|
661
661
|
async function hook(event, input, ctx) {
|
|
662
662
|
const data = asInput(input);
|
|
663
|
-
ctx = withConversation(data, ctx, event ===
|
|
663
|
+
ctx = withConversation(data, ctx, event === SESSION_START_EVENT || event === TURN_START_EVENT);
|
|
664
664
|
switch (event) {
|
|
665
665
|
case SESSION_START_EVENT:
|
|
666
666
|
if (!inSubagent(data)) await ownSession(ctx).catch(() => null);
|
|
@@ -3,7 +3,7 @@ import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
|
|
|
3
3
|
import { createConnection } from "node:net";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
|
-
import {
|
|
6
|
+
import { $n as defaultSocketPath, B as daemonProof, Bn as EventPayload, Dt as newAuthNonce, H as dataPaths, Jn as RpcResponse, P as clientProof, Qn as createLineDecoder, Ut as proofsMatch, V as dataDir, Wn as PROTOCOL_VERSION, er as encodeFrame, nr as isSocketPathTooLong, pr as socketPathTooLongMessage, qn as RpcErrorCode, r as ConvenoError, tr as ipcMethods } from "./dist-Dc50_P_f.js";
|
|
7
7
|
// ../client/dist/index.js
|
|
8
8
|
const DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
9
9
|
const DEFAULT_START_TIMEOUT_MS = 1e4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { At as parseCliVersion, Et as needsQuoting, Ft as pendingHookContext,
|
|
3
|
+
import { At as parseCliVersion, Et as needsQuoting, F as compareVersions, Ft as pendingHookContext, K as dropFromList, V as dataDir, Y as endTurnContinuation, Z as existedBefore, bt as loadJson, dn as sameJson, ft as isObject, ht as late, kt as ownSession, q as editJson, w as askedMarker, wn as uninstallLauncher, x as agentCommand, zt as planLauncher } from "./dist-Dc50_P_f.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. */
|
|
@@ -345,13 +345,13 @@ async function plan(env, opts = {}) {
|
|
|
345
345
|
});
|
|
346
346
|
const setFile = await loadJson(p.settings);
|
|
347
347
|
const allow = allowList(setFile.value, p.settings);
|
|
348
|
-
const hasRule = allow?.includes(
|
|
348
|
+
const hasRule = allow?.includes(PERMISSION_RULE) ?? false;
|
|
349
349
|
const relay = relayRule(env);
|
|
350
350
|
const hadRelay = allow?.includes(relay) ?? false;
|
|
351
351
|
const known = await relayRuleKnown(env);
|
|
352
352
|
const others = otherRelayRules(env);
|
|
353
353
|
const hadOther = allow?.some((r) => typeof r === "string" && others.has(r)) ?? false;
|
|
354
|
-
const wantRelay = known === void 0 ? hadRelay : (opts.accept?.includes(
|
|
354
|
+
const wantRelay = known === void 0 ? hadRelay : (opts.accept?.includes(RELAY_OPTION) === true || hadRelay || hadOther) && known;
|
|
355
355
|
const stale = dropFromList(allow, ["permissions", "allow"], (r) => known !== void 0 && isOurRelayRule(r) && !(wantRelay && r === relay), { keepEmpty: true });
|
|
356
356
|
const missing = [...hasRule ? [] : [PERMISSION_RULE], ...wantRelay && !hadRelay ? [relay] : []];
|
|
357
357
|
if (missing.length > 0 || stale.length > 0) {
|
|
@@ -407,7 +407,7 @@ async function plan(env, opts = {}) {
|
|
|
407
407
|
before: setFile.raw,
|
|
408
408
|
after: editJson(setFile, ruleEdits),
|
|
409
409
|
description: [
|
|
410
|
-
missing.includes(
|
|
410
|
+
missing.includes(PERMISSION_RULE) ? `Allow the agent to call Conveno's tools (${PERMISSION_RULE}) without asking. They only exchange messages between your own sessions.` : void 0,
|
|
411
411
|
addsRelay ? `Allow the agent to start Conveno's relay (${relay}) without asking, so it can wake an idle conversation.` : void 0,
|
|
412
412
|
stale.length > 0 ? "Remove the old rule that started Conveno's relay without asking." : void 0
|
|
413
413
|
].filter(Boolean).join(" ")
|
|
@@ -513,7 +513,7 @@ async function uninstallPlan(env, baseline) {
|
|
|
513
513
|
description: `Remove the "${SERVER_NAME}" MCP server.`
|
|
514
514
|
});
|
|
515
515
|
const setFile = await loadJson(p.settings);
|
|
516
|
-
const drops = dropFromList(allowList(setFile.value, p.settings), ["permissions", "allow"], (r) => r ===
|
|
516
|
+
const drops = dropFromList(allowList(setFile.value, p.settings), ["permissions", "allow"], (r) => r === PERMISSION_RULE || isOurRelayRule(r), { keepEmpty: existedBefore(baseline?.get(p.settings), ["permissions", "allow"]) });
|
|
517
517
|
if (drops.length > 0) {
|
|
518
518
|
const alone = drops.length === 1 && drops[0]?.path.length === 2;
|
|
519
519
|
const only = Object.keys(setFile.value.permissions).length === 1 && !existedBefore(baseline?.get(p.settings), ["permissions"]);
|
|
@@ -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 { At as parseCliVersion, Bt as planProgram, Ft as pendingHookContext, Vt as planSpawn,
|
|
5
|
+
import { At as parseCliVersion, Bt as planProgram, Ft as pendingHookContext, Vt as planSpawn, Y as endTurnContinuation, _n as startTurnContext, et as findOnPath, kt as ownSession } from "./dist-Dc50_P_f.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";
|