agentworkshop 0.7.39 → 0.7.41
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 +55 -0
- package/.output/.AgentWorkShop/prompts/host-tools.json +55 -0
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/88GOowgO2.js +1 -0
- package/.output/public/_nuxt/{BNT8gYU92.js → BC9wjTJK2.js} +2 -2
- package/.output/public/_nuxt/{CY9LbPCI.js → BN16aRdQ.js} +1 -1
- package/.output/public/_nuxt/BWVhZntO.js +1 -0
- package/.output/public/_nuxt/{HBLJ-wei.js → BXxH0UQE.js} +1 -1
- package/.output/public/_nuxt/{zIGh7R49.js → BneN7fbu.js} +1 -1
- package/.output/public/_nuxt/BsROmY89.js +1 -0
- package/.output/public/_nuxt/{DUrecWPx.js → C0ZrS1KL.js} +2 -2
- package/.output/public/_nuxt/{C_OLzD09.js → C4oW1HsE.js} +1 -1
- package/.output/public/_nuxt/{CUDwzgLV.js → C4s_niy-.js} +9 -9
- package/.output/public/_nuxt/CFxtLwjp.js +1 -0
- package/.output/public/_nuxt/{Cec0Ua3F.js → CS50LB_l.js} +1 -1
- package/.output/public/_nuxt/CssgYAAL2.js +1 -0
- package/.output/public/_nuxt/D6mbFA-a.js +1 -0
- package/.output/public/_nuxt/D98NH8kG.js +1 -0
- package/.output/public/_nuxt/DGIuvyRN2.js +1 -0
- package/.output/public/_nuxt/DGbd-UiG.js +1 -0
- package/.output/public/_nuxt/{CojCTLKD.js → DGj-WEBg.js} +1 -1
- package/.output/public/_nuxt/{DDShH71m.js → DS8qj8EL.js} +1 -1
- package/.output/public/_nuxt/DTFCy6h-.js +1 -0
- package/.output/public/_nuxt/{DrYV5i68.js → DUjW5Yq5.js} +1 -1
- package/.output/public/_nuxt/{45zuyAso.js → D_OTvQza.js} +1 -1
- package/.output/public/_nuxt/Dap5PmTL.js +2 -0
- package/.output/public/_nuxt/Dqw1lpr-.js +1 -0
- package/.output/public/_nuxt/DvLxILQP.js +1 -0
- package/.output/public/_nuxt/IREZ1eC2.js +1 -0
- package/.output/public/_nuxt/TownView.f-YOdXRs.css +1 -0
- package/.output/public/_nuxt/_id_.D9ymtHB5.css +1 -0
- package/.output/public/_nuxt/_id_.jf-_8E_c.css +1 -0
- package/.output/public/_nuxt/_wsId_.B4WiqkIS.css +1 -0
- package/.output/public/_nuxt/agents.ZD0rVdHE.css +1 -0
- package/.output/public/_nuxt/aml.BN8ZEW4h.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/78a295bb-2072-48a4-8b46-6d545fdae743.json +1 -0
- package/.output/public/_nuxt/ca4TJ3Op.js +1 -0
- package/.output/public/_nuxt/channel-templates.BOtahzPi.css +1 -0
- package/.output/public/_nuxt/daq.DjSgY94l.css +1 -0
- package/.output/public/_nuxt/dcw.8Y7FqCVN.css +1 -0
- package/.output/public/_nuxt/default.J32SgqFY.css +1 -0
- package/.output/public/_nuxt/entry.bdm0tv6M.css +1 -0
- package/.output/public/_nuxt/eqq3wWQF.js +18 -0
- package/.output/public/_nuxt/logs.BpKzmKsh.css +1 -0
- package/.output/public/_nuxt/monitor.D9pe7qN6.css +1 -0
- package/.output/public/_nuxt/pages.D7aSDlUI.css +1 -0
- package/.output/public/_nuxt/permissions.DwTVlFe6.css +1 -0
- package/.output/public/_nuxt/plugins.sb4nDGqr.css +1 -0
- package/.output/public/_nuxt/{Cbq-mryP.js → qr6R6Ha1.js} +1 -1
- package/.output/public/_nuxt/settings.BTgR-NiE.css +1 -0
- package/.output/public/_nuxt/teams.CxnxKVVs.css +1 -0
- package/.output/public/_nuxt/tokens.BFY7qv4f.css +1 -0
- package/.output/public/_nuxt/{town.DKIAhKnx.css → town.BBXZmeoP.css} +1 -1
- package/.output/public/_nuxt/users.DLgZ1D0h.css +1 -0
- package/.output/public/_nuxt/workshop.CR_QzeAN.css +1 -0
- package/.output/public/_nuxt/{BzHEilTt.js → xh3_vYcu.js} +1 -1
- package/.output/public/_nuxt/yF0aYMF1.js +4 -0
- package/.output/server/chunks/_/entity.mjs.map +1 -1
- package/.output/server/chunks/_/nitro.mjs +2355 -1362
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/build/{TownView-jVazYOjN.mjs → TownView--otsnr_7.mjs} +290 -208
- package/.output/server/chunks/build/TownView--otsnr_7.mjs.map +1 -0
- package/.output/server/chunks/build/{_id_-CfVosNg3.mjs → _id_-Brv-JSvr.mjs} +142 -141
- package/.output/server/chunks/build/_id_-Brv-JSvr.mjs.map +1 -0
- package/.output/server/chunks/build/{_id_-Hwr4rZpr.mjs → _id_-D9pl1OZy.mjs} +38 -36
- package/.output/server/chunks/build/_id_-D9pl1OZy.mjs.map +1 -0
- package/.output/server/chunks/build/{_wsId_-BVg3bB77.mjs → _wsId_-BASfDf0s.mjs} +295 -261
- package/.output/server/chunks/build/{_wsId_-BVg3bB77.mjs.map → _wsId_-BASfDf0s.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents-Bvin73QY.mjs → agents-CLQqJF2y.mjs} +21 -27
- package/.output/server/chunks/build/agents-CLQqJF2y.mjs.map +1 -0
- package/.output/server/chunks/build/{aml-BCSJCdX7.mjs → aml-_7FdFL2p.mjs} +109 -109
- package/.output/server/chunks/build/{aml-BCSJCdX7.mjs.map → aml-_7FdFL2p.mjs.map} +1 -1
- package/.output/server/chunks/build/api-error-dul30BYQ.mjs.map +1 -1
- package/.output/server/chunks/build/{channel-templates-BTq8570n.mjs → channel-templates-p6SZNjlM.mjs} +19 -19
- package/.output/server/chunks/build/{channel-templates-BTq8570n.mjs.map → channel-templates-p6SZNjlM.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-C03Uu5UE.mjs → daq-DkMvD8sg.mjs} +193 -126
- package/.output/server/chunks/build/daq-DkMvD8sg.mjs.map +1 -0
- package/.output/server/chunks/build/{dcw-6vEYVeje.mjs → dcw-C1jgVJkO.mjs} +46 -46
- package/.output/server/chunks/build/{dcw-6vEYVeje.mjs.map → dcw-C1jgVJkO.mjs.map} +1 -1
- package/.output/server/chunks/build/{default-CZmZFpqH.mjs → default-BE4r0FZN.mjs} +152 -58
- package/.output/server/chunks/build/{default-CZmZFpqH.mjs.map → default-BE4r0FZN.mjs.map} +1 -1
- package/.output/server/chunks/build/{logs-B-xhuqln.mjs → logs--dByNyhw.mjs} +35 -35
- package/.output/server/chunks/build/{logs-B-xhuqln.mjs.map → logs--dByNyhw.mjs.map} +1 -1
- package/.output/server/chunks/build/{monitor-CyfDt4nR.mjs → monitor-C0okQaXz.mjs} +33 -33
- package/.output/server/chunks/build/{monitor-CyfDt4nR.mjs.map → monitor-C0okQaXz.mjs.map} +1 -1
- package/.output/server/chunks/build/{pages-BO7yZsXA.mjs → pages-B0bUWnC6.mjs} +35 -19
- package/.output/server/chunks/build/pages-B0bUWnC6.mjs.map +1 -0
- package/.output/server/chunks/build/{permissions-B52oOmaO.mjs → permissions-68SsNjex.mjs} +12 -12
- package/.output/server/chunks/build/{permissions-B52oOmaO.mjs.map → permissions-68SsNjex.mjs.map} +1 -1
- package/.output/server/chunks/build/{plugins-CUWmMdyt.mjs → plugins-lGlUr1lj.mjs} +17 -17
- package/.output/server/chunks/build/{plugins-CUWmMdyt.mjs.map → plugins-lGlUr1lj.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-DoQ2Oq3P.mjs → settings-Ddd1qx2Z.mjs} +50 -47
- package/.output/server/chunks/build/settings-Ddd1qx2Z.mjs.map +1 -0
- package/.output/server/chunks/build/{teams-2kz3CusY.mjs → teams-MEDLZdMn.mjs} +38 -34
- package/.output/server/chunks/build/teams-MEDLZdMn.mjs.map +1 -0
- package/.output/server/chunks/build/{tokens-BbWLqtVz.mjs → tokens-C7fTM5C2.mjs} +14 -14
- package/.output/server/chunks/build/{tokens-BbWLqtVz.mjs.map → tokens-C7fTM5C2.mjs.map} +1 -1
- package/.output/server/chunks/build/{town-BOl6hs9B.mjs → town-CoQdblbZ.mjs} +38 -12
- package/.output/server/chunks/build/town-CoQdblbZ.mjs.map +1 -0
- package/.output/server/chunks/build/{useDaqStream-CIBaiGAl.mjs → useDaqStream-DfCFpb3p.mjs} +9 -3
- package/.output/server/chunks/build/useDaqStream-DfCFpb3p.mjs.map +1 -0
- package/.output/server/chunks/build/{useDcwStream-CBbiYnWe.mjs → useDcwStream-UPiX-3iO.mjs} +11 -2
- package/.output/server/chunks/build/useDcwStream-UPiX-3iO.mjs.map +1 -0
- package/.output/server/chunks/build/useResponsive-BKDMGTHs.mjs +49 -0
- package/.output/server/chunks/build/useResponsive-BKDMGTHs.mjs.map +1 -0
- package/.output/server/chunks/build/{users-fohSmF-J.mjs → users-Cfd5-l2-.mjs} +6 -6
- package/.output/server/chunks/build/{users-fohSmF-J.mjs.map → users-Cfd5-l2-.mjs.map} +1 -1
- package/.output/server/chunks/build/{workshop-DX5-ldc4.mjs → workshop-BL5bhfs0.mjs} +15 -15
- package/.output/server/chunks/build/{workshop-DX5-ldc4.mjs.map → workshop-BL5bhfs0.mjs.map} +1 -1
- package/.output/server/chunks/build/{workspaces-BuydxM-3.mjs → workspaces-Bgz5Ekwp.mjs} +18 -3
- package/.output/server/chunks/build/workspaces-Bgz5Ekwp.mjs.map +1 -0
- package/.output/server/chunks/routes/api/system/config-groups/_id_.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/system/index.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/system/index.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/system/settings/events.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +6 -2
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +2 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +3 -3
- package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +3 -2
- 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 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +8 -6
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +5 -5
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +14 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +4 -4
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +4 -3
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs +31 -0
- package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs +28 -0
- package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs +32 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs +34 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs +33 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs +34 -0
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs +3 -1
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.get.mjs +5 -1
- package/.output/server/chunks/routes/api/workshop/index6.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs +3 -1
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs.map +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/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/workspaces/_id/channel-templates/_tplId_.post.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +3 -3
- package/.output/server/chunks/virtual/entry.mjs +51 -25
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +203 -39
- package/README.md +739 -591
- package/app/app.vue +9 -3
- package/app/assets/css/main.css +517 -7
- package/app/components/AppHeader.vue +98 -7
- package/app/components/AppSidebar.vue +117 -11
- package/app/components/AwChart.vue +2 -1
- package/app/components/workshop/AgentInspectorDrawer.vue +6 -6
- package/app/components/workshop/AgentLanesView.vue +52 -1
- package/app/components/workshop/AssetLibrary.vue +4 -2
- package/app/components/workshop/ChannelSessionList.vue +4 -2
- package/app/components/workshop/Composer.vue +96 -0
- package/app/components/workshop/DaqNodeRow.vue +19 -0
- package/app/components/workshop/DaqTemplateIcon.vue +33 -0
- package/app/components/workshop/DeviceTwinPanel.vue +37 -35
- package/app/components/workshop/EventBlock.vue +3 -3
- package/app/components/workshop/InspectorPanel.vue +47 -11
- package/app/components/workshop/LiveAgentBar.vue +34 -0
- package/app/components/workshop/TaskBoardView.vue +83 -33
- package/app/components/workshop/TranscriptTimeline.vue +56 -0
- package/app/components/workshop/blocks/ClusterError.vue +1 -1
- package/app/components/workshop/blocks/ClusterRoute.vue +3 -1
- package/app/components/workshop/blocks/ClusterStatus.vue +2 -2
- package/app/components/workshop/blocks/ClusterStream.vue +8 -2
- package/app/components/workshop/town/ModelPreview3D.vue +1 -1
- package/app/components/workshop/town/TownView.vue +507 -82
- package/app/composables/useResponsive.ts +88 -0
- package/app/composables/useRouteMeta.ts +3 -0
- package/app/composables/workshop/useDaqStream.ts +7 -4
- package/app/composables/workshop/useDcwStream.ts +8 -2
- package/app/composables/workshop/useVisibleInterval.ts +2 -2
- package/app/composables/workshop/useWorkshopApi.ts +1 -1
- package/app/layouts/default.vue +46 -2
- package/app/pages/aml/index.vue +712 -616
- package/app/pages/daq/[id].vue +12 -7
- package/app/pages/daq/index.vue +216 -13
- package/app/pages/dcw/[id].vue +117 -32
- package/app/pages/dcw/index.vue +83 -23
- package/app/pages/index.vue +35 -1
- package/app/pages/logs/index.vue +147 -13
- package/app/pages/monitor.vue +56 -12
- package/app/pages/permissions/index.vue +34 -0
- package/app/pages/plugins/index.vue +35 -4
- package/app/pages/settings.vue +90 -21
- package/app/pages/tokens.vue +23 -0
- package/app/pages/town.vue +50 -5
- package/app/pages/users.vue +23 -0
- package/app/pages/workshop/agents.vue +92 -2
- package/app/pages/workshop/channel-templates.vue +53 -0
- package/app/pages/workshop/index.vue +14 -0
- package/app/pages/workshop/teams.vue +66 -6
- package/app/pages/workshop/w/[wsId].vue +202 -14
- package/app/plugins/aw-plugins.client.ts +13 -8
- package/app/stores/app.ts +33 -1
- package/app/stores/workshop/user.ts +1 -1
- package/app/stores/workshop/workspaces.ts +18 -2
- package/app/utils/api-error.ts +1 -1
- package/cli/commands/build.mjs +8 -1
- package/docker-compose.yml +6 -0
- package/docs/cli.en.md +2 -2
- package/docs/cli.md +2 -2
- package/docs/plugins.en.md +33 -1
- package/docs/plugins.md +29 -1
- package/docs/sdk.en.md +1 -1
- package/docs/sdk.md +1 -1
- package/i18n/locales/en.ts +2 -0
- package/i18n/locales/zh-CN.ts +2 -0
- package/nuxt.config.ts +31 -0
- package/package.json +11 -2
- package/scripts/_dbg-param-map-e2e.ts +242 -0
- package/scripts/_dbg-param-map-rest-smoke.mjs +73 -0
- package/scripts/_dbg-param-real-scenario.mjs +153 -0
- package/scripts/_loop-biax-campaign.mjs +124 -0
- package/scripts/api-live-e2e.mjs +40 -8
- package/scripts/capture-walkthrough.mjs +232 -0
- package/scripts/render-walkthrough-figure.mjs +46 -0
- package/scripts/seed-walkthrough-fixture.mjs +143 -0
- package/scripts/test-plugin-hardening.mjs +8 -0
- package/scripts/test-serial-bridge.mjs +418 -0
- package/scripts/ui/admin-shots.mjs +46 -0
- package/scripts/ui/audit-layout.mjs +301 -0
- package/scripts/ui/bump-microfont.mjs +39 -0
- package/scripts/ui/e2e-interactive.mjs +328 -0
- package/scripts/ui/lib.mjs +198 -0
- package/scripts/ui/linkcheck2.mjs +37 -0
- package/scripts/ui/live-render-check.mjs +72 -0
- package/scripts/ui/md-lint.mjs +80 -0
- package/scripts/ui/perf-audit.mjs +132 -0
- package/scripts/ui/readme-assets.mjs +30 -0
- package/scripts/ui/readme-shots.mjs +42 -0
- package/scripts/ui/record.mjs +225 -0
- package/scripts/ui/seed-admin.mjs +68 -0
- package/scripts/ui/seed-demo.mjs +83 -0
- package/scripts/ui/seed-industrial-demo.mjs +171 -0
- package/scripts/ui/shot-hero.mjs +25 -0
- package/scripts/ui/shots.mjs +75 -0
- package/scripts/ui/sim-ui-shot.mjs +16 -0
- package/scripts/ui/verify-nav.mjs +51 -0
- package/scripts/ui/verify-responsive.mjs +285 -0
- package/server/api/system/config-groups/[id].patch.ts +1 -1
- package/server/api/system/config-groups/index.post.ts +1 -1
- package/server/api/system/settings/events.get.ts +1 -1
- package/server/api/system/settings/index.patch.ts +1 -1
- package/server/api/workshop/agent-tools/invoke.post.ts +16 -2
- package/server/api/workshop/aml/datasets/[id].get.ts +8 -1
- package/server/api/workshop/daq/index.get.ts +3 -1
- package/server/api/workshop/daq/infra/reconnect.post.ts +1 -1
- package/server/api/workshop/daq/templates/[key].delete.ts +1 -0
- package/server/api/workshop/daq/templates/[key].patch.ts +1 -0
- package/server/api/workshop/daq/templates/index.post.ts +1 -0
- package/server/api/workshop/dcw/[id]/write.post.ts +10 -2
- package/server/api/workshop/dcw/[id].delete.ts +5 -2
- package/server/api/workshop/dcw/index.get.ts +5 -0
- package/server/api/workshop/dcw/lines/[id].patch.ts +1 -1
- package/server/api/workshop/dcw/params/[id]/read.post.ts +17 -0
- package/server/api/workshop/dcw/params/[id]/write.post.ts +21 -0
- package/server/api/workshop/dcw/params/[id].delete.ts +19 -0
- package/server/api/workshop/dcw/params/[id].patch.ts +23 -0
- package/server/api/workshop/dcw/params/index.get.ts +27 -0
- package/server/api/workshop/dcw/params/index.post.ts +25 -0
- package/server/api/workshop/permissions/index.get.ts +3 -1
- package/server/plugins/aw-plugins.ts +23 -10
- package/server/plugins/dev-stability-guard.ts +3 -1
- package/server/plugins/system-config.ts +6 -1
- package/server/plugins-builtin/serial-bridge/client.mjs +210 -0
- package/server/plugins-builtin/serial-bridge/drivers.mjs +409 -0
- package/server/plugins-builtin/serial-bridge/i18n.json +62 -0
- package/server/plugins-builtin/serial-bridge/index.mjs +247 -0
- package/server/plugins-builtin/serial-bridge/lib.mjs +208 -0
- package/server/plugins-builtin/serial-bridge/rtu.mjs +168 -0
- package/server/services/system-config.ts +28 -9
- package/server/services/workshop/agents/adapters/one-shot-cli-agent.ts +2 -1
- package/server/services/workshop/agents/agent-interface.ts +8 -6
- package/server/services/workshop/agents/base-agent.ts +18 -4
- package/server/services/workshop/agents/claude-agent.ts +7 -3
- package/server/services/workshop/agents/codex-agent.ts +3 -3
- package/server/services/workshop/agents/dsh-agent.ts +3 -3
- package/server/services/workshop/agents/goose-agent.ts +0 -1
- package/server/services/workshop/agents/harness-terminal.ts +14 -1
- package/server/services/workshop/agents/hermes-agent.ts +4 -2
- package/server/services/workshop/agents/host-tool-bridge.ts +5 -1
- package/server/services/workshop/agents/industrial-context.ts +4 -1
- package/server/services/workshop/agents/industrial-tools.ts +164 -6
- package/server/services/workshop/agents/omp-agent.ts +15 -9
- package/server/services/workshop/agents/opencode-agent.ts +47 -21
- package/server/services/workshop/agents/qwen-agent.ts +10 -5
- package/server/services/workshop/aml/entity.ts +3 -1
- package/server/services/workshop/aml/python-runtime.ts +3 -2
- package/server/services/workshop/daq/bus/mqtt.adapter.ts +8 -4
- package/server/services/workshop/daq/daq-controller.ts +25 -5
- package/server/services/workshop/daq/daq-runtime.ts +5 -3
- package/server/services/workshop/daq/drivers.ts +141 -11
- package/server/services/workshop/daq/host-ports.ts +3 -2
- package/server/services/workshop/daq/storage/timescale.adapter.ts +3 -1
- package/server/services/workshop/db/channel.repo.ts +4 -0
- package/server/services/workshop/db/ops.repo.ts +5 -2
- package/server/services/workshop/db/retention.ts +8 -3
- package/server/services/workshop/dcw/dcw-controller.ts +147 -16
- package/server/services/workshop/dcw/dcw-product.repo.ts +38 -1
- package/server/services/workshop/dcw/dcw-runtime.ts +3 -2
- package/server/services/workshop/dcw/drivers.ts +90 -4
- package/server/services/workshop/dcw/param-conversion.ts +78 -0
- package/server/services/workshop/dcw/param-limits.ts +142 -0
- package/server/services/workshop/dcw/param-map.repo.ts +305 -0
- package/server/services/workshop/dcw/plugin-bridge.ts +45 -0
- package/server/services/workshop/dcw/recipe-rollback-manager.ts +13 -7
- package/server/services/workshop/plugins/host.mjs +30 -0
- package/server/services/workshop/runtime/agent-runtime.ts +4 -0
- package/server/services/workshop/runtime/manager.ts +9 -2
- package/server/services/workshop/settings.ts +4 -2
- package/server/types/pg.d.ts +49 -0
- package/server/utils/stability-severity.ts +13 -2
- package/shared/config/groups.mjs +22 -1
- package/shared/config/home.d.mts +28 -0
- package/shared/daq-protocol.ts +15 -0
- package/shared/dcw-protocol.ts +136 -0
- package/uno.config.ts +12 -1
- package/.output/public/_nuxt/8NMOXZOV.js +0 -1
- package/.output/public/_nuxt/BFkgkW8u.js +0 -4
- package/.output/public/_nuxt/C5gUkRwn.js +0 -1
- package/.output/public/_nuxt/CM12FuB42.js +0 -1
- package/.output/public/_nuxt/CZiw7sEV.js +0 -1
- package/.output/public/_nuxt/Cc_9VzD42.js +0 -1
- package/.output/public/_nuxt/CdPzkOMV.js +0 -1
- package/.output/public/_nuxt/CmsOtOAA2.js +0 -1
- package/.output/public/_nuxt/D1YDxZpZ.js +0 -1
- package/.output/public/_nuxt/D20Yamr4.js +0 -1
- package/.output/public/_nuxt/DAe0h2MB.js +0 -1
- package/.output/public/_nuxt/DmqknNvV.js +0 -18
- package/.output/public/_nuxt/DnUuIR83.js +0 -1
- package/.output/public/_nuxt/S_fVQwJK.js +0 -1
- package/.output/public/_nuxt/TownView.0oLiQgTC.css +0 -1
- package/.output/public/_nuxt/_id_.D-SYuyZb.css +0 -1
- package/.output/public/_nuxt/_id_.hma_BU6T.css +0 -1
- package/.output/public/_nuxt/_wsId_.B12v3PhY.css +0 -1
- package/.output/public/_nuxt/agents.BV70ioCv.css +0 -1
- package/.output/public/_nuxt/ahgEJu2R.js +0 -1
- package/.output/public/_nuxt/aml.COEKNNqK.css +0 -1
- package/.output/public/_nuxt/builds/meta/4457d63f-0866-4cea-b320-04a321f24795.json +0 -1
- package/.output/public/_nuxt/channel-templates.C-M5nKcC.css +0 -1
- package/.output/public/_nuxt/daq.B3265ZDn.css +0 -1
- package/.output/public/_nuxt/dcw.DLYZqEhT.css +0 -1
- package/.output/public/_nuxt/default.BXI_fZUi.css +0 -1
- package/.output/public/_nuxt/entry.BB-Eeh-J.css +0 -1
- package/.output/public/_nuxt/logs.CqFyMrJw.css +0 -1
- package/.output/public/_nuxt/monitor.B--1dPzs.css +0 -1
- package/.output/public/_nuxt/pages.ooEzrMm9.css +0 -1
- package/.output/public/_nuxt/permissions.B1pjGChZ.css +0 -1
- package/.output/public/_nuxt/plugins.5e5chZ67.css +0 -1
- package/.output/public/_nuxt/pz2JDAM7.js +0 -2
- package/.output/public/_nuxt/settings.Dm3M0RLy.css +0 -1
- package/.output/public/_nuxt/teams.BC75EGnR.css +0 -1
- package/.output/public/_nuxt/tokens.xRb1fSPU.css +0 -1
- package/.output/public/_nuxt/users.CXnP2E08.css +0 -1
- package/.output/public/_nuxt/workshop.Jk5HxWPE.css +0 -1
- package/.output/server/chunks/build/TownView-jVazYOjN.mjs.map +0 -1
- package/.output/server/chunks/build/_id_-CfVosNg3.mjs.map +0 -1
- package/.output/server/chunks/build/_id_-Hwr4rZpr.mjs.map +0 -1
- package/.output/server/chunks/build/agents-Bvin73QY.mjs.map +0 -1
- package/.output/server/chunks/build/daq-C03Uu5UE.mjs.map +0 -1
- package/.output/server/chunks/build/pages-BO7yZsXA.mjs.map +0 -1
- package/.output/server/chunks/build/settings-DoQ2Oq3P.mjs.map +0 -1
- package/.output/server/chunks/build/teams-2kz3CusY.mjs.map +0 -1
- package/.output/server/chunks/build/town-BOl6hs9B.mjs.map +0 -1
- package/.output/server/chunks/build/useDaqStream-CIBaiGAl.mjs.map +0 -1
- package/.output/server/chunks/build/useDcwStream-CBbiYnWe.mjs.map +0 -1
- package/.output/server/chunks/build/workspaces-BuydxM-3.mjs.map +0 -1
- /package/.output/public/_nuxt/{36oeS8_R2.js → 36oeS8_R.js} +0 -0
- /package/.output/public/_nuxt/{CYWVXZTS.js → CYWVXZTS2.js} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GET /api/workshop/dcw/params —— 工艺参数映射列表(登录用户)。
|
|
3
|
+
* 仅语义面(key/单位/限界/当前值/驱动类别);寄存器等 PLC 寻址细节不透出。
|
|
4
|
+
* ?lineId= 过滤产线;?limits=1 附带各参数的有效限界剖面(分层 + 交集)。
|
|
5
|
+
*/
|
|
6
|
+
import { getQuery } from 'h3'
|
|
7
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
8
|
+
import { filterByLine } from '@/server/services/workshop/permissions'
|
|
9
|
+
import { defineApiHandler } from '@/server/utils/response'
|
|
10
|
+
import { bindDcwBroadcast, getDcwController } from '@/server/services/workshop/dcw/dcw-controller'
|
|
11
|
+
import { broadcastSceneEvent } from '@/server/services/workshop/scene-events'
|
|
12
|
+
|
|
13
|
+
export default defineApiHandler(async (event) => {
|
|
14
|
+
const user = resolveUser(event)
|
|
15
|
+
bindDcwBroadcast(broadcastSceneEvent)
|
|
16
|
+
const ctrl = getDcwController()
|
|
17
|
+
const q = getQuery(event)
|
|
18
|
+
const lineFilter = q.lineId ? String(q.lineId) : ''
|
|
19
|
+
let params = ctrl.listParamViews()
|
|
20
|
+
params = filterByLine(user, params, p => p.lineId)
|
|
21
|
+
if (lineFilter) params = params.filter(p => p.lineId === lineFilter)
|
|
22
|
+
const withLimits = q.limits === '1'
|
|
23
|
+
return {
|
|
24
|
+
params,
|
|
25
|
+
limits: withLimits ? params.map(p => ctrl.paramLimitsOf(p.id)) : undefined,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/workshop/dcw/params —— 创建工艺参数映射。
|
|
3
|
+
* 路径一(nodeId):映射指向既有写控制执行节点;
|
|
4
|
+
* 路径二(access):设备连接 + 寄存器 + 标准转换模式一键建映射
|
|
5
|
+
* (系统按转换模式自动创建执行节点,用户不手工拼装驱动配置)。
|
|
6
|
+
*/
|
|
7
|
+
import { readBody } from 'h3'
|
|
8
|
+
import type { DcwParamInput } from '#shared/dcw-protocol'
|
|
9
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
10
|
+
import { requireLineMode } from '@/server/services/workshop/permissions'
|
|
11
|
+
import { defineApiHandler } from '@/server/utils/response'
|
|
12
|
+
import { bindDcwBroadcast, getDcwController } from '@/server/services/workshop/dcw/dcw-controller'
|
|
13
|
+
import { broadcastSceneEvent } from '@/server/services/workshop/scene-events'
|
|
14
|
+
|
|
15
|
+
export default defineApiHandler(async (event) => {
|
|
16
|
+
const user = resolveUser(event)
|
|
17
|
+
bindDcwBroadcast(broadcastSceneEvent)
|
|
18
|
+
const body = await readBody<Partial<DcwParamInput>>(event) ?? {}
|
|
19
|
+
// 产线权限:目标产线(access 自动建节点)或执行节点所在产线需「可操控」
|
|
20
|
+
const lineId = body.access
|
|
21
|
+
? (body.lineId ?? '')
|
|
22
|
+
: (body.nodeId ? getDcwController().byId(String(body.nodeId))?.lineId : undefined)
|
|
23
|
+
requireLineMode(user, lineId, 'operate')
|
|
24
|
+
return { param: getDcwController().createParamMapping(body) }
|
|
25
|
+
})
|
|
@@ -23,7 +23,9 @@ export default defineApiHandler(async (event) => {
|
|
|
23
23
|
// channel 列表按 owner 归并(每用户一次轻量查询;channel 行自带 ownerUserId)
|
|
24
24
|
const out = users.map(u => ({
|
|
25
25
|
...u,
|
|
26
|
-
|
|
26
|
+
// ChannelRow 的 channel 主键列名是 id(SELECT 'id, name, ...');原写的 c.channelId 运行时恒 undefined,
|
|
27
|
+
// 与前端 UserRow.channels: Array<{ id, name, createdAt }>(app/pages/permissions/index.vue)不一致
|
|
28
|
+
channels: manager.listChannelsForUser(u.id).map(c => ({ id: c.id, name: c.name, createdAt: c.createdAt })),
|
|
27
29
|
grants: grantsByUser.get(u.id) ?? [],
|
|
28
30
|
}))
|
|
29
31
|
return { lines, users: out }
|
|
@@ -9,19 +9,32 @@ import { existsSync } from 'node:fs'
|
|
|
9
9
|
import { dirname, resolve } from 'node:path'
|
|
10
10
|
|
|
11
11
|
// packageRoot = 本包根。nitro 打包后 import.meta.url 位于 .output/server/chunks/ 内,
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
// 且 chunk 相对包根的层级随 nitro 版本变化(如 chunks/build/xxx.mjs 比源码布局深一层),
|
|
13
|
+
// 固定 2/3 级上溯在**全局安装布局**(node_modules/agentworkshop/)下探测不到包根,
|
|
14
|
+
// builtin 插件会全部失踪。改为从 chunk 目录逐级上溯(上限 8 级 ≫ 任何已知布局),
|
|
15
|
+
// 以「server/plugins-builtin 真实存在」为命中判据;最后兜底 cwd(源码运行)。
|
|
16
|
+
const candidates: string[] = []
|
|
17
|
+
for (let dir = dirname(fileURLToPath(import.meta.url)), i = 0; i < 8; i++, dir = dirname(dir)) {
|
|
18
|
+
candidates.push(dir)
|
|
19
|
+
}
|
|
20
|
+
candidates.push(process.cwd())
|
|
19
21
|
const packageRoot = candidates.find(r => existsSync(resolve(r, 'server', 'plugins-builtin'))) ?? process.cwd()
|
|
20
22
|
|
|
21
23
|
export default defineNitroPlugin((nitroApp) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
// host.mjs 是未类型化的 JS:TS 从 `{ cwd = process.cwd(), packageRoot } = {}` 推断形参类型时只保留了
|
|
25
|
+
// 带默认值的 cwd,丢掉了没有默认值的 shorthand 属性 packageRoot(host.mjs 内部确实会解构并使用它,
|
|
26
|
+
// 见 host.mjs 的 host.packageRoot / resolveRunMode({ cwd, packageRoot }))。按真实形参给局部变量
|
|
27
|
+
// 加注解即可,调用本身逐字不变。
|
|
28
|
+
const hostOptions: { cwd?: string, packageRoot?: string } = { cwd: process.cwd(), packageRoot }
|
|
29
|
+
void initPluginHost(hostOptions).then((host) => {
|
|
30
|
+
// 实际监听端口回填(nitro listen 后 ctx.api 自环 origin 才准确)。
|
|
31
|
+
// nitro 的运行时 hook 类型 NitroRuntimeHooks 未声明 'listen'(nitro 2.13 的 node 预设运行时只派发
|
|
32
|
+
// request/beforeResponse/afterResponse/render:*/error/close),故对一个只读视图做局部拓宽;
|
|
33
|
+
// 注册行为与原代码逐字相同(有派发则回填端口,无派发则空转),运行时零变化。
|
|
34
|
+
const hooks = nitroApp.hooks as typeof nitroApp.hooks & {
|
|
35
|
+
hookOnce(name: 'listen', fn: (listener: { port?: number }) => void): unknown
|
|
36
|
+
}
|
|
37
|
+
hooks.hookOnce('listen', (listener) => {
|
|
25
38
|
if (listener?.port)
|
|
26
39
|
host.setSelfOrigin(listener.port)
|
|
27
40
|
})
|
|
@@ -23,7 +23,9 @@ export default defineNitroPlugin(() => {
|
|
|
23
23
|
console.error(`[stability-guard] fatal ${kind}, exiting:\n${describeReason(reason)}`)
|
|
24
24
|
process.exit(1)
|
|
25
25
|
}
|
|
26
|
-
counts
|
|
26
|
+
// counts 的四个 key 装配时已全部初始化为 0,且 'fatal' 已在上面提前 return;
|
|
27
|
+
// `?? 0` 只是 noUncheckedIndexedAccess 下的写法,取值口径与 `+= 1` 完全一致
|
|
28
|
+
counts[severity] = (counts[severity] ?? 0) + 1
|
|
27
29
|
const line = `[stability-guard] ${severity}(累计 ${counts[severity]},不退出): ${describeReason(reason).slice(0, 200).replace(/\n/g, ' ')}`
|
|
28
30
|
// 外部设备不可达与引擎边界属"要有人知道"的信号 → error;其余瞬态噪声 → warn
|
|
29
31
|
if (severity === 'upstream' || severity === 'engine') console.error(line)
|
|
@@ -11,6 +11,11 @@ import { resolve } from 'node:path'
|
|
|
11
11
|
import { resolveRunMode } from '@/shared/config/home.mjs'
|
|
12
12
|
import { getSystemConfigService } from '../services/system-config'
|
|
13
13
|
|
|
14
|
+
/** 错误消息提取(catch 变量为 unknown;与原先 `String(err?.message ?? err)` 逐字等价) */
|
|
15
|
+
function errorMessage(err: unknown): string {
|
|
16
|
+
return String((err as { message?: unknown } | null | undefined)?.message ?? err)
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export default function systemConfigPlugin(nitroApp: {
|
|
15
20
|
hooks: { hook(name: string, fn: (...args: unknown[]) => void | Promise<void>): void }
|
|
16
21
|
}): void {
|
|
@@ -28,7 +33,7 @@ export default function systemConfigPlugin(nitroApp: {
|
|
|
28
33
|
}
|
|
29
34
|
catch (err) {
|
|
30
35
|
// 初始化失败不阻断服务(设置系统降级为只读构建配置)
|
|
31
|
-
console.warn('[system-config] 初始化失败(设置系统降级):',
|
|
36
|
+
console.warn('[system-config] 初始化失败(设置系统降级):', errorMessage(err))
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
nitroApp.hooks.hook('close', () => {
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* serial-bridge 客户端面板 —— 注入 'plugins.page' 插槽。
|
|
3
|
+
* 协议栈可用性、系统串口枚举、连接探针(开串口读一次,不落库)、打开链路与串口节点概览。
|
|
4
|
+
* 与 diag-bridge 同范式:30s 自动刷新健康面,语言切换即重渲染。
|
|
5
|
+
*/
|
|
6
|
+
export function setup(ctx) {
|
|
7
|
+
const styleId = 'aw-serial-styles'
|
|
8
|
+
if (!document.getElementById(styleId)) {
|
|
9
|
+
document.head.append(ctx.el('style', { id: styleId }, [`
|
|
10
|
+
.aw-serial { display:flex; flex-direction:column; gap:10px; font-size:12px; }
|
|
11
|
+
.aw-serial-badge { display:inline-flex; align-items:center; gap:6px; }
|
|
12
|
+
.aw-serial-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
|
|
13
|
+
.aw-serial-dot-ok { background:#35e0a0; }
|
|
14
|
+
.aw-serial-dot-bad { background:#e05a5a; }
|
|
15
|
+
.aw-serial-toolbar { display:flex; justify-content:flex-end; }
|
|
16
|
+
.aw-serial-btn { padding:4px 12px; border:1px solid color-mix(in srgb, currentColor 28%, transparent); border-radius:7px; background:transparent; color:inherit; cursor:pointer; }
|
|
17
|
+
.aw-serial-table { width:100%; border-collapse:collapse; }
|
|
18
|
+
.aw-serial-table th, .aw-serial-table td { text-align:left; padding:5px 8px; border-bottom:1px solid color-mix(in srgb, currentColor 10%, transparent); }
|
|
19
|
+
.aw-serial-table th { opacity:.65; font-weight:500; }
|
|
20
|
+
.aw-serial-empty { opacity:.6; padding:6px 0; }
|
|
21
|
+
.aw-serial-form { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
|
|
22
|
+
.aw-serial-form .aw-serial-inp { width:110px; padding:3px 8px; border:1px solid color-mix(in srgb, currentColor 24%, transparent); border-radius:7px; background:transparent; color:inherit; font:inherit; }
|
|
23
|
+
.aw-serial-form .aw-serial-inp.grow { flex:1 1 140px; }
|
|
24
|
+
.aw-serial-hint { opacity:.6; }
|
|
25
|
+
.aw-serial-result { white-space:pre-wrap; word-break:break-all; padding:6px 8px; border-radius:7px; }
|
|
26
|
+
.aw-serial-result.ok { background:color-mix(in srgb, #35e0a0 12%, transparent); }
|
|
27
|
+
.aw-serial-result.bad { background:color-mix(in srgb, #e05a5a 12%, transparent); }
|
|
28
|
+
.aw-serial-sec { font-weight:600; opacity:.85; margin-top:2px; }
|
|
29
|
+
`]))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ctx.ui.registerPanel({
|
|
33
|
+
slot: 'plugins.page',
|
|
34
|
+
name: 'serial-bridge-panel',
|
|
35
|
+
titleKey: 'panel.title',
|
|
36
|
+
order: 30,
|
|
37
|
+
mount(elRoot) {
|
|
38
|
+
const t = k => ctx.t(`panel.${k}`)
|
|
39
|
+
const root = ctx.el('div', { class: 'aw-serial' })
|
|
40
|
+
elRoot.append(root)
|
|
41
|
+
|
|
42
|
+
// ---- 状态徽标 + 刷新 ----
|
|
43
|
+
const badge = ctx.el('span', { class: 'aw-serial-badge' })
|
|
44
|
+
const refreshAll = () => {
|
|
45
|
+
void loadHealth()
|
|
46
|
+
void loadPorts()
|
|
47
|
+
}
|
|
48
|
+
const toolbar = ctx.el('div', { class: 'aw-serial-toolbar' }, [
|
|
49
|
+
ctx.el('button', { class: 'aw-serial-btn', onclick: refreshAll }, [t('refresh')]),
|
|
50
|
+
])
|
|
51
|
+
root.append(ctx.el('div', {}, [badge]), toolbar)
|
|
52
|
+
|
|
53
|
+
// ---- 系统串口表 ----
|
|
54
|
+
root.append(ctx.el('div', { class: 'aw-serial-sec' }, [t('ports')]))
|
|
55
|
+
const portsWrap = ctx.el('div')
|
|
56
|
+
root.append(portsWrap)
|
|
57
|
+
|
|
58
|
+
// ---- 连接探针 ----
|
|
59
|
+
root.append(ctx.el('div', { class: 'aw-serial-sec' }, [t('probe')]))
|
|
60
|
+
const probeSel = ctx.el('input', { class: 'aw-serial-inp grow', placeholder: 'COM3' })
|
|
61
|
+
const modeSel = ctx.el('select', { class: 'aw-serial-inp' }, [
|
|
62
|
+
ctx.el('option', { value: 'modbus-rtu' }, ['Modbus RTU']),
|
|
63
|
+
ctx.el('option', { value: 'ascii-line' }, ['ASCII']),
|
|
64
|
+
])
|
|
65
|
+
const baudInp = ctx.el('input', { class: 'aw-serial-inp', type: 'number', value: '9600' })
|
|
66
|
+
const unitInp = ctx.el('input', { class: 'aw-serial-inp', type: 'number', value: '1' })
|
|
67
|
+
const regInp = ctx.el('input', { class: 'aw-serial-inp', type: 'number', placeholder: '40001' })
|
|
68
|
+
const lineInp = ctx.el('input', { class: 'aw-serial-inp grow', placeholder: t('sendLine') })
|
|
69
|
+
const probeBtn = ctx.el('button', { class: 'aw-serial-btn', onclick: () => void runProbe() })
|
|
70
|
+
const result = ctx.el('div', { class: 'aw-serial-hint' }, [t('probe_hint')])
|
|
71
|
+
const form = ctx.el('div', { class: 'aw-serial-form' }, [
|
|
72
|
+
probeSel, modeSel, baudInp, unitInp, regInp, lineInp, probeBtn,
|
|
73
|
+
])
|
|
74
|
+
root.append(form, result)
|
|
75
|
+
|
|
76
|
+
// ---- 打开的链路 + 串口节点 ----
|
|
77
|
+
root.append(ctx.el('div', { class: 'aw-serial-sec' }, [t('links')]))
|
|
78
|
+
const linksWrap = ctx.el('div')
|
|
79
|
+
root.append(linksWrap, ctx.el('div', { class: 'aw-serial-sec' }, [t('nodes')]))
|
|
80
|
+
const nodesWrap = ctx.el('div')
|
|
81
|
+
root.append(nodesWrap)
|
|
82
|
+
|
|
83
|
+
let probing = false
|
|
84
|
+
function setBtn(label, disabled) {
|
|
85
|
+
probeBtn.textContent = label
|
|
86
|
+
probeBtn.disabled = disabled
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function loadHealth() {
|
|
90
|
+
const h = await ctx.fetch('/api/plugins/serial-bridge/health').catch(() => null)
|
|
91
|
+
badge.replaceChildren(
|
|
92
|
+
ctx.el('span', { class: `aw-serial-dot ${h?.available ? 'aw-serial-dot-ok' : 'aw-serial-dot-bad'}` }),
|
|
93
|
+
document.createTextNode(h?.available ? t('available') : t('unavailable')),
|
|
94
|
+
)
|
|
95
|
+
const links = Array.isArray(h?.links) ? h.links : []
|
|
96
|
+
if (!links.length) {
|
|
97
|
+
linksWrap.replaceChildren(ctx.el('div', { class: 'aw-serial-empty' }, [t('nolinks')]))
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const tbody = ctx.el('tbody')
|
|
101
|
+
for (const l of links) {
|
|
102
|
+
tbody.append(ctx.el('tr', {}, [
|
|
103
|
+
ctx.el('td', {}, [String(l.key ?? '-')]),
|
|
104
|
+
ctx.el('td', {}, [String(l.pending ?? 0)]),
|
|
105
|
+
ctx.el('td', {}, [String(l.errors ?? 0)]),
|
|
106
|
+
ctx.el('td', {}, [l.lastUsedAt ? new Date(l.lastUsedAt).toLocaleTimeString() : '-']),
|
|
107
|
+
]))
|
|
108
|
+
}
|
|
109
|
+
linksWrap.replaceChildren(ctx.el('table', { class: 'aw-serial-table' }, [
|
|
110
|
+
ctx.el('thead', {}, [ctx.el('tr', {}, [
|
|
111
|
+
ctx.el('th', {}, [t('link')]),
|
|
112
|
+
ctx.el('th', {}, [t('pending')]),
|
|
113
|
+
ctx.el('th', {}, [t('errors')]),
|
|
114
|
+
ctx.el('th', {}, [t('lastUsed')]),
|
|
115
|
+
])]),
|
|
116
|
+
tbody,
|
|
117
|
+
]))
|
|
118
|
+
}
|
|
119
|
+
const nodes = Array.isArray(h?.readNodes) ? h.readNodes : []
|
|
120
|
+
nodesWrap.replaceChildren(
|
|
121
|
+
nodes.length
|
|
122
|
+
? ctx.el('div', {}, [nodes.map(n => `${n.name || n.id} @ ${n.path || '?'}${n.enabled === false ? ' [off]' : ''}`).join(', ')])
|
|
123
|
+
: ctx.el('div', { class: 'aw-serial-empty' }, [t('nonodes')]),
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function loadPorts() {
|
|
128
|
+
const r = await ctx.fetch('/api/plugins/serial-bridge/ports').catch(() => null)
|
|
129
|
+
const ports = Array.isArray(r?.ports) ? r.ports : []
|
|
130
|
+
if (!ports.length) {
|
|
131
|
+
portsWrap.replaceChildren(ctx.el('div', { class: 'aw-serial-empty' }, [r?.error ?? t('noports')]))
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
const tbody = ctx.el('tbody')
|
|
135
|
+
for (const p of ports) {
|
|
136
|
+
const pickPort = () => void (probeSel.value = p.path)
|
|
137
|
+
const row = ctx.el('tr', { style: 'cursor:pointer', title: p.friendlyName ?? '', onclick: pickPort }, [
|
|
138
|
+
ctx.el('td', {}, [String(p.path ?? '-')]),
|
|
139
|
+
ctx.el('td', {}, [String(p.manufacturer ?? '-')]),
|
|
140
|
+
ctx.el('td', {}, [String(p.serialNumber ?? '-')]),
|
|
141
|
+
])
|
|
142
|
+
tbody.append(row)
|
|
143
|
+
}
|
|
144
|
+
portsWrap.replaceChildren(ctx.el('table', { class: 'aw-serial-table' }, [
|
|
145
|
+
ctx.el('thead', {}, [ctx.el('tr', {}, [
|
|
146
|
+
ctx.el('th', {}, [t('path')]),
|
|
147
|
+
ctx.el('th', {}, [t('manufacturer')]),
|
|
148
|
+
ctx.el('th', {}, [t('serialNumber')]),
|
|
149
|
+
])]),
|
|
150
|
+
tbody,
|
|
151
|
+
]))
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function runProbe() {
|
|
155
|
+
if (probing) return
|
|
156
|
+
const path = String(probeSel.value ?? '').trim()
|
|
157
|
+
if (!path) {
|
|
158
|
+
result.className = 'aw-serial-result bad'
|
|
159
|
+
result.textContent = t('noports')
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
probing = true
|
|
163
|
+
setBtn(t('probing'), true)
|
|
164
|
+
try {
|
|
165
|
+
// ctx.fetch 会自动 JSON.stringify(body)——这里必须传对象(双重 stringify 会让服务端收到字符串)
|
|
166
|
+
const r = await ctx.fetch('/api/plugins/serial-bridge/probe', {
|
|
167
|
+
method: 'POST',
|
|
168
|
+
body: {
|
|
169
|
+
path,
|
|
170
|
+
mode: modeSel.value,
|
|
171
|
+
baudRate: Number(baudInp.value) || 9600,
|
|
172
|
+
unitId: Number(unitInp.value) || 1,
|
|
173
|
+
register: regInp.value === '' ? undefined : Number(regInp.value),
|
|
174
|
+
sendLine: modeSel.value === 'ascii-line' && lineInp.value ? lineInp.value : undefined,
|
|
175
|
+
},
|
|
176
|
+
})
|
|
177
|
+
const body = r ?? {}
|
|
178
|
+
const ok = body.ok === true
|
|
179
|
+
result.className = `aw-serial-result ${ok ? 'ok' : 'bad'}`
|
|
180
|
+
result.textContent = `${ok ? '✓' : '✗'} ${body.message ?? body.error ?? '-'}${body.latencyMs != null ? ` (${body.latencyMs}ms)` : ''}`
|
|
181
|
+
void loadHealth()
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
result.className = 'aw-serial-result bad'
|
|
185
|
+
result.textContent = `✗ ${err?.message ?? err}`
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
probing = false
|
|
189
|
+
setBtn(t('run_probe'), false)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
setBtn(t('run_probe'), false)
|
|
194
|
+
void loadHealth()
|
|
195
|
+
void loadPorts()
|
|
196
|
+
const timer = setInterval(() => void loadHealth(), 30_000)
|
|
197
|
+
const offLocale = ctx.hooks.on('i18n:changed', () => {
|
|
198
|
+
setBtn(t('run_probe'), false)
|
|
199
|
+
result.className = 'aw-serial-hint'
|
|
200
|
+
result.textContent = t('probe_hint')
|
|
201
|
+
void loadHealth()
|
|
202
|
+
void loadPorts()
|
|
203
|
+
})
|
|
204
|
+
return () => {
|
|
205
|
+
clearInterval(timer)
|
|
206
|
+
offLocale()
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
})
|
|
210
|
+
}
|