agentworkshop 0.7.27 → 0.7.33

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 (1030) hide show
  1. package/.AgentWorkShop/prompts/aml-mission-default.md +20 -0
  2. package/.AgentWorkShop/prompts/aml-playbook.md +49 -0
  3. package/.AgentWorkShop/prompts/host-tools.json +314 -0
  4. package/.output/.AgentWorkShop/prompts/aml-mission-default.md +20 -0
  5. package/.output/.AgentWorkShop/prompts/aml-playbook.md +49 -0
  6. package/.output/.AgentWorkShop/prompts/host-tools.json +314 -0
  7. package/.output/.AgentWorkShop/schema.json +120 -0
  8. package/.output/nitro.json +1 -1
  9. package/.output/public/_nuxt/{BTLEvDxM.js → 4bHdIqEg.js} +8 -8
  10. package/.output/public/_nuxt/B9nXmjSB.js +19 -0
  11. package/.output/public/_nuxt/BASN8nZ0.js +1 -0
  12. package/.output/public/_nuxt/{DNQF_TXX.js → BBBtwOpo.js} +1 -1
  13. package/.output/public/_nuxt/{DoAlYsiF.js → BBwMH_hG.js} +1 -1
  14. package/.output/public/_nuxt/BWSE6hR6.js +1 -0
  15. package/.output/public/_nuxt/BZv4RFYN.js +1 -0
  16. package/.output/public/_nuxt/{BgCrZKv_2.js → Bc0AmjfT.js} +1 -1
  17. package/.output/public/_nuxt/BcmbLh2z2.js +1 -0
  18. package/.output/public/_nuxt/BgTB6h_q.js +2 -0
  19. package/.output/public/_nuxt/BkLJA9J5.js +1 -0
  20. package/.output/public/_nuxt/{XY2z78rj.js → BuCHayqN.js} +1 -1
  21. package/.output/public/_nuxt/{0jKrzLuM.js → BuvcLKh1.js} +1 -1
  22. package/.output/public/_nuxt/C-mDhyEd.js +1 -0
  23. package/.output/public/_nuxt/{DosOJEmZ2.js → C77oC8yC2.js} +1 -1
  24. package/.output/public/_nuxt/CQvmN-Mi.js +1 -0
  25. package/.output/public/_nuxt/CUDrOuW7.js +1 -0
  26. package/.output/public/_nuxt/{DjU9Dx5Y.js → CZcC-gpk.js} +1 -1
  27. package/.output/public/_nuxt/{Cz9gD2Yo.js → CbzsPO5H.js} +1 -1
  28. package/.output/public/_nuxt/CdSOrh2c.js +1 -0
  29. package/.output/public/_nuxt/Cgx818r-.js +1 -0
  30. package/.output/public/_nuxt/Cjm7VogC.js +1 -0
  31. package/.output/public/_nuxt/Cm5mDxzH.js +1 -0
  32. package/.output/public/_nuxt/Cp6z0RN7.js +1 -0
  33. package/.output/public/_nuxt/Ct-WOVr4.js +1 -0
  34. package/.output/public/_nuxt/CwqIxJGj.js +2 -0
  35. package/.output/public/_nuxt/{BGhOrgle.js → D0fhp-Ga.js} +2 -2
  36. package/.output/public/_nuxt/DIaTPH1M.js +1 -0
  37. package/.output/public/_nuxt/DLljr7g0.js +1 -0
  38. package/.output/public/_nuxt/DTYBfjRY.js +1 -0
  39. package/.output/public/_nuxt/DYKVPzN-.js +1 -0
  40. package/.output/public/_nuxt/DZzGarBE2.js +13 -0
  41. package/.output/public/_nuxt/DaMCzQhv.js +1 -0
  42. package/.output/public/_nuxt/DoMxCWN52.js +4 -0
  43. package/.output/public/_nuxt/{CucID8qg2.js → DoTdlVVe2.js} +1 -1
  44. package/.output/public/_nuxt/DsVcWfyR.js +1 -0
  45. package/.output/public/_nuxt/{BCJFMBQ6.js → DzuC31-i.js} +2 -2
  46. package/.output/public/_nuxt/FQri3dV3.js +1 -0
  47. package/.output/public/_nuxt/Lp7Ll94I.js +1 -0
  48. package/.output/public/_nuxt/PluginSlot.DmjNbrcX.css +1 -0
  49. package/.output/public/_nuxt/_id_.hRYo-EAB.css +1 -0
  50. package/.output/public/_nuxt/_wsId_.gXMEOYgX.css +1 -0
  51. package/.output/public/_nuxt/agents.BV70ioCv.css +1 -0
  52. package/.output/public/_nuxt/aml.WU_bh87J.css +1 -0
  53. package/.output/public/_nuxt/builds/latest.json +1 -1
  54. package/.output/public/_nuxt/builds/meta/291ef3e6-fa6a-4dee-8f46-05da1aeab815.json +1 -0
  55. package/.output/public/_nuxt/daq.Bb6l44-O.css +1 -0
  56. package/.output/public/_nuxt/default.jNT73_hq.css +1 -0
  57. package/.output/public/_nuxt/ekuGmQ7R.js +1 -0
  58. package/.output/public/_nuxt/entry.jFrFAWuA.css +1 -0
  59. package/.output/public/_nuxt/pMoIO6rr.js +14 -0
  60. package/.output/public/_nuxt/pages.Cc8GX9T1.css +1 -0
  61. package/.output/public/_nuxt/plugins.wIPyfPn-.css +1 -0
  62. package/.output/public/_nuxt/settings.BCm4NZIc.css +1 -0
  63. package/.output/public/_nuxt/teams.BC75EGnR.css +1 -0
  64. package/.output/server/chunks/_/binding-authz.mjs +23 -0
  65. package/.output/server/chunks/_/binding-authz.mjs.map +1 -0
  66. package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
  67. package/.output/server/chunks/_/host-bindings.mjs +1 -1
  68. package/.output/server/chunks/_/nitro.mjs +13557 -6855
  69. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  70. package/.output/server/chunks/_/scene-layout.repo.mjs +3 -3
  71. package/.output/server/chunks/_/scene-layout.repo.mjs.map +1 -1
  72. package/.output/server/chunks/build/Checkbox-eax2M3o-.mjs +207 -0
  73. package/.output/server/chunks/build/Checkbox-eax2M3o-.mjs.map +1 -0
  74. package/.output/server/chunks/build/{OmpTerminalPanel-Cw_Vw9oO.mjs → OmpTerminalPanel-Cu_s4i0A.mjs} +2 -2
  75. package/.output/server/chunks/build/{OmpTerminalPanel-Cw_Vw9oO.mjs.map → OmpTerminalPanel-Cu_s4i0A.mjs.map} +1 -1
  76. package/.output/server/chunks/build/{alert-qJnjyRcP.mjs → PluginSlot-CcR4Ys3T.mjs} +140 -4
  77. package/.output/server/chunks/build/PluginSlot-CcR4Ys3T.mjs.map +1 -0
  78. package/.output/server/chunks/build/{TownView-ftIylqiD.mjs → TownView-BdHnAilw.mjs} +5 -5
  79. package/.output/server/chunks/build/{TownView-ftIylqiD.mjs.map → TownView-BdHnAilw.mjs.map} +1 -1
  80. package/.output/server/chunks/build/{_id_-CahfkmEt.mjs → _id_-Cb845FHR.mjs} +7 -5
  81. package/.output/server/chunks/build/_id_-Cb845FHR.mjs.map +1 -0
  82. package/.output/server/chunks/build/{_id_-3Axz2-gV.mjs → _id_-fadFPl2i.mjs} +50 -35
  83. package/.output/server/chunks/build/_id_-fadFPl2i.mjs.map +1 -0
  84. package/.output/server/chunks/build/{_wsId_-BymlQhzS.mjs → _wsId_-CTZswnm5.mjs} +181 -22
  85. package/.output/server/chunks/build/{_wsId_-BymlQhzS.mjs.map → _wsId_-CTZswnm5.mjs.map} +1 -1
  86. package/.output/server/chunks/build/{agents-DuMiSWKp.mjs → agents-Bvin73QY.mjs} +82 -32
  87. package/.output/server/chunks/build/agents-Bvin73QY.mjs.map +1 -0
  88. package/.output/server/chunks/build/aml-uBNIppIf.mjs +508 -0
  89. package/.output/server/chunks/build/aml-uBNIppIf.mjs.map +1 -0
  90. package/.output/server/chunks/build/apiClient-BwnfOQU8.mjs +81 -0
  91. package/.output/server/chunks/build/apiClient-BwnfOQU8.mjs.map +1 -0
  92. package/.output/server/chunks/build/{channel-templates-BStqJ-of.mjs → channel-templates-BTq8570n.mjs} +6 -5
  93. package/.output/server/chunks/build/channel-templates-BTq8570n.mjs.map +1 -0
  94. package/.output/server/chunks/build/{checkbox-C1gABOca.mjs → checkbox-8fB-wI-T.mjs} +2 -2
  95. package/.output/server/chunks/build/{checkbox-C1gABOca.mjs.map → checkbox-8fB-wI-T.mjs.map} +1 -1
  96. package/.output/server/chunks/build/{daq-ChYCABz1.mjs → daq-BvihjQyW.mjs} +111 -109
  97. package/.output/server/chunks/build/daq-BvihjQyW.mjs.map +1 -0
  98. package/.output/server/chunks/build/{dcw-CcQNGggh.mjs → dcw-Ks2vJ4PF.mjs} +5 -3
  99. package/.output/server/chunks/build/dcw-Ks2vJ4PF.mjs.map +1 -0
  100. package/.output/server/chunks/build/{default-95-zOTPt.mjs → default-GgHt4O2R.mjs} +164 -101
  101. package/.output/server/chunks/build/{default-95-zOTPt.mjs.map → default-GgHt4O2R.mjs.map} +1 -1
  102. package/.output/server/chunks/build/{input-number-Bd55elNN.mjs → input-number-DzpyYB99.mjs} +2 -2
  103. package/.output/server/chunks/build/{input-number-Bd55elNN.mjs.map → input-number-DzpyYB99.mjs.map} +1 -1
  104. package/.output/server/chunks/build/{logs-D-2UyGtE.mjs → logs-CYBhkQwh.mjs} +5 -3
  105. package/.output/server/chunks/build/logs-CYBhkQwh.mjs.map +1 -0
  106. package/.output/server/chunks/build/{monitor-mfG5jBtz.mjs → monitor-CyfDt4nR.mjs} +7 -6
  107. package/.output/server/chunks/build/{monitor-mfG5jBtz.mjs.map → monitor-CyfDt4nR.mjs.map} +1 -1
  108. package/.output/server/chunks/build/{pages-Dfosfchr.mjs → pages-C-6BRtv8.mjs} +57 -47
  109. package/.output/server/chunks/build/pages-C-6BRtv8.mjs.map +1 -0
  110. package/.output/server/chunks/build/{permissions-B-hhZuzm.mjs → permissions-B52oOmaO.mjs} +6 -5
  111. package/.output/server/chunks/build/permissions-B52oOmaO.mjs.map +1 -0
  112. package/.output/server/chunks/build/{plugins-DZR0T4Mh.mjs → plugins-dZRegC7m.mjs} +22 -18
  113. package/.output/server/chunks/build/plugins-dZRegC7m.mjs.map +1 -0
  114. package/.output/server/chunks/build/{segmented-LPPREMtZ.mjs → segmented-3TrWo0lS.mjs} +3 -3
  115. package/.output/server/chunks/build/{segmented-LPPREMtZ.mjs.map → segmented-3TrWo0lS.mjs.map} +1 -1
  116. package/.output/server/chunks/build/{settings-BajN9TQW.mjs → settings-CgDLkP3s.mjs} +437 -62
  117. package/.output/server/chunks/build/settings-CgDLkP3s.mjs.map +1 -0
  118. package/.output/server/chunks/build/{table-Bf1r2JjE.mjs → table-BjSWwmic.mjs} +4 -4
  119. package/.output/server/chunks/build/{table-Bf1r2JjE.mjs.map → table-BjSWwmic.mjs.map} +1 -1
  120. package/.output/server/chunks/build/{tag-NO9jEqKy.mjs → tag-DNE9vXc0.mjs} +3 -131
  121. package/.output/server/chunks/build/tag-DNE9vXc0.mjs.map +1 -0
  122. package/.output/server/chunks/build/{teams-t2SkRlJP.mjs → teams-2kz3CusY.mjs} +31 -30
  123. package/.output/server/chunks/build/teams-2kz3CusY.mjs.map +1 -0
  124. package/.output/server/chunks/build/{tokens-DiCojbN8.mjs → tokens-BbWLqtVz.mjs} +6 -5
  125. package/.output/server/chunks/build/tokens-BbWLqtVz.mjs.map +1 -0
  126. package/.output/server/chunks/build/town-BUqRobze.mjs +1 -0
  127. package/.output/server/chunks/build/town-BUqRobze.mjs.map +1 -1
  128. package/.output/server/chunks/build/{town-C7QM8DYK.mjs → town-DJ-V5G9U.mjs} +7 -5
  129. package/.output/server/chunks/build/town-DJ-V5G9U.mjs.map +1 -0
  130. package/.output/server/chunks/build/{useDaqStream-BeA2X8KR.mjs → useDaqStream-CIBaiGAl.mjs} +4 -3
  131. package/.output/server/chunks/build/useDaqStream-CIBaiGAl.mjs.map +1 -0
  132. package/.output/server/chunks/build/{useDcwStream-BJW_MitY.mjs → useDcwStream-CBbiYnWe.mjs} +4 -80
  133. package/.output/server/chunks/build/useDcwStream-CBbiYnWe.mjs.map +1 -0
  134. package/.output/server/chunks/build/{useDeviceTwins-Dwz_EY_i.mjs → useDeviceTwins-Yko6nNPF.mjs} +2 -2
  135. package/.output/server/chunks/build/{useDeviceTwins-Dwz_EY_i.mjs.map → useDeviceTwins-Yko6nNPF.mjs.map} +1 -1
  136. package/.output/server/chunks/build/{useOpsLog-Dm8QEb1I.mjs → useOpsLog-CO_VWh7t.mjs} +2 -2
  137. package/.output/server/chunks/build/{useOpsLog-Dm8QEb1I.mjs.map → useOpsLog-CO_VWh7t.mjs.map} +1 -1
  138. package/.output/server/chunks/build/{useWorkshopApi-B-L3MmIX.mjs → useWorkshopApi-NyjL0L3j.mjs} +4 -2
  139. package/.output/server/chunks/build/{useWorkshopApi-B-L3MmIX.mjs.map → useWorkshopApi-NyjL0L3j.mjs.map} +1 -1
  140. package/.output/server/chunks/build/{users-B9SAdEtH.mjs → users-4nzxTjFT.mjs} +6 -5
  141. package/.output/server/chunks/build/users-4nzxTjFT.mjs.map +1 -0
  142. package/.output/server/chunks/build/workshop-81xhz368.mjs +1 -0
  143. package/.output/server/chunks/build/workshop-81xhz368.mjs.map +1 -1
  144. package/.output/server/chunks/routes/api/health.get.mjs +1 -0
  145. package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
  146. package/.output/server/chunks/routes/api/index.get.mjs +1 -1
  147. package/.output/server/chunks/routes/api/index.post.mjs +1 -1
  148. package/.output/server/chunks/routes/api/metrics.mjs +1 -0
  149. package/.output/server/chunks/routes/api/metrics.mjs.map +1 -1
  150. package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs +1 -0
  151. package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs.map +1 -1
  152. package/.output/server/chunks/routes/api/plugins/client/_name_.get.mjs +1 -0
  153. package/.output/server/chunks/routes/api/plugins/client/_name_.get.mjs.map +1 -1
  154. package/.output/server/chunks/routes/api/plugins/i18n.get.mjs +26 -0
  155. package/.output/server/chunks/routes/api/plugins/i18n.get.mjs.map +1 -0
  156. package/.output/server/chunks/routes/api/plugins/manifest.get.mjs +2 -1
  157. package/.output/server/chunks/routes/api/plugins/manifest.get.mjs.map +1 -1
  158. package/.output/server/chunks/routes/api/system/config-groups/_id_.delete.mjs +32 -0
  159. package/.output/server/chunks/routes/api/system/config-groups/_id_.delete.mjs.map +1 -0
  160. package/.output/server/chunks/routes/api/system/config-groups/_id_.patch.mjs +36 -0
  161. package/.output/server/chunks/routes/api/system/config-groups/_id_.patch.mjs.map +1 -0
  162. package/.output/server/chunks/routes/api/system/config.get.mjs +1 -0
  163. package/.output/server/chunks/routes/api/system/config.get.mjs.map +1 -1
  164. package/.output/server/chunks/routes/api/system/index.get.mjs +7 -2
  165. package/.output/server/chunks/routes/api/system/index.get.mjs.map +1 -1
  166. package/.output/server/chunks/routes/api/system/index.patch.mjs +2 -1
  167. package/.output/server/chunks/routes/api/system/index.patch.mjs.map +1 -1
  168. package/.output/server/chunks/routes/api/system/index.post.mjs +36 -0
  169. package/.output/server/chunks/routes/api/system/index.post.mjs.map +1 -0
  170. package/.output/server/chunks/routes/api/system/index2.get.mjs +28 -0
  171. package/.output/server/chunks/routes/api/system/index2.get.mjs.map +1 -0
  172. package/.output/server/chunks/routes/api/system/monitor/terminal/ws.mjs +2 -1
  173. package/.output/server/chunks/routes/api/system/monitor/terminal/ws.mjs.map +1 -1
  174. package/.output/server/chunks/routes/api/system/monitor/terminate.post.mjs +2 -1
  175. package/.output/server/chunks/routes/api/system/monitor/terminate.post.mjs.map +1 -1
  176. package/.output/server/chunks/routes/api/system/monitor.get.mjs +1 -0
  177. package/.output/server/chunks/routes/api/system/monitor.get.mjs.map +1 -1
  178. package/.output/server/chunks/routes/api/system/settings/events.get.mjs +8 -5
  179. package/.output/server/chunks/routes/api/system/settings/events.get.mjs.map +1 -1
  180. package/.output/server/chunks/routes/api/system/settings/reset.post.mjs +2 -1
  181. package/.output/server/chunks/routes/api/system/settings/reset.post.mjs.map +1 -1
  182. package/.output/server/chunks/routes/api/users/_id_.delete.mjs +2 -1
  183. package/.output/server/chunks/routes/api/users/_id_.delete.mjs.map +1 -1
  184. package/.output/server/chunks/routes/api/users/_id_.get.mjs +2 -1
  185. package/.output/server/chunks/routes/api/users/_id_.get.mjs.map +1 -1
  186. package/.output/server/chunks/routes/api/users/_id_.put.mjs +1 -1
  187. package/.output/server/chunks/routes/api/users/index.get.mjs +2 -1
  188. package/.output/server/chunks/routes/api/users/index.get.mjs.map +1 -1
  189. package/.output/server/chunks/routes/api/users/index.post.mjs +1 -1
  190. package/.output/server/chunks/routes/api/users/login.post.mjs +1 -1
  191. package/.output/server/chunks/routes/api/users/logout.post.mjs +2 -1
  192. package/.output/server/chunks/routes/api/users/logout.post.mjs.map +1 -1
  193. package/.output/server/chunks/routes/api/users/me.get.mjs +2 -1
  194. package/.output/server/chunks/routes/api/users/me.get.mjs.map +1 -1
  195. package/.output/server/chunks/routes/api/users/register.post.mjs +1 -1
  196. package/.output/server/chunks/routes/api/users/setup-status.get.mjs +2 -1
  197. package/.output/server/chunks/routes/api/users/setup-status.get.mjs.map +1 -1
  198. package/.output/server/chunks/routes/api/users/tokens/_id/token.get.mjs +2 -1
  199. package/.output/server/chunks/routes/api/users/tokens/_id/token.get.mjs.map +1 -1
  200. package/.output/server/chunks/routes/api/users/tokens/_id_.delete.mjs +2 -1
  201. package/.output/server/chunks/routes/api/users/tokens/_id_.delete.mjs.map +1 -1
  202. package/.output/server/chunks/routes/api/users/tokens/_id_.patch.mjs +1 -1
  203. package/.output/server/chunks/routes/api/workshop/_...path_.mjs +2 -1
  204. package/.output/server/chunks/routes/api/workshop/_...path_.mjs.map +1 -1
  205. package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.get.mjs +2 -1
  206. package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.get.mjs.map +1 -1
  207. package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.post.mjs +1 -1
  208. package/.output/server/chunks/routes/api/workshop/a2a/send.post.mjs +1 -1
  209. package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs +2 -1
  210. package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs.map +1 -1
  211. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs +5 -2
  212. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs.map +1 -1
  213. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs +9 -3
  214. package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs.map +1 -1
  215. package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs +2 -1
  216. package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs.map +1 -1
  217. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +2 -1
  218. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs.map +1 -1
  219. package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs +23 -3
  220. package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs.map +1 -1
  221. package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +21 -3
  222. package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs.map +1 -1
  223. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +2 -1
  224. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -1
  225. package/.output/server/chunks/routes/api/workshop/agents/_id_.delete.mjs +2 -1
  226. package/.output/server/chunks/routes/api/workshop/agents/_id_.delete.mjs.map +1 -1
  227. package/.output/server/chunks/routes/api/workshop/agents/_id_.get.mjs +2 -1
  228. package/.output/server/chunks/routes/api/workshop/agents/_id_.get.mjs.map +1 -1
  229. package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
  230. package/.output/server/chunks/routes/api/workshop/agents/subscribe.post.mjs +1 -1
  231. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +75 -0
  232. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs.map +1 -0
  233. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +35 -0
  234. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs.map +1 -0
  235. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +35 -0
  236. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs.map +1 -0
  237. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +46 -0
  238. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs.map +1 -0
  239. package/.output/server/chunks/routes/api/workshop/aml/index2.get.mjs +47 -0
  240. package/.output/server/chunks/routes/api/workshop/aml/index2.get.mjs.map +1 -0
  241. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +48 -0
  242. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs.map +1 -0
  243. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +41 -0
  244. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs.map +1 -0
  245. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +62 -0
  246. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs.map +1 -0
  247. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +35 -0
  248. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs.map +1 -0
  249. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +36 -0
  250. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs.map +1 -0
  251. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +34 -0
  252. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs.map +1 -0
  253. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs +38 -0
  254. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs.map +1 -0
  255. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +37 -0
  256. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs.map +1 -0
  257. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +42 -0
  258. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs.map +1 -0
  259. package/.output/server/chunks/routes/api/workshop/approvals/_id/decide.post.mjs +2 -1
  260. package/.output/server/chunks/routes/api/workshop/approvals/_id/decide.post.mjs.map +1 -1
  261. package/.output/server/chunks/routes/api/workshop/assets/character/_id_.delete.mjs +2 -1
  262. package/.output/server/chunks/routes/api/workshop/assets/character/_id_.delete.mjs.map +1 -1
  263. package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +2 -1
  264. package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs.map +1 -1
  265. package/.output/server/chunks/routes/api/workshop/assets/index.get.mjs +2 -1
  266. package/.output/server/chunks/routes/api/workshop/assets/index.get.mjs.map +1 -1
  267. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +2 -1
  268. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs.map +1 -1
  269. package/.output/server/chunks/routes/api/workshop/assets/index2.get.mjs +1 -0
  270. package/.output/server/chunks/routes/api/workshop/assets/index2.get.mjs.map +1 -1
  271. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +2 -1
  272. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs.map +1 -1
  273. package/.output/server/chunks/routes/api/workshop/audit.get.mjs +2 -1
  274. package/.output/server/chunks/routes/api/workshop/audit.get.mjs.map +1 -1
  275. package/.output/server/chunks/routes/api/workshop/caller.mjs +2 -1
  276. package/.output/server/chunks/routes/api/workshop/caller.mjs.map +1 -1
  277. package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
  278. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.delete.mjs +2 -1
  279. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.delete.mjs.map +1 -1
  280. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.get.mjs +2 -1
  281. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.get.mjs.map +1 -1
  282. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
  283. package/.output/server/chunks/routes/api/workshop/channel-templates/from-channel.post.mjs +1 -1
  284. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +2 -1
  285. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs.map +1 -1
  286. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.get.mjs +2 -1
  287. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.get.mjs.map +1 -1
  288. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.post.mjs +1 -1
  289. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/_memoryId_.delete.mjs +2 -1
  290. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/_memoryId_.delete.mjs.map +1 -1
  291. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/search.post.mjs +1 -1
  292. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/model.patch.mjs +2 -1
  293. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/model.patch.mjs.map +1 -1
  294. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/position.patch.mjs +2 -1
  295. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/position.patch.mjs.map +1 -1
  296. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/range.patch.mjs +2 -1
  297. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/range.patch.mjs.map +1 -1
  298. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/stop.post.mjs +2 -1
  299. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/stop.post.mjs.map +1 -1
  300. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.delete.mjs +2 -1
  301. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.delete.mjs.map +1 -1
  302. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +2 -1
  303. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs.map +1 -1
  304. package/.output/server/chunks/routes/api/workshop/channels/_id/events.get.mjs +1 -1
  305. package/.output/server/chunks/routes/api/workshop/channels/_id/index.get.mjs +2 -1
  306. package/.output/server/chunks/routes/api/workshop/channels/_id/index.get.mjs.map +1 -1
  307. package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
  308. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +2 -1
  309. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs.map +1 -1
  310. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +2 -1
  311. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs.map +1 -1
  312. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
  313. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
  314. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
  315. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +2 -1
  316. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs.map +1 -1
  317. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.post.mjs +1 -1
  318. package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.mjs +1 -0
  319. package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.mjs.map +1 -1
  320. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId_.delete.mjs +2 -1
  321. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId_.delete.mjs.map +1 -1
  322. package/.output/server/chunks/routes/api/workshop/channels/_id/queue.get.mjs +2 -1
  323. package/.output/server/chunks/routes/api/workshop/channels/_id/queue.get.mjs.map +1 -1
  324. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +2 -1
  325. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs.map +1 -1
  326. package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -0
  327. package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs.map +1 -1
  328. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +2 -1
  329. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs.map +1 -1
  330. package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +1 -1
  331. package/.output/server/chunks/routes/api/workshop/channels.get.mjs +1 -0
  332. package/.output/server/chunks/routes/api/workshop/channels.get.mjs.map +1 -1
  333. package/.output/server/chunks/routes/api/workshop/channels.post.mjs +4 -4
  334. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +2 -1
  335. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs.map +1 -1
  336. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +2 -1
  337. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs.map +1 -1
  338. package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +2 -1
  339. package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs.map +1 -1
  340. package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +2 -1
  341. package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs.map +1 -1
  342. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +2 -1
  343. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs.map +1 -1
  344. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +2 -1
  345. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs.map +1 -1
  346. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +3 -1
  347. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs.map +1 -1
  348. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +2 -1
  349. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs.map +1 -1
  350. package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +2 -1
  351. package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs.map +1 -1
  352. package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs +2 -1
  353. package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs.map +1 -1
  354. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +2 -1
  355. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs.map +1 -1
  356. package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +2 -1
  357. package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs.map +1 -1
  358. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +2 -1
  359. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs.map +1 -1
  360. package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +2 -1
  361. package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs.map +1 -1
  362. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +2 -1
  363. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs.map +1 -1
  364. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +2 -1
  365. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs.map +1 -1
  366. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +2 -1
  367. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs.map +1 -1
  368. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +2 -1
  369. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs.map +1 -1
  370. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +2 -1
  371. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs.map +1 -1
  372. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +2 -1
  373. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs.map +1 -1
  374. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +2 -1
  375. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs.map +1 -1
  376. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +2 -1
  377. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs.map +1 -1
  378. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +2 -1
  379. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs.map +1 -1
  380. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +2 -1
  381. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs.map +1 -1
  382. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +7 -2
  383. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs.map +1 -1
  384. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +2 -1
  385. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs.map +1 -1
  386. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +2 -1
  387. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs.map +1 -1
  388. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +2 -1
  389. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs.map +1 -1
  390. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +2 -1
  391. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs.map +1 -1
  392. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +2 -1
  393. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs.map +1 -1
  394. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +2 -1
  395. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs.map +1 -1
  396. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +2 -1
  397. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs.map +1 -1
  398. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +2 -1
  399. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs.map +1 -1
  400. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +2 -1
  401. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs.map +1 -1
  402. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +2 -1
  403. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs.map +1 -1
  404. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +2 -1
  405. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs.map +1 -1
  406. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +2 -1
  407. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs.map +1 -1
  408. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +2 -1
  409. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs.map +1 -1
  410. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +2 -1
  411. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs.map +1 -1
  412. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +2 -1
  413. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs.map +1 -1
  414. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs +2 -1
  415. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs.map +1 -1
  416. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +2 -1
  417. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs.map +1 -1
  418. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +2 -1
  419. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs.map +1 -1
  420. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +2 -1
  421. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs.map +1 -1
  422. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +2 -1
  423. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs.map +1 -1
  424. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +2 -1
  425. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs.map +1 -1
  426. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +2 -1
  427. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs.map +1 -1
  428. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +2 -1
  429. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs.map +1 -1
  430. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +2 -1
  431. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs.map +1 -1
  432. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs +2 -1
  433. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs.map +1 -1
  434. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +2 -1
  435. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs.map +1 -1
  436. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/versions.get.mjs +2 -1
  437. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/versions.get.mjs.map +1 -1
  438. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -1
  439. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs.map +1 -1
  440. package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs +2 -1
  441. package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs.map +1 -1
  442. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +2 -1
  443. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs.map +1 -1
  444. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +2 -1
  445. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs.map +1 -1
  446. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +2 -1
  447. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs.map +1 -1
  448. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +2 -1
  449. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs.map +1 -1
  450. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +2 -1
  451. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs.map +1 -1
  452. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +2 -1
  453. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs.map +1 -1
  454. package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +2 -1
  455. package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs.map +1 -1
  456. package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +2 -1
  457. package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs.map +1 -1
  458. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +2 -1
  459. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs.map +1 -1
  460. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +2 -1
  461. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs.map +1 -1
  462. package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +2 -1
  463. package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs.map +1 -1
  464. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +32 -1
  465. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs.map +1 -1
  466. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +2 -1
  467. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs.map +1 -1
  468. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +2 -1
  469. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs.map +1 -1
  470. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +3 -2
  471. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs.map +1 -1
  472. package/.output/server/chunks/routes/api/workshop/index.get.mjs +1 -0
  473. package/.output/server/chunks/routes/api/workshop/index.get.mjs.map +1 -1
  474. package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
  475. package/.output/server/chunks/routes/api/workshop/index.put.mjs +2 -1
  476. package/.output/server/chunks/routes/api/workshop/index.put.mjs.map +1 -1
  477. package/.output/server/chunks/routes/api/workshop/index10.get.mjs +12 -6
  478. package/.output/server/chunks/routes/api/workshop/index10.get.mjs.map +1 -1
  479. package/.output/server/chunks/routes/api/workshop/index11.get.mjs +4 -2
  480. package/.output/server/chunks/routes/api/workshop/index11.get.mjs.map +1 -1
  481. package/.output/server/chunks/routes/api/workshop/index12.get.mjs +28 -0
  482. package/.output/server/chunks/routes/api/workshop/index12.get.mjs.map +1 -0
  483. package/.output/server/chunks/routes/api/workshop/index2.get.mjs +17 -11
  484. package/.output/server/chunks/routes/api/workshop/index2.get.mjs.map +1 -1
  485. package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
  486. package/.output/server/chunks/routes/api/workshop/index3.get.mjs +11 -4
  487. package/.output/server/chunks/routes/api/workshop/index3.get.mjs.map +1 -1
  488. package/.output/server/chunks/routes/api/workshop/index3.post.mjs +2 -1
  489. package/.output/server/chunks/routes/api/workshop/index3.post.mjs.map +1 -1
  490. package/.output/server/chunks/routes/api/workshop/index4.get.mjs +5 -27
  491. package/.output/server/chunks/routes/api/workshop/index4.get.mjs.map +1 -1
  492. package/.output/server/chunks/routes/api/workshop/index4.post.mjs +2 -1
  493. package/.output/server/chunks/routes/api/workshop/index4.post.mjs.map +1 -1
  494. package/.output/server/chunks/routes/api/workshop/index5.get.mjs +24 -18
  495. package/.output/server/chunks/routes/api/workshop/index5.get.mjs.map +1 -1
  496. package/.output/server/chunks/routes/api/workshop/index5.post.mjs +2 -1
  497. package/.output/server/chunks/routes/api/workshop/index5.post.mjs.map +1 -1
  498. package/.output/server/chunks/routes/api/workshop/index6.get.mjs +23 -5
  499. package/.output/server/chunks/routes/api/workshop/index6.get.mjs.map +1 -1
  500. package/.output/server/chunks/routes/api/workshop/index6.post.mjs +2 -1
  501. package/.output/server/chunks/routes/api/workshop/index6.post.mjs.map +1 -1
  502. package/.output/server/chunks/routes/api/workshop/index7.get.mjs +4 -17
  503. package/.output/server/chunks/routes/api/workshop/index7.get.mjs.map +1 -1
  504. package/.output/server/chunks/routes/api/workshop/index7.post.mjs +8 -3
  505. package/.output/server/chunks/routes/api/workshop/index7.post.mjs.map +1 -1
  506. package/.output/server/chunks/routes/api/workshop/index8.get.mjs +20 -21
  507. package/.output/server/chunks/routes/api/workshop/index8.get.mjs.map +1 -1
  508. package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
  509. package/.output/server/chunks/routes/api/workshop/index9.get.mjs +24 -11
  510. package/.output/server/chunks/routes/api/workshop/index9.get.mjs.map +1 -1
  511. package/.output/server/chunks/routes/api/workshop/mailbox/all.get.mjs +1 -0
  512. package/.output/server/chunks/routes/api/workshop/mailbox/all.get.mjs.map +1 -1
  513. package/.output/server/chunks/routes/api/workshop/mailbox.get.mjs +1 -0
  514. package/.output/server/chunks/routes/api/workshop/mailbox.get.mjs.map +1 -1
  515. package/.output/server/chunks/routes/api/workshop/memories/maintenance.post.mjs +2 -1
  516. package/.output/server/chunks/routes/api/workshop/memories/maintenance.post.mjs.map +1 -1
  517. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +2 -1
  518. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs.map +1 -1
  519. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +2 -1
  520. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs.map +1 -1
  521. package/.output/server/chunks/routes/api/workshop/plugins/index.get.mjs +2 -1
  522. package/.output/server/chunks/routes/api/workshop/plugins/index.get.mjs.map +1 -1
  523. package/.output/server/chunks/routes/api/workshop/runtime.get.mjs +1 -0
  524. package/.output/server/chunks/routes/api/workshop/runtime.get.mjs.map +1 -1
  525. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +2 -1
  526. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs.map +1 -1
  527. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +2 -1
  528. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs.map +1 -1
  529. package/.output/server/chunks/routes/api/workshop/scene/layouts.get.mjs +1 -0
  530. package/.output/server/chunks/routes/api/workshop/scene/layouts.get.mjs.map +1 -1
  531. package/.output/server/chunks/routes/api/workshop/tasks/_id/complete.post.mjs +1 -1
  532. package/.output/server/chunks/routes/api/workshop/tasks/_id/dispatch.post.mjs +1 -1
  533. package/.output/server/chunks/routes/api/workshop/tasks/_id/index.post.mjs +2 -1
  534. package/.output/server/chunks/routes/api/workshop/tasks/_id/index.post.mjs.map +1 -1
  535. package/.output/server/chunks/routes/api/workshop/tasks/_id/report.post.mjs +1 -1
  536. package/.output/server/chunks/routes/api/workshop/tasks/_id/retry.post.mjs +2 -1
  537. package/.output/server/chunks/routes/api/workshop/tasks/_id/retry.post.mjs.map +1 -1
  538. package/.output/server/chunks/routes/api/workshop/tasks/_id_.get.mjs +2 -1
  539. package/.output/server/chunks/routes/api/workshop/tasks/_id_.get.mjs.map +1 -1
  540. package/.output/server/chunks/routes/api/workshop/tasks.get.mjs +1 -0
  541. package/.output/server/chunks/routes/api/workshop/tasks.get.mjs.map +1 -1
  542. package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
  543. package/.output/server/chunks/routes/api/workshop/teams/_id/index.get.mjs +2 -1
  544. package/.output/server/chunks/routes/api/workshop/teams/_id/index.get.mjs.map +1 -1
  545. package/.output/server/chunks/routes/api/workshop/teams/_id/index.post.mjs +1 -1
  546. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +44 -0
  547. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs.map +1 -0
  548. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +47 -0
  549. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs.map +1 -0
  550. package/.output/server/chunks/routes/api/workshop/teams/_id/members/_agentId_.delete.mjs +2 -1
  551. package/.output/server/chunks/routes/api/workshop/teams/_id/members/_agentId_.delete.mjs.map +1 -1
  552. package/.output/server/chunks/routes/api/workshop/teams/_id_.delete.mjs +2 -1
  553. package/.output/server/chunks/routes/api/workshop/teams/_id_.delete.mjs.map +1 -1
  554. package/.output/server/chunks/routes/api/workshop/teams/_id_.get.mjs +2 -1
  555. package/.output/server/chunks/routes/api/workshop/teams/_id_.get.mjs.map +1 -1
  556. package/.output/server/chunks/routes/api/workshop/teams/_id_.patch.mjs +1 -1
  557. package/.output/server/chunks/routes/api/workshop/users/me.get.mjs +2 -0
  558. package/.output/server/chunks/routes/api/workshop/users/me.get.mjs.map +1 -1
  559. package/.output/server/chunks/routes/api/workshop/users/register.post.mjs +1 -1
  560. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
  561. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.delete.mjs +1 -0
  562. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.delete.mjs.map +1 -1
  563. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.post.mjs +1 -0
  564. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.post.mjs.map +1 -1
  565. package/.output/server/chunks/routes/api/workshop/workspaces/index.delete.mjs +1 -0
  566. package/.output/server/chunks/routes/api/workshop/workspaces/index.delete.mjs.map +1 -1
  567. package/.output/server/chunks/routes/renderer.mjs +2 -2
  568. package/.output/server/chunks/virtual/entry.mjs +601 -36
  569. package/.output/server/chunks/virtual/entry.mjs.map +1 -1
  570. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  571. package/.output/server/index.mjs +1 -0
  572. package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/package.json +84 -0
  573. package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +225 -0
  574. package/.output/server/package.json +2 -1
  575. package/README-zh.md +507 -478
  576. package/README.md +517 -486
  577. package/app/app.vue +17 -2
  578. package/app/assets/css/main.css +421 -30
  579. package/app/components/AppHeader.vue +17 -0
  580. package/app/components/AppSidebar.vue +162 -63
  581. package/app/components/AwChart.vue +57 -54
  582. package/app/components/workshop/ChannelSessionList.vue +802 -703
  583. package/app/components/workshop/DaqNodeRow.vue +156 -0
  584. package/app/components/workshop/PluginSlot.vue +120 -0
  585. package/app/composables/workshop/useAmlStream.ts +136 -0
  586. package/app/composables/workshop/useDaqStream.ts +8 -1
  587. package/app/composables/workshop/usePluginPanels.ts +72 -0
  588. package/app/composables/workshop/useWorkshopApi.ts +7 -0
  589. package/app/pages/aml/index.vue +1949 -0
  590. package/app/pages/daq/[id].vue +60 -2
  591. package/app/pages/daq/index.vue +7 -148
  592. package/app/pages/index.vue +235 -213
  593. package/app/pages/plugins/index.vue +280 -274
  594. package/app/pages/settings.vue +555 -78
  595. package/app/pages/workshop/agents.vue +23 -1
  596. package/app/pages/workshop/teams.vue +2 -2
  597. package/app/plugins/aw-plugins.client.ts +95 -6
  598. package/app/plugins/runtime-config.client.ts +4 -14
  599. package/app/plugins/theme.client.ts +13 -3
  600. package/app/stores/app.ts +9 -2
  601. package/app/stores/runtime-config.ts +113 -7
  602. package/cli/aw.mjs +16 -3
  603. package/cli/commands/build.mjs +8 -8
  604. package/cli/commands/dev.mjs +5 -13
  605. package/cli/commands/init.mjs +1 -1
  606. package/cli/commands/start.mjs +10 -17
  607. package/cli/core/args.mjs +85 -4
  608. package/cli/core/child-lifecycle.mjs +136 -0
  609. package/config.yml +24 -0
  610. package/docs/plugins.md +128 -220
  611. package/docs/sdk.md +1 -1
  612. package/i18n/dicts/_en.json +43 -2
  613. package/i18n/dicts/aml.json +163 -0
  614. package/i18n/dicts/channelSessionList.json +4 -1
  615. package/i18n/dicts/daqDetail.json +1 -0
  616. package/i18n/dicts/settings.json +33 -1
  617. package/i18n/dicts/teams.json +9 -1
  618. package/i18n/locales/en.ts +364 -132
  619. package/i18n/locales/zh-CN.ts +433 -201
  620. package/nuxt.config.ts +18 -3
  621. package/package.json +153 -149
  622. package/scripts/_audit/.tmp/audit-data/dcws.json +28 -0
  623. package/scripts/_audit/.tmp/dcw-writes.json +15650 -0
  624. package/scripts/_audit/.tmp/dcws.json +9033 -0
  625. package/scripts/_audit/.tmp/pollution-backup/dcw-rollback.polluted.json +470006 -0
  626. package/scripts/_audit/.tmp/pollution-backup/dcws.polluted.json +9085 -0
  627. package/scripts/_audit/.tmp/probe-cwd.txt +1 -0
  628. package/scripts/_audit/audit-harness-adapters.md +664 -0
  629. package/scripts/_audit/awhome/commands/README.md +3 -0
  630. package/scripts/_audit/awhome/commands/hello.mjs +12 -0
  631. package/scripts/_audit/dcw-controller-e2e.ts +99 -0
  632. package/scripts/_audit/dcw-flush-cost.ts +43 -0
  633. package/scripts/_audit/dcw-rollback-ledger.ts +153 -0
  634. package/scripts/_audit/dcw-unrecorded-write.ts +171 -0
  635. package/scripts/_audit/dcw-write-mutex.ts +157 -0
  636. package/scripts/_audit/diag-cwd.ts +20 -0
  637. package/scripts/_audit/diag-cwd2.ts +19 -0
  638. package/scripts/_audit/exp-cost-scaling.mjs +54 -0
  639. package/scripts/_audit/exp-envelope-and-png.mjs +77 -0
  640. package/scripts/_audit/exp-png-decode.mjs +67 -0
  641. package/scripts/_audit/exp-retention-plan.mjs +61 -0
  642. package/scripts/_audit/exp-retention-rescan.mjs +42 -0
  643. package/scripts/_audit/exp-sweep-fairness.mjs +48 -0
  644. package/scripts/_audit/hello.mjs +12 -0
  645. package/scripts/_audit/http-api-authz-audit.md +657 -0
  646. package/scripts/_audit/ndjson-partial-line-repro.mjs +77 -0
  647. package/scripts/_audit/opencode-await-ternary-repro.mjs +20 -0
  648. package/scripts/_audit/part-frag.txt +84 -0
  649. package/scripts/_audit/part-head.txt +45 -0
  650. package/scripts/_audit/probe-binding.mjs +103 -0
  651. package/scripts/_audit/probe-child.mjs +17 -0
  652. package/scripts/_audit/probe-envelope.mjs +49 -0
  653. package/scripts/_audit/probe-packlist.mjs +67 -0
  654. package/scripts/_audit/probe-routes.mjs +47 -0
  655. package/scripts/_audit/probe-routes2.mjs +38 -0
  656. package/scripts/_audit/probe.ts +9 -0
  657. package/scripts/_audit/probe2.ts +6 -0
  658. package/scripts/_audit/probe3.ts +3 -0
  659. package/scripts/_audit/probe4.ts +3 -0
  660. package/scripts/_audit/proj/.AgentWorkShop/commands/echoargs.mjs +13 -0
  661. package/scripts/_audit/proj/config.yml +1 -0
  662. package/scripts/_audit/run.mjs +30 -0
  663. package/scripts/_audit/runtime-audit.md +716 -0
  664. package/scripts/_audit/ts-resolve-hook.mjs +41 -0
  665. package/scripts/_audit/tsconfig.probe.json +24 -0
  666. package/scripts/_audit/typecheck-out.txt +466 -0
  667. package/scripts/_audit/verify-data-integrity.mjs +112 -0
  668. package/scripts/_dbg-agents-dropdown-shot.py +33 -0
  669. package/scripts/_dbg-anim-verify.mjs +1 -1
  670. package/scripts/_dbg-audit-all-pages.mjs +1 -1
  671. package/scripts/_dbg-availability-probe.ts +11 -0
  672. package/scripts/_dbg-bind-bidi-e2e.mjs +1 -1
  673. package/scripts/_dbg-cf-line-shot.mjs +18 -0
  674. package/scripts/_dbg-channel-plugin-ui.mjs +94 -0
  675. package/scripts/_dbg-configroot-audit.mjs +84 -0
  676. package/scripts/_dbg-crash-recovery.mjs +1 -1
  677. package/scripts/_dbg-crush-probe.sh +21 -0
  678. package/scripts/_dbg-crush-spawn-probe.ts +22 -0
  679. package/scripts/_dbg-daq-acc-probe.mjs +1 -1
  680. package/scripts/_dbg-daq-attrib.mjs +1 -1
  681. package/scripts/_dbg-daq-debug.mjs +1 -1
  682. package/scripts/_dbg-daq-diag.mjs +1 -1
  683. package/scripts/_dbg-daq-e2e.mjs +1 -1
  684. package/scripts/_dbg-daq-filter-e2e.mjs +1 -1
  685. package/scripts/_dbg-daq-filter-e2e2.mjs +1 -1
  686. package/scripts/_dbg-daq-final-regression.mjs +1 -1
  687. package/scripts/_dbg-daq-frame-alarm.mjs +1 -1
  688. package/scripts/_dbg-daq-frame-ui.mjs +1 -1
  689. package/scripts/_dbg-daq-frame-ws.mjs +1 -1
  690. package/scripts/_dbg-daq-frames-e2e.mjs +1 -1
  691. package/scripts/_dbg-daq-full-check.mjs +1 -1
  692. package/scripts/_dbg-daq-intervals-func.mjs +94 -0
  693. package/scripts/_dbg-daq-pages-shot.mjs +1 -1
  694. package/scripts/_dbg-daq-perf.mjs +1 -1
  695. package/scripts/_dbg-daq-probe.mjs +1 -1
  696. package/scripts/_dbg-daq-recipe-e2e.mjs +1 -1
  697. package/scripts/_dbg-daq-rows-probe.mjs +1 -1
  698. package/scripts/_dbg-daq-rowstate-e2e.mjs +1 -1
  699. package/scripts/_dbg-daq-rowstate-shot.mjs +1 -1
  700. package/scripts/_dbg-daq-rowstate-shot2.mjs +1 -1
  701. package/scripts/_dbg-daq-rowstyle-verify.mjs +112 -0
  702. package/scripts/_dbg-dash-console-check.mjs +1 -1
  703. package/scripts/_dbg-dash-deep-probe.mjs +1 -1
  704. package/scripts/_dbg-dash-hitpoint.mjs +1 -1
  705. package/scripts/_dbg-dcw-read-rest.mjs +1 -1
  706. package/scripts/_dbg-dcw-read-ui.mjs +1 -1
  707. package/scripts/_dbg-dcw-shot2.mjs +1 -1
  708. package/scripts/_dbg-diag-mock-loop.mjs +89 -0
  709. package/scripts/_dbg-diag-watch.mjs +95 -0
  710. package/scripts/_dbg-error-probe.mjs +2 -2
  711. package/scripts/_dbg-filter-light-verify.mjs +1 -1
  712. package/scripts/_dbg-final-acceptance-2.mjs +1 -1
  713. package/scripts/_dbg-final-acceptance.mjs +1 -1
  714. package/scripts/_dbg-final-full-e2e.mjs +1 -1
  715. package/scripts/_dbg-final-shots.mjs +32 -0
  716. package/scripts/_dbg-final-t6-hitl.mjs +1 -1
  717. package/scripts/_dbg-fix-unused-imports.py +41 -0
  718. package/scripts/_dbg-fresh-scene-e2e.mjs +1 -1
  719. package/scripts/_dbg-goose-probe.mjs +33 -0
  720. package/scripts/_dbg-goose-probe.sh +10 -0
  721. package/scripts/_dbg-groups-ui-verify.mjs +122 -0
  722. package/scripts/_dbg-harness-ui-shot.py +109 -0
  723. package/scripts/_dbg-hidden-check.mjs +1 -1
  724. package/scripts/_dbg-home-repro.mjs +1 -1
  725. package/scripts/_dbg-home-stack.mjs +1 -1
  726. package/scripts/_dbg-hydration-detail.mjs +1 -1
  727. package/scripts/_dbg-infra-lifecycle.mjs +1 -1
  728. package/scripts/_dbg-line-live-e2e.mjs +1 -1
  729. package/scripts/_dbg-line-repo-test.ts +10 -0
  730. package/scripts/_dbg-login-debug.py +23 -0
  731. package/scripts/_dbg-modbus-latency.mjs +22 -0
  732. package/scripts/_dbg-mqtt-chain-e2e.mjs +1 -1
  733. package/scripts/_dbg-oneshot-impl-probe.ts +67 -0
  734. package/scripts/_dbg-opt-team-e2e.mjs +1 -1
  735. package/scripts/_dbg-panesplitter-fix-check.mjs +1 -1
  736. package/scripts/_dbg-phase-e3-monitor.mjs +1 -1
  737. package/scripts/_dbg-pi-spawn-probe.ts +33 -0
  738. package/scripts/_dbg-plc-e2e.mjs +1 -1
  739. package/scripts/_dbg-plugin-config-ui.mjs +111 -0
  740. package/scripts/_dbg-plugin-panels-ui.mjs +54 -0
  741. package/scripts/_dbg-plugin-sink-rest.mjs +1 -1
  742. package/scripts/_dbg-plugin-sink-ui.mjs +1 -1
  743. package/scripts/_dbg-plugin-ui-wizard.mjs +1 -1
  744. package/scripts/_dbg-plugin-verify-e2e.mjs +1 -1
  745. package/scripts/_dbg-pop-clamp-verify.mjs +1 -1
  746. package/scripts/_dbg-preview-console.mjs +1 -1
  747. package/scripts/_dbg-preview-minrepro.mjs +1 -1
  748. package/scripts/_dbg-preview-pixels.mjs +1 -1
  749. package/scripts/_dbg-quality-pages-e2e.mjs +1 -1
  750. package/scripts/_dbg-qwen-acp-probe.mjs +30 -0
  751. package/scripts/_dbg-qwen-capture.mjs +21 -0
  752. package/scripts/_dbg-rail-tree-e2e.mjs +1 -1
  753. package/scripts/_dbg-real-driver-e2e.mjs +1 -1
  754. package/scripts/_dbg-real-scenario-timeline.log +55 -123
  755. package/scripts/_dbg-redesign-shots.mjs +1 -1
  756. package/scripts/_dbg-release-smoke.mjs +1 -1
  757. package/scripts/_dbg-resolve-probe.ts +6 -0
  758. package/scripts/_dbg-restart-persist.mjs +1 -1
  759. package/scripts/_dbg-sc001-dispatch.mjs +1 -1
  760. package/scripts/_dbg-scenario-final-shot.mjs +1 -1
  761. package/scripts/_dbg-scenario-phase-e2.mjs +1 -1
  762. package/scripts/_dbg-scenario-phase-e3.mjs +1 -1
  763. package/scripts/_dbg-scenario-phase1.mjs +1 -1
  764. package/scripts/_dbg-scenario-phase2.mjs +1 -1
  765. package/scripts/_dbg-scenario-phase3-monitor.mjs +1 -1
  766. package/scripts/_dbg-scenario-phase3.mjs +1 -1
  767. package/scripts/_dbg-settings-draft-probe.mjs +39 -0
  768. package/scripts/_dbg-settings-probe.mjs +33 -0
  769. package/scripts/_dbg-task-cancel-probe.mjs +66 -0
  770. package/scripts/_dbg-town-alarm-e2e.mjs +1 -1
  771. package/scripts/_dbg-town-daq-shot.mjs +1 -1
  772. package/scripts/_dbg-town-full-e2e.mjs +1 -1
  773. package/scripts/_dbg-town-gate.mjs +1 -1
  774. package/scripts/_dbg-town-ins-probe.mjs +1 -1
  775. package/scripts/_dbg-town-perf.mjs +1 -1
  776. package/scripts/_dbg-town-realtime.mjs +1 -1
  777. package/scripts/_dbg-town-shot.py +25 -0
  778. package/scripts/_dbg-town-shot3.mjs +1 -1
  779. package/scripts/_dbg-town-smoke.mjs +54 -0
  780. package/scripts/_dbg-town-truth.mjs +1 -1
  781. package/scripts/_dbg-town-truth2.mjs +1 -1
  782. package/scripts/_dbg-trend-expand-test.mjs +1 -1
  783. package/scripts/_dbg-twindaq-focus.mjs +1 -1
  784. package/scripts/_dbg-ui-polish-shot.mjs +1 -1
  785. package/scripts/_dbg-ui-polish-verify1.mjs +1 -1
  786. package/scripts/_dbg-ui-polish-verify2.mjs +1 -1
  787. package/scripts/_dbg-ui-polish-verify3.mjs +1 -1
  788. package/scripts/_dbg-ui-polish-verify4.mjs +1 -1
  789. package/scripts/_dbg-unify-shot.mjs +1 -1
  790. package/scripts/_dbg-uplink-probe.mjs +1 -1
  791. package/scripts/_dbg-wizard-preview-shot.mjs +1 -1
  792. package/scripts/_dbg-wizard-ui-e2e.mjs +1 -1
  793. package/scripts/_dbg-ws-probe.mjs +1 -1
  794. package/scripts/_dbg-wsdot-sanity.mjs +1 -1
  795. package/scripts/_node-state-probe.mjs +1 -1
  796. package/scripts/_tmp-args-probe.mjs +20 -0
  797. package/scripts/_tmp-cyc-entry.mjs +8 -0
  798. package/scripts/_tmp-cyc-main.mjs +5 -0
  799. package/scripts/_tmp-cyc-mod.mjs +2 -0
  800. package/scripts/_tmp-cycle-a.mjs +6 -0
  801. package/scripts/_tmp-cycle-b.mjs +2 -0
  802. package/scripts/_tmp-cycle-probe.mjs +4 -0
  803. package/scripts/_tmp-entry-variant.mjs +2 -0
  804. package/scripts/_tmp-help-probe.mjs +19 -0
  805. package/scripts/_tmp-help-probe2.mjs +2 -0
  806. package/scripts/_tmp-trace-preload.mjs +1 -0
  807. package/scripts/aml-agent-bridge.ts +230 -0
  808. package/scripts/aml-industrial-loop.ts +232 -0
  809. package/scripts/aml-ui-smoke.mjs +67 -0
  810. package/scripts/aw-start-smoke.mjs +194 -0
  811. package/scripts/design-verify-templates.mjs +1 -1
  812. package/scripts/device-line-restore.mjs +1 -1
  813. package/scripts/e2e-aml.ts +259 -0
  814. package/scripts/e2e-config-groups.mjs +238 -0
  815. package/scripts/e2e-full-closedloop.mjs +911 -0
  816. package/scripts/e2e-full-scenario.ts +321 -0
  817. package/scripts/e2e-harness-consistency.ts +204 -0
  818. package/scripts/e2e-multi-harness.ts +233 -76
  819. package/scripts/e2e-plc-plugin-closedloop.mjs +518 -0
  820. package/scripts/e2e-real-scenario.mjs +466 -452
  821. package/scripts/e2e-template-isolation.mjs +2 -2
  822. package/scripts/experiment-castfilm-closedloop.mjs +423 -0
  823. package/scripts/experiment-castfilm-finish.mjs +194 -0
  824. package/scripts/experiment-castfilm-ui-shot.mjs +52 -0
  825. package/scripts/experiment-castfilm-viz.mjs +172 -0
  826. package/scripts/production-closed-loop-e2e.mjs +74 -28
  827. package/scripts/test-aml-integration.ts +159 -0
  828. package/scripts/test-aml-job.ts +174 -0
  829. package/scripts/test-aml-unit.ts +184 -0
  830. package/scripts/test-cli-exit.mjs +235 -0
  831. package/scripts/test-daq-frame-race.mjs +310 -0
  832. package/scripts/test-data-root.mjs +208 -0
  833. package/scripts/test-log-flooding.mjs +160 -0
  834. package/scripts/test-lru.mjs +78 -0
  835. package/scripts/test-memory-month-query.mjs +62 -0
  836. package/scripts/test-plugin-hardening.mjs +45 -0
  837. package/scripts/test-rollback-index.mjs +79 -0
  838. package/scripts/test-sdk-surface.mjs +155 -0
  839. package/scripts/three-system-e2e.mjs +662 -448
  840. package/scripts/town-scene-clear.mjs +1 -1
  841. package/sdk/client.d.mts +110 -0
  842. package/sdk/client.mjs +144 -124
  843. package/sdk/context.mjs +161 -1
  844. package/sdk/index.d.mts +37 -5
  845. package/sdk/index.mjs +44 -41
  846. package/sdk/lifecycle.mjs +4 -1
  847. package/server/api/plugins/i18n.get.ts +12 -0
  848. package/server/api/system/config-groups/[id].delete.ts +21 -0
  849. package/server/api/system/config-groups/[id].patch.ts +26 -0
  850. package/server/api/system/config-groups/index.get.ts +21 -0
  851. package/server/api/system/config-groups/index.post.ts +33 -0
  852. package/server/api/system/settings/events.get.ts +8 -4
  853. package/server/api/workshop/agent-tools/bindings/[id].delete.ts +6 -1
  854. package/server/api/workshop/agent-tools/bindings/[id].patch.ts +12 -3
  855. package/server/api/workshop/agent-tools/bindings/index.get.ts +29 -2
  856. package/server/api/workshop/agent-tools/invoke.post.ts +30 -5
  857. package/server/api/workshop/aml/datasets/[id]/preview.get.ts +68 -0
  858. package/server/api/workshop/aml/datasets/[id].get.ts +24 -0
  859. package/server/api/workshop/aml/datasets/index.get.ts +20 -0
  860. package/server/api/workshop/aml/datasets/index.post.ts +27 -0
  861. package/server/api/workshop/aml/experiments/index.get.ts +35 -0
  862. package/server/api/workshop/aml/index.get.ts +24 -0
  863. package/server/api/workshop/aml/jobs/[id]/cancel.post.ts +21 -0
  864. package/server/api/workshop/aml/jobs/[id]/logs.get.ts +23 -0
  865. package/server/api/workshop/aml/jobs/[id]/retry.post.ts +20 -0
  866. package/server/api/workshop/aml/jobs/[id].get.ts +23 -0
  867. package/server/api/workshop/aml/jobs/index.get.ts +26 -0
  868. package/server/api/workshop/aml/jobs/index.post.ts +44 -0
  869. package/server/api/workshop/aml/models/[id]/predict.post.ts +24 -0
  870. package/server/api/workshop/aml/models/[id]/promote.post.ts +30 -0
  871. package/server/api/workshop/aml/models/index.get.ts +48 -0
  872. package/server/api/workshop/daq/[id].delete.ts +6 -0
  873. package/server/api/workshop/dcw/[id].patch.ts +14 -2
  874. package/server/api/workshop/hitl/respond.post.ts +3 -1
  875. package/server/api/workshop/teams/[id]/plugins/index.get.ts +36 -0
  876. package/server/api/workshop/teams/[id]/plugins/index.put.ts +42 -0
  877. package/server/api/workshop/teams/index.post.ts +13 -0
  878. package/server/api/workshop/users/me.get.ts +5 -0
  879. package/server/api/workshop/ws.ts +14 -2
  880. package/server/data/daqs.json +1648 -123
  881. package/server/data/dcw-lines.json +301 -0
  882. package/server/data/dcw-products.json +140 -0
  883. package/server/data/dcw-recipes.json +890 -0
  884. package/server/data/dcw-rollback.json +11591 -5740
  885. package/server/data/dcw-runs.json +3745 -3559
  886. package/server/data/dcw-templates.json +120 -0
  887. package/server/data/dcw-writes.json +1800 -0
  888. package/server/data/dcws.json +1576 -287
  889. package/server/data/line-runs.json +137 -27
  890. package/server/harness/pi-aw-tools.mjs +51 -0
  891. package/server/plugins/dev-stability-guard.ts +63 -63
  892. package/server/plugins/system-config.ts +10 -11
  893. package/server/plugins/workshop.ts +10 -0
  894. package/server/plugins-builtin/diag-bridge/client.mjs +84 -0
  895. package/server/plugins-builtin/diag-bridge/i18n.json +72 -0
  896. package/server/plugins-builtin/diag-bridge/index.mjs +127 -22
  897. package/server/plugins-builtin/rag-bridge/client.mjs +108 -0
  898. package/server/plugins-builtin/rag-bridge/i18n.json +60 -0
  899. package/server/plugins-builtin/rag-bridge/index.mjs +67 -20
  900. package/server/services/system-config.ts +610 -396
  901. package/server/services/workshop/agents/adapters/line-spawn.ts +15 -6
  902. package/server/services/workshop/agents/adapters/one-shot-cli-agent.ts +530 -0
  903. package/server/services/workshop/agents/base-agent.ts +210 -0
  904. package/server/services/workshop/agents/binding-authz.ts +57 -0
  905. package/server/services/workshop/agents/claude-agent.ts +546 -30
  906. package/server/services/workshop/agents/codex-agent.ts +729 -822
  907. package/server/services/workshop/agents/copilot-agent.ts +136 -0
  908. package/server/services/workshop/agents/crush-agent.ts +107 -0
  909. package/server/services/workshop/agents/cursor-agent.ts +102 -0
  910. package/server/services/workshop/agents/dsh-agent.ts +578 -670
  911. package/server/services/workshop/agents/gemini-agent.ts +121 -0
  912. package/server/services/workshop/agents/goose-agent.ts +98 -0
  913. package/server/services/workshop/agents/harness-models.ts +305 -270
  914. package/server/services/workshop/agents/hermes-agent.ts +528 -0
  915. package/server/services/workshop/agents/host-tool-bridge.ts +53 -2
  916. package/server/services/workshop/agents/industrial-tools.ts +659 -7
  917. package/server/services/workshop/agents/omp-agent.ts +74 -59
  918. package/server/services/workshop/agents/opencode-agent.ts +936 -987
  919. package/server/services/workshop/agents/pi-agent.ts +108 -0
  920. package/server/services/workshop/agents/qwen-agent.ts +540 -0
  921. package/server/services/workshop/agents/registry.ts +117 -5
  922. package/server/services/workshop/agents/tool-approvals.ts +3 -3
  923. package/server/services/workshop/aml/aml.repo.ts +368 -0
  924. package/server/services/workshop/aml/clean.ts +120 -0
  925. package/server/services/workshop/aml/dataset-builder.ts +491 -0
  926. package/server/services/workshop/aml/gates.ts +121 -0
  927. package/server/services/workshop/aml/job-orchestrator.ts +650 -0
  928. package/server/services/workshop/aml/model-registry.ts +169 -0
  929. package/server/services/workshop/aml/predictor.ts +262 -0
  930. package/server/services/workshop/aml/python/aml_eval.py +171 -0
  931. package/server/services/workshop/aml/python/amlkit.py +120 -0
  932. package/server/services/workshop/aml/python/requirements.txt +7 -0
  933. package/server/services/workshop/aml/python/train-example.py +92 -0
  934. package/server/services/workshop/aml/python-runtime.ts +217 -0
  935. package/server/services/workshop/aml/retention.ts +98 -0
  936. package/server/services/workshop/aml/runtime.ts +45 -0
  937. package/server/services/workshop/aml/spec.ts +63 -0
  938. package/server/services/workshop/aml/stats.ts +140 -0
  939. package/server/services/workshop/daq/bus/mqtt.adapter.ts +8 -1
  940. package/server/services/workshop/daq/daq-controller.ts +147 -19
  941. package/server/services/workshop/daq/daq-node.repo.ts +13 -11
  942. package/server/services/workshop/daq/daq-runtime.ts +11 -0
  943. package/server/services/workshop/daq/drivers.ts +89 -8
  944. package/server/services/workshop/db/aml-team-seeds.ts +118 -0
  945. package/server/services/workshop/db/channel-plugins.repo.ts +27 -1
  946. package/server/services/workshop/db/database.ts +89 -1
  947. package/server/services/workshop/db/memory.repo.ts +31 -0
  948. package/server/services/workshop/db/user.repo.ts +9 -0
  949. package/server/services/workshop/dcw/dcw-controller.ts +33 -7
  950. package/server/services/workshop/dcw/dcw-line.repo.ts +5 -3
  951. package/server/services/workshop/dcw/dcw-node.repo.ts +4 -4
  952. package/server/services/workshop/dcw/dcw-product.repo.ts +8 -8
  953. package/server/services/workshop/dcw/dcw-recipe.repo.ts +6 -7
  954. package/server/services/workshop/dcw/dcw-runtime.ts +16 -2
  955. package/server/services/workshop/dcw/dcw-templates.ts +4 -4
  956. package/server/services/workshop/dcw/line-run.ts +5 -5
  957. package/server/services/workshop/dcw/recipe-rollback-manager.ts +3 -1
  958. package/server/services/workshop/dcw/recipe-rollback.repo.ts +155 -52
  959. package/server/services/workshop/logger.ts +145 -3
  960. package/server/services/workshop/plugins/host.mjs +857 -566
  961. package/server/services/workshop/prompts/loader.ts +32 -6
  962. package/server/services/workshop/runtime/manager.ts +53 -13
  963. package/server/services/workshop/runtime/scheduler-loop.ts +18 -1
  964. package/server/services/workshop/scene/scene-layout.repo.ts +5 -5
  965. package/server/services/workshop/settings.ts +64 -0
  966. package/shared/config/engine.mjs +5 -0
  967. package/shared/config/groups.mjs +220 -0
  968. package/shared/config/home.mjs +11 -2
  969. package/shared/config/schema.json +31 -6
  970. package/shared/daq-protocol.ts +6 -0
  971. package/shared/lru.mjs +94 -0
  972. package/shared/workshop-protocol.ts +2 -2
  973. package/.output/public/_nuxt/2jaJHWIJ.js +0 -1
  974. package/.output/public/_nuxt/B8kt898d.js +0 -1
  975. package/.output/public/_nuxt/BFGpEo8S.js +0 -1
  976. package/.output/public/_nuxt/BG4zduPf.js +0 -14
  977. package/.output/public/_nuxt/BHcpzI2n.js +0 -19
  978. package/.output/public/_nuxt/BWyR3awA.js +0 -1
  979. package/.output/public/_nuxt/Bc89zKq2.js +0 -1
  980. package/.output/public/_nuxt/BetmGSO4.js +0 -1
  981. package/.output/public/_nuxt/BowTbasd.js +0 -1
  982. package/.output/public/_nuxt/BvtknqSC2.js +0 -1
  983. package/.output/public/_nuxt/BytVi9VX2.js +0 -4
  984. package/.output/public/_nuxt/CJviSvm-.js +0 -1
  985. package/.output/public/_nuxt/CTfqWGdy.js +0 -1
  986. package/.output/public/_nuxt/Cb3SnTM8.js +0 -1
  987. package/.output/public/_nuxt/Chc5pfAA.js +0 -1
  988. package/.output/public/_nuxt/CobSUzQv.js +0 -2
  989. package/.output/public/_nuxt/D95h62Jn.js +0 -1
  990. package/.output/public/_nuxt/DGAOugLt.js +0 -1
  991. package/.output/public/_nuxt/DHbTyoAV.js +0 -1
  992. package/.output/public/_nuxt/DfLUN8kY.js +0 -1
  993. package/.output/public/_nuxt/DnziMlcX.js +0 -1
  994. package/.output/public/_nuxt/DvgKXPgu2.js +0 -13
  995. package/.output/public/_nuxt/Q_SJDSgx.js +0 -1
  996. package/.output/public/_nuxt/_id_.DdbYeLqn.css +0 -1
  997. package/.output/public/_nuxt/_wsId_.BqWBlY7X.css +0 -1
  998. package/.output/public/_nuxt/agents.CB9Ck7VQ.css +0 -1
  999. package/.output/public/_nuxt/bFnZa2yd.js +0 -1
  1000. package/.output/public/_nuxt/builds/meta/f7a8e33d-5422-45ac-895d-27168f97e3ad.json +0 -1
  1001. package/.output/public/_nuxt/daq.DGV9QS8d.css +0 -1
  1002. package/.output/public/_nuxt/default.BbgdTDCk.css +0 -1
  1003. package/.output/public/_nuxt/entry.BN02X8iR.css +0 -1
  1004. package/.output/public/_nuxt/pages.CG8UJ2TK.css +0 -1
  1005. package/.output/public/_nuxt/plugins.DpCuwaJt.css +0 -1
  1006. package/.output/public/_nuxt/rkVgzg62.js +0 -1
  1007. package/.output/public/_nuxt/settings.W6qrYAui.css +0 -1
  1008. package/.output/public/_nuxt/teams.BBXVkyKq.css +0 -1
  1009. package/.output/server/chunks/build/_id_-3Axz2-gV.mjs.map +0 -1
  1010. package/.output/server/chunks/build/_id_-CahfkmEt.mjs.map +0 -1
  1011. package/.output/server/chunks/build/agents-DuMiSWKp.mjs.map +0 -1
  1012. package/.output/server/chunks/build/alert-qJnjyRcP.mjs.map +0 -1
  1013. package/.output/server/chunks/build/channel-templates-BStqJ-of.mjs.map +0 -1
  1014. package/.output/server/chunks/build/daq-ChYCABz1.mjs.map +0 -1
  1015. package/.output/server/chunks/build/dcw-CcQNGggh.mjs.map +0 -1
  1016. package/.output/server/chunks/build/logs-D-2UyGtE.mjs.map +0 -1
  1017. package/.output/server/chunks/build/pages-Dfosfchr.mjs.map +0 -1
  1018. package/.output/server/chunks/build/permissions-B-hhZuzm.mjs.map +0 -1
  1019. package/.output/server/chunks/build/plugins-DZR0T4Mh.mjs.map +0 -1
  1020. package/.output/server/chunks/build/responsiveObserve-CS0UB6wQ.mjs +0 -78
  1021. package/.output/server/chunks/build/responsiveObserve-CS0UB6wQ.mjs.map +0 -1
  1022. package/.output/server/chunks/build/settings-BajN9TQW.mjs.map +0 -1
  1023. package/.output/server/chunks/build/tag-NO9jEqKy.mjs.map +0 -1
  1024. package/.output/server/chunks/build/teams-t2SkRlJP.mjs.map +0 -1
  1025. package/.output/server/chunks/build/tokens-DiCojbN8.mjs.map +0 -1
  1026. package/.output/server/chunks/build/town-C7QM8DYK.mjs.map +0 -1
  1027. package/.output/server/chunks/build/useDaqStream-BeA2X8KR.mjs.map +0 -1
  1028. package/.output/server/chunks/build/useDcwStream-BJW_MitY.mjs.map +0 -1
  1029. package/.output/server/chunks/build/users-B9SAdEtH.mjs.map +0 -1
  1030. /package/.output/public/_nuxt/{ORt9oDIy.js → ORt9oDIy2.js} +0 -0
