@mininglamp-oss/octo-runtime 1.1.6 → 1.1.8

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 (250) hide show
  1. package/apps/cli/dist/build-info.json +2 -2
  2. package/dist/public/dsh.d.ts +1 -1
  3. package/dist/public/dsh.js +1 -1
  4. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  5. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +9 -1
  6. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +17 -0
  7. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  8. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +20 -2
  9. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  10. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +32 -2
  11. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +3 -0
  12. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  13. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +16 -2
  14. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  15. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +5 -0
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +32 -2
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-IW62UM3C.js → chunk-CFKMMCO6.js} +5 -3
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-FWAPYRV2.js → chunk-LO34KB7D.js} +1 -1
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-3GXX5VD5.js → chunk-V5W6ZTYC.js} +14 -6
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +4 -2
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +3 -1
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +17 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +8 -6
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +1 -0
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +4 -3
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +9 -1
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +10 -6
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +9 -1
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +9 -1
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +9 -1
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +2 -1
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +12 -40
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +22 -2
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +422 -135
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +6 -2
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +2 -0
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +9 -1
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +9 -1
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +19 -5
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +8 -5
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.d.ts +2 -0
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +22 -0
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +20 -0
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +14 -1
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +20 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  59. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
  61. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.d.ts +2 -1
  62. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/runner.js +102 -52
  63. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +8 -3
  64. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +5 -3
  65. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +4 -3
  66. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +1 -1
  67. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +2 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
  69. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +9 -6
  70. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  71. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  72. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
  73. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.d.ts +17 -1
  74. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +22 -6
  75. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.d.ts +3 -0
  76. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/history-context.js +27 -0
  77. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +447 -241
  78. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.d.ts +5 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/rules-context.js +42 -4
  80. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +5 -0
  81. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.d.ts +15 -0
  82. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/stable-context.js +28 -0
  83. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +17 -7
  84. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +4 -5
  85. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +12 -9
  86. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +1 -0
  87. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +7 -5
  88. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.d.ts +4 -0
  89. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.js +29 -6
  90. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +15 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +36 -0
  92. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.d.ts +2 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/scheduler.js +10 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.d.ts +6 -0
  95. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.js +10 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +5 -2
  97. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +36 -22
  98. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +14 -1
  99. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +4 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +5 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.js +265 -38
  102. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.d.ts +4 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +5 -5
  104. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +7 -0
  105. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +19 -2
  106. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.d.ts +3 -1
  107. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +4 -3
  108. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.d.ts +0 -12
  109. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/errors.js +5 -3
  110. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +2 -1
  111. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +8 -6
  112. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.d.ts +3 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/messages.js +2 -2
  114. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +5 -4
  115. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +76 -20
  116. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +19 -1
  117. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +197 -66
  118. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +2 -4
  119. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +5 -6
  120. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +52 -36
  121. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.d.ts +2 -6
  122. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +53 -82
  123. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.d.ts +12 -0
  124. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-content.js +133 -0
  125. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.d.ts +21 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/history-messages.js +76 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +0 -2
  128. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +0 -2
  129. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.d.ts +16 -0
  130. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-identities.js +74 -0
  131. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.d.ts +4 -0
  132. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-time.js +19 -0
  133. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.d.ts +7 -0
  134. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/message-trigger.js +90 -0
  135. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +44 -9
  136. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.d.ts +6 -0
  137. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/retry-after.js +60 -0
  138. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +0 -10
  139. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +19 -127
  140. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  141. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +10 -2
  142. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/extra.js +14 -1
  143. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/transport/channel.js +2 -3
  144. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  145. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-CXTvRGim.js → index-B127MhT-.js} +10 -9
  146. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  147. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  148. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.d.ts +3 -2
  149. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +11 -4
  150. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  151. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +8 -1
  152. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +9 -0
  153. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +3 -0
  154. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +6 -0
  155. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +14 -0
  156. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  157. package/node_modules/iconv-lite/LICENSE +21 -0
  158. package/node_modules/iconv-lite/README.md +138 -0
  159. package/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  160. package/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  161. package/node_modules/iconv-lite/encodings/index.js +23 -0
  162. package/node_modules/iconv-lite/encodings/internal.js +218 -0
  163. package/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  164. package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  165. package/node_modules/iconv-lite/encodings/sbcs-data.js +180 -0
  166. package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  167. package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  168. package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  169. package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  170. package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  171. package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  172. package/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  173. package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  174. package/node_modules/iconv-lite/encodings/utf16.js +187 -0
  175. package/node_modules/iconv-lite/encodings/utf32.js +314 -0
  176. package/node_modules/iconv-lite/encodings/utf7.js +283 -0
  177. package/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  178. package/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  179. package/node_modules/iconv-lite/lib/index.d.ts +129 -0
  180. package/node_modules/iconv-lite/lib/index.js +182 -0
  181. package/node_modules/iconv-lite/lib/streams.js +105 -0
  182. package/node_modules/iconv-lite/package.json +70 -0
  183. package/node_modules/iconv-lite/types/encodings.d.ts +425 -0
  184. package/node_modules/safer-buffer/LICENSE +21 -0
  185. package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  186. package/node_modules/safer-buffer/Readme.md +156 -0
  187. package/node_modules/safer-buffer/dangerous.js +58 -0
  188. package/node_modules/safer-buffer/package.json +34 -0
  189. package/node_modules/safer-buffer/safer.js +77 -0
  190. package/node_modules/safer-buffer/tests.js +406 -0
  191. package/node_modules/semver/LICENSE +15 -0
  192. package/node_modules/semver/README.md +680 -0
  193. package/node_modules/semver/bin/semver.js +195 -0
  194. package/node_modules/semver/classes/comparator.js +143 -0
  195. package/node_modules/semver/classes/index.js +7 -0
  196. package/node_modules/semver/classes/range.js +577 -0
  197. package/node_modules/semver/classes/semver.js +350 -0
  198. package/node_modules/semver/functions/clean.js +8 -0
  199. package/node_modules/semver/functions/cmp.js +54 -0
  200. package/node_modules/semver/functions/coerce.js +62 -0
  201. package/node_modules/semver/functions/compare-build.js +9 -0
  202. package/node_modules/semver/functions/compare-loose.js +5 -0
  203. package/node_modules/semver/functions/compare.js +7 -0
  204. package/node_modules/semver/functions/diff.js +60 -0
  205. package/node_modules/semver/functions/eq.js +5 -0
  206. package/node_modules/semver/functions/gt.js +5 -0
  207. package/node_modules/semver/functions/gte.js +5 -0
  208. package/node_modules/semver/functions/inc.js +21 -0
  209. package/node_modules/semver/functions/lt.js +5 -0
  210. package/node_modules/semver/functions/lte.js +5 -0
  211. package/node_modules/semver/functions/major.js +5 -0
  212. package/node_modules/semver/functions/minor.js +5 -0
  213. package/node_modules/semver/functions/neq.js +5 -0
  214. package/node_modules/semver/functions/parse.js +18 -0
  215. package/node_modules/semver/functions/patch.js +5 -0
  216. package/node_modules/semver/functions/prerelease.js +8 -0
  217. package/node_modules/semver/functions/rcompare.js +5 -0
  218. package/node_modules/semver/functions/rsort.js +5 -0
  219. package/node_modules/semver/functions/satisfies.js +12 -0
  220. package/node_modules/semver/functions/sort.js +5 -0
  221. package/node_modules/semver/functions/truncate.js +48 -0
  222. package/node_modules/semver/functions/valid.js +8 -0
  223. package/node_modules/semver/index.js +93 -0
  224. package/node_modules/semver/internal/constants.js +37 -0
  225. package/node_modules/semver/internal/debug.js +11 -0
  226. package/node_modules/semver/internal/identifiers.js +29 -0
  227. package/node_modules/semver/internal/lrucache.js +42 -0
  228. package/node_modules/semver/internal/parse-options.js +17 -0
  229. package/node_modules/semver/internal/re.js +223 -0
  230. package/node_modules/semver/package.json +78 -0
  231. package/node_modules/semver/preload.js +4 -0
  232. package/node_modules/semver/range.bnf +17 -0
  233. package/node_modules/semver/ranges/gtr.js +6 -0
  234. package/node_modules/semver/ranges/intersects.js +9 -0
  235. package/node_modules/semver/ranges/ltr.js +6 -0
  236. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  237. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  238. package/node_modules/semver/ranges/min-version.js +63 -0
  239. package/node_modules/semver/ranges/outside.js +82 -0
  240. package/node_modules/semver/ranges/simplify.js +49 -0
  241. package/node_modules/semver/ranges/subset.js +249 -0
  242. package/node_modules/semver/ranges/to-comparators.js +10 -0
  243. package/node_modules/semver/ranges/valid.js +13 -0
  244. package/package.json +33 -27
  245. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +8 -1
  246. package/packages/octo-runtime-protocol/schema/protocol.schema.json +43 -1
  247. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/text-send.d.ts +0 -19
  248. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/text-send.js +0 -86
  249. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.d.ts +0 -5
  250. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.js +0 -35
