@oh-my-pi/pi-wire 16.1.6 → 16.1.8

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,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [16.1.8] - 2026-06-20
6
+
7
+ ### Breaking Changes
8
+
9
+ - Bumped `COLLAB_PROTO` to `2`. The `welcome` host frame now carries metadata only (`header`, `state`, `agents`, `entryCount`, optional `readOnly`) — the transcript moves to a new `snapshot-chunk` host frame (`{ entries: SessionEntry[]; final: boolean }`) sent immediately after the welcome. Hosts split large snapshots into multiple chunks; the last chunk carries `final: true`. Old guests speaking proto v1 are rejected with the existing protocol-mismatch error. ([#3144](https://github.com/can1357/oh-my-pi/issues/3144))
10
+
5
11
  ## [15.12.4] - 2026-06-13
6
12
 
7
13
  ### Changed
@@ -317,11 +317,28 @@ export type HostFrame = {
317
317
  t: "welcome";
318
318
  proto: number;
319
319
  header: SessionHeader;
320
- entries: SessionEntry[];
321
320
  state: SessionState;
322
321
  agents: AgentSnapshot[];
322
+ /**
323
+ * Total number of `SessionEntry` items the host will deliver in the
324
+ * `snapshot-chunk` frames that follow. Guests stay in the loading
325
+ * phase until they have accumulated all of them (or a chunk arrives
326
+ * with `final: true`).
327
+ */
328
+ entryCount: number;
323
329
  /** True when this peer joined through a read-only (view) link. */
324
330
  readOnly?: boolean;
331
+ }
332
+ /**
333
+ * Targeted snapshot fragment delivered after `welcome`. Hosts split the
334
+ * transcript into chunks bounded by byte size so a multi-MB session is not
335
+ * forced through one giant frame the relay may stall on. The last chunk
336
+ * carries `final: true`; guests finalize the replica on that frame.
337
+ */
338
+ | {
339
+ t: "snapshot-chunk";
340
+ entries: SessionEntry[];
341
+ final: boolean;
325
342
  } | {
326
343
  t: "entry";
327
344
  entry: SessionEntry;
@@ -356,8 +373,16 @@ export type HostFrame = {
356
373
  message: string;
357
374
  };
358
375
  export type WireFrame = GuestFrame | HostFrame;
359
- /** Wire protocol version carried in `hello`; the host rejects mismatches. */
360
- export declare const COLLAB_PROTO = 1;
376
+ /**
377
+ * Wire protocol version carried in `hello`; the host rejects mismatches.
378
+ *
379
+ * - `1` (legacy): `welcome` carried the full `entries` array inline.
380
+ * - `2`: `welcome` carries only metadata (header/state/agents/entryCount);
381
+ * transcript entries follow in `snapshot-chunk` frames, so multi-MB
382
+ * sessions are not gated on a single welcome frame fitting under the
383
+ * guest's first-welcome timeout.
384
+ */
385
+ export declare const COLLAB_PROTO = 2;
361
386
  /** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
362
387
  export declare const INTENT_FIELD = "i";
363
388
  /** Plaintext envelope prefix: `[4B uint32 BE peerId][sealed payload]`. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-wire",
4
- "version": "16.1.6",
4
+ "version": "16.1.8",
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
@@ -323,12 +323,25 @@ export type HostFrame =
323
323
  t: "welcome";
324
324
  proto: number;
325
325
  header: SessionHeader;
326
- entries: SessionEntry[];
327
326
  state: SessionState;
328
327
  agents: AgentSnapshot[];
328
+ /**
329
+ * Total number of `SessionEntry` items the host will deliver in the
330
+ * `snapshot-chunk` frames that follow. Guests stay in the loading
331
+ * phase until they have accumulated all of them (or a chunk arrives
332
+ * with `final: true`).
333
+ */
334
+ entryCount: number;
329
335
  /** True when this peer joined through a read-only (view) link. */
330
336
  readOnly?: boolean;
331
337
  }
338
+ /**
339
+ * Targeted snapshot fragment delivered after `welcome`. Hosts split the
340
+ * transcript into chunks bounded by byte size so a multi-MB session is not
341
+ * forced through one giant frame the relay may stall on. The last chunk
342
+ * carries `final: true`; guests finalize the replica on that frame.
343
+ */
344
+ | { t: "snapshot-chunk"; entries: SessionEntry[]; final: boolean }
332
345
  | { t: "entry"; entry: SessionEntry }
333
346
  | { t: "event"; event: AgentEvent }
334
347
  | { t: "state"; state: SessionState }
@@ -342,8 +355,16 @@ export type HostFrame =
342
355
 
343
356
  export type WireFrame = GuestFrame | HostFrame;
344
357
 
345
- /** Wire protocol version carried in `hello`; the host rejects mismatches. */
346
- export const COLLAB_PROTO = 1;
358
+ /**
359
+ * Wire protocol version carried in `hello`; the host rejects mismatches.
360
+ *
361
+ * - `1` (legacy): `welcome` carried the full `entries` array inline.
362
+ * - `2`: `welcome` carries only metadata (header/state/agents/entryCount);
363
+ * transcript entries follow in `snapshot-chunk` frames, so multi-MB
364
+ * sessions are not gated on a single welcome frame fitting under the
365
+ * guest's first-welcome timeout.
366
+ */
367
+ export const COLLAB_PROTO = 2;
347
368
 
348
369
  /** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */
349
370
  export const INTENT_FIELD = "i";