super-dsh 0.1.3 → 0.1.4

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 (115) hide show
  1. package/README.md +9 -8
  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 +16 -21
  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 +15 -20
  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 +16 -21
  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 +22 -19
  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 +16 -21
  62. package/agent-pi/package.json +14 -11
  63. package/cordis.patch.yml +31 -21
  64. package/package.json +30 -38
  65. package/{agent-hub → superd-hub}/cordis.patch.yml +3 -3
  66. package/{agent-hub → superd-hub}/dist/carrier.d.ts +9 -3
  67. package/{agent-hub → superd-hub}/dist/carrier.js +29 -3
  68. package/{agent-hub → superd-hub}/dist/gateway.d.ts +2 -2
  69. package/{agent-hub → superd-hub}/dist/gateway.js +1 -1
  70. package/{agent-hub → superd-hub}/dist/index.d.ts +5 -3
  71. package/{agent-hub → superd-hub}/dist/index.js +5 -3
  72. package/{agent-hub → superd-hub}/dist/roster.d.ts +2 -2
  73. package/{agent-hub → superd-hub}/dist/rpc.js +1 -1
  74. package/{agent-hub → superd-hub}/dist/spawn-world.d.ts +27 -6
  75. package/superd-hub/dist/spawn-world.js +277 -0
  76. package/superd-hub/dist/system-head.d.ts +69 -0
  77. package/superd-hub/dist/system-head.js +194 -0
  78. package/superd-hub/dist/web-trust.d.ts +112 -0
  79. package/superd-hub/dist/web-trust.js +126 -0
  80. package/{agent-hub → superd-hub}/dist/world-entry.d.ts +2 -2
  81. package/{agent-hub → superd-hub}/dist/world-entry.js +4 -4
  82. package/{agent-hub → superd-hub}/dist/world-host.d.ts +1 -1
  83. package/{agent-hub → superd-hub}/dist/world-join.d.ts +2 -1
  84. package/{agent-hub → superd-hub}/dist/world-join.js +16 -21
  85. package/{agent-hub → superd-hub}/dist/world-mount.d.ts +14 -6
  86. package/{agent-hub → superd-hub}/dist/world-mount.js +28 -7
  87. package/{agent-hub → superd-hub}/dist/world-mux.d.ts +21 -6
  88. package/superd-hub/dist/world-mux.js +392 -0
  89. package/{agent-hub → superd-hub}/dist/world-provision.d.ts +20 -4
  90. package/superd-hub/dist/world-provision.js +196 -0
  91. package/{agent-hub → superd-hub}/dist/world-web-server.js +7 -1
  92. package/{agent-hub → superd-hub}/package.json +9 -16
  93. package/agent-hub/dist/spawn-world.js +0 -72
  94. package/agent-hub/dist/world-mux.js +0 -224
  95. package/agent-hub/dist/world-provision.js +0 -122
  96. package/agent-hub/lib/client/index.js +0 -242
  97. package/client/index.js +0 -242
  98. /package/{agent-hub → superd-hub}/dist/agent-roster.d.ts +0 -0
  99. /package/{agent-hub → superd-hub}/dist/agent-roster.js +0 -0
  100. /package/{agent-hub → superd-hub}/dist/client-shim.d.ts +0 -0
  101. /package/{agent-hub → superd-hub}/dist/client-shim.js +0 -0
  102. /package/{agent-hub → superd-hub}/dist/envelope.d.ts +0 -0
  103. /package/{agent-hub → superd-hub}/dist/envelope.js +0 -0
  104. /package/{agent-hub → superd-hub}/dist/index-pass.d.ts +0 -0
  105. /package/{agent-hub → superd-hub}/dist/index-pass.js +0 -0
  106. /package/{agent-hub → superd-hub}/dist/labels.d.ts +0 -0
  107. /package/{agent-hub → superd-hub}/dist/labels.js +0 -0
  108. /package/{agent-hub → superd-hub}/dist/ownership.d.ts +0 -0
  109. /package/{agent-hub → superd-hub}/dist/ownership.js +0 -0
  110. /package/{agent-hub → superd-hub}/dist/roster.js +0 -0
  111. /package/{agent-hub → superd-hub}/dist/rpc.d.ts +0 -0
  112. /package/{agent-hub → superd-hub}/dist/targets.d.ts +0 -0
  113. /package/{agent-hub → superd-hub}/dist/targets.js +0 -0
  114. /package/{agent-hub → superd-hub}/dist/world-host.js +0 -0
  115. /package/{agent-hub → superd-hub}/dist/world-web-server.d.ts +0 -0
