super-dsh 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +9 -8
  2. package/agent-agy/cordis.patch.yml +8 -4
  3. package/agent-agy/dist/agent-preset-agy.d.ts +23 -43
  4. package/agent-agy/dist/agent-preset-agy.js +29 -166
  5. package/agent-agy/dist/agent.d.ts +2 -1
  6. package/agent-agy/dist/agent.js +3 -2
  7. package/agent-agy/dist/agy-sessions.d.ts +2 -1
  8. package/agent-agy/dist/agy-sessions.js +2 -11
  9. package/agent-agy/dist/index.js +13 -12
  10. package/agent-agy/dist/world-plugin.d.ts +2 -1
  11. package/agent-agy/dist/world-plugin.js +16 -21
  12. package/agent-agy/package.json +6 -6
  13. package/agent-claude/cordis.patch.yml +8 -4
  14. package/agent-claude/dist/agent-preset-claude.js +29 -166
  15. package/agent-claude/dist/agent.js +10 -10
  16. package/agent-claude/dist/claude-client.js +22 -3
  17. package/agent-claude/dist/claude-home.js +0 -8
  18. package/agent-claude/dist/index.js +12 -15
  19. package/agent-claude/dist/session-map.js +2 -5
  20. package/agent-claude/dist/world-plugin.js +3 -3
  21. package/agent-claude/package.json +9 -9
  22. package/agent-codex/README.md +8 -8
  23. package/agent-codex/cordis.patch.yml +9 -5
  24. package/agent-codex/dist/agent-preset-codex.js +29 -168
  25. package/agent-codex/dist/agent.js +17 -12
  26. package/agent-codex/dist/codex-store.js +0 -9
  27. package/agent-codex/dist/index.js +13 -16
  28. package/agent-codex/dist/session-map.js +2 -5
  29. package/agent-codex/dist/world-plugin.js +15 -20
  30. package/agent-codex/package.json +14 -11
  31. package/agent-hermes/README.md +9 -8
  32. package/agent-hermes/cordis.patch.yml +8 -4
  33. package/agent-hermes/dist/agent-preset-hermes.js +29 -168
  34. package/agent-hermes/dist/agent.js +33 -19
  35. package/agent-hermes/dist/hermes-client.js +5 -5
  36. package/agent-hermes/dist/hermes-store.js +2 -11
  37. package/agent-hermes/dist/index.js +13 -12
  38. package/agent-hermes/dist/world-plugin.js +16 -21
  39. package/agent-hermes/package.json +14 -11
  40. package/agent-omp/README.md +2 -2
  41. package/agent-omp/cordis.patch.yml +12 -7
  42. package/agent-omp/dist/agent-preset-omp.js +30 -169
  43. package/agent-omp/dist/agent.js +13 -5
  44. package/agent-omp/dist/index.js +12 -22
  45. package/agent-omp/dist/mobile/gesture.js +2 -2
  46. package/agent-omp/dist/mobile/zoom-guard.js +4 -4
  47. package/agent-omp/dist/mobile-boot.js +2 -2
  48. package/agent-omp/dist/omp-cli.js +1 -1
  49. package/agent-omp/dist/omp-disk-discovery.js +1 -1
  50. package/agent-omp/dist/protocol.js +1 -1
  51. package/agent-omp/dist/sidecar-client.js +1 -1
  52. package/agent-omp/dist/world-plugin.js +22 -19
  53. package/agent-omp/package.json +18 -14
  54. package/agent-omp/sidecar/main.ts +2 -2
  55. package/agent-pi/README.md +5 -5
  56. package/agent-pi/cordis.patch.yml +8 -4
  57. package/agent-pi/dist/agent-preset-pi.js +29 -166
  58. package/agent-pi/dist/agent.js +18 -12
  59. package/agent-pi/dist/index.js +14 -16
  60. package/agent-pi/dist/pi-home.js +2 -12
  61. package/agent-pi/dist/world-plugin.js +16 -21
  62. package/agent-pi/package.json +14 -11
  63. package/cordis.patch.yml +31 -21
  64. package/package.json +30 -38
  65. package/{agent-hub → superd-hub}/cordis.patch.yml +3 -3
  66. package/{agent-hub → superd-hub}/dist/carrier.d.ts +9 -3
  67. package/{agent-hub → superd-hub}/dist/carrier.js +29 -3
  68. package/{agent-hub → superd-hub}/dist/gateway.d.ts +2 -2
  69. package/{agent-hub → superd-hub}/dist/gateway.js +1 -1
  70. package/{agent-hub → superd-hub}/dist/index.d.ts +5 -3
  71. package/{agent-hub → superd-hub}/dist/index.js +5 -3
  72. package/{agent-hub → superd-hub}/dist/roster.d.ts +2 -2
  73. package/{agent-hub → superd-hub}/dist/rpc.js +1 -1
  74. package/{agent-hub → superd-hub}/dist/spawn-world.d.ts +27 -6
  75. package/superd-hub/dist/spawn-world.js +277 -0
  76. package/superd-hub/dist/system-head.d.ts +69 -0
  77. package/superd-hub/dist/system-head.js +194 -0
  78. package/superd-hub/dist/web-trust.d.ts +112 -0
  79. package/superd-hub/dist/web-trust.js +126 -0
  80. package/{agent-hub → superd-hub}/dist/world-entry.d.ts +2 -2
  81. package/{agent-hub → superd-hub}/dist/world-entry.js +4 -4
  82. package/{agent-hub → superd-hub}/dist/world-host.d.ts +1 -1
  83. package/{agent-hub → superd-hub}/dist/world-join.d.ts +2 -1
  84. package/{agent-hub → superd-hub}/dist/world-join.js +16 -21
  85. package/{agent-hub → superd-hub}/dist/world-mount.d.ts +14 -6
  86. package/{agent-hub → superd-hub}/dist/world-mount.js +28 -7
  87. package/{agent-hub → superd-hub}/dist/world-mux.d.ts +21 -6
  88. package/superd-hub/dist/world-mux.js +392 -0
  89. package/{agent-hub → superd-hub}/dist/world-provision.d.ts +20 -4
  90. package/superd-hub/dist/world-provision.js +196 -0
  91. package/{agent-hub → superd-hub}/dist/world-web-server.js +7 -1
  92. package/{agent-hub → superd-hub}/package.json +9 -16
  93. package/agent-hub/dist/spawn-world.js +0 -72
  94. package/agent-hub/dist/world-mux.js +0 -224
  95. package/agent-hub/dist/world-provision.js +0 -122
  96. package/agent-hub/lib/client/index.js +0 -242
  97. package/client/index.js +0 -242
  98. /package/{agent-hub → superd-hub}/dist/agent-roster.d.ts +0 -0
  99. /package/{agent-hub → superd-hub}/dist/agent-roster.js +0 -0
  100. /package/{agent-hub → superd-hub}/dist/client-shim.d.ts +0 -0
  101. /package/{agent-hub → superd-hub}/dist/client-shim.js +0 -0
  102. /package/{agent-hub → superd-hub}/dist/envelope.d.ts +0 -0
  103. /package/{agent-hub → superd-hub}/dist/envelope.js +0 -0
  104. /package/{agent-hub → superd-hub}/dist/index-pass.d.ts +0 -0
  105. /package/{agent-hub → superd-hub}/dist/index-pass.js +0 -0
  106. /package/{agent-hub → superd-hub}/dist/labels.d.ts +0 -0
  107. /package/{agent-hub → superd-hub}/dist/labels.js +0 -0
  108. /package/{agent-hub → superd-hub}/dist/ownership.d.ts +0 -0
  109. /package/{agent-hub → superd-hub}/dist/ownership.js +0 -0
  110. /package/{agent-hub → superd-hub}/dist/roster.js +0 -0
  111. /package/{agent-hub → superd-hub}/dist/rpc.d.ts +0 -0
  112. /package/{agent-hub → superd-hub}/dist/targets.d.ts +0 -0
  113. /package/{agent-hub → superd-hub}/dist/targets.js +0 -0
  114. /package/{agent-hub → superd-hub}/dist/world-host.js +0 -0
  115. /package/{agent-hub → superd-hub}/dist/world-web-server.d.ts +0 -0
