diff --git a/ts/docs/plans/vscode-devx/STATUS.md b/ts/docs/plans/vscode-devx/STATUS.md index 484c282683..a2a782a6be 100644 --- a/ts/docs/plans/vscode-devx/STATUS.md +++ b/ts/docs/plans/vscode-devx/STATUS.md @@ -5,11 +5,13 @@ > and what remains. Update it whenever a capability changes state. Branch: earlier feature work merged to `main` via PR #2468; ongoing work -continues on the `dev/talzacc/typeagent_studio_part*` stack (currently part6 — -corpus capture + Impact Report regression verdict, which **closes the headline -"find a regression" gate**: the shipped regression predicate — the detector, not -this change — agrees with blind human labels on a fixed benchmark of hand-built -deltas at ~92%, above the 80% bar). +continues on the `dev/talzacc/typeagent_studio_part*` stack (currently part7). +part6 delivered corpus capture + the Impact Report regression verdict, which +**closes the headline "find a regression" gate**: the shipped regression +predicate — the detector, not this change — agrees with blind human labels on a +fixed benchmark of hand-built deltas at ~92%, above the 80% bar. **part7 adds the +Trace Viewer** (Gate D / J5): an A/B resolution-pipeline debugger that drills into +a single utterance from an Impact Report row. ## Capability matrix @@ -17,25 +19,26 @@ Legend: ✅ done · 🟡 partial · ❌ not started. "Wired to dispatcher" = backed by the real TypeAgent dispatcher/engine rather than an in-memory stand-in. -| Capability | Core logic | UI | Wired to dispatcher | Tested | -| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------ | -| Sandboxes (lifecycle, agent load/unload) | ✅ in-memory | ✅ tree view (channel-backed; agent runtime is source of truth) | ❌ in-memory only (no subprocess/isolated dispatcher) | ✅ | -| Sandbox persistence across reload/restart | ✅ | ✅ (auto-restore) | n/a | ✅ | -| Corpora (federation: in-repo / captures / external / feedback) | ✅ file-backed | ✅ tree view | n/a | ✅ | -| Event Log (structured event stream) | 🟡 in-memory ring buffer | ✅ tree view (+ channel-backed source) | ❌ most emit sites unwired | ✅ | -| Agent health (status bar + findings) | 🟡 heuristic/filesystem checks | ✅ status bar | ❌ no real schema parse / grammar compile | ✅ | -| Collisions (cross-schema grammar overlap) | ✅ real NFA scanner over compiled `.ag.json` | ✅ tree view + Skipped group + auto-scan (+ channel-backed source) | n/a (reads compiled grammars) | ✅ | -| Feedback (thumbs up/down → corpus) | ✅ | ✅ command | n/a | ✅ | -| Replay / compare engine | ✅ schema-enriched grammar (L1), construction-cache (L2), selectable two-mode (grammar/cache) + opt-in live wildcard validation (L4a) + red/green regression predicate (`likelyRegression`) | ✅ Impact Report webview (`ActionDelta[]`) | 🟡 grammar + live construction cache + working-tree wildcard validation; no two-version build-from-ref (L4b, deferred to P-7) | ✅ | -| Onboarding bridge (snapshot/restore, stale detection) | ✅ | ✅ commands | ❌ in-memory bridge | ✅ | -| Repo-root detection (find `packages/agents`) | ✅ | ✅ warn toast + status bar | n/a | ✅ | -| Webview infrastructure (`webviewKit`) | ✅ CSP/nonce host + typed protocol | ✅ singleton-panel host | — | ✅ | -| Regression verdict (red/green predicate) | ✅ `likelyRegression` (delta-shape + observation-scoped feedback-override); the detector agrees with blind human labels on a fixed benchmark of hand-built deltas at ~92% (bar 80%) | ✅ verdict banner + per-row Impact column | n/a (classifies replay rows) | ✅ | -| Impact Report webview | ✅ `replayCorpus` over channel | ✅ context header, A/B controls, Grammar/Cache + Validate toggles, durable state, verdict banner + Impact column, unified live-count filter chips, column sorting, utterance filter | 🟡 grammar + construction-cache + working-tree wildcard validation (L1–L2, L4a) | ✅ | -| Corpus capture (real utterances → actions, any agent) | ✅ display/interaction-log → corpus transform + import, auto-promote to shared in-repo corpus | ✅ import command + Corpora tree (filename-based rows, auto-refresh) | ✅ reads real interaction logs | ✅ | -| Schema Studio | ❌ | ❌ | ❌ | ❌ | -| Live Trace | ❌ | ❌ | ❌ | ❌ | -| `agr-language` / `vscode-shell` refactor onto core | 🟡 dependency edge only | — | ❌ no behavioral integration | ❌ | +| Capability | Core logic | UI | Wired to dispatcher | Tested | +| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------- | +| Sandboxes (lifecycle, agent load/unload) | ✅ in-memory | ✅ tree view (channel-backed; agent runtime is source of truth) | ❌ in-memory only (no subprocess/isolated dispatcher) | ✅ | +| Sandbox persistence across reload/restart | ✅ | ✅ (auto-restore) | n/a | ✅ | +| Corpora (federation: in-repo / captures / external / feedback) | ✅ file-backed | ✅ tree view | n/a | ✅ | +| Event Log (structured event stream) | 🟡 in-memory ring buffer | ✅ tree view (+ channel-backed source) | ❌ most emit sites unwired | ✅ | +| Agent health (status bar + findings) | 🟡 heuristic/filesystem checks | ✅ status bar | ❌ no real schema parse / grammar compile | ✅ | +| Collisions (cross-schema grammar overlap) | ✅ real NFA scanner over compiled `.ag.json` | ✅ tree view + Skipped group + auto-scan (+ channel-backed source) | n/a (reads compiled grammars) | ✅ | +| Feedback (thumbs up/down → corpus) | ✅ | ✅ command | n/a | ✅ | +| Replay / compare engine | ✅ schema-enriched grammar (L1), construction-cache (L2), selectable two-mode (grammar/cache) + opt-in live wildcard validation (L4a) + red/green regression predicate (`likelyRegression`) | ✅ Impact Report webview (`ActionDelta[]`) | 🟡 grammar + live construction cache + working-tree wildcard validation; no two-version build-from-ref (L4b, deferred to P-7) | ✅ | +| Onboarding bridge (snapshot/restore, stale detection) | ✅ | ✅ commands | ❌ in-memory bridge | ✅ | +| Repo-root detection (find `packages/agents`) | ✅ | ✅ warn toast + status bar | n/a | ✅ | +| Webview infrastructure (`webviewKit`) | ✅ CSP/nonce host + typed protocol | ✅ singleton-panel host | — | ✅ | +| Regression verdict (red/green predicate) | ✅ `likelyRegression` (delta-shape + observation-scoped feedback-override); the detector agrees with blind human labels on a fixed benchmark of hand-built deltas at ~92% (bar 80%) | ✅ verdict banner + per-row Impact column | n/a (classifies replay rows) | ✅ | +| Impact Report webview | ✅ `replayCorpus` over channel | ✅ context header, A/B controls, Grammar/Cache + Validate toggles, durable state, verdict banner + Impact column, unified live-count filter chips, column sorting, utterance filter | 🟡 grammar + construction-cache + working-tree wildcard validation (L1–L2, L4a) | ✅ | +| Trace Viewer webview | ✅ per-row `ReplayResolutionTrace` capture (all rows, changed-first, capped) + per-run persistence + single-utterance recompute; browser-neutral divergence view model (parity + cause attribution to the first diverging layer, rule-level culprit file via grammar hash) | ✅ A/B resolution-pipeline webview (cache → grammar → wildcard → result), cause bar + native A↔B file diff + per-side source jumps (grammar → `.agr`, action → schema); Impact Report entry points (right-click, telescope, arrow-nav) | 🟡 captured during real `replayCorpus` (grammar + construction cache + working-tree wildcard, L1–L4a) | ✅ view model unit-tested | +| Corpus capture (real utterances → actions, any agent) | ✅ display/interaction-log → corpus transform + import, auto-promote to shared in-repo corpus | ✅ import command + Corpora tree (filename-based rows, auto-refresh) | ✅ reads real interaction logs | ✅ | +| Schema Studio | ❌ | ❌ | ❌ | ❌ | +| Live Trace | ❌ | ❌ | ❌ | ❌ | +| `agr-language` / `vscode-shell` refactor onto core | 🟡 dependency edge only | — | ❌ no behavioral integration | ❌ | ## Roadmap at a glance — gate spine + backlog @@ -49,13 +52,13 @@ is clear why it waits. There is no second roadmap — depth (L4b) and breadth ### Gate spine (MVP critical path) -| Gate | Journey | Capability | Phase | Status | -| ----- | -------------------- | ------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **A** | J1 Stand up an agent | New-Agent Wizard | P-2 | ❌ not started (onboarding bridge ✅) | -| **B** | J2 Tune schema | Schema Studio | P-4 | ❌ not started | -| **C** | J4 Find a regression | Impact Report ≥ 80% red/green on hand-labelled `player` | P-3 | 🟡 **long pole** — engine L1–L4a ✅; corpus ✅; predicate + measurement ✅ (detector agrees with human labels at 92% on a fixture-delta benchmark); Impact Report wiring ❌ | -| **D** | J5 Debug a trace | Trace Viewer | P-3 | ❌ not started | -| **E** | J6 Observe live | Live Trace + status bar | P-5 | ❌ not started | +| Gate | Journey | Capability | Phase | Status | +| ----- | -------------------- | ------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **A** | J1 Stand up an agent | New-Agent Wizard | P-2 | ❌ not started (onboarding bridge ✅) | +| **B** | J2 Tune schema | Schema Studio | P-4 | ❌ not started | +| **C** | J4 Find a regression | Impact Report ≥ 80% red/green on hand-labelled `player` | P-3 | 🟡 **long pole** — engine L1–L4a ✅; corpus ✅; predicate + measurement ✅ (detector agrees with human labels at 92% on a fixture-delta benchmark); Impact Report wiring ❌ | +| **D** | J5 Debug a trace | Trace Viewer | P-3 | 🟡 A/B resolution-pipeline viewer built — one-click drill-in from an Impact Report row (right-click / telescope / arrow-nav), side-by-side vA/vB with cause attribution, grammar-step → AGR line and action → schema jumps, per-row trace capture + persistence + single-utterance recompute; **remaining for full pass:** cache-node → cache-entry inspect, and a surfaced replay-this-trace | +| **E** | J6 Observe live | Live Trace + status bar | P-5 | ❌ not started | **Critical path now: close Gate C** — corpus capture (the agent-agnostic capture path; `player` is just the anchor set the gate is scored on) → predicate tuning → diff --git a/ts/packages/grammarTools/ui/README.AUTOGEN.md b/ts/packages/grammarTools/ui/README.AUTOGEN.md index b8999ca6a9..b690a82929 100644 --- a/ts/packages/grammarTools/ui/README.AUTOGEN.md +++ b/ts/packages/grammarTools/ui/README.AUTOGEN.md @@ -3,7 +3,7 @@ - + # grammar-tools-ui — AI-generated documentation @@ -12,91 +12,100 @@ ## Overview -The `grammar-tools-ui` package provides a set of Lit web components for grammar visualization, editing, and debugging. These components are designed to work with the `grammar-tools-core` package, offering a user interface for interacting with grammar data. +The `grammar-tools-ui` package provides a collection of reusable Lit web components designed for grammar visualization, editing, and debugging. These components are tightly integrated with the `grammar-tools-core` package, enabling developers to create interactive user interfaces for working with grammar data. The package is used in other parts of the TypeAgent monorepo, such as the `agr-language` extension. ## What it does -The package includes several web components that facilitate various grammar-related tasks: +This package offers a suite of web components that support various grammar-related tasks, including visualization, debugging, and editing. These components are designed to work with a `GrammarBackend` interface, which acts as a bridge to the `grammar-tools-core` service. The key components include: -- `GtRuleList`: Displays a list of grammar rules. -- `GtSourceView`: Shows the source code of the grammar. -- `GtCompletionPanel`: Provides an interactive completion preview panel. -- `GtTraceTimeline`: Visualizes the trace of grammar matches. -- `GtCoverageHeatmap`: Displays a heatmap of grammar rule coverage. -- `GtDiffView`: Shows side-by-side grammar rule differences. -- `GtDebugPanel`: A composite debug panel that integrates multiple components for a comprehensive debugging experience. +- **`GtRuleList`**: Displays a list of grammar rules, allowing users to view and interact with individual rules. +- **`GtSourceView`**: Provides a detailed view of the grammar's source code, enabling users to explore its structure. +- **`GtCompletionPanel`**: An interactive panel for previewing completions based on partial input, helping users understand how different inputs are parsed. +- **`GtTraceTimeline`**: Visualizes the trace of grammar matches, offering insights into how the grammar processes input step by step. +- **`GtCoverageHeatmap`**: Displays a heatmap of grammar rule coverage, highlighting which rules are most frequently used. +- **`GtDiffView`**: Provides a side-by-side comparison of grammar rule differences, useful for analyzing changes between versions. +- **`GtDebugPanel`**: A composite panel that integrates multiple components, such as grammar loading, completion preview, trace visualization, coverage analysis, and diff comparison, into a single interface. -These components interact with a `GrammarBackend` interface, which defines methods for loading grammars, previewing completions, tracing matches, computing coverage, and more. +These components are designed to be modular and can be used individually or combined to create a comprehensive grammar debugging and visualization tool. ## Setup -To set up the `grammar-tools-ui` package, ensure you have the following environment variables configured: +To use the `grammar-tools-ui` package, ensure the following prerequisites are met: -- `GRAMMAR_TOOLS_CORE_PATH`: Path to the `grammar-tools-core` package. +1. **Install Dependencies**: This package depends on the `grammar-tools-core` package and the `lit` library. Ensure these dependencies are installed in your project. +2. **Environment Variables**: Set the `GRAMMAR_TOOLS_CORE_PATH` environment variable to the path of the `grammar-tools-core` package. This is required for the `GrammarBackend` interface to function correctly. +3. **Build the Package**: Use `pnpm` to install dependencies and build the package: + ```bash + pnpm install + pnpm build + ``` +4. **Integration**: Import the required components into your project and use them as custom elements in your HTML or JavaScript/TypeScript files. -For detailed setup instructions, see the hand-written README. +For additional setup details, refer to the hand-written README. ## Key Files -The package is structured as follows: +The `grammar-tools-ui` package is organized into several key files, each responsible for specific functionality: -- [src/index.ts](./src/index.ts): Exports the main components and types. -- [src/backend.ts](./src/backend.ts): Defines the `GrammarBackend` interface, which mirrors the `grammar-tools-core` service interface. -- src/fixture/index.ts: Exports the `FixtureBackend` for development and testing. -- [src/gt-completion-panel.ts](./src/gt-completion-panel.ts): Implements the `GtCompletionPanel` component. -- [src/gt-coverage-heatmap.ts](./src/gt-coverage-heatmap.ts): Implements the `GtCoverageHeatmap` component. -- [src/gt-debug-panel.ts](./src/gt-debug-panel.ts): Implements the `GtDebugPanel` component. -- [src/gt-diff-view.ts](./src/gt-diff-view.ts): Implements the `GtDiffView` component. -- [src/gt-rule-list.ts](./src/gt-rule-list.ts): Implements the `GtRuleList` component. -- [src/gt-source-view.ts](./src/gt-source-view.ts): Implements the `GtSourceView` component. +- **[src/index.ts](./src/index.ts)**: The main entry point of the package, exporting all components and types. +- **[src/backend.ts](./src/backend.ts)**: Defines the `GrammarBackend` interface, which mirrors the `grammar-tools-core` service interface. This interface includes methods for loading grammars, previewing completions, tracing matches, computing coverage, and more. +- **src/fixture/index.ts**: Provides the `FixtureBackend`, a mock implementation of the `GrammarBackend` interface for development and testing purposes. +- **[src/gt-completion-panel.ts](./src/gt-completion-panel.ts)**: Implements the `GtCompletionPanel` component for interactive completion previews. +- **[src/gt-coverage-heatmap.ts](./src/gt-coverage-heatmap.ts)**: Implements the `GtCoverageHeatmap` component for visualizing grammar rule coverage. +- **[src/gt-debug-panel.ts](./src/gt-debug-panel.ts)**: Implements the `GtDebugPanel` component, which integrates multiple debugging tools into a single interface. +- **[src/gt-diff-view.ts](./src/gt-diff-view.ts)**: Implements the `GtDiffView` component for side-by-side grammar rule comparisons. +- **[src/gt-rule-list.ts](./src/gt-rule-list.ts)**: Implements the `GtRuleList` component for displaying and interacting with a list of grammar rules. +- **[src/gt-source-view.ts](./src/gt-source-view.ts)**: Implements the `GtSourceView` component for exploring grammar source code. +- **[src/gt-trace-timeline.ts](./src/gt-trace-timeline.ts)**: Implements the `GtTraceTimeline` component for visualizing the trace of grammar matches. -### Component Details +## How to extend -- **GtRuleList**: Displays a list of grammar rules, allowing users to view and interact with individual rules. -- **GtSourceView**: Shows the source code of the grammar, providing a detailed view of the grammar's structure. -- **GtCompletionPanel**: Provides an interactive panel for previewing completions based on partial input, helping users understand how different inputs are parsed. -- **GtTraceTimeline**: Visualizes the trace of grammar matches, offering insights into how the grammar processes input. -- **GtCoverageHeatmap**: Displays a heatmap of grammar rule coverage, highlighting which rules are most frequently used. -- **GtDiffView**: Shows side-by-side differences between grammar rules, useful for comparing changes between versions. -- **GtDebugPanel**: Integrates multiple components into a single panel for comprehensive debugging, including grammar loading, completion preview, trace visualization, coverage analysis, and diff comparison. +To extend the `grammar-tools-ui` package, you can add new components or enhance existing ones. Below are the steps to guide you through the process: -## How to extend +1. **Create a New Component**: + + - Add a new TypeScript file in the `src/` directory. + - Use the Lit framework to define your custom element. For example: + + ```ts + import { LitElement, html, css } from "lit"; + import { customElement, property } from "lit/decorators.js"; + + @customElement("gt-new-component") + export class GtNewComponent extends LitElement { + static override styles = css` + /* Add your styles here */ + `; + + @property({ type: String }) + title = "New Component"; -To extend the `grammar-tools-ui` package, follow these steps: + override render() { + return html`
${error.message}
`)}