@conveno/cli 0.2.0-rc.3 → 0.2.0-rc.5
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 +15 -8
- package/dist/{acp-BD19nka6.js → acp-BD7Oaerg.js} +3 -3
- package/dist/{args-DEYV4Ran.js → args-BRB8QEQM.js} +44 -7
- package/dist/bin.js +2 -2
- package/dist/daemon.js +259 -12
- package/dist/{dist-BiAm0SS8.js → dist-BPPOKmbH.js} +3 -3
- package/dist/{dist-B7znzc5U.js → dist-C8JRuLiZ.js} +1 -1
- package/dist/{dist-B3mH66Y1.js → dist-CEJ2-wxh.js} +2 -1
- package/dist/{dist-DIJhGLVn.js → dist-E3XvoT1Q.js} +1 -1
- package/dist/{dist-M9Gs7e_K.js → dist-TrWRppjR.js} +36 -6
- package/dist/{doctor-D1sP9gCl.js → doctor-CzIGTeNT.js} +3 -3
- package/dist/{hook-W7tV131z.js → hook-CLB_muZS.js} +1 -1
- package/dist/{hook-entry-CvmuMVWY.js → hook-entry-BlvSoNMm.js} +4 -4
- package/dist/hook-entry-CRDh36pe.js +1 -0
- package/dist/{main-Cf0q06gR.js → main-CsCsyq2G.js} +218 -21
- package/dist/{run-BlRhoflZ.js → run-CYH0CRbp.js} +2365 -660
- package/dist/{runtime-BPG36vYD.js → runtime-B1Pb9Qqg.js} +47 -20
- package/package.json +15 -15
- package/dist/hook-entry-B8Iiwe99.js +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @conveno/cli
|
|
2
2
|
|
|
3
|
-
Conveno
|
|
3
|
+
Conveno is a connector. It lets the AI coding CLI sessions you already use find each other, send messages and route work to the one session you pick as the lead (the code and older docs call it the orchestrator). You keep using each CLI the way you do today. This package is the `conveno` command and everything it needs, including the local daemon.
|
|
4
4
|
|
|
5
5
|
- Website: https://conveno.dev
|
|
6
6
|
- Source and issues: https://github.com/0xPixelNinja/conveno
|
|
7
|
-
- Status: pre-alpha. The local mesh works, with spawn, peek and
|
|
7
|
+
- Status: pre-alpha. The local mesh works, with spawn, peek, questions and handoff. Pro, the end-to-end encrypted relay between your machines, is in preview.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -25,6 +25,8 @@ conveno init
|
|
|
25
25
|
|
|
26
26
|
Then open two CLI sessions, for example Claude Code and Codex. In one, ask it to run `list_sessions`, then to `send` a message to the other. `conveno status` lists the sessions.
|
|
27
27
|
|
|
28
|
+
Then run `conveno` with no arguments. It opens a full-screen app (Sessions, You, New, Devices, Setup) for the keyboard and mouse: `/` searches, `?` shows the keys. Sessions can message you or ask you questions there. It raises a desktop notification when something needs you; turn that off in Setup or with `CONVENO_NOTIFY=0`, and the mouse with `CONVENO_MOUSE=0`.
|
|
29
|
+
|
|
28
30
|
`conveno uninstall` reverts what `init` did. A file that has not changed since `init` is restored byte for byte. If a CLI has rewritten it since, only Conveno's entries are removed.
|
|
29
31
|
|
|
30
32
|
## Commands
|
|
@@ -33,19 +35,24 @@ Then open two CLI sessions, for example Claude Code and Codex. In one, ask it to
|
|
|
33
35
|
|---|---|
|
|
34
36
|
| `conveno init [--with-permission-relay]` | Add the Conveno MCP server and hooks to each detected CLI. `--with-permission-relay` also adds the hook for the experimental permission relay. |
|
|
35
37
|
| `conveno uninstall` | Undo every install that has not been undone. |
|
|
36
|
-
| `conveno status` | Online sessions grouped by repo, with the
|
|
37
|
-
| `conveno
|
|
38
|
+
| `conveno status` | Online sessions grouped by repo, with the lead marked. `--all` includes offline ones. |
|
|
39
|
+
| `conveno questions [--open]` | Questions workers asked the lead (`conveno tickets` still works): id, state, who asked whom, when, and the first line. `--open` shows only those still waiting. `conveno status` ends with the open count when it is not zero. |
|
|
40
|
+
| `conveno send <to> <text...> [--urgent]` | Send a message as you to a session name or id, `lead`, or `device:name`. `-` reads the text from standard input. |
|
|
41
|
+
| `conveno rename <session> <new-name>` | Rename an online session. |
|
|
42
|
+
| `conveno lead <session>` | Make a session the lead. |
|
|
38
43
|
| `conveno answer <ticket> <text>` | Answer a ticket as yourself, no agent needed. The ticket is a full id or the start or end of one (6 characters or more). The worker gets the text as an `Answer (ticket ...)` message. For a permission request answer `allow` or `deny`. |
|
|
39
|
-
| `conveno permissions [relay on\|off [session]]` | **Experimental, off by default.** `relay on <session>` lets the
|
|
44
|
+
| `conveno permissions [relay on\|off [session]]` | **Experimental, off by default.** `relay on <session>` lets the lead allow or deny that worker's tool permission prompts (Claude Code and Codex); `relay off [session]` ends it (without a name, for every session); no arguments lists the sessions with it on. It only works for a session started with `conveno spawn` or `spawn_session`, so a session you drive yourself is refused. The command prints a warning when it turns the relay on. The first `relay on` shows a diff and adds the CLI's `PermissionRequest` hook (Claude Code, Codex) with init's backup and manifest, so `conveno uninstall` removes it; `conveno init --with-permission-relay` adds it up front. The hook does nothing until the relay is on for a session. A call outside the worker's repo, network use, credential files, elevated rights and anything Conveno cannot read with certainty always stays with the CLI's own prompt, and so does any call the lead does not answer within about 80 seconds. SECURITY.md has the threat model. |
|
|
40
45
|
| `conveno forget [<name\|pattern>...] [--offline] [--older-than <duration>] [--dry-run] [--yes]` | Remove offline sessions from the list, for example the leftovers of deleted test repos. A name is exact or a pattern where `*` matches any run of characters (quote it: `'conveno-real-*'`). `--offline` with no name means every offline session, and `--older-than 30m`, `24h` or `7d` keeps only those last seen that long ago. It lists what it will remove and asks; `--yes` skips the question, and without a terminal it exits 2 unless `--yes` is given. `--dry-run` lists and changes nothing. A running session that matches is listed as skipped and never removed. Forgetting deletes the queued messages of the session; messages it sent stay with the receivers. The daemon also forgets offline sessions whose folder has been missing for 5 minutes and that have no unread messages. |
|
|
41
|
-
| `conveno spawn <cli> [--cwd <dir>] [--name <name>] [--task <text> \| --task-file <path>] [--headless] [--yes]` | Start a worker session of `claude`, `codex`, `opencode`, `cursor`, `copilot`, `antigravity` or `grok`, and print its name once it registers. The CLI must be installed. By default the real CLI opens in a new terminal so you can watch it and take over: Windows Terminal (`wt -w 0 new-tab`, else a new console window) on Windows, Terminal.app (iTerm2 when it is your terminal) on macOS, and on Linux a new tmux window when you are inside tmux, else the first of `x-terminal-emulator`, `gnome-terminal`, `konsole`, `kitty`, `wezterm`, `alacritty` and `xterm`. With none of those it exits 1 and suggests `--headless`. `--headless` runs the CLI's documented one-shot mode (`claude -p`, `codex exec`, `opencode run`, `agy -p` and so on) detached, with its output in `<data dir>/logs/spawn/<name>.log` (readable by you only); it needs a task, runs it and exits, and the session still registers and shows in `conveno status`. The first task is the CLI's initial prompt argument; for a CLI with none (Antigravity) it is sent as a Conveno message once the session registers, which needs the command to run inside an agent session. `--name` sets the session name (a taken or reserved one is refused); otherwise the usual `<cli>@<repo>-<n>` name is used. `--cwd` defaults to the current folder, which must be inside your home folder; an explicit `--cwd` can be anywhere. It asks first and `--yes` skips the question; without a terminal it exits 2 unless `--yes` is given. At most 8 spawned sessions run at once (`CONVENO_SPAWN_MAX` changes that), and a spawned session cannot spawn more than 3 levels deep. Run from inside an agent session (its shell tool, say), the new session's `spawnedBy` is that session. A task is at most 16000 characters; `--task-file` reads one from a file. |
|
|
46
|
+
| `conveno spawn <cli> [--cwd <dir>] [--name <name>] [--task <text> \| --task-file <path>] [--headless] [--yes]` | Start a worker session of `claude`, `codex`, `opencode`, `cursor`, `copilot`, `antigravity` or `grok`, and print its name once it registers. The CLI must be installed. `--mode window\|background\|once` picks how it runs (window is the default; background is `--acp`; once is `--headless --one-shot`) and wins over those flags. By default the real CLI opens in a new terminal so you can watch it and take over: Windows Terminal (`wt -w 0 new-tab`, else a new console window) on Windows, Terminal.app (iTerm2 when it is your terminal) on macOS, and on Linux a new tmux window when you are inside tmux, else the first of `x-terminal-emulator`, `gnome-terminal`, `konsole`, `kitty`, `wezterm`, `alacritty` and `xterm`. With none of those it exits 1 and suggests `--headless`. `--headless` runs the CLI's documented one-shot mode (`claude -p`, `codex exec`, `opencode run`, `agy -p` and so on) detached, with its output in `<data dir>/logs/spawn/<name>.log` (readable by you only); it needs a task, runs it and exits, and the session still registers and shows in `conveno status`. The first task is the CLI's initial prompt argument; for a CLI with none (Antigravity) it is sent as a Conveno message once the session registers, which needs the command to run inside an agent session. `--name` sets the session name (a taken or reserved one is refused); otherwise the usual `<cli>@<repo>-<n>` name is used. `--cwd` defaults to the current folder, which must be inside your home folder; an explicit `--cwd` can be anywhere. It asks first and `--yes` skips the question; without a terminal it exits 2 unless `--yes` is given. At most 8 spawned sessions run at once (`CONVENO_SPAWN_MAX` changes that), and a spawned session cannot spawn more than 3 levels deep. Run from inside an agent session (its shell tool, say), the new session's `spawnedBy` is that session. A task is at most 16000 characters; `--task-file` reads one from a file. |
|
|
42
47
|
| `conveno spawn <cli> --acp [--allow <kinds>] [--task <text>]` | Run the worker through the CLI's Agent Client Protocol server, in the background, with `conveno acp-host` driving it. The ACP commands: `claude-agent-acp` (install `@agentclientprotocol/claude-agent-acp`), `codex-acp` (install `@agentclientprotocol/codex-acp`), `opencode acp`, `agent acp` (Cursor), `copilot --acp --stdio`, `agy acp` and `grok agent stdio`; a missing one is an error that says what to install. For Claude Code and Codex, `conveno init` can allow running the adapter with `npx -y <package>@<pinned version>`, and `CONVENO_ACP_CODEX_CMD` / `CONVENO_ACP_CLAUDE_CMD` replace the command. The task is the first prompt and is optional. The worker keeps running: each message sent to it becomes its next prompt at once when it is idle, or when its current turn ends, under the auto-mode limit. A tool call that needs approval is denied unless `--allow` covers it: comma-separated ACP tool kinds (`read`, `edit`, `delete`, `move`, `search`, `execute`, `think`, `fetch`, `switch_mode`, `other`, or `*`), each optionally with `:` and a title glob (`execute:npm test*`). Allowed calls are answered "allow once", never "always". Denials are reported to the spawning session after the turn. `--headless` picks ACP when the CLI's ACP server is installed; `--one-shot` keeps the one-shot mode. The host's log is `<data dir>/logs/spawn/<name>.log`. See `packages/protocol/PROTOCOL.md`, section 6.8. |
|
|
43
48
|
| `conveno attach <worker> [--lines <n>] [--no-follow]` | Print an ACP worker's recent prompts, answers, tool calls and permission answers, and follow new ones until it stops or you press Ctrl+C. Read-only. |
|
|
44
49
|
| `conveno stop <worker>` | Stop a background worker. An ACP worker sends `session/cancel` for a running turn, ends its CLI and the processes it started, tells the spawning session why, and goes offline. A one-shot `--headless` run is ended. A worker in a terminal is yours to close. |
|
|
45
|
-
| `conveno auto [on\|off\|resume] [<session>]`, `conveno auto limit <n\|default> [<session>]` | Auto mode for a session: waiting messages become its next prompt when its turn ends, and an idle Claude Code or OpenCode session is woken. Without a name it changes the session it is typed in; without arguments it lists the sessions. `resume` lifts a pause by the limit: 20 automatic turns per rolling hour, and a chain of sessions answering each other stops after 20 automatic turns with no person in between (`limit` changes both for one session). The
|
|
50
|
+
| `conveno auto [on\|off\|resume] [<session>]`, `conveno auto limit <n\|default> [<session>]` | Auto mode for a session: waiting messages become its next prompt when its turn ends, and an idle Claude Code or OpenCode session is woken. Without a name it changes the session it is typed in; without arguments it lists the sessions. `resume` lifts a pause by the limit: 20 automatic turns per rolling hour, and a chain of sessions answering each other stops after 20 automatic turns with no person in between (`limit` changes both for one session). The lead may resume a session once per hour; the owner any time. See `packages/protocol/PROTOCOL.md`, section 6.7. |
|
|
46
51
|
| `conveno peek <session> [-n 10] [--raw-json]` | Read the last turns (prompts, replies, tool calls) of another session on this machine, with secrets redacted on a best-effort basis. `-n` is 1 to 50. Works for Claude Code, Codex, OpenCode, Copilot and Grok, and for any worker started with `--acp`; Cursor and Antigravity sessions otherwise answer that peek is not supported yet. `--raw-json` prints the daemon's answer. |
|
|
47
52
|
| `conveno peek on\|off [session]` | Allow or stop other sessions reading yours. With no session it covers every session online now. The daemon log records each peek (who, whom, how many turns), never the text. |
|
|
48
53
|
| `conveno doctor [--cli <list>]` | Check each CLI and the daemon, and say which delivery works for each: next turn, end of turn, idle wake, or inbox only. `--cli claude,codex` checks only those CLIs, so problems in the others do not count. |
|
|
54
|
+
| `conveno devices [pair\|join\|revoke\|rename\|accept\|reset]` | Pro. List your devices, or pair a new machine: `pair` on one device and `join` on the new one at the same time, then type the 8-digit code each screen shows. `revoke` removes a device for good. Needs a Pro login on both. |
|
|
55
|
+
| `conveno relay status` | Show the relay connection. |
|
|
49
56
|
| `conveno login [--no-browser]` | Sign in to your Conveno account for Pro. Shows a code and a link, opens the browser, and waits for you to approve the code. The tokens go to `account.json` in the data dir, readable by you only. The local mesh does not need an account. |
|
|
50
57
|
| `conveno logout` | Sign out on the server and delete the saved tokens. |
|
|
51
58
|
| `conveno account` | Show your plan and trial. |
|
|
@@ -71,7 +78,7 @@ Vendors change config and hook formats without notice. `conveno doctor` compares
|
|
|
71
78
|
|
|
72
79
|
## How it works
|
|
73
80
|
|
|
74
|
-
Each CLI session starts its own MCP server through `conveno mcp`. The servers talk to one small daemon on your machine, which keeps the session list, the mailboxes and the routing. The daemon listens on a local socket and nothing leaves your machine. Messages from other sessions reach an agent labelled as data from a peer, not as instructions from you.
|
|
81
|
+
Each CLI session starts its own MCP server through `conveno mcp`. The servers talk to one small daemon on your machine, which keeps the session list, the mailboxes and the routing. The daemon listens on a local socket and, without Pro, nothing leaves your machine. With Pro, end-to-end encrypted envelopes go through `relay.conveno.dev` to your other machines. The relay sees device names, public keys, routing metadata and sizes, never message content. Conveno sends no telemetry. Messages from other sessions reach an agent labelled as data from a peer, not as instructions from you.
|
|
75
82
|
|
|
76
83
|
Conveno never reads, stores or forwards a provider login token or credential file. It works with the official CLIs only, under your own login or API key.
|
|
77
84
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { i as stopRequestPath, n as parseTurns, r as runAcpHostFromFile, t as killProcessTree } from "./dist-
|
|
3
|
-
import {
|
|
4
|
-
import { i as parseFlags, l as fail, o as cmd, t as COMMANDS, u as localStamp } from "./args-
|
|
2
|
+
import { i as stopRequestPath, n as parseTurns, r as runAcpHostFromFile, t as killProcessTree } from "./dist-BPPOKmbH.js";
|
|
3
|
+
import { Gt as spawnRecordPath, Nt as readSpawnRecord, m as acpTurnsPath } from "./dist-TrWRppjR.js";
|
|
4
|
+
import { i as parseFlags, l as fail, o as cmd, t as COMMANDS, u as localStamp } from "./args-BRB8QEQM.js";
|
|
5
5
|
// src/acp.ts
|
|
6
6
|
/** How long `conveno stop` waits for a worker to end by itself before it ends the process tree. */
|
|
7
7
|
const STOP_WAIT_MS = 1e4;
|
|
@@ -154,19 +154,50 @@ const COMMANDS = [
|
|
|
154
154
|
} }
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
name: "
|
|
158
|
-
usage: "conveno
|
|
159
|
-
summary: "List questions workers asked the
|
|
157
|
+
name: "questions",
|
|
158
|
+
usage: "conveno questions [--open]",
|
|
159
|
+
summary: "List questions workers asked the lead",
|
|
160
160
|
flags: { open: {
|
|
161
161
|
type: "boolean",
|
|
162
|
-
help: "Only
|
|
162
|
+
help: "Only questions that still wait for an answer"
|
|
163
163
|
} },
|
|
164
|
-
notes: ["Workers
|
|
164
|
+
notes: ["Workers ask with the ask tool. Answer one with conveno answer.", "The old name, conveno tickets, still works."]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "send",
|
|
168
|
+
usage: "conveno send <to> <text...> [--urgent]",
|
|
169
|
+
summary: "Send a message to a session as you",
|
|
170
|
+
flags: { urgent: {
|
|
171
|
+
type: "boolean",
|
|
172
|
+
help: "Mark the message urgent"
|
|
173
|
+
} },
|
|
174
|
+
notes: [
|
|
175
|
+
"<to> is a session name or id, lead, or device:name for a session on another device.",
|
|
176
|
+
"Give - as the text to read it from standard input.",
|
|
177
|
+
"The session sees the message as coming from you."
|
|
178
|
+
],
|
|
179
|
+
positionals: true
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "rename",
|
|
183
|
+
usage: "conveno rename <session> <new-name>",
|
|
184
|
+
summary: "Give an online session a new name",
|
|
185
|
+
flags: {},
|
|
186
|
+
notes: ["<session> is a name or id. Names use lowercase letters, digits and . _ @ -."],
|
|
187
|
+
positionals: true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "lead",
|
|
191
|
+
usage: "conveno lead <session>",
|
|
192
|
+
summary: "Make a session the lead",
|
|
193
|
+
flags: {},
|
|
194
|
+
notes: ["The lead gets the questions workers ask and the messages sent to lead.", "<session> is a name or id. The old lead is told."],
|
|
195
|
+
positionals: true
|
|
165
196
|
},
|
|
166
197
|
{
|
|
167
198
|
name: "answer",
|
|
168
199
|
usage: "conveno answer <ticket> <text>",
|
|
169
|
-
summary: "Answer a worker's
|
|
200
|
+
summary: "Answer a worker's question yourself",
|
|
170
201
|
flags: {},
|
|
171
202
|
notes: ["The ticket is a full id, or the end or start of one (at least 6 characters).", "The worker gets the answer as a message. For a permission request, answer allow or deny."],
|
|
172
203
|
positionals: true
|
|
@@ -228,6 +259,11 @@ const COMMANDS = [
|
|
|
228
259
|
usage: "conveno spawn <cli> [options]",
|
|
229
260
|
summary: "Start a worker session of any CLI",
|
|
230
261
|
flags: {
|
|
262
|
+
mode: {
|
|
263
|
+
type: "string",
|
|
264
|
+
value: "window|background|once",
|
|
265
|
+
help: "window: a terminal you can watch (default). background: kept running over ACP. once: one task, then it ends"
|
|
266
|
+
},
|
|
231
267
|
cwd: {
|
|
232
268
|
type: "string",
|
|
233
269
|
value: "<dir>",
|
|
@@ -272,7 +308,8 @@ const COMMANDS = [
|
|
|
272
308
|
}
|
|
273
309
|
},
|
|
274
310
|
notes: [
|
|
275
|
-
"By default the real CLI opens in a new terminal, so you can watch it and take over.",
|
|
311
|
+
"By default (--mode window) the real CLI opens in a new terminal, so you can watch it and take over.",
|
|
312
|
+
"--mode background is --acp, and --mode once is --headless --one-shot. --mode wins over those flags.",
|
|
276
313
|
"--acp starts the CLI's Agent Client Protocol server in the background. Each message sent to",
|
|
277
314
|
"the worker becomes its next prompt: right away when it is idle, else when its turn ends.",
|
|
278
315
|
"Tool calls that need approval are denied unless --allow covers them. Follow it with",
|
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-CRDh36pe.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-CsCsyq2G.js"), import("./runtime-B1Pb9Qqg.js")]);
|
|
32
32
|
code = await main(argv, createRuntimeCtx());
|
|
33
33
|
}
|
|
34
34
|
if (isHook) process.exit(code);
|
package/dist/daemon.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { homedir, hostname, userInfo } from "node:os";
|
|
3
|
-
import { $t as
|
|
3
|
+
import { $t as toIso, A as currentAccessToken, At as readHeadLine, B as effectiveHolder, Bn as newDeviceId, Bt as resolveRecipient, C as claimOrchestrator, Ct as planSpawn, Dt as readAccountTokens, E as clientProof, F as defaultProcessIo, Fn as isLeadAlias, Gn as parseRelayFrame, H as entriesNewestFirst, Hn as newSessionId, I as describeToolCall, In as isSocketPathTooLong, Jn as socketPathTooLongMessage, Jt as statusAfterLiveness, Kn as safeParse, L as detectRepo, Ln as makeError, M as dataDir, Mn as defaultSocketPath, N as dataPaths, Nn as encodeFrame, Ot as readAncestry, P as decideAutoContinue, Q as holderAfterDeparture, Qt as takeWithinBytes, Rn as makeEventNotification, S as bindAccountDevice, Sn as RpcErrorCode, T as classifyPermission, Tt as proofsMatch, U as evaluateLiveness, Un as newTicketId, Vn as newMessageId, Wn as parseIpcRequest, Wt as samePath, Xt as tailJsonl, Z as generateSessionName, _ as asString, _n as ORCHESTRATOR_ALIAS, at as jwtClaim, b as autoLimitsFromEnv, bn as PROTOCOL_VERSION, ct as markDelivered, d as ackEntries, dn as EVENT_NAMES, dt as notFound, en as tooManyUnreadMessage, ft as notifyDesktopWanted, hn as Message, in as validateRename, j as daemonProof, jn as createLineDecoder, jt as readInbox, k as createWmiWalker, kn as Ticket, lt as nameMatchesPattern, mn as HUMAN_ANSWERER, n as AccountError, nn as unsupportedTranscript, p as acpTranscript, qn as sanitizeLine, r as ConvenoError, rt as isRecord, s as RESPONSE_BUDGET_BYTES, tn as turnHops, tt as isOnline, un as DeviceId, ut as newAuthNonce, vn as OWNER_SESSION_ID, vt as pauseLabel, wn as SessionId, x as baseName, xn as RelayPayload, y as autoCandidates, yn as PERMISSION_ANSWERS, yt as pendingForInjection, zn as makeResult } from "./dist-TrWRppjR.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";
|
|
7
|
-
import { dirname, join, posix, win32 } from "node:path";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { delimiter, dirname, join, posix, win32 } from "node:path";
|
|
8
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
9
|
+
import { n as redactWithReport, t as redact } from "./dist-DcmKjrmu.js";
|
|
10
|
+
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-E3XvoT1Q.js";
|
|
11
11
|
import { DatabaseSync } from "node:sqlite";
|
|
12
|
-
import { c as claudeTranscript, i as codexTranscript, t as openCodeTranscript } from "./dist-
|
|
12
|
+
import { c as claudeTranscript, i as codexTranscript, t as openCodeTranscript } from "./dist-C8JRuLiZ.js";
|
|
13
13
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
14
14
|
// ../daemon/src/lifecycle.ts
|
|
15
15
|
/** Thrown when another Conveno daemon already owns the lock file or answers on the socket. */
|
|
@@ -160,6 +160,196 @@ function createDaemonLog(path, opts = {}) {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
+
/** The OS command is killed after this long. */
|
|
164
|
+
const NOTIFY_TIMEOUT_MS = 5e3;
|
|
165
|
+
const NOTIFY_TITLE = "Conveno";
|
|
166
|
+
const noopNotifier = {
|
|
167
|
+
notify() {},
|
|
168
|
+
close() {}
|
|
169
|
+
};
|
|
170
|
+
const CONTROL = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g;
|
|
171
|
+
/** One line, no control characters, trimmed. */
|
|
172
|
+
function flatten(s) {
|
|
173
|
+
return s.replace(CONTROL, " ").replace(/\s+/g, " ").trim();
|
|
174
|
+
}
|
|
175
|
+
function clip$2(s, max) {
|
|
176
|
+
const chars = [...s];
|
|
177
|
+
return chars.length > max ? `${chars.slice(0, max - 3).join("")}...` : s;
|
|
178
|
+
}
|
|
179
|
+
/** The body for one item: "name asks: first line..." with secrets removed. */
|
|
180
|
+
function bodyFor(item) {
|
|
181
|
+
const verb = item.kind === "question" ? "asks" : item.kind === "permission" ? "wants to" : "says";
|
|
182
|
+
const name = clip$2(flatten(redact(item.from)), 40) || "A session";
|
|
183
|
+
const first = clip$2(flatten(redact(item.text)), 80);
|
|
184
|
+
return first ? `${name} ${verb}: ${first}` : `${name} ${verb === "wants to" ? "needs you" : verb}`;
|
|
185
|
+
}
|
|
186
|
+
/** The body for several things at once. */
|
|
187
|
+
function batchBody(n) {
|
|
188
|
+
return `${n} things need you`;
|
|
189
|
+
}
|
|
190
|
+
/** Escape a string for an AppleScript string literal. */
|
|
191
|
+
function appleScriptString(s) {
|
|
192
|
+
return `"${s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
193
|
+
}
|
|
194
|
+
/** Escape text for XML content. */
|
|
195
|
+
function xmlEscape(s) {
|
|
196
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
197
|
+
}
|
|
198
|
+
/** The PowerShell script for a toast. Text is XML-escaped, then placed in a single-quoted string. */
|
|
199
|
+
function toastScript(title, body) {
|
|
200
|
+
return [
|
|
201
|
+
"$ErrorActionPreference = 'Stop'",
|
|
202
|
+
"[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null",
|
|
203
|
+
"[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null",
|
|
204
|
+
"$appId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe'",
|
|
205
|
+
"$doc = New-Object Windows.Data.Xml.Dom.XmlDocument",
|
|
206
|
+
`$doc.LoadXml(${`'${`<toast><visual><binding template="ToastGeneric"><text>${xmlEscape(title)}</text><text>${xmlEscape(body)}</text></binding></visual></toast>`.replace(/['\u2018\u2019\u201A\u201B]/g, (q) => q + q)}'`})`,
|
|
207
|
+
"$toast = [Windows.UI.Notifications.ToastNotification]::new($doc)",
|
|
208
|
+
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($appId).Show($toast)"
|
|
209
|
+
].join("\n");
|
|
210
|
+
}
|
|
211
|
+
/** The command that shows a notification on a platform. */
|
|
212
|
+
function commandFor(platform, title, body) {
|
|
213
|
+
const t = flatten(title);
|
|
214
|
+
const b = flatten(body);
|
|
215
|
+
if (platform === "darwin") return {
|
|
216
|
+
cmd: "osascript",
|
|
217
|
+
args: ["-e", `display notification ${appleScriptString(b)} with title ${appleScriptString(t)}`]
|
|
218
|
+
};
|
|
219
|
+
if (platform === "win32") return {
|
|
220
|
+
cmd: "powershell.exe",
|
|
221
|
+
args: [
|
|
222
|
+
"-NoProfile",
|
|
223
|
+
"-NonInteractive",
|
|
224
|
+
"-WindowStyle",
|
|
225
|
+
"Hidden",
|
|
226
|
+
"-EncodedCommand",
|
|
227
|
+
Buffer.from(toastScript(t, b), "utf16le").toString("base64")
|
|
228
|
+
]
|
|
229
|
+
};
|
|
230
|
+
return {
|
|
231
|
+
cmd: "notify-send",
|
|
232
|
+
args: [
|
|
233
|
+
"--app-name=Conveno",
|
|
234
|
+
"--",
|
|
235
|
+
xmlEscape(t),
|
|
236
|
+
xmlEscape(b)
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function truthy(v) {
|
|
241
|
+
return v !== void 0 && v !== "" && ![
|
|
242
|
+
"0",
|
|
243
|
+
"false",
|
|
244
|
+
"no",
|
|
245
|
+
"off"
|
|
246
|
+
].includes(v.toLowerCase());
|
|
247
|
+
}
|
|
248
|
+
function findOnPath(cmd, env) {
|
|
249
|
+
for (const dir of (env.PATH ?? "").split(delimiter)) if (dir && existsSync(join(dir, cmd))) return true;
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Build the notifier the daemon uses. It stays quiet under CI and tests unless `run` is given,
|
|
254
|
+
* when the owner turned it off, and on a Linux box with no display or no notify-send.
|
|
255
|
+
*/
|
|
256
|
+
function createNotifier(opts) {
|
|
257
|
+
const env = opts.env ?? process.env;
|
|
258
|
+
const platform = opts.platform ?? process.platform;
|
|
259
|
+
const now = opts.now ?? Date.now;
|
|
260
|
+
const windowMs = opts.windowMs ?? 1e4;
|
|
261
|
+
const onPath = opts.onPath ?? ((c) => findOnPath(c, env));
|
|
262
|
+
let reported = false;
|
|
263
|
+
const fail = (what, e) => {
|
|
264
|
+
if (reported) return;
|
|
265
|
+
reported = true;
|
|
266
|
+
try {
|
|
267
|
+
opts.onError?.(what, e);
|
|
268
|
+
} catch {}
|
|
269
|
+
};
|
|
270
|
+
const available = () => {
|
|
271
|
+
if (opts.run === void 0 && (truthy(env.CI) || truthy(env.VITEST))) return false;
|
|
272
|
+
if (platform === "linux") {
|
|
273
|
+
if (!env.DISPLAY && !env.WAYLAND_DISPLAY) return false;
|
|
274
|
+
if (!onPath("notify-send")) return false;
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
};
|
|
278
|
+
const spawnIt = (c) => {
|
|
279
|
+
let child;
|
|
280
|
+
try {
|
|
281
|
+
child = spawn(c.cmd, c.args, {
|
|
282
|
+
detached: true,
|
|
283
|
+
stdio: "ignore",
|
|
284
|
+
windowsHide: true
|
|
285
|
+
});
|
|
286
|
+
} catch (e) {
|
|
287
|
+
fail("could not start the notification command", e);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
child.on("error", (e) => fail("the notification command failed", e));
|
|
291
|
+
const timer = setTimeout(() => {
|
|
292
|
+
try {
|
|
293
|
+
child.kill();
|
|
294
|
+
} catch {}
|
|
295
|
+
}, NOTIFY_TIMEOUT_MS);
|
|
296
|
+
timer.unref();
|
|
297
|
+
child.on("exit", () => clearTimeout(timer));
|
|
298
|
+
child.unref();
|
|
299
|
+
};
|
|
300
|
+
const run = opts.run ?? spawnIt;
|
|
301
|
+
let lastAt = Number.NEGATIVE_INFINITY;
|
|
302
|
+
let pending = [];
|
|
303
|
+
let timer;
|
|
304
|
+
const show = (body) => {
|
|
305
|
+
lastAt = now();
|
|
306
|
+
try {
|
|
307
|
+
run(commandFor(platform, NOTIFY_TITLE, body));
|
|
308
|
+
} catch (e) {
|
|
309
|
+
fail("could not show a notification", e);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const flush = () => {
|
|
313
|
+
timer = void 0;
|
|
314
|
+
const items = pending;
|
|
315
|
+
pending = [];
|
|
316
|
+
if (items.length === 0) return;
|
|
317
|
+
if (!notifyDesktopWanted(opts.settingsPath, env) || !available()) return;
|
|
318
|
+
show(items.length === 1 ? bodyFor(items[0]) : batchBody(items.length));
|
|
319
|
+
};
|
|
320
|
+
return {
|
|
321
|
+
notify(item) {
|
|
322
|
+
try {
|
|
323
|
+
if (!notifyDesktopWanted(opts.settingsPath, env) || !available()) return;
|
|
324
|
+
const wait = lastAt + windowMs - now();
|
|
325
|
+
if (wait <= 0 && pending.length === 0) {
|
|
326
|
+
show(bodyFor(item));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
pending.push(item);
|
|
330
|
+
if (!timer) {
|
|
331
|
+
timer = setTimeout(flush, Math.max(0, wait));
|
|
332
|
+
timer.unref();
|
|
333
|
+
}
|
|
334
|
+
} catch (e) {
|
|
335
|
+
fail("could not queue a notification", e);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
close() {
|
|
339
|
+
if (timer) clearTimeout(timer);
|
|
340
|
+
timer = void 0;
|
|
341
|
+
pending = [];
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/** The text of a message to the owner, for the notification line. */
|
|
346
|
+
function ownerNoticeText(body) {
|
|
347
|
+
const b = body ?? {};
|
|
348
|
+
if (typeof b.text === "string") return b.text;
|
|
349
|
+
if (typeof b.question === "string") return b.question;
|
|
350
|
+
if (typeof b.goal === "string") return b.goal;
|
|
351
|
+
return "";
|
|
352
|
+
}
|
|
163
353
|
// ../daemon/src/peek.ts
|
|
164
354
|
/** Longest text of one turn that is returned. A tool output is cut to this. */
|
|
165
355
|
const PEEK_TURN_MAX_CHARS = 4e3;
|
|
@@ -2170,6 +2360,26 @@ var Store = class {
|
|
|
2170
2360
|
if (n > 0) this.run("DELETE FROM messages WHERE id NOT IN (SELECT message_id FROM mailbox)");
|
|
2171
2361
|
return n;
|
|
2172
2362
|
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Messages a session received (it has a mailbox entry) or sent, newest first, optionally only
|
|
2365
|
+
* those older than `before`. Message ids are ULIDs, so id order is time order.
|
|
2366
|
+
*/
|
|
2367
|
+
messagesOf(sessionId, limit, before) {
|
|
2368
|
+
return this.all(`SELECT m.json FROM messages m
|
|
2369
|
+
WHERE (m.id IN (SELECT message_id FROM mailbox WHERE session_id = ?)
|
|
2370
|
+
OR json_extract(m.json, '$.from') = ?)
|
|
2371
|
+
${before ? "AND m.id < ?" : ""}
|
|
2372
|
+
ORDER BY m.id DESC LIMIT ?`, ...before ? [
|
|
2373
|
+
sessionId,
|
|
2374
|
+
sessionId,
|
|
2375
|
+
before,
|
|
2376
|
+
limit
|
|
2377
|
+
] : [
|
|
2378
|
+
sessionId,
|
|
2379
|
+
sessionId,
|
|
2380
|
+
limit
|
|
2381
|
+
]).map((r) => Message.parse(JSON.parse(r.json)));
|
|
2382
|
+
}
|
|
2173
2383
|
/** Mailbox entries of one session, optionally limited to the given states or message ids. */
|
|
2174
2384
|
entries(sessionId, filter = {}) {
|
|
2175
2385
|
let sql = `SELECT m.json, b.state, b.queued_at, b.delivered_at, b.read_at, b.acked_at, b.hops
|
|
@@ -2206,6 +2416,11 @@ const clip = (text, max) => {
|
|
|
2206
2416
|
const flat = sanitizeLine(text);
|
|
2207
2417
|
return flat.length > max ? `${flat.slice(0, max - 3)}...` : flat;
|
|
2208
2418
|
};
|
|
2419
|
+
/** The "Tool: ..." and "Command: ..." lines of a permission request, as one short line. */
|
|
2420
|
+
function permissionLine(question) {
|
|
2421
|
+
const tool = /^Tool: (.*)$/m.exec(question)?.[1];
|
|
2422
|
+
return `run ${/^Command: (.*)$/m.exec(question)?.[1] ?? tool ?? "a tool"}`;
|
|
2423
|
+
}
|
|
2209
2424
|
/** Questions to the orchestrator, answers back to the asker, and the permission relay. */
|
|
2210
2425
|
var TicketService = class {
|
|
2211
2426
|
host;
|
|
@@ -2219,12 +2434,12 @@ var TicketService = class {
|
|
|
2219
2434
|
const asker = this.requireOnline(p.sessionId);
|
|
2220
2435
|
const toOwner = p.to === "you" || p.to === OWNER_SESSION_ID;
|
|
2221
2436
|
const target = toOwner ? OWNER : this.host.resolve(p.to ?? "orchestrator");
|
|
2222
|
-
if (target.id === asker.id) fail(RpcErrorCode.InvalidParams, p.to === void 0 || p.to
|
|
2437
|
+
if (target.id === asker.id) fail(RpcErrorCode.InvalidParams, p.to === void 0 || isLeadAlias(p.to) ? "You are the lead, so there is no one above you to ask. Ask the user directly." : "A session cannot ask itself. Name another session in `to`.");
|
|
2223
2438
|
return this.open(asker, target, {
|
|
2224
2439
|
kind: "question",
|
|
2225
2440
|
question: p.question,
|
|
2226
2441
|
options: p.options,
|
|
2227
|
-
toRef: toOwner ? "you" : p.to === void 0 || p.to
|
|
2442
|
+
toRef: toOwner ? "you" : p.to === void 0 || isLeadAlias(p.to) ? ORCHESTRATOR_ALIAS : target.id,
|
|
2228
2443
|
ttlMs: TICKET_TTL_MS
|
|
2229
2444
|
});
|
|
2230
2445
|
}
|
|
@@ -2269,6 +2484,11 @@ var TicketService = class {
|
|
|
2269
2484
|
event: "ticket.created",
|
|
2270
2485
|
data: { ticket }
|
|
2271
2486
|
}, target.id);
|
|
2487
|
+
if (target.id === OWNER_SESSION_ID || t.kind === "permission") this.host.notify({
|
|
2488
|
+
from: asker.name,
|
|
2489
|
+
text: t.kind === "permission" ? permissionLine(t.question) : t.question,
|
|
2490
|
+
kind: t.kind === "permission" ? "permission" : "question"
|
|
2491
|
+
});
|
|
2272
2492
|
return { ticket };
|
|
2273
2493
|
}
|
|
2274
2494
|
answer(p, client) {
|
|
@@ -2447,7 +2667,7 @@ var TicketService = class {
|
|
|
2447
2667
|
}
|
|
2448
2668
|
};
|
|
2449
2669
|
// ../daemon/src/server.ts
|
|
2450
|
-
const DAEMON_VERSION = "0.2.0-rc.
|
|
2670
|
+
const DAEMON_VERSION = "0.2.0-rc.5";
|
|
2451
2671
|
/** A connection that has not finished the handshake by then is closed. */
|
|
2452
2672
|
const AUTH_TIMEOUT_MS = 5e3;
|
|
2453
2673
|
/** Unread messages one session may hold. */
|
|
@@ -2497,6 +2717,7 @@ var Daemon = class {
|
|
|
2497
2717
|
transcripts;
|
|
2498
2718
|
transcriptEnv;
|
|
2499
2719
|
processIo;
|
|
2720
|
+
notifier;
|
|
2500
2721
|
conns = /* @__PURE__ */ new Set();
|
|
2501
2722
|
/** Reaches the owner's other devices; set by startDaemon unless disabled. */
|
|
2502
2723
|
relay;
|
|
@@ -2511,7 +2732,7 @@ var Daemon = class {
|
|
|
2511
2732
|
home: homedir(),
|
|
2512
2733
|
platform: process.platform,
|
|
2513
2734
|
env: process.env
|
|
2514
|
-
}, processIo = defaultProcessIo) {
|
|
2735
|
+
}, processIo = defaultProcessIo, notifier = noopNotifier) {
|
|
2515
2736
|
this.store = store;
|
|
2516
2737
|
this.token = token;
|
|
2517
2738
|
this.now = now;
|
|
@@ -2526,6 +2747,7 @@ var Daemon = class {
|
|
|
2526
2747
|
this.transcripts = transcripts;
|
|
2527
2748
|
this.transcriptEnv = transcriptEnv;
|
|
2528
2749
|
this.processIo = processIo;
|
|
2750
|
+
this.notifier = notifier;
|
|
2529
2751
|
this.deviceId = store.deviceId();
|
|
2530
2752
|
this.startedMs = now().getTime();
|
|
2531
2753
|
this.idleSince = this.startedMs;
|
|
@@ -2537,10 +2759,14 @@ var Daemon = class {
|
|
|
2537
2759
|
holder: () => effectiveHolder(store.holder(), this.named(store.allSessions()))?.id ?? null,
|
|
2538
2760
|
queue: (message, to, limit) => this.queueMessage(message, to, limit),
|
|
2539
2761
|
emit: (payload, onlyTo) => this.emit(payload, onlyTo),
|
|
2540
|
-
daemonSender: DAEMON_SENDER_ID
|
|
2762
|
+
daemonSender: DAEMON_SENDER_ID,
|
|
2763
|
+
notify: (item) => this.notifier.notify(item)
|
|
2541
2764
|
});
|
|
2542
2765
|
}
|
|
2543
2766
|
iso = () => this.now().toISOString();
|
|
2767
|
+
closeNotifier() {
|
|
2768
|
+
this.notifier.close();
|
|
2769
|
+
}
|
|
2544
2770
|
attach(socket) {
|
|
2545
2771
|
const conn = {
|
|
2546
2772
|
socket,
|
|
@@ -2633,6 +2859,7 @@ var Daemon = class {
|
|
|
2633
2859
|
case "daemon.shutdown": return { ok: true };
|
|
2634
2860
|
case "orchestrator.claim": return this.claim(req.params.sessionId);
|
|
2635
2861
|
case "message.send": return this.sendMessage(req.params);
|
|
2862
|
+
case "message.history": return this.messageHistory(conn, req.params);
|
|
2636
2863
|
case "owner.inbox": return this.ownerInbox(conn, req.params);
|
|
2637
2864
|
case "owner.ack": return this.ownerAck(conn, req.params);
|
|
2638
2865
|
case "owner.send": return this.ownerSend(conn, req.params);
|
|
@@ -3105,6 +3332,11 @@ var Daemon = class {
|
|
|
3105
3332
|
id: OWNER_SESSION_ID,
|
|
3106
3333
|
name: "you"
|
|
3107
3334
|
}, true));
|
|
3335
|
+
this.notifier.notify({
|
|
3336
|
+
from: sender.name,
|
|
3337
|
+
text: ownerNoticeText(message.body),
|
|
3338
|
+
kind: "message"
|
|
3339
|
+
});
|
|
3108
3340
|
return {
|
|
3109
3341
|
message,
|
|
3110
3342
|
delivery: "inbox",
|
|
@@ -3151,6 +3383,16 @@ var Daemon = class {
|
|
|
3151
3383
|
this.requireCli(conn, "read the owner's messages");
|
|
3152
3384
|
return this.readInboxOf(OWNER_SESSION_ID, p.unreadOnly, p.limit, true);
|
|
3153
3385
|
}
|
|
3386
|
+
messageHistory(conn, p) {
|
|
3387
|
+
this.requireCli(conn, "read a session's message history");
|
|
3388
|
+
if (!(p.session === OWNER_SESSION_ID || this.store.getSession(p.session) !== void 0 || (this.relay?.remoteSessions?.() ?? []).some((s) => s.id === p.session))) throw new ConvenoError(RpcErrorCode.NotFound, `No session with id ${p.session}.`);
|
|
3389
|
+
const rows = this.store.messagesOf(p.session, p.limit + 1, p.before);
|
|
3390
|
+
const more = rows.length > p.limit;
|
|
3391
|
+
return {
|
|
3392
|
+
messages: rows.slice(0, p.limit).reverse(),
|
|
3393
|
+
more
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3154
3396
|
ownerAck(conn, p) {
|
|
3155
3397
|
this.requireCli(conn, "mark the owner's messages as handled");
|
|
3156
3398
|
return this.ackFor(OWNER_SESSION_ID, p.ids);
|
|
@@ -3561,11 +3803,15 @@ async function startDaemon(opts) {
|
|
|
3561
3803
|
await clearStaleSocket(socketPath);
|
|
3562
3804
|
let closing;
|
|
3563
3805
|
let timer;
|
|
3806
|
+
const daemonLog = createDaemonLog(paths.daemonLog, { now });
|
|
3564
3807
|
const daemon = new Daemon(store, token, now, isAlive, opts.idleExitMs ?? 6e5, () => {
|
|
3565
3808
|
close().then(() => opts.onIdleExit?.());
|
|
3566
3809
|
}, () => {
|
|
3567
3810
|
close().then(() => opts.onShutdown?.());
|
|
3568
|
-
},
|
|
3811
|
+
}, daemonLog, opts.authTimeoutMs ?? 5e3, opts.pathExists ?? existsSync, opts.autoLimits ?? autoLimitsFromEnv(process.env), opts.transcripts, opts.transcriptEnv, processIo, opts.notifier ?? createNotifier({
|
|
3812
|
+
settingsPath: paths.settings,
|
|
3813
|
+
onError: (what, e) => daemonLog.error(`notify: ${what}`, e)
|
|
3814
|
+
}));
|
|
3569
3815
|
const srv = createServer((socket) => daemon.attach(socket));
|
|
3570
3816
|
server = srv;
|
|
3571
3817
|
await new Promise((resolve, reject) => {
|
|
@@ -3581,6 +3827,7 @@ async function startDaemon(opts) {
|
|
|
3581
3827
|
closing ??= (async () => {
|
|
3582
3828
|
if (timer) clearInterval(timer);
|
|
3583
3829
|
walker?.close();
|
|
3830
|
+
daemon.closeNotifier();
|
|
3584
3831
|
daemon.relay?.stop();
|
|
3585
3832
|
const stopped = new Promise((resolve) => srv.close(() => resolve()));
|
|
3586
3833
|
for (const c of daemon.conns) c.socket.destroy();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as connect } from "./dist-
|
|
2
|
-
import { $ as isAllowed, Sn as
|
|
1
|
+
import { n as connect } from "./dist-CEJ2-wxh.js";
|
|
2
|
+
import { $ as isAllowed, Sn as RpcErrorCode, Zt as takeAcpLaunchFile, ln as CliKind, mt as parseAllowPatterns, q as formatContinuation, r as ConvenoError, rn as updateSpawnRecord, wn as SessionId } from "./dist-TrWRppjR.js";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { chmodSync, existsSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
@@ -173,7 +173,7 @@ function parseTurns(text) {
|
|
|
173
173
|
}
|
|
174
174
|
return out;
|
|
175
175
|
}
|
|
176
|
-
const HOST_VERSION = "0.2.0-rc.
|
|
176
|
+
const HOST_VERSION = "0.2.0-rc.5";
|
|
177
177
|
/** A stop request file: `conveno stop` writes it next to the spawn record. */
|
|
178
178
|
const stopRequestPath = (recordPath) => recordPath.replace(/\.json$/, ".stop");
|
|
179
179
|
function withTimeout(p, ms, what) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as toIso, At as readHeadLine, H as entriesNewestFirst, I as describeToolCall, It as recordCliInfo, Lt as relayPermission, Pt as readTailLines, V as endTurnContinuation, Wt as samePath, X as formatPermissionDecision, Xt as tailJsonl, Yt as subdirsNewestFirst, _ as asString, an as waitForWork, bt as pendingHookContext, dt as notFound, ht as parseCliVersion, it as isTranscriptPath, qt as startTurnContext, rt as isRecord, xt as pickNewestSince } from "./dist-TrWRppjR.js";
|
|
2
2
|
import { isAbsolute, join } from "node:path";
|
|
3
3
|
import { readFile, stat } from "node:fs/promises";
|
|
4
4
|
import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
@@ -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 { Cn as RpcResponse, E as clientProof, In as isSocketPathTooLong, Jn as socketPathTooLongMessage, M as dataDir, Mn as defaultSocketPath, N as dataPaths, Nn as encodeFrame, Pn as ipcMethods, Sn as RpcErrorCode, Tt as proofsMatch, bn as PROTOCOL_VERSION, j as daemonProof, jn as createLineDecoder, pn as EventPayload, r as ConvenoError, ut as newAuthNonce } from "./dist-TrWRppjR.js";
|
|
7
7
|
// ../client/dist/index.js
|
|
8
8
|
const DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
9
9
|
const DEFAULT_START_TIMEOUT_MS = 1e4;
|
|
@@ -31,6 +31,7 @@ const CLIENT_METHODS = [
|
|
|
31
31
|
"owner.inbox",
|
|
32
32
|
"owner.ack",
|
|
33
33
|
"owner.send",
|
|
34
|
+
"message.history",
|
|
34
35
|
"session.setCliInfo",
|
|
35
36
|
"session.setPeekable",
|
|
36
37
|
"session.peek",
|
|
@@ -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 { $n as
|
|
5
|
+
import { $n as literal, Qn as discriminatedUnion, Xn as array, Yn as _enum, er as number, nr as string, tr as object, un as DeviceId } from "./dist-TrWRppjR.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";
|