@oh-my-pi/pi-wire 15.11.8 → 15.12.1

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/CHANGELOG.md CHANGED
@@ -2,8 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [15.12.0] - 2026-06-12
6
+ ### Added
7
+
8
+ - Added `readOnly` flags to participant and session payload types to indicate when a guest is connected via a read-only (view) link
9
+ - Added `writeToken` to `GuestFrame` hello payloads and parsed collaboration links so full-access links can carry and expose a write-capability token
10
+ - Added `ROOM_KEY_BYTES` and `WRITE_TOKEN_BYTES` constants for room key and write-token sizing in the wire protocol
11
+ - Added `DEFAULT_SHARE_URL` (`https://my.omp.sh/s`), the default share viewer/upload base for `/share` links
12
+
5
13
  ## [15.11.8] - 2026-06-12
6
14
 
7
15
  ### Added
8
16
 
9
- - Added shared collab live-session wire contracts for the host CLI and browser guest client.
17
+ - Added shared collab live-session wire contracts for the host CLI and browser guest client.
@@ -213,6 +213,8 @@ export interface ContextUsage {
213
213
  export interface Participant {
214
214
  name: string;
215
215
  role: "host" | "guest";
216
+ /** True when the guest joined through a read-only (view) link. */
217
+ readOnly?: boolean;
216
218
  }
217
219
  /** Debounced footer snapshot broadcast by the host. */
218
220
  export interface SessionState {
@@ -285,6 +287,12 @@ export type GuestFrame = {
285
287
  t: "hello";
286
288
  proto: number;
287
289
  name: string;
290
+ /**
291
+ * base64url write token proving full-link possession; absent for
292
+ * read-only (view) links. The host marks peers without a valid token
293
+ * read-only and rejects their mutating frames.
294
+ */
295
+ writeToken?: string;
288
296
  } | {
289
297
  t: "prompt";
290
298
  text: string;
@@ -311,6 +319,8 @@ export type HostFrame = {
311
319
  entries: SessionEntry[];
312
320
  state: SessionState;
313
321
  agents: AgentSnapshot[];
322
+ /** True when this peer joined through a read-only (view) link. */
323
+ readOnly?: boolean;
314
324
  } | {
315
325
  t: "entry";
316
326
  entry: SessionEntry;
@@ -350,13 +360,25 @@ export declare const COLLAB_PROTO = 1;
350
360
  /** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
351
361
  export declare const ENVELOPE_HEADER_LENGTH = 4;
352
362
  export declare const ROOM_ID_BYTES = 16;
363
+ /** AES-256-GCM room key; the seal key for every collab frame. */
364
+ export declare const ROOM_KEY_BYTES = 32;
365
+ /**
366
+ * Random write token appended to the room key in full links
367
+ * (`base64url(key ∥ token)`); view links carry the bare key. Possession
368
+ * proves prompt/abort/agent-cmd capability to the host.
369
+ */
370
+ export declare const WRITE_TOKEN_BYTES = 16;
353
371
  /** Default public relay; bare `<roomId>#<key>` links resolve against it. */
354
- export declare const DEFAULT_RELAY_URL = "wss://relay.omp.sh";
372
+ export declare const DEFAULT_RELAY_URL = "wss://my.omp.sh";
373
+ /** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
374
+ export declare const DEFAULT_SHARE_URL = "https://my.omp.sh/s";
355
375
  export interface ParsedCollabLink {
356
376
  /** wss://host[:port]/r/<roomId> — no query, no fragment. */
357
377
  wsUrl: string;
358
378
  roomId: string;
359
379
  key: Uint8Array;
380
+ /** Write token from a full link; absent for read-only (view) links. */
381
+ writeToken?: Uint8Array;
360
382
  }
361
383
  /** Relay → host control message. */
362
384
  export type RelayControlToHost = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-wire",
4
- "version": "15.11.8",
4
+ "version": "15.12.1",
5
5
  "description": "Shared wire protocol types for Oh My Pi packages",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
package/src/index.ts CHANGED
@@ -217,6 +217,8 @@ export interface ContextUsage {
217
217
  export interface Participant {
218
218
  name: string;
219
219
  role: "host" | "guest";
220
+ /** True when the guest joined through a read-only (view) link. */
221
+ readOnly?: boolean;
220
222
  }
221
223
 
222
224
  /** Debounced footer snapshot broadcast by the host. */
@@ -296,7 +298,17 @@ export interface SubagentLifecyclePayload {
296
298
  // ═══════════════════════════════════════════════════════════════════════════
297
299
 
298
300
  export type GuestFrame =
299
- | { t: "hello"; proto: number; name: string }
301
+ | {
302
+ t: "hello";
303
+ proto: number;
304
+ name: string;
305
+ /**
306
+ * base64url write token proving full-link possession; absent for
307
+ * read-only (view) links. The host marks peers without a valid token
308
+ * read-only and rejects their mutating frames.
309
+ */
310
+ writeToken?: string;
311
+ }
300
312
  | { t: "prompt"; text: string; images?: ImageContent[] }
301
313
  | { t: "abort" }
302
314
  | { t: "agent-cmd"; cmd: "chat" | "kill" | "revive"; agentId: string; text?: string }
@@ -313,6 +325,8 @@ export type HostFrame =
313
325
  entries: SessionEntry[];
314
326
  state: SessionState;
315
327
  agents: AgentSnapshot[];
328
+ /** True when this peer joined through a read-only (view) link. */
329
+ readOnly?: boolean;
316
330
  }
317
331
  | { t: "entry"; entry: SessionEntry }
318
332
  | { t: "event"; event: AgentEvent }
@@ -339,14 +353,29 @@ export const ENVELOPE_HEADER_LENGTH = 4;
339
353
 
340
354
  export const ROOM_ID_BYTES = 16;
341
355
 
356
+ /** AES-256-GCM room key; the seal key for every collab frame. */
357
+ export const ROOM_KEY_BYTES = 32;
358
+
359
+ /**
360
+ * Random write token appended to the room key in full links
361
+ * (`base64url(key ∥ token)`); view links carry the bare key. Possession
362
+ * proves prompt/abort/agent-cmd capability to the host.
363
+ */
364
+ export const WRITE_TOKEN_BYTES = 16;
365
+
342
366
  /** Default public relay; bare `<roomId>#<key>` links resolve against it. */
343
- export const DEFAULT_RELAY_URL = "wss://relay.omp.sh";
367
+ export const DEFAULT_RELAY_URL = "wss://my.omp.sh";
368
+
369
+ /** Default share viewer/upload base; `/share` links resolve against `<base>/<id>#<key>`. */
370
+ export const DEFAULT_SHARE_URL = "https://my.omp.sh/s";
344
371
 
345
372
  export interface ParsedCollabLink {
346
373
  /** wss://host[:port]/r/<roomId> — no query, no fragment. */
347
374
  wsUrl: string;
348
375
  roomId: string;
349
376
  key: Uint8Array;
377
+ /** Write token from a full link; absent for read-only (view) links. */
378
+ writeToken?: Uint8Array;
350
379
  }
351
380
 
352
381
  // ═══════════════════════════════════════════════════════════════════════════