@devframes/hub 0.9.0-beta.9 → 0.9.1

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.
@@ -0,0 +1,105 @@
1
+ import { t as DevframeDocksUserSettings } from "./settings-D7whfcx2.mjs";
2
+ //#region src/events.d.ts
3
+ /**
4
+ * Centralized registry of every event, broadcast, RPC method, shared-state
5
+ * key, and channel name the hub uses — the single source of truth that keeps
6
+ * these names out of scattered string literals.
7
+ *
8
+ * **Keep this in sync with [`docs/guide/events.md`](../../../docs/guide/events.md)**
9
+ * (the Hub Events Reference): every name here appears in that page's tables, and
10
+ * every name there resolves to an entry here. Add, rename, or remove a name in
11
+ * both places in the same change, and reference `HUB_EVENTS.*` from call sites
12
+ * instead of re-typing a literal.
13
+ *
14
+ * The `.events` EventEmitter maps in `types/{docks,terminals,messages,commands}.ts`
15
+ * and the RPC augmentation interfaces in `node/context.ts` declare these same
16
+ * names as type-level keys (a literal is unavoidable in a type position); those
17
+ * declarations mirror this map and move with it.
18
+ */
19
+ declare const HUB_EVENTS: {
20
+ /**
21
+ * Internal node `EventEmitter` events on `ctx.<subsystem>.events`. Emitted
22
+ * and consumed inside the node process (chiefly by `createHubContext`, which
23
+ * fans them out onto the wire); they never cross to the browser.
24
+ */
25
+ readonly bus: {
26
+ readonly docksEntryUpdated: "docks:entry:updated";
27
+ readonly docksActivate: "docks:activate";
28
+ readonly terminalsSessionUpdated: "terminals:session:updated";
29
+ readonly messagesAdded: "messages:added";
30
+ readonly messagesUpdated: "messages:updated";
31
+ readonly messagesRemoved: "messages:removed";
32
+ readonly messagesCleared: "messages:cleared";
33
+ readonly commandsRegistered: "commands:registered";
34
+ readonly commandsUnregistered: "commands:unregistered";
35
+ };
36
+ /** Server RPC methods a connected client calls (client → server), `hub:` prefix. */
37
+ readonly rpc: {
38
+ readonly docksActivate: "hub:docks:activate";
39
+ readonly commandsExecute: "hub:commands:execute";
40
+ readonly messagesAdd: "hub:messages:add";
41
+ readonly messagesUpdate: "hub:messages:update";
42
+ readonly messagesRemove: "hub:messages:remove";
43
+ readonly messagesClear: "hub:messages:clear";
44
+ readonly terminalsWrite: "hub:terminals:write";
45
+ readonly terminalsResize: "hub:terminals:resize";
46
+ readonly terminalsTerminate: "hub:terminals:terminate";
47
+ readonly terminalsRestart: "hub:terminals:restart";
48
+ readonly terminalsRemove: "hub:terminals:remove";
49
+ };
50
+ /** Broadcast notifications the server pushes to clients (server → client), `devframe:` prefix. */
51
+ readonly broadcast: {
52
+ readonly docksActivate: "devframe:docks:activate";
53
+ readonly terminalsUpdated: "devframe:terminals:updated";
54
+ readonly messagesUpdated: "devframe:messages:updated";
55
+ };
56
+ /** Shared-state slot keys a hub-aware client reads (server → client), `devframe:` prefix. */
57
+ readonly sharedState: {
58
+ readonly docks: "devframe:docks";
59
+ readonly docksActive: "devframe:docks:active";
60
+ readonly commands: "devframe:commands";
61
+ readonly userSettings: "devframe:user-settings";
62
+ readonly dockRenderers: "devframe:dock-renderers";
63
+ };
64
+ /** Streaming channel ids (server → client), `devframe:` prefix. */
65
+ readonly stream: {
66
+ readonly terminals: "devframe:terminals";
67
+ };
68
+ /** `postMessage` channels for host ↔ iframe protocols, `devframe:` prefix. */
69
+ readonly postMessage: {
70
+ readonly frameNav: "devframe:frame-nav";
71
+ };
72
+ };
73
+ //#endregion
74
+ //#region src/constants.d.ts
75
+ /** Default mount base for a hub instance — one namespace, one catch-all. */
76
+ declare const DEVFRAMES_HUB_BASE = "/__devframes/";
77
+ /**
78
+ * Normalize a hub mount base to an absolute path with leading and trailing
79
+ * slashes (e.g. `devframes` → `/devframes/`), collapsing any doubled
80
+ * slashes the input introduced. The one implementation every hub-aware
81
+ * host (`@devframes/hub` itself, and the Vite/Nuxt/Next adapters) resolves
82
+ * `options.base` through.
83
+ */
84
+ declare function normalizeHubBase(base: string): string;
85
+ /**
86
+ * The default ordering weight for each known dock category — lower sorts
87
+ * earlier. Downstream viewers (e.g. `@vitejs/devtools-kit`) import this as the
88
+ * single source of truth so the hub and its viewers agree on category order.
89
+ * `framework` sorts first; `~builtin` (the viewer's own built-in views) last.
90
+ *
91
+ * The buckets read from "closest to your app" → "platform / analysis" →
92
+ * "peripheral". Gaps between the weights are intentional: a kit can interleave
93
+ * its own categories (or override these) without editing this table.
94
+ */
95
+ declare const DEFAULT_CATEGORIES_ORDER: Record<string, number>;
96
+ /**
97
+ * Shared-state slot carrying the hub's renderer manifest — one
98
+ * {@link import('./client/renderers').DockRendererManifest} entry per dock
99
+ * `type`, published by `initHub({ renderers })` and consumed by every
100
+ * hub-aware client (the headless client host and viewers alike).
101
+ */
102
+ declare const DOCK_RENDERERS_STATE_KEY: string;
103
+ declare const DEFAULT_STATE_USER_SETTINGS: () => DevframeDocksUserSettings;
104
+ //#endregion
105
+ export { normalizeHubBase as a, DOCK_RENDERERS_STATE_KEY as i, DEFAULT_STATE_USER_SETTINGS as n, HUB_EVENTS as o, DEVFRAMES_HUB_BASE as r, DEFAULT_CATEGORIES_ORDER as t };
@@ -1,34 +1,3 @@
1
- import { t as DevframeDocksUserSettings } from "./settings-DfrRa9Wf.mjs";
1
+ import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-CmESZCBq.mjs";
2
2
  export * from "devframe/constants";
