agentworkshop 0.7.38 → 0.7.40
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/aml-mission-default.md +20 -20
- package/.AgentWorkShop/prompts/aml-playbook.md +49 -49
- package/.AgentWorkShop/prompts/host-tools.json +1293 -1238
- package/.AgentWorkShop/prompts/peer-reply-cross-channel.md +10 -10
- package/.output/.AgentWorkShop/prompts/aml-mission-default.md +20 -20
- package/.output/.AgentWorkShop/prompts/aml-playbook.md +49 -49
- package/.output/.AgentWorkShop/prompts/host-tools.json +1293 -1238
- package/.output/.AgentWorkShop/prompts/peer-reply-cross-channel.md +10 -10
- 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/BOt2SP4z.js +1 -0
- package/.output/public/_nuxt/BP-NyKVG.js +18 -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/{C_OLzD09.js → C4oW1HsE.js} +1 -1
- package/.output/public/_nuxt/CFxtLwjp.js +1 -0
- package/.output/public/_nuxt/{Cec0Ua3F.js → CS50LB_l.js} +1 -1
- package/.output/public/_nuxt/C_iYD-EB.js +1 -0
- package/.output/public/_nuxt/{DAe0h2MB.js → ClILjvWH.js} +1 -1
- package/.output/public/_nuxt/CssgYAAL2.js +1 -0
- package/.output/public/_nuxt/{CY9LbPCI.js → CzOCSGLe.js} +1 -1
- package/.output/public/_nuxt/D8qvkfyY.js +1 -0
- package/.output/public/_nuxt/DCn7QZ5N.js +2 -0
- package/.output/public/_nuxt/DGIuvyRN2.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/DZshyNLa.js +1 -0
- package/.output/public/_nuxt/{45zuyAso.js → D_OTvQza.js} +1 -1
- package/.output/public/_nuxt/DcsCcxp4.js +1 -0
- package/.output/public/_nuxt/{DUrecWPx.js → Dihnimlk.js} +2 -2
- package/.output/public/_nuxt/Dqw1lpr-.js +1 -0
- package/.output/public/_nuxt/{BG8sCcwx.js → Dr9v6C0f.js} +9 -9
- package/.output/public/_nuxt/{8NMOXZOV.js → Du9ZJtnj.js} +1 -1
- package/.output/public/_nuxt/TownView.f-YOdXRs.css +1 -0
- package/.output/public/_nuxt/_id_.CM4bIgKY.css +1 -0
- package/.output/public/_nuxt/_id_.bNV69Dtf.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/f4707884-7cf4-4a31-80d2-e3d72b73745f.json +1 -0
- package/.output/public/_nuxt/channel-templates.BOtahzPi.css +1 -0
- package/.output/public/_nuxt/daq.B0D3dPAc.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/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 +2244 -1464
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/build/{TownView-jVazYOjN.mjs → TownView-BuLAsmpR.mjs} +288 -206
- package/.output/server/chunks/build/TownView-BuLAsmpR.mjs.map +1 -0
- package/.output/server/chunks/build/{_id_-CfVosNg3.mjs → _id_-BU1wfOID.mjs} +138 -138
- package/.output/server/chunks/build/{_id_-CfVosNg3.mjs.map → _id_-BU1wfOID.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-Hwr4rZpr.mjs → _id_-BYsEua57.mjs} +33 -32
- package/.output/server/chunks/build/_id_-BYsEua57.mjs.map +1 -0
- package/.output/server/chunks/build/{_wsId_-BVg3bB77.mjs → _wsId_-BxlDcJHg.mjs} +293 -259
- package/.output/server/chunks/build/{_wsId_-BVg3bB77.mjs.map → _wsId_-BxlDcJHg.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-cgyjKmJu.mjs} +188 -122
- package/.output/server/chunks/build/daq-cgyjKmJu.mjs.map +1 -0
- package/.output/server/chunks/build/{dcw-6vEYVeje.mjs → dcw-CoTxBlAZ.mjs} +45 -45
- package/.output/server/chunks/build/{dcw-6vEYVeje.mjs.map → dcw-CoTxBlAZ.mjs.map} +1 -1
- package/.output/server/chunks/build/{default-hseyOqBT.mjs → default-BE4r0FZN.mjs} +158 -79
- package/.output/server/chunks/build/{default-hseyOqBT.mjs.map → default-BE4r0FZN.mjs.map} +1 -1
- package/.output/server/chunks/build/{logs-B-xhuqln.mjs → logs-BSOeZwwI.mjs} +34 -34
- package/.output/server/chunks/build/{logs-B-xhuqln.mjs.map → logs-BSOeZwwI.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-DFxjn9Xa.mjs} +33 -17
- package/.output/server/chunks/build/pages-DFxjn9Xa.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-qMPql9Se.mjs} +36 -10
- package/.output/server/chunks/build/town-qMPql9Se.mjs.map +1 -0
- package/.output/server/chunks/build/useDaqStream-CIBaiGAl.mjs +1 -1
- package/.output/server/chunks/build/useDcwStream-CBbiYnWe.mjs +1 -1
- 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_.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/index6.get.mjs +2 -0
- 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 +53 -25
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +204 -40
- 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 -24
- package/app/components/AppSidebar.vue +118 -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/useDcwStream.ts +1 -1
- 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 +3 -2
- package/app/pages/daq/index.vue +209 -9
- package/app/pages/dcw/[id].vue +109 -28
- 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/full-test-plan.md +4 -0
- package/docs/plugins.en.md +1 -0
- package/docs/plugins.md +1 -0
- package/i18n/locales/en.ts +3 -0
- package/i18n/locales/zh-CN.ts +3 -0
- package/nuxt.config.ts +31 -0
- package/package.json +9 -1
- package/scripts/_audit/detached-start.mjs +103 -0
- package/scripts/_audit/guard-upstream-liveness.mjs +104 -0
- 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/_dbg-perms-e2e.mjs +10 -3
- package/scripts/_dbg-protocol-matrix.mjs +453 -441
- package/scripts/_dbg-render-regression.mjs +151 -130
- package/scripts/_dbg-town-agents-probe.mjs +60 -0
- package/scripts/_dbg-visual-acceptance.mjs +63 -0
- package/scripts/api-live-e2e.mjs +40 -8
- package/scripts/capture-walkthrough.mjs +232 -0
- package/scripts/e2e-agent-team.mjs +5 -3
- 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/three-system-e2e.mjs +6 -6
- 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/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/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/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 +2 -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 +14 -3
- package/server/plugins/dev-stability-guard.ts +3 -1
- package/server/plugins/system-config.ts +6 -1
- package/server/plugins-builtin/rag-bridge/index.mjs +9 -2
- 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 +18 -3
- package/server/services/workshop/daq/daq-runtime.ts +5 -3
- package/server/services/workshop/daq/drivers.ts +63 -8
- 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 +143 -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 +5 -2
- 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/recipe-rollback-manager.ts +13 -7
- 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/dcw-protocol.ts +136 -0
- package/uno.config.ts +12 -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/D1YDxZpZ.js +0 -1
- package/.output/public/_nuxt/D20Yamr4.js +0 -1
- package/.output/public/_nuxt/DVsjtsvZ2.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/44b66249-54d0-4c8a-9057-9755a32329e2.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.DE_vT238.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_-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/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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/workshop/dcw/params/:id/read —— 工艺参数读取(读执行节点 PLC 值,物理量纲)。
|
|
3
|
+
* 被动观测免审批;返回 PLC 实时读数 + 当前设定值。
|
|
4
|
+
*/
|
|
5
|
+
import { getRouterParam } from 'h3'
|
|
6
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
7
|
+
import { defineApiHandler } from '@/server/utils/response'
|
|
8
|
+
import { bindDcwBroadcast, getDcwController } from '@/server/services/workshop/dcw/dcw-controller'
|
|
9
|
+
import { broadcastSceneEvent } from '@/server/services/workshop/scene-events'
|
|
10
|
+
|
|
11
|
+
export default defineApiHandler(async (event) => {
|
|
12
|
+
resolveUser(event)
|
|
13
|
+
bindDcwBroadcast(broadcastSceneEvent)
|
|
14
|
+
const id = getRouterParam(event, 'id') ?? ''
|
|
15
|
+
const read = await getDcwController().readParam(id)
|
|
16
|
+
return { read }
|
|
17
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/workshop/dcw/params/:id/write —— 工艺参数写入(用户/Agent 的标准写入口)。
|
|
3
|
+
* body: { value: number }(工程量纲)。限界联锁(参数基准 ∩ 产品 ∩ 配方 ∩ 节点安全量程)
|
|
4
|
+
* 在 DcwController.write 咽喉点统一生效,越界 400 并点名约束层。
|
|
5
|
+
*/
|
|
6
|
+
import { getRouterParam, readBody } from 'h3'
|
|
7
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
8
|
+
import { requireLineMode } 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 id = getRouterParam(event, 'id') ?? ''
|
|
17
|
+
const body = await readBody<{ value?: number }>(event) ?? {}
|
|
18
|
+
requireLineMode(user, getDcwController().paramById(id).lineId, 'operate')
|
|
19
|
+
const outcome = await getDcwController().writeParam(id, Number(body.value), { source: 'manual', actor: user.id, actorName: user.name })
|
|
20
|
+
return { outcome }
|
|
21
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DELETE /api/workshop/dcw/params/:id —— 删除工艺参数映射(仅删语义面,执行节点不受影响)。
|
|
3
|
+
*/
|
|
4
|
+
import { getRouterParam } from 'h3'
|
|
5
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
6
|
+
import { requireLineMode } from '@/server/services/workshop/permissions'
|
|
7
|
+
import { defineApiHandler } from '@/server/utils/response'
|
|
8
|
+
import { bindDcwBroadcast, getDcwController } from '@/server/services/workshop/dcw/dcw-controller'
|
|
9
|
+
import { getDcwParamRepo } from '@/server/services/workshop/dcw/param-map.repo'
|
|
10
|
+
import { broadcastSceneEvent } from '@/server/services/workshop/scene-events'
|
|
11
|
+
|
|
12
|
+
export default defineApiHandler(async (event) => {
|
|
13
|
+
const user = resolveUser(event)
|
|
14
|
+
bindDcwBroadcast(broadcastSceneEvent)
|
|
15
|
+
const id = getRouterParam(event, 'id') ?? ''
|
|
16
|
+
requireLineMode(user, getDcwController().paramById(id).lineId, 'operate')
|
|
17
|
+
getDcwParamRepo().remove(id)
|
|
18
|
+
return { removed: id }
|
|
19
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PATCH /api/workshop/dcw/params/:id —— 编辑工艺参数映射(语义面/基准限界)。
|
|
3
|
+
* nodeId 映射目标不可变(换绑请删建,避免账本悬空引用)。
|
|
4
|
+
*/
|
|
5
|
+
import { getRouterParam, readBody } from 'h3'
|
|
6
|
+
import type { DcwParamInput } from '#shared/dcw-protocol'
|
|
7
|
+
import { resolveUser } from '@/server/api/workshop/caller'
|
|
8
|
+
import { requireLineMode } 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 { getDcwParamRepo } from '@/server/services/workshop/dcw/param-map.repo'
|
|
12
|
+
import { broadcastSceneEvent } from '@/server/services/workshop/scene-events'
|
|
13
|
+
|
|
14
|
+
export default defineApiHandler(async (event) => {
|
|
15
|
+
const user = resolveUser(event)
|
|
16
|
+
bindDcwBroadcast(broadcastSceneEvent)
|
|
17
|
+
const id = getRouterParam(event, 'id') ?? ''
|
|
18
|
+
const body = await readBody<Partial<DcwParamInput>>(event) ?? {}
|
|
19
|
+
// 产线权限:参数执行节点所在产线需「可操控」(限界是写控安全配置)
|
|
20
|
+
requireLineMode(user, getDcwController().paramById(id).lineId, 'operate')
|
|
21
|
+
const row = getDcwParamRepo().update(id, body)
|
|
22
|
+
return { param: getDcwController().paramById(row.id) }
|
|
23
|
+
})
|
|
@@ -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 }
|
|
@@ -19,9 +19,20 @@ const candidates = [
|
|
|
19
19
|
const packageRoot = candidates.find(r => existsSync(resolve(r, 'server', 'plugins-builtin'))) ?? process.cwd()
|
|
20
20
|
|
|
21
21
|
export default defineNitroPlugin((nitroApp) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// host.mjs 是未类型化的 JS:TS 从 `{ cwd = process.cwd(), packageRoot } = {}` 推断形参类型时只保留了
|
|
23
|
+
// 带默认值的 cwd,丢掉了没有默认值的 shorthand 属性 packageRoot(host.mjs 内部确实会解构并使用它,
|
|
24
|
+
// 见 host.mjs 的 host.packageRoot / resolveRunMode({ cwd, packageRoot }))。按真实形参给局部变量
|
|
25
|
+
// 加注解即可,调用本身逐字不变。
|
|
26
|
+
const hostOptions: { cwd?: string, packageRoot?: string } = { cwd: process.cwd(), packageRoot }
|
|
27
|
+
void initPluginHost(hostOptions).then((host) => {
|
|
28
|
+
// 实际监听端口回填(nitro listen 后 ctx.api 自环 origin 才准确)。
|
|
29
|
+
// nitro 的运行时 hook 类型 NitroRuntimeHooks 未声明 'listen'(nitro 2.13 的 node 预设运行时只派发
|
|
30
|
+
// request/beforeResponse/afterResponse/render:*/error/close),故对一个只读视图做局部拓宽;
|
|
31
|
+
// 注册行为与原代码逐字相同(有派发则回填端口,无派发则空转),运行时零变化。
|
|
32
|
+
const hooks = nitroApp.hooks as typeof nitroApp.hooks & {
|
|
33
|
+
hookOnce(name: 'listen', fn: (listener: { port?: number }) => void): unknown
|
|
34
|
+
}
|
|
35
|
+
hooks.hookOnce('listen', (listener) => {
|
|
25
36
|
if (listener?.port)
|
|
26
37
|
host.setSelfOrigin(listener.port)
|
|
27
38
|
})
|
|
@@ -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', () => {
|
|
@@ -349,10 +349,17 @@ export default {
|
|
|
349
349
|
outbound: state.outbound,
|
|
350
350
|
auth: kbToken() ? 'bearer' : 'anonymous',
|
|
351
351
|
// token 配置与「实测是否被接受」分开呈现:401/403 = 明确被拒(运维一眼看出 token 配错),
|
|
352
|
-
// 网络不通/超时为 null(未知),2xx 或非鉴权类失败为 true(未被拒)
|
|
352
|
+
// 网络不通/超时为 null(未知),2xx 或非鉴权类失败为 true(未被拒)。
|
|
353
|
+
// 实测打受保护 GET /api/v1/auth/me —— rag 后端 GET 只读端点公开(/health 匿名可过,
|
|
354
|
+
// 测不出 token 对错),/auth/me 无 token/错 token 均 401。
|
|
353
355
|
token: {
|
|
354
356
|
configured: Boolean(kbToken()),
|
|
355
|
-
accepted:
|
|
357
|
+
accepted: await (async () => {
|
|
358
|
+
if (!state.outbound) return null
|
|
359
|
+
if (!kbToken()) return backend.ok ? true : null
|
|
360
|
+
const me = await callJson('GET', `${base()}/api/v1/auth/me`, null, { timeoutMs: 5000, retries: 0 })
|
|
361
|
+
return me.ok ? true : (me.status === 401 || me.status === 403 ? false : null)
|
|
362
|
+
})(),
|
|
356
363
|
},
|
|
357
364
|
kb: { name: KB_NAME, id: kbId() || null },
|
|
358
365
|
backend: { url: base(), ok: backend.ok, ...(backend.ok ? { status: backend.body?.status ?? null } : { status: backend.status ?? null, error: backend.error }) },
|
|
@@ -44,8 +44,10 @@ export interface ConfigGroup {
|
|
|
44
44
|
label: string
|
|
45
45
|
labelKey?: string
|
|
46
46
|
description: string
|
|
47
|
-
/** 排序权重(小在前);内置分组按 schema 声明顺序 ×10
|
|
48
|
-
order
|
|
47
|
+
/** 排序权重(小在前);内置分组按 schema 声明顺序 ×10。
|
|
48
|
+
* 可缺省:持久化条目与插件声明允许不写 order,由 shared/config/groups.mjs 的
|
|
49
|
+
* mergeGroups 沿用内置声明顺序兜底(消费侧见 nextGroupOrder/updateGroup 均按可缺省处理)。 */
|
|
50
|
+
order?: number
|
|
49
51
|
/** 前端默认折叠态(用户本地展开偏好优先) */
|
|
50
52
|
collapsed: boolean
|
|
51
53
|
collapsible: boolean
|
|
@@ -105,6 +107,23 @@ export interface ConfigEventPayload {
|
|
|
105
107
|
|
|
106
108
|
type Listener = (payload: ConfigEventPayload) => void
|
|
107
109
|
|
|
110
|
+
/** runtimeConfig 的动态视图:PUBLIC_FIELDS(public.*)/ROOT_FIELDS(根字段)/daq.* 三处动态读写共用 */
|
|
111
|
+
type RuntimeConfigView = Record<string, unknown> & { public: Record<string, unknown> }
|
|
112
|
+
|
|
113
|
+
/** 从 catch 的 unknown 值取可读错误文本(与原先的 String(err?.message ?? err) 运行时完全等价) */
|
|
114
|
+
function errorText(err: unknown): string {
|
|
115
|
+
return String((err as { message?: unknown } | null | undefined)?.message ?? err)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** 以可写记录视图取 runtimeConfig.daq:缺失/非对象时就地落一个空对象(与原先的兜底赋值等价) */
|
|
119
|
+
function daqView(rc: RuntimeConfigView): Record<string, unknown> {
|
|
120
|
+
const current = rc.daq
|
|
121
|
+
if (current && typeof current === 'object') return current as Record<string, unknown>
|
|
122
|
+
const created: Record<string, unknown> = {}
|
|
123
|
+
rc.daq = created
|
|
124
|
+
return created
|
|
125
|
+
}
|
|
126
|
+
|
|
108
127
|
declare global {
|
|
109
128
|
var __systemConfig: SystemConfigService | undefined
|
|
110
129
|
}
|
|
@@ -169,7 +188,7 @@ export class SystemConfigService {
|
|
|
169
188
|
}
|
|
170
189
|
}
|
|
171
190
|
catch (err) {
|
|
172
|
-
console.warn('[system-config] 遗留设置迁移失败(不阻断启动):',
|
|
191
|
+
console.warn('[system-config] 遗留设置迁移失败(不阻断启动):', errorText(err))
|
|
173
192
|
}
|
|
174
193
|
}
|
|
175
194
|
|
|
@@ -217,7 +236,7 @@ export class SystemConfigService {
|
|
|
217
236
|
saveGroups(toSave, this.groupsPath)
|
|
218
237
|
}
|
|
219
238
|
catch (err) {
|
|
220
|
-
console.warn('[system-config] 分组注册表落盘失败(本次仅内存生效):',
|
|
239
|
+
console.warn('[system-config] 分组注册表落盘失败(本次仅内存生效):', errorText(err))
|
|
221
240
|
}
|
|
222
241
|
}
|
|
223
242
|
|
|
@@ -345,7 +364,8 @@ export class SystemConfigService {
|
|
|
345
364
|
|
|
346
365
|
/** 从当前 runtimeConfig 读取某 key 的构建期基准值 */
|
|
347
366
|
private readBase(key: string): unknown {
|
|
348
|
-
const rc = useRuntimeConfig() as
|
|
367
|
+
const rc = useRuntimeConfig() as RuntimeConfigView
|
|
368
|
+
// 保留 ?.:public 缺失时按 undefined 处理(与改动前一致,不引入抛错路径)
|
|
349
369
|
if (PUBLIC_FIELDS[key]) return rc.public?.[PUBLIC_FIELDS[key]]
|
|
350
370
|
if (ROOT_FIELDS[key]) return rc[ROOT_FIELDS[key]]
|
|
351
371
|
if (key.startsWith(DAQ_PREFIX)) return getPath(rc.daq, key.slice(DAQ_PREFIX.length))
|
|
@@ -357,7 +377,7 @@ export class SystemConfigService {
|
|
|
357
377
|
* 视图以本服务内存 effective 为唯一实时源,前端经 SSE 消费;SSR 读取在下次启动后对齐。 */
|
|
358
378
|
private applyToRuntime(key: string, value: unknown): void {
|
|
359
379
|
try {
|
|
360
|
-
const rc = useRuntimeConfig() as
|
|
380
|
+
const rc = useRuntimeConfig() as RuntimeConfigView
|
|
361
381
|
if (PUBLIC_FIELDS[key]) {
|
|
362
382
|
rc.public[PUBLIC_FIELDS[key]] = value
|
|
363
383
|
return
|
|
@@ -367,8 +387,7 @@ export class SystemConfigService {
|
|
|
367
387
|
return
|
|
368
388
|
}
|
|
369
389
|
if (key.startsWith(DAQ_PREFIX)) {
|
|
370
|
-
|
|
371
|
-
setPath(rc.daq, key.slice(DAQ_PREFIX.length), value)
|
|
390
|
+
setPath(daqView(rc), key.slice(DAQ_PREFIX.length), value)
|
|
372
391
|
}
|
|
373
392
|
}
|
|
374
393
|
catch {
|
|
@@ -456,7 +475,7 @@ export class SystemConfigService {
|
|
|
456
475
|
if (existsSync(this.root)) this.watcher.push(watch(this.root, { persistent: false }, handler))
|
|
457
476
|
}
|
|
458
477
|
catch (err) {
|
|
459
|
-
console.warn('[system-config] 文件监听不可用(外部写入将不热重载):',
|
|
478
|
+
console.warn('[system-config] 文件监听不可用(外部写入将不热重载):', errorText(err))
|
|
460
479
|
}
|
|
461
480
|
}
|
|
462
481
|
|
|
@@ -19,6 +19,7 @@ import type { ChildProcess } from 'node:child_process'
|
|
|
19
19
|
import { createLogger } from '../../logger'
|
|
20
20
|
import type {
|
|
21
21
|
AgentEvent,
|
|
22
|
+
AgentInterface,
|
|
22
23
|
AgentRunContext,
|
|
23
24
|
AgentRunRequest,
|
|
24
25
|
} from '../agent-interface'
|
|
@@ -183,7 +184,7 @@ export class OneShotCliAgentImpl extends BaseAgentImpl implements AgentInterface
|
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
/** HITL:一次性 CLI 家族无程序化审批面(能力面如实声明 hitl:false) */
|
|
186
|
-
async respondHitl(): Promise<void> {
|
|
187
|
+
override async respondHitl(): Promise<void> {
|
|
187
188
|
throw new Error(`${this.spec.harnessId} 无 HITL 应答面`)
|
|
188
189
|
}
|
|
189
190
|
|
|
@@ -72,8 +72,10 @@ export interface AgentWorkspace {
|
|
|
72
72
|
toChannelName: string
|
|
73
73
|
toLeadAgentId: string
|
|
74
74
|
}>
|
|
75
|
-
/** (仅 lead)其他团队概览:同主其余 channel 的场景任务(进行中/近期完成)
|
|
76
|
-
|
|
75
|
+
/** (仅 lead)其他团队概览:同主其余 channel 的场景任务(进行中/近期完成)——跨团队协同的观察面。
|
|
76
|
+
* 同步返回:唯一实现(manager.listOtherTeamsOverview)与工具桥直调方(manager.invokeAgentWorkspaceTool)均按数组消费;
|
|
77
|
+
* 声明为 Promise 会与实现漂移(await 同步值仍合法,故异步消费方不受影响)。 */
|
|
78
|
+
listOtherTeams(): Array<{
|
|
77
79
|
channelId: string
|
|
78
80
|
name: string
|
|
79
81
|
description: string
|
|
@@ -82,16 +84,16 @@ export interface AgentWorkspace {
|
|
|
82
84
|
sharedMemories: number
|
|
83
85
|
activeTasks: Array<{ id: string, title: string, state: string }>
|
|
84
86
|
recentCompleted: Array<{ title: string }>
|
|
85
|
-
}
|
|
86
|
-
/** (全员)跨团队共享记忆检索:其他 channel 的 __team__
|
|
87
|
-
searchOtherTeamsMemory(input: { query: string, limit?: number }):
|
|
87
|
+
}>
|
|
88
|
+
/** (全员)跨团队共享记忆检索:其他 channel 的 __team__ 公共域,只读,带团队归属。同步返回,同 listOtherTeams */
|
|
89
|
+
searchOtherTeamsMemory(input: { query: string, limit?: number }): Array<{
|
|
88
90
|
channelId: string
|
|
89
91
|
channelName: string
|
|
90
92
|
title: string
|
|
91
93
|
content: string
|
|
92
94
|
importance: number
|
|
93
95
|
createdAt: string
|
|
94
|
-
}
|
|
96
|
+
}>
|
|
95
97
|
/**
|
|
96
98
|
* 拒绝指派给自己的任务(能力/范畴不匹配):任务置 FAILED(调度器改派他人),
|
|
97
99
|
* 并向派发方(任务创建者,缺省 channel lead)回执拒绝原因。
|
|
@@ -43,11 +43,24 @@ export interface BaseAgentIdentity {
|
|
|
43
43
|
channelId?: string
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* configRecord() 的视图类型:基类真正读取的公共配置键。
|
|
48
|
+
* 各 harness 的强类型配置(XxxAgentConfig)均以可选键声明这三项 → 子类直接 `return this.config` 即满足。
|
|
49
|
+
* 刻意不用 Record<string, unknown> 当返回类型:那会逼迫子类配置类型打开 index signature,
|
|
50
|
+
* 让子类内部配置键的拼写错误静默退化为 unknown(类型洞),而基类实际只用这三个键。
|
|
51
|
+
*/
|
|
52
|
+
export interface BaseAgentConfigView {
|
|
53
|
+
superviseTimeoutMs?: number
|
|
54
|
+
systemPromptPrefix?: string
|
|
55
|
+
scenarioPrompt?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
export abstract class BaseAgentImpl implements AgentInterface {
|
|
47
59
|
protected workspace: AgentRunContext['workspace'] | null = null
|
|
48
60
|
protected readonly toolState: HostToolSessionState = createSessionState()
|
|
49
61
|
protected readonly bridgeCtx: HostToolBridgeContext
|
|
50
|
-
|
|
62
|
+
/** 名册缓存:仅由 refreshIdentity() 装配(构造函数必经路径),故用明确赋值断言 */
|
|
63
|
+
protected roster!: ReturnType<typeof createRosterCache>
|
|
51
64
|
|
|
52
65
|
protected selfAgentId = ''
|
|
53
66
|
protected agentName = 'agent'
|
|
@@ -70,8 +83,8 @@ export abstract class BaseAgentImpl implements AgentInterface {
|
|
|
70
83
|
/** 引擎标识(日志/登记;如 'dsh'/'pi') */
|
|
71
84
|
protected abstract get harnessId(): string
|
|
72
85
|
|
|
73
|
-
/**
|
|
74
|
-
protected abstract configRecord():
|
|
86
|
+
/** 子类强类型配置的公共键视图(基类只读;子类 `return this.config` 即可) */
|
|
87
|
+
protected abstract configRecord(): BaseAgentConfigView
|
|
75
88
|
|
|
76
89
|
protected makeRoster(): ReturnType<typeof createRosterCache> {
|
|
77
90
|
return createRosterCache({
|
|
@@ -141,7 +154,8 @@ export abstract class BaseAgentImpl implements AgentInterface {
|
|
|
141
154
|
|
|
142
155
|
// ===== lead 调度回合(模板方法) =====
|
|
143
156
|
|
|
144
|
-
|
|
157
|
+
/** supervise 互斥位(子类 supervise 实现与本字段共享同一实例字段,故为 protected;纯可见性修饰,无运行时差异) */
|
|
158
|
+
protected supervising = false
|
|
145
159
|
|
|
146
160
|
async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
|
|
147
161
|
if (this.supervising) return []
|
|
@@ -75,7 +75,9 @@ type PermissionVerdict
|
|
|
75
75
|
export class ClaudeSdkAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
76
76
|
private readonly config: ClaudeAgentConfig
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// agentRole 由 BaseAgentImpl 持有(protected):子类再声明同名私有字段会以字段初始化器
|
|
79
|
+
// 覆盖基类 identity 装配的角色(lead 身份丢失)。此处仅收窄可见性声明,运行时代码不变。
|
|
80
|
+
protected override agentRole: 'lead' | 'worker' = 'worker'
|
|
79
81
|
/** SDK 会话句柄(动态类型:依赖包可能未安装) */
|
|
80
82
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
83
|
private session: any = null
|
|
@@ -162,7 +164,7 @@ export class ClaudeSdkAgentImpl extends BaseAgentImpl implements AgentInterface
|
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
/** HITL 应答:canUseTool 挂起的权限请求 → allow/deny(fail-closed) */
|
|
165
|
-
async respondHitl(kind: string, id: string, outcome: {
|
|
167
|
+
override async respondHitl(kind: string, id: string, outcome: {
|
|
166
168
|
confirmed?: boolean
|
|
167
169
|
cancelled?: boolean
|
|
168
170
|
comment?: string
|
|
@@ -544,7 +546,9 @@ export class ClaudeSdkAgentImpl extends BaseAgentImpl implements AgentInterface
|
|
|
544
546
|
agentId: this.selfAgentId,
|
|
545
547
|
agentName: this.agentName,
|
|
546
548
|
channelId: this.channelId,
|
|
547
|
-
pid:
|
|
549
|
+
// claude SDK 是进程内 harness(无子进程 pid):HitlRegisterInput.pid 缺省即"无终端路由"。
|
|
550
|
+
// 唯一的 pid 消费方 /api/workshop/hitl/respond 只在 omp-dialog 分支用 item.pid 且按真值判定,
|
|
551
|
+
// 故省略等价于原 pid:null(null 与 undefined 同为假值,协议 AepHitlItem.pid?: number 本不允许 null)。
|
|
548
552
|
method: 'confirm',
|
|
549
553
|
title: `claude 权限请求:${toolName}`,
|
|
550
554
|
detail: JSON.stringify(input).slice(0, 500),
|
|
@@ -27,7 +27,7 @@ import { peerPrompt, systemManual, toolArgsPreview, workerPrompt } from './promp
|
|
|
27
27
|
import { getHitlRegistry } from './hitl-registry'
|
|
28
28
|
import { harnessSettings } from '../settings'
|
|
29
29
|
import { StdioJsonRpcClient } from './adapters/stdio-jsonrpc'
|
|
30
|
-
import { BaseAgentImpl } from './base-agent'
|
|
30
|
+
import { BaseAgentImpl, type BaseAgentConfigView } from './base-agent'
|
|
31
31
|
import { generateMcpBridgeEnv } from './harness-env'
|
|
32
32
|
|
|
33
33
|
const log = createLogger('workshop.codex')
|
|
@@ -115,7 +115,7 @@ export class CodexAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
115
115
|
return 'codex'
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
protected configRecord():
|
|
118
|
+
protected configRecord(): BaseAgentConfigView {
|
|
119
119
|
return this.config
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -180,7 +180,7 @@ export class CodexAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/** HITL 应答:审批请求 → JSON-RPC 应答(decision) */
|
|
183
|
-
async respondHitl(kind: string, id: string, outcome: {
|
|
183
|
+
override async respondHitl(kind: string, id: string, outcome: {
|
|
184
184
|
confirmed?: boolean
|
|
185
185
|
cancelled?: boolean
|
|
186
186
|
value?: string
|
|
@@ -26,7 +26,7 @@ import { peerPrompt, systemManual, toolArgsPreview, workerPrompt } from './promp
|
|
|
26
26
|
import { getHitlRegistry } from './hitl-registry'
|
|
27
27
|
import { harnessSettings } from '../settings'
|
|
28
28
|
import { StdioJsonRpcClient, type JsonRpcRequestIncoming } from './adapters/stdio-jsonrpc'
|
|
29
|
-
import { BaseAgentImpl } from './base-agent'
|
|
29
|
+
import { BaseAgentImpl, type BaseAgentConfigView } from './base-agent'
|
|
30
30
|
import { generateMcpBridgeEnv } from './harness-env'
|
|
31
31
|
|
|
32
32
|
const log = createLogger('workshop.dsh')
|
|
@@ -106,7 +106,7 @@ export class DshAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
106
106
|
return 'dsh'
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
protected configRecord():
|
|
109
|
+
protected configRecord(): BaseAgentConfigView {
|
|
110
110
|
return this.config
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -159,7 +159,7 @@ export class DshAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/** HITL 应答:session/request_permission → allow/reject/cancelled(fail-closed) */
|
|
162
|
-
async respondHitl(kind: string, id: string, outcome: {
|
|
162
|
+
override async respondHitl(kind: string, id: string, outcome: {
|
|
163
163
|
confirmed?: boolean
|
|
164
164
|
cancelled?: boolean
|
|
165
165
|
value?: string
|
|
@@ -33,9 +33,22 @@ import {
|
|
|
33
33
|
|
|
34
34
|
const log = createLogger('workshop.harness-terminal')
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 会话 meta:本 hub 只接纳已完成身份绑定的 harness 进程(attachTerminalTap 的入参全为非空字符串),
|
|
38
|
+
* 故内部用比协议层更窄的类型 —— TermSessionMeta 允许 null 是为了容忍"未绑定进程"的通用视图,
|
|
39
|
+
* 而此处消费方(hitl-registry.register 要求 agentId: string)不必被迫处理不存在的 null。
|
|
40
|
+
* 纯类型收窄:任何写入本字段的值本来就只有 attachTerminalTap 一处,且其中无 null。
|
|
41
|
+
*/
|
|
42
|
+
type BoundSessionMeta = Omit<TermSessionMeta, 'agentId' | 'channelId' | 'name' | 'role'> & {
|
|
43
|
+
agentId: string
|
|
44
|
+
channelId: string
|
|
45
|
+
name: string
|
|
46
|
+
role: 'lead' | 'worker'
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
/** 终端会话(一个 pid 一份;进程退出后保留缓冲供事后查看) */
|
|
37
50
|
interface TerminalSession {
|
|
38
|
-
meta:
|
|
51
|
+
meta: BoundSessionMeta
|
|
39
52
|
client: OmpRpcClient
|
|
40
53
|
seq: number
|
|
41
54
|
ring: TermFrame[]
|
|
@@ -64,7 +64,9 @@ export interface HermesAgentConfig {
|
|
|
64
64
|
export class HermesAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
65
65
|
private readonly config: HermesAgentConfig
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
// agentRole 由 BaseAgentImpl 持有(protected);同名私有声明会遮蔽基类 identity 角色。
|
|
68
|
+
// 仅收窄可见性声明,运行时代码不变(ensureClient 仍按 ctx.role 同步)。
|
|
69
|
+
protected override agentRole: 'lead' | 'worker' = 'worker'
|
|
68
70
|
private client: StdioJsonRpcClient | null = null
|
|
69
71
|
private clientStarting: Promise<void> | null = null
|
|
70
72
|
private sessionId: string | null = null
|
|
@@ -138,7 +140,7 @@ export class HermesAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
138
140
|
return 'deferred'
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
async respondHitl(kind: string, id: string, outcome: {
|
|
143
|
+
override async respondHitl(kind: string, id: string, outcome: {
|
|
142
144
|
confirmed?: boolean
|
|
143
145
|
cancelled?: boolean
|
|
144
146
|
}): Promise<void> {
|
|
@@ -21,7 +21,7 @@ import type { WorkspaceTask } from '../types/task'
|
|
|
21
21
|
import type { RpcHostToolDefinition } from './adapters/omp-rpc-client'
|
|
22
22
|
import { loadHostToolDefs } from '../prompts/loader'
|
|
23
23
|
import { daqRuntimeSettings } from '../settings'
|
|
24
|
-
import { toolAmlDatasetBuild, toolAmlDatasetStats, toolAmlJobCancel, toolAmlJobLogs, toolAmlJobStatus, toolAmlJobSubmit, toolAmlLeaderboard, toolAmlModelPromote, toolAmlModelReference, toolAmlNodeCatalog, toolDaqFrames, toolDaqQuery, toolDcwControl, toolDcwJudge, toolDcwJournal, toolDcwRead, toolDcwRollback, toolLineContext, toolMyIndustrialNodes, toolOpsLog, toolRecipeLog, toolRecipeRollback, toolRecipeUpdate, toolRecipeVersions } from './industrial-tools'
|
|
24
|
+
import { toolAmlDatasetBuild, toolAmlDatasetStats, toolAmlJobCancel, toolAmlJobLogs, toolAmlJobStatus, toolAmlJobSubmit, toolAmlLeaderboard, toolAmlModelPromote, toolAmlModelReference, toolAmlNodeCatalog, toolDaqFrames, toolDaqQuery, toolDcwControl, toolDcwJudge, toolDcwJournal, toolDcwRead, toolDcwRollback, toolLineContext, toolMyIndustrialNodes, toolOpsLog, toolParamControl, toolParamRead, toolRecipeLog, toolRecipeRollback, toolRecipeUpdate, toolRecipeVersions } from './industrial-tools'
|
|
25
25
|
import { listPluginTools, pluginOfTool } from './plugin-tools'
|
|
26
26
|
import { getChannelPluginsRepo } from '../db/channel-plugins.repo'
|
|
27
27
|
import { extractTaskMode } from '../runtime/execution-mode'
|
|
@@ -186,6 +186,10 @@ export async function dispatchHostTool(ctx: HostToolBridgeContext, req: HostTool
|
|
|
186
186
|
return toolDcwControl(identity.agentId, args as { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string })
|
|
187
187
|
case 'dcw_read':
|
|
188
188
|
return toolDcwRead(identity.agentId, args as { node_id?: string })
|
|
189
|
+
case 'param_control':
|
|
190
|
+
return toolParamControl(identity.agentId, args as { param?: string, value?: number | string, hypothesis?: string, task_id?: string, line_id?: string })
|
|
191
|
+
case 'param_read':
|
|
192
|
+
return toolParamRead(identity.agentId, args as { param?: string, line_id?: string })
|
|
189
193
|
case 'daq_query':
|
|
190
194
|
return toolDaqQuery(identity.agentId, args as Parameters<typeof toolDaqQuery>[1])
|
|
191
195
|
case 'daq_frames':
|
|
@@ -13,6 +13,7 @@ import { getDcwLineRepo } from '../dcw/dcw-line.repo'
|
|
|
13
13
|
import { getActiveLineRun } from '../dcw/line-run'
|
|
14
14
|
import { findDcwTemplate } from '../dcw/dcw-templates'
|
|
15
15
|
import { getDaqNodeRepo } from '../daq/daq-node.repo'
|
|
16
|
+
import type { DaqNode } from '../daq/daq-node'
|
|
16
17
|
import { findDaqTemplate } from '../daq/daq-templates'
|
|
17
18
|
import { getDeviceTwinRepo } from '../assets/device-twin.repo'
|
|
18
19
|
import { getRecipeRollBackManager } from '../dcw/recipe-rollback-manager'
|
|
@@ -159,9 +160,11 @@ export function buildIndustrialContext(agentId: string): string {
|
|
|
159
160
|
if (twinNames.size > 0) lines.push(`- 关联设备孪生: ${Array.from(twinNames).join(' | ')}`)
|
|
160
161
|
// 当前报警透出(只报本 Agent 绑定的数采节点):越限即报警是工况里最需要
|
|
161
162
|
// Agent 优先感知的事实 —— 不注入的话,Agent 只能靠 daq_query 事后发现
|
|
163
|
+
// 类型谓词(不收窄就无法在下游安全读 n.name/n.value/n.unit):
|
|
164
|
+
// `!!n && ...` 与原 `n && ...` 的真值判定完全一致,只补返回类型标注。
|
|
162
165
|
const alarms = daqIds
|
|
163
166
|
.map(id => getDaqNodeRepo().byId(id))
|
|
164
|
-
.filter(n => n && n.lineId === lineId && n.state === 'alarm')
|
|
167
|
+
.filter((n): n is DaqNode => !!n && n.lineId === lineId && n.state === 'alarm')
|
|
165
168
|
if (alarms.length > 0) {
|
|
166
169
|
lines.push(`- **当前报警**: ${alarms.map(n => `${n.name} 实时 ${n.value ?? '?'}${n.unit} 处于报警态(越量程或越配方监控窗口)`)},应优先判读(设定-响应滞后 vs 真实异常)并处置`)
|
|
167
170
|
}
|