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
|
@@ -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
|
}
|
|
@@ -19,6 +19,9 @@ import { daqRuntimeSettings } from '../settings'
|
|
|
19
19
|
import { getDaqNodeRepo } from '../daq/daq-node.repo'
|
|
20
20
|
import { findDaqTemplate } from '../daq/daq-templates'
|
|
21
21
|
import { getRecipeRollBackManager } from '../dcw/recipe-rollback-manager'
|
|
22
|
+
import { getDcwParamRepo } from '../dcw/param-map.repo'
|
|
23
|
+
import { limitsBreakdownOf } from '../dcw/param-limits'
|
|
24
|
+
import type { DcwParamView } from '../../../../shared/dcw-protocol'
|
|
22
25
|
import { getOps, recordOps } from '../ops/ops'
|
|
23
26
|
import { getDcwLineRepo } from '../dcw/dcw-line.repo'
|
|
24
27
|
import { getDcwProductRepo } from '../dcw/dcw-product.repo'
|
|
@@ -75,7 +78,10 @@ export async function toolMyIndustrialNodes(agentId: string): Promise<{ text: st
|
|
|
75
78
|
---
|
|
76
79
|
通用规则:
|
|
77
80
|
1. 一个 Agent 可绑定多个节点;先读本清单理解每个节点的物理意义与操作守则,再动手。
|
|
78
|
-
2.
|
|
81
|
+
2. 数控下发优先用 param_control(param, value) 以**工艺参数**寻址(key 语义稳定,跨批次/换配方不变);
|
|
82
|
+
dcw_control(node_id, value) 为节点直接寻址的兼容面。设定值受四层限界联锁
|
|
83
|
+
(节点安全量程 ∩ 工艺参数基准限界 ∩ 活动产品限界 ∩ 活动配方工艺窗口)逐层收窄,
|
|
84
|
+
越界一律拒绝 —— 用户与 Agent 一体约束,无旁路。下发前/后用 param_read(param) 读 PLC 当前值取证复核(被动观测免审批)。
|
|
79
85
|
3. 数据获取 daq_query(不传 node_id = 全部数采节点),支持按产线/产品/配方/时间检索;解读数据时结合语义卡的判读方法。
|
|
80
86
|
4. 改动设定后等待工艺响应(热惯性/传动惯量)再评估,避免连续大幅调整。
|
|
81
87
|
5. 调控闭环:每次下发自动开一条优化记录(open);观察数采后用 dcw_judge 落判定(keep/rollback/uncertain);
|
|
@@ -130,11 +136,8 @@ export async function toolDcwControl(agentId: string, args: { node_id?: string,
|
|
|
130
136
|
if (approvals.hasPendingFor(agentId, nodeId)) {
|
|
131
137
|
return { text: `你对该节点已有一条待审批的下发指令,请等待用户处理后再发新指令(避免审批堆积)。`, isError: true }
|
|
132
138
|
}
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const param = recipe?.params.find(p => p.nodeId === nodeId)
|
|
136
|
-
const detail = `${node.name}(${tpl?.ch ?? node.templateKey})设定 ${value}${node.unit}`
|
|
137
|
-
+ (param && (param.min != null || param.max != null) ? `,配方窗口 ${param.min ?? '-∞'}~${param.max ?? '+∞'}${node.unit}` : `,安全量程 ${node.min}~${node.max}${node.unit}`)
|
|
139
|
+
const bd = limitsBreakdownOf(node)
|
|
140
|
+
const detail = `${node.name}(${tpl?.ch ?? node.templateKey})设定 ${value}${node.unit},有效写入区间 ${bd.effective.min}~${bd.effective.max}${node.unit}(${bd.layers.map(l => l.label).join(' ∩ ')})`
|
|
138
141
|
const ap = await approvals.request(agentId, nodeId, 'dcw', detail)
|
|
139
142
|
if (!ap.approved) {
|
|
140
143
|
return { text: `指令未执行:用户${ap.comment.includes('超时') ? '未在时限内批准(超时)' : `拒绝了本次下发`}。用户备注:${ap.comment || '(无)'}` }
|
|
@@ -236,6 +239,161 @@ function writeToleranceOf(node: { decimals: number, min: number, max: number }):
|
|
|
236
239
|
return Math.max(0.5 * 10 ** -node.decimals, (node.max - node.min) * 0.005)
|
|
237
240
|
}
|
|
238
241
|
|
|
242
|
+
/** 工艺参数解析(param_control/param_read 共用):pp-id 优先,其次按 key;跨产线同名需 line_id 消歧 */
|
|
243
|
+
function resolveParamRef(ref: string, lineId?: string): { ok: true, param: DcwParamView } | { ok: false, text: string, isError: true } {
|
|
244
|
+
const repo = getDcwParamRepo()
|
|
245
|
+
const trimmed = String(ref ?? '').trim()
|
|
246
|
+
if (!trimmed) {
|
|
247
|
+
return { ok: false, text: 'param 必填:工艺参数 id(pp-*)或参数 key(见 my_industrial_nodes)。', isError: true }
|
|
248
|
+
}
|
|
249
|
+
const row = trimmed.startsWith('pp-') ? repo.byId(trimmed) : undefined
|
|
250
|
+
if (row) {
|
|
251
|
+
const view = repo.viewOf(row)
|
|
252
|
+
if (!view) return { ok: false, text: `工艺参数 ${trimmed} 的执行节点已不存在(映射悬空)。`, isError: true }
|
|
253
|
+
if (lineId && view.lineId !== lineId) {
|
|
254
|
+
return { ok: false, text: `工艺参数 ${view.key} 不属于产线 ${lineId}(实际归属:${view.lineId || '未分配'})。`, isError: true }
|
|
255
|
+
}
|
|
256
|
+
return { ok: true, param: view }
|
|
257
|
+
}
|
|
258
|
+
const hits = repo.byKey(trimmed)
|
|
259
|
+
.map(r => repo.viewOf(r))
|
|
260
|
+
.filter((v): v is DcwParamView => v != null)
|
|
261
|
+
const scoped = lineId ? hits.filter(v => v.lineId === lineId) : hits
|
|
262
|
+
if (scoped.length === 1) return { ok: true, param: scoped[0]! }
|
|
263
|
+
if (scoped.length === 0) {
|
|
264
|
+
const catalog = repo.listViews().slice(0, 12).map(v => `${v.key}(${v.name})`).join('、')
|
|
265
|
+
return { ok: false, text: `未找到工艺参数「${trimmed}」${lineId ? `(产线 ${lineId})` : ''}。可用参数:${catalog || '无 —— 请先让用户创建写控节点生成参数面'}。`, isError: true }
|
|
266
|
+
}
|
|
267
|
+
return { ok: false, text: `工艺参数「${trimmed}」命中 ${scoped.length} 条同名映射,请附加 line_id 消歧或改用参数 id(${scoped.map(v => v.id).join(' / ')})。`, isError: true }
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** 参数面权限摘要(工具回包统一口径;不透出寄存器等 PLC 寻址细节) */
|
|
271
|
+
function paramLimitsText(param: DcwParamView): string {
|
|
272
|
+
const node = getDcwController().byId(param.nodeId)
|
|
273
|
+
if (!node) return '执行节点已删除'
|
|
274
|
+
const bd = limitsBreakdownOf(node)
|
|
275
|
+
const layers = bd.layers.filter(l => l.min != null || l.max != null).map(l => l.label).join(' ∩ ')
|
|
276
|
+
return `有效写入区间 ${bd.effective.min}~${bd.effective.max}${param.unit}(约束层:${layers || '无'})`
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** 工具:param_control —— 按工艺参数下发设定值(推荐的参数语义寻址面)。
|
|
280
|
+
* 权限沿用节点绑定(参数 → 执行节点);限界联锁(参数基准 ∩ 产品 ∩ 配方 ∩ 节点安全量程)
|
|
281
|
+
* 在网关咽喉点统一生效。args.hypothesis 声明本次假设(入册),args.task_id 关联任务。 */
|
|
282
|
+
export async function toolParamControl(agentId: string, args: {
|
|
283
|
+
param?: string
|
|
284
|
+
value?: number | string
|
|
285
|
+
hypothesis?: string
|
|
286
|
+
task_id?: string
|
|
287
|
+
line_id?: string
|
|
288
|
+
}): Promise<{ text: string, isError?: boolean }> {
|
|
289
|
+
const resolved = resolveParamRef(String(args.param ?? ''), args.line_id ? String(args.line_id) : undefined)
|
|
290
|
+
if (!resolved.ok) return resolved
|
|
291
|
+
const param = resolved.param
|
|
292
|
+
const value = Number(args.value)
|
|
293
|
+
if (!Number.isFinite(value)) {
|
|
294
|
+
return { text: '设定值 value 必须为数字。', isError: true }
|
|
295
|
+
}
|
|
296
|
+
const repo = getAgentNodeBindingRepo()
|
|
297
|
+
const binding = repo.find(agentId, param.nodeId, 'dcw')
|
|
298
|
+
if (!binding) {
|
|
299
|
+
const mine = repo.byAgent(agentId).filter(b => b.kind === 'dcw')
|
|
300
|
+
return {
|
|
301
|
+
text: mine.length
|
|
302
|
+
? `无权操作工艺参数「${param.key}」(执行节点 ${param.nodeId} 未绑定给你)。你有权控制的数控节点:${mine.map(b => b.nodeId).join(', ')}。`
|
|
303
|
+
: '你尚未绑定任何数控节点,无权下发控制指令。请在数字孪生界面绑定数控节点。',
|
|
304
|
+
isError: true,
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const node = getDcwController().byId(param.nodeId)
|
|
308
|
+
if (!node) {
|
|
309
|
+
repo.removeAgentNode(agentId, param.nodeId, 'dcw')
|
|
310
|
+
return { text: `工艺参数「${param.key}」的执行节点已不存在(可能被删除),原绑定已自动清理。`, isError: true }
|
|
311
|
+
}
|
|
312
|
+
if (!node.enabled) {
|
|
313
|
+
return { text: `工艺参数「${param.key}」的执行节点「${node.name}」已停用(控制已暂停),无法下发。`, isError: true }
|
|
314
|
+
}
|
|
315
|
+
// 手动确认模式:与 dcw_control 同源审批面,备注回给 Agent
|
|
316
|
+
if (binding.mode === 'manual') {
|
|
317
|
+
const approvals = getToolApprovals()
|
|
318
|
+
if (approvals.hasPendingFor(agentId, param.nodeId)) {
|
|
319
|
+
return { text: '你对该执行节点已有一条待审批的下发指令,请等待用户处理后再发新指令(避免审批堆积)。', isError: true }
|
|
320
|
+
}
|
|
321
|
+
const detail = `工艺参数「${param.key}」(${param.name})设定 ${value}${param.unit},${paramLimitsText(param)}`
|
|
322
|
+
const ap = await approvals.request(agentId, param.nodeId, 'dcw', detail)
|
|
323
|
+
if (!ap.approved) {
|
|
324
|
+
return { text: `指令未执行:用户${ap.comment.includes('超时') ? '未在时限内批准(超时)' : `拒绝了本次下发`}。用户备注:${ap.comment || '(无)'}` }
|
|
325
|
+
}
|
|
326
|
+
if (!repo.find(agentId, param.nodeId, 'dcw')) {
|
|
327
|
+
return { text: '指令未执行:审批通过时你的该节点绑定已被解除(权限在批准时失效)。', isError: true }
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
try {
|
|
331
|
+
const meta = {
|
|
332
|
+
source: 'agent' as const,
|
|
333
|
+
actor: agentId,
|
|
334
|
+
actorName: agentBadgeLabel(agentId),
|
|
335
|
+
taskId: args.task_id ? String(args.task_id) : undefined,
|
|
336
|
+
hypothesis: args.hypothesis ? String(args.hypothesis) : '',
|
|
337
|
+
}
|
|
338
|
+
const outcome = await getDcwController().writeParam(param.id, value, meta)
|
|
339
|
+
if (outcome.ok) {
|
|
340
|
+
const stable = getRecipeRollBackManager().journal({ nodeId: param.nodeId, limit: 10 }).find(a => a.prevValue != null && a.prevValue !== a.newValue)
|
|
341
|
+
const loopTxt = [
|
|
342
|
+
outcome.recordId ? `优化记录 ${outcome.recordId} 已开窗(观察数采后 dcw_judge 落判定)` : null,
|
|
343
|
+
stable ? `上一稳定锚:${stable.prevValue}${param.unit}(可 dcw_rollback 回退)` : null,
|
|
344
|
+
].filter(Boolean).join(';')
|
|
345
|
+
return {
|
|
346
|
+
text: `下发成功:工艺参数「${param.key}」(${param.name})设定 ${value}${param.unit} → 执行节点「${node.name}」;回读 ${outcome.readback != null ? `${outcome.readback}${param.unit}` : '不支持'}一致。${paramLimitsText(param)}。${outcome.message}${loopTxt ? `\n[调控闭环] ${loopTxt}` : ''}`,
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return { text: `下发失败:${outcome.message}(工艺参数 ${param.key},执行节点「${node.name}」;${paramLimitsText(param)};当前设定值保持 ${node.value ?? '原值'}${param.unit} 未被改动)`, isError: true }
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
353
|
+
return { text: `下发被拒绝:${msg}(工艺参数 ${param.key};${paramLimitsText(param)})`, isError: true }
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** 工具:param_read —— 按工艺参数读取 PLC 当前值(被动观测免审批) */
|
|
358
|
+
export async function toolParamRead(agentId: string, args: {
|
|
359
|
+
param?: string
|
|
360
|
+
line_id?: string
|
|
361
|
+
}): Promise<{ text: string, isError?: boolean }> {
|
|
362
|
+
const resolved = resolveParamRef(String(args.param ?? ''), args.line_id ? String(args.line_id) : undefined)
|
|
363
|
+
if (!resolved.ok) return resolved
|
|
364
|
+
const param = resolved.param
|
|
365
|
+
const repo = getAgentNodeBindingRepo()
|
|
366
|
+
if (!repo.find(agentId, param.nodeId, 'dcw')) {
|
|
367
|
+
const mine = repo.byAgent(agentId).filter(b => b.kind === 'dcw')
|
|
368
|
+
return {
|
|
369
|
+
text: mine.length
|
|
370
|
+
? `无权读取工艺参数「${param.key}」(执行节点 ${param.nodeId} 未绑定给你)。你有权读取的数控节点:${mine.map(b => b.nodeId).join(', ')}。`
|
|
371
|
+
: '你尚未绑定任何数控节点,无权读取控制通道数据。请在数字孪生界面绑定数控节点。',
|
|
372
|
+
isError: true,
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const node = getDcwController().byId(param.nodeId)
|
|
376
|
+
if (!node) {
|
|
377
|
+
repo.removeAgentNode(agentId, param.nodeId, 'dcw')
|
|
378
|
+
return { text: `工艺参数「${param.key}」的执行节点已不存在(可能被删除),原绑定已自动清理。`, isError: true }
|
|
379
|
+
}
|
|
380
|
+
try {
|
|
381
|
+
const read = await getDcwController().readParam(param.id)
|
|
382
|
+
if (!read.ok && read.value == null && !node.readValue) {
|
|
383
|
+
return { text: `读取失败:${read.message}(执行节点「${node.name}」驱动 ${node.driver} 可能不支持读取;可改用 daq_query 查关联数采通道)`, isError: true }
|
|
384
|
+
}
|
|
385
|
+
const readTxt = read.value != null
|
|
386
|
+
? `${Number(read.value.toFixed(param.decimals))}${param.unit} @ ${read.at.slice(11, 19)}`
|
|
387
|
+
: (node.readValue != null ? `${node.readValue}${param.unit}(最近一次)` : '无读数')
|
|
388
|
+
return {
|
|
389
|
+
text: `读取成功:工艺参数「${param.key}」(${param.name})\n PLC 读数(ACT): ${readTxt}\n 当前设定(SET): ${node.value != null ? `${node.value}${param.unit}` : '从未下发'}\n ${paramLimitsText(param)}`,
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
return { text: `读取被拒绝:${err instanceof Error ? err.message : String(err)}(工艺参数 ${param.key})`, isError: true }
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
239
397
|
/**
|
|
240
398
|
* 数采目标集解析(工具共用鉴权面):Agent 绑定(kind=daq)为权限边界 ——
|
|
241
399
|
* node_id/line_id 只能缩小范围,不能放大(越权节点一律拒绝)。
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* 与 codex/dsh/opencode impl 全引擎一致。协议权威:omp://rpc.md。
|
|
19
19
|
*/
|
|
20
20
|
import { createLogger } from '../logger'
|
|
21
|
-
import { BaseAgentImpl } from './base-agent'
|
|
21
|
+
import { BaseAgentImpl, type BaseAgentConfigView } from './base-agent'
|
|
22
22
|
import { randomUUID } from 'node:crypto'
|
|
23
23
|
import type {
|
|
24
24
|
AgentEvent,
|
|
@@ -133,8 +133,8 @@ export class OmpRpcAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
133
133
|
return 'omp'
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
protected configRecord():
|
|
137
|
-
return this.config
|
|
136
|
+
protected configRecord(): BaseAgentConfigView {
|
|
137
|
+
return this.config
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
@@ -205,7 +205,9 @@ export class OmpRpcAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
205
205
|
/** 当前回合产生的 assistant 文本(供诊断) */
|
|
206
206
|
private turnText = ''
|
|
207
207
|
/** agent 身份信息(factory 注入;无需等待 init()) */
|
|
208
|
-
|
|
208
|
+
// agentRole 由 BaseAgentImpl 持有(protected);同名私有声明会遮蔽基类 identity 角色。
|
|
209
|
+
// 仅收窄可见性声明,运行时代码不变(构造函数与 ensureClient 仍显式同步)。
|
|
210
|
+
protected override agentRole: 'lead' | 'worker' = 'worker'
|
|
209
211
|
|
|
210
212
|
// ===== 上下文治理(70% 无中断压缩环)=====
|
|
211
213
|
/** 压缩进行中(平台 gate 与 omp 原生压缩共用互斥位) */
|
|
@@ -421,7 +423,7 @@ export class OmpRpcAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
421
423
|
|
|
422
424
|
// ===== 生命周期 =====
|
|
423
425
|
|
|
424
|
-
async init(input: { agent: AgentInfo, channelId: string }): Promise<void> {
|
|
426
|
+
override async init(input: { agent: AgentInfo, channelId: string }): Promise<void> {
|
|
425
427
|
this.agentInfo = input.agent
|
|
426
428
|
this.channelId = input.channelId
|
|
427
429
|
this.agentName = input.agent.name
|
|
@@ -550,10 +552,13 @@ export class OmpRpcAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
550
552
|
|
|
551
553
|
// ===== supervise() =====
|
|
552
554
|
|
|
553
|
-
/**
|
|
554
|
-
|
|
555
|
+
/**
|
|
556
|
+
* supervise 单飞守卫:同一 client 不并发 LLM 回合(残留回合与下一 prompt 混流的根因)。
|
|
557
|
+
* 守卫位由 BaseAgentImpl 的 protected supervising 承载 —— 本类原先的私有重复声明与基类构成
|
|
558
|
+
* "两个私有声明"(TS2415),而 JS 只有一个实例字段,故删除后语义与运行时完全一致。
|
|
559
|
+
*/
|
|
555
560
|
|
|
556
|
-
async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
|
|
561
|
+
override async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
|
|
557
562
|
await this.ensureClient(ctx)
|
|
558
563
|
if (!this.client) return []
|
|
559
564
|
if (this.supervising) return [] // 上一轮 supervise 未收口:跳过本拍(节流即正确)
|
|
@@ -1109,7 +1114,8 @@ export class OmpRpcAgentImpl extends BaseAgentImpl implements AgentInterface {
|
|
|
1109
1114
|
const client = new OmpRpcClient({
|
|
1110
1115
|
command,
|
|
1111
1116
|
mode: this.rpcMode,
|
|
1112
|
-
args
|
|
1117
|
+
// 重复键 args 的生效者是下一行(JS 对象字面量后写覆盖先写):保留生效语义,删除被覆盖项。
|
|
1118
|
+
// (原 ['--thinking', level] 从未真正传给 omp —— 见报告"未修的缺陷"一节。)
|
|
1113
1119
|
args: this.config.args,
|
|
1114
1120
|
cwd: this.config.cwd ?? process.cwd(),
|
|
1115
1121
|
// 进程退出 → 注册表标记(供运行时资源监控);pid=-1 表示无法取得,忽略
|