agentworkshop 0.11.3 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/.AgentWorkShop/prompts/host-tools.json +4 -4
  2. package/.output/.AgentWorkShop/prompts/host-tools.json +4 -4
  3. package/.output/nitro.json +1 -1
  4. package/.output/public/_nuxt/{DXXBGPAc.js → CsdezMu9.js} +4 -4
  5. package/.output/public/_nuxt/WL1R8lPA.js +1 -0
  6. package/.output/public/_nuxt/_id_.Czwkl50w.css +1 -0
  7. package/.output/public/_nuxt/builds/latest.json +1 -1
  8. package/.output/public/_nuxt/builds/meta/577f464e-672a-4c4e-a3c8-dc8c1b38930d.json +1 -0
  9. package/.output/server/chunks/_/access.mjs +1 -1
  10. package/.output/server/chunks/_/candidate-store.mjs +1 -1
  11. package/.output/server/chunks/_/catalog-view.mjs +1 -1
  12. package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
  13. package/.output/server/chunks/_/data-export.mjs +6 -6
  14. package/.output/server/chunks/_/data-query.mjs +3 -3
  15. package/.output/server/chunks/_/eda-run.repo.mjs +2 -2
  16. package/.output/server/chunks/_/entity.mjs +1 -1
  17. package/.output/server/chunks/_/features.mjs +5 -5
  18. package/.output/server/chunks/_/golden.mjs +3 -3
  19. package/.output/server/chunks/_/host-bindings.mjs +1 -1
  20. package/.output/server/chunks/_/index.mjs +1 -1
  21. package/.output/server/chunks/_/line-scope.mjs +1 -1
  22. package/.output/server/chunks/_/mes-console.mjs +1 -1
  23. package/.output/server/chunks/_/mes-secrets.repo.mjs +1 -1
  24. package/.output/server/chunks/_/mes-templates.mjs +1 -1
  25. package/.output/server/chunks/_/nitro.mjs +4070 -2343
  26. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  27. package/.output/server/chunks/_/ocap.mjs +1 -1
  28. package/.output/server/chunks/_/orchestrator.mjs +1 -1
  29. package/.output/server/chunks/_/promote.mjs +1 -1
  30. package/.output/server/chunks/_/rest-auth.mjs +1 -1
  31. package/.output/server/chunks/_/runtime.mjs +8 -8
  32. package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
  33. package/.output/server/chunks/_/spc.mjs +1 -1
  34. package/.output/server/chunks/_/validator.mjs +1 -1
  35. package/.output/server/chunks/build/TownView-DD1zY8xq.mjs +1 -1
  36. package/.output/server/chunks/build/{_id_-C0vNEbts.mjs → _id_-B9zi8WEg.mjs} +23 -12
  37. package/.output/server/chunks/build/_id_-B9zi8WEg.mjs.map +1 -0
  38. package/.output/server/chunks/build/_wsId_-LDv5SEW_.mjs +1 -1
  39. package/.output/server/chunks/build/daq-B5zlUIlb.mjs +1 -1
  40. package/.output/server/chunks/build/dcw-B-eoU7sq.mjs +1 -1
  41. package/.output/server/chunks/build/types-D6J7slEa.mjs +1 -1
  42. package/.output/server/chunks/build/useDaqAddNode-Dr5CfMpU.mjs +1 -1
  43. package/.output/server/chunks/build/useDaqDetailNode-DDq5osE-.mjs +1 -1
  44. package/.output/server/chunks/build/useDaqDetailParams-DdOcUvHG.mjs +1 -1
  45. package/.output/server/chunks/build/useDaqFilters-Y_NRhP6i.mjs +1 -1
  46. package/.output/server/chunks/build/useDaqStream-phwM5tIN.mjs +1 -1
  47. package/.output/server/chunks/build/useDaqTemplates-lKw2b01d.mjs +1 -1
  48. package/.output/server/chunks/build/useDcwAddNode-CT-oOFom.mjs +1 -1
  49. package/.output/server/chunks/build/useDcwStream-CNtMGcR0.mjs +1 -1
  50. package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
  51. package/.output/server/chunks/routes/api/system/backup/run.post.mjs +2 -2
  52. package/.output/server/chunks/routes/api/system/index.patch.mjs +2 -2
  53. package/.output/server/chunks/routes/api/system/shutdown.post.mjs +2 -2
  54. package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
  55. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +7 -2
  56. package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -1
  57. package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
  58. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +1 -1
  59. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs +1 -1
  60. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +1 -1
  61. package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs +1 -1
  62. package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs +1 -1
  63. package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs +1 -1
  64. package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs +1 -1
  65. package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +1 -1
  66. package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +1 -1
  67. package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +1 -1
  68. package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +1 -1
  69. package/.output/server/chunks/routes/api/workshop/aml/index3.post.mjs +1 -1
  70. package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +1 -1
  71. package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs +1 -1
  72. package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs +1 -1
  73. package/.output/server/chunks/routes/api/workshop/aml/index7.get.mjs +1 -1
  74. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +1 -1
  75. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +1 -1
  76. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +1 -1
  77. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs +1 -1
  78. package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs +1 -1
  79. package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +1 -1
  80. package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +1 -1
  81. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs +1 -1
  82. package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs +1 -1
  83. package/.output/server/chunks/routes/api/workshop/aml/models/index.get.mjs +1 -1
  84. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id/train.post.mjs +1 -1
  85. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.delete.mjs +1 -1
  86. package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.patch.mjs +1 -1
  87. package/.output/server/chunks/routes/api/workshop/aml/training-plans/index.get.mjs +1 -1
  88. package/.output/server/chunks/routes/api/workshop/aml/twin/providers.get.mjs +1 -1
  89. package/.output/server/chunks/routes/api/workshop/analysis/_id_.delete.mjs +1 -1
  90. package/.output/server/chunks/routes/api/workshop/analysis/_id_.get.mjs +1 -1
  91. package/.output/server/chunks/routes/api/workshop/analysis/_id_.patch.mjs +1 -1
  92. package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
  93. package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +1 -1
  94. package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +1 -1
  95. package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
  96. package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
  97. package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +1 -1
  98. package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
  99. package/.output/server/chunks/routes/api/workshop/channels/_id/chat/index.post.mjs +1 -1
  100. package/.output/server/chunks/routes/api/workshop/channels/_id/execution-mode.patch.mjs +1 -1
  101. package/.output/server/chunks/routes/api/workshop/channels/_id/harness-profiles/promote.post.mjs +1 -1
  102. package/.output/server/chunks/routes/api/workshop/channels/_id/improvement-proposals/decide.post.mjs +1 -1
  103. package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
  104. package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +1 -1
  105. package/.output/server/chunks/routes/api/workshop/channels/_id/index11.get.mjs +1 -1
  106. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
  107. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
  108. package/.output/server/chunks/routes/api/workshop/channels/_id/index2.put.mjs +1 -1
  109. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
  110. package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
  111. package/.output/server/chunks/routes/api/workshop/channels/_id/index5.post.mjs +1 -1
  112. package/.output/server/chunks/routes/api/workshop/channels/_id/index7.get.mjs +1 -1
  113. package/.output/server/chunks/routes/api/workshop/channels/_id/index7.post.mjs +1 -1
  114. package/.output/server/chunks/routes/api/workshop/channels/_id/line.put.mjs +1 -1
  115. package/.output/server/chunks/routes/api/workshop/channels/_id/members/join.post.mjs +1 -1
  116. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId/promote.post.mjs +1 -1
  117. package/.output/server/chunks/routes/api/workshop/channels/_id/memories/merge.post.mjs +1 -1
  118. package/.output/server/chunks/routes/api/workshop/channels/_id/products.get.mjs +1 -1
  119. package/.output/server/chunks/routes/api/workshop/channels/_id/products.put.mjs +1 -1
  120. package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
  121. package/.output/server/chunks/routes/api/workshop/channels/_id/tool-usage.get.mjs +1 -1
  122. package/.output/server/chunks/routes/api/workshop/channels/_id/tools/reset.post.mjs +1 -1
  123. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.get.mjs +1 -1
  124. package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.patch.mjs +1 -1
  125. package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
  126. package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +1 -1
  127. package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +1 -1
  128. package/.output/server/chunks/routes/api/workshop/channels.post.mjs +7 -7
  129. package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
  130. package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
  131. package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +1 -1
  132. package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +1 -1
  133. package/.output/server/chunks/routes/api/workshop/daq/_id/ingest.post.mjs +2 -2
  134. package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
  135. package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
  136. package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
  137. package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
  138. package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +1 -1
  139. package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
  140. package/.output/server/chunks/routes/api/workshop/daq/index.get.mjs +1 -1
  141. package/.output/server/chunks/routes/api/workshop/daq/index2.post.mjs +1 -1
  142. package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
  143. package/.output/server/chunks/routes/api/workshop/daq/storage/retention.put.mjs +1 -1
  144. package/.output/server/chunks/routes/api/workshop/daq/storage/rollup.post.mjs +1 -1
  145. package/.output/server/chunks/routes/api/workshop/daq/storage.get.mjs +1 -1
  146. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
  147. package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
  148. package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
  149. package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
  150. package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
  151. package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
  152. package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
  153. package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
  154. package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
  155. package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
  156. package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
  157. package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
  158. package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
  159. package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
  160. package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
  161. package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
  162. package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
  163. package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
  164. package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
  165. package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
  166. package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
  167. package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs +1 -1
  168. package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs +1 -1
  169. package/.output/server/chunks/routes/api/workshop/dcw/index7.get.mjs +1 -1
  170. package/.output/server/chunks/routes/api/workshop/dcw/index8.get.mjs +1 -1
  171. package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
  172. package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
  173. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
  174. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
  175. package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
  176. package/.output/server/chunks/routes/api/workshop/dcw/lines/index.get.mjs +1 -1
  177. package/.output/server/chunks/routes/api/workshop/dcw/mes-artifacts/file.get.mjs +1 -1
  178. package/.output/server/chunks/routes/api/workshop/dcw/mes-hook-test.post.mjs +1 -1
  179. package/.output/server/chunks/routes/api/workshop/dcw/mes-test-read.post.mjs +1 -1
  180. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
  181. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
  182. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
  183. package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
  184. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs +1 -1
  185. package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs +1 -1
  186. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs +1 -1
  187. package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs +1 -1
  188. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
  189. package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
  190. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
  191. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
  192. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs +1 -1
  193. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
  194. package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
  195. package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs +1 -1
  196. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
  197. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
  198. package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
  199. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
  200. package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
  201. package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
  202. package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
  203. package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
  204. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
  205. package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
  206. package/.output/server/chunks/routes/api/workshop/eda/commonality.get.mjs +1 -1
  207. package/.output/server/chunks/routes/api/workshop/eda/index6.get.mjs +1 -1
  208. package/.output/server/chunks/routes/api/workshop/eda/index6.post.mjs +1 -1
  209. package/.output/server/chunks/routes/api/workshop/eda/vm/predict.post.mjs +1 -1
  210. package/.output/server/chunks/routes/api/workshop/exp/confirmations/_id/decide.post.mjs +1 -1
  211. package/.output/server/chunks/routes/api/workshop/exp/index.get.mjs +1 -1
  212. package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
  213. package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
  214. package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
  215. package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
  216. package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
  217. package/.output/server/chunks/routes/api/workshop/index.mjs +1 -1
  218. package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
  219. package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
  220. package/.output/server/chunks/routes/api/workshop/index12.get.mjs +1 -1
  221. package/.output/server/chunks/routes/api/workshop/index13.get.mjs +1 -1
  222. package/.output/server/chunks/routes/api/workshop/index14.get.mjs +1 -1
  223. package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
  224. package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
  225. package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
  226. package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
  227. package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
  228. package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
  229. package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
  230. package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
  231. package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
  232. package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
  233. package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
  234. package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
  235. package/.output/server/chunks/routes/api/workshop/index9.post.mjs +1 -1
  236. package/.output/server/chunks/routes/api/workshop/mes/bridge.post.mjs +1 -1
  237. package/.output/server/chunks/routes/api/workshop/mes/datasets.get.mjs +1 -1
  238. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/autofix.mjs +1 -1
  239. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs +1 -1
  240. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs +1 -1
  241. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs +1 -1
  242. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs +1 -1
  243. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs +1 -1
  244. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs +1 -1
  245. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/subgraph.mjs +1 -1
  246. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs +1 -1
  247. package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs +1 -1
  248. package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs +1 -1
  249. package/.output/server/chunks/routes/api/workshop/ontology/index.mjs +1 -1
  250. package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs +1 -1
  251. package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs +1 -1
  252. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs +1 -1
  253. package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs +1 -1
  254. package/.output/server/chunks/routes/api/workshop/optimization/capabilities.get.mjs +1 -1
  255. package/.output/server/chunks/routes/api/workshop/optimization/index.get.mjs +1 -1
  256. package/.output/server/chunks/routes/api/workshop/optimization/index.mjs +1 -1
  257. package/.output/server/chunks/routes/api/workshop/optimization/index2.mjs +1 -1
  258. package/.output/server/chunks/routes/api/workshop/optimization/profiles/_id/publish.post.mjs +1 -1
  259. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/crosscheck.post.mjs +1 -1
  260. package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/dispatch.post.mjs +1 -1
  261. package/.output/server/chunks/routes/api/workshop/optimization/solve.post.mjs +1 -1
  262. package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
  263. package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
  264. package/.output/server/chunks/routes/api/workshop/process-model/datasets.post.mjs +1 -1
  265. package/.output/server/chunks/routes/api/workshop/process-model/eligibility.mjs +1 -1
  266. package/.output/server/chunks/routes/api/workshop/process-model/experiments.mjs +1 -1
  267. package/.output/server/chunks/routes/api/workshop/process-model/index.mjs +1 -1
  268. package/.output/server/chunks/routes/api/workshop/process-model/specs/_id/publish.post.mjs +1 -1
  269. package/.output/server/chunks/routes/api/workshop/process-model/train.post.mjs +1 -1
  270. package/.output/server/chunks/routes/api/workshop/projects/_id/activate.post.mjs +1 -1
  271. package/.output/server/chunks/routes/api/workshop/projects/_id/approvals/_aid/decide.post.mjs +1 -1
  272. package/.output/server/chunks/routes/api/workshop/projects/_id/archive.post.mjs +1 -1
  273. package/.output/server/chunks/routes/api/workshop/projects/_id/channels/_channelId_.delete.mjs +1 -1
  274. package/.output/server/chunks/routes/api/workshop/projects/_id/complete.post.mjs +1 -1
  275. package/.output/server/chunks/routes/api/workshop/projects/_id/continue.post.mjs +1 -1
  276. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/_did/waive.post.mjs +1 -1
  277. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.get.mjs +1 -1
  278. package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.patch.mjs +1 -1
  279. package/.output/server/chunks/routes/api/workshop/projects/_id/health.get.mjs +1 -1
  280. package/.output/server/chunks/routes/api/workshop/projects/_id/index.get.mjs +1 -1
  281. package/.output/server/chunks/routes/api/workshop/projects/_id/index.post.mjs +1 -1
  282. package/.output/server/chunks/routes/api/workshop/projects/_id/index2.get.mjs +1 -1
  283. package/.output/server/chunks/routes/api/workshop/projects/_id/index2.post.mjs +1 -1
  284. package/.output/server/chunks/routes/api/workshop/projects/_id/index3.get.mjs +1 -1
  285. package/.output/server/chunks/routes/api/workshop/projects/_id/index3.post.mjs +1 -1
  286. package/.output/server/chunks/routes/api/workshop/projects/_id/index4.get.mjs +1 -1
  287. package/.output/server/chunks/routes/api/workshop/projects/_id/index4.post.mjs +1 -1
  288. package/.output/server/chunks/routes/api/workshop/projects/_id/index5.get.mjs +1 -1
  289. package/.output/server/chunks/routes/api/workshop/projects/_id/index6.get.mjs +1 -1
  290. package/.output/server/chunks/routes/api/workshop/projects/_id/index7.get.mjs +1 -1
  291. package/.output/server/chunks/routes/api/workshop/projects/_id/index8.get.mjs +1 -1
  292. package/.output/server/chunks/routes/api/workshop/projects/_id/kernel/tick.post.mjs +1 -1
  293. package/.output/server/chunks/routes/api/workshop/projects/_id/ledger.get.mjs +1 -1
  294. package/.output/server/chunks/routes/api/workshop/projects/_id/members/_userId_.delete.mjs +1 -1
  295. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/activity.get.mjs +1 -1
  296. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/route.get.mjs +1 -1
  297. package/.output/server/chunks/routes/api/workshop/projects/_id/observability/work-items/_wid_.get.mjs +1 -1
  298. package/.output/server/chunks/routes/api/workshop/projects/_id/observability.get.mjs +1 -1
  299. package/.output/server/chunks/routes/api/workshop/projects/_id/pause.post.mjs +1 -1
  300. package/.output/server/chunks/routes/api/workshop/projects/_id/plan/request-approval.post.mjs +1 -1
  301. package/.output/server/chunks/routes/api/workshop/projects/_id/proposals/_decisionId/apply.post.mjs +1 -1
  302. package/.output/server/chunks/routes/api/workshop/projects/_id/reconcile.post.mjs +1 -1
  303. package/.output/server/chunks/routes/api/workshop/projects/_id/report.get.mjs +1 -1
  304. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/request-acceptance.post.mjs +1 -1
  305. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/review.post.mjs +1 -1
  306. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/submit.post.mjs +1 -1
  307. package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/supersede.post.mjs +1 -1
  308. package/.output/server/chunks/routes/api/workshop/projects/_id/resume.post.mjs +1 -1
  309. package/.output/server/chunks/routes/api/workshop/projects/_id/sessions.get.mjs +1 -1
  310. package/.output/server/chunks/routes/api/workshop/projects/_id/snapshot.get.mjs +1 -1
  311. package/.output/server/chunks/routes/api/workshop/projects/_id/terminate.post.mjs +1 -1
  312. package/.output/server/chunks/routes/api/workshop/projects/_id/trace/_traceId_.get.mjs +1 -1
  313. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/cancel.post.mjs +1 -1
  314. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/dispatch.post.mjs +1 -1
  315. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/retry.post.mjs +1 -1
  316. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.get.mjs +1 -1
  317. package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.patch.mjs +1 -1
  318. package/.output/server/chunks/routes/api/workshop/projects/_id_.get.mjs +1 -1
  319. package/.output/server/chunks/routes/api/workshop/projects/_id_.patch.mjs +1 -1
  320. package/.output/server/chunks/routes/api/workshop/projects/instantiate.post.mjs +1 -1
  321. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
  322. package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
  323. package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs +44 -0
  324. package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs.map +1 -0
  325. package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs +38 -0
  326. package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs.map +1 -0
  327. package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
  328. package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +1 -1
  329. package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +1 -1
  330. package/.output/server/chunks/routes/api/workshop/tools/sync.post.mjs +1 -1
  331. package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
  332. package/.output/server/chunks/routes/api/workshop/ws/ticket.post.mjs +1 -1
  333. package/.output/server/chunks/routes/renderer.mjs +2 -2
  334. package/.output/server/chunks/virtual/entry.mjs +6 -2
  335. package/.output/server/chunks/virtual/precomputed.mjs +1 -1
  336. package/.output/server/package.json +1 -1
  337. package/README-zh.md +7 -7
  338. package/README.md +7 -7
  339. package/app/components/dcw/DcwNodesTable.vue +24 -0
  340. package/docs/mcp.en.md +30 -27
  341. package/docs/mcp.md +7 -3
  342. package/docs/plugins.en.md +4 -2
  343. package/docs/plugins.md +4 -2
  344. package/i18n/dicts/dcwDetail.json +221 -219
  345. package/i18n/locales/en.ts +2 -0
  346. package/i18n/locales/zh-CN.ts +2 -0
  347. package/package.json +2 -1
  348. package/scripts/check-docs-sync.mjs +20 -9
  349. package/scripts/onboarding/forge-channel.mjs +2 -1
  350. package/scripts/onboarding/lib.mjs +159 -3
  351. package/scripts/onboarding/onboard.mjs +2 -0
  352. package/scripts/onboarding/preflight.mjs +233 -231
  353. package/scripts/onboarding/provision-line.mjs +12 -2
  354. package/scripts/onboarding/sim-attest.mjs +103 -0
  355. package/scripts/onboarding/sim-twin.mjs +88 -4
  356. package/scripts/onboarding/test-connection.mjs +2 -1
  357. package/scripts/onboarding/v6-protected-api.mjs +41 -0
  358. package/scripts/onboarding/v6-protected-fixture.mjs +54 -0
  359. package/scripts/onboarding/verify-line.mjs +179 -136
  360. package/scripts/onboarding/verify-mirror.mjs +149 -145
  361. package/server/api/workshop/agent-tools/list.get.ts +10 -1
  362. package/server/api/workshop/tasks/[id]/recovery-disposition.post.ts +32 -0
  363. package/server/api/workshop/tasks/recovery-holds.get.ts +22 -0
  364. package/server/plugins-builtin/rag-bridge/index.mjs +20 -2
  365. package/server/services/workshop/agents/agent-interface.ts +3 -0
  366. package/server/services/workshop/agents/base-agent.ts +100 -4
  367. package/server/services/workshop/agents/execution-scope.ts +26 -0
  368. package/server/services/workshop/agents/hitl-capabilities.ts +3 -3
  369. package/server/services/workshop/agents/host-tool-bridge/dispatch.ts +42 -2
  370. package/server/services/workshop/agents/host-tool-bridge/tools/progress.ts +4 -0
  371. package/server/services/workshop/agents/host-tool-bridge/tools/tasks.ts +11 -28
  372. package/server/services/workshop/agents/host-tool-bridge/tools/team-delegation.ts +83 -129
  373. package/server/services/workshop/agents/industrial/dcw-tools.ts +27 -5
  374. package/server/services/workshop/agents/industrial/line-tools.ts +15 -4
  375. package/server/services/workshop/agents/industrial/ops-tools.ts +32 -6
  376. package/server/services/workshop/agents/industrial/optimization-tools.ts +16 -3
  377. package/server/services/workshop/agents/industrial/recipe-propose-tools.ts +26 -3
  378. package/server/services/workshop/agents/omp-agent/client.ts +2 -4
  379. package/server/services/workshop/agents/omp-agent/core.ts +3 -0
  380. package/server/services/workshop/agents/omp-agent/lifecycle.ts +70 -4
  381. package/server/services/workshop/agents/omp-agent/supervision-decision.ts +3 -1
  382. package/server/services/workshop/agents/omp-agent/tools-steer.ts +113 -32
  383. package/server/services/workshop/agents/tool-approvals.ts +113 -29
  384. package/server/services/workshop/agents/tool-classes.ts +72 -56
  385. package/server/services/workshop/db/database/open.ts +5 -2
  386. package/server/services/workshop/db/database/schema.ts +1 -0
  387. package/server/services/workshop/db/database/seed.ts +2 -2
  388. package/server/services/workshop/db/message.repo.ts +134 -26
  389. package/server/services/workshop/db/project-kernel.repo.ts +3 -3
  390. package/server/services/workshop/db/schema.sql +3 -1
  391. package/server/services/workshop/db/task.repo.ts +101 -0
  392. package/server/services/workshop/dcw/dcw-controller/actuation.ts +120 -9
  393. package/server/services/workshop/dcw/dcw-controller/contracts.ts +18 -16
  394. package/server/services/workshop/dcw/dcw-controller/crud.ts +23 -0
  395. package/server/services/workshop/dcw/dcw-controller/lines.ts +34 -2
  396. package/server/services/workshop/dcw/dcw-controller/recipes.ts +80 -6
  397. package/server/services/workshop/dcw/dcw-controller/state.ts +89 -88
  398. package/server/services/workshop/dcw/dcw-controller/types.ts +5 -0
  399. package/server/services/workshop/dcw/dcw-controller/write.ts +9 -6
  400. package/server/services/workshop/dcw/dcw-line.repo.ts +2 -0
  401. package/server/services/workshop/dcw/dcw-node.repo.ts +3 -1
  402. package/server/services/workshop/dcw/dcw-node.ts +346 -307
  403. package/server/services/workshop/dcw/dcw-runtime.ts +8 -4
  404. package/server/services/workshop/projects/effects.ts +47 -29
  405. package/server/services/workshop/projects/kernel.ts +8 -1
  406. package/server/services/workshop/projects/legacy-recovery.ts +36 -0
  407. package/server/services/workshop/projects/service.ts +15 -0
  408. package/server/services/workshop/runtime/agent-runtime/contracts.ts +1 -1
  409. package/server/services/workshop/runtime/agent-runtime/lifecycle.ts +7 -2
  410. package/server/services/workshop/runtime/agent-runtime/message-watchdog.ts +40 -0
  411. package/server/services/workshop/runtime/agent-runtime/message.ts +151 -21
  412. package/server/services/workshop/runtime/agent-runtime/state.ts +69 -13
  413. package/server/services/workshop/runtime/agent-runtime/supervise.ts +219 -42
  414. package/server/services/workshop/runtime/agent-runtime/types.ts +6 -0
  415. package/server/services/workshop/runtime/mailbox.ts +112 -21
  416. package/server/services/workshop/runtime/manager/admin-channel.ts +34 -22
  417. package/server/services/workshop/runtime/manager/host-tools.ts +18 -5
  418. package/server/services/workshop/runtime/manager/runtime-wiring.ts +101 -41
  419. package/server/services/workshop/runtime/manager/schedules.ts +3 -1
  420. package/server/services/workshop/runtime/manager/tasks.ts +41 -0
  421. package/server/services/workshop/runtime/memory/recall.ts +11 -4
  422. package/server/services/workshop/runtime/memory/types.ts +2 -0
  423. package/server/services/workshop/runtime/scheduler-loop/contracts.ts +29 -29
  424. package/server/services/workshop/runtime/scheduler-loop/execute.ts +7 -0
  425. package/server/services/workshop/runtime/scheduler-loop/rules.ts +3 -0
  426. package/server/services/workshop/runtime/scheduler-loop/snapshot.ts +10 -2
  427. package/server/services/workshop/runtime/scheduler-loop/state.ts +12 -0
  428. package/server/services/workshop/runtime/scheduler-loop/tick.ts +54 -5
  429. package/server/services/workshop/runtime/task-engine/create.ts +16 -0
  430. package/server/services/workshop/runtime/task-engine/helpers.ts +5 -0
  431. package/server/services/workshop/runtime/task-engine/legacy-recovery.ts +149 -0
  432. package/server/services/workshop/runtime/task-engine/lifecycle.ts +38 -1
  433. package/server/services/workshop/runtime/task-engine/transition.ts +4 -0
  434. package/server/services/workshop/runtime/task-engine/update.ts +6 -0
  435. package/server/services/workshop/runtime/task-engine/views.ts +61 -0
  436. package/shared/dcw-protocol/line.ts +4 -0
  437. package/.output/public/_nuxt/C8QlHux5.js +0 -1
  438. package/.output/public/_nuxt/_id_.0EnzA0aA.css +0 -1
  439. package/.output/public/_nuxt/builds/meta/846b9c03-1442-4fcb-b3fc-1d9484eaa41b.json +0 -1
  440. package/.output/server/chunks/build/_id_-C0vNEbts.mjs.map +0 -1
