@botiverse/oar 0.127.0 → 0.128.1

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 (121) hide show
  1. package/README.md +6 -6
  2. package/dist/community/cybion/refused-options.d.ts.map +1 -1
  3. package/dist/community/cybion/refused-options.js +1 -0
  4. package/dist/community/cybion/refused-options.js.map +1 -1
  5. package/dist/community/morph/session.d.ts.map +1 -1
  6. package/dist/community/morph/session.js +1 -0
  7. package/dist/community/morph/session.js.map +1 -1
  8. package/dist/contracts/runtime.d.ts +1 -1
  9. package/dist/contracts/runtime.d.ts.map +1 -1
  10. package/dist/contracts/session-options.d.ts +9 -0
  11. package/dist/contracts/session-options.d.ts.map +1 -1
  12. package/dist/platforms.d.ts +7 -6
  13. package/dist/platforms.d.ts.map +1 -1
  14. package/dist/platforms.js +7 -6
  15. package/dist/platforms.js.map +1 -1
  16. package/dist/runtimes/antigravity/options.d.ts.map +1 -1
  17. package/dist/runtimes/antigravity/options.js +1 -0
  18. package/dist/runtimes/antigravity/options.js.map +1 -1
  19. package/dist/runtimes/claude/options.d.ts.map +1 -1
  20. package/dist/runtimes/claude/options.js +1 -0
  21. package/dist/runtimes/claude/options.js.map +1 -1
  22. package/dist/runtimes/claude/projection.js +3 -3
  23. package/dist/runtimes/claude/projection.js.map +1 -1
  24. package/dist/runtimes/codebuddy/options.d.ts.map +1 -1
  25. package/dist/runtimes/codebuddy/options.js +1 -0
  26. package/dist/runtimes/codebuddy/options.js.map +1 -1
  27. package/dist/runtimes/codex/options.d.ts.map +1 -1
  28. package/dist/runtimes/codex/options.js +1 -0
  29. package/dist/runtimes/codex/options.js.map +1 -1
  30. package/dist/runtimes/cursor/model.d.ts.map +1 -1
  31. package/dist/runtimes/cursor/model.js +1 -0
  32. package/dist/runtimes/cursor/model.js.map +1 -1
  33. package/dist/runtimes/devin/options.d.ts.map +1 -1
  34. package/dist/runtimes/devin/options.js +1 -0
  35. package/dist/runtimes/devin/options.js.map +1 -1
  36. package/dist/runtimes/dsh/bridge-controls.d.ts.map +1 -1
  37. package/dist/runtimes/dsh/bridge-controls.js +21 -0
  38. package/dist/runtimes/dsh/bridge-controls.js.map +1 -1
  39. package/dist/runtimes/dsh/bridge.d.ts.map +1 -1
  40. package/dist/runtimes/dsh/bridge.js +35 -4
  41. package/dist/runtimes/dsh/bridge.js.map +1 -1
  42. package/dist/runtimes/dsh/index.d.ts +22 -1
  43. package/dist/runtimes/dsh/index.d.ts.map +1 -1
  44. package/dist/runtimes/dsh/index.js +13 -2
  45. package/dist/runtimes/dsh/index.js.map +1 -1
  46. package/dist/runtimes/dsh/launch.d.ts +6 -1
  47. package/dist/runtimes/dsh/launch.d.ts.map +1 -1
  48. package/dist/runtimes/dsh/launch.js +14 -2
  49. package/dist/runtimes/dsh/launch.js.map +1 -1
  50. package/dist/runtimes/dsh/list-models.d.ts +3 -1
  51. package/dist/runtimes/dsh/list-models.d.ts.map +1 -1
  52. package/dist/runtimes/dsh/list-models.js +28 -9
  53. package/dist/runtimes/dsh/list-models.js.map +1 -1
  54. package/dist/runtimes/dsh/options.d.ts +6 -0
  55. package/dist/runtimes/dsh/options.d.ts.map +1 -1
  56. package/dist/runtimes/dsh/options.js +15 -1
  57. package/dist/runtimes/dsh/options.js.map +1 -1
  58. package/dist/runtimes/dsh/session.d.ts.map +1 -1
  59. package/dist/runtimes/dsh/session.js +46 -6
  60. package/dist/runtimes/dsh/session.js.map +1 -1
  61. package/dist/runtimes/dsh/skills.js +1 -1
  62. package/dist/runtimes/dsh/skills.js.map +1 -1
  63. package/dist/runtimes/factory/options.d.ts.map +1 -1
  64. package/dist/runtimes/factory/options.js +1 -0
  65. package/dist/runtimes/factory/options.js.map +1 -1
  66. package/dist/runtimes/grok/options.d.ts.map +1 -1
  67. package/dist/runtimes/grok/options.js +1 -0
  68. package/dist/runtimes/grok/options.js.map +1 -1
  69. package/dist/runtimes/kimi/options.d.ts.map +1 -1
  70. package/dist/runtimes/kimi/options.js +1 -0
  71. package/dist/runtimes/kimi/options.js.map +1 -1
  72. package/dist/runtimes/opencode/options.d.ts.map +1 -1
  73. package/dist/runtimes/opencode/options.js +1 -0
  74. package/dist/runtimes/opencode/options.js.map +1 -1
  75. package/dist/runtimes/pi/credential-shape.d.ts.map +1 -1
  76. package/dist/runtimes/pi/credential-shape.js +4 -0
  77. package/dist/runtimes/pi/credential-shape.js.map +1 -1
  78. package/dist/runtimes/pi/list-models.d.ts +3 -2
  79. package/dist/runtimes/pi/list-models.d.ts.map +1 -1
  80. package/dist/runtimes/pi/list-models.js +12 -2
  81. package/dist/runtimes/pi/list-models.js.map +1 -1
  82. package/dist/runtimes/pi/model-projection.d.ts +2 -0
  83. package/dist/runtimes/pi/model-projection.d.ts.map +1 -1
  84. package/dist/runtimes/pi/model-projection.js.map +1 -1
  85. package/dist/runtimes/pi/open.d.ts.map +1 -1
  86. package/dist/runtimes/pi/open.js +9 -27
  87. package/dist/runtimes/pi/open.js.map +1 -1
  88. package/dist/runtimes/pi/projection.d.ts.map +1 -1
  89. package/dist/runtimes/pi/projection.js +6 -3
  90. package/dist/runtimes/pi/projection.js.map +1 -1
  91. package/dist/runtimes/pi/rpc/readers.d.ts.map +1 -1
  92. package/dist/runtimes/pi/rpc/readers.js +2 -0
  93. package/dist/runtimes/pi/rpc/readers.js.map +1 -1
  94. package/dist/runtimes/pi/rpc/session.js +1 -1
  95. package/dist/runtimes/pi/rpc/session.js.map +1 -1
  96. package/dist/runtimes/pi/session.js +1 -1
  97. package/dist/runtimes/pi/session.js.map +1 -1
  98. package/dist/runtimes/pi-durable/options.d.ts.map +1 -1
  99. package/dist/runtimes/pi-durable/options.js +1 -0
  100. package/dist/runtimes/pi-durable/options.js.map +1 -1
  101. package/dist/runtimes/qoder/options.d.ts.map +1 -1
  102. package/dist/runtimes/qoder/options.js +1 -0
  103. package/dist/runtimes/qoder/options.js.map +1 -1
  104. package/dist/runtimes/qoder/projection.js +1 -1
  105. package/dist/runtimes/qoder/projection.js.map +1 -1
  106. package/dist/runtimes/qwen/options.d.ts.map +1 -1
  107. package/dist/runtimes/qwen/options.js +1 -0
  108. package/dist/runtimes/qwen/options.js.map +1 -1
  109. package/dist/runtimes/qwen/projection.js +1 -1
  110. package/dist/runtimes/qwen/projection.js.map +1 -1
  111. package/dist/shared/acp/turns.js +3 -5
  112. package/dist/shared/acp/turns.js.map +1 -1
  113. package/dist/shared/session-options.js +1 -1
  114. package/dist/shared/session-options.js.map +1 -1
  115. package/dist/shared/stream-json/profile.d.ts +0 -1
  116. package/dist/shared/stream-json/profile.d.ts.map +1 -1
  117. package/dist/shared/stream-json/projection.js +1 -1
  118. package/dist/shared/stream-json/projection.js.map +1 -1
  119. package/dist/testing/scripted-runtime.js +1 -1
  120. package/dist/testing/scripted-runtime.js.map +1 -1
  121. package/package.json +8 -8
