@futdevpro/ccap 1.1.3508 → 1.1.3515
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-X2EAZWNC.js → agent-instances.module-5DOGNLXO.js} +2 -2
- package/client-dist/{ca.module-UKEVG7H5.js → ca.module-XHE46FU5.js} +2 -2
- package/client-dist/{cc-usage-dashboard.component-SWKOCSYU.js → cc-usage-dashboard.component-FUIRNB4B.js} +2 -2
- package/client-dist/{cc-usage-dashboard.component-SWKOCSYU.js.map → cc-usage-dashboard.component-FUIRNB4B.js.map} +3 -3
- package/client-dist/{cc.module-AE3UTLQM.js → cc.module-7CFFLL2A.js} +2 -2
- package/client-dist/{chunk-G5RVYENP.js → chunk-26VAQXDU.js} +2 -2
- package/client-dist/{chunk-YYASTT5C.js → chunk-2PAMSPPB.js} +2 -2
- package/client-dist/{chunk-PQJSMEEO.js → chunk-3OAVFWVG.js} +2 -2
- package/client-dist/{chunk-JSLXFS3P.js → chunk-44UE4O3M.js} +2 -2
- package/client-dist/{chunk-O2MF2KDY.js → chunk-4WNJ7IKE.js} +2 -2
- package/client-dist/{chunk-SY2IF3DK.js → chunk-55GY7S7U.js} +2 -2
- package/client-dist/{chunk-ANMHMGCN.js → chunk-5IGMWTXT.js} +2 -2
- package/client-dist/{chunk-ANMHMGCN.js.map → chunk-5IGMWTXT.js.map} +1 -1
- package/client-dist/{chunk-4BERPGJT.js → chunk-6BHKDJRV.js} +2 -2
- package/client-dist/{chunk-R3JWUXQG.js → chunk-6JLSVPOB.js} +2 -2
- package/client-dist/{chunk-QBVNLJ7A.js → chunk-6YZDXJ6X.js} +2 -2
- package/client-dist/{chunk-5ZNUIE2O.js → chunk-7G7KR4QZ.js} +2 -2
- package/client-dist/{chunk-M5JVIKJU.js → chunk-7UZGBEJQ.js} +2 -2
- package/client-dist/{chunk-TOIHWXFM.js → chunk-AUQW6PKZ.js} +2 -2
- package/client-dist/{chunk-ERROOXHA.js → chunk-BYH47PRM.js} +2 -2
- package/client-dist/{chunk-EZD36BDE.js → chunk-DWUR2UF6.js} +2 -2
- package/client-dist/{chunk-HJ6Q4JYU.js → chunk-DZKNJL3B.js} +2 -2
- package/client-dist/{chunk-NU2XNK5F.js → chunk-EGMYVF63.js} +2 -2
- package/client-dist/{chunk-3B2KB7MF.js → chunk-EJO6O6EC.js} +2 -2
- package/client-dist/{chunk-KNNGJ7AJ.js → chunk-GT7XB72V.js} +2 -2
- package/client-dist/{chunk-7AJI4JCW.js → chunk-HDK4R4DG.js} +2 -2
- package/client-dist/{chunk-KOY5WHLS.js → chunk-HY6E2IHK.js} +2 -2
- package/client-dist/{chunk-YDJYWSDS.js → chunk-IDPVOORT.js} +2 -2
- package/client-dist/{chunk-XBMDDFNC.js → chunk-J6DVPTY6.js} +2 -2
- package/client-dist/{chunk-LOGCDPUJ.js → chunk-JENBNAWF.js} +2 -2
- package/client-dist/{chunk-BCLGUIFQ.js → chunk-JJSBMY7W.js} +2 -2
- package/client-dist/{chunk-2ZCY5YQ7.js → chunk-JXYR2FVY.js} +2 -2
- package/client-dist/{chunk-ACYOZ4MP.js → chunk-LD2DR5AV.js} +2 -2
- package/client-dist/{chunk-ARE26OH2.js → chunk-LLL5SQYK.js} +2 -2
- package/client-dist/{chunk-5GU2SVER.js → chunk-NKTKS3CC.js} +2 -2
- package/client-dist/{chunk-ZMT6QVPB.js → chunk-OR2HJC37.js} +2 -2
- package/client-dist/{chunk-2HP3VJTA.js → chunk-QAASV4PF.js} +2 -2
- package/client-dist/{chunk-HWY2SAVN.js → chunk-QENS5VWV.js} +2 -2
- package/client-dist/{chunk-KJBEKLZZ.js → chunk-QM3IE6FW.js} +2 -2
- package/client-dist/{chunk-AEAJ2ABL.js → chunk-QMT4EYEY.js} +2 -2
- package/client-dist/{chunk-UMM6T6AQ.js → chunk-QVUTIP6O.js} +2 -2
- package/client-dist/{chunk-L7MQFYDG.js → chunk-RMXLLPRL.js} +2 -2
- package/client-dist/chunk-S3GEEACD.js +3 -0
- package/client-dist/chunk-S3GEEACD.js.map +7 -0
- package/client-dist/{chunk-XI7FMFIP.js → chunk-S3YWAZOT.js} +2 -2
- package/client-dist/{chunk-XJKKZSRS.js → chunk-T66WJFRE.js} +2 -2
- package/client-dist/{chunk-4JRMGC33.js → chunk-TBT47423.js} +2 -2
- package/client-dist/{chunk-RHNIU2GL.js → chunk-TWJMNHTT.js} +2 -2
- package/client-dist/{chunk-NZTD5QPD.js → chunk-U7R547IU.js} +2 -2
- package/client-dist/{chunk-BSUZZCBN.js → chunk-UX6DCHMP.js} +2 -2
- package/client-dist/{chunk-IVUKHZAE.js → chunk-VHLAHN4W.js} +2 -2
- package/client-dist/{chunk-NYV2AR3J.js → chunk-VSVT5EBJ.js} +2 -2
- package/client-dist/{chunk-5H5VMEAE.js → chunk-VWURPWCQ.js} +2 -2
- package/client-dist/{chunk-U7YD552X.js → chunk-W7RXNJML.js} +2 -2
- package/client-dist/{chunk-WIJ2KUXX.js → chunk-WOO4U5C6.js} +2 -2
- package/client-dist/{chunk-PHSKINXP.js → chunk-XC224D3K.js} +2 -2
- package/client-dist/{chunk-WBU5DC4T.js → chunk-XCALX3WQ.js} +2 -2
- package/client-dist/{chunk-2DCZKGMQ.js → chunk-XL2IMPJH.js} +2 -2
- package/client-dist/{chunk-2ZPKASXU.js → chunk-Y6BP4ZNN.js} +2 -2
- package/client-dist/{chunk-3LJRWGKD.js → chunk-YCBBLDH7.js} +2 -2
- package/client-dist/{chunk-WLLWEGK2.js → chunk-YRUJTMBL.js} +2 -2
- package/client-dist/{chunk-Y5NZKXVF.js → chunk-ZCNA73AF.js} +2 -2
- package/client-dist/{chunk-SOCHCXP2.js → chunk-ZJHMMJDV.js} +2 -2
- package/client-dist/{chunk-5CI77L5J.js → chunk-ZNCU4N2R.js} +2 -2
- package/client-dist/{consultant.module-HZ7WOFTN.js → consultant.module-PDBKVNXA.js} +2 -2
- package/client-dist/{crd.module-OXAMCXDI.js → crd.module-BTDSNWAE.js} +2 -2
- package/client-dist/{dashboard.module-VSGVSZBD.js → dashboard.module-NO5DUIKA.js} +2 -2
- package/client-dist/{do.module-WC6SE5GC.js → do.module-6WQ46EMR.js} +2 -2
- package/client-dist/{document-library.module-LF6PNZZ6.js → document-library.module-CO5QB3GM.js} +2 -2
- package/client-dist/{embedding-eval.module-VG2H26HJ.js → embedding-eval.module-AV2EO7PM.js} +2 -2
- package/client-dist/{embedding-registry.module-L4VRHDSK.js → embedding-registry.module-OBW2UXRZ.js} +2 -2
- package/client-dist/{err.module-7FJCXFSP.js → err.module-LGHLV6S2.js} +2 -2
- package/client-dist/{feedback.module-2K2I6WPU.js → feedback.module-XY3XQN65.js} +2 -2
- package/client-dist/{host-runtime-mcp.module-JOQ523Q5.js → host-runtime-mcp.module-6MAMMHK7.js} +2 -2
- package/client-dist/index.html +1 -1
- package/client-dist/{live-dev-pipeline.module-RJBGTQHR.js → live-dev-pipeline.module-EJ4YWZAM.js} +2 -2
- package/client-dist/{logs.module-2CBIYME4.js → logs.module-53YFDP7B.js} +2 -2
- package/client-dist/{main-TOSGI6VN.js → main-BOSIIGT3.js} +3 -3
- package/client-dist/{master-control-remote-poc.module-5USUYVL5.js → master-control-remote-poc.module-XAAURRJ2.js} +2 -2
- package/client-dist/{mobile-app.module-7ZWPWWLA.js → mobile-app.module-M5TZCEMQ.js} +2 -2
- package/client-dist/{model-registry.module-ENN2P4B7.js → model-registry.module-C6KJUOBE.js} +2 -2
- package/client-dist/{oc.module-27SYDDIP.js → oc.module-YCLNVWJS.js} +2 -2
- package/client-dist/{orc.module-JXNEWP23.js → orc.module-ENRYSIZP.js} +2 -2
- package/client-dist/{project-management.module-4ALXGXV4.js → project-management.module-OKZFJRJ5.js} +2 -2
- package/client-dist/project-source-routed.module-7U4KGGVZ.js +2 -0
- package/client-dist/{scheduler.module-N6PG2XU5.js → scheduler.module-T2NZBYPO.js} +2 -2
- package/client-dist/{session.module-QH4R6K5Q.js → session.module-CEGFEHCL.js} +2 -2
- package/client-dist/{set.module-CVDVQQP3.js → set.module-DEUP6N4M.js} +2 -2
- package/client-dist/{setup.module-UVOQ7JCG.js → setup.module-HUF56GW6.js} +2 -2
- package/client-dist/{terminals.module-FYGH4UWH.js → terminals.module-WU2RY26U.js} +2 -2
- package/client-dist/{voice-notes-poc.module-B2ZRFQMS.js → voice-notes-poc.module-PYHY4YL6.js} +2 -2
- package/client-dist/{wfs.module-FPVJ74R6.js → wfs.module-JSYNS7N7.js} +2 -2
- package/package.json +1 -1
- package/server/build/src/_modules/ccap-agent/_modules/tools/_services/tls-execution.control-service.d.ts +9 -0
- package/server/build/src/_modules/ccap-agent/_modules/tools/_services/tls-execution.control-service.d.ts.map +1 -1
- package/server/build/src/_modules/ccap-agent/_modules/tools/_services/tls-execution.control-service.js +40 -2
- package/server/build/src/_modules/ccap-agent/_modules/tools/_services/tls-execution.control-service.js.map +1 -1
- package/client-dist/chunk-ORLDSG2B.js +0 -2
- package/client-dist/chunk-ORLDSG2B.js.map +0 -7
- package/client-dist/project-source-routed.module-BENCKHFP.js +0 -2
- /package/client-dist/{agent-instances.module-X2EAZWNC.js.map → agent-instances.module-5DOGNLXO.js.map} +0 -0
- /package/client-dist/{ca.module-UKEVG7H5.js.map → ca.module-XHE46FU5.js.map} +0 -0
- /package/client-dist/{cc.module-AE3UTLQM.js.map → cc.module-7CFFLL2A.js.map} +0 -0
- /package/client-dist/{chunk-G5RVYENP.js.map → chunk-26VAQXDU.js.map} +0 -0
- /package/client-dist/{chunk-YYASTT5C.js.map → chunk-2PAMSPPB.js.map} +0 -0
- /package/client-dist/{chunk-PQJSMEEO.js.map → chunk-3OAVFWVG.js.map} +0 -0
- /package/client-dist/{chunk-JSLXFS3P.js.map → chunk-44UE4O3M.js.map} +0 -0
- /package/client-dist/{chunk-O2MF2KDY.js.map → chunk-4WNJ7IKE.js.map} +0 -0
- /package/client-dist/{chunk-SY2IF3DK.js.map → chunk-55GY7S7U.js.map} +0 -0
- /package/client-dist/{chunk-4BERPGJT.js.map → chunk-6BHKDJRV.js.map} +0 -0
- /package/client-dist/{chunk-R3JWUXQG.js.map → chunk-6JLSVPOB.js.map} +0 -0
- /package/client-dist/{chunk-QBVNLJ7A.js.map → chunk-6YZDXJ6X.js.map} +0 -0
- /package/client-dist/{chunk-5ZNUIE2O.js.map → chunk-7G7KR4QZ.js.map} +0 -0
- /package/client-dist/{chunk-M5JVIKJU.js.map → chunk-7UZGBEJQ.js.map} +0 -0
- /package/client-dist/{chunk-TOIHWXFM.js.map → chunk-AUQW6PKZ.js.map} +0 -0
- /package/client-dist/{chunk-ERROOXHA.js.map → chunk-BYH47PRM.js.map} +0 -0
- /package/client-dist/{chunk-EZD36BDE.js.map → chunk-DWUR2UF6.js.map} +0 -0
- /package/client-dist/{chunk-HJ6Q4JYU.js.map → chunk-DZKNJL3B.js.map} +0 -0
- /package/client-dist/{chunk-NU2XNK5F.js.map → chunk-EGMYVF63.js.map} +0 -0
- /package/client-dist/{chunk-3B2KB7MF.js.map → chunk-EJO6O6EC.js.map} +0 -0
- /package/client-dist/{chunk-KNNGJ7AJ.js.map → chunk-GT7XB72V.js.map} +0 -0
- /package/client-dist/{chunk-7AJI4JCW.js.map → chunk-HDK4R4DG.js.map} +0 -0
- /package/client-dist/{chunk-KOY5WHLS.js.map → chunk-HY6E2IHK.js.map} +0 -0
- /package/client-dist/{chunk-YDJYWSDS.js.map → chunk-IDPVOORT.js.map} +0 -0
- /package/client-dist/{chunk-XBMDDFNC.js.map → chunk-J6DVPTY6.js.map} +0 -0
- /package/client-dist/{chunk-LOGCDPUJ.js.map → chunk-JENBNAWF.js.map} +0 -0
- /package/client-dist/{chunk-BCLGUIFQ.js.map → chunk-JJSBMY7W.js.map} +0 -0
- /package/client-dist/{chunk-2ZCY5YQ7.js.map → chunk-JXYR2FVY.js.map} +0 -0
- /package/client-dist/{chunk-ACYOZ4MP.js.map → chunk-LD2DR5AV.js.map} +0 -0
- /package/client-dist/{chunk-ARE26OH2.js.map → chunk-LLL5SQYK.js.map} +0 -0
- /package/client-dist/{chunk-5GU2SVER.js.map → chunk-NKTKS3CC.js.map} +0 -0
- /package/client-dist/{chunk-ZMT6QVPB.js.map → chunk-OR2HJC37.js.map} +0 -0
- /package/client-dist/{chunk-2HP3VJTA.js.map → chunk-QAASV4PF.js.map} +0 -0
- /package/client-dist/{chunk-HWY2SAVN.js.map → chunk-QENS5VWV.js.map} +0 -0
- /package/client-dist/{chunk-KJBEKLZZ.js.map → chunk-QM3IE6FW.js.map} +0 -0
- /package/client-dist/{chunk-AEAJ2ABL.js.map → chunk-QMT4EYEY.js.map} +0 -0
- /package/client-dist/{chunk-UMM6T6AQ.js.map → chunk-QVUTIP6O.js.map} +0 -0
- /package/client-dist/{chunk-L7MQFYDG.js.map → chunk-RMXLLPRL.js.map} +0 -0
- /package/client-dist/{chunk-XI7FMFIP.js.map → chunk-S3YWAZOT.js.map} +0 -0
- /package/client-dist/{chunk-XJKKZSRS.js.map → chunk-T66WJFRE.js.map} +0 -0
- /package/client-dist/{chunk-4JRMGC33.js.map → chunk-TBT47423.js.map} +0 -0
- /package/client-dist/{chunk-RHNIU2GL.js.map → chunk-TWJMNHTT.js.map} +0 -0
- /package/client-dist/{chunk-NZTD5QPD.js.map → chunk-U7R547IU.js.map} +0 -0
- /package/client-dist/{chunk-BSUZZCBN.js.map → chunk-UX6DCHMP.js.map} +0 -0
- /package/client-dist/{chunk-IVUKHZAE.js.map → chunk-VHLAHN4W.js.map} +0 -0
- /package/client-dist/{chunk-NYV2AR3J.js.map → chunk-VSVT5EBJ.js.map} +0 -0
- /package/client-dist/{chunk-5H5VMEAE.js.map → chunk-VWURPWCQ.js.map} +0 -0
- /package/client-dist/{chunk-U7YD552X.js.map → chunk-W7RXNJML.js.map} +0 -0
- /package/client-dist/{chunk-WIJ2KUXX.js.map → chunk-WOO4U5C6.js.map} +0 -0
- /package/client-dist/{chunk-PHSKINXP.js.map → chunk-XC224D3K.js.map} +0 -0
- /package/client-dist/{chunk-WBU5DC4T.js.map → chunk-XCALX3WQ.js.map} +0 -0
- /package/client-dist/{chunk-2DCZKGMQ.js.map → chunk-XL2IMPJH.js.map} +0 -0
- /package/client-dist/{chunk-2ZPKASXU.js.map → chunk-Y6BP4ZNN.js.map} +0 -0
- /package/client-dist/{chunk-3LJRWGKD.js.map → chunk-YCBBLDH7.js.map} +0 -0
- /package/client-dist/{chunk-WLLWEGK2.js.map → chunk-YRUJTMBL.js.map} +0 -0
- /package/client-dist/{chunk-Y5NZKXVF.js.map → chunk-ZCNA73AF.js.map} +0 -0
- /package/client-dist/{chunk-SOCHCXP2.js.map → chunk-ZJHMMJDV.js.map} +0 -0
- /package/client-dist/{chunk-5CI77L5J.js.map → chunk-ZNCU4N2R.js.map} +0 -0
- /package/client-dist/{consultant.module-HZ7WOFTN.js.map → consultant.module-PDBKVNXA.js.map} +0 -0
- /package/client-dist/{crd.module-OXAMCXDI.js.map → crd.module-BTDSNWAE.js.map} +0 -0
- /package/client-dist/{dashboard.module-VSGVSZBD.js.map → dashboard.module-NO5DUIKA.js.map} +0 -0
- /package/client-dist/{do.module-WC6SE5GC.js.map → do.module-6WQ46EMR.js.map} +0 -0
- /package/client-dist/{document-library.module-LF6PNZZ6.js.map → document-library.module-CO5QB3GM.js.map} +0 -0
- /package/client-dist/{embedding-eval.module-VG2H26HJ.js.map → embedding-eval.module-AV2EO7PM.js.map} +0 -0
- /package/client-dist/{embedding-registry.module-L4VRHDSK.js.map → embedding-registry.module-OBW2UXRZ.js.map} +0 -0
- /package/client-dist/{err.module-7FJCXFSP.js.map → err.module-LGHLV6S2.js.map} +0 -0
- /package/client-dist/{feedback.module-2K2I6WPU.js.map → feedback.module-XY3XQN65.js.map} +0 -0
- /package/client-dist/{host-runtime-mcp.module-JOQ523Q5.js.map → host-runtime-mcp.module-6MAMMHK7.js.map} +0 -0
- /package/client-dist/{live-dev-pipeline.module-RJBGTQHR.js.map → live-dev-pipeline.module-EJ4YWZAM.js.map} +0 -0
- /package/client-dist/{logs.module-2CBIYME4.js.map → logs.module-53YFDP7B.js.map} +0 -0
- /package/client-dist/{main-TOSGI6VN.js.map → main-BOSIIGT3.js.map} +0 -0
- /package/client-dist/{master-control-remote-poc.module-5USUYVL5.js.map → master-control-remote-poc.module-XAAURRJ2.js.map} +0 -0
- /package/client-dist/{mobile-app.module-7ZWPWWLA.js.map → mobile-app.module-M5TZCEMQ.js.map} +0 -0
- /package/client-dist/{model-registry.module-ENN2P4B7.js.map → model-registry.module-C6KJUOBE.js.map} +0 -0
- /package/client-dist/{oc.module-27SYDDIP.js.map → oc.module-YCLNVWJS.js.map} +0 -0
- /package/client-dist/{orc.module-JXNEWP23.js.map → orc.module-ENRYSIZP.js.map} +0 -0
- /package/client-dist/{project-management.module-4ALXGXV4.js.map → project-management.module-OKZFJRJ5.js.map} +0 -0
- /package/client-dist/{project-source-routed.module-BENCKHFP.js.map → project-source-routed.module-7U4KGGVZ.js.map} +0 -0
- /package/client-dist/{scheduler.module-N6PG2XU5.js.map → scheduler.module-T2NZBYPO.js.map} +0 -0
- /package/client-dist/{session.module-QH4R6K5Q.js.map → session.module-CEGFEHCL.js.map} +0 -0
- /package/client-dist/{set.module-CVDVQQP3.js.map → set.module-DEUP6N4M.js.map} +0 -0
- /package/client-dist/{setup.module-UVOQ7JCG.js.map → setup.module-HUF56GW6.js.map} +0 -0
- /package/client-dist/{terminals.module-FYGH4UWH.js.map → terminals.module-WU2RY26U.js.map} +0 -0
- /package/client-dist/{voice-notes-poc.module-B2ZRFQMS.js.map → voice-notes-poc.module-PYHY4YL6.js.map} +0 -0
- /package/client-dist/{wfs.module-FPVJ74R6.js.map → wfs.module-JSYNS7N7.js.map} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as R,b as O}from"./chunk-
|
|
1
|
+
import{a as R,b as O}from"./chunk-RMXLLPRL.js";import{a as q}from"./chunk-VHLAHN4W.js";import{a as g}from"./chunk-UFBTR2BG.js";import{a as U}from"./chunk-LD2DR5AV.js";import{e as P}from"./chunk-XL2IMPJH.js";import{h as y,j as L}from"./chunk-3OAVFWVG.js";import{p as D}from"./chunk-5IGMWTXT.js";import{C as v,R as T,a as h,aa as p,b as S,h as E,k as d,y as A}from"./chunk-TBMJSIBB.js";var f=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?S(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(S(h({},r),{session:S(h({},r.session),{status:n,statusMessage:t}),runtime:S(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 I=0;I<i.length;I++)c.add(m+I);this.parent.liveStderrLines_$.set(c)}let l=[...o,...i];if(l.length>r){let c=l.length-r,m=l.slice(c),I=this.parent.liveStderrLines_$(),b=new Set;for(let w of I){let $=w-c;$>=0&&b.add($)}this.parent.liveStderrLines_$.set(b),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(S(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(S(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)??"":"",I=a.content,b=typeof I=="string"?I:"",w=a.is_error===!0,$=m?`${m}: `:"",k=b.length>200?b.substring(0,200)+"\u2026":b||"tool result",F=w?`${$}ERROR \u2014 ${k}`:`${$}${k}`;this.parent.pushConsoleMessage({type:"tool-result",text:F,expandableContent:b.length>200?b:void 0,rawData:S(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*f.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){f.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){f.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){f.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}})}loadDiagnostic(e){return d(this,null,function*(){try{return yield this.ccSession_AS.getDiagnostic({sessionId:e.sessionId})}catch(s){return f.DyFM_Log.error(`CCAP_CcSession_DS | loadDiagnostic failed | sessionId: ${e.sessionId}`,s),null}})}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(S(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]=S(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){f.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){f.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){f.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){f.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";f.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-QENS5VWV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{I as d}from"./chunk-5IGMWTXT.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-QM3IE6FW.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-VHLAHN4W.js";import{a as q}from"./chunk-LD2DR5AV.js";import{d as F}from"./chunk-DWUR2UF6.js";import{e as D}from"./chunk-XL2IMPJH.js";import{h as A,j as k}from"./chunk-3OAVFWVG.js";import{I as R,p as j}from"./chunk-5IGMWTXT.js";import{C as I,R as P,a as S,aa as m,b,h as U,k as f,p as y,vb as g,xb as K,y as E}from"./chunk-TBMJSIBB.js";var M=class{static compareMirrorEventsAsc(i,e){let t=(i.sequence??0)-(e.sequence??0);if(t!==0)return t;let s=typeof i.timestamp=="string"?i.timestamp:"",n=typeof e.timestamp=="string"?e.timestamp:"",o=s.localeCompare(n);if(o!==0)return o;let r=typeof i.eventType=="string"?i.eventType:"",a=typeof e.eventType=="string"?e.eventType:"";return r.localeCompare(a)}};var C=class c{static messageIdsCompatibleForStreamMerge(i,e){let t=(i??"").trim(),s=(e??"").trim();return t.length>0&&s.length>0?t===s:!0}static parseStreamChunkFromMirrorData(i){let e=i.update;if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=c.toPlainRecord(e),s=t.sessionUpdate,n=null;if(s==="agent_message_chunk"&&(n="agent"),s==="user_message_chunk"&&(n="user"),s==="agent_thought_chunk"&&(n="thought"),n===null)return null;let o=t.content;if(o===null||typeof o!="object"||Array.isArray(o))return null;let a=c.toPlainRecord(o).text;if(typeof a!="string"||!a.length)return null;let l=t.messageId,d=typeof l=="string"&&l.length>0?l:void 0;return{role:n,text:a,messageId:d}}static canMergeConsoleTailWithChunk(i){let e=i.prev;if(e.streamTextRole===void 0||e.streamTextRole!==i.parsed.role)return!1;let t=e.streamMessageId,s=i.parsed.messageId;if(!c.messageIdsCompatibleForStreamMerge(t,s))return!1;let n=i.ev.sequence??0,o=e.streamLastSequence??0;return!(n<=o)}static canMergeMirrorChunkEvents(i,e,t){let s=c.parseStreamChunkFromMirrorData(i.data??{});if(s===null||s.role!==t.role)return!1;let n=s.messageId,o=t.messageId;if(!c.messageIdsCompatibleForStreamMerge(n,o))return!1;let r=i.sequence??0;return!((e.sequence??0)<=r)}static foldEventsToTimelineRows(i){let e=[];for(let t of i){let s=c.parseStreamChunkFromMirrorData(t.data??{});if(s!==null){let n=e.length>0?e[e.length-1]:void 0,o=n!==void 0&&n.events.length>0?n.events[n.events.length-1]:void 0;if(n!==void 0&&o!==void 0&&c.canMergeMirrorChunkEvents(o,t,s)){let r=[...n.events,t];e[e.length-1]={rowKey:c.mergedTimelineRowKey(r),events:r}}else e.push({rowKey:`evt-${String(t.sequence??0)}`,events:[t]})}else e.push({rowKey:`evt-${String(t.sequence??0)}`,events:[t]})}return e}static mergedTimelineRowKey(i){if(!i.length)return"evt-empty";let e=i[0].sequence??0,t=i[i.length-1].sequence??0;return`merged-chunk-${String(e)}-${String(t)}`}static toPlainRecord(i){let e={};for(let t of Object.keys(i))e[t]=Reflect.get(i,t);return e}};var v=U(j());var x=class c{static prettyStringifyUnknown(i){try{let e=c.expandEmbeddedJsonStrings(i);return JSON.stringify(e,null,2)}catch{return i==null?String(i):typeof i=="object"?"[Object stringify failed]":String(i)}}static expandEmbeddedJsonStrings(i){if(i==null)return i;if(typeof i=="string"){let t=i;if(!F.looksLikeJson(t))return t;try{let s=JSON.parse(t.trim());return c.expandEmbeddedJsonStrings(s)}catch{return t}}if(typeof i!="object")return i;if(Array.isArray(i))return i.map(t=>c.expandEmbeddedJsonStrings(t));let e={};for(let t of Object.keys(i)){let s=Reflect.get(i,t);e[t]=c.expandEmbeddedJsonStrings(s)}return e}};var T=class c{static buildFromMirrorEvent(i){let e=i.sequence??0,t=i.data!==void 0?i.data:{},s=typeof i.eventType=="string"?i.eventType:"";return s==="prompt-sent"?c.buildPromptSentBrief(e,t):s==="ca-session-update"?c.buildCaSessionUpdateBrief(e,t):c.buildGenericBrief(s,e,t)}static extractSessionUpdateKind(i){let e=i.update;if(e===null||typeof e!="object"||Array.isArray(e))return;let s=c.toPlainRecord(e).sessionUpdate;return typeof s=="string"&&s.length?s:void 0}static buildPromptSentBrief(i,e){let t=e.content;return typeof t!="string"||!t.length?null:{listKey:`mirror-prompt-${String(i)}`,consoleType:"prompt",bodyText:t,mirrorEventType:"prompt-sent",useRawBubbleKind:!1,rawData:e}}static buildCaSessionUpdateBrief(i,e){let t=C.parseStreamChunkFromMirrorData(e);if(t!==null){let n=c.extractSessionUpdateKind(e),o=t.role==="thought";return{listKey:`mirror-chunk-${String(i)}`,consoleType:o?"thinking":"assistant",bodyText:t.text,mirrorEventType:"ca-session-update",briefSubtype:n,useRawBubbleKind:!1,rawData:e,isStreamingTextChunk:!0,streamTextRole:t.role,streamMessageId:t.messageId}}let s=x.prettyStringifyUnknown(e);return{listKey:`mirror-ca-session-update-${String(i)}`,consoleType:"info",bodyText:s,mirrorEventType:"ca-session-update",useRawBubbleKind:!0,rawData:e}}static buildGenericBrief(i,e,t){let s=c.safeListKeySegment(i),n={eventType:i.length?i:"unknown",sequence:e,data:t},o=x.prettyStringifyUnknown(n);return{listKey:`mirror-${s}-${String(e)}`,consoleType:"info",bodyText:o,mirrorEventType:i.length?i:"unknown",useRawBubbleKind:!0,rawData:t}}static safeListKeySegment(i){let e=i.replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/^_+|_+$/g,"");return e.length?e:"event"}static toPlainRecord(i){let e={};for(let t of Object.keys(i))e[t]=Reflect.get(i,t);return e}};var u=class c{static listKeyStart(i){return`ca-tc-${i}-start`}static listKeyProgress(i){return`ca-tc-${i}-progress`}static listKeyResult(i){return`ca-tc-${i}-result`}static listKeyError(i){return`ca-tc-${i}-error`}static tryParseStableListKey(i){let e="ca-tc-";if(!i.startsWith(e))return null;let t=[{suffix:"-progress",role:"progress"},{suffix:"-start",role:"start"},{suffix:"-result",role:"result"},{suffix:"-error",role:"error"}];for(let s of t){if(!i.endsWith(s.suffix))continue;let n=i.slice(e.length,i.length-s.suffix.length);return n.length?{toolCallId:n,role:s.role}:null}return null}static tryParseMirrorData(i){let e=i.update;if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=c.toPlainRecord(e),s=t.sessionUpdate;if(s!=="tool_call"&&s!=="tool_call_update")return null;let n=t.toolCallId;if(typeof n!="string"||!n.trim().length)return null;let o=t.status,r=typeof o=="string"?o:"",a=t.title,l=typeof a=="string"&&a.trim().length?a.trim():void 0,d=t.kind,h=typeof d=="string"&&d.trim().length?d.trim():void 0,p=t.rawOutput,_=t.rawInput,w=t.content,$=t.locations;return{sessionUpdate:s,toolCallId:n.trim(),status:r,title:l,toolKind:h,rawOutput:p!==void 0?p:void 0,rawInput:_!==void 0?_:void 0,content:Array.isArray(w)&&w.length?w:void 0,locations:Array.isArray($)&&$.length?$:void 0}}static hasRawOutputError(i){if(i===null||typeof i!="object"||Array.isArray(i))return!1;let e=c.toPlainRecord(i);return Object.prototype.hasOwnProperty.call(e,"error")}static summarizeRawOutputError(i){if(i===null||typeof i!="object"||Array.isArray(i))return"Tool call failed";let t=c.toPlainRecord(i).error;if(typeof t=="string"&&t.trim().length)return t.trim();try{return JSON.stringify(i)}catch{return"Tool call failed"}}static summarizeRawOutputSuccess(i){if(i===void 0)return"Completed";try{let e=JSON.stringify(i),t=400;return e.length>t?`${e.substring(0,t)}\u2026`:e}catch{return"Completed"}}static formatRawInput(i){if(i==null)return"";try{return JSON.stringify(i,null,2)}catch{return String(i)}}static formatLocations(i){if(!i?.length)return"";let e=[];for(let t of i){if(t===null||typeof t!="object"||Array.isArray(t))continue;let s=c.toPlainRecord(t),n=s.path;if(typeof n!="string"||!n.length)continue;let o=s.line,r=typeof o=="number"?`:${o}`:"";e.push(`${n}${r}`)}return e.join(`
|
|
2
2
|
`)}static formatContent(i){if(!i?.length)return"";let e=[];for(let t of i){if(t===null||typeof t!="object"||Array.isArray(t))continue;let s=c.toPlainRecord(t),n=s.type;if(n==="diff"){let o=s.path,r=s.oldText,a=s.newText,d=[`--- ${typeof o=="string"?o:"(unknown)"}`];typeof r=="string"&&r.length&&d.push(`- ${r.substring(0,500)}${r.length>500?"\u2026":""}`),typeof a=="string"&&a.length&&d.push(`+ ${a.substring(0,500)}${a.length>500?"\u2026":""}`),e.push(d.join(`
|
|
3
3
|
`))}else if(n==="terminal")try{e.push(`[terminal] ${JSON.stringify(s,null,2)}`)}catch{e.push("[terminal output]")}else if(n==="content"){let o=s.parts;if(Array.isArray(o)){for(let r of o)if(r!==null&&typeof r=="object"&&!Array.isArray(r)){let a=c.toPlainRecord(r);typeof a.text=="string"&&e.push(a.text)}}}}return e.join(`
|
|
4
4
|
|
|
5
5
|
`)}static toPlainRecord(i){let e={};for(let t of Object.keys(i))e[t]=Reflect.get(i,t);return e}};var L=(()=>{class c{baseUrl=`${R.api.baseUrl}/ca-session`;http=I(K);peiContext_DS=I(q);withCcapId(e){let t=this.peiContext_DS.activeCcapId_$();return t?e.set("ccapId",t):e}createSession(e){let t=this.withCcapId(new g);return y(this.http.post(this.baseUrl,e,{params:t}))}listSessions(e){let t=this.withCcapId(new g);return e?.status&&(t=t.set("status",e.status)),e?.workspacePath&&(t=t.set("workspacePath",e.workspacePath)),e?.includeArchived&&(t=t.set("includeArchived","1")),y(this.http.get(this.baseUrl,{params:t}))}syncFromAgent(e){let t=this.withCcapId(new g);return y(this.http.post(`${this.baseUrl}/sync`,{cwd:e?.cwd},{params:t}))}getSession(e){let t=this.withCcapId(new g);return y(this.http.get(`${this.baseUrl}/${e}`,{params:t}))}sendPrompt(e){let t=this.withCcapId(new g);return y(this.http.post(`${this.baseUrl}/${e.sessionId}/prompt`,{content:e.content},{params:t}))}stopExecution(e){let t=this.withCcapId(new g);return y(this.http.post(`${this.baseUrl}/${e}/stop-execution`,{},{params:t}))}terminateSession(e){let t=this.withCcapId(new g);return y(this.http.post(`${this.baseUrl}/${e}/terminate`,{},{params:t}))}setSessionArchived(e){let t=this.withCcapId(new g);return y(this.http.patch(`${this.baseUrl}/${e.sessionId}/archive`,{isArchived:e.isArchived},{params:t}))}getSessionEvents(e){let t=this.withCcapId(new g);return e.sinceSequence!=null&&(t=t.set("sinceSequence",String(e.sinceSequence))),e.limit!=null&&(t=t.set("limit",String(e.limit))),y(this.http.get(`${this.baseUrl}/${e.sessionId}/events`,{params:t}))}hydrateSession(e){return y(this.http.post(`${this.baseUrl}/${e.sessionId}/hydrate`,{force:e.force===!0},{params:this.withCcapId(new g)}))}static \u0275fac=function(t){return new(t||c)};static \u0275prov=E({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();var fe=(()=>{class c{sessions_$=m([]);sessionsLoading_$=m(!1);sessionsLoadError_$=m(null);selectedSession_$=m(null);selectedSessionLoading_$=m(!1);selectedSessionEvents_$=m([]);sessionEventsHasMore_$=m(!1);mirrorRuntime_$=m(null);consoleMessages_$=m([]);assembledMessages_$=m([]);assembledMessagesHasMore_$=m(!1);isLoadingOlderMessages_$=m(!1);lastStatusUpdate_$=m(null);activeSessionId_$=m("");sessionDetailError_$=m(null);caSession_AS=I(L);extSessionMsg_AS=I(O);globalError_CS=I(k);socket_CS=I(D);ngZone=I(P);eventSubscription=null;reconnectSubscription=null;lastKnownEventSequence=-1;openSessionPollTimer=null;openSessionPollTargetId="";pendingOptimisticPrompts=[];sessionEventsNextSince=null;constructor(){this.eventSubscription=this.socket_CS.event$.subscribe(e=>{this.handleSocketEvent(e)}),this.reconnectSubscription=this.socket_CS.connected$.subscribe(e=>{if(e){let t=this.activeSessionId_$();t&&(this.socket_CS.emit("ca-session:subscribe",{sessionId:t}),this.loadAssembledMessages({sessionId:t}).catch(()=>{}))}})}ngOnDestroy(){this.stopOpenSessionPolling(),this.eventSubscription?.unsubscribe(),this.reconnectSubscription?.unsubscribe()}loadSessions(e){return f(this,null,function*(){this.sessionsLoading_$.set(!0),this.sessionsLoadError_$.set(null);try{let t=yield this.caSession_AS.listSessions({includeArchived:e?.includeArchived}),s=t.sessions,o=(Array.isArray(s)?s:[]).map(_=>this.mapSessionRecord(this.toRecord(_)));this.sessions_$.set(o);let r=t.mirrorRuntime,a=this.toRecord(r),l=a.isAcpConnected,d=a.loadSessionSupported,h=a.isTerminalMode,p=a.isTerminalRunnerConnected;typeof l=="boolean"&&typeof d=="boolean"?this.mirrorRuntime_$.set({isAcpConnected:l,loadSessionSupported:d,isTerminalMode:h===!0,isTerminalRunnerConnected:p===!0}):this.mirrorRuntime_$.set(null)}catch(t){this.sessionsLoadError_$.set(t),this.globalError_CS.showError(t,"ca-session-list")}finally{this.sessionsLoading_$.set(!1)}})}syncFromAgent(e){return f(this,null,function*(){try{yield this.caSession_AS.syncFromAgent({cwd:e?.cwd}),yield this.loadSessions()}catch(t){throw this.globalError_CS.showError(t,"ca-session-sync"),t}})}loadSessionDetail(e){return f(this,null,function*(){this.sessionDetailError_$.set(null),this.selectedSessionLoading_$.set(!0);try{let s=(yield this.caSession_AS.getSession(e.sessionId)).session;this.selectedSession_$.set(this.mapSessionRecord(s)),this.sessionEventsNextSince=null,this.sessionEventsHasMore_$.set(!1);let n=yield this.caSession_AS.getSessionEvents({sessionId:e.sessionId,limit:200}),o=n.events.map(a=>({sessionId:typeof a.sessionId=="string"?a.sessionId:e.sessionId,eventType:typeof a.eventType=="string"?a.eventType:"",timestamp:typeof a.timestamp=="string"?a.timestamp:"",data:this.asRecord(a.data),sequence:typeof a.sequence=="number"?a.sequence:0}));this.selectedSessionEvents_$.set(o),this.sessionEventsHasMore_$.set(n.hasMore===!0);let r=n.nextSinceSequence;return this.sessionEventsNextSince=typeof r=="number"?r:null,this.lastKnownEventSequence=Math.max(-1,...this.selectedSessionEvents_$().map(a=>a.sequence??0)),this.seedConsoleFromMirrorEvents(o),this.loadAssembledMessages({sessionId:e.sessionId}).catch(()=>{}),!0}catch(t){return this.sessionDetailError_$.set(t),this.selectedSession_$.set(null),this.selectedSessionEvents_$.set([]),this.globalError_CS.showError(t,"ca-session-detail"),!1}finally{this.selectedSessionLoading_$.set(!1)}})}loadMoreSessionEvents(e){return f(this,null,function*(){let t=this.sessionEventsNextSince;if(t!=null)try{let s=yield this.caSession_AS.getSessionEvents({sessionId:e.sessionId,sinceSequence:t,limit:200}),n=s.events.map(a=>({sessionId:typeof a.sessionId=="string"?a.sessionId:e.sessionId,eventType:typeof a.eventType=="string"?a.eventType:"",timestamp:typeof a.timestamp=="string"?a.timestamp:"",data:this.asRecord(a.data),sequence:typeof a.sequence=="number"?a.sequence:0})),o=[...this.selectedSessionEvents_$(),...n];o.sort(M.compareMirrorEventsAsc),this.selectedSessionEvents_$.set(o),this.sessionEventsHasMore_$.set(s.hasMore===!0);let r=s.nextSinceSequence;this.sessionEventsNextSince=typeof r=="number"?r:null,this.lastKnownEventSequence=Math.max(this.lastKnownEventSequence,...n.map(a=>a.sequence??0))}catch(s){this.globalError_CS.showError(s,"ca-session-events-page")}})}hydrateFromAgent(e){return f(this,null,function*(){try{yield this.caSession_AS.hydrateSession({sessionId:e.sessionId,force:e.force})}catch(s){throw this.globalError_CS.showError(s,"ca-session-hydrate"),s}if(!(yield this.loadSessionDetail({sessionId:e.sessionId}))){let s=this.sessionDetailError_$();throw s instanceof Error?s:new Error("CA session detail reload after hydrate failed")}})}setActiveSessionId(e){let t=this.activeSessionId_$();t&&t!==e&&this.socket_CS.emit("ca-session:unsubscribe",{sessionId:t}),this.activeSessionId_$.set(e),e&&this.socket_CS.emit("ca-session:subscribe",{sessionId:e})}clearLiveOutput(){this.consoleMessages_$.set([]),this.lastKnownEventSequence=-1,this.pendingOptimisticPrompts.length=0}createSession(e){return f(this,null,function*(){try{let t=yield this.caSession_AS.createSession({workspacePath:e.workspacePath,label:e.label}),n=this.toRecord(t.session).sessionId,o=typeof n=="string"?n:"";return yield this.loadSessions(),o}catch(t){throw t}})}sendPrompt(e){return f(this,null,function*(){let t=`optimistic-prompt-${globalThis.crypto.randomUUID()}`;this.pendingOptimisticPrompts.push({listKey:t,text:e.content}),this.pushConsoleMessage({listKey:t,type:"prompt",text:e.content});try{yield this.caSession_AS.sendPrompt(e)}catch(s){let n=this.pendingOptimisticPrompts.findIndex(o=>o.listKey===t);throw n>=0&&this.pendingOptimisticPrompts.splice(n,1),this.pushConsoleMessage({type:"error",text:A.getErrorMessageForDisplay(s)}),this.globalError_CS.showError(s,"ca-session-prompt"),s}})}stopExecution(e){return f(this,null,function*(){try{yield this.caSession_AS.stopExecution(e)}catch(t){throw this.globalError_CS.showError(t,"ca-session-stop-execution"),t}})}terminateSession(e){return f(this,null,function*(){try{yield this.caSession_AS.terminateSession(e),yield this.loadSessions()}catch(t){throw this.globalError_CS.showError(t,"ca-session-terminate"),t}})}setSessionArchived(e){return f(this,null,function*(){try{let t=yield this.caSession_AS.setSessionArchived(e);yield this.loadSessions(),this.selectedSession_$()?.sessionId===e.sessionId&&t.session!==null&&typeof t.session=="object"&&this.selectedSession_$.set(this.mapSessionRecord(this.toRecord(t.session)))}catch(t){throw this.globalError_CS.showError(t,"ca-session-archive"),t}})}startOpenSessionPolling(e){if(this.stopOpenSessionPolling(),!e)return;this.openSessionPollTargetId=e;let t=10*v.second;this.openSessionPollTimer=globalThis.setInterval(()=>{this.runOpenSessionPollTick(e)},t)}stopOpenSessionPolling(){this.openSessionPollTimer!==null&&(globalThis.clearInterval(this.openSessionPollTimer),this.openSessionPollTimer=null),this.openSessionPollTargetId=""}pushConsoleMessage(e){let t=this.materializeConsoleLineFromPushParams({listKey:e.listKey,type:e.type,text:e.text,timestamp:e.timestamp??new Date().toISOString(),rawData:e.rawData,mirrorEventType:e.mirrorEventType,briefSubtype:e.briefSubtype,useRawBubbleKind:e.useRawBubbleKind,streamTextRole:e.streamTextRole,streamLastSequence:e.streamLastSequence,streamMessageId:e.streamMessageId,streamPartData:e.streamPartData,toolDisplayName:e.toolDisplayName,isToolCallFailedIndicator:e.isToolCallFailedIndicator}),s=this.consoleMessages_$();this.consoleMessages_$.set([...s,t])}appendConsoleMirrorEventOne(e){if(e.eventType==="ca-session-update"){let o=u.tryParseMirrorData(e.data??{});if(o!==null&&this.applyToolCallMirrorEventToLiveConsole({ev:e,parsed:o}))return}let t=T.buildFromMirrorEvent(e);if(t===null||(e.eventType==="prompt-sent"&&t.consoleType==="prompt"&&this.removePendingOptimisticPromptBubbleIfTextMatchesMirror(t.bodyText),this.consoleMessages_$().some(o=>o.listKey===t.listKey))||t.isStreamingTextChunk===!0&&this.tryMergeStreamingMirrorChunkIntoConsole({ev:e,brief:t}))return;let n=typeof e.timestamp=="string"&&e.timestamp.length?e.timestamp:new Date().toISOString();this.pushConsoleMessage(this.buildConsolePushParamsFromBrief({ev:e,brief:t,timestampIso:n}))}tryMergeStreamingMirrorChunkIntoConsole(e){let t=this.consoleMessages_$();if(t.length===0)return!1;let s=t[t.length-1],n=C.parseStreamChunkFromMirrorData(e.ev.data??{});if(n===null||!C.canMergeConsoleTailWithChunk({prev:s,ev:e.ev,parsed:n}))return!1;let o=s.streamPartData!==void 0?[...s.streamPartData]:[];o.push(e.ev.data??{});let r=e.brief.streamMessageId,a=r!==void 0&&r.trim().length>0?r.trim():s.streamMessageId,l=b(S({},s),{text:s.text+e.brief.bodyText,streamLastSequence:e.ev.sequence??s.streamLastSequence,streamMessageId:a,streamPartData:o,rawData:{streamMerged:!0,partCount:o.length,lastChunkSequence:e.ev.sequence,chunkSnapshots:o}}),d=[...t];return d[d.length-1]=l,this.consoleMessages_$.set(d),!0}buildConsolePushParamsFromBrief(e){let t=e.brief;return t.isStreamingTextChunk===!0?{listKey:t.listKey,type:t.consoleType,text:t.bodyText,timestamp:e.timestampIso,rawData:t.rawData,mirrorEventType:t.mirrorEventType,briefSubtype:t.briefSubtype,useRawBubbleKind:t.useRawBubbleKind,streamTextRole:t.streamTextRole,streamLastSequence:e.ev.sequence,streamMessageId:t.streamMessageId,streamPartData:[e.ev.data??{}]}:{listKey:t.listKey,type:t.consoleType,text:t.bodyText,timestamp:e.timestampIso,rawData:t.rawData,mirrorEventType:t.mirrorEventType,briefSubtype:t.briefSubtype,useRawBubbleKind:t.useRawBubbleKind}}buildFoldedConsoleMessagesFromMirrorEvents(e){let t=[];for(let s of e){if(this.tryFoldToolCallMirrorEventIntoOut(t,s))continue;let o=T.buildFromMirrorEvent(s);if(o===null)continue;let r=typeof s.timestamp=="string"&&s.timestamp.length?s.timestamp:new Date().toISOString();if(o.isStreamingTextChunk===!0){let a=C.parseStreamChunkFromMirrorData(s.data??{});if(a===null)continue;let l=t.length>0?t[t.length-1]:void 0;if(l!==void 0&&C.canMergeConsoleTailWithChunk({prev:l,ev:s,parsed:a})){let d=l.streamPartData!==void 0?[...l.streamPartData]:[];d.push(s.data??{});let h=o.streamMessageId,p=h!==void 0&&h.trim().length>0?h.trim():l.streamMessageId;t[t.length-1]=b(S({},l),{text:l.text+o.bodyText,streamLastSequence:s.sequence??l.streamLastSequence,streamMessageId:p,streamPartData:d,rawData:{streamMerged:!0,partCount:d.length,lastChunkSequence:s.sequence,chunkSnapshots:d}})}else t.push(this.materializeConsoleLineFromPushParams(this.buildConsolePushParamsFromBrief({ev:s,brief:o,timestampIso:r})))}else t.push(this.materializeConsoleLineFromPushParams(this.buildConsolePushParamsFromBrief({ev:s,brief:o,timestampIso:r})))}return t}materializeConsoleLineFromPushParams(e){return{listKey:e.listKey??globalThis.crypto.randomUUID(),type:e.type,text:e.text,timestamp:e.timestamp,rawData:e.rawData,mirrorEventType:e.mirrorEventType,briefSubtype:e.briefSubtype,useRawBubbleKind:e.useRawBubbleKind,streamTextRole:e.streamTextRole,streamLastSequence:e.streamLastSequence,streamMessageId:e.streamMessageId,streamPartData:e.streamPartData,toolDisplayName:e.toolDisplayName,isToolCallFailedIndicator:e.isToolCallFailedIndicator}}applyToolCallMirrorEventToLiveConsole(e){let t=e.parsed,s=t.toolCallId,n=typeof e.ev.timestamp=="string"&&e.ev.timestamp.length?e.ev.timestamp:new Date().toISOString(),o=e.ev.data??{};if(t.sessionUpdate==="tool_call"){let r=u.listKeyStart(s);if(this.consoleMessages_$().some(h=>h.listKey===r))return!0;let l=c.toolCallDisplayName(t),d=c.buildToolCallBodyText({displayName:l,parsed:t});return this.pushConsoleMessage({listKey:r,type:"tool",text:d,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call",toolDisplayName:l}),!0}if(t.sessionUpdate==="tool_call_update"&&t.status==="in_progress"){t.rawInput!==void 0&&this.patchLiveToolCallStartInput({toolCallId:s,parsed:t});let r=u.listKeyProgress(s),a="in_progress",l=this.consoleMessages_$(),d=l.findIndex(p=>p.listKey===r),h=this.materializeConsoleLineFromPushParams({listKey:r,type:"status-update",text:a,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"});if(d>=0){let p=[...l];p[d]=h,this.consoleMessages_$.set(p)}else this.consoleMessages_$.set([...l,h]);return!0}if(t.sessionUpdate==="tool_call_update"&&t.status==="completed"){if(u.hasRawOutputError(t.rawOutput)){let d=u.listKeyError(s);if(!this.consoleMessages_$().some(p=>p.listKey===d)){let p=u.summarizeRawOutputError(t.rawOutput);this.pushConsoleMessage({listKey:d,type:"error",text:p,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"}),this.patchLiveConsoleToolCallStartFailed({toolCallId:s})}return!0}let a=u.listKeyResult(s);if(!this.consoleMessages_$().some(d=>d.listKey===a)){let d=u.summarizeRawOutputSuccess(t.rawOutput);this.pushConsoleMessage({listKey:a,type:"tool-result",text:d,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"})}return!0}return!1}tryFoldToolCallMirrorEventIntoOut(e,t){if(t.eventType!=="ca-session-update")return!1;let s=u.tryParseMirrorData(t.data??{});if(s===null)return!1;let n=typeof t.timestamp=="string"&&t.timestamp.length?t.timestamp:new Date().toISOString(),o=t.data??{};if(s.sessionUpdate==="tool_call"){let r=u.listKeyStart(s.toolCallId);if(!e.some(l=>l.listKey===r)){let l=c.toolCallDisplayName(s),d=c.buildToolCallBodyText({displayName:l,parsed:s});e.push(this.materializeConsoleLineFromPushParams({listKey:r,type:"tool",text:d,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call",toolDisplayName:l}))}return!0}if(s.sessionUpdate==="tool_call_update"&&s.status==="in_progress"){s.rawInput!==void 0&&c.patchOutArrayToolCallStartInput(e,s);let r=u.listKeyProgress(s.toolCallId),a=this.materializeConsoleLineFromPushParams({listKey:r,type:"status-update",text:"in_progress",timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"}),l=e.findIndex(d=>d.listKey===r);return l>=0?e[l]=a:e.push(a),!0}if(s.sessionUpdate==="tool_call_update"&&s.status==="completed"){if(u.hasRawOutputError(s.rawOutput)){let d=u.listKeyError(s.toolCallId);if(!e.some(p=>p.listKey===d)){let p=u.summarizeRawOutputError(s.rawOutput);e.push(this.materializeConsoleLineFromPushParams({listKey:d,type:"error",text:p,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"})),c.patchOutArrayToolCallStartFailed(e,s.toolCallId)}return!0}let a=u.listKeyResult(s.toolCallId);if(!e.some(d=>d.listKey===a)){let d=u.summarizeRawOutputSuccess(s.rawOutput);e.push(this.materializeConsoleLineFromPushParams({listKey:a,type:"tool-result",text:d,timestamp:n,rawData:o,mirrorEventType:"ca-session-update",briefSubtype:"tool_call_update"}))}return!0}return!1}patchLiveToolCallStartInput(e){let t=u.listKeyStart(e.toolCallId),s=this.consoleMessages_$(),n=s.findIndex(l=>l.listKey===t);if(n<0)return;let o=s[n].toolDisplayName??"Tool call",r=c.buildToolCallBodyText({displayName:o,parsed:e.parsed}),a=[...s];a[n]=b(S({},a[n]),{text:r}),this.consoleMessages_$.set(a)}patchLiveConsoleToolCallStartFailed(e){let t=u.listKeyStart(e.toolCallId),s=this.consoleMessages_$(),n=s.findIndex(r=>r.listKey===t);if(n<0)return;let o=[...s];o[n]=b(S({},o[n]),{isToolCallFailedIndicator:!0}),this.consoleMessages_$.set(o)}static patchOutArrayToolCallStartFailed(e,t){let s=u.listKeyStart(t),n=e.findIndex(o=>o.listKey===s);n<0||(e[n]=b(S({},e[n]),{isToolCallFailedIndicator:!0}))}static patchOutArrayToolCallStartInput(e,t){let s=u.listKeyStart(t.toolCallId),n=e.findIndex(a=>a.listKey===s);if(n<0)return;let o=e[n].toolDisplayName??"Tool call",r=c.buildToolCallBodyText({displayName:o,parsed:t});e[n]=b(S({},e[n]),{text:r})}static toolCallDisplayName(e){return e.title!==void 0&&e.title.length?e.title:e.toolKind!==void 0&&e.toolKind.length?e.toolKind:"Tool call"}static buildToolCallBodyText(e){let t=[e.displayName],s=u.formatRawInput(e.parsed.rawInput);s.length&&t.push(s);let n=u.formatLocations(e.parsed.locations);return n.length&&t.push(`[locations]
|
|
6
6
|
${n}`),t.join(`
|
|
7
7
|
`)}runOpenSessionPollTick(e){return f(this,null,function*(){if(!(e!==this.activeSessionId_$()||e!==this.openSessionPollTargetId))try{let t=yield this.caSession_AS.getSession(e);this.ngZone.run(()=>{e===this.activeSessionId_$()&&this.selectedSession_$.set(this.mapSessionRecord(this.toRecord(t.session)))});let s=this.lastKnownEventSequence,o=(yield this.caSession_AS.getSessionEvents({sessionId:e,sinceSequence:s>=0?s:void 0,limit:200})).events.map(r=>({sessionId:typeof r.sessionId=="string"?r.sessionId:e,eventType:typeof r.eventType=="string"?r.eventType:"",timestamp:typeof r.timestamp=="string"?r.timestamp:"",data:this.asRecord(r.data),sequence:typeof r.sequence=="number"?r.sequence:0}));if(!o.length)return;this.ngZone.run(()=>{if(e!==this.activeSessionId_$())return;let r=new Map;for(let l of this.selectedSessionEvents_$())r.set(l.sequence??0,l);for(let l of o)r.set(l.sequence??0,l);let a=[...r.values()].sort(M.compareMirrorEventsAsc);this.selectedSessionEvents_$.set(a);for(let l of o)(l.sequence??0)>s&&this.appendConsoleMirrorEventOne(l);this.lastKnownEventSequence=Math.max(s,...o.map(l=>l.sequence??0))})}catch{}})}handleSocketEvent(e){let t=e.event,s=e.payload;try{this.ngZone.run(()=>{switch(t){case"ca-session:status":this.handleStatusUpdate(s);break;case"ca-session:output":this.handleOutputChunk(s);break;case"ca-session:event":this.handleSessionEvent(s);break;case"ca-session:list-update":this.loadSessions().catch(()=>{});break;case"ext-session-msg:message":this.handleAssembledMessage(s);break;case"ext-session-msg:update":this.handleAssembledMessageUpdate(s);break;default:break}})}catch(n){v.DyFM_Log.error(`CCAP_CaSession_DS | socket error | ${t}`,n)}}handleStatusUpdate(e){let t=typeof e.sessionId=="string"?e.sessionId:"",s=typeof e.status=="string"?e.status:"",n=typeof e.statusMessage=="string"?e.statusMessage:void 0;this.lastStatusUpdate_$.set({sessionId:t,status:s,statusMessage:n});let o=this.sessions_$();this.sessions_$.set(o.map(a=>a.sessionId===t?b(S({},a),{status:s,statusMessage:n}):a));let r=this.selectedSession_$();r?.sessionId===t&&this.selectedSession_$.set(b(S({},r),{status:s,statusMessage:n})),s==="errored"&&this.globalError_CS.showError(new Error(n?`CA session error: ${n}`:"CA session errored"),"ca-session-status")}handleOutputChunk(e){let t=typeof e.sessionId=="string"?e.sessionId:"";if(t&&t!==this.activeSessionId_$())return;let s=typeof e.content=="string"?e.content:"",n=typeof e.type=="string"?e.type:"response";if(s){let o={};for(let r of Object.keys(e))o[r]=Reflect.get(e,r);this.pushConsoleMessage({type:n==="error"?"error":"assistant",text:s,rawData:o,mirrorEventType:"ca-session:output"})}}handleSessionEvent(e){let t=typeof e.sessionId=="string"?e.sessionId:"";if(t&&t!==this.activeSessionId_$())return;let s=this.asRecord(e.event),n=typeof s.sequence=="number"?s.sequence:0;if(n<=this.lastKnownEventSequence)return;this.lastKnownEventSequence=n;let o=s.timestamp,r={sessionId:t,eventType:typeof s.eventType=="string"?s.eventType:"",timestamp:typeof o=="string"&&o.length?o:new Date().toISOString(),data:this.asRecord(s.data),sequence:n},a=this.selectedSessionEvents_$();this.selectedSessionEvents_$.set([...a,r]),this.appendConsoleMirrorEventOne(r)}seedConsoleFromMirrorEvents(e){this.pendingOptimisticPrompts.length=0;let t=[...e].sort(M.compareMirrorEventsAsc);this.consoleMessages_$.set(this.buildFoldedConsoleMessagesFromMirrorEvents(t))}removePendingOptimisticPromptBubbleIfTextMatchesMirror(e){let t=this.pendingOptimisticPrompts.findIndex(o=>o.text===e||o.text.trim()===e.trim());if(t<0)return;let s=this.pendingOptimisticPrompts[t];this.pendingOptimisticPrompts.splice(t,1);let n=this.consoleMessages_$().filter(o=>o.listKey!==s.listKey);this.consoleMessages_$.set(n)}mapSessionRecord(e){return{sessionId:typeof e.sessionId=="string"?e.sessionId:void 0,acpSessionId:typeof e.acpSessionId=="string"?e.acpSessionId:void 0,label:typeof e.label=="string"?e.label:void 0,workspacePath:typeof e.workspacePath=="string"?e.workspacePath:void 0,status:typeof e.status=="string"?e.status:void 0,statusMessage:typeof e.statusMessage=="string"?e.statusMessage:void 0,promptCount:typeof e.promptCount=="number"?e.promptCount:void 0,lastPrompt:typeof e.lastPrompt=="string"?e.lastPrompt:void 0,lastActivityAt:typeof e.lastActivityAt=="string"?e.lastActivityAt:void 0,isArchived:e.isArchived===!0,parentSessionId:typeof e.parentSessionId=="string"?e.parentSessionId:void 0,lastSyncAt:typeof e.lastSyncAt=="string"?e.lastSyncAt:void 0,lastSyncError:typeof e.lastSyncError=="string"?e.lastSyncError:void 0,agentInfoName:typeof e.agentInfoName=="string"?e.agentInfoName:void 0,agentInfoVersion:typeof e.agentInfoVersion=="string"?e.agentInfoVersion:void 0,isAcpConnected:typeof e.isAcpConnected=="boolean"?e.isAcpConnected:void 0,loadSessionSupported:typeof e.loadSessionSupported=="boolean"?e.loadSessionSupported:void 0,isTerminalMode:typeof e.isTerminalMode=="boolean"?e.isTerminalMode:void 0,isTerminalRunnerConnected:typeof e.isTerminalRunnerConnected=="boolean"?e.isTerminalRunnerConnected:void 0}}asRecord(e){return this.toRecord(e)}toRecord(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t={};for(let s of Object.keys(e))t[s]=Reflect.get(e,s);return t}return{}}loadAssembledMessages(e){return f(this,null,function*(){try{let t=yield this.extSessionMsg_AS.getMessages({sessionId:e.sessionId,latest:!0});this.assembledMessages_$.set(t.messages),this.assembledMessagesHasMore_$.set(t.hasMore===!0)}catch(t){v.DyFM_Log.error(`CCAP_CaSession_DS | loadAssembledMessages failed | sessionId: ${e.sessionId}`,t)}})}loadOlderAssembledMessages(e){return f(this,null,function*(){if(this.isLoadingOlderMessages_$()||!this.assembledMessagesHasMore_$())return;let t=this.assembledMessages_$();if(!t.length)return;let s=t.reduce((n,o)=>(o.sequence??0)<n?o.sequence??0:n,t[0].sequence??0);this.isLoadingOlderMessages_$.set(!0);try{let n=yield this.extSessionMsg_AS.getMessages({sessionId:e.sessionId,beforeSequence:s,limit:e.limit??50});n.messages.length&&this.assembledMessages_$.set([...n.messages,...t]),this.assembledMessagesHasMore_$.set(n.hasMore===!0)}catch(n){v.DyFM_Log.error(`CCAP_CaSession_DS | loadOlderAssembledMessages failed | sessionId: ${e.sessionId}`,n)}finally{this.isLoadingOlderMessages_$.set(!1)}})}handleAssembledMessage(e){let t=typeof e.sessionId=="string"?e.sessionId:"";if(!t||t!==this.activeSessionId_$())return;let s=e.message;if(!s||typeof s!="object")return;let n=s,o=this.assembledMessages_$();this.assembledMessages_$.set([...o,n])}handleAssembledMessageUpdate(e){let t=typeof e.sessionId=="string"?e.sessionId:"";if(!t||t!==this.activeSessionId_$())return;let s=typeof e.messageKey=="string"?e.messageKey:"";if(!s)return;let n=e.update;if(!n||typeof n!="object")return;let o=n,r=this.assembledMessages_$(),a=r.findIndex(h=>h.messageKey===s);if(a<0)return;let l=S({},r[a]);typeof o.bodyText=="string"&&(l.bodyText=o.bodyText),o.toolResult!==void 0&&(l.toolResult=o.toolResult),typeof o.toolStatus=="string"&&(l.toolStatus=o.toolStatus),o.headerStatusDot!==void 0&&(l.headerStatusDot=typeof o.headerStatusDot=="string"?o.headerStatusDot:void 0);let d=[...r];d[a]=l,this.assembledMessages_$.set(d)}static \u0275fac=function(t){return new(t||c)};static \u0275prov=E({token:c,factory:c.\u0275fac,providedIn:"root"})}return c})();export{M as a,C as b,x as c,u as d,fe as e};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-QMT4EYEY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as l}from"./chunk-ZNCU4N2R.js";import{N as p}from"./chunk-5IGMWTXT.js";import{C as i,aa as n,k as o,y as c}from"./chunk-TBMJSIBB.js";var d=(()=>{class a{settingsGeneral_DS=i(p);pm_AS=i(l);workspacePathPickerOptions_$=n([]);refreshWorkspacePathPickerOptions(){return o(this,null,function*(){yield this.settingsGeneral_DS.loadDefaultWorkspacePath();let t=this.settingsGeneral_DS.defaultWorkspacePath_$().trim(),e=[];t&&e.push({label:"Default Workspace",path:t}),this.workspacePathPickerOptions_$.set(e);try{let f=(yield this.pm_AS.listProjects()).projects.filter(s=>!!s.localPath&&!!s.isActive).map(s=>({label:s.name||"Unnamed Project",path:s.localPath??""})),r=[];t&&r.push({label:"Default Workspace",path:t}),r.push(...f),this.workspacePathPickerOptions_$.set(r)}catch{}})}resolveInitialWorkspacePath(t){let e=this.settingsGeneral_DS.defaultWorkspacePath_$().trim();return t.lastWorkspacePath.trim()||e}static \u0275fac=function(e){return new(e||a)};static \u0275prov=c({token:a,factory:a.\u0275fac,providedIn:"root"})}return a})();export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QVUTIP6O.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as S}from"./chunk-LD2DR5AV.js";import{I as m}from"./chunk-5IGMWTXT.js";import{C as d,d as l,p as n,vb as r,xb as I,y as f}from"./chunk-TBMJSIBB.js";var P=(()=>{class i{baseUrl=`${m.api.baseUrl}/cc-session`;http=d(I);peiContext_DS=d(S);currentCcapId(){return this.peiContext_DS.activeCcapId_$()}withCcapId(t){let e=this.currentCcapId();return e?t.set("ccapId",e):t}createSession(t){let e=this.withCcapId(new r);return n(this.http.post(this.baseUrl,t,{params:e}))}listSessions(t){let e=this.withCcapId(new r);return t?.status&&(e=e.set("status",t.status)),t?.workspacePath&&(e=e.set("workspacePath",t.workspacePath)),t?.includeArchived&&(e=e.set("includeArchived","1")),t?.limit!=null&&(e=e.set("limit",String(t.limit))),t?.offset!=null&&(e=e.set("offset",String(t.offset))),n(this.http.get(this.baseUrl,{params:e}))}getSession(t){let e=this.withCcapId(new r);return n(this.http.get(`${this.baseUrl}/${t.sessionId}`,{params:e}))}sendPrompt(t){let e={content:t.content};t.attachments?.length&&(e.attachments=t.attachments);let s=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/prompt`,e,{params:s}))}resumeSession(t){let e=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/resume`,{},{params:e}))}forkSession(t){let e={};t.label&&(e.label=t.label);let s=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/fork`,e,{params:s}))}stopExecution(t){let e=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/stop-execution`,{},{params:e}))}terminateSession(t){let e=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/terminate`,{},{params:e}))}restartRunner(t){let e=this.withCcapId(new r);return n(this.http.post(`${this.baseUrl}/${t.sessionId}/runner-restart`,{},{params:e}))}updateSessionConfig(t){let a=t,{sessionId:e}=a,s=l(a,["sessionId"]),o=this.withCcapId(new r);return n(this.http.patch(`${this.baseUrl}/${e}/config`,s,{params:o}))}setSessionArchived(t){let e=this.withCcapId(new r);return n(this.http.patch(`${this.baseUrl}/${t.sessionId}/archive`,{isArchived:t.isArchived},{params:e}))}getSessionEvents(t){let e=this.withCcapId(new r);return t.eventType&&(e=e.set("eventType",t.eventType)),t.since&&(e=e.set("since",t.since)),t.sinceSequence!=null&&(e=e.set("sinceSequence",String(t.sinceSequence))),t.limit!=null&&(e=e.set("limit",String(t.limit))),t.offset!=null&&(e=e.set("offset",String(t.offset))),t.latest&&(e=e.set("latest","1")),n(this.http.get(`${this.baseUrl}/${t.sessionId}/events`,{params:e}))}getRateLimitState(t){let e=new r;return n(this.http.get(`${this.baseUrl}/rate-limit-state/${encodeURIComponent(t.ccapId)}`,{params:e}))}getDiagnostic(t){return n(this.http.get(`${this.baseUrl}/${encodeURIComponent(t.sessionId)}/diagnostic`))}getSessionEventStreamUrl(t){let e=`${this.baseUrl}/${t.sessionId}/events/stream`,s=this.currentCcapId();return s?`${e}?ccapId=${encodeURIComponent(s)}`:e}static \u0275fac=function(e){return new(e||i)};static \u0275prov=f({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var y=(()=>{class i{static DEFAULT_SURPASSED_THRESHOLD=.8;static mapServerItemsToClientInfo(t){if(!t||!Array.isArray(t)||t.length===0)return null;let e=t.filter(u=>typeof u?.rateLimitType=="string"&&u.rateLimitType.length>0);if(e.length===0)return null;let s=i.pickMostRelevantItem(e),o=typeof s.utilization=="number"?Math.max(0,Math.min(1,s.utilization)):0,a=typeof s.resetsAtMs=="number"&&s.resetsAtMs>0?s.resetsAtMs:0,c=a>0?Math.floor(a/1e3):0,h=i.mapStatus(s.lastObservedStatus),p=i.readObservedAtIso(s.observedAt);return{status:h,resetsAt:c,rateLimitType:s.rateLimitType??"",utilization:o,surpassedThreshold:i.DEFAULT_SURPASSED_THRESHOLD,isUsingOverage:!1,receivedAt:p}}static pickMostRelevantItem(t){let e=o=>o==="reached"?2:o==="approaching"?1:0;return[...t].sort((o,a)=>{let c=e(a.lastObservedStatus)-e(o.lastObservedStatus);if(c!==0)return c;let h=(a.utilization??0)-(o.utilization??0);if(Math.abs(h)>1e-4)return h>0?1:-1;let p=i.readObservedAtMs(o.observedAt);return i.readObservedAtMs(a.observedAt)-p})[0]}static mapStatus(t){return t==="reached"?"limited":t==="approaching"?"allowed_warning":"allowed"}static readObservedAtMs(t){if(!t)return 0;if(t instanceof Date)return t.getTime();let e=Date.parse(t);return isNaN(e)?0:e}static readObservedAtIso(t){if(!t)return new Date().toISOString();if(t instanceof Date)return t.toISOString();let e=Date.parse(t);return isNaN(e)?new Date().toISOString():new Date(e).toISOString()}}return i})();export{P as a,y as b};
|
|
2
|
+
//# sourceMappingURL=chunk-RMXLLPRL.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{e as ct}from"./chunk-XL2IMPJH.js";import{j as rt}from"./chunk-3OAVFWVG.js";import{I as st}from"./chunk-5IGMWTXT.js";import{$a as K,C as w,D as Z,Fa as u,Ga as G,Ha as S,J as V,K as L,L as E,M as q,Pa as B,Qa as W,R as J,Ra as U,Ta as tt,Ua as et,Z as o,aa as C,bb as N,da as y,fa as v,ga as O,ha as R,hb as nt,ia as A,ja as T,jb as j,k as p,la as g,na as Q,oa as k,p as f,pa as D,pb as it,qa as s,ra as a,sa as $,ua as P,ub as ot,va as F,wa as d,xb as at,y as H}from"./chunk-TBMJSIBB.js";var ut=(()=>{class n{baseUrl=`${st.api.baseUrl}/cc-account`;http=w(at);listAccounts(){return f(this.http.get(`${this.baseUrl}/list`))}listAccountsByIdentity(){return f(this.http.get(`${this.baseUrl}/list-by-identity`))}backfillIdentity(){return f(this.http.post(`${this.baseUrl}/backfill-identity`,{}))}auditIdentityDuplicates(){return f(this.http.get(`${this.baseUrl}/identity-audit`))}refreshLocalAccounts(){return f(this.http.post(`${this.baseUrl}/refresh`,{}))}getInstanceMapping(){return f(this.http.get(`${this.baseUrl}/instance-mapping`))}getAccount(t){return f(this.http.get(`${this.baseUrl}/${t}`))}getAccountUsage(t){return f(this.http.get(`${this.baseUrl}/${t}/usage`))}getAccountUsageHistory(t){let e=[];t.windowType!=null&&t.windowType!==""&&e.push(`windowType=${encodeURIComponent(t.windowType)}`),t.fromMs!=null&&e.push(`fromMs=${t.fromMs}`),t.toMs!=null&&e.push(`toMs=${t.toMs}`);let i=e.length>0?`?${e.join("&")}`:"";return f(this.http.get(`${this.baseUrl}/${t.accountKey}/usage-history${i}`))}refreshAccountUsage(t){return f(this.http.post(`${this.baseUrl}/${t}/refresh-usage`,{}))}renameAccount(t){let e={};return t.displayName!==void 0&&(e.displayName=t.displayName),t.email!==void 0&&(e.email=t.email),f(this.http.patch(`${this.baseUrl}/${t.accountKey}`,e))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=H({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var _t="cc:account-usage-update",ht="cc:account-list-update",dt=(()=>{class n{account_AS=w(ut);socket_CS=w(ct);globalError_CS=w(rt);ngZone=w(J);socketSubscription=null;accounts_$=C([]);accountUsageMap_$=C(new Map);instanceMapping_$=C(null);usageHistoryMap_$=C(new Map);identityGroups_$=C([]);isLoading_$=C(!1);loadError_$=C(null);loadDashboardBootstrap(){return p(this,null,function*(){this.isLoading_$.set(!0),this.loadError_$.set(null);let t=!1;try{let[e,i,r]=yield Promise.all([this.account_AS.listAccounts(),this.account_AS.getInstanceMapping(),this.account_AS.listAccountsByIdentity()]);this.accounts_$.set(e.items),this.instanceMapping_$.set(i),this.identityGroups_$.set(r.groups);let _=new Map(this.accountUsageMap_$());for(let x of r.groups)_.set(x.primary.accountKey,x.mergedUsage);this.accountUsageMap_$.set(_)}catch(e){t=!0,this.loadError_$.set(this.errorMessageOf(e)),this.globalError_CS.showError(e,"cc-account-dashboard-bootstrap")}finally{this.isLoading_$.set(!1)}})}loadIdentityGroups(){return p(this,null,function*(){try{let t=yield this.account_AS.listAccountsByIdentity();this.identityGroups_$.set(t.groups);let e=new Map(this.accountUsageMap_$());for(let i of t.groups)e.set(i.primary.accountKey,i.mergedUsage);this.accountUsageMap_$.set(e)}catch(t){this.loadError_$.set(this.errorMessageOf(t)),this.globalError_CS.showError(t,"cc-account-load-identity-groups")}})}loadAccounts(){return p(this,null,function*(){try{let t=yield this.account_AS.listAccounts();this.accounts_$.set(t.items)}catch(t){this.loadError_$.set(this.errorMessageOf(t)),this.globalError_CS.showError(t,"cc-account-load-accounts")}})}loadAccountUsage(t){return p(this,null,function*(){try{let e=yield this.account_AS.getAccountUsage(t),i=new Map(this.accountUsageMap_$());i.set(t,e.items),this.accountUsageMap_$.set(i)}catch(e){this.loadError_$.set(this.errorMessageOf(e)),this.globalError_CS.showError(e,`cc-account-load-usage[${t}]`)}})}loadAccountUsageHistory(t){return p(this,null,function*(){try{let e=yield this.account_AS.getAccountUsageHistory(t),i=new Map(this.usageHistoryMap_$());i.set(t.accountKey,e.items),this.usageHistoryMap_$.set(i)}catch(e){this.loadError_$.set(this.errorMessageOf(e)),this.globalError_CS.showError(e,`cc-account-load-history[${t.accountKey}]`)}})}loadInstanceMapping(){return p(this,null,function*(){try{let t=yield this.account_AS.getInstanceMapping();this.instanceMapping_$.set(t)}catch(t){this.loadError_$.set(this.errorMessageOf(t)),this.globalError_CS.showError(t,"cc-account-load-instance-mapping")}})}refreshAccounts(){return p(this,null,function*(){this.isLoading_$.set(!0),this.loadError_$.set(null);try{let t=yield this.account_AS.refreshLocalAccounts();return yield this.loadAccounts(),yield this.loadIdentityGroups(),t}catch(t){return this.loadError_$.set(this.errorMessageOf(t)),this.globalError_CS.showError(t,"cc-account-refresh-accounts"),{refreshedKeys:[],scannedPaths:0}}finally{this.isLoading_$.set(!1)}})}refreshAccountUsage(t){return p(this,null,function*(){try{let e=yield this.account_AS.refreshAccountUsage(t);return e.status!=="ok"&&this.surfacePullError({source:"cc-account-pull",accountKey:t,status:e.status,httpStatus:e.httpStatus,bodyHead:e.bodyHead,attemptedUrl:e.attemptedUrl,networkMessage:e.networkMessage}),yield this.loadAccountUsage(t),yield this.loadAccounts(),yield this.loadIdentityGroups(),e}catch(e){return this.loadError_$.set(this.errorMessageOf(e)),this.globalError_CS.showError(e,`cc-account-pull[${t}]`),{status:"error",windowsUpserted:0,email:null}}})}surfacePullError(t){let e=[];e.push(`CC Account pull failed (status=${t.status})`),e.push(`accountKey: ${t.accountKey}`),t.httpStatus!=null&&e.push(`httpStatus: ${t.httpStatus}`),t.attemptedUrl!=null&&t.attemptedUrl!==""&&e.push(`attemptedUrl: ${t.attemptedUrl}`),t.networkMessage!=null&&t.networkMessage!==""&&e.push(`networkMessage: ${t.networkMessage}`),t.bodyHead!=null&&t.bodyHead!==""&&e.push(`responseBodyHead: ${t.bodyHead}`);let i=e.join(`
|
|
2
|
+
`),r=new Error(i);r.errorDetails={message:i,errorCode:`CCAP-CC-ACCOUNT-PULL-${t.status.toUpperCase()}`,additionalContent:t},this.loadError_$.set(i),this.globalError_CS.showError(r,t.source)}renameAccount(t){return p(this,null,function*(){try{let e=yield this.account_AS.renameAccount(t),i=this.accounts_$().map(r=>r.accountKey===t.accountKey?e:r);this.accounts_$.set(i),yield this.loadIdentityGroups()}catch(e){this.loadError_$.set(this.errorMessageOf(e)),this.globalError_CS.showError(e,`cc-account-rename[${t.accountKey}]`)}})}startLiveUpdates(){this.socketSubscription==null&&(this.socketSubscription=this.socket_CS.event$.subscribe(t=>{this.ngZone.run(()=>{t.event===_t?this.handleAccountUsageUpdate(t.payload):t.event===ht&&this.handleAccountListUpdate(t.payload)})}))}stopLiveUpdates(){this.socketSubscription!=null&&(this.socketSubscription.unsubscribe(),this.socketSubscription=null)}ngOnDestroy(){this.stopLiveUpdates()}handleAccountUsageUpdate(t){let e=t.accountKey,i=t.windowType;if(typeof e!="string"||e===""||typeof i!="string")return;let r={accountKey:e,windowType:i,utilization:typeof t.utilization=="number"?t.utilization:void 0,resetsAtMs:typeof t.resetsAtMs=="number"?t.resetsAtMs:void 0,lastObservedStatus:typeof t.lastObservedStatus=="string"?t.lastObservedStatus:void 0,observedAt:typeof t.observedAt=="string"?t.observedAt:void 0,lastObservedByCcapId:typeof t.lastObservedByCcapId=="string"?t.lastObservedByCcapId:void 0,lastObservedBySessionId:typeof t.lastObservedBySessionId=="string"?t.lastObservedBySessionId:void 0},_=new Map(this.accountUsageMap_$()),l=(_.get(e)??[]).filter(m=>m.windowType!==i);l.push(r),_.set(e,l),this.accountUsageMap_$.set(_)}handleAccountListUpdate(t){this.loadAccounts(),this.loadIdentityGroups()}errorMessageOf(t){if(t instanceof Error)return t.message;if(typeof t=="object"&&t!==null){let e=t;if(typeof e.message=="string")return e.message}return String(t)}static \u0275fac=function(e){return new(e||n)};static \u0275prov=H({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var M=(()=>{class n{static CHART_WIDTH=100;static CHART_HEIGHT=40;static COLOR_MAP={five_hour:"#10b981",seven_day:"#06b6d4",seven_day_opus:"#a855f7",seven_day_sonnet:"#f59e0b",extra_usage:"#f43f5e"};static WINDOW_LABEL_MAP={five_hour:"5h",seven_day:"Weekly",seven_day_opus:"Opus",seven_day_sonnet:"Sonnet",extra_usage:"Extra"};static WINDOW_ORDER=["five_hour","seven_day","seven_day_opus","seven_day_sonnet","extra_usage"];static buildChart(t){let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=0;for(let l of t){if(typeof l.observedAt!="string"||l.observedAt===""||typeof l.utilization!="number"||!isFinite(l.utilization))continue;let m=Date.parse(l.observedAt);isFinite(m)&&(m<e&&(e=m),m>i&&(i=m),r++)}if(r===0)return{lines:n.WINDOW_ORDER.map(l=>({windowType:l,label:n.WINDOW_LABEL_MAP[l]??l,colorHex:n.COLOR_MAP[l]??"#9ca3af",pathPoints:"",hasData:!1,pointCount:0,lastX:0,lastY:0})),hasAnyData:!1,minTimeMs:0,maxTimeMs:0};i-e<1&&(i=e+36e5);let _=i-e,x=n.WINDOW_ORDER.map(l=>{let m=[];for(let h of t){if(h.windowType!==l||typeof h.observedAt!="string"||h.observedAt===""||typeof h.utilization!="number"||!isFinite(h.utilization))continue;let b=Date.parse(h.observedAt);isFinite(b)&&m.push({t:b,u:Math.max(0,Math.min(1,h.utilization))})}m.sort((h,b)=>h.t-b.t);let I=[],z=0,Y=0;for(let h of m){let b=(h.t-e)/_*n.CHART_WIDTH,X=n.CHART_HEIGHT-h.u*n.CHART_HEIGHT;I.push(`${b.toFixed(2)},${X.toFixed(2)}`),z=b,Y=X}return{windowType:l,label:n.WINDOW_LABEL_MAP[l]??l,colorHex:n.COLOR_MAP[l]??"#9ca3af",pathPoints:I.join(" "),hasData:I.length>0,pointCount:I.length,lastX:z,lastY:Y}});return{lines:x,hasAnyData:x.some(l=>l.hasData),minTimeMs:e,maxTimeMs:i}}}return n})();var pt=(n,c)=>c.windowType,ft=()=>["five_hour","seven_day","seven_day_opus","seven_day_sonnet","extra_usage"];function mt(n,c){if(n&1&&$(0,"div"),n&2){d();let t=U(0),e=d();T("h-full transition-all "+e.utilizationBarColorClass(t.utilization)),R("width",e.utilizationPercent(t.utilization),"%")}}function gt(n,c){if(n&1&&(B(0),s(1,"div")(2,"div",4),u(3),a(),s(4,"div",5)(5,"div"),y(6,mt,1,4,"div",6),a(),s(7,"span",7),u(8),a()(),s(9,"div",8),u(10),a()()),n&2){let t,e=c.$implicit,i=d(),r=W(i.usageItemOfWindow(e));o(),T(i.compact?"grid grid-cols-[90px_1fr_56px] items-center gap-2 text-[10px]":"grid grid-cols-[110px_1fr_64px] items-center gap-2 text-[11px]"),A("opacity-50",!r),o(),O("title",e),o(),S(" ",i.windowLabelOf(e)," "),o(2),T(i.compact?"flex-1 h-1.5 bg-neutral-800 rounded-full overflow-hidden":"flex-1 h-2 bg-neutral-800 rounded-full overflow-hidden"),o(),g(r?6:-1),o(),T(i.compact?"w-8 text-[10px]":"w-9"),o(),S(" ",i.formatUtilization((t=r==null?null:r.utilization)!==null&&t!==void 0?t:null)," "),o(),O("title","Resets in "+i.formatResetCountdown(r==null?null:r.resetsAtMs)),o(),S(" ",i.formatResetCountdown(r==null?null:r.resetsAtMs)," ")}}function Ct(n,c){n&1&&(s(0,"div",2),u(1," No data yet \u2014 click "),s(2,"strong",9),u(3,"Pull"),a(),u(4," or wait for the next rate-limit event. "),a())}function yt(n,c){n&1&&(s(0,"div",14),u(1," No graph data yet \u2014 pull usage or wait for a CC session rate-limit event. "),a())}function xt(n,c){if(n&1&&(E(),$(0,"circle",25)),n&2){let t=d(2).$implicit;v("cx",t.lastX)("cy",t.lastY)("fill",t.colorHex)}}function wt(n,c){if(n&1&&(E(),$(0,"polyline",26)(1,"circle",27)),n&2){let t=d(2).$implicit;v("points",t.pathPoints)("stroke",t.colorHex),o(),v("cx",t.lastX)("cy",t.lastY)("fill",t.colorHex)}}function vt(n,c){if(n&1&&y(0,xt,1,3,":svg:circle",25)(1,wt,2,5),n&2){let t=d().$implicit;g(t.pointCount===1?0:1)}}function bt(n,c){if(n&1&&y(0,vt,2,1),n&2){let t=c.$implicit;g(t.hasData?0:-1)}}function At(n,c){if(n&1&&(s(0,"span",31),u(1,"\xB7"),a(),s(2,"span",32),u(3),a()),n&2){let t=d().$implicit,e=d(4);o(3),S(" ",((e.chartH-t.lastY)/e.chartH*100).toFixed(0),"% ")}}function $t(n,c){if(n&1&&(s(0,"div",28),$(1,"span",29),s(2,"span",30),u(3),a(),y(4,At,4,1),a()),n&2){let t=c.$implicit;A("opacity-40",!t.hasData),o(),R("background-color",t.colorHex),o(2),G(t.label),o(),g(t.hasData?4:-1)}}function Mt(n,c){if(n&1&&(s(0,"span"),u(1),K(2,"date"),a()),n&2){d(2);let t=U(0);o(),G(N(2,1,t.minTimeMs,"yyyy-MM-dd HH:mm"))}}function St(n,c){n&1&&(s(0,"span"),u(1,"\u2014"),a())}function Et(n,c){if(n&1&&(s(0,"span"),u(1),K(2,"date"),a()),n&2){d(2);let t=U(0);o(),G(N(2,1,t.maxTimeMs,"yyyy-MM-dd HH:mm"))}}function Tt(n,c){n&1&&(s(0,"span"),u(1,"\u2014"),a())}function Ut(n,c){if(n&1){let t=P();s(0,"div",15),E(),s(1,"svg",16),$(2,"line",17)(3,"line",18)(4,"line",19),k(5,bt,1,1,null,null,pt),a(),q(),s(7,"div",20)(8,"span"),u(9,"100%"),a(),s(10,"span"),u(11,"50%"),a(),s(12,"span"),u(13,"0%"),a()()(),s(14,"div",21),k(15,$t,5,6,"div",22,pt),a(),s(17,"div",23),y(18,Mt,3,4,"span")(19,St,2,0,"span"),s(20,"button",24),F("click",function(){V(t);let i=d(3);return L(i.handleRefreshGraph())}),u(21," \u21BB Refresh "),a(),y(22,Et,3,4,"span")(23,Tt,2,0,"span"),a()}if(n&2){d();let t=U(0),e=d(2);o(),A("h-24",e.compact)("h-32",!e.compact),v("viewBox",e.chartViewBox),o(),v("y1",e.chartH)("x2",e.chartW)("y2",e.chartH),o(),v("y1",e.chartMidY)("x2",e.chartW)("y2",e.chartMidY),o(),v("x2",e.chartW),o(),D(t.lines),o(10),D(t.lines),o(3),g(t.minTimeMs?18:19),o(4),g(t.maxTimeMs?22:23)}}function It(n,c){if(n&1&&(B(0),s(1,"div",13),y(2,yt,2,0,"div",14)(3,Ut,24,14),a()),n&2){let t=W(d(2).chart_$());o(2),g(t.hasAnyData?3:2)}}function Ht(n,c){if(n&1){let t=P();s(0,"div",3)(1,"button",10),F("click",function(){V(t);let i=d();return L(i.handleToggleGraph())}),E(),s(2,"svg",11),$(3,"path",12),a(),u(4),a(),y(5,It,4,2,"div",13),a()}if(n&2){let t=d();o(),O("title",t.isGraphOpen_$()?"Hide usage graph":"Show usage graph (utilization over time per window)"),o(),A("rotate-90",t.isGraphOpen_$()),o(2),S(" \u{1F4C8} ",t.isGraphOpen_$()?"Hide":"Show"," graph "),o(),g(t.isGraphOpen_$()?5:-1)}}var te=(()=>{class n{account_DS=w(dt);accountKey="";compact=!1;showGraphToggle=!0;initiallyOpenGraph=!1;isGraphOpen_$=C(!1);chart_$=nt(()=>M.buildChart(this.account_DS.usageHistoryMap_$().get(this.accountKey)??[]));chartViewBox=`0 0 ${M.CHART_WIDTH} ${M.CHART_HEIGHT}`;chartW=M.CHART_WIDTH;chartH=M.CHART_HEIGHT;chartMidY=M.CHART_HEIGHT/2;usageEffect=j(()=>{let t=this.accountKey;t&&(this.account_DS.accountUsageMap_$().has(t)||this.account_DS.loadAccountUsage(t))});initialOpenEffect=j(()=>{this.initiallyOpenGraph&&this.isGraphOpen_$.set(!0)});handleToggleGraph(){return p(this,null,function*(){let t=!this.isGraphOpen_$();this.isGraphOpen_$.set(t),t&&!this.account_DS.usageHistoryMap_$().has(this.accountKey)&&(yield this.account_DS.loadAccountUsageHistory({accountKey:this.accountKey}))})}handleRefreshGraph(){return p(this,null,function*(){yield this.account_DS.loadAccountUsageHistory({accountKey:this.accountKey})})}usageItemOfWindow(t){let e=this.account_DS.accountUsageMap_$().get(this.accountKey)??[];for(let i of e)if(i.windowType===t)return i;return null}hasAnyUsageData(){return(this.account_DS.accountUsageMap_$().get(this.accountKey)??[]).length>0}windowLabelOf(t){switch(t){case"five_hour":return"5-hour session";case"seven_day":return"Weekly";case"seven_day_opus":return"Weekly \xB7 Opus";case"seven_day_sonnet":return"Weekly \xB7 Sonnet";case"extra_usage":return"Extra (pay-as-you-go)";default:return t}}utilizationPercent(t){return t==null||!isFinite(t)?0:Math.max(0,Math.min(100,Math.round(t*100)))}formatUtilization(t){return t==null?"\u2014":`${Math.round(t*100)}%`}utilizationBarColorClass(t){return t==null||!isFinite(t)?"bg-neutral-600":t>=.85?"bg-red-500":t>=.5?"bg-amber-500":"bg-emerald-500"}formatResetCountdown(t){if(t==null||!isFinite(t)||t<=0)return"\u2014";let e=t-Date.now();if(e<=0)return"expired";let i=Math.floor(e/6e4),r=Math.floor(i/(60*24)),_=Math.floor(i%(60*24)/60),x=i%60;return r>0?`${r}d ${_}h`:_>0?`${_}h ${x}m`:`${x}m`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Z({type:n,selectors:[["app-cc-account-usage-view"]],inputs:{accountKey:"accountKey",compact:"compact",showGraphToggle:"showGraphToggle",initiallyOpenGraph:"initiallyOpenGraph"},standalone:!0,features:[tt],decls:6,vars:11,consts:[[1,"flex","flex-col"],[3,"class","opacity-50"],[1,"text-[10px]","text-neutral-500","italic","pt-1","border-t","border-neutral-800/40"],[1,"border-t","border-neutral-800/40","pt-2"],[1,"text-neutral-300","font-medium","truncate",3,"title"],[1,"flex","items-center","gap-2","min-w-0"],[3,"class","width"],[1,"font-mono","text-neutral-200","text-right","shrink-0"],[1,"font-mono","text-neutral-500","text-right","text-[10px]","truncate",3,"title"],[1,"text-neutral-400"],["type","button",1,"text-[11px]","text-neutral-400","hover:text-neonCyan","flex","items-center","gap-1","transition-colors",3,"click","title"],["fill","none","stroke","currentColor","viewBox","0 0 24 24","aria-hidden","true",1,"w-3","h-3","transition-transform"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M9 5l7 7-7 7"],[1,"mt-2","rounded-md","border","border-neutral-800","bg-neutral-950/40","p-2"],[1,"text-[11px]","text-neutral-500","italic","px-2","py-3","text-center"],[1,"relative","w-full"],["preserveAspectRatio","none",1,"w-full","block"],["x1","0","stroke","#3f3f46","stroke-width","0.3"],["x1","0","stroke","#3f3f46","stroke-width","0.2","stroke-dasharray","1,1"],["x1","0","y1","0","y2","0","stroke","#3f3f46","stroke-width","0.2","stroke-dasharray","1,1"],[1,"absolute","inset-y-0","left-0","flex","flex-col","justify-between","text-[8px]","text-neutral-600","font-mono","pointer-events-none"],[1,"mt-2","flex","flex-wrap","items-center","gap-2","text-[10px]"],[1,"flex","items-center","gap-1",3,"opacity-40"],[1,"mt-1","flex","items-center","justify-between","text-[9px]","text-neutral-600"],["type","button","title","Re-fetch usage event history for this graph.",1,"text-[10px]","text-neutral-400","hover:text-neonCyan","border","border-neutral-700","hover:border-neonCyan","rounded","px-1.5","py-0.5","transition-colors",3,"click"],["r","0.8"],["fill","none","stroke-width","0.6","stroke-linecap","round","stroke-linejoin","round","vector-effect","non-scaling-stroke"],["r","0.6"],[1,"flex","items-center","gap-1"],[1,"inline-block","w-2","h-2","rounded-sm"],[1,"text-neutral-300"],[1,"text-neutral-500"],[1,"font-mono","text-neutral-400"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"div"),k(2,gt,11,15,"div",1,Q),a(),y(4,Ct,5,0,"div",2)(5,Ht,6,5,"div",3),a()),e&2&&(A("gap-1",i.compact)("gap-2",!i.compact),o(),A("space-y-1",i.compact)("space-y-2",!i.compact),o(),D(et(10,ft)),o(2),g(i.hasAnyUsageData()?-1:4),o(),g(i.showGraphToggle?5:-1))},dependencies:[ot,it],encapsulation:2})}return n})();export{dt as a,te as b};
|
|
3
|
+
//# sourceMappingURL=chunk-S3GEEACD.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["src/app/_modules/external-sessions/_modules/claude-code/_services/cc-account.api-service.ts", "src/app/_modules/external-sessions/_modules/claude-code/_services/cc-account.data-service.ts", "src/app/_modules/external-sessions/_modules/claude-code/_collections/cc-account-usage-chart.util.ts", "src/app/_modules/external-sessions/_modules/claude-code/_components/cc-account-usage-view/cc-account-usage-view.component.ts", "src/app/_modules/external-sessions/_modules/claude-code/_components/cc-account-usage-view/cc-account-usage-view.component.html"],
|
|
4
|
+
"sourcesContent": ["import { inject, Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\n\nimport { firstValueFrom } from 'rxjs';\n\nimport { CC_Account_Response } from '../_models/interfaces/cc-account/cc-account.interface';\nimport { CC_AccountUsageEvent_Response } from '../_models/interfaces/cc-account/cc-account-usage-event.interface';\nimport {\n CC_AccountInstanceMapping_Response,\n CC_AccountUsageState_Response,\n} from '../_models/interfaces/cc-account/cc-account-usage-state.interface';\nimport { CC_AccountIdentityList_Response } from '../_models/interfaces/cc-account/cc-account-identity-group.interface';\nimport { environment } from '../../../../../../environments/environment';\n\n/**\n * CC Account REST API service (REQ-CC-USAGE-DASHBOARD-001 Slice 5 cycle 856).\n *\n * HTTP-bridge a server-oldali `CC_Account_Controller` endpoint-jaihoz\n * (`/cc-account/*`). Egyszerű thin api-service mintán a\n * `cc-cci-instance-data.api-service.ts`-hez hasonlóan: minden hívás\n * `firstValueFrom`-mal Promise-ra fordított `HttpClient` get/post/patch.\n *\n * A Slice 5+ Dashboard komponensek és a Slice 6 instance-mapping view\n * data-service-en keresztül használja.\n */\n@Injectable({ providedIn: 'root' })\nexport class CC_Account_ApiService {\n\n private readonly baseUrl: string = `${environment.api.baseUrl}/cc-account`;\n\n private readonly http: HttpClient = inject(HttpClient);\n\n /** GET /cc-account/list — cross-instance account-lista. */\n listAccounts(): Promise<{ items: CC_Account_Response[] }> {\n return firstValueFrom(\n this.http.get<{ items: CC_Account_Response[] }>(`${this.baseUrl}/list`),\n );\n }\n\n /**\n * GET /cc-account/list-by-identity — REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 3\n * part-1 (cycle 890): account-lista accountIdentity szerint csoportosítva.\n * A Dashboard ezt használja a per-email view-hoz (a token-rotation\n * duplikátumok egyetlen kártyán).\n */\n listAccountsByIdentity(): Promise<CC_AccountIdentityList_Response> {\n return firstValueFrom(\n this.http.get<CC_AccountIdentityList_Response>(`${this.baseUrl}/list-by-identity`),\n );\n }\n\n /**\n * POST /cc-account/backfill-identity — REQ-CC-ACCOUNT-IDENTITY-EMAIL-001\n * Slice 2 (cycle 889): manuális identity-backfill trigger.\n */\n backfillIdentity(): Promise<{\n totalScanned: number;\n alreadyPopulated: number;\n populated: number;\n skippedMissingFile: number;\n skippedInvalidPayload: number;\n failures: number;\n }> {\n return firstValueFrom(\n this.http.post<{\n totalScanned: number;\n alreadyPopulated: number;\n populated: number;\n skippedMissingFile: number;\n skippedInvalidPayload: number;\n failures: number;\n }>(`${this.baseUrl}/backfill-identity`, {}),\n );\n }\n\n /**\n * GET /cc-account/identity-audit — REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 2\n * (cycle 889): identity-duplikáció audit.\n */\n auditIdentityDuplicates(): Promise<{\n duplicateGroups: { accountIdentity: string; accountKeys: string[]; count: number }[];\n totalDuplicates: number;\n uniqueIdentities: number;\n recordsWithoutIdentity: number;\n }> {\n return firstValueFrom(\n this.http.get<{\n duplicateGroups: { accountIdentity: string; accountKeys: string[]; count: number }[];\n totalDuplicates: number;\n uniqueIdentities: number;\n recordsWithoutIdentity: number;\n }>(`${this.baseUrl}/identity-audit`),\n );\n }\n\n /** POST /cc-account/refresh — a hívó CCAP instance-en credential-discovery újrafutás. */\n refreshLocalAccounts(): Promise<{ refreshedKeys: string[]; scannedPaths: number }> {\n return firstValueFrom(\n this.http.post<{ refreshedKeys: string[]; scannedPaths: number }>(\n `${this.baseUrl}/refresh`,\n {},\n ),\n );\n }\n\n /**\n * GET /cc-account/instance-mapping — Slice 4 cross-instance aggregate.\n * Minden ismert CCAP instance group-by lastObservedByCcapId — melyik account-okat\n * látta utoljára.\n */\n getInstanceMapping(): Promise<CC_AccountInstanceMapping_Response> {\n return firstValueFrom(\n this.http.get<CC_AccountInstanceMapping_Response>(`${this.baseUrl}/instance-mapping`),\n );\n }\n\n /** GET /cc-account/:accountKey — egy account részletek. */\n getAccount(accountKey: string): Promise<CC_Account_Response> {\n return firstValueFrom(\n this.http.get<CC_Account_Response>(`${this.baseUrl}/${accountKey}`),\n );\n }\n\n /**\n * GET /cc-account/:accountKey/usage — Slice 3 per-account usage state-ek.\n * 0..5 rekord (egy windowType-onként).\n */\n getAccountUsage(accountKey: string): Promise<{ items: CC_AccountUsageState_Response[] }> {\n return firstValueFrom(\n this.http.get<{ items: CC_AccountUsageState_Response[] }>(\n `${this.baseUrl}/${accountKey}/usage`,\n ),\n );\n }\n\n /**\n * GET /cc-account/:accountKey/usage-history — történeti event-lista\n * (REQ-CC-USAGE-DASHBOARD-001 cycle 879). Append-only timeline; opcionális\n * windowType + idő-tartomány szűrők (`fromMs`, `toMs`).\n */\n getAccountUsageHistory(params: {\n accountKey: string;\n windowType?: string;\n fromMs?: number;\n toMs?: number;\n }): Promise<{ items: CC_AccountUsageEvent_Response[] }> {\n const query: string[] = [];\n if (params.windowType != null && params.windowType !== '') {\n query.push(`windowType=${encodeURIComponent(params.windowType)}`);\n }\n if (params.fromMs != null) {\n query.push(`fromMs=${params.fromMs}`);\n }\n if (params.toMs != null) {\n query.push(`toMs=${params.toMs}`);\n }\n const qs: string = query.length > 0 ? `?${query.join('&')}` : '';\n return firstValueFrom(\n this.http.get<{ items: CC_AccountUsageEvent_Response[] }>(\n `${this.baseUrl}/${params.accountKey}/usage-history${qs}`,\n ),\n );\n }\n\n /**\n * POST /cc-account/:accountKey/refresh-usage — aktív Anthropic usage-pull\n * (REQ-CC-USAGE-DASHBOARD-001 cycle 873). A server credential-fájl + Bearer-rel\n * hív, az 5 window state-et upsert-eli, profile-mezőket (email/orgId/planTier)\n * a CC_Account-ba updateli, socket-broadcast.\n */\n refreshAccountUsage(accountKey: string): Promise<{\n status: 'ok' | 'not-found' | 'credential-unreadable' | 'no-token' | 'http-error' | 'network-error' | string;\n windowsUpserted: number;\n email: string | null;\n /** Cycle 874 diag: rossz HTTP-státusz a probe-tól (401, 404 stb.). */\n httpStatus?: number;\n /** Cycle 874 diag: Anthropic-válasz első ~400 char-ja. */\n bodyHead?: string;\n /** Cycle 874 diag: a hívott URL. */\n attemptedUrl?: string;\n /** Cycle 874 diag: network-error üzenet. */\n networkMessage?: string;\n }> {\n return firstValueFrom(\n this.http.post<{\n status: string;\n windowsUpserted: number;\n email: string | null;\n httpStatus?: number;\n bodyHead?: string;\n attemptedUrl?: string;\n networkMessage?: string;\n }>(\n `${this.baseUrl}/${accountKey}/refresh-usage`,\n {},\n ),\n );\n }\n\n /**\n * PATCH /cc-account/:accountKey — user-editable mezők frissítése (cycle 876):\n * `displayName` és/vagy `email`. Mindkettő opcionális; legalább egy kell.\n * `email: null` (vagy üres string) → kitörli (clear). Server-side validáció:\n * displayName 200-char + control-char tiltás, email RFC alap-formátum + 320-char.\n */\n renameAccount(params: {\n accountKey: string;\n displayName?: string;\n email?: string | null;\n }): Promise<CC_Account_Response> {\n const body: Record<string, unknown> = {};\n if (params.displayName !== undefined) {\n body.displayName = params.displayName;\n }\n if (params.email !== undefined) {\n body.email = params.email;\n }\n return firstValueFrom(\n this.http.patch<CC_Account_Response>(\n `${this.baseUrl}/${params.accountKey}`,\n body,\n ),\n );\n }\n}\n", "import { inject, Injectable, NgZone, OnDestroy, signal } from '@angular/core';\nimport { Subscription } from 'rxjs';\n\nimport { CCAP_Socket_ControlService } from '../../../../../_services/control-services/ccap-socket.control-service';\nimport { CCAP_GlobalError_ControlService } from '../../../../../_services/control-services/ccap-global-error.control-service';\nimport { CC_Account_ApiService } from './cc-account.api-service';\nimport { CC_Account_Response } from '../_models/interfaces/cc-account/cc-account.interface';\nimport { CC_AccountUsageEvent_Response } from '../_models/interfaces/cc-account/cc-account-usage-event.interface';\nimport {\n CC_AccountInstanceMapping_Response,\n CC_AccountUsageState_Response,\n} from '../_models/interfaces/cc-account/cc-account-usage-state.interface';\nimport {\n CC_AccountIdentityGroup_Response,\n} from '../_models/interfaces/cc-account/cc-account-identity-group.interface';\n\n/** Socket envelope shape — `CCAP_Socket_ControlService.event$` Subject közvetíti. */\ninterface SocketEnvelope_Interface {\n event: string;\n payload: Record<string, unknown>;\n}\n\n/** REQ-CC-USAGE-DASHBOARD-001 Slice 6 second-half: socket event nevek. */\nconst SOCKET_EVENT_CC_ACCOUNT_USAGE_UPDATE: string = 'cc:account-usage-update';\nconst SOCKET_EVENT_CC_ACCOUNT_LIST_UPDATE: string = 'cc:account-list-update';\n\n/**\n * CC Account Dashboard data service (REQ-CC-USAGE-DASHBOARD-001 Slice 5 cycle 857).\n *\n * SSOT a Slice 5+ Dashboard kliens-oldali state-jéhez. Signal-ek a komponensek\n * change-detection-jéhez (`accounts_$`, `accountUsageMap_$`, `instanceMapping_$`,\n * `isLoading_$`, `loadError_$`); async metódusok REST hívásokhoz a\n * `CC_Account_ApiService`-en át (cycle 856).\n *\n * NEM perzisztál (a backend DBNT a SSOT) — a kliens csak cache-eli a fetch-eket\n * a komponens élettartam alatt. Refresh: explicit user-action (`refreshAccounts`)\n * vagy szocket-event (Slice 6).\n */\n@Injectable({ providedIn: 'root' })\nexport class CC_Account_DataService implements OnDestroy {\n\n private readonly account_AS: CC_Account_ApiService = inject(CC_Account_ApiService);\n private readonly socket_CS: CCAP_Socket_ControlService = inject(CCAP_Socket_ControlService);\n private readonly globalError_CS: CCAP_GlobalError_ControlService = inject(CCAP_GlobalError_ControlService);\n private readonly ngZone: NgZone = inject(NgZone);\n\n /** Socket envelope subscription élettartam-kezelése. */\n private socketSubscription: Subscription | null = null;\n\n /** Cross-instance account-lista (a `listAccounts` REST eredménye). */\n readonly accounts_$ = signal<CC_Account_Response[]>([]);\n\n /**\n * Per-account usage state cache: `accountKey → usage-state[]` (5 windowType-onként\n * egy rekord max). A Slice 5 Dashboard account-card-ok ebből rendernek.\n */\n readonly accountUsageMap_$ = signal<Map<string, CC_AccountUsageState_Response[]>>(\n new Map(),\n );\n\n /** Cross-instance aggregate (Slice 4 instance-mapping endpoint cache). */\n readonly instanceMapping_$ = signal<CC_AccountInstanceMapping_Response | null>(null);\n\n /**\n * Per-account usage-history cache: `accountKey → event[]` (REQ-CC-USAGE-DASHBOARD-001\n * cycle 879). Append-only timeline a `ccap_cc_account_usage_event` collection-ből;\n * lazy-loaded a Dashboard expand-panel megnyitásakor.\n */\n readonly usageHistoryMap_$ = signal<Map<string, CC_AccountUsageEvent_Response[]>>(\n new Map(),\n );\n\n /**\n * REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 3 part-1 (cycle 890): identity-\n * csoportosított account-lista — per-email view a Dashboard-on. A\n * `accounts_$` (raw rekordok, duplikátumokkal) MELLETT él; a Dashboard a\n * `identityGroups_$`-ot rendereli (egy kártya / identity), az `accounts_$`\n * audit / admin-célokra megmarad.\n */\n readonly identityGroups_$ = signal<CC_AccountIdentityGroup_Response[]>([]);\n\n /** Bármelyik load folyamatban-e (UI spinner-hez). */\n readonly isLoading_$ = signal<boolean>(false);\n\n /** Utolsó load hiba — null ha sikeres vagy nem futott. */\n readonly loadError_$ = signal<string | null>(null);\n\n /**\n * Bootstrap fetch: account-list + instance-mapping párhuzamosan, majd a\n * megismert account-okhoz az 5 windowType-os usage state-eket is lehúzzuk\n * (REQ-CC-USAGE-DASHBOARD-001 cycle 883). Ez biztosítja, hogy a Dashboard\n * megnyitásakor azonnal látszanak az utolsó perzisztált usage értékek —\n * nem kell auto-pull socket-eventre vagy manuális Pull-clickre várni.\n */\n async loadDashboardBootstrap(): Promise<void> {\n this.isLoading_$.set(true);\n this.loadError_$.set(null);\n let didFail: boolean = false;\n try {\n // REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 3 part-1 (cycle 890): a Dashboard\n // most az identity-group endpoint-ot is használja a per-email view-hoz.\n // Párhuzamosan az accountsList + instance-mapping + identity-groups.\n const [accountsResp, mappingResp, groupsResp] = await Promise.all([\n this.account_AS.listAccounts(),\n this.account_AS.getInstanceMapping(),\n this.account_AS.listAccountsByIdentity(),\n ]);\n this.accounts_$.set(accountsResp.items);\n this.instanceMapping_$.set(mappingResp);\n this.identityGroups_$.set(groupsResp.groups);\n // A `accountUsageMap_$` cache-be a group merged-usage-eket is beleírjuk\n // — a `<app-cc-account-usage-view [accountKey]>` komponens (per identity-group\n // a primary.accountKey-vel) ezt olvassa.\n const nextMap: Map<string, CC_AccountUsageState_Response[]> = new Map(this.accountUsageMap_$());\n for (const group of groupsResp.groups) {\n nextMap.set(group.primary.accountKey, group.mergedUsage);\n }\n this.accountUsageMap_$.set(nextMap);\n } catch (err: unknown) {\n didFail = true;\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, 'cc-account-dashboard-bootstrap');\n } finally {\n this.isLoading_$.set(false);\n // didFail kifejezetten a TS-flag, nem inert: a finally után további\n // tisztító logikát itt nem futtatunk.\n void didFail;\n }\n }\n\n /**\n * REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 3 part-1 (cycle 890): csak az\n * identity-groups refetch-je (a refresh-after-pull / list-update szocketnél).\n */\n async loadIdentityGroups(): Promise<void> {\n try {\n const resp = await this.account_AS.listAccountsByIdentity();\n this.identityGroups_$.set(resp.groups);\n // Merged-usage cache update is.\n const nextMap: Map<string, CC_AccountUsageState_Response[]> = new Map(this.accountUsageMap_$());\n for (const group of resp.groups) {\n nextMap.set(group.primary.accountKey, group.mergedUsage);\n }\n this.accountUsageMap_$.set(nextMap);\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, 'cc-account-load-identity-groups');\n }\n }\n\n /** Csak az account-listát tölti újra (kis fetch). */\n async loadAccounts(): Promise<void> {\n try {\n const resp = await this.account_AS.listAccounts();\n this.accounts_$.set(resp.items);\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, 'cc-account-load-accounts');\n }\n }\n\n /**\n * Per-account usage-state fetch + cache-be írás. A Slice 5 account-card\n * komponens ezt hívja a saját accountKey-jére.\n */\n async loadAccountUsage(accountKey: string): Promise<void> {\n try {\n const resp = await this.account_AS.getAccountUsage(accountKey);\n const next: Map<string, CC_AccountUsageState_Response[]> = new Map(this.accountUsageMap_$());\n next.set(accountKey, resp.items);\n this.accountUsageMap_$.set(next);\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, `cc-account-load-usage[${accountKey}]`);\n }\n }\n\n /**\n * Per-account usage-history fetch + cache-be írás (REQ-CC-USAGE-DASHBOARD-001\n * cycle 879). Lazy: a Dashboard expand-panel megnyitásakor hívjuk. Opcionális\n * windowType + idő-tartomány szűrőkkel.\n */\n async loadAccountUsageHistory(params: {\n accountKey: string;\n windowType?: string;\n fromMs?: number;\n toMs?: number;\n }): Promise<void> {\n try {\n const resp = await this.account_AS.getAccountUsageHistory(params);\n const next: Map<string, CC_AccountUsageEvent_Response[]> = new Map(this.usageHistoryMap_$());\n next.set(params.accountKey, resp.items);\n this.usageHistoryMap_$.set(next);\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, `cc-account-load-history[${params.accountKey}]`);\n }\n }\n\n /** Cross-instance aggregate refetch (Slice 4 — Slice 6 view bootstrap-jánál). */\n async loadInstanceMapping(): Promise<void> {\n try {\n const resp = await this.account_AS.getInstanceMapping();\n this.instanceMapping_$.set(resp);\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, 'cc-account-load-instance-mapping');\n }\n }\n\n /**\n * Explicit user-trigger: a hívó CCAP instance-en credential-discovery újrafutás\n * + account-lista refetch. POST /refresh után automatikusan listAccounts-szal frissít.\n */\n async refreshAccounts(): Promise<{ refreshedKeys: string[]; scannedPaths: number }> {\n this.isLoading_$.set(true);\n this.loadError_$.set(null);\n try {\n const refreshResult = await this.account_AS.refreshLocalAccounts();\n await this.loadAccounts();\n await this.loadIdentityGroups();\n return refreshResult;\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, 'cc-account-refresh-accounts');\n return { refreshedKeys: [], scannedPaths: 0 };\n } finally {\n this.isLoading_$.set(false);\n }\n }\n\n /**\n * Aktív usage-pull egy adott account-ra (REQ-CC-USAGE-DASHBOARD-001 cycle 873).\n * A server `POST /cc-account/:accountKey/refresh-usage`-t hívja, ami az\n * Anthropic `/api/oauth/usage` endpoint-ját triggeri Bearer-rel. A pull\n * eredménye automatikusan jön socket-eventként (`cc:account-usage-update`),\n * de a sikeres POST után explicit re-fetch-eljük is az adott account usage-ét\n * + a teljes account-listát (a profile-mezők is updatelődtek).\n */\n async refreshAccountUsage(accountKey: string): Promise<{ status: string; windowsUpserted: number; email: string | null }> {\n try {\n const result = await this.account_AS.refreshAccountUsage(accountKey);\n // REQ-CC-USAGE-DASHBOARD-001 cycle 893: result-level error surface a globális\n // error-display-be. A server 200-as response-szal tér vissza non-ok status-szal\n // (probe-failed scenarios), így ezt az interceptor NEM tudja elkapni.\n if (result.status !== 'ok') {\n this.surfacePullError({\n source: 'cc-account-pull',\n accountKey: accountKey,\n status: result.status,\n httpStatus: result.httpStatus,\n bodyHead: result.bodyHead,\n attemptedUrl: result.attemptedUrl,\n networkMessage: result.networkMessage,\n });\n }\n // Re-fetch a friss state-et — bár a socket-event is jön, a cache-frissítés\n // garantált a user-action végén.\n await this.loadAccountUsage(accountKey);\n await this.loadAccounts();\n // Identity-grouped lista is frissítendő (a primary key megváltozhat token-rotation-nél).\n await this.loadIdentityGroups();\n return result;\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, `cc-account-pull[${accountKey}]`);\n return { status: 'error', windowsUpserted: 0, email: null };\n }\n }\n\n /**\n * Cycle 893: pull-result NEM-OK status → human-readable error-object construction\n * + globalError_CS.showError() hívás. A user a részletes diagnosztikát látja:\n * status + httpStatus + attemptedUrl + bodyHead (Anthropic-válasz részlete) +\n * networkMessage. Ezt ki tudja másolni és visszajelezni.\n */\n private surfacePullError(params: {\n source: string;\n accountKey: string;\n status: string;\n httpStatus?: number;\n bodyHead?: string;\n attemptedUrl?: string;\n networkMessage?: string;\n }): void {\n const lines: string[] = [];\n lines.push(`CC Account pull failed (status=${params.status})`);\n lines.push(`accountKey: ${params.accountKey}`);\n if (params.httpStatus != null) {\n lines.push(`httpStatus: ${params.httpStatus}`);\n }\n if (params.attemptedUrl != null && params.attemptedUrl !== '') {\n lines.push(`attemptedUrl: ${params.attemptedUrl}`);\n }\n if (params.networkMessage != null && params.networkMessage !== '') {\n lines.push(`networkMessage: ${params.networkMessage}`);\n }\n if (params.bodyHead != null && params.bodyHead !== '') {\n lines.push(`responseBodyHead: ${params.bodyHead}`);\n }\n const message: string = lines.join('\\n');\n const err: Error & { errorDetails?: Record<string, unknown> } = new Error(message);\n err.errorDetails = {\n message: message,\n errorCode: `CCAP-CC-ACCOUNT-PULL-${params.status.toUpperCase()}`,\n additionalContent: params as unknown as Record<string, unknown>,\n };\n this.loadError_$.set(message);\n this.globalError_CS.showError(err, params.source);\n }\n\n /**\n * Display-name átírása + a cache-elt account-lista frissítése (a megfelelő\n * elem displayName mezőjének felülírása, signal-update).\n */\n async renameAccount(params: {\n accountKey: string;\n displayName?: string;\n email?: string | null;\n }): Promise<void> {\n try {\n const updated = await this.account_AS.renameAccount(params);\n const next: CC_Account_Response[] = this.accounts_$().map(\n (a): CC_Account_Response => (a.accountKey === params.accountKey ? updated : a),\n );\n this.accounts_$.set(next);\n // Identity-grouped lista is frissítendő (a primary kártya neve / email-je megváltozhat).\n await this.loadIdentityGroups();\n } catch (err: unknown) {\n this.loadError_$.set(this.errorMessageOf(err));\n this.globalError_CS.showError(err, `cc-account-rename[${params.accountKey}]`);\n }\n }\n\n /**\n * Socket subscription init (REQ-CC-USAGE-DASHBOARD-001 Slice 6 second-half cycle 871).\n * A `CCAP_Socket_ControlService.event$` Subject minden socket-event-et közvetít\n * envelope-formában (event-name + payload). Mi az `cc:account-usage-update`\n * és `cc:account-list-update` event-ekre szűrünk és a megfelelő signal-eket frissítjük.\n *\n * Late subscription: a Dashboard component `ngOnInit`-jéből hívjuk (vagy explicit\n * service-init-kor), hogy ne legyen subscription-overhead, ha a Dashboard sose\n * nyílik meg.\n */\n startLiveUpdates(): void {\n if (this.socketSubscription != null) {\n return;\n }\n this.socketSubscription = this.socket_CS.event$.subscribe(\n (envelope: SocketEnvelope_Interface): void => {\n this.ngZone.run((): void => {\n if (envelope.event === SOCKET_EVENT_CC_ACCOUNT_USAGE_UPDATE) {\n this.handleAccountUsageUpdate(envelope.payload);\n } else if (envelope.event === SOCKET_EVENT_CC_ACCOUNT_LIST_UPDATE) {\n this.handleAccountListUpdate(envelope.payload);\n }\n });\n },\n );\n }\n\n /** Socket subscription teardown (component destroy / explicit stop). */\n stopLiveUpdates(): void {\n if (this.socketSubscription != null) {\n this.socketSubscription.unsubscribe();\n this.socketSubscription = null;\n }\n }\n\n ngOnDestroy(): void {\n this.stopLiveUpdates();\n }\n\n /**\n * Per-account usage state real-time frissítés. A server `persistAccountUsageState`\n * upsert sikere után emit-elt event-ből építjük újra a `accountUsageMap_$`\n * megfelelő `accountKey` bejegyzését. Ha a windowType már szerepel, lecseréljük;\n * különben hozzáadjuk.\n */\n private handleAccountUsageUpdate(payload: Record<string, unknown>): void {\n const accountKey: unknown = payload.accountKey;\n const windowType: unknown = payload.windowType;\n if (typeof accountKey !== 'string' || accountKey === '' || typeof windowType !== 'string') {\n return;\n }\n const newItem: CC_AccountUsageState_Response = {\n accountKey: accountKey,\n windowType: windowType,\n utilization: typeof payload.utilization === 'number' ? payload.utilization : undefined,\n resetsAtMs: typeof payload.resetsAtMs === 'number' ? payload.resetsAtMs : undefined,\n lastObservedStatus: typeof payload.lastObservedStatus === 'string' ? payload.lastObservedStatus : undefined,\n observedAt: typeof payload.observedAt === 'string' ? payload.observedAt : undefined,\n lastObservedByCcapId: typeof payload.lastObservedByCcapId === 'string' ? payload.lastObservedByCcapId : undefined,\n lastObservedBySessionId: typeof payload.lastObservedBySessionId === 'string' ? payload.lastObservedBySessionId : undefined,\n };\n\n const next: Map<string, CC_AccountUsageState_Response[]> = new Map(this.accountUsageMap_$());\n const existing: CC_AccountUsageState_Response[] = next.get(accountKey) ?? [];\n const replaced: CC_AccountUsageState_Response[] = existing.filter(\n (item: CC_AccountUsageState_Response): boolean => item.windowType !== windowType,\n );\n replaced.push(newItem);\n next.set(accountKey, replaced);\n this.accountUsageMap_$.set(next);\n }\n\n /**\n * Account-pool változás (új account felfedezve, displayName-átírás): a\n * legegyszerűbb és legbiztonságosabb módon `loadAccounts()` re-fetch-csel\n * frissítjük a `accounts_$` signal-t. Cross-instance change-ek esetén is\n * ez a megközelítés robosztus (a DB SSOT-ből minden instance ugyanazt látja).\n */\n private handleAccountListUpdate(_payload: Record<string, unknown>): void {\n void this.loadAccounts();\n // REQ-CC-ACCOUNT-IDENTITY-EMAIL-001 Slice 3 part-1 (cycle 890): a Dashboard\n // identity-groups view is frissül a socket-eventre — egyébként új account\n // (vagy backfill utáni identity-update) nem jutna el a Dashboard kártyáira.\n void this.loadIdentityGroups();\n }\n\n /** Hibaüzenet kinyerés tipikus shape-ekből (HttpErrorResponse / Error / unknown). */\n private errorMessageOf(err: unknown): string {\n if (err instanceof Error) {\n return err.message;\n }\n if (typeof err === 'object' && err !== null) {\n const rec: Record<string, unknown> = err as Record<string, unknown>;\n if (typeof rec.message === 'string') {\n return rec.message;\n }\n }\n return String(err);\n }\n}\n", "import { CC_AccountUsageEvent_Response } from '../_models/interfaces/cc-account/cc-account-usage-event.interface';\nimport {\n CC_AccountUsageChartLine_Interface,\n CC_AccountUsageChart_Result,\n} from '../_models/interfaces/cc-account/cc-account-usage-chart.interface';\n\n/**\n * Account usage-history → SVG chart-line projektor (REQ-CC-USAGE-DASHBOARD-001\n * cycle 884). Az event-eket windowType-onként szétválogatja, observedAt szerint\n * növekvő sorrendbe rendezi, majd a `(t, utilization)` párokat egy 100×40 unit-os\n * viewBox-ba projektálja (x: 0..100 idő-tengely, y: 0=tele/100% .. 40=üres/0%).\n *\n * A 5 fix windowType-onkénti szín stabil (a Dashboard-kártyák és a Session-info\n * popover is ugyanezt használja, mint vizuális SSOT).\n */\nexport class CC_AccountUsageChart_Util {\n\n static readonly CHART_WIDTH: number = 100;\n static readonly CHART_HEIGHT: number = 40;\n\n /** Fix windowType-onkénti szín-paletta (stroke hex). */\n static readonly COLOR_MAP: Record<string, string> = {\n five_hour: '#10b981',\n seven_day: '#06b6d4',\n seven_day_opus: '#a855f7',\n seven_day_sonnet: '#f59e0b',\n extra_usage: '#f43f5e',\n };\n\n static readonly WINDOW_LABEL_MAP: Record<string, string> = {\n five_hour: '5h',\n seven_day: 'Weekly',\n seven_day_opus: 'Opus',\n seven_day_sonnet: 'Sonnet',\n extra_usage: 'Extra',\n };\n\n /** Fix windowType render-sorrend (stabil legend-sorrend). */\n static readonly WINDOW_ORDER: string[] = [\n 'five_hour',\n 'seven_day',\n 'seven_day_opus',\n 'seven_day_sonnet',\n 'extra_usage',\n ];\n\n /**\n * Account-history events → chart-line projektálás.\n * Üres input → üres result (`hasAnyData=false`); a hívó tudja kezelni az\n * \"no data yet\" placeholder render-t.\n */\n static buildChart(events: CC_AccountUsageEvent_Response[]): CC_AccountUsageChart_Result {\n // Idő-tartomány + érvényes pontok detektálása egy menetben.\n let minT: number = Number.POSITIVE_INFINITY;\n let maxT: number = Number.NEGATIVE_INFINITY;\n let validCount: number = 0;\n for (const e of events) {\n if (typeof e.observedAt !== 'string' || e.observedAt === '') {\n continue;\n }\n if (typeof e.utilization !== 'number' || !isFinite(e.utilization)) {\n continue;\n }\n const t: number = Date.parse(e.observedAt);\n if (!isFinite(t)) {\n continue;\n }\n if (t < minT) {\n minT = t;\n }\n if (t > maxT) {\n maxT = t;\n }\n validCount++;\n }\n\n if (validCount === 0) {\n return {\n lines: CC_AccountUsageChart_Util.WINDOW_ORDER.map(\n (wt: string): CC_AccountUsageChartLine_Interface => ({\n windowType: wt,\n label: CC_AccountUsageChart_Util.WINDOW_LABEL_MAP[wt] ?? wt,\n colorHex: CC_AccountUsageChart_Util.COLOR_MAP[wt] ?? '#9ca3af',\n pathPoints: '',\n hasData: false,\n pointCount: 0,\n lastX: 0,\n lastY: 0,\n }),\n ),\n hasAnyData: false,\n minTimeMs: 0,\n maxTimeMs: 0,\n };\n }\n\n // Degenerate eset: minden esemény ugyanabban a ms-ben — expand-eljük 1h-vel,\n // hogy a vízszintes vonalak ne 0-szélességűek legyenek.\n if (maxT - minT < 1) {\n maxT = minT + 3_600_000;\n }\n const range: number = maxT - minT;\n\n const lines: CC_AccountUsageChartLine_Interface[] =\n CC_AccountUsageChart_Util.WINDOW_ORDER.map((wt: string): CC_AccountUsageChartLine_Interface => {\n // windowType-onkénti gyűjtés + növekvő idő szerinti rendezés.\n const points: { t: number; u: number }[] = [];\n for (const e of events) {\n if (e.windowType !== wt) {\n continue;\n }\n if (typeof e.observedAt !== 'string' || e.observedAt === '') {\n continue;\n }\n if (typeof e.utilization !== 'number' || !isFinite(e.utilization)) {\n continue;\n }\n const t: number = Date.parse(e.observedAt);\n if (!isFinite(t)) {\n continue;\n }\n points.push({ t: t, u: Math.max(0, Math.min(1, e.utilization)) });\n }\n points.sort((a: { t: number; u: number }, b: { t: number; u: number }): number => a.t - b.t);\n\n const coords: string[] = [];\n let lastX: number = 0;\n let lastY: number = 0;\n for (const p of points) {\n const x: number = ((p.t - minT) / range) * CC_AccountUsageChart_Util.CHART_WIDTH;\n const y: number = CC_AccountUsageChart_Util.CHART_HEIGHT\n - (p.u * CC_AccountUsageChart_Util.CHART_HEIGHT);\n coords.push(`${x.toFixed(2)},${y.toFixed(2)}`);\n lastX = x;\n lastY = y;\n }\n\n return {\n windowType: wt,\n label: CC_AccountUsageChart_Util.WINDOW_LABEL_MAP[wt] ?? wt,\n colorHex: CC_AccountUsageChart_Util.COLOR_MAP[wt] ?? '#9ca3af',\n pathPoints: coords.join(' '),\n hasData: coords.length > 0,\n pointCount: coords.length,\n lastX: lastX,\n lastY: lastY,\n };\n });\n\n return {\n lines: lines,\n hasAnyData: lines.some((l: CC_AccountUsageChartLine_Interface): boolean => l.hasData),\n minTimeMs: minT,\n maxTimeMs: maxT,\n };\n }\n}\n", "import { CommonModule } from '@angular/common';\nimport { Component, computed, effect, inject, Input, signal, Signal } from '@angular/core';\n\nimport { CC_Account_DataService } from '../../_services/cc-account.data-service';\nimport { CC_AccountUsageState_Response } from '../../_models/interfaces/cc-account/cc-account-usage-state.interface';\nimport { CC_AccountUsageChart_Result } from '../../_models/interfaces/cc-account/cc-account-usage-chart.interface';\nimport { CC_AccountUsageChart_Util } from '../../_collections/cc-account-usage-chart.util';\n\n/**\n * CC Account Usage View — megosztott komponens (REQ-CC-USAGE-DASHBOARD-001 cycle 885).\n *\n * Egy account `accountKey`-éhez tartozó 5 windowType-os usage státusz + opcionális\n * időbeli SVG-graph render. Több helyen használt:\n * - CC Usage Dashboard (account-cards) — `compact=false`, graph elérhető\n * - CC Session info-panel popover — `compact=true` szűk popover-hez\n * - bárhol ahol egy accountKey-hez kell mutatni a usage-snapshot-ot\n *\n * SSOT: a `CC_Account_DataService.accountUsageMap_$` és `usageHistoryMap_$` signal-okat\n * olvassa. Lazy-fetch saját maga: ha a state cache-ben még nincs, indítja a\n * `loadAccountUsage`-t. A history-fetch csak akkor fut, ha a graph megnyílik.\n */\n@Component({\n selector: 'app-cc-account-usage-view',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './cc-account-usage-view.component.html',\n})\n/**\n * REQ-CC-USAGE-DASHBOARD-001 (cycle 885) — shared CC account-usage megjelenítő.\n * Egyetlen komponens a per-account utilization graph + status egységes renderéhez,\n * amit a Dashboard és a CC Session info-panel egyaránt használ (graph + status\n * SSOT). Csak Render-only: state-et a `CC_Account_DataService`-ből olvas.\n */\nexport class CC_AccountUsageView_Component {\n\n private readonly account_DS: CC_Account_DataService = inject(CC_Account_DataService);\n\n /** Account stable kulcs — kötelező input. */\n @Input({ required: true }) accountKey: string = '';\n\n /** Kompakt layout (kisebb fontok, szűkebb padding) — popover-be javasolt. */\n @Input() compact: boolean = false;\n\n /** Igaz → a graph toggle gomb meg fog jelenni (default: true). */\n @Input() showGraphToggle: boolean = true;\n\n /** Igaz → a graph-panel induláskor nyitva (default: false → lezárt). */\n @Input() initiallyOpenGraph: boolean = false;\n\n /** Lokális UI state: a graph-panel nyitva/zárva. */\n readonly isGraphOpen_$ = signal<boolean>(false);\n\n /** SVG chart-data builder az adott account-history cache-éből. */\n readonly chart_$: Signal<CC_AccountUsageChart_Result> = computed(\n (): CC_AccountUsageChart_Result => {\n return CC_AccountUsageChart_Util.buildChart(\n this.account_DS.usageHistoryMap_$().get(this.accountKey) ?? [],\n );\n },\n );\n\n /** SVG viewBox literal (a template használja). */\n readonly chartViewBox: string = `0 0 ${CC_AccountUsageChart_Util.CHART_WIDTH} ${CC_AccountUsageChart_Util.CHART_HEIGHT}`;\n readonly chartW: number = CC_AccountUsageChart_Util.CHART_WIDTH;\n readonly chartH: number = CC_AccountUsageChart_Util.CHART_HEIGHT;\n readonly chartMidY: number = CC_AccountUsageChart_Util.CHART_HEIGHT / 2;\n\n /**\n * Reaktív lazy-fetch: ha az accountKey változik vagy a cache üres, lekérjük\n * a perzisztált usage state-et. Ez azoknál a használati helyeknél kritikus\n * (popover, CC sessions dashboard), ahol a Dashboard-bootstrap NEM futott.\n */\n private readonly usageEffect = effect((): void => {\n const key: string = this.accountKey;\n if (!key) {\n return;\n }\n if (!this.account_DS.accountUsageMap_$().has(key)) {\n void this.account_DS.loadAccountUsage(key);\n }\n });\n\n /** initiallyOpenGraph input alkalmazása az isGraphOpen_$-ra. */\n private readonly initialOpenEffect = effect((): void => {\n if (this.initiallyOpenGraph) {\n this.isGraphOpen_$.set(true);\n }\n });\n\n /** Graph-toggle handler — első megnyitás-kor history-fetch. */\n async handleToggleGraph(): Promise<void> {\n const next: boolean = !this.isGraphOpen_$();\n this.isGraphOpen_$.set(next);\n if (next && !this.account_DS.usageHistoryMap_$().has(this.accountKey)) {\n await this.account_DS.loadAccountUsageHistory({ accountKey: this.accountKey });\n }\n }\n\n /** Explicit refresh — history-fetch reload. */\n async handleRefreshGraph(): Promise<void> {\n await this.account_DS.loadAccountUsageHistory({ accountKey: this.accountKey });\n }\n\n /** Egy adott windowType state-jét adja vissza, vagy null. */\n usageItemOfWindow(windowType: string): CC_AccountUsageState_Response | null {\n const items: CC_AccountUsageState_Response[] = this.account_DS.accountUsageMap_$().get(this.accountKey) ?? [];\n for (const item of items) {\n if (item.windowType === windowType) {\n return item;\n }\n }\n return null;\n }\n\n /** True ha legalább egy windowType-ra van adat. */\n hasAnyUsageData(): boolean {\n const items: CC_AccountUsageState_Response[] = this.account_DS.accountUsageMap_$().get(this.accountKey) ?? [];\n return items.length > 0;\n }\n\n /** Window-typeName → emberi label (pure mapping). */\n windowLabelOf(windowType: string): string {\n switch (windowType) {\n case 'five_hour': return '5-hour session';\n case 'seven_day': return 'Weekly';\n case 'seven_day_opus': return 'Weekly · Opus';\n case 'seven_day_sonnet': return 'Weekly · Sonnet';\n case 'extra_usage': return 'Extra (pay-as-you-go)';\n default: return windowType;\n }\n }\n\n /** Utilization → progress-bar width (0..100%, 0 ha null). */\n utilizationPercent(utilization: number | undefined): number {\n if (utilization == null || !isFinite(utilization)) {\n return 0;\n }\n return Math.max(0, Math.min(100, Math.round(utilization * 100)));\n }\n\n /** Utilization fraction (0..1) → percent string '42%'. null → '—'. */\n formatUtilization(utilization: number | null | undefined): string {\n if (utilization == null) {\n return '—';\n }\n return `${Math.round(utilization * 100)}%`;\n }\n\n /** Progress-bar szín-osztály utilization alapján (zöld/sárga/piros). */\n utilizationBarColorClass(utilization: number | undefined): string {\n if (utilization == null || !isFinite(utilization)) {\n return 'bg-neutral-600';\n }\n if (utilization >= 0.85) {\n return 'bg-red-500';\n }\n if (utilization >= 0.5) {\n return 'bg-amber-500';\n }\n return 'bg-emerald-500';\n }\n\n /** Reset countdown — emberi olvasható ('2h 34m', '5d 1h', 'expired', '—'). */\n formatResetCountdown(resetsAtMs: number | undefined): string {\n if (resetsAtMs == null || !isFinite(resetsAtMs) || resetsAtMs <= 0) {\n return '—';\n }\n const diffMs: number = resetsAtMs - Date.now();\n if (diffMs <= 0) {\n return 'expired';\n }\n const totalMinutes: number = Math.floor(diffMs / 60_000);\n const days: number = Math.floor(totalMinutes / (60 * 24));\n const hours: number = Math.floor((totalMinutes % (60 * 24)) / 60);\n const minutes: number = totalMinutes % 60;\n if (days > 0) {\n return `${days}d ${hours}h`;\n }\n if (hours > 0) {\n return `${hours}h ${minutes}m`;\n }\n return `${minutes}m`;\n }\n}\n", "<!-- CC Account Usage View — megosztott komponens (cycle 885).\n A 5 usage-sor mindig látszik (placeholder ha üres), a graph opcionális toggle-able. -->\n<div class=\"flex flex-col\" [class.gap-1]=\"compact\" [class.gap-2]=\"!compact\">\n <!-- 5 usage-sor: a mindig-látható status block. -->\n <div [class.space-y-1]=\"compact\" [class.space-y-2]=\"!compact\">\n @for (windowType of ['five_hour', 'seven_day', 'seven_day_opus', 'seven_day_sonnet', 'extra_usage']; track windowType) {\n @let item = usageItemOfWindow(windowType);\n <div [class]=\"compact ? 'grid grid-cols-[90px_1fr_56px] items-center gap-2 text-[10px]' : 'grid grid-cols-[110px_1fr_64px] items-center gap-2 text-[11px]'\"\n [class.opacity-50]=\"!item\">\n <div class=\"text-neutral-300 font-medium truncate\" [title]=\"windowType\">\n {{ windowLabelOf(windowType) }}\n </div>\n <div class=\"flex items-center gap-2 min-w-0\">\n <div [class]=\"compact ? 'flex-1 h-1.5 bg-neutral-800 rounded-full overflow-hidden' : 'flex-1 h-2 bg-neutral-800 rounded-full overflow-hidden'\">\n @if (item) {\n <div [class]=\"'h-full transition-all ' + utilizationBarColorClass(item.utilization)\"\n [style.width.%]=\"utilizationPercent(item.utilization)\"></div>\n }\n </div>\n <span class=\"font-mono text-neutral-200 text-right shrink-0\"\n [class]=\"compact ? 'w-8 text-[10px]' : 'w-9'\">\n {{ formatUtilization(item?.utilization ?? null) }}\n </span>\n </div>\n <div class=\"font-mono text-neutral-500 text-right text-[10px] truncate\"\n [title]=\"'Resets in ' + formatResetCountdown(item?.resetsAtMs)\">\n {{ formatResetCountdown(item?.resetsAtMs) }}\n </div>\n </div>\n }\n </div>\n\n @if (!hasAnyUsageData()) {\n <div class=\"text-[10px] text-neutral-500 italic pt-1 border-t border-neutral-800/40\">\n No data yet — click <strong class=\"text-neutral-400\">Pull</strong> or wait for the next rate-limit event.\n </div>\n }\n\n <!-- Graph toggle + SVG line-chart (cycle 884 portolva ide). -->\n @if (showGraphToggle) {\n <div class=\"border-t border-neutral-800/40 pt-2\">\n <button\n type=\"button\"\n class=\"text-[11px] text-neutral-400 hover:text-neonCyan flex items-center gap-1 transition-colors\"\n (click)=\"handleToggleGraph()\"\n [title]=\"isGraphOpen_$() ? 'Hide usage graph' : 'Show usage graph (utilization over time per window)'\"\n >\n <svg class=\"w-3 h-3 transition-transform\"\n [class.rotate-90]=\"isGraphOpen_$()\"\n fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 5l7 7-7 7\"/>\n </svg>\n 📈 {{ isGraphOpen_$() ? 'Hide' : 'Show' }} graph\n </button>\n\n @if (isGraphOpen_$()) {\n @let chart = chart_$();\n <div class=\"mt-2 rounded-md border border-neutral-800 bg-neutral-950/40 p-2\">\n @if (!chart.hasAnyData) {\n <div class=\"text-[11px] text-neutral-500 italic px-2 py-3 text-center\">\n No graph data yet — pull usage or wait for a CC session rate-limit event.\n </div>\n } @else {\n <div class=\"relative w-full\">\n <svg [attr.viewBox]=\"chartViewBox\" preserveAspectRatio=\"none\"\n class=\"w-full block\"\n [class.h-24]=\"compact\"\n [class.h-32]=\"!compact\">\n <!-- Háttér + 0%, 50%, 100% referencia-vonalak. -->\n <line x1=\"0\" [attr.y1]=\"chartH\" [attr.x2]=\"chartW\" [attr.y2]=\"chartH\"\n stroke=\"#3f3f46\" stroke-width=\"0.3\"/>\n <line x1=\"0\" [attr.y1]=\"chartMidY\" [attr.x2]=\"chartW\" [attr.y2]=\"chartMidY\"\n stroke=\"#3f3f46\" stroke-width=\"0.2\" stroke-dasharray=\"1,1\"/>\n <line x1=\"0\" y1=\"0\" [attr.x2]=\"chartW\" y2=\"0\"\n stroke=\"#3f3f46\" stroke-width=\"0.2\" stroke-dasharray=\"1,1\"/>\n @for (line of chart.lines; track line.windowType) {\n @if (line.hasData) {\n @if (line.pointCount === 1) {\n <circle [attr.cx]=\"line.lastX\" [attr.cy]=\"line.lastY\" r=\"0.8\" [attr.fill]=\"line.colorHex\"/>\n } @else {\n <polyline [attr.points]=\"line.pathPoints\"\n [attr.stroke]=\"line.colorHex\"\n fill=\"none\" stroke-width=\"0.6\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"/>\n <circle [attr.cx]=\"line.lastX\" [attr.cy]=\"line.lastY\" r=\"0.6\" [attr.fill]=\"line.colorHex\"/>\n }\n }\n }\n </svg>\n <div class=\"absolute inset-y-0 left-0 flex flex-col justify-between text-[8px] text-neutral-600 font-mono pointer-events-none\">\n <span>100%</span>\n <span>50%</span>\n <span>0%</span>\n </div>\n </div>\n <div class=\"mt-2 flex flex-wrap items-center gap-2 text-[10px]\">\n @for (line of chart.lines; track line.windowType) {\n <div class=\"flex items-center gap-1\" [class.opacity-40]=\"!line.hasData\">\n <span class=\"inline-block w-2 h-2 rounded-sm\" [style.background-color]=\"line.colorHex\"></span>\n <span class=\"text-neutral-300\">{{ line.label }}</span>\n @if (line.hasData) {\n <span class=\"text-neutral-500\">·</span>\n <span class=\"font-mono text-neutral-400\">\n {{ ((chartH - line.lastY) / chartH * 100).toFixed(0) }}%\n </span>\n }\n </div>\n }\n </div>\n <div class=\"mt-1 flex items-center justify-between text-[9px] text-neutral-600\">\n @if (chart.minTimeMs) {\n <span>{{ chart.minTimeMs | date:'yyyy-MM-dd HH:mm' }}</span>\n } @else {\n <span>—</span>\n }\n <button\n type=\"button\"\n class=\"text-[10px] text-neutral-400 hover:text-neonCyan border border-neutral-700\n hover:border-neonCyan rounded px-1.5 py-0.5 transition-colors\"\n (click)=\"handleRefreshGraph()\"\n title=\"Re-fetch usage event history for this graph.\"\n >\n ↻ Refresh\n </button>\n @if (chart.maxTimeMs) {\n <span>{{ chart.maxTimeMs | date:'yyyy-MM-dd HH:mm' }}</span>\n } @else {\n <span>—</span>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n</div>\n"],
|
|
5
|
+
"mappings": "+eA0BA,IAAaA,IAAqB,IAAA,CAA5B,MAAOA,CAAqB,CAEfC,QAAkB,GAAGC,GAAYC,IAAIF,OAAO,cAE5CG,KAAmBC,EAAOC,EAAU,EAGrDC,cAAY,CACV,OAAOC,EACL,KAAKJ,KAAKK,IAAsC,GAAG,KAAKR,OAAO,OAAO,CAAC,CAE3E,CAQAS,wBAAsB,CACpB,OAAOF,EACL,KAAKJ,KAAKK,IAAqC,GAAG,KAAKR,OAAO,mBAAmB,CAAC,CAEtF,CAMAU,kBAAgB,CAQd,OAAOH,EACL,KAAKJ,KAAKQ,KAOP,GAAG,KAAKX,OAAO,qBAAsB,CAAA,CAAE,CAAC,CAE/C,CAMAY,yBAAuB,CAMrB,OAAOL,EACL,KAAKJ,KAAKK,IAKP,GAAG,KAAKR,OAAO,iBAAiB,CAAC,CAExC,CAGAa,sBAAoB,CAClB,OAAON,EACL,KAAKJ,KAAKQ,KACR,GAAG,KAAKX,OAAO,WACf,CAAA,CAAE,CACH,CAEL,CAOAc,oBAAkB,CAChB,OAAOP,EACL,KAAKJ,KAAKK,IAAwC,GAAG,KAAKR,OAAO,mBAAmB,CAAC,CAEzF,CAGAe,WAAWC,EAAkB,CAC3B,OAAOT,EACL,KAAKJ,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AAA,OAAA,eAAA,OAAA,EAAA,CAAA,EAAA,eAAA,MAAA,MAAA,YAAA,EAAA,CAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,YAAA,kBAAA,CAAA,EAAAC,SAAA,SAAAC,EAAAC,EAAA,CAAAD,EAAA,IC/B1CxH,EAAA,EAAA,MAAA,CAAA,EAA4E,EAAA,KAAA,EAGxEuC,EAAA,EAAAmF,GAAA,GAAA,GAAA,MAAA,EAAAC,CAAA,EAyBFzH,EAAA,EAEAC,EAAA,EAAAyH,GAAA,EAAA,EAAA,MAAA,CAAA,EAA0B,EAAAC,GAAA,EAAA,EAAA,MAAA,CAAA,EAwG5B3H,EAAA,SAtI2BQ,EAAA,QAAA+G,EAAAhH,OAAA,EAAuB,QAAA,CAAAgH,EAAAhH,OAAA,EAE3CD,EAAA,EAAAE,EAAA,YAAA+G,EAAAhH,OAAA,EAA2B,YAAA,CAAAgH,EAAAhH,OAAA,EAC9BD,EAAA,EAAA6C,EAAAyE,GAAA,GAAAC,EAAA,CAAA,EA2BFvH,EAAA,CAAA,EAAAO,EAAA0G,EAAAzB,gBAAA,EAAA,GAAA,CAAA,EAOAxF,EAAA,EAAAO,EAAA0G,EAAApD,gBAAA,EAAA,EAAA,kBDfU2D,GAAYC,EAAA,EAAAC,cAAA,CAAA,CAAA,SASXlE,CAA6B,GAAA",
|
|
6
|
+
"names": ["CC_Account_ApiService", "baseUrl", "environment", "api", "http", "inject", "HttpClient", "listAccounts", "firstValueFrom", "get", "listAccountsByIdentity", "backfillIdentity", "post", "auditIdentityDuplicates", "refreshLocalAccounts", "getInstanceMapping", "getAccount", "accountKey", "getAccountUsage", "getAccountUsageHistory", "params", "query", "windowType", "push", "encodeURIComponent", "fromMs", "toMs", "qs", "length", "join", "refreshAccountUsage", "renameAccount", "body", "displayName", "undefined", "email", "patch", "factory", "\u0275fac", "providedIn", "SOCKET_EVENT_CC_ACCOUNT_USAGE_UPDATE", "SOCKET_EVENT_CC_ACCOUNT_LIST_UPDATE", "CC_Account_DataService", "account_AS", "inject", "CC_Account_ApiService", "socket_CS", "CCAP_Socket_ControlService", "globalError_CS", "CCAP_GlobalError_ControlService", "ngZone", "NgZone", "socketSubscription", "accounts_$", "signal", "accountUsageMap_$", "Map", "instanceMapping_$", "usageHistoryMap_$", "identityGroups_$", "isLoading_$", "loadError_$", "loadDashboardBootstrap", "__async", "set", "didFail", "accountsResp", "mappingResp", "groupsResp", "Promise", "all", "listAccounts", "getInstanceMapping", "listAccountsByIdentity", "items", "groups", "nextMap", "group", "primary", "accountKey", "mergedUsage", "err", "errorMessageOf", "showError", "loadIdentityGroups", "resp", "loadAccounts", "loadAccountUsage", "getAccountUsage", "next", "loadAccountUsageHistory", "params", "getAccountUsageHistory", "loadInstanceMapping", "refreshAccounts", "refreshResult", "refreshLocalAccounts", "refreshedKeys", "scannedPaths", "refreshAccountUsage", "result", "status", "surfacePullError", "source", "httpStatus", "bodyHead", "attemptedUrl", "networkMessage", "windowsUpserted", "email", "lines", "push", "message", "join", "Error", "errorDetails", "errorCode", "toUpperCase", "additionalContent", "renameAccount", "updated", "map", "a", "startLiveUpdates", "event$", "subscribe", "envelope", "run", "event", "handleAccountUsageUpdate", "payload", "handleAccountListUpdate", "stopLiveUpdates", "unsubscribe", "ngOnDestroy", "windowType", "newItem", "utilization", "undefined", "resetsAtMs", "lastObservedStatus", "observedAt", "lastObservedByCcapId", "lastObservedBySessionId", "replaced", "get", "filter", "item", "_payload", "rec", "String", "factory", "\u0275fac", "providedIn", "CC_AccountUsageChart_Util", "CHART_WIDTH", "CHART_HEIGHT", "COLOR_MAP", "five_hour", "seven_day", "seven_day_opus", "seven_day_sonnet", "extra_usage", "WINDOW_LABEL_MAP", "WINDOW_ORDER", "buildChart", "events", "minT", "Number", "POSITIVE_INFINITY", "maxT", "NEGATIVE_INFINITY", "validCount", "e", "observedAt", "utilization", "isFinite", "t", "Date", "parse", "lines", "map", "wt", "windowType", "label", "colorHex", "pathPoints", "hasData", "pointCount", "lastX", "lastY", "hasAnyData", "minTimeMs", "maxTimeMs", "range", "points", "push", "u", "Math", "max", "min", "sort", "a", "b", "coords", "p", "x", "y", "toFixed", "join", "length", "some", "l", "\u0275\u0275element", "\u0275\u0275classMap", "ctx_r1", "utilizationBarColorClass", "item_r1", "utilization", "\u0275\u0275styleProp", "utilizationPercent", "\u0275\u0275declareLet", "\u0275\u0275elementStart", "\u0275\u0275text", "\u0275\u0275elementEnd", "\u0275\u0275template", "CC_AccountUsageView_Component_For_3_Conditional_6_Template", "\u0275\u0275storeLet", "usageItemOfWindow", "windowType_r3", "\u0275\u0275advance", "compact", "\u0275\u0275classProp", "item_r4", "\u0275\u0275property", "\u0275\u0275textInterpolate1", "windowLabelOf", "\u0275\u0275conditional", "formatUtilization", "tmp_18_0", "undefined", "formatResetCountdown", "resetsAtMs", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_6_Conditional_0_Conditional_0_Template", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_6_Conditional_0_Conditional_1_Template", "line_r7", "pointCount", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_6_Conditional_0_Template", "hasData", "chartH", "line_r8", "lastY", "toFixed", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_16_Conditional_4_Template", "colorHex", "\u0275\u0275textInterpolate", "label", "\u0275\u0275pipeBind2", "chart_r9", "minTimeMs", "maxTimeMs", "\u0275\u0275repeaterCreate", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_6_Template", "_forTrack0", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_For_16_Template", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_Conditional_18_Template", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_Conditional_19_Template", "\u0275\u0275listener", "\u0275\u0275restoreView", "_r6", "\u0275\u0275nextContext", "\u0275\u0275resetView", "handleRefreshGraph", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_Conditional_22_Template", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_Conditional_23_Template", "\u0275\u0275repeater", "lines", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_2_Template", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Conditional_3_Template", "chart_$", "chart_r10", "hasAnyData", "_r5", "handleToggleGraph", "CC_AccountUsageView_Component_Conditional_5_Conditional_5_Template", "isGraphOpen_$", "CC_AccountUsageView_Component", "account_DS", "inject", "CC_Account_DataService", "accountKey", "showGraphToggle", "initiallyOpenGraph", "signal", "computed", "CC_AccountUsageChart_Util", "buildChart", "usageHistoryMap_$", "get", "chartViewBox", "CHART_WIDTH", "CHART_HEIGHT", "chartW", "chartMidY", "usageEffect", "effect", "key", "accountUsageMap_$", "has", "loadAccountUsage", "initialOpenEffect", "set", "__async", "next", "loadAccountUsageHistory", "windowType", "items", "item", "hasAnyUsageData", "length", "isFinite", "Math", "max", "min", "round", "diffMs", "Date", "now", "totalMinutes", "floor", "days", "hours", "minutes", "selectors", "inputs", "standalone", "features", "\u0275\u0275StandaloneFeature", "decls", "vars", "consts", "template", "rf", "ctx", "CC_AccountUsageView_Component_For_3_Template", "\u0275\u0275repeaterTrackByIdentity", "CC_AccountUsageView_Component_Conditional_4_Template", "CC_AccountUsageView_Component_Conditional_5_Template", "\u0275\u0275pureFunction0", "_c0", "CommonModule", "DatePipe", "encapsulation"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{I as l}from"./chunk-5IGMWTXT.js";import{C as d,p as n,xb as o,y as i}from"./chunk-TBMJSIBB.js";var p=(()=>{class s{baseUrl=`${l.api.baseUrl}/embedding-registry`;http=d(o);getList(e){let t=new URLSearchParams;e?.embeddingBackend!==void 0&&e.embeddingBackend.trim()!==""&&t.set("embeddingBackend",e.embeddingBackend.trim()),e?.modelId!==void 0&&e.modelId.trim()!==""&&t.set("modelId",e.modelId.trim()),e?.enabled===!0?t.set("enabled","true"):e?.enabled===!1&&t.set("enabled","false");let r=t.toString(),a=`${this.baseUrl}/list${r!==""?`?${r}`:""}`;return n(this.http.get(a))}getEntry(e){return n(this.http.get(`${this.baseUrl}/entry/${encodeURIComponent(e)}`))}getEvalSummary(e){return n(this.http.get(`${this.baseUrl}/entry/${encodeURIComponent(e)}/eval-summary`))}sync(){return n(this.http.post(`${this.baseUrl}/sync`,{}))}patchEntry(e,t){let r={};return t.enabled!==void 0&&(r.enabled=t.enabled),t.label!==void 0&&(r.label=t.label),n(this.http.patch(`${this.baseUrl}/patch/${encodeURIComponent(e)}`,r))}bulkSetEnabled(e,t){return n(this.http.patch(`${this.baseUrl}/bulk-enabled`,{ids:e,enabled:t}))}getScenarios(){return n(this.http.get(`${this.baseUrl}/scenarios`))}startTestRun(e){return n(this.http.post(`${this.baseUrl}/test-run`,{registryEntryIds:e.registryEntryIds,scenarioIds:e.scenarioIds,corpusDocumentId:e.corpusDocumentId}))}getTestRunStatus(e){return n(this.http.get(`${this.baseUrl}/test-run/${encodeURIComponent(e)}`))}getTestResults(e){return n(this.http.get(`${this.baseUrl}/test-results/${encodeURIComponent(e)}`))}static \u0275fac=function(t){return new(t||s)};static \u0275prov=i({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-S3YWAZOT.js.map
|