agentworkshop 0.11.3 → 0.13.0

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 (457) hide show
  1. package/.AgentWorkShop/prompts/host-tools.json +4 -4
  2. package/.output/.AgentWorkShop/prompts/host-tools.json +4 -4
  3. package/.output/nitro.json +1 -1
  4. package/.output/public/_nuxt/{DXXBGPAc.js → CsdezMu9.js} +4 -4
  5. package/.output/public/_nuxt/WL1R8lPA.js +1 -0
  6. package/.output/public/_nuxt/_id_.Czwkl50w.css +1 -0
  7. package/.output/public/_nuxt/builds/latest.json +1 -1
  8. package/.output/public/_nuxt/builds/meta/2f96705b-cf57-4bde-87a4-1b818b268f0f.json +1 -0
  9. package/.output/server/chunks/_/access.mjs +1 -1
  10. package/.output/server/chunks/_/candidate-store.mjs +1 -1
  11. package/.output/server/chunks/_/catalog-view.mjs +1 -1
  12. package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
  13. package/.output/server/chunks/_/data-export.mjs +6 -6
  14. package/.output/server/chunks/_/data-query.mjs +3 -3
  15. package/.output/server/chunks/_/eda-run.repo.mjs +2 -2
  16. package/.output/server/chunks/_/entity.mjs +1 -1
  17. package/.output/server/chunks/_/features.mjs +5 -5
  18. package/.output/server/chunks/_/golden.mjs +3 -3
  19. package/.output/server/chunks/_/host-bindings.mjs +1 -1
  20. package/.output/server/chunks/_/index.mjs +1 -1
  21. package/.output/server/chunks/_/line-scope.mjs +1 -1
  22. package/.output/server/chunks/_/mes-console.mjs +1 -1
  23. package/.output/server/chunks/_/mes-secrets.repo.mjs +1 -1
  24. package/.output/server/chunks/_/mes-templates.mjs +1 -1
  25. package/.output/server/chunks/_/nitro.mjs +4084 -2343
  26. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  27. package/.output/server/chunks/_/ocap.mjs +1 -1
  28. package/.output/server/chunks/_/orchestrator.mjs +1 -1
  29. package/.output/server/chunks/_/promote.mjs +1 -1
  30. package/.output/server/chunks/_/rest-auth.mjs +1 -1
  31. package/.output/server/chunks/_/runtime.mjs +8 -8
  32. package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
  33. package/.output/server/chunks/_/spc.mjs +1 -1
  34. package/.output/server/chunks/_/validator.mjs +1 -1
  35. package/.output/server/chunks/build/TownView-DD1zY8xq.mjs +1 -1
  36. package/.output/server/chunks/build/{_id_-C0vNEbts.mjs → _id_-B9zi8WEg.mjs} +23 -12
  37. package/.output/server/chunks/build/_id_-B9zi8WEg.mjs.map +1 -0
  38. package/.output/server/chunks/build/_wsId_-LDv5SEW_.mjs +1 -1
  39. package/.output/server/chunks/build/daq-B5zlUIlb.mjs +1 -1
  40. package/.output/server/chunks/build/dcw-B-eoU7sq.mjs +1 -1
  41. package/.output/server/chunks/build/types-D6J7slEa.mjs +1 -1
  42. package/.output/server/chunks/build/useDaqAddNode-Dr5CfMpU.mjs +1 -1
  43. package/.output/server/chunks/build/useDaqDetailNode-DDq5osE-.mjs +1 -1
  44. package/.output/server/chunks/build/useDaqDetailParams-DdOcUvHG.mjs +1 -1
  45. package/.output/server/chunks/build/useDaqFilters-Y_NRhP6i.mjs +1 -1
  46. package/.output/server/chunks/build/useDaqStream-phwM5tIN.mjs +1 -1
  47. package/.output/server/chunks/build/useDaqTemplates-lKw2b01d.mjs +1 -1
  48. package/.output/server/chunks/build/useDcwAddNode-CT-oOFom.mjs +1 -1
  49. package/.output/server/chunks/build/useDcwStream-CNtMGcR0.mjs +1 -1
  50. package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
  51. package/.output/server/chunks/routes/api/system/backup/run.post.mjs +2 -2
  52. package/.output/server/chunks/routes/api/system/index.patch.mjs +2 -2
  53. package/.output/server/chunks/routes/api/system/shutdown.post.mjs +2 -2
  54. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
  55. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +7 -2
  56. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -1
  57. package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
  58. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +1 -1
  59. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs +1 -1
  60. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +1 -1
  61. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs +1 -1
  62. package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs +1 -1
  63. package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs +1 -1
  64. package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs +1 -1
  65. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +1 -1
  66. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +1 -1
  67. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +1 -1
  68. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +1 -1
  69. package/.output/server/chunks/routes/api/workshop/aml/index3.post.mjs +1 -1
  70. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +1 -1
  71. package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs +1 -1
  72. package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs +1 -1
  73. package/.output/server/chunks/routes/api/workshop/aml/index7.get.mjs +1 -1
  74. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +1 -1
  75. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +1 -1
  76. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +1 -1
  77. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs +1 -1
  78. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs +1 -1
  79. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +1 -1
  80. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +1 -1
  81. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs +1 -1
  82. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs +1 -1
  83. package/.output/server/chunks/routes/api/workshop/aml/models/index.get.mjs +1 -1
  84. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id/train.post.mjs +1 -1
  85. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.delete.mjs +1 -1
  86. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.patch.mjs +1 -1
  87. package/.output/server/chunks/routes/api/workshop/aml/training-plans/index.get.mjs +1 -1
  88. package/.output/server/chunks/routes/api/workshop/aml/twin/providers.get.mjs +1 -1
  89. package/.output/server/chunks/routes/api/workshop/analysis/_id_.delete.mjs +1 -1
  90. package/.output/server/chunks/routes/api/workshop/analysis/_id_.get.mjs +1 -1
  91. package/.output/server/chunks/routes/api/workshop/analysis/_id_.patch.mjs +1 -1
  92. package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
  93. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +1 -1
  94. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +1 -1
  95. package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
  96. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
  97. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +1 -1
  98. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
  99. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/index.post.mjs +1 -1
  100. package/.output/server/chunks/routes/api/workshop/channels/_id/execution-mode.patch.mjs +1 -1
  101. package/.output/server/chunks/routes/api/workshop/channels/_id/harness-profiles/promote.post.mjs +1 -1
  102. package/.output/server/chunks/routes/api/workshop/channels/_id/improvement-proposals/decide.post.mjs +1 -1
  103. package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
  104. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +1 -1
  105. package/.output/server/chunks/routes/api/workshop/channels/_id/index11.get.mjs +1 -1
  106. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
  107. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
  108. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.put.mjs +1 -1
  109. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
  110. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
  111. package/.output/server/chunks/routes/api/workshop/channels/_id/index5.post.mjs +1 -1
  112. package/.output/server/chunks/routes/api/workshop/channels/_id/index7.get.mjs +1 -1
  113. package/.output/server/chunks/routes/api/workshop/channels/_id/index7.post.mjs +1 -1
  114. package/.output/server/chunks/routes/api/workshop/channels/_id/line.put.mjs +1 -1
  115. package/.output/server/chunks/routes/api/workshop/channels/_id/members/join.post.mjs +1 -1
  116. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId/promote.post.mjs +1 -1
  117. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/merge.post.mjs +1 -1
  118. package/.output/server/chunks/routes/api/workshop/channels/_id/products.get.mjs +1 -1
  119. package/.output/server/chunks/routes/api/workshop/channels/_id/products.put.mjs +1 -1
  120. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
  121. package/.output/server/chunks/routes/api/workshop/channels/_id/tool-usage.get.mjs +1 -1
  122. package/.output/server/chunks/routes/api/workshop/channels/_id/tools/reset.post.mjs +1 -1
  123. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.get.mjs +1 -1
  124. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.patch.mjs +1 -1
  125. package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
  126. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +1 -1
  127. package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +1 -1
  128. package/.output/server/chunks/routes/api/workshop/channels.post.mjs +7 -7
  129. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
  130. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
  131. package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +1 -1
  132. package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +1 -1
  133. package/.output/server/chunks/routes/api/workshop/daq/_id/ingest.post.mjs +2 -2
  134. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
  135. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
  136. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
  137. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
  138. package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +1 -1
  139. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
  140. package/.output/server/chunks/routes/api/workshop/daq/index.get.mjs +1 -1
  141. package/.output/server/chunks/routes/api/workshop/daq/index2.post.mjs +1 -1
  142. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
  143. package/.output/server/chunks/routes/api/workshop/daq/storage/retention.put.mjs +1 -1
  144. package/.output/server/chunks/routes/api/workshop/daq/storage/rollup.post.mjs +1 -1
  145. package/.output/server/chunks/routes/api/workshop/daq/storage.get.mjs +1 -1
  146. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
  147. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
  148. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
  149. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
  150. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
  151. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
  152. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
  153. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
  154. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
  155. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
  156. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
  157. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
  158. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
  159. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
  160. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
  161. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
  162. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
  163. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
  164. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
  165. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
  166. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
  167. package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs +1 -1
  168. package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs +1 -1
  169. package/.output/server/chunks/routes/api/workshop/dcw/index7.get.mjs +1 -1
  170. package/.output/server/chunks/routes/api/workshop/dcw/index8.get.mjs +1 -1
  171. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
  172. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
  173. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
  174. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
  175. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
  176. package/.output/server/chunks/routes/api/workshop/dcw/lines/index.get.mjs +1 -1
  177. package/.output/server/chunks/routes/api/workshop/dcw/mes-artifacts/file.get.mjs +1 -1
  178. package/.output/server/chunks/routes/api/workshop/dcw/mes-hook-test.post.mjs +1 -1
  179. package/.output/server/chunks/routes/api/workshop/dcw/mes-test-read.post.mjs +1 -1
  180. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
  181. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
  182. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
  183. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
  184. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs +1 -1
  185. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs +1 -1
  186. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs +1 -1
  187. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs +1 -1
  188. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
  189. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
  190. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
  191. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
  192. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs +1 -1
  193. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
  194. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
  195. package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs +1 -1
  196. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
  197. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
  198. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
  199. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
  200. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
  201. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
  202. package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
  203. package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
  204. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
  205. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
  206. package/.output/server/chunks/routes/api/workshop/eda/commonality.get.mjs +1 -1
  207. package/.output/server/chunks/routes/api/workshop/eda/index6.get.mjs +1 -1
  208. package/.output/server/chunks/routes/api/workshop/eda/index6.post.mjs +1 -1
  209. package/.output/server/chunks/routes/api/workshop/eda/vm/predict.post.mjs +1 -1
  210. package/.output/server/chunks/routes/api/workshop/exp/confirmations/_id/decide.post.mjs +1 -1
  211. package/.output/server/chunks/routes/api/workshop/exp/index.get.mjs +1 -1
  212. package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
  213. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
  214. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
  215. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
  216. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
  217. package/.output/server/chunks/routes/api/workshop/index.mjs +1 -1
  218. package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
  219. package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
  220. package/.output/server/chunks/routes/api/workshop/index12.get.mjs +1 -1
  221. package/.output/server/chunks/routes/api/workshop/index13.get.mjs +1 -1
  222. package/.output/server/chunks/routes/api/workshop/index14.get.mjs +1 -1
  223. package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
  224. package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
  225. package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
  226. package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
  227. package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
  228. package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
  229. package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
  230. package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
  231. package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
  232. package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
  233. package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
  234. package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
  235. package/.output/server/chunks/routes/api/workshop/index9.post.mjs +1 -1
  236. package/.output/server/chunks/routes/api/workshop/mes/bridge.post.mjs +1 -1
  237. package/.output/server/chunks/routes/api/workshop/mes/datasets.get.mjs +1 -1
  238. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/autofix.mjs +1 -1
  239. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs +1 -1
  240. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs +1 -1
  241. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs +1 -1
  242. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs +1 -1
  243. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs +1 -1
  244. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs +1 -1
  245. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/subgraph.mjs +1 -1
  246. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs +1 -1
  247. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs +1 -1
  248. package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs +1 -1
  249. package/.output/server/chunks/routes/api/workshop/ontology/index.mjs +1 -1
  250. package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs +1 -1
  251. package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs +1 -1
  252. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs +1 -1
  253. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs +1 -1
  254. package/.output/server/chunks/routes/api/workshop/optimization/capabilities.get.mjs +1 -1
  255. package/.output/server/chunks/routes/api/workshop/optimization/index.get.mjs +1 -1
  256. package/.output/server/chunks/routes/api/workshop/optimization/index.mjs +1 -1
  257. package/.output/server/chunks/routes/api/workshop/optimization/index2.mjs +1 -1
  258. package/.output/server/chunks/routes/api/workshop/optimization/profiles/_id/publish.post.mjs +1 -1
  259. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/crosscheck.post.mjs +1 -1
  260. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/dispatch.post.mjs +1 -1
  261. package/.output/server/chunks/routes/api/workshop/optimization/solve.post.mjs +1 -1
  262. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
  263. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
  264. package/.output/server/chunks/routes/api/workshop/process-model/datasets.post.mjs +1 -1
  265. package/.output/server/chunks/routes/api/workshop/process-model/eligibility.mjs +1 -1
  266. package/.output/server/chunks/routes/api/workshop/process-model/experiments.mjs +1 -1
  267. package/.output/server/chunks/routes/api/workshop/process-model/index.mjs +1 -1
  268. package/.output/server/chunks/routes/api/workshop/process-model/specs/_id/publish.post.mjs +1 -1
  269. package/.output/server/chunks/routes/api/workshop/process-model/train.post.mjs +1 -1
  270. package/.output/server/chunks/routes/api/workshop/projects/_id/activate.post.mjs +1 -1
  271. package/.output/server/chunks/routes/api/workshop/projects/_id/approvals/_aid/decide.post.mjs +1 -1
  272. package/.output/server/chunks/routes/api/workshop/projects/_id/archive.post.mjs +1 -1
  273. package/.output/server/chunks/routes/api/workshop/projects/_id/channels/_channelId_.delete.mjs +1 -1
  274. package/.output/server/chunks/routes/api/workshop/projects/_id/complete.post.mjs +1 -1
  275. package/.output/server/chunks/routes/api/workshop/projects/_id/continue.post.mjs +1 -1
  276. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/_did/waive.post.mjs +1 -1
  277. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.get.mjs +1 -1
  278. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.patch.mjs +1 -1
  279. package/.output/server/chunks/routes/api/workshop/projects/_id/health.get.mjs +1 -1
  280. package/.output/server/chunks/routes/api/workshop/projects/_id/index.get.mjs +1 -1
  281. package/.output/server/chunks/routes/api/workshop/projects/_id/index.post.mjs +1 -1
  282. package/.output/server/chunks/routes/api/workshop/projects/_id/index2.get.mjs +1 -1
  283. package/.output/server/chunks/routes/api/workshop/projects/_id/index2.post.mjs +1 -1
  284. package/.output/server/chunks/routes/api/workshop/projects/_id/index3.get.mjs +1 -1
  285. package/.output/server/chunks/routes/api/workshop/projects/_id/index3.post.mjs +1 -1
  286. package/.output/server/chunks/routes/api/workshop/projects/_id/index4.get.mjs +1 -1
  287. package/.output/server/chunks/routes/api/workshop/projects/_id/index4.post.mjs +1 -1
  288. package/.output/server/chunks/routes/api/workshop/projects/_id/index5.get.mjs +1 -1
  289. package/.output/server/chunks/routes/api/workshop/projects/_id/index6.get.mjs +1 -1
  290. package/.output/server/chunks/routes/api/workshop/projects/_id/index7.get.mjs +1 -1
  291. package/.output/server/chunks/routes/api/workshop/projects/_id/index8.get.mjs +1 -1
  292. package/.output/server/chunks/routes/api/workshop/projects/_id/kernel/tick.post.mjs +1 -1
  293. package/.output/server/chunks/routes/api/workshop/projects/_id/ledger.get.mjs +1 -1
  294. package/.output/server/chunks/routes/api/workshop/projects/_id/members/_userId_.delete.mjs +1 -1
  295. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/activity.get.mjs +1 -1
  296. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/route.get.mjs +1 -1
  297. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/work-items/_wid_.get.mjs +1 -1
  298. package/.output/server/chunks/routes/api/workshop/projects/_id/observability.get.mjs +1 -1
  299. package/.output/server/chunks/routes/api/workshop/projects/_id/pause.post.mjs +1 -1
  300. package/.output/server/chunks/routes/api/workshop/projects/_id/plan/request-approval.post.mjs +1 -1
  301. package/.output/server/chunks/routes/api/workshop/projects/_id/proposals/_decisionId/apply.post.mjs +1 -1
  302. package/.output/server/chunks/routes/api/workshop/projects/_id/reconcile.post.mjs +1 -1
  303. package/.output/server/chunks/routes/api/workshop/projects/_id/report.get.mjs +1 -1
  304. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/request-acceptance.post.mjs +1 -1
  305. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/review.post.mjs +1 -1
  306. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/submit.post.mjs +1 -1
  307. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/supersede.post.mjs +1 -1
  308. package/.output/server/chunks/routes/api/workshop/projects/_id/resume.post.mjs +1 -1
  309. package/.output/server/chunks/routes/api/workshop/projects/_id/sessions.get.mjs +1 -1
  310. package/.output/server/chunks/routes/api/workshop/projects/_id/snapshot.get.mjs +1 -1
  311. package/.output/server/chunks/routes/api/workshop/projects/_id/terminate.post.mjs +1 -1
  312. package/.output/server/chunks/routes/api/workshop/projects/_id/trace/_traceId_.get.mjs +1 -1
  313. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/cancel.post.mjs +1 -1
  314. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/dispatch.post.mjs +1 -1
  315. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/retry.post.mjs +1 -1
  316. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.get.mjs +1 -1
  317. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.patch.mjs +1 -1
  318. package/.output/server/chunks/routes/api/workshop/projects/_id_.get.mjs +1 -1
  319. package/.output/server/chunks/routes/api/workshop/projects/_id_.patch.mjs +1 -1
  320. package/.output/server/chunks/routes/api/workshop/projects/instantiate.post.mjs +1 -1
  321. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
  322. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
  323. package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs +44 -0
  324. package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs.map +1 -0
  325. package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs +38 -0
  326. package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs.map +1 -0
  327. package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
  328. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +1 -1
  329. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +1 -1
  330. package/.output/server/chunks/routes/api/workshop/tools/sync.post.mjs +1 -1
  331. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
  332. package/.output/server/chunks/routes/api/workshop/ws/ticket.post.mjs +1 -1
  333. package/.output/server/chunks/routes/renderer.mjs +2 -2
  334. package/.output/server/chunks/virtual/entry.mjs +6 -2
  335. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  336. package/.output/server/package.json +1 -1
  337. package/README-zh.md +19 -7
  338. package/README.md +21 -7
  339. package/app/components/dcw/DcwNodesTable.vue +24 -0
  340. package/config.yml +1 -1
  341. package/docs/cli.en.md +1 -1
  342. package/docs/cli.md +1 -1
  343. package/docs/mcp.en.md +30 -27
  344. package/docs/mcp.md +7 -3
  345. package/docs/plugin-idd-rag-contract.md +87 -0
  346. package/docs/plugins.en.md +5 -3
  347. package/docs/plugins.md +5 -3
  348. package/docs/sdk.en.md +1 -1
  349. package/docs/sdk.md +1 -1
  350. package/i18n/dicts/dcwDetail.json +221 -219
  351. package/i18n/locales/en.ts +2 -0
  352. package/i18n/locales/zh-CN.ts +2 -0
  353. package/package.json +3 -1
  354. package/scripts/check-docs-sync.mjs +20 -9
  355. package/scripts/onboarding/forge-channel.mjs +2 -1
  356. package/scripts/onboarding/lib.mjs +159 -3
  357. package/scripts/onboarding/onboard.mjs +2 -0
  358. package/scripts/onboarding/preflight.mjs +233 -231
  359. package/scripts/onboarding/provision-line.mjs +12 -2
  360. package/scripts/onboarding/sim-attest.mjs +103 -0
  361. package/scripts/onboarding/sim-twin.mjs +115 -19
  362. package/scripts/onboarding/test-connection.mjs +2 -1
  363. package/scripts/onboarding/v6-protected-api.mjs +41 -0
  364. package/scripts/onboarding/v6-protected-fixture.mjs +54 -0
  365. package/scripts/onboarding/verify-line.mjs +179 -136
  366. package/scripts/onboarding/verify-mirror.mjs +149 -145
  367. package/server/api/workshop/agent-tools/list.get.ts +10 -1
  368. package/server/api/workshop/tasks/[id]/recovery-disposition.post.ts +32 -0
  369. package/server/api/workshop/tasks/recovery-holds.get.ts +22 -0
  370. package/server/plugins-builtin/diag-bridge/host/deposit.mjs +232 -0
  371. package/server/plugins-builtin/diag-bridge/host/diagnosis.mjs +121 -38
  372. package/server/plugins-builtin/diag-bridge/host/external-v1.mjs +213 -0
  373. package/server/plugins-builtin/diag-bridge/host/helpers.mjs +4 -2
  374. package/server/plugins-builtin/diag-bridge/host/intents.mjs +65 -62
  375. package/server/plugins-builtin/diag-bridge/host/plugin.mjs +351 -82
  376. package/server/plugins-builtin/diag-bridge/host/receipt.mjs +83 -0
  377. package/server/plugins-builtin/diag-bridge/host/sweep.mjs +70 -91
  378. package/server/plugins-builtin/diag-bridge/i18n.json +4 -0
  379. package/server/plugins-builtin/rag-bridge/i18n.json +18 -0
  380. package/server/plugins-builtin/rag-bridge/index.mjs +570 -64
  381. package/server/services/workshop/agents/agent-interface.ts +3 -0
  382. package/server/services/workshop/agents/base-agent.ts +100 -4
  383. package/server/services/workshop/agents/execution-scope.ts +26 -0
  384. package/server/services/workshop/agents/hitl-capabilities.ts +3 -3
  385. package/server/services/workshop/agents/host-tool-bridge/dispatch.ts +42 -2
  386. package/server/services/workshop/agents/host-tool-bridge/tools/progress.ts +4 -0
  387. package/server/services/workshop/agents/host-tool-bridge/tools/tasks.ts +11 -28
  388. package/server/services/workshop/agents/host-tool-bridge/tools/team-delegation.ts +83 -129
  389. package/server/services/workshop/agents/industrial/dcw-tools.ts +27 -5
  390. package/server/services/workshop/agents/industrial/line-tools.ts +15 -4
  391. package/server/services/workshop/agents/industrial/ops-tools.ts +32 -6
  392. package/server/services/workshop/agents/industrial/optimization-tools.ts +28 -4
  393. package/server/services/workshop/agents/industrial/recipe-propose-tools.ts +26 -3
  394. package/server/services/workshop/agents/omp-agent/client.ts +2 -4
  395. package/server/services/workshop/agents/omp-agent/core.ts +3 -0
  396. package/server/services/workshop/agents/omp-agent/lifecycle.ts +70 -4
  397. package/server/services/workshop/agents/omp-agent/supervision-decision.ts +3 -1
  398. package/server/services/workshop/agents/omp-agent/tools-steer.ts +113 -32
  399. package/server/services/workshop/agents/tool-approvals.ts +113 -29
  400. package/server/services/workshop/agents/tool-classes.ts +72 -56
  401. package/server/services/workshop/db/database/open.ts +5 -2
  402. package/server/services/workshop/db/database/schema.ts +1 -0
  403. package/server/services/workshop/db/database/seed.ts +2 -2
  404. package/server/services/workshop/db/message.repo.ts +134 -26
  405. package/server/services/workshop/db/project-kernel.repo.ts +3 -3
  406. package/server/services/workshop/db/schema.sql +3 -1
  407. package/server/services/workshop/db/task.repo.ts +101 -0
  408. package/server/services/workshop/dcw/dcw-controller/actuation.ts +120 -9
  409. package/server/services/workshop/dcw/dcw-controller/contracts.ts +18 -16
  410. package/server/services/workshop/dcw/dcw-controller/crud.ts +23 -0
  411. package/server/services/workshop/dcw/dcw-controller/lines.ts +34 -2
  412. package/server/services/workshop/dcw/dcw-controller/recipes.ts +80 -6
  413. package/server/services/workshop/dcw/dcw-controller/state.ts +89 -88
  414. package/server/services/workshop/dcw/dcw-controller/types.ts +5 -0
  415. package/server/services/workshop/dcw/dcw-controller/write.ts +9 -6
  416. package/server/services/workshop/dcw/dcw-line.repo.ts +2 -0
  417. package/server/services/workshop/dcw/dcw-node.repo.ts +3 -1
  418. package/server/services/workshop/dcw/dcw-node.ts +346 -307
  419. package/server/services/workshop/dcw/dcw-runtime.ts +8 -4
  420. package/server/services/workshop/projects/effects.ts +47 -29
  421. package/server/services/workshop/projects/kernel.ts +8 -1
  422. package/server/services/workshop/projects/legacy-recovery.ts +36 -0
  423. package/server/services/workshop/projects/service.ts +15 -0
  424. package/server/services/workshop/runtime/agent-runtime/contracts.ts +1 -1
  425. package/server/services/workshop/runtime/agent-runtime/lifecycle.ts +7 -2
  426. package/server/services/workshop/runtime/agent-runtime/message-watchdog.ts +40 -0
  427. package/server/services/workshop/runtime/agent-runtime/message.ts +151 -21
  428. package/server/services/workshop/runtime/agent-runtime/state.ts +69 -13
  429. package/server/services/workshop/runtime/agent-runtime/supervise.ts +219 -42
  430. package/server/services/workshop/runtime/agent-runtime/types.ts +6 -0
  431. package/server/services/workshop/runtime/mailbox.ts +112 -21
  432. package/server/services/workshop/runtime/manager/admin-channel.ts +34 -22
  433. package/server/services/workshop/runtime/manager/host-tools.ts +18 -5
  434. package/server/services/workshop/runtime/manager/runtime-wiring.ts +101 -41
  435. package/server/services/workshop/runtime/manager/schedules.ts +3 -1
  436. package/server/services/workshop/runtime/manager/tasks.ts +41 -0
  437. package/server/services/workshop/runtime/memory/recall.ts +11 -4
  438. package/server/services/workshop/runtime/memory/types.ts +2 -0
  439. package/server/services/workshop/runtime/scheduler-loop/contracts.ts +29 -29
  440. package/server/services/workshop/runtime/scheduler-loop/execute.ts +7 -0
  441. package/server/services/workshop/runtime/scheduler-loop/rules.ts +3 -0
  442. package/server/services/workshop/runtime/scheduler-loop/snapshot.ts +10 -2
  443. package/server/services/workshop/runtime/scheduler-loop/state.ts +12 -0
  444. package/server/services/workshop/runtime/scheduler-loop/tick.ts +54 -5
  445. package/server/services/workshop/runtime/task-engine/create.ts +16 -0
  446. package/server/services/workshop/runtime/task-engine/helpers.ts +5 -0
  447. package/server/services/workshop/runtime/task-engine/legacy-recovery.ts +149 -0
  448. package/server/services/workshop/runtime/task-engine/lifecycle.ts +38 -1
  449. package/server/services/workshop/runtime/task-engine/transition.ts +4 -0
  450. package/server/services/workshop/runtime/task-engine/update.ts +6 -0
  451. package/server/services/workshop/runtime/task-engine/views.ts +61 -0
  452. package/server/services/workshop/tools/policy.ts +16 -1
  453. package/shared/dcw-protocol/line.ts +4 -0
  454. package/.output/public/_nuxt/C8QlHux5.js +0 -1
  455. package/.output/public/_nuxt/_id_.0EnzA0aA.css +0 -1
  456. package/.output/public/_nuxt/builds/meta/846b9c03-1442-4fcb-b3fc-1d9484eaa41b.json +0 -1
  457. package/.output/server/chunks/build/_id_-C0vNEbts.mjs.map +0 -1