@@ -60,8 +60,6 @@ function requireMethod(target, key, capability) {
60
60
  }
61
61
  }
62
62
 
63
-
64
-
65
63
  export function apply(ctx, config) {
66
64
  const loader = ctx.get("loader");
67
65
  if (typeof loader?.await !== "function") {
@@ -82,6 +80,28 @@ export function apply(ctx, config) {
82
80
  // Cordis FiberState.ACTIVE is 2 in the native protocol we probe.
83
81
  if (fiber.state !== 2) { throw refusal("mcp_inactive", "Requested MCP plugin is not active (native state " + fiber.state + ")", "session MCP"); }
84
82
  }
83
+ if (config?.sessionLogPlugin !== undefined) {
84
+ const plugin = config.sessionLogPlugin;
85
+ requireMethod(loader, "entries", "sessionLogUpload");
86
+ const entry = [...loader.entries()].find((row) => row.options?.id === plugin.id);
87
+ if (entry === undefined) {
88
+ throw refusal("option_not_applied", "DSH does not mount the " + plugin.id + " plugin, so OAR cannot confirm session-log upload is off", "sessionLogUpload");
89
+ }
90
+ if (entry.options?.name !== plugin.name) {
91
+ throw refusal("option_not_applied", "DSH " + plugin.id + " entry does not match " + plugin.name, "sessionLogUpload");
92
+ }
93
+ if (entry.options?.disabled !== true) {
94
+ if (entry.options?.config?.enabled !== false) {
95
+ throw refusal("option_not_applied", "DSH did not apply enabled: false to " + plugin.id, "sessionLogUpload");
96
+ }
97
+ const fiber = entry.fiber;
98
+ requireMethod(fiber, "await", "sessionLogUpload");
99
+ await fiber.await();
100
+ if (fiber.state !== 2) {
101
+ throw refusal("option_not_applied", "DSH " + plugin.id + " plugin is not active (native state " + fiber.state + ")", "sessionLogUpload");
102
+ }
103
+ }
104
+ }
85
105
  boot(ctx, config);
86
106
  }
87
107
  catch (error) { const native = structured(error); write({ type: "startup-error", error: native, code: native.code, capability: native.capability }); }
@@ -113,10 +133,13 @@ ${dshInputSource}
113
133
  handles.set(agent.session.id, handle);
114
134
  routes.set(agent, route);
115
135
  const modelCurrent = typeof agent.model?.current === "function";
136
+ const sessionFile = await sessionFileOf(agent.session.id);
116
137
  return { compact: typeof ctx.get("compaction")?.compactNow === "function", imageTypes: await imageTypes(agent), sessionId: agent.session.id, header: agent.session.header, status: agent.status,
117
138
  jobMethods: methods(jobs, ["get", "kill", "wait"]),
118
139
  methods: methods(agent, AGENT_METHODS), inboxMethods: methods(agent.inbox, INBOX_METHODS),
119
140
  pending: { nextTurn: agent.inbox?.nextTurn?.length, nextStep: agent.inbox?.nextStep?.length },
141
+ sessionFileStat: typeof persistence?.stat === "function",
142
+ ...(sessionFile === undefined ? {} : { sessionFile }),
120
143
  modelCurrent, ...(modelCurrent ? { model: agent.model.current() } : {}) };
121
144
  };
