@devframes/hub 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.mts +2 -2
- package/dist/constants.d.mts +1 -1
- package/dist/{context-CXN9eDXS.d.mts → context-BVliVH77.d.mts} +40 -15
- package/dist/index.d.mts +3 -3
- package/dist/node/index.d.mts +10 -21
- package/dist/node/index.mjs +74 -52
- package/dist/{settings-DJs3n2p1.d.mts → settings-ZM591NEp.d.mts} +14 -31
- package/dist/types/index.d.mts +3 -3
- package/package.json +3 -3
package/dist/client/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as DevframeMessagesClient, _ as DevframeMessageEntryInput } from "../context-BVliVH77.mjs";
|
|
2
|
+
import { O as RemoteConnectionInfo, i as DevframeCommandEntry, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, t as DevframeDocksUserSettings, v as DevframeDockUserEntry } from "../settings-ZM591NEp.mjs";
|
|
3
3
|
import { DevframeClientRpcHost, DevframeRpcClient, DevframeRpcClientOptions, DevframeRpcContext, RpcClientEvents } from "devframe/client";
|
|
4
4
|
import { EventEmitter } from "devframe/types";
|
|
5
5
|
import { SharedState } from "devframe/utils/shared-state";
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as
|
|
1
|
+
import { M as JsonRenderer, _ as DevframeDockEntryIcon, c as DevframeCommandsHost, j as JsonRenderSpec, y as DevframeDocksHost } from "./settings-ZM591NEp.mjs";
|
|
2
2
|
import { CreateHostContextOptions } from "devframe/node";
|
|
3
3
|
import { DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
|
|
4
4
|
import { ChildProcess } from "node:child_process";
|
|
@@ -245,10 +245,42 @@ interface DevframeChildProcessExecuteOptions {
|
|
|
245
245
|
cwd?: string;
|
|
246
246
|
env?: Record<string, string>;
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* The settled outcome of a {@link DevframeChildProcessTerminalSession} run —
|
|
250
|
+
* stdout/stderr captured separately (unlike the session's merged display
|
|
251
|
+
* `stream`), plus the process's exit code (`undefined` if it was killed by a
|
|
252
|
+
* signal before exiting).
|
|
253
|
+
*/
|
|
254
|
+
interface DevframeChildProcessOutput {
|
|
255
|
+
stdout: string;
|
|
256
|
+
stderr: string;
|
|
257
|
+
exitCode: number | undefined;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A live handle on a child process's outcome — mirrors the ergonomics of
|
|
261
|
+
* `tinyexec`'s `Result` (a promise-like paired with synchronous accessors) so
|
|
262
|
+
* callers migrating from a `tinyexec`/`execa`-based subprocess API (e.g.
|
|
263
|
+
* Nuxt DevTools' `startSubprocess().getResult()`) can adopt
|
|
264
|
+
* {@link DevframeTerminalsHost.startChildProcess} with minimal changes.
|
|
265
|
+
* `await`ing it (or calling `.then()`) resolves once the process exits, with
|
|
266
|
+
* the full captured {@link DevframeChildProcessOutput}.
|
|
267
|
+
*/
|
|
268
|
+
interface DevframeChildProcessResult extends PromiseLike<DevframeChildProcessOutput> {
|
|
269
|
+
readonly pid: number | undefined;
|
|
270
|
+
/** `undefined` while the process is still running. */
|
|
271
|
+
readonly exitCode: number | undefined;
|
|
272
|
+
readonly killed: boolean;
|
|
273
|
+
kill: (signal?: NodeJS.Signals | number) => boolean;
|
|
274
|
+
}
|
|
248
275
|
interface DevframeChildProcessTerminalSession extends DevframeTerminalSession {
|
|
249
276
|
type: 'child-process';
|
|
250
277
|
executeOptions: DevframeChildProcessExecuteOptions;
|
|
251
278
|
getChildProcess: () => ChildProcess | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* Get a live handle on the current run's outcome. Reflects the most recent
|
|
281
|
+
* `restart()` — call it again after restarting to track the new run.
|
|
282
|
+
*/
|
|
283
|
+
getResult: () => DevframeChildProcessResult;
|
|
252
284
|
terminate: () => Promise<void>;
|
|
253
285
|
restart: () => Promise<void>;
|
|
254
286
|
}
|
|
@@ -319,19 +351,12 @@ interface DevframeHubContext extends DevframeNodeContext {
|
|
|
319
351
|
*/
|
|
320
352
|
createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
|
|
321
353
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
*
|
|
329
|
-
* Omitting this option keeps all three built-ins.
|
|
330
|
-
*
|
|
331
|
-
* @default { terminals: true, messages: true, settings: true }
|
|
332
|
-
*/
|
|
333
|
-
builtinDocks?: BuiltinDocksOptions;
|
|
334
|
-
}
|
|
354
|
+
/**
|
|
355
|
+
* Options for {@link createHubContext} — devframe's
|
|
356
|
+
* {@link CreateHostContextOptions} plus any hub-level additions kits layer on
|
|
357
|
+
* through declaration merging.
|
|
358
|
+
*/
|
|
359
|
+
interface CreateHubContextOptions extends CreateHostContextOptions {}
|
|
335
360
|
/**
|
|
336
361
|
* Create a hub-level node context: wraps devframe's `createHostContext`,
|
|
337
362
|
* attaches the hub hosts (`docks`, `terminals`, `messages`, `commands`),
|
|
@@ -340,4 +365,4 @@ interface CreateHubContextOptions extends CreateHostContextOptions {
|
|
|
340
365
|
*/
|
|
341
366
|
declare function createHubContext(options: CreateHubContextOptions): Promise<DevframeHubContext>;
|
|
342
367
|
//#endregion
|
|
343
|
-
export {
|
|
368
|
+
export { DevframeMessagesHost as C, DevframeMessagesClient as S, DevframeMessagesListDelta as T, DevframeMessageEntryInput as _, DevframeChildProcessOutput as a, DevframeMessageLevel as b, DevframePtyExecuteOptions as c, DevframeTerminalSessionBase as d, DevframeTerminalStatus as f, DevframeMessageEntryFrom as g, DevframeMessageEntry as h, DevframeChildProcessExecuteOptions as i, DevframePtyTerminalSession as l, DevframeMessageElementPosition as m, DevframeHubContext as n, DevframeChildProcessResult as o, DevframeTerminalsHost as p, createHubContext as r, DevframeChildProcessTerminalSession as s, CreateHubContextOptions as t, DevframeTerminalSession as u, DevframeMessageFilePosition as v, DevframeMessagesLevelShortcuts as w, DevframeMessageShortcutInput as x, DevframeMessageHandle as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { A as
|
|
1
|
+
import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "./context-BVliVH77.mjs";
|
|
2
|
+
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "./settings-ZM591NEp.mjs";
|
|
3
3
|
import { C as RpcStreamingChannel, E as Thenable, S as RpcSharedStateHost, T as RpcStreamingHost, _ as RpcBroadcastOptions, a as DevframeDiagnosticsLogger, b as RpcFunctionsHost, c as DevframeRpcClientFunctions, d as DevframeViewHost, f as EntriesToObject, g as PartialWithoutId, h as EventsMap, i as DevframeDiagnosticsHost, l as DevframeRpcServerFunctions, m as EventUnsubscribe, n as DevframeCapabilities, o as DevframeHost, p as EventEmitter, r as DevframeDiagnosticsDefinition, s as DevframeNodeRpcSession, t as ConnectionMeta, u as DevframeRpcSharedStates, v as RpcDefinitionsFilter, w as RpcStreamingChannelOptions, x as RpcSharedStateGetOptions, y as RpcDefinitionsToFunctions } from "./index-Dic9q4eN.mjs";
|
|
4
4
|
import { WhenContext, WhenExpression } from "devframe/utils/when";
|
|
5
5
|
|
|
@@ -13,4 +13,4 @@ declare function defineDockEntry<const T extends DevframeDockUserEntry, const W
|
|
|
13
13
|
}): T;
|
|
14
14
|
declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { type
|
|
16
|
+
export { type ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, type DevframeChildProcessExecuteOptions, type DevframeChildProcessOutput, type DevframeChildProcessResult, type DevframeChildProcessTerminalSession, type DevframeClientCommand, type DevframeCommandBase, type DevframeCommandEntry, type DevframeCommandHandle, type DevframeCommandKeybinding, type DevframeCommandShortcutOverrides, type DevframeCommandsHost, type DevframeCommandsHostEvents, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockEntriesGrouped, type DevframeDockEntry, type DevframeDockEntryBase, type DevframeDockEntryCategory, type DevframeDockEntryIcon, type DevframeDockUserEntry, type DevframeDocksHost, type DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, type DevframeMessageElementPosition, type DevframeMessageEntry, type DevframeMessageEntryFrom, type DevframeMessageEntryInput, type DevframeMessageFilePosition, type DevframeMessageHandle, type DevframeMessageLevel, type DevframeMessageShortcutInput, type DevframeMessagesClient, type DevframeMessagesHost, type DevframeMessagesLevelShortcuts, type DevframeMessagesListDelta, type DevframeNodeRpcSession, type DevframePtyExecuteOptions, type DevframePtyTerminalSession, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeServerCommandEntry, type DevframeServerCommandInput, type DevframeTerminalSession, type DevframeTerminalSessionBase, type DevframeTerminalStatus, type DevframeTerminalsHost, type DevframeViewAction, type DevframeViewBuiltin, type DevframeViewCustomRender, type DevframeViewGroup, type DevframeViewHost, type DevframeViewIframe, type DevframeViewJsonRender, type DevframeViewLauncher, type DevframeViewLauncherStatus, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type JsonRenderElement, type JsonRenderSpec, type JsonRenderer, type PartialWithoutId, type RemoteConnectionInfo, type RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type Thenable, defineCommand, defineDockEntry, defineHubRpcFunction, defineJsonRenderSpec };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
1
|
+
import { C as DevframeMessagesHost$1, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, n as DevframeHubContext, p as DevframeTerminalsHost$1, r as createHubContext, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-BVliVH77.mjs";
|
|
2
|
+
import { a as DevframeCommandHandle, c as DevframeCommandsHost$1, d as DevframeServerCommandInput, f as ClientScriptEntry, m as DevframeDockEntry, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, y as DevframeDocksHost$1 } from "../settings-ZM591NEp.mjs";
|
|
3
3
|
import { RpcFunctionDefinitionAny } from "devframe/rpc";
|
|
4
4
|
import { DevframeDefinition } from "devframe/types";
|
|
5
5
|
import { SharedState } from "devframe/utils/shared-state";
|
|
@@ -21,37 +21,26 @@ declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
|
21
21
|
//#region src/node/host-docks.d.ts
|
|
22
22
|
declare class DevframeDocksHost implements DevframeDocksHost$1 {
|
|
23
23
|
readonly context: DevframeHubContext;
|
|
24
|
-
/**
|
|
25
|
-
* Per-entry toggles for the synthesized built-in dock entries. An omitted
|
|
26
|
-
* (or `undefined`) flag keeps that built-in; only an explicit `false`
|
|
27
|
-
* suppresses it.
|
|
28
|
-
*/
|
|
29
|
-
private readonly builtinDocks;
|
|
30
24
|
readonly views: DevframeDocksHost$1['views'];
|
|
31
25
|
readonly events: DevframeDocksHost$1['events'];
|
|
32
26
|
userSettings: SharedState<DevframeDocksUserSettings>;
|
|
33
27
|
/** Dock-id → allocated remote token + resolved options. */
|
|
34
28
|
private readonly remoteDocks;
|
|
35
|
-
constructor(context: DevframeHubContext
|
|
36
|
-
/**
|
|
37
|
-
* Per-entry toggles for the synthesized built-in dock entries. An omitted
|
|
38
|
-
* (or `undefined`) flag keeps that built-in; only an explicit `false`
|
|
39
|
-
* suppresses it.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
builtinDocks?: BuiltinDocksOptions);
|
|
29
|
+
constructor(context: DevframeHubContext);
|
|
43
30
|
init(): Promise<void>;
|
|
44
|
-
values(
|
|
45
|
-
includeBuiltin
|
|
46
|
-
}?: {
|
|
47
|
-
includeBuiltin?: boolean;
|
|
48
|
-
}): DevframeDockEntry[];
|
|
31
|
+
values(): DevframeDockEntry[];
|
|
49
32
|
private projectView;
|
|
50
33
|
private resolveDevServerOrigin;
|
|
51
34
|
register<T extends DevframeDockUserEntry>(view: T, force?: boolean): {
|
|
52
35
|
update: (patch: Partial<T>) => void;
|
|
53
36
|
};
|
|
54
37
|
update(view: DevframeDockUserEntry): void;
|
|
38
|
+
/**
|
|
39
|
+
* `~builtin` views default their category to `~builtin` so the viewer's
|
|
40
|
+
* native views group together and sort last — a high-level integration
|
|
41
|
+
* registering one needn't repeat the category.
|
|
42
|
+
*/
|
|
43
|
+
private withBuiltinCategory;
|
|
55
44
|
private validateGroupMembership;
|
|
56
45
|
private prepareRemoteRegistration;
|
|
57
46
|
}
|
package/dist/node/index.mjs
CHANGED
|
@@ -207,15 +207,13 @@ function buildRemoteUrl(baseUrl, payload, transport) {
|
|
|
207
207
|
}
|
|
208
208
|
var DevframeDocksHost = class {
|
|
209
209
|
context;
|
|
210
|
-
builtinDocks;
|
|
211
210
|
views = /* @__PURE__ */ new Map();
|
|
212
211
|
events = createEventEmitter();
|
|
213
212
|
userSettings = void 0;
|
|
214
213
|
/** Dock-id → allocated remote token + resolved options. */
|
|
215
214
|
remoteDocks = /* @__PURE__ */ new Map();
|
|
216
|
-
constructor(context
|
|
215
|
+
constructor(context) {
|
|
217
216
|
this.context = context;
|
|
218
|
-
this.builtinDocks = builtinDocks;
|
|
219
217
|
}
|
|
220
218
|
async init() {
|
|
221
219
|
this.userSettings = await this.context.rpc.sharedState.get("devframe:user-settings", { sharedState: createStorage({
|
|
@@ -223,39 +221,8 @@ var DevframeDocksHost = class {
|
|
|
223
221
|
initialValue: DEFAULT_STATE_USER_SETTINGS()
|
|
224
222
|
}) });
|
|
225
223
|
}
|
|
226
|
-
values(
|
|
227
|
-
|
|
228
|
-
const { terminals = true, messages = true, settings = true } = this.builtinDocks;
|
|
229
|
-
const builtinDocksEntries = [];
|
|
230
|
-
if (terminals) builtinDocksEntries.push({
|
|
231
|
-
type: "~builtin",
|
|
232
|
-
id: "~terminals",
|
|
233
|
-
title: "Terminals",
|
|
234
|
-
icon: "ph:terminal-duotone",
|
|
235
|
-
category: "~builtin",
|
|
236
|
-
get when() {
|
|
237
|
-
return context.terminals.sessions.size === 0 ? "false" : void 0;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
if (messages) builtinDocksEntries.push({
|
|
241
|
-
type: "~builtin",
|
|
242
|
-
id: "~messages",
|
|
243
|
-
title: "Messages & Notifications",
|
|
244
|
-
icon: "ph:notification-duotone",
|
|
245
|
-
category: "~builtin",
|
|
246
|
-
get badge() {
|
|
247
|
-
const size = context.messages.entries.size;
|
|
248
|
-
return size > 0 ? String(size) : void 0;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
if (settings) builtinDocksEntries.push({
|
|
252
|
-
type: "~builtin",
|
|
253
|
-
id: "~settings",
|
|
254
|
-
title: "Settings",
|
|
255
|
-
category: "~builtin",
|
|
256
|
-
icon: "ph:gear-duotone"
|
|
257
|
-
});
|
|
258
|
-
return [...Array.from(this.views.values(), (view) => this.projectView(view)), ...includeBuiltin ? builtinDocksEntries : []];
|
|
224
|
+
values() {
|
|
225
|
+
return Array.from(this.views.values(), (view) => this.projectView(view));
|
|
259
226
|
}
|
|
260
227
|
projectView(view) {
|
|
261
228
|
if (view.type !== "iframe" || !view.remote) return view;
|
|
@@ -281,8 +248,9 @@ var DevframeDocksHost = class {
|
|
|
281
248
|
if (this.views.has(view.id) && !force) throw diagnostics.DF8100({ id: view.id });
|
|
282
249
|
this.validateGroupMembership(view);
|
|
283
250
|
this.prepareRemoteRegistration(view);
|
|
284
|
-
this.
|
|
285
|
-
this.
|
|
251
|
+
const entry = this.withBuiltinCategory(view);
|
|
252
|
+
this.views.set(entry.id, entry);
|
|
253
|
+
this.events.emit("dock:entry:updated", entry);
|
|
286
254
|
return { update: (patch) => {
|
|
287
255
|
if (patch.id && patch.id !== view.id) throw diagnostics.DF8101({
|
|
288
256
|
id: view.id,
|
|
@@ -295,8 +263,21 @@ var DevframeDocksHost = class {
|
|
|
295
263
|
if (!this.views.has(view.id)) throw diagnostics.DF8102({ id: view.id });
|
|
296
264
|
this.validateGroupMembership(view);
|
|
297
265
|
this.prepareRemoteRegistration(view);
|
|
298
|
-
this.
|
|
299
|
-
this.
|
|
266
|
+
const entry = this.withBuiltinCategory(view);
|
|
267
|
+
this.views.set(entry.id, entry);
|
|
268
|
+
this.events.emit("dock:entry:updated", entry);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* `~builtin` views default their category to `~builtin` so the viewer's
|
|
272
|
+
* native views group together and sort last — a high-level integration
|
|
273
|
+
* registering one needn't repeat the category.
|
|
274
|
+
*/
|
|
275
|
+
withBuiltinCategory(view) {
|
|
276
|
+
if (view.type === "~builtin" && view.category === void 0) return {
|
|
277
|
+
...view,
|
|
278
|
+
category: "~builtin"
|
|
279
|
+
};
|
|
280
|
+
return view;
|
|
300
281
|
}
|
|
301
282
|
validateGroupMembership(view) {
|
|
302
283
|
if (view.groupId === void 0) return;
|
|
@@ -594,6 +575,7 @@ var DevframeTerminalsHost = class {
|
|
|
594
575
|
const { exec } = await import("tinyexec");
|
|
595
576
|
let controller;
|
|
596
577
|
let cp;
|
|
578
|
+
let currentResult;
|
|
597
579
|
let runId = 0;
|
|
598
580
|
let streamClosed = false;
|
|
599
581
|
const closeStream = () => {
|
|
@@ -631,17 +613,56 @@ var DevframeTerminalsHost = class {
|
|
|
631
613
|
cwd: executeOptions.cwd ?? process$1.cwd(),
|
|
632
614
|
stdio: "pipe"
|
|
633
615
|
} });
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
616
|
+
const stdoutChunks = [];
|
|
617
|
+
const stderrChunks = [];
|
|
618
|
+
let settled = false;
|
|
619
|
+
let resolveOutput;
|
|
620
|
+
const outputPromise = new Promise((resolve) => {
|
|
621
|
+
resolveOutput = resolve;
|
|
622
|
+
});
|
|
623
|
+
const settle = (exitCode) => {
|
|
624
|
+
if (settled || currentRun !== runId) return;
|
|
625
|
+
settled = true;
|
|
626
|
+
resolveOutput({
|
|
627
|
+
stdout: stdoutChunks.join(""),
|
|
628
|
+
stderr: stderrChunks.join(""),
|
|
629
|
+
exitCode
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
cp.process?.stdout?.on("data", (chunk) => {
|
|
633
|
+
if (currentRun !== runId) return;
|
|
634
|
+
const text = chunk.toString();
|
|
635
|
+
stdoutChunks.push(text);
|
|
636
|
+
if (!streamClosed) controller?.enqueue(text);
|
|
637
|
+
});
|
|
638
|
+
cp.process?.stderr?.on("data", (chunk) => {
|
|
639
|
+
if (currentRun !== runId) return;
|
|
640
|
+
const text = chunk.toString();
|
|
641
|
+
stderrChunks.push(text);
|
|
642
|
+
if (!streamClosed) controller?.enqueue(text);
|
|
643
|
+
});
|
|
644
|
+
cp.process?.once("error", (error) => {
|
|
645
|
+
if (currentRun !== runId) return;
|
|
646
|
+
settle(cp.process?.exitCode ?? void 0);
|
|
647
|
+
errorStream(error);
|
|
648
|
+
});
|
|
649
|
+
cp.process?.once("close", (code) => {
|
|
650
|
+
settle(code ?? void 0);
|
|
651
|
+
if (currentRun === runId) closeStream();
|
|
652
|
+
});
|
|
653
|
+
currentResult = {
|
|
654
|
+
get pid() {
|
|
655
|
+
return cp.process?.pid;
|
|
656
|
+
},
|
|
657
|
+
get exitCode() {
|
|
658
|
+
return cp.process?.exitCode ?? void 0;
|
|
659
|
+
},
|
|
660
|
+
get killed() {
|
|
661
|
+
return cp.process?.killed === true;
|
|
662
|
+
},
|
|
663
|
+
kill: (signal) => cp.kill(signal),
|
|
664
|
+
then: (onfulfilled, onrejected) => outputPromise.then(onfulfilled, onrejected)
|
|
665
|
+
};
|
|
645
666
|
return cp;
|
|
646
667
|
}
|
|
647
668
|
cp = createChildProcess();
|
|
@@ -662,6 +683,7 @@ var DevframeTerminalsHost = class {
|
|
|
662
683
|
type: "child-process",
|
|
663
684
|
executeOptions,
|
|
664
685
|
getChildProcess: () => cp?.process,
|
|
686
|
+
getResult: () => currentResult,
|
|
665
687
|
terminate,
|
|
666
688
|
restart
|
|
667
689
|
};
|
|
@@ -893,7 +915,7 @@ async function createHubContext(options) {
|
|
|
893
915
|
...options,
|
|
894
916
|
builtinRpcDeclarations: [...builtinHubRpcDeclarations, ...options.builtinRpcDeclarations ?? []]
|
|
895
917
|
});
|
|
896
|
-
const docks = new DevframeDocksHost(context
|
|
918
|
+
const docks = new DevframeDocksHost(context);
|
|
897
919
|
const terminals = new DevframeTerminalsHost(context);
|
|
898
920
|
const messages = new DevframeMessagesHost(context);
|
|
899
921
|
const commands = new DevframeCommandsHost(context);
|
|
@@ -39,34 +39,7 @@ interface DevframeDocksHost {
|
|
|
39
39
|
update: (patch: Partial<T>) => void;
|
|
40
40
|
};
|
|
41
41
|
update: (entry: DevframeDockUserEntry) => void;
|
|
42
|
-
values: (
|
|
43
|
-
includeBuiltin?: boolean;
|
|
44
|
-
}) => DevframeDockEntry[];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Per-entry toggles for the hub's synthesized built-in dock entries.
|
|
48
|
-
*
|
|
49
|
-
* Each flag defaults to `true` (the entry is present). Set one to `false` to
|
|
50
|
-
* suppress that built-in everywhere it would otherwise appear — useful when a
|
|
51
|
-
* host mounts a plugin that supersedes the built-in tab (e.g.
|
|
52
|
-
* `@devframes/plugin-terminals` replacing the `~terminals` entry).
|
|
53
|
-
*/
|
|
54
|
-
interface BuiltinDocksOptions {
|
|
55
|
-
/**
|
|
56
|
-
* Include the built-in `~terminals` dock entry.
|
|
57
|
-
* @default true
|
|
58
|
-
*/
|
|
59
|
-
terminals?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Include the built-in `~messages` dock entry.
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
messages?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Include the built-in `~settings` dock entry.
|
|
67
|
-
* @default true
|
|
68
|
-
*/
|
|
69
|
-
settings?: boolean;
|
|
42
|
+
values: () => DevframeDockEntry[];
|
|
70
43
|
}
|
|
71
44
|
type DevframeDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~builtin' | (string & {});
|
|
72
45
|
type DevframeDockEntryIcon = string | {
|
|
@@ -207,6 +180,16 @@ interface DevframeViewCustomRender extends DevframeDockEntryBase {
|
|
|
207
180
|
type: 'custom-render';
|
|
208
181
|
renderer: ClientScriptEntry;
|
|
209
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* A view rendered natively by the viewer rather than by a plugin — the
|
|
185
|
+
* settings panel, the terminals feed, the messages feed, etc. A high-level
|
|
186
|
+
* integration registers the built-in views it wants; the viewer recognizes the
|
|
187
|
+
* reserved `id` and renders its own UI for it.
|
|
188
|
+
*
|
|
189
|
+
* Its {@link DevframeDockEntryBase.category} defaults to `'~builtin'` when
|
|
190
|
+
* omitted, so built-in views group together and sort last without every
|
|
191
|
+
* integration repeating it.
|
|
192
|
+
*/
|
|
210
193
|
interface DevframeViewBuiltin extends DevframeDockEntryBase {
|
|
211
194
|
type: '~builtin';
|
|
212
195
|
id: '~terminals' | '~messages' | '~client-auth-notice' | '~settings' | '~popup';
|
|
@@ -237,8 +220,8 @@ interface DevframeViewGroup extends DevframeDockEntryBase {
|
|
|
237
220
|
*/
|
|
238
221
|
defaultChildId?: string;
|
|
239
222
|
}
|
|
240
|
-
type DevframeDockUserEntry = DevframeViewIframe | DevframeViewAction | DevframeViewCustomRender | DevframeViewLauncher | DevframeViewJsonRender | DevframeViewGroup;
|
|
241
|
-
type DevframeDockEntry = DevframeDockUserEntry
|
|
223
|
+
type DevframeDockUserEntry = DevframeViewIframe | DevframeViewAction | DevframeViewCustomRender | DevframeViewLauncher | DevframeViewJsonRender | DevframeViewGroup | DevframeViewBuiltin;
|
|
224
|
+
type DevframeDockEntry = DevframeDockUserEntry;
|
|
242
225
|
type DevframeDockEntriesGrouped = [category: string, entries: DevframeDockEntry[]][];
|
|
243
226
|
//#endregion
|
|
244
227
|
//#region src/types/commands.d.ts
|
|
@@ -370,4 +353,4 @@ interface DevframeDocksUserSettings {
|
|
|
370
353
|
commandShortcuts: DevframeCommandShortcutOverrides;
|
|
371
354
|
}
|
|
372
355
|
//#endregion
|
|
373
|
-
export {
|
|
356
|
+
export { JsonRenderElement as A, DevframeViewGroup as C, DevframeViewLauncherStatus as D, DevframeViewLauncher as E, JsonRenderer as M, RemoteConnectionInfo as O, DevframeViewCustomRender as S, DevframeViewJsonRender as T, DevframeDockEntryIcon as _, DevframeCommandHandle as a, DevframeViewAction as b, DevframeCommandsHost as c, DevframeServerCommandInput as d, ClientScriptEntry as f, DevframeDockEntryCategory as g, DevframeDockEntryBase as h, DevframeCommandEntry as i, JsonRenderSpec as j, RemoteDockOptions as k, DevframeCommandsHostEvents as l, DevframeDockEntry as m, DevframeClientCommand as n, DevframeCommandKeybinding as o, DevframeDockEntriesGrouped as p, DevframeCommandBase as r, DevframeCommandShortcutOverrides as s, DevframeDocksUserSettings as t, DevframeServerCommandEntry as u, DevframeDockUserEntry as v, DevframeViewIframe as w, DevframeViewBuiltin as x, DevframeDocksHost as y };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { A as
|
|
1
|
+
import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-BVliVH77.mjs";
|
|
2
|
+
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "../settings-ZM591NEp.mjs";
|
|
3
3
|
import { C as RpcStreamingChannel, E as Thenable, S as RpcSharedStateHost, T as RpcStreamingHost, _ as RpcBroadcastOptions, a as DevframeDiagnosticsLogger, b as RpcFunctionsHost, c as DevframeRpcClientFunctions, d as DevframeViewHost, f as EntriesToObject, g as PartialWithoutId, h as EventsMap, i as DevframeDiagnosticsHost, l as DevframeRpcServerFunctions, m as EventUnsubscribe, n as DevframeCapabilities, o as DevframeHost, p as EventEmitter, r as DevframeDiagnosticsDefinition, s as DevframeNodeRpcSession, t as ConnectionMeta, u as DevframeRpcSharedStates, v as RpcDefinitionsFilter, w as RpcStreamingChannelOptions, x as RpcSharedStateGetOptions, y as RpcDefinitionsToFunctions } from "../index-Dic9q4eN.mjs";
|
|
4
|
-
export {
|
|
4
|
+
export { ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, DevframeChildProcessExecuteOptions, DevframeChildProcessOutput, DevframeChildProcessResult, DevframeChildProcessTerminalSession, DevframeClientCommand, DevframeCommandBase, DevframeCommandEntry, DevframeCommandHandle, DevframeCommandKeybinding, DevframeCommandShortcutOverrides, DevframeCommandsHost, DevframeCommandsHostEvents, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockUserEntry, DevframeDocksHost, DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, DevframeMessageElementPosition, DevframeMessageEntry, DevframeMessageEntryFrom, DevframeMessageEntryInput, DevframeMessageFilePosition, DevframeMessageHandle, DevframeMessageLevel, DevframeMessageShortcutInput, DevframeMessagesClient, DevframeMessagesHost, DevframeMessagesLevelShortcuts, DevframeMessagesListDelta, type DevframeNodeRpcSession, DevframePtyExecuteOptions, DevframePtyTerminalSession, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, DevframeServerCommandEntry, DevframeServerCommandInput, DevframeTerminalSession, DevframeTerminalSessionBase, DevframeTerminalStatus, DevframeTerminalsHost, DevframeViewAction, DevframeViewBuiltin, DevframeViewCustomRender, DevframeViewGroup, type DevframeViewHost, DevframeViewIframe, DevframeViewJsonRender, DevframeViewLauncher, DevframeViewLauncherStatus, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, type PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type Thenable };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/hub",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"description": "Framework-neutral hub layer for devframe — docks, terminals, messages, commands.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"devframe": "0.6.
|
|
36
|
+
"devframe": "0.6.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"birpc": "^4.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/node": "^26.1.0",
|
|
49
49
|
"mlly": "^1.8.2",
|
|
50
50
|
"tsdown": "^0.22.3",
|
|
51
|
-
"devframe": "0.6.
|
|
51
|
+
"devframe": "0.6.2"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tsdown",
|