agentworkshop 0.11.3 → 0.12.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 (440) 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/577f464e-672a-4c4e-a3c8-dc8c1b38930d.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 +4070 -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 +7 -7
  338. package/README.md +7 -7
  339. package/app/components/dcw/DcwNodesTable.vue +24 -0
  340. package/docs/mcp.en.md +30 -27
  341. package/docs/mcp.md +7 -3
  342. package/docs/plugins.en.md +4 -2
  343. package/docs/plugins.md +4 -2
  344. package/i18n/dicts/dcwDetail.json +221 -219
  345. package/i18n/locales/en.ts +2 -0
  346. package/i18n/locales/zh-CN.ts +2 -0
  347. package/package.json +2 -1
  348. package/scripts/check-docs-sync.mjs +20 -9
  349. package/scripts/onboarding/forge-channel.mjs +2 -1
  350. package/scripts/onboarding/lib.mjs +159 -3
  351. package/scripts/onboarding/onboard.mjs +2 -0
  352. package/scripts/onboarding/preflight.mjs +233 -231
  353. package/scripts/onboarding/provision-line.mjs +12 -2
  354. package/scripts/onboarding/sim-attest.mjs +103 -0
  355. package/scripts/onboarding/sim-twin.mjs +88 -4
  356. package/scripts/onboarding/test-connection.mjs +2 -1
  357. package/scripts/onboarding/v6-protected-api.mjs +41 -0
  358. package/scripts/onboarding/v6-protected-fixture.mjs +54 -0
  359. package/scripts/onboarding/verify-line.mjs +179 -136
  360. package/scripts/onboarding/verify-mirror.mjs +149 -145
  361. package/server/api/workshop/agent-tools/list.get.ts +10 -1
  362. package/server/api/workshop/tasks/[id]/recovery-disposition.post.ts +32 -0
  363. package/server/api/workshop/tasks/recovery-holds.get.ts +22 -0
  364. package/server/plugins-builtin/rag-bridge/index.mjs +20 -2
  365. package/server/services/workshop/agents/agent-interface.ts +3 -0
  366. package/server/services/workshop/agents/base-agent.ts +100 -4
  367. package/server/services/workshop/agents/execution-scope.ts +26 -0
  368. package/server/services/workshop/agents/hitl-capabilities.ts +3 -3
  369. package/server/services/workshop/agents/host-tool-bridge/dispatch.ts +42 -2
  370. package/server/services/workshop/agents/host-tool-bridge/tools/progress.ts +4 -0
  371. package/server/services/workshop/agents/host-tool-bridge/tools/tasks.ts +11 -28
  372. package/server/services/workshop/agents/host-tool-bridge/tools/team-delegation.ts +83 -129
  373. package/server/services/workshop/agents/industrial/dcw-tools.ts +27 -5
  374. package/server/services/workshop/agents/industrial/line-tools.ts +15 -4
  375. package/server/services/workshop/agents/industrial/ops-tools.ts +32 -6
  376. package/server/services/workshop/agents/industrial/optimization-tools.ts +16 -3
  377. package/server/services/workshop/agents/industrial/recipe-propose-tools.ts +26 -3
  378. package/server/services/workshop/agents/omp-agent/client.ts +2 -4
  379. package/server/services/workshop/agents/omp-agent/core.ts +3 -0
  380. package/server/services/workshop/agents/omp-agent/lifecycle.ts +70 -4
  381. package/server/services/workshop/agents/omp-agent/supervision-decision.ts +3 -1
  382. package/server/services/workshop/agents/omp-agent/tools-steer.ts +113 -32
  383. package/server/services/workshop/agents/tool-approvals.ts +113 -29
  384. package/server/services/workshop/agents/tool-classes.ts +72 -56
  385. package/server/services/workshop/db/database/open.ts +5 -2
  386. package/server/services/workshop/db/database/schema.ts +1 -0
  387. package/server/services/workshop/db/database/seed.ts +2 -2
  388. package/server/services/workshop/db/message.repo.ts +134 -26
  389. package/server/services/workshop/db/project-kernel.repo.ts +3 -3
  390. package/server/services/workshop/db/schema.sql +3 -1
  391. package/server/services/workshop/db/task.repo.ts +101 -0
  392. package/server/services/workshop/dcw/dcw-controller/actuation.ts +120 -9
  393. package/server/services/workshop/dcw/dcw-controller/contracts.ts +18 -16
  394. package/server/services/workshop/dcw/dcw-controller/crud.ts +23 -0
  395. package/server/services/workshop/dcw/dcw-controller/lines.ts +34 -2
  396. package/server/services/workshop/dcw/dcw-controller/recipes.ts +80 -6
  397. package/server/services/workshop/dcw/dcw-controller/state.ts +89 -88
  398. package/server/services/workshop/dcw/dcw-controller/types.ts +5 -0
  399. package/server/services/workshop/dcw/dcw-controller/write.ts +9 -6
  400. package/server/services/workshop/dcw/dcw-line.repo.ts +2 -0
  401. package/server/services/workshop/dcw/dcw-node.repo.ts +3 -1
  402. package/server/services/workshop/dcw/dcw-node.ts +346 -307
  403. package/server/services/workshop/dcw/dcw-runtime.ts +8 -4
  404. package/server/services/workshop/projects/effects.ts +47 -29
  405. package/server/services/workshop/projects/kernel.ts +8 -1
  406. package/server/services/workshop/projects/legacy-recovery.ts +36 -0
  407. package/server/services/workshop/projects/service.ts +15 -0
  408. package/server/services/workshop/runtime/agent-runtime/contracts.ts +1 -1
  409. package/server/services/workshop/runtime/agent-runtime/lifecycle.ts +7 -2
  410. package/server/services/workshop/runtime/agent-runtime/message-watchdog.ts +40 -0
  411. package/server/services/workshop/runtime/agent-runtime/message.ts +151 -21
  412. package/server/services/workshop/runtime/agent-runtime/state.ts +69 -13
  413. package/server/services/workshop/runtime/agent-runtime/supervise.ts +219 -42
  414. package/server/services/workshop/runtime/agent-runtime/types.ts +6 -0
  415. package/server/services/workshop/runtime/mailbox.ts +112 -21
  416. package/server/services/workshop/runtime/manager/admin-channel.ts +34 -22
  417. package/server/services/workshop/runtime/manager/host-tools.ts +18 -5
  418. package/server/services/workshop/runtime/manager/runtime-wiring.ts +101 -41
  419. package/server/services/workshop/runtime/manager/schedules.ts +3 -1
  420. package/server/services/workshop/runtime/manager/tasks.ts +41 -0
  421. package/server/services/workshop/runtime/memory/recall.ts +11 -4
  422. package/server/services/workshop/runtime/memory/types.ts +2 -0
  423. package/server/services/workshop/runtime/scheduler-loop/contracts.ts +29 -29
  424. package/server/services/workshop/runtime/scheduler-loop/execute.ts +7 -0
  425. package/server/services/workshop/runtime/scheduler-loop/rules.ts +3 -0
  426. package/server/services/workshop/runtime/scheduler-loop/snapshot.ts +10 -2
  427. package/server/services/workshop/runtime/scheduler-loop/state.ts +12 -0
  428. package/server/services/workshop/runtime/scheduler-loop/tick.ts +54 -5
  429. package/server/services/workshop/runtime/task-engine/create.ts +16 -0
  430. package/server/services/workshop/runtime/task-engine/helpers.ts +5 -0
  431. package/server/services/workshop/runtime/task-engine/legacy-recovery.ts +149 -0
  432. package/server/services/workshop/runtime/task-engine/lifecycle.ts +38 -1
  433. package/server/services/workshop/runtime/task-engine/transition.ts +4 -0
  434. package/server/services/workshop/runtime/task-engine/update.ts +6 -0
  435. package/server/services/workshop/runtime/task-engine/views.ts +61 -0
  436. package/shared/dcw-protocol/line.ts +4 -0
  437. package/.output/public/_nuxt/C8QlHux5.js +0 -1
  438. package/.output/public/_nuxt/_id_.0EnzA0aA.css +0 -1
  439. package/.output/public/_nuxt/builds/meta/846b9c03-1442-4fcb-b3fc-1d9484eaa41b.json +0 -1
  440. package/.output/server/chunks/build/_id_-C0vNEbts.mjs.map +0 -1
