@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,52 @@
1
+ import { type RuntimeLog, type CanonicalEvent, type InvokeRequest, type AdapterInvocationContext } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ export { DshError, DSH_VERSION } from "./errors.js";
3
+ export interface DshAdapterOptions {
4
+ /** 同一 RuntimeLog sink;只记录身份、阶段、时间和安全枚举,不记录原始轨迹。 */
5
+ log?: RuntimeLog;
6
+ }
7
+ /**
8
+ * SDK/CLI 共用的实验性 Adapter。每 invoke 使用独立官方 Client,等待其 close 后发唯一终态。
9
+ * SDK 只确认直接子进程退出;不承诺完整后代回收或解析前内存上界。
10
+ * providerSession 来自调用方,跨调用显式 resume;不缓存业务上下文或安装/修改 Provider。
11
+ */
12
+ export declare function createDshAdapter(options?: DshAdapterOptions): Readonly<{
13
+ metadata: {
14
+ type: string;
15
+ agentSources: "provisioned"[];
16
+ };
17
+ probe(probeOptions?: {
18
+ providerOptions?: Record<string, string>;
19
+ }): Promise<{
20
+ available: true;
21
+ command: string;
22
+ version: string;
23
+ reason?: undefined;
24
+ } | {
25
+ available: false;
26
+ command: string;
27
+ reason: "DSH_CONFIG_INVALID" | "DSH_ACTMODE_UNSUPPORTED" | "PROVIDER_MESSAGE_TOO_LARGE" | "STREAM_QUEUE_ITEM_TOO_LARGE" | "STREAM_QUEUE_BYTES_EXCEEDED" | "STREAM_QUEUE_ITEMS_EXCEEDED" | "DSH_EXECUTABLE_NOT_FOUND" | "DSH_VERSION_UNSUPPORTED" | "DSH_START_FAILED" | "DSH_INITIALIZE_TIMEOUT" | "DSH_RPC_ERROR" | "DSH_REQUEST_TIMEOUT" | "DSH_TRANSPORT_CLOSED" | "DSH_PROTOCOL_ERROR" | "DSH_TRAJECTORY_INVALID" | "DSH_SESSION_RESUME_FAILED" | "DSH_SESSION_BUSY" | "DSH_EXECUTION_FAILED" | "DSH_NO_FINAL_OUTPUT" | "DSH_CANCEL_FAILED" | "DSH_CLEANUP_FAILED";
28
+ version?: undefined;
29
+ }>;
30
+ invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
31
+ }>;
32
+ export declare const dshAdapter: Readonly<{
33
+ metadata: {
34
+ type: string;
35
+ agentSources: "provisioned"[];
36
+ };
37
+ probe(probeOptions?: {
38
+ providerOptions?: Record<string, string>;
39
+ }): Promise<{
40
+ available: true;
41
+ command: string;
42
+ version: string;
43
+ reason?: undefined;
44
+ } | {
45
+ available: false;
46
+ command: string;
47
+ reason: "DSH_CONFIG_INVALID" | "DSH_ACTMODE_UNSUPPORTED" | "PROVIDER_MESSAGE_TOO_LARGE" | "STREAM_QUEUE_ITEM_TOO_LARGE" | "STREAM_QUEUE_BYTES_EXCEEDED" | "STREAM_QUEUE_ITEMS_EXCEEDED" | "DSH_EXECUTABLE_NOT_FOUND" | "DSH_VERSION_UNSUPPORTED" | "DSH_START_FAILED" | "DSH_INITIALIZE_TIMEOUT" | "DSH_RPC_ERROR" | "DSH_REQUEST_TIMEOUT" | "DSH_TRANSPORT_CLOSED" | "DSH_PROTOCOL_ERROR" | "DSH_TRAJECTORY_INVALID" | "DSH_SESSION_RESUME_FAILED" | "DSH_SESSION_BUSY" | "DSH_EXECUTION_FAILED" | "DSH_NO_FINAL_OUTPUT" | "DSH_CANCEL_FAILED" | "DSH_CLEANUP_FAILED";
48
+ version?: undefined;
49
+ }>;
50
+ invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
51
+ }>;
52
+ export default dshAdapter;
@@ -0,0 +1,306 @@
1
+ import {
2
+ resolveDshLaunch,
3
+ stringOption,
4
+ timeoutOption
5
+ } from "./chunk-G5PWGRL5.js";
6
+ import {
7
+ DshTrajectory
8
+ } from "./chunk-UOQRXV3Q.js";
9
+ import {
10
+ DSH_VERSION,
11
+ DshError,
12
+ HarnessClient,
13
+ dshError,
14
+ record
15
+ } from "./chunk-DYOJCNWF.js";
16
+
17
+ // packages/octo-runtime-adapter-dsh/dist/index.js
18
+ import { randomUUID } from "node:crypto";
19
+ import { realpath } from "node:fs/promises";
20
+ import { defineAdapter, invocationEnvironment, providerInputParts, initialControlInstructions, DriverQueue, noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
21
+ import { contextActmode, DEFAULT_STREAM_LIMIT_POLICY } from "@mininglamp-oss/octo-runtime-protocol";
22
+ function failureEvent(error, diagnostics) {
23
+ return {
24
+ protocolVersion: 2,
25
+ type: "run.failed",
26
+ payload: {
27
+ code: error.code,
28
+ message: error.message,
29
+ retryable: false,
30
+ adapterType: "dsh",
31
+ diagnostics: { ...diagnostics, ...error.diagnostics }
32
+ }
33
+ };
34
+ }
35
+ function createDshAdapter(options = {}) {
36
+ const sessions = /* @__PURE__ */ new Set();
37
+ const log = options.log ?? noopRuntimeLog;
38
+ return defineAdapter({
39
+ metadata: { type: "dsh", agentSources: ["provisioned"] },
40
+ async probe(probeOptions) {
41
+ try {
42
+ const launch = await resolveDshLaunch(probeOptions?.providerOptions ?? {}, {
43
+ ...process.env
44
+ });
45
+ return { available: true, command: launch.command, version: DSH_VERSION };
46
+ } catch (error) {
47
+ return {
48
+ available: false,
49
+ command: "dsh",
50
+ reason: dshError(error, "DSH_START_FAILED").code
51
+ };
52
+ }
53
+ },
54
+ async *invoke(request, context) {
55
+ const invocationLog = context?.log ?? log;
56
+ if (request.approvalMode !== "full_access")
57
+ throw new Error("APPROVAL_MODE_UNSUPPORTED: DSH SDK 0.2.1-rc.3 has no interactive approval transport; explicitly select full_access");
58
+ let config;
59
+ let sessionId;
60
+ let requestedId;
61
+ try {
62
+ const actmode = contextActmode(request.context);
63
+ if (actmode !== void 0 && actmode !== "default")
64
+ throw new DshError("DSH_ACTMODE_UNSUPPORTED");
65
+ if (request.agentConfig.sandbox !== void 0 && request.agentConfig.sandbox !== "danger-full-access")
66
+ throw new DshError("DSH_CONFIG_INVALID");
67
+ const configured = request.agentConfig.providerOptions ?? {};
68
+ if (!record(configured))
69
+ throw new DshError("DSH_CONFIG_INVALID");
70
+ config = configured;
71
+ requestedId = request.providerSession?.sessionId;
72
+ if (requestedId !== void 0 && (typeof requestedId !== "string" || !requestedId || requestedId.length > 191))
73
+ throw new DshError("DSH_SESSION_RESUME_FAILED");
74
+ sessionId = requestedId ?? `octo-${randomUUID()}`;
75
+ if (sessions.has(sessionId))
76
+ throw new DshError("DSH_SESSION_BUSY");
77
+ } catch (error) {
78
+ yield failureEvent(dshError(error, "DSH_CONFIG_INVALID"), { phase: "preflight" });
79
+ return;
80
+ }
81
+ sessions.add(sessionId);
82
+ const started = Date.now();
83
+ let phase = "launch";
84
+ let failurePhase;
85
+ let client;
86
+ let subscription;
87
+ let notifications;
88
+ let primary;
89
+ let cleanup;
90
+ let terminal;
91
+ let closing;
92
+ let cancelOverridesFailure = true;
93
+ const limits = context?.streamLimits ?? DEFAULT_STREAM_LIMIT_POLICY;
94
+ const trajectory = new DshTrajectory(sessionId, limits.rawMessageMaxBytes);
95
+ let receiptId;
96
+ const queue = new DriverQueue({
97
+ limits,
98
+ boundary: "adapter.dsh_queue",
99
+ discardOnFailure: true,
100
+ onFailure: (error) => {
101
+ primary ??= dshError(error, "DSH_EXECUTION_FAILED");
102
+ failurePhase ??= phase;
103
+ void close().catch(() => {
104
+ });
105
+ }
106
+ });
107
+ const close = () => closing ??= Promise.resolve().then(() => client?.close());
108
+ const abort = () => {
109
+ cancelOverridesFailure = primary === void 0;
110
+ queue.close(new DshError("DSH_TRANSPORT_CLOSED", { phase: "cancel" }));
111
+ void close().catch(() => {
112
+ });
113
+ };
114
+ const diagnostic = (code, data = {}) => {
115
+ try {
116
+ invocationLog(code === "completed" ? "info" : "error", "dsh.execution", {
117
+ run_id: request.runId,
118
+ invocation_id: request.invocationId,
119
+ session_id: sessionId,
120
+ adapter_type: "dsh",
121
+ code,
122
+ state: cleanup ? "cleanup" : failurePhase ?? phase,
123
+ duration_ms: Date.now() - started,
124
+ request_id: data.requestId,
125
+ native_code: data.nativeCode,
126
+ pid: data.pid,
127
+ exit_code: data.exitCode,
128
+ signal: data.signal,
129
+ primary_code: data.primaryCode,
130
+ cleanup_code: data.cleanupCode
131
+ });
132
+ } catch {
133
+ }
134
+ };
135
+ let producer;
136
+ try {
137
+ if (request.signal?.aborted) {
138
+ terminal = {
139
+ protocolVersion: 2,
140
+ type: "run.cancelled",
141
+ payload: { reason: "cancelled" }
142
+ };
143
+ } else {
144
+ const initializeTimeoutMs = timeoutOption(config, "initializeTimeoutMs", 15e3);
145
+ const requestTimeoutMs = timeoutOption(config, "requestTimeoutMs", 3e4);
146
+ const runTimeoutMs = request.runtimeLimits?.runTimeoutMs ?? 12e4;
147
+ const shutdownTimeoutMs = timeoutOption(config, "shutdownTimeoutMs", 1e3);
148
+ const env = invocationEnvironment(request, {
149
+ DSH_PERMISSION_MODE: "danger-full-access"
150
+ });
151
+ if (config.dshHome !== void 0)
152
+ env.DSH_HOME = stringOption(config, "dshHome", "");
153
+ const launch = await resolveDshLaunch(config, env, request.signal);
154
+ if (request.signal?.aborted)
155
+ throw new DshError("DSH_TRANSPORT_CLOSED", { phase: "cancel" });
156
+ client = new HarnessClient({
157
+ dshBin: launch.dshBin,
158
+ profile: stringOption(config, "profile", "sdk"),
159
+ processCwd: request.workdir,
160
+ env: launch.env,
161
+ initializeTimeoutMs,
162
+ requestTimeoutMs,
163
+ shutdownTimeoutMs
164
+ });
165
+ subscription = client.subscribe((notification) => {
166
+ if (phase !== "prompt" && phase !== "wait")
167
+ return false;
168
+ try {
169
+ for (const value of trajectory.accept(notification))
170
+ queue.push(value);
171
+ } catch (error) {
172
+ primary ??= dshError(error, "DSH_TRAJECTORY_INVALID");
173
+ failurePhase ??= phase;
174
+ queue.close(primary);
175
+ void close().catch(() => {
176
+ });
177
+ }
178
+ return false;
179
+ });
180
+ notifications = subscription.next().then(() => {
181
+ }, (error) => {
182
+ if (closing)
183
+ return;
184
+ primary ??= dshError(error, "DSH_TRANSPORT_CLOSED");
185
+ failurePhase ??= phase;
186
+ queue.close(primary);
187
+ });
188
+ request.signal?.addEventListener("abort", abort, { once: true });
189
+ if (request.signal?.aborted)
190
+ abort();
191
+ const owned = client;
192
+ producer = (async () => {
193
+ try {
194
+ phase = "initialize";
195
+ const initialization = await owned.initialize({
196
+ cwd: request.workdir,
197
+ provider: stringOption(config, "provider", "deepseek-account"),
198
+ model: request.agentConfig.model ?? "deepseek-flash",
199
+ ...config.maxTokens === void 0 ? {} : { maxTokens: timeoutOption(config, "maxTokens", 4096) }
200
+ });
201
+ if (!record(initialization) || !record(initialization.serverInfo) || initialization.serverInfo.name !== "deepseek-harness-sdk-runtime" || initialization.serverInfo.version !== "0.0.1")
202
+ throw new DshError("DSH_VERSION_UNSUPPORTED");
203
+ if (requestedId) {
204
+ phase = "resume";
205
+ try {
206
+ await owned.resumeSession(sessionId);
207
+ const directory = await owned.setWorkingDirectory(sessionId, request.workdir);
208
+ if (await realpath(directory) !== await realpath(request.workdir))
209
+ throw new DshError("DSH_SESSION_RESUME_FAILED");
210
+ } catch (error) {
211
+ throw new DshError("DSH_SESSION_RESUME_FAILED", dshError(error, "DSH_RPC_ERROR").diagnostics, { cause: error });
212
+ }
213
+ }
214
+ queue.push({
215
+ protocolVersion: 2,
216
+ type: "session.update",
217
+ payload: {
218
+ providerSession: {
219
+ sessionId,
220
+ resumable: true,
221
+ resumeOutcome: requestedId ? "resumed" : "new"
222
+ }
223
+ }
224
+ });
225
+ const contentBlocks = providerInputParts(request).map((part) => part.type === "image" ? { type: "image", mimeType: part.mimeType, data: part.data } : { type: "text", text: part.text });
226
+ const instructions = initialControlInstructions(request);
227
+ if (instructions)
228
+ contentBlocks.unshift({ type: "text", text: instructions });
229
+ phase = "prompt";
230
+ const receipt = await owned.prompt(sessionId, contentBlocks);
231
+ if (!receipt || receipt.length > 191)
232
+ throw new DshError("DSH_PROTOCOL_ERROR");
233
+ receiptId = receipt;
234
+ phase = "wait";
235
+ await owned.request("session/wait", { sessionId }, runTimeoutMs);
236
+ terminal = trajectory.finish(receiptId);
237
+ queue.close();
238
+ } catch (error) {
239
+ const failure = dshError(error, "DSH_EXECUTION_FAILED");
240
+ primary ??= phase === "initialize" && failure.code === "DSH_REQUEST_TIMEOUT" ? new DshError("DSH_INITIALIZE_TIMEOUT", {}, { cause: error }) : failure;
241
+ failurePhase ??= phase;
242
+ queue.close(primary);
243
+ }
244
+ })();
245
+ yield* queue;
246
+ await producer;
247
+ }
248
+ } catch (error) {
249
+ primary ??= dshError(error, "DSH_EXECUTION_FAILED");
250
+ failurePhase ??= phase;
251
+ } finally {
252
+ phase = "cleanup";
253
+ try {
254
+ await close();
255
+ } catch (error) {
256
+ cleanup = dshError(error, "DSH_CLEANUP_FAILED");
257
+ }
258
+ subscription?.close();
259
+ await notifications;
260
+ await producer;
261
+ request.signal?.removeEventListener("abort", abort);
262
+ queue.close();
263
+ queue.drain();
264
+ sessions.delete(sessionId);
265
+ }
266
+ if (cleanup) {
267
+ const code = request.signal?.aborted ? "DSH_CANCEL_FAILED" : "DSH_CLEANUP_FAILED";
268
+ primary = new DshError(code, {
269
+ primaryCode: primary?.code ?? "NONE",
270
+ cleanupCode: cleanup.code,
271
+ ...cleanup.diagnostics
272
+ });
273
+ } else if (request.signal?.aborted && cancelOverridesFailure) {
274
+ terminal = {
275
+ protocolVersion: 2,
276
+ type: "run.cancelled",
277
+ payload: { reason: "cancelled" }
278
+ };
279
+ primary = void 0;
280
+ }
281
+ if (primary) {
282
+ diagnostic(primary.code, primary.diagnostics);
283
+ yield failureEvent(primary, {
284
+ phase: cleanup ? "cleanup" : failurePhase ?? phase,
285
+ durationMs: Date.now() - started
286
+ });
287
+ } else if (terminal) {
288
+ diagnostic(terminal.type === "run.completed" ? "completed" : "cancelled");
289
+ yield terminal;
290
+ } else {
291
+ const failure = new DshError("DSH_TRAJECTORY_INVALID");
292
+ diagnostic(failure.code);
293
+ yield failureEvent(failure, { phase, durationMs: Date.now() - started });
294
+ }
295
+ }
296
+ }, null);
297
+ }
298
+ var dshAdapter = createDshAdapter();
299
+ var index_default = dshAdapter;
300
+ export {
301
+ DSH_VERSION,
302
+ DshError,
303
+ createDshAdapter,
304
+ index_default as default,
305
+ dshAdapter
306
+ };
@@ -0,0 +1,11 @@
1
+ export declare const DSH_PROCESS_GRACE_MS = 1000;
2
+ export interface DshLaunch {
3
+ command: string;
4
+ args: string[];
5
+ env: NodeJS.ProcessEnv;
6
+ dshBin: string;
7
+ }
8
+ /** 宿主选择已安装 Provider;Desktop 只作为发行载体,不控制 GUI 或改写用户 profile。 */
9
+ export declare function resolveDshLaunch(options: Record<string, unknown>, env: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<DshLaunch>;
10
+ export declare function timeoutOption(options: Record<string, unknown>, key: string, fallback: number): number;
11
+ export declare function stringOption(options: Record<string, unknown>, key: string, fallback: string): string;
@@ -0,0 +1,13 @@
1
+ import {
2
+ DSH_PROCESS_GRACE_MS,
3
+ resolveDshLaunch,
4
+ stringOption,
5
+ timeoutOption
6
+ } from "./chunk-G5PWGRL5.js";
7
+ import "./chunk-DYOJCNWF.js";
8
+ export {
9
+ DSH_PROCESS_GRACE_MS,
10
+ resolveDshLaunch,
11
+ stringOption,
12
+ timeoutOption
13
+ };
@@ -0,0 +1,12 @@
1
+ import type { CanonicalEvent } from "@mininglamp-oss/octo-runtime-protocol";
2
+ import type { HarnessNotification } from "@deepseek-ai/dsh-sdk-client";
3
+ /** 只保留当前工作和序号摘要;不存轨迹历史,不把 child 文本合并进 root final。 */
4
+ export declare class DshTrajectory {
5
+ #private;
6
+ readonly sessionId: string;
7
+ private readonly maxTextBytes;
8
+ constructor(sessionId: string, maxTextBytes: number);
9
+ accept(notification: HarnessNotification): CanonicalEvent[];
10
+ /** wait 只证明 idle;receipt、durable terminal 和已提交回答分别验证。 */
11
+ finish(receiptId: string): CanonicalEvent;
12
+ }
@@ -0,0 +1,7 @@
1
+ import {
2
+ DshTrajectory
3
+ } from "./chunk-UOQRXV3Q.js";
4
+ import "./chunk-DYOJCNWF.js";
5
+ export {
6
+ DshTrajectory
7
+ };
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@mininglamp-oss/octo-runtime-adapter-dsh",
3
+ "version": "1.1.4",
4
+ "private": true,
5
+ "type": "module",
6
+ "exports": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "dependencies": {
12
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.4",
13
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.4"
14
+ }
15
+ }
@@ -1,5 +1,6 @@
1
1
  import { AcpClient } from "@mininglamp-oss/octo-runtime-acp-client";
2
2
  import { INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
3
+ import { mergeProcessEnvironment } from "@mininglamp-oss/octo-runtime-adapter-sdk";
3
4
  import { spawn } from "node:child_process";
4
5
  import { createInterface } from "node:readline";
5
6
  export class GrokBuildRpcError extends Error {
@@ -135,7 +136,7 @@ class GrokBuildAcpClient extends AcpClient {
135
136
  export function spawnGrokBuildAcpClient(options) {
136
137
  const child = spawn(options.command, options.args ?? [], {
137
138
  cwd: options.cwd,
138
- env: { ...process.env, ...options.env },
139
+ env: mergeProcessEnvironment(process.env, options.env ?? {}),
139
140
  stdio: ["pipe", "pipe", "pipe"],
140
141
  detached: process.platform !== "win32"
141
142
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-grok-build",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,9 +9,9 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-acp-client": "1.1.2",
13
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.2",
14
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
15
- "@mininglamp-oss/octo-runtime-protocol": "1.1.2"
12
+ "@mininglamp-oss/octo-runtime-acp-client": "1.1.4",
13
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.4",
14
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.4",
15
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.4"
16
16
  }
17
17
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-hermes",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.2"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.4"
13
13
  }
14
14
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-kimi-code",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.2"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.4"
13
13
  }
14
14
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-mcode",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.2"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.4"
13
13
  }
14
14
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-openclaw",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.1.2",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.4",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.4",
10
10
  "ws": "8.22.0"
11
11
  },
12
12
  "types": "./dist/index.d.ts",
@@ -1,4 +1,7 @@
1
- import { type AdapterInvocationContext, type CanonicalEvent, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
+ import { type AdapterInvocationContext, type CanonicalEvent, type InvokeRequest, type ProbeResult } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ export declare const MINIMUM_OPENCODE_VERSION = "2.1.3";
3
+ /** 检查本轮实际选中的程序;未知版本与 V1 都不能进入执行传输。 */
4
+ export declare function probeOpenCode(command?: string, env?: NodeJS.ProcessEnv, cwd?: string): Promise<ProbeResult>;
2
5
  /** A single OpenCode stream part; tool lifecycle is carried in `state.status` (running -> completed/error). */
3
6
  interface OpenCodePart {
4
7
  sessionID?: string;
@@ -52,9 +55,11 @@ interface OpenCodeNativeEvent extends OpenCodePart {
52
55
  export declare function buildOpenCodeCommand(req: InvokeRequest, command?: string): Promise<{
53
56
  command: string;
54
57
  args: string[];
58
+ input: string;
55
59
  env: {
56
60
  OPENCODE_CONFIG_CONTENT: string;
57
61
  OPENCODE_CLIENT: string;
62
+ PWD: string;
58
63
  };
59
64
  rpcMethod: string;
60
65
  providerSessionId: string | undefined;
@@ -74,15 +79,15 @@ export declare class OpenCodeEventNormalizer {
74
79
  export declare function createOpenCodeAdapter({ command }?: {
75
80
  command?: string;
76
81
  }): {
77
- respondInteraction: (invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse) => Promise<void>;
82
+ respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
78
83
  invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
79
84
  metadata: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterMetadata;
80
- probe?: (options?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterProbeOptions) => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
85
+ probe?: (options?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterProbeOptions) => Promise<ProbeResult>;
81
86
  };
82
87
  export declare const opencodeAdapter: {
83
- respondInteraction: (invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse) => Promise<void>;
88
+ respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
84
89
  invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
85
90
  metadata: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterMetadata;
86
- probe?: (options?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterProbeOptions) => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
91
+ probe?: (options?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterProbeOptions) => Promise<ProbeResult>;
87
92
  };
88
93
  export default opencodeAdapter;