super-dsh 0.3.2 → 0.3.3-b

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 (48) hide show
  1. package/agent-agy/dist/agent.d.ts +4 -1
  2. package/agent-agy/dist/agent.js +15 -1
  3. package/agent-agy/dist/index.js +5 -8
  4. package/agent-agy/package.json +6 -6
  5. package/agent-agy-sdk/dist/agent.d.ts +4 -1
  6. package/agent-agy-sdk/dist/agent.js +15 -1
  7. package/agent-agy-sdk/dist/index.js +5 -8
  8. package/agent-agy-sdk/package.json +5 -5
  9. package/agent-claude/dist/agent.js +15 -1
  10. package/agent-claude/package.json +8 -8
  11. package/agent-codex/dist/agent.js +15 -1
  12. package/agent-codex/package.json +7 -7
  13. package/agent-codex-sdk/dist/agent.js +15 -1
  14. package/agent-codex-sdk/dist/index.js +5 -11
  15. package/agent-codex-sdk/package.json +7 -7
  16. package/agent-hermes/dist/agent.js +15 -1
  17. package/agent-hermes/dist/index.js +5 -8
  18. package/agent-hermes/package.json +7 -7
  19. package/agent-omp/dist/agent.js +26 -2
  20. package/agent-omp/package.json +8 -8
  21. package/agent-omp-sdk/dist/agent.d.ts +4 -1
  22. package/agent-omp-sdk/dist/agent.js +15 -1
  23. package/agent-omp-sdk/package.json +8 -8
  24. package/agent-pi/dist/agent.js +20 -2
  25. package/agent-pi/dist/index.js +5 -11
  26. package/agent-pi/package.json +7 -7
  27. package/package.json +21 -21
  28. package/remote/hub-pty-pump.mjs +97 -0
  29. package/remote/plugin.d.ts +476 -200
  30. package/remote/plugin.js +1445 -664
  31. package/remote/provenance.json +22 -17
  32. package/superd-hub/dist/agent-model-face.d.ts +93 -0
  33. package/superd-hub/dist/agent-model-face.js +113 -0
  34. package/superd-hub/dist/exec.d.ts +3 -2
  35. package/superd-hub/dist/exec.js +6 -5
  36. package/superd-hub/dist/hub-tool.d.ts +1 -1
  37. package/superd-hub/dist/hub-tool.js +6 -6
  38. package/superd-hub/dist/index.d.ts +1 -0
  39. package/superd-hub/dist/index.js +1 -0
  40. package/superd-hub/dist/remote-provider.js +70 -36
  41. package/superd-hub/dist/world-entry.js +30 -0
  42. package/superd-hub/package.json +14 -10
  43. package/superd-hub/dist/exec-pty-channel.d.ts +0 -58
  44. package/superd-hub/dist/exec-pty-channel.js +0 -162
  45. package/superd-hub/dist/exec-pty-framing.d.ts +0 -34
  46. package/superd-hub/dist/exec-pty-framing.js +0 -89
  47. package/superd-hub/dist/exec-pty-session.d.ts +0 -78
  48. package/superd-hub/dist/exec-pty-session.js +0 -228
@@ -26,7 +26,7 @@
26
26
  * `onApiKey` (adapter state, world home only) and confirmed in the same turn.
27
27
  */
28
28
  import type { Context } from "@deepseek-ai/cordis";
29
- import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget } from "@deepseek-ai/dsh-agent";
29
+ import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget, Model } from "@deepseek-ai/dsh-agent";
30
30
  import { Inbox } from "./inbox.js";
31
31
  import type { AgentCancelCause, Session, SessionId, UserMessage } from "@deepseek-ai/dsh-session";
32
32
  import type { TokenUsage } from "@deepseek-ai/dsh-llm";
