@mininglamp-oss/octo-runtime 1.1.2 → 1.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 (140) hide show
  1. package/README.md +1 -1
  2. package/apps/cli/dist/build-info.json +2 -2
  3. package/apps/cli/dist/help.js +5 -1
  4. package/apps/cli/dist/main.js +32 -6
  5. package/apps/cli/dist/manifest.json +5 -0
  6. package/apps/cli/dist/openclaw.js +32 -8
  7. package/apps/cli/dist/output.js +3 -0
  8. package/apps/cli/dist/playboard.d.ts +5 -0
  9. package/apps/cli/dist/playboard.js +41 -13
  10. package/dist/public/dsh.d.ts +2 -0
  11. package/dist/public/dsh.js +1 -0
  12. package/dist/public/executor-kernel.d.ts +1 -1
  13. package/dist/public/executor-kernel.js +1 -1
  14. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +2 -2
  15. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +4 -0
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +26 -2
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +3 -3
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-DYOJCNWF.js +854 -0
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-G5PWGRL5.js +209 -0
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-UOQRXV3Q.js +340 -0
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +1 -0
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +16 -0
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +6 -0
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-client-LICENSE.txt +21 -0
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-protocol-LICENSE.txt +21 -0
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +35 -0
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +14 -0
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +52 -0
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +306 -0
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +11 -0
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +13 -0
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.d.ts +12 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +7 -0
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +15 -0
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +2 -1
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +10 -5
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +214 -55
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +3 -0
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.d.ts +4 -0
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +24 -2
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/hourly-log.js +11 -3
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +12 -3
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +30 -8
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +4 -3
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +15 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +29 -1
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +5 -5
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  64. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  65. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +5 -1
  66. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +32 -6
  67. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +5 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +32 -8
  69. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +3 -0
  70. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +5 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +41 -13
  72. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -23
  73. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.d.ts +2 -2
  74. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.js +16 -6
  75. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/systemd.js +9 -7
  76. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.d.ts +4 -1
  77. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +36 -11
  78. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  79. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -2
  80. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  81. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -1
  82. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +2 -1
  83. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -1
  84. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +16 -1
  85. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +181 -27
  86. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +9 -2
  87. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +8 -0
  88. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +17 -0
  89. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  90. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +57 -1
  91. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +167 -25
  92. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +3 -1
  93. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +20 -1
  94. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +23 -0
  95. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +43 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +15 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +283 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +2 -0
  99. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +15 -1
  100. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +5 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -13
  102. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.d.ts +1 -1
  103. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.js +5 -3
  104. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +26 -1
  105. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +2 -1
  106. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +1 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +3 -2
  108. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +3 -2
  109. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +4 -0
  110. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +104 -3
  111. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.js +4 -3
  112. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.d.ts +2 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.js +7 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +2 -1
  115. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +9 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +49 -17
  117. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.js +2 -1
  118. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.d.ts +1 -1
  119. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +4 -2
  120. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +7 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +10 -7
  122. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  123. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +141 -16
  124. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.d.ts +3 -1
  125. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  126. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-CXTvRGim.js +74 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  128. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  129. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +33 -9
  130. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +9 -4
  131. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  132. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +5 -0
  133. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +39 -1
  134. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +76 -7
  135. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  136. package/package.json +35 -29
  137. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +57 -1
  138. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +443 -56
  139. package/packages/octo-runtime-protocol/schema/protocol.schema.json +357 -37
  140. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-DiPc-ipL.js +0 -74
