super-dsh 0.1.2 → 0.1.3

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,242 @@
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; } });
package/cordis.patch.yml CHANGED
@@ -16,8 +16,11 @@
16
16
  # Profile-layer values (webserver port/host, settings path) stay in the USER's
17
17
  # profile patch layer, never here.
18
18
  - insert:
19
+ # BARE package row: subpath rows (…/world/omp) are permanently not client
20
+ # rows in client-modules' scan (exactPackageSpecifier), so THIS row is
21
+ # what registers the package's client half — the sidebar selector.
19
22
  - id: agent-hub
20
- name: 'super-dsh/hub'
23
+ name: 'super-dsh'
21
24
  - id: aw-agent-adapter-omp
22
25
  name: 'super-dsh/world/omp'
23
26
  - id: aw-agent-adapter-codex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-dsh",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Agent Worlds for the DeepSeek Harness (DSH) — one dsh plugin that mounts the agent hub (runtime selector, roster, per-runtime worlds) and joins local foreign-agent runtimes (OMP, Codex, Claude, Pi, Hermes, Antigravity) into the DSH Web UI. Each runtime keeps its native home and session store; the hub only bridges.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,6 +9,7 @@
9
9
  "url": "git+https://github.com/pgmi-builds/superd.git"
10
10
  },
11
11
  "exports": {
12
+ ".": "./agent-hub/dist/index.js",
12
13
  "./hub": "./agent-hub/dist/index.js",
13
14
  "./join": "./agent-hub/dist/world-join.js",
14
15
  "./world/omp": "./agent-omp/dist/world-plugin.js",
@@ -17,12 +18,13 @@
17
18
  "./world/pi": "./agent-pi/dist/world-plugin.js",
18
19
  "./world/hermes": "./agent-hermes/dist/world-plugin.js",
19
20
  "./world/agy": "./agent-agy/dist/world-plugin.js",
20
- "./client": "./agent-hub/lib/client/index.js",
21
+ "./client": "./client/index.js",
21
22
  "./cordis.patch.yml": "./cordis.patch.yml",
22
23
  "./package.json": "./package.json"
23
24
  },
24
25
  "files": [
25
26
  "cordis.patch.yml",
27
+ "client",
26
28
  "README.md",
27
29
  "agent-hub/dist",
28
30
  "agent-hub/lib",