Skip to content

feat(phonon): Graft Kit MVP — molecule system + marketplace demo#300422

Closed
Alemusica wants to merge 44 commits intomicrosoft:mainfrom
Alemusica:feat/fase4-molecule-system
Closed

feat(phonon): Graft Kit MVP — molecule system + marketplace demo#300422
Alemusica wants to merge 44 commits intomicrosoft:mainfrom
Alemusica:feat/fase4-molecule-system

Conversation

@Alemusica
Copy link
Copy Markdown

Summary

Complete implementation of the Phonon Graft Kit system (Fase 4 pipeline, steps 1-8):

  • Rename molecule→graft across entire phonon codebase (types, registry, bridge, compositor, tests)
  • GraftDNA manifest contract: tokenWeight, domain, category, tags, shows, relatesTo for AI-driven composition
  • Iframe sandbox rendering with window.phonon postMessage bridge
  • Dual-mode compositor: deterministic path via defaultGrafts (zero AI cost) + AI-driven composeFromIntent
  • 7-gate intent gatekeeper (structure, action, entity, existence, depth, layout, params)
  • State management (setState/getState) + state aggregation for system prompt enrichment
  • Hot reload via correlated FileSystemWatcher with state preservation
  • Application-style canvas (panel layout, not card widgets)
  • Developer View toggle with per-graft metadata overlay + footer showing token savings, energy (Wh), CO₂ (g)
  • ICompositionMetrics event on compositor (graftCount, publisherCount, graftEquivalentTokens, intentTokens)
  • GraftDNA type alias as public SDK contract name

Marketplace demo — two extensions

Extension Publisher Grafts Domain
phonon-module-ristorazione Marco Rossetti (indie) 8 (incl. SP69 traffic heatmap) Ristorazione
phonon-module-ops Northwind Data (enterprise) 5 IT Operations

Test Plan

  • 235 phonon/liquid tests passing
  • Zero layering violations (npm run valid-layers-check)
  • Manual: install both extensions, verify sidebar navigation
  • Manual: toggle Developer View, verify graft metadata overlay
  • Manual: check traffic heatmap renders SP69 data correctly

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

alelab and others added 30 commits February 19, 2026 12:29
Phase 0 (Rebrand):
- product.json: renamed to Phonon IDE, Open VSX gallery, removed defaultChatAgent
- Replaced app icons (darwin/linux/win32) with Phonon branding
- Added null checks for removed defaultChatAgent in 4 files

Phase 1 (Claude Native Integration):
- New contrib: src/vs/workbench/contrib/phonon/ (6 files)
- IPhononService: API key management via ISecretStorageService
- PhononLanguageModelProvider: direct HTTP to api.anthropic.com with SSE streaming
- PhononChatAgentImpl: registered as dynamic agent (isCore: false, isDefault: true)
- 3 Claude models: Opus 4.6, Sonnet 4.6, Haiku 4.5
- Context keys: chatSetupInstalled, chatIsEnabled, panelParticipantRegistered
- Commands: Phonon Set API Key, Phonon Clear API Key
- Model cache population via triggerInitialModelResolution()

Note: product.json contains extensionsGallery for Open VSX (needed in dev for this fork)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace HTTP API with claude -p subprocess for chat (uses Max subscription,
no API key needed). IPC bridge via Pattern B: main process spawns CLI,
renderer receives streaming events through permanent dispatch map.

Key changes:
- IPhononCliService: IPC interface + main process impl + renderer proxy
- PhononLanguageModelProvider: CLI-to-AsyncIterable bridge with HTTP fallback
- Permanent event dispatch map eliminates IPC subscribe/unsubscribe race
- Clean env (strip CLAUDE_CODE_* vars) prevents CLI nesting guard
- stdin.end() after spawn prevents silent hang on EOF wait
- Skip assistant message type to prevent text duplication
- Phonon Calm: scientifically-based color theme (ART, circadian-friendly)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Foundation types for the Phonon Module Manifest System:
contribution types (raw from package.json), resolved types
(after extension point processing), canvas composition types,
and AI capability summary. Pure type surface - zero runtime code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…idebar sort

