Skip to content

feat(kit): enrich launcher view with command binding, terminal digest, and session navigation#435

Open
antfubot wants to merge 7 commits into
mainfrom
dry-pumas-relax
Open

feat(kit): enrich launcher view with command binding, terminal digest, and session navigation#435
antfubot wants to merge 7 commits into
mainfrom
dry-pumas-relax

Conversation

@antfubot

@antfubot antfubot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Turns the launcher dock view into a small process-control card and consumes devframe 0.7.3's new cross-iframe dock-activation API.

A launcher can now:

  • Bind a commandlauncher.command links the launch action to a registered command, so the launch button, the command palette, and any keybinding all run one handler.
  • Show progress/status — a short launcher.progress line reflecting what the process is doing (e.g. "Waiting for the server…", "Running"), rather than a raw output preview.
  • Navigate to its session — a View in Terminal action jumps the host shell to the Terminals dock focused on that exact session (where the full output lives), via the hub's hub:docks:activate({ dockId, params: { sessionId } }).

createProcessLauncher composes these primitives for the two common shapes, in one call:

  • Terminal launcher (no serve): spawn a long-running process and stay a launcher, showing its running/finished status (dev servers, watchers, builds).
  • Server launcher (prepare + serve.onReady): run some commands, start a server, then replace the card with an iframe embedding the server once it's ready. This is the most common shape, and Vitest uses it end-to-end (install @vitest/ui on demand → spawn vitest --ui → wait → embed).

