agentworkshop 0.7.9 → 0.7.11
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{BUPj10t4.js → 6vYobj4F.js} +1 -1
- package/.output/public/_nuxt/{BCJFMBQ6.js → B-xskWta.js} +1 -1
- package/.output/public/_nuxt/{BC8s1Guv.js → B3Psw_sL.js} +1 -1
- package/.output/public/_nuxt/B53Mp7lD.js +1 -0
- package/.output/public/_nuxt/B5CYgFAD.js +14 -0
- package/.output/public/_nuxt/{91DZTUMJ.js → B8WV7GzS.js} +1 -1
- package/.output/public/_nuxt/{BDASpD_i.js → BBwMH_hG.js} +1 -1
- package/.output/public/_nuxt/BLzCac9K2.js +1 -0
- package/.output/public/_nuxt/BNXfwXpE.js +1 -0
- package/.output/public/_nuxt/BbZAzXjZ2.js +1 -0
- package/.output/public/_nuxt/{CFn4vHwD.js → Bc3PiGGr.js} +1 -1
- package/.output/public/_nuxt/{B0HpdCKS.js → Bckshc9V.js} +1 -1
- package/.output/public/_nuxt/BcrN7QEl2.js +1 -0
- package/.output/public/_nuxt/BgOhoDTI.js +1 -0
- package/.output/public/_nuxt/Bmpvki7M.js +1 -0
- package/.output/public/_nuxt/BxPPAkGA.js +3 -0
- package/.output/public/_nuxt/{u7KWCGSb.js → BxtpDtzC.js} +1 -1
- package/.output/public/_nuxt/{DxrgFxIr2.js → C4OAdbVK2.js} +1 -1
- package/.output/public/_nuxt/C6m-kenn.js +1 -0
- package/.output/public/_nuxt/{DDdEnkdw.js → CGx-mtWf.js} +1 -1
- package/.output/public/_nuxt/Cj6139IM.js +1 -0
- package/.output/public/_nuxt/{6PZPfFcO.js → Cor9siSf.js} +1 -1
- package/.output/public/_nuxt/{wirVyscc.js → D7jiode2.js} +1 -1
- package/.output/public/_nuxt/{Ct68Z0232.js → DA4lxCWC2.js} +1 -1
- package/.output/public/_nuxt/DEaY_uvR.js +1 -0
- package/.output/public/_nuxt/{MyA0Oeqd.js → DNxVTfhe.js} +1 -1
- package/.output/public/_nuxt/DT-Wg8r1.js +1 -0
- package/.output/public/_nuxt/DTYBfjRY.js +1 -0
- package/.output/public/_nuxt/{DvgKXPgu2.js → DWcEk1ur2.js} +1 -1
- package/.output/public/_nuxt/Dhqra7NB.js +1 -0
- package/.output/public/_nuxt/DlRO_q5L.js +1 -0
- package/.output/public/_nuxt/{D8EfUxO2.js → Ds8JbqGB.js} +1 -1
- package/.output/public/_nuxt/{DN5RuZ8k.js → DyisHHzD.js} +1 -1
- package/.output/public/_nuxt/ORt9oDIy2.js +1 -0
- package/.output/public/_nuxt/{By8BpbKH.js → QoCzfpo2.js} +1 -1
- package/.output/public/_nuxt/RzXYI9FM.js +23 -0
- package/.output/public/_nuxt/{BuktKVqK2.js → arUY5dyq2.js} +2 -2
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/88479a5b-ce6a-400f-9737-1cc9f54b1fe5.json +1 -0
- package/.output/public/_nuxt/{pKv_VWR4.js → d_Sz9KGm.js} +1 -1
- package/.output/public/_nuxt/{default.BR3e5fPY.css → default.BbgdTDCk.css} +1 -1
- package/.output/public/_nuxt/{C9cU_Ujd.js → eHYnGew0.js} +1 -1
- package/.output/public/_nuxt/{DM4CNkXz.js → eUGyJdiT.js} +1 -1
- package/.output/public/_nuxt/{entry.5qf6EqfN.css → entry.B03HBJGC.css} +1 -1
- package/.output/public/_nuxt/{B1g8pJmr.js → kkEthL84.js} +1 -1
- package/.output/public/_nuxt/permissions.CwZo6t1V.css +1 -0
- package/.output/public/_nuxt/settings.BqMF2nfj.css +1 -0
- package/.output/public/_nuxt/{D0Szyn_D.js → tJuVvBSl.js} +1 -1
- package/.output/public/_nuxt/zVkqCZ78.js +1 -0
- package/.output/server/chunks/_/LeftOutlined.mjs +1 -1
- package/.output/server/chunks/_/SearchOutlined.mjs +1 -1
- package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
- package/.output/server/chunks/_/host-bindings.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +1636 -1315
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
- package/.output/server/chunks/build/Col-biaNnEPf.mjs +1 -1
- package/.output/server/chunks/build/{OmpTerminalPanel-COphA1br.mjs → OmpTerminalPanel-Ban3yJZ4.mjs} +4 -5
- package/.output/server/chunks/build/OmpTerminalPanel-Ban3yJZ4.mjs.map +1 -0
- package/.output/server/chunks/build/{TownView-D8DSdO3H.mjs → TownView-CunmEMzS.mjs} +8 -9
- package/.output/server/chunks/build/{TownView-D8DSdO3H.mjs.map → TownView-CunmEMzS.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-BV4FfiYd.mjs → _id_-CVnMdSeG.mjs} +7 -7
- package/.output/server/chunks/build/{_id_-BV4FfiYd.mjs.map → _id_-CVnMdSeG.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-TP9hvnBM.mjs → _id_-D265Wh_k.mjs} +7 -7
- package/.output/server/chunks/build/{_id_-TP9hvnBM.mjs.map → _id_-D265Wh_k.mjs.map} +1 -1
- package/.output/server/chunks/build/{_wsId_-Mm9sQSz2.mjs → _wsId_-eNJmBp05.mjs} +17 -17
- package/.output/server/chunks/build/{_wsId_-Mm9sQSz2.mjs.map → _wsId_-eNJmBp05.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents-To3a5xcZ.mjs → agents-B10wmFri.mjs} +9 -9
- package/.output/server/chunks/build/{agents-To3a5xcZ.mjs.map → agents-B10wmFri.mjs.map} +1 -1
- package/.output/server/chunks/build/alert-qJnjyRcP.mjs +1 -1
- package/.output/server/chunks/build/api-error-dul30BYQ.mjs +1 -1
- package/.output/server/chunks/build/button-DEcZFcqN.mjs +2 -2
- package/.output/server/chunks/build/{card-Dipvaykh.mjs → card-CCPQoKlh.mjs} +4 -4
- package/.output/server/chunks/build/{card-Dipvaykh.mjs.map → card-CCPQoKlh.mjs.map} +1 -1
- package/.output/server/chunks/build/{channel-templates-DRsP-qxl.mjs → channel-templates-CpWxVk5A.mjs} +7 -7
- package/.output/server/chunks/build/{channel-templates-DRsP-qxl.mjs.map → channel-templates-CpWxVk5A.mjs.map} +1 -1
- package/.output/server/chunks/build/{checkbox-dzcpU_Cd.mjs → checkbox-Dv1kjaUZ.mjs} +3 -3
- package/.output/server/chunks/build/{checkbox-dzcpU_Cd.mjs.map → checkbox-Dv1kjaUZ.mjs.map} +1 -1
- package/.output/server/chunks/build/client-only-D5BzSQc6.mjs +1 -1
- package/.output/server/chunks/build/{daq-_hCEaYLd.mjs → daq-DxaXk_8N.mjs} +9 -10
- package/.output/server/chunks/build/daq-DxaXk_8N.mjs.map +1 -0
- package/.output/server/chunks/build/{dcw-C7pJ4Y0p.mjs → dcw-DqjHrl5Z.mjs} +5 -5
- package/.output/server/chunks/build/{dcw-C7pJ4Y0p.mjs.map → dcw-DqjHrl5Z.mjs.map} +1 -1
- package/.output/server/chunks/build/{default-Dnjs36e8.mjs → default-YcUHc1Ev.mjs} +19 -12
- package/.output/server/chunks/build/{default-Dnjs36e8.mjs.map → default-YcUHc1Ev.mjs.map} +1 -1
- package/.output/server/chunks/build/drawer-Cmh90erI.mjs +1 -1
- package/.output/server/chunks/build/dropdown-vhn1NPFs.mjs +2 -2
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs +554 -0
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs.map +1 -0
- package/.output/server/chunks/build/initDefaultProps-DIbWwP4R.mjs +1 -1
- package/.output/server/chunks/build/{input-sf_BT6o6.mjs → input-DxDqeyQW.mjs} +5 -553
- package/.output/server/chunks/build/input-DxDqeyQW.mjs.map +1 -0
- package/.output/server/chunks/build/{input-number-Bd55elNN.mjs → input-number-CZ3ZrCsy.mjs} +3 -3
- package/.output/server/chunks/build/{input-number-Bd55elNN.mjs.map → input-number-CZ3ZrCsy.mjs.map} +1 -1
- package/.output/server/chunks/build/{logs-C039TFW1.mjs → logs-Co854R4y.mjs} +6 -7
- package/.output/server/chunks/build/logs-Co854R4y.mjs.map +1 -0
- package/.output/server/chunks/build/menu-WCrlpYVh.mjs +2 -2
- package/.output/server/chunks/build/modal-yvUquPj5.mjs +2 -2
- package/.output/server/chunks/build/{monitor-MIOvsyLa.mjs → monitor-miqq9xHB.mjs} +11 -11
- package/.output/server/chunks/build/{monitor-MIOvsyLa.mjs.map → monitor-miqq9xHB.mjs.map} +1 -1
- package/.output/server/chunks/build/{pages-C_VSGSGo.mjs → pages-DPC1Vp6w.mjs} +5 -5
- package/.output/server/chunks/build/{pages-C_VSGSGo.mjs.map → pages-DPC1Vp6w.mjs.map} +1 -1
- package/.output/server/chunks/build/permissions-Eu9e6hfZ.mjs +534 -0
- package/.output/server/chunks/build/permissions-Eu9e6hfZ.mjs.map +1 -0
- package/.output/server/chunks/build/{plugins-4FMWkN8d.mjs → plugins-D84mvK9G.mjs} +3 -4
- package/.output/server/chunks/build/plugins-D84mvK9G.mjs.map +1 -0
- package/.output/server/chunks/build/popconfirm-CRaHcz5O.mjs +2 -2
- package/.output/server/chunks/build/responsiveObserve-CS0UB6wQ.mjs +1 -1
- package/.output/server/chunks/build/{segmented-DPe9ZzLO.mjs → segmented-ChmQZwz6.mjs} +5 -4
- package/.output/server/chunks/build/{segmented-DPe9ZzLO.mjs.map → segmented-ChmQZwz6.mjs.map} +1 -1
- package/.output/server/chunks/build/select-D-CeE5vY.mjs +1 -1
- package/.output/server/chunks/build/{settings-DA8IkGLo.mjs → settings-BPBll_7K.mjs} +28 -26
- package/.output/server/chunks/build/settings-BPBll_7K.mjs.map +1 -0
- package/.output/server/chunks/build/space-CCBYAkXt.mjs +2 -2
- package/.output/server/chunks/build/spin-HVY81X_L.mjs +1 -1
- package/.output/server/chunks/build/switch-CelRXpcy.mjs +2 -2
- package/.output/server/chunks/build/{table-Cswq-l2r.mjs → table-BtksyDlQ.mjs} +5 -5
- package/.output/server/chunks/build/{table-Cswq-l2r.mjs.map → table-BtksyDlQ.mjs.map} +1 -1
- package/.output/server/chunks/build/{tabs-BM3tAh_J.mjs → tabs-DQv-_-R6.mjs} +3 -3
- package/.output/server/chunks/build/{tabs-BM3tAh_J.mjs.map → tabs-DQv-_-R6.mjs.map} +1 -1
- package/.output/server/chunks/build/{tag-NO9jEqKy.mjs → tag-A0tZ2Ouq.mjs} +4 -4
- package/.output/server/chunks/build/{tag-NO9jEqKy.mjs.map → tag-A0tZ2Ouq.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-DA1lkf1n.mjs → teams-CNflUtPh.mjs} +7 -7
- package/.output/server/chunks/build/{teams-DA1lkf1n.mjs.map → teams-CNflUtPh.mjs.map} +1 -1
- package/.output/server/chunks/build/{tokens-DKMvvk3e.mjs → tokens-CZpnEDVf.mjs} +10 -10
- package/.output/server/chunks/build/{tokens-DKMvvk3e.mjs.map → tokens-CZpnEDVf.mjs.map} +1 -1
- package/.output/server/chunks/build/town-BUqRobze.mjs +1 -1
- package/.output/server/chunks/build/{town-D0thZ7PK.mjs → town-BbaR-8io.mjs} +9 -10
- package/.output/server/chunks/build/town-BbaR-8io.mjs.map +1 -0
- package/.output/server/chunks/build/{useDaqStream-BVTRw8_H.mjs → useDaqStream-BkmyQT06.mjs} +34 -23
- package/.output/server/chunks/build/useDaqStream-BkmyQT06.mjs.map +1 -0
- package/.output/server/chunks/build/{useDcwStream-DNsivqI_.mjs → useDcwStream-DWVoU96J.mjs} +60 -46
- package/.output/server/chunks/build/useDcwStream-DWVoU96J.mjs.map +1 -0
- package/.output/server/chunks/build/{useDeviceTwins-WeIom7A6.mjs → useDeviceTwins-34WGk9aN.mjs} +2 -2
- package/.output/server/chunks/build/{useDeviceTwins-WeIom7A6.mjs.map → useDeviceTwins-34WGk9aN.mjs.map} +1 -1
- package/.output/server/chunks/build/useLocalTime-9a4B-aHv.mjs +1 -1
- package/.output/server/chunks/build/{useOpsLog-DcKnPO43.mjs → useOpsLog-C9zTzYof.mjs} +27 -15
- package/.output/server/chunks/build/useOpsLog-C9zTzYof.mjs.map +1 -0
- package/.output/server/chunks/build/useSiteConfig-DJe_KMVr.mjs +1 -1
- package/.output/server/chunks/build/useWorkshopApi-D2gq06N2.mjs +1 -1
- package/.output/server/chunks/build/{useWorkshopWs-B3j5wIAK.mjs → useWorkshopWs-CprkZEdq.mjs} +2 -3
- package/.output/server/chunks/build/useWorkshopWs-CprkZEdq.mjs.map +1 -0
- package/.output/server/chunks/build/{users-CmVvb1oq.mjs → users-D6RNylrW.mjs} +10 -10
- package/.output/server/chunks/build/{users-CmVvb1oq.mjs.map → users-D6RNylrW.mjs.map} +1 -1
- package/.output/server/chunks/build/{workshop-BhWnJMWs.mjs → workshop-Crsai2Y9.mjs} +9 -9
- package/.output/server/chunks/build/{workshop-BhWnJMWs.mjs.map → workshop-Crsai2Y9.mjs.map} +1 -1
- package/.output/server/chunks/build/{workspaces-IfORCDJE.mjs → workspaces-BuydxM-3.mjs} +2 -3
- package/.output/server/chunks/build/workspaces-BuydxM-3.mjs.map +1 -0
- 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 +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/setup-status.get.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 +19 -8
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs.map +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 +2 -2
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +2 -2
- 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 +3 -3
- 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 +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +3 -3
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +7 -6
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +5 -4
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +5 -4
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +5 -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 +5 -4
- package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +5 -2
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +3 -2
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs.map +1 -1
- 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 +7 -6
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs.map +1 -1
- 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 +5 -4
- package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +4 -3
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs.map +1 -1
- 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 +4 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +8 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +4 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs.map +1 -1
- 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 +4 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs.map +1 -1
- 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 +7 -3
- package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +3 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +3 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs.map +1 -1
- 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 +5 -3
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs.map +1 -1
- 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 +2 -2
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +2 -2
- 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/index.put.mjs +41 -0
- package/.output/server/chunks/routes/api/workshop/index.put.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/index10.get.mjs +4 -3
- package/.output/server/chunks/routes/api/workshop/index10.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index11.get.mjs +27 -0
- package/.output/server/chunks/routes/api/workshop/index11.get.mjs.map +1 -0
- 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 +4 -4
- package/.output/server/chunks/routes/api/workshop/index3.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index4.get.mjs +5 -4
- package/.output/server/chunks/routes/api/workshop/index4.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index4.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs +18 -11
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs.map +1 -1
- 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 +24 -12
- package/.output/server/chunks/routes/api/workshop/index8.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs +12 -7
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs.map +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 +2 -2
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +2 -2
- 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 +2 -2
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +2 -2
- 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 +3 -3
- 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 +3 -3
- package/.output/server/chunks/virtual/entry.mjs +271 -31
- 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/README-zh.md +15 -0
- package/README.md +20 -0
- package/app/components/AppSidebar.vue +7 -1
- package/app/composables/workshop/apiClient.ts +103 -95
- package/app/composables/workshop/useDaqStream.ts +35 -21
- package/app/composables/workshop/useDcwStream.ts +22 -5
- package/app/composables/workshop/useOpsLog.ts +26 -13
- package/app/composables/workshop/useWorkshopWs.ts +11 -2
- package/app/pages/permissions/index.vue +327 -0
- package/app/pages/settings.vue +4 -2
- package/app/plugins/http.ts +18 -2
- package/app/plugins/session-restore.client.ts +7 -2
- package/app/stores/workshop/user.ts +14 -1
- package/i18n/locales/en.ts +37 -0
- package/i18n/locales/zh-CN.ts +37 -0
- package/package.json +1 -1
- package/scripts/_dbg-acc-1-setup.mjs +57 -0
- package/scripts/_dbg-acc-2-diag.mjs +14 -0
- package/scripts/_dbg-acc-2-intervals.mjs +81 -0
- package/scripts/_dbg-acc-3-daq.mjs +48 -0
- package/scripts/_dbg-acc-4-team.mjs +92 -0
- package/scripts/_dbg-acc-5-visual.mjs +63 -0
- package/scripts/_dbg-acc-5b-ws-town.mjs +18 -0
- package/scripts/_dbg-acc-5c-town.mjs +12 -0
- package/scripts/_dbg-acc-6-i18n.mjs +19 -0
- package/scripts/_dbg-audit-neg-e2e.mjs +64 -0
- package/scripts/_dbg-final-features.mjs +155 -0
- package/scripts/_dbg-final-fixups.mjs +62 -0
- package/scripts/_dbg-final-visual.mjs +29 -0
- package/scripts/_dbg-perms-e2e.mjs +102 -0
- package/scripts/_dbg-perms-visual.mjs +36 -0
- package/scripts/_dbg-protocol-matrix.mjs +16 -0
- package/sdk/api.mjs +117 -101
- package/sdk/context.mjs +240 -219
- package/sdk/hooks.mjs +105 -103
- package/sdk/index.d.mts +142 -135
- package/sdk/lifecycle.mjs +26 -25
- package/server/api/workshop/agent-tools/bindings/index.post.ts +40 -20
- package/server/api/workshop/daq/[id]/bind.post.ts +5 -2
- package/server/api/workshop/daq/[id]/frames/content.get.ts +4 -1
- package/server/api/workshop/daq/[id]/frames.get.ts +4 -1
- package/server/api/workshop/daq/[id]/samples.get.ts +4 -1
- package/server/api/workshop/daq/[id].patch.ts +3 -0
- package/server/api/workshop/daq/alarms/[id]/ack.post.ts +20 -15
- package/server/api/workshop/daq/controller.post.ts +2 -0
- package/server/api/workshop/daq/index.get.ts +5 -3
- package/server/api/workshop/daq/index.post.ts +2 -2
- package/server/api/workshop/dcw/[id]/bind.post.ts +20 -17
- package/server/api/workshop/dcw/[id]/test.post.ts +18 -15
- package/server/api/workshop/dcw/[id]/write.post.ts +3 -0
- package/server/api/workshop/dcw/index.get.ts +22 -9
- package/server/api/workshop/dcw/line/query.get.ts +38 -31
- package/server/api/workshop/dcw/lines/[id]/start.post.ts +3 -0
- package/server/api/workshop/dcw/lines/[id]/stop.post.ts +3 -0
- package/server/api/workshop/dcw/lines/index.get.ts +8 -2
- package/server/api/workshop/dcw/lines/index.post.ts +2 -2
- package/server/api/workshop/dcw/products/index.post.ts +16 -16
- package/server/api/workshop/dcw/runs/[id]/data.get.ts +20 -15
- package/server/api/workshop/dcw/runs/index.get.ts +13 -11
- package/server/api/workshop/permissions/index.get.ts +30 -0
- package/server/api/workshop/permissions/index.put.ts +29 -0
- package/server/api/workshop/ws.ts +18 -6
- package/server/data/daqs.json +48 -48
- package/server/data/dcw-products.json +21 -0
- package/server/data/dcw-recipes.json +84 -0
- package/server/data/dcw-rollback.json +94 -6
- package/server/data/dcw-runs.json +81 -75
- package/server/data/dcw-writes.json +108 -0
- package/server/data/dcws.json +645 -382
- package/server/data/line-runs.json +8 -8
- package/server/plugins/backup.ts +119 -116
- package/server/repositories/user.repository.ts +86 -6
- package/server/services/user.service.ts +5 -3
- package/server/services/workshop/daq/bus/index.ts +5 -3
- package/server/services/workshop/daq/bus/inproc.adapter.ts +12 -3
- package/server/services/workshop/daq/bus/mqtt.adapter.ts +13 -0
- package/server/services/workshop/daq/bus/queue-port.ts +2 -0
- package/server/services/workshop/daq/daq-controller.ts +18 -1
- package/server/services/workshop/db/ops.repo.ts +6 -0
- package/server/services/workshop/dcw/dcw-controller.ts +10 -2
- package/server/services/workshop/permissions.ts +79 -0
- package/server/services/workshop/plugins/host.mjs +38 -1
- package/server/services/workshop/scene-events.ts +25 -1
- package/shared/config/single-instance.mjs +24 -0
- package/shared/daq-protocol.ts +2 -0
- package/.output/public/_nuxt/B1kA8LhC.js +0 -14
- package/.output/public/_nuxt/B9MUiDFl.js +0 -1
- package/.output/public/_nuxt/B9dLFSYI.js +0 -1
- package/.output/public/_nuxt/BaMkWl5i2.js +0 -1
- package/.output/public/_nuxt/BmHvC_OU.js +0 -1
- package/.output/public/_nuxt/CBciOiTQ.js +0 -1
- package/.output/public/_nuxt/CUMdhxg9.js +0 -1
- package/.output/public/_nuxt/CgvGu2IO.js +0 -1
- package/.output/public/_nuxt/CjDQPXfv.js +0 -1
- package/.output/public/_nuxt/CmHzfVc5.js +0 -3
- package/.output/public/_nuxt/Cn3J3NXR.js +0 -23
- package/.output/public/_nuxt/Cst47G4-.js +0 -1
- package/.output/public/_nuxt/D3VJ3lex.js +0 -1
- package/.output/public/_nuxt/D8wyHvcz2.js +0 -1
- package/.output/public/_nuxt/Dqj2h40U.js +0 -1
- package/.output/public/_nuxt/OV6PBW2z.js +0 -1
- package/.output/public/_nuxt/builds/meta/92d6bd39-dbc5-46d5-90d8-8387f36715fa.json +0 -1
- package/.output/public/_nuxt/settings.DeRNNUcP.css +0 -1
- package/.output/server/chunks/build/OmpTerminalPanel-COphA1br.mjs.map +0 -1
- package/.output/server/chunks/build/daq-_hCEaYLd.mjs.map +0 -1
- package/.output/server/chunks/build/input-sf_BT6o6.mjs.map +0 -1
- package/.output/server/chunks/build/logs-C039TFW1.mjs.map +0 -1
- package/.output/server/chunks/build/plugins-4FMWkN8d.mjs.map +0 -1
- package/.output/server/chunks/build/settings-DA8IkGLo.mjs.map +0 -1
- package/.output/server/chunks/build/town-D0thZ7PK.mjs.map +0 -1
- package/.output/server/chunks/build/useDaqStream-BVTRw8_H.mjs.map +0 -1
- package/.output/server/chunks/build/useDcwStream-DNsivqI_.mjs.map +0 -1
- package/.output/server/chunks/build/useOpsLog-DcKnPO43.mjs.map +0 -1
- package/.output/server/chunks/build/useWorkshopWs-B3j5wIAK.mjs.map +0 -1
- package/.output/server/chunks/build/user-Dk-ytEUV.mjs +0 -140
- package/.output/server/chunks/build/user-Dk-ytEUV.mjs.map +0 -1
- package/.output/server/chunks/build/workspaces-IfORCDJE.mjs.map +0 -1
- /package/.output/public/_nuxt/{CNs_Ozdc2.js → CNs_Ozdc.js} +0 -0
- /package/.output/public/_nuxt/{Cno6kYiO2.js → Cno6kYiO.js} +0 -0
package/sdk/hooks.mjs
CHANGED
|
@@ -1,103 +1,105 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// AgentWorkShop SDK — HookBus(插件生命周期钩子总线)
|
|
3
|
-
// ------------------------------------------------------------
|
|
4
|
-
// 设计:
|
|
5
|
-
// · 异步串行触发(监听器按注册序 await,可返回值形成 waterfall)
|
|
6
|
-
// · 错误隔离:单监听器抛错不影响其他监听器,错误经 onError 上报
|
|
7
|
-
// · 支持通配符 '*'(接收 { type, payload })
|
|
8
|
-
// · 连续失败自动摘除(熔断):同一监听器连续失败超阈值自动停用,
|
|
9
|
-
// 防止病态插件拖垮事件桥
|
|
10
|
-
// ============================================================
|
|
11
|
-
|
|
12
|
-
const FAILLIMIT = 8
|
|
13
|
-
|
|
14
|
-
export class HookBus {
|
|
15
|
-
constructor({ name = 'hooks', onError } = {}) {
|
|
16
|
-
this.name = name
|
|
17
|
-
this.onError = onError ?? (() => {})
|
|
18
|
-
/** type → Array<{ fn, fails }> */
|
|
19
|
-
this.listeners = new Map()
|
|
20
|
-
this.count = 0
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** 注册监听器;type='*' 接收全部事件({type,payload})。返回解绑函数 */
|
|
24
|
-
on(type, fn) {
|
|
25
|
-
if (typeof type !== 'string' || typeof fn !== 'function') return () => {}
|
|
26
|
-
const list = this.listeners.get(type) ?? []
|
|
27
|
-
list.push({ fn, fails: 0 })
|
|
28
|
-
this.listeners.set(type, list)
|
|
29
|
-
this.count++
|
|
30
|
-
return () => this.off(type, fn)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** 一次性监听(触发后自动解绑) */
|
|
34
|
-
once(type, fn) {
|
|
35
|
-
const off = this.on(type, async (arg) => {
|
|
36
|
-
off()
|
|
37
|
-
return fn(arg)
|
|
38
|
-
})
|
|
39
|
-
return off
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
off(type, fn) {
|
|
43
|
-
const list = this.listeners.get(type)
|
|
44
|
-
if (!list) return
|
|
45
|
-
const idx = list.findIndex(l => l.fn === fn)
|
|
46
|
-
if (idx >= 0) {
|
|
47
|
-
list.splice(idx, 1)
|
|
48
|
-
this.count--
|
|
49
|
-
}
|
|
50
|
-
if (!list.length) this.listeners.delete(type)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 触发事件:同名监听器按注册序串行 await;返回最后一个非 undefined 返回值。
|
|
55
|
-
* emit 永不抛错——监听器错误被隔离并计数,连续超限自动摘除(熔断)。
|
|
56
|
-
*/
|
|
57
|
-
async emit(type, payload) {
|
|
58
|
-
const same = this.listeners.get(type)
|
|
59
|
-
const wild = this.listeners.get('*')
|
|
60
|
-
let result
|
|
61
|
-
if (same) {
|
|
62
|
-
for (const l of [...same]) {
|
|
63
|
-
const r = await this.#invoke(type, l, payload)
|
|
64
|
-
if (r !== undefined) result = r
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (wild) {
|
|
68
|
-
for (const l of [...wild]) {
|
|
69
|
-
await this.#invoke('*', l, { type, payload })
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return result
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async #invoke(type, l, payload) {
|
|
76
|
-
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
1
|
+
// ============================================================
|
|
2
|
+
// AgentWorkShop SDK — HookBus(插件生命周期钩子总线)
|
|
3
|
+
// ------------------------------------------------------------
|
|
4
|
+
// 设计:
|
|
5
|
+
// · 异步串行触发(监听器按注册序 await,可返回值形成 waterfall)
|
|
6
|
+
// · 错误隔离:单监听器抛错不影响其他监听器,错误经 onError 上报
|
|
7
|
+
// · 支持通配符 '*'(接收 { type, payload })
|
|
8
|
+
// · 连续失败自动摘除(熔断):同一监听器连续失败超阈值自动停用,
|
|
9
|
+
// 防止病态插件拖垮事件桥
|
|
10
|
+
// ============================================================
|
|
11
|
+
|
|
12
|
+
const FAILLIMIT = 8
|
|
13
|
+
|
|
14
|
+
export class HookBus {
|
|
15
|
+
constructor({ name = 'hooks', onError } = {}) {
|
|
16
|
+
this.name = name
|
|
17
|
+
this.onError = onError ?? (() => {})
|
|
18
|
+
/** type → Array<{ fn, fails }> */
|
|
19
|
+
this.listeners = new Map()
|
|
20
|
+
this.count = 0
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 注册监听器;type='*' 接收全部事件({type,payload})。返回解绑函数 */
|
|
24
|
+
on(type, fn) {
|
|
25
|
+
if (typeof type !== 'string' || typeof fn !== 'function') return () => {}
|
|
26
|
+
const list = this.listeners.get(type) ?? []
|
|
27
|
+
list.push({ fn, fails: 0 })
|
|
28
|
+
this.listeners.set(type, list)
|
|
29
|
+
this.count++
|
|
30
|
+
return () => this.off(type, fn)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 一次性监听(触发后自动解绑) */
|
|
34
|
+
once(type, fn) {
|
|
35
|
+
const off = this.on(type, async (arg) => {
|
|
36
|
+
off()
|
|
37
|
+
return fn(arg)
|
|
38
|
+
})
|
|
39
|
+
return off
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
off(type, fn) {
|
|
43
|
+
const list = this.listeners.get(type)
|
|
44
|
+
if (!list) return
|
|
45
|
+
const idx = list.findIndex(l => l.fn === fn)
|
|
46
|
+
if (idx >= 0) {
|
|
47
|
+
list.splice(idx, 1)
|
|
48
|
+
this.count--
|
|
49
|
+
}
|
|
50
|
+
if (!list.length) this.listeners.delete(type)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 触发事件:同名监听器按注册序串行 await;返回最后一个非 undefined 返回值。
|
|
55
|
+
* emit 永不抛错——监听器错误被隔离并计数,连续超限自动摘除(熔断)。
|
|
56
|
+
*/
|
|
57
|
+
async emit(type, payload) {
|
|
58
|
+
const same = this.listeners.get(type)
|
|
59
|
+
const wild = this.listeners.get('*')
|
|
60
|
+
let result
|
|
61
|
+
if (same) {
|
|
62
|
+
for (const l of [...same]) {
|
|
63
|
+
const r = await this.#invoke(type, l, payload)
|
|
64
|
+
if (r !== undefined) result = r
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (wild) {
|
|
68
|
+
for (const l of [...wild]) {
|
|
69
|
+
await this.#invoke('*', l, { type, payload })
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async #invoke(type, l, payload) {
|
|
76
|
+
try {
|
|
77
|
+
const r = await l.fn(payload)
|
|
78
|
+
l.fails = 0 // 仅"连续失败"触发熔断:成功即清零,偶发失败不累积驱逐
|
|
79
|
+
return r
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
l.fails++
|
|
83
|
+
try {
|
|
84
|
+
this.onError(err, { bus: this.name, type, fails: l.fails })
|
|
85
|
+
}
|
|
86
|
+
catch { /* 上报器自身错误忽略 */ }
|
|
87
|
+
if (l.fails >= FAILLIMIT) {
|
|
88
|
+
const list = this.listeners.get(type)
|
|
89
|
+
const idx = list?.indexOf(l) ?? -1
|
|
90
|
+
if (idx >= 0) {
|
|
91
|
+
list.splice(idx, 1)
|
|
92
|
+
this.count--
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return undefined
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** 已注册监听器总数(诊断用) */
|
|
100
|
+
get size() {
|
|
101
|
+
return this.count
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default HookBus
|
package/sdk/index.d.mts
CHANGED
|
@@ -1,135 +1,142 @@
|
|
|
1
|
-
// AgentWorkShop SDK 类型声明(agentworkshop/sdk)
|
|
2
|
-
import type { HookBus } from './hooks.mjs'
|
|
3
|
-
|
|
4
|
-
export declare const SDK_VERSION: string
|
|
5
|
-
|
|
6
|
-
/** 生命周期钩子总线:异步串行、错误隔离、'*' 通配、连续失败自动熔断 */
|
|
7
|
-
export declare class HookBus {
|
|
8
|
-
constructor(opts?: { name?: string, onError?: (err: Error, meta?: { bus?: string, type?: string, fails?: number }) => void })
|
|
9
|
-
on(type: string, fn: (payload: any) => any): () => void
|
|
10
|
-
once(type: string, fn: (payload: any) => any): () => void
|
|
11
|
-
off(type: string, fn: (payload: any) => any): void
|
|
12
|
-
emit(type: string, payload?: any): Promise<any>
|
|
13
|
-
readonly size: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface PluginLogger {
|
|
17
|
-
debug(...args: unknown[]): void
|
|
18
|
-
info(...args: unknown[]): void
|
|
19
|
-
warn(...args: unknown[]): void
|
|
20
|
-
error(...args: unknown[]): void
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface PluginKv {
|
|
24
|
-
get(key: string): any
|
|
25
|
-
set(key: string, value: any): any
|
|
26
|
-
all(): Record<string, any>
|
|
27
|
-
bump(key: string, by?: number): number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface PluginHttp {
|
|
31
|
-
get(url: string, opts?: { timeoutMs?: number, headers?: Record<string, string> }): Promise<Response>
|
|
32
|
-
post(url: string, body?: unknown, opts?: { timeoutMs?: number, headers?: Record<string, string> }): Promise<Response>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** 平台 REST 客户端(SDK 作为项目服务 client 的门面) */
|
|
36
|
-
export interface PlatformClient {
|
|
37
|
-
call<T = any>(method: string, path: string, body?: unknown): Promise<T>
|
|
38
|
-
get<T = any>(path: string, query?: Record<string, unknown>): Promise<T>
|
|
39
|
-
post<T = any>(path: string, body?: unknown): Promise<T>
|
|
40
|
-
patch<T = any>(path: string, body?: unknown): Promise<T>
|
|
41
|
-
delete<T = any>(path: string): Promise<T>
|
|
42
|
-
setToken(token: string | null): PlatformClient
|
|
43
|
-
ping(): Promise<any>
|
|
44
|
-
users: { list(q?: any): Promise<any>, get(id: string): Promise<any>, create(b: any): Promise<any>, login(email: string, password: string): Promise<any>, me(): Promise<any> }
|
|
45
|
-
lines: { list(q?: any): Promise<any>, get(id: string): Promise<any>, create(b: any): Promise<any>, update(id: string, p: any): Promise<any>, remove(id: string): Promise<any>, start(id: string, recipeId?: string): Promise<any>, stop(id: string): Promise<any> }
|
|
46
|
-
products: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
47
|
-
recipes: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
48
|
-
dcwNodes: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
49
|
-
daqNodes: { list(q?: any): Promise<any>, create(b: any): Promise<any>, alarms(): Promise<any> }
|
|
50
|
-
templates: { daq(): Promise<any[]>, dcw(): Promise<any[]> }
|
|
51
|
-
twins: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
52
|
-
teams: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
53
|
-
agents: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
54
|
-
channels: { list(q?: any): Promise<any> }
|
|
55
|
-
plugins: { manifest(): Promise<any> }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface PluginContext {
|
|
59
|
-
name: string
|
|
60
|
-
scope: 'project' | 'user'
|
|
61
|
-
dir: string
|
|
62
|
-
sdkVersion: string
|
|
63
|
-
hooks: HookBus
|
|
64
|
-
logger: PluginLogger
|
|
65
|
-
config: {
|
|
66
|
-
get(key: string): any
|
|
67
|
-
all(): Record<string, any>
|
|
68
|
-
onChange(fn: (payload?: { at: string }) => any): () => void
|
|
69
|
-
}
|
|
70
|
-
paths: { home: string, configRoot: string, dataDir: string }
|
|
71
|
-
dataDir: string
|
|
72
|
-
kv: PluginKv
|
|
73
|
-
timer: {
|
|
74
|
-
setInterval(fn: (...args: any[]) => void, ms: number, ...rest: any[]): NodeJS.Timeout
|
|
75
|
-
setTimeout(fn: (...args: any[]) => void, ms: number, ...rest: any[]): NodeJS.Timeout
|
|
76
|
-
}
|
|
77
|
-
onDispose(fn: () => any): () => void
|
|
78
|
-
subscriptions: { add(d: { dispose(): any } | (() => any)): any }
|
|
79
|
-
route(method: string, path: string, handler: (event: any) => any): boolean
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
export declare function
|
|
111
|
-
export declare function
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
export
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1
|
+
// AgentWorkShop SDK 类型声明(agentworkshop/sdk)
|
|
2
|
+
import type { HookBus } from './hooks.mjs'
|
|
3
|
+
|
|
4
|
+
export declare const SDK_VERSION: string
|
|
5
|
+
|
|
6
|
+
/** 生命周期钩子总线:异步串行、错误隔离、'*' 通配、连续失败自动熔断 */
|
|
7
|
+
export declare class HookBus {
|
|
8
|
+
constructor(opts?: { name?: string, onError?: (err: Error, meta?: { bus?: string, type?: string, fails?: number }) => void })
|
|
9
|
+
on(type: string, fn: (payload: any) => any): () => void
|
|
10
|
+
once(type: string, fn: (payload: any) => any): () => void
|
|
11
|
+
off(type: string, fn: (payload: any) => any): void
|
|
12
|
+
emit(type: string, payload?: any): Promise<any>
|
|
13
|
+
readonly size: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PluginLogger {
|
|
17
|
+
debug(...args: unknown[]): void
|
|
18
|
+
info(...args: unknown[]): void
|
|
19
|
+
warn(...args: unknown[]): void
|
|
20
|
+
error(...args: unknown[]): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PluginKv {
|
|
24
|
+
get(key: string): any
|
|
25
|
+
set(key: string, value: any): any
|
|
26
|
+
all(): Record<string, any>
|
|
27
|
+
bump(key: string, by?: number): number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PluginHttp {
|
|
31
|
+
get(url: string, opts?: { timeoutMs?: number, headers?: Record<string, string> }): Promise<Response>
|
|
32
|
+
post(url: string, body?: unknown, opts?: { timeoutMs?: number, headers?: Record<string, string> }): Promise<Response>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 平台 REST 客户端(SDK 作为项目服务 client 的门面) */
|
|
36
|
+
export interface PlatformClient {
|
|
37
|
+
call<T = any>(method: string, path: string, body?: unknown): Promise<T>
|
|
38
|
+
get<T = any>(path: string, query?: Record<string, unknown>): Promise<T>
|
|
39
|
+
post<T = any>(path: string, body?: unknown): Promise<T>
|
|
40
|
+
patch<T = any>(path: string, body?: unknown): Promise<T>
|
|
41
|
+
delete<T = any>(path: string): Promise<T>
|
|
42
|
+
setToken(token: string | null): PlatformClient
|
|
43
|
+
ping(): Promise<any>
|
|
44
|
+
users: { list(q?: any): Promise<any>, get(id: string): Promise<any>, create(b: any): Promise<any>, login(email: string, password: string): Promise<any>, me(): Promise<any> }
|
|
45
|
+
lines: { list(q?: any): Promise<any>, get(id: string): Promise<any>, create(b: any): Promise<any>, update(id: string, p: any): Promise<any>, remove(id: string): Promise<any>, start(id: string, recipeId?: string): Promise<any>, stop(id: string): Promise<any> }
|
|
46
|
+
products: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
47
|
+
recipes: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
48
|
+
dcwNodes: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
49
|
+
daqNodes: { list(q?: any): Promise<any>, create(b: any): Promise<any>, alarms(): Promise<any> }
|
|
50
|
+
templates: { daq(): Promise<any[]>, dcw(): Promise<any[]> }
|
|
51
|
+
twins: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
52
|
+
teams: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
53
|
+
agents: { list(q?: any): Promise<any>, create(b: any): Promise<any> }
|
|
54
|
+
channels: { list(q?: any): Promise<any> }
|
|
55
|
+
plugins: { manifest(): Promise<any> }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PluginContext {
|
|
59
|
+
name: string
|
|
60
|
+
scope: 'project' | 'user'
|
|
61
|
+
dir: string
|
|
62
|
+
sdkVersion: string
|
|
63
|
+
hooks: HookBus
|
|
64
|
+
logger: PluginLogger
|
|
65
|
+
config: {
|
|
66
|
+
get(key: string): any
|
|
67
|
+
all(): Record<string, any>
|
|
68
|
+
onChange(fn: (payload?: { at: string }) => any): () => void
|
|
69
|
+
}
|
|
70
|
+
paths: { home: string, configRoot: string, dataDir: string }
|
|
71
|
+
dataDir: string
|
|
72
|
+
kv: PluginKv
|
|
73
|
+
timer: {
|
|
74
|
+
setInterval(fn: (...args: any[]) => void, ms: number, ...rest: any[]): NodeJS.Timeout
|
|
75
|
+
setTimeout(fn: (...args: any[]) => void, ms: number, ...rest: any[]): NodeJS.Timeout
|
|
76
|
+
}
|
|
77
|
+
onDispose(fn: () => any): () => void
|
|
78
|
+
subscriptions: { add(d: { dispose(): any } | (() => any)): any }
|
|
79
|
+
route(method: string, path: string, handler: (event: any) => any): boolean
|
|
80
|
+
/** 产线权限拓展面(用户 × 产线三态授权: none / readonly / operate) */
|
|
81
|
+
permissions: {
|
|
82
|
+
lineMode(user: { id: string, role: string }, lineId: string | null | undefined): 'none' | 'readonly' | 'operate'
|
|
83
|
+
visibleLineIds(user: { id: string, role: string }): Set<string> | null
|
|
84
|
+
listGrants(userId: string): Array<{ lineId: string, mode: string, grantedBy: string | null, grantedAt: string }>
|
|
85
|
+
setGrants(userId: string, grants: Array<{ lineId: string, mode: 'readonly' | 'operate' | null }>, grantedBy?: string): Array<{ lineId: string, mode: string }>
|
|
86
|
+
}
|
|
87
|
+
api: PlatformClient
|
|
88
|
+
http: PluginHttp
|
|
89
|
+
events: { on(type: string, fn: (payload: any) => any): () => void, off(type: string, fn: (payload: any) => any): void }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PluginRouteDef {
|
|
93
|
+
method?: string
|
|
94
|
+
path: string
|
|
95
|
+
handler: (event: any) => any
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface PluginDef {
|
|
99
|
+
name: string
|
|
100
|
+
version?: string
|
|
101
|
+
description?: string
|
|
102
|
+
setup?(ctx: PluginContext): void | Promise<void>
|
|
103
|
+
client?: string
|
|
104
|
+
routes?: PluginRouteDef[]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** 显式糖:类型化定义插件(宿主同样接受裸对象导出) */
|
|
108
|
+
export declare function definePlugin(def: PluginDef): PluginDef
|
|
109
|
+
|
|
110
|
+
export declare function createPluginContext(opts: Record<string, any>): PluginContext
|
|
111
|
+
export declare function createRouteTable(): {
|
|
112
|
+
register(name: string, method: string, path: string, handler: (event: any) => any): boolean
|
|
113
|
+
resolve(name: string, method: string, path: string): ((event: any) => any) | null
|
|
114
|
+
byPlugin(name: string): Array<{ method: string, path: string }>
|
|
115
|
+
readonly size: number
|
|
116
|
+
}
|
|
117
|
+
export declare function validatePluginModule(mod: any, source: string): { ok: boolean, def?: PluginDef, error?: string }
|
|
118
|
+
export declare function pluginKvExists(dataDir: string, name: string): boolean
|
|
119
|
+
|
|
120
|
+
export declare function createPlatformClient(opts?: { baseUrl?: string, token?: string, logger?: PluginLogger, timeoutMs?: number }): PlatformClient
|
|
121
|
+
|
|
122
|
+
export declare const LIFECYCLE_EVENTS: readonly ['plugin:host:init', 'config:changed', 'event:*', 'daq:sample', 'dcw:write', 'line:start', 'line:stop', 'server:close']
|
|
123
|
+
export declare const CLIENT_EVENTS: readonly ['client:init', 'event:*', 'page:change', 'client:destroy']
|
|
124
|
+
|
|
125
|
+
/** 客户端插件上下文(sdk/client.mjs) */
|
|
126
|
+
export declare const CLIENT_SDK_VERSION: string
|
|
127
|
+
export interface ClientContext {
|
|
128
|
+
name: string
|
|
129
|
+
sdkVersion: string
|
|
130
|
+
hooks: HookBus
|
|
131
|
+
on(type: string, fn: (payload: any) => any): () => void
|
|
132
|
+
fetch<T = any>(path: string, opt?: { method?: string, body?: unknown, headers?: Record<string, string> }): Promise<T>
|
|
133
|
+
el(tag: string, attrs?: Record<string, unknown>, children?: Array<Node | string>): HTMLElement
|
|
134
|
+
mount(target: string | Element, node: Node): Node
|
|
135
|
+
root(): HTMLElement
|
|
136
|
+
log: PluginLogger
|
|
137
|
+
dispose(): void
|
|
138
|
+
}
|
|
139
|
+
export declare function createClientContext(opts: { name: string, eventBridge?: (fn: (type: string, payload: any) => void) => (() => void), baseUrl?: string }): ClientContext
|
|
140
|
+
|
|
141
|
+
declare const _default: Record<string, unknown>
|
|
142
|
+
export default _default
|
package/sdk/lifecycle.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// AgentWorkShop SDK — 生命周期事件清单(宿主触发;单一事实源)
|
|
3
|
-
// ============================================================
|
|
4
|
-
|
|
5
|
-
/** 服务端生命周期事件清单(宿主触发;文档见 docs/plugins.md) */
|
|
6
|
-
export const LIFECYCLE_EVENTS = Object.freeze([
|
|
7
|
-
'plugin:host:init',
|
|
8
|
-
'config:changed',
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'line:
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
// ============================================================
|
|
2
|
+
// AgentWorkShop SDK — 生命周期事件清单(宿主触发;单一事实源)
|
|
3
|
+
// ============================================================
|
|
4
|
+
|
|
5
|
+
/** 服务端生命周期事件清单(宿主触发;文档见 docs/plugins.md) */
|
|
6
|
+
export const LIFECYCLE_EVENTS = Object.freeze([
|
|
7
|
+
'plugin:host:init',
|
|
8
|
+
'config:changed',
|
|
9
|
+
'permissions:changed',
|
|
10
|
+
'event:*',
|
|
11
|
+
'daq:sample',
|
|
12
|
+
'dcw:write',
|
|
13
|
+
'line:start',
|
|
14
|
+
'line:stop',
|
|
15
|
+
'server:close',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
/** 客户端生命周期事件清单 */
|
|
19
|
+
export const CLIENT_EVENTS = Object.freeze([
|
|
20
|
+
'client:init',
|
|
21
|
+
'event:*',
|
|
22
|
+
'page:change',
|
|
23
|
+
'client:destroy',
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
export default { LIFECYCLE_EVENTS, CLIENT_EVENTS }
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* POST /api/workshop/agent-tools/bindings —— 绑定 Agent ↔ 工业节点。
|
|
3
|
-
* body: { agentId, nodeId, kind: 'dcw'|'daq', mode: 'auto'|'manual' }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/workshop/agent-tools/bindings —— 绑定 Agent ↔ 工业节点。
|
|
3
|
+
* body: { agentId, nodeId, kind: 'dcw'|'daq', mode: 'auto'|'manual' }
|
|
4
|
+
* 产线权限:普通用户仅可绑定自己有权产线的节点——daq 绑定需「仅查看」及以上,
|
|
5
|
+
* dcw(写控)绑定需「可操控」;admin/editor 不受限。
|
|
6
|
+
*/
|
|
7
|
+
import { readBody } from 'h3'
|
|
8
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
9
|
+
import { defineApiHandler } from '@/server/utils/response'
|
|
10
|
+
import { getAgentNodeBindingRepo } from '@/server/services/workshop/agents/node-bindings.repo'
|
|
11
|
+
import { lineMode } from '@/server/services/workshop/permissions'
|
|
12
|
+
import { getDaqController } from '@/server/services/workshop/daq/daq-controller'
|
|
13
|
+
import { getDcwController } from '@/server/services/workshop/dcw/dcw-controller'
|
|
14
|
+
import { AppError, ErrorCodes } from '@/server/utils/errors'
|
|
15
|
+
|
|
16
|
+
export default defineApiHandler(async (event) => {
|
|
17
|
+
const user = resolveUser(event)
|
|
18
|
+
const body = await readBody<{ agentId?: string, nodeId?: string, kind?: 'dcw' | 'daq', mode?: 'auto' | 'manual' }>(event) ?? {}
|
|
19
|
+
const kind = body.kind ?? 'dcw'
|
|
20
|
+
const nodeId = String(body.nodeId ?? '')
|
|
21
|
+
// 绑定前置:节点必须存在,且用户对其所属产线有足额权限
|
|
22
|
+
const lineId = kind === 'daq'
|
|
23
|
+
? getDaqController().byId(nodeId)?.lineId
|
|
24
|
+
: getDcwController().byId(nodeId)?.lineId
|
|
25
|
+
if (!lineId) {
|
|
26
|
+
throw new AppError(404, ErrorCodes.NOT_FOUND, `${kind === 'daq' ? '数采' : '写控'}节点不存在: ${nodeId}`)
|
|
27
|
+
}
|
|
28
|
+
const mode = lineMode(user, lineId)
|
|
29
|
+
const needOperate = kind === 'dcw'
|
|
30
|
+
if (mode === 'none' || (needOperate && mode !== 'operate')) {
|
|
31
|
+
throw new AppError(403, 'LINE_FORBIDDEN', `无该产线权限:绑定${kind === 'daq' ? '数采' : '写控'}节点需对产线「${lineId}」拥有${needOperate ? '可操控' : '仅查看'}及以上权限`)
|
|
32
|
+
}
|
|
33
|
+
const binding = getAgentNodeBindingRepo().bind(
|
|
34
|
+
String(body.agentId ?? ''),
|
|
35
|
+
nodeId,
|
|
36
|
+
kind,
|
|
37
|
+
body.mode ?? 'auto',
|
|
38
|
+
)
|
|
39
|
+
return { binding }
|
|
40
|
+
})
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getRouterParam, readBody } from 'h3'
|
|
6
6
|
import { resolveUser } from '@/server/api/workshop/caller'
|
|
7
|
+
import { requireLineMode } from '@/server/services/workshop/permissions'
|
|
7
8
|
import { defineApiHandler } from '@/server/utils/response'
|
|
8
|
-
import { bindDaqHost } from '@/server/services/workshop/daq/host-bindings'
|
|
9
|
+
import { bindDaqHost } from '@/server/services/workshop/daq/host-bindings'
|
|
9
10
|
import { getDaqController } from '@/server/services/workshop/daq/daq-controller'
|
|
10
11
|
import { broadcastSceneEvent } from '../../../../services/workshop/scene-events'
|
|
11
12
|
|
|
12
13
|
export default defineApiHandler(async (event) => {
|
|
13
|
-
resolveUser(event)
|
|
14
|
+
const user = resolveUser(event)
|
|
14
15
|
bindDaqHost(broadcastSceneEvent)
|
|
15
16
|
const id = getRouterParam(event, 'id') ?? ''
|
|
17
|
+
// 产线权限:数采设备绑定=操控能力(绑定后通道值回写设备)
|
|
18
|
+
requireLineMode(user, getDaqController().byId(id)?.lineId, 'operate')
|
|
16
19
|
const body = await readBody<{ deviceId?: string | null }>(event) ?? {}
|
|
17
20
|
const node = getDaqController().bind(id, body.deviceId ?? null)
|
|
18
21
|
return { node: node.toView() }
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { createError, defineEventHandler, getQuery, getRouterParam, setResponseHeader } from 'h3'
|
|
9
9
|
import { resolveUser } from '@/server/api/workshop/caller'
|
|
10
|
+
import { requireLineMode } from '@/server/services/workshop/permissions'
|
|
10
11
|
import { getDaqController } from '@/server/services/workshop/daq/daq-controller'
|
|
11
12
|
|
|
12
13
|
export default defineEventHandler(async (event) => {
|
|
13
|
-
resolveUser(event)
|
|
14
|
+
const user = resolveUser(event)
|
|
14
15
|
const id = getRouterParam(event, 'id') ?? ''
|
|
16
|
+
// 产线权限:帧内容需「仅查看」及以上
|
|
17
|
+
requireLineMode(user, getDaqController().byId(id)?.lineId, 'readonly')
|
|
15
18
|
const q = getQuery(event)
|
|
16
19
|
const ts = Number(q.ts)
|
|
17
20
|
if (!Number.isFinite(ts) || ts <= 0) {
|