Code quality review fixes:
- Add onDidChangeDataProviders event to match reactivity contract
- Sort sidebar children recursively, not just root level
- Add tests for both fixes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
First liquid module skeleton proving the manifest system end-to-end.
Contributes 3 entities (dish, supplier, order), 4 views, 1 data provider,
and sidebar structure for restaurant management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Captures core architecture (3-layer model), language-agnostic card
development, AI-native composition, marketplace model, and Card SDK
design. Source material for future pitches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hides activity bar, status bar, and panel when App Mode is active,
leaving only canvas + sidebar + chat visible. State persists per
workspace via IStorageService and restores on startup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ILiquidCardContribution (raw from package.json) and ILiquidCard
(resolved with URI + extensionId) model sandboxed HTML webview cards.
ICompositionSlot now accepts either viewId or cardId (mutually exclusive).
ILiquidCapabilitySummary includes cards for AI consumption.
All consumers updated for optional viewId: canvas editor, registry
validateIntent, and both test suites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Card-to-host and host-to-card typed message protocol with LiquidCardSlotHost
handler class, ILiquidDataResolver interface, and injectable bridge script
that exposes window.phonon API inside card iframes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the card registry extension point and query methods for the Liquid
Module system:
- Register `liquidCards` extension point with JSON schema (id, label,
  entry, entity, tags, size) and handler that resolves HTML entry paths
  to full URIs via URI.joinPath
- Add `getCardsForEntity(entityId)` and `getCardsByTag(tag)` to the
  ILiquidModuleRegistry interface and LiquidModuleRegistry implementation
- Add tests for both query methods covering entity filtering, tag
  filtering, and empty-result cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Standalone HTML fragments for food-cost, orders-incoming, supplier-status,
daily-specials, revenue-today, inventory-alert. Each uses window.phonon bridge
for data fetching, ES5 JS, dark-theme styling, zero external deps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tents

The system prompt now enumerates available cards (micro-widgets) from
the Liquid Module registry, enabling Claude to compose card-based
phonon-intent blocks using cardId. Canvas Composition instructions
updated with card and view examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Register ILiquidDataResolver as a VS Code DI service (decorator +
interface in liquidCardBridge.ts) and implement LiquidMockDataProvider
with hardcoded ristorazione data (dishes, suppliers, orders). Cards
fetch this data through the bridge postMessage protocol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire LiquidSidebarDataProvider navigation event to LiquidCanvasEditor.
Dashboard nodes compose a grid of dashboard-tagged cards; regular nodes
open a single-view intent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ancellation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ridge

- Vision document: composition platform framing, value proposition,
  onboarding flow, Card SDK spec, who-benefits section
- Fase 3.5 plan: 9 tasks for sandboxed webview card architecture
- Liquid extension points registered in extensionPoints.json
- Mock data provider wired via side-effect import
- Bridge script dual-transport (acquireVsCodeApi + postMessage fallback)
- MCP bridge intent interception for solo + team mode
- Phonon configuration extended for Liquid App settings

Sidebar + navigation + 5-card dashboard grid working.
Card webview content rendering needs further work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous approach used fetch() inside the webview sandbox to load
card HTML via asWebviewUri — blocked by CSP. Now reads card files
via IFileService on the host side and inlines content into setHtml().

All 5 cards render successfully with bridge + data binding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover the 3 critical untested files with 54 total tests (was 31):
- phononMcpBridge: 19 tests (3-tier intent extraction, validation, edge cases)
- phononAutoSpawn: 20 tests (scoring heuristic, team/solo threshold, worker inference)
- liquidCardBridge: 15 tests (all 7 message types, error paths, disposal)

Type preparation for Fase 4+:
- CardRuntime type ('js' | 'wasm-bindgen' | 'pyodide' | 'emscripten')
- runtime + permissions fields on ILiquidCard(Contribution)
- priority field on ILiquidDataProvider(Contribution)
- Extension point defaults (runtime='js', permissions=[], priority=0)

Fix setTimeout(50) timing bomb in canvas tests → setTimeout(0).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename ILiquidCard→ILiquidMolecule, add MoleculeDNA fields (domain, category,
layout, shows, relatesTo, description). Remove premature CardRuntime type.
Rename cardId→moleculeId in composition slots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oleculeDNA

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
alelab and others added 14 commits March 9, 2026 15:36
Update all 5 phonon test files to match the card→molecule production rename:
- liquidModuleTypes.test: ILiquidCard→ILiquidMolecule, CardRuntime→ComponentCategory,
  ILiquidCardContribution→ILiquidMoleculeContribution, cardId→moleculeId, cards→molecules
- liquidModuleRegistry.test: updateCards→updateMolecules, getCardsForEntity→getMoleculesForEntity,
  getCardsByTag→getMoleculesByTag, cardId→moleculeId, add findByEntity/findByDomain tests
