@mininglamp-oss/octo-runtime 1.1.9 → 1.1.11

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 (225) hide show
  1. package/README.md +2 -2
  2. package/apps/cli/README.md +1 -1
  3. package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.d.ts → apps/cli/dist/adapter-configuration.d.ts} +1 -0
  4. package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.js → apps/cli/dist/adapter-configuration.js} +1 -0
  5. package/apps/cli/dist/adapter-configurations.d.ts +1 -1
  6. package/apps/cli/dist/adapter-configurations.js +1 -1
  7. package/apps/cli/dist/adapters.d.ts +7 -0
  8. package/apps/cli/dist/adapters.js +77 -0
  9. package/apps/cli/dist/build-info.json +2 -2
  10. package/apps/cli/dist/command-tree.js +2 -3
  11. package/apps/cli/dist/extras.js +11 -1
  12. package/apps/cli/dist/help.js +1 -1
  13. package/apps/cli/dist/index.js +18 -1
  14. package/apps/cli/dist/main.d.ts +2 -0
  15. package/apps/cli/dist/main.js +67 -34
  16. package/apps/cli/dist/manifest.json +0 -5
  17. package/apps/cli/dist/module-manifest.js +21 -3
  18. package/apps/cli/dist/output.d.ts +19 -1
  19. package/apps/cli/dist/output.js +180 -33
  20. package/apps/cli/dist/playboard-interrupt.d.ts +6 -0
  21. package/apps/cli/dist/playboard-interrupt.js +86 -0
  22. package/apps/cli/dist/playboard.d.ts +2 -0
  23. package/apps/cli/dist/playboard.js +10 -11
  24. package/apps/cli/dist/state.d.ts +5 -2
  25. package/apps/cli/dist/state.js +48 -13
  26. package/dist/public/codex.d.ts +1 -0
  27. package/dist/public/codex.js +1 -0
  28. package/dist/public/executor-kernel.d.ts +4 -1
  29. package/dist/public/executor-kernel.js +2 -1
  30. package/dist/public/extra.d.ts +1 -1
  31. package/dist/public/host.d.ts +5 -0
  32. package/dist/public/host.js +2 -0
  33. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +20 -0
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -6
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +68 -253
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +11 -6
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +198 -52
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +58 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +650 -0
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +3 -0
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +15 -0
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +2 -0
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -0
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +25 -0
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +3 -0
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/reasoning.js +1 -2
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +1 -1
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +12 -30
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  65. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.d.ts +3 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.js +125 -0
  67. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.d.ts +1 -1
  68. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.js +1 -1
  69. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +7 -0
  70. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +77 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  72. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +2 -3
  73. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +11 -1
  74. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +1 -1
  75. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/index.js +18 -1
  76. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
  77. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +67 -34
  78. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +0 -5
  79. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +21 -3
  80. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +19 -1
  81. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +180 -33
  82. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.d.ts +6 -0
  83. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.js +86 -0
  84. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +2 -0
  85. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +10 -11
  86. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.d.ts +5 -2
  87. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -13
  88. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -24
  89. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +5 -0
  90. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.d.ts +30 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.js +199 -0
  92. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.d.ts +1 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.js +1 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.d.ts +10 -0
  95. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +465 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.d.ts +6 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.js +6 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.d.ts +4 -0
  99. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.js +5 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.d.ts +59 -0
  101. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.js +287 -0
  102. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.d.ts +1 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.js +1 -0
  104. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.d.ts +1 -0
  105. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.js +1 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.d.ts +21 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.js +138 -0
  108. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.d.ts +8 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.js +65 -0
  110. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.d.ts +82 -0
  111. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.js +371 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.d.ts +10 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.js +23 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.d.ts +72 -0
  115. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.js +10 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +54 -0
  117. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +1219 -0
  118. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +5988 -0
  119. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +56 -0
  120. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc-fixtures.json +53 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +538 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +116 -0
  123. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +4525 -0
  124. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +761 -0
  125. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +663 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +191 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  128. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +29 -21
  129. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +173 -14
  130. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  131. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +1 -30
  132. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +2 -199
  133. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +1 -8
  134. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -444
  135. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/endpoint.js +2 -0
  136. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.d.ts +17 -0
  137. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.js +21 -0
  138. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts +11 -9
  139. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +14 -3
  140. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +5 -7
  141. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +6 -7
  142. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.d.ts +1 -53
  143. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -280
  144. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +14 -13
  145. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +84 -187
  146. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.d.ts +5 -10
  147. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.js +4 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.d.ts +20 -0
  149. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.js +180 -0
  150. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -8
  151. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +75 -45
  152. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +9 -2
  153. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +60 -5
  154. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.d.ts +1 -0
  155. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.js +1 -0
  156. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.d.ts +1 -0
  157. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.js +1 -0
  158. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.d.ts +4 -0
  159. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.js +18 -0
  160. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +1 -10
  161. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +2 -23
  162. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.d.ts +2 -72
  163. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.js +2 -10
  164. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -12
  165. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +1 -1
  166. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/ports.d.ts +2 -2
  167. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  168. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +1 -1
  169. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/ports.d.ts +2 -2
  170. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  171. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.js +4 -4
  172. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-BVxePruX.js → index-BLMf2Etg.js} +1 -3
  173. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  174. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  175. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.d.ts +1 -1
  176. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +12 -5
  177. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.d.ts +5 -1
  178. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.js +9 -0
  179. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.d.ts +44 -0
  180. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.js +207 -0
  181. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +23 -3
  182. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.d.ts +27 -4
  183. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.js +133 -25
  184. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.d.ts +10 -3
  185. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.js +18 -4
  186. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.d.ts +5 -6
  187. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +33 -45
  188. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/identity.js +6 -0
  189. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +4 -0
  190. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +3 -0
  191. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +5 -4
  192. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +7 -0
  193. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +19 -15
  194. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +3 -1
  195. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +1 -0
  196. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.d.ts +5 -0
  197. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +65 -0
  198. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  199. package/package.json +33 -29
  200. package/packages/octo-runtime-protocol/schema/protocol.schema.json +42 -36
  201. package/apps/cli/dist/worker.js +0 -18
  202. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.d.ts +0 -63
  203. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.js +0 -846
  204. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +0 -54
  205. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +0 -154
  206. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +0 -15
  207. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.js +0 -18
  208. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.d.ts +0 -16
  209. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.js +0 -59
  210. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.d.ts +0 -6
  211. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.js +0 -88
  212. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.d.ts +0 -1
  213. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.js +0 -2
  214. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +0 -42
  215. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +0 -292
  216. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.d.ts +0 -64
  217. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +0 -674
  218. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.d.ts +0 -2
  219. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.js +0 -5
  220. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.d.ts +0 -10
  221. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +0 -96
  222. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +0 -15
  223. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +0 -279
  224. /package/{apps/cli/dist/worker.d.ts → node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.js} +0 -0
  225. /package/node_modules/@mininglamp-oss/{octo-runtime-cli/dist/worker.d.ts → octo-runtime-protocol/dist/adapter-metadata.js} +0 -0
