agentworkshop 0.8.8 → 0.9.1

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 (591) hide show
  1. package/.AgentWorkShop/prompts/host-tools.json +68 -0
  2. package/.output/.AgentWorkShop/prompts/host-tools.json +68 -0
  3. package/.output/.AgentWorkShop/schema.json +2 -0
  4. package/.output/nitro.json +1 -1
  5. package/.output/public/_nuxt/{Cdi9qfTr.js → CDO7Zey1.js} +2 -2
  6. package/.output/public/_nuxt/builds/latest.json +1 -1
  7. package/.output/public/_nuxt/builds/meta/247a0d5c-de27-46a4-8f76-3e64affe9473.json +1 -0
  8. package/.output/server/chunks/_/access.mjs +1 -1
  9. package/.output/server/chunks/_/data-export.mjs +5 -5
  10. package/.output/server/chunks/_/data-query.mjs +2 -2
  11. package/.output/server/chunks/_/eda-run.repo.mjs +3 -3
  12. package/.output/server/chunks/_/features.mjs +5 -5
  13. package/.output/server/chunks/_/golden.mjs +2 -2
  14. package/.output/server/chunks/_/host-bindings.mjs +1 -1
  15. package/.output/server/chunks/_/index.mjs +2 -2
  16. package/.output/server/chunks/_/mes-secrets.repo.mjs +1 -1
  17. package/.output/server/chunks/_/nitro.mjs +2836 -1334
  18. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  19. package/.output/server/chunks/_/spc.mjs +2 -2
  20. package/.output/server/chunks/build/_id_-CsCtnbwe.mjs +1 -1
  21. package/.output/server/chunks/build/_id_-P1W47Gqq.mjs +1 -1
  22. package/.output/server/chunks/build/_wsId_-DpOErFj6.mjs +1 -1
  23. package/.output/server/chunks/build/agents-D7CdEUTv.mjs +1 -1
  24. package/.output/server/chunks/build/aml-DRAFRcGU.mjs +1 -1
  25. package/.output/server/chunks/build/analysis-J9axLuRt.mjs +1 -1
  26. package/.output/server/chunks/build/api-B4Om0mEc.mjs +1 -1
  27. package/.output/server/chunks/build/api-BEW_ebY_.mjs +1 -1
  28. package/.output/server/chunks/build/api-BsAgXWxi.mjs +1 -1
  29. package/.output/server/chunks/build/board-CJUc032b.mjs +1 -1
  30. package/.output/server/chunks/build/channel-templates-ggsBacZF.mjs +1 -1
  31. package/.output/server/chunks/build/constants-HPHJvjne.mjs +1 -1
  32. package/.output/server/chunks/build/daq-B_dRMDw4.mjs +1 -1
  33. package/.output/server/chunks/build/data-D8uX1dnm.mjs +1 -1
  34. package/.output/server/chunks/build/dcw-D_HD_H_2.mjs +1 -1
  35. package/.output/server/chunks/build/default-CNWS6NUw.mjs +1 -1
  36. package/.output/server/chunks/build/es-Bxu10NJ2.mjs +1 -1
  37. package/.output/server/chunks/build/logs-BnYSMRXM.mjs +1 -1
  38. package/.output/server/chunks/build/monitor-Cq6hRFeQ.mjs +1 -1
  39. package/.output/server/chunks/build/ontology-ohICfVVb.mjs +1 -1
  40. package/.output/server/chunks/build/operations-4zOVhW7o.mjs +1 -1
  41. package/.output/server/chunks/build/optimizer-BlWTsM-W.mjs +1 -1
  42. package/.output/server/chunks/build/pages-DEv4ProW.mjs +1 -1
  43. package/.output/server/chunks/build/permissions-DgXQZSyx.mjs +1 -1
  44. package/.output/server/chunks/build/pipeline-CkavMBhk.mjs +1 -1
  45. package/.output/server/chunks/build/plugins-LRjaSEZy.mjs +1 -1
  46. package/.output/server/chunks/build/schedules-Hz2DJUE2.mjs +1 -1
  47. package/.output/server/chunks/build/settings-DXLJPq7d.mjs +1 -1
  48. package/.output/server/chunks/build/studio-hSqH9TYS.mjs +1 -1
  49. package/.output/server/chunks/build/teams-BbwYJyzv.mjs +1 -1
  50. package/.output/server/chunks/build/tokens-GYaGJ35Z.mjs +1 -1
  51. package/.output/server/chunks/build/tools-CnYi9cou.mjs +1 -1
  52. package/.output/server/chunks/build/town-BV-hbwb5.mjs +1 -1
  53. package/.output/server/chunks/build/town-CcoQKjMj.mjs +1 -1
  54. package/.output/server/chunks/build/types-D6J7slEa.mjs +1 -1
  55. package/.output/server/chunks/build/types-DWqIeMRP.mjs +1 -1
  56. package/.output/server/chunks/build/useAgentHarnessOptions-Dq0l0Z6d.mjs +1 -1
  57. package/.output/server/chunks/build/useAgentTemplateActions-BFOHb5-L.mjs +1 -1
  58. package/.output/server/chunks/build/useAgentTemplateDialogState-CZzpu5og.mjs +1 -1
  59. package/.output/server/chunks/build/useAgentTemplateForm-CuJPOPcK.mjs +1 -1
  60. package/.output/server/chunks/build/useAgentTemplatesCatalog-B2bIhZLA.mjs +1 -1
  61. package/.output/server/chunks/build/useAmlDatasets-DeoE1idn.mjs +1 -1
  62. package/.output/server/chunks/build/useAmlEntities-BJhvdqHJ.mjs +1 -1
  63. package/.output/server/chunks/build/useAmlEnv-CDIZ6xTe.mjs +1 -1
  64. package/.output/server/chunks/build/useAmlExperiments-Dloi834i.mjs +1 -1
  65. package/.output/server/chunks/build/useAmlFormat-C2sl3MGB.mjs +1 -1
  66. package/.output/server/chunks/build/useAmlJobs-BF9LpwXz.mjs +1 -1
  67. package/.output/server/chunks/build/useAmlModels-_bweOr3R.mjs +1 -1
  68. package/.output/server/chunks/build/useAmlNotes-DQj980iX.mjs +1 -1
  69. package/.output/server/chunks/build/useAmlPredict-DHNgDSJn.mjs +1 -1
  70. package/.output/server/chunks/build/useAnalysisFeed-BrEGV_9x.mjs +1 -1
  71. package/.output/server/chunks/build/useDaqAddNode-D_Rkju0f.mjs +1 -1
  72. package/.output/server/chunks/build/useDaqDetailBinding-DCWaLKXT.mjs +1 -1
  73. package/.output/server/chunks/build/useDaqDetailFrames-BOIcOJRB.mjs +1 -1
  74. package/.output/server/chunks/build/useDaqDetailHistory-D6WulPVs.mjs +1 -1
  75. package/.output/server/chunks/build/useDaqDetailNode-BGMRUIXN.mjs +1 -1
  76. package/.output/server/chunks/build/useDaqDetailParams-Cm9a9r5G.mjs +1 -1
  77. package/.output/server/chunks/build/useDaqFilters-zAAVlzJQ.mjs +1 -1
  78. package/.output/server/chunks/build/useDaqNodeWindow-1DWj2H5G.mjs +1 -1
  79. package/.output/server/chunks/build/useDaqOptimizations-BE_9Z2s_.mjs +1 -1
  80. package/.output/server/chunks/build/useDaqTemplates-CK37sMfi.mjs +1 -1
  81. package/.output/server/chunks/build/useDashboardCharts-D45083s_.mjs +1 -1
  82. package/.output/server/chunks/build/useDashboardData-Cw8lrPo5.mjs +1 -1
  83. package/.output/server/chunks/build/useDcwAddNode-KnocMk1m.mjs +1 -1
  84. package/.output/server/chunks/build/useDcwCards-C53IiOcg.mjs +1 -1
  85. package/.output/server/chunks/build/useDcwDetailScope-D6qXrfZu.mjs +1 -1
  86. package/.output/server/chunks/build/useDcwDetailTemplates-DPOXu1o_.mjs +1 -1
  87. package/.output/server/chunks/build/useDcwFilter-DNQ6Ivwd.mjs +1 -1
  88. package/.output/server/chunks/build/useDcwLedger-BhbUBCbi.mjs +1 -1
  89. package/.output/server/chunks/build/useDcwLineMutations-KA7VnggO.mjs +1 -1
  90. package/.output/server/chunks/build/useDcwLineRun-3zx_UCxi.mjs +1 -1
  91. package/.output/server/chunks/build/useDcwParamApprovals-DzyY6Tmi.mjs +1 -1
  92. package/.output/server/chunks/build/useDcwProducts-B05ymt3k.mjs +1 -1
  93. package/.output/server/chunks/build/useDcwQuery-vWpgpSmJ.mjs +1 -1
  94. package/.output/server/chunks/build/useDcwQuickActions-DUkLy34S.mjs +1 -1
  95. package/.output/server/chunks/build/useDcwRecipes-BAb4Yg3d.mjs +1 -1
  96. package/.output/server/chunks/build/useDcwTemplates-D2aoejps.mjs +1 -1
  97. package/.output/server/chunks/build/useDcwWrites-7w8txksD.mjs +1 -1
  98. package/.output/server/chunks/build/useExpConfirmations-BM626N4p.mjs +1 -1
  99. package/.output/server/chunks/build/useLogsFormat-B-o4MHy7.mjs +1 -1
  100. package/.output/server/chunks/build/useLogsManual-D0dvgCsP.mjs +1 -1
  101. package/.output/server/chunks/build/useLogsQuery-D7hrJ3yn.mjs +1 -1
  102. package/.output/server/chunks/build/useLogsScope-DEUyq-My.mjs +1 -1
  103. package/.output/server/chunks/build/useMonitorColumns-vVnt3r5Q.mjs +1 -1
  104. package/.output/server/chunks/build/useMonitorData-DIkiLr_h.mjs +1 -1
  105. package/.output/server/chunks/build/useMonitorFormat-CyURtH8N.mjs +1 -1
  106. package/.output/server/chunks/build/useMonitorTerminal-Dj4QwRNW.mjs +1 -1
  107. package/.output/server/chunks/build/useOperationsFeed-Ci4mZAn_.mjs +1 -1
  108. package/.output/server/chunks/build/useRecipeDispatchApprovals-BYtiqfeb.mjs +1 -1
  109. package/.output/server/chunks/build/useTeamActions-BDjU06LP.mjs +1 -1
  110. package/.output/server/chunks/build/useTeamAddMemberDialog-J3oFn3FI.mjs +1 -1
  111. package/.output/server/chunks/build/useTeamCreateDialog-fbn4ixYu.mjs +1 -1
  112. package/.output/server/chunks/build/useTeamDeployDialog-BNezMD2k.mjs +1 -1
  113. package/.output/server/chunks/build/useTeamDialogState-CFRUQxAf.mjs +1 -1
  114. package/.output/server/chunks/build/useTeamPluginDialog-BZznrOVe.mjs +1 -1
  115. package/.output/server/chunks/build/useTeamsCatalog-DuZFP3oG.mjs +1 -1
  116. package/.output/server/chunks/build/useTokenClipboard-CwQpoFeP.mjs +1 -1
  117. package/.output/server/chunks/build/useTokenCreate-Ctl0YGhL.mjs +1 -1
  118. package/.output/server/chunks/build/useTokenRename-Cm3ypSfN.mjs +1 -1
  119. package/.output/server/chunks/build/useTokenReveal-CeoWL5Mt.mjs +1 -1
  120. package/.output/server/chunks/build/useTokensList-CNIzON3u.mjs +1 -1
  121. package/.output/server/chunks/build/useWorkbenchAuth-CY-bVFMu.mjs +1 -1
  122. package/.output/server/chunks/build/useWorkbenchWorkspaces-DhZQFss9.mjs +1 -1
  123. package/.output/server/chunks/build/useWorkspaceAuth-Dlvj9csD.mjs +1 -1
  124. package/.output/server/chunks/build/useWorkspaceChannels-CPFepxTN.mjs +1 -1
  125. package/.output/server/chunks/build/useWorkspacePanels-CTwREmq0.mjs +1 -1
  126. package/.output/server/chunks/build/useWorkspaceShell-BCypjjjE.mjs +1 -1
  127. package/.output/server/chunks/build/users-DjiVC_tS.mjs +1 -1
  128. package/.output/server/chunks/build/workshop-1gKeDASV.mjs +1 -1
  129. package/.output/server/chunks/routes/api/health.get.mjs +1 -1
  130. package/.output/server/chunks/routes/api/index.get.mjs +1 -1
  131. package/.output/server/chunks/routes/api/index.post.mjs +1 -1
  132. package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
  133. package/.output/server/chunks/routes/api/metrics.mjs +1 -1
  134. package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs +1 -1
  135. package/.output/server/chunks/routes/api/plugins/client/_name_.get.mjs +1 -1
  136. package/.output/server/chunks/routes/api/plugins/i18n.get.mjs +1 -1
  137. package/.output/server/chunks/routes/api/plugins/manifest.get.mjs +1 -1
  138. package/.output/server/chunks/routes/api/system/backup/list.get.mjs +1 -1
  139. package/.output/server/chunks/routes/api/system/backup/run.post.mjs +3 -3
  140. package/.output/server/chunks/routes/api/system/config-groups/_id_.delete.mjs +1 -1
  141. package/.output/server/chunks/routes/api/system/config-groups/_id_.patch.mjs +1 -1
  142. package/.output/server/chunks/routes/api/system/config.get.mjs +1 -1
  143. package/.output/server/chunks/routes/api/system/index.get.mjs +1 -1
  144. package/.output/server/chunks/routes/api/system/index.patch.mjs +1 -1
  145. package/.output/server/chunks/routes/api/system/index.post.mjs +1 -1
  146. package/.output/server/chunks/routes/api/system/index2.get.mjs +1 -1
  147. package/.output/server/chunks/routes/api/system/monitor/terminal/ws.mjs +1 -1
  148. package/.output/server/chunks/routes/api/system/monitor/terminate.post.mjs +1 -1
  149. package/.output/server/chunks/routes/api/system/monitor.get.mjs +1 -1
  150. package/.output/server/chunks/routes/api/system/settings/events.get.mjs +1 -1
  151. package/.output/server/chunks/routes/api/system/settings/reset.post.mjs +1 -1
  152. package/.output/server/chunks/routes/api/system/timezone.get.mjs +1 -1
  153. package/.output/server/chunks/routes/api/users/_id_.delete.mjs +1 -1
  154. package/.output/server/chunks/routes/api/users/_id_.get.mjs +1 -1
  155. package/.output/server/chunks/routes/api/users/_id_.put.mjs +1 -1
  156. package/.output/server/chunks/routes/api/users/change-password.post.mjs +1 -1
  157. package/.output/server/chunks/routes/api/users/index.get.mjs +1 -1
  158. package/.output/server/chunks/routes/api/users/index.post.mjs +1 -1
  159. package/.output/server/chunks/routes/api/users/login.post.mjs +1 -1
  160. package/.output/server/chunks/routes/api/users/logout.post.mjs +1 -1
  161. package/.output/server/chunks/routes/api/users/me.get.mjs +1 -1
  162. package/.output/server/chunks/routes/api/users/register.post.mjs +1 -1
  163. package/.output/server/chunks/routes/api/users/setup-status.get.mjs +1 -1
  164. package/.output/server/chunks/routes/api/users/tokens/_id/token.get.mjs +1 -1
  165. package/.output/server/chunks/routes/api/users/tokens/_id_.delete.mjs +1 -1
  166. package/.output/server/chunks/routes/api/users/tokens/_id_.patch.mjs +1 -1
  167. package/.output/server/chunks/routes/api/workshop/_...path_.mjs +1 -1
  168. package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.get.mjs +1 -1
  169. package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.post.mjs +1 -1
  170. package/.output/server/chunks/routes/api/workshop/a2a/send.post.mjs +1 -1
  171. package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs +1 -1
  172. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs +1 -1
  173. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs +1 -1
  174. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/grant.post.mjs +1 -1
  175. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/revoke.post.mjs +1 -1
  176. package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs +1 -1
  177. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +2 -2
  178. package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs +1 -1
  179. package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +1 -1
  180. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +1 -1
  181. package/.output/server/chunks/routes/api/workshop/agents/_id_.delete.mjs +1 -1
  182. package/.output/server/chunks/routes/api/workshop/agents/_id_.get.mjs +1 -1
  183. package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
  184. package/.output/server/chunks/routes/api/workshop/agents/subscribe.post.mjs +1 -1
  185. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +1 -1
  186. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs +1 -1
  187. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +1 -1
  188. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs +1 -1
  189. package/.output/server/chunks/routes/api/workshop/aml/entities/prune.post.mjs +1 -1
  190. package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs +1 -1
  191. package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs +1 -1
  192. package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs +1 -1
  193. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +1 -1
  194. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +1 -1
  195. package/.output/server/chunks/routes/api/workshop/aml/index2.get.mjs +1 -1
  196. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +1 -1
  197. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +1 -1
  198. package/.output/server/chunks/routes/api/workshop/aml/index3.post.mjs +1 -1
  199. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +1 -1
  200. package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs +1 -1
  201. package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs +1 -1
  202. package/.output/server/chunks/routes/api/workshop/aml/index7.get.mjs +1 -1
  203. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +1 -1
  204. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +1 -1
  205. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +1 -1
  206. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs +1 -1
  207. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs +1 -1
  208. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +1 -1
  209. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +1 -1
  210. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs +1 -1
  211. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs +1 -1
  212. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id/train.post.mjs +1 -1
  213. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.delete.mjs +1 -1
  214. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.patch.mjs +1 -1
  215. package/.output/server/chunks/routes/api/workshop/aml/twin/providers.get.mjs +1 -1
  216. package/.output/server/chunks/routes/api/workshop/analysis/_id_.delete.mjs +1 -1
  217. package/.output/server/chunks/routes/api/workshop/analysis/_id_.get.mjs +1 -1
  218. package/.output/server/chunks/routes/api/workshop/analysis/_id_.patch.mjs +1 -1
  219. package/.output/server/chunks/routes/api/workshop/approvals/_id/decide.post.mjs +1 -1
  220. package/.output/server/chunks/routes/api/workshop/assets/character/_id_.delete.mjs +1 -1
  221. package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
  222. package/.output/server/chunks/routes/api/workshop/assets/index.get.mjs +1 -1
  223. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +1 -1
  224. package/.output/server/chunks/routes/api/workshop/assets/index2.get.mjs +1 -1
  225. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +1 -1
  226. package/.output/server/chunks/routes/api/workshop/audit.get.mjs +1 -1
  227. package/.output/server/chunks/routes/api/workshop/caller.mjs +1 -1
  228. package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
  229. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.delete.mjs +1 -1
  230. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.get.mjs +1 -1
  231. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
  232. package/.output/server/chunks/routes/api/workshop/channel-templates/from-channel.post.mjs +1 -1
  233. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +1 -1
  234. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.get.mjs +1 -1
  235. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.post.mjs +1 -1
  236. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/_memoryId_.delete.mjs +1 -1
  237. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/search.post.mjs +1 -1
  238. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/model.patch.mjs +1 -1
  239. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/position.patch.mjs +1 -1
  240. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/range.patch.mjs +1 -1
  241. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/rotate-token.post.mjs +1 -1
  242. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/stop.post.mjs +1 -1
  243. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.delete.mjs +1 -1
  244. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
  245. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/index.get.mjs +1 -1
  246. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/index.post.mjs +1 -1
  247. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/messages/_messageId/read.post.mjs +1 -1
  248. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/permissions.get.mjs +1 -1
  249. package/.output/server/chunks/routes/api/workshop/channels/_id/events.get.mjs +1 -1
  250. package/.output/server/chunks/routes/api/workshop/channels/_id/execution-mode.patch.mjs +1 -1
  251. package/.output/server/chunks/routes/api/workshop/channels/_id/index.get.mjs +1 -1
  252. package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
  253. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +1 -1
  254. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
  255. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
  256. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.put.mjs +1 -1
  257. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
  258. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
  259. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +1 -1
  260. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.post.mjs +1 -1
  261. package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.mjs +1 -1
  262. package/.output/server/chunks/routes/api/workshop/channels/_id/index6.get.mjs +1 -1
  263. package/.output/server/chunks/routes/api/workshop/channels/_id/index7.get.mjs +1 -1
  264. package/.output/server/chunks/routes/api/workshop/channels/_id/line.put.mjs +1 -1
  265. package/.output/server/chunks/routes/api/workshop/channels/_id/members/_userId/approve.post.mjs +1 -1
  266. package/.output/server/chunks/routes/api/workshop/channels/_id/members/_userId_.delete.mjs +1 -1
  267. package/.output/server/chunks/routes/api/workshop/channels/_id/members/join.post.mjs +1 -1
  268. package/.output/server/chunks/routes/api/workshop/channels/_id/members/leave.post.mjs +1 -1
  269. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId_.delete.mjs +1 -1
  270. package/.output/server/chunks/routes/api/workshop/channels/_id/queue.get.mjs +1 -1
  271. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
  272. package/.output/server/chunks/routes/api/workshop/channels/_id/tools/reset.post.mjs +1 -1
  273. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.get.mjs +1 -1
  274. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.patch.mjs +1 -1
  275. package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
  276. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +1 -1
  277. package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +1 -1
  278. package/.output/server/chunks/routes/api/workshop/channels.get.mjs +1 -1
  279. package/.output/server/chunks/routes/api/workshop/channels.post.mjs +7 -7
  280. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
  281. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
  282. package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +1 -1
  283. package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +1 -1
  284. package/.output/server/chunks/routes/api/workshop/daq/_id/ingest.post.mjs +2 -2
  285. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
  286. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
  287. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
  288. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
  289. package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +1 -1
  290. package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs +1 -1
  291. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
  292. package/.output/server/chunks/routes/api/workshop/daq/export/_id_.get.mjs +1 -1
  293. package/.output/server/chunks/routes/api/workshop/daq/export-file.get.mjs +1 -1
  294. package/.output/server/chunks/routes/api/workshop/daq/index.get.mjs +1 -1
  295. package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +1 -1
  296. package/.output/server/chunks/routes/api/workshop/daq/index2.post.mjs +1 -1
  297. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
  298. package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +1 -1
  299. package/.output/server/chunks/routes/api/workshop/daq/query.get.mjs +1 -1
  300. package/.output/server/chunks/routes/api/workshop/daq/storage/retention.put.mjs +1 -1
  301. package/.output/server/chunks/routes/api/workshop/daq/storage/rollup.post.mjs +1 -1
  302. package/.output/server/chunks/routes/api/workshop/daq/storage.get.mjs +1 -1
  303. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
  304. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
  305. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
  306. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
  307. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
  308. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
  309. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
  310. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
  311. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
  312. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
  313. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
  314. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
  315. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
  316. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
  317. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
  318. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
  319. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
  320. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
  321. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
  322. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
  323. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
  324. package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs +1 -1
  325. package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs +1 -1
  326. package/.output/server/chunks/routes/api/workshop/dcw/index7.get.mjs +1 -1
  327. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
  328. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
  329. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
  330. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
  331. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
  332. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs +1 -1
  333. package/.output/server/chunks/routes/api/workshop/dcw/mes-artifacts/file.get.mjs +1 -1
  334. package/.output/server/chunks/routes/api/workshop/dcw/mes-hook-test.post.mjs +1 -1
  335. package/.output/server/chunks/routes/api/workshop/dcw/mes-test-read.post.mjs +1 -1
  336. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
  337. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
  338. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
  339. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
  340. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs +1 -1
  341. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs +1 -1
  342. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs +1 -1
  343. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs +1 -1
  344. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
  345. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
  346. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
  347. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
  348. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs +1 -1
  349. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
  350. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/versions.get.mjs +1 -1
  351. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
  352. package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs +1 -1
  353. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
  354. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
  355. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
  356. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
  357. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
  358. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
  359. package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
  360. package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
  361. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
  362. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
  363. package/.output/server/chunks/routes/api/workshop/eda/charts/_id_.delete.mjs +1 -1
  364. package/.output/server/chunks/routes/api/workshop/eda/charts/_id_.get.mjs +1 -1
  365. package/.output/server/chunks/routes/api/workshop/eda/charts/_id_.patch.mjs +1 -1
  366. package/.output/server/chunks/routes/api/workshop/eda/commonality.get.mjs +1 -1
  367. package/.output/server/chunks/routes/api/workshop/eda/dashboards/_id_.delete.mjs +1 -1
  368. package/.output/server/chunks/routes/api/workshop/eda/dashboards/_id_.get.mjs +1 -1
  369. package/.output/server/chunks/routes/api/workshop/eda/dashboards/_id_.patch.mjs +1 -1
  370. package/.output/server/chunks/routes/api/workshop/eda/features/jobs.get.mjs +1 -1
  371. package/.output/server/chunks/routes/api/workshop/eda/features/run.post.mjs +1 -1
  372. package/.output/server/chunks/routes/api/workshop/eda/golden/_id_.delete.mjs +1 -1
  373. package/.output/server/chunks/routes/api/workshop/eda/golden/deviation.get.mjs +1 -1
  374. package/.output/server/chunks/routes/api/workshop/eda/golden/single.get.mjs +1 -1
  375. package/.output/server/chunks/routes/api/workshop/eda/index.get.mjs +1 -1
  376. package/.output/server/chunks/routes/api/workshop/eda/index.post.mjs +1 -1
  377. package/.output/server/chunks/routes/api/workshop/eda/index2.get.mjs +1 -1
  378. package/.output/server/chunks/routes/api/workshop/eda/index2.post.mjs +1 -1
  379. package/.output/server/chunks/routes/api/workshop/eda/index3.get.mjs +1 -1
  380. package/.output/server/chunks/routes/api/workshop/eda/index3.post.mjs +1 -1
  381. package/.output/server/chunks/routes/api/workshop/eda/index4.get.mjs +1 -1
  382. package/.output/server/chunks/routes/api/workshop/eda/index4.post.mjs +1 -1
  383. package/.output/server/chunks/routes/api/workshop/eda/index5.get.mjs +1 -1
  384. package/.output/server/chunks/routes/api/workshop/eda/index5.post.mjs +1 -1
  385. package/.output/server/chunks/routes/api/workshop/eda/index6.get.mjs +1 -1
  386. package/.output/server/chunks/routes/api/workshop/eda/index6.post.mjs +1 -1
  387. package/.output/server/chunks/routes/api/workshop/eda/index7.get.mjs +1 -1
  388. package/.output/server/chunks/routes/api/workshop/eda/index7.post.mjs +1 -1
  389. package/.output/server/chunks/routes/api/workshop/eda/index8.get.mjs +1 -1
  390. package/.output/server/chunks/routes/api/workshop/eda/index8.post.mjs +1 -1
  391. package/.output/server/chunks/routes/api/workshop/eda/ocap/_id_.get.mjs +1 -1
  392. package/.output/server/chunks/routes/api/workshop/eda/ocap/_id_.patch.mjs +1 -1
  393. package/.output/server/chunks/routes/api/workshop/eda/runs/_id/labels.patch.mjs +1 -1
  394. package/.output/server/chunks/routes/api/workshop/eda/runs.get.mjs +1 -1
  395. package/.output/server/chunks/routes/api/workshop/eda/spc/_id/recompute.post.mjs +1 -1
  396. package/.output/server/chunks/routes/api/workshop/eda/spc/_id_.delete.mjs +1 -1
  397. package/.output/server/chunks/routes/api/workshop/eda/spc/_id_.get.mjs +1 -1
  398. package/.output/server/chunks/routes/api/workshop/eda/templates/_id_.delete.mjs +1 -1
  399. package/.output/server/chunks/routes/api/workshop/eda/templates/_id_.get.mjs +1 -1
  400. package/.output/server/chunks/routes/api/workshop/eda/templates/_id_.patch.mjs +1 -1
  401. package/.output/server/chunks/routes/api/workshop/eda/vm/predict.post.mjs +1 -1
  402. package/.output/server/chunks/routes/api/workshop/exp/confirmations/_id/decide.post.mjs +1 -1
  403. package/.output/server/chunks/routes/api/workshop/exp/index.get.mjs +1 -1
  404. package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
  405. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
  406. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
  407. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
  408. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
  409. package/.output/server/chunks/routes/api/workshop/index.get.mjs +1 -1
  410. package/.output/server/chunks/routes/api/workshop/index.mjs +1 -1
  411. package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
  412. package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
  413. package/.output/server/chunks/routes/api/workshop/index10.get.mjs +1 -1
  414. package/.output/server/chunks/routes/api/workshop/index10.post.mjs +1 -1
  415. package/.output/server/chunks/routes/api/workshop/index11.get.mjs +1 -1
  416. package/.output/server/chunks/routes/api/workshop/index12.get.mjs +1 -1
  417. package/.output/server/chunks/routes/api/workshop/index13.get.mjs +1 -1
  418. package/.output/server/chunks/routes/api/workshop/index14.get.mjs +1 -1
  419. package/.output/server/chunks/routes/api/workshop/index15.get.mjs +1 -1
  420. package/.output/server/chunks/routes/api/workshop/index16.get.mjs +1 -1
  421. package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
  422. package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
  423. package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
  424. package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
  425. package/.output/server/chunks/routes/api/workshop/index4.get.mjs +1 -1
  426. package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
  427. package/.output/server/chunks/routes/api/workshop/index5.get.mjs +1 -1
  428. package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
  429. package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
  430. package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
  431. package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
  432. package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
  433. package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
  434. package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
  435. package/.output/server/chunks/routes/api/workshop/index9.get.mjs +1 -1
  436. package/.output/server/chunks/routes/api/workshop/index9.post.mjs +1 -1
  437. package/.output/server/chunks/routes/api/workshop/mailbox/all.get.mjs +1 -1
  438. package/.output/server/chunks/routes/api/workshop/mailbox.get.mjs +1 -1
  439. package/.output/server/chunks/routes/api/workshop/memories/maintenance.post.mjs +1 -1
  440. package/.output/server/chunks/routes/api/workshop/mes/datasets.get.mjs +1 -1
  441. package/.output/server/chunks/routes/api/workshop/mes/index.get.mjs +1 -1
  442. package/.output/server/chunks/routes/api/workshop/mes/index.put.mjs +1 -1
  443. package/.output/server/chunks/routes/api/workshop/mes/points.get.mjs +1 -1
  444. package/.output/server/chunks/routes/api/workshop/mes/preview.post.mjs +1 -1
  445. package/.output/server/chunks/routes/api/workshop/mes/secrets/_ref_.delete.mjs +1 -1
  446. package/.output/server/chunks/routes/api/workshop/notifications/read.post.mjs +1 -1
  447. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/autofix.mjs +1 -1
  448. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs +1 -1
  449. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs +1 -1
  450. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs +1 -1
  451. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs +1 -1
  452. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs +1 -1
  453. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs +1 -1
  454. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/subgraph.mjs +1 -1
  455. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs +1 -1
  456. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs +1 -1
  457. package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs +1 -1
  458. package/.output/server/chunks/routes/api/workshop/ontology/index.mjs +1 -1
  459. package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs +1 -1
  460. package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs +1 -1
  461. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs +1 -1
  462. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs +1 -1
  463. package/.output/server/chunks/routes/api/workshop/optimization/bindings/_id_.delete.mjs +1 -1
  464. package/.output/server/chunks/routes/api/workshop/optimization/capabilities.get.mjs +1 -1
  465. package/.output/server/chunks/routes/api/workshop/optimization/index.get.mjs +1 -1
  466. package/.output/server/chunks/routes/api/workshop/optimization/index.mjs +1 -1
  467. package/.output/server/chunks/routes/api/workshop/optimization/index2.mjs +1 -1
  468. package/.output/server/chunks/routes/api/workshop/optimization/profiles/_id/publish.post.mjs +1 -1
  469. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/crosscheck.post.mjs +1 -1
  470. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/dispatch.post.mjs +1 -1
  471. package/.output/server/chunks/routes/api/workshop/optimization/solve.post.mjs +1 -1
  472. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
  473. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
  474. package/.output/server/chunks/routes/api/workshop/plugins/index.get.mjs +1 -1
  475. package/.output/server/chunks/routes/api/workshop/process-model/datasets.post.mjs +1 -1
  476. package/.output/server/chunks/routes/api/workshop/process-model/eligibility.mjs +1 -1
  477. package/.output/server/chunks/routes/api/workshop/process-model/experiments.mjs +370 -20
  478. package/.output/server/chunks/routes/api/workshop/process-model/experiments.mjs.map +1 -1
  479. package/.output/server/chunks/routes/api/workshop/process-model/index.mjs +1 -1
  480. package/.output/server/chunks/routes/api/workshop/process-model/specs/_id/publish.post.mjs +1 -1
  481. package/.output/server/chunks/routes/api/workshop/process-model/train.post.mjs +1 -1
  482. package/.output/server/chunks/routes/api/workshop/runtime.get.mjs +1 -1
  483. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
  484. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
  485. package/.output/server/chunks/routes/api/workshop/scene/layouts.get.mjs +1 -1
  486. package/.output/server/chunks/routes/api/workshop/schedules/_id/run.post.mjs +1 -1
  487. package/.output/server/chunks/routes/api/workshop/schedules/_id/runs.get.mjs +1 -1
  488. package/.output/server/chunks/routes/api/workshop/schedules/_id_.delete.mjs +1 -1
  489. package/.output/server/chunks/routes/api/workshop/schedules/_id_.get.mjs +1 -1
  490. package/.output/server/chunks/routes/api/workshop/schedules/_id_.patch.mjs +1 -1
  491. package/.output/server/chunks/routes/api/workshop/tasks/_id/complete.post.mjs +1 -1
  492. package/.output/server/chunks/routes/api/workshop/tasks/_id/dispatch.post.mjs +1 -1
  493. package/.output/server/chunks/routes/api/workshop/tasks/_id/index.post.mjs +1 -1
  494. package/.output/server/chunks/routes/api/workshop/tasks/_id/reassign.post.mjs +1 -1
  495. package/.output/server/chunks/routes/api/workshop/tasks/_id/reopen.post.mjs +1 -1
  496. package/.output/server/chunks/routes/api/workshop/tasks/_id/report.post.mjs +1 -1
  497. package/.output/server/chunks/routes/api/workshop/tasks/_id/retry.post.mjs +1 -1
  498. package/.output/server/chunks/routes/api/workshop/tasks/_id/supersede.post.mjs +1 -1
  499. package/.output/server/chunks/routes/api/workshop/tasks/_id/update.post.mjs +1 -1
  500. package/.output/server/chunks/routes/api/workshop/tasks/_id_.get.mjs +1 -1
  501. package/.output/server/chunks/routes/api/workshop/tasks.get.mjs +1 -1
  502. package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
  503. package/.output/server/chunks/routes/api/workshop/teams/_id/index.get.mjs +1 -1
  504. package/.output/server/chunks/routes/api/workshop/teams/_id/index.post.mjs +1 -1
  505. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +1 -1
  506. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +1 -1
  507. package/.output/server/chunks/routes/api/workshop/teams/_id/members/_agentId_.delete.mjs +1 -1
  508. package/.output/server/chunks/routes/api/workshop/teams/_id_.delete.mjs +1 -1
  509. package/.output/server/chunks/routes/api/workshop/teams/_id_.get.mjs +1 -1
  510. package/.output/server/chunks/routes/api/workshop/teams/_id_.patch.mjs +1 -1
  511. package/.output/server/chunks/routes/api/workshop/tools/_name_.get.mjs +1 -1
  512. package/.output/server/chunks/routes/api/workshop/tools/sync.post.mjs +1 -1
  513. package/.output/server/chunks/routes/api/workshop/users/me.get.mjs +1 -1
  514. package/.output/server/chunks/routes/api/workshop/users/register.post.mjs +1 -1
  515. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
  516. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.delete.mjs +1 -1
  517. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.post.mjs +1 -1
  518. package/.output/server/chunks/routes/api/workshop/workspaces/index.delete.mjs +1 -1
  519. package/.output/server/chunks/routes/renderer.mjs +2 -2
  520. package/.output/server/chunks/virtual/entry.mjs +5 -1
  521. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  522. package/.output/server/index.mjs +1 -1
  523. package/.output/server/package.json +1 -1
  524. package/README-zh.md +3 -3
  525. package/README.md +3 -3
  526. package/config.yml +1 -1
  527. package/docs/aml.md +112 -112
  528. package/docs/cli.en.md +4 -4
  529. package/docs/cli.md +3 -3
  530. package/docs/plugins.en.md +1 -1
  531. package/docs/plugins.md +1 -1
  532. package/docs/sdk.en.md +1 -1
  533. package/docs/sdk.md +1 -1
  534. package/i18n/locales/en.ts +2 -0
  535. package/i18n/locales/zh-CN.ts +2 -0
  536. package/package.json +1 -1
  537. package/scripts/_audit/demo-shot-studio.mjs +37 -0
  538. package/scripts/_audit/demo-shots.mjs +38 -0
  539. package/scripts/_audit/gen-demo-report.py +69 -0
  540. package/scripts/_audit/mqtt-pub.mjs +13 -0
  541. package/scripts/_audit/mqtt-topic-probe.mjs +15 -0
  542. package/scripts/_audit/proto-b3-device-4021.mjs +90 -0
  543. package/scripts/_audit/proto-doc-device-4120.mjs +53 -0
  544. package/scripts/acceptance-scientific-loop.ts +240 -0
  545. package/scripts/generate-identifiability-fixtures.ts +98 -0
  546. package/server/api/workshop/process-model/experiments.ts +28 -2
  547. package/server/plugins-builtin/diag-bridge/host/plugin.mjs +759 -753
  548. package/server/plugins-builtin/rag-bridge/index.mjs +490 -484
  549. package/server/repositories/user.repository.ts +24 -1
  550. package/server/services/user.service.ts +8 -6
  551. package/server/services/workshop/agents/host-tool-bridge/catalog.ts +2 -0
  552. package/server/services/workshop/agents/host-tool-bridge/tools/industrial.ts +4 -1
  553. package/server/services/workshop/agents/host-tool-bridge/tools/messaging.ts +5 -1
  554. package/server/services/workshop/agents/industrial/aml-dataset-tools.ts +3 -0
  555. package/server/services/workshop/agents/industrial/bench-approval-only.ts +335 -58
  556. package/server/services/workshop/agents/industrial/dcw-tools.ts +7 -1
  557. package/server/services/workshop/agents/industrial/identifiability-tools.ts +247 -0
  558. package/server/services/workshop/agents/industrial/index.ts +1 -0
  559. package/server/services/workshop/agents/industrial/manual-approval.ts +3 -1
  560. package/server/services/workshop/agents/industrial/ops-tools.ts +58 -15
  561. package/server/services/workshop/agents/industrial/optimization-tools.ts +49 -19
  562. package/server/services/workshop/agents/plugin-governance.ts +22 -2
  563. package/server/services/workshop/aml/action-coverage.ts +253 -0
  564. package/server/services/workshop/aml/causal-claim.ts +68 -0
  565. package/server/services/workshop/aml/dataset-builder.ts +19 -0
  566. package/server/services/workshop/aml/gates.ts +45 -1
  567. package/server/services/workshop/aml/identifiability.ts +335 -0
  568. package/server/services/workshop/aml/intervention-ledger.ts +289 -0
  569. package/server/services/workshop/aml/ontology-learning.ts +143 -0
  570. package/server/services/workshop/aml/twin/cross-check-service.ts +114 -0
  571. package/server/services/workshop/aml/twin/cross-check.ts +176 -0
  572. package/server/services/workshop/daq/daq-controller/contracts.ts +3 -0
  573. package/server/services/workshop/daq/daq-controller/crud.ts +12 -2
  574. package/server/services/workshop/daq/daq-controller/push.ts +22 -0
  575. package/server/services/workshop/daq/drivers/mqtt.ts +28 -0
  576. package/server/services/workshop/daq/drivers/shared.ts +6 -0
  577. package/server/services/workshop/db/database/open.ts +2 -0
  578. package/server/services/workshop/db/database/rows.ts +4 -1
  579. package/server/services/workshop/db/database/schema.ts +38 -2
  580. package/server/services/workshop/db/message.repo.ts +10 -3
  581. package/server/services/workshop/dcw/dcw-controller/write-audit.ts +21 -1
  582. package/server/services/workshop/process-model/experiment-runner.ts +437 -0
  583. package/server/services/workshop/process-model/experiment.ts +31 -10
  584. package/server/services/workshop/process-model/plan-safety.ts +69 -0
  585. package/server/services/workshop/runtime/agent-runtime/lifecycle.ts +34 -11
  586. package/server/services/workshop/runtime/agent-runtime/state.ts +6 -1
  587. package/server/services/workshop/settings.ts +4 -1
  588. package/server/services/workshop/types/a2a.ts +16 -1
  589. package/shared/config/schema.json +2 -0
  590. package/shared/dcw-protocol/closed-loop.ts +2 -0
  591. package/.output/public/_nuxt/builds/meta/1231252d-2864-43c0-83b2-4e70d3b86dea.json +0 -1