3
- //#region src/constants.d.ts
4
- /** Default mount base for a hub instance — one namespace, one catch-all. */
5
- declare const DEVFRAMES_HUB_BASE = "/__devframes/";
6
- /**
7
- * Normalize a hub mount base to an absolute path with leading and trailing
8
- * slashes (e.g. `devframes` → `/devframes/`), collapsing any doubled
9
- * slashes the input introduced. The one implementation every hub-aware
10
- * host (`@devframes/hub` itself, and the Vite/Nuxt/Next adapters) resolves
11
- * `options.base` through.
12
- */
13
- declare function normalizeHubBase(base: string): string;
14
- /**
15
- * The default ordering weight for each known dock category — lower sorts
16
- * earlier. Downstream viewers (e.g. `@vitejs/devtools-kit`) import this as the
17
- * single source of truth so the hub and its viewers agree on category order.
18
- * `framework` sorts first; `~builtin` (the viewer's own built-in views) last.
19
- *
20
- * The buckets read from "closest to your app" → "platform / analysis" →
21
- * "peripheral". Gaps between the weights are intentional: a kit can interleave
22
- * its own categories (or override these) without editing this table.
23
- */
24
- declare const DEFAULT_CATEGORIES_ORDER: Record<string, number>;
25
- /**
26
- * Shared-state slot carrying the hub's renderer manifest — one
27
- * {@link import('./client/renderers').DockRendererManifest} entry per dock
28
- * `type`, published by `initHub({ renderers })` and consumed by every
29
- * hub-aware client (the headless client host and viewers alike).
30
- */
31
- declare const DOCK_RENDERERS_STATE_KEY = "devframe:dock-renderers";
32
- declare const DEFAULT_STATE_USER_SETTINGS: () => DevframeDocksUserSettings;
33
- //#endregion
34
- export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, normalizeHubBase };
3
+ export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, HUB_EVENTS, normalizeHubBase };
@@ -1,53 +1,3 @@
1
- import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash } from "ufo";
1
+ import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS, r as DEVFRAMES_HUB_BASE, t as DEFAULT_CATEGORIES_ORDER } from "./constants-C2b2cACy.mjs";
2
2
  export * from "devframe/constants";
3
- //#region src/constants.ts
4
- /** Default mount base for a hub instance — one namespace, one catch-all. */
5
- const DEVFRAMES_HUB_BASE = "/__devframes/";
6
- /**
7
- * Normalize a hub mount base to an absolute path with leading and trailing
8
- * slashes (e.g. `devframes` → `/devframes/`), collapsing any doubled
9
- * slashes the input introduced. The one implementation every hub-aware
10
- * host (`@devframes/hub` itself, and the Vite/Nuxt/Next adapters) resolves
11
- * `options.base` through.
12
- */
13
- function normalizeHubBase(base) {
14
- return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
15
- }
16
- /**
17
- * The default ordering weight for each known dock category — lower sorts
18
- * earlier. Downstream viewers (e.g. `@vitejs/devtools-kit`) import this as the
19
- * single source of truth so the hub and its viewers agree on category order.
20
- * `framework` sorts first; `~builtin` (the viewer's own built-in views) last.
21
- *
22
- * The buckets read from "closest to your app" → "platform / analysis" →
23
- * "peripheral". Gaps between the weights are intentional: a kit can interleave
24
- * its own categories (or override these) without editing this table.
25
- */
26
- const DEFAULT_CATEGORIES_ORDER = {
27
- "framework": -100,
28
- "default": 0,
29
- "app": 100,
30
- "ui": 150,
31
- "data": 250,
32
- "web": 300,
33
- "performance": 350,
34
- "advanced": 400,
35
- "docs": 500,
36
- "~builtin": 1e3
37
- };
38
- /**
39
- * Shared-state slot carrying the hub's renderer manifest — one
40
- * {@link import('./client/renderers').DockRendererManifest} entry per dock
41
- * `type`, published by `initHub({ renderers })` and consumed by every
42
- * hub-aware client (the headless client host and viewers alike).
43
- */
44
- const DOCK_RENDERERS_STATE_KEY = "devframe:dock-renderers";
45
- const DEFAULT_STATE_USER_SETTINGS = () => ({
46
- docksHidden: [],
47
- docksCategoriesHidden: [],
48
- docksPinned: [],
49
- docksCustomOrder: {},
50
- commandShortcuts: {}
51
- });
52
- //#endregion
53
- export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, normalizeHubBase };
3
+ export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVFRAMES_HUB_BASE, DOCK_RENDERERS_STATE_KEY, HUB_EVENTS, normalizeHubBase };
@@ -1,6 +1,6 @@
1
1
  import { r as defineHubRpcFunction } from "./define-Ceekw2EO.mjs";
2
- import { DEFAULT_STATE_USER_SETTINGS } from "./constants.mjs";
3
- import { t as buildRemoteConnectionUrl } from "./remote-url-KVXtKP47.mjs";
2
+ import { n as DEFAULT_STATE_USER_SETTINGS, o as HUB_EVENTS } from "./constants-C2b2cACy.mjs";
3
+ import { i as isBareModuleSpecifier, t as buildRemoteConnectionUrl } from "./remote-url-Bgc7gtsP.mjs";
4
4
  import { createEventEmitter } from "devframe/utils/events";