@@ -1,307 +1,346 @@
1
- import { maskDriverConfigSecrets } from '../../../../shared/daq-protocol'
2
- /**
3
- * DcwNode —— 数据写控制节点领域对象(与 DaqNode 对称)。
4
- *
5
- * 一个实例 = 一条工艺参数写通道:模板域(物理含义/单位/工艺安全量程)+ 驱动配置
6
- * (连接 + 工程量→原始值线性换算,系统封装)+ 绑定关系 + 写状态(value/lastAckAt/
7
- * writeState)。用户只操作工程量;PLC 原始值的换算/回读校验由运行时完成。
8
- * 序列化经 toRow/fromRow 对接持久化仓库(dcws.json)。
9
- */
10
-
11
- import { dcwKeyFromRef, type DcwDriverKind, type DcwNodeState, type DcwNodeView, type DataTransform } from '../../../../shared/dcw-protocol'
12
- import { findDcwTemplate } from './dcw-templates'
13
-
14
- interface DcwNodeOptions {
15
- id: string
16
- templateRef: string
17
- name?: string
18
- driver?: DcwDriverKind
19
- enabled?: boolean
20
- /** 保写周期 ms(心跳重下发;null = 仅手动下发) */
21
- holdIntervalMs?: number | null
22
- unit?: string
23
- decimals?: number
24
- min?: number
25
- max?: number
26
- deviceBindingId?: string | null
27
- /** 多对多绑定(权威):deviceIds 去重列表 */
28
- deviceIds?: string[]
29
- driverConfig?: Record<string, string | number | boolean>
30
- /** 数据语义标定钩子(encode:物理值 → PLC 设定值;回读经 decoder 校验) */
31
- transform?: DataTransform
32
- posX?: number
33
- posZ?: number
34
- /** 所属产线('' = 未分配) */
35
- lineId?: string
36
- /** 节点级工艺语义备注(覆盖模板 semantics;注入 Agent 上下文) */
37
- semantics?: string
38
- /** 周期读间隔 ms(null = 走网关默认;0 = 关闭周期读,仅手动读取) */
39
- readIntervalMs?: number | null
40
- /** 写入保持窗秒数(写成功后节点锁定该时长,防参数震荡;0 = 不锁;默认 60) */
41
- writeLockSeconds?: number
42
- /** 单次控制步长上限(工程量;undefined 采用量程 2% 默认值;null 显式关闭) */
43
- stepLimit?: number | null
44
- createdAt?: string
45
- }
46
-
47
- function normalizeStepLimit(value: number | null): number | null {
48
- if (value == null) return null
49
- const n = Number(value)
50
- if (!Number.isFinite(n) || n <= 0) return null
51
- return n
52
- }
53
-
54
- export class DcwNode {
55
- readonly id: string
56
- templateRef: string
57
- name: string
58
- driver: DcwDriverKind
59
- enabled: boolean
60
- holdIntervalMs: number | null
61
- unit: string
62
- decimals: number
63
- min: number
64
- max: number
65
- deviceBindingId: string | null
66
- /** 多对多设备绑定(权威字段;去重有序) */
67
- deviceIds: string[]
68
- driverConfig: Record<string, string | number | boolean>
69
- transform?: DataTransform
70
- posX?: number
71
- posZ?: number
72
- /** 当前设定值(工程量;null = 从未下发) */
73
- value: number | null = null
74
- /** PLC 当前读数(工程量物理值;null = 从未读到或驱动不支持读) */
75
- readValue: number | null = null
76
- lastReadAt: string | null = null
77
- lastReadError: string | null = null
78
- /** 周期读间隔 ms(null = 走网关默认;0 = 仅手动读取) */
79
- readIntervalMs: number | null = null
80
- /** 写入保持窗秒数(写成功后锁定;防参数频繁修改震荡;0 = 不锁) */
81
- writeLockSeconds = 30
82
- /** 单次控制步长上限(工程量);探索阶段必须有有限值 */
83
- stepLimit: number | null
84
- lastAckAt: string | null = null
85
- /** 最近一次**成功**下发(设备已证实/受理)的时刻;失败写不更新 */
86
- lastWriteAt: string | null = null
87
- /**
88
- * 最近一次**值发生变化**的成功下发时刻。
89
- * 60s 在线写间隔以此为准:保写心跳(holdIntervalMs)按周期重发同一设定值,
90
- * 若它刷新间隔基准,会让 Agent/试验计划的写入永远差 60s(实测活锁)。
91
- */
92
- lastChangeAt: string | null = null
93
- /** 最近一次写**尝试**的时刻(含失败);仅用于诊断/失败冷却,不参与 60s 成功间隔 */
94
- lastAttemptAt: string | null = null
95
- state: DcwNodeState = 'idle'
96
- /** 所属产线('' = 未分配;采集门控/写联锁/场景光晕按产线隔离) */
97
- lineId = ''
98
- /** 节点级工艺语义备注(覆盖模板 semantics) */
99
- semantics?: string
100
- lastError: string | null = null
101
- readonly createdAt: string
102
-
103
- constructor(o: DcwNodeOptions) {
104
- const tpl = findDcwTemplate(dcwKeyFromRef(o.templateRef))
105
- this.id = o.id
106
- this.templateRef = o.templateRef
107
- this.name = o.name ?? (tpl ? `${tpl.name}` : '控制节点')
108
- this.driver = o.driver ?? 'mock'
109
- this.enabled = o.enabled ?? true
110
- this.holdIntervalMs = o.holdIntervalMs ?? null
111
- this.unit = o.unit ?? tpl?.unit ?? ''
112
- this.decimals = o.decimals ?? tpl?.decimals ?? 2
113
- this.min = o.min ?? tpl?.min ?? 0
114
- this.max = o.max ?? tpl?.max ?? 100
115
- const legacyD = o.deviceBindingId ?? null
116
- this.deviceIds = [...new Set([...(o.deviceIds ?? []), ...(legacyD ? [legacyD] : [])])].filter(Boolean)
117
- this.deviceBindingId = this.deviceIds[0] ?? legacyD ?? null
118
- this.driverConfig = o.driverConfig ?? {}
119
- if (o.transform) this.transform = o.transform
120
- if (o.posX !== undefined) this.posX = o.posX
121
- if (o.posZ !== undefined) this.posZ = o.posZ
122
- this.lineId = o.lineId ?? ''
123
- this.semantics = o.semantics
124
- this.readIntervalMs = o.readIntervalMs ?? null
125
- this.writeLockSeconds = Math.max(0, Math.min(3600, Math.round(o.writeLockSeconds ?? 60)))
126
- const fallbackStep = Math.max(10 ** -this.decimals, (this.max - this.min) * 0.02)
127
- this.stepLimit = o.stepLimit === undefined ? Number(fallbackStep.toFixed(this.decimals)) : normalizeStepLimit(o.stepLimit)
128
- this.createdAt = o.createdAt ?? new Date().toISOString()
129
- }
130
-
131
- get templateKey(): string {
132
- return dcwKeyFromRef(this.templateRef)
133
- }
134
-
135
- /** 写入值工艺安全校验(越界即拒绝;返回错误消息或 null) */
136
- validateEng(v: number): string | null {
137
- if (!Number.isFinite(v)) return '设定值需为数字'
138
- if (v < this.min || v > this.max) {
139
- return `设定值 ${v}${this.unit} 越出工艺安全量程 [${this.min}, ${this.max}] ${this.unit}`
140
- }
141
- return null
142
- }
143
-
144
- /** 记录一次写 ACK(成功)/失败。
145
- * P0-1 失败写不占位:value 只承载「设备确认过的值」(成功取回读,缺失回退指令值)。
146
- * 此前失败写把从未被 PLC 接受的指令值占进 value —— 保写心跳按 value 周期重下发,
147
- * 会把幻影指令值反复写向设备(10-07 事故放大器);同时污染步长基准与回退账本 prevValue。 */
148
- applyWriteResult(eng: number, ok: boolean, message: string, at: string): void {
149
- // 尝试时间恒更新;成功时间只在设备证实/受理时更新 ——
150
- // 失败写不再占用 60s 成功间隔(现场瞬断恢复后可立即重试),失败冷却另由
151
- // write.ts 用 lastAttemptAt 做 5s 防轰炸。
152
- this.lastAttemptAt = at
153
- if (ok) {
154
- const prev = this.value
155
- this.lastWriteAt = at
156
- this.value = Number(eng.toFixed(this.decimals))
157
- // 只有真正改变设定值才推进 60s 间隔基准(同值保活写不算)
158
- if (prev == null || Math.abs(Number(prev) - this.value) > 1e-9) this.lastChangeAt = at
159
- this.lastAckAt = at
160
- this.state = 'ok'
161
- this.lastError = null
162
- }
163
- else {
164
- this.state = 'error'
165
- this.lastError = message
166
- }
167
- }
168
-
169
- /** 记录一次读数(成功回填物理值;失败仅记原因,旧读数保留供展示) */
170
- applyReadResult(eng: number | null, raw: number | null, ok: boolean, message: string, at: string): void {
171
- this.lastReadAt = at
172
- if (ok && eng != null) {
173
- this.readValue = Number(eng.toFixed(this.decimals))
174
- this.lastReadError = null
175
- }
176
- else {
177
- this.lastReadError = message
178
- }
179
- }
180
-
181
- toRow(): Record<string, unknown> {
182
- return {
183
- id: this.id,
184
- templateRef: this.templateRef,
185
- name: this.name,
186
- driver: this.driver,
187
- enabled: this.enabled,
188
- holdIntervalMs: this.holdIntervalMs,
189
- readIntervalMs: this.readIntervalMs,
190
- writeLockSeconds: this.writeLockSeconds,
191
- stepLimit: this.stepLimit,
192
- unit: this.unit,
193
- decimals: this.decimals,
194
- min: this.min,
195
- max: this.max,
196
- deviceBindingId: this.deviceBindingId,
197
- deviceIds: this.deviceIds,
198
- driverConfig: this.driverConfig,
199
- transform: this.transform,
200
- posX: this.posX,
201
- posZ: this.posZ,
202
- lineId: this.lineId,
203
- semantics: this.semantics,
204
- value: this.value,
205
- readValue: this.readValue,
206
- lastReadAt: this.lastReadAt,
207
- lastReadError: this.lastReadError,
208
- lastAckAt: this.lastAckAt,
209
- lastWriteAt: this.lastWriteAt,
210
- lastChangeAt: this.lastChangeAt,
211
- lastAttemptAt: this.lastAttemptAt,
212
- state: this.state,
213
- lastError: this.lastError,
214
- createdAt: this.createdAt,
215
- }
216
- }
217
-
218
- static fromRow(row: Record<string, unknown>): DcwNode {
219
- const node = new DcwNode({
220
- id: String(row.id),
221
- templateRef: String(row.templateRef ?? ''),
222
- name: row.name != null ? String(row.name) : undefined,
223
- driver: (row.driver as DcwDriverKind) ?? undefined,
224
- enabled: row.enabled === undefined ? undefined : Boolean(row.enabled),
225
- holdIntervalMs: row.holdIntervalMs == null ? null : Number(row.holdIntervalMs),
226
- unit: row.unit != null ? String(row.unit) : undefined,
227
- decimals: row.decimals != null ? Number(row.decimals) : undefined,
228
- min: row.min != null ? Number(row.min) : undefined,
229
- max: row.max != null ? Number(row.max) : undefined,
230
- deviceBindingId: row.deviceBindingId === undefined ? undefined : (row.deviceBindingId == null ? null : String(row.deviceBindingId)),
231
- deviceIds: Array.isArray(row.deviceIds) ? row.deviceIds.map(String).filter(Boolean) : undefined,
232
- driverConfig: (row.driverConfig as Record<string, string | number | boolean>) ?? {},
233
- transform: (row.transform as DataTransform | undefined) ?? undefined,
234
- posX: row.posX == null ? undefined : Number(row.posX),
235
- lineId: row.lineId == null ? '' : String(row.lineId),
236
- semantics: row.semantics == null ? undefined : String(row.semantics),
237
- readIntervalMs: row.readIntervalMs == null ? null : Number(row.readIntervalMs),
238
- writeLockSeconds: row.writeLockSeconds == null ? undefined : Number(row.writeLockSeconds),
239
- stepLimit: row.stepLimit === undefined ? undefined : (row.stepLimit == null ? null : Number(row.stepLimit)),
240
- posZ: row.posZ == null ? undefined : Number(row.posZ),
241
- createdAt: row.createdAt != null ? String(row.createdAt) : undefined,
242
- })
243
- if (row.value != null && !Number.isNaN(Number(row.value))) node.value = Number(row.value)
244
- if (row.readValue != null && !Number.isNaN(Number(row.readValue))) node.readValue = Number(row.readValue)
245
- if (row.lastReadAt != null) node.lastReadAt = String(row.lastReadAt)
246
- if (row.lastReadError != null) node.lastReadError = String(row.lastReadError)
247
- if (row.lastAckAt != null) node.lastAckAt = String(row.lastAckAt)
248
- if (row.lastWriteAt != null) node.lastWriteAt = String(row.lastWriteAt)
249
- if (row.lastChangeAt != null) node.lastChangeAt = String(row.lastChangeAt)
250
- if (row.lastAttemptAt != null) node.lastAttemptAt = String(row.lastAttemptAt)
251
- // 旧快照兼容:历史 lastWriteAt 是「尝试时间」语义,补一份到 lastAttemptAt
252
- else if (row.lastWriteAt != null) node.lastAttemptAt = String(row.lastWriteAt)
253
- if (row.state != null) {
254
- const restored = String(row.state)
255
- // 持久化恢复消毒:'writing' 是进程内瞬态(写事务在飞)。若被快照带出后进程
256
- // 硬杀重启,原样恢复会让该节点所有写永久 409(startAll 只复位 offline)。
257
- // 归一为 error:写路径放行,同时显式提示"上次写入结果未知,需核销"。
258
- if (restored === 'writing') {
259
- node.state = 'error'
260
- node.lastError = node.lastError || '进程中断于写入,状态已复位为 error(上次写入结果未知,请回读核销)'
261
- }
262
- else {
263
- node.state = restored as DcwNodeState
264
- }
265
- }
266
- if (row.lastError != null) node.lastError = String(row.lastError)
267
- return node
268
- }
269
-
270
- toView(): DcwNodeView {
271
- return {
272
- id: this.id,
273
- templateRef: this.templateRef,
274
- name: this.name,
275
- driver: this.driver,
276
- enabled: this.enabled,
277
- holdIntervalMs: this.holdIntervalMs,
278
- unit: this.unit,
279
- decimals: this.decimals,
280
- min: this.min,
281
- max: this.max,
282
- deviceBindingId: this.deviceBindingId,
283
- deviceIds: this.deviceIds,
284
- // 凭据脱敏(同 daq 侧 toView;toRow 持久化不掩码)
285
- driverConfig: maskDriverConfigSecrets(this.driverConfig),
286
- transform: this.transform,
287
- posX: this.posX,
288
- posZ: this.posZ,
289
- lineId: this.lineId,
290
- semantics: this.semantics,
291
- value: this.value,
292
- readValue: this.readValue,
293
- lastReadAt: this.lastReadAt,
294
- lastReadError: this.lastReadError,
295
- readIntervalMs: this.readIntervalMs,
296
- writeLockSeconds: this.writeLockSeconds,
297
- stepLimit: this.stepLimit,
298
- lastAckAt: this.lastAckAt,
299
- lastWriteAt: this.lastWriteAt,
300
- lastChangeAt: this.lastChangeAt,
301
- lastAttemptAt: this.lastAttemptAt,
302
- state: this.state,
303
- lastError: this.lastError,
304
- createdAt: this.createdAt,
305
- }
306
- }
307
- }
1
+ import { maskDriverConfigSecrets } from '../../../../shared/daq-protocol'
2
+ /**
3
+ * DcwNode —— 数据写控制节点领域对象(与 DaqNode 对称)。
4
+ *
5
+ * 一个实例 = 一条工艺参数写通道:模板域(物理含义/单位/工艺安全量程)+ 驱动配置
6
+ * (连接 + 工程量→原始值线性换算,系统封装)+ 绑定关系 + 写状态(value/lastAckAt/
7
+ * writeState)。用户只操作工程量;PLC 原始值的换算/回读校验由运行时完成。
8
+ * 序列化经 toRow/fromRow 对接持久化仓库(dcws.json)。
9
+ */
10
+
11
+ import { dcwKeyFromRef, type DcwDriverKind, type DcwNodeState, type DcwNodeView, type DataTransform } from '../../../../shared/dcw-protocol'
12
+ import { findDcwTemplate } from './dcw-templates'
13
+
14
+ /**
15
+ * transport-ack 节点的保写观测证实声明(与 V3 验收 ACK 口径同源):
16
+ * 写被 broker 受理后,以独立 DAQ 观测节点跟随到目标值作为「设备侧生效」证据,
17
+ * 证实通过才解除保写安全锁(holdBlocked)。无此声明的 transport-ack 节点保写
18
+ * 保持挂起并显式提示 —— 链路受理本身不是设备生效证据。
19
+ */
20
+ export interface DcwHoldObserve {
21
+ /** 独立观测 DAQ 节点 id(物理量跟随证据源) */
22
+ daqId: string
23
+ /** 观测跟随容差(工程量;缺省 max(0.5, |目标|×2%),与 V3 观测口径一致) */
24
+ tolerance?: number
25
+ /** 观测证实超时 ms(缺省 45000;超时保写保持挂起并提示) */
26
+ timeoutMs?: number
27
+ }
28
+
29
+ interface DcwNodeOptions {
30
+ id: string
31
+ templateRef: string
32
+ name?: string
33
+ driver?: DcwDriverKind
34
+ enabled?: boolean
35
+ /** 保写周期 ms(心跳重下发;null = 仅手动下发) */
36
+ holdIntervalMs?: number | null
37
+ /** transport-ack 写的观测证实声明(缺省 null = 链路受理不构成保写解除证据) */
38
+ holdObserve?: DcwHoldObserve | null
39
+ unit?: string
40
+ decimals?: number
41
+ min?: number
42
+ max?: number
43
+ deviceBindingId?: string | null
44
+ /** 多对多绑定(权威):deviceIds 去重列表 */
45
+ deviceIds?: string[]
46
+ driverConfig?: Record<string, string | number | boolean>
47
+ /** 数据语义标定钩子(encode:物理值 → PLC 设定值;回读经 decoder 校验) */
48
+ transform?: DataTransform
49
+ posX?: number
50
+ posZ?: number
51
+ /** 所属产线('' = 未分配) */
52
+ lineId?: string
53
+ /** 节点级工艺语义备注(覆盖模板 semantics;注入 Agent 上下文) */
54
+ semantics?: string
55
+ /** 周期读间隔 ms(null = 走网关默认;0 = 关闭周期读,仅手动读取) */
56
+ readIntervalMs?: number | null
57
+ /** 写入保持窗秒数(写成功后节点锁定该时长,防参数震荡;0 = 不锁;默认 60) */
58
+ writeLockSeconds?: number
59
+ /** 单次控制步长上限(工程量;undefined 采用量程 2% 默认值;null 显式关闭) */
60
+ stepLimit?: number | null
61
+ createdAt?: string
62
+ }
63
+
64
+ function normalizeStepLimit(value: number | null): number | null {
65
+ if (value == null) return null
66
+ const n = Number(value)
67
+ if (!Number.isFinite(n) || n <= 0) return null
68
+ return n
69
+ }
70
+
71
+ /** 快照恢复守卫:形态不合法的 holdObserve 一律按 null(未声明)处理,fail-safe。 */
72
+ function isDcwHoldObserve(value: unknown): value is DcwHoldObserve {
73
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return false
74
+ const o = value as Record<string, unknown>
75
+ if (typeof o.daqId !== 'string' || !/^[A-Za-z0-9_-]+$/.test(o.daqId)) return false
76
+ if (o.tolerance !== undefined && (!Number.isFinite(Number(o.tolerance)) || Number(o.tolerance) <= 0)) return false
77
+ if (o.timeoutMs !== undefined && (!Number.isFinite(Number(o.timeoutMs)) || Number(o.timeoutMs) < 250 || Number(o.timeoutMs) > 600_000)) return false
78
+ return true
79
+ }
80
+
81
+ export class DcwNode {
82
+ readonly id: string
83
+ templateRef: string
84
+ name: string
85
+ driver: DcwDriverKind
86
+ enabled: boolean
87
+ holdIntervalMs: number | null
88
+ /** transport-ack 保写观测证实声明(null = 链路受理不构成保写解除证据) */
89
+ holdObserve: DcwHoldObserve | null
90
+ unit: string
91
+ decimals: number
92
+ min: number
93
+ max: number
94
+ deviceBindingId: string | null
95
+ /** 多对多设备绑定(权威字段;去重有序) */
96
+ deviceIds: string[]
97
+ driverConfig: Record<string, string | number | boolean>
98
+ transform?: DataTransform
99
+ posX?: number
100
+ posZ?: number
101
+ /** 当前设定值(工程量;null = 从未下发) */
102
+ value: number | null = null
103
+ /** Hold is blocked until a later write is confirmed by physical readback. */
104
+ holdBlocked = false
105
+ /** PLC 当前读数(工程量物理值;null = 从未读到或驱动不支持读) */
106
+ readValue: number | null = null
107
+ lastReadAt: string | null = null
108
+ lastReadError: string | null = null
109
+ /** 周期读间隔 ms(null = 走网关默认;0 = 仅手动读取) */
110
+ readIntervalMs: number | null = null
111
+ /** 写入保持窗秒数(写成功后锁定;防参数频繁修改震荡;0 = 不锁) */
112
+ writeLockSeconds = 30
113
+ /** 单次控制步长上限(工程量);探索阶段必须有有限值 */
114
+ stepLimit: number | null
115
+ lastAckAt: string | null = null
116
+ /** 最近一次**成功**下发(设备已证实/受理)的时刻;失败写不更新 */
117
+ lastWriteAt: string | null = null
118
+ /**
119
+ * 最近一次**值发生变化**的成功下发时刻。
120
+ * 60s 在线写间隔以此为准:保写心跳(holdIntervalMs)按周期重发同一设定值,
121
+ * 若它刷新间隔基准,会让 Agent/试验计划的写入永远差 60s(实测活锁)。
122
+ */
123
+ lastChangeAt: string | null = null
124
+ /** 最近一次写**尝试**的时刻(含失败);仅用于诊断/失败冷却,不参与 60s 成功间隔 */
125
+ lastAttemptAt: string | null = null
126
+ state: DcwNodeState = 'idle'
127
+ /** 所属产线('' = 未分配;采集门控/写联锁/场景光晕按产线隔离) */
128
+ lineId = ''
129
+ /** 节点级工艺语义备注(覆盖模板 semantics) */
130
+ semantics?: string
131
+ lastError: string | null = null
132
+ readonly createdAt: string
133
+
134
+ constructor(o: DcwNodeOptions) {
135
+ const tpl = findDcwTemplate(dcwKeyFromRef(o.templateRef))
136
+ this.id = o.id
137
+ this.templateRef = o.templateRef
138
+ this.name = o.name ?? (tpl ? `${tpl.name}` : '控制节点')
139
+ this.driver = o.driver ?? 'mock'
140
+ this.enabled = o.enabled ?? true
141
+ this.holdIntervalMs = o.holdIntervalMs ?? null
142
+ this.holdObserve = o.holdObserve ?? null
143
+ this.unit = o.unit ?? tpl?.unit ?? ''
144
+ this.decimals = o.decimals ?? tpl?.decimals ?? 2
145
+ this.min = o.min ?? tpl?.min ?? 0
146
+ this.max = o.max ?? tpl?.max ?? 100
147
+ const legacyD = o.deviceBindingId ?? null
148
+ this.deviceIds = [...new Set([...(o.deviceIds ?? []), ...(legacyD ? [legacyD] : [])])].filter(Boolean)
149
+ this.deviceBindingId = this.deviceIds[0] ?? legacyD ?? null
150
+ this.driverConfig = o.driverConfig ?? {}
151
+ if (o.transform) this.transform = o.transform
152
+ if (o.posX !== undefined) this.posX = o.posX
153
+ if (o.posZ !== undefined) this.posZ = o.posZ
154
+ this.lineId = o.lineId ?? ''
155
+ this.semantics = o.semantics
156
+ this.readIntervalMs = o.readIntervalMs ?? null
157
+ this.writeLockSeconds = Math.max(0, Math.min(3600, Math.round(o.writeLockSeconds ?? 60)))
158
+ const fallbackStep = Math.max(10 ** -this.decimals, (this.max - this.min) * 0.02)
159
+ this.stepLimit = o.stepLimit === undefined ? Number(fallbackStep.toFixed(this.decimals)) : normalizeStepLimit(o.stepLimit)
160
+ this.createdAt = o.createdAt ?? new Date().toISOString()
161
+ }
162
+
163
+ get templateKey(): string {
164
+ return dcwKeyFromRef(this.templateRef)
165
+ }
166
+
167
+ /** 写入值工艺安全校验(越界即拒绝;返回错误消息或 null) */
168
+ validateEng(v: number): string | null {
169
+ if (!Number.isFinite(v)) return '设定值需为数字'
170
+ if (v < this.min || v > this.max) {
171
+ return `设定值 ${v}${this.unit} 越出工艺安全量程 [${this.min}, ${this.max}] ${this.unit}`
172
+ }
173
+ return null
174
+ }
175
+
176
+ /** 记录一次写 ACK(成功)/失败。
177
+ * P0-1 失败写不占位:value 只承载「设备确认过的值」(成功取回读,缺失回退指令值)。
178
+ * 此前失败写把从未被 PLC 接受的指令值占进 value —— 保写心跳按 value 周期重下发,
179
+ * 会把幻影指令值反复写向设备(10-07 事故放大器);同时污染步长基准与回退账本 prevValue。 */
180
+ applyWriteResult(eng: number, ok: boolean, message: string, at: string): void {
181
+ // 尝试时间恒更新;成功时间只在设备证实/受理时更新 ——
182
+ // 失败写不再占用 60s 成功间隔(现场瞬断恢复后可立即重试),失败冷却另由
183
+ // write.ts 用 lastAttemptAt 做 5s 防轰炸。
184
+ this.lastAttemptAt = at
185
+ if (ok) {
186
+ const prev = this.value
187
+ this.lastWriteAt = at
188
+ this.value = Number(eng.toFixed(this.decimals))
189
+ // 只有真正改变设定值才推进 60s 间隔基准(同值保活写不算)
190
+ if (prev == null || Math.abs(Number(prev) - this.value) > 1e-9) this.lastChangeAt = at
191
+ this.lastAckAt = at
192
+ this.state = 'ok'
193
+ this.lastError = null
194
+ }
195
+ else {
196
+ this.state = 'error'
197
+ this.lastError = message
198
+ }
199
+ }
200
+
201
+ /** 记录一次读数(成功回填物理值;失败仅记原因,旧读数保留供展示) */
202
+ applyReadResult(eng: number | null, raw: number | null, ok: boolean, message: string, at: string): void {
203
+ this.lastReadAt = at
204
+ if (ok && eng != null) {
205
+ this.readValue = Number(eng.toFixed(this.decimals))
206
+ this.lastReadError = null
207
+ }
208
+ else {
209
+ this.lastReadError = message
210
+ }
211
+ }
212
+
213
+ toRow(): Record<string, unknown> {
214
+ return {
215
+ id: this.id,
216
+ templateRef: this.templateRef,
217
+ name: this.name,
218
+ driver: this.driver,
219
+ enabled: this.enabled,
220
+ holdIntervalMs: this.holdIntervalMs,
221
+ holdObserve: this.holdObserve,
222
+ holdBlocked: this.holdBlocked,
223
+ readIntervalMs: this.readIntervalMs,
224
+ writeLockSeconds: this.writeLockSeconds,
225
+ stepLimit: this.stepLimit,
226
+ unit: this.unit,
227
+ decimals: this.decimals,
228
+ min: this.min,
229
+ max: this.max,
230
+ deviceBindingId: this.deviceBindingId,
231
+ deviceIds: this.deviceIds,
232
+ driverConfig: this.driverConfig,
233
+ transform: this.transform,
234
+ posX: this.posX,
235
+ posZ: this.posZ,
236
+ lineId: this.lineId,
237
+ semantics: this.semantics,
238
+ value: this.value,
239
+ readValue: this.readValue,
240
+ lastReadAt: this.lastReadAt,
241
+ lastReadError: this.lastReadError,
242
+ lastAckAt: this.lastAckAt,
243
+ lastWriteAt: this.lastWriteAt,
244
+ lastChangeAt: this.lastChangeAt,
245
+ lastAttemptAt: this.lastAttemptAt,
246
+ state: this.state,
247
+ lastError: this.lastError,
248
+ createdAt: this.createdAt,
249
+ }
250
+ }
251
+
252
+ static fromRow(row: Record<string, unknown>): DcwNode {
253
+ const node = new DcwNode({
254
+ id: String(row.id),
255
+ templateRef: String(row.templateRef ?? ''),
256
+ name: row.name != null ? String(row.name) : undefined,
257
+ driver: (row.driver as DcwDriverKind) ?? undefined,
258
+ enabled: row.enabled === undefined ? undefined : Boolean(row.enabled),
259
+ holdIntervalMs: row.holdIntervalMs == null ? null : Number(row.holdIntervalMs),
260
+ holdObserve: isDcwHoldObserve(row.holdObserve) ? row.holdObserve : null,
261
+ unit: row.unit != null ? String(row.unit) : undefined,
262
+ decimals: row.decimals != null ? Number(row.decimals) : undefined,
263
+ min: row.min != null ? Number(row.min) : undefined,
264
+ max: row.max != null ? Number(row.max) : undefined,
265
+ deviceBindingId: row.deviceBindingId === undefined ? undefined : (row.deviceBindingId == null ? null : String(row.deviceBindingId)),
266
+ deviceIds: Array.isArray(row.deviceIds) ? row.deviceIds.map(String).filter(Boolean) : undefined,
267
+ driverConfig: (row.driverConfig as Record<string, string | number | boolean>) ?? {},
268
+ transform: (row.transform as DataTransform | undefined) ?? undefined,
269
+ posX: row.posX == null ? undefined : Number(row.posX),
270
+ lineId: row.lineId == null ? '' : String(row.lineId),
271
+ semantics: row.semantics == null ? undefined : String(row.semantics),
272
+ readIntervalMs: row.readIntervalMs == null ? null : Number(row.readIntervalMs),
273
+ writeLockSeconds: row.writeLockSeconds == null ? undefined : Number(row.writeLockSeconds),
274
+ stepLimit: row.stepLimit === undefined ? undefined : (row.stepLimit == null ? null : Number(row.stepLimit)),
275
+ posZ: row.posZ == null ? undefined : Number(row.posZ),
276
+ createdAt: row.createdAt != null ? String(row.createdAt) : undefined,
277
+ })
278
+ node.holdBlocked = row.holdBlocked === true
279
+ if (row.value != null && !Number.isNaN(Number(row.value))) node.value = Number(row.value)
280
+ if (row.readValue != null && !Number.isNaN(Number(row.readValue))) node.readValue = Number(row.readValue)
281
+ if (row.lastReadAt != null) node.lastReadAt = String(row.lastReadAt)
282
+ if (row.lastReadError != null) node.lastReadError = String(row.lastReadError)
283
+ if (row.lastAckAt != null) node.lastAckAt = String(row.lastAckAt)
284
+ if (row.lastWriteAt != null) node.lastWriteAt = String(row.lastWriteAt)
285
+ if (row.lastChangeAt != null) node.lastChangeAt = String(row.lastChangeAt)
286
+ if (row.lastAttemptAt != null) node.lastAttemptAt = String(row.lastAttemptAt)
287
+ // 旧快照兼容:历史 lastWriteAt 是「尝试时间」语义,补一份到 lastAttemptAt
288
+ else if (row.lastWriteAt != null) node.lastAttemptAt = String(row.lastWriteAt)
289
+ if (row.state != null) {
290
+ const restored = String(row.state)
291
+ // 持久化恢复消毒:'writing' 是进程内瞬态(写事务在飞)。若被快照带出后进程
292
+ // 硬杀重启,原样恢复会让该节点所有写永久 409(startAll 只复位 offline)。
293
+ // 归一为 error:写路径放行,同时显式提示"上次写入结果未知,需核销"。
294
+ if (restored === 'writing') {
295
+ node.holdBlocked = true
296
+ node.state = 'error'
297
+ node.lastError = node.lastError || '进程中断于写入,状态已复位为 error(上次写入结果未知,请回读核销)'
298
+ }
299
+ else {
300
+ node.state = restored as DcwNodeState
301
+ }
302
+ }
303
+ if (row.lastError != null) node.lastError = String(row.lastError)
304
+ return node
305
+ }
306
+
307
+ toView(): DcwNodeView {
308
+ return {
309
+ id: this.id,
310
+ templateRef: this.templateRef,
311
+ name: this.name,
312
+ driver: this.driver,
313
+ enabled: this.enabled,
314
+ holdIntervalMs: this.holdIntervalMs,
315
+ holdBlocked: this.holdBlocked,
316
+ holdObserve: this.holdObserve,
317
+ unit: this.unit,
318
+ decimals: this.decimals,
319
+ min: this.min,
320
+ max: this.max,
321
+ deviceBindingId: this.deviceBindingId,
322
+ deviceIds: this.deviceIds,
323
+ // 凭据脱敏(同 daq 侧 toView;toRow 持久化不掩码)
324
+ driverConfig: maskDriverConfigSecrets(this.driverConfig),
325
+ transform: this.transform,
326
+ posX: this.posX,
327
+ posZ: this.posZ,
328
+ lineId: this.lineId,
329
+ semantics: this.semantics,
330
+ value: this.value,
331
+ readValue: this.readValue,
332
+ lastReadAt: this.lastReadAt,
333
+ lastReadError: this.lastReadError,
334
+ readIntervalMs: this.readIntervalMs,
335
+ writeLockSeconds: this.writeLockSeconds,
336
+ stepLimit: this.stepLimit,
337
+ lastAckAt: this.lastAckAt,
338
+ lastWriteAt: this.lastWriteAt,
339
+ lastChangeAt: this.lastChangeAt,
340
+ lastAttemptAt: this.lastAttemptAt,
341
+ state: this.state,
342
+ lastError: this.lastError,
343
+ createdAt: this.createdAt,
344
+ }
345
+ }
346
+ }