agentworkshop 0.7.34 → 0.7.38

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 (985) hide show
  1. package/.output/.AgentWorkShop/aml-python/aml_eval.py +171 -0
  2. package/.output/.AgentWorkShop/aml-python/amlkit.py +120 -0
  3. package/.output/.AgentWorkShop/aml-python/requirements.txt +7 -0
  4. package/.output/.AgentWorkShop/aml-python/train-example.py +92 -0
  5. package/.output/.AgentWorkShop/schema.json +2 -1
  6. package/.output/nitro.json +1 -1
  7. package/.output/public/_nuxt/{DLljr7g0.js → 45zuyAso.js} +1 -1
  8. package/.output/public/_nuxt/4sIEbgcl.js +42 -0
  9. package/.output/public/_nuxt/8NMOXZOV.js +1 -0
  10. package/.output/public/_nuxt/BCGafdXT.js +2 -0
  11. package/.output/public/_nuxt/BDNMzG2s2.js +1 -0
  12. package/.output/public/_nuxt/{C-mDhyEd.js → BDmh31hl.js} +1 -1
  13. package/.output/public/_nuxt/BFkgkW8u.js +4 -0
  14. package/.output/public/_nuxt/BG8sCcwx.js +14 -0
  15. package/.output/public/_nuxt/{D8CqF0yy.js → BHA40aHa.js} +1 -1
  16. package/.output/public/_nuxt/BJHKLJJU.js +1 -0
  17. package/.output/public/_nuxt/{DoTdlVVe2.js → BN6iuJEg2.js} +1 -1
  18. package/.output/public/_nuxt/BNT8gYU92.js +4 -0
  19. package/.output/public/_nuxt/BU83-NnX.js +106 -0
  20. package/.output/public/_nuxt/BYhEUx8t.js +17 -0
  21. package/.output/public/_nuxt/BzHEilTt.js +1 -0
  22. package/.output/public/_nuxt/{Ct-WOVr4.js → C3J6FYKa.js} +1 -1
  23. package/.output/public/_nuxt/C3gwHTz0.js +1 -0
  24. package/.output/public/_nuxt/C4DWUZ6d2.js +1 -0
  25. package/.output/public/_nuxt/C5gUkRwn.js +1 -0
  26. package/.output/public/_nuxt/CClOy-Hz2.js +1 -0
  27. package/.output/public/_nuxt/{CUXCQXjG.js → CM12FuB42.js} +1 -1
  28. package/.output/public/_nuxt/{BSCpFtzG.js → CSkxz2NX.js} +1 -1
  29. package/.output/public/_nuxt/CWoJjWmZ.js +1 -0
  30. package/.output/public/_nuxt/CY9LbPCI.js +1 -0
  31. package/.output/public/_nuxt/CYWVXZTS.js +7 -0
  32. package/.output/public/_nuxt/CZiw7sEV.js +1 -0
  33. package/.output/public/_nuxt/C_OLzD09.js +1 -0
  34. package/.output/public/_nuxt/C__m4EhR.js +1 -0
  35. package/.output/public/_nuxt/Cbq-mryP.js +1 -0
  36. package/.output/public/_nuxt/{C4OAdbVK2.js → Cc_9VzD42.js} +1 -1
  37. package/.output/public/_nuxt/{BASN8nZ0.js → CdPzkOMV.js} +1 -1
  38. package/.output/public/_nuxt/Cec0Ua3F.js +1 -0
  39. package/.output/public/_nuxt/{DYKVPzN-.js → CoNpEq5X.js} +1 -1
  40. package/.output/public/_nuxt/CojCTLKD.js +1 -0
  41. package/.output/public/_nuxt/{B7wL3pDk.js → Crod5z2f.js} +1 -1
  42. package/.output/public/_nuxt/CzlMDL5H.js +13 -0
  43. package/.output/public/_nuxt/{G0qIw7Gq2.js → D0ZBQrN_2.js} +1 -1
  44. package/.output/public/_nuxt/{Lp7Ll94I.js → D1YDxZpZ.js} +1 -1
  45. package/.output/public/_nuxt/{Bc0AmjfT.js → D20Yamr4.js} +1 -1
  46. package/.output/public/_nuxt/D6uzXueg.js +2 -0
  47. package/.output/public/_nuxt/D9Oidm5I.js +1 -0
  48. package/.output/public/_nuxt/DAe0h2MB.js +1 -0
  49. package/.output/public/_nuxt/DBHNsT1Y.js +23 -0
  50. package/.output/public/_nuxt/DDShH71m.js +1 -0
  51. package/.output/public/_nuxt/DDgJcSET.js +19 -0
  52. package/.output/public/_nuxt/DHFrCUxA2.js +13 -0
  53. package/.output/public/_nuxt/{BcrN7QEl2.js → DIaZ2PTo2.js} +1 -1
  54. package/.output/public/_nuxt/DPnwL14Y.js +1 -0
  55. package/.output/public/_nuxt/DR12_WCA.js +3 -0
  56. package/.output/public/_nuxt/{B9nXmjSB.js → DUrecWPx.js} +4 -4
  57. package/.output/public/_nuxt/DVsjtsvZ2.js +1 -0
  58. package/.output/public/_nuxt/DYr1VMiQ.js +6 -0
  59. package/.output/public/_nuxt/DZtm4l-P2.js +1 -0
  60. package/.output/public/_nuxt/DdD9mCHM.js +1 -0
  61. package/.output/public/_nuxt/DeJykBFf.js +9 -0
  62. package/.output/public/_nuxt/{DoMxCWN52.js → DeyBFhKH2.js} +1 -1
  63. package/.output/public/_nuxt/DkGQ7lnb2.js +1 -0
  64. package/.output/public/_nuxt/DmqknNvV.js +18 -0
  65. package/.output/public/_nuxt/DnUuIR83.js +1 -0
  66. package/.output/public/_nuxt/DrYV5i68.js +1 -0
  67. package/.output/public/_nuxt/{B5S_UyaC.js → DtYHUi5Z.js} +1 -1
  68. package/.output/public/_nuxt/Dz_Q3Lpw2.js +1 -0
  69. package/.output/public/_nuxt/DzbFpZRk.js +3 -0
  70. package/.output/public/_nuxt/HBLJ-wei.js +1 -0
  71. package/.output/public/_nuxt/JCoYF4IJ.js +31 -0
  72. package/.output/public/_nuxt/JTLM-kqr2.js +1 -0
  73. package/.output/public/_nuxt/{BeIfu4N3.js → KZQX7xoM.js} +2 -2
  74. package/.output/public/_nuxt/S_fVQwJK.js +1 -0
  75. package/.output/public/_nuxt/TownView.0oLiQgTC.css +1 -0
  76. package/.output/public/_nuxt/YnQxK3eG.js +1 -0
  77. package/.output/public/_nuxt/_id_.D-SYuyZb.css +1 -0
  78. package/.output/public/_nuxt/_id_.hma_BU6T.css +1 -0
  79. package/.output/public/_nuxt/_wsId_.B12v3PhY.css +1 -0
  80. package/.output/public/_nuxt/aLLjF2K-2.js +1 -0
  81. package/.output/public/_nuxt/aWWIh8YL.js +24 -0
  82. package/.output/public/_nuxt/ahgEJu2R.js +1 -0
  83. package/.output/public/_nuxt/aml.COEKNNqK.css +1 -0
  84. package/.output/public/_nuxt/builds/latest.json +1 -1
  85. package/.output/public/_nuxt/builds/meta/44b66249-54d0-4c8a-9057-9755a32329e2.json +1 -0
  86. package/.output/public/_nuxt/daq.B3265ZDn.css +1 -0
  87. package/.output/public/_nuxt/dcw.DLYZqEhT.css +1 -0
  88. package/.output/public/_nuxt/default.DE_vT238.css +1 -0
  89. package/.output/public/_nuxt/entry.BB-Eeh-J.css +1 -0
  90. package/.output/public/_nuxt/jZsY8yYz.js +1 -0
  91. package/.output/public/_nuxt/logs.CqFyMrJw.css +1 -0
  92. package/.output/public/_nuxt/pages.ooEzrMm9.css +1 -0
  93. package/.output/public/_nuxt/pdk8jLGT.js +1 -0
  94. package/.output/public/_nuxt/plugins.5e5chZ67.css +1 -0
  95. package/.output/public/_nuxt/pz2JDAM7.js +2 -0
  96. package/.output/public/_nuxt/settings.Dm3M0RLy.css +1 -0
  97. package/.output/public/_nuxt/town.DKIAhKnx.css +1 -0
  98. package/.output/public/_nuxt/users.CXnP2E08.css +1 -0
  99. package/.output/public/_nuxt/vRTjoWqd.js +1 -0
  100. package/.output/public/_nuxt/workshop.Jk5HxWPE.css +1 -0
  101. package/.output/public/_nuxt/zIGh7R49.js +75 -0
  102. package/.output/public/_nuxt/zq5t1vyX.js +1 -0
  103. package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
  104. package/.output/server/chunks/_/entity.mjs +174 -0
  105. package/.output/server/chunks/_/entity.mjs.map +1 -0
  106. package/.output/server/chunks/_/env-manager.mjs +162 -0
  107. package/.output/server/chunks/_/env-manager.mjs.map +1 -0
  108. package/.output/server/chunks/_/host-bindings.mjs +1 -1
  109. package/.output/server/chunks/_/nitro.mjs +1657 -1162
  110. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  111. package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
  112. package/.output/server/chunks/build/{TownView-BdHnAilw.mjs → TownView-jVazYOjN.mjs} +141 -141
  113. package/.output/server/chunks/build/{TownView-BdHnAilw.mjs.map → TownView-jVazYOjN.mjs.map} +1 -1
  114. package/.output/server/chunks/build/{_id_-Cb845FHR.mjs → _id_-CfVosNg3.mjs} +136 -136
  115. package/.output/server/chunks/build/{_id_-Cb845FHR.mjs.map → _id_-CfVosNg3.mjs.map} +1 -1
  116. package/.output/server/chunks/build/{_id_-fadFPl2i.mjs → _id_-Hwr4rZpr.mjs} +32 -32
  117. package/.output/server/chunks/build/{_id_-fadFPl2i.mjs.map → _id_-Hwr4rZpr.mjs.map} +1 -1
  118. package/.output/server/chunks/build/{_wsId_-CTZswnm5.mjs → _wsId_-BVg3bB77.mjs} +175 -165
  119. package/.output/server/chunks/build/{_wsId_-CTZswnm5.mjs.map → _wsId_-BVg3bB77.mjs.map} +1 -1
  120. package/.output/server/chunks/build/aml-BCSJCdX7.mjs +588 -0
  121. package/.output/server/chunks/build/aml-BCSJCdX7.mjs.map +1 -0
  122. package/.output/server/chunks/build/{daq-BvihjQyW.mjs → daq-C03Uu5UE.mjs} +108 -106
  123. package/.output/server/chunks/build/daq-C03Uu5UE.mjs.map +1 -0
  124. package/.output/server/chunks/build/{dcw-Ks2vJ4PF.mjs → dcw-6vEYVeje.mjs} +44 -44
  125. package/.output/server/chunks/build/{dcw-Ks2vJ4PF.mjs.map → dcw-6vEYVeje.mjs.map} +1 -1
  126. package/.output/server/chunks/build/{default-GgHt4O2R.mjs → default-hseyOqBT.mjs} +30 -27
  127. package/.output/server/chunks/build/{default-GgHt4O2R.mjs.map → default-hseyOqBT.mjs.map} +1 -1
  128. package/.output/server/chunks/build/{logs-CYBhkQwh.mjs → logs-B-xhuqln.mjs} +35 -35
  129. package/.output/server/chunks/build/{logs-CYBhkQwh.mjs.map → logs-B-xhuqln.mjs.map} +1 -1
  130. package/.output/server/chunks/build/{pages-C-6BRtv8.mjs → pages-BO7yZsXA.mjs} +18 -27
  131. package/.output/server/chunks/build/pages-BO7yZsXA.mjs.map +1 -0
  132. package/.output/server/chunks/build/{plugins-dZRegC7m.mjs → plugins-CUWmMdyt.mjs} +17 -17
  133. package/.output/server/chunks/build/{plugins-dZRegC7m.mjs.map → plugins-CUWmMdyt.mjs.map} +1 -1
  134. package/.output/server/chunks/build/{settings-CgDLkP3s.mjs → settings-DoQ2Oq3P.mjs} +43 -43
  135. package/.output/server/chunks/build/{settings-CgDLkP3s.mjs.map → settings-DoQ2Oq3P.mjs.map} +1 -1
  136. package/.output/server/chunks/build/{town-DJ-V5G9U.mjs → town-BOl6hs9B.mjs} +7 -7
  137. package/.output/server/chunks/build/{town-DJ-V5G9U.mjs.map → town-BOl6hs9B.mjs.map} +1 -1
  138. package/.output/server/chunks/build/useDaqStream-CIBaiGAl.mjs +1 -1
  139. package/.output/server/chunks/build/useDcwStream-CBbiYnWe.mjs +1 -1
  140. package/.output/server/chunks/build/{useWorkshopWs-CprkZEdq.mjs → useWorkshopWs-C_I7q9As.mjs} +110 -32
  141. package/.output/server/chunks/build/{useWorkshopWs-CprkZEdq.mjs.map → useWorkshopWs-C_I7q9As.mjs.map} +1 -1
  142. package/.output/server/chunks/build/{users-4nzxTjFT.mjs → users-fohSmF-J.mjs} +6 -6
  143. package/.output/server/chunks/build/{users-4nzxTjFT.mjs.map → users-fohSmF-J.mjs.map} +1 -1
  144. package/.output/server/chunks/build/{workshop-81xhz368.mjs → workshop-DX5-ldc4.mjs} +15 -15
  145. package/.output/server/chunks/build/{workshop-81xhz368.mjs.map → workshop-DX5-ldc4.mjs.map} +1 -1
  146. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +21 -8
  147. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs.map +1 -1
  148. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +1 -1
  149. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs +58 -0
  150. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs.map +1 -0
  151. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +27 -6
  152. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs.map +1 -1
  153. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs +49 -0
  154. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs.map +1 -0
  155. package/.output/server/chunks/routes/api/workshop/aml/entities/prune.post.mjs +45 -0
  156. package/.output/server/chunks/routes/api/workshop/aml/entities/prune.post.mjs.map +1 -0
  157. package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs +30 -0
  158. package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs.map +1 -0
  159. package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs +40 -0
  160. package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs.map +1 -0
  161. package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs +42 -0
  162. package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs.map +1 -0
  163. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +1 -1
  164. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +1 -1
  165. package/.output/server/chunks/routes/api/workshop/aml/index2.get.mjs +4 -22
  166. package/.output/server/chunks/routes/api/workshop/aml/index2.get.mjs.map +1 -1
  167. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +1 -1
  168. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +4 -16
  169. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs.map +1 -1
  170. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +19 -34
  171. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs.map +1 -1
  172. package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs +41 -0
  173. package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs.map +1 -0
  174. package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs +62 -0
  175. package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs.map +1 -0
  176. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +1 -1
  177. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +1 -1
  178. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +1 -1
  179. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs +63 -0
  180. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs.map +1 -0
  181. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +1 -1
  182. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +1 -1
  183. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs +54 -0
  184. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs.map +1 -0
  185. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs +46 -0
  186. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs.map +1 -0
  187. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +1 -1
  188. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +1 -1
  189. package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
  190. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +1 -1
  191. package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
  192. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +1 -1
  193. package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +1 -1
  194. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
  195. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +1 -1
  196. package/.output/server/chunks/routes/api/workshop/channels.post.mjs +4 -4
  197. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
  198. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
  199. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
  200. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
  201. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
  202. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
  203. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
  204. package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +1 -1
  205. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
  206. package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +1 -1
  207. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
  208. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
  209. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
  210. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
  211. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
  212. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
  213. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
  214. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
  215. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
  216. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
  217. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
  218. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
  219. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
  220. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
  221. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
  222. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
  223. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
  224. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
  225. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
  226. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
  227. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
  228. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
  229. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
  230. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
  231. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
  232. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
  233. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
  234. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
  235. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
  236. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
  237. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
  238. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
  239. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
  240. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
  241. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
  242. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +1 -1
  243. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
  244. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
  245. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
  246. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
  247. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
  248. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
  249. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
  250. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
  251. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
  252. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
  253. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
  254. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
  255. package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
  256. package/.output/server/chunks/routes/api/workshop/index2.get.mjs +12 -1
  257. package/.output/server/chunks/routes/api/workshop/index2.get.mjs.map +1 -1
  258. package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
  259. package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
  260. package/.output/server/chunks/routes/api/workshop/index5.get.mjs +1 -1
  261. package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
  262. package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
  263. package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
  264. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
  265. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
  266. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
  267. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
  268. package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
  269. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +1 -1
  270. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +1 -1
  271. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
  272. package/.output/server/chunks/routes/renderer.mjs +2 -2
  273. package/.output/server/chunks/virtual/entry.mjs +103 -17
  274. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  275. package/.output/server/package.json +1 -1
  276. package/README-zh.md +578 -507
  277. package/README.md +125 -51
  278. package/app/assets/css/main.css +329 -22
  279. package/app/components/AppHeader.vue +5 -4
  280. package/app/components/AppSidebar.vue +5 -4
  281. package/app/components/AwChart.vue +17 -0
  282. package/app/components/workshop/AgentLanesView.vue +2 -2
  283. package/app/components/workshop/ChannelSessionList.vue +3 -3
  284. package/app/components/workshop/CommandPalette.vue +1 -2
  285. package/app/components/workshop/Composer.vue +4 -4
  286. package/app/components/workshop/DaqNodeRow.vue +20 -1
  287. package/app/components/workshop/EventBlock.vue +3 -3
  288. package/app/components/workshop/MentionHoverCard.vue +1 -1
  289. package/app/components/workshop/MultiChannelView.vue +1 -1
  290. package/app/components/workshop/TaskBoardView.vue +5 -5
  291. package/app/components/workshop/TranscriptTimeline.vue +3 -3
  292. package/app/components/workshop/blocks/ClusterRoute.vue +3 -3
  293. package/app/components/workshop/blocks/ClusterStream.vue +1 -1
  294. package/app/components/workshop/blocks/ClusterTool.vue +1 -1
  295. package/app/components/workshop/lanes/LaneBlocks.vue +5 -2
  296. package/app/components/workshop/town/TownView.vue +0 -7
  297. package/app/composables/workshop/useClusteredBlocks.ts +22 -3
  298. package/app/composables/workshop/useEscClose.ts +44 -0
  299. package/app/config/index.ts +2 -1
  300. package/app/layouts/default.vue +25 -8
  301. package/app/pages/aml/index.vue +626 -4
  302. package/app/pages/daq/[id].vue +1 -1
  303. package/app/pages/daq/index.vue +10 -12
  304. package/app/pages/dcw/[id].vue +2 -2
  305. package/app/pages/dcw/index.vue +7 -11
  306. package/app/pages/index.vue +24 -6
  307. package/app/pages/logs/index.vue +2 -6
  308. package/app/pages/plugins/index.vue +1 -1
  309. package/app/pages/settings.vue +2 -2
  310. package/app/pages/town.vue +0 -2
  311. package/app/pages/users.vue +1 -1
  312. package/app/pages/workshop/index.vue +2 -2
  313. package/app/plugins/esc-close.client.ts +31 -0
  314. package/app/stores/workshop/events.ts +186 -36
  315. package/bin/aw.mjs +7 -2
  316. package/cli/aw.mjs +19 -34
  317. package/cli/commands/build.mjs +18 -1
  318. package/cli/commands/config.mjs +2 -0
  319. package/cli/commands/plugin.mjs +45 -18
  320. package/cli/commands/register.mjs +6 -2
  321. package/cli/commands/status.mjs +2 -1
  322. package/cli/commands/update.mjs +1 -1
  323. package/cli/commands/version.mjs +1 -1
  324. package/cli/core/args.mjs +76 -4
  325. package/cli/core/help.mjs +3 -1
  326. package/cli/core/meta.mjs +38 -0
  327. package/cli/core/post-build.mjs +96 -0
  328. package/cli/core/registry.mjs +6 -3
  329. package/config.yml +28 -26
  330. package/docs/aml.md +99 -0
  331. package/docs/cli.en.md +445 -0
  332. package/docs/cli.md +410 -220
  333. package/docs/full-test-plan.md +174 -0
  334. package/docs/multi-harness-architecture.md +248 -0
  335. package/docs/plugins.en.md +534 -0
  336. package/docs/plugins.md +531 -179
  337. package/docs/sdk.en.md +922 -0
  338. package/docs/sdk.md +725 -129
  339. package/i18n/dicts/aml.json +43 -1
  340. package/i18n/locales/en.ts +1928 -1885
  341. package/i18n/locales/zh-CN.ts +1928 -1885
  342. package/nuxt.config.ts +27 -2
  343. package/package.json +164 -153
  344. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.continue.json +1 -0
  345. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.json +1 -0
  346. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/054bb4bc4e4217a2ab0b0c6b663747214a9af464f5568ea60e784704e340bb0f.source +153 -0
  347. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/0554197c3d2bac203a1f5c48a5d52495d1336db1bd7aa4f4c19875810363e684.source +153 -0
  348. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/05c203d12a954fffba942e1d626e3f5fec05b18a5aef2bac003b7884a4b77406.source +431 -0
  349. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/145a6e6ba811af35aed31e0cc3211f53706a14980fa069ee9e3c1591139f96f0.source +180 -0
  350. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/1ae0fb281f97899c025e368ca73f41349b01fb5f85b19e08d7ebccff49095ed5.source +112 -0
  351. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/20ee9967aa0541c516db7575bdd4a1a745939bc7016bd10d7635903113edb8ec.source +227 -0
  352. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/233751843aeba9d4c5263f275b8102de00443c06f286918cbd23e0b6729e01aa.source +131 -0
  353. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/263c2e05b425e5c322e60c6475279f963bab3a873eb521b21df7fec935a46597.source +160 -0
  354. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/2ac5eaac28eaaee2178c4b32014df8e732f9dd432a285a872f5b7f31c1395fa4.source +157 -0
  355. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/33a0db0d2d95d2c11d0720090458e5fba1425376f5ceb5b422d1d3471be3226b.source +348 -0
  356. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/359e474ae83db35e4615d3728de6bf694b64d4dce9b536730a3b6518f9c0494a.source +296 -0
  357. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/37a4c3c31c4b70f6b719c53d1e9c4fcba603f31adfdd11bb6ef9f0d094923c56.source +285 -0
  358. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/461feca1c14a695eb8b0f17a6f95fe97eeceabc0510faaea4ba6d25bde147d8d.source +217 -0
  359. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/4cfadbda8591f29d5e1e230dc000e701b756e850441b3900fb596a4d2f6e98c2.source +301 -0
  360. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/50ca2810cf0b248c96948994c0c404531bbad6e553166b6816b3b03bfa0f75d2.source +151 -0
  361. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/52d9e8cb591a9ae86e238c3620a610cd386717bee222c0f37b25b2ac7e523dc4.source +135 -0
  362. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/6c87daafa4c006560a954636a97333f6123153c9d34d96203f7ee3a14e556357.source +156 -0
  363. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/77bc47854b577900621cacf1697f81fa2bc005af129d37614a97a3441c08f99f.source +72 -0
  364. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/7bbb789d3a527817118cf8399ed1861d6a962ade10878fd07223435d333a7089.source +469 -0
  365. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/86b7c1daafc8b60ba9982dde5bf1bcc74265709483c176e71f23ec6fc267451f.source +259 -0
  366. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/8df66d62bd41984d0970e8236882080c5085ac937d07a29779463d6a03b37c76.source +97 -0
  367. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/9962f2d1b3a85137bd40cc835725600b39f89ee02a27c06b2e0402e1eafde115.source +277 -0
  368. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/a1090ea066b792cb201739f4994e37bf7c12f52e805239a1eab87f18a537f266.source +171 -0
  369. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/a5241091650134d0919897e086a606a3846c8b2b54f8b4c84a8696c145ac3e9e.source +425 -0
  370. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/af19fa4c6e34d5540028be4b17600161283af3a2a2dfc61a3fdc0834436a0c14.source +99 -0
  371. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/b3713d78e2b2f93905ff6be8d58a8d0a2f42dea322eb67c987fda22ff6a084d5.source +325 -0
  372. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/b3849943c3aff102d1af815631fc843a2a52c17646a4b04696ece323e483bbec.source +332 -0
  373. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/bac735a3803a6650b7f1eb8f587e6dc5c68ea055000c3c99a11789438b78e837.source +43 -0
  374. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/d32c24d61eb8b33c73e5a8fc7e4dc7ef437aed238ee4371c2b00617e6104090a.source +154 -0
  375. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/d5170dc9a9879fda04fdf91d8a110d4efb6787ee38dda596d4da899883d36a72.source +531 -0
  376. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/dc59bcd7bb397be63ba2f2c3fec23f3782dcb17d2d75a9981eeced761f33eb32.source +439 -0
  377. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/eb5ff8cf66b92aec7bf6726781d8df74faa2b030c3aaac17d6b00c1fc04c9b32.source +323 -0
  378. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/f10615a6fae18436e70d1201b2d44fdae3174a3aa7bb4db97dea1b3ed291d721.source +433 -0
  379. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/f36d3e271668bc1260c2823542d22dbf1d0f7041ff16b1ac175bce2256e582ca.source +280 -0
  380. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/f94449380af09f31ac352152007146a75cc80bae8d6411ffe57b2c56f933b0ff.source +117 -0
  381. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/fe4dfd81178fd6b648335f6405d9ede71319aebde796008e50db21f8adf44c99.source +160 -0
  382. package/scripts/.mimosa/hook-state/sess_aeaecb58-8833-4b83-b93c-050467d21e03.mtxwtxme-61028-1f4519fbc4.baseline/ffb4e3aa548cfdadabaa44ab599f9b6a3ca6288176a2cc7a4b2fc2a12b5fb848.source +101 -0
  383. package/scripts/.mimosa/hook-status/sess_aeaecb58-8833-4b83-b93c-050467d21e03-d944d71bb3.json +14 -0
  384. package/scripts/_audit/aml-layout-diag.mjs +83 -0
  385. package/scripts/_audit/bump-version.mjs +51 -0
  386. package/scripts/_audit/channel-inspect.mjs +49 -0
  387. package/scripts/_audit/cleanup-apply.mjs +89 -0
  388. package/scripts/_audit/cleanup-plan.mjs +82 -0
  389. package/scripts/_audit/contrast-check.mjs +43 -0
  390. package/scripts/_audit/dcw-unrecorded-write.ts +1 -1
  391. package/scripts/_audit/design-shots.mjs +145 -0
  392. package/scripts/_audit/docs-font-probe.mjs +68 -0
  393. package/scripts/_audit/docs-probe.mjs +107 -0
  394. package/scripts/_audit/docs-shots.mjs +171 -0
  395. package/scripts/_audit/docs-v3-verify.mjs +255 -0
  396. package/scripts/_audit/docs-vue-lint.mjs +81 -0
  397. package/scripts/_audit/docs-vue-lint2.mjs +91 -0
  398. package/scripts/_audit/exp-cost-scaling.mjs +4 -1
  399. package/scripts/_audit/exp-envelope-and-png.mjs +2 -1
  400. package/scripts/_audit/exp-sweep-fairness.mjs +4 -2
  401. package/scripts/_audit/fix-settings-count.mjs +57 -0
  402. package/scripts/_audit/glass-verify.mjs +155 -0
  403. package/scripts/_audit/hydration-diff.mjs +104 -0
  404. package/scripts/_audit/hydration-head.mjs +36 -0
  405. package/scripts/_audit/hydration-probe.mjs +59 -0
  406. package/scripts/_audit/lead-matrix-test.mjs +172 -0
  407. package/scripts/_audit/plc-agent-task.mjs +74 -0
  408. package/scripts/_audit/plc-clean-scenario.mjs +434 -0
  409. package/scripts/_audit/plc-clean-shots.mjs +161 -0
  410. package/scripts/_audit/plc-fc10-probe.mjs +30 -0
  411. package/scripts/_audit/probe-binding.mjs +114 -103
  412. package/scripts/_audit/review-fix-verify.mjs +158 -0
  413. package/scripts/_audit/seed-demo.mjs +165 -0
  414. package/scripts/_audit/town-focus-shot.mjs +129 -0
  415. package/scripts/_audit/town-reposition.mjs +85 -0
  416. package/scripts/_audit/ts-resolve-hook.mjs +57 -22
  417. package/scripts/_audit/verify-cleanup.mjs +67 -0
  418. package/scripts/_audit/verify-release-pack.mjs +82 -0
  419. package/scripts/_audit/watchdog-recovery-test.mjs +127 -0
  420. package/scripts/_dbg-audit-all-pages.mjs +43 -43
  421. package/scripts/_dbg-configroot-audit.mjs +84 -84
  422. package/scripts/_dbg-daq-intervals-func.mjs +94 -94
  423. package/scripts/_dbg-daq-rowstyle-verify.mjs +112 -112
  424. package/scripts/_dbg-groups-ui-verify.mjs +122 -122
  425. package/scripts/_dbg-harness-e2e.mjs +92 -92
  426. package/scripts/_dbg-harness-ui-e2e.py +97 -97
  427. package/scripts/_dbg-hitl-timeout-e2e.mjs +93 -93
  428. package/scripts/_dbg-multiharness-live-e2e.mjs +254 -254
  429. package/scripts/_dbg-opslog-agent-e2e.mjs +194 -194
  430. package/scripts/_dbg-opt-team-e2e.mjs +133 -133
  431. package/scripts/_dbg-recipe-e2e.mjs +176 -176
  432. package/scripts/_dbg-recipe-stale-e2e.mjs +135 -135
  433. package/scripts/_dbg-render-perf.mjs +142 -142
  434. package/scripts/_dbg-render-regression.mjs +130 -130
  435. package/scripts/_dbg-town-smoke.mjs +54 -54
  436. package/scripts/aw-start-smoke.mjs +27 -8
  437. package/scripts/check-docs-sync.mjs +367 -0
  438. package/scripts/e2e-full-closedloop.mjs +36 -18
  439. package/scripts/production-closed-loop-e2e.mjs +300 -303
  440. package/scripts/test-cli-exit.mjs +129 -21
  441. package/scripts/test-daq-frame-race.mjs +144 -96
  442. package/scripts/test-events-index.mjs +176 -0
  443. package/scripts/test-lru.mjs +34 -11
  444. package/scripts/test-memory-month-query.mjs +11 -3
  445. package/scripts/test-plugin-hardening.mjs +39 -2
  446. package/scripts/test-plugin-lifecycle.mjs +173 -0
  447. package/scripts/test-rollback-index.mjs +76 -18
  448. package/scripts/test-sdk-surface.mjs +6 -3
  449. package/sdk/client.mjs +16 -7
  450. package/sdk/context.mjs +21 -9
  451. package/sdk/examples/line-sentinel/client.mjs +13 -6
  452. package/sdk/examples/line-sentinel/index.mjs +5 -2
  453. package/sdk/examples/ops-notifier/client.mjs +3 -1
  454. package/sdk/examples/sample-insight/client.mjs +4 -2
  455. package/sdk/index.d.mts +133 -16
  456. package/sdk/index.mjs +3 -2
  457. package/sdk/lifecycle.mjs +8 -3
  458. package/server/api/workshop/agent-tools/bindings/index.post.ts +22 -7
  459. package/server/api/workshop/aml/datasets/[id].delete.ts +39 -0
  460. package/server/api/workshop/aml/datasets/[id].get.ts +31 -9
  461. package/server/api/workshop/aml/datasets/[id].patch.ts +30 -0
  462. package/server/api/workshop/aml/entities/index.get.ts +13 -0
  463. package/server/api/workshop/aml/entities/prune.post.ts +28 -0
  464. package/server/api/workshop/aml/env/index.get.ts +13 -0
  465. package/server/api/workshop/aml/env/recheck.post.ts +14 -0
  466. package/server/api/workshop/aml/env/uv.post.ts +21 -0
  467. package/server/api/workshop/aml/env/venv.post.ts +24 -0
  468. package/server/api/workshop/aml/index.get.ts +14 -1
  469. package/server/api/workshop/aml/jobs/[id].delete.ts +44 -0
  470. package/server/api/workshop/aml/models/[id].delete.ts +35 -0
  471. package/server/api/workshop/aml/models/[id].patch.ts +30 -0
  472. package/server/plugins/dev-stability-guard.ts +40 -63
  473. package/server/services/workshop/agents/agent-interface.ts +3 -0
  474. package/server/services/workshop/agents/codex-agent.ts +4 -7
  475. package/server/services/workshop/agents/dsh-agent.ts +4 -7
  476. package/server/services/workshop/agents/opencode-agent.ts +5 -7
  477. package/server/services/workshop/aml/aml.repo.ts +18 -0
  478. package/server/services/workshop/aml/dataset-builder.ts +4 -0
  479. package/server/services/workshop/aml/entity.ts +365 -0
  480. package/server/services/workshop/aml/env-manager.ts +242 -0
  481. package/server/services/workshop/aml/job-orchestrator.ts +4 -15
  482. package/server/services/workshop/aml/model-registry.ts +6 -0
  483. package/server/services/workshop/aml/python-runtime.ts +396 -62
  484. package/server/services/workshop/aml/runtime.ts +95 -4
  485. package/server/services/workshop/daq/bus/mqtt.adapter.ts +3 -1
  486. package/server/services/workshop/daq/daq-controller.ts +95 -47
  487. package/server/services/workshop/daq/daq-node.repo.ts +0 -10
  488. package/server/services/workshop/daq/daq-runtime.ts +0 -5
  489. package/server/services/workshop/json-store.mjs +35 -2
  490. package/server/services/workshop/plugins/host.mjs +14 -5
  491. package/server/services/workshop/runtime/manager.ts +28 -1
  492. package/server/services/workshop/runtime/scheduler-loop.ts +10 -1
  493. package/server/services/workshop/settings.ts +2 -0
  494. package/server/utils/stability-severity.ts +66 -0
  495. package/shared/config/home.mjs +58 -0
  496. package/shared/config/schema.json +2 -1
  497. package/shared/lru.mjs +4 -1
  498. package/.output/public/_nuxt/-6OnbLFb.js +0 -1
  499. package/.output/public/_nuxt/-nb2uqVg.js +0 -1
  500. package/.output/public/_nuxt/4bHdIqEg.js +0 -18
  501. package/.output/public/_nuxt/6PZPfFcO.js +0 -17
  502. package/.output/public/_nuxt/BBBtwOpo.js +0 -9
  503. package/.output/public/_nuxt/BBwMH_hG.js +0 -7
  504. package/.output/public/_nuxt/BDUjyaF4.js +0 -42
  505. package/.output/public/_nuxt/BNXfwXpE.js +0 -1
  506. package/.output/public/_nuxt/BN_PdN3J.js +0 -24
  507. package/.output/public/_nuxt/BSSUlJnx2.js +0 -1
  508. package/.output/public/_nuxt/BWSE6hR6.js +0 -1
  509. package/.output/public/_nuxt/BZGNTgTQ2.js +0 -1
  510. package/.output/public/_nuxt/BZv4RFYN.js +0 -1
  511. package/.output/public/_nuxt/BcmbLh2z2.js +0 -1
  512. package/.output/public/_nuxt/BfGc7TJp.js +0 -1
  513. package/.output/public/_nuxt/BgTB6h_q.js +0 -2
  514. package/.output/public/_nuxt/BkLJA9J5.js +0 -1
  515. package/.output/public/_nuxt/Bp5luxkg2.js +0 -1
  516. package/.output/public/_nuxt/BuCHayqN.js +0 -1
  517. package/.output/public/_nuxt/BuvcLKh1.js +0 -19
  518. package/.output/public/_nuxt/C3tCneTM.js +0 -1
  519. package/.output/public/_nuxt/C77oC8yC2.js +0 -7
  520. package/.output/public/_nuxt/C9f8QMp12.js +0 -1
  521. package/.output/public/_nuxt/CKfhtOt7.js +0 -13
  522. package/.output/public/_nuxt/CQvmN-Mi.js +0 -1
  523. package/.output/public/_nuxt/CUDrOuW7.js +0 -1
  524. package/.output/public/_nuxt/CZcC-gpk.js +0 -1
  525. package/.output/public/_nuxt/CbzsPO5H.js +0 -1
  526. package/.output/public/_nuxt/CdSOrh2c.js +0 -1
  527. package/.output/public/_nuxt/Cgx818r-.js +0 -1
  528. package/.output/public/_nuxt/Cjm7VogC.js +0 -1
  529. package/.output/public/_nuxt/Cm5mDxzH.js +0 -1
  530. package/.output/public/_nuxt/CmHzfVc5.js +0 -3
  531. package/.output/public/_nuxt/Cn3J3NXR.js +0 -23
  532. package/.output/public/_nuxt/Cno6kYiO2.js +0 -1
  533. package/.output/public/_nuxt/Cp6z0RN7.js +0 -1
  534. package/.output/public/_nuxt/CwqIxJGj.js +0 -2
  535. package/.output/public/_nuxt/D-Ca4BGY.js +0 -70
  536. package/.output/public/_nuxt/D0fhp-Ga.js +0 -75
  537. package/.output/public/_nuxt/D1z7i2UP.js +0 -31
  538. package/.output/public/_nuxt/DIaTPH1M.js +0 -1
  539. package/.output/public/_nuxt/DTYBfjRY.js +0 -1
  540. package/.output/public/_nuxt/DXRZPxGs.js +0 -1
  541. package/.output/public/_nuxt/DZzGarBE2.js +0 -13
  542. package/.output/public/_nuxt/DaMCzQhv.js +0 -1
  543. package/.output/public/_nuxt/DoLasgPj2.js +0 -1
  544. package/.output/public/_nuxt/DpojD719.js +0 -1
  545. package/.output/public/_nuxt/DsVcWfyR.js +0 -1
  546. package/.output/public/_nuxt/DtBu71ev.js +0 -32
  547. package/.output/public/_nuxt/Dy-mxvXY2.js +0 -1
  548. package/.output/public/_nuxt/DzuC31-i.js +0 -2
  549. package/.output/public/_nuxt/FQri3dV3.js +0 -1
  550. package/.output/public/_nuxt/ORt9oDIy2.js +0 -1
  551. package/.output/public/_nuxt/TownView.CtskuMXS.css +0 -1
  552. package/.output/public/_nuxt/VLI2Zy4t.js +0 -5
  553. package/.output/public/_nuxt/_id_.MbzdFygI.css +0 -1
  554. package/.output/public/_nuxt/_id_.hRYo-EAB.css +0 -1
  555. package/.output/public/_nuxt/_wsId_.gXMEOYgX.css +0 -1
  556. package/.output/public/_nuxt/aml.WU_bh87J.css +0 -1
  557. package/.output/public/_nuxt/arUY5dyq2.js +0 -4
  558. package/.output/public/_nuxt/builds/meta/adc365b6-f636-4a2b-9527-79819c1e874b.json +0 -1
  559. package/.output/public/_nuxt/daq.Bb6l44-O.css +0 -1
  560. package/.output/public/_nuxt/dcw.rXH2fc2Z.css +0 -1
  561. package/.output/public/_nuxt/default.jNT73_hq.css +0 -1
  562. package/.output/public/_nuxt/ekuGmQ7R.js +0 -1
  563. package/.output/public/_nuxt/entry.jFrFAWuA.css +0 -1
  564. package/.output/public/_nuxt/logs.DMOM-iHe.css +0 -1
  565. package/.output/public/_nuxt/niDwBOZW.js +0 -3
  566. package/.output/public/_nuxt/pMoIO6rr.js +0 -14
  567. package/.output/public/_nuxt/pages.Cc8GX9T1.css +0 -1
  568. package/.output/public/_nuxt/plugins.wIPyfPn-.css +0 -1
  569. package/.output/public/_nuxt/rqZ-1SoP.js +0 -2
  570. package/.output/public/_nuxt/settings.BCm4NZIc.css +0 -1
  571. package/.output/public/_nuxt/town.C_DsNW0J.css +0 -1
  572. package/.output/public/_nuxt/users.DuAt_Zwf.css +0 -1
  573. package/.output/public/_nuxt/vJ4FPb-_.js +0 -1
  574. package/.output/public/_nuxt/workshop.BJg84pOK.css +0 -1
  575. package/.output/server/chunks/build/aml-uBNIppIf.mjs +0 -508
  576. package/.output/server/chunks/build/aml-uBNIppIf.mjs.map +0 -1
  577. package/.output/server/chunks/build/daq-BvihjQyW.mjs.map +0 -1
  578. package/.output/server/chunks/build/pages-C-6BRtv8.mjs.map +0 -1
  579. package/scripts/_audit/.tmp/audit-data/dcws.json +0 -28
  580. package/scripts/_audit/.tmp/dcw-writes.json +0 -15650
  581. package/scripts/_audit/.tmp/dcws.json +0 -9033
  582. package/scripts/_audit/.tmp/pollution-backup/dcw-rollback.polluted.json +0 -470006
  583. package/scripts/_audit/.tmp/pollution-backup/dcws.polluted.json +0 -9085
  584. package/scripts/_audit/.tmp/probe-cwd.txt +0 -1
  585. package/scripts/_audit/awhome/commands/README.md +0 -3
  586. package/scripts/_audit/awhome/commands/hello.mjs +0 -12
  587. package/scripts/_audit/diag-cwd.ts +0 -20
  588. package/scripts/_audit/diag-cwd2.ts +0 -19
  589. package/scripts/_audit/hello.mjs +0 -12
  590. package/scripts/_audit/ndjson-partial-line-repro.mjs +0 -77
  591. package/scripts/_audit/opencode-await-ternary-repro.mjs +0 -20
  592. package/scripts/_audit/part-frag.txt +0 -84
  593. package/scripts/_audit/part-head.txt +0 -45
  594. package/scripts/_audit/probe-child.mjs +0 -17
  595. package/scripts/_audit/probe-envelope.mjs +0 -49
  596. package/scripts/_audit/probe-packlist.mjs +0 -67
  597. package/scripts/_audit/probe-routes.mjs +0 -47
  598. package/scripts/_audit/probe-routes2.mjs +0 -38
  599. package/scripts/_audit/probe.ts +0 -9
  600. package/scripts/_audit/probe2.ts +0 -6
  601. package/scripts/_audit/probe3.ts +0 -3
  602. package/scripts/_audit/probe4.ts +0 -3
  603. package/scripts/_audit/proj/.AgentWorkShop/commands/echoargs.mjs +0 -13
  604. package/scripts/_audit/proj/config.yml +0 -1
  605. package/scripts/_audit/run.mjs +0 -30
  606. package/scripts/_audit/tsconfig.probe.json +0 -24
  607. package/scripts/_audit/typecheck-out.txt +0 -466
  608. package/scripts/_daq-realtime-probe.mjs +0 -68
  609. package/scripts/_daq-warn-probe.mjs +0 -50
  610. package/scripts/_dbg-acc-1-setup.mjs +0 -57
  611. package/scripts/_dbg-acc-2-diag.mjs +0 -14
  612. package/scripts/_dbg-acc-2-intervals.mjs +0 -81
  613. package/scripts/_dbg-acc-3-daq.mjs +0 -48
  614. package/scripts/_dbg-acc-4-team.mjs +0 -92
  615. package/scripts/_dbg-acc-5-visual.mjs +0 -63
  616. package/scripts/_dbg-acc-5b-ws-town.mjs +0 -18
  617. package/scripts/_dbg-acc-5c-town.mjs +0 -12
  618. package/scripts/_dbg-acc-6-i18n.mjs +0 -19
  619. package/scripts/_dbg-agent-tools-audit.mjs +0 -154
  620. package/scripts/_dbg-agent-workflow-audit.mjs +0 -177
  621. package/scripts/_dbg-agents-dropdown-shot.py +0 -33
  622. package/scripts/_dbg-anim-verify.mjs +0 -81
  623. package/scripts/_dbg-app-shot.mjs +0 -48
  624. package/scripts/_dbg-autoframe.mjs +0 -103
  625. package/scripts/_dbg-availability-probe.ts +0 -11
  626. package/scripts/_dbg-beacon-final.mjs +0 -181
  627. package/scripts/_dbg-bind-bidi-e2e.mjs +0 -239
  628. package/scripts/_dbg-callout-near.mjs +0 -108
  629. package/scripts/_dbg-catalog-smoke.ts +0 -20
  630. package/scripts/_dbg-cf-line-shot.mjs +0 -18
  631. package/scripts/_dbg-chan-focus.mjs +0 -49
  632. package/scripts/_dbg-channel-plugin-ui.mjs +0 -94
  633. package/scripts/_dbg-cleanup.mjs +0 -31
  634. package/scripts/_dbg-closedloop-ui-shot.mjs +0 -61
  635. package/scripts/_dbg-codex-handshake.ts +0 -30
  636. package/scripts/_dbg-codex-probe.mjs +0 -58
  637. package/scripts/_dbg-codex-sandbox.ts +0 -58
  638. package/scripts/_dbg-codex-turn.ts +0 -65
  639. package/scripts/_dbg-collab-scenario-e2e.mjs +0 -185
  640. package/scripts/_dbg-config-smoke.ts +0 -28
  641. package/scripts/_dbg-console-audit.mjs +0 -61
  642. package/scripts/_dbg-console-probe.mjs +0 -23
  643. package/scripts/_dbg-context-inject-audit.mjs +0 -231
  644. package/scripts/_dbg-cpu-profile.mjs +0 -53
  645. package/scripts/_dbg-crash-recovery.mjs +0 -143
  646. package/scripts/_dbg-crop-shot.mjs +0 -16
  647. package/scripts/_dbg-cross-channel-e2e.mjs +0 -157
  648. package/scripts/_dbg-cross-team-visibility-e2e.mjs +0 -129
  649. package/scripts/_dbg-crush-probe.sh +0 -21
  650. package/scripts/_dbg-crush-spawn-probe.ts +0 -22
  651. package/scripts/_dbg-daq-acc-probe.mjs +0 -24
  652. package/scripts/_dbg-daq-attrib.mjs +0 -34
  653. package/scripts/_dbg-daq-bind-audit.mjs +0 -119
  654. package/scripts/_dbg-daq-cadence.mjs +0 -104
  655. package/scripts/_dbg-daq-debug.mjs +0 -22
  656. package/scripts/_dbg-daq-diag.mjs +0 -33
  657. package/scripts/_dbg-daq-e2e.mjs +0 -171
  658. package/scripts/_dbg-daq-film.mjs +0 -136
  659. package/scripts/_dbg-daq-filter-e2e.mjs +0 -109
  660. package/scripts/_dbg-daq-filter-e2e2.mjs +0 -62
  661. package/scripts/_dbg-daq-final-regression.mjs +0 -78
  662. package/scripts/_dbg-daq-frame-alarm.mjs +0 -49
  663. package/scripts/_dbg-daq-frame-ui.mjs +0 -62
  664. package/scripts/_dbg-daq-frame-ws.mjs +0 -72
  665. package/scripts/_dbg-daq-full-check.mjs +0 -179
  666. package/scripts/_dbg-daq-line-note-verify.mjs +0 -61
  667. package/scripts/_dbg-daq-linebanner-audit.mjs +0 -107
  668. package/scripts/_dbg-daq-pages-shot.mjs +0 -37
  669. package/scripts/_dbg-daq-perf.mjs +0 -61
  670. package/scripts/_dbg-daq-probe.mjs +0 -27
  671. package/scripts/_dbg-daq-recipe-e2e.mjs +0 -30
  672. package/scripts/_dbg-daq-redesign-shot.mjs +0 -88
  673. package/scripts/_dbg-daq-rows-probe.mjs +0 -26
  674. package/scripts/_dbg-daq-rowstate-e2e.mjs +0 -152
  675. package/scripts/_dbg-daq-rowstate-shot.mjs +0 -45
  676. package/scripts/_dbg-daq-rowstate-shot2.mjs +0 -38
  677. package/scripts/_dbg-daq-tpl.mjs +0 -144
  678. package/scripts/_dbg-dash-console-check.mjs +0 -49
  679. package/scripts/_dbg-dash-deep-probe.mjs +0 -61
  680. package/scripts/_dbg-dash-hitpoint.mjs +0 -44
  681. package/scripts/_dbg-dash-live-shot.mjs +0 -36
  682. package/scripts/_dbg-dash-shot.mjs +0 -21
  683. package/scripts/_dbg-dashboard-shot.mjs +0 -35
  684. package/scripts/_dbg-dcw-audit.mjs +0 -126
  685. package/scripts/_dbg-dcw-card-e2e.mjs +0 -108
  686. package/scripts/_dbg-dcw-channel-ui.mjs +0 -144
  687. package/scripts/_dbg-dcw-examples.mjs +0 -81
  688. package/scripts/_dbg-dcw-light-shot.mjs +0 -19
  689. package/scripts/_dbg-dcw-line-audit.mjs +0 -107
  690. package/scripts/_dbg-dcw-pause-tpl-audit.mjs +0 -161
  691. package/scripts/_dbg-dcw-pause-ui.mjs +0 -175
  692. package/scripts/_dbg-dcw-read-toolface.ts +0 -13
  693. package/scripts/_dbg-dcw-read-ui.mjs +0 -74
  694. package/scripts/_dbg-dcw-scene.mjs +0 -72
  695. package/scripts/_dbg-dcw-shot2.mjs +0 -14
  696. package/scripts/_dbg-dcw-twin-e2e.mjs +0 -192
  697. package/scripts/_dbg-diag-mock-loop.mjs +0 -89
  698. package/scripts/_dbg-diag-watch.mjs +0 -95
  699. package/scripts/_dbg-docs-site-shot.mjs +0 -32
  700. package/scripts/_dbg-dsh-probe.mjs +0 -31
  701. package/scripts/_dbg-dt-interact.mjs +0 -193
  702. package/scripts/_dbg-error-probe.mjs +0 -54
  703. package/scripts/_dbg-filter-light-verify.mjs +0 -54
  704. package/scripts/_dbg-final-acceptance-2.mjs +0 -72
  705. package/scripts/_dbg-final-acceptance.mjs +0 -192
  706. package/scripts/_dbg-final-agent-e2e.mjs +0 -151
  707. package/scripts/_dbg-final-features.mjs +0 -155
  708. package/scripts/_dbg-final-fixups.mjs +0 -62
  709. package/scripts/_dbg-final-full-e2e.mjs +0 -218
  710. package/scripts/_dbg-final-line-e2e.mjs +0 -173
  711. package/scripts/_dbg-final-shots.mjs +0 -32
  712. package/scripts/_dbg-final-t6-hitl.mjs +0 -38
  713. package/scripts/_dbg-final-visual.mjs +0 -29
  714. package/scripts/_dbg-fix-unused-imports.py +0 -41
  715. package/scripts/_dbg-focus-range.mjs +0 -115
  716. package/scripts/_dbg-fresh-scene-e2e.mjs +0 -125
  717. package/scripts/_dbg-fullchain-e2e.mjs +0 -178
  718. package/scripts/_dbg-gate-debug.mjs +0 -37
  719. package/scripts/_dbg-gif-encode.mjs +0 -111
  720. package/scripts/_dbg-gizmo.mjs +0 -95
  721. package/scripts/_dbg-glass-probe.mjs +0 -57
  722. package/scripts/_dbg-glass-shot.mjs +0 -50
  723. package/scripts/_dbg-glass-sweep.mjs +0 -25
  724. package/scripts/_dbg-glb-probe.mjs +0 -43
  725. package/scripts/_dbg-goose-probe.mjs +0 -33
  726. package/scripts/_dbg-goose-probe.sh +0 -10
  727. package/scripts/_dbg-hardening-probe.mjs +0 -90
  728. package/scripts/_dbg-harness-cancel-repro.mjs +0 -81
  729. package/scripts/_dbg-harness-ui-dbg.py +0 -49
  730. package/scripts/_dbg-harness-ui-shot.py +0 -109
  731. package/scripts/_dbg-hero-btn-probe.mjs +0 -21
  732. package/scripts/_dbg-hidden-check.mjs +0 -21
  733. package/scripts/_dbg-hmi-audit.mjs +0 -164
  734. package/scripts/_dbg-home-repro.mjs +0 -24
  735. package/scripts/_dbg-home-stack.mjs +0 -13
  736. package/scripts/_dbg-host.mjs +0 -16
  737. package/scripts/_dbg-huashu-survey.mjs +0 -31
  738. package/scripts/_dbg-huashu-survey2.mjs +0 -35
  739. package/scripts/_dbg-huashu-verify.mjs +0 -25
  740. package/scripts/_dbg-huashu-verify2.mjs +0 -26
  741. package/scripts/_dbg-hydration-detail.mjs +0 -18
  742. package/scripts/_dbg-i18n-debug.mjs +0 -27
  743. package/scripts/_dbg-i18n-debug2.mjs +0 -26
  744. package/scripts/_dbg-i18n-final.mjs +0 -42
  745. package/scripts/_dbg-i18n-scan.mjs +0 -38
  746. package/scripts/_dbg-infra-lifecycle.mjs +0 -44
  747. package/scripts/_dbg-interval-config.mjs +0 -156
  748. package/scripts/_dbg-interval-scenario.mjs +0 -126
  749. package/scripts/_dbg-kicker-check.mjs +0 -11
  750. package/scripts/_dbg-line-aura-shots.mjs +0 -54
  751. package/scripts/_dbg-line-control-e2e.mjs +0 -120
  752. package/scripts/_dbg-line-gate-audit.mjs +0 -108
  753. package/scripts/_dbg-line-live-e2e.mjs +0 -144
  754. package/scripts/_dbg-line-repo-test.ts +0 -10
  755. package/scripts/_dbg-line-scenario-e2e.mjs +0 -256
  756. package/scripts/_dbg-line-spawn.ts +0 -31
  757. package/scripts/_dbg-live-engine-probe.mjs +0 -80
  758. package/scripts/_dbg-login-debug.py +0 -23
  759. package/scripts/_dbg-login-e2e.mjs +0 -26
  760. package/scripts/_dbg-logs-ui-e2e.py +0 -126
  761. package/scripts/_dbg-mcp-bridge-probe.mjs +0 -147
  762. package/scripts/_dbg-modbus-latency.mjs +0 -22
  763. package/scripts/_dbg-mqtt-chain-e2e.mjs +0 -90
  764. package/scripts/_dbg-mqtt-publisher.mjs +0 -17
  765. package/scripts/_dbg-nav-rpg.mjs +0 -84
  766. package/scripts/_dbg-nav-shot.mjs +0 -28
  767. package/scripts/_dbg-nav.mjs +0 -27
  768. package/scripts/_dbg-oneshot-impl-probe.ts +0 -67
  769. package/scripts/_dbg-opencode-sse.mjs +0 -101
  770. package/scripts/_dbg-opencode-start.ts +0 -57
  771. package/scripts/_dbg-opslog-e2e.mjs +0 -121
  772. package/scripts/_dbg-opslog-shots.mjs +0 -62
  773. package/scripts/_dbg-optimization-e2e.mjs +0 -94
  774. package/scripts/_dbg-orbit.mjs +0 -58
  775. package/scripts/_dbg-overview-probe.sh +0 -31
  776. package/scripts/_dbg-panesplitter-fix-check.mjs +0 -62
  777. package/scripts/_dbg-perms-visual.mjs +0 -36
  778. package/scripts/_dbg-pg-tcp-probe.cjs +0 -27
  779. package/scripts/_dbg-phase-e3-monitor.mjs +0 -25
  780. package/scripts/_dbg-pi-spawn-probe.ts +0 -33
  781. package/scripts/_dbg-plc-agent-loop.ts +0 -102
  782. package/scripts/_dbg-plc-e2e.mjs +0 -171
  783. package/scripts/_dbg-plugin-agent-read.ts +0 -56
  784. package/scripts/_dbg-plugin-config-ui.mjs +0 -111
  785. package/scripts/_dbg-plugin-matrix.mjs +0 -212
  786. package/scripts/_dbg-plugin-panels-ui.mjs +0 -54
  787. package/scripts/_dbg-plugin-sink-rest.mjs +0 -70
  788. package/scripts/_dbg-plugin-sink-ui.mjs +0 -81
  789. package/scripts/_dbg-plugin-tools-inject.ts +0 -80
  790. package/scripts/_dbg-plugin-ui-wizard.mjs +0 -125
  791. package/scripts/_dbg-plugin-verify-e2e.mjs +0 -123
  792. package/scripts/_dbg-plugins-e2e.mjs +0 -101
  793. package/scripts/_dbg-pop-clamp-verify.mjs +0 -77
  794. package/scripts/_dbg-preset-e2e.mjs +0 -116
  795. package/scripts/_dbg-preview-console.mjs +0 -28
  796. package/scripts/_dbg-preview-minrepro.mjs +0 -156
  797. package/scripts/_dbg-preview-pixels.mjs +0 -93
  798. package/scripts/_dbg-prompts-hotreload-test.ts +0 -76
  799. package/scripts/_dbg-prompts-resolve-test.ts +0 -39
  800. package/scripts/_dbg-quality-pages-e2e.mjs +0 -84
  801. package/scripts/_dbg-query-cancel.ts +0 -12
  802. package/scripts/_dbg-qwen-acp-probe.mjs +0 -30
  803. package/scripts/_dbg-qwen-capture.mjs +0 -21
  804. package/scripts/_dbg-rail-tree-e2e.mjs +0 -183
  805. package/scripts/_dbg-real-driver-e2e.mjs +0 -55
  806. package/scripts/_dbg-redesign-shots.mjs +0 -34
  807. package/scripts/_dbg-registry-smoke.ts +0 -14
  808. package/scripts/_dbg-release-smoke.mjs +0 -104
  809. package/scripts/_dbg-repo-setup-verify.mjs +0 -31
  810. package/scripts/_dbg-resolve-probe.ts +0 -6
  811. package/scripts/_dbg-restart-persist.mjs +0 -41
  812. package/scripts/_dbg-retention-test.ts +0 -25
  813. package/scripts/_dbg-rollback-mgr-audit.mjs +0 -169
  814. package/scripts/_dbg-rpg.mjs +0 -71
  815. package/scripts/_dbg-sc001-dispatch.mjs +0 -63
  816. package/scripts/_dbg-scenario-final-shot.mjs +0 -24
  817. package/scripts/_dbg-scenario-phase-e2.mjs +0 -75
  818. package/scripts/_dbg-scenario-phase-e3.mjs +0 -96
  819. package/scripts/_dbg-scenario-phase1.mjs +0 -90
  820. package/scripts/_dbg-scenario-phase2.mjs +0 -105
  821. package/scripts/_dbg-scenario-phase3-monitor.mjs +0 -48
  822. package/scripts/_dbg-scenario-phase3.mjs +0 -111
  823. package/scripts/_dbg-scene-polish-shot.mjs +0 -118
  824. package/scripts/_dbg-selring-probe.mjs +0 -47
  825. package/scripts/_dbg-settings-draft-probe.mjs +0 -39
  826. package/scripts/_dbg-settings-probe.mjs +0 -33
  827. package/scripts/_dbg-setup-e2e.mjs +0 -88
  828. package/scripts/_dbg-sideinfo.mjs +0 -101
  829. package/scripts/_dbg-sim-keeper.mjs +0 -100
  830. package/scripts/_dbg-splitter.mjs +0 -88
  831. package/scripts/_dbg-swatch-check.mjs +0 -10
  832. package/scripts/_dbg-task-cancel-probe.mjs +0 -66
  833. package/scripts/_dbg-team-drill.mjs +0 -173
  834. package/scripts/_dbg-town-alarm-e2e.mjs +0 -40
  835. package/scripts/_dbg-town-beauty-shots.mjs +0 -54
  836. package/scripts/_dbg-town-daq-shot.mjs +0 -26
  837. package/scripts/_dbg-town-full-e2e.mjs +0 -104
  838. package/scripts/_dbg-town-gate.mjs +0 -44
  839. package/scripts/_dbg-town-ins-probe.mjs +0 -37
  840. package/scripts/_dbg-town-perf.mjs +0 -50
  841. package/scripts/_dbg-town-polish-shots.mjs +0 -82
  842. package/scripts/_dbg-town-realtime.mjs +0 -42
  843. package/scripts/_dbg-town-shot.py +0 -25
  844. package/scripts/_dbg-town-shot3.mjs +0 -17
  845. package/scripts/_dbg-town-truth.mjs +0 -37
  846. package/scripts/_dbg-town-truth2.mjs +0 -27
  847. package/scripts/_dbg-transform-audit.mjs +0 -98
  848. package/scripts/_dbg-trend-expand-test.mjs +0 -38
  849. package/scripts/_dbg-twindaq-focus.mjs +0 -81
  850. package/scripts/_dbg-ui-polish-shot.mjs +0 -43
  851. package/scripts/_dbg-ui-polish-verify1.mjs +0 -92
  852. package/scripts/_dbg-ui-polish-verify2.mjs +0 -50
  853. package/scripts/_dbg-ui-polish-verify3.mjs +0 -51
  854. package/scripts/_dbg-ui-polish-verify4.mjs +0 -50
  855. package/scripts/_dbg-ui-shot.mjs +0 -26
  856. package/scripts/_dbg-ui-shots.mjs +0 -28
  857. package/scripts/_dbg-ui-survey.py +0 -52
  858. package/scripts/_dbg-unify-shot.mjs +0 -43
  859. package/scripts/_dbg-uplink-probe.mjs +0 -36
  860. package/scripts/_dbg-wizard-preview-shot.mjs +0 -58
  861. package/scripts/_dbg-wizard-ui-e2e.mjs +0 -93
  862. package/scripts/_dbg-ws-probe.mjs +0 -86
  863. package/scripts/_dbg-ws-shot2.mjs +0 -23
  864. package/scripts/_dbg-wsdot-sanity.mjs +0 -25
  865. package/scripts/_dev-stack.mjs +0 -46
  866. package/scripts/_http-driver-probe.mjs +0 -30
  867. package/scripts/_mqtt-driver-probe.mjs +0 -30
  868. package/scripts/_newdriver-rest-probe.mjs +0 -100
  869. package/scripts/_node-state-probe.mjs +0 -5
  870. package/scripts/_opcua-driver-probe.mjs +0 -31
  871. package/scripts/_rtu-debug.mjs +0 -41
  872. package/scripts/_rtu-direct.mjs +0 -6
  873. package/scripts/_rtu-driver-probe.mjs +0 -53
  874. package/scripts/_spike-pitui.mjs +0 -116
  875. package/scripts/_tmp-args-probe.mjs +0 -20
  876. package/scripts/_tmp-cyc-entry.mjs +0 -8
  877. package/scripts/_tmp-cyc-main.mjs +0 -5
  878. package/scripts/_tmp-cyc-mod.mjs +0 -2
  879. package/scripts/_tmp-cycle-a.mjs +0 -6
  880. package/scripts/_tmp-cycle-b.mjs +0 -2
  881. package/scripts/_tmp-cycle-probe.mjs +0 -4
  882. package/scripts/_tmp-entry-variant.mjs +0 -2
  883. package/scripts/_tmp-help-probe.mjs +0 -19
  884. package/scripts/_tmp-help-probe2.mjs +0 -2
  885. package/scripts/_tmp-trace-preload.mjs +0 -1
  886. package/scripts/_wizard-shots.mjs +0 -90
  887. package/scripts/acceptance-suite.py +0 -207
  888. package/scripts/aml-agent-bridge.ts +0 -230
  889. package/scripts/aml-industrial-loop.ts +0 -232
  890. package/scripts/build-film-devices.mjs +0 -227
  891. package/scripts/collab-live-test.py +0 -177
  892. package/scripts/debug-mcp-http.ts +0 -64
  893. package/scripts/demo-lead-worker.ts +0 -256
  894. package/scripts/demo-modes.ts +0 -415
  895. package/scripts/demo-omp-channel.ts +0 -135
  896. package/scripts/design-preflight.mjs +0 -223
  897. package/scripts/design-verify-templates.mjs +0 -110
  898. package/scripts/design-verify.mjs +0 -170
  899. package/scripts/dev-window.cmd +0 -6
  900. package/scripts/device-line-restore.mjs +0 -34
  901. package/scripts/diag-lead-status.ts +0 -101
  902. package/scripts/e2e-a2a-steer-live.mjs +0 -193
  903. package/scripts/e2e-dual-drive-comm.ts +0 -259
  904. package/scripts/e2e-full-scenario.ts +0 -321
  905. package/scripts/e2e-harness-consistency.ts +0 -204
  906. package/scripts/e2e-harness-provider-task.mjs +0 -126
  907. package/scripts/e2e-line-live.mjs +0 -144
  908. package/scripts/e2e-memory-persistence.ts +0 -320
  909. package/scripts/e2e-omp-modes.ts +0 -274
  910. package/scripts/e2e-omp-realtime.ts +0 -258
  911. package/scripts/e2e-plc-scenario.mjs +0 -292
  912. package/scripts/e2e-real-scenario.mjs +0 -466
  913. package/scripts/e2e-tab-close.mjs +0 -136
  914. package/scripts/e2e-token-ui.mjs +0 -149
  915. package/scripts/final-soup-run.py +0 -192
  916. package/scripts/final-soup-watch.py +0 -83
  917. package/scripts/i18n-codemod.mjs +0 -173
  918. package/scripts/i18n-fix-en.py +0 -28
  919. package/scripts/i18n-fix-en2.py +0 -31
  920. package/scripts/i18n-merge.mjs +0 -191
  921. package/scripts/migrate-local-time.mjs +0 -123
  922. package/scripts/omp-real-test.py +0 -328
  923. package/scripts/team-plugins-api-smoke.mjs +0 -149
  924. package/scripts/test-a2a-relay.mjs +0 -222
  925. package/scripts/test-aml-integration.ts +0 -159
  926. package/scripts/test-aml-job.ts +0 -174
  927. package/scripts/test-aml-unit.ts +0 -184
  928. package/scripts/test-api-client.ts +0 -108
  929. package/scripts/test-api-suite.mjs +0 -271
  930. package/scripts/test-block-consumption.mjs +0 -194
  931. package/scripts/test-cmd-render.mjs +0 -218
  932. package/scripts/test-collab-omp.mjs +0 -192
  933. package/scripts/test-config-precedence.ts +0 -124
  934. package/scripts/test-context-governor.ts +0 -176
  935. package/scripts/test-daq-frames.ts +0 -180
  936. package/scripts/test-daq-minio.ts +0 -77
  937. package/scripts/test-dedup-logic.ts +0 -132
  938. package/scripts/test-e2e-collaboration.ts +0 -262
  939. package/scripts/test-e2e-monitor.ts +0 -192
  940. package/scripts/test-event-history.ts +0 -112
  941. package/scripts/test-exec-modes.ts +0 -316
  942. package/scripts/test-fifo-realtime.mjs +0 -193
  943. package/scripts/test-final-e2e.mjs +0 -290
  944. package/scripts/test-goal-summary.ts +0 -202
  945. package/scripts/test-harness-liveness.ts +0 -109
  946. package/scripts/test-harness-terminal.ts +0 -164
  947. package/scripts/test-header-trail.mjs +0 -95
  948. package/scripts/test-hitl.ts +0 -360
  949. package/scripts/test-koda-restyle.mjs +0 -105
  950. package/scripts/test-lane-raw.ts +0 -67
  951. package/scripts/test-lanes-history-render.mjs +0 -138
  952. package/scripts/test-loop-omp.mjs +0 -154
  953. package/scripts/test-mdlite.ts +0 -53
  954. package/scripts/test-memory-brief-chronicle.ts +0 -180
  955. package/scripts/test-memory-rrf-mmr.ts +0 -114
  956. package/scripts/test-mock-collab.mjs +0 -226
  957. package/scripts/test-modern-render.mjs +0 -174
  958. package/scripts/test-omp-terminal.mjs +0 -187
  959. package/scripts/test-plugin-ext.ts +0 -173
  960. package/scripts/test-prompts-loader.ts +0 -56
  961. package/scripts/test-real-scenario.mjs +0 -290
  962. package/scripts/test-stream-render.ts +0 -37
  963. package/scripts/test-task-drawer.mjs +0 -204
  964. package/scripts/test-task-invariants.mjs +0 -169
  965. package/scripts/test-town-3d.mjs +0 -121
  966. package/scripts/test-town-layout.mjs +0 -200
  967. package/scripts/test-town-page.mjs +0 -136
  968. package/scripts/test-town-scene-math.ts +0 -169
  969. package/scripts/test-town-twin.mjs +0 -121
  970. package/scripts/test-town-upload.mjs +0 -89
  971. package/scripts/test-town-user-flow.mjs +0 -619
  972. package/scripts/test-town-world.mjs +0 -76
  973. package/scripts/test-town-wuwa.mjs +0 -198
  974. package/scripts/test-user-isolation.mjs +0 -193
  975. package/scripts/test-workshop-entries.ts +0 -370
  976. package/scripts/test-workspace-api.ts +0 -329
  977. package/scripts/test-ws-aep.mjs +0 -187
  978. package/scripts/test-ws-protocol.ts +0 -134
  979. package/scripts/town-demo-seed.mjs +0 -75
  980. package/scripts/town-scene-clear.mjs +0 -56
  981. package/scripts/verify-exec-modes-report.ts +0 -248
  982. package/scripts/verify-lead-mail.ts +0 -188
  983. package/scripts/verify-page-smoke.mjs +0 -87
  984. package/scripts/ws-test.mjs +0 -176
  985. package/scripts/ws-test.py +0 -4
