diff --git a/packages/wire/CHANGELOG.md b/packages/wire/CHANGELOG.md index 6e75b705b..422951a63 100644 --- a/packages/wire/CHANGELOG.md +++ b/packages/wire/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Breaking Changes + +- Bumped `COLLAB_PROTO` to `3`: the `ui-request`/`ui-request-end` host frames and `ui-response` guest frame are part of the handshake contract. Proto-2 guests, which silently dropped host ask requests, are now rejected at hello with the protocol-mismatch error. + ### Added - Added collaboration UI request/response wireframes, enabling browser guests to respond to host-side interactive prompts. diff --git a/packages/wire/src/index.ts b/packages/wire/src/index.ts index 752ce8919..57d549770 100644 --- a/packages/wire/src/index.ts +++ b/packages/wire/src/index.ts @@ -389,8 +389,12 @@ export type WireFrame = GuestFrame | HostFrame; * transcript entries follow in `snapshot-chunk` frames, so multi-MB * sessions are not gated on a single welcome frame fitting under the * guest's first-welcome timeout. + * - `3`: host asks guests through `ui-request`/`ui-request-end` host frames + * answered by the `ui-response` guest frame. Guests that predate the + * grammar would silently drop `ui-request` (asks hang forever on the + * host), so they must be rejected at hello. */ -export const COLLAB_PROTO = 2; +export const COLLAB_PROTO = 3; /** Parameter key used for intent tracing (e.g. prompt explanation/reasoning) */ export const INTENT_FIELD = "i"; diff --git a/packages/wire/test/constants.test.ts b/packages/wire/test/constants.test.ts index 6acd1491c..282d0ca86 100644 --- a/packages/wire/test/constants.test.ts +++ b/packages/wire/test/constants.test.ts @@ -9,7 +9,7 @@ import { describe("collab wire constants", () => { it("exports the protocol constants consumed by host, guest, and relay links", () => { - expect(COLLAB_PROTO).toBe(2); + expect(COLLAB_PROTO).toBe(3); expect(COLLAB_PROMPT_MESSAGE_TYPE).toBe("collab-prompt"); expect(ENVELOPE_HEADER_LENGTH).toBe(4); expect(ROOM_ID_BYTES).toBe(16); diff --git a/scripts/install-tests/run-ci.sh b/scripts/install-tests/run-ci.sh index 64ae5c18f..247904412 100755 --- a/scripts/install-tests/run-ci.sh +++ b/scripts/install-tests/run-ci.sh @@ -170,7 +170,7 @@ mkdir -p "$TARBALL_APP_DIR" exit 1 } wire_proto="$(bun -e 'import { COLLAB_PROTO } from "@oh-my-pi/pi-wire"; process.stdout.write(String(COLLAB_PROTO));')" - [ "$wire_proto" = "2" ] || { + [ "$wire_proto" = "3" ] || { echo "Unexpected @oh-my-pi/pi-wire COLLAB_PROTO: $wire_proto" exit 1 }