super-dsh 0.1.2 → 0.1.3-c

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.
@@ -17,6 +17,8 @@ import { basename, dirname, join, resolve } from "node:path";
17
17
  /** Prod homes that must never be resolved into (repo red line). */
18
18
  const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
19
19
  function assertNotProdHome(path, label) {
20
+ if (process.env.SUPERD_DEV_REDLINE !== "1")
21
+ return; // published install: the host dsh home (~/.dsh on consumers) is authoritative — the S3/S7 world layout lives under it. Dev lines set SUPERD_DEV_REDLINE=1 (repo red line: ~/.dsh is Dash prod).
20
22
  if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
21
23
  throw new Error(`agy-sessions: refusing prod home as ${label}: ${path}`);
22
24
  }
@@ -12,6 +12,8 @@ import { join, resolve } from "node:path";
12
12
  const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
13
13
  /** Refuse any path that resolves into a production DSH home (repo red line). */
14
14
  export function assertNotProdHome(path, label) {
15
+ if (process.env.SUPERD_DEV_REDLINE !== "1")
16
+ return; // published install: the host dsh home (~/.dsh on consumers) is authoritative — the S3/S7 world layout lives under it. Dev lines set SUPERD_DEV_REDLINE=1 (repo red line: ~/.dsh is Dash prod).
15
17
  const p = resolve(path);
16
18
  if (PROD_HOMES.includes(p) || PROD_HOMES.some((prod) => p.startsWith(`${prod}/`))) {
17
19
  throw new Error(`agent-claude: refusing prod home "${p}" for ${label} — set DSH_HOME to the test home`);
@@ -22,6 +22,8 @@ import { join, resolve } from "node:path";
22
22
  /** Prod homes that must never be resolved into (repo red line). */
23
23
  const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
24
24
  export function assertNotProdHome(path, label) {
25
+ if (process.env.SUPERD_DEV_REDLINE !== "1")
26
+ return; // published install: the host dsh home (~/.dsh on consumers) is authoritative — the S3/S7 world layout lives under it. Dev lines set SUPERD_DEV_REDLINE=1 (repo red line: ~/.dsh is Dash prod).
25
27
  if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
26
28
  throw new Error(`codex-store: refusing prod home as ${label}: ${path}`);
27
29
  }
@@ -24,6 +24,8 @@ import { basename, dirname, join, resolve } from "node:path";
24
24
  /** Prod homes that must never be resolved into (repo red line). */
25
25
  const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
26
26
  function assertNotProdHome(path, label) {
27
+ if (process.env.SUPERD_DEV_REDLINE !== "1")
28
+ return; // published install: the host dsh home (~/.dsh on consumers) is authoritative — the S3/S7 world layout lives under it. Dev lines set SUPERD_DEV_REDLINE=1 (repo red line: ~/.dsh is Dash prod).
27
29
  if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
28
30
  throw new Error(`hermes-store: refusing prod home as ${label}: ${path}`);
29
31
  }
@@ -32,10 +32,10 @@
32
32
  * or null when the adapter sibling does not exist next to the hub (a foreign
33
33
  * composition this module does not own — keep the caller's env/fallback path).
34
34
  */
35
- import { existsSync, lstatSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
35
+ import { existsSync, lstatSync, mkdirSync, readdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
36
36
  import { dirname, join } from 'node:path';
37
37
  import { fileURLToPath } from 'node:url';
38
- import { createRequire } from 'node:module';
38
+ import { resolveDshHome } from '@deepseek-ai/dsh-home-paths';
39
39
  const HUB_SCOPE = '@pgmi-builds';
40
40
  const HARNESS_SCOPE = '@deepseek-ai';
41
41
  /** The profile bundles every world tree composes besides its adapter. */
@@ -103,20 +103,33 @@ function provisionWorldProfileUnchecked(opts) {
103
103
  rmSync(dst, { recursive: true, force: true });
104
104
  symlinkSync(target, dst);
105
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))
106
+ // The harness scope for the world tree is a REAL scope directory of
107
+ // per-package symlinks UNIONED from two authoritative sources (farm first,
108
+ // installation fills the gaps dev3 evidence: farm 244 entries missing 16
109
+ // newer packages the install's 260 has; ctx0 survives via the app-boot
110
+ // install-anchored resolver fallback, but a tree with an explicit bare
111
+ // base gets no such fallback). A single scope-level link cannot express
112
+ // that union, and a resolve.paths() walk from this module can pick the
113
+ // PROFILE's own partial pnpm scope (2 entries on dev3) — never use it.
114
+ const ANCHOR = process.env.SUPERD_DSH_ANCHOR
115
+ ?? '/home/u1/.local/lib/node_modules/@deepseek-ai/dsh/package.json';
116
+ const scopeSources = [
117
+ join(resolveDshHome(), 'profiles', 'node_modules', HARNESS_SCOPE),
118
+ join(dirname(ANCHOR), 'node_modules', HARNESS_SCOPE),
119
+ ];
120
+ const scopeDst = join(linkRoot, HARNESS_SCOPE);
121
+ rmSync(scopeDst, { recursive: true, force: true });
122
+ mkdirSync(scopeDst, { recursive: true });
123
+ const linked = new Set();
124
+ for (const scopeSrc of scopeSources) {
125
+ if (!existsSync(scopeSrc))
113
126
  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;
127
+ for (const name of readdirSync(scopeSrc)) {
128
+ if (name.startsWith('.') || linked.has(name))
129
+ continue;
130
+ symlinkSync(join(scopeSrc, name), join(scopeDst, name));
131
+ linked.add(name);
132
+ }
120
133
  }
121
134
  return join(opts.worldHome, 'profiles', 'node_modules') + '/';
122
135
  }
@@ -21,6 +21,8 @@ import { join, resolve } from "node:path";
21
21
  /** Prod homes that must never be resolved into (repo red line). */
22
22
  const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
23
23
  export function assertNotProdHome(path, label) {
24
+ if (process.env.SUPERD_DEV_REDLINE !== "1")
25
+ return; // published install: the host dsh home (~/.dsh on consumers) is authoritative — the S3/S7 world layout lives under it. Dev lines set SUPERD_DEV_REDLINE=1 (repo red line: ~/.dsh is Dash prod).
24
26
  if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
25
27
  throw new Error(`pi-home: refusing prod home as ${label}: ${path}`);
26
28
  }
@@ -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-c",
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",