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,822 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodexAgentImpl — OpenAI Codex CLI(app-server)harness 的 AgentInterface 实现。
|
|
3
|
+
*
|
|
4
|
+
* 进程模型:每 Agent 一个 `codex app-server` 子进程(stdio NDJSON JSON-RPC v2,
|
|
5
|
+
* lazy spawn 跨消息复用);thread/start 建会话,turn/start 驱动回合。
|
|
6
|
+
*
|
|
7
|
+
* - prompt/工具面与 omp 全引擎同源(prompt-builder / host-tool-bridge);
|
|
8
|
+
* 工具经 stdio MCP 桥注入(config.toml 由 impl 装配 [mcp_servers.aw])
|
|
9
|
+
* - 事件映射:item/agentMessage/delta → delta;item/started → 🔧 status;
|
|
10
|
+
* turn/completed → artifact + done / error(codexErrorInfo 结构化)
|
|
11
|
+
* - HITL:item/commandExecution|fileChange/requestApproval(server→client 请求)
|
|
12
|
+
* → hitl-registry 登记 → respondHitl 应答(decision: accept/decline/cancel)
|
|
13
|
+
* - steer:turn 运行中 → turn/steer;无 active turn → 'deferred'
|
|
14
|
+
* - 上下文治理:thread/tokenUsage/updated 被动跟踪;越阈值 → thread/compact/start
|
|
15
|
+
*
|
|
16
|
+
* 协议权威:github.com/openai/codex codex-rs/app-server/README.md(v0.149 实测)。
|
|
17
|
+
*/
|
|
18
|
+
import { createLogger } from '../logger'
|
|
19
|
+
import { randomUUID } from 'node:crypto'
|
|
20
|
+
import { join } from 'node:path'
|
|
21
|
+
import { mkdirSync, writeFileSync, existsSync, readFileSync, copyFileSync } from 'node:fs'
|
|
22
|
+
import { tmpdir } from 'node:os'
|
|
23
|
+
import type {
|
|
24
|
+
AgentEvent,
|
|
25
|
+
AgentInterface,
|
|
26
|
+
AgentInfo,
|
|
27
|
+
AgentRunContext,
|
|
28
|
+
AgentRunRequest,
|
|
29
|
+
SupervisionDecision,
|
|
30
|
+
SupervisionSnapshot,
|
|
31
|
+
} from './agent-interface'
|
|
32
|
+
import type { AgentContextStats } from '../types/task'
|
|
33
|
+
import { registerHarnessProcess, bindHarnessProcess, markHarnessProcessExit, killHarnessProcess } from './harness-process'
|
|
34
|
+
import { createSessionState, dispatchHostTool } from './host-tool-bridge'
|
|
35
|
+
import {
|
|
36
|
+
contextPrefix as buildContextPrefix,
|
|
37
|
+
createRosterCache,
|
|
38
|
+
extractJsonArray,
|
|
39
|
+
peerPrompt,
|
|
40
|
+
supervisePrompt,
|
|
41
|
+
systemManual,
|
|
42
|
+
toolArgsPreview,
|
|
43
|
+
workerPrompt,
|
|
44
|
+
} from './prompt-builder'
|
|
45
|
+
import { getHitlRegistry } from './hitl-registry'
|
|
46
|
+
import { harnessSettings } from '../settings'
|
|
47
|
+
import { StdioJsonRpcClient } from './adapters/stdio-jsonrpc'
|
|
48
|
+
import { generateMcpBridgeEnv } from './harness-env'
|
|
49
|
+
|
|
50
|
+
const log = createLogger('workshop.codex')
|
|
51
|
+
|
|
52
|
+
export interface CodexAgentConfig {
|
|
53
|
+
/** codex 可执行文件(默认取 harness.codex_command 设置) */
|
|
54
|
+
command?: string
|
|
55
|
+
/** 额外 CLI 参数(app-server 之前) */
|
|
56
|
+
args?: string[]
|
|
57
|
+
cwd?: string
|
|
58
|
+
/** 模型(如 gpt-5.2) */
|
|
59
|
+
model?: string
|
|
60
|
+
/** 审批策略(默认 on-request:沙箱内自由,越界请求审批 → HITL) */
|
|
61
|
+
approvalPolicy?: 'untrusted' | 'on-request' | 'never'
|
|
62
|
+
/** 沙箱(默认 workspace-write) */
|
|
63
|
+
sandbox?: 'read-only' | 'workspace-write' | 'danger-full-access'
|
|
64
|
+
/** CODEX_HOME(缺省进程环境;配置隔离/多账户时按 agent 指定;effort 未指定 home 时自动种子化) */
|
|
65
|
+
codexHome?: string
|
|
66
|
+
/** 思考 effort(model_reasoning_effort;需 CODEX_HOME 配置面,未指定 home 时自动种子化) */
|
|
67
|
+
effort?: string
|
|
68
|
+
/** 上下文窗口(usage 百分比计算) */
|
|
69
|
+
contextWindow?: number
|
|
70
|
+
/** 压缩阈值(0-1,默认 0.7) */
|
|
71
|
+
compactThreshold?: number
|
|
72
|
+
promptTimeoutMs?: number
|
|
73
|
+
superviseTimeoutMs?: number
|
|
74
|
+
systemPromptPrefix?: string
|
|
75
|
+
scenarioPrompt?: string
|
|
76
|
+
agentId?: string
|
|
77
|
+
name?: string
|
|
78
|
+
role?: 'lead' | 'worker'
|
|
79
|
+
channelId?: string
|
|
80
|
+
token?: string
|
|
81
|
+
baseUrl?: string
|
|
82
|
+
mcpBridgePath?: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class CodexAgentImpl implements AgentInterface {
|
|
86
|
+
private readonly config: CodexAgentConfig
|
|
87
|
+
private workspace: AgentRunContext['workspace'] | null = null
|
|
88
|
+
private agentInfo: AgentInfo | null = null
|
|
89
|
+
private readonly toolState = createSessionState()
|
|
90
|
+
private readonly bridgeCtx = {
|
|
91
|
+
identity: { agentId: '', channelId: '', role: 'worker' as 'lead' | 'worker', name: 'agent' },
|
|
92
|
+
state: this.toolState,
|
|
93
|
+
getWorkspace: () => this.workspace,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private roster = createRosterCache({ selfAgentId: '', listAgents: async () => [] })
|
|
97
|
+
|
|
98
|
+
private selfAgentId = ''
|
|
99
|
+
private agentName = 'agent'
|
|
100
|
+
private agentRole: 'lead' | 'worker' = 'worker'
|
|
101
|
+
private channelId = ''
|
|
102
|
+
|
|
103
|
+
private client: StdioJsonRpcClient | null = null
|
|
104
|
+
private clientStarting: Promise<void> | null = null
|
|
105
|
+
private threadId: string | null = null
|
|
106
|
+
private turnId: string | null = null
|
|
107
|
+
|
|
108
|
+
// 回合状态
|
|
109
|
+
private turnActive = false
|
|
110
|
+
private deltaBuf = ''
|
|
111
|
+
private deltaTimer: ReturnType<typeof setTimeout> | null = null
|
|
112
|
+
private lastUsage: { input: number, at: number } | null = null
|
|
113
|
+
private compacting = false
|
|
114
|
+
private lastCompactAt = 0
|
|
115
|
+
/** 待应答审批(approval request id → JSON-RPC id) */
|
|
116
|
+
private pendingApprovals = new Map<string, { rpcId: string | number, timer: ReturnType<typeof setTimeout> | null }>()
|
|
117
|
+
|
|
118
|
+
constructor(config: Record<string, unknown> = {}) {
|
|
119
|
+
this.config = config as CodexAgentConfig
|
|
120
|
+
this.selfAgentId = this.config.agentId ?? ''
|
|
121
|
+
this.agentName = this.config.name ?? 'agent'
|
|
122
|
+
this.agentRole = this.config.role ?? 'worker'
|
|
123
|
+
this.channelId = this.config.channelId ?? ''
|
|
124
|
+
this.refreshIdentity()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private refreshIdentity(): void {
|
|
128
|
+
this.bridgeCtx.identity = { agentId: this.selfAgentId, channelId: this.channelId, role: this.agentRole, name: this.agentName }
|
|
129
|
+
this.roster = createRosterCache({
|
|
130
|
+
selfAgentId: this.selfAgentId,
|
|
131
|
+
listAgents: async () => this.workspace?.listAgents() ?? [],
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async init(input: { agent: AgentInfo, channelId: string }): Promise<void> {
|
|
136
|
+
this.agentInfo = input.agent
|
|
137
|
+
this.channelId = input.channelId
|
|
138
|
+
this.agentName = input.agent.name
|
|
139
|
+
this.agentRole = input.agent.role
|
|
140
|
+
this.selfAgentId = input.agent.id
|
|
141
|
+
this.refreshIdentity()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async dispose(): Promise<void> {
|
|
145
|
+
const client = this.client
|
|
146
|
+
this.client = null
|
|
147
|
+
this.threadId = null
|
|
148
|
+
if (client) {
|
|
149
|
+
const pid = client.pid
|
|
150
|
+
await client.dispose().catch(() => {})
|
|
151
|
+
if (pid) markHarnessProcessExit(pid, null)
|
|
152
|
+
}
|
|
153
|
+
for (const [id, p] of this.pendingApprovals) {
|
|
154
|
+
if (p.timer) clearTimeout(p.timer)
|
|
155
|
+
this.pendingApprovals.delete(id)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
getProcessInfo(): { pid: number, alive: boolean, command: string } | null {
|
|
160
|
+
const client = this.client
|
|
161
|
+
const pid = client?.pid
|
|
162
|
+
if (!pid || !client) return null
|
|
163
|
+
return { pid, alive: client.alive, command: 'codex app-server' }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
killProcess(): void {
|
|
167
|
+
const pid = this.client?.pid
|
|
168
|
+
if (pid) killHarnessProcess(pid)
|
|
169
|
+
else this.client?.kill()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
reconcileProcess(): void {
|
|
173
|
+
this.client?.reconcile()
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
dispatchHostTool(toolName: string, args: Record<string, unknown>): Promise<{ text: string, isError?: boolean }> {
|
|
177
|
+
return dispatchHostTool(this.bridgeCtx, { toolName, arguments: args })
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
getContextStats(): AgentContextStats | null {
|
|
181
|
+
if (!this.lastUsage) return null
|
|
182
|
+
const window = this.config.contextWindow ?? null
|
|
183
|
+
return {
|
|
184
|
+
usedTokens: this.lastUsage.input,
|
|
185
|
+
contextWindow: window,
|
|
186
|
+
percent: window && window > 0 ? Math.min(1, this.lastUsage.input / window) : null,
|
|
187
|
+
compacting: this.compacting,
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** 实时注入:turn 运行中 → turn/steer;否则 'deferred'(消息保持 pending) */
|
|
192
|
+
async steer(text: string): Promise<'steer' | 'deferred'> {
|
|
193
|
+
const client = this.client
|
|
194
|
+
if (!client?.alive || !this.threadId || !this.turnActive) return 'deferred'
|
|
195
|
+
try {
|
|
196
|
+
await client.request('turn/steer', {
|
|
197
|
+
threadId: this.threadId,
|
|
198
|
+
input: [{ type: 'text', text }],
|
|
199
|
+
}, 15_000)
|
|
200
|
+
return 'steer'
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// 无 active turn / 引擎拒绝 → 消息保持 pending 由消费循环处理
|
|
204
|
+
return 'deferred'
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** HITL 应答:审批请求 → JSON-RPC 应答(decision) */
|
|
209
|
+
async respondHitl(kind: string, id: string, outcome: {
|
|
210
|
+
confirmed?: boolean
|
|
211
|
+
cancelled?: boolean
|
|
212
|
+
value?: string
|
|
213
|
+
response?: string
|
|
214
|
+
comment?: string
|
|
215
|
+
}): Promise<void> {
|
|
216
|
+
if (kind !== 'codex-approval') return
|
|
217
|
+
const pending = this.pendingApprovals.get(id)
|
|
218
|
+
if (!pending) throw new Error(`待办不存在或已处理: ${id}`)
|
|
219
|
+
const client = this.client
|
|
220
|
+
if (!client) throw new Error('codex 会话已关闭')
|
|
221
|
+
const decision = outcome.cancelled === true
|
|
222
|
+
? 'cancel'
|
|
223
|
+
: outcome.confirmed === true ? 'accept' : 'decline'
|
|
224
|
+
client.respond(pending.rpcId, { decision })
|
|
225
|
+
if (pending.timer) clearTimeout(pending.timer)
|
|
226
|
+
this.pendingApprovals.delete(id)
|
|
227
|
+
getHitlRegistry().resolve(kind, id, decision === 'cancel' ? 'cancelled' : 'answered')
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** 上下文治理(post-settle):越阈值 → thread/compact/start */
|
|
231
|
+
async onTurnSettled(): Promise<void> {
|
|
232
|
+
const client = this.client
|
|
233
|
+
if (!client?.alive || !this.threadId || this.compacting) return
|
|
234
|
+
const stats = this.getContextStats()
|
|
235
|
+
const threshold = this.config.compactThreshold ?? 0.7
|
|
236
|
+
if (!stats?.percent || stats.percent < threshold) return
|
|
237
|
+
if (Date.now() - this.lastCompactAt < 5 * 60_000) return
|
|
238
|
+
this.compacting = true
|
|
239
|
+
this.lastCompactAt = Date.now()
|
|
240
|
+
try {
|
|
241
|
+
await client.request('thread/compact/start', { threadId: this.threadId }, 30_000)
|
|
242
|
+
log.info(`[CodexAgent:${this.selfAgentId}] 上下文压缩已触发(percent=${(stats.percent * 100).toFixed(0)}%)`)
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
log.warn(`[CodexAgent:${this.selfAgentId}] compact 发起失败(放行):`, err instanceof Error ? err.message : err)
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
this.compacting = false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// ===== run / supervise =====
|
|
253
|
+
|
|
254
|
+
async* run(request: AgentRunRequest, ctx: AgentRunContext): AsyncIterable<AgentEvent> {
|
|
255
|
+
const kind = request.message.metadata?.['x-aw-task-kind']
|
|
256
|
+
if (kind === 'assign' && ctx.role === 'worker') {
|
|
257
|
+
yield* this.workerRun(request, ctx)
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
if (!kind && (request.fromAgentId || request.message.metadata?.['x-aw-from-label'])) {
|
|
261
|
+
yield* this.peerMessageRun(request, ctx)
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private supervising = false
|
|
267
|
+
|
|
268
|
+
async supervise(snapshot: SupervisionSnapshot, ctx: AgentRunContext, opts?: { signal?: AbortSignal }): Promise<SupervisionDecision[]> {
|
|
269
|
+
await this.ensureClient(ctx)
|
|
270
|
+
if (!this.client || !this.threadId) return []
|
|
271
|
+
if (this.supervising) return []
|
|
272
|
+
const prompt = supervisePrompt({
|
|
273
|
+
snapshot,
|
|
274
|
+
agentName: this.agentName,
|
|
275
|
+
channelId: this.channelId,
|
|
276
|
+
ctxPrefix: await this.contextPrefix(),
|
|
277
|
+
manual: systemManual(),
|
|
278
|
+
memory: ctx.memory,
|
|
279
|
+
})
|
|
280
|
+
this.supervising = true
|
|
281
|
+
try {
|
|
282
|
+
const events = await this.collectTurn(prompt, this.config.superviseTimeoutMs ?? 150_000, opts?.signal)
|
|
283
|
+
let text = ''
|
|
284
|
+
for (const e of events) {
|
|
285
|
+
if (e.kind === 'artifact') {
|
|
286
|
+
text += e.artifact.parts.map(p => 'text' in p ? p.text : '').join('')
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const parsed = extractJsonArray(text)
|
|
290
|
+
return parsed && parsed.length > 0 ? parsed as SupervisionDecision[] : []
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return []
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
this.supervising = false
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private async* workerRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
|
|
301
|
+
const taskId = request.taskId ?? (request.message.metadata?.['x-aw-task-id'] as string | undefined)
|
|
302
|
+
if (!taskId) return
|
|
303
|
+
this.toolState.currentTaskId = taskId
|
|
304
|
+
try {
|
|
305
|
+
await this.ensureClient(ctx)
|
|
306
|
+
const taskText = request.message.parts.map((p) => {
|
|
307
|
+
if ('text' in p) return p.text
|
|
308
|
+
if ('data' in p) return JSON.stringify(p.data)
|
|
309
|
+
if ('url' in p) return p.url
|
|
310
|
+
if ('raw' in p) return p.raw
|
|
311
|
+
return ''
|
|
312
|
+
}).join('\n')
|
|
313
|
+
const prompt = workerPrompt({
|
|
314
|
+
agentName: this.agentName,
|
|
315
|
+
channelId: this.channelId,
|
|
316
|
+
taskId,
|
|
317
|
+
taskText,
|
|
318
|
+
memory: request.memory,
|
|
319
|
+
ctxPrefix: await this.contextPrefix(),
|
|
320
|
+
manual: systemManual(),
|
|
321
|
+
})
|
|
322
|
+
yield* this.streamTurn(prompt, taskId, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
this.toolState.currentTaskId = null
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
private async* peerMessageRun(request: AgentRunRequest, ctx: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown> {
|
|
330
|
+
await this.ensureClient(ctx)
|
|
331
|
+
const msg = request.message
|
|
332
|
+
const fromId = request.fromAgentId
|
|
333
|
+
?? (typeof msg.metadata?.['x-aw-from-label'] === 'string' ? msg.metadata['x-aw-from-label'] : undefined)
|
|
334
|
+
?? 'unknown'
|
|
335
|
+
const requireReply = msg.metadata?.['x-aw-require-reply'] === 'true'
|
|
336
|
+
const crossChannel = msg.metadata?.['x-aw-cross-channel'] === 'true'
|
|
337
|
+
this.toolState.replyContext = requireReply && request.fromAgentId && !crossChannel
|
|
338
|
+
? { fromId: request.fromAgentId, messageId: msg.messageId }
|
|
339
|
+
: null
|
|
340
|
+
const msgText = msg.parts.map((p) => {
|
|
341
|
+
if ('text' in p) return p.text
|
|
342
|
+
if ('data' in p) return JSON.stringify(p.data)
|
|
343
|
+
if ('url' in p) return p.url
|
|
344
|
+
if ('raw' in p) return p.raw
|
|
345
|
+
return ''
|
|
346
|
+
}).join('\n')
|
|
347
|
+
const prompt = peerPrompt({
|
|
348
|
+
agentName: this.agentName,
|
|
349
|
+
role: this.agentRole,
|
|
350
|
+
channelId: this.channelId,
|
|
351
|
+
ctxPrefix: await this.contextPrefix(),
|
|
352
|
+
manual: systemManual(),
|
|
353
|
+
memory: request.memory,
|
|
354
|
+
fromId,
|
|
355
|
+
messageId: msg.messageId,
|
|
356
|
+
requireReply,
|
|
357
|
+
isReply: typeof msg.metadata?.['x-aw-in-reply-to'] === 'string',
|
|
358
|
+
crossChannel,
|
|
359
|
+
fromChannel: typeof msg.metadata?.['x-aw-from-channel'] === 'string' ? String(msg.metadata['x-aw-from-channel']) : '',
|
|
360
|
+
msgText,
|
|
361
|
+
})
|
|
362
|
+
yield* this.streamTurn(prompt, undefined, this.config.promptTimeoutMs ?? 600_000, ctx.signal)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
private async contextPrefix(): Promise<string> {
|
|
366
|
+
return buildContextPrefix({
|
|
367
|
+
scenarioPrompt: this.config.scenarioPrompt,
|
|
368
|
+
systemPromptPrefix: this.config.systemPromptPrefix,
|
|
369
|
+
agentId: this.selfAgentId,
|
|
370
|
+
roster: await this.roster.roster(),
|
|
371
|
+
})
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// ===== 回合执行 =====
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* 流式回合:turn/start → 逐事件产出(delta/status)→ turn/completed 收口。
|
|
378
|
+
* artifact 在 done 前注入(item/completed agentMessage 聚合文本)。
|
|
379
|
+
*/
|
|
380
|
+
private async* streamTurn(prompt: string, taskId: string | undefined, timeoutMs: number, signal?: AbortSignal): AsyncGenerator<AgentEvent, void, unknown> {
|
|
381
|
+
const client = this.client
|
|
382
|
+
if (!client || !this.threadId) {
|
|
383
|
+
yield { kind: 'error', error: { code: 'CODEX_NOT_READY', message: 'codex 会话未就绪' } }
|
|
384
|
+
return
|
|
385
|
+
}
|
|
386
|
+
const queue: AgentEvent[] = []
|
|
387
|
+
let isDone = false
|
|
388
|
+
let resolveWait: (() => void) | null = null
|
|
389
|
+
let lastActivity = Date.now()
|
|
390
|
+
let agentText = ''
|
|
391
|
+
this.turnActive = true
|
|
392
|
+
this.turnId = null
|
|
393
|
+
|
|
394
|
+
const enqueue = (e: AgentEvent): void => {
|
|
395
|
+
if (e.kind === 'done' && !isDone) {
|
|
396
|
+
if (agentText.trim()) {
|
|
397
|
+
queue.push({
|
|
398
|
+
kind: 'artifact',
|
|
399
|
+
artifact: { artifactId: randomUUID(), name: 'output', parts: [{ text: agentText.trim() }] },
|
|
400
|
+
lastChunk: true,
|
|
401
|
+
totalChunks: 1,
|
|
402
|
+
})
|
|
403
|
+
}
|
|
404
|
+
this.turnActive = false
|
|
405
|
+
}
|
|
406
|
+
if (e.kind === 'done' || e.kind === 'error') {
|
|
407
|
+
isDone = true
|
|
408
|
+
this.turnActive = false
|
|
409
|
+
flushDelta()
|
|
410
|
+
}
|
|
411
|
+
queue.push(e)
|
|
412
|
+
lastActivity = Date.now()
|
|
413
|
+
resolveWait?.()
|
|
414
|
+
resolveWait = null
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const flushDelta = (): void => {
|
|
418
|
+
if (this.deltaTimer) {
|
|
419
|
+
clearTimeout(this.deltaTimer)
|
|
420
|
+
this.deltaTimer = null
|
|
421
|
+
}
|
|
422
|
+
if (!this.deltaBuf) return
|
|
423
|
+
const text = this.deltaBuf
|
|
424
|
+
this.deltaBuf = ''
|
|
425
|
+
queue.push({ kind: 'delta', delta: { text } })
|
|
426
|
+
}
|
|
427
|
+
const pushDelta = (text: string): void => {
|
|
428
|
+
this.deltaBuf += text
|
|
429
|
+
this.deltaTimer ??= setTimeout(() => {
|
|
430
|
+
this.deltaTimer = null
|
|
431
|
+
flushDelta()
|
|
432
|
+
}, 50)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 通知订阅(审批请求处理器已在 startClient 挂接,此处只处理回合通知)
|
|
436
|
+
const unsub = client.onNotification((method, params) => {
|
|
437
|
+
const p = (params ?? {}) as Record<string, unknown>
|
|
438
|
+
lastActivity = Date.now()
|
|
439
|
+
if (method === 'item/agentMessage/delta') {
|
|
440
|
+
const delta = typeof p.delta === 'string' ? p.delta : ''
|
|
441
|
+
if (delta) {
|
|
442
|
+
this.turnActive = true
|
|
443
|
+
pushDelta(delta)
|
|
444
|
+
}
|
|
445
|
+
return
|
|
446
|
+
}
|
|
447
|
+
if (method === 'turn/started') {
|
|
448
|
+
const turn = p.turn as Record<string, unknown> | undefined
|
|
449
|
+
this.turnId = typeof turn?.id === 'string' ? turn.id : this.turnId
|
|
450
|
+
this.turnActive = true
|
|
451
|
+
enqueue({ kind: 'status', status: { state: 'WORKING', timestamp: new Date().toISOString() } })
|
|
452
|
+
return
|
|
453
|
+
}
|
|
454
|
+
if (method === 'item/started') {
|
|
455
|
+
const item = p.item as Record<string, unknown> | undefined
|
|
456
|
+
const t = String(item?.type ?? '')
|
|
457
|
+
if (['commandExecution', 'mcpToolCall', 'fileChange', 'dynamicToolCall', 'webSearch', 'collabToolCall'].includes(t)) {
|
|
458
|
+
const label = t === 'commandExecution'
|
|
459
|
+
? String(item?.command ?? 'command')
|
|
460
|
+
: String(item?.tool ?? item?.title ?? t)
|
|
461
|
+
enqueue({
|
|
462
|
+
kind: 'status',
|
|
463
|
+
status: {
|
|
464
|
+
state: 'WORKING',
|
|
465
|
+
message: {
|
|
466
|
+
messageId: randomUUID(),
|
|
467
|
+
contextId: this.channelId,
|
|
468
|
+
role: 'ROLE_AGENT',
|
|
469
|
+
parts: [{ text: `🔧 ${label}${toolArgsPreview(item?.input ?? item?.arguments ?? item?.command)}` }],
|
|
470
|
+
},
|
|
471
|
+
timestamp: new Date().toISOString(),
|
|
472
|
+
},
|
|
473
|
+
})
|
|
474
|
+
}
|
|
475
|
+
if (t === 'contextCompaction') this.compacting = true
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
if (method === 'item/completed') {
|
|
479
|
+
const item = p.item as Record<string, unknown> | undefined
|
|
480
|
+
if (String(item?.type ?? '') === 'agentMessage' && typeof item?.text === 'string') {
|
|
481
|
+
agentText += item.text
|
|
482
|
+
}
|
|
483
|
+
if (String(item?.type ?? '') === 'contextCompaction') this.compacting = false
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
if (method === 'thread/tokenUsage/updated') {
|
|
487
|
+
const usage = (p.usage ?? p.tokenUsage ?? p) as Record<string, unknown>
|
|
488
|
+
const input = Number(usage.input_tokens ?? usage.inputTokens ?? usage.total_tokens ?? usage.totalTokens)
|
|
489
|
+
if (Number.isFinite(input) && input > 0) this.lastUsage = { input, at: Date.now() }
|
|
490
|
+
return
|
|
491
|
+
}
|
|
492
|
+
if (method === 'turn/completed') {
|
|
493
|
+
const turn = (p.turn ?? {}) as Record<string, unknown>
|
|
494
|
+
const status = String(turn.status ?? 'completed')
|
|
495
|
+
if (status === 'failed') {
|
|
496
|
+
const err = (turn.error ?? {}) as Record<string, unknown>
|
|
497
|
+
const info = String(err.codexErrorInfo ?? '')
|
|
498
|
+
enqueue({
|
|
499
|
+
kind: 'error',
|
|
500
|
+
error: {
|
|
501
|
+
code: info ? `CODEX_${info}` : 'CODEX_LLM_ERROR',
|
|
502
|
+
message: String(err.message ?? 'codex 回合失败'),
|
|
503
|
+
},
|
|
504
|
+
})
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
// completed / interrupted:中断按 done 收口(消息按已处理落账)
|
|
508
|
+
enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
|
|
509
|
+
}
|
|
510
|
+
return
|
|
511
|
+
}
|
|
512
|
+
if (method === 'error') {
|
|
513
|
+
enqueue({
|
|
514
|
+
kind: 'error',
|
|
515
|
+
error: { code: 'CODEX_ERROR', message: String(p.message ?? p.error ?? JSON.stringify(params).slice(0, 300)) },
|
|
516
|
+
})
|
|
517
|
+
}
|
|
518
|
+
})
|
|
519
|
+
|
|
520
|
+
// abort 传导
|
|
521
|
+
const onAbort = (): void => {
|
|
522
|
+
log.warn(`[CodexAgent:${this.selfAgentId}] run 被 abort → turn/interrupt,taskId=${taskId ?? '-'}`)
|
|
523
|
+
void client.request('turn/interrupt', { threadId: this.threadId, ...(this.turnId ? { turnId: this.turnId } : {}) }, 15_000).catch(() => {})
|
|
524
|
+
setTimeout(() => {
|
|
525
|
+
if (!isDone) enqueue({ kind: 'done', final: taskId ? { taskId } : undefined })
|
|
526
|
+
}, 5000)
|
|
527
|
+
}
|
|
528
|
+
if (signal?.aborted) onAbort()
|
|
529
|
+
else signal?.addEventListener('abort', onAbort, { once: true })
|
|
530
|
+
|
|
531
|
+
// 投递 turn
|
|
532
|
+
try {
|
|
533
|
+
await client.request('turn/start', {
|
|
534
|
+
threadId: this.threadId,
|
|
535
|
+
input: [{ type: 'text', text: prompt }],
|
|
536
|
+
}, 60_000)
|
|
537
|
+
}
|
|
538
|
+
catch (err) {
|
|
539
|
+
unsub()
|
|
540
|
+
signal?.removeEventListener('abort', onAbort)
|
|
541
|
+
this.turnActive = false
|
|
542
|
+
yield {
|
|
543
|
+
kind: 'error',
|
|
544
|
+
error: {
|
|
545
|
+
code: 'CODEX_PROMPT_FAILED',
|
|
546
|
+
message: `codex turn/start 失败: ${err instanceof Error ? err.message : String(err)}`,
|
|
547
|
+
},
|
|
548
|
+
}
|
|
549
|
+
return
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
try {
|
|
553
|
+
while (!isDone || queue.length > 0) {
|
|
554
|
+
if (queue.length === 0 && !isDone) {
|
|
555
|
+
const remaining = timeoutMs - (Date.now() - lastActivity)
|
|
556
|
+
if (remaining <= 0) {
|
|
557
|
+
void client.request('turn/interrupt', { threadId: this.threadId }, 15_000).catch(() => {})
|
|
558
|
+
enqueue({
|
|
559
|
+
kind: 'error',
|
|
560
|
+
error: { code: 'CODEX_TURN_STALLED', message: `回合停滞 ${Math.round(timeoutMs / 1000)}s 无事件,已中止` },
|
|
561
|
+
})
|
|
562
|
+
continue
|
|
563
|
+
}
|
|
564
|
+
await new Promise<void>((r) => {
|
|
565
|
+
resolveWait = r
|
|
566
|
+
setTimeout(() => {
|
|
567
|
+
resolveWait = null
|
|
568
|
+
r()
|
|
569
|
+
}, remaining + 100)
|
|
570
|
+
})
|
|
571
|
+
}
|
|
572
|
+
while (queue.length > 0) {
|
|
573
|
+
yield queue.shift()!
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
flushDelta()
|
|
579
|
+
unsub()
|
|
580
|
+
signal?.removeEventListener('abort', onAbort)
|
|
581
|
+
this.turnActive = false
|
|
582
|
+
this.turnId = null
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** supervise 用:收齐整个回合的事件流(supervise 决策解析在调用方) */
|
|
587
|
+
private async collectTurn(prompt: string, timeoutMs: number, signal?: AbortSignal): Promise<AgentEvent[]> {
|
|
588
|
+
const events: AgentEvent[] = []
|
|
589
|
+
for await (const e of this.streamTurn(prompt, undefined, timeoutMs, signal)) {
|
|
590
|
+
events.push(e)
|
|
591
|
+
if (e.kind === 'error') break
|
|
592
|
+
}
|
|
593
|
+
return events
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// ===== HITL 登记 =====
|
|
597
|
+
|
|
598
|
+
private registerApprovalHitl(rpcId: string | number, itemId: string, kindLabel: 'command' | 'file', p: Record<string, unknown>): void {
|
|
599
|
+
const id = `codex-${itemId}`
|
|
600
|
+
if (this.pendingApprovals.has(id)) return
|
|
601
|
+
const title = kindLabel === 'command'
|
|
602
|
+
? `codex 命令审批:${String(p.command ?? '(未知命令)').slice(0, 200)}`
|
|
603
|
+
: `codex 文件变更审批:${String(p.cwd ?? p.grantRoot ?? '')}`
|
|
604
|
+
const registry = getHitlRegistry()
|
|
605
|
+
registry.register({
|
|
606
|
+
kind: 'codex-approval',
|
|
607
|
+
id,
|
|
608
|
+
agentId: this.selfAgentId,
|
|
609
|
+
agentName: this.agentName,
|
|
610
|
+
channelId: this.channelId,
|
|
611
|
+
pid: this.client?.pid,
|
|
612
|
+
method: 'confirm',
|
|
613
|
+
title,
|
|
614
|
+
detail: typeof p.reason === 'string' ? p.reason : undefined,
|
|
615
|
+
createdAt: new Date().toISOString(),
|
|
616
|
+
expiresAt: null,
|
|
617
|
+
})
|
|
618
|
+
const timeoutMs = harnessSettings().hitl_timeout_ms
|
|
619
|
+
const timer = timeoutMs > 0
|
|
620
|
+
? setTimeout(() => {
|
|
621
|
+
void this.respondHitl('codex-approval', id, { cancelled: true }).catch(() => {})
|
|
622
|
+
registry.resolve('codex-approval', id, 'expired')
|
|
623
|
+
}, timeoutMs)
|
|
624
|
+
: null
|
|
625
|
+
this.pendingApprovals.set(id, { rpcId, timer })
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
private registerUserInputHitl(rpcId: string | number, p: Record<string, unknown>): void {
|
|
629
|
+
const id = `codex-input-${randomUUID().slice(0, 8)}`
|
|
630
|
+
const questions = Array.isArray(p.questions) ? p.questions : []
|
|
631
|
+
const first = (questions[0] ?? {}) as Record<string, unknown>
|
|
632
|
+
const registry = getHitlRegistry()
|
|
633
|
+
registry.register({
|
|
634
|
+
kind: 'codex-approval',
|
|
635
|
+
id,
|
|
636
|
+
agentId: this.selfAgentId,
|
|
637
|
+
agentName: this.agentName,
|
|
638
|
+
channelId: this.channelId,
|
|
639
|
+
pid: this.client?.pid,
|
|
640
|
+
method: 'input',
|
|
641
|
+
title: String(first.question ?? first.header ?? 'codex 提问'),
|
|
642
|
+
detail: typeof p.reason === 'string' ? p.reason : undefined,
|
|
643
|
+
createdAt: new Date().toISOString(),
|
|
644
|
+
expiresAt: null,
|
|
645
|
+
})
|
|
646
|
+
const timeoutMs = harnessSettings().hitl_timeout_ms
|
|
647
|
+
const timer = timeoutMs > 0
|
|
648
|
+
? setTimeout(() => {
|
|
649
|
+
void this.respondUserInput(rpcId, id, { cancelled: true }).catch(() => {})
|
|
650
|
+
}, timeoutMs)
|
|
651
|
+
: null
|
|
652
|
+
this.pendingApprovals.set(id, { rpcId, timer })
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
private async respondUserInput(rpcId: string | number, id: string, outcome: { cancelled?: boolean, value?: string }): Promise<void> {
|
|
656
|
+
const pending = this.pendingApprovals.get(id)
|
|
657
|
+
if (!pending) return
|
|
658
|
+
const client = this.client
|
|
659
|
+
if (!client) return
|
|
660
|
+
if (outcome.cancelled) {
|
|
661
|
+
client.respondError(rpcId, -32800, '人工取消')
|
|
662
|
+
getHitlRegistry().resolve('codex-approval', id, 'cancelled')
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
client.respond(rpcId, { answers: [{ answer: outcome.value ?? '' }] })
|
|
666
|
+
getHitlRegistry().resolve('codex-approval', id, 'answered')
|
|
667
|
+
}
|
|
668
|
+
if (pending.timer) clearTimeout(pending.timer)
|
|
669
|
+
this.pendingApprovals.delete(id)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// ===== 客户端管理 =====
|
|
673
|
+
|
|
674
|
+
private async ensureClient(ctx: AgentRunContext): Promise<void> {
|
|
675
|
+
if (!this.workspace) this.workspace = ctx.workspace
|
|
676
|
+
if (!this.agentInfo) {
|
|
677
|
+
this.channelId = ctx.channelId
|
|
678
|
+
this.agentRole = ctx.role
|
|
679
|
+
this.refreshIdentity()
|
|
680
|
+
}
|
|
681
|
+
if (this.client?.alive && this.threadId) return
|
|
682
|
+
if (this.client && !this.client.alive) {
|
|
683
|
+
this.client = null
|
|
684
|
+
this.threadId = null
|
|
685
|
+
}
|
|
686
|
+
this.clientStarting ??= this.startClient().finally(() => {
|
|
687
|
+
this.clientStarting = null
|
|
688
|
+
})
|
|
689
|
+
await this.clientStarting
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
private async startClient(): Promise<void> {
|
|
693
|
+
const command = this.config.command ?? harnessSettings().codex_command
|
|
694
|
+
const client = new StdioJsonRpcClient({
|
|
695
|
+
name: 'codex',
|
|
696
|
+
command,
|
|
697
|
+
args: [...(this.config.args ?? []), 'app-server'],
|
|
698
|
+
cwd: this.config.cwd ?? process.cwd(),
|
|
699
|
+
env: generateMcpBridgeEnv({
|
|
700
|
+
agentId: this.selfAgentId,
|
|
701
|
+
token: this.config.token,
|
|
702
|
+
baseUrl: this.config.baseUrl,
|
|
703
|
+
bridgePath: this.config.mcpBridgePath,
|
|
704
|
+
extra: this.config.codexHome ? { CODEX_HOME: this.config.codexHome } : {},
|
|
705
|
+
}).engineEnv,
|
|
706
|
+
requestTimeoutMs: 60_000,
|
|
707
|
+
})
|
|
708
|
+
const pidRef = { pid: undefined as number | undefined }
|
|
709
|
+
client.onExit((code) => {
|
|
710
|
+
if (pidRef.pid) markHarnessProcessExit(pidRef.pid, code)
|
|
711
|
+
this.threadId = null
|
|
712
|
+
log.warn(`[CodexAgent:${this.selfAgentId}] codex app-server 退出(code=${code});下回合自动重生`)
|
|
713
|
+
})
|
|
714
|
+
await client.start()
|
|
715
|
+
pidRef.pid = client.pid
|
|
716
|
+
if (client.pid) {
|
|
717
|
+
registerHarnessProcess(client.pid, { harness: 'codex', command, args: ['app-server'] })
|
|
718
|
+
bindHarnessProcess(client.pid, { agentId: this.selfAgentId, channelId: this.channelId, name: this.agentName, role: this.agentRole })
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// 握手
|
|
722
|
+
await client.request('initialize', {
|
|
723
|
+
clientInfo: { name: 'agentworkshop', title: 'AgentWorkShop', version: '0.8.0' },
|
|
724
|
+
}, 30_000)
|
|
725
|
+
client.notify('initialized', {})
|
|
726
|
+
|
|
727
|
+
// MCP 桥装配(per-agent CODEX_HOME 的 config.toml [mcp_servers.aw])
|
|
728
|
+
this.writeCodexHomeConfig()
|
|
729
|
+
|
|
730
|
+
// 建会话
|
|
731
|
+
const result = await client.request('thread/start', {
|
|
732
|
+
...(this.config.model ? { model: this.config.model } : {}),
|
|
733
|
+
cwd: this.config.cwd ?? process.cwd(),
|
|
734
|
+
approvalPolicy: this.config.approvalPolicy ?? 'on-request',
|
|
735
|
+
sandbox: this.config.sandbox ?? 'workspace-write',
|
|
736
|
+
}, 60_000) as Record<string, unknown>
|
|
737
|
+
const thread = (result?.thread ?? result) as Record<string, unknown>
|
|
738
|
+
this.threadId = typeof thread?.id === 'string' ? thread.id : null
|
|
739
|
+
if (!this.threadId) throw new Error('codex thread/start 未返回 thread id')
|
|
740
|
+
|
|
741
|
+
// 事件监听挂接(通知在 streamTurn 内按回合订阅;此处仅挂请求处理器)
|
|
742
|
+
client.onRequest((req) => {
|
|
743
|
+
if (req.method === 'item/commandExecution/requestApproval' || req.method === 'item/fileChange/requestApproval') {
|
|
744
|
+
const p = (req.params ?? {}) as Record<string, unknown>
|
|
745
|
+
this.registerApprovalHitl(req.id, String(p.itemId ?? randomUUID()), req.method === 'item/fileChange/requestApproval' ? 'file' : 'command', p)
|
|
746
|
+
}
|
|
747
|
+
else if (req.method === 'tool/requestUserInput') {
|
|
748
|
+
const p = (req.params ?? {}) as Record<string, unknown>
|
|
749
|
+
this.registerUserInputHitl(req.id, p)
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
client.respondError(req.id, -32601, `方法不存在: ${req.method}`)
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
|
|
756
|
+
this.client = client
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* per-agent CODEX_HOME config.toml:注册 MCP 桥(required=true,桥挂了宁可失败)。
|
|
761
|
+
* 已有 config.toml(从全局目录种子化复制)→ 追加本段(保留用户的 provider/model
|
|
762
|
+
* 配置,自定义网关/密钥不丢失);全新目录 → 独立写入。
|
|
763
|
+
*/
|
|
764
|
+
private writeCodexHomeConfig(): void {
|
|
765
|
+
let home = this.config.codexHome
|
|
766
|
+
if (!home && this.config.effort) {
|
|
767
|
+
// effort 需要配置文件面(model_reasoning_effort):自动种子化 per-agent CODEX_HOME
|
|
768
|
+
// (拷贝全局凭据/网关配置,保登录与自定义 provider;追加 MCP 段 + 顶部 effort)
|
|
769
|
+
home = join(tmpdir(), `aw-codex-${this.selfAgentId.slice(0, 8)}`)
|
|
770
|
+
this.config.codexHome = home
|
|
771
|
+
for (const f of ['auth.json', 'config.toml', 'cc-switch-model-catalog.json']) {
|
|
772
|
+
try {
|
|
773
|
+
const src = join(process.env.HOME ?? process.env.USERPROFILE ?? '', '.codex', f)
|
|
774
|
+
if (existsSync(src)) copyFileSync(src, join(home, f))
|
|
775
|
+
}
|
|
776
|
+
catch { /* 单文件缺失忽略 */ }
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
if (!home) return
|
|
780
|
+
try {
|
|
781
|
+
mkdirSync(home, { recursive: true })
|
|
782
|
+
const configFile = join(home, 'config.toml')
|
|
783
|
+
const env = generateMcpBridgeEnv({ agentId: this.selfAgentId, token: this.config.token, baseUrl: this.config.baseUrl, bridgePath: this.config.mcpBridgePath })
|
|
784
|
+
const envLines = Object.entries(env.bridgeEnv).map(([k, v]) => ` ${k} = "${v}"`).join('\n')
|
|
785
|
+
const section = [
|
|
786
|
+
``,
|
|
787
|
+
`[mcp_servers.aw]`,
|
|
788
|
+
`command = ${JSON.stringify(process.execPath)}`,
|
|
789
|
+
`args = [${JSON.stringify(join(process.env.AW_PACKAGE_ROOT ?? process.cwd(), 'server', 'harness', 'aw-mcp-bridge.mjs'))}]`,
|
|
790
|
+
`required = true`,
|
|
791
|
+
``,
|
|
792
|
+
`[mcp_servers.aw.env]`,
|
|
793
|
+
envLines,
|
|
794
|
+
``,
|
|
795
|
+
].join('\n')
|
|
796
|
+
// effort 走 TOML 顶层键(model_reasoning_effort):必须位于任何 [table] 之前 → 顶部插入
|
|
797
|
+
const effortLine = this.config.effort
|
|
798
|
+
? `model_reasoning_effort = ${JSON.stringify(this.config.effort)}
|
|
799
|
+
`
|
|
800
|
+
: ''
|
|
801
|
+
if (existsSync(configFile)) {
|
|
802
|
+
const existing = readFileSync(configFile, 'utf-8')
|
|
803
|
+
const withoutDup = this.config.effort
|
|
804
|
+
? existing.replace(/^model_reasoning_effort = .*\n?/m, '')
|
|
805
|
+
: existing
|
|
806
|
+
if (withoutDup.includes('[mcp_servers.aw]')) {
|
|
807
|
+
if (effortLine && !withoutDup.startsWith(effortLine.trim())) {
|
|
808
|
+
writeFileSync(configFile, effortLine + withoutDup, 'utf-8')
|
|
809
|
+
}
|
|
810
|
+
return
|
|
811
|
+
}
|
|
812
|
+
writeFileSync(configFile, effortLine + withoutDup + section, 'utf-8')
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
writeFileSync(configFile, effortLine + section, 'utf-8')
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
catch (err) {
|
|
819
|
+
log.warn(`[CodexAgent:${this.selfAgentId}] CODEX_HOME config 写入失败(信任全局配置):`, err instanceof Error ? err.message : err)
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|