Adopt session.step.streamed, ./tui-only exports, and beta-19381 - #2
Merged
Merged
Conversation
P-Theo
force-pushed
the
step-streamed-boundary
branch
from
September 9, 2026 17:11
e4be610 to
0bd75fd
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The streamed-boundary change is integrated end-to-end (tracker logic + event wiring) with strong, targeted test coverage and the packaging/scope updates are consistently applied across CI, tooling, and documentation.
Pull request overview
This PR updates the plugin’s settled-span timing to use the host-published session.step.streamed boundary (with a fallback for older hosts), adjusts packaging to export only the ./tui entrypoint, and bumps OpenCode-related dependencies to the new @opencode/* scope and 0.0.0-beta-19381, with corresponding documentation/runbook updates.
Changes:
- Track and prefer
session.step.streamedas the authoritative end-of-stream timestamp when settling step durations, falling back to the last observable content boundary when absent. - Update packaging/export surface to
./tuionly and add a repo-roottui.tsxsource entrypoint for directory-based path loading. - Bump OpenCode SDK deps to
@opencode/*0.0.0-beta-19381and refresh CI, Renovate, and docs to match (including updated install guidance).
File summaries
| File | Description |
|---|---|
| tui.tsx | Adds a repo-root source entrypoint that re-exports the plugin definition for directory-based path loading. |
| tsconfig.json | Includes tui.tsx in the TypeScript project inputs. |
| tps.tsx | Implements streamed-boundary tracking (markStreamed) and uses it for settled duration computation; wires up the new event subscription. |
| tps.test.ts | Adds comprehensive tests for streamed-boundary behavior, fallback behavior, retries, gaps, and subscription wiring/dedup. |
| renovate.jsonc | Updates Renovate rules to track the new @opencode/* package names. |
| README.md | Updates install instructions (lead with opencode2 plugin add), tested beta version, cache location details, and streamed-boundary explanation. |
| package.json | Drops "." export and keeps only "./tui" export; bumps devDependencies to @opencode/* and updates @opentui/* floors. |
| docs/release.md | Updates the release runbook to reflect host cache generations and ./tui export-based loading. |
| docs/development.md | Updates source-run instructions to use a directory path entry and documents streamed-boundary semantics and tool-input event behavior. |
| check-compatibility.mjs | Updates compatibility package list to @opencode/*. |
| .github/workflows/ci.yml | Updates CI paths and version extraction for the new @opencode/cli package location/name. |
Review details
- Files reviewed: 10/12 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
P-Theo
force-pushed
the
step-streamed-boundary
branch
from
September 9, 2026 19:20
0bd75fd to
3290760
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Five changes in two commits (code and packaging first, then docs):
session.step.streamed. The host publishes this after the provider stream exits and before local tools join, making it the authoritative span end. It replaces the last observable content boundary, which remains the fallback for hosts that don't publish the event — so the earliest compatible beta stays0.0.0-beta-17595. This also fixes steps with exact usage but zero observable output (Gemini signature-only thinking) settling tokens with no duration../tui-only exports. Dropping the.export fixesopencode2 plugin add opencode2-tpsmisrouting the package into the server config (opencode.json) instead of the TUI config (cli.json).0.0.0-beta-17639→0.0.0-beta-19381, new@opencodescope. The type import moves to@opencode/plugin/tui; the compat script, CI, and Renovate follow the scope. The new SDK floors the@opentui/{core,solid}dev dependencies at 0.5.10 — the runtime peer range stays>=0.5.4because the SDK import is type-only and hosts supply their own copies.tui.tsxsource entry. Current betas resolve a path entry as<directory>/tui.tsxand skip entries that point at a file, so the repository root gains a re-export shim that lets a path entry load the source. The tarball ships onlydist, so it never reaches the package.opencode2 plugin add, which works with the./tui-only export map introduced in this PR. The docs also describe the streamed boundary, correct the current tool-input event behavior, explain why this plugin's settled t/s can differ from OpenCode's built-in figure, and document the current host cache layout (~/.cache/opencode/npm/<name>@<spec>/<generation>/, newest generation winning) for installs, upgrades, and the release runbook.Why the streamed boundary
The last content boundary is an approximation of the stream end: it is the final
text/reasoning/tool.inputblock-ended event, which can fire well before the stream exits, and it is missing entirely when a step produces no observable content.session.step.streamedis exact by construction.It also aligns the denominator with OpenCode's own assistant-footer t/s, which divides visible output tokens by
time.streamed - time.created. This plugin keeps its inclusive numerator (tokens.output + tokens.reasoning), so the two figures differ in what they count, not in how time is measured. On a nine-stepgpt-5.6-lunaturn with 523 visible and 985 hidden reasoning tokens over 28.84s of streamed spans, the built-in figure reads 18.1 t/s while this plugin settles at ~52 t/s.Compatibility
session.step.streamedon a host that never publishes it is a no-op, and settlement falls back to the content boundary. The earliest compatible beta stays0.0.0-beta-17595.assistantMessageIDkeeps the first attempt'sstartedAt;markStreamedis last-wins, so the boundary follows the latest attempt.Verification
@opencode/plugin@0.0.0-beta-19381, all 57 tests, build, and the compatibility check all pass.dist/tui.jsby path, so it does not exercise theexportsmap. That contract is covered by a local Node resolution test and by release runbook step 5, which installs the packed tarball from the registry before publishing.Version bump and publish follow the release runbook after merge.