@@ -1,13 +1,72 @@
1
1
  import { ServiceError } from "@mininglamp-oss/octo-runtime-cross-service";
2
2
  import { RuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
3
- import { open, readdir } from "node:fs/promises";
3
+ import { describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, safeStartupValue, startupPathDiagnostic, STARTUP_CATALOG } from "@mininglamp-oss/octo-runtime-executor-kernel";
4
+ import { constants } from "node:fs";
5
+ import { randomUUID } from "node:crypto";
6
+ import { open, readdir, mkdir, rename, rm, lstat } from "node:fs/promises";
4
7
  import { join } from "node:path";
8
+ /** doctor 仅投影已取得的常驻快照;同 PID 合并角色,层级表示所有权而非猜测 OS PPID。 */
9
+ export function residentProcesses(snapshots) {
10
+ const processes = [];
11
+ const pid = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : undefined;
12
+ const add = (entry) => {
13
+ const existing = entry.pid &&
14
+ processes.find((value) => value.pid === entry.pid &&
15
+ value.observation === "alive" &&
16
+ entry.observation === "alive" &&
17
+ value.owner_pid === entry.owner_pid &&
18
+ value.service_id === entry.service_id &&
19
+ value.incarnation === entry.incarnation);
20
+ if (existing)
21
+ existing.roles.push(...entry.roles.filter((role) => !existing.roles.includes(role)));
22
+ else
23
+ processes.push(entry);
24
+ };
25
+ for (const [name, snapshot] of Object.entries(snapshots)) {
26
+ const runtime = record(snapshot.runtime);
27
+ const actualPid = pid(runtime.pid);
28
+ const managedPid = pid(snapshot.service.pid);
29
+ add({
30
+ ...(actualPid || managedPid ? { pid: actualPid ?? managedPid } : {}),
31
+ roles: [name === "executor-kernel" ? "Host/Kernel" : `Extra:${name}`],
32
+ state: actualPid ? "running" : snapshot.service.state,
33
+ observation: actualPid ? "alive" : "unknown"
34
+ });
35
+ if (!Array.isArray(runtime.service_processes))
36
+ continue;
37
+ for (const value of runtime.service_processes.slice(0, 256)) {
38
+ const service = record(value);
39
+ add({
40
+ ...(pid(service.pid) ? { pid: pid(service.pid) } : {}),
41
+ owner_pid: pid(service.owner_pid),
42
+ roles: [`${text(service.provider)} app-server`],
43
+ state: text(service.state),
44
+ observation: text(service.observation),
45
+ service_id: text(service.service_id),
46
+ incarnation: typeof service.incarnation === "number" ? service.incarnation : undefined
47
+ });
48
+ }
49
+ }
50
+ return processes;
51
+ }
52
+ export function formatResidentProcesses(processes) {
53
+ const lines = ["Resident processes (ownership):"];
54
+ for (const entry of processes.filter((value) => !value.owner_pid)) {
55
+ lines.push(` ${entry.roles.join(", ")} PID ${entry.pid ?? "unknown"} ${entry.state} (${entry.observation})`);
56
+ for (const child of processes.filter((value) => entry.pid && value.owner_pid === entry.pid))
57
+ lines.push(` +-- ${child.roles.join(", ")} PID ${child.pid ?? "-"} ${child.state} (${child.observation}) incarnation ${child.incarnation ?? "-"} service ${child.service_id ?? "-"}`);
58
+ }
59
+ for (const entry of processes.filter((value) => value.owner_pid && !processes.some((parent) => parent.pid === value.owner_pid)))
60
+ lines.push(` ${entry.roles.join(", ")} PID ${entry.pid ?? "-"} ${entry.state} (${entry.observation}) owner PID ${entry.owner_pid}`);
61
+ return lines.join("\n");
62
+ }
5
63
  const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value)
