@futdevpro/ccap 1.1.3002 → 1.1.3008
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-GN4PQAF3.js} +2 -2
- package/client-dist/ca.module-CKYKW3JK.js +5 -0
- package/client-dist/ca.module-CKYKW3JK.js.map +7 -0
- package/client-dist/{cc-usage-dashboard.component-D6CNJHB5.js → cc-usage-dashboard.component-Q5JJBLZ4.js} +2 -2
- package/client-dist/{cc.module-T3NJWMZ5.js → cc.module-PWOSEU35.js} +4 -4
- package/client-dist/cc.module-PWOSEU35.js.map +7 -0
- package/client-dist/{chunk-I4V3JDZC.js → chunk-25I4EVM2.js} +2 -2
- package/client-dist/{chunk-E6DWNZNG.js → chunk-2EZEKYOT.js} +2 -2
- package/client-dist/{chunk-QXIUTGNM.js → chunk-2UGNMPLF.js} +2 -2
- package/client-dist/{chunk-ZZ7RWOLH.js → chunk-3EZGW2AE.js} +2 -2
- package/client-dist/{chunk-2IYGO6RM.js → chunk-4KJ53ND4.js} +2 -2
- package/client-dist/{chunk-ZZRTMXBT.js → chunk-4UCTQFBQ.js} +2 -2
- package/client-dist/{chunk-P7Z33WJF.js → chunk-543UYBGO.js} +2 -2
- package/client-dist/{chunk-SJ6KKDJT.js → chunk-5ZSG63JI.js} +2 -2
- package/client-dist/{chunk-NCOPOED7.js → chunk-75PLAFQN.js} +2 -2
- package/client-dist/{chunk-WNQYZI4D.js → chunk-77DEVH3B.js} +2 -2
- package/client-dist/{chunk-W7OH67K2.js → chunk-7SMKTOH2.js} +2 -2
- package/client-dist/{chunk-JLF2BDJU.js → chunk-7Y72ZMAB.js} +2 -2
- package/client-dist/{chunk-GNWPRBF5.js → chunk-A2QJB3E4.js} +2 -2
- package/client-dist/{chunk-DPXSAO23.js → chunk-ALW7KZ7Q.js} +2 -2
- package/client-dist/{chunk-IGWJMU5B.js → chunk-AON3XCTS.js} +2 -2
- package/client-dist/{chunk-FOL6X3TR.js → chunk-BHJM6S4T.js} +2 -2
- package/client-dist/{chunk-7SCYMYZG.js → chunk-EK4MRIFY.js} +2 -2
- package/client-dist/{chunk-3JQ2UHMM.js → chunk-FSZ2PEZ2.js} +2 -2
- package/client-dist/{chunk-SJTW4HLQ.js → chunk-GE472LIK.js} +2 -2
- package/client-dist/{chunk-64K7CP3A.js → chunk-GETS4G5N.js} +2 -2
- package/client-dist/{chunk-3SYXOECP.js → chunk-GNA4E3CW.js} +2 -2
- package/client-dist/{chunk-XKS3GVP3.js → chunk-H76CW7P3.js} +2 -2
- package/client-dist/{chunk-3LPBF4AU.js → chunk-HDAWX2XF.js} +2 -2
- package/client-dist/{chunk-A3RMSX34.js → chunk-HJHNE6YH.js} +2 -2
- package/client-dist/{chunk-7VUQTBJ2.js → chunk-HJO6XKJU.js} +2 -2
- package/client-dist/{chunk-S46BSLUB.js → chunk-HRWESQZ7.js} +2 -2
- package/client-dist/{chunk-36LPXL3M.js → chunk-HVP7A2W5.js} +2 -2
- package/client-dist/{chunk-YWW2VAZR.js → chunk-HW7NI36G.js} +2 -2
- package/client-dist/{chunk-CN76LOPU.js → chunk-IM75ARVA.js} +2 -2
- package/client-dist/{chunk-VQSRIIPK.js → chunk-LBCLWTHX.js} +2 -2
- package/client-dist/{chunk-AQD6DEHR.js → chunk-LHZIBNFR.js} +2 -2
- package/client-dist/{chunk-PTS77H25.js → chunk-LWUIDMNL.js} +2 -2
- package/client-dist/{chunk-O6IRGFCX.js → chunk-LYMCPIS7.js} +2 -2
- package/client-dist/{chunk-ZW4M7CJ2.js → chunk-NO6TCJGM.js} +2 -2
- package/client-dist/{chunk-ZPE6HI3H.js → chunk-NRQ7LIBM.js} +2 -2
- package/client-dist/{chunk-SBJAWWHF.js → chunk-NVK2NT5O.js} +2 -2
- package/client-dist/{chunk-SBJAWWHF.js.map → chunk-NVK2NT5O.js.map} +3 -3
- package/client-dist/{chunk-ZLCRMQAK.js → chunk-O2FA6HNL.js} +2 -2
- package/client-dist/{chunk-7YT7BGBD.js → chunk-OASG3NKM.js} +2 -2
- package/client-dist/{chunk-KHVPVWG7.js → chunk-OYB4VU7M.js} +2 -2
- package/client-dist/{chunk-FID2RUXN.js → chunk-PEEGB2PT.js} +2 -2
- package/client-dist/{chunk-SAC7F2CB.js → chunk-PR4Y5XDM.js} +2 -2
- package/client-dist/{chunk-7MZ4N75F.js → chunk-RHGTAI5Z.js} +2 -2
- package/client-dist/{chunk-OVU6SA42.js → chunk-RUNHLH7T.js} +2 -2
- package/client-dist/{chunk-5HYEA5IO.js → chunk-S4CBPEPW.js} +2 -2
- package/client-dist/chunk-S5BXJ3N4.js +4 -0
- package/client-dist/{chunk-OXEKAYMY.js.map → chunk-S5BXJ3N4.js.map} +3 -3
- package/client-dist/{chunk-DB44BUNE.js → chunk-SADTSOZ4.js} +2 -2
- package/client-dist/{chunk-PVLRUWUC.js → chunk-SD7AGJZH.js} +2 -2
- package/client-dist/{chunk-6227S2CN.js → chunk-TJTRKXZC.js} +2 -2
- package/client-dist/{chunk-4AVVQGND.js → chunk-U7HJBEWP.js} +2 -2
- package/client-dist/{chunk-W3HNVMKS.js → chunk-UB5YSCWY.js} +2 -2
- package/client-dist/{chunk-TNGH7PJP.js → chunk-ULMUGWHO.js} +2 -2
- package/client-dist/{chunk-IUCQWZ34.js → chunk-VG3BRAVF.js} +2 -2
- package/client-dist/{chunk-EGZ2ZMS3.js → chunk-VZXRS3CY.js} +2 -2
- package/client-dist/{chunk-2ZTUWDCN.js → chunk-WCQEVEV6.js} +2 -2
- package/client-dist/{chunk-5DUG67IY.js → chunk-YYFQVRYR.js} +2 -2
- package/client-dist/{chunk-TIJCR5DW.js → chunk-ZUSKVUGS.js} +2 -2
- package/client-dist/{chunk-TIJCR5DW.js.map → chunk-ZUSKVUGS.js.map} +1 -1
- package/client-dist/{consultant.module-J2JDO2WS.js → consultant.module-53M2Y4PS.js} +2 -2
- package/client-dist/{crd.module-SCW4OTC2.js → crd.module-576N24XD.js} +2 -2
- package/client-dist/{dashboard.module-F55QGGVH.js → dashboard.module-D4N6YL4E.js} +2 -2
- package/client-dist/{do.module-7FRBSMAA.js → do.module-RYNW2MQK.js} +2 -2
- package/client-dist/{document-library.module-B6VXHRG7.js → document-library.module-35GLKIFU.js} +2 -2
- package/client-dist/{embedding-eval.module-NPC3TEIO.js → embedding-eval.module-TLH2FYJN.js} +2 -2
- package/client-dist/{embedding-registry.module-LIVVEPZY.js → embedding-registry.module-B2CVM2LG.js} +2 -2
- package/client-dist/{err.module-YOIHNORT.js → err.module-3Z2NKVJP.js} +2 -2
- package/client-dist/{feedback.module-V5KVPNYZ.js → feedback.module-KZ2RUEQ3.js} +2 -2
- package/client-dist/{host-runtime-mcp.module-PHWXY4PV.js → host-runtime-mcp.module-B2NZZ76H.js} +2 -2
- package/client-dist/index.html +2 -2
- package/client-dist/{live-dev-pipeline.module-NGFZQDD3.js → live-dev-pipeline.module-7YGIVZDK.js} +2 -2
- package/client-dist/{logs.module-U22RMCHY.js → logs.module-BJM5JU3E.js} +2 -2
- package/client-dist/{main-E47XWCXH.js → main-4GMW27ZD.js} +3 -3
- package/client-dist/{master-control-remote-poc.module-EBA63OMO.js → master-control-remote-poc.module-NFVYO3TC.js} +2 -2
- package/client-dist/{mobile-app.module-SRY6NVNR.js → mobile-app.module-AJXVZHZD.js} +2 -2
- package/client-dist/{model-registry.module-UTATZZJR.js → model-registry.module-P3GYIQV5.js} +2 -2
- package/client-dist/oc.module-HPRR6R6N.js +3 -0
- package/client-dist/oc.module-HPRR6R6N.js.map +7 -0
- package/client-dist/{orc.module-MKANMSGC.js → orc.module-M42ZABQO.js} +2 -2
- package/client-dist/{project-management.module-4LL5UVW5.js → project-management.module-DFDGNSZI.js} +2 -2
- package/client-dist/project-source-routed.module-LCGCSMJZ.js +2 -0
- package/client-dist/{scheduler.module-COHLY6ZF.js → scheduler.module-3I7X5DM3.js} +2 -2
- package/client-dist/{session.module-JQCXS6ZJ.js → session.module-XLIKQTZZ.js} +9 -9
- package/client-dist/session.module-XLIKQTZZ.js.map +7 -0
- package/client-dist/{set.module-PUU5N4MJ.js → set.module-2LSG7A5L.js} +2 -2
- package/client-dist/{setup.module-HPV5JS3I.js → setup.module-XEGHSWPE.js} +2 -2
- package/client-dist/{styles-XKQ3MDLE.css → styles-VMCPLJOS.css} +2 -2
- package/client-dist/{styles-XKQ3MDLE.css.map → styles-VMCPLJOS.css.map} +1 -1
- package/client-dist/{terminals.module-VIWV443T.js → terminals.module-SCMLUJKP.js} +2 -2
- package/client-dist/{voice-notes-poc.module-ZNRSQ6XH.js → voice-notes-poc.module-WJ6RZAXO.js} +2 -2
- package/client-dist/{wfs.module-CIG5GOVA.js → wfs.module-EXKZZCJ5.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-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-GN4PQAF3.js.map} +0 -0
- /package/client-dist/{cc-usage-dashboard.component-D6CNJHB5.js.map → cc-usage-dashboard.component-Q5JJBLZ4.js.map} +0 -0
- /package/client-dist/{chunk-I4V3JDZC.js.map → chunk-25I4EVM2.js.map} +0 -0
- /package/client-dist/{chunk-E6DWNZNG.js.map → chunk-2EZEKYOT.js.map} +0 -0
- /package/client-dist/{chunk-QXIUTGNM.js.map → chunk-2UGNMPLF.js.map} +0 -0
- /package/client-dist/{chunk-ZZ7RWOLH.js.map → chunk-3EZGW2AE.js.map} +0 -0
- /package/client-dist/{chunk-2IYGO6RM.js.map → chunk-4KJ53ND4.js.map} +0 -0
- /package/client-dist/{chunk-ZZRTMXBT.js.map → chunk-4UCTQFBQ.js.map} +0 -0
- /package/client-dist/{chunk-P7Z33WJF.js.map → chunk-543UYBGO.js.map} +0 -0
- /package/client-dist/{chunk-SJ6KKDJT.js.map → chunk-5ZSG63JI.js.map} +0 -0
- /package/client-dist/{chunk-NCOPOED7.js.map → chunk-75PLAFQN.js.map} +0 -0
- /package/client-dist/{chunk-WNQYZI4D.js.map → chunk-77DEVH3B.js.map} +0 -0
- /package/client-dist/{chunk-W7OH67K2.js.map → chunk-7SMKTOH2.js.map} +0 -0
- /package/client-dist/{chunk-JLF2BDJU.js.map → chunk-7Y72ZMAB.js.map} +0 -0
- /package/client-dist/{chunk-GNWPRBF5.js.map → chunk-A2QJB3E4.js.map} +0 -0
- /package/client-dist/{chunk-DPXSAO23.js.map → chunk-ALW7KZ7Q.js.map} +0 -0
- /package/client-dist/{chunk-IGWJMU5B.js.map → chunk-AON3XCTS.js.map} +0 -0
- /package/client-dist/{chunk-FOL6X3TR.js.map → chunk-BHJM6S4T.js.map} +0 -0
- /package/client-dist/{chunk-7SCYMYZG.js.map → chunk-EK4MRIFY.js.map} +0 -0
- /package/client-dist/{chunk-3JQ2UHMM.js.map → chunk-FSZ2PEZ2.js.map} +0 -0
- /package/client-dist/{chunk-SJTW4HLQ.js.map → chunk-GE472LIK.js.map} +0 -0
- /package/client-dist/{chunk-64K7CP3A.js.map → chunk-GETS4G5N.js.map} +0 -0
- /package/client-dist/{chunk-3SYXOECP.js.map → chunk-GNA4E3CW.js.map} +0 -0
- /package/client-dist/{chunk-XKS3GVP3.js.map → chunk-H76CW7P3.js.map} +0 -0
- /package/client-dist/{chunk-3LPBF4AU.js.map → chunk-HDAWX2XF.js.map} +0 -0
- /package/client-dist/{chunk-A3RMSX34.js.map → chunk-HJHNE6YH.js.map} +0 -0
- /package/client-dist/{chunk-7VUQTBJ2.js.map → chunk-HJO6XKJU.js.map} +0 -0
- /package/client-dist/{chunk-S46BSLUB.js.map → chunk-HRWESQZ7.js.map} +0 -0
- /package/client-dist/{chunk-36LPXL3M.js.map → chunk-HVP7A2W5.js.map} +0 -0
- /package/client-dist/{chunk-YWW2VAZR.js.map → chunk-HW7NI36G.js.map} +0 -0
- /package/client-dist/{chunk-CN76LOPU.js.map → chunk-IM75ARVA.js.map} +0 -0
- /package/client-dist/{chunk-VQSRIIPK.js.map → chunk-LBCLWTHX.js.map} +0 -0
- /package/client-dist/{chunk-AQD6DEHR.js.map → chunk-LHZIBNFR.js.map} +0 -0
- /package/client-dist/{chunk-PTS77H25.js.map → chunk-LWUIDMNL.js.map} +0 -0
- /package/client-dist/{chunk-O6IRGFCX.js.map → chunk-LYMCPIS7.js.map} +0 -0
- /package/client-dist/{chunk-ZW4M7CJ2.js.map → chunk-NO6TCJGM.js.map} +0 -0
- /package/client-dist/{chunk-ZPE6HI3H.js.map → chunk-NRQ7LIBM.js.map} +0 -0
- /package/client-dist/{chunk-ZLCRMQAK.js.map → chunk-O2FA6HNL.js.map} +0 -0
- /package/client-dist/{chunk-7YT7BGBD.js.map → chunk-OASG3NKM.js.map} +0 -0
- /package/client-dist/{chunk-KHVPVWG7.js.map → chunk-OYB4VU7M.js.map} +0 -0
- /package/client-dist/{chunk-FID2RUXN.js.map → chunk-PEEGB2PT.js.map} +0 -0
- /package/client-dist/{chunk-SAC7F2CB.js.map → chunk-PR4Y5XDM.js.map} +0 -0
- /package/client-dist/{chunk-7MZ4N75F.js.map → chunk-RHGTAI5Z.js.map} +0 -0
- /package/client-dist/{chunk-OVU6SA42.js.map → chunk-RUNHLH7T.js.map} +0 -0
- /package/client-dist/{chunk-5HYEA5IO.js.map → chunk-S4CBPEPW.js.map} +0 -0
- /package/client-dist/{chunk-DB44BUNE.js.map → chunk-SADTSOZ4.js.map} +0 -0
- /package/client-dist/{chunk-PVLRUWUC.js.map → chunk-SD7AGJZH.js.map} +0 -0
- /package/client-dist/{chunk-6227S2CN.js.map → chunk-TJTRKXZC.js.map} +0 -0
- /package/client-dist/{chunk-4AVVQGND.js.map → chunk-U7HJBEWP.js.map} +0 -0
- /package/client-dist/{chunk-W3HNVMKS.js.map → chunk-UB5YSCWY.js.map} +0 -0
- /package/client-dist/{chunk-TNGH7PJP.js.map → chunk-ULMUGWHO.js.map} +0 -0
- /package/client-dist/{chunk-IUCQWZ34.js.map → chunk-VG3BRAVF.js.map} +0 -0
- /package/client-dist/{chunk-EGZ2ZMS3.js.map → chunk-VZXRS3CY.js.map} +0 -0
- /package/client-dist/{chunk-2ZTUWDCN.js.map → chunk-WCQEVEV6.js.map} +0 -0
- /package/client-dist/{chunk-5DUG67IY.js.map → chunk-YYFQVRYR.js.map} +0 -0
- /package/client-dist/{consultant.module-J2JDO2WS.js.map → consultant.module-53M2Y4PS.js.map} +0 -0
- /package/client-dist/{crd.module-SCW4OTC2.js.map → crd.module-576N24XD.js.map} +0 -0
- /package/client-dist/{dashboard.module-F55QGGVH.js.map → dashboard.module-D4N6YL4E.js.map} +0 -0
- /package/client-dist/{do.module-7FRBSMAA.js.map → do.module-RYNW2MQK.js.map} +0 -0
- /package/client-dist/{document-library.module-B6VXHRG7.js.map → document-library.module-35GLKIFU.js.map} +0 -0
- /package/client-dist/{embedding-eval.module-NPC3TEIO.js.map → embedding-eval.module-TLH2FYJN.js.map} +0 -0
- /package/client-dist/{embedding-registry.module-LIVVEPZY.js.map → embedding-registry.module-B2CVM2LG.js.map} +0 -0
- /package/client-dist/{err.module-YOIHNORT.js.map → err.module-3Z2NKVJP.js.map} +0 -0
- /package/client-dist/{feedback.module-V5KVPNYZ.js.map → feedback.module-KZ2RUEQ3.js.map} +0 -0
- /package/client-dist/{host-runtime-mcp.module-PHWXY4PV.js.map → host-runtime-mcp.module-B2NZZ76H.js.map} +0 -0
- /package/client-dist/{live-dev-pipeline.module-NGFZQDD3.js.map → live-dev-pipeline.module-7YGIVZDK.js.map} +0 -0
- /package/client-dist/{logs.module-U22RMCHY.js.map → logs.module-BJM5JU3E.js.map} +0 -0
- /package/client-dist/{main-E47XWCXH.js.map → main-4GMW27ZD.js.map} +0 -0
- /package/client-dist/{master-control-remote-poc.module-EBA63OMO.js.map → master-control-remote-poc.module-NFVYO3TC.js.map} +0 -0
- /package/client-dist/{mobile-app.module-SRY6NVNR.js.map → mobile-app.module-AJXVZHZD.js.map} +0 -0
- /package/client-dist/{model-registry.module-UTATZZJR.js.map → model-registry.module-P3GYIQV5.js.map} +0 -0
- /package/client-dist/{orc.module-MKANMSGC.js.map → orc.module-M42ZABQO.js.map} +0 -0
- /package/client-dist/{project-management.module-4LL5UVW5.js.map → project-management.module-DFDGNSZI.js.map} +0 -0
- /package/client-dist/{project-source-routed.module-DSUCIWHV.js.map → project-source-routed.module-LCGCSMJZ.js.map} +0 -0
- /package/client-dist/{scheduler.module-COHLY6ZF.js.map → scheduler.module-3I7X5DM3.js.map} +0 -0
- /package/client-dist/{set.module-PUU5N4MJ.js.map → set.module-2LSG7A5L.js.map} +0 -0
- /package/client-dist/{setup.module-HPV5JS3I.js.map → setup.module-XEGHSWPE.js.map} +0 -0
- /package/client-dist/{terminals.module-VIWV443T.js.map → terminals.module-SCMLUJKP.js.map} +0 -0
- /package/client-dist/{voice-notes-poc.module-ZNRSQ6XH.js.map → voice-notes-poc.module-WJ6RZAXO.js.map} +0 -0
- /package/client-dist/{wfs.module-CIG5GOVA.js.map → wfs.module-EXKZZCJ5.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as _,K as T,N as D,p as U}from"./chunk-
|
|
1
|
+
import{I as _,K as T,N as D,p as U}from"./chunk-ZUSKVUGS.js";import{C,Gb as H,a as b,aa as I,b as j,h as w,k as L,p as g,q as h,wb as d,xb as M,y as F}from"./chunk-TBMJSIBB.js";var y=[{prefix:"/setup",hint:"Setup \u2014 client/src/app/_modules/config/_modules/setup/"},{prefix:"/settings",hint:"Settings \u2014 client/src/app/_modules/config/_modules/settings/"},{prefix:"/model-registry",hint:"Model registry \u2014 client/src/app/_modules/model-registry/"},{prefix:"/embedding-registry",hint:"Embedding registry \u2014 client/src/app/_modules/ai-systems/_modules/embedding-registry/"},{prefix:"/embedding-eval",hint:"Embedding eval \u2014 client/src/app/_modules/embedding-eval/"},{prefix:"/session",hint:"CCAP Session UI \u2014 client/src/app/_modules/session/"},{prefix:"/errors",hint:"Errors list \u2014 client/src/app/_modules/system/_modules/errors/"},{prefix:"/feedback",hint:"Feedback \u2014 client/src/app/_modules/feedback/"},{prefix:"/logs",hint:"Logs \u2014 client/src/app/_modules/dev/_modules/devtools/_modules/logs/"},{prefix:"/host-runtime-mcp",hint:"Host runtime MCP \u2014 client/src/app/_modules/dev/_modules/host-runtime-mcp/"},{prefix:"/voice-notes-poc",hint:"Voice notes POC \u2014 client/src/app/_modules/dev/_modules/poc/voice-notes-poc/"},{prefix:"/master-control-remote-poc",hint:"Master control remote POC \u2014 client/src/app/_modules/dev/_modules/poc/master-control-remote-poc/"},{prefix:"/workflow-settings",hint:"Workflow settings \u2014 client/src/app/_modules/config/_modules/workflow-settings/"},{prefix:"/coordinator",hint:"Coordinator \u2014 client/src/app/_modules/coordinator/"},{prefix:"/dark-office",hint:"Dark Office \u2014 client/src/app/_modules/dark-office/"},{prefix:"/project-management",hint:"Project management \u2014 client/src/app/_modules/project-management/"},{prefix:"/cc-session",hint:"CC Session UI \u2014 client/src/app/_modules/cc-session/"},{prefix:"/mobile-app",hint:"Mobile app \u2014 client/src/app/_modules/dev/_modules/poc/mobile-app/"},{prefix:"/oc-session",hint:"OC Session \u2014 client/src/app/_modules/oc/"},{prefix:"/ca-session",hint:"CA Session \u2014 client/src/app/_modules/ca-session/"},{prefix:"/consultant",hint:"Consultant \u2014 client/src/app/_modules/consultant/"},{prefix:"/agent-instances",hint:"Agent instances \u2014 client/src/app/_modules/agent-instances/"},{prefix:"/terminals",hint:"Terminals \u2014 client/src/app/_modules/dev/_modules/devtools/_modules/terminals/"},{prefix:"/live-development-pipeline",hint:"Live Development Pipeline \u2014 client/src/app/_modules/dev/_modules/devtools/_modules/live-dev-pipeline/"},{prefix:"/system-status",hint:"Legacy route \u2192 redirects to /live-development-pipeline \u2014 client/src/app/_modules/dev/_modules/devtools/_modules/live-dev-pipeline/"},{prefix:"/",hint:"Dashboard (root) \u2014 client/src/app/_modules/dashboard/"}];var q="NG0203",S=class r{static isNg0203Message(n){return n.trim()===q}static buildDiagnostics(n){let t={route:n.context.route,url:n.context.url,userAgent:n.context.userAgent,timestamp:n.context.timestamp},e=r.parseStackFrames(n.stack),i=typeof n.context.route=="string"?n.context.route:"",o=r.resolveRouteFeatureHints(i),s=r.buildStaticGuidance(),l=r.buildToolSteps({clientSnapshot:t,clientSource:n.clientSource,stackFrames:e,routeFeatureHints:o});return{summary:"Angular NG0203: inject() was called outside an injection context (constructor, field initializer, factory, or runInInjectionContext).",clientSource:n.clientSource,clientSnapshot:t,stackFrames:e,routeFeatureHints:o,staticGuidance:s,toolSteps:l}}static formatDiagnosticsAppendix(n){let t;try{t=JSON.stringify(n,null,2)}catch{t='{"ng0203Diagnostics":"JSON stringify failed"}'}return`
|
|
2
2
|
|
|
3
3
|
[NG0203 diagnostics]
|
|
4
4
|
${t}`}static parseStackFrames(n){if(n==null||!n.trim())return[];let t=n.split(`
|
|
@@ -24,4 +24,4 @@ ${String(n)}`}function nt(r){if(r instanceof Error&&typeof r.stack=="string"&&r.
|
|
|
24
24
|
`),s=t!=null&&t.trim().length>0?t.trim():"(no stack)";return`${o}
|
|
25
25
|
|
|
26
26
|
${s}`}buildReportPayloadFromError(t,e){let i=this.getCurrentContext(),o=f.getErrorMessageForDisplay(t),s=r.enrichMessageForReport(t,o),l=f.getStackForReport(t),m=this.buildStackWithContext(l,i),R=r.extractErrorCode(t),E=r.extractAdditionalContent(t);return{message:s,stack:m,source:e??"client-app",errorCode:R,errorAdditionalContent:E,clientContext:i}}static enrichMessageForReport(t,e){if(!(t instanceof d))return e;let i=t.url?`URL: ${t.url}`:"URL: (?)",o=`status: ${t.status}`;return`${e} | ${i} | ${o}`}static extractErrorCode(t){if(t==null||typeof t!="object")return;let e=t;if(typeof e.errorCode=="string"&&e.errorCode.length>0)return e.errorCode;if(typeof e._errorCode=="string"&&e._errorCode.length>0)return e._errorCode}static extractAdditionalContent(t){if(t==null||typeof t!="object")return;let e=t;if(e.additionalContent!=null&&typeof e.additionalContent=="object")return e.additionalContent}buildReportPayloadFromParams(t){let e=this.getCurrentContext(),i=this.buildStackWithContext(t.stack,e);return{message:t.message,stack:i,source:t.source,clientContext:e}}showError(t,e){setTimeout(()=>{try{let i=f.getErrorMessageForDisplay(t),o=N.tryGetShortNotificationAffix({error:t});if(o.length>0&&(i=i+o),!(t instanceof d)&&!(this.settingsGeneral_DS.section_$().form.reportSocketConnectionErrorsToErrorList===!0)&&x.matchesDisplayMessage(i)){t instanceof Error&&p.DyFM_Log.error("[CCAP]",e??"client-app",t);return}let s=this.getCurrentContext(),l;if(k.isNg0600Message(i))try{l=k.buildDiagnostics({stack:f.getStackForReport(t),context:{route:s.route,url:s.url,userAgent:s.userAgent,timestamp:s.timestamp},clientSource:e})}catch(a){p.DyFM_Log.error("CCAP NG0600 diagnostics failed",a)}let m;if(S.isNg0203Message(i))try{m=S.buildDiagnostics({stack:f.getStackForReport(t),context:{route:s.route,url:s.url,userAgent:s.userAgent,timestamp:s.timestamp},clientSource:e})}catch(a){p.DyFM_Log.error("CCAP NG0203 diagnostics failed",a)}let R=e!=null&&e.trim().length>0?e.trim():void 0,E={id:this.nextNotificationId++,error:t,displayMessage:i,timestamp:Date.now(),isDismissing:!1,clientSource:R,ng0600Diagnostics:l,ng0203Diagnostics:m};if(this.errors_$.update(a=>{let u=[...a,E];return u.length>r.maxNotifications?u.slice(u.length-r.maxNotifications):u}),setTimeout(()=>{this.dismissNotification(E.id)},r.autoDismissMs),t instanceof Error&&p.DyFM_Log.error("[CCAP]",e??"client-app",t),!(t instanceof d)){let a=this.buildReportPayloadFromError(t,e??"client-app"),u="";l!=null?u=k.formatDiagnosticsAppendix(l):m!=null&&(u=S.formatDiagnosticsAppendix(m));let X=u.length>0?`${a.stack??""}${u}`:a.stack??"",Y={message:a.message,stack:X,source:a.source,sessionId:a.sessionId,runId:a.runId,errorCode:a.errorCode,errorAdditionalContent:a.errorAdditionalContent,clientContext:a.clientContext};this.errors_AS.reportError(Y).catch(()=>{})}}catch(i){p.DyFM_Log.error("CCAP showError set failed",i)}},0)}selectError(t){let e=this.errors_$().find(i=>i.id===t);e!=null&&this.selectedNotificationForModal_$.set(e)}dismissNotification(t){let i=this.errors_$().find(o=>o.id===t);i==null||i.isDismissing||(this.errors_$.update(o=>o.map(s=>s.id===t?j(b({},s),{isDismissing:!0}):s)),setTimeout(()=>{this.errors_$.update(o=>o.filter(s=>s.id!==t))},r.exitAnimationMs))}dismissSelected(){this.selectedNotificationForModal_$.set(null)}dismissAll(){this.errors_$.set([]),this.selectedNotificationForModal_$.set(null)}copyToClipboard(t){return L(this,null,function*(){return(yield this.tryWriteTextWithNavigatorClipboard(t))?{ok:!0}:this.copyTextWithExecCommand(t)?{ok:!0}:{ok:!1,error:new Error("Clipboard copy failed (secure Clipboard API unavailable or denied, and legacy execCommand copy failed)")}})}tryWriteTextWithNavigatorClipboard(t){return L(this,null,function*(){let e=typeof navigator<"u"?navigator.clipboard:void 0;if(e==null||typeof e.writeText!="function")return!1;try{return yield e.writeText(t),!0}catch{return!1}})}copyTextWithExecCommand(t){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.setAttribute("aria-hidden","true"),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="0",e.style.border="none",e.style.outline="none",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e),e.focus(),e.select();let i=t.length;e.setSelectionRange(0,i);let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return e.remove(),o}reportErrorOnly(t){if(!(this.settingsGeneral_DS.section_$().form.reportSocketConnectionErrorsToErrorList===!0)&&(t.source==="client-socket"||x.matchesDisplayMessage(t.message)))return;let i=this.buildReportPayloadFromParams(t);this.errors_AS.reportError(i).catch(()=>{})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=F({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{S as a,k as b,c,$ as d,v as e,z as f,N as g,f as h,V as i,Ot as j};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-O2FA6HNL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{I as o}from"./chunk-ZUSKVUGS.js";import{C as s,p as r,xb as a,y as n}from"./chunk-TBMJSIBB.js";var h=(()=>{class e{baseUrl=`${o.api.baseUrl}/oci-instance-data`;http=s(a);listInstances(){return r(this.http.get(`${this.baseUrl}/list`))}getByInstanceId(t){return r(this.http.get(`${this.baseUrl}/by-id/${t}`))}patchVisuals(t){let i={};return t.label!==void 0&&(i.label=t.label),t.darkOfficeVisuals!==void 0&&(i.darkOfficeVisuals=t.darkOfficeVisuals),r(this.http.patch(`${this.baseUrl}/by-id/${t.instanceId}`,i))}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OASG3NKM.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as P}from"./chunk-IUCQWZ34.js";import{a as T}from"./chunk-UFBTR2BG.js";import{a as U}from"./chunk-2IYGO6RM.js";import{e as k}from"./chunk-4AVVQGND.js";import{G as C,I as y,p as O}from"./chunk-TIJCR5DW.js";import{C as p,a as $,aa as o,b as v,h as N,jb as M,k as l,l as L,p as u,vb as f,xb as w,y as E}from"./chunk-TBMJSIBB.js";var A=class{static computeSocketUrlFromStatus(m,e){return e}};var b=class{static toDisplayString(m){if(m==null)return"";if(typeof m=="string")return m;if(typeof m=="object"&&m!==null){let t=m;if(typeof t.message=="string"&&t.message.trim().length>0)return t.message.trim();if(typeof t.error=="string"&&t.error.trim().length>0)return t.error.trim();if(typeof t.detail=="string"&&t.detail.trim().length>0)return t.detail.trim()}let e=String(m);return e==="[object Object]"?"\u2014":e}};var d=N(O());var R=(()=>{class r{baseUrl=`${y.api.baseUrl}/session`;http=p(w);getMessages(e){return u(this.http.get(`${this.baseUrl}/${e.sessionId}/messages`,{params:{viewMode:e.viewMode}}))}sendMessage(e){return u(this.http.post(`${this.baseUrl}/${e.sessionId}/messages`,{content:e.content,imageAttachments:e.imageAttachments}))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var K=(()=>{class r{baseUrl=`${y.api.baseUrl}/session`;http=p(w);peiContext_DS=p(U);currentCcapId(){return this.peiContext_DS.activeCcapId_$()}withCcapId(e){let t=this.currentCcapId();return t?e.set("ccapId",t):e}listSessions(){let e=this.withCcapId(new f);return u(this.http.get(this.baseUrl,{params:e}))}listArchivedSessions(){let e=this.withCcapId(new f);return e=e.set("archived","true"),u(this.http.get(this.baseUrl,{params:e}))}createSession(e){let t={},s=e?.name!==void 0?e.name.trim():void 0;s!==void 0&&s.length>0&&(t.name=s);let i=this.withCcapId(new f);return u(this.http.post(this.baseUrl,t,{params:i}))}getSession(e){let t=this.withCcapId(new f);return u(this.http.get(`${this.baseUrl}/${e}`,{params:t}))}updateSession(e){let t=this.withCcapId(new f);return u(this.http.patch(`${this.baseUrl}/${e.sessionId}`,e.updates,{params:t}))}getSessionInfo(e){let t=this.withCcapId(new f);return u(this.http.get(`${this.baseUrl}/${e}/session-info`,{params:t}))}copySession(e){let t={};e.name&&(t.name=e.name),e.forkUntilMessageKey&&(t.forkUntilMessageKey=e.forkUntilMessageKey);let s=this.withCcapId(new f);return u(this.http.post(`${this.baseUrl}/${e.sessionId}/copy`,t,{params:s}))}stopExecution(e){let t=this.withCcapId(new f);return u(this.http.post(`${this.baseUrl}/${e}/stop-execution`,{},{params:t}))}getLlmDebugTrace(e){let t=this.withCcapId(new f);return t=t.set("runId",e.runId),u(this.http.get(`${this.baseUrl}/${e.sessionId}/llm-debug-trace`,{params:t}))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var j="answer",V="notify-user",B="agent-events",z="context:updated",H="monitoring:event",G="user-interaction:request",q="user-interaction:resolved",W="ccap_notification",Q="notification-sent",X="waiting-for-user",Ce=(()=>{class r{sessionDetailBySessionId=new Map;sessionInfoBySessionId=new Map;activeSessionId_$=o("");requestSidebarCloseOnMobileBump_$=o(0);sessions_$=o([]);sessionsLoadError_$=o(null);sessionsLoading_$=o(!1);archivedSessions_$=o([]);archivedSessionsLoading_$=o(!1);messages_$=o([]);messagesLoading_$=o(!1);messagesLoadError_$=o(null);agentEvents_$=o({});activeRunExecutionMode_$=o("");contextUpdated_$=o(null);monitoringEvent_$=o(null);monitoringEvent_S=new L;pendingInteraction_$=o(null);pendingNotification_$=o(null);sessionDetailMap_$=o(new Map);sessionDetailLoading_$=o(!1);sessionInfoMap_$=o(new Map);sessionInfoLoading_$=o(!1);sessionInfoLoadError_$=o(null);llmDebugTraceEntries_$=o([]);llmDebugTraceLoading_$=o(!1);llmDebugTraceLoadError_$=o(null);eventSubscription=null;connectedEffectRef=null;session_AS=p(K);conversation_AS=p(R);serverStatus_AS=p(P);socket_CS=p(k);get connected_$(){return this.socket_CS.connected_$}get socketStatus_$(){return this.socket_CS.status_$}get lastSocketError_$(){return this.socket_CS.lastError_$}get connectAttemptCount_$(){return this.socket_CS.connectAttemptCount_$}diagnoseConnection(){return this.socket_CS.diagnoseConnection()}constructor(){this.eventSubscription=this.socket_CS.event$.subscribe(e=>{this.handleSocketEvent(e)}),this.connectedEffectRef=M(()=>{this.socket_CS.connected_$()&&this.getActiveSessionId()&&this.socket_CS.emit("session:attach",{sessionId:this.getActiveSessionId()})})}handleSocketEvent(e){let t=e.payload??{},s=this.getActiveSessionId(),i=typeof t.channelId=="string"?t.channelId:void 0,g=typeof t.sessionId=="string"?t.sessionId:void 0,I=!i&&!g||i===s||g===s;if(e.event===j&&I){let n=typeof t.content=="string"?t.content:"",a=typeof t.timestamp=="string"?t.timestamp:new Date().toISOString(),c=typeof t.runId=="string"?t.runId:void 0,S={role:"assistant",content:n,timestamp:new Date(a)},h=c?v($({},S),{runId:c}):S,_=this.ensureClientListKey(h);this.messages_$.set([...this.messages_$(),_]);return}if(e.event===V&&I){let n=typeof t.content=="string"?t.content:"";d.DyFM_Log.info(`CCAP_SessionDS | notify-user received: ${n.substring(0,120)}\u2026`);let a=this.ensureClientListKey({role:"system",content:n,timestamp:new Date});this.messages_$.set([...this.messages_$(),a]);return}if(e.event===B){let n=typeof t.eventData=="object"&&t.eventData!==null?t.eventData:{};this.agentEvents_$.set(n),this.applyAgentEventRunExecutionModeLatch(n);let a=typeof n.toolId=="string"?n.toolId:"",c=typeof n.phase=="string"?n.phase:"";a===W&&(c===Q||c===X)?this.pendingNotification_$.set({phase:c,notificationTitle:typeof n.notificationTitle=="string"?n.notificationTitle:"",notificationType:typeof n.notificationType=="string"?n.notificationType:"",notificationPriority:typeof n.notificationPriority=="string"?n.notificationPriority:"info"}):this.pendingNotification_$()&&this.pendingNotification_$.set(null);let S=n.toolError,h=i??n.channelId,_=!h||h===s,D=b.toDisplayString(S).trim();if(D.length>0&&_){d.DyFM_Log.info(`CCAP_SessionDS | toolError from agent-events, pushing to chat: ${D.substring(0,80)}\u2026`);let F=this.ensureClientListKey({role:"system",content:D,timestamp:new Date});this.messages_$.set([...this.messages_$(),F])}return}if(e.event===z){let n=typeof t.sessionId=="string"?t.sessionId:"",a=typeof t.contextState=="object"&&t.contextState!==null?t.contextState:{};this.contextUpdated_$.set({sessionId:n,contextState:a});return}if(e.event===H){let n=typeof t.sessionId=="string"?t.sessionId:"",a=typeof t.event=="object"&&t.event!==null?t.event:{},c={sessionId:n,event:a};this.monitoringEvent_$.set(c),this.monitoringEvent_S.next(c);return}if(e.event===G&&I){this.pendingInteraction_$.set(t);return}if(e.event===q&&I){let n=typeof t.interactionId=="string"?t.interactionId:void 0;if(!n)return;this.pendingInteraction_$()?.interactionId===n&&this.pendingInteraction_$.set(null);return}}loadSessions(){return l(this,null,function*(){this.sessionsLoading_$.set(!0);try{this.sessionsLoadError_$.set(null);let e=yield this.session_AS.listSessions();return this.sessions_$.set(e.sessions),e.sessions}catch(e){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load sessions",e),this.sessionsLoadError_$.set(e),[]}finally{this.sessionsLoading_$.set(!1)}})}createSession(e){return l(this,null,function*(){let t=yield this.session_AS.createSession(e);return yield this.loadSessions(),t.session})}copySession(e){return l(this,null,function*(){let t=yield this.session_AS.copySession(e);return yield this.loadSessions(),t.session})}forkSession(e){return l(this,null,function*(){let t=yield this.session_AS.copySession({sessionId:e.sessionId,name:e.name,forkUntilMessageKey:e.forkUntilMessageKey});return yield this.loadSessions(),t.session})}loadArchivedSessions(){return l(this,null,function*(){this.archivedSessionsLoading_$.set(!0);try{let e=yield this.session_AS.listArchivedSessions();return this.archivedSessions_$.set(e.sessions),e.sessions}catch(e){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load archived sessions",e),this.archivedSessions_$.set([]),[]}finally{this.archivedSessionsLoading_$.set(!1)}})}setActiveSession(e){this.activeSessionId_$()!==e&&(this.activeSessionId_$.set(e),this.clearMessages(),this.pendingInteraction_$.set(null),this.activeRunExecutionMode_$.set("")),this.socket_CS.emit("session:attach",{sessionId:e})}getActiveSessionId(){return this.activeSessionId_$()}reconnectSocket(){return l(this,null,function*(){try{let e=yield this.serverStatus_AS.getStatus(),t=typeof window<"u"?window.location.origin:"",s=A.computeSocketUrlFromStatus({httpPort:e.httpPort,socketPort:e.socketPort},t),i=y.socketUrl??t;if(s!==i&&typeof window<"u"){y.socketUrl=s,d.DyFM_Log.info("CCAP_SessionDS | socketUrl changed on reconnect, reloading",s),window.location.reload();return}}catch{}this.socket_CS.reconnect()})}stopExecution(e){return l(this,null,function*(){try{return(yield this.session_AS.stopExecution(e)).success}catch(t){return d.DyFM_Error.logSimple("CCAP_Session_DS | stopExecution failed",t),!1}})}sendMessageViaSocket(e,t){return l(this,null,function*(){let s=e.trim();if(s==="/new")return{newSession:yield this.createSession(),sent:!0};let i=this.activeSessionId_$();if(!i)return{sent:!1};let g=(t?.length??0)>0;if(!s.length&&!g)return{sent:!1};let I={role:"user",content:e,timestamp:new Date},n=this.ensureClientListKey(I);this.messages_$.set([...this.messages_$(),n]);try{let c=(yield this.conversation_AS.sendMessage({sessionId:i,content:e,imageAttachments:t})).message,S=this.messages_$().map(h=>{if(h.clientListKey!==n.clientListKey)return h;let _=$({},h);return c.messageKey&&(_.messageKey=c.messageKey),c.hasTtsAudio!==void 0&&(_.hasTtsAudio=c.hasTtsAudio),_});return this.messages_$.set(S),{sent:!0}}catch(a){d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to send message via REST",a);let c=this.messages_$().filter(h=>h.clientListKey!==n.clientListKey);return this.messages_$.set(c),{sent:!1,error:a instanceof Error?a.message:"\xDCzenet k\xFCld\xE9se sikertelen."}}})}sendMessageToSession(e){return l(this,null,function*(){yield this.conversation_AS.sendMessage({sessionId:e.sessionId,content:e.content})})}sendInteractionResponse(e){this.socket_CS.emit("user-interaction:response",e),this.pendingInteraction_$.set(null)}clearMessages(){this.messages_$.set([])}setMessages(e){let s=(e??[]).map(i=>this.ensureClientListKey(i));this.messages_$.set(s)}ensureClientListKey(e){if(e.clientListKey?.trim()?.length)return e;let s=e.messageKey?.trim();return s?.length?v($({},e),{clientListKey:s}):v($({},e),{clientListKey:globalThis.crypto.randomUUID()})}setMessageTtsCached(e){let s=this.messages_$().map(i=>i.messageKey===e?v($({},i),{hasTtsAudio:!0}):i);this.messages_$.set(s)}loadMessagesForView(e){return l(this,null,function*(){this.messagesLoading_$.set(!0),this.messagesLoadError_$.set(null);try{let s=(yield this.conversation_AS.getMessages({sessionId:e,viewMode:"conversationFull"})).messages??[];return e===this.activeSessionId_$()&&this.setMessages(s),s}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load messages for view",t),this.messagesLoadError_$.set(t),[]}finally{this.messagesLoading_$.set(!1)}})}loadSessionDetail(e){return l(this,null,function*(){if(!e)return null;this.sessionDetailLoading_$.set(!0);try{let t=yield this.session_AS.getSession(e),s={session:t.session,lastRun:t.lastRun??null};return this.sessionDetailBySessionId.set(e,s),this.sessionDetailMap_$.set(new Map(this.sessionDetailBySessionId)),s}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load session detail",t),null}finally{this.sessionDetailLoading_$.set(!1)}})}getCachedSessionDetail(e){return this.sessionDetailBySessionId.get(e)??null}loadSessionInfo(e){return l(this,null,function*(){if(!e)return null;this.sessionInfoLoading_$.set(!0),this.sessionInfoLoadError_$.set(null);try{let t=yield this.session_AS.getSessionInfo(e);return this.sessionInfoBySessionId.set(e,t),this.sessionInfoMap_$.set(new Map(this.sessionInfoBySessionId)),t}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load session info",t),this.sessionInfoLoadError_$.set(t),null}finally{this.sessionInfoLoading_$.set(!1)}})}getCachedSessionInfo(e){return this.sessionInfoBySessionId.get(e)??null}fetchLlmDebugTraceEntriesForRun(e){return l(this,null,function*(){let t=e.sessionId?.trim()??"",s=e.runId?.trim()??"";if(!t||!s)return[];try{return(yield this.session_AS.getLlmDebugTrace({sessionId:t,runId:s})).entries??[]}catch{return[]}})}loadLlmDebugTrace(e){return l(this,null,function*(){let t=e.sessionId?.trim()??"",s=e.runId?.trim()??"";if(!t||!s){this.llmDebugTraceEntries_$.set([]);return}this.llmDebugTraceLoading_$.set(!0),this.llmDebugTraceLoadError_$.set(null);try{let i=yield this.session_AS.getLlmDebugTrace({sessionId:t,runId:s});this.llmDebugTraceEntries_$.set(i.entries)}catch(i){d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load LLM debug trace",i),this.llmDebugTraceLoadError_$.set(i),this.llmDebugTraceEntries_$.set([])}finally{this.llmDebugTraceLoading_$.set(!1)}})}updateSession(e){return l(this,null,function*(){try{let t=yield this.session_AS.updateSession(e),s=e.updates.archived;return s===!0||s===!1?(yield this.loadSessions(),yield this.loadArchivedSessions()):yield this.loadSessions(),t.session}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to update session",t),null}})}applyAgentEventRunExecutionModeLatch(e){let t=e.phase,s=typeof t=="string"?t.trim():"";if(s===T.analyzeResult){let i=e.runExecutionMode;if(typeof i=="string"&&i.trim()!==""){let g=r.normalizeRunExecutionModeSocketValue(i);g!==void 0&&this.activeRunExecutionMode_$.set(g)}return}(s===T.runFlowComplete||s===T.runInitialization)&&this.activeRunExecutionMode_$.set("")}static normalizeRunExecutionModeSocketValue(e){let t=e.trim(),s=[C.instant,C.agenticAny,C.ask,C.plan];for(let i of s)if(t===i)return i}ngOnDestroy(){this.monitoringEvent_S.complete(),this.eventSubscription&&(this.eventSubscription.unsubscribe(),this.eventSubscription=null),this.connectedEffectRef&&(this.connectedEffectRef.destroy(),this.connectedEffectRef=null)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{A as a,b,Ce as c};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as P}from"./chunk-VG3BRAVF.js";import{a as T}from"./chunk-UFBTR2BG.js";import{a as U}from"./chunk-4KJ53ND4.js";import{e as k}from"./chunk-U7HJBEWP.js";import{G as C,I as y,p as O}from"./chunk-ZUSKVUGS.js";import{C as p,a as $,aa as o,b as v,h as N,jb as M,k as l,l as L,p as u,vb as f,xb as w,y as E}from"./chunk-TBMJSIBB.js";var A=class{static computeSocketUrlFromStatus(m,e){return e}};var b=class{static toDisplayString(m){if(m==null)return"";if(typeof m=="string")return m;if(typeof m=="object"&&m!==null){let t=m;if(typeof t.message=="string"&&t.message.trim().length>0)return t.message.trim();if(typeof t.error=="string"&&t.error.trim().length>0)return t.error.trim();if(typeof t.detail=="string"&&t.detail.trim().length>0)return t.detail.trim()}let e=String(m);return e==="[object Object]"?"\u2014":e}};var d=N(O());var R=(()=>{class r{baseUrl=`${y.api.baseUrl}/session`;http=p(w);getMessages(e){return u(this.http.get(`${this.baseUrl}/${e.sessionId}/messages`,{params:{viewMode:e.viewMode}}))}sendMessage(e){return u(this.http.post(`${this.baseUrl}/${e.sessionId}/messages`,{content:e.content,imageAttachments:e.imageAttachments}))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var K=(()=>{class r{baseUrl=`${y.api.baseUrl}/session`;http=p(w);peiContext_DS=p(U);currentCcapId(){return this.peiContext_DS.activeCcapId_$()}withCcapId(e){let t=this.currentCcapId();return t?e.set("ccapId",t):e}listSessions(){let e=this.withCcapId(new f);return u(this.http.get(this.baseUrl,{params:e}))}listArchivedSessions(){let e=this.withCcapId(new f);return e=e.set("archived","true"),u(this.http.get(this.baseUrl,{params:e}))}createSession(e){let t={},s=e?.name!==void 0?e.name.trim():void 0;s!==void 0&&s.length>0&&(t.name=s);let i=this.withCcapId(new f);return u(this.http.post(this.baseUrl,t,{params:i}))}getSession(e){let t=this.withCcapId(new f);return u(this.http.get(`${this.baseUrl}/${e}`,{params:t}))}updateSession(e){let t=this.withCcapId(new f);return u(this.http.patch(`${this.baseUrl}/${e.sessionId}`,e.updates,{params:t}))}getSessionInfo(e){let t=this.withCcapId(new f);return u(this.http.get(`${this.baseUrl}/${e}/session-info`,{params:t}))}copySession(e){let t={};e.name&&(t.name=e.name),e.forkUntilMessageKey&&(t.forkUntilMessageKey=e.forkUntilMessageKey);let s=this.withCcapId(new f);return u(this.http.post(`${this.baseUrl}/${e.sessionId}/copy`,t,{params:s}))}stopExecution(e){let t=this.withCcapId(new f);return u(this.http.post(`${this.baseUrl}/${e}/stop-execution`,{},{params:t}))}getLlmDebugTrace(e){let t=this.withCcapId(new f);return t=t.set("runId",e.runId),u(this.http.get(`${this.baseUrl}/${e.sessionId}/llm-debug-trace`,{params:t}))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var j="answer",V="notify-user",B="agent-events",z="context:updated",H="monitoring:event",G="user-interaction:request",q="user-interaction:resolved",W="ccap_notification",Q="notification-sent",X="waiting-for-user",Ce=(()=>{class r{sessionDetailBySessionId=new Map;sessionInfoBySessionId=new Map;activeSessionId_$=o("");requestSidebarCloseOnMobileBump_$=o(0);sessions_$=o([]);sessionsLoadError_$=o(null);sessionsLoading_$=o(!1);archivedSessions_$=o([]);archivedSessionsLoading_$=o(!1);messages_$=o([]);messagesLoading_$=o(!1);messagesLoadError_$=o(null);agentEvents_$=o({});activeRunExecutionMode_$=o("");contextUpdated_$=o(null);monitoringEvent_$=o(null);monitoringEvent_S=new L;pendingInteraction_$=o(null);pendingNotification_$=o(null);sessionDetailMap_$=o(new Map);sessionDetailLoading_$=o(!1);sessionInfoMap_$=o(new Map);sessionInfoLoading_$=o(!1);sessionInfoLoadError_$=o(null);llmDebugTraceEntries_$=o([]);llmDebugTraceLoading_$=o(!1);llmDebugTraceLoadError_$=o(null);eventSubscription=null;connectedEffectRef=null;session_AS=p(K);conversation_AS=p(R);serverStatus_AS=p(P);socket_CS=p(k);get connected_$(){return this.socket_CS.connected_$}get socketStatus_$(){return this.socket_CS.status_$}get lastSocketError_$(){return this.socket_CS.lastError_$}get connectAttemptCount_$(){return this.socket_CS.connectAttemptCount_$}diagnoseConnection(){return this.socket_CS.diagnoseConnection()}constructor(){this.eventSubscription=this.socket_CS.event$.subscribe(e=>{this.handleSocketEvent(e)}),this.connectedEffectRef=M(()=>{this.socket_CS.connected_$()&&this.getActiveSessionId()&&this.socket_CS.emit("session:attach",{sessionId:this.getActiveSessionId()})})}handleSocketEvent(e){let t=e.payload??{},s=this.getActiveSessionId(),i=typeof t.channelId=="string"?t.channelId:void 0,g=typeof t.sessionId=="string"?t.sessionId:void 0,I=!i&&!g||i===s||g===s;if(e.event===j&&I){let n=typeof t.content=="string"?t.content:"",a=typeof t.timestamp=="string"?t.timestamp:new Date().toISOString(),c=typeof t.runId=="string"?t.runId:void 0,S={role:"assistant",content:n,timestamp:new Date(a)},h=c?v($({},S),{runId:c}):S,_=this.ensureClientListKey(h);this.messages_$.set([...this.messages_$(),_]);return}if(e.event===V&&I){let n=typeof t.content=="string"?t.content:"";d.DyFM_Log.info(`CCAP_SessionDS | notify-user received: ${n.substring(0,120)}\u2026`);let a=this.ensureClientListKey({role:"system",content:n,timestamp:new Date});this.messages_$.set([...this.messages_$(),a]);return}if(e.event===B){let n=typeof t.eventData=="object"&&t.eventData!==null?t.eventData:{};this.agentEvents_$.set(n),this.applyAgentEventRunExecutionModeLatch(n);let a=typeof n.toolId=="string"?n.toolId:"",c=typeof n.phase=="string"?n.phase:"";a===W&&(c===Q||c===X)?this.pendingNotification_$.set({phase:c,notificationTitle:typeof n.notificationTitle=="string"?n.notificationTitle:"",notificationType:typeof n.notificationType=="string"?n.notificationType:"",notificationPriority:typeof n.notificationPriority=="string"?n.notificationPriority:"info"}):this.pendingNotification_$()&&this.pendingNotification_$.set(null);let S=n.toolError,h=i??n.channelId,_=!h||h===s,D=b.toDisplayString(S).trim();if(D.length>0&&_){d.DyFM_Log.info(`CCAP_SessionDS | toolError from agent-events, pushing to chat: ${D.substring(0,80)}\u2026`);let F=this.ensureClientListKey({role:"system",content:D,timestamp:new Date});this.messages_$.set([...this.messages_$(),F])}return}if(e.event===z){let n=typeof t.sessionId=="string"?t.sessionId:"",a=typeof t.contextState=="object"&&t.contextState!==null?t.contextState:{};this.contextUpdated_$.set({sessionId:n,contextState:a});return}if(e.event===H){let n=typeof t.sessionId=="string"?t.sessionId:"",a=typeof t.event=="object"&&t.event!==null?t.event:{},c={sessionId:n,event:a};this.monitoringEvent_$.set(c),this.monitoringEvent_S.next(c);return}if(e.event===G&&I){this.pendingInteraction_$.set(t);return}if(e.event===q&&I){let n=typeof t.interactionId=="string"?t.interactionId:void 0;if(!n)return;this.pendingInteraction_$()?.interactionId===n&&this.pendingInteraction_$.set(null);return}}loadSessions(){return l(this,null,function*(){this.sessionsLoading_$.set(!0);try{this.sessionsLoadError_$.set(null);let e=yield this.session_AS.listSessions();return this.sessions_$.set(e.sessions),e.sessions}catch(e){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load sessions",e),this.sessionsLoadError_$.set(e),[]}finally{this.sessionsLoading_$.set(!1)}})}createSession(e){return l(this,null,function*(){let t=yield this.session_AS.createSession(e);return yield this.loadSessions(),t.session})}copySession(e){return l(this,null,function*(){let t=yield this.session_AS.copySession(e);return yield this.loadSessions(),t.session})}forkSession(e){return l(this,null,function*(){let t=yield this.session_AS.copySession({sessionId:e.sessionId,name:e.name,forkUntilMessageKey:e.forkUntilMessageKey});return yield this.loadSessions(),t.session})}loadArchivedSessions(){return l(this,null,function*(){this.archivedSessionsLoading_$.set(!0);try{let e=yield this.session_AS.listArchivedSessions();return this.archivedSessions_$.set(e.sessions),e.sessions}catch(e){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load archived sessions",e),this.archivedSessions_$.set([]),[]}finally{this.archivedSessionsLoading_$.set(!1)}})}setActiveSession(e){this.activeSessionId_$()!==e&&(this.activeSessionId_$.set(e),this.clearMessages(),this.pendingInteraction_$.set(null),this.activeRunExecutionMode_$.set("")),this.socket_CS.emit("session:attach",{sessionId:e})}getActiveSessionId(){return this.activeSessionId_$()}reconnectSocket(){return l(this,null,function*(){try{let e=yield this.serverStatus_AS.getStatus(),t=typeof window<"u"?window.location.origin:"",s=A.computeSocketUrlFromStatus({httpPort:e.httpPort,socketPort:e.socketPort},t),i=y.socketUrl??t;if(s!==i&&typeof window<"u"){y.socketUrl=s,d.DyFM_Log.info("CCAP_SessionDS | socketUrl changed on reconnect, reloading",s),window.location.reload();return}}catch{}this.socket_CS.reconnect()})}stopExecution(e){return l(this,null,function*(){try{return(yield this.session_AS.stopExecution(e)).success}catch(t){return d.DyFM_Error.logSimple("CCAP_Session_DS | stopExecution failed",t),!1}})}sendMessageViaSocket(e,t){return l(this,null,function*(){let s=e.trim();if(s==="/new")return{newSession:yield this.createSession(),sent:!0};let i=this.activeSessionId_$();if(!i)return{sent:!1};let g=(t?.length??0)>0;if(!s.length&&!g)return{sent:!1};let I={role:"user",content:e,timestamp:new Date},n=this.ensureClientListKey(I);this.messages_$.set([...this.messages_$(),n]);try{let c=(yield this.conversation_AS.sendMessage({sessionId:i,content:e,imageAttachments:t})).message,S=this.messages_$().map(h=>{if(h.clientListKey!==n.clientListKey)return h;let _=$({},h);return c.messageKey&&(_.messageKey=c.messageKey),c.hasTtsAudio!==void 0&&(_.hasTtsAudio=c.hasTtsAudio),_});return this.messages_$.set(S),{sent:!0}}catch(a){d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to send message via REST",a);let c=this.messages_$().filter(h=>h.clientListKey!==n.clientListKey);return this.messages_$.set(c),{sent:!1,error:a instanceof Error?a.message:"\xDCzenet k\xFCld\xE9se sikertelen."}}})}sendMessageToSession(e){return l(this,null,function*(){yield this.conversation_AS.sendMessage({sessionId:e.sessionId,content:e.content})})}sendInteractionResponse(e){this.socket_CS.emit("user-interaction:response",e),this.pendingInteraction_$.set(null)}clearMessages(){this.messages_$.set([])}setMessages(e){let s=(e??[]).map(i=>this.ensureClientListKey(i));this.messages_$.set(s)}ensureClientListKey(e){if(e.clientListKey?.trim()?.length)return e;let s=e.messageKey?.trim();return s?.length?v($({},e),{clientListKey:s}):v($({},e),{clientListKey:globalThis.crypto.randomUUID()})}setMessageTtsCached(e){let s=this.messages_$().map(i=>i.messageKey===e?v($({},i),{hasTtsAudio:!0}):i);this.messages_$.set(s)}loadMessagesForView(e){return l(this,null,function*(){this.messagesLoading_$.set(!0),this.messagesLoadError_$.set(null);try{let s=(yield this.conversation_AS.getMessages({sessionId:e,viewMode:"conversationFull"})).messages??[];return e===this.activeSessionId_$()&&this.setMessages(s),s}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load messages for view",t),this.messagesLoadError_$.set(t),[]}finally{this.messagesLoading_$.set(!1)}})}loadSessionDetail(e){return l(this,null,function*(){if(!e)return null;this.sessionDetailLoading_$.set(!0);try{let t=yield this.session_AS.getSession(e),s={session:t.session,lastRun:t.lastRun??null};return this.sessionDetailBySessionId.set(e,s),this.sessionDetailMap_$.set(new Map(this.sessionDetailBySessionId)),s}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load session detail",t),null}finally{this.sessionDetailLoading_$.set(!1)}})}getCachedSessionDetail(e){return this.sessionDetailBySessionId.get(e)??null}loadSessionInfo(e){return l(this,null,function*(){if(!e)return null;this.sessionInfoLoading_$.set(!0),this.sessionInfoLoadError_$.set(null);try{let t=yield this.session_AS.getSessionInfo(e);return this.sessionInfoBySessionId.set(e,t),this.sessionInfoMap_$.set(new Map(this.sessionInfoBySessionId)),t}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load session info",t),this.sessionInfoLoadError_$.set(t),null}finally{this.sessionInfoLoading_$.set(!1)}})}getCachedSessionInfo(e){return this.sessionInfoBySessionId.get(e)??null}fetchLlmDebugTraceEntriesForRun(e){return l(this,null,function*(){let t=e.sessionId?.trim()??"",s=e.runId?.trim()??"";if(!t||!s)return[];try{return(yield this.session_AS.getLlmDebugTrace({sessionId:t,runId:s})).entries??[]}catch{return[]}})}loadLlmDebugTrace(e){return l(this,null,function*(){let t=e.sessionId?.trim()??"",s=e.runId?.trim()??"";if(!t||!s){this.llmDebugTraceEntries_$.set([]);return}this.llmDebugTraceLoading_$.set(!0),this.llmDebugTraceLoadError_$.set(null);try{let i=yield this.session_AS.getLlmDebugTrace({sessionId:t,runId:s});this.llmDebugTraceEntries_$.set(i.entries)}catch(i){d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to load LLM debug trace",i),this.llmDebugTraceLoadError_$.set(i),this.llmDebugTraceEntries_$.set([])}finally{this.llmDebugTraceLoading_$.set(!1)}})}updateSession(e){return l(this,null,function*(){try{let t=yield this.session_AS.updateSession(e),s=e.updates.archived;return s===!0||s===!1?(yield this.loadSessions(),yield this.loadArchivedSessions()):yield this.loadSessions(),t.session}catch(t){return d.DyFM_Error.logSimple("CCAP_SessionDS | Failed to update session",t),null}})}applyAgentEventRunExecutionModeLatch(e){let t=e.phase,s=typeof t=="string"?t.trim():"";if(s===T.analyzeResult){let i=e.runExecutionMode;if(typeof i=="string"&&i.trim()!==""){let g=r.normalizeRunExecutionModeSocketValue(i);g!==void 0&&this.activeRunExecutionMode_$.set(g)}return}(s===T.runFlowComplete||s===T.runInitialization)&&this.activeRunExecutionMode_$.set("")}static normalizeRunExecutionModeSocketValue(e){let t=e.trim(),s=[C.instant,C.agenticAny,C.ask,C.plan];for(let i of s)if(t===i)return i}ngOnDestroy(){this.monitoringEvent_S.complete(),this.eventSubscription&&(this.eventSubscription.unsubscribe(),this.eventSubscription=null),this.connectedEffectRef&&(this.connectedEffectRef.destroy(),this.connectedEffectRef=null)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=E({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{A as a,b,Ce as c};
|
|
2
|
+
//# sourceMappingURL=chunk-OYB4VU7M.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{j as s}from"./chunk-A2QJB3E4.js";var r="ccap-personaSoulDraft";function p(){try{let o=localStorage.getItem(r);if(!o)return null;let n=s.tryParseStrict({text:o,contextLabel:"CCAP_PersonaDraft_localStorage"});if(!n.ok)return null;let e=n.value;if(typeof e!="object"||e===null)return null;let t=Object.fromEntries(Object.entries(e)),a=typeof t.name=="string"?t.name:"",c=typeof t.personality=="string"?t.personality:"",i=typeof t.conversation_style=="string"?t.conversation_style:"",l=typeof t.work_style=="string"?t.work_style:"",f=typeof t.mission=="string"?t.mission:"",y=typeof t.avoid=="string"?t.avoid:"";return{name:a,personality:c,conversation_style:i,work_style:l,mission:f,avoid:y}}catch{return null}}function g(o){try{localStorage.setItem(r,JSON.stringify(o))}catch{}}function u(){try{localStorage.removeItem(r)}catch{}}var m={get:p,save:g,clear:u};export{m as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PEEGB2PT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-543UYBGO.js";import{p as m}from"./chunk-ZUSKVUGS.js";import{G as i,h as s}from"./chunk-TBMJSIBB.js";var l=(()=>{class r{transform(n){return p.getDurationBand(n)}static \u0275fac=function(t){return new(t||r)};static \u0275pipe=i({name:"ccapDurationBand",type:r,pure:!0,standalone:!0})}return r})();var f=s(m()),a=f.second,u=60*a,c=60*u,o=class{static formatGenerationTimeMs(e){if(e==null||typeof e!="number"||Number.isNaN(e))return"\u2013";if(e<a)return`${Math.round(e)} ms`;if(e<u){let t=e/a;return t>=10||t%1===0?`${Math.round(t)} s`:`${t.toFixed(1)} s`}if(e<c){let t=e/u;return t>=10||t%1===0?`${Math.round(t)} min`:`${t.toFixed(1)} min`}let n=e/c;return n>=10||n%1===0?`${Math.round(n)} h`:`${n.toFixed(1)} h`}};var $=(()=>{class r{transform(n){return o.formatGenerationTimeMs(n)}static \u0275fac=function(t){return new(t||r)};static \u0275pipe=i({name:"ccapGenerationTime",type:r,pure:!0,standalone:!0})}return r})();export{l as a,$ as b};
|
|
2
|
+
//# sourceMappingURL=chunk-PR4Y5XDM.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{I as d}from"./chunk-ZUSKVUGS.js";import{C as o,p as n,xb as l,y as s}from"./chunk-TBMJSIBB.js";var p=(()=>{class r{baseUrl=`${d.api.baseUrl}/model-registry`;http=o(l);getList(e){let t=new URLSearchParams;e?.provider!==void 0&&e.provider.trim()!==""&&t.set("provider",e.provider.trim()),e?.modelName!==void 0&&e.modelName.trim()!==""&&t.set("modelName",e.modelName.trim()),e?.enabled===!0?t.set("enabled","true"):e?.enabled===!1&&t.set("enabled","false"),e?.inactiveProviderOnly===!0&&t.set("inactiveProviderOnly","true");let i=t.toString(),u=`${this.baseUrl}/list${i!==""?`?${i}`:""}`;return n(this.http.get(u))}sync(){return n(this.http.post(`${this.baseUrl}/sync`,{}))}setEnabled(e,t){return n(this.http.patch(`${this.baseUrl}/patch/${encodeURIComponent(e)}`,{enabled:t}))}patchEntry(e,t){let i={};return t.enabled!==void 0&&(i.enabled=t.enabled),t.reasoningLevelForTest!==void 0&&(i.reasoningLevelForTest=t.reasoningLevelForTest),t.capabilities!==void 0&&(i.capabilities=t.capabilities),n(this.http.patch(`${this.baseUrl}/patch/${encodeURIComponent(e)}`,i))}bulkSetEnabled(e,t){return n(this.http.patch(`${this.baseUrl}/bulk-enabled`,{ids:e,enabled:t}))}deleteEntry(e){return n(this.http.delete(`${this.baseUrl}/entry/${encodeURIComponent(e)}`))}deleteEntries(e){return n(this.http.post(`${this.baseUrl}/delete-entries`,{ids:e}))}getTestResults(e){let t=new URLSearchParams;e.provider&&t.set("provider",e.provider),e.model&&t.set("model",e.model),e.limit!==void 0&&t.set("limit",String(e.limit)),e.reasoningLevel!==void 0&&e.reasoningLevel.trim()!==""&&t.set("reasoningLevel",e.reasoningLevel.trim());let i=t.toString();return n(this.http.get(`${this.baseUrl}/test-results${i?`?${i}`:""}`))}getPrompts(){return n(this.http.get(`${this.baseUrl}/prompts`))}startTestRun(e,t){let i={modelIds:e};return t!==void 0&&t.length>0&&(i.promptIds=t),n(this.http.post(`${this.baseUrl}/test-run`,i))}getTestRunStatus(e){return n(this.http.get(`${this.baseUrl}/test-run/${e}`))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=s({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RHGTAI5Z.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-ALW7KZ7Q.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-3EZGW2AE.js";import{a as Ce}from"./chunk-OASG3NKM.js";import{e as ye}from"./chunk-U7HJBEWP.js";import{L as he,p as ee,t as ae}from"./chunk-ZUSKVUGS.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-RUNHLH7T.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as R,b as O}from"./chunk-
|
|
1
|
+
import{a as R,b as O}from"./chunk-LHZIBNFR.js";import{a as q}from"./chunk-2EZEKYOT.js";import{a as g}from"./chunk-UFBTR2BG.js";import{a as U}from"./chunk-4KJ53ND4.js";import{e as P}from"./chunk-U7HJBEWP.js";import{h as y,j as L}from"./chunk-O2FA6HNL.js";import{p as D}from"./chunk-ZUSKVUGS.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-S4CBPEPW.js.map
|