@@ -0,0 +1,209 @@
1
+ import {
2
+ DSH_VERSION,
3
+ DshError,
4
+ dshError,
5
+ nativeCode
6
+ } from "./chunk-DYOJCNWF.js";
7
+
8
+ // packages/octo-runtime-adapter-dsh/dist/launch.js
9
+ import { spawn } from "node:child_process";
10
+ import { constants } from "node:fs";
11
+ import { access, stat } from "node:fs/promises";
12
+ import { delimiter, isAbsolute, join, resolve } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import { createProcessCleanup } from "@mininglamp-oss/octo-runtime-adapter-sdk/process-cleanup";
15
+ import { processEnvironmentValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
16
+ var VERSION_PROBE_TIMEOUT_MS = 1e4;
17
+ var VERSION_PROBE_MAX_BYTES = 4096;
18
+ var MAX_LAUNCH_ARGS = 64;
19
+ var MAX_LAUNCH_ARG_BYTES = 4096;
20
+ var MAX_TIMEOUT_MS = 864e5;
21
+ var MAX_OPTION_STRING_LENGTH = 4096;
22
+ var DSH_PROCESS_GRACE_MS = 1e3;
23
+ async function resolveDshLaunch(options, env, signal) {
24
+ if (options.args !== void 0 && options.command === void 0)
25
+ throw new DshError("DSH_CONFIG_INVALID");
26
+ if (options.command !== void 0 && options.desktopPath !== void 0)
27
+ throw new DshError("DSH_CONFIG_INVALID");
28
+ let command;
29
+ let args = [];
30
+ let dshBin;
31
+ if (options.dshBin !== void 0) {
32
+ if (options.command !== void 0 || options.args !== void 0 || options.desktopPath !== void 0)
33
+ throw new DshError("DSH_CONFIG_INVALID");
34
+ dshBin = resolve(stringOption(options, "dshBin", ""));
35
+ try {
36
+ if (!(await stat(dshBin)).isFile())
37
+ throw new Error("not a file");
38
+ } catch {
39
+ throw new DshError("DSH_EXECUTABLE_NOT_FOUND");
40
+ }
41
+ command = process.execPath;
42
+ args = [dshBin];
43
+ } else if (options.command !== void 0) {
44
+ if (typeof options.command !== "string" || !options.command.trim())
45
+ throw new DshError("DSH_CONFIG_INVALID");
46
+ command = await executable(options.command, env);
47
+ if (!command)
48
+ throw new DshError("DSH_EXECUTABLE_NOT_FOUND");
49
+ if (options.args !== void 0) {
50
+ if (!Array.isArray(options.args) || options.args.length > MAX_LAUNCH_ARGS || options.args.some((value) => typeof value !== "string" || value.length > MAX_LAUNCH_ARG_BYTES || value.includes("\0") || Buffer.byteLength(value) > MAX_LAUNCH_ARG_BYTES))
51
+ throw new DshError("DSH_CONFIG_INVALID");
52
+ args = options.args.map((value) => value);
53
+ }
54
+ } else if (options.desktopPath === void 0) {
55
+ command = await executable("dsh", env);
56
+ }
57
+ if (!command) {
58
+ const desktop = options.desktopPath ?? (process.platform === "darwin" ? "/Applications/DeepSeek Harness.app" : void 0);
59
+ if (typeof desktop !== "string" || !isAbsolute(desktop))
60
+ throw new DshError("DSH_EXECUTABLE_NOT_FOUND");
61
+ if (process.platform !== "darwin")
62
+ throw new DshError("DSH_CONFIG_INVALID");
63
+ command = join(desktop, "Contents/MacOS/DeepSeek Harness");
64
+ const entry = join(desktop, "Contents/Resources/app.asar/dsh/node_modules/@deepseek-ai/dsh/lib/bin.js");
65
+ try {
66
+ await access(command);
67
+ await access(join(desktop, "Contents/Resources/app.asar"));
68
+ } catch {
69
+ throw new DshError("DSH_EXECUTABLE_NOT_FOUND");
70
+ }
71
+ args = [entry];
72
+ dshBin = fileURLToPath(new URL("./desktop-entry.js", import.meta.url));
73
+ env = {
74
+ ...env,
75
+ ELECTRON_RUN_AS_NODE: "1",
76
+ OCTO_DSH_DESKTOP_BINARY: command,
77
+ OCTO_DSH_DESKTOP_ENTRY: entry
78
+ };
79
+ }
80
+ if (process.platform === "win32" && /\.(cmd|bat)$/i.test(command))
81
+ throw new DshError("DSH_CONFIG_INVALID");
82
+ if (!dshBin) {
83
+ if (args.length === 0)
84
+ dshBin = command;
85
+ else if (args.length === 1 && (process.platform === "win32" ? command.toLowerCase() === process.execPath.toLowerCase() : command === process.execPath))
86
+ dshBin = resolve(args[0]);
87
+ else
88
+ throw new DshError("DSH_CONFIG_INVALID");
89
+ }
90
+ const launch = { command, args, env, dshBin };
91
+ await checkVersion(launch, signal);
92
+ return launch;
93
+ }
94
+ async function executable(command, env) {
95
+ const candidates = isAbsolute(command) || /[/\\]/.test(command) ? [resolve(command)] : (processEnvironmentValue(env, "PATH") ?? "").split(delimiter).flatMap((directory) => {
96
+ const extensions = process.platform === "win32" && !/\.[^\\/]+$/.test(command) ? [
97
+ "",
98
+ ...(processEnvironmentValue(env, "PATHEXT") ?? ".EXE;.CMD;.BAT;.COM").split(";")
99
+ ] : [""];
100
+ return extensions.map((extension) => resolve(directory, command + extension));
101
+ });
102
+ for (const candidate of candidates) {
103
+ try {
104
+ await access(candidate, constants.X_OK);
105
+ if ((await stat(candidate)).isFile())
106
+ return candidate;
107
+ } catch {
108
+ }
109
+ }
110
+ return void 0;
111
+ }
112
+ async function checkVersion(launch, signal) {
113
+ if (signal?.aborted)
114
+ throw new DshError("DSH_START_FAILED", { phase: "version" });
115
+ const child = spawn(launch.command, [...launch.args, "--version"], {
116
+ env: launch.env,
117
+ detached: process.platform !== "win32",
118
+ windowsHide: true,
119
+ stdio: ["ignore", "pipe", "pipe"]
120
+ });
121
+ const cleanup = createProcessCleanup(child, {
122
+ processGroup: process.platform !== "win32",
123
+ processTree: true,
124
+ termGraceMs: DSH_PROCESS_GRACE_MS,
125
+ killGraceMs: DSH_PROCESS_GRACE_MS
126
+ });
127
+ let output = "";
128
+ let bytes = 0;
129
+ let rejectPending = () => {
130
+ };
131
+ const stop = () => rejectPending(new DshError("DSH_START_FAILED", { phase: "version" }));
132
+ let timer;
133
+ child.stderr.resume();
134
+ child.stderr.on("error", () => {
135
+ });
136
+ let failure;
137
+ try {
138
+ await new Promise((resolveVersion, reject) => {
139
+ rejectPending = reject;
140
+ timer = setTimeout(stop, VERSION_PROBE_TIMEOUT_MS);
141
+ const ioFailure = (error) => reject(new DshError("DSH_START_FAILED", {
142
+ phase: "version",
143
+ nativeCode: nativeCode(error.code) ?? null
144
+ }, { cause: error }));
145
+ child.once("error", ioFailure);
146
+ child.stdout.on("error", ioFailure);
147
+ child.stdout.on("data", (chunk) => {
148
+ bytes += chunk.length;
149
+ if (bytes > VERSION_PROBE_MAX_BYTES)
150
+ stop();
151
+ else
152
+ output += chunk.toString("utf8");
153
+ });
154
+ child.once("close", (code, signal2) => code === 0 ? resolveVersion() : reject(new DshError("DSH_START_FAILED", { phase: "version", exitCode: code, signal: signal2 })));
155
+ signal?.addEventListener("abort", stop, { once: true });
156
+ if (signal?.aborted)
157
+ stop();
158
+ });
159
+ if (output.trim() !== DSH_VERSION)
160
+ throw new DshError("DSH_VERSION_UNSUPPORTED");
161
+ } catch (error) {
162
+ failure = error;
163
+ } finally {
164
+ clearTimeout(timer);
165
+ signal?.removeEventListener("abort", stop);
166
+ try {
167
+ await cleanup();
168
+ } catch (error) {
169
+ const primary = failure === void 0 ? void 0 : dshError(failure, "DSH_START_FAILED");
170
+ const cleanup2 = dshError(error, "DSH_CLEANUP_FAILED");
171
+ failure = new DshError("DSH_CLEANUP_FAILED", {
172
+ ...primary?.diagnostics,
173
+ phase: "version",
174
+ pid: child.pid ?? null,
175
+ primaryCode: primary?.code ?? "NONE",
176
+ cleanupCode: cleanup2.diagnostics.nativeCode ?? cleanup2.code
177
+ }, {
178
+ cause: new AggregateError(failure === void 0 ? [error] : [failure, error], "DSH version probe cleanup failed")
179
+ });
180
+ } finally {
181
+ child.stdout.destroy();
182
+ child.stderr.destroy();
183
+ }
184
+ }
185
+ if (failure instanceof Error)
186
+ throw failure;
187
+ if (failure !== void 0)
188
+ throw new DshError("DSH_START_FAILED", { phase: "version" });
189
+ }
190
+ function timeoutOption(options, key, fallback) {
191
+ const raw = options[key];
192
+ const value = raw === void 0 ? fallback : typeof raw === "number" || typeof raw === "string" && /^\d+$/.test(raw) ? Number(raw) : NaN;
193
+ if (!Number.isSafeInteger(value) || value < 1 || value > MAX_TIMEOUT_MS)
194
+ throw new DshError("DSH_CONFIG_INVALID");
195
+ return value;
196
+ }
197
+ function stringOption(options, key, fallback) {
198
+ const value = options[key] ?? fallback;
199
+ if (typeof value !== "string" || !value.trim() || value.includes("\0") || value.length > MAX_OPTION_STRING_LENGTH)
200
+ throw new DshError("DSH_CONFIG_INVALID");
201
+ return value;
202
+ }
203
+
204
+ export {
205
+ DSH_PROCESS_GRACE_MS,
206
+ resolveDshLaunch,
207
+ timeoutOption,
208
+ stringOption
209
+ };
@@ -0,0 +1,340 @@
1
+ import {
2
+ DshError,
3
+ nativeCode,
4
+ record
5
+ } from "./chunk-DYOJCNWF.js";
6
+
7
+ // packages/octo-runtime-adapter-dsh/dist/trajectory.js
8
+ import { createHash } from "node:crypto";
9
+ function required(value) {
10
+ if (!value)
11
+ throw new DshError("DSH_TRAJECTORY_INVALID");
12
+ }
13
+ function integer(value) {
14
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
15
+ }
16
+ function identifier(value) {
17
+ return typeof value === "string" && value.length > 0 && value.length <= 191;
18
+ }
19
+ function hash(value) {
20
+ return createHash("sha256").update(value).digest("hex").slice(0, 24);
21
+ }
22
+ function event(type, payload) {
23
+ return { protocolVersion: 2, type, payload };
24
+ }
25
+ var DshTrajectory = class {
26
+ sessionId;
27
+ maxTextBytes;
28
+ #sessions = /* @__PURE__ */ new Map();
29
+ #steps = /* @__PURE__ */ new Map();
30
+ #turns = /* @__PURE__ */ new Map();
31
+ #tools = /* @__PURE__ */ new Map();
32
+ #messages = /* @__PURE__ */ new Map();
33
+ #receipts = /* @__PURE__ */ new Set();
34
+ #lastReason;
35
+ #lastNativeCode;
36
+ #lastAnswer = false;
37
+ #objects = 0;
38
+ constructor(sessionId, maxTextBytes) {
39
+ this.sessionId = sessionId;
40
+ this.maxTextBytes = maxTextBytes;
41
+ this.#sessions.set(sessionId, { seq: -1, digest: "" });
42
+ }
43
+ #id(sessionId, kind, value) {
44
+ return `dsh:${hash(sessionId)}:${kind}:${String(value)}`;
45
+ }
46
+ #bound() {
47
+ if (++this.#objects > 4096)
48
+ throw new DshError("DSH_TRAJECTORY_INVALID", { phase: "object_limit" });
49
+ }
50
+ #lineage(sessionId) {
51
+ const parentSessionId = this.#sessions.get(sessionId)?.parent;
52
+ return { providerSessionId: sessionId, ...parentSessionId ? { parentSessionId } : {} };
53
+ }
54
+ accept(notification) {
55
+ const { method, params } = notification;
56
+ if (method === "subagent.started") {
57
+ if (!this.#sessions.has(String(params.parentSessionId)))
58
+ return [];
59
+ required(identifier(params.childSessionId) && identifier(params.parentSessionId));
60
+ const child = this.#sessions.get(params.childSessionId);
61
+ if (child) {
62
+ required(child.parent === params.parentSessionId);
63
+ return [];
64
+ }
65
+ required(this.#sessions.size < 128 && params.childSessionId !== this.sessionId);
66
+ this.#sessions.set(params.childSessionId, {
67
+ parent: params.parentSessionId,
68
+ seq: -1,
69
+ digest: ""
70
+ });
71
+ return [
72
+ event("activity.started", {
73
+ activityId: this.#id(params.childSessionId, "agent", 0),
74
+ kind: "working",
75
+ subject: { type: "run" },
76
+ source: "provider",
77
+ info: {
78
+ params: {
79
+ providerSessionId: params.childSessionId,
80
+ parentSessionId: params.parentSessionId
81
+ }
82
+ }
83
+ })
84
+ ];
85
+ }
86
+ if (method === "subagent.finished") {
87
+ const child = typeof params.childSessionId === "string" ? this.#sessions.get(params.childSessionId) : void 0;
88
+ if (!child)
89
+ return [];
90
+ required(child.parent === params.parentSessionId && ["ok", "error"].includes(String(params.status)));
91
+ return [
92
+ event("activity.finished", {
93
+ activityId: this.#id(String(params.childSessionId), "agent", 0),
94
+ status: params.status === "ok" ? "completed" : "failed"
95
+ })
96
+ ];
97
+ }
98
+ if (method !== "session.event")
99
+ return [];
100
+ required(identifier(params.sessionId));
101
+ const sessionId = params.sessionId;
102
+ const state = this.#sessions.get(sessionId);
103
+ if (!state)
104
+ return [];
105
+ const source = params.event;
106
+ required(record(source) && identifier(source.type) && integer(source.seq) && integer(source.time) && record(source.data));
107
+ const digest = hash(JSON.stringify(source));
108
+ if (source.seq < state.seq)
109
+ return [];
110
+ if (source.seq === state.seq) {
111
+ required(digest === state.digest);
112
+ return [];
113
+ }
114
+ state.seq = source.seq;
115
+ state.digest = digest;
116
+ const data = source.data;
117
+ const lineage = this.#lineage(sessionId);
118
+ const output = [];
119
+ const stepId = this.#id(sessionId, "step", `${String(data.turn)}:${String(data.step)}`);
120
+ switch (source.type) {
121
+ case "agent/inbox/spliced":
122
+ if (sessionId === this.sessionId) {
123
+ required(Array.isArray(data.inserted));
124
+ for (const item of data.inserted) {
125
+ required(record(item) && identifier(item.id));
126
+ required(this.#receipts.size < 128);
127
+ this.#receipts.add(item.id);
128
+ }
129
+ }
130
+ break;
131
+ case "turn/start":
132
+ required(integer(data.turn) && !this.#turns.has(sessionId));
133
+ this.#turns.set(sessionId, data.turn);
134
+ if (sessionId === this.sessionId) {
135
+ this.#lastReason = void 0;
136
+ this.#lastAnswer = false;
137
+ }
138
+ output.push(event("activity.started", {
139
+ activityId: this.#id(sessionId, "turn", data.turn),
140
+ kind: "working",
141
+ subject: { type: "run" },
142
+ source: "provider",
143
+ info: { params: lineage },
144
+ startedAtMs: source.time
145
+ }));
146
+ break;
147
+ case "step/start":
148
+ required(integer(data.turn) && integer(data.step) && this.#turns.get(sessionId) === data.turn && !this.#steps.has(sessionId));
149
+ this.#bound();
150
+ this.#steps.set(sessionId, stepId);
151
+ output.push(event("model_step.started", { stepId, startedAtMs: source.time, ...lineage }));
152
+ break;
153
+ case "step/end":
154
+ required(this.#steps.get(sessionId) === stepId);
155
+ this.#steps.delete(sessionId);
156
+ output.push(event("model_step.finished", {
157
+ stepId,
158
+ status: "completed",
159
+ endedAtMs: source.time,
160
+ ...lineage
161
+ }));
162
+ break;
163
+ case "assistant/chunk": {
164
+ required(this.#steps.get(sessionId) === stepId && record(data.chunk));
165
+ const chunk = data.chunk;
166
+ if (chunk.type !== "text-delta")
167
+ break;
168
+ required(typeof chunk.text === "string");
169
+ const message = this.#messages.get(sessionId) ?? {
170
+ id: this.#id(sessionId, "message", source.seq),
171
+ text: ""
172
+ };
173
+ if (!this.#messages.has(sessionId))
174
+ output.push(this.#messageEvent("message.create", message.id, sessionId, stepId, {
175
+ role: "assistant",
176
+ status: "streaming"
177
+ }));
178
+ message.text += chunk.text;
179
+ required(Buffer.byteLength(message.text) <= this.maxTextBytes);
180
+ this.#messages.set(sessionId, message);
181
+ output.push(this.#messageEvent("message.delta", message.id, sessionId, stepId, { text: chunk.text }));
182
+ break;
183
+ }
184
+ case "assistant/message": {
185
+ required(this.#steps.get(sessionId) === stepId && record(data.message) && Array.isArray(data.message.content));
186
+ const blocks = data.message.content;
187
+ required(blocks.every((block) => record(block) && typeof block.type === "string"));
188
+ const text = blocks.filter((block) => block.type === "text").map((block) => {
189
+ required(typeof block.text === "string");
190
+ return block.text;
191
+ }).join("");
192
+ required(Buffer.byteLength(text) <= this.maxTextBytes);
193
+ const reasoning = blocks.filter((block) => block.type === "reasoning").map((block) => {
194
+ required(typeof block.text === "string");
195
+ return block.text;
196
+ }).join("");
197
+ if (reasoning) {
198
+ required(Buffer.byteLength(reasoning) <= this.maxTextBytes);
199
+ const analysis = {
200
+ id: this.#id(sessionId, "analysis", source.seq),
201
+ role: "assistant",
202
+ channel: "analysis",
203
+ exposure: "private_reasoning",
204
+ provenance: { provider: "dsh", nativeEvent: "assistant/message" },
205
+ stepId,
206
+ ...lineage
207
+ };
208
+ output.push(event("message.create", { ...analysis, status: "streaming" }), event("message.delta", { ...analysis, text: reasoning }), event("message.update", { ...analysis, status: "completed" }));
209
+ }
210
+ const existing = this.#messages.get(sessionId);
211
+ const messageId = existing?.id ?? this.#id(sessionId, "message", source.seq);
212
+ if (!existing)
213
+ output.push(this.#messageEvent("message.create", messageId, sessionId, stepId, {
214
+ role: "assistant",
215
+ status: "streaming"
216
+ }));
217
+ let sent = existing?.text ?? "";
218
+ if (!existing && data.stream !== void 0) {
219
+ required(Array.isArray(data.stream));
220
+ for (const part of data.stream) {
221
+ required(record(part) && typeof part.type === "string");
222
+ if (part.type !== "text-chunks")
223
+ continue;
224
+ required(Array.isArray(part.texts) && part.texts.every((item) => typeof item === "string"));
225
+ for (const delta of part.texts) {
226
+ sent += delta;
227
+ required(Buffer.byteLength(sent) <= this.maxTextBytes);
228
+ if (delta)
229
+ output.push(this.#messageEvent("message.delta", messageId, sessionId, stepId, { text: delta }));
230
+ }
231
+ }
232
+ }
233
+ required(text.startsWith(sent));
234
+ if (text.length > sent.length)
235
+ output.push(this.#messageEvent("message.delta", messageId, sessionId, stepId, {
236
+ text: text.slice(sent.length)
237
+ }));
238
+ output.push(this.#messageEvent("message.update", messageId, sessionId, stepId, {
239
+ role: "assistant",
240
+ status: data.interrupted === true ? "stopped" : "completed"
241
+ }));
242
+ this.#messages.delete(sessionId);
243
+ this.#bound();
244
+ if (sessionId === this.sessionId)
245
+ this.#lastAnswer = text.trim().length > 0 && data.interrupted !== true;
246
+ if (record(data.usage)) {
247
+ const usage = Object.fromEntries(Object.entries(data.usage).filter(([, value]) => integer(value)));
248
+ if (Object.keys(usage).length)
249
+ output.push(event("usage.update", { ...usage, stepId, ...lineage }));
250
+ }
251
+ break;
252
+ }
253
+ case "tool/call": {
254
+ let args = data.arguments;
255
+ if (typeof args === "string") {
256
+ try {
257
+ args = JSON.parse(args);
258
+ } catch {
259
+ throw new DshError("DSH_TRAJECTORY_INVALID");
260
+ }
261
+ }
262
+ required(this.#steps.get(sessionId) === stepId && identifier(data.callId) && identifier(data.name) && record(args));
263
+ const key = `${sessionId}\0${data.callId}`;
264
+ required(!this.#tools.has(key));
265
+ this.#bound();
266
+ const id = this.#id(sessionId, "tool", hash(data.callId));
267
+ this.#tools.set(key, { id, sessionId, time: source.time });
268
+ output.push(event("tool_call.create", {
269
+ id,
270
+ name: data.name,
271
+ args,
272
+ status: "running",
273
+ stepId,
274
+ ...lineage
275
+ }));
276
+ break;
277
+ }
278
+ case "tool/result": {
279
+ required(record(data.message) && identifier(data.message.toolCallId));
280
+ const key = `${sessionId}\0${data.message.toolCallId}`;
281
+ const tool = this.#tools.get(key);
282
+ required(tool && this.#steps.get(sessionId) === stepId && Array.isArray(data.message.content));
283
+ required(data.message.isError === void 0 || typeof data.message.isError === "boolean");
284
+ this.#tools.delete(key);
285
+ output.push(event("tool_call.update", {
286
+ id: tool.id,
287
+ status: data.message.isError ? "failed" : "completed",
288
+ output: data.message.content,
289
+ stepId,
290
+ ...lineage,
291
+ ...source.time >= tool.time ? { durationMs: source.time - tool.time } : {}
292
+ }));
293
+ break;
294
+ }
295
+ case "turn/end": {
296
+ required(integer(data.turn) && this.#turns.get(sessionId) === data.turn && record(data.reason) && ["completed", "error", "aborted", "max-tokens"].includes(String(data.reason.kind)));
297
+ this.#turns.delete(sessionId);
298
+ if (sessionId === this.sessionId) {
299
+ this.#lastReason = String(data.reason.kind);
300
+ const code = record(data.reason.error) ? nativeCode(data.reason.error.code) : void 0;
301
+ this.#lastNativeCode = code;
302
+ }
303
+ output.push(event("activity.finished", {
304
+ activityId: this.#id(sessionId, "turn", data.turn),
305
+ status: data.reason.kind === "completed" ? "completed" : data.reason.kind === "aborted" ? "cancelled" : "failed",
306
+ endedAtMs: source.time
307
+ }));
308
+ break;
309
+ }
310
+ }
311
+ return output;
312
+ }
313
+ #messageEvent(type, id, sessionId, stepId, data) {
314
+ return event(type, {
315
+ id,
316
+ channel: sessionId === this.sessionId ? "final" : "commentary",
317
+ stepId,
318
+ ...this.#lineage(sessionId),
319
+ ...data
320
+ });
321
+ }
322
+ /** wait 只证明 idle;receipt、durable terminal 和已提交回答分别验证。 */
323
+ finish(receiptId) {
324
+ if (!this.#receipts.has(receiptId) || !this.#lastReason || this.#turns.size || this.#steps.size || this.#tools.size || this.#messages.size)
325
+ throw new DshError("DSH_TRAJECTORY_INVALID");
326
+ if (this.#lastReason === "aborted")
327
+ return event("run.cancelled", { reason: "provider_aborted" });
328
+ if (this.#lastReason !== "completed")
329
+ throw new DshError("DSH_EXECUTION_FAILED", {
330
+ ...this.#lastNativeCode === void 0 ? {} : { nativeCode: this.#lastNativeCode }
331
+ });
332
+ if (!this.#lastAnswer)
333
+ throw new DshError("DSH_NO_FINAL_OUTPUT");
334
+ return event("run.completed", {});
335
+ }
336
+ };
337
+
338
+ export {
339
+ DshTrajectory
340
+ };
@@ -0,0 +1,16 @@
1
+ import { isAbsolute } from "node:path";
2
+ // 官方 Client 用 Node 启动 dshBin;execve 保留其拥有的 PID 和 stdio,交给 Electron 解析 asar。
3
+ // 不创建代理进程,也不读取、编码或转发 JSON-RPC。此入口只用于 macOS Desktop。
4
+ const binary = process.env.OCTO_DSH_DESKTOP_BINARY;
5
+ const entry = process.env.OCTO_DSH_DESKTOP_ENTRY;
6
+ if (process.platform !== "darwin" || !binary || !entry || !isAbsolute(binary) || !isAbsolute(entry))
7
+ throw new Error("DSH_CONFIG_INVALID: invalid Desktop launch paths");
8
+ if (!process.execve)
9
+ throw new Error("DSH_START_FAILED: Desktop requires Node execve support");
10
+ const env = { ...process.env };
11
+ delete env.OCTO_DSH_DESKTOP_BINARY;
12
+ delete env.OCTO_DSH_DESKTOP_ENTRY;
13
+ process.execve(binary, [binary, entry, ...process.argv.slice(2)], {
14
+ ...env,
15
+ ELECTRON_RUN_AS_NODE: "1"
16
+ });
@@ -0,0 +1,6 @@
1
+ @deepseek-ai/dsh-sdk-client@0.2.1-rc.3
2
+ @deepseek-ai/dsh-sdk-protocol@0.2.1-rc.3
3
+ License: MIT
4
+ Upstream: https://github.com/deepseek-ai/deepseek-harness
5
+ Unmodified official npm JavaScript is bundled by esbuild.
6
+ DSH integration is experimental; SDK process-tree cleanup and pre-parse resource limits are not guaranteed.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ export declare const DSH_VERSION = "0.2.1-rc.3";
2
+ declare const messages: {
3
+ readonly DSH_CONFIG_INVALID: "DeepSeek Harness configuration is invalid for this invocation.";
4
+ readonly DSH_ACTMODE_UNSUPPORTED: "DeepSeek Harness supports only the default actmode.";
5
+ readonly PROVIDER_MESSAGE_TOO_LARGE: "DeepSeek Harness protocol line exceeded the configured limit.";
6
+ readonly STREAM_QUEUE_ITEM_TOO_LARGE: "DeepSeek Harness event exceeded the configured queue item limit.";
7
+ readonly STREAM_QUEUE_BYTES_EXCEEDED: "DeepSeek Harness event queue exceeded the configured byte limit.";
8
+ readonly STREAM_QUEUE_ITEMS_EXCEEDED: "DeepSeek Harness event queue exceeded the configured item limit.";
9
+ readonly DSH_EXECUTABLE_NOT_FOUND: "Install a compatible DeepSeek Harness or select its executable.";
10
+ readonly DSH_VERSION_UNSUPPORTED: "DeepSeek Harness version is incompatible with this adapter.";
11
+ readonly DSH_START_FAILED: "DeepSeek Harness could not start.";
12
+ readonly DSH_INITIALIZE_TIMEOUT: "DeepSeek Harness initialization timed out.";
13
+ readonly DSH_RPC_ERROR: "DeepSeek Harness rejected a protocol request.";
14
+ readonly DSH_REQUEST_TIMEOUT: "DeepSeek Harness request timed out; execution may have occurred.";
15
+ readonly DSH_TRANSPORT_CLOSED: "DeepSeek Harness transport closed before execution was confirmed.";
16
+ readonly DSH_PROTOCOL_ERROR: "DeepSeek Harness returned an invalid protocol envelope.";
17
+ readonly DSH_TRAJECTORY_INVALID: "DeepSeek Harness execution evidence was incomplete or inconsistent.";
18
+ readonly DSH_SESSION_RESUME_FAILED: "DeepSeek Harness could not restore the requested session.";
19
+ readonly DSH_SESSION_BUSY: "The requested DeepSeek Harness session is already executing.";
20
+ readonly DSH_EXECUTION_FAILED: "DeepSeek Harness reported an execution failure.";
21
+ readonly DSH_NO_FINAL_OUTPUT: "DeepSeek Harness returned no committed assistant answer.";
22
+ readonly DSH_CANCEL_FAILED: "DeepSeek Harness cancellation cleanup could not be confirmed.";
23
+ readonly DSH_CLEANUP_FAILED: "DeepSeek Harness process cleanup could not be confirmed.";
24
+ };
25
+ export type DshErrorCode = keyof typeof messages;
26
+ /** 安全文本与原生原因分开;远端 message/data/stderr 不进入公共错误或日志。 */
27
+ export declare class DshError extends Error {
28
+ readonly code: DshErrorCode;
29
+ readonly diagnostics: Record<string, string | number | null>;
30
+ constructor(code: DshErrorCode, diagnostics?: Record<string, string | number | null>, options?: ErrorOptions);
31
+ }
32
+ export declare function record(value: unknown): value is Record<string, unknown>;
33
+ export declare function nativeCode(value: unknown): string | number | undefined;
34
+ export declare function dshError(error: unknown, fallback: DshErrorCode): DshError;
35
+ export {};
@@ -0,0 +1,14 @@
1
+ import {
2
+ DSH_VERSION,
3
+ DshError,
4
+ dshError,
5
+ nativeCode,
6
+ record
7
+ } from "./chunk-DYOJCNWF.js";
8
+ export {
9
+ DSH_VERSION,
10
+ DshError,
11
+ dshError,
12
+ nativeCode,
13
+ record
14
+ };