@@ -1,484 +1,490 @@
1
- /**
2
- * rag-bridge —— rag-knowledge 知识库桥接插件。
3
- *
4
- * 把本地 rag-knowledge 服务(FastAPI 后端 + Nuxt web)集成为 AgentWorkShop 的
5
- * 团队知识库:启动即确保「aw-industrial」知识库存在,并向 agent 注入三个工具——
6
- * kb_agent(知识库 Agent 对话)——检索/入库/经验全部由知识库内部 Agent 处理。
7
- * 另开放 /health、/search、/experience 三个插件 API 便于运维探查。
8
- * 服务不可达时工具返回 isError 文本(含原因与修复建议),绝不抛异常拖垮宿主。
9
- */
10
- const KB_NAME = 'aw-industrial'
11
- const DEFAULT_BASE = 'http://127.0.0.1:8770' // FastAPI 后端
12
- const DEFAULT_WEB = 'http://127.0.0.1:6789' // Nuxt web(文档写盘)
13
-
14
- export default {
15
- name: 'rag-bridge',
16
- version: '2.1.0',
17
- description: 'rag-knowledge 知识库桥接 v2.1:kb_agent 对话工具(功能解耦,sync/async 双模式)+ kb_agent_status 异步结果查询',
18
- auth: 'user', // 平台转发层按此声明统一校验(缺省 'none' 开放)
19
- client: './client.mjs', // 前端面板(插件页注入;i18n 见 i18n.json)
20
- // 插件配置分组:插件调用平台 API 增加自己的设置分区(设置页独立成区、可折叠)。
21
- // id 由宿主收敛进 plugin-rag-bridge* 命名空间,不会与其它插件/平台分组撞车;
22
- // 插件卸载或停用时这两个分区随之消失,不残留空区块。
23
- configGroups: [
24
- { id: 'default', labelKey: 'plugin.rag-bridge.group.conn', label: 'rag-knowledge 连接', description: '后端与 Web 地址(保存即热生效)', order: 400 },
25
- { id: 'auth', labelKey: 'plugin.rag-bridge.group.auth', label: 'rag-knowledge 鉴权', description: '服务端开启鉴权时所需 Token', order: 410, collapsed: true },
26
- ],
27
- // 插件设置声明:key 强制编址 plugins.rag-bridge.<key>,进 SystemConfigService 后
28
- // 前端设置页自动渲染(labelKey 解析 i18n.json 的 plugin.rag-bridge.settings.*);
29
- // group 指向上面声明的分区 → 字段按分区隔离展示
30
- settings: [
31
- { key: 'base_url', type: 'string', default: DEFAULT_BASE, group: 'default', labelKey: 'plugin.rag-bridge.settings.base_url', label: 'rag-knowledge 后端地址', description: 'FastAPI 后端(http/https,host 限 127.0.0.1/localhost);保存即热生效' },
32
- { key: 'web_url', type: 'string', default: DEFAULT_WEB, group: 'default', labelKey: 'plugin.rag-bridge.settings.web_url', label: 'rag-knowledge Web 地址', description: 'Nuxt Web(文档写盘/目录);保存即热生效' },
33
- { key: 'token', type: 'string', default: '', group: 'auth', labelKey: 'plugin.rag-bridge.settings.token', label: 'rag-knowledge API Token', description: '服务端开启鉴权时的 MCP/API Token(Authorization: Bearer);空=匿名;保存即热生效' },
34
- ],
35
- async setup(ctx) {
36
- // ---- 运行态 ----
37
- const state = { outbound: true } // base_url 非法时禁用全部出站调用
38
- const base = () => trimSlash(String(ctx.config?.get?.('plugins.rag-bridge.base_url') || ctx.kv.get('kb.base_url') || DEFAULT_BASE))
39
- const web = () => trimSlash(String(ctx.config?.get?.('plugins.rag-bridge.web_url') || ctx.kv.get('kb.web_url') || DEFAULT_WEB))
40
- const kbId = () => String(ctx.kv.get('kb.id') || '')
41
- // 鉴权 token(系统配置优先,kv 兜底):rag-knowledge 开启 server.auth 时所有 /api/*
42
- // 要求 Bearer;backend 与 web 都认 Authorization: Bearer / X-KB-Token 两种头
43
- const kbToken = () => String(ctx.config?.get?.('plugins.rag-bridge.token') || ctx.kv.get('kb.token') || '').trim()
44
- const authHeaders = () => {
45
- const t = kbToken()
46
- return t ? { 'authorization': `Bearer ${t}`, 'x-kb-token': t } : {}
47
- }
48
-
49
- // ---- kv 默认值(幂等) ----
50
- if (ctx.kv.get('kb.base_url') == null) ctx.kv.set('kb.base_url', DEFAULT_BASE)
51
- if (ctx.kv.get('kb.web_url') == null) ctx.kv.set('kb.web_url', DEFAULT_WEB)
52
- ctx.kv.set('kb.name', KB_NAME)
53
-
54
- // base_url 守卫:仅 http/https 且 host 必须是 127.0.0.1/localhost(不合法则禁用出站)。
55
- // 每次配置变更都重算 —— 否则改错地址后旧判定会一直沿用,「独立配置即时生效」不成立。
56
- const applyOutboundGuard = () => {
57
- try {
58
- const u = new URL(base())
59
- if ((u.protocol !== 'http:' && u.protocol !== 'https:') || !['127.0.0.1', 'localhost'].includes(u.hostname)) {
60
- throw new Error(`base_url 必须是 http(s)://127.0.0.1|localhost,实际 ${base()}`)
61
- }
62
- state.outbound = true
63
- }
64
- catch (err) {
65
- state.outbound = false
66
- ctx.logger.error(`出站调用已禁用:${err?.message ?? err}(修正 rag-bridge 的「后端地址」后即恢复)`)
67
- }
68
- }
69
- applyOutboundGuard()
70
- // 配置热更新(runtime-settings 变更)→ 立即重算出站开关与下次探活
71
- ctx.config.onChange(() => applyOutboundGuard())
72
-
73
- // ---- ensureKB:幂等初始化(失败仅告警,不阻塞装载) ----
74
- try {
75
- await ensureKB()
76
- ctx.logger.info(`rag-bridge 就绪:kb=${KB_NAME}(${kbId() || '待建'}),出站=${state.outbound ? '启用' : '禁用'}`)
77
- }
78
- catch (err) {
79
- ctx.logger.warn(`ensureKB 未完成(不影响装载,工具会在服务可用后按需重试):${err?.message ?? err}`)
80
- }
81
-
82
- // ================= 出站 HTTP(重试 + 超时 + success 断言) =================
83
-
84
- function sleep(ms) {
85
- return new Promise(resolve => ctx.timer.setTimeout(resolve, ms))
86
- }
87
-
88
- /** 单次 JSON 请求;429/网络错误按 1s*重试次数退避,最多重试 2 次;检索类调用方传 timeoutMs:30000 */
89
- async function callJson(method, url, body, { timeoutMs = 15000, retries = 2, headers = {} } = {}) {
90
- let lastErr = ''
91
- const h = { ...authHeaders(), ...headers }
92
- for (let attempt = 0; attempt <= retries; attempt++) {
93
- if (attempt > 0) await sleep(1000 * attempt) // 退避 1s*n
94
- try {
95
- const res = method === 'GET'
96
- ? await ctx.http.get(url, { timeoutMs, headers: h })
97
- : await ctx.http.post(url, body ?? {}, { timeoutMs, headers: h })
98
- if (res.status === 429) {
99
- lastErr = `HTTP 429(限流)`
100
- continue
101
- }
102
- if (!res.ok) return { ok: false, status: res.status, error: `HTTP ${res.status}` }
103
- const json = await res.json().catch(() => null)
104
- if (json == null) return { ok: false, status: res.status, error: '响应不是合法 JSON' }
105
- return { ok: true, status: res.status, body: json }
106
- }
107
- catch (err) {
108
- lastErr = err?.message ?? String(err) // 网络错误/超时(AbortSignal.timeout)
109
- }
110
- }
111
- return { ok: false, error: lastErr || '未知错误' }
112
- }
113
-
114
- /** rag 业务调用:铁律——HTTP 200 但 body.success !== true 一律视为失败 */
115
- async function ragCall(method, url, body, opts = {}) {
116
- const r = await callJson(method, url, body, opts)
117
- if (!r.ok) return r
118
- if (r.body?.success !== true) {
119
- return { ok: false, error: `服务返回 success!=true:${JSON.stringify(r.body).slice(0, 200)}` }
120
- }
121
- return r
122
- }
123
-
124
- const outboundOff = () => ({ ok: false, error: '出站调用已禁用:kv["kb.base_url"] 非法(仅允许 http/https 且 host 为 127.0.0.1/localhost)' })
125
-
126
- // ================= 异步任务生命周期(提交 → 跟踪 → 进度/结果 → 回执) =================
127
- // rag-knowledge web 的任务登记表是进程内 Map(TTL 2h / 200 条),进程重启即丢失;
128
- // 这里把 task_id 与发起者归因落到插件 kv,15s 轮询终态并主动投递平台通告 ——
129
- // 否则 Agent 提交 async 入库后不主动轮询就永远不知道结果。
130
- const KB_TASK_PREFIX = 'kbtask:'
131
- const KB_TASK_TTL_MS = 3 * 60 * 60 * 1000
132
- let kbPolling = false
133
-
134
- const kbTaskKey = id => KB_TASK_PREFIX + id
135
-
136
- async function kbNotify() {
137
- try {
138
- return await ctx.services.get('notify')
139
- }
140
- catch {
141
- return null
142
- }
143
- }
144
-
145
- async function queryKbTask(taskId) {
146
- const r = await callJson('GET', web() + '/api/kb/agent/tasks/' + encodeURIComponent(taskId), null, { timeoutMs: 15000, retries: 0 })
147
- if (!r.ok) return { ok: false, error: String(r.error ?? ''), status: r.status }
148
- const body = r.body || {}
149
- return {
150
- ok: true,
151
- status: String(body.status ?? 'unknown'),
152
- reply: String(body.result?.reply ?? body.result?.partial_text ?? '').trim(),
153
- error: String(body.result?.error ?? '').slice(0, 600),
154
- }
155
- }
156
-
157
- async function deliverKbTask(task, ok, summary) {
158
- // 无发起者归因(手动调用/旧任务)→ 无收件人,跳过平台回执
159
- if (!task.agentId) return false
160
- const notify = await kbNotify()
161
- if (!notify) {
162
- ctx.logger.warn(`知识库任务 ${task.taskId} 已结束,但平台通告面不可用(可用 kb_agent_status 查询)`)
163
- return false
164
- }
165
- try {
166
- const delivered = await notify.deliver({
167
- kind: 'tool-result',
168
- tool: 'kb_agent',
169
- jobId: task.taskId,
170
- agentId: task.agentId,
171
- ...(task.channelId ? { channelId: task.channelId } : {}),
172
- ok,
173
- title: `知识库任务${ok ? '完成' : '失败'}`,
174
- summary: String(summary || (ok ? '(知识库 Agent 返回空结果)' : '任务失败')).slice(0, 900),
175
- })
176
- return delivered !== false
177
- }
178
- catch (err) {
179
- ctx.logger.warn(`知识库任务 ${task.taskId} 回执投递失败:${err?.message ?? err}`)
180
- return false
181
- }
182
- }
183
-
184
- async function pollKbTasks() {
185
- if (kbPolling || !state.outbound) return
186
- kbPolling = true
187
- try {
188
- const entries = Object.entries(ctx.kv.all())
189
- .filter(([k, v]) => k.startsWith(KB_TASK_PREFIX) && v && typeof v === 'object' && !v.deliveredAt)
190
- for (const [key, task] of entries) {
191
- if (!task.taskId) continue
192
- if (Date.now() - Number(task.createdAt || 0) > KB_TASK_TTL_MS) {
193
- await deliverKbTask(task, false, '任务超过 3 小时仍未结束,已停止跟踪;可稍后用 kb_agent_status 再查一次。')
194
- ctx.kv.set(key, { ...task, status: 'expired', error: '超过 3 小时未完成', deliveredAt: Date.now() })
195
- continue
196
- }
197
- const q = await queryKbTask(task.taskId)
198
- if (!q.ok) {
199
- const attempts = Number(task.pollErrors || 0) + 1
200
- // 404 = web 重启/任务被淘汰;连续 3 轮仍查不到 → 收敛为 failed 并回执
201
- if (/HTTP 404/.test(q.error) && attempts >= 3) {
202
- await deliverKbTask(task, false, `任务已无法查询(HTTP 404,可能因 web 重启或超过 2h 淘汰):${q.error}`)
203
- ctx.kv.set(key, { ...task, status: 'failed', error: q.error, pollErrors: attempts, deliveredAt: Date.now() })
204
- }
205
- else {
206
- ctx.kv.set(key, { ...task, pollErrors: attempts, lastPollError: q.error })
207
- }
208
- continue
209
- }
210
- if (q.status === 'running' || q.status === 'queued') {
211
- ctx.kv.set(key, { ...task, status: q.status, pollErrors: 0 })
212
- continue
213
- }
214
- const okStatus = q.status === 'completed'
215
- await deliverKbTask(task, okStatus, okStatus ? q.reply : `任务以 ${q.status} 结束:${q.error || '(无错误详情)'}`)
216
- ctx.kv.set(key, {
217
- ...task,
218
- status: q.status,
219
- reply: q.reply.slice(0, 2000),
220
- error: q.error,
221
- deliveredAt: Date.now(),
222
- deliverPending: false,
223
- })
224
- }
225
- }
226
- catch (err) {
227
- ctx.logger.warn(`知识库任务轮询异常(下轮继续):${err?.message ?? err}`)
228
- }
229
- finally {
230
- kbPolling = false
231
- }
232
- }
233
-
234
- // ================= ensureKB(catalog 查找 → 建库 → experience init) =================
235
-
236
- async function ensureKB() {
237
- // ① catalog 查找同名库(响应 {success,count,knowledgeBases:[{kbId,name,...}]})
238
- const cat = state.outbound
239
- ? await callJson('GET', `${web()}/api/kb/catalog`, null, { timeoutMs: 10000 })
240
- : { ok: false, error: '出站已禁用' }
241
- if (cat.ok) {
242
- const list = Array.isArray(cat.body?.knowledgeBases) ? cat.body.knowledgeBases : []
243
- const hit = list.find(kb => kb?.name === KB_NAME)
244
- if (hit?.kbId) ctx.kv.set('kb.id', hit.kbId)
245
- }
246
- else {
247
- ctx.logger.warn(`catalog 不可达(${cat.error}),跳过查找直接尝试建库`)
248
- }
249
- // ② 无则建库(响应 {success,knowledgeBase:{id,name,path,...}})
250
- if (!kbId()) {
251
- const created = state.outbound
252
- ? await ragCall('POST', `${web()}/api/kb/create`, { name: KB_NAME, description: 'AgentWorkShop 工业知识库(诊断报告/经验教训/操作规范)' }, { timeoutMs: 15000 })
253
- : { ok: false, error: '出站已禁用' }
254
- if (!created.ok) throw new Error(`创建知识库 ${KB_NAME} 失败:${created.error}`)
255
- const id = created.body?.knowledgeBase?.id
256
- if (!id) throw new Error(`建库响应缺少 knowledgeBase.id:${JSON.stringify(created.body).slice(0, 200)}`)
257
- ctx.kv.set('kb.id', id)
258
- }
259
- // ③ 经验文件夹初始化(容忍已初始化/失败:仅告警)
260
- const init = state.outbound
261
- ? await ragCall('POST', `${base()}/api/v1/experience/${kbId()}/init`, {}, { timeoutMs: 15000 })
262
- : { ok: false, error: '出站已禁用' }
263
- if (!init.ok) ctx.logger.warn(`experience init 未成功(可忽略或稍后手动重试):${init.error}`)
264
- }
265
-
266
- /** 工具侧兜底:kv 无 kb.id 时按需重跑 ensureKB */
267
- async function requireKbId() {
268
- if (kbId()) return kbId()
269
- await ensureKB()
270
- if (kbId()) return kbId()
271
- return null
272
- }
273
-
274
- // ================= 工具 ×1(kb_agent —— 功能解耦的唯一入口) =================
275
- // 外部系统不再拼装检索/入库步骤:一个对话工具把任务原话交给 rag-knowledge
276
- // 的原生 Agent(claude SDK + QDCVR skill + kb-mcp),检索/入库/经验/图谱全部
277
- // 由知识库内部 Agent 自主完成,直接返回最终结果。
278
-
279
- ctx.omp.registerTool({
280
- name: 'kb_agent',
281
- label: '知识库Agent',
282
- description: '与 rag-knowledge 知识库的原生 Agent 对话(知识库操作唯一入口,功能解耦)。把任务原话交给它:检索问答(知识库侧自动走 QDCVR 全流程,返回带引用的可信答案)、文档入库(给出标题与完整 markdown 正文,action=ingest)、经验沉淀(action=ingest)、图谱关联等,全部由知识库内部 Agent 自主处理并返回最终结果。入库类动作会进入平台审批(HITL),批准后才提交。',
283
- parameters: {
284
- type: 'object',
285
- properties: {
286
- prompt: { type: 'string', description: '给知识库 Agent 的完整任务原话。检索:要查的问题;入库:目标知识库名(缺省 aw-industrial)+文档标题+完整 markdown 正文;经验:标题/类别/问题/解决方案' },
287
- mode: { type: 'string', enum: ['sync', 'async'], description: '执行方式(按场景自选):sync 同步等待知识库执行完并返回结果(检索问答用,需要立刻拿到答案);async 异步——立即返回 task_id,知识库在后台完成任务,完成后可用 kb_agent_status 查询该 task 的结果(入库/经验沉淀类用,无需等待)' },
288
- action: { type: 'string', enum: ['query', 'ingest'], description: '动作类别:query=只读检索问答(缺省);ingest=写知识库(文档入库/经验沉淀),平台会挂 HITL 审批单,批准前不提交后端。入库务必显式声明 action=ingest。' },
289
- },
290
- required: ['prompt'],
291
- },
292
- roles: ['lead', 'worker'],
293
- riskClass: 'write',
294
- noRefs: true,
295
- handler: async (args, agent) => {
296
- if (!state.outbound) {
297
- return { text: '知识库 Agent 不可用:' + outboundOff().error + '。修复后重启服务。', isError: true }
298
- }
299
- const prompt = String(args.prompt ?? '').trim()
300
- if (!prompt) return { text: 'prompt 必填(把要做的任务完整描述给知识库 Agent)。', isError: true }
301
- const mode = String(args.mode ?? '').trim().toLowerCase() === 'async' ? 'async' : 'sync'
302
- // 权限档由服务端固定(不再接受调用方透传):历史参数 permission/harness 一律忽略。
303
- // 缺省 'default' 标准审批档;此前缺省传递 bypassPermissions 允许 Agent 自行提权。
304
- const body = { prompt, timeout_ms: 540000, mode, permission: 'default' }
305
-
306
- if (mode === 'async') {
307
- // 异步:立即返回 task_id,知识库后台完成;结果稍后用 kb_agent_status 查询
308
- const sub = await ragCall('POST', web() + '/api/kb/agent/chat', body, { timeoutMs: 30000, retries: 0 })
309
- if (!sub.ok) {
310
- return { text: '知识库异步任务提交失败:' + String(sub.error ?? '').slice(0, 200) + '。请确认 rag-knowledge web(' + web() + ') 已启动后重试。', isError: true }
311
- }
312
- const taskId = String(sub.body?.task_id ?? '')
313
- if (!taskId) return { text: '知识库异步任务提交异常:响应缺少 task_id。', isError: true }
314
- // 落 kv:异步任务与发起者归因,供后台轮询主动回执;进程重启后仍可继续跟踪
315
- ctx.kv.set(kbTaskKey(taskId), {
316
- taskId,
317
- createdAt: Date.now(),
318
- status: 'running',
319
- agentId: agent?.agentId ?? '',
320
- channelId: agent?.channelId ?? '',
321
- prompt: prompt.slice(0, 160),
322
- })
323
- return { text: '已提交知识库异步任务(后台执行中,无需等待):\ntask_id=' + taskId + '\n完成后平台会自动回执到你的信箱并唤醒你;空闲时也可调用 kb_agent_status(task_id, wait_seconds=120) 等待并获取结果。' }
324
- }
325
-
326
- // 同步请求禁止网络重试:POST 可能已在知识库侧启动回合,重试会重复入库/重复生成
327
- const r = await ragCall('POST', web() + '/api/kb/agent/chat', body, { timeoutMs: 580000, retries: 0 })
328
- if (!r.ok) {
329
- return { text: '知识库 Agent 调用失败:' + String(r.error ?? '').slice(0, 200) + '。请确认 rag-knowledge web(' + web() + ') 已启动后重试。', isError: true }
330
- }
331
- const reply = String(r.body?.reply ?? '').trim()
332
- return { text: reply || '(知识库 Agent 返回空回复)' }
333
- },
334
- })
335
-
336
- ctx.omp.registerTool({
337
- name: 'kb_agent_status',
338
- label: '知识库任务状态',
339
- description: '查询知识库异步任务的执行状态与结果(kb_agent 以 mode=async 提交后,用返回的 task_id 查询;任务完成后返回知识库 Agent 的完整结果)。可传 wait_seconds 最长等 120s:任务在窗口内完成则直接返回结果,免反复轮询。',
340
- parameters: {
341
- type: 'object',
342
- properties: {
343
- task_id: { type: 'string', description: 'kb_agent 异步提交时返回的 task_id' },
344
- wait_seconds: { type: 'number', description: '长轮询等待秒数(0=立即返回,默认 0,上限 120);入库类任务建议 90~120' },
345
- },
346
- required: ['task_id'],
347
- },
348
- roles: ['lead', 'worker'],
349
- handler: async (args) => {
350
- if (!state.outbound) {
351
- return { text: '知识库 Agent 不可用:' + outboundOff().error + '。修复后重启服务。', isError: true }
352
- }
353
- const taskId = String(args.task_id ?? '').trim()
354
- if (!taskId) return { text: 'task_id 必填(kb_agent 异步提交时返回的 id)。', isError: true }
355
- const waitSec = Math.min(Math.max(Math.round(Number(args.wait_seconds ?? 0) || 0), 0), 120)
356
- const finish = async (reply, ok) => {
357
- // 终态由轮询面亲自看到 → 认领回执所有权,取消后台补送(先到先得)
358
- try {
359
- const notify = await kbNotify()
360
- notify?.claim?.('kb_agent', taskId)
361
- }
362
- catch { /* 未接线时忽略 */ }
363
- const known = ctx.kv.get(kbTaskKey(taskId))
364
- if (known) ctx.kv.set(kbTaskKey(taskId), { ...known, deliveredAt: Date.now(), deliveredBy: 'kb_agent_status', ...(ok != null ? { status: ok ? 'completed' : 'failed' } : {}) })
365
- return reply
366
- }
367
- const queryOnce = async () => {
368
- const q = await queryKbTask(taskId)
369
- if (!q.ok) {
370
- return { text: '任务查询失败:' + q.error + '(不存在/已过期 2h/服务重启过,或任务从未提交)。', isError: true }
371
- }
372
- if (q.status === 'running' || q.status === 'queued') return null
373
- if (q.status === 'completed') {
374
- return { text: await finish('任务 ' + taskId + ' 已完成。知识库 Agent 结果:\n\n' + (q.reply || '(知识库 Agent 返回空结果)'), true) }
375
- }
376
- return { text: await finish('任务 ' + taskId + ' 状态:' + q.status + '\n' + (q.error || '(无错误详情)'), false) }
377
- }
378
- // 长轮询:5s 步进,窗口内完成即返回结果
379
- const deadline = Date.now() + waitSec * 1000
380
- for (;;) {
381
- const got = await queryOnce()
382
- if (got) return got
383
- if (Date.now() >= deadline) {
384
- return { text: '任务 ' + taskId + ' 仍在后台执行中(running,已等待 ' + waitSec + 's)。稍后再次查询;完成后平台也会自动回执。' }
385
- }
386
- await sleep(5000)
387
- }
388
- },
389
- })
390
-
391
- // 后台轮询:15s 一次,终态主动回执(与 diag-bridge sweep 同构)
392
- ctx.timer.setInterval(() => {
393
- pollKbTasks().catch(err => ctx.logger.warn(`知识库任务轮询异常(继续):${err?.message ?? err}`))
394
- }, 15000)
395
- pollKbTasks().catch(() => {})
396
-
397
- // ================= 插件 API ×3(/api/plugins/rag-bridge/**) =================
398
-
399
- /** 从 h3 event 取查询参数(转发层只预挂 awBody;query 在 event.path 上) */
400
- function queryOf(event) {
401
- const raw = String(event?.path ?? event?.node?.req?.url ?? '')
402
- const q = {}
403
- try {
404
- const u = new URL(raw, 'http://local')
405
- for (const [k, v] of u.searchParams.entries()) q[k] = v
406
- }
407
- catch { /* 忽略,返回空 */ }
408
- return q
409
- }
410
-
411
- // 健康:后端 + web 存活、kb.id(缺失时按需自愈 ensureKB,token 后配的场景)、出站开关
412
- ctx.route('GET', '/health', async () => {
413
- const backend = state.outbound
414
- ? await callJson('GET', `${base()}/api/v1/health`, null, { timeoutMs: 5000, retries: 0 })
415
- : { ok: false, error: '出站已禁用' }
416
- const webR = state.outbound
417
- ? await callJson('GET', `${web()}/api/kb/catalog`, null, { timeoutMs: 5000, retries: 0 })
418
- : { ok: false, error: '出站已禁用' }
419
- if (!kbId() && state.outbound && backend.ok && webR.ok) {
420
- await ensureKB().catch(() => {}) // 装载期 401/不可达导致 kb.id 缺失 → 探活时自愈
421
- }
422
- return {
423
- plugin: 'rag-bridge',
424
- outbound: state.outbound,
425
- auth: kbToken() ? 'bearer' : 'anonymous',
426
- // token 配置与「实测是否被接受」分开呈现:401/403 = 明确被拒(运维一眼看出 token 配错),
427
- // 网络不通/超时为 null(未知),2xx 或非鉴权类失败为 true(未被拒)。
428
- // 实测打受保护 GET /api/v1/auth/me —— rag 后端 GET 只读端点公开(/health 匿名可过,
429
- // 测不出 token 对错),/auth/me 无 token/错 token 均 401。
430
- token: {
431
- configured: Boolean(kbToken()),
432
- accepted: await (async () => {
433
- if (!state.outbound) return null
434
- if (!kbToken()) return backend.ok ? true : null
435
- const me = await callJson('GET', `${base()}/api/v1/auth/me`, null, { timeoutMs: 5000, retries: 0 })
436
- return me.ok ? true : (me.status === 401 || me.status === 403 ? false : null)
437
- })(),
438
- },
439
- kb: { name: KB_NAME, id: kbId() || null },
440
- backend: { url: base(), ok: backend.ok, ...(backend.ok ? { status: backend.body?.status ?? null } : { status: backend.status ?? null, error: backend.error }) },
441
- web: { url: web(), ok: webR.ok, ...(webR.ok ? { knowledgeBases: webR.body?.count ?? null } : { error: webR.error }) },
442
- counters: { store: ctx.kv.get('store.count') ?? 0, index: ctx.kv.get('index.count') ?? 0 },
443
- }
444
- })
445
-
446
- // 检索:复用 two-stage(?q=&kb_id=&top_k=)
447
- ctx.route('GET', '/search', async (event) => {
448
- const q = queryOf(event)
449
- const query = String(q.q ?? '').trim()
450
- if (!query) return { success: false, error: '缺少参数 q(检索词)' }
451
- if (!state.outbound) return { success: false, error: outboundOff().error }
452
- const kb = String(q.kb_id ?? '').trim() || kbId() || undefined
453
- const topK = Math.min(Math.max(Math.round(Number(q.top_k) || 5), 1), 20)
454
- const r = await ragCall('POST', `${base()}/api/v1/search/two-stage`,
455
- { query, kb_id: kb, stage2_top_k: topK }, { timeoutMs: 30000 })
456
- if (!r.ok) return { success: false, error: r.error }
457
- return { success: true, query, total_results: r.body?.total_results ?? null, results: r.body?.stage2?.results ?? [] }
458
- })
459
-
460
- // 经验列表:GET {base}/api/v1/experience/{kb_id} → {success,count,experiences:[...]}(?limit= 截取)
461
- ctx.route('GET', '/experience', async (event) => {
462
- const q = queryOf(event)
463
- if (!state.outbound) return { success: false, error: outboundOff().error }
464
- const kb = await requireKbId()
465
- if (!kb) return { success: false, error: `知识库 ${KB_NAME} 不存在且自动建库失败(检查 web ${web()})` }
466
- const limit = Math.min(Math.max(Math.round(Number(q.limit) || 20), 1), 100)
467
- const r = await ragCall('GET', `${base()}/api/v1/experience/${kb}`, null, { timeoutMs: 15000 })
468
- if (!r.ok) return { success: false, error: `经验列表不可用:${r.error}` }
469
- const all = Array.isArray(r.body?.experiences) ? r.body.experiences : []
470
- return {
471
- success: true,
472
- kb: { name: KB_NAME, id: kb },
473
- count: all.length,
474
- experiences: all.slice(0, limit),
475
- }
476
- })
477
- },
478
- }
479
-
480
- // ================= 纯函数小工具 =================
481
-
482
- function trimSlash(s) {
483
- return s.replace(/\/+$/, '')
484
- }
1
+ /**
2
+ * rag-bridge —— rag-knowledge 知识库桥接插件。
3
+ *
4
+ * 把本地 rag-knowledge 服务(FastAPI 后端 + Nuxt web)集成为 AgentWorkShop 的
5
+ * 团队知识库:启动即确保「aw-industrial」知识库存在,并向 agent 注入三个工具——
6
+ * kb_agent(知识库 Agent 对话)——检索/入库/经验全部由知识库内部 Agent 处理。
7
+ * 另开放 /health、/search、/experience 三个插件 API 便于运维探查。
8
+ * 服务不可达时工具返回 isError 文本(含原因与修复建议),绝不抛异常拖垮宿主。
9
+ */
10
+ const KB_NAME = 'aw-industrial'
11
+ const DEFAULT_BASE = 'http://127.0.0.1:8770' // FastAPI 后端
12
+ const DEFAULT_WEB = 'http://127.0.0.1:6789' // Nuxt web(文档写盘)
13
+
14
+ export default {
15
+ name: 'rag-bridge',
16
+ version: '2.2.0',
17
+ description: 'rag-knowledge 知识库桥接 v2.1:kb_agent 对话工具(功能解耦,sync/async 双模式)+ kb_agent_status 异步结果查询',
18
+ auth: 'user', // 平台转发层按此声明统一校验(缺省 'none' 开放)
19
+ client: './client.mjs', // 前端面板(插件页注入;i18n 见 i18n.json)
20
+ // 插件配置分组:插件调用平台 API 增加自己的设置分区(设置页独立成区、可折叠)。
21
+ // id 由宿主收敛进 plugin-rag-bridge* 命名空间,不会与其它插件/平台分组撞车;
22
+ // 插件卸载或停用时这两个分区随之消失,不残留空区块。
23
+ configGroups: [
24
+ { id: 'default', labelKey: 'plugin.rag-bridge.group.conn', label: 'rag-knowledge 连接', description: '后端与 Web 地址(保存即热生效)', order: 400 },
25
+ { id: 'auth', labelKey: 'plugin.rag-bridge.group.auth', label: 'rag-knowledge 鉴权', description: '服务端开启鉴权时所需 Token', order: 410, collapsed: true },
26
+ ],
27
+ // 插件设置声明:key 强制编址 plugins.rag-bridge.<key>,进 SystemConfigService 后
28
+ // 前端设置页自动渲染(labelKey 解析 i18n.json 的 plugin.rag-bridge.settings.*);
29
+ // group 指向上面声明的分区 → 字段按分区隔离展示
30
+ settings: [
31
+ { key: 'base_url', type: 'string', default: DEFAULT_BASE, group: 'default', labelKey: 'plugin.rag-bridge.settings.base_url', label: 'rag-knowledge 后端地址', description: 'FastAPI 后端(http/https,host 限 127.0.0.1/localhost);保存即热生效' },
32
+ { key: 'web_url', type: 'string', default: DEFAULT_WEB, group: 'default', labelKey: 'plugin.rag-bridge.settings.web_url', label: 'rag-knowledge Web 地址', description: 'Nuxt Web(文档写盘/目录);保存即热生效' },
33
+ { key: 'token', type: 'string', default: '', group: 'auth', labelKey: 'plugin.rag-bridge.settings.token', label: 'rag-knowledge API Token', description: '服务端开启鉴权时的 MCP/API Token(Authorization: Bearer);空=匿名;保存即热生效' },
34
+ ],
35
+ async setup(ctx) {
36
+ // ---- 运行态 ----
37
+ const state = { outbound: true } // base_url 非法时禁用全部出站调用
38
+ const base = () => trimSlash(String(ctx.config?.get?.('plugins.rag-bridge.base_url') || ctx.kv.get('kb.base_url') || DEFAULT_BASE))
39
+ const web = () => trimSlash(String(ctx.config?.get?.('plugins.rag-bridge.web_url') || ctx.kv.get('kb.web_url') || DEFAULT_WEB))
40
+ const kbId = () => String(ctx.kv.get('kb.id') || '')
41
+ // 鉴权 token(系统配置优先,kv 兜底):rag-knowledge 开启 server.auth 时所有 /api/*
42
+ // 要求 Bearer;backend 与 web 都认 Authorization: Bearer / X-KB-Token 两种头
43
+ const kbToken = () => String(ctx.config?.get?.('plugins.rag-bridge.token') || ctx.kv.get('kb.token') || '').trim()
44
+ const authHeaders = () => {
45
+ const t = kbToken()
46
+ return t ? { 'authorization': `Bearer ${t}`, 'x-kb-token': t } : {}
47
+ }
48
+
49
+ // ---- kv 默认值(幂等) ----
50
+ if (ctx.kv.get('kb.base_url') == null) ctx.kv.set('kb.base_url', DEFAULT_BASE)
51
+ if (ctx.kv.get('kb.web_url') == null) ctx.kv.set('kb.web_url', DEFAULT_WEB)
52
+ ctx.kv.set('kb.name', KB_NAME)
53
+
54
+ // base_url 守卫:仅 http/https 且 host 必须是 127.0.0.1/localhost(不合法则禁用出站)。
55
+ // 每次配置变更都重算 —— 否则改错地址后旧判定会一直沿用,「独立配置即时生效」不成立。
56
+ const applyOutboundGuard = () => {
57
+ try {
58
+ const u = new URL(base())
59
+ if ((u.protocol !== 'http:' && u.protocol !== 'https:') || !['127.0.0.1', 'localhost'].includes(u.hostname)) {
60
+ throw new Error(`base_url 必须是 http(s)://127.0.0.1|localhost,实际 ${base()}`)
61
+ }
62
+ state.outbound = true
63
+ }
64
+ catch (err) {
65
+ state.outbound = false
66
+ ctx.logger.error(`出站调用已禁用:${err?.message ?? err}(修正 rag-bridge 的「后端地址」后即恢复)`)
67
+ }
68
+ }
69
+ applyOutboundGuard()
70
+ // 配置热更新(runtime-settings 变更)→ 立即重算出站开关与下次探活
71
+ ctx.config.onChange(() => applyOutboundGuard())
72
+
73
+ // ---- ensureKB:幂等初始化(失败仅告警,不阻塞装载) ----
74
+ try {
75
+ await ensureKB()
76
+ ctx.logger.info(`rag-bridge 就绪:kb=${KB_NAME}(${kbId() || '待建'}),出站=${state.outbound ? '启用' : '禁用'}`)
77
+ }
78
+ catch (err) {
79
+ ctx.logger.warn(`ensureKB 未完成(不影响装载,工具会在服务可用后按需重试):${err?.message ?? err}`)
80
+ }
81
+
82
+ // ================= 出站 HTTP(重试 + 超时 + success 断言) =================
83
+
84
+ function sleep(ms) {
85
+ return new Promise(resolve => ctx.timer.setTimeout(resolve, ms))
86
+ }
87
+
88
+ /** 单次 JSON 请求;429/网络错误按 1s*重试次数退避,最多重试 2 次;检索类调用方传 timeoutMs:30000 */
89
+ async function callJson(method, url, body, { timeoutMs = 15000, retries = 2, headers = {} } = {}) {
90
+ let lastErr = ''
91
+ const h = { ...authHeaders(), ...headers }
92
+ for (let attempt = 0; attempt <= retries; attempt++) {
93
+ if (attempt > 0) await sleep(1000 * attempt) // 退避 1s*n
94
+ try {
95
+ const res = method === 'GET'
96
+ ? await ctx.http.get(url, { timeoutMs, headers: h })
97
+ : await ctx.http.post(url, body ?? {}, { timeoutMs, headers: h })
98
+ if (res.status === 429) {
99
+ lastErr = `HTTP 429(限流)`
100
+ continue
101
+ }
102
+ if (!res.ok) return { ok: false, status: res.status, error: `HTTP ${res.status}` }
103
+ const json = await res.json().catch(() => null)
104
+ if (json == null) return { ok: false, status: res.status, error: '响应不是合法 JSON' }
105
+ return { ok: true, status: res.status, body: json }
106
+ }
107
+ catch (err) {
108
+ lastErr = err?.message ?? String(err) // 网络错误/超时(AbortSignal.timeout)
109
+ }
110
+ }
111
+ return { ok: false, error: lastErr || '未知错误' }
112
+ }
113
+
114
+ /** rag 业务调用:铁律——HTTP 200 但 body.success !== true 一律视为失败 */
115
+ async function ragCall(method, url, body, opts = {}) {
116
+ const r = await callJson(method, url, body, opts)
117
+ if (!r.ok) return r
118
+ if (r.body?.success !== true) {
119
+ return { ok: false, error: `服务返回 success!=true:${JSON.stringify(r.body).slice(0, 200)}` }
120
+ }
121
+ return r
122
+ }
123
+
124
+ const outboundOff = () => ({ ok: false, error: '出站调用已禁用:kv["kb.base_url"] 非法(仅允许 http/https 且 host 为 127.0.0.1/localhost)' })
125
+
126
+ // ================= 异步任务生命周期(提交 → 跟踪 → 进度/结果 → 回执) =================
127
+ // rag-knowledge web 的任务登记表是进程内 Map(TTL 2h / 200 条),进程重启即丢失;
128
+ // 这里把 task_id 与发起者归因落到插件 kv,15s 轮询终态并主动投递平台通告 ——
129
+ // 否则 Agent 提交 async 入库后不主动轮询就永远不知道结果。
130
+ const KB_TASK_PREFIX = 'kbtask:'
131
+ const KB_TASK_TTL_MS = 3 * 60 * 60 * 1000
132
+ let kbPolling = false
133
+
134
+ const kbTaskKey = id => KB_TASK_PREFIX + id
135
+
136
+ async function kbNotify() {
137
+ try {
138
+ return await ctx.services.get('notify')
139
+ }
140
+ catch {
141
+ return null
142
+ }
143
+ }
144
+
145
+ async function queryKbTask(taskId) {
146
+ const r = await callJson('GET', web() + '/api/kb/agent/tasks/' + encodeURIComponent(taskId), null, { timeoutMs: 15000, retries: 0 })
147
+ if (!r.ok) return { ok: false, error: String(r.error ?? ''), status: r.status }
148
+ const body = r.body || {}
149
+ return {
150
+ ok: true,
151
+ status: String(body.status ?? 'unknown'),
152
+ reply: String(body.result?.reply ?? body.result?.partial_text ?? '').trim(),
153
+ error: String(body.result?.error ?? '').slice(0, 600),
154
+ }
155
+ }
156
+
157
+ async function deliverKbTask(task, ok, summary) {
158
+ // 无发起者归因(手动调用/旧任务)→ 无收件人,跳过平台回执
159
+ if (!task.agentId) return false
160
+ const notify = await kbNotify()
161
+ if (!notify) {
162
+ ctx.logger.warn(`知识库任务 ${task.taskId} 已结束,但平台通告面不可用(可用 kb_agent_status 查询)`)
163
+ return false
164
+ }
165
+ try {
166
+ const delivered = await notify.deliver({
167
+ kind: 'tool-result',
168
+ tool: 'kb_agent',
169
+ jobId: task.taskId,
170
+ agentId: task.agentId,
171
+ ...(task.channelId ? { channelId: task.channelId } : {}),
172
+ ok,
173
+ title: `知识库任务${ok ? '完成' : '失败'}`,
174
+ summary: String(summary || (ok ? '(知识库 Agent 返回空结果)' : '任务失败')).slice(0, 900),
175
+ })
176
+ return delivered !== false
177
+ }
178
+ catch (err) {
179
+ ctx.logger.warn(`知识库任务 ${task.taskId} 回执投递失败:${err?.message ?? err}`)
180
+ return false
181
+ }
182
+ }
183
+
184
+ async function pollKbTasks() {
185
+ if (kbPolling || !state.outbound) return
186
+ kbPolling = true
187
+ try {
188
+ const entries = Object.entries(ctx.kv.all())
189
+ .filter(([k, v]) => k.startsWith(KB_TASK_PREFIX) && v && typeof v === 'object' && !v.deliveredAt)
190
+ for (const [key, task] of entries) {
191
+ if (!task.taskId) continue
192
+ if (Date.now() - Number(task.createdAt || 0) > KB_TASK_TTL_MS) {
193
+ await deliverKbTask(task, false, '任务超过 3 小时仍未结束,已停止跟踪;可稍后用 kb_agent_status 再查一次。')
194
+ ctx.kv.set(key, { ...task, status: 'expired', error: '超过 3 小时未完成', deliveredAt: Date.now() })
195
+ continue
196
+ }
197
+ const q = await queryKbTask(task.taskId)
198
+ if (!q.ok) {
199
+ const attempts = Number(task.pollErrors || 0) + 1
200
+ // 404 = web 重启/任务被淘汰;连续 3 轮仍查不到 → 收敛为 failed 并回执
201
+ if (/HTTP 404/.test(q.error) && attempts >= 3) {
202
+ await deliverKbTask(task, false, `任务已无法查询(HTTP 404,可能因 web 重启或超过 2h 淘汰):${q.error}`)
203
+ ctx.kv.set(key, { ...task, status: 'failed', error: q.error, pollErrors: attempts, deliveredAt: Date.now() })
204
+ }
205
+ else {
206
+ ctx.kv.set(key, { ...task, pollErrors: attempts, lastPollError: q.error })
207
+ }
208
+ continue
209
+ }
210
+ if (q.status === 'running' || q.status === 'queued') {
211
+ ctx.kv.set(key, { ...task, status: q.status, pollErrors: 0 })
212
+ continue
213
+ }
214
+ const okStatus = q.status === 'completed'
215
+ await deliverKbTask(task, okStatus, okStatus ? q.reply : `任务以 ${q.status} 结束:${q.error || '(无错误详情)'}`)
216
+ ctx.kv.set(key, {
217
+ ...task,
218
+ status: q.status,
219
+ reply: q.reply.slice(0, 2000),
220
+ error: q.error,
221
+ deliveredAt: Date.now(),
222
+ deliverPending: false,
223
+ })
224
+ }
225
+ }
226
+ catch (err) {
227
+ ctx.logger.warn(`知识库任务轮询异常(下轮继续):${err?.message ?? err}`)
228
+ }
229
+ finally {
230
+ kbPolling = false
231
+ }
232
+ }
233
+
234
+ // ================= ensureKB(catalog 查找 → 建库 → experience init) =================
235
+
236
+ async function ensureKB() {
237
+ // ① catalog 查找同名库(响应 {success,count,knowledgeBases:[{kbId,name,...}]})
238
+ const cat = state.outbound
239
+ ? await callJson('GET', `${web()}/api/kb/catalog`, null, { timeoutMs: 10000 })
240
+ : { ok: false, error: '出站已禁用' }
241
+ if (cat.ok) {
242
+ const list = Array.isArray(cat.body?.knowledgeBases) ? cat.body.knowledgeBases : []
243
+ const hit = list.find(kb => kb?.name === KB_NAME)
244
+ if (hit?.kbId) ctx.kv.set('kb.id', hit.kbId)
245
+ }
246
+ else {
247
+ ctx.logger.warn(`catalog 不可达(${cat.error}),跳过查找直接尝试建库`)
248
+ }
249
+ // ② 无则建库(响应 {success,knowledgeBase:{id,name,path,...}})
250
+ if (!kbId()) {
251
+ const created = state.outbound
252
+ ? await ragCall('POST', `${web()}/api/kb/create`, { name: KB_NAME, description: 'AgentWorkShop 工业知识库(诊断报告/经验教训/操作规范)' }, { timeoutMs: 15000 })
253
+ : { ok: false, error: '出站已禁用' }
254
+ if (!created.ok) throw new Error(`创建知识库 ${KB_NAME} 失败:${created.error}`)
255
+ const id = created.body?.knowledgeBase?.id
256
+ if (!id) throw new Error(`建库响应缺少 knowledgeBase.id:${JSON.stringify(created.body).slice(0, 200)}`)
257
+ ctx.kv.set('kb.id', id)
258
+ }
259
+ // ③ 经验文件夹初始化(容忍已初始化/失败:仅告警)
260
+ const init = state.outbound
261
+ ? await ragCall('POST', `${base()}/api/v1/experience/${kbId()}/init`, {}, { timeoutMs: 15000 })
262
+ : { ok: false, error: '出站已禁用' }
263
+ if (!init.ok) ctx.logger.warn(`experience init 未成功(可忽略或稍后手动重试):${init.error}`)
264
+ }
265
+
266
+ /** 工具侧兜底:kv 无 kb.id 时按需重跑 ensureKB */
267
+ async function requireKbId() {
268
+ if (kbId()) return kbId()
269
+ await ensureKB()
270
+ if (kbId()) return kbId()
271
+ return null
272
+ }
273
+
274
+ // ================= 工具 ×1(kb_agent —— 功能解耦的唯一入口) =================
275
+ // 外部系统不再拼装检索/入库步骤:一个对话工具把任务原话交给 rag-knowledge
276
+ // 的原生 Agent(claude SDK + QDCVR skill + kb-mcp),检索/入库/经验/图谱全部
277
+ // 由知识库内部 Agent 自主完成,直接返回最终结果。
278
+
279
+ ctx.omp.registerTool({
280
+ name: 'kb_agent',
281
+ label: '知识库Agent',
282
+ description: '与 rag-knowledge 知识库的原生 Agent 对话(知识库操作唯一入口,功能解耦)。把任务原话交给它:检索问答(知识库侧自动走 QDCVR 全流程,返回带引用的可信答案)、文档入库(给出标题与完整 markdown 正文,action=ingest)、经验沉淀(action=ingest)、图谱关联等,全部由知识库内部 Agent 自主处理并返回最终结果。入库类动作会进入平台审批(HITL),批准后才提交。',
283
+ parameters: {
284
+ type: 'object',
285
+ properties: {
286
+ prompt: { type: 'string', description: '给知识库 Agent 的完整任务原话。检索:要查的问题;入库:目标知识库名(缺省 aw-industrial)+文档标题+完整 markdown 正文;经验:标题/类别/问题/解决方案' },
287
+ mode: { type: 'string', enum: ['sync', 'async'], description: '执行方式(旧口径,建议改用 wait/wait_seconds):sync 同步等待;async 立即返回 task_id 后台跑' },
288
+ wait: { type: 'boolean', description: '是否等待结果(推荐口径):true=本次调用挂起直到知识库任务终态——成功/失败都返回完整结果,任务未完不返回;false/缺省=提交即返 task_id 后台跑(结果存后台任务台账,kb_agent_status(task_id) 随时可查)' },
289
+ wait_seconds: { type: 'number', description: 'wait=true 的等待上限秒(缺省 600,上限 1800);窗口内未完则如实返回 running 态与 task_id,任务后台继续并仍会自动回执' },
290
+ action: { type: 'string', enum: ['query', 'ingest'], description: '动作类别:query=只读检索问答(缺省);ingest=写知识库(文档入库/经验沉淀),平台会挂 HITL 审批单,批准前不提交后端。入库务必显式声明 action=ingest。' },
291
+ },
292
+ required: ['prompt'],
293
+ },
294
+ roles: ['lead', 'worker'],
295
+ riskClass: 'write',
296
+ noRefs: true,
297
+ handler: async (args, agent) => {
298
+ if (!state.outbound) {
299
+ return { text: '知识库 Agent 不可用:' + outboundOff().error + '。修复后重启服务。', isError: true }
300
+ }
301
+ const prompt = String(args.prompt ?? '').trim()
302
+ if (!prompt) return { text: 'prompt 必填(把要做的任务完整描述给知识库 Agent)。', isError: true }
303
+ // 等待语义:wait=true 显式挂起到终态(成功/失败都给完整结果);wait=false/缺省=提交即返。
304
+ // 挂起期间 Agent 的回合被本工具调用占住——结构上保证"任务未完不能标记完成"。
305
+ const legacyAsync = args.wait === undefined && String(args.mode ?? '').trim().toLowerCase() === 'async'
306
+ const mode = (args.wait === false || legacyAsync) ? 'async' : 'sync'
307
+ const waitSec = Math.min(Math.max(Math.round(Number(args.wait_seconds ?? 600) || 600), 10), 1800)
308
+ // 权限档由服务端固定(不再接受调用方透传):历史参数 permission/harness 一律忽略。
309
+ // 缺省 'default' 标准审批档;此前缺省传递 bypassPermissions 允许 Agent 自行提权。
310
+ const body = { prompt, timeout_ms: mode === 'sync' ? waitSec * 1000 : 540000, mode, permission: 'default' }
311
+
312
+ if (mode === 'async') {
313
+ // 异步:立即返回 task_id,知识库后台完成;结果稍后用 kb_agent_status 查询
314
+ const sub = await ragCall('POST', web() + '/api/kb/agent/chat', body, { timeoutMs: 30000, retries: 0 })
315
+ if (!sub.ok) {
316
+ return { text: '知识库异步任务提交失败:' + String(sub.error ?? '').slice(0, 200) + '。请确认 rag-knowledge web(' + web() + ') 已启动后重试。', isError: true }
317
+ }
318
+ const taskId = String(sub.body?.task_id ?? '')
319
+ if (!taskId) return { text: '知识库异步任务提交异常:响应缺少 task_id。', isError: true }
320
+ // 落 kv:异步任务与发起者归因,供后台轮询主动回执;进程重启后仍可继续跟踪
321
+ ctx.kv.set(kbTaskKey(taskId), {
322
+ taskId,
323
+ createdAt: Date.now(),
324
+ status: 'running',
325
+ agentId: agent?.agentId ?? '',
326
+ channelId: agent?.channelId ?? '',
327
+ prompt: prompt.slice(0, 160),
328
+ })
329
+ return { text: '已提交知识库异步任务(后台执行中,无需等待):\ntask_id=' + taskId + '\n完成后平台会自动回执到你的信箱并唤醒你;空闲时也可调用 kb_agent_status(task_id, wait_seconds=120) 等待并获取结果。' }
330
+ }
331
+
332
+ // 同步请求禁止网络重试:POST 可能已在知识库侧启动回合,重试会重复入库/重复生成
333
+ const r = await ragCall('POST', web() + '/api/kb/agent/chat', body, { timeoutMs: waitSec * 1000 + 30000, retries: 0 })
334
+ if (!r.ok) {
335
+ return { text: '知识库 Agent 调用失败(本次调用即终态,失败结果已如实返回):' + String(r.error ?? '').slice(0, 300) + '。请确认 rag-knowledge web(' + web() + ') 已启动后重试。', isError: true }
336
+ }
337
+ const reply = String(r.body?.reply ?? '').trim()
338
+ return { text: '✅ 知识库任务完成(等待到终态)。\n\n' + (reply || '(知识库 Agent 返回空回复)') }
339
+ },
340
+ })
341
+
342
+ ctx.omp.registerTool({
343
+ name: 'kb_agent_status',
344
+ label: '知识库任务状态',
345
+ description: '查询知识库异步任务的执行状态与结果(kb_agent 以 mode=async 提交后,用返回的 task_id 查询;任务完成后返回知识库 Agent 的完整结果)。可传 wait_seconds 最长等 120s:任务在窗口内完成则直接返回结果,免反复轮询。',
346
+ parameters: {
347
+ type: 'object',
348
+ properties: {
349
+ task_id: { type: 'string', description: 'kb_agent 异步提交时返回的 task_id' },
350
+ wait_seconds: { type: 'number', description: '长轮询等待秒数(0=立即返回,默认 0,上限 1800);任务在窗口内完成则直接返回结果' },
351
+ },
352
+ required: ['task_id'],
353
+ },
354
+ roles: ['lead', 'worker'],
355
+ handler: async (args) => {
356
+ if (!state.outbound) {
357
+ return { text: '知识库 Agent 不可用:' + outboundOff().error + '。修复后重启服务。', isError: true }
358
+ }
359
+ const taskId = String(args.task_id ?? '').trim()
360
+ if (!taskId) return { text: 'task_id 必填(kb_agent 异步提交时返回的 id)。', isError: true }
361
+ const waitSec = Math.min(Math.max(Math.round(Number(args.wait_seconds ?? 0) || 0), 0), 1800)
362
+ const finish = async (reply, ok) => {
363
+ // 终态由轮询面亲自看到 → 认领回执所有权,取消后台补送(先到先得)
364
+ try {
365
+ const notify = await kbNotify()
366
+ notify?.claim?.('kb_agent', taskId)
367
+ }
368
+ catch { /* 未接线时忽略 */ }
369
+ const known = ctx.kv.get(kbTaskKey(taskId))
370
+ if (known) ctx.kv.set(kbTaskKey(taskId), { ...known, deliveredAt: Date.now(), deliveredBy: 'kb_agent_status', ...(ok != null ? { status: ok ? 'completed' : 'failed' } : {}) })
371
+ return reply
372
+ }
373
+ const queryOnce = async () => {
374
+ const q = await queryKbTask(taskId)
375
+ if (!q.ok) {
376
+ return { text: '任务查询失败:' + q.error + '(不存在/已过期 2h/服务重启过,或任务从未提交)。', isError: true }
377
+ }
378
+ if (q.status === 'running' || q.status === 'queued') return null
379
+ if (q.status === 'completed') {
380
+ return { text: await finish('任务 ' + taskId + ' 已完成。知识库 Agent 结果:\n\n' + (q.reply || '(知识库 Agent 返回空结果)'), true) }
381
+ }
382
+ return { text: await finish('任务 ' + taskId + ' 状态:' + q.status + '\n' + (q.error || '(无错误详情)'), false) }
383
+ }
384
+ // 长轮询:5s 步进,窗口内完成即返回结果
385
+ const deadline = Date.now() + waitSec * 1000
386
+ for (;;) {
387
+ const got = await queryOnce()
388
+ if (got) return got
389
+ if (Date.now() >= deadline) {
390
+ return { text: '任务 ' + taskId + ' 仍在后台执行中(running,已等待 ' + waitSec + 's)。稍后再次查询;完成后平台也会自动回执。' }
391
+ }
392
+ await sleep(5000)
393
+ }
394
+ },
395
+ })
396
+
397
+ // 后台轮询:15s 一次,终态主动回执(与 diag-bridge sweep 同构)
398
+ ctx.timer.setInterval(() => {
399
+ pollKbTasks().catch(err => ctx.logger.warn(`知识库任务轮询异常(继续):${err?.message ?? err}`))
400
+ }, 15000)
401
+ pollKbTasks().catch(() => {})
402
+
403
+ // ================= 插件 API ×3(/api/plugins/rag-bridge/**) =================
404
+
405
+ /** 从 h3 event 取查询参数(转发层只预挂 awBody;query 在 event.path 上) */
406
+ function queryOf(event) {
407
+ const raw = String(event?.path ?? event?.node?.req?.url ?? '')
408
+ const q = {}
409
+ try {
410
+ const u = new URL(raw, 'http://local')
411
+ for (const [k, v] of u.searchParams.entries()) q[k] = v
412
+ }
413
+ catch { /* 忽略,返回空 */ }
414
+ return q
415
+ }
416
+
417
+ // 健康:后端 + web 存活、kb.id(缺失时按需自愈 ensureKB,token 后配的场景)、出站开关
418
+ ctx.route('GET', '/health', async () => {
419
+ const backend = state.outbound
420
+ ? await callJson('GET', `${base()}/api/v1/health`, null, { timeoutMs: 5000, retries: 0 })
421
+ : { ok: false, error: '出站已禁用' }
422
+ const webR = state.outbound
423
+ ? await callJson('GET', `${web()}/api/kb/catalog`, null, { timeoutMs: 5000, retries: 0 })
424
+ : { ok: false, error: '出站已禁用' }
425
+ if (!kbId() && state.outbound && backend.ok && webR.ok) {
426
+ await ensureKB().catch(() => {}) // 装载期 401/不可达导致 kb.id 缺失 → 探活时自愈
427
+ }
428
+ return {
429
+ plugin: 'rag-bridge',
430
+ outbound: state.outbound,
431
+ auth: kbToken() ? 'bearer' : 'anonymous',
432
+ // token 配置与「实测是否被接受」分开呈现:401/403 = 明确被拒(运维一眼看出 token 配错),
433
+ // 网络不通/超时为 null(未知),2xx 或非鉴权类失败为 true(未被拒)。
434
+ // 实测打受保护 GET /api/v1/auth/me —— rag 后端 GET 只读端点公开(/health 匿名可过,
435
+ // 测不出 token 对错),/auth/me 无 token/错 token 均 401。
436
+ token: {
437
+ configured: Boolean(kbToken()),
438
+ accepted: await (async () => {
439
+ if (!state.outbound) return null
440
+ if (!kbToken()) return backend.ok ? true : null
441
+ const me = await callJson('GET', `${base()}/api/v1/auth/me`, null, { timeoutMs: 5000, retries: 0 })
442
+ return me.ok ? true : (me.status === 401 || me.status === 403 ? false : null)
443
+ })(),
444
+ },
445
+ kb: { name: KB_NAME, id: kbId() || null },
446
+ backend: { url: base(), ok: backend.ok, ...(backend.ok ? { status: backend.body?.status ?? null } : { status: backend.status ?? null, error: backend.error }) },
447
+ web: { url: web(), ok: webR.ok, ...(webR.ok ? { knowledgeBases: webR.body?.count ?? null } : { error: webR.error }) },
448
+ counters: { store: ctx.kv.get('store.count') ?? 0, index: ctx.kv.get('index.count') ?? 0 },
449
+ }
450
+ })
451
+
452
+ // 检索:复用 two-stage(?q=&kb_id=&top_k=)
453
+ ctx.route('GET', '/search', async (event) => {
454
+ const q = queryOf(event)
455
+ const query = String(q.q ?? '').trim()
456
+ if (!query) return { success: false, error: '缺少参数 q(检索词)' }
457
+ if (!state.outbound) return { success: false, error: outboundOff().error }
458
+ const kb = String(q.kb_id ?? '').trim() || kbId() || undefined
459
+ const topK = Math.min(Math.max(Math.round(Number(q.top_k) || 5), 1), 20)
460
+ const r = await ragCall('POST', `${base()}/api/v1/search/two-stage`,
461
+ { query, kb_id: kb, stage2_top_k: topK }, { timeoutMs: 30000 })
462
+ if (!r.ok) return { success: false, error: r.error }
463
+ return { success: true, query, total_results: r.body?.total_results ?? null, results: r.body?.stage2?.results ?? [] }
464
+ })
465
+
466
+ // 经验列表:GET {base}/api/v1/experience/{kb_id} → {success,count,experiences:[...]}(?limit= 截取)
467
+ ctx.route('GET', '/experience', async (event) => {
468
+ const q = queryOf(event)
469
+ if (!state.outbound) return { success: false, error: outboundOff().error }
470
+ const kb = await requireKbId()
471
+ if (!kb) return { success: false, error: `知识库 ${KB_NAME} 不存在且自动建库失败(检查 web ${web()})` }
472
+ const limit = Math.min(Math.max(Math.round(Number(q.limit) || 20), 1), 100)
473
+ const r = await ragCall('GET', `${base()}/api/v1/experience/${kb}`, null, { timeoutMs: 15000 })
474
+ if (!r.ok) return { success: false, error: `经验列表不可用:${r.error}` }
475
+ const all = Array.isArray(r.body?.experiences) ? r.body.experiences : []
476
+ return {
477
+ success: true,
478
+ kb: { name: KB_NAME, id: kb },
479
+ count: all.length,
480
+ experiences: all.slice(0, limit),
481
+ }
482
+ })
483
+ },
484
+ }
485
+
486
+ // ================= 纯函数小工具 =================
487
+
488
+ function trimSlash(s) {
489
+ return s.replace(/\/+$/, '')
490
+ }