@mininglamp-oss/octo-runtime 1.1.12 → 1.1.14

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 (195) hide show
  1. package/README.md +1 -1
  2. package/apps/cli/dist/adapters.d.ts +19 -1
  3. package/apps/cli/dist/adapters.js +154 -28
  4. package/apps/cli/dist/build-info.json +2 -2
  5. package/apps/cli/dist/codex.d.ts +5 -0
  6. package/apps/cli/dist/codex.js +36 -0
  7. package/apps/cli/dist/kernel.d.ts +4 -0
  8. package/apps/cli/dist/kernel.js +84 -0
  9. package/apps/cli/dist/main.js +8 -7
  10. package/apps/cli/dist/manifest.json +33 -22
  11. package/apps/cli/dist/output.d.ts +1 -0
  12. package/apps/cli/dist/output.js +8 -4
  13. package/apps/cli/dist/playboard.js +21 -12
  14. package/apps/cli/dist/provider-launch.d.ts +28 -0
  15. package/apps/cli/dist/provider-launch.js +52 -0
  16. package/apps/cli/dist/providers.d.ts +182 -0
  17. package/apps/cli/dist/providers.js +34 -0
  18. package/dist/public/adapter-sdk.d.ts +2 -0
  19. package/dist/public/adapter-sdk.js +2 -0
  20. package/dist/public/protocol.d.ts +2 -2
  21. package/dist/public/protocol.js +1 -1
  22. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
  23. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +26 -10
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +44 -53
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +21 -29
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.d.ts +3 -0
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.js +10 -0
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +77 -61
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +28 -18
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.d.ts +3 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.js +10 -0
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +55 -54
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +103 -217
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-SMTJTIN7.js → chunk-AE3OJBDS.js} +1 -1
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-H3S6WM37.js → chunk-NGR74QLF.js} +0 -1
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-RISQ6NGV.js → chunk-XIUZ6GXG.js} +1 -1
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +0 -1
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +6 -8
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +16 -21
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -16
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +29 -46
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.d.ts +3 -0
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.js +10 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +47 -36
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +24 -8
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +14 -7
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +24 -8
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +13 -6
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +24 -8
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +14 -7
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -7
  80. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +28 -31
  81. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  82. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
  83. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +113 -179
  84. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  85. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +24 -8
  86. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +14 -6
  87. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
  88. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +24 -8
  89. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +14 -6
  90. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
  91. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
  92. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +48 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +234 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
  95. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
  96. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
  97. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -14
  98. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +112 -59
  99. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
  100. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
  102. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
  104. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
  105. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
  107. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +154 -28
  108. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  109. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
  110. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
  111. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
  114. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
  115. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
  117. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
  118. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
  119. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
  120. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
  123. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
  124. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
  125. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
  126. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
  127. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +166 -1870
  128. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  129. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
  130. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +122 -65
  131. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
  132. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
  133. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.d.ts +21 -0
  134. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.js +176 -0
  135. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -2
  136. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +8 -4
  137. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  138. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
  139. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
  140. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
  141. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
  142. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
  143. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  144. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +1 -1
  145. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
  146. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
  147. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -9
  149. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
  150. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -5
  151. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -292
  152. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/experience.js +7 -0
  153. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
  154. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +18 -13
  155. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +90 -608
  156. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
  157. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -18
  158. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +34 -189
  159. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
  160. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
  161. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
  162. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
  163. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -40
  164. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
  165. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  166. package/package.json +34 -37
  167. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
  168. package/packages/octo-runtime-protocol/schema/protocol.schema.json +166 -1870
  169. package/dist/public/codex.d.ts +0 -1
  170. package/dist/public/codex.js +0 -1
  171. package/dist/public/dsh.d.ts +0 -2
  172. package/dist/public/dsh.js +0 -1
  173. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.d.ts +0 -5
  174. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.js +0 -8
  175. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
  176. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
  177. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
  178. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
  179. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
  180. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
  181. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
  182. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
  183. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
  184. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
  185. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
  186. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.d.ts +0 -4
  187. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.js +0 -36
  188. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
  189. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
  190. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
  191. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
  192. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.d.ts +0 -3
  193. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.js +0 -68
  194. /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
  195. /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
