You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hub): expose getResult() on startChildProcess() terminal sessions
Add a getResult() accessor to DevframeChildProcessTerminalSession that
mirrors tinyexec's Result contract — a promise-like handle with live
pid/exitCode/killed getters that resolves to { stdout, stderr, exitCode }
once the process exits. stdout and stderr are now captured separately
(alongside the existing merged display stream) by listening on the raw
child process directly, rather than through tinyexec's own async
iterator/promise, which would otherwise starve each other reading the
same underlying streams.
This gives tinyexec/execa-based subprocess-runner APIs (e.g. Nuxt
DevTools' startSubprocess().getResult()) a compatible seam to adopt
ctx.terminals.startChildProcess() directly.
Co-authored-by: opencode <noreply@opencode.ai>
Copy file name to clipboardExpand all lines: docs/guide/hub.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ A hub-aware node context (`DevframeHubContext`) extends `DevframeNodeContext` wi
13
13
| Subsystem | Surface | Purpose |
14
14
|---|---|---|
15
15
|`ctx.docks`|`register / update / values`| Multi-tool dock entries (iframes, launchers, json-render, custom-render) and groups that collapse them under one button. |
16
-
|`ctx.terminals`|`register / startChildProcess`| Aggregate terminal sessions, stream output over a well-known channel. The single source of truth for "what sessions exist" — see [Terminals](/plugins/terminals#hub-aggregation) for how the terminals plugin renders and mirrors into it. |
16
+
|`ctx.terminals`|`register / startChildProcess`| Aggregate terminal sessions, stream output over a well-known channel. The single source of truth for "what sessions exist" — see [Terminals](/plugins/terminals#hub-aggregation) for how the terminals plugin renders and mirrors into it. A `startChildProcess()` session's `getResult()` mirrors `tinyexec`'s `Result` (promise-like, plus live `pid` / `exitCode` / `killed`), so subprocess-runner APIs built on `tinyexec`/`execa` can adopt it with little change. |
Copy file name to clipboardExpand all lines: docs/plugins/terminals.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ Mounted into a hub, the plugin owns PTY/child-process spawning and its own strea
56
56
57
57
`ctx.terminals` is the source of truth for "what sessions exist"; the plugin is the panel that renders them and the one PTY-capable provider among possibly several session sources. The plugin never imports `@devframes/hub`'s types to stay mountable without a hub — it duck-types the minimal `register` / `update` / `events` shape it needs.
58
58
59
+
A session from `ctx.terminals.startChildProcess()` carries a `getResult()` accessor shaped like `tinyexec`'s `Result` — `await`able to `{ stdout, stderr, exitCode }` (captured separately from the merged display stream), with live `pid` / `exitCode` / `killed` getters and `kill()` in the meantime. That's the seam for migrating an existing `tinyexec`/`execa`-based "run a subprocess and get its result" API onto the hub's terminals: keep the same calling code, swap the runner for `startChildProcess()`, and the session's output shows up in every hub-aware terminal panel for free.
0 commit comments