agentworkshop 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.AgentWorkShop/prompts/host-tools.json +1 -1
- package/.output/.AgentWorkShop/prompts/host-tools.json +1 -1
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{rzGB_ojX.js → 3612gD2V.js} +2 -2
- package/.output/public/_nuxt/8eIQAVlb.js +1 -0
- package/.output/public/_nuxt/Ah9qOv1m.js +1 -0
- package/.output/public/_nuxt/{DdPeifHR.js → B4Fia4FB.js} +1 -1
- package/.output/public/_nuxt/B7aqqzkY.js +1 -0
- package/.output/public/_nuxt/BJ-fxrSw.js +1 -0
- package/.output/public/_nuxt/{DPDqAD1e.js → BSXx2vqR.js} +1 -1
- package/.output/public/_nuxt/{CdSgfcYR.js → BVZjSVs2.js} +1 -1
- package/.output/public/_nuxt/{DP6bdyIp.js → BVzDoF8t.js} +1 -1
- package/.output/public/_nuxt/BYL0Rjqj.js +7 -0
- package/.output/public/_nuxt/{CXmkVXS5.js → BjVLsC3M.js} +1 -1
- package/.output/public/_nuxt/{7ZABjMRh2.js → BkfchkK62.js} +1 -1
- package/.output/public/_nuxt/BnVoQ74r.js +1 -0
- package/.output/public/_nuxt/Bnp4vIAf.js +1 -0
- package/.output/public/_nuxt/BsMpJf7S.js +70 -0
- package/.output/public/_nuxt/{Z8k0uMSI.js → Bt_HDizI.js} +1 -1
- package/.output/public/_nuxt/Bu-P92Pe.js +18 -0
- package/.output/public/_nuxt/ButLXkjo.js +2 -0
- package/.output/public/_nuxt/{D8DDDzV62.js → C2iWjzEC2.js} +1 -1
- package/.output/public/_nuxt/{HWXLx5Hz.js → C8dxXc6K.js} +5 -5
- package/.output/public/_nuxt/CGdPdJPP.js +1 -0
- package/.output/public/_nuxt/{CN7Zh8GQ.js → CRGlf1Gb.js} +1 -1
- package/.output/public/_nuxt/{DSBfvCi5.js → CblLEiCZ.js} +7 -7
- package/.output/public/_nuxt/Cd15nPnG2.js +1 -0
- package/.output/public/_nuxt/{OwJ1LJkF.js → CsCpu2Zh.js} +1 -1
- package/.output/public/_nuxt/CvbHIGQY2.js +1 -0
- package/.output/public/_nuxt/Cyk3du4K2.js +1 -0
- package/.output/public/_nuxt/{DVQAz9WI.js → D4qXvjuV.js} +2 -2
- package/.output/public/_nuxt/{CfIXY-ET.js → DCEyMaN-.js} +1 -1
- package/.output/public/_nuxt/{BFYNhG9S.js → DCXIGxzT.js} +1 -1
- package/.output/public/_nuxt/{B9aPoQvt.js → DM8DS9MA.js} +1 -1
- package/.output/public/_nuxt/{ChnfyQHz.js → DNzaswei.js} +1 -1
- package/.output/public/_nuxt/{CrFGZYVB2.js → DYZBdSSg2.js} +1 -1
- package/.output/public/_nuxt/{dObsRdSQ.js → DZk24ego.js} +1 -1
- package/.output/public/_nuxt/{CyygA0q4.js → Dc46i75T.js} +4 -4
- package/.output/public/_nuxt/DeYsUzhr.js +1 -0
- package/.output/public/_nuxt/Dk6pq9JB2.js +1 -0
- package/.output/public/_nuxt/{ByGNWgAr.js → Do88WZG2.js} +3 -3
- package/.output/public/_nuxt/{R_WxTozV2.js → Du-eSpo2.js} +1 -1
- package/.output/public/_nuxt/OmpTerminalPanel.B_Pl5Ynm.css +1 -0
- package/.output/public/_nuxt/R_Wv_Nd9.js +1 -0
- package/.output/public/_nuxt/{Bsc69G4x.js → VnIWJ0ts.js} +3 -3
- package/.output/public/_nuxt/_id_.BzKMZnLe.css +1 -0
- package/.output/public/_nuxt/_id_.CbpDAWRh.css +1 -0
- package/.output/public/_nuxt/{_wsId_.DET_GinP.css → _wsId_.COUzMXpP.css} +1 -1
- package/.output/public/_nuxt/agents.BlejnOOC.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/e5bb1803-86d9-43b3-85be-dc787dc9a978.json +1 -0
- package/.output/public/_nuxt/daq.zZ8GR433.css +1 -0
- package/.output/public/_nuxt/{default.D17kXlD6.css → default.V3_hUJq1.css} +1 -1
- package/.output/public/_nuxt/{entry.DvlXlPwx.css → entry.5qf6EqfN.css} +1 -1
- package/.output/public/_nuxt/{B4GHHF6d2.js → fQUs58kX2.js} +1 -1
- package/.output/public/_nuxt/p7wSGMtc.js +1 -0
- package/.output/public/_nuxt/tRBT-plo.js +1 -0
- package/.output/public/_nuxt/workshop.3kAcLB_M.css +1 -0
- package/.output/server/chunks/_/SearchOutlined.mjs +4 -4
- package/.output/server/chunks/_/SearchOutlined.mjs.map +1 -1
- package/.output/server/chunks/_/character-asset.repo.mjs +3 -6
- package/.output/server/chunks/_/character-asset.repo.mjs.map +1 -1
- package/.output/server/chunks/_/host-bindings.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +12807 -9814
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/_/scene-layout.repo.mjs +4 -10
- package/.output/server/chunks/_/scene-layout.repo.mjs.map +1 -1
- package/.output/server/chunks/build/{Col-D7fjGDF6.mjs → Col-biaNnEPf.mjs} +2 -2
- package/.output/server/chunks/build/{Col-D7fjGDF6.mjs.map → Col-biaNnEPf.mjs.map} +1 -1
- package/.output/server/chunks/build/{OmpTerminalPanel-B_SYhmgb.mjs → OmpTerminalPanel-COphA1br.mjs} +20 -19
- package/.output/server/chunks/build/OmpTerminalPanel-COphA1br.mjs.map +1 -0
- package/.output/server/chunks/build/{TownView-Bl8Gkcxi.mjs → TownView-B5KifIaT.mjs} +5 -5
- package/.output/server/chunks/build/{TownView-Bl8Gkcxi.mjs.map → TownView-B5KifIaT.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-GnRJPykX.mjs → _id_-C-ewLgfl.mjs} +120 -120
- package/.output/server/chunks/build/{_id_-GnRJPykX.mjs.map → _id_-C-ewLgfl.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-CWLFGZjV.mjs → _id_-Ct4Jhvl1.mjs} +43 -39
- package/.output/server/chunks/build/_id_-Ct4Jhvl1.mjs.map +1 -0
- package/.output/server/chunks/build/{_wsId_-BhQMjyHG.mjs → _wsId_-CanI_6Su.mjs} +591 -53
- package/.output/server/chunks/build/{_wsId_-BhQMjyHG.mjs.map → _wsId_-CanI_6Su.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents-D4l1icvn.mjs → agents-DSOptxXA.mjs} +146 -91
- package/.output/server/chunks/build/agents-DSOptxXA.mjs.map +1 -0
- package/.output/server/chunks/build/{alert-gH-s7yIh.mjs → alert-qJnjyRcP.mjs} +3 -3
- package/.output/server/chunks/build/{alert-gH-s7yIh.mjs.map → alert-qJnjyRcP.mjs.map} +1 -1
- package/.output/server/chunks/build/{button-BhbX5ACI.mjs → button-DEcZFcqN.mjs} +3 -3
- package/.output/server/chunks/build/{button-BhbX5ACI.mjs.map → button-DEcZFcqN.mjs.map} +1 -1
- package/.output/server/chunks/build/{card-l4BbX67w.mjs → card-Dipvaykh.mjs} +5 -5
- package/.output/server/chunks/build/{card-l4BbX67w.mjs.map → card-Dipvaykh.mjs.map} +1 -1
- package/.output/server/chunks/build/{channel-templates-DqjtC-R0.mjs → channel-templates-BK0KuPOd.mjs} +13 -12
- package/.output/server/chunks/build/channel-templates-BK0KuPOd.mjs.map +1 -0
- package/.output/server/chunks/build/{checkbox-BF11p3dH.mjs → checkbox-dzcpU_Cd.mjs} +4 -4
- package/.output/server/chunks/build/{checkbox-BF11p3dH.mjs.map → checkbox-dzcpU_Cd.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-BOgpn9sl.mjs → daq-D9RA_uze.mjs} +103 -103
- package/.output/server/chunks/build/{daq-BOgpn9sl.mjs.map → daq-D9RA_uze.mjs.map} +1 -1
- package/.output/server/chunks/build/dcw-BTM5YU-B.mjs +2 -2
- package/.output/server/chunks/build/{default-CKJWhkot.mjs → default-BfWGTlbj.mjs} +81 -23
- package/.output/server/chunks/build/{default-CKJWhkot.mjs.map → default-BfWGTlbj.mjs.map} +1 -1
- package/.output/server/chunks/build/{drawer-CVValqoh.mjs → drawer-Cmh90erI.mjs} +3 -3
- package/.output/server/chunks/build/{drawer-CVValqoh.mjs.map → drawer-Cmh90erI.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-ByCsEWlQ.mjs → dropdown-CGQ0KAzA.mjs} +2 -2
- package/.output/server/chunks/build/{dropdown-ByCsEWlQ.mjs.map → dropdown-CGQ0KAzA.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-Dex8PXu6.mjs → dropdown-vhn1NPFs.mjs} +4 -4
- package/.output/server/chunks/build/{dropdown-Dex8PXu6.mjs.map → dropdown-vhn1NPFs.mjs.map} +1 -1
- package/.output/server/chunks/build/{input-number-BBlRoAJ7.mjs → input-number-Bd55elNN.mjs} +5 -5
- package/.output/server/chunks/build/{input-number-BBlRoAJ7.mjs.map → input-number-Bd55elNN.mjs.map} +1 -1
- package/.output/server/chunks/build/{input--KMeLYqZ.mjs → input-sf_BT6o6.mjs} +3 -3
- package/.output/server/chunks/build/{input--KMeLYqZ.mjs.map → input-sf_BT6o6.mjs.map} +1 -1
- package/.output/server/chunks/build/logs-Dyk0I2I9.mjs +1 -1
- package/.output/server/chunks/build/{menu-xN-SXb9Q.mjs → menu-WCrlpYVh.mjs} +3 -3
- package/.output/server/chunks/build/{menu-xN-SXb9Q.mjs.map → menu-WCrlpYVh.mjs.map} +1 -1
- package/.output/server/chunks/build/{modal-DrCOcjrl.mjs → modal-yvUquPj5.mjs} +4 -4
- package/.output/server/chunks/build/{modal-DrCOcjrl.mjs.map → modal-yvUquPj5.mjs.map} +1 -1
- package/.output/server/chunks/build/{monitor-KW8WLOJd.mjs → monitor-MIOvsyLa.mjs} +21 -21
- package/.output/server/chunks/build/{monitor-KW8WLOJd.mjs.map → monitor-MIOvsyLa.mjs.map} +1 -1
- package/.output/server/chunks/build/pages-DR2bzczM.mjs +1 -1
- package/.output/server/chunks/build/{plugins-B-ZNey0Z.mjs → plugins-DnOBIWGg.mjs} +7 -7
- package/.output/server/chunks/build/{plugins-B-ZNey0Z.mjs.map → plugins-DnOBIWGg.mjs.map} +1 -1
- package/.output/server/chunks/build/{popconfirm-C5H1Qoh3.mjs → popconfirm-CRaHcz5O.mjs} +4 -4
- package/.output/server/chunks/build/{popconfirm-C5H1Qoh3.mjs.map → popconfirm-CRaHcz5O.mjs.map} +1 -1
- package/.output/server/chunks/build/{useWorkshopApi-Bh5VUHWu.mjs → segmented-DPe9ZzLO.mjs} +7 -78
- package/.output/server/chunks/build/segmented-DPe9ZzLO.mjs.map +1 -0
- package/.output/server/chunks/build/{select-D7H2ysgT.mjs → select-D-CeE5vY.mjs} +3 -3
- package/.output/server/chunks/build/{select-D7H2ysgT.mjs.map → select-D-CeE5vY.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-Cr06lbRy.mjs → settings-DA8IkGLo.mjs} +11 -11
- package/.output/server/chunks/build/{settings-Cr06lbRy.mjs.map → settings-DA8IkGLo.mjs.map} +1 -1
- package/.output/server/chunks/build/{space-DCwIlnkI.mjs → space-CCBYAkXt.mjs} +2 -2
- package/.output/server/chunks/build/{space-DCwIlnkI.mjs.map → space-CCBYAkXt.mjs.map} +1 -1
- package/.output/server/chunks/build/{switch-VC0m9ede.mjs → switch-CelRXpcy.mjs} +3 -3
- package/.output/server/chunks/build/{switch-VC0m9ede.mjs.map → switch-CelRXpcy.mjs.map} +1 -1
- package/.output/server/chunks/build/{table-BksLg3Q_.mjs → table-Cswq-l2r.mjs} +10 -10
- package/.output/server/chunks/build/{table-BksLg3Q_.mjs.map → table-Cswq-l2r.mjs.map} +1 -1
- package/.output/server/chunks/build/{tabs-CzUfD3iX.mjs → tabs-BM3tAh_J.mjs} +5 -5
- package/.output/server/chunks/build/{tabs-CzUfD3iX.mjs.map → tabs-BM3tAh_J.mjs.map} +1 -1
- package/.output/server/chunks/build/{tag-oQI3VtqM.mjs → tag-NO9jEqKy.mjs} +4 -4
- package/.output/server/chunks/build/{tag-oQI3VtqM.mjs.map → tag-NO9jEqKy.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-QR3BBF7A.mjs → teams-BhSKBBBM.mjs} +15 -14
- package/.output/server/chunks/build/teams-BhSKBBBM.mjs.map +1 -0
- package/.output/server/chunks/build/{tokens-DFvr_TLj.mjs → tokens-D_eyxmcv.mjs} +16 -16
- package/.output/server/chunks/build/{tokens-DFvr_TLj.mjs.map → tokens-D_eyxmcv.mjs.map} +1 -1
- package/.output/server/chunks/build/town-BUqRobze.mjs +1 -1
- package/.output/server/chunks/build/{town-_4tEEEVW.mjs → town-DPtOPRRO.mjs} +4 -4
- package/.output/server/chunks/build/{town-_4tEEEVW.mjs.map → town-DPtOPRRO.mjs.map} +1 -1
- package/.output/server/chunks/build/useDaqStream-hwkhJHFU.mjs +1 -1
- package/.output/server/chunks/build/useDcwStream-Bdew_yrr.mjs +1 -1
- package/.output/server/chunks/build/useLocalTime-9a4B-aHv.mjs +42 -0
- package/.output/server/chunks/build/useLocalTime-9a4B-aHv.mjs.map +1 -0
- package/.output/server/chunks/build/useWorkshopApi-D2gq06N2.mjs +81 -0
- package/.output/server/chunks/build/useWorkshopApi-D2gq06N2.mjs.map +1 -0
- package/.output/server/chunks/build/useWorkshopWs-B3j5wIAK.mjs +1 -1
- package/.output/server/chunks/build/user-Dk-ytEUV.mjs +1 -1
- package/.output/server/chunks/build/{users-4FZ0yFUO.mjs → users-CmVvb1oq.mjs} +16 -16
- package/.output/server/chunks/build/{users-4FZ0yFUO.mjs.map → users-CmVvb1oq.mjs.map} +1 -1
- package/.output/server/chunks/build/{workshop-k0XZTFKg.mjs → workshop-D5CQj2A8.mjs} +53 -47
- package/.output/server/chunks/build/workshop-D5CQj2A8.mjs.map +1 -0
- package/.output/server/chunks/build/workspaces-IfORCDJE.mjs +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/chunks/routes/api/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
- package/.output/server/chunks/routes/api/metrics.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/_name/_...path_.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/client/_name_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/plugins/manifest.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/config.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/index.get.mjs +3 -3
- package/.output/server/chunks/routes/api/system/index.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/system/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor/terminal/ws.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor/terminate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/system/monitor.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/settings/events.get.mjs +1 -1
- package/.output/server/chunks/routes/api/system/settings/reset.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/_id_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/users/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/login.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/logout.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/me.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/register.post.mjs +1 -1
- package/.output/server/chunks/routes/api/users/setup-status.get.mjs +25 -0
- package/.output/server/chunks/routes/api/users/setup-status.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/users/tokens/_id/token.get.mjs +1 -1
- package/.output/server/chunks/routes/api/users/tokens/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/users/tokens/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/_...path_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/_agentId/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/a2a/send.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +6 -14
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +39 -0
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/agents/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/subscribe.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/approvals/_id/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/character/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/assets/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/audit.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/caller.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +3 -3
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/from-channel.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/_memoryId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/memories/search.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/model.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/position.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/range.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/events.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/queue.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +9 -2
- package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +3 -3
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +7 -4
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/alarms.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/infra.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +247 -0
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +27 -0
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +20 -8
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index10.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index4.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index4.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index5.get.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index5.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index9.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mailbox/all.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mailbox.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/memories/maintenance.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/plugins/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/runtime.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/scene/layouts.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/complete.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/dispatch.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/report.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/retry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/teams/_id/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/members/_agentId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/users/me.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/users/register.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +3 -3
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channels/_channelId_.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/index.delete.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +2 -2
- package/.output/server/chunks/virtual/entry.mjs +132 -114
- package/.output/server/chunks/virtual/entry.mjs.map +1 -1
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/index.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +27 -7
- package/README.md +455 -435
- package/app/components/AppHeader.vue +56 -2
- package/app/components/workshop/ChannelSessionList.vue +703 -593
- package/app/components/workshop/terminal/OmpTerminalPanel.vue +2 -1
- package/app/composables/workshop/useLocalTime.ts +16 -0
- package/app/composables/workshop/useSceneLayouts.ts +2 -1
- package/app/composables/workshop/useWorkshopApi.ts +249 -224
- package/app/pages/daq/[id].vue +7 -6
- package/app/pages/daq/index.vue +2 -2
- package/app/pages/dcw/[id].vue +3 -3
- package/app/pages/workshop/agents.vue +432 -382
- package/app/pages/workshop/index.vue +25 -6
- package/bin/aw.mjs +0 -0
- package/cli/aw.mjs +8 -1
- package/cli/commands/stop.mjs +7 -4
- package/cli/commands/tui.mjs +10 -1
- package/cli/core/registry.mjs +5 -3
- package/config.yml +144 -134
- package/docs/tui.md +1 -1
- package/i18n/dicts/settings.json +4 -0
- package/i18n/locales/en.ts +9 -0
- package/i18n/locales/zh-CN.ts +9 -0
- package/package.json +148 -140
- package/scripts/_dbg-catalog-smoke.ts +20 -0
- package/scripts/_dbg-codex-handshake.ts +30 -0
- package/scripts/_dbg-codex-probe.mjs +58 -0
- package/scripts/_dbg-codex-sandbox.ts +58 -0
- package/scripts/_dbg-codex-turn.ts +65 -0
- package/scripts/_dbg-dsh-probe.mjs +31 -0
- package/scripts/_dbg-interval-config.mjs +145 -0
- package/scripts/_dbg-interval-scenario.mjs +126 -0
- package/scripts/_dbg-line-spawn.ts +31 -0
- package/scripts/_dbg-live-engine-probe.mjs +80 -0
- package/scripts/_dbg-mcp-bridge-probe.mjs +147 -0
- package/scripts/_dbg-opencode-sse.mjs +101 -0
- package/scripts/_dbg-opencode-start.ts +57 -0
- package/scripts/_dbg-plugin-matrix.mjs +212 -0
- package/scripts/_dbg-protocol-matrix.mjs +425 -0
- package/scripts/_dbg-real-scenario-timeline.log +123 -0
- package/scripts/_dbg-registry-smoke.ts +14 -0
- package/scripts/_dbg-setup-e2e.mjs +88 -0
- package/scripts/_dbg-sim-keeper.mjs +100 -0
- package/scripts/_dbg-team-drill.mjs +173 -0
- package/scripts/dev-guard.mjs +11 -3
- package/scripts/dev-protocol-simulators.mjs +28 -1
- package/scripts/e2e-harness-provider-task.mjs +126 -0
- package/scripts/e2e-multi-harness.ts +374 -0
- package/scripts/e2e-multiharness-team.mjs +319 -0
- package/scripts/e2e-plc-scenario.mjs +292 -0
- package/scripts/e2e-real-scenario.mjs +452 -0
- package/scripts/migrate-local-time.mjs +123 -0
- package/scripts/start.mjs +30 -2
- package/server/api/system/settings/index.get.ts +3 -3
- package/server/api/users/setup-status.get.ts +8 -0
- package/server/api/workshop/agent-tools/invoke.post.ts +27 -41
- package/server/api/workshop/agent-tools/list.get.ts +25 -0
- package/server/api/workshop/channels/[id]/index.patch.ts +38 -30
- package/server/api/workshop/daq/[id]/samples.get.ts +8 -3
- package/server/api/workshop/harnesses/[id]/providers.get.ts +16 -0
- package/server/api/workshop/harnesses.get.ts +12 -0
- package/server/api/workshop/hitl/respond.post.ts +87 -67
- package/server/api/workshop/ws.ts +13 -0
- package/server/data/daqs.json +1421 -19
- package/server/data/dcw-lines.json +273 -0
- package/server/data/dcw-products.json +224 -0
- package/server/data/dcw-recipes.json +868 -0
- package/server/data/dcw-rollback.json +1177 -1
- package/server/data/dcw-runs.json +3032 -2834
- package/server/data/dcw-writes.json +1116 -0
- package/server/data/dcws.json +3447 -297
- package/server/data/line-runs.json +52 -2
- package/server/harness/aw-mcp-bridge.mjs +153 -0
- package/server/plugins/00-local-time.ts +10 -0
- package/server/plugins/aw-plugins.ts +3 -0
- package/server/plugins/backup.ts +116 -97
- package/server/plugins/dev-stability-guard.ts +24 -15
- package/server/plugins/retention.ts +1 -0
- package/server/plugins/security.ts +46 -29
- package/server/plugins/workshop.ts +156 -153
- package/server/repositories/user.repository.ts +15 -22
- package/server/services/system-config.ts +32 -6
- package/server/services/user.service.ts +8 -3
- package/server/services/workshop/.mimosa/hook-state/sess_fed429fb-c8b7-4a50-bbd6-45afc580893f.json +1 -0
- package/server/services/workshop/.mimosa/hook-status/sess_fed429fb-c8b7-4a50-bbd6-45afc580893f-e6b75bbfe6.json +14 -0
- package/server/services/workshop/agents/adapters/line-spawn.ts +111 -0
- package/server/services/workshop/agents/adapters/stdio-jsonrpc.ts +316 -0
- package/server/services/workshop/agents/agent-interface.ts +17 -0
- package/server/services/workshop/agents/codex-agent.ts +822 -0
- package/server/services/workshop/agents/dsh-agent.ts +670 -0
- package/server/services/workshop/agents/factory.ts +4 -16
- package/server/services/workshop/agents/harness-env.ts +54 -0
- package/server/services/workshop/agents/harness-models.ts +270 -0
- package/server/services/workshop/agents/host-tool-bridge.ts +612 -0
- package/server/services/workshop/agents/industrial-tools.ts +7 -1
- package/server/services/workshop/agents/node-bindings.repo.ts +4 -5
- package/server/services/workshop/agents/omp-agent.ts +1178 -1957
- package/server/services/workshop/agents/opencode-agent.ts +987 -0
- package/server/services/workshop/agents/prompt-builder.ts +393 -0
- package/server/services/workshop/agents/registry.ts +125 -0
- package/server/services/workshop/assets/character-asset.repo.ts +3 -5
- package/server/services/workshop/assets/device-twin.repo.ts +3 -5
- package/server/services/workshop/daq/daq-controller.ts +38 -6
- package/server/services/workshop/daq/daq-node.repo.ts +3 -5
- package/server/services/workshop/daq/daq-node.ts +3 -3
- package/server/services/workshop/daq/daq-runtime.ts +4 -3
- package/server/services/workshop/daq/daq-templates.ts +3 -5
- package/server/services/workshop/daq/drivers.ts +41 -12
- package/server/services/workshop/daq/storage/sqlite.adapter.ts +313 -309
- package/server/services/workshop/db/backup-registry.ts +33 -0
- package/server/services/workshop/db/channel.repo.ts +104 -101
- package/server/services/workshop/db/database.ts +956 -949
- package/server/services/workshop/dcw/dcw-controller.ts +5 -1
- package/server/services/workshop/dcw/dcw-line.repo.ts +4 -11
- package/server/services/workshop/dcw/dcw-node.repo.ts +3 -5
- package/server/services/workshop/dcw/dcw-node.ts +13 -1
- package/server/services/workshop/dcw/dcw-product.repo.ts +3 -4
- package/server/services/workshop/dcw/dcw-recipe.repo.ts +3 -19
- package/server/services/workshop/dcw/dcw-templates.ts +3 -5
- package/server/services/workshop/dcw/drivers.ts +37 -13
- package/server/services/workshop/dcw/line-run.ts +3 -5
- package/server/services/workshop/dcw/recipe-rollback.repo.ts +4 -10
- package/server/services/workshop/json-store.mjs +72 -0
- package/server/services/workshop/plugins/host.mjs +2 -1
- package/server/services/workshop/runtime/agent-runtime.ts +44 -0
- package/server/services/workshop/runtime/manager.ts +2953 -2868
- package/server/services/workshop/scene/scene-layout.repo.ts +4 -11
- package/server/services/workshop/settings.ts +30 -0
- package/shared/config/schema.json +9 -0
- package/shared/config/single-instance.mjs +5 -1
- package/shared/local-time.mjs +36 -0
- package/shared/workshop-protocol.ts +11 -5
- package/tui/aw-tui.mjs +28 -10
- package/tui/components/hitl-card.mjs +47 -36
- package/tui/lib/ws.mjs +2 -1
- package/.output/public/_nuxt/9X0fVBD7.js +0 -57
- package/.output/public/_nuxt/B6M2WJWm2.js +0 -1
- package/.output/public/_nuxt/B9Yie5HN.js +0 -2
- package/.output/public/_nuxt/BF9XPEuw.js +0 -1
- package/.output/public/_nuxt/BbQornXa.js +0 -1
- package/.output/public/_nuxt/Bxgaym6j.js +0 -1
- package/.output/public/_nuxt/Bxh5nf8j.js +0 -1
- package/.output/public/_nuxt/CXLI50Sq.js +0 -1
- package/.output/public/_nuxt/CdfAP_IH2.js +0 -1
- package/.output/public/_nuxt/Ce1zyNYu.js +0 -1
- package/.output/public/_nuxt/D-Ne4C9a.js +0 -1
- package/.output/public/_nuxt/DEHNjlTq2.js +0 -1
- package/.output/public/_nuxt/DFnGFEav.js +0 -18
- package/.output/public/_nuxt/DYWgGHNo.js +0 -7
- package/.output/public/_nuxt/OmpTerminalPanel.Bc9GjNU5.css +0 -1
- package/.output/public/_nuxt/W1E3-5ML.js +0 -14
- package/.output/public/_nuxt/XVB9_zwP.js +0 -1
- package/.output/public/_nuxt/Xaf_HIR3.js +0 -1
- package/.output/public/_nuxt/_id_.BeqSLvl_.css +0 -1
- package/.output/public/_nuxt/_id_.DN3U6EF9.css +0 -1
- package/.output/public/_nuxt/agents.BJwgTLFZ.css +0 -1
- package/.output/public/_nuxt/builds/meta/55c10854-ee0e-4be4-924b-a1b0e100fe11.json +0 -1
- package/.output/public/_nuxt/daq.BXsnevQv.css +0 -1
- package/.output/public/_nuxt/workshop.B98sHiJq.css +0 -1
- package/.output/public/_nuxt/yIKY_V1P.js +0 -1
- package/.output/server/chunks/build/OmpTerminalPanel-B_SYhmgb.mjs.map +0 -1
- package/.output/server/chunks/build/_id_-CWLFGZjV.mjs.map +0 -1
- package/.output/server/chunks/build/agents-D4l1icvn.mjs.map +0 -1
- package/.output/server/chunks/build/channel-templates-DqjtC-R0.mjs.map +0 -1
- package/.output/server/chunks/build/interval-WlxgjTzO.mjs +0 -9
- package/.output/server/chunks/build/interval-WlxgjTzO.mjs.map +0 -1
- package/.output/server/chunks/build/teams-QR3BBF7A.mjs.map +0 -1
- package/.output/server/chunks/build/useWorkshopApi-Bh5VUHWu.mjs.map +0 -1
- package/.output/server/chunks/build/workshop-k0XZTFKg.mjs.map +0 -1
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DshAgentImpl — DeepSeek Harness(`dsh --profile acp`)的 AgentInterface 实现。
|
|
3
|
+
*
|
|
4
|
+
* 进程模型:每 Agent 一个 `dsh --profile acp` 子进程(ACP v1:JSON-RPC over stdio,
|
|
5
|
+
* lazy spawn 跨消息复用);session/new 建会话(挂 stdio MCP 桥),session/prompt
|
|
6
|
+
* 驱动回合(单飞,响应在回合终点返回 stopReason)。
|
|
7
|
+
*
|
|
8
|
+
* - prompt/工具面与 omp 全引擎同源(prompt-builder / host-tool-bridge);
|
|
9
|
+
* 工具经 stdio MCP 桥以 session/new mcpServers 挂载(工具名 mcp__aw__* 由引擎加前缀)
|
|
10
|
+
* - 事件映射:session/update(agent_message_chunk/tool_call/tool_call_update/contextUsage)
|
|
11
|
+
* → AgentEvent;session/prompt 响应(stopReason)→ done/error
|
|
12
|
+
* - HITL:session/request_permission(server→client 请求)→ hitl-registry 登记 →
|
|
13
|
+
* respondHitl 应答(allow 选项 / reject 选项 / cancelled;fail-closed)
|
|
14
|
+
* - steer:ACP 无同轮注入 → 恒 'deferred'(能力面如实声明 steer:false)
|
|
15
|
+
* - 上下文:引擎原生 auto-compaction;usage 随事件被动跟踪(平台不主动压缩)
|
|
16
|
+
*
|
|
17
|
+
* 风险:pre-1.0(developer preview),协议方法名集中本文件;版本 pin + 契约测试兜底。
|
|
18
|
+
* 协议权威:github.com/deepseek-ai/deepseek-harness packages/acp/acp/README.md。
|
|
19
|
+
*/
|
|
20
|
+
import { createLogger } from '../logger'
|
|
21
|
+
import { randomUUID } from 'node:crypto'
|
|
22
|
+
import type {
|
|
23
|
+
AgentEvent,
|
|
24
|
+
AgentInterface,
|
|
25
|
+
AgentInfo,
|
|
26
|
+
AgentRunContext,
|
|
27
|
+
AgentRunRequest,
|
|
28
|
+
SupervisionDecision,
|
|
29
|
+
SupervisionSnapshot,
|
|
30
|
+
} from './agent-interface'
|
|
31
|
+
import type { AgentContextStats } from '../types/task'
|
|
32
|
+
import { registerHarnessProcess, bindHarnessProcess, markHarnessProcessExit, killHarnessProcess } from './harness-process'
|
|
33
|
+
import { createSessionState, dispatchHostTool } from './host-tool-bridge'
|
|
34
|
+
import {
|
|
35
|
+
contextPrefix as buildContextPrefix,
|
|
36
|
+
createRosterCache,
|
|
37
|
+
extractJsonArray,
|
|
38
|
+
peerPrompt,
|
|
39
|
+
supervisePrompt,
|
|
40
|
+
systemManual,
|
|
41
|
+
toolArgsPreview,
|
|
42
|
+
workerPrompt,
|
|
43
|
+
} from './prompt-builder'
|
|
44
|
+
import { getHitlRegistry } from './hitl-registry'
|
|
45
|
+
import { harnessSettings } from '../settings'
|
|
46
|
+
import { StdioJsonRpcClient, type JsonRpcRequestIncoming } from './adapters/stdio-jsonrpc'
|
|
47
|
+
import { generateMcpBridgeEnv } from './harness-env'
|
|
48
|
+
|
|
49
|
+
const log = createLogger('workshop.dsh')
|
|
50
|
+
|
|
51
|
+
/** ACP 协议方法名集中地(pre-1.0 变更时改这一处) */
|
|
52
|
+
export const DSH_ACP_METHODS = {
|
|
53
|
+
initialize: 'initialize',
|
|
54
|
+
sessionNew: 'session/new',
|
|
55
|
+
sessionPrompt: 'session/prompt',
|
|
56
|
+
sessionCancel: 'session/cancel',
|
|
57
|
+
sessionUpdate: 'session/update',
|
|
58
|
+
requestPermission: 'session/request_permission',
|
|
59
|
+
} as const
|
|
60
|
+
|
|
61
|
+
export interface DshAgentConfig {
|
|
62
|
+
/** dsh 可执行文件(默认取 harness.dsh_command 设置) */
|
|
63
|
+
command?: string
|
|
64
|
+
/** 额外 CLI 参数(默认 ['--profile','acp']) */
|
|
65
|
+
args?: string[]
|
|
66
|
+
cwd?: string
|
|
67
|
+
/** 模型(如 deepseek-v4-flash;经进程环境传给 profile patch 的 acp provider/model) */
|
|
68
|
+
model?: string
|
|
69
|
+
/** provider(如 deepseek-official;经进程环境传给 profile patch) */
|
|
70
|
+
provider?: string
|
|
71
|
+
/** 推理档位(off|low|high|max) */
|
|
72
|
+
reasoningEffort?: string
|
|
73
|
+
/** 审批策略(ask=默认,触发 HITL;never=引擎侧全拒) */
|
|
74
|
+
approvalPolicy?: 'ask' | 'never'
|
|
75
|
+
/** 沙箱预设(read-only|workspace-write|danger-full-access) */
|
|
76
|
+
sandboxPreset?: string
|
|
77
|
+
/** DSH_HOME(缺省继承用户环境,保留其凭据) */
|
|
78
|
+
dshHome?: string
|
|
79
|
+
/** DEEPSEEK_API_KEY(缺省继承进程环境) */
|
|
80
|
+
apiKey?: string
|
|
81
|
+
/** 上下文窗口(usage 百分比;默认 1_000_000,deepseek v4 系) */
|
|
82
|
+
contextWindow?: number
|
|
83
|
+
promptTimeoutMs?: number
|
|
84
|
+
superviseTimeoutMs?: number
|
|
85
|
+
systemPromptPrefix?: string
|
|
86
|
+
scenarioPrompt?: string
|
|
87
|
+
agentId?: string
|
|
88
|
+
name?: string
|
|
89
|
+
role?: 'lead' | 'worker'
|
|
90
|
+
channelId?: string
|
|
91
|
+
token?: string
|
|
92
|
+
baseUrl?: string
|
|
93
|
+
mcpBridgePath?: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export class DshAgentImpl implements AgentInterface {
|
|
97
|
+
private readonly config: DshAgentConfig
|
|
98
|
+
private workspace: AgentRunContext['workspace'] | null = null
|
|
99
|
+
private agentInfo: AgentInfo | null = null
|
|
100
|
+
private readonly toolState = createSessionState()
|
|
101
|
+
private readonly bridgeCtx = {
|
|
102
|
+
identity: { agentId: '', channelId: '', role: 'worker' as 'lead' | 'worker', name: 'agent' },
|
|
103
|
+
state: this.toolState,
|
|
104
|
+
getWorkspace: () => this.workspace,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private roster = createRosterCache({ selfAgentId: '', listAgents: async () => [] })
|
|
108
|
+
|
|
109
|
+
private selfAgentId = ''
|
|
110
|
+
private agentName = 'agent'
|
|
111
|
+
private agentRole: 'lead' | 'worker' = 'worker'
|
|
112
|
+
private channelId = ''
|
|
113
|
+
|
|
114
|
+
private client: StdioJsonRpcClient | null = null
|
|
115
|
+
private clientStarting: Promise<void> | null = null
|
|
116
|
+
private sessionId: string | null = null
|
|
117
|
+
/** ACP 会话回合锁(一 session 一 in-flight prompt) */
|
|
118
|
+
private turnActive = false
|
|
119
|
+
private lastUsage: { input: number, at: number } | null = null
|
|
120
|
+
/** 待应答权限(permission request id → rpc id) */
|
|
121
|
+
private pendingPermissions = new Map<string, { rpcId: string | number, options: Array<Record<string, unknown>>, timer: ReturnType<typeof setTimeout> | null }>()
|
|
122
|
+
|
|
123
|
+
constructor(config: Record<string, unknown> = {}) {
|
|
124
|
+
this.config = config as DshAgentConfig
|
|
125
|
+
this.selfAgentId = this.config.agentId ?? ''
|
|
126
|
+
this.agentName = this.config.name ?? 'agent'
|
|
127
|
+
this.agentRole = this.config.role ?? 'worker'
|
|
128
|
+
this.channelId = this.config.channelId ?? ''
|
|
129
|
+
this.refreshIdentity()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private refreshIdentity(): void {
|
|
133
|
+
this.bridgeCtx.identity = { agentId: this.selfAgentId, channelId: this.channelId, role: this.agentRole, name: this.agentName }
|
|
134
|
+
this.roster = createRosterCache({
|
|
135
|
+
selfAgentId: this.selfAgentId,
|
|
136
|
+
listAgents: async () => this.workspace?.listAgents() ?? [],
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async init(input: { agent: AgentInfo, channelId: string }): Promise<void> {
|
|
141
|
+
this.agentInfo = input.agent
|
|
142
|
+
this.channelId = input.channelId
|
|
143
|
+
this.agentName = input.agent.name
|
|
144
|
+
this.agentRole = input.agent.role
|
|
145
|
+
this.selfAgentId = input.agent.id
|
|
146
|
+
this.refreshIdentity()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async dispose(): Promise<void> {
|
|
150
|
+
const client = this.client
|
|
151
|
+
this.client = null
|
|
152
|
+
this.sessionId = null
|
|
153
|
+
if (client) {
|
|
154
|
+
const pid = client.pid
|
|
155
|
+
await client.dispose().catch(() => {})
|
|
156
|
+
if (pid) markHarnessProcessExit(pid, null)
|
|
157
|
+
}
|
|
158
|
+
for (const [id, p] of this.pendingPermissions) {
|
|
159
|
+
if (p.timer) clearTimeout(p.timer)
|
|
160
|
+
this.pendingPermissions.delete(id)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
getProcessInfo(): { pid: number, alive: boolean, command: string } | null {
|
|
165
|
+
const client = this.client
|
|
166
|
+
const pid = client?.pid
|
|
167
|
+
if (!pid || !client) return null
|
|
168
|
+
return { pid, alive: client.alive, command: 'dsh --profile acp' }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
killProcess(): void {
|
|
172
|
+
const pid = this.client?.pid
|
|
173
|
+
if (pid) killHarnessProcess(pid)
|
|
174
|
+
else this.client?.kill()
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
reconcileProcess(): void {
|
|
178
|
+
this.client?.reconcile()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
dispatchHostTool(toolName: string, args: Record<string, unknown>): Promise<{ text: string, isError?: boolean }> {
|
|
182
|
+
return dispatchHostTool(this.bridgeCtx, { toolName, arguments: args })
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
getContextStats(): AgentContextStats | null {
|
|
186
|
+
if (!this.lastUsage) return null
|
|
187
|
+
const window = this.config.contextWindow ?? 1_000_000
|
|
188
|
+
return {
|
|
189
|
+
usedTokens: this.lastUsage.input,
|
|
190
|
+
contextWindow: window,
|
|
191
|
+
percent: window > 0 ? Math.min(1, this.lastUsage.input / window) : null,
|
|
192
|
+
compacting: false, // 压缩由引擎原生驱动,平台无主动 compact 面
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** ACP 无同轮注入:恒 'deferred'(消息保持 pending,消费循环处理;能力面如实声明) */
|
|
197
|
+
async steer(_text: string): Promise<'steer' | 'deferred'> {
|
|
198
|
+
return 'deferred'
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** HITL 应答:session/request_permission → allow/reject/cancelled(fail-closed) */
|
|
202
|
+
async respondHitl(kind: string, id: string, outcome: {
|
|
203
|
+
confirmed?: boolean
|
|
204
|
+
cancelled?: boolean
|
|
205
|
+
value?: string
|
|
206
|
+
response?: string
|
|
207
|
+
comment?: string
|
|
208
|
+
}): Promise<void> {
|
|
209
|
+
if (kind !== 'dsh-permission') return
|
|
210
|
+
const pending = this.pendingPermissions.get(id)
|
|
211
|
+
if (!pending) throw new Error(`待办不存在或已处理: ${id}`)
|
|
212
|
+
const client = this.client
|
|
213
|
+
if (!client) throw new Error('dsh 会话已关闭')
|
|
214
|
+
let result: Record<string, unknown>
|
|
215
|
+
if (outcome.cancelled === true) {
|
|
216
|
+
result = { outcome: { outcome: 'cancelled' } }
|
|
217
|
+
}
|
|
218
|
+
else if (outcome.confirmed === true) {
|
|
219
|
+
// 选第一个 allow 语义选项(kind: allow_once/allow_always 或 name 含 allow)
|
|
220
|
+
const allow = pending.options.find(o => String(o.kind ?? '').startsWith('allow') || /allow/i.test(String(o.name ?? '')))
|
|
221
|
+
if (!allow) {
|
|
222
|
+
client.respondError(pending.rpcId, -32602, '无可用 allow 选项')
|
|
223
|
+
this.clearPending(id, 'cancelled')
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
result = { outcome: { outcome: 'selected', optionId: allow.optionId } }
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
const reject = pending.options.find(o => String(o.kind ?? '').startsWith('reject') || /reject|deny/i.test(String(o.name ?? '')))
|
|
230
|
+
if (reject) {
|
|
231
|
+
result = { outcome: { outcome: 'selected', optionId: reject.optionId } }
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
client.respondError(pending.rpcId, -32602, '已拒绝')
|
|
235
|
+
this.clearPending(id, 'cancelled')
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
client.respond(pending.rpcId, result)
|
|
240
|
+
this.clearPending(id, outcome.cancelled === true ? 'cancelled' : 'answered')
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private clearPending(id: string, resolution: 'answered' | 'cancelled' | 'expired'): void {
|
|
244
|
+
const p = this.pendingPermissions.get(id)
|
|
245
|
+
if (p?.timer) clearTimeout(p.timer)
|
|
246
|
+
this.pendingPermissions.delete(id)
|
|
247
|
+
getHitlRegistry().resolve('dsh-permission', id, resolution)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ===== run / supervise =====
|
|
251
|
+
|
|
252
|
+
async* run(request: AgentRunRequest, ctx: AgentRunContext): AsyncIterable<AgentEvent> {
|
|
253
|
+
const kind = request.message.metadata?.['x-aw-task-kind']
|
|
254
|
+
if (kind === 'assign' && ctx.role === 'worker') {
|
|
255
|
+
yield* this.workerRun(request, ctx)
|
|
256
|
+
return
|
|
257
|
+
}
|
|
258
|
+
if (!kind && (request.fromAgentId || request.message.metadata?.['x-aw-from-label'])) {
|
|
259
|
+
yield* this.peerMessageRun(request, ctx)
|
|
260
|
+
return
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private supervising = false
|
|
265
|
+
|
|
266
|
+
async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
|
|
267
|
+
await this.ensureClient(ctx)
|
|
268
|
+
if (!this.client || !this.sessionId) return []
|
|
269
|
+
if (this.supervising) return []
|
|
270
|
+
const prompt = supervisePrompt({
|
|
271
|
+
snapshot,
|
|
272
|
+
agentName: this.agentName,
|
|
273
|
+
channelId: this.channelId,
|
|
274
|
+
ctxPrefix: await this.contextPrefix(),
|
|
275
|
+
manual: systemManual(),
|
|
276
|
+
memory: ctx.memory,
|
|
277
|
+
})
|
|
278
|
+
this.supervising = true
|
|
279
|
+
try {
|
|
280
|
+
const events = await this.collectTurn(prompt, this.config.superviseTimeoutMs ?? 150_000, opts?.signal)
|
|
281
|
+
let text = ''
|
|
282
|
+
for (const e of events) {
|
|
283
|
+
if (e.kind === 'artifact') {
|
|
284
|
+
text += e.artifact.parts.map(p => 'text' in p ? p.text : '').join('')
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const parsed = extractJsonArray(text)
|
|
288
|
+
return parsed && parsed.length > 0 ? parsed as SupervisionDecision[] : []
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
return []
|
|
292
|
+
}
|
|
293
|
+
finally {
|
|
294
|
+
this.supervising = false
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private async* workerRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
|
|
299
|
+
const taskId = request.taskId ?? (request.message.metadata?.['x-aw-task-id'] as string | undefined)
|
|
300
|
+
if (!taskId) return
|
|
301
|
+
this.toolState.currentTaskId = taskId
|
|
302
|
+
try {
|
|
303
|
+
await this.ensureClient(ctx)
|
|
304
|
+
const taskText = request.message.parts.map((p) => {
|
|
305
|
+
if ('text' in p) return p.text
|
|
306
|
+
if ('data' in p) return JSON.stringify(p.data)
|
|
307
|
+
if ('url' in p) return p.url
|
|
308
|
+
if ('raw' in p) return p.raw
|
|
309
|
+
return ''
|
|
310
|
+
}).join('\n')
|
|
311
|
+
const prompt = workerPrompt({
|
|
312
|
+
agentName: this.agentName,
|
|
313
|
+
channelId: this.channelId,
|
|
314
|
+
taskId,
|
|
315
|
+
taskText,
|
|
316
|
+
memory: request.memory,
|
|
317
|
+
ctxPrefix: await this.contextPrefix(),
|
|
318
|
+
manual: systemManual(),
|
|
319
|
+
})
|
|
320
|
+
yield* this.streamTurn(prompt, taskId, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
|
|
321
|
+
}
|
|
322
|
+
finally {
|
|
323
|
+
this.toolState.currentTaskId = null
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
private async* peerMessageRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
|
|
328
|
+
await this.ensureClient(ctx)
|
|
329
|
+
const msg = request.message
|
|
330
|
+
const fromId = request.fromAgentId
|
|
331
|
+
?? (typeof msg.metadata?.['x-aw-from-label'] === 'string' ? msg.metadata['x-aw-from-label'] : undefined)
|
|
332
|
+
?? 'unknown'
|
|
333
|
+
const requireReply = msg.metadata?.['x-aw-require-reply'] === 'true'
|
|
334
|
+
const crossChannel = msg.metadata?.['x-aw-cross-channel'] === 'true'
|
|
335
|
+
this.toolState.replyContext = requireReply && request.fromAgentId && !crossChannel
|
|
336
|
+
? { fromId: request.fromAgentId, messageId: msg.messageId }
|
|
337
|
+
: null
|
|
338
|
+
const msgText = msg.parts.map((p) => {
|
|
339
|
+
if ('text' in p) return p.text
|
|
340
|
+
if ('data' in p) return JSON.stringify(p.data)
|
|
341
|
+
if ('url' in p) return p.url
|
|
342
|
+
if ('raw' in p) return p.raw
|
|
343
|
+
return ''
|
|
344
|
+
}).join('\n')
|
|
345
|
+
const prompt = peerPrompt({
|
|
346
|
+
agentName: this.agentName,
|
|
347
|
+
role: this.agentRole,
|
|
348
|
+
channelId: this.channelId,
|
|
349
|
+
ctxPrefix: await this.contextPrefix(),
|
|
350
|
+
manual: systemManual(),
|
|
351
|
+
memory: request.memory,
|
|
352
|
+
fromId,
|
|
353
|
+
messageId: msg.messageId,
|
|
354
|
+
requireReply,
|
|
355
|
+
isReply: typeof msg.metadata?.['x-aw-in-reply-to'] === 'string',
|
|
356
|
+
crossChannel,
|
|
357
|
+
fromChannel: typeof msg.metadata?.['x-aw-from-channel'] === 'string' ? String(msg.metadata['x-aw-from-channel']) : '',
|
|
358
|
+
msgText,
|
|
359
|
+
})
|
|
360
|
+
yield* this.streamTurn(prompt, undefined, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
private async contextPrefix(): Promise<string> {
|
|
364
|
+
return buildContextPrefix({
|
|
365
|
+
scenarioPrompt: this.config.scenarioPrompt,
|
|
366
|
+
systemPromptPrefix: this.config.systemPromptPrefix,
|
|
367
|
+
agentId: this.selfAgentId,
|
|
368
|
+
roster: await this.roster.roster(),
|
|
369
|
+
})
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// ===== 回合执行 =====
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* ACP 回合:session/prompt(响应在回合终点返回)+ session/update 通知流。
|
|
376
|
+
* 通知由 client 级 handler 转 turnSettlers;abort → session/cancel 通知。
|
|
377
|
+
*/
|
|
378
|
+
private async* streamTurn(prompt: string, taskId: string | undefined, timeoutMs: number, signal?: AbortSignal): AsyncGenerator<AgentEvent, void, unknown> {
|
|
379
|
+
const client = this.client
|
|
380
|
+
if (!client || !this.sessionId) {
|
|
381
|
+
yield { kind: 'error', error: { code: 'DSH_NOT_READY', message: 'dsh 会话未就绪' } }
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
if (this.turnActive) {
|
|
385
|
+
// 单飞约束:上一回合未收口(理论不可达,run/supervise 互斥在上层保证)
|
|
386
|
+
yield { kind: 'error', error: { code: 'DSH_TURN_BUSY', message: 'dsh 上一回合尚未收口' } }
|
|
387
|
+
return
|
|
388
|
+
}
|
|
389
|
+
this.turnActive = true
|
|
390
|
+
const queue: AgentEvent[] = []
|
|
391
|
+
let isDone = false
|
|
392
|
+
let resolveWait: (() => void) | null = null
|
|
393
|
+
let lastActivity = Date.now()
|
|
394
|
+
let agentText = ''
|
|
395
|
+
|
|
396
|
+
const enqueue = (e: AgentEvent): void => {
|
|
397
|
+
if (e.kind === 'done' && !isDone) {
|
|
398
|
+
if (agentText.trim()) {
|
|
399
|
+
queue.push({
|
|
400
|
+
kind: 'artifact',
|
|
401
|
+
artifact: { artifactId: randomUUID(), name: 'output', parts: [{ text: agentText.trim() }] },
|
|
402
|
+
lastChunk: true,
|
|
403
|
+
totalChunks: 1,
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
this.turnActive = false
|
|
407
|
+
}
|
|
408
|
+
if (e.kind === 'done' || e.kind === 'error') {
|
|
409
|
+
isDone = true
|
|
410
|
+
this.turnActive = false
|
|
411
|
+
}
|
|
412
|
+
queue.push(e)
|
|
413
|
+
lastActivity = Date.now()
|
|
414
|
+
resolveWait?.()
|
|
415
|
+
resolveWait = null
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// 引擎事件 → 队列(session/update 映射)
|
|
419
|
+
const pushUpdate = (params: unknown): void => {
|
|
420
|
+
lastActivity = Date.now()
|
|
421
|
+
const p = (params ?? {}) as Record<string, unknown>
|
|
422
|
+
const sid = p.sessionId ?? p.sessionID
|
|
423
|
+
if (sid && sid !== this.sessionId) return
|
|
424
|
+
const update = (p.update ?? p) as Record<string, unknown>
|
|
425
|
+
const kind = String(update.sessionUpdate ?? update.kind ?? update.type ?? '')
|
|
426
|
+
const now = new Date().toISOString()
|
|
427
|
+
const statusEvent = (text: string): void => {
|
|
428
|
+
enqueue({
|
|
429
|
+
kind: 'status',
|
|
430
|
+
status: {
|
|
431
|
+
state: 'WORKING',
|
|
432
|
+
message: { messageId: randomUUID(), contextId: this.channelId, role: 'ROLE_AGENT', parts: [{ text }] },
|
|
433
|
+
timestamp: now,
|
|
434
|
+
},
|
|
435
|
+
})
|
|
436
|
+
}
|
|
437
|
+
if (kind === 'agent_message_chunk' || kind === 'agentMessageChunk') {
|
|
438
|
+
const content = (update.content ?? {}) as Record<string, unknown>
|
|
439
|
+
const text = typeof content.text === 'string' ? content.text : ''
|
|
440
|
+
if (text) {
|
|
441
|
+
agentText += text
|
|
442
|
+
enqueue({ kind: 'delta', delta: { text } })
|
|
443
|
+
}
|
|
444
|
+
return
|
|
445
|
+
}
|
|
446
|
+
if (kind === 'tool_call' || kind === 'toolCall') {
|
|
447
|
+
statusEvent(`🔧 ${String(update.title ?? update.toolName ?? 'tool')}${toolArgsPreview(update.rawInput ?? update.arguments)}`)
|
|
448
|
+
return
|
|
449
|
+
}
|
|
450
|
+
if (kind === 'tool_call_update' || kind === 'toolCallUpdate') {
|
|
451
|
+
const status = String(update.status ?? '')
|
|
452
|
+
if (status === 'failed' || status === 'error') {
|
|
453
|
+
statusEvent(`🔧 ${String(update.title ?? 'tool')} 失败`)
|
|
454
|
+
}
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
// contextUsage / config / 其他通知:仅刷新活动时间
|
|
458
|
+
const usage = (p.contextUsage ?? update.contextUsage ?? update.usage) as Record<string, unknown> | undefined
|
|
459
|
+
if (usage) {
|
|
460
|
+
const input = Number(usage.usedTokens ?? usage.inputTokens ?? usage.input ?? usage.totalTokens)
|
|
461
|
+
if (Number.isFinite(input) && input > 0) this.lastUsage = { input, at: Date.now() }
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const unsub = client.onNotification((method, params) => {
|
|
466
|
+
if (method === DSH_ACP_METHODS.sessionUpdate) pushUpdate(params)
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
// abort:session/cancel 通知 → 引擎终结 prompt(响应 stopReason=cancelled)
|
|
470
|
+
const onAbort = (): void => {
|
|
471
|
+
log.warn(`[DshAgent:${this.selfAgentId}] run 被 abort → session/cancel,taskId=${taskId ?? '-'}`)
|
|
472
|
+
client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
|
|
473
|
+
setTimeout(() => {
|
|
474
|
+
if (!isDone) enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
|
|
475
|
+
}, 5000)
|
|
476
|
+
}
|
|
477
|
+
if (signal?.aborted) onAbort()
|
|
478
|
+
else signal?.addEventListener('abort', onAbort, { once: true })
|
|
479
|
+
|
|
480
|
+
// 投递 prompt(响应在回合终点返回 → 异步挂接,回合内事件由生成器边到边 yield)
|
|
481
|
+
void client.request(DSH_ACP_METHODS.sessionPrompt, {
|
|
482
|
+
sessionId: this.sessionId,
|
|
483
|
+
prompt: [{ type: 'text', text: prompt }],
|
|
484
|
+
}, timeoutMs + 30_000)
|
|
485
|
+
.then((result) => {
|
|
486
|
+
const stopReason = String((result as Record<string, unknown>)?.stopReason ?? 'end_turn')
|
|
487
|
+
if (stopReason === 'refusal') {
|
|
488
|
+
enqueue({ kind: 'error', error: { code: 'DSH_REFUSAL', message: 'dsh 回合被引擎拒绝(refusal)' } })
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
// end_turn / cancelled / 其他:中断按 done 收口(消息按已处理落账)
|
|
492
|
+
enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
|
|
493
|
+
}
|
|
494
|
+
})
|
|
495
|
+
.catch((err: unknown) => {
|
|
496
|
+
enqueue({
|
|
497
|
+
kind: 'error',
|
|
498
|
+
error: {
|
|
499
|
+
code: 'DSH_PROMPT_FAILED',
|
|
500
|
+
message: `dsh session/prompt 失败: ${err instanceof Error ? err.message : String(err)}`,
|
|
501
|
+
},
|
|
502
|
+
})
|
|
503
|
+
})
|
|
504
|
+
|
|
505
|
+
try {
|
|
506
|
+
while (!isDone || queue.length > 0) {
|
|
507
|
+
if (queue.length === 0 && !isDone) {
|
|
508
|
+
const remaining = timeoutMs - (Date.now() - lastActivity)
|
|
509
|
+
if (remaining <= 0) {
|
|
510
|
+
client.notify(DSH_ACP_METHODS.sessionCancel, { sessionId: this.sessionId })
|
|
511
|
+
enqueue({
|
|
512
|
+
kind: 'error',
|
|
513
|
+
error: { code: 'DSH_TURN_STALLED', message: `回合停滞 ${Math.round(timeoutMs / 1000)}s 无事件,已取消` },
|
|
514
|
+
})
|
|
515
|
+
continue
|
|
516
|
+
}
|
|
517
|
+
await new Promise<void>((r) => {
|
|
518
|
+
resolveWait = r
|
|
519
|
+
setTimeout(() => {
|
|
520
|
+
resolveWait = null
|
|
521
|
+
r()
|
|
522
|
+
}, remaining + 100)
|
|
523
|
+
})
|
|
524
|
+
}
|
|
525
|
+
while (queue.length > 0) {
|
|
526
|
+
yield queue.shift()!
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
finally {
|
|
531
|
+
unsub()
|
|
532
|
+
signal?.removeEventListener('abort', onAbort)
|
|
533
|
+
this.turnActive = false
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** supervise 用:收齐整个回合 */
|
|
538
|
+
private async collectTurn(prompt: string, timeoutMs: number, signal?: AbortSignal): Promise<AgentEvent[]> {
|
|
539
|
+
const events: AgentEvent[] = []
|
|
540
|
+
for await (const e of this.streamTurn(prompt, undefined, timeoutMs, signal)) {
|
|
541
|
+
events.push(e)
|
|
542
|
+
if (e.kind === 'error') break
|
|
543
|
+
}
|
|
544
|
+
return events
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// ===== 客户端管理 =====
|
|
548
|
+
|
|
549
|
+
private async ensureClient(ctx: AgentRunContext): Promise<void> {
|
|
550
|
+
if (!this.workspace) this.workspace = ctx.workspace
|
|
551
|
+
if (!this.agentInfo) {
|
|
552
|
+
this.channelId = ctx.channelId
|
|
553
|
+
this.agentRole = ctx.role
|
|
554
|
+
this.refreshIdentity()
|
|
555
|
+
}
|
|
556
|
+
if (this.client?.alive && this.sessionId) return
|
|
557
|
+
if (this.client && !this.client.alive) {
|
|
558
|
+
this.client = null
|
|
559
|
+
this.sessionId = null
|
|
560
|
+
}
|
|
561
|
+
this.clientStarting ??= this.startClient().finally(() => {
|
|
562
|
+
this.clientStarting = null
|
|
563
|
+
})
|
|
564
|
+
await this.clientStarting
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
private async startClient(): Promise<void> {
|
|
568
|
+
const command = this.config.command ?? harnessSettings().dsh_command
|
|
569
|
+
const env = generateMcpBridgeEnv({
|
|
570
|
+
agentId: this.selfAgentId,
|
|
571
|
+
token: this.config.token,
|
|
572
|
+
baseUrl: this.config.baseUrl,
|
|
573
|
+
bridgePath: this.config.mcpBridgePath,
|
|
574
|
+
extra: {
|
|
575
|
+
// 桥身份随进程环境注入:profile 级 mcp-client(patch 层)经 !!js 读取;
|
|
576
|
+
// 此 dsh 版本 session/new 不支持 mcpServers 参数,挂载走 profile 配置。
|
|
577
|
+
...generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgeEnv,
|
|
578
|
+
AW_BRIDGE_PATH: generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath }).bridgePath,
|
|
579
|
+
// provider/model 经环境传给 profile patch(!!js 读取):channel/agent config 驱动
|
|
580
|
+
...(this.config.provider ? { AW_ACP_PROVIDER: this.config.provider } : {}),
|
|
581
|
+
...(this.config.model ? { AW_ACP_MODEL: this.config.model } : {}),
|
|
582
|
+
...(this.config.dshHome ? { DSH_HOME: this.config.dshHome } : {}),
|
|
583
|
+
...(this.config.apiKey ? { DEEPSEEK_API_KEY: this.config.apiKey } : {}),
|
|
584
|
+
},
|
|
585
|
+
})
|
|
586
|
+
const client = new StdioJsonRpcClient({
|
|
587
|
+
name: 'dsh',
|
|
588
|
+
command,
|
|
589
|
+
args: this.config.args ?? ['--profile', 'acp'],
|
|
590
|
+
cwd: this.config.cwd ?? process.cwd(),
|
|
591
|
+
env: env.engineEnv,
|
|
592
|
+
requestTimeoutMs: 60_000,
|
|
593
|
+
})
|
|
594
|
+
const pidRef = { pid: undefined as number | undefined }
|
|
595
|
+
client.onExit((code) => {
|
|
596
|
+
if (pidRef.pid) markHarnessProcessExit(pidRef.pid, code)
|
|
597
|
+
this.sessionId = null
|
|
598
|
+
log.warn(`[DshAgent:${this.selfAgentId}] dsh acp 进程退出(code=${code});下回合自动重生`)
|
|
599
|
+
})
|
|
600
|
+
await client.start()
|
|
601
|
+
pidRef.pid = client.pid
|
|
602
|
+
if (client.pid) {
|
|
603
|
+
registerHarnessProcess(client.pid, { harness: 'dsh', command, args: ['--profile', 'acp'] })
|
|
604
|
+
bindHarnessProcess(client.pid, { agentId: this.selfAgentId, channelId: this.channelId, name: this.agentName, role: this.agentRole })
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// 服务端→客户端请求(权限)→ HITL
|
|
608
|
+
client.onRequest((req: JsonRpcRequestIncoming) => {
|
|
609
|
+
if (req.method === DSH_ACP_METHODS.requestPermission) {
|
|
610
|
+
this.registerPermissionHitl(req)
|
|
611
|
+
return
|
|
612
|
+
}
|
|
613
|
+
client.respondError(req.id, -32601, `方法不存在: ${req.method}`)
|
|
614
|
+
})
|
|
615
|
+
|
|
616
|
+
// ACP 握手
|
|
617
|
+
await client.request(DSH_ACP_METHODS.initialize, {
|
|
618
|
+
protocolVersion: 1,
|
|
619
|
+
clientCapabilities: {},
|
|
620
|
+
}, 30_000).catch(async (err: Error) => {
|
|
621
|
+
// 协议版本协商失败 → 显式版本重试一次
|
|
622
|
+
await client.request(DSH_ACP_METHODS.initialize, { protocolVersion: '2025-06-01', clientCapabilities: {} }, 30_000)
|
|
623
|
+
.catch(() => { throw err })
|
|
624
|
+
})
|
|
625
|
+
|
|
626
|
+
// 建会话(此版本不接受自定义 mcpServers;工具经 profile 级 mcp-client 挂载;
|
|
627
|
+
// ACP schema 要求 mcpServers 字段存在,传空数组)
|
|
628
|
+
const created = await client.request(DSH_ACP_METHODS.sessionNew, {
|
|
629
|
+
cwd: this.config.cwd ?? process.cwd(),
|
|
630
|
+
mcpServers: [],
|
|
631
|
+
}, 60_000) as Record<string, unknown>
|
|
632
|
+
const sid = created?.sessionId ?? created?.id
|
|
633
|
+
this.sessionId = typeof sid === 'string' ? sid : null
|
|
634
|
+
if (!this.sessionId) throw new Error('dsh session/new 未返回 sessionId')
|
|
635
|
+
|
|
636
|
+
this.client = client
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
private registerPermissionHitl(req: JsonRpcRequestIncoming): void {
|
|
640
|
+
const client = this.client
|
|
641
|
+
if (!client) return
|
|
642
|
+
const p = (req.params ?? {}) as Record<string, unknown>
|
|
643
|
+
const options = Array.isArray(p.options) ? p.options as Array<Record<string, unknown>> : []
|
|
644
|
+
const toolCall = (p.toolCall ?? {}) as Record<string, unknown>
|
|
645
|
+
const id = `dsh-${randomUUID().slice(0, 8)}`
|
|
646
|
+
const registry = getHitlRegistry()
|
|
647
|
+
registry.register({
|
|
648
|
+
kind: 'dsh-permission',
|
|
649
|
+
id,
|
|
650
|
+
agentId: this.selfAgentId,
|
|
651
|
+
agentName: this.agentName,
|
|
652
|
+
channelId: this.channelId,
|
|
653
|
+
pid: client.pid,
|
|
654
|
+
method: 'confirm',
|
|
655
|
+
title: `dsh 权限请求:${String(toolCall.title ?? toolCall.toolName ?? p.toolName ?? '操作').slice(0, 200)}`,
|
|
656
|
+
detail: String(toolCall.kind ?? p.kind ?? ''),
|
|
657
|
+
options: options.map(o => String(o.name ?? o.optionId ?? '')),
|
|
658
|
+
createdAt: new Date().toISOString(),
|
|
659
|
+
expiresAt: null,
|
|
660
|
+
})
|
|
661
|
+
const timeoutMs = harnessSettings().hitl_timeout_ms
|
|
662
|
+
const timer = timeoutMs > 0
|
|
663
|
+
? setTimeout(() => {
|
|
664
|
+
// fail-closed:超时按拒绝应答(引擎默认语义)
|
|
665
|
+
void this.respondHitl('dsh-permission', id, { confirmed: false }).catch(() => {})
|
|
666
|
+
}, timeoutMs)
|
|
667
|
+
: null
|
|
668
|
+
this.pendingPermissions.set(id, { rpcId: req.id, options, timer })
|
|
669
|
+
}
|
|
670
|
+
}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent 实现工厂 — 按 harness 装配 AgentInterface。
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* 全部引擎注册于 HARNESS_REGISTRY(registry.ts,单一事实源);
|
|
4
|
+
* 未知 harness 抛 UNKNOWN_HARNESS。
|
|
5
5
|
* 权威契约见 docs/superpowers/plans/2026-08-13-agent-workshop-multi-agent.md 核心契约块 T5。
|
|
6
6
|
*/
|
|
7
|
-
import { AppError } from '../../../utils/errors'
|
|
8
7
|
import type { AgentInfo, AgentInterface } from './agent-interface'
|
|
9
|
-
import {
|
|
10
|
-
import { OmpRpcAgentImpl } from './omp-agent'
|
|
11
|
-
import { ClaudeSdkAgentImpl } from './claude-agent'
|
|
8
|
+
import { createAgentImplByHarness } from './registry'
|
|
12
9
|
|
|
13
10
|
export function createAgentImpl(agent: AgentInfo): AgentInterface {
|
|
14
|
-
|
|
15
|
-
case 'mock':
|
|
16
|
-
return new MockAgentImpl(agent.config)
|
|
17
|
-
case 'omp':
|
|
18
|
-
return new OmpRpcAgentImpl({ ...agent.config, agentId: agent.id, name: agent.name, role: agent.role, channelId: agent.channelId })
|
|
19
|
-
case 'claude':
|
|
20
|
-
return new ClaudeSdkAgentImpl(agent.config)
|
|
21
|
-
default:
|
|
22
|
-
throw new AppError(400, 'UNKNOWN_HARNESS', `未知 harness: ${agent.harness}`)
|
|
23
|
-
}
|
|
11
|
+
return createAgentImplByHarness(agent)
|
|
24
12
|
}
|