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
@@ -17,6 +17,7 @@ import { nodeSemanticCards, recipeOperationFace } from '../industrial-context'
17
17
  import { requestManualApproval } from './manual-approval'
18
18
  import { guardTwinWrite } from '../../aml/twin/write-guard'
19
19
  import { executionModeOfChannel, observeWriteRejectedText } from '../execution-mode'
20
+ import { currentExecutionScope } from '../execution-scope'
20
21
 
21
22
  export async function toolMyIndustrialNodes(agentId: string): Promise<{ text: string }> {
22
23
  const repo = getAgentNodeBindingRepo()
@@ -116,14 +117,18 @@ export async function toolDcwControl(agentId: string, args: { node_id?: string,
116
117
  * 仍允许**平台内部治理工具**复用:optimization_explore(工艺优化 Channel 的闭环探索,
117
118
  * profile 门控)的写入委托它执行 —— Agent 可调用面依然收敛在配方面,此处非 Agent 入口。
118
119
  */
119
- export async function dcwControlGovernedInternal(agentId: string, args: { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId?: string): Promise<{ text: string, isError?: boolean }> {
120
- return dcwControlGovernedLegacy(agentId, args, channelId)
120
+ export async function dcwControlGovernedInternal(agentId: string, args: { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId?: string): Promise<{ text: string, isError?: boolean, dispatch: 'not_dispatched' | 'indeterminate' | 'accepted' }> {
121
+ let driverStarted = false
122
+ const result = await dcwControlGovernedLegacy(agentId, args, channelId, () => {
123
+ driverStarted = true
124
+ })
125
+ return { ...result, dispatch: result.isError ? (driverStarted ? 'indeterminate' : 'not_dispatched') : 'accepted' }
121
126
  }
122
127
 
123
128
  /** v2 前的直写实现(治理链完整:四层限界/HITL/60s 联锁/journal/open 记录)。
124
129
  * 非任何 Agent 工具入口 —— 仅由 dcwControlGovernedInternal 承载平台内部治理写
125
130
  * (optimization_explore 闭环探索的写入委托),Agent 可调用面依然收敛在配方面。 */
126
- async function dcwControlGovernedLegacy(agentId: string, args: { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId?: string): Promise<{ text: string, isError?: boolean }> {
131
+ async function dcwControlGovernedLegacy(agentId: string, args: { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId?: string, onDriverStart?: () => void): Promise<{ text: string, isError?: boolean }> {
127
132
  const twinGuard = guardTwinWrite(agentId, channelId)
128
133
  if (!twinGuard.allowed) return { text: `${twinGuard.code}: ${twinGuard.message}`, isError: true }
129
134
  // 频道执行模式(2026-10-28 三模式计划 M2/M3):observe 兜底拒写(分发守卫之外的第二道
@@ -240,13 +245,16 @@ async function dcwControlGovernedLegacy(agentId: string, args: { node_id?: strin
240
245
  }
241
246
  }
242
247
 
248
+ let driverStarted = false
249
+ const executionScope = currentExecutionScope()
243
250
  try {
251
+ executionScope?.assertActive()
244
252
  const meta = {
245
253
  source: 'agent' as const,
246
254
  actor: agentId,
247
255
  // 人话操作者:「Channel名/成员名」——/logs 来源=Agent 与用户/系统操作可区分追溯
248
256
  actorName: agentBadgeLabel(agentId),
249
- taskId: args.task_id ? String(args.task_id) : undefined,
257
+ taskId: executionScope?.taskId,
250
258
  hypothesis: args.hypothesis ? String(args.hypothesis) : '',
251
259
  approvalId: approvalId || undefined,
252
260
  // v34 干预台账归因:写入发生时所在 Channel(台账 path/channel 维度)
@@ -254,7 +262,11 @@ async function dcwControlGovernedLegacy(agentId: string, args: { node_id?: strin
254
262
  // 台账口径(三模式):该次写入发生时的频道生效执行模式(事后审计"这条写入当时是什么模式")
255
263
  executionMode: execMode,
256
264
  }
257
- const outcome = await getDcwController().write(nodeId, value, null, meta)
265
+ const outcome = await getDcwController().write(nodeId, value, null, meta, executionScope, () => {
266
+ driverStarted = true
267
+ onDriverStart?.()
268
+ })
269
+ executionScope?.assertActive()
258
270
  const run = node.lineId ? getActiveLineRun(node.lineId) : null
259
271
  const winTxt = run
260
272
  ? `当前活动配方「${run.recipeName}」`
@@ -293,6 +305,16 @@ async function dcwControlGovernedLegacy(agentId: string, args: { node_id?: strin
293
305
  }
294
306
  catch (err) {
295
307
  const msg = err instanceof Error ? err.message : String(err)
308
+ let inactive = false
309
+ try {
310
+ executionScope?.assertActive()
311
+ }
312
+ catch {
313
+ inactive = true
314
+ }
315
+ if (driverStarted) {
316
+ return { text: `${inactive ? '执行租约失效' : '写入过程异常'}:写入已进入驱动,设备状态不确定,请立即核实后再决定是否重试。${msg}`, isError: true }
317
+ }
296
318
  const retryHint = /忙|busy/i.test(msg) ? '链路忙属瞬时状态,可稍后重试' : '设定值必须落在安全量程与活动配方工艺窗口内'
297
319
  return { text: `下发被拒绝:${msg}(节点 ${node.name},物理量 ${tpl?.ch ?? node.templateKey};${retryHint})`, isError: true }
298
320
  }
@@ -11,6 +11,7 @@
11
11
  import { getToolApprovals } from '../tool-approvals'
12
12
  import { agentBadgeLabel } from '../agent-badge'
13
13
  import { currentToolInvocation } from '../governance-harness-audit'
14
+ import { currentExecutionScope } from '../execution-scope'
14
15
  import { getDcwController } from '../../dcw/dcw-controller'
15
16
  import { getDcwLineRepo } from '../../dcw/dcw-line.repo'
16
17
  import { recordOps } from '../../ops/ops'
@@ -22,6 +23,8 @@ export interface LineStatusInput { line_id?: string }
22
23
 
23
24
  /** 懒加载 manager:静态 import plugins/workshop 会拖入 Nitro #imports,使本模块无法被单测/脚本直接加载 */
24
25
  async function workshopManager() {
26
+ const manager = globalThis.__workshopManager
27
+ if (manager) return manager
25
28
  const { getWorkshopManager } = await import('@/server/plugins/workshop')
26
29
  return getWorkshopManager()
27
30
  }
@@ -116,6 +119,7 @@ export async function toolLineStart(agentId: string, args: LineStartInput, chann
116
119
  try {
117
120
  // 归因:line_start 的逐参数写入必须携带频道/任务锚点,否则干预台账 channel 为空,
118
121
  // C1 独立回读的任务终态补扫(按 channel 取 pending)永远看不到这批写入。
122
+ currentExecutionScope()?.assertActive()
119
123
  const invocation = currentToolInvocation()
120
124
  const run = await ctrl.lineStart(lineId, recipeId, {
121
125
  source: 'recipe',
@@ -123,10 +127,16 @@ export async function toolLineStart(agentId: string, args: LineStartInput, chann
123
127
  actorName: agentBadgeLabel(agentId),
124
128
  channelId: channelId ?? '',
125
129
  ...(invocation?.taskId ? { taskId: invocation.taskId } : {}),
126
- })
130
+ }, currentExecutionScope())
131
+ try {
132
+ currentExecutionScope()?.assertActive()
133
+ }
134
+ catch {
135
+ return { text: `开线批次 ${run.id} 执行后租约失效,设备可能已变化;请立即核实产线与设备状态。${run.results.map(r => `${r.nodeId ?? r.templateRef}:${r.message}`).join(';')}`, isError: true }
136
+ }
127
137
  const results = run.results ?? []
128
- const failed = results.filter(r => !r.ok)
129
- const unverified = results.filter(r => r.ok && r.verify?.verdict !== 'verified' && r.ack !== 'readback-verified')
138
+ const failed = results.filter(r => !r.ok && r.verify?.verdict !== 'unverified')
139
+ const unverified = results.filter(r => r.verify?.verdict === 'unverified' || (r.ok && r.verify?.verdict !== 'verified' && r.ack !== 'readback-verified'))
130
140
  const detailOf = (r: typeof results[number]): string => {
131
141
  const node = r.nodeId ? ctrl.byId(r.nodeId) : undefined
132
142
  return `${node?.name ?? r.templateRef ?? r.nodeId ?? '?'}: ${String(r.message).slice(0, 100)}`
@@ -207,7 +217,7 @@ export async function toolLineStart(agentId: string, args: LineStartInput, chann
207
217
  const parts = [
208
218
  `产线「${lineName}」已开跑(批次 ${run.id.slice(0, 8)},配方「${recipe.name}」),但参数下发未全部证实${acks ? `(证实 ${acks.verified}/${acks.total},未证实 ${acks.unverified},失败 ${acks.failed})` : ''}:`,
209
219
  ...(failed.length > 0 ? [`失败参数:`, ...failed.map(r => ` - ${detailOf(r)}`)] : []),
210
- ...(unverified.length > 0 ? [`未证实参数(命令已受理,设备侧未确认):`, ...unverified.map(r => ` - ${detailOf(r)}`)] : []),
220
+ ...(unverified.length > 0 ? [`未证实参数(可能已下发,设备状态须核实):`, ...unverified.map(r => ` - ${detailOf(r)}`)] : []),
211
221
  '请先用 daq_query 复测实际工况;未生效参数需人工处置或 line_stop 后重试,禁止把本次开线当作全量生效。',
212
222
  ]
213
223
  return { text: parts.join('\n'), isError: true }
@@ -268,6 +278,7 @@ export async function toolLineStop(agentId: string, args: LineStopInput, channel
268
278
  }
269
279
  }
270
280
  try {
281
+ currentExecutionScope()?.assertActive()
271
282
  const run = ctrl.lineStop(lineId)
272
283
  try {
273
284
  recordOps({
@@ -24,6 +24,7 @@ import { assertRecipeCreate, assertRecipeOperation, recipeApprovalPayload, type
24
24
  import { RECOVERY_RETRY_HINT, RECOVERY_TRACE_HINT, RECOVERY_VERIFY_HINT } from './fallback-hints'
25
25
  import { approvalOnlyTrialReceipt, sameApprovalOnlyTrialReceipt, type ApprovalOnlyTrialReceipt } from './bench-approval-only'
26
26
  import { currentToolInvocation } from '../governance-harness-audit'
27
+ import { currentExecutionScope } from '../execution-scope'
27
28
  import { executionModeOfAgent } from '../execution-mode'
28
29
  import { getAmlRuntime } from '../../aml/runtime'
29
30
  import { markRecipeProposalsAccepted } from '../../db/improvement.repo'
@@ -682,6 +683,7 @@ export async function toolRecipeCreate(agentId: string, args: {
682
683
  if (!again.ok) return { text: `人工已批准,但审批期间授权已失效,本次未创建:${again.text}`, isError: true }
683
684
  }
684
685
  try {
686
+ currentExecutionScope()?.assertActive()
685
687
  const created = getDcwController().createRecipe({
686
688
  name,
687
689
  productId,
@@ -908,6 +910,7 @@ export async function toolRecipeUpdate(agentId: string, args: {
908
910
  const extra = list.filter(p => !recipe.params.some(x => x.nodeId === String(p.node_id).trim()))
909
911
  for (const p of extra) merged.push({ nodeId: String(p.node_id).trim(), value: Number(p.value) })
910
912
  try {
913
+ currentExecutionScope()?.assertActive()
911
914
  const updated = getDcwController().updateRecipe(recipeId, { params: merged }, {
912
915
  by: 'agent',
913
916
  actorName: agentBadgeLabel(agentId),
@@ -993,6 +996,7 @@ export async function toolRecipeRollback(agentId: string, args: {
993
996
  if (latestSessionRecipe) return latestSessionRecipe
994
997
  }
995
998
  try {
999
+ currentExecutionScope()?.assertActive()
996
1000
  const finalSessionRecipe = sessionRecipeError(sessionScope, getDcwRecipeRepo().byId(recipeId) ?? recipe)
997
1001
  if (finalSessionRecipe) return finalSessionRecipe
998
1002
  if (dispatch) {
@@ -1009,8 +1013,15 @@ export async function toolRecipeRollback(agentId: string, args: {
1009
1013
  description: reason,
1010
1014
  agentDispatch: true,
1011
1015
  agentApprovalId: gateApprovalId,
1016
+ executionScope: currentExecutionScope(),
1012
1017
  emergency,
1013
1018
  })
1019
+ try {
1020
+ currentExecutionScope()?.assertActive()
1021
+ }
1022
+ catch {
1023
+ return { text: `回退定义已处理,批次 ${run.id} 执行后租约失效,设备可能已变化,请核实配方和设备状态。${run.results.map(r => `${r.nodeId ?? r.templateRef}:${r.message}`).join(';')}`, isError: true }
1024
+ }
1014
1025
  const okN = run.results.filter(r => r.ok).length
1015
1026
  const acks = run.ackSummary ?? { verified: okN, unverified: 0, failed: run.results.length - okN, total: run.results.length }
1016
1027
  const defNote = definitionNoop
@@ -1018,7 +1029,7 @@ export async function toolRecipeRollback(agentId: string, args: {
1018
1029
  : `已生成 v${updated.version ?? 1}`
1019
1030
  // 整批重下发全部失败(典型:节点写入保持窗/节流未放行)→ 响亮失败:定义已回退但产线仍运行
1020
1031
  // 旧参数,Agent 必须知道并稍后重发(再调本工具会再生成一个回退版本,或按 RECOVERY_RETRY_HINT 整批重试)。
1021
- if (run.results.length > 0 && okN === 0) {
1032
+ if (run.results.length > 0 && okN === 0 && acks.unverified === 0) {
1022
1033
  return {
1023
1034
  text: `回退部分失败:配方「${updated.name}」${defNote},但整批重下发 0/${run.results.length} 参数成功(节点写入保持窗/节流未放行)。产线仍在运行旧参数 —— ${RECOVERY_RETRY_HINT}(回退目标 v${updated.version ?? 1});原因:${reason}。`,
1024
1035
  isError: true,
@@ -1102,6 +1113,7 @@ async function hitlDispatchGate(agentId: string, recipeId: string, detail: strin
1102
1113
  title,
1103
1114
  ...(opts?.payload !== undefined ? { payload: opts.payload } : {}),
1104
1115
  ...(timeoutMs ? { timeoutMs } : {}),
1116
+ ...(currentExecutionScope() ? { executionScope: currentExecutionScope() } : {}),
1105
1117
  })
1106
1118
  return { approved: decision.approved, comment: decision.comment, id: decision.id }
1107
1119
  }
@@ -1198,7 +1210,7 @@ export async function revalidateApprovedAction(
1198
1210
  // Grant lookup is asynchronous. Re-read the active tuple after that await so
1199
1211
  // queued line/run changes cannot pass between the initial comparison and the
1200
1212
  // caller's dispatch continuation.
1201
- const changedAfterGrantCheck = approvedContextError(agentId, recipe, op, expectedContext, targetNodeIds, approvalBypassed)
1213
+ const changedAfterGrantCheck = approvedContextError(agentId, recipe, op, expectedContext, targetNodeIds, approvalBypassed, expectedDefinition)
1202
1214
  if (changedAfterGrantCheck) return changedAfterGrantCheck
1203
1215
  return null
1204
1216
  }
@@ -1384,6 +1396,7 @@ export async function toolRecipeTrial(agentId: string, args: {
1384
1396
  const invocation = currentToolInvocation()
1385
1397
  const run = await getDcwController().applyRecipe(recipeId, {
1386
1398
  overrides: list, trial: true, agentDispatch: true, agentApprovalId: gateApprovalId, emergency,
1399
+ ...(currentExecutionScope() ? { executionScope: currentExecutionScope() } : {}),
1387
1400
  agentTrialMeta: {
1388
1401
  actor: agentId, actorName: agentBadgeLabel(agentId), hypothesis,
1389
1402
  channelId: invocation?.channelId || channelIdOfAgent(agentId),
@@ -1405,6 +1418,12 @@ export async function toolRecipeTrial(agentId: string, args: {
1405
1418
  })
1406
1419
  }
1407
1420
  catch { /* 审计失败不影响试验结果 */ }
1421
+ try {
1422
+ currentExecutionScope()?.assertActive()
1423
+ }
1424
+ catch {
1425
+ return { text: `试验批次 ${run.id} 执行后租约失效,设备可能已变化,请核实批次结果与设备状态。${run.results.map(r => `${r.nodeId ?? r.templateRef}:${r.message}`).join(';')}`, isError: true, ...(approvalBypassed ? { approval_bypassed: true as const } : {}) }
1426
+ }
1408
1427
  const ackTagOf = (r: typeof run.results[number]): string => {
1409
1428
  if (!r.ok) return ''
1410
1429
  return r.verify?.verdict === 'verified' || r.ack === 'readback-verified' ? ' [证实✓]' : ' [未证实⚠]'
@@ -1412,7 +1431,7 @@ export async function toolRecipeTrial(agentId: string, args: {
1412
1431
  const changed = run.results.map((r) => {
1413
1432
  const node = r.nodeId ? getDcwController().byId(r.nodeId) : undefined
1414
1433
  const reason = r.ok ? '' : `(${String(r.message).slice(0, 60)})`
1415
- return `${node?.name ?? r.templateRef}→${r.value}${node?.unit ?? ''}${ackTagOf(r)}${r.ok ? '' : ` 被拒${reason}`}`
1434
+ return `${node?.name ?? r.templateRef}→${r.value}${node?.unit ?? ''}${ackTagOf(r)}${r.ok ? '' : r.verify?.verdict === 'unverified' ? ` 状态不确定${reason}` : ` 被拒${reason}`}`
1416
1435
  }).join(';')
1417
1436
  // 未证实/失败一律 isError(ACK 鉴定铁律:不许把"仅链路受理"报成试验成功)
1418
1437
  if (acks.failed > 0 || acks.unverified > 0) {
@@ -1520,6 +1539,7 @@ export async function toolRecipeApply(agentId: string, args: {
1520
1539
  agentDispatch: true,
1521
1540
  agentApprovalId: gateApprovalId,
1522
1541
  emergency,
1542
+ ...(currentExecutionScope() ? { executionScope: currentExecutionScope() } : {}),
1523
1543
  agentTrialMeta: {
1524
1544
  actor: agentId,
1525
1545
  actorName: agentBadgeLabel(agentId),
@@ -1532,19 +1552,19 @@ export async function toolRecipeApply(agentId: string, args: {
1532
1552
  const acks = run.ackSummary ?? { verified: run.results.filter(r => r.ok).length, unverified: 0, failed: run.results.filter(r => !r.ok).length, total: run.results.length }
1533
1553
  // 逐参数标注:被跳过/失败的参数(节点停用/已删除/限界拒绝)必须透出给 Agent,
1534
1554
  // 否则回包只见 N/N 成功数,无法定位哪些参数未生效(与 recipe_trial 的逐参数渲染同口径)。
1535
- const skipped = run.results.filter(r => !r.ok)
1555
+ const skipped = run.results.filter(r => !r.ok && r.verify?.verdict !== 'unverified')
1536
1556
  .map((r) => {
1537
1557
  const node = r.nodeId ? getDcwController().byId(r.nodeId) : undefined
1538
1558
  return `${node?.name ?? r.templateRef ?? r.nodeId ?? '?'}: ${String(r.message).slice(0, 80)}`
1539
1559
  })
1540
1560
  // 未证实参数(ok 但仅链路受理)单独点名 —— 这正是"参数真实正确下发"要堵的盲区
1541
- const unverified = run.results.filter(r => r.ok && r.verify?.verdict !== 'verified' && r.ack !== 'readback-verified')
1561
+ const unverified = run.results.filter(r => r.verify?.verdict === 'unverified' || (r.ok && r.verify?.verdict !== 'verified' && r.ack !== 'readback-verified'))
1542
1562
  .map((r) => {
1543
1563
  const node = r.nodeId ? getDcwController().byId(r.nodeId) : undefined
1544
1564
  return `${node?.name ?? r.templateRef ?? r.nodeId ?? '?'}: ${String(r.message).slice(0, 100)}`
1545
1565
  })
1546
1566
  const skippedNote = skipped.length > 0 ? `\n未生效参数(${skipped.length}):\n - ${skipped.join('\n - ')}` : ''
1547
- const unverifiedNote = unverified.length > 0 ? `\n未证实参数(${unverified.length};命令已受理但设备侧未确认):\n - ${unverified.join('\n - ')}` : ''
1567
+ const unverifiedNote = unverified.length > 0 ? `\n未证实参数(${unverified.length};可能已下发,设备状态须核实):\n - ${unverified.join('\n - ')}` : ''
1548
1568
  try {
1549
1569
  const { recordOps } = await import('../../ops/ops')
1550
1570
  recordOps({
@@ -1556,6 +1576,12 @@ export async function toolRecipeApply(agentId: string, args: {
1556
1576
  })
1557
1577
  }
1558
1578
  catch { /* 审计失败不影响下发结果 */ }
1579
+ try {
1580
+ currentExecutionScope()?.assertActive()
1581
+ }
1582
+ catch {
1583
+ return { text: `配方批次 ${run.id} 执行后租约失效,设备可能已变化,请核实批次结果与设备状态。${run.results.map(r => `${r.nodeId ?? r.templateRef}:${r.message}`).join(';')}`, isError: true }
1584
+ }
1559
1585
  if (acks.failed > 0 || acks.unverified > 0) {
1560
1586
  return {
1561
1587
  text: [
@@ -23,6 +23,7 @@ import { resolveRefFaces } from './tool-verify'
23
23
  import { assessIdentifiability } from '../../aml/identifiability'
24
24
  import { attachExplorationVerdict, explorationIdentifiabilityPreflight, identGateEnabled, identifiabilityLearningText, periodHintFromSeries, readTargetWindow } from './identifiability-tools'
25
25
  import { preDispatchCrossCheck } from '../../aml/twin/cross-check-service'
26
+ import { currentExecutionScope } from '../execution-scope'
26
27
 
27
28
  const sleep = (ms: number) => new Promise(r => setTimeout(r, ms))
28
29
 
@@ -67,7 +68,18 @@ export async function toolOptimizationExplore(agentId: string, args: {
67
68
  const tuneMin = binding?.tuning?.min ?? node.min
68
69
  const tuneMax = binding?.tuning?.max ?? node.max
69
70
  const direction = args.direction === 'down' ? -1 : 1
70
- const controlBefore = Number(node.value ?? 0)
71
+ // u0 退化角修复(2026-11-17 fresh 环境 100% 复现):供给清值后 node.value=null,
72
+ // 旧逻辑 Number(node.value ?? 0)=0 → 提议值钳到量程下缘 → 步限 fail-closed。
73
+ // 改为「先读后探」:优先最近回读值,再实时只读回读锚定;都不可得才拒绝并给行动指引。
74
+ let controlBefore = node.value != null ? Number(node.value) : Number.NaN
75
+ if (!Number.isFinite(controlBefore) && node.readValue != null) controlBefore = Number(node.readValue)
76
+ if (!Number.isFinite(controlBefore)) {
77
+ const probe = await getDcwController().readNow(controlNodeId).catch(() => null)
78
+ controlBefore = probe?.ok && probe.value != null ? Number(probe.value) : Number.NaN
79
+ }
80
+ if (!Number.isFinite(controlBefore)) {
81
+ return { text: `控制节点 ${controlNodeId} 无可用锚定值(value 与回读均为空,实时回读失败);请先由用户写入一次基线值(如 owner 直写)或检查驱动连通后重试探索。`, isError: true }
82
+ }
71
83
  const proposed = controlBefore + direction * step
72
84
  const target = Math.min(tuneMax, Math.max(tuneMin, proposed))
73
85
  const clamped = Math.abs(target - proposed) > 1e-9
@@ -133,13 +145,23 @@ export async function toolOptimizationExplore(agentId: string, args: {
133
145
  hypothesis: args.hypothesis ?? `探索激励(${direction > 0 ? 'up' : 'down'} ${Number(step).toFixed(3)};goal=${goalText.slice(0, 120)})`,
134
146
  }, channelId)
135
147
  const writeOk = !write.isError
148
+ if (writeOk) {
149
+ try {
150
+ currentExecutionScope()?.assertActive()
151
+ }
152
+ catch {
153
+ return { text: `探索写入已进入驱动,任务租约失效,设备状态须核实;未继续采样或判读。\n${write.text}`, isError: true }
154
+ }
155
+ }
136
156
 
137
157
  let targetAfter: number | null = null
138
158
  let verdictText = ''
139
159
  if (writeOk) {
140
160
  await sleep(settleSec * 1000)
161
+ currentExecutionScope()?.assertActive()
141
162
  // 写后窗(=settle 窗):一次取数同时取均值与序列(与写前窗对称)
142
163
  const postWindow = await readTargetWindow(targetNodeId, writeAtMs, Date.now())
164
+ currentExecutionScope()?.assertActive()
143
165
  targetAfter = postWindow.mean
144
166
  // P1 判读:前后窗完整序列交给可辨识性引擎(不再以单点差分作因果依据),
145
167
  // 判定回填干预台账(intervention_events);序列不足时 verdictText 空 → 中性文案,不外推。
@@ -165,7 +187,7 @@ export async function toolOptimizationExplore(agentId: string, args: {
165
187
  targetAfter,
166
188
  direction: direction > 0 ? 'up' : 'down',
167
189
  hypothesis: String(args.hypothesis ?? ''),
168
- writeStatus: writeOk ? 'ok' : 'rejected',
190
+ writeStatus: writeOk ? 'ok' : write.dispatch === 'not_dispatched' ? 'rejected' : 'failed',
169
191
  writeMessage: write.text.slice(0, 400),
170
192
  }
171
193
  try {
@@ -174,11 +196,13 @@ export async function toolOptimizationExplore(agentId: string, args: {
174
196
  .run(record.id, record.channelId, record.agentId, record.goalJson, record.controlNodeId, record.controlBefore, record.controlAfter, record.controlStep, record.targetNodeId, record.targetBefore, record.targetAfter, record.direction, record.hypothesis, record.writeStatus, record.writeMessage, new Date().toISOString())
175
197
  }
176
198
  catch (err) {
177
- return { text: `探索步已执行但记录落库失败:${err instanceof Error ? err.message : String(err)}\n\n${write.text}`, isError: writeOk ? undefined : true }
199
+ return { text: `探索记录落库失败:${err instanceof Error ? err.message : String(err)}\n\n${write.text}`, isError: true }
178
200
  }
179
201
 
180
202
  if (!writeOk) {
181
- return { text: `探索步被拒绝(未写入产线,已记录 rejected):\n${write.text}`, isError: true }
203
+ return write.dispatch === 'not_dispatched'
204
+ ? { text: `探索步被拒绝(未下发,已记录 rejected):\n${write.text}`, isError: true }
205
+ : { text: `探索步未获确认(已记录 failed,可能已下发;请核实设备状态):\n${write.text}`, isError: true }
182
206
  }
183
207
  const deltaTarget = targetAfter != null && targetBefore != null ? targetAfter - targetBefore : null
184
208
  const lines = [
@@ -30,6 +30,7 @@ import { GOVERNED_DISPATCH_HINT, RECOVERY_RETRY_HINT, RECOVERY_TRACE_HINT, RECOV
30
30
  import { amlActivityForLine } from './aml-activity'
31
31
  import { agentOpsScope, channelIdOfAgent, revalidateApprovedAction, sessionRecipeError } from './ops-tools'
32
32
  import { recipeEvidenceText } from '../../dcw/recipe-evidence'
33
+ import { currentExecutionScope } from '../execution-scope'
33
34
 
34
35
  /** 候选包上限(防审批卡被刷屏;1~3 套) */
35
36
  const MAX_PACKAGES = 3
@@ -275,6 +276,7 @@ export async function toolRecipePropose(agentId: string, args: {
275
276
  title: `整包方案审批:${recipe.name}`,
276
277
  timeoutMs: securityRecipeDispatchTimeoutMs(),
277
278
  payload,
279
+ ...(currentExecutionScope() ? { executionScope: currentExecutionScope() } : {}),
278
280
  })
279
281
  }
280
282
  catch (err) {
@@ -300,6 +302,20 @@ export async function toolRecipePropose(agentId: string, args: {
300
302
  const stale = await revalidateApprovedAction(agentId, recipe, 'dispatch', 'recipe_propose', { recipe_id: recipeId }, gate.activeContext)
301
303
  if (stale) return stale
302
304
 
305
+ const latestRecipe = getDcwController().listRecipes().find(r => r.id === recipeId)
306
+ if (!latestRecipe || (latestRecipe.version ?? 1) !== payload.recipeVersion
307
+ || JSON.stringify(latestRecipe.params.map(p => ({ nodeId: p.nodeId, value: p.value }))) !== JSON.stringify(payload.recipeParams)) {
308
+ return { text: '配方在授权复核期间已变更,本次未执行。请重新提交 recipe_propose。', isError: true }
309
+ }
310
+ const latestSessionBoundary = sessionRecipeError(sessionScope, latestRecipe)
311
+ if (latestSessionBoundary) return latestSessionBoundary
312
+ try {
313
+ currentExecutionScope()?.assertActive()
314
+ }
315
+ catch (err) {
316
+ return { text: `执行租约失效,方案未下发:${err instanceof Error ? err.message : String(err)}`, isError: true }
317
+ }
318
+
303
319
  // ---------- ⑦b 批准(choice 已由 decide 链 fail-closed 归一):选定包整批下发 ----------
304
320
  // 归一后的 decision.choice 必为合法下标(由 normalizeRecipeProposeDecision 保证;此处兜底防呆)
305
321
  const chosenIdx = decision.choice ?? 0
@@ -317,6 +333,7 @@ export async function toolRecipePropose(agentId: string, args: {
317
333
  agentDispatch: true,
318
334
  agentApprovalId: decision.id,
319
335
  emergency: args.emergency === true || args.emergency === 'true',
336
+ ...(currentExecutionScope() ? { executionScope: currentExecutionScope() } : {}),
320
337
  agentTrialMeta: {
321
338
  actor: agentId,
322
339
  actorName: agentBadgeLabel(agentId),
@@ -332,11 +349,17 @@ export async function toolRecipePropose(agentId: string, args: {
332
349
  return {
333
350
  text: [
334
351
  `方案「${chosen.name}」已获批准,但整批下发启动失败:${err instanceof Error ? err.message : String(err)}`,
335
- `产线未做任何变更;请等待节拍窗放行后重新提交 recipe_propose 整批下发本方案参数 —— ${GOVERNED_DISPATCH_HINT}。`,
352
+ `产线状态可能已变化,请核查执行记录与设备实际状态后再决定是否重试 —— ${GOVERNED_DISPATCH_HINT}。`,
336
353
  ].join('\n'),
337
354
  isError: true,
338
355
  }
339
356
  }
357
+ try {
358
+ currentExecutionScope()?.assertActive()
359
+ }
360
+ catch {
361
+ return { text: `方案批次 ${run.id} 执行后租约失效,设备可能已变化,请核实批次结果与设备状态。${run.results.map(r => `${r.nodeId ?? r.templateRef}:${r.message}`).join(';')}`, isError: true }
362
+ }
340
363
  // ---------- ⑦c ACK 鉴定回执(2026-10-08):三段口径 + 未证实/失败一律 isError ----------
341
364
  // 「ok」只是命令受理;回执按 设备证实(verified)/未证实(unverified)/失败(failed) 三段计,
342
365
  // 只要有 unverified 或 failed 就 isError —— Agent 必须如实知道哪个参数未获设备确认。
@@ -366,7 +389,7 @@ export async function toolRecipePropose(agentId: string, args: {
366
389
  const label = node?.name ?? r.templateRef ?? r.nodeId ?? '?'
367
390
  const spec = r.nodeId ? chosenByNode.get(r.nodeId) : undefined
368
391
  const change = spec ? `${spec.from ?? '?'}→${spec.to}` : `${r.value}(随批整发,本方案未改动)`
369
- return `- ${label} ${change}${node?.unit ?? ''}${ackTagOf(r)}${r.ok ? '' : ` 被拒:${String(r.message).slice(0, 80)}`}`
392
+ return `- ${label} ${change}${node?.unit ?? ''}${ackTagOf(r)}${r.ok ? '' : r.verify?.verdict === 'unverified' ? ` 状态不确定:${String(r.message).slice(0, 80)}` : ` 被拒:${String(r.message).slice(0, 80)}`}`
370
393
  })
371
394
  const feedback = decision.comment ? `\n[人工反馈] ${decision.comment}` : ''
372
395
  // RSI WP-D1:回执附证据链(批次成效由 verdict 聚合,取代"自行回访"的提示词纪律)
@@ -375,7 +398,7 @@ export async function toolRecipePropose(agentId: string, args: {
375
398
  ? `runId:${run.id}(后续轮次按此回访效果并回写经验)\n\n${evidenceBlock}`
376
399
  : `runId:${run.id}(后续轮次按此回访效果并回写经验)`
377
400
  // 全失败:响亮失败(isError;统一回退指引,口径 mirror recipe_trial/recipe_rollback)
378
- if (run.results.length > 0 && okN === 0) {
401
+ if (run.results.length > 0 && okN === 0 && acks.unverified === 0) {
379
402
  return {
380
403
  text: [
381
404
  `整包下发失败:方案「${chosen.name}」已获批准,但整批下发 0/${run.results.length} 参数成功(典型:节点写入保持窗/节流未放行)。${runIdNote}${feedback}`,
@@ -7,7 +7,6 @@ import type { AgentRunContext } from '../agent-interface'
7
7
  import { OmpRpcClient } from '../adapters/omp-rpc-client'
8
8
  import { attachTerminalTap, markTerminalSessionExit } from '../harness-terminal'
9
9
  import { bindHarnessProcess, markHarnessProcessExit, registerHarnessProcess } from '../harness-process'
10
- import { hostToolsForAgent } from '../host-tool-bridge'
11
10
 
12
11
  export abstract class OmpRpcAgentImplClient extends OmpRpcAgentImplEventMapping {
13
12
  protected async ensureClient(ctx: AgentRunContext): Promise<void> {
@@ -92,9 +91,8 @@ export abstract class OmpRpcAgentImplClient extends OmpRpcAgentImplEventMapping
92
91
  }
93
92
  }
94
93
 
95
- // 注册 host tools(按角色差异化:lead 全量,worker 剔除调度/团队管理专属工具)
94
+ // Tool definitions are registered with turn-specific aliases before each prompt.
96
95
  client.onHostToolCall(req => this.handleHostTool(req, client))
97
- await client.send({ type: 'set_host_tools', tools: hostToolsForAgent(this.selfAgentId, this.agentRole, this.channelId) })
98
96
 
99
97
  // 上下文治理探测(feature-detect 一次;失败退化被动 usage 跟踪)+ 原生压缩兜底保持开启
100
98
  // 会话身份(sessionId)也由 probeContext 取回:必须 **await** —— fire-and-forget 会与
@@ -107,7 +105,7 @@ export abstract class OmpRpcAgentImplClient extends OmpRpcAgentImplEventMapping
107
105
  void client.send({ type: 'set_auto_compaction', enabled: true }).catch(() => {})
108
106
 
109
107
  this.client = client
110
- this.hostToolsRegistered = true
108
+ this.hostToolsRegistered = false
111
109
  }
112
110
  }
113
111
 
@@ -7,6 +7,7 @@
7
7
  import { BaseAgentImpl } from '../base-agent'
8
8
  import type { AgentEvent, AgentInfo, AgentRunContext } from '../agent-interface'
9
9
  import type { AgentSessionEvent, OmpRpcClient } from '../adapters/omp-rpc-client'
10
+ import type { ExecutionScope } from '../execution-scope'
10
11
  import type { BaseAgentConfigView } from '../base-agent'
11
12
  import type { OmpAgentConfig } from './types'
12
13
  import { createRosterCache } from '../prompt-builder'
@@ -94,6 +95,8 @@ export abstract class OmpRpcAgentImplCore extends BaseAgentImpl {
94
95
  protected client: OmpRpcClient | null = null
95
96
  protected agentInfo: AgentInfo | null = null
96
97
  protected hostToolsRegistered = false
98
+ protected hostToolAliases: { client: OmpRpcClient, scope: ExecutionScope, nonce: string, revision: number, byAlias: Map<string, string>, byName: Map<string, string> } | null = null
99
+ protected hostToolRegistration: Promise<void> = Promise.resolve()
97
100
  /**
98
101
  * 会话回合状态(steer 可靠注入的依据):
99
102
  * omp 的 steer 仅在回合 streaming 中生效——prompt 已入列但尚未开始输出时,
@@ -7,6 +7,9 @@ import { hostToolsForAgent } from '../host-tool-bridge'
7
7
  import { killHarnessProcess, markHarnessProcessExit } from '../harness-process'
8
8
  import { liveAgents } from './helpers'
9
9
  import { markTerminalSessionExit } from '../harness-terminal'
10
+ import { createHash, randomBytes } from 'node:crypto'
11
+ import type { OmpRpcClient } from '../adapters/omp-rpc-client'
12
+ import type { ExecutionScope } from '../execution-scope'
10
13
 
11
14
  export abstract class OmpRpcAgentImplLifecycle extends OmpRpcAgentImplContextGovernance {
12
15
  async dispose(): Promise<void> {
@@ -20,14 +23,77 @@ export abstract class OmpRpcAgentImplLifecycle extends OmpRpcAgentImplContextGov
20
23
  markTerminalSessionExit(pid, null)
21
24
  }
22
25
  }
26
+ this.hostToolAliases = null
23
27
  this.hostToolsRegistered = false
24
28
  }
25
29
 
26
- /** 工具注册表变更 → 热重发 set_host_tools(在跑会话立即获得插件新工具,无需重spawn) */
30
+ /** Register aliases in a single ordered queue, including plugin hot reloads. */
31
+ protected registerTurnTools(client: OmpRpcClient, scope: ExecutionScope, rotate: boolean): Promise<void> {
32
+ if (rotate) {
33
+ this.hostToolAliases = { client, scope, nonce: randomBytes(16).toString('hex'), revision: 0, byAlias: new Map(), byName: new Map() }
34
+ }
35
+ const turn = this.hostToolAliases
36
+ if (!turn || turn.client !== client || turn.scope !== scope) return Promise.reject(new Error('OMP turn tool scope unavailable'))
37
+ const revision = ++turn.revision
38
+ if (!rotate) {
39
+ turn.nonce = randomBytes(16).toString('hex')
40
+ turn.byAlias.clear()
41
+ turn.byName.clear()
42
+ }
43
+ const nonce = turn.nonce
44
+ const update = this.hostToolRegistration.catch(() => {}).then(async () => {
45
+ if (this.hostToolAliases !== turn || this.client !== client || scope.signal.aborted) throw new Error('OMP turn tool scope expired')
46
+ const tools = hostToolsForAgent(this.selfAgentId, this.agentRole, this.channelId)
47
+ const nextByAlias = new Map<string, string>()
48
+ const nextByName = new Map<string, string>()
49
+ const aliased = tools.map((tool) => {
50
+ const digest = createHash('sha256').update(tool.name).digest('hex').slice(0, 16)
51
+ const prefix = tool.name.replace(/[^a-zA-Z0-9_-]/g, '_').slice(0, 11) || 'tool'
52
+ const alias = `aw_${nonce}_${digest}_${prefix}`
53
+ if (nextByAlias.has(alias)) throw new Error(`OMP host tool alias collision: ${tool.name}`)
54
+ nextByAlias.set(alias, tool.name)
55
+ nextByName.set(tool.name, alias)
56
+ return { ...tool, name: alias, description: `Canonical tool: ${tool.name}. ${tool.description}` }
57
+ })
58
+ // Revoke the old snapshot while registration is in flight; a failed or
59
+ // ambiguous update must never leave any alias dispatchable.
60
+ turn.byAlias.clear()
61
+ await client.send({ type: 'set_host_tools', tools: aliased })
62
+ if (this.hostToolAliases !== turn || this.client !== client || scope.signal.aborted) throw new Error('OMP turn tool scope expired')
63
+ if (turn.revision !== revision) return
64
+ turn.byAlias = nextByAlias
65
+ turn.byName = nextByName
66
+ this.hostToolsRegistered = true
67
+ })
68
+ this.hostToolRegistration = update
69
+ return update
70
+ }
71
+
72
+ protected async prepareTurnTools(client: OmpRpcClient, scope: ExecutionScope): Promise<void> {
73
+ await this.registerTurnTools(client, scope, true)
74
+ let pending: Promise<void>
75
+ do {
76
+ pending = this.hostToolRegistration
77
+ await pending
78
+ } while (pending !== this.hostToolRegistration)
79
+ if (this.hostToolAliases?.client !== client || this.hostToolAliases.scope !== scope || this.client !== client || scope.signal.aborted) {
80
+ throw new Error('OMP turn tool scope expired')
81
+ }
82
+ }
83
+
84
+ protected clearTurnTools(scope: ExecutionScope): void {
85
+ if (this.hostToolAliases?.scope === scope) this.hostToolAliases = null
86
+ }
87
+
88
+ /** 工具注册表变更 → 回收旧别名并热更新。 */
27
89
  refreshPluginTools(): void {
28
- const client = this.client
29
- if (!client || !client.alive) return
30
- void client.send({ type: 'set_host_tools', tools: hostToolsForAgent(this.selfAgentId, this.agentRole, this.channelId) }).catch(() => {})
90
+ const turn = this.hostToolAliases
91
+ if (!turn || turn.client !== this.client || !turn.client.alive || turn.scope.signal.aborted) return
92
+ void this.registerTurnTools(turn.client, turn.scope, false).catch((err) => {
93
+ // A failed refresh leaves no potentially revoked alias dispatchable.
94
+ if (this.hostToolAliases === turn) turn.byAlias.clear()
95
+ console.warn('[omp] host tool refresh failed:', err instanceof Error ? err.message : err)
96
+ })
31
97
  }
32
98
 
33
99
  /** harness 会话身份(§2.4;get_state 探测到才有;未探测到返回 null) */
@@ -37,13 +37,15 @@ export function isHardAbortReason(reason: string): boolean {
37
37
  *
38
38
  * 历史缺陷:onAbort 把所有非 hard timeout 的原因都重写成 'external cancel',
39
39
  * 于是调度器生命周期停机(runtime stop)也合成 cancel 决策,把在办根任务取消。
40
- * 这里只保留三类语义:hard timeout / runtime stop / external cancel。
40
+ * 这里保留四类语义:hard timeout / runtime stop / message watchdog / external cancel。
41
+ * watchdog(消息级无活动 abort)不是治理取消 —— 不收口在办任务。
41
42
  */
42
43
  export function normalizeSupervisionAbortReason(reason: string): string {
43
44
  const r = String(reason ?? '').trim()
44
45
  if (!r) return 'external cancel'
45
46
  if (r.includes('hard timeout')) return r
46
47
  if (r === 'runtime stop' || r === 'runtime_stop') return 'runtime stop'
48
+ if (r === 'message watchdog' || r === 'watchdog') return 'watchdog'
47
49
  return 'external cancel'
48
50
  }
49
51