package/docs/sdk.en.md ADDED
@@ -0,0 +1,922 @@
1
+ # AgentWorkShop SDK Development and Usage Guide
2
+
3
+ > The SDK is AgentWorkShop's **programming client and extension base**: external projects
4
+ > consume the platform REST surface through it, and plugins receive the host-injected
5
+ > runtime context through it (hooks / config / storage / timers / platform API / event stream).
6
+ > Zero third-party runtime dependencies; works on Node ≥ 23.4 and modern browsers.
7
+
8
+ **SDK version constants**: server-side `SDK_VERSION = '0.3.0'`, browser-side `CLIENT_SDK_VERSION = '0.3.0'`.
9
+ These two constants are the **interface version of the SDK itself** and evolve **independently**
10
+ from the npm package version (the `version` field in `package.json`, currently 0.7.38) —
11
+ them being out of sync is expected. Never use `SDK_VERSION` to infer the package version, or the reverse.
12
+ **Module format**: ESM only (only `import` / `export`; there is no CJS entry).
13
+ **Types**: `sdk/index.d.mts` and `sdk/client.d.mts` ship with the package, so TypeScript projects
14
+ get IntelliSense with zero configuration (coverage is described in §7).
15
+
16
+ ---
17
+
18
+ ## 1. Getting the SDK
19
+
20
+ ### 1.1 Global install (includes the CLI and the platform itself)
21
+
22
+ ```bash
23
+ npm install -g agentworkshop
24
+ ```
25
+
26
+ The SDK lives inside the global package at `$(npm prefix -g)/node_modules/agentworkshop/sdk/`.
27
+ Plugins **need not and should not** import it directly (see the host-injection model in §2);
28
+ it serves two audiences:
29
+
30
+ - **External integration**: embed AgentWorkShop's line / DAQ / write-control / device-twin
31
+ capabilities into your own node service;
32
+ - **Plugin development** (TypeScript): import types only for full IntelliSense — the runtime
33
+ is injected by the host.
34
+
35
+ ### 1.2 Project dependency (recommended for integrators)
36
+
37
+ ```bash
38
+ npm install agentworkshop # as a dependency (full SDK and types)
39
+ ```
40
+
41
+ ### 1.3 Import paths
42
+
43
+ `package.json` exposes exactly four `exports` entries:
44
+
45
+ | Import | Resolves to | Contents |
46
+ |---|---|---|
47
+ | `agentworkshop` | `sdk/index.mjs` | **Exactly the same facade** as `agentworkshop/sdk` (the root specifier was previously undocumented; it works) |
48
+ | `agentworkshop/sdk` | `sdk/index.mjs` | The whole facade (server + browser + platform REST client + types) |
49
+ | `agentworkshop/sdk/client` | `sdk/client.mjs` | Browser only (`createClientContext`) |
50
+ | `agentworkshop/package.json` | `package.json` | Package metadata |
51
+
52
+ **Deep paths are not importable**: paths such as `agentworkshop/sdk/api.mjs` or
53
+ `agentworkshop/sdk/hooks.mjs` do not appear in `exports`, and Node throws
54
+ `ERR_PACKAGE_PATH_NOT_EXPORTED`. Take every symbol from one of the three entry points above.
55
+
56
+ ```js
57
+ import { createPlatformClient, definePlugin, HookBus } from 'agentworkshop/sdk'
58
+ import { createClientContext } from 'agentworkshop/sdk/client' // browser only
59
+ ```
60
+
61
+ ### 1.4 Named export list
62
+
63
+ | Entry | Named exports |
64
+ |---|---|
65
+ | `agentworkshop/sdk` (equivalent to `agentworkshop`) | `SDK_VERSION`, `definePlugin`, `createPluginContext`, `createRouteTable`, `validatePluginModule`, `validatePluginSettings`, `validatePluginGroups`, `resolvePluginGroupId`, `pluginKvExists`, `isPathInside`, `HookBus`, `createPlatformClient`, `CLIENT_SDK_VERSION`, `createClientContext`, `LIFECYCLE_EVENTS`, `CLIENT_EVENTS` |
66
+ | `agentworkshop/sdk/client` | `CLIENT_SDK_VERSION`, `createClientContext` |
67
+
68
+ ### 1.5 The remaining named exports
69
+
70
+ Plugin authors normally work with the host-injected `ctx` (§4); the symbols below serve host
71
+ assembly, scaffolding and validation tooling.
72
+
73
+ | Symbol | Signature | Purpose |
74
+ |---|---|---|
75
+ | `createPluginContext(opts)` | `opts` is the host assembly object | Called by the host to build `ctx`; plugin authors never call it themselves |
76
+ | `createRouteTable()` | → `{ register, resolve, byPlugin, unregisterPlugin, size }` | Host route table: exact match, mounted at `/api/plugins/<name><path>` |
77
+ | `definePlugin(def)` | `def` → `def` | Type sugar plus shape validation; throws on an invalid definition. The host also accepts a bare object export |
78
+ | `validatePluginModule(mod, source)` | → `{ ok, def?, error? }` | Pre-load entry check (`name` required, `setup` must be a function, `client` must be a string, `settings` must be an array) |
79
+ | `validatePluginSettings(pluginName, defs)` | → `{ descriptors, errors }` | Validate and normalize setting declarations; rules in §4.9 |
80
+ | `validatePluginGroups(pluginName, defs)` | → `{ groups, errors }` | Validate and normalize config-group declarations |
81
+ | `resolvePluginGroupId(pluginName, declaredId)` | → `string` | Fold a declared group name into the `plugin-<name>[-<suffix>]` namespace |
82
+ | `pluginKvExists(dataDir, name)` | → `boolean` | Probe whether `<dataDir>/plugins/<name>/kv.json` exists |
83
+ | `isPathInside(dir, p)` | → `boolean` | Path containment test (uses `relative()`, so a sibling directory with the same prefix such as `…/foo-evil` cannot fool it) |
84
+ | `HookBus` | `class` | The hook bus implementation; the host owns one shared instance and plugins receive a scoped facade (§4.1) |
85
+ | `LIFECYCLE_EVENTS` | frozen array (11 items) | Authoritative server-side event list (§5) |
86
+ | `CLIENT_EVENTS` | frozen array (5 items) | Authoritative browser-side event list (§5) |
87
+
88
+ ---
89
+
90
+ ## 2. Core model: two identities, one SDK
91
+
92
+ | Identity | Form | Role of the SDK |
93
+ |---|---|---|
94
+ | **External integrator** | regular dependency | call `createPlatformClient()` to consume the platform REST surface |
95
+ | **Plugin author** | exports `{ name, setup(ctx) }` | `ctx` is the host-injected SDK context — **zero imports**, the SDK runtime is provided by the host |
96
+
97
+ > Why don't plugins import the SDK directly? Globally installed plugin directories
98
+ > (`~/.AgentWorkShop/plugins/`) are outside the node_modules resolution chain, so host
99
+ > injection is the only zero-pitfall shape (the same paradigm as VSCode's `activate(context)`).
100
+
101
+ A plugin entry is an ordinary ESM module:
102
+
103
+ ```js
104
+ export default {
105
+ name: 'my-plugin',
106
+ version: '1.0.0',
107
+ description: 'Example plugin',
108
+ auth: 'none', // declarative auth for plugin routes, see §4.4
109
+ client: './client.mjs', // browser entry (optional), see §6
110
+ async setup(ctx) {
111
+ ctx.logger.info('loaded, directory:', ctx.dir)
112
+ },
113
+ }
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 3. Platform REST client `createPlatformClient`
119
+
120
+ The SDK fronts the platform as a "project service client": it attaches the Bearer token,
121
+ unwraps the unified envelope `{ code, message, data } → data`, and throws according to the
122
+ rules below.
123
+
124
+ ### 3.1 Creating a client
125
+
126
+ ```js
127
+ import { createPlatformClient } from 'agentworkshop/sdk'
128
+
129
+ const api = createPlatformClient({
130
+ baseUrl: 'http://127.0.0.1:3001', // defaults to '' (same-origin relative); integrators pass the platform address
131
+ token: '<bearer-token>', // optional; api.setToken() swaps it later
132
+ timeoutMs: 10_000, // optional; per-request timeout (AbortSignal), default 10 000
133
+ logger, // optional; warns when a request fails
134
+ })
135
+ ```
136
+
137
+ - `baseUrl` defaults to `''`, i.e. same-origin relative paths; it **may also be a function**
138
+ evaluated lazily on every request (the host's listening port is only known once the server
139
+ actually listens, so the host passes `() => origin`).
140
+ - A trailing `/` is stripped: `'http://host:3001/'` and `'http://host:3001'` are equivalent.
141
+
142
+ ### 3.2 Envelope and error semantics (three paths — do not mix them up)
143
+
144
+ | Case | Behaviour |
145
+ |---|---|
146
+ | HTTP non-2xx | throws an `Error` carrying **only `err.status` and `err.body`**; this path **does not set `err.code`** |
147
+ | HTTP 200 but envelope `code !== 0` | throws an `Error` carrying `err.status`, `err.code` **and** `err.body` |
148
+ | Success | returns the unwrapped `data`; a body with no `code`/`data` envelope is returned **as-is** (for example `GET /api/workshop/plugins`, `GET /api/plugins/manifest`) |
149
+
150
+ ```js
151
+ try {
152
+ await api.daqNodes.get('no-such-node')
153
+ }
154
+ catch (err) {
155
+ err.status // 404
156
+ err.body // { code: 'NOT_FOUND', message: '…', data: null }
157
+ err.code // undefined —— this path does not set code
158
+ }
159
+ ```
160
+
161
+ > On the platform side `defineApiHandler` sets a non-2xx status for business errors, so in
162
+ > practice you almost always hit the first path. The second path is a defensive check inside
163
+ > the SDK (`sdk/api.mjs` inspects `code` before unwrapping) aimed at endpoints that do not go
164
+ > through the unified wrapper yet still return an error envelope under HTTP 200 — without that
165
+ > check a plugin would unwrap the error envelope to `null` and treat it as success.
166
+
167
+ ### 3.3 Generic calls (any platform path)
168
+
169
+ | Method | Signature | Notes |
170
+ |---|---|---|
171
+ | `api.call(method, path, body?, opt?)` | low level | `opt` may carry `{ timeoutMs, headers }`; returns the unwrapped `data` |
172
+ | `api.get(path, query?)` | query object serialized automatically | `api.get('/api/workshop/dcw', { page: 1 })` |
173
+ | `api.post(path, body?)` | JSON-serialized | |
174
+ | `api.patch(path, body?)` | | |
175
+ | `api.delete(path)` | | |
176
+ | `api.setToken(token)` | chainable, returns `api` | `api.setToken(res.token)` after login; pass `null` to clear |
177
+ | `api.ping()` | `GET /api/plugins/manifest` | liveness probe (unauthenticated) |
178
+
179
+ `toQuery` **drops `undefined`, `null` and empty-string** values, so
180
+ `api.get('/x', { lineId: undefined })` never produces `?lineId=undefined`.
181
+
182
+ ### 3.4 Resource surfaces and their real base paths
183
+
184
+ Every resource is built by the internal `resource(root)` helper, so **all of them expose five
185
+ methods**: `list(query?)`, `get(id)`, `create(body)`, `update(id, patch)`, `remove(id)`.
186
+ "A method exists" does not mean "the server route exists" — real availability is in §3.5.
187
+
188
+ | Namespace | Base path | Extra methods |
189
+ |---|---|---|
190
+ | `api.users` | `/api/users` | `login(email, password)` → `{ user, token }`; `me()` |
191
+ | `api.lines` | `/api/workshop/dcw/lines` | `start(id, recipeId = '')`; `stop(id)` |
192
+ | `api.products` | `/api/workshop/dcw/products` | — |
193
+ | `api.recipes` | `/api/workshop/dcw/recipes` | — |
194
+ | `api.dcwNodes` | `/api/workshop/dcw` | — |
195
+ | `api.daqNodes` | `/api/workshop/daq` | `alarms()` → `GET /api/workshop/daq/alarms` |
196
+ | `api.templates` | — | `daq()` / `dcw()`: read `.templates` off the two list responses |
197
+ | `api.twins` | `/api/workshop/device-twins` | — |
198
+ | `api.teams` | `/api/workshop/teams` | — |
199
+ | `api.agents` | `/api/workshop/agents` | — |
200
+ | `api.channels` | `/api/workshop/channels` | — |
201
+ | `api.permissions` | — | `overview()` → `GET /api/workshop/permissions`; `set({ userId, grants })` → `PUT /api/workshop/permissions` (admin) |
202
+ | `api.plugins` | — | `manifest()` |
203
+
204
+ The payload shape for `api.permissions.set`:
205
+
206
+ ```json
207
+ { "userId": "<user id>", "grants": [{ "lineId": "<line id>", "mode": "readonly" }] }
208
+ ```
209
+
210
+ `mode` is `'readonly'`, `'operate'` or `null` (passing `null` revokes that grant).
211
+
212
+ ### 3.5 Real route support
213
+
214
+ `resource(root)` always generates five methods, but only some server route files exist.
215
+ **The table below is the result of checking every route file**: "no" means the call targets a
216
+ path that does not exist and therefore 404s.
217
+
218
+ | Namespace | `list` | `get(id)` | `create` | `update(id)` | `remove(id)` | Notes |
219
+ |---|---|---|---|---|---|---|
220
+ | `users` | yes | yes | yes | **no** | yes | The server only has `PUT /api/users/:id`, while `update()` sends `PATCH`; to update a user call `api.call('PUT', '/api/users/' + id, patch)` directly. `list`/`get`/`create` all require admin |
221
+ | `lines` | yes | no | yes | yes | yes | Plus `start` / `stop`. `create` requires the `admin` or `editor` role |
222
+ | `products` | **no** | no | yes | yes | yes | There is no `GET /api/workshop/dcw/products`; read the product list from `.products` of `GET /api/workshop/dcw` (see §3.6) |
223
+ | `recipes` | yes | no | yes | yes | yes | `list()` returns `{ recipes, runs }`; there is no route for `recipes.get(id)` |
224
+ | `dcwNodes` | yes | no | yes | yes | yes | No `[id].get.ts`; read the node list from `.nodes` of `GET /api/workshop/dcw` |
225
+ | `daqNodes` | yes | no | yes | yes | yes | No `[id].get.ts`; `alarms()` works |
226
+ | `twins` | yes | no | yes | yes | yes | No `[id].get.ts` |
227
+ | `teams` | yes | yes | yes | yes | yes | Full CRUD |
228
+ | `agents` | yes | yes | yes | yes | yes | Full CRUD |
229
+ | `channels` | yes | yes | yes | yes | yes | Full CRUD |
230
+ | `permissions` | `overview()` only | — | — | — | — | No five-method `resource()`; only `overview()` and `set()` |
231
+ | `plugins` | `manifest()` only | — | — | — | — | Unauthenticated |
232
+
233
+ Authentication and timeouts:
234
+
235
+ - Business read endpoints such as `api.lines.list()`, `api.daqNodes.list()` and
236
+ `api.dcwNodes.list()` go through platform auth and need a user token (`api.setToken(...)`,
237
+ or the cookie in a browser);
238
+ - `api.plugins.manifest()` and `api.ping()` are unauthenticated — the only two endpoints you
239
+ can call without a token.
240
+
241
+ ### 3.6 Response shapes at a glance
242
+
243
+ **A list does not necessarily return an array** — this is the easiest trap in the whole SDK.
244
+ Every row below was checked against the server handler.
245
+
246
+ | Call | Real response |
247
+ |---|---|
248
+ | `api.lines.list()` | `{ lines, states }` (**not an array**) |
249
+ | `api.daqNodes.list()` | `{ controller, nodes, meta, driverAvailable, infra, templates }` |
250
+ | `api.dcwNodes.list()` | a multi-key object (`controller` / `nodes` / `templates` / `recipes` / `runs` / `history` / `products` / `lines` …), **not a node array** |
251
+ | `api.recipes.list()` | `{ recipes, runs }` |
252
+ | `api.twins.list()` | `{ twins }` |
253
+ | `api.daqNodes.alarms()` | `{ alarms }` |
254
+ | `api.permissions.overview()` | `{ lines, users }` |
255
+ | `api.templates.daq()` / `api.templates.dcw()` | an array (`.templates ?? []`) |
256
+ | `api.teams.list()` / `api.agents.list()` / `api.channels.list()` | an array |
257
+ | `api.users.list()` | `{ items, total, page, pageSize }` |
258
+ | `api.plugins.manifest()` | `{ plugins }` (no envelope, returned as-is) |
259
+ | `api.lines.create(body)` | `{ line }` |
260
+ | `api.recipes.create(body)` | `{ recipe }` |
261
+ | `api.products.create(body)` | `{ product }` |
262
+ | `api.dcwNodes.create(body)` / `api.daqNodes.create(body)` | `{ node }` |
263
+ | `api.twins.create(body)` | `{ twin }` |
264
+ | `api.lines.start(id, recipeId)` | `{ run, line }` |
265
+ | `api.users.login(email, password)` | `{ user, token }` |
266
+
267
+ About `api.daqNodes.list({ lineId })`: the `{ lineId }` query argument **is not read by that
268
+ handler**. Line filtering happens server-side from the caller's permissions (a regular user
269
+ only sees nodes of granted lines). Do not present it as a working client-side filter.
270
+
271
+ About `api.lines.start(id, recipeId)`: `recipeId` defaults to an empty string, but the server
272
+ **requires a recipe that actually exists** (an empty string or an unknown id yields
273
+ 404 `Recipe 不存在`). When a line has recipes, `recipeId` is effectively mandatory.
274
+
275
+ ### 3.7 Full example: external integration
276
+
277
+ ```js
278
+ import { createPlatformClient } from 'agentworkshop/sdk'
279
+
280
+ const api = createPlatformClient({ baseUrl: 'http://plant.local:3001' })
281
+
282
+ const { token } = await api.users.login('you@example.com', 'secret')
283
+ api.setToken(token)
284
+
285
+ // 1) Line list: { lines, states } —— not an array
286
+ const { lines, states } = await api.lines.list()
287
+ console.log(`${lines.length} lines`)
288
+ for (const l of lines) {
289
+ console.log(` ${l.name} → ${states.find(s => s.lineId === l.id)?.state ?? 'unknown'}`)
290
+ }
291
+
292
+ // 2) DAQ surface: { controller, nodes, meta, driverAvailable, infra, templates }
293
+ const { nodes } = await api.daqNodes.list()
294
+ console.log(`${nodes.length} DAQ nodes, ${nodes.filter(n => n.state === 'offline').length} offline`)
295
+
296
+ // 3) Write-control surface: the node list is an object too; products come from .products
297
+ const dcw = await api.dcwNodes.list()
298
+ console.log(`${dcw.nodes.length} DCW nodes, ${dcw.products.length} products`)
299
+
300
+ // 4) Recipe surface: { recipes, runs }
301
+ const { recipes } = await api.recipes.list()
302
+
303
+ // 5) Starting a line: recipeId must be a real recipe of that line (an empty string is rejected)
304
+ const line = lines[0]
305
+ const recipe = recipes.find(r => r.lineId === line?.id)
306
+ if (line && recipe) {
307
+ await api.lines.start(line.id, recipe.id)
308
+ await api.lines.stop(line.id)
309
+ }
310
+
311
+ // 6) Line grants (admin): overview() reads everything, set() writes in bulk
312
+ const { users } = await api.permissions.overview()
313
+ const target = users[0]
314
+ if (target && line) {
315
+ await api.permissions.set({ userId: target.id, grants: [{ lineId: line.id, mode: 'readonly' }] })
316
+ }
317
+ ```
318
+
319
+ ---
320
+
321
+ ## 4. Plugin context `ctx` (the complete member surface)
322
+
323
+ The `ctx` handed to `setup(ctx)` is the host-assembled SDK runtime. **The table below is the
324
+ complete surface**; the last three rows (`ctx.daq` / `ctx.omp` / `ctx.services`) are attached
325
+ directly by the plugin host before `setup` runs and are not part of `sdk/context.mjs`.
326
+
327
+ | Group | Member | Type | Notes |
328
+ |---|---|---|---|
329
+ | Identity | `ctx.name` | `string` | plugin name (= directory name / declared name) |
330
+ | | `ctx.scope` | `'builtin' \| 'project' \| 'user'` | load scope; on a name clash the priority is builtin > project > user |
331
+ | | `ctx.dir` | `string` | absolute path of the plugin directory |
332
+ | | `ctx.sdkVersion` | `string` | SDK interface version (= `SDK_VERSION`) |
333
+ | Hooks | `ctx.hooks` | `{ on, once, off, emit }` | per-plugin scoped hook facade (§4.1); **not a `HookBus` instance and has no `.size`** |
334
+ | Logging | `ctx.logger` | `{ debug, info, warn, error }` | output is prefixed `[aw-plugins] [<plugin name>]` |
335
+ | Config | `ctx.config.get(key)` | any | effective value (after the four-layer merge) |
336
+ | | `ctx.config.all()` | `Record<string, any>` | shallow copy of every effective setting |
337
+ | | `ctx.config.onChange(fn)` | unsubscribe function | subscribes to `config:changed` (§4.5) |
338
+ | | `ctx.config.defineGroup(def)` | group object \| `null` | declare a plugin-owned config group (§4.9) |
339
+ | | `ctx.config.defineField(decl)` | descriptor \| `null` | declare a setting field (key auto-addressed as `plugins.<name>.<key>`) |
340
+ | | `ctx.config.removeGroup(id)` | `boolean` | remove a group declaration |
341
+ | | `ctx.config.removeField(key)` | `boolean` | remove a field declaration |
342
+ | | `ctx.config.groups()` / `fields()` | arrays | the groups / fields this plugin currently has registered (read-only snapshot) |
343
+ | Paths | `ctx.paths` | `{ home, configRoot, dataDir }` | config-root information (home mode = `~/.AgentWorkShop`) |
344
+ | | `ctx.dataDir` | `string` | this plugin's private data directory = `<paths.dataDir>/plugins/<name>` |
345
+ | Storage | `ctx.kv` | `{ get, set, all, bump }` | plugin-private KV (§4.2); **there is no `reset()`** |
346
+ | Timers | `ctx.timer.setInterval(fn, ms)` / `setTimeout(fn, ms)` | timer id | auto `unref` + auto-collected on shutdown / hot reload (§4.3) |
347
+ | Cleanup | `ctx.onDispose(fn)` | the `fn` you passed | register a cleanup callback (§4.3) |
348
+ | | `ctx.subscriptions.add(d)` | the `d` you passed | register a `{ dispose() }` object or a function; same collection queue as `onDispose` |
349
+ | Routes | `ctx.route(method, path, handler)` | `boolean` | mounts at `/api/plugins/<name><path>`; auth is declared by the plugin's `auth` field (§4.4) |
350
+ | Platform | `ctx.api` | `PlatformClient` | loopback REST client (**no token by default**; §4.6) |
351
+ | Network | `ctx.http.get(url, opts)` / `post(url, body, opts)` | `Promise<Response>` | outbound requests; the guard is protocol-only; 8 s default timeout (§4.6) |
352
+ | Events | `ctx.events.on(type, fn)` / `off(type, fn)` | unsubscribe function | live scene event subscription; the `event:` prefix is added for you (§4.6) |
353
+ | Line permissions (host-injected) | `ctx.permissions` | see §4.7 | query and manage the per-user, per-line three-state grants |
354
+ | DAQ extension (host-injected) | `ctx.daq` | see §4.8 | driver / processor / template registration + frame subscription + time-series queries |
355
+ | Agent tools (host-injected) | `ctx.omp.registerTool(tool)` | see §4.8 | hot-inject a custom host tool at runtime |
356
+ | Runtime services (host-injected) | `ctx.services` | see §4.8 | lazy service access + cross-plugin service provision |
357
+
358
+ `ctx` has **no** `ctx.routes`, `ctx.dcw`, `ctx.scene` or `ctx.version`: route registration is
359
+ the singular `ctx.route()`; write-control traffic is observed through the `dcw:write` hook;
360
+ scene events go through `ctx.events`.
361
+
362
+ ### 4.1 `ctx.hooks` — the hook facade
363
+
364
+ The host owns one shared `HookBus` named `aw-plugins`; a plugin receives a **scoped facade
365
+ exposing only `on` / `once` / `off` / `emit`**. Listeners registered through it are tracked and
366
+ auto-unbound when the plugin hot-reloads (the one cleanup path that always worked).
367
+ The facade exposes no diagnostic properties such as `count` / `size` / `listeners`.
368
+
369
+ ```js
370
+ function onSample(sample) {
371
+ ctx.kv.bump('samples')
372
+ }
373
+
374
+ const off = ctx.hooks.on('daq:sample', onSample) // returns an unsubscribe function
375
+ ctx.hooks.once('server:close', () => { /* teardown, fires once */ })
376
+ ctx.hooks.off('daq:sample', onSample) // manual unbind: pass the original handler
377
+ off() // or just call the function returned by on()
378
+
379
+ await ctx.hooks.emit('my-plugin:custom', { hello: 1 }) // inter-plugin messaging: other plugins can listen
380
+ ctx.hooks.on('*', ({ type, payload }) => { /* every event */ })
381
+ ```
382
+
383
+ Semantics (matching `sdk/hooks.mjs`):
384
+
385
+ - **Async-serial**: listeners of one type run in registration order and are awaited; the next
386
+ one does not start until the previous returns;
387
+ - **Error isolation**: one throwing listener is only counted and warned about; siblings and the
388
+ main service are unaffected;
389
+ - **Circuit breaker**: a listener failing **8 times in a row** is removed automatically;
390
+ **any single success resets the counter**, so occasional failures never accumulate into an eviction;
391
+ - **Wildcard**: the only server-side wildcard spelling is the bare `'*'`; its callback receives
392
+ `{ type, payload }` and runs after the named listeners;
393
+ - **The return value is fan-out, not a waterfall**: every listener receives **the same unmodified
394
+ payload**; `emit()` merely returns "the last non-`undefined` return value" — values are never
395
+ threaded from one listener to the next;
396
+ - **v1 is observation-only**: there is no veto / interception / rewriting.
397
+
398
+ > `ctx.hooks.on('event:*')` never fires. `event:*` is the subscription entry name the list uses
399
+ > for scene events; the real wildcard is the bare `'*'`, and the ergonomic scene-event form is
400
+ > `ctx.events.on('<type>', fn)` (§4.6).
401
+
402
+ ### 4.2 `ctx.kv` — plugin-private persistence
403
+
404
+ ```js
405
+ ctx.kv.set('threshold', 100)
406
+ ctx.kv.bump('samples') // atomic increment, +1 by default; bump(key, by) sets the step
407
+ ctx.kv.bump('samples', 5)
408
+ ctx.kv.get('threshold') // 100
409
+ ctx.kv.all() // { samples: 19453, threshold: 100, ... }
410
+ ```
411
+
412
+ - **These four methods only**: `get` / `set` / `all` / `bump`. **No `reset()`, no `delete()`,
413
+ no `keys()`**; to clear a key, `set` it explicitly or switch to a new key.
414
+ - On-disk location: `<ctx.dataDir>/kv.json`, i.e. `<paths.dataDir>/plugins/<name>/kv.json`.
415
+ - **In-memory state is authoritative + a 200 ms debounced atomic write** (temp file plus
416
+ `rename`), so a high-frequency hook (`daq:sample`) and a low-frequency hook (`line:stop`)
417
+ calling concurrently cannot race on read-modify-write.
418
+ - On shutdown / hot reload the pending debounce is **cancelled and flushed synchronously**, so a
419
+ `set` from the last 200 ms before exit is not lost.
420
+ - Typical uses: counters, alarm state, threshold config, heartbeat timestamps.
421
+
422
+ ### 4.3 `ctx.timer` / `ctx.onDispose` / `ctx.subscriptions`
423
+
424
+ ```js
425
+ ctx.timer.setInterval(() => ctx.kv.set('heartbeat', Date.now()), 5000)
426
+ ctx.timer.setTimeout(() => ctx.logger.info('one-shot task'), 1000)
427
+
428
+ ctx.onDispose(() => ctx.logger.info('plugin cleanup done'))
429
+
430
+ // subscriptions.add accepts a { dispose() } object or a function; same queue as onDispose
431
+ const controller = new AbortController()
432
+ ctx.subscriptions.add({ dispose() { controller.abort() } })
433
+ ```
434
+
435
+ - Timers created by `ctx.timer.setInterval/setTimeout` are automatically `unref`ed (they never
436
+ hold the process open) and automatically registered with the collection queue, so **you never
437
+ have to clear them by hand**.
438
+ - `ctx.onDispose(fn)` and `ctx.subscriptions.add(d)` (`d` may be `{ dispose() }` or a function)
439
+ share **one host-owned collection queue** with the timers.
440
+ - That queue runs on **both server shutdown and plugin hot reload** — a guarantee this version of
441
+ the SDK can make after the fix (`createPluginContext` previously failed to forward the host's
442
+ `onDispose` injection point, leaking timers and losing the final kv write).
443
+
444
+ Server shutdown sequence:
445
+
446
+ ```text
447
+ server shutdown (nitro close)
448
+ └─ per-plugin dispose queue (each entry try/catch): clear timers, flush kv synchronously, unbind subscriptions…
449
+ └─ broadcast server:close { at }
450
+ ```
451
+
452
+ ### 4.4 `ctx.route` — plugin API
453
+
454
+ ```js
455
+ export default {
456
+ name: 'my-plugin',
457
+ auth: 'user', // declarative auth: 'none' (default) | 'user' | 'admin' | 'agent-or-user'
458
+ async setup(ctx) {
459
+ // returns boolean: true = registration succeeded, false = handler is not a function
460
+ const ok = ctx.route('GET', '/stats', () => ctx.kv.all())
461
+ if (!ok) ctx.logger.warn('route registration failed')
462
+
463
+ ctx.route('POST', '/threshold', (event) => {
464
+ const body = event.awBody // the JSON body the host already pre-read (may be undefined)
465
+ const threshold = Number(body?.threshold)
466
+ if (!Number.isFinite(threshold)) return { ok: false, error: 'threshold must be a number' }
467
+ ctx.kv.set('threshold', threshold)
468
+ return { ok: true, threshold } // the return value is serialized to JSON by nitro
469
+ })
470
+ },
471
+ }
472
+ ```
473
+
474
+ → mounted at `GET /api/plugins/<plugin name>/stats` and
475
+ `POST /api/plugins/<plugin name>/threshold`.
476
+
477
+ - **The return value is `boolean`**: `false` when `handler` is not a function.
478
+ - **Paths** start with `/` (a missing one is added for you); the base is always
479
+ `/api/plugins/<plugin name>`.
480
+ - **Auth is declarative — do not write your own**: give the plugin definition
481
+ `auth: 'none' | 'user' | 'admin' | 'agent-or-user'` and the platform catch-all
482
+ (`server/api/plugins/[name]/[...path].ts`) validates it **before** your handler runs,
483
+ returning 401 on failure.
484
+ - **The handler cannot obtain a user object**: `resolveUser(event)` is not on `ctx` and cannot be
485
+ imported from a plugin module. When you need an identity, combine the `auth` gate with
486
+ `ctx.api.setToken(...)` and go through the platform API.
487
+ - **The JSON body is already pre-read** and attached as `event.awBody` (not h3's `readBody`).
488
+ - Handler errors are isolated: the platform logs with the plugin name and returns a 500 envelope
489
+ (`插件路由处理失败(<plugin name>): <original message>`) without leaking a stack trace.
490
+
491
+ ### 4.5 `ctx.config` — reading config and reacting to change
492
+
493
+ ```js
494
+ ctx.config.get('plugins.my-plugin.threshold') // effective value (after the four-layer merge)
495
+ ctx.config.all() // every effective setting (shallow copy)
496
+
497
+ const off = ctx.config.onChange((payload) => { // payload: the config:changed payload, see §5
498
+ ctx.logger.info('config changed:', payload?.changed)
499
+ })
500
+ ```
501
+
502
+ `config:changed` is bridged onto the plugin bus from the platform settings service, and
503
+ `ctx.config.onChange(fn)` is essentially `ctx.hooks.on('config:changed', fn)`, so it is likewise
504
+ auto-unbound on hot reload.
505
+
506
+ ### 4.6 `ctx.api` / `ctx.http` / `ctx.events` — which one to use
507
+
508
+ | Need | Use | Why |
509
+ |---|---|---|
510
+ | Read / write **platform business data** (lines, nodes, twins…) | `ctx.api` | auth / envelope / resource semantics out of the box |
511
+ | Call an **external system** (MES, webhook, mail gateway) | `ctx.http` | generic requests plus a protocol guard |
512
+ | React to the **live stream** (samples, alarms, start/stop) | `ctx.events` / `ctx.hooks.on` | in-process, zero HTTP overhead |
513
+
514
+ ```js
515
+ // ctx.api: the loopback PlatformClient. baseUrl is resolved lazily by the host; no token by default.
516
+ const { token } = await ctx.api.users.login('user@example.com', 'secret')
517
+ ctx.api.setToken(token) // later loopback calls carry that token
518
+ const { lines } = await ctx.api.lines.list()
519
+
520
+ // ctx.http: outbound requests, protocol guard only (http/https), 8 s default timeout
521
+ const res = await ctx.http.get('https://mes.example.com/health', { timeoutMs: 3000 })
522
+ const payload = await ctx.http.post('https://mes.example.com/events', { lineId: 'L1' })
523
+
524
+ // ctx.events: scene events — pass the scene event name itself; the `event:` prefix is added for you
525
+ ctx.events.on('daq.reading', r => ctx.logger.info('sample', r.nodeId))
526
+ ctx.events.on('permissions.changed', ({ userId }) => ctx.logger.info('grants changed', userId))
527
+ ctx.events.on('device.created', d => ctx.logger.info('new device', d.id))
528
+ const off = ctx.events.on('daq.alarm', a => ctx.logger.warn('alarm', a.id))
529
+ off()
530
+ ```
531
+
532
+ - `ctx.api` has **no token by default**: unauthenticated endpoints (`plugins.manifest` / `ping`)
533
+ work immediately; anything else needs a login followed by `setToken`. If you only need
534
+ in-process data, prefer `ctx.events` and `ctx.hooks` (no auth, no overhead).
535
+ - The `ctx.http` guard **checks the protocol only** and does not restrict hosts — the target
536
+ address is the plugin's own responsibility.
537
+ - `ctx.events.on(type, fn)` / `off(type, fn)` install `event:<type>` underneath; to receive every
538
+ scene event use `ctx.hooks.on('*', ({ type, payload }) => …)`.
539
+
540
+ ### 4.7 `ctx.permissions` — per-user, per-line grants
541
+
542
+ | Method | Returns | Notes |
543
+ |---|---|---|
544
+ | `lineMode(user, lineId)` | `'none' \| 'readonly' \| 'operate'` | `user` is `{ id, role }`; admin/editor is always `operate` |
545
+ | `visibleLineIds(user)` | `Set<string> \| null` | `null` means unrestricted (admin/editor) |
546
+ | `listGrants(userId)` | `Array<{ lineId, mode, grantedBy, grantedAt }>` | read every grant of one user |
547
+ | `setGrants(userId, grants, grantedBy?)` | the grants after the write | `grants` looks like `[{ lineId, mode }]` with `mode` = `'readonly'` / `'operate'` / `null` |
548
+
549
+ ```js
550
+ const userId = ctx.kv.get('watchUserId') // a plugin gets userIds from event payloads or its own config
551
+ if (userId) {
552
+ const mode = ctx.permissions.lineMode({ id: userId, role: 'user' }, 'line-1')
553
+ const visible = ctx.permissions.visibleLineIds({ id: userId, role: 'user' })
554
+ const grants = ctx.permissions.listGrants(userId)
555
+ ctx.logger.info(`mode=${mode} visible=${visible ? visible.size : 'all'} grants=${grants.length}`)
556
+ }
557
+
558
+ // Change notification is the scene event permissions.changed, subscribed via ctx.events (prefix added for you)
559
+ ctx.events.on('permissions.changed', ({ userId }) => ctx.logger.info('grants changed:', userId))
560
+ ```
561
+
562
+ ### 4.8 Host-injected extensions `ctx.daq` / `ctx.omp` / `ctx.services`
563
+
564
+ **`ctx.daq`** — multi-modal DAQ extension (v0.6 frame pipeline):
565
+
566
+ | Method | Notes |
567
+ |---|---|
568
+ | `registerDriver({ kind, available, sample, test })` | register a custom driver |
569
+ | `registerProcessor(kind, name, fn)` | register a sink processor (after sampling, before storage) |
570
+ | `registerTemplate(def)` | register a DAQ node template (`key` / `signalKind` / `vector` / `sink` / `metrics`) |
571
+ | `onFrame(fn)` | frame subscription sugar (= `ctx.hooks.on('daq:frame', fn)`) |
572
+ | `onSample(fn)` | sample subscription sugar (= `ctx.hooks.on('daq:sample', fn)`) |
573
+ | `query({ nodeIds?, lineId?, from?, to?, bucketMs? })` | unauthenticated time-series query (straight to `queryTagged`) |
574
+ | `nodes()` | DAQ node metadata snapshot (including line ownership) |
575
+
576
+ ```js
577
+ ctx.daq.registerProcessor('vector', 'my-derive', (frame) => {
578
+ // frame = { kind: 'vector'|'image', points? | blob? (image producer side only), metrics }
579
+ return { ...frame, metrics: { ...frame.metrics, myMetric: 1 } }
580
+ })
581
+ ctx.daq.onFrame(f => ctx.logger.debug('frame', f.nodeId, f.kind))
582
+ const rows = await ctx.daq.query({ nodeIds: ['n1'], from: Date.now() - 3600_000, to: Date.now(), bucketMs: 60_000 })
583
+ const all = await ctx.daq.nodes()
584
+ ```
585
+
586
+ A template's `sink.processors` declares the sink pipeline; `metrics` declares derived-metric
587
+ thresholds whose breaches ride the platform's existing alarm chain. Vector / frame metadata lands
588
+ in Timescale `daq_frames`; image pixels land in object storage (the `daq:frame` payload
589
+ **carries no pixel blob**).
590
+
591
+ **`ctx.omp.registerTool({ name, label?, description, parameters, roles?, handler })`** —
592
+ register a custom host tool, hot-injected into every running agent session at runtime:
593
+
594
+ ```js
595
+ ctx.omp.registerTool({
596
+ name: 'sensor_log',
597
+ label: 'Sensor calibration',
598
+ description: 'Query or record sensor calibration conclusions',
599
+ parameters: { type: 'object', properties: { sensor: { type: 'string' } }, required: ['sensor'] },
600
+ roles: ['lead', 'worker'], // the only valid literals are 'lead' and 'worker'; default is both
601
+ handler: async (args, agent) => ({ text: `recorded ${args.sensor}` }), // agent = { agentId, channelId, role, name }
602
+ })
603
+ ```
604
+
605
+ Registry changes are hot-injected into running sessions immediately (re-sending `set_host_tools`,
606
+ no respawn); a tool sharing a name with a built-in host tool is ignored.
607
+
608
+ **`ctx.services`** — the backend runtime object surface (lazy getters, cached after first access):
609
+
610
+ | Call | Resolves to |
611
+ |---|---|
612
+ | `ctx.services.names()` | every service name (including plugin-provided `<plugin>.<name>`) |
613
+ | `await ctx.services.get('daq')` | `{ query(q), nodes() }` |
614
+ | `await ctx.services.get('lines')` | `{ list(), byId(id) }` |
615
+ | `await ctx.services.get('channels')` | `{ list(), agents(channelId) }` |
616
+ | `await ctx.services.get('plugins')` | the plugin manifest **array** (note: not an object and with no `pluginManifest()`) |
617
+ | `ctx.services.provide(name, getter)` | provide a service, auto-prefixed with `<plugin>.` |
618
+
619
+ ```js
620
+ const daq = await ctx.services.get('daq')
621
+ const lines = await ctx.services.get('lines')
622
+ const channels = await ctx.services.get('channels')
623
+ const plugins = await ctx.services.get('plugins') // an array
624
+ ctx.services.provide('my-data', async () => ({ ready: true })) // → 'my-plugin.my-data'
625
+ ctx.logger.info(ctx.services.names().join(', '))
626
+ ```
627
+
628
+ An unknown name throws (the caller is expected to handle it). `provide` forces the
629
+ `<plugin>.` prefix so cross-plugin name clashes cannot happen.
630
+
631
+ ### 4.9 Plugin setting declarations (`settings` / `configGroups`)
632
+
633
+ Two equivalent routes: the top-level `settings` array in the entry (declarative), or
634
+ `ctx.config.defineField` inside `setup` (conditional).
635
+
636
+ ```js
637
+ export default {
638
+ name: 'my-plugin',
639
+ configGroups: [{ id: 'conn', label: 'Connection', collapsed: true }],
640
+ settings: [
641
+ { key: 'base_url', type: 'string', default: 'https://example.com', group: 'conn',
642
+ labelKey: 'plugin.my-plugin.base_url', label: 'Service URL' },
643
+ ],
644
+ async setup(ctx) {
645
+ // equivalent form: add declarations conditionally at runtime
646
+ ctx.config.defineGroup({ id: 'sync', label: 'Sync' })
647
+ ctx.config.defineField({ key: 'interval', type: 'number', default: 30, min: 1, max: 3600, group: 'sync' })
648
+ },
649
+ }
650
+ ```
651
+
652
+ Validation rules (an entry that fails **is skipped with a warning**; it never blocks loading):
653
+
654
+ | Rule | Detail |
655
+ |---|---|
656
+ | `key` | must match `[A-Za-z0-9_-]+`; addressed as `plugins.<plugin name>.<key>` |
657
+ | `type` | one of `'string'` / `'number'` / `'boolean'` / `'select'` |
658
+ | `default` | **required** — a declaration without `default` is skipped outright |
659
+ | `select` | must supply an `options` array, and `default` must appear among its stringified values |
660
+ | `min` / `max` | **apply to `number` only** |
661
+ | Group | an explicit `group` is folded into the `plugin-<name>[-<suffix>]` namespace; a field without `group` lands in the `plugin-<name>` group labelled with the plugin name |
662
+
663
+ Once declared, the settings are merged into the platform settings service: the "Plugins" section
664
+ of the settings page renders them automatically, PATCH validation uses the same source, and
665
+ saving takes effect immediately. Read values with the full key:
666
+ `ctx.config.get('plugins.my-plugin.base_url')`.
667
+
668
+ ---
669
+
670
+ ## 5. Lifecycle events
671
+
672
+ The authoritative lists are the SDK-exported `LIFECYCLE_EVENTS` (11 items) and
673
+ `CLIENT_EVENTS` (5 items), both checked one by one against what the host actually emits.
674
+ **Every event is also part of the config-root event stream.**
675
+
676
+ ### 5.1 Server-side events (`LIFECYCLE_EVENTS`, 11 items)
677
+
678
+ | Event name (bus type) | When it fires | Payload | Typical use |
679
+ |---|---|---|---|
680
+ | `plugin:host:init` | once, after the host has loaded every plugin (including disabled ones) | `{ plugins: string[], failures: number }` | readiness proof, deferred init |
681
+ | `plugins:reloaded` | end of a hot reload (plugin enabled/disabled, `plugins-state.json` changed) | `{ plugins: <manifest entry array> }` | rebuild caches, re-register external resources |
682
+ | `config:changed` | `runtime-settings.json` changed (`aw config set` / settings page, bridged from SystemConfigService) | `{ type: 'config:changed', changed: string[], effective: object, sources: object }` | hot-update thresholds, refresh caches |
683
+ | `event:permissions:changed` | after line grants were written successfully | `{ userId }` | refresh cached grant views |
684
+ | `event:*` | **a subscription entry, not an emitted event** | — | use the bare `'*'` to receive everything (§4.1) |
685
+ | `daq:sample` | DAQ **downlink-level** sampling (same point as WS `daq.reading`, on the node's `publishIntervalMs` cadence) | `{ nodeId, templateRef, value, state, at, lineId }` | limit alarms, statistics, interlocking |
686
+ | `daq:frame` | multi-modal frames (vector / image) at downlink level, on the same frame-ingest path as `daq:sample` | `{ nodeId, templateRef, kind, at, lineId, preview?, metrics, thumbUrl?, state }` | custom sinks, derived metrics |
687
+ | `dcw:write` | observation after a write-control ACK (never affects the write decision) | `{ nodeId, name, eng, prevValue, ok, source, lineId, at }` | write audit, trend recording |
688
+ | `line:start` | a line starts running (batch window opens) | `{ lineId, runId, recipeId, productName? }` | batch-start interlocking |
689
+ | `line:stop` | a line stops (batch window closes) | `{ lineId, runId }` | batch wrap-up, report generation |
690
+ | `server:close` | server shutdown, after the per-plugin dispose queues have run | `{ at }` | final flush, outbound notification |
691
+
692
+ `dcw:write`'s `source` is `'manual'` / `'recipe'` / `'agent'` / `'rollback'`; the payload
693
+ **has no `message` field** (look at platform logs or the ledger for a failure reason).
694
+
695
+ The `config:changed` payload **has no `at` field** — take the time yourself with `Date.now()`
696
+ when you receive it, and read the new values from `ctx.config.get/all()`.
697
+
698
+ ### 5.2 Browser-side events (`CLIENT_EVENTS`, 5 items)
699
+
700
+ | Event | When it fires | Payload |
701
+ |---|---|---|
702
+ | `client:init` | after the client script's `setup(ctx)` has finished | `{ name }` |
703
+ | `event:*` | live scene events (same source as the browser WS, via the event bridge) | the event's own payload |
704
+ | `page:change` | route change finished (`page:finish`) | `{ path }` |
705
+ | `i18n:changed` | UI language switched | `{ locale }` |
706
+ | `client:destroy` | just before `ctx.dispose()` collects things | `{ name }` |
707
+
708
+ ### 5.3 Subscription cheat sheet
709
+
710
+ | What you want | Server plugin | Browser plugin |
711
+ |---|---|---|
712
+ | A named lifecycle hook (`daq:sample` / `dcw:write` / `line:start` …) | `ctx.hooks.on('daq:sample', fn)` | not delivered (server hooks never reach the browser) |
713
+ | A scene event (e.g. `daq.reading`, `device.created`) | `ctx.events.on('daq.reading', fn)` | `ctx.on('daq.reading', fn)` |
714
+ | Every scene event | `ctx.hooks.on('*', ({ type, payload }) => …)` | `ctx.on('event:*', fn)` |
715
+ | A client-local hook (`client:init` / `page:change` / `i18n:changed` / `client:destroy`) | n/a | `ctx.hooks.on('page:change', fn)` |
716
+
717
+ The two easiest mistakes:
718
+
719
+ - The server wildcard is the bare `'*'` only: `ctx.hooks.on('event:*', fn)` **never fires**;
720
+ - The client wildcard is the literal `'event:*'` only: `ctx.on('*', fn)` **never fires**, and
721
+ `ctx.on('event:line.start', fn)` gets the prefix added twice (`event:event:line.start`) and
722
+ likewise never fires.
723
+
724
+ Scene events enter the bus as `event:<type>`, and `ctx.events.on('<type>', fn)` is the sugar that
725
+ adds the prefix. So the correct subscription for the scene event `permissions.changed` is
726
+ `ctx.events.on('permissions.changed', fn)`, while `ctx.hooks.on('permissions:changed', fn)`
727
+ never fires.
728
+
729
+ ### 5.4 Shutdown and hot-reload sequences
730
+
731
+ ```text
732
+ server shutdown (nitro close → shutdownPluginHost)
733
+ └─ per-plugin ctx.onDispose queue (each entry try/catch)
734
+ └─ broadcast server:close { at }
735
+
736
+ plugin hot reload (plugins-state.json changed / plugin enabled-disabled / 10 s poll fallback)
737
+ └─ per-plugin ctx.onDispose queue
738
+ └─ unbind every listener registered through ctx.hooks
739
+ └─ reload → broadcast plugins:reloaded
740
+ └─ broadcast the scene event plugins.reloaded (the browser loader hot-injects / unloads client plugins from it)
741
+ ```
742
+
743
+ > v1 hooks are **observation-only** — they never change interlocking or write-control decisions;
744
+ > veto (interception / rewriting) hooks are on the roadmap.
745
+
746
+ ---
747
+
748
+ ## 6. Browser-side SDK (`agentworkshop/sdk/client`)
749
+
750
+ A plugin's `client.mjs` is a **self-contained ESM** module (no bare imports — the browser resolves
751
+ it natively) exporting `setup(ctx)`. The entry must be declared in the plugin definition as
752
+ `client: './client.mjs'`; the loader fetches the script from
753
+ `GET /api/plugins/client/<plugin name>` and imports it dynamically.
754
+
755
+ ### 6.1 Creation (host-invoked; plugins only write `setup`)
756
+
757
+ ```js
758
+ import { createClientContext } from 'agentworkshop/sdk/client'
759
+
760
+ // host-side assembly (illustrative); a plugin author only writes setup(ctx) in client.mjs
761
+ const listeners = new Set()
762
+ const townBus = {
763
+ subscribe(fn) { listeners.add(fn); return () => listeners.delete(fn) },
764
+ }
765
+
766
+ const ctx = createClientContext({
767
+ name: 'my-plugin',
768
+ // event bridge: the host feeds every WS bus message into dispatch
769
+ eventBridge: dispatch => townBus.subscribe(e => dispatch(e.type, e.payload)),
770
+ baseUrl: '', // same-origin; fill in the platform address for cross-origin integration
771
+ ui: { slots: ['plugins.page'], registerPanel: () => () => {} },
772
+ t: key => `plugin.my-plugin.${key}`, // the host passes a real translation helper
773
+ getLocale: () => 'zh-CN',
774
+ })
775
+ ```
776
+
777
+ ### 6.2 `ctx` members
778
+
779
+ | Member | Notes |
780
+ |---|---|
781
+ | `ctx.name` | plugin name |
782
+ | `ctx.sdkVersion` | `CLIENT_SDK_VERSION` |
783
+ | `ctx.hooks` | the client-local `HookBus`; both local hooks and scene events ride this bus |
784
+ | `ctx.on(type, fn)` | subscribe to **live scene events**; `type` is the **scene event name itself** (e.g. `'daq.reading'` / `'daq.alarm'` / `'daq.alarm.changed'` / `'dcw.written'` / `'daq.node.changed'` / `'device.updated'`), installed as `event:<type>` internally; returns an unsubscribe function and is **auto-collected on pagehide**. The only wildcard spelling is the literal **`'event:*'`** |
785
+ | `ctx.fetch(path, opt?)` | same-origin platform API: automatic JSON, automatic `{data}` unwrapping, throws on non-2xx, and **automatically carries the platform token from the cookie** |
786
+ | `ctx.el(tag, attrs, children)` | DOM builder: `style` / `class` / `on*` event attributes get special handling |
787
+ | `ctx.mount(target, node)` | mount into any selector / element; falls back to `ctx.root()` when the target is missing |
788
+ | `ctx.root()` | the plugin's private mount point `#aw-plugin-<name>` (bottom-right, lazily created) |
789
+ | `ctx.ui` | UI injection surface: `slots` and `registerPanel(entry)` (§6.4) |
790
+ | `ctx.t(key, params?)` | plugin namespace translation: `ctx.t('panel.title')` → `plugin.<name>.panel.title` (messages come from `i18n.json` in the plugin root; a miss falls back to the original key). **`params` is currently ignored — there is no interpolation** |
791
+ | `ctx.locale` | the current UI language (read-only getter) |
792
+ | `ctx.log` | prefixed console: `info` / `warn` / `error` (**no `debug`**) |
793
+ | `ctx.dispose()` | unload: broadcast `client:destroy` → run local disposables → remove `root()`. **Idempotent**; it does not unregister panels (the loader does that on disable / hot reload) |
794
+
795
+ Two wrong spellings of `ctx.on`: `ctx.on('*')` and `ctx.on('event:line.start')` both
796
+ **never fire** — the former is not installed on the bare `'*'`, the latter gets a second prefix
797
+ and becomes `event:event:line.start`.
798
+
799
+ **Server hooks never reach the browser**: colon-named server hooks such as `daq:sample`,
800
+ `dcw:write`, `line:start` / `line:stop` are not delivered to the client. Their browser-side
801
+ counterparts are scene events (`daq.reading` / `daq.frame` / `dcw.written` and so on); subscribe
802
+ to those with `ctx.on('<scene-type>')`.
803
+
804
+ **Client lifecycle hooks cannot go through `ctx.on` either**: `client:init` / `page:change` /
805
+ `i18n:changed` / `client:destroy` must be subscribed directly with `ctx.hooks.on(...)` (they carry
806
+ no `event:` prefix).
807
+
808
+ ### 6.3 Full example
809
+
810
+ ```js
811
+ export function setup(ctx) {
812
+ const badge = ctx.el('div', {
813
+ style: 'padding:8px 12px;border:1px solid #35e0a0;border-radius:10px;color:#35e0a0',
814
+ }, ['samples: 0'])
815
+ ctx.root().append(badge)
816
+
817
+ let n = 0
818
+ ctx.on('daq.reading', () => { badge.textContent = `samples: ${++n}` }) // scene event
819
+ ctx.on('event:*', (payload) => ctx.log.info('scene event', payload)) // the only wildcard spelling
820
+
821
+ ctx.hooks.on('page:change', ({ path }) => ctx.log.info('page →', path)) // local hook: subscribe directly
822
+
823
+ // Consume the platform API (same-origin, cookie auth): the line list is { lines, states }, not an array
824
+ ctx.fetch('/api/workshop/dcw/lines').then(({ lines }) => ctx.log.info('lines', lines.length))
825
+ }
826
+ ```
827
+
828
+ ### 6.4 UI injection `ctx.ui.registerPanel`
829
+
830
+ ```js
831
+ let samples = 0
832
+ ctx.on('daq.reading', () => { samples += 1 })
833
+
834
+ const off = ctx.ui.registerPanel({
835
+ slot: 'dashboard.widgets', // 'plugins.page' | 'settings.plugins' | 'dashboard.widgets'
836
+ name: 'my-widget',
837
+ title: 'Sample counter',
838
+ titleKey: 'plugin.my-plugin.widget.title', // titleKey wins when present
839
+ order: 100, // smaller comes first; default 100
840
+ mount(el) {
841
+ el.textContent = `samples: ${samples}`
842
+ const tick = setInterval(() => { el.textContent = `samples: ${samples}` }, 1000)
843
+ return () => clearInterval(tick) // called when the panel is unmounted
844
+ },
845
+ })
846
+ off() // the returned unregister function; ctx.dispose() does not call it, the loader collects it on disable
847
+ ```
848
+
849
+ - `ctx.ui.slots` is exactly `['plugins.page', 'settings.plugins', 'dashboard.widgets']`.
850
+ - `registerPanel` returns an unregister function; if `mount(el)` returns a function it is called
851
+ when that panel is unmounted.
852
+
853
+ ### 6.5 Constraints and trust
854
+
855
+ - **Self-contained**: no bare imports of `vue` or other third-party packages (the browser's native
856
+ import cannot resolve them) — build UI with native DOM (`ctx.el`);
857
+ - **Trust model**: client scripts are served by platform endpoints, trusted at the same level as
858
+ aw commands — only install plugins you trust;
859
+ - **Isolation**: a single plugin failing to load only logs a console warning; the app and other
860
+ plugins are unaffected.
861
+
862
+ ---
863
+
864
+ ## 7. Types and TypeScript
865
+
866
+ ```ts
867
+ import type { PluginDef, PluginContext, PlatformClient } from 'agentworkshop/sdk'
868
+
869
+ export default {
870
+ name: 'typed-plugin',
871
+ auth: 'user',
872
+ async setup(ctx: PluginContext) {
873
+ const timeout: number = ctx.config.get('plugins.typed-plugin.timeout')
874
+ const client: PlatformClient = ctx.api
875
+ ctx.logger.info('api available:', typeof client.get === 'function', 'timeout:', timeout)
876
+ },
877
+ } satisfies PluginDef
878
+ ```
879
+
880
+ The runtime **does not import** the SDK (keeping the zero-dependency shape); types are erased at
881
+ build time.
882
+
883
+ Current coverage of the type declarations (always defer to `sdk/index.d.mts` and
884
+ `sdk/client.d.mts`):
885
+
886
+ - Declared: `PluginDef`, `PluginContext`, `PluginHostExtensions`, `PluginSettingDecl`,
887
+ `PluginGroupDecl`, `PluginLogger`, `PluginKv`, `PluginHttp`, `CrudResource`, `PlatformClient`,
888
+ `ConfigChangedPayload`, `HookBus`, `ClientContext`, `ClientUi`, `ClientPanelEntry`,
889
+ `LIFECYCLE_EVENTS`, `CLIENT_EVENTS` and the factory functions.
890
+ - **Not yet declared**: `isPathInside`, `validatePluginSettings`, `validatePluginGroups` and
891
+ `resolvePluginGroupId` are runtime-only exports with no declaration in `.d.mts` — a TypeScript
892
+ project importing them gets TS2614 and needs a local declaration or `await import()`.
893
+ - In addition, `sdk/client.d.mts` declares an `el` named export that does not exist at runtime
894
+ (the runtime has only `CLIENT_SDK_VERSION` and `createClientContext`); importing it compiles
895
+ but yields `undefined` at runtime.
896
+
897
+ ---
898
+
899
+ ## 8. Versioning and compatibility policy
900
+
901
+ - The SDK interface follows semver: patch = fixes; minor = new hooks / `ctx` members
902
+ (backwards compatible); major = breaking contract changes. `SDK_VERSION` /
903
+ `CLIENT_SDK_VERSION` are the versions on that line and are **independent of the npm package
904
+ version** — never infer one from the other.
905
+ - The host exposes `ctx.sdkVersion` so a plugin can degrade gracefully by feature.
906
+ - Config-root hardening does not live in the single `aw start` command but in the **CLI context
907
+ builder** — every `aw` command calls it while resolving the run root (idempotently), so no
908
+ command fails just because a config-root directory is missing.
909
+ - There is **no version-based directory-layout migration**: the only migration copies data files
910
+ from the legacy locations into the config root, that is `cwd/data` (and the historical
911
+ `cwd/server/data`) → `<configRoot>/data`, only for `.sqlite` / `.sqlite-wal` / `.sqlite-shm` /
912
+ `.json`, with "newest wins" by `mtimeMs` on a name clash; when the config root falls back to
913
+ `~/.AgentWorkShop` that migration is skipped to avoid cross-project pollution.
914
+
915
+ ---
916
+
917
+ ## Appendix: scope of this page
918
+
919
+ This page is the single source of truth for the SDK; it follows the actual implementation in
920
+ `sdk/*.mjs`, `sdk/*.d.mts`, `server/services/workshop/plugins/host.mjs` and `server/api/**`.
921
+ CI copies this file to the site at `docs/site/en/sdk/guide.md`, and the Chinese original
922
+ `docs/sdk.md` to `docs/site/sdk/guide.md`.