@@ -1,122 +0,0 @@
1
- /**
2
- * Nested-world profile provisioning — the publish story.
3
- *
4
- * The dev line (test/smoke.mjs) hand-provisions every world's nested profile
5
- * (`<home>/agents/<label>/profiles/web`) and the `@pgmi-builds/*` links its
6
- * resolution needs. A foreign install has NO line bootstrap:
7
- *
8
- * dsh plugin --profile <name> add super-dsh
9
- *
10
- * mounts the hub + adapter world plugins into the consumer's profile, and the
11
- * spawn call sites (adapter world-plugins, hub join) must provision the same
12
- * layout THEMSELVES or every world spawn fails on a missing profile.
13
- *
14
- * This module is the library form of that bootstrap, called by all six spawn
15
- * sites. Layout invariants (super-dsh/AGENTS.md S7, smoke.mjs parity):
16
- *
17
- * - `<worldHome>/profiles/web/package.json` — bundles `[dsh-base, dsh-web-app,
18
- * adapterPkg]`; the world tree is a full sibling root, nothing shared.
19
- * - `<worldHome>/profiles/web/cordis.patch.yml` — per-world home pinning:
20
- * every home-resolving DSH plugin reads THIS tree's nested root.
21
- * - `<worldHome>/profiles/node_modules/@pgmi-builds/{adapter,hub}` — links
22
- * for the profile's bundle resolution and the inserted mount rows
23
- * (`@deepseek-ai/*` is loadProfile's heal farm, not ours).
24
- *
25
- * Link identity rule: both links point INSIDE the running line tree — the hub
26
- * at this module's own package root, the adapter at its sibling
27
- * `agent-<key>` directory — identical in the dev repo layout and inside the
28
- * published single `super-dsh` package, so ctx0 and every world root share
29
- * one hub/adapter instance with zero registry involvement.
30
- *
31
- * Returns the bare module base for `spawnWorld` (`…/profiles/node_modules/`),
32
- * or null when the adapter sibling does not exist next to the hub (a foreign
33
- * composition this module does not own — keep the caller's env/fallback path).
34
- */
35
- import { existsSync, lstatSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
36
- import { dirname, join } from 'node:path';
37
- import { fileURLToPath } from 'node:url';
38
- import { createRequire } from 'node:module';
39
- const HUB_SCOPE = '@pgmi-builds';
40
- const HARNESS_SCOPE = '@deepseek-ai';
41
- /** The profile bundles every world tree composes besides its adapter. */
42
- const WORLD_BASE_BUNDLES = ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app'];
43
- /**
44
- * Provision one world's nested profile (idempotent: rewrites profile files,
45
- * re-links packages — lstat-safe against dangling links). Returns the
46
- * `bareModuleBaseUrl` for {@link spawnWorld}, or null when unresolvable.
47
- *
48
- * Never throws: any provisioning failure is logged and returns null so the
49
- * calling world plugin degrades to a not-ready roster row instead of failing
50
- * the loader entry — a failed apply would take down the whole host boot.
51
- */
52
- export function provisionWorldProfile(opts) {
53
- try {
54
- return provisionWorldProfileUnchecked(opts);
55
- }
56
- catch (cause) {
57
- console.error(`[super-dsh] provisioning world '${opts.key}' failed:`, cause);
58
- return null;
59
- }
60
- }
61
- function provisionWorldProfileUnchecked(opts) {
62
- // Single-pack topology: this module lives at `<line>/agent-hub/dist/`, and
63
- // every adapter is a SIBLING directory (`<line>/agent-<key>`) — the same
64
- // layout in the repo (dev link: lines) and inside the published `super-dsh`
65
- // package. The adapter link therefore points at the sibling; no registry
66
- // resolution is involved anywhere.
67
- const hubRoot = dirname(dirname(fileURLToPath(import.meta.url))); // <line>/agent-hub
68
- const lineRoot = dirname(hubRoot); // monolith root / repo super-dsh/
69
- const adapterDir = join(lineRoot, `agent-${opts.key}`);
70
- if (!existsSync(join(adapterDir, 'package.json')))
71
- return null;
72
- const profileName = opts.profileName ?? 'web';
73
- const profDir = join(opts.worldHome, 'profiles', profileName);
74
- mkdirSync(profDir, { recursive: true });
75
- writeFileSync(join(profDir, 'package.json'), JSON.stringify({
76
- name: `aw-${opts.key}-world-profile`,
77
- private: true,
78
- dsh: { profile: { bundles: [...WORLD_BASE_BUNDLES, opts.adapterPkg] } },
79
- }, null, 2) + '\n');
80
- // Per-world home pinning (smoke.mjs parity): settings, credentials,
81
- // attachments, shell env and skills all land inside `agents/<key>/`.
82
- // (`agent-instructions` keeps its base `maxBytes` home — instruction
83
- // discovery root, not agent data.)
84
- writeFileSync(join(profDir, 'cordis.patch.yml'), [
85
- '# Per-world home pinning (dshHomePath is this tree\'s nested home).',
86
- ...['settings', 'credentials', 'attachment-local', 'shell-env', 'skill-filesystem'].flatMap((id) => [`- id: ${id}`, ' config:', ' dshHome: !!js dshHomePath()']),
87
- '',
88
- ].join('\n'));
89
- // @pgmi-builds links for the world tree's bare-name resolution (profile
90
- // bundles + the inserted mount rows). Dangling links first (lstat:
91
- // existsSync is false for them, which skipped rmSync and crashed
92
- // symlinkSync with EEXIST after repo moves).
93
- const linkRoot = join(opts.worldHome, 'profiles', 'node_modules');
94
- mkdirSync(join(linkRoot, HUB_SCOPE), { recursive: true });
95
- const links = [
96
- [opts.adapterPkg.slice(HUB_SCOPE.length + 1), adapterDir],
97
- ['agent-hub', hubRoot],
98
- ];
99
- for (const [name, target] of links) {
100
- const dst = join(linkRoot, HUB_SCOPE, name);
101
- const st = lstatSync(dst, { throwIfNoEntry: false });
102
- if (st)
103
- rmSync(dst, { recursive: true, force: true });
104
- symlinkSync(target, dst);
105
- }
106
- // The harness scope rides along as ONE scope-level link into the first
107
- // `@deepseek-ai` directory visible from this module (the shared heal farm
108
- // in a dsh home, the repo farm in dev) — every `@deepseek-ai/*` row of the
109
- // world composition resolves through it without farming per package.
110
- for (const searchPath of createRequire(import.meta.url).resolve.paths(`${HARNESS_SCOPE}/x`) ?? []) {
111
- const scopeDir = join(searchPath, HARNESS_SCOPE);
112
- if (!existsSync(scopeDir))
113
- continue;
114
- const dst = join(linkRoot, HARNESS_SCOPE);
115
- const st = lstatSync(dst, { throwIfNoEntry: false });
116
- if (st)
117
- rmSync(dst, { recursive: true, force: true });
118
- symlinkSync(scopeDir, dst);
119
- break;
120
- }
121
- return join(opts.worldHome, 'profiles', 'node_modules') + '/';
122
- }
@@ -1,242 +0,0 @@
1
- window.__ModuleLoader__.load({ id: "@pgmi-builds/agent-hub", factory: (require) => {
2
- var module = { exports: {} }; var exports = module.exports;
3
- //#region rolldown:runtime
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
- value: mod,
22
- enumerable: true
23
- }) : target, mod));
24
-
25
- //#endregion
26
- let react = require("react");
27
- react = __toESM(react);
28
- let react_jsx_runtime = require("react/jsx-runtime");
29
- react_jsx_runtime = __toESM(react_jsx_runtime);
30
-
31
- //#region src/client/RuntimeSeat.tsx
32
- const NATIVE = {
33
- key: "native",
34
- label: "DSH",
35
- path: "/"
36
- };
37
- /** Fallback labels for the read-only face (which only reports keys). */
38
- const RUNTIME_LABELS = {
39
- native: "DSH",
40
- omp: "OMP",
41
- codex: "Codex"
42
- };
43
- function fromGlobal() {
44
- const agents = globalThis.__DSH_AGENT_ROSTER__?.agents;
45
- if (!Array.isArray(agents)) return void 0;
46
- const links = [];
47
- for (const entry of agents) {
48
- if (typeof entry !== "object" || entry === null) continue;
49
- const { key, label, path } = entry;
50
- if (typeof key !== "string" || typeof path !== "string") continue;
51
- links.push({
52
- key,
53
- label: typeof label === "string" ? label : RUNTIME_LABELS[key] ?? key,
54
- path
55
- });
56
- }
57
- return links.length > 0 ? links : void 0;
58
- }
59
- /** Normalize the current mount root: `/omp` and `/omp/` are the same page. */
60
- function currentPath() {
61
- const pathname = typeof location === "undefined" ? "/" : location.pathname;
62
- if (pathname === "" || pathname === "/") return "/";
63
- return pathname.endsWith("/") ? pathname : `${pathname}/`;
64
- }
65
- function RuntimeSeat({ wide }) {
66
- const [agents, setAgents] = react.useState(() => fromGlobal() ?? [NATIVE]);
67
- const [open, setOpen] = react.useState(false);
68
- const rootRef = react.useRef(null);
69
- react.useEffect(() => {
70
- let cancelled = false;
71
- fetch("/api/agent-runtime", { credentials: "same-origin" }).then((r) => r.ok ? r.json() : Promise.reject(/* @__PURE__ */ new Error(`HTTP ${r.status}`))).then((j) => {
72
- if (cancelled) return;
73
- if (Array.isArray(j?.agents)) {
74
- const listed = [];
75
- for (const entry of j.agents) {
76
- if (typeof entry !== "object" || entry === null) continue;
77
- const { key, label, path } = entry;
78
- if (typeof key !== "string" || typeof path !== "string") continue;
79
- listed.push({
80
- key,
81
- label: typeof label === "string" ? label : RUNTIME_LABELS[key] ?? key,
82
- path
83
- });
84
- }
85
- if (listed.length > 0) {
86
- setAgents(listed);
87
- return;
88
- }
89
- }
90
- if (!Array.isArray(j?.available)) return;
91
- const links = [];
92
- for (const key of j.available) {
93
- if (typeof key !== "string") continue;
94
- links.push(key === "native" ? NATIVE : {
95
- key,
96
- label: RUNTIME_LABELS[key] ?? key,
97
- path: `/${key}/`
98
- });
99
- }
100
- if (links.length > 0) setAgents(links);
101
- }).catch(() => {});
102
- return () => {
103
- cancelled = true;
104
- };
105
- }, []);
106
- react.useEffect(() => {
107
- if (!open) return;
108
- const onDown = (event) => {
109
- if (rootRef.current !== null && !rootRef.current.contains(event.target)) setOpen(false);
110
- };
111
- document.addEventListener("mousedown", onDown);
112
- return () => document.removeEventListener("mousedown", onDown);
113
- }, [open]);
114
- const here = currentPath();
115
- const active = agents.find((agent) => agent.path === here) ?? NATIVE;
116
- const styleBase = {
117
- display: "flex",
118
- alignItems: "center",
119
- gap: 8,
120
- width: "100%",
121
- padding: wide ? "7px 10px" : "7px 0",
122
- justifyContent: wide ? "flex-start" : "center",
123
- border: "none",
124
- borderRadius: 8,
125
- background: "transparent",
126
- color: "inherit",
127
- font: "inherit",
128
- fontSize: 13,
129
- cursor: "pointer",
130
- position: "relative"
131
- };
132
- const styleBadge = {
133
- fontSize: 10,
134
- lineHeight: 1.4,
135
- padding: "1px 6px",
136
- borderRadius: 999,
137
- background: "color-mix(in srgb, currentColor 12%, transparent)",
138
- whiteSpace: "nowrap"
139
- };
140
- const styleMenu = {
141
- position: "absolute",
142
- bottom: "calc(100% + 6px)",
143
- left: 6,
144
- right: 6,
145
- zIndex: 40,
146
- background: "var(--dsh-surface, #26262b)",
147
- border: "1px solid color-mix(in srgb, currentColor 18%, transparent)",
148
- borderRadius: 10,
149
- boxShadow: "0 8px 24px rgba(0,0,0,.35)",
150
- overflow: "hidden"
151
- };
152
- const styleItem = (isActive) => ({
153
- display: "block",
154
- width: "100%",
155
- padding: "8px 12px",
156
- border: "none",
157
- background: isActive ? "color-mix(in srgb, currentColor 10%, transparent)" : "transparent",
158
- color: "inherit",
159
- font: "inherit",
160
- fontSize: 13,
161
- textAlign: "left",
162
- cursor: "pointer"
163
- });
164
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
165
- ref: rootRef,
166
- style: {
167
- position: "relative",
168
- width: "100%"
169
- },
170
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
171
- type: "button",
172
- style: styleBase,
173
- title: "Agent runtime — picking one opens that runtime's mount (/omp/, /codex/, …)",
174
- onClick: () => {
175
- setOpen((v) => !v);
176
- },
177
- children: wide ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
178
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
179
- "aria-hidden": true,
180
- children: "⌘"
181
- }),
182
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
183
- style: {
184
- flex: 1,
185
- textAlign: "left",
186
- whiteSpace: "nowrap",
187
- overflow: "hidden",
188
- textOverflow: "ellipsis"
189
- },
190
- children: ["Agent · ", active.label]
191
- }),
192
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
193
- style: styleBadge,
194
- children: "open"
195
- })
196
- ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
197
- "aria-hidden": true,
198
- children: "⌘"
199
- })
200
- }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
201
- style: styleMenu,
202
- children: agents.map((agent) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
203
- href: agent.path,
204
- style: {
205
- ...styleItem(agent.path === here),
206
- textDecoration: "none"
207
- },
208
- "aria-current": agent.path === here ? "page" : void 0,
209
- onClick: () => {
210
- setOpen(false);
211
- },
212
- children: agent.path === here ? `${agent.label} ✓` : agent.label
213
- }, agent.key))
214
- })]
215
- });
216
- }
217
-
218
- //#endregion
219
- //#region src/client/index.ts
220
- /** Required services (cordis fiber inject): the slot registry. */
221
- const inject = ["slots"];
222
- /**
223
- * Mount the selector. Degrades silently when the slot service is absent (a
224
- * composition without the sidebar renders nothing — a footer action is an
225
- * optional occupant by contract).
226
- *
227
- * @param ctx - client root context.
228
- */
229
- function apply(ctx) {
230
- ctx.inject(["slots"], (raw) => {
231
- const scope = raw;
232
- scope.effect(() => scope.slots.inject("sidebar.footer.action", () => scope.slots.register({
233
- name: "sidebar.footer.action",
234
- id: "agent-runtime"
235
- }, RuntimeSeat)), "agent-hub: runtime footer action");
236
- });
237
- }
238
-
239
- //#endregion
240
- exports.apply = apply;
241
- exports.inject = inject;
242
- return module.exports; } });
package/client/index.js DELETED
@@ -1,242 +0,0 @@
1
- window.__ModuleLoader__.load({ id: "super-dsh", factory: (require) => {
2
- var module = { exports: {} }; var exports = module.exports;
3
- //#region rolldown:runtime
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
- value: mod,
22
- enumerable: true
23
- }) : target, mod));
24
-
25
- //#endregion
26
- let react = require("react");
27
- react = __toESM(react);
28
- let react_jsx_runtime = require("react/jsx-runtime");
29
- react_jsx_runtime = __toESM(react_jsx_runtime);
30
-
31
- //#region src/client/RuntimeSeat.tsx
32
- const NATIVE = {
33
- key: "native",
34
- label: "DSH",
35
- path: "/"
36
- };
37
- /** Fallback labels for the read-only face (which only reports keys). */
38
- const RUNTIME_LABELS = {
39
- native: "DSH",
40
- omp: "OMP",
41
- codex: "Codex"
42
- };
43
- function fromGlobal() {
44
- const agents = globalThis.__DSH_AGENT_ROSTER__?.agents;
45
- if (!Array.isArray(agents)) return void 0;
46
- const links = [];
47
- for (const entry of agents) {
48
- if (typeof entry !== "object" || entry === null) continue;
49
- const { key, label, path } = entry;
50
- if (typeof key !== "string" || typeof path !== "string") continue;
51
- links.push({
52
- key,
53
- label: typeof label === "string" ? label : RUNTIME_LABELS[key] ?? key,
54
- path
55
- });
56
- }
57
- return links.length > 0 ? links : void 0;
58
- }
59
- /** Normalize the current mount root: `/omp` and `/omp/` are the same page. */
60
- function currentPath() {
61
- const pathname = typeof location === "undefined" ? "/" : location.pathname;
62
- if (pathname === "" || pathname === "/") return "/";
63
- return pathname.endsWith("/") ? pathname : `${pathname}/`;
64
- }
65
- function RuntimeSeat({ wide }) {
66
- const [agents, setAgents] = react.useState(() => fromGlobal() ?? [NATIVE]);
67
- const [open, setOpen] = react.useState(false);
68
- const rootRef = react.useRef(null);
69
- react.useEffect(() => {
70
- let cancelled = false;
71
- fetch("/api/agent-runtime", { credentials: "same-origin" }).then((r) => r.ok ? r.json() : Promise.reject(/* @__PURE__ */ new Error(`HTTP ${r.status}`))).then((j) => {
72
- if (cancelled) return;
73
- if (Array.isArray(j?.agents)) {
74
- const listed = [];
75
- for (const entry of j.agents) {
76
- if (typeof entry !== "object" || entry === null) continue;
77
- const { key, label, path } = entry;
78
- if (typeof key !== "string" || typeof path !== "string") continue;
79
- listed.push({
80
- key,
81
- label: typeof label === "string" ? label : RUNTIME_LABELS[key] ?? key,
82
- path
83
- });
84
- }
85
- if (listed.length > 0) {
86
- setAgents(listed);
87
- return;
88
- }
89
- }
90
- if (!Array.isArray(j?.available)) return;
91
- const links = [];
92
- for (const key of j.available) {
93
- if (typeof key !== "string") continue;
94
- links.push(key === "native" ? NATIVE : {
95
- key,
96
- label: RUNTIME_LABELS[key] ?? key,
97
- path: `/${key}/`
98
- });
99
- }
100
- if (links.length > 0) setAgents(links);
101
- }).catch(() => {});
102
- return () => {
103
- cancelled = true;
104
- };
105
- }, []);
106
- react.useEffect(() => {
107
- if (!open) return;
108
- const onDown = (event) => {
109
- if (rootRef.current !== null && !rootRef.current.contains(event.target)) setOpen(false);
110
- };
111
- document.addEventListener("mousedown", onDown);
112
- return () => document.removeEventListener("mousedown", onDown);
113
- }, [open]);
114
- const here = currentPath();
115
- const active = agents.find((agent) => agent.path === here) ?? NATIVE;
116
- const styleBase = {
117
- display: "flex",
118
- alignItems: "center",
119
- gap: 8,
120
- width: "100%",
121
- padding: wide ? "7px 10px" : "7px 0",
122
- justifyContent: wide ? "flex-start" : "center",
123
- border: "none",
124
- borderRadius: 8,
125
- background: "transparent",
126
- color: "inherit",
127
- font: "inherit",
128
- fontSize: 13,
129
- cursor: "pointer",
130
- position: "relative"
131
- };
132
- const styleBadge = {
133
- fontSize: 10,
134
- lineHeight: 1.4,
135
- padding: "1px 6px",
136
- borderRadius: 999,
137
- background: "color-mix(in srgb, currentColor 12%, transparent)",
138
- whiteSpace: "nowrap"
139
- };
140
- const styleMenu = {
141
- position: "absolute",
142
- bottom: "calc(100% + 6px)",
143
- left: 6,
144
- right: 6,
145
- zIndex: 40,
146
- background: "var(--dsh-surface, #26262b)",
147
- border: "1px solid color-mix(in srgb, currentColor 18%, transparent)",
148
- borderRadius: 10,
149
- boxShadow: "0 8px 24px rgba(0,0,0,.35)",
150
- overflow: "hidden"
151
- };
152
- const styleItem = (isActive) => ({
153
- display: "block",
154
- width: "100%",
155
- padding: "8px 12px",
156
- border: "none",
157
- background: isActive ? "color-mix(in srgb, currentColor 10%, transparent)" : "transparent",
158
- color: "inherit",
159
- font: "inherit",
160
- fontSize: 13,
161
- textAlign: "left",
162
- cursor: "pointer"
163
- });
164
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
165
- ref: rootRef,
166
- style: {
167
- position: "relative",
168
- width: "100%"
169
- },
170
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
171
- type: "button",
172
- style: styleBase,
173
- title: "Agent runtime — picking one opens that runtime's mount (/omp/, /codex/, …)",
174
- onClick: () => {
175
- setOpen((v) => !v);
176
- },
177
- children: wide ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
178
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
179
- "aria-hidden": true,
180
- children: "⌘"
181
- }),
182
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
183
- style: {
184
- flex: 1,
185
- textAlign: "left",
186
- whiteSpace: "nowrap",
187
- overflow: "hidden",
188
- textOverflow: "ellipsis"
189
- },
190
- children: ["Agent · ", active.label]
191
- }),
192
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
193
- style: styleBadge,
194
- children: "open"
195
- })
196
- ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
197
- "aria-hidden": true,
198
- children: "⌘"
199
- })
200
- }), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
201
- style: styleMenu,
202
- children: agents.map((agent) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
203
- href: agent.path,
204
- style: {
205
- ...styleItem(agent.path === here),
206
- textDecoration: "none"
207
- },
208
- "aria-current": agent.path === here ? "page" : void 0,
209
- onClick: () => {
210
- setOpen(false);
211
- },
212
- children: agent.path === here ? `${agent.label} ✓` : agent.label
213
- }, agent.key))
214
- })]
215
- });
216
- }
217
-
218
- //#endregion
219
- //#region src/client/index.ts
220
- /** Required services (cordis fiber inject): the slot registry. */
221
- const inject = ["slots"];
222
- /**
223
- * Mount the selector. Degrades silently when the slot service is absent (a
224
- * composition without the sidebar renders nothing — a footer action is an
225
- * optional occupant by contract).
226
- *
227
- * @param ctx - client root context.
228
- */
229
- function apply(ctx) {
230
- ctx.inject(["slots"], (raw) => {
231
- const scope = raw;
232
- scope.effect(() => scope.slots.inject("sidebar.footer.action", () => scope.slots.register({
233
- name: "sidebar.footer.action",
234
- id: "agent-runtime"
235
- }, RuntimeSeat)), "agent-hub: runtime footer action");
236
- });
237
- }
238
-
239
- //#endregion
240
- exports.apply = apply;
241
- exports.inject = inject;
242
- return module.exports; } });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes