Theorem chat register: Studio panel + /chat, retire OpenWork host - #193
Conversation
Add @commonplace/theorem-chat-register (theorem.chat), mount it in the theorem-vscode chat panel and at /chat, and retire OpenWork as the product chat host (opt-in CONSOLE_OPENWORK_CHAT_PROXY rollback only).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (35)
📝 WalkthroughWalkthroughThe PR adds the ChangesTheorem chat register
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR replaces the console’s product /chat surface and the Studio chat panel surface with a single shared “Theorem chat register” implementation (register_impl=theorem.chat), retiring the OpenWork reverse-proxy path by default and documenting the supersession in the plan/spec artifacts.
Changes:
- Add new
@commonplace/theorem-chat-registerpackage (session controller, HTTP stream transport, React register UI, and Studio webview HTML shell). - Mount the register in Studio via
Theorem: Open Chat(apps/theorem-vscode) and in Console via/chatpages + updated view registry, with OpenWork proxy disabled unlessCONSOLE_OPENWORK_CHAT_PROXY=1. - Update plan/spec/execute-report + canonical manifest wiring (
.commonplace-canonical, manifest gate, supersession notes).
Reviewed changes
Copilot reviewed 34 out of 36 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check-register-manifest.mjs | Allows prototype.stage as an unmanifested companion descriptor. |
| pnpm-lock.yaml | Adds workspace links for the new theorem chat register package. |
| packages/theorem-chat-register/vitest.config.ts | Vitest configuration for the new package. |
| packages/theorem-chat-register/tsconfig.json | TS config for the new package. |
| packages/theorem-chat-register/src/webview-html.ts | Generates CSP-stamped Studio webview HTML shell for chat. |
| packages/theorem-chat-register/src/transport.ts | Defines injectable ChatTransport interface. |
| packages/theorem-chat-register/src/TheoremChatRegister.tsx | React register UI for /chat and Studio. |
| packages/theorem-chat-register/src/session.ts | Session controller with snapshot + prompt orchestration. |
| packages/theorem-chat-register/src/session.test.ts | Package-level tests for controller behavior + stamp. |
| packages/theorem-chat-register/src/register-impl.ts | Defines canonical REGISTER_IMPL = 'theorem.chat'. |
| packages/theorem-chat-register/src/index.ts | Barrel exports for the package surface. |
| packages/theorem-chat-register/src/http-stream-transport.ts | Fetch/SSE transport for console /api/chat/stream. |
| packages/theorem-chat-register/package.json | Package metadata, exports, scripts, and deps. |
| docs/plans/theorem-chat-register/SPEC-THEOREM-CHAT-REGISTER-1.0.md | Updates the normative spec with finalized contract + mounts. |
| docs/plans/theorem-chat-register/PLAN.md | Marks CR tasks done/verifying and updates plan board status. |
| docs/plans/theorem-chat-register/EXECUTE-REPORT.md | Adds execution report and remaining rollout steps. |
| docs/plans/ide-substrate-wire/FOLLOW-UP-CODE-SERVE-WEB.md | Updates status to reflect Copilot retirement and chat register plan link. |
| docs/plans/console/SPEC-COMMONPLACE-OPENWORK-FORK-1.0.md | Adds supersession note: OpenWork no longer product /chat host. |
| apps/theorem-vscode/vitest.config.ts | Adds path alias for theorem chat register source during tests. |
| apps/theorem-vscode/tsconfig.json | Adds TS path mapping for theorem chat register imports. |
| apps/theorem-vscode/src/extension.ts | Registers theorem.openChat command and wires chat panel. |
| apps/theorem-vscode/src/agent/chat-panel.ts | Implements Studio webview panel powered by shared controller + HTML. |
| apps/theorem-vscode/package.json | Adds dependency + command contribution for “Theorem: Open Chat”. |
| apps/console/src/views/TheoremChatRegister.tsx | Console wrapper view that provides HTTP stream transport. |
| apps/console/src/views/registry.tsx | Switches chat descriptors/renderers to Theorem chat register. |
| apps/console/src/views/OpenworkChatRegister.tsx | Deprecates OpenWork register view to forward to Theorem register. |
| apps/console/src/middleware.ts | Gates OpenWork reverse-proxy behind CONSOLE_OPENWORK_CHAT_PROXY=1. |
| apps/console/src/lib/register-impl.ts | Updates chat.surface register impl mapping to theorem.chat. |
| apps/console/src/app/chat/page.tsx | /chat now renders Theorem register instead of OpenWork redirect/proxy flow. |
| apps/console/src/app/chat/page.test.tsx | Updates tests to assert Theorem register render. |
| apps/console/src/app/chat/[threadId]/page.tsx | Thread pages render Theorem register (context only for now). |
| apps/console/src/app/chat/[threadId]/page.test.tsx | Updates thread page tests for theorem.chat stamp. |
| apps/console/package.json | Adds dependency on @commonplace/theorem-chat-register. |
| .harness/checklists/theorem-chat-register--plan-local-20260805a.json | Updates checklist statuses/evidence notes for CR-003..007. |
| .gitignore | Ignores local .pnpm-store/. |
| .commonplace-canonical | Updates canonical register record: /chat now theorem.chat, supersedes openwork.chat. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
apps/theorem-vscode/src/agent/chat-panel.ts:36
- Nonce generation should be unpredictable;
Date.now()is guessable. After importingrandomUUID, generate the nonce from it.
const nonce = String(Date.now());
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### Public API (CR-004) | ||
|
|
||
| - `REGISTER_IMPL = 'theorem.chat'` | ||
| - `ChatTransport`: `{ openSession(), prompt(text), subscribe(listener), dispose() }` |
| const snapshot = (): ChatSessionSnapshot => ({ | ||
| sessionId: sessionId ?? '', | ||
| messages, | ||
| running, | ||
| error, | ||
| }); |
| async open() { | ||
| error = null; | ||
| sessionId = await transport.openSession(); | ||
| emit(); | ||
| return sessionId; | ||
| }, |
| buffer += decoder.decode(value, { stream: true }); | ||
| const parts = buffer.split('\n\n'); | ||
| buffer = parts.pop() ?? ''; | ||
| for (const part of parts) { | ||
| const dataLine = part | ||
| .split('\n') | ||
| .find((line) => line.startsWith('data:')); | ||
| if (!dataLine) continue; | ||
| const raw = dataLine.slice('data:'.length).trim(); | ||
| const chunk = textOf(raw); | ||
| if (chunk) onDelta(chunk); | ||
| } |
| import * as vscode from 'vscode'; | ||
| import { createChatSessionController } from '@commonplace/theorem-chat-register/session'; | ||
| import { renderTheoremChatWebviewHtml } from '@commonplace/theorem-chat-register/webview-html'; | ||
| import type { ChatTransport } from '@commonplace/theorem-chat-register/transport'; |
Summary
@commonplace/theorem-chat-register(register_impl=theorem.chat) with session controller, HTTP stream transport, React register, Studio webview HTML.Theorem: Open Chatwebview over hosted ACP./chatrenders Theorem register; OpenWork reverse-proxy is off unlessCONSOLE_OPENWORK_CHAT_PROXY=1.plan-theorem-chat-register-20260805a.Test plan
pnpm --filter @commonplace/theorem-chat-register testnode scripts/check-register-manifest.mjspnpm --filter theorem-vscode check && build && testnode scripts/doctor.mjs/chatgreen (loginish ortheorem.chatstamp)/IDE→ Theorem: Open ChatPlan:
docs/plans/theorem-chat-register/PLAN.mdSummary by CodeRabbit
New Features
theorem.openChatcommand to the VS Code extension.Bug Fixes
Documentation