@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,444 +1,2 @@
1
- import net from "node:net";
2
- import { randomUUID } from "node:crypto";
3
- import { assertHostFrame, assertHostFrameIdentity, assertHostRunReceipt, createInputInvoke, identifyInvokeInput, isHostTerminal, HOST_RPC_MAX_LINE_BYTES, INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
4
- import { KernelError } from "./types.js";
5
- import { InvocationRegistry } from "./invocation-lifecycle.js";
6
- import { markSubmissionRejected } from "./submission-error.js";
7
- /**
8
- * 连接本机 socket/Windows Pipe,返回不拥有 Kernel 进程的客户端。
9
- * invoke 提供登记、取消和尾流观察;关闭连接或迭代器不会隐式取消已接纳 Run。
10
- */
11
- export function attachKernel(options) {
12
- const sockets = new Set();
13
- let closed = false;
14
- const open = async (signal, timeout = 5000) => {
15
- if (closed)
16
- throw new KernelError("CLIENT_CLOSED");
17
- if (sockets.size >= 32)
18
- throw new KernelError("CLIENT_CAPACITY_EXHAUSTED");
19
- signal?.throwIfAborted();
20
- const socket = net.createConnection(options.endpoint);
21
- sockets.add(socket);
22
- socket.once("close", () => sockets.delete(socket));
23
- socket.on("error", () => { });
24
- const abort = () => socket.destroy(new KernelError("SUBSCRIPTION_ABORTED"));
25
- signal?.addEventListener("abort", abort, { once: true });
26
- socket.once("close", () => signal?.removeEventListener("abort", abort));
27
- await new Promise((resolve, reject) => {
28
- const finish = (error) => {
29
- clearTimeout(timer);
30
- socket.off("connect", connected);
31
- socket.off("error", failed);
32
- socket.off("close", disconnected);
33
- if (error)
34
- reject(error);
35
- else
36
- resolve();
37
- };
38
- const connected = () => finish();
39
- const failed = (error) => finish(error);
40
- const disconnected = () => finish(new KernelError(closed ? "CLIENT_CLOSED" : "CONNECTION_CLOSED"));
41
- const timer = setTimeout(() => {
42
- socket.destroy();
43
- finish(new KernelError("KERNEL_UNAVAILABLE"));
44
- }, Math.min(5000, timeout));
45
- socket.once("connect", connected);
46
- socket.once("error", failed);
47
- socket.once("close", disconnected);
48
- }).catch(() => {
49
- socket.destroy();
50
- throw new KernelError(closed ? "CLIENT_CLOSED" : "KERNEL_UNAVAILABLE");
51
- });
52
- return socket;
53
- };
54
- const exchange = async (method, params = {}, timeout = 5000, signal, beforeSend, sent) => {
55
- const until = Date.now() + timeout;
56
- const socket = await open(signal, timeout);
57
- const timer = setTimeout(() => socket.destroy(new KernelError("KERNEL_TIMEOUT")), Math.max(1, until - Date.now()));
58
- const id = randomUUID();
59
- try {
60
- signal?.throwIfAborted();
61
- beforeSend?.();
62
- send(socket, id, method, params);
63
- sent?.();
64
- for await (const value of lines(socket))
65
- return response(value, id);
66
- throw new KernelError(closed ? "CLIENT_CLOSED" : "CONNECTION_CLOSED");
67
- }
68
- catch (error) {
69
- if (closed)
70
- throw new KernelError("CLIENT_CLOSED");
71
- throw error;
72
- }
73
- finally {
74
- clearTimeout(timer);
75
- socket.destroy();
76
- }
77
- };
78
- const query = async (key, expectedInstance, deadline = Date.now() + 5000, signal) => {
79
- const info = (await exchange("agent_run.get", {
80
- key: lookupForKey(key),
81
- kernel_instance_id: expectedInstance
82
- }, remaining(deadline), signal));
83
- assertHostRunReceipt(receiptFor(info.ref));
84
- if (expectedInstance !== undefined && info.ref.kernel_instance_id !== expectedInstance)
85
- throw new KernelError("KERNEL_INSTANCE_CHANGED");
86
- if (!sameLookup(info.ref, key))
87
- throw new KernelError("RUN_IDENTITY_MISMATCH");
88
- if (info.terminal) {
89
- assertHostFrame(info.terminal);
90
- assertHostFrameIdentity(info.terminal, receiptFor(info.ref));
91
- if (!isHostTerminal(info.terminal))
92
- throw new KernelError("HOST_FRAME_INVALID");
93
- }
94
- registry.reconcile(info.ref, info.terminal);
95
- return info;
96
- };
97
- const cancel = async (ref, reason, deadline = Date.now() + 5000, signal) => {
98
- try {
99
- const result = (await exchange("agent_run.cancel", { ref, reason }, remaining(deadline), signal));
100
- if (typeof result?.accepted !== "boolean")
101
- throw new KernelError("OPERATION_OUTCOME_UNKNOWN");
102
- return result;
103
- }
104
- catch (error) {
105
- if (error instanceof KernelError &&
106
- !["CONNECTION_CLOSED", "KERNEL_TIMEOUT", "SUBSCRIPTION_ABORTED"].includes(error.code))
107
- throw error;
108
- throw new KernelError("OPERATION_OUTCOME_UNKNOWN");
109
- }
110
- };
111
- const registry = new InvocationRegistry({ get: query, cancel });
112
- const control = async (method, params) => {
113
- try {
114
- await exchange(method, params);
115
- }
116
- catch (error) {
117
- if (error instanceof KernelError &&
118
- !["CONNECTION_CLOSED", "KERNEL_TIMEOUT"].includes(error.code))
119
- throw error;
120
- throw new KernelError("OPERATION_OUTCOME_UNKNOWN");
121
- }
122
- };
123
- const client = {
124
- topology: "kernel-ipc",
125
- ownership: "attached",
126
- invocations: registry,
127
- invoke: createInputInvoke(async function* (input, environment = {}) {
128
- if (closed)
129
- throw new KernelError("CLIENT_CLOSED");
130
- environment.signal?.throwIfAborted();
131
- const request = identifyInvokeInput(input);
132
- const record = registry.begin(lookupFor(request));
133
- // signal 属于执行控制,不传给 subscribe:取消后仍须读到 Provider 会话更新与真实终态。
134
- const abort = () => {
135
- void registry.cancel(record, "caller_aborted").catch(() => undefined);
136
- };
137
- environment.signal?.addEventListener("abort", abort, { once: true });
138
- try {
139
- let ref;
140
- try {
141
- ref = (await submit(request, environment, record)).ref;
142
- registry.accepted(record, ref);
143
- }
144
- catch (error) {
145
- registry.rejected(record, error);
146
- throw error;
147
- }
148
- // 终态会释放登记,但 yield 后的业务持久化/投递仍由消费者负责,owner 不能据此提前 close。
149
- let terminal = false;
150
- for await (const frame of client.subscribe(ref)) {
151
- terminal = isHostTerminal(frame);
152
- if (request.protocol_mode === "canonical" &&
153
- frame.kind === "control" &&
154
- frame.control.type === "error") {
155
- const snapshot = await query(ref, ref.kernel_instance_id).catch(() => undefined);
156
- if (snapshot?.terminal?.kind === "control" &&
157
- snapshot.terminal.control.type === "state" &&
158
- snapshot.terminal.control.state === "lost")
159
- throw new KernelError("RUN_OUTCOME_UNKNOWN");
160
- }
161
- yield frame;
162
- if (terminal &&
163
- frame.kind === "control" &&
164
- frame.control.type === "state" &&
165
- frame.control.state === "lost")
166
- throw new KernelError("RUN_OUTCOME_UNKNOWN");
167
- }
168
- if (!terminal)
169
- throw new KernelError("HOST_ENDED_WITHOUT_TERMINAL");
170
- if (record.cancelTask)
171
- await record.cancelTask;
172
- }
173
- catch (error) {
174
- registry.interrupted(record, error);
175
- throw error;
176
- }
177
- finally {
178
- environment.signal?.removeEventListener("abort", abort);
179
- registry.interrupted(record);
180
- }
181
- }),
182
- cancelInvocation: async (id, reason) => registry.cancel(registry.active(id), reason),
183
- respondInteraction: async (id, response) => client.respond(registry.ref(id), response),
184
- respondNativeInteraction: async (id, response) => client.respondNative(registry.ref(id), response),
185
- status: async () => (await exchange("status")),
186
- list: async () => (await exchange("adapter.list")),
187
- get: query,
188
- submit: (input, environment) => submit(input, environment),
189
- async *subscribe(ref, afterSeq = 0, signal) {
190
- // 断线仅续读同一实例、同一流的连续序号;不能把恢复观察变成再次执行 Provider。
191
- let after = afterSeq;
192
- let repair = 0;
193
- let repairUntil;
194
- while (true) {
195
- signal?.throwIfAborted();
196
- if (closed)
197
- throw new KernelError("CLIENT_CLOSED");
198
- let socket;
199
- let timer;
200
- try {
201
- if (repairUntil !== undefined && Date.now() >= repairUntil)
202
- throw new KernelError("KERNEL_UNAVAILABLE");
203
- socket = await open(signal, repairUntil === undefined ? 5000 : Math.max(1, repairUntil - Date.now()));
204
- const current = socket;
205
- timer = setTimeout(() => current.destroy(new KernelError("KERNEL_TIMEOUT")), repairUntil === undefined ? 5000 : Math.max(1, Math.min(5000, repairUntil - Date.now())));
206
- const id = randomUUID();
207
- send(socket, id, "agent_run.subscribe", { ref, after_seq: after });
208
- let acknowledged = false;
209
- let terminalAt;
210
- for await (const value of lines(socket)) {
211
- if (!acknowledged) {
212
- const info = response(value, id);
213
- if (info.ref.kernel_instance_id !== ref.kernel_instance_id)
214
- throw new KernelError("KERNEL_INSTANCE_CHANGED");
215
- assertHostRunReceipt(receiptFor(info.ref));
216
- if (!sameLookup(info.ref, ref) ||
217
- info.ref.stream_id !== ref.stream_id ||
218
- info.ref.protocol !== ref.protocol)
219
- throw new KernelError("RUN_IDENTITY_MISMATCH");
220
- acknowledged = true;
221
- clearTimeout(timer);
222
- if (info.terminal) {
223
- assertHostFrame(info.terminal);
224
- assertHostFrameIdentity(info.terminal, receiptFor(ref));
225
- if (!isHostTerminal(info.terminal))
226
- throw new KernelError("HOST_FRAME_INVALID");
227
- registry.reconcile(info.ref, info.terminal);
228
- terminalAt = info.latest_seq;
229
- }
230
- if (terminalAt !== undefined && after >= terminalAt)
231
- return;
232
- continue;
233
- }
234
- const notification = value;
235
- if (notification.method === "agent_run.stream_error")
236
- throw new KernelError(notification.params?.code ?? "STREAM_FAILED");
237
- if (notification.method !== "agent_run.event" ||
238
- notification.params?.kernel_instance_id !== ref.kernel_instance_id)
239
- throw new KernelError("HOST_FRAME_INVALID");
240
- const frame = notification.params.event;
241
- assertHostFrame(frame);
242
- assertHostFrameIdentity(frame, receiptFor(ref));
243
- if (frame.seq !== after + 1 || notification.params.seq !== frame.seq)
244
- throw new KernelError("STREAM_GAP");
245
- after = frame.seq;
246
- registry.observe(ref, frame);
247
- yield frame;
248
- if (isHostTerminal(frame))
249
- return;
250
- }
251
- throw new KernelError("CONNECTION_CLOSED");
252
- }
253
- catch (error) {
254
- if (closed)
255
- throw new KernelError("CLIENT_CLOSED");
256
- signal?.throwIfAborted();
257
- if (!(error instanceof KernelError) &&
258
- error instanceof Error &&
259
- "code" in error &&
260
- typeof error.code === "string")
261
- throw new KernelError(error.code);
262
- if (error instanceof KernelError &&
263
- !["CONNECTION_CLOSED", "KERNEL_UNAVAILABLE", "KERNEL_TIMEOUT"].includes(error.code))
264
- throw error;
265
- if (repair >= 3)
266
- throw new KernelError("KERNEL_UNAVAILABLE");
267
- repairUntil ??= Date.now() + 10_000;
268
- if (Date.now() >= repairUntil)
269
- throw new KernelError("KERNEL_UNAVAILABLE");
270
- await new Promise((resolve) => setTimeout(resolve, [100, 250, 500][repair++]));
271
- }
272
- finally {
273
- clearTimeout(timer);
274
- socket?.destroy();
275
- }
276
- }
277
- },
278
- cancel,
279
- respond: (ref, response) => control("agent_run.respond", { ref, response }),
280
- respondNative: (ref, response) => control("agent_run.native.respond", { ref, response }),
281
- close() {
282
- closed = true;
283
- registry.close();
284
- for (const socket of sockets)
285
- socket.destroy();
286
- }
287
- };
288
- async function submit(input, environment = {}, record) {
289
- if (closed)
290
- throw new KernelError("CLIENT_CLOSED");
291
- environment.signal?.throwIfAborted();
292
- if (environment.streamLimits !== undefined)
293
- throw new KernelError("KERNEL_STREAM_LIMITS_UNSUPPORTED");
294
- const request = identifyInvokeInput(input);
295
- const requestLine = JSON.stringify({
296
- jsonrpc: "2.0",
297
- id: "0".repeat(36),
298
- method: "agent_run.invoke",
299
- params: { input: request, executionEnvOverrides: environment.executionEnvOverrides }
300
- });
301
- if (Buffer.byteLength(requestLine) + 1 > INVOKE_REQUEST_MAX_BYTES)
302
- throw new KernelError("INVOKE_REQUEST_TOO_LARGE");
303
- const instance = (await client.status()).kernel_instance_id;
304
- environment.signal?.throwIfAborted();
305
- if (record)
306
- record.instance = instance;
307
- let ref;
308
- let submitted = false;
309
- try {
310
- const result = (await exchange("agent_run.invoke", {
311
- input: request,
312
- executionEnvOverrides: environment.executionEnvOverrides,
313
- kernel_instance_id: instance
314
- }, 30_000,
315
- // 请求发出后中断等待会让接纳结果不明;先取得/查询 ACK,再按原身份请求取消。
316
- undefined, () => {
317
- environment.signal?.throwIfAborted();
318
- if (record)
319
- registry.assertSubmission();
320
- }, () => {
321
- submitted = true;
322
- if (record)
323
- record.submitted = true;
324
- }));
325
- assertHostRunReceipt(result.receipt);
326
- if (result.kernel_instance_id !== instance)
327
- throw new KernelError("KERNEL_INSTANCE_CHANGED");
328
- ref = { ...result.receipt, kernel_instance_id: result.kernel_instance_id };
329
- if (!sameLookup(ref, lookupFor(request)))
330
- throw new KernelError("RUN_IDENTITY_MISMATCH");
331
- }
332
- catch (error) {
333
- if (!submitted)
334
- throw error;
335
- markSubmissionRejected(error, instance);
336
- if (error instanceof KernelError &&
337
- !["KERNEL_TIMEOUT", "CONNECTION_CLOSED"].includes(error.code))
338
- throw error;
339
- // ACK 丢失后只按原身份查询,不重新提交,避免创建第二次执行。
340
- const key = lookupFor(request);
341
- let recovered;
342
- const until = Date.now() + 10_000;
343
- for (const delay of [100, 250, 500]) {
344
- await new Promise((resolve) => setTimeout(resolve, delay));
345
- if (Date.now() >= until)
346
- break;
347
- try {
348
- recovered = (await query(key, instance, Math.min(until, Date.now() + 5000))).ref;
349
- break;
350
- }
351
- catch (queryError) {
352
- if (queryError instanceof KernelError &&
353
- ["KERNEL_INSTANCE_CHANGED", "RUN_IDENTITY_MISMATCH"].includes(queryError.code))
354
- throw queryError;
355
- }
356
- }
357
- if (!recovered)
358
- throw new KernelError("ACCEPTANCE_UNKNOWN");
359
- ref = recovered;
360
- }
361
- if (!record && environment.signal?.aborted)
362
- await client.cancel(ref, "caller_aborted");
363
- return { ref };
364
- }
365
- return client;
366
- }
367
- function remaining(deadline) {
368
- const timeout = deadline - Date.now();
369
- if (timeout <= 0)
370
- throw new KernelError("KERNEL_TIMEOUT");
371
- return timeout;
372
- }
373
- function receiptFor(ref) {
374
- const { kernel_instance_id: _instance, ...receipt } = ref;
375
- void _instance;
376
- return receipt;
377
- }
378
- function lookupForKey(key) {
379
- return {
380
- run_id: key.run_id,
381
- invocation_id: key.invocation_id,
382
- agent_session_id: key.agent_session_id,
383
- session_generation: key.session_generation,
384
- protocol_mode: key.protocol_mode
385
- };
386
- }
387
- function sameLookup(left, right) {
388
- return (left.run_id === right.run_id &&
389
- left.invocation_id === right.invocation_id &&
390
- left.agent_session_id === right.agent_session_id &&
391
- left.session_generation === right.session_generation &&
392
- left.protocol_mode === right.protocol_mode);
393
- }
394
- function lookupFor(input) {
395
- return {
396
- run_id: input.runId,
397
- invocation_id: input.invocationId,
398
- agent_session_id: input.sessionId,
399
- session_generation: input.sessionGeneration ?? 0,
400
- protocol_mode: input.protocol_mode ?? "native"
401
- };
402
- }
403
- function send(socket, id, method, params) {
404
- const line = `${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`;
405
- if (Buffer.byteLength(line) > INVOKE_REQUEST_MAX_BYTES)
406
- throw new KernelError("INVOKE_REQUEST_TOO_LARGE");
407
- socket.write(line);
408
- }
409
- function response(value, id) {
410
- const reply = value;
411
- if (reply.id !== id)
412
- throw new KernelError("INVALID_RESPONSE");
413
- if (reply.error)
414
- throw new KernelError(typeof reply.error.data?.code === "string" ? reply.error.data.code : "KERNEL_REQUEST_FAILED", reply.error.data);
415
- return reply.result;
416
- }
417
- async function* lines(socket) {
418
- let pending = Buffer.alloc(0);
419
- try {
420
- for await (const chunk of socket) {
421
- const bytes = chunk;
422
- pending = pending.length ? Buffer.concat([pending, bytes]) : bytes;
423
- let offset;
424
- while ((offset = pending.indexOf(10)) >= 0) {
425
- if (offset > HOST_RPC_MAX_LINE_BYTES)
426
- throw new KernelError("HOST_FRAME_TOO_LARGE");
427
- const line = pending.subarray(0, offset);
428
- pending = pending.subarray(offset + 1);
429
- yield JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(line));
430
- }
431
- if (pending.length > HOST_RPC_MAX_LINE_BYTES)
432
- throw new KernelError("HOST_FRAME_TOO_LARGE");
433
- }
434
- if (pending.length)
435
- throw new KernelError("CONNECTION_CLOSED");
436
- }
437
- catch (error) {
438
- if (error instanceof KernelError)
439
- throw error;
440
- if (error instanceof Error && /^[A-Z][A-Z0-9_]+$/.test(error.message))
441
- throw new KernelError(error.message);
442
- throw new KernelError("CONNECTION_CLOSED");
443
- }
444
- }
1
+ // 兼容旧入口;客户端状态、错误身份和恢复实现由独立包统一持有。
2
+ export { attachKernel } from "@mininglamp-oss/octo-runtime-client";
@@ -1,8 +1,10 @@
1
1
  import net from "node:net";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { lstat, open, readFile, rm } from "node:fs/promises";
