@mininglamp-oss/octo-runtime 1.1.3 → 1.1.5

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 (214) hide show
  1. package/README.md +62 -38
  2. package/apps/cli/README.md +58 -22
  3. package/apps/cli/dist/build-info.json +2 -2
  4. package/apps/cli/dist/cli-entrypoint.d.ts +2 -0
  5. package/apps/cli/dist/cli-entrypoint.js +16 -0
  6. package/apps/cli/dist/command-tree.d.ts +20 -0
  7. package/apps/cli/dist/command-tree.js +402 -0
  8. package/apps/cli/dist/extra-command-config.d.ts +4 -0
  9. package/apps/cli/dist/extra-command-config.js +50 -0
  10. package/apps/cli/dist/extra-commands.d.ts +15 -0
  11. package/apps/cli/dist/extra-commands.js +275 -0
  12. package/apps/cli/dist/extras.js +14 -2
  13. package/apps/cli/dist/global-extras.d.ts +16 -0
  14. package/apps/cli/dist/global-extras.js +201 -0
  15. package/apps/cli/dist/help.d.ts +4 -1
  16. package/apps/cli/dist/help.js +31 -75
  17. package/apps/cli/dist/main.d.ts +2 -0
  18. package/apps/cli/dist/main.js +53 -63
  19. package/apps/cli/dist/manifest.json +53 -3
  20. package/apps/cli/dist/module-manifest.d.ts +1 -1
  21. package/apps/cli/dist/module-manifest.js +3 -2
  22. package/apps/cli/dist/openclaw.js +32 -8
  23. package/apps/cli/dist/output.js +16 -2
  24. package/apps/cli/dist/playboard.d.ts +5 -0
  25. package/apps/cli/dist/playboard.js +41 -13
  26. package/apps/cli/dist/service-control.js +2 -2
  27. package/apps/cli/dist/state.js +48 -19
  28. package/dist/public/channel-gateway-commands.d.ts +1 -0
  29. package/dist/public/channel-gateway-commands.js +1 -0
  30. package/dist/public/channel-wecom-commands.d.ts +1 -0
  31. package/dist/public/channel-wecom-commands.js +1 -0
  32. package/dist/public/dsh.d.ts +2 -0
  33. package/dist/public/dsh.js +1 -0
  34. package/dist/public/executor-kernel.d.ts +1 -1
  35. package/dist/public/executor-kernel.js +1 -1
  36. package/dist/public/extra.d.ts +1 -0
  37. package/dist/public/extra.js +1 -0
  38. package/dist/public/host.d.ts +2 -4
  39. package/dist/public/host.js +1 -2
  40. package/dist/public/webui-commands.d.ts +1 -0
  41. package/dist/public/webui-commands.js +1 -0
  42. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +2 -2
  43. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +4 -0
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +26 -2
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +3 -3
  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-DYOJCNWF.js +854 -0
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-G5PWGRL5.js +209 -0
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-UOQRXV3Q.js +340 -0
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +1 -0
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +16 -0
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +6 -0
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-client-LICENSE.txt +21 -0
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-protocol-LICENSE.txt +21 -0
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +35 -0
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +14 -0
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +52 -0
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +306 -0
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +11 -0
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +13 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.d.ts +12 -0
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +7 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +15 -0
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +2 -1
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +10 -5
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +214 -55
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  80. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +3 -0
  81. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.d.ts +4 -0
  82. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +24 -2
  83. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/hourly-log.js +11 -3
  84. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +12 -3
  85. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +30 -8
  86. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +4 -3
  87. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +6 -0
  88. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +16 -4
  89. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +15 -2
  90. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +29 -1
  91. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  92. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +5 -5
  93. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  94. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  95. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.d.ts +2 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.js +16 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +20 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +402 -0
  99. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +4 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +50 -0
  101. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +15 -0
  102. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +275 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +14 -2
  104. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +16 -0
  105. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +201 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +4 -1
  107. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +31 -75
  108. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +53 -63
  110. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +53 -3
  111. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
  112. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +3 -2
  113. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +32 -8
  114. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +16 -2
  115. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +5 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +41 -13
  117. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/service-control.js +2 -2
  118. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -19
  119. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +25 -23
  120. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.d.ts +2 -2
  121. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.js +16 -6
  122. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/systemd.js +9 -7
  123. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.d.ts +4 -1
  124. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +36 -11
  125. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  126. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -2
  127. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  128. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -1
  129. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +2 -1
  130. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -1
  131. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +16 -1
  132. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +152 -21
  133. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +9 -2
  134. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +8 -0
  135. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +17 -0
  136. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  137. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
  138. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +170 -28
  139. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +3 -1
  140. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.d.ts +4 -0
  141. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +124 -0
  142. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +19 -1
  143. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +23 -0
  144. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +43 -0
  145. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +15 -0
  146. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +283 -0
  147. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +2 -0
  148. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +15 -1
  149. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +5 -1
  150. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -13
  151. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.d.ts +1 -1
  152. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.js +5 -3
  153. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +26 -1
  154. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +2 -1
  155. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +1 -0
  156. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +3 -2
  157. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +3 -2
  158. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +4 -0
  159. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +104 -3
  160. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.js +4 -3
  161. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.d.ts +2 -0
  162. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.js +7 -0
  163. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.d.ts +1 -1
  164. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +4 -3
  165. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +9 -0
  166. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +44 -13
  167. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.d.ts +7 -0
  168. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +44 -3
  169. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.js +2 -1
  170. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +7 -0
  171. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +18 -12
  172. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +10 -6
  173. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +141 -16
  174. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.d.ts +3 -1
  175. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.d.ts +4 -0
  176. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +128 -0
  177. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +9 -5
  178. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +3 -0
  179. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +51 -0
  180. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-CXTvRGim.js +74 -0
  181. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  182. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +7 -3
  183. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +70 -0
  184. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +16 -0
  185. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +33 -9
  186. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +9 -4
  187. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +1 -3
  188. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +1 -2
  189. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +8 -4
  190. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +5 -0
  191. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +39 -1
  192. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +76 -7
  193. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  194. package/node_modules/commander/LICENSE +22 -0
  195. package/node_modules/commander/Readme.md +1172 -0
  196. package/node_modules/commander/index.js +21 -0
  197. package/node_modules/commander/lib/argument.js +147 -0
  198. package/node_modules/commander/lib/command.js +2790 -0
  199. package/node_modules/commander/lib/error.js +36 -0
  200. package/node_modules/commander/lib/help.js +731 -0
  201. package/node_modules/commander/lib/option.js +377 -0
  202. package/node_modules/commander/lib/suggestSimilar.js +99 -0
  203. package/node_modules/commander/package-support.json +19 -0
  204. package/node_modules/commander/package.json +64 -0
  205. package/node_modules/commander/typings/index.d.ts +1113 -0
  206. package/package.json +49 -29
  207. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
  208. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +443 -56
  209. package/packages/octo-runtime-protocol/schema/protocol.schema.json +357 -37
  210. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-DiPc-ipL.js +0 -74
  211. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.d.ts +0 -15
  212. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.js +0 -22
  213. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.d.ts +0 -16
  214. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.js +0 -160
