super-dsh 0.1.3 → 0.1.5-a
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/README.md +3 -3
- package/agent-agy/cordis.patch.yml +8 -4
- package/agent-agy/dist/agent-preset-agy.d.ts +23 -43
- package/agent-agy/dist/agent-preset-agy.js +29 -166
- package/agent-agy/dist/agent.d.ts +2 -1
- package/agent-agy/dist/agent.js +3 -2
- package/agent-agy/dist/agy-sessions.d.ts +2 -1
- package/agent-agy/dist/agy-sessions.js +2 -11
- package/agent-agy/dist/index.js +13 -12
- package/agent-agy/dist/world-plugin.d.ts +2 -1
- package/agent-agy/dist/world-plugin.js +31 -51
- package/agent-agy/package.json +6 -6
- package/agent-claude/cordis.patch.yml +8 -4
- package/agent-claude/dist/agent-preset-claude.js +29 -166
- package/agent-claude/dist/agent.js +10 -10
- package/agent-claude/dist/claude-client.js +22 -3
- package/agent-claude/dist/claude-home.js +0 -8
- package/agent-claude/dist/index.js +12 -15
- package/agent-claude/dist/session-map.js +2 -5
- package/agent-claude/dist/world-plugin.js +3 -3
- package/agent-claude/package.json +9 -9
- package/agent-codex/README.md +8 -8
- package/agent-codex/cordis.patch.yml +9 -5
- package/agent-codex/dist/agent-preset-codex.js +29 -168
- package/agent-codex/dist/agent.js +17 -12
- package/agent-codex/dist/codex-store.js +0 -9
- package/agent-codex/dist/index.js +13 -16
- package/agent-codex/dist/session-map.js +2 -5
- package/agent-codex/dist/world-plugin.js +31 -51
- package/agent-codex/package.json +14 -11
- package/agent-hermes/README.md +9 -8
- package/agent-hermes/cordis.patch.yml +8 -4
- package/agent-hermes/dist/agent-preset-hermes.js +29 -168
- package/agent-hermes/dist/agent.js +33 -19
- package/agent-hermes/dist/hermes-client.js +5 -5
- package/agent-hermes/dist/hermes-store.js +2 -11
- package/agent-hermes/dist/index.js +13 -12
- package/agent-hermes/dist/world-plugin.js +31 -52
- package/agent-hermes/package.json +14 -11
- package/agent-omp/README.md +2 -2
- package/agent-omp/cordis.patch.yml +12 -7
- package/agent-omp/dist/agent-preset-omp.js +30 -169
- package/agent-omp/dist/agent.js +13 -5
- package/agent-omp/dist/index.js +12 -22
- package/agent-omp/dist/mobile/gesture.js +2 -2
- package/agent-omp/dist/mobile/zoom-guard.js +4 -4
- package/agent-omp/dist/mobile-boot.js +2 -2
- package/agent-omp/dist/omp-cli.js +1 -1
- package/agent-omp/dist/omp-disk-discovery.js +1 -1
- package/agent-omp/dist/protocol.js +1 -1
- package/agent-omp/dist/sidecar-client.js +1 -1
- package/agent-omp/dist/world-plugin.js +37 -50
- package/agent-omp/package.json +18 -14
- package/agent-omp/sidecar/main.ts +2 -2
- package/agent-pi/README.md +5 -5
- package/agent-pi/cordis.patch.yml +8 -4
- package/agent-pi/dist/agent-preset-pi.js +29 -166
- package/agent-pi/dist/agent.js +18 -12
- package/agent-pi/dist/index.js +14 -16
- package/agent-pi/dist/pi-home.js +2 -12
- package/agent-pi/dist/world-plugin.js +31 -51
- package/agent-pi/package.json +14 -11
- package/client/index.js +1994 -150
- package/cordis.patch.yml +39 -15
- package/package.json +32 -30
- package/{agent-hub → superd-hub}/cordis.patch.yml +3 -3
- package/{agent-hub → superd-hub}/dist/agent-roster.d.ts +3 -1
- package/{agent-hub → superd-hub}/dist/agent-roster.js +4 -2
- package/superd-hub/dist/carrier.d.ts +62 -0
- package/superd-hub/dist/carrier.js +213 -0
- package/superd-hub/dist/fusion-transport.d.ts +150 -0
- package/superd-hub/dist/fusion-transport.js +369 -0
- package/{agent-hub → superd-hub}/dist/gateway.d.ts +9 -4
- package/superd-hub/dist/gateway.js +44 -0
- package/superd-hub/dist/hub-route.d.ts +74 -0
- package/superd-hub/dist/hub-route.js +188 -0
- package/{agent-hub → superd-hub}/dist/index.d.ts +14 -6
- package/{agent-hub → superd-hub}/dist/index.js +14 -6
- package/{agent-hub → superd-hub}/dist/roster.d.ts +2 -2
- package/{agent-hub → superd-hub}/dist/rpc.js +1 -1
- package/{agent-hub → superd-hub}/dist/spawn-world.d.ts +27 -6
- package/superd-hub/dist/spawn-world.js +279 -0
- package/superd-hub/dist/switch-core.d.ts +630 -0
- package/superd-hub/dist/switch-core.js +734 -0
- package/superd-hub/dist/system-head.d.ts +69 -0
- package/superd-hub/dist/system-head.js +194 -0
- package/superd-hub/dist/web-trust.d.ts +112 -0
- package/superd-hub/dist/web-trust.js +126 -0
- package/superd-hub/dist/world-entry.d.ts +38 -0
- package/superd-hub/dist/world-entry.js +47 -0
- package/{agent-hub → superd-hub}/dist/world-host.d.ts +15 -20
- package/superd-hub/dist/world-host.js +65 -0
- package/{agent-hub → superd-hub}/dist/world-join.d.ts +2 -1
- package/{agent-hub → superd-hub}/dist/world-join.js +30 -50
- package/superd-hub/dist/world-mount.d.ts +82 -0
- package/superd-hub/dist/world-mount.js +105 -0
- package/{agent-hub → superd-hub}/dist/world-mux.d.ts +21 -6
- package/superd-hub/dist/world-mux.js +392 -0
- package/{agent-hub → superd-hub}/dist/world-provision.d.ts +20 -4
- package/superd-hub/dist/world-provision.js +203 -0
- package/superd-hub/dist/world-web-server.d.ts +113 -0
- package/superd-hub/dist/world-web-server.js +99 -0
- package/superd-hub/lib/client/index.js +2086 -0
- package/{agent-hub → superd-hub}/package.json +12 -7
- package/agent-hub/dist/carrier.d.ts +0 -43
- package/agent-hub/dist/carrier.js +0 -241
- package/agent-hub/dist/gateway.js +0 -18
- package/agent-hub/dist/spawn-world.js +0 -72
- package/agent-hub/dist/world-entry.d.ts +0 -31
- package/agent-hub/dist/world-entry.js +0 -51
- package/agent-hub/dist/world-host.js +0 -44
- package/agent-hub/dist/world-mount.d.ts +0 -52
- package/agent-hub/dist/world-mount.js +0 -52
- package/agent-hub/dist/world-mux.js +0 -224
- package/agent-hub/dist/world-provision.js +0 -122
- package/agent-hub/dist/world-web-server.d.ts +0 -162
- package/agent-hub/dist/world-web-server.js +0 -248
- package/agent-hub/lib/client/index.js +0 -242
- /package/{agent-hub → superd-hub}/dist/client-shim.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/client-shim.js +0 -0
- /package/{agent-hub → superd-hub}/dist/envelope.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/envelope.js +0 -0
- /package/{agent-hub → superd-hub}/dist/index-pass.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/index-pass.js +0 -0
- /package/{agent-hub → superd-hub}/dist/labels.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/labels.js +0 -0
- /package/{agent-hub → superd-hub}/dist/ownership.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/ownership.js +0 -0
- /package/{agent-hub → superd-hub}/dist/roster.js +0 -0
- /package/{agent-hub → superd-hub}/dist/rpc.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/targets.d.ts +0 -0
- /package/{agent-hub → superd-hub}/dist/targets.js +0 -0
|
@@ -1,171 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
return useValue ? value : void 0;
|
|
7
|
-
};
|
|
8
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
-
var _, done = false;
|
|
14
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
-
var context = {};
|
|
16
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
-
if (kind === "accessor") {
|
|
21
|
-
if (result === void 0) continue;
|
|
22
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
-
}
|
|
27
|
-
else if (_ = accept(result)) {
|
|
28
|
-
if (kind === "field") initializers.unshift(_);
|
|
29
|
-
else descriptor[key] = _;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
-
done = true;
|
|
34
|
-
};
|
|
35
|
-
import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
36
|
-
const CODEX_PRESET = Object.freeze({
|
|
37
|
-
id: "codex",
|
|
38
|
-
trust: "system",
|
|
39
|
-
path: "",
|
|
1
|
+
export const CODEX_PRESET_ID = "codex";
|
|
2
|
+
/** The single fixed Codex preset: mounting it composes nothing. */
|
|
3
|
+
export const CODEX_PRESET = Object.freeze({
|
|
4
|
+
id: CODEX_PRESET_ID,
|
|
40
5
|
name: "Codex",
|
|
41
6
|
description: "Codex agent via the agent-codex adapter",
|
|
7
|
+
plugins: Object.freeze([]),
|
|
42
8
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_remoteRead_decorators = [Remote("read")];
|
|
68
|
-
_remoteCopy_decorators = [Remote("copy")];
|
|
69
|
-
_remoteDelete_decorators = [Remote("deletePreset")];
|
|
70
|
-
_remoteSelect_decorators = [Remote("select")];
|
|
71
|
-
__esDecorate(this, null, _remoteList_decorators, { kind: "method", name: "remoteList", static: false, private: false, access: { has: obj => "remoteList" in obj, get: obj => obj.remoteList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
72
|
-
__esDecorate(this, null, _remoteRead_decorators, { kind: "method", name: "remoteRead", static: false, private: false, access: { has: obj => "remoteRead" in obj, get: obj => obj.remoteRead }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
-
__esDecorate(this, null, _remoteCopy_decorators, { kind: "method", name: "remoteCopy", static: false, private: false, access: { has: obj => "remoteCopy" in obj, get: obj => obj.remoteCopy }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
|
-
__esDecorate(this, null, _remoteDelete_decorators, { kind: "method", name: "remoteDelete", static: false, private: false, access: { has: obj => "remoteDelete" in obj, get: obj => obj.remoteDelete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
|
-
__esDecorate(this, null, _remoteSelect_decorators, { kind: "method", name: "remoteSelect", static: false, private: false, access: { has: obj => "remoteSelect" in obj, get: obj => obj.remoteSelect }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
77
|
-
}
|
|
78
|
-
constructor(ctx) {
|
|
79
|
-
super(ctx, "agentPresets");
|
|
80
|
-
__runInitializers(this, _instanceExtraInitializers);
|
|
81
|
-
}
|
|
82
|
-
get defaultId() {
|
|
83
|
-
return CODEX_PRESET.id;
|
|
84
|
-
}
|
|
85
|
-
get roots() {
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
get authorable() {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
async list() {
|
|
92
|
-
return [CODEX_PRESET];
|
|
93
|
-
}
|
|
94
|
-
async resolve(id) {
|
|
95
|
-
if (id === undefined || id === CODEX_PRESET.id)
|
|
96
|
-
return CODEX_PRESET;
|
|
97
|
-
throw new RemoteError("agent-preset/not-found", `agent-presets: preset "${id}" not found (available: codex)`, { agentPreset: id, available: [CODEX_PRESET.id] });
|
|
98
|
-
}
|
|
99
|
-
async mount(_agentCtx, id) {
|
|
100
|
-
return this.resolve(id);
|
|
101
|
-
}
|
|
102
|
-
async recompose(_agentCtx, id) {
|
|
103
|
-
return this.resolve(id);
|
|
104
|
-
}
|
|
105
|
-
async read(id) {
|
|
106
|
-
await this.resolve(id);
|
|
107
|
-
return COMPOSITION_TEXT;
|
|
108
|
-
}
|
|
109
|
-
// ── Remote RPC surface (alpha: agentPresets routes come from @Remote) ────
|
|
110
|
-
// The stock dsh-host-apiproxy mapped cordis methods to routes; alpha serves
|
|
111
|
-
// them from @Remote decorators on a TypertRemoteService. A plain Service
|
|
112
|
-
// registers no routes, which is why Settings → Agent Preset 404'd.
|
|
113
|
-
async remoteList() {
|
|
114
|
-
if (process.env.CODEX_TRACE === "1")
|
|
115
|
-
process.stderr.write("[codex-roster] remoteList INVOKED\n");
|
|
116
|
-
return {
|
|
117
|
-
presets: [
|
|
118
|
-
{
|
|
119
|
-
id: CODEX_PRESET.id,
|
|
120
|
-
trust: CODEX_PRESET.trust,
|
|
121
|
-
isDefault: true,
|
|
122
|
-
name: CODEX_PRESET.name,
|
|
123
|
-
description: CODEX_PRESET.description,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
authorable: this.authorable,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
async remoteRead(agentPreset) {
|
|
130
|
-
const preset = await this.resolve(agentPreset);
|
|
131
|
-
return {
|
|
132
|
-
agentPreset: preset.id,
|
|
133
|
-
trust: preset.trust,
|
|
134
|
-
content: await this.read(preset.id),
|
|
135
|
-
name: preset.name,
|
|
136
|
-
description: preset.description,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async remoteCopy(from, id, name) {
|
|
140
|
-
await this.copy(from, id, name);
|
|
141
|
-
}
|
|
142
|
-
async remoteDelete(id) {
|
|
143
|
-
await this.remove(id);
|
|
144
|
-
}
|
|
145
|
-
/** Fixed roster: one preset, so selecting it is a no-op ack; anything else is unknown. */
|
|
146
|
-
async remoteSelect(agent, agentPreset) {
|
|
147
|
-
const preset = await this.resolve(agentPreset);
|
|
148
|
-
return preset.id;
|
|
149
|
-
}
|
|
150
|
-
async copy(_from, id, _name) {
|
|
151
|
-
throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Codex roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Codex roster is fixed and ships exactly one preset" });
|
|
152
|
-
}
|
|
153
|
-
async remove(id) {
|
|
154
|
-
throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Codex roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Codex roster is fixed and ships exactly one preset" });
|
|
155
|
-
}
|
|
156
|
-
serviceFor(_agent, _name) {
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
composeFrom(_agentCtx, _parentCtx) {
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
composedPreset(_agentCtx) {
|
|
163
|
-
return CODEX_PRESET.id;
|
|
164
|
-
}
|
|
165
|
-
async standingKeyFor(id) {
|
|
166
|
-
await this.resolve(id);
|
|
167
|
-
return STANDING_KEY;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
})();
|
|
171
|
-
export { SingleCodexPresetRoster };
|
|
9
|
+
/**
|
|
10
|
+
* Register the fixed preset into the host `AgentPresetRegistry` once the
|
|
11
|
+
* service is up. Registration failure keeps the roster row visible as
|
|
12
|
+
* `broken` inside the registry (upstream owns that lifecycle) — the adapter
|
|
13
|
+
* only owns the disposer.
|
|
14
|
+
*/
|
|
15
|
+
export function registerCodexPreset(ctx) {
|
|
16
|
+
ctx.inject(["agentPresets"], (scoped) => {
|
|
17
|
+
let dispose;
|
|
18
|
+
let settled = false;
|
|
19
|
+
void scoped.agentPresets.register(CODEX_PRESET).then((unregister) => {
|
|
20
|
+
if (settled) {
|
|
21
|
+
void unregister();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
dispose = unregister;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
ctx.effect(() => async () => {
|
|
28
|
+
settled = true;
|
|
29
|
+
await dispose?.();
|
|
30
|
+
}, "codexAdapter.preset");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -2,6 +2,7 @@ import { agentEvents } from "@deepseek-ai/dsh-agent";
|
|
|
2
2
|
import { Inbox } from "./inbox.js";
|
|
3
3
|
import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage, createSystemMessage, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { createScope } from "@deepseek-ai/dsh-scope";
|
|
5
|
+
import { withSystemHead } from "../../superd-hub/dist/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* v2 live assistant-stream publication for the Codex bridge — the same frame
|
|
7
8
|
* protocol the reference loop's AssistantStreamAttempt speaks (start marker,
|
|
@@ -199,8 +200,13 @@ function userMessageText(message) {
|
|
|
199
200
|
* Detect and drop it.
|
|
200
201
|
*/
|
|
201
202
|
function isApprovalNarration(message) {
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
// 0.1.7: the shared `plugin` source kind is gone (MessageSourceMap is
|
|
204
|
+
// merge-extensible; each producer declares its own kind) — user-approval
|
|
205
|
+
// now carries the dedicated `user-approval` kind.
|
|
206
|
+
// Type-only: loads the `user-approval` MessageSourceMap augmentation
|
|
207
|
+
// (0.1.7: producer-owned source kinds; the shared `plugin` kind is gone).
|
|
208
|
+
// noinspection JSValidateTypes
|
|
209
|
+
return message.source.kind === "user-approval";
|
|
204
210
|
}
|
|
205
211
|
/**
|
|
206
212
|
* Reconstruct a Dash user message from a wire `message_start(role=user)`
|
|
@@ -293,7 +299,7 @@ export class CodexAgent {
|
|
|
293
299
|
this.#loopCtx = loopCtx;
|
|
294
300
|
this.id = id;
|
|
295
301
|
this.options = options;
|
|
296
|
-
this.session = session;
|
|
302
|
+
this.session = withSystemHead(session, () => createSystemMessage(""));
|
|
297
303
|
this.#client = client;
|
|
298
304
|
this.#onIdleExit = onIdleExit;
|
|
299
305
|
this.#runtimeInfo = runtimeInfo;
|
|
@@ -501,20 +507,19 @@ export class CodexAgent {
|
|
|
501
507
|
if (this.#runtimeInfo === undefined || !this.#turnOpen)
|
|
502
508
|
return;
|
|
503
509
|
this.#commitStepStart();
|
|
504
|
-
|
|
510
|
+
// commitStepStart re-enters #emitSystemMessage (step open → stamp); the
|
|
511
|
+
// outer call must re-check the one-shot flag after the recursion.
|
|
512
|
+
if (this.#systemMessageDone)
|
|
505
513
|
return;
|
|
506
|
-
if (this
|
|
507
|
-
this.#systemMessageDone = true;
|
|
514
|
+
if (this.#step === 0)
|
|
508
515
|
return;
|
|
509
|
-
}
|
|
510
516
|
const text = this.#runtimeInfo.systemPrompt();
|
|
511
517
|
if (text === undefined || text.trim() === "")
|
|
512
518
|
return;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}, { surfaceOp: "append" });
|
|
519
|
+
// v4 protected-head posture: replace the placeholder head (stamped before
|
|
520
|
+
// the first user message); an append here would corrupt the log for the
|
|
521
|
+
// 0.1.7 reader ("system/message requires a protected first surface head").
|
|
522
|
+
this.session.stampSystemPrompt(this.#dashTurn, this.#step, createSystemMessage(text));
|
|
518
523
|
this.#systemMessageDone = true;
|
|
519
524
|
trace(`system/message stamped (${text.length} chars)`);
|
|
520
525
|
}
|
|
@@ -20,12 +20,6 @@ import { closeSync, openSync, readdirSync, readSync, statSync } from "node:fs";
|
|
|
20
20
|
import { homedir } from "node:os";
|
|
21
21
|
import { join, resolve } from "node:path";
|
|
22
22
|
/** Prod homes that must never be resolved into (repo red line). */
|
|
23
|
-
const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
|
|
24
|
-
export function assertNotProdHome(path, label) {
|
|
25
|
-
if (PROD_HOMES.includes(path) || PROD_HOMES.some((p) => path.startsWith(`${p}/`))) {
|
|
26
|
-
throw new Error(`codex-store: refusing prod home as ${label}: ${path}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
23
|
/**
|
|
30
24
|
* Resolve the Codex CLI's app-data home — the NATIVE `~/.codex` (user ruling
|
|
31
25
|
* 2026-09-17, pi precedent): the installed app keeps its own home, so the
|
|
@@ -42,11 +36,9 @@ export function assertNotProdHome(path, label) {
|
|
|
42
36
|
export function resolveCodexHome() {
|
|
43
37
|
if (process.env.CODEX_HOME !== undefined) {
|
|
44
38
|
const env = resolve(process.env.CODEX_HOME);
|
|
45
|
-
assertNotProdHome(env, "codex home");
|
|
46
39
|
return env;
|
|
47
40
|
}
|
|
48
41
|
const native = join(homedir(), ".codex");
|
|
49
|
-
assertNotProdHome(native, "codex home");
|
|
50
42
|
return native;
|
|
51
43
|
}
|
|
52
44
|
/**
|
|
@@ -56,7 +48,6 @@ export function resolveCodexHome() {
|
|
|
56
48
|
*/
|
|
57
49
|
export function useCodexHome(path) {
|
|
58
50
|
const resolved = resolve(path);
|
|
59
|
-
assertNotProdHome(resolved, "codex home");
|
|
60
51
|
return resolved;
|
|
61
52
|
}
|
|
62
53
|
/** Bounded read budget: `session_meta` is the FIRST line, so this is generous. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* agent-codex provider — Codex provider plugin for DeepSeek Harness
|
|
3
|
-
* (
|
|
3
|
+
* (Super D, SDK line).
|
|
4
4
|
*
|
|
5
5
|
* Replaces the built-in agent loop with an `AgentFactory` that drives
|
|
6
6
|
* `@openai/codex-sdk` threads (one `CodexSdkClient` per session) and bridges
|
|
@@ -22,13 +22,12 @@
|
|
|
22
22
|
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
23
23
|
import { join } from "node:path";
|
|
24
24
|
import { Service } from "@deepseek-ai/cordis";
|
|
25
|
-
import {
|
|
25
|
+
import { installModelSelection } from "@deepseek-ai/dsh-agent";
|
|
26
26
|
import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
|
|
27
27
|
import { CodexSdkClient } from "./codex-client.js";
|
|
28
28
|
import { CodexAgent } from "./agent.js";
|
|
29
29
|
import { CodexLlmAdapter, CODEX_PROVIDER_ID } from "./adapter.js";
|
|
30
|
-
import {
|
|
31
|
-
import { codexAgentPresetProjection } from "./agent-preset-projection.js";
|
|
30
|
+
import { registerCodexPreset } from "./agent-preset-codex.js";
|
|
32
31
|
import { readRolloutHead, resolveCodexHome } from "./codex-store.js";
|
|
33
32
|
import { CodexResumeError, sessionRecord, upsertSession } from "./session-map.js";
|
|
34
33
|
import { readCodexModelCatalog, CODEX_DEFAULT_MODEL_PLACEHOLDER } from "./models.js";
|
|
@@ -102,15 +101,12 @@ export class CodexProvider extends Service {
|
|
|
102
101
|
// from the gateway and every agentPresets/* call 404s. Register it on
|
|
103
102
|
// this plugin's own (top-level) fiber instead — its Service constructor
|
|
104
103
|
// ties teardown to this fiber via reflect.provide.
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
ctx.inject(["sessionProjections"], (scoped) => {
|
|
112
|
-
scoped.sessionProjections.register(codexAgentPresetProjection);
|
|
113
|
-
});
|
|
104
|
+
// 0.1.7: roster/selection/document RPC + the `agentPreset` session
|
|
105
|
+
// projection all live in the host AgentPresetRegistry (mounted by the
|
|
106
|
+
// dsh-web-app bundle's `agent-preset-registry` row; the adapter patch
|
|
107
|
+
// pins its `default` to the Codex preset). The adapter only registers
|
|
108
|
+
// its one fixed preset into the registry.
|
|
109
|
+
registerCodexPreset(ctx);
|
|
114
110
|
}
|
|
115
111
|
/**
|
|
116
112
|
* The factory owns its sessions' route (user directive 2026-09-15): the
|
|
@@ -209,7 +205,7 @@ export class CodexProvider extends Service {
|
|
|
209
205
|
if (typeof resolved === "string" && resolved !== "")
|
|
210
206
|
return resolved;
|
|
211
207
|
}
|
|
212
|
-
return process.env.DSH_HOME ?? join(process.cwd(), ".tests", "
|
|
208
|
+
return process.env.DSH_HOME ?? join(process.cwd(), ".tests", "superd");
|
|
213
209
|
}
|
|
214
210
|
/**
|
|
215
211
|
* App-wide wiring the adapter owns (user 2026-09-15): the SDK has no
|
|
@@ -553,8 +549,9 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
|
|
|
553
549
|
agent.ctx.sessions.announce(session);
|
|
554
550
|
}
|
|
555
551
|
detachAgent = loopCtx.agents.enter(agent, parentAgent);
|
|
556
|
-
|
|
557
|
-
|
|
552
|
+
// 0.1.6: announce(agent, source) is required, async, and emits agent/created
|
|
553
|
+
// itself — the manual agent/session-start emission is gone upstream.
|
|
554
|
+
await loopCtx.agents.announce(agent, source);
|
|
558
555
|
let disposed = false;
|
|
559
556
|
let unfollowOwner;
|
|
560
557
|
const dispose = async () => {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
21
21
|
import { dirname, join, resolve } from "node:path";
|
|
22
|
-
import { assertNotProdHome } from "./codex-store.js";
|
|
23
22
|
/** An `Error` carrying a stable {@link CodexResumeErrorCode}. */
|
|
24
23
|
export class CodexResumeError extends Error {
|
|
25
24
|
code;
|
|
@@ -35,17 +34,15 @@ export class CodexResumeError extends Error {
|
|
|
35
34
|
* (`<dshHome>/agents/codex`), never the codex app home. Precedence: explicit
|
|
36
35
|
* world home (boot-provided `dshHomePath`), then `$DSH_HOME` (a hub home, so
|
|
37
36
|
* the world layout nests `agents/codex`), then the line's historical test-home
|
|
38
|
-
* default.
|
|
37
|
+
* default.
|
|
39
38
|
*/
|
|
40
39
|
export function resolveCodexStateDir(home) {
|
|
41
40
|
if (home !== undefined) {
|
|
42
41
|
const dir = resolve(home);
|
|
43
|
-
assertNotProdHome(dir, "codex state dir");
|
|
44
42
|
return dir;
|
|
45
43
|
}
|
|
46
|
-
const fallbackHome = resolve(process.env.DSH_HOME ?? join(process.cwd(), ".tests", "
|
|
44
|
+
const fallbackHome = resolve(process.env.DSH_HOME ?? join(process.cwd(), ".tests", "superd"));
|
|
47
45
|
const dir = join(fallbackHome, "agents", "codex");
|
|
48
|
-
assertNotProdHome(dir, "codex state dir");
|
|
49
46
|
return dir;
|
|
50
47
|
}
|
|
51
48
|
/** The map file's path at the world DSH-home root. */
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* agent-codex — the Codex adapter's WORLD plugin (spec S2):
|
|
3
3
|
* activation IS roster membership.
|
|
4
4
|
*
|
|
5
|
-
* AW-B
|
|
6
|
-
* so the hub sees both foreign runtimes through
|
|
7
|
-
* as a sibling ROOT context with NO listener
|
|
8
|
-
*
|
|
5
|
+
* AW-B data-plane shape (DL1–DL5 → path-separation T-D), mirroring
|
|
6
|
+
* `@pgmi-builds/agent-omp/world` so the hub sees both foreign runtimes through
|
|
7
|
+
* one shape: the world is spawned as a sibling ROOT context with NO listener
|
|
8
|
+
* and NO webui composition (`worldMountPatches`) — a pure data plane behind
|
|
9
|
+
* the hub's `/hub` family —
|
|
9
10
|
*
|
|
10
|
-
* 1. ctx0 publishes the host mount (
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* 1. ctx0 publishes the host mount record (the world's addressability
|
|
12
|
+
* entry — no webServer, no fence: those legs retired with the world
|
|
13
|
+
* pages) before spawn;
|
|
14
|
+
* 2. the world's entry row provides the virtual `webServer` (a silent
|
|
15
|
+
* sink) plus the neutral `webRuntime` facts its connection row injects;
|
|
16
|
+
* 3. the hub's `/hub` family answers `?agent=codex` traffic in ctx0's auth
|
|
17
|
+
* domain and dispatches into this world's gateway instance (the
|
|
18
|
+
* per-label `/<label>/api` + `/<label>/api/remote.mux` mounts retired
|
|
19
|
+
* in T-C, `mountWorld` deleted in T-D).
|
|
15
20
|
*/
|
|
16
21
|
import { mkdirSync } from 'node:fs';
|
|
17
22
|
import { resolveDshHome } from '@deepseek-ai/dsh-home-paths';
|
|
18
23
|
import { join } from 'node:path';
|
|
19
|
-
import { spawnWorld, registerAgent, setReady, registerForeignTarget, registerHostMount,
|
|
20
|
-
export const name = '
|
|
24
|
+
import { spawnWorld, registerAgent, setReady, registerForeignTarget, registerHostMount, worldMountPatches, provisionWorldProfile, resolveInstallAnchor, } from '../../superd-hub/dist/index.js';
|
|
25
|
+
export const name = 'agent-codex';
|
|
21
26
|
/** Runtime key — also the mount label. */
|
|
22
27
|
const KEY = 'codex';
|
|
23
|
-
const ANCHOR = process.env.SUPERD_DSH_ANCHOR
|
|
24
|
-
?? '/home/u1/.local/lib/node_modules/@deepseek-ai/dsh/package.json';
|
|
25
28
|
export function apply(ctx) {
|
|
26
29
|
registerAgent({ key: KEY, label: 'Codex', ready: false });
|
|
27
30
|
// Harness resolver (env → ~/.dsh): a consumer install has no DSH_HOME and
|
|
@@ -34,57 +37,34 @@ export function apply(ctx) {
|
|
|
34
37
|
const worldHome = join(root, 'agents', KEY);
|
|
35
38
|
mkdirSync(join(worldHome, 'profiles'), { recursive: true });
|
|
36
39
|
// Publish story: a foreign install has no line bootstrap, so the nested
|
|
37
|
-
// profile + @pgmi-builds links are provisioned HERE (idempotent
|
|
38
|
-
|
|
39
|
-
// overrides the resolved base).
|
|
40
|
-
const bareBase = provisionWorldProfile({
|
|
40
|
+
// profile + @pgmi-builds links are provisioned HERE (idempotent).
|
|
41
|
+
provisionWorldProfile({
|
|
41
42
|
key: KEY,
|
|
42
|
-
adapterPkg: '@pgmi-builds/agent-
|
|
43
|
+
adapterPkg: '@pgmi-builds/agent-codex',
|
|
43
44
|
worldHome,
|
|
44
45
|
});
|
|
45
46
|
const world = (async () => {
|
|
46
|
-
//
|
|
47
|
-
// the
|
|
48
|
-
const
|
|
49
|
-
ctx.inject(['webServer', 'connection'], (hostCtx) => { resolve(hostCtx); });
|
|
50
|
-
});
|
|
51
|
-
const real = host['webServer'];
|
|
52
|
-
const connection = host['connection'];
|
|
53
|
-
const dropHostMount = registerHostMount({
|
|
54
|
-
key: KEY,
|
|
55
|
-
labelPath: `/${KEY}`,
|
|
56
|
-
real,
|
|
57
|
-
// ctx0's index gate, applied by the mount to this world's pages and assets:
|
|
58
|
-
// the world is reached in-ctx and owns no listener, so ctx0 decides auth.
|
|
59
|
-
authorize: (req, res) => connection.authorizeIndex(req, res),
|
|
60
|
-
});
|
|
47
|
+
// T-D: no ctx0 listening-stack wait — the mount record is addressability
|
|
48
|
+
// only and the /hub family wires its own gate in ctx0 (gateway.ts).
|
|
49
|
+
const dropHostMount = registerHostMount({ key: KEY, labelPath: `/${KEY}` });
|
|
61
50
|
const ctxW = await spawnWorld({
|
|
62
|
-
appName: `
|
|
51
|
+
appName: `superd-${KEY}`,
|
|
63
52
|
profileName: 'web',
|
|
64
|
-
installAnchor:
|
|
53
|
+
installAnchor: resolveInstallAnchor(ctx), // lazy: never at module scope — import must stay side-effect-free
|
|
65
54
|
home: worldHome,
|
|
66
55
|
dataHome: worldHome,
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
bareModuleBaseUrl: process.env.AW_BARE_BASE ?? bareBase ?? undefined,
|
|
56
|
+
// The host's live table carries this world: spawnWorld republishes a
|
|
57
|
+
// widened successor before boot imports anything (spec §2.1), and
|
|
58
|
+
// @pgmi-builds rows resolve from the profile-local links written above.
|
|
59
|
+
host: ctx,
|
|
72
60
|
extraPatches: worldMountPatches(KEY),
|
|
73
61
|
});
|
|
74
62
|
const gateway = ctxW.get('typertGateway');
|
|
75
63
|
registerForeignTarget({ key: KEY, gateway });
|
|
76
|
-
const mounted = mountWorld({
|
|
77
|
-
real,
|
|
78
|
-
label: KEY,
|
|
79
|
-
gateway,
|
|
80
|
-
requestRejection: (request) => connection
|
|
81
|
-
.requestRejection(request),
|
|
82
|
-
});
|
|
83
64
|
setReady(KEY, true);
|
|
84
65
|
ctx.effect?.(() => () => {
|
|
85
|
-
mounted.dispose();
|
|
86
66
|
dropHostMount();
|
|
87
|
-
}, `
|
|
67
|
+
}, `agent-${KEY}: mount`);
|
|
88
68
|
return ctxW;
|
|
89
69
|
})().catch((cause) => {
|
|
90
70
|
// A failed world degrades to a not-ready roster row; a rejected provided
|
|
@@ -92,5 +72,5 @@ export function apply(ctx) {
|
|
|
92
72
|
console.error(`[super-dsh] ${KEY} world failed:`, cause);
|
|
93
73
|
return null;
|
|
94
74
|
});
|
|
95
|
-
ctx.provide(`
|
|
75
|
+
ctx.provide(`superd.world.${KEY}`, world);
|
|
96
76
|
}
|
package/agent-codex/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@pgmi-builds/agent-
|
|
2
|
+
"name": "@pgmi-builds/agent-codex",
|
|
3
3
|
"version": "0.1.0",
|
|
4
|
-
"description": "Codex provider for DeepSeek Harness (dsh) — an AgentFactory that embeds Codex CLI via the @openai/codex-sdk and bridges Codex's session surface into Dash Agent/Session contracts
|
|
4
|
+
"description": "Codex provider for DeepSeek Harness (dsh) — an AgentFactory that embeds Codex CLI via the @openai/codex-sdk and bridges Codex's session surface into Dash Agent/Session contracts .",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@openai/codex": "0.154.0",
|
|
26
26
|
"@openai/codex-sdk": "0.154.0",
|
|
27
|
-
"
|
|
28
|
-
"zod": "3.25.76"
|
|
27
|
+
"zod": "4.4.3"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
31
30
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
32
|
-
"@deepseek-ai/dsh-agent": "0.1.5-
|
|
33
|
-
"@deepseek-ai/dsh-agent-presets": "0.1.5-
|
|
34
|
-
"@deepseek-ai/dsh-llm": "0.1.5-
|
|
35
|
-
"@deepseek-ai/dsh-scope": "0.1.5-
|
|
36
|
-
"@deepseek-ai/dsh-session": "0.1.5-
|
|
37
|
-
"@deepseek-ai/dsh-session-persistence": "0.1.5-
|
|
38
|
-
"@deepseek-ai/dsh-typert-protocol": "0.1.5-
|
|
31
|
+
"@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
|
|
32
|
+
"@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
|
|
33
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
|
|
34
|
+
"@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
|
|
35
|
+
"@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
|
|
36
|
+
"@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
|
|
37
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
|
|
38
|
+
"@pgmi-builds/superd-hub": "*"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@deepseek-ai/cordis": {
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
},
|
|
62
62
|
"@deepseek-ai/dsh-typert-protocol": {
|
|
63
63
|
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"@pgmi-builds/superd-hub": {
|
|
66
|
+
"optional": true
|
|
64
67
|
}
|
|
65
68
|
},
|
|
66
69
|
"devDependencies": {
|
package/agent-hermes/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# @pgmi-builds/agent-
|
|
1
|
+
# @pgmi-builds/agent-hermes
|
|
2
2
|
|
|
3
3
|
Hermes provider for DeepSeek Harness (dsh) — an AgentFactory that embeds the
|
|
4
4
|
Nous Research Hermes Agent via the TUI gateway JSON-RPC (`python -m
|
|
5
5
|
tui_gateway.entry`) and bridges its session surface into Dash Agent/Session
|
|
6
|
-
contracts (
|
|
7
|
-
`docs/superpowers/plans/2026-09-17-
|
|
6
|
+
contracts (Super D; parity round 2026-09-17 = Task M1 of
|
|
7
|
+
`docs/superpowers/plans/2026-09-17-superd-five-adapter-parity-fixes.md`).
|
|
8
8
|
|
|
9
9
|
## Layout
|
|
10
10
|
|
|
@@ -128,17 +128,18 @@ DSH_HOME=<repo>/.tests node --test test/*.test.mjs
|
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
All unit/fixture tests fake the gateway child (`setGatewayFactory`) — no real
|
|
131
|
-
python child in
|
|
132
|
-
|
|
131
|
+
python child in any test (the opt-in live suite was retired with the
|
|
132
|
+
2026-09-24 scenario retirement; whole-plugin scenarios run on the superd
|
|
133
|
+
4999 pack line).
|
|
133
134
|
|
|
134
135
|
## Trap: `npm install` materializes the hub link
|
|
135
136
|
|
|
136
|
-
This package depends on `@pgmi-builds/
|
|
137
|
+
This package depends on `@pgmi-builds/superd-hub` via `file:../superd-hub`. A
|
|
137
138
|
bare `npm install` replaces the symlink with a PHYSICAL copy → a second hub
|
|
138
139
|
instance in the same process → every world webServer stays `pending` forever.
|
|
139
140
|
After any `npm install` here, re-link it:
|
|
140
141
|
|
|
141
142
|
```bash
|
|
142
|
-
rm -rf node_modules/@pgmi-builds/
|
|
143
|
-
ln -s ../../../../
|
|
143
|
+
rm -rf node_modules/@pgmi-builds/superd-hub
|
|
144
|
+
ln -s ../../../../super-dsh/superd-hub node_modules/@pgmi-builds/superd-hub
|
|
144
145
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @pgmi-builds/agent-
|
|
1
|
+
# @pgmi-builds/agent-hermes bundle patch (TUI-gateway line, standalone form).
|
|
2
2
|
# This file is the `dsh.bundle.patch` layer of the adapter package: when the
|
|
3
3
|
# hermes world profile mounts the bundle, the boot merges THIS patch — mount
|
|
4
4
|
# the Hermes provider plus disable the native components it replaces.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# single `hermes` route (gateway model.options, TTL-cached).
|
|
16
16
|
- insert:
|
|
17
17
|
- id: hermes-provider
|
|
18
|
-
name: '@pgmi-builds/agent-
|
|
18
|
+
name: '@pgmi-builds/agent-hermes'
|
|
19
19
|
|
|
20
20
|
# Hermes owns the live agent transcript (the gateway's session state); the
|
|
21
21
|
# built-in loop must not double-run alongside the gateway child — the
|
|
@@ -33,8 +33,12 @@
|
|
|
33
33
|
|
|
34
34
|
# Hermes is single-mode: the gateway drives tools itself, so no Dash preset
|
|
35
35
|
# composition is needed (the provider ships the fixed single-preset roster).
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
# 0.1.7: the host AgentPresetRegistry row (renamed `agent-presets` ->
|
|
37
|
+
# `agent-preset-registry`) stays MOUNTED — the adapter registers its one
|
|
38
|
+
# fixed preset into it (src/agent-preset-hermes.ts); pin only the default.
|
|
39
|
+
- id: agent-preset-registry
|
|
40
|
+
config:
|
|
41
|
+
default: hermes
|
|
38
42
|
|
|
39
43
|
# The upstream jsonl persistence row STAYS MOUNTED (2026-09-17): the provider
|
|
40
44
|
# writes the DSH session log through it (create/open/append/close), and that
|