@@ -16,6 +16,8 @@ import { isProductionTool } from '../../agents/host-tool-bridge/catalog'
16
16
  import { channelToolGate } from '../../tools/policy'
17
17
  import { recordOps } from '../../ops/ops'
18
18
  import { rowToMessage } from '../mailbox'
19
+ import { isRecoveryBlockedMessage } from '../../db/message.repo'
20
+ import { allowedWithoutTurnProvenance } from '../../agents/tool-classes'
19
21
 
20
22
  /** WP4:token 路径需要留痕的协作面工具(可作数据二次外传的通道) */
21
23
  const COLLAB_AUDIT_TOOLS = new Set([
@@ -102,6 +104,13 @@ export abstract class ManagerHostTools extends ManagerA2A {
102
104
  if (input.token !== undefined && !this.deps.repos.channelAgents.isTokenValid(row, input.token)) {
103
105
  throw new AppError(401, 'UNAUTHORIZED', 'agent token 校验失败')
104
106
  }
107
+ // An agent token identifies an agent, not the turn that authorized a call.
108
+ if (input.token !== undefined) {
109
+ const isBuiltin = HOST_TOOLS.some(t => t.name === input.tool)
110
+ if (!allowedWithoutTurnProvenance(input.tool, isBuiltin, isBuiltin ? undefined : listPluginTools().get(input.tool))) {
111
+ return { text: `工具「${input.tool}」拒绝执行: agent token 缺少可信回合来源 (turn provenance),无法授权此操作。`, isError: true }
112
+ }
113
+ }
105
114
  // ── 人类权限作用域判定(§13.3)────────────────────────────────────────────
106
115
  // 该 Agent 若正在服务一次**群成员**发起的人类调用,则管理面/高危工具一律拒绝:
107
116
  // @Agent 不等于把 owner 权限委托给成员,发起者权限不得因 Agent 身份更高而放大。
@@ -270,25 +279,29 @@ export abstract class ManagerHostTools extends ManagerA2A {
270
279
 
271
280
  async pollMailbox(channelId: string, callerAgentId: string, limit = 100): Promise<A2AMessage[]> {
272
281
  this.requireMember(channelId, callerAgentId)
282
+ const isBlocked = (row: import('../../db/database').MessageRow) =>
283
+ isRecoveryBlockedMessage(row, id => this.getTaskEngine().isLegacyRecoveryBlocked(id))
273
284
  return this.deps.repos.messages
274
- .listPendingByChannelAgent(channelId, callerAgentId)
275
- .slice(0, limit)
285
+ .listPendingByChannelAgent(channelId, callerAgentId, limit, isBlocked)
276
286
  .map(rowToMessage)
277
287
  }
278
288
 
279
289
  /** 确认消费自己 mailbox 的协作消息(读即取;id 须属于 caller 的 pending 集) */
280
290
  ackMailbox(channelId: string, callerAgentId: string, messageIds: string[]): void {
281
291
  this.requireMember(channelId, callerAgentId)
292
+ const isBlocked = (row: import('../../db/database').MessageRow) =>
293
+ isRecoveryBlockedMessage(row, id => this.getTaskEngine().isLegacyRecoveryBlocked(id))
282
294
  const pending = new Set(
283
295
  this.deps.repos.messages
284
- .listPendingByChannelAgent(channelId, callerAgentId)
296
+ .listPendingByChannelAgent(channelId, callerAgentId, undefined, isBlocked)
285
297
  .map(r => r.id),
286
298
  )
287
299
  for (const id of messageIds) {
288
300
  // claim 守卫:与 steer 注入原子竞争(peek 与 ack 之间消息可能被认领),
289
301
  // 认领成功才标记消费——失败说明 steer 已注入运行中会话,不再重复投递
290
- if (pending.has(id) && this.deps.repos.messages.claim(id)) {
291
- this.deps.repos.messages.markConsumed(id)
302
+ if (pending.has(id)) {
303
+ const token = this.deps.repos.messages.claim(id, isBlocked)
304
+ if (token) this.deps.repos.messages.markConsumed(id, token)
292
305
  }
293
306
  }
294
307
  }
@@ -11,6 +11,7 @@ import { AgentMemory } from '../memory'
11
11
  import { AgentRuntime } from '../agent-runtime'
12
12
  import type { ChannelRuntime } from '../channel-runtime'
13
13
  import { Mailbox } from '../mailbox'
14
+ import { isRecoveryBlockedMessage } from '../../db/message.repo'
14
15
  import { SchedulerLoop } from '../scheduler-loop'
15
16
  import { buildMessage, instanceToAgentInfo, log, parseChannelLlm, rowToChannelMail, runtimeKey } from './helpers'
16
17
  import { getDcwLineRepo } from '../../dcw/dcw-line.repo'
@@ -25,6 +26,8 @@ import { shouldRescueBusyStuck } from './rescue-policy'
25
26
  import { channelRecycleDecision } from './recycle-policy'
26
27
  import { SessionContextService, formatBriefText } from '../../sessions/context'
27
28
  import { channelModeForAgent } from '../../channel-mode'
29
+ import { fenceToMetadata } from '../task-engine/lease'
30
+ import { isLegacyRecoveryHeld } from '../task-engine/legacy-recovery'
28
31
 
29
32
  /**
30
33
  * 有原生会话持久化的引擎 → session 注入用 brief 档(只注身份+关键事实,历史归引擎)。
@@ -40,6 +43,9 @@ function memberMapContains(memberMapJson: string, memberId: string): boolean {
40
43
 
41
44
  export abstract class ManagerRuntimeWiring extends ManagerBus {
42
45
  private sessionContextService: SessionContextService | null = null
46
+ private readonly channelUnloads = new Map<string, Promise<boolean>>()
47
+ protected readonly channelRemovals = new Map<string, Promise<void>>()
48
+ protected readonly channelAgentStops = new Map<string, Set<Promise<void>>>()
43
49
 
44
50
  /** Session Context 单例(按需建;repo 持有 db,不额外连接) */
45
51
  protected getSessionContextService(): SessionContextService {
@@ -57,7 +63,8 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
57
63
  const agent = instanceToAgentInfo(m)
58
64
  const cr = this.ensureChannelRuntime(m.channelId)
59
65
  const bus = this.buses.get(m.channelId)!
60
- const mailbox = new Mailbox(this.deps.repos.messages, m.channelId, agent.id, () => cr.wakeScheduler())
66
+ const mailbox = new Mailbox(this.deps.repos.messages, m.channelId, agent.id, () => cr.wakeScheduler(),
67
+ row => isRecoveryBlockedMessage(row, id => this.getTaskEngine().isLegacyRecoveryBlocked(id)))
61
68
  const sessionRow = activeSessionOfMember(createChannelSessionRepo(this.deps.db).listByChannel(m.channelId), agent.id)
62
69
  const trustedSession = sessionRow ? trustedSessionBindingIdentity(sessionRow) : null
63
70
  const channelSessionScope: ChannelSessionExecutionScope | null = trustedSession
@@ -78,7 +85,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
78
85
  const boundLineId = integrated ? (sessionRow ? channelSessionScope?.lineId ?? '' : this.deps.repos.channels.findById(m.channelId)?.lineId ?? '') : ''
79
86
  const line = boundLineId ? getDcwLineRepo().byId(boundLineId) : undefined
80
87
  if (line) {
81
- const brief = `\n\n## 绑定产线(只读上下文)\n本频道已绑定产线「${line.name}」(${line.id})${line.description ? ` — ${line.description}` : ''}。全员可用 line_context 查看该产线实时全景(运行状态/活动批次/当前配方与参数窗口),ops_log / recipe_log / recipe_versions 查运维日志与配方历史(频道绑定 = 只读授权);参数下发等写操作仍需节点授权(lead 可用 team_grant_nodes/grant_node_ids 授予)。`
88
+ const brief = `\n\n## 绑定产线(只读上下文)\n本频道已绑定产线「${line.name}」(${line.id})${line.description ? ` — ${line.description}` : ''}。全员可用 line_context 查看该产线实时全景(运行状态/活动批次/当前配方与参数窗口),ops_log / recipe_log / recipe_versions 查运维日志与配方历史(频道绑定 = 只读授权);参数下发等写操作仍需节点授权(lead 可单独用 team_grant_nodes 授予自己已绑定的节点,再不带 grant_node_ids 派发)。`
82
89
  configWithCtx.scenarioPrompt = (scenarioPrompt ? `${scenarioPrompt}\n` : '') + brief
83
90
  }
84
91
  else if (scenarioPrompt) {
@@ -203,7 +210,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
203
210
  protected ensureAgentRuntime(channelId: string, agentId: string): AgentRuntime | undefined {
204
211
  const key = runtimeKey(channelId, agentId)
205
212
  // 停机窗口墓碑:既不返回半关闭的旧运行时,也不重建新运行时(否则消息进闭箱)
206
- if (this.stoppingAgents.has(key) || this.channels.get(channelId)?.schedulerStoppingInProgress) return undefined
213
+ if (this.shutdownStarted || this.channelRemovals.has(channelId) || this.channelUnloads.has(channelId) || this.stoppingAgents.has(key) || this.channels.get(channelId)?.schedulerStoppingInProgress) return undefined
207
214
  const existing = this.agentIndex.get(key)
208
215
  if (existing) {
209
216
  // 活性守卫(2026-11-10 P1):已停止的实例不能直接复用 —— 旧实现无条件返回它,
@@ -219,7 +226,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
219
226
  // WP2 守卫 A:频道已停用(任务实例终态回收/频道关闭)→ 拒绝按需重装配,
220
227
  // 防「已停用频道被直接寻址复活」。
221
228
  const ch = this.deps.repos.channels.findById(channelId)
222
- if (ch && ch.enabled !== 1) return undefined
229
+ if (!ch || ch.enabled !== 1) return undefined
223
230
  // WP2 守卫 B:会话克隆(名字带 ·session· 标记)只在所属会话仍 active 时可装配;
224
231
  // 已关闭会话的克隆不可被任何寻址路径重新拉起(历史行仍保留审计)。
225
232
  if (String(m.name ?? '').includes('·session·')) {
@@ -245,6 +252,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
245
252
 
246
253
  /** 激活 channel:装配 lead 运行时 + 装配并启动 SchedulerLoop(幂等) */
247
254
  ensureChannelActive(channelId: string, options?: SchedulerLoopOptions): void {
255
+ if (this.shutdownStarted || this.channelRemovals.has(channelId) || this.channelUnloads.has(channelId)) return
248
256
  const channel = this.deps.repos.channels.findById(channelId)
249
257
  if (!channel || channel.enabled !== 1 || !channel.leadAgentId) return
250
258
  const cr = this.ensureChannelRuntime(channelId)
@@ -337,36 +345,48 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
337
345
  }
338
346
 
339
347
  /** 停止并卸载某实例运行时(强制;删除实例/channel 时用) */
340
- protected async stopAndDetach(channelId: string, agentId: string): Promise<void> {
348
+ protected stopAndDetach(channelId: string, agentId: string): Promise<void> {
349
+ const removal = this.channelRemovals.get(channelId)
350
+ if (removal) return removal
341
351
  const key = runtimeKey(channelId, agentId)
342
352
  const runtime = this.agentIndex.get(key)
343
- if (!runtime) return
353
+ if (!runtime) return Promise.resolve()
344
354
  // C-P1-1(2026-10-28 审查):所有"摘除"动作在第一个 await 之前同步完成。
345
355
  // 旧实现把 agentIndex.delete 放在 await stop() 之后,停机窗口内:
346
356
  // route → ensureAgentRuntime 命中旧索引 → enqueue 进正在关闭的信箱 → 假送达 + 永久丢失;
347
357
  // 即便先 detach,loader 也能按 agentIndex 缓存把旧运行时装回去。
348
358
  // 现在的顺序 = 立墓碑 → 摘索引 → 摘频道成员 → 清人类调用作用域 → 后台停机。
359
+ const cr = this.channels.get(channelId)
349
360
  this.stoppingAgents.add(key)
350
361
  this.agentIndex.delete(key)
351
- const cr = this.channels.get(channelId)
352
362
  cr?.detachAgent(agentId)
353
363
  this.clearInvocationScope(agentId)
354
- let releaseSchedulerStarts: (() => void) | null = null
355
- try {
356
- if (runtime.role === 'lead' && cr) {
357
- releaseSchedulerStarts = await cr.stopSchedulersAndWait()
364
+ const stops = this.channelAgentStops.get(channelId) ?? new Set<Promise<void>>()
365
+ this.channelAgentStops.set(channelId, stops)
366
+ const stop = Promise.resolve().then(async () => {
367
+ let releaseSchedulerStarts: (() => void) | null = null
368
+ try {
369
+ if (runtime.role === 'lead' && cr) {
370
+ releaseSchedulerStarts = await cr.stopSchedulersAndWait()
371
+ }
372
+ await runtime.stop()
358
373
  }
359
- await runtime.stop()
360
- }
361
- finally {
362
- releaseSchedulerStarts?.()
363
- // 停机完成即允许惰性复活(新消息触发 wireMember 重建)
364
- this.stoppingAgents.delete(key)
365
- }
366
- if (cr && cr.getAgents().length === 0 && !cr.scheduler) {
367
- this.channels.delete(channelId)
368
- this.buses.delete(channelId)
374
+ finally {
375
+ releaseSchedulerStarts?.()
376
+ this.stoppingAgents.delete(key)
377
+ }
378
+ if (cr && this.channels.get(channelId) === cr && !this.channelUnloads.has(channelId) && !this.channelRemovals.has(channelId) && cr.getAgents().length === 0 && !cr.scheduler) {
379
+ this.channels.delete(channelId)
380
+ this.buses.delete(channelId)
381
+ }
382
+ })
383
+ stops.add(stop)
384
+ const forgetStop = () => {
385
+ stops.delete(stop)
386
+ if (stops.size === 0) this.channelAgentStops.delete(channelId)
369
387
  }
388
+ void stop.then(forgetStop, forgetStop)
389
+ return stop
370
390
  }
371
391
 
372
392
  /** 卸载实例运行时(空闲后释放内存,杀 omp 子进程);busy/有 pending/lead 有活跃任务 → 跳过 */
@@ -535,30 +555,56 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
535
555
  * 卸载 Channel 的全部成员运行时并停掉调度器。
536
556
  * 返回 false = 没有已装配的 ChannelRuntime(未装配/已卸载),调用方据此决定是否重装。
537
557
  */
538
- protected async unloadChannelAgents(channelId: string): Promise<boolean> {
558
+ protected unloadChannelAgents(channelId: string): Promise<boolean> {
559
+ const pending = this.channelUnloads.get(channelId)
560
+ if (pending) return pending
539
561
  const cr = this.channels.get(channelId)
540
- if (!cr) return false
541
- let releaseSchedulerStarts: (() => void) | null = null
542
- let unloaded = false
543
- try {
544
- releaseSchedulerStarts = await cr.stopSchedulersAndWait()
545
- const agents = [...cr.getAgents()]
546
- for (const agent of agents) {
547
- await agent.stop()
548
- cr.detachAgent(agent.agentId)
562
+ if (!cr) return Promise.resolve(false)
563
+
564
+ // Detach every routing entry before the first await; the channel tombstone also
565
+ // prevents a previously unwired member from being created during teardown.
566
+ const agents = [...cr.getAgents()]
567
+ const keys = agents.map(agent => runtimeKey(channelId, agent.agentId))
568
+ const ownedKeys = keys.filter(key => !this.stoppingAgents.has(key))
569
+ for (const key of ownedKeys) this.stoppingAgents.add(key)
570
+ for (const agent of agents) {
571
+ cr.detachAgent(agent.agentId)
572
+ if (this.agentIndex.get(runtimeKey(channelId, agent.agentId)) === agent) {
549
573
  this.agentIndex.delete(runtimeKey(channelId, agent.agentId))
550
574
  }
551
- if (cr.getAgents().length === 0) {
552
- this.channels.delete(channelId)
553
- this.buses.delete(channelId)
554
- }
555
- unloaded = true
556
- }
557
- finally {
558
- // Reopening is safe only after every old runtime has been detached.
559
- if (unloaded && this.channels.get(channelId) === cr) releaseSchedulerStarts?.()
575
+ this.clearInvocationScope(agent.agentId)
560
576
  }
561
- return unloaded
577
+
578
+ const unload = Promise.resolve().then(async () => {
579
+ let releaseSchedulerStarts: (() => void) | null = null
580
+ let unloaded = false
581
+ try {
582
+ releaseSchedulerStarts = await cr.stopSchedulersAndWait()
583
+ const results = await Promise.allSettled(agents.map(agent => agent.stop()))
584
+ const failed = results.find(result => result.status === 'rejected')
585
+ if (failed?.status === 'rejected') throw failed.reason
586
+ if (this.channels.get(channelId) === cr && cr.getAgents().length === 0) {
587
+ this.channels.delete(channelId)
588
+ this.buses.delete(channelId)
589
+ }
590
+ unloaded = true
591
+ return true
592
+ }
593
+ finally {
594
+ if (!unloaded && this.channels.get(channelId) === cr) {
595
+ // Preserve ownership for a later retry if a teardown fails.
596
+ for (const agent of agents) {
597
+ cr.addAgent(agent)
598
+ this.agentIndex.set(runtimeKey(channelId, agent.agentId), agent as AgentRuntime)
599
+ }
600
+ }
601
+ if (unloaded) releaseSchedulerStarts?.()
602
+ for (const key of ownedKeys) this.stoppingAgents.delete(key)
603
+ this.channelUnloads.delete(channelId)
604
+ }
605
+ })
606
+ this.channelUnloads.set(channelId, unload)
607
+ return unload
562
608
  }
563
609
 
564
610
  startIdleSweeper(options?: { intervalMs?: number, graceMs?: number }): () => void {
@@ -652,6 +698,14 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
652
698
  // 必须先滤掉终态根(FAILED 旧根占着 seq=1 会挡住重开的 seq=2 根,实测)。
653
699
  const head = roots.find(r => !TERMINAL_TASK_STATES[r.state as TaskState])
654
700
  if (!head || head.assigneeId !== channel.leadAgentId) continue
701
+ if (isLegacyRecoveryHeld(head)) continue
702
+ try {
703
+ if (this.getTaskEngine().isLegacyRecoveryBlocked(head.id)) continue
704
+ }
705
+ catch (err) {
706
+ log.warn(`[AgentChannelManager] D1 兜底无法校验历史恢复隔离,跳过 ${head.id}:`, err)
707
+ continue
708
+ }
655
709
  const openChildren = this.getTaskEngine().list(channel.id)
656
710
  .filter(t => t.parentId === head.id && !TERMINAL_TASK_STATES[t.state as TaskState])
657
711
  const leadRtPre = this.runtimeOf(channel.id, channel.leadAgentId)
@@ -693,6 +747,10 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
693
747
  // SUBMITTED root 场景永远是空操作(2026-11-10 实测确认)。
694
748
  await this.stopAndDetach(channel.id, channel.leadAgentId)
695
749
  }
750
+ if (this.getTaskEngine().isLegacyRecoveryBlocked(head.id)) {
751
+ this.rescueSeen.delete(head.id)
752
+ continue
753
+ }
696
754
  this.ensureChannelActive(channel.id)
697
755
  // 入场即刷新执行预算(deadline 语义=执行预算,预算从入场起算):滞留根的旧预算
698
756
  // 早已耗尽,不刷新则 tick 的过期收口会在 WORKING 后立即处决它。
@@ -706,6 +764,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
706
764
  catch { /* 极简引擎替身缺方法:跳过,入场后由既有预算语义接管 */ }
707
765
  }
708
766
  catch (err) {
767
+ this.rescueSeen.delete(head.id)
709
768
  log.warn(`[AgentChannelManager] D1 兜底复活失败(下轮重试): ${err instanceof Error ? err.message : String(err)}`)
710
769
  continue
711
770
  }
@@ -733,6 +792,7 @@ export abstract class ManagerRuntimeWiring extends ManagerBus {
733
792
  'x-aw-task-kind': 'assign',
734
793
  'x-aw-task-id': head.id,
735
794
  'x-aw-from-label': '调度兜底',
795
+ ...fenceToMetadata({ assignmentGeneration: freshHead.assignmentGeneration, executionLeaseId: freshHead.executionLeaseId ?? undefined }),
736
796
  },
737
797
  )
738
798
  rescueMessage.taskId = head.id
@@ -10,6 +10,7 @@ import { AppError } from '../../../../utils/errors'
10
10
  import { ScheduleRuntime, validatePlanAndComputeFirstRun } from '../schedule-runtime'
11
11
  import { TERMINAL_TASK_STATES } from '../../types/task'
12
12
  import { log } from './helpers'
13
+ import { isLegacyRecoveryHeld } from '../task-engine/legacy-recovery'
13
14
 
14
15
  export abstract class ManagerSchedules extends ManagerHostTools {
15
16
  async restore(): Promise<void> {
@@ -48,7 +49,7 @@ export abstract class ManagerSchedules extends ManagerHostTools {
48
49
  err instanceof Error ? err.message : String(err))
49
50
  }
50
51
  }
51
- // 断线重连:ASSIGNED/WORKING 的叶子任务(无子任务)若无 pending assign 投递
52
+ // 断线重连:ASSIGNED/WORKING 的叶子任务(无子任务)若无 pending/consuming assign 投递
52
53
  // (消息已被消费但任务未完成——进程内 run 抛错、或崩溃落在消费后),
53
54
  // 无人会重新驱动它(调度循环只 dispatch lead 名下任务;停滞检测要 stallMs×2 才 cancel)。
54
55
  // 重投 assign + 唤醒 assignee,由 processMessage 的终态检查保证幂等(执行从头重放)。
@@ -62,6 +63,7 @@ export abstract class ManagerSchedules extends ManagerHostTools {
62
63
  }
63
64
  }
64
65
  for (const task of nonTerminal) {
66
+ if (isLegacyRecoveryHeld(task) || this.getTaskEngine().isLegacyRecoveryBlocked(task.id)) continue
65
67
  if (task.state !== 'ASSIGNED' && task.state !== 'WORKING') continue
66
68
  if (parentIds.has(task.id)) continue
67
69
  if (this.deps.repos.messages.hasPendingAssign(task.id)) continue
@@ -19,6 +19,9 @@ import { parseJson } from '../../db/database'
19
19
  import { randomUUID } from 'node:crypto'
20
20
  import { workshopSettings } from '../../settings'
21
21
  import { assertDispatchAllowed } from '../task-engine/policy'
22
+ import { fenceToMetadata } from '../task-engine/lease'
23
+ import { assertNotLegacyRecoveryHeld } from '../task-engine/legacy-recovery'
24
+ import { currentExecutionScope } from '../../agents/execution-scope'
22
25
 
23
26
  export abstract class ManagerTasks extends ManagerChannelTemplates {
24
27
  /**
@@ -47,6 +50,9 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
47
50
  if (channel.enabled !== 1) {
48
51
  throw new AppError(403, 'CHANNEL_DISABLED', `channel ${input.channelId} 已禁用`)
49
52
  }
53
+ if (this.getTaskEngine().hasLegacyRecoveryHold(input.channelId)) {
54
+ throw new AppError(409, 'LEGACY_EXECUTION_RECOVERY_REQUIRED', '频道存在待核查的历史任务,暂不接收新任务')
55
+ }
50
56
  this.ensureChannelActive(input.channelId)
51
57
  // 标题是展示字段不是身份:不同请求允许同标题并排入队;chat 重投由来源消息键幂等。
52
58
  // HITL 直发目标校验 + 容错寻址(id/名字/唯一前缀;人类输入名字即可直发)
@@ -112,6 +118,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
112
118
  const messageMetadata: Record<string, unknown> = {
113
119
  'x-aw-task-kind': 'assign',
114
120
  'x-aw-task-id': task.id,
121
+ ...fenceToMetadata(task),
115
122
  }
116
123
  if (input.fromLabel) messageMetadata['x-aw-from-label'] = input.fromLabel
117
124
  // 简报兜底:人类直派常只填 title/description(不带 parts)——assign 消息若只有空
@@ -161,6 +168,9 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
161
168
  throw new AppError(400, 'NO_LEAD_AGENT', `channel ${input.channelId} 无 lead,请先创建 lead`)
162
169
  }
163
170
  if (channel.enabled !== 1) throw new AppError(403, 'CHANNEL_DISABLED', `channel ${input.channelId} 已禁用`)
171
+ if (this.getTaskEngine().hasLegacyRecoveryHold(input.channelId)) {
172
+ throw new AppError(409, 'LEGACY_EXECUTION_RECOVERY_REQUIRED', '频道存在待核查的历史任务,暂不接收新任务')
173
+ }
164
174
  this.ensureChannelActive(input.channelId)
165
175
  const assigneeId = input.assigneeId ?? channel.leadAgentId
166
176
  const assigneeRow = this.deps.repos.channelAgents.findByChannelAgent(input.channelId, assigneeId)
@@ -205,6 +215,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
205
215
  'x-aw-msg-priority': 'immediate',
206
216
  'x-aw-task-kind': 'assign',
207
217
  'x-aw-task-id': task.id,
218
+ ...fenceToMetadata(task),
208
219
  'x-aw-from-label': '项目派发',
209
220
  ...(input.sessionId ? { 'x-aw-session-id': input.sessionId } : {}),
210
221
  },
@@ -238,6 +249,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
238
249
  }
239
250
  // 执行前强校验:worker 引擎未安装 → 报错回 lead(可改派),不产生必败子任务
240
251
  assertHarnessUsable(assignee.harness, parseJson<Record<string, unknown>>(assignee.configJson, {}))
252
+ currentExecutionScope()?.assertActive()
241
253
  let task: WorkspaceTask
242
254
  if (input.parentTaskId) {
243
255
  const parent = this.getTaskEngine().get(input.parentTaskId)
@@ -318,6 +330,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
318
330
  'x-aw-task-kind': 'assign',
319
331
  'x-aw-task-id': task.id,
320
332
  'x-aw-from-agent': callerAgentId,
333
+ ...fenceToMetadata(task),
321
334
  })
322
335
  message.taskId = task.id
323
336
  const delivered = this.route(channelId, message)
@@ -411,6 +424,10 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
411
424
  input: { taskId: string, progress?: number, artifact?: A2AArtifact, message?: string },
412
425
  ): Promise<WorkspaceTask> {
413
426
  const task = this.requireTaskInScope(channelId, callerAgentId, input.taskId)
427
+ assertNotLegacyRecoveryHeld(task)
428
+ if (this.getTaskEngine().isLegacyRecoveryBlocked(task.id)) {
429
+ throw new AppError(409, 'LEGACY_EXECUTION_RECOVERY_REQUIRED', `Task ${task.id} requires operator investigation`)
430
+ }
414
431
  if (task.assigneeId !== callerAgentId) {
415
432
  throw new AppError(403, 'SCOPE_VIOLATION', '仅 assignee 可上报任务')
416
433
  }
@@ -429,6 +446,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
429
446
  { messageId: randomUUID(), contextId: task.channelId, role: 'ROLE_AGENT' as const, parts: [{ text: input.message }] },
430
447
  ].slice(-200)
431
448
  }
449
+ currentExecutionScope()?.assertActive()
432
450
  const updated = this.deps.repos.tasks.update(input.taskId, patch)
433
451
  const next = rowToTask(updated!)
434
452
  this.notifyTask(task.channelId, { taskId: task.id, progress: next.progress, agentId: callerAgentId })
@@ -450,6 +468,7 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
450
468
  if (task.state === 'CANCELED' || task.state === 'FAILED') {
451
469
  throw new AppError(409, 'TASK_TERMINAL', `任务 ${input.taskId.slice(0, 8)} 已被平台${task.state === 'CANCELED' ? '取消' : '判定失败'},不能再标记完成;请继续处理队列下一项`)
452
470
  }
471
+ currentExecutionScope()?.assertActive()
453
472
  const completed = this.getTaskEngine().complete(input.taskId, input.artifacts)
454
473
  // goal 保底合成产物广播(goal 模式父任务且 lead 未自带总结时,taskEngine 追加了
455
474
  // 平台合成的 goal-summary;以 goal-summary 语义 + artifactId 差集识别,幂等不重复广播)
@@ -520,6 +539,17 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
520
539
  const canceledTasks = this.getTaskEngine().cancelTree(input.taskId, callerAgentId, isLead ? 'LEAD_CANCEL' : 'USER_CANCEL')
521
540
  for (const canceled of canceledTasks) {
522
541
  this.runtimeOf(channelId, canceled.assigneeId)?.abortTask(canceled.id)
542
+ if (canceled.assignmentGeneration != null && canceled.executionLeaseId) {
543
+ try {
544
+ const { getToolApprovals } = await import('../../agents/tool-approvals')
545
+ getToolApprovals().cancelPendingForTask(canceled.id, '任务已取消,审批失效,指令未执行', {
546
+ agentId: canceled.assigneeId,
547
+ assignmentGeneration: canceled.assignmentGeneration,
548
+ executionLeaseId: canceled.executionLeaseId,
549
+ })
550
+ }
551
+ catch { /* 审批面未装配时仍保留任务取消语义 */ }
552
+ }
523
553
  this.wakeAgent(channelId, canceled.assigneeId)
524
554
  }
525
555
  return this.getTaskEngine().get(input.taskId)!
@@ -670,6 +700,17 @@ export abstract class ManagerTasks extends ManagerChannelTemplates {
670
700
  if (current && (current.state === 'WORKING' || current.state === 'WAITING')) {
671
701
  const { task, previousAssigneeId } = this.getTaskEngine().reassignRunning(taskId, target.id, callerAgentId, 'LEAD_REASSIGN')
672
702
  this.runtimeOf(channelId, previousAssigneeId)?.abortTask?.(taskId)
703
+ if (current.assignmentGeneration != null && current.executionLeaseId) {
704
+ try {
705
+ const { getToolApprovals } = await import('../../agents/tool-approvals')
706
+ getToolApprovals().cancelPendingForTask(taskId, '任务已重派,旧审批失效,指令未执行', {
707
+ agentId: previousAssigneeId,
708
+ assignmentGeneration: current.assignmentGeneration,
709
+ executionLeaseId: current.executionLeaseId,
710
+ })
711
+ }
712
+ catch { /* 审批面未装配时仍保留重派语义 */ }
713
+ }
673
714
  this.wakeAgent(channelId, target.id)
674
715
  return task
675
716
  }
@@ -34,7 +34,8 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
34
34
  * FTS 榜与向量榜各按名次贡献 1/(k+rank) 累加,再按榜内最高分归一化到 0-1——
35
35
  * 相比 v1 的 max 距离归一化,弱首命中/两榜分纲不一致时排序依然稳定。
36
36
  */
37
- protected async collectHits(query: string, scope: MemoryScope, sessionId?: string | null, scopeContext?: ScopeContext, automatic = false): Promise<Map<string, { row: MemoryRow, relevance: number }>> {
37
+ protected async collectHits(query: string, scope: MemoryScope, sessionId?: string | null, scopeContext?: ScopeContext, automatic = false, signal?: AbortSignal): Promise<Map<string, { row: MemoryRow, relevance: number }>> {
38
+ signal?.throwIfAborted()
38
39
  const rrf = new Map<string, { row: MemoryRow, score: number }>()
39
40
  const addRank = (row: MemoryRow, rank: number): void => {
40
41
  if (!this.inScope(row, scope, sessionId, scopeContext, automatic)) return
@@ -55,6 +56,7 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
55
56
  if (this.embedder) {
56
57
  try {
57
58
  const [qv] = await this.embedder.embed([query])
59
+ signal?.throwIfAborted()
58
60
  if (qv) {
59
61
  this.ensureVec()
60
62
  const ownDomains: string[]
@@ -80,6 +82,7 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
80
82
  }
81
83
  }
82
84
  catch { /* 向量不可用退化为 FTS */ }
85
+ signal?.throwIfAborted()
83
86
  }
84
87
  // 时近兜底仅对含私有域的 scope 生效(shared 域无"本人最近"语义);
85
88
  // 兜底行不参与 RRF,固定弱相关度(策展层行排除——brief 恒 L0 注入,不占引子)
@@ -107,9 +110,11 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
107
110
  protected async rank(
108
111
  query: string,
109
112
  scope: MemoryScope,
110
- opts: { excludeCurated?: boolean, relatedTaskIds?: string[], sessionId?: string | null, scopeContext?: ScopeContext, automatic?: boolean } = {},
113
+ opts: { excludeCurated?: boolean, relatedTaskIds?: string[], sessionId?: string | null, scopeContext?: ScopeContext, automatic?: boolean, signal?: AbortSignal } = {},
111
114
  ): Promise<Array<{ row: MemoryRow, relevance: number, score: number }>> {
112
- const hits = await this.collectHits(query, scope, opts.sessionId, opts.scopeContext, opts.automatic ?? false)
115
+ opts.signal?.throwIfAborted()
116
+ const hits = await this.collectHits(query, scope, opts.sessionId, opts.scopeContext, opts.automatic ?? false, opts.signal)
117
+ opts.signal?.throwIfAborted()
113
118
  const related = opts.relatedTaskIds && opts.relatedTaskIds.length > 0 ? new Set(opts.relatedTaskIds) : null
114
119
  const scopeCtx = this.resolveScopeContext(opts.scopeContext)
115
120
  return [...hits.values()]
@@ -139,6 +144,7 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
139
144
  * 预算内装配;使用提示计费(防提示挤占正文预算)。
140
145
  */
141
146
  async recall(query: string, recallOpts: RecallOptions = {}): Promise<string | null> {
147
+ recallOpts.signal?.throwIfAborted()
142
148
  const doTouch = recallOpts.touch !== false
143
149
  // 显式 budgetTokens(实例/调用级)= 整块记忆硬顶(L0 简报+L1 引子+提示全计入);
144
150
  // 未显式设置 = 双预算:L1 引子 ≤ memory.primer_tokens(300),整块 ≤ memory.inject_total(500)
@@ -147,7 +153,8 @@ export abstract class AgentMemoryRecall extends AgentMemoryState {
147
153
  const totalBudget = explicit ?? memoryCfg().inject_total
148
154
  const scope = recallOpts.scope ?? 'auto'
149
155
  const sessionId = recallOpts.sessionId ?? this.opts.sessionId
150
- const scored = await this.rank(query, scope, { excludeCurated: true, relatedTaskIds: recallOpts.relatedTaskIds, sessionId, scopeContext: recallOpts.scopeContext, automatic: true })
156
+ const scored = await this.rank(query, scope, { excludeCurated: true, relatedTaskIds: recallOpts.relatedTaskIds, sessionId, scopeContext: recallOpts.scopeContext, automatic: true, signal: recallOpts.signal })
157
+ recallOpts.signal?.throwIfAborted()
151
158
 
152
159
  const lines: string[] = []
153
160
  const touched: string[] = []
@@ -18,6 +18,8 @@ export interface AgentMemoryOptions {
18
18
  }
19
19
 
20
20
  export interface RecallOptions {
21
+ /** Stop recall before further repository operations when aborted. */
22
+ signal?: AbortSignal
21
23
  /** 默认 true;supervise 调用应传 false 防 access_count 通胀 */
22
24
  touch?: boolean
23
25
  /** 本次召回预算覆盖(默认 AW_MEMORY_BUDGET_TOKENS) */
@@ -1,29 +1,29 @@
1
- /**
2
- * SchedulerLoopContracts —— **跨层能力契约**。
3
- *
4
- * 拆成 5 层后,有 8 个方法只被"更早的层"调用;
5
- * 与其把层序排成拓扑序打散职责,不如显式声明为抽象签名,由实现它的层提供(编译期校验)。
6
- *
7
- * 契约成员:
8
- * checkLoopCompletion → 由 execute.ts 实现
9
- * collectSnapshot → 由 snapshot.ts 实现
10
- * decide → 由 snapshot.ts 实现
11
- * execute → 由 execute.ts 实现
12
- * pickWorker → 由 execute.ts 实现
13
- * refreshIdle → 由 execute.ts 实现
14
- * ruleEngine → 由 rules.ts 实现
15
- * runRound → 由 tick.ts 实现
16
- */
17
- import type { SchedulerDecision } from './types'
18
- import type { SupervisionSnapshot } from '../../agents/agent-interface'
19
-
20
- export abstract class SchedulerLoopContracts {
21
- protected abstract checkLoopCompletion(snapshot: SupervisionSnapshot): void
22
- protected abstract collectSnapshot(): SupervisionSnapshot
23
- protected abstract decide(snapshot: SupervisionSnapshot): Promise<SchedulerDecision[]>
24
- protected abstract execute(decision: SchedulerDecision): void
25
- protected abstract pickWorker(pool: SupervisionSnapshot['members'], now: number, exclude?: string): SupervisionSnapshot['members'][number] | undefined
26
- protected abstract refreshIdle(members: SupervisionSnapshot['members'], now: number): void
27
- protected abstract ruleEngine(snapshot: SupervisionSnapshot): SchedulerDecision[]
28
- protected abstract runRound(): Promise<void>
29
- }
1
+ /**
2
+ * SchedulerLoopContracts —— **跨层能力契约**。
3
+ *
4
+ * 拆成 5 层后,有 8 个方法只被"更早的层"调用;
5
+ * 与其把层序排成拓扑序打散职责,不如显式声明为抽象签名,由实现它的层提供(编译期校验)。
6
+ *
7
+ * 契约成员:
8
+ * checkLoopCompletion → 由 execute.ts 实现
9
+ * collectSnapshot → 由 snapshot.ts 实现
10
+ * decide → 由 snapshot.ts 实现
11
+ * execute → 由 execute.ts 实现
12
+ * pickWorker → 由 execute.ts 实现
13
+ * refreshIdle → 由 execute.ts 实现
14
+ * ruleEngine → 由 rules.ts 实现
15
+ * runRound → 由 tick.ts 实现
16
+ */
17
+ import type { SchedulerDecision } from './types'
18
+ import type { SupervisionSnapshot } from '../../agents/agent-interface'
19
+
20
+ export abstract class SchedulerLoopContracts {
21
+ protected abstract checkLoopCompletion(snapshot: SupervisionSnapshot): void
22
+ protected abstract collectSnapshot(): SupervisionSnapshot
23
+ protected abstract decide(snapshot: SupervisionSnapshot, stillCurrent: () => boolean): Promise<SchedulerDecision[]>
24
+ protected abstract execute(decision: SchedulerDecision): void
25
+ protected abstract pickWorker(pool: SupervisionSnapshot['members'], now: number, exclude?: string): SupervisionSnapshot['members'][number] | undefined
26
+ protected abstract refreshIdle(members: SupervisionSnapshot['members'], now: number): void
27
+ protected abstract ruleEngine(snapshot: SupervisionSnapshot): SchedulerDecision[]
28
+ protected abstract runRound(): Promise<void>
29
+ }
@@ -9,6 +9,7 @@ import type { SchedulerDecision } from './types'
9
9
  import { AppError } from '../../../../utils/errors'
10
10
  import { LoopController, extractTaskMode, isGoalSummaryArtifact } from '../execution-mode'
11
11
  import { log } from './helpers'
12
+ import { isLegacyRecoveryHeld } from '../task-engine/legacy-recovery'
12
13
  import { randomUUID } from 'node:crypto'
13
14
  import { TERMINAL_TASK_STATES } from '../../types/task'
14
15
  import { rootQueueEnabled, workshopSettings } from '../../settings'
@@ -20,6 +21,11 @@ const CANCEL_BLOCKED_NOTE_COOLDOWN_MS = 5 * 60_000
20
21
  export abstract class SchedulerLoopExecute extends SchedulerLoopRules {
21
22
  /** 执行单条决策(身份=lead,经 TaskEngine 与 ChannelRuntime) */
22
23
  protected execute(decision: SchedulerDecision): void {
24
+ const taskId = 'taskId' in decision ? decision.taskId : decision.kind === 'dispatch' ? decision.parentTaskId : undefined
25
+ if (taskId) {
26
+ const task = this.lead.taskEngine.get(taskId)
27
+ if ((task && isLegacyRecoveryHeld(task)) || this.legacyBlocked(taskId)) return
28
+ }
23
29
  switch (decision.kind) {
24
30
  case 'wait': {
25
31
  // wait is an explicit, auditable Lead decision. It must not be treated as
@@ -303,6 +309,7 @@ export abstract class SchedulerLoopExecute extends SchedulerLoopRules {
303
309
  // 重启前已完成的主任务再识别一次并 resubmit(多跑一轮);只认本进程生命
304
310
  // 周期内完成的任务,重启前的历史 loop 由用户/上游重新提交
305
311
  const current = snapshot.tasks.find((t) => {
312
+ if (isLegacyRecoveryHeld(t) || this.legacyBlocked(t.id)) return false
306
313
  if (t.assigneeId !== this.lead.agentId) return false
307
314
  if (t.state !== 'COMPLETED') return false
308
315
  if (this.loopCompletedTaskIds.has(t.id)) return false
@@ -19,6 +19,7 @@ export abstract class SchedulerLoopRules extends SchedulerLoopSnapshot {
19
19
 
20
20
  // 任务按 createdAt ASC 迭代(list 顺序)= 外部提交 FIFO:先提交先分解先分发。
21
21
  for (const task of tasks) {
22
+ if (this.legacyBlocked(task.id)) continue
22
23
  // FAILED 且 retryCount<3:优先换人重试;仅剩原 assignee 空闲(如单 worker channel)
23
24
  // → 由原 assignee 重试(reassign 到自己,走 FAILED→ASSIGNED 恢复);无人可用 → 保留 FAILED
24
25
  // 留给父任务收口规则(直接 cancel FAILED 会撞终态 409——实测曾是每 tick 空转的死代码)。
@@ -56,6 +57,7 @@ export abstract class SchedulerLoopRules extends SchedulerLoopSnapshot {
56
57
  // 有 COMPLETED 子任务(部分成果可收)或仍有非终态子任务时不在此收口 ——
57
58
  // 交给 lead 的监督回合判定(接受部分成果/补发/改派)。
58
59
  for (const task of tasks) {
60
+ if (this.legacyBlocked(task.id)) continue
59
61
  if (task.state !== 'WAITING') continue
60
62
  const children = tasks.filter(t => t.parentId === task.id)
61
63
  if (children.length === 0 || children.some(c => !TERMINAL_TASK_STATES[c.state])) continue
@@ -76,6 +78,7 @@ export abstract class SchedulerLoopRules extends SchedulerLoopSnapshot {
76
78
  // 规则引擎对 busy 不强制取消 —— 只留可见信号,不做破坏性动作。
77
79
  const assigneeState = new Map(this.channelRuntime.getAgents().map(a => [a.agentId, a.getState()]))
78
80
  for (const task of tasks) {
81
+ if (this.legacyBlocked(task.id)) continue
79
82
  if (task.state !== 'WORKING') continue
80
83
  // 工具调用即活性:最近 stallMs 内有工具invoke的任务视为健康推进,刷新基线并跳过看门狗。
81
84
  // 真实 LLM worker 的长工具链(真实 PLC 写+等待回读)不更新 progress 数字,且回合间隙