super-dsh 0.1.3 → 0.1.5

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.
Files changed (142) hide show
  1. package/README.md +3 -3
  2. package/agent-agy/cordis.patch.yml +8 -4
  3. package/agent-agy/dist/agent-preset-agy.d.ts +23 -43
  4. package/agent-agy/dist/agent-preset-agy.js +29 -166
  5. package/agent-agy/dist/agent.d.ts +2 -1
  6. package/agent-agy/dist/agent.js +3 -2
  7. package/agent-agy/dist/agy-sessions.d.ts +2 -1
  8. package/agent-agy/dist/agy-sessions.js +2 -11
  9. package/agent-agy/dist/index.js +13 -12
  10. package/agent-agy/dist/world-plugin.d.ts +2 -1
  11. package/agent-agy/dist/world-plugin.js +31 -51
  12. package/agent-agy/package.json +6 -6
  13. package/agent-claude/cordis.patch.yml +8 -4
  14. package/agent-claude/dist/agent-preset-claude.js +29 -166
  15. package/agent-claude/dist/agent.js +10 -10
  16. package/agent-claude/dist/claude-client.js +22 -3
  17. package/agent-claude/dist/claude-home.js +0 -8
  18. package/agent-claude/dist/index.js +12 -15
  19. package/agent-claude/dist/session-map.js +2 -5
  20. package/agent-claude/dist/world-plugin.js +3 -3
  21. package/agent-claude/package.json +9 -9
  22. package/agent-codex/README.md +8 -8
  23. package/agent-codex/cordis.patch.yml +9 -5
  24. package/agent-codex/dist/agent-preset-codex.js +29 -168
  25. package/agent-codex/dist/agent.js +17 -12
  26. package/agent-codex/dist/codex-store.js +0 -9
  27. package/agent-codex/dist/index.js +13 -16
  28. package/agent-codex/dist/session-map.js +2 -5
  29. package/agent-codex/dist/world-plugin.js +31 -51
  30. package/agent-codex/package.json +14 -11
  31. package/agent-hermes/README.md +9 -8
  32. package/agent-hermes/cordis.patch.yml +8 -4
  33. package/agent-hermes/dist/agent-preset-hermes.js +29 -168
  34. package/agent-hermes/dist/agent.js +33 -19
  35. package/agent-hermes/dist/hermes-client.js +5 -5
  36. package/agent-hermes/dist/hermes-store.js +2 -11
  37. package/agent-hermes/dist/index.js +13 -12
  38. package/agent-hermes/dist/world-plugin.js +31 -52
  39. package/agent-hermes/package.json +14 -11
  40. package/agent-omp/README.md +2 -2
  41. package/agent-omp/cordis.patch.yml +12 -7
  42. package/agent-omp/dist/agent-preset-omp.js +30 -169
  43. package/agent-omp/dist/agent.js +13 -5
  44. package/agent-omp/dist/index.js +12 -22
  45. package/agent-omp/dist/mobile/gesture.js +2 -2
  46. package/agent-omp/dist/mobile/zoom-guard.js +4 -4
  47. package/agent-omp/dist/mobile-boot.js +2 -2
  48. package/agent-omp/dist/omp-cli.js +1 -1
  49. package/agent-omp/dist/omp-disk-discovery.js +1 -1
  50. package/agent-omp/dist/protocol.js +1 -1
  51. package/agent-omp/dist/sidecar-client.js +1 -1
  52. package/agent-omp/dist/world-plugin.js +37 -50
  53. package/agent-omp/package.json +18 -14
  54. package/agent-omp/sidecar/main.ts +2 -2
  55. package/agent-pi/README.md +5 -5
  56. package/agent-pi/cordis.patch.yml +8 -4
  57. package/agent-pi/dist/agent-preset-pi.js +29 -166
  58. package/agent-pi/dist/agent.js +18 -12
  59. package/agent-pi/dist/index.js +14 -16
  60. package/agent-pi/dist/pi-home.js +2 -12
  61. package/agent-pi/dist/world-plugin.js +31 -51
  62. package/agent-pi/package.json +14 -11
  63. package/client/index.js +1994 -150
  64. package/cordis.patch.yml +38 -15
  65. package/package.json +32 -30
  66. package/{agent-hub → superd-hub}/cordis.patch.yml +3 -3
  67. package/{agent-hub → superd-hub}/dist/agent-roster.d.ts +3 -1
  68. package/{agent-hub → superd-hub}/dist/agent-roster.js +4 -2
  69. package/superd-hub/dist/carrier.d.ts +62 -0
  70. package/superd-hub/dist/carrier.js +213 -0
  71. package/superd-hub/dist/fusion-transport.d.ts +148 -0
  72. package/superd-hub/dist/fusion-transport.js +397 -0
  73. package/{agent-hub → superd-hub}/dist/gateway.d.ts +9 -4
  74. package/superd-hub/dist/gateway.js +44 -0
  75. package/superd-hub/dist/hub-route.d.ts +74 -0
  76. package/superd-hub/dist/hub-route.js +188 -0
  77. package/{agent-hub → superd-hub}/dist/index.d.ts +14 -6
  78. package/{agent-hub → superd-hub}/dist/index.js +14 -6
  79. package/{agent-hub → superd-hub}/dist/roster.d.ts +2 -2
  80. package/{agent-hub → superd-hub}/dist/rpc.js +1 -1
  81. package/{agent-hub → superd-hub}/dist/spawn-world.d.ts +27 -6
  82. package/superd-hub/dist/spawn-world.js +279 -0
  83. package/superd-hub/dist/switch-core.d.ts +630 -0
  84. package/superd-hub/dist/switch-core.js +734 -0
  85. package/superd-hub/dist/system-head.d.ts +69 -0
  86. package/superd-hub/dist/system-head.js +194 -0
  87. package/superd-hub/dist/web-trust.d.ts +112 -0
  88. package/superd-hub/dist/web-trust.js +126 -0
  89. package/superd-hub/dist/world-entry.d.ts +38 -0
  90. package/superd-hub/dist/world-entry.js +47 -0
  91. package/{agent-hub → superd-hub}/dist/world-host.d.ts +15 -20
  92. package/superd-hub/dist/world-host.js +65 -0
  93. package/{agent-hub → superd-hub}/dist/world-join.d.ts +2 -1
  94. package/{agent-hub → superd-hub}/dist/world-join.js +30 -50
  95. package/superd-hub/dist/world-mount.d.ts +82 -0
  96. package/superd-hub/dist/world-mount.js +105 -0
  97. package/{agent-hub → superd-hub}/dist/world-mux.d.ts +21 -6
  98. package/superd-hub/dist/world-mux.js +392 -0
  99. package/{agent-hub → superd-hub}/dist/world-provision.d.ts +20 -4
  100. package/superd-hub/dist/world-provision.js +203 -0
  101. package/superd-hub/dist/world-web-server.d.ts +113 -0
  102. package/superd-hub/dist/world-web-server.js +99 -0
  103. package/superd-hub/lib/client/index.js +2086 -0
  104. package/{agent-hub → superd-hub}/package.json +12 -7
  105. package/agent-agy/dist/agent-preset-projection.d.ts +0 -31
  106. package/agent-agy/dist/agent-preset-projection.js +0 -33
  107. package/agent-claude/dist/agent-preset-projection.js +0 -30
  108. package/agent-codex/dist/agent-preset-projection.js +0 -37
  109. package/agent-codex/dist/app-home.js +0 -65
  110. package/agent-codex/dist/spike.js +0 -46
  111. package/agent-hermes/dist/agent-preset-projection.js +0 -34
  112. package/agent-hub/dist/carrier.d.ts +0 -43
  113. package/agent-hub/dist/carrier.js +0 -241
  114. package/agent-hub/dist/client-shim.d.ts +0 -28
  115. package/agent-hub/dist/client-shim.js +0 -251
  116. package/agent-hub/dist/gateway.js +0 -18
  117. package/agent-hub/dist/index-pass.d.ts +0 -22
  118. package/agent-hub/dist/index-pass.js +0 -47
  119. package/agent-hub/dist/labels.d.ts +0 -45
  120. package/agent-hub/dist/labels.js +0 -83
  121. package/agent-hub/dist/spawn-world.js +0 -72
  122. package/agent-hub/dist/world-entry.d.ts +0 -31
  123. package/agent-hub/dist/world-entry.js +0 -51
  124. package/agent-hub/dist/world-host.js +0 -44
  125. package/agent-hub/dist/world-mount.d.ts +0 -52
  126. package/agent-hub/dist/world-mount.js +0 -52
  127. package/agent-hub/dist/world-mux.js +0 -224
  128. package/agent-hub/dist/world-provision.js +0 -122
  129. package/agent-hub/dist/world-web-server.d.ts +0 -162
  130. package/agent-hub/dist/world-web-server.js +0 -248
  131. package/agent-hub/lib/client/index.js +0 -242
  132. package/agent-omp/dist/agent-preset-projection.js +0 -36
  133. package/agent-omp/dist/app-home.js +0 -86
  134. package/agent-pi/dist/agent-preset-projection.js +0 -29
  135. /package/{agent-hub → superd-hub}/dist/envelope.d.ts +0 -0
  136. /package/{agent-hub → superd-hub}/dist/envelope.js +0 -0
  137. /package/{agent-hub → superd-hub}/dist/ownership.d.ts +0 -0
  138. /package/{agent-hub → superd-hub}/dist/ownership.js +0 -0
  139. /package/{agent-hub → superd-hub}/dist/roster.js +0 -0
  140. /package/{agent-hub → superd-hub}/dist/rpc.d.ts +0 -0
  141. /package/{agent-hub → superd-hub}/dist/targets.d.ts +0 -0
  142. /package/{agent-hub → superd-hub}/dist/targets.js +0 -0
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Cross-root mount registry (AW-B DL1/DL3).
3
+ *
4
+ * A world runs as its OWN cordis ROOT (events are root-scoped — probe
5
+ * 2026-09-16), so ctx0 and the world cannot share service instances through
6
+ * the context tree. They DO share this module (the profile links
7
+ * `@pgmi-builds/superd-hub` at the same path), which is where the host hands
8
+ * the world what it needs to mount itself:
9
+ *
10
+ * ctx0 hub → registerHostMount({ key, labelPath }) (before spawn)
11
+ * world → takeHostMount(key) → provides the virtual `webServer`
12
+ *
13
+ * T-C (2026-09-26): the `real`/`authorize` legs were RETIRED with the
14
+ * per-label URL family. T-D (2026-09-26) swept the vestiges: the mount record
15
+ * is the world's ADDRESSABILITY entry only (`{ key, labelPath }`) — no ctx0
16
+ * webServer instance, no index gate; the adapter world-plugins' call sites
17
+ * were updated in the same round.
18
+ *
19
+ * No selection state: the key is the world's own identity, fixed at spawn.
20
+ */
21
+ const mounts = new Map();
22
+ /** Publish the host side of one world mount (idempotent replace). */
23
+ export function registerHostMount(mount) {
24
+ mounts.set(mount.key, mount);
25
+ return () => {
26
+ if (mounts.get(mount.key) === mount)
27
+ mounts.delete(mount.key);
28
+ };
29
+ }
30
+ const servers = new Map();
31
+ /** Record the virtual webServer a world root provided (diagnostics/tests). */
32
+ export function noteWorldServer(key, server) {
33
+ servers.set(key, server);
34
+ }
35
+ /** The virtual webServer a world root provided, if it mounted yet. */
36
+ export function worldServerOf(key) {
37
+ return servers.get(key);
38
+ }
39
+ /** Read one host mount (called from inside the world root). */
40
+ export function takeHostMount(key) {
41
+ return mounts.get(key);
42
+ }
43
+ /** Keys with a published host mount. */
44
+ export function listHostMounts() {
45
+ return [...mounts.keys()];
46
+ }
47
+ const worldFetchHandlers = new Map();
48
+ /**
49
+ * Publish one world's shared `/api` fetch handler so the hub's `/hub` family
50
+ * can forward non-envelope traffic (`?agent=<label>` GET/HEAD) into the
51
+ * world's registered routes (session-log export and friends). Called from
52
+ * inside the world root (`world-entry`); read from the host root
53
+ * (`carrier`). Idempotent replace.
54
+ */
55
+ export function publishWorldFetch(key, handler) {
56
+ worldFetchHandlers.set(key, handler);
57
+ return () => {
58
+ if (worldFetchHandlers.get(key) === handler)
59
+ worldFetchHandlers.delete(key);
60
+ };
61
+ }
62
+ /** The world's published shared `/api` fetch handler, if its root published one yet. */
63
+ export function worldFetchHandlerOf(key) {
64
+ return worldFetchHandlers.get(key);
65
+ }
@@ -1,5 +1,5 @@
1
1
  /** Stable Cordis plugin name. */