122
145
 
@@ -236,17 +259,25 @@ ${dshGoalSource}
236
259
  return { providers, default: defaultRoute() };
237
260
  },
238
261
  async dispose() {
262
+ const ids = [...handles.keys()];
239
263
  const results = await Promise.allSettled([...handles.values()].map(async (handle) => { await handle.dispose(); }));
240
264
  handles.clear();
241
265
  if (typeof persistence?.flush === "function") { await persistence.flush(); }
266
+ const sessionFiles = {};
267
+ for (const id of ids) {
268
+ try {
269
+ const path = await sessionFileOf(id);
270
+ if (path !== undefined) { sessionFiles[id] = path; }
271
+ } catch {}
272
+ }
242
273
  const failed = results.find((result) => result.status === "rejected");
243
274
  if (failed !== undefined) { throw failed.reason; }
244
- return {};
275
+ return Object.keys(sessionFiles).length === 0 ? {} : { sessionFiles };
245
276
  },
246
277
  };
247
278
 
248
279
  write({ type: "ready", protocol: PROTOCOL,
249
- services: { agents: methods(agents, ["create", "resume"]), sessionPersistence: methods(persistence, ["list", "open", "flush"]) } });
280
+ services: { agents: methods(agents, ["create", "resume"]), sessionPersistence: methods(persistence, ["list", "open", "flush", "stat"]) } });
250
281
 
251
282
  const input = createInterface({ input: process.stdin, crlfDelay: Infinity });