4
+ import { assertIpcEndpoint } from "./runtime-home.js";
4
5
  /** 端点租约保护启动竞争;只移除已确认无人监听的旧 socket,不替换用户文件。 */
5
6
  export async function acquireEndpoint(endpoint) {
7
+ assertIpcEndpoint(endpoint);
6
8
  if (process.platform === "win32")
7
9
  return async () => { };
8
10
  const file = `${endpoint}.owner`;
@@ -0,0 +1,17 @@
1
+ import type { AdapterProbeOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import type { HostedAdapterMetadata } from "@mininglamp-oss/octo-runtime-executor-core";
3
+ import { type InputInvoke, type InputFrames, type InteractionResponse, type NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
4
+ /** Kernel 内部的原生执行源;不是另一条传输协议,公共调用始终经过 KernelClient RPC。 */
5
+ export interface ExecutionSource {
6
+ list(configurations?: Record<string, AdapterProbeOptions>): Promise<HostedAdapterMetadata[]>;
7
+ probe(adapterType: string, options?: AdapterProbeOptions): Promise<unknown>;
8
+ cancel(invocationId: string, reason?: string): Promise<{
9
+ cancelled: boolean;
10
+ }>;
11
+ respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
12
+ respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
13
+ invoke: InputInvoke;
14
+ invokeFrames: InputFrames;
15
+ }
16
+ /** 校验宿主提供的配置值,不读取文件或修改原对象。 */
17
+ export declare function probeOptions(value: unknown): AdapterProbeOptions | undefined;
@@ -0,0 +1,21 @@
1
+ import { resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
2
+ /** 校验宿主提供的配置值,不读取文件或修改原对象。 */
3
+ export function probeOptions(value) {
4
+ if (value === undefined)
5
+ return undefined;
6
+ if (!value || typeof value !== "object" || Array.isArray(value))
7
+ throw new TypeError("invalid probe options");
8
+ const options = value;
9
+ if (options.providerOptions !== undefined &&
10
+ (!options.providerOptions ||
11
+ typeof options.providerOptions !== "object" ||
12
+ Array.isArray(options.providerOptions) ||
13
+ Object.values(options.providerOptions).some((v) => typeof v !== "string")))
14
+ throw new TypeError("invalid probe provider options");
15
+ return {
16
+ ...options,
17
+ ...(options.streamLimits === undefined
18
+ ? {}
19
+ : { streamLimits: resolveStreamLimitPolicy(options.streamLimits) })
20
+ };
21
+ }
@@ -1,4 +1,4 @@
1
- import type { WorkerRpc } from "./rpc.js";
1
+ import type { ExecutionSource } from "./execution-source.js";
2
2
  import { type HostFrame, type HostRunReceipt, type InvokeInput, type InvokeEnvironment, type NativeInteractionResponse, type InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
3
3
  export interface SourceEvent {
4
4
  seq: number;
@@ -7,28 +7,30 @@ export interface SourceEvent {
7
7
  at: number;
8
8
  }
9
9
  /**
10
- * Kernel 内唯一的 Run 事件源:从 worker 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
10
+ * Kernel 内唯一的 Run 事件源:从同进程 Core 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
11
11
  * 接纳、执行与观察分离;订阅退出不取消源执行,缓存过期只报告缺口,不重跑 Provider。
12
12
  */
13
- export declare class HostRunService implements WorkerRpc {
13
+ export declare class HostRunService implements ExecutionSource {
14
14
  #private;
15
- readonly transport: WorkerRpc;
15
+ readonly transport: ExecutionSource;
16
16
  private readonly resolveStreamLimits?;
17
17
  readonly invoke: import("@mininglamp-oss/octo-runtime-protocol").InputInvoke;
18
- constructor(transport: WorkerRpc, resolveStreamLimits?: ((input: InvokeInput) => InvokeEnvironment["streamLimits"]) | undefined);
18
+ constructor(transport: ExecutionSource, resolveStreamLimits?: ((input: InvokeInput) => InvokeEnvironment["streamLimits"]) | undefined);
19
19
  get status(): {
20
20
  draining: boolean;
21
21
  activeRuns: number;
22
22
  admittingRuns: number;
23
23
  };
24
- list(...args: Parameters<WorkerRpc["list"]>): ReturnType<WorkerRpc["list"]>;
25
- probe(...args: Parameters<WorkerRpc["probe"]>): Promise<unknown>;
26
- cancel(invocationId: string, reason?: string): ReturnType<WorkerRpc["cancel"]>;
24
+ list(...args: Parameters<ExecutionSource["list"]>): ReturnType<ExecutionSource["list"]>;
25
+ probe(...args: Parameters<ExecutionSource["probe"]>): Promise<unknown>;
26
+ cancel(invocationId: string, reason?: string): ReturnType<ExecutionSource["cancel"]>;
27
27
  respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
28
28
  respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
29
29
  invokeFrames(input: InvokeInput, environment?: InvokeEnvironment): AsyncGenerator<HostFrame>;
30
30
  /** 返回接纳凭据后仍在后台驱动源流;调用方无需保持原请求连接才能让执行继续。 */
31
31
  submit(input: InvokeInput, environment?: InvokeEnvironment): Promise<HostRunReceipt>;
32
+ /** 观察指定后台消费的实际结束;终态进入窗口时 finally 可能仍在执行。 */
33
+ settled(receipt: HostRunReceipt): Promise<void>;
32
34
  get(runId: string): HostRunReceipt & {
33
35
  oldest_seq: number;
34
36
  latest_seq: number;
@@ -38,7 +40,7 @@ export declare class HostRunService implements WorkerRpc {
38
40
  read(runId: string, streamId: string | undefined, after: number): ReturnType<HostRunService["get"]> & {
39
41
  events: SourceEvent[];
40
42
  };
41
- cancelRun(runId: string, reason?: string): ReturnType<WorkerRpc["cancel"]>;
43
+ cancelRun(runId: string, reason?: string): ReturnType<ExecutionSource["cancel"]>;
42
44
  respond(runId: string, response: InteractionResponse): Promise<void>;
43
45
  respondNativeRun(runId: string, response: NativeInteractionResponse): Promise<void>;
44
46
  acquireSubscription(): () => void;
@@ -1,7 +1,7 @@
1
1
  import { createInputInvoke, assertInvokeRequestSize, identifyInvokeInput, assertHostFrameIdentity, isHostTerminal, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, protocolError } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  const TTL = 120_000;
3
3
  /**
4
- * Kernel 内唯一的 Run 事件源:从 worker 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
4
+ * Kernel 内唯一的 Run 事件源:从同进程 Core 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
5
5
  * 接纳、执行与观察分离;订阅退出不取消源执行,缓存过期只报告缺口,不重跑 Provider。
6
6
  */
7
7
  export class HostRunService {
@@ -154,14 +154,25 @@ export class HostRunService {
154
154
  /** 返回接纳凭据后仍在后台驱动源流;调用方无需保持原请求连接才能让执行继续。 */
155
155
  async submit(input, environment = {}) {
156
156
  const run = await this.#begin(identifyInvokeInput(input), environment);
157
- const task = (async () => {
157
+ const execution = (async () => {
158
158
  for await (const event of this.#execute(run))
159
159
  void event;
160
- })().catch(() => undefined);
160
+ })();
161
+ run.settled = execution;
162
+ const task = execution.catch(() => undefined);
161
163
  this.#tasks.add(task);
162
164
  void task.finally(() => this.#tasks.delete(task));
163
165
  return { ...run.receipt };
164
166
  }
167
+ /** 观察指定后台消费的实际结束;终态进入窗口时 finally 可能仍在执行。 */
168
+ settled(receipt) {
169
+ const run = this.#get(receipt.run_id);
170
+ if (run.streamId !== receipt.stream_id)
171
+ throw new Error("STREAM_EXPIRED");
172
+ if (!run.settled)
173
+ throw new Error("RUN_NOT_SUBMITTED");
174
+ return run.settled;
175
+ }
165
176
  #append(run, event) {
166
177
  if (run.terminal)
167
178
  throw new Error("HOST_FRAME_AFTER_TERMINAL");
@@ -2,14 +2,12 @@ export { type HostedAdapter, type HostedAdapterMetadata, DEFAULT_RUNTIME_LIMITS,
2
2
  export { HostRunService } from "./host-run-service.js";
3
3
  export { createKernelService, type KernelService, type KernelServiceOptions, type KernelServiceStatus } from "./service.js";
4
4
  export * from "./lifecycle.js";
5
+ export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint, runtimePathFailure, kernelStartupPaths, prepareHomeDirectory, type StartupPathDiagnostic, type RuntimePath } from "./runtime-home.js";
6
+ export * from "./startup-diagnostics.js";
5
7
  export { attachKernel } from "./client.js";
6
8
  export { AsyncQuestionReply, type AsyncQuestionReplyResult } from "./async-question-reply.js";
7
- export { isInvocationNotSubmitted } from "./submission-error.js";
9
+ export { isInvocationNotSubmitted, admissionClosedError } from "./submission-error.js";
8
10
  export * from "./types.js";
9
- export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, processStartIdentity, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
10
- export { readAdapterConfigurations } from "./runtime-configuration.js";
11
- export { spawnWorker } from "./process.js";
12
- export { serveWorker } from "./serve.js";
13
- export type { WorkerProcess, SpawnWorkerOptions } from "./process.js";
14
- export { WorkerRpcClient, WorkerRpcServer, type WorkerRpc, type RpcTrace, type RpcTraceDirection } from "./rpc.js";
11
+ export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
15
12
  export { acquireEndpoint } from "./endpoint.js";
13
+ export { assertStartupLogging } from "./startup-logging.js";
@@ -1,15 +1,14 @@
1
- // Kernel 只提供 IPC、Run 观察与 worker 监督;执行逻辑统一委托给 worker 中的 Core。
1
+ // Kernel 在宿主进程拥有 Core 与 Run 管理;所有业务调用统一经过本地 RPC。
2
2
  export { DEFAULT_RUNTIME_LIMITS, prepareRunContext } from "@mininglamp-oss/octo-runtime-executor-core";
3
3
  export { HostRunService } from "./host-run-service.js";
4
4
  export { createKernelService } from "./service.js";
5
5
  export * from "./lifecycle.js";
6
+ export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint, runtimePathFailure, kernelStartupPaths, prepareHomeDirectory } from "./runtime-home.js";
7
+ export * from "./startup-diagnostics.js";
6
8
  export { attachKernel } from "./client.js";
7
9
  export { AsyncQuestionReply } from "./async-question-reply.js";
8
- export { isInvocationNotSubmitted } from "./submission-error.js";
10
+ export { isInvocationNotSubmitted, admissionClosedError } from "./submission-error.js";
9
11
  export * from "./types.js";
10
- export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, processStartIdentity, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
11
- export { readAdapterConfigurations } from "./runtime-configuration.js";
12
- export { spawnWorker } from "./process.js";
13
- export { serveWorker } from "./serve.js";
14
- export { WorkerRpcClient, WorkerRpcServer } from "./rpc.js";
12
+ export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
15
13
  export { acquireEndpoint } from "./endpoint.js";
14
+ export { assertStartupLogging } from "./startup-logging.js";