Add OpenTUI Solid reference client for PrologAgent UI v1 #113

Merged
lost-rob0t merged 16 commits from agent/opentui-solid-reference-client-current into main 2026-08-20 01:42:24 +00:00
lost-rob0t commented 2026-08-19 04:20:52 +00:00 (Migrated from github.com)

Closes #112.

What changed

Adds the first standalone renderer for the merged prolog_agent_ui_v1 contract without introducing a second agent/runtime implementation.

  • adds a self-contained Bun + OpenTUI + SolidJS package under agentProlog/ui/opentui/;
  • pins @opentui/core / @opentui/solid 0.4.5 and solid-js 1.9.12, with the Solid JSX preload/config expected by current OpenTUI;
  • adds a typed v1 decoder/validator and deterministic presentation reducer matching the canonical Prolog snapshot/event semantics;
  • preserves server-owned sequence numbers and keeps request correlation separate;
  • rejects sequence gaps/session mismatches/malformed records/unsupported required extensions and surfaces unexpected server frames/transport exit;
  • keeps optional unknown events and unknown tools generically renderable;
  • isolates child-process NDJSON behind an NdjsonTransport interface so a local socket can replace stdio without changing protocol/reducer code;
  • spawns the canonical child-swipl fixture and negotiates prolog_agent_ui_v1;
  • renders conversation streaming, task/tool state, approvals/questions, subagents, verification, usage, traces, indeterminate effects, and optional extension records;
  • keyboard choices send only values already advertised by authoritative protocol state; TypeScript does not implement authority policy;
  • adds deterministic golden replay, duplicate/gap, required-extension, UTF-8 bound, request-correlation, real child-swipl command round-trip, and in-memory OpenTUI render tests;
  • adds a path-filtered AgentProlog UI Actions workflow for dependency install, typecheck, and deterministic tests;
  • adds a Prolog-side command codec regression and surfaces fixture frame-encoding failures instead of silently exiting the fixture server;
  • rejects outstanding correlated requests when the client is deliberately closed, preventing unresolved Promise/request leakage;
  • updates AgentProlog README.

Runtime boundary

The client does not execute tools, mutate repositories, implement permissions, decide verification success, or reconstruct domain state from trace prose. If future renderer work needs semantics not present in prolog_agent_ui_v1, that is a protocol/facade issue rather than permission to grow a TypeScript runtime.

Reconciliation

PR #115 / the Project source-and-grammar registry is now merged. This PR targets main directly. The former stacked #95 base and the current merged #115 tree are source-identical for this PR's tested base delta, so no hidden source change was introduced by the retarget.

The only file shared with the active DeepSeek Harness PR #125 is test/run_tests.pl, where this PR adds its independent Prolog fixture-codec test registration. The OpenTUI runtime and tests do not modify DeepSeek Harness implementation files.

CI hardening found during final merge review

The renderer/transport review found one additional lifecycle defect before merge: caller-initiated ProtocolClient.close() could leave an in-flight correlated request unresolved because the expected-close path suppressed failAll(). Head 99acd1a1823ebb00188282c66a8a08f6b90b5832 rejects those pending requests deterministically and adds a regression test that would otherwise hang until the Bun test timeout.

Non-goals

  • no real coding workflow transport yet;
  • no repository mutation/project tool pack;
  • no new authority semantics;
  • no final Unix/local socket transport;
  • no full composer/session navigator/file browser yet;
  • no Emacs/Lem/CL/Nim renderer in this slice.

Verification

The AgentProlog UI workflow is the execution oracle for Bun/OpenTUI/Solid typecheck, protocol/transport tests, real child-swipl fixture integration, noninteractive render smoke, and the new pending-close regression. Existing repository CI remains authoritative for core regression checks, and the Tree-sitter lane must remain green.

Merge only after the exact reviewed head is green on all required deterministic and live gates. A provider-side OpenRouter quota failure is recorded as external evidence but is not silently converted into success or skipped.

Closes #112. ## What changed Adds the first standalone renderer for the merged `prolog_agent_ui_v1` contract without introducing a second agent/runtime implementation. - adds a self-contained Bun + OpenTUI + SolidJS package under `agentProlog/ui/opentui/`; - pins `@opentui/core` / `@opentui/solid` 0.4.5 and `solid-js` 1.9.12, with the Solid JSX preload/config expected by current OpenTUI; - adds a typed v1 decoder/validator and deterministic presentation reducer matching the canonical Prolog snapshot/event semantics; - preserves server-owned sequence numbers and keeps request correlation separate; - rejects sequence gaps/session mismatches/malformed records/unsupported required extensions and surfaces unexpected server frames/transport exit; - keeps optional unknown events and unknown tools generically renderable; - isolates child-process NDJSON behind an `NdjsonTransport` interface so a local socket can replace stdio without changing protocol/reducer code; - spawns the canonical child-`swipl` fixture and negotiates `prolog_agent_ui_v1`; - renders conversation streaming, task/tool state, approvals/questions, subagents, verification, usage, traces, indeterminate effects, and optional extension records; - keyboard choices send only values already advertised by authoritative protocol state; TypeScript does not implement authority policy; - adds deterministic golden replay, duplicate/gap, required-extension, UTF-8 bound, request-correlation, real child-`swipl` command round-trip, and in-memory OpenTUI render tests; - adds a path-filtered AgentProlog UI Actions workflow for dependency install, typecheck, and deterministic tests; - adds a Prolog-side command codec regression and surfaces fixture frame-encoding failures instead of silently exiting the fixture server; - rejects outstanding correlated requests when the client is deliberately closed, preventing unresolved Promise/request leakage; - updates AgentProlog README. ## Runtime boundary The client does **not** execute tools, mutate repositories, implement permissions, decide verification success, or reconstruct domain state from trace prose. If future renderer work needs semantics not present in `prolog_agent_ui_v1`, that is a protocol/facade issue rather than permission to grow a TypeScript runtime. ## Reconciliation PR #115 / the Project source-and-grammar registry is now merged. This PR targets `main` directly. The former stacked #95 base and the current merged #115 tree are source-identical for this PR's tested base delta, so no hidden source change was introduced by the retarget. The only file shared with the active DeepSeek Harness PR #125 is `test/run_tests.pl`, where this PR adds its independent Prolog fixture-codec test registration. The OpenTUI runtime and tests do not modify DeepSeek Harness implementation files. ## CI hardening found during final merge review The renderer/transport review found one additional lifecycle defect before merge: caller-initiated `ProtocolClient.close()` could leave an in-flight correlated request unresolved because the expected-close path suppressed `failAll()`. Head `99acd1a1823ebb00188282c66a8a08f6b90b5832` rejects those pending requests deterministically and adds a regression test that would otherwise hang until the Bun test timeout. ## Non-goals - no real coding workflow transport yet; - no repository mutation/project tool pack; - no new authority semantics; - no final Unix/local socket transport; - no full composer/session navigator/file browser yet; - no Emacs/Lem/CL/Nim renderer in this slice. ## Verification The AgentProlog UI workflow is the execution oracle for Bun/OpenTUI/Solid typecheck, protocol/transport tests, real child-`swipl` fixture integration, noninteractive render smoke, and the new pending-close regression. Existing repository CI remains authoritative for core regression checks, and the Tree-sitter lane must remain green. Merge only after the exact reviewed head is green on all required deterministic and live gates. A provider-side OpenRouter quota failure is recorded as external evidence but is not silently converted into success or skipped.
Sign in to join this conversation.
No description provided.