@@ -21,78 +21,34 @@ const validBuildTime = typeof buildTime === "string" &&
21
21
  (buildTime.includes(".") ? buildTime : buildTime.replace("Z", ".000Z"));
22
22
  const cliBuildInfo = `build:${validBuildTime ? buildTime : "unknown"}`;
23
23
  export const cliVersionInfo = `${cliVersion}\n${cliCommitInfo}\n${cliBuildInfo}`;
24
- const componentDescriptions = {
25
- "executor-kernel": `Local Agent execution service. Runs requests through Provider adapters and
26
- supervises the execution worker used by Gateway, WeCom, WebUI and SDK clients.
27
- Install and authenticate your chosen Provider before running Agent tasks.
28
-
29
- Get started: octo-runtime executor-kernel start
30
- Check readiness: octo-runtime executor-kernel status`,
31
- "channel-gateway": `Connects Octo IM Bots to local Agent execution. Receives messages, invokes
32
- the Executor Kernel and sends Agent replies back to Octo IM.
33
-
34
- Configure Bots: octo-runtime extraset channel-gateway < gateway.json
35
- Start: octo-runtime channel-gateway start
36
- Agent tasks also need: octo-runtime executor-kernel start`,
37
- "channel-wecom": `Connects WeCom Bots to local Agent execution. Receives WeCom messages,
38
- invokes the Executor Kernel and sends Agent replies back to WeCom.
39
-
40
- Configure Bots: octo-runtime extraset channel-wecom < wecom.json
41
- Start: octo-runtime channel-wecom start
42
- Agent tasks also need: octo-runtime executor-kernel start`,
43
- webui: `Local browser workspace for Agent conversations and projects.
44
- Uses the Executor Kernel for Agent execution; default URL: http://127.0.0.1:13888/.
45
-
46
- Configure port and sessionStorePath: octo-runtime extraset webui < webui.json
47
- Start: octo-runtime webui start
48
- Agent tasks also need: octo-runtime executor-kernel start`
49
- };
50
- export function helpText(component) {
51
- if (component)
52
- return `Octo Runtime: ${component}
53
-
54
- ${componentDescriptions[component] ?? `Configured Extra service "${component}". Runs its registered module independently.\nConfiguration: octo-runtime extraget ${component}`}
55
-
56
- Usage: octo-runtime ${component} <command> [flags]
57
-
58
- Commands:
59
- install Register and enable this service (autostart on by default)
60
- uninstall Remove this service, preserving configuration and data
61
- start Install if needed, then start this service and wait for readiness
62
- restart Restart this service and wait for local readiness
63
- stop Stop this service, preserving its autostart setting
64
- status Show native service, IPC and component status
65
- run Run this component in the foreground
66
- ${component === "executor-kernel" ? "" : " logs Tail service status logs (no conversation content)\n"}
67
-
68
- Flags: --home <path> --profile <name> --manifest <path> --json --help
69
- Install: --autostart=true|false
70
- ${component === "executor-kernel" ? "" : "Logs: --lines <1..10000> (default 200) --follow --json (NDJSON)\n"}
71
- Kernel and Extras have independent services and autostart settings.
72
- An Extra may start before Kernel and connect when Kernel becomes available.`;
73
- return `Octo Runtime CLI (${cliVersion})
74
- ${cliVersionInfo.split("\n").slice(1).join("\n")}
75
- Manage the local Agent runtime and independent services.
76
-
77
- Usage:
78
- octo-runtime executor-kernel uninstall|install|start|restart|stop|status|run
79
- octo-runtime <extra-name> uninstall|install|start|restart|stop|status|run
80
- octo-runtime <extra-name> logs [--lines 200] [--follow] [--json]
81
- octo-runtime status [--json]
82
- octo-runtime adapter list
83
- octo-runtime adapter probe <type>
84
- octo-runtime doctor
85
- octo-runtime extraset <name> < config.json
86
- octo-runtime extraget <name>
87
- octo-runtime playboard < request.json
88
-
89
- Flags: --home <path> --profile <name> --manifest <path> --json
90
- Install: --autostart=true|false (defaults to true)
91
- Extras: channel-gateway, channel-wecom, webui, or a name saved by extraset.
92
- Components:
93
- executor-kernel Local Agent execution and worker supervision
94
- channel-gateway Octo IM Bot messaging and Agent replies
95
- channel-wecom WeCom Bot messaging and Agent replies
96
- webui Local browser workspace for Agent conversations
97
- Use octo-runtime <component> --help for component commands.`;
98
- }
24
+ export const cliHelpHeader = `Octo Runtime CLI (${cliVersion})\n${cliCommitInfo}\n${cliBuildInfo}`;
25
+ // 产品指定的首页顺序只影响展示;缺席的 Extra 不补进有效命令目录。
26
+ export const preferredRootCommands = [
27
+ "executor-kernel",
28
+ "channel-gateway",
29
+ "channel-wecom",
30
+ "webui"
31
+ ];
32
+ export const lifecycleCommands = new Map([
33
+ ["install", "Register and enable this service (autostart on by default)"],
34
+ ["uninstall", "Remove this service, preserving configuration and data"],
35
+ ["start", "Install if needed, then start this service and wait for readiness"],
36
+ ["stop", "Stop this service, preserving its autostart setting"],
37
+ ["restart", "Restart this service and wait for readiness"],
38
+ ["run", "Run this service in the foreground"],
39
+ ["status", "Show service and runtime status"],
40
+ ["logs", "Read service status logs (no conversation content)"],
41
+ ["extraset", "Replace this service configuration from stdin JSON"],
42
+ ["extraget", "Read this service configuration, including credentials"]
43
+ ]);
44
+ export const rootCommands = new Map([
45
+ ["adapter", "List and probe execution adapters"],
46
+ ["doctor", "Diagnose the local runtime"],
47
+ ["executor-kernel", "Manage local Agent execution and worker supervision"],
48
+ ["extraget", "Read a complete service configuration (advanced)"],
49
+ ["extraset", "Replace a complete service configuration from JSON (advanced)"],
50
+ ["help", "Help about any command"],
51
+ ["playboard", "Run an Agent request from stdin JSON"],
52
+ ["status", "Show runtime and service status"],
53
+ ["version", "Print version and build information"]
54
+ ]);
@@ -8,5 +8,7 @@ export interface CliDependencies extends ServiceControlOptions {
8
8
  /** CLI 入口选择前台组件的退出策略;仅确认命令类型,不表示服务 ready。 */
9
9
  onComponentRun?: () => void;
10
10
  logsSignal?: AbortSignal;
11
+ /** 自有命令的取消;不启动或停止任何服务。 */
12
+ commandSignal?: AbortSignal;
11
13
  }
