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
@@ -1,24 +1,42 @@
1
1
  /**
2
- * 启动一次诊断(建运行记录 / 调 harness / 落 KV)
3
- * (由 server/plugins-builtin/diag-bridge/index.mjs 按职责拆出;内容逐行原文搬运)
2
+ * 启动一次诊断(契约定轨 → 建运行记录 / 调 IDD / 落 KV)
3
+ * WS-2:主契约迁移 external v1(auto 提交前探测定轨,legacy 显式回退);
4
+ * run meta 持久化 contract + task_id + run_id,轮询/状态/回执全链同契约。
4
5
  */
5
6
  import { baseOf, harnessOf, jpost, maxMinutesOf, maxTurnsOf, runKey, runningOfLine, short } from './helpers.mjs'
6
7
  import { snapshotCore } from './snapshot.mjs'
7
8
  import { startingLines } from './constants.mjs'
8
9
  import { defaultQuestionFor, resolveBridgeIntent } from './intents.mjs'
10
+ import { getCapabilities, mapV1Error, preflightCapabilities, resolveContract, v1Request } from './external-v1.mjs'
9
11
 
10
- export async function startDiagnosis(ctx, { line, fromMs, toMs, question, scene, source, dataPath, dataPaths, harness, agentId, channelId, analysisIntent, model, permissionMode }) {
12
+ export async function startDiagnosis(ctx, {
13
+ line, lineScope, fromMs, toMs, question, scene, source, dataPath, dataPaths,
14
+ harness, agentId, channelId, analysisIntent, model, permissionMode,
15
+ ontologyMode, ontologyScene, ontologySource, preprocessingMode, reportLanguage,
16
+ }) {
11
17
  const base = baseOf(ctx)
12
18
  if (!base) return { ok: false, error: 'diag.base_url 非法(仅允许 http/https 且 host 为 127.0.0.1/localhost)。' }
13
19
  const intent = resolveBridgeIntent(analysisIntent)
14
20
  if (analysisIntent && String(analysisIntent).trim() && !intent) {
15
- return { ok: false, error: `未知分析意图: ${String(analysisIntent)}(支持 deep-diagnosis/stability-report/quick-screen/doe-analysis/experience-mining/optimizer-campaign)` }
21
+ return { ok: false, error: `未知分析意图: ${String(analysisIntent)}(支持 deep-diagnosis/stability-report/quick-screen/doe-analysis/experience-mining/optimizer-campaign/improvement-advisory)` }
16
22
  }
17
23
  if (startingLines.has(line)) return { ok: false, error: `产线 ${line} 已有诊断正在启动,请稍后再试。` }
18
24
  const existing = runningOfLine(ctx, line)
19
25
  if (existing) return { ok: false, error: `产线 ${line} 已有运行中的诊断(run_id=${existing.id}),请稍后用 diag_status 查询。` }
20
26
  startingLines.add(line)
21
27
  try {
28
+ // ① 契约定轨(提交前;v1 /analyze 无幂等键,禁止"失败后回退"式重提交)
29
+ const track = await resolveContract(ctx)
30
+ if (!track.contract) return { ok: false, error: track.error }
31
+ const contract = track.contract
32
+
33
+ // ② v1 能力预检(软拒绝:intent/引擎不在 capabilities 清单 → 提交前可读拒绝)
34
+ if (contract === 'v1') {
35
+ const cap = await getCapabilities(ctx)
36
+ const reject = preflightCapabilities(cap, { intent, harness: harness || harnessOf(ctx) })
37
+ if (reject) return { ok: false, error: reject }
38
+ }
39
+
22
40
  let snap = { ok: true, csvPath: '', rows: 0, nodes: 0 }
23
41
  if (!dataPath && !(Array.isArray(dataPaths) && dataPaths.length > 0)) {
24
42
  snap = await snapshotCore(ctx, line, fromMs, toMs)
@@ -27,46 +45,116 @@ export async function startDiagnosis(ctx, { line, fromMs, toMs, question, scene,
27
45
  // 按情景注入业务提示词:调用方显式 question 优先,否则用意图目录的模板(分析语义在此,执行解耦在 IDD)
28
46
  const q = question || defaultQuestionFor(intent, { line, fromMs, toMs })
29
47
  const sceneName = scene || `${line}_diag`
30
- // v2.1:统一走 IDD 任务管理面 /api/diagnosis/tasks——接收即返 task_id,
31
- // 诊断在 IDD 后台线程执行(内部 start+execute),Channel 绝不等待。
32
- // v2.2:dataPaths(多文件,manifest 首位)走 IDD multi 模式;harness 可按次覆盖。
33
- const payload = Array.isArray(dataPaths) && dataPaths.length > 0
34
- ? { dataPaths }
35
- : { dataPath: dataPath || snap.csvPath }
36
- const started = await jpost(ctx, `${base}/api/diagnosis/tasks`, {
37
- ...payload,
38
- sceneName,
39
- userQuestion: q,
40
- harness: harness || harnessOf(ctx), // 缺省落 claude 引擎会因无 key 失败,必须显式(系统配置 plugins.diag-bridge.harness → kv → omp;diag_run 可按次覆盖)
41
- ...(intent && intent !== 'deep-diagnosis' ? { analysisIntent: intent } : {}), // 分析意图透传(缺省意图不传,由 IDD 兜底)
42
- ...(model ? { model: String(model) } : {}), // 引擎模型按次覆盖(合法性由 IDD validateEngineOption 校验,不合法 400)
43
- ...(permissionMode ? { permissionMode: String(permissionMode) } : {}),
44
- enhancement: 'off',
45
- reportLanguage: 'zh',
46
- maxTurns: maxTurnsOf(ctx), // 修复循环会加转数;150 不够走完全管线
47
- timeoutMinutes: maxMinutesOf(ctx),
48
- })
49
- const runId = String(started.data?.task_id ?? started.data?.runId ?? '')
50
- const name = String(started.data?.name ?? '')
51
- if (!runId) return { ok: false, error: `tasks 响应缺少 data.task_id: ${short(started)}` }
52
- // 采用 IDD ack 的真实初始态:队列满时是 queued,触发失败时是 failed。
53
- // 此前一律写 running —— queued 被 sweep 的 running 过滤条件丢弃,自动回执永久丢失。
54
- const ackStatus = String(started.data?.status ?? '').toLowerCase()
55
- if (ackStatus === 'failed') {
56
- return { ok: false, error: `诊断任务已受理但立即失败(run_id=${runId}):${started.data?.error ?? started.data?.result?.error ?? 'IDD 未返回原因'}` }
48
+ const engine = harness || harnessOf(ctx)
49
+ const notes = []
50
+
51
+ let runId
52
+ let taskId = ''
53
+ let initialStatus = 'running'
54
+ let name = ''
55
+
56
+ if (contract === 'v1') {
57
+ // v1 提交:202 {task_id, run_id, status, links}(无 success 字段,按 HTTP 状态码分支)
58
+ const payload = Array.isArray(dataPaths) && dataPaths.length > 0
59
+ ? { dataPaths }
60
+ : { dataPath: dataPath || snap.csvPath }
61
+ const body = {
62
+ ...payload,
63
+ analysisIntent: intent,
64
+ harness: engine,
65
+ sceneName,
66
+ question: q,
67
+ reportLanguage: String(reportLanguage || 'zh'),
68
+ wait: false,
69
+ ...(ontologyMode ? { ontologyMode: String(ontologyMode) } : {}),
70
+ ...(ontologyScene ? { ontologyScene: String(ontologyScene) } : {}),
71
+ ...(ontologySource ? { ontologySource: String(ontologySource) } : {}),
72
+ ...(preprocessingMode ? { preprocessingMode: String(preprocessingMode) } : {}),
73
+ maxTurns: maxTurnsOf(ctx),
74
+ timeoutMinutes: maxMinutesOf(ctx),
75
+ }
76
+ if (model || permissionMode) notes.push('external v1 无 model/permissionMode 字段,本次已忽略(按 IDD 默认执行)')
77
+ const started = await v1Request(ctx, 'POST', '/analyze', body, 20000)
78
+ if (!started.ok) {
79
+ return { ok: false, error: `发起分析失败:${mapV1Error(started, { base })}` }
80
+ }
81
+ const data = started.body?.data ?? {}
82
+ taskId = String(data.task_id ?? '')
83
+ runId = String(data.run_id ?? taskId)
84
+ name = String(data.name ?? '')
85
+ const ackStatus = String(data.status ?? '').toLowerCase()
86
+ if (!taskId || !runId) return { ok: false, error: `v1 analyze 响应缺少 task_id/run_id: ${short(started.body)}` }
87
+ if (['failed', 'interrupted', 'expired'].includes(ackStatus)) {
88
+ return { ok: false, error: `诊断任务已受理但立即 ${ackStatus}(run_id=${runId}):${data.error ?? 'IDD 未返回原因'}` }
89
+ }
90
+ initialStatus = ['queued', 'running', 'accepted', 'awaiting_input'].includes(ackStatus) ? ackStatus : 'running'
91
+ }
92
+ else {
93
+ // legacy 提交(/api/diagnosis/tasks):接收即返 task_id,诊断在 IDD 后台执行
94
+ const payload = Array.isArray(dataPaths) && dataPaths.length > 0
95
+ ? { dataPaths }
96
+ : { dataPath: dataPath || snap.csvPath }
97
+ const started = await jpost(ctx, `${base}/api/diagnosis/tasks`, {
98
+ ...payload,
99
+ sceneName,
100
+ userQuestion: q,
101
+ harness: engine, // 缺省落 claude 引擎会因无 key 失败,必须显式(系统配置 → kv → omp)
102
+ ...(intent && intent !== 'deep-diagnosis' ? { analysisIntent: intent } : {}),
103
+ ...(model ? { model: String(model) } : {}),
104
+ ...(permissionMode ? { permissionMode: String(permissionMode) } : {}),
105
+ ...(reportLanguage ? { reportLanguage: String(reportLanguage) } : { reportLanguage: 'zh' }),
106
+ ...(ontologyMode ? { ontologyMode: String(ontologyMode) } : {}),
107
+ ...(ontologyScene ? { ontologyScene: String(ontologyScene) } : {}),
108
+ ...(ontologySource ? { ontologySource: String(ontologySource) } : {}),
109
+ ...(preprocessingMode ? { preprocessingMode: String(preprocessingMode) } : {}),
110
+ enhancement: 'off',
111
+ maxTurns: maxTurnsOf(ctx),
112
+ timeoutMinutes: maxMinutesOf(ctx),
113
+ })
114
+ runId = String(started.data?.task_id ?? started.data?.runId ?? '')
115
+ taskId = runId
116
+ name = String(started.data?.name ?? '')
117
+ if (!runId) return { ok: false, error: `tasks 响应缺少 data.task_id: ${short(started)}` }
118
+ // 采用 IDD ack 的真实初始态:队列满时是 queued,触发失败时是 failed。
119
+ const ackStatus = String(started.data?.status ?? '').toLowerCase()
120
+ if (ackStatus === 'failed') {
121
+ return { ok: false, error: `诊断任务已受理但立即失败(run_id=${runId}):${started.data?.error ?? started.data?.result?.error ?? 'IDD 未返回原因'}` }
122
+ }
123
+ initialStatus = ['queued', 'running'].includes(ackStatus) ? ackStatus : 'running'
57
124
  }
58
- const initialStatus = ['queued', 'running'].includes(ackStatus) ? ackStatus : 'running'
125
+
59
126
  ctx.kv.set(runKey(runId), {
60
127
  line, fromMs, toMs, question: q, scene: sceneName,
128
+ // 授权作用域(区别于 line 锁键):显式传入的产线才参与可读面校验;
129
+ // 纯离线数据集为 ''(不按产线拒,读取面已由数据集归属/导出约束)。
130
+ lineScope: String(lineScope ?? line ?? ''),
61
131
  intent: intent || 'deep-diagnosis',
62
132
  status: initialStatus, createdAt: Date.now(), source,
63
133
  csvPath: snap.csvPath,
64
134
  files: Array.isArray(dataPaths) ? dataPaths.length : 0,
65
135
  name,
136
+ // 契约路由字段:轮询/状态/回执/report 全链同契约(跨 sweep 与工具面)
137
+ contract,
138
+ taskId,
139
+ runId,
66
140
  // 归因:发起 Agent 完成后的结果回执靠它寻址(平台通告面 deliver)
67
141
  agentId: agentId || '', channelId: channelId || '',
68
142
  })
69
- return { ok: true, runId, name, status: initialStatus, csvPath: snap.csvPath, rows: snap.rows, nodes: snap.nodes, files: Array.isArray(dataPaths) ? dataPaths.length : 0, intent: intent || 'deep-diagnosis', question: q }
143
+ return {
144
+ ok: true,
145
+ runId,
146
+ taskId,
147
+ contract,
148
+ name,
149
+ status: initialStatus,
150
+ csvPath: snap.csvPath,
151
+ rows: snap.rows,
152
+ nodes: snap.nodes,
153
+ files: Array.isArray(dataPaths) ? dataPaths.length : 0,
154
+ intent: intent || 'deep-diagnosis',
155
+ question: q,
156
+ notes,
157
+ }
70
158
  }
71
159
  catch (err) {
72
160
  return { ok: false, error: `发起诊断失败: ${err?.message ?? err}` }
@@ -75,8 +163,3 @@ export async function startDiagnosis(ctx, { line, fromMs, toMs, question, scene,
75
163
  startingLines.delete(line)
76
164
  }
77
165
  }
78
-
79
- // ── 轮询器:15s 扫描 kv 中 running 的 run → 更新状态 ──────────────────────
80
- // v2.1:入库不再由本插件自动执行(web documents/create 旧两步管线已移除)。
81
- // 完成后的协调契约:Channel 空闲时用 diag_status 查询 → 拿到 诊断总结+报告 md
82
- // 路径 → 由 Agent 调用 rag-bridge 的 kb_agent(mode=async) 把报告入库知识库。
@@ -0,0 +1,213 @@
1
+ /**
2
+ * IDD external v1 契约层(WS-2)。
3
+ *
4
+ * - 契约定轨:显式 settings `contract` ∈ auto|v1|legacy;auto 时**提交前**探测
5
+ * `GET /capabilities` 并缓存(5min,按 base+token 指纹)——不是"失败后回退",
6
+ * 因为 v1 /analyze 无幂等键,202 后重提交有双跑风险。
7
+ * - 请求层:不复用 jget/jpost 的 success 断言 —— v1 202 信封无 success 字段;
8
+ * 一律按 HTTP 状态码分支,错误码统一映射为中文可读指引(手册 §9)。
9
+ * - 结果归一:v1 task/result → 既有内部形状(score/verdict/summary/reportPath/...),
10
+ * 下游(回执/结果库/面板)零形状断裂。
11
+ */
12
+ import { authHeadersOf, baseOf, diagTokenOf } from './helpers.mjs'
13
+
14
+ export const V1_PREFIX = '/api/external/v1'
15
+ export const CONTRACT_TTL_MS = 5 * 60_000
16
+
17
+ /** 契约开关(系统配置优先,kv 兜底;auto=探测) */
18
+ export function contractModeOf(ctx) {
19
+ const v = String(ctx.config?.get?.('plugins.diag-bridge.contract') || ctx.kv.get('diag.contract') || 'auto').trim().toLowerCase()
20
+ return ['v1', 'legacy', 'auto'].includes(v) ? v : 'auto'
21
+ }
22
+
23
+ /** 等待人工介入(run=awaiting_input)的老化上限(分钟;到期转 expired 并提示) */
24
+ export function awaitingMaxMinutesOf(ctx) {
25
+ const n = Number(ctx.config?.get?.('plugins.diag-bridge.awaiting_max_minutes')) || Number(ctx.kv.get('diag.awaiting_max_minutes')) || 30
26
+ return Math.min(24 * 60, Math.max(1, Math.round(n)))
27
+ }
28
+
29
+ /** 缓存指纹:base_url + token 变化必须使探测缓存失效 */
30
+ function probeKeyOf(ctx) {
31
+ const base = baseOf(ctx) ?? ''
32
+ const token = diagTokenOf(ctx)
33
+ let h = 0
34
+ for (let i = 0; i < token.length; i += 1) h = (h * 31 + token.charCodeAt(i)) | 0
35
+ return `diag.contract_probe:${base}:${h}`
36
+ }
37
+
38
+ /**
39
+ * v1 请求:返回 { ok, status, body } 或 { ok:false, status, body, error }。
40
+ * 不使用 success 断言(202 无 success;部分端点成功信封只有 data/status)。
41
+ */
42
+ export async function v1Request(ctx, method, path, body, timeoutMs = 10000) {
43
+ const base = baseOf(ctx)
44
+ if (!base) return { ok: false, status: 0, error: 'base_url 非法(仅允许 http/https 且 host 为 127.0.0.1/localhost)' }
45
+ const url = `${base}${V1_PREFIX}${path}`
46
+ const opts = { timeoutMs, headers: authHeadersOf(ctx) }
47
+ try {
48
+ const res = method === 'GET'
49
+ ? await ctx.http.get(url, opts)
50
+ : await ctx.http.post(url, body ?? {}, opts)
51
+ const json = await res.json().catch(() => null)
52
+ if (!res.ok) {
53
+ return { ok: false, status: res.status, body: json, error: `HTTP ${res.status}${json?.code ? ` ${json.code}` : ''}${json?.error ? `:${json.error}` : ''}` }
54
+ }
55
+ return { ok: true, status: res.status, body: json }
56
+ }
57
+ catch (err) {
58
+ return { ok: false, status: 0, error: String(err?.message ?? err) }
59
+ }
60
+ }
61
+
62
+ /** capabilities(缓存 5min;force=true 强制刷新) */
63
+ export async function getCapabilities(ctx, { force = false } = {}) {
64
+ const key = probeKeyOf(ctx)
65
+ if (!force) {
66
+ const cached = ctx.kv.get(key)
67
+ if (cached) {
68
+ try {
69
+ const p = JSON.parse(cached)
70
+ if (Date.now() - p.at < CONTRACT_TTL_MS && p.capabilities) return { ok: true, cached: true, data: p.capabilities }
71
+ }
72
+ catch { /* 缓存损坏则重探 */ }
73
+ }
74
+ }
75
+ const r = await v1Request(ctx, 'GET', '/capabilities', undefined, 5000)
76
+ if (r.ok && r.body?.success === true && r.body?.data) {
77
+ try {
78
+ ctx.kv.set(key, JSON.stringify({ at: Date.now(), capabilities: r.body.data }))
79
+ }
80
+ catch { /* kv 不可写不影响主流程 */ }
81
+ return { ok: true, data: r.body.data }
82
+ }
83
+ // HTTP 200 但不是 v1 能力信封(常见于反向代理 catch-all/旧后端兜底)→ 标记 shape,
84
+ // 由 resolveContract 按 legacy 处理(而不是把"200"误当 v1 能力)。
85
+ const shape = Boolean(r.ok) && !(r.body?.success === true && r.body?.data)
86
+ return { ok: false, status: r.status ?? 0, shape, error: r.error ?? (shape ? 'capabilities 响应形状不符(非 v1 信封)' : 'capabilities 不可达') }
87
+ }
88
+
89
+ /**
90
+ * 契约定轨。返回 { contract:'v1'|'legacy', mode, cached? } 或 { contract:null, error }。
91
+ * 铁律:401/403 与 5xx 不钉 legacy(token/服务故障时 legacy 同样不可用,静默回退会掩盖问题)。
92
+ */
93
+ export async function resolveContract(ctx, { force = false } = {}) {
94
+ const mode = contractModeOf(ctx)
95
+ if (mode === 'v1' || mode === 'legacy') return { contract: mode, mode, pinned: true }
96
+ const cap = await getCapabilities(ctx, { force })
97
+ if (cap.ok) return { contract: 'v1', mode, cached: Boolean(cap.cached) }
98
+ const status = Number(cap.status ?? 0)
99
+ if (status === 404 || status === 400) return { contract: 'legacy', mode }
100
+ if (status === 0) return { contract: 'legacy', mode } // 老后端/不可达:legacy 路径会给出更具体的网络错误
101
+ if (cap.shape) return { contract: 'legacy', mode } // 200 非 v1 信封(代理兜底/旧后端)
102
+ if (status === 401 || status === 403) {
103
+ return {
104
+ contract: null,
105
+ mode,
106
+ error: `IDD Token 无效或过期(HTTP ${status}):请到 系统设置→运行配置→插件 更新「诊断 API Token」(idd_ 前缀持久 Token)。契约定轨不会回退 legacy —— token 错误时两条路径都不可用。`,
107
+ }
108
+ }
109
+ return { contract: null, mode, error: `capabilities 探测失败(HTTP ${status},${cap.error});服务可能暂时不可用,请稍后重试或将 contract 显式设为 v1/legacy。` }
110
+ }
111
+
112
+ /** v1 任务状态(GET /tasks/:id;/tasks 接受 task_id 或 run_id) */
113
+ export function v1Task(ctx, id, timeoutMs = 8000) {
114
+ return v1Request(ctx, 'GET', `/tasks/${encodeURIComponent(id)}`, undefined, timeoutMs)
115
+ }
116
+
117
+ /** v1 终态结果(GET /tasks/:id/result;运行中 409 EXTERNAL_TASK_RUNNING) */
118
+ export function v1Result(ctx, id, timeoutMs = 15000) {
119
+ return v1Request(ctx, 'GET', `/tasks/${encodeURIComponent(id)}/result`, undefined, timeoutMs)
120
+ }
121
+
122
+ /** v1 续聊(POST /chat) */
123
+ export function v1Chat(ctx, runId, message, timeoutMs = 20000) {
124
+ return v1Request(ctx, 'POST', '/chat', { run_id: runId, message }, timeoutMs)
125
+ }
126
+
127
+ /** v1 停止(POST /analyze/:runId/stop) */
128
+ export function v1Stop(ctx, runId, timeoutMs = 15000) {
129
+ return v1Request(ctx, 'POST', `/analyze/${encodeURIComponent(runId)}/stop`, {}, timeoutMs)
130
+ }
131
+
132
+ /** 手册 §9 错误码 → 中文可读 + 处方 */
133
+ export function mapV1Error(r, { base = '' } = {}) {
134
+ const code = String(r?.body?.code ?? '')
135
+ const status = Number(r?.status ?? 0)
136
+ const raw = String(r?.body?.error ?? r?.error ?? '')
137
+ if (/^AUTH_/.test(code) || status === 401 || status === 403) {
138
+ return `IDD Token 无效/过期(${code || `HTTP ${status}`}):在 系统设置→运行配置→插件 更新「诊断 API Token」(idd_ 持久 Token),保存即热生效。`
139
+ }
140
+ if (code === 'EXTERNAL_INTENT_UNKNOWN') {
141
+ const supported = Array.isArray(r?.body?.supported) ? r.body.supported.join('/') : 'deep-diagnosis/stability-report/quick-screen/doe-analysis/experience-mining/optimizer-campaign/improvement-advisory'
142
+ return `未知分析意图(${raw})。支持:${supported}。`
143
+ }
144
+ if (code === 'HARNESS_UNKNOWN') {
145
+ return `诊断引擎名不存在(${raw})。可用引擎以 GET /api/external/v1/capabilities 的 harnesses 为准(当前推荐 omp)。`
146
+ }
147
+ if (code === 'HARNESS_UNAVAILABLE') {
148
+ return `诊断引擎不可用(${raw})。该引擎未安装或健康探测失败;换用 capabilities 中 runs_capable=true 的引擎(如 omp),或先在 IDD 侧修复引擎环境。`
149
+ }
150
+ if (code === 'EXTERNAL_DATA_REQUIRED') {
151
+ return '缺少数据来源:line(平台快照)/data_path(诊断服务内文件)/export_id(daq_export 数据集)至少给一个。'
152
+ }
153
+ if (code === 'DATA_NOT_FOUND') return `数据路径不存在(${raw}):确认 data_path 相对 data/ 或 workspace 白名单;export 数据集请先用 daq_export 导出。`
154
+ if (code === 'PATH_TRAVERSAL') return `数据路径越界被拒(${raw}):只允许 data/ 或 workspace 白名单内的路径。`
155
+ if (code === 'INTENT_UNSUPPORTED_ON_HARNESS') return `该引擎不支持此分析意图(${raw});换引擎或换意图(capabilities 的 supported_intents 为准)。`
156
+ if (code === 'PREPROCESSING_MODE_UNSUPPORTED_INTENT') return 'preprocessing_mode 仅 stability-report 支持;其它意图请去掉该参数。'
157
+ if (code === 'ONTOLOGY_UNSUPPORTED_INTENT') return 'ontology 字段仅 deep-diagnosis/stability-report/quick-screen/doe-analysis 支持;其它意图请去掉。'
158
+ if (code === 'RUN_NOT_IDLE') {
159
+ return `该 run 正在运行,不能续聊(RUN_NOT_IDLE):先 diag_stop 停止,或等终态后再 diag_chat。`
160
+ }
161
+ if (code === 'RUN_TERMINAL') return `该 run 已结束(${raw}),无需再 stop;如需追问用 diag_chat(终态 run 可续聊)。`
162
+ if (code === 'EXTERNAL_TASK_RUNNING') return `任务仍在运行(HTTP 409):先把任务跑到终态再取结果;进度用 diag_status 查询。`
163
+ if (code === 'RUN_NOT_FOUND') return `run 不存在(${raw}):可能已被 IDD 清理或服务重启丢失;用 diag_status 查本地记录。`
164
+ if (code === 'RESULT_FORBIDDEN') return '结果不属于当前 Token 属主;换创建它的账号 Token 或由 IDD 管理员操作。'
165
+ if (status === 404) return `任务/资源不存在(HTTP 404):可能已过期(2h)或 IDD 重启丢失;重新 diag_run 或 diag_status 查本地记录。`
166
+ if (status >= 500) return `IDD 服务端错误(HTTP ${status}):${raw || '请查看 IDD 日志'};稍后重试。`
167
+ if (status === 0) return `诊断服务不可达${base ? `(${base})` : ''}:${raw || '检查 base_url、IDD 服务状态与网络'}。`
168
+ return raw || `请求失败(HTTP ${status || '?'})`
169
+ }
170
+
171
+ /**
172
+ * v1 / legacy 结果 → 内部统一形状。
173
+ * data 可为:task entry(refreshTask)、tasks/:id/result 信封(data.result/files)、
174
+ * legacy tasks/:id 的 data(result 内嵌)。
175
+ */
176
+ export function normalizeResult(data) {
177
+ const result = data?.result ?? {}
178
+ const files = data?.files ?? result?.files ?? null
179
+ return {
180
+ score: result.score ?? null,
181
+ verdict: result.verdict ?? null,
182
+ summary: String(result.summary ?? ''),
183
+ reportPath: files?.report_md_path ?? result.report_md_path ?? null,
184
+ reportUrl: files?.report_md_url ?? result.report_md_url ?? null,
185
+ reportMd: typeof result.report_md === 'string' && result.report_md.length ? result.report_md : null,
186
+ html: Array.isArray(files?.html) ? files.html : [],
187
+ files,
188
+ error: result.error ?? data?.error ?? null,
189
+ artifacts: result.artifacts ?? null,
190
+ }
191
+ }
192
+
193
+ /** 能力预检(软拒绝):intent/harness 不在 capabilities 清单时给出可读原因 */
194
+ export function preflightCapabilities(cap, { intent, harness }) {
195
+ if (!cap?.ok || !cap.data) return null // 探测失败不阻断提交(服务端仍会校验)
196
+ const intents = (Array.isArray(cap.data.intents) ? cap.data.intents : []).map(i => i?.intent).filter(Boolean)
197
+ if (intent && intents.length && !intents.includes(intent)) {
198
+ return `未知分析意图「${intent}」。支持:${intents.join('/')}。`
199
+ }
200
+ const list = Array.isArray(cap.data.harnesses) ? cap.data.harnesses : []
201
+ const hit = list.find(h => String(h?.id ?? '').toLowerCase() === String(harness ?? '').toLowerCase())
202
+ if (!hit) {
203
+ const ids = list.map(h => h?.id).filter(Boolean)
204
+ return `诊断引擎「${harness}」不在 capabilities 清单。可用:${ids.join('/') || '(空)'}。`
205
+ }
206
+ if (hit.runs_capable === false) {
207
+ return `诊断引擎「${harness}」不具备 runs 能力(可执行分析),提交必失败。请换用 runs_capable=true 的引擎(如 omp)。`
208
+ }
209
+ if (intent && Array.isArray(hit.supported_intents) && !hit.supported_intents.includes(intent)) {
210
+ return `引擎「${harness}」不支持分析意图「${intent}」。该引擎支持:${hit.supported_intents.join('/')}。`
211
+ }
212
+ return null
213
+ }
@@ -49,8 +49,10 @@ export function kvRuns(ctx) {
49
49
  return out
50
50
  }
51
51
 
52
- /** 未终态(仍占用产线单飞锁):queued 与 running 同等对待 */
53
- export const ACTIVE_RUN_STATUSES = new Set(['queued', 'running'])
52
+ /** 未终态(仍占用产线单飞锁):queued/running/awaiting_input 同等对待。
53
+ * awaiting_input = 等待人工介入(v1 六态之一,单列不冒充终态):必须继续占锁,
54
+ * 否则同线会并发第二个任务(与"awaiting 不释放锁"的治理语义直接矛盾)。 */
55
+ export const ACTIVE_RUN_STATUSES = new Set(['queued', 'running', 'awaiting_input'])
54
56
 
55
57
  /** 该产线是否有未终态的诊断(queued 也占用,否则同线会并发两个任务) */
56
58
  export function runningOfLine(ctx, line) {
@@ -1,62 +1,65 @@
1
- /**
2
- * 分析意图目录(diag-bridge 侧镜像)。
3
- *
4
- * ⚠️ 权威源在 IDD:`app/backend/src/engine/claude-client.mjs` 的 ANALYSIS_INTENTS
5
- * (每个意图 = 一个 skill 协议,buildIntentDirective 生成绑定指令,由 IDD 的 harness 执行)。
6
- * 本目录只是**调用面镜像**:给 diag_run 提供 enum 校验、中文标签与按情景的缺省提问模板
7
- * (数据分析业务语义在此注入,执行完全解耦在 IDD)。IDD 对未知意图 400 拒绝,不会静默降级。
8
- */
9
-
10
- /** 各意图的缺省提问模板(按任务情景注入给 IDD harness 的业务提示词)。
11
- * line=产线标识;win=可读时窗描述(缺省时可空)。 */
12
- const QUESTION_TEMPLATES = {
13
- 'deep-diagnosis': ({ line, win }) =>
14
- `${line} 产线${win}数据深度根因诊断:定位异常根因,给出证据链与修复建议`,
15
- 'stability-report': ({ line, win }) =>
16
- `${line} 产线${win}运行稳定性报告:给出综合评分与等级、各参数稳态表现(均值/波动/趋势)、问题清单与运行建议;不需要根因分析`,
17
- 'quick-screen': ({ line, win }) =>
18
- `${line} 产线${win}数据快速筛查:识别越限/漂移/冻结/卡死等异常,按严重度给出关注点清单,产出筛查报告与 HTML 看板;不做深度根因分析`,
19
- 'doe-analysis': ({ line, win }) =>
20
- `${line} 产线${win}DOE 试验数据分析:识别因子与响应,给出因子效应、显著性判断与最优工况组合建议;若数据不含多因子试验结构,请在报告中明确说明数据局限`,
21
- 'experience-mining': ({ line, win }) =>
22
- `${line} 产线${win}数据调参经验挖掘:总结可复用的调整经验(参数方向、幅度、生效条件与反例),按结构化经验条目输出,供知识库沉淀`,
23
- 'optimizer-campaign': ({ line, win }) =>
24
- `${line} 产线${win}数据优化战役:基于数据确定优化目标与约束,执行寻优迭代并汇报每轮目标值变化,最终给出推荐工况与预期收益`,
25
- }
26
-
27
- /** 意图元数据(label 给审批卡/回执用;skill 仅供诊断对账,执行由 IDD 自主) */
28
- export const ANALYSIS_INTENTS = {
29
- 'deep-diagnosis': { label: '深度根因诊断', skill: 'industrial-analysis-auto', defaultPolicy: true },
30
- 'stability-report': { label: '产线稳定报告', skill: 'industrial-line-stability-report' },
31
- 'quick-screen': { label: '快速筛查', skill: 'industrial-sentinel' },
32
- 'doe-analysis': { label: 'DOE 试验分析', skill: 'industrial-doe-analyzer' },
33
- 'experience-mining': { label: '调参经验挖掘', skill: 'industrial-tuning-memory' },
34
- 'optimizer-campaign': { label: '优化战役', skill: 'industrial-optimizer-loop' },
35
- }
36
-
37
- /** 归一化:空/未知 → null(空=缺省 deep-diagnosis 由 IDD 兜底;未知由调用方报错) */
38
- export function resolveBridgeIntent(value) {
39
- const v = String(value ?? '').trim()
40
- if (!v) return 'deep-diagnosis'
41
- return Object.prototype.hasOwnProperty.call(ANALYSIS_INTENTS, v) ? v : null
42
- }
43
-
44
- export function intentLabel(intent) {
45
- return ANALYSIS_INTENTS[intent]?.label ?? intent
46
- }
47
-
48
- /** 按情景生成缺省提问(业务提示词注入点;caller 显式 question 优先) */
49
- export function defaultQuestionFor(intent, { line, fromMs, toMs } = {}) {
50
- const tpl = QUESTION_TEMPLATES[intent] ?? QUESTION_TEMPLATES['deep-diagnosis']
51
- const win = fromMs && toMs && toMs > fromMs
52
- ? `${new Date(fromMs).toISOString().slice(0, 16)} ~ ${new Date(toMs).toISOString().slice(0, 16)} 时窗`
53
- : '该时窗'
54
- return tpl({ line: line || 'offline-data', win })
55
- }
56
-
57
- /** diag_run 参数面的 enum 说明(工具描述用;一行一意图) */
58
- export function intentCatalogText() {
59
- return Object.entries(ANALYSIS_INTENTS)
60
- .map(([id, m]) => `${id}=${m.label}`)
61
- .join(';')
62
- }
1
+ /**
2
+ * 分析意图目录(diag-bridge 侧镜像)。
3
+ *
4
+ * ⚠️ 权威源在 IDD:`app/backend/src/engine/claude-client.mjs` 的 ANALYSIS_INTENTS
5
+ * (每个意图 = 一个 skill 协议,buildIntentDirective 生成绑定指令,由 IDD 的 harness 执行)。
6
+ * 本目录只是**调用面镜像**:给 diag_run 提供 enum 校验、中文标签与按情景的缺省提问模板
7
+ * (数据分析业务语义在此注入,执行完全解耦在 IDD)。IDD 对未知意图 400 拒绝,不会静默降级。
8
+ */
9
+
10
+ /** 各意图的缺省提问模板(按任务情景注入给 IDD harness 的业务提示词)。
11
+ * line=产线标识;win=可读时窗描述(缺省时可空)。 */
12
+ const QUESTION_TEMPLATES = {
13
+ 'deep-diagnosis': ({ line, win }) =>
14
+ `${line} 产线${win}数据深度根因诊断:定位异常根因,给出证据链与修复建议`,
15
+ 'stability-report': ({ line, win }) =>
16
+ `${line} 产线${win}运行稳定性报告:给出综合评分与等级、各参数稳态表现(均值/波动/趋势)、问题清单与运行建议;不需要根因分析`,
17
+ 'quick-screen': ({ line, win }) =>
18
+ `${line} 产线${win}数据快速筛查:识别越限/漂移/冻结/卡死等异常,按严重度给出关注点清单,产出筛查报告与 HTML 看板;不做深度根因分析`,
19
+ 'doe-analysis': ({ line, win }) =>
20
+ `${line} 产线${win}DOE 试验数据分析:识别因子与响应,给出因子效应、显著性判断与最优工况组合建议;若数据不含多因子试验结构,请在报告中明确说明数据局限`,
21
+ 'experience-mining': ({ line, win }) =>
22
+ `${line} 产线${win}数据调参经验挖掘:总结可复用的调整经验(参数方向、幅度、生效条件与反例),按结构化经验条目输出,供知识库沉淀`,
23
+ 'optimizer-campaign': ({ line, win }) =>
24
+ `${line} 产线${win}数据优化战役:基于数据确定优化目标与约束,执行寻优迭代并汇报每轮目标值变化,最终给出推荐工况与预期收益`,
25
+ 'improvement-advisory': ({ line, win }) =>
26
+ `${line} 产线${win}数据改善建议:按 A/B/C 分级给出可执行建议(每条含 95% 置信区间、验证方法与回滚方案);数据不足时如实给出 not_actionable 与所需数据清单,不要编造结论`,
27
+ }
28
+
29
+ /** 意图元数据(label 给审批卡/回执用;skill 仅供诊断对账,执行由 IDD 自主) */
30
+ export const ANALYSIS_INTENTS = {
31
+ 'deep-diagnosis': { label: '深度根因诊断', skill: 'industrial-analysis-auto', defaultPolicy: true },
32
+ 'stability-report': { label: '产线稳定报告', skill: 'industrial-line-stability-report' },
33
+ 'quick-screen': { label: '快速筛查', skill: 'industrial-sentinel' },
34
+ 'doe-analysis': { label: 'DOE 试验分析', skill: 'industrial-doe-analyzer' },
35
+ 'experience-mining': { label: '调参经验挖掘', skill: 'industrial-tuning-memory' },
36
+ 'optimizer-campaign': { label: '优化战役', skill: 'industrial-optimizer-loop' },
37
+ 'improvement-advisory': { label: '改善建议', skill: 'industrial-improvement-advisor' },
38
+ }
39
+
40
+ /** 归一化:空/未知 → null(空=缺省 deep-diagnosis 由 IDD 兜底;未知由调用方报错) */
41
+ export function resolveBridgeIntent(value) {
42
+ const v = String(value ?? '').trim()
43
+ if (!v) return 'deep-diagnosis'
44
+ return Object.prototype.hasOwnProperty.call(ANALYSIS_INTENTS, v) ? v : null
45
+ }
46
+
47
+ export function intentLabel(intent) {
48
+ return ANALYSIS_INTENTS[intent]?.label ?? intent
49
+ }
50
+
51
+ /** 按情景生成缺省提问(业务提示词注入点;caller 显式 question 优先) */
52
+ export function defaultQuestionFor(intent, { line, fromMs, toMs } = {}) {
53
+ const tpl = QUESTION_TEMPLATES[intent] ?? QUESTION_TEMPLATES['deep-diagnosis']
54
+ const win = fromMs && toMs && toMs > fromMs
55
+ ? `${new Date(fromMs).toISOString().slice(0, 16)} ~ ${new Date(toMs).toISOString().slice(0, 16)} 时窗`
56
+ : '该时窗'
57
+ return tpl({ line: line || 'offline-data', win })
58
+ }
59
+
60
+ /** diag_run 参数面的 enum 说明(工具描述用;一行一意图) */
61
+ export function intentCatalogText() {
62
+ return Object.entries(ANALYSIS_INTENTS)
63
+ .map(([id, m]) => `${id}=${m.label}`)
64
+ .join(';')
65
+ }