- liquidCanvasEditor.test: ILiquidCard→ILiquidMolecule, import from liquidMoleculeBridge,
  cardId→moleculeId, "Card:"→"Molecule:", "Card load error"→"Molecule load error"
- liquidCardBridge.test→liquidMoleculeBridge.test: LiquidCardSlotHost→LiquidMoleculeSlotHost,
  ICardWebview→IMoleculeWebview, CardToHostMessage→MoleculeToHostMessage,
  HostToCardMessage→HostToMoleculeMessage, cardId→moleculeId
- phononMcpBridge.test: updateCards→updateMolecules, cardId→moleculeId, molecule mock data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace direct DOM injection with sandboxed iframe rendering. Molecules
now run inside <iframe sandbox="allow-scripts"> with srcdoc containing
the molecule HTML plus an ES5 bridge shim that exposes window.phonon
via postMessage. This eliminates workbench window pollution and provides
proper isolation between molecules and the host.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pure function validateIntent() with 7 sequential gates:
structure, action, entity, existence, depth, layout, params.
42 tests covering all gates including parameter sanitization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Molecules report state via phonon.setState(key, value). Canvas editor
aggregates state per molecule. System prompt includes active canvas
state snapshot and uses molecule terminology throughout.

- Add phonon:setState to bridge protocol + onDidStateChange event
- Add phonon:stateUpdate for state restoration (hot reload prep)
- Add setState/getState to iframe bridge shim
- Add getCanvasStateSnapshot() to canvas editor
- Fix system prompt: cards -> molecules with MoleculeDNA fields
- Fix sidebar: getCardsByTag -> getMoleculesByTag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Watch molecule entryUri with correlated watcher. On change: save state,
destroy iframe, re-render with preserved state via phonon:stateUpdate.
Sub-second iteration cycle for molecule development.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…alization

- I-1: Use MutableDisposable for slot host lifecycle in hot reload
- I-2: Nest user params under `params` key to prevent collision with gate fields
- I-3: Add reloadInFlight guard to prevent overlapping hot reloads
- I-4: Use dom.append() instead of raw appendChild for iframe
- I-5: Localize all user-facing strings via nls.localize()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete Graft Kit terminology rename per design doc:
- Types: ILiquidMolecule→ILiquidGraft, MoleculeDNA→GraftDNA
- Files: liquidModuleTypes→liquidGraftTypes, liquidMoleculeBridge→liquidGraftBridge
- Slots: moleculeId→graftId, defaultMolecules→defaultGrafts
- Bridge: LiquidMoleculeSlotHost→LiquidGraftSlotHost, IMoleculeWebview→IGraftWebview
- Registry: updateMolecules→updateGrafts, onDidChangeMolecules→onDidChangeGrafts
- Extension point: liquidMolecules→liquidGrafts in extensionPoints.json
- Extension: phonon-module-ristorazione package.json updated
- All 156 phonon tests passing, zero remaining molecule references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port traffic analysis from gestionale-ristorazione:
- traffic-heatmap: 7x8 grid with SP69 Roadwise real data
- traffic-insight: rule-based insight cards (picchi, anomalie, stagionalita)
- New 'Traffico' view with both grafts as defaults

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Northwind Data Operations Intelligence module:
- 4 entities: service, incident, deployment, metric
- 5 grafts: service-health, incident-board, deploy-timeline, resource-gauge, alert-feed
- 3 views: Dashboard, Incidents, Deployments
- Professional dark theme, enterprise styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Canvas renders grafts as integrated panels, not card widgets
- Developer View toggle (persisted per profile)
- Overlay shows graft ID, publisher, domain, motif per slot
- Footer shows graft count, equivalent tokens, energy/CO2 savings
- ICompositionMetrics event on compositor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move 6 existing graft HTML files from cards/ to grafts/
- Update all entry paths in package.json
- Publisher: "Marco Rossetti" (indie dev persona)
- displayName: "Gestione Ristorante"
- tokenWeight calculated for all 8 grafts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… event tests

Adds ICompositionMetrics interface and GraftDNA type alias to liquidGraftTypes.
Tests cover onDidCompose event firing for both composeFromView and composeFromIntent
paths, verifying metric shapes and intentTokens values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/code/electron-main/app.ts
  • src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts

@deepak1556

Matched files:

  • src/vs/code/electron-main/app.ts

@Alemusica
Copy link
Copy Markdown
Author

Opened against wrong repo by mistake. Moving to Alemusica/vscode_ale.

@Alemusica Alemusica closed this Mar 10, 2026
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.

2 participants