@@ -1,169 +1,32 @@
1
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
- var useValue = arguments.length > 2;
3
- for (var i = 0; i < initializers.length; i++) {
4
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
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 CLAUDE_PRESET = Object.freeze({
37
- id: "claude",
38
- trust: "system",
39
- path: "",
1
+ export const CLAUDE_PRESET_ID = "claude";
2
+ /** The single fixed Claude preset: mounting it composes nothing. */
3
+ export const CLAUDE_PRESET = Object.freeze({
4
+ id: CLAUDE_PRESET_ID,
40
5
  name: "Claude",
41
6
  description: "Claude Code via the agent-claude adapter",
7
+ plugins: Object.freeze([]),
42
8
  });
43
- const COMPOSITION_TEXT = [
44
- "# Claude (fixed roster)",
45
- "",
46
- "This deployment runs exactly one agent mode: the Claude provider bridges Dash",
47
- "sessions to a native Claude Code CLI over the official @anthropic-ai/claude-agent-sdk.",
48
- "There is no per-session plugin composition to configure, so this preset",
49
- "mounts nothing.",
50
- "",
51
- "rows: []",
52
- "",
53
- ].join("\n");
54
- /** The standing scope key every `claude` session reads presenters through. */
55
- const STANDING_KEY = {};
56
- let SingleClaudePresetRoster = (() => {
57
- let _classSuper = TypertRemoteService;
58
- let _instanceExtraInitializers = [];
59
- let _remoteList_decorators;
60
- let _remoteRead_decorators;
61
- let _remoteCopy_decorators;
62
- let _remoteDelete_decorators;
63
- let _remoteSelect_decorators;
64
- return class SingleClaudePresetRoster extends _classSuper {
65
- static {
66
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
67
- _remoteList_decorators = [Remote("list")];
68
- _remoteRead_decorators = [Remote("read")];
69
- _remoteCopy_decorators = [Remote("copy")];
70
- _remoteDelete_decorators = [Remote("deletePreset")];
71
- _remoteSelect_decorators = [Remote("select")];
72
- __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);
73
- __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);
74
- __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);
75
- __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);
76
- __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);
77
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
78
- }
79
- constructor(ctx) {
80
- super(ctx, "agentPresets");
81
- __runInitializers(this, _instanceExtraInitializers);
82
- }
83
- get defaultId() {
84
- return CLAUDE_PRESET.id;
85
- }
86
- get roots() {
87
- return [];
88
- }
89
- get authorable() {
90
- return false;
91
- }
92
- async list() {
93
- return [CLAUDE_PRESET];
94
- }
95
- async resolve(id) {
96
- if (id === undefined || id === CLAUDE_PRESET.id)
97
- return CLAUDE_PRESET;
98
- throw new RemoteError("agent-preset/not-found", `agent-presets: preset "${id}" not found (available: claude)`, { agentPreset: id, available: [CLAUDE_PRESET.id] });
99
- }
100
- async mount(_agentCtx, id) {
101
- return this.resolve(id);
102
- }
103
- async recompose(_agentCtx, id) {
104
- return this.resolve(id);
105
- }
106
- async read(id) {
107
- await this.resolve(id);
108
- return COMPOSITION_TEXT;
109
- }
110
- // ── Remote RPC surface (alpha: agentPresets routes come from @Remote) ────
111
- async remoteList() {
112
- if (process.env.CLAUDE_TRACE === "1")
113
- process.stderr.write("[claude-roster] remoteList INVOKED\n");
114
- return {
115
- presets: [
116
- {
117
- id: CLAUDE_PRESET.id,
118
- trust: CLAUDE_PRESET.trust,
119
- isDefault: true,
120
- name: CLAUDE_PRESET.name,
121
- description: CLAUDE_PRESET.description,
122
- },
123
- ],
124
- authorable: this.authorable,
125
- };
126
- }
127
- async remoteRead(agentPreset) {
128
- const preset = await this.resolve(agentPreset);
129
- return {
130
- agentPreset: preset.id,
131
- trust: preset.trust,
132
- content: await this.read(preset.id),
133
- name: preset.name,
134
- description: preset.description,
135
- };
136
- }
137
- async remoteCopy(from, id, name) {
138
- await this.copy(from, id, name);
139
- }
140
- async remoteDelete(id) {
141
- await this.remove(id);
142
- }
143
- /** Fixed roster: one preset, so selecting it is a no-op ack; anything else is unknown. */
144
- async remoteSelect(agent, agentPreset) {
145
- const preset = await this.resolve(agentPreset);
146
- return preset.id;
147
- }
148
- async copy(_from, id, _name) {
149
- throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Claude roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Claude roster is fixed and ships exactly one preset" });
150
- }
151
- async remove(id) {
152
- throw new RemoteError("agent-preset/read-only", `agent-presets: preset "${id}" cannot be written: the Claude roster is fixed and ships exactly one preset`, { agentPreset: id, reason: "the Claude roster is fixed and ships exactly one preset" });
153
- }
154
- serviceFor(_agent, _name) {
155
- return undefined;
156
- }
157
- composeFrom(_agentCtx, _parentCtx) {
158
- return undefined;
159
- }
160
- composedPreset(_agentCtx) {
161
- return CLAUDE_PRESET.id;
162
- }
163
- async standingKeyFor(id) {
164
- await this.resolve(id);
165
- return STANDING_KEY;
166
- }
167
- };
168
- })();
169
- export { SingleClaudePresetRoster };
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 registerClaudePreset(ctx) {
16
+ ctx.inject(["agentPresets"], (scoped) => {
17
+ let dispose;
18
+ let settled = false;
19
+ void scoped.agentPresets.register(CLAUDE_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
+ }, "claudeAdapter.preset");
31
+ });
32
+ }
@@ -47,6 +47,7 @@ import { resetProjectionState } from "./claude-events.js";
47
47
  import { CLAUDE_PROVIDER_ID } from "./adapter.js";
