7 months ago
0a6567c* refactor: simplify protocol negotiation to JSON-RPC only Remove legacy protocol support from negotiation. Only cowork.jsonrpc.v1 subprotocol is now accepted. Legacy connections are rejected with a clear error message. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: remove legacy WebSocket path from startServer.ts Remove openLegacySocket/closeLegacySocket functions and the protocol branching in websocket open/message/close handlers. All connections now go through JSON-RPC transport exclusively. Remove unused imports of decodeClientMessage, dispatchClientMessage, and WEBSOCKET_PROTOCOL_VERSION. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: delete legacy WebSocket dispatch infrastructure Remove all legacy client message dispatch files: - decodeClientMessage.ts - dispatchClientMessage.ts and all sub-modules (.threadTurn, .session, .provider, .mcp, .skills, .agents, .memoryBackups, .shared) - Associated test files These were only used by the legacy WebSocket protocol path which has been removed in favor of JSON-RPC. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: remove ClientMessage type and legacy protocol constants Remove ClientMessage union type, WEBSOCKET_PROTOCOL_VERSION, CLIENT_MESSAGE_TYPES, SERVER_EVENT_TYPES, and the re-exports from protocolEventParser. Delete protocolParser.ts and protocolEventParser.ts which only served legacy client message parsing and event validation. ServerEvent and other shared types (SessionConfigPatch, ASK_SKIP_TOKEN) are preserved as they're used by JSON-RPC internals. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: simplify startServer types for JSON-RPC only Remove WsProtocolMode import, simplify protocolMode to literal "jsonrpc" type. All socket data types reflect the JSON-RPC-only protocol. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: rename legacyEventProjector, remove legacy tests, clean up AgentSocket - Rename legacyEventProjector.ts → eventProjector.ts (and function createJsonRpcLegacyEventProjector → createJsonRpcEventProjector) - Remove AgentSocket export from client/index.ts - Remove AgentSocket re-export from desktop lib/agentSocket.ts - Delete legacy test files: agentSocket.parse.test.ts, agentSocket.runtime.test.ts, tui.socketLifecycle.test.ts, protocol.test.ts - Rewrite ws-protocol-negotiation.test.ts for JSON-RPC-only behavior - Fix server.test.ts imports and remove legacy Protocol Doc Parity section https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: delete AgentSocket legacy WebSocket client The AgentSocket class was the legacy protocol client. All consumers (CLI, TUI) are being migrated to JsonRpcSocket. The client index now only exports JsonRpcSocket and modelStream utilities. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * fix: update server index and jsonrpc test for jsonrpc-only protocol - Fix server/index.ts to only accept "jsonrpc" for --ws-protocol-default - Update server.jsonrpc.test.ts: "jsonrpc is the default" test now verifies that default connections require the initialize handshake https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * docs: update CLAUDE.md for JSON-RPC-only protocol Update architecture documentation to reflect the removal of the legacy WebSocket protocol. Server & Protocol section now references JSON-RPC types. WebSocket-First Development Rule updated with JSON-RPC route workflow instead of ClientMessage/dispatchClientMessage pattern. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * fix: remove ClientMessage references from desktop app Fix desktop wsProtocol.ts to not import removed safeParseServerEventJson and ClientMessage from protocol.ts. Update workspaceDefaults.ts and threadEventReducer.ts to use local type definitions instead of the removed ClientMessage union. Simplify wsProtocol type to jsonrpc-only. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * refactor: remove legacy protocol tests from server.test.ts Remove WebSocket Lifecycle, Message Parsing, and Server Resilience test sections that tested the legacy WebSocket protocol (raw ServerEvent and ClientMessage). These are replaced by test/server.jsonrpc.test.ts and test/server.jsonrpc.flow.test.ts. Also remove desktop ws-protocol-parse test (tested removed safeParseServerEvent). Remaining: Server Startup (12 tests) and HTTP Handler tests pass. https://claude.ai/code/session_01Kd77TTnwcFkYgk7n9NZ4sq * fix: drop stale legacy websocket test coupling Move the remaining stale websocket-facing tests onto supported JSON-RPC routes and harness helpers instead of reviving retired transport code. Extract archived TUI prompt, args, hotkey, provider-auth, and local-state helpers so those tests cover live leaf logic without importing dead socket layers. Restore the desktop server-event parser surface used by cache/store tests, add JSON-RPC agent and harness-context routes and schemas, and defer harness-context cleanup until session persistence drains so restart coverage stops racing shutdown. Verification: bun test test/server.toolstream.test.ts; bun test test/tui.global-hotkeys.test.ts test/tui.sync-lifecycle.test.ts test/tui.log-filter.test.ts test/server.toolstream.test.ts test/harness.ws.e2e.test.ts; bun test test/tui.args.test.ts test/tui.question-prompt.test.ts apps/TUI/routes/session/question.test.ts test/jsonrpc.codegen.test.ts; bun test apps/TUI/context/local.test.ts apps/TUI/component/dialog-provider.test.ts; bun test test/harness.ws.e2e.test.ts apps/desktop/test/bootstrap-cache.test.ts apps/desktop/test/store-feed-mapping.test.ts; bun run docs:generate-jsonrpc; bun run docs:check; bun run typecheck; bun test. * test: speed up slow tool coverage Add narrow internal test hooks for the bash and webFetch tools so the tool test suite can avoid real shell subprocess startup and heavy HTML parser initialization when those costs are not the behavior under test. Update the slow bash and webFetch cases in test/tools.test.ts to use deterministic runners while still exercising the tool entrypoints. Verification: timing probe for test/tools.test.ts improved from about 0.656s to 0.253s; bun test test/tools.test.ts; bun run typecheck; bun test. * refactor: remove archived tui surface Remove the archived TUI app, source tree, docs mirror, and dedicated TUI tests instead of carrying them as a dormant client surface. Simplify the terminal entrypoint so the supported CLI path is the only terminal interface, drop the unused OpenTUI and Solid dependencies, and update contributor/docs references accordingly. Verification: - bun test test/cli-args.test.ts test/docs.check.test.ts - bun run docs:check - bun run typecheck - bun test * fix: align CLI REPL with JSON-RPC control contracts Read thread ids from the JSON-RPC thread envelope and hydrate CLI state from returned control-event payloads so startup, /new, and provider metadata loading stay in sync with the server contract. Route API-key auth through cowork/provider/auth/setApiKey, clear hard caps through cowork/session/usageBudget/set, source /tools from the real session tool-name policy, and update streamed delta/toolCall handling to match the current projector schema. Verification: - bun test test/repl.test.ts test/repl.server-event-handler.test.ts test/repl.thread-envelope.test.ts test/repl.disconnect-send.test.ts test/repl.restart-failure.test.ts - bun run typecheck - bun test * fix: restore CLI auth and resume parity Restore provider auth challenge/result handling for CLI JSON-RPC envelopes, keep resumed threads bound to their actual workspace cwd, and make /tools mirror the real root-session capability set including agent controls. Verification: - bun test test/repl.server-event-handler.test.ts test/repl.resume-cwd.test.ts test/repl.test.ts test/tools.test.ts - bun run typecheck - bun test * refactor: move conversation projection into harness core Replaces the split JSON-RPC/session snapshot projection logic with a shared harness-owned reducer and projected-item contract, moves model-stream normalization into shared code, and switches desktop live hydration onto projected turn/item snapshots instead of provider-specific re-projection. Updates the JSON-RPC schema/docs/generated artifacts, covers repeated raw ids plus non-turn projected items and ask/approval parity in tests, and records the verification trail in tasks/todo.md. Verification: - bun test test/jsonrpc.projectors.test.ts test/sessionSnapshotProjector.test.ts test/jsonrpc.thread-read-projector.test.ts apps/desktop/test/control-socket.test.ts apps/desktop/test/protocol-v2-events.test.ts test/server.jsonrpc.flow.test.ts - bun run typecheck - bun run docs:generate-jsonrpc - bun test * fix: clean up cowork activity rendering Skip blank reasoning placeholders in desktop activity groups so empty harness reasoning items do not render as empty Summary rows. Normalize Codex native web-search start args in the shared model-stream mapper to use the projected tool-card contract, and keep formatter compatibility for older replayed bare-action shapes.\n\nVerification:\n- bun test --cwd apps/desktop test/chat-activity-group-card.test.tsx test/store-feed-mapping.test.ts test/protocol-v2-events.test.ts test/chat-reasoning-ui.test.ts\n- bun test test/modelStreamReplay.test.ts apps/desktop/test/model-stream-mapper.test.ts apps/desktop/test/tool-card-formatting.test.ts\n- bun run typecheck\n- bun test test/permissions.test.ts (existing unrelated failures)\n- bun test (stops on the same existing unrelated permissions failures) * fix: snap google citation markers to sentence boundaries Use a shared raw-vs-markdown annotation heuristic so Google url citations stay attached to the right sentence instead of landing in the next bullet or mid-word. The resolver now prefers raw anchors when they already line up with the markdown source and falls back to markdown-aware remapping when they do not. Also teach native web-search card formatting to surface Google query arrays without a provider-specific desktop branch, and cover the real-session regressions with focused desktop/shared tests. Verification: bun test test/displayCitationMarkers.test.ts apps/desktop/test/message-links.test.ts apps/desktop/test/tool-card-formatting.test.ts apps/desktop/test/store-feed-mapping.test.ts; bun run typecheck; bun test. * fix: render native citations as paragraph chips Collapse native annotation citations into one compact chip per markdown paragraph or list item instead of injecting inline superscripts after each sentence. The shared citation normalizer now resolves the containing block after its raw-vs-markdown anchor heuristic and renders a dedicated chip wrapper with a compact source label plus +N when multiple citations land in the same block. Plumb citation source metadata through the desktop message renderer so the chip can use real source titles, and style it with a dedicated cite wrapper that survives the Streamdown sanitize pipeline. Verification: bun test test/displayCitationMarkers.test.ts apps/desktop/test/message-links.test.ts apps/desktop/test/tool-card-formatting.test.ts apps/desktop/test/protocol-v2-events.test.ts; bun run typecheck; bun test. * feat: add citation popup cards to message chips Turn native annotation citation chips into interactive popup cards with previous and next navigation over the grouped sources. The shared citation normalizer still owns paragraph and list-item grouping, but desktop now renders each chip through a custom cite component that opens an anchored source card instead of leaving the chip as a static label. Because Streamdown did not reliably forward custom data attributes into the cite renderer, the shared html-mode chip payload now rides through a preserved title attribute with a private prefix. ChatView also suppresses the footer sources carousel when native annotation chips are present so the same sources do not render twice. Verification: bun test apps/desktop/test/message-links.test.ts test/displayCitationMarkers.test.ts apps/desktop/test/chat-view.stability.test.tsx apps/desktop/test/protocol-v2-events.test.ts; bun run typecheck; bun test. * fix the card * fix: tighten citation popup cards Shrink the citation source popup into a lighter-weight picker, reduce the oversized arrow-control treatment, and keep the layout stable with placeholder-first favicon rendering. Prewarm favicon URLs when citation chips mount so icons are usually cached before the popup opens, and add focused regression coverage for the compact popup contract and favicon preloading behavior. * feat: resolve google citation titles in harness Add a server-side citation resolver for opaque Google grounding redirects, wire it into live Google annotation emission and thread/read hydration, and cover the new behavior with focused runtime/router tests. * chore: remove opentui references - Delete .agents/skills/opentui/ skill folder - Remove jsxImportSource from tsconfig.json - Remove src/tui from exclude in tsconfig.json * fix: keep Google citation enrichment off live stream path Prevent slow citation resolution fetches from stalling `text-end` delivery during Google native streaming. Queue enrichment per completed text block, wait only before returning final assistant content, and cover the slow-fetch path with a regression test. Made-with: Cursor * fix: keep thread/read citation enrichment off response path Return thread/read snapshots immediately instead of blocking on citation fetches or timeouts. Use settled citation cache data when available and warm unresolved Google redirect metadata asynchronously for later reads. Made-with: Cursor * fix: validate harness context payload for cowork/session/harnessContext/set Made-with: Cursor * fix: project committed steers into thread feeds * fix: allow desktop custom app links * fixes * fix: stabilize desktop skills and command mocks * test(desktop): isolate skill store and detail dialog workspaces for parallel CI Use unique workspace ids and reactivateWorkspaceJsonRpcState in beforeEach so bun test --max-concurrency does not leak disposed JSON-RPC state or clobber useAppStore runtime keys shared with other specs. Made-with: Cursor * Update executable_resolution.py * fix: bound citation caches and harden Google stream cleanup - Cap settled (512) and in-flight (128) citation resolution maps with FIFO eviction - Await stream delivery and annotation enrichment concurrently; settle enrichments on error path - Document thread/read cache-only citation path and agent spawn enum validation - Add citation cache eviction regression test Made-with: Cursor * fixes * fix(test): stabilize CI-flaky skill dialog and journal replay tests - Skill detail dialog: use functional setState updater to merge workspaceRuntimeById instead of replacing it, preventing concurrent test files from clobbering each other under --max-concurrency 4 - Journal replay: increase test timeout to 15s to accommodate CI resource contention with multiple server tests running in parallel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): revert skill detail dialog test to main-branch pattern with diagnostics Revert the workspace isolation approach (unique ID + beforeEach + functional setState) back to the main-branch pattern that passes CI. Keep only the required openExternalUrl mock addition. Add DOM dumps to error messages for CI debugging if buttons are still missing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(test): add comprehensive diagnostics to skill detail dialog test Add store state verification before render, capture console.error during render, and dump store state after render to diagnose CI-only failure where the component renders an empty DOM. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(test): add canary render and store identity checks for CI debug Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(test): add dialog mock and zustand store probes for CI debug Test whether the Dialog mock is applying correctly on CI and whether Zustand's useAppStore hook returns correct data inside a rendered component in the JSDOM environment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(test): wrap SkillDetailDialog to capture component-level store reads Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Parent7153c05