@yefengr/remote-pi 0.7.4 → 0.7.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 +81 -586
- package/dist/bin/supervisord.js +4 -5
- package/dist/bin/supervisord.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/daemon/cli-links.d.ts +30 -0
- package/dist/daemon/cli-links.js +134 -0
- package/dist/daemon/cli-links.js.map +1 -0
- package/dist/daemon/commands.d.ts +27 -0
- package/dist/daemon/commands.js +295 -0
- package/dist/daemon/commands.js.map +1 -0
- package/dist/daemon/control_protocol.d.ts +53 -31
- package/dist/daemon/control_protocol.js +8 -31
- package/dist/daemon/control_protocol.js.map +1 -1
- package/dist/daemon/cron_log.d.ts +2 -23
- package/dist/daemon/cron_log.js +10 -25
- package/dist/daemon/cron_log.js.map +1 -1
- package/dist/daemon/cron_registry.d.ts +3 -40
- package/dist/daemon/cron_registry.js +58 -103
- package/dist/daemon/cron_registry.js.map +1 -1
- package/dist/daemon/install-runtime.d.ts +10 -0
- package/dist/daemon/install-runtime.js +81 -0
- package/dist/daemon/install-runtime.js.map +1 -0
- package/dist/daemon/install.d.ts +3 -63
- package/dist/daemon/install.js +5 -289
- package/dist/daemon/install.js.map +1 -1
- package/dist/daemon/preflight.d.ts +51 -0
- package/dist/daemon/preflight.js +136 -0
- package/dist/daemon/preflight.js.map +1 -0
- package/dist/daemon/registry.d.ts +33 -45
- package/dist/daemon/registry.js +171 -117
- package/dist/daemon/registry.js.map +1 -1
- package/dist/daemon/rpc_child.d.ts +92 -146
- package/dist/daemon/rpc_child.js +336 -263
- package/dist/daemon/rpc_child.js.map +1 -1
- package/dist/daemon/status.d.ts +45 -0
- package/dist/daemon/status.js +87 -0
- package/dist/daemon/status.js.map +1 -0
- package/dist/daemon/supervisor-ipc.d.ts +2 -0
- package/dist/daemon/supervisor-ipc.js +20 -0
- package/dist/daemon/supervisor-ipc.js.map +1 -0
- package/dist/daemon/supervisor.d.ts +48 -71
- package/dist/daemon/supervisor.js +430 -420
- package/dist/daemon/supervisor.js.map +1 -1
- package/dist/extension_ui_bridge.d.ts +4 -3
- package/dist/extension_ui_bridge.js +10 -0
- package/dist/extension_ui_bridge.js.map +1 -1
- package/dist/index.d.ts +25 -230
- package/dist/index.js +515 -5553
- package/dist/index.js.map +1 -1
- package/dist/pairing/crypto.d.ts +8 -1
- package/dist/pairing/crypto.js +56 -6
- package/dist/pairing/crypto.js.map +1 -1
- package/dist/pairing/owner_storage.d.ts +42 -0
- package/dist/pairing/owner_storage.js +207 -0
- package/dist/pairing/owner_storage.js.map +1 -0
- package/dist/pairing/qr.d.ts +3 -42
- package/dist/pairing/qr.js +9 -59
- package/dist/pairing/qr.js.map +1 -1
- package/dist/pairing/storage.d.ts +3 -45
- package/dist/pairing/storage.js +10 -223
- package/dist/pairing/storage.js.map +1 -1
- package/dist/protocol/types.d.ts +1 -1
- package/dist/protocol/v2/schemas.d.ts +1 -1
- package/dist/protocol/v2/schemas.js +1 -1
- package/dist/protocol/v2/schemas.js.map +1 -1
- package/dist/runtime/owner_router.d.ts +16 -0
- package/dist/runtime/owner_router.js +37 -0
- package/dist/runtime/owner_router.js.map +1 -0
- package/dist/session/ipc.d.ts +1 -22
- package/dist/session/ipc.js +4 -11
- package/dist/session/ipc.js.map +1 -1
- package/dist/session/local_config.d.ts +4 -47
- package/dist/session/local_config.js +19 -101
- package/dist/session/local_config.js.map +1 -1
- package/dist/transport/peer_channel.d.ts +25 -39
- package/dist/transport/peer_channel.js +74 -131
- package/dist/transport/peer_channel.js.map +1 -1
- package/dist/transport/relay_client.d.ts +26 -70
- package/dist/transport/relay_client.js +37 -106
- package/dist/transport/relay_client.js.map +1 -1
- package/docs/daemon.md +91 -207
- package/package.json +21 -17
- package/dist/daemon/id.d.ts +0 -24
- package/dist/daemon/id.js +0 -36
- package/dist/daemon/id.js.map +0 -1
- package/dist/mcp/mesh_result.d.ts +0 -10
- package/dist/mcp/mesh_result.js +0 -42
- package/dist/mcp/mesh_result.js.map +0 -1
- package/dist/mcp/mesh_server.d.ts +0 -16
- package/dist/mcp/mesh_server.js +0 -327
- package/dist/mcp/mesh_server.js.map +0 -1
- package/dist/mesh/canonical.d.ts +0 -30
- package/dist/mesh/canonical.js +0 -61
- package/dist/mesh/canonical.js.map +0 -1
- package/dist/mesh/client.d.ts +0 -18
- package/dist/mesh/client.js +0 -125
- package/dist/mesh/client.js.map +0 -1
- package/dist/mesh/encoding.d.ts +0 -38
- package/dist/mesh/encoding.js +0 -216
- package/dist/mesh/encoding.js.map +0 -1
- package/dist/mesh/self_revoke.d.ts +0 -73
- package/dist/mesh/self_revoke.js +0 -401
- package/dist/mesh/self_revoke.js.map +0 -1
- package/dist/mesh/siblings.d.ts +0 -49
- package/dist/mesh/siblings.js +0 -159
- package/dist/mesh/siblings.js.map +0 -1
- package/dist/mesh/types.d.ts +0 -34
- package/dist/mesh/types.js +0 -11
- package/dist/mesh/types.js.map +0 -1
- package/dist/mesh/verify.d.ts +0 -17
- package/dist/mesh/verify.js +0 -86
- package/dist/mesh/verify.js.map +0 -1
- package/dist/rooms.d.ts +0 -29
- package/dist/rooms.js +0 -57
- package/dist/rooms.js.map +0 -1
- package/dist/session/bridge.d.ts +0 -37
- package/dist/session/bridge.js +0 -130
- package/dist/session/bridge.js.map +0 -1
- package/dist/session/broker.d.ts +0 -189
- package/dist/session/broker.js +0 -507
- package/dist/session/broker.js.map +0 -1
- package/dist/session/broker_remote.d.ts +0 -74
- package/dist/session/broker_remote.js +0 -583
- package/dist/session/broker_remote.js.map +0 -1
- package/dist/session/cwd_lock.d.ts +0 -33
- package/dist/session/cwd_lock.js +0 -126
- package/dist/session/cwd_lock.js.map +0 -1
- package/dist/session/envelope.d.ts +0 -33
- package/dist/session/envelope.js +0 -117
- package/dist/session/envelope.js.map +0 -1
- package/dist/session/global_config.d.ts +0 -33
- package/dist/session/global_config.js +0 -73
- package/dist/session/global_config.js.map +0 -1
- package/dist/session/leader_election.d.ts +0 -32
- package/dist/session/leader_election.js +0 -106
- package/dist/session/leader_election.js.map +0 -1
- package/dist/session/mesh_node.d.ts +0 -116
- package/dist/session/mesh_node.js +0 -573
- package/dist/session/mesh_node.js.map +0 -1
- package/dist/session/peer.d.ts +0 -139
- package/dist/session/peer.js +0 -451
- package/dist/session/peer.js.map +0 -1
- package/dist/session/peer_inventory.d.ts +0 -13
- package/dist/session/peer_inventory.js +0 -48
- package/dist/session/peer_inventory.js.map +0 -1
- package/dist/session/peer_limits.d.ts +0 -9
- package/dist/session/peer_limits.js +0 -21
- package/dist/session/peer_limits.js.map +0 -1
- package/dist/session/setup_wizard.d.ts +0 -39
- package/dist/session/setup_wizard.js +0 -63
- package/dist/session/setup_wizard.js.map +0 -1
- package/dist/session/tools.d.ts +0 -24
- package/dist/session/tools.js +0 -252
- package/dist/session/tools.js.map +0 -1
- package/dist/session/wizard.d.ts +0 -13
- package/dist/session/wizard.js +0 -20
- package/dist/session/wizard.js.map +0 -1
- package/dist/transport/pi_forward_client.d.ts +0 -29
- package/dist/transport/pi_forward_client.js +0 -62
- package/dist/transport/pi_forward_client.js.map +0 -1
- package/dist/ui/footer.d.ts +0 -32
- package/dist/ui/footer.js +0 -34
- package/dist/ui/footer.js.map +0 -1
- package/skills/agent-network/SKILL.md +0 -310
|
@@ -1,55 +1,12 @@
|
|
|
1
1
|
export interface LocalConfig {
|
|
2
2
|
agent_name?: string;
|
|
3
|
-
/**
|
|
4
|
-
* If true (default), `/remote-pi` with no args auto-joins the local UDS
|
|
5
|
-
* mesh and starts the relay on a fresh terminal. The field name is
|
|
6
|
-
* historical (plano 21); the UX wording was reworked to "use the relay
|
|
7
|
-
* on this terminal to connect to the remote mesh (PWA + PCs)". Legacy
|
|
8
|
-
* configs without this field are treated as `true` for backward compat.
|
|
9
|
-
*/
|
|
3
|
+
/** Whether an interactive Pi starts its Relay endpoint automatically. */
|
|
10
4
|
auto_start_relay?: boolean;
|
|
11
5
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Normalize a name segment to a mesh-safe token: trim, replace the addressing
|
|
14
|
-
* separators (`/ : @ #`) and whitespace runs with `-`, collapse repeats, strip
|
|
15
|
-
* edges. The `@` is included so a sanitized name can never contain the address
|
|
16
|
-
* separator — `<cwd>@<name>` stays unambiguous on the wire. Returns undefined
|
|
17
|
-
* when the input isn't a usable non-empty string, sanitizes to empty, or is a
|
|
18
|
-
* reserved addressing keyword (`broadcast` / `broker`). Used by the broker's
|
|
19
|
-
* `sanitizeMeshName` to keep the `<nome>` half of a peer address safe to
|
|
20
|
-
* compose (plan/38).
|
|
21
|
-
*/
|
|
22
|
-
export declare function sanitizeSegment(v: unknown): string | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Migrate a persisted `agent_name` to the plan/38 leaf-name model (decision E).
|
|
25
|
-
* Two legacy shapes get rewritten on read so a pre-fix config never fossilizes a
|
|
26
|
-
* runtime accident as if it were an explicit choice:
|
|
27
|
-
*
|
|
28
|
-
* - **`#N` collision suffix** — could only have come from a broker/lock
|
|
29
|
-
* assignment (the user can't type `#`: `sanitizeSegment` maps it to `-`), so
|
|
30
|
-
* a trailing `#<digits>` is stripped and the clean base re-derived.
|
|
31
|
-
* - **legacy `parent/folder`** — the old `defaultAgentName` shape; the `/`
|
|
32
|
-
* means it predates the leaf-only model, so we keep only the leaf segment.
|
|
33
|
-
*
|
|
34
|
-
* Returns the cleaned name, or undefined when nothing usable remains (so the
|
|
35
|
-
* caller falls back to `defaultAgentName(cwd)`).
|
|
36
|
-
*/
|
|
37
|
-
export declare function migrateAgentName(raw: string): string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* True when a local config is available for this cwd — either inline via
|
|
40
|
-
* `REMOTE_PI_DIRECT_CONFIG` or as `<cwd>/.pi/remote-pi/config.json` on disk.
|
|
41
|
-
*/
|
|
42
6
|
export declare function localConfigExists(cwd: string): boolean;
|
|
43
7
|
export declare function loadLocalConfig(cwd: string): LocalConfig;
|
|
44
8
|
export declare function saveLocalConfig(cwd: string, patch: Partial<LocalConfig>): void;
|
|
45
|
-
/**
|
|
46
|
-
* Default agent name when none is configured (plan/38 decision D): the **leaf**
|
|
47
|
-
* of the cwd, `basename(cwd)`. The cwd now travels as its own address axis
|
|
48
|
-
* (`<cwd>@<nome>`), so the name no longer needs the `parent/folder` prefix that
|
|
49
|
-
* used to disambiguate folders — the broker keys peers by `(cwd, nome)`, and a
|
|
50
|
-
* clean leaf means `#N` almost never fires. Falls back to `"agent"` for a
|
|
51
|
-
* path with no usable basename (root / empty).
|
|
52
|
-
*/
|
|
9
|
+
/** Default display name when none is configured. */
|
|
53
10
|
export declare function defaultAgentName(cwd: string): string;
|
|
54
|
-
/** Resolves
|
|
55
|
-
export declare function effectiveAutoStartRelay(
|
|
11
|
+
/** Resolves the default for omitted config values. */
|
|
12
|
+
export declare function effectiveAutoStartRelay(config: LocalConfig): boolean;
|
|
@@ -2,64 +2,10 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
3
|
const LOCAL_DIR = ".pi/remote-pi";
|
|
4
4
|
const LOCAL_FILE = "config.json";
|
|
5
|
-
/**
|
|
6
|
-
* Escape hatch: when set, carries the WHOLE local config as inline JSON,
|
|
7
|
-
* bypassing the on-disk `config.json`. For CI/ops/daemons that inject config
|
|
8
|
-
* via env instead of writing a file — mirrors `REMOTE_PI_RELAY` for the relay
|
|
9
|
-
* URL. Takes precedence over the file; an unset/empty/unparseable value falls
|
|
10
|
-
* back to the file (never fatal).
|
|
11
|
-
*/
|
|
12
5
|
const DIRECT_CONFIG_ENV = "REMOTE_PI_DIRECT_CONFIG";
|
|
13
6
|
function pathFor(cwd) {
|
|
14
7
|
return join(cwd, LOCAL_DIR, LOCAL_FILE);
|
|
15
8
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Normalize a name segment to a mesh-safe token: trim, replace the addressing
|
|
18
|
-
* separators (`/ : @ #`) and whitespace runs with `-`, collapse repeats, strip
|
|
19
|
-
* edges. The `@` is included so a sanitized name can never contain the address
|
|
20
|
-
* separator — `<cwd>@<name>` stays unambiguous on the wire. Returns undefined
|
|
21
|
-
* when the input isn't a usable non-empty string, sanitizes to empty, or is a
|
|
22
|
-
* reserved addressing keyword (`broadcast` / `broker`). Used by the broker's
|
|
23
|
-
* `sanitizeMeshName` to keep the `<nome>` half of a peer address safe to
|
|
24
|
-
* compose (plan/38).
|
|
25
|
-
*/
|
|
26
|
-
export function sanitizeSegment(v) {
|
|
27
|
-
if (typeof v !== "string")
|
|
28
|
-
return undefined;
|
|
29
|
-
const token = v.trim().replace(/[/:@#\s]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
|
|
30
|
-
if (!token)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (token.toLowerCase() === "broadcast" || token.toLowerCase() === "broker")
|
|
33
|
-
return undefined;
|
|
34
|
-
return token;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Migrate a persisted `agent_name` to the plan/38 leaf-name model (decision E).
|
|
38
|
-
* Two legacy shapes get rewritten on read so a pre-fix config never fossilizes a
|
|
39
|
-
* runtime accident as if it were an explicit choice:
|
|
40
|
-
*
|
|
41
|
-
* - **`#N` collision suffix** — could only have come from a broker/lock
|
|
42
|
-
* assignment (the user can't type `#`: `sanitizeSegment` maps it to `-`), so
|
|
43
|
-
* a trailing `#<digits>` is stripped and the clean base re-derived.
|
|
44
|
-
* - **legacy `parent/folder`** — the old `defaultAgentName` shape; the `/`
|
|
45
|
-
* means it predates the leaf-only model, so we keep only the leaf segment.
|
|
46
|
-
*
|
|
47
|
-
* Returns the cleaned name, or undefined when nothing usable remains (so the
|
|
48
|
-
* caller falls back to `defaultAgentName(cwd)`).
|
|
49
|
-
*/
|
|
50
|
-
export function migrateAgentName(raw) {
|
|
51
|
-
// Legacy `parent/folder` (or any path-ish value) → keep the trailing segment.
|
|
52
|
-
const leaf = raw.includes("/") ? raw.slice(raw.lastIndexOf("/") + 1) : raw;
|
|
53
|
-
// Drop a runtime collision suffix a pre-fix build may have frozen into config.
|
|
54
|
-
const clean = leaf.replace(/#\d+$/, "").trim();
|
|
55
|
-
return clean.length > 0 ? clean : undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Parse a raw JSON string into a LocalConfig, surfacing only known fields.
|
|
59
|
-
* Returns null when the input isn't a usable JSON object. Legacy `session_name`
|
|
60
|
-
* from pre-refactor configs is silently dropped — the local UDS mesh is now
|
|
61
|
-
* always a single fixed session, so the field has no meaning.
|
|
62
|
-
*/
|
|
63
9
|
function parseLocalConfig(raw) {
|
|
64
10
|
let parsed;
|
|
65
11
|
try {
|
|
@@ -70,88 +16,60 @@ function parseLocalConfig(raw) {
|
|
|
70
16
|
}
|
|
71
17
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
72
18
|
return null;
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
if (typeof
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
cfg.agent_name = migrated;
|
|
19
|
+
const source = parsed;
|
|
20
|
+
const config = {};
|
|
21
|
+
if (typeof source["agent_name"] === "string" && source["agent_name"].trim()) {
|
|
22
|
+
config.agent_name = source["agent_name"].trim();
|
|
23
|
+
}
|
|
24
|
+
if (typeof source["auto_start_relay"] === "boolean") {
|
|
25
|
+
config.auto_start_relay = source["auto_start_relay"];
|
|
81
26
|
}
|
|
82
|
-
|
|
83
|
-
cfg.auto_start_relay = src["auto_start_relay"];
|
|
84
|
-
return cfg;
|
|
27
|
+
return config;
|
|
85
28
|
}
|
|
86
|
-
/** Inline config from `REMOTE_PI_DIRECT_CONFIG`, when set + parseable; else null. */
|
|
87
29
|
function directConfig() {
|
|
88
30
|
const raw = process.env[DIRECT_CONFIG_ENV];
|
|
89
31
|
if (!raw || raw.trim().length === 0)
|
|
90
32
|
return null;
|
|
91
33
|
return parseLocalConfig(raw);
|
|
92
34
|
}
|
|
93
|
-
/**
|
|
94
|
-
* True when a local config is available for this cwd — either inline via
|
|
95
|
-
* `REMOTE_PI_DIRECT_CONFIG` or as `<cwd>/.pi/remote-pi/config.json` on disk.
|
|
96
|
-
*/
|
|
97
35
|
export function localConfigExists(cwd) {
|
|
98
36
|
return directConfig() !== null || existsSync(pathFor(cwd));
|
|
99
37
|
}
|
|
100
38
|
export function loadLocalConfig(cwd) {
|
|
101
|
-
// Precedence: inline `REMOTE_PI_DIRECT_CONFIG` env wins over the file. An
|
|
102
|
-
// unset/empty/malformed env falls through to the on-disk config.json.
|
|
103
39
|
const direct = directConfig();
|
|
104
40
|
if (direct)
|
|
105
41
|
return direct;
|
|
106
|
-
const
|
|
107
|
-
if (!existsSync(
|
|
42
|
+
const path = pathFor(cwd);
|
|
43
|
+
if (!existsSync(path))
|
|
108
44
|
return {};
|
|
109
45
|
try {
|
|
110
|
-
return parseLocalConfig(readFileSync(
|
|
46
|
+
return parseLocalConfig(readFileSync(path, "utf8")) ?? {};
|
|
111
47
|
}
|
|
112
48
|
catch {
|
|
113
49
|
return {};
|
|
114
50
|
}
|
|
115
51
|
}
|
|
116
52
|
export function saveLocalConfig(cwd, patch) {
|
|
117
|
-
const
|
|
53
|
+
const path = pathFor(cwd);
|
|
118
54
|
const current = loadLocalConfig(cwd);
|
|
119
55
|
const next = { ...current, ...patch };
|
|
120
|
-
// Always persist auto_start_relay explicitly (default true) so future reads
|
|
121
|
-
// never need to guess. Backward-compat: legacy files without the field
|
|
122
|
-
// are treated as true on read; we lock that intent in on first save.
|
|
123
56
|
if (typeof next.auto_start_relay !== "boolean")
|
|
124
57
|
next.auto_start_relay = true;
|
|
125
|
-
// Best-effort persistence: a read-only config.json is a legitimate deployment
|
|
126
|
-
// (NixOS/Home Manager symlink into the immutable Nix store, read-only root,
|
|
127
|
-
// EPERM). The name/config sync is cosmetic — it must NEVER crash the pi
|
|
128
|
-
// process with an uncaughtException. `saveLocalConfig` is reached via
|
|
129
|
-
// fire-and-forget async paths (`void _syncNameFromPi()` from `turn_start` /
|
|
130
|
-
// `session_start`), so a sync throw from `mkdirSync`/`writeFileSync` sails
|
|
131
|
-
// past the runner's per-handler try/catch and takes down pi. Guard both fs
|
|
132
|
-
// calls together so a partial attempt can't throw past the caller.
|
|
133
58
|
try {
|
|
134
|
-
mkdirSync(dirname(
|
|
135
|
-
writeFileSync(
|
|
59
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
60
|
+
writeFileSync(path, JSON.stringify(next, null, 2));
|
|
136
61
|
}
|
|
137
62
|
catch (error) {
|
|
138
63
|
const message = error instanceof Error ? error.message : String(error);
|
|
139
|
-
console.warn(`[remote-pi] could not persist local config ${
|
|
64
|
+
console.warn(`[remote-pi] could not persist local config ${path}: ${message}`);
|
|
140
65
|
}
|
|
141
66
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Default agent name when none is configured (plan/38 decision D): the **leaf**
|
|
144
|
-
* of the cwd, `basename(cwd)`. The cwd now travels as its own address axis
|
|
145
|
-
* (`<cwd>@<nome>`), so the name no longer needs the `parent/folder` prefix that
|
|
146
|
-
* used to disambiguate folders — the broker keys peers by `(cwd, nome)`, and a
|
|
147
|
-
* clean leaf means `#N` almost never fires. Falls back to `"agent"` for a
|
|
148
|
-
* path with no usable basename (root / empty).
|
|
149
|
-
*/
|
|
67
|
+
/** Default display name when none is configured. */
|
|
150
68
|
export function defaultAgentName(cwd) {
|
|
151
69
|
return basename(cwd) || "agent";
|
|
152
70
|
}
|
|
153
|
-
/** Resolves
|
|
154
|
-
export function effectiveAutoStartRelay(
|
|
155
|
-
return
|
|
71
|
+
/** Resolves the default for omitted config values. */
|
|
72
|
+
export function effectiveAutoStartRelay(config) {
|
|
73
|
+
return config.auto_start_relay !== false;
|
|
156
74
|
}
|
|
157
75
|
//# sourceMappingURL=local_config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local_config.js","sourceRoot":"","sources":["../../src/session/local_config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ACrC,MAAM,IAAI,GAAgB,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;IACnD,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAS;QAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC7E,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,8CAA8C,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC;AAClC,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,uBAAuB,CAAC,MAAmB;IACzD,OAAO,MAAM,CAAC,gBAAgB,KAAK,KAAK,CAAC;AAC3C,CAAC"}
|
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
import type { ClientMessage, ServerMessage } from "../protocol/types.js";
|
|
2
1
|
import { type ClientFrame, type ServerFrame } from "../protocol/v2/index.js";
|
|
3
2
|
import type { RelayClient } from "./relay_client.js";
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export type RoutePurpose = "pairing" | "session";
|
|
4
|
+
export type RouteFrame = {
|
|
5
|
+
type: "route";
|
|
6
|
+
purpose: RoutePurpose;
|
|
7
|
+
device_id: string;
|
|
8
|
+
endpoint_id: string;
|
|
9
|
+
runtime_instance_id: string;
|
|
10
|
+
target_owner_id?: string;
|
|
11
|
+
source_owner_id?: string;
|
|
12
|
+
ct: string;
|
|
13
|
+
};
|
|
14
|
+
export type HostRouteIdentity = {
|
|
15
|
+
deviceId: string;
|
|
16
|
+
endpointId: string;
|
|
17
|
+
runtimeInstanceId: string;
|
|
18
|
+
};
|
|
8
19
|
export interface V2Channel {
|
|
9
20
|
getPeerId(): string;
|
|
10
21
|
sendV2(msg: ServerFrame): void;
|
|
11
22
|
detach(): void;
|
|
12
23
|
}
|
|
13
24
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* const channel = new PlainPeerChannel(relay, appPeerId, myRoomId, onMsg)
|
|
18
|
-
* channel.send(serverMessage) // base64-encodes JSON, routes via relay
|
|
19
|
-
* // incoming relay messages destined for appPeerId are auto-decoded
|
|
20
|
-
* // and delivered via onMessage callback
|
|
21
|
-
*
|
|
22
|
-
* `myRoomId` is the *local* Pi's room id — sent on every outbound envelope
|
|
23
|
-
* so the app can correlate which Pi sent it (multi-pi support, plano 17).
|
|
25
|
+
* A Host-side protocol-v2 channel for one authorized Owner. The relay
|
|
26
|
+
* authenticates and injects `source_owner_id` for Owner-to-Host routes; this
|
|
27
|
+
* channel only accepts routes for its immutable endpoint identity and owner.
|
|
24
28
|
*/
|
|
25
29
|
export declare class V2PeerChannel implements V2Channel {
|
|
26
30
|
private readonly relay;
|
|
27
|
-
private readonly
|
|
31
|
+
private readonly ownerId;
|
|
32
|
+
private readonly host;
|
|
28
33
|
private readonly onMessage;
|
|
29
34
|
private readonly unsubscribe;
|
|
30
|
-
constructor(relay: RelayClient,
|
|
35
|
+
constructor(relay: RelayClient, ownerId: string, host: HostRouteIdentity, onMessage: (msg: ClientFrame) => void);
|
|
31
36
|
getPeerId(): string;
|
|
32
37
|
sendV2(msg: ServerFrame): void;
|
|
33
38
|
detach(): void;
|
|
34
39
|
private onLine;
|
|
40
|
+
private sendUpgradeRequired;
|
|
35
41
|
}
|
|
36
|
-
|
|
37
|
-
export declare
|
|
38
|
-
private readonly relay;
|
|
39
|
-
private readonly remotePeerId;
|
|
40
|
-
private readonly onMessage;
|
|
41
|
-
private readonly _unsubscribe;
|
|
42
|
-
constructor(relay: RelayClient, remotePeerId: string,
|
|
43
|
-
/**
|
|
44
|
-
* This Pi's room id. Currently NOT injected in the outer envelope
|
|
45
|
-
* (defensive — relay/app not yet ready). Kept in the constructor for
|
|
46
|
-
* forward-compat so callers don't need to change again when we re-enable.
|
|
47
|
-
*/
|
|
48
|
-
myRoomId: string | undefined, onMessage: (msg: ClientMessage) => void,
|
|
49
|
-
/** Called when this specific peer connection is considered lost. */
|
|
50
|
-
_onDisconnect?: () => void);
|
|
51
|
-
/** Authenticated Owner peer id used as a server-derived sender reference. */
|
|
52
|
-
getPeerId(): string;
|
|
53
|
-
send(msg: ServerMessage): void;
|
|
54
|
-
/** Detaches from relay (does not close the relay itself). */
|
|
55
|
-
detach(): void;
|
|
56
|
-
private _onLine;
|
|
57
|
-
}
|
|
42
|
+
export declare function parseIncomingRoute(line: string, host: HostRouteIdentity, ownerId?: string): RouteFrame | null;
|
|
43
|
+
export declare function sendRoute(relay: RelayClient, host: HostRouteIdentity, ownerId: string, purpose: RoutePurpose, ct: string): void;
|
|
@@ -1,171 +1,114 @@
|
|
|
1
1
|
import { decodeClientFrameV2, encodeServerFrameV2, } from "../protocol/v2/index.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* const channel = new PlainPeerChannel(relay, appPeerId, myRoomId, onMsg)
|
|
7
|
-
* channel.send(serverMessage) // base64-encodes JSON, routes via relay
|
|
8
|
-
* // incoming relay messages destined for appPeerId are auto-decoded
|
|
9
|
-
* // and delivered via onMessage callback
|
|
10
|
-
*
|
|
11
|
-
* `myRoomId` is the *local* Pi's room id — sent on every outbound envelope
|
|
12
|
-
* so the app can correlate which Pi sent it (multi-pi support, plano 17).
|
|
3
|
+
* A Host-side protocol-v2 channel for one authorized Owner. The relay
|
|
4
|
+
* authenticates and injects `source_owner_id` for Owner-to-Host routes; this
|
|
5
|
+
* channel only accepts routes for its immutable endpoint identity and owner.
|
|
13
6
|
*/
|
|
14
7
|
export class V2PeerChannel {
|
|
15
8
|
relay;
|
|
16
|
-
|
|
9
|
+
ownerId;
|
|
10
|
+
host;
|
|
17
11
|
onMessage;
|
|
18
12
|
unsubscribe;
|
|
19
|
-
constructor(relay,
|
|
13
|
+
constructor(relay, ownerId, host, onMessage) {
|
|
20
14
|
this.relay = relay;
|
|
21
|
-
this.
|
|
15
|
+
this.ownerId = ownerId;
|
|
16
|
+
this.host = host;
|
|
22
17
|
this.onMessage = onMessage;
|
|
23
18
|
const listener = (line) => this.onLine(line);
|
|
24
19
|
relay.on("message", listener);
|
|
25
20
|
this.unsubscribe = () => relay.off("message", listener);
|
|
26
21
|
}
|
|
27
22
|
getPeerId() {
|
|
28
|
-
return this.
|
|
23
|
+
return this.ownerId;
|
|
29
24
|
}
|
|
30
25
|
sendV2(msg) {
|
|
31
|
-
let ct;
|
|
32
26
|
try {
|
|
33
|
-
ct = Buffer.from(encodeServerFrameV2(msg)).toString("base64");
|
|
34
|
-
this.relay.send(JSON.stringify({
|
|
27
|
+
const ct = Buffer.from(encodeServerFrameV2(msg)).toString("base64");
|
|
28
|
+
this.relay.send(JSON.stringify({
|
|
29
|
+
type: "route",
|
|
30
|
+
purpose: msg.type === "pair_ok" || msg.type === "pair_error" ? "pairing" : "session",
|
|
31
|
+
device_id: this.host.deviceId,
|
|
32
|
+
endpoint_id: this.host.endpointId,
|
|
33
|
+
runtime_instance_id: this.host.runtimeInstanceId,
|
|
34
|
+
target_owner_id: this.ownerId,
|
|
35
|
+
ct,
|
|
36
|
+
}));
|
|
35
37
|
}
|
|
36
38
|
catch {
|
|
37
|
-
//
|
|
39
|
+
// Formal history recovers messages lost while the relay reconnects.
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
detach() {
|
|
41
43
|
this.unsubscribe();
|
|
42
44
|
}
|
|
43
45
|
onLine(line) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
outer = JSON.parse(line);
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (outer.peer !== this.remotePeerId || !outer.ct)
|
|
46
|
+
const outer = parseIncomingRoute(line, this.host, this.ownerId);
|
|
47
|
+
if (!outer)
|
|
52
48
|
return;
|
|
53
49
|
try {
|
|
54
|
-
const
|
|
55
|
-
|
|
50
|
+
const frame = decodeClientFrameV2(Buffer.from(outer.ct, "base64").toString("utf8"));
|
|
51
|
+
const expectedPurpose = frame.type === "pair_request" ? "pairing" : "session";
|
|
52
|
+
if (outer.purpose !== expectedPurpose)
|
|
53
|
+
return;
|
|
54
|
+
this.onMessage(frame);
|
|
56
55
|
}
|
|
57
56
|
catch {
|
|
58
|
-
|
|
59
|
-
// error; malformed bytes without an id cannot be safely targeted.
|
|
60
|
-
try {
|
|
61
|
-
const raw = JSON.parse(Buffer.from(outer.ct, "base64").toString("utf8"));
|
|
62
|
-
const id = typeof raw.id === "string" ? raw.id : undefined;
|
|
63
|
-
const channelId = typeof raw.channel_id === "string" ? raw.channel_id : undefined;
|
|
64
|
-
if (id) {
|
|
65
|
-
this.sendV2({
|
|
66
|
-
protocol_version: 2,
|
|
67
|
-
type: "protocol_error",
|
|
68
|
-
...(channelId ? { target_channel_id: channelId } : {}),
|
|
69
|
-
in_reply_to: id,
|
|
70
|
-
code: "protocol_upgrade_required",
|
|
71
|
-
message: "Protocol v2 is required",
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
// Ignore malformed outer payloads.
|
|
77
|
-
}
|
|
57
|
+
this.sendUpgradeRequired(outer.ct);
|
|
78
58
|
}
|
|
79
59
|
}
|
|
80
|
-
|
|
81
|
-
/** @deprecated Protocol v1 test helper. Production uses V2PeerChannel. */
|
|
82
|
-
export class PlainPeerChannel {
|
|
83
|
-
relay;
|
|
84
|
-
remotePeerId;
|
|
85
|
-
onMessage;
|
|
86
|
-
_unsubscribe;
|
|
87
|
-
constructor(relay, remotePeerId,
|
|
88
|
-
/**
|
|
89
|
-
* This Pi's room id. Currently NOT injected in the outer envelope
|
|
90
|
-
* (defensive — relay/app not yet ready). Kept in the constructor for
|
|
91
|
-
* forward-compat so callers don't need to change again when we re-enable.
|
|
92
|
-
*/
|
|
93
|
-
myRoomId, onMessage,
|
|
94
|
-
/** Called when this specific peer connection is considered lost. */
|
|
95
|
-
_onDisconnect) {
|
|
96
|
-
this.relay = relay;
|
|
97
|
-
this.remotePeerId = remotePeerId;
|
|
98
|
-
this.onMessage = onMessage;
|
|
99
|
-
const listener = (line) => this._onLine(line);
|
|
100
|
-
relay.on("message", listener);
|
|
101
|
-
this._unsubscribe = () => relay.off("message", listener);
|
|
102
|
-
void _onDisconnect;
|
|
103
|
-
void myRoomId; // intentionally unused — see send() comment
|
|
104
|
-
}
|
|
105
|
-
// ── PeerChannel interface ──────────────────────────────────────────────────
|
|
106
|
-
/** Authenticated Owner peer id used as a server-derived sender reference. */
|
|
107
|
-
getPeerId() {
|
|
108
|
-
return this.remotePeerId;
|
|
109
|
-
}
|
|
110
|
-
send(msg) {
|
|
111
|
-
const ct = Buffer.from(JSON.stringify(msg)).toString("base64");
|
|
112
|
-
// NOTE: `room` removed from the outer envelope until relay (W1.A) + app
|
|
113
|
-
// (W1.C) accept the field. Multi-Pi multiplexing already works via
|
|
114
|
-
// `room_id`/`room_meta` in the WS-level `hello` — outer routing stays by
|
|
115
|
-
// `peer` alone. Re-add the field once downstream is ready.
|
|
116
|
-
const outer = { peer: this.remotePeerId, ct };
|
|
117
|
-
// Best-effort delivery. The relay WS can be mid-reconnect (idle/NAT drop, or
|
|
118
|
-
// a session_new/session-replacement teardown) when we push a server→app frame
|
|
119
|
-
// — notably the action_ok/action_error ack a handler emits right after
|
|
120
|
-
// newSession. `relay.send` throws "relay: not connected" in that window; since
|
|
121
|
-
// this runs inside an async SDK event callback, letting it propagate becomes an
|
|
122
|
-
// uncaughtException that kills the whole pi process. The relay auto-reconnects
|
|
123
|
-
// and the app re-syncs via session_sync, so a dropped frame is recoverable — a
|
|
124
|
-
// crash is not. Mirrors RelayClient.sendControl's no-op-when-closed policy.
|
|
60
|
+
sendUpgradeRequired(ct) {
|
|
125
61
|
try {
|
|
126
|
-
|
|
62
|
+
const raw = JSON.parse(Buffer.from(ct, "base64").toString("utf8"));
|
|
63
|
+
const id = typeof raw.id === "string" ? raw.id : undefined;
|
|
64
|
+
const channelId = typeof raw.channel_id === "string" ? raw.channel_id : undefined;
|
|
65
|
+
if (!id)
|
|
66
|
+
return;
|
|
67
|
+
this.sendV2({
|
|
68
|
+
protocol_version: 2,
|
|
69
|
+
type: "protocol_error",
|
|
70
|
+
...(channelId ? { target_channel_id: channelId } : {}),
|
|
71
|
+
in_reply_to: id,
|
|
72
|
+
code: "protocol_upgrade_required",
|
|
73
|
+
message: "Protocol v2 is required",
|
|
74
|
+
});
|
|
127
75
|
}
|
|
128
76
|
catch {
|
|
129
|
-
|
|
77
|
+
// Invalid bytes without a request id are not targetable.
|
|
130
78
|
}
|
|
131
79
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
80
|
+
}
|
|
81
|
+
export function parseIncomingRoute(line, host, ownerId) {
|
|
82
|
+
let route;
|
|
83
|
+
try {
|
|
84
|
+
route = JSON.parse(line);
|
|
135
85
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
let outer;
|
|
139
|
-
try {
|
|
140
|
-
outer = JSON.parse(line);
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
return; // malformed line
|
|
144
|
-
}
|
|
145
|
-
if (outer.peer !== this.remotePeerId)
|
|
146
|
-
return;
|
|
147
|
-
if (!outer.ct)
|
|
148
|
-
return;
|
|
149
|
-
let plaintext;
|
|
150
|
-
try {
|
|
151
|
-
plaintext = Buffer.from(outer.ct, "base64").toString("utf8");
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
let msg;
|
|
157
|
-
try {
|
|
158
|
-
msg = JSON.parse(plaintext);
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (!msg ||
|
|
164
|
-
typeof msg !== "object" ||
|
|
165
|
-
typeof msg.type !== "string") {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
this.onMessage(msg);
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
169
88
|
}
|
|
89
|
+
if (route.type !== "route" ||
|
|
90
|
+
(route.purpose !== "pairing" && route.purpose !== "session") ||
|
|
91
|
+
typeof route.ct !== "string" ||
|
|
92
|
+
route.device_id !== host.deviceId ||
|
|
93
|
+
route.endpoint_id !== host.endpointId ||
|
|
94
|
+
route.runtime_instance_id !== host.runtimeInstanceId ||
|
|
95
|
+
typeof route.source_owner_id !== "string" ||
|
|
96
|
+
route.target_owner_id !== undefined) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
if (ownerId !== undefined && route.source_owner_id !== ownerId)
|
|
100
|
+
return null;
|
|
101
|
+
return route;
|
|
102
|
+
}
|
|
103
|
+
export function sendRoute(relay, host, ownerId, purpose, ct) {
|
|
104
|
+
relay.send(JSON.stringify({
|
|
105
|
+
type: "route",
|
|
106
|
+
purpose,
|
|
107
|
+
device_id: host.deviceId,
|
|
108
|
+
endpoint_id: host.endpointId,
|
|
109
|
+
runtime_instance_id: host.runtimeInstanceId,
|
|
110
|
+
target_owner_id: ownerId,
|
|
111
|
+
ct,
|
|
112
|
+
}));
|
|
170
113
|
}
|
|
171
114
|
//# sourceMappingURL=peer_channel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_channel.js","sourceRoot":"","sources":["../../src/transport/peer_channel.ts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