@mininglamp-oss/octo-runtime 1.1.5 → 1.1.7

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 (282) hide show
  1. package/apps/cli/dist/adapter-configurations.d.ts +4 -0
  2. package/apps/cli/dist/adapter-configurations.js +102 -0
  3. package/apps/cli/dist/build-info.json +2 -2
  4. package/apps/cli/dist/command-tree.js +1 -1
  5. package/apps/cli/dist/logs.js +8 -4
  6. package/apps/cli/dist/main.js +11 -5
  7. package/apps/cli/dist/output.js +5 -0
  8. package/apps/cli/dist/playboard.js +3 -2
  9. package/dist/public/dsh.d.ts +1 -1
  10. package/dist/public/dsh.js +1 -1
  11. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +5 -2
  12. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  13. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +9 -1
  14. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +17 -0
  15. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +20 -2
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +32 -2
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +3 -0
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -6
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +161 -26
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +8 -1
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +32 -2
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-DYOJCNWF.js → chunk-CFKMMCO6.js} +6 -4
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-UOQRXV3Q.js → chunk-LO34KB7D.js} +1 -1
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-V5W6ZTYC.js +151 -0
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +5 -3
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +3 -1
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +17 -3
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +8 -6
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +2 -1
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +4 -3
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +9 -1
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +8 -2
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +10 -6
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +9 -1
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +9 -1
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +9 -1
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +2 -1
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +12 -40
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +22 -2
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +422 -135
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +6 -2
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +2 -0
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +9 -1
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +9 -1
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +19 -5
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +15 -8
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +12 -0
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +91 -0
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log-worker.js +2 -2
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +13 -1
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +9 -0
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +40 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +3 -2
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +20 -2
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  71. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.d.ts +4 -0
  72. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.js +102 -0
  73. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  74. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +1 -1
  75. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.js +8 -4
  76. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +11 -5
  77. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +5 -0
  78. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +3 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
  80. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.d.ts +2 -1
  81. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.js +102 -52
  82. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +8 -3
  83. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +5 -3
  84. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +4 -3
  85. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +9 -4
  86. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +2 -0
  87. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
  88. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +9 -6
  89. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +47 -4
  90. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  91. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -0
  92. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +4 -1
  93. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +7 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +79 -5
  95. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +3 -1
  96. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +22 -6
  97. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +2 -1
  98. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +5 -3
  99. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +12 -6
  100. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +4 -2
  101. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +131 -43
  102. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  103. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
  104. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +17 -1
  105. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +22 -6
  106. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.d.ts +3 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.js +27 -0
  108. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +462 -228
  109. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.d.ts +5 -2
  110. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.js +42 -4
  111. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +5 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.d.ts +15 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.js +28 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +16 -5
  115. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +4 -5
  116. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +12 -9
  117. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +1 -0
  118. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +7 -5
  119. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +15 -0
  120. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +36 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts +2 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js +10 -0
  123. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +5 -2
  124. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +39 -22
  125. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.d.ts +29 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.js +171 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +4 -1
  128. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -6
  129. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +14 -1
  130. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +4 -0
  131. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +7 -1
  132. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +265 -38
  133. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.d.ts +4 -0
  134. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +5 -5
  135. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +7 -0
  136. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +19 -2
  137. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +3 -1
  138. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +4 -3
  139. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.d.ts +0 -12
  140. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.js +5 -3
  141. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +2 -1
  142. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +8 -6
  143. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.d.ts +3 -0
  144. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.js +2 -2
  145. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +2 -2
  146. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +27 -15
  147. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +17 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +217 -50
  149. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +2 -4
  150. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +3 -2
  151. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +41 -12
  152. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +2 -6
  153. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +53 -82
  154. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.d.ts +12 -0
  155. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.js +133 -0
  156. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.d.ts +21 -0
  157. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.js +76 -0
  158. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +0 -2
  159. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +0 -2
  160. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.d.ts +16 -0
  161. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.js +74 -0
  162. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.d.ts +4 -0
  163. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.js +19 -0
  164. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.d.ts +7 -0
  165. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.js +90 -0
  166. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +39 -2
  167. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.d.ts +6 -0
  168. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.js +60 -0
  169. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +2 -1
  170. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +20 -8
  171. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  172. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +10 -2
  173. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +14 -1
  174. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.js +2 -3
  175. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  176. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  177. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.d.ts +3 -2
  178. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +11 -4
  179. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.d.ts +2 -0
  180. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +5 -3
  181. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  182. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +8 -1
  183. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -1
  184. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +9 -1
  185. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +18 -0
  186. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +3 -0
  187. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +6 -0
  188. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +14 -0
  189. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  190. package/node_modules/iconv-lite/LICENSE +21 -0
  191. package/node_modules/iconv-lite/README.md +138 -0
  192. package/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  193. package/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  194. package/node_modules/iconv-lite/encodings/index.js +23 -0
  195. package/node_modules/iconv-lite/encodings/internal.js +218 -0
  196. package/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  197. package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  198. package/node_modules/iconv-lite/encodings/sbcs-data.js +180 -0
  199. package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  200. package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  201. package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  202. package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  203. package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  204. package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  205. package/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  206. package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  207. package/node_modules/iconv-lite/encodings/utf16.js +187 -0
  208. package/node_modules/iconv-lite/encodings/utf32.js +314 -0
  209. package/node_modules/iconv-lite/encodings/utf7.js +283 -0
  210. package/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  211. package/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  212. package/node_modules/iconv-lite/lib/index.d.ts +129 -0
  213. package/node_modules/iconv-lite/lib/index.js +182 -0
  214. package/node_modules/iconv-lite/lib/streams.js +105 -0
  215. package/node_modules/iconv-lite/package.json +70 -0
  216. package/node_modules/iconv-lite/types/encodings.d.ts +425 -0
  217. package/node_modules/safer-buffer/LICENSE +21 -0
  218. package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  219. package/node_modules/safer-buffer/Readme.md +156 -0
  220. package/node_modules/safer-buffer/dangerous.js +58 -0
  221. package/node_modules/safer-buffer/package.json +34 -0
  222. package/node_modules/safer-buffer/safer.js +77 -0
  223. package/node_modules/safer-buffer/tests.js +406 -0
  224. package/node_modules/semver/LICENSE +15 -0
  225. package/node_modules/semver/README.md +680 -0
  226. package/node_modules/semver/bin/semver.js +195 -0
  227. package/node_modules/semver/classes/comparator.js +143 -0
  228. package/node_modules/semver/classes/index.js +7 -0
  229. package/node_modules/semver/classes/range.js +577 -0
  230. package/node_modules/semver/classes/semver.js +350 -0
  231. package/node_modules/semver/functions/clean.js +8 -0
  232. package/node_modules/semver/functions/cmp.js +54 -0
  233. package/node_modules/semver/functions/coerce.js +62 -0
  234. package/node_modules/semver/functions/compare-build.js +9 -0
  235. package/node_modules/semver/functions/compare-loose.js +5 -0
  236. package/node_modules/semver/functions/compare.js +7 -0
  237. package/node_modules/semver/functions/diff.js +60 -0
  238. package/node_modules/semver/functions/eq.js +5 -0
  239. package/node_modules/semver/functions/gt.js +5 -0
  240. package/node_modules/semver/functions/gte.js +5 -0
  241. package/node_modules/semver/functions/inc.js +21 -0
  242. package/node_modules/semver/functions/lt.js +5 -0
  243. package/node_modules/semver/functions/lte.js +5 -0
  244. package/node_modules/semver/functions/major.js +5 -0
  245. package/node_modules/semver/functions/minor.js +5 -0
  246. package/node_modules/semver/functions/neq.js +5 -0
  247. package/node_modules/semver/functions/parse.js +18 -0
  248. package/node_modules/semver/functions/patch.js +5 -0
  249. package/node_modules/semver/functions/prerelease.js +8 -0
  250. package/node_modules/semver/functions/rcompare.js +5 -0
  251. package/node_modules/semver/functions/rsort.js +5 -0
  252. package/node_modules/semver/functions/satisfies.js +12 -0
  253. package/node_modules/semver/functions/sort.js +5 -0
  254. package/node_modules/semver/functions/truncate.js +48 -0
  255. package/node_modules/semver/functions/valid.js +8 -0
  256. package/node_modules/semver/index.js +93 -0
  257. package/node_modules/semver/internal/constants.js +37 -0
  258. package/node_modules/semver/internal/debug.js +11 -0
  259. package/node_modules/semver/internal/identifiers.js +29 -0
  260. package/node_modules/semver/internal/lrucache.js +42 -0
  261. package/node_modules/semver/internal/parse-options.js +17 -0
  262. package/node_modules/semver/internal/re.js +223 -0
  263. package/node_modules/semver/package.json +78 -0
  264. package/node_modules/semver/preload.js +4 -0
  265. package/node_modules/semver/range.bnf +17 -0
  266. package/node_modules/semver/ranges/gtr.js +6 -0
  267. package/node_modules/semver/ranges/intersects.js +9 -0
  268. package/node_modules/semver/ranges/ltr.js +6 -0
  269. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  270. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  271. package/node_modules/semver/ranges/min-version.js +63 -0
  272. package/node_modules/semver/ranges/outside.js +82 -0
  273. package/node_modules/semver/ranges/simplify.js +49 -0
  274. package/node_modules/semver/ranges/subset.js +249 -0
  275. package/node_modules/semver/ranges/to-comparators.js +10 -0
  276. package/node_modules/semver/ranges/valid.js +13 -0
  277. package/package.json +33 -27
  278. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
  279. package/packages/octo-runtime-protocol/schema/protocol.schema.json +57 -1
  280. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-G5PWGRL5.js +0 -209
  281. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +0 -1
  282. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +0 -16