@@ -65,6 +65,9 @@ export declare class AgyAgent implements Agent {
65
65
  readonly session: WithSystemHead<Session>;
66
66
  readonly inbox: Inbox;
67
67
  readonly ctx: Context;
68
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
69
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
70
+ readonly model: Model;
68
71
  private readonly client;
69
72
  private readonly loopCtx;
70
73
  private readonly scope;
@@ -2,7 +2,7 @@ import { agentEvents } from "@deepseek-ai/dsh-agent";
2
2
  import { Inbox } from "./inbox.js";
3
3
  import { LlmAttemptId, ToolCallId, createAssistantMessage, createSystemMessage, createToolResultMessage } from "@deepseek-ai/dsh-llm";
4
4
  import { createScope } from "@deepseek-ai/dsh-scope";
5
- import { withSystemHead } from "../../superd-hub/dist/index.js";
5
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
6
6
  /** v2 live assistant-stream publication (same frame protocol as hermes). */
7
7
  class AssistantStreamBridge {
8
8
  attemptId;
@@ -80,6 +80,9 @@ export class AgyAgent {
80
80
  session;
81
81
  inbox;
82
82
  ctx;
83
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
84
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
85
+ model;
83
86
  client;
84
87
  loopCtx;
85
88
  scope;
@@ -106,6 +109,17 @@ export class AgyAgent {
106
109
  this.id = id;
107
110
  this.options = options;
108
111
  this.session = withSystemHead(session, () => createSystemMessage(""));
112
+ this.model = createAgentModelFace({
113
+ session: this.session,
114
+ options: this.options,
115
+ appendSelection: (selection) => {
116
+ this.session.append("model/selection", selection);
117
+ },
118
+ readDefault: () => {
119
+ const service = this.ctx.get("agentDefaultModel");
120
+ return service?.currentSelection?.();
121
+ },
122
+ });
109
123
  this.client = client;
110
124
  this.onIdleExit = onIdleExit;
111
125
  this.runtimeInfo = runtimeInfo;
@@ -21,7 +21,6 @@ import { realpathSync, statSync } from "node:fs";
21
21
  import { bindForeignHub } from "@pgmi-builds/superd-hub/foreign-hub";
22
22
  import { join } from "node:path";
23
23
  import { Service } from "@deepseek-ai/cordis";
24
- import { installModelSelection } from "@deepseek-ai/dsh-agent";
25
24
  import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
26
25
  import { AgyCliClient } from "./agy-cli-client.js";
27
26
  import { hasSigninCredential, resolveAuthMode } from "./agy-auth.js";
@@ -475,13 +474,11 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
475
474
  try {
476
475
  const selection = { provider: agentOptions.provider ?? "agy", model: agentOptions.model ?? "" };
477
476
  if (selection.model !== "") {
478
- let picked = selection;
479
- installModelSelection(agent.ctx, {
480
- get current() { return picked; },
481
- set current(next) { picked = next; },
482
- assembled: undefined,
483
- });
484
- session.append("model/selection", selection);
477
+ // 0.2.2: installModelSelection dropped its injected-ref parameter — the
478
+ // durable face (`agent.model`, the same mechanism session/selectModel
479
+ // uses) carries the pin: select() appends the typed, deduped
480
+ // `model/selection` event.
481
+ agent.model.select(selection);
485
482
  trace(`session route pinned: ${selection.provider}/${selection.model}`);
486
483
  }
487
484
  }
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@deepseek-ai/cordis": "^4.0.1",
28
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
29
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
30
- "@deepseek-ai/dsh-scope": ">=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-typert-protocol": ">=0.1.5-0 <0.3.0-0",
28
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
29
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
30
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
31
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
32
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
33
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
34
34
  "@pgmi-builds/superd-hub": "*"
35
35
  },
36
36
  "peerDependenciesMeta": {
@@ -25,7 +25,7 @@
25
25
  * `onApiKey` (adapter state, world home only) and confirmed in the same turn.
26
26
  */
27
27
  import type { Context } from "@deepseek-ai/cordis";
28
- import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget } from "@deepseek-ai/dsh-agent";
28
+ import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget, Model } from "@deepseek-ai/dsh-agent";
29
29
  import { Inbox } from "./inbox.js";
30
30
  import type { AgentCancelCause, Session, SessionId, UserMessage } from "@deepseek-ai/dsh-session";
31
31
  import type { TokenUsage } from "@deepseek-ai/dsh-llm";
@@ -63,6 +63,9 @@ export declare class AgyAgent implements Agent {
63
63
  readonly session: WithSystemHead<Session>;
64
64
  readonly inbox: Inbox;
65
65
  readonly ctx: Context;
66
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
67
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
68
+ readonly model: Model;
66
69
  private readonly client;
67
70
  private readonly loopCtx;
68
71
  private readonly scope;
@@ -2,7 +2,7 @@ import { agentEvents } from "@deepseek-ai/dsh-agent";
2
2
  import { Inbox } from "./inbox.js";
3
3
  import { LlmAttemptId, ToolCallId, createAssistantMessage, createSystemMessage, createToolResultMessage } from "@deepseek-ai/dsh-llm";
4
4
  import { createScope } from "@deepseek-ai/dsh-scope";
5
- import { withSystemHead } from "../../superd-hub/dist/index.js";
5
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
6
6
  /** v2 live assistant-stream publication (same frame protocol as hermes). */
7
7
  class AssistantStreamBridge {
8
8
  attemptId;
@@ -80,6 +80,9 @@ export class AgyAgent {
80
80
  session;
81
81
  inbox;
82
82
  ctx;
83
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
84
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
85
+ model;
83
86
  client;
84
87
  loopCtx;
85
88
  scope;
@@ -106,6 +109,17 @@ export class AgyAgent {
106
109
  this.id = id;
107
110
  this.options = options;
108
111
  this.session = withSystemHead(session, () => createSystemMessage(""));
112
+ this.model = createAgentModelFace({
113
+ session: this.session,
114
+ options: this.options,
115
+ appendSelection: (selection) => {
116
+ this.session.append("model/selection", selection);
117
+ },
118
+ readDefault: () => {
119
+ const service = this.ctx.get("agentDefaultModel");
120
+ return service?.currentSelection?.();
121
+ },
122
+ });
109
123
  this.client = client;
110
124
  this.onIdleExit = onIdleExit;
111
125
  this.runtimeInfo = runtimeInfo;
@@ -26,7 +26,6 @@
26
26
  import { realpathSync, statSync } from "node:fs";
27
27
  import { join } from "node:path";
28
28
  import { Service } from "@deepseek-ai/cordis";
29
- import { installModelSelection } from "@deepseek-ai/dsh-agent";
30
29
  import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
31
30
  import { AgyBridgeClient } from "./agy-client.js";
32
31
  import { registerAntigravityPreset } from "./agent-preset-agy.js";
@@ -413,13 +412,11 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
413
412
  try {
414
413
  const selection = { provider: agentOptions.provider ?? "agy", model: agentOptions.model ?? "" };
415
414
  if (selection.model !== "") {
416
- let picked = selection;
417
- installModelSelection(agent.ctx, {
418
- get current() { return picked; },
419
- set current(next) { picked = next; },
420
- assembled: undefined,
421
- });
422
- session.append("model/selection", selection);
415
+ // 0.2.2: installModelSelection dropped its injected-ref parameter — the
416
+ // durable face (`agent.model`, the same mechanism session/selectModel
417
+ // uses) carries the pin: select() appends the typed, deduped
418
+ // `model/selection` event.
419
+ agent.model.select(selection);
423
420
  trace(`session route pinned: ${selection.provider}/${selection.model}`);
424
421
  }
425
422
  }
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@deepseek-ai/cordis": "^4.0.1",
30
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
31
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
32
- "@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
33
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
34
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0"
30
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
31
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
32
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
33
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
34
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@deepseek-ai/cordis": {
@@ -50,7 +50,7 @@ import { resolveRoute, routeSeed } from "./claude-route.js";
50
50
  import { CLAUDE_PROVIDER_ID } from "./adapter.js";
51
51
  import { claudePermissionMode, presetFromEvents } from "./permission.js";
52
52
  import { catalogFromInit, modelEntryFromSdk, readModelCatalog, setModelCatalog } from "./models.js";
53
- import { withSystemHead } from "../../superd-hub/dist/index.js";
53
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
54
54
  import { registerClaudeCommands, slashCommandsFromReported, } from "./commands.js";
55
55
  /** Diagnostic trace (set CLAUDE_TRACE=1 on the dsh process to enable). */
56
56
  const TRACE = process.env.CLAUDE_TRACE === "1";
@@ -237,6 +237,9 @@ export class ClaudeAgent {
237
237
  session;
238
238
  inbox;
239
239
  ctx;
240
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
241
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
242
+ model;
240
243
  client;
241
244
  /** Unsubscriber for the LIVE client's wire listener — released before a swap closes the old child. */
242
245
  clientUnsubscribe = undefined;
@@ -313,6 +316,17 @@ export class ClaudeAgent {
313
316
  this.id = id;
314
317
  this.options = options;
315
318
  this.session = withSystemHead(session, () => createSystemMessage(""));
319
+ this.model = createAgentModelFace({
320
+ session: this.session,
321
+ options: this.options,
322
+ appendSelection: (selection) => {
323
+ this.session.append("model/selection", selection);
324
+ },
325
+ readDefault: () => {
326
+ const service = this.ctx.get("agentDefaultModel");
327
+ return service?.currentSelection?.();
328
+ },
329
+ });
316
330
  this.client = client;
317
331
  this.clientFactory = clientFactory;
318
332
  this.onIdleExit = onIdleExit;
@@ -23,14 +23,14 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@deepseek-ai/cordis": "^4.0.1",
26
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
27
- "@deepseek-ai/dsh-commands": ">=0.1.5-0 <0.3.0-0",
28
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
29
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
30
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
31
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
32
- "@deepseek-ai/dsh-user-approval": ">=0.1.5-0 <0.3.0-0",
33
- "@deepseek-ai/dsh-user-questions": ">=0.1.5-0 <0.3.0-0"
26
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
27
+ "@deepseek-ai/dsh-commands": ">=0.2.2-0 <1.0.0-0",
28
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
29
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
30
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
31
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
32
+ "@deepseek-ai/dsh-user-approval": ">=0.2.2-0 <1.0.0-0",
33
+ "@deepseek-ai/dsh-user-questions": ">=0.2.2-0 <1.0.0-0"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@deepseek-ai/cordis": {
@@ -6,7 +6,7 @@ import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage,
6
6
  import { createScope } from "@deepseek-ai/dsh-scope";
7
7
  import { makeApprovalHandler, parseApprovalTimeout } from "./app-server-approvals.js";
8
8
  import { presetFromEvents, turnPolicyFromEvents } from "./permission.js";
9
- import { withSystemHead } from "../../superd-hub/dist/index.js";
9
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
10
10
  import { NATIVE_LAUNCH } from "./codex-launch.js";
11
11
  import { resolveRoute } from "./codex-route.js";
12
12
  /**
@@ -257,6 +257,9 @@ export class CodexAgent {
257
257
  session;
258
258
  inbox;
259
259
  ctx;
260
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
261
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
262
+ model;
260
263
  #client;
261
264
  #loopCtx;
262
265
  #scope;
@@ -341,6 +344,17 @@ export class CodexAgent {
341
344
  this.id = id;
342
345
  this.options = options;
343
346
  this.session = withSystemHead(session, () => createSystemMessage(""));
347
+ this.model = createAgentModelFace({
348
+ session: this.session,
349
+ options: this.options,
350
+ appendSelection: (selection) => {
351
+ this.session.append("model/selection", selection);
352
+ },
353
+ readDefault: () => {
354
+ const service = this.ctx.get("agentDefaultModel");
355
+ return service?.currentSelection?.();
356
+ },
357
+ });
344
358
  this.#client = client;
345
359
  this.#onIdleExit = onIdleExit;
346
360
  this.#runtimeInfo = runtimeInfo;
@@ -32,13 +32,13 @@
32
32
 
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.1",
35
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
36
- "@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
37
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
38
- "@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
39
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
40
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
41
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
35
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
36
+ "@deepseek-ai/dsh-agent-presets": ">=0.2.2-0 <1.0.0-0",
37
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
38
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
39
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
40
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
41
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
42
42
  "@pgmi-builds/superd-hub": "*"
43
43
  },
44
44
  "peerDependenciesMeta": {
@@ -4,7 +4,7 @@ import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage,
4
4
  import { createScope } from "@deepseek-ai/dsh-scope";
5
5
  import { NATIVE_SDK_LAUNCH } from "./codex-sdk-launch.js";
6
6
  import { resolveRoute } from "./codex-route.js";
7
- import { withSystemHead } from "../../superd-hub/dist/index.js";
7
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
8
8
  /**
9
9
  * v2 live assistant-stream publication for the Codex bridge — the same frame
10
10
  * protocol the reference loop's AssistantStreamAttempt speaks (start marker,
@@ -243,6 +243,9 @@ export class CodexAgent {
243
243
  session;
244
244
  inbox;
245
245
  ctx;
246
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
247
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
248
+ model;
246
249
  #client;
247
250
  #loopCtx;
248
251
  #scope;
@@ -312,6 +315,17 @@ export class CodexAgent {
312
315
  this.id = id;
313
316
  this.options = options;
314
317
  this.session = withSystemHead(session, () => createSystemMessage(""));
318
+ this.model = createAgentModelFace({
319
+ session: this.session,
320
+ options: this.options,
321
+ appendSelection: (selection) => {
322
+ this.session.append("model/selection", selection);
323
+ },
324
+ readDefault: () => {
325
+ const service = this.ctx.get("agentDefaultModel");
326
+ return service?.currentSelection?.();
327
+ },
328
+ });
315
329
  this.#client = client;
316
330
  this.#onIdleExit = onIdleExit;
317
331
  this.#runtimeInfo = runtimeInfo;
@@ -23,7 +23,6 @@ import { OPENAI_OAUTH_ID, readEffectiveProviderStore } from "./codex-oauth.js";
23
23
  import { existsSync, realpathSync, statSync } from "node:fs";
24
24
  import { join } from "node:path";
25
25
  import { Service } from "@deepseek-ai/cordis";
26
- import { installModelSelection } from "@deepseek-ai/dsh-agent";
27
26
  import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
28
27
  import { CodexSdkClient } from "./codex-sdk-client.js";
29
28
  import { CodexAgent } from "./agent.js";
@@ -659,16 +658,11 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
659
658
  // `ModelSelectionRef` (same shape the controller installs) that the
660
659
  // next prompt's route check reads. Synchronous on purpose — the first
661
660
  // prompt must not depend on the global default's late flush.
662
- let picked = selection;
663
- installModelSelection(agent.ctx, {
664
- get current() { return picked; },
665
- set current(next) { picked = next; },
666
- assembled: undefined,
667
- });
668
- // `model/selection` is contributed to `SessionEventMap` by the upstream
669
- // session-controller package (declaration merging); this adapter does
670
- // not depend on it, so the append goes through a narrow local cast.
671
- session.append("model/selection", selection);
661
+ // 0.2.2: installModelSelection dropped its injected-ref parameter — the
662
+ // durable face (`agent.model`, the same mechanism session/selectModel
663
+ // uses) carries the pin: select() appends the typed, deduped
664
+ // `model/selection` event.
665
+ agent.model.select(selection);
672
666
  trace(`session route pinned: ${route.provider}/${route.model}`);
673
667
  }
674
668
  }
@@ -26,13 +26,13 @@
26
26
  "dependencies": {},
27
27
  "peerDependencies": {
28
28
  "@deepseek-ai/cordis": "^4.0.1",
29
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
30
- "@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
31
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
32
- "@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
33
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
34
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
35
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
29
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
30
+ "@deepseek-ai/dsh-agent-presets": ">=0.2.2-0 <1.0.0-0",
31
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
32
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
33
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
34
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
35
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
36
36
  "@pgmi-builds/superd-hub": "*"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -4,7 +4,7 @@ import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage,
4
4
  import { createScope } from "@deepseek-ai/dsh-scope";
5
5
  import { GatewayRpcError, HERMES_SPAWN_ATTEMPTS } from "./hermes-client.js";
6
6
  import { approvalChoiceFromOutcome } from "./permission.js";
7
- import { withSystemHead } from "../../superd-hub/dist/index.js";
7
+ import { createAgentModelFace, withSystemHead } from "../../superd-hub/dist/index.js";
8
8
  /**
9
9
  * v2 live assistant-stream publication for the Hermes bridge — the same frame
10
10
  * protocol the reference loop's AssistantStreamAttempt speaks (start marker,
@@ -259,6 +259,9 @@ export class HermesAgent {
259
259
  session;
260
260
  inbox;
261
261
  ctx;
262
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
263
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
264
+ model;
262
265
  #client;
263
266
  #loopCtx;
264
267
  #scope;
@@ -319,6 +322,17 @@ export class HermesAgent {
319
322
  this.id = id;
320
323
  this.options = options;
321
324
  this.session = withSystemHead(session, () => createSystemMessage(""));
325
+ this.model = createAgentModelFace({
326
+ session: this.session,
327
+ options: this.options,
328
+ appendSelection: (selection) => {
329
+ this.session.append("model/selection", selection);
330
+ },
331
+ readDefault: () => {
332
+ const service = this.ctx.get("agentDefaultModel");
333
+ return service?.currentSelection?.();
334
+ },
335
+ });
322
336
  this.#client = client;
323
337
  this.#onIdleExit = onIdleExit;
324
338
  this.#runtimeInfo = runtimeInfo;
@@ -24,7 +24,6 @@
24
24
  import { realpathSync, statSync } from "node:fs";
25
25
  import { join } from "node:path";
26
26
  import { Service } from "@deepseek-ai/cordis";
27
- import { installModelSelection } from "@deepseek-ai/dsh-agent";
28
27
  import { SessionLogOffset, SessionPreparation, interruptedTurnClosers, } from "@deepseek-ai/dsh-session";
29
28
  import { bindForeignHub } from "@pgmi-builds/superd-hub/foreign-hub";
30
29
  import { HermesGatewayClient, HERMES_SPAWN_GRACE_MS } from "./hermes-client.js";
@@ -482,13 +481,11 @@ async function setupAndPublish(loopCtx, ownerCtx, id, agentOptions, setup, sessi
482
481
  const route = await runtimeInfo?.routeContext({ provider: agentOptions.provider, model: agentOptions.model });
483
482
  if (route !== undefined) {
484
483
  const selection = { provider: route.provider, model: route.model };
485
- let picked = selection;
486
- installModelSelection(agent.ctx, {
487
- get current() { return picked; },
488
- set current(next) { picked = next; },
489
- assembled: undefined,
490
- });
491
- session.append("model/selection", selection);
484
+ // 0.2.2: installModelSelection dropped its injected-ref parameter — the
485
+ // durable face (`agent.model`, the same mechanism session/selectModel
486
+ // uses) carries the pin: select() appends the typed, deduped
487
+ // `model/selection` event.
488
+ agent.model.select(selection);
492
489
  trace(`session route pinned: ${route.provider}/${route.model}`);
493
490
  }
494
491
  }
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@deepseek-ai/cordis": "^4.0.1",
29
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
30
- "@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
31
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
32
- "@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
33
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
34
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
35
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
29
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
30
+ "@deepseek-ai/dsh-agent-presets": ">=0.2.2-0 <1.0.0-0",
31
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
32
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
33
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
34
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
35
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
36
36
  "@pgmi-builds/superd-hub": "*"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -5,7 +5,7 @@ import { LlmAttemptId, ToolCallId, QUOTA_EXCEEDED_CODE, createAssistantMessage,
5
5
  import { createScope } from "@deepseek-ai/dsh-scope";
6
6
  import { ompPermissionCommand } from "./permission.js";
7
7
  import { getBridgeStore } from "./store/index.js";
8
- import { withSystemHead } from "../../superd-hub/dist/index.js";
8
+ import { createAgentModelFace, recordedModelSelection, withSystemHead } from "../../superd-hub/dist/index.js";
9
9
  /**
10
10
  * v2 live assistant-stream publication for the OMP bridge — the same frame
11
11
  * protocol the reference loop's AssistantStreamAttempt speaks (start marker,
@@ -255,6 +255,11 @@ export class OmpAgent {
255
255
  session;
256
256
  inbox;
257
257
  ctx;
258
+ /** Durable model selection (0.2.2 Agent face): recorded via `model/selection`,
259
+ * resolved with the same precedence as the native AgentModel — see
260
+ * {@link #recordedModelSelection}. Pushes to OMP at the next turn boundary
261
+ * through the existing {@link #syncModelSelection} `set_model` path. */
262
+ model;
258
263
  #rpc;
259
264
  #loopCtx;
260
265
  #scope;
@@ -311,6 +316,14 @@ export class OmpAgent {
311
316
  this.#onIdleExit = onIdleExit;
312
317
  this.#dispatch = agentEvents(loopCtx, this);
313
318
  this.inbox = new Inbox();
319
+ this.model = createAgentModelFace({
320
+ session: this.session,
321
+ options: this.options,
322
+ appendSelection: (selection) => {
323
+ this.session.append("model/selection", selection);
324
+ },
325
+ readDefault: () => this.ctx.get("agentDefaultModel")?.currentSelection(),
326
+ });
314
327
  this.#scope = createScope(loopCtx, this);
315
328
  this.ctx = this.#scope.ctx.extend({ agent: this });
316
329
  this.#lastTurn = session.snapshotEvents().findLast((event) => event.type === "turn/start")?.data.turn ?? 0;
@@ -649,8 +662,19 @@ export class OmpAgent {
649
662
  }
650
663
  return base;
651
664
  }
652
- /** Tier-2/3 base: the session's logged header config, else the global default, else agent options. */
665
+ // The durable-selection fold and the `Model` face moved to the shared hub
666
+ // module (superd-hub agent-model-face.ts): the constructor builds `this.model`
667
+ // with `createAgentModelFace`, and {@link #baseModelSelection} reads the fold
668
+ // through the thin wrapper below.
669
+ #recordedModelSelection() {
670
+ return recordedModelSelection(this.session.snapshotEvents());
671
+ }
672
+ /** Tier-0..3 base: pending selection, else the session's logged header config, else the global default, else agent options. */
653
673
  #baseModelSelection() {
674
+ const pending = this.#recordedModelSelection();
675
+ if (pending !== null && pending.provider !== "" && pending.model !== "") {
676
+ return { provider: pending.provider, model: pending.model };
677
+ }
654
678
  const persisted = this.session.requestHeader()?.config;
655
679
  if (persisted !== undefined && persisted.provider !== "" && persisted.model !== "") {
656
680
  return { provider: persisted.provider, model: persisted.model };
@@ -34,14 +34,14 @@
34
34
  "dependencies": {},
35
35
  "peerDependencies": {
36
36
  "@deepseek-ai/cordis": "^4.0.1",
37
- "@deepseek-ai/dsh-agent": ">=0.1.5-0 <0.3.0-0",
38
- "@deepseek-ai/dsh-agent-presets": ">=0.1.5-0 <0.3.0-0",
39
- "@deepseek-ai/dsh-llm": ">=0.1.5-0 <0.3.0-0",
40
- "@deepseek-ai/dsh-scope": ">=0.1.5-0 <0.3.0-0",
41
- "@deepseek-ai/dsh-session": ">=0.1.5-0 <0.3.0-0",
42
- "@deepseek-ai/dsh-session-persistence": ">=0.1.5-0 <0.3.0-0",
43
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-0 <0.3.0-0",
44
- "@deepseek-ai/dsh-home-paths": ">=0.1.5-0 <0.3.0-0",
37
+ "@deepseek-ai/dsh-agent": ">=0.2.2-0 <1.0.0-0",
38
+ "@deepseek-ai/dsh-agent-presets": ">=0.2.2-0 <1.0.0-0",
39
+ "@deepseek-ai/dsh-llm": ">=0.2.2-0 <1.0.0-0",
40
+ "@deepseek-ai/dsh-scope": ">=0.2.2-0 <1.0.0-0",
41
+ "@deepseek-ai/dsh-session": ">=0.2.2-0 <1.0.0-0",
42
+ "@deepseek-ai/dsh-session-persistence": ">=0.2.2-0 <1.0.0-0",
43
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-0 <1.0.0-0",
44
+ "@deepseek-ai/dsh-home-paths": ">=0.2.2-0 <1.0.0-0",
45
45
  "@pgmi-builds/superd-hub": "*"
46
46
  },
47
47
  "peerDependenciesMeta": {
@@ -20,7 +20,7 @@
20
20
  * are synthesized around the OMP stream.
21
21
  */
22
22
  import type { Context } from "@deepseek-ai/cordis";
23
- import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget } from "@deepseek-ai/dsh-agent";
23
+ import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget, Model } from "@deepseek-ai/dsh-agent";
24
24
  import { Inbox } from "./inbox.js";
25
25
  import type { AgentCancelCause, Session, SessionId, UserMessage } from "@deepseek-ai/dsh-session";
26
26
  import type { ContentBlock, TokenUsage } from "@deepseek-ai/dsh-llm";
@@ -61,6 +61,9 @@ export declare class OmpAgent implements Agent {
61
61
  readonly session: WithSystemHead<Session>;
62
62
  readonly inbox: Inbox;
63
63
  readonly ctx: Context;
64
+ /** Durable model selection (0.2.2 Agent face): the shared hub face over
65
+ * `model/selection` events — see superd-hub agent-model-face.ts. */
66
+ readonly model: Model;
64
67
  constructor(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session, rpc: OmpAgentRpc, onIdleExit?: () => void);
65
68
  get status(): AgentStatus;
66
69
  send(message: UserMessage, target: InboxTarget, wakeup: boolean): void;