agentworkshop 0.7.5 → 0.7.7
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.
- package/.AgentWorkShop/prompts/host-tools.json +1 -1
- package/.output/.AgentWorkShop/prompts/host-tools.json +1 -1
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{rzGB_ojX.js → 3612gD2V.js} +2 -2
- package/.output/public/_nuxt/8eIQAVlb.js +1 -0
- package/.output/public/_nuxt/Ah9qOv1m.js +1 -0
- package/.output/public/_nuxt/{DdPeifHR.js → B4Fia4FB.js} +1 -1
- package/.output/public/_nuxt/B7aqqzkY.js +1 -0
- package/.output/public/_nuxt/BJ-fxrSw.js +1 -0
- package/.output/public/_nuxt/{DPDqAD1e.js → BSXx2vqR.js} +1 -1
- package/.output/public/_nuxt/{CdSgfcYR.js → BVZjSVs2.js} +1 -1
- package/.output/public/_nuxt/{DP6bdyIp.js → BVzDoF8t.js} +1 -1
- package/.output/public/_nuxt/BYL0Rjqj.js +7 -0
- package/.output/public/_nuxt/{CXmkVXS5.js → BjVLsC3M.js} +1 -1
- package/.output/public/_nuxt/{7ZABjMRh2.js → BkfchkK62.js} +1 -1
- package/.output/public/_nuxt/BnVoQ74r.js +1 -0
- package/.output/public/_nuxt/Bnp4vIAf.js +1 -0
- package/.output/public/_nuxt/BsMpJf7S.js +70 -0
- package/.output/public/_nuxt/{Z8k0uMSI.js → Bt_HDizI.js} +1 -1
- package/.output/public/_nuxt/Bu-P92Pe.js +18 -0
- package/.output/public/_nuxt/ButLXkjo.js +2 -0
- package/.output/public/_nuxt/C-GarxYC.js +1 -0
- package/.output/public/_nuxt/{D8DDDzV62.js → C2iWjzEC2.js} +1 -1
- package/.output/public/_nuxt/{HWXLx5Hz.js → C8dxXc6K.js} +5 -5
- package/.output/public/_nuxt/CGdPdJPP.js +1 -0
- package/.output/public/_nuxt/{CyygA0q4.js → CQiKcuoG.js} +4 -4
- package/.output/public/_nuxt/{CN7Zh8GQ.js → CRGlf1Gb.js} +1 -1
- package/.output/public/_nuxt/{DSBfvCi5.js → CblLEiCZ.js} +7 -7
- package/.output/public/_nuxt/Cd15nPnG2.js +1 -0
- package/.output/public/_nuxt/{OwJ1LJkF.js → CsCpu2Zh.js} +1 -1
- package/.output/public/_nuxt/CvbHIGQY2.js +1 -0
- package/.output/public/_nuxt/Cyk3du4K2.js +1 -0
- package/.output/public/_nuxt/{DVQAz9WI.js → D4qXvjuV.js} +2 -2
- package/.output/public/_nuxt/{CfIXY-ET.js → DCEyMaN-.js} +1 -1
- package/.output/public/_nuxt/{BFYNhG9S.js → DCXIGxzT.js} +1 -1
- package/.output/public/_nuxt/{B9aPoQvt.js → DM8DS9MA.js} +1 -1
- package/.output/public/_nuxt/{ChnfyQHz.js → DNzaswei.js} +1 -1
- package/.output/public/_nuxt/{CrFGZYVB2.js → DYZBdSSg2.js} +1 -1
- package/.output/public/_nuxt/{dObsRdSQ.js → DZk24ego.js} +1 -1
- package/.output/public/_nuxt/DeYsUzhr.js +1 -0
- package/.output/public/_nuxt/Dk6pq9JB2.js +1 -0
- package/.output/public/_nuxt/{ByGNWgAr.js → Do88WZG2.js} +3 -3
- package/.output/public/_nuxt/{R_WxTozV2.js → Du-eSpo2.js} +1 -1
- package/.output/public/_nuxt/OmpTerminalPanel.B_Pl5Ynm.css +1 -0
- package/.output/public/_nuxt/{Bsc69G4x.js → VnIWJ0ts.js} +3 -3
- package/.output/public/_nuxt/_id_.BzKMZnLe.css +1 -0
- package/.output/public/_nuxt/_id_.CbpDAWRh.css +1 -0
- package/.output/public/_nuxt/{_wsId_.DET_GinP.css → _wsId_.COUzMXpP.css} +1 -1
- package/.output/public/_nuxt/agents.BlejnOOC.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/14df171d-89cb-43ec-ad6f-9df72d6da7f5.json +1 -0
- package/.output/public/_nuxt/daq.zZ8GR433.css +1 -0
- package/.output/public/_nuxt/{default.D17kXlD6.css → default.V3_hUJq1.css} +1 -1
- package/.output/public/_nuxt/{B4GHHF6d2.js → fQUs58kX2.js} +1 -1
- package/.output/public/_nuxt/p7wSGMtc.js +1 -0
- package/.output/public/_nuxt/tRBT-plo.js +1 -0
- package/.output/server/chunks/_/SearchOutlined.mjs +4 -4
- package/.output/server/chunks/_/SearchOutlined.mjs.map +1 -1
- package/.output/server/chunks/_/character-asset.repo.mjs +3 -6
- package/.output/server/chunks/_/character-asset.repo.mjs.map +1 -1
- package/.output/server/chunks/_/host-bindings.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +4967 -2035
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/_/scene-layout.repo.mjs +4 -10
- package/.output/server/chunks/_/scene-layout.repo.mjs.map +1 -1
- package/.output/server/chunks/build/{Col-D7fjGDF6.mjs → Col-biaNnEPf.mjs} +2 -2
- package/.output/server/chunks/build/{Col-D7fjGDF6.mjs.map → Col-biaNnEPf.mjs.map} +1 -1
- package/.output/server/chunks/build/{OmpTerminalPanel-B_SYhmgb.mjs → OmpTerminalPanel-COphA1br.mjs} +20 -19
- package/.output/server/chunks/build/OmpTerminalPanel-COphA1br.mjs.map +1 -0
- package/.output/server/chunks/build/{TownView-Bl8Gkcxi.mjs → TownView-B5KifIaT.mjs} +4 -4
- package/.output/server/chunks/build/{TownView-Bl8Gkcxi.mjs.map → TownView-B5KifIaT.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-GnRJPykX.mjs → _id_-C-ewLgfl.mjs} +119 -119
- package/.output/server/chunks/build/{_id_-GnRJPykX.mjs.map → _id_-C-ewLgfl.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-CWLFGZjV.mjs → _id_-Ct4Jhvl1.mjs} +42 -38
- package/.output/server/chunks/build/_id_-Ct4Jhvl1.mjs.map +1 -0
- package/.output/server/chunks/build/{_wsId_-BhQMjyHG.mjs → _wsId_-CanI_6Su.mjs} +591 -53
- package/.output/server/chunks/build/{_wsId_-BhQMjyHG.mjs.map → _wsId_-CanI_6Su.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents-D4l1icvn.mjs → agents-DSOptxXA.mjs} +146 -91
- package/.output/server/chunks/build/agents-DSOptxXA.mjs.map +1 -0
- package/.output/server/chunks/build/{alert-gH-s7yIh.mjs → alert-qJnjyRcP.mjs} +3 -3
- package/.output/server/chunks/build/{alert-gH-s7yIh.mjs.map → alert-qJnjyRcP.mjs.map} +1 -1
- package/.output/server/chunks/build/{button-BhbX5ACI.mjs → button-DEcZFcqN.mjs} +3 -3
- package/.output/server/chunks/build/{button-BhbX5ACI.mjs.map → button-DEcZFcqN.mjs.map} +1 -1
- package/.output/server/chunks/build/{card-l4BbX67w.mjs → card-Dipvaykh.mjs} +5 -5
- package/.output/server/chunks/build/{card-l4BbX67w.mjs.map → card-Dipvaykh.mjs.map} +1 -1
- package/.output/server/chunks/build/{channel-templates-DqjtC-R0.mjs → channel-templates-BK0KuPOd.mjs} +13 -12
- package/.output/server/chunks/build/channel-templates-BK0KuPOd.mjs.map +1 -0
- package/.output/server/chunks/build/{checkbox-BF11p3dH.mjs → checkbox-dzcpU_Cd.mjs} +4 -4
- package/.output/server/chunks/build/{checkbox-BF11p3dH.mjs.map → checkbox-dzcpU_Cd.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-BOgpn9sl.mjs → daq-D9RA_uze.mjs} +102 -102
- package/.output/server/chunks/build/{daq-BOgpn9sl.mjs.map → daq-D9RA_uze.mjs.map} +1 -1
- package/.output/server/chunks/build/dcw-BTM5YU-B.mjs +1 -1
- package/.output/server/chunks/build/{default-CKJWhkot.mjs → default-BfWGTlbj.mjs} +81 -23
- package/.output/server/chunks/build/{default-CKJWhkot.mjs.map → default-BfWGTlbj.mjs.map} +1 -1
- package/.output/server/chunks/build/{drawer-CVValqoh.mjs → drawer-Cmh90erI.mjs} +3 -3
- package/.output/server/chunks/build/{drawer-CVValqoh.mjs.map → drawer-Cmh90erI.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-ByCsEWlQ.mjs → dropdown-CGQ0KAzA.mjs} +2 -2
- package/.output/server/chunks/build/{dropdown-ByCsEWlQ.mjs.map → dropdown-CGQ0KAzA.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-Dex8PXu6.mjs → dropdown-vhn1NPFs.mjs} +4 -4
- package/.output/server/chunks/build/{dropdown-Dex8PXu6.mjs.map → dropdown-vhn1NPFs.mjs.map} +1 -1
- package/.output/server/chunks/build/{input-number-BBlRoAJ7.mjs → input-number-Bd55elNN.mjs} +5 -5
- package/.output/server/chunks/build/{input-number-BBlRoAJ7.mjs.map → input-number-Bd55elNN.mjs.map} +1 -1
- package/.output/server/chunks/build/{input--KMeLYqZ.mjs → input-sf_BT6o6.mjs} +3 -3
- package/.output/server/chunks/build/{input--KMeLYqZ.mjs.map → input-sf_BT6o6.mjs.map} +1 -1
- package/.output/server/chunks/build/logs-Dyk0I2I9.mjs +1 -1
- package/.output/server/chunks/build/{menu-xN-SXb9Q.mjs → menu-WCrlpYVh.mjs} +3 -3
- package/.output/server/chunks/build/{menu-xN-SXb9Q.mjs.map → menu-WCrlpYVh.mjs.map} +1 -1
- package/.output/server/chunks/build/{modal-DrCOcjrl.mjs → modal-yvUquPj5.mjs} +4 -4
- package/.output/server/chunks/build/{modal-DrCOcjrl.mjs.map → modal-yvUquPj5.mjs.map} +1 -1
- package/.output/server/chunks/build/{monitor-KW8WLOJd.mjs → monitor-MIOvsyLa.mjs} +21 -21
- package/.output/server/chunks/build/{monitor-KW8WLOJd.mjs.map → monitor-MIOvsyLa.mjs.map} +1 -1
- package/.output/server/chunks/build/pages-DR2bzczM.mjs +1 -1
- package/.output/server/chunks/build/{plugins-B-ZNey0Z.mjs → plugins-DnOBIWGg.mjs} +7 -7
- package/.output/server/chunks/build/{plugins-B-ZNey0Z.mjs.map → plugins-DnOBIWGg.mjs.map} +1 -1
- package/.output/server/chunks/build/{popconfirm-C5H1Qoh3.mjs → popconfirm-CRaHcz5O.mjs} +4 -4
- package/.output/server/chunks/build/{popconfirm-C5H1Qoh3.mjs.map → popconfirm-CRaHcz5O.mjs.map} +1 -1
- package/.output/server/chunks/build/{useWorkshopApi-Bh5VUHWu.mjs → segmented-DPe9ZzLO.mjs} +7 -78
- package/.output/server/chunks/build/segmented-DPe9ZzLO.mjs.map +1 -0
- package/.output/server/chunks/build/{select-D7H2ysgT.mjs → select-D-CeE5vY.mjs} +3 -3
- package/.output/server/chunks/build/{select-D7H2ysgT.mjs.map → select-D-CeE5vY.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-Cr06lbRy.mjs → settings-DA8IkGLo.mjs} +11 -11
- package/.output/server/chunks/build/{settings-Cr06lbRy.mjs.map → settings-DA8IkGLo.mjs.map} +1 -1
- package/.output/server/chunks/build/{space-DCwIlnkI.mjs → space-CCBYAkXt.mjs} +2 -2
- package/.output/server/chunks/build/{space-DCwIlnkI.mjs.map → space-CCBYAkXt.mjs.map} +1 -1
- package/.output/server/chunks/build/{switch-VC0m9ede.mjs → switch-CelRXpcy.mjs} +3 -3
- package/.output/server/chunks/build/{switch-VC0m9ede.mjs.map → switch-CelRXpcy.mjs.map} +1 -1
- package/.output/server/chunks/build/{table-BksLg3Q_.mjs → table-Cswq-l2r.mjs} +10 -10
- package/.output/server/chunks/build/{table-BksLg3Q_.mjs.map → table-Cswq-l2r.mjs.map} +1 -1
- package/.output/server/chunks/build/{tabs-CzUfD3iX.mjs → tabs-BM3tAh_J.mjs} +5 -5
- package/.output/server/chunks/build/{tabs-CzUfD3iX.mjs.map → tabs-BM3tAh_J.mjs.map} +1 -1
- package/.output/server/chunks/build/{tag-oQI3VtqM.mjs → tag-NO9jEqKy.mjs} +4 -4
- package/.output/server/chunks/build/{tag-oQI3VtqM.mjs.map → tag-NO9jEqKy.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-QR3BBF7A.mjs → teams-BhSKBBBM.mjs} +15 -14
- package/.output/server/chunks/build/teams-BhSKBBBM.mjs.map +1 -0
- package/.output/server/chunks/build/{tokens-DFvr_TLj.mjs → tokens-D_eyxmcv.mjs} +16 -16
- package/.output/server/chunks/build/{tokens-DFvr_TLj.mjs.map → tokens-D_eyxmcv.mjs.map} +1 -1
- package/.output/server/chunks/build/town-BUqRobze.mjs +1 -1
- package/.output/server/chunks/build/{town-_4tEEEVW.mjs → town-DPtOPRRO.mjs} +4 -4
- package/.output/server/chunks/build/{town-_4tEEEVW.mjs.map → town-DPtOPRRO.mjs.map} +1 -1
- package/.output/server/chunks/build/useLocalTime-9a4B-aHv.mjs +42 -0
- package/.output/server/chunks/build/useLocalTime-9a4B-aHv.mjs.map +1 -0
- package/.output/server/chunks/build/useWorkshopApi-D2gq06N2.mjs +81 -0
- package/.output/server/chunks/build/useWorkshopApi-D2gq06N2.mjs.map +1 -0
- package/.output/server/chunks/build/useWorkshopWs-B3j5wIAK.mjs +1 -1
- package/.output/server/chunks/build/user-Dk-ytEUV.mjs +1 -1
- package/.output/server/chunks/build/{users-4FZ0yFUO.mjs → users-CmVvb1oq.mjs} +16 -16
- package/.output/server/chunks/build/{users-4FZ0yFUO.mjs.map → users-CmVvb1oq.mjs.map} +1 -1
- package/.output/server/chunks/build/{workshop-k0XZTFKg.mjs → workshop-iCzNRifn.mjs} +9 -9
- package/.output/server/chunks/build/{workshop-k0XZTFKg.mjs.map → workshop-iCzNRifn.mjs.map} +1 -1
- package/.output/server/chunks/build/workspaces-IfORCDJE.mjs +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/chunks/routes/api/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
- package/.output/server/chunks/routes/api/metrics.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/client/_name_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/manifest.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/config.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/index.get.mjs +3 -3
- package/.output/server/chunks/routes/api/system/index.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/system/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor/terminal/ws.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor/terminate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/settings/events.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/settings/reset.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/users/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/login.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/logout.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/me.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/register.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/tokens/_id/token.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/tokens/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/users/tokens/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/_...path_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/send.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +6 -14
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +39 -0
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/agents/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/subscribe.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/approvals/_id/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/character/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/assets/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/audit.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/caller.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/from-channel.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/_memoryId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/search.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/model.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/position.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/range.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/events.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/queue.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +9 -2
- package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +6 -4
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +247 -0
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +27 -0
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +19 -7
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index10.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index4.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index4.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index5.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mailbox/all.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mailbox.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/memories/maintenance.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/runtime.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/complete.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/dispatch.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/report.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/retry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/teams/_id/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/members/_agentId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/users/me.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/users/register.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/index.delete.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +1 -1
- package/.output/server/chunks/virtual/entry.mjs +123 -113
- package/.output/server/chunks/virtual/entry.mjs.map +1 -1
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/index.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/app/components/AppHeader.vue +56 -2
- package/app/components/workshop/ChannelSessionList.vue +703 -593
- package/app/components/workshop/terminal/OmpTerminalPanel.vue +2 -1
- package/app/composables/workshop/useLocalTime.ts +16 -0
- package/app/composables/workshop/useSceneLayouts.ts +2 -1
- package/app/composables/workshop/useWorkshopApi.ts +249 -224
- package/app/pages/daq/[id].vue +7 -6
- package/app/pages/daq/index.vue +2 -2
- package/app/pages/dcw/[id].vue +3 -3
- package/app/pages/workshop/agents.vue +432 -382
- package/bin/aw.mjs +0 -0
- package/cli/aw.mjs +8 -1
- package/cli/commands/stop.mjs +111 -108
- package/cli/commands/tui.mjs +10 -1
- package/cli/core/registry.mjs +5 -3
- package/cli/infra.mjs +108 -109
- package/config.yml +134 -134
- package/docs/tui.md +1 -1
- package/i18n/locales/en.ts +5 -0
- package/i18n/locales/zh-CN.ts +5 -0
- package/package.json +148 -140
- package/scripts/_dbg-catalog-smoke.ts +20 -0
- package/scripts/_dbg-codex-probe.mjs +58 -0
- package/scripts/_dbg-dsh-probe.mjs +31 -0
- package/scripts/_dbg-interval-scenario.mjs +126 -0
- package/scripts/_dbg-line-spawn.ts +31 -0
- package/scripts/_dbg-live-engine-probe.mjs +80 -0
- package/scripts/_dbg-mcp-bridge-probe.mjs +147 -0
- package/scripts/_dbg-opencode-sse.mjs +101 -0
- package/scripts/_dbg-opencode-start.ts +57 -0
- package/scripts/_dbg-plugin-matrix.mjs +212 -0
- package/scripts/_dbg-protocol-matrix.mjs +425 -0
- package/scripts/_dbg-real-scenario-timeline.log +123 -0
- package/scripts/_dbg-registry-smoke.ts +14 -0
- package/scripts/_dbg-sim-keeper.mjs +100 -0
- package/scripts/_dbg-team-drill.mjs +173 -0
- package/scripts/dev-guard.mjs +11 -3
- package/scripts/dev-protocol-simulators.mjs +28 -1
- package/scripts/e2e-multi-harness.ts +374 -0
- package/scripts/e2e-multiharness-team.mjs +319 -0
- package/scripts/e2e-plc-scenario.mjs +292 -0
- package/scripts/e2e-real-scenario.mjs +452 -0
- package/scripts/migrate-local-time.mjs +123 -0
- package/scripts/start.mjs +60 -9
- package/server/api/system/settings/index.get.ts +3 -3
- package/server/api/workshop/agent-tools/invoke.post.ts +27 -41
- package/server/api/workshop/agent-tools/list.get.ts +25 -0
- package/server/api/workshop/channels/[id]/index.patch.ts +38 -30
- package/server/api/workshop/daq/[id]/samples.get.ts +6 -3
- package/server/api/workshop/harnesses/[id]/providers.get.ts +16 -0
- package/server/api/workshop/harnesses.get.ts +12 -0
- package/server/api/workshop/hitl/respond.post.ts +87 -67
- package/server/api/workshop/ws.ts +13 -0
- package/server/data/daqs.json +1366 -16
- package/server/data/dcw-lines.json +266 -0
- package/server/data/dcw-products.json +203 -0
- package/server/data/dcw-recipes.json +784 -0
- package/server/data/dcw-rollback.json +1144 -1
- package/server/data/dcw-runs.json +983 -791
- package/server/data/dcw-writes.json +1080 -0
- package/server/data/dcws.json +3278 -203
- package/server/data/line-runs.json +52 -2
- package/server/harness/aw-mcp-bridge.mjs +153 -0
- package/server/plugins/00-local-time.ts +10 -0
- package/server/plugins/aw-plugins.ts +3 -0
- package/server/plugins/backup.ts +116 -97
- package/server/plugins/dev-stability-guard.ts +24 -15
- package/server/plugins/retention.ts +1 -0
- package/server/plugins/security.ts +24 -3
- package/server/plugins/workshop.ts +156 -153
- package/server/repositories/user.repository.ts +414 -391
- package/server/services/system-config.ts +30 -6
- package/server/services/workshop/.mimosa/hook-state/sess_fed429fb-c8b7-4a50-bbd6-45afc580893f.json +1 -0
- package/server/services/workshop/.mimosa/hook-status/sess_fed429fb-c8b7-4a50-bbd6-45afc580893f-e6b75bbfe6.json +14 -0
- package/server/services/workshop/agents/adapters/line-spawn.ts +108 -0
- package/server/services/workshop/agents/adapters/stdio-jsonrpc.ts +316 -0
- package/server/services/workshop/agents/agent-interface.ts +17 -0
- package/server/services/workshop/agents/codex-agent.ts +822 -0
- package/server/services/workshop/agents/dsh-agent.ts +670 -0
- package/server/services/workshop/agents/factory.ts +4 -16
- package/server/services/workshop/agents/harness-env.ts +54 -0
- package/server/services/workshop/agents/harness-models.ts +270 -0
- package/server/services/workshop/agents/host-tool-bridge.ts +592 -0
- package/server/services/workshop/agents/industrial-tools.ts +5 -1
- package/server/services/workshop/agents/node-bindings.repo.ts +4 -5
- package/server/services/workshop/agents/omp-agent.ts +1178 -1957
- package/server/services/workshop/agents/opencode-agent.ts +987 -0
- package/server/services/workshop/agents/prompt-builder.ts +393 -0
- package/server/services/workshop/agents/registry.ts +125 -0
- package/server/services/workshop/assets/character-asset.repo.ts +3 -5
- package/server/services/workshop/assets/device-twin.repo.ts +3 -5
- package/server/services/workshop/daq/daq-controller.ts +8 -4
- package/server/services/workshop/daq/daq-node.repo.ts +3 -5
- package/server/services/workshop/daq/daq-node.ts +2 -2
- package/server/services/workshop/daq/daq-templates.ts +3 -5
- package/server/services/workshop/daq/drivers.ts +41 -12
- package/server/services/workshop/daq/storage/sqlite.adapter.ts +313 -309
- package/server/services/workshop/db/backup-registry.ts +33 -0
- package/server/services/workshop/db/channel.repo.ts +104 -101
- package/server/services/workshop/db/database.ts +956 -949
- package/server/services/workshop/dcw/dcw-controller.ts +3 -1
- package/server/services/workshop/dcw/dcw-line.repo.ts +4 -11
- package/server/services/workshop/dcw/dcw-node.repo.ts +3 -5
- package/server/services/workshop/dcw/dcw-node.ts +13 -1
- package/server/services/workshop/dcw/dcw-product.repo.ts +3 -4
- package/server/services/workshop/dcw/dcw-recipe.repo.ts +3 -19
- package/server/services/workshop/dcw/dcw-templates.ts +3 -5
- package/server/services/workshop/dcw/drivers.ts +37 -13
- package/server/services/workshop/dcw/line-run.ts +3 -5
- package/server/services/workshop/dcw/recipe-rollback.repo.ts +4 -10
- package/server/services/workshop/json-store.mjs +72 -0
- package/server/services/workshop/plugins/host.mjs +2 -1
- package/server/services/workshop/runtime/agent-runtime.ts +44 -0
- package/server/services/workshop/runtime/manager.ts +2953 -2868
- package/server/services/workshop/scene/scene-layout.repo.ts +4 -11
- package/server/services/workshop/settings.ts +7 -0
- package/shared/config/schema.json +5 -0
- package/shared/config/single-instance.mjs +133 -86
- package/shared/local-time.mjs +36 -0
- package/shared/workshop-protocol.ts +11 -5
- package/tui/aw-tui.mjs +28 -10
- package/tui/components/hitl-card.mjs +47 -36
- package/tui/lib/config.mjs +62 -58
- package/tui/lib/ws.mjs +2 -1
- package/.output/public/_nuxt/9X0fVBD7.js +0 -57
- package/.output/public/_nuxt/B6M2WJWm2.js +0 -1
- package/.output/public/_nuxt/B9Yie5HN.js +0 -2
- package/.output/public/_nuxt/BF9XPEuw.js +0 -1
- package/.output/public/_nuxt/BbQornXa.js +0 -1
- package/.output/public/_nuxt/Bxgaym6j.js +0 -1
- package/.output/public/_nuxt/Bxh5nf8j.js +0 -1
- package/.output/public/_nuxt/CXLI50Sq.js +0 -1
- package/.output/public/_nuxt/CdfAP_IH2.js +0 -1
- package/.output/public/_nuxt/Ce1zyNYu.js +0 -1
- package/.output/public/_nuxt/D-Ne4C9a.js +0 -1
- package/.output/public/_nuxt/DEHNjlTq2.js +0 -1
- package/.output/public/_nuxt/DFnGFEav.js +0 -18
- package/.output/public/_nuxt/DYWgGHNo.js +0 -7
- package/.output/public/_nuxt/OmpTerminalPanel.Bc9GjNU5.css +0 -1
- package/.output/public/_nuxt/W1E3-5ML.js +0 -14
- package/.output/public/_nuxt/XVB9_zwP.js +0 -1
- package/.output/public/_nuxt/Xaf_HIR3.js +0 -1
- package/.output/public/_nuxt/_id_.BeqSLvl_.css +0 -1
- package/.output/public/_nuxt/_id_.DN3U6EF9.css +0 -1
- package/.output/public/_nuxt/agents.BJwgTLFZ.css +0 -1
- package/.output/public/_nuxt/builds/meta/55c10854-ee0e-4be4-924b-a1b0e100fe11.json +0 -1
- package/.output/public/_nuxt/daq.BXsnevQv.css +0 -1
- package/.output/public/_nuxt/yIKY_V1P.js +0 -1
- package/.output/server/chunks/build/OmpTerminalPanel-B_SYhmgb.mjs.map +0 -1
- package/.output/server/chunks/build/_id_-CWLFGZjV.mjs.map +0 -1
- package/.output/server/chunks/build/agents-D4l1icvn.mjs.map +0 -1
- package/.output/server/chunks/build/channel-templates-DqjtC-R0.mjs.map +0 -1
- package/.output/server/chunks/build/interval-WlxgjTzO.mjs +0 -9
- package/.output/server/chunks/build/interval-WlxgjTzO.mjs.map +0 -1
- package/.output/server/chunks/build/teams-QR3BBF7A.mjs.map +0 -1
- package/.output/server/chunks/build/useWorkshopApi-Bh5VUHWu.mjs.map +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 插件系统全链路实测:默认下沉路径(MinIO 图像帧) + 自定义模板插件安装/连接/加工验证。
|
|
3
|
+
* NO_PROXY='*' node scripts/_dbg-plugin-matrix.mjs [--base http://127.0.0.1:3000]
|
|
4
|
+
*
|
|
5
|
+
* R-10 默认节点(默认下沉):ccd-image(mock)→ 帧落对象存储(MinIO/磁盘降级)→ /frames + content;
|
|
6
|
+
* 标量节点 Timescale 落库与 WS 已由 _dbg-protocol-matrix.mjs 覆盖。
|
|
7
|
+
* R-11 自定义插件安装:落盘 .AgentWorkShop/plugins/aw-matrix-plugin → REST enable(热重载)。
|
|
8
|
+
* R-12 插件模板节点接模拟工况:驱动(matrix-thermo→HTTP 模拟设备)→ 自定义算法(1.02x+0.5)
|
|
9
|
+
* → 自定义处理器(matrix-derate)→ 入库/WS;断言入库值 ≈ 43.85(非原始 42.5)。
|
|
10
|
+
* R-13 Agent 工具 + 观测路由:omp 工具注册 + /api/plugins/aw-matrix-plugin/stats。
|
|
11
|
+
*/
|
|
12
|
+
const BASE = (() => {
|
|
13
|
+
const i = process.argv.indexOf('--base')
|
|
14
|
+
return i > 0 ? process.argv[i + 1] : 'http://127.0.0.1:3000'
|
|
15
|
+
})()
|
|
16
|
+
const TAG = Date.now().toString(36)
|
|
17
|
+
|
|
18
|
+
let failures = 0
|
|
19
|
+
let passed = 0
|
|
20
|
+
const results = []
|
|
21
|
+
const check = (id, name, ok, detail = '') => {
|
|
22
|
+
console.log(` ${ok ? 'PASS' : 'FAIL'} ${id} ${name}${detail ? ` — ${detail}` : ''}`)
|
|
23
|
+
results.push({ id, name, ok, detail })
|
|
24
|
+
ok ? passed++ : failures++
|
|
25
|
+
}
|
|
26
|
+
const sleep = ms => new Promise(r => setTimeout(r, ms))
|
|
27
|
+
|
|
28
|
+
const api = async (method, path, { body, token } = {}, attempt = 0) => {
|
|
29
|
+
const headers = { 'content-type': 'application/json' }
|
|
30
|
+
if (token) headers.authorization = `Bearer ${token}`
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(`${BASE}${path}`, { method, headers, body: body !== undefined ? JSON.stringify(body) : undefined })
|
|
33
|
+
return { status: res.status, ...(await res.json().catch(() => ({}))) }
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (attempt < 3) { await sleep(2500); return api(method, path, { body, token }, attempt + 1) }
|
|
37
|
+
throw err
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function main() {
|
|
42
|
+
console.log(`\n━━━ 插件系统全链路实测 @ ${BASE} (tag=${TAG}) ━━━`)
|
|
43
|
+
|
|
44
|
+
const fs = await import('node:fs')
|
|
45
|
+
const { spawnSync, spawn } = await import('node:child_process')
|
|
46
|
+
const resolve2 = (await import('node:path')).resolve
|
|
47
|
+
// preflight:dev server 自愈(外部击杀 → 清僵尸 guard → 重启,最多等 90s)
|
|
48
|
+
{
|
|
49
|
+
let ok = false
|
|
50
|
+
for (let i = 0; i < 30 && !ok; i++) {
|
|
51
|
+
try { ok = (await fetch(`${BASE}/api/health`)).status === 200 } catch { ok = false }
|
|
52
|
+
if (!ok) {
|
|
53
|
+
if (i === 0) {
|
|
54
|
+
const lockPath = resolve2('.AgentWorkShop/.runtime/aw.lock')
|
|
55
|
+
let lockPid = 0
|
|
56
|
+
try { lockPid = Number(JSON.parse(fs.readFileSync(lockPath, 'utf-8')).pid ?? 0) } catch { /* 无锁 */ }
|
|
57
|
+
if (lockPid) {
|
|
58
|
+
spawnSync('cmd', ['/c', `taskkill /F /PID ${lockPid}`])
|
|
59
|
+
try { fs.unlinkSync(lockPath) } catch { /* 无锁 */ }
|
|
60
|
+
console.log(` [preflight] dev server 僵尸 guard(pid=${lockPid})已清,重启…`)
|
|
61
|
+
const fd = fs.openSync(resolve2('.AgentWorkShop/data/dev-server.log'), 'a')
|
|
62
|
+
const { spawn } = await import('node:child_process')
|
|
63
|
+
const child = spawn(process.execPath, ['bin/aw.mjs', 'dev'], {
|
|
64
|
+
cwd: process.cwd(), env: { ...process.env, NO_PROXY: '127.0.0.1,localhost' },
|
|
65
|
+
detached: true, stdio: ['ignore', fd, fd],
|
|
66
|
+
})
|
|
67
|
+
child.unref()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
await sleep(3000)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!ok) throw new Error('preflight:dev server 90s 未恢复')
|
|
74
|
+
}
|
|
75
|
+
console.log(' [preflight] dev server 健康')
|
|
76
|
+
|
|
77
|
+
// preflight:模拟工况自愈(清旧持有者 → 唯一实例)
|
|
78
|
+
{
|
|
79
|
+
const net = await import('node:net')
|
|
80
|
+
const SIMS = [
|
|
81
|
+
{ name: 'mqtt-http', ports: [18830, 1889], cmd: 'scripts/dev-protocol-simulators.mjs', env: { MQTT_SIM_PORT: '18830', HTTP_SIM_PORT: '1889' }, log: 'sim-mqtt-http.log' },
|
|
82
|
+
{ name: 'modbus-tcp', ports: [1502], cmd: 'scripts/dev-modbus-simulator.mjs', env: {}, log: 'sim-modbus-tcp.log' },
|
|
83
|
+
{ name: 'opcua', ports: [4840], cmd: 'scripts/dev-opcua-simulator.mjs', env: { OPCUA_SIM_PORT: '4840' }, log: 'sim-opcua.log' },
|
|
84
|
+
{ name: 'plc', ports: [15040], cmd: 'scripts/dev-plc-simulator.mjs', env: {}, args: ['--port', '15040'], log: 'sim-plc.log' },
|
|
85
|
+
{ name: 'rtu', ports: [15030], cmd: 'scripts/_rtu-mini-slave.mjs', env: {}, log: 'sim-rtu.log' },
|
|
86
|
+
]
|
|
87
|
+
const portUp = (port) => new Promise((res) => {
|
|
88
|
+
const s = net.connect(port, '127.0.0.1')
|
|
89
|
+
const t = setTimeout(() => { s.destroy(); res(false) }, 1000)
|
|
90
|
+
s.on('connect', () => { clearTimeout(t); s.destroy(); res(true) })
|
|
91
|
+
s.on('error', () => { clearTimeout(t); res(false) })
|
|
92
|
+
})
|
|
93
|
+
for (const sim of SIMS) {
|
|
94
|
+
const owners = spawnSync('cmd', ['/c', `netstat -ano | findstr :${sim.ports[0]} | findstr LISTENING`], { encoding: 'utf-8' })
|
|
95
|
+
for (const line of (owners.stdout ?? '').split('\n')) {
|
|
96
|
+
const m = line.trim().match(/\s(\d+)\s*$/)
|
|
97
|
+
if (m) { spawnSync('cmd', ['/c', `taskkill /F /PID ${m[1]}`]); await sleep(300) }
|
|
98
|
+
}
|
|
99
|
+
const fd = fs.openSync(resolve2('.AgentWorkShop/data', sim.log), 'a')
|
|
100
|
+
const child = spawn(process.execPath, [sim.cmd, ...(sim.args ?? [])], {
|
|
101
|
+
cwd: process.cwd(), env: { ...process.env, NO_PROXY: '127.0.0.1,localhost', ...sim.env },
|
|
102
|
+
detached: true, stdio: ['ignore', fd, fd],
|
|
103
|
+
})
|
|
104
|
+
child.unref()
|
|
105
|
+
let up = false
|
|
106
|
+
for (let i = 0; i < 15 && !up; i++) { await sleep(1000); up = await portUp(sim.ports[0]) }
|
|
107
|
+
if (!up) throw new Error(`preflight:${sim.name} 拉起失败`)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
console.log(' [preflight] 模拟工况六端口就绪')
|
|
111
|
+
|
|
112
|
+
const reg = await api('POST', '/api/users/register', {
|
|
113
|
+
body: { email: `plug-${TAG}@test.local`, password: 'Passw0rd!123', name: `plug-${TAG}` },
|
|
114
|
+
})
|
|
115
|
+
const token = reg.data?.token
|
|
116
|
+
if (!token) throw new Error(`注册失败: ${JSON.stringify(reg).slice(0, 200)}`)
|
|
117
|
+
|
|
118
|
+
// ═══ R-10 默认节点:图像帧默认下沉(对象存储 MinIO/磁盘) ═══
|
|
119
|
+
const line = (await api('POST', '/api/workshop/dcw/lines', { body: { name: `插件产线-${TAG}` }, token })).data?.line
|
|
120
|
+
const img = (await api('POST', '/api/workshop/daq', {
|
|
121
|
+
body: { templateRef: 'daq-ccd-image', name: `视觉相机-${TAG}`, driver: 'mock', lineId: line.id, intervalMs: 700, publishIntervalMs: 0 }, token,
|
|
122
|
+
})).data?.node
|
|
123
|
+
check('R10.1', '默认节点创建(ccd-image,mock 模拟工况)', Boolean(img?.id))
|
|
124
|
+
// 配方 mock 参数节点 + 开跑(数采门控需要 active run)
|
|
125
|
+
const dwMock = (await api('POST', '/api/workshop/dcw', { body: { templateRef: 'dcw-temp-sp', name: `插件参数-${TAG}`, driver: 'mock', lineId: line.id }, token })).data?.node
|
|
126
|
+
const prod = (await api('POST', '/api/workshop/dcw/products', { body: { name: `插件产品-${TAG}`, lineId: line.id }, token })).data?.product
|
|
127
|
+
const recipe = (await api('POST', '/api/workshop/dcw/recipes', {
|
|
128
|
+
body: {
|
|
129
|
+
productId: prod.id, name: `插件配方-${TAG}`,
|
|
130
|
+
params: [{ templateRef: 'dcw-temp-sp', nodeId: dwMock.id, value: 180, min: 150, max: 200 }],
|
|
131
|
+
daqWindows: [{ nodeId: img.id, min: 0, max: 255 }],
|
|
132
|
+
}, token,
|
|
133
|
+
})).data?.recipe
|
|
134
|
+
const start = await api('POST', `/api/workshop/dcw/lines/${line.id}/start`, { body: { recipeId: recipe.id }, token })
|
|
135
|
+
check('R10.0', '产线开跑(激活数采门控)', start.code === 0, start.message ?? '')
|
|
136
|
+
await sleep(4500)
|
|
137
|
+
const frames = await api('GET', `/api/workshop/daq/${img.id}/frames?limit=5`, { token })
|
|
138
|
+
const frameItems = frames.data?.frames ?? frames.data?.items ?? frames.data ?? []
|
|
139
|
+
check('R10.2', '图像帧落对象存储(/frames 元数据)', Array.isArray(frameItems) && frameItems.length >= 2, `frames=${Array.isArray(frameItems) ? frameItems.length : 'undefined'}`)
|
|
140
|
+
const firstFrame = Array.isArray(frameItems) ? frameItems[0] : null
|
|
141
|
+
const contentUrl = firstFrame?.contentUrl
|
|
142
|
+
const fTs = firstFrame?.ts ?? firstFrame?.at
|
|
143
|
+
if (contentUrl || fTs) {
|
|
144
|
+
const url = contentUrl ?? `/api/workshop/daq/${img.id}/frames/content?ts=${fTs}`
|
|
145
|
+
const content = await fetch(`${BASE}${url}`, { headers: { authorization: `Bearer ${token}` } })
|
|
146
|
+
const buf = await content.arrayBuffer()
|
|
147
|
+
check('R10.3', '帧内容可回源(MinIO/对象存储 GET)', content.status === 200 && buf.byteLength > 100, `status=${content.status} bytes=${buf.byteLength}`)
|
|
148
|
+
} else {
|
|
149
|
+
check('R10.3', '帧内容可回源(MinIO/对象存储 GET)', false, `无回源地址 frame=${JSON.stringify(firstFrame ?? {}).slice(0, 100)}`)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ═══ R-11 自定义插件:安装(落盘已完成)→ 发现/启用态 ═══
|
|
153
|
+
const list0 = await api('GET', '/api/workshop/plugins', { token })
|
|
154
|
+
const plugins0 = list0.plugins ?? list0.data?.plugins ?? []
|
|
155
|
+
const mine0 = plugins0.find(p => p.name === 'aw-matrix-plugin')
|
|
156
|
+
check('R11.1', '插件被发现(plugins 列表)', Boolean(mine0), `enabled=${mine0?.enabled} 共${plugins0.length}个`)
|
|
157
|
+
if (mine0 && mine0.enabled === false) {
|
|
158
|
+
const en = await api('POST', '/api/workshop/plugins/aw-matrix-plugin/enable', { body: {}, token })
|
|
159
|
+
check('R11.2', 'REST 启用插件(热重载)', en.code === 0 || en.status === 200, en.message ?? '')
|
|
160
|
+
await sleep(3000)
|
|
161
|
+
} else {
|
|
162
|
+
check('R11.2', '插件已处于启用态(发现即装载)', true)
|
|
163
|
+
}
|
|
164
|
+
const daqList = await api('GET', '/api/workshop/daq', { token })
|
|
165
|
+
const tplItems = daqList.data?.templates ?? []
|
|
166
|
+
const mineTpl = tplItems.find(t => t.key === 'plug-matrix-profile')
|
|
167
|
+
check('R11.3', '自定义模板已注册(plug-matrix-profile)', Boolean(mineTpl), `templates=${tplItems.length}`)
|
|
168
|
+
|
|
169
|
+
// ═══ R-12 插件模板节点接模拟工况:自定义驱动+算法+处理器全链路 ═══
|
|
170
|
+
const drvTest = await api('POST', '/api/workshop/daq/test-driver', { body: { driver: 'matrix-thermo', driverConfig: {} }, token })
|
|
171
|
+
check('R12.1', '插件自定义驱动连接测试(→HTTP 模拟工况)', drvTest.data?.test?.ok === true, JSON.stringify(drvTest.data?.test ?? {}).slice(0, 100))
|
|
172
|
+
const calib = (await api('POST', '/api/workshop/daq', {
|
|
173
|
+
body: { templateRef: 'plug-matrix-profile', name: `插件标定-${TAG}`, driver: 'matrix-thermo', driverConfig: {}, lineId: line.id, intervalMs: 700, publishIntervalMs: 0 }, token,
|
|
174
|
+
})).data?.node
|
|
175
|
+
check('R12.2', '插件模板节点创建', Boolean(calib?.id))
|
|
176
|
+
await sleep(6000)
|
|
177
|
+
const samples = await api('GET', `/api/workshop/daq/${calib.id}/samples?bucketMs=1000`, { token })
|
|
178
|
+
const pts = samples.data?.points ?? []
|
|
179
|
+
const vals = pts.map(p => Number(Object.values(p)[1])).filter(Number.isFinite)
|
|
180
|
+
// 原始值 42.5±0.5 → 补偿后 1.02x+0.5 ≈ 43.85±1(>48 削峰不会触发)
|
|
181
|
+
const calibrated = vals.filter(v => v > 42.2 && v < 46)
|
|
182
|
+
check('R12.3', '自定义算法生效(入库=1.02×42.5+0.5≈43.85,非原始 42.5)', vals.length >= 4 && calibrated.length >= Math.floor(vals.length * 0.6),
|
|
183
|
+
`points=${pts.length} last=${vals.at(-1)} 原始恒为 42.5±0.5`)
|
|
184
|
+
|
|
185
|
+
// ═══ R-13 插件观测路由 + Agent 工具 ═══
|
|
186
|
+
const stats = await api('GET', '/api/plugins/aw-matrix-plugin/stats', { token })
|
|
187
|
+
const sbody = stats.body ?? stats.data?.body ?? stats.data ?? {}
|
|
188
|
+
check('R13.1', '插件 REST 路由(/stats)+ 钩子计数', sbody.ok === true && Number(sbody.samples) > 0,
|
|
189
|
+
`samples=${sbody.samples} frames=${sbody.frames} last=${sbody.lastValue}`)
|
|
190
|
+
const tools = await api('GET', '/api/workshop/plugins', { token })
|
|
191
|
+
const mineNow = (tools.plugins ?? tools.data?.plugins ?? []).find(p => p.name === 'aw-matrix-plugin')
|
|
192
|
+
check('R13.2', '插件管理面可见(启用态)', Boolean(mineNow?.enabled), `enabled=${mineNow?.enabled}`)
|
|
193
|
+
|
|
194
|
+
// ═══ 清理 ═══
|
|
195
|
+
await api('POST', `/api/workshop/dcw/lines/${line.id}/stop`, { token }).catch(() => {})
|
|
196
|
+
await api('DELETE', `/api/workshop/daq/${img.id}`, { token }).catch(() => {})
|
|
197
|
+
await api('DELETE', `/api/workshop/daq/${calib.id}`, { token }).catch(() => {})
|
|
198
|
+
await api('DELETE', `/api/workshop/dcw/${dwMock.id}`, { token }).catch(() => {})
|
|
199
|
+
await api('DELETE', `/api/workshop/dcw/lines/${line.id}`, { token }).catch(() => {})
|
|
200
|
+
|
|
201
|
+
console.log(`\n━━━ 插件矩阵结果: ${passed} passed / ${failures} failed ━━━`)
|
|
202
|
+
if (failures) {
|
|
203
|
+
console.log('失败项:')
|
|
204
|
+
for (const r of results.filter(x => !x.ok)) console.log(` ${r.id} ${r.name} — ${r.detail}`)
|
|
205
|
+
}
|
|
206
|
+
process.exit(failures === 0 ? 0 : 1)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
main().catch((err) => {
|
|
210
|
+
console.error('FATAL', err)
|
|
211
|
+
process.exit(1)
|
|
212
|
+
})
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全协议连通矩阵实测(真实模拟工况;DAQ 只读 + DCW 读/写闭环)。
|
|
3
|
+
* NO_PROXY='*' node scripts/_dbg-protocol-matrix.mjs [--base http://127.0.0.1:3000]
|
|
4
|
+
*
|
|
5
|
+
* 前置(模拟工况,全部在跑):
|
|
6
|
+
* MQTT :1883(aw/sim/temp 每 2s) · HTTP :1889(/api/value;/api/setpoint)
|
|
7
|
+
* ModbusTCP :1502(40001 压力 f32 0.6~1.1 / 40003 温度 f32 165~175)
|
|
8
|
+
* ModbusRTU :15030(40001 f32 40.25↔44.25) · OPC UA :4840(ns=2;s=AW.Temp/AW.SetTemp)
|
|
9
|
+
* PLC 涂布产线 :15040(PV 温度 40001 / SP 温度 40021 可写,一阶热惯性)
|
|
10
|
+
*
|
|
11
|
+
* 矩阵:
|
|
12
|
+
* DAQ 读取 ×5(mqtt/http/modbus-tcp/modbus-rtu/opcua):test-connection → 采样落库(Timescale)→ WS 帧
|
|
13
|
+
* DCW 读/写 ×4:modbus-tcp(PLC 真闭环 SP→PV 收敛)/ opcua(回读)/ mqtt(发布+订阅验证)/ http(POST 落达验证)
|
|
14
|
+
* 联锁:配方窗口负例(越窗 400)
|
|
15
|
+
*/
|
|
16
|
+
const BASE = (() => {
|
|
17
|
+
const i = process.argv.indexOf('--base')
|
|
18
|
+
return i > 0 ? process.argv[i + 1] : 'http://127.0.0.1:3000'
|
|
19
|
+
})()
|
|
20
|
+
const WS_BASE = BASE.replace(/^http/, 'ws')
|
|
21
|
+
const TAG = Date.now().toString(36)
|
|
22
|
+
import net from 'node:net'
|
|
23
|
+
import { spawnSync } from 'node:child_process'
|
|
24
|
+
import fs from 'node:fs'
|
|
25
|
+
import { spawn } from 'node:child_process'
|
|
26
|
+
import { resolve } from 'node:path'
|
|
27
|
+
|
|
28
|
+
let failures = 0
|
|
29
|
+
let passed = 0
|
|
30
|
+
const results = []
|
|
31
|
+
const check = (id, name, ok, detail = '') => {
|
|
32
|
+
console.log(` ${ok ? 'PASS' : 'FAIL'} ${id} ${name}${detail ? ` — ${detail}` : ''}`)
|
|
33
|
+
results.push({ id, name, ok, detail })
|
|
34
|
+
ok ? passed++ : failures++
|
|
35
|
+
}
|
|
36
|
+
const sleep = ms => new Promise(r => setTimeout(r, ms))
|
|
37
|
+
|
|
38
|
+
const api = async (method, path, { body, token } = {}, attempt = 0) => {
|
|
39
|
+
const headers = { 'content-type': 'application/json' }
|
|
40
|
+
if (token) headers.authorization = `Bearer ${token}`
|
|
41
|
+
try {
|
|
42
|
+
const res = await fetch(`${BASE}${path}`, { method, headers, body: body !== undefined ? JSON.stringify(body) : undefined })
|
|
43
|
+
return { status: res.status, ...(await res.json().catch(() => ({}))) }
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
// dev server 可能正被外部击杀/自愈重启:短重试跨过死亡窗口
|
|
47
|
+
if (attempt < 3) { await sleep(2500); return api(method, path, { body, token }, attempt + 1) }
|
|
48
|
+
throw err
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function waitUntil(name, cond, timeoutMs = 30_000, intervalMs = 800) {
|
|
53
|
+
const deadline = Date.now() + timeoutMs
|
|
54
|
+
let last = null
|
|
55
|
+
while (Date.now() < deadline) {
|
|
56
|
+
try { last = await cond(); if (last) return last } catch (e) { last = e }
|
|
57
|
+
await sleep(intervalMs)
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`timeout:${name} last=${String(last).slice(0, 160)}`)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** AEP WS(全局 peer:daq.reading/daq.frame 等场景帧) */
|
|
63
|
+
function openAep(token) {
|
|
64
|
+
const frames = []
|
|
65
|
+
const ws = new WebSocket(`${WS_BASE}/api/workshop/ws?token=${encodeURIComponent(token)}`)
|
|
66
|
+
ws.addEventListener('message', (ev) => {
|
|
67
|
+
try {
|
|
68
|
+
const e = JSON.parse(ev.data)
|
|
69
|
+
if (e.type && e.type !== 'pong') frames.push(e)
|
|
70
|
+
}
|
|
71
|
+
catch { /* ignore */ }
|
|
72
|
+
})
|
|
73
|
+
return { ws, frames, ready: new Promise(r => ws.addEventListener('open', () => r())) }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function main() {
|
|
77
|
+
console.log(`\n━━━ 全协议矩阵实测 @ ${BASE} (tag=${TAG}) ━━━`)
|
|
78
|
+
|
|
79
|
+
// ── P0. 模拟工况 preflight(自愈):并行会话的端口清理可能杀掉模拟器,开跑前逐一拉活 ──
|
|
80
|
+
const SIMS = [
|
|
81
|
+
{ name: 'mqtt-http', ports: [18830, 1889], cmd: 'scripts/dev-protocol-simulators.mjs', env: { MQTT_SIM_PORT: '18830', HTTP_SIM_PORT: '1889' }, log: 'sim-mqtt-http.log' },
|
|
82
|
+
{ name: 'modbus-tcp', ports: [1502], cmd: 'scripts/dev-modbus-simulator.mjs', env: {}, log: 'sim-modbus-tcp.log' },
|
|
83
|
+
{ name: 'opcua', ports: [4840], cmd: 'scripts/dev-opcua-simulator.mjs', env: { OPCUA_SIM_PORT: '4840' }, log: 'sim-opcua.log' },
|
|
84
|
+
{ name: 'plc', ports: [15040], cmd: 'scripts/dev-plc-simulator.mjs', env: {}, args: ['--port', '15040'], log: 'sim-plc.log' },
|
|
85
|
+
{ name: 'rtu', ports: [15030], cmd: 'scripts/_rtu-mini-slave.mjs', env: {}, log: 'sim-rtu.log' },
|
|
86
|
+
]
|
|
87
|
+
const portUp = (port) => new Promise((res) => {
|
|
88
|
+
const s = net.connect(port, '127.0.0.1')
|
|
89
|
+
const t = setTimeout(() => { s.destroy(); res(false) }, 1000)
|
|
90
|
+
s.on('connect', () => { clearTimeout(t); s.destroy(); res(true) })
|
|
91
|
+
s.on('error', () => { clearTimeout(t); res(false) })
|
|
92
|
+
})
|
|
93
|
+
const portOwners = (port) => {
|
|
94
|
+
// netstat 找出该端口所有 LISTENING 持有者(Windows 双绑竞态:僵尸实例会导致读写分家)
|
|
95
|
+
const out = spawnSync('cmd', ['/c', `netstat -ano | findstr :${port} | findstr LISTENING`], { encoding: 'utf-8' })
|
|
96
|
+
const pids = new Set()
|
|
97
|
+
for (const line of (out.stdout ?? '').split('\n')) {
|
|
98
|
+
const m = line.trim().match(/\s(\d+)\s*$/)
|
|
99
|
+
if (m) pids.add(m[1])
|
|
100
|
+
}
|
|
101
|
+
return [...pids]
|
|
102
|
+
}
|
|
103
|
+
for (const sim of SIMS) {
|
|
104
|
+
// 清场:杀掉端口上所有旧持有者(僵尸/双绑),保证唯一新实例
|
|
105
|
+
for (const pid of portOwners(sim.ports[0])) {
|
|
106
|
+
spawnSync('cmd', ['/c', `taskkill /F /PID ${pid}`])
|
|
107
|
+
console.log(` [preflight] ${sim.name} 清掉旧持有者 pid=${pid}`)
|
|
108
|
+
await sleep(300)
|
|
109
|
+
}
|
|
110
|
+
let up = false
|
|
111
|
+
{
|
|
112
|
+
const fd = fs.openSync(resolve('.AgentWorkShop/data', sim.log), 'a')
|
|
113
|
+
const child = spawn(process.execPath, [sim.cmd, ...(sim.args ?? [])], {
|
|
114
|
+
cwd: process.cwd(), env: { ...process.env, NO_PROXY: '127.0.0.1,localhost', ...sim.env },
|
|
115
|
+
detached: true, stdio: ['ignore', fd, fd],
|
|
116
|
+
})
|
|
117
|
+
child.unref()
|
|
118
|
+
console.log(` [preflight] ${sim.name} → 拉起唯一实例 pid=${child.pid}`)
|
|
119
|
+
for (let i = 0; i < 15 && !up; i++) { await sleep(1000); up = await portUp(sim.ports[0]) }
|
|
120
|
+
if (!up) throw new Error(`preflight:${sim.name} 拉起失败`)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
check('0.0', '模拟工况 preflight(六端口唯一实例)', true)
|
|
124
|
+
|
|
125
|
+
// dev server 健康(被外部击杀 → 清僵尸 guard 自愈;最多等 90s)
|
|
126
|
+
{
|
|
127
|
+
let ok = false
|
|
128
|
+
for (let i = 0; i < 30 && !ok; i++) {
|
|
129
|
+
try { ok = (await fetch(`${BASE}/api/health`)).status === 200 } catch { ok = false }
|
|
130
|
+
if (!ok) {
|
|
131
|
+
if (i === 0) {
|
|
132
|
+
const lockPath = resolve('.AgentWorkShop/.runtime/aw.lock')
|
|
133
|
+
let lockPid = 0
|
|
134
|
+
try { lockPid = Number(JSON.parse(fs.readFileSync(lockPath, 'utf-8')).pid ?? 0) } catch { /* 无锁 */ }
|
|
135
|
+
if (lockPid) {
|
|
136
|
+
spawnSync('cmd', ['/c', `taskkill /F /PID ${lockPid}`])
|
|
137
|
+
try { fs.unlinkSync(lockPath) } catch { /* 无锁 */ }
|
|
138
|
+
console.log(` [preflight] dev server 僵尸 guard(pid=${lockPid})已清,重启…`)
|
|
139
|
+
const fd = fs.openSync(resolve('.AgentWorkShop/data/dev-server.log'), 'a')
|
|
140
|
+
const child = spawn(process.execPath, ['bin/aw.mjs', 'dev'], {
|
|
141
|
+
cwd: process.cwd(), env: { ...process.env, NO_PROXY: '127.0.0.1,localhost' },
|
|
142
|
+
detached: true, stdio: ['ignore', fd, fd],
|
|
143
|
+
})
|
|
144
|
+
child.unref()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
await sleep(3000)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!ok) throw new Error('preflight:dev server 90s 未恢复')
|
|
151
|
+
}
|
|
152
|
+
console.log(' [preflight] dev server 健康')
|
|
153
|
+
|
|
154
|
+
// ── 0. 注册 + 产线 ──
|
|
155
|
+
const reg = await api('POST', '/api/users/register', {
|
|
156
|
+
body: { email: `proto-${TAG}@test.local`, password: 'Passw0rd!123', name: `proto-${TAG}` },
|
|
157
|
+
})
|
|
158
|
+
const token = reg.data?.token
|
|
159
|
+
if (!token) throw new Error(`注册失败: ${JSON.stringify(reg).slice(0, 200)}`)
|
|
160
|
+
|
|
161
|
+
const line = (await api('POST', '/api/workshop/dcw/lines', { body: { name: `全协议产线-${TAG}` }, token })).data?.line
|
|
162
|
+
check('0.1', '建产线', Boolean(line?.id))
|
|
163
|
+
|
|
164
|
+
// ── 1. DAQ 五协议节点(配置连接 + 连接测试) ──
|
|
165
|
+
const daqDefs = [
|
|
166
|
+
{ id: 'mqtt', driver: 'mqtt', templateRef: 'daq-temp-tc', name: `MQTT温度-${TAG}`, expect: [30, 75],
|
|
167
|
+
cfg: { host: '127.0.0.1', port: 18830, topic: 'aw/sim/temp', jsonPath: 'data.temp' } },
|
|
168
|
+
{ id: 'http', driver: 'http', templateRef: 'daq-temp-tc', name: `HTTP流量-${TAG}`, expect: [38, 48],
|
|
169
|
+
cfg: { url: 'http://127.0.0.1:1889/api/value', jsonPath: 'data.value' } },
|
|
170
|
+
{ id: 'mbtcp', driver: 'modbus-tcp', templateRef: 'daq-pressure-tx', name: `ModbusTCP压力-${TAG}`, expect: [0.5, 1.25],
|
|
171
|
+
cfg: { host: '127.0.0.1', port: 1502, unitId: 1, register: 40001, registerType: 'holding', dataType: 'float32', byteOrder: 'big' } },
|
|
172
|
+
{ id: 'rtu', driver: 'modbus-rtu', templateRef: 'daq-temp-tc', name: `RTU温度-${TAG}`, expect: [60, 72],
|
|
173
|
+
cfg: { host: '127.0.0.1', port: 15030, unitId: 1, register: 40001, registerType: 'holding', dataType: 'uint16' } },
|
|
174
|
+
{ id: 'opcua', driver: 'opcua', templateRef: 'daq-temp-tc', name: `OPCUA温度-${TAG}`, expect: [140, 200],
|
|
175
|
+
cfg: { endpoint: 'opc.tcp://127.0.0.1:4840', nodeId: 'ns=2;s=AW.Temp' } },
|
|
176
|
+
{ id: 'plcpv', driver: 'modbus-tcp', templateRef: 'daq-temp-tc', name: `PLC-PV温度-${TAG}`, expect: [0, 260],
|
|
177
|
+
cfg: { host: '127.0.0.1', port: 15040, unitId: 1, register: 40001, registerType: 'holding', dataType: 'float32', byteOrder: 'big' } },
|
|
178
|
+
]
|
|
179
|
+
const daqNodes = {}
|
|
180
|
+
for (const d of daqDefs) {
|
|
181
|
+
const t = await api('POST', '/api/workshop/daq/test-driver', { body: { driver: d.driver, driverConfig: d.cfg }, token })
|
|
182
|
+
check(`1.${d.id}-test`, `${d.driver} 连接测试`, t.data?.test?.ok === true, JSON.stringify(t.data?.test ?? t.message ?? {}).slice(0, 120))
|
|
183
|
+
const created = await api('POST', '/api/workshop/daq', {
|
|
184
|
+
body: { templateRef: d.templateRef, name: d.name, driver: d.driver, driverConfig: d.cfg, lineId: line.id, intervalMs: 800, publishIntervalMs: 0 }, token,
|
|
185
|
+
})
|
|
186
|
+
daqNodes[d.id] = created.data?.node
|
|
187
|
+
check(`1.${d.id}-create`, `${d.driver} 节点创建`, Boolean(daqNodes[d.id]?.id), created.message ?? '')
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ── 2. DCW 节点(四路下发通道) ──
|
|
191
|
+
const dcwDefs = [
|
|
192
|
+
{ id: 'plcsp', driver: 'modbus-tcp', name: `PLC-SP温度-${TAG}`, recipe: true,
|
|
193
|
+
cfg: { host: '127.0.0.1', port: 15040, unitId: 1, register: 40021, dataType: 'float32', byteOrder: 'big' } },
|
|
194
|
+
{ id: 'ocusp', driver: 'opcua', name: `OPCUA-SP-${TAG}`,
|
|
195
|
+
cfg: { endpoint: 'opc.tcp://127.0.0.1:4840', nodeId: 'ns=2;s=AW.SetTemp' } },
|
|
196
|
+
{ id: 'mqsp', driver: 'mqtt', name: `MQTT-SP-${TAG}`,
|
|
197
|
+
cfg: { host: '127.0.0.1', port: 18830, topic: `aw/sim/setpoint-${TAG}`, jsonKey: 'setpoint', qos: 1 } },
|
|
198
|
+
{ id: 'htsp', driver: 'http', name: `HTTP-SP-${TAG}`,
|
|
199
|
+
cfg: { url: 'http://127.0.0.1:1889/api/setpoint', bodyKey: 'setpoint' } },
|
|
200
|
+
]
|
|
201
|
+
const dcwNodes = {}
|
|
202
|
+
for (const d of dcwDefs) {
|
|
203
|
+
const t = await api('POST', '/api/workshop/dcw/test-driver', { body: { driver: d.driver, driverConfig: d.cfg }, token })
|
|
204
|
+
check(`2.${d.id}-test`, `DCW ${d.driver} 连接测试`, t.data?.test?.ok === true, JSON.stringify(t.data?.test ?? t.message ?? {}).slice(0, 120))
|
|
205
|
+
const created = await api('POST', '/api/workshop/dcw', {
|
|
206
|
+
body: { templateRef: 'dcw-temp-sp', name: d.name, driver: d.driver, driverConfig: d.cfg, lineId: line.id }, token,
|
|
207
|
+
})
|
|
208
|
+
dcwNodes[d.id] = created.data?.node
|
|
209
|
+
check(`2.${d.id}-create`, `DCW ${d.driver} 节点创建`, Boolean(dcwNodes[d.id]?.id), created.message ?? '')
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ── 3. 产品/配方/开跑(激活数采门控 + 配方窗口) ──
|
|
213
|
+
// 预置:先把 PLC SP 裸写到 25℃,让 PV 从上轮残留收敛到低温 —— 6.4c 的"爬升"才有确定性基线
|
|
214
|
+
{
|
|
215
|
+
const net = await import('node:net')
|
|
216
|
+
await new Promise((resolve) => {
|
|
217
|
+
const sock = net.connect(15040, '127.0.0.1')
|
|
218
|
+
const b = Buffer.alloc(4)
|
|
219
|
+
b.writeFloatBE(25)
|
|
220
|
+
const words = [b.readUInt16BE(0), b.readUInt16BE(2)]
|
|
221
|
+
const frame = Buffer.alloc(17)
|
|
222
|
+
frame.writeUInt16BE(1, 0) // txn
|
|
223
|
+
frame.writeUInt16BE(0, 2) // proto
|
|
224
|
+
frame.writeUInt16BE(11, 4) // len(unit+PDU)
|
|
225
|
+
frame.writeUInt8(1, 6) // unit
|
|
226
|
+
frame.writeUInt8(16, 7) // FC16
|
|
227
|
+
frame.writeUInt16BE(20, 8) // start = 40021-40001
|
|
228
|
+
frame.writeUInt16BE(2, 10) // qty words
|
|
229
|
+
frame.writeUInt8(4, 12) // byte count
|
|
230
|
+
frame.writeUInt16BE(words[0], 13)
|
|
231
|
+
frame.writeUInt16BE(words[1], 15)
|
|
232
|
+
sock.on('connect', () => sock.write(frame))
|
|
233
|
+
sock.on('data', () => { sock.destroy(); resolve() })
|
|
234
|
+
sock.on('error', () => resolve())
|
|
235
|
+
setTimeout(() => { sock.destroy(); resolve() }, 3000)
|
|
236
|
+
})
|
|
237
|
+
await sleep(22_000) // τ=8s ×3,PV 充分回落(<60)
|
|
238
|
+
}
|
|
239
|
+
const prod = (await api('POST', '/api/workshop/dcw/products', { body: { name: `全协议产品-${TAG}`, lineId: line.id }, token })).data?.product
|
|
240
|
+
const plcSp = dcwNodes.plcsp
|
|
241
|
+
const recipe = (await api('POST', '/api/workshop/dcw/recipes', {
|
|
242
|
+
body: {
|
|
243
|
+
productId: prod.id, name: `全协议配方-${TAG}`,
|
|
244
|
+
params: [{ templateRef: 'dcw-temp-sp', nodeId: plcSp.id, value: 180, min: 176, max: 188 }],
|
|
245
|
+
daqWindows: [{ nodeId: daqNodes.plcpv.id, min: 100, max: 260 }],
|
|
246
|
+
}, token,
|
|
247
|
+
})).data?.recipe
|
|
248
|
+
check('3.1', '产品+配方(PLC-SP 绑工艺窗 176~188)', Boolean(prod?.id && recipe?.id))
|
|
249
|
+
const start = await api('POST', `/api/workshop/dcw/lines/${line.id}/start`, { body: { recipeId: recipe.id }, token })
|
|
250
|
+
check('3.2', '产线开跑(数采门控激活)', start.code === 0, start.message ?? '')
|
|
251
|
+
|
|
252
|
+
// ── 4. DAQ 采样落库 + 数值域 + WS 帧 ──
|
|
253
|
+
const aep = openAep(token)
|
|
254
|
+
await aep.ready
|
|
255
|
+
await sleep(9000)
|
|
256
|
+
for (const d of daqDefs) {
|
|
257
|
+
const node = daqNodes[d.id]
|
|
258
|
+
const s = await api('GET', `/api/workshop/daq/${node.id}/samples?bucketMs=1000`, { token })
|
|
259
|
+
const points = s.data?.points ?? s.data ?? []
|
|
260
|
+
const n = Array.isArray(points) ? points.length : 0
|
|
261
|
+
const lastVal = n > 0 ? Number(Object.values(points[n - 1] ?? {})[1] ?? NaN) : NaN
|
|
262
|
+
const inRange = Number.isFinite(lastVal) && lastVal >= d.expect[0] && lastVal <= d.expect[1]
|
|
263
|
+
check(`4.${d.id}`, `${d.driver} 持续采样落库(Timescale)`, n >= 4 && inRange,
|
|
264
|
+
`points=${n} last=${lastVal} 期望域[${d.expect.join(',')}] ${s.message ?? ''}`)
|
|
265
|
+
}
|
|
266
|
+
const daqFrames = aep.frames.filter(f => f.type === 'daq.reading' || f.type === 'daq.frame')
|
|
267
|
+
check('4.ws', 'WS 实时推送(daq.reading/frame 场景帧)', daqFrames.length >= 10, `frames=${daqFrames.length} total=${aep.frames.length}`)
|
|
268
|
+
|
|
269
|
+
// ── 5. DCW 读(读回设备参数);响应形状 { read: {...} } ──
|
|
270
|
+
const rPlc = await api('POST', `/api/workshop/dcw/${dcwNodes.plcsp.id}/read`, { token })
|
|
271
|
+
const plcRead = Number(rPlc.data?.read?.value ?? rPlc.data?.value ?? NaN)
|
|
272
|
+
check('5.1', 'DCW Modbus 读 SP 寄存器', rPlc.code === 0 && Number.isFinite(plcRead), `value=${plcRead} ${JSON.stringify(rPlc.data ?? {}).slice(0, 120)} ${rPlc.message ?? ''}`)
|
|
273
|
+
const rOpc = await api('POST', `/api/workshop/dcw/${dcwNodes.ocusp.id}/read`, { token })
|
|
274
|
+
const opcRead = Number(rOpc.data?.read?.value ?? rOpc.data?.value ?? NaN)
|
|
275
|
+
check('5.2', 'DCW OPC UA 读节点', rOpc.code === 0 && Number.isFinite(opcRead), `value=${opcRead} ${rOpc.message ?? ''}`)
|
|
276
|
+
const rMq = await api('POST', `/api/workshop/dcw/${dcwNodes.mqsp.id}/read`, { token })
|
|
277
|
+
const mqReadVal = rMq.data?.read?.value ?? rMq.data?.value
|
|
278
|
+
check('5.3', 'DCW MQTT 读=能力外优雅报错(仅下行)', !Number.isFinite(Number(mqReadVal)) && (rMq.code !== 0 || rMq.data?.read?.ok === false || rMq.data?.ok === false), `code=${rMq.code} read=${JSON.stringify(rMq.data?.read ?? {}).slice(0, 100)}`)
|
|
279
|
+
|
|
280
|
+
// ── 6. DCW 写 ×4 ──
|
|
281
|
+
// 6.1 MQTT 下行:先建订阅(不等待)→ 驱动写 → 收到的报文即真实链路证据
|
|
282
|
+
let mqttRx = null
|
|
283
|
+
try {
|
|
284
|
+
const { default: mqtt } = await import('mqtt')
|
|
285
|
+
const sub = await new Promise((resolve) => {
|
|
286
|
+
const c = mqtt.connect('mqtt://127.0.0.1:18830', { connectTimeout: 4000 })
|
|
287
|
+
const timer = setTimeout(() => { c.end(true); resolve(null) }, 8000)
|
|
288
|
+
c.on('connect', () => c.subscribe(`aw/sim/setpoint-${TAG}`, { qos: 1 }, () => { clearTimeout(timer); resolve(c) }))
|
|
289
|
+
c.on('error', () => { clearTimeout(timer); resolve(null) })
|
|
290
|
+
})
|
|
291
|
+
if (sub) {
|
|
292
|
+
const wMq = await api('POST', `/api/workshop/dcw/${dcwNodes.mqsp.id}/write`, { body: { value: 165.5 }, token })
|
|
293
|
+
check("6.1a", "DCW MQTT 下发执行", wMq.code === 0 && wMq.data?.outcome?.ok === true, JSON.stringify(wMq.data ?? wMq.message ?? {}).slice(0, 140))
|
|
294
|
+
mqttRx = await new Promise((resolve) => {
|
|
295
|
+
const timer = setTimeout(() => { sub.end(true); resolve(null) }, 10_000)
|
|
296
|
+
sub.on('message', (_t, payload) => { clearTimeout(timer); sub.end(true); resolve(payload.toString()) })
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch { /* mqtt 包不可用则跳过订阅验证 */ }
|
|
301
|
+
// broker 侧确定性验收:模拟器把真实路由落盘(broker 收到即证据,不依赖订阅端时序)
|
|
302
|
+
let auditHit = null
|
|
303
|
+
{
|
|
304
|
+
const auditPath = resolve('.AgentWorkShop/data/sim-setpoint-routes.log')
|
|
305
|
+
for (let i = 0; i < 10 && !auditHit; i++) {
|
|
306
|
+
await sleep(1000)
|
|
307
|
+
try {
|
|
308
|
+
const content = fs.readFileSync(auditPath, 'utf-8')
|
|
309
|
+
auditHit = content.split('\n').reverse().find(l => l.includes(`aw/sim/setpoint-${TAG}`)) ?? null
|
|
310
|
+
}
|
|
311
|
+
catch { /* 文件未生成 */ }
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
check('6.1b', 'DCW MQTT 真实报文抵达 Broker(broker 路由审计)', auditHit !== null && auditHit.includes('165.5'), `audit=${auditHit?.trim() ?? 'null'}`)
|
|
315
|
+
// 环境噪声重试:broker 实例可能在订阅/发布之间被杀换新,换全新订阅再写一次
|
|
316
|
+
if (auditHit === null) {
|
|
317
|
+
try {
|
|
318
|
+
const { default: mqtt2 } = await import('mqtt')
|
|
319
|
+
const sub2 = await new Promise((resolve) => {
|
|
320
|
+
const c = mqtt2.connect('mqtt://127.0.0.1:18830', { connectTimeout: 3000 })
|
|
321
|
+
const timer = setTimeout(() => { c.end(true); resolve(null) }, 6000)
|
|
322
|
+
c.on('connect', () => c.subscribe(`aw/sim/setpoint-${TAG}`, { qos: 1 }, () => { clearTimeout(timer); resolve(c) }))
|
|
323
|
+
c.on('error', () => { clearTimeout(timer); resolve(null) })
|
|
324
|
+
})
|
|
325
|
+
if (sub2) {
|
|
326
|
+
await api('POST', `/api/workshop/dcw/${dcwNodes.mqsp.id}/write`, { body: { value: 165.5 }, token })
|
|
327
|
+
mqttRx = await new Promise((resolve) => {
|
|
328
|
+
const timer = setTimeout(() => { sub2.end(true); resolve(null) }, 8000)
|
|
329
|
+
sub2.on('message', (_t, payload) => { clearTimeout(timer); sub2.end(true); resolve(payload.toString()) })
|
|
330
|
+
})
|
|
331
|
+
check('6.1b-retry', 'DCW MQTT 报文抵达(重订重写)', mqttRx !== null && mqttRx.includes('165.5'), `payload=${mqttRx}`)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
catch { /* ignore */ }
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// 6.2 HTTP 下发:经驱动 POST,模拟器日志留痕
|
|
338
|
+
const wHt = await api('POST', `/api/workshop/dcw/${dcwNodes.htsp.id}/write`, { body: { value: 168.25 }, token })
|
|
339
|
+
check("6.2a", "DCW HTTP 下发执行", wHt.code === 0 && wHt.data?.outcome?.ok === true, JSON.stringify(wHt.data ?? wHt.message ?? {}).slice(0, 140))
|
|
340
|
+
|
|
341
|
+
// 6.3 OPC UA 写 + 回读校验
|
|
342
|
+
const wOpc = await api('POST', `/api/workshop/dcw/${dcwNodes.ocusp.id}/write`, { body: { value: 172.5 }, token })
|
|
343
|
+
check("6.3a", "DCW OPC UA 写入", wOpc.code === 0 && wOpc.data?.outcome?.ok === true, JSON.stringify(wOpc.data ?? wOpc.message ?? {}).slice(0, 140))
|
|
344
|
+
await sleep(1200)
|
|
345
|
+
const rOpc2 = await api('POST', `/api/workshop/dcw/${dcwNodes.ocusp.id}/read`, { token })
|
|
346
|
+
const opc2 = Number(rOpc2.data?.read?.value ?? rOpc2.data?.value ?? NaN)
|
|
347
|
+
check('6.3b', 'DCW OPC UA 回读=172.5±1', Number.isFinite(opc2) && Math.abs(opc2 - 172.5) <= 1, `read=${opc2}`)
|
|
348
|
+
|
|
349
|
+
// 6.4 PLC Modbus 写(配方窗内)+ 真闭环 SP→PV 收敛
|
|
350
|
+
const wPlc = await api('POST', `/api/workshop/dcw/${plcSp.id}/write`, { body: { value: 182 }, token })
|
|
351
|
+
check("6.4a", "DCW Modbus 写 SP=182(配方窗内)", wPlc.code === 0 && wPlc.data?.outcome?.ok === true, JSON.stringify(wPlc.data ?? wPlc.message ?? {}).slice(0, 140))
|
|
352
|
+
const wPlcBad = await api('POST', `/api/workshop/dcw/${plcSp.id}/write`, { body: { value: 195 }, token })
|
|
353
|
+
check('6.4b', '配方窗联锁负例(195 越窗 → 400)', wPlcBad.status === 400, `status=${wPlcBad.status} msg=${String(wPlcBad.message ?? '').slice(0, 80)}`)
|
|
354
|
+
|
|
355
|
+
// PLC 一阶热惯性:PV 从 ~26(预置衰减后)随配方 SP=180 + 写 182 爬升收敛
|
|
356
|
+
const pvNode = daqNodes.plcpv
|
|
357
|
+
const pvStart = await api('GET', `/api/workshop/daq/${pvNode.id}/samples?bucketMs=1000`, { token })
|
|
358
|
+
const pv0 = (pvStart.data?.points ?? []).slice(-3).map(p => Number(Object.values(p)[1])).filter(Number.isFinite).at(-1)
|
|
359
|
+
let pvLastSeen = null
|
|
360
|
+
let pvEnd = null
|
|
361
|
+
let pvDiag = ''
|
|
362
|
+
try {
|
|
363
|
+
pvEnd = await waitUntil('PV 收敛', async () => {
|
|
364
|
+
const s = await api('GET', `/api/workshop/daq/${pvNode.id}/samples?bucketMs=1000`, { token })
|
|
365
|
+
const pts = s.data?.points ?? []
|
|
366
|
+
const v = pts.slice(-2).map(p => Number(Object.values(p)[1])).find(Number.isFinite)
|
|
367
|
+
if (Number.isFinite(v)) pvLastSeen = v
|
|
368
|
+
const view = await api('GET', '/api/workshop/daq', { token })
|
|
369
|
+
const me = (Array.isArray(view.data) ? view.data : (view.data?.nodes ?? [])).find(x => x.id === pvNode.id)
|
|
370
|
+
const lines = await api('GET', '/api/workshop/dcw/lines', { token })
|
|
371
|
+
const ln = (Array.isArray(lines.data) ? lines.data : (lines.data?.lines ?? [])).find(l => l.id === line.id)
|
|
372
|
+
pvDiag = `pts=${pts.length} node=${me?.state} err=${String(me?.lastError ?? '-').slice(0, 40)} lineRun=${ln && (ln.activeRun || ln.run) ? 'on' : 'off'}`
|
|
373
|
+
return Number.isFinite(v) && v >= 170 ? v : null
|
|
374
|
+
}, 90_000, 2500)
|
|
375
|
+
} catch { /* keep null */ }
|
|
376
|
+
// 物理真值回退:DAQ 观测链若被环境中断(模拟器运行中被杀/ revived),直接裸读寄存器验证闭环
|
|
377
|
+
let rawSp = null
|
|
378
|
+
let rawPv = null
|
|
379
|
+
if (!pvEnd) {
|
|
380
|
+
await new Promise((resolveRaw) => {
|
|
381
|
+
const sock = net.connect(15040, '127.0.0.1')
|
|
382
|
+
let buf = Buffer.alloc(0)
|
|
383
|
+
sock.on('connect', () => sock.write(Buffer.from([0, 1, 0, 0, 0, 6, 1, 3, 0, 0, 0, 0x16])))
|
|
384
|
+
sock.on('data', (d) => {
|
|
385
|
+
buf = Buffer.concat([buf, d])
|
|
386
|
+
if (buf.length >= 9 + 44) {
|
|
387
|
+
rawPv = Number(buf.subarray(9, 13).readFloatBE(0).toFixed(1))
|
|
388
|
+
rawSp = Number(buf.subarray(49, 53).readFloatBE(0).toFixed(1))
|
|
389
|
+
sock.destroy(); resolveRaw()
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
sock.on('error', () => resolveRaw())
|
|
393
|
+
setTimeout(() => { sock.destroy(); resolveRaw() }, 4000)
|
|
394
|
+
})
|
|
395
|
+
}
|
|
396
|
+
const loopProven = (Number.isFinite(pv0) && pv0 < 60 && Number.isFinite(pvEnd) && pvEnd >= 170)
|
|
397
|
+
|| (rawSp !== null && Math.abs(rawSp - 182) <= 2 && rawPv !== null && Math.abs(rawPv - rawSp) <= 6)
|
|
398
|
+
check('6.4c', '真实闭环:PLC PV 随 SP 收敛(≈26→≥170)', loopProven, `pv0=${pv0} pvEnd=${pvEnd} lastSeen=${pvLastSeen} | rawSP=${rawSp} rawPV=${rawPv} ${pvDiag}`)
|
|
399
|
+
|
|
400
|
+
// ── 7. 写后节点视图一致性 + journal ──
|
|
401
|
+
const list = await api('GET', '/api/workshop/dcw', { token })
|
|
402
|
+
const nodes = Array.isArray(list.data) ? list.data : (list.data?.nodes ?? [])
|
|
403
|
+
const plcNow = nodes.find(n => n.id === plcSp.id)
|
|
404
|
+
check('7.1', 'DCW 节点 readValue 收敛 182±2', plcNow && Math.abs(Number(plcNow.readValue) - 182) <= 2, `readValue=${plcNow?.readValue}`)
|
|
405
|
+
const journal = await api('GET', `/api/workshop/dcw/journal?nodeId=${plcSp.id}`, { token })
|
|
406
|
+
check('7.2', '写账本留痕(journal anchors)', (journal.data?.anchors ?? []).length >= 1, `anchors=${(journal.data?.anchors ?? []).length}`)
|
|
407
|
+
|
|
408
|
+
// ── 清理 ──
|
|
409
|
+
await api('POST', `/api/workshop/dcw/lines/${line.id}/stop`, { token }).catch(() => {})
|
|
410
|
+
for (const n of Object.values(daqNodes)) await api('DELETE', `/api/workshop/daq/${n.id}`, { token }).catch(() => {})
|
|
411
|
+
for (const n of Object.values(dcwNodes)) await api('DELETE', `/api/workshop/dcw/${n.id}`, { token }).catch(() => {})
|
|
412
|
+
await api('DELETE', `/api/workshop/dcw/lines/${line.id}`, { token }).catch(() => {})
|
|
413
|
+
|
|
414
|
+
console.log(`\n━━━ 矩阵结果: ${passed} passed / ${failures} failed ━━━`)
|
|
415
|
+
if (failures) {
|
|
416
|
+
console.log('失败项:')
|
|
417
|
+
for (const r of results.filter(x => !x.ok)) console.log(` ${r.id} ${r.name} — ${r.detail}`)
|
|
418
|
+
}
|
|
419
|
+
process.exit(failures === 0 ? 0 : 1)
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
main().catch((err) => {
|
|
423
|
+
console.error('FATAL', err)
|
|
424
|
+
process.exit(1)
|
|
425
|
+
})
|