@@ -0,0 +1,90 @@
1
+ import { getJson } from "./api/client.js";
2
+ import { groupScope } from "./normalize.js";
3
+ import { messageSentAt } from "./message-time.js";
4
+ import { resolveMessageIdentities, unknownIdentity } from "./message-identities.js";
5
+ const requestOptions = { retryOn429: false, logRateLimit: false, maxResponseBytes: 1_048_576 };
6
+ function object(value) {
7
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
8
+ }
9
+ function name(value) {
10
+ return typeof value === "string" && value.trim() ? value : null;
11
+ }
12
+ /** 返回模型可读 JSON;外部取消继续传播,补充信息失败只留下真实 ID 和未知值。 */
13
+ export async function buildMessageTrigger(config, message, token, signal, cache) {
14
+ if (typeof message.channelId !== "string" || typeof message.messageId !== "string")
15
+ return undefined;
16
+ signal.throwIfAborted();
17
+ const mention = object(message.payload?.mention);
18
+ const targets = [
19
+ ...new Set(Array.isArray(mention.uids)
20
+ ? mention.uids.filter((uid) => typeof uid === "string" && !!uid)
21
+ : [])
22
+ ];
23
+ const senderUid = typeof message.fromUid === "string" ? message.fromUid : "";
24
+ // 批量 API 上限 200;超过查询上限的 @ 目标仍保留 UID,名称和类型标未知。
25
+ const uids = [...new Set([senderUid, config.bot_id, ...targets])].filter((uid) => uid && Buffer.byteLength(uid) <= 64);
26
+ const scope = groupScope(message.channelId);
27
+ const inGroup = [2, 5].includes(message.channelType);
28
+ const inTopic = message.channelType === 5 && !!scope.shortId;
29
+ const deadline = AbortSignal.any([signal, AbortSignal.timeout(5_000)]);
30
+ const optional = async (read) => {
31
+ try {
32
+ return await read();
33
+ }
34
+ catch {
35
+ signal.throwIfAborted();
36
+ return undefined;
37
+ }
38
+ };
39
+ const groupPath = `/v1/bot/groups/${encodeURIComponent(scope.groupNo)}`;
40
+ const [users, detail] = await Promise.all([
41
+ resolveMessageIdentities(config, uids, token, signal, cache, deadline),
42
+ inGroup
43
+ ? optional(() => getJson(config.api_url, token, inTopic ? `${groupPath}/threads/${encodeURIComponent(scope.shortId)}` : groupPath, deadline, requestOptions))
44
+ : undefined
45
+ ]);
46
+ signal.throwIfAborted();
47
+ const data = object(detail);
48
+ const matchingGroup = data.group_no === scope.groupNo;
49
+ const matchingTopic = matchingGroup && data.short_id === scope.shortId;
50
+ const known = (uid) => users.get(uid) ?? unknownIdentity(uid);
51
+ const sentAt = messageSentAt(message.timestamp, "seconds");
52
+ const enabled = (value) => value === true || value === 1;
53
+ return {
54
+ namespace: "extra.im",
55
+ name: "message-trigger",
56
+ guidance: "Current message: conversation=channel ID/type, sender=actor, recipient=this Bot, sentAt=system-zone time, mentions=actual @ targets; null=unknown.",
57
+ payload: {
58
+ messageId: message.messageId,
59
+ sentAt,
60
+ conversation: {
61
+ id: message.channelId,
62
+ type: inTopic ? "group_topic" : inGroup ? "group" : "dm",
63
+ ...(inGroup
64
+ ? {
65
+ group: {
66
+ id: scope.groupNo,
67
+ name: matchingGroup ? name(inTopic ? data.group_name : data.name) : null
68
+ }
69
+ }
70
+ : {}),
71
+ ...(inTopic
72
+ ? {
73
+ topic: {
74
+ id: scope.shortId,
75
+ name: matchingTopic ? name(data.name) : null
76
+ }
77
+ }
78
+ : {})
79
+ },
80
+ sender: senderUid ? known(senderUid) : { uid: null, name: null, type: "unknown" },
81
+ recipient: { botId: config.bot_id, name: known(config.bot_id).name },
82
+ mentions: {
83
+ targets: targets.map(known),
84
+ ...(enabled(mention.ais) ? { allBots: true } : {}),
85
+ ...(enabled(mention.all) ? { allMembers: true } : {}),
86
+ ...(enabled(mention.humans) ? { allHumans: true } : {})
87
+ }
88
+ }
89
+ };
90
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  // Port of octo-agent-app-channel/internal/transport/progress.go display rules.
6
6
  import { failureMessage } from "@mininglamp-oss/octo-runtime-protocol";
7
+ import { MODEL_WAIT_TIMEOUT_MESSAGE } from "../execution/model-wait.js";
7
8
  import { clampRunes, compactRunes } from "../presentation/run-projector.js";
8
9
  export function formatDuration(ms) {
9
10
  ms = Math.max(0, ms);
@@ -73,7 +74,7 @@ function action(item) {
73
74
  };
74
75
  }
75
76
  export function reasoningPhases(snapshot) {
76
- const steps = snapshot.items.filter((i) => i.kind === "model_step");
77
+ const steps = snapshot.modelSteps ?? snapshot.items.filter((i) => i.kind === "model_step");
77
78
  let phases;
78
79
  if (steps.length) {
79
80
  phases = steps.flatMap((step, index) => {
@@ -96,7 +97,7 @@ export function reasoningPhases(snapshot) {
96
97
  : ["stop", "end_turn", "completed"].includes(step.finishReason ?? "")
97
98
  ? "整理回答"
98
99
  : "模型处理";
99
- let heading = `第 ${index + 1} 轮 · ${label}${step.durationMs === undefined ? "" : " · " + formatDuration(step.durationMs)}`;
100
+ let heading = `第 ${step.ordinal ?? index + 1} 轮 · ${label}${step.durationMs === undefined ? "" : " · " + formatDuration(step.durationMs)}`;
100
101
  if (segments.length > 1)
101
102
  heading += ` · 阶段 ${segmentIndex + 1}`;
102
103
  const failed = children.some((i) => i.kind === "tool" && i.status === "failed" && i.outcome !== "check_findings");
@@ -320,6 +321,42 @@ export function buildReasoningFrame(snapshot, template) {
320
321
  }
321
322
  ];
322
323
  }
324
+ const waiting = snapshot.modelWait;
325
+ if (waiting?.seconds && !snapshot.terminal && !snapshot.resultUnknown) {
326
+ // active 模板的 progressText 位于原卡片底部;不向 phases 插入伪造模型过程。
327
+ frame.progressText = `${waiting.hasOutput ? "模型暂无新输出" : "尚未收到模型输出"},已连续等待 ${waiting.seconds} 秒。`;
328
+ frame.traceExpanded = true;
329
+ frame.traceCollapsed = false;
330
+ }
331
+ if (waiting?.timeout && snapshot.terminal !== "completed") {
332
+ const confirmed = waiting.timeout === "terminated" && !snapshot.resultUnknown;
333
+ const uncertain = snapshot.resultUnknown || waiting.timeout === "unconfirmed";
334
+ frame.state = confirmed ? "error" : snapshot.resultUnknown ? "stopped" : "reasoning";
335
+ frame.statusLabel = confirmed
336
+ ? "请求超时"
337
+ : uncertain
338
+ ? "超时 · 停止未确认"
339
+ : "超时 · 正在请求停止";
340
+ frame.statusTone = "Attention";
341
+ frame.collapsedSummary = MODEL_WAIT_TIMEOUT_MESSAGE;
342
+ const detail = confirmed
343
+ ? "已确认执行结束,可以重试。"
344
+ : uncertain
345
+ ? "尚未确认执行停止,请核查运行记录,避免重复执行。"
346
+ : "正在请求停止执行,等待结束确认。";
347
+ if (confirmed) {
348
+ frame.errorTitle = "请求超时";
349
+ frame.errorMessage = MODEL_WAIT_TIMEOUT_MESSAGE + detail;
350
+ delete frame.progressText;
351
+ }
352
+ else if (!snapshot.resultUnknown) {
353
+ frame.traceExpanded = true;
354
+ frame.traceCollapsed = false;
355
+ frame.progressText = MODEL_WAIT_TIMEOUT_MESSAGE + detail;
356
+ }
357
+ else
358
+ frame.collapsedSummary += detail;
359
+ }
323
360
  for (const phase of frame.phases)
324
361
  phase.thought = clampRunes(phase.thought, thoughtMax);
325
362
  let total = frame.phases.reduce((size, phase) => size + Array.from(phase.thought).length, 0);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 解析 HTTP Retry-After 的秒数或日期,返回相对 nowMs 的非负毫秒数。
3
+ * 无效值返回 undefined,过去日期返回零;默认退避和等待预算由调用方决定。
4
+ * 有限秒数换算溢出时保留 Infinity,使 REST 仍能按超预算拒绝,不能退回短等待。
5
+ */
6
+ export declare function parseRetryAfterMs(raw: string | null | undefined, nowMs?: number): number | undefined;
@@ -0,0 +1,60 @@
1
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2
+ const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
3
+ const imfFixdate = /^(?<weekday>Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?<day>\d{2}) (?<month>[A-Z][a-z]{2}) (?<year>\d{4}) (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2}) GMT$/;
4
+ const rfc850Date = /^(?<weekday>Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?<day>\d{2})-(?<month>[A-Z][a-z]{2})-(?<year>\d{2}) (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2}) GMT$/;
5
+ const asctimeDate = /^(?<weekday>Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?<month>[A-Z][a-z]{2}) (?<day>\d{2}| \d) (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2}) (?<year>\d{4})$/;
6
+ /**
7
+ * 解析 HTTP Retry-After 的秒数或日期,返回相对 nowMs 的非负毫秒数。
8
+ * 无效值返回 undefined,过去日期返回零;默认退避和等待预算由调用方决定。
9
+ * 有限秒数换算溢出时保留 Infinity,使 REST 仍能按超预算拒绝,不能退回短等待。
10
+ */
11
+ export function parseRetryAfterMs(raw, nowMs = Date.now()) {
12
+ // 先限制字符集,trim 才只会移除 HTTP 的 SP/HTAB;避免空白正则在长畸形值上重复回溯。
13
+ if (raw == null || /[^\t\x20-\x7e]/.test(raw))
14
+ return undefined;
15
+ const value = raw.trim();
16
+ if (!value)
17
+ return undefined;
18
+ // HTTP 秒数只接受十进制;保留 REST 的普通小数兼容,不接收 Number 的进制、符号或指数语法。
19
+ if (/^(?:\d+(?:\.\d*)?|\.\d+)$/.test(value)) {
20
+ const seconds = Number(value);
21
+ if (!Number.isFinite(seconds))
22
+ return undefined;
23
+ return Math.round(seconds * 1000);
24
+ }
25
+ const fields = (imfFixdate.exec(value) ?? rfc850Date.exec(value) ?? asctimeDate.exec(value))
26
+ ?.groups;
27
+ if (!fields)
28
+ return undefined;
29
+ let year = Number(fields.year);
30
+ const month = months.indexOf(fields.month);
31
+ const day = Number(fields.day);
32
+ const hour = Number(fields.hour);
33
+ const minute = Number(fields.minute);
34
+ const second = Number(fields.second);
35
+ if (month < 0 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 60)
36
+ return undefined;
37
+ // 三种 HTTP-date 均为 UTC。先保留第 59 秒以校验日历,闰秒最后映射到下一秒。
38
+ const date = new Date(0);
39
+ const leapSecondMs = second === 60 ? 1000 : 0;
40
+ if (fields.year.length === 2) {
41
+ const limit = new Date(nowMs);
42
+ limit.setUTCFullYear(limit.getUTCFullYear() + 50);
43
+ year += Math.floor(limit.getUTCFullYear() / 100) * 100;
44
+ date.setUTCFullYear(year, month, day);
45
+ date.setUTCHours(hour, minute, Math.min(second, 59), 0);
46
+ // 比较完整 UTC 时间戳:恰好 50 年保留,超过才回到最近的过去世纪。
47
+ if (date.getTime() + leapSecondMs > limit.getTime())
48
+ year -= 100;
49
+ }
50
+ date.setUTCFullYear(year, month, day);
51
+ date.setUTCHours(hour, minute, Math.min(second, 59), 0);
52
+ // Date 的分量 API 会自动顺延无效日期,必须回读校验;星期按最终展开的年份校验。
53
+ if (year < 1900 ||
54
+ date.getUTCFullYear() !== year ||
55
+ date.getUTCMonth() !== month ||
56
+ date.getUTCDate() !== day ||
57
+ weekdays[date.getUTCDay()] !== fields.weekday.slice(0, 3))
58
+ return undefined;
59
+ return Math.max(0, date.getTime() + leapSecondMs - nowMs);
60
+ }
@@ -30,6 +30,7 @@ export declare class WukongConnection {
30
30
  clientMsgNo: string;
31
31
  spaceId?: unknown;
32
32
  }) => void) | undefined;
