Skip to content

fix: Goal sidebar rendering with the OpenTUI function API#15

Open
tienbac2314 wants to merge 1 commit into
prevalentWare:mainfrom
tienbac2314:repro/goal-sidebar-function-api-comparison
Open

fix: Goal sidebar rendering with the OpenTUI function API#15
tienbac2314 wants to merge 1 commit into
prevalentWare:mainfrom
tienbac2314:repro/goal-sidebar-function-api-comparison

Conversation

@tienbac2314

Copy link
Copy Markdown

Summary

Rewrites the Goal TUI entrypoint from TSX/JSX to the @opentui/solid function API because the published raw TSX entrypoint does not render in OpenCode 1.18.3 on the tested Windows 11 and Ubuntu 24.04 installations.

The server plugin and /goal command already load correctly. This change keeps the existing sidebar data, lifecycle actions, cache behavior, and command-palette integration while avoiding the failing JSX renderer path.

Related issue

Closes #14

Changes

  • Replace JSX rendering with createElement, insert, and setProp.
  • Preserve Goal states and fields: objective, status, elapsed time, tokens, auto-continues, checkpoint, latest status, and stop reason.
  • Preserve refresh, history, pause, resume, and clear actions.
  • Preserve session tool-output scanning and in-memory/KV snapshot caching.
  • Request a TUI render once per second so elapsed time and state changes refresh.
  • Rename the TUI source entrypoint from src/tui.tsx to src/tui.ts and update package exports, published files, tests, and README documentation.

Verification

Tested the local package with OpenCode 1.18.3 on Windows 11. The vanilla 0.1.24 package loaded /goal but did not show the Goal block; this function-API version rendered it on the same installation.

Commands run:

bun run lint
# passed

bun run typecheck
# passed

bun test test/tui.test.ts test/package.test.ts
# 8 passed, 0 failed

bun run build
# passed; server.js built successfully

bun run pack:dry-run
# passed; package contains dist/server.js and src/tui.ts

Full bun test result on Windows:

63 passed, 1 failed

The only failure is the existing POSIX file-mode assertion in test/state.test.ts (0o666 received instead of 0o600 on Windows). All TUI and package tests pass.

Visual comparison:

Vanilla 0.1.24: Goal block absent

Vanilla Goal plugin with no Goal sidebar block

Function-API rewrite: Goal block visible

Function-API rewrite rendering the Goal sidebar block

Checklist

  • bun test passes (new behavior has regression coverage)
  • bun run lint passes
  • bun run typecheck passes
  • bun run build passes and dist/server.js is committed if server code changed
  • README/docs updated if behavior or options changed

Full bun test is unchecked because of the Windows-only file-permission assertion documented above. The focused TUI/package suite passes.

Note: merging to main automatically publishes a new patch release to npm.

Replace src/tui.tsx (JSX-based, broken) with src/tui.ts (function-based,
working). Uses same approach as oh-my-opencode-slim: createElement, insert,
setProp from @opentui/solid with sidebar_content slot registration and
setInterval + requestRender for live updates.

Features ported from original:
- Sidebar: status, time (live), tokens, auto-turns, checkpoints, objective
- Command palette (Ctrl+P > Goal)
- Goal action dialog (Refresh/History/Pause/Resume/Clear)
- Toast notifications
- All prompt functions

Known limitation: tokens only update when goal tools run (pause/complete),
not during regular agent work.
@tienbac2314
tienbac2314 marked this pull request as ready for review July 19, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Goal sidebar does not render on Windows 11 or Ubuntu 24.04

1 participant