Robust failure handling. If the process exits before its server is ready (e.g. Vitest's No test files found, exiting with code 1), the launcher fails fast — the readiness probe is raced against the process exit (DTK0052) — surfaces the reason on the card, and turns the launch button into a clickable Retry. (The on-launch bridge was also fixed: it cached the in-flight promise and never cleared it, so retries did nothing.)

What's included

  • devframe → 0.7.3 (devframe + @devframes/* catalog): brings hub:docks:activate (cross-iframe dock activation) and terminal-session focus-by-id.
  • kit
    • Superset launcher fields on the launcher view (command / terminalSessionId / progress) — a deliberate downstream shim (see below); they ride the existing devframe:docks shared-state sync untouched.
    • createProcessLauncher — register + command binding + prepare + spawn + progress + session navigation, with an optional serve.onReady that swaps the launcher to an iframe once a server is up, and fail-fast on early exit.
    • createInstallLauncher binds its install action to a command.
    • DEVTOOLS_TERMINALS_DOCK_ID constant; DTK0052 diagnostic.
  • core
    • ViewLauncher.vue renders the progress line + View in Terminal button, and a clickable Retry with the failure reason on error.
    • The webcomponents shell handles the devframe:docks:activate broadcast and switches the active dock (our shell runs its own dock machinery rather than hub's client host).
    • Declares hub:docks:activate on the client-callable surface (hub ships the node handler but doesn't augment the client type).
    • docks-on-launch clears its in-flight cache on settle so Retry re-runs.
  • vitestDevToolsVitestUI is now a thin createProcessLauncher config (install-on-demand → spawn → wait → swap to iframe), keeping its own readiness probe and diagnostics (VTDT0001/VTDT0002).
  • docs / stories / tests — launcher docs (both factory modes), progress + error/Retry stories, unit tests for createProcessLauncher (terminal + server + fail-fast), the on-launch retry/dedupe behavior, and command-binding assertions, plus regenerated tsnapi export snapshots.

Gates: pnpm lint && pnpm test && pnpm typecheck && pnpm build all pass.

Linked Issues

Additional context

Upstream follow-up (non-blocking). By this repo's dependency-boundary rule, a launcher that binds a command, shows process progress, and navigates to a session is a hub concern. This PR ships it as a downstream shim (the kit superset fields + client rendering) on top of 0.7.3. A natural follow-up promotes these into @devframes/hub's launcher type as first-class fields — mirroring the #431 → devframe#103 precedent — after which the kit superset can be dropped. A proposal draft for that upstream change is ready to file.

Reviewers: worth a look at the devframe:docks:activate broadcast handler in packages/core/src/client/webcomponents/state/context.ts, the launcher superset in packages/kit/src/types/docks.ts, and createProcessLauncher's serve-mode swap + fail-fast in packages/kit/src/node/create-process-launcher.ts.

This PR was created with the help of an agent.

…, and session navigation

Bump devframe to 0.7.3 and build a small process-control launcher on top of
its new cross-iframe dock-activation API (hub:docks:activate + terminal
session focus).

- kit: superset launcher fields (command / terminalSessionId / digest),
  a createLineDigest/tailSessionDigest helper, and command binding for
  createInstallLauncher; DEVTOOLS_TERMINALS_DOCK_ID constant.
- core: ViewLauncher renders a live digest line and a 'View in Terminal'
  action; the shell handles the devframe:docks:activate broadcast to switch
  the active dock; hub:docks:activate declared on the client surface.
- vitest: launcher binds a start command and streams a startup digest with a
  jump-to-session action.
- docs + stories + tests + regenerated API snapshots.
@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools@435

@vitejs/devtools-kit

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-kit@435

@vitejs/devtools-oxc

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-oxc@435

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-rolldown@435

@vitejs/devtools-vite

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite@435

@vitejs/devtools-vitest

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vitest@435

commit: ebfe6cf

antfubot added 3 commits July 17, 2026 04:21
Compose the launcher primitives (register + command binding + spawn +
tailSessionDigest + session navigation) into a single call for the common
'spawn a long-running process and stay a launcher' case. Integrations that
swap the launcher for another view (e.g. Vitest's iframe) keep composing the
primitives directly.
…e Vitest onto it

Add prepare (pre-launch commands), a lazy process resolver, and serve.onReady
to createProcessLauncher: run commands, start a server, stream its startup
digest, then swap the launcher to an iframe embedding the server once ready.

Migrate DevToolsVitestUI onto the factory — it now covers the full
install → spawn → wait → embed flow through one primitive, keeping its own
readiness probe and diagnostics (VTDT0001/VTDT0002).
…n a Retry

When a launcher's process exits before its server is ready (e.g. Vitest's
'No test files found, exiting with code 1'), the launcher now:

- fails fast instead of blocking on the readiness probe — createProcessLauncher
  races serve.onReady against the process exit and raises DTK0052 the moment
  the process dies;
- reflects the failure on the card with the error message; and
- turns the launch button into a clickable Retry (ViewLauncher enables the
  button on 'error' and shows the reason).

Also fix the on-launch bridge: it cached the in-flight launch promise and never
cleared it, so a Retry click returned the old settled promise and did nothing.
The cache now clears on settle, so retries re-run.

Adds DTK0052 (+ docs), unit tests for the fail-fast path and the retry
behaviour, and an Error story.
…tput tail

Replace the launcher's terminal-tail preview with a short progress/status line.

- kit: drop the launcher `digest` field, the `createLineDigest`/`tailSessionDigest`
  helpers, and all output tailing; add a `progress` field. createProcessLauncher
  now sets lifecycle phases ("Waiting for the server…", "Running", "Finished")
  rather than streaming raw output.
- core: ViewLauncher shows a plain progress line (with a spinner while loading)
  instead of the monospace output preview; the "View in Terminal" action still
  links to the session's full output.

Updates docs, story, tests, and API snapshots.
antfubot added 2 commits July 17, 2026 14:16
devframe/@devframes/hub -> ^0.7.5 (plugins stay ^0.7.4 until published).

0.7.5 promotes the launcher command/terminalSessionId/digest fields and the
hub:docks:activate client RPC upstream (devframe#109) and fixes the
RpcFunctionsHost export regression, so:

- kit: drop the DevToolsLauncherExtras superset shim; DevToolsViewLauncher /
  DevToolsDockEntry are plain hub re-exports again. Launchers use hub's native
  digest (author-set progress line) and rely on the bound command (onLaunch is
  now optional) — createProcessLauncher and createInstallLauncher drop their
  onLaunch wrappers.
- core: docks-on-launch prefers onLaunch, falls back to the bound command;
  drop the local hub:docks:activate declaration (hub declares it now).
- compat: devframe >=0.7.4 declares its RPC name maps in a bundled chunk, so
  RPC-name augmentation must target devframe/types directly (renamed re-export
  aliases no longer merge) — retarget core/vite/rolldown/oxc; add devframe as a
  devDep to vite + rolldown. ws.ts reaches devframe's @internal RPC wiring
  through a narrow local shape now that the public RpcFunctionsHost type hides it.

Regenerated API snapshots; lint/test/typecheck/build all pass.
# Conflicts:
#	packages/core/src/client/webcomponents/.generated/css.ts
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.

1 participant