@av-pi-studio/cli 0.0.79 → 0.0.81
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/daemon-commands.js +15 -1
- package/dist/daemon-control.d.ts +15 -0
- package/dist/daemon-control.js +22 -1
- package/package.json +9 -7
- package/dist/.tsbuildinfo +0 -1
- package/dist/agent-commands.d.ts.map +0 -1
- package/dist/agent-commands.js.map +0 -1
- package/dist/auth-commands.d.ts.map +0 -1
- package/dist/auth-commands.js.map +0 -1
- package/dist/auth-interaction.d.ts.map +0 -1
- package/dist/auth-interaction.js.map +0 -1
- package/dist/auth-runtime.d.ts.map +0 -1
- package/dist/auth-runtime.js.map +0 -1
- package/dist/cli-core.d.ts.map +0 -1
- package/dist/cli-core.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client-id.d.ts.map +0 -1
- package/dist/client-id.js.map +0 -1
- package/dist/connection.d.ts.map +0 -1
- package/dist/connection.js.map +0 -1
- package/dist/daemon-commands.d.ts.map +0 -1
- package/dist/daemon-commands.js.map +0 -1
- package/dist/daemon-control.d.ts.map +0 -1
- package/dist/daemon-control.js.map +0 -1
- package/dist/extensions-commands.d.ts.map +0 -1
- package/dist/extensions-commands.js.map +0 -1
- package/dist/feature-commands.d.ts.map +0 -1
- package/dist/feature-commands.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js.map +0 -1
- package/dist/pairing.d.ts.map +0 -1
- package/dist/pairing.js.map +0 -1
- package/dist/pi-commands.d.ts.map +0 -1
- package/dist/pi-commands.js.map +0 -1
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/qr.d.ts.map +0 -1
- package/dist/qr.js.map +0 -1
- package/dist/relay-commands.d.ts.map +0 -1
- package/dist/relay-commands.js.map +0 -1
- package/dist/relay-control.d.ts.map +0 -1
- package/dist/relay-control.js.map +0 -1
- package/dist/update-commands.d.ts.map +0 -1
- package/dist/update-commands.js.map +0 -1
- package/dist/update-control.d.ts.map +0 -1
- package/dist/update-control.js.map +0 -1
- package/dist/web-commands.d.ts.map +0 -1
- package/dist/web-commands.js.map +0 -1
- package/dist/web-server.d.ts.map +0 -1
- package/dist/web-server.js.map +0 -1
package/dist/daemon-commands.js
CHANGED
|
@@ -2,7 +2,7 @@ import { loadConfig } from "@av-pi-studio/server";
|
|
|
2
2
|
import { EXIT_ERROR, EXIT_OK } from "./cli-core.js";
|
|
3
3
|
import { resolveHome } from "./client-id.js";
|
|
4
4
|
import { parseHost } from "./connection.js";
|
|
5
|
-
import { daemonStatus, daemonPaths, defaultDaemonRuntime, persistRelayEnvOverrides, setDaemonPassword, stopDaemon, waitForDaemon, } from "./daemon-control.js";
|
|
5
|
+
import { daemonStatus, daemonPaths, defaultDaemonRuntime, persistRelayEnvOverrides, rotateDaemonKeypair, setDaemonPassword, stopDaemon, waitForDaemon, } from "./daemon-control.js";
|
|
6
6
|
import { buildPairingUrl, readDaemonPublicKey } from "./pairing.js";
|
|
7
7
|
import { renderQrToTerminal } from "./qr.js";
|
|
8
8
|
/**
|
|
@@ -133,6 +133,20 @@ export function registerDaemonCommands(program, ctx, setExit) {
|
|
|
133
133
|
ctx.sink.write("password set; restart the daemon to enforce it.");
|
|
134
134
|
setExit(EXIT_OK);
|
|
135
135
|
});
|
|
136
|
+
daemon
|
|
137
|
+
.command("rotate-key")
|
|
138
|
+
.description("replace the daemon's pairing keypair (revokes every existing pairing link)")
|
|
139
|
+
.action(async () => {
|
|
140
|
+
const home = resolveCtxHome(ctx, g());
|
|
141
|
+
// Stop first: a live daemon holds the old key in memory and keeps answering on the old relay
|
|
142
|
+
// session id, so deleting the file under it would revoke nothing until it exited anyway.
|
|
143
|
+
stopDaemon(home, runtimeOf(ctx));
|
|
144
|
+
const rotated = rotateDaemonKeypair(home);
|
|
145
|
+
ctx.sink.write(rotated
|
|
146
|
+
? "keypair rotated — every previously-issued pairing link/QR is now invalid; re-pair all clients."
|
|
147
|
+
: "no existing keypair found — a new one will be generated.");
|
|
148
|
+
setExit(await ensureLocalDaemonAndPair(ctx, g()));
|
|
149
|
+
});
|
|
136
150
|
// top-level `onboard` — start/connect + show QR.
|
|
137
151
|
program
|
|
138
152
|
.command("onboard")
|
package/dist/daemon-control.d.ts
CHANGED
|
@@ -83,6 +83,21 @@ export declare function setDaemonPassword(home: string, plaintext: string, runti
|
|
|
83
83
|
export declare function persistRelayEnvOverrides(home: string, env?: Record<string, string | undefined>): void;
|
|
84
84
|
/** Stop the local daemon by signaling its recorded pid. Returns false when no daemon was found. */
|
|
85
85
|
export declare function stopDaemon(home: string, runtime: DaemonRuntime): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Delete `$PI_STUDIO_HOME/daemon-keypair.json` so the daemon mints a fresh Curve25519 identity on
|
|
88
|
+
* its next boot (`packages/server/src/daemon/bootstrap.ts#resolveDaemonKeypair` regenerates when the
|
|
89
|
+
* file is missing/unreadable). Returns true when a keypair was actually removed.
|
|
90
|
+
*
|
|
91
|
+
* This is credential revocation, not housekeeping: a pairing link's `offer=` key IS the credential
|
|
92
|
+
* for a relay-routed connection (the password is not consulted on that path), and the relay
|
|
93
|
+
* rendezvous id is `deriveRelaySessionId(publicKey)` — deterministic for the life of the key. So a
|
|
94
|
+
* leaked link stays valid forever until the key behind it is replaced. Rotating invalidates every
|
|
95
|
+
* previously-issued pairing link/QR; all clients must re-pair (relay-e2ee.md § Pairing).
|
|
96
|
+
*
|
|
97
|
+
* The daemon reads the keypair once at startup, so a rotation only takes effect after a restart —
|
|
98
|
+
* callers are expected to stop the daemon first (see `daemon rotate-key`).
|
|
99
|
+
*/
|
|
100
|
+
export declare function rotateDaemonKeypair(home: string): boolean;
|
|
86
101
|
/** Poll the health endpoint until the daemon is up or attempts are exhausted. */
|
|
87
102
|
export declare function waitForDaemon(runtime: DaemonRuntime, host: string, port: number, opts?: {
|
|
88
103
|
attempts?: number;
|
package/dist/daemon-control.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { request } from "node:http";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import bcrypt from "bcryptjs";
|
|
@@ -220,6 +220,27 @@ export function stopDaemon(home, runtime) {
|
|
|
220
220
|
return false;
|
|
221
221
|
return runtime.kill(pid);
|
|
222
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Delete `$PI_STUDIO_HOME/daemon-keypair.json` so the daemon mints a fresh Curve25519 identity on
|
|
225
|
+
* its next boot (`packages/server/src/daemon/bootstrap.ts#resolveDaemonKeypair` regenerates when the
|
|
226
|
+
* file is missing/unreadable). Returns true when a keypair was actually removed.
|
|
227
|
+
*
|
|
228
|
+
* This is credential revocation, not housekeeping: a pairing link's `offer=` key IS the credential
|
|
229
|
+
* for a relay-routed connection (the password is not consulted on that path), and the relay
|
|
230
|
+
* rendezvous id is `deriveRelaySessionId(publicKey)` — deterministic for the life of the key. So a
|
|
231
|
+
* leaked link stays valid forever until the key behind it is replaced. Rotating invalidates every
|
|
232
|
+
* previously-issued pairing link/QR; all clients must re-pair (relay-e2ee.md § Pairing).
|
|
233
|
+
*
|
|
234
|
+
* The daemon reads the keypair once at startup, so a rotation only takes effect after a restart —
|
|
235
|
+
* callers are expected to stop the daemon first (see `daemon rotate-key`).
|
|
236
|
+
*/
|
|
237
|
+
export function rotateDaemonKeypair(home) {
|
|
238
|
+
const path = daemonPaths(home).keypair;
|
|
239
|
+
if (!existsSync(path))
|
|
240
|
+
return false;
|
|
241
|
+
rmSync(path, { force: true });
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
223
244
|
/** Poll the health endpoint until the daemon is up or attempts are exhausted. */
|
|
224
245
|
export async function waitForDaemon(runtime, host, port, opts = {}) {
|
|
225
246
|
const attempts = opts.attempts ?? 40;
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@av-pi-studio/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.81",
|
|
4
4
|
"bin": {
|
|
5
5
|
"pi-studio": "dist/cli.js"
|
|
6
6
|
},
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"!dist/**/*.map",
|
|
10
|
+
"!dist/.tsbuildinfo"
|
|
9
11
|
],
|
|
10
12
|
"type": "module",
|
|
11
13
|
"main": "./dist/index.js",
|
|
@@ -21,11 +23,11 @@
|
|
|
21
23
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"@av-pi-studio/client": "^0.0.
|
|
25
|
-
"@av-pi-studio/protocol": "^0.0.
|
|
26
|
-
"@av-pi-studio/relay": "^0.0.
|
|
27
|
-
"@av-pi-studio/server": "^0.0.
|
|
28
|
-
"@av-pi-studio/web-client": "^0.0.
|
|
26
|
+
"@av-pi-studio/client": "^0.0.81",
|
|
27
|
+
"@av-pi-studio/protocol": "^0.0.81",
|
|
28
|
+
"@av-pi-studio/relay": "^0.0.81",
|
|
29
|
+
"@av-pi-studio/server": "^0.0.81",
|
|
30
|
+
"@av-pi-studio/web-client": "^0.0.81",
|
|
29
31
|
"@earendil-works/pi-coding-agent": "^0.84.1",
|
|
30
32
|
"@inquirer/prompts": "^8.5.2",
|
|
31
33
|
"bcryptjs": "^3.0.3",
|