2
- export declare const name = "aw.world.join";
2
+ export declare const name = "superd-join";
3
3
  /** Row config: which world to join, under which roster label. */
4
4
  export interface Config {
5
5
  key: string;
@@ -10,6 +10,7 @@ interface HostContext {
10
10
  provide(name: string, value: unknown): void;
11
11
  inject(deps: string[], callback: (ctx: unknown) => void): unknown;
12
12
  effect?(callback: () => () => void, label?: string): unknown;
13
+ get(name: string): unknown;
13
14
  }
14
15
  /** Apply the join. @param ctx - the CTX0 root context. @param config - `{ key, label? }`. */
15
16
  export declare function apply(ctx: HostContext, config?: Partial<Config>): void;
@@ -1,22 +1,26 @@
1
1
  /**
2
- * Hub-side world joiner (AW-B DL1–DL5) — `@pgmi-builds/agent-hub/join`.
2
+ * Hub-side world joiner (AW-B DL1–DL5) — `@pgmi-builds/superd-hub/join`.
3
3
  *
4
4
  * Ruling R2 (2026-09-16): an adapter may ship STANDALONE only — joining the
5
- * agent-worlds hub is the HUB side's job. This plugin is that job, generic:
5
+ * super-dsh hub is the HUB side's job. This plugin is that job, generic:
6
6
  * the ctx0 composition inserts one row with `{ key }` and the hub does the
7
7
  * spawn/roster/mount wiring the adapter's own world plugin would otherwise
8
8
  * carry (the omp/codex adapters ship active per-adapter plugins; the claude
9
9
  * adapter's `/world` entry is deliberately inert and is joined HERE).
10
10
  *
11
11
  * 1. roster membership (activation IS membership, spec S2);
12
- * 2. ctx0 publishes the host mount (real webServer instance) before spawn;
12
+ * 2. ctx0 publishes the host mount record — the world's addressability
13
+ * entry only since T-D (no webServer instance, no fence: those legs
14
+ * retired with the world pages);
13
15
  * 3. `spawnWorld` boots the sibling ROOT from the world's own nested home
14
16
  * (`<home>/agents/<key>/profiles/web` — provisioned here via
15
17
  * `provisionWorldProfile`, or by the line bootstrap when the adapter
16
18
  * package is not resolvable from this module), with the world mount
17
- * patches (no listener, virtual webServer);
18
- * 4. the world's gateway becomes a foreign target; the carrier answers
19
- * `/<key>/api` + `/<key>/api/remote.mux` in ctx0's auth domain.
19
+ * patches (no listener, no webui rows — T-D);
20
+ * 4. the world's gateway becomes a foreign target; the hub's `/hub` family
21
+ * answers `?agent=<key>` traffic in ctx0's auth domain (T-C: the
22
+ * per-label `/<key>/api` + `/<key>/api/remote.mux` mounts are retired —
23
+ * `/hub` is the sole entry).
20
24
  *
21
25
  * Cordis identifies a plugin by its module, so ONE joiner row per tree — a
22
26
  * second joined world needs either its own adapter-side plugin (omp/codex
@@ -31,19 +35,16 @@ import { join } from 'node:path';
31
35
  import { registerAgent, setReady } from './roster.js';
32
36
  import { registerForeignTarget } from './targets.js';
33
37
  import { spawnWorld } from './spawn-world.js';
34
- import { provisionWorldProfile } from './world-provision.js';
38
+ import { provisionWorldProfile, resolveInstallAnchor } from './world-provision.js';
35
39
  import { registerHostMount } from './world-host.js';
36
- import { mountWorld } from './carrier.js';
37
40
  import { worldMountPatches } from './world-mount.js';
38
41
  /** Stable Cordis plugin name. */
39
- export const name = 'aw.world.join';
40
- const ANCHOR = process.env.SUPERD_DSH_ANCHOR
41
- ?? '/home/u1/.local/lib/node_modules/@deepseek-ai/dsh/package.json';
42
+ export const name = 'superd-join';
42
43
  /** Apply the join. @param ctx - the CTX0 root context. @param config - `{ key, label? }`. */
43
44
  export function apply(ctx, config) {
44
45
  const key = typeof config?.key === 'string' ? config.key : undefined;
45
46
  if (key === undefined || key === '' || key.includes('/')) {
46
- ctx.provide('aw.world.join.error', `invalid config.key ${JSON.stringify(config?.key)}`);
47
+ ctx.provide('superd.world.join.error', `invalid config.key ${JSON.stringify(config?.key)}`);
47
48
  return;
48
49
  }
49
50
  const label = typeof config?.label === 'string' && config.label !== '' ? config.label : key;
@@ -58,58 +59,37 @@ export function apply(ctx, config) {
58
59
  const worldHome = join(root, 'agents', key);
59
60
  mkdirSync(join(worldHome, 'profiles'), { recursive: true });
60
61
  // Publish story: a foreign install has no line bootstrap, so the nested
61
- // profile + @pgmi-builds links are provisioned HERE (idempotent; dev lines
62
- // keep parity — smoke.mjs wrote the same layout, and AW_BARE_BASE still
63
- // overrides the resolved base).
64
- const bareBase = provisionWorldProfile({
62
+ // profile + @pgmi-builds links are provisioned HERE (idempotent).
63
+ provisionWorldProfile({
65
64
  key,
66
- adapterPkg: '@pgmi-builds/agent-adapter-claude',
65
+ adapterPkg: '@pgmi-builds/agent-claude',
67
66
  worldHome,
68
67
  });
69
68
  const world = (async () => {
70
- // Wait for ctx0's listening stack: the mount needs the real webServer and
71
- // the browser-trust fence from the live connection service.
72
- const host = await new Promise((resolve) => {
73
- ctx.inject(['webServer', 'connection'], (hostCtx) => { resolve(hostCtx); });
74
- });
75
- const real = host['webServer'];
76
- const connection = host['connection'];
77
- const dropHostMount = registerHostMount({
78
- key,
79
- labelPath: `/${key}`,
80
- real,
81
- // ctx0's index gate, applied by the mount to this world's pages and
82
- // assets: the world is reached in-ctx and owns no listener, so ctx0
83
- // decides auth (one auth domain).
84
- authorize: (req, res) => connection.authorizeIndex(req, res),
85
- });
69
+ // T-D: the mount record is addressability only — no ctx0 listening-stack
70
+ // wait, no webServer instance, no authorize leg (the /hub family wires
71
+ // its own gate in ctx0, see gateway.ts).
72
+ const dropHostMount = registerHostMount({ key, labelPath: `/${key}` });
86
73
  const ctxW = await spawnWorld({
87
- appName: `aw-${key}`,
74
+ appName: `superd-${key}`,
88
75
  profileName: 'web',
89
- installAnchor: ANCHOR,
76
+ installAnchor: resolveInstallAnchor(ctx), // lazy: never at module scope — import must stay side-effect-free
90
77
  home: worldHome,
91
78
  dataHome: worldHome,
92
- // Adapter-local bundle names resolve from the profile's own
93
- // node_modules (heal owns @deepseek-ai there; @pgmi-builds links are
94
- // provisioned by provisionWorldProfile above, or by the line bootstrap
95
- // when the adapter package was not resolvable — env wins over both).
96
- bareModuleBaseUrl: process.env.AW_BARE_BASE ?? bareBase ?? undefined,
79
+ // The host's live table carries this world: spawnWorld republishes a
80
+ // widened successor before boot imports anything (spec §2.1), and
81
+ // @pgmi-builds rows resolve from the profile-local links written above.
82
+ host: ctx,
97
83
  extraPatches: worldMountPatches(key),
98
84
  });
99
85
  const gateway = ctxW.get('typertGateway');
100
86
  registerForeignTarget({ key, gateway });
101
- const mounted = mountWorld({
102
- real,
103
- label: key,
104
- gateway,
105
- requestRejection: (request) => connection
106
- .requestRejection(request),
107
- });
87
+ // T-C: no per-label mount anymore — the gateway above is the world's
88
+ // whole ingress, reached through the /hub family's `?agent=<key>` demux.
108
89
  setReady(key, true);
109
90
  ctx.effect?.(() => () => {
110
- mounted.dispose();
111
91
  dropHostMount();
112
- }, `aw.world.join: ${key} mount`);
92
+ }, `superd-join: ${key} mount`);
113
93
  return ctxW;
114
94
  })().catch((cause) => {
115
95
  // A failed world degrades to a not-ready roster row; a rejected provided
@@ -117,6 +97,6 @@ export function apply(ctx, config) {
117
97
  console.error(`[super-dsh] ${key} world failed:`, cause);
118
98
  return null;
119
99
  });
120
- ctx.provide(`aw.world.${key}`, world);
100
+ ctx.provide(`superd.world.${key}`, world);
121
101
  }
122
102
  export default apply;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * World composition patches for the mount (AW-B DL1/DL3 → path-separation T-D).
3
+ *
4
+ * A mounted world is a PURE DATA PLANE: no listener (it never had a socket)
5
+ * and since T-D no webui composition either ("disable their webui build, just
6
+ * like disable their webserver" — 2026-09-26 user ruling). The rows that gave
7
+ * the world tree its own web surface are DISABLED here:
8
+ *
9
+ * 1. `webserver` disabled — the world owns no socket; ctx0's listener is
10
+ * the only ingress (pre-T-D posture, kept).
11
+ * 2. `hmr` disabled — a world's composition is a spawn-time fact;
12
+ * the profile-hmr reload chain must never arm.
13
+ * 3. `web-runtime` disabled — the web-app glue row: it mounted the
14
+ * frontend-static fallback owner over the
15
+ * virtual server, printed the URL line, opened
16
+ * the browser, and registered the web-surface
17
+ * prompt section. Its ONE data-plane leg — the
18
+ * `webRuntime` values the `connection` row
19
+ * injects — moved into the world mount row
20
+ * (neutral facts, see `world-entry.ts`).
21
+ * 4. `client-hmr` disabled — the client-plugin reload chain; nothing ever
22
+ * loads a world page to reload.
23
+ * 5. `modules` still waits — the client-modules row (and any other row
24
+ * that injects `webServer`) binds against the
25
+ * VIRTUAL per-world server the mount row
26
+ * provides; the virtual server swallows every
27
+ * registration (T-C), so the tree boots
28
+ * unchanged while nothing is ever served.
29
+ * 6. insert the world rows — the mount row (virtual `webServer` + neutral
30
+ * `webRuntime` provider) and the HUB row (the
31
+ * `/api/agent-runtime` face /hub can reach
32
+ * through the world's own data plane). The
33
+ * world page-trust row is GONE (T-D): its only
34
+ * consumer was the world page.
35
+ * Patch layers are plain data: the patch engine applies arbitrary entry
36
+ * overrides (`vendor/include/src/index.ts:77-121`).
37
+ */
38
+ /** Id of the inserted world-mount row. */
39
+ export declare const WORLD_MOUNT_ROW_ID = "superd-world-mount";
40
+ /** Plugin name providing the world's virtual webServer. */
41
+ export declare const WORLD_MOUNT_PLUGIN = "@pgmi-builds/superd-hub/world";
42
+ /** Id of the inserted hub row (the same plugin ctx0 itself composes). */
43
+ export declare const WORLD_HUB_ROW_ID = "superd-hub";
44
+ /** Plugin name of the hub itself — one UI, one roster, every runtime. */
45
+ export declare const WORLD_HUB_PLUGIN = "@pgmi-builds/superd-hub";
46
+ /**
47
+ * Parse the deploy-level trusted-authority list the world's connection fence
48
+ * was seeded with (`SUPERD_TRUSTED_HOSTS`, whitespace/comma separated) — the
49
+ * same values `spawnWorld` feeds the world tree as `--trusted-host` extras.
50
+ * Shared so the fence facts keep a single derivation.
51
+ */
52
+ export declare function superdTrustedHosts(value: string | undefined): string[];
53
+ /** One patch layer understood by the loader (structural; no app-boot import). */
54
+ export type WorldPatchLayer = {
55
+ id: string;
56
+ disabled?: boolean;
57
+ inject?: readonly string[];
58
+ config?: Record<string, unknown>;
59
+ } | {
60
+ insert: ReadonlyArray<{
61
+ id: string;
62
+ name: string;
63
+ config?: Record<string, unknown>;
64
+ }>;
65
+ };
66
+ /**
67
+ * The layers that turn a listener-owning world into a mounted, webui-less
68
+ * data plane:
69
+ *
70
+ * 1. `webserver` off — the world owns no socket (the hub serves its face);
71
+ * 2. `hmr` off — the composition is a spawn-time fact;
72
+ * 3. `web-runtime` off — no frontend-static mount, no URL line, no browser
73
+ * handoff, no web-surface prompt (T-D; its `webRuntime` provider moved
74
+ * into the mount row);
75
+ * 4. `client-hmr` off — no client reload chain (T-D);
76
+ * 5. `modules` waits for the virtual `webServer` the mount row provides;
77
+ * 6. the world rows: the mount (virtual `webServer` + neutral `webRuntime`)
78
+ * and the hub (`/api/agent-runtime` face on the world's data plane).
79
+ * @param key - runtime key (`omp`, `codex`, …) — the mount label.
80
+ * @returns patch layers to append to the world's composition.
81
+ */
82
+ export declare function worldMountPatches(key: string): readonly WorldPatchLayer[];
@@ -0,0 +1,105 @@
1
+ /**
2
+ * World composition patches for the mount (AW-B DL1/DL3 → path-separation T-D).
3
+ *
4
+ * A mounted world is a PURE DATA PLANE: no listener (it never had a socket)
5
+ * and since T-D no webui composition either ("disable their webui build, just
6
+ * like disable their webserver" — 2026-09-26 user ruling). The rows that gave
7
+ * the world tree its own web surface are DISABLED here:
8
+ *
9
+ * 1. `webserver` disabled — the world owns no socket; ctx0's listener is
10
+ * the only ingress (pre-T-D posture, kept).
11
+ * 2. `hmr` disabled — a world's composition is a spawn-time fact;
12
+ * the profile-hmr reload chain must never arm.
13
+ * 3. `web-runtime` disabled — the web-app glue row: it mounted the
14
+ * frontend-static fallback owner over the
15
+ * virtual server, printed the URL line, opened
16
+ * the browser, and registered the web-surface
17
+ * prompt section. Its ONE data-plane leg — the
18
+ * `webRuntime` values the `connection` row
19
+ * injects — moved into the world mount row
20
+ * (neutral facts, see `world-entry.ts`).
21
+ * 4. `client-hmr` disabled — the client-plugin reload chain; nothing ever
22
+ * loads a world page to reload.
23
+ * 5. `modules` still waits — the client-modules row (and any other row
24
+ * that injects `webServer`) binds against the
25
+ * VIRTUAL per-world server the mount row
26
+ * provides; the virtual server swallows every
27
+ * registration (T-C), so the tree boots
28
+ * unchanged while nothing is ever served.
29
+ * 6. insert the world rows — the mount row (virtual `webServer` + neutral
30
+ * `webRuntime` provider) and the HUB row (the
31
+ * `/api/agent-runtime` face /hub can reach
32
+ * through the world's own data plane). The
33
+ * world page-trust row is GONE (T-D): its only
34
+ * consumer was the world page.
35
+ * Patch layers are plain data: the patch engine applies arbitrary entry
36
+ * overrides (`vendor/include/src/index.ts:77-121`).
37
+ */
38
+ /** Id of the inserted world-mount row. */
39
+ export const WORLD_MOUNT_ROW_ID = 'superd-world-mount';
40
+ /** Plugin name providing the world's virtual webServer. */
41
+ export const WORLD_MOUNT_PLUGIN = '@pgmi-builds/superd-hub/world';
42
+ /** Id of the inserted hub row (the same plugin ctx0 itself composes). */
43
+ export const WORLD_HUB_ROW_ID = 'superd-hub';
44
+ /** Plugin name of the hub itself — one UI, one roster, every runtime. */
45
+ export const WORLD_HUB_PLUGIN = '@pgmi-builds/superd-hub';
46
+ /**
47
+ * Parse the deploy-level trusted-authority list the world's connection fence
48
+ * was seeded with (`SUPERD_TRUSTED_HOSTS`, whitespace/comma separated) — the
49
+ * same values `spawnWorld` feeds the world tree as `--trusted-host` extras.
50
+ * Shared so the fence facts keep a single derivation.
51
+ */
52
+ export function superdTrustedHosts(value) {
53
+ return (value ?? '').split(/[\s,]+/).filter(Boolean);
54
+ }
55
+ /**
56
+ * The layers that turn a listener-owning world into a mounted, webui-less
57
+ * data plane:
58
+ *
59
+ * 1. `webserver` off — the world owns no socket (the hub serves its face);
60
+ * 2. `hmr` off — the composition is a spawn-time fact;
61
+ * 3. `web-runtime` off — no frontend-static mount, no URL line, no browser
62
+ * handoff, no web-surface prompt (T-D; its `webRuntime` provider moved
63
+ * into the mount row);
64
+ * 4. `client-hmr` off — no client reload chain (T-D);
65
+ * 5. `modules` waits for the virtual `webServer` the mount row provides;
66
+ * 6. the world rows: the mount (virtual `webServer` + neutral `webRuntime`)
67
+ * and the hub (`/api/agent-runtime` face on the world's data plane).
68
+ * @param key - runtime key (`omp`, `codex`, …) — the mount label.
69
+ * @returns patch layers to append to the world's composition.
70
+ */
71
+ export function worldMountPatches(key) {
72
+ if (typeof key !== 'string' || key === '' || key.includes('/')) {
73
+ throw new Error(`world-mount: invalid key ${JSON.stringify(key)}`);
74
+ }
75
+ return [
76
+ // 0.1.7 belt-and-braces: the composition provably carries `disabled: true`
77
+ // (SUPERD_TRACE dump), yet the live world audit still saw the row activate
78
+ // and bind the default 3080 — so pin the config to an EPHEMERAL loopback
79
+ // port too (the audited AW fixture shape: loopback-only, never
80
+ // user-facing). Honored disables bind nothing; ignored disables bind a
81
+ // throwaway socket instead of colliding with a real deployment port.
82
+ { id: 'webserver', disabled: true, config: { host: '127.0.0.1', port: 0 } },
83
+ // 0.1.7: with a profileContext provided (settings requires it), the base
84
+ // hmr row ENABLES itself in world trees (`disabled: !!js
85
+ // !ctx.get('profileContext')`) and its config reload then recomposes the
86
+ // tree from the profile layers alone — DROPPING the spawn-time
87
+ // worldMountPatches (webserver re-enabled on 3080, world rows gone).
88
+ // Worlds must stay hmr-less: their composition is a spawn-time fact.
89
+ { id: 'hmr', disabled: true },
90
+ // T-D (2026-09-26): the world webui rows off. The `web-runtime` row is the
91
+ // web-app glue that mounted frontend-static over the virtual server and
92
+ // announced a URL nobody can reach (`/hub` is the sole entry); the world
93
+ // keeps only its data plane. Its `webRuntime` provider — the ONE
94
+ // data-plane leg (the `connection` row injects it) — is re-provided by the
95
+ // mount row with the same neutral facts (loopback bind ⇒ no LAN
96
+ // literals; the deploy-level trusted-host extras ride along).
97
+ { id: 'web-runtime', disabled: true },
98
+ { id: 'client-hmr', disabled: true },
99
+ { id: 'modules', inject: ['webServer'] },
100
+ { insert: [
101
+ { id: WORLD_MOUNT_ROW_ID, name: WORLD_MOUNT_PLUGIN, config: { key } },
102
+ { id: WORLD_HUB_ROW_ID, name: WORLD_HUB_PLUGIN },
103
+ ] },
104
+ ];
105
+ }
@@ -4,20 +4,26 @@
4
4
  * Upstream's `RemoteStreamMuxServer` owns `/api/remote.mux` for the native
5
5
  * gateway and is NOT reachable from outside its package (root exports omit it;
6
6
  * `./src/*` cannot be imported at runtime). So this is our own wire-compatible
7
- * implementation of the same protocol, bound to the ADDRESSED world's
8
- * `openWireStream`:
7
+ * implementation of the same protocol (dsh 0.1.7 `stream-protocol.ts`), bound
8
+ * to the ADDRESSED world's `openWireStream`:
9
9
  *
10
10
  * browser → server { type:'open', streamId, endpoint, payload }
11
+ * { type:'item', streamId, value? } (uplink)
12
+ * { type:'end', streamId } (uplink half-close)
11
13
  * { type:'cancel', streamId }
12
14
  * server → browser { type:'item', streamId, value }
13
15
  * { type:'end', streamId }
14
16
  * { type:'error', streamId, error:{code,message,details} }
15
17
  *
16
- * Heartbeat: ping every interval, terminate after two missed pongs (same
17
- * policy as upstream).
18
+ * Dispatch semantics mirror upstream `RemoteStreamMuxConnection`: `item`,
19
+ * `end`, and `cancel` for a stream this connection no longer owns are dropped;
20
+ * a duplicate `open` is the one violation that closes the socket. Uplink items
21
+ * wait in a bounded inbox created before the opener resolves, so items sent
22
+ * right after `open` are never lost. Heartbeat: ping every interval, terminate
23
+ * after two missed pongs.
18
24
  */
19
25
  /** Open one world stream (the world gateway's `openWireStream`). */
20
- export type MuxOpen = (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<AsyncIterable<unknown>>;
26
+ export type MuxOpen = (endpoint: string, payload: unknown, uplink: AsyncIterable<unknown>, control: AbortController) => Promise<AsyncIterable<unknown>> | AsyncIterable<unknown>;
21
27
  /** Wire failure body (upstream `RemoteStreamFailure`). */
22
28
  export interface MuxFailure {
23
29
  code: string;
@@ -26,8 +32,10 @@ export interface MuxFailure {
26
32
  }
27
33
  /** Options. */
28
34
  export interface WorldMuxOptions {
29
- /** Ping interval; upstream default is 30s. */
35
+ /** Ping interval; upstream default is 2s. */
30
36
  heartbeatIntervalMs?: number;
37
+ /** Buffered uplink frame bytes one logical stream may hold before it fails; upstream default 256KiB. */
38
+ streamInboxBytes?: number;
31
39
  /** Error → wire failure mapper. */
32
40
  failure?: (error: unknown) => MuxFailure;
33
41
  }
@@ -37,6 +45,13 @@ type ClientMessage = {
37
45
  streamId: string;
38
46
  endpoint: string;
39
47
  payload: unknown;
48
+ } | {
49
+ type: 'item';
50
+ streamId: string;
51
+ value?: unknown;
52
+ } | {
53
+ type: 'end';
54
+ streamId: string;
40
55
  } | {
41
56
  type: 'cancel';
42
57
  streamId: string;