252
283
  input.on("line", (line) => { void receive(line); });
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.js","sources":["../../../src/runtimes/dsh/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,gIAAgI;AAChI,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;mBAKtB,MAAM,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsE5C,gBAAgB;;;;;;;;;;;;;;;;EAgBhB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4Bd,eAAe;;;;;;EAMf,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Hd,CAAC"}
1
+ {"version":3,"file":"bridge.js","sources":["../../../src/runtimes/dsh/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,gIAAgI;AAChI,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;mBAKtB,MAAM,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0F5C,gBAAgB;;;;;;;;;;;;;;;;EAgBhB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+Bd,eAAe;;;;;;EAMf,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkId,CAAC"}
@@ -5,6 +5,7 @@ export declare const dshRuntime: Omit<{
5
5
  readonly activeTurn: "reject";
6
6
  };
7
7
  readonly sessionCapabilities: (installation: import("../../browser.js").AvailableInstallation) => {
8
+ nativeSessionFile?: boolean;
8
9
  compactionEvents: {
9
10
  started: true;
10
11
  ended: true;
@@ -15,7 +16,27 @@ export declare const dshRuntime: Omit<{
15
16
  };
16
17
  mcpTransports: "stdio"[];
17
18
  stopTask: true;
18
- refusedSessionOptions: Readonly<Partial<Record<import("../../contracts/runtime.js").RefusableSessionOption, string>>>;
19
+ refusedSessionOptions: {
20
+ additionalDirectories?: string;
21
+ appendSystemPrompt?: string;
22
+ disallowedTools?: string;
23
+ endTurnProcessesOnAbort?: string;
24
+ env?: string;
25
+ fork?: string;
26
+ goals?: string;
27
+ launchArgs?: string;
28
+ mcpServerCredentials?: string;
29
+ mcpServers?: string;
30
+ modelRequests?: string;
31
+ name?: string;
32
+ nativeMemoryDefault?: string;
33
+ outputSchema?: string;
34
+ partialUserConfiguration?: string;
35
+ serviceTier?: string;
36
+ sessionLogUpload?: string;
37
+ systemPrompt?: string;
38
+ userConfiguration?: string;
39
+ };
19
40
  };
20
41
  readonly brand: {
21
42
  readonly name: "DeepSeek Harness";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/dsh/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/dsh/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCK,CAAC"}
@@ -4,12 +4,23 @@ import { defineRuntime } from "../../contracts/runtime.js";
4
4
  import { onFirstCall } from "../../shared/lazy.js";
5
5
  import { dshInstallation } from "./installation.js";
6
6
  import { dshInstall, dshInstallPlan } from "./install.js";
7
- import { dshDirectoryRefusal, dshRefusedSessionOptions } from "./options.js";
7
+ import { dshDirectoryRefusal, dshRefusedSessionOptions, dshSessionLogUploadRefusal, dshSupportsNativeSessionFile } from "./options.js";
8
8
  import { DSH_MINIMUM_VERSION } from "./version.js";
9
9
  export const dshRuntime = defineRuntime({
10
10
  id: "dsh",
11
11
  manualCompaction: { kind: "supported", activeTurn: "reject" },
12
- sessionCapabilities: (installation) => ({ compactionEvents: { started: true, ended: true }, contextUsage: { tokens: true, contextWindow: true }, mcpTransports: ["stdio"], stopTask: true, refusedSessionOptions: dshDirectoryRefusal(installation.via === "executable" ? installation.version : undefined) }), brand: runtimeBrands.dsh, verifiedPlatforms: verifiedPlatforms.dsh,
12
+ sessionCapabilities: (installation) => {
13
+ const version = installation.via === "executable" ? installation.version : undefined;
14
+ const nativeSessionFile = dshSupportsNativeSessionFile(version);
15
+ return {
16
+ ...(nativeSessionFile === undefined ? {} : { nativeSessionFile }),
17
+ compactionEvents: { started: true, ended: true },
18
+ contextUsage: { tokens: true, contextWindow: true },
19
+ mcpTransports: ["stdio"],
20
+ stopTask: true,
21
+ refusedSessionOptions: { ...dshDirectoryRefusal(version), ...dshSessionLogUploadRefusal(version) },
22
+ };
23
+ }, brand: runtimeBrands.dsh, verifiedPlatforms: verifiedPlatforms.dsh,
13
24
  minVersion: DSH_MINIMUM_VERSION,
14
25
  // The default route reads DEEPSEEK_API_KEY; a key saved through DSH's own settings wins (docs/runtimes/dsh.md#credentials).
15
26
  credentials: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/runtimes/dsh/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,EAAE,EAAE,KAAK;IACT,gBAAgB,EAAE,EAAE,I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AAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -14,10 +14,15 @@ export interface LaunchedDsh {
14
14
  * host that names its own mode for this session keeps it.
15
15
  */
16
16
  export declare function dshEnvironment(env: SessionOptions["env"]): NodeJS.ProcessEnv;
17
+ export interface DshLaunchOptions {
18
+ readonly mcpRows?: readonly JsonRecord[];
19
+ readonly disableSessionLogUpload?: boolean;
20
+ readonly signal?: AbortSignal;
21
+ }
17
22
  /**
18
23
  * One owned `dsh --profile acp` process with the ACP protocol plugin off and the
19
24
  * bridge on. The profile supplies the native core and its stdin shutdown; no ACP
20
25
  * message is exchanged. The overlay is an invocation layer: it edits no user file.
21
26
  */
22
- export declare function launchDsh(command: string, cwd: string, env: NodeJS.ProcessEnv, mcpRows?: readonly JsonRecord[], signal?: AbortSignal): Promise<LaunchedDsh>;
27
+ export declare function launchDsh(command: string, cwd: string, env: NodeJS.ProcessEnv, options?: DshLaunchOptions): Promise<LaunchedDsh>;
23
28
  //# sourceMappingURL=launch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sources":["../../../src/runtimes/dsh/launch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,YAAY,IAAI,IAAI,CAAA;KAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,UAAU,CAG5E;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,GAAE,SAAS,UAAU,EAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBrK"}
1
+ {"version":3,"file":"launch.d.ts","sources":["../../../src/runtimes/dsh/launch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,YAAY,IAAI,IAAI,CAAA;KAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,UAAU,CAG5E;AAKD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CA0B1I"}
@@ -15,19 +15,31 @@ export function dshEnvironment(env) {
15
15
  const explicit = env?.DSH_PERMISSION_MODE;
16
16
  return { ...sessionEnvironment(env), ...(typeof explicit === "string" ? {} : { DSH_PERMISSION_MODE: "danger-full-access" }) };
17
17
  }
18
+ const SESSION_LOG_PLUGIN_ID = "session-log-deepseek";
19
+ const SESSION_LOG_PLUGIN_NAME = "@deepseek-ai/dsh-session-log-deepseek";
18
20
  /**
19
21
  * One owned `dsh --profile acp` process with the ACP protocol plugin off and the
20
22
  * bridge on. The profile supplies the native core and its stdin shutdown; no ACP
21
23
  * message is exchanged. The overlay is an invocation layer: it edits no user file.
22
24
  */
23
- export async function launchDsh(command, cwd, env, mcpRows = [], signal) {
25
+ export async function launchDsh(command, cwd, env, options = {}) {
26
+ const { mcpRows = [], disableSessionLogUpload = false, signal } = options;
24
27
  const directory = await privateTempDir("oar-dsh-");
25
28
  let release = undefined;
26
29
  try {
27
30
  const bridge = path.join(directory.path, "bridge.mjs");
28
31
  const patch = path.join(directory.path, "patch.json");
29
32
  await writeFile(bridge, dshBridgeSource, { mode: 0o600, flag: "wx" });
30
- await writeFile(patch, JSON.stringify([{ id: "acp", disabled: true }, { insert: [...mcpRows, { id: "oar-dsh-bridge", name: pathToFileURL(bridge).href, config: { mcpEntries: mcpRows.map((row) => row.id) } }] }]), { mode: 0o600, flag: "wx" });
33
+ const bridgeConfig = {
34
+ mcpEntries: mcpRows.map((row) => row.id),
35
+ ...(disableSessionLogUpload ? { sessionLogPlugin: { id: SESSION_LOG_PLUGIN_ID, name: SESSION_LOG_PLUGIN_NAME } } : {}),
36
+ };
37
+ const patchRows = [
38
+ { id: "acp", disabled: true },
39
+ { insert: [...mcpRows, { id: "oar-dsh-bridge", name: pathToFileURL(bridge).href, config: bridgeConfig }] },
40
+ ...(disableSessionLogUpload ? [{ id: SESSION_LOG_PLUGIN_ID, name: SESSION_LOG_PLUGIN_NAME, config: { enabled: false } }] : []),
41
+ ];
42
+ await writeFile(patch, JSON.stringify(patchRows), { mode: 0o600, flag: "wx" });
31
43
  const finish = await acquireDshProfile(env, cwd, signal);
32
44
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AAM,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/E,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACzD,OAAO,GAAG,MAAM,CAAC;QACjB,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACjI,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,CAAC,OAAO,CAAC;QACpB,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC;IACnF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QAAC,MAAM,KAAK,CAAC;IAAC,CAAC;AACxE,CAAC"}
@@ -1,7 +1,9 @@
1
- import type { ModelEntry, ModelLister } from "../../contracts/list-models.js";
1
+ import type { ListModelsResult, ModelEntry, ModelLister } from "../../contracts/list-models.js";
2
2
  import { type JsonRecord } from "../../shared/json.js";
3
3
  /** The native catalog as `Session.model` selectors. A provider that could not list is not a model; the caller decides what no model means. */
4
4
  export declare function projectDshModels(catalog: JsonRecord): readonly ModelEntry[];
5
+ /** Classify DSH's native `models` catalog without inspecting environment variables. */
6
+ export declare function dshCatalogResult(catalog: JsonRecord): ListModelsResult;
5
7
  /** Native `llm.listProviders`, `listModels` and `resolveModelInfo`, in a short-lived process started the way a session is. */
6
8
  export declare const dshListModels: ModelLister;
7
9
  //# sourceMappingURL=list-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.d.ts","sources":["../../../src/runtimes/dsh/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAEhG,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAO/E,8IAA8I;AAC9I,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,UAAU,EAAE,CAmB3E;AAED,8HAA8H;AAC9H,eAAO,MAAM,aAAa,EAAE,WA2B3B,CAAC"}
1
+ {"version":3,"file":"list-models.d.ts","sources":["../../../src/runtimes/dsh/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAEhG,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAO/E,8IAA8I;AAC9I,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,UAAU,EAAE,CAmB3E;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,gBAAgB,CAwBtE;AAED,8HAA8H;AAC9H,eAAO,MAAM,aAAa,EAAE,WAsB3B,CAAC"}
@@ -31,6 +31,32 @@ export function projectDshModels(catalog) {
31
31
  });
32
32
  });
33
33
  }
34
+ /** Classify DSH's native `models` catalog without inspecting environment variables. */
35
+ export function dshCatalogResult(catalog) {
36
+ const models = projectDshModels(catalog);
37
+ if (models.length > 0) {
38
+ return { kind: "ok", models };
39
+ }
40
+ const providers = asRecordList(catalog.providers);
41
+ const selected = asRecord(catalog.default);
42
+ const defaultProvider = typeof selected?.provider === "string" && selected.provider.length > 0 ? selected.provider : undefined;
43
+ if (defaultProvider !== undefined) {
44
+ const entry = providers.find((provider) => provider.id === defaultProvider);
45
+ if (entry !== undefined && typeof entry.failure !== "string" && asRecordList(entry.models).length === 0) {
46
+ const defaultModel = typeof selected?.model === "string" && selected.model.length > 0 ? selected.model : undefined;
47
+ const target = defaultModel === undefined ? `"${defaultProvider}"` : `"${defaultProvider}" (${defaultProvider}/${defaultModel})`;
48
+ return {
49
+ kind: "unauthenticated",
50
+ detail: `DSH default provider ${target} listed no models; configure credentials for ${defaultProvider}.`,
51
+ };
52
+ }
53
+ }
54
+ const failures = providers.flatMap((provider) => typeof provider.failure === "string" ? [`${String(provider.id)}: ${provider.failure}`] : []);
55
+ if (failures.length > 0) {
56
+ return { kind: "unsupported", reason: `DSH could not list any provider's models: ${failures.join("; ")}` };
57
+ }
58
+ return { kind: "ok", models };
59
+ }
34
60
  /** Native `llm.listProviders`, `listModels` and `resolveModelInfo`, in a short-lived process started the way a session is. */
35
61
  export const dshListModels = async (installation, options = {}) => {
36
62
  if (installation.via !== "executable") {
@@ -45,20 +71,13 @@ export const dshListModels = async (installation, options = {}) => {
45
71
  if (refusal !== null) {
46
72
  return refusal;
47
73
  }
48
- const launched = await launchDsh(installation.command, listingCwd(options), env, [], signal);
74
+ const launched = await launchDsh(installation.command, listingCwd(options), env, { signal });
49
75
  own(launched.child);
50
76
  const control = dshControl(launched.child, () => { });
51
77
  try {
52
78
  await control.ready;
53
79
  const catalog = await control.request("models", {}, options.timeoutMs);
54
- const models = projectDshModels(catalog);
55
- if (models.length === 0) {
56
- const failures = asRecordList(catalog.providers).flatMap((provider) => typeof provider.failure === "string" ? [`${String(provider.id)}: ${provider.failure}`] : []);
57
- if (failures.length > 0) {
58
- return { kind: "unsupported", reason: `DSH could not list any provider's models: ${failures.join("; ")}` };
59
- }
60
- }
61
- return { kind: "ok", models };
80
+ return dshCatalogResult(catalog);
62
81
  }
63
82
  catch (error) {
64
83
  if (error instanceof DshCommandError && error.code === "native_method_unavailable") {
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.js","sources":["../../../src/runtimes/dsh/list-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,8IAA8I;AAC9I,MAAM,UAAU,gBAAgB,CAAC,OAAmB;IAClD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1D,IAAI,OAAO,QAAQ,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC;QAAC,CAAC;QACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAgB,EAAE;YACnE,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;gBAAC,OAAO,EAAE,CAAC;YAAC,CAAC;YAChD,MAAM,SAAS,GAAG,Q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AG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,KAAK,CAAC;YACpB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YACvE,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,2BAA2B,EAAE,CAAC;gBAAC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAAC,CAAC;YAC9I,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -4,6 +4,12 @@ import type { SessionOptions } from "../../contracts/session.js";
4
4
  export declare const dshRefusedSessionOptions: RefusedSessionOptions;
5
5
  /** Session-scoped directory grants are effective for file and process writes on these platforms. */
6
6
  export declare function dshDirectoryRefusal(version: string | undefined, platform?: NodeJS.Platform): RefusedSessionOptions;
7
+ /** First DSH release whose `sessionPersistence.stat(id)` returns `location.path` (0.2.1-rc.5 omits `location`). */
8
+ export declare const DSH_NATIVE_SESSION_FILE_VERSION = "0.2.2-alpha.2";
9
+ /** Whether this DSH version reports `location.path` from `sessionPersistence.stat(id)`, or undefined when unreadable. */
10
+ export declare function dshSupportsNativeSessionFile(version: string | undefined): boolean | undefined;
11
+ /** DSH 0.2.1-rc.5 and later ship @deepseek-ai/dsh-session-log-deepseek (verified on 0.2.1-rc.5 and 0.2.2-rc.5); bridge startup still confirms the row after loader.await(). */
12
+ export declare function dshSessionLogUploadRefusal(version: string | undefined): Pick<RefusedSessionOptions, "sessionLogUpload">;
7
13
  export interface DshAgentOptions {
8
14
  readonly provider?: string;
9
15
  readonly model?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sources":["../../../src/runtimes/dsh/options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,wHAAwH;AACxH,eAAO,MAAM,wBAAwB,EAAE,qBAUtC,CAAC;AAEF,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,qBAAqB,CAQpI;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,+HAA+H;AAC/H,wBAAgB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG,eAAe,CASlG"}
1
+ {"version":3,"file":"options.d.ts","sources":["../../../src/runtimes/dsh/options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,wHAAwH;AACxH,eAAO,MAAM,wBAAwB,EAAE,qBAUtC,CAAC;AAEF,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,qBAAqB,CAQpI;AAED,mHAAmH;AACnH,eAAO,MAAM,+BAA+B,kBAAkB,CAAC;AAE/D,yHAAyH;AACzH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAG7F;AAED,+KAA+K;AAC/K,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAIvH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,+HAA+H;AAC/H,wBAAgB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG,eAAe,CASlG"}
@@ -1,5 +1,6 @@
1
1
  import { UnsupportedOptionError } from "../../contracts/errors.js";
2
- import { compareSemver } from "../../shared/semver.js";
2
+ import { compareSemver, semverAtLeast } from "../../shared/semver.js";
3
+ import { DSH_MINIMUM_VERSION } from "./version.js";
3
4
  /** Each stays refused until its own native probe. DSH may well have the concept; OAR has not verified its semantics. */
4
5
  export const dshRefusedSessionOptions = {
5
6
  modelRequests: "This adapter has no verified capture of the root agent's provider request",
@@ -22,6 +23,19 @@ export function dshDirectoryRefusal(version, platform = process.platform) {
22
23
  ? { additionalDirectories: "DSH versions below 0.2.2-rc.3 have no session-scoped registerWritableRoot that preserves the existing sandbox policy" }
23
24
  : {};
24
25
  }
26
+ /** First DSH release whose `sessionPersistence.stat(id)` returns `location.path` (0.2.1-rc.5 omits `location`). */
27
+ export const DSH_NATIVE_SESSION_FILE_VERSION = "0.2.2-alpha.2";
28
+ /** Whether this DSH version reports `location.path` from `sessionPersistence.stat(id)`, or undefined when unreadable. */
29
+ export function dshSupportsNativeSessionFile(version) {
30
+ const order = version === undefined ? null : compareSemver(version, DSH_NATIVE_SESSION_FILE_VERSION);
31
+ return order === null ? undefined : order >= 0;
32
+ }
33
+ /** DSH 0.2.1-rc.5 and later ship @deepseek-ai/dsh-session-log-deepseek (verified on 0.2.1-rc.5 and 0.2.2-rc.5); bridge startup still confirms the row after loader.await(). */
34
+ export function dshSessionLogUploadRefusal(version) {
35
+ return semverAtLeast(version, DSH_MINIMUM_VERSION)
36
+ ? {}
37
+ : { sessionLogUpload: `DSH session-log upload control requires a verified version of ${DSH_MINIMUM_VERSION} or later` };
38
+ }
25
39
  /** DSH routes every request by provider and model; a bare model name has no route and would fail only at its first request. */
26
40
  export function dshAgentOptions(options) {
27
41
  const { model, effort } = options;
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sources":["../../../src/runtimes/dsh/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,wHAAwH;AACxH,MAAM,CAAC,MAAM,wBAAwB,GAA0B;IAC7D,aAAa,EAAE,2EAA2E;IAC1F,IAAI,EAAE,qHAAqH;IAC3H,oBAAoB,EAAE,oGAAoG;IAC1H,UAAU,EAAE,6GAA6G;IACzH,WAAW,EAAE,mEAAmE;IAChF,YAAY,EAAE,iDAAiD;IAC/D,iBAAiB,EAAE,oIAAoI;IACvJ,uBAAuB,EAAE,kJAAkJ;IAC3K,mBAAmB,EAAE,6EAA6E;CACnG,CAAC;AAEF,oGAAoG;AACpG,MAAM,UAAU,mBAAmB,CAAC,OAA2B,EAAE,QAAQ,GAAoB,OAAO,CAAC,QAAQ;IAC3G,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,EAAE,qBAAqB,EAAE,sGAAsG,EAAE,CAAC;IAC3I,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAA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CAAC;QAChD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,gBAAgB,EAAE,iEAAiE,mBAAmB,WAAW,EAAE,CAAC;AAC5H,CAAC;AAQD,+HAA+H;AAC/H,MAAM,UAAU,eAAe,CAAC,OAAiD;IAC/E,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC7E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,YAAY,CAAC;IAAC,CAAC;IACjD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,sBAAsB,CAAC,OAAO,EAAE,8CAA8C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC;AACrG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sources":["../../../src/runtimes/dsh/session.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAyC,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA2MtG,kFAAkF;AAClF,eAAO,MAAM,UAAU,EAAE,YAevB,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sources":["../../../src/runtimes/dsh/session.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAyC,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAgPtG,kFAAkF;AAClF,eAAO,MAAM,UAAU,EAAE,YAgBvB,CAAC"}
@@ -14,6 +14,7 @@ import { createAbortFallback } from "../../shared/abort-fallback.js";
14
14
  import { appendCleanupFailure, cleanupFailureReason } from "../../shared/executable/process-cleanup.js";
15
15
  import { withInputImages } from "../../shared/input-images.js";
16
16
  import { asRecord } from "../../shared/json.js";
17
+ import { sessionFileLocator } from "../../shared/native-session-file.js";
17
18
  import { sameDirectory } from "../../shared/same-directory.js";
18
19
  import { checkSessionName, refuseSessionOptions } from "../../shared/session-options.js";
19
20
  import { withSessionCredentials } from "../../shared/session-credentials.js";
@@ -23,7 +24,7 @@ import { dshEnvironment, launchDsh } from "./launch.js";
23
24
  import { isBackgroundShellJob } from "./jobs.js";
24
25
  import { dshGoalControl } from "./goal.js";
25
26
  import { dshMcpRows } from "./mcp.js";
26
- import { dshAgentOptions, dshDirectoryRefusal, dshRefusedSessionOptions } from "./options.js";
27
+ import { dshAgentOptions, dshDirectoryRefusal, dshRefusedSessionOptions, dshSessionLogUploadRefusal, dshSupportsNativeSessionFile } from "./options.js";
27
28
  import { dshOpenedFrame, foldDsh, initialDshProjection } from "./projection.js";
28
29
  const OPEN_TIMEOUT_MS = 60_000;
29
30
  const DISPOSE_TIMEOUT_MS = 8000;
@@ -35,7 +36,7 @@ function openFailure(error, sessionId, resuming) {
35
36
  if (error.native.name === "SessionPersistenceNotFoundError") {
36
37
  return new SessionNotFoundError(sessionId, `DSH has no saved session ${sessionId}`, { method: "sessionPersistence.open", native: error.native });
37
38
  }
38
- if ((error.code === "native_method_unavailable" || error.code === "option_not_applied") && (error.capability === "name" || error.capability === "disallowedTools" || error.capability === "additionalDirectories")) {
39
+ if ((error.code === "native_method_unavailable" || error.code === "option_not_applied") && (error.capability === "name" || error.capability === "disallowedTools" || error.capability === "additionalDirectories" || error.capability === "sessionLogUpload")) {
39
40
  return new UnsupportedOptionError(error.capability, error.message);
40
41
  }
41
42
  if (error.code === "prompt_not_applied" && (error.capability === "systemPrompt" || error.capability === "appendSystemPrompt")) {
@@ -119,22 +120,42 @@ const inputFields = (text, inputId, images) => ({
119
120
  text, ...(inputId === undefined ? {} : { inputId }),
120
121
  ...(images.length === 0 ? {} : { images: images.map(({ data, mediaType }) => ({ data, mediaType })) }),
121
122
  });
122
- async function open(command, options, env, credentials, mcpRows) {
123
+ async function open(command, options, env, credentials, mcpRows, supportsSessionFile) {
123
124
  const sessionId = options.resume ?? randomUUID();
124
125
  const agentOptions = dshAgentOptions(options);
125
126
  const kernel = credentials.kernel(sessionId);
126
127
  let projection = initialDshProjection(sessionId);
127
- const { child, directory } = await launchDsh(command, options.cwd, env, mcpRows);
128
+ const { child, directory } = await launchDsh(command, options.cwd, env, { mcpRows, disableSessionLogUpload: options.sessionLogUpload === "off" });
128
129
  const fallback = createAbortFallback(() => { child.kill(); });
130
+ let exited = false;
131
+ let hasSessionFileStat = false;
132
+ let sessionFilePath = undefined;
133
+ const rememberSessionFile = (value) => {
134
+ if (typeof value === "string" && value.length > 0) {
135
+ sessionFilePath = value;
136
+ }
137
+ };
129
138
  const control = dshControl(child, (message) => {
130
139
  const { state, frame } = foldDsh(projection, message);
131
140
  projection = state;
132
141
  if (frame.sessionId === undefined && frame.body.events.some((event) => event.kind === "turn_ended")) {
133
142
  fallback.clear();
143
+ if (hasSessionFileStat && !exited) {
144
+ void (async () => {
145
+ try {
146
+ const answer = await control.request("sessionFile", { sessionId, flush: false });
147
+ rememberSessionFile(answer.path);
148
+ }
149
+ catch {
150
+ // Best-effort refresh before unexpected exit; explicit calls still query or report errors.
151
+ }
152
+ })();
153
+ }
134
154
  }
135
155
  kernel.frame(frame.body, frame.sessionId === undefined ? undefined : { sessionId: frame.sessionId });
136
156
  }, credentials.redact);
137
157
  child.onExit((code, reason) => {
158
+ exited = true;
138
159
  fallback.clear();
139
160
  kernel.processExited(code, sessionExitReason(child, reason, credentials.redact));
140
161
  });
@@ -171,6 +192,22 @@ async function open(command, options, env, credentials, mcpRows) {
171
192
  throw appendCleanupFailure(openFailure(error, sessionId, options.resume !== undefined), cleanupFailureReason(child.diagnostics().cleanup));
172
193
  }
173
194
  kernel.frame(dshOpenedFrame(opened));
195
+ hasSessionFileStat = supportsSessionFile && opened.sessionFileStat === true;
196
+ rememberSessionFile(opened.sessionFile);
197
+ const nativeSessionFile = hasSessionFileStat ? async () => {
198
+ if (!exited) {
199
+ try {
200
+ const answer = await control.request("sessionFile", { sessionId, flush: true });
201
+ rememberSessionFile(answer.path);
202
+ }
203
+ catch (error) {
204
+ if (!isDshExitedError(error)) {
205
+ throw error;
206
+ }
207
+ }
208
+ }
209
+ return sessionFileLocator(sessionFilePath, credentials.redact)();
210
+ } : undefined;
174
211
  const capabilities = { queue: { durable: false }, attribution: "nested", images: Array.isArray(opened.imageTypes) && opened.imageTypes.length > 0 };
175
212
  const methods = asRecord(opened.methods) ?? {};
176
213
  const inboxMethods = asRecord(opened.inboxMethods) ?? {};
@@ -189,6 +226,7 @@ async function open(command, options, env, credentials, mcpRows) {
189
226
  const compactBusy = { kind: "rejected", code: "busy", reason: "DSH is compacting this session" };
190
227
  return credentials.seal({
191
228
  id: sessionId, capabilities, resources: child.resources,
229
+ ...(nativeSessionFile === undefined ? {} : { nativeSessionFile }),
192
230
  ...(compaction === undefined ? {} : { compact: compaction.compact }),
193
231
  ...(options.goals === true ? { goal: dshGoalControl(kernel, control, sessionId, refusalOf) } : {}),
194
232
  prompt: async (text, inputOptions) => kernel.control({ kind: "prompt", input: text, ...inputOptions }, async () => {
@@ -250,7 +288,8 @@ async function open(command, options, env, credentials, mcpRows) {
250
288
  // Native disposal records its own turn end and flushes the log; the
251
289
  // process owner then bounds shutdown and removes anything left.
252
290
  try {
253
- await control.request("dispose", {}, DISPOSE_TIMEOUT_MS);
291
+ const disposed = await control.request("dispose", {}, DISPOSE_TIMEOUT_MS);
292
+ rememberSessionFile(asRecord(disposed.sessionFiles)?.[sessionId]);
254
293
  }
255
294
  catch (error) {
256
295
  kernel.frame({ type: "dsh/dispose-failed", native: error instanceof DshCommandError ? error.native : { message: String(error) }, events: [] });
@@ -275,12 +314,13 @@ export const dshSession = withSessionCredentials(async (installation, options, c
275
314
  const env = dshEnvironment(options.env);
276
315
  // A floor refusal names the real version, before anything starts.
277
316
  const version = installation.version ?? await readExecutableVersion(installation.command, 15_000, undefined, env);
317
+ refuseSessionOptions(dshSessionLogUploadRefusal(version), options);
278
318
  const refusal = dshVersionRefusal(version);
279
319
  if (refusal !== null) {
280
320
  throw new RuntimeFailureError("invalid_request", refusal);
281
321
  }
282
322
  refuseSessionOptions(dshDirectoryRefusal(version), options);
283
323
  const directories = resolvedAdditionalDirectories(options);
284
- return open(installation.command, directories.length === 0 ? options : { ...options, additionalDirectories: directories }, env, credentials, mcpRows);
324
+ return open(installation.command, directories.length === 0 ? options : { ...options, additionalDirectories: directories }, env, credentials, mcpRows, dshSupportsNativeSessionFile(version) === true);
285
325
  });
286
326
  //# sourceMappingURL=session.js.map