@futdevpro/ccap 1.1.3002 → 1.1.3013
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/client-dist/{agent-instances.module-VLGX2Z7Z.js → agent-instances.module-SZDIKSIR.js} +2 -2
- package/client-dist/ca.module-JYSD4TBY.js +5 -0
- package/client-dist/ca.module-JYSD4TBY.js.map +7 -0
- package/client-dist/{cc-usage-dashboard.component-D6CNJHB5.js → cc-usage-dashboard.component-O4VDGFYY.js} +2 -2
- package/client-dist/{cc.module-T3NJWMZ5.js → cc.module-HHIOLYUZ.js} +4 -4
- package/client-dist/cc.module-HHIOLYUZ.js.map +7 -0
- package/client-dist/{chunk-7VUQTBJ2.js → chunk-2BZ4R623.js} +2 -2
- package/client-dist/{chunk-YWW2VAZR.js → chunk-2V2O2JAL.js} +2 -2
- package/client-dist/{chunk-3SYXOECP.js → chunk-3KB6O77F.js} +2 -2
- package/client-dist/{chunk-PTS77H25.js → chunk-4ZEPJMCK.js} +2 -2
- package/client-dist/{chunk-64K7CP3A.js → chunk-5ATMD4SY.js} +2 -2
- package/client-dist/{chunk-W3HNVMKS.js → chunk-5GTIJO5T.js} +2 -2
- package/client-dist/{chunk-PVLRUWUC.js → chunk-5UADYWSA.js} +2 -2
- package/client-dist/{chunk-36LPXL3M.js → chunk-5Z43LN5U.js} +2 -2
- package/client-dist/{chunk-3JQ2UHMM.js → chunk-6HMRYXOI.js} +2 -2
- package/client-dist/{chunk-6227S2CN.js → chunk-6JLLWGQF.js} +2 -2
- package/client-dist/{chunk-EGZ2ZMS3.js → chunk-72Z4K7WC.js} +2 -2
- package/client-dist/{chunk-O6IRGFCX.js → chunk-7FGU7NN2.js} +2 -2
- package/client-dist/{chunk-SJTW4HLQ.js → chunk-A6TWPSUA.js} +2 -2
- package/client-dist/{chunk-2IYGO6RM.js → chunk-APYQ4B27.js} +2 -2
- package/client-dist/{chunk-SAC7F2CB.js → chunk-AVH4FZ6Z.js} +2 -2
- package/client-dist/{chunk-FOL6X3TR.js → chunk-B24YBK2I.js} +2 -2
- package/client-dist/{chunk-5HYEA5IO.js → chunk-BGD62M7R.js} +2 -2
- package/client-dist/{chunk-5DUG67IY.js → chunk-BKR6H3SJ.js} +2 -2
- package/client-dist/{chunk-OVU6SA42.js → chunk-BWW75POL.js} +2 -2
- package/client-dist/{chunk-WNQYZI4D.js → chunk-DC4EFEQU.js} +2 -2
- package/client-dist/{chunk-SJ6KKDJT.js → chunk-EEOSB2P7.js} +2 -2
- package/client-dist/{chunk-W7OH67K2.js → chunk-EVREGV4D.js} +2 -2
- package/client-dist/{chunk-S46BSLUB.js → chunk-FD6QRJ7H.js} +2 -2
- package/client-dist/{chunk-JLF2BDJU.js → chunk-G5CYHOH4.js} +2 -2
- package/client-dist/{chunk-2ZTUWDCN.js → chunk-GB5ESWPG.js} +2 -2
- package/client-dist/{chunk-SBJAWWHF.js → chunk-GERQQL7M.js} +2 -2
- package/client-dist/{chunk-SBJAWWHF.js.map → chunk-GERQQL7M.js.map} +3 -3
- package/client-dist/{chunk-ZZ7RWOLH.js → chunk-GHUVIUFQ.js} +2 -2
- package/client-dist/{chunk-7YT7BGBD.js → chunk-GKKG77XM.js} +2 -2
- package/client-dist/{chunk-ZZRTMXBT.js → chunk-GPAB3FYW.js} +2 -2
- package/client-dist/chunk-GWFZKTPN.js +4 -0
- package/client-dist/{chunk-OXEKAYMY.js.map → chunk-GWFZKTPN.js.map} +3 -3
- package/client-dist/{chunk-TIJCR5DW.js → chunk-HHHXXHAW.js} +2 -2
- package/client-dist/{chunk-TIJCR5DW.js.map → chunk-HHHXXHAW.js.map} +1 -1
- package/client-dist/{chunk-NCOPOED7.js → chunk-HK42XXL4.js} +2 -2
- package/client-dist/{chunk-VQSRIIPK.js → chunk-KB4N3NQJ.js} +2 -2
- package/client-dist/{chunk-7SCYMYZG.js → chunk-KM4V4ZQZ.js} +2 -2
- package/client-dist/{chunk-XKS3GVP3.js → chunk-KYW5YFHW.js} +2 -2
- package/client-dist/{chunk-QXIUTGNM.js → chunk-LUJCXLWT.js} +2 -2
- package/client-dist/{chunk-3LPBF4AU.js → chunk-M5ZAOY2Y.js} +2 -2
- package/client-dist/{chunk-TNGH7PJP.js → chunk-MJJNEYN2.js} +2 -2
- package/client-dist/{chunk-IGWJMU5B.js → chunk-NEGX5HML.js} +2 -2
- package/client-dist/{chunk-KHVPVWG7.js → chunk-NGFX2IRI.js} +2 -2
- package/client-dist/{chunk-E6DWNZNG.js → chunk-NH77DCAE.js} +2 -2
- package/client-dist/{chunk-CN76LOPU.js → chunk-NLYXP47X.js} +2 -2
- package/client-dist/chunk-P3IBAIKH.js +18 -0
- package/client-dist/chunk-P3IBAIKH.js.map +7 -0
- package/client-dist/{chunk-FID2RUXN.js → chunk-PBI4ECTK.js} +2 -2
- package/client-dist/{chunk-I4V3JDZC.js → chunk-QF6DLZ66.js} +2 -2
- package/client-dist/{chunk-ZLCRMQAK.js → chunk-QFD5FURA.js} +2 -2
- package/client-dist/{chunk-AQD6DEHR.js → chunk-QGUF3JAC.js} +2 -2
- package/client-dist/{chunk-IUCQWZ34.js → chunk-RKWECXJW.js} +2 -2
- package/client-dist/{chunk-ZW4M7CJ2.js → chunk-THHGTIDJ.js} +2 -2
- package/client-dist/{chunk-4AVVQGND.js → chunk-TZIBF6RE.js} +2 -2
- package/client-dist/{chunk-A3RMSX34.js → chunk-WI4NEQOH.js} +2 -2
- package/client-dist/{chunk-GNWPRBF5.js → chunk-X2RTRMJW.js} +2 -2
- package/client-dist/{chunk-DPXSAO23.js → chunk-X4RAIC74.js} +2 -2
- package/client-dist/{chunk-7MZ4N75F.js → chunk-XJDLUP33.js} +2 -2
- package/client-dist/{chunk-ZPE6HI3H.js → chunk-YR6NTERF.js} +2 -2
- package/client-dist/{chunk-P7Z33WJF.js → chunk-ZTXRLQE6.js} +2 -2
- package/client-dist/{consultant.module-J2JDO2WS.js → consultant.module-UR6QVGHX.js} +2 -2
- package/client-dist/{crd.module-SCW4OTC2.js → crd.module-VBL7AIQU.js} +2 -2
- package/client-dist/{dashboard.module-F55QGGVH.js → dashboard.module-NM4D5NW3.js} +2 -2
- package/client-dist/{do.module-7FRBSMAA.js → do.module-IILFMQ4A.js} +2 -2
- package/client-dist/{document-library.module-B6VXHRG7.js → document-library.module-2DB3MQAW.js} +2 -2
- package/client-dist/{embedding-eval.module-NPC3TEIO.js → embedding-eval.module-WSWE67IJ.js} +2 -2
- package/client-dist/{embedding-registry.module-LIVVEPZY.js → embedding-registry.module-SG3ZJKPN.js} +2 -2
- package/client-dist/{err.module-YOIHNORT.js → err.module-ALQB32AB.js} +2 -2
- package/client-dist/{feedback.module-V5KVPNYZ.js → feedback.module-Y2YSFOAJ.js} +2 -2
- package/client-dist/{host-runtime-mcp.module-PHWXY4PV.js → host-runtime-mcp.module-YZ6D6IOC.js} +2 -2
- package/client-dist/index.html +2 -2
- package/client-dist/{live-dev-pipeline.module-NGFZQDD3.js → live-dev-pipeline.module-2IEAOW5B.js} +2 -2
- package/client-dist/{logs.module-U22RMCHY.js → logs.module-6654WNYH.js} +2 -2
- package/client-dist/{main-E47XWCXH.js → main-P264JJGJ.js} +3 -3
- package/client-dist/{master-control-remote-poc.module-EBA63OMO.js → master-control-remote-poc.module-CKHW6KMI.js} +2 -2
- package/client-dist/{mobile-app.module-SRY6NVNR.js → mobile-app.module-LLBTOC54.js} +2 -2
- package/client-dist/{model-registry.module-UTATZZJR.js → model-registry.module-MLQXILLQ.js} +2 -2
- package/client-dist/oc.module-IBQUD7B7.js +3 -0
- package/client-dist/oc.module-IBQUD7B7.js.map +7 -0
- package/client-dist/{orc.module-MKANMSGC.js → orc.module-EHJZJMOJ.js} +2 -2
- package/client-dist/{project-management.module-4LL5UVW5.js → project-management.module-QW2OUHID.js} +2 -2
- package/client-dist/project-source-routed.module-ZRIGHKPE.js +2 -0
- package/client-dist/{scheduler.module-COHLY6ZF.js → scheduler.module-3ZZRNJUV.js} +2 -2
- package/client-dist/{session.module-JQCXS6ZJ.js → session.module-N6ITSDGW.js} +9 -9
- package/client-dist/session.module-N6ITSDGW.js.map +7 -0
- package/client-dist/{set.module-PUU5N4MJ.js → set.module-DQOBFJCH.js} +2 -2
- package/client-dist/{setup.module-HPV5JS3I.js → setup.module-R2TZA42H.js} +2 -2
- package/client-dist/{styles-XKQ3MDLE.css → styles-ETK3TL2N.css} +2 -2
- package/client-dist/{styles-XKQ3MDLE.css.map → styles-ETK3TL2N.css.map} +1 -1
- package/client-dist/{terminals.module-VIWV443T.js → terminals.module-4NZBPA65.js} +2 -2
- package/client-dist/{voice-notes-poc.module-ZNRSQ6XH.js → voice-notes-poc.module-UZUWDFZD.js} +2 -2
- package/client-dist/{wfs.module-CIG5GOVA.js → wfs.module-4GKFJ5LB.js} +2 -2
- package/package.json +1 -1
- package/client-dist/ca.module-FMCAOMOB.js +0 -5
- package/client-dist/ca.module-FMCAOMOB.js.map +0 -7
- package/client-dist/cc.module-T3NJWMZ5.js.map +0 -7
- package/client-dist/chunk-DB44BUNE.js +0 -18
- package/client-dist/chunk-DB44BUNE.js.map +0 -7
- package/client-dist/chunk-OXEKAYMY.js +0 -4
- package/client-dist/oc.module-SVMLBM6T.js +0 -3
- package/client-dist/oc.module-SVMLBM6T.js.map +0 -7
- package/client-dist/project-source-routed.module-DSUCIWHV.js +0 -2
- package/client-dist/session.module-JQCXS6ZJ.js.map +0 -7
- /package/client-dist/{agent-instances.module-VLGX2Z7Z.js.map → agent-instances.module-SZDIKSIR.js.map} +0 -0
- /package/client-dist/{cc-usage-dashboard.component-D6CNJHB5.js.map → cc-usage-dashboard.component-O4VDGFYY.js.map} +0 -0
- /package/client-dist/{chunk-7VUQTBJ2.js.map → chunk-2BZ4R623.js.map} +0 -0
- /package/client-dist/{chunk-YWW2VAZR.js.map → chunk-2V2O2JAL.js.map} +0 -0
- /package/client-dist/{chunk-3SYXOECP.js.map → chunk-3KB6O77F.js.map} +0 -0
- /package/client-dist/{chunk-PTS77H25.js.map → chunk-4ZEPJMCK.js.map} +0 -0
- /package/client-dist/{chunk-64K7CP3A.js.map → chunk-5ATMD4SY.js.map} +0 -0
- /package/client-dist/{chunk-W3HNVMKS.js.map → chunk-5GTIJO5T.js.map} +0 -0
- /package/client-dist/{chunk-PVLRUWUC.js.map → chunk-5UADYWSA.js.map} +0 -0
- /package/client-dist/{chunk-36LPXL3M.js.map → chunk-5Z43LN5U.js.map} +0 -0
- /package/client-dist/{chunk-3JQ2UHMM.js.map → chunk-6HMRYXOI.js.map} +0 -0
- /package/client-dist/{chunk-6227S2CN.js.map → chunk-6JLLWGQF.js.map} +0 -0
- /package/client-dist/{chunk-EGZ2ZMS3.js.map → chunk-72Z4K7WC.js.map} +0 -0
- /package/client-dist/{chunk-O6IRGFCX.js.map → chunk-7FGU7NN2.js.map} +0 -0
- /package/client-dist/{chunk-SJTW4HLQ.js.map → chunk-A6TWPSUA.js.map} +0 -0
- /package/client-dist/{chunk-2IYGO6RM.js.map → chunk-APYQ4B27.js.map} +0 -0
- /package/client-dist/{chunk-SAC7F2CB.js.map → chunk-AVH4FZ6Z.js.map} +0 -0
- /package/client-dist/{chunk-FOL6X3TR.js.map → chunk-B24YBK2I.js.map} +0 -0
- /package/client-dist/{chunk-5HYEA5IO.js.map → chunk-BGD62M7R.js.map} +0 -0
- /package/client-dist/{chunk-5DUG67IY.js.map → chunk-BKR6H3SJ.js.map} +0 -0
- /package/client-dist/{chunk-OVU6SA42.js.map → chunk-BWW75POL.js.map} +0 -0
- /package/client-dist/{chunk-WNQYZI4D.js.map → chunk-DC4EFEQU.js.map} +0 -0
- /package/client-dist/{chunk-SJ6KKDJT.js.map → chunk-EEOSB2P7.js.map} +0 -0
- /package/client-dist/{chunk-W7OH67K2.js.map → chunk-EVREGV4D.js.map} +0 -0
- /package/client-dist/{chunk-S46BSLUB.js.map → chunk-FD6QRJ7H.js.map} +0 -0
- /package/client-dist/{chunk-JLF2BDJU.js.map → chunk-G5CYHOH4.js.map} +0 -0
- /package/client-dist/{chunk-2ZTUWDCN.js.map → chunk-GB5ESWPG.js.map} +0 -0
- /package/client-dist/{chunk-ZZ7RWOLH.js.map → chunk-GHUVIUFQ.js.map} +0 -0
- /package/client-dist/{chunk-7YT7BGBD.js.map → chunk-GKKG77XM.js.map} +0 -0
- /package/client-dist/{chunk-ZZRTMXBT.js.map → chunk-GPAB3FYW.js.map} +0 -0
- /package/client-dist/{chunk-NCOPOED7.js.map → chunk-HK42XXL4.js.map} +0 -0
- /package/client-dist/{chunk-VQSRIIPK.js.map → chunk-KB4N3NQJ.js.map} +0 -0
- /package/client-dist/{chunk-7SCYMYZG.js.map → chunk-KM4V4ZQZ.js.map} +0 -0
- /package/client-dist/{chunk-XKS3GVP3.js.map → chunk-KYW5YFHW.js.map} +0 -0
- /package/client-dist/{chunk-QXIUTGNM.js.map → chunk-LUJCXLWT.js.map} +0 -0
- /package/client-dist/{chunk-3LPBF4AU.js.map → chunk-M5ZAOY2Y.js.map} +0 -0
- /package/client-dist/{chunk-TNGH7PJP.js.map → chunk-MJJNEYN2.js.map} +0 -0
- /package/client-dist/{chunk-IGWJMU5B.js.map → chunk-NEGX5HML.js.map} +0 -0
- /package/client-dist/{chunk-KHVPVWG7.js.map → chunk-NGFX2IRI.js.map} +0 -0
- /package/client-dist/{chunk-E6DWNZNG.js.map → chunk-NH77DCAE.js.map} +0 -0
- /package/client-dist/{chunk-CN76LOPU.js.map → chunk-NLYXP47X.js.map} +0 -0
- /package/client-dist/{chunk-FID2RUXN.js.map → chunk-PBI4ECTK.js.map} +0 -0
- /package/client-dist/{chunk-I4V3JDZC.js.map → chunk-QF6DLZ66.js.map} +0 -0
- /package/client-dist/{chunk-ZLCRMQAK.js.map → chunk-QFD5FURA.js.map} +0 -0
- /package/client-dist/{chunk-AQD6DEHR.js.map → chunk-QGUF3JAC.js.map} +0 -0
- /package/client-dist/{chunk-IUCQWZ34.js.map → chunk-RKWECXJW.js.map} +0 -0
- /package/client-dist/{chunk-ZW4M7CJ2.js.map → chunk-THHGTIDJ.js.map} +0 -0
- /package/client-dist/{chunk-4AVVQGND.js.map → chunk-TZIBF6RE.js.map} +0 -0
- /package/client-dist/{chunk-A3RMSX34.js.map → chunk-WI4NEQOH.js.map} +0 -0
- /package/client-dist/{chunk-GNWPRBF5.js.map → chunk-X2RTRMJW.js.map} +0 -0
- /package/client-dist/{chunk-DPXSAO23.js.map → chunk-X4RAIC74.js.map} +0 -0
- /package/client-dist/{chunk-7MZ4N75F.js.map → chunk-XJDLUP33.js.map} +0 -0
- /package/client-dist/{chunk-ZPE6HI3H.js.map → chunk-YR6NTERF.js.map} +0 -0
- /package/client-dist/{chunk-P7Z33WJF.js.map → chunk-ZTXRLQE6.js.map} +0 -0
- /package/client-dist/{consultant.module-J2JDO2WS.js.map → consultant.module-UR6QVGHX.js.map} +0 -0
- /package/client-dist/{crd.module-SCW4OTC2.js.map → crd.module-VBL7AIQU.js.map} +0 -0
- /package/client-dist/{dashboard.module-F55QGGVH.js.map → dashboard.module-NM4D5NW3.js.map} +0 -0
- /package/client-dist/{do.module-7FRBSMAA.js.map → do.module-IILFMQ4A.js.map} +0 -0
- /package/client-dist/{document-library.module-B6VXHRG7.js.map → document-library.module-2DB3MQAW.js.map} +0 -0
- /package/client-dist/{embedding-eval.module-NPC3TEIO.js.map → embedding-eval.module-WSWE67IJ.js.map} +0 -0
- /package/client-dist/{embedding-registry.module-LIVVEPZY.js.map → embedding-registry.module-SG3ZJKPN.js.map} +0 -0
- /package/client-dist/{err.module-YOIHNORT.js.map → err.module-ALQB32AB.js.map} +0 -0
- /package/client-dist/{feedback.module-V5KVPNYZ.js.map → feedback.module-Y2YSFOAJ.js.map} +0 -0
- /package/client-dist/{host-runtime-mcp.module-PHWXY4PV.js.map → host-runtime-mcp.module-YZ6D6IOC.js.map} +0 -0
- /package/client-dist/{live-dev-pipeline.module-NGFZQDD3.js.map → live-dev-pipeline.module-2IEAOW5B.js.map} +0 -0
- /package/client-dist/{logs.module-U22RMCHY.js.map → logs.module-6654WNYH.js.map} +0 -0
- /package/client-dist/{main-E47XWCXH.js.map → main-P264JJGJ.js.map} +0 -0
- /package/client-dist/{master-control-remote-poc.module-EBA63OMO.js.map → master-control-remote-poc.module-CKHW6KMI.js.map} +0 -0
- /package/client-dist/{mobile-app.module-SRY6NVNR.js.map → mobile-app.module-LLBTOC54.js.map} +0 -0
- /package/client-dist/{model-registry.module-UTATZZJR.js.map → model-registry.module-MLQXILLQ.js.map} +0 -0
- /package/client-dist/{orc.module-MKANMSGC.js.map → orc.module-EHJZJMOJ.js.map} +0 -0
- /package/client-dist/{project-management.module-4LL5UVW5.js.map → project-management.module-QW2OUHID.js.map} +0 -0
- /package/client-dist/{project-source-routed.module-DSUCIWHV.js.map → project-source-routed.module-ZRIGHKPE.js.map} +0 -0
- /package/client-dist/{scheduler.module-COHLY6ZF.js.map → scheduler.module-3ZZRNJUV.js.map} +0 -0
- /package/client-dist/{set.module-PUU5N4MJ.js.map → set.module-DQOBFJCH.js.map} +0 -0
- /package/client-dist/{setup.module-HPV5JS3I.js.map → setup.module-R2TZA42H.js.map} +0 -0
- /package/client-dist/{terminals.module-VIWV443T.js.map → terminals.module-4NZBPA65.js.map} +0 -0
- /package/client-dist/{voice-notes-poc.module-ZNRSQ6XH.js.map → voice-notes-poc.module-UZUWDFZD.js.map} +0 -0
- /package/client-dist/{wfs.module-CIG5GOVA.js.map → wfs.module-4GKFJ5LB.js.map} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as R,b as O}from"./chunk-
|
|
1
|
+
import{a as R,b as O}from"./chunk-QGUF3JAC.js";import{a as q}from"./chunk-NH77DCAE.js";import{a as g}from"./chunk-UFBTR2BG.js";import{a as U}from"./chunk-APYQ4B27.js";import{e as P}from"./chunk-TZIBF6RE.js";import{h as y,j as L}from"./chunk-QFD5FURA.js";import{p as D}from"./chunk-HHHXXHAW.js";import{C as v,R as T,a as h,aa as p,b as f,h as E,k as d,y as A}from"./chunk-TBMJSIBB.js";var S=E(D());var _=class u{static compareAsc(C,e){let s=(C.sequence??0)-(e.sequence??0);if(s!==0)return s;let n=typeof C.timestamp=="string"?C.timestamp:"",t=typeof e.timestamp=="string"?e.timestamp:"",o=n.localeCompare(t);if(o!==0)return o;let i=typeof C.messageKey=="string"?C.messageKey:"",r=typeof e.messageKey=="string"?e.messageKey:"";return i.localeCompare(r)}static sortAsc(C){return[...C].sort(u.compareAsc)}};var M=E(D());var x=(()=>{class u{parent;agentToolUseIds=new Set;activeSubAgentId="";toolUseIdToName=new Map;init(e){this.parent=e}resetTrackingState(){this.toolUseIdToName.clear(),this.agentToolUseIds.clear(),this.activeSubAgentId=""}handleSocketEvent(e,s){let n=e.event,t=e.payload;try{let o=typeof t.ccapId=="string"?t.ccapId:"";if(n!=="cc:rate-limit-update"&&n!=="ext-session-msg:message"&&n!=="ext-session-msg:update"&&o&&s.selectedCcapId&&o!==s.selectedCcapId){M.DyFM_Log.info(`CCAP_CcSession_DS | socket event dropped by instance filter | event: ${n} | eventCcapId: ${o} | selectedCcapId: ${s.selectedCcapId}`);return}switch(n){case"cc-session:status":this.handleStatusUpdate(t);break;case"cc-session:output":this.handleOutputChunk(t);break;case"cc-session:event":this.handleSessionEvent(t);break;case"cc-session:list-update":this.handleListUpdate(t);break;case"cc-session:session-update":this.handleSessionItemUpdate(t);break;case"agent-events":this.handleAgentEvent(t);break;case"ext-session-msg:message":this.handleAssembledMessage(t);break;case"ext-session-msg:update":this.handleAssembledMessageUpdate(t);break;case"cc:rate-limit-update":this.handleRateLimitBroadcast(t);break}}catch(o){let i=o instanceof Error?o.message:String(o);M.DyFM_Log.error(`CCAP_CcSession_DS | socket event error | event: ${n}`,o),s.globalErrorShowError(o instanceof Error?o:new Error(`CC Session socket event processing failed: ${n} \u2014 ${i}`),"cc-session-socket-event")}}pushConsoleMessageFromEvent(e,s,n){let t=e.data;switch(e.eventType){case"response-chunk":{this.pushResponseChunkBlocks(t);break}case"tool-call-start":{let o=t.name??t.tool_name??"unknown",i=typeof t.id=="string"?t.id:"";i&&this.toolUseIdToName.set(i,o),o==="Agent"&&i&&this.agentToolUseIds.add(i);let r=t.input,a=r?u.summarizeToolInput(r):"",l=a?`${o}: ${a}`:o,c=o==="Edit"?u.buildEditExpandableContent(r):void 0,m=o==="Agent"?"":this.activeSubAgentId;this.parent.pushConsoleMessage({type:"tool",text:l,expandableContent:c,rawData:t,parentAgentId:m||void 0});break}case"tool-call-end":{let o=t.content??t.output,i=typeof o=="string"?o:"",r=i.length>200?i.substring(0,200)+"\u2026":i;if(r){let a=i.length>200?i:void 0;this.parent.pushConsoleMessage({type:"tool-result",text:r,expandableContent:a,rawData:t,parentAgentId:this.activeSubAgentId||void 0})}break}case"response-complete":{this.activeSubAgentId="";let o=t.cost_usd,i=typeof o=="number"?` ($${o.toFixed(4)})`:"",r=typeof t.model=="string"?` \xB7 ${t.model}`:"";this.parent.pushConsoleMessage({type:"result",text:`Response complete${r}${i}`,rawData:t,expandableContent:JSON.stringify(t,null,2)}),this.accumulateUsage(t);break}case"prompt-sent":{let o=typeof t.content=="string"?t.content:"";o&&(this.parent.consoleMessages_$().some(a=>a.type==="prompt"&&a.text===o.trim())||this.parent.pushConsoleMessage({type:"prompt",text:o,rawData:t,expandableContent:JSON.stringify(t,null,2)}));break}case"status-change":{let o=typeof t.from=="string"?t.from:"",i=typeof t.to=="string"?t.to:"";if(i){let r=typeof t.statusMessage=="string"?t.statusMessage:void 0,a=o?`${o} \u2192 ${i}`:i,l=r?`${a} \u2014 ${r}`:a;this.parent.pushConsoleMessage({type:"status",text:l,isStatus:!0,rawData:t,expandableContent:JSON.stringify(t,null,2)})}break}case"config-change":{let o=t.update,i=o&&typeof o=="object"?Object.keys(o).join(", "):"unknown";this.parent.pushConsoleMessage({type:"info",text:`Config updated: ${i}`,rawData:t,expandableContent:JSON.stringify(t,null,2)});break}case"error":{let o=typeof t.message=="string"?t.message:"Unknown error";this.parent.pushConsoleMessage({type:"error",text:o,rawData:t,expandableContent:JSON.stringify(t,null,2)}),s&&n(new Error(`CC Session error: ${o}`),"cc-session-event");break}case"usage-update":{this.accumulateUsage(t);break}case"cli-chunk":{this.handleCliChunkEvent(t);break}case"runner-overflow":{let i=`Runner buffer overflow: ${typeof t.droppedCount=="number"?t.droppedCount:0} output items lost during server disconnect`;this.parent.pushConsoleMessage({type:"error",text:i,rawData:t,expandableContent:JSON.stringify(t,null,2)});break}case"interrupted-prompt":{let o=typeof t.reason=="string"?t.reason:"",i=typeof t.lastPrompt=="string"?t.lastPrompt:"",r=i.length>80?i.substring(0,80)+"\u2026":i,a=r?`Prompt interrupted (${o}): "${r}"`:`Prompt interrupted${o?" ("+o+")":""}`;this.parent.pushConsoleMessage({type:"status",text:a,isStatus:!0,rawData:t,expandableContent:JSON.stringify(t,null,2)});break}case"session-init":{let o=typeof t.model=="string"?t.model:"",i=typeof t.claudeCodeVersion=="string"?t.claudeCodeVersion:"",r=typeof t.permissionMode=="string"?t.permissionMode:"",a=[];o&&a.push(o),r&&a.push(r),i&&a.push(`v${i}`);let l=a.length>0?`CLI init: ${a.join(" \xB7 ")}`:"CLI initialized",c=JSON.stringify(t,null,2);this.parent.pushConsoleMessage({type:"info",text:l,rawData:t,expandableContent:c});break}case"config-mismatch":{let o=t.mismatches,i=Array.isArray(o)?o.map(r=>`${r.field}: requested "${r.requested}" \u2192 actual "${r.actual}"`).join(", "):"unknown mismatch";this.parent.pushConsoleMessage({type:"error",text:`Config mismatch: ${i}`,rawData:t,expandableContent:JSON.stringify(t,null,2)});break}case"cli-args-record":{let o=typeof t.model=="string"?t.model:"default",i=typeof t.reasoningEffort=="string"?t.reasoningEffort:"default",r=typeof t.mode=="string"?t.mode:"normal",a=typeof t.permissionPolicy=="string"?t.permissionPolicy:"default",l=`CLI spawn: model=${o} \xB7 effort=${i} \xB7 mode=${r} \xB7 permission=${a}`;this.parent.pushConsoleMessage({type:"info",text:l,rawData:t,expandableContent:JSON.stringify(t,null,2)});break}case"stdout-line":case"stderr-line":break;default:{let o=e.eventType;this.parent.pushConsoleMessage({type:"raw",text:o,rawData:t});break}}}handleStatusUpdate(e){let s=e.sessionId??"",n=e.status??"",t=e.statusMessage;this.parent.lastStatusUpdate_$.set({sessionId:s,status:n,statusMessage:t});let i=this.parent.sessions_$().map(a=>a.sessionId===s?f(h({},a),{status:n,statusMessage:t}):a);this.parent.sessions_$.set(i);let r=this.parent.selectedSession_$();if(r?.session.sessionId===s){let a=u.isLiveCcSessionStatus(n);this.parent.selectedSession_$.set(f(h({},r),{session:f(h({},r.session),{status:n,statusMessage:t}),runtime:f(h({},r.runtime),{isLive:a,runtimeStatus:n})}))}if(n==="errored"){let a=(t??"").trim();if(a.startsWith("Auto-recovery: terminal runner dropped silently")||a.startsWith("Exit code:"))M.DyFM_Log.warn(`CCAP_CcSession | user-task-fail diagnostic (NOT recorded to /errors) | sessionId: ${s} | statusMessage: ${a}`);else{let c=t?`CC Session error (${s}): ${t}`:`CC Session error (${s}): session entered errored state`;this.parent.showGlobalError(new Error(c),"cc-session-status")}}this.parent.evaluateSessionEventsPolling()}handleOutputChunk(e){let s=e.sessionId??"";if(s&&s!==this.parent.activeSessionId_$())return;let n=e.content??"",t=e.type??"stdout",o=this.parent.liveOutput_$(),i=n.split(`
|
|
2
2
|
`),r=3e3;if(t==="stderr"){let c=new Set(this.parent.liveStderrLines_$()),m=o.length;for(let b=0;b<i.length;b++)c.add(m+b);this.parent.liveStderrLines_$.set(c)}let l=[...o,...i];if(l.length>r){let c=l.length-r,m=l.slice(c),b=this.parent.liveStderrLines_$(),I=new Set;for(let w of b){let $=w-c;$>=0&&I.add($)}this.parent.liveStderrLines_$.set(I),this.parent.liveOutput_$.set(m)}else this.parent.liveOutput_$.set(l)}handleSessionEvent(e){let s=e.sessionId??"";if(s&&s!==this.parent.activeSessionId_$())return;let n=e.event??{},t={sessionId:s,eventType:n.eventType??"",timestamp:n.timestamp??"",data:n.data??{},sequence:n.sequence??0,eventSource:typeof n.eventSource=="string"?n.eventSource:void 0};if(t.sequence<=this.parent.getLastKnownEventSequence())return;this.parent.setLastKnownEventSequence(t.sequence);let o=this.parent.selectedSessionEvents_$();this.parent.selectedSessionEvents_$.set([...o,t]),this.pushConsoleMessageFromEvent(t,!0,(i,r)=>{this.parent.showGlobalError(i,r)})}handleAgentEvent(e){let s=typeof e.phase=="string"?e.phase:void 0;if(s)switch(s){case g.runInitialization:this.parent.pushConsoleMessage({type:"status",text:"RUN initialization",isStatus:!0});break;case g.analyze:this.parent.pushConsoleMessage({type:"status",text:"Analyzing incoming message",isStatus:!0});break;case g.analyzeResult:{let n=typeof e.runIntent=="string"?e.runIntent:"";n&&this.parent.pushConsoleMessage({type:"run-intent",text:n,isStatus:!1});break}case g.assemble:this.parent.pushConsoleMessage({type:"status",text:"Refreshing Context",isStatus:!0});break;case g.executionStart:this.parent.pushConsoleMessage({type:"status",text:"Starting Agent",isStatus:!0});break;case g.llmAgenticLoop:this.parent.pushConsoleMessage({type:"status",text:"Selecting next move",isStatus:!0});break;case g.agenticLoopIteration:{let n=typeof e.action=="string"?e.action:"",t=typeof e.tool=="string"?e.tool:"",o=typeof e.intent=="string"?e.intent:"",i=[];n&&i.push(n),t&&i.push(t),o&&i.push(o);let r=i.join(" \xB7 ");r&&this.parent.pushConsoleMessage({type:"iteration",text:r,isStatus:!1});break}case g.llmToolDescription:this.parent.pushConsoleMessage({type:"status",text:"Assembling tool inputs",isStatus:!0});break;case g.llmToolErrorRetry:this.parent.pushConsoleMessage({type:"status",text:"Figuring out what's wrong",isStatus:!0});break;case g.toolErrorRetry:this.parent.pushConsoleMessage({type:"status",text:"Trying to fix inputs",isStatus:!0});break;case g.executionEnd:this.parent.pushConsoleMessage({type:"status",text:"Finishing run",isStatus:!0});break;case g.finalization:case g.llmRunFinalization:this.parent.pushConsoleMessage({type:"status",text:"Gathering what we've done",isStatus:!0});break;case g.postFinalization:this.parent.pushConsoleMessage({type:"status",text:"Memorizing stuff",isStatus:!0});break;case g.runFlowComplete:this.parent.pushConsoleMessage({type:"status",text:"Getting back to user",isStatus:!0});break}}handleRateLimitBroadcast(e){let s=e.rate_limit_info;if(!s||typeof s!="object")return;let n=s,t={status:typeof n.status=="string"?n.status:"",resetsAt:typeof n.resetsAt=="number"?n.resetsAt:0,rateLimitType:typeof n.rateLimitType=="string"?n.rateLimitType:"",utilization:typeof n.utilization=="number"?n.utilization:0,surpassedThreshold:typeof n.surpassedThreshold=="number"?n.surpassedThreshold:0,isUsingOverage:n.isUsingOverage===!0,receivedAt:new Date().toISOString()};this.parent.rateLimitInfo_$.set(t)}handleListUpdate(e){let s=e.sessions??[],o=[...this.parent.sessions_$().some(i=>i.isArchived===!0)?s:s.filter(i=>!i.isArchived)].sort((i,r)=>{let a=i.lastActivityAt?new Date(i.lastActivityAt).getTime():0;return(r.lastActivityAt?new Date(r.lastActivityAt).getTime():0)-a});this.parent.sessions_$.set(o),this.mergeActiveSessionDetail(s)}handleSessionItemUpdate(e){let s=typeof e.sessionId=="string"?e.sessionId:"";if(!s)return;let n=typeof e.update=="object"&&e.update!==null?e.update:{},o=this.parent.sessions_$().map(r=>r.sessionId!==s?r:u.applySessionFieldUpdate(r,n));this.parent.sessions_$.set(o);let i=this.parent.selectedSession_$();i?.session.sessionId===s&&this.parent.selectedSession_$.set(f(h({},i),{session:u.applySessionFieldUpdate(i.session,n)}))}static applySessionFieldUpdate(e,s){let n=h({},e);return typeof s.toolCallCountIncrement=="number"&&(n.toolCallCount=(n.toolCallCount??0)+s.toolCallCountIncrement),typeof s.promptCountIncrement=="number"&&(n.promptCount=(n.promptCount??0)+s.promptCountIncrement),typeof s.inputTokensIncrement=="number"&&(n.inputTokensTotal=(n.inputTokensTotal??0)+s.inputTokensIncrement),typeof s.outputTokensIncrement=="number"&&(n.outputTokensTotal=(n.outputTokensTotal??0)+s.outputTokensIncrement),typeof s.costUsdIncrement=="number"&&(n.costUsdTotal=(n.costUsdTotal??0)+s.costUsdIncrement),typeof s.status=="string"&&(n.status=s.status),(typeof s.statusMessage=="string"||s.statusMessage===void 0)&&(n.statusMessage=s.statusMessage),typeof s.lastActivityAt=="string"&&(n.lastActivityAt=s.lastActivityAt),typeof s.lastPrompt=="string"&&(n.lastPrompt=s.lastPrompt),typeof s.activeModel=="string"&&(n.activeModel=s.activeModel),n}mergeActiveSessionDetail(e){let s=this.parent.activeSessionId_$();if(!s)return;let n=this.parent.selectedSession_$();if(!n)return;let t=e.find(o=>o.sessionId===s);t&&this.parent.selectedSession_$.set(f(h({},n),{session:h(h({},n.session),t)}))}handleAssembledMessage(e){let s=typeof e.sessionId=="string"?e.sessionId:"",n=this.parent.activeSessionId_$();if(!s||s!==n)return;let t=e.message;if(!t||typeof t!="object"){M.DyFM_Log.warn("CCAP_CcSession_DS | handleAssembledMessage dropped: invalid message payload",{sessionId:s,payloadKeys:Object.keys(e)});return}let o=t,i=this.parent.assembledMessages_$(),r=typeof o.messageKey=="string"?o.messageKey:"";r&&i.some(a=>a.messageKey===r)||this.parent.assembledMessages_$.set(_.sortAsc([...i,o]))}handleAssembledMessageUpdate(e){let s=typeof e.sessionId=="string"?e.sessionId:"";if(!s||s!==this.parent.activeSessionId_$())return;let n=typeof e.messageKey=="string"?e.messageKey:"";if(!n)return;let t=e.update;if(!t||typeof t!="object")return;let o=t,i=this.parent.assembledMessages_$(),r=i.findIndex(c=>c.messageKey===n);if(r<0)return;let a=h({},i[r]);typeof o.bodyText=="string"&&(a.bodyText=o.bodyText),o.toolResult!==void 0&&(a.toolResult=o.toolResult),typeof o.toolStatus=="string"&&(a.toolStatus=o.toolStatus),o.headerStatusDot!==void 0&&(a.headerStatusDot=typeof o.headerStatusDot=="string"?o.headerStatusDot:void 0);let l=[...i];l[r]=a,this.parent.assembledMessages_$.set(l)}handleCliChunkEvent(e){let s=typeof e.type=="string"?e.type:"";if(s==="rate_limit_event"){let n=e.rate_limit_info;if(n&&typeof n=="object"){let t=n,o={status:typeof t.status=="string"?t.status:"",resetsAt:typeof t.resetsAt=="number"?t.resetsAt:0,rateLimitType:typeof t.rateLimitType=="string"?t.rateLimitType:"",utilization:typeof t.utilization=="number"?t.utilization:0,surpassedThreshold:typeof t.surpassedThreshold=="number"?t.surpassedThreshold:0,isUsingOverage:t.isUsingOverage===!0,receivedAt:new Date().toISOString()};this.parent.rateLimitInfo_$.set(o)}return}if(s==="system"){this.handleCliChunkSystemEvent(e);return}this.handleCliChunkToolResults(e)||this.parent.pushConsoleMessage({type:"raw",text:s||"cli-chunk",rawData:e})}handleCliChunkSystemEvent(e){let s=typeof e.subtype=="string"?e.subtype:"",n=typeof e.description=="string"?e.description:u.buildSystemEventBrief({subtype:s,data:e}),t=typeof e.tool_use_id=="string"?e.tool_use_id:"";t&&this.agentToolUseIds.has(t)&&(this.activeSubAgentId=t);let o=t&&this.agentToolUseIds.has(t)?t:this.activeSubAgentId||void 0,i=typeof e.last_tool_name=="string"?e.last_tool_name:"";if(s==="task_progress"&&i){this.parent.pushConsoleMessage({type:"tool",text:`${i}: ${n}`,isStatus:!1,rawData:e,parentAgentId:o});return}this.parent.pushConsoleMessage({type:"status-update",text:n,subtype:s,isStatus:!1,rawData:e,parentAgentId:o})}pushResponseChunkBlocks(e){let s=e.message,n=s&&typeof s=="object"?s.content:e.content;if(Array.isArray(n)){for(let t of n){if(!t||typeof t!="object")continue;let o=t,i=typeof o.type=="string"?o.type:"";if(i==="text"){let r=typeof o.text=="string"?o.text:"";r&&(this.activeSubAgentId="",this.parent.pushConsoleMessage({type:"assistant",text:r,rawData:e}))}else if(i==="tool_use")this.handleResponseChunkToolUse(o,e);else if(i==="tool_result")this.handleResponseChunkToolResult(o);else if(i==="thinking"){let r=typeof o.thinking=="string"?o.thinking:"";r&&this.parent.pushConsoleMessage({type:"thinking",text:r,rawData:o,parentAgentId:this.activeSubAgentId||void 0})}else i&&this.parent.pushConsoleMessage({type:"raw",text:i,rawData:o})}return}if(typeof n=="string"&&n){this.parent.pushConsoleMessage({type:"assistant",text:n,rawData:e});return}this.parent.pushConsoleMessage({type:"raw",text:"response-chunk",rawData:e})}handleResponseChunkToolUse(e,s){let n=typeof e.name=="string"?e.name:"unknown",t=typeof e.id=="string"?e.id:"";t&&this.toolUseIdToName.set(t,n),n==="Agent"&&t&&this.agentToolUseIds.add(t);let o=e.input,i=o?u.summarizeToolInput(o):"",r=i?`${n}: ${i}`:n,a=n==="Edit"?u.buildEditExpandableContent(o):void 0,l=n==="Agent"?"":this.activeSubAgentId;this.parent.pushConsoleMessage({type:"tool",text:r,expandableContent:a,rawData:e,parentAgentId:l||void 0})}handleResponseChunkToolResult(e){let s=typeof e.tool_use_id=="string"?e.tool_use_id:"",n=s&&this.agentToolUseIds.has(s)?s:this.activeSubAgentId||"",t=e.content??e.output,o=typeof t=="string"?t:"",i=o.length>200?o.substring(0,200)+"\u2026":o||"tool_result";this.parent.pushConsoleMessage({type:"tool-result",text:i,expandableContent:o.length>200?o:void 0,rawData:e,parentAgentId:n||void 0})}handleCliChunkToolResults(e){if((typeof e.type=="string"?e.type:"")!=="user")return!1;let n=e.message,t=n&&typeof n=="object"?n.content:null;if(!Array.isArray(t))return!1;let o=typeof e.parent_tool_use_id=="string"?e.parent_tool_use_id:"",i=!1;for(let r of t){if(!r||typeof r!="object")continue;let a=r,l=typeof a.type=="string"?a.type:"";if(l==="tool_result"){let c=typeof a.tool_use_id=="string"?a.tool_use_id:"",m=c?this.toolUseIdToName.get(c)??"":"",b=a.content,I=typeof b=="string"?b:"",w=a.is_error===!0,$=m?`${m}: `:"",k=I.length>200?I.substring(0,200)+"\u2026":I||"tool result",F=w?`${$}ERROR \u2014 ${k}`:`${$}${k}`;this.parent.pushConsoleMessage({type:"tool-result",text:F,expandableContent:I.length>200?I:void 0,rawData:f(h({},a),{parent_tool_use_id:o||void 0}),parentAgentId:o||void 0}),i=!0}else if(l==="text"&&o){let c=typeof a.text=="string"?a.text:"";if(c){let m=c.length>200?c.substring(0,200)+"\u2026":c;this.parent.pushConsoleMessage({type:"tool-result",text:m,expandableContent:c.length>200?c:void 0,rawData:{tool_use_id:o,type:"sub-agent-prompt",text:c},parentAgentId:o}),i=!0}}}return i}static isLiveCcSessionStatus(e){return e==="running"||e==="waiting-input"||e==="starting"}static buildSystemEventBrief(e){switch(e.subtype){case"init":{let s=typeof e.data.cwd=="string"?e.data.cwd:"",n=typeof e.data.model=="string"?e.data.model:"",t=["init"];return s&&t.push(s),n&&t.push(n),t.join(" \xB7 ")}case"task_updated":{let s=e.data.patch,n=s&&typeof s=="object"&&typeof s.status=="string"?s.status:"";return n?`task ${n}`:"task updated"}case"task_notification":{let s=typeof e.data.status=="string"?e.data.status:"";return s?`task ${s}`:"task notification"}default:return e.subtype||"system"}}static buildEditExpandableContent(e){if(!e||typeof e!="object")return;let s=e,n=s.old_string,t=s.new_string;if(typeof n!="string"||typeof t!="string")return;let o=500,i=n.length>o?n.substring(0,o)+"\u2026":n,r=t.length>o?t.substring(0,o)+"\u2026":t;return JSON.stringify({old:i,new:r})}static summarizeToolInput(e){if(typeof e=="string")return e.length>120?e.substring(0,120)+"\u2026":e;if(e&&typeof e=="object"){let s=e,n=s.file_path??s.path,t=s.command,o=s.pattern;if(typeof n=="string")return n;if(typeof t=="string")return t.length>120?t.substring(0,120)+"\u2026":t;if(typeof o=="string")return o}return""}accumulateUsage(e){let s=e.usage,n=typeof e.cost_usd=="number"?e.cost_usd:0,t=0,o=0;if(s&&typeof s=="object"){let r=s;t=typeof r.input_tokens=="number"?r.input_tokens:typeof r.promptTokens=="number"?r.promptTokens:0,o=typeof r.output_tokens=="number"?r.output_tokens:typeof r.completionTokens=="number"?r.completionTokens:0}let i=this.parent.sessionUsage_$();this.parent.sessionUsage_$.set({promptTokens:i.promptTokens+t,completionTokens:i.completionTokens+o,totalTokens:i.totalTokens+t+o,costUsd:i.costUsd+n})}static \u0275fac=function(s){return new(s||u)};static \u0275prov=A({token:u,factory:u.\u0275fac,providedIn:"root"})}return u})();var ne=(()=>{class u{sessions_$=p([]);sessionsLoading_$=p(!1);sessionsLoadError_$=p(null);selectedSession_$=p(null);selectedSessionLoading_$=p(!1);selectedSessionEvents_$=p([]);liveOutput_$=p([]);liveStderrLines_$=p(new Set);consoleMessages_$=p([]);assembledMessages_$=p([]);assembledMessagesHasMore_$=p(!1);isLoadingOlderMessages_$=p(!1);assembledMessagesLoaded_$=p(!1);lastStatusUpdate_$=p(null);sessionUsage_$=p({promptTokens:0,completionTokens:0,totalTokens:0,costUsd:0});rateLimitInfo_$=p(null);activeSessionId_$=p("");ccSession_AS=v(R);extSessionMsg_AS=v(q);globalError_CS=v(L);socket_CS=v(P);ngZone=v(T);peiContext_DS=v(U);socketEventHandler_CS=v(x);eventSubscription=null;reconnectSubscription=null;lastKnownEventSequence=-1;static SESSION_EVENTS_POLL_INTERVAL_MS=5*S.second;sessionEventsPollHandle=null;isSessionEventsPollInFlight=!1;constructor(){this.socketEventHandler_CS.init(this),this.eventSubscription=this.socket_CS.event$.subscribe(e=>{this.ngZone.run(()=>{this.socketEventHandler_CS.handleSocketEvent(e,{selectedCcapId:this.peiContext_DS.activeCcapId_$(),globalErrorShowError:(s,n)=>{this.globalError_CS.showError(s,n)}})})}),this.reconnectSubscription=this.socket_CS.connected$.subscribe(e=>{if(!e)return;let s=this.activeSessionId_$();s&&(this.socket_CS.emit("cc-session:subscribe",{sessionId:s}),this.loadAssembledMessages({sessionId:s}).catch(()=>{}),this.loadSessionDetail({sessionId:s}).catch(()=>{})),this.loadSessions().catch(()=>{}),this.backfillMissedEvents()})}ngOnDestroy(){this.stopSessionEventsPolling(),this.eventSubscription&&(this.eventSubscription.unsubscribe(),this.eventSubscription=null),this.reconnectSubscription&&(this.reconnectSubscription.unsubscribe(),this.reconnectSubscription=null)}showGlobalError(e,s){this.globalError_CS.showError(e,s)}getLastKnownEventSequence(){return this.lastKnownEventSequence}setLastKnownEventSequence(e){this.lastKnownEventSequence=e}evaluateSessionEventsPolling(){let e=this.activeSessionId_$(),s=this.resolveActiveSessionStatusForEventsPolling();!!(e&&this.lastKnownEventSequence>=0&&s!=null&&x.isLiveCcSessionStatus(s))?this.ensureSessionEventsPollingStarted():this.stopSessionEventsPolling()}loadSessions(e){return d(this,null,function*(){this.sessionsLoading_$.set(!0),this.sessionsLoadError_$.set(null);try{let n=[...(yield this.ccSession_AS.listSessions({status:e?.status,workspacePath:e?.workspacePath,includeArchived:e?.includeArchived})).sessions].sort((t,o)=>{let i=t.lastActivityAt?new Date(t.lastActivityAt).getTime():0;return(o.lastActivityAt?new Date(o.lastActivityAt).getTime():0)-i});this.sessions_$.set(n)}catch(s){this.sessionsLoadError_$.set(s)}finally{this.sessionsLoading_$.set(!1)}})}loadPersistedRateLimitState(e){return d(this,null,function*(){let s=e.ccapId?.trim()??"";if(s)try{let n=yield this.ccSession_AS.getRateLimitState({ccapId:s});this.mergePersistedRateLimitState(n.items)}catch(n){S.DyFM_Log.warn(`ClaudeCode_DS | loadPersistedRateLimitState failed (non-blocking) | ccapId: ${s} | ${n instanceof Error?n.message:String(n)}`)}})}mergePersistedRateLimitState(e){if(this.rateLimitInfo_$()!==null)return;let s=O.mapServerItemsToClientInfo(e);s!==null&&this.rateLimitInfo_$.set(s)}loadSessionDetail(e){return d(this,null,function*(){this.selectedSessionLoading_$.set(!0);try{let s=yield this.ccSession_AS.getSession({sessionId:e.sessionId}),n=this.activeSessionId_$();if(n&&n!==e.sessionId){S.DyFM_Log.info(`CCAP_CcSession_DS | loadSessionDetail stale response \u2014 discarded | requestedSessionId: ${e.sessionId} | currentActiveSessionId: ${n}`);return}this.selectedSession_$.set(s)}catch(s){let n=this.activeSessionId_$();if(n&&n!==e.sessionId)return;this.selectedSession_$.set(null);let t=s instanceof Error?s.message:"Failed to load session details";this.pushConsoleMessage({type:"error",text:`Load session failed: ${t}`})}finally{this.selectedSessionLoading_$.set(!1),this.evaluateSessionEventsPolling()}})}loadSessionEvents(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.getSessionEvents({sessionId:e.sessionId,eventType:e.eventType,limit:e.limit??500,latest:!0}),n=this.activeSessionId_$();if(n&&n!==e.sessionId){S.DyFM_Log.info(`CCAP_CcSession_DS | loadSessionEvents stale response \u2014 discarded | requestedSessionId: ${e.sessionId} | currentActiveSessionId: ${n}`);return}this.selectedSessionEvents_$.set(s.events),this.updateLastKnownSequence(s.events);for(let t of s.events)this.socketEventHandler_CS.pushConsoleMessageFromEvent(t,!1,(o,i)=>{this.globalError_CS.showError(o,i)});this.loadAssembledMessages({sessionId:e.sessionId}).catch(()=>{})}catch{let n=this.activeSessionId_$();if(n&&n!==e.sessionId)return;this.selectedSessionEvents_$.set([])}finally{this.evaluateSessionEventsPolling()}})}createSession(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.createSession(e),n=String(s.session.sessionId||"");return yield this.loadSessions(),n}catch(s){throw this.pushConsoleMessage({type:"error",text:`Create session failed: ${y.getErrorMessageForDisplay(s)}`}),s}})}sendPrompt(e){return d(this,null,function*(){let s=e.attachments?.filter(n=>n.isImage&&!!n.base64).map(n=>`data:${n.mimeType};base64,${n.base64}`);this.pushConsoleMessage({type:"prompt",text:e.content,imageDataUrls:s?.length?s:void 0});try{let n=yield this.ccSession_AS.sendPrompt(e);n.relayed&&(n.targetOnline?this.pushConsoleMessage({type:"info",text:`Prompt relayed to remote instance (task: ${n.taskId?.substring(0,8)}\u2026)`}):this.pushConsoleMessage({type:"error",text:`\u26A0 A t\xE1voli instance jelenleg offline \u2014 a prompt queue-ban v\xE1rakozik (task: ${n.taskId?.substring(0,8)}\u2026) \xE9s csak akkor k\xE9zbes\xEDt\u0151dik, ha a target instance online lesz. Ellen\u0151rizd, hogy mindk\xE9t instance fut, \xE9s a Settings \u2192 Cluster sharedSecret azonos.`})),this.evaluateSessionEventsPolling()}catch(n){throw this.pushConsoleMessage({type:"error",text:`Send failed: ${y.getErrorMessageForDisplay(n)}`}),this.globalError_CS.showError(n,"CC Session sendPrompt"),n}})}forkSession(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.forkSession({sessionId:e.sessionId,label:e.label}),n=String(s.session.sessionId||"");return yield this.loadSessions(),n}catch(s){throw this.pushConsoleMessage({type:"error",text:`Fork session failed: ${y.getErrorMessageForDisplay(s)}`}),s}})}resumeSession(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.resumeSession(e);s.relayed&&this.pushConsoleMessage({type:"info",text:s.targetOnline?"Resume relayed to remote instance":"Resume queued for offline remote instance"}),yield this.loadSessions()}catch(s){throw this.pushConsoleMessage({type:"error",text:`Resume failed: ${y.getErrorMessageForDisplay(s)}`}),s}})}stopExecution(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.stopExecution(e);if(s.relayed){this.pushSystemAssembledMessage({sessionId:e.sessionId,text:s.targetOnline?"Stop execution relayed to remote instance":"Stop execution queued for offline remote instance",role:"info"});return}let n=s.message||"Execution stopped";this.pushSystemAssembledMessage({sessionId:e.sessionId,text:n,role:"info"})}catch(s){throw this.pushSystemAssembledMessage({sessionId:e.sessionId,text:`Stop execution failed: ${y.getErrorMessageForDisplay(s)}`,role:"error"}),s}})}terminateSession(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.terminateSession(e);s.relayed?this.pushSystemAssembledMessage({sessionId:e.sessionId,text:s.targetOnline?"Terminate relayed to remote instance":"Terminate queued for offline remote instance",role:"info"}):this.pushSystemAssembledMessage({sessionId:e.sessionId,text:"Session terminated",role:"status"}),yield this.loadSessions()}catch(s){throw this.pushSystemAssembledMessage({sessionId:e.sessionId,text:`Terminate failed: ${y.getErrorMessageForDisplay(s)}`,role:"error"}),s}})}restartRunner(e){return d(this,null,function*(){try{let s=yield this.ccSession_AS.restartRunner(e);this.pushSystemAssembledMessage({sessionId:e.sessionId,text:`Runner restarted (new terminalId: ${s.newTerminalId.slice(0,8)}\u2026). New terminal window should open shortly.`,role:"info"})}catch(s){throw this.pushSystemAssembledMessage({sessionId:e.sessionId,text:`Runner restart failed: ${y.getErrorMessageForDisplay(s)}`,role:"error"}),s}})}setSessionArchived(e){return d(this,null,function*(){try{yield this.ccSession_AS.setSessionArchived(e),yield this.loadSessions()}catch(s){throw this.pushConsoleMessage({type:"error",text:`Archive failed: ${y.getErrorMessageForDisplay(s)}`}),s}})}updateSessionConfig(e){return d(this,null,function*(){try{yield this.ccSession_AS.updateSessionConfig(e);let s=this.selectedSession_$();if(s?.session.sessionId===e.sessionId){let n=h({},s.session);e.label!=null&&(n.label=e.label),e.mode!=null&&(n.mode=e.mode),e.permissionPolicy!=null&&(n.permissionPolicy=e.permissionPolicy),e.reasoningEffort!=null&&(n.reasoningEffort=e.reasoningEffort),e.model!=null&&(n.model=e.model),e.isDebugMode!=null&&(n.isDebugMode=e.isDebugMode),this.selectedSession_$.set(f(h({},s),{session:n}))}if(e.label!=null){let n=this.sessions_$(),t=n.findIndex(o=>o.sessionId===e.sessionId);if(t>=0){let o=[...n];o[t]=f(h({},o[t]),{label:e.label}),this.sessions_$.set(o)}}}catch(s){throw this.pushConsoleMessage({type:"error",text:`Config update failed: ${y.getErrorMessageForDisplay(s)}`}),s}})}setActiveSessionId(e){let s=this.activeSessionId_$();s!==e&&this.stopSessionEventsPolling(),s&&s!==e&&this.socket_CS.emit("cc-session:unsubscribe",{sessionId:s}),this.activeSessionId_$.set(e),e&&this.socket_CS.emit("cc-session:subscribe",{sessionId:e})}clearLiveOutput(){this.stopSessionEventsPolling(),this.liveOutput_$.set([]),this.liveStderrLines_$.set(new Set),this.consoleMessages_$.set([]),this.assembledMessages_$.set([]),this.assembledMessagesHasMore_$.set(!1),this.isLoadingOlderMessages_$.set(!1),this.assembledMessagesLoaded_$.set(!1),this.selectedSession_$.set(null),this.selectedSessionEvents_$.set([]),this.lastStatusUpdate_$.set(null),this.sessionUsage_$.set({promptTokens:0,completionTokens:0,totalTokens:0,costUsd:0}),this.lastKnownEventSequence=-1,this.socketEventHandler_CS.resetTrackingState()}pushConsoleMessage(e){let s=e.type==="assistant"||e.type==="prompt"?e.text.trim():e.text,n={listKey:e.listKey??this.allocateConsoleListKey(),type:e.type,text:s,timestamp:e.timestamp??new Date().toISOString(),isStatus:e.isStatus??!1,expandableContent:e.expandableContent,rawData:e.rawData,subtype:e.subtype,parentAgentId:e.parentAgentId,imageDataUrls:e.imageDataUrls},t=this.consoleMessages_$();this.consoleMessages_$.set([...t,n])}loadAssembledMessages(e){return d(this,null,function*(){try{let s=yield this.extSessionMsg_AS.getMessages({sessionId:e.sessionId,latest:!0}),n=this.activeSessionId_$();if(n&&n!==e.sessionId){S.DyFM_Log.info(`CCAP_CcSession_DS | loadAssembledMessages stale \u2014 discarded | requestedSessionId: ${e.sessionId} | currentActiveSessionId: ${n} | restMessageCount: ${s.messages.length}`);return}let t=this.assembledMessages_$(),o=new Set(s.messages.map(r=>r.messageKey).filter(r=>typeof r=="string"&&r.length>0)),i=t.filter(r=>!o.has(r.messageKey));this.assembledMessages_$.set(_.sortAsc([...s.messages,...i])),this.assembledMessagesHasMore_$.set(s.hasMore)}catch(s){S.DyFM_Log.error(`CCAP_CcSession_DS | loadAssembledMessages failed | sessionId: ${e.sessionId}`,s)}finally{this.assembledMessagesLoaded_$.set(!0)}})}loadOlderAssembledMessages(e){return d(this,null,function*(){if(this.isLoadingOlderMessages_$()||!this.assembledMessagesHasMore_$())return;let s=this.assembledMessages_$();if(!s.length)return;let n=s.reduce((t,o)=>(o.sequence??0)<t?o.sequence??0:t,s[0].sequence??0);this.isLoadingOlderMessages_$.set(!0);try{let t=yield this.extSessionMsg_AS.getMessages({sessionId:e.sessionId,beforeSequence:n,limit:e.limit??50});t.messages.length&&this.assembledMessages_$.set(_.sortAsc([...t.messages,...s])),this.assembledMessagesHasMore_$.set(t.hasMore)}catch(t){S.DyFM_Log.error(`CCAP_CcSession_DS | loadOlderAssembledMessages failed | sessionId: ${e.sessionId}`,t)}finally{this.isLoadingOlderMessages_$.set(!1)}})}pushSystemAssembledMessage(e){let s=this.assembledMessages_$(),n=s.length?s.reduce((o,i)=>(i.sequence??0)>o?i.sequence??0:o,0):0,t={messageKey:`sys-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,sessionId:e.sessionId,sessionType:"cc",messageRole:e.role,bodyText:e.text,timestamp:new Date().toISOString(),sequence:n+1};this.assembledMessages_$.set(_.sortAsc([...s,t])),this.pushConsoleMessage({type:e.role==="error"?"error":e.role==="status"?"status":"info",text:e.text,isStatus:e.role==="status"})}allocateConsoleListKey(){return globalThis.crypto.randomUUID()}pullEventsSinceLastKnownSequence(e){return d(this,null,function*(){let s=this.activeSessionId_$();if(!(!s||this.lastKnownEventSequence<0))try{let t=(yield this.ccSession_AS.getSessionEvents({sessionId:s,sinceSequence:this.lastKnownEventSequence})).events;if(!t.length)return;this.ngZone.run(()=>{let o=this.activeSessionId_$();if(o!==s){S.DyFM_Log.info(`CCAP_CcSession_DS | pull(${e}) stale \u2014 discarded | requestedSessionId: ${s} | currentActiveSessionId: ${o} | newEventCount: ${t.length}`);return}let i=this.selectedSessionEvents_$();this.selectedSessionEvents_$.set([...i,...t]);for(let r of t)this.socketEventHandler_CS.pushConsoleMessageFromEvent(r,!0,(a,l)=>{this.globalError_CS.showError(a,l)});this.updateLastKnownSequence(t)})}catch(n){let t=e==="poll"?"session events poll failed":"backfill failed";S.DyFM_Log.warn(`CCAP_CcSession_DS | ${t}`,n)}})}backfillMissedEvents(){return d(this,null,function*(){yield this.pullEventsSinceLastKnownSequence("backfill")})}updateLastKnownSequence(e){for(let s of e)s.sequence>this.lastKnownEventSequence&&(this.lastKnownEventSequence=s.sequence)}resolveActiveSessionStatusForEventsPolling(){let e=this.activeSessionId_$();if(!e)return null;let s=this.selectedSession_$();if(s?.session.sessionId===e)return s.session.status;let n=this.lastStatusUpdate_$();return n?.sessionId===e?n.status:this.sessions_$().find(o=>o.sessionId===e)?.status??null}ensureSessionEventsPollingStarted(){this.sessionEventsPollHandle===null&&(this.sessionEventsPollHandle=setInterval(()=>{this.onSessionEventsPollTick()},u.SESSION_EVENTS_POLL_INTERVAL_MS))}stopSessionEventsPolling(){this.sessionEventsPollHandle!==null&&(clearInterval(this.sessionEventsPollHandle),this.sessionEventsPollHandle=null),this.isSessionEventsPollInFlight=!1}onSessionEventsPollTick(){return d(this,null,function*(){if(!this.isSessionEventsPollInFlight){this.isSessionEventsPollInFlight=!0;try{yield this.pullEventsSinceLastKnownSequence("poll");let e=this.activeSessionId_$();e&&(yield this.loadAssembledMessages({sessionId:e}))}finally{this.isSessionEventsPollInFlight=!1}}})}static \u0275fac=function(s){return new(s||u)};static \u0275prov=A({token:u,factory:u.\u0275fac,providedIn:"root"})}return u})();export{ne as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-BGD62M7R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as _}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as _}from"./chunk-TZIBF6RE.js";import{I as C,p as $}from"./chunk-HHHXXHAW.js";import{C as l,a as c,aa as s,b as d,h as f,hb as S,k as n,p as a,t as h,xb as m,y as p}from"./chunk-TBMJSIBB.js";var i=f($());var g=(()=>{class e{http=l(m);coordinatorUrl(t){return`${C.api.baseUrl}/session/${t}/coordinator`}getStatus(t){return a(this.http.get(this.coordinatorUrl(t)))}startCoordinator(t){return a(this.http.post(this.coordinatorUrl(t.sessionId),{providerName:t.providerName,model:t.model,workflowId:t.workflowId,projectId:t.projectId}))}stopCoordinator(t){return a(this.http.delete(this.coordinatorUrl(t)))}pauseCoordinator(t){return a(this.http.post(`${this.coordinatorUrl(t)}/pause`,{}))}resumeCoordinator(t){return a(this.http.post(`${this.coordinatorUrl(t)}/resume`,{}))}listCoordinators(t){return a(this.http.get(`${this.coordinatorUrl(t)}/list`))}static \u0275fac=function(o){return new(o||e)};static \u0275prov=p({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var b="coordinator:",j=(()=>{class e{coordinator_AS=l(g);socket_CS=l(_);coordinator_$=s(null);decisions_$=s([]);lastGenerationStats_$=s(null);userInteractionPrompt_$=s(null);isLoading_$=s(!1);globalCoordinatorsList_$=s([]);globalCoordinatorsListLoading_$=s(!1);coordinatedSessionIds_$=S(()=>{let t=new Set;for(let o of this.globalCoordinatorsList_$()){let r=(o.status??"").trim().toLowerCase();if(r==="stopped"||r==="completed")continue;let u=o.sessionId?.trim();u&&t.add(u)}return t});activeSessionId=null;socketSubscription=null;ngOnDestroy(){this.cleanupSocketSubscription()}loadAllCoordinatorsForManagementPage(){return n(this,null,function*(){this.globalCoordinatorsListLoading_$.set(!0);try{let t=yield this.coordinator_AS.listCoordinators("_all");this.globalCoordinatorsList_$.set(t.coordinators??[])}catch(t){i.DyFM_Error.logSimple("CCAP_Coordinator_DS | loadAllCoordinatorsForManagementPage failed",t)}finally{this.globalCoordinatorsListLoading_$.set(!1)}})}loadCoordinatorStatus(t){return n(this,null,function*(){try{this.isLoading_$.set(!0);let o=yield this.coordinator_AS.getStatus(t);this.coordinator_$.set(o.coordinator),o.coordinator&&(this.decisions_$.set(o.coordinator.decisions??[]),this.setupSocketListeners(t))}catch(o){i.DyFM_Error.logSimple("CCAP_Coordinator_DS | loadCoordinatorStatus failed",o),this.coordinator_$.set(null)}finally{this.isLoading_$.set(!1)}})}startCoordinator(t){return n(this,null,function*(){try{this.isLoading_$.set(!0),this.decisions_$.set([]),this.userInteractionPrompt_$.set(null),this.lastGenerationStats_$.set(null);let o=yield this.coordinator_AS.startCoordinator(t);this.coordinator_$.set(o.coordinator),this.setupSocketListeners(t.sessionId)}catch(o){throw i.DyFM_Error.logSimple("CCAP_Coordinator_DS | startCoordinator failed",o),o}finally{this.isLoading_$.set(!1)}})}stopCoordinator(t){return n(this,null,function*(){try{yield this.coordinator_AS.stopCoordinator(t),this.coordinator_$.set(null),this.cleanupSocketSubscription()}catch(o){throw i.DyFM_Error.logSimple("CCAP_Coordinator_DS | stopCoordinator failed",o),o}})}pauseCoordinator(t){return n(this,null,function*(){try{yield this.coordinator_AS.pauseCoordinator(t),yield this.loadCoordinatorStatus(t)}catch(o){throw i.DyFM_Error.logSimple("CCAP_Coordinator_DS | pauseCoordinator failed",o),o}})}resumeCoordinator(t){return n(this,null,function*(){try{this.userInteractionPrompt_$.set(null),yield this.coordinator_AS.resumeCoordinator(t),yield this.loadCoordinatorStatus(t)}catch(o){throw i.DyFM_Error.logSimple("CCAP_Coordinator_DS | resumeCoordinator failed",o),o}})}setupSocketListeners(t){this.activeSessionId!==t&&(this.cleanupSocketSubscription(),this.activeSessionId=t,this.socketSubscription=this.socket_CS.event$.pipe(h(o=>o.event.startsWith(b))).subscribe(o=>{let r=o.payload&&typeof o.payload=="object"?o.payload:{};this.handleSocketEvent(o.event,r)}),i.DyFM_Log.info(`CCAP_Coordinator_DS | Socket subscription setup for session: ${t}`))}handleSocketEvent(t,o){switch(t){case"coordinator:stepCompleted":this.handleStepCompleted(o);break;case"coordinator:userInteractionRequired":this.handleUserInteractionRequired(o);break;case"coordinator:error":this.handleError(o);break;case"coordinator:resumed":this.userInteractionPrompt_$.set(null),this.coordinator_$.update(r=>r&&d(c({},r),{status:"active",pauseReason:null}));break;case"coordinator:completed":this.coordinator_$.update(r=>{if(!r)return r;let u=o.success?"completed":"failed";return d(c({},r),{status:u})});break;default:break}}handleStepCompleted(t){let o={coordinatorId:String(t.coordinatorId??""),sessionId:String(t.sessionId??""),action:String(t.action??""),reasoning:String(t.reasoning??""),generationStats:t.generationStats?t.generationStats:void 0},r={action:o.action,messageToAgent:null,statusUpdates:[],reasoning:o.reasoning,stopReason:null,userInteractionDetails:null,timestamp:new Date().toISOString()};this.decisions_$.set([...this.decisions_$(),r]),o.generationStats&&this.lastGenerationStats_$.set({timestamp:new Date().toISOString(),model:o.generationStats.model,providerName:o.generationStats.providerName,inputTokens:o.generationStats.inputTokens,outputTokens:o.generationStats.outputTokens,responseTimeMs:o.generationStats.responseTimeMs,action:o.action,reasoning:o.reasoning,messageToAgent:null})}handleUserInteractionRequired(t){this.userInteractionPrompt_$.set(String(t.details??"")),this.coordinator_$.update(o=>o&&d(c({},o),{status:"paused",pauseReason:String(t.details??"")}))}handleError(t){this.coordinator_$.update(o=>o&&d(c({},o),{status:"paused",pauseReason:String(t.error??"Unknown error")}))}cleanupSocketSubscription(){this.socketSubscription&&(this.socketSubscription.unsubscribe(),this.socketSubscription=null),this.activeSessionId=null}static \u0275fac=function(o){return new(o||e)};static \u0275prov=p({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BKR6H3SJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as H,b as Ae}from"./chunk-DPXSAO23.js";import{a as we}from"./chunk-UFBTR2BG.js";import{a as te,b as p}from"./chunk-6Y7O2W4H.js";import{a as Ie,b as ge,c as ve,d as Re}from"./chunk-ZZ7RWOLH.js";import{a as Ce}from"./chunk-7YT7BGBD.js";import{e as ye}from"./chunk-4AVVQGND.js";import{L as he,p as ee,t as ae}from"./chunk-TIJCR5DW.js";import{C as x,a as R,aa as P,b as A,d as Se,h as J,hb as D,jb as me,k as $,wb as fe,y as Z}from"./chunk-TBMJSIBB.js";var M=function(i){return i.standing="standing",i.working="working",i.sitting="sitting",i.walkingIn="walking-in",i.walkingOut="walking-out",i.walkingBetween="walking-between",i.idleWalking="idle-walking",i}(M||{});var O=function(i){return i.workstation="workstation",i.rest="rest",i.meeting="meeting",i}(O||{});var C=function(i){return i.ccap="ccap",i.openclaw="openclaw",i.ccSession="cc-session",i.caSession="ca-session",i}(C||{});var X=function(i){return i.average="average",i.slim="slim",i.stocky="stocky",i.athletic="athletic",i}(X||{});var Y=function(i){return i.casual="casual",i.formal="formal",i.hoodie="hoodie",i.tshirt="tshirt",i}(Y||{});var j=function(i){return i.short="short",i.long="long",i.spiky="spiky",i.curly="curly",i.bald="bald",i.mohawk="mohawk",i}(j||{});var it=["#f5c592","#e8a96e","#d4845a","#c06a3c","#9b5930","#7a3d1c","#4a2412"],ot=["#1a1006","#3b2505","#6b3d11","#9b6720","#c9a227","#e8d5a3","#f0f0f0","#a0a0a0","#2a4080","#8b1a2a"],at=["#1e40af","#166534","#7f1d1d","#4c1d95","#134e4a","#713f12","#374151","#6b21a8","#0f766e","#1e3a5f","#b45309","#be185d","#475569"],rt=["#1e293b","#374151","#292524","#1e3a5f","#1a2e05","#2d1b69","#3b1a08","#1a1a2e"],ct=["#1a1a1a","#3b5998","#2d8a4e","#8b4513","#4b0082","#5f9ea0"],b={skinColor:"#e8a96e",hairColor:"#1a1006",hairStyle:j.short,shirtColor:"#1e40af",clothingStyle:Y.casual,pantsColor:"#1e293b",eyeColor:"#1a1a1a",bodyType:X.average,displayName:""},_={skinColor:"#b0bec5",hairColor:"#37474f",hairStyle:j.short,shirtColor:"#0288d1",clothingStyle:Y.tshirt,pantsColor:"#263238",eyeColor:"#00bcd4",bodyType:X.average,displayName:""},L={skinColor:"#d4c4a8",hairColor:"#2d1b0e",hairStyle:j.short,shirtColor:"#5b21b6",clothingStyle:Y.casual,pantsColor:"#312e81",eyeColor:"#4338ca",bodyType:X.average,displayName:""},N={skinColor:"#e2e8f0",hairColor:"#0f172a",hairStyle:j.short,shirtColor:"#0d9488",clothingStyle:Y.casual,pantsColor:"#134e4a",eyeColor:"#14b8a6",bodyType:X.average,displayName:""};var Me=2e3;var F=(()=>{class i{static officeInstanceIdPrefix="cai:";static build(e){return`${i.officeInstanceIdPrefix}${e.ccapId.trim()}`}static parseCcapId(e){let t=e.trim();if(!t.startsWith(i.officeInstanceIdPrefix))return null;let s=t.slice(i.officeInstanceIdPrefix.length).trim();return s.length>0?s:null}}return i})();var U=(()=>{class i{static officeInstanceIdPrefix="cci:";static build(e){return`${i.officeInstanceIdPrefix}${e.ccapId.trim()}`}static parseCcapId(e){let t=e.trim();if(!t.startsWith(i.officeInstanceIdPrefix))return null;let s=t.slice(i.officeInstanceIdPrefix.length).trim();return s.length>0?s:null}}return i})();var E=class i{static clampGrid(n){return{workstationCols:i.clampDim(n.workstationCols),workstationRows:i.clampDim(n.workstationRows),restCols:i.clampDim(n.restCols),restRows:i.clampDim(n.restRows),meetingCols:i.clampDim(n.meetingCols),meetingRows:i.clampDim(n.meetingRows)}}static computeDerived(n){let e=i.clampGrid(n),t=4*32,s=3*32,a=i.computeWorkspaceWidthPx(e.workstationCols),o=i.computeLoungeWidthPx(e.restCols),r=6*32,c=a+r+o,u=8*32,l=c+u,d=e.workstationRows*6*32,f=3*32+e.meetingRows*5*32+3*32,h=Math.max(2*32,Math.round(f/2)),I=s+d,S=2*32,m=I+h+32,g=t-32,w=S,y=c+2*32,v=m-w,k=m+3*32,T={x:t,y:s,w:a,h:d},G={x:t+a,y:s,w:r,h:m-s},B={x:t+a+r,y:s,w:o,h:m-s},oe={x:t,y:I,w:a,h},De=t+a,ue=t+a+r,Oe=I,be={x:G.x+Math.round(G.w/2),y:m-2*32},_e=i.buildWorkstationSlots(e,T),de=i.buildMeetingSlots(e,oe),Le=i.buildWorkstationDesks(e,T),pe=i.buildLoungeSeatingLayout(e,B),Ne=pe.restSlots,We=pe.loungeSofas,$e=i.buildConferenceFurniture(oe,de),Fe=t+Math.round(a/2),Ue=ue+Math.round(o/2),Ve=t+Math.round(a/2),Ge=s+32,Xe=S+32/2;return{worldW:l,worldH:k,environmentOverflowPx:3e3,buildingOuter:{x:g,y:w,w:y,h:v},floorWorkspace:T,floorLobby:G,floorLounge:B,floorConference:oe,zoneSplitX:De,zoneSplitLobbyLoungeX:ue,topFloorBottomY:Oe,door:be,workstationSlots:_e,restSlots:Ne,meetingSlots:de,workstationDesks:Le,loungeSofas:We,conference:$e,windowsNorthY:Xe,labelWorkspaceX:Fe,labelLoungeX:Ue,labelConferenceX:Ve,ceilingNeonY:Ge}}static workstationCapacity(n){let e=i.clampGrid(n);return e.workstationCols*e.workstationRows}static restCapacity(n){let e=i.clampGrid(n);return e.restCols*e.restRows*2}static meetingCapacity(n){return 2*i.clampGrid(n).meetingCols+2}static clampDim(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e<1?1:e>12?12:e}static computeWorkspaceWidthPx(n){let s=128+n*256;return Math.max(896,s)}static computeLoungeWidthPx(n){return 140+n*170}static buildWorkstationSlots(n,e){let t=[],s=i.workstationPitchX(n.workstationCols,e.w),a=e.x+64,o=i.workstationRowFeetY(n.workstationRows,e);for(let r=0;r<n.workstationRows;r++)for(let c=0;c<n.workstationCols;c++)t.push({x:Math.round(a+c*s),y:o[r]});return t}static workstationPitchX(n,e){return n<=1?0:n===3&&e===896?96:Math.max(96,Math.round((e-192)/(n-1)))}static workstationRowFeetY(n,e){if(n===3)return[e.y+112,e.y+250,e.y+452];let t=[],s=48,o=e.h-s-48,r=n<=1?0:o/(n-1);for(let c=0;c<n;c++)t.push(Math.round(e.y+s+c*r));return t}static buildWorkstationDesks(n,e){let t=[],s=i.workstationPitchX(n.workstationCols,e.w),a=e.x+64,o=i.workstationDeskTopY(n.workstationRows,e);for(let r=0;r<n.workstationRows;r++)for(let c=0;c<n.workstationCols;c++){let l=Math.round(a+c*s)-32,d=o[r],f=(r+c)%2===0;t.push({trackId:`ws-${r}-${c}`,x:l,y:d,monitorIsCyan:f})}return t}static workstationDeskTopY(n,e){return n===3?[e.y+64,e.y+256,e.y+404]:i.workstationRowFeetY(n,e).map(s=>s-48)}static buildLoungeSeatingLayout(n,e){let t=[],s=[],h=e.w-32,S=(e.h-2*18)/Math.max(1,n.restRows);for(let m=0;m<n.restRows;m++){let g=e.y+18+m*S,w=S-14;if(n.restCols<=1){let y=Math.min(188,Math.max(120,e.w-32)),v=e.x+Math.round((e.w-y)/2),k=Math.round(g+w*.12);t.push({trackId:`lounge-${m}-0`,x:v,y:k,w:y,h:36});let T=k+36+14;s.push({x:v+Math.round(y*.33),y:T}),s.push({x:v+Math.round(y*.67),y:T})}else{let y=(n.restCols-1)*12,v=Math.max(96,Math.round((h-y)/n.restCols));for(let k=0;k<n.restCols;k++){let T=e.x+16+k*(v+12),G=Math.round(g+w*.12);t.push({trackId:`lounge-${m}-${k}`,x:T,y:G,w:v,h:36});let B=G+36+14;s.push({x:T+Math.round(v*.33),y:B}),s.push({x:T+Math.round(v*.67),y:B})}}}return{restSlots:s,loungeSofas:t}}static buildMeetingSlots(n,e){return i.computeConferenceChairPositions(n,e)}static computeConferenceChairPositions(n,e){let t=[],s=Math.min(420,e.w-80),a=56,o=e.x+Math.round((e.w-s)/2),r=e.y+Math.round(e.h/2)-Math.round(a/2),c=26,u=Math.max(1,n.meetingCols);for(let d=0;d<u;d++){let f=o+Math.round((d+1)*s/(u+1));t.push({x:f,y:r-c})}for(let d=0;d<u;d++){let f=o+Math.round((d+1)*s/(u+1));t.push({x:f,y:r+a+c})}let l=r+Math.round(a/2);return t.push({x:o-c,y:l}),t.push({x:o+s+c,y:l}),t}static buildConferenceFurniture(n,e){let t=Math.min(420,n.w-80),s=56,a={x:n.x+Math.round((n.w-t)/2),y:n.y+Math.round(n.h/2)-Math.round(s/2),w:t,h:s},o=e.map((r,c)=>({trackId:`conf-chair-${c}`,x:r.x,y:r.y}));return{table:a,chairs:o}}};var se={workstationCols:3,workstationRows:3,restCols:2,restRows:3,meetingCols:2,meetingRows:2,maxEverWorkstationCols:3,maxEverWorkstationRows:3,maxEverRestCols:2,maxEverRestRows:3,maxEverMeetingCols:2,maxEverMeetingRows:2},ke=(()=>{class i{settings_AS=x(he);layoutPersisted_$=P(se);saveTimerId;grid_$=D(()=>{let e=this.layoutPersisted_$();return{workstationCols:e.workstationCols,workstationRows:e.workstationRows,restCols:e.restCols,restRows:e.restRows,meetingCols:e.meetingCols,meetingRows:e.meetingRows}});derived_$=D(()=>E.computeDerived(this.grid_$()));workstationCapacity_$=D(()=>E.workstationCapacity(this.grid_$()));restCapacity_$=D(()=>E.restCapacity(this.grid_$()));meetingCapacity_$=D(()=>E.meetingCapacity(this.grid_$()));maxEverDisplay_$=D(()=>this.layoutPersisted_$());constructor(){this.loadFromServer()}loadFromServer(){return $(this,null,function*(){try{let e=yield this.settings_AS.getSection(ae.darkOfficeLayout);if(e==null||Object.keys(e).length===0){this.layoutPersisted_$.set(se);return}let t=i.parsePayload(e);this.layoutPersisted_$.set(t)}catch{this.layoutPersisted_$.set(se)}})}ensureMinCapacitiesFromSceneCharacters(e){let t=0,s=0,a=0;for(let c of e)c.scenePlacement===O.meeting?a++:c.presence===p.working?t++:s++;let o=this.layoutPersisted_$(),r=R({},o);r=i.expandGridToFit(r,t,s,a),!i.isSamePersisted(o,r)&&(this.layoutPersisted_$.set(r),this.scheduleDebouncedSave())}applyPersistedFromUser(e){return $(this,null,function*(){this.layoutPersisted_$.set(R({},e)),yield this.saveNow()})}validateProposedGridAgainstSceneCharacters(e){let t=E.clampGrid(e.grid),s=0,a=0,o=0;for(let l of e.characters)l.scenePlacement===O.meeting?o++:l.presence===p.working?s++:a++;let r=E.workstationCapacity(t),c=E.restCapacity(t),u=E.meetingCapacity(t);return s<=r&&a<=c&&o<=u?null:`Dark office layout rejected: scene occupancy exceeds proposed capacity. workstation=${s}/${r}, rest=${a}/${c}, meeting=${o}/${u}.`}getWorkstationSlots(){return this.derived_$().workstationSlots}getRestSlots(){return this.derived_$().restSlots}getMeetingSlots(){return this.derived_$().meetingSlots}getDoorPosition(){return this.derived_$().door}scheduleDebouncedSave(){this.saveTimerId!==void 0&&clearTimeout(this.saveTimerId),this.saveTimerId=setTimeout(()=>{this.saveTimerId=void 0,this.saveNow()},500)}saveNow(){return $(this,null,function*(){let e={workstationCols:this.layoutPersisted_$().workstationCols,workstationRows:this.layoutPersisted_$().workstationRows,restCols:this.layoutPersisted_$().restCols,restRows:this.layoutPersisted_$().restRows,meetingCols:this.layoutPersisted_$().meetingCols,meetingRows:this.layoutPersisted_$().meetingRows,maxEverWorkstationCols:this.layoutPersisted_$().maxEverWorkstationCols,maxEverWorkstationRows:this.layoutPersisted_$().maxEverWorkstationRows,maxEverRestCols:this.layoutPersisted_$().maxEverRestCols,maxEverRestRows:this.layoutPersisted_$().maxEverRestRows,maxEverMeetingCols:this.layoutPersisted_$().maxEverMeetingCols,maxEverMeetingRows:this.layoutPersisted_$().maxEverMeetingRows};try{yield this.settings_AS.saveSection(ae.darkOfficeLayout,e)}catch{}})}static parsePayload(e){let t=(o,r)=>{let c=e[o];return typeof c=="number"&&Number.isFinite(c)?Math.floor(c):r},s=se,a={workstationCols:t("workstationCols",s.workstationCols),workstationRows:t("workstationRows",s.workstationRows),restCols:t("restCols",s.restCols),restRows:t("restRows",s.restRows),meetingCols:t("meetingCols",s.meetingCols),meetingRows:t("meetingRows",s.meetingRows),maxEverWorkstationCols:t("maxEverWorkstationCols",s.maxEverWorkstationCols),maxEverWorkstationRows:t("maxEverWorkstationRows",s.maxEverWorkstationRows),maxEverRestCols:t("maxEverRestCols",s.maxEverRestCols),maxEverRestRows:t("maxEverRestRows",s.maxEverRestRows),maxEverMeetingCols:t("maxEverMeetingCols",s.maxEverMeetingCols),maxEverMeetingRows:t("maxEverMeetingRows",s.maxEverMeetingRows)};return i.clampPersisted(a)}static clampPersisted(e){let t=a=>{if(!Number.isFinite(a))return 1;let o=Math.floor(a);return o<1?1:o>12?12:o},s={workstationCols:t(e.workstationCols),workstationRows:t(e.workstationRows),restCols:t(e.restCols),restRows:t(e.restRows),meetingCols:t(e.meetingCols),meetingRows:t(e.meetingRows),maxEverWorkstationCols:t(e.maxEverWorkstationCols),maxEverWorkstationRows:t(e.maxEverWorkstationRows),maxEverRestCols:t(e.maxEverRestCols),maxEverRestRows:t(e.maxEverRestRows),maxEverMeetingCols:t(e.maxEverMeetingCols),maxEverMeetingRows:t(e.maxEverMeetingRows)};return s.maxEverWorkstationCols=Math.max(s.maxEverWorkstationCols,s.workstationCols),s.maxEverWorkstationRows=Math.max(s.maxEverWorkstationRows,s.workstationRows),s.maxEverRestCols=Math.max(s.maxEverRestCols,s.restCols),s.maxEverRestRows=Math.max(s.maxEverRestRows,s.restRows),s.maxEverMeetingCols=Math.max(s.maxEverMeetingCols,s.meetingCols),s.maxEverMeetingRows=Math.max(s.maxEverMeetingRows,s.meetingRows),s}static isSamePersisted(e,t){return e.workstationCols===t.workstationCols&&e.workstationRows===t.workstationRows&&e.restCols===t.restCols&&e.restRows===t.restRows&&e.meetingCols===t.meetingCols&&e.meetingRows===t.meetingRows&&e.maxEverWorkstationCols===t.maxEverWorkstationCols&&e.maxEverWorkstationRows===t.maxEverWorkstationRows&&e.maxEverRestCols===t.maxEverRestCols&&e.maxEverRestRows===t.maxEverRestRows&&e.maxEverMeetingCols===t.maxEverMeetingCols&&e.maxEverMeetingRows===t.maxEverMeetingRows}static expandGridToFit(e,t,s,a){let o=e.workstationCols,r=e.workstationRows,c=e.restCols,u=e.restRows,l=e.meetingCols,d=e.meetingRows;for(;o*r<t&&(o<12||r<12);)o<=r?o=Math.min(12,o+1):r=Math.min(12,r+1);for(;c*u<s&&(c<12||u<12);)c<=u?c=Math.min(12,c+1):u=Math.min(12,u+1);for(;l*d<a&&(l<12||d<12);)l<=d?l=Math.min(12,l+1):d=Math.min(12,d+1);let f={workstationCols:o,workstationRows:r,restCols:c,restRows:u,meetingCols:l,meetingRows:d,maxEverWorkstationCols:Math.max(e.maxEverWorkstationCols,o),maxEverWorkstationRows:Math.max(e.maxEverWorkstationRows,r),maxEverRestCols:Math.max(e.maxEverRestCols,c),maxEverRestRows:Math.max(e.maxEverRestRows,u),maxEverMeetingCols:Math.max(e.maxEverMeetingCols,l),maxEverMeetingRows:Math.max(e.maxEverMeetingRows,d)};return i.clampPersisted(f)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Z({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var ie=J(ee());var K=function(i){return i.connected="connected",i.disconnected="disconnected",i.error="error",i.unreachable="unreachable",i}(K||{});var W=class{static pickCcapPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveRun===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}static pickCciPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}static pickCaiPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}};var z=class{static pickPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}};var xe=J(ee()),Pe=2*xe.minute;var ne=class i{static mapGatewaySessionsResponse(n){let e=[];for(let t of n.sessions){let s=i.mapOneSession(t);s!==null&&e.push(s)}return e}static mapOneSession(n){let e=typeof n.key=="string"?n.key:typeof n.sessionId=="string"?n.sessionId:typeof n.id=="string"?n.id:"";if(!e.trim())return null;let t=typeof n.status=="string"?n.status.trim().toLowerCase():"",s=i.resolvePresenceFromGatewaySession({statusLower:t,raw:n}),a=s===p.working,o=H.extractTimestamp(n,H.GATEWAY_SESSION_LAST_ACTIVITY_FIELD_NAMES)??new Date().toISOString(),r=typeof n.label=="string"?n.label:typeof n.name=="string"?n.name:typeof n.title=="string"?n.title:void 0,u=(typeof n.statusMessage=="string"?n.statusMessage:void 0)?.trim()||(t.length>0?t:"OpenClaw session"),l=typeof n.lastPrompt=="string"?n.lastPrompt:void 0;return{sessionId:e,sessionName:r,presence:s,lastActivityAt:o,hasActiveSession:a,activitySummary:u,lastMessage:l}}static resolvePresenceFromGatewaySession(n){let e=n.statusLower;return e==="connecting"?p.working:i.hasRecentGatewayOutputTimestamp(n.raw)?p.working:e?p.idle:p.idle}static hasRecentGatewayOutputTimestamp(n){let e=H.extractTimestamp(n,H.GATEWAY_OUTPUT_ONLY_TIMESTAMP_FIELD_NAMES);if(!e?.length)return!1;let t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t<=Pe}};var re=function(i){return i.creating="creating",i.connecting="connecting",i.waitingInput="waiting-input",i.running="running",i.errored="errored",i.completed="completed",i.terminated="terminated",i.disconnected="disconnected",i}(re||{});var Ee=J(ee()),ce=(()=>{class i{static INTERESTING_SESSION_WINDOW_MS=5*Ee.minute;static prune(e,t){if(e.length===0)return[];let s=t.nowMs,a=t.recentWindowMs,o=[];for(let u of e){let l=new Date(u.lastActivityAt).getTime();Number.isNaN(l)||o.push({row:u,ms:l})}if(o.length===0)return[];let r=o.filter(u=>s-u.ms<=a),c=u=>{let d=[...u].sort((f,h)=>{let I=h.ms-f.ms;return I!==0?I:f.row.sessionId.localeCompare(h.row.sessionId)})[0];if(!d)throw new Error("DO_InstanceTrackerSessionStatuses_Prune_Util | empty sort");return d.row};if(r.length>0){let u=new Map;for(let l of r){let d=u.get(l.row.sessionId);(!d||l.ms>=d.ms)&&u.set(l.row.sessionId,l)}return[...u.values()].sort((l,d)=>d.ms-l.ms).map(l=>l.row)}return[c(o)]}}return i})();var V=class i{static resolveCcapSessionStatuses(n){let e=i.mapRawToCcapSessionStatuses(n.inst.rawSessionStatuses),t=e.length>0?e:i.snapshotCcapSessionStatuses({darkOffice_DS:n.darkOffice_DS,instanceId:n.inst.instanceId});return i.applyInterestingSessionWindow(t)}static resolveOciSessionStatuses(n){let e=i.mapRawToOciSessionStatuses(n.inst.rawSessionStatuses),t=e.length>0?e:i.snapshotOciSessionStatuses({darkOffice_DS:n.darkOffice_DS,instanceId:n.inst.instanceId});return i.applyInterestingSessionWindow(t)}static resolveCciSessionStatuses(n){let e=U.parseCcapId(n.inst.instanceId);if(!e)return[];let t=i.mapRawToCciSessionStatuses(n.inst.rawSessionStatuses),s=t.length>0?t:i.snapshotCciSessionStatuses({darkOffice_DS:n.darkOffice_DS,ccapId:e});return i.applyInterestingSessionWindow(s)}static resolveCaiSessionStatuses(n){let e=F.parseCcapId(n.inst.instanceId);if(!e)return[];let t=i.mapRawToCaiSessionStatuses(n.inst.rawSessionStatuses),s=t.length>0?t:i.snapshotCaiSessionStatuses({darkOffice_DS:n.darkOffice_DS,ccapId:e});return i.applyInterestingSessionWindow(s)}static applyInterestingSessionWindow(n){return ce.prune(n,{nowMs:Date.now(),recentWindowMs:ce.INTERESTING_SESSION_WINDOW_MS})}static snapshotCcapSessionStatuses(n){let t=n.darkOffice_DS.getCcapInstanceDataSnapshot(n.instanceId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotOciSessionStatuses(n){let t=n.darkOffice_DS.getOciInstanceDataSnapshot(n.instanceId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotCciSessionStatuses(n){let t=n.darkOffice_DS.getCciInstanceDataSnapshot(n.ccapId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotCaiSessionStatuses(n){let t=n.darkOffice_DS.getCaiInstanceDataSnapshot(n.ccapId)?.sessionStatuses;return Array.isArray(t)?t:[]}static mapRawToCcapSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if(!("hasActiveRun"in t))continue;let s=t.hasActiveRun;if(typeof s!="boolean")continue;let a=t.sessionId;if(typeof a!="string")continue;let o=t.presence;if(!i.isPresenceEnum(o))continue;let r=t.lastActivityAt;if(typeof r!="string")continue;let c=t.activitySummary;if(typeof c!="string")continue;let u=t.sessionName,l=t.lastMessage,d;if("activeRunPhase"in t){let h=t.activeRunPhase;if(h==null)d=void 0;else if(i.isRunFlowPhaseValue(h))d=h;else continue}let f;if("activeRunId"in t){let h=t.activeRunId;if(typeof h=="string")f=h;else if(h!=null)continue}e.push({sessionId:a,sessionName:typeof u=="string"?u:void 0,presence:o,lastActivityAt:r,hasActiveRun:s,activeRunId:f,activeRunPhase:d,activitySummary:c,lastMessage:typeof l=="string"?l:void 0})}return e}static mapRawToCaiSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t)||!("currentCaSessionStatus"in t))continue;let s=i.tryMapToOciOrCciShape(t);if(s===null)continue;let a=Reflect.get(t,"currentCaSessionStatus"),o;i.isCaSessionStatusValue(a)&&(o=a),e.push({sessionId:s.sessionId,sessionName:s.sessionName,presence:s.presence,lastActivityAt:s.lastActivityAt,hasActiveSession:s.hasActiveSession,currentCaSessionStatus:o,activitySummary:s.activitySummary,lastMessage:s.lastMessage})}return e}static mapRawToOciSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t))continue;let s=i.tryMapToOciOrCciShape(t);s!==null&&e.push(s)}return e}static mapRawToCciSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t))continue;let s=i.tryMapToOciOrCciShape(t);if(s===null)continue;let a;if("currentCcSessionStatus"in t){let o=t.currentCcSessionStatus;typeof o=="string"&&(a=o)}e.push({sessionId:s.sessionId,sessionName:s.sessionName,presence:s.presence,lastActivityAt:s.lastActivityAt,hasActiveSession:s.hasActiveSession,currentCcSessionStatus:a,activitySummary:s.activitySummary,lastMessage:s.lastMessage})}return e}static tryMapToOciOrCciShape(n){if(!("hasActiveSession"in n))return null;let e=Reflect.get(n,"hasActiveSession");if(typeof e!="boolean")return null;let t=n.sessionId;if(typeof t!="string")return null;let s=n.presence;if(!i.isPresenceEnum(s))return null;let a=n.lastActivityAt;if(typeof a!="string")return null;let o=n.activitySummary;if(typeof o!="string")return null;let r=n.sessionName,c=n.lastMessage;return{sessionId:t,sessionName:typeof r=="string"?r:void 0,presence:s,lastActivityAt:a,hasActiveSession:e,activitySummary:o,lastMessage:typeof c=="string"?c:void 0}}static isPresenceEnum(n){return typeof n!="string"?!1:Object.values(p).includes(n)}static isRunFlowPhaseValue(n){if(typeof n!="string")return!1;let e=Object.values(we);for(let t of e)if(t===n)return!0;return!1}static isCaSessionStatusValue(n){if(typeof n!="string")return!1;let e=Object.values(re);for(let t of e)if(t===n)return!0;return!1}};var Te=72,q=class i{static buildLastMessageDerivedStatusLabel(n){let e=n.trim();return e&&e.startsWith("[QUEUE]")?"Message queued":""}static buildPanelActiveSessionRows(n){let e=n.rawSessionStatuses;if(!e||e.length===0)return[];let t=n.characterType,s;return t===C.openclaw||t===C.ccSession||t===C.caSession?s=i.collectActiveOciOrCciFromUnion(e):s=i.collectActiveCcapFromUnion(e),s.length<=1?[]:s}static buildSessionDisplayLabel(n,e){let t=e?.trim();return t||i.shortenSessionId(n)}static truncateLastMessagePreview(n){let e=n.trim();return e?e.length<=Te?e:`${e.slice(0,Te-1)}\u2026`:""}static isCcapSessionRow(n){return"hasActiveRun"in n}static isOciOrCciSessionRow(n){return"hasActiveSession"in n}static isCcapSessionActive(n){return n.hasActiveRun===!0?!0:n.presence===p.working}static isOciOrCciSessionActive(n){return n.hasActiveSession===!0?!0:n.presence===p.working}static isSessionActiveForSceneDuplication(n){if(n.row.presence===p.offline)return!1;let e=n.characterType;return e===C.openclaw||e===C.ccSession||e===C.caSession?i.isOciOrCciSessionRow(n.row)?i.isOciOrCciSessionActive(n.row):!1:i.isCcapSessionRow(n.row)?i.isCcapSessionActive(n.row):!1}static shortenSessionId(n){return n.length<=10?n:`${n.slice(0,8)}\u2026`}static collectActiveCcapFromUnion(n){let e=[];for(let t of n){if(!i.isCcapSessionRow(t)||!i.isCcapSessionActive(t))continue;let s=i.truncateLastMessagePreview(t.lastMessage??"");e.push({sessionId:t.sessionId,displayLabel:i.buildSessionDisplayLabel(t.sessionId,t.sessionName),presence:t.presence,activitySummary:t.activitySummary,lastMessagePreview:s})}return e}static collectActiveOciOrCciFromUnion(n){let e=[];for(let t of n){if(!i.isOciOrCciSessionRow(t)||!i.isOciOrCciSessionActive(t))continue;let s=i.truncateLastMessagePreview(t.lastMessage??"");e.push({sessionId:t.sessionId,displayLabel:i.buildSessionDisplayLabel(t.sessionId,t.sessionName),presence:t.presence,activitySummary:t.activitySummary,lastMessagePreview:s})}return e}};var le=J(ee());var Q=(()=>{class i{static sceneRecentActivityWindowMs=5*le.minute;static sceneIdleWalkActivityWindowMs=15*le.minute;static parseLastActivityMs(e){let t=Date.parse(e);return Number.isNaN(t)?Number.NaN:t}static isSessionRecentAndOnline(e){if(e.presence===p.offline)return!1;let t=i.parseLastActivityMs(e.lastActivityAtIso);return Number.isNaN(t)?!1:e.nowMs-t<=e.windowMs}static rowLastActivityIso(e){return e.lastActivityAt??""}static isSessionWorkingForSceneCharacter(e){return e.presence===p.working||"hasActiveRun"in e&&e.hasActiveRun===!0||"hasActiveSession"in e&&e.hasActiveSession===!0}static isWorkingSessionRecentAndOnline(e){return i.isSessionWorkingForSceneCharacter(e.row)?i.isSessionRecentAndOnline({lastActivityAtIso:i.rowLastActivityIso(e.row),presence:e.row.presence,nowMs:e.nowMs,windowMs:e.windowMs}):!1}static isSessionInIdleWalkWindow(e){if(e.row.presence===p.offline||i.isWorkingSessionRecentAndOnline({row:e.row,nowMs:e.nowMs,windowMs:e.recentWindowMs}))return!1;let t=i.parseLastActivityMs(i.rowLastActivityIso(e.row));return Number.isNaN(t)?!1:e.nowMs-t<=e.idleWalkWindowMs}static pickNewestSessionByLastActivity(e){let t=e.sessions;return t.length===0?null:[...t].sort((o,r)=>{let c=i.parseLastActivityMs(i.rowLastActivityIso(o)),u=i.parseLastActivityMs(i.rowLastActivityIso(r)),l=!Number.isNaN(c),d=!Number.isNaN(u);return l&&d&&u!==c?u-c:l!==d?l?-1:1:o.sessionId.localeCompare(r.sessionId)})[0]??null}}return i})();var je="instance-data:session-status-updated",Be="openclaw-instance-data:status-updated",He="cci-instance-data:status-updated",Ke="cai-instance-data:status-updated",ys=(()=>{class i{instances_$=P([]);characters_$=D(()=>{let e=this.expandInstancesToCharacters(this.instances_$());return this.assignDistinctSlotsForScene(e)});loading_$=P(!1);loadError_$=P(null);isServerUnreachable_$=P(!1);selectedInstanceId_$=P(null);chatPopupSessionId_$=P(null);chatPopupSessionType_$=P(null);instanceStatusDetailInstanceId_$=P(null);instanceData_AS=x(ve);ociInstanceData_AS=x(Ce);cciInstanceData_AS=x(ge);caiInstanceData_AS=x(Ie);runtimeInstances_DS=x(Re);socket_CS=x(ye);ocSession_DS=x(Ae);darkOfficeLayout_DS=x(ke);constructor(){me(()=>{this.darkOfficeLayout_DS.ensureMinCapacitiesFromSceneCharacters(this.characters_$())},{allowSignalWrites:!0}),this.socket_CS.event$.subscribe(e=>{e.event===je?this.handleInstanceStatusUpdate(e.payload):e.event===Be?this.handleOciInstanceStatusUpdate(e.payload):e.event===He?this.handleCciInstanceStatusUpdate(e.payload):e.event===Ke&&this.handleCaiInstanceStatusUpdate(e.payload)})}workstationSlotMap=new Map;restSlotMap=new Map;patchTimerMap=new Map;meetingRoomLingerMs=2*ie.minute;sessionMeetingRoomUntilByKey=new Map;loadInstanceData(){return $(this,null,function*(){this.loading_$.set(!0),this.loadError_$.set(null);try{yield this.runtimeInstances_DS.loadCcapInstanceList();let e=this.runtimeInstances_DS.ccapInstanceListError_$();if(e){e instanceof fe&&e.status===0?this.isServerUnreachable_$.set(!0):this.loadError_$.set(e);return}yield this.runtimeInstances_DS.loadOciInstanceListAllowEmpty(),yield this.runtimeInstances_DS.loadCciInstanceListAllowEmpty(),yield this.runtimeInstances_DS.loadCaiInstanceListAllowEmpty(),this.isServerUnreachable_$.set(!1);let s=this.runtimeInstances_DS.ccapInstanceList_$().filter(d=>d.status===te.active),a=this.runtimeInstances_DS.ociInstanceList_$(),o=yield this.enrichOciListWithGatewaySessions({list:a}),c=this.runtimeInstances_DS.cciInstanceList_$().filter(d=>d.status===te.active),l=this.runtimeInstances_DS.caiInstanceList_$().filter(d=>d.status===te.active);this.applyAllInstanceData(s,o,c,l)}finally{this.loading_$.set(!1)}})}enrichOciListWithGatewaySessions(e){return $(this,null,function*(){return yield Promise.all(e.list.map(s=>$(this,null,function*(){let a=s.sessionStatuses??[];if(!(s.connectionStatus===K.connected)||a.length>0)return s;try{let r=yield this.ocSession_DS.fetchGatewaySessionsForInstance({instanceId:s.instanceId}),c=ne.mapGatewaySessionsResponse({sessions:r.rawSessions});return c.length===0?s:A(R({},s),{sessionStatuses:c})}catch(r){return ie.DyFM_Error.logSimple("CCAP_DarkOffice_DS | enrichOciListWithGatewaySessions failed",r),s}})))})}saveVisuals(e,t){this.instances_$.update(s=>s.map(a=>a.instanceId===e?A(R({},a),{visuals:t}):a)),this.schedulePatch(e,t)}dismissError(){this.loadError_$.set(null)}openChatPopup(e,t=null){this.chatPopupSessionId_$.set(e),this.chatPopupSessionType_$.set(t)}closeChatPopup(){this.chatPopupSessionId_$.set(null),this.chatPopupSessionType_$.set(null)}selectInstance(e){this.selectedInstanceId_$.set(e)}openInstanceStatusDetail(e){this.instanceStatusDetailInstanceId_$.set(e)}closeInstanceStatusDetail(){this.instanceStatusDetailInstanceId_$.set(null)}getCcapInstanceDataSnapshot(e){return this.runtimeInstances_DS.ccapInstanceList_$().find(t=>t.ccapId===e)}getOciInstanceDataSnapshot(e){return this.runtimeInstances_DS.ociInstanceList_$().find(t=>t.instanceId===e)}getCciInstanceDataSnapshot(e){return this.runtimeInstances_DS.cciInstanceList_$().find(t=>t.ccapId===e)}getCaiInstanceDataSnapshot(e){return this.runtimeInstances_DS.caiInstanceList_$().find(t=>t.ccapId===e)}resolveOfficeInstanceById(e){return e?this.instances_$().find(a=>a.instanceId===e)??null:null}resolveModalCcapSessionStatuses(e){return V.resolveCcapSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalOciSessionStatuses(e){return V.resolveOciSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalCciSessionStatuses(e){return V.resolveCciSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalCaiSessionStatuses(e){return V.resolveCaiSessionStatuses({inst:e,darkOffice_DS:this})}buildInstanceStatusDetailRuntimeHint(e){let t=e.characterType??C.ccap;if(t===C.openclaw)return this.resolveModalOciSessionStatuses(e).length>0||this.getOciInstanceDataSnapshot(e.instanceId)?"":"No matching OCI row in runtime list (last load only; socket updates may not refresh this list).";if(t===C.ccSession){let o=U.parseCcapId(e.instanceId);return!o||this.resolveModalCciSessionStatuses(e).length>0||this.getCciInstanceDataSnapshot(o)?"":"No matching CCI row in runtime list (last load only; socket updates may not refresh this list)."}if(t===C.caSession){let o=F.parseCcapId(e.instanceId);return!o||this.resolveModalCaiSessionStatuses(e).length>0||this.getCaiInstanceDataSnapshot(o)?"":"No matching CAI row in runtime list (last load only; socket updates may not refresh this list)."}return this.resolveModalCcapSessionStatuses(e).length>0||this.getCcapInstanceDataSnapshot(e.instanceId)?"":"No matching CCAP row in runtime list (last load only; socket updates may not refresh this list)."}pruneExpiredMeetingRoomKeys(e){for(let t of[...this.sessionMeetingRoomUntilByKey.keys()]){let s=this.sessionMeetingRoomUntilByKey.get(t);s!==void 0&&s<=e&&this.sessionMeetingRoomUntilByKey.delete(t)}}applyMeetingRoomTransitionForSessionDiff(e){let t=Date.now();this.pruneExpiredMeetingRoomKeys(t);let s=new Map;for(let a of e.previousRows??[])s.set(a.sessionId,a.presence);for(let a of e.nextRows??[]){let o=s.get(a.sessionId),r=`${e.baseInstanceId}::${a.sessionId}`;o===p.working&&a.presence===p.idle&&this.sessionMeetingRoomUntilByKey.set(r,t+this.meetingRoomLingerMs)}}resolveScenePlacementForSessionKey(e){let t=`${e.baseInstanceId}::${e.sessionId}`,s=this.sessionMeetingRoomUntilByKey.get(t);if(s!==void 0&&Date.now()<s)return O.meeting}handleInstanceStatusUpdate(e){let t=typeof e.ccapId=="string"?e.ccapId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t||!a)return;let o=this.instances_$(),r=o.findIndex(h=>h.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:a});let u=this.resolveSessionInfoFromStatuses(a),l=this.assignSlot(t,u.presence,c),d=this.resolveAnimState(u.presence,c.presence),f=this.applyPanelCardProjection(A(R({},c),{presence:u.presence,activitySummary:u.activitySummary,currentRunFlowPhase:u.currentRunFlowPhase,latestSessionId:u.latestSessionId,lastMessage:u.lastMessage,animState:d,previousPresence:c.presence,assignedSlotIndex:l,rawSessionStatuses:a}));this.instances_$.update(h=>h.map(I=>I.instanceId===t?f:I))}resolveSessionInfoFromStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CCAP Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCcapPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.activeRunPhase??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}applyPanelCardProjection(e){let t=e.sessionName??"";if(!t&&e.latestSessionId&&e.rawSessionStatuses){for(let s of e.rawSessionStatuses)if(s.sessionId===e.latestSessionId){t=s.sessionName??"";break}}return A(R({},e),{sessionName:t,lastMessageDerivedStatusLabel:q.buildLastMessageDerivedStatusLabel(e.lastMessage),panelActiveSessionRows:q.buildPanelActiveSessionRows({characterType:e.characterType,rawSessionStatuses:e.rawSessionStatuses})})}applyAllInstanceData(e,t,s,a){let o=this.instances_$(),r=new Map(o.map(S=>[S.instanceId,S])),c=e.map(S=>{let m=r.get(S.ccapId),g=m?.visuals??this.mapToVisuals(S),w=this.resolveSessionInfo(S),y=this.assignSlot(S.ccapId,w.presence,m),v=this.resolveAnimState(w.presence,m?.presence??null);return this.applyPanelCardProjection({instanceId:S.ccapId,presence:w.presence,activitySummary:w.activitySummary,currentRunFlowPhase:w.currentRunFlowPhase,latestSessionId:w.latestSessionId,lastMessage:w.lastMessage,visuals:g,animState:v,previousPresence:m?.presence??null,assignedSlotIndex:y,characterType:C.ccap,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),u=t.map(S=>{let m=r.get(S.instanceId),g=m?.visuals??this.mapOciToVisuals(S),w=this.resolveOciSessionInfo(S),y=this.assignSlot(S.instanceId,w.presence,m),v=this.resolveAnimState(w.presence,m?.presence??null);return this.applyPanelCardProjection({instanceId:S.instanceId,presence:w.presence,activitySummary:w.activitySummary,currentRunFlowPhase:null,latestSessionId:w.latestSessionId,lastMessage:w.lastMessage,visuals:g,animState:v,previousPresence:m?.presence??null,assignedSlotIndex:y,characterType:C.openclaw,connectionStatus:S.connectionStatus??null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),l=s.map(S=>{let m=U.build({ccapId:S.ccapId}),g=r.get(m),w=g?.visuals??this.mapCciToVisuals(S),y=this.resolveCciSessionInfo(S),v=this.assignSlot(m,y.presence,g),k=this.resolveAnimState(y.presence,g?.presence??null);return this.applyPanelCardProjection({instanceId:m,presence:y.presence,activitySummary:y.activitySummary,currentRunFlowPhase:y.currentRunFlowPhase,latestSessionId:y.latestSessionId,lastMessage:y.lastMessage,visuals:w,animState:k,previousPresence:g?.presence??null,assignedSlotIndex:v,characterType:C.ccSession,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),d=a.map(S=>{let m=F.build({ccapId:S.ccapId}),g=r.get(m),w=g?.visuals??this.mapCaiToVisuals(S),y=this.resolveCaiSessionInfo(S),v=this.assignSlot(m,y.presence,g),k=this.resolveAnimState(y.presence,g?.presence??null);return this.applyPanelCardProjection({instanceId:m,presence:y.presence,activitySummary:y.activitySummary,currentRunFlowPhase:y.currentRunFlowPhase,latestSessionId:y.latestSessionId,lastMessage:y.lastMessage,visuals:w,animState:k,previousPresence:g?.presence??null,assignedSlotIndex:v,characterType:C.caSession,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),f=[...c,...u,...l,...d];for(let S of f){let m=r.get(S.instanceId);this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:S.instanceId,previousRows:m?.rawSessionStatuses,nextRows:S.rawSessionStatuses})}let h=new Set(f.map(S=>S.instanceId)),I=o.filter(S=>!h.has(S.instanceId)&&S.animState!==M.walkingOut).map(S=>this.applyPanelCardProjection(A(R({},S),{animState:M.walkingOut})));this.instances_$.set([...f,...I]),I.length>0&&setTimeout(()=>{this.instances_$.update(S=>S.filter(m=>h.has(m.instanceId)))},Me+200)}mapToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??b.skinColor,hairColor:t?.hairColor??b.hairColor,hairStyle:t?.hairStyle??b.hairStyle,shirtColor:t?.shirtColor??b.shirtColor,clothingStyle:t?.clothingStyle??b.clothingStyle,pantsColor:t?.pantsColor??b.pantsColor,eyeColor:t?.eyeColor??b.eyeColor,bodyType:t?.bodyType??b.bodyType,displayName:e.name??""}}resolveSessionInfo(e){let t=e.sessionStatuses;if(!t||t.length===0)return{presence:p.idle,activitySummary:"No CCAP Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCcapPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.activeRunPhase??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}mapOciToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??_.skinColor,hairColor:t?.hairColor??_.hairColor,hairStyle:t?.hairStyle??_.hairStyle,shirtColor:t?.shirtColor??_.shirtColor,clothingStyle:t?.clothingStyle??_.clothingStyle,pantsColor:t?.pantsColor??_.pantsColor,eyeColor:t?.eyeColor??_.eyeColor,bodyType:t?.bodyType??_.bodyType,displayName:e.label??""}}mapCaiToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??N.skinColor,hairColor:t?.hairColor??N.hairColor,hairStyle:t?.hairStyle??N.hairStyle,shirtColor:t?.shirtColor??N.shirtColor,clothingStyle:t?.clothingStyle??N.clothingStyle,pantsColor:t?.pantsColor??N.pantsColor,eyeColor:t?.eyeColor??N.eyeColor,bodyType:t?.bodyType??N.bodyType,displayName:e.name??""}}resolveCaiSessionInfo(e){let t=e.sessionStatuses??[];if(t.length===0)return{presence:p.idle,activitySummary:"No CA Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCaiPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.currentCaSessionStatus??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}mapCciToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??L.skinColor,hairColor:t?.hairColor??L.hairColor,hairStyle:t?.hairStyle??L.hairStyle,shirtColor:t?.shirtColor??L.shirtColor,clothingStyle:t?.clothingStyle??L.clothingStyle,pantsColor:t?.pantsColor??L.pantsColor,eyeColor:t?.eyeColor??L.eyeColor,bodyType:t?.bodyType??L.bodyType,displayName:e.name??""}}resolveCciSessionInfo(e){let t=e.sessionStatuses??[];if(t.length===0)return{presence:p.idle,activitySummary:"No CC Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCciPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.currentCcSessionStatus??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}resolveOciSessionInfo(e){if(!(e.connectionStatus===K.connected))return{presence:p.offline,activitySummary:"Gateway disconnected",latestSessionId:null,lastMessage:""};let s=e.sessionStatuses??[];if(s.length===0)return{presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""};let a=z.pickPrimary(s);return a?{presence:a.presence,activitySummary:a.activitySummary,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}:{presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""}}handleOciInstanceStatusUpdate(e){let t=typeof e.instanceId=="string"?e.instanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0,o=typeof e.connectionStatus=="string"?e.connectionStatus:void 0;if(!t)return;let r=this.instances_$(),c=r.findIndex(m=>m.instanceId===t);if(!(o===K.connected)&&c>=0){let m=r[c],g=this.assignSlot(t,p.offline,m),w=this.resolveAnimState(p.offline,m.presence);this.instances_$.update(y=>y.map(v=>v.instanceId===t?this.applyPanelCardProjection(A(R({},v),{presence:p.offline,activitySummary:"Gateway disconnected",lastMessage:"",animState:w,previousPresence:m.presence,assignedSlotIndex:g,connectionStatus:o??v.connectionStatus})):v));return}if(c<0){this.loadInstanceData();return}let l=r[c],d=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:l.rawSessionStatuses,nextRows:d});let f;if(d.length>0){let m=z.pickPrimary(d);m?f={presence:m.presence,activitySummary:m.activitySummary,latestSessionId:m.sessionId,lastMessage:m.lastMessage??""}:f={presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""}}else f={presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""};let h=this.assignSlot(t,f.presence,l),I=this.resolveAnimState(f.presence,l.presence),S=this.applyPanelCardProjection(A(R({},l),{presence:f.presence,activitySummary:f.activitySummary,latestSessionId:f.latestSessionId,lastMessage:f.lastMessage,animState:I,previousPresence:l.presence,assignedSlotIndex:h,connectionStatus:o??l.connectionStatus,rawSessionStatuses:d}));this.instances_$.update(m=>m.map(g=>g.instanceId===t?S:g))}handleCciInstanceStatusUpdate(e){let t=typeof e.officeInstanceId=="string"?e.officeInstanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t)return;let o=this.instances_$(),r=o.findIndex(I=>I.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r],u=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:u});let l=this.resolveSessionInfoFromCciStatuses(u),d=this.assignSlot(t,l.presence,c),f=this.resolveAnimState(l.presence,c.presence),h=this.applyPanelCardProjection(A(R({},c),{presence:l.presence,activitySummary:l.activitySummary,currentRunFlowPhase:l.currentRunFlowPhase,latestSessionId:l.latestSessionId,lastMessage:l.lastMessage,animState:f,previousPresence:c.presence,assignedSlotIndex:d,rawSessionStatuses:u}));this.instances_$.update(I=>I.map(S=>S.instanceId===t?h:S))}handleCaiInstanceStatusUpdate(e){let t=typeof e.officeInstanceId=="string"?e.officeInstanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t)return;let o=this.instances_$(),r=o.findIndex(I=>I.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r],u=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:u});let l=this.resolveSessionInfoFromCaiStatuses(u),d=this.assignSlot(t,l.presence,c),f=this.resolveAnimState(l.presence,c.presence),h=this.applyPanelCardProjection(A(R({},c),{presence:l.presence,activitySummary:l.activitySummary,currentRunFlowPhase:l.currentRunFlowPhase,latestSessionId:l.latestSessionId,lastMessage:l.lastMessage,animState:f,previousPresence:c.presence,assignedSlotIndex:d,rawSessionStatuses:u}));this.instances_$.update(I=>I.map(S=>S.instanceId===t?h:S))}resolveSessionInfoFromCciStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CC Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCciPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.currentCcSessionStatus??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}resolveSessionInfoFromCaiStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CA Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCaiPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.currentCaSessionStatus??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}schedulePatch(e,t){let s=this.patchTimerMap.get(e);s!==void 0&&clearTimeout(s);let a=setTimeout(()=>{this.patchTimerMap.delete(e);let d=t,{displayName:o}=d,r=Se(d,["displayName"]),c=this.instances_$().find(f=>f.instanceId===e),u=F.parseCcapId(e),l=U.parseCcapId(e);u!==null?this.caiInstanceData_AS.patchByCcapId({ccapId:u,name:o||void 0,darkOfficeVisuals:r}):l!==null?this.cciInstanceData_AS.patchByCcapId({ccapId:l,name:o||void 0,darkOfficeVisuals:r}):c?.characterType===C.openclaw?this.ociInstanceData_AS.patchVisuals({instanceId:e,label:o||void 0,darkOfficeVisuals:r}):this.instanceData_AS.patchByCcapId({ccapId:e,name:o||void 0,darkOfficeVisuals:r})},300);this.patchTimerMap.set(e,a)}assignSlot(e,t,s){let a=t===p.working,o=a?this.workstationSlotMap:this.restSlotMap,r=a?this.darkOfficeLayout_DS.workstationCapacity_$():this.darkOfficeLayout_DS.restCapacity_$();if(o.has(e))return o.get(e);this.workstationSlotMap.delete(e),this.restSlotMap.delete(e);let c=new Set(o.values());for(let l=0;l<r;l++)if(!c.has(l))return o.set(e,l),l;let u=r;for(;c.has(u);)u++;return o.set(e,u),u}resolveAnimState(e,t){return t===p.offline&&e!==p.offline?M.walkingIn:t!==null&&t!==p.offline&&e===p.offline?M.walkingOut:t!==null&&t!==p.offline&&e!==p.offline&&t!==e?M.walkingBetween:e===p.working?M.working:e===p.idle?M.sitting:M.standing}assignDistinctSlotsForScene(e){let t=0,s=0,a=0;return e.map(o=>{let r;return o.scenePlacement===O.meeting?r=a++:o.presence===p.working?r=t++:r=s++,A(R({},o),{assignedSlotIndex:r})})}expandInstancesToCharacters(e){let t=[],s=Date.now(),a=Q.sceneRecentActivityWindowMs,o=Q.sceneIdleWalkActivityWindowMs,r=new Map;for(let c of e)c.characterType===C.ccap&&r.set(c.instanceId,c.presence);for(let c of e){if(c.presence===p.offline)continue;if(c.characterType===C.ccSession||c.characterType===C.caSession){let l=c.characterType===C.ccSession?U.parseCcapId(c.instanceId):F.parseCcapId(c.instanceId),d=l?r.get(l):void 0;if(d===void 0||d===p.offline)continue}t.push(this.buildInstanceBaselineCharacter(c));let u=c.rawSessionStatuses??[];for(let l of u){if(Q.isWorkingSessionRecentAndOnline({row:l,nowMs:s,windowMs:a})){t.push(this.buildPerSessionOfficeCharacter(c,l));continue}Q.isSessionInIdleWalkWindow({row:l,nowMs:s,recentWindowMs:a,idleWalkWindowMs:o})&&t.push(this.buildIdleWalkSessionCharacter(c,l))}}return t}buildIdleWalkSessionCharacter(e,t){let s=`${e.instanceId}::${t.sessionId}`;return this.applyPanelCardProjection(A(R({},e),{instanceId:s,sessionId:t.sessionId,sessionName:t.sessionName??"",presence:p.idle,activitySummary:t.activitySummary,lastMessage:t.lastMessage??"",latestSessionId:t.sessionId,currentRunFlowPhase:i.resolveSessionRunFlowPhaseLabel(t),assignedSlotIndex:0,animState:M.idleWalking,previousPresence:null,scenePlacement:void 0,rawSessionStatuses:void 0,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}buildInstanceBaselineCharacter(e){return this.applyPanelCardProjection(A(R({},e),{instanceId:e.instanceId,sessionId:void 0,sessionName:"",presence:p.idle,activitySummary:e.activitySummary,lastMessage:"",latestSessionId:null,currentRunFlowPhase:null,assignedSlotIndex:0,animState:M.sitting,previousPresence:null,scenePlacement:void 0,rawSessionStatuses:e.rawSessionStatuses,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}buildPerSessionOfficeCharacter(e,t){let s=`${e.instanceId}::${t.sessionId}`,o=(t.presence===p.working?void 0:this.resolveScenePlacementForSessionKey({baseInstanceId:e.instanceId,sessionId:t.sessionId}))===O.meeting?O.meeting:void 0;return this.applyPanelCardProjection(A(R({},e),{instanceId:s,sessionId:t.sessionId,sessionName:t.sessionName??"",presence:t.presence,activitySummary:t.activitySummary,lastMessage:t.lastMessage??"",latestSessionId:t.sessionId,currentRunFlowPhase:i.resolveSessionRunFlowPhaseLabel(t),assignedSlotIndex:0,animState:t.presence===p.working?M.working:M.sitting,previousPresence:null,scenePlacement:o,rawSessionStatuses:void 0,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}static resolveSessionRunFlowPhaseLabel(e){return"activeRunPhase"in e?e.activeRunPhase??null:"currentCcSessionStatus"in e?e.currentCcSessionStatus??null:"currentCaSessionStatus"in e?e.currentCaSessionStatus??null:null}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Z({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();export{M as a,O as b,C as c,K as d,X as e,Y as f,j as g,it as h,ot as i,at as j,rt as k,ct as l,F as m,U as n,Q as o,ke as p,ys as q};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as H,b as Ae}from"./chunk-X4RAIC74.js";import{a as we}from"./chunk-UFBTR2BG.js";import{a as te,b as p}from"./chunk-6Y7O2W4H.js";import{a as Ie,b as ge,c as ve,d as Re}from"./chunk-GHUVIUFQ.js";import{a as Ce}from"./chunk-GKKG77XM.js";import{e as ye}from"./chunk-TZIBF6RE.js";import{L as he,p as ee,t as ae}from"./chunk-HHHXXHAW.js";import{C as x,a as R,aa as P,b as A,d as Se,h as J,hb as D,jb as me,k as $,wb as fe,y as Z}from"./chunk-TBMJSIBB.js";var M=function(i){return i.standing="standing",i.working="working",i.sitting="sitting",i.walkingIn="walking-in",i.walkingOut="walking-out",i.walkingBetween="walking-between",i.idleWalking="idle-walking",i}(M||{});var O=function(i){return i.workstation="workstation",i.rest="rest",i.meeting="meeting",i}(O||{});var C=function(i){return i.ccap="ccap",i.openclaw="openclaw",i.ccSession="cc-session",i.caSession="ca-session",i}(C||{});var X=function(i){return i.average="average",i.slim="slim",i.stocky="stocky",i.athletic="athletic",i}(X||{});var Y=function(i){return i.casual="casual",i.formal="formal",i.hoodie="hoodie",i.tshirt="tshirt",i}(Y||{});var j=function(i){return i.short="short",i.long="long",i.spiky="spiky",i.curly="curly",i.bald="bald",i.mohawk="mohawk",i}(j||{});var it=["#f5c592","#e8a96e","#d4845a","#c06a3c","#9b5930","#7a3d1c","#4a2412"],ot=["#1a1006","#3b2505","#6b3d11","#9b6720","#c9a227","#e8d5a3","#f0f0f0","#a0a0a0","#2a4080","#8b1a2a"],at=["#1e40af","#166534","#7f1d1d","#4c1d95","#134e4a","#713f12","#374151","#6b21a8","#0f766e","#1e3a5f","#b45309","#be185d","#475569"],rt=["#1e293b","#374151","#292524","#1e3a5f","#1a2e05","#2d1b69","#3b1a08","#1a1a2e"],ct=["#1a1a1a","#3b5998","#2d8a4e","#8b4513","#4b0082","#5f9ea0"],b={skinColor:"#e8a96e",hairColor:"#1a1006",hairStyle:j.short,shirtColor:"#1e40af",clothingStyle:Y.casual,pantsColor:"#1e293b",eyeColor:"#1a1a1a",bodyType:X.average,displayName:""},_={skinColor:"#b0bec5",hairColor:"#37474f",hairStyle:j.short,shirtColor:"#0288d1",clothingStyle:Y.tshirt,pantsColor:"#263238",eyeColor:"#00bcd4",bodyType:X.average,displayName:""},L={skinColor:"#d4c4a8",hairColor:"#2d1b0e",hairStyle:j.short,shirtColor:"#5b21b6",clothingStyle:Y.casual,pantsColor:"#312e81",eyeColor:"#4338ca",bodyType:X.average,displayName:""},N={skinColor:"#e2e8f0",hairColor:"#0f172a",hairStyle:j.short,shirtColor:"#0d9488",clothingStyle:Y.casual,pantsColor:"#134e4a",eyeColor:"#14b8a6",bodyType:X.average,displayName:""};var Me=2e3;var F=(()=>{class i{static officeInstanceIdPrefix="cai:";static build(e){return`${i.officeInstanceIdPrefix}${e.ccapId.trim()}`}static parseCcapId(e){let t=e.trim();if(!t.startsWith(i.officeInstanceIdPrefix))return null;let s=t.slice(i.officeInstanceIdPrefix.length).trim();return s.length>0?s:null}}return i})();var U=(()=>{class i{static officeInstanceIdPrefix="cci:";static build(e){return`${i.officeInstanceIdPrefix}${e.ccapId.trim()}`}static parseCcapId(e){let t=e.trim();if(!t.startsWith(i.officeInstanceIdPrefix))return null;let s=t.slice(i.officeInstanceIdPrefix.length).trim();return s.length>0?s:null}}return i})();var E=class i{static clampGrid(n){return{workstationCols:i.clampDim(n.workstationCols),workstationRows:i.clampDim(n.workstationRows),restCols:i.clampDim(n.restCols),restRows:i.clampDim(n.restRows),meetingCols:i.clampDim(n.meetingCols),meetingRows:i.clampDim(n.meetingRows)}}static computeDerived(n){let e=i.clampGrid(n),t=4*32,s=3*32,a=i.computeWorkspaceWidthPx(e.workstationCols),o=i.computeLoungeWidthPx(e.restCols),r=6*32,c=a+r+o,u=8*32,l=c+u,d=e.workstationRows*6*32,f=3*32+e.meetingRows*5*32+3*32,h=Math.max(2*32,Math.round(f/2)),I=s+d,S=2*32,m=I+h+32,g=t-32,w=S,y=c+2*32,v=m-w,k=m+3*32,T={x:t,y:s,w:a,h:d},G={x:t+a,y:s,w:r,h:m-s},B={x:t+a+r,y:s,w:o,h:m-s},oe={x:t,y:I,w:a,h},De=t+a,ue=t+a+r,Oe=I,be={x:G.x+Math.round(G.w/2),y:m-2*32},_e=i.buildWorkstationSlots(e,T),de=i.buildMeetingSlots(e,oe),Le=i.buildWorkstationDesks(e,T),pe=i.buildLoungeSeatingLayout(e,B),Ne=pe.restSlots,We=pe.loungeSofas,$e=i.buildConferenceFurniture(oe,de),Fe=t+Math.round(a/2),Ue=ue+Math.round(o/2),Ve=t+Math.round(a/2),Ge=s+32,Xe=S+32/2;return{worldW:l,worldH:k,environmentOverflowPx:3e3,buildingOuter:{x:g,y:w,w:y,h:v},floorWorkspace:T,floorLobby:G,floorLounge:B,floorConference:oe,zoneSplitX:De,zoneSplitLobbyLoungeX:ue,topFloorBottomY:Oe,door:be,workstationSlots:_e,restSlots:Ne,meetingSlots:de,workstationDesks:Le,loungeSofas:We,conference:$e,windowsNorthY:Xe,labelWorkspaceX:Fe,labelLoungeX:Ue,labelConferenceX:Ve,ceilingNeonY:Ge}}static workstationCapacity(n){let e=i.clampGrid(n);return e.workstationCols*e.workstationRows}static restCapacity(n){let e=i.clampGrid(n);return e.restCols*e.restRows*2}static meetingCapacity(n){return 2*i.clampGrid(n).meetingCols+2}static clampDim(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e<1?1:e>12?12:e}static computeWorkspaceWidthPx(n){let s=128+n*256;return Math.max(896,s)}static computeLoungeWidthPx(n){return 140+n*170}static buildWorkstationSlots(n,e){let t=[],s=i.workstationPitchX(n.workstationCols,e.w),a=e.x+64,o=i.workstationRowFeetY(n.workstationRows,e);for(let r=0;r<n.workstationRows;r++)for(let c=0;c<n.workstationCols;c++)t.push({x:Math.round(a+c*s),y:o[r]});return t}static workstationPitchX(n,e){return n<=1?0:n===3&&e===896?96:Math.max(96,Math.round((e-192)/(n-1)))}static workstationRowFeetY(n,e){if(n===3)return[e.y+112,e.y+250,e.y+452];let t=[],s=48,o=e.h-s-48,r=n<=1?0:o/(n-1);for(let c=0;c<n;c++)t.push(Math.round(e.y+s+c*r));return t}static buildWorkstationDesks(n,e){let t=[],s=i.workstationPitchX(n.workstationCols,e.w),a=e.x+64,o=i.workstationDeskTopY(n.workstationRows,e);for(let r=0;r<n.workstationRows;r++)for(let c=0;c<n.workstationCols;c++){let l=Math.round(a+c*s)-32,d=o[r],f=(r+c)%2===0;t.push({trackId:`ws-${r}-${c}`,x:l,y:d,monitorIsCyan:f})}return t}static workstationDeskTopY(n,e){return n===3?[e.y+64,e.y+256,e.y+404]:i.workstationRowFeetY(n,e).map(s=>s-48)}static buildLoungeSeatingLayout(n,e){let t=[],s=[],h=e.w-32,S=(e.h-2*18)/Math.max(1,n.restRows);for(let m=0;m<n.restRows;m++){let g=e.y+18+m*S,w=S-14;if(n.restCols<=1){let y=Math.min(188,Math.max(120,e.w-32)),v=e.x+Math.round((e.w-y)/2),k=Math.round(g+w*.12);t.push({trackId:`lounge-${m}-0`,x:v,y:k,w:y,h:36});let T=k+36+14;s.push({x:v+Math.round(y*.33),y:T}),s.push({x:v+Math.round(y*.67),y:T})}else{let y=(n.restCols-1)*12,v=Math.max(96,Math.round((h-y)/n.restCols));for(let k=0;k<n.restCols;k++){let T=e.x+16+k*(v+12),G=Math.round(g+w*.12);t.push({trackId:`lounge-${m}-${k}`,x:T,y:G,w:v,h:36});let B=G+36+14;s.push({x:T+Math.round(v*.33),y:B}),s.push({x:T+Math.round(v*.67),y:B})}}}return{restSlots:s,loungeSofas:t}}static buildMeetingSlots(n,e){return i.computeConferenceChairPositions(n,e)}static computeConferenceChairPositions(n,e){let t=[],s=Math.min(420,e.w-80),a=56,o=e.x+Math.round((e.w-s)/2),r=e.y+Math.round(e.h/2)-Math.round(a/2),c=26,u=Math.max(1,n.meetingCols);for(let d=0;d<u;d++){let f=o+Math.round((d+1)*s/(u+1));t.push({x:f,y:r-c})}for(let d=0;d<u;d++){let f=o+Math.round((d+1)*s/(u+1));t.push({x:f,y:r+a+c})}let l=r+Math.round(a/2);return t.push({x:o-c,y:l}),t.push({x:o+s+c,y:l}),t}static buildConferenceFurniture(n,e){let t=Math.min(420,n.w-80),s=56,a={x:n.x+Math.round((n.w-t)/2),y:n.y+Math.round(n.h/2)-Math.round(s/2),w:t,h:s},o=e.map((r,c)=>({trackId:`conf-chair-${c}`,x:r.x,y:r.y}));return{table:a,chairs:o}}};var se={workstationCols:3,workstationRows:3,restCols:2,restRows:3,meetingCols:2,meetingRows:2,maxEverWorkstationCols:3,maxEverWorkstationRows:3,maxEverRestCols:2,maxEverRestRows:3,maxEverMeetingCols:2,maxEverMeetingRows:2},ke=(()=>{class i{settings_AS=x(he);layoutPersisted_$=P(se);saveTimerId;grid_$=D(()=>{let e=this.layoutPersisted_$();return{workstationCols:e.workstationCols,workstationRows:e.workstationRows,restCols:e.restCols,restRows:e.restRows,meetingCols:e.meetingCols,meetingRows:e.meetingRows}});derived_$=D(()=>E.computeDerived(this.grid_$()));workstationCapacity_$=D(()=>E.workstationCapacity(this.grid_$()));restCapacity_$=D(()=>E.restCapacity(this.grid_$()));meetingCapacity_$=D(()=>E.meetingCapacity(this.grid_$()));maxEverDisplay_$=D(()=>this.layoutPersisted_$());constructor(){this.loadFromServer()}loadFromServer(){return $(this,null,function*(){try{let e=yield this.settings_AS.getSection(ae.darkOfficeLayout);if(e==null||Object.keys(e).length===0){this.layoutPersisted_$.set(se);return}let t=i.parsePayload(e);this.layoutPersisted_$.set(t)}catch{this.layoutPersisted_$.set(se)}})}ensureMinCapacitiesFromSceneCharacters(e){let t=0,s=0,a=0;for(let c of e)c.scenePlacement===O.meeting?a++:c.presence===p.working?t++:s++;let o=this.layoutPersisted_$(),r=R({},o);r=i.expandGridToFit(r,t,s,a),!i.isSamePersisted(o,r)&&(this.layoutPersisted_$.set(r),this.scheduleDebouncedSave())}applyPersistedFromUser(e){return $(this,null,function*(){this.layoutPersisted_$.set(R({},e)),yield this.saveNow()})}validateProposedGridAgainstSceneCharacters(e){let t=E.clampGrid(e.grid),s=0,a=0,o=0;for(let l of e.characters)l.scenePlacement===O.meeting?o++:l.presence===p.working?s++:a++;let r=E.workstationCapacity(t),c=E.restCapacity(t),u=E.meetingCapacity(t);return s<=r&&a<=c&&o<=u?null:`Dark office layout rejected: scene occupancy exceeds proposed capacity. workstation=${s}/${r}, rest=${a}/${c}, meeting=${o}/${u}.`}getWorkstationSlots(){return this.derived_$().workstationSlots}getRestSlots(){return this.derived_$().restSlots}getMeetingSlots(){return this.derived_$().meetingSlots}getDoorPosition(){return this.derived_$().door}scheduleDebouncedSave(){this.saveTimerId!==void 0&&clearTimeout(this.saveTimerId),this.saveTimerId=setTimeout(()=>{this.saveTimerId=void 0,this.saveNow()},500)}saveNow(){return $(this,null,function*(){let e={workstationCols:this.layoutPersisted_$().workstationCols,workstationRows:this.layoutPersisted_$().workstationRows,restCols:this.layoutPersisted_$().restCols,restRows:this.layoutPersisted_$().restRows,meetingCols:this.layoutPersisted_$().meetingCols,meetingRows:this.layoutPersisted_$().meetingRows,maxEverWorkstationCols:this.layoutPersisted_$().maxEverWorkstationCols,maxEverWorkstationRows:this.layoutPersisted_$().maxEverWorkstationRows,maxEverRestCols:this.layoutPersisted_$().maxEverRestCols,maxEverRestRows:this.layoutPersisted_$().maxEverRestRows,maxEverMeetingCols:this.layoutPersisted_$().maxEverMeetingCols,maxEverMeetingRows:this.layoutPersisted_$().maxEverMeetingRows};try{yield this.settings_AS.saveSection(ae.darkOfficeLayout,e)}catch{}})}static parsePayload(e){let t=(o,r)=>{let c=e[o];return typeof c=="number"&&Number.isFinite(c)?Math.floor(c):r},s=se,a={workstationCols:t("workstationCols",s.workstationCols),workstationRows:t("workstationRows",s.workstationRows),restCols:t("restCols",s.restCols),restRows:t("restRows",s.restRows),meetingCols:t("meetingCols",s.meetingCols),meetingRows:t("meetingRows",s.meetingRows),maxEverWorkstationCols:t("maxEverWorkstationCols",s.maxEverWorkstationCols),maxEverWorkstationRows:t("maxEverWorkstationRows",s.maxEverWorkstationRows),maxEverRestCols:t("maxEverRestCols",s.maxEverRestCols),maxEverRestRows:t("maxEverRestRows",s.maxEverRestRows),maxEverMeetingCols:t("maxEverMeetingCols",s.maxEverMeetingCols),maxEverMeetingRows:t("maxEverMeetingRows",s.maxEverMeetingRows)};return i.clampPersisted(a)}static clampPersisted(e){let t=a=>{if(!Number.isFinite(a))return 1;let o=Math.floor(a);return o<1?1:o>12?12:o},s={workstationCols:t(e.workstationCols),workstationRows:t(e.workstationRows),restCols:t(e.restCols),restRows:t(e.restRows),meetingCols:t(e.meetingCols),meetingRows:t(e.meetingRows),maxEverWorkstationCols:t(e.maxEverWorkstationCols),maxEverWorkstationRows:t(e.maxEverWorkstationRows),maxEverRestCols:t(e.maxEverRestCols),maxEverRestRows:t(e.maxEverRestRows),maxEverMeetingCols:t(e.maxEverMeetingCols),maxEverMeetingRows:t(e.maxEverMeetingRows)};return s.maxEverWorkstationCols=Math.max(s.maxEverWorkstationCols,s.workstationCols),s.maxEverWorkstationRows=Math.max(s.maxEverWorkstationRows,s.workstationRows),s.maxEverRestCols=Math.max(s.maxEverRestCols,s.restCols),s.maxEverRestRows=Math.max(s.maxEverRestRows,s.restRows),s.maxEverMeetingCols=Math.max(s.maxEverMeetingCols,s.meetingCols),s.maxEverMeetingRows=Math.max(s.maxEverMeetingRows,s.meetingRows),s}static isSamePersisted(e,t){return e.workstationCols===t.workstationCols&&e.workstationRows===t.workstationRows&&e.restCols===t.restCols&&e.restRows===t.restRows&&e.meetingCols===t.meetingCols&&e.meetingRows===t.meetingRows&&e.maxEverWorkstationCols===t.maxEverWorkstationCols&&e.maxEverWorkstationRows===t.maxEverWorkstationRows&&e.maxEverRestCols===t.maxEverRestCols&&e.maxEverRestRows===t.maxEverRestRows&&e.maxEverMeetingCols===t.maxEverMeetingCols&&e.maxEverMeetingRows===t.maxEverMeetingRows}static expandGridToFit(e,t,s,a){let o=e.workstationCols,r=e.workstationRows,c=e.restCols,u=e.restRows,l=e.meetingCols,d=e.meetingRows;for(;o*r<t&&(o<12||r<12);)o<=r?o=Math.min(12,o+1):r=Math.min(12,r+1);for(;c*u<s&&(c<12||u<12);)c<=u?c=Math.min(12,c+1):u=Math.min(12,u+1);for(;l*d<a&&(l<12||d<12);)l<=d?l=Math.min(12,l+1):d=Math.min(12,d+1);let f={workstationCols:o,workstationRows:r,restCols:c,restRows:u,meetingCols:l,meetingRows:d,maxEverWorkstationCols:Math.max(e.maxEverWorkstationCols,o),maxEverWorkstationRows:Math.max(e.maxEverWorkstationRows,r),maxEverRestCols:Math.max(e.maxEverRestCols,c),maxEverRestRows:Math.max(e.maxEverRestRows,u),maxEverMeetingCols:Math.max(e.maxEverMeetingCols,l),maxEverMeetingRows:Math.max(e.maxEverMeetingRows,d)};return i.clampPersisted(f)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Z({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var ie=J(ee());var K=function(i){return i.connected="connected",i.disconnected="disconnected",i.error="error",i.unreachable="unreachable",i}(K||{});var W=class{static pickCcapPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveRun===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}static pickCciPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}static pickCaiPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession===!0||o.presence===p.working);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}};var z=class{static pickPrimary(n){if(!n.length)return null;let e=(o,r)=>new Date(r.lastActivityAt).getTime()-new Date(o.lastActivityAt).getTime(),t=n.filter(o=>o.hasActiveSession);return t.length>0?[...t].sort(e)[0]??null:[...n].sort(e)[0]??null}};var xe=J(ee()),Pe=2*xe.minute;var ne=class i{static mapGatewaySessionsResponse(n){let e=[];for(let t of n.sessions){let s=i.mapOneSession(t);s!==null&&e.push(s)}return e}static mapOneSession(n){let e=typeof n.key=="string"?n.key:typeof n.sessionId=="string"?n.sessionId:typeof n.id=="string"?n.id:"";if(!e.trim())return null;let t=typeof n.status=="string"?n.status.trim().toLowerCase():"",s=i.resolvePresenceFromGatewaySession({statusLower:t,raw:n}),a=s===p.working,o=H.extractTimestamp(n,H.GATEWAY_SESSION_LAST_ACTIVITY_FIELD_NAMES)??new Date().toISOString(),r=typeof n.label=="string"?n.label:typeof n.name=="string"?n.name:typeof n.title=="string"?n.title:void 0,u=(typeof n.statusMessage=="string"?n.statusMessage:void 0)?.trim()||(t.length>0?t:"OpenClaw session"),l=typeof n.lastPrompt=="string"?n.lastPrompt:void 0;return{sessionId:e,sessionName:r,presence:s,lastActivityAt:o,hasActiveSession:a,activitySummary:u,lastMessage:l}}static resolvePresenceFromGatewaySession(n){let e=n.statusLower;return e==="connecting"?p.working:i.hasRecentGatewayOutputTimestamp(n.raw)?p.working:e?p.idle:p.idle}static hasRecentGatewayOutputTimestamp(n){let e=H.extractTimestamp(n,H.GATEWAY_OUTPUT_ONLY_TIMESTAMP_FIELD_NAMES);if(!e?.length)return!1;let t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t<=Pe}};var re=function(i){return i.creating="creating",i.connecting="connecting",i.waitingInput="waiting-input",i.running="running",i.errored="errored",i.completed="completed",i.terminated="terminated",i.disconnected="disconnected",i}(re||{});var Ee=J(ee()),ce=(()=>{class i{static INTERESTING_SESSION_WINDOW_MS=5*Ee.minute;static prune(e,t){if(e.length===0)return[];let s=t.nowMs,a=t.recentWindowMs,o=[];for(let u of e){let l=new Date(u.lastActivityAt).getTime();Number.isNaN(l)||o.push({row:u,ms:l})}if(o.length===0)return[];let r=o.filter(u=>s-u.ms<=a),c=u=>{let d=[...u].sort((f,h)=>{let I=h.ms-f.ms;return I!==0?I:f.row.sessionId.localeCompare(h.row.sessionId)})[0];if(!d)throw new Error("DO_InstanceTrackerSessionStatuses_Prune_Util | empty sort");return d.row};if(r.length>0){let u=new Map;for(let l of r){let d=u.get(l.row.sessionId);(!d||l.ms>=d.ms)&&u.set(l.row.sessionId,l)}return[...u.values()].sort((l,d)=>d.ms-l.ms).map(l=>l.row)}return[c(o)]}}return i})();var V=class i{static resolveCcapSessionStatuses(n){let e=i.mapRawToCcapSessionStatuses(n.inst.rawSessionStatuses),t=e.length>0?e:i.snapshotCcapSessionStatuses({darkOffice_DS:n.darkOffice_DS,instanceId:n.inst.instanceId});return i.applyInterestingSessionWindow(t)}static resolveOciSessionStatuses(n){let e=i.mapRawToOciSessionStatuses(n.inst.rawSessionStatuses),t=e.length>0?e:i.snapshotOciSessionStatuses({darkOffice_DS:n.darkOffice_DS,instanceId:n.inst.instanceId});return i.applyInterestingSessionWindow(t)}static resolveCciSessionStatuses(n){let e=U.parseCcapId(n.inst.instanceId);if(!e)return[];let t=i.mapRawToCciSessionStatuses(n.inst.rawSessionStatuses),s=t.length>0?t:i.snapshotCciSessionStatuses({darkOffice_DS:n.darkOffice_DS,ccapId:e});return i.applyInterestingSessionWindow(s)}static resolveCaiSessionStatuses(n){let e=F.parseCcapId(n.inst.instanceId);if(!e)return[];let t=i.mapRawToCaiSessionStatuses(n.inst.rawSessionStatuses),s=t.length>0?t:i.snapshotCaiSessionStatuses({darkOffice_DS:n.darkOffice_DS,ccapId:e});return i.applyInterestingSessionWindow(s)}static applyInterestingSessionWindow(n){return ce.prune(n,{nowMs:Date.now(),recentWindowMs:ce.INTERESTING_SESSION_WINDOW_MS})}static snapshotCcapSessionStatuses(n){let t=n.darkOffice_DS.getCcapInstanceDataSnapshot(n.instanceId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotOciSessionStatuses(n){let t=n.darkOffice_DS.getOciInstanceDataSnapshot(n.instanceId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotCciSessionStatuses(n){let t=n.darkOffice_DS.getCciInstanceDataSnapshot(n.ccapId)?.sessionStatuses;return Array.isArray(t)?t:[]}static snapshotCaiSessionStatuses(n){let t=n.darkOffice_DS.getCaiInstanceDataSnapshot(n.ccapId)?.sessionStatuses;return Array.isArray(t)?t:[]}static mapRawToCcapSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if(!("hasActiveRun"in t))continue;let s=t.hasActiveRun;if(typeof s!="boolean")continue;let a=t.sessionId;if(typeof a!="string")continue;let o=t.presence;if(!i.isPresenceEnum(o))continue;let r=t.lastActivityAt;if(typeof r!="string")continue;let c=t.activitySummary;if(typeof c!="string")continue;let u=t.sessionName,l=t.lastMessage,d;if("activeRunPhase"in t){let h=t.activeRunPhase;if(h==null)d=void 0;else if(i.isRunFlowPhaseValue(h))d=h;else continue}let f;if("activeRunId"in t){let h=t.activeRunId;if(typeof h=="string")f=h;else if(h!=null)continue}e.push({sessionId:a,sessionName:typeof u=="string"?u:void 0,presence:o,lastActivityAt:r,hasActiveRun:s,activeRunId:f,activeRunPhase:d,activitySummary:c,lastMessage:typeof l=="string"?l:void 0})}return e}static mapRawToCaiSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t)||!("currentCaSessionStatus"in t))continue;let s=i.tryMapToOciOrCciShape(t);if(s===null)continue;let a=Reflect.get(t,"currentCaSessionStatus"),o;i.isCaSessionStatusValue(a)&&(o=a),e.push({sessionId:s.sessionId,sessionName:s.sessionName,presence:s.presence,lastActivityAt:s.lastActivityAt,hasActiveSession:s.hasActiveSession,currentCaSessionStatus:o,activitySummary:s.activitySummary,lastMessage:s.lastMessage})}return e}static mapRawToOciSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t))continue;let s=i.tryMapToOciOrCciShape(t);s!==null&&e.push(s)}return e}static mapRawToCciSessionStatuses(n){if(!Array.isArray(n)||n.length===0)return[];let e=[];for(let t of n){if("hasActiveRun"in t||!("hasActiveSession"in t))continue;let s=i.tryMapToOciOrCciShape(t);if(s===null)continue;let a;if("currentCcSessionStatus"in t){let o=t.currentCcSessionStatus;typeof o=="string"&&(a=o)}e.push({sessionId:s.sessionId,sessionName:s.sessionName,presence:s.presence,lastActivityAt:s.lastActivityAt,hasActiveSession:s.hasActiveSession,currentCcSessionStatus:a,activitySummary:s.activitySummary,lastMessage:s.lastMessage})}return e}static tryMapToOciOrCciShape(n){if(!("hasActiveSession"in n))return null;let e=Reflect.get(n,"hasActiveSession");if(typeof e!="boolean")return null;let t=n.sessionId;if(typeof t!="string")return null;let s=n.presence;if(!i.isPresenceEnum(s))return null;let a=n.lastActivityAt;if(typeof a!="string")return null;let o=n.activitySummary;if(typeof o!="string")return null;let r=n.sessionName,c=n.lastMessage;return{sessionId:t,sessionName:typeof r=="string"?r:void 0,presence:s,lastActivityAt:a,hasActiveSession:e,activitySummary:o,lastMessage:typeof c=="string"?c:void 0}}static isPresenceEnum(n){return typeof n!="string"?!1:Object.values(p).includes(n)}static isRunFlowPhaseValue(n){if(typeof n!="string")return!1;let e=Object.values(we);for(let t of e)if(t===n)return!0;return!1}static isCaSessionStatusValue(n){if(typeof n!="string")return!1;let e=Object.values(re);for(let t of e)if(t===n)return!0;return!1}};var Te=72,q=class i{static buildLastMessageDerivedStatusLabel(n){let e=n.trim();return e&&e.startsWith("[QUEUE]")?"Message queued":""}static buildPanelActiveSessionRows(n){let e=n.rawSessionStatuses;if(!e||e.length===0)return[];let t=n.characterType,s;return t===C.openclaw||t===C.ccSession||t===C.caSession?s=i.collectActiveOciOrCciFromUnion(e):s=i.collectActiveCcapFromUnion(e),s.length<=1?[]:s}static buildSessionDisplayLabel(n,e){let t=e?.trim();return t||i.shortenSessionId(n)}static truncateLastMessagePreview(n){let e=n.trim();return e?e.length<=Te?e:`${e.slice(0,Te-1)}\u2026`:""}static isCcapSessionRow(n){return"hasActiveRun"in n}static isOciOrCciSessionRow(n){return"hasActiveSession"in n}static isCcapSessionActive(n){return n.hasActiveRun===!0?!0:n.presence===p.working}static isOciOrCciSessionActive(n){return n.hasActiveSession===!0?!0:n.presence===p.working}static isSessionActiveForSceneDuplication(n){if(n.row.presence===p.offline)return!1;let e=n.characterType;return e===C.openclaw||e===C.ccSession||e===C.caSession?i.isOciOrCciSessionRow(n.row)?i.isOciOrCciSessionActive(n.row):!1:i.isCcapSessionRow(n.row)?i.isCcapSessionActive(n.row):!1}static shortenSessionId(n){return n.length<=10?n:`${n.slice(0,8)}\u2026`}static collectActiveCcapFromUnion(n){let e=[];for(let t of n){if(!i.isCcapSessionRow(t)||!i.isCcapSessionActive(t))continue;let s=i.truncateLastMessagePreview(t.lastMessage??"");e.push({sessionId:t.sessionId,displayLabel:i.buildSessionDisplayLabel(t.sessionId,t.sessionName),presence:t.presence,activitySummary:t.activitySummary,lastMessagePreview:s})}return e}static collectActiveOciOrCciFromUnion(n){let e=[];for(let t of n){if(!i.isOciOrCciSessionRow(t)||!i.isOciOrCciSessionActive(t))continue;let s=i.truncateLastMessagePreview(t.lastMessage??"");e.push({sessionId:t.sessionId,displayLabel:i.buildSessionDisplayLabel(t.sessionId,t.sessionName),presence:t.presence,activitySummary:t.activitySummary,lastMessagePreview:s})}return e}};var le=J(ee());var Q=(()=>{class i{static sceneRecentActivityWindowMs=5*le.minute;static sceneIdleWalkActivityWindowMs=15*le.minute;static parseLastActivityMs(e){let t=Date.parse(e);return Number.isNaN(t)?Number.NaN:t}static isSessionRecentAndOnline(e){if(e.presence===p.offline)return!1;let t=i.parseLastActivityMs(e.lastActivityAtIso);return Number.isNaN(t)?!1:e.nowMs-t<=e.windowMs}static rowLastActivityIso(e){return e.lastActivityAt??""}static isSessionWorkingForSceneCharacter(e){return e.presence===p.working||"hasActiveRun"in e&&e.hasActiveRun===!0||"hasActiveSession"in e&&e.hasActiveSession===!0}static isWorkingSessionRecentAndOnline(e){return i.isSessionWorkingForSceneCharacter(e.row)?i.isSessionRecentAndOnline({lastActivityAtIso:i.rowLastActivityIso(e.row),presence:e.row.presence,nowMs:e.nowMs,windowMs:e.windowMs}):!1}static isSessionInIdleWalkWindow(e){if(e.row.presence===p.offline||i.isWorkingSessionRecentAndOnline({row:e.row,nowMs:e.nowMs,windowMs:e.recentWindowMs}))return!1;let t=i.parseLastActivityMs(i.rowLastActivityIso(e.row));return Number.isNaN(t)?!1:e.nowMs-t<=e.idleWalkWindowMs}static pickNewestSessionByLastActivity(e){let t=e.sessions;return t.length===0?null:[...t].sort((o,r)=>{let c=i.parseLastActivityMs(i.rowLastActivityIso(o)),u=i.parseLastActivityMs(i.rowLastActivityIso(r)),l=!Number.isNaN(c),d=!Number.isNaN(u);return l&&d&&u!==c?u-c:l!==d?l?-1:1:o.sessionId.localeCompare(r.sessionId)})[0]??null}}return i})();var je="instance-data:session-status-updated",Be="openclaw-instance-data:status-updated",He="cci-instance-data:status-updated",Ke="cai-instance-data:status-updated",ys=(()=>{class i{instances_$=P([]);characters_$=D(()=>{let e=this.expandInstancesToCharacters(this.instances_$());return this.assignDistinctSlotsForScene(e)});loading_$=P(!1);loadError_$=P(null);isServerUnreachable_$=P(!1);selectedInstanceId_$=P(null);chatPopupSessionId_$=P(null);chatPopupSessionType_$=P(null);instanceStatusDetailInstanceId_$=P(null);instanceData_AS=x(ve);ociInstanceData_AS=x(Ce);cciInstanceData_AS=x(ge);caiInstanceData_AS=x(Ie);runtimeInstances_DS=x(Re);socket_CS=x(ye);ocSession_DS=x(Ae);darkOfficeLayout_DS=x(ke);constructor(){me(()=>{this.darkOfficeLayout_DS.ensureMinCapacitiesFromSceneCharacters(this.characters_$())},{allowSignalWrites:!0}),this.socket_CS.event$.subscribe(e=>{e.event===je?this.handleInstanceStatusUpdate(e.payload):e.event===Be?this.handleOciInstanceStatusUpdate(e.payload):e.event===He?this.handleCciInstanceStatusUpdate(e.payload):e.event===Ke&&this.handleCaiInstanceStatusUpdate(e.payload)})}workstationSlotMap=new Map;restSlotMap=new Map;patchTimerMap=new Map;meetingRoomLingerMs=2*ie.minute;sessionMeetingRoomUntilByKey=new Map;loadInstanceData(){return $(this,null,function*(){this.loading_$.set(!0),this.loadError_$.set(null);try{yield this.runtimeInstances_DS.loadCcapInstanceList();let e=this.runtimeInstances_DS.ccapInstanceListError_$();if(e){e instanceof fe&&e.status===0?this.isServerUnreachable_$.set(!0):this.loadError_$.set(e);return}yield this.runtimeInstances_DS.loadOciInstanceListAllowEmpty(),yield this.runtimeInstances_DS.loadCciInstanceListAllowEmpty(),yield this.runtimeInstances_DS.loadCaiInstanceListAllowEmpty(),this.isServerUnreachable_$.set(!1);let s=this.runtimeInstances_DS.ccapInstanceList_$().filter(d=>d.status===te.active),a=this.runtimeInstances_DS.ociInstanceList_$(),o=yield this.enrichOciListWithGatewaySessions({list:a}),c=this.runtimeInstances_DS.cciInstanceList_$().filter(d=>d.status===te.active),l=this.runtimeInstances_DS.caiInstanceList_$().filter(d=>d.status===te.active);this.applyAllInstanceData(s,o,c,l)}finally{this.loading_$.set(!1)}})}enrichOciListWithGatewaySessions(e){return $(this,null,function*(){return yield Promise.all(e.list.map(s=>$(this,null,function*(){let a=s.sessionStatuses??[];if(!(s.connectionStatus===K.connected)||a.length>0)return s;try{let r=yield this.ocSession_DS.fetchGatewaySessionsForInstance({instanceId:s.instanceId}),c=ne.mapGatewaySessionsResponse({sessions:r.rawSessions});return c.length===0?s:A(R({},s),{sessionStatuses:c})}catch(r){return ie.DyFM_Error.logSimple("CCAP_DarkOffice_DS | enrichOciListWithGatewaySessions failed",r),s}})))})}saveVisuals(e,t){this.instances_$.update(s=>s.map(a=>a.instanceId===e?A(R({},a),{visuals:t}):a)),this.schedulePatch(e,t)}dismissError(){this.loadError_$.set(null)}openChatPopup(e,t=null){this.chatPopupSessionId_$.set(e),this.chatPopupSessionType_$.set(t)}closeChatPopup(){this.chatPopupSessionId_$.set(null),this.chatPopupSessionType_$.set(null)}selectInstance(e){this.selectedInstanceId_$.set(e)}openInstanceStatusDetail(e){this.instanceStatusDetailInstanceId_$.set(e)}closeInstanceStatusDetail(){this.instanceStatusDetailInstanceId_$.set(null)}getCcapInstanceDataSnapshot(e){return this.runtimeInstances_DS.ccapInstanceList_$().find(t=>t.ccapId===e)}getOciInstanceDataSnapshot(e){return this.runtimeInstances_DS.ociInstanceList_$().find(t=>t.instanceId===e)}getCciInstanceDataSnapshot(e){return this.runtimeInstances_DS.cciInstanceList_$().find(t=>t.ccapId===e)}getCaiInstanceDataSnapshot(e){return this.runtimeInstances_DS.caiInstanceList_$().find(t=>t.ccapId===e)}resolveOfficeInstanceById(e){return e?this.instances_$().find(a=>a.instanceId===e)??null:null}resolveModalCcapSessionStatuses(e){return V.resolveCcapSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalOciSessionStatuses(e){return V.resolveOciSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalCciSessionStatuses(e){return V.resolveCciSessionStatuses({inst:e,darkOffice_DS:this})}resolveModalCaiSessionStatuses(e){return V.resolveCaiSessionStatuses({inst:e,darkOffice_DS:this})}buildInstanceStatusDetailRuntimeHint(e){let t=e.characterType??C.ccap;if(t===C.openclaw)return this.resolveModalOciSessionStatuses(e).length>0||this.getOciInstanceDataSnapshot(e.instanceId)?"":"No matching OCI row in runtime list (last load only; socket updates may not refresh this list).";if(t===C.ccSession){let o=U.parseCcapId(e.instanceId);return!o||this.resolveModalCciSessionStatuses(e).length>0||this.getCciInstanceDataSnapshot(o)?"":"No matching CCI row in runtime list (last load only; socket updates may not refresh this list)."}if(t===C.caSession){let o=F.parseCcapId(e.instanceId);return!o||this.resolveModalCaiSessionStatuses(e).length>0||this.getCaiInstanceDataSnapshot(o)?"":"No matching CAI row in runtime list (last load only; socket updates may not refresh this list)."}return this.resolveModalCcapSessionStatuses(e).length>0||this.getCcapInstanceDataSnapshot(e.instanceId)?"":"No matching CCAP row in runtime list (last load only; socket updates may not refresh this list)."}pruneExpiredMeetingRoomKeys(e){for(let t of[...this.sessionMeetingRoomUntilByKey.keys()]){let s=this.sessionMeetingRoomUntilByKey.get(t);s!==void 0&&s<=e&&this.sessionMeetingRoomUntilByKey.delete(t)}}applyMeetingRoomTransitionForSessionDiff(e){let t=Date.now();this.pruneExpiredMeetingRoomKeys(t);let s=new Map;for(let a of e.previousRows??[])s.set(a.sessionId,a.presence);for(let a of e.nextRows??[]){let o=s.get(a.sessionId),r=`${e.baseInstanceId}::${a.sessionId}`;o===p.working&&a.presence===p.idle&&this.sessionMeetingRoomUntilByKey.set(r,t+this.meetingRoomLingerMs)}}resolveScenePlacementForSessionKey(e){let t=`${e.baseInstanceId}::${e.sessionId}`,s=this.sessionMeetingRoomUntilByKey.get(t);if(s!==void 0&&Date.now()<s)return O.meeting}handleInstanceStatusUpdate(e){let t=typeof e.ccapId=="string"?e.ccapId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t||!a)return;let o=this.instances_$(),r=o.findIndex(h=>h.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:a});let u=this.resolveSessionInfoFromStatuses(a),l=this.assignSlot(t,u.presence,c),d=this.resolveAnimState(u.presence,c.presence),f=this.applyPanelCardProjection(A(R({},c),{presence:u.presence,activitySummary:u.activitySummary,currentRunFlowPhase:u.currentRunFlowPhase,latestSessionId:u.latestSessionId,lastMessage:u.lastMessage,animState:d,previousPresence:c.presence,assignedSlotIndex:l,rawSessionStatuses:a}));this.instances_$.update(h=>h.map(I=>I.instanceId===t?f:I))}resolveSessionInfoFromStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CCAP Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCcapPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.activeRunPhase??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}applyPanelCardProjection(e){let t=e.sessionName??"";if(!t&&e.latestSessionId&&e.rawSessionStatuses){for(let s of e.rawSessionStatuses)if(s.sessionId===e.latestSessionId){t=s.sessionName??"";break}}return A(R({},e),{sessionName:t,lastMessageDerivedStatusLabel:q.buildLastMessageDerivedStatusLabel(e.lastMessage),panelActiveSessionRows:q.buildPanelActiveSessionRows({characterType:e.characterType,rawSessionStatuses:e.rawSessionStatuses})})}applyAllInstanceData(e,t,s,a){let o=this.instances_$(),r=new Map(o.map(S=>[S.instanceId,S])),c=e.map(S=>{let m=r.get(S.ccapId),g=m?.visuals??this.mapToVisuals(S),w=this.resolveSessionInfo(S),y=this.assignSlot(S.ccapId,w.presence,m),v=this.resolveAnimState(w.presence,m?.presence??null);return this.applyPanelCardProjection({instanceId:S.ccapId,presence:w.presence,activitySummary:w.activitySummary,currentRunFlowPhase:w.currentRunFlowPhase,latestSessionId:w.latestSessionId,lastMessage:w.lastMessage,visuals:g,animState:v,previousPresence:m?.presence??null,assignedSlotIndex:y,characterType:C.ccap,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),u=t.map(S=>{let m=r.get(S.instanceId),g=m?.visuals??this.mapOciToVisuals(S),w=this.resolveOciSessionInfo(S),y=this.assignSlot(S.instanceId,w.presence,m),v=this.resolveAnimState(w.presence,m?.presence??null);return this.applyPanelCardProjection({instanceId:S.instanceId,presence:w.presence,activitySummary:w.activitySummary,currentRunFlowPhase:null,latestSessionId:w.latestSessionId,lastMessage:w.lastMessage,visuals:g,animState:v,previousPresence:m?.presence??null,assignedSlotIndex:y,characterType:C.openclaw,connectionStatus:S.connectionStatus??null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),l=s.map(S=>{let m=U.build({ccapId:S.ccapId}),g=r.get(m),w=g?.visuals??this.mapCciToVisuals(S),y=this.resolveCciSessionInfo(S),v=this.assignSlot(m,y.presence,g),k=this.resolveAnimState(y.presence,g?.presence??null);return this.applyPanelCardProjection({instanceId:m,presence:y.presence,activitySummary:y.activitySummary,currentRunFlowPhase:y.currentRunFlowPhase,latestSessionId:y.latestSessionId,lastMessage:y.lastMessage,visuals:w,animState:k,previousPresence:g?.presence??null,assignedSlotIndex:v,characterType:C.ccSession,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),d=a.map(S=>{let m=F.build({ccapId:S.ccapId}),g=r.get(m),w=g?.visuals??this.mapCaiToVisuals(S),y=this.resolveCaiSessionInfo(S),v=this.assignSlot(m,y.presence,g),k=this.resolveAnimState(y.presence,g?.presence??null);return this.applyPanelCardProjection({instanceId:m,presence:y.presence,activitySummary:y.activitySummary,currentRunFlowPhase:y.currentRunFlowPhase,latestSessionId:y.latestSessionId,lastMessage:y.lastMessage,visuals:w,animState:k,previousPresence:g?.presence??null,assignedSlotIndex:v,characterType:C.caSession,connectionStatus:null,rawSessionStatuses:S.sessionStatuses??[],lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]})}),f=[...c,...u,...l,...d];for(let S of f){let m=r.get(S.instanceId);this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:S.instanceId,previousRows:m?.rawSessionStatuses,nextRows:S.rawSessionStatuses})}let h=new Set(f.map(S=>S.instanceId)),I=o.filter(S=>!h.has(S.instanceId)&&S.animState!==M.walkingOut).map(S=>this.applyPanelCardProjection(A(R({},S),{animState:M.walkingOut})));this.instances_$.set([...f,...I]),I.length>0&&setTimeout(()=>{this.instances_$.update(S=>S.filter(m=>h.has(m.instanceId)))},Me+200)}mapToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??b.skinColor,hairColor:t?.hairColor??b.hairColor,hairStyle:t?.hairStyle??b.hairStyle,shirtColor:t?.shirtColor??b.shirtColor,clothingStyle:t?.clothingStyle??b.clothingStyle,pantsColor:t?.pantsColor??b.pantsColor,eyeColor:t?.eyeColor??b.eyeColor,bodyType:t?.bodyType??b.bodyType,displayName:e.name??""}}resolveSessionInfo(e){let t=e.sessionStatuses;if(!t||t.length===0)return{presence:p.idle,activitySummary:"No CCAP Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCcapPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.activeRunPhase??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}mapOciToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??_.skinColor,hairColor:t?.hairColor??_.hairColor,hairStyle:t?.hairStyle??_.hairStyle,shirtColor:t?.shirtColor??_.shirtColor,clothingStyle:t?.clothingStyle??_.clothingStyle,pantsColor:t?.pantsColor??_.pantsColor,eyeColor:t?.eyeColor??_.eyeColor,bodyType:t?.bodyType??_.bodyType,displayName:e.label??""}}mapCaiToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??N.skinColor,hairColor:t?.hairColor??N.hairColor,hairStyle:t?.hairStyle??N.hairStyle,shirtColor:t?.shirtColor??N.shirtColor,clothingStyle:t?.clothingStyle??N.clothingStyle,pantsColor:t?.pantsColor??N.pantsColor,eyeColor:t?.eyeColor??N.eyeColor,bodyType:t?.bodyType??N.bodyType,displayName:e.name??""}}resolveCaiSessionInfo(e){let t=e.sessionStatuses??[];if(t.length===0)return{presence:p.idle,activitySummary:"No CA Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCaiPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.currentCaSessionStatus??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}mapCciToVisuals(e){let t=e.darkOfficeVisuals;return{skinColor:t?.skinColor??L.skinColor,hairColor:t?.hairColor??L.hairColor,hairStyle:t?.hairStyle??L.hairStyle,shirtColor:t?.shirtColor??L.shirtColor,clothingStyle:t?.clothingStyle??L.clothingStyle,pantsColor:t?.pantsColor??L.pantsColor,eyeColor:t?.eyeColor??L.eyeColor,bodyType:t?.bodyType??L.bodyType,displayName:e.name??""}}resolveCciSessionInfo(e){let t=e.sessionStatuses??[];if(t.length===0)return{presence:p.idle,activitySummary:"No CC Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let a=W.pickCciPrimary(t)??t[0];return{presence:a.presence,activitySummary:a.activitySummary,currentRunFlowPhase:a.currentCcSessionStatus??null,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}}resolveOciSessionInfo(e){if(!(e.connectionStatus===K.connected))return{presence:p.offline,activitySummary:"Gateway disconnected",latestSessionId:null,lastMessage:""};let s=e.sessionStatuses??[];if(s.length===0)return{presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""};let a=z.pickPrimary(s);return a?{presence:a.presence,activitySummary:a.activitySummary,latestSessionId:a.sessionId,lastMessage:a.lastMessage??""}:{presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""}}handleOciInstanceStatusUpdate(e){let t=typeof e.instanceId=="string"?e.instanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0,o=typeof e.connectionStatus=="string"?e.connectionStatus:void 0;if(!t)return;let r=this.instances_$(),c=r.findIndex(m=>m.instanceId===t);if(!(o===K.connected)&&c>=0){let m=r[c],g=this.assignSlot(t,p.offline,m),w=this.resolveAnimState(p.offline,m.presence);this.instances_$.update(y=>y.map(v=>v.instanceId===t?this.applyPanelCardProjection(A(R({},v),{presence:p.offline,activitySummary:"Gateway disconnected",lastMessage:"",animState:w,previousPresence:m.presence,assignedSlotIndex:g,connectionStatus:o??v.connectionStatus})):v));return}if(c<0){this.loadInstanceData();return}let l=r[c],d=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:l.rawSessionStatuses,nextRows:d});let f;if(d.length>0){let m=z.pickPrimary(d);m?f={presence:m.presence,activitySummary:m.activitySummary,latestSessionId:m.sessionId,lastMessage:m.lastMessage??""}:f={presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""}}else f={presence:p.idle,activitySummary:"Connected",latestSessionId:null,lastMessage:""};let h=this.assignSlot(t,f.presence,l),I=this.resolveAnimState(f.presence,l.presence),S=this.applyPanelCardProjection(A(R({},l),{presence:f.presence,activitySummary:f.activitySummary,latestSessionId:f.latestSessionId,lastMessage:f.lastMessage,animState:I,previousPresence:l.presence,assignedSlotIndex:h,connectionStatus:o??l.connectionStatus,rawSessionStatuses:d}));this.instances_$.update(m=>m.map(g=>g.instanceId===t?S:g))}handleCciInstanceStatusUpdate(e){let t=typeof e.officeInstanceId=="string"?e.officeInstanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t)return;let o=this.instances_$(),r=o.findIndex(I=>I.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r],u=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:u});let l=this.resolveSessionInfoFromCciStatuses(u),d=this.assignSlot(t,l.presence,c),f=this.resolveAnimState(l.presence,c.presence),h=this.applyPanelCardProjection(A(R({},c),{presence:l.presence,activitySummary:l.activitySummary,currentRunFlowPhase:l.currentRunFlowPhase,latestSessionId:l.latestSessionId,lastMessage:l.lastMessage,animState:f,previousPresence:c.presence,assignedSlotIndex:d,rawSessionStatuses:u}));this.instances_$.update(I=>I.map(S=>S.instanceId===t?h:S))}handleCaiInstanceStatusUpdate(e){let t=typeof e.officeInstanceId=="string"?e.officeInstanceId:void 0,s=e.sessionStatuses,a=Array.isArray(s)?s:void 0;if(!t)return;let o=this.instances_$(),r=o.findIndex(I=>I.instanceId===t);if(r<0){this.loadInstanceData();return}let c=o[r],u=a??[];this.applyMeetingRoomTransitionForSessionDiff({baseInstanceId:t,previousRows:c.rawSessionStatuses,nextRows:u});let l=this.resolveSessionInfoFromCaiStatuses(u),d=this.assignSlot(t,l.presence,c),f=this.resolveAnimState(l.presence,c.presence),h=this.applyPanelCardProjection(A(R({},c),{presence:l.presence,activitySummary:l.activitySummary,currentRunFlowPhase:l.currentRunFlowPhase,latestSessionId:l.latestSessionId,lastMessage:l.lastMessage,animState:f,previousPresence:c.presence,assignedSlotIndex:d,rawSessionStatuses:u}));this.instances_$.update(I=>I.map(S=>S.instanceId===t?h:S))}resolveSessionInfoFromCciStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CC Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCciPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.currentCcSessionStatus??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}resolveSessionInfoFromCaiStatuses(e){if(e.length===0)return{presence:p.idle,activitySummary:"No CA Session activity",currentRunFlowPhase:null,latestSessionId:null,lastMessage:""};let s=W.pickCaiPrimary(e)??e[0];return{presence:s.presence,activitySummary:s.activitySummary,currentRunFlowPhase:s.currentCaSessionStatus??null,latestSessionId:s.sessionId,lastMessage:s.lastMessage??""}}schedulePatch(e,t){let s=this.patchTimerMap.get(e);s!==void 0&&clearTimeout(s);let a=setTimeout(()=>{this.patchTimerMap.delete(e);let d=t,{displayName:o}=d,r=Se(d,["displayName"]),c=this.instances_$().find(f=>f.instanceId===e),u=F.parseCcapId(e),l=U.parseCcapId(e);u!==null?this.caiInstanceData_AS.patchByCcapId({ccapId:u,name:o||void 0,darkOfficeVisuals:r}):l!==null?this.cciInstanceData_AS.patchByCcapId({ccapId:l,name:o||void 0,darkOfficeVisuals:r}):c?.characterType===C.openclaw?this.ociInstanceData_AS.patchVisuals({instanceId:e,label:o||void 0,darkOfficeVisuals:r}):this.instanceData_AS.patchByCcapId({ccapId:e,name:o||void 0,darkOfficeVisuals:r})},300);this.patchTimerMap.set(e,a)}assignSlot(e,t,s){let a=t===p.working,o=a?this.workstationSlotMap:this.restSlotMap,r=a?this.darkOfficeLayout_DS.workstationCapacity_$():this.darkOfficeLayout_DS.restCapacity_$();if(o.has(e))return o.get(e);this.workstationSlotMap.delete(e),this.restSlotMap.delete(e);let c=new Set(o.values());for(let l=0;l<r;l++)if(!c.has(l))return o.set(e,l),l;let u=r;for(;c.has(u);)u++;return o.set(e,u),u}resolveAnimState(e,t){return t===p.offline&&e!==p.offline?M.walkingIn:t!==null&&t!==p.offline&&e===p.offline?M.walkingOut:t!==null&&t!==p.offline&&e!==p.offline&&t!==e?M.walkingBetween:e===p.working?M.working:e===p.idle?M.sitting:M.standing}assignDistinctSlotsForScene(e){let t=0,s=0,a=0;return e.map(o=>{let r;return o.scenePlacement===O.meeting?r=a++:o.presence===p.working?r=t++:r=s++,A(R({},o),{assignedSlotIndex:r})})}expandInstancesToCharacters(e){let t=[],s=Date.now(),a=Q.sceneRecentActivityWindowMs,o=Q.sceneIdleWalkActivityWindowMs,r=new Map;for(let c of e)c.characterType===C.ccap&&r.set(c.instanceId,c.presence);for(let c of e){if(c.presence===p.offline)continue;if(c.characterType===C.ccSession||c.characterType===C.caSession){let l=c.characterType===C.ccSession?U.parseCcapId(c.instanceId):F.parseCcapId(c.instanceId),d=l?r.get(l):void 0;if(d===void 0||d===p.offline)continue}t.push(this.buildInstanceBaselineCharacter(c));let u=c.rawSessionStatuses??[];for(let l of u){if(Q.isWorkingSessionRecentAndOnline({row:l,nowMs:s,windowMs:a})){t.push(this.buildPerSessionOfficeCharacter(c,l));continue}Q.isSessionInIdleWalkWindow({row:l,nowMs:s,recentWindowMs:a,idleWalkWindowMs:o})&&t.push(this.buildIdleWalkSessionCharacter(c,l))}}return t}buildIdleWalkSessionCharacter(e,t){let s=`${e.instanceId}::${t.sessionId}`;return this.applyPanelCardProjection(A(R({},e),{instanceId:s,sessionId:t.sessionId,sessionName:t.sessionName??"",presence:p.idle,activitySummary:t.activitySummary,lastMessage:t.lastMessage??"",latestSessionId:t.sessionId,currentRunFlowPhase:i.resolveSessionRunFlowPhaseLabel(t),assignedSlotIndex:0,animState:M.idleWalking,previousPresence:null,scenePlacement:void 0,rawSessionStatuses:void 0,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}buildInstanceBaselineCharacter(e){return this.applyPanelCardProjection(A(R({},e),{instanceId:e.instanceId,sessionId:void 0,sessionName:"",presence:p.idle,activitySummary:e.activitySummary,lastMessage:"",latestSessionId:null,currentRunFlowPhase:null,assignedSlotIndex:0,animState:M.sitting,previousPresence:null,scenePlacement:void 0,rawSessionStatuses:e.rawSessionStatuses,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}buildPerSessionOfficeCharacter(e,t){let s=`${e.instanceId}::${t.sessionId}`,o=(t.presence===p.working?void 0:this.resolveScenePlacementForSessionKey({baseInstanceId:e.instanceId,sessionId:t.sessionId}))===O.meeting?O.meeting:void 0;return this.applyPanelCardProjection(A(R({},e),{instanceId:s,sessionId:t.sessionId,sessionName:t.sessionName??"",presence:t.presence,activitySummary:t.activitySummary,lastMessage:t.lastMessage??"",latestSessionId:t.sessionId,currentRunFlowPhase:i.resolveSessionRunFlowPhaseLabel(t),assignedSlotIndex:0,animState:t.presence===p.working?M.working:M.sitting,previousPresence:null,scenePlacement:o,rawSessionStatuses:void 0,lastMessageDerivedStatusLabel:"",panelActiveSessionRows:[]}))}static resolveSessionRunFlowPhaseLabel(e){return"activeRunPhase"in e?e.activeRunPhase??null:"currentCcSessionStatus"in e?e.currentCcSessionStatus??null:"currentCaSessionStatus"in e?e.currentCaSessionStatus??null:null}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Z({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();export{M as a,O as b,C as c,K as d,X as e,Y as f,j as g,it as h,ot as i,at as j,rt as k,ct as l,F as m,U as n,Q as o,ke as p,ys as q};
|
|
2
|
+
//# sourceMappingURL=chunk-BWW75POL.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as S}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-GKKG77XM.js";import{M as m,t as g}from"./chunk-HHHXXHAW.js";import{C as y,N as h,a as i,aa as u,b as c,k as d,y as f}from"./chunk-TBMJSIBB.js";function I(){return{instanceId:crypto.randomUUID(),label:"default",gatewayUrl:"ws://127.0.0.1:18789",authToken:void 0,isPrimary:!1,autoConnect:!1,testState:"idle"}}function p(o){let l=[],s=o.gatewayUrl??"",t=(o.message??"").toLowerCase(),e=o.failureType??"";return s.startsWith("wss://")&&(e==="ws-error"||e==="ws-close")&&l.push('A gateway wss:// (TLS) protokollt haszn\xE1l \u2014 ha self-signed certificate-et haszn\xE1l, enged\xE9lyezd az "Allow self-signed TLS" opci\xF3t.'),s.startsWith("ws://")&&!s.startsWith("wss://")&&(e==="ws-error"||e==="ws-close")&&l.push("Ha a gateway TLS-t (wss://) haszn\xE1l, cser\xE9ld az URL-t ws:// helyett wss://-re."),e==="timeout"&&l.push("A gateway nem v\xE1laszolt id\u0151ben. Ellen\u0151rizd, hogy fut-e a gateway process \xE9s el\xE9rhet\u0151-e a megadott c\xEDmen."),e==="ws-error"&&!l.length&&l.push("Nem siker\xFClt csatlakozni. Ellen\u0151rizd: 1) fut-e a gateway, 2) helyes-e az URL \xE9s port, 3) nincs-e t\u0171zfal az \xFAtban."),(t.includes("econnrefused")||t.includes("connection refused"))&&l.push("A kapcsolat visszautas\xEDtva \u2014 a gateway nem hallgat a megadott c\xEDmen/porton."),(t.includes("certificate")||t.includes("cert")||t.includes("ssl")||t.includes("tls"))&&l.push('TLS tan\xFAs\xEDtv\xE1ny hiba \u2014 self-signed certificate eset\xE9n enged\xE9lyezd az "Allow self-signed TLS" opci\xF3t.'),l.length?`
|
|
2
2
|
|
|
3
3
|
`+l.join(`
|
|
4
4
|
`):""}var _=(()=>{class o extends m{ociData_AS=y(S);section_$=u({form:{instances:[]}});updateForm(s){this.section_$.update(t=>c(i({},t),{form:i(i({},t.form),s)}))}setSection(s){this.section_$.set(s)}getSectionId(){return g.openclawRegistry}getSection_$(){return this.section_$}doLoad(){return d(this,null,function*(){let s=new Map;for(let a of this.section_$().form.instances)s.set(a.instanceId,{testState:a.testState,testLatencyMs:a.testLatencyMs,testError:a.testError,testResultMessage:a.testResultMessage,authTokenEditMode:a.authTokenEditMode,pairState:a.pairState,pairError:a.pairError,pairMessage:a.pairMessage,pairResultMessage:a.pairResultMessage,connectionStatus:a.connectionStatus,lastConnectedAt:a.lastConnectedAt});let e=(yield this.settings_AS.getSection(g.openclawRegistry)).instances,n=Array.isArray(e)?e.map(a=>{let r=s.get(a.instanceId);return c(i({},a),{authToken:void 0,testState:r?.testState??"idle",testLatencyMs:r?.testLatencyMs,testError:r?.testError,testResultMessage:r?.testResultMessage,authTokenEditMode:r?.authTokenEditMode??!1,pairState:r?.pairState??"idle",pairError:r?.pairError,pairMessage:r?.pairMessage,pairResultMessage:r?.pairResultMessage,connectionStatus:r?.connectionStatus,lastConnectedAt:r?.lastConnectedAt})}):[];this.section_$.set({form:{instances:n}}),this.enrichWithOciStatus().catch(()=>{})})}enrichWithOciStatus(){return d(this,null,function*(){let s=yield this.ociData_AS.listInstances(),t=new Map;for(let e of s.list)t.set(e.instanceId,e);this.section_$.update(e=>c(i({},e),{form:{instances:e.form.instances.map(n=>{let a=t.get(n.instanceId);return a?c(i({},n),{connectionStatus:a.connectionStatus,lastConnectedAt:a.lastConnectedAt}):n})}}))})}buildSaveBody(){return{instances:this.section_$().form.instances.map(t=>({instanceId:t.instanceId,label:t.label,gatewayUrl:t.gatewayUrl,authToken:t.authToken,isPrimary:t.isPrimary,autoConnect:t.autoConnect,allowSelfSignedTls:t.allowSelfSignedTls}))}}savingInstanceId_$=u(null);buildSaveBodyForInstance(s){let t=this.section_$().form.instances.find(e=>e.instanceId===s);return t?{openclawRegistrySaveScope:"instance",targetInstanceId:s,instances:[{instanceId:t.instanceId,label:t.label,gatewayUrl:t.gatewayUrl,authToken:t.authToken,isPrimary:t.isPrimary,autoConnect:t.autoConnect,allowSelfSignedTls:t.allowSelfSignedTls}]}:{}}saveInstance(s){return d(this,null,function*(){this.savingInstanceId_$.set(s),this.saveError_$.set(null);try{let t=this.buildSaveBodyForInstance(s);yield this.doSave(t),yield this.load()}catch(t){this.saveError_$.set(o.getErrorMessage(t))}finally{this.savingInstanceId_$.set(null)}})}addInstance(){let s=I();this.section_$().form.instances.length||(s.isPrimary=!0),this.section_$.update(t=>c(i({},t),{form:{instances:[...t.form.instances,s]}}))}removeInstance(s){this.section_$.update(t=>{let e=t.form.instances.filter((a,r)=>r!==s);return(t.form.instances[s]?.isPrimary??!1)&&e.length>0&&(e[0]=c(i({},e[0]),{isPrimary:!0})),c(i({},t),{form:{instances:e}})})}updateInstance(s,t){this.section_$.update(e=>{let n=e.form.instances.map((a,r)=>r!==s?a:i(i({},a),t));return c(i({},e),{form:{instances:n}})})}setPrimary(s){this.section_$.update(t=>{let e=t.form.instances.map((n,a)=>c(i({},n),{isPrimary:a===s}));return c(i({},t),{form:{instances:e}})})}testConnection(s){return d(this,null,function*(){let t=this.section_$().form.instances[s];if(t){this.updateInstance(s,{testState:"testing",testLatencyMs:void 0,testError:void 0,testResultMessage:void 0});try{let e=yield this.settings_AS.testOpenclawConnection({gatewayUrl:t.gatewayUrl,authToken:t.authToken,allowSelfSignedTls:t.allowSelfSignedTls,instanceId:t.instanceId});if(e.success){let n=e.checks,a=n?" | WS: OK | v3 Handshake: OK | Sessions: OK"+(typeof n.sessionCount=="number"?` (${n.sessionCount} session)`:""):"";this.updateInstance(s,{testState:"ok",testLatencyMs:e.latencyMs,testError:void 0,testResultMessage:`Gateway el\xE9rhet\u0151 \u2014 v\xE1laszid\u0151: ${e.latencyMs}ms${a}`})}else{let n=e.error?.context?.failureType?String(e.error.context.failureType):"unknown",a=p({failureType:n,gatewayUrl:typeof e.error?.context?.gatewayUrl=="string"?e.error.context.gatewayUrl:t.gatewayUrl,message:e.error?.message});this.updateInstance(s,{testState:"error",testLatencyMs:void 0,testError:e.error??new Error("Connection failed"),testResultMessage:`Kapcsol\xF3d\xE1s sikertelen (${n}): ${e.error?.message??"ismeretlen hiba"}${a}`})}}catch(e){let n=e&&typeof e=="object"&&"error"in e?e.error:void 0,a=n?.message?String(n.message):e instanceof Error?e.message:String(e),r=p({gatewayUrl:t.gatewayUrl,message:a});this.updateInstance(s,{testState:"error",testError:n??e,testResultMessage:`Teszt hiba: ${a}${r}`})}}})}pairingInstanceId_$=u(null);pairInstance(s){return d(this,null,function*(){let t=this.section_$().form.instances[s];if(t){this.pairingInstanceId_$.set(t.instanceId),this.updateInstance(s,{pairState:"pairing",pairError:void 0,pairMessage:void 0});try{let e=yield this.settings_AS.pairOpenclawInstance({instanceId:t.instanceId});if(e.status==="paired")this.updateInstance(s,{pairState:"paired",pairingStatus:"paired",pairedAt:e.pairedAt,deviceTokenMasked:e.deviceTokenMasked,ccapDeviceId:e.ccapDeviceId,pairMessage:e.message,pairError:void 0,pairResultMessage:`Sikeresen p\xE1ros\xEDtva \u2014 device token megkapva${e.pairedAt?" ("+e.pairedAt+")":""}`});else if(e.status==="pending")this.updateInstance(s,{pairState:"pending",pairingStatus:"pending",ccapDeviceId:e.ccapDeviceId,pairingRequestId:e.pairingRequestId,pairMessage:e.message,pairError:void 0,pairResultMessage:`J\xF3v\xE1hagy\xE1sra v\xE1r a gateway-en \u2014 Device ID: ${e.ccapDeviceId??"N/A"}`});else if(e.status==="rejected")this.updateInstance(s,{pairState:"rejected",pairingStatus:"rejected",ccapDeviceId:e.ccapDeviceId,pairMessage:e.message,pairError:void 0,pairResultMessage:`A gateway elutas\xEDtotta a p\xE1ros\xEDt\xE1st: ${e.message??"ismeretlen ok"}`});else{let n=e.error?.context,a=p({failureType:typeof n?.failureType=="string"?n.failureType:void 0,gatewayUrl:typeof n?.gatewayUrl=="string"?n.gatewayUrl:t.gatewayUrl,message:e.message??e.error?.message});this.updateInstance(s,{pairState:"error",pairError:e.error??new Error(e.message??"Pairing failed"),pairMessage:e.message,pairResultMessage:`P\xE1ros\xEDt\xE1s hiba: ${e.message??e.error?.message??"ismeretlen hiba"}${a}`})}yield this.load()}catch(e){let n=e&&typeof e=="object"&&"error"in e?e.error:void 0,a=n?.message?String(n.message):e instanceof Error?e.message:String(e),r=n?.context,w=p({failureType:typeof r?.failureType=="string"?r.failureType:void 0,gatewayUrl:typeof r?.gatewayUrl=="string"?r.gatewayUrl:t.gatewayUrl,message:a});this.updateInstance(s,{pairState:"error",pairError:n??e,pairMessage:void 0,pairResultMessage:`P\xE1ros\xEDt\xE1s hiba: ${a}${w}`})}finally{this.pairingInstanceId_$.set(null)}}})}static \u0275fac=(()=>{let s;return function(e){return(s||(s=h(o)))(e||o)}})();static \u0275prov=f({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();export{_ as a};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-DC4EFEQU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as f,p as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{I as f,p as h}from"./chunk-HHHXXHAW.js";import{C as o,aa as i,h as g,k as s,p as n,xb as u,y as a}from"./chunk-TBMJSIBB.js";var l=g(h());var d=(()=>{class e{baseUrl=`${f.api.baseUrl}/instance-registry`;http=o(u);getList(){return n(this.http.get(`${this.baseUrl}/list`))}getCurrent(){return n(this.http.get(`${this.baseUrl}/current`))}getListUnified(){return n(this.http.get(`${this.baseUrl}/list-unified`))}getPresence(){return n(this.http.get(`${this.baseUrl}/presence`))}static \u0275fac=function(r){return new(r||e)};static \u0275prov=a({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var E=(()=>{class e{list_$=i([]);listLoading_$=i(!1);listError_$=i(null);current_$=i(null);currentLoading_$=i(!1);currentError_$=i(null);unifiedList_$=i([]);unifiedListLoading_$=i(!1);unifiedListError_$=i(null);instanceRegistry_AS=o(d);loadList(){return s(this,null,function*(){this.listLoading_$.set(!0),this.listError_$.set(null);try{let r=(yield this.instanceRegistry_AS.getList()).list??[];return this.list_$.set(r),r}catch(t){return l.DyFM_Error.logSimple("CCAP_InstanceRegistryDS | loadList failed",t),this.listError_$.set(t),[]}finally{this.listLoading_$.set(!1)}})}loadCurrent(){return s(this,null,function*(){this.currentLoading_$.set(!0),this.currentError_$.set(null);try{let r=(yield this.instanceRegistry_AS.getCurrent()).current??null;return this.current_$.set(r),r}catch(t){return l.DyFM_Error.logSimple("CCAP_InstanceRegistryDS | loadCurrent failed",t),this.currentError_$.set(t),this.current_$.set(null),null}finally{this.currentLoading_$.set(!1)}})}loadAll(){return s(this,null,function*(){yield Promise.all([this.loadList(),this.loadCurrent()])})}loadUnifiedList(){return s(this,null,function*(){this.unifiedListLoading_$.set(!0),this.unifiedListError_$.set(null);try{let r=(yield this.instanceRegistry_AS.getListUnified()).list??[];return this.unifiedList_$.set(r),r}catch(t){return l.DyFM_Error.logSimple("CCAP_InstanceRegistryDS | loadUnifiedList failed",t),this.unifiedListError_$.set(t),[]}finally{this.unifiedListLoading_$.set(!1)}})}isCurrentRow(t){let r=this.current_$()?.instanceKey?.trim(),c=t.instanceKey?.trim();return!r||!c?!1:r===c}formatMetadataDate(t){if(t==null)return"\u2014";if(t instanceof Date)return Number.isNaN(t.getTime())?"\u2014":t.toISOString();let r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toISOString()}static \u0275fac=function(r){return new(r||e)};static \u0275prov=a({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{d as a,E as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EEOSB2P7.js.map
|