feat(chat): cross-workbench Chat tool with Logit Lens / Patch Lens handoff - #128
feat(chat): cross-workbench Chat tool with Logit Lens / Patch Lens handoff#128jon-bell wants to merge 2 commits into
Conversation
Add a collapsible Chat rail available on every workspace tool page. It talks to the same model as the rest of the workspace via the existing generate endpoint, and integrates with the interpretability tools: - Spin out: push a Logit Lens / Patch Lens prompt into the chat and generate up to N tokens. - Capture back: send a completed chat result into the Logit Lens or Patch Lens prompt editor. The rail is collapsed to a slim strip by default (bottom-right FAB + drawer on mobile) so it stays unobtrusive when idle. History is kept per-workspace in a persisted zustand store; spin-out/injection are ephemeral handoff channels. Co-authored-by: Jonathan Bell <jon@jonbell.net>
- chat-handoff.spec.ts (no NDIF): rail collapsed-by-default + toggle, and send-to-Logit-Lens handoff via a seeded chart + seeded chat message. - chat.spec.ts (real NDIF): compose+generate a continuation, and spin the lens prompt out to chat then capture it back. - seed-chat.cjs seeds a deterministic lens2 chart for the handoff spec. Co-authored-by: Jonathan Bell <jon@jonbell.net>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
|
🚀 Preview deployed
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Summary
Adds a Chat tool available across the whole workbench — a lightweight completion playground wired to the same model the rest of the workspace uses, with easy two-way handoff to the interpretability tools.
It fulfils the request:
UX
Chatstrip with an open button; expanded → header, transcript, and composer. Mounted at the workspace layout level so it appears on every tool page.MessageSquareFAB (mirrors the bottom-left charts drawer) opening a right-side slide-over with the same panel.Logit Lens/Patch Lenscapture actions.Handoff model
SpinOutButtonin Logit Lens and Patch Lens): opens the chat, seeds the composer with the tool's prompt, and auto-generates a continuation.Implementation
/models/start-generateNDIF flow — no backend changes.modelsApi.tsnow exports a baregenerateCompletion(no toast) for the rail's inline error UI, keepinguseGenerateintact.useChatzustand store (persisted tolocalStorage, keyed per-workspace) holds rail open-state, composer drafts, and conversation history. Interruptedpendingturns are surfaced as errors on rehydrate. This is the interim history home documented inCLAUDE.md(a DB-backed table is the eventual target).app/workbench/[workspaceId]/components/chat/:WorkbenchChat(layout switch),ChatRail,MobileChatDrawer,ChatPanel,ChatComposer,ChatMessageItem,SpinOutButton, and theuseChatControllerhook (generation + handoff logic shared by desktop/mobile).layout.tsx,Lens2Controls.tsx, and the Patch Lens page/area to mount the rail and wire spin-out + injection.Tests
tests/chat-handoff.spec.ts(no NDIF): rail is collapsed by default and toggles open; a seeded completed message is captured into the Logit Lens prompt editor (seeded lens2 chart viatests/seed-chat.cjs+ seeded chatlocalStorage, so no model run is needed).tests/chat.spec.ts(real NDIF): compose a prompt and generate a continuation; spin the lens prompt out to chat, generate, and capture the result back.Verification
bunx tsc --noEmit(no new errors),eslint,knip,prettier --check, andnext buildall pass for the changed files.