super-dsh 0.1.0 → 0.1.2
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.
- package/agent-agy/bridge/agy_bridge.py +250 -0
- package/agent-agy/bridge/gemini_openai_server.mjs +98 -0
- package/agent-agy/cordis.patch.yml +49 -0
- package/agent-agy/dist/adapter.d.ts +15 -0
- package/agent-agy/dist/adapter.js +42 -0
- package/agent-agy/dist/agent-preset-agy.d.ts +47 -0
- package/agent-agy/dist/agent-preset-agy.js +169 -0
- package/agent-agy/dist/agent-preset-projection.d.ts +31 -0
- package/agent-agy/dist/agent-preset-projection.js +33 -0
- package/agent-agy/dist/agent.d.ts +137 -0
- package/agent-agy/dist/agent.js +493 -0
- package/agent-agy/dist/agy-cli-client.d.ts +137 -0
- package/agent-agy/dist/agy-cli-client.js +301 -0
- package/agent-agy/dist/agy-client.d.ts +160 -0
- package/agent-agy/dist/agy-client.js +252 -0
- package/agent-agy/dist/agy-sessions.d.ts +24 -0
- package/agent-agy/dist/agy-sessions.js +116 -0
- package/agent-agy/dist/agy-store.d.ts +39 -0
- package/agent-agy/dist/agy-store.js +83 -0
- package/agent-agy/dist/inbox.d.ts +26 -0
- package/agent-agy/dist/inbox.js +53 -0
- package/agent-agy/dist/index.d.ts +80 -0
- package/agent-agy/dist/index.js +505 -0
- package/agent-agy/dist/models.d.ts +41 -0
- package/agent-agy/dist/models.js +74 -0
- package/agent-agy/dist/world-plugin.d.ts +9 -0
- package/agent-agy/dist/world-plugin.js +97 -0
- package/agent-agy/package.json +64 -0
- package/agent-claude/cordis.patch.yml +42 -0
- package/agent-claude/dist/adapter.js +62 -0
- package/agent-claude/dist/agent-preset-claude.js +169 -0
- package/agent-claude/dist/agent-preset-projection.js +30 -0
- package/agent-claude/dist/agent.js +1271 -0
- package/agent-claude/dist/claude-client.js +357 -0
- package/agent-claude/dist/claude-events.js +223 -0
- package/agent-claude/dist/claude-home.js +29 -0
- package/agent-claude/dist/commands.js +182 -0
- package/agent-claude/dist/content.js +134 -0
- package/agent-claude/dist/inbox.js +53 -0
- package/agent-claude/dist/index.js +555 -0
- package/agent-claude/dist/input-queue.js +64 -0
- package/agent-claude/dist/interaction.js +271 -0
- package/agent-claude/dist/models.js +158 -0
- package/agent-claude/dist/permission.js +120 -0
- package/agent-claude/dist/session-id.js +20 -0
- package/agent-claude/dist/session-map.js +165 -0
- package/agent-claude/dist/world-plugin.js +14 -0
- package/agent-claude/package.json +74 -0
- package/agent-codex/README.md +74 -0
- package/agent-codex/cordis.patch.yml +77 -0
- package/agent-codex/dist/adapter.js +55 -0
- package/agent-codex/dist/agent-preset-codex.js +171 -0
- package/agent-codex/dist/agent-preset-projection.js +37 -0
- package/agent-codex/dist/agent.js +1056 -0
- package/agent-codex/dist/app-home.js +65 -0
- package/agent-codex/dist/codex-client.js +469 -0
- package/agent-codex/dist/codex-events.js +297 -0
- package/agent-codex/dist/codex-store.js +190 -0
- package/agent-codex/dist/inbox.js +53 -0
- package/agent-codex/dist/index.js +605 -0
- package/agent-codex/dist/models.js +152 -0
- package/agent-codex/dist/permission.js +71 -0
- package/agent-codex/dist/session-map.js +170 -0
- package/agent-codex/dist/spike.js +46 -0
- package/agent-codex/dist/world-plugin.js +96 -0
- package/agent-codex/package.json +78 -0
- package/agent-hermes/README.md +144 -0
- package/agent-hermes/cordis.patch.yml +83 -0
- package/agent-hermes/dist/adapter.js +83 -0
- package/agent-hermes/dist/agent-preset-hermes.js +171 -0
- package/agent-hermes/dist/agent-preset-projection.js +34 -0
- package/agent-hermes/dist/agent.js +1068 -0
- package/agent-hermes/dist/hermes-client.js +953 -0
- package/agent-hermes/dist/hermes-events.js +289 -0
- package/agent-hermes/dist/hermes-store.js +158 -0
- package/agent-hermes/dist/inbox.js +53 -0
- package/agent-hermes/dist/index.js +541 -0
- package/agent-hermes/dist/models.js +324 -0
- package/agent-hermes/dist/permission.js +60 -0
- package/agent-hermes/dist/world-plugin.js +101 -0
- package/agent-hermes/package.json +76 -0
- package/agent-hub/cordis.patch.yml +12 -0
- package/agent-hub/dist/agent-roster.d.ts +34 -0
- package/agent-hub/dist/agent-roster.js +27 -0
- package/agent-hub/dist/carrier.d.ts +43 -0
- package/agent-hub/dist/carrier.js +241 -0
- package/agent-hub/dist/client-shim.d.ts +28 -0
- package/agent-hub/dist/client-shim.js +251 -0
- package/agent-hub/dist/envelope.d.ts +54 -0
- package/agent-hub/dist/envelope.js +92 -0
- package/agent-hub/dist/gateway.d.ts +28 -0
- package/agent-hub/dist/gateway.js +18 -0
- package/agent-hub/dist/index-pass.d.ts +22 -0
- package/agent-hub/dist/index-pass.js +47 -0
- package/agent-hub/dist/index.d.ts +29 -0
- package/agent-hub/dist/index.js +29 -0
- package/agent-hub/dist/labels.d.ts +45 -0
- package/agent-hub/dist/labels.js +83 -0
- package/agent-hub/dist/ownership.d.ts +37 -0
- package/agent-hub/dist/ownership.js +54 -0
- package/agent-hub/dist/roster.d.ts +28 -0
- package/agent-hub/dist/roster.js +38 -0
- package/agent-hub/dist/rpc.d.ts +38 -0
- package/agent-hub/dist/rpc.js +52 -0
- package/agent-hub/dist/spawn-world.d.ts +46 -0
- package/agent-hub/dist/spawn-world.js +72 -0
- package/agent-hub/dist/targets.d.ts +33 -0
- package/agent-hub/dist/targets.js +30 -0
- package/agent-hub/dist/world-entry.d.ts +31 -0
- package/agent-hub/dist/world-entry.js +51 -0
- package/agent-hub/dist/world-host.d.ts +69 -0
- package/agent-hub/dist/world-host.js +44 -0
- package/agent-hub/dist/world-join.d.ts +16 -0
- package/agent-hub/dist/world-join.js +122 -0
- package/agent-hub/dist/world-mount.d.ts +52 -0
- package/agent-hub/dist/world-mount.js +52 -0
- package/agent-hub/dist/world-mux.d.ts +72 -0
- package/agent-hub/dist/world-mux.js +224 -0
- package/agent-hub/dist/world-provision.d.ts +20 -0
- package/agent-hub/dist/world-provision.js +122 -0
- package/agent-hub/dist/world-web-server.d.ts +162 -0
- package/agent-hub/dist/world-web-server.js +248 -0
- package/agent-hub/lib/client/index.js +242 -0
- package/agent-hub/package.json +65 -0
- package/agent-omp/README.md +77 -0
- package/agent-omp/cordis.patch.yml +92 -0
- package/agent-omp/dist/adapter.js +36 -0
- package/agent-omp/dist/agent-preset-omp.js +171 -0
- package/agent-omp/dist/agent-preset-projection.js +36 -0
- package/agent-omp/dist/agent.js +1145 -0
- package/agent-omp/dist/app-home.js +86 -0
- package/agent-omp/dist/discovery.js +116 -0
- package/agent-omp/dist/inbox.js +53 -0
- package/agent-omp/dist/index.js +574 -0
- package/agent-omp/dist/knobs.js +50 -0
- package/agent-omp/dist/lazy-rpc.js +161 -0
- package/agent-omp/dist/mobile/gesture.js +148 -0
- package/agent-omp/dist/mobile/zoom-guard.js +294 -0
- package/agent-omp/dist/mobile-boot.js +38 -0
- package/agent-omp/dist/models.js +299 -0
- package/agent-omp/dist/omp-cli.js +147 -0
- package/agent-omp/dist/omp-disk-discovery.js +178 -0
- package/agent-omp/dist/omp-store.js +518 -0
- package/agent-omp/dist/pairing.js +45 -0
- package/agent-omp/dist/permission.js +96 -0
- package/agent-omp/dist/protocol.js +13 -0
- package/agent-omp/dist/rpc-types.js +1 -0
- package/agent-omp/dist/sdk-client.js +378 -0
- package/agent-omp/dist/sidecar-client.js +195 -0
- package/agent-omp/dist/store/adapter.js +47 -0
- package/agent-omp/dist/store/db.js +210 -0
- package/agent-omp/dist/store/index.js +59 -0
- package/agent-omp/dist/store/reconcile.js +51 -0
- package/agent-omp/dist/store/schema.js +40 -0
- package/agent-omp/dist/world-plugin.js +96 -0
- package/agent-omp/package.json +97 -0
- package/agent-omp/sidecar/main.ts +481 -0
- package/agent-pi/README.md +67 -0
- package/agent-pi/cordis.patch.yml +80 -0
- package/agent-pi/dist/adapter.js +53 -0
- package/agent-pi/dist/agent-preset-pi.js +169 -0
- package/agent-pi/dist/agent-preset-projection.js +29 -0
- package/agent-pi/dist/agent.js +949 -0
- package/agent-pi/dist/inbox.js +53 -0
- package/agent-pi/dist/index.js +595 -0
- package/agent-pi/dist/knobs.js +24 -0
- package/agent-pi/dist/models.js +200 -0
- package/agent-pi/dist/permission.js +66 -0
- package/agent-pi/dist/pi-client.js +224 -0
- package/agent-pi/dist/pi-events.js +155 -0
- package/agent-pi/dist/pi-home.js +55 -0
- package/agent-pi/dist/safe-json.js +25 -0
- package/agent-pi/dist/session-map.js +119 -0
- package/agent-pi/dist/world-plugin.js +97 -0
- package/agent-pi/package.json +77 -0
- package/cordis.patch.yml +22 -19
- package/package.json +88 -25
- package/client.js +0 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi-home — the adapter's DSH-side state-dir resolution.
|
|
3
|
+
*
|
|
4
|
+
* TWO homes, and mixing them is THE bug this module exists to prevent:
|
|
5
|
+
*
|
|
6
|
+
* - pi's RUNTIME home is the native `~/.pi` (agent dir `~/.pi/agent`): auth,
|
|
7
|
+
* models, settings, skills, extensions, project trust, and the native
|
|
8
|
+
* session JSONL store all live there. The adapter NEVER redirects it — no
|
|
9
|
+
* `agentDir` override is passed to the SDK, so the user's pi CLI state is
|
|
10
|
+
* exactly what our sessions run with (2026-09-17 user ruling — generalized
|
|
11
|
+
* to ALL adapters in dev-rules §5/§13 the same day). Tests may
|
|
12
|
+
* redirect the RUNTIME home via `PI_CODING_AGENT_DIR` /
|
|
13
|
+
* `PI_CODING_AGENT_SESSION_DIR` — read by pi itself, never by us.
|
|
14
|
+
* - the adapter's DSH-side STATE dir is `<dshHomePath>/agents/pi`
|
|
15
|
+
* (om bridge-store / codex map precedent): the tiny dsh↔pi session mapping.
|
|
16
|
+
* pi never reads this tree; it is DSH bookkeeping in the same class as the
|
|
17
|
+
* DSH session log.
|
|
18
|
+
*/
|
|
19
|
+
import { homedir } from "node:os";
|
|
20
|
+
import { join, resolve } from "node:path";
|
|
21
|
+
/** Prod homes that must never be resolved into (repo red line). */
|
|
22
|
+
const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
|
|
23
|
+
export function assertNotProdHome(path, label) {
|
|
24
|
+
if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
|
|
25
|
+
throw new Error(`pi-home: refusing prod home as ${label}: ${path}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the adapter's DSH-side state dir — `<dshHomePath>/agents/pi`.
|
|
30
|
+
* Precedence: explicit home (boot-provided `dshHomePath`), then `$DSH_HOME`,
|
|
31
|
+
* then the line's historical test-home default. Prod-guarded.
|
|
32
|
+
*/
|
|
33
|
+
export function resolvePiStateDir(home) {
|
|
34
|
+
if (home !== undefined) {
|
|
35
|
+
const resolved = resolve(home);
|
|
36
|
+
// World form: spawnWorld overrides dshHomePath to `<line home>/agents/pi`
|
|
37
|
+
// — that tree IS the pi world's root, so the state dir is the home itself
|
|
38
|
+
// (no second nest). Line/standalone form: nest once under agents/pi.
|
|
39
|
+
if (resolved.endsWith(join("agents", "pi"))) {
|
|
40
|
+
assertNotProdHome(resolved, "pi state dir");
|
|
41
|
+
return resolved;
|
|
42
|
+
}
|
|
43
|
+
const dir = join(resolved, "agents", "pi");
|
|
44
|
+
assertNotProdHome(dir, "pi state dir");
|
|
45
|
+
return dir;
|
|
46
|
+
}
|
|
47
|
+
const fallbackHome = resolve(process.env.DSH_HOME ?? join(process.cwd(), ".tests", "aw"));
|
|
48
|
+
const dir = join(fallbackHome, "agents", "pi");
|
|
49
|
+
assertNotProdHome(dir, "pi state dir");
|
|
50
|
+
return dir;
|
|
51
|
+
}
|
|
52
|
+
/** The dsh↔pi session mapping file inside the state dir. */
|
|
53
|
+
export function piMappingPath(home) {
|
|
54
|
+
return join(resolvePiStateDir(home), "dsh-sessions.json");
|
|
55
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON.stringify that never throws: circular structures and bigint values
|
|
3
|
+
* degrade to placeholders instead of blowing up the event pump.
|
|
4
|
+
*/
|
|
5
|
+
export function JSONStringifySafe(value) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.stringify(value, replacer()) ?? "null";
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return '"[unserializable]"';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function replacer() {
|
|
14
|
+
const ancestors = new Set();
|
|
15
|
+
return function (_key, value) {
|
|
16
|
+
if (typeof value === "bigint")
|
|
17
|
+
return String(value);
|
|
18
|
+
if (value !== null && typeof value === "object") {
|
|
19
|
+
if (ancestors.has(value))
|
|
20
|
+
return "[circular]";
|
|
21
|
+
ancestors.add(value);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH-session ↔ pi-session-file identity map (the "mapping only" model,
|
|
3
|
+
* codex precedent).
|
|
4
|
+
*
|
|
5
|
+
* The DSH session id is the authority: it is supplied by the harness at
|
|
6
|
+
* create/resume and is what the API layer routes on. pi's session file only
|
|
7
|
+
* materializes when the first prompt starts the SDK session, so the pairing
|
|
8
|
+
* is persisted here, in an adapter-owned JSON file in the adapter's DSH-side
|
|
9
|
+
* state dir (2026-09-17 ruling — pi's native home `~/.pi` stays pi-only):
|
|
10
|
+
*
|
|
11
|
+
* `<dshHome>/agents/pi/dsh-sessions.json`
|
|
12
|
+
*
|
|
13
|
+
* Shape: `{ "<dshSessionId>": { sessionFile, cwd, createdAt, preset } }` —
|
|
14
|
+
* `sessionFile` is `null` until the pi session starts. Writes are atomic
|
|
15
|
+
* (temp file + rename); reads are fail-soft (malformed JSON reads as empty)
|
|
16
|
+
* and never throw, so a corrupt map degrades to "unknown session" rather
|
|
17
|
+
* than breaking every operation.
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { dirname } from "node:path";
|
|
21
|
+
import { piMappingPath } from "./pi-home.js";
|
|
22
|
+
/** Read the map. Fail-soft: a missing or malformed file reads as `{}`. */
|
|
23
|
+
export function readSessionMap(home) {
|
|
24
|
+
let raw;
|
|
25
|
+
try {
|
|
26
|
+
raw = readFileSync(piMappingPath(home), "utf8");
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = JSON.parse(raw);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
39
|
+
return {};
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const [id, value] of Object.entries(parsed)) {
|
|
42
|
+
const record = coerceRecord(value);
|
|
43
|
+
if (record !== undefined)
|
|
44
|
+
out[id] = record;
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/** Validate one entry; malformed entries are dropped (fail-soft). */
|
|
49
|
+
function coerceRecord(value) {
|
|
50
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
51
|
+
return undefined;
|
|
52
|
+
const raw = value;
|
|
53
|
+
const cwd = raw["cwd"];
|
|
54
|
+
const createdAt = raw["createdAt"];
|
|
55
|
+
if (typeof cwd !== "string" || cwd === "")
|
|
56
|
+
return undefined;
|
|
57
|
+
const sessionFile = raw["sessionFile"];
|
|
58
|
+
const preset = raw["preset"];
|
|
59
|
+
return {
|
|
60
|
+
sessionFile: typeof sessionFile === "string" && sessionFile !== "" ? sessionFile : null,
|
|
61
|
+
cwd,
|
|
62
|
+
createdAt: typeof createdAt === "number" && Number.isFinite(createdAt) ? createdAt : 0,
|
|
63
|
+
preset: typeof preset === "string" && preset !== "" ? preset : null,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** One session's record, or `undefined` when the id is unknown. */
|
|
67
|
+
export function sessionRecord(home, dshSessionId) {
|
|
68
|
+
return readSessionMap(home)[dshSessionId];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Insert or merge one session's record and persist the map atomically
|
|
72
|
+
* (temp file + rename, same directory). Merge semantics: an omitted `patch`
|
|
73
|
+
* field keeps the stored value; `sessionFile: null` explicitly records "not
|
|
74
|
+
* yet materialized". Throws only when the write itself fails — the caller
|
|
75
|
+
* owns that decision (create treats an unwritable map as fatal; the
|
|
76
|
+
* observation path logs and continues).
|
|
77
|
+
*/
|
|
78
|
+
export function upsertSession(home, dshSessionId, patch) {
|
|
79
|
+
const path = piMappingPath(home);
|
|
80
|
+
const map = readSessionMap(home);
|
|
81
|
+
const previous = map[dshSessionId];
|
|
82
|
+
const next = {
|
|
83
|
+
sessionFile: patch.sessionFile !== undefined ? patch.sessionFile : previous?.sessionFile ?? null,
|
|
84
|
+
cwd: patch.cwd !== undefined ? patch.cwd : previous?.cwd ?? "",
|
|
85
|
+
createdAt: patch.createdAt !== undefined ? patch.createdAt : previous?.createdAt ?? Date.now(),
|
|
86
|
+
preset: patch.preset !== undefined ? patch.preset : previous?.preset ?? null,
|
|
87
|
+
};
|
|
88
|
+
map[dshSessionId] = next;
|
|
89
|
+
writeMapAtomic(path, map);
|
|
90
|
+
return next;
|
|
91
|
+
}
|
|
92
|
+
/** Drop one session's record (idempotent; failure to persist rethrows). */
|
|
93
|
+
export function forgetSession(home, dshSessionId) {
|
|
94
|
+
const path = piMappingPath(home);
|
|
95
|
+
if (!existsSync(path))
|
|
96
|
+
return;
|
|
97
|
+
const map = readSessionMap(home);
|
|
98
|
+
if (map[dshSessionId] === undefined)
|
|
99
|
+
return;
|
|
100
|
+
delete map[dshSessionId];
|
|
101
|
+
writeMapAtomic(path, map);
|
|
102
|
+
}
|
|
103
|
+
function writeMapAtomic(path, map) {
|
|
104
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
105
|
+
const temp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
106
|
+
writeFileSync(temp, `${JSON.stringify(map, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
107
|
+
try {
|
|
108
|
+
renameSync(temp, path);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
try {
|
|
112
|
+
rmSync(temp, { force: true });
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// The rename failure is primary.
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aw.agent-adapter-pi — the Pi adapter's WORLD plugin (spec S2):
|
|
3
|
+
* activation IS roster membership.
|
|
4
|
+
*
|
|
5
|
+
* AW-B URL scheme (DL1–DL5), mirroring `@pgmi-builds/agent-adapter-omp/world`
|
|
6
|
+
* and `@pgmi-builds/agent-adapter-codex/world` so the hub sees every foreign
|
|
7
|
+
* runtime through one shape: the world is spawned as a sibling ROOT context
|
|
8
|
+
* with NO listener (`worldMountPatches`) and mounts itself under `/pi`.
|
|
9
|
+
*
|
|
10
|
+
* 1. ctx0 publishes the host mount (real webServer instance) before spawn;
|
|
11
|
+
* 2. the world's entry row provides the virtual `webServer` in the world
|
|
12
|
+
* root, translating every route its plugins declare into `/pi+path`;
|
|
13
|
+
* 3. the hub's carrier answers `/pi/api` + `/pi/api/remote.mux` in
|
|
14
|
+
* ctx0's auth domain and dispatches into this world's gateway instance.
|
|
15
|
+
*/
|
|
16
|
+
import { mkdirSync } from 'node:fs';
|
|
17
|
+
import { resolveDshHome } from '@deepseek-ai/dsh-home-paths';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { spawnWorld, registerAgent, setReady, registerForeignTarget, registerHostMount, mountWorld, worldMountPatches, provisionWorldProfile, } from '../../agent-hub/dist/index.js';
|
|
20
|
+
export const name = 'aw.agent-adapter-pi';
|
|
21
|
+
/** Runtime key — also the mount label. */
|
|
22
|
+
const KEY = 'pi';
|
|
23
|
+
const ANCHOR = process.env.SUPERD_DSH_ANCHOR
|
|
24
|
+
?? '/home/u1/.local/lib/node_modules/@deepseek-ai/dsh/package.json';
|
|
25
|
+
export function apply(ctx) {
|
|
26
|
+
registerAgent({ key: KEY, label: 'Pi', ready: false });
|
|
27
|
+
// Harness resolver (env → ~/.dsh): a consumer install has no DSH_HOME and
|
|
28
|
+
// no cwd contract — deriving the world root from cwd spawns worlds into a
|
|
29
|
+
// garbage tree or throws inside apply() and kills the whole host boot.
|
|
30
|
+
const root = resolveDshHome();
|
|
31
|
+
// Nested home: the world's DSH data lives INSIDE `agents/<label>` (sessions
|
|
32
|
+
// / settings / workspaces, and the adapter's dsh-sessions.json mapping).
|
|
33
|
+
// pi's RUNTIME home is the native ~/.pi (2026-09-17 ruling) — nothing is
|
|
34
|
+
// seeded or nested for the pi SDK itself.
|
|
35
|
+
const worldHome = join(root, 'agents', KEY);
|
|
36
|
+
mkdirSync(join(worldHome, 'profiles'), { recursive: true });
|
|
37
|
+
// Publish story: a foreign install has no line bootstrap, so the nested
|
|
38
|
+
// profile + @pgmi-builds links are provisioned HERE (idempotent; dev lines
|
|
39
|
+
// keep parity — smoke.mjs wrote the same layout, and AW_BARE_BASE still
|
|
40
|
+
// overrides the resolved base).
|
|
41
|
+
const bareBase = provisionWorldProfile({
|
|
42
|
+
key: KEY,
|
|
43
|
+
adapterPkg: '@pgmi-builds/agent-adapter-pi',
|
|
44
|
+
worldHome,
|
|
45
|
+
});
|
|
46
|
+
const world = (async () => {
|
|
47
|
+
// Wait for ctx0's listening stack: the mount needs the real webServer and
|
|
48
|
+
// the browser-trust fence from the live connection service.
|
|
49
|
+
const host = await new Promise((resolve) => {
|
|
50
|
+
ctx.inject(['webServer', 'connection'], (hostCtx) => { resolve(hostCtx); });
|
|
51
|
+
});
|
|
52
|
+
const real = host['webServer'];
|
|
53
|
+
const connection = host['connection'];
|
|
54
|
+
const dropHostMount = registerHostMount({
|
|
55
|
+
key: KEY,
|
|
56
|
+
labelPath: `/${KEY}`,
|
|
57
|
+
real,
|
|
58
|
+
// ctx0's index gate, applied by the mount to this world's pages and assets:
|
|
59
|
+
// the world is reached in-ctx and owns no listener, so ctx0 decides auth.
|
|
60
|
+
authorize: (req, res) => connection.authorizeIndex(req, res),
|
|
61
|
+
});
|
|
62
|
+
const ctxW = await spawnWorld({
|
|
63
|
+
appName: `aw-${KEY}`,
|
|
64
|
+
profileName: 'web',
|
|
65
|
+
installAnchor: ANCHOR,
|
|
66
|
+
home: worldHome,
|
|
67
|
+
dataHome: worldHome,
|
|
68
|
+
// Adapter-local bundle names resolve from the profile's own
|
|
69
|
+
// node_modules (heal owns @deepseek-ai there; @pgmi-builds links are
|
|
70
|
+
// provisioned by provisionWorldProfile above, or by the line bootstrap
|
|
71
|
+
// when the adapter package was not resolvable — env wins over both).
|
|
72
|
+
bareModuleBaseUrl: process.env.AW_BARE_BASE ?? bareBase ?? undefined,
|
|
73
|
+
extraPatches: worldMountPatches(KEY),
|
|
74
|
+
});
|
|
75
|
+
const gateway = ctxW.get('typertGateway');
|
|
76
|
+
registerForeignTarget({ key: KEY, gateway });
|
|
77
|
+
const mounted = mountWorld({
|
|
78
|
+
real,
|
|
79
|
+
label: KEY,
|
|
80
|
+
gateway,
|
|
81
|
+
requestRejection: (request) => connection
|
|
82
|
+
.requestRejection(request),
|
|
83
|
+
});
|
|
84
|
+
setReady(KEY, true);
|
|
85
|
+
ctx.effect?.(() => () => {
|
|
86
|
+
mounted.dispose();
|
|
87
|
+
dropHostMount();
|
|
88
|
+
}, `aw.agent-adapter-${KEY}: mount`);
|
|
89
|
+
return ctxW;
|
|
90
|
+
})().catch((cause) => {
|
|
91
|
+
// A failed world degrades to a not-ready roster row; a rejected provided
|
|
92
|
+
// promise would fail the entire host boot (loader entry apply).
|
|
93
|
+
console.error(`[super-dsh] ${KEY} world failed:`, cause);
|
|
94
|
+
return null;
|
|
95
|
+
});
|
|
96
|
+
ctx.provide(`aw.world.${KEY}`, world);
|
|
97
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pgmi-builds/agent-adapter-pi",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pi provider for DeepSeek Harness (dsh) — an AgentFactory that embeds the pi coding agent in-process via the @earendil-works/pi-coding-agent SDK and bridges pi's session surface into Dash Agent/Session contracts (Agent Worlds AW-F). pi keeps its native data home ~/.pi (2026-09-17 ruling).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./world": "./dist/world-plugin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"cordis.patch.yml",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"dsh": {
|
|
16
|
+
"bundle": {
|
|
17
|
+
"patch": "./cordis.patch.yml"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"test": "node --test test/*.test.mjs"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
26
|
+
"@pgmi-builds/agent-hub": "file:../agent-hub",
|
|
27
|
+
"zod": "3.25.76"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
31
|
+
"@deepseek-ai/dsh-agent": "0.1.5-rc.2",
|
|
32
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.5-rc.2",
|
|
33
|
+
"@deepseek-ai/dsh-llm": "0.1.5-rc.2",
|
|
34
|
+
"@deepseek-ai/dsh-scope": "0.1.5-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-session": "0.1.5-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.5-rc.2"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"@deepseek-ai/cordis": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"@deepseek-ai/dsh-agent": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"@deepseek-ai/dsh-agent-presets": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@deepseek-ai/dsh-llm": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@deepseek-ai/dsh-scope": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@deepseek-ai/dsh-session": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@deepseek-ai/dsh-session-persistence": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^26.2.0",
|
|
67
|
+
"typescript": "^5.6.0"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"license": "MIT",
|
|
73
|
+
"main": "dist/index.js",
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=22.18"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/cordis.patch.yml
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
# super-dsh — the Agent Worlds composite bundle (one `dsh plugin add` face).
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# - one world plugin per adapter (activation IS roster membership, S2) —
|
|
7
|
-
# each spawns its own zero-port sibling root and mounts under `/<label>`;
|
|
8
|
-
# - the generic hub joiner for the claude adapter (ships standalone, R2);
|
|
9
|
-
# - the directory-picker browse pair + auto picker off (the line's server
|
|
10
|
-
# posture: no DISPLAY/zenity dependency on the host machine).
|
|
3
|
+
# better-dsh shape: ONE package, components are this package's own subpath
|
|
4
|
+
# exports, so every row below is individually toggleable on the plugin page
|
|
5
|
+
# (cordis hmr; docs/06 §二.5 — insert rows = the "Components" lines).
|
|
11
6
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
7
|
+
# - super-dsh/hub the hub: selector + roster + per-world mount
|
|
8
|
+
# carrier + V5 gateway delegation (wraps the live
|
|
9
|
+
# typertGateway; upstream dispatch untouched)
|
|
10
|
+
# - super-dsh/world/<label> one world plugin per adapter (activation IS
|
|
11
|
+
# roster membership, S2) — each spawns its own
|
|
12
|
+
# zero-port sibling root, mounted under /<label>
|
|
13
|
+
# - super-dsh/join the generic hub joiner for the standalone
|
|
14
|
+
# claude adapter (R2)
|
|
15
|
+
#
|
|
16
|
+
# Profile-layer values (webserver port/host, settings path) stay in the USER's
|
|
17
|
+
# profile patch layer, never here.
|
|
15
18
|
- insert:
|
|
16
19
|
- id: agent-hub
|
|
17
|
-
name: '
|
|
20
|
+
name: 'super-dsh/hub'
|
|
18
21
|
- id: aw-agent-adapter-omp
|
|
19
|
-
name: '
|
|
22
|
+
name: 'super-dsh/world/omp'
|
|
20
23
|
- id: aw-agent-adapter-codex
|
|
21
|
-
name: '
|
|
24
|
+
name: 'super-dsh/world/codex'
|
|
22
25
|
- id: aw-agent-adapter-pi
|
|
23
|
-
name: '
|
|
26
|
+
name: 'super-dsh/world/pi'
|
|
24
27
|
- id: aw-agent-adapter-hermes
|
|
25
|
-
name: '
|
|
28
|
+
name: 'super-dsh/world/hermes'
|
|
26
29
|
- id: aw-agent-adapter-agy
|
|
27
|
-
name: '
|
|
30
|
+
name: 'super-dsh/world/agy'
|
|
28
31
|
# R2 (2026-09-16): the claude adapter ships STANDALONE only — its /world
|
|
29
32
|
# entry is inert. The HUB side joins it: one generic joiner row with the
|
|
30
|
-
# key; spawn/roster/mount wiring lives in
|
|
33
|
+
# key; spawn/roster/mount wiring lives in super-dsh/join.
|
|
31
34
|
- id: aw-world-join-claude
|
|
32
|
-
name: '
|
|
35
|
+
name: 'super-dsh/join'
|
|
33
36
|
config:
|
|
34
37
|
key: claude
|
|
35
38
|
label: Claude
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "super-dsh",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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,12 +9,45 @@
|
|
|
9
9
|
"url": "git+https://github.com/pgmi-builds/superd.git"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
|
-
"./
|
|
12
|
+
"./hub": "./agent-hub/dist/index.js",
|
|
13
|
+
"./join": "./agent-hub/dist/world-join.js",
|
|
14
|
+
"./world/omp": "./agent-omp/dist/world-plugin.js",
|
|
15
|
+
"./world/codex": "./agent-codex/dist/world-plugin.js",
|
|
16
|
+
"./world/claude": "./agent-claude/dist/world-plugin.js",
|
|
17
|
+
"./world/pi": "./agent-pi/dist/world-plugin.js",
|
|
18
|
+
"./world/hermes": "./agent-hermes/dist/world-plugin.js",
|
|
19
|
+
"./world/agy": "./agent-agy/dist/world-plugin.js",
|
|
20
|
+
"./client": "./agent-hub/lib/client/index.js",
|
|
21
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
22
|
+
"./package.json": "./package.json"
|
|
13
23
|
},
|
|
14
24
|
"files": [
|
|
15
25
|
"cordis.patch.yml",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
26
|
+
"README.md",
|
|
27
|
+
"agent-hub/dist",
|
|
28
|
+
"agent-hub/lib",
|
|
29
|
+
"agent-hub/package.json",
|
|
30
|
+
"agent-hub/cordis.patch.yml",
|
|
31
|
+
"agent-omp/dist",
|
|
32
|
+
"agent-omp/package.json",
|
|
33
|
+
"agent-omp/cordis.patch.yml",
|
|
34
|
+
"agent-omp/sidecar",
|
|
35
|
+
"agent-codex/dist",
|
|
36
|
+
"agent-codex/package.json",
|
|
37
|
+
"agent-codex/cordis.patch.yml",
|
|
38
|
+
"agent-claude/dist",
|
|
39
|
+
"agent-claude/package.json",
|
|
40
|
+
"agent-claude/cordis.patch.yml",
|
|
41
|
+
"agent-pi/dist",
|
|
42
|
+
"agent-pi/package.json",
|
|
43
|
+
"agent-pi/cordis.patch.yml",
|
|
44
|
+
"agent-hermes/dist",
|
|
45
|
+
"agent-hermes/package.json",
|
|
46
|
+
"agent-hermes/cordis.patch.yml",
|
|
47
|
+
"agent-agy/dist",
|
|
48
|
+
"agent-agy/package.json",
|
|
49
|
+
"agent-agy/cordis.patch.yml",
|
|
50
|
+
"agent-agy/bridge"
|
|
18
51
|
],
|
|
19
52
|
"dsh": {
|
|
20
53
|
"bundle": {
|
|
@@ -28,13 +61,15 @@
|
|
|
28
61
|
}
|
|
29
62
|
},
|
|
30
63
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.263",
|
|
65
|
+
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
66
|
+
"@oh-my-pi/pi-coding-agent": "^18.1.14",
|
|
67
|
+
"@openai/codex": "0.154.0",
|
|
68
|
+
"@openai/codex-sdk": "0.154.0",
|
|
69
|
+
"bun": "^1.4.2",
|
|
70
|
+
"ws": "^8.21.0",
|
|
71
|
+
"zod": "3.25.76",
|
|
72
|
+
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
38
73
|
},
|
|
39
74
|
"peerDependencies": {
|
|
40
75
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
@@ -53,20 +88,48 @@
|
|
|
53
88
|
"@deepseek-ai/dsh-user-questions": "0.1.5-rc.2"
|
|
54
89
|
},
|
|
55
90
|
"peerDependenciesMeta": {
|
|
56
|
-
"@deepseek-ai/cordis": {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
|
|
91
|
+
"@deepseek-ai/cordis": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@deepseek-ai/dsh-agent": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@deepseek-ai/dsh-agent-presets": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@deepseek-ai/dsh-api-gateway": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"@deepseek-ai/dsh-commands": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"@deepseek-ai/dsh-home-paths": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"@deepseek-ai/dsh-host-webserver": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"@deepseek-ai/dsh-llm": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"@deepseek-ai/dsh-scope": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"@deepseek-ai/dsh-session": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"@deepseek-ai/dsh-session-persistence": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"@deepseek-ai/dsh-typert-protocol": {
|
|
125
|
+
"optional": true
|
|
126
|
+
},
|
|
127
|
+
"@deepseek-ai/dsh-user-approval": {
|
|
128
|
+
"optional": true
|
|
129
|
+
},
|
|
130
|
+
"@deepseek-ai/dsh-user-questions": {
|
|
131
|
+
"optional": true
|
|
132
|
+
}
|
|
70
133
|
},
|
|
71
134
|
"publishConfig": {
|
|
72
135
|
"access": "public"
|
package/client.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// super-dsh client face — re-export the hub's client half (selector mount:
|
|
2
|
-
// sidebar footer action + runtime seat). The dsh web app resolves this
|
|
3
|
-
// package's `./client` subpath via the `dsh.client` manifest in package.json.
|
|
4
|
-
export { apply, inject } from '@pgmi-builds/agent-hub/client'
|