@@ -1,670 +1,578 @@
1
- /**
2
- * DshAgentImpl — DeepSeek Harness(`dsh --profile acp`)的 AgentInterface 实现。
3
- *
4
- * 进程模型:每 Agent 一个 `dsh --profile acp` 子进程(ACP v1:JSON-RPC over stdio,
5
- * lazy spawn 跨消息复用);session/new 建会话(挂 stdio MCP 桥),session/prompt
6
- * 驱动回合(单飞,响应在回合终点返回 stopReason)。
7
- *
8
- * - prompt/工具面与 omp 全引擎同源(prompt-builder / host-tool-bridge);
9
- * 工具经 stdio MCP 桥以 session/new mcpServers 挂载(工具名 mcp__aw__* 由引擎加前缀)
10
- * - 事件映射:session/update(agent_message_chunk/tool_call/tool_call_update/contextUsage)
11
- * → AgentEvent;session/prompt 响应(stopReason)→ done/error
12
- * - HITL:session/request_permission(server→client 请求)→ hitl-registry 登记 →
13
- * respondHitl 应答(allow 选项 / reject 选项 / cancelled;fail-closed)
14
- * - steer:ACP 无同轮注入 → 恒 'deferred'(能力面如实声明 steer:false)
15
- * - 上下文:引擎原生 auto-compaction;usage 随事件被动跟踪(平台不主动压缩)
16
- *
17
- * 风险:pre-1.0(developer preview),协议方法名集中本文件;版本 pin + 契约测试兜底。
18
- * 协议权威:github.com/deepseek-ai/deepseek-harness packages/acp/acp/README.md。
19
- */
20
- import { createLogger } from '../logger'
21
- import { randomUUID } from 'node:crypto'
22
- import type {
23
- AgentEvent,
24
- AgentInterface,
25
- AgentInfo,
26
- AgentRunContext,
27
- AgentRunRequest,
28
- SupervisionDecision,
29
- SupervisionSnapshot,
30
- } from './agent-interface'
31
- import type { AgentContextStats } from '../types/task'
32
- import { registerHarnessProcess, bindHarnessProcess, markHarnessProcessExit, killHarnessProcess } from './harness-process'
33
- import { createSessionState, dispatchHostTool } from './host-tool-bridge'
34
- import {
35
- contextPrefix as buildContextPrefix,
36
- createRosterCache,
37
- extractJsonArray,
38
- peerPrompt,
39
- supervisePrompt,
40
- systemManual,
41
- toolArgsPreview,
42
- workerPrompt,
43
- } from './prompt-builder'
44
- import { getHitlRegistry } from './hitl-registry'
45
- import { harnessSettings } from '../settings'
46
- import { StdioJsonRpcClient, type JsonRpcRequestIncoming } from './adapters/stdio-jsonrpc'
47
- import { generateMcpBridgeEnv } from './harness-env'
48
-
49
- const log = createLogger('workshop.dsh')
50
-
51
- /** ACP 协议方法名集中地(pre-1.0 变更时改这一处) */
52
- export const DSH_ACP_METHODS = {
53
- initialize: 'initialize',
54
- sessionNew: 'session/new',
55
- sessionPrompt: 'session/prompt',
56
- sessionCancel: 'session/cancel',
57
- sessionUpdate: 'session/update',
58
- requestPermission: 'session/request_permission',
59
- } as const
60
-
61
- export interface DshAgentConfig {
62
- /** dsh 可执行文件(默认取 harness.dsh_command 设置) */
63
- command?: string
64
- /** 额外 CLI 参数(默认 ['--profile','acp']) */
65
- args?: string[]
66
- cwd?: string
67
- /** 模型(如 deepseek-v4-flash;经进程环境传给 profile patch 的 acp provider/model) */
68
- model?: string
69
- /** provider(如 deepseek-official;经进程环境传给 profile patch) */
70
- provider?: string
71
- /** 推理档位(off|low|high|max) */
72
- reasoningEffort?: string
73
- /** 审批策略(ask=默认,触发 HITL;never=引擎侧全拒) */
74
- approvalPolicy?: 'ask' | 'never'
75
- /** 沙箱预设(read-only|workspace-write|danger-full-access) */
76
- sandboxPreset?: string
77
- /** DSH_HOME(缺省继承用户环境,保留其凭据) */
78
- dshHome?: string
79
- /** DEEPSEEK_API_KEY(缺省继承进程环境) */
80
- apiKey?: string
81
- /** 上下文窗口(usage 百分比;默认 1_000_000,deepseek v4 系) */
82
- contextWindow?: number
83
- promptTimeoutMs?: number
84
- superviseTimeoutMs?: number
85
- systemPromptPrefix?: string
86
- scenarioPrompt?: string
87
- agentId?: string
88
- name?: string
89
- role?: 'lead' | 'worker'
90
- channelId?: string
91
- token?: string
92
- baseUrl?: string
93
- mcpBridgePath?: string
94
- }
95
-
96
- export class DshAgentImpl implements AgentInterface {
97
- private readonly config: DshAgentConfig
98
- private workspace: AgentRunContext['workspace'] | null = null
99
- private agentInfo: AgentInfo | null = null
100
- private readonly toolState = createSessionState()
101
- private readonly bridgeCtx = {
102
- identity: { agentId: '', channelId: '', role: 'worker' as 'lead' | 'worker', name: 'agent' },
103
- state: this.toolState,
104
- getWorkspace: () => this.workspace,
105
- }
106
-
107
- private roster = createRosterCache({ selfAgentId: '', listAgents: async () => [] })
108
-
109
- private selfAgentId = ''
110
- private agentName = 'agent'
111
- private agentRole: 'lead' | 'worker' = 'worker'
112
- private channelId = ''
113
-
114
- private client: StdioJsonRpcClient | null = null
115
- private clientStarting: Promise<void> | null = null
116
- private sessionId: string | null = null
117
- /** ACP 会话回合锁(一 session 一 in-flight prompt) */
118
- private turnActive = false
119
- private lastUsage: { input: number, at: number } | null = null
120
- /** 待应答权限(permission request id → rpc id) */
121
- private pendingPermissions = new Map<string, { rpcId: string | number, options: Array<Record<string, unknown>>, timer: ReturnType<typeof setTimeout> | null }>()
122
-
123
- constructor(config: Record<string, unknown> = {}) {
124
- this.config = config as DshAgentConfig
125
- this.selfAgentId = this.config.agentId ?? ''
126
- this.agentName = this.config.name ?? 'agent'
127
- this.agentRole = this.config.role ?? 'worker'
128
- this.channelId = this.config.channelId ?? ''
129
- this.refreshIdentity()
130
- }
131
-
132
- private refreshIdentity(): void {
133
- this.bridgeCtx.identity = { agentId: this.selfAgentId, channelId: this.channelId, role: this.agentRole, name: this.agentName }
134
- this.roster = createRosterCache({
135
- selfAgentId: this.selfAgentId,
136
- listAgents: async () => this.workspace?.listAgents() ?? [],
137
- })
138
- }
139
-
140
- async init(input: { agent: AgentInfo, channelId: string }): Promise<void> {
141
- this.agentInfo = input.agent
142
- this.channelId = input.channelId
143
- this.agentName = input.agent.name
144
- this.agentRole = input.agent.role
145
- this.selfAgentId = input.agent.id
146
- this.refreshIdentity()
147
- }
148
-
149
- async dispose(): Promise<void> {
150
- const client = this.client
151
- this.client = null
152
- this.sessionId = null
153
- if (client) {
154
- const pid = client.pid
155
- await client.dispose().catch(() => {})
156
- if (pid) markHarnessProcessExit(pid, null)
157
- }
158
- for (const [id, p] of this.pendingPermissions) {
159
- if (p.timer) clearTimeout(p.timer)
160
- this.pendingPermissions.delete(id)
161
- }
162
- }
163
-
164
- getProcessInfo(): { pid: number, alive: boolean, command: string } | null {
165
- const client = this.client
166
- const pid = client?.pid
167
- if (!pid || !client) return null
168
- return { pid, alive: client.alive, command: 'dsh --profile acp' }
169
- }
170
-
171
- killProcess(): void {
172
- const pid = this.client?.pid
173
- if (pid) killHarnessProcess(pid)
174
- else this.client?.kill()
175
- }
176
-
177
- reconcileProcess(): void {
178
- this.client?.reconcile()
179
- }
180
-
181
- dispatchHostTool(toolName: string, args: Record<string, unknown>): Promise<{ text: string, isError?: boolean }> {
182
- return dispatchHostTool(this.bridgeCtx, { toolName, arguments: args })
183
- }
184
-
185
- getContextStats(): AgentContextStats | null {
186
- if (!this.lastUsage) return null
187
- const window = this.config.contextWindow ?? 1_000_000
188
- return {
189
- usedTokens: this.lastUsage.input,
190
- contextWindow: window,
191
- percent: window > 0 ? Math.min(1, this.lastUsage.input / window) : null,
192
- compacting: false, // 压缩由引擎原生驱动,平台无主动 compact 面
193
- }
194
- }
195
-
196
- /** ACP 无同轮注入:恒 'deferred'(消息保持 pending,消费循环处理;能力面如实声明) */
197
- async steer(_text: string): Promise<'steer' | 'deferred'> {
198
- return 'deferred'
199
- }
200
-
201
- /** HITL 应答:session/request_permission → allow/reject/cancelled(fail-closed) */
202
- async respondHitl(kind: string, id: string, outcome: {
203
- confirmed?: boolean
204
- cancelled?: boolean
205
- value?: string
206
- response?: string
207
- comment?: string
208
- }): Promise<void> {
209
- if (kind !== 'dsh-permission') return
210
- const pending = this.pendingPermissions.get(id)
211
- if (!pending) throw new Error(`待办不存在或已处理: ${id}`)
212
- const client = this.client
213
- if (!client) throw new Error('dsh 会话已关闭')
214
- let result: Record<string, unknown>
215
- if (outcome.cancelled === true) {
216
- result = { outcome: { outcome: 'cancelled' } }
217
- }
218
- else if (outcome.confirmed === true) {
219
- // 选第一个 allow 语义选项(kind: allow_once/allow_always 或 name 含 allow)
220
- const allow = pending.options.find(o => String(o.kind ?? '').startsWith('allow') || /allow/i.test(String(o.name ?? '')))
221
- if (!allow) {
222
- client.respondError(pending.rpcId, -32602, '无可用 allow 选项')
223
- this.clearPending(id, 'cancelled')
224
- return
225
- }
226
- result = { outcome: { outcome: 'selected', optionId: allow.optionId } }
227
- }
228
- else {
229
- const reject = pending.options.find(o => String(o.kind ?? '').startsWith('reject') || /reject|deny/i.test(String(o.name ?? '')))
230
- if (reject) {
231
- result = { outcome: { outcome: 'selected', optionId: reject.optionId } }
232
- }
233
- else {
234
- client.respondError(pending.rpcId, -32602, '已拒绝')
235
- this.clearPending(id, 'cancelled')
236
- return
237
- }
238
- }
239
- client.respond(pending.rpcId, result)
240
- this.clearPending(id, outcome.cancelled === true ? 'cancelled' : 'answered')
241
- }
242
-
243
- private clearPending(id: string, resolution: 'answered' | 'cancelled' | 'expired'): void {
244
- const p = this.pendingPermissions.get(id)
245
- if (p?.timer) clearTimeout(p.timer)
246
- this.pendingPermissions.delete(id)
247
- getHitlRegistry().resolve('dsh-permission', id, resolution)
248
- }
249
-
250
- // ===== run / supervise =====
251
-
252
- async* run(request: AgentRunRequest, ctx: AgentRunContext): AsyncIterable<AgentEvent> {
253
- const kind = request.message.metadata?.['x-aw-task-kind']
254
- if (kind === 'assign' && ctx.role === 'worker') {
255
- yield* this.workerRun(request, ctx)
256
- return
257
- }
258
- if (!kind && (request.fromAgentId || request.message.metadata?.['x-aw-from-label'])) {
259
- yield* this.peerMessageRun(request, ctx)
260
- return
261
- }
262
- }
263
-
264
- private supervising = false
265
-
266
- async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
267
- await this.ensureClient(ctx)
268
- if (!this.client || !this.sessionId) return []
269
- if (this.supervising) return []
270
- const prompt = supervisePrompt({
271
- snapshot,
272
- agentName: this.agentName,
273
- channelId: this.channelId,
274
- ctxPrefix: await this.contextPrefix(),
275
- manual: systemManual(),
276
- memory: ctx.memory,
277
- })
278
- this.supervising = true
279
- try {
280
- const events = await this.collectTurn(prompt, this.config.superviseTimeoutMs ?? 150_000, opts?.signal)
281
- let text = ''
282
- for (const e of events) {
283
- if (e.kind === 'artifact') {
284
- text += e.artifact.parts.map(p => 'text' in p ? p.text : '').join('')
285
- }
286
- }
287
- const parsed = extractJsonArray(text)
288
- return parsed && parsed.length > 0 ? parsed as SupervisionDecision[] : []
289
- }
290
- catch {
291
- return []
292
- }
293
- finally {
294
- this.supervising = false
295
- }
296
- }
297
-
298
- private async* workerRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
299
- const taskId = request.taskId ?? (request.message.metadata?.['x-aw-task-id'] as string | undefined)
300
- if (!taskId) return
301
- this.toolState.currentTaskId = taskId
302
- try {
303
- await this.ensureClient(ctx)
304
- const taskText = request.message.parts.map((p) => {
305
- if ('text' in p) return p.text
306
- if ('data' in p) return JSON.stringify(p.data)
307
- if ('url' in p) return p.url
308
- if ('raw' in p) return p.raw
309
- return ''
310
- }).join('\n')
311
- const prompt = workerPrompt({
312
- agentName: this.agentName,
313
- channelId: this.channelId,
314
- taskId,
315
- taskText,
316
- memory: request.memory,
317
- ctxPrefix: await this.contextPrefix(),
318
- manual: systemManual(),
319
- })
320
- yield* this.streamTurn(prompt, taskId, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
321
- }
322
- finally {
323
- this.toolState.currentTaskId = null
324
- }
325
- }
326
-
327
- private async* peerMessageRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
328
- await this.ensureClient(ctx)
329
- const msg = request.message
330
- const fromId = request.fromAgentId
331
- ?? (typeof msg.metadata?.['x-aw-from-label'] === 'string' ? msg.metadata['x-aw-from-label'] : undefined)
332
- ?? 'unknown'
333
- const requireReply = msg.metadata?.['x-aw-require-reply'] === 'true'
334
- const crossChannel = msg.metadata?.['x-aw-cross-channel'] === 'true'
335
- this.toolState.replyContext = requireReply && request.fromAgentId && !crossChannel
336
- ? { fromId: request.fromAgentId, messageId: msg.messageId }
337
- : null
338
- const msgText = msg.parts.map((p) => {
339
- if ('text' in p) return p.text
340
- if ('data' in p) return JSON.stringify(p.data)
341
- if ('url' in p) return p.url
342
- if ('raw' in p) return p.raw
343
- return ''
344
- }).join('\n')
345
- const prompt = peerPrompt({
346
- agentName: this.agentName,
347
- role: this.agentRole,
348
- channelId: this.channelId,
349
- ctxPrefix: await this.contextPrefix(),
350
- manual: systemManual(),
351
- memory: request.memory,
352
- fromId,
353
- messageId: msg.messageId,
354
- requireReply,
355
- isReply: typeof msg.metadata?.['x-aw-in-reply-to'] === 'string',
356
- crossChannel,
357
- fromChannel: typeof msg.metadata?.['x-aw-from-channel'] === 'string' ? String(msg.metadata['x-aw-from-channel']) : '',
358
- msgText,
359
- })
360
- yield* this.streamTurn(prompt, undefined, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
361
- }
362
-
363
- private async contextPrefix(): Promise<string> {
364
- return buildContextPrefix({
365
- scenarioPrompt: this.config.scenarioPrompt,
366
- systemPromptPrefix: this.config.systemPromptPrefix,
367
- agentId: this.selfAgentId,
368
- roster: await this.roster.roster(),
369
- })
370
- }
371
-
372
- // ===== 回合执行 =====
373
-
374
- /**
375
- * ACP 回合:session/prompt(响应在回合终点返回)+ session/update 通知流。
376
- * 通知由 client 级 handler 转 turnSettlers;abort → session/cancel 通知。
377
- */
378
- private async* streamTurn(prompt: string, taskId: string | undefined, timeoutMs: number, signal?: AbortSignal): AsyncGenerator<AgentEvent, void, unknown> {
379
- const client = this.client
380
- if (!client || !this.sessionId) {
381
- yield { kind: 'error', error: { code: 'DSH_NOT_READY', message: 'dsh 会话未就绪' } }
382
- return
383
- }
384
- if (this.turnActive) {
385
- // 单飞约束:上一回合未收口(理论不可达,run/supervise 互斥在上层保证)
386
- yield { kind: 'error', error: { code: 'DSH_TURN_BUSY', message: 'dsh 上一回合尚未收口' } }
387
- return
388
- }
389
- this.turnActive = true
390
- const queue: AgentEvent[] = []
391
- let isDone = false
392
- let resolveWait: (() => void) | null = null
393
- let lastActivity = Date.now()
394
- let agentText = ''
395
-
396
- const enqueue = (e: AgentEvent): void => {
397
- if (e.kind === 'done' && !isDone) {
398
- if (agentText.trim()) {
399
- queue.push({
400
- kind: 'artifact',
401
- artifact: { artifactId: randomUUID(), name: 'output', parts: [{ text: agentText.trim() }] },
402
- lastChunk: true,
403
- totalChunks: 1,
404
- })
405
- }
406
- this.turnActive = false
407
- }
408
- if (e.kind === 'done' || e.kind === 'error') {
409
- isDone = true
410
- this.turnActive = false
411
- }
412
- queue.push(e)
413
- lastActivity = Date.now()
414
- resolveWait?.()
415
- resolveWait = null
416
- }
417
-
418
- // 引擎事件 → 队列(session/update 映射)
419
- const pushUpdate = (params: unknown): void => {
420
- lastActivity = Date.now()
421
- const p = (params ?? {}) as Record<string, unknown>
422
- const sid = p.sessionId ?? p.sessionID
423
- if (sid && sid !== this.sessionId) return
424
- const update = (p.update ?? p) as Record<string, unknown>
425
- const kind = String(update.sessionUpdate ?? update.kind ?? update.type ?? '')
426
- const now = new Date().toISOString()
427
- const statusEvent = (text: string): void => {
428
- enqueue({
429
- kind: 'status',
430
- status: {
431
- state: 'WORKING',
432
- message: { messageId: randomUUID(), contextId: this.channelId, role: 'ROLE_AGENT', parts: [{ text }] },
433
- timestamp: now,
434
- },
435
- })
436
- }
437
- if (kind === 'agent_message_chunk' || kind === 'agentMessageChunk') {
438
- const content = (update.content ?? {}) as Record<string, unknown>
439
- const text = typeof content.text === 'string' ? content.text : ''
440
- if (text) {
441
- agentText += text
442
- enqueue({ kind: 'delta', delta: { text } })
443
- }
444
- return
445
- }
446
- if (kind === 'tool_call' || kind === 'toolCall') {
447
- statusEvent(`🔧 ${String(update.title ?? update.toolName ?? 'tool')}${toolArgsPreview(update.rawInput ?? update.arguments)}`)
448
- return
449
- }
450
- if (kind === 'tool_call_update' || kind === 'toolCallUpdate') {
451
- const status = String(update.status ?? '')
452
- if (status === 'failed' || status === 'error') {
453
- statusEvent(`🔧 ${String(update.title ?? 'tool')} 失败`)
454
- }
455
- return
456
- }
457
- // contextUsage / config / 其他通知:仅刷新活动时间
458
- const usage = (p.contextUsage ?? update.contextUsage ?? update.usage) as Record<string, unknown> | undefined
459
- if (usage) {
460
- const input = Number(usage.usedTokens ?? usage.inputTokens ?? usage.input ?? usage.totalTokens)
461
- if (Number.isFinite(input) && input > 0) this.lastUsage = { input, at: Date.now() }
462
- }
463
- }
464
-
465
- const unsub = client.onNotification((method, params) => {
466
- if (method === DSH_ACP_METHODS.sessionUpdate) pushUpdate(params)
467
- })
468
-
469
- // abort:session/cancel 通知 → 引擎终结 prompt(响应 stopReason=cancelled)
470
- const onAbort = (): void => {
471
- log.warn(`[DshAgent:${this.selfAgentId}] run 被 abort → session/cancel,taskId=${taskId ?? '-'}`)
472
- client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
473
- setTimeout(() => {
474
- if (!isDone) enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
475
- }, 5000)
476
- }
477
- if (signal?.aborted) onAbort()
478
- else signal?.addEventListener('abort', onAbort, { once: true })
479
-
480
- // 投递 prompt(响应在回合终点返回 → 异步挂接,回合内事件由生成器边到边 yield)
481
- void client.request(DSH_ACP_METHODS.sessionPrompt, {
482
- sessionId: this.sessionId,
483
- prompt: [{ type: 'text', text: prompt }],
484
- }, timeoutMs + 30_000)
485
- .then((result) => {
486
- const stopReason = String((result as Record<string, unknown>)?.stopReason ?? 'end_turn')
487
- if (stopReason === 'refusal') {
488
- enqueue({ kind: 'error', error: { code: 'DSH_REFUSAL', message: 'dsh 回合被引擎拒绝(refusal)' } })
489
- }
490
- else {
491
- // end_turn / cancelled / 其他:中断按 done 收口(消息按已处理落账)
492
- enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
493
- }
494
- })
495
- .catch((err: unknown) => {
496
- enqueue({
497
- kind: 'error',
498
- error: {
499
- code: 'DSH_PROMPT_FAILED',
500
- message: `dsh session/prompt 失败: ${err instanceof Error ? err.message : String(err)}`,
501
- },
502
- })
503
- })
504
-
505
- try {
506
- while (!isDone || queue.length > 0) {
507
- if (queue.length === 0 && !isDone) {
508
- const remaining = timeoutMs - (Date.now() - lastActivity)
509
- if (remaining <= 0) {
510
- client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
511
- enqueue({
512
- kind: 'error',
513
- error: { code: 'DSH_TURN_STALLED', message: `回合停滞 ${Math.round(timeoutMs / 1000)}s 无事件,已取消` },
514
- })
515
- continue
516
- }
517
- await new Promise<void>((r) => {
518
- resolveWait = r
519
- setTimeout(() => {
520
- resolveWait = null
521
- r()
522
- }, remaining + 100)
523
- })
524
- }
525
- while (queue.length > 0) {
526
- yield queue.shift()!
527
- }
528
- }
529
- }
530
- finally {
531
- unsub()
532
- signal?.removeEventListener('abort', onAbort)
533
- this.turnActive = false
534
- }
535
- }
536
-
537
- /** supervise 用:收齐整个回合 */
538
- private async collectTurn(prompt: string, timeoutMs: number, signal?: AbortSignal): Promise<AgentEvent[]> {
539
- const events: AgentEvent[] = []
540
- for await (const e of this.streamTurn(prompt, undefined, timeoutMs, signal)) {
541
- events.push(e)
542
- if (e.kind === 'error') break
543
- }
544
- return events
545
- }
546
-
547
- // ===== 客户端管理 =====
548
-
549
- private async ensureClient(ctx: AgentRunContext): Promise<void> {
550
- if (!this.workspace) this.workspace = ctx.workspace
551
- if (!this.agentInfo) {
552
- this.channelId = ctx.channelId
553
- this.agentRole = ctx.role
554
- this.refreshIdentity()
555
- }
556
- if (this.client?.alive && this.sessionId) return
557
- if (this.client && !this.client.alive) {
558
- this.client = null
559
- this.sessionId = null
560
- }
561
- this.clientStarting ??= this.startClient().finally(() => {
562
- this.clientStarting = null
563
- })
564
- await this.clientStarting
565
- }
566
-
567
- private async startClient(): Promise<void> {
568
- const command = this.config.command ?? harnessSettings().dsh_command
569
- const env = generateMcpBridgeEnv({
570
- agentId: this.selfAgentId,
571
- token: this.config.token,
572
- baseUrl: this.config.baseUrl,
573
- bridgePath: this.config.mcpBridgePath,
574
- extra: {
575
- // 桥身份随进程环境注入:profile 级 mcp-client(patch 层)经 !!js 读取;
576
- // 此 dsh 版本 session/new 不支持 mcpServers 参数,挂载走 profile 配置。
577
- ...generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgeEnv,
578
- AW_BRIDGE_PATH: generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgePath,
579
- // provider/model 经环境传给 profile patch(!!js 读取):channel/agent config 驱动
580
- ...(this.config.provider ? { AW_ACP_PROVIDER: this.config.provider } : {}),
581
- ...(this.config.model ? { AW_ACP_MODEL: this.config.model } : {}),
582
- ...(this.config.dshHome ? { DSH_HOME: this.config.dshHome } : {}),
583
- ...(this.config.apiKey ? { DEEPSEEK_API_KEY: this.config.apiKey } : {}),
584
- },
585
- })
586
- const client = new StdioJsonRpcClient({
587
- name: 'dsh',
588
- command,
589
- args: this.config.args ?? ['--profile', 'acp'],
590
- cwd: this.config.cwd ?? process.cwd(),
591
- env: env.engineEnv,
592
- requestTimeoutMs: 60_000,
593
- })
594
- const pidRef = { pid: undefined as number | undefined }
595
- client.onExit((code) => {
596
- if (pidRef.pid) markHarnessProcessExit(pidRef.pid, code)
597
- this.sessionId = null
598
- log.warn(`[DshAgent:${this.selfAgentId}] dsh acp 进程退出(code=${code});下回合自动重生`)
599
- })
600
- await client.start()
601
- pidRef.pid = client.pid
602
- if (client.pid) {
603
- registerHarnessProcess(client.pid, { harness: 'dsh', command, args: ['--profile', 'acp'] })
604
- bindHarnessProcess(client.pid, { agentId: this.selfAgentId, channelId: this.channelId, name: this.agentName, role: this.agentRole })
605
- }
606
-
607
- // 服务端→客户端请求(权限)→ HITL
608
- client.onRequest((req: JsonRpcRequestIncoming) => {
609
- if (req.method === DSH_ACP_METHODS.requestPermission) {
610
- this.registerPermissionHitl(req)
611
- return
612
- }
613
- client.respondError(req.id, -32601, `方法不存在: ${req.method}`)
614
- })
615
-
616
- // ACP 握手
617
- await client.request(DSH_ACP_METHODS.initialize, {
618
- protocolVersion: 1,
619
- clientCapabilities: {},
620
- }, 30_000).catch(async (err: Error) => {
621
- // 协议版本协商失败 → 显式版本重试一次
622
- await client.request(DSH_ACP_METHODS.initialize, { protocolVersion: '2025-06-01', clientCapabilities: {} }, 30_000)
623
- .catch(() => { throw err })
624
- })
625
-
626
- // 建会话(此版本不接受自定义 mcpServers;工具经 profile 级 mcp-client 挂载;
627
- // ACP schema 要求 mcpServers 字段存在,传空数组)
628
- const created = await client.request(DSH_ACP_METHODS.sessionNew, {
629
- cwd: this.config.cwd ?? process.cwd(),
630
- mcpServers: [],
631
- }, 60_000) as Record<string, unknown>
632
- const sid = created?.sessionId ?? created?.id
633
- this.sessionId = typeof sid === 'string' ? sid : null
634
- if (!this.sessionId) throw new Error('dsh session/new 未返回 sessionId')
635
-
636
- this.client = client
637
- }
638
-
639
- private registerPermissionHitl(req: JsonRpcRequestIncoming): void {
640
- const client = this.client
641
- if (!client) return
642
- const p = (req.params ?? {}) as Record<string, unknown>
643
- const options = Array.isArray(p.options) ? p.options as Array<Record<string, unknown>> : []
644
- const toolCall = (p.toolCall ?? {}) as Record<string, unknown>
645
- const id = `dsh-${randomUUID().slice(0, 8)}`
646
- const registry = getHitlRegistry()
647
- registry.register({
648
- kind: 'dsh-permission',
649
- id,
650
- agentId: this.selfAgentId,
651
- agentName: this.agentName,
652
- channelId: this.channelId,
653
- pid: client.pid,
654
- method: 'confirm',
655
- title: `dsh 权限请求:${String(toolCall.title ?? toolCall.toolName ?? p.toolName ?? '操作').slice(0, 200)}`,
656
- detail: String(toolCall.kind ?? p.kind ?? ''),
657
- options: options.map(o => String(o.name ?? o.optionId ?? '')),
658
- createdAt: new Date().toISOString(),
659
- expiresAt: null,
660
- })
661
- const timeoutMs = harnessSettings().hitl_timeout_ms
662
- const timer = timeoutMs > 0
663
- ? setTimeout(() => {
664
- // fail-closed:超时按拒绝应答(引擎默认语义)
665
- void this.respondHitl('dsh-permission', id, { confirmed: false }).catch(() => {})
666
- }, timeoutMs)
667
- : null
668
- this.pendingPermissions.set(id, { rpcId: req.id, options, timer })
669
- }
670
- }
1
+ /**
2
+ * DshAgentImpl — DeepSeek Harness(`dsh --profile acp`)的 AgentInterface 实现。
3
+ *
4
+ * 进程模型:每 Agent 一个 `dsh --profile acp` 子进程(ACP v1:JSON-RPC over stdio,
5
+ * lazy spawn 跨消息复用);session/new 建会话(挂 stdio MCP 桥),session/prompt
6
+ * 驱动回合(单飞,响应在回合终点返回 stopReason)。
7
+ *
8
+ * - prompt/工具面与 omp 全引擎同源(prompt-builder / host-tool-bridge);
9
+ * 工具经 stdio MCP 桥以 session/new mcpServers 挂载(工具名 mcp__aw__* 由引擎加前缀)
10
+ * - 事件映射:session/update(agent_message_chunk/tool_call/tool_call_update/contextUsage)
11
+ * → AgentEvent;session/prompt 响应(stopReason)→ done/error
12
+ * - HITL:session/request_permission(server→client 请求)→ hitl-registry 登记 →
13
+ * respondHitl 应答(allow 选项 / reject 选项 / cancelled;fail-closed)
14
+ * - steer:ACP 无同轮注入 → 恒 'deferred'(能力面如实声明 steer:false)
15
+ * - 上下文:引擎原生 auto-compaction;usage 随事件被动跟踪(平台不主动压缩)
16
+ *
17
+ * 风险:pre-1.0(developer preview),协议方法名集中本文件;版本 pin + 契约测试兜底。
18
+ * 协议权威:github.com/deepseek-ai/deepseek-harness packages/acp/acp/README.md。
19
+ */
20
+ import { createLogger } from '../logger'
21
+ import { randomUUID } from 'node:crypto'
22
+ import type { AgentEvent, AgentInterface, AgentInfo, AgentRunContext, AgentRunRequest } from './agent-interface'
23
+ import type { AgentContextStats } from '../types/task'
24
+ import { registerHarnessProcess, bindHarnessProcess, markHarnessProcessExit, killHarnessProcess } from './harness-process'
25
+ import { peerPrompt, systemManual, toolArgsPreview, workerPrompt } from './prompt-builder'
26
+ import { getHitlRegistry } from './hitl-registry'
27
+ import { harnessSettings } from '../settings'
28
+ import { StdioJsonRpcClient, type JsonRpcRequestIncoming } from './adapters/stdio-jsonrpc'
29
+ import { BaseAgentImpl } from './base-agent'
30
+ import { generateMcpBridgeEnv } from './harness-env'
31
+
32
+ const log = createLogger('workshop.dsh')
33
+
34
+ /** ACP 协议方法名集中地(pre-1.0 变更时改这一处) */
35
+ export const DSH_ACP_METHODS = {
36
+ initialize: 'initialize',
37
+ sessionNew: 'session/new',
38
+ sessionPrompt: 'session/prompt',
39
+ sessionCancel: 'session/cancel',
40
+ sessionUpdate: 'session/update',
41
+ requestPermission: 'session/request_permission',
42
+ } as const
43
+
44
+ export interface DshAgentConfig {
45
+ /** dsh 可执行文件(默认取 harness.dsh_command 设置) */
46
+ command?: string
47
+ /** 额外 CLI 参数(默认 ['--profile','acp']) */
48
+ args?: string[]
49
+ cwd?: string
50
+ /** 模型(如 deepseek-v4-flash;经进程环境传给 profile patch 的 acp provider/model) */
51
+ model?: string
52
+ /** provider(如 deepseek-official;经进程环境传给 profile patch) */
53
+ provider?: string
54
+ /** 推理档位(off|low|high|max) */
55
+ reasoningEffort?: string
56
+ /** 审批策略(ask=默认,触发 HITL;never=引擎侧全拒) */
57
+ approvalPolicy?: 'ask' | 'never'
58
+ /** 沙箱预设(read-only|workspace-write|danger-full-access) */
59
+ sandboxPreset?: string
60
+ /** DSH_HOME(缺省继承用户环境,保留其凭据) */
61
+ dshHome?: string
62
+ /** DEEPSEEK_API_KEY(缺省继承进程环境) */
63
+ apiKey?: string
64
+ /** 上下文窗口(usage 百分比;默认 1_000_000,deepseek v4 系) */
65
+ contextWindow?: number
66
+ promptTimeoutMs?: number
67
+ superviseTimeoutMs?: number
68
+ systemPromptPrefix?: string
69
+ scenarioPrompt?: string
70
+ agentId?: string
71
+ name?: string
72
+ role?: 'lead' | 'worker'
73
+ channelId?: string
74
+ token?: string
75
+ baseUrl?: string
76
+ mcpBridgePath?: string
77
+ }
78
+
79
+ export class DshAgentImpl extends BaseAgentImpl implements AgentInterface {
80
+ private readonly config: DshAgentConfig
81
+ private agentInfo: AgentInfo | null = null
82
+ private readonly bridgeCtx = {
83
+ identity: { agentId: '', channelId: '', role: 'worker' as 'lead' | 'worker', name: 'agent' },
84
+ state: this.toolState,
85
+ getWorkspace: () => this.workspace,
86
+ }
87
+
88
+ private agentRole: 'lead' | 'worker' = 'worker'
89
+ private client: StdioJsonRpcClient | null = null
90
+ private clientStarting: Promise<void> | null = null
91
+ private sessionId: string | null = null
92
+ /** ACP 会话回合锁(一 session 一 in-flight prompt) */
93
+ private turnActive = false
94
+ private lastUsage: { input: number, at: number } | null = null
95
+ /** 待应答权限(permission request id → rpc id) */
96
+ private pendingPermissions = new Map<string, { rpcId: string | number, options: Array<Record<string, unknown>>, timer: ReturnType<typeof setTimeout> | null }>()
97
+
98
+ constructor(config: Record<string, unknown> = {}) {
99
+ super({
100
+ agentId: typeof config.agentId === 'string' ? config.agentId : '',
101
+ name: typeof config.name === 'string' ? config.name : undefined,
102
+ role: config.role === 'lead' ? 'lead' : 'worker',
103
+ channelId: typeof config.channelId === 'string' ? config.channelId : '',
104
+ })
105
+ this.config = config as DshAgentConfig
106
+ }
107
+
108
+ protected get harnessId(): string {
109
+ return 'dsh'
110
+ }
111
+
112
+ protected configRecord(): Record<string, unknown> {
113
+ return this.config
114
+ }
115
+
116
+ async dispose(): Promise<void> {
117
+ const client = this.client
118
+ this.client = null
119
+ this.sessionId = null
120
+ if (client) {
121
+ const pid = client.pid
122
+ await client.dispose().catch(() => {})
123
+ if (pid) markHarnessProcessExit(pid, null)
124
+ }
125
+ for (const [id, p] of this.pendingPermissions) {
126
+ if (p.timer) clearTimeout(p.timer)
127
+ this.pendingPermissions.delete(id)
128
+ }
129
+ }
130
+
131
+ getProcessInfo(): { pid: number, alive: boolean, command: string } | null {
132
+ const client = this.client
133
+ const pid = client?.pid
134
+ if (!pid || !client) return null
135
+ return { pid, alive: client.alive, command: 'dsh --profile acp' }
136
+ }
137
+
138
+ killProcess(): void {
139
+ const pid = this.client?.pid
140
+ if (pid) killHarnessProcess(pid)
141
+ else this.client?.kill()
142
+ }
143
+
144
+ reconcileProcess(): void {
145
+ this.client?.reconcile()
146
+ }
147
+
148
+ getContextStats(): AgentContextStats | null {
149
+ if (!this.lastUsage) return null
150
+ const window = this.config.contextWindow ?? 1_000_000
151
+ return {
152
+ usedTokens: this.lastUsage.input,
153
+ contextWindow: window,
154
+ percent: window > 0 ? Math.min(1, this.lastUsage.input / window) : null,
155
+ compacting: false, // 压缩由引擎原生驱动,平台无主动 compact 面
156
+ }
157
+ }
158
+
159
+ /** ACP 无同轮注入:恒 'deferred'(消息保持 pending,消费循环处理;能力面如实声明) */
160
+ async steer(_text: string): Promise<'steer' | 'deferred'> {
161
+ return 'deferred'
162
+ }
163
+
164
+ /** HITL 应答:session/request_permission → allow/reject/cancelled(fail-closed) */
165
+ async respondHitl(kind: string, id: string, outcome: {
166
+ confirmed?: boolean
167
+ cancelled?: boolean
168
+ value?: string
169
+ response?: string
170
+ comment?: string
171
+ }): Promise<void> {
172
+ if (kind !== 'dsh-permission') return
173
+ const pending = this.pendingPermissions.get(id)
174
+ if (!pending) throw new Error(`待办不存在或已处理: ${id}`)
175
+ const client = this.client
176
+ if (!client) throw new Error('dsh 会话已关闭')
177
+ let result: Record<string, unknown>
178
+ if (outcome.cancelled === true) {
179
+ result = { outcome: { outcome: 'cancelled' } }
180
+ }
181
+ else if (outcome.confirmed === true) {
182
+ // 选第一个 allow 语义选项(kind: allow_once/allow_always 或 name 含 allow)
183
+ const allow = pending.options.find(o => String(o.kind ?? '').startsWith('allow') || /allow/i.test(String(o.name ?? '')))
184
+ if (!allow) {
185
+ client.respondError(pending.rpcId, -32602, '无可用 allow 选项')
186
+ this.clearPending(id, 'cancelled')
187
+ return
188
+ }
189
+ result = { outcome: { outcome: 'selected', optionId: allow.optionId } }
190
+ }
191
+ else {
192
+ const reject = pending.options.find(o => String(o.kind ?? '').startsWith('reject') || /reject|deny/i.test(String(o.name ?? '')))
193
+ if (reject) {
194
+ result = { outcome: { outcome: 'selected', optionId: reject.optionId } }
195
+ }
196
+ else {
197
+ client.respondError(pending.rpcId, -32602, '已拒绝')
198
+ this.clearPending(id, 'cancelled')
199
+ return
200
+ }
201
+ }
202
+ client.respond(pending.rpcId, result)
203
+ this.clearPending(id, outcome.cancelled === true ? 'cancelled' : 'answered')
204
+ }
205
+
206
+ private clearPending(id: string, resolution: 'answered' | 'cancelled' | 'expired'): void {
207
+ const p = this.pendingPermissions.get(id)
208
+ if (p?.timer) clearTimeout(p.timer)
209
+ this.pendingPermissions.delete(id)
210
+ getHitlRegistry().resolve('dsh-permission', id, resolution)
211
+ }
212
+
213
+ // ===== run / supervise =====
214
+
215
+ protected async* workerTurn(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
216
+ const taskId = request.taskId ?? (request.message.metadata?.['x-aw-task-id'] as string | undefined)
217
+ if (!taskId) return
218
+ this.toolState.currentTaskId = taskId
219
+ try {
220
+ await this.ensureClient(ctx)
221
+ const taskText = request.message.parts.map((p) => {
222
+ if ('text' in p) return p.text
223
+ if ('data' in p) return JSON.stringify(p.data)
224
+ if ('url' in p) return p.url
225
+ if ('raw' in p) return p.raw
226
+ return ''
227
+ }).join('\n')
228
+ const prompt = workerPrompt({
229
+ agentName: this.agentName,
230
+ channelId: this.channelId,
231
+ taskId,
232
+ taskText,
233
+ memory: request.memory,
234
+ ctxPrefix: await this.contextPrefix(),
235
+ manual: systemManual(),
236
+ })
237
+ yield* this.streamTurn(prompt, taskId, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
238
+ }
239
+ finally {
240
+ this.toolState.currentTaskId = null
241
+ }
242
+ }
243
+
244
+ protected async* peerTurn(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
245
+ await this.ensureClient(ctx)
246
+ const msg = request.message
247
+ const fromId = request.fromAgentId
248
+ ?? (typeof msg.metadata?.['x-aw-from-label'] === 'string' ? msg.metadata['x-aw-from-label'] : undefined)
249
+ ?? 'unknown'
250
+ const requireReply = msg.metadata?.['x-aw-require-reply'] === 'true'
251
+ const crossChannel = msg.metadata?.['x-aw-cross-channel'] === 'true'
252
+ this.toolState.replyContext = requireReply && request.fromAgentId && !crossChannel
253
+ ? { fromId: request.fromAgentId, messageId: msg.messageId }
254
+ : null
255
+ const msgText = msg.parts.map((p) => {
256
+ if ('text' in p) return p.text
257
+ if ('data' in p) return JSON.stringify(p.data)
258
+ if ('url' in p) return p.url
259
+ if ('raw' in p) return p.raw
260
+ return ''
261
+ }).join('\n')
262
+ const prompt = peerPrompt({
263
+ agentName: this.agentName,
264
+ role: this.agentRole,
265
+ channelId: this.channelId,
266
+ ctxPrefix: await this.contextPrefix(),
267
+ manual: systemManual(),
268
+ memory: request.memory,
269
+ fromId,
270
+ messageId: msg.messageId,
271
+ requireReply,
272
+ isReply: typeof msg.metadata?.['x-aw-in-reply-to'] === 'string',
273
+ crossChannel,
274
+ fromChannel: typeof msg.metadata?.['x-aw-from-channel'] === 'string' ? String(msg.metadata['x-aw-from-channel']) : '',
275
+ msgText,
276
+ })
277
+ yield* this.streamTurn(prompt, undefined, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
278
+ }
279
+
280
+ // ===== 回合执行 =====
281
+
282
+ /**
283
+ * ACP 回合:session/prompt(响应在回合终点返回)+ session/update 通知流。
284
+ * 通知由 client 级 handler 转 turnSettlers;abort → session/cancel 通知。
285
+ */
286
+ private async* streamTurn(prompt: string, taskId: string | undefined, timeoutMs: number, signal?: AbortSignal): AsyncGenerator<AgentEvent, void, unknown> {
287
+ const client = this.client
288
+ if (!client || !this.sessionId) {
289
+ yield { kind: 'error', error: { code: 'DSH_NOT_READY', message: 'dsh 会话未就绪' } }
290
+ return
291
+ }
292
+ if (this.turnActive) {
293
+ // 单飞约束:上一回合未收口(理论不可达,run/supervise 互斥在上层保证)
294
+ yield { kind: 'error', error: { code: 'DSH_TURN_BUSY', message: 'dsh 上一回合尚未收口' } }
295
+ return
296
+ }
297
+ this.turnActive = true
298
+ const queue: AgentEvent[] = []
299
+ let isDone = false
300
+ let resolveWait: (() => void) | null = null
301
+ let lastActivity = Date.now()
302
+ let agentText = ''
303
+
304
+ const enqueue = (e: AgentEvent): void => {
305
+ if (e.kind === 'done' && !isDone) {
306
+ if (agentText.trim()) {
307
+ queue.push({
308
+ kind: 'artifact',
309
+ artifact: { artifactId: randomUUID(), name: 'output', parts: [{ text: agentText.trim() }] },
310
+ lastChunk: true,
311
+ totalChunks: 1,
312
+ })
313
+ }
314
+ this.turnActive = false
315
+ }
316
+ if (e.kind === 'done' || e.kind === 'error') {
317
+ isDone = true
318
+ this.turnActive = false
319
+ }
320
+ queue.push(e)
321
+ lastActivity = Date.now()
322
+ resolveWait?.()
323
+ resolveWait = null
324
+ }
325
+
326
+ // 引擎事件 → 队列(session/update 映射)
327
+ const pushUpdate = (params: unknown): void => {
328
+ lastActivity = Date.now()
329
+ const p = (params ?? {}) as Record<string, unknown>
330
+ const sid = p.sessionId ?? p.sessionID
331
+ if (sid && sid !== this.sessionId) return
332
+ const update = (p.update ?? p) as Record<string, unknown>
333
+ const kind = String(update.sessionUpdate ?? update.kind ?? update.type ?? '')
334
+ const now = new Date().toISOString()
335
+ const statusEvent = (text: string): void => {
336
+ enqueue({
337
+ kind: 'status',
338
+ status: {
339
+ state: 'WORKING',
340
+ message: { messageId: randomUUID(), contextId: this.channelId, role: 'ROLE_AGENT', parts: [{ text }] },
341
+ timestamp: now,
342
+ },
343
+ })
344
+ }
345
+ if (kind === 'agent_message_chunk' || kind === 'agentMessageChunk') {
346
+ const content = (update.content ?? {}) as Record<string, unknown>
347
+ const text = typeof content.text === 'string' ? content.text : ''
348
+ if (text) {
349
+ agentText += text
350
+ enqueue({ kind: 'delta', delta: { text } })
351
+ }
352
+ return
353
+ }
354
+ if (kind === 'tool_call' || kind === 'toolCall') {
355
+ statusEvent(`🔧 ${String(update.title ?? update.toolName ?? 'tool')}${toolArgsPreview(update.rawInput ?? update.arguments)}`)
356
+ return
357
+ }
358
+ if (kind === 'tool_call_update' || kind === 'toolCallUpdate') {
359
+ const status = String(update.status ?? '')
360
+ if (status === 'failed' || status === 'error') {
361
+ statusEvent(`🔧 ${String(update.title ?? 'tool')} 失败`)
362
+ }
363
+ return
364
+ }
365
+ // contextUsage / config / 其他通知:仅刷新活动时间
366
+ const usage = (p.contextUsage ?? update.contextUsage ?? update.usage) as Record<string, unknown> | undefined
367
+ if (usage) {
368
+ const input = Number(usage.usedTokens ?? usage.inputTokens ?? usage.input ?? usage.totalTokens)
369
+ if (Number.isFinite(input) && input > 0) this.lastUsage = { input, at: Date.now() }
370
+ }
371
+ }
372
+
373
+ const unsub = client.onNotification((method, params) => {
374
+ if (method === DSH_ACP_METHODS.sessionUpdate) pushUpdate(params)
375
+ })
376
+
377
+ // abort:session/cancel 通知 → 引擎终结 prompt(响应 stopReason=cancelled)
378
+ const onAbort = (): void => {
379
+ log.warn(`[DshAgent:${this.selfAgentId}] run 被 abort → session/cancel,taskId=${taskId ?? '-'}`)
380
+ client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
381
+ setTimeout(() => {
382
+ if (!isDone) enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
383
+ }, 5000)
384
+ }
385
+ if (signal?.aborted) onAbort()
386
+ else signal?.addEventListener('abort', onAbort, { once: true })
387
+
388
+ // 投递 prompt(响应在回合终点返回 → 异步挂接,回合内事件由生成器边到边 yield)
389
+ void client.request(DSH_ACP_METHODS.sessionPrompt, {
390
+ sessionId: this.sessionId,
391
+ prompt: [{ type: 'text', text: prompt }],
392
+ }, timeoutMs + 30_000)
393
+ .then((result) => {
394
+ const stopReason = String((result as Record<string, unknown>)?.stopReason ?? 'end_turn')
395
+ if (stopReason === 'refusal') {
396
+ enqueue({ kind: 'error', error: { code: 'DSH_REFUSAL', message: 'dsh 回合被引擎拒绝(refusal)' } })
397
+ }
398
+ else {
399
+ // end_turn / cancelled / 其他:中断按 done 收口(消息按已处理落账)
400
+ enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
401
+ }
402
+ })
403
+ .catch((err: unknown) => {
404
+ enqueue({
405
+ kind: 'error',
406
+ error: {
407
+ code: 'DSH_PROMPT_FAILED',
408
+ message: `dsh session/prompt 失败: ${err instanceof Error ? err.message : String(err)}`,
409
+ },
410
+ })
411
+ })
412
+
413
+ try {
414
+ while (!isDone || queue.length > 0) {
415
+ if (queue.length === 0 && !isDone) {
416
+ const remaining = timeoutMs - (Date.now() - lastActivity)
417
+ if (remaining <= 0) {
418
+ client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
419
+ enqueue({
420
+ kind: 'error',
421
+ error: { code: 'DSH_TURN_STALLED', message: `回合停滞 ${Math.round(timeoutMs / 1000)}s 无事件,已取消` },
422
+ })
423
+ continue
424
+ }
425
+ await new Promise<void>((r) => {
426
+ resolveWait = r
427
+ setTimeout(() => {
428
+ resolveWait = null
429
+ r()
430
+ }, remaining + 100)
431
+ })
432
+ }
433
+ while (queue.length > 0) {
434
+ yield queue.shift()!
435
+ }
436
+ }
437
+ }
438
+ finally {
439
+ unsub()
440
+ signal?.removeEventListener('abort', onAbort)
441
+ this.turnActive = false
442
+ }
443
+ }
444
+
445
+ /** supervise 用:收齐整个回合 */
446
+ protected async collectTurnEvents(prompt: string, timeoutMs: number, signal?: AbortSignal): Promise<AgentEvent[]> {
447
+ const events: AgentEvent[] = []
448
+ for await (const e of this.streamTurn(prompt, undefined, timeoutMs, signal)) {
449
+ events.push(e)
450
+ if (e.kind === 'error') break
451
+ }
452
+ return events
453
+ }
454
+
455
+ // ===== 客户端管理 =====
456
+
457
+ private async ensureClient(ctx: AgentRunContext): Promise<void> {
458
+ if (!this.workspace) this.workspace = ctx.workspace
459
+ if (!this.agentInfo) {
460
+ this.channelId = ctx.channelId
461
+ this.agentRole = ctx.role
462
+ this.refreshIdentity()
463
+ }
464
+ if (this.client?.alive && this.sessionId) return
465
+ if (this.client && !this.client.alive) {
466
+ this.client = null
467
+ this.sessionId = null
468
+ }
469
+ this.clientStarting ??= this.startClient().finally(() => {
470
+ this.clientStarting = null
471
+ })
472
+ await this.clientStarting
473
+ }
474
+
475
+ private async startClient(): Promise<void> {
476
+ const command = this.config.command ?? harnessSettings().dsh_command
477
+ const env = generateMcpBridgeEnv({
478
+ agentId: this.selfAgentId,
479
+ token: this.config.token,
480
+ baseUrl: this.config.baseUrl,
481
+ bridgePath: this.config.mcpBridgePath,
482
+ extra: {
483
+ // 桥身份随进程环境注入:profile 级 mcp-client(patch 层)经 !!js 读取;
484
+ // 此 dsh 版本 session/new 不支持 mcpServers 参数,挂载走 profile 配置。
485
+ ...generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgeEnv,
486
+ AW_BRIDGE_PATH: generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgePath,
487
+ // provider/model 经环境传给 profile patch(!!js 读取):channel/agent config 驱动
488
+ ...(this.config.provider ? { AW_ACP_PROVIDER: this.config.provider } : {}),
489
+ ...(this.config.model ? { AW_ACP_MODEL: this.config.model } : {}),
490
+ ...(this.config.dshHome ? { DSH_HOME: this.config.dshHome } : {}),
491
+ ...(this.config.apiKey ? { DEEPSEEK_API_KEY: this.config.apiKey } : {}),
492
+ },
493
+ })
494
+ const client = new StdioJsonRpcClient({
495
+ name: 'dsh',
496
+ command,
497
+ args: this.config.args ?? ['--profile', 'acp'],
498
+ cwd: this.config.cwd ?? process.cwd(),
499
+ env: env.engineEnv,
500
+ requestTimeoutMs: 60_000,
501
+ })
502
+ const pidRef = { pid: undefined as number | undefined }
503
+ client.onExit((code) => {
504
+ if (pidRef.pid) markHarnessProcessExit(pidRef.pid, code)
505
+ this.sessionId = null
506
+ log.warn(`[DshAgent:${this.selfAgentId}] dsh acp 进程退出(code=${code});下回合自动重生`)
507
+ })
508
+ await client.start()
509
+ pidRef.pid = client.pid
510
+ if (client.pid) {
511
+ registerHarnessProcess(client.pid, { harness: 'dsh', command, args: ['--profile', 'acp'] })
512
+ bindHarnessProcess(client.pid, { agentId: this.selfAgentId, channelId: this.channelId, name: this.agentName, role: this.agentRole })
513
+ }
514
+
515
+ // 服务端→客户端请求(权限)→ HITL
516
+ client.onRequest((req: JsonRpcRequestIncoming) => {
517
+ if (req.method === DSH_ACP_METHODS.requestPermission) {
518
+ this.registerPermissionHitl(req)
519
+ return
520
+ }
521
+ client.respondError(req.id, -32601, `方法不存在: ${req.method}`)
522
+ })
523
+
524
+ // ACP 握手
525
+ await client.request(DSH_ACP_METHODS.initialize, {
526
+ protocolVersion: 1,
527
+ clientCapabilities: {},
528
+ }, 30_000).catch(async (err: Error) => {
529
+ // 协议版本协商失败 → 显式版本重试一次
530
+ await client.request(DSH_ACP_METHODS.initialize, { protocolVersion: '2025-06-01', clientCapabilities: {} }, 30_000)
531
+ .catch(() => { throw err })
532
+ })
533
+
534
+ // 建会话(此版本不接受自定义 mcpServers;工具经 profile 级 mcp-client 挂载;
535
+ // ACP schema 要求 mcpServers 字段存在,传空数组)
536
+ const created = await client.request(DSH_ACP_METHODS.sessionNew, {
537
+ cwd: this.config.cwd ?? process.cwd(),
538
+ mcpServers: [],
539
+ }, 60_000) as Record<string, unknown>
540
+ const sid = created?.sessionId ?? created?.id
541
+ this.sessionId = typeof sid === 'string' ? sid : null
542
+ if (!this.sessionId) throw new Error('dsh session/new 未返回 sessionId')
543
+
544
+ this.client = client
545
+ }
546
+
547
+ private registerPermissionHitl(req: JsonRpcRequestIncoming): void {
548
+ const client = this.client
549
+ if (!client) return
550
+ const p = (req.params ?? {}) as Record<string, unknown>
551
+ const options = Array.isArray(p.options) ? p.options as Array<Record<string, unknown>> : []
552
+ const toolCall = (p.toolCall ?? {}) as Record<string, unknown>
553
+ const id = `dsh-${randomUUID().slice(0, 8)}`
554
+ const registry = getHitlRegistry()
555
+ registry.register({
556
+ kind: 'dsh-permission',
557
+ id,
558
+ agentId: this.selfAgentId,
559
+ agentName: this.agentName,
560
+ channelId: this.channelId,
561
+ pid: client.pid,
562
+ method: 'confirm',
563
+ title: `dsh 权限请求:${String(toolCall.title ?? toolCall.toolName ?? p.toolName ?? '操作').slice(0, 200)}`,
564
+ detail: String(toolCall.kind ?? p.kind ?? ''),
565
+ options: options.map(o => String(o.name ?? o.optionId ?? '')),
566
+ createdAt: new Date().toISOString(),
567
+ expiresAt: null,
568
+ })
569
+ const timeoutMs = harnessSettings().hitl_timeout_ms
570
+ const timer = timeoutMs > 0
571
+ ? setTimeout(() => {
572
+ // fail-closed:超时按拒绝应答(引擎默认语义)
573
+ void this.respondHitl('dsh-permission', id, { confirmed: false }).catch(() => {})
574
+ }, timeoutMs)
575
+ : null
576
+ this.pendingPermissions.set(id, { rpcId: req.id, options, timer })
577
+ }
578
+ }