feat(plugin-code-server): spawn via ctx.terminals as a read-only hub session#54
Merged
Conversation
…session When mounted in a hub, launch code-server through ctx.terminals so it shows up in the hub's terminals panel as a read-only session with a proper icon and name. Reflect stop/exit on that session and re-register a fresh one on the next start. Standalone runtimes keep spawning a direct child process unchanged.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Show terminal sessions contributed by other devframes through the hub (ctx.terminals) — such as code-server — in the terminals plugin's own tab. They render read-only with the contributing tool's icon and name, stream output from the hub's channel, and refresh as they start/stop. The plugin offers no rename/restart/kill controls for sessions it doesn't own.
Normalize a hub session's dock icon (ph:code-duotone) to the client's UnoCSS class (i-ph-code-duotone) and safelist the built-in plugins' icons so those runtime-supplied glyphs are emitted by the SPA build and actually render.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
When the code-server plugin is mounted in a hub, it now launches code-server through the hub's
ctx.terminalsinstead of spawning a raw child process. The process surfaces in the hub's terminals panel as a read-only session (the hub wires no stdin) with a proper icon (ph:code-duotone) and name (Code Server, described by the workspace folder).Standalone runtimes (CLI / Vite / build) have no
ctx.terminals, so they keep spawning a direct child process exactly as before — the plugin stays hub-agnostic by duck-typing the terminals bridge (same pattern the terminals plugin uses), with no build/runtime dependency on@devframes/hub.Behavior
ctx.terminals.startChildProcess(...); the returned child feeds the unchanged readiness/port/log/exit wiring, so startup, auth handoff and health probing are identical.stoppedon stop,erroron unexpected crash — the hub doesn't update a child-process session on its own exit), and each start removes the stale same-id session before registering a fresh one (every start uses a new port + password).PASSWORDis neutralized explicitly since the hub mergesprocess.env, keepingHASHED_PASSWORDauto-auth intact.Tests
Added a faithful fake
ctx.terminals(really spawns, mergesprocess.env, exposesgetChildProcess/terminate) and two cases: the read-only session's name/icon/description/pid + end-to-end auth through the hub, and stop→stopped→fresh re-register on the next start. tsnapi API snapshots regenerated.Verified:
pnpm test(534 passed),pnpm typecheck,pnpm lint,pnpm build.This PR was created with the help of an agent.