6
64
  ? value
7
65
  : {};
8
66
  const text = (value) => String(value)
9
67
  .replace(/\p{Cc}/gu, " ")
10
68
  .slice(0, 200);
69
+ const stableCode = (value) => typeof value === "string" && /^[A-Z][A-Z0-9_]{1,100}$/.test(value) ? value : undefined;
11
70
  /** 展示公开状态的摘要,不为输出克隆完整 session/delivery 集合。JSON 模式保留原结果。 */
12
71
  export function formatStatus(name, snapshot) {
13
72
  const service = snapshot.service;
@@ -22,12 +81,7 @@ export function formatStatus(name, snapshot) {
22
81
  ` Manager: ${service.manager}${service.pid ? ` PID: ${service.pid}` : runtime.pid ? ` PID: ${text(runtime.pid)}` : ""}`
23
82
  ];
24
83
  if (runtime.execution_ready !== undefined)
25
- lines.push(` Worker: ${runtime.execution_ready ? "ready" : "unavailable"}`);
26
- const recovery = record(record(runtime.worker).recovery);
27
- if (recovery.code) {
28
- lines.push(` Recovery: ${text(recovery.stage)} (${text(recovery.code)})${recovery.retry_at ? ` Next retry: ${text(recovery.retry_at)}` : ""}`);
29
- lines.push(" Diagnostics: octo-runtime executor-kernel logs --follow (use the same --home)");
30
- }
84
+ lines.push(` Execution: ${runtime.execution_ready ? "ready" : "unavailable"}`);
31
85
  if (runtime.available === false)
32
86
  lines.push(` Reason: ${text(record(runtime.error).code ?? "COMPONENT_UNAVAILABLE")}`);
33
87
  if (service.lastExitCode !== undefined && service.lastExitCode !== 0)
@@ -92,26 +146,36 @@ export function formatStatus(name, snapshot) {
92
146
  return lines.join("\n");
93
147
  }
94
148
  /** 只保留受控错误码和管理器元信息;异常正文及任意 stderr 可能含凭据,不能直出。 */
95
- export function describeError(error, fallback = "COMMAND_FAILED") {
96
- const stableCode = (value) => typeof value === "string" && /^[A-Z][A-Z0-9_]{1,100}$/.test(value) ? value : undefined;
97
- const value = record(error);
98
- const code = stableCode(value.code) ??
99
- (error instanceof Error ? stableCode(error.message) : undefined) ??
149
+ export function describeError(error, fallback = "COMMAND_FAILED", startup) {
150
+ const field = (value, key) => {
151
+ try {
152
+ return value !== null && typeof value === "object"
153
+ ? Object.getOwnPropertyDescriptor(value, key)?.value
154
+ : undefined;
155
+ }
156
+ catch {
157
+ return undefined;
158
+ }
159
+ };
160
+ const code = stableCode(field(error, "code")) ??
161
+ (error instanceof Error ? stableCode(field(error, "message")) : undefined) ??
100
162
  fallback;
101
- const cause = record(value.cause);
102
- const causeCode = stableCode(cause.code) ?? stableCode(cause.message);
163
+ const cause = field(error, "cause");
164
+ const causeCode = stableCode(field(cause, "code")) ?? stableCode(field(cause, "message"));
165
+ const projection = describeStartupError(error, startup);
166
+ const pathDiagnostic = startupPathDiagnostic(projection);
167
+ const diagnostic = startup ||
168
+ pathDiagnostic ||
169
+ field(field(error, "diagnostic"), "domain") === "startup" ||
170
+ projection.causes.some((cause) => cause.component && cause.phase)
171
+ ? projection
172
+ : undefined;
103
173
  const hints = {
104
174
  COMMAND_FAILED: "The command failed. Check the native manager, configuration and service logs.",
105
- ENOENT: "The component endpoint or required file does not exist. Check installation and service status.",
106
- ECONNREFUSED: "The component is not accepting IPC connections. Check its process and logs.",
107
175
  KERNEL_UNAVAILABLE: "Kernel is unavailable. Check executor-kernel status; Extras can remain running.",
108
176
  INVALID_ARGUMENTS: "Use --help to see the available commands and flags.",
109
- SETUP_IN_PROGRESS: "Another component lifecycle operation is in progress. Wait for it to finish, then retry.",
110
- 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.",
111
177
  ORPHAN_CLEANUP_OWNER_ALIVE: "The original Kernel or worker is still alive or its identity cannot be verified. Stop it safely before acknowledging cleanup.",
112
178
  ORPHAN_CLEANUP_NOT_PENDING: "There is no valid incomplete orphan cleanup to acknowledge. Run doctor with the same --home.",
113
- SERVICE_NOT_INSTALLED: "Run this component's install command, then start it.",
114
- NOT_INSTALLED: "Run this component's install command, then start it.",
115
179
  EXTRA_COMMAND_FAILED: "The Extra command failed. No private backend error is printed; check its input and configuration, then retry.",
116
180
  EXTRA_CONFIG_CONFLICT: "Configuration changed after this command read it. Read the latest configuration and retry.",
117
181
  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.",
@@ -121,33 +185,75 @@ export function describeError(error, fallback = "COMMAND_FAILED") {
121
185
  EXTRA_COMMAND_NOT_FOUND: "Unknown command. Use --help on the service command to see available subcommands.",
122
186
  EXTRA_COMMAND_CANCELLED: "The command was cancelled. Any save that already completed remains persisted.",
123
187
  EXTRA_COMMAND_STDIN_REQUIRED: "Pipe the required input through stdin; do not put credentials in command arguments.",
124
- EXTRA_NOT_REGISTERED: "Save the service configuration using its configure or extraset subcommand before starting it.",
125
188
  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.",
126
- EXTRA_NAME_MISMATCH: "The selected Extra must export the same name as its catalog entry. Check the reported package origin.",
127
- 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.",
128
- 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.",
129
- MANIFEST_INVALID: "Check manifest.json: version must be 1 and adapters/extras must be valid arrays without duplicate keys.",
130
- MANAGER_UNAVAILABLE: "Run doctor and check the current user's native service manager.",
131
- COMPONENT_UNAVAILABLE: "Check component status and the service logs; the IPC or worker is not ready.",
132
- SERVICE_PROCESS_EXITED: "The service exited unexpectedly. Check its logs and configuration.",
133
- SERVICE_INITIALIZATION_FAILED: "Check the component configuration, manifest and service logs.",
134
- SERVICE_DISABLED: "Enable this component with install --autostart=true, then start it."
189
+ 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."
135
190
  };
136
191
  return {
137
192
  code,
138
- message: hints[code] ?? "Check --help, component status and service logs for this operation.",
193
+ message: diagnostic?.explanation ??
194
+ STARTUP_CATALOG[code]?.action ??
195
+ hints[code] ??
196
+ "Check --help, component status and service logs for this operation.",
139
197
  ...(causeCode ? { cause_code: causeCode } : {}),
198
+ ...(diagnostic ? { diagnostic } : {}),
199
+ ...(pathDiagnostic
200
+ ? { startup: pathDiagnostic, ...(diagnostic?.cleanup ? { cleanup: diagnostic.cleanup } : {}) }
201
+ : {}),
140
202
  ...(error instanceof ServiceError
141
- ? { backend: error.backend, command: error.command, exit_code: error.exitCode }
203
+ ? {
204
+ backend: error.backend,
205
+ command: typeof error.command === "string" ? safeStartupValue(error.command) : undefined,
206
+ exit_code: error.exitCode
207
+ }
142
208
  : {})
143
209
  };
144
210
  }
211
+ /** 保留兼容 code/cause_code;共享启动结构决定动态解释与下一步。 */
212
+ export function formatErrorDetails(failure) {
213
+ return failure.diagnostic ? formatStartupDiagnostic(failure.diagnostic) : failure.message;
214
+ }
145
215
  /** 前台启动失败沿既有白名单和小时轮转落盘;不捕获任意进程 stdout/stderr。 */
146
216
  export async function recordStartupFailure(directory, component, error) {
217
+ if (!/^[a-z][a-z0-9-]{0,63}$/.test(component))
218
+ return;
219
+ // Home 校验失败不得由诊断日志递归补建根目录(#306)。
220
+ if (startupPathDiagnostic(describeStartupError(error)))
221
+ return;
147
222
  const logging = new RuntimeLogging({ directory });
148
223
  try {
149
- const log = component === "executor-kernel" ? logging.kernel : logging.extra(component);
224
+ // 单份最近失败记录拥有独立有界文件;不放宽通用日志的配置/异常白名单。
225
+ const diagnostic = describeStartupError(error, { component, phase: "initializing" });
150
226
  const failure = describeError(error, "SERVICE_INITIALIZATION_FAILED");
227
+ const file = join(directory, `startup-${component}.json`);
228
+ const temporary = `${file}.${randomUUID()}.tmp`;
229
+ try {
230
+ const line = JSON.stringify({
231
+ schema_version: 1,
232
+ time: new Date().toISOString(),
233
+ component,
234
+ code: failure.code,
235
+ ...(failure.cause_code ? { cause_code: failure.cause_code } : {}),
236
+ diagnostic
237
+ });
238
+ if (Buffer.byteLength(line) <= 262144) {
239
+ await mkdir(directory, { recursive: true, mode: 0o700 });
240
+ const handle = await open(temporary, "wx", 0o600);
241
+ try {
242
+ await handle.writeFile(line);
243
+ }
244
+ finally {
245
+ await handle.close();
246
+ }
247
+ await rename(temporary, file);
248
+ }
249
+ }
250
+ catch {
251
+ // 诊断落盘失败不能覆盖原始启动/清理错误,调用方仍持有完整安全投影。
252
+ }
253
+ finally {
254
+ await rm(temporary, { force: true }).catch(() => undefined);
255
+ }
256
+ const log = component === "executor-kernel" ? logging.kernel : logging.extra(component);
151
257
  if (failure.cause_code)
152
258
  log("error", "cli.initialization_cause", { code: failure.cause_code });
153
259
  log("error", "cli.initialization_failed", { code: failure.code });
@@ -158,6 +264,47 @@ export async function recordStartupFailure(directory, component, error) {
158
264
  }
159
265
  /** 只读本次 start 后的白名单失败事件;每个轮转文件最多读取末尾 64 KiB。 */
160
266
  export async function readStartupFailure(directory, component, since) {
267
+ if (!/^[a-z][a-z0-9-]{0,63}$/.test(component))
268
+ return undefined;
269
+ try {
270
+ const file = await open(join(directory, `startup-${component}.json`), constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
271
+ try {
272
+ const stat = await file.stat();
273
+ if (!constants.O_NOFOLLOW) {
274
+ const entry = await lstat(join(directory, `startup-${component}.json`));
275
+ if (!entry.isFile() || entry.dev !== stat.dev || entry.ino !== stat.ino)
276
+ return undefined;
277
+ }
278
+ if (stat.isFile() && stat.size <= 262144) {
279
+ const bytes = Buffer.alloc(262145);
280
+ let length = 0;
281
+ while (length < bytes.length) {
282
+ const { bytesRead } = await file.read(bytes, length, bytes.length - length, null);
283
+ if (!bytesRead)
284
+ break;
285
+ length += bytesRead;
286
+ }
287
+ if (length > 262144)
288
+ return undefined;
289
+ const row = record(JSON.parse(bytes.subarray(0, length).toString("utf8")));
290
+ if (row.schema_version === 1 &&
291
+ row.component === component &&
292
+ typeof row.time === "string" &&
293
+ Date.parse(row.time) >= since) {
294
+ const diagnostic = restoreStartupDiagnostic(row.diagnostic);
295
+ const code = stableCode(row.code), causeCode = stableCode(row.cause_code);
296
+ if (diagnostic && code)
297
+ return Object.assign(new Error(code, causeCode ? { cause: new Error(causeCode) } : undefined), { diagnostic });
298
+ }
299
+ }
300
+ }
301
+ finally {
302
+ await file.close();
303
+ }
304
+ }
305
+ catch {
306
+ // 缺失、损坏或旧版本记录继续走既有白名单日志,不影响真实就绪等待。
307
+ }
161
308
  const root = component === "executor-kernel" ? directory : join(directory, "extras");
162
309
  const prefix = component === "executor-kernel" ? "kernel-" : `${component}-`;
163
310
  try {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 仅 CLI 可执行入口在确认 playboard 命令后安装,监听持续到本进程退出。
3
+ * 人工停止不等待 import、Run 终态或 Kernel close;SDK 不使用此策略。
4
+ * 命令返回但清理失败时仍须能停止残留进程树;信号监听本身不维持事件循环。
5
+ */
6
+ export declare function installPlayboardInterrupt(): void;
@@ -0,0 +1,86 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { writeSync } from "node:fs";
3
+ /**
4
+ * 仅 CLI 可执行入口在确认 playboard 命令后安装,监听持续到本进程退出。
5
+ * 人工停止不等待 import、Run 终态或 Kernel close;SDK 不使用此策略。
6
+ * 命令返回但清理失败时仍须能停止残留进程树;信号监听本身不维持事件循环。
7
+ */
8
+ export function installPlayboardInterrupt() {
9
+ let stopping = false;
10
+ const stop = (code) => {
11
+ if (stopping)
12
+ return;
13
+ stopping = true;
14
+ diagnostic("PLAYBOARD_FORCE_STOP: execution and cleanup are unconfirmed");
15
+ try {
16
+ if (process.platform === "win32") {
17
+ // 保持 leader 存活,由系统按 PID 回收树;不能先退出再查找后代。
18
+ execFileSync("taskkill.exe", ["/PID", String(process.pid), "/T", "/F"], {
19
+ stdio: "ignore",
20
+ windowsHide: true,
21
+ timeout: 2000
22
+ });
23
+ }
24
+ else {
25
+ // Adapter 可创建独立组,不能只杀当前组,更不能按 node/应用名匹配。
26
+ // 选择本次 CLI 的可识别后代,先杀最深层再退出自身,不触及兄弟服务。
27
+ const listing = execFileSync("/bin/ps", ["-axo", "pid=,ppid="], {
28
+ encoding: "utf8",
29
+ timeout: 2000,
30
+ maxBuffer: 8 * 1024 * 1024
31
+ });
32
+ const children = new Map();
33
+ for (const line of listing.split("\n")) {
34
+ const match = /^\s*(\d+)\s+(\d+)\s*$/.exec(line);
35
+ if (!match)
36
+ continue;
37
+ const pid = Number(match[1]), parent = Number(match[2]);
38
+ if (pid <= 1 || pid === process.pid)
39
+ continue;
40
+ const group = children.get(parent) ?? [];
41
+ group.push(pid);
42
+ children.set(parent, group);
43
+ }
44
+ const owned = [process.pid];
45
+ const seen = new Set(owned);
46
+ for (let i = 0; i < owned.length; i++)
47
+ for (const pid of children.get(owned[i]) ?? [])
48
+ if (!seen.has(pid)) {
49
+ seen.add(pid);
50
+ owned.push(pid);
51
+ }
52
+ let failed = false;
53
+ for (const pid of owned.slice(1).reverse()) {
54
+ try {
55
+ process.kill(pid, "SIGKILL");
56
+ }
57
+ catch (error) {
58
+ if (error.code !== "ESRCH")
59
+ failed = true;
60
+ }
61
+ }
62
+ if (failed)
63
+ diagnostic("PLAYBOARD_TREE_STOP_UNCONFIRMED");
64
+ }
65
+ }
66
+ catch {
67
+ // 查询/终止失败不能继续吞掉人工退出;不声称未知或已重新归属的后代已停止。
68
+ diagnostic("PLAYBOARD_TREE_STOP_UNCONFIRMED");
69
+ }
70
+ finally {
71
+ process.exit(code);
72
+ }
73
+ };
74
+ const interrupt = () => stop(130);
75
+ const terminate = () => stop(143);
76
+ process.on("SIGINT", interrupt);
77
+ process.on("SIGTERM", terminate);
78
+ }
79
+ function diagnostic(message) {
80
+ try {
81
+ writeSync(2, `${message}\n`);
82
+ }
83
+ catch {
84
+ // stderr 已关闭时仍执行定向强退。
85
+ }
86
+ }
@@ -1,4 +1,6 @@
1
1
  export interface PlayboardOptions {
2
+ /** CLI 可执行入口已接管强退时关闭本函数的协作信号监听;不在此退出宿主。 */
3
+ handleSignals?: boolean;
2
4
  input: NodeJS.ReadableStream;
3
5
  output?: (line: string) => void | Promise<void>;
4
6
  env?: NodeJS.ProcessEnv;
@@ -1,9 +1,8 @@
1
+ import { loadCliAdapters } from "./adapters.js";
1
2
  import { defaultRuntimeHome, runtimePaths, readJsonFile } from "./state.js";
2
3
  import { loadCliManifest } from "./module-manifest.js";
3
4
  import { readCliAdapterConfigurations } from "./adapter-configurations.js";
4
- import { resolveAdapterModules } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
5
5
  import { createKernelService } from "@mininglamp-oss/octo-runtime-executor-kernel";
6
- import { fileURLToPath } from "node:url";
7
6
  import { componentEndpoint } from "@mininglamp-oss/octo-runtime-host-sdk";
8
7
  import { mkdtemp, rm } from "node:fs/promises";
9
8
  import { tmpdir } from "node:os";
@@ -76,8 +75,10 @@ export async function runPlayboard(options) {
76
75
  };
77
76
  if (!options.output)
78
77
  process.stdout.on("error", onOutputError);
79
- process.once("SIGINT", onInterrupt);
80
- process.once("SIGTERM", onTerminate);
78
+ if (options.handleSignals !== false) {
79
+ process.once("SIGINT", onInterrupt);
80
+ process.once("SIGTERM", onTerminate);
81
+ }
81
82
  let kernel;
82
83
  let outcome;
83
84
  let primaryFailure;
@@ -87,14 +88,12 @@ export async function runPlayboard(options) {
87
88
  const manifest = await loadCliManifest(home, options.manifest);
88
89
  const configuration = await readJsonFile(paths.profileConfig);
89
90
  kernel = createKernelService({
91
+ home: temporary,
90
92
  endpoint: process.platform === "win32" ? componentEndpoint(temporary) : join(temporary, "k.sock"),
91
- workerEntrypoint: fileURLToPath(new URL("./worker.js", import.meta.url)),
92
- adapterModules: resolveAdapterModules(manifest),
93
- env: {
94
- ...(options.env ?? process.env),
95
- OCTO_RUNTIME_CLI_PROFILE_ROOT: paths.profileRoot,
96
- OCTO_RUNTIME_CLI_SYNC_OPENCLAW_TOOLS: "0"
97
- },
93
+ adapters: await loadCliAdapters(manifest.adapters, {
94
+ profileRoot: paths.profileRoot,
95
+ syncOpenClawTools: false
96
+ }),
98
97
  adapterConfigurations: await readCliAdapterConfigurations(paths.profileRoot, configuration?.adapters, manifest, options.env ?? process.env)
99
98
  });
100
99
  await kernel.initialize({ signal: controller.signal });
@@ -49,10 +49,13 @@ export interface RuntimePaths {
49
49
  openclawRoot: string;
50
50
  setupLock: string;
51
51
  pid: string;
52
- socket: string;
53
52
  logs: string;
54
53
  }
55
- export declare function defaultRuntimeHome(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
54
+ export declare function defaultRuntimeHome(env?: NodeJS.ProcessEnv): string;
55
+ /** CLI 明确接受相对 --home 并转为绝对路径;不展开 ~,空值必须失败。 */
56
+ export declare function selectRuntimeHome(input: string | undefined, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
57
+ /** 根目录只由 CLI 准备;先检查完整预算,创建失败保留原 path/errno,不换根。 */
58
+ export declare function prepareRuntimeHome(home: string): Promise<void>;
56
59
  export declare function runtimePaths(home: string, profile: string, platform?: NodeJS.Platform): RuntimePaths;
57
60
  /** Call under the Home setup lock; this label is shared by all profiles, not an authentication key. */
58
61
  export declare function ensureMachineIdentity(paths: RuntimePaths): Promise<MachineIdentity>;
@@ -2,12 +2,17 @@ import { createHash, randomUUID } from "node:crypto";
2
2
  import { access, chmod, link, mkdir, open, readFile, rename, rm, rmdir } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { basename, dirname, join, resolve } from "node:path";
5
- import { componentEndpoint } from "@mininglamp-oss/octo-runtime-host-sdk";
5
+ import { componentEndpoint, normalizeRuntimeHome, assertRuntimePath, runtimePathFailure, validateRuntimeHome } from "@mininglamp-oss/octo-runtime-host-sdk";
6
+ import { withStartupContext } from "@mininglamp-oss/octo-runtime-executor-kernel";
6
7
  const PROFILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
7
8
  const RESERVED_PROFILE_NAMES = new Set([
8
9
  "config.json",
9
10
  "credentials",
10
11
  "extras",
12
+ "executor-kernel.sock",
13
+ "executor-kernel.sock.owner",
14
+ "executor-kernel.sock.owner.recovery",
15
+ "executor-kernel.sock.runs",
11
16
  "identity",
12
17
  "machine.json",
13
18
  "logs",
@@ -18,20 +23,43 @@ const RESERVED_PROFILE_NAMES = new Set([
18
23
  "sockets",
19
24
  "state.db"
20
25
  ]);
21
- export function defaultRuntimeHome(env = process.env, platform = process.platform) {
22
- if (env.OCTO_RUNTIME_HOME?.trim())
23
- return resolve(env.OCTO_RUNTIME_HOME.trim());
24
- if (platform === "win32") {
25
- const localAppData = env.LOCALAPPDATA?.trim();
26
- if (localAppData)
27
- return resolve(localAppData, "OctoRuntime");
26
+ export function defaultRuntimeHome(env = process.env) {
27
+ return normalizeRuntimeHome(join(env.HOME?.trim() || homedir(), ".octo-runtime"));
28
+ }
29
+ /** CLI 明确接受相对 --home 并转为绝对路径;不展开 ~,空值必须失败。 */
30
+ export function selectRuntimeHome(input, env, platform = process.platform) {
31
+ if (input === undefined)
32
+ return normalizeRuntimeHome(defaultRuntimeHome(env), platform);
33
+ if (typeof input !== "string" || !input.trim() || input.startsWith("~"))
34
+ return normalizeRuntimeHome(input, platform);
35
+ return normalizeRuntimeHome(resolve(input), platform);
36
+ }
37
+ /** 根目录只由 CLI 准备;先检查完整预算,创建失败保留原 path/errno,不换根。 */
38
+ export async function prepareRuntimeHome(home) {
39
+ const selected = normalizeRuntimeHome(home);
40
+ componentEndpoint(selected);
41
+ assertRuntimePath(join(selected, "run", `kernel-invocations.json.acknowledged.${"0".repeat(36)}.json`), "kernel-state");
42
+ try {
43
+ await mkdir(selected, { recursive: true, mode: 0o700 });
28
44
  }
29
- return resolve(env.HOME?.trim() || homedir(), ".octo-runtime");
45
+ catch (error) {
46
+ if (isNodeError(error, "EEXIST"))
47
+ validateRuntimeHome(selected);
48
+ throw runtimePathFailure(error, selected, "home", "mkdir");
49
+ }
50
+ validateRuntimeHome(selected);
30
51
  }
31
52
  export function runtimePaths(home, profile, platform = process.platform) {
32
53
  assertProfileName(profile);
33
- const absoluteHome = resolve(home);
54
+ const absoluteHome = normalizeRuntimeHome(home, platform);
34
55
  const profileRoot = join(absoluteHome, profile);
56
+ // CLI 的身份/锁原子写另有后缀,不可只检查 Home 或 hash pipe 的短地址。
57
+ for (const path of [
58
+ join(profileRoot, "credentials", `runtime-token.json.${"0".repeat(10)}.${"0".repeat(36)}.tmp`),
59
+ join(absoluteHome, "run", `kernel-invocations.json.acknowledged.${"0".repeat(36)}.json`),
60
+ join(absoluteHome, "run", `.reclaim-${"0".repeat(64)}.${"0".repeat(10)}.${"0".repeat(36)}.tmp`)
61
+ ])
62
+ assertRuntimePath(path, "cli-state", platform);
35
63
  return {
36
64
  home: absoluteHome,
37
65
  rootConfig: join(absoluteHome, "config.json"),
@@ -43,7 +71,6 @@ export function runtimePaths(home, profile, platform = process.platform) {
43
71
  openclawRoot: join(profileRoot, "adapters", "openclaw"),
44
72
  setupLock: join(absoluteHome, "run", "setup.lock"),
45
73
  pid: join(absoluteHome, "run", "executor-kernel.pid"),
46
- socket: componentEndpoint(absoluteHome, "executor-kernel", platform),
47
74
  logs: join(absoluteHome, "logs")
48
75
  };
49
76
  }
@@ -141,8 +168,16 @@ export async function readJsonFile(path) {
141
168
  if (isNodeError(error, "ENOENT"))
142
169
  return undefined;
143
170
  if (error instanceof SyntaxError)
144
- throw new Error(`invalid JSON file: ${path}`, { cause: error });
145
- throw error;
171
+ throw withStartupContext(new Error(`invalid JSON file: ${path}`, { cause: error }), {
172
+ component: "cli",
173
+ phase: "created",
174
+ context: { path, resource: "configuration", operation: "read-json" }
175
+ }, "LOCAL_STATE_INVALID");
176
+ throw withStartupContext(error, {
177
+ component: "cli",
178
+ phase: "created",
179
+ context: { path, resource: "configuration", operation: "read" }
180
+ });
146
181
  }
147
182
  }
148
183
  export async function writeJsonAtomic(path, value) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cli",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,29 +9,28 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "dependencies": {
11
11
  "commander": "15.0.0",
12
- "@mininglamp-oss/octo-runtime-adapter-dsh": "1.1.9",
13
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.9",
12
+ "@mininglamp-oss/octo-runtime-adapter-dsh": "1.1.11",
13
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.11",
14
14
  "json5": "2.2.3",
15
- "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.9",
16
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.9",
17
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.9",
18
- "@mininglamp-oss/octo-runtime-cross-service": "1.1.9",
19
- "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
20
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.9",
21
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.9",
22
- "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.9",
23
- "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.9",
24
- "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.9",
25
- "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.9",
26
- "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.9",
27
- "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.9",
28
- "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.9",
29
- "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.9",
30
- "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.9",
31
- "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.9",
32
- "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.9",
33
- "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.9",
34
- "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.9",
35
- "@mininglamp-oss/octo-runtime-extra-webui": "1.1.9"
15
+ "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.11",
16
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.11",
17
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.11",
18
+ "@mininglamp-oss/octo-runtime-cross-service": "1.1.11",
19
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.11",
20
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.11",
21
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.11",
22
+ "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.11",
23
+ "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.11",
24
+ "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.11",
25
+ "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.11",
26
+ "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.11",
27
+ "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.11",
28
+ "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.11",
29
+ "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.11",
30
+ "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.11",
31
+ "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.11",
32
+ "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.11",
33
+ "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.11",
34
+ "@mininglamp-oss/octo-runtime-extra-webui": "1.1.11"
36
35
  }
37
36
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "commit": "780cd7cd5e67e4868df895a2e74a826097f349fd",
3
+ "dirty": false,
4
+ "buildTime": "2026-11-05T06:19:50.356Z"
5
+ }
@@ -0,0 +1,30 @@
1
+ import { type AsyncQuestionReplySnapshot, type CanonicalEvent, type HostFrame, type InvokeEnvironment, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
2
+ import { type KernelClient } from "./types.js";
3
+ export type AsyncQuestionReplyResult = {
4
+ route: "steer";
5
+ acceptance: "provider_accepted";
6
+ } | {
7
+ route: "new_run";
8
+ input: InvokeInput;
9
+ events: AsyncGenerator<CanonicalEvent>;
10
+ };
11
+ /**
12
+ * 宿主持有的一份旁路问题控制者,不拥有 Kernel 或数据库。
13
+ * 活动时 steer,确认正常完成后复用 invoke;宿主须串行管理同会话、
14
+ * 保存提交状态并消费新 Run 尾流。新流返回不代表 Provider 接纳。
15
+ */
16
+ export declare class AsyncQuestionReply {
17
+ #private;
18
+ readonly client: KernelClient;
19
+ readonly continuation: () => InvokeInput;
20
+ readonly environment?: InvokeEnvironment | undefined;
21
+ constructor(client: KernelClient, snapshot: AsyncQuestionReplySnapshot, continuation: () => InvokeInput, environment?: InvokeEnvironment | undefined);
22
+ /** 独立 JSON 副本供宿主保存;恢复 submitting/unknown 不会再次投递。 */
23
+ snapshot(): AsyncQuestionReplySnapshot;
24
+ /** 只接受原源流事实;消息 final 或查不到 Run 不能证明正常完成。 */
25
+ observe(frame: HostFrame): void;
26
+ /** 关闭旁路,不中断模型;原活动交互同步关闭,未知响应不重试。 */
27
+ cancel(): Promise<void>;
28
+ /** 整批一次。steer 等待 Provider ACK;new_run 必须消费返回流,沿原 invoke 管理执行。 */
29
+ respond(value: unknown): Promise<AsyncQuestionReplyResult>;
30
+ }