@@ -1,68 +1,25 @@
1
- import { initialControlInstructions, hasImageInput, mapReasoningEffort, invocationEnvironment, processEnvironmentValue, invocationMcpServers, assertMcpOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
+ export const openCodeMetadata = {
2
+ mcp: true,
3
+ type: "opencode"
4
+ };
5
+ import { assertAdapterAgentEnv, assertAdapterWorkdir, runAdapterPreparation, invocationEffort, invocationModel, invocationRuntimeLimits, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
6
+ import { hasImageInput, mapReasoningEffort, invocationEnvironment, processEnvironmentValue, invocationMcpServers, assertMcpOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
7
  import { canonicalTerminalStatus } from "@mininglamp-oss/octo-runtime-protocol";
3
8
  /**
4
9
  * OpenCode adapter: wraps the OpenCode CLI (`opencode run --format json
5
10
  * --thinking --auto`) for full access and ACP for interactive approval.
6
11
  * Both transports normalize provider output into canonical events.
7
12
  */
8
- import { AcpInvocationError, createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
9
- import { createJsonCliAdapter, probeCommand, providerInputText, ProviderProcessError } from "@mininglamp-oss/octo-runtime-adapter-sdk";
10
- import { mkdtemp, rm, writeFile } from "node:fs/promises";
11
- import { tmpdir } from "node:os";
12
- import { delimiter, join, parse, resolve } from "node:path";
13
- export const MINIMUM_OPENCODE_VERSION = "2.1.3";
13
+ import { AcpInvocationError, acpModeId, createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
14
+ import { createJsonCliAdapter, probeCommand, snapshotProviderLaunch, providerInputText, ProviderProcessError } from "@mininglamp-oss/octo-runtime-adapter-sdk";
14
15
  class OpenCodeInputError extends Error {
15
16
  }
16
- /** 检查本轮实际选中的程序;未知版本与 V1 都不能进入执行传输。 */
17
- export async function probeOpenCode(command = "opencode", env = process.env, cwd = process.cwd()) {
18
- const qualified = command.includes("/") || command.includes("\\") || parse(command).root !== "";
19
- // 本机 path 规则保留绝对路径;Windows 根相对和盘符相对路径也绑定本轮 cwd。
20
- const selected = qualified ? resolve(cwd, command) : command;
21
- const probeEnv = { ...env };
22
- if (process.platform === "win32") {
23
- // 普通对象的键区分大小写;与 Node 子进程一致,重复别名取字典序首项。
24
- for (const name of ["PATH", "PATHEXT"]) {
25
- const aliases = Object.keys(env)
26
- .filter((key) => key.toUpperCase() === name)
27
- .sort();
28
- const value = aliases.length ? env[aliases[0]] : undefined;
29
- for (const alias of aliases)
30
- delete probeEnv[alias];
31
- if (value !== undefined)
32
- probeEnv[name] = value;
33
- }
34
- }
35
- // 空项和相对项按子进程 cwd 查找;绝对项按本机规则保留原有含义。
36
- probeEnv.PATH = (probeEnv.PATH ?? "")
37
- .split(delimiter)
38
- .map((entry) => resolve(cwd, entry))
39
- .join(delimiter);
40
- const result = await probeCommand(selected, {
41
- cwd,
42
- env: probeEnv
43
- });
44
- if (!result.available)
45
- return result;
46
- if (!result.version)
47
- return {
48
- ...result,
49
- available: false,
50
- reason: "OPENCODE_VERSION_DETECTION_FAILED: could not determine OpenCode version (--version failed, timed out, or returned invalid output)"
51
- };
52
- const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(result.version);
53
- if (!match ||
54
- Number(match[1]) !== 2 ||
55
- Number(match[2]) < 1 ||
56
- (Number(match[2]) === 1 && Number(match[3]) < 3))
57
- return {
58
- ...result,
59
- available: false,
60
- reason: `OPENCODE_VERSION_UNSUPPORTED: detected ${result.version}. ${result.version.startsWith("1.") ? "OpenCode 1 is no longer supported. " : ""}Install OpenCode >= ${MINIMUM_OPENCODE_VERSION} < 3 and retry.`
61
- };
62
- return result;
17
+ /** 只展示宿主绑定目标的可选版本,不按版本号准入;协议可用性由实际执行结果确定。 */
18
+ export async function probeOpenCode(command, env = {}, cwd, args = []) {
19
+ return probeCommand(command, { cwd, env, args });
63
20
  }
64
- function inlineConfig(request) {
65
- const content = processEnvironmentValue(invocationEnvironment(request), "OPENCODE_CONFIG_CONTENT");
21
+ function inlineConfig(request, inherited = {}) {
22
+ const content = processEnvironmentValue(invocationEnvironment(request, {}, inherited), "OPENCODE_CONFIG_CONTENT");
66
23
  if (!content)
67
24
  return {};
68
25
  let parsed;
@@ -77,92 +34,68 @@ function inlineConfig(request) {
77
34
  return parsed;
78
35
  }
79
36
  /**
80
- * Build the OpenCode CLI argv/env for one invocation.
81
- *
82
- * Runtime context is injected as an extra entry in OpenCode's `instructions`
83
- * config (a temp markdown file) delivered through OPENCODE_CONFIG_CONTENT,
84
- * merged onto any inline config so the user's existing OpenCode config is not
85
- * overwritten. Returns a `cleanup` that removes the temp directory.
86
- *
37
+ * 构造本轮 OpenCode 命令、普通输入和执行配置;原生 inline config 保持,
38
+ * 仅合并本轮 MCP 设置,不生成应用指令文件或追加系统提示词。
87
39
  */
88
- export async function buildOpenCodeCommand(req, command = "opencode") {
89
- if (hasImageInput(req))
90
- throw new Error("UNSUPPORTED_INPUT_MODALITY: opencode does not encode image input");
91
- if (req.approvalMode !== "full_access")
92
- throw new Error("APPROVAL_MODE_UNSUPPORTED: opencode permission transport is not qualified");
93
- const runEnv = invocationEnvironment(req);
94
- const servers = invocationMcpServers(req, runEnv);
95
- assertMcpOptions(servers, "opencode", ["toolTimeoutMs"]);
96
- const inline = inlineConfig(req);
97
- const configuredInstructions = Array.isArray(inline.instructions)
98
- ? inline.instructions.filter((value) => typeof value === "string")
99
- : [];
100
- if (Object.keys(servers).length) {
101
- const existing = isRecord(inline.mcp) ? inline.mcp : {};
102
- inline.mcp = {
103
- ...existing,
104
- servers: {
105
- ...(isRecord(existing.servers) ? existing.servers : {}),
106
- ...Object.fromEntries(Object.entries(servers).map(([name, server]) => [
107
- name,
108
- {
109
- ...(server.type === "stdio"
110
- ? {
111
- type: "local",
112
- command: [server.command, ...(server.args ?? [])],
113
- environment: server.env ?? {}
114
- }
115
- : { type: "remote", url: server.url, headers: server.headers ?? {} }),
116
- disabled: false,
117
- ...(server.toolTimeoutMs !== undefined
118
- ? { timeout: { execution: server.toolTimeoutMs } }
119
- : {})
120
- }
121
- ]))
122
- }
123
- };
124
- }
125
- // Reasoning output and non-interactive tool approval are mandatory parts of
126
- // this adapter's provider contract.
127
- const args = ["run", "--format", "json", "--thinking", "--auto", "--standalone"];
128
- if (req.providerSession?.sessionId)
129
- args.push("--session", req.providerSession.sessionId);
130
- const variant = mapReasoningEffort("opencode", req.agentConfig?.effort);
131
- if (req.agentConfig?.model) {
132
- const model = req.agentConfig.model;
133
- args.push("--model", variant ? `${model.split("#")[0]}#${variant}` : model);
134
- }
135
- // 先校验和转换,再创建资源;写入失败由本层回收,返回后交给 CLI helper。
136
- let directory;
137
- try {
138
- if (initialControlInstructions(req)) {
139
- directory = await mkdtemp(join(tmpdir(), "octo-runtime-opencode-"));
140
- const instructions = join(directory, "instructions.md");
141
- await writeFile(instructions, initialControlInstructions(req), { mode: 0o600 });
142
- inline.instructions = [...configuredInstructions, instructions];
40
+ export function buildOpenCodeCommand(req, command = "opencode", inherited = {}) {
41
+ return Promise.resolve().then(() => {
42
+ if (hasImageInput(req))
43
+ throw new Error("UNSUPPORTED_INPUT_MODALITY: opencode does not encode image input");
44
+ if (invocationApprovalMode(req) !== "full_access")
45
+ throw new Error("APPROVAL_MODE_UNSUPPORTED: opencode permission transport is not qualified");
46
+ const runEnv = invocationEnvironment(req, {}, inherited);
47
+ const servers = invocationMcpServers(req, runEnv);
48
+ assertMcpOptions(servers, "opencode", ["toolTimeoutMs"]);
49
+ const inline = inlineConfig(req, inherited);
50
+ if (Object.keys(servers).length) {
51
+ const existing = isRecord(inline.mcp) ? inline.mcp : {};
52
+ inline.mcp = {
53
+ ...existing,
54
+ servers: {
55
+ ...(isRecord(existing.servers) ? existing.servers : {}),
56
+ ...Object.fromEntries(Object.entries(servers).map(([name, server]) => [
57
+ name,
58
+ {
59
+ ...(server.type === "stdio"
60
+ ? {
61
+ type: "local",
62
+ command: [server.command, ...(server.args ?? [])],
63
+ environment: server.env ?? {}
64
+ }
65
+ : { type: "remote", url: server.url, headers: server.headers ?? {} }),
66
+ disabled: false,
67
+ ...(server.toolTimeoutMs !== undefined
68
+ ? { timeout: { execution: server.toolTimeoutMs } }
69
+ : {})
70
+ }
71
+ ]))
72
+ }
73
+ };
143
74
  }
144
- }
145
- catch (error) {
146
- if (directory)
147
- await rm(directory, { recursive: true, force: true });
148
- throw error;
149
- }
150
- return {
151
- command,
152
- args,
153
- input: providerInputText(req),
154
- env: {
155
- OPENCODE_CONFIG_CONTENT: JSON.stringify(inline),
156
- OPENCODE_CLIENT: "octo-runtime",
157
- PWD: req.workdir
158
- },
159
- rpcMethod: "process.stdin",
160
- providerSessionId: req.providerSession?.sessionId,
161
- cleanup: async () => {
162
- if (directory)
163
- await rm(directory, { recursive: true, force: true });
75
+ // Reasoning output and non-interactive tool approval are mandatory parts of
76
+ // this adapter's provider contract.
77
+ const args = ["run", "--format", "json", "--thinking", "--auto", "--standalone"];
78
+ if (req.providerSession?.sessionId)
79
+ args.push("--session", req.providerSession.sessionId);
80
+ const variant = mapReasoningEffort("opencode", invocationEffort(req));
81
+ const model = invocationModel(req);
82
+ if (model) {
83
+ args.push("--model", variant ? `${model.split("#")[0]}#${variant}` : model);
164
84
  }
165
- };
85
+ return {
86
+ command,
87
+ args,
88
+ input: providerInputText(req),
89
+ env: {
90
+ OPENCODE_CONFIG_CONTENT: JSON.stringify(inline),
91
+ OPENCODE_CLIENT: "octo-runtime",
92
+ PWD: invocationWorkdir(req)
93
+ },
94
+ rpcMethod: "process.stdin",
95
+ providerSessionId: req.providerSession?.sessionId,
96
+ cleanup: () => undefined
97
+ };
98
+ });
166
99
  }
167
100
  /** Translate one OpenCode native event/part into canonical events; unrelated events yield an empty list. */
168
101
  export function normalizeOpenCodeEvent(native) {
@@ -363,28 +296,33 @@ export class OpenCodeEventNormalizer {
363
296
  });
364
297
  }
365
298
  }
366
- export function createOpenCodeAdapter({ command = "opencode" } = {}) {
299
+ export function createOpenCodeAdapter({ command, commandArgsPrefix = [], env = {} }) {
300
+ const launch = snapshotProviderLaunch({ command, args: commandArgsPrefix, env });
301
+ const buildCommand = async (req) => {
302
+ const spec = await buildOpenCodeCommand(req, launch.command, launch.env);
303
+ return {
304
+ ...spec,
305
+ args: [...launch.args, ...spec.args],
306
+ env: invocationEnvironment(req, spec.env, launch.env)
307
+ };
308
+ };
367
309
  const interactiveAdapters = new Map();
368
- const createInteractive = (selected) => createAcpAdapter({
310
+ const createInteractive = () => createAcpAdapter({
369
311
  type: "opencode",
370
312
  provider: "opencode",
371
- command: selected,
313
+ command: launch.command,
372
314
  args: ["acp"],
373
315
  // ACP 原生权限策略决定何时请求审批;桥接层逐次处理,不覆盖用户的 deny。
374
316
  env: (request) => ({
375
317
  OPENCODE_CLIENT: "octo-runtime",
376
- PWD: request.workdir,
377
- OPENCODE_CONFIG_CONTENT: JSON.stringify(inlineConfig(request))
318
+ PWD: invocationWorkdir(request),
319
+ OPENCODE_CONFIG_CONTENT: JSON.stringify(inlineConfig(request, launch.env))
378
320
  })
379
- });
321
+ }, { command: launch.command, commandArgsPrefix: launch.args, env: launch.env });
380
322
  const options = {
381
- metadata: {
382
- mcp: true,
383
- type: "opencode",
384
- agentSources: ["provisioned"]
385
- },
386
- probe: () => probeOpenCode(command),
387
- buildCommand: (req) => buildOpenCodeCommand(req, command),
323
+ metadata: openCodeMetadata,
324
+ probe: () => probeOpenCode(launch.command, launch.env, undefined, launch.args),
325
+ buildCommand,
388
326
  normalize: normalizeOpenCodeEvent,
389
327
  onSuccess: () => [
390
328
  {
@@ -398,6 +336,9 @@ export function createOpenCodeAdapter({ command = "opencode" } = {}) {
398
336
  const adapter = createJsonCliAdapter(options);
399
337
  return {
400
338
  ...adapter,
339
+ get defaultAgentEnv() {
340
+ return adapter.defaultAgentEnv;
341
+ },
401
342
  async respondInteraction(...args) {
402
343
  const interactive = interactiveAdapters.get(args[0]);
403
344
  if (!interactive)
@@ -405,32 +346,27 @@ export function createOpenCodeAdapter({ command = "opencode" } = {}) {
405
346
  await interactive.respondInteraction(...args);
406
347
  },
407
348
  async *invoke(request, context) {
408
- if (hasImageInput(request))
409
- throw new Error("UNSUPPORTED_INPUT_MODALITY: opencode does not encode image input");
410
- if (request.approvalMode === "assisted")
411
- throw new Error("APPROVAL_MODE_UNSUPPORTED: opencode has no qualified assisted policy");
349
+ await runAdapterPreparation(context, async () => {
350
+ assertAdapterAgentEnv(request);
351
+ // 两种传输共用本轮预算;内层再次配置同值不会重置 Core 的计时起点。
352
+ context?.configureRuntimeLimits?.(invocationRuntimeLimits(request));
353
+ await assertAdapterWorkdir(request);
354
+ if (hasImageInput(request))
355
+ throw new Error("UNSUPPORTED_INPUT_MODALITY: opencode does not encode image input");
356
+ if (invocationApprovalMode(request) === "assisted")
357
+ throw new Error("APPROVAL_MODE_UNSUPPORTED: opencode has no qualified assisted policy");
358
+ // 启动前只做目录与纯配置检查;实际协议失败按执行结果报告,不以版本号拦截。
359
+ inlineConfig(request, launch.env);
360
+ // JSON CLI 没有本包已接线的模式载体,不替宿主改变审批或选择传输。
361
+ if (invocationApprovalMode(request) === "full_access" &&
362
+ acpModeId(request, "opencode") !== undefined)
363
+ throw new Error("OPENCODE_MODE_UNSUPPORTED: modeId requires the ACP execution path");
364
+ });
412
365
  request.signal?.throwIfAborted();
413
- const selected = await probeOpenCode(command, invocationEnvironment(request), request.workdir);
414
- if (!selected.available)
415
- throw new Error(selected.reason ?? "OpenCode is unavailable");
416
- request.signal?.throwIfAborted();
417
- try {
418
- inlineConfig(request);
419
- }
420
- catch (error) {
421
- if (!(error instanceof OpenCodeInputError))
422
- throw error;
423
- yield {
424
- protocolVersion: 2,
425
- type: "run.failed",
426
- payload: { code: "OPENCODE_CONFIG_INVALID", message: error.message }
427
- };
428
- return;
429
- }
430
- if (request.approvalMode === "ask") {
366
+ if (invocationApprovalMode(request) === "ask") {
431
367
  if (interactiveAdapters.has(request.invocationId))
432
368
  throw new Error("INVOCATION_ALREADY_ACTIVE");
433
- const interactive = createInteractive(selected.command);
369
+ const interactive = createInteractive();
434
370
  interactiveAdapters.set(request.invocationId, interactive);
435
371
  try {
436
372
  yield* interactive.invoke(request, context);
@@ -451,8 +387,8 @@ export function createOpenCodeAdapter({ command = "opencode" } = {}) {
451
387
  try {
452
388
  yield* createJsonCliAdapter({
453
389
  ...options,
454
- reasoningLevels: request.agentConfig.model ? undefined : null,
455
- buildCommand: (req) => buildOpenCodeCommand(req, selected.command),
390
+ reasoningLevels: invocationModel(request) ? undefined : null,
391
+ buildCommand,
456
392
  normalize: (native) => {
457
393
  const part = native.part ?? native;
458
394
  if (native.type === "step_start" || part.type === "step-start")
@@ -493,5 +429,3 @@ export function createOpenCodeAdapter({ command = "opencode" } = {}) {
493
429
  }
494
430
  };
495
431
  }
496
- export const opencodeAdapter = createOpenCodeAdapter();
497
- export default opencodeAdapter;
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-opencode",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
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.12",
9
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.12",
10
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.12"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.14",
9
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.14",
10
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14"
11
11
  },
12
12
  "types": "./dist/index.d.ts",
13
13
  "files": [
@@ -1,3 +1,5 @@
1
+ import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
1
3
  /**
2
4
  * Qoder CLI ACP adapter. Launches `qodercli --acp` and speaks the Agent
3
5
  * Client Protocol through the shared ACP adapter, which reconstructs model
@@ -10,22 +12,36 @@
10
12
  * fallback. Per-session model selection follows the standard ACP path when the
11
13
  * runtime configures a model that Qoder advertises.
12
14
  */
13
- export declare const qoderCliAdapter: Readonly<Omit<{
15
+ export declare const qoderCliMetadata: AdapterMetadata;
16
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
17
+ export declare function createQoderCliAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
18
+ command: string;
19
+ }): Readonly<Omit<{
14
20
  metadata: {
15
- mcp: true;
21
+ mcp?: boolean;
22
+ workspace?: boolean;
23
+ protocolSupport?: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
16
24
  type: string;
17
- agentSources: "provisioned"[];
25
+ processModel?: string;
26
+ transport?: string;
18
27
  };
19
- probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
28
+ probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
29
+ available: false;
30
+ command: string;
31
+ reason: string;
32
+ }>);
20
33
  respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
21
34
  invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
22
- }, "metadata"> & {
35
+ }, "metadata" | "defaultAgentEnv"> & {
36
+ readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
23
37
  metadata: Omit<{
24
- mcp: true;
38
+ mcp?: boolean;
39
+ workspace?: boolean;
40
+ protocolSupport?: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
25
41
  type: string;
26
- agentSources: "provisioned"[];
42
+ processModel?: string;
43
+ transport?: string;
27
44
  }, "protocolSupport"> & {
28
45
  protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
29
46
  };
30
47
  }>;
31
- export default qoderCliAdapter;
@@ -1,3 +1,4 @@
1
+ import { invocationApprovalMode } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
2
3
  /**
3
4
  * Qoder CLI ACP adapter. Launches `qodercli --acp` and speaks the Agent
@@ -11,10 +12,17 @@ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
11
12
  * fallback. Per-session model selection follows the standard ACP path when the
12
13
  * runtime configures a model that Qoder advertises.
13
14
  */
14
- export const qoderCliAdapter = createAcpAdapter({
15
+ export const qoderCliMetadata = {
15
16
  type: "qodercli",
16
- provider: "qodercli",
17
- command: "qodercli",
18
- args: (request) => (request.approvalMode === "full_access" ? ["--yolo", "--acp"] : ["--acp"])
19
- });
20
- export default qoderCliAdapter;
17
+ mcp: true
18
+ };
19
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
20
+ export function createQoderCliAdapter(options) {
21
+ return createAcpAdapter({
22
+ metadata: qoderCliMetadata,
23
+ type: "qodercli",
24
+ provider: "qodercli",
25
+ command: options.command,
26
+ args: (request) => invocationApprovalMode(request) === "full_access" ? ["--yolo", "--acp"] : ["--acp"]
27
+ }, options);
28
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qodercli",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.12"
12
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14",
13
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.14"
13
14
  }
14
15
  }
@@ -1,3 +1,5 @@
1
+ import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
1
3
  /**
2
4
  * Qoder CN CLI ACP adapter. Launches `qoderclicn --acp` and speaks the
3
5
  * Agent Client Protocol through the shared ACP adapter, which reconstructs
@@ -10,22 +12,36 @@
10
12
  * binary and is registered as its own adapter type so a runtime can pick the CN
11
13
  * build explicitly.
12
14
  */
13
- export declare const qoderCliCnAdapter: Readonly<Omit<{
15
+ export declare const qoderCliCnMetadata: AdapterMetadata;
16
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
17
+ export declare function createQoderCliCnAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
18
+ command: string;
19
+ }): Readonly<Omit<{
14
20
  metadata: {
15
- mcp: true;
21
+ mcp?: boolean;
22
+ workspace?: boolean;
23
+ protocolSupport?: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
16
24
  type: string;
17
- agentSources: "provisioned"[];
25
+ processModel?: string;
26
+ transport?: string;
18
27
  };
19
- probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
28
+ probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
29
+ available: false;
30
+ command: string;
31
+ reason: string;
32
+ }>);
20
33
  respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
21
34
  invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
22
- }, "metadata"> & {
35
+ }, "metadata" | "defaultAgentEnv"> & {
36
+ readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
23
37
  metadata: Omit<{
24
- mcp: true;
38
+ mcp?: boolean;
39
+ workspace?: boolean;
40
+ protocolSupport?: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
25
41
  type: string;
26
- agentSources: "provisioned"[];
42
+ processModel?: string;
43
+ transport?: string;
27
44
  }, "protocolSupport"> & {
28
45
  protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
29
46
  };
30
47
  }>;
31
- export default qoderCliCnAdapter;
@@ -1,3 +1,4 @@
1
+ import { invocationApprovalMode } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
2
3
  /**
3
4
  * Qoder CN CLI ACP adapter. Launches `qoderclicn --acp` and speaks the
@@ -11,10 +12,17 @@ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
11
12
  * binary and is registered as its own adapter type so a runtime can pick the CN
12
13
  * build explicitly.
13
14
  */
14
- export const qoderCliCnAdapter = createAcpAdapter({
15
+ export const qoderCliCnMetadata = {
15
16
  type: "qoderclicn",
16
- provider: "qoderclicn",
17
- command: "qoderclicn",
18
- args: (request) => (request.approvalMode === "full_access" ? ["--yolo", "--acp"] : ["--acp"])
19
- });
20
- export default qoderCliCnAdapter;
17
+ mcp: true
18
+ };
19
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
20
+ export function createQoderCliCnAdapter(options) {
21
+ return createAcpAdapter({
22
+ metadata: qoderCliCnMetadata,
23
+ type: "qoderclicn",
24
+ provider: "qoderclicn",
25
+ command: options.command,
26
+ args: (request) => invocationApprovalMode(request) === "full_access" ? ["--yolo", "--acp"] : ["--acp"]
27
+ }, options);
28
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qoderclicn",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.12"
12
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14",
13
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.14"
13
14
  }
14
15
  }
@@ -1,4 +1,4 @@
1
- import type { ProtocolMode, StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import type { ProtocolMode, RuntimeLimits, StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  import type { RuntimeLog } from "./runtime-log.js";
3
3
  /** Provider progress used by the host watchdog to enforce execution deadlines. */
4
4
  export interface ProviderActivity {
@@ -8,6 +8,10 @@ export interface ProviderActivity {
8
8
  toolState?: "started" | "completed";
9
9
  }
10
10
  export interface AdapterInvocationContext {
11
+ /** 宿主可信连接设置不改写调用方 AgentEnv。 */
12
+ providerOptions?: Record<string, string>;
13
+ /** Adapter 解释预算后配置本次 Core 看门狗;不传 Provider 配置副本。 */
14
+ configureRuntimeLimits?(limits: RuntimeLimits | undefined): void;
11
15
  protocolMode?: ProtocolMode;
12
16
  streamLimits?: Readonly<StreamLimitPolicy>;
13
17
  /** Existing host metadata sink; never serialize or log provider bodies. */
@@ -0,0 +1,48 @@
1
+ import { type AgentEnv, type ContextItem, type ApprovalMode, type InvokeRequest, type RuntimeLimits } from "@mininglamp-oss/octo-runtime-protocol";
2
+ /**
3
+ * 在 Adapter 消费本轮 AgentEnv 时,按 namespace/name 精确读取 bean 的 payload;不存在则返回 undefined。
4
+ * 公共与私有 bean 都可读取。私有名称、字段和类型由宿主与对应 Adapter 约定,无须公共 schema 注册。
5
+ * T 仅提供编译期类型提示,不做运行时校验;必填检查、默认值及 Provider 原生映射由消费方负责。
6
+ * 返回原 payload 引用,不复制或修改信封;调用方应只读使用,不写回默认值或跨调用保存配置。
7
+ *
8
+ * @example
9
+ * const options = agentEnvItem<{ agentId: string }>(req.agentEnv, "adapter.my-adapter", "options");
10
+ * if (!options || typeof options.agentId !== "string" || !options.agentId.trim())
11
+ * throw new TypeError("MY_ADAPTER_AGENT_ID_REQUIRED");
12
+ *
13
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
14
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
15
+ */
16
+ export declare function agentEnvItem<T extends object = Record<string, unknown>>(env: AgentEnv, namespace: string, name: string): T | undefined;
17
+ /**
18
+ * Adapter 读取公共 octo.execution/model bean 的 selection.id,取得本轮显式选择的 Provider 模型标识。
19
+ * 条目或 id 缺失时返回 undefined;不补默认模型、不查询模型目录,也不读取私有 options 中的同名字段。
20
+ * 本函数只读不改写 AgentEnv;字段类型、可用性检查及 Provider 原生参数映射仍由 Adapter 负责。
21
+ * 私有配置使用 agentEnvItem<T>(request.agentEnv, namespace, name),不扩展公共 model bean。
22
+ *
23
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
24
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
25
+ */
26
+ export declare function invocationModel(request: InvokeRequest): string | undefined;
27
+ export declare function invocationEffort(request: InvokeRequest): string | undefined;
28
+ export declare function invocationWorkdir(request: InvokeRequest): string;
29
+ export declare function invocationApprovalMode(request: InvokeRequest): ApprovalMode;
30
+ /** Harness 私有选项仍是原始 payload;不生成公共配置副本。 */
31
+ export declare function invocationOptions(request: InvokeRequest, adapterType?: string): Record<string, unknown>;
32
+ /** 可信连接选项只绑定本次 Adapter 调用,不写回调用方信封。 */
33
+ export declare function bindInvocationConnection(request: InvokeRequest, options?: Record<string, string>): void;
34
+ export declare function invocationProviderOptions(request: InvokeRequest, adapterType?: string): Record<string, unknown>;
35
+ export declare function invocationOption(request: InvokeRequest, key: string, adapterType?: string): string | undefined;
36
+ export declare function invocationTimeoutSeconds(request: InvokeRequest, adapterType?: string): number | undefined;
37
+ /** Adapter 解释预算,Core 仅按本地回调执行计时,不解析配置条目。 */
38
+ export declare function invocationRuntimeLimits(request: InvokeRequest): RuntimeLimits | undefined;
39
+ /** 每个 Harness 拥有自己的默认信封;不包含隐式 cwd、模型或业务材料。 */
40
+ export declare function defaultAgentEnv(type: string): AgentEnv;
41
+ /** 调用方显式补缺省条目,保留已提交条目的顺序和值,返回独立副本。 */
42
+ export declare function withAgentEnvDefaults(submitted: AgentEnv, defaults: AgentEnv): AgentEnv;
43
+ /** 调用方显式替换同名 bean;不解释 payload,不改变其他条目的相对顺序。 */
44
+ export declare function withAgentEnvItems(env: AgentEnv | undefined, items: ContextItem[]): AgentEnv;
45
+ /** 公共 bean 的消费校验;未消费的私有扩展不参与,也不需要中央注册。 */
46
+ export declare function assertAdapterAgentEnv(request: InvokeRequest): void;
47
+ /** 调用方准备目录;Adapter 在启动 Provider 前检查,不创建或替换路径。 */
48
+ export declare function assertAdapterWorkdir(request: InvokeRequest, workspace?: boolean): Promise<void>;