Skip to content

feat(chat): cancel + block_id routing + replay + tests (0.8.0)#35

Merged
tbitcs merged 1 commit intodevelopfrom
feat/chat-panel-foundation
Apr 28, 2026
Merged

feat(chat): cancel + block_id routing + replay + tests (0.8.0)#35
tbitcs merged 1 commit intodevelopfrom
feat/chat-panel-foundation

Conversation

@tbitcs
Copy link
Copy Markdown
Contributor

@tbitcs tbitcs commented Apr 28, 2026

Summary

PR-2 of the three-PR chat-system completeness work. This adds four properties to the chat surface so the extension can power real multi-turn / multi-session work end-to-end:

  1. Cancel button in the chat panel footer — issues SIGTERM (taskkill on Windows; SIGTERM → SIGKILL after 2s on POSIX) to the running CLI child. The panel-dispose hook also kills every running child, so closing the panel no longer leaves orphan specsmith chat processes.
  2. block_id-keyed decision routing via the new ChatSessionRegistry — sessions are indexed by id and every tool_request / block_start kind=diff block_id is tagged with the session that emitted it. Decisions arriving from the panel route deterministically to the child that actually owns that block_id, so concurrent sessions no longer clobber each other's stdin.
  3. Per-session event persistence + replay via the new ChatHistory module — every header / event / exit record is appended as JSONL to <projectDir>/.specsmith/sessions/<id>/events.jsonl. The first time the panel is opened against a project that has prior sessions, the most-recent one is replayed under a replay: <id> divider. Empty-utterance invocations of specsmith.openChat reuse this path to surface history without starting a new turn.
  4. Mocha tests — 18 new unit tests across src/test/chat-session-registry.test.ts (routing semantics, observe/forget, fallback rules) and src/test/chat-history.test.ts (round-trip persistence, JSONL parsing, session listing).

The README also gets a new "Voice input (Web Speech API)" section explaining mic-permission expectations and the graceful fallback to text input when the API is unavailable.

Files

  • src/ChatSessionRegistry.ts (new) — pure routing logic; no vscode / child_process imports.
  • src/ChatHistory.ts (new) — JSONL append / read / list; pure stdlib.
  • src/ChatPanel.ts — Cancel button, replay(), setRunning(), programmatic dispose(), replay-divider style and running / replay_divider inbound messages.
  • src/ChatStreamConsumer.ts — rewritten around the registry + history modules; legacy _running: Map<projectDir, RunningSession> removed.
  • src/test/chat-session-registry.test.ts (new), src/test/chat-history.test.ts (new).
  • package.json — version bump to 0.8.0.
  • package-lock.json — synced to 0.8.0 / engines ^1.116.0.
  • CHANGELOG.md, README.md — entries for the new behaviour and the voice-input docs.

Verification

  • npm run lint (tsc --noEmit): clean.
  • npm run build (esbuild): 241.7kb bundle.
  • npm test: 41 passing (was 23 before the new tests).

Artifacts

Co-Authored-By: Oz oz-agent@warp.dev

PR-2 of the chat-system completeness work. Adds four properties to the chat surface in the VS Code extension.

Co-Authored-By: Oz <oz-agent@warp.dev>
@tbitcs tbitcs merged commit 0a12345 into develop Apr 28, 2026
1 check passed
@tbitcs tbitcs deleted the feat/chat-panel-foundation branch April 28, 2026 15:59
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.

1 participant