@mininglamp-oss/octo-runtime 1.1.10 → 1.1.12

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 (916) hide show
  1. package/README.md +26 -142
  2. package/apps/cli/README.md +7 -102
  3. package/apps/cli/dist/adapters.js +41 -19
  4. package/apps/cli/dist/build-info.json +2 -2
  5. package/apps/cli/dist/command-tree.d.ts +1 -13
  6. package/apps/cli/dist/command-tree.js +130 -317
  7. package/apps/cli/dist/foreground.d.ts +1 -2
  8. package/apps/cli/dist/help.d.ts +0 -1
  9. package/apps/cli/dist/help.js +2 -13
  10. package/apps/cli/dist/index.js +14 -1
  11. package/apps/cli/dist/logs.d.ts +2 -2
  12. package/apps/cli/dist/logs.js +14 -17
  13. package/apps/cli/dist/main.js +99 -182
  14. package/apps/cli/dist/manifest.json +0 -50
  15. package/apps/cli/dist/module-manifest.d.ts +1 -1
  16. package/apps/cli/dist/module-manifest.js +23 -6
  17. package/apps/cli/dist/openclaw.d.ts +0 -8
  18. package/apps/cli/dist/openclaw.js +2 -114
  19. package/apps/cli/dist/output.d.ts +19 -1
  20. package/apps/cli/dist/output.js +185 -44
  21. package/apps/cli/dist/playboard.js +17 -9
  22. package/apps/cli/dist/service-control.js +0 -1
  23. package/apps/cli/dist/state.d.ts +5 -2
  24. package/apps/cli/dist/state.js +48 -13
  25. package/dist/public/codex.d.ts +1 -0
  26. package/dist/public/codex.js +1 -0
  27. package/dist/public/executor-kernel.d.ts +4 -0
  28. package/dist/public/executor-kernel.js +2 -0
  29. package/dist/public/host.d.ts +6 -3
  30. package/dist/public/host.js +3 -1
  31. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +20 -0
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -6
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +78 -262
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +11 -6
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +198 -52
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +58 -0
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +650 -0
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +3 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +15 -0
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-R3PDZLX5.js → chunk-H3S6WM37.js} +3 -3
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-FGFEM7JP.js → chunk-RISQ6NGV.js} +1 -1
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-TSRZVLIG.js → chunk-SMTJTIN7.js} +1 -1
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +2 -2
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +3 -3
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +4 -4
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +4 -4
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +2 -0
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -0
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +25 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +4 -1
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +1 -1
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +1 -13
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +4 -27
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log-worker.js +4 -8
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.d.ts +0 -4
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +6 -60
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +0 -10
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +0 -83
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  76. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +41 -19
  77. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  78. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +1 -13
  79. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +130 -317
  80. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/foreground.d.ts +1 -2
  81. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +0 -1
  82. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +2 -13
  83. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/index.js +14 -1
  84. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.d.ts +2 -2
  85. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.js +14 -17
  86. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +99 -182
  87. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +0 -50
  88. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
  89. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +23 -6
  90. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.d.ts +0 -8
  91. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +2 -114
  92. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +19 -1
  93. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +185 -44
  94. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +17 -9
  95. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/service-control.js +0 -1
  96. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.d.ts +5 -2
  97. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -13
  98. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -23
  99. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +5 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.d.ts +29 -0
  101. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.js +210 -0
  102. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.d.ts +1 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.js +1 -0
  104. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.d.ts +10 -0
  105. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +495 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.d.ts +6 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.js +6 -0
  108. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.d.ts +4 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.js +5 -0
  110. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.d.ts +59 -0
  111. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.js +302 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.d.ts +1 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.js +1 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.d.ts +1 -0
  115. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.js +1 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.d.ts +21 -0
  117. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.js +138 -0
  118. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.d.ts +8 -0
  119. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.js +53 -0
  120. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.d.ts +82 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.js +371 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.d.ts +12 -0
  123. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.js +29 -0
  124. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.d.ts +87 -0
  125. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.js +10 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +54 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +1219 -0
  128. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +5988 -0
  129. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +56 -0
  130. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc-fixtures.json +75 -0
  131. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +538 -0
  132. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +116 -0
  133. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +4713 -0
  134. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +761 -0
  135. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +663 -0
  136. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +191 -0
  137. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  138. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +26 -18
  139. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +153 -14
  140. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +1 -1
  141. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +22 -15
  142. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  143. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +1 -30
  144. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +2 -199
  145. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +1 -10
  146. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -446
  147. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/endpoint.js +2 -0
  148. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts +2 -0
  149. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +13 -2
  150. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +4 -1
  151. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +4 -1
  152. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.d.ts +1 -53
  153. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -280
  154. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.d.ts +5 -10
  155. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.js +4 -1
  156. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.d.ts +20 -0
  157. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.js +180 -0
  158. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +41 -15
  159. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +5 -2
  160. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +48 -5
  161. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.d.ts +1 -0
  162. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.js +1 -0
  163. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.d.ts +1 -0
  164. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.js +1 -0
  165. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.d.ts +4 -0
  166. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.js +18 -0
  167. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +1 -10
  168. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +2 -23
  169. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.d.ts +2 -72
  170. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.js +2 -10
  171. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -4
  172. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.d.ts +1 -1
  173. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +12 -5
  174. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.d.ts +5 -1
  175. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.js +9 -0
  176. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.d.ts +5 -6
  177. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +33 -45
  178. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/identity.js +6 -0
  179. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +4 -6
  180. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +3 -5
  181. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -17
  182. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +7 -0
  183. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +1 -0
  184. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +1 -0
  185. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +52 -8
  186. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/image-input.d.ts +9 -0
  187. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/image-input.js +20 -0
  188. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +3 -1
  189. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +1 -0
  190. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +27 -29
  191. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +86 -37
  192. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.d.ts +1 -6
  193. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +3 -17
  194. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.d.ts +5 -0
  195. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +65 -0
  196. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  197. package/node_modules/semver/classes/range.js +2 -2
  198. package/node_modules/semver/internal/constants.js +30 -0
  199. package/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
  200. package/node_modules/semver/package.json +1 -1
  201. package/node_modules/ws/README.md +21 -29
  202. package/node_modules/ws/lib/buffer-util.js +13 -2
  203. package/node_modules/ws/lib/sender.js +4 -1
  204. package/node_modules/ws/lib/websocket.js +8 -3
  205. package/node_modules/ws/package.json +1 -1
  206. package/package.json +33 -135
  207. package/packages/octo-runtime-protocol/schema/kernel-ipc-fixtures.json +28 -6
  208. package/packages/octo-runtime-protocol/schema/protocol.schema.json +296 -66
  209. package/apps/cli/dist/extra-command-config.d.ts +0 -4
  210. package/apps/cli/dist/extra-command-config.js +0 -50
  211. package/apps/cli/dist/extra-commands.d.ts +0 -15
  212. package/apps/cli/dist/extra-commands.js +0 -275
  213. package/apps/cli/dist/extras.d.ts +0 -8
  214. package/apps/cli/dist/extras.js +0 -72
  215. package/apps/cli/dist/global-extras.d.ts +0 -16
  216. package/apps/cli/dist/global-extras.js +0 -201
  217. package/apps/cli/dist/status-output.d.ts +0 -10
  218. package/apps/cli/dist/status-output.js +0 -65
  219. package/dist/public/channel-gateway-commands.d.ts +0 -1
  220. package/dist/public/channel-gateway-commands.js +0 -1
  221. package/dist/public/channel-gateway.d.ts +0 -3
  222. package/dist/public/channel-gateway.js +0 -1
  223. package/dist/public/channel-wecom-commands.d.ts +0 -1
  224. package/dist/public/channel-wecom-commands.js +0 -1
  225. package/dist/public/channel-wecom.d.ts +0 -2
  226. package/dist/public/channel-wecom.js +0 -1
  227. package/dist/public/extra.d.ts +0 -5
  228. package/dist/public/extra.js +0 -3
  229. package/dist/public/webui-commands.d.ts +0 -1
  230. package/dist/public/webui-commands.js +0 -1
  231. package/dist/public/webui.d.ts +0 -1
  232. package/dist/public/webui.js +0 -1
  233. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +0 -4
  234. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +0 -50
  235. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +0 -15
  236. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +0 -275
  237. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.d.ts +0 -8
  238. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +0 -72
  239. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +0 -16
  240. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +0 -201
  241. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/status-output.d.ts +0 -10
  242. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/status-output.js +0 -65
  243. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +0 -8
  244. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +0 -62
  245. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +0 -458
  246. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +0 -50
  247. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +0 -140
  248. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.d.ts +0 -3
  249. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.js +0 -27
  250. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/host-session-store.d.ts +0 -17
  251. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/host-session-store.js +0 -123
  252. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.d.ts +0 -15
  253. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +0 -1489
  254. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.d.ts +0 -28
  255. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.js +0 -77
  256. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +0 -71
  257. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.js +0 -153
  258. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.d.ts +0 -15
  259. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.js +0 -28
  260. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.d.ts +0 -4
  261. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +0 -124
  262. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +0 -172
  263. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +0 -22
  264. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +0 -46
  265. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +0 -16
  266. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +0 -285
  267. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.d.ts +0 -20
  268. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.js +0 -109
  269. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +0 -15
  270. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +0 -36
  271. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts +0 -16
  272. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js +0 -98
  273. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.d.ts +0 -6
  274. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.js +0 -10
  275. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +0 -17
  276. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +0 -238
  277. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.d.ts +0 -29
  278. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.js +0 -171
  279. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +0 -44
  280. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +0 -392
  281. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.d.ts +0 -3
  282. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.js +0 -27
  283. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.d.ts +0 -4
  284. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +0 -87
  285. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/index.d.ts +0 -20
  286. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/index.js +0 -13
  287. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.d.ts +0 -9
  288. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +0 -162
  289. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/manager.d.ts +0 -12
  290. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/manager.js +0 -154
  291. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/ports.d.ts +0 -34
  292. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +0 -67
  293. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +0 -588
  294. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/typing.d.ts +0 -16
  295. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/typing.js +0 -83
  296. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.d.ts +0 -132
  297. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +0 -226
  298. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +0 -65
  299. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +0 -202
  300. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +0 -112
  301. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +0 -138
  302. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.d.ts +0 -48
  303. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.js +0 -116
  304. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/events.d.ts +0 -51
  305. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/events.js +0 -79
  306. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +0 -30
  307. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +0 -222
  308. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/index.d.ts +0 -13
  309. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/index.js +0 -13
  310. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.d.ts +0 -92
  311. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.js +0 -173
  312. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.d.ts +0 -84
  313. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.js +0 -110
  314. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/types.d.ts +0 -87
  315. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/types.js +0 -45
  316. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.d.ts +0 -2
  317. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.js +0 -7
  318. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.d.ts +0 -5
  319. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +0 -23
  320. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-action.d.ts +0 -20
  321. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-action.js +0 -75
  322. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +0 -22
  323. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +0 -136
  324. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/cards.d.ts +0 -7
  325. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/cards.js +0 -40
  326. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +0 -70
  327. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +0 -646
  328. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.d.ts +0 -17
  329. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +0 -91
  330. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +0 -18
  331. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +0 -148
  332. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +0 -15
  333. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +0 -257
  334. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.d.ts +0 -12
  335. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.js +0 -133
  336. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.d.ts +0 -21
  337. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.js +0 -76
  338. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.d.ts +0 -6
  339. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.js +0 -163
  340. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.d.ts +0 -4
  341. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.js +0 -113
  342. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +0 -13
  343. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +0 -75
  344. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-content.d.ts +0 -6
  345. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-content.js +0 -117
  346. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.d.ts +0 -16
  347. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.js +0 -74
  348. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.d.ts +0 -4
  349. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.js +0 -19
  350. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.d.ts +0 -7
  351. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.js +0 -90
  352. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.d.ts +0 -20
  353. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +0 -85
  354. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.d.ts +0 -34
  355. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +0 -430
  356. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/resources.d.ts +0 -6
  357. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/resources.js +0 -63
  358. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.d.ts +0 -6
  359. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.js +0 -60
  360. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.d.ts +0 -9
  361. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.js +0 -71
  362. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +0 -44
  363. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +0 -357
  364. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +0 -33
  365. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/config-schema.json +0 -276
  366. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.d.ts +0 -11
  367. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +0 -754
  368. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.d.ts +0 -35
  369. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.js +0 -93
  370. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.d.ts +0 -4
  371. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +0 -128
  372. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/contracts.d.ts +0 -78
  373. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/contracts.js +0 -1
  374. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/delivery/dispatcher.d.ts +0 -16
  375. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/delivery/dispatcher.js +0 -69
  376. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/execution/dispatcher.d.ts +0 -12
  377. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/execution/dispatcher.js +0 -95
  378. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.d.ts +0 -3
  379. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +0 -85
  380. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/index.d.ts +0 -10
  381. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/index.js +0 -6
  382. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/lifecycle/configuration.d.ts +0 -6
  383. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/lifecycle/configuration.js +0 -109
  384. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/lifecycle/manager.d.ts +0 -12
  385. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/lifecycle/manager.js +0 -73
  386. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/ports.d.ts +0 -24
  387. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/ports.js +0 -1
  388. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/presentation/run-projector.d.ts +0 -45
  389. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/presentation/run-projector.js +0 -258
  390. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.d.ts +0 -21
  391. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.js +0 -124
  392. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/connection.d.ts +0 -53
  393. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/connection.js +0 -219
  394. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/stream-session.d.ts +0 -10
  395. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/stream-session.js +0 -52
  396. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +0 -31
  397. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/config-schema.json +0 -134
  398. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +0 -3
  399. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +0 -51
  400. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.d.ts +0 -3
  401. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.js +0 -423
  402. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/store.d.ts +0 -25
  403. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/store.js +0 -130
  404. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-BLMf2Etg.js +0 -73
  405. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-CYTpqItx.css +0 -1
  406. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +0 -3
  407. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +0 -28
  408. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.d.ts +0 -32
  409. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +0 -165
  410. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +0 -70
  411. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +0 -16
  412. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.d.ts +0 -20
  413. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +0 -134
  414. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-dependencies.d.ts +0 -4
  415. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-dependencies.js +0 -21
  416. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.d.ts +0 -22
  417. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.js +0 -309
  418. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.d.ts +0 -55
  419. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.js +0 -375
  420. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/shutdown.d.ts +0 -7
  421. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/shutdown.js +0 -39
  422. package/node_modules/@types/debug/LICENSE +0 -21
  423. package/node_modules/@types/debug/README.md +0 -69
  424. package/node_modules/@types/debug/index.d.ts +0 -50
  425. package/node_modules/@types/debug/package.json +0 -58
  426. package/node_modules/@types/mdast/LICENSE +0 -21
  427. package/node_modules/@types/mdast/README.md +0 -15
  428. package/node_modules/@types/mdast/index.d.ts +0 -1123
  429. package/node_modules/@types/mdast/package.json +0 -47
  430. package/node_modules/@types/ms/LICENSE +0 -21
  431. package/node_modules/@types/ms/README.md +0 -82
  432. package/node_modules/@types/ms/index.d.ts +0 -63
  433. package/node_modules/@types/ms/package.json +0 -26
  434. package/node_modules/@types/unist/LICENSE +0 -21
  435. package/node_modules/@types/unist/README.md +0 -15
  436. package/node_modules/@types/unist/index.d.ts +0 -119
  437. package/node_modules/@types/unist/package.json +0 -60
  438. package/node_modules/character-entities/index.d.ts +0 -6
  439. package/node_modules/character-entities/index.js +0 -2132
  440. package/node_modules/character-entities/license +0 -22
  441. package/node_modules/character-entities/package.json +0 -78
  442. package/node_modules/character-entities/readme.md +0 -152
  443. package/node_modules/debug/LICENSE +0 -20
  444. package/node_modules/debug/README.md +0 -481
  445. package/node_modules/debug/package.json +0 -64
  446. package/node_modules/debug/src/browser.js +0 -272
  447. package/node_modules/debug/src/common.js +0 -292
  448. package/node_modules/debug/src/index.js +0 -10
  449. package/node_modules/debug/src/node.js +0 -263
  450. package/node_modules/decode-named-character-reference/index.d.ts +0 -13
  451. package/node_modules/decode-named-character-reference/index.d.ts.map +0 -1
  452. package/node_modules/decode-named-character-reference/index.dom.d.ts +0 -6
  453. package/node_modules/decode-named-character-reference/index.dom.d.ts.map +0 -1
  454. package/node_modules/decode-named-character-reference/index.dom.js +0 -32
  455. package/node_modules/decode-named-character-reference/index.js +0 -19
  456. package/node_modules/decode-named-character-reference/license +0 -22
  457. package/node_modules/decode-named-character-reference/package.json +0 -90
  458. package/node_modules/decode-named-character-reference/readme.md +0 -136
  459. package/node_modules/dequal/dist/index.js +0 -86
  460. package/node_modules/dequal/dist/index.min.js +0 -1
  461. package/node_modules/dequal/dist/index.mjs +0 -84
  462. package/node_modules/dequal/index.d.ts +0 -1
  463. package/node_modules/dequal/license +0 -21
  464. package/node_modules/dequal/lite/index.d.ts +0 -1
  465. package/node_modules/dequal/lite/index.js +0 -31
  466. package/node_modules/dequal/lite/index.min.js +0 -1
  467. package/node_modules/dequal/lite/index.mjs +0 -29
  468. package/node_modules/dequal/package.json +0 -57
  469. package/node_modules/dequal/readme.md +0 -112
  470. package/node_modules/devlop/lib/default.js +0 -9
  471. package/node_modules/devlop/lib/development.d.ts +0 -84
  472. package/node_modules/devlop/lib/development.js +0 -238
  473. package/node_modules/devlop/license +0 -22
  474. package/node_modules/devlop/package.json +0 -80
  475. package/node_modules/devlop/readme.md +0 -360
  476. package/node_modules/mdast-util-from-markdown/dev/index.d.ts +0 -23
  477. package/node_modules/mdast-util-from-markdown/dev/index.js +0 -2
  478. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts +0 -53
  479. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts.map +0 -1
  480. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +0 -1455
  481. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +0 -321
  482. package/node_modules/mdast-util-from-markdown/dev/lib/types.js +0 -2
  483. package/node_modules/mdast-util-from-markdown/index.d.ts +0 -23
  484. package/node_modules/mdast-util-from-markdown/index.js +0 -2
  485. package/node_modules/mdast-util-from-markdown/lib/index.d.ts +0 -53
  486. package/node_modules/mdast-util-from-markdown/lib/index.d.ts.map +0 -1
  487. package/node_modules/mdast-util-from-markdown/lib/index.js +0 -1270
  488. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +0 -321
  489. package/node_modules/mdast-util-from-markdown/lib/types.js +0 -2
  490. package/node_modules/mdast-util-from-markdown/license +0 -22
  491. package/node_modules/mdast-util-from-markdown/package.json +0 -98
  492. package/node_modules/mdast-util-from-markdown/readme.md +0 -549
  493. package/node_modules/mdast-util-to-string/index.d.ts +0 -2
  494. package/node_modules/mdast-util-to-string/index.js +0 -5
  495. package/node_modules/mdast-util-to-string/lib/index.d.ts +0 -31
  496. package/node_modules/mdast-util-to-string/lib/index.js +0 -108
  497. package/node_modules/mdast-util-to-string/license +0 -22
  498. package/node_modules/mdast-util-to-string/package.json +0 -78
  499. package/node_modules/mdast-util-to-string/readme.md +0 -218
  500. package/node_modules/micromark/dev/index.d.ts +0 -82
  501. package/node_modules/micromark/dev/index.d.ts.map +0 -1
  502. package/node_modules/micromark/dev/index.js +0 -68
  503. package/node_modules/micromark/dev/lib/compile.d.ts +0 -16
  504. package/node_modules/micromark/dev/lib/compile.d.ts.map +0 -1
  505. package/node_modules/micromark/dev/lib/compile.js +0 -1162
  506. package/node_modules/micromark/dev/lib/constructs.d.ts +0 -73
  507. package/node_modules/micromark/dev/lib/constructs.d.ts.map +0 -1
  508. package/node_modules/micromark/dev/lib/constructs.js +0 -101
  509. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts +0 -46
  510. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +0 -1
  511. package/node_modules/micromark/dev/lib/create-tokenizer.js +0 -718
  512. package/node_modules/micromark/dev/lib/initialize/content.d.ts +0 -4
  513. package/node_modules/micromark/dev/lib/initialize/content.d.ts.map +0 -1
  514. package/node_modules/micromark/dev/lib/initialize/content.js +0 -99
  515. package/node_modules/micromark/dev/lib/initialize/document.d.ts +0 -10
  516. package/node_modules/micromark/dev/lib/initialize/document.d.ts.map +0 -1
  517. package/node_modules/micromark/dev/lib/initialize/document.js +0 -449
  518. package/node_modules/micromark/dev/lib/initialize/flow.d.ts +0 -4
  519. package/node_modules/micromark/dev/lib/initialize/flow.d.ts.map +0 -1
  520. package/node_modules/micromark/dev/lib/initialize/flow.js +0 -86
  521. package/node_modules/micromark/dev/lib/initialize/text.d.ts +0 -8
  522. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +0 -1
  523. package/node_modules/micromark/dev/lib/initialize/text.js +0 -248
  524. package/node_modules/micromark/dev/lib/parse.d.ts +0 -10
  525. package/node_modules/micromark/dev/lib/parse.d.ts.map +0 -1
  526. package/node_modules/micromark/dev/lib/parse.js +0 -58
  527. package/node_modules/micromark/dev/lib/postprocess.d.ts +0 -9
  528. package/node_modules/micromark/dev/lib/postprocess.d.ts.map +0 -1
  529. package/node_modules/micromark/dev/lib/postprocess.js +0 -19
  530. package/node_modules/micromark/dev/lib/preprocess.d.ts +0 -13
  531. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +0 -1
  532. package/node_modules/micromark/dev/lib/preprocess.js +0 -139
  533. package/node_modules/micromark/dev/stream.d.ts +0 -35
  534. package/node_modules/micromark/dev/stream.d.ts.map +0 -1
  535. package/node_modules/micromark/dev/stream.js +0 -270
  536. package/node_modules/micromark/index.d.ts +0 -82
  537. package/node_modules/micromark/index.d.ts.map +0 -1
  538. package/node_modules/micromark/index.js +0 -60
  539. package/node_modules/micromark/lib/compile.d.ts +0 -16
  540. package/node_modules/micromark/lib/compile.d.ts.map +0 -1
  541. package/node_modules/micromark/lib/compile.js +0 -1068
  542. package/node_modules/micromark/lib/constructs.d.ts +0 -73
  543. package/node_modules/micromark/lib/constructs.d.ts.map +0 -1
  544. package/node_modules/micromark/lib/constructs.js +0 -85
  545. package/node_modules/micromark/lib/create-tokenizer.d.ts +0 -46
  546. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +0 -1
  547. package/node_modules/micromark/lib/create-tokenizer.js +0 -613
  548. package/node_modules/micromark/lib/initialize/content.d.ts +0 -4
  549. package/node_modules/micromark/lib/initialize/content.d.ts.map +0 -1
  550. package/node_modules/micromark/lib/initialize/content.js +0 -79
  551. package/node_modules/micromark/lib/initialize/document.d.ts +0 -10
  552. package/node_modules/micromark/lib/initialize/document.d.ts.map +0 -1
  553. package/node_modules/micromark/lib/initialize/document.js +0 -370
  554. package/node_modules/micromark/lib/initialize/flow.d.ts +0 -4
  555. package/node_modules/micromark/lib/initialize/flow.d.ts.map +0 -1
  556. package/node_modules/micromark/lib/initialize/flow.js +0 -58
  557. package/node_modules/micromark/lib/initialize/text.d.ts +0 -8
  558. package/node_modules/micromark/lib/initialize/text.d.ts.map +0 -1
  559. package/node_modules/micromark/lib/initialize/text.js +0 -216
  560. package/node_modules/micromark/lib/parse.d.ts +0 -10
  561. package/node_modules/micromark/lib/parse.d.ts.map +0 -1
  562. package/node_modules/micromark/lib/parse.js +0 -56
  563. package/node_modules/micromark/lib/postprocess.d.ts +0 -9
  564. package/node_modules/micromark/lib/postprocess.d.ts.map +0 -1
  565. package/node_modules/micromark/lib/postprocess.js +0 -18
  566. package/node_modules/micromark/lib/preprocess.d.ts +0 -13
  567. package/node_modules/micromark/lib/preprocess.d.ts.map +0 -1
  568. package/node_modules/micromark/lib/preprocess.js +0 -112
  569. package/node_modules/micromark/license +0 -22
  570. package/node_modules/micromark/package.json +0 -87
  571. package/node_modules/micromark/readme.md +0 -488
  572. package/node_modules/micromark/stream.d.ts +0 -35
  573. package/node_modules/micromark/stream.d.ts.map +0 -1
  574. package/node_modules/micromark/stream.js +0 -256
  575. package/node_modules/micromark-core-commonmark/dev/index.d.ts +0 -23
  576. package/node_modules/micromark-core-commonmark/dev/index.d.ts.map +0 -1
  577. package/node_modules/micromark-core-commonmark/dev/index.js +0 -22
  578. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts +0 -4
  579. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map +0 -1
  580. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +0 -294
  581. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts +0 -4
  582. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map +0 -1
  583. package/node_modules/micromark-core-commonmark/dev/lib/autolink.js +0 -269
  584. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts +0 -4
  585. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map +0 -1
  586. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.js +0 -62
  587. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts +0 -4
  588. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map +0 -1
  589. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.js +0 -162
  590. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts +0 -4
  591. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map +0 -1
  592. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.js +0 -69
  593. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts +0 -4
  594. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map +0 -1
  595. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.js +0 -166
  596. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts +0 -4
  597. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +0 -1
  598. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +0 -472
  599. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts +0 -4
  600. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map +0 -1
  601. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +0 -178
  602. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts +0 -4
  603. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map +0 -1
  604. package/node_modules/micromark-core-commonmark/dev/lib/code-text.js +0 -257
  605. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts +0 -7
  606. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map +0 -1
  607. package/node_modules/micromark-core-commonmark/dev/lib/content.js +0 -185
  608. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts +0 -4
  609. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map +0 -1
  610. package/node_modules/micromark-core-commonmark/dev/lib/definition.js +0 -295
  611. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts +0 -4
  612. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map +0 -1
  613. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js +0 -65
  614. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts +0 -4
  615. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map +0 -1
  616. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +0 -229
  617. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts +0 -4
  618. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +0 -1
  619. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +0 -938
  620. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts +0 -4
  621. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map +0 -1
  622. package/node_modules/micromark-core-commonmark/dev/lib/html-text.js +0 -783
  623. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts +0 -4
  624. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map +0 -1
  625. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +0 -658
  626. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts +0 -4
  627. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +0 -1
  628. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +0 -119
  629. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts +0 -4
  630. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +0 -1
  631. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +0 -71
  632. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts +0 -4
  633. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map +0 -1
  634. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.js +0 -34
  635. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts +0 -4
  636. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map +0 -1
  637. package/node_modules/micromark-core-commonmark/dev/lib/list.js +0 -306
  638. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +0 -4
  639. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +0 -1
  640. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +0 -67
  641. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts +0 -4
  642. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +0 -1
  643. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +0 -213
  644. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts +0 -4
  645. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map +0 -1
  646. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js +0 -120
  647. package/node_modules/micromark-core-commonmark/index.d.ts +0 -23
  648. package/node_modules/micromark-core-commonmark/index.d.ts.map +0 -1
  649. package/node_modules/micromark-core-commonmark/index.js +0 -22
  650. package/node_modules/micromark-core-commonmark/lib/attention.d.ts +0 -4
  651. package/node_modules/micromark-core-commonmark/lib/attention.d.ts.map +0 -1
  652. package/node_modules/micromark-core-commonmark/lib/attention.js +0 -231
  653. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts +0 -4
  654. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map +0 -1
  655. package/node_modules/micromark-core-commonmark/lib/autolink.js +0 -233
  656. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts +0 -4
  657. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map +0 -1
  658. package/node_modules/micromark-core-commonmark/lib/blank-line.js +0 -61
  659. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts +0 -4
  660. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map +0 -1
  661. package/node_modules/micromark-core-commonmark/lib/block-quote.js +0 -143
  662. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts +0 -4
  663. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map +0 -1
  664. package/node_modules/micromark-core-commonmark/lib/character-escape.js +0 -64
  665. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts +0 -4
  666. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map +0 -1
  667. package/node_modules/micromark-core-commonmark/lib/character-reference.js +0 -149
  668. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts +0 -4
  669. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +0 -1
  670. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +0 -422
  671. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts +0 -4
  672. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map +0 -1
  673. package/node_modules/micromark-core-commonmark/lib/code-indented.js +0 -159
  674. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts +0 -4
  675. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map +0 -1
  676. package/node_modules/micromark-core-commonmark/lib/code-text.js +0 -225
  677. package/node_modules/micromark-core-commonmark/lib/content.d.ts +0 -7
  678. package/node_modules/micromark-core-commonmark/lib/content.d.ts.map +0 -1
  679. package/node_modules/micromark-core-commonmark/lib/content.js +0 -163
  680. package/node_modules/micromark-core-commonmark/lib/definition.d.ts +0 -4
  681. package/node_modules/micromark-core-commonmark/lib/definition.d.ts.map +0 -1
  682. package/node_modules/micromark-core-commonmark/lib/definition.js +0 -254
  683. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts +0 -4
  684. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map +0 -1
  685. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +0 -60
  686. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts +0 -4
  687. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map +0 -1
  688. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +0 -191
  689. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts +0 -4
  690. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +0 -1
  691. package/node_modules/micromark-core-commonmark/lib/html-flow.js +0 -827
  692. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts +0 -4
  693. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map +0 -1
  694. package/node_modules/micromark-core-commonmark/lib/html-text.js +0 -678
  695. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts +0 -4
  696. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map +0 -1
  697. package/node_modules/micromark-core-commonmark/lib/label-end.js +0 -561
  698. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts +0 -4
  699. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +0 -1
  700. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +0 -110
  701. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts +0 -4
  702. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +0 -1
  703. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +0 -63
  704. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts +0 -4
  705. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map +0 -1
  706. package/node_modules/micromark-core-commonmark/lib/line-ending.js +0 -33
  707. package/node_modules/micromark-core-commonmark/lib/list.d.ts +0 -4
  708. package/node_modules/micromark-core-commonmark/lib/list.d.ts.map +0 -1
  709. package/node_modules/micromark-core-commonmark/lib/list.js +0 -213
  710. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +0 -4
  711. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +0 -1
  712. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +0 -61
  713. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts +0 -4
  714. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +0 -1
  715. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +0 -187
  716. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts +0 -4
  717. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map +0 -1
  718. package/node_modules/micromark-core-commonmark/lib/thematic-break.js +0 -102
  719. package/node_modules/micromark-core-commonmark/license +0 -22
  720. package/node_modules/micromark-core-commonmark/package.json +0 -62
  721. package/node_modules/micromark-core-commonmark/readme.md +0 -171
  722. package/node_modules/micromark-factory-destination/dev/index.d.ts +0 -42
  723. package/node_modules/micromark-factory-destination/dev/index.d.ts.map +0 -1
  724. package/node_modules/micromark-factory-destination/dev/index.js +0 -255
  725. package/node_modules/micromark-factory-destination/index.d.ts +0 -42
  726. package/node_modules/micromark-factory-destination/index.d.ts.map +0 -1
  727. package/node_modules/micromark-factory-destination/index.js +0 -206
  728. package/node_modules/micromark-factory-destination/license +0 -22
  729. package/node_modules/micromark-factory-destination/package.json +0 -57
  730. package/node_modules/micromark-factory-destination/readme.md +0 -234
  731. package/node_modules/micromark-factory-label/dev/index.d.ts +0 -37
  732. package/node_modules/micromark-factory-label/dev/index.d.ts.map +0 -1
  733. package/node_modules/micromark-factory-label/dev/index.js +0 -172
  734. package/node_modules/micromark-factory-label/index.d.ts +0 -37
  735. package/node_modules/micromark-factory-label/index.d.ts.map +0 -1
  736. package/node_modules/micromark-factory-label/index.js +0 -148
  737. package/node_modules/micromark-factory-label/license +0 -22
  738. package/node_modules/micromark-factory-label/package.json +0 -60
  739. package/node_modules/micromark-factory-label/readme.md +0 -224
  740. package/node_modules/micromark-factory-space/dev/index.d.ts +0 -60
  741. package/node_modules/micromark-factory-space/dev/index.d.ts.map +0 -1
  742. package/node_modules/micromark-factory-space/dev/index.js +0 -122
  743. package/node_modules/micromark-factory-space/index.d.ts +0 -60
  744. package/node_modules/micromark-factory-space/index.d.ts.map +0 -1
  745. package/node_modules/micromark-factory-space/index.js +0 -116
  746. package/node_modules/micromark-factory-space/license +0 -22
  747. package/node_modules/micromark-factory-space/package.json +0 -46
  748. package/node_modules/micromark-factory-space/readme.md +0 -225
  749. package/node_modules/micromark-factory-title/dev/index.d.ts +0 -36
  750. package/node_modules/micromark-factory-title/dev/index.d.ts.map +0 -1
  751. package/node_modules/micromark-factory-title/dev/index.js +0 -169
  752. package/node_modules/micromark-factory-title/index.d.ts +0 -36
  753. package/node_modules/micromark-factory-title/index.d.ts.map +0 -1
  754. package/node_modules/micromark-factory-title/index.js +0 -158
  755. package/node_modules/micromark-factory-title/license +0 -22
  756. package/node_modules/micromark-factory-title/package.json +0 -58
  757. package/node_modules/micromark-factory-title/readme.md +0 -229
  758. package/node_modules/micromark-factory-whitespace/dev/index.d.ts +0 -22
  759. package/node_modules/micromark-factory-whitespace/dev/index.d.ts.map +0 -1
  760. package/node_modules/micromark-factory-whitespace/dev/index.js +0 -53
  761. package/node_modules/micromark-factory-whitespace/index.d.ts +0 -22
  762. package/node_modules/micromark-factory-whitespace/index.d.ts.map +0 -1
  763. package/node_modules/micromark-factory-whitespace/index.js +0 -44
  764. package/node_modules/micromark-factory-whitespace/license +0 -22
  765. package/node_modules/micromark-factory-whitespace/package.json +0 -57
  766. package/node_modules/micromark-factory-whitespace/readme.md +0 -205
  767. package/node_modules/micromark-util-character/dev/index.d.ts +0 -195
  768. package/node_modules/micromark-util-character/dev/index.d.ts.map +0 -1
  769. package/node_modules/micromark-util-character/dev/index.js +0 -252
  770. package/node_modules/micromark-util-character/index.d.ts +0 -195
  771. package/node_modules/micromark-util-character/index.d.ts.map +0 -1
  772. package/node_modules/micromark-util-character/index.js +0 -246
  773. package/node_modules/micromark-util-character/license +0 -22
  774. package/node_modules/micromark-util-character/package.json +0 -57
  775. package/node_modules/micromark-util-character/readme.md +0 -446
  776. package/node_modules/micromark-util-chunked/dev/index.d.ts +0 -41
  777. package/node_modules/micromark-util-chunked/dev/index.d.ts.map +0 -1
  778. package/node_modules/micromark-util-chunked/dev/index.js +0 -89
  779. package/node_modules/micromark-util-chunked/index.d.ts +0 -41
  780. package/node_modules/micromark-util-chunked/index.d.ts.map +0 -1
  781. package/node_modules/micromark-util-chunked/index.js +0 -81
  782. package/node_modules/micromark-util-chunked/license +0 -22
  783. package/node_modules/micromark-util-chunked/package.json +0 -57
  784. package/node_modules/micromark-util-chunked/readme.md +0 -219
  785. package/node_modules/micromark-util-classify-character/dev/index.d.ts +0 -18
  786. package/node_modules/micromark-util-classify-character/dev/index.d.ts.map +0 -1
  787. package/node_modules/micromark-util-classify-character/dev/index.js +0 -38
  788. package/node_modules/micromark-util-classify-character/index.d.ts +0 -18
  789. package/node_modules/micromark-util-classify-character/index.d.ts.map +0 -1
  790. package/node_modules/micromark-util-classify-character/index.js +0 -27
  791. package/node_modules/micromark-util-classify-character/license +0 -22
  792. package/node_modules/micromark-util-classify-character/package.json +0 -59
  793. package/node_modules/micromark-util-classify-character/readme.md +0 -205
  794. package/node_modules/micromark-util-combine-extensions/index.d.ts +0 -22
  795. package/node_modules/micromark-util-combine-extensions/index.d.ts.map +0 -1
  796. package/node_modules/micromark-util-combine-extensions/index.js +0 -143
  797. package/node_modules/micromark-util-combine-extensions/license +0 -22
  798. package/node_modules/micromark-util-combine-extensions/package.json +0 -52
  799. package/node_modules/micromark-util-combine-extensions/readme.md +0 -201
  800. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts +0 -16
  801. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map +0 -1
  802. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js +0 -42
  803. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts +0 -16
  804. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map +0 -1
  805. package/node_modules/micromark-util-decode-numeric-character-reference/index.js +0 -32
  806. package/node_modules/micromark-util-decode-numeric-character-reference/license +0 -22
  807. package/node_modules/micromark-util-decode-numeric-character-reference/package.json +0 -59
  808. package/node_modules/micromark-util-decode-numeric-character-reference/readme.md +0 -184
  809. package/node_modules/micromark-util-decode-string/dev/index.d.ts +0 -14
  810. package/node_modules/micromark-util-decode-string/dev/index.d.ts.map +0 -1
  811. package/node_modules/micromark-util-decode-string/dev/index.js +0 -53
  812. package/node_modules/micromark-util-decode-string/index.d.ts +0 -14
  813. package/node_modules/micromark-util-decode-string/index.d.ts.map +0 -1
  814. package/node_modules/micromark-util-decode-string/index.js +0 -45
  815. package/node_modules/micromark-util-decode-string/license +0 -22
  816. package/node_modules/micromark-util-decode-string/package.json +0 -63
  817. package/node_modules/micromark-util-decode-string/readme.md +0 -179
  818. package/node_modules/micromark-util-edit-map/dev/index.d.ts +0 -78
  819. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +0 -1
  820. package/node_modules/micromark-util-edit-map/dev/index.js +0 -237
  821. package/node_modules/micromark-util-edit-map/index.d.ts +0 -78
  822. package/node_modules/micromark-util-edit-map/index.d.ts.map +0 -1
  823. package/node_modules/micromark-util-edit-map/index.js +0 -225
  824. package/node_modules/micromark-util-edit-map/license +0 -22
  825. package/node_modules/micromark-util-edit-map/package.json +0 -48
  826. package/node_modules/micromark-util-edit-map/readme.md +0 -234
  827. package/node_modules/micromark-util-encode/index.d.ts +0 -14
  828. package/node_modules/micromark-util-encode/index.d.ts.map +0 -1
  829. package/node_modules/micromark-util-encode/index.js +0 -33
  830. package/node_modules/micromark-util-encode/license +0 -22
  831. package/node_modules/micromark-util-encode/package.json +0 -47
  832. package/node_modules/micromark-util-encode/readme.md +0 -176
  833. package/node_modules/micromark-util-html-tag-name/index.d.ts +0 -30
  834. package/node_modules/micromark-util-html-tag-name/index.d.ts.map +0 -1
  835. package/node_modules/micromark-util-html-tag-name/index.js +0 -93
  836. package/node_modules/micromark-util-html-tag-name/license +0 -22
  837. package/node_modules/micromark-util-html-tag-name/package.json +0 -47
  838. package/node_modules/micromark-util-html-tag-name/readme.md +0 -193
  839. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts +0 -21
  840. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map +0 -1
  841. package/node_modules/micromark-util-normalize-identifier/dev/index.js +0 -38
  842. package/node_modules/micromark-util-normalize-identifier/index.d.ts +0 -21
  843. package/node_modules/micromark-util-normalize-identifier/index.d.ts.map +0 -1
  844. package/node_modules/micromark-util-normalize-identifier/index.js +0 -33
  845. package/node_modules/micromark-util-normalize-identifier/license +0 -22
  846. package/node_modules/micromark-util-normalize-identifier/package.json +0 -58
  847. package/node_modules/micromark-util-normalize-identifier/readme.md +0 -187
  848. package/node_modules/micromark-util-resolve-all/index.d.ts +0 -22
  849. package/node_modules/micromark-util-resolve-all/index.d.ts.map +0 -1
  850. package/node_modules/micromark-util-resolve-all/index.js +0 -32
  851. package/node_modules/micromark-util-resolve-all/license +0 -22
  852. package/node_modules/micromark-util-resolve-all/package.json +0 -48
  853. package/node_modules/micromark-util-resolve-all/readme.md +0 -238
  854. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts +0 -36
  855. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map +0 -1
  856. package/node_modules/micromark-util-sanitize-uri/dev/index.js +0 -124
  857. package/node_modules/micromark-util-sanitize-uri/index.d.ts +0 -36
  858. package/node_modules/micromark-util-sanitize-uri/index.d.ts.map +0 -1
  859. package/node_modules/micromark-util-sanitize-uri/index.js +0 -107
  860. package/node_modules/micromark-util-sanitize-uri/license +0 -22
  861. package/node_modules/micromark-util-sanitize-uri/package.json +0 -59
  862. package/node_modules/micromark-util-sanitize-uri/readme.md +0 -214
  863. package/node_modules/micromark-util-subtokenize/dev/index.d.ts +0 -12
  864. package/node_modules/micromark-util-subtokenize/dev/index.d.ts.map +0 -1
  865. package/node_modules/micromark-util-subtokenize/dev/index.js +0 -284
  866. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts +0 -161
  867. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map +0 -1
  868. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js +0 -288
  869. package/node_modules/micromark-util-subtokenize/index.d.ts +0 -12
  870. package/node_modules/micromark-util-subtokenize/index.d.ts.map +0 -1
  871. package/node_modules/micromark-util-subtokenize/index.js +0 -228
  872. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts +0 -161
  873. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map +0 -1
  874. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +0 -251
  875. package/node_modules/micromark-util-subtokenize/license +0 -22
  876. package/node_modules/micromark-util-subtokenize/package.json +0 -60
  877. package/node_modules/micromark-util-subtokenize/readme.md +0 -181
  878. package/node_modules/micromark-util-symbol/lib/codes.d.ts +0 -139
  879. package/node_modules/micromark-util-symbol/lib/codes.d.ts.map +0 -1
  880. package/node_modules/micromark-util-symbol/lib/codes.js +0 -158
  881. package/node_modules/micromark-util-symbol/lib/constants.d.ts +0 -37
  882. package/node_modules/micromark-util-symbol/lib/constants.d.ts.map +0 -1
  883. package/node_modules/micromark-util-symbol/lib/constants.js +0 -44
  884. package/node_modules/micromark-util-symbol/lib/default.d.ts +0 -5
  885. package/node_modules/micromark-util-symbol/lib/default.d.ts.map +0 -1
  886. package/node_modules/micromark-util-symbol/lib/default.js +0 -4
  887. package/node_modules/micromark-util-symbol/lib/types.d.ts +0 -106
  888. package/node_modules/micromark-util-symbol/lib/types.d.ts.map +0 -1
  889. package/node_modules/micromark-util-symbol/lib/types.js +0 -453
  890. package/node_modules/micromark-util-symbol/lib/values.d.ts +0 -102
  891. package/node_modules/micromark-util-symbol/lib/values.d.ts.map +0 -1
  892. package/node_modules/micromark-util-symbol/lib/values.js +0 -109
  893. package/node_modules/micromark-util-symbol/license +0 -22
  894. package/node_modules/micromark-util-symbol/package.json +0 -43
  895. package/node_modules/micromark-util-symbol/readme.md +0 -168
  896. package/node_modules/micromark-util-types/index.d.ts +0 -1315
  897. package/node_modules/micromark-util-types/index.js +0 -2
  898. package/node_modules/micromark-util-types/license +0 -22
  899. package/node_modules/micromark-util-types/package.json +0 -37
  900. package/node_modules/micromark-util-types/readme.md +0 -151
  901. package/node_modules/ms/index.js +0 -162
  902. package/node_modules/ms/license.md +0 -21
  903. package/node_modules/ms/package.json +0 -38
  904. package/node_modules/ms/readme.md +0 -59
  905. package/node_modules/unist-util-stringify-position/index.d.ts +0 -1
  906. package/node_modules/unist-util-stringify-position/index.js +0 -1
  907. package/node_modules/unist-util-stringify-position/lib/index.d.ts +0 -61
  908. package/node_modules/unist-util-stringify-position/lib/index.js +0 -84
  909. package/node_modules/unist-util-stringify-position/license +0 -22
  910. package/node_modules/unist-util-stringify-position/package.json +0 -80
  911. package/node_modules/unist-util-stringify-position/readme.md +0 -206
  912. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +0 -458
  913. package/packages/octo-runtime-extra-channel-wecom/config-schema.json +0 -276
  914. package/packages/octo-runtime-extra-webui/config-schema.json +0 -134
  915. /package/node_modules/@mininglamp-oss/{octo-runtime-extra-channel-gateway/dist/contracts.js → octo-runtime-adapter-sdk/dist/execution-scope.js} +0 -0
  916. /package/node_modules/@mininglamp-oss/{octo-runtime-extra-channel-gateway/dist/ports.js → octo-runtime-protocol/dist/adapter-metadata.js} +0 -0