48
48
  import { claudePermissionMode, presetFromEvents } from "./permission.js";
49
49
  import { catalogFromInit, modelEntryFromSdk, readModelCatalog, setModelCatalog } from "./models.js";
50
+ import { withSystemHead } from "../../superd-hub/dist/index.js";
50
51
  import { registerClaudeCommands, slashCommandsFromReported, } from "./commands.js";
51
52
  /** Diagnostic trace (set CLAUDE_TRACE=1 on the dsh process to enable). */
52
53
  const TRACE = process.env.CLAUDE_TRACE === "1";
@@ -298,7 +299,7 @@ export class ClaudeAgent {
298
299
  this.loopCtx = loopCtx;
299
300
  this.id = id;
300
301
  this.options = options;
301
- this.session = session;
302
+ this.session = withSystemHead(session, () => createSystemMessage(""));
302
303
  this.client = client;
303
304
  this.onIdleExit = onIdleExit;
304
305
  this.runtimeInfo = runtimeInfo;
@@ -715,12 +716,12 @@ export class ClaudeAgent {
715
716
  if (!this.turnOpen)
716
717
  return;
717
718
  this.commitStepStart();
718
- if (!this.stepOpen)
719
+ // commitStepStart re-enters emitSystemMessage (step open → stamp); the
720
+ // outer call must re-check the one-shot flag after the recursion.
721
+ if (this.systemMessageDone)
719
722
  return;
720
- if (this.session.snapshotEvents().some((event) => event.type === "system/message")) {
721
- this.systemMessageDone = true;
723
+ if (!this.stepOpen)
722
724
  return;
723
- }
724
725
  const model = this.observedMessageModel || this.observedDefaultModel || this.options.model || "unknown";
725
726
  const mode = this.runtimeInfo?.claudeMode ?? claudePermissionMode(presetFromEvents(this.session.snapshotEvents()));
726
727
  const text = [
@@ -730,11 +731,10 @@ export class ClaudeAgent {
730
731
  `- cwd: ${this.client.cwd}`,
731
732
  `- permission mode: ${mode}`,
732
733
  ].join("\n");
733
- this.session.append("system/message", {
734
- turn: this.dashTurn,
735
- step: this.step,
736
- message: createSystemMessage(text, "aw.agent-adapter-claude"),
737
- }, { surfaceOp: "append" });
734
+ // v4 protected-head posture: replace the placeholder head (stamped before
735
+ // the first user message); an append here would corrupt the log for the
736
+ // 0.1.7 reader ("system/message requires a protected first surface head").
737
+ this.session.stampSystemPrompt(this.dashTurn, this.step, createSystemMessage(text));
738
738
  this.systemMessageDone = true;
739
739
  trace(`system/message stamped (${text.length} chars)`);
740
740
  }
@@ -54,16 +54,35 @@
54
54
  * every push is queued in order and there is no separate follow-up channel.
55
55
  * `steer` differs by pushing with `priority: "now"`.
56
56
  */
57
+ import { existsSync } from "node:fs";
58
+ import { homedir } from "node:os";
59
+ import { join } from "node:path";
57
60
  import { query as officialQuery } from "@anthropic-ai/claude-agent-sdk";
58
61
  import { InputQueue } from "./input-queue.js";
59
62
  import { projectClaudeEvent } from "./claude-events.js";
60
- /** Host Claude Code binary driven through the SDK's bridge (spec ruling R5). */
61
- export const DEFAULT_CLAUDE_EXECUTABLE = "/home/u1/.local/bin/claude";
63
+ /** Host Claude Code binary driven through the SDK bridge (spec ruling R5).
64
+ * PATH-resolved like any host CLI: $CLAUDE_EXECUTABLE wins, else a bare
65
+ * "claude" the SDK spawns through PATH. No machine-specific path ships. */
66
+ export const DEFAULT_CLAUDE_EXECUTABLE = "claude";
62
67
  const defaultFactory = (o) => officialQuery({
63
68
  prompt: o.prompt,
64
69
  options: o.options,
65
70
  });
66
- const defaultExecutableResolver = () => process.env.CLAUDE_EXECUTABLE ?? DEFAULT_CLAUDE_EXECUTABLE;
71
+ const defaultExecutableResolver = () => process.env.CLAUDE_EXECUTABLE ?? resolveClaudeExecutable();
72
+ /** PATH first, then the common native-installer locations (a service unit
73
+ * PATH may not include ~/.local/bin — dev3 2026-09-22: "native binary not
74
+ * found at claude" mid-session). */
75
+ function resolveClaudeExecutable() {
76
+ for (const dir of (process.env.PATH ?? "").split(":").filter(Boolean)) {
77
+ if (existsSync(join(dir, "claude")))
78
+ return DEFAULT_CLAUDE_EXECUTABLE;
79
+ }
80
+ for (const candidate of [join(homedir(), ".local/bin/claude"), "/usr/local/bin/claude"]) {
81
+ if (existsSync(candidate))
82
+ return candidate;
83
+ }
84
+ return DEFAULT_CLAUDE_EXECUTABLE;
85
+ }
67
86
  let factory = defaultFactory;
68
87
  let executableResolver = defaultExecutableResolver;
69
88
  let refcount = 0;
@@ -9,14 +9,7 @@
9
9
  */
10
10
  import { homedir } from "node:os";
11
11
  import { join, resolve } from "node:path";
12
- const PROD_HOMES = [join(homedir(), ".dsh"), join(homedir(), ".superd")];
13
12
  /** Refuse any path that resolves into a production DSH home (repo red line). */
14
- export function assertNotProdHome(path, label) {
15
- const p = resolve(path);
16
- if (PROD_HOMES.includes(p) || PROD_HOMES.some((prod) => p.startsWith(`${prod}/`))) {
17
- throw new Error(`agent-claude: refusing prod home "${p}" for ${label} — set DSH_HOME to the test home`);
18
- }
19
- }
20
13
  /**
21
14
  * The Claude app home: the NATIVE `~/.claude`, prod-home guarded. An ambient
22
15
  * `CLAUDE_CONFIG_DIR` wins (tests pin an isolated home that way); the adapter
@@ -24,6 +17,5 @@ export function assertNotProdHome(path, label) {
24
17
  */
25
18
  export function resolveClaudeHome() {
26
19
  const claudeHome = resolve(process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude"));
27
- assertNotProdHome(claudeHome, "claudeHome");
28
20
  return claudeHome;
29
21
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * agent-claude provider — Claude Code provider plugin for DeepSeek Harness
3
- * (Agent Worlds, standalone SDK line).
3
+ * (Super D, standalone SDK line).
4
4
  *
5
5
  * Replaces the built-in agent loop with an `AgentFactory` that drives one
6
6
  * `ClaudeSdkClient` (a per-session Claude Agent SDK bridge) and bridges the
@@ -22,7 +22,6 @@
22
22
  import { realpathSync, statSync } from "node:fs";
23
23
  import { join } from "node:path";
24
24
  import { Service } from "@deepseek-ai/cordis";
25
- import { emitAgentEvent } from "@deepseek-ai/dsh-agent";
26
25
  import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
27
26
  import { ClaudeSdkClient, probeClaudeModels } from "./claude-client.js";
28
27
  import { ClaudeAgent } from "./agent.js";
@@ -34,8 +33,7 @@ import { claudePermissionMode, defaultPermissionPreset, modeChangePatch, presetF
34
33
  import { sessionRecord, upsertSession } from "./session-map.js";
35
34
  import { makeCanUseTool, answerAskUserQuestion, askPlanReview, } from "./interaction.js";
36
35
  import { modelEntryFromSdk, readModelCatalog, setModelCatalog, CLAUDE_DEFAULT_MODEL } from "./models.js";
37
- import { SingleClaudePresetRoster } from "./agent-preset-claude.js";
38
- import { claudeAgentPresetProjection } from "./agent-preset-projection.js";
36
+ import { registerClaudePreset } from "./agent-preset-claude.js";
39
37
  const CLAUDE_MODES = ["default", "acceptEdits", "bypassPermissions", "plan", "auto", "dontAsk"];
40
38
  /** Narrow an untrusted value to a persisted Claude permission mode. */
41
39
  function isClaudeMode(raw) {
@@ -134,14 +132,12 @@ export class ClaudeProvider extends Service {
134
132
  // @Remote routes from the gateway and every agentPresets/* call 404s (the
135
133
  // omp/pi registration lesson). Register it on this plugin's own
136
134
  // (top-level) fiber instead — next to setFactory, never under ctx.plugin.
137
- new SingleClaudePresetRoster(ctx);
138
- // Drive the `agentPreset` session projection ourselves: the upstream
139
- // registrant lives in the (patch-disabled) dsh-agent-presets package, but
140
- // the Web UI gates the preset chip and header label on
141
- // `projectionValues.agentPreset`.
142
- ctx.inject(["sessionProjections"], (scoped) => {
143
- scoped.sessionProjections.register(claudeAgentPresetProjection);
144
- });
135
+ // 0.1.7: roster/selection/document RPC + the `agentPreset` session
136
+ // projection all live in the host AgentPresetRegistry (mounted by the
137
+ // dsh-web-app bundle's `agent-preset-registry` row; the adapter patch
138
+ // pins its `default` to the Claude preset). The adapter only registers
139
+ // its one fixed preset into the registry.
140
+ registerClaudePreset(ctx);
145
141
  this.#registerDefaultModel();
146
142
  this.#probeBootModels();
147
143
  }
@@ -178,7 +174,7 @@ export class ClaudeProvider extends Service {
178
174
  if (typeof resolved === "string" && resolved !== "")
179
175
  return resolved;
180
176
  }
181
- return process.env.DSH_HOME ?? join(process.cwd(), ".tests", "aw");
177
+ return process.env.DSH_HOME ?? join(process.cwd(), ".tests", "superd");
182
178
  }
183
179
  /**
184
180
  * The write path is mandatory (2026-09-16): this factory owns the DSH
@@ -513,8 +509,9 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
513
509
  agent.ctx.sessions.announce(session);
514
510
  }
515
511
  detachAgent = loopCtx.agents.enter(agent, parentAgent);
516
- loopCtx.agents.announce(agent);
517
- emitAgentEvent(loopCtx, agent, "agent/session-start", { source });
512
+ // 0.1.6: announce(agent, source) is required, async, and emits agent/created
513
+ // itself — the manual agent/session-start emission is gone upstream.
514
+ await loopCtx.agents.announce(agent, source);
518
515
  let disposed = false;
519
516
  let unfollowOwner;
520
517
  const dispose = async () => {
@@ -26,23 +26,20 @@
26
26
  */
27
27
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
28
28
  import { dirname, join, resolve } from "node:path";
29
- import { assertNotProdHome } from "./claude-home.js";
30
29
  /**
31
30
  * The adapter's DSH-side state dir — the world's DSH home root
32
31
  * (`<dshHome>/agents/claude`), never the Claude app home. Precedence:
33
32
  * explicit world home (boot-provided `dshHomePath`), then `$DSH_HOME` (a hub
34
33
  * home, so the world layout nests `agents/claude`), then the line's
35
- * historical test-home default. Prod-guarded.
34
+ * historical test-home default.
36
35
  */
37
36
  export function resolveClaudeStateDir(home) {
38
37
  if (home !== undefined) {
39
38
  const dir = resolve(home);
40
- assertNotProdHome(dir, "claude state dir");
41
39
  return dir;
42
40
  }
43
- const fallbackHome = resolve(process.env.DSH_HOME ?? join(process.cwd(), ".tests", "aw"));
41
+ const fallbackHome = resolve(process.env.DSH_HOME ?? join(process.cwd(), ".tests", "superd"));
44
42
  const dir = join(fallbackHome, "agents", "claude");
45
- assertNotProdHome(dir, "claude state dir");
46
43
  return dir;
47
44
  }
48
45
  /** The map file's path at the world DSH-home root. */
@@ -2,12 +2,12 @@
2
2
  * `./world` entry point for a future hub-side packaging step.
3
3
  *
4
4
  * Ruling R2 (2026-09-16): this adapter ships and is verified STANDALONE only.
5
- * Joining the agent-worlds hub is the hub side's job — it packages this entry
5
+ * Joining the super-dsh hub is the hub side's job — it packages this entry
6
6
  * with its own spawn/roster wiring. Nothing here starts a process or reads the
7
7
  * hub; it only exposes the canonical provider row name.
8
8
  */
9
- export const name = 'aw.agent-adapter-claude-world';
10
- export const providerRow = '@pgmi-builds/agent-adapter-claude';
9
+ export const name = 'agent-claude-world';
10
+ export const providerRow = '@pgmi-builds/agent-claude';
11
11
  export function apply() {
12
12
  // Intentionally inert: the standalone bundle patch (cordis.patch.yml) is the
13
13
  // sole mounting path in V1. The hub packages its own insert row via `providerRow`.
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "@pgmi-builds/agent-adapter-claude",
2
+ "name": "@pgmi-builds/agent-claude",
3
3
  "version": "0.1.0",
4
- "description": "Claude Code provider for DeepSeek Harness (dsh) — an AgentFactory that bridges the host Claude Code CLI through the official @anthropic-ai/claude-agent-sdk into the Dash Agent/Session contracts (Agent Worlds, standalone form).",
4
+ "description": "Claude Code provider for DeepSeek Harness (dsh) — an AgentFactory that bridges the host Claude Code CLI through the official @anthropic-ai/claude-agent-sdk into the Dash Agent/Session contracts (Super D, standalone form).",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@deepseek-ai/cordis": "^4.0.1",
28
- "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
29
- "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
30
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
31
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
32
- "@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
33
- "@deepseek-ai/dsh-user-approval": "0.1.5-rc.2",
34
- "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2"
28
+ "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
29
+ "@deepseek-ai/dsh-commands": ">=0.1.5-0 <0.3.0-0",
30
+ "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
31
+ "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
32
+ "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
33
+ "@deepseek-ai/dsh-user-approval": ">=0.1.5-0 <0.3.0-0",
34
+ "@deepseek-ai/dsh-user-questions": ">=0.1.5-0 <0.3.0-0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@deepseek-ai/cordis": {
@@ -1,6 +1,6 @@
1
- # @pgmi-builds/agent-adapter-codex
1
+ # @pgmi-builds/agent-codex
2
2
 
3
- superd 外壳下的 **Codex adapter**(agent-worlds 线,AW-E):把 Codex CLI 经由
3
+ superd 外壳下的 **Codex adapter**(super-dsh 线,AW-E):把 Codex CLI 经由
4
4
  `@openai/codex-sdk` 接进 DSH —— 会话、事件、模型目录、持久化全部按 DSH 语义呈现,
5
5
  WebUI 消费的是 DSH 服务提供的数据面。
6
6
 
@@ -14,19 +14,19 @@ WebUI 消费的是 DSH 服务提供的数据面。
14
14
  - 一个 **AgentFactory**:`src/index.ts` 里的 `CodexProvider` 在 `ctx.agents` 注册工厂,
15
15
  每个会话一个 `CodexSdkClient`(真 `@openai/codex-sdk` 线程);`src/agent.ts` 把 Codex 线程事件
16
16
  投影成 DSH 会话事件。
17
- - **不包含** 任何 hub 耦合:世界挂载由 hub 侧驱动(AW-B 用 `@pgmi-builds/agent-hub/world` 的
17
+ - **不包含** 任何 hub 耦合:世界挂载由 hub 侧驱动(AW-B 用 `@pgmi-builds/superd-hub/world` 的
18
18
  mount carrier)。本包自己就足以点亮一个完整的 web app。
19
19
 
20
20
  ## 单独跑起来(首选开发/验收形态)
21
21
 
22
22
  ```bash
23
23
  # 在仓根执行;端口默认 4988,LAN 走只绑 LAN IP 的 socat relay
24
- AW_APP_PORT=4989 bash super-dsh/test/start-codex-app.sh
24
+ SUPERD_APP_PORT=4989 bash super-dsh/test/start-codex-app.sh
25
25
  # 脚本会打印 loopback / LAN token URL;停止:
26
- systemctl --user stop aw-codex-app-<port>-test aw-codex-app-<port>-relay
26
+ systemctl --user stop superd-codex-app-<port>-test superd-codex-app-<port>-relay
27
27
  ```
28
28
 
29
- 环境变量:`AW_APP_PORT`(端口)、`AW_APP_HOME`(默认 `$WT/.tests`)、
29
+ 环境变量:`SUPERD_APP_PORT`(端口)、`SUPERD_APP_HOME`(默认 `$WT/.tests`)、
30
30
  `SUPERD_LAN_HOST`(默认 `192.168.31.130`)、`CODEX_TRACE=1`(provider/agent 追踪)。
31
31
 
32
32
  ## Home 与 profile 布局(user 裁定)
@@ -34,7 +34,7 @@ systemctl --user stop aw-codex-app-<port>-test aw-codex-app-<port>-relay
34
34
  | 位置 | 内容 |
35
35
  |---|---|
36
36
  | `$DSH_HOME`(测试 = `<repo>/.tests`) | 测试 DSH home |
37
- | `$DSH_HOME/agents/codex` | **Codex app home**:`config.toml` / `auth.json` / 模型 catalog(由 `scripts/setup-codex-home.mjs` 从 `~/.codex` **单向**拷入)+ Codex 自己的 rollout/state |
37
+ | `$DSH_HOME/agents/codex` | **Codex app home**:`config.toml` / `auth.json` / 模型 catalog(standalone 时代的 `setup-codex-home.mjs` 拷入已随 2026-09-24 场景退役删除)+ Codex 自己的 rollout/state |
38
38
  | `$DSH_HOME/profiles/codex` | 本 app 的 dsh profile(bundles + `cordis.patch.yml`) |
39
39
  | `$DSH_HOME/sessions/...` | **DSH 会话日志**(上游 `session-persistence-jsonl`,zstd)——list/replay 都由此提供 |
40
40
 
@@ -63,7 +63,7 @@ SUPERD_DSH_ANCHOR=<repo>/upstream/deepseek-harness/package.json \
63
63
  node --test test/*.test.mjs
64
64
  ```
65
65
 
66
- live 门控:`AW_CODEX_LIVE=1`(会真跑一次 Codex turn)。
66
+ live 门控:`SUPERD_CODEX_LIVE=1`(会真跑一次 Codex turn)。
67
67
 
68
68
  ## 已知边界(V1)
69
69
 
@@ -1,10 +1,10 @@
1
- # @pgmi-builds/agent-adapter-codex bundle patch (AW-E SDK line, omp-web form).
1
+ # @pgmi-builds/agent-codex bundle patch (SDK line, standalone form).
2
2
  # This file is the `dsh.bundle.patch` layer of the adapter package: when the
3
3
  # codex world profile mounts the bundle, the boot merges THIS patch — mount
4
4
  # the Codex provider plus disable the native components it replaces.
5
5
  #
6
6
  # Profile-specific values are deliberately NOT here: `webserver.port` (port
7
- # choice) belongs to the world/profile patch layer (the aw-codex-world
7
+ # choice) belongs to the world/profile patch layer (the superd-codex-world
8
8
  # fixture carries the 127.0.0.1:0 listener posture).
9
9
 
10
10
  # Mount the Codex provider: a Cordis Service that registers an AgentFactory
@@ -14,7 +14,7 @@
14
14
  # config.toml + model_catalog_json.
15
15
  - insert:
16
16
  - id: codex-provider
17
- name: '@pgmi-builds/agent-adapter-codex'
17
+ name: '@pgmi-builds/agent-codex'
18
18
 
19
19
  # Codex owns the live agent transcript (the rollout JSONL); disable the
20
20
  # built-in loop so it does not double-run alongside the SDK thread.
@@ -31,8 +31,12 @@
31
31
 
32
32
  # Codex is single-mode: the SDK thread drives tools itself, so no Dash preset
33
33
  # composition is needed (the provider ships the fixed single-preset roster).
34
- - id: agent-presets
35
- disabled: true
34
+ # 0.1.7: the host AgentPresetRegistry row (renamed `agent-presets` ->
35
+ # `agent-preset-registry`) stays MOUNTED — the adapter registers its one
36
+ # fixed preset into it (src/agent-preset-codex.ts); pin only the default.
37
+ - id: agent-preset-registry
38
+ config:
39
+ default: codex
36
40
 
37
41
  # The upstream jsonl persistence row STAYS MOUNTED (2026-09-16): the provider
38
42
  # writes the DSH session log through it (create/open/append/close), so