33
+ readonly onDelivered?: ((clientMsgNo: string) => void) | undefined;
33
34
  constructor(onMessage: (message: ImMessage) => void, onDisconnect?: (error: Error) => void, onPosition?: ((position: {
34
35
  channelId: string;
35
36
  channelType: number;
@@ -38,7 +39,7 @@ export declare class WukongConnection {
38
39
  messageId: string;
39
40
  clientMsgNo: string;
40
41
  spaceId?: unknown;
41
- }) => void) | undefined);
42
+ }) => void) | undefined, onDelivered?: ((clientMsgNo: string) => void) | undefined);
42
43
  get connected(): boolean;
43
44
  connect(registration: BotRegistration): Promise<void>;
44
45
  sendText(channelId: string, channelType: number, text: string, clientMsgNo?: string, spaceId?: string, mention?: ImTextMention, signal?: AbortSignal, onPosition?: (sequence: number) => void): Promise<string>;
@@ -6,11 +6,13 @@ import { createCipheriv, createDecipheriv, createHash, createPublicKey, diffieHe
6
6
  import WebSocket from "ws";
7
7
  import { ImSendError, ImTextSend } from "../delivery/text-send.js";
8
8
  import { isRulesNotification } from "./normalize.js";
9
+ import { trimTrailingSlashes } from "./api/url.js";
9
10
  import { connectionFetch, connectionJson, httpConnectionFailure, ImConnectionError, wukongConnectionFailure } from "./connection-error.js";
10
11
  const LIMIT = 1 << 20;
11
12
  const md5 = (value) => createHash("md5").update(value).digest("hex");
12
13
  export async function registerBot(apiUrl, token, signal) {
13
- const response = await connectionFetch(`${apiUrl.replace(/\/$/, "")}/v1/bot/register`, {
14
+ // 与鉴权及其他 REST 请求共用尾斜杠处理,保留 API 路径前缀。
15
+ const response = await connectionFetch(`${trimTrailingSlashes(apiUrl)}/v1/bot/register`, {
14
16
  method: "POST",
15
17
  // 返回重定向状态供统一分类,不跟随到新地址,也不将其折叠成网络暂态。
16
18
  redirect: "manual",
@@ -118,6 +120,7 @@ export class WukongConnection {
118
120
  onMessage;
119
121
  onDisconnect;
120
122
  onPosition;
123
+ onDelivered;
121
124
  #socket;
122
125
  #closing;
123
126
  #key;
@@ -126,7 +129,7 @@ export class WukongConnection {
126
129
  #buffer = Buffer.alloc(0);
127
130
  #seq = 0;
128
131
  #heartbeat;
129
- #lastPacket = Date.now();
132
+ #awaitingPong = false;
130
133
  #closed = false;
131
134
  #ready = false;
132
135
  #sends = new Map();
@@ -134,10 +137,11 @@ export class WukongConnection {
134
137
  #confirmed = new Set();
135
138
  #retained = new Map();
136
139
  #abort = new AbortController();
137
- constructor(onMessage, onDisconnect = () => { }, onPosition) {
140
+ constructor(onMessage, onDisconnect = () => { }, onPosition, onDelivered) {
138
141
  this.onMessage = onMessage;
139
142
  this.onDisconnect = onDisconnect;
140
143
  this.onPosition = onPosition;
144
+ this.onDelivered = onDelivered;
141
145
  }
142
146
  get connected() {
143
147
  return this.#ready && this.#socket?.readyState === WebSocket.OPEN;
@@ -210,9 +214,10 @@ export class WukongConnection {
210
214
  const header = this.#buffer[0], kind = header >> 4;
211
215
  if (kind === 7 || kind === 8) {
212
216
  this.#buffer = this.#buffer.subarray(1);
213
- this.#lastPacket = Date.now();
214
217
  if (kind === 7)
215
218
  socket.send(Buffer.from([8 << 4]));
219
+ else
220
+ this.#awaitingPong = false;
216
221
  continue;
217
222
  }
218
223
  let length = 0, multiplier = 1, offset = 1, complete = false;
@@ -237,7 +242,6 @@ export class WukongConnection {
237
242
  break;
238
243
  const reader = new Reader(this.#buffer.subarray(offset, offset + length));
239
244
  this.#buffer = this.#buffer.subarray(offset + length);
240
- this.#lastPacket = Date.now();
241
245
  if (kind === 2 && !ready) {
242
246
  if (header & 1)
243
247
  this.#version = reader.byte();
@@ -263,14 +267,21 @@ export class WukongConnection {
263
267
  ready = true;
264
268
  this.#ready = true;
265
269
  clearTimeout(timeout);
270
+ // 切网不一定触发 TCP close,必须主动确认这条连接的双向协议链路。
271
+ // 每 5 秒 PING,下一次检查仍无 PONG 即关闭;推送或服务端 PING 不能续命。
272
+ // 单连接最多一个在途探测,回调延迟时不补发积压 PING;close 负责通知上层重连。
266
273
  this.#heartbeat = setInterval(() => {
267
- if (Date.now() - this.#lastPacket > 90_000) {
274
+ if (this.#awaitingPong) {
275
+ this.#ready = false;
276
+ clearInterval(this.#heartbeat);
268
277
  failure = new ImConnectionError("IM_HEARTBEAT_TIMEOUT", true);
269
278
  socket.terminate();
270
279
  }
271
- else if (socket.readyState === WebSocket.OPEN)
280
+ else if (socket.readyState === WebSocket.OPEN) {
281
+ this.#awaitingPong = true;
272
282
  socket.send(Buffer.from([7 << 4]));
273
- }, 25_000);
283
+ }
284
+ }, 5_000);
274
285
  this.#heartbeat.unref();
275
286
  resolve();
276
287
  }
@@ -294,6 +305,7 @@ export class WukongConnection {
294
305
  this.#confirmed.add(pending.key);
295
306
  if (this.#confirmed.size > 512)
296
307
  this.#confirmed.delete(this.#confirmed.values().next().value);
308
+ this.onDelivered?.(pending.key);
297
309
  this.#forget(pending.operation);
298
310
  }
299
311
  pending.operation.ack(id, reason);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-channel-gateway",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,11 +22,11 @@
22
22
  "docs"
23
23
  ],
24
24
  "dependencies": {
25
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.5",
26
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.5",
27
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.5",
28
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.5",
29
- "@mininglamp-oss/octo-runtime-protocol": "1.1.5",
25
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.7",
26
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7",
27
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.7",
28
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.7",
29
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.7",
30
30
  "mdast-util-from-markdown": "2.1.0",
31
31
  "ws": "8.22.0"
32
32
  }
@@ -13,6 +13,11 @@ import { createImInvocation } from "../execution/dispatcher.js";
13
13
  import { ImDeliveryDispatcher } from "../delivery/dispatcher.js";
14
14
  import { ImRunProjector } from "../presentation/run-projector.js";
15
15
  import { MemoryImSessionStore } from "./session-store.js";
16
+ // 仅精确匹配已定义的准备期原因;未知异常正文不得进入回复或新增诊断。
17
+ const preparationFailureMessages = new Map([
18
+ ["IM_AGENT_WORKDIR_FIXED", "本轮工作目录与固定目录配置冲突,尚未发起执行。请检查工作目录配置。"],
19
+ ["IM_RULE_PROTOCOL_INVALID", "规则数据格式不符合协议,尚未发起执行。请检查规则服务返回格式。"]
20
+ ]);
16
21
  export class ImRuntime {
17
22
  dependencies;
18
23
  #preparing = new Map();
@@ -500,10 +505,13 @@ export class ImRuntime {
500
505
  catch (error) {
501
506
  if (turnSignal.aborted)
502
507
  return;
503
- if (error instanceof Error && /^IM_CONTEXT_(?:LOADING|RESULT)_[A-Z_]+$/.test(error.message))
508
+ const preparationMessage = error instanceof Error ? preparationFailureMessages.get(error.message) : undefined;
509
+ if (error instanceof Error &&
510
+ (preparationMessage || /^IM_CONTEXT_(?:LOADING|RESULT)_[A-Z_]+$/.test(error.message)))
504
511
  this.#diagnostic(error.message);
505
512
  this.#diagnostic("IM_CONTEXT_PREPARATION_FAILED");
506
- await this.#reply(message, "本轮输入或执行配置准备失败,尚未发起执行。请检查配置、会话权限或稍后重试。", `prepare:${occurrenceId ?? message.messageId}`);
513
+ await this.#reply(message, preparationMessage ??
514
+ "本轮输入或执行配置准备失败,尚未发起执行。请检查配置、会话权限或稍后重试。", `prepare:${occurrenceId ?? message.messageId}`);
507
515
  return;
508
516
  }
509
517
  finally {
@@ -31,7 +31,20 @@ async function initialize(context, config, dependencies) {
31
31
  signal: context.signal,
32
32
  log: context.log,
33
33
  // 与 Gateway 共用逐轮合同:宿主数据可变,连接与 manager 仍由 Extra 整体封装。
34
- prepareContexts: (bot, signal) => contexts.load(bot, signal),
34
+ prepareContexts: async (bot, signal) => {
35
+ let ignored = 0;
36
+ const business = await contexts.load(bot, signal, (items) => {
37
+ const selected = items.filter((item) => item.namespace !== "extra.im");
38
+ ignored += items.length - selected.length;
39
+ return selected;
40
+ });
41
+ // 保留命名空间误配只记数量,不输出内容或阻断当前任务。
42
+ if (ignored)
43
+ context.log("warn", "channel.context.reserved_ignored", {
44
+ ignored_items: ignored
45
+ });
46
+ return business;
47
+ },
35
48
  credentials: (bot) => Promise.resolve(configuredCredential(bot)),
36
49
  ...(allowed
37
50
  ? {
@@ -76,9 +76,8 @@ export class WecomTransport {
76
76
  text: body.text.content,
77
77
  buildContext: (_signal, options) => Promise.resolve({
78
78
  schema: CONTEXT_SCHEMA,
79
- items: structuredClone([
80
- ...(options?.configuredItems ?? this.config.context?.items ?? [])
81
- ])
79
+ // extra.im 由本渠道构造;宿主业务材料须使用其他命名空间。
80
+ items: structuredClone((options?.configuredItems ?? this.config.context?.items ?? []).filter((item) => item.namespace !== "extra.im"))
82
81
  }),
83
82
  beginPresentation: (_runId, onDiagnostic) => {
84
83
  this.#streams.add(stream);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-channel-wecom",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,10 +22,10 @@
22
22
  "docs"
23
23
  ],
24
24
  "dependencies": {
25
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.5",
26
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.5",
27
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.5",
25
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.7",
26
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.7",
27
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.7",
28
28
  "ws": "8.22.0",
29
- "@mininglamp-oss/octo-runtime-protocol": "1.1.5"
29
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.7"
30
30
  }
31
31
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-webui",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Local Runtime workbench with canonical SSE presentation",
@@ -23,6 +23,6 @@
23
23
  "porting-map.md"
24
24
  ],
25
25
  "dependencies": {
26
- "@mininglamp-oss/octo-runtime-protocol": "1.1.5"
26
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.7"
27
27
  }
28
28
  }
@@ -17,14 +17,15 @@ export interface ChannelDependencies {
17
17
  * 只合并本轮数据,不保留历史。动态同 key 整项替换且保留静态位置,新项按返回顺序追加。
18
18
  * instructions.entries 也不拼接:覆盖方须显式保留需要的固定人设;空动态列表不删除静态项。
19
19
  * 两个来源先分别校验,避免同源重复 key 被覆盖掩盖;返回副本隔离宿主与插件的后续修改。
20
+ * 调用方可在来源校验后显式选择有效项,选择策略归调用方;最终合并预算仍强制校验。
20
21
  */
21
- export declare function mergeConfiguredContexts(base: readonly ContextItem[], dynamic: readonly ContextItem[]): ContextItem[];
22
+ export declare function mergeConfiguredContexts(base: readonly ContextItem[], dynamic: readonly ContextItem[], selectItems?: (items: readonly ContextItem[]) => readonly ContextItem[]): ContextItem[];
22
23
  /**
23
24
  * 每个 Extra 共用一个有界回调池,而非每个 Bot 各建一份额度。
24
25
  * 超时只结束本轮等待,不能强制结束外部 Promise;实际操作结束前仍须占额,防止挂起 IO 累积。
25
26
  */
26
27
  export declare function createContextLoader(callback: LoadContexts | undefined, settings: JsonValue | undefined, owner: AbortSignal): {
27
- load(config: JsonObject, signal: AbortSignal): Promise<ContextItem[]>;
28
+ load(config: JsonObject, signal: AbortSignal, selectItems?: (items: readonly ContextItem[]) => readonly ContextItem[]): Promise<ContextItem[]>;
28
29
  close(): Promise<void>;
29
30
  readonly inFlight: number;
30
31
  };
@@ -3,10 +3,17 @@ import { CONTEXT_SCHEMA, assertContextEnvelope } from "@mininglamp-oss/octo-runt
3
3
  * 只合并本轮数据,不保留历史。动态同 key 整项替换且保留静态位置,新项按返回顺序追加。
4
4
  * instructions.entries 也不拼接:覆盖方须显式保留需要的固定人设;空动态列表不删除静态项。
5
5
  * 两个来源先分别校验,避免同源重复 key 被覆盖掩盖;返回副本隔离宿主与插件的后续修改。
6
+ * 调用方可在来源校验后显式选择有效项,选择策略归调用方;最终合并预算仍强制校验。
6
7
  */
7
- export function mergeConfiguredContexts(base, dynamic) {
8
+ export function mergeConfiguredContexts(base, dynamic, selectItems) {
8
9
  assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: base });
9
10
  assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: dynamic });
11
+ if (selectItems) {
12
+ base = selectItems(base);
13
+ dynamic = selectItems(dynamic);
14
+ assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: base });
15
+ assertContextEnvelope({ schema: CONTEXT_SCHEMA, items: dynamic });
16
+ }
10
17
  const items = [...base];
11
18
  const positions = new Map(items.map((item, index) => [`${item.namespace}/${item.name}`, index]));
12
19
  for (const item of dynamic) {
@@ -48,12 +55,12 @@ export function createContextLoader(callback, settings, owner) {
48
55
  const pending = new Set();
49
56
  const stop = new AbortController();
50
57
  return {
51
- async load(config, signal) {
58
+ async load(config, signal, selectItems) {
52
59
  const base = config.context?.items ?? [];
53
60
  if (!Array.isArray(base))
54
61
  throw new Error("IM_CONTEXT_INVALID");
55
62
  if (!callback)
56
- return mergeConfiguredContexts(base, []);
63
+ return mergeConfiguredContexts(base, [], selectItems);
57
64
  owner.throwIfAborted();
58
65
  stop.signal.throwIfAborted();
59
66
  signal.throwIfAborted();
@@ -74,7 +81,7 @@ export function createContextLoader(callback, settings, owner) {
74
81
  // 超时或取消后的迟到结果不能再校验、复制或进入本轮模型输入。
75
82
  combined.throwIfAborted();
76
83
  assertBoundedJson(items);
77
- return mergeConfiguredContexts(base, items);
84
+ return mergeConfiguredContexts(base, items, selectItems);
78
85
  });
79
86
  pending.add(operation);
80
87
  // 跟踪真实操作,而非 race 的等待结果;迟到 reject 也必须被消费,避免未处理拒绝。
@@ -1,4 +1,6 @@
1
+ /** 按选定平台规范化 Home 字符串;Windows 忽略大小写,其他平台保留大小写,不访问文件系统。 */
1
2
  export declare function normalizedHome(home: string, platform?: NodeJS.Platform): string;
2
3
  export declare function homeHash(home: string, platform?: NodeJS.Platform): string;
4
+ /** 按 Home 和组件派生本地 IPC 地址;平台路径差异在内部处理,无需调用方转换路径。 */
3
5
  export declare function componentEndpoint(home: string, component?: string, platform?: NodeJS.Platform): string;
4
6
  export declare function componentServiceId(home: string, component: string, platform?: NodeJS.Platform): string;
@@ -1,17 +1,19 @@
1
1
  import { createHash } from "node:crypto";
2
- import { join, resolve, win32 } from "node:path";
2
+ import { posix, win32 } from "node:path";
3
+ /** 按选定平台规范化 Home 字符串;Windows 忽略大小写,其他平台保留大小写,不访问文件系统。 */
3
4
  export function normalizedHome(home, platform = process.platform) {
4
- return platform === "win32" ? win32.resolve(home).toLowerCase() : resolve(home);
5
+ return platform === "win32" ? win32.resolve(home).toLowerCase() : posix.resolve(home);
5
6
  }
6
7
  export function homeHash(home, platform = process.platform) {
7
8
  return createHash("sha256").update(normalizedHome(home, platform)).digest("hex").slice(0, 16);
8
9
  }
10
+ /** 按 Home 和组件派生本地 IPC 地址;平台路径差异在内部处理,无需调用方转换路径。 */
9
11
  export function componentEndpoint(home, component = "executor-kernel", platform = process.platform) {
10
12
  if (!/^[a-z][a-z0-9-]{0,69}$/.test(component))
11
13
  throw new Error("COMPONENT_INVALID");
12
14
  return platform === "win32"
13
15
  ? `\\\\.\\pipe\\octo-runtime-${component === "executor-kernel" ? "kernel" : component}-${homeHash(home, platform)}`
14
- : join(normalizedHome(home), "sockets", `octo-runtime-${component}.sock`);
16
+ : posix.join(normalizedHome(home, platform), "sockets", `octo-runtime-${component}.sock`);
15
17
  }
16
18
  export function componentServiceId(home, component, platform = process.platform) {
17
19
  if (!/^[a-z][a-z0-9-]{0,69}$/.test(component))
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-host-sdk",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,9 +23,9 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.5",
27
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.5",
28
- "@mininglamp-oss/octo-runtime-protocol": "1.1.5"
26
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7",
27
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.7",
28
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.7"
29
29
  },
30
30
  "types": "./dist/index.d.ts",
31
31
  "files": [
@@ -28,7 +28,7 @@ export function assertContextEnvelope(value) {
28
28
  const keys = new Set();
29
29
  for (const item of value.items) {
30
30
  object(item, "CONTEXT_SCHEMA_INVALID");
31
- fields(item, ["namespace", "name", "guidance", "payload"]);
31
+ fields(item, ["namespace", "name", "guidance", "data_format", "payload"]);
32
32
  for (const property of ["namespace", "name"]) {
33
33
  const text = item[property];
34
34
  if (typeof text !== "string" || text.length > 96 || !/^[a-z0-9][a-z0-9._-]*$/.test(text))
@@ -45,6 +45,13 @@ export function assertContextEnvelope(value) {
45
45
  throw new TypeError("CONTEXT_GUIDANCE_FORBIDDEN");
46
46
  }
47
47
  object(item.payload, "CONTEXT_SCHEMA_INVALID");
48
+ if (item.data_format !== undefined) {
49
+ if (item.data_format !== "text" || !String(item.namespace).startsWith("extra."))
50
+ throw new TypeError("CONTEXT_SCHEMA_INVALID");
51
+ fields(item.payload, ["text"]);
52
+ if (typeof item.payload.text !== "string")
53
+ throw new TypeError("CONTEXT_SCHEMA_INVALID");
54
+ }
48
55
  publicPayload(item.namespace, item.name, item.payload);
49
56
  }
50
57
  if (new TextEncoder().encode(JSON.stringify(value)).length > CONTEXT_MAX_BYTES)
@@ -10,7 +10,7 @@ export interface FailureClassificationContext {
10
10
  occurredAt?: string;
11
11
  /** Only trusted downstream boundaries may retain a previously validated envelope. */
12
12
  preserveExisting?: boolean;
13
- /** 仅可信调用边界在确认 Kernel 本地写出前拒绝后设置;错误字符串不能提供此证据。 */
13
+ /** 仅可信调用边界确认未进入执行源后设置;错误字符串不能提供此证据。 */
14
14
  invocationNotSubmitted?: boolean;
15
15
  }
16
16
  interface CatalogEntry {
@@ -59,6 +59,7 @@ export declare const FAILURE_CATALOG: Readonly<{
59
59
  "OH-PRV-4007": CatalogEntry;
60
60
  "OH-PRV-4008": CatalogEntry;
61
61
  "OH-PRV-4009": CatalogEntry;
62
+ "OH-PRV-4010": CatalogEntry;
62
63
  "OH-PRV-4099": CatalogEntry;
63
64
  "OH-SYS-9001": CatalogEntry;
64
65
  }>;