@conveno/cli 0.2.0-rc.7 → 0.2.0-rc.9
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-9pRRszwU.js → acp-BVk6rmXR.js} +3 -3
- package/dist/{agy-relay-C-nqvieJ.js → agy-relay-D8eZcLuc.js} +2 -2
- package/dist/{args-C7Agak9f.js → args-B3Cj2Ie4.js} +90 -50
- package/dist/bin.js +2 -2
- package/dist/daemon.js +20 -7
- package/dist/{daemonError-DNAKEyRT.js → daemonError-C05GqdhQ.js} +1 -1
- package/dist/{dist-D9Gu-mQm.js → dist-BjdBeCHy.js} +143 -48
- package/dist/{dist-iFaY42Bs.js → dist-CVdpCNJo.js} +1 -1
- package/dist/{dist-ftx5RNCp.js → dist-D_O_JLLq.js} +1 -1
- package/dist/{dist-Dd31Fg0h.js → dist-DaIpdMke.js} +46 -50
- package/dist/{dist-DOKVrSIw.js → dist-DzpERiRx.js} +3 -3
- package/dist/{dist-DOGlDbRb.js → dist-MK-cK1JY.js} +487 -22
- package/dist/{dist-D2hMvcZu.js → dist-STNJjbNH.js} +186 -56
- package/dist/{hook-CQeSn-w4.js → hook-CDF1A8AY.js} +26 -3
- package/dist/{hook-entry-BXmSN--S.js → hook-entry-BTJK7aO0.js} +19 -9
- package/dist/hook-entry-D6zup0QV.js +1 -0
- package/dist/{main-seh-HPZO.js → main-Kv31Qxro.js} +61 -382
- package/dist/{pick-DoyocW55.js → pick-DLp6w_-z.js} +1 -1
- package/dist/run-BPtFUGtu.js +5609 -0
- package/dist/{runtime-Bnjh9BQ8.js → runtime-xjPzIGmp.js} +72 -13
- package/dist/{doctor-BYa-MApu.js → uninstall-8AHErPRN.js} +581 -48
- package/dist/{watch-Dr2RdyGo.js → watch-D0KIPowJ.js} +4 -4
- package/package.json +19 -16
- package/dist/hook-entry-CgiSN-Oj.js +0 -1
- package/dist/run-B-WfNtCX.js +0 -4507
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync } from "node:fs";
|
|
2
|
-
import { n as runAcpHostFromFile, r as stopRequestPath, t as killProcessTree } from "./dist-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { n as runAcpHostFromFile, r as stopRequestPath, t as killProcessTree } from "./dist-DzpERiRx.js";
|
|
3
|
+
import { At as readSpawnRecord, Wt as spawnRecordPath } from "./dist-STNJjbNH.js";
|
|
4
|
+
import { a as parseFlags, n as COMMANDS } from "./args-B3Cj2Ie4.js";
|
|
5
5
|
import { a as fail, n as cmd } from "./fmt-C2SsP5Y0.js";
|
|
6
6
|
// src/acp.ts
|
|
7
7
|
/** How long `conveno stop` waits for a worker to end by itself before it ends the process tree. */
|
|
@@ -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-BjdBeCHy.js";
|
|
3
|
+
import { Vt as runWaker } from "./dist-STNJjbNH.js";
|
|
4
4
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
5
5
|
// src/agy-relay.ts
|
|
6
6
|
/**
|
|
@@ -1,67 +1,93 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { a as fail, n as cmd, t as closest } from "./fmt-C2SsP5Y0.js";
|
|
3
|
+
// src/args.ts
|
|
4
|
+
const SETUP_FLAGS = {
|
|
5
|
+
yes: {
|
|
6
|
+
type: "boolean",
|
|
7
|
+
short: "y",
|
|
8
|
+
help: "Apply without asking"
|
|
9
|
+
},
|
|
10
|
+
"dry-run": {
|
|
11
|
+
type: "boolean",
|
|
12
|
+
help: "Show the changes and write nothing"
|
|
13
|
+
},
|
|
14
|
+
cli: {
|
|
15
|
+
type: "string",
|
|
16
|
+
value: "<list>",
|
|
17
|
+
help: "Only these AI tools, separated by commas or spaces, such as claude,codex"
|
|
18
|
+
},
|
|
19
|
+
accept: {
|
|
20
|
+
type: "string",
|
|
21
|
+
value: "<ids>",
|
|
22
|
+
help: "Say yes to these extras without asking, such as copilot-idle-wake"
|
|
23
|
+
},
|
|
24
|
+
"acp-adapters": {
|
|
25
|
+
type: "boolean",
|
|
26
|
+
help: "Let ACP workers fetch the Codex and Claude adapters with npx, without asking"
|
|
27
|
+
},
|
|
28
|
+
"no-acp-adapters": {
|
|
29
|
+
type: "boolean",
|
|
30
|
+
help: "Do not let ACP workers fetch adapters; print how to install them"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
3
33
|
const COMMANDS = [
|
|
4
34
|
{
|
|
5
|
-
name: "
|
|
6
|
-
usage: "conveno
|
|
7
|
-
summary: "
|
|
35
|
+
name: "setup",
|
|
36
|
+
usage: "conveno setup [--yes] [--dry-run] [--cli <list>] [--lead <cli>]",
|
|
37
|
+
summary: "Connect Conveno to your AI tools",
|
|
8
38
|
flags: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
short: "y",
|
|
12
|
-
help: "Apply without asking"
|
|
13
|
-
},
|
|
14
|
-
"dry-run": {
|
|
15
|
-
type: "boolean",
|
|
16
|
-
help: "Show the changes and write nothing"
|
|
17
|
-
},
|
|
18
|
-
cli: {
|
|
19
|
-
type: "string",
|
|
20
|
-
value: "<list>",
|
|
21
|
-
help: "Only these CLIs, separated by commas or spaces, such as claude,codex"
|
|
22
|
-
},
|
|
23
|
-
accept: {
|
|
39
|
+
...SETUP_FLAGS,
|
|
40
|
+
lead: {
|
|
24
41
|
type: "string",
|
|
25
|
-
value: "<
|
|
26
|
-
help: "
|
|
27
|
-
},
|
|
28
|
-
"acp-adapters": {
|
|
29
|
-
type: "boolean",
|
|
30
|
-
help: "Let ACP workers fetch the Codex and Claude adapters with npx, without asking"
|
|
31
|
-
},
|
|
32
|
-
"no-acp-adapters": {
|
|
33
|
-
type: "boolean",
|
|
34
|
-
help: "Do not let ACP workers fetch adapters; print how to install them"
|
|
42
|
+
value: "<cli>",
|
|
43
|
+
help: "The AI tool that should lead when it starts, such as claude"
|
|
35
44
|
}
|
|
36
45
|
},
|
|
37
46
|
notes: [
|
|
38
|
-
"
|
|
47
|
+
"In a terminal, setup walks you through it. With --yes, or without a terminal, it applies the changes without a walk-through.",
|
|
48
|
+
"Setup shows every file it will change and asks first. Without a terminal it needs --yes, and exits 2 without it.",
|
|
49
|
+
"Approving Conveno inside Codex and Antigravity is asked as yes/no, default yes. Extras, such as Copilot idle wake (it turns on Copilot's experimental mode), default no. --yes takes the defaults; --accept <ids> says yes to only those.",
|
|
50
|
+
"Undo any time with conveno uninstall."
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "init",
|
|
55
|
+
usage: "conveno init [--yes] [--dry-run] [--cli <list>] [--acp-adapters | --no-acp-adapters]",
|
|
56
|
+
summary: "Set up every supported AI tool that is installed",
|
|
57
|
+
flags: SETUP_FLAGS,
|
|
58
|
+
notes: [
|
|
59
|
+
"init is the older name for setup. It shows every file it will change, with a diff, and asks first.",
|
|
39
60
|
"Without a terminal it needs --yes, and exits 2 without it.",
|
|
40
|
-
"
|
|
61
|
+
"Approving Conveno inside Codex and Antigravity is asked as yes/no, default yes. Other optional setups, such as Copilot idle wake (it turns on Copilot's experimental mode), default no. --yes takes the defaults; --accept <ids> says yes to only those.",
|
|
41
62
|
"When Codex or Claude Code is installed without its ACP adapter, init asks once whether npx may fetch it (third-party npm packages, pinned versions). The answer is kept; the two adapter flags change it."
|
|
42
|
-
]
|
|
63
|
+
],
|
|
64
|
+
hidden: true
|
|
43
65
|
},
|
|
44
66
|
{
|
|
45
67
|
name: "uninstall",
|
|
46
68
|
usage: "conveno uninstall [--yes]",
|
|
47
|
-
summary: "
|
|
69
|
+
summary: "Remove Conveno from your AI tools",
|
|
48
70
|
flags: { yes: {
|
|
49
71
|
type: "boolean",
|
|
50
72
|
short: "y",
|
|
51
|
-
help: "
|
|
73
|
+
help: "Go ahead without asking"
|
|
52
74
|
} },
|
|
53
|
-
notes: [
|
|
75
|
+
notes: [
|
|
76
|
+
"Stops Conveno's background service first, then puts your AI tools back the way they were.",
|
|
77
|
+
"Files that are still as setup left them are restored exactly.",
|
|
78
|
+
"Files you or the AI tool changed since lose only Conveno's own entries."
|
|
79
|
+
]
|
|
54
80
|
},
|
|
55
81
|
{
|
|
56
82
|
name: "status",
|
|
57
83
|
usage: "conveno status",
|
|
58
|
-
summary: "
|
|
84
|
+
summary: "See which AI sessions are running",
|
|
59
85
|
flags: {}
|
|
60
86
|
},
|
|
61
87
|
{
|
|
62
88
|
name: "send",
|
|
63
89
|
usage: "conveno send <to> <text...> [--urgent]",
|
|
64
|
-
summary: "Send a message to a session
|
|
90
|
+
summary: "Send a message to a running session",
|
|
65
91
|
flags: { urgent: {
|
|
66
92
|
type: "boolean",
|
|
67
93
|
help: "Mark the message urgent"
|
|
@@ -79,7 +105,8 @@ const COMMANDS = [
|
|
|
79
105
|
summary: "Give an online session a new name",
|
|
80
106
|
flags: {},
|
|
81
107
|
notes: ["<session> is a name or id. Names use lowercase letters, digits and . _ @ -."],
|
|
82
|
-
positionals: true
|
|
108
|
+
positionals: true,
|
|
109
|
+
hidden: true
|
|
83
110
|
},
|
|
84
111
|
{
|
|
85
112
|
name: "lead",
|
|
@@ -94,7 +121,8 @@ const COMMANDS = [
|
|
|
94
121
|
"<session> is a name or id. The old lead is told.",
|
|
95
122
|
"--clear leaves no lead."
|
|
96
123
|
],
|
|
97
|
-
positionals: true
|
|
124
|
+
positionals: true,
|
|
125
|
+
hidden: true
|
|
98
126
|
},
|
|
99
127
|
{
|
|
100
128
|
name: "spawn",
|
|
@@ -146,7 +174,8 @@ const COMMANDS = [
|
|
|
146
174
|
"Without a terminal of your own it needs --yes, and exits 2 without it.",
|
|
147
175
|
"At most 8 spawned sessions run at once; CONVENO_SPAWN_MAX changes that."
|
|
148
176
|
],
|
|
149
|
-
positionals: true
|
|
177
|
+
positionals: true,
|
|
178
|
+
hidden: true
|
|
150
179
|
},
|
|
151
180
|
{
|
|
152
181
|
name: "stop",
|
|
@@ -154,7 +183,8 @@ const COMMANDS = [
|
|
|
154
183
|
summary: "Stop a background worker",
|
|
155
184
|
flags: {},
|
|
156
185
|
notes: ["A background worker cancels its current turn, stops its CLI and tells the session that spawned it.", "A worker in a terminal window is yours to close."],
|
|
157
|
-
positionals: true
|
|
186
|
+
positionals: true,
|
|
187
|
+
hidden: true
|
|
158
188
|
},
|
|
159
189
|
{
|
|
160
190
|
name: "devices",
|
|
@@ -174,14 +204,16 @@ const COMMANDS = [
|
|
|
174
204
|
"reset forgets this device's list after you reset your devices on the account page.",
|
|
175
205
|
"Needs a Conveno Pro login on both devices."
|
|
176
206
|
],
|
|
177
|
-
positionals: true
|
|
207
|
+
positionals: true,
|
|
208
|
+
hidden: true
|
|
178
209
|
},
|
|
179
210
|
{
|
|
180
211
|
name: "relay",
|
|
181
212
|
usage: "conveno relay status",
|
|
182
213
|
summary: "Show the relay connection",
|
|
183
214
|
flags: {},
|
|
184
|
-
positionals: true
|
|
215
|
+
positionals: true,
|
|
216
|
+
hidden: true
|
|
185
217
|
},
|
|
186
218
|
{
|
|
187
219
|
name: "doctor",
|
|
@@ -190,8 +222,9 @@ const COMMANDS = [
|
|
|
190
222
|
flags: { cli: {
|
|
191
223
|
type: "string",
|
|
192
224
|
value: "<list>",
|
|
193
|
-
help: "Only these
|
|
194
|
-
} }
|
|
225
|
+
help: "Only these AI tools, separated by commas or spaces, such as claude,codex"
|
|
226
|
+
} },
|
|
227
|
+
hidden: true
|
|
195
228
|
},
|
|
196
229
|
{
|
|
197
230
|
name: "login",
|
|
@@ -205,19 +238,22 @@ const COMMANDS = [
|
|
|
205
238
|
"login shows a code and a link. Approve the code in your browser and the terminal signs in.",
|
|
206
239
|
"The account is only for Conveno Pro. Everything on this machine works without one.",
|
|
207
240
|
"The tokens are kept in the data dir, in account.json, readable by you only."
|
|
208
|
-
]
|
|
241
|
+
],
|
|
242
|
+
hidden: true
|
|
209
243
|
},
|
|
210
244
|
{
|
|
211
245
|
name: "logout",
|
|
212
246
|
usage: "conveno logout",
|
|
213
247
|
summary: "Sign out and delete the saved tokens",
|
|
214
|
-
flags: {}
|
|
248
|
+
flags: {},
|
|
249
|
+
hidden: true
|
|
215
250
|
},
|
|
216
251
|
{
|
|
217
252
|
name: "account",
|
|
218
253
|
usage: "conveno account",
|
|
219
254
|
summary: "Show your plan and trial",
|
|
220
|
-
flags: {}
|
|
255
|
+
flags: {},
|
|
256
|
+
hidden: true
|
|
221
257
|
},
|
|
222
258
|
{
|
|
223
259
|
name: "daemon",
|
|
@@ -235,17 +271,21 @@ const COMMANDS = [
|
|
|
235
271
|
type: "string",
|
|
236
272
|
value: "<cli>",
|
|
237
273
|
help: "The CLI that starts it, such as claude"
|
|
238
|
-
} }
|
|
274
|
+
} },
|
|
275
|
+
hidden: true
|
|
239
276
|
},
|
|
240
277
|
{
|
|
241
278
|
name: "hook",
|
|
242
279
|
usage: "conveno hook <cli> <event>",
|
|
243
280
|
summary: "Hook entry (CLIs launch this)",
|
|
244
281
|
flags: {},
|
|
245
|
-
positionals: true
|
|
282
|
+
positionals: true,
|
|
283
|
+
hidden: true
|
|
246
284
|
}
|
|
247
285
|
];
|
|
248
286
|
const COMMAND_NAMES = COMMANDS.filter((c) => !c.hidden).map((c) => c.name);
|
|
287
|
+
/** Every command that works, shown in help or not. Used for "Did you mean". */
|
|
288
|
+
const ALL_COMMAND_NAMES = COMMANDS.map((c) => c.name);
|
|
249
289
|
/** `conveno <command> --help`. */
|
|
250
290
|
function commandHelp(ctx, spec) {
|
|
251
291
|
const t = ctx.theme;
|
|
@@ -318,4 +358,4 @@ function parseFlags(ctx, spec, argv) {
|
|
|
318
358
|
});
|
|
319
359
|
}
|
|
320
360
|
}
|
|
321
|
-
export { parseFlags as i,
|
|
361
|
+
export { parseFlags as a, commandHelp as i, COMMANDS as n, COMMAND_NAMES as r, ALL_COMMAND_NAMES as t };
|
package/dist/bin.js
CHANGED
|
@@ -26,9 +26,9 @@ for (const stream of [process.stdout, process.stderr]) stream.on("error", (err)
|
|
|
26
26
|
});
|
|
27
27
|
try {
|
|
28
28
|
let code;
|
|
29
|
-
if (isHook) code = await (await import("./hook-entry-
|
|
29
|
+
if (isHook) code = await (await import("./hook-entry-D6zup0QV.js")).runHookEntry(argv.slice(1));
|
|
30
30
|
else {
|
|
31
|
-
const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-
|
|
31
|
+
const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-Kv31Qxro.js"), import("./runtime-xjPzIGmp.js")]);
|
|
32
32
|
code = await main(argv, createRuntimeCtx());
|
|
33
33
|
}
|
|
34
34
|
if (isHook) process.exit(code);
|
package/dist/daemon.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { homedir, hostname, userInfo } from "node:os";
|
|
3
|
-
import { t as codexAdapter } from "./dist-
|
|
4
|
-
import {
|
|
3
|
+
import { t as codexAdapter } from "./dist-MK-cK1JY.js";
|
|
4
|
+
import { An as newSessionId, C as bindAccountDevice, Ct as proofsMatch, D as clientProof, Dn as makeResult, E as clearOrchestrator, En as makeEventNotification, Et as readAncestry, F as dataPaths, Fn as socketPathTooLongMessage, I as decideAutoContinue, J as formatHookContext, L as defaultProcessIo, M as currentAccessToken, Mn as parseRelayFrame, N as daemonProof, Nn as safeParse, On as newDeviceId, Ot as readInbox, P as dataDir, Pn as sanitizeLine, Pt as requeueEntries, Qt as turnHops, R as detectRepo, Rt as resolveRecipient, S as baseName, Sn as encodeFrame, Tn as makeError, Tt as readAccountTokens, U as evaluateLiveness, V as effectiveHolder, X as generateSessionName, Xt as takeWithinChars, Yt as takeWithinBytes, Z as holderAfterDeparture, Zt as tooManyUnreadMessage, b as autoCandidates, bn as createLineDecoder, cn as EVENT_NAMES, ct as markDelivered, dn as Message, gn as RpcErrorCode, gt as pendingForInjection, hn as RelayPayload, j as createWmiWalker, jn as parseIpcRequest, kn as newMessageId, kt as readSettings, l as RESPONSE_BUDGET_BYTES, mn as PROTOCOL_VERSION, n as AccountError, nt as jwtClaim, p as ackEntries, pn as OWNER_SESSION_ID, q as formatContinuation, qt as statusAfterLiveness, r as ConvenoError, sn as DeviceId, tn as validateRename, tt as isOnline, ut as newAuthNonce, w as claimOrchestrator, wn as isSocketPathTooLong, x as autoLimitsFromEnv, xn as defaultSocketPath, xt as planSpawn, yn as SessionId } from "./dist-STNJjbNH.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-
|
|
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-CVdpCNJo.js";
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
11
|
import { DatabaseSync } from "node:sqlite";
|
|
12
12
|
// ../daemon/src/lifecycle.ts
|
|
@@ -1944,7 +1944,7 @@ var Store = class {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
};
|
|
1946
1946
|
// ../daemon/src/server.ts
|
|
1947
|
-
const DAEMON_VERSION = "0.2.0-rc.
|
|
1947
|
+
const DAEMON_VERSION = "0.2.0-rc.9";
|
|
1948
1948
|
/** A connection that has not finished the handshake by then is closed. */
|
|
1949
1949
|
const AUTH_TIMEOUT_MS = 5e3;
|
|
1950
1950
|
/** Unread messages one session may hold. */
|
|
@@ -1987,6 +1987,7 @@ var Daemon = class {
|
|
|
1987
1987
|
processIo;
|
|
1988
1988
|
platform;
|
|
1989
1989
|
wakers;
|
|
1990
|
+
settingsPath;
|
|
1990
1991
|
conns = /* @__PURE__ */ new Set();
|
|
1991
1992
|
/** Reaches the owner's other devices; set by startDaemon unless disabled. */
|
|
1992
1993
|
relay;
|
|
@@ -2019,7 +2020,7 @@ var Daemon = class {
|
|
|
2019
2020
|
startedMs;
|
|
2020
2021
|
/** When each session went offline, for the removal grace. In memory only. */
|
|
2021
2022
|
offlineSince = /* @__PURE__ */ new Map();
|
|
2022
|
-
constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS, autoLimits = autoLimitsFromEnv({}), processIo = defaultProcessIo, platform = process.platform, wakers = {}) {
|
|
2023
|
+
constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS, autoLimits = autoLimitsFromEnv({}), processIo = defaultProcessIo, platform = process.platform, wakers = {}, settingsPath) {
|
|
2023
2024
|
this.store = store;
|
|
2024
2025
|
this.token = token;
|
|
2025
2026
|
this.now = now;
|
|
@@ -2033,6 +2034,7 @@ var Daemon = class {
|
|
|
2033
2034
|
this.processIo = processIo;
|
|
2034
2035
|
this.platform = platform;
|
|
2035
2036
|
this.wakers = wakers;
|
|
2037
|
+
this.settingsPath = settingsPath;
|
|
2036
2038
|
this.deviceId = store.deviceId();
|
|
2037
2039
|
this.startedMs = now().getTime();
|
|
2038
2040
|
this.idleSince = this.startedMs;
|
|
@@ -2263,7 +2265,18 @@ var Daemon = class {
|
|
|
2263
2265
|
return r;
|
|
2264
2266
|
});
|
|
2265
2267
|
this.emitSession(row.id, "registered");
|
|
2266
|
-
|
|
2268
|
+
this.claimPreferredLead(row);
|
|
2269
|
+
return { session: this.view(this.store.getSession(row.id) ?? row) };
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* The saved preferred lead CLI takes the lead when it registers and nobody online leads. The
|
|
2273
|
+
* settings are read on each register, so a change needs no restart. It is the normal claim.
|
|
2274
|
+
*/
|
|
2275
|
+
claimPreferredLead(row) {
|
|
2276
|
+
if (this.settingsPath === void 0) return;
|
|
2277
|
+
if (readSettings(this.settingsPath).leadCli !== row.cli) return;
|
|
2278
|
+
if (this.orchestratorNow() !== null) return;
|
|
2279
|
+
this.claim(row.id);
|
|
2267
2280
|
}
|
|
2268
2281
|
async registerAsync(p) {
|
|
2269
2282
|
return this.register(p, await this.detect(p));
|
|
@@ -3047,7 +3060,7 @@ async function startDaemon(opts) {
|
|
|
3047
3060
|
close().then(() => opts.onIdleExit?.());
|
|
3048
3061
|
}, () => {
|
|
3049
3062
|
close().then(() => opts.onShutdown?.());
|
|
3050
|
-
}, daemonLog, opts.authTimeoutMs ?? 5e3, opts.autoLimits ?? autoLimitsFromEnv(process.env), processIo, opts.platform, opts.wakers ?? {});
|
|
3063
|
+
}, daemonLog, opts.authTimeoutMs ?? 5e3, opts.autoLimits ?? autoLimitsFromEnv(process.env), processIo, opts.platform, opts.wakers ?? {}, paths.settings);
|
|
3051
3064
|
daemon.removeAllOffline();
|
|
3052
3065
|
const srv = createServer((socket) => daemon.attach(socket));
|
|
3053
3066
|
server = srv;
|