Add Tasks panel infrastructure with type-safe IPC protocol#772
Add Tasks panel infrastructure with type-safe IPC protocol#772
Conversation
318c084 to
33757b5
Compare
Adds foundational infrastructure for the Tasks panel: Backend (TasksPanel.ts): - CRUD operations for tasks (create, delete, pause, resume) - Template and preset management - Log fetching with caching - Real-time push notifications to webview Type-safe IPC Protocol: - Generic request/response/notification patterns - Compile-time type safety for webview-extension messages - useIpc hook for React components - useTasksApi hook with typed methods Supporting infrastructure: - Test setup for jsdom compatibility with Lit elements - Codicon stylesheet integration for vscode-elements - React Compiler integration with ESLint plugin - pnpm catalog for consistent dependency versions
19abe9f to
8c9d478
Compare
8c9d478 to
4fdc74e
Compare
068ac5e to
343940c
Compare
- Remove unused `scope` feature from IPC protocol (YAGNI) - Remove redundant array spreads in TasksPanel - Make TaskDetails extend TaskActions to reduce duplication - Remove handler fallback in TasksPanel (keep requests/commands separate) - Add notification subscription support to useIpc hook - Add tests for onNotification feature - Remove redundant individual exports from tasks/api.ts (export as group only)
343940c to
f7f9316
Compare
DanielleMaywood
left a comment
There was a problem hiding this comment.
Just some minor nits for now. Still haven't had time to read and digest it all
6b927b2 to
c951db0
Compare
mafredri
left a comment
There was a problem hiding this comment.
Mainly focused on the tasks state handling. I read through the full PR but the other parts are a bit too far outside my ballpark to comment on.
| "canceled", | ||
| ]; | ||
|
|
||
| const PAUSED_STATUSES: readonly WorkspaceStatus[] = [ |
There was a problem hiding this comment.
Nit: Inconsistent naming? Paused/resumed, or pause-able/resumable?
|
|
||
| const RESUMABLE_STATUSES: readonly WorkspaceStatus[] = [ | ||
| "stopped", | ||
| "failed", |
There was a problem hiding this comment.
I imagine this status should allow either resume or pause?
| | "initializing"; | ||
|
|
||
| /** Compute the UI state from a Task object */ | ||
| export function getTaskUIState(task: Task): TaskUIState { |
There was a problem hiding this comment.
Shouldn't this use task.status primarily?
| return "complete"; | ||
| } | ||
|
|
||
| return "idle"; |
There was a problem hiding this comment.
This is only true for task.status === "active" && taskState == "idle", it probably shouldn't be the fall-back for when we didn't handle other statuses?
| | "complete" | ||
| | "error" | ||
| | "paused" | ||
| | "initializing"; |
There was a problem hiding this comment.
Might be good to add "pending" here too, although that won't be showing up correctly before next release.
For now it could be checked via task.status === "initializing" && workspace build === "pending".
Summary
Adds foundational infrastructure for the Tasks panel: a type-safe IPC protocol for webview-extension communication, the TasksPanel backend, and comprehensive test coverage.
Type-Safe IPC Protocol
The protocol uses phantom types (inspired by tRPC) to carry type information at compile time without runtime overhead:
Three message types with distinct semantics:
Why this design:
requestHandler,commandHandler) ensure type safety at definition time, catching errors before they reach call sitesTasksApiobject serves as the source of truth for all messagesPackage Structure
Shared types live in
@repo/sharedso both the extension (Node.js) and webviews (browser) import the same definitions.TasksPanel Backend
tasksUpdatednotificationCloses #775