12
14
  export declare function runCli(args: string[], dependencies?: CliDependencies): Promise<number>;
@@ -1,13 +1,15 @@
1
+ import { runExtraCommand, commandError } from "./extra-commands.js";
1
2
  import net from "node:net";
2
3
  import { randomUUID } from "node:crypto";
3
4
  import { once } from "node:events";
4
5
  import { lstat, mkdir } from "node:fs/promises";
5
6
  import { join, resolve } from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
- import { attachKernel, createKernelService, readAdapterConfigurations } from "@mininglamp-oss/octo-runtime-executor-kernel";
8
+ import { attachKernel, acknowledgeOrphanCleanup, inspectOrphanCleanup, createKernelService, readAdapterConfigurations } from "@mininglamp-oss/octo-runtime-executor-kernel";
8
9
  import { componentEndpoint, createExtraService } from "@mininglamp-oss/octo-runtime-host-sdk";
9
10
  import { getExtra, readExtra, setExtra } from "./extras.js";
10
- import { cliVersionInfo, helpText } from "./help.js";
11
+ import { cliVersionInfo } from "./help.js";
12
+ import { parseCliCommand } from "./command-tree.js";
11
13
  import { runForegroundService } from "./foreground.js";
12
14
  import { showExtraLogs } from "./logs.js";
13
15
  import { StatusOutput } from "./status-output.js";
@@ -21,12 +23,25 @@ const components = ["executor-kernel", "channel-gateway"];
21
23
  const builtinComponents = [...components, "channel-wecom", "webui"];
