diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index fb1b348f..83ee1729 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -12,9 +12,9 @@ source locations, and required attributions are included at the stated archive p ## Bundled runtime dependencies -### @oh-my-pi/pi-wire@18.20.0 +### @oh-my-pi/pi-wire@19.1.1 -- Source: +- Source: - License: MIT - Copyright: Copyright (c) 2025-2026 Can Bölük; Copyright (c) 2026 Stencil Labs, Inc. - License text: `licenses/runtime/@oh-my-pi__pi-wire/LICENSE` @@ -187,8 +187,8 @@ source locations, and required attributions are included at the stated archive p ### @oh-my-pi/collab-web@16.3.6 -- Source: -- Pinned source: tag `v18.20.0`, commit `c308970263ae13744ea15ab67302e3dac840e266` +- Source: +- Pinned source: tag `v19.1.1`, commit `31ffee513f27a01bba7d4dfbe12bae239cdc646a` - License: MIT - Copyright: Copyright (c) 2025 Mario Zechner; Copyright (c) 2025-2026 Can Bölük; Copyright (c) 2026 Stencil Labs, Inc. - License text: `licenses/collab-web/LICENSE` @@ -199,15 +199,16 @@ source locations, and required attributions are included at the stated archive p metadata stripping, bounds, volatile previews, transcript acknowledgements, and retry; foreground, online, relay-room, and gateway-health transport recovery; generation-bound sends with fresh hello; long-transcript windowing and coalescing-safe live-transition tail reset; exact-optional typing; - redacted capability errors; retained hub-family renderers; speech input; artwork exclusion; and - the gateway's self-hosted PUA symbol fallback. All dispositions are in `upstream/UPSTREAM.json`. + redacted capability errors; retained hub-family renderers and older hosts' `xd://` and + `artifact://` tool output; speech input; artwork exclusion; and the gateway's self-hosted PUA + symbol fallback. All dispositions are in `upstream/UPSTREAM.json`. -### @oh-my-pi/pi-utils@18.20.0 — vendored pure helpers only +### @oh-my-pi/pi-utils@19.1.1 — vendored pure helpers only -- Source: +- Source: - Exact source files: `marked.ts`, `marked/core.ts`, `marked/inline-closers.ts`, - `marked/inline-text.ts`, `marked-list.ts`, `math-delimiters.ts`, and `bytes.ts`, copied without modifications - into `packages/collab-client/upstream/src/vendor/pi-utils/`. + `marked/inline-text.ts`, `marked-list.ts`, `math-delimiters.ts`, `bytes.ts`, and `spill-url.ts`, + copied without modifications into `packages/collab-client/upstream/src/vendor/pi-utils/`. - License: MIT; original Marked MIT and Markdown BSD-3-Clause notices are preserved. - Copyright: Copyright (c) 2018+ MarkedJS; Copyright (c) 2011-2018 Christopher Jeffrey; Copyright (c) 2004 John Gruber; Copyright (c) 2025 Mario Zechner; diff --git a/UPSTREAM.lock.json b/UPSTREAM.lock.json index ddea18ba..9eeba2ce 100644 --- a/UPSTREAM.lock.json +++ b/UPSTREAM.lock.json @@ -1,14 +1,14 @@ { "$schema": "./schemas/upstream-lock.schema.json", "status": "pinned-main", - "observedAt": "2026-11-13", + "observedAt": "2026-11-23", "repository": "https://github.com/can1357/oh-my-pi", - "tag": "v18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", - "packageVersion": "18.20.0", + "tag": "v19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", + "packageVersion": "19.1.1", "packageVersions": { - "@oh-my-pi/pi-coding-agent": "18.20.0", - "@oh-my-pi/pi-wire": "18.20.0", + "@oh-my-pi/pi-coding-agent": "19.1.1", + "@oh-my-pi/pi-wire": "19.1.1", "@oh-my-pi/collab-web": "16.3.6" }, "bunVersion": "1.4.4", @@ -30,6 +30,7 @@ "packages/collab-web/src/lib/client.ts" ], "notes": [ + "Baseline moved to published mainline OMP v19.1.1 on 2026-11-23. scripts/upstream-pins.ts derives the commit, tree, package versions and both official native pins; registry sha512 integrity and sha1 shasum are verified before hashing, and both native file names are unchanged. Relative to v18.20.0, registry.ts, settings.ts and docs/collab.md are byte-identical; minimum host 18.1.20, registry v1, discovery paths, query shapes, COLLAB_PROTO 3 and the relay envelope remain unchanged. The changes below shipped in v19.1.0; v19.1.1 changes the relevant paths only in docs/extensions.md (extension todo backends) and package versions. Native IPC moves from crates/pi-natives to crates/natives (35d76ddd82) and adds TCP and raw-upgrade primitives (3302a13eed); endpoint.rs, unix.rs and windows.rs are unchanged, and the registry still serves one lines-framed request and response per local connection. The host accepts writer-only resume and deliver-queue guest frames and an optional prompt followUp flag (82e8e939a7), coalesces queued subagent progress per agent id (8e784dd326, 8ef822a102), and re-encodes the session's new agent_pause as the agent_end with isTerminal false and yielded flags that 18.20.0 hosts already sent (loop-end-wire.ts), so guest frames stay compatible. collab-web changes lib/client.ts (failed-welcome rejoin, image and followUp prompts, resume and deliver-queue senders), streaming Markdown, and the bash, resolve and web-search renderers; the embedded client adopts them through its own reviewed refresh recorded in packages/collab-client/upstream/UPSTREAM.json, not through this host pin. The daily canary resolving npm latest passed every Linux stage and every supported Windows stage on 19.0.0, 19.0.1 and 19.1.0 (runs 44577425931, 44779508819, 44923572742 and 45044046190), and the pull-request canary at c945ade8 (run 45122265372) installed 19.1.1 and passed the same stages. This source pin is not a candidate, qualification or installed-byte smoke result; published v0.12.0 and its v18.20.0 qualification remain unchanged.", "Baseline moved to published mainline OMP v18.20.0 on 2026-11-13. scripts/upstream-pins.ts derives the commit, tree, package versions and both official native pins; registry sha512 integrity and sha1 shasum are verified before hashing. Relative to v18.18.0, registry.ts, settings.ts, docs/collab.md and native IPC sources are byte-identical; minimum host 18.1.20, registry v1, discovery and relay envelope remain unchanged. Host per-peer backlog shedding adds error.resync and re-hello recovery; select requests add optional approval metadata. collab-web changes lib/client.ts and ask/task rendering, including HTML-form ask results; the embedded client adopts them through its own reviewed refresh recorded in packages/collab-client/upstream/UPSTREAM.json, not through this host pin. Upstream 7027a619a41c1eccdae6a5f07de91c43e2a487e3 changes successful rewind status to Rewound N turns; the canary matcher accepts the counted singular and plural forms as well as the old text. This source pin is not a live canary, candidate, qualification or installed-byte smoke result; published v0.11.0 and its qualification remain unchanged.", "Baseline moved to published mainline OMP v18.18.0 on 2026-11-07. scripts/upstream-pins.ts derived the source, package, tree, and native pins from official sources; independent tarball measurements matched registry sha512 integrity and sha1 shasum. Relative to v18.17.0, the complete coding-agent collab subtree, collab-web subtree, native IPC subtree, collaboration commands, extension UI controller, modes/types.ts, docs/collab.md, docs/extensions.md, and wire/index.ts are byte-identical. wire/shell-trace.ts now accepts string | number[] for non-UTF-8 run bytes in bash details.trace. The current embedded v18.12.6 client preserves those JSON arrays but does not consume trace visualization; its bash renderer keeps command, text, images, and status badges. Bash results also gain additive cwd/cdSeparator metadata, and write results may carry touchesNoFiles, which the current client does not consume. Upstream collab-web's asStrictBytes helper is byte-for-byte equivalent in behavior to the embedded codec's local asStrict helper; no codec runtime incompatibility was found. Client provenance and pi-wire remain independently pinned at v18.12.6 for the separate client refresh. Exact-version canary run 42337262675 passed all eleven Linux stages and eight supported Windows stages at gateway 9a3388fd7a96342b1e31989305bf68f6d2958234; three lifecycle stages are intentionally skipped on Windows. This is Tested evidence only; no v18.18.0 release qualification is claimed, and published v0.9.1 retains its v18.17.0 qualification.", "Baseline moved to published mainline OMP v18.17.0 on 2026-11-06 (PR #559). Relative to v18.16.0, the relevant paths change in: PR #17960 (merge b0b565c1c0; 9c31dcdd39, 8e4f72d2fd) and PR #17997 (merge 7ceb801092; b94281fc50), which add extension transcript presenters (registerTranscriptPresenter, ctx.ui.refreshTranscript) in extension-ui-controller.ts, modes/types.ts, and docs/extensions.md and make collab/guest.ts claim and release the CLI guest through ctx.setCollabGuest() instead of assigning ctx.collabGuest; these are TUI, extension, and CLI-guest surfaces, and host.ts and registry.ts are unchanged, so inputRequired and the ask representation are unchanged; PR #16476 (merge 544cacab86; d00abaeca7, f9eb7ac058), which adds an extension link browser in extension-ui-controller.ts, modes/types.ts, and docs/extensions.md and makes editor-area dialogs and asks close it before mounting, a terminal-only change; PR #17961 (merge 84c92fbbf4; ac3305bb7e), which adds getShortcutConflict and exposes keybindings to extensions in extension-ui-controller.ts and docs/extensions.md; PR #17848 (merge ef3293b64f; 6ccb40f969, c9779c5e06, 4e9af0ca5e), which adds the in-session pin indicator and /unpin through notifySessionPinChanged in builtin-registry.ts and modes/types.ts, leaving /collab, /join, and /leave unchanged; direct commits 488cafa0e0 and fcdda683f1, which visualize bash execution from native run traces through new packages/wire/src/shell-trace.ts and shell-viz.ts and native RunTrace, ShellVisualization, and runShellMain exports, while packages/wire/src/index.ts only adds the shell-trace and shell-viz exports and leaves relay envelope helpers and types unchanged; direct commit a55b04a332, which adds TSP code heat, wash, folds, and overview in packages/wire/src/tsp.ts, a Tern surface for which the gateway has no reader; direct commit adcb8800b6, which stops wait peer chatter and staggered jobs from chaining waits by changing the host's packages/coding-agent/src/tools/wait.ts result details.waited from one message to a list of messages (null still means timed out) and rendering the list in packages/collab-web/src/tool-render/tools/irc.tsx and its test; the embedded v18.12.6 client parsed waited as one message, so v18.17.0 host wait cards degraded to ← anyone plus raw result text, and PR #559 carries a local irc/wait renderer patch accepting both the new list and the older single message, an embedded-client rendering change only with no frame, protocol, relay, or registry change; client provenance stays v18.12.6 with one more local patch recorded in packages/collab-client/upstream/UPSTREAM.json; direct commit 19ef041ec5, which hardens only packages/natives/test/ipc.test.ts without changing IPC sources; and the version bumps and dependency pinning in root package.json and package manifests, with no Bun engine or packageManager change. The gateway's registry and relay contract is unchanged. packages/coding-agent/src/collab/host.ts, registry.ts, and settings.ts, packages/coding-agent/src/slash-commands/builtin-collaboration.ts, docs/collab.md, packages/collab-web/src/app.tsx and src/lib/client.ts, and crates/pi-natives/src/ipc/mod.rs, unix.rs, and windows.rs are byte-identical, so registry v1 query/response and token check, the discovery file format and socket paths, the relay protocol, and collab.autoStart behavior are unchanged. Minimum host stays 18.1.20 and gateway Bun stays 1.4.4. @oh-my-pi/pi-coding-agent and @oh-my-pi/pi-wire move to 18.17.0 and @oh-my-pi/collab-web stays 16.3.6; the embedded client keeps its v18.12.6 provenance and pi-wire 18.12.6 pin with the carried local wait-rendering patch. scripts/upstream-pins.ts derived the tag, commit, tree, package versions, and both native pins from official npm tarballs after verifying registry integrity. Exact-version canary run 42239663270 passed for stock OMP 18.17.0: all eleven Linux stages and the eight supported Windows stages, with new-generation, fork, and branch-rewind skipped by design on Windows. This is Tested evidence only, not qualification: no candidate or qualification is claimed for v18.17.0, and published v0.9.0 remains qualified on v18.12.5.", @@ -48,9 +49,9 @@ "The embedded client keeps its collab-web provenance and npm pi-wire pin at v18.4.2. Upstream collab-web at v18.5.1 differs from v18.4.2 only in its changelog and the transcript/math.ts Markdown performance changes first shipped in v18.4.12; this host-only baseline update does not import them. Client provenance and local modifications remain recorded independently in packages/collab-client/upstream/UPSTREAM.json.", "scripts/upstream-pins.ts derived the tag, commit, tree, package versions, and both native pins. The Darwin arm64 native hashes identify the official 18.5.1 npm tarball and its pi_natives.darwin-arm64.node payload; the tarball matched the registry sha512 integrity and sha1 shasum before hashing. These measured source-build inputs are not a qualification result. The script requires every relevant path to exist at the tag: collab settings live in packages/coding-agent/src/collab/settings.ts, and the earlier packages/coding-agent/src/config/settings-schema.ts entry named a file upstream deleted before v18.4.2." ], - "tree": "ba890953dd69eb4bf73bb7233bbe50ccfacd6912", + "tree": "3f27b6346d6319234bcd91d8148c15d077cea436", "darwinArm64Native": { - "tarballSha256": "820b308b4869e7f34a50d91554f57e79e30a9c896ced0d8ca89cf470f9dbb066", - "binarySha256": "50c4795066df814cea3a0849109dd86c11089f8bccef0736681b29801cdaaa5c" + "tarballSha256": "707db13fe015b01589728a44b73c82f03df1deb28ba5704b69649ea9dd5e8fc0", + "binarySha256": "c2afb0d332e6f8f04ecd05fafe0b5838ca47c5748a9ed9d150de0a6db67f2cf7" } } diff --git a/bun.lock b/bun.lock index 7bde16fc..968a52ec 100644 --- a/bun.lock +++ b/bun.lock @@ -39,7 +39,7 @@ "name": "@omp-session-gateway/collab-client", "version": "0.12.0", "dependencies": { - "@oh-my-pi/pi-wire": "18.20.0", + "@oh-my-pi/pi-wire": "19.1.1", "katex": "0.18.5", "lucide-react": "1.31.0", "react": "19.2.7", @@ -68,7 +68,7 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], - "@oh-my-pi/pi-wire": ["@oh-my-pi/pi-wire@18.20.0", "", {}, "sha512-EgX/010dxeclR5GBY/Hq3P3mNnHxBicuxN2THRJI38bpwc8UzvJAyhSVjTIjmEp4SQpoc3zYPLeor93dQ+FK8Q=="], + "@oh-my-pi/pi-wire": ["@oh-my-pi/pi-wire@19.1.1", "", {}, "sha512-ebhDjqUZy7d+du5UPHno5hdtpdget/d1J0E53g9eTKiySfYTk7iYEkzj6hLmk/zK0xXn7nFYIXJ0Vh3EAstRpw=="], "@omp-session-gateway/collab-client": ["@omp-session-gateway/collab-client@workspace:packages/collab-client"], diff --git a/changelog.d/changed-omp-19-1-baseline.md b/changelog.d/changed-omp-19-1-baseline.md new file mode 100644 index 00000000..63ebf53b --- /dev/null +++ b/changelog.d/changed-omp-19-1-baseline.md @@ -0,0 +1,2 @@ +- Advance the independent host engineering baseline to stock OMP 19.1.1 with measured source and + native pins; retain the minimum host and published qualification. diff --git a/changelog.d/changed-omp-19-1-client.md b/changelog.d/changed-omp-19-1-client.md new file mode 100644 index 00000000..26405a37 --- /dev/null +++ b/changelog.d/changed-omp-19-1-client.md @@ -0,0 +1,5 @@ +- Refresh the embedded client and wire dependency to exact OMP 19.1.1 source: rejoin instead of + going live when a later welcome fails to apply, keep finished streaming Markdown blocks' DOM, + nest bash tool-command cards, show brief intent labels and answerless web-search excerpts; keep + View guards on the new resume and deliver-queue senders and older hosts' xd:// and artifact:// + rendering. diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index 296b7724..8cfb4802 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -46,13 +46,13 @@ Qualified attention and lifecycle scope covers the Mac-guest new-generation, for Stock mainline OMP `>= 18.1.20` ([PR #11908](https://github.com/can1357/oh-my-pi/pull/11908), commit `4999b98bd5`) is the minimum supported OMP version: set `collab.autoStart` ([Operator settings](OMP_INTEGRATION.md#1-operator-settings)) and start participating sessions with plain `omp`. -The engineering host baseline (tested in CI) is `v18.20.0` in [`UPSTREAM.lock.json`](../UPSTREAM.lock.json), the qualified host baseline is in the matrix below, and the embedded browser client is pinned to the same source (`@oh-my-pi/collab-web` `16.3.6`, `@oh-my-pi/pi-wire` `18.20.0`) in [`packages/collab-client`](../packages/collab-client/README.md). +The engineering host baseline (tested in CI) is `v19.1.1` in [`UPSTREAM.lock.json`](../UPSTREAM.lock.json), the qualified host baseline is in the matrix below, and the embedded browser client is pinned to the same source (`@oh-my-pi/collab-web` `16.3.6`, `@oh-my-pi/pi-wire` `19.1.1`) in [`packages/collab-client`](../packages/collab-client/README.md). Under registry v1, the gateway validates only the fields it reads and ignores unknown additive fields ([ADR-028](DECISIONS.md#adr-028--consume-mainline-omp-discovery-and-resolve-capabilities-only-at-launch)); a registry major bump or a changed type on a consumed field requires a gateway update. -Upstream reviews across OMP releases through `v18.20.0` verified that registry v1, the discovery file format and native IPC query contract, the relay envelope layout, and `collab.autoStart` match this contract ([Baseline review record](UPSTREAM_STRATEGY.md#baseline-review-record)). The embedded client preserves non-UTF-8 byte arrays in bash `details.trace` without rendering shell trace visualizations, and adapts single-message `wait` results from pre-`v18.17.0` OMP hosts. +Upstream reviews across OMP releases through `v19.1.1` verified that registry v1, the discovery file format and native IPC query contract, the relay envelope layout, and `collab.autoStart` match this contract ([Baseline review record](UPSTREAM_STRATEGY.md#baseline-review-record)). The embedded client preserves non-UTF-8 byte arrays in bash `details.trace` without rendering shell trace visualizations, and adapts single-message `wait` results from pre-`v18.17.0` OMP hosts. -The canary's rewind matcher accepts upstream's positive `Rewound N turns` status as well as the old text. The pull-request canary that installed npm `latest` (18.20.0) passed every Linux stage and every supported Windows stage, with `branch-rewind` among the stages Windows skips by design, and a release request still runs the canary pinned to its exact version. Neither the matcher change nor that run qualifies a release. +The canary's rewind matcher accepts upstream's positive `Rewound N turns` status as well as the old text. The daily canary, which installs npm `latest`, passed every Linux stage and every supported Windows stage on 19.0.0, 19.0.1 and 19.1.0, and the pull-request canary passed the same stages on 19.1.1, with `new-generation`, `fork` and `branch-rewind` the stages Windows skips by design; a release request still runs the canary pinned to its exact version. Neither the matcher change nor those runs qualify a release. | Surface | Current contract | Qualification | diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index bcd24e83..557846d8 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -946,6 +946,40 @@ published v0.7.6 remains qualified on v18.8.9. --- +**Engineering baseline update (2026-11-23):** Pin published mainline v19.1.1 +(`31ffee513f27a01bba7d4dfbe12bae239cdc646a`, tree +`3f27b6346d6319234bcd91d8148c15d077cea436`). `scripts/upstream-pins.ts` derives +both native tarball/binary hashes after checking official npm integrity and shasum; +the native file names are unchanged. Agent and wire packages are `19.1.1`; +collab-web stays `16.3.6`, and Bun stays `1.4.4` (upstream requires `>=1.4.4`). +The registry, collab settings and collaboration documentation are byte-identical +to v18.20.0: minimum host `18.1.20`, registry v1, discovery paths, query shapes, +`COLLAB_PROTO` 3 and the relay envelope remain unchanged. The native IPC crate is +renamed and gains TCP and raw-upgrade primitives; its endpoint, Unix-socket and +named-pipe sources are unchanged. + +The host changes below shipped in v19.1.0; v19.1.1 changes the tracked paths only in +`docs/extensions.md` (extension todo backends) and package versions. The host +accepts writer-only `resume` and `deliver-queue` guest frames and an optional +prompt `followUp` flag, coalesces queued subagent progress per agent id, and +re-encodes the session's new `agent_pause` as the `agent_end` with +`isTerminal: false` and `yielded` flags that v18.20.0 hosts already sent. The +embedded client follows the collab-web changes in its own reviewed refresh, +committed separately with patch and provenance records in +`packages/collab-client/upstream/UPSTREAM.json`; a **View** capability still +rejects every mutating client method, including the new senders. Extension +provider takeover, `/copy local`, `/commit`, tray and Tern TSP changes add no +gateway registry fields. + +The daily canary that installs npm `latest` passed every Linux stage and every +supported Windows stage on 19.0.0, 19.0.1 and 19.1.0 (runs 44577425931, +44779508819, 44923572742 and 45044046190), and the pull-request canary at +`c945ade8` (run 45122265372) installed 19.1.1 and passed the same stages. No +candidate, qualification or installed-byte smoke is claimed, and published +v0.12.0 stays bound to its recorded v18.20.0 qualification. + +--- + **Engineering baseline update (2026-11-13):** Pin published mainline v18.20.0 (`c308970263ae13744ea15ab67302e3dac840e266`, tree `ba890953dd69eb4bf73bb7233bbe50ccfacd6912`) independently of the embedded client. diff --git a/docs/OMP_INTEGRATION.md b/docs/OMP_INTEGRATION.md index d4a44f61..fe026185 100644 --- a/docs/OMP_INTEGRATION.md +++ b/docs/OMP_INTEGRATION.md @@ -11,8 +11,8 @@ Production deployment requires Bun `1.4.4`, TUN-mode Tailscale Serve, an exact l | Surface | Pin or contract | Notes | |---|---|---| | Stock mainline OMP host | `>= 18.1.20` | Minimum OMP version supplying the native local registry (`collab.autoStart`). | -| Engineering host baseline | `v18.20.0` (`c308970263ae13744ea15ab67302e3dac840e266`) | Exact OMP commit and Git tree (`ba890953dd69eb4bf73bb7233bbe50ccfacd6912`) in [`UPSTREAM.lock.json`](../UPSTREAM.lock.json) ([Baseline review record](UPSTREAM_STRATEGY.md#baseline-review-record)). | -| Embedded browser client | `v18.20.0` (`@oh-my-pi/collab-web` `16.3.6`, `@oh-my-pi/pi-wire` `18.20.0`) | Provenance pin in [`packages/collab-client`](../packages/collab-client/README.md): independent `collab-web` source, wire dependency, and vendored `pi-utils` helper provenance, with bounded resync rejoin and older-host rendering retained. | +| Engineering host baseline | `v19.1.1` (`31ffee513f27a01bba7d4dfbe12bae239cdc646a`) | Exact OMP commit and Git tree (`3f27b6346d6319234bcd91d8148c15d077cea436`) in [`UPSTREAM.lock.json`](../UPSTREAM.lock.json) ([Baseline review record](UPSTREAM_STRATEGY.md#baseline-review-record)). | +| Embedded browser client | `v19.1.1` (`@oh-my-pi/collab-web` `16.3.6`, `@oh-my-pi/pi-wire` `19.1.1`) | Provenance pin in [`packages/collab-client`](../packages/collab-client/README.md): independent `collab-web` source, wire dependency, and vendored `pi-utils` helper provenance, with bounded resync rejoin and older-host rendering retained. | | Gateway runtime | Bun `1.4.4` | Required runtime for `omp-gateway` (the CLI), `omp-gatewayd` (the daemon), and release archives. | For the latest release and its qualified hardware matrix, see [Current claim](COMPATIBILITY.md#current-claim) and [Release status](RELEASE_STATUS.md). @@ -21,7 +21,7 @@ For the latest release and its qualified hardware matrix, see [Current claim](CO Under registry v1 ([Protocol](PROTOCOL.md)), the gateway validates only the fields it reads and ignores unknown additive fields ([ADR-028](DECISIONS.md#adr-028--consume-mainline-omp-discovery-and-resolve-capabilities-only-at-launch)). Any snapshot naming `prompt`, `question`, `options`, `prefill`, `answer`, `requestId`, or `count` is refused as a privacy violation. -The minimum host stayed at `18.1.20` when the engineering baseline moved to `v18.20.0`: its registry and native IPC sources are unchanged from `v18.18.0`, and the additive guest resync and `select.approval` markers affect the embedded browser client, not the gateway's metadata registry reader. +The minimum host stayed at `18.1.20` when the engineering baseline moved to `v19.1.1`: its registry and collab settings are unchanged from `v18.20.0`, its native IPC keeps the same local-socket and named-pipe query path, and the additive guest `resume`, `deliver-queue` and prompt `followUp` frames affect the embedded browser client, not the gateway's metadata registry reader. OMP hosts (one running `omp` process per collaboration entry) at `18.2.9` or newer ([PR #12844](https://github.com/can1357/oh-my-pi/pull/12844)) emit optional boolean `busy` (OMP's `session.isStreaming` state): `true` while running a turn, `false` while idle, and unknown when omitted or `null`. OMP `18.1.20`–`18.2.8` hosts appear in the directory with unknown activity; `busy` is not proof of task completion or process exit. diff --git a/docs/RELEASE_STATUS.md b/docs/RELEASE_STATUS.md index d529f616..d702dc21 100644 --- a/docs/RELEASE_STATUS.md +++ b/docs/RELEASE_STATUS.md @@ -1,17 +1,20 @@ # Release status -## Engineering update — OMP v18.20.0 (not a release) +## Engineering update — OMP v19.1.1 (not a release) The host source pin and, in separate commits, the embedded browser client -advance to `c308970263ae13744ea15ab67302e3dac840e266` -(tree `ba890953dd69eb4bf73bb7233bbe50ccfacd6912`). This is source compatibility -work only. The canary now recognizes upstream's counted rewind status; the -pull-request canary that installed npm `latest` (18.20.0) passed every Linux -stage and every supported Windows stage, with `branch-rewind` among the stages -Windows skips. A release request still runs the canary pinned to its exact version. -No candidate, qualification, signed publication or installed-byte smoke is -recorded by this update. Published v0.11.0 and the generated evidence below -remain unchanged. +advance to `31ffee513f27a01bba7d4dfbe12bae239cdc646a` +(tree `3f27b6346d6319234bcd91d8148c15d077cea436`). This is source compatibility +work only. The daily canary, which installs npm `latest`, passed every Linux stage +and every supported Windows stage on 19.0.0, 19.0.1 and 19.1.0, with +`new-generation`, `fork` and `branch-rewind` the stages Windows skips; 19.1.1 +changes the tracked collaboration paths only in extension docs and package +versions, and the pull-request canary at `c945ade8` (run 45122265372) installed +19.1.1 and passed the same stages. A release request still runs the canary pinned +to its exact version. No candidate, +qualification, signed publication or installed-byte smoke is recorded by this +update. Published v0.12.0, its v18.20.0 qualification and the generated evidence +below remain unchanged. ## Mainline v0.12.0 — published stable diff --git a/docs/UPSTREAM_STRATEGY.md b/docs/UPSTREAM_STRATEGY.md index 2770e01d..4257b466 100644 --- a/docs/UPSTREAM_STRATEGY.md +++ b/docs/UPSTREAM_STRATEGY.md @@ -42,6 +42,10 @@ Cite the merged general-purpose collaboration and discovery contribution ([PR #1 Entries below are dated upstream compatibility reviews and are kept as written. +### v19.1.1 — 2026-11-23 + +`v19.1.1` (`31ffee513f27a01bba7d4dfbe12bae239cdc646a`, tree `3f27b6346d6319234bcd91d8148c15d077cea436`) keeps the registry, collab settings and `docs/collab.md` byte-identical to v18.20.0, so registry v1, the discovery format, the query contract, `COLLAB_PROTO` 3, the relay envelope and the `18.1.20` minimum are unchanged. The changes below shipped in v19.1.0; v19.1.1 changes the tracked paths only in `docs/extensions.md` (extension todo backends) and package versions. The native IPC crate moves from `crates/pi-natives` to `crates/natives` and gains TCP and raw-upgrade primitives, while its endpoint, Unix-socket and named-pipe sources are unchanged and the registry still serves one lines-framed request and response per local connection. The host accepts writer-only `resume` and `deliver-queue` guest frames and an optional prompt `followUp` flag, coalesces queued subagent progress per agent id, and re-encodes the session's new `agent_pause` as the `agent_end` with `isTerminal: false` and `yielded` flags that v18.20.0 hosts already sent. `packages/collab-web` changes `lib/client.ts`, streaming Markdown and the bash, resolve and web-search renderers; the embedded client adopts those in its own reviewed refresh. The daily canary that installs npm `latest` passed every Linux stage and every supported Windows stage on 19.0.0, 19.0.1 and 19.1.0, and the pull-request canary at `c945ade8` (run 45122265372) installed 19.1.1 and passed the same stages. Source review only: no candidate, qualification or installed-byte smoke is claimed, and published v0.12.0 keeps its v18.20.0 qualification. + ### v18.20.0 — 2026-11-13 `v18.20.0` (`c308970263ae13744ea15ab67302e3dac840e266`, tree `ba890953dd69eb4bf73bb7233bbe50ccfacd6912`) keeps the registry, collab settings, `docs/collab.md` and the native IPC sources byte-identical to v18.18.0, so registry v1, the discovery format, the query contract, the relay envelope and the `18.1.20` minimum are unchanged. Host per-peer backlog shedding adds `error.resync` and re-hello recovery, and `select` requests gain optional `approval` metadata without a new response shape. `packages/collab-web` changes `lib/client.ts` and the Ask and task renderers, including HTML-form Ask results; the embedded client adopts those in its own reviewed refresh. Upstream `7027a619a41c1eccdae6a5f07de91c43e2a487e3` changes the successful rewind status to `Rewound N turns`, which the canary matcher now accepts alongside the old text. Source review only: no candidate, qualification or installed-byte smoke is claimed, and published v0.11.0 keeps its v18.18.0 qualification. diff --git a/docs/media/README.md b/docs/media/README.md index 32750c97..c357713e 100644 --- a/docs/media/README.md +++ b/docs/media/README.md @@ -15,8 +15,8 @@ bun run media:check `media:capture` builds the actual PWA and pinned collaboration client before capture. It publishes the canonical set only after staging the complete package. `media:check` verifies the binaries, manifest, public-safety rules, and root README references; it does not regenerate media. Both use `packages/collab-client/upstream/UPSTREAM.json` for browser-client provenance, independently of the OMP host baseline. -Source revision: `884e2b5d59c3580c497f8664b4ff263ba3d66546` -Pinned client: `v18.20.0` / `c308970263ae13744ea15ab67302e3dac840e266` (`@oh-my-pi/collab-web` 16.3.6) +Source revision: `6539ed095a0295cc1a657f48cbc57083ac66e489` +Pinned client: `v19.1.1` / `31ffee513f27a01bba7d4dfbe12bae239cdc646a` (`@oh-my-pi/collab-web` 16.3.6) Normalized tool versions: @@ -24,7 +24,7 @@ Normalized tool versions: - TypeScript 7.0.2 - Playwright 1.62.1 - Chromium 151.0.7922.34 -- FFmpeg 9.0 +- FFmpeg 9.0.2 - ffprobe 9.0.2 The synthetic clock is 2026-08-21T12:10:00.000Z, with locale en-US, timezone UTC, dark color scheme, and reduced motion. Mobile captures use a 390×844 CSS-pixel viewport at DPR 2, producing 780×1688 PNGs. diff --git a/docs/media/manifest.json b/docs/media/manifest.json index ba1d8f2a..0138390d 100644 --- a/docs/media/manifest.json +++ b/docs/media/manifest.json @@ -1,9 +1,9 @@ { "schemaVersion": 1, - "sourceRevision": "884e2b5d59c3580c497f8664b4ff263ba3d66546", + "sourceRevision": "6539ed095a0295cc1a657f48cbc57083ac66e489", "upstreamClient": { - "tag": "v18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "tag": "v19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "packageVersion": "16.3.6" }, "generatedBy": { @@ -12,7 +12,7 @@ "typescript": "7.0.2", "playwright": "1.62.1", "chromium": "151.0.7922.34", - "ffmpeg": "9.0", + "ffmpeg": "9.0.2", "ffprobe": "9.0.2" }, "capture": { @@ -33,8 +33,8 @@ }, "assets": { "omp-session-gateway-demo.gif": { - "bytes": 369424, - "sha256": "a361fcab3adb8aa39592f764d68e156c8862405d139cf7716c92c9b702e4c529", + "bytes": 371451, + "sha256": "3dd0a4ffe7ee3050fbb49b1841f9e170d74f8d894b232baba0a9150cd193ba98", "width": 960, "height": 540, "provenance": "capture-only-presentation-composite", @@ -70,8 +70,8 @@ ] }, "omp-session-gateway-demo.mp4": { - "bytes": 398969, - "sha256": "3c3f35828d2382eea84ed8b1a88654a2c1f94ca6aa77b69facacf8f59fe1dcce", + "bytes": 398982, + "sha256": "9a80114bdc594295020bec56b464c1f0e7121f4d780c6ad358f522bb2478f2f4", "width": 960, "height": 540, "provenance": "capture-only-presentation-composite", @@ -108,8 +108,8 @@ ] }, "omp-session-gateway-demo-poster.png": { - "bytes": 71649, - "sha256": "9bfa8abcb307226ebfba8880985a5f4452cc13770422b4a96575011a9535ca58", + "bytes": 71657, + "sha256": "be8bdf765c24573407e55f95c4c6f9eba774165f7c5ddbd345f353d4acdfa920", "width": 960, "height": 540, "provenance": "capture-only-presentation-composite", diff --git a/docs/media/omp-session-gateway-demo-poster.png b/docs/media/omp-session-gateway-demo-poster.png index d161d8c2..bc69c6fd 100644 Binary files a/docs/media/omp-session-gateway-demo-poster.png and b/docs/media/omp-session-gateway-demo-poster.png differ diff --git a/docs/media/omp-session-gateway-demo.gif b/docs/media/omp-session-gateway-demo.gif index 1fb9b273..198560cc 100644 Binary files a/docs/media/omp-session-gateway-demo.gif and b/docs/media/omp-session-gateway-demo.gif differ diff --git a/docs/media/omp-session-gateway-demo.mp4 b/docs/media/omp-session-gateway-demo.mp4 index e519b313..a70ac545 100644 Binary files a/docs/media/omp-session-gateway-demo.mp4 and b/docs/media/omp-session-gateway-demo.mp4 differ diff --git a/packages/collab-client/README.md b/packages/collab-client/README.md index 05a07807..a95e12ae 100644 --- a/packages/collab-client/README.md +++ b/packages/collab-client/README.md @@ -2,7 +2,7 @@ This package tells contributors how OMP Session Gateway embeds and verifies Oh My Pi's (OMP's) browser collaboration client, checks upstream source drift, and bounds client-side speech and photo inputs. -It vendors a live-runtime subset of upstream `packages/collab-web` at tag `v18.20.0` (commit `c308970263ae13744ea15ab67302e3dac840e266`, upstream `@oh-my-pi/collab-web` package version `16.3.6`) with `@oh-my-pi/pi-wire` pinned to `18.20.0` (`package.json`) and Bun `1.4.4` (`upstream/UPSTREAM.json`). Collaboration framing and relay envelopes match upstream, and the additive `error.resync` and `select.approval` fields keep the same hello and response shapes; `@oh-my-pi/pi-wire`'s Tern Surface Protocol (`tsp.ts`) runtime is not bundled. +It vendors a live-runtime subset of upstream `packages/collab-web` at tag `v19.1.1` (commit `31ffee513f27a01bba7d4dfbe12bae239cdc646a`, upstream `@oh-my-pi/collab-web` package version `16.3.6`) with `@oh-my-pi/pi-wire` pinned to `19.1.1` (`package.json`) and Bun `1.4.4` (`upstream/UPSTREAM.json`). Collaboration framing and relay envelopes match upstream, and the additive `error.resync` and `select.approval` fields keep the same hello and response shapes; `@oh-my-pi/pi-wire`'s Tern Surface Protocol (`tsp.ts`) runtime is not bundled. These browser-client provenance pins are tracked independently of both the minimum supported OMP host version (`>= 18.1.20`) and the root `UPSTREAM.lock.json` engineering host baseline; see [Mainline OMP integration](../../docs/OMP_INTEGRATION.md). Paths below starting with `package.json`, `upstream/`, or `test/` are relative to `packages/collab-client/`; paths starting with `.github/`, `scripts/`, or `licenses/` are relative to the repository root. @@ -39,19 +39,21 @@ Foreground, `pageshow`, `online`, and Network Information transitions replace st `CollabEmbedState.loading` publishes `{ received, total } | null` snapshot counters without transcript payloads so the shell renders connection progress ([View and Control](../../docs/USAGE.md#view-and-control)). -The 18.20.0 refresh adds upstream's same-transport resync rejoin (three automatic rejoins per five minutes) with a bounded post-join welcome retry, plus upstream's current HTML-form Ask results and named task/step rendering. Resync clears the shed peer's old dialog response and any in-flight relay probe, while an ordinary transport reconnect still retains the response until acknowledgement. Form HTML is reduced to text outlines and never mounted, a form result without answers shows the host's result text, and a task row opens a subagent transcript only by an agent id the host reports in progress or results, because upstream allocates `Name-2` when a requested name is taken. Older question cards and task id/assignment fields remain supported by a named local patch, and all seven helper blobs are unchanged from the previous import. +The 18.20.0 refresh adds upstream's same-transport resync rejoin (three automatic rejoins per five minutes) with a bounded post-join welcome retry, plus upstream's current HTML-form Ask results and named task/step rendering. Resync clears the shed peer's old dialog response and any in-flight relay probe, while an ordinary transport reconnect still retains the response until acknowledgement. Form HTML is reduced to text outlines and never mounted, a form result without answers shows the host's result text, and a task row opens a subagent transcript only by an agent id the host reports in progress or results, because upstream allocates `Name-2` when a requested name is taken. Older question cards and task id/assignment fields remain supported by a named local patch. + +The 19.1.1 refresh (its `collab-web` and helper sources are identical to v19.1.0's) reads every throwing welcome field before changing state, and a guest already in the session that cannot apply a later welcome says hello again through the same three-rejoin budget instead of going live on a partial snapshot. Streaming Markdown keeps finished blocks' DOM and replaces only the open tail. `GuestClient` gains upstream's `followUp` prompt option and `sendResume` and `sendDeliverQueue` senders, which no embedded control calls yet; a **View** capability rejects all three like every other mutation. Tool cards show the brief intent label, answerless web searches list each source's excerpt, and a bash card nests the tool commands it ran and names its `local://N.log` spill. Hosts before 19.1.0 dispatch those commands as `write xd://` and hosts before 19.0.0 spill to `artifact://`; a named local patch keeps both rendering as before. The refresh vendors `spill-url.ts` as the eighth pure helper. Optional `CollabEmbedOptions.takeInitialPromptDraft` drains a shell-bounded volatile first-task draft (capped by the host shell at 8,000 code points and 32 KiB) once into an empty `Composer.tsx` input in live writable **Control** when the relay is healthy, no Ask is active, and no photo draft or send is in flight; reconnects, rerenders, and disposal never reapply or persist it ([Protocol §5](../../docs/PROTOCOL.md#5-in-memory-collab-client-bootstrap)). The codec and tool renderers use `@oh-my-pi/pi-wire` shared envelope functions, the vendored `asStrictBytes` byte-buffer helper, `wait` message-list rendering with an adapter for older single-message/null/empty host results, job-intent labels with command fallback, `eval` table/JSON/Markdown views, and retained hub-family tool cards (`hub`, `irc`, `job`, `await`, `poll`, `cancel_job`). -Live bash cards render command, text, image, and status output while ignoring `details.trace` string or byte-array fields. +Live bash cards render command, text, image, and status output, nested tool-command cards and the spill stat while ignoring `details.trace` string or byte-array fields. Streaming updates publish at most once per animation frame while non-streaming frames flush synchronously, with memoized `Composer` and `HeaderBar` props, separate committed-tool scanning, and idle agent-drawer polling shutdown. Guest-replica snapshots buffer until the final chunk or promised entry count, keeping the last published rows visible during resynchronization and clearing finished stream ghosts. `upstream/src/components/transcript/Transcript.tsx` renders the newest 150 entries (`TRANSCRIPT_WINDOW`) and reveals 300 more per **Show earlier** tap (`TRANSCRIPT_WINDOW_STEP`), pinning the oldest visible entry and scroll offset across live appends and reconnects while pairing tool results across the full retained history. Bottom-lock holds within 40 px of the tail, and a monotonic `liveEpoch` returns the main transcript to the latest message on connect and reconnect. -Markdown and math rendering (`upstream/src/components/transcript/Markdown.tsx`, `math.ts`) uses KaTeX `0.18.5` native MathML (`trust: false`, math dimensions capped at 100 em, no KaTeX CSS or remote fonts) and seven pure TypeScript helpers vendored from `@oh-my-pi/pi-utils` `18.20.0` under `upstream/src/vendor/pi-utils/` (licenses in `licenses/pi-utils-marked/LICENSE`). Rejected currency openers and half-streamed delimiters keep their existing semantics, now supplied by upstream rather than a local npm-parser adapter. +Markdown and math rendering (`upstream/src/components/transcript/Markdown.tsx`, `math.ts`) uses KaTeX `0.18.5` native MathML (`trust: false`, math dimensions capped at 100 em, no KaTeX CSS or remote fonts) and seven pure TypeScript helpers vendored from `@oh-my-pi/pi-utils` `19.1.1` under `upstream/src/vendor/pi-utils/` (licenses in `licenses/pi-utils-marked/LICENSE`); the bash renderer uses the eighth, `spill-url.ts`. Rejected currency openers and half-streamed delimiters keep their existing semantics, now supplied by upstream rather than a local npm-parser adapter. Links and image sources in settled and streaming blocks pass through browser URL parsing and `http:`/`https:` (plus `mailto:` for links) allowlists, and text stacks fall back to the gateway's self-hosted `"Symbols Nerd Font Mono"` face for Private Use Area glyphs (such as icons printed by `ls` or `eza`) only. diff --git a/packages/collab-client/package.json b/packages/collab-client/package.json index 993ed133..3ccd59b9 100644 --- a/packages/collab-client/package.json +++ b/packages/collab-client/package.json @@ -8,7 +8,7 @@ "typecheck": "bunx tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@oh-my-pi/pi-wire": "18.20.0", + "@oh-my-pi/pi-wire": "19.1.1", "katex": "0.18.5", "lucide-react": "1.31.0", "react": "19.2.7", diff --git a/packages/collab-client/test/markdown.test.ts b/packages/collab-client/test/markdown.test.ts index ed37a68e..3a0d29ea 100644 --- a/packages/collab-client/test/markdown.test.ts +++ b/packages/collab-client/test/markdown.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test } from "bun:test"; import { createElement } from "react"; import { renderToStaticMarkup } from "react-dom/server"; -import { Markdown, renderStreamingMarkdown, type FrozenMarkdownPrefix } from "../upstream/src/components/transcript/Markdown"; +import { Markdown, renderStreamingMarkdown, StreamingMarkdown, type FrozenMarkdownPrefix } from "../upstream/src/components/transcript/Markdown"; +import { mount, query, restoreDomGlobals, unmountAll } from "./react-dom-harness"; function renderMarkdown(text: string): string { return renderToStaticMarkup(createElement(Markdown, { text })); @@ -307,4 +308,21 @@ describe("streaming Markdown", () => { expect(frozeRejectedLink).toBe(true); } }); + + test("keeps the mounted DOM equal to a one-shot render while frozen blocks grow and the text rewrites", async () => { + const doc = `${PARAGRAPHS}\n\n[safe](https://example.com) and a tail`; + const texts: string[] = []; + for (let len = 1; len < doc.length; len += 5) texts.push(doc.slice(0, len)); + texts.push(doc, "uno\n\ntwo", "uno\n\ntwo\n\nthree"); + try { + const tree = await mount(createElement(StreamingMarkdown, { text: texts[0]! })); + for (const text of texts) { + await tree.render(createElement(StreamingMarkdown, { text })); + expect(`
${query(tree.container, "tr-md")!.innerHTML}
`).toBe(renderMarkdown(text)); + } + } finally { + await unmountAll(); + restoreDomGlobals(); + } + }); }); diff --git a/packages/collab-client/test/react-dom-harness.ts b/packages/collab-client/test/react-dom-harness.ts index 90c3c60e..d3929358 100644 --- a/packages/collab-client/test/react-dom-harness.ts +++ b/packages/collab-client/test/react-dom-harness.ts @@ -3,7 +3,7 @@ * * `bun test` provides no DOM and this package takes no test-only dependencies, * so these classes implement exactly the surface `react-dom/client` touches: - * node insertion and removal, attributes, `innerHTML` for rendered markdown, + * node insertion and removal, attributes, `innerHTML` and `insertAdjacentHTML` for rendered markdown, * container-level event listeners, and the scroll metrics the transcript's * bottom lock reads. Every element is {@link ROW_PX} tall, so `scrollHeight` is * an exact function of the mounted children and scroll assertions are exact. @@ -93,6 +93,10 @@ export class MiniNode { addEventListener(_type: string, _listener: Listener): void {} removeEventListener(_type: string, _listener: Listener): void {} + + remove(): void { + this.parentNode?.removeChild(this); + } } export class MiniText extends MiniNode { @@ -115,6 +119,17 @@ export class MiniComment extends MiniNode { } } +/** One opaque `innerHTML` or `insertAdjacentHTML` fragment; the harness never parses markup. */ +export class MiniMarkup extends MiniNode { + readonly nodeName = "#markup"; + readonly markup: string; + + constructor(ownerDocument: MiniDocument, markup: string) { + super(ownerDocument); + this.markup = markup; + } +} + export class MiniElement extends MiniNode { readonly tagName: string; readonly nodeName: string; @@ -123,8 +138,6 @@ export class MiniElement extends MiniNode { readonly style: Record = {}; readonly listeners = new Map>(); namespaceURI = "http://www.w3.org/1999/xhtml"; - /** Markdown arrives through `dangerouslySetInnerHTML`. */ - markup = ""; scrollTop = 0; type = ""; value = ""; @@ -163,18 +176,23 @@ export class MiniElement extends MiniNode { this.nodeName = this.tagName; } + /** Markdown arrives through `dangerouslySetInnerHTML`, then streaming tails through `insertAdjacentHTML`. */ set innerHTML(markup: string) { - this.markup = markup; this.childNodes.length = 0; + this.insertAdjacentHTML("beforeend", markup); } get innerHTML(): string { - return this.markup; + return this.childNodes.map(node => (node instanceof MiniMarkup ? node.markup : "")).join(""); + } + + insertAdjacentHTML(position: "beforeend", markup: string): void { + if (position !== "beforeend") throw new Error(`insertAdjacentHTML position ${position} is not modeled`); + if (markup !== "") this.appendChild(new MiniMarkup(this.ownerDocument, markup)); } set textContent(text: string) { this.childNodes.length = 0; - this.markup = ""; if (text !== "") this.appendChild(new MiniText(this.ownerDocument, text)); } @@ -272,9 +290,7 @@ export class MiniDocument extends MiniNode { /** Text of a subtree, with markdown `innerHTML` reduced to its text. */ export function textOf(node: MiniNode): string { if (node.nodeType === 3) return node.nodeValue ?? ""; - if (node instanceof MiniElement && node.markup !== "") { - return node.markup.replaceAll(/<[^>]*>/g, ""); - } + if (node instanceof MiniMarkup) return node.markup.replaceAll(/<[^>]*>/g, ""); let text = ""; for (const child of node.childNodes) text += textOf(child); return text; diff --git a/packages/collab-client/test/socket.test.ts b/packages/collab-client/test/socket.test.ts index 45bda7f8..ca5d2e74 100644 --- a/packages/collab-client/test/socket.test.ts +++ b/packages/collab-client/test/socket.test.ts @@ -521,13 +521,19 @@ describe("CollabSocket browser lifecycle recovery", () => { socket.open(); await socket.waitForSent(1); client.sendPrompt("blocked before welcome", [{ type: "image", data: "blocked", mimeType: "image/jpeg" }]); + client.sendPrompt("blocked follow-up before welcome", [], { followUp: true }); client.sendAbort(); + client.sendResume(); + client.sendDeliverQueue(); client.sendAgentCmd("chat", "blocked-agent", "blocked"); client.applyFrameForTest(TEST_WELCOME); expect(client.getSnapshot().readOnly).toBeTrue(); client.sendPrompt("blocked", [{ type: "image", data: "blocked-image", mimeType: "image/jpeg" }]); + client.sendPrompt("blocked follow-up", [], { followUp: true }); client.sendAbort(); + client.sendResume(); + client.sendDeliverQueue(); client.sendAgentCmd("chat", "blocked-agent", "blocked"); const mutationSent = await Promise.race([ socket.waitForSent(2).then(() => true), @@ -574,6 +580,29 @@ describe("CollabSocket browser lifecycle recovery", () => { } }); + test("rejoins a joined guest whose later welcome fails to apply, without applying any of it", async () => { + const key = await importRoomKey(new Uint8Array(32)); + const client = new GuestClient(TEST_CONTROL_LINK, "test guest"); + try { + client.connect(); + const socket = FakeWebSocket.instances[0]!; + socket.open(); + await socket.waitForSent(1); + client.applyFrameForTest(TEST_WELCOME); + const header = client.getSnapshot().header; + // `agents` is read first, so the replacement header never lands. + client.applyFrameForTest({ ...TEST_WELCOME, header: { ...TEST_HEADER }, agents: null } as unknown as HostFrame); + expect(client.getSnapshot().phase).toBe("reconnecting"); + expect(client.getSnapshot().header).toBe(header); + await socket.waitForSent(2); + expect((await decodeFrames(socket, key)).map(frame => frame.t)).toEqual(["hello", "hello"]); + client.applyFrameForTest(TEST_WELCOME); + expect(client.getSnapshot().phase).toBe("live"); + } finally { + client.close(); + } + }); + test("bounds successful resync rejoins and refuses further automatic snapshots", async () => { const client = new GuestClient(TEST_CONTROL_LINK, "test guest"); try { diff --git a/packages/collab-client/test/tool-render.test.ts b/packages/collab-client/test/tool-render.test.ts index f79deb9e..69a5f8cb 100644 --- a/packages/collab-client/test/tool-render.test.ts +++ b/packages/collab-client/test/tool-render.test.ts @@ -407,6 +407,42 @@ describe("tool renderers across supported OMP releases", () => { expect(job).toContain("poll a1b2"); expect(job).not.toContain("tv-out-title"); }); + + test("nests current bash tool commands and keeps older hosts' xd:// device cards", () => { + const inner = { action: "discard", reason: "Unsafe migration" }; + const nested = render({ + name: "bash", args: { command: "reject --reason 'Unsafe migration'" }, + result: { content: [{ type: "text", text: "Rejected" }], details: { exitCode: 0, toolCommands: [ + { tool: "reject", mode: "execute", exitCode: 0, args: { reason: "Unsafe migration" }, inner }, + { tool: "todo", mode: "help", exitCode: 0 }, + ] } }, + }); + expect(nested).toContain('
'); + expect(nested).toContain('reject'); + expect(nested).toContain("todo --help"); + + // Hosts before 19.1 dispatch the same command as `write xd://`. + const legacy = render({ + name: "write", args: { path: "xd://reject", content: "Unsafe migration" }, + result: { content: [{ type: "text", text: "Rejected" }], details: { xdev: { + mode: "execute", tool: "reject", args: { reason: "Unsafe migration" }, inner, + } } }, + }); + expect(legacy).toContain('xd://reject'); + expect(legacy).toContain("proposed → rejected"); + expect(legacy).toContain("Unsafe migration"); + expect(legacy).not.toContain('write'); + }); + + test("labels a local:// spill and keeps older hosts' artifact stat on bash cards", () => { + const stats = (notice: string): string => render({ + name: "bash", args: { command: "seq 100000" }, + result: { content: [{ type: "text", text: `100000\n[raw output: ${notice}]` }], details: { wallTimeMs: 25 } }, + }); + expect(stats("local://7.log")).toContain("wall 25ms · local://7.log"); + expect(stats("artifact://a1b2-c3")).toContain("wall 25ms · artifact a1b2-c3"); + expect(stats("https://example.invalid/7.log")).not.toContain("wall 25ms · "); + }); }); describe("task drill-down", () => { diff --git a/packages/collab-client/test/vendor-provenance.test.ts b/packages/collab-client/test/vendor-provenance.test.ts index f01f61a9..1ea60ce3 100644 --- a/packages/collab-client/test/vendor-provenance.test.ts +++ b/packages/collab-client/test/vendor-provenance.test.ts @@ -20,7 +20,7 @@ describe("embedded client provenance", () => { expect(provenance.tree).toMatch(/^[a-f0-9]{40}$/); expect(provenance.tag).toBe(`v${manifest.dependencies["@oh-my-pi/pi-wire"]}`); expect(provenance.bunVersion).toBe("1.4.4"); - expect(provenance.additionalSources).toHaveLength(7); + expect(provenance.additionalSources).toHaveLength(8); for (const source of provenance.additionalSources) { expect(source.commit).toBe(provenance.commit); expect(source.packageVersion).toBe(manifest.dependencies["@oh-my-pi/pi-wire"]); diff --git a/packages/collab-client/upstream/UPSTREAM.json b/packages/collab-client/upstream/UPSTREAM.json index 6b898522..70067bca 100644 --- a/packages/collab-client/upstream/UPSTREAM.json +++ b/packages/collab-client/upstream/UPSTREAM.json @@ -1,59 +1,59 @@ { "repository": "https://github.com/can1357/oh-my-pi", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", - "tree": "ba890953dd69eb4bf73bb7233bbe50ccfacd6912", - "tag": "v18.20.0", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", + "tree": "3f27b6346d6319234bcd91d8148c15d077cea436", + "tag": "v19.1.1", "package": "@oh-my-pi/collab-web", "packageVersion": "16.3.6", "sourcePath": "packages/collab-web", - "observedAt": "2026-11-13", + "observedAt": "2026-11-23", "bunVersion": "1.4.4", "schemaVersion": 1, "additionalSources": [ { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/marked.ts", "vendoredPath": "src/vendor/pi-utils/marked.ts", "blob": "75369d2cdb83f360ade03cafa325858ef631bce6" }, { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/marked/core.ts", "vendoredPath": "src/vendor/pi-utils/marked/core.ts", - "blob": "074f73c1bce275c2c8ec7ec6af35640dc0c18da5" + "blob": "49b3e70bdee2b565bce9039f124ca6225a1c6234" }, { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/marked/inline-closers.ts", "vendoredPath": "src/vendor/pi-utils/marked/inline-closers.ts", - "blob": "020cb64caebfa52630e33082653c607b3ecdea45" + "blob": "89e2b6d39dfb1be641fcacc0dbdc5df113b2d86f" }, { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/marked/inline-text.ts", "vendoredPath": "src/vendor/pi-utils/marked/inline-text.ts", "blob": "f2072e9036048ef86d479cf2336336e7f893329b" }, { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/marked-list.ts", "vendoredPath": "src/vendor/pi-utils/marked-list.ts", "blob": "f7fd8fb4ab5147576345f9427f9b8c05c4bf7fd0" }, { "package": "@oh-my-pi/pi-utils", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "sourcePath": "packages/utils/src/math-delimiters.ts", "vendoredPath": "src/vendor/pi-utils/math-delimiters.ts", "blob": "dd0dcbb7fe62d1159f51150bc2d3fdad2ed8bc4f" @@ -62,9 +62,17 @@ "package": "@oh-my-pi/pi-utils", "sourcePath": "packages/utils/src/bytes.ts", "vendoredPath": "src/vendor/pi-utils/bytes.ts", - "packageVersion": "18.20.0", - "commit": "c308970263ae13744ea15ab67302e3dac840e266", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", "blob": "2e003975f10be65ceed83e73b5999ce6ba0160b0" + }, + { + "package": "@oh-my-pi/pi-utils", + "packageVersion": "19.1.1", + "commit": "31ffee513f27a01bba7d4dfbe12bae239cdc646a", + "sourcePath": "packages/utils/src/spill-url.ts", + "vendoredPath": "src/vendor/pi-utils/spill-url.ts", + "blob": "75450326e7996342ef48164664f06a8842558396" } ], "excludedEntrypoints": [ @@ -272,6 +280,10 @@ { "file": "packages/collab-client/test/socket.test.ts", "case": "keeps a late non-resync error after a resync as a notice while the rejoin awaits its welcome" + }, + { + "file": "packages/collab-client/test/socket.test.ts", + "case": "rejoins a joined guest whose later welcome fails to apply, without applying any of it" } ], "upstreamStatus": "gateway-specific; not supplied by the pinned upstream client", @@ -293,6 +305,26 @@ "upstreamStatus": "gateway-specific; not supplied by the pinned upstream client", "removeWhen": "Minimum supported host no longer emits these names." }, + { + "id": "legacy-xdev-and-artifact-notices", + "purpose": "Adopt upstream's nested bash tool-command cards and local:// spill stat while rendering older hosts' write xd:// dispatches as the device card and keeping the artifact stat of their artifact:// raw-output notices.", + "files": [ + "src/tool-render/ToolView.tsx", + "src/tool-render/tools/bash.tsx" + ], + "proof": [ + { + "file": "packages/collab-client/test/tool-render.test.ts", + "case": "nests current bash tool commands and keeps older hosts' xd:// device cards" + }, + { + "file": "packages/collab-client/test/tool-render.test.ts", + "case": "labels a local:// spill and keeps older hosts' artifact stat on bash cards" + } + ], + "upstreamStatus": "upstream 19.1.0 renders only bash tool-command records and local:// spills; hosts before 19.1.0 dispatch through write xd:// and hosts before 19.0.0 spill to artifact://", + "removeWhen": "The supported host floor no longer emits write xd:// dispatches or artifact:// raw-output notices." + }, { "id": "health-and-response-ack", "purpose": "Retain metadata-free probes, encrypted health frames, object sealing and transport-reconnect response acknowledgements; on upstream resync, clear shed-peer responses and drop any in-flight relay probe.", @@ -410,8 +442,7 @@ "files": [ "src/components/shell/Composer.tsx", "src/components/shell/shell.css", - "src/lib/photo-attachment.ts", - "src/lib/client.ts" + "src/lib/photo-attachment.ts" ], "proof": [ { @@ -431,12 +462,12 @@ "case": "embedded active ask matches the original 3d shell interaction" } ], - "upstreamStatus": "gateway-specific; not supplied by the pinned upstream client", + "upstreamStatus": "upstream 19.1.0 sends prompt images in the same frame; capture, bounds, previews and acknowledgement retry remain gateway-specific", "removeWhen": "Upstream provides the same bounded phone-photo flow and acknowledgement/retry semantics." }, { "id": "read-only-mutations", - "purpose": "Enforce View guards inside every mutating guest method, including image, Ask and agent commands.", + "purpose": "Enforce View guards inside every mutating guest method, including image and follow-up prompts, Ask responses, resume, deliver-queue and agent commands.", "files": [ "src/lib/client.ts" ], @@ -466,11 +497,12 @@ }, { "id": "pure-helper-imports", - "purpose": "Use seven exact pure pi-utils helper files instead of installing pi-utils or pi-natives.", + "purpose": "Use eight exact pure pi-utils helper files instead of installing pi-utils or pi-natives.", "files": [ "src/lib/codec.ts", "src/components/transcript/Markdown.tsx", - "src/components/transcript/math.ts" + "src/components/transcript/math.ts", + "src/tool-render/tools/bash.tsx" ], "proof": [ { diff --git a/packages/collab-client/upstream/src/components/transcript/Markdown.tsx b/packages/collab-client/upstream/src/components/transcript/Markdown.tsx index a74331fc..83ee0ba4 100644 --- a/packages/collab-client/upstream/src/components/transcript/Markdown.tsx +++ b/packages/collab-client/upstream/src/components/transcript/Markdown.tsx @@ -2,7 +2,7 @@ import type { Token } from "../../vendor/pi-utils/marked"; import { Marked } from "../../vendor/pi-utils/marked"; import { listMayContinueAt } from "../../vendor/pi-utils/marked-list"; import type { ReactNode } from "react"; -import { memo, useMemo, useRef } from "react"; +import { memo, useLayoutEffect, useMemo, useRef, useState } from "react"; import { escapeHtml } from "../../lib/format"; import { mathExtension } from "./math"; @@ -198,18 +198,55 @@ export function renderStreamingMarkdown( } } +/** The frozen prefix a {@link StreamingMarkdown} element currently shows and the child nodes it built. */ +interface AppliedFrozen { + prefix: FrozenMarkdownPrefix; + nodeCount: number; +} + /** * {@link Markdown} for a block that is still streaming: settled leading * blocks are rendered once and reused, so each token re-parses only the open * tail instead of the whole growing block. Output is identical to * {@link Markdown} for the same text. + * + * The DOM follows the same split: frozen blocks are parsed into nodes once + * and kept; each update replaces only the tail's nodes. The container keeps + * the blocks as direct children, exactly as {@link Markdown} does. */ export const StreamingMarkdown = memo(function StreamingMarkdown({ text }: { text: string }): ReactNode { const prefixRef = useRef(NO_PREFIX); - const html = useMemo(() => { - const rendered = renderStreamingMarkdown(text, prefixRef.current); + const rootRef = useRef(null); + // Unknown after the initial markup; the first update rebuilds. + const appliedRef = useRef(null); + // React owns only the initial markup. It re-applies `dangerouslySetInnerHTML` whenever the + // prop object changes identity, so the object itself must stay constant across renders. + const [initialHtml] = useState(() => { + const rendered = renderStreamingMarkdown(text, NO_PREFIX); prefixRef.current = rendered.prefix; - return rendered.html; + return { __html: rendered.html }; + }); + const shownTextRef = useRef(text); + useLayoutEffect(() => { + const root = rootRef.current; + if (root === null || text === shownTextRef.current) return; + shownTextRef.current = text; + const rendered = renderStreamingMarkdown(text, prefixRef.current); + const prefix = rendered.prefix; + prefixRef.current = prefix; + const applied = appliedRef.current; + if (applied !== null && (prefix === applied.prefix || prefix.html.startsWith(applied.prefix.html))) { + while (root.childNodes.length > applied.nodeCount) root.lastChild!.remove(); + if (prefix !== applied.prefix) { + root.insertAdjacentHTML("beforeend", prefix.html.slice(applied.prefix.html.length)); + appliedRef.current = { prefix, nodeCount: root.childNodes.length }; + } + } else { + root.innerHTML = prefix.html; + appliedRef.current = { prefix, nodeCount: root.childNodes.length }; + } + // `rendered.html` always starts with the frozen prefix's markup. + root.insertAdjacentHTML("beforeend", rendered.html.slice(prefix.html.length)); }, [text]); - return
; + return
; }); diff --git a/packages/collab-client/upstream/src/lib/client.ts b/packages/collab-client/upstream/src/lib/client.ts index 32b4bd31..56ce182a 100644 --- a/packages/collab-client/upstream/src/lib/client.ts +++ b/packages/collab-client/upstream/src/lib/client.ts @@ -310,9 +310,18 @@ export class GuestClient { return this.#snapshot; } - sendPrompt(text: string, images?: ImageContent[]): void { + /** + * Prompts the host; `images` ride in the same `prompt` frame (omitted when empty). `followUp` waits for the + * running turn instead of steering it. + */ + sendPrompt(text: string, images?: readonly ImageContent[], options?: { followUp?: boolean }): void { if (this.#readOnly) return; - this.#socket.send({ t: "prompt", text, images: images && images.length > 0 ? images : undefined }); + this.#socket.send({ + t: "prompt", + text, + ...(images && images.length > 0 ? { images: [...images] } : {}), + ...(options?.followUp ? { followUp: true } : {}), + }); } sendUiResponse(reqId: number, value?: CollabUiResponseValue): void { @@ -327,6 +336,18 @@ export class GuestClient { this.#socket.send({ t: "abort" }); } + /** The `.`/`c` continue shortcut: the host resumes its agent, interrupting a running turn first. */ + sendResume(): void { + if (this.#readOnly) return; + this.#socket.send({ t: "resume" }); + } + + /** Empty Enter: the host interrupts a run that has queued input and continues it with that input. */ + sendDeliverQueue(): void { + if (this.#readOnly) return; + this.#socket.send({ t: "deliver-queue" }); + } + sendAgentCmd(cmd: "chat" | "kill" | "revive", agentId: string, text?: string): void { if (this.#readOnly) return; this.#socket.send({ t: "agent-cmd", cmd, agentId, ...(text === undefined ? {} : { text }) }); @@ -502,8 +523,13 @@ export class GuestClient { this.#applyFrame(frame); } catch (err) { console.warn("collab: failed to apply frame", frame.t, err); - if (frame.t === "welcome" && !this.#welcomed) { - this.#end(`failed to apply session snapshot: ${err instanceof Error ? err.message : String(err)}`); + if (frame.t === "welcome") { + const reason = `failed to apply session snapshot: ${err instanceof Error ? err.message : String(err)}`; + // A failed welcome must never go live through its snapshot chunks. A + // guest already in the session says hello again instead, which also + // drops any earlier welcome's snapshot and timer. + if (this.#welcomed) this.#rejoin(reason); + else this.#end(reason); return; } this.#pushNotice("error", `failed to apply ${frame.t} frame`); @@ -513,7 +539,11 @@ export class GuestClient { #applyFrame(frame: HostFrame): void { switch (frame.t) { - case "welcome": + case "welcome": { + // Read every field that can throw on a malformed frame before any + // state changes, so a failed welcome leaves the guest as it was. + const agents = [...frame.agents]; + const working = frame.state.isStreaming; // A fresh welcome (first join or reconnect) restarts the snapshot. // Entries already on screen stay until the new snapshot replaces // them once complete, so a resync never blanks the transcript. @@ -526,14 +556,14 @@ export class GuestClient { this.#pendingSnapshot = { entries: [], live: [], total: frame.entryCount }; } this.#state = frame.state; - this.#agents = [...frame.agents]; + this.#agents = agents; this.#stream = null; this.#streamDone = false; this.#activeTools = new Map(); this.#progress = new Map(); this.#lifecycle = new Map(); this.#unlistedBusIds.clear(); - this.#working = frame.state.isStreaming; + this.#working = working; this.#readOnly = this.#writeToken === undefined || frame.readOnly === true; this.#restorePendingUiRequest(); this.#welcomed = true; @@ -549,6 +579,7 @@ export class GuestClient { } this.#endedReason = null; break; + } case "snapshot-chunk": { // Buffer fragments and publish the transcript once, when the // snapshot completes (as the TUI guest does). Intermediate chunks diff --git a/packages/collab-client/upstream/src/tool-render/ToolView.tsx b/packages/collab-client/upstream/src/tool-render/ToolView.tsx index 220126be..2d8b3972 100644 --- a/packages/collab-client/upstream/src/tool-render/ToolView.tsx +++ b/packages/collab-client/upstream/src/tool-render/ToolView.tsx @@ -2,7 +2,7 @@ * Tool card chrome + per-tool dispatch. Works in the collab-web app and inside * the `` web component embedded in HTML session exports. */ -import { INTENT_FIELD } from "@oh-my-pi/pi-wire"; +import { INTENT_FIELD, toolIntentLabel } from "@oh-my-pi/pi-wire"; import type { ReactNode } from "react"; import { useState } from "react"; import { resolveToolRenderer } from "./registry"; @@ -27,7 +27,8 @@ export interface ToolViewProps { function normalizeArgs(raw: unknown): { args: Record; intent: string | undefined } { if (!isRecord(raw)) return { args: {}, intent: undefined }; - const intent = typeof raw[INTENT_FIELD] === "string" ? (raw[INTENT_FIELD] as string).trim() : undefined; + const rawIntent = raw[INTENT_FIELD]; + const intent = typeof rawIntent === "string" ? rawIntent.trim() : undefined; if (!(INTENT_FIELD in raw)) return { args: raw, intent }; const args: Record = {}; for (const k in raw) { @@ -36,6 +37,38 @@ function normalizeArgs(raw: unknown): { args: Record; intent: s return { args, intent }; } +/** One tool-command invocation nested in a completed `bash` result. */ +interface ToolCommandRecord { + tool: string; + mode: "help" | "execute"; + exitCode: number; + args?: Record; + inner?: unknown; +} + +/** `details.toolCommands` records of a bash result, in invocation order. */ +function toolCommandRecords(result: ToolResultLike | undefined): ToolCommandRecord[] { + if (!result || !isRecord(result.details)) return []; + const raw = result.details.toolCommands; + if (!Array.isArray(raw)) return []; + const records: ToolCommandRecord[] = []; + for (const item of raw) { + if (!isRecord(item)) continue; + const { tool, mode, exitCode } = item; + if (typeof tool !== "string" || typeof exitCode !== "number") continue; + if (mode !== "help" && mode !== "execute") continue; + records.push({ + tool, + mode, + exitCode, + args: isRecord(item.args) ? item.args : undefined, + inner: item.inner, + }); + } + return records; +} + +/** A pre-19.1 host's `write xd://` dispatch, rendered as the device's own card. */ interface XdevDispatch { tool: string; args: Record; @@ -54,6 +87,7 @@ export function ToolView(props: ToolViewProps): ReactNode { const xdev = executeXdevDispatch(props); const { args, intent: argIntent } = normalizeArgs(props.args); const intent = props.intent?.trim() || argIntent; + const label = intent ? toolIntentLabel(intent) : undefined; const name = xdev?.tool ?? props.name; const result = xdev ? { content: props.result!.content, details: xdev.inner, isError: props.result!.isError } @@ -66,38 +100,62 @@ export function ToolView(props: ToolViewProps): ReactNode { running: props.running, host: props.host, }; + const commands = props.name === "bash" ? toolCommandRecords(props.result) : []; const isError = props.result?.isError === true; const status = props.running ? "run" : isError ? "err" : props.result ? "ok" : "pending"; const partial = props.running && !props.result && props.partial ? stripAnsi(replaceTabs(props.partial)) : ""; return ( -
- + {open && ( +
+ {label &&
{label}
} + {renderer.Body ? : null} +
+ )} + {partial && ( +
{partial.length > 2048 ? `…${partial.slice(-2048)}` : partial}
)} - {xdev ? `xd://${name}` : name} - - - -
+ ); } diff --git a/packages/collab-client/upstream/src/tool-render/tool-render.css b/packages/collab-client/upstream/src/tool-render/tool-render.css index 826e50a6..e0e8e86e 100644 --- a/packages/collab-client/upstream/src/tool-render/tool-render.css +++ b/packages/collab-client/upstream/src/tool-render/tool-render.css @@ -445,6 +445,12 @@ overflow-wrap: anywhere; } +/* A source's page excerpt under its title (web_search without an answer). */ +.tv-excerpt { + display: block; + color: var(--tv-muted); +} + /* ---- todo ---- */ .tv-todo { diff --git a/packages/collab-client/upstream/src/tool-render/tools/bash.tsx b/packages/collab-client/upstream/src/tool-render/tools/bash.tsx index 5df1638e..f7be2699 100644 --- a/packages/collab-client/upstream/src/tool-render/tools/bash.tsx +++ b/packages/collab-client/upstream/src/tool-render/tools/bash.tsx @@ -1,4 +1,5 @@ /** `bash` — shell command execution: prompt line with env prefix, badges, output tail. */ +import { parseSpillUrl, spillUrl } from "../../vendor/pi-utils/spill-url"; import type { ReactNode } from "react"; import { Badge, Badges, InvalidArg, ResultImages, ResultText, Row } from "../parts"; import type { ToolRenderer, ToolRenderProps } from "../types"; @@ -7,8 +8,10 @@ import { detailsRecord, display, isRecord, normalizeWs, num, resultTextOf, short /** Values safe to show unquoted in a `NAME=value` shell prefix. */ const SHELL_SAFE = /^[\w@%+=:,./-]+$/; -/** Footer appended by the bash tool when long output was spilled to an artifact. */ -const ARTIFACT_NOTICE = /\[raw output: artifact:\/\/([\w-]+)\]/; +/** Footer appended by the bash tool when long output was spilled; the URL inside is a `local://N.log` spill. */ +const RAW_OUTPUT_NOTICE = /\[raw output: ([^\]\s]+)\]/; +/** Hosts before 19.0 spilled long output to `artifact://` instead of a `local://N.log` spill. */ +const LEGACY_ARTIFACT_URL = /^artifact:\/\/([\w-]+)$/; function envPrefix(env: Record): string { const parts: string[] = []; @@ -50,7 +53,10 @@ function Body({ args, result }: ToolRenderProps): ReactNode { const timeoutSeconds = num(args.timeout) ?? num(details?.timeoutSeconds); const requestedTimeoutSeconds = num(details?.requestedTimeoutSeconds); const job = asyncDetailsOf(details); - const artifactId = ARTIFACT_NOTICE.exec(resultTextOf(result))?.[1] ?? null; + const noticeUrl = RAW_OUTPUT_NOTICE.exec(resultTextOf(result))?.[1]; + const spillId = noticeUrl === undefined ? undefined : parseSpillUrl(noticeUrl); + const legacyArtifactId = + spillId === undefined && noticeUrl !== undefined ? LEGACY_ARTIFACT_URL.exec(noticeUrl)?.[1] : undefined; const stats: string[] = []; if (wallTimeMs !== null) { @@ -60,7 +66,8 @@ function Body({ args, result }: ToolRenderProps): ReactNode { stats.push(`requested timeout ${requestedTimeoutSeconds}s clamped`); } if (job?.jobId) stats.push(`job ${job.jobId}`); - if (artifactId) stats.push(`artifact ${artifactId}`); + if (spillId !== undefined) stats.push(spillUrl(spillId)); + else if (legacyArtifactId) stats.push(`artifact ${legacyArtifactId}`); return ( <> diff --git a/packages/collab-client/upstream/src/tool-render/tools/resolve.tsx b/packages/collab-client/upstream/src/tool-render/tools/resolve.tsx index c6f3106e..dbd9bc12 100644 --- a/packages/collab-client/upstream/src/tool-render/tools/resolve.tsx +++ b/packages/collab-client/upstream/src/tool-render/tools/resolve.tsx @@ -2,12 +2,13 @@ * `resolve` / `reject` / `propose` — finalize a staged preview (apply/discard) * or submit a plan for approval. * - * In collab-web these arrive as `write xd://` calls that `ToolView` - * unwraps: the card model then lives on the unwrapped inner details - * (`result.details`) and the device name (`props.name`). Historical top-level - * `resolve` transcripts instead carried `action`/`reason` on `args`, so read - * details first and fall back to args. When neither is present yet (a running - * card), the device name supplies the default action. + * In collab-web these arrive either as direct `resolve` / `reject` / `propose` + * tool calls or as tool-command records nested in a `bash` result, whose inner + * details `ToolView` renders as this card: the card model then lives on the + * unwrapped `result.details` and the command name on `props.name`. A direct + * call instead carries `action` / `reason` on `args`, so read details first and + * fall back to args. When neither is present yet (a running card), the command + * name supplies the default action. */ import type { ReactNode } from "react"; import type { Tone } from "../parts"; @@ -43,7 +44,7 @@ interface ResolveCard { extra: Record | null; } -/** Derive the card model from unwrapped inner details, args fallback, and device name. */ +/** Derive the card model from unwrapped inner details, args fallback, and command name. */ function cardModel({ name, args, result }: ToolRenderProps): ResolveCard { const details = detailsRecord(result); const explicit = str(details?.action) ?? str(args.action); diff --git a/packages/collab-client/upstream/src/tool-render/tools/web-search.tsx b/packages/collab-client/upstream/src/tool-render/tools/web-search.tsx index 7f83f90e..0c55bfde 100644 --- a/packages/collab-client/upstream/src/tool-render/tools/web-search.tsx +++ b/packages/collab-client/upstream/src/tool-render/tools/web-search.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from "react"; import { Badge, Badges, InvalidArg, Kv, KvGrid, Note, ResultText, Row } from "../parts"; import type { ToolRenderer, ToolRenderProps } from "../types"; -import { detailsRecord, isRecord, normalizeWs, num, resultTextOf, str, truncate } from "../util"; +import { detailsRecord, isRecord, normalizeWs, num, replaceTabs, resultTextOf, str, truncate } from "../util"; function getDomain(url: string): string { try { @@ -24,6 +24,29 @@ function formatAge(seconds: unknown): string { return `${Math.floor(d / 365)}y ago`; } +/** Most excerpt lines shown under a source when the provider returned no synthesized answer. */ +const EXCERPT_LINES = 3; +/** Longest excerpt line, in characters. */ +const EXCERPT_LINE_CHARS = 160; + +/** + * A source's page excerpt as display lines: tabs expanded, whitespace runs + * collapsed, lines without a letter or digit (blank lines, code fences, rules) + * dropped, capped at {@link EXCERPT_LINES} lines of {@link EXCERPT_LINE_CHARS}. + */ +function excerptLines(snippet: unknown): string[] { + const text = str(snippet); + if (!text) return []; + const lines: string[] = []; + for (const raw of text.split(/\r?\n/)) { + const line = normalizeWs(replaceTabs(raw)); + if (!/[\p{L}\p{N}]/u.test(line)) continue; + lines.push(truncate(line, EXCERPT_LINE_CHARS)); + if (lines.length === EXCERPT_LINES) break; + } + return lines; +} + function Summary({ args }: ToolRenderProps): ReactNode { const query = str(args.query); const recency = str(args.recency); @@ -39,11 +62,21 @@ function Summary({ args }: ToolRenderProps): ReactNode { ); } -function SourceRow({ source, index }: { source: Record; index: number }): ReactNode { +function SourceRow({ + source, + index, + excerpt, +}: { + source: Record; + index: number; + /** Show the source's page excerpt under it (no synthesized answer to read instead). */ + excerpt?: boolean; +}): ReactNode { const url = str(source.url) ?? ""; const title = str(source.title)?.trim() || url || "Untitled"; const domain = url ? getDomain(url) : ""; const age = formatAge(source.ageSeconds) || (str(source.publishedDate) ?? ""); + const lines = excerpt ? excerptLines(source.snippet) : []; return ( {url ? ( @@ -55,6 +88,11 @@ function SourceRow({ source, index }: { source: Record; index: )} {domain && ({domain})} {age && · {age}} + {lines.map((line, i) => ( + + {line} + + ))} ); } @@ -73,6 +111,9 @@ function Body({ args, result }: ToolRenderProps): ReactNode { const authMode = response ? str(response.authMode) : null; const sources: Record[] = response && Array.isArray(response.sources) ? response.sources.filter(isRecord) : []; + // Without a synthesized answer the result text is the model-facing numbered listing of these + // same sources: show each source's excerpt in its row instead of that text. + const answerless = response !== null && !str(response.answer)?.trim() && sources.length > 0; let providerInfo = model && provider ? `${model} @ ${provider}` : (model ?? provider ?? ""); if (providerInfo && authMode) { @@ -110,11 +151,11 @@ function Body({ args, result }: ToolRenderProps): ReactNode { )} {errorMsg && !resultTextOf(result) && {errorMsg}} - + {!answerless && } {sources.length > 0 && (
{sources.map((source, i) => ( - + ))}
)} diff --git a/packages/collab-client/upstream/src/vendor/pi-utils/marked/core.ts b/packages/collab-client/upstream/src/vendor/pi-utils/marked/core.ts index 074f73c1..49b3e70b 100644 --- a/packages/collab-client/upstream/src/vendor/pi-utils/marked/core.ts +++ b/packages/collab-client/upstream/src/vendor/pi-utils/marked/core.ts @@ -4,6 +4,7 @@ import { canOpenDelimiter, escapedAt, InlineClosers, + matchDestination, PUNCTUATION, } from "./inline-closers"; import { TextRun, TextStops } from "./inline-text"; @@ -418,30 +419,6 @@ function findDelimiter(src: string, delimiter: string, from: number): number { while (at !== -1 && escapedAt(src, at)) at = src.indexOf(delimiter, at + delimiter.length); return at; } - -/** - * The autolink at the start of `src`, a suffix of `closers`' source: "<", a URL or an address, ">". A URL runs from its - * scheme to the first " " or ">", which must be a ">"; an address holds no " ", "<", ">" or second "@". An address - * that matches after a scheme ends where the URL does, so only the URL is tried there. - */ -function autolinkPrefix(src: string, closers: InlineClosers): string | undefined { - const scheme = /^<(?:https?:\/\/|ftp:\/\/)/i.exec(src); - if (!scheme) return /^<[^ <>@]+@[^ <>@]+>/.exec(src)?.[0]; - const close = closers.closeUrlAutolink(src, scheme[0].length); - return close === -1 ? undefined : src.slice(0, close + 1); -} - -/** The inline HTML (a tag or a comment) at the start of `src`, a suffix of `closers`' source, or `undefined`. */ -function inlineHtmlPrefix(src: string, closers: InlineClosers): string | undefined { - if (src.startsWith("" after "" after the "