@threadbase-sh/streamer 1.52.4 → 1.52.6

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.
@@ -1,6 +1,21 @@
1
1
  -- Paired-device registry (C5 scoped device capabilities).
2
2
  -- See docs/architecture/2026-07-24-device-identity-and-capabilities.md.
3
3
  --
4
+ -- SUPERSEDED. The live registry is now `runtime-migrations/003_create_devices.sql`
5
+ -- in runtime.db; this table is no longer read or written after boot.
6
+ --
7
+ -- It is still CREATED on a fresh cache, but it is left EMPTY:
8
+ -- RuntimeStore.importLegacyDevices() moves any rows into runtime.db on the first
9
+ -- boot after the move and then deletes them here. A `devices` row carries a
10
+ -- user-supplied device label, and keeping a second copy of that indefinitely —
11
+ -- in the one file users are told to delete when something goes wrong — retains
12
+ -- more personal data than the rollback path is worth.
13
+ --
14
+ -- Consequence, deliberate: rolling back to a streamer older than the move means
15
+ -- re-pairing, because this table will be empty. That costs a QR scan.
16
+ --
17
+ -- Do not add columns here — add them to the runtime migration instead.
18
+ --
4
19
  -- Pairing exchanged a short-lived token for the streamer's API key — the SAME
5
20
  -- string for every device that ever paired. Nothing recorded that a device
6
21
  -- existed, so there was no attribution, no per-device revocation (rotating the
@@ -0,0 +1,52 @@
1
+ -- Paired-device registry (C5 scoped device capabilities).
2
+ -- See docs/architecture/2026-07-24-device-identity-and-capabilities.md.
3
+ --
4
+ -- MOVED HERE from cache.db (migration 011_create_devices.sql), which was the
5
+ -- wrong file for it. Everything in cache.db is rebuildable from ~/.claude and
6
+ -- ~/.codex, which is why "delete the cache and restart" is reasonable support
7
+ -- advice, why `tb-streamer cache clear` deletes it outright, and why the
8
+ -- integrity monitor offers a reset-and-rescan action. A device registry is
9
+ -- rebuildable from nothing: losing it invalidates every device token issued so
10
+ -- far. Leaving it there made every paired device one documented troubleshooting
11
+ -- step away from having to re-pair — which is why the narrower device
12
+ -- credential could not safely be adopted by the client while it lived in the
13
+ -- cache.
14
+ --
15
+ -- The pre-split table in cache.db is MOVED here once by
16
+ -- RuntimeStore.importLegacyDevices(): copied, verified by row count, then
17
+ -- deleted from the cache. Unlike managed_sessions, no second copy is left
18
+ -- behind — a device row carries a user-supplied label, and duplicating that on
19
+ -- disk indefinitely retains more personal data than a rollback path whose
20
+ -- recovery is re-scanning a pairing QR.
21
+ CREATE TABLE IF NOT EXISTS devices (
22
+ -- Minted server-side. A client-supplied id would let one device claim
23
+ -- another's identity.
24
+ device_id TEXT PRIMARY KEY,
25
+
26
+ -- The client public key already supplied at pairing, previously used once as
27
+ -- a sealing target and then discarded.
28
+ public_key TEXT NOT NULL,
29
+
30
+ -- SHA-256 of the device token, never the token itself: a read of this table
31
+ -- must not let anyone impersonate a device. Same reasoning as password hashes.
32
+ token_hash TEXT NOT NULL UNIQUE,
33
+
34
+ -- Client-supplied label ("Ronen's iPhone"). Display only, never trusted for
35
+ -- authorization.
36
+ name TEXT,
37
+
38
+ -- JSON array of capability strings. Unknown entries are dropped on read, so a
39
+ -- downgrade cannot silently grant a capability this build does not understand.
40
+ capabilities TEXT NOT NULL,
41
+
42
+ created_at INTEGER NOT NULL,
43
+ last_seen_at INTEGER,
44
+
45
+ -- Set to revoke. Checked per request rather than cached — a stale cache is
46
+ -- exactly the window that makes revocation useless.
47
+ revoked_at INTEGER
48
+ );
49
+
50
+ -- Authentication looks a device up by token hash on every request, so this is
51
+ -- the hot path.
52
+ CREATE INDEX IF NOT EXISTS idx_devices_token_hash ON devices (token_hash);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadbase-sh/streamer",
3
- "version": "1.52.4",
3
+ "version": "1.52.6",
4
4
  "description": "PTY session management, WebSocket streaming, and REST API server for Claude Code conversations",
5
5
  "license": "MIT",
6
6
  "author": "Ronen Mars",