Tags: CopilotKit/vscode-extension
Tags
fix(playground): saved-replay sidebar + chat resilience (v0.2.3) (#43) ## Summary Five interlocking playground bugs surfaced during a single user session — each was masking the next. Fixes them all in one PR; cuts v0.2.3. - **Saved-replay sidebar ignored manual deletes.** `vscode.workspace.createFileSystemWatcher` is unreliable for dot-prefixed paths (notably `.copilotkit/`) on Windows. Replaced with a Node `fs.watch`-based `FixturesDirWatcher` that retries until the dir exists. Output channel now logs `[fixtures-watcher] attached`, `fs.watch <event>`, and `[playground] fixtures dir changed — refreshing sidebar` so the chain is self-diagnosing. - **Clicking ▶ on a saved replay produced an empty chat.** The extension posted `bundle-ready` then `play-fixture` back-to-back; the webview's `executePlaygroundBundle` is async, so the `play-fixture` `CustomEvent` fired before the new bundle's `PlaygroundChat` had registered its replay listener. App shell now unmounts the stale bundle synchronously on `bundle-ready`, queues the messages in state, and dispatches in a parent `useEffect` keyed on `[bundle, pendingReplay]` (React runs child effects before parent effects on the same commit → listener is attached before dispatch). - **Clicking ▶ on a deleted fixture permanently bricked the panel.** `load-fixture` set `replayFixturePath` first, then tried to read. The read failed but the path stayed, so every subsequent `runBundle` re-read the missing file and crashed. Refresh did nothing. Now: read-then-commit; on read failure clear state, refresh the sidebar, warn. `runBundle` also wraps its fixture read in try/catch and falls back to record mode when the file vanishes mid-session. - **Refresh wasn't a recovery path.** `runBundle` now posts a fresh `fixtures-list` at the *start* of every bundle pass, so Refresh is a guaranteed manual reconciliation with disk. - **Chat returned silently with too many `vscode.lm` tools.** Claude through Copilot Chat returns 200 OK + empty stream when ~80+ tools are forwarded. `vscode-lm-factory` now auto-retries once without `vscode.lm` tools, so the user gets a real response on the same query without changing their settings. If both attempts return empty, an actionable in-chat message explains the cause and points at `copilotkit.playground.enableVscodeLmTools`. - **`LanguageModelDataPart` text/json mimes are now surfaced.** Newer Claude builds routed through Copilot Chat stream text content as `DataPart` with `text/plain` or `application/json` mimes — previously dropped on the floor, producing the same empty-chat symptom. Unknown part types are logged with their constructor name + mime. Plus user-driven removal of a stale frontend tool from `test-workspace/playground/v2/Tools.tsx`. ## Test plan - [x] `pnpm run check-types` clean - [x] `pnpm run test` — 312 pass, 1 skipped (added 8 new tests across `view-provider`, `vscode-lm-factory`, `fixtures-dir-watcher`, `App.replay-race`) - [x] Manual: deleted a fixture from disk → sidebar updates within ~1s - [x] Manual: clicked ▶ on a deleted fixture → toast, sidebar refreshes, panel does not hang - [x] Manual: asked "what's the weather in sarajevo" with `enableVscodeLmTools=true` and 87 vscode.lm tools forwarded → auto-retry path fires, chat responds normally
fix(publish): drop --target from vsce publish (conflicts with --packa… …gePath) (#27) ## Why After #26 surfaced vsce's actual error (which the bash retry function was previously eating), the diagnostic was clear. Reproduced locally by downloading the failed run's `vsix-darwin-x64` artifact and running: ``` $ npx @vscode/vsce@^3 publish --target darwin-x64 --packagePath extension-darwin-x64.vsix --pat <fake> ERROR Both options not supported simultaneously: 'packagePath' and 'target'. Use 'vsce package --target <target>' to first create a platform specific package, then use 'vsce publish --packagePath <path>' to publish it. ``` vsce reads the target from the `.vsix` manifest's `<TargetPlatform>` tag (stamped at `vsce package --target` time) and explicitly rejects `--target` together with `--packagePath`. The error fires before any auth check, which is why all 4 vsce publishes failed in ~1 second flat. ovsx is more permissive and accepts both flags together — that's why every ovsx publish succeeded while every vsce publish failed identically. ## Fix Drop `--target ${{ matrix.target }}` from the `vsce publish` call. The matrix still records the target via the step name, the artifact name, the .vsix filename, and the manifest stamping — nothing self-documenting is lost. `ovsx publish --target ... --packagePath ...` is left as-is since ovsx accepts both and the explicit `--target` round-trips through the ovsx API for the registry's own metadata (and worked on the previous run for all 4 targets). ## State going in - **VS Code Marketplace:** still on `0.2.0`. `0.2.2` never landed. - **Open VSX:** has `0.2.2` for all 4 targets. - **#26 merged:** retry function now surfaces vsce/ovsx output regardless of exit code. ## Recovery on merge `prepare` will see Marketplace doesn't have `0.2.2` → proceeds. ovsx will return "already exists" for all 4 targets → idempotent success. vsce, with the conflicting flag removed, should publish all 4 targets cleanly. `finalize` will tag and cut the GitHub Release. ## Test plan - [x] Reproduced the error locally with the failed-run artifact - [x] Confirmed `vsce publish --packagePath <vsix>` (without `--target`) is the documented vsce form for publishing pre-packaged platform-specific .vsix files - [ ] After merge: push to main triggers re-run; vsce publishes all 4 targets to Marketplace; finalize creates `vscode-extension-v0.2.2` tag and GitHub Release
Playground chat tab: vscode.lm, scanner, bundler, fixture replay (#22) ## Summary Migrated from CopilotKit/CopilotKit#4635 (by @AlemTuzlak) to the standalone repo. - Replaces the OpenAI/Anthropic + API-key + Node-subprocess flow with VSCode's built-in Language Model API (`vscode.lm`), with optional `vscode.lm.tools` forwarding so the model can use Copilot's web-fetch tool out of the box - Adds a playground scanner that detects `<CopilotKit>` JSX nodes, serializes props, walks ancestors, maps hooks to components, and orchestrates multi-file scanning - Codegen modules (aggregator, entry, error-boundary, provider-chain templates) and rolldown bundler with Tailwind v4 compile pass + file watcher for hot-reload - Custom `PlaygroundChat` that drives the runtime over SSE, executes frontend tool handlers locally, supports `followUp: false`, renders markdown, and animates fixture replay - Fixture store for `.copilotkit/fixtures` with v2 schema (`RecordedCall[]`) and replay mode - Resizable/collapsible panels: MountedComponents, ConversationSidebar, DiagnosticsPanel, ModelPicker, ScannerView (state persisted to localStorage) - Test-workspace rebuilt as a v2-only weather demo with `useFrontendTool` and deterministic mock-data handlers ## Test plan - [ ] `vitest run` passes locally (300 tests) - [ ] Build produces clean dist - [ ] Open dev host on `test-workspace`, open Chat tab, ask "what's the weather in Sarajevo?" — renders populated WeatherCard