@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
@@ -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,14 +92,15 @@ 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>;
98
+ replyFailure?(event: CanonicalEvent, effectKey: string, options?: Pick<ImFinalReplyOptions, "signal" | "obsolete">): Promise<void>;
99
+ /** 原轮未知通知继承最终投递取消及过期判断,在实际 REST 发送前再次检查。 */
100
+ replyDeliveryUnknown?(event: CanonicalEvent, effectKey: string, replyEffectKey: string, signal: AbortSignal, obsolete?: () => boolean): Promise<void>;
92
101
  isReplyDelivered?(effectKey: string): boolean;
93
102
  buildContext(signal: AbortSignal, options?: {
94
103
  initialSession: boolean;
95
- mentionGuidance?: boolean;
96
104
  configuredItems?: readonly ContextItem[];
97
105
  historyGap?: ImGapPlan;
98
106
  onHistoryGapPrepared?(plan: ImGapPlan): void;
@@ -139,6 +147,7 @@ export interface ImAddress {
139
147
  export type ImConnectionState = "stopped" | "connecting" | "online" | "retrying" | "failed";
140
148
  export interface ImSession {
141
149
  id?: string;
150
+ sessionName?: string;
142
151
  generation: number;
143
152
  providerSession?: ProviderSession;
144
153
  lastEventId?: string;
@@ -150,6 +159,8 @@ export interface ImSession {
150
159
  initialization?: {
151
160
  attempted: boolean;
152
161
  };
162
+ /** 与初始化资格相同的同代次共享对象,reset 替换而非修改旧轮状态。 */
163
+ stableContext?: ImStableContextState;
153
164
  }
154
165
  export type DeliveryState = "pending" | "delivered" | "failed" | "unknown";
155
166
  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
  }
@@ -0,0 +1,15 @@
1
+ /** 一次已核验目标身份的投递权限及有界 ACK 账本;更新 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 "./text-send.js";
2
+ /** 一次已核验目标身份的投递权限及有界 ACK 账本;更新 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
  }
@@ -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
  };
@@ -10,8 +10,12 @@ import { assertContextEnvelope, mergeContext } from "@mininglamp-oss/octo-runtim
10
10
  import { validateImConfig } from "../lifecycle/configuration.js";
11
11
  import { compactHistoryGap, historyGapContext } from "../application/context-gap.js";
12
12
  import { MENTION_GUIDANCE } from "../transport/mentions.js";
13
- import { artifactContext, artifactPolicy } from "../delivery/artifact-policy.js";
14
- export function createImInvocation(config, message, context, sessionKey, session, _signal, occurrenceId = message.messageId) {
13
+ import { artifactPolicy } from "../delivery/artifact-policy.js";
14
+ import { stableChannelContexts } from "../application/stable-context.js";
15
+ import { modelRulesContext } from "../application/rules-context.js";
16
+ import { modelHistoryContexts } from "../application/history-context.js";
17
+ export function createImInvocation(config, message, context, sessionKey, session, _signal, occurrenceId = message.messageId, refreshStableContext = !session.providerSession?.sessionId ||
18
+ session.providerSession.resumable === false) {
15
19
  validateImConfig(config);
16
20
  assertContextEnvelope(context);
17
21
  if (!session.id)
@@ -51,6 +55,9 @@ export function createImInvocation(config, message, context, sessionKey, session
51
55
  name: "limits",
52
56
  payload: {
53
57
  run_timeout_ms: config.run_timeout_ms ?? 86_400_000,
58
+ // 模型静默由 Gateway 按公开内容计时;Core 保留总期限和工具预算,不抢先触发首帧超时。
59
+ first_frame_timeout_ms: 310_000,
60
+ model_idle_policy: "observe",
54
61
  // IM 的长工具可能长时间无输出;业务可通过本轮 limits 显式收紧。
55
62
  tool_timeout_ms: 86_400_000
56
63
  }
@@ -79,11 +86,11 @@ export function createImInvocation(config, message, context, sessionKey, session
79
86
  ]
80
87
  };
81
88
  // Channel 只组装公开 InvokeInput;执行解析和指令渲染统一交给 Host,避免再次拒绝业务 Context。
82
- // 宿主已先解析静态/动态 Context;渠道默认指令只在本轮与有效 entries 保序组合一次。
89
+ // 宿主已先解析静态/动态 Context;渠道默认指令仅在刷新轮与有效 entries 保序组合。
83
90
  // 不改变公共 mergeContext 或动态人设替换合同,也不把上一轮的组合结果累积回来。
84
91
  let submitted = context;
85
92
  // 同代次卡片重试已从 occurrence 取得组合后的冻结快照,不能再次追加或按文本去重。
86
- if (!message.historyRetry) {
93
+ if (!message.historyRetry && refreshStableContext) {
87
94
  const instructions = context.items.find((item) => item.namespace === "octo.control" && item.name === "instructions");
88
95
  const channelInstructions = {
89
96
  namespace: "octo.control",
@@ -103,25 +110,26 @@ export function createImInvocation(config, message, context, sessionKey, session
103
110
  : [...context.items, channelInstructions]
104
111
  };
105
112
  }
113
+ submitted = { ...submitted, items: submitted.items.map(modelRulesContext) };
106
114
  let snapshot;
115
+ let artifacts;
116
+ let stable = [];
107
117
  // 执行默认项也占协议预算;只降级本渠道自动追加的辅助材料,不丢弃显式业务项。
108
- for (const optional of [
109
- "history",
110
- "history-gap-compact",
111
- "mention-instructions",
112
- "history-gap",
113
- undefined
114
- ]) {
118
+ for (const optional of ["history", "history-gap-compact", "history-gap", undefined]) {
115
119
  try {
116
- snapshot = mergeContext(defaults, submitted);
117
- // 固定交付约定也计入 Context 预算;沿原策略只移除自动辅助材料。
118
- snapshot = {
119
- ...snapshot,
120
- items: [
121
- ...snapshot.items.filter((item) => !(item.namespace === "extra.im" && item.name === "artifact-delivery")),
122
- artifactContext(artifactPolicy(config, snapshot, agentSource === "provisioned"))
123
- ]
124
- };
120
+ snapshot = mergeContext(defaults, {
121
+ ...submitted,
122
+ items: modelHistoryContexts(submitted.items)
123
+ });
124
+ artifacts = structuredClone(message.frozenArtifacts ?? artifactPolicy(config, snapshot));
125
+ stable = stableChannelContexts(artifacts);
126
+ // 稳定说明只由渠道按周期生成;已有同名项不能抑制刷新或绕过普通轮省略。
127
+ // 冻结重试复用渠道已生成的完整快照,不重建或再次追加说明。
128
+ if (!message.historyRetry) {
129
+ snapshot.items = snapshot.items.filter((item) => !stable.some((owned) => owned.namespace === item.namespace && owned.name === item.name));
130
+ if (refreshStableContext)
131
+ snapshot.items.push(...stable);
132
+ }
125
133
  assertContextEnvelope(snapshot);
126
134
  break;
127
135
  }
@@ -179,8 +187,13 @@ export function createImInvocation(config, message, context, sessionKey, session
179
187
  }
180
188
  }
181
189
  }
182
- if (!snapshot)
190
+ if (!snapshot || !artifacts)
183
191
  throw new Error("IM_EXECUTION_CONFIG_INVALID");
192
+ // 仅最终仍提交的自动历史构成交接证据;内部字段不进入模型快照或冻结重试。
193
+ const historyContext = submitted.items.find((item) => item.namespace === "extra.im" &&
194
+ item.name === "history" &&
195
+ item.payload.automatic === true &&
196
+ snapshot.items.some((candidate) => candidate.namespace === item.namespace && candidate.name === item.name));
184
197
  const eventId = `evt_${randomUUID()}`, runId = `run_${randomUUID()}`;
185
198
  const prompt = message.buildInputs ? "[Image]" : message.text.trim();
186
199
  const request = {
@@ -188,6 +201,7 @@ export function createImInvocation(config, message, context, sessionKey, session
188
201
  invocationId: `invoke_${randomUUID()}`,
189
202
  runId,
190
203
  sessionId: session.id,
204
+ ...(session.sessionName ? { sessionName: session.sessionName } : {}),
191
205
  sessionGeneration: session.generation,
192
206
  providerEpoch: session.generation,
193
207
  agentSource,
@@ -216,6 +230,9 @@ export function createImInvocation(config, message, context, sessionKey, session
216
230
  return {
217
231
  request,
218
232
  adapterType: selectedAdapter,
219
- artifacts: artifactPolicy(config, snapshot, agentSource === "provisioned")
233
+ artifacts,
234
+ historyContext,
235
+ recoveryContexts: stable.filter((item) => !snapshot.items.some((existing) => existing.namespace === item.namespace && existing.name === item.name)),
236
+ stableContextIncluded: stable.every((item) => snapshot.items.some((existing) => existing.namespace === item.namespace && existing.name === item.name))
220
237
  };
221
238
  }
@@ -0,0 +1,29 @@
1
+ import type { CanonicalEvent } from "@mininglamp-oss/octo-runtime-protocol";
2
+ export interface ModelWaitSnapshot {
3
+ seconds?: number;
4
+ hasOutput: boolean;
5
+ timeout?: "cancelling" | "unconfirmed" | "terminated";
6
+ }
7
+ interface ModelWaitClock {
8
+ now(): number;
9
+ schedule(callback: () => void, ms: number): () => void;
10
+ }
11
+ export declare const MODEL_WAIT_TIMEOUT_MESSAGE = "\u6A21\u578B\u5DF2\u8FDE\u7EED 5 \u5206\u949F\u672A\u8FD4\u56DE\u8F93\u51FA\uFF0C\u672C\u8F6E\u8BF7\u6C42\u5DF2\u8D85\u65F6\u3002";
12
+ /** Gateway 每次尝试拥有的模型等待钟;只消费统一事件,不修改执行源或中止观察流。 */
13
+ export declare class ImModelWait {
14
+ #private;
15
+ readonly clock: ModelWaitClock;
16
+ readonly changed: () => void;
17
+ readonly timedOut: () => void;
18
+ constructor(clock: ModelWaitClock, changed: () => void, timedOut: () => void);
19
+ get snapshot(): ModelWaitSnapshot;
20
+ /** 新尝试从交接执行开始;队列通知及工具/交互活动另行暂停。 */
21
+ start(): void;
22
+ accept(event: CanonicalEvent): void;
23
+ unconfirmed(): void;
24
+ /** 必须在同次源流正常耗尽且确认终态后调用,不能由 cancel ACK 调用。 */
25
+ confirmTermination(): void;
26
+ /** Stop、排空及 dispose 共用清理;保留超时事实供终态和未知展示使用。 */
27
+ stop(): void;
28
+ }
29
+ export {};