@@ -1,1489 +0,0 @@
1
- import { shutdownDeadline, withinShutdown } from "@mininglamp-oss/octo-runtime-host-sdk/shutdown";
2
- /**
3
- * 单 Bot 编排:把授权 IM 消息转换为有界任务,并把公开结果投递回原会话。
4
- * 管理会话、排队、取消和交互归属;平台协议交给 connector,领域业务交给发起方。
5
- */
6
- import { randomUUID } from "node:crypto";
7
- import { assertModelInputParts, assertSessionName, failurePayload, failureMessage } from "@mininglamp-oss/octo-runtime-protocol";
8
- import { ImImageInputError } from "../transport/image-input.js";
9
- import { performance } from "node:perf_hooks";
10
- import { imBotIdentity, validateImConfig } from "../lifecycle/configuration.js";
11
- import { GatewayTransport } from "../transport/channel.js";
12
- import { createImInvocation } from "../execution/dispatcher.js";
13
- import { ImTask } from "../execution/task.js";
14
- import { MODEL_WAIT_TIMEOUT_MESSAGE } from "../execution/model-wait.js";
15
- import { ImDeliveryIdentity } from "../delivery/identity.js";
16
- import { ImDeliveryDispatcher } from "../delivery/dispatcher.js";
17
- import { ImRunProjector } from "../presentation/run-projector.js";
18
- import { MemoryImSessionStore } from "./session-store.js";
19
- import { addRulesRecovery, selectRulesContext } from "./rules-context.js";
20
- import { planStableContext } from "./stable-context.js";
21
- import { groupScope } from "../transport/normalize.js";
22
- import { connectionFailure, ImConnectionError } from "../transport/connection-error.js";
23
- import { commitHistoryGap, gapMetadata, planHistoryGap, validMessageSeq } from "./context-gap.js";
24
- function readableSessionName(message, current) {
25
- if (current !== undefined) {
26
- try {
27
- assertSessionName(current);
28
- return current;
29
- }
30
- catch {
31
- // 修复旧版本已保存的非法展示名称,不触碰业务身份和原生恢复句柄。
32
- }
33
- }
34
- // 每个地址片段最多 80 个码点,最长群话题名称(含 UUID)不超过 215 个码点。
35
- const displayPart = (value) => [...value]
36
- .slice(0, 80)
37
- .map((character) => {
38
- const code = character.charCodeAt(0);
39
- return code < 32 || (code >= 127 && code <= 159) ? "-" : character;
40
- })
41
- .join("") || "unknown";
42
- const suffix = randomUUID();
43
- const scope = groupScope(message.conversationId);
44
- const name = message.conversationKind === "direct"
45
- ? `octo-dm-${displayPart(message.conversationId)}-${suffix}`
46
- : message.conversationKind === "thread"
47
- ? `octo-group-${displayPart(scope.groupNo)}-topic-${displayPart(scope.shortId ?? message.conversationId)}-${suffix}`
48
- : `octo-group-${displayPart(message.conversationId)}-${suffix}`;
49
- assertSessionName(name);
50
- return name;
51
- }
52
- // 仅精确匹配已定义的准备期原因;未知异常正文不得进入回复或新增诊断。
53
- const preparationFailureMessages = new Map([
54
- ["IM_AGENT_WORKDIR_FIXED", "本轮工作目录与固定目录配置冲突,尚未发起执行。请检查工作目录配置。"],
55
- ["IM_RULE_PROTOCOL_INVALID", "规则数据格式不符合协议,尚未发起执行。请检查规则服务返回格式。"]
56
- ]);
57
- export class ImRuntime {
58
- dependencies;
59
- #processEpoch = randomUUID();
60
- #preparing = new Map();
61
- #finalDeliveries = new Map();
62
- config;
63
- #connector;
64
- #delivery;
65
- #cardDelivery;
66
- #deliveryIdentity;
67
- // 仅保存已核验 Bot/空间的凭据;候选值核验期间 REST 继续使用旧值,不等待 WS。
68
- #restToken;
69
- #sessions = new Map();
70
- #sessionStore;
71
- #seen = new Map();
72
- #queuedOccurrences = new Set();
73
- #tasks = new Map();
74
- #interactions = new Map();
75
- #responding = new Set();
76
- #closed = true;
77
- #draining = false;
78
- #ownerStopped;
79
- #drainErrors = [];
80
- #finishIncomplete;
81
- #state = "stopped";
82
- #reconnect;
83
- #connecting;
84
- #abort = new AbortController();
85
- #signal = this.#abort.signal;
86
- #closing;
87
- #connectionAbort;
88
- #error;
89
- #working = 0;
90
- #busyNotifications = new Map();
91
- #failureNotifications = new Map();
92
- #busyNotifiedAt = new Map();
93
- #retry = 0;
94
- #backoff = 0;
95
- #fastRetriesRemaining = 0;
96
- #disconnecting;
97
- constructor(config, dependencies) {
98
- this.dependencies = dependencies;
99
- validateImConfig(config);
100
- this.config = structuredClone(config);
101
- this.config.bot_name ??= this.config.bot_id;
102
- this.#sessionStore = dependencies.sessions ?? new MemoryImSessionStore();
103
- }
104
- get status() {
105
- return {
106
- ...this.#connector?.status,
107
- connection_key: imBotIdentity(this.config),
108
- type: "octo",
109
- bot_name: this.config.bot_name,
110
- enabled: this.config.enabled !== false,
111
- botId: this.#connector?.botId,
112
- connected: this.#state === "online",
113
- state: this.#state,
114
- error: this.#error ?? null,
115
- deliveries: this.#delivery?.receiptCount ?? 0,
116
- workingTasks: this.#working,
117
- queuedTasks: [...this.#sessions.values()].reduce((sum, session) => sum + Math.max(0, session.pending - 1), 0),
118
- sessions: [...this.#sessions.values()].map((session) => ({
119
- sessionId: session.id,
120
- generation: session.generation,
121
- runId: session.lastRunId,
122
- eventId: session.lastEventId,
123
- active: !!session.activeInvocationId
124
- })),
125
- tasks: [...this.#tasks.values()].map(({ task }) => ({
126
- runId: task.request.runId,
127
- attempts: task.attempts.map((attempt) => ({ ...attempt })),
128
- stopReason: task.stopReason
129
- }))
130
- };
131
- }
132
- async start() {
133
- if (this.#closing)
134
- await this.#closing;
135
- this.dependencies.signal?.throwIfAborted();
136
- if (this.config.enabled === false)
137
- return;
138
- if (!this.#closed && this.#state !== "failed")
139
- return this.#connecting;
140
- if (this.#connecting)
141
- return this.#connecting;
142
- if (this.#closed) {
143
- this.#closed = false;
144
- this.#draining = false;
145
- this.#drainErrors.length = 0;
146
- this.#closing = undefined;
147
- this.#abort = new AbortController();
148
- this.#signal = this.#abort.signal;
149
- this.#ownerStopped = () => {
150
- if (!this.#closed)
151
- void this.close().catch(() => this.#diagnostic("IM_DISPOSE_FAILED"));
152
- };
153
- this.dependencies.signal?.addEventListener("abort", this.#ownerStopped, { once: true });
154
- this.#delivery = new ImDeliveryDispatcher(this.#signal);
155
- // 卡片/文件回执归 Bot,跨 WS 恢复复用同一有界缓存;与文本回执分开统计。
156
- this.#cardDelivery = new ImDeliveryDispatcher(this.#signal);
157
- this.#deliveryIdentity = new ImDeliveryIdentity();
158
- this.#restToken = undefined;
159
- }
160
- this.#retry = 0;
161
- this.#backoff = 0;
162
- this.#fastRetriesRemaining = 0;
163
- this.#error = undefined;
164
- this.#state = "connecting";
165
- this.#connecting = this.#connect(false);
166
- try {
167
- await this.#connecting;
168
- }
169
- finally {
170
- this.#connecting = undefined;
171
- }
172
- }
173
- async #connect(recovering) {
174
- if (this.#closed || this.#draining || this.#signal.aborted)
175
- return;
176
- this.#log(recovering ? "channel.retry_started" : "channel.connecting", {
177
- attempt: this.#retry
178
- });
179
- // 只回收单次 WS;Bot 持有的 REST 凭据及任务展示不随连接清理暂停。
180
- this.#connectionAbort?.abort();
181
- try {
182
- await this.#disconnecting;
183
- await this.#connector?.close();
184
- }
185
- catch {
186
- this.#state = this.#closed ? "stopped" : "failed";
187
- if (!this.#closed)
188
- this.#error = "IM_DISPOSE_FAILED";
189
- this.#diagnostic("IM_DISPOSE_FAILED");
190
- return;
191
- }
192
- if (this.#closed || this.#draining || this.#signal.aborted)
193
- return;
194
- this.#connectionAbort = new AbortController();
195
- const signal = AbortSignal.any([this.#signal, this.#connectionAbort.signal]);
196
- let starting = true;
197
- let disconnected;
198
- const credentials = async (config, signal) => {
199
- const token = await (this.dependencies.credentials
200
- ? this.dependencies.credentials(config, signal)
201
- : Promise.resolve(config.bf_token));
202
- signal.throwIfAborted();
203
- return token;
204
- };
205
- const connector = new GatewayTransport(this.config, credentials, {
206
- authorizeSpace: this.dependencies.authorizeSpace,
207
- onPosition: (position) => {
208
- if (connector === this.#connector && !signal.aborted)
209
- this.#observePosition(position);
210
- },
211
- onTaskPosition: (position) => {
212
- // 原任务目标身份生成 key;重连中 current connector 可能尚未核验空间。
213
- if (!this.#signal.aborted)
214
- this.#observePosition(position, this.#key(position, connector.identity));
215
- },
216
- onRulesChanged: (change) => {
217
- if (connector !== this.#connector || signal.aborted)
218
- return;
219
- this.#invalidateRules(change);
220
- },
221
- onMessage: (message) => {
222
- if (connector === this.#connector && !signal.aborted)
223
- this.#receive(message);
224
- },
225
- onDiagnostic: (code) => {
226
- if (connector === this.#connector && !signal.aborted)
227
- this.#diagnostic(code);
228
- },
229
- onDisconnect: (code, retryable = true) => {
230
- if (connector !== this.#connector || this.#closed || signal.aborted)
231
- return;
232
- if (disconnected)
233
- return;
234
- disconnected = new ImConnectionError(code, retryable);
235
- if (!starting)
236
- this.#lostConnection(connector, disconnected);
237
- }
238
- }, {
239
- signal: this.#signal,
240
- dispatcher: this.#cardDelivery,
241
- identity: this.#deliveryIdentity,
242
- token: () => this.#restToken,
243
- acceptToken: (token) => {
244
- this.#restToken = token;
245
- }
246
- });
247
- this.#connector = connector;
248
- try {
249
- await connector.start(signal);
250
- if (signal.aborted) {
251
- await connector.close();
252
- return;
253
- }
254
- if (disconnected)
255
- throw disconnected;
256
- starting = false;
257
- this.#state = "online";
258
- this.#log("channel.connected", { state: "online" });
259
- this.#error = undefined;
260
- this.#retry = 0;
261
- this.#backoff = 0;
262
- this.#fastRetriesRemaining = 0;
263
- }
264
- catch (error) {
265
- if (signal.aborted)
266
- return;
267
- starting = false;
268
- const failure = connectionFailure(error);
269
- // 注册/WS 握手失败只影响连接恢复,不撤销 Bot 已持有的 REST 凭据。
270
- this.#connectionAbort.abort();
271
- this.#error = failure.message;
272
- // 首次离线与后续断线共用恢复;服务端断开不等于永久拒绝,由传输分类决定资格。
273
- const retry = failure.retryable;
274
- this.#state = retry ? "retrying" : "failed";
275
- this.#log("channel.connection_failed", { state: this.#state, code: failure.message });
276
- try {
277
- await connector.close();
278
- }
279
- catch {
280
- if (!this.#closed)
281
- this.#state = "failed";
282
- this.#diagnostic("IM_DISPOSE_FAILED");
283
- return;
284
- }
285
- if (retry)
286
- this.#scheduleReconnect(failure.retryAfterMs);
287
- }
288
- }
289
- #lostConnection(connector, failure) {
290
- this.#error = failure.message;
291
- const retry = failure.retryable;
292
- this.#state = retry ? "retrying" : "failed";
293
- this.#log("channel.disconnected", { state: this.#state, code: failure.message });
294
- this.#connectionAbort?.abort();
295
- // 确认断线即退出 online;立即重连后追加最多十次 1 秒重试,覆盖换网恢复间隙。
296
- // 关闭和旧回调不能再创建连接,回收失败须单独诊断,不能以加速为由重叠连接。
297
- this.#disconnecting = connector.close();
298
- void this.#disconnecting.then(() => {
299
- if (retry) {
300
- this.#fastRetriesRemaining = 10;
301
- this.#scheduleReconnect(failure.retryAfterMs, true);
302
- }
303
- }, () => {
304
- if (!this.#closed)
305
- this.#state = "failed";
306
- this.#diagnostic("IM_DISPOSE_FAILED");
307
- });
308
- }
309
- #scheduleReconnect(retryAfterMs = 0, immediate = false) {
310
- if (this.#closed ||
311
- this.#draining ||
312
- this.#signal.aborted ||
313
- this.#state !== "retrying" ||
314
- this.#reconnect)
315
- return;
316
- // 快速重试仅用于上线后的断线恢复,不消耗常规退避档位;Retry-After 仍优先。
317
- // 每次失败回收完成才安排下一次,慢握手或休眠恢复不会堆积并发连接。
318
- const fast = !immediate && this.#fastRetriesRemaining > 0;
319
- const baseDelayMs = immediate ? 0 : fast ? 1_000 : [5_000, 10_000, 15_000][this.#backoff];
320
- const delayMs = Math.max(baseDelayMs, retryAfterMs);
321
- this.#retry = Math.min(Number.MAX_SAFE_INTEGER, this.#retry + 1);
322
- if (fast)
323
- this.#fastRetriesRemaining--;
324
- else if (!immediate)
325
- this.#backoff = Math.min(2, this.#backoff + 1);
326
- this.#log("channel.retry_scheduled", {
327
- state: "retrying",
328
- delay_ms: delayMs,
329
- attempt: this.#retry
330
- });
331
- // Node clamps oversized timers to 1ms. Partition long Retry-After waits without bypassing throttling.
332
- const deadline = performance.now() + delayMs;
333
- const wake = () => {
334
- if (this.#closed || this.#draining || this.#signal.aborted || this.#state !== "retrying")
335
- return;
336
- const remaining = deadline - performance.now();
337
- if (remaining > 0) {
338
- this.#reconnect = setTimeout(wake, Math.min(remaining, 2_147_483_647));
339
- this.#reconnect.unref();
340
- return;
341
- }
342
- this.#reconnect = undefined;
343
- this.#connecting = this.#connect(true).finally(() => {
344
- this.#connecting = undefined;
345
- });
346
- };
347
- this.#reconnect = setTimeout(wake, Math.min(delayMs, 2_147_483_647));
348
- this.#reconnect.unref();
349
- }
350
- #diagnostic(code, runId, data = {}) {
351
- try {
352
- this.dependencies.log?.("warn", "channel.diagnostic", {
353
- code,
354
- ...data,
355
- endpoint_id: imBotIdentity(this.config),
356
- ...(runId ? { run_id: runId } : {})
357
- });
358
- this.dependencies.onDiagnostic?.(code, {
359
- endpointId: imBotIdentity(this.config),
360
- ...(runId ? { runId } : {})
361
- });
362
- }
363
- catch {
364
- /* Diagnostics cannot fail execution. */
365
- }
366
- }
367
- #log(event, data = {}) {
368
- try {
369
- this.dependencies.log?.("info", event, { endpoint_id: imBotIdentity(this.config), ...data });
370
- }
371
- catch {
372
- /* 诊断不改变业务结果。 */
373
- }
374
- }
375
- #finalizationFailed(code, runId) {
376
- if (this.#draining)
377
- this.#drainErrors.push(new Error(code));
378
- this.#diagnostic(code, runId);
379
- }
380
- #key(message, identity = this.#connector.identity) {
381
- return [
382
- identity,
383
- imBotIdentity(this.config),
384
- this.config.adapter.adapter_type ?? "",
385
- message.conversationKind,
386
- message.conversationId
387
- ]
388
- .map(encodeURIComponent)
389
- .join("/");
390
- }
391
- #observePosition(position, key = this.#key(position)) {
392
- if (this.#closed || !validMessageSeq(position.messageSeq))
393
- return;
394
- try {
395
- const binding = this.#sessionStore.read(key);
396
- if (!binding?.id || !this.#sessionStore.patchGap)
397
- return;
398
- if (position.own &&
399
- (!position.turn ||
400
- position.turn.processEpoch !== this.#processEpoch ||
401
- position.turn.sessionId !== binding.id ||
402
- position.turn.generation !== binding.generation))
403
- return;
404
- this.#sessionStore.patchGap(key, { sessionId: binding.id, generation: binding.generation }, (previous) => {
405
- const next = gapMetadata(this.#processEpoch, previous);
406
- next.latestObservedSeq = Math.max(next.latestObservedSeq ?? 0, position.messageSeq);
407
- next.observationVisibility = "partial";
408
- if (position.own)
409
- next.localOutputSeqs = [...new Set([...next.localOutputSeqs, position.messageSeq])]
410
- .sort((left, right) => left - right)
411
- .slice(-32);
412
- const providerSessionId = position.turn?.providerSessionId;
413
- if (position.own &&
414
- position.outputFingerprint &&
415
- providerSessionId &&
416
- binding.providerSession?.sessionId === providerSessionId) {
417
- const previous = next.assistantOutputs?.providerSessionId === providerSessionId
418
- ? next.assistantOutputs.messages
419
- : [];
420
- next.assistantOutputs = {
421
- providerSessionId,
422
- messages: [
423
- ...previous.filter((entry) => entry.seq !== position.messageSeq),
424
- { seq: position.messageSeq, fingerprint: position.outputFingerprint }
425
- ]
426
- .sort((left, right) => left.seq - right.seq)
427
- .slice(-32)
428
- };
429
- }
430
- return next;
431
- });
432
- }
433
- catch {
434
- this.#finalizationFailed("IM_HISTORY_POSITION_UNAVAILABLE");
435
- }
436
- }
437
- #invalidateRules(change) {
438
- try {
439
- this.#sessionStore.invalidateRules?.((key) => {
440
- const parts = key.split("/");
441
- const kind = decodeURIComponent(parts.at(-2) ?? "");
442
- const id = decodeURIComponent(parts.at(-1) ?? "");
443
- if (kind !== "group" && kind !== "thread")
444
- return false;
445
- if (key !== this.#key({ conversationKind: kind, conversationId: id }))
446
- return false;
447
- const scope = groupScope(id);
448
- return (scope.groupNo === change.groupNo &&
449
- (!change.shortId || (kind === "thread" && scope.shortId === change.shortId)));
450
- });
451
- }
452
- catch {
453
- this.#finalizationFailed("IM_RULES_STATE_UNAVAILABLE");
454
- }
455
- }
456
- #finishRules(key, session, revision, versions, completed) {
457
- if (this.#closed || !session.id)
458
- return;
459
- try {
460
- const provider = this.#sessionStore.read(key)?.providerSession;
461
- this.#sessionStore.patchRules?.(key, { sessionId: session.id, generation: session.generation }, (current) => {
462
- const latest = current?.revision ?? 0;
463
- // 成功确认前重读状态;旧任务不得清除运行期间到达的更新通知。
464
- if (completed && versions && provider?.sessionId && provider.resumable !== false) {
465
- if (latest !== revision)
466
- return undefined;
467
- return { revision, supplied: { ...versions, providerSessionId: provider.sessionId } };
468
- }
469
- return { revision: latest };
470
- });
471
- }
472
- catch {
473
- this.#finalizationFailed("IM_RULES_STATE_UNAVAILABLE");
474
- }
475
- }
476
- #receive(message) {
477
- if (this.#closed ||
478
- this.#draining ||
479
- (this.config.allowed_sender_ids && !this.config.allowed_sender_ids.includes(message.senderId)))
480
- return;
481
- const now = Date.now();
482
- for (const [id, expiry] of this.#seen)
483
- if (expiry <= now)
484
- this.#seen.delete(id);
485
- const key = this.#key(message), dedupe = `${key}/${encodeURIComponent(message.messageId)}`;
486
- if (this.#seen.has(dedupe))
487
- return;
488
- if (this.#seen.size >= 4096 || Buffer.byteLength(message.text) > 64 * 1024) {
489
- this.#diagnostic("IM_INBOUND_CAPACITY_EXHAUSTED");
490
- return;
491
- }
492
- this.#seen.set(dedupe, now + 120_000);
493
- const command = message.text.trim();
494
- // null 表示 Gateway 已拒绝控制授权;不能用 ?? 回退原文,避免广播裸命令绕过。
495
- const sessionControl = message.sessionControl === undefined ? command : message.sessionControl;
496
- if (/^\/(approve|decline|respond)\s/.test(command)) {
497
- void this.#respond(message, key).catch(() => this.#diagnostic("IM_INTERACTION_RESPONSE_FAILED"));
498
- return;
499
- }
500
- let session;
501
- // 只有 read 的同步失败属于执行前存储故障,排队、控制及后续保存不进入此分类。
502
- try {
503
- session = this.#session(key);
504
- }
505
- catch {
506
- const failure = failurePayload({ code: "IM_SESSION_STORE_FAILED" }, {
507
- stage: "channel_session_read",
508
- defaultDomain: "runtime"
509
- }).failure;
510
- void this.#notifyFailure(message, failure).finally(() => this.#seen.delete(dedupe));
511
- return;
512
- }
513
- try {
514
- if (sessionControl === "/reset" || sessionControl === "/new") {
515
- try {
516
- const binding = this.#sessionStore.reset(key, message.messageId);
517
- this.#finalDeliveries.get(key)?.abort();
518
- this.#tasks.get(key)?.task.stopRetries();
519
- session.id = binding.id;
520
- session.sessionName = binding.sessionName;
521
- session.generation = binding.generation;
522
- session.providerSession = binding.providerSession;
523
- session.initialization = { attempted: false };
524
- session.stableContext = { turnCount: 0, refreshPending: true };
525
- session.lastRunId = undefined;
526
- void this.#reply(message, "会话已经重置", `control:${message.messageId}`, true).catch(() => {
527
- this.#seen.delete(dedupe);
528
- this.#diagnostic("IM_RESET_REPLY_FAILED");
529
- });
530
- }
531
- catch {
532
- this.#seen.delete(dedupe);
533
- void this.#reply(message, "会话重置失败,请重试。", `reset-failed:${message.messageId}`).catch(() => this.#diagnostic("IM_RESET_FAILED"));
534
- }
535
- return;
536
- }
537
- if (sessionControl === "/stop" || command === "/cancel") {
538
- // 控制命令绕过普通消息队列,否则 stop 会排在待取消的长任务之后。
539
- const preparation = this.#preparing.get(key);
540
- preparation?.abort();
541
- const delivery = this.#finalDeliveries.get(key);
542
- delivery?.abort();
543
- const invocationId = session.activeInvocationId;
544
- void (async () => {
545
- const task = this.#tasks.get(key)?.task;
546
- const cancelled = preparation || delivery
547
- ? true
548
- : task
549
- ? await task.cancel()
550
- : invocationId
551
- ? (await this.dependencies.kernel.cancelInvocation(invocationId, "IM user stop"))
552
- .accepted
553
- : false;
554
- await this.#reply(message, cancelled ? "已请求停止本轮执行。" : "当前没有可停止的执行。", `control:${message.messageId}`);
555
- })().catch(() => this.#diagnostic("IM_CANCEL_FAILED"));
556
- return;
557
- }
558
- this.#enqueue(message, key);
559
- }
560
- catch {
561
- this.#seen.delete(dedupe);
562
- this.#diagnostic("IM_INBOUND_PROCESSING_FAILED");
563
- }
564
- finally {
565
- if (session)
566
- this.#releaseSession(key, session);
567
- }
568
- }
569
- #session(key) {
570
- let session = this.#sessions.get(key);
571
- if (!session) {
572
- const binding = this.#sessionStore.read(key);
573
- session = {
574
- generation: 1,
575
- ...binding,
576
- initialization: { attempted: binding?.initialContextPrepared === true },
577
- stableContext: binding?.stableContext ?? { turnCount: 0, refreshPending: true },
578
- pending: 0,
579
- tail: Promise.resolve()
580
- };
581
- this.#sessions.set(key, session);
582
- }
583
- return session;
584
- }
585
- #releaseSession(key, session) {
586
- if (!session.pending && !session.activeInvocationId && this.#sessions.get(key) === session)
587
- this.#sessions.delete(key);
588
- }
589
- #runControls(message, key, invocationId) {
590
- const controls = {
591
- failed: false,
592
- respond: async (response) => {
593
- if (this.#tasks.get(key)?.rootInvocationId !== invocationId)
594
- throw Error("IM_INTERACTION_STALE_RUN");
595
- await this.#submitInteraction(key, message.senderId, response);
596
- },
597
- cancel: async () => !this.#draining &&
598
- this.#tasks.get(key)?.rootInvocationId === invocationId &&
599
- (await this.#tasks.get(key).task.cancel("IM card stop")),
600
- retry: (senderId, id) => {
601
- if (!controls.failed)
602
- return false;
603
- const saved = this.#sessionStore.occurrence(key, message.messageId)?.snapshot;
604
- if (!saved)
605
- return false;
606
- const binding = this.#sessionStore.read(key);
607
- if (saved.sessionId !== binding?.id || saved.sessionGeneration !== binding.generation)
608
- return this.#enqueue({ ...message, senderId }, key, id);
609
- const images = saved.inputs.filter((part) => part.type === "image");
610
- return this.#enqueue({
611
- ...message,
612
- senderId,
613
- historyRetry: true,
614
- frozenArtifacts: this.#sessionStore.occurrence(key, message.messageId)?.artifacts,
615
- runMetadata: saved.runMetadata,
616
- buildContext: () => Promise.resolve(structuredClone(saved.contexts)),
617
- ...(images.length
618
- ? { buildInputs: () => Promise.resolve(structuredClone(images)) }
619
- : {})
620
- }, key, id);
621
- }
622
- };
623
- return controls;
624
- }
625
- #enqueue(message, key, occurrenceId) {
626
- if (this.#closed || this.#draining || this.#signal.aborted)
627
- return false;
628
- const id = occurrenceId ?? message.messageId;
629
- const queuedKey = JSON.stringify([key, id]);
630
- if (this.#queuedOccurrences.has(queuedKey))
631
- return false;
632
- const previous = this.#sessionStore.occurrence(key, id);
633
- if (previous) {
634
- void this.#reply(message, previous.text === message.text
635
- ? previous.notSubmittedFailure
636
- ? `原消息尚未提交,请修复故障后重新发送。\n错误码:${previous.notSubmittedFailure.code}\n诊断编号:${previous.notSubmittedFailure.diagnosticId}`
637
- : "该消息已经提交,请查看原执行结果。"
638
- : "消息身份冲突,请重新发送。", `duplicate:${id}`);
639
- return false;
640
- }
641
- const session = this.#session(key);
642
- try {
643
- // Octospec F26: .octospec/tasks/gateway-august-feature-assessment/assessment.md
644
- // 每个非空 session 占一个工作槽位;结束清理后原子交给同 session 的下一条。
645
- // 排队另计四条,不把 Bot 的工作数与所有排队消息混加。
646
- // 只有空闲 session 需要申请新槽;Bot 满载不阻止已有工作 session 排队。
647
- const full = session.pending >= 5
648
- ? "IM_SESSION_QUEUE_FULL"
649
- : session.pending === 0 && this.#working >= 64
650
- ? "IM_BOT_WORKING_FULL"
651
- : undefined;
652
- if (full) {
653
- this.#busy(message, key, full);
654
- return false;
655
- }
656
- if (message.text.trim() !== "/session" && !session.id) {
657
- const binding = {
658
- id: `as_${randomUUID()}`,
659
- generation: session.generation,
660
- initialContextPrepared: session.initialization?.attempted === true
661
- };
662
- this.#sessionStore.save(key, binding);
663
- session.id = binding.id;
664
- }
665
- if (message.text.trim() !== "/session") {
666
- const name = readableSessionName(message, session.sessionName);
667
- if (name !== session.sessionName) {
668
- session.sessionName = name;
669
- this.#saveBinding(key, session);
670
- }
671
- }
672
- const executionSession = { ...session };
673
- const frozenMessage = {
674
- ...message,
675
- ...(message.position ? { position: { ...message.position } } : {})
676
- };
677
- this.#queuedOccurrences.add(queuedKey);
678
- if (session.pending++ === 0)
679
- this.#working++;
680
- session.tail = session.tail
681
- .then(() => this.#turn(frozenMessage, key, session, occurrenceId, executionSession))
682
- .catch(() => this.#diagnostic("IM_TURN_FAILED"))
683
- .finally(() => {
684
- this.#queuedOccurrences.delete(queuedKey);
685
- session.pending--;
686
- if (session.pending === 0)
687
- this.#working--;
688
- this.#releaseSession(key, session);
689
- });
690
- return true;
691
- }
692
- finally {
693
- this.#releaseSession(key, session);
694
- }
695
- }
696
- #busy(message, key, code) {
697
- this.#diagnostic(code);
698
- const now = Date.now();
699
- if (this.#busyNotifications.has(key) ||
700
- this.#busyNotifications.size >= 64 ||
701
- now - (this.#busyNotifiedAt.get(key) ?? 0) < 1000)
702
- return;
703
- this.#busyNotifiedAt.set(key, now);
704
- if (this.#busyNotifiedAt.size > 128)
705
- this.#busyNotifiedAt.delete(this.#busyNotifiedAt.keys().next().value);
706
- const payload = failurePayload({ code }, {
707
- stage: "channel_admission",
708
- defaultDomain: "runtime",
709
- source: { component: "octo-runtime" }
710
- });
711
- const event = {
712
- protocolVersion: 2,
713
- type: "run.failed",
714
- payload: {
715
- ...payload,
716
- message: `当前智能体繁忙,请稍后再试。本条消息未受理,尚未开始执行。${code === "IM_SESSION_QUEUE_FULL" ? "单 session 排队已满。" : "Bot 工作并发已满。"}`
717
- }
718
- };
719
- const effect = `busy:${message.messageId}`;
720
- const notification = Promise.allSettled([
721
- Promise.resolve().then(() => message.replyFailure?.(event, effect, {
722
- signal: this.#signal,
723
- obsolete: () => this.#closed || this.#signal.aborted
724
- })),
725
- this.#reply(message, `当前智能体繁忙,请稍后再试\n错误码:${payload.failure.code}`, `${effect}:text`)
726
- ])
727
- .then((results) => {
728
- if (results.some((result) => result.status === "rejected"))
729
- this.#diagnostic("IM_BUSY_NOTIFICATION_FAILED");
730
- })
731
- .finally(() => {
732
- this.#busyNotifications.delete(key);
733
- });
734
- this.#busyNotifications.set(key, notification);
735
- }
736
- /** 独立错误展示不复用已坏的 presentation;共享有界投递,迟到失败不触发再次执行或递归通知。 */
737
- #notifyFailure(message, failure, identity, retry = false, turnSignal) {
738
- const data = {
739
- code: failure.code,
740
- reason_code: failure.reasonCode,
741
- diagnostic_id: failure.diagnosticId,
742
- stage: failure.stage,
743
- failure_component: failure.source.component,
744
- occurred_at: failure.occurredAt,
745
- ...(failure.source.adapter ? { adapter_type: failure.source.adapter } : {}),
746
- ...(identity ? { invocation_id: identity.invocationId, session_id: identity.sessionId } : {})
747
- };
748
- this.#diagnostic(failure.reasonCode, identity?.runId, data);
749
- if (this.#failureNotifications.size >= 64 || this.#closed || !this.#delivery)
750
- return Promise.resolve();
751
- const until = shutdownDeadline(this.dependencies.signal);
752
- const effect = `failure:${message.messageId}:${failure.diagnosticId}`;
753
- const text = `${retry ? "本次重试未提交,之前的执行记录仍须核查。" : failureMessage(failure.code)}\n错误码:${failure.code}\n诊断编号:${failure.diagnosticId}`;
754
- const event = {
755
- protocolVersion: 2,
756
- type: "run.failed",
757
- payload: { code: failure.reasonCode, message: text, failure }
758
- };
759
- const delivery = this.#delivery;
760
- const options = { transient: true, obsolete: () => this.#closed || performance.now() >= until };
761
- const deliveryOptions = {
762
- signal: AbortSignal.any([
763
- this.#signal,
764
- ...(turnSignal ? [turnSignal] : []),
765
- ...(Number.isFinite(until)
766
- ? [AbortSignal.timeout(Math.max(0, Math.ceil(until - performance.now())))]
767
- : [])
768
- ]),
769
- obsolete: () => options.obsolete() || Boolean(turnSignal?.aborted)
770
- };
771
- const secondary = (code) => {
772
- this.#diagnostic(code, identity?.runId, {
773
- ...data,
774
- code,
775
- reason_code: code,
776
- primary_code: failure.code
777
- });
778
- if (this.#draining)
779
- this.#drainErrors.push(new Error(code));
780
- };
781
- const send = async (operation, key) => {
782
- const receipt = await delivery.deliver(key, operation, options);
783
- if (turnSignal?.aborted)
784
- return;
785
- if (receipt.state !== "delivered")
786
- secondary(receipt.code ?? "IM_DELIVERY_FAILED");
787
- };
788
- const notification = withinShutdown(Promise.allSettled([
789
- ...(message.replyFailure
790
- ? [send(() => message.replyFailure(event, effect, deliveryOptions), effect)]
791
- : []),
792
- send(() => message.reply(text, `${effect}:text`, deliveryOptions), `${effect}:text`)
793
- ]), until, "IM_DELIVERY_UNKNOWN")
794
- .then(() => undefined)
795
- .catch(() => secondary("IM_DELIVERY_UNKNOWN"))
796
- .finally(() => this.#failureNotifications.delete(failure.diagnosticId));
797
- this.#failureNotifications.set(failure.diagnosticId, notification);
798
- return notification;
799
- }
800
- async #reply(message, text, effectKey, requireDelivered = false, final = false, finalOptions, runId) {
801
- if (this.#closed || this.#signal.aborted || !this.#delivery)
802
- return;
803
- const receipt = await this.#delivery.deliver(effectKey, () => final && message.replyFinal
804
- ? message.replyFinal(text, effectKey, finalOptions)
805
- : message.reply(text, effectKey, finalOptions), {
806
- obsolete: finalOptions ? () => finalOptions.obsolete() : undefined,
807
- ...(finalOptions ? { attempts: 4 } : {})
808
- });
809
- if (finalOptions?.obsolete())
810
- return;
811
- if (receipt.state !== "delivered") {
812
- if (this.#draining)
813
- this.#drainErrors.push(new Error(receipt.code ?? "IM_DELIVERY_FAILED"));
814
- this.#diagnostic(receipt.code ?? "IM_DELIVERY_FAILED", runId);
815
- if (requireDelivered)
816
- throw new Error(receipt.code ?? "IM_DELIVERY_FAILED");
817
- }
818
- }
819
- async #respond(message, key) {
820
- const match = /^\/(approve|decline|respond)\s+(\S+)(?:\s+([\s\S]*))?$/.exec(message.text.trim());
821
- if (!match)
822
- return;
823
- const entry = this.#interactions.get(match[2]);
824
- if (!entry ||
825
- entry.key !== key ||
826
- entry.senderId !== message.senderId ||
827
- entry.request.expiresAt === undefined ||
828
- !Number.isFinite(Date.parse(entry.request.expiresAt)) ||
829
- Date.parse(entry.request.expiresAt) <= Date.now()) {
830
- await this.#reply(message, "该交互已失效或不属于当前会话。", `interaction:${message.messageId}`);
831
- return;
832
- }
833
- const command = match[1], approval = entry.request.kind === "approval";
834
- if (approval !== (command !== "respond")) {
835
- await this.#reply(message, "交互响应类型不匹配。", `interaction:${message.messageId}`);
836
- return;
837
- }
838
- const response = {
839
- interactionId: match[2],
840
- outcome: command === "approve" ? "accepted" : command === "decline" ? "declined" : "answered"
841
- };
842
- if (!approval) {
843
- if (!match[3]?.trim())
844
- return;
845
- response.value =
846
- entry.request.kind === "elicitation" || Array.isArray(entry.request.request.questions)
847
- ? JSON.parse(match[3])
848
- : match[3];
849
- }
850
- await this.#submitInteraction(key, message.senderId, response);
851
- await this.#reply(message, "已提交本次响应。", `interaction:${message.messageId}`);
852
- }
853
- async #submitInteraction(key, senderId, response) {
854
- const entry = this.#interactions.get(response.interactionId);
855
- if (this.#closed ||
856
- this.#draining ||
857
- this.#signal.aborted ||
858
- !entry ||
859
- entry.key !== key ||
860
- entry.senderId !== senderId ||
861
- this.#sessionStore.read(key)?.id !== entry.sessionId ||
862
- entry.request.expiresAt === undefined ||
863
- !Number.isFinite(Date.parse(entry.request.expiresAt)) ||
864
- Date.parse(entry.request.expiresAt) <= Date.now())
865
- throw Error("IM_INTERACTION_STALE");
866
- if (this.#responding.has(response.interactionId))
867
- return;
868
- this.#responding.add(response.interactionId);
869
- try {
870
- await this.dependencies.kernel.respondInteraction(entry.invocationId, response);
871
- this.#interactions.delete(response.interactionId);
872
- }
873
- finally {
874
- this.#responding.delete(response.interactionId);
875
- }
876
- }
877
- async #turn(message, key, session, occurrenceId, executionSession = session) {
878
- if (this.#closed || this.#draining || this.#signal.aborted || !this.#delivery)
879
- return;
880
- const prompt = message.text.trim();
881
- if (!prompt && !message.buildInputs)
882
- return;
883
- if (prompt === "/session") {
884
- await this.#reply(message, `session=${session.id} generation=${session.generation}${session.lastRunId ? ` run=${session.lastRunId}` : ""}`, `control:${message.messageId}`);
885
- return;
886
- }
887
- // 准备阶段还没有 invocationId;按会话单独持有 controller,使 /stop 也能取消动态 Context/取材。
888
- const preparation = new AbortController();
889
- this.#preparing.set(key, preparation);
890
- const turnSignal = AbortSignal.any([this.#signal, preparation.signal]);
891
- let prepared;
892
- let gapPlan = { mode: "none" };
893
- let failureAfterSeq = null;
894
- let rulesRevision = 0;
895
- let rulesVersions;
896
- const stableState = executionSession.stableContext;
897
- const initialWasAttempted = executionSession.initialization.attempted;
898
- const stablePlan = message.historyRetry
899
- ? { turn: stableState.turnCount, refresh: false }
900
- : planStableContext(stableState, this.config.stable_context_refresh_interval_turns);
901
- let stableRecovered = false;
902
- const rulesEnabled = message.conversationKind !== "direct";
903
- // Octospec F05: .octospec/tasks/gateway-august-feature-assessment/assessment.md
904
- // 仅普通任务开始时回执;通知失败不阻断 Context 准备和模型执行。
905
- if (message.markRead)
906
- void Promise.resolve()
907
- .then(() => message.markRead(turnSignal))
908
- .catch(() => this.#diagnostic("IM_READ_RECEIPT_FAILED"));
909
- let environment;
910
- try {
911
- environment = message.executionEnvironment?.() ?? {};
912
- if (session.id === executionSession.id)
913
- executionSession.providerSession = session.providerSession;
914
- const initialization = executionSession.initialization;
915
- const initialSession = !initialization.attempted;
916
- const refreshStableContext = stablePlan.refresh ||
917
- !executionSession.providerSession?.sessionId ||
918
- executionSession.providerSession.resumable === false;
919
- const binding = this.#sessionStore.read(key);
920
- const rulesCursor = !message.historyRetry &&
921
- typeof this.#sessionStore.patchRules === "function" &&
922
- typeof this.#sessionStore.invalidateRules === "function" &&
923
- binding?.id === executionSession.id &&
924
- binding?.generation === executionSession.generation
925
- ? binding.rulesContext
926
- : undefined;
927
- rulesRevision = rulesCursor?.revision ?? 0;
928
- const gapEnabled = message.conversationKind !== "direct" &&
929
- message.position !== undefined &&
930
- !message.historyRetry;
931
- if (gapEnabled) {
932
- gapPlan = planHistoryGap(message.position?.messageSeq, binding &&
933
- binding.id === executionSession.id &&
934
- binding.generation === executionSession.generation
935
- ? binding.gap
936
- : undefined, this.#processEpoch, typeof this.#sessionStore.patchGap === "function");
937
- const outputs = binding?.gap?.assistantOutputs;
938
- // 补位/新建/恢复不明均保留;旧 ACK 与同 UID 不能代替当前 Provider 的归属证据。
939
- if (!initialSession &&
940
- gapPlan.mode === "delta" &&
941
- binding?.gap?.pendingAfterSeq === undefined &&
942
- !binding?.gap?.continuityUnknown &&
943
- outputs?.providerSessionId === executionSession.providerSession?.sessionId &&
944
- executionSession.providerSession?.resumable !== false &&
945
- !["fresh_fallback", "compacted"].includes(executionSession.providerSession?.resumeOutcome ?? ""))
946
- gapPlan.excludedOutputs = outputs?.messages;
947
- message.bindHistoryTurn?.({
948
- sessionId: executionSession.id,
949
- generation: executionSession.generation,
950
- processEpoch: this.#processEpoch
951
- });
952
- }
953
- const fullContext = await message.buildContext(turnSignal, {
954
- configuredItems: message.historyRetry
955
- ? undefined
956
- : await this.dependencies.prepareContexts?.(this.config, turnSignal),
957
- initialSession,
958
- ...(gapEnabled
959
- ? {
960
- historyGap: gapPlan,
961
- onHistoryGapPrepared: (plan) => {
962
- gapPlan = plan;
963
- }
964
- }
965
- : {})
966
- });
967
- const selection = selectRulesContext(fullContext, rulesCursor, executionSession.providerSession, !message.historyRetry && refreshStableContext);
968
- const context = selection.context;
969
- rulesVersions = message.historyRetry ? undefined : selection.versions;
970
- if (gapEnabled)
971
- failureAfterSeq = gapPlan.afterSeq ?? null;
972
- // 准备只计算发送计划;直到第一次执行尝试才消费轮次和首轮历史资格。
973
- prepared = createImInvocation(this.config, message, context, key, executionSession, turnSignal, occurrenceId, refreshStableContext);
974
- if (gapEnabled &&
975
- context.items.some((item) => item.namespace === "extra.im" &&
976
- item.name === "history" &&
977
- item.payload.automatic === true) &&
978
- !prepared.request.contexts.items.some((item) => item.namespace === "extra.im" && item.name === "history"))
979
- gapPlan = { ...gapPlan, retrieval: "omitted" };
980
- if (message.buildInputs) {
981
- if (prepared.adapterType !== "codex")
982
- throw new ImImageInputError("本期仅 Codex 支持独立图片输入,当前引擎不支持。");
983
- const parts = await message.buildInputs(turnSignal);
984
- assertModelInputParts(parts);
985
- if (parts.length !== 1 || parts[0].type !== "image")
986
- throw new ImImageInputError("每条独立图片消息只接收一张图片。");
987
- prepared.request.inputs = parts;
988
- }
989
- // 恢复补充只含主历史排除的消息,同一窗口/快照,不重复用户 gap 或另起读取。
990
- addRulesRecovery(prepared.request, [
991
- ...selection.omitted,
992
- ...prepared.recoveryContexts,
993
- ...(prepared.historyContext && gapPlan.recoveryHistory ? [gapPlan.recoveryHistory] : [])
994
- ]);
995
- if (!message.historyRetry)
996
- prepared.request.runMetadata = {
997
- ...prepared.request.runMetadata,
998
- conversationTurn: stablePlan.turn
999
- };
1000
- if (message.historyRetry) {
1001
- const saved = this.#sessionStore.occurrence(key, message.messageId)?.snapshot;
1002
- if (saved?.freshFallbackModelInput !== undefined)
1003
- prepared.request.freshFallbackModelInput = saved.freshFallbackModelInput;
1004
- if (saved?.freshFallbackModelInputParts)
1005
- prepared.request.freshFallbackModelInputParts = structuredClone(saved.freshFallbackModelInputParts);
1006
- }
1007
- if (session.id === prepared.request.sessionId) {
1008
- session.lastEventId = executionSession.lastEventId;
1009
- session.lastRunId = prepared.request.runId;
1010
- this.#saveBinding(key, session);
1011
- }
1012
- message.executionEnvironment?.();
1013
- if (prepared.adapterType === "openclaw")
1014
- environment = {};
1015
- turnSignal.throwIfAborted();
1016
- const snapshot = { ...prepared.request };
1017
- this.#sessionStore.remember(key, occurrenceId ?? message.messageId, {
1018
- text: message.text,
1019
- sessionId: executionSession.id,
1020
- runId: prepared.request.runId,
1021
- snapshot,
1022
- artifacts: prepared.artifacts
1023
- });
1024
- }
1025
- catch (error) {
1026
- if (rulesEnabled)
1027
- this.#finishRules(key, executionSession, rulesRevision, undefined, false);
1028
- if (turnSignal.aborted)
1029
- return;
1030
- const preparationMessage = error instanceof Error ? preparationFailureMessages.get(error.message) : undefined;
1031
- if (error instanceof Error &&
1032
- (preparationMessage || /^IM_CONTEXT_(?:LOADING|RESULT)_[A-Z_]+$/.test(error.message)))
1033
- this.#diagnostic(error.message);
1034
- this.#diagnostic("IM_CONTEXT_PREPARATION_FAILED");
1035
- await this.#reply(message, preparationMessage ??
1036
- (error instanceof ImImageInputError
1037
- ? error.message
1038
- : message.buildInputs
1039
- ? "图片输入准备失败,尚未发起执行。请检查图片或稍后重试。"
1040
- : "本轮输入或执行配置准备失败,尚未发起执行。请检查配置、会话权限或稍后重试。"), `prepare:${occurrenceId ?? message.messageId}`);
1041
- return;
1042
- }
1043
- finally {
1044
- this.#preparing.delete(key);
1045
- }
1046
- if (this.#closed || this.#draining || this.#signal.aborted)
1047
- return;
1048
- let { request } = prepared;
1049
- const rootRunId = request.runId;
1050
- this.#log("agent_run.requested", {
1051
- run_id: request.runId,
1052
- invocation_id: request.invocationId,
1053
- session_id: request.sessionId
1054
- });
1055
- const startedAt = performance.now();
1056
- let presentationSeq = 0;
1057
- let projector = new ImRunProjector(rootRunId, message.conversationKind === "direct");
1058
- let handedOff = false;
1059
- let turnStarted = false;
1060
- const task = new ImTask(this.dependencies.kernel, request, prepared.adapterType, this.config, { ...environment, signal: this.#signal }, (attempt) => {
1061
- // 同代次排队共享状态;自动/卡片重试不增加用户轮数,reset 后旧任务仅更新旧对象。
1062
- if (!turnStarted && !message.historyRetry) {
1063
- turnStarted = true;
1064
- stableState.turnCount = stablePlan.turn;
1065
- stableState.refreshPending ||= prepared.stableContextIncluded;
1066
- executionSession.initialization.attempted = true;
1067
- }
1068
- if (!handedOff &&
1069
- message.position &&
1070
- message.conversationKind !== "direct" &&
1071
- !message.historyRetry) {
1072
- handedOff = true;
1073
- try {
1074
- this.#sessionStore.patchGap?.(key, { sessionId: executionSession.id, generation: executionSession.generation }, (previous) => commitHistoryGap(gapMetadata(this.#processEpoch, previous), message.position?.messageSeq, gapPlan, attempt.contexts.items.some((item) => item.namespace === "extra.im" && item.name === "history")
1075
- ? prepared.historyContext
1076
- : undefined));
1077
- }
1078
- catch {
1079
- this.#finalizationFailed("IM_HISTORY_POSITION_UNAVAILABLE");
1080
- }
1081
- }
1082
- for (const [id, entry] of this.#interactions)
1083
- if (entry.invocationId === request.invocationId)
1084
- this.#interactions.delete(id);
1085
- request = attempt;
1086
- projector.dispose();
1087
- projector = new ImRunProjector(rootRunId, message.conversationKind === "direct");
1088
- session.activeInvocationId = request.invocationId;
1089
- if (session.id === request.sessionId) {
1090
- session.lastRunId = request.runId;
1091
- this.#saveBinding(key, session);
1092
- }
1093
- else
1094
- task.stopRetries();
1095
- }, undefined, () => updatePresentation());
1096
- this.#tasks.set(key, { rootInvocationId: request.invocationId, task });
1097
- const snapshot = () => ({
1098
- ...projector.snapshot(),
1099
- seq: ++presentationSeq,
1100
- elapsedMs: Math.round(performance.now() - startedAt),
1101
- modelWait: task.modelWait.snapshot,
1102
- attempts: task.attempts.map((attempt) => ({ ...attempt }))
1103
- });
1104
- const controls = this.#runControls(message, key, request.invocationId);
1105
- let presentation;
1106
- let executionStarted = false;
1107
- let presentationFailed = false;
1108
- let localFailure;
1109
- const delivery = new AbortController();
1110
- // 时钟和源事件走同一投影出口,保留原卡片的序号、预算与终态屏障。
1111
- const updatePresentation = () => {
1112
- if (presentationFailed || this.#closed || this.#signal.aborted)
1113
- return;
1114
- try {
1115
- presentation?.update(snapshot());
1116
- }
1117
- catch {
1118
- presentationFailed = true;
1119
- this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
1120
- if (!projector.snapshot().terminal)
1121
- void task
1122
- .cancelExecution("IM presentation failed")
1123
- .catch(() => this.#diagnostic("IM_CANCEL_FAILED", request.runId));
1124
- }
1125
- };
1126
- try {
1127
- try {
1128
- presentation = message.beginPresentation?.(rootRunId, (code, data) => this.#diagnostic(code, rootRunId, data), controls);
1129
- presentation?.update(snapshot());
1130
- session.activeInvocationId = request.invocationId;
1131
- executionStarted = true;
1132
- for await (const event of task.events()) {
1133
- if (this.#closed || this.#signal.aborted)
1134
- break;
1135
- if (event.type === "session.update" && session.id === request.sessionId) {
1136
- session.providerSession = event.payload.providerSession;
1137
- this.#saveBinding(key, session);
1138
- if (event.payload.providerSession?.resumeOutcome === "fresh_fallback") {
1139
- stableRecovered = true;
1140
- try {
1141
- this.#sessionStore.patchGap?.(key, { sessionId: request.sessionId, generation: executionSession.generation }, (previous) => ({
1142
- ...gapMetadata(this.#processEpoch, previous),
1143
- continuityUnknown: true,
1144
- pendingAfterSeq: null
1145
- }));
1146
- }
1147
- catch {
1148
- this.#finalizationFailed("IM_HISTORY_POSITION_UNAVAILABLE");
1149
- }
1150
- }
1151
- }
1152
- // 只有执行策略与事件策略均为 full_access 的审批才是自动处理的审计记录。
1153
- // 问题/elicitation 仍须展示并交回原交互入口,不能一并过滤。
1154
- if (event.type === "interaction.requested" &&
1155
- event.payload.kind === "approval" &&
1156
- request.approvalMode === "full_access" &&
1157
- event.payload.request.policy?.mode === "full_access")
1158
- continue;
1159
- if (event.type === "interaction.requested") {
1160
- if (this.#draining)
1161
- continue;
1162
- // Octospec F09: .octospec/tasks/gateway-august-feature-assessment/assessment.md
1163
- // 普通 IM 不提供秘密输入通道,禁止退回聊天命令收集凭据。
1164
- if (Array.isArray(event.payload.request.questions) &&
1165
- event.payload.request.questions.some((question) => question !== null &&
1166
- typeof question === "object" &&
1167
- "isSecret" in question &&
1168
- question.isSecret === true)) {
1169
- this.#diagnostic("IM_INTERACTION_SECRET_UNSUPPORTED", request.runId);
1170
- await this.#reply(message, "本次执行需要安全输入,当前聊天不支持。请勿在聊天中发送密码或密钥;本次执行已请求停止。", `interaction:${event.payload.interactionId}`);
1171
- await this.dependencies.kernel.cancelInvocation(request.invocationId, "IM secret input unsupported");
1172
- continue;
1173
- }
1174
- if (this.#interactions.size >= 64)
1175
- throw new Error("IM_INTERACTION_CAPACITY_EXHAUSTED");
1176
- this.#interactions.set(event.payload.interactionId, {
1177
- invocationId: request.invocationId,
1178
- sessionId: request.sessionId,
1179
- key,
1180
- senderId: message.senderId,
1181
- request: structuredClone(event.payload)
1182
- });
1183
- const interaction = event.payload;
1184
- let cardShown = false;
1185
- try {
1186
- cardShown =
1187
- !presentationFailed && ((await presentation?.interaction?.(interaction)) ?? false);
1188
- }
1189
- catch {
1190
- this.#diagnostic("IM_INTERACTION_CARD_FAILED", request.runId);
1191
- }
1192
- const display = interaction.request.operation;
1193
- const summary = [
1194
- display?.summary,
1195
- interaction.request.question,
1196
- interaction.request.message
1197
- ].find((value) => typeof value === "string");
1198
- const instruction = interaction.kind === "approval"
1199
- ? `/approve ${interaction.interactionId} 或 /decline ${interaction.interactionId}`
1200
- : `/respond ${interaction.interactionId} ${interaction.kind === "elicitation" ? "<JSON>" : "<回答>"}`;
1201
- if (!cardShown)
1202
- await this.#reply(message, `${summary?.slice(0, 1000) ?? "执行需要你的确认或输入。"}\n${Array.isArray(interaction.request.questions) ? JSON.stringify(interaction.request.questions).slice(0, 8000) + "\n请按问题 ID 提交 JSON 答案。\n" : ""}${instruction}`, `interaction:${interaction.interactionId}`, true);
1203
- }
1204
- if (event.type === "interaction.resolved") {
1205
- this.#interactions.delete(event.payload.interactionId);
1206
- try {
1207
- if (!presentationFailed)
1208
- await presentation?.resolveInteraction?.(event.payload.interactionId, event.payload.status);
1209
- }
1210
- catch {
1211
- this.#diagnostic("IM_INTERACTION_CARD_FAILED", request.runId);
1212
- }
1213
- }
1214
- projector.accept(event);
1215
- controls.failed =
1216
- projector.snapshot().terminal === "failed" ||
1217
- (projector.snapshot().terminal === "cancelled" &&
1218
- task.modelWait.snapshot.timeout === "terminated");
1219
- updatePresentation();
1220
- }
1221
- if (!projector.snapshot().terminal)
1222
- throw new Error("IM_RUN_WITHOUT_TERMINAL");
1223
- }
1224
- catch {
1225
- if (!executionStarted || task.notSubmittedFailure) {
1226
- localFailure =
1227
- task.notSubmittedFailure ??
1228
- failurePayload({ code: "IM_PRESENTATION_INITIALIZATION_FAILED" }, {
1229
- stage: "channel_presentation_initialize",
1230
- defaultDomain: "runtime",
1231
- runId: request.runId
1232
- }).failure;
1233
- controls.failed = false;
1234
- // 未提交失败的错误卡也可能等待重连;先移交取消权,stop/reset 才能终止待发通知。
1235
- this.#finalDeliveries.set(key, delivery);
1236
- await this.#notifyFailure(message, localFailure, request, task.attempts.length > 1, delivery.signal);
1237
- }
1238
- else {
1239
- if (this.#draining)
1240
- this.#drainErrors.push(new Error("IM_EXECUTION_RESULT_UNKNOWN"));
1241
- // 流断开无法证明执行失败;尽力取消并提示核查,不自动重跑潜在的业务副作用。
1242
- await this.dependencies.kernel
1243
- .cancelInvocation(request.invocationId, "IM execution stream failed")
1244
- .catch(() => undefined);
1245
- this.#diagnostic("IM_EXECUTION_RESULT_UNKNOWN", request.runId);
1246
- // 原源流即使在终态后失败,也不能被展示层的终态掩盖。
1247
- controls.failed = false;
1248
- projector.dispose();
1249
- projector = new ImRunProjector(rootRunId, message.conversationKind === "direct");
1250
- if (!presentationFailed) {
1251
- try {
1252
- presentation?.update({ ...snapshot(), resultUnknown: true });
1253
- }
1254
- catch {
1255
- this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
1256
- }
1257
- }
1258
- }
1259
- }
1260
- finally {
1261
- let stableChanged = false;
1262
- if (localFailure &&
1263
- turnStarted &&
1264
- task.attempts.every((attempt) => attempt.outcome === "not_submitted") &&
1265
- session.id === executionSession.id &&
1266
- session.generation === executionSession.generation) {
1267
- // 可信未提交才允许回退轮次;已执行失败或结果未知不能当作从未执行。
1268
- stableState.turnCount--;
1269
- executionSession.initialization.attempted = initialWasAttempted;
1270
- stableChanged = true;
1271
- }
1272
- if (session.id === executionSession.id &&
1273
- session.generation === executionSession.generation &&
1274
- projector.snapshot().terminal === "completed" &&
1275
- (prepared.stableContextIncluded || stableRecovered)) {
1276
- stableState.refreshPending = false;
1277
- stableChanged = true;
1278
- }
1279
- if (stableChanged)
1280
- try {
1281
- this.#saveBinding(key, session);
1282
- }
1283
- catch {
1284
- this.#finalizationFailed("IM_SESSION_STORE_FAILED", rootRunId);
1285
- }
1286
- if (rulesEnabled)
1287
- this.#finishRules(key, executionSession, rulesRevision, rulesVersions, projector.snapshot().terminal === "completed");
1288
- if (!this.#closed && handedOff && projector.snapshot().terminal !== "completed") {
1289
- try {
1290
- this.#sessionStore.patchGap?.(key, { sessionId: executionSession.id, generation: executionSession.generation }, (previous) => {
1291
- const next = gapMetadata(this.#processEpoch, previous);
1292
- next.pendingAfterSeq =
1293
- next.pendingAfterSeq === null || failureAfterSeq === null
1294
- ? null
1295
- : Math.min(next.pendingAfterSeq ?? failureAfterSeq, failureAfterSeq);
1296
- return next;
1297
- });
1298
- }
1299
- catch {
1300
- this.#finalizationFailed("IM_HISTORY_POSITION_UNAVAILABLE");
1301
- }
1302
- }
1303
- if (task.stopReason)
1304
- this.#diagnostic(task.stopReason, rootRunId);
1305
- this.#log("agent_run.finished", {
1306
- run_id: rootRunId,
1307
- invocation_id: request.invocationId,
1308
- session_id: request.sessionId,
1309
- status: localFailure ? "not_submitted" : (projector.snapshot().terminal ?? "unknown")
1310
- });
1311
- // 移除执行身份前移交收尾/产物投递的取消权;finish 等待期间的 stop 不能落入空窗。
1312
- if (!localFailure)
1313
- this.#finalDeliveries.set(key, delivery);
1314
- this.#tasks.delete(key);
1315
- try {
1316
- // 长任务结束后重新开始终态去重窗口,保留有界尝试身份,避免立即重复执行。
1317
- const saved = { ...prepared.request };
1318
- if (!this.#closed)
1319
- this.#sessionStore.remember(key, occurrenceId ?? message.messageId, {
1320
- text: message.text,
1321
- sessionId: request.sessionId,
1322
- runId: rootRunId,
1323
- snapshot: saved,
1324
- artifacts: prepared.artifacts,
1325
- attempts: task.attempts.map((attempt) => ({ ...attempt })),
1326
- ...(localFailure &&
1327
- task.attempts.every((attempt) => attempt.outcome === "not_submitted")
1328
- ? { notSubmittedFailure: localFailure }
1329
- : {})
1330
- });
1331
- }
1332
- catch {
1333
- this.#finalizationFailed("IM_SESSION_STORE_FAILED", rootRunId);
1334
- }
1335
- session.activeInvocationId = undefined;
1336
- for (const [id, entry] of this.#interactions)
1337
- if (entry.invocationId === request.invocationId)
1338
- this.#interactions.delete(id);
1339
- try {
1340
- if (!this.#closed)
1341
- await withinShutdown(Promise.resolve().then(() => presentation?.finish()), shutdownDeadline(this.dependencies.signal), "IM_PRESENTATION_FINISH_INCOMPLETE");
1342
- }
1343
- catch (error) {
1344
- // 截止只结束等待,不能证明尚未完成的展示资源已经释放。
1345
- if (error instanceof Error && error.message === "IM_PRESENTATION_FINISH_INCOMPLETE")
1346
- this.#finishIncomplete ??= error;
1347
- this.#finalizationFailed("IM_PRESENTATION_FAILED", request.runId);
1348
- }
1349
- }
1350
- try {
1351
- if (localFailure || this.#closed || this.#signal.aborted || delivery.signal.aborted)
1352
- return;
1353
- const { text, allowMention } = task.modelWait.snapshot.timeout && projector.snapshot().terminal !== "completed"
1354
- ? {
1355
- text: MODEL_WAIT_TIMEOUT_MESSAGE +
1356
- (task.modelWait.snapshot.timeout === "terminated"
1357
- ? "已确认执行结束,可以重试。"
1358
- : "尚未确认执行停止,请核查运行记录,避免重复执行。"),
1359
- allowMention: false
1360
- }
1361
- : projector.finalReply;
1362
- const obsolete = () => {
1363
- const binding = this.#sessionStore.read(key);
1364
- return (binding?.id !== request.sessionId || binding.generation !== request.sessionGeneration);
1365
- };
1366
- // reset 不取消原模型执行,但旧代次的结果不能启动上传或继续最终消息重试。
1367
- if (allowMention && obsolete())
1368
- return;
1369
- const deliverySignal = AbortSignal.any([this.#signal, delivery.signal]);
1370
- if (allowMention &&
1371
- projector.snapshot().terminal === "completed" &&
1372
- session.providerSession?.sessionId &&
1373
- session.providerSession.resumable !== false)
1374
- message.bindHistoryTurn?.({
1375
- sessionId: request.sessionId,
1376
- generation: executionSession.generation,
1377
- processEpoch: this.#processEpoch,
1378
- providerSessionId: session.providerSession.sessionId
1379
- });
1380
- // 最终文本拥有独立投递身份,即使进度卡投递失败,也必须尝试回复用户。
1381
- await this.#reply(message, text, `final:${rootRunId}`, false, allowMention, {
1382
- artifacts: prepared.artifacts,
1383
- signal: deliverySignal,
1384
- obsolete: () => deliverySignal.aborted || (allowMention && obsolete())
1385
- }, rootRunId);
1386
- }
1387
- finally {
1388
- if (this.#finalDeliveries.get(key) === delivery)
1389
- this.#finalDeliveries.delete(key);
1390
- }
1391
- }
1392
- finally {
1393
- // 先保留 final 的读取与投递机会,再解除正文引用;取消/早退同样进入此收尾。
1394
- projector.dispose();
1395
- presentation = undefined;
1396
- }
1397
- }
1398
- #saveBinding(key, session) {
1399
- if (this.#closed)
1400
- return;
1401
- const binding = this.#sessionStore.read(key);
1402
- this.#sessionStore.save(key, {
1403
- id: session.id,
1404
- sessionName: session.sessionName,
1405
- generation: session.generation,
1406
- providerSession: session.providerSession,
1407
- lastEventId: session.lastEventId,
1408
- lastRunId: session.lastRunId,
1409
- initialContextPrepared: session.initialization?.attempted === true,
1410
- stableContext: session.stableContext,
1411
- ...(binding?.id === session.id &&
1412
- binding?.generation === session.generation &&
1413
- binding.rulesContext
1414
- ? { rulesContext: binding.rulesContext }
1415
- : {}),
1416
- ...(binding &&
1417
- binding.id === session.id &&
1418
- binding.generation === session.generation &&
1419
- binding.gap
1420
- ? { gap: binding.gap }
1421
- : {})
1422
- });
1423
- }
1424
- /**
1425
- * 同步停准入,在共享预算内取消执行并等待会话持久化、卡片和 final,再释放连接。
1426
- * 源终态或空任务表不代表业务 tail 已结束;失败/超时及重复调用都保留同一关闭结果。
1427
- */
1428
- close() {
1429
- if (this.#closing)
1430
- return this.#closing;
1431
- this.#draining = true;
1432
- const until = shutdownDeadline(this.dependencies.signal);
1433
- const drainUntil = Math.min(performance.now() + 3000, until - 1000);
1434
- const wasOnline = this.#state === "online";
1435
- this.#state = "stopped";
1436
- this.#log("channel.stopped", { state: "stopped" });
1437
- this.#error = undefined;
1438
- this.#retry = 0;
1439
- for (const preparation of this.#preparing.values())
1440
- preparation.abort();
1441
- // 执行终态之后 session.tail 仍可能在结束卡片或发送 final,连接在 drain 后统一撤销。
1442
- if (!wasOnline)
1443
- this.#connectionAbort?.abort();
1444
- if (this.#reconnect) {
1445
- clearTimeout(this.#reconnect);
1446
- this.#reconnect = undefined;
1447
- }
1448
- this.#closing = Promise.resolve().then(async () => {
1449
- const errors = [];
1450
- const attempt = async (operation, deadline = until) => {
1451
- try {
1452
- await withinShutdown(Promise.resolve().then(operation), deadline, "IM_DRAIN_INCOMPLETE");
1453
- }
1454
- catch (error) {
1455
- errors.push(error);
1456
- }
1457
- };
1458
- await Promise.all([
1459
- ...[...this.#tasks.values()].map(({ task }) => attempt(() => task.drain(), drainUntil)),
1460
- ...[...this.#sessions.values()].map((session) => attempt(() => session.tail, drainUntil))
1461
- ]);
1462
- // 截止后撤销订阅与投递权限,迟到事件不能继续保存或向已释放连接投递。
1463
- this.#closed = true;
1464
- this.#abort.abort();
1465
- this.#connectionAbort?.abort();
1466
- if (this.#ownerStopped)
1467
- this.dependencies.signal?.removeEventListener("abort", this.#ownerStopped);
1468
- await Promise.all([
1469
- attempt(() => this.#connector?.close()),
1470
- attempt(() => this.#connecting),
1471
- attempt(() => this.#disconnecting),
1472
- ...[...this.#failureNotifications.values()].map((notification) => attempt(() => notification)),
1473
- ...[...this.#busyNotifications.values()].map((notification) => attempt(() => notification))
1474
- ]);
1475
- if (!this.dependencies.sessions)
1476
- await attempt(() => this.#sessionStore.close?.());
1477
- errors.push(...this.#drainErrors);
1478
- if (this.#finishIncomplete)
1479
- errors.push(this.#finishIncomplete);
1480
- if (errors.length)
1481
- throw new AggregateError(errors, "IM_DISPOSE_FAILED");
1482
- this.#sessions.clear();
1483
- this.#seen.clear();
1484
- this.#interactions.clear();
1485
- this.#connector = undefined;
1486
- });
1487
- return this.#closing;
1488
- }
1489
- }