@@ -12,6 +12,8 @@ import { recordSupervisionToolHistory } from './supervision-history'
12
12
  import { ompAgentTeamAuditFailure, recordOmpAgentTeamToolEvent } from './agentteam-audit'
13
13
  import { workshopSettings } from '../../settings'
14
14
  import { TERMINAL_TASK_STATES } from '../../types/task'
15
+ import { getToolApprovals } from '../tool-approvals'
16
+ import type { ExecutionScope } from '../execution-scope'
15
17
 
16
18
  export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle {
17
19
  protected activeSupervisionToolLease: {
@@ -19,10 +21,12 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
19
21
  rootId: string | null
20
22
  rootActive: boolean
21
23
  signal?: AbortSignal
24
+ scope?: ExecutionScope
22
25
  } | null = null
23
26
 
24
27
  protected retireSupervisionClient(client: OmpRpcClient): void {
25
28
  if (this.client === client) this.client = null
29
+ if (this.hostToolAliases?.client === client) this.hostToolAliases = null
26
30
  if (this.activeSupervisionToolLease?.client === client) this.activeSupervisionToolLease = null
27
31
  this.hostToolsRegistered = false
28
32
  client.kill()
@@ -45,15 +49,20 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
45
49
 
46
50
  /** 引擎无关工具面:REST/MCP 桥直调与 omp 内部 host_tool_call 共用同一实现 */
47
51
  protected async handleHostTool(req: HostToolCallRequest, sourceClient: OmpRpcClient): Promise<{ text: string, isError?: boolean }> {
52
+ const scope = this.currentTurnScope
53
+ if (!scope) return { text: 'Harness 回合已结束,拒绝迟到的工具调用。', isError: true }
48
54
  if (sourceClient !== this.client) {
49
55
  return { text: '监督回合已取消,拒绝过期 Harness 工具调用。', isError: true }
50
56
  }
51
57
  if (!this.turnActive) {
52
58
  return { text: 'Harness 回合已结束,拒绝迟到的工具调用。', isError: true }
53
59
  }
60
+ const aliases = this.hostToolAliases
61
+ const toolName = aliases?.client === sourceClient && aliases.scope === scope ? aliases.byAlias.get(req.toolName) : undefined
62
+ if (!toolName) return { text: '过期或未知的 Harness 工具调用。', isError: true }
54
63
  const lease = this.activeSupervisionToolLease
55
64
  if (lease?.client === sourceClient && lease.rootId) {
56
- if (!lease.rootActive || lease.signal?.aborted) {
65
+ if ((lease.scope && lease.scope !== scope) || !lease.rootActive || lease.signal?.aborted) {
57
66
  this.retireSupervisionClient(sourceClient)
58
67
  return { text: '监督根任务已取消或结束,拒绝后续工具调用。', isError: true }
59
68
  }
@@ -70,7 +79,7 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
70
79
  if (auditFailure) {
71
80
  return { text: `AgentTeam 工具事件采集失败,已阻止后续工具分发: ${auditFailure}`, isError: true }
72
81
  }
73
- if (req.toolName === 'dispatch_task' && this.agentRole !== 'lead') {
82
+ if (toolName === 'dispatch_task' && this.agentRole !== 'lead') {
74
83
  return { text: '拒绝:dispatch_task 仅对 lead 开放。', isError: true }
75
84
  }
76
85
  const activeRootTaskId = this.agentRole === 'lead'
@@ -79,10 +88,29 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
79
88
  && !lease.signal?.aborted
80
89
  ? lease.rootId ?? undefined
81
90
  : undefined
82
- if (this.agentRole === 'lead' && req.toolName === 'dispatch_task' && !activeRootTaskId) {
91
+ if (this.agentRole === 'lead' && toolName === 'dispatch_task' && !activeRootTaskId) {
83
92
  return { text: '拒绝:dispatch_task 需要已验证的活动根任务;请在监督回合内派发。', isError: true }
84
93
  }
85
- return this.dispatchHostTool(req.toolName, req.arguments ?? {}, activeRootTaskId)
94
+ if (scope !== this.currentTurnScope || scope.signal.aborted || this.hostToolAliases !== aliases || aliases?.byAlias.get(req.toolName) !== toolName) {
95
+ return { text: 'Harness 回合已结束,拒绝迟到的工具调用。', isError: true }
96
+ }
97
+ return this.dispatchTurnHostTool(toolName, req.arguments ?? {}, scope, activeRootTaskId)
98
+ }
99
+
100
+ protected canonicalToolEvent(event: import('../adapters/omp-rpc-client').AgentSessionEvent): import('../adapters/omp-rpc-client').AgentSessionEvent | null {
101
+ if (!event.toolName) return event
102
+ const canonical = this.hostToolAliases?.byAlias.get(event.toolName)
103
+ if (canonical) return { ...event, toolName: canonical }
104
+ // Stale host frames are rejected and must not enter a new turn's audit.
105
+ if (/^aw_[0-9a-f]{32}_[0-9a-f]{16}_/.test(event.toolName)) return null
106
+ return event
107
+ }
108
+
109
+ protected promptWithToolAliases(prompt: string, scope: ExecutionScope): string {
110
+ const aliases = this.hostToolAliases
111
+ if (!aliases || aliases.scope !== scope) throw new Error('OMP turn tool scope unavailable')
112
+ const mapping = [...aliases.byName].map(([canonical, alias]) => `${canonical} -> ${alias}`).join('\n')
113
+ return `${prompt}\n\n[Host tool names for this turn]\nUse the current registered name on the right when calling a tool; names on the left in the instructions are canonical names. Do not reuse tool names from earlier turns. If the tool list changes, use the currently available tool name whose description identifies its canonical name.\n${mapping}\n[/Host tool names]`
86
114
  }
87
115
 
88
116
  // ===== prompt 组合 =====
@@ -146,14 +174,35 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
146
174
  */
147
175
 
148
176
  override async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: SupervisionOptions): Promise<SupervisionDecision[]> {
149
- if (!this.supervising) await this.retireEndedSupervisionClient(snapshot.activeRootId ?? null)
177
+ if (this.supervising || ctx.signal.aborted || opts?.signal?.aborted) return []
178
+ this.supervising = true
179
+ let scope: ExecutionScope | undefined
180
+ try {
181
+ scope = this.beginTurnScope(ctx)
182
+ return await this.superviseTurn(snapshot, ctx, scope, opts)
183
+ }
184
+ finally {
185
+ if (scope) {
186
+ this.clearTurnTools(scope)
187
+ this.endTurnScope(scope)
188
+ }
189
+ this.supervising = false
190
+ }
191
+ }
192
+
193
+ private async superviseTurn(snapshot: SupervisionSnapshot, ctx: AgentRunContext, scope: ExecutionScope, opts?: SupervisionOptions): Promise<SupervisionDecision[]> {
194
+ const turnSignal = opts?.signal ? AbortSignal.any([scope.signal, opts.signal]) : scope.signal
195
+ if (turnSignal.aborted) return []
196
+ await this.retireEndedSupervisionClient(snapshot.activeRootId ?? null)
197
+ if (turnSignal.aborted) return []
150
198
  await this.ensureClient(ctx)
199
+ if (turnSignal.aborted) return []
151
200
  if (!this.client) return []
152
- if (this.supervising) return [] // 上一轮 supervise 未收口:跳过本拍(节流即正确)
153
201
  const client = this.client
154
202
 
155
203
  // 上下文门控(≥70% 先压缩再调度;回合间隙发起,失败放行)
156
204
  await this.contextGate('supervise')
205
+ if (turnSignal.aborted) return []
157
206
 
158
207
  const prompt = supervisePrompt({
159
208
  snapshot,
@@ -163,6 +212,9 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
163
212
  manual: this.systemManual(),
164
213
  memory: ctx.memory,
165
214
  })
215
+ if (turnSignal.aborted) return []
216
+ await this.prepareTurnTools(client, scope)
217
+ if (turnSignal.aborted) return []
166
218
  // watchdog 只做观察和同 session 提示;hard timeout 仅作为最终回合安全边界。
167
219
  const policy = this.getSupervisionPolicy()
168
220
  const hardTimeoutMs = policy.hardTimeoutMs
@@ -181,14 +233,14 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
181
233
  client,
182
234
  rootId,
183
235
  rootActive: Boolean(rootTask && !TERMINAL_TASK_STATES[rootTask.state]),
184
- signal: opts?.signal,
236
+ signal: turnSignal,
237
+ scope,
185
238
  }
186
239
  let taskHistoryWrites = Promise.resolve()
187
240
 
188
241
  const finish = (decisions: SupervisionDecision[]) => {
189
242
  if (resolved) return
190
243
  resolved = true
191
- this.supervising = false
192
244
  this.turnActive = false
193
245
  this.streaming = false
194
246
  unsub()
@@ -202,11 +254,8 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
202
254
  // 只有显式取消、Runtime stop 或 hard timeout 才 abort;watchdog 本身不 abort。
203
255
  log.warn(`[OmpRpcAgent:${this.selfAgentId}] supervise ${reason} → abort 当前调度回合`)
204
256
  void client.send({ type: 'abort' }).catch(() => {})
205
- if (rootId) {
206
- // 旧 stdio 上的迟到 host_tool_call 无法再归属新一轮监督;立即退役客户端,
207
- // 后续 ensureClient 会重建,handleHostTool 依据客户端身份拒绝旧帧。
208
- this.retireSupervisionClient(client)
209
- }
257
+ // A late frame on an aborted stdio session cannot be attributed to a new turn.
258
+ this.retireSupervisionClient(client)
210
259
  // P4(2026-11-03):回合被中止时不得让在办任务滞留 WORKING —— 空决策会让
211
260
  // 任务停在"租约已撤但状态未收口"(FL-7 实测:只能人工取消)。映射规则抽到
212
261
  // supervision-decision.ts(纯函数,单测覆盖):仅硬中止(external cancel /
@@ -215,7 +264,9 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
215
264
  finish(decision ? [decision] : [])
216
265
  }
217
266
 
218
- const unsub = client.onEvent((event) => {
267
+ const unsub = client.onEvent((rawEvent) => {
268
+ const event = this.canonicalToolEvent(rawEvent)
269
+ if (!event) return
219
270
  if (event.type === 'tool_execution_start' || event.type === 'tool_execution_end') {
220
271
  recordOmpAgentTeamToolEvent(event, {
221
272
  agentId: this.selfAgentId,
@@ -258,29 +309,27 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
258
309
 
259
310
  // 外部取消(调度器 cancel 路径)传导:abort 当前 LLM 回合并立即收口
260
311
  let signalUnsub: (() => void) | undefined
261
- if (opts?.signal) {
262
- if (opts.signal.aborted) {
263
- unsub()
264
- resolve([])
312
+ {
313
+ if (turnSignal.aborted) {
314
+ finish([])
265
315
  return
266
316
  }
267
317
  const onAbort = (): void => {
268
318
  // 区分外部取消与硬超时:supervise.ts 用 controller.abort(reason) 传因。
269
319
  // 硬超时不该被当成"外部取消"去合成 cancel 决策 —— 慢回合(大上下文/慢
270
320
  // provider)是常态,取消任务属越权收口(2026-11-10 P1)。
271
- const why = (opts.signal as AbortSignal & { reason?: unknown })?.reason
321
+ const why = turnSignal.reason
272
322
  const reasonText = why instanceof Error ? why.message : String(why ?? '')
273
323
  // runtime stop 是生命周期停机,不得归一成 external cancel(否则取消在办任务)。
274
324
  abortTurn(normalizeSupervisionAbortReason(reasonText))
275
325
  }
276
- opts.signal.addEventListener('abort', onAbort, { once: true })
277
- signalUnsub = () => opts.signal?.removeEventListener('abort', onAbort)
326
+ turnSignal.addEventListener('abort', onAbort, { once: true })
327
+ signalUnsub = () => turnSignal.removeEventListener('abort', onAbort)
278
328
  }
279
329
 
280
- this.supervising = true
281
330
  this.turnActive = true
282
331
  this.streaming = false
283
- client.send({ type: 'prompt', message: prompt }).catch(() => finish([]))
332
+ client.send({ type: 'prompt', message: this.promptWithToolAliases(prompt, scope) }).catch(() => finish([]))
284
333
  })
285
334
  }
286
335
 
@@ -420,6 +469,14 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
420
469
  }
421
470
  // 上下文门控(≥70% 时在回合间隙先压缩再发 prompt;等待有界,失败放行)
422
471
  await this.contextGate('pre-prompt')
472
+ const scope = this.currentTurnScope
473
+ if (!scope) throw new Error('OMP turn scope unavailable')
474
+ if (signal.aborted) return
475
+ await this.prepareTurnTools(client, scope)
476
+ if (signal.aborted || scope.signal.aborted) {
477
+ this.clearTurnTools(scope)
478
+ return
479
+ }
423
480
  const queue: AgentEvent[] = []
424
481
  let resolveWait: (() => void) | null = null
425
482
  let isDone = false
@@ -487,7 +544,14 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
487
544
  // WP8:停滞看门狗阈值入运行语义设置(缺省 600s;per-agent promptTimeoutMs 仍可覆盖)
488
545
  const idleTimeoutMs = this.config.promptTimeoutMs ?? (Number(workshopSettings().harness_stall_timeout_ms) || 600_000)
489
546
  let lastActivity = Date.now()
547
+ const approvals = getToolApprovals()
548
+ const approvalPending = (): boolean => approvals.listPending(this.selfAgentId).length > 0
490
549
  let stallTimer: ReturnType<typeof setTimeout> | null = null
550
+ const unsubApprovals = approvals.subscribeApprovalChanges(this.selfAgentId, () => {
551
+ lastActivity = Date.now()
552
+ resolveWait?.()
553
+ resolveWait = null
554
+ })
491
555
 
492
556
  // LLM 流式增量缓冲:50ms 批量合并为一帧 delta(防高频 text_delta 洪泛 WS)
493
557
  let deltaBuf = ''
@@ -512,7 +576,11 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
512
576
 
513
577
  // 订阅 omp 事件流
514
578
  const unsub = client.onEvent((event) => {
515
- for (const mapped of this.mapOmpEvent(event, taskId)) {
579
+ if (event.type === 'message_end' && event.message?.role === 'user'
580
+ && JSON.stringify(event.message.content).includes('[Host tool names for this turn]')) return
581
+ const canonical = this.canonicalToolEvent(event)
582
+ if (!canonical) return
583
+ for (const mapped of this.mapOmpEvent(canonical, taskId)) {
516
584
  enqueue(mapped)
517
585
  }
518
586
  })
@@ -521,6 +589,7 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
521
589
  const onAbort = (): void => {
522
590
  log.warn(`[OmpRpcAgent:${this.selfAgentId}] run 被 abort(signal)→ 中止 omp 回合,taskId=${taskId ?? '-'}`)
523
591
  client.send({ type: 'abort' }).catch(() => {})
592
+ this.retireSupervisionClient(client)
524
593
  if (!isDone) {
525
594
  enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
526
595
  }
@@ -534,19 +603,25 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
534
603
 
535
604
  // 发送 prompt
536
605
  try {
537
- await client.send({ type: 'prompt', message: prompt })
606
+ if (!signal.aborted) await client.send({ type: 'prompt', message: this.promptWithToolAliases(prompt, scope) })
538
607
  }
539
608
  catch (err) {
609
+ this.clearTurnTools(scope)
610
+ unsubState()
540
611
  unsub()
612
+ unsubApprovals()
613
+ if (deltaTimer) clearTimeout(deltaTimer)
541
614
  signal.removeEventListener('abort', onAbort)
615
+ this.turnActive = false
616
+ this.streaming = false
617
+ this.toolState.currentTaskId = null
542
618
  // 僵死进程回收:prompt send 失败 = stdio 断裂或 60s 命令确认超时 —— 进程
543
619
  // "活着但不干活"(alive-but-wedged)。若仅报错不清理,消息重试(≤2 次)会
544
620
  // 复用同一僵死 stdio 每次空转 60s;必须杀掉并置空,下回合 ensureClient
545
621
  // 全新重生(host tools/模型/终端 tap 随重建)。
546
622
  log.warn(`[OmpRpcAgent:${this.selfAgentId}] prompt 失败 → 回收可疑僵死进程 pid=${client.pid}`)
547
623
  this.harnessRestartReason = 'PROMPT_FAIL'
548
- this.killProcess()
549
- this.client = null
624
+ this.retireSupervisionClient(client)
550
625
  this.hostToolsRegistered = false
551
626
  yield {
552
627
  kind: 'error',
@@ -562,8 +637,9 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
562
637
  try {
563
638
  while (!isDone || queue.length > 0) {
564
639
  if (queue.length === 0 && !isDone) {
640
+ const pendingApproval = approvalPending()
565
641
  const remaining = idleTimeoutMs - (Date.now() - lastActivity)
566
- if (remaining <= 0) {
642
+ if (remaining <= 0 && !pendingApproval) {
567
643
  client.send({ type: 'abort' }).catch(() => {})
568
644
  // 子进程大概率已僵死:击杀并清引用,下回合 ensureClient 全新重生
569
645
  this.harnessRestartReason = 'TURN_STALLED'
@@ -581,10 +657,12 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
581
657
  }
582
658
  await new Promise<void>((r) => {
583
659
  resolveWait = r
584
- stallTimer = setTimeout(() => {
585
- resolveWait = null
586
- r()
587
- }, remaining + 100)
660
+ if (!pendingApproval) {
661
+ stallTimer = setTimeout(() => {
662
+ resolveWait = null
663
+ r()
664
+ }, remaining + 100)
665
+ }
588
666
  })
589
667
  if (stallTimer) {
590
668
  clearTimeout(stallTimer)
@@ -598,6 +676,9 @@ export abstract class OmpRpcAgentImplToolsSteer extends OmpRpcAgentImplLifecycle
598
676
  }
599
677
  finally {
600
678
  if (stallTimer) clearTimeout(stallTimer)
679
+ if (deltaTimer) clearTimeout(deltaTimer)
680
+ unsubApprovals()
681
+ this.clearTurnTools(scope)
601
682
  // 事件监听必须全部解除:本 client 跨回合长期复用,残留的 mapOmpEvent
602
683
  // 闭包会在后续每一帧继续执行并把事件 push 进孤儿队列(内存/CPU 随
603
684
  // 回合数线性劣化,直接违背进程常驻的稳定性目标)
@@ -15,6 +15,7 @@ import { notifyLineOperators } from '../runtime/line-notify'
15
15
  import { getDcwController } from '../dcw/dcw-controller'
16
16
  import { recordRecipeOpAnchor } from '../dcw/recipe-op-anchor'
17
17
  import { assertRecipeOperation } from './industrial/recipe-gate'
18
+ import { currentExecutionScope, type ExecutionScope } from './execution-scope'
18
19
 
19
20
  export interface ToolApproval {
20
21
  id: string
@@ -60,18 +61,78 @@ class ToolApprovalService {
60
61
  remindTimers: NodeJS.Timeout[]
61
62
  /** 审批单归属产线(线域定向通知用;可空 = 推导不出) */
62
63
  lineId?: string
64
+ /** Trusted task execution scope captured at approval creation. */
65
+ executionScope?: ExecutionScope
66
+ removeAbortListener?: () => void
63
67
  }>()
64
68
 
65
69
  private history: ToolApproval[] = []
70
+ private approvalListeners = new Map<string, Set<() => void>>()
71
+
72
+ /** Notify watchdogs synchronously, including approvals completed between polling ticks. */
73
+ subscribeApprovalChanges(agentId: string, listener: () => void): () => void {
74
+ let listeners = this.approvalListeners.get(agentId)
75
+ if (!listeners) this.approvalListeners.set(agentId, listeners = new Set())
76
+ listeners.add(listener)
77
+ return () => {
78
+ listeners.delete(listener)
79
+ if (listeners.size === 0 && this.approvalListeners.get(agentId) === listeners) this.approvalListeners.delete(agentId)
80
+ }
81
+ }
82
+
83
+ private notifyApprovalChange(agentId: string): void {
84
+ for (const listener of [...(this.approvalListeners.get(agentId) ?? [])]) {
85
+ try {
86
+ listener()
87
+ }
88
+ catch { /* Observers must not interfere with approval settlement. */ }
89
+ }
90
+ }
91
+
92
+ private addPending(id: string, entry: NonNullable<ReturnType<typeof this.pending.get>>): void {
93
+ this.pending.set(id, entry)
94
+ if (entry.executionScope) {
95
+ const signal = entry.executionScope.signal
96
+ const onAbort = () => this.cancelEntry(id, '任务执行已中止,审批失效,指令未执行')
97
+ signal.addEventListener('abort', onAbort, { once: true })
98
+ entry.removeAbortListener = () => signal.removeEventListener('abort', onAbort)
99
+ }
100
+ this.notifyApprovalChange(entry.approval.agentId)
101
+ if (entry.executionScope?.signal.aborted) this.cancelEntry(id, '任务执行已中止,审批失效,指令未执行')
102
+ }
103
+
104
+ private removePending(id: string): NonNullable<ReturnType<typeof this.pending.get>> | undefined {
105
+ const entry = this.pending.get(id)
106
+ if (!entry) return undefined
107
+ this.pending.delete(id)
108
+ clearTimeout(entry.timer)
109
+ entry.remindTimers.forEach(clearTimeout)
110
+ entry.removeAbortListener?.()
111
+ this.notifyApprovalChange(entry.approval.agentId)
112
+ return entry
113
+ }
114
+
115
+ private cancelEntry(id: string, reason: string): boolean {
116
+ const entry = this.removePending(id)
117
+ if (!entry) return false
118
+ entry.approval.status = 'denied'
119
+ entry.approval.comment = reason
120
+ entry.approval.decidedAt = new Date().toISOString()
121
+ this.remember(entry.approval)
122
+ getHitlRegistry().resolve('dcw-approval', id, 'cancelled')
123
+ entry.resolve({ approved: false, comment: reason, id })
124
+ return true
125
+ }
66
126
 
67
127
  /** 挂起一次执行审批(工具侧 await;批准/拒绝/超时三向落定)。
68
128
  * opts.title 覆盖 HITL 待办标题(缺省 = 既有「XX 下发审批」,默认行为不变);
69
129
  * opts.timeoutMs 覆盖本单超时窗(expiresAt 与 timer 两处同源取值;缺省 = 全局 hitl_timeout_ms);
70
130
  * opts.payload 携带结构化审批载荷(随 pending/history 落库,前端渲染结构化审批卡)。
71
131
  * 不传 opts 的既有调用(param_control/manual-approval/recipe 门)行为不变。 */
72
- request(agentId: string, nodeId: string, kind: 'dcw' | 'daq' | 'kb', detail: string, opts?: { title?: string, timeoutMs?: number, payload?: unknown }): Promise<ToolApprovalDecision> {
132
+ request(agentId: string, nodeId: string, kind: 'dcw' | 'daq' | 'kb', detail: string, opts?: { title?: string, timeoutMs?: number, payload?: unknown, executionScope?: ExecutionScope }): Promise<ToolApprovalDecision> {
73
133
  // hold 模式(手动生产语义):审批不自动拒、周期催办;显式传 timeoutMs 的调用方
74
134
  // (整包方案 30min)同样被 hold 覆盖 —— 真人在环时"等人"优先于"限时"。
135
+ const executionScope = opts?.executionScope ?? currentExecutionScope()
75
136
  const hold = securityHitlTimeoutMode() === 'hold'
76
137
  const timeoutMs = hold ? 0 : (opts?.timeoutMs ?? TIMEOUT_MS())
77
138
  const approval: ToolApproval = {
@@ -147,7 +208,7 @@ class ToolApprovalService {
147
208
  }
148
209
  const remindTimer = setInterval(remind, REMIND_EVERY_MS)
149
210
  remindTimer.unref?.()
150
- this.pending.set(approval.id, { approval, resolve, remindTimers: [remindTimer], ...(lineId ? { lineId } : {}) })
211
+ this.addPending(approval.id, { approval, resolve, remindTimers: [remindTimer], ...(lineId ? { lineId } : {}), ...(executionScope ? { executionScope } : {}) })
151
212
  return
152
213
  }
153
214
  // 未读升级(2026-10-05 评审):此前超时=静默 approved:false —— 「人没看到→自动拒绝」。
@@ -182,25 +243,40 @@ class ToolApprovalService {
182
243
  const remindTimers = [remindAt(0.5), remindAt(0.85)]
183
244
  const timer = setTimeout(() => {
184
245
  remindTimers.forEach(clearTimeout)
185
- if (!this.pending.has(approval.id)) return
186
- this.pending.delete(approval.id)
246
+ // 到期权威收口(2026-11-16 复现回归):过去先查 pending 表,表项被其它路径
247
+ // (熔断收口/取消/重装)提前摘除时这里直接 return,审批单永久悬挂在
248
+ // status=pending、无任何终态通告。现在以审批单自身状态为准:仍是 pending
249
+ // 就必须在此落定 expired,无论 pending 表还认不认它。
250
+ if (approval.status !== 'pending') return
251
+ this.removePending(approval.id)
187
252
  approval.status = 'expired'
188
253
  approval.decidedAt = new Date().toISOString()
189
254
  approval.comment = '审批超时未处理,默认拒绝,指令未执行'
190
255
  this.remember(approval)
191
256
  getHitlRegistry().resolve('dcw-approval', approval.id, 'expired')
257
+ // 超时终态必须可观测:此前只发 50%/85% 预警,真正的"已自动拒绝"不落任何
258
+ // 通告 —— 频道/线域对结果失明(实测:卡被摘除后 1 小时才在对账里看到 failed)。
259
+ const expiredSummary = `审批 ${approval.id}(${opts?.title ?? approval.nodeId})超过时限未裁决,已按默认拒绝收口,指令未执行。`
260
+ try {
261
+ sendHitlNote({ agentId: approval.agentId, title: '⛔ 审批已超时自动拒绝', summary: expiredSummary })
262
+ }
263
+ catch { /* 通知失败不影响审批主流程 */ }
264
+ if (lineId) {
265
+ notifyLineOperators(lineId, {
266
+ eventId: `hitl_expired:dcw-approval:${approval.id}`,
267
+ title: '⛔ 审批已超时自动拒绝',
268
+ body: expiredSummary,
269
+ hitlKind: 'dcw-approval',
270
+ hitlId: approval.id,
271
+ })
272
+ }
192
273
  resolve({ approved: false, comment: approval.comment, id: approval.id })
193
274
  }, timeoutMs)
194
275
  // 不 unref:审批 Promise 的完成依赖此计时器。调用方(Agent 回合/插件/测试)
195
276
  // 在等待期间可能没有其它活跃句柄;unref 会让事件循环提前清空 → 超时不触发、
196
277
  // Promise 永久 pending(Node 报 "event loop has already resolved")。
197
278
  // 计时器在 decide/cancelPendingFor/超时路径均 clearTimeout,不会泄漏。
198
- const prevEntry = this.pending.get(approval.id)
199
- if (prevEntry) {
200
- // 幂等重复 request:清掉旧提醒(原实现同样覆盖 timer)
201
- prevEntry.remindTimers?.forEach(clearTimeout)
202
- }
203
- this.pending.set(approval.id, { approval, resolve, timer, remindTimers, ...(lineId ? { lineId } : {}) })
279
+ this.addPending(approval.id, { approval, resolve, timer, remindTimers, ...(lineId ? { lineId } : {}), ...(executionScope ? { executionScope } : {}) })
204
280
  })
205
281
  }
206
282
 
@@ -225,10 +301,18 @@ class ToolApprovalService {
225
301
  decide(id: string, approved: boolean, comment: string, decidedBy = '', decidedName = '', choice?: number): ToolApproval {
226
302
  const entry = this.pending.get(id)
227
303
  if (!entry) throw new Error(`审批不存在或已处理: ${id}`)
304
+ if (approved && entry.executionScope) {
305
+ try {
306
+ if (entry.executionScope.signal.aborted) throw new Error('task execution aborted')
307
+ entry.executionScope.assertActive()
308
+ }
309
+ catch {
310
+ this.cancelEntry(id, '任务执行已失效,审批按拒绝收敛,指令未执行')
311
+ throw new Error(`审批不存在或已处理: ${id} (任务执行已失效)`)
312
+ }
313
+ }
228
314
  const choiceNorm = Number.isInteger(choice) ? (choice as number) : null
229
- clearTimeout(entry.timer)
230
- entry.remindTimers.forEach(clearTimeout)
231
- this.pending.delete(id)
315
+ this.removePending(id)
232
316
  entry.approval.status = approved ? 'approved' : 'denied'
233
317
  entry.approval.comment = String(comment ?? '').trim()
234
318
  entry.approval.choice = choiceNorm
@@ -276,14 +360,7 @@ class ToolApprovalService {
276
360
  let n = 0
277
361
  for (const [id, entry] of [...this.pending.entries()]) {
278
362
  if (entry.approval.agentId !== agentId || entry.approval.nodeId !== nodeId) continue
279
- clearTimeout(entry.timer)
280
- this.pending.delete(id)
281
- entry.approval.status = 'denied'
282
- entry.approval.comment = '绑定已解除,审批失效'
283
- entry.approval.decidedAt = new Date().toISOString()
284
- this.remember(entry.approval)
285
- getHitlRegistry().resolve('dcw-approval', id, 'cancelled')
286
- entry.resolve({ approved: false, comment: entry.approval.comment, id })
363
+ if (!this.cancelEntry(id, '绑定已解除,审批失效')) continue
287
364
  // 附言可能再也到不了 Agent(回合已死):平台通告补送,人机交互不因链路断裂丢话
288
365
  sendHitlNote({
289
366
  agentId,
@@ -352,19 +429,26 @@ class ToolApprovalService {
352
429
  const notes: string[] = []
353
430
  for (const [id, entry] of [...this.pending.entries()]) {
354
431
  if (entry.approval.agentId !== agentId) continue
355
- clearTimeout(entry.timer)
356
- this.pending.delete(id)
357
- entry.approval.status = 'denied'
358
- entry.approval.comment = reason
359
- entry.approval.decidedAt = new Date().toISOString()
360
- this.remember(entry.approval)
361
- getHitlRegistry().resolve('dcw-approval', id, 'cancelled')
362
- entry.resolve({ approved: false, comment: reason, id })
432
+ if (!this.cancelEntry(id, reason)) continue
363
433
  notes.push(`${entry.approval.kind.toUpperCase()} 审批 ${id}(${entry.approval.detail})已按拒绝收敛,指令未执行`)
364
434
  }
365
435
  return notes
366
436
  }
367
437
 
438
+ /** Cancel approvals belonging to one task, preserving unrelated approvals for the same agent. */
439
+ cancelPendingForTask(taskId: string, reason: string, scope?: { agentId?: string, assignmentGeneration?: number, executionLeaseId?: string }): number {
440
+ let n = 0
441
+ for (const [id, entry] of [...this.pending.entries()]) {
442
+ const execution = entry.executionScope
443
+ if (execution?.taskId !== taskId
444
+ || (scope?.agentId !== undefined && execution.agentId !== scope.agentId)
445
+ || (scope?.assignmentGeneration !== undefined && execution.assignmentGeneration !== scope.assignmentGeneration)
446
+ || (scope?.executionLeaseId !== undefined && execution.executionLeaseId !== scope.executionLeaseId)) continue
447
+ if (this.cancelEntry(id, reason)) n++
448
+ }
449
+ return n
450
+ }
451
+
368
452
  /** 同一 Agent 同一节点的挂起审批去重:已有 pending 时拒绝新挂起(防审批面板堆积) */
369
453
  hasPendingFor(agentId: string, nodeId: string): boolean {
370
454
  for (const entry of this.pending.values()) {