22
24
  export async function runCli(args, dependencies = {}) {
23
25
  const output = dependencies.output ?? ((line) => process.stdout.write(`${line}\n`));
24
- let json = args.includes("--json");
26
+ // 参数解析失败也按宿主布尔标记输出 JSON;-- 后的字面位置参数不选择输出格式。
27
+ const literalIndex = args.indexOf("--");
28
+ let json = (literalIndex < 0 ? args : args.slice(0, literalIndex)).some((arg) => arg === "--json" || arg.startsWith("--json="));
25
29
  let context = {};
26
30
  let runningComponent;
27
31
  let statusOutput;
28
32
  try {
29
- const { flags, positional } = parse(args);
33
+ const parsed = await parseCliCommand(args, dependencies);
34
+ if (parsed.help !== undefined) {
35
+ output(parsed.help);
36
+ return 0;
37
+ }
38
+ const { flags, positional } = parsed;
39
+ json = Boolean(flags.json);
40
+ if (parsed.extra)
41
+ return await runExtraCommand(parsed, dependencies);
42
+ if (flags["acknowledge-orphan-cleanup"] !== undefined &&
43
+ !(positional[0] === "executor-kernel" && positional[1] === "recover"))
44
+ throw new Error("INVALID_ARGUMENTS");
30
45
  if ((flags.lines !== undefined || flags.follow !== undefined) && positional[1] !== "logs")
31
46
  throw new Error("INVALID_ARGUMENTS");
32
47
  json = Boolean(flags.json);
@@ -34,16 +49,26 @@ export async function runCli(args, dependencies = {}) {
34
49
  output(cliVersionInfo);
35
50
  return 0;
36
51
  }
37
- if (flags.help || !positional.length || positional[0] === "help") {
38
- output(helpText(builtinComponents.includes(positional[0]) ? positional[0] : undefined));
39
- return 0;
40
- }
41
- // 裸组件帮助仅做词法校验,不读取配置或创建服务管理器。
42
- if (positional.length === 1 && builtinComponents.includes(positional[0])) {
43
- output(helpText(positional[0]));
52
+ const home = resolve(flags.home ?? defaultRuntimeHome(dependencies.env, dependencies.platform));
53
+ // 模块清单不决定运行状态位置;前台 Kernel、doctor 和恢复确认共用 Home 下的同一路径。
54
+ const kernelStateDirectory = join(home, "run");
55
+ const kernelInvocationManifest = join(kernelStateDirectory, "kernel-invocations.json");
56
+ // 恢复确认不加载 Provider 或访问服务管理器;原记录继续保留,下一次启动校验摘要后替换。
57
+ if (positional[0] === "executor-kernel" && positional[1] === "recover") {
58
+ context = { component: "executor-kernel", action: "recover", logs: join(home, "logs") };
59
+ if (positional.length !== 2 ||
60
+ flags["acknowledge-orphan-cleanup"] !== "true" ||
61
+ flags.autostart !== undefined)
62
+ throw new Error("INVALID_ARGUMENTS");
63
+ const recovery = await withSetupLock({
64
+ ...runtimePaths(home, "default", dependencies.platform),
65
+ setupLock: join(kernelStateDirectory, "executor-kernel.setup.lock")
66
+ }, () => acknowledgeOrphanCleanup(kernelInvocationManifest));
67
+ output(json
68
+ ? JSON.stringify(recovery)
69
+ : `Orphan cleanup acknowledged. Evidence: ${recovery.archivePath}\nStart executor-kernel again using the same --home.`);
44
70
  return 0;
45
71
  }
46
- const home = resolve(flags.home ?? defaultRuntimeHome(dependencies.env, dependencies.platform));
47
72
  // Route logs before config/module/manager access so offline failures remain diagnosable.
48
73
  if (positional[1] === "logs") {
49
74
  const extra = positional[0];
@@ -103,10 +128,6 @@ export async function runCli(args, dependencies = {}) {
103
128
  const isComponent = (name) => builtinComponents.includes(name) ||
104
129
  registrations.some((entry) => entry.name === name) ||
105
130
  manifest?.extras.some((entry) => entry.name === name) === true;
106
- if (positional.length === 1 && isComponent(positional[0])) {
107
- output(helpText(positional[0]));
108
- return 0;
109
- }
110
131
  const service = resolveServiceControl(dependencies);
111
132
  const input = dependencies.input ?? process.stdin;
112
133
  const publish = (value, human) => output(typeof value === "string" ? value : !json && human ? human : JSON.stringify(value, null, 2));
@@ -190,9 +211,10 @@ export async function runCli(args, dependencies = {}) {
190
211
  const manager = await service.backend.probe();
191
212
  const status = await snapshots(componentNames);
192
213
  const checks = Object.entries(status).map(([component, value]) => ({ component, ...value }));
193
- publish({ manager, checks }, `Manager: ${manager.manager} (${manager.supported ? "available" : "unavailable"})\n\n${Object.entries(status)
214
+ const recovery = await inspectOrphanCleanup(kernelInvocationManifest);
215
+ publish({ manager, checks, recovery }, `Manager: ${manager.manager} (${manager.supported ? "available" : "unavailable"})\n\n${Object.entries(status)
194
216
  .map(([name, value]) => formatStatus(name, value))
195
- .join("\n\n")}`);
217
+ .join("\n\n")}\n\nOrphan cleanup: ${recovery.state}\nManifest: ${recovery.manifestPath}${recovery.state === "cleanup_incomplete" ? "\nStop all orphan tools, then run executor-kernel recover --acknowledge-orphan-cleanup with the same --home." : ""}`);
196
218
  return 0;
197
219
  }
198
220
  if (positional[0] === "status" && positional.length === 1) {
@@ -225,7 +247,7 @@ export async function runCli(args, dependencies = {}) {
225
247
  const config = await readJsonFile(paths.profileConfig);
226
248
  handle = createKernelService({
227
249
  endpoint,
228
- stateDirectory: join(home, "run"),
250
+ stateDirectory: kernelStateDirectory,
229
251
  workerEntrypoint: fileURLToPath(new URL("./worker.js", import.meta.url)),
230
252
  adapterModules: resolveAdapterModules(manifest),
231
253
  adapterConfigurations: readAdapterConfigurations(paths.profileRoot, config?.adapters),
@@ -349,21 +371,23 @@ export async function runCli(args, dependencies = {}) {
349
371
  catch (error) {
350
372
  if (runningComponent && context.logs)
351
373
  await recordStartupFailure(context.logs, runningComponent, error);
352
- const failure = { ...describeError(error), ...context };
374
+ const failure = { ...(commandError(error) ?? describeError(error)), ...context };
353
375
  const code = failure.code;
354
376
  if (json)
355
377
  output(JSON.stringify({ error: failure }, null, context.action === "logs" ? undefined : 2));
356
378
  else
357
379
  (dependencies.errorOutput ?? ((line) => process.stderr.write(`${line}\n`)))(`${[context.component, context.action].filter(Boolean).join(" ") || "octo-runtime"}: ${code}${failure.cause_code ? ` (${failure.cause_code})` : ""}\n${failure.message}${context.logs ? `\nLogs: ${context.logs}` : ""}`);
358
- return ["SERVICE_NOT_INSTALLED", "NOT_INSTALLED"].includes(code)
359
- ? 3
360
- : /INVALID|REQUIRED/.test(code)
361
- ? 2
362
- : /INCOMPLETE/.test(code)
363
- ? 5
364
- : /UNAVAILABLE|SERVICE_PROCESS_EXITED/.test(code)
365
- ? 4
366
- : 1;
380
+ return code === "EXTRA_COMMAND_CANCELLED"
381
+ ? 130
382
+ : ["SERVICE_NOT_INSTALLED", "NOT_INSTALLED"].includes(code)
383
+ ? 3
384
+ : /INVALID|REQUIRED|COMMAND_NOT_FOUND/.test(code)
385
+ ? 2
386
+ : /INCOMPLETE/.test(code)
387
+ ? 5
388
+ : /UNAVAILABLE|SERVICE_PROCESS_EXITED/.test(code)
389
+ ? 4
390
+ : 1;
367
391
  }
368
392
  finally {
369
393
  statusOutput?.close();
@@ -425,37 +449,3 @@ async function componentStatus(home, component, platform, requireReady = false)
425
449
  });
426
450
  }
427
451
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
428
- function parse(args) {
429
- const flags = {}, positional = [];
430
- for (let i = 0; i < args.length; i++) {
431
- const arg = args[i] === "-h" ? "--help" : args[i] === "-v" ? "--version" : args[i];
432
- if (!arg.startsWith("-")) {
433
- positional.push(arg);
434
- continue;
435
- }
436
- const match = /^--([a-z-]+)(?:=(.*))?$/.exec(arg);
437
- if (!match ||
438
- ![
439
- "home",
440
- "profile",
441
- "manifest",
442
- "json",
443
- "help",
444
- "version",
445
- "autostart",
446
- "lines",
447
- "follow"
448
- ].includes(match[1]) ||
449
- Object.hasOwn(flags, match[1]))
450
- throw new Error("INVALID_ARGUMENTS");
451
- const key = match[1];
452
- flags[key] = ["json", "help", "version", "follow"].includes(key)
453
- ? "true"
454
- : (match[2] ?? args[++i]);
455
- if (!flags[key] ||
456
- flags[key].startsWith("--") ||
457
- (key === "autostart" && !["true", "false"].includes(flags[key])))
458
- throw new Error("INVALID_ARGUMENTS");
459
- }
460
- return { flags, positional };
461
- }
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "version": 1,
3
3
  "adapters": [
4
+ {
5
+ "type": "dsh",
6
+ "module": "@mininglamp-oss/octo-runtime-adapter-dsh",
7
+ "export": "dshAdapter"
8
+ },
4
9
  {
5
10
  "type": "codex",
6
11
  "module": "@mininglamp-oss/octo-runtime-adapter-codex",
@@ -68,8 +73,53 @@
68
73
  }
69
74
  ],
70
75
  "extras": [
71
- { "name": "channel-gateway", "module": "@mininglamp-oss/octo-runtime-extra-channel-gateway" },
72
- { "name": "channel-wecom", "module": "@mininglamp-oss/octo-runtime-extra-channel-wecom" },
73
- { "name": "webui", "module": "@mininglamp-oss/octo-runtime-extra-webui" }
76
+ {
77
+ "name": "channel-gateway",
78
+ "description": "Connect Octo IM Bots to local Agent execution",
79
+ "configExample": {
80
+ "bots": [
81
+ {
82
+ "api_url": "https://im.example.com/api",
83
+ "bot_id": "<BOT_ID>",
84
+ "bf_token": "<BOT_TOKEN>",
85
+ "adapter": {
86
+ "adapter_type": "codex",
87
+ "workdir": "/absolute/workspace",
88
+ "model": "<MODEL_ID>",
89
+ "effort": "medium"
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ "module": "@mininglamp-oss/octo-runtime-extra-channel-gateway"
95
+ },
96
+ {
97
+ "name": "channel-wecom",
98
+ "description": "Connect WeCom Bots to local Agent execution",
99
+ "configExample": {
100
+ "bots": [
101
+ {
102
+ "bot_id": "<BOT_ID>",
103
+ "app_secret": "<APP_SECRET>",
104
+ "adapter": {
105
+ "adapter_type": "codex",
106
+ "workdir": "/absolute/workspace",
107
+ "model": "<MODEL_ID>",
108
+ "effort": "medium"
109
+ }
110
+ }
111
+ ]
112
+ },
113
+ "module": "@mininglamp-oss/octo-runtime-extra-channel-wecom"
114
+ },
115
+ {
116
+ "name": "webui",
117
+ "description": "Open a local browser workspace for Agent conversations",
118
+ "configExample": {
119
+ "port": 13888,
120
+ "sessionStorePath": "/absolute/host-home/extras/webui/sessions.json"
121
+ },
122
+ "module": "@mininglamp-oss/octo-runtime-extra-webui"
123
+ }
74
124
  ]
75
125
  }
@@ -1,3 +1,3 @@
1
1
  import { type ModuleManifest } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
2
- /** CLI 独占默认目录与 Home 扩展策略;SDK 原生装配不读取这两份文件。 */
2
+ /** CLI 独占内置、Home 与全局 Extra 目录;SDK 不扫描,显式清单完全替换。 */
3
3
  export declare function loadCliManifest(home: string, override?: string, report?: (message: string) => void): Promise<ModuleManifest>;
@@ -1,11 +1,12 @@
1
1
  import { join, resolve } from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { mergeModuleManifests, readModuleManifest } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
4
- /** CLI 独占默认目录与 Home 扩展策略;SDK 原生装配不读取这两份文件。 */
4
+ import { discoverGlobalExtras, mergeGlobalExtras } from "./global-extras.js";
5
+ /** CLI 独占内置、Home 与全局 Extra 目录;SDK 不扫描,显式清单完全替换。 */
5
6
  export async function loadCliManifest(home, override, report = (message) => console.error(message)) {
6
7
  if (override)
7
8
  return readModuleManifest(resolve(override), { legacy: true });
8
9
  const builtin = await readModuleManifest(fileURLToPath(new URL("./manifest.json", import.meta.url)));
9
10
  const extension = await readModuleManifest(join(home, "manifest.json"), { optional: true });
10
- return mergeModuleManifests(builtin, extension, report);
11
+ return mergeGlobalExtras(mergeModuleManifests(builtin, extension, report), await discoverGlobalExtras(report), report);
11
12
  }
@@ -1,4 +1,5 @@
1
- import { readFile, mkdir, writeFile, rename, lstat, chmod, rm } from "node:fs/promises";
1
+ import { constants } from "node:fs";
2
+ import { readFile, mkdir, writeFile, rename, lstat, open, rm } from "node:fs/promises";
2
3
  import { parseEnv, promisify } from "node:util";
3
4
  import { execFile } from "node:child_process";
4
5
  import { randomUUID } from "node:crypto";
@@ -134,8 +135,19 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
134
135
  (url.protocol !== "https:" &&
135
136
  !(url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname))))
136
137
  throw new Error("IM_API_URL_INVALID");
137
- url.pathname = url.pathname.replace(/\/+$/, "").replace(/\/api$/, "");
138
- values = { OCTO_BOT_TOKEN: token, OCTO_API_BASE_URL: url.href.replace(/\/+$/, "") };
138
+ let end = url.pathname.length;
139
+ while (end > 0 && url.pathname[end - 1] === "/")
140
+ end--;
141
+ url.pathname = url.pathname.slice(0, end).replace(/\/api$/, "");
142
+ // 去掉 /api 后可能露出多重尾斜杠,仍需全部移除,并保留路径内部的分隔符。
143
+ const href = url.href;
144
+ end = href.length;
145
+ while (end > 0 && href[end - 1] === "/")
146
+ end--;
147
+ values = {
148
+ OCTO_BOT_TOKEN: token,
149
+ OCTO_API_BASE_URL: href.slice(0, end)
150
+ };
139
151
  }
140
152
  if (!values)
141
153
  return { written: false, restartRequired: false };
@@ -149,10 +161,23 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
149
161
  throw new Error("OPENCLAW_ENV_DIRECTORY_INVALID");
150
162
  let previous = "";
151
163
  try {
152
- const info = await lstat(file);
153
- if (!info.isFile())
154
- throw new Error("OPENCLAW_ENV_FILE_INVALID");
155
- previous = await readFile(file, "utf8");
164
+ const handle = await open(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
165
+ try {
166
+ // 校验、读取和收紧权限绑定同一目标;拒绝链接,避免检查后重新按路径操作。
167
+ const info = await handle.stat();
168
+ if (!info.isFile())
169
+ throw new Error("OPENCLAW_ENV_FILE_INVALID");
170
+ if (!constants.O_NOFOLLOW) {
171
+ const entry = await lstat(file);
172
+ if (!entry.isFile() || entry.dev !== info.dev || entry.ino !== info.ino)
173
+ throw new Error("OPENCLAW_ENV_FILE_INVALID");
174
+ }
175
+ await handle.chmod(0o600);
176
+ previous = await handle.readFile("utf8");
177
+ }
178
+ finally {
179
+ await handle.close();
180
+ }
156
181
  }
157
182
  catch (error) {
158
183
  if (error.code !== "ENOENT")
@@ -170,7 +195,6 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
170
195
  Object.entries(values).some(([key, value]) => after[key] !== value))
171
196
  throw new Error("OPENCLAW_ENV_UPDATE_INVALID");
172
197
  if (content === previous) {
173
- await chmod(file, 0o600);
174
198
  return { file, written: false, restartRequired: true };
175
199
  }
176
200
  const temporary = join(origin.openclaw_home, `.octo-env-${randomUUID()}.tmp`);
@@ -99,10 +99,24 @@ export function describeError(error, fallback = "COMMAND_FAILED") {
99
99
  KERNEL_UNAVAILABLE: "Kernel is unavailable. Check executor-kernel status; Extras can remain running.",
100
100
  INVALID_ARGUMENTS: "Use --help to see the available commands and flags.",
101
101
  SETUP_IN_PROGRESS: "Another component lifecycle operation is in progress. Wait for it to finish, then retry.",
102
+ ORPHAN_CLEANUP_INCOMPLETE: "Run doctor with the same --home to inspect the manifest. After stopping all orphan tools, run executor-kernel recover --acknowledge-orphan-cleanup, then start again.",
103
+ ORPHAN_CLEANUP_OWNER_ALIVE: "The original Kernel or worker is still alive or its identity cannot be verified. Stop it safely before acknowledging cleanup.",
104
+ ORPHAN_CLEANUP_NOT_PENDING: "There is no valid incomplete orphan cleanup to acknowledge. Run doctor with the same --home.",
102
105
  SERVICE_NOT_INSTALLED: "Run this component's install command, then start it.",
103
106
  NOT_INSTALLED: "Run this component's install command, then start it.",
104
- EXTRA_NOT_REGISTERED: "Save this Extra's declaration with extraset before starting it.",
105
- EXTRA_MANIFEST_DECLARATION_REQUIRED: "Add this Extra's name and module to the selected Home manifest.json (extras array), then retry.",
107
+ EXTRA_COMMAND_FAILED: "The Extra command failed. No private backend error is printed; check its input and configuration, then retry.",
108
+ EXTRA_CONFIG_CONFLICT: "Configuration changed after this command read it. Read the latest configuration and retry.",
109
+ EXTRA_COMMAND_LOAD_FAILED: "The selected Extra command module or one of its dependencies is broken. Check its package and commands export; lifecycle commands remain available.",
110
+ EXTRA_COMMAND_API_UNSUPPORTED: "This CLI supports Extra command apiVersion 1. Install a compatible command extension.",
111
+ EXTRA_COMMAND_DEFINITION_INVALID: "Command definitions must have unique names and valid options; lifecycle and host option names are reserved.",
112
+ EXTRA_COMMAND_NAMESPACE_CONFLICT: "An Extra name conflicts with a Runtime command. Rename its manifest entry.",
113
+ EXTRA_COMMAND_NOT_FOUND: "Unknown command. Use --help on the service command to see available subcommands.",
114
+ EXTRA_COMMAND_CANCELLED: "The command was cancelled. Any save that already completed remains persisted.",
115
+ EXTRA_COMMAND_STDIN_REQUIRED: "Pipe the required input through stdin; do not put credentials in command arguments.",
116
+ EXTRA_NOT_REGISTERED: "Save the service configuration using its configure or extraset subcommand before starting it.",
117
+ EXTRA_MANIFEST_DECLARATION_REQUIRED: "Install this Extra alongside the global Runtime, or add its name and module to the selected Home manifest.json (extras array), then retry.",
118
+ EXTRA_NAME_MISMATCH: "The selected Extra must export the same name as its catalog entry. Check the reported package origin.",
119
+ EXTRA_MODULE_LOAD_FAILED: "Check the selected catalog declaration, discovery diagnostics, installation and ESM exports; reinstall it or select a valid Home manifest entry, then retry.",
106
120
  EXTRA_MODULE_MIGRATION_REQUIRED: "The saved module differs from manifest.json. Review both declarations, then save matching module text or omit module from the Extra configuration.",
107
121
  MANIFEST_INVALID: "Check manifest.json: version must be 1 and adapters/extras must be valid arrays without duplicate keys.",
108
122
  MANAGER_UNAVAILABLE: "Run doctor and check the current user's native service manager.",
@@ -6,4 +6,9 @@ export interface PlayboardOptions {
6
6
  home?: string;
7
7
  profile?: string;
8
8
  }
9
+ /**
10
+ * CLI 单次执行入口:读取一个 InvokeInput,原生构造并拥有本次临时 Kernel,消费源帧后关闭。
11
+ * 返回执行退出码;关闭失败仍拒绝,并保留已发生的执行错误或非零结果,不能假报清理成功。
12
+ * Home/profile 属于调用者,仅删除本次创建的临时目录,不改变公共 SDK 调用合同。
13
+ */
9
14
  export declare function runPlayboard(options: PlayboardOptions): Promise<number>;
@@ -9,6 +9,11 @@ import { tmpdir } from "node:os";
9
9
  import { join } from "node:path";
10
10
  import { identifyInvokeInput, isHostTerminal, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
11
11
  import { INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
12
+ /**
13
+ * CLI 单次执行入口:读取一个 InvokeInput,原生构造并拥有本次临时 Kernel,消费源帧后关闭。
14
+ * 返回执行退出码;关闭失败仍拒绝,并保留已发生的执行错误或非零结果,不能假报清理成功。
15
+ * Home/profile 属于调用者,仅删除本次创建的临时目录,不改变公共 SDK 调用合同。
16
+ */
12
17
  export async function runPlayboard(options) {
13
18
  if (options.input.isTTY) {
14
19
  throw new Error("playboard requires a JSON request on stdin; use <<< '...JSON...' or < request.json");
@@ -46,6 +51,9 @@ export async function runPlayboard(options) {
46
51
  throw new Error("RUNTIME_CONFIGURATION_NOT_FOUND: request profile differs from --profile");
47
52
  input.runMetadata = { ...input.runMetadata, profile };
48
53
  const output = options.output ?? writeLine;
54
+ // Unix socket 的路径预算小于普通文件路径;固定短根,避免 TMPDIR 嵌套或中文路径超限。
55
+ // mkdtemp 创建本次独占的 0700 目录;常驻服务仍使用 Runtime Home,Windows 保留命名管道。
56
+ const temporary = await mkdtemp(join(process.platform === "win32" ? tmpdir() : "/tmp", "op-"));
49
57
  const controller = new AbortController();
50
58
  let interrupted = 0;
51
59
  const onInterrupt = () => {
@@ -64,7 +72,9 @@ export async function runPlayboard(options) {
64
72
  process.once("SIGINT", onInterrupt);
65
73
  process.once("SIGTERM", onTerminate);
66
74
  let kernel;
67
- const temporary = await mkdtemp(join(tmpdir(), "octo-playboard-"));
75
+ let outcome;
76
+ let primaryFailure;
77
+ let cleanupFailure;
68
78
  try {
69
79
  const paths = runtimePaths(home, profile);
70
80
  const manifest = await loadCliManifest(home, options.manifest);
@@ -101,25 +111,43 @@ export async function runPlayboard(options) {
101
111
  if (!("kind" in frame) && isTerminal(frame))
102
112
  exitCode = frame.type === "run.completed" ? 0 : frame.type === "run.cancelled" ? 130 : 1;
103
113
  }
104
- return interrupted || exitCode;
114
+ outcome = interrupted || exitCode;
105
115
  }
106
116
  catch (error) {
107
117
  if (interrupted)
108
- return interrupted;
109
- throw error;
118
+ outcome = interrupted;
119
+ else
120
+ primaryFailure = { error };
121
+ }
122
+ try {
123
+ await closeKernel(kernel);
124
+ await rm(temporary, { recursive: true, force: true });
125
+ }
126
+ catch (error) {
127
+ cleanupFailure = { error };
110
128
  }
111
129
  finally {
112
- try {
113
- await closeKernel(kernel);
114
- await rm(temporary, { recursive: true, force: true });
115
- }
116
- finally {
117
- if (!options.output)
118
- process.stdout.removeListener("error", onOutputError);
119
- process.removeListener("SIGINT", onInterrupt);
120
- process.removeListener("SIGTERM", onTerminate);
130
+ if (!options.output)
131
+ process.stdout.removeListener("error", onOutputError);
132
+ process.removeListener("SIGINT", onInterrupt);
133
+ process.removeListener("SIGTERM", onTerminate);
134
+ }
135
+ // 清理之后统一选择结果,避免 finally 的拒绝覆盖主结果。保留两个原始异常对象;
136
+ // 取消/失败已有帧不改写,清理失败仍非零退出,不返回原来的成功码。
137
+ if (cleanupFailure) {
138
+ const cleanupError = cleanupFailure.error;
139
+ const cleanupMessage = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
140
+ if (primaryFailure) {
141
+ const primary = primaryFailure.error;
142
+ throw new AggregateError([primary, cleanupError], `${primary instanceof Error ? primary.message : String(primary)}; cleanup: ${cleanupMessage}`, { cause: cleanupError });
121
143
  }
144
+ if (outcome !== undefined && outcome !== 0)
145
+ throw new AggregateError([cleanupError], `Playboard exited with code ${outcome}; cleanup: ${cleanupMessage}`, { cause: cleanupError });
146
+ throw cleanupError;
122
147
  }
148
+ if (primaryFailure)
149
+ throw primaryFailure.error;
150
+ return outcome ?? 1;
123
151
  }
124
152
  function writeLine(line) {
125
153
  return new Promise((resolve, reject) => {
@@ -1,6 +1,6 @@
1
1
  import { homedir } from "node:os";
2
2
  import { resolve } from "node:path";
3
- import { fileURLToPath } from "node:url";
3
+ import { cliEntrypoint } from "./cli-entrypoint.js";
4
4
  import { componentServiceId } from "@mininglamp-oss/octo-runtime-host-sdk";
5
5
  import { createServiceBackend } from "@mininglamp-oss/octo-runtime-cross-service";
6
6
  export function resolveServiceControl(options = {}) {
@@ -19,7 +19,7 @@ export function resolveServiceControl(options = {}) {
19
19
  description: `Octo Runtime ${component}`,
20
20
  command: resolve(options.nodeExecutable ?? process.execPath),
21
21
  args: [
22
- resolve(options.cliEntrypoint ?? fileURLToPath(new URL("./index.js", import.meta.url))),
22
+ resolve(options.cliEntrypoint ?? cliEntrypoint()),
23
23
  component,
24
24
  "run",
25
25
  "--home",