@@ -14,12 +14,15 @@ export interface ImRulesContext {
14
14
  providerSessionId: string;
15
15
  };
16
16
  }
17
+ export declare function rulesGuidance(item: ContextItem): string;
18
+ /** 版本游标在应用层保留;执行快照只携带实际规则正文。显式宿主项不改写。 */
19
+ export declare function modelRulesContext(item: ContextItem): ContextItem;
17
20
  /** 仅选择 Gateway 自动读取的规则;宿主显式提交的 Context 不参与省略。 */
18
- export declare function selectRulesContext(context: ContextEnvelope, cursor: ImRulesContext | undefined, provider: ProviderSession | undefined): {
21
+ export declare function selectRulesContext(context: ContextEnvelope, cursor: ImRulesContext | undefined, provider: ProviderSession | undefined, refresh?: boolean): {
19
22
  context: ContextEnvelope;
20
23
  versions?: ImRulesVersions;
21
24
  omitted: ContextItem[];
22
25
  };
23
- /** 恢复新 Provider 会话时显式重带本轮规则和原 inputs,不改变普通续聊输入。 */
26
+ /** 新 Provider 恢复本轮省略的渠道材料(规则、稳定说明和已覆盖历史),保留原 inputs/图片。 */
24
27
  export declare function addRulesRecovery(input: ImInvocationInput, rules: ContextItem[]): void;
25
28
  export {};
@@ -1,5 +1,31 @@
1
+ export function rulesGuidance(item) {
2
+ const document = item.name === "group-rules" ? "Octo IM Group's GROUP.md" : "Octo IM Group Topic Rules";
3
+ if (item.payload.status === "not_found")
4
+ return `${document} is currently unavailable (not found); previously supplied rules no longer apply.`;
5
+ if (item.payload.status === "empty")
6
+ return `${document} is currently empty; previously supplied rules no longer apply.`;
7
+ return `${document}. These rules replace the previously supplied version.`;
8
+ }
9
+ /** 版本游标在应用层保留;执行快照只携带实际规则正文。显式宿主项不改写。 */
10
+ export function modelRulesContext(item) {
11
+ if (item.namespace !== "extra.im" ||
12
+ !["group-rules", "topic-rules"].includes(item.name) ||
13
+ item.payload.automatic !== true)
14
+ return item;
15
+ return {
16
+ namespace: item.namespace,
17
+ name: item.name,
18
+ guidance: rulesGuidance(item),
19
+ data_format: "text",
20
+ payload: {
21
+ text: typeof item.payload.text === "string" && item.payload.text.trim()
22
+ ? item.payload.text
23
+ : "NO RULES"
24
+ }
25
+ };
26
+ }
1
27
  /** 仅选择 Gateway 自动读取的规则;宿主显式提交的 Context 不参与省略。 */
2
- export function selectRulesContext(context, cursor, provider) {
28
+ export function selectRulesContext(context, cursor, provider, refresh = false) {
3
29
  const rules = context.items.filter((item) => item.namespace === "extra.im" &&
4
30
  ["group-rules", "topic-rules"].includes(item.name) &&
5
31
  item.payload.automatic === true);
@@ -14,7 +40,8 @@ export function selectRulesContext(context, cursor, provider) {
14
40
  const versions = { group: stamp(group), ...(topic ? { topic: stamp(topic) } : {}) };
15
41
  const supplied = cursor?.supplied;
16
42
  const same = (left, right) => left?.version === right?.version && left?.status === right?.status;
17
- if (!provider?.sessionId ||
43
+ if (refresh ||
44
+ !provider?.sessionId ||
18
45
  provider.resumable === false ||
19
46
  !supplied ||
20
47
  supplied.providerSessionId !== provider.sessionId ||
@@ -27,11 +54,22 @@ export function selectRulesContext(context, cursor, provider) {
27
54
  omitted: rules
28
55
  };
29
56
  }
30
- /** 恢复新 Provider 会话时显式重带本轮规则和原 inputs,不改变普通续聊输入。 */
57
+ /** 新 Provider 恢复本轮省略的渠道材料(规则、稳定说明和已覆盖历史),保留原 inputs/图片。 */
31
58
  export function addRulesRecovery(input, rules) {
32
59
  if (!rules.length)
33
60
  return;
34
- const text = `以下为当前群和话题规则,替代旧版本;empty/not_found 表示旧规则已撤销。\n${JSON.stringify(rules)}`;
61
+ const text = [
62
+ "Current channel context for session recovery:",
63
+ ...rules
64
+ .map(modelRulesContext)
65
+ .map((item) => [
66
+ `${item.namespace}/${item.name}`,
67
+ ...(item.guidance ? [item.guidance] : []),
68
+ item.data_format === "text"
69
+ ? String(item.payload.text)
70
+ : JSON.stringify(item.payload, null, 2)
71
+ ].join("\n"))
72
+ ].join("\n\n");
35
73
  input.freshFallbackModelInputParts = [{ type: "text", text }, ...structuredClone(input.inputs)];
36
74
  input.freshFallbackModelInput = input.freshFallbackModelInputParts
37
75
  .map((part) => (part.type === "text" ? part.text : "[Image]"))
@@ -3,22 +3,27 @@ import type { FailureEnvelope, ProviderSession } from "@mininglamp-oss/octo-runt
3
3
  import type { ImTaskAttempt } from "../contracts.js";
4
4
  import type { ImGapMetadata, ImGapTurnToken } from "./context-gap.js";
5
5
  import type { ImRulesContext } from "./rules-context.js";
6
+ import type { ImStableContextState } from "./stable-context.js";
7
+ import type { ImArtifactPolicy } from "../delivery/artifact-policy.js";
6
8
  export interface ImSessionOccurrence {
7
9
  text: string;
8
10
  sessionId: string;
9
11
  runId: string;
10
12
  snapshot?: ImInvocationInput;
13
+ artifacts?: ImArtifactPolicy;
11
14
  attempts?: ImTaskAttempt[];
12
15
  /** 仅整轮没有已执行或未知尝试时保存;旧记录缺省不推测执行事实。 */
13
16
  notSubmittedFailure?: FailureEnvelope;
14
17
  }
15
18
  export interface ImSessionBinding {
16
19
  id?: string;
20
+ sessionName?: string;
17
21
  generation: number;
18
22
  providerSession?: ProviderSession;
19
23
  lastEventId?: string;
20
24
  lastRunId?: string;
21
25
  initialContextPrepared?: boolean;
26
+ stableContext?: ImStableContextState;
22
27
  gap?: ImGapMetadata;
23
28
  rulesContext?: ImRulesContext;
24
29
  }
@@ -0,0 +1,15 @@
1
+ import type { ContextItem } from "@mininglamp-oss/octo-runtime-protocol";
2
+ import { type ImArtifactPolicy } from "../delivery/artifact-policy.js";
3
+ export declare const DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS = 30;
4
+ /** 同代次排队共享,binding 只保存快照;待刷新仅在实际携带规则的执行成功后清除。 */
5
+ export interface ImStableContextState {
6
+ turnCount: number;
7
+ refreshPending: boolean;
8
+ }
9
+ /** 只计算下一轮计划;准备失败或同轮重试不能提前推进用户任务轮数。 */
10
+ export declare function planStableContext(state: ImStableContextState, interval?: number): {
11
+ turn: number;
12
+ refresh: boolean;
13
+ };
14
+ /** Gateway 自有稳定说明;普通轮省略的内容仅供本次显式新会话恢复,不缓存宿主材料。 */
15
+ export declare function stableChannelContexts(policy: ImArtifactPolicy): ContextItem[];
@@ -0,0 +1,28 @@
1
+ import { artifactContext } from "../delivery/artifact-policy.js";
2
+ import { MENTION_GUIDANCE } from "../transport/mentions.js";
3
+ export const DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS = 30;
4
+ /** 只计算下一轮计划;准备失败或同轮重试不能提前推进用户任务轮数。 */
5
+ export function planStableContext(state, interval = DEFAULT_STABLE_CONTEXT_REFRESH_INTERVAL_TURNS) {
6
+ const turn = state.turnCount + 1;
7
+ if (!Number.isSafeInteger(turn) || turn < 1)
8
+ throw new Error("IM_CONTEXT_TURN_LIMIT");
9
+ return { turn, refresh: state.refreshPending || turn === 1 || turn % interval === 0 };
10
+ }
11
+ /** Gateway 自有稳定说明;普通轮省略的内容仅供本次显式新会话恢复,不缓存宿主材料。 */
12
+ export function stableChannelContexts(policy) {
13
+ return [
14
+ {
15
+ namespace: "extra.im",
16
+ name: "mention-instructions",
17
+ guidance: MENTION_GUIDANCE,
18
+ payload: { automatic: true }
19
+ },
20
+ artifactContext(policy),
21
+ {
22
+ namespace: "extra.im",
23
+ name: "history-instructions",
24
+ guidance: "Understand the current intent using relevant conversation history, honor the latest relevant corrections, and do not restart past tasks merely because they appear in history.",
25
+ payload: { automatic: true }
26
+ }
27
+ ];
28
+ }
@@ -5,12 +5,14 @@ import type { ApprovalMode, ContextEnvelope, ContextItem, CanonicalEvent, Intera
5
5
  import type { RunPresentation } from "./presentation/run-projector.js";
6
6
  import type { ImGapPlan, ImGapTurnToken } from "./application/context-gap.js";
7
7
  import type { ImArtifactPolicy } from "./delivery/artifact-policy.js";
8
+ import type { ImStableContextState } from "./application/stable-context.js";
8
9
  export interface ImPositionObservation {
9
10
  conversationId: string;
10
11
  conversationKind: "group" | "thread";
11
12
  messageSeq: number;
12
13
  own?: boolean;
13
14
  turn?: ImGapTurnToken;
15
+ outputFingerprint?: string;
14
16
  }
15
17
  export interface ImAdapterConfig {
16
18
  adapter_type?: string;
@@ -42,6 +44,8 @@ export interface ImCommonConfig {
42
44
  export interface OctoBotConfig extends ImCommonConfig {
43
45
  api_url: string;
44
46
  bf_token?: string;
47
+ /** 自动稳定说明的用户任务刷新周期,默认 30;首轮必带,reset/new 后重新计轮。 */
48
+ stable_context_refresh_interval_turns?: number;
45
49
  /** .octospec/tasks/channel-group-admission/plan.md:群/话题入口开关,省略为 true,不影响私聊。 */
46
50
  groups_enabled?: boolean;
47
51
  /** 仅约束群范围;省略、null、[] 均不增加限制,关闭入口使用 groups_enabled=false。 */
@@ -51,6 +55,7 @@ export interface OctoBotConfig extends ImCommonConfig {
51
55
  /** 渠道固定产物交付;由宿主配置,模型 Context 不能扩大文件访问范围。 */
52
56
  artifact_delivery?: {
53
57
  mode?: "channel" | "tools";
58
+ /** 可选的 Gateway 本机产物目录限制;省略不额外限制,空列表拒绝全部,不改变 Agent 工作区。 */
54
59
  allowed_roots?: string[];
55
60
  allowed_mime_types?: string[];
56
61
  max_file_bytes?: number;
@@ -59,7 +64,7 @@ export interface OctoBotConfig extends ImCommonConfig {
59
64
  timeout_ms?: number;
60
65
  };
61
66
  }
62
- /** 成功 final 的冻结投递合同;signal 归当前交付所有,不能复用已终态的模型 signal。 */
67
+ /** 终态回复的冻结投递合同;成功 final 才准备产物,所有终态都遵守当前交付的取消期限。 */
63
68
  export interface ImFinalReplyOptions {
64
69
  artifacts: ImArtifactPolicy;
65
70
  signal: AbortSignal;
@@ -77,6 +82,8 @@ export interface ImInboundMessage {
77
82
  };
78
83
  /** 同代次卡片重试:buildContext 返回 Gateway 已组合的冻结快照,不再采集或追加默认项。 */
79
84
  historyRetry?: boolean;
85
+ /** 同代次卡片重试复用原投递合同,不从更新后的配置重建文件访问策略。 */
86
+ frozenArtifacts?: ImArtifactPolicy;
80
87
  bindHistoryTurn?(token: ImGapTurnToken): void;
81
88
  markRead?(signal: AbortSignal): Promise<void>;
82
89
  messageId: string;
@@ -85,21 +92,19 @@ export interface ImInboundMessage {
85
92
  conversationKind: "direct" | "group" | "thread";
86
93
  text: string;
87
94
  buildInputs?(signal: AbortSignal): Promise<ModelInputPart[]>;
88
- reply(text: string, effectKey?: string): Promise<void>;
95
+ /** 终态提示也携带该轮投递期限;普通控制回复可省略,不进行产物准备。 */
96
+ reply(text: string, effectKey?: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
89
97
  replyFinal?(text: string, effectKey: string, options?: ImFinalReplyOptions): Promise<void>;
90
- replyFailure?(event: CanonicalEvent, effectKey: string): Promise<void>;
91
- replyDeliveryUnknown?(event: CanonicalEvent, effectKey: string, replyEffectKey: string, signal: AbortSignal): Promise<void>;
92
- isReplyDelivered?(effectKey: string): boolean;
98
+ replyFailure?(event: CanonicalEvent, effectKey: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
93
99
  buildContext(signal: AbortSignal, options?: {
94
100
  initialSession: boolean;
95
- mentionGuidance?: boolean;
96
101
  configuredItems?: readonly ContextItem[];
97
102
  historyGap?: ImGapPlan;
98
103
  onHistoryGapPrepared?(plan: ImGapPlan): void;
99
104
  }): Promise<ContextEnvelope>;
100
105
  executionEnvironment?(): InvokeEnvironment;
101
106
  runMetadata?: Record<string, unknown>;
102
- beginPresentation?(runId: string, onDiagnostic: (code: string) => void, controls: ImRunControls): ImPresentation;
107
+ beginPresentation?(runId: string, onDiagnostic: (code: string, data?: Record<string, unknown>) => void, controls: ImRunControls): ImPresentation;
103
108
  }
104
109
  export interface ImPresentation {
105
110
  interaction?(request: InteractionRequestedPayload): Promise<boolean>;
@@ -127,6 +132,8 @@ export interface ChannelCallbacks {
127
132
  shortId?: string;
128
133
  }): void;
129
134
  onPosition?(position: ImPositionObservation): void;
135
+ /** 已受理任务的 REST 回执位置,归 Bot/任务所有,不要求接收 WS 仍在线。 */
136
+ onTaskPosition?(position: ImPositionObservation): void;
130
137
  authorizeSpace?: (spaceId: string) => void;
131
138
  onMessage(message: ImInboundMessage): void;
132
139
  onDisconnect(code: string, retryable?: boolean): void;
@@ -139,6 +146,7 @@ export interface ImAddress {
139
146
  export type ImConnectionState = "stopped" | "connecting" | "online" | "retrying" | "failed";
140
147
  export interface ImSession {
141
148
  id?: string;
149
+ sessionName?: string;
142
150
  generation: number;
143
151
  providerSession?: ProviderSession;
144
152
  lastEventId?: string;
@@ -150,6 +158,8 @@ export interface ImSession {
150
158
  initialization?: {
151
159
  attempted: boolean;
152
160
  };
161
+ /** 与初始化资格相同的同代次共享对象,reset 替换而非修改旧轮状态。 */
162
+ stableContext?: ImStableContextState;
153
163
  }
154
164
  export type DeliveryState = "pending" | "delivered" | "failed" | "unknown";
155
165
  export interface ImDeliveryReceipt {
@@ -3,8 +3,7 @@ import type { OctoBotConfig } from "../contracts.js";
3
3
  export interface ImArtifactPolicy {
4
4
  mode: "channel" | "tools";
5
5
  workspace?: string;
6
- local: boolean;
7
- roots: string[];
6
+ roots?: string[];
8
7
  mimeTypes?: string[];
9
8
  maxFileBytes: number;
10
9
  maxTotalBytes: number;
@@ -17,7 +16,7 @@ export declare const ARTIFACT_LIMITS: {
17
16
  readonly max_files: 16;
18
17
  readonly timeout_ms: 30000;
19
18
  };
20
- /** 从可信配置及实际执行目录派生合同;远程 preset 的同名主机路径永不成为可读产物。 */
21
- export declare function artifactPolicy(config: OctoBotConfig, context: ContextEnvelope, local: boolean): ImArtifactPolicy;
22
- /** 在执行前向模型明示两种行为;这里只传递约定,不接受模型改写后的访问授权。 */
19
+ /** 本地引用均按 Gateway 文件系统尝试读取;仅可信宿主配置可额外限制根目录。 */
20
+ export declare function artifactPolicy(config: OctoBotConfig, context: ContextEnvelope): ImArtifactPolicy;
21
+ /** 默认交付只约定本地引用格式;真实上传策略由代码执行,不以提示词授予访问权限。 */
23
22
  export declare function artifactContext(policy: ImArtifactPolicy): ContextItem;
@@ -4,15 +4,14 @@ export const ARTIFACT_LIMITS = {
4
4
  max_files: 16,
5
5
  timeout_ms: 30_000
6
6
  };
7
- /** 从可信配置及实际执行目录派生合同;远程 preset 的同名主机路径永不成为可读产物。 */
8
- export function artifactPolicy(config, context, local) {
7
+ /** 本地引用均按 Gateway 文件系统尝试读取;仅可信宿主配置可额外限制根目录。 */
8
+ export function artifactPolicy(config, context) {
9
9
  const options = config.artifact_delivery;
10
10
  const workspace = context.items.find((item) => item.namespace === "octo.execution" && item.name === "workspace")?.payload.path;
11
11
  return {
12
12
  mode: options?.mode ?? "channel",
13
13
  ...(typeof workspace === "string" ? { workspace } : {}),
14
- local,
15
- roots: [...(options?.allowed_roots ?? (typeof workspace === "string" ? [workspace] : []))],
14
+ ...(options?.allowed_roots !== undefined ? { roots: [...options.allowed_roots] } : {}),
16
15
  ...(options?.allowed_mime_types ? { mimeTypes: [...options.allowed_mime_types] } : {}),
17
16
  maxFileBytes: options?.max_file_bytes ?? ARTIFACT_LIMITS.max_file_bytes,
18
17
  maxTotalBytes: options?.max_total_bytes ?? ARTIFACT_LIMITS.max_total_bytes,
@@ -20,19 +19,23 @@ export function artifactPolicy(config, context, local) {
20
19
  timeoutMs: options?.timeout_ms ?? ARTIFACT_LIMITS.timeout_ms
21
20
  };
22
21
  }
23
- /** 在执行前向模型明示两种行为;这里只传递约定,不接受模型改写后的访问授权。 */
22
+ /** 默认交付只约定本地引用格式;真实上传策略由代码执行,不以提示词授予访问权限。 */
24
23
  export function artifactContext(policy) {
25
24
  return {
26
25
  namespace: "extra.im",
27
26
  name: "artifact-delivery",
28
27
  guidance: policy.mode === "channel"
29
- ? "This channel delivers generated local output files referenced in your successful final reply. Create outputs in the effective workspace and use Markdown links or images (including reference style). Gateway's deterministic delivery workflow uploads accessible, policy-allowed files as IM attachments, rewrites their targets and sends native file cards for ordinary file links alongside this same final reply. Display image outputs inline with ![alt](path); a plain download link alone is not image delivery. Images alone do not add file cards. Offer a separate image download link only when requested. This workflow does not publish HTML, create online documents, grant document permissions or save to Drive. Explicit user requests to upload, publish, collaborate on an online document or perform another business action still use your normal tool calls; preserve their returned remote URLs. Do not send a duplicate final reply with a messaging tool. Code, quoted examples, and directory contents are not collected. Remote provider files cannot be retrieved by Gateway."
30
- : "This channel does not automatically upload output files. Use normal tool calls when the task requires file delivery and return recipient-accessible URLs. Do not present runtime-local paths as downloadable attachments. Do not send a duplicate final reply with a messaging tool.",
28
+ ? "If your final deliverable is a local file, reference it using Markdown with an absolute path: [label](/absolute/path); for images, use ![alt](/absolute/path)."
29
+ : [
30
+ "This channel does not automatically upload output files.",
31
+ "Use normal tool calls when the task requires file delivery and return recipient-accessible URLs.",
32
+ "Do not present runtime-local paths as downloadable attachments.",
33
+ "Do not send a duplicate final reply with a messaging tool."
34
+ ].join("\n"),
31
35
  payload: {
32
36
  mode: policy.mode,
33
- localWorkspaceAccessible: policy.local,
34
37
  ...(policy.workspace ? { workspace: policy.workspace } : {}),
35
- allowedRoots: policy.roots,
38
+ ...(policy.roots !== undefined ? { allowedRoots: policy.roots } : {}),
36
39
  ...(policy.mimeTypes ? { allowedMimeTypes: policy.mimeTypes } : {}),
37
40
  maxFileBytes: policy.maxFileBytes,
38
41
  maxTotalBytes: policy.maxTotalBytes,
@@ -10,6 +10,7 @@ export interface ArtifactFile {
10
10
  export interface PreparedArtifacts {
11
11
  text: string;
12
12
  files: ArtifactFile[];
13
+ incomplete?: true;
13
14
  }
14
15
  /** 只交付成功 final 的显式引用;失败不改变生成终态,缓存由 transport 的 final effect 闭包持有。 */
15
16
  export declare function prepareArtifacts(text: string, policy: ImArtifactPolicy, ownerSignal: AbortSignal, upload: ArtifactUpload): Promise<PreparedArtifacts>;
@@ -186,14 +186,12 @@ export async function prepareArtifacts(text, policy, ownerSignal, upload) {
186
186
  if (file === undefined)
187
187
  continue;
188
188
  signal.throwIfAborted();
189
- if (!policy.local)
190
- throw new Error("remote-file-unavailable");
191
- if (!roots)
189
+ if (policy.roots !== undefined && !roots)
192
190
  roots = await Promise.all(policy.roots.map((root) => realpath(root)));
193
191
  const resolved = await realpath(file).catch(() => {
194
192
  throw new Error("file-unavailable");
195
193
  });
196
- if (!roots.some((root) => contained(root, resolved)))
194
+ if (roots && !roots.some((root) => contained(root, resolved)))
197
195
  throw new Error("directory-policy");
198
196
  let result = files.get(resolved);
199
197
  if (!result) {
@@ -279,5 +277,9 @@ export async function prepareArtifacts(text, policy, ownerSignal, upload) {
279
277
  output = output.slice(0, edit.start) + edit.url + output.slice(edit.end);
280
278
  if (failures.length)
281
279
  output += `\n\nAttachment delivery failed: ${failures.join("; ")}. These local references are unavailable to channel recipients; generation was not rerun.`;
282
- return { text: output, files: [...cards.values()] };
280
+ return {
281
+ text: output,
282
+ files: [...cards.values()],
283
+ ...(failures.length ? { incomplete: true } : {})
284
+ };
283
285
  }
@@ -11,6 +11,10 @@ export declare class ImDeliveryDispatcher {
11
11
  get receiptCount(): number;
12
12
  deliver(effectKey: string, operation: () => Promise<string | void>, options?: {
13
13
  transient?: boolean;
14
+ /** 仅当前 finalMsg/卡片 finish 显式指定剩余尝试数,包含首发,最多四次。 */
15
+ attempts?: 1 | 2 | 3 | 4;
14
16
  obsolete?: () => boolean;
17
+ cardOperation?: "send" | "edit";
18
+ onDiagnostic?: (code: string, data?: Record<string, unknown>) => void;
15
19
  }): Promise<ImDeliveryReceipt>;
16
20
  }
@@ -1,5 +1,6 @@
1
+ import { sanitizeDiagnosticBody } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  import { OctoApiError } from "../transport/api/errors.js";
2
- import { ImSendError } from "./text-send.js";
3
+ import { ImSendError } from "./send-error.js";
3
4
  export class ImDeliveryDispatcher {
4
5
  signal;
5
6
  #receipts = new Map();
@@ -14,7 +15,7 @@ export class ImDeliveryDispatcher {
14
15
  const previous = this.#receipts.get(effectKey);
15
16
  if (previous?.state === "delivered")
16
17
  return { ...previous };
17
- const attempts = options.transient ? 1 : 3;
18
+ const attempts = options.transient ? 1 : (options.attempts ?? 3);
18
19
  let receipt = { effectKey, state: "pending" };
19
20
  this.#record(receipt);
20
21
  for (let attempt = 0; attempt < attempts && !this.signal.aborted; attempt++) {
@@ -36,12 +37,27 @@ export class ImDeliveryDispatcher {
36
37
  code: error instanceof ImSendError
37
38
  ? error.code
38
39
  : status
39
- ? `IM_HTTP_${status}`
40
+ ? options.cardOperation
41
+ ? `IM_CARD_${options.cardOperation.toUpperCase()}_${status}`
42
+ : `IM_HTTP_${status}`
40
43
  : "IM_DELIVERY_UNKNOWN"
41
44
  };
42
45
  this.#record(receipt);
43
- // WS 已在同一确认窗口完成四次预算,不再叠乘 REST 的重试次数。
44
- if (error instanceof ImSendError)
46
+ // HTTP 状态只描述本次投递,不代表业务永久失败;诊断先脱敏再限长,不记录请求正文。
47
+ try {
48
+ options.onDiagnostic?.(receipt.code, options.cardOperation && error instanceof OctoApiError
49
+ ? {
50
+ path: error.path.split(/[?#]/, 1)[0],
51
+ http_status: error.status,
52
+ response_body: sanitizeDiagnosticBody(error.body)
53
+ }
54
+ : undefined);
55
+ }
56
+ catch {
57
+ /* 诊断回调失败不得改变投递结果或触发额外发送。 */
58
+ }
59
+ // 仅本轮 REST 收尾可重试未知响应;明确取消/拒绝立即结束,不另开确认窗口。
60
+ if (error instanceof ImSendError && !(options.attempts && error.state === "unknown"))
45
61
  break;
46
62
  if (status && status !== 429 && status < 500)
47
63
  break;
@@ -73,8 +89,15 @@ export class ImDeliveryDispatcher {
73
89
  }
74
90
  }
75
91
  }
76
- if (receipt.state === "pending")
92
+ if (receipt.state === "pending") {
77
93
  receipt = { effectKey, state: "failed", code: "IM_DELIVERY_CANCELLED" };
94
+ try {
95
+ options.onDiagnostic?.(receipt.code);
96
+ }
97
+ catch {
98
+ /* 取消诊断同样不能阻断清理。 */
99
+ }
100
+ }
78
101
  this.#record(receipt);
79
102
  return receipt;
80
103
  }
@@ -0,0 +1,15 @@
1
+ /** 一次已核验目标身份的投递权限及有界 REST 回执缓存;更新 token 或重建 WS 不取消。 */
2
+ export declare class ImDeliveryScope {
3
+ #private;
4
+ readonly signal: AbortSignal;
5
+ revoke(): void;
6
+ confirm(key: string): void;
7
+ isConfirmed(key: string): boolean;
8
+ }
9
+ /** 归 Bot 所有;只接受核验成功的身份,不随 current transport 的替换遗忘旧代次失效。 */
10
+ export declare class ImDeliveryIdentity {
11
+ #private;
12
+ /** 明确拒绝目标身份/空间后关闭旧代次;后续恢复到相同身份也不能复活旧投递。 */
13
+ revoke(): void;
14
+ accept(identity: string): ImDeliveryScope;
15
+ }
@@ -0,0 +1,36 @@
1
+ import { ImSendError } from "./send-error.js";
2
+ /** 一次已核验目标身份的投递权限及有界 REST 回执缓存;更新 token 或重建 WS 不取消。 */
3
+ export class ImDeliveryScope {
4
+ #abort = new AbortController();
5
+ #confirmed = new Set();
6
+ signal = this.#abort.signal;
7
+ revoke() {
8
+ this.#abort.abort(new ImSendError("IM_CONNECTION_IDENTITY_CHANGED", "failed"));
9
+ }
10
+ confirm(key) {
11
+ if (this.signal.aborted)
12
+ return;
13
+ this.#confirmed.add(key);
14
+ if (this.#confirmed.size > 512)
15
+ this.#confirmed.delete(this.#confirmed.values().next().value);
16
+ }
17
+ isConfirmed(key) {
18
+ return this.#confirmed.has(key);
19
+ }
20
+ }
21
+ /** 归 Bot 所有;只接受核验成功的身份,不随 current transport 的替换遗忘旧代次失效。 */
22
+ export class ImDeliveryIdentity {
23
+ #current;
24
+ /** 明确拒绝目标身份/空间后关闭旧代次;后续恢复到相同身份也不能复活旧投递。 */
25
+ revoke() {
26
+ this.#current?.scope.revoke();
27
+ this.#current = undefined;
28
+ }
29
+ accept(identity) {
30
+ if (this.#current?.identity !== identity) {
31
+ this.#current?.scope.revoke();
32
+ this.#current = { identity, scope: new ImDeliveryScope() };
33
+ }
34
+ return this.#current.scope;
35
+ }
36
+ }
@@ -10,5 +10,7 @@ export declare class ProgressScheduler<T> {
10
10
  constructor(send: (value: T) => Promise<void>, onError: () => void, intervalMs?: number);
11
11
  enqueue(value: T, terminal?: boolean): void;
12
12
  flush(): Promise<void>;
13
+ /** 所有者收尾时丢弃未发送进度并解除 timer;在途发送仍沿原 finally 完成,不伪报排空。 */
14
+ dispose(): void;
13
15
  get terminal(): boolean;
14
16
  }
@@ -82,6 +82,16 @@ export class ProgressScheduler {
82
82
  this.#schedule();
83
83
  await done;
84
84
  }
85
+ /** 所有者收尾时丢弃未发送进度并解除 timer;在途发送仍沿原 finally 完成,不伪报排空。 */
86
+ dispose() {
87
+ this.#terminal = true;
88
+ this.#pending = undefined;
89
+ clearTimeout(this.#timer);
90
+ this.#timer = undefined;
91
+ if (!this.#running)
92
+ for (const resolve of this.#waiters.splice(0))
93
+ resolve();
94
+ }
85
95
  get terminal() {
86
96
  return this.#terminal;
87
97
  }
@@ -0,0 +1,6 @@
1
+ /** REST 投递错误保留本次请求的确认状态;不触发 WS 恢复或重新执行模型。 */
2
+ export declare class ImSendError extends Error {
3
+ readonly code: string;
4
+ readonly state: "failed" | "unknown";
5
+ constructor(code: string, state: "failed" | "unknown");
6
+ }
@@ -0,0 +1,10 @@
1
+ /** REST 投递错误保留本次请求的确认状态;不触发 WS 恢复或重新执行模型。 */
2
+ export class ImSendError extends Error {
3
+ code;
4
+ state;
5
+ constructor(code, state) {
6
+ super(code);
7
+ this.code = code;
8
+ this.state = state;
9
+ }
10
+ }
@@ -1,4 +1,4 @@
1
- import { type ContextEnvelope, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import { type ContextEnvelope, type ContextItem, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  import type { ImBotConfig, ImInboundMessage, ImSession } from "../contracts.js";
3
3
  import type { ImArtifactPolicy } from "../delivery/artifact-policy.js";
4
4
  export type ImInvocationInput = InvokeInput & {
@@ -7,8 +7,11 @@ export type ImInvocationInput = InvokeInput & {
7
7
  sessionId: string;
8
8
  protocol_mode: "canonical";
9
9
  };
10
- export declare function createImInvocation(config: ImBotConfig, message: ImInboundMessage, context: ContextEnvelope, sessionKey: string, session: ImSession, _signal: AbortSignal, occurrenceId?: string): {
10
+ export declare function createImInvocation(config: ImBotConfig, message: ImInboundMessage, context: ContextEnvelope, sessionKey: string, session: ImSession, _signal: AbortSignal, occurrenceId?: string, refreshStableContext?: boolean): {
11
11
  request: ImInvocationInput;
12
12
  adapterType: string;
13
13
  artifacts: ImArtifactPolicy;
14
+ recoveryContexts: ContextItem[];
15
+ stableContextIncluded: boolean;
16
+ historyContext?: ContextItem;
14
17
  };