5
5
  import { createHostContext, createStorage } from "devframe/node";
6
6
  import { getInternalContext, resolveBasePath } from "devframe/node/hub-internals";
@@ -74,6 +74,10 @@ const diagnostics = defineDiagnostics({
74
74
  why: (p) => `Dock type "${p.type}" is not a servable renderer-module name — the hub serves each module at \`<base>__renderers/<type>.mjs\``,
75
75
  fix: "Renderer types become URL segments, so they may only contain letters, digits, `_`, `-`, and `.`. Use a route-safe dock type (e.g. `json-render`)."
76
76
  },
77
+ DF8111: {
78
+ why: (p) => `Dock "${p.id}" declares the bare-specifier client script "${p.specifier}", but this host advertises no client-module resolution — the browser cannot resolve a bare npm specifier natively, so the script will fail to load.`,
79
+ fix: "Run under a host that declares `initHub({ clientModuleResolution })` (e.g. Vite's `'/@id/{specifier}'`), ship the script as a self-contained bundle served by URL, or resolve it in the viewer via `createDevframeClientHost({ resolveClientModule })` (then disregard this warning)."
80
+ },
77
81
  DF8200: { why: (p) => `Terminal session with id "${p.id}" already registered` },
78
82
  DF8201: { why: (p) => `Terminal session with id "${p.id}" not registered` },
79
83
  DF8202: {
@@ -152,7 +156,7 @@ var DevframeCommandsHost = class {
152
156
  validateCommandIds(this.commands, command);
153
157
  this.validateAgentExposure(command);
154
158
  this.commands.set(command.id, command);
155
- this.events.emit("command:registered", this.toSerializable(command));
159
+ this.events.emit(HUB_EVENTS.bus.commandsRegistered, this.toSerializable(command));
156
160
  this.agentProvider?.notifyChanged();
157
161
  return {
158
162
  id: command.id,
@@ -168,7 +172,7 @@ var DevframeCommandsHost = class {
168
172
  validateCommandIds(this.commands, next, existing.id);
169
173
  this.validateAgentExposure(next);
170
174
  Object.assign(existing, patch);
171
- this.events.emit("command:registered", this.toSerializable(existing));
175
+ this.events.emit(HUB_EVENTS.bus.commandsRegistered, this.toSerializable(existing));
172
176
  this.agentProvider?.notifyChanged();
173
177
  },
174
178
  unregister: () => this.unregister(command.id)
@@ -177,7 +181,7 @@ var DevframeCommandsHost = class {
177
181
  unregister(id) {
178
182
  const deleted = this.commands.delete(id);
179
183
  if (deleted) {
180
- this.events.emit("command:unregistered", id);
184
+ this.events.emit(HUB_EVENTS.bus.commandsUnregistered, id);
181
185
  this.agentProvider?.notifyChanged();
182
186
  }
183
187
  return deleted;
@@ -259,7 +263,7 @@ var DevframeDocksHost = class {
259
263
  this.context = context;
260
264
  }
261
265
  async init() {
262
- this.userSettings = await this.context.rpc.sharedState.get("devframe:user-settings", { sharedState: createStorage({
266
+ this.userSettings = await this.context.rpc.sharedState.get(HUB_EVENTS.sharedState.userSettings, { sharedState: createStorage({
263
267
  filepath: join(this.context.host.getStorageDir("project"), "settings.json"),
264
268
  initialValue: DEFAULT_STATE_USER_SETTINGS()
265
269
  }) });
@@ -290,9 +294,10 @@ var DevframeDocksHost = class {
290
294
  register(view, force) {
291
295
  if (this.views.has(view.id) && !force) throw diagnostics.DF8100({ id: view.id });
292
296
  this.validateGroupMembership(view);
297
+ this.warnUnresolvableClientScript(view);
293
298
  this.prepareRemoteRegistration(view);
294
299
  this.views.set(view.id, view);
295
- this.events.emit("dock:entry:updated", view);
300
+ this.events.emit(HUB_EVENTS.bus.docksEntryUpdated, view);
296
301
  return { update: (patch) => {
297
302
  if (patch.id && patch.id !== view.id) throw diagnostics.DF8101({
298
303
  id: view.id,
@@ -309,15 +314,30 @@ var DevframeDocksHost = class {
309
314
  this.validateGroupMembership(view);
310
315
  this.prepareRemoteRegistration(view);
311
316
  this.views.set(view.id, view);
312
- this.events.emit("dock:entry:updated", view);
317
+ this.events.emit(HUB_EVENTS.bus.docksEntryUpdated, view);
313
318
  }
314
319
  activate(dockId, params) {
315
320
  if (!this.views.has(dockId)) diagnostics.DF8107({ id: dockId });
316
- this.events.emit("dock:activate", {
321
+ this.events.emit(HUB_EVENTS.bus.docksActivate, {
317
322
  dockId,
318
323
  params
319
324
  });
320
325
  }
326
+ /**
327
+ * Warn (don't throw — a viewer-side `resolveClientModule` may still cover
328
+ * it) when a dock declares a **bare-specifier** client script on a host
329
+ * that advertises no `staticConfig.dock.clientModuleResolution`: the
330
+ * browser cannot resolve a bare npm specifier natively, so the script is
331
+ * doomed to fail there.
332
+ */
333
+ warnUnresolvableClientScript(view) {
334
+ if (this.context.staticConfig?.dock?.clientModuleResolution) return;
335
+ const script = view.clientScript ?? view.action ?? view.renderer;
336
+ if (script?.importFrom && isBareModuleSpecifier(script.importFrom)) diagnostics.DF8111({
337
+ id: view.id,
338
+ specifier: script.importFrom
339
+ });
340
+ }
321
341
  validateGroupMembership(view) {
322
342
  if (view.groupId === void 0) return;
323
343
  if (view.groupId === view.id) throw diagnostics.DF8103({ id: view.id });
@@ -395,7 +415,7 @@ var DevframeMessagesHost = class {
395
415
  }
396
416
  this.entries.set(entry.id, entry);
397
417
  this.lastModified.set(entry.id, this._tick());
398
- this.events.emit("message:added", entry);
418
+ this.events.emit(HUB_EVENTS.bus.messagesAdded, entry);
399
419
  if (entry.autoDelete) this._autoDeleteTimers.set(entry.id, setTimeout(() => {
400
420
  this.remove(entry.id);
401
421
  }, entry.autoDelete));
@@ -413,7 +433,7 @@ var DevframeMessagesHost = class {
413
433
  };
414
434
  this.entries.set(id, updated);
415
435
  this.lastModified.set(id, this._tick());
416
- this.events.emit("message:updated", updated);
436
+ this.events.emit(HUB_EVENTS.bus.messagesUpdated, updated);
417
437
  if (patch.autoDelete !== void 0) {
418
438
  const timer = this._autoDeleteTimers.get(id);
419
439
  if (timer) {
@@ -435,7 +455,7 @@ var DevframeMessagesHost = class {
435
455
  this.entries.delete(id);
436
456
  this.lastModified.delete(id);
437
457
  this._recordRemoval(id, this._tick());
438
- this.events.emit("message:removed", id);
458
+ this.events.emit(HUB_EVENTS.bus.messagesRemoved, id);
439
459
  }
440
460
  info(message, extra) {
441
461
  return this.add({
@@ -479,7 +499,7 @@ var DevframeMessagesHost = class {
479
499
  for (const id of this.entries.keys()) this._recordRemoval(id, tick);
480
500
  this.entries.clear();
481
501
  this.lastModified.clear();
482
- this.events.emit("message:cleared");
502
+ this.events.emit(HUB_EVENTS.bus.messagesCleared);
483
503
  }
484
504
  listSince(since) {
485
505
  const version = this._clock;
@@ -523,7 +543,7 @@ var DevframeMessagesHost = class {
523
543
  * Channel name used for terminal stream output. Stable, well-known so
524
544
  * hub-aware clients can subscribe by name.
525
545
  */
526
- const TERMINAL_STREAM_CHANNEL = "devframe:terminals";
546
+ const TERMINAL_STREAM_CHANNEL = HUB_EVENTS.stream.terminals;
527
547
  const TERMINAL_REPLAY_WINDOW = 1e3;
528
548
  /** Max chunks retained in the per-session scrollback buffer (bounded like the replay window). */
529
549
  const TERMINAL_BUFFER_LIMIT = 1e3;
@@ -553,7 +573,7 @@ var DevframeTerminalsHost = class {
553
573
  if (this.sessions.has(session.id)) throw diagnostics.DF8200({ id: session.id });
554
574
  this.sessions.set(session.id, session);
555
575
  this.bindStream(session);
556
- this.events.emit("terminal:session:updated", session);
576
+ this.events.emit(HUB_EVENTS.bus.terminalsSessionUpdated, session);
557
577
  return session;
558
578
  }
559
579
  update(patch) {
@@ -562,12 +582,12 @@ var DevframeTerminalsHost = class {
562
582
  Object.assign(session, patch);
563
583
  this.sessions.set(patch.id, session);
564
584
  this.bindStream(session);
565
- this.events.emit("terminal:session:updated", session);
585
+ this.events.emit(HUB_EVENTS.bus.terminalsSessionUpdated, session);
566
586
  }
567
587
  remove(session) {
568
588
  this._boundStreams.get(session.id)?.dispose();
569
589
  this.sessions.delete(session.id);
570
- this.events.emit("terminal:session:updated", session);
590
+ this.events.emit(HUB_EVENTS.bus.terminalsSessionUpdated, session);
571
591
  this._boundStreams.delete(session.id);
572
592
  }
573
593
  bindStream(session) {
@@ -621,7 +641,7 @@ var DevframeTerminalsHost = class {
621
641
  const markStatus = (next) => {
622
642
  if (session.status === next) return;
623
643
  session.status = next;
624
- this.events.emit("terminal:session:updated", session);
644
+ this.events.emit(HUB_EVENTS.bus.terminalsSessionUpdated, session);
625
645
  };
626
646
  const closeStream = () => {
627
647
  if (streamClosed) return;
@@ -755,7 +775,7 @@ var DevframeTerminalsHost = class {
755
775
  const markStatus = (next) => {
756
776
  if (session.status === next) return;
757
777
  session.status = next;
758
- this.events.emit("terminal:session:updated", session);
778
+ this.events.emit(HUB_EVENTS.bus.terminalsSessionUpdated, session);
759
779
  };
760
780
  const closeStream = () => {
761
781
  if (streamClosed) return;
@@ -923,6 +943,7 @@ async function installDevframe(ctx, d, options = {}) {
923
943
  type: "iframe",
924
944
  url: base
925
945
  });
946
+ for (const input of d.services ?? []) ctx.services.install(input, { resolveFrom: d.packageName });
926
947
  await d.setup(ctx);
927
948
  }
928
949
  //#endregion
@@ -957,7 +978,7 @@ function resolveControllableSession(sessions, id) {
957
978
  * from the shared state and dispatch by id via this RPC.
958
979
  */
959
980
  const hubCommandsExecute = defineHubRpcFunction({
960
- name: "hub:commands:execute",
981
+ name: HUB_EVENTS.rpc.commandsExecute,
961
982
  type: "action",
962
983
  setup: (context) => ({ async handler(id, ...args) {
963
984
  return context.commands.execute(id, ...args);
@@ -973,7 +994,7 @@ const hubCommandsExecute = defineHubRpcFunction({
973
994
  * dock client script can report into the same feed the server writes to.
974
995
  */
975
996
  const hubMessagesAdd = defineHubRpcFunction({
976
- name: "hub:messages:add",
997
+ name: HUB_EVENTS.rpc.messagesAdd,
977
998
  type: "action",
978
999
  jsonSerializable: true,
979
1000
  setup: (context) => ({ async handler(input) {
@@ -985,7 +1006,7 @@ const hubMessagesAdd = defineHubRpcFunction({
985
1006
  });
986
1007
  /** `hub:messages:update` — Patch a message by id; returns the updated entry (or `undefined`). */
987
1008
  const hubMessagesUpdate = defineHubRpcFunction({
988
- name: "hub:messages:update",
1009
+ name: HUB_EVENTS.rpc.messagesUpdate,
989
1010
  type: "action",
990
1011
  jsonSerializable: true,
991
1012
  setup: (context) => ({ async handler(id, patch) {
@@ -994,7 +1015,7 @@ const hubMessagesUpdate = defineHubRpcFunction({
994
1015
  });
995
1016
  /** `hub:messages:remove` — Remove a message by id. */
996
1017
  const hubMessagesRemove = defineHubRpcFunction({
997
- name: "hub:messages:remove",
1018
+ name: HUB_EVENTS.rpc.messagesRemove,
998
1019
  type: "action",
999
1020
  setup: (context) => ({ async handler(id) {
1000
1021
  await context.messages.remove(id);
@@ -1002,7 +1023,7 @@ const hubMessagesRemove = defineHubRpcFunction({
1002
1023
  });
1003
1024
  /** `hub:messages:clear` — Remove every message. */
1004
1025
  const hubMessagesClear = defineHubRpcFunction({
1005
- name: "hub:messages:clear",
1026
+ name: HUB_EVENTS.rpc.messagesClear,
1006
1027
  type: "action",
1007
1028
  setup: (context) => ({ async handler() {
1008
1029
  await context.messages.clear();
@@ -1014,7 +1035,7 @@ const hubMessagesClear = defineHubRpcFunction({
1014
1035
  * terminals plugin) drive a session owned by another plugin.
1015
1036
  */
1016
1037
  const hubTerminalsWrite = defineHubRpcFunction({
1017
- name: "hub:terminals:write",
1038
+ name: HUB_EVENTS.rpc.terminalsWrite,
1018
1039
  type: "action",
1019
1040
  setup: (context) => ({ async handler(id, data) {
1020
1041
  resolveInteractiveSession(context.terminals.sessions, id).write(data);
@@ -1022,7 +1043,7 @@ const hubTerminalsWrite = defineHubRpcFunction({
1022
1043
  });
1023
1044
  /** `hub:terminals:resize` — Resize an interactive PTY session by id. */
1024
1045
  const hubTerminalsResize = defineHubRpcFunction({
1025
- name: "hub:terminals:resize",
1046
+ name: HUB_EVENTS.rpc.terminalsResize,
1026
1047
  type: "action",
1027
1048
  setup: (context) => ({ async handler(id, cols, rows) {
1028
1049
  resolveInteractiveSession(context.terminals.sessions, id).resize(cols, rows);
@@ -1035,7 +1056,7 @@ const hubTerminalsResize = defineHubRpcFunction({
1035
1056
  * force-kill a session owned by another plugin.
1036
1057
  */
1037
1058
  const hubTerminalsTerminate = defineHubRpcFunction({
1038
- name: "hub:terminals:terminate",
1059
+ name: HUB_EVENTS.rpc.terminalsTerminate,
1039
1060
  type: "action",
1040
1061
  setup: (context) => ({ async handler(id) {
1041
1062
  await resolveControllableSession(context.terminals.sessions, id).terminate();
@@ -1047,7 +1068,7 @@ const hubTerminalsTerminate = defineHubRpcFunction({
1047
1068
  * elsewhere.
1048
1069
  */
1049
1070
  const hubTerminalsRestart = defineHubRpcFunction({
1050
- name: "hub:terminals:restart",
1071
+ name: HUB_EVENTS.rpc.terminalsRestart,
1051
1072
  type: "action",
1052
1073
  setup: (context) => ({ async handler(id) {
1053
1074
  const session = resolveControllableSession(context.terminals.sessions, id);
@@ -1061,7 +1082,7 @@ const hubTerminalsRestart = defineHubRpcFunction({
1061
1082
  * terminal UI discard a stopped aggregated session.
1062
1083
  */
1063
1084
  const hubTerminalsRemove = defineHubRpcFunction({
1064
- name: "hub:terminals:remove",
1085
+ name: HUB_EVENTS.rpc.terminalsRemove,
1065
1086
  type: "action",
1066
1087
  setup: (context) => ({ async handler(id) {
1067
1088
  const session = context.terminals.sessions.get(id);
@@ -1084,7 +1105,7 @@ const hubTerminalsRemove = defineHubRpcFunction({
1084
1105
  * mounts in response still converges on it).
1085
1106
  */
1086
1107
  const hubDocksActivate = defineHubRpcFunction({
1087
- name: "hub:docks:activate",
1108
+ name: HUB_EVENTS.rpc.docksActivate,
1088
1109
  type: "action",
1089
1110
  setup: (context) => ({ async handler(input) {
1090
1111
  context.docks.activate(input.dockId, input.params);
@@ -1133,48 +1154,48 @@ async function createHubContext(options) {
1133
1154
  context.install = (devframe, options) => installDevframe(context, devframe, options);
1134
1155
  await docks.init();
1135
1156
  const debounceMs = options.mode === "build" ? 0 : 10;
1136
- const docksSharedState = await context.rpc.sharedState.get("devframe:docks", { initialValue: [] });
1157
+ const docksSharedState = await context.rpc.sharedState.get(HUB_EVENTS.sharedState.docks, { initialValue: [] });
1137
1158
  const refreshDocks = debounce(() => {
1138
1159
  docksSharedState.mutate(() => docks.values());
1139
1160
  }, debounceMs);
1140
- docks.events.on("dock:entry:updated", refreshDocks);
1161
+ docks.events.on(HUB_EVENTS.bus.docksEntryUpdated, refreshDocks);
1141
1162
  getInternalContext(context).onWsEndpointChange(refreshDocks);
1142
1163
  docksSharedState.mutate(() => docks.values());
1143
- const activeDockSharedState = await context.rpc.sharedState.get("devframe:docks:active", { initialValue: { activation: null } });
1144
- docks.events.on("dock:activate", (activation) => {
1164
+ const activeDockSharedState = await context.rpc.sharedState.get(HUB_EVENTS.sharedState.docksActive, { initialValue: { activation: null } });
1165
+ docks.events.on(HUB_EVENTS.bus.docksActivate, (activation) => {
1145
1166
  activeDockSharedState.mutate((state) => {
1146
1167
  state.activation = activation;
1147
1168
  });
1148
1169
  context.rpc.broadcast({
1149
- method: "devframe:docks:activate",
1170
+ method: HUB_EVENTS.broadcast.docksActivate,
1150
1171
  args: [activation]
1151
1172
  });
1152
1173
  });
1153
1174
  const broadcastTerminals = debounce(() => {
1154
1175
  context.rpc.broadcast({
1155
- method: "devframe:terminals:updated",
1176
+ method: HUB_EVENTS.broadcast.terminalsUpdated,
1156
1177
  args: []
1157
1178
  });
1158
1179
  docksSharedState.mutate(() => docks.values());
1159
1180
  }, debounceMs);
1160
- terminals.events.on("terminal:session:updated", broadcastTerminals);
1181
+ terminals.events.on(HUB_EVENTS.bus.terminalsSessionUpdated, broadcastTerminals);
1161
1182
  const broadcastMessages = debounce(() => {
1162
1183
  context.rpc.broadcast({
1163
- method: "devframe:messages:updated",
1184
+ method: HUB_EVENTS.broadcast.messagesUpdated,
1164
1185
  args: []
1165
1186
  });
1166
1187
  docksSharedState.mutate(() => docks.values());
1167
1188
  }, debounceMs);
1168
- messages.events.on("message:added", broadcastMessages);
1169
- messages.events.on("message:updated", broadcastMessages);
1170
- messages.events.on("message:removed", broadcastMessages);
1171
- messages.events.on("message:cleared", broadcastMessages);
1172
- const commandsSharedState = await context.rpc.sharedState.get("devframe:commands", { initialValue: [] });
1189
+ messages.events.on(HUB_EVENTS.bus.messagesAdded, broadcastMessages);
1190
+ messages.events.on(HUB_EVENTS.bus.messagesUpdated, broadcastMessages);
1191
+ messages.events.on(HUB_EVENTS.bus.messagesRemoved, broadcastMessages);
1192
+ messages.events.on(HUB_EVENTS.bus.messagesCleared, broadcastMessages);
1193
+ const commandsSharedState = await context.rpc.sharedState.get(HUB_EVENTS.sharedState.commands, { initialValue: [] });
1173
1194
  const syncCommands = debounce(() => {
1174
1195
  commandsSharedState.mutate(() => commands.list());
1175
1196
  }, debounceMs);
1176
- commands.events.on("command:registered", syncCommands);
1177
- commands.events.on("command:unregistered", syncCommands);
1197
+ commands.events.on(HUB_EVENTS.bus.commandsRegistered, syncCommands);
1198
+ commands.events.on(HUB_EVENTS.bus.commandsUnregistered, syncCommands);
1178
1199
  commandsSharedState.mutate(() => commands.list());
1179
1200
  return context;
1180
1201
  }
@@ -1,4 +1,4 @@
1
- import { b as DevframeDockEntryIcon, k as DevframeViewIframe, l as DevframeCommandsHost, m as DevframeDockActivation, w as DevframeDocksHost } from "./settings-DfrRa9Wf.mjs";
1
+ import { b as DevframeDockEntryIcon, k as DevframeViewIframe, l as DevframeCommandsHost, m as DevframeDockActivation, w as DevframeDocksHost } from "./settings-D7whfcx2.mjs";
2
2
  import { CreateHostContextOptions } from "devframe/node";
3
3
  import { DevframeDefinition, DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
4
4
  import { ChildProcess } from "node:child_process";
@@ -207,10 +207,10 @@ interface DevframeMessagesListDelta {
207
207
  interface DevframeMessagesHost extends DevframeMessagesLevelShortcuts {
208
208
  readonly entries: Map<string, DevframeMessageEntry>;
209
209
  readonly events: EventEmitter<{
210
- 'message:added': (entry: DevframeMessageEntry) => void;
211
- 'message:updated': (entry: DevframeMessageEntry) => void;
212
- 'message:removed': (id: string) => void;
213
- 'message:cleared': () => void;
210
+ 'messages:added': (entry: DevframeMessageEntry) => void;
211
+ 'messages:updated': (entry: DevframeMessageEntry) => void;
212
+ 'messages:removed': (id: string) => void;
213
+ 'messages:cleared': () => void;
214
214
  }>;
215
215
  /**
216
216
  * Add a new message entry. If an entry with the same `id` already exists, it will be updated instead.
@@ -244,7 +244,7 @@ interface DevframeMessagesHost extends DevframeMessagesLevelShortcuts {
244
244
  interface DevframeTerminalsHost {
245
245
  readonly sessions: Map<string, DevframeTerminalSession>;
246
246
  readonly events: EventEmitter<{
247
- 'terminal:session:updated': (session: DevframeTerminalSession) => void;
247
+ 'terminals:session:updated': (session: DevframeTerminalSession) => void;
248
248
  }>;
249
249
  register: (session: DevframeTerminalSession) => DevframeTerminalSession;
250
250
  update: (session: DevframeTerminalSession) => void;
@@ -1,5 +1,5 @@
1
- import "./context-D5TJIHwp.mjs";
2
- import "./settings-DfrRa9Wf.mjs";
1
+ import "./context-BVkxwz5k.mjs";
2
+ import "./settings-D7whfcx2.mjs";
3
3
  import { RpcDefinitionsFilter, RpcDefinitionsToFunctions } from "devframe/rpc";
4
4
  import { ConnectionMeta as ConnectionMeta$1, DevframeCapabilities, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeHost as DevframeHost$1, DevframeNodeRpcSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeViewHost, EventEmitter as EventEmitter$1, EventUnsubscribe, EventsMap, RpcBroadcastOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost } from "devframe/types";
5
5
  export { RpcStreamingHost as S, RpcFunctionsHost as _, DevframeHost$1 as a, RpcStreamingChannel as b, DevframeRpcServerFunctions as c, EventEmitter$1 as d, EventUnsubscribe as f, RpcDefinitionsToFunctions as g, RpcDefinitionsFilter as h, DevframeDiagnosticsLogger as i, DevframeRpcSharedStates as l, RpcBroadcastOptions as m, DevframeCapabilities as n, DevframeNodeRpcSession as o, EventsMap as p, DevframeDiagnosticsHost as r, DevframeRpcClientFunctions as s, ConnectionMeta$1 as t, DevframeViewHost as u, RpcSharedStateGetOptions as v, RpcStreamingChannelOptions as x, RpcSharedStateHost as y };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as DevframeMessageHandle, D as DevframeMessagesHost, E as DevframeMessagesClient, O as DevframeMessagesLevelShortcuts, S as DevframeMessageFilePosition, T as DevframeMessageShortcutInput, _ as DevframeMessageCommandAction, a as DevframeChildProcessExecuteOptions, b as DevframeMessageEntryFrom, c as DevframeChildProcessTerminalSession, d as DevframeTerminalSession, f as DevframeTerminalSessionBase, g as DevframeMessageActivateAction, h as DevframeMessageAction, k as DevframeMessagesListDelta, l as DevframePtyExecuteOptions, m as DevframeTerminalsHost, n as DevframeHubContext, o as DevframeChildProcessOutput, p as DevframeTerminalStatus, s as DevframeChildProcessResult, t as CreateHubContextOptions, u as DevframePtyTerminalSession, v as DevframeMessageElementPosition, w as DevframeMessageLevel, x as DevframeMessageEntryInput, y as DevframeMessageEntry } from "./context-D5TJIHwp.mjs";
2
- import { A as DevframeViewLauncher, C as DevframeDocksActiveState, D as DevframeViewCustomRender, E as DevframeViewBuiltin, F as RemoteDockOptions, M as FrameSubTabsConfig, N as NavTarget, O as DevframeViewGroup, P as RemoteConnectionInfo, S as DevframeDockUserEntry, T as DevframeViewAction, _ as DevframeDockEntry, a as DevframeCommandEntry, b as DevframeDockEntryIcon, c as DevframeCommandShortcutOverrides, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, g as DevframeDockEntriesGrouped, h as DevframeDockBadgeVariant, i as DevframeCommandBase, j as DevframeViewLauncherStatus, k as DevframeViewIframe, l as DevframeCommandsHost, m as DevframeDockActivation, n as DevframeClientCommand, o as DevframeCommandHandle, p as ClientScriptEntry, r as DevframeCommandAgentOptions, s as DevframeCommandKeybinding, t as DevframeDocksUserSettings, u as DevframeCommandsHostEvents, v as DevframeDockEntryBase, w as DevframeDocksHost, x as DevframeDockEntryRegistry, y as DevframeDockEntryCategory } from "./settings-DfrRa9Wf.mjs";
3
- import { S as RpcStreamingHost, _ as RpcFunctionsHost, a as DevframeHost, b as RpcStreamingChannel, c as DevframeRpcServerFunctions, d as EventEmitter, f as EventUnsubscribe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, i as DevframeDiagnosticsLogger, l as DevframeRpcSharedStates, m as RpcBroadcastOptions, n as DevframeCapabilities, o as DevframeNodeRpcSession, p as EventsMap, r as DevframeDiagnosticsHost, s as DevframeRpcClientFunctions, t as ConnectionMeta, u as DevframeViewHost, v as RpcSharedStateGetOptions, x as RpcStreamingChannelOptions, y as RpcSharedStateHost } from "./index-coDmWngQ.mjs";
1
+ import { C as DevframeMessageHandle, D as DevframeMessagesHost, E as DevframeMessagesClient, O as DevframeMessagesLevelShortcuts, S as DevframeMessageFilePosition, T as DevframeMessageShortcutInput, _ as DevframeMessageCommandAction, a as DevframeChildProcessExecuteOptions, b as DevframeMessageEntryFrom, c as DevframeChildProcessTerminalSession, d as DevframeTerminalSession, f as DevframeTerminalSessionBase, g as DevframeMessageActivateAction, h as DevframeMessageAction, k as DevframeMessagesListDelta, l as DevframePtyExecuteOptions, m as DevframeTerminalsHost, n as DevframeHubContext, o as DevframeChildProcessOutput, p as DevframeTerminalStatus, s as DevframeChildProcessResult, t as CreateHubContextOptions, u as DevframePtyTerminalSession, v as DevframeMessageElementPosition, w as DevframeMessageLevel, x as DevframeMessageEntryInput, y as DevframeMessageEntry } from "./context-BVkxwz5k.mjs";
2
+ import { A as DevframeViewLauncher, C as DevframeDocksActiveState, D as DevframeViewCustomRender, E as DevframeViewBuiltin, F as RemoteDockOptions, M as FrameSubTabsConfig, N as NavTarget, O as DevframeViewGroup, P as RemoteConnectionInfo, S as DevframeDockUserEntry, T as DevframeViewAction, _ as DevframeDockEntry, a as DevframeCommandEntry, b as DevframeDockEntryIcon, c as DevframeCommandShortcutOverrides, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, g as DevframeDockEntriesGrouped, h as DevframeDockBadgeVariant, i as DevframeCommandBase, j as DevframeViewLauncherStatus, k as DevframeViewIframe, l as DevframeCommandsHost, m as DevframeDockActivation, n as DevframeClientCommand, o as DevframeCommandHandle, p as ClientScriptEntry, r as DevframeCommandAgentOptions, s as DevframeCommandKeybinding, t as DevframeDocksUserSettings, u as DevframeCommandsHostEvents, v as DevframeDockEntryBase, w as DevframeDocksHost, x as DevframeDockEntryRegistry, y as DevframeDockEntryCategory } from "./settings-D7whfcx2.mjs";
3
+ import { S as RpcStreamingHost, _ as RpcFunctionsHost, a as DevframeHost, b as RpcStreamingChannel, c as DevframeRpcServerFunctions, d as EventEmitter, f as EventUnsubscribe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, i as DevframeDiagnosticsLogger, l as DevframeRpcSharedStates, m as RpcBroadcastOptions, n as DevframeCapabilities, o as DevframeNodeRpcSession, p as EventsMap, r as DevframeDiagnosticsHost, s as DevframeRpcClientFunctions, t as ConnectionMeta, u as DevframeViewHost, v as RpcSharedStateGetOptions, x as RpcStreamingChannelOptions, y as RpcSharedStateHost } from "./index-CyEyZHB3.mjs";
4
4
  import { WhenContext, WhenExpression } from "devframe/utils/when";
5
5
  //#region src/define.d.ts
6
6
  declare const defineHubRpcFunction: <NAME extends string, TYPE extends import("devframe/rpc").RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends import("devframe/rpc").RpcArgsSchema | undefined = undefined, const RS extends import("devframe/rpc").RpcReturnSchema | undefined = undefined>(definition: import("devframe/rpc").RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>) => import("devframe/rpc").RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>;
@@ -1,5 +1,5 @@
1
- import { C as DevframeMessageHandle, D as DevframeMessagesHost$1, T as DevframeMessageShortcutInput, a as DevframeChildProcessExecuteOptions, c as DevframeChildProcessTerminalSession, d as DevframeTerminalSession, f as DevframeTerminalSessionBase, i as InstallDevframeOptions, k as DevframeMessagesListDelta, l as DevframePtyExecuteOptions, m as DevframeTerminalsHost$1, n as DevframeHubContext, r as createHubContext, t as CreateHubContextOptions, u as DevframePtyTerminalSession, x as DevframeMessageEntryInput, y as DevframeMessageEntry } from "../context-D5TJIHwp.mjs";
2
- import { S as DevframeDockUserEntry, _ as DevframeDockEntry, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, l as DevframeCommandsHost$1, o as DevframeCommandHandle, p as ClientScriptEntry, t as DevframeDocksUserSettings, w as DevframeDocksHost$1 } from "../settings-DfrRa9Wf.mjs";
1
+ import { C as DevframeMessageHandle, D as DevframeMessagesHost$1, T as DevframeMessageShortcutInput, a as DevframeChildProcessExecuteOptions, c as DevframeChildProcessTerminalSession, d as DevframeTerminalSession, f as DevframeTerminalSessionBase, i as InstallDevframeOptions, k as DevframeMessagesListDelta, l as DevframePtyExecuteOptions, m as DevframeTerminalsHost$1, n as DevframeHubContext, r as createHubContext, t as CreateHubContextOptions, u as DevframePtyTerminalSession, x as DevframeMessageEntryInput, y as DevframeMessageEntry } from "../context-BVkxwz5k.mjs";
2
+ import { S as DevframeDockUserEntry, _ as DevframeDockEntry, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, l as DevframeCommandsHost$1, o as DevframeCommandHandle, p as ClientScriptEntry, t as DevframeDocksUserSettings, w as DevframeDocksHost$1 } from "../settings-D7whfcx2.mjs";
3
3
  import { RpcFunctionDefinitionAny } from "devframe/rpc";
4
4
  import { SharedState } from "devframe/utils/shared-state";
5
5
  //#region src/node/host-commands.d.ts
@@ -51,6 +51,14 @@ declare class DevframeDocksHost implements DevframeDocksHost$1 {
51
51
  };
52
52
  update(view: DevframeDockUserEntry): void;
53
53
  activate(dockId: string, params?: Record<string, unknown>): void;
54
+ /**
55
+ * Warn (don't throw — a viewer-side `resolveClientModule` may still cover
56
+ * it) when a dock declares a **bare-specifier** client script on a host
57
+ * that advertises no `staticConfig.dock.clientModuleResolution`: the
58
+ * browser cannot resolve a bare npm specifier natively, so the script is
59
+ * doomed to fail there.
60
+ */
61
+ private warnUnresolvableClientScript;
54
62
  private validateGroupMembership;
55
63
  private prepareRemoteRegistration;
56
64
  }