@agimon-ai/po-cloudflare 0.0.2-alpha.84 → 0.0.2-alpha.86
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/dist/{agent-DS0i8PXh.js → agent-ByyFRgYd.js} +1 -1
- package/dist/{agentSettled-x-o79BQN.js → agentSettled-CNTWltFP.js} +4 -4
- package/dist/{apiContracts-bi70zpFm.js → apiContracts-JzFccYqL.js} +3 -3
- package/dist/{approval-R0GK965c.js → approval-COB0xwwA.js} +2 -2
- package/dist/{approvalPrompt-Dzcca937.js → approvalPrompt-B0d2Z1CV.js} +1 -1
- package/dist/{approvalSession-BurJIcni.js → approvalSession-DIAcB46h.js} +1 -1
- package/dist/{artifactAdmin-Cg84GFlr.js → artifactAdmin-MI5O10ne.js} +6 -6
- package/dist/artifactFiles-AoUY2ThG.js +1 -0
- package/dist/{artifactsApi-nSekqLgD.js → artifactsApi-rQsS77q3.js} +2 -2
- package/dist/assets/assets/{CodeEditorView-DyehTPmW.js → CodeEditorView-DkIeHyrP.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-7LLEq7eQ.js → abnfDiagram-WEYOIA3C-ynPGX5Gd.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-B72QnnaV.js → architecture-WOLXFQ4H-BVHisG6R.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-jvGpdkOQ.js → architectureDiagram-ZHVYKT53-BN_lTQqN.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-BsTSNYTL.js → blockDiagram-RJAE7QA3-Q6-1IC_D.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-C2WdkrZU.js → c4Diagram-XDPPPE54-DNCf3jW8.js} +2 -2
- package/dist/assets/assets/channel-VRQYnVQk.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-jHOgJqUg.js → chunk-2E7WHVMD-DTubwNao.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-CSkVoLDu.js → chunk-4EMNKR2T-CNORN6dA.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-DXUrwWsH.js → chunk-55XCU76K-DxvhzpUL.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-C7Uo_M0Q.js → chunk-7S6XSTFO-CIxiENvy.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-CVlAOEat.js → chunk-AQDTSKZB-CpsntfT-.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-BzLYfF8C.js → chunk-DSNLSHJZ-4NKGiswH.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-ZI5_eRk9.js → chunk-HAGFOTED-DA90hRi5.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-kXJ7L9ul.js → chunk-HNE4Q36P-DtMnf82W.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-CFQxcC6E.js → chunk-NQOKRVIF-CfxNRopg.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP--X_wXnRI.js → chunk-UHW7PFBP-VBH7tObh.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-CxWYJ-aN.js → chunk-VQ5W62QI-DfHhCVTL.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-CKIHdcua.js → chunk-WQQL4CDK-64NSJnqr.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-BXSKYqQ5.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-CNrXB-gI.js → chunk-YZO67HFG-BURsTeAF.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DO-UBKB7.js → chunk-ZAUX2LTX-DoY8Qwp1.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-CSAJ32qi.js → chunk-ZCHMQSOR-CJzHetPB.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-IiBEbrda.js → classDiagram-v2-4MYWR3UA-oCUQQTQU.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-D6Hj7QgS.js → cose-bilkent-JH36ORCC-D8vYBkcp.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-hc-X44Q7.js → cynefin-EF2NZ3EQ-BLmlaHwV.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Deb17Ala.js → cynefinDiagram-WF24UDRP-BE2zzLrA.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-slqkAUGH.js → dagre-NK4GIZVX-BRPblGM9.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-C0mDz-DL.js → diagram-CBK3MWTC-Bm57bIuc.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-9QcDvMAc.js → diagram-I5XIIV2D-WpjL2qBa.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DwKroXpr.js → diagram-ODIL2UCW-DstGr4jZ.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-YzGQARPe.js → diagram-PFBEJUXE-Bvd0PsDz.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-CK1rdXGZ.js → diagram-RJA3I4VV-DC4K-DAM.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-Bi6NFXDk.js → diagram-TYUNFSNR-JAVEdwCY.js} +2 -2
- package/dist/assets/assets/{dist-CCRwRwWl.js → dist-AEuin7Cr.js} +2 -2
- package/dist/assets/assets/{dist-6Ayuc6fu.js → dist-BB2NDo4_.js} +2 -2
- package/dist/assets/assets/{dist-DTzw2_vJ.js → dist-BCdFGYQx.js} +2 -2
- package/dist/assets/assets/{dist-MQtoFHLc.js → dist-BSCZHt8W.js} +2 -2
- package/dist/assets/assets/{dist-DBXV7yMw.js → dist-C2VMiFQY.js} +2 -2
- package/dist/assets/assets/{dist-DEGfRkUa.js → dist-CBi3vLJl.js} +2 -2
- package/dist/assets/assets/{dist-D8IAXiyB.js → dist-CRb9s6nY.js} +2 -2
- package/dist/assets/assets/{dist-BdcrSiRT.js → dist-D9LHajnC.js} +2 -2
- package/dist/assets/assets/{dist-D1Kt8M1d.js → dist-DSGs7bKM.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BDbaFUy4.js → ebnfDiagram-V4P3TTPT-DihV2nso.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-BORoT8oP.js → elk-QONTBCTQ-C-DP3bKH.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-30HxuCQQ.js → erDiagram-KYQIGQAA-uX7cX0Pv.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-WxAMftin.js → eventmodeling-K75KTNOO-_8QMEKdJ.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-wxyTDGEd.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-BKTDiXol.js → ganttDiagram-R7GPNTJY-hyDvUvVj.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-BxVCjB4C.js → gitGraph-VSP46ZUC-CRdWO5rg.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-DNth6T3B.js → gitGraphDiagram-PDYL7XHY-B7_2njnN.js} +2 -2
- package/dist/assets/assets/index-B-2dpEM4.js +256 -0
- package/dist/assets/assets/{info-OHQRW6UA-BBdVZ5sm.js → info-OHQRW6UA-o4kxhlhp.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-xI8nu8k4.js → infoDiagram-MVDRKAX5-D1P34RLm.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-BG1t0Moi.js → ishikawaDiagram-HPEHV2GE-CtpnjWXV.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-jKZscUCP.js → journeyDiagram-BOSHW7O7-Lik3T1t0.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-CzB6MLvN.js → kanban-definition-FNSA4HC5-C03oQvg9.js} +2 -2
- package/dist/assets/assets/{line-DgDVjEIK.js → line-Bn4tDd4J.js} +2 -2
- package/dist/assets/assets/{linear-hFuQXP8W.js → linear-wvgzI9r2.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-Cawcj1eS.js → mermaid-parser.core-RFbFnqwu.js} +4 -4
- package/dist/assets/assets/{mermaid.core-D1lK3Nqu.js → mermaid.core-BO7dE0av.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-BeFUfdkK.js → mindmap-definition-6OY57UG3-BFqpuPqL.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-C6C2p116.js → packet-JDAUHWVQ-CQ5QD8zx.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-onb7YZ5W.js → pegDiagram-ECIUJNBX-8LdFk1sJ.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-DzNEYOjy.js → pie-XZMESJXO-D_57SbCU.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-HMTBnsl2.js → pieDiagram-GNMPY74T-myoHDQic.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CKAdjR8s.js → quadrantDiagram-D57K4MC3-D0-GRZLg.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-Dpa_aV4V.js → radar-ABXABTNO-RSiJnJJi.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-D4OCm26Q.js → railroad-I3PHUGI6-DeDlIdwN.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-D5ba_qIJ.js → railroad-abnf-LNEFI6M7-CgqPBMfV.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-D-zwMd2z.js → railroad-ebnf-DWYD2UWJ-CclYsYaS.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-EDS_klms.js → railroad-peg-JR7BVNR7-BmwsXM-V.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-Crk8rnkG.js → railroadDiagram-Y72NRBL7-BV9BYRnp.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-l_6pnkwQ.js → requirementDiagram-EQYSW5RA-CehHHN5D.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DktVOdaM.js → sankeyDiagram-SY24JHO5-B3Bat7MW.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-zF87QNAj.js → sequenceDiagram-BLEHNHQU-Dnxt0WF5.js} +2 -2
- package/dist/assets/assets/{src-DPKY1yE3.js → src-B6ecRe1w.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-CfvUC9sy.js → stateDiagram-v2-A6IESKWZ-D83wPcye.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-B2uv8MJP.js → swimlanes-B3ENRKFQ-4-uor4aq.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BGcvTNeG.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-BQgI2uAB.js → timeline-definition-JXYKGLGB-DWdoPd7k.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-CnnkeOtg.js → treeView-D4JQ5SDB-BXksAmt2.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-CSHp7FUq.js → treemap-SAJKECNS-BGszskVz.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C-zdey6Q.js → usecaseDiagram-WPOLBNNX-CEu1fQKo.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-D1RVo7Yl.js → vennDiagram-Q3Y3IDCW-BYcDk-m0.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-jLenXH5j.js → wardley-7MLQ67FV-dwyA020S.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CaJ7LO3d.js → wardleyDiagram-IVAIDKWA-DX0NSUoq.js} +2 -2
- package/dist/assets/assets/{webpack-RQ-pOsb8.js → webpack-C4Tbwqdn.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-CvA2wYcx.js → xychartDiagram-4URNHDU4-Dm0tr3uZ.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +1 -1
- package/dist/assets/plugins/chunks/po-web-runtime-DWhVOIt0.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.8b3f37d9-C5Etwv2-.js +3 -0
- package/dist/assets/plugins/slots/artifacts.47d00f81-DhWTAcln.js +1 -0
- package/dist/assets/plugins/slots/author.1a07727d-CJOPvry5.js +93 -0
- package/dist/assets/plugins/slots/{autocompact.dd97d013-BrCbK4Kx.js → autocompact.9a92993d-CxqybO4a.js} +1 -1
- package/dist/assets/plugins/slots/{backdrop-bamboo.04604501-DLm0Q3vw.js → backdrop-bamboo.efdd4d7c-L59DM3jX.js} +1 -1
- package/dist/assets/plugins/slots/browse.131d479c-Cw4Mhefz.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.939bbfff-Dsnr_Ok2.js +7 -0
- package/dist/assets/plugins/slots/calendar.a920088e-CW572v9M.js +2 -0
- package/dist/assets/plugins/slots/{codemode.8eaee717-0oBfWJnw.js → codemode.782e5bb1-CHiS1bpG.js} +5 -5
- package/dist/assets/plugins/slots/domain.21790b66-BSJuBLOI.js +1 -0
- package/dist/assets/plugins/slots/{edit.385c9aa9-D8UcbK41.js → edit.c7c85129-B589XAgA.js} +3 -3
- package/dist/assets/plugins/slots/{files.daf34ed8-D3XLkVWH.js → files.bbcef824-OI6-oJL6.js} +2 -2
- package/dist/assets/plugins/slots/goal.95aff482-BQr-RSgu.js +1 -0
- package/dist/assets/plugins/slots/grep.3dfd3214-DLkFhCy3.js +1 -0
- package/dist/assets/plugins/slots/help.c7b368c8-hMEVEg9s.js +3 -0
- package/dist/assets/plugins/slots/log.33bc7d38-BEEVJE4t.js +4 -0
- package/dist/assets/plugins/slots/mcp.59c68bcb-DJhVjZ2F.js +55 -0
- package/dist/assets/plugins/slots/{plan.01c64f5c-Dj3B4EP3.js → plan.905fb054-DWXdcmOf.js} +2 -2
- package/dist/assets/plugins/slots/profile.ea55f5e1-BvCtg0Nh.js +17 -0
- package/dist/assets/plugins/slots/{prompts.723d7748-Du_RKitn.js → prompts.9957cc84-BpgIM246.js} +2 -2
- package/dist/assets/plugins/slots/{read.46bf6536-Dtn8BnHZ.js → read.30a617e7-CBoaumRE.js} +1 -1
- package/dist/assets/plugins/slots/runner.9f3559b0-kain6L7f.js +9 -0
- package/dist/assets/plugins/slots/scaffold.6ee623c2-81V3KXTG.js +1 -0
- package/dist/assets/plugins/slots/session-mcp.d2f3e9eb-DUkEqwoy.js +2 -0
- package/dist/assets/plugins/slots/{sessions.09d5cdbb-CvfpOhKv.js → sessions.d6812dc8-DMiH81FM.js} +1 -1
- package/dist/assets/plugins/slots/skill.f506a5ea-CgZFvoiK.js +4 -0
- package/dist/assets/plugins/slots/{space.fa184827-C9fElry9.js → space.1260a175-BonLhQRx.js} +1 -1
- package/dist/assets/plugins/slots/subagents.d796413d-rvh0bpZ7.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.50a12814-CMq7C4Ck.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.323fb323-D6olyyuw.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.2d9ffb73-BvTVyeLZ.js +1 -0
- package/dist/assets/plugins/slots/{vault.ac9935c8-CkM08O8Q.js → vault.01657352-Bu4MTSz9.js} +1 -1
- package/dist/assets/plugins/slots/voice.31d76794-BI4TxlO-.js +1 -0
- package/dist/assets/plugins/slots/{web-search.81622d74-Cfmby7gg.js → web-search.6f84bd6e-B2RmNmLD.js} +1 -1
- package/dist/assets/plugins/slots/{workflows.562ad1f1-YR_QeyYe.js → workflows.1350c068-Bxe2yPJK.js} +6 -6
- package/dist/{atomicJson-DD5U5tjQ.js → atomicJson-CmJwr5aB.js} +2 -2
- package/dist/{backgroundWork-BBHkedFE.js → backgroundWork-D2r2ApKO.js} +1 -1
- package/dist/{browser-BYWSPAEE.js → browser-Dp4r9ITk.js} +1 -162
- package/dist/browserSealedChannel-DePvxJsk.js +218 -0
- package/dist/{childProcess-_K0eEVap.js → childProcess-DqyLvuql.js} +1 -1
- package/dist/{codemode-D0N0nnAW.js → codemode-BuBaBMms.js} +1 -1
- package/dist/{contracts-CDZL6Oxi.js → contracts-BruHxoQY.js} +3 -3
- package/dist/{contracts-Dug1eXOZ.js → contracts-DOCSa5kc.js} +3 -3
- package/dist/{cordisHost-BuVg1RmQ.js → cordisHost-BmTJV5xN.js} +1 -1
- package/dist/{delegation-Cx9cFQWQ.js → delegation-CGddof1O.js} +1 -1
- package/dist/{exports-_jolwyKx.js → exports-BOJm983N.js} +9 -9
- package/dist/exports-Bi7NFPmm.js +1 -0
- package/dist/{exports-mbRsjI7B.js → exports-DClMdstQ.js} +5 -5
- package/dist/{exports-DFvm018C.js → exports-DRrtX5Vq.js} +2 -2
- package/dist/{exports-BAOR4mxs.js → exports-D_Q13ii9.js} +2 -2
- package/dist/{extensionFile-CYT5OGC3.js → extensionFile-BbUWH56d.js} +1 -1
- package/dist/{harnessState-BDVwwP_X.js → harnessState-keegJSRn.js} +12 -12
- package/dist/{harnessStore-CuH4R3lM.js → harnessStore-BCOLX-sj.js} +4 -4
- package/dist/{help-DeJ6qHec.js → help-BKuiJbo4.js} +1 -1
- package/dist/{http-C_eQIrFr.js → http-B_mwqZOZ.js} +1 -1
- package/dist/{hubChannel-DCtuNjLW.js → hubChannel-BjkmXIFn.js} +1 -1
- package/dist/{hubRevisions-D34aServ.js → hubRevisions-NvGDZ9H-.js} +1 -1
- package/dist/{index.edge-q9_rsJ__.js → index.edge-D5FA6HG9.js} +1 -1
- package/dist/{layeredConfig-D0LKjKAB.js → layeredConfig-MDzUPvZU.js} +6 -6
- package/dist/{mcpProjection-D4hUK9Ip.js → mcpProjection-CFh6L27_.js} +1 -1
- package/dist/{notification-70P3QXp_.js → notification-qX1yMuki.js} +1 -1
- package/dist/{packageApi-C0ZZekoc.js → packageApi-CDIltnxE.js} +1 -1
- package/dist/{piConfig-ByJz4nz4.js → piConfig-D1tdRgOm.js} +4 -4
- package/dist/piSettings-nr9wNpN3.js +1 -0
- package/dist/{platform-D-bT8M_0.js → platform-DSwKU9ZI.js} +1 -1
- package/dist/{pluginProtocol-CzYwk73s.js → pluginProtocol-BG6b3BRq.js} +1 -1
- package/dist/pluginProtocol-yDZ8pRcW.js +1 -0
- package/dist/{presetConfig-CmSIhJqZ.js → presetConfig--KiLG1qz.js} +11 -5
- package/dist/{profileSources-C7MOMfYl.js → profileSources-CPM5ivrv.js} +2 -2
- package/dist/{protocol-CKiJ5fEX.js → protocol-DamNEW8l.js} +1 -1
- package/dist/{scaffoldRegistry-9cs3prfq.js → scaffoldRegistry-kYdKEcNl.js} +2 -2
- package/dist/{server-D9c3-U6e.js → server-B7_c_cDe.js} +20 -17
- package/dist/{server-BQNOdN4z.js → server-BGYjbBIt.js} +6 -6
- package/dist/{server-DdbyZYJ2.js → server-BOzlbKAE.js} +22 -13
- package/dist/{server-DGxxn0_W.js → server-BQq3Jiv0.js} +7 -7
- package/dist/{server-pwlXnMn7.js → server-BejlQPdA.js} +6 -6
- package/dist/{server-CajhvVg3.js → server-BkcKjX7F.js} +7 -7
- package/dist/{server-Cpgz_PWe.js → server-BsNHQ8WG.js} +3 -3
- package/dist/{server-BlVvrfF3.js → server-C0MJyzKL.js} +8 -8
- package/dist/{server-Co56aIHd.js → server-CEc8Ihom.js} +11 -11
- package/dist/{server-BR2dz5sp.js → server-CG42Oief.js} +9 -9
- package/dist/{server-DIqAAMfa.js → server-CJlKYuCe.js} +9 -9
- package/dist/{server-DqtE9UlZ.js → server-CNsWwpaq.js} +3 -3
- package/dist/{server-DP-jIlmO.js → server-C_SqjSOo.js} +11 -11
- package/dist/{server-CBbj4vTa.js → server-Ca7zIv1r.js} +3 -3
- package/dist/{server-CEXhVRwt.js → server-Cc4Q5371.js} +10 -10
- package/dist/{server-Df4r6VGG.js → server-CloiJy6e.js} +5 -5
- package/dist/{server-BnnNFSmD.js → server-CzIT9-vm.js} +8 -8
- package/dist/{server-DCFnTH-x.js → server-DCR9TkiF.js} +14 -14
- package/dist/{server-DbP7iHPZ.js → server-DGHXxAZ4.js} +5 -5
- package/dist/{server-zu-Zgi3L.js → server-DLDy27ln.js} +8 -8
- package/dist/{server-DlLAMX_l.js → server-DNobdzqi.js} +3 -3
- package/dist/{server-Bgnb7gG-.js → server-DUtOJXPP.js} +17 -17
- package/dist/{server-CGyF3Y2t.js → server-DcQcdoRV.js} +3 -3
- package/dist/{server-Bcgp7PIw.js → server-Dv5xfOPV.js} +8 -16
- package/dist/{server-Ca7u6iOG.js → server-DvA_6yYM.js} +7 -7
- package/dist/{server-Dt6jd3eW.js → server-DwGoYlCO.js} +28 -22
- package/dist/{server-8za7Nb_p.js → server-DwcGU_w0.js} +2 -2
- package/dist/{server-CmW0--Nv.js → server-PLUom2Y4.js} +4 -4
- package/dist/{server-BX_sDPqW.js → server-Q1TL9KHP.js} +12 -12
- package/dist/{server-DoScfh4J.js → server-UYTrnyEW.js} +13 -13
- package/dist/{server-CMH-axK1.js → server-WnlDOaaZ.js} +3 -3
- package/dist/{server-C9S9if7K.js → server-d4ezexkw.js} +8 -8
- package/dist/{server-BwD8o-EO.js → server-fI7DXkwx.js} +9 -9
- package/dist/{server-3WojhHFE.js → server-ofmaANh3.js} +20 -14
- package/dist/{server-CsScoQcp.js → server-ohnKHnqD.js} +4 -4
- package/dist/{server-Cn-vZ4ly.js → server-qO_fZZC6.js} +81 -33
- package/dist/{server-KH_vLxM4.js → server-w7qileIW.js} +3 -3
- package/dist/{server-DUtJRxx0.js → server-yZn0y4Ta.js} +15 -13
- package/dist/{serverPlugin-CJtFKP76.js → serverPlugin-CiVvJBFN.js} +17 -7
- package/dist/{sessionConfig-BHoE7hiv.js → sessionConfig-DV9B574n.js} +13 -13
- package/dist/{space-WVNdNN7e.js → space-wPKqlKM-.js} +5 -5
- package/dist/{type-LEm-Przh.js → type-6WRonWSM.js} +23 -40
- package/dist/{validation-Dk6zmByY.js → validation-C6kgYzUG.js} +2 -2
- package/dist/{vaultSettings-BbdfJtLT.js → vaultSettings-D6sS8eHJ.js} +1 -1
- package/dist/{voiceTools-Ck1vJ-qp.js → voiceTools-CC2TDPd1.js} +1 -1
- package/dist/web-DVI_lYRF.js +4 -0
- package/dist/worker.js +460 -396
- package/dist/{workflow-BQHVtsyG.js → workflow-DrkqIF9E.js} +1 -1
- package/dist/{workflowServices-Ce6xW4RP.js → workflowServices-DOi-cBJe.js} +2 -2
- package/package.json +49 -49
- package/dist/artifactFiles-Ckv0_GBz.js +0 -1
- package/dist/assets/assets/channel-Dilj5YP7.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-kK__NO4h.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-pQPoCobd.js +0 -1
- package/dist/assets/assets/index-C68h3va3.js +0 -256
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-0ypcu0uw.js +0 -9
- package/dist/assets/plugins/chunks/po-web-runtime-C-6-Rprr.js +0 -1
- package/dist/assets/plugins/slots/approval.293d9a00-DVnx43-k.js +0 -3
- package/dist/assets/plugins/slots/artifacts.24567664-Dsj1OtVT.js +0 -1
- package/dist/assets/plugins/slots/author.48eac256-Cr8yccCT.js +0 -93
- package/dist/assets/plugins/slots/browse.cb8b3e01-BRfvw2p6.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.36d7400b-DrI7xiqJ.js +0 -7
- package/dist/assets/plugins/slots/calendar.00cc24fe-utcYs8bS.js +0 -2
- package/dist/assets/plugins/slots/domain.5e95fc37-DJyv7MCr.js +0 -1
- package/dist/assets/plugins/slots/goal.af9d3f50-DlmoFhc5.js +0 -1
- package/dist/assets/plugins/slots/grep.02052cdc-BwX6MyWZ.js +0 -1
- package/dist/assets/plugins/slots/help.df615585-ByXu3edO.js +0 -3
- package/dist/assets/plugins/slots/log.a86eb6d0-BoK7Agu-.js +0 -4
- package/dist/assets/plugins/slots/mcp.974af249-BmAcosBX.js +0 -55
- package/dist/assets/plugins/slots/profile.48851a1d-Ddem7X8p.js +0 -17
- package/dist/assets/plugins/slots/runner.53e9bd76-Bo18TpTv.js +0 -9
- package/dist/assets/plugins/slots/scaffold.f4740e70-CsZM392r.js +0 -1
- package/dist/assets/plugins/slots/session-mcp.e0b15a89-Q3kt8mfN.js +0 -2
- package/dist/assets/plugins/slots/skill.086701a4-xpM93FVb.js +0 -4
- package/dist/assets/plugins/slots/subagents.5cb761ff-DFX-yRuh.js +0 -7
- package/dist/assets/plugins/slots/template-advanced.fe838aa3-CBtnuZFl.js +0 -1
- package/dist/assets/plugins/slots/template-desktop.99bc49e1-BnCY2bMo.js +0 -7
- package/dist/assets/plugins/slots/template-elegant.68738440-Do-6RsF_.js +0 -1
- package/dist/assets/plugins/slots/voice.15fd8d84-D-rAfc09.js +0 -1
- package/dist/exports-BgVdXxEv.js +0 -1
- package/dist/piSettings-9GtxPU4u.js +0 -1
- package/dist/pluginProtocol-bqyjtLgJ.js +0 -1
- package/dist/sealedChannel-BeWNTWys.js +0 -27
- package/dist/web-Dpk-XW_b.js +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,$n as t,Bi as n,Ca as r,Di as i,Dn as a,Fa as o,Fr as s,Ft as c,Ha as l,Hn as u,Ia as d,Ii as f,Ir as p,It as m,Ji as h,Jt as g,Ki as _,Lt as v,Mn as y,Qi as b,Qn as ee,Rt as x,Ua as te,Ut as S,Vt as C,Wa as ne,Wi as re,Xa as ie,Yi as ae,Za as oe,Zi as se,Zt as w,_r as ce,aa as T,br as E,cr as le,da as D,fr as ue,gr as O,hr as k,in as A,ir as de,ja as fe,ka as pe,ki as me,la as he,mr as j,na as ge,oa as M,pa as _e,qi as ve,qn as ye,qt as N,ra as P,ri as be,rr as xe,ti as F,tn as Se,tr as Ce,un as we,vr as I,xr as L,yr as R,zi as Te}from"../chunks/po-web-runtime-C-6-Rprr.js";var z={id:`browser-control`,label:`browser control`,detail:`choose which browser Po opens for web tasks, and what happens if it cannot start`,order:50,fields:[{id:`engine`,label:`Browser engine`,kind:`select`,keyPath:[`browse`,`engine`],placeholder:`Default (Playwright Chromium)`,detail:`CloakBrowser gives each profile its own steady fingerprint. Changes apply to the next browser Po opens.`,options:[{value:`cloak`,label:`CloakBrowser`},{value:`chrome-for-testing`,label:`Chrome for Testing`}]},{id:`fallback`,label:`If CloakBrowser can't start`,kind:`select`,keyPath:[`browse`,`fallback`],placeholder:`Default (stop and show the error)`,detail:`Chrome for Testing works without fingerprint protection. Po says so each time it falls back.`,options:[{value:`chrome-for-testing`,label:`Use Chrome for Testing`}]}]},Ee=`/api/plugins/browse/profiles`,De=`/api/plugins/browse/remote`,Oe=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`});function ke(t){let{profiles:n,error:i,confirming:o,deleting:s,openMenu:c}=t;return x(`div`,{"data-testid":`browser-profiles`,className:`@container flex flex-col gap-3`,children:[i?v(`p`,{role:`alert`,className:`text-sm text-po-red`,children:i}):null,n===void 0?v(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading profiles…`}):n.length===0?v(_e,{title:`No browser profiles yet`,description:`Po saves one when a task signs in to a site.`,className:`py-12`}):v(`ul`,{"aria-label":`Browser profiles`,className:`grid grid-cols-1 gap-3 @lg:grid-cols-2 @3xl:grid-cols-3`,children:n.map(e=>v(a,{asChild:!0,className:`flex min-w-0 items-start gap-3 py-3 pr-1 pl-3`,children:x(`li`,{"data-testid":`browser-profile-${e.name}`,"aria-busy":s===e.name,children:[v(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-po-deep`,children:v(r,{"aria-hidden":!0,className:`size-4 text-po-dim`})}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[v(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.name}),v(`span`,{className:`truncate text-sm text-po-dim`,children:s===e.name?`Deleting…`:e.lastUsedAt?`Last used ${Oe.format(new Date(e.lastUsedAt))}`:`Updated ${Oe.format(new Date(e.updatedAt))}`})]}),x(P,{modal:!1,defaultOpen:c===e.name,children:[v(D,{asChild:!0,children:v(F,{variant:`ghost`,size:`icon`,"aria-label":`Manage ${e.name}`,disabled:s!==void 0,children:v(A,{className:`size-3.5`})})}),v(T,{align:`end`,children:x(M,{variant:`destructive`,onSelect:()=>t.onAskDelete?.(e.name),children:[v(be,{className:`size-3.5`}),`Delete profile`]})})]})]})},e.name))}),v(_,{open:o!==void 0,onOpenChange:e=>e?void 0:t.onCancelDelete?.(),children:x(h,{children:[v(b,{children:x(e,{children:[`Delete `,o,`?`]})}),v(ve,{children:v(ae,{children:`Its saved sign-ins, cookies and fingerprint are removed. Po signs in again the next time a task needs it.`})}),x(se,{children:[v(F,{onClick:t.onCancelDelete,children:`Keep profile`}),v(F,{variant:`danger-outline`,disabled:s!==void 0,onClick:()=>o===void 0?void 0:t.onConfirmDelete?.(o),children:`Delete profile`})]})]})})]})}async function Ae(e,t){let n=await e.json().catch(()=>void 0);return typeof n?.error==`string`?n.error:t}function je({request:e,requestWithStepUp:t}){let[n,r]=g(),[i,a]=g(),[o,s]=g(),[c,l]=g(),u=C(async()=>{try{let t=await e(Ee);if(!t.ok)throw Error(await Ae(t,`Po could not read your browser profiles.`));r((await t.json()).profiles),a(void 0)}catch(e){r(e=>e??[]),a(e instanceof Error?e.message:`Po could not read your browser profiles.`)}},[e]);S(()=>{u()},[u]);let d=async e=>{l(e);try{let n=await t(`${Ee}/${encodeURIComponent(e)}`,{method:`DELETE`});a(n.ok?void 0:await Ae(n,`Po could not delete this profile.`))}catch(e){a(e instanceof Error?e.message:`Po could not delete this profile.`)}finally{s(void 0),l(void 0),await u()}};return v(ke,{profiles:n,error:i,confirming:o,deleting:c,onAskDelete:s,onCancelDelete:()=>s(void 0),onConfirmDelete:e=>void d(e)})}var B=`__default`;function Me({values:e,loading:n,saving:r,error:i,onChange:a,onRetry:o,profiles:s}){return x(`div`,{"data-testid":`browser-settings`,className:`flex min-w-0 flex-col gap-10`,children:[x(I,{children:[x(E,{children:[v(L,{children:`Engine`}),v(R,{children:`Applies to every workspace. Changes apply to the next browser Po opens.`})]}),i?x(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v(`p`,{role:`alert`,className:`text-sm text-po-red`,children:i}),v(F,{size:`sm`,variant:`ghost`,disabled:r,onClick:o,children:`Try again`})]}):null,v(le,{"aria-busy":n||r||void 0,children:z.fields.map(i=>{let o=i.id,s=e[o];return x(j,{"data-testid":`browser-setting-${o}`,changed:s!==void 0,className:`items-start`,children:[x(O,{className:`gap-1`,children:[v(ce,{className:`flex min-h-6 items-center`,children:i.label}),i.detail?v(k,{children:i.detail}):null]}),x(ee,{value:s??B,disabled:n||r,onValueChange:e=>a?.(o,e===B?null:e),children:[v(xe,{"aria-label":i.label,className:`w-full text-sm sm:w-64`,children:v(de,{placeholder:i.placeholder})}),x(t,{children:[v(Ce,{value:B,children:i.placeholder}),(i.options??[]).map(e=>v(Ce,{value:e.value,children:e.label},e.value))]})]})]},o)})}),r||n&&!i?v(`p`,{role:`status`,className:`text-sm text-po-dim`,children:r?`Saving on your computer…`:`Loading browser settings…`}):null]}),x(I,{children:[x(E,{children:[v(L,{children:`Profiles`}),v(R,{children:`Each profile keeps its own sign-ins, cookies and fingerprint.`})]}),s]})]})}function Ne(e){let t=Math.round(e/60);if(t<60)return`${t} min`;let n=t%60;return n===0?`${Math.floor(t/60)} h`:`${Math.floor(t/60)} h ${n} min`}function Pe(e,t){return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,timeZone:t}).format(new Date(e))}function Fe({status:e,loading:t,error:n,onRetry:r,timeZone:i}){let a=e?Math.min(e.usedSeconds,e.limitSeconds):0,o=e!==void 0&&e.usedSeconds>=e.limitSeconds,s=e?Pe(e.resetsAt,i):``,c=e?Math.round(e.idleSeconds/60):0;return x(`div`,{"data-testid":`remote-browser-settings`,className:`flex min-w-0 flex-col gap-10`,children:[x(I,{children:[x(E,{children:[v(L,{children:`Today`}),v(R,{children:`Po Cloud runs the browser for you. Every session on this account shares one daily allowance.`})]}),n?x(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v(`p`,{role:`alert`,className:`text-sm text-po-red`,children:n}),v(F,{size:`sm`,variant:`ghost`,onClick:r,children:`Try again`})]}):null,e&&!e.enabled?v(ue,{children:`The browser is turned off on this host, so Po does web tasks without one.`}):null,x(le,{"aria-busy":t||void 0,children:[x(j,{"data-testid":`remote-browser-time`,className:`items-start`,children:[x(O,{className:`gap-2`,children:[v(ce,{children:`Browser time`}),v(k,{children:e?`Resets at ${s} (${e.resetsAt.slice(11,16)} UTC).`:`Resets every day.`}),v(u,{"aria-label":`Browser time used today`,value:e&&e.limitSeconds>0?a/e.limitSeconds*100:0})]}),v(`span`,{className:`shrink-0 text-base font-semibold tabular-nums text-po-hi`,children:e?`${Ne(a)} of ${Ne(e.limitSeconds)}`:`…`})]}),x(j,{"data-testid":`remote-browser-open`,className:`items-start`,children:[x(O,{className:`gap-1`,children:[v(ce,{children:`Open now`}),v(k,{children:e?`Each session opens its own browser. It closes ${c} ${c===1?`minute`:`minutes`} after Po last uses it, and that time counts too.`:`Each session opens its own browser.`})]}),v(`span`,{className:`shrink-0 text-base font-semibold tabular-nums text-po-hi`,children:e?`${e.open} of ${e.openLimit}`:`…`})]})]}),o?x(`p`,{role:`status`,"data-testid":`remote-browser-used-up`,className:`text-sm text-po-text`,children:[`Today's browser time is used up. Po can browse again at `,s,`.`]}):null,t&&!n?v(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading browser use…`}):null]}),x(I,{children:[x(E,{children:[v(L,{children:`Sign-ins`}),v(R,{children:`A session's browser keeps its tabs and sign-ins while it is open. Once it closes they are gone, and you sign in again the next time a site needs it.`})]}),v(ue,{children:`Saved browser profiles are not available on Po Cloud yet.`})]})]})}var Ie=`/api/settings`,Le=`/api/settings/value`,Re=`The request did not reach Po on your computer.`;function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function ze(e){let t=await e.json().catch(()=>void 0);if(!e.ok)return{ok:!1,error:V(t)&&typeof t.error==`string`?t.error:`Po answered ${e.status}.`};if(!V(t)||!V(t.values)||!V(t.hashes)||typeof t.hashes.host!=`string`)return{ok:!1,error:`Po answered with no configuration.`};let n={};for(let e of z.fields){let r=t.values[e.keyPath.join(`.`)];V(r)&&typeof r.value==`string`&&r.origin!=="default"&&(n[e.id]=r.value)}return{ok:!0,config:{values:n,hash:t.hashes.host}}}async function H(e){let t=new URLSearchParams({repoRoot:``});for(let e of z.fields)t.append(`key`,e.keyPath.join(`.`));try{return await ze(await e(`${Ie}?${t.toString()}`))}catch{return{ok:!1,error:Re}}}async function Be(e,t,n,r){let i=z.fields.find(e=>e.id===t);if(!i||n!==null&&!i.options?.some(e=>e.value===n))return{ok:!1,error:`Choose one of the browser settings offered.`};try{let t=await e(Le,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({repoRoot:``,scope:`host`,keyPath:i.keyPath,value:n,expectedHash:r})});return t.status===409?{ok:!1,conflict:!0,error:`The settings changed on your computer. Try again.`}:t.ok?await H(e):await ze(t)}catch{return{ok:!1,error:Re}}}function Ve({request:e,requestWithStepUp:t}){let[n,r]=g(),[i,a]=g(!0),[o,s]=g(!1),[c,l]=g(),u=N(!1),d=N(!1),f=C(async()=>{a(!0);let t=await H(e);u.current&&(t.ok?(r(t.config),l(void 0)):(r(void 0),l(t.error)),a(!1))},[e]);S(()=>(u.current=!0,f(),()=>{u.current=!1}),[f]);let p=async(a,o)=>{if(d.current||i||!n)return;d.current=!0,s(!0),l(void 0);let c=await Be(t,a,o,n.hash);if(u.current){if(c.ok)r(c.config);else{if(c.conflict){let t=await H(e);if(!u.current)return;r(t.ok?t.config:void 0)}l(c.error)}d.current=!1,s(!1)}};return{values:n?.values??{},loading:i||!n,saving:o,error:c,onRetry:()=>void f(),onChange:(e,t)=>void p(e,t)}}function He(e){return v(Me,{...Ve(e),profiles:v(je,{...e})})}function Ue(e){let{request:t}=e,[n,r]=g({kind:`checking`}),i=C(async()=>{try{let e=await t(De);e.status===404?r({kind:`local`}):e.ok?r({kind:`remote`,status:await e.json()}):r({kind:`remote`,error:`Po could not read today's browser use.`})}catch{r(e=>e.kind===`remote`?{...e,error:`Po could not read today's browser use.`}:{kind:`local`})}},[t]);return S(()=>{i()},[i]),n.kind===`local`?v(He,{...e}):n.kind===`checking`?v(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading browser settings…`}):v(Fe,{status:n.status,error:n.error,onRetry:()=>void i()})}var We=te({label:`Browser`,detail:`The browser Po uses for web tasks, and how long your sign-ins last.`,order:z.order,icon:w,component:Ue}),Ge=ne({...z,icon:w}),Ke={slot:`author.open-source`,parse(e){if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.createTab==`function`?t:null}};function qe(e){return e.sessionId===null?void 0:e.slotData?.(Ke)?.[0]?.data}var Je=`browse_activity`,Ye=`browse`;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Xe=new Set([`active`,`idle`,`asleep`,`crashed`]);function Ze(e){return U(e)&&typeof e.id==`string`&&typeof e.title==`string`&&typeof e.url==`string`&&typeof e.current==`boolean`&&typeof e.lastAccessedAt==`number`}function Qe(e){return!U(e)||typeof e.id!=`string`||typeof e.name!=`string`||!Xe.has(e.state)||e.window!==`headed`&&e.window!==`headless`||typeof e.lastUsedAt!=`number`||!Array.isArray(e.tabs)?null:{...e,tabs:e.tabs.filter(Ze)}}function $e(e){return!U(e)||!Array.isArray(e.identities)?null:{identities:e.identities.map(Qe).filter(e=>e!==null)}}function et(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function tt(e){return U(e)?e.state===`ok`&&typeof e.src==`string`&&e.src.startsWith(`data:image/`)?{state:`ok`,src:e.src,...et(e.seq)?{seq:e.seq}:{}}:e.state===`unchanged`&&et(e.seq)?{state:`unchanged`,seq:e.seq}:e.state===`closed`||e.state===`timeout`?{state:e.state}:{state:`error`}:{state:`error`}}function nt(e){return U(e)&&e.ok===!0&&typeof e.path==`string`&&e.path!==``?{ok:!0,path:e.path}:U(e)&&e.ok===!1&&typeof e.message==`string`?{ok:!1,message:e.message}:{ok:!1,message:`Po could not take the snapshot.`}}function rt(e,t,n){if(!(U(e)&&e.closed===t.length))return n.length>1?`Po could not close these browsers.`:n.length===1?`Po could not close this browser.`:t.length===1?`Po could not close this tab.`:`Po could not close every tab.`}function it({identities:e,hidden:t}){return t.length===0?e:e.filter(e=>!t.includes(`identity:${e.id}`)).map(e=>({...e,tabs:e.tabs.filter(e=>!t.includes(`tab:${e.id}`))}))}function at(e){return`${e} ${e===1?`tab`:`tabs`}`}function ot(e){let t=t=>e.filter(e=>e.state===t).length;return[t(`active`)>0?`${t(`active`)} working`:``,t(`idle`)>0?`${t(`idle`)} open`:``,t(`asleep`)>0?`${t(`asleep`)} asleep`:``,t(`crashed`)>0?`${t(`crashed`)} closed unexpectedly`:``].filter(Boolean).join(`, `)}function W({state:e,tabs:t,activity:n,lastUsed:r}){return e===`active`?n??`Working`:e===`asleep`&&t.length>0?`Asleep ${r}, keeps ${t[0]?.title}${t.length>1?` and ${t.length-1} more`:``}`:e===`idle`?`Open and waiting, used ${r}`:e===`asleep`?`Asleep ${r}`:`Closed unexpectedly. Po reopens it the next time a task needs it.`}function st(e,t){return e===`timeout`?t?`The browser is slow to answer. The last frame stays here.`:`Po is on another tab`:e===`error`?`Po could not reach this browser. Trying again.`:void 0}function ct(e,t,n,r){let i=!n&&e.state===`active`&&t.current;return{live:i,badge:n?`Closed`:i?`Po is working`:`Watching`,footer:n?`This tab is closed. The last frame stays here.`:r??(i?e.activity??`Po is working here`:`Po is not on this tab right now`)}}var G=l({identities:[],hidden:[],pending:0});function K(e){return c(G.store,t=>G.select(t,e))}function lt(e,t,n){let r=G.select(G.store.state,e).identities.find(e=>e.id===t);return r&&{identity:r,tab:r.tabs.find(e=>e.id===n)}}var ut={subscribe(e){let t=G.store.subscribe(e);return()=>t.unsubscribe()},isActive(e){return G.select(G.store.state,e).identities.some(e=>e.state===`active`)}},dt=G.channel({channel:Je,parse:$e,reduce:(e,{identities:t})=>({...e,identities:t,...e.pending===0?{hidden:[]}:{}})}),ft=d(void 0);function pt(e){let t=t=>e.invokeServerMethod(t);return ft.update(()=>t),()=>ft.update(e=>e===t?void 0:e)}function q(e,t,n){let r=ft.store.state;return r?r({mount:{scope:`session`,sessionId:e},service:Ye,method:t,input:n}):Promise.reject(Error(`The browser view is not connected.`))}async function mt(e,t,n){try{return tt(await q(e,`frame`,n===void 0?{tabId:t}:{tabId:t,since:n}))}catch{return{state:`error`}}}async function ht(e,t){try{return nt(await q(e,`snapshot`,t))}catch(e){return{ok:!1,message:e instanceof Error?e.message:`Po could not take the snapshot.`}}}async function J(e,{tabIds:t,identityIds:n=[]}){if(t.length===0&&n.length===0)return;let r=[...t.map(e=>`tab:${e}`),...n.map(e=>`identity:${e}`)];G.update(e,e=>({...e,hidden:[...e.hidden,...r],pending:e.pending+1,error:void 0}));let i=await gt(e,t,n);return G.update(e,e=>({...e,pending:e.pending-1,...i===void 0?{}:{error:i,hidden:e.hidden.filter(e=>!r.includes(e))}})),i}async function gt(e,t,n){let r;try{r=await q(e,`close`,n.length>0?{tabIds:[...t],identityIds:[...n]}:{tabIds:[...t]})}catch{}return rt(r,t,n)}async function _t(e,t,n){let{method:r,profileName:i}=t,a=t=>G.update(e,e=>{let{[i]:n,...r}=e.busy??{};return{...e,busy:t===void 0?r:{...r,[i]:t}}});a(n),G.update(e,e=>({...e,error:void 0}));let o;try{o=await q(e,r,r===`sleep`?{profileName:i}:{profileName:i,headless:t.headless,urls:[...t.urls]})}catch{}let s=typeof o==`object`&&!!o&&o.ok===!0,c=s?void 0:o?.message;a(void 0),s||G.update(e,e=>({...e,error:typeof c==`string`?c:`Po could not reach this browser.`}))}function Y(e){try{return new URL(e).host}catch{return e}}var X=6e4,Z=60*X,Q=24*Z;function vt(e,t){let n=Math.max(0,t-e);return n<X?`just now`:n<Z?`${Math.floor(n/X)} min ago`:n<Q?`${Math.floor(n/Z)} h ago`:`${Math.floor(n/Q)} d ago`}function yt(e,t=Date.now()){return{id:e.id,name:e.name,state:e.state,window:e.window,...e.profile===void 0?{}:{profile:e.profile},lastUsed:vt(e.lastUsedAt,t),lastUsedAt:e.lastUsedAt,tabs:e.tabs.map(({id:e,title:t,url:n,current:r})=>({id:e,title:t,url:n,current:r}))}}function bt(e,t){let n=e.lastUsedAt;if(n===void 0||e.state!==`idle`&&e.state!==`asleep`)return{text:W(e)};let r=Math.max(0,t-n),i=r<Z?X:r<Q?Z:Q;return{text:W({...e,lastUsed:vt(n,t)}),nextMs:t<n?n-t+X:i-r%i}}function xt(e,t){let n=!1,r,i,a=async()=>{let o=await e(i);n||(o.state===`ok`&&(i=o.seq),t(o),o.state!==`closed`&&(r=setTimeout(()=>void a(),500)))};return a(),()=>{n=!0,clearTimeout(r)}}async function St(e,t,n,r){let i=await e(t.sessionId,{tabId:t.tabId,identity:t.identity,host:Y(t.url)});if(!i.ok)return{error:i.message};try{return r(n.createTab({sessionId:t.sessionId,path:i.path})),`idle`}catch(e){return{error:e instanceof Error?e.message:`Author could not open the snapshot.`}}}function Ct({identity:e,tab:t,frameSrc:n,frame:i,closed:a=!1,stale:o,snapshot:c,onSnapshot:l}){let{live:u,badge:d,footer:f}=ct(e,t,a,o),p=t.url.startsWith(`https://`),m=n!==void 0||i!==void 0;return x(`section`,{"data-testid":`browser-live-view`,"data-closed":a,"aria-label":`${t.title}, live view`,className:`flex min-h-0 flex-1 flex-col gap-3 px-[26px] py-[18px]`,children:[x(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[v(`span`,{className:`shrink-0 truncate text-base font-semibold text-po-hi`,children:e.name}),v(`span`,{className:`text-xs text-po-faint`,children:`›`}),v(`span`,{className:`min-w-0 truncate text-base text-po-text`,children:t.title}),v(s,{tone:u?`running`:`neutral`,"data-testid":`browser-live-state`,children:d}),v(`span`,{className:`ml-auto shrink-0 text-sm text-po-dim`,children:`View only`}),c===void 0?null:v(wt,{state:c,disabled:a||!m,onSnapshot:l})]}),x(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-po-border`,children:[x(`div`,{className:`flex min-w-0 items-center gap-1.5 border-b border-po-border bg-po-panel px-3 py-1.5`,children:[p?v(we,{"aria-label":`Secure connection`,className:`size-3 shrink-0 text-po-dim`}):v(r,{"aria-label":`Not secure`,className:`size-3 shrink-0 text-po-dim`}),v(`span`,{"data-testid":`browser-live-url`,className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:t.url})]}),v(`div`,{className:`relative min-h-0 flex-1 bg-po-bg ${a?`opacity-50 grayscale`:``}`,children:n?v(`img`,{src:n,alt:`Live view of ${t.title}`,className:`absolute inset-0 size-full object-contain object-top`}):i||v(`span`,{className:`absolute inset-0 flex items-center justify-center text-sm text-po-dim`,children:a?`This tab closed before the first frame`:`Waiting for the first frame`})})]}),v(`span`,{"data-testid":`browser-live-footer`,className:`truncate text-sm text-po-dim`,children:f})]})}function wt({state:e,disabled:t,onSnapshot:n}){return x(`span`,{className:`flex shrink-0 items-center gap-2`,children:[typeof e==`object`?v(`span`,{role:`alert`,className:`max-w-48 truncate text-sm text-po-red`,title:e.error,children:e.error}):null,v(F,{size:`xs`,variant:`outline`,"data-testid":`browser-live-snapshot`,disabled:t,loading:e===`taking`,loadingLabel:`Taking snapshot`,onClick:n,children:`Snapshot to Author`})]})}function Tt(e,t){let n=lt(e,t.identity.id,t.tab.id);return n?.tab?{identity:n.identity,tab:n.tab,gone:!1}:{identity:n?.identity??t.identity,tab:t.tab,gone:!0}}function Et(e,t){let{identity:n,tab:r}=Tt(e,t);return{kind:`browser-tab`,source:`po-browse`,id:`${t.identity.id}/${t.tab.id}`,label:`${n.name} · ${r.title}`,content:`The person is watching browser identity "${n.name}", tab "${r.title}" at ${r.url}.`}}function Dt(e,t){let n={identity:e,tab:t};return{id:`browse-live-${e.id}-${t.id}`.replace(/[^\w-]+/g,`-`),label:`${e.name} › ${t.title}`,panel:e=>v(kt,{...e,opened:n}),retainComposer:!0,composerContext:e=>Et(e,n)}}function Ot(){let[e,t]=g(()=>typeof document>`u`||!document.hidden);return S(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function kt(e){let{sessionId:t,opened:n,openTransientTab:r}=e;K(t);let i=Tt(t,n),a=i.identity.state===`asleep`||i.identity.state===`crashed`,[o,s]=g(),[c,l]=g(!1),[u,d]=g(),f=i.gone||a||c,p=Ot(),m=n.tab.id;S(()=>{if(t!==null&&!f&&p)return xt(e=>mt(t,m,e),e=>{e.state===`ok`?(s(e.src),d(void 0)):e.state===`unchanged`?d(void 0):e.state===`closed`?l(!0):d(e.state)})},[t,m,f,p]);let h=N(!0);S(()=>(h.current=!0,()=>{h.current=!1}),[]);let[_,y]=g(`idle`),b=qe(e),ee=async()=>{if(b===void 0||t===null||_===`taking`)return;y(`taking`);let e=await St(ht,{sessionId:t,tabId:m,identity:n.identity.id,url:i.tab.url},b,r);h.current&&y(e)},x=st(u,i.tab.current);return v(Ct,{identity:yt(i.identity,Date.now()),tab:{id:i.tab.id,title:i.tab.title,url:i.tab.url,current:i.tab.current},frameSrc:o,closed:f,stale:x,snapshot:b===void 0?void 0:_,onSnapshot:()=>void ee()})}var At={active:`green`,idle:`neutral`,asleep:`muted`,crashed:`red`};function jt(e){let{identities:t,error:n}=e;return t.length===0?v(_e,{"data-testid":`browsers-panel`,title:`No browser yet`,description:`Po opens one when a task needs the web.`,className:`py-12`}):x(`div`,{"data-testid":`browsers-panel`,className:`@container flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-6 py-4`,children:[v(`p`,{className:`text-sm text-po-dim`,children:ot(t)}),n?v(`p`,{role:`alert`,className:`text-sm text-po-red`,children:n}):null,t.map(t=>v(Mt,{...e,identity:t},t.id))]})}function Mt(e){let{identity:t,busy:n,canShowWindow:r=!0,openMenu:i}=e,{state:a,tabs:o}=t,s=n?.[t.id],c=a===`active`||a===`idle`,l=a!==`crashed`&&s===void 0,u=t.profile!==!1;return x(`section`,{"aria-label":t.name,"data-testid":`browsers-identity-${t.id}`,"data-state":a,className:`flex flex-col gap-3`,children:[x(`header`,{className:`flex min-w-0 items-center gap-2`,children:[v(ge,{tone:At[a],pulse:a===`active`||s!==void 0}),v(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-po-hi`,children:t.name}),x(`span`,{className:`min-w-0 flex-1 truncate text-sm ${a===`crashed`?`text-po-red`:`text-po-dim`}`,children:[s??W(t),c?` · ${t.window===`headed`?`Window shown`:`No window`}`:``]}),l?x(P,{modal:!1,defaultOpen:i===`identity:${t.id}`,children:[v(D,{asChild:!0,children:v(F,{variant:`ghost`,size:`icon`,"aria-label":`Manage ${t.name}`,children:v(A,{className:`size-3.5`})})}),x(T,{align:`end`,children:[u?a===`asleep`?x(M,{onSelect:()=>e.onWake?.(t.id),children:[v(ye,{className:`size-3.5`}),`Wake up`]}):x(m,{children:[r?x(M,{onSelect:()=>e.onToggleWindow?.(t.id,t.window===`headed`?`headless`:`headed`),children:[v(w,{className:`size-3.5`}),t.window===`headed`?`Hide window`:`Show window`]}):null,x(M,{onSelect:()=>e.onSleep?.(t.id),children:[v(p,{className:`size-3.5`}),`Put to sleep`]})]}):null,u?v(he,{}):null,x(M,{onSelect:()=>e.onCloseBrowser?.(t.id),children:[v(f,{className:`size-3.5`}),`Close browser`]})]})]}):null]}),o.length>0?v(`ul`,{"aria-label":`Tabs in ${t.name}`,className:`grid grid-cols-1 gap-3 @lg:grid-cols-2 @4xl:grid-cols-3`,children:o.map(t=>v(Nt,{...e,tab:t},t.id))}):null]})}function Nt(e){let{identity:t,tab:n,renderFrame:i,openMenu:o}=e,s=t.state===`asleep`,c=t.state===`active`&&n.current,l=()=>e.onWatch?.(t.id,n.id),u=e=>{e.target!==e.currentTarget||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),l())},d=i?.(t,n);return v(a,{asChild:!0,className:`flex min-w-0 flex-col focus-within:border-po-green`,children:x(`li`,{"data-testid":`browsers-tab-${n.id}`,"data-current":n.current,children:[s?null:x(`div`,{role:`button`,tabIndex:0,title:`Watch this tab live`,onClick:l,onKeyDown:u,className:`relative aspect-video cursor-pointer overflow-hidden bg-po-deep outline-none`,children:[d??x(`span`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-1 text-sm text-po-dim`,children:[v(r,{"aria-hidden":!0,className:`size-5 text-po-faint`}),`Waiting for the first frame`]}),c?v(`span`,{className:`absolute top-2 left-2 rounded-xs bg-po-tint-green px-1.5 py-0.5 text-sm font-semibold text-po-green`,children:`Po is here`}):null]}),x(`div`,{className:`flex min-w-0 items-center gap-2 py-1.5 pr-1 pl-3 ${s?``:`border-t border-po-border-soft`}`,children:[x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[v(`span`,{className:`truncate text-base ${n.current?`font-semibold text-po-hi`:`text-po-text`}`,children:n.title}),v(`span`,{className:`truncate text-sm text-po-dim`,children:Y(n.url)})]}),x(P,{modal:!1,defaultOpen:o===`tab:${n.id}`,children:[v(D,{asChild:!0,children:v(F,{variant:`ghost`,size:`icon`,"aria-label":`Manage ${n.title}`,children:v(A,{className:`size-3.5`})})}),x(T,{align:`end`,children:[s?null:x(m,{children:[x(M,{onSelect:l,children:[v(y,{className:`size-3.5`}),`Watch live`]}),e.onSnapshot?x(M,{onSelect:()=>e.onSnapshot?.(t.id,n.id),children:[v(Se,{className:`size-3.5`}),`Snapshot to Author`]}):null]}),x(M,{onSelect:()=>e.onCopyUrl?.(n.url),children:[v(re,{className:`size-3.5`}),`Copy URL`]}),s?null:x(m,{children:[v(he,{}),x(M,{onSelect:()=>e.onCloseTab?.(t.id,n.id),children:[v(f,{className:`size-3.5`}),`Close tab`]})]})]})]})]})]})})}function Pt(){return{id:`browse-browsers`,label:`Browsers`,panel:It}}function Ft({sessionId:e,tabId:t}){let[n,r]=g();return S(()=>xt(n=>mt(e,t,n),e=>{e.state===`ok`&&r(e.src)}),[e,t]),n===void 0?void 0:v(`img`,{src:n,alt:``,className:`absolute inset-0 size-full object-cover object-top`})}function It(e){let{sessionId:t,openTransientTab:n}=e,r=K(t),[i,a]=g(),o=qe(e),s=e=>r.identities.find(t=>t.id===e),c=e=>{let t=s(e);return t&&t.state!==`asleep`?t.tabs.map(e=>e.id):[]};return v(jt,{identities:it(r).map(e=>yt(e)),renderFrame:(e,n)=>t===null||e.state===`asleep`?void 0:v(Ft,{sessionId:t,tabId:n.id},n.id),busy:r.busy,error:i??r.error,onWatch:(e,t)=>{let r=s(e),i=r?.tabs.find(e=>e.id===t);r&&i&&n(Dt(r,i))},onSnapshot:o===void 0||t===null?void 0:(e,r)=>{let i=s(e)?.tabs.find(e=>e.id===r);i&&(a(void 0),St(ht,{sessionId:t,tabId:r,identity:e,url:i.url},o,n).then(e=>{e!==`idle`&&a(e.error)}))},onCopyUrl:e=>{a(void 0),navigator.clipboard.writeText(e).catch(()=>a(`Po could not copy the URL.`))},onCloseTab:(e,n)=>t&&void J(t,{tabIds:[n]}),onCloseBrowser:e=>t&&void J(t,{tabIds:c(e),identityIds:[e]}),onSleep:e=>t&&void _t(t,{method:`sleep`,profileName:e},`Going to sleep`),onWake:e=>{let n=s(e);t&&n&&_t(t,{method:`relaunch`,profileName:e,headless:n.window===`headless`,urls:n.tabs.map(e=>e.url).filter(e=>/^https?:\/\//.test(e))},`Waking up`)},onToggleWindow:(e,n)=>t&&void _t(t,{method:`relaunch`,profileName:e,headless:n===`headless`,urls:[]},`Reopening, pages reload`)})}var Lt=pe({keys:`g b`,icon:r,activeSource:ut,marksBackgroundWork:!1,order:45,transientTab:Pt}),Rt=fe(dt),zt={active:`green`,idle:`neutral`,asleep:`muted`,crashed:`red`};function Bt({identities:e,onOpenTab:t,onCloseTab:n,onCloseBrowser:r,onCloseAsleep:i,error:a}){if(e.length===0)return v(`p`,{"data-testid":`activity-summary-browser`,className:`px-1 text-sm text-po-dim`,children:`No browser yet. Po opens one when a task needs the web.`});let o=e.filter(e=>e.state===`asleep`),s=ot(e);return x(`div`,{"data-testid":`activity-browser-identities`,className:`flex flex-col gap-1`,children:[v(`p`,{"data-testid":`activity-summary-browser`,className:`px-1 pb-1 text-sm text-po-dim`,children:s}),a?v(`p`,{role:`alert`,className:`px-1 pb-1 text-sm text-po-red`,children:a}):null,v(`ul`,{className:`flex flex-col`,children:e.map(e=>v(Vt,{identity:e,onOpenTab:t,onCloseTab:n,onCloseBrowser:r},e.id))}),o.length>1&&i?x(F,{variant:`ghost`,size:`sm`,className:`mt-1 self-start`,onClick:()=>i(o.map(e=>e.id)),children:[`Close `,o.length,` asleep browsers`]}):null]})}function Vt({identity:e,onOpenTab:t,onCloseTab:r,onCloseBrowser:a}){let{state:o,tabs:s}=e,[c,l]=g(o===`active`),u=o===`asleep`;return v(`li`,{"data-testid":`activity-browser-${e.id}`,"data-state":o,className:`group/row`,children:x(Te,{open:c,onOpenChange:l,children:[x(`div`,{className:`flex items-start gap-1 rounded-md hover:bg-po-deep/60`,children:[x(F,{variant:`ghost`,size:`card`,"aria-expanded":s.length>0?c:void 0,title:e.name,onClick:()=>l(!c),className:`min-w-0 flex-1 gap-0.5 px-1.5 py-1.5 hover:bg-transparent`,children:[x(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[v(ge,{tone:zt[o],pulse:o===`active`}),v(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:e.name}),s.length>0&&!c?v(`span`,{className:`shrink-0 text-sm text-po-dim`,children:at(s.length)}):null,s.length>0?c?v(i,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-po-dim`}):v(me,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-po-faint`}):null]}),v(`span`,{className:`pl-3.5 text-sm ${o===`crashed`?`text-po-red`:`truncate text-po-dim`}`,children:v(Ut,{identity:e})})]}),o!==`crashed`&&a?x(P,{modal:!1,children:[v(D,{asChild:!0,children:v(F,{variant:`ghost`,size:`icon`,"aria-label":`Manage ${e.name}`,className:`mt-1.5 mr-1 opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,children:v(A,{className:`size-3.5`})})}),v(T,{align:`end`,children:x(M,{onSelect:()=>a(e.id),children:[v(f,{className:`size-3.5`}),`Close browser`]})})]}):null]}),v(n,{children:v(`ul`,{"aria-label":`Tabs in ${e.name}`,className:`flex flex-col gap-0.5 pt-0.5 pb-1.5 pl-4`,children:s.map(n=>u?v(`li`,{className:`flex items-center gap-2 px-1.5 py-1.5`,children:v(Ht,{tab:n,here:!1})},n.id):x(`li`,{className:`group/tab flex items-center gap-1 rounded-md hover:bg-po-deep`,children:[v(F,{variant:`ghost`,size:`card`,"data-testid":`activity-browser-tab-${n.id}`,"data-current":n.current,"aria-current":n.current?`true`:void 0,title:`Watch this tab live`,onClick:()=>t?.(e.id,n.id),className:`min-w-0 flex-1 flex-row items-center gap-2 px-1.5 py-1.5 hover:bg-transparent`,children:v(Ht,{tab:n,here:n.current&&o===`active`})}),r?v(F,{variant:`ghost`,size:`icon`,"aria-label":`Close ${n.title}`,onClick:()=>r(e.id,n.id),className:`mr-1 opacity-0 group-hover/tab:opacity-100 focus-visible:opacity-100`,children:v(f,{className:`size-3.5`})}):null]},n.id))})})]})})}function Ht({tab:e,here:t}){return x(m,{children:[v(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center rounded-xs text-2xs font-semibold uppercase ${t?`bg-po-tint-green text-po-green`:`bg-po-deep text-po-dim`}`,children:e.title.charAt(0)}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[v(`span`,{className:`truncate text-base ${e.current?`font-semibold text-po-hi`:`text-po-text`}`,children:e.title}),v(`span`,{className:`truncate text-sm text-po-dim`,children:t?`Po is here · ${Y(e.url)}`:Y(e.url)})]})]})}function Ut({identity:e}){let t=N(null);return S(()=>{let n,r=()=>{let{text:i,nextMs:a}=bt(e,Date.now());t.current?.firstChild&&(t.current.firstChild.nodeValue=i),a!==void 0&&(n=setTimeout(r,a))};return r(),()=>clearTimeout(n)},[e]),v(`span`,{ref:t,children:bt(e,Date.now()).text})}function Wt(e,t,n,r){let i=e.find(e=>e.id===t),a=i?.tabs.find(e=>e.id===n);i&&a&&r(Dt(i,a))}function Gt({sessionId:e,openTransientTab:t}){let n=K(e),{identities:r}=n,i=e=>r.find(t=>t.id===e&&t.state!==`asleep`)?.tabs.map(e=>e.id)??[];return v(Bt,{identities:it(n).map(e=>yt(e)),error:n.error,onOpenTab:(e,n)=>Wt(r,e,n,t),onCloseTab:(t,n)=>e&&void J(e,{tabIds:[n]}),onCloseBrowser:t=>e&&void J(e,{tabIds:i(t),identityIds:[t]}),onCloseAsleep:t=>e&&void J(e,{tabIds:[],identityIds:t})})}var Kt=o({component:Gt}),qt=ie(pt),$=(e,t)=>t===void 0?void 0:{...e,...t},Jt=oe({id:`browse`,packageName:`@agimon-ai/po-browse`,host:{get settingsPanels(){return[$({id:`browser`},We)]}},workspace:{get settingsSections(){return[$({id:`browser-control`},Ge)]}},session:{get activityGroups(){return[$({name:`browser`},Lt)]},get channels(){return[$({channel:`browse_activity`},Rt)]},get fills(){return[$({slot:`activity.browser`,id:`browser`},Kt)]},get start(){return qt}}});export{Jt as webPlugin};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{Fi as e,It as t,Ja as n,Lt as r,Pi as i,Qr as a,Rt as o,Za as s,_n as c,gn as l,hn as u,vn as d,zr as f}from"../chunks/po-web-runtime-C-6-Rprr.js";var p=51200,m=1024;function h(e){return e.filter(e=>e!==void 0&&e.length>0)}function g(e,t){return typeof e==`number`&&Number.isFinite(e)?`${e} ${t}`:void 0}function _(e){return typeof e==`string`&&e.length>0?e:`.`}function v(e){return e<m?`${e}B`:e<m*m?`${(e/m).toFixed(1)}KB`:`${(e/(m*m)).toFixed(1)}MB`}function y(e,t){let n=typeof e.content==`string`?e.content:``,r=typeof e.path==`string`?e.path:``,i=`${n.length.toLocaleString(`en-US`)} chars`;if(n.length===0)return{path:r,size:i,preview:[],hidden:0,gutter:1};let a=n.replaceAll(` `,` `).replaceAll(`\r
|
|
2
|
-
`,`
|
|
3
|
-
`).split(`
|
|
4
|
-
`);for(;a.at(-1)===``;)a.pop();let o=t?a:a.slice(0,10);return{path:r,size:i,preview:o.map((e,t)=>({number:t+1,text:e})),hidden:a.length-o.length,gutter:String(o.length).length}}function b(e){return{primary:typeof e.pattern==`string`?e.pattern:``,details:h([_(e.path),g(e.limit,`results`)])}}function x(e){return{primary:_(e.path),details:h([g(e.limit,`entries`)])}}function S(e){let t=e.replace(/\/$/,``).lastIndexOf(`/`);return t<0?{name:e,folder:``}:{name:e.slice(t+1),folder:e.slice(0,t)}}function C(e,t){return e===null?t:e.content.flatMap(e=>{let t=typeof e==`object`&&e?e:{};return t.type===`text`&&typeof t.text==`string`?[t.text]:[]}).join(`
|
|
5
|
-
`)}function w(e,t,n,r,i){let a=C(e,t).trim(),o=a.length===0?[]:a.split(`
|
|
6
|
-
`),s=n?o:o.slice(0,20),c=typeof e?.details==`object`&&e.details!==null?e.details:{},l=c[r],u=typeof c.truncation==`object`&&c.truncation!==null?c.truncation:void 0,d=[];return typeof l==`number`&&l>0&&d.push(`${l} ${i} limit`),u?.truncated===!0&&d.push(`${v(typeof u.maxBytes==`number`?u.maxBytes:p)} limit`),{lines:s,hidden:o.length-s.length,truncated:d.length>0?`[Truncated: ${d.join(`, `)}]`:void 0}}function T({tool:e,limitKey:t,limitUnit:n,expanded:i,props:a}){let{result:s,output:c,running:u,isError:f}=a;if(f)return r(l,{"data-testid":`tool-result-${e}`,className:`flex flex-col`,children:r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:C(s,c)})});if(s===null)return u?r(l,{"data-testid":`tool-result-${e}`,children:r(d,{tone:`running`,children:`running`})}):null;let p=w(s,c,i,t,n);return p.lines.length===0&&p.truncated===void 0?null:o(l,{"data-testid":`tool-result-${e}`,className:`flex flex-col font-mono`,children:[p.lines.map((e,t)=>{let n=S(e);return o(`span`,{title:e,className:`flex min-w-0 items-baseline gap-2`,children:[r(`span`,{className:`max-w-full shrink-0 truncate text-po-text`,children:n.name}),n.folder.length>0?r(`span`,{className:`min-w-0 truncate text-po-dim`,children:n.folder}):null]},`${String(t)}-${e}`)}),p.hidden>0?o(d,{expands:!0,children:[p.hidden,` more lines`]}):null,p.truncated===void 0?null:r(`span`,{className:`text-po-yellow`,children:p.truncated})]})}var E=`resultLimitReached`,D=`results`;function O(e){let n=b(e.args);return r(u,{tone:i({running:e.running,isError:e.isError}),expandable:!0,children:({expanded:i})=>o(t,{children:[r(c,{title:`find`,children:o(`span`,{"data-testid":`tool-call-find`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[r(`span`,{className:`truncate text-po-text`,children:n.primary}),n.details.length>0?o(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,n.details.join(` · `)]}):null]})}),i?r(T,{tool:`find`,limitKey:E,limitUnit:D,expanded:!0,props:e}):null]})})}var k=n({message:O}),A=`entryLimitReached`,j=`entries`;function M(e){let n=x(e.args);return r(u,{tone:i({running:e.running,isError:e.isError}),expandable:!0,children:({expanded:i})=>o(t,{children:[r(c,{title:`ls`,children:o(`span`,{"data-testid":`tool-call-ls`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[r(`span`,{className:`truncate text-po-text`,children:n.primary}),n.details.length>0?o(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,n.details.join(` · `)]}):null]})}),i?r(T,{tool:`ls`,limitKey:A,limitUnit:j,expanded:!0,props:e}):null]})})}var N=n({message:M});function P({view:n,path:i}){let a=e(n.preview.map(e=>e.text).join(`
|
|
7
|
-
`),{path:i});return r(t,{children:n.preview.map((e,t)=>o(`span`,{className:`flex gap-2`,children:[r(`span`,{className:`shrink-0 text-right text-po-faint`,style:{width:`${String(n.gutter)}ch`},children:e.number}),r(f,{spans:a?.[t],text:e.text,className:`min-w-0 whitespace-pre-wrap break-words text-po-text`})]},e.number))})}function F({args:e,result:n,output:s,running:f,isError:p,fileTabFor:m,openTransientTab:h}){let g=y(e,!1),_=m(g.path);return r(u,{tone:i({running:f,isError:p}),expandable:!0,children:({expanded:i})=>{let u=i?y(e,!0):g;return o(t,{children:[r(c,{title:`write`,children:o(`span`,{"data-testid":`tool-call-write`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[r(a,{path:u.path,..._===void 0?{}:{onOpen:()=>h(_)}}),o(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,u.size]})]})}),i?p?r(l,{"data-testid":`tool-result-write`,className:`flex flex-col`,children:r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:C(n,s)})}):u.preview.length===0?f?r(l,{"data-testid":`tool-result-write`,children:r(d,{tone:`running`,children:`running`})}):null:o(l,{"data-testid":`tool-result-write`,className:`flex flex-col font-mono`,children:[r(P,{view:u,path:u.path}),u.hidden>0?o(d,{expands:!0,children:[u.hidden,` more lines`]}):null,f?r(d,{tone:`running`,children:`running`}):null]}):null]})}})}var I=n({message:F}),L=(e,t)=>t===void 0?void 0:{...e,...t},R=s({id:`builtin-tools`,packageName:`@agimon-ai/po-ui`,session:{get toolRenderers(){return[L({tools:[`find`]},k),L({tools:[`ls`]},N),L({tools:[`write`]},I)]}}});export{R as webPlugin};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$a as e,$i as t,$n as n,Dn as r,Ea as i,Fa as a,Fr as o,Gr as s,Hr as c,Ii as l,It as u,Ja as d,Ji as f,Jt as p,Ki as m,Kt as h,Lt as g,Mt as _,Na as v,Oa as y,Qi as b,Qn as x,Rt as S,Ur as C,Ut as w,Wi as T,Wr as E,Xi as D,Xn as O,Xr as ee,Yt as k,Za as A,Zi as te,_n as j,an as ne,ao as M,ar as N,eo as P,gn as F,hn as I,io as L,ir as R,jt as re,ki as z,nn as B,on as V,pa as H,pi as U,qi as ie,qt as ae,rr as W,ti as G,tr as oe,ur as K,vn as q,yn as se}from"../chunks/po-web-runtime-C-6-Rprr.js";var ce={list:{method:`GET`,path:`/events`,query:[`from`,`to`,`cursor`,`tz`,`status`,`workspace`,`kind`,`q`,`limit`],response:void 0},create:{method:`POST`,path:`/events`,response:void 0},update:{method:`PATCH`,path:`/events/:id`,response:void 0},cancel:{method:`DELETE`,path:`/events/:id`,response:void 0},pause:{method:`POST`,path:`/events/:id/pause`,response:void 0},resume:{method:`POST`,path:`/events/:id/resume`,response:void 0},runNow:{method:`POST`,path:`/events/:id/run-now`,response:void 0},ask:{method:`POST`,path:`/events/:id/ask`,response:void 0},history:{method:`GET`,path:`/events/:id/history`,query:[`cursor`],response:void 0},targets:{method:`GET`,path:`/targets`,response:void 0}},le=[`host`,`workspace`,`session`],J=y(ce,{scopes:le,basePath:`calendar`,transport:(e,t)=>re.fetch(e,t),sessionAddress:L});function ue(){let t=e(`calendar`);return k(e=>M(t,e),()=>P(t))}var Y={query:``,workspace:`all`,status:`open`,kind:`all`};function de({query:e,workspace:t,status:n,kind:r}){return{...e.trim()?{q:e.trim()}:{},...t===`all`?{}:{workspace:t},...n===`all`?{}:{status:n},...r===`all`?{}:{kind:r}}}function X(e,t){return e===void 0?void 0:t?.workspaces.find(t=>t.id===e)?.name??e}function fe(e,t){return e.owner.level===`global`?`Global`:`${e.owner.level===`workspace`?`Workspace`:`Session`} · ${X(e.owner.workspaceId,t)}`}function pe(e){return(e?.workspaces??[]).map(({id:e,name:t})=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name))}function me(e,t){let n=new Date(t);n.setHours(0,0,0,0);let r=[];for(let t of e){let e=new Date(t.projectedDueAt??t.nextDueAt??t.updatedAt);e.setHours(0,0,0,0);let i=Math.round((e.getTime()-n.getTime())/864e5),a=i===0?`Today`:i===1?`Tomorrow`:e.toLocaleDateString(void 0,{weekday:`long`,day:`numeric`,month:`long`}),o=r.at(-1);o?.label===a?o.events.push(t):r.push({label:a,events:[t]})}return r}function he(e,t,n){let r=t.map(()=>[]);for(let i of e)for(let e of i.occurrences??(i.projectedDueAt===void 0?[]:[i.projectedDueAt])){let a=t.filter(t=>t<=e).length-1;a>=0&&e<n&&r[a].push({...i,projectedDueAt:e})}for(let e of r)e.sort((e,t)=>e.projectedDueAt-t.projectedDueAt);return r}function ge(e,t,n){let r=new Date(`${e}T${t}:00Z`).getTime();if(!Number.isFinite(r))throw Error(`Choose a valid date and time.`);let i=new Intl.DateTimeFormat(`sv-SE`,{timeZone:n,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),a=r;for(let e=0;e<4;e++){let e=r-new Date(i.format(new Date(a)).replace(` `,`T`)+`Z`).getTime();if(e===0)return a;a+=e}throw Error(`This time does not exist in that timezone. Choose another time.`)}function _e(e,t){let n=new Date(e);n.setDate(n.getDate()+t);let r=new Date(n);return r.setDate(r.getDate()+1),{from:n.getTime(),to:r.getTime()}}function ve(e){return{from:e,to:e+5184e6}}function ye(e,t){let n=new Date(t).getMonth(),r=new Date(t);r.setHours(0,0,0,0),e===`month`&&r.setDate(1),r.setDate(r.getDate()-(r.getDay()+6)%7);let i=[];do i.push(r.getTime()),r.setDate(r.getDate()+1);while(e===`month`?r.getMonth()===n||r.getDay()!==1:i.length<7);return{days:i,from:i[0],to:r.getTime()}}function be(e,t,n,r){if(n===0)return r;let i=new Date(t);return e===`month`?i.setMonth(i.getMonth()+n,1):i.setDate(i.getDate()+n*7),i.getTime()}function xe(e,t){let n=t.indexOf(`/`);return n<0||e.startsWith(t.slice(0,n+1))?e:t.slice(0,n+1)+e}function Se(e,t,n){return t.level===`global`?e.host:t.level===`workspace`?e.workspace(xe(t.workspaceId,n)):e.session(xe(t.sessionId,n))}function Ce(e,t,n){if(!e.title.trim()||!n?.workflow&&!n?.action&&!e.prompt.trim())throw Error(`Add a title and prompt.`);let r=(e.delay??`0`).trim(),i=Number(r);if(r===``||!Number.isInteger(i)||i<0||i>3600)throw Error(`Choose a random delay from 0 to 3,600 seconds.`);let a;if(e.kind===`Interval`){let t=Number(e.seconds);if(!Number.isInteger(t)||t<30||t>3600)throw Error(`Choose an interval from 30 to 3,600 seconds.`);if(i>=t)throw Error(`The random delay must be shorter than the interval.`);a={kind:`interval`,seconds:t,...i>0?{randomDelaySeconds:i}:{}}}else if(e.kind===`Cron`){if(!e.expr.trim())throw Error(`Add a cron expression.`);a={kind:`cron`,expr:e.expr,tz:e.tz,...i>0?{randomDelaySeconds:i}:{}}}else{let t=ge(e.date,e.time,e.tz);if(!Number.isFinite(t)||t<=Date.now())throw Error(`Choose a time in the future.`);a={kind:`once`,at:t,tz:e.tz,...i>0?{randomDelaySeconds:i}:{}}}let o;if(e.targetKind===`New session`){let n=t.workspaces.find(t=>t.id===e.targetId&&t.active);if(!n)throw Error(`Choose an active workspace.`);o={kind:`newSession`,workspaceId:n.id,cwd:n.path}}else{let n=t.sessions.find(t=>t.sessionId===e.targetId);if(!n)throw Error(`Choose an available session.`);o={kind:`existingSession`,sessionId:n.sessionId}}return n?.target.kind===o.kind&&(n.target.kind===`newSession`?n.target.workspaceId:n.target.sessionId)===e.targetId&&(o=n.target),{title:e.title.trim(),schedule:a,target:o,...n?.workflow?{workflow:n.workflow}:n?.action?{action:n.action}:{prompt:e.prompt.trim()},...n?.assignment?{assignment:n.assignment}:{}}}function we(e,t=Intl.DateTimeFormat().resolvedOptions().timeZone){let n=new Intl.DateTimeFormat(`sv-SE`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(new Date(e)),r=e=>n.find(t=>t.type===e)?.value??``;return{date:`${r(`year`)}-${r(`month`)}-${r(`day`)}`,time:`${r(`hour`)}:${r(`minute`)}`}}function Te(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+6)%7),t.getTime()}function Ee(e){return{id:e.id,title:e.title,prompt:e.prompt??(e.workflow?`Runs workflow ${e.workflow.key}`:`Runs ${e.action?.launcherId??`an action`}`),time:new Date(e.projectedDueAt??e.nextDueAt??e.updatedAt).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),schedule:(e.schedule.kind===`interval`?`Every ${e.schedule.seconds} seconds`:e.schedule.kind===`cron`?e.schedule.expr:`Once`)+(e.schedule.randomDelaySeconds?`, up to ${e.schedule.randomDelaySeconds} seconds late`:``),target:e.target.kind===`existingSession`?e.target.sessionId:`New session`,owner:`${e.owner.level===`global`?`Global`:e.owner.level===`workspace`?`Workspace`:`Session`}${e.id.startsWith(`${e.homeHostId}/`)?` · ${e.homeHostId}`:``}`,source:e.source?.packageName,execution:e.workflow?`Workflow: ${e.workflow.key}`:e.action?`Action: ${e.action.launcherId}`:void 0,assignment:e.assignment?JSON.stringify(e.assignment):void 0,profile:e.assignment?.profile,status:e.status===`active`?`Scheduled`:e.status}}function De(e,t,n=`panel`,r,i,a=0,o,s=`Session`,c=Date.now,l=!1,u){let{from:d,to:f,tz:m}=r??{},g=JSON.stringify(i??{}),[_,v]=p(n===`page`?`Everything`:s),[y,b]=p(()=>Te(c())),[x,S]=p(()=>(new Date(c()).getDay()+6)%7),[C,T]=p([]),[E,D]=p(),[O,ee]=p({total:0,matched:0,more:!1}),k=ae({key:``,count:1}),A=ae(void 0),[te,j]=p(`loading`),[ne,M]=p(),[N,P]=p(0),[F,I]=p(!1),L=ae(!1),[R,re]=p(),[z,B]=p(),[V,H]=p(),[U,ie]=p(),W=U?.owner,G=u===void 0?n===`page`||_===`Everything`?{level:`global`}:_===`Workspace`&&W&&W.level!==`global`?{level:`workspace`,workspaceId:W.workspaceId}:W:{level:`workspace`,workspaceId:u};w(()=>{let r=!0;return(async()=>{let i=n===`page`||u!==void 0?void 0:await e.session(t).targets();if(i&&!i.ok)throw Error(i.error||`Calendar could not load.`);if(!r)return;i&&ie(i.data);let a=u===void 0?!i||_===`Everything`?{level:`global`}:_===`Workspace`&&i.data.owner.level!==`global`?{level:`workspace`,workspaceId:i.data.owner.workspaceId}:i.data.owner:{level:`workspace`,workspaceId:u},o=d!==void 0&&f!==void 0?{from:d,to:f,...m?{tz:m}:{}}:n!==`page`||l?_e(y,x):ve(c()),s=Se(e,a,t),p=await s.targets();if(!p.ok)throw Error(p.error||`Targets could not load.`);let h={...o,...JSON.parse(g)},v=async e=>{let t=await s.list({query:{...h,...e?{cursor:e}:{}}});if(!t.ok)throw Error(t.error||`Calendar could not load.`);return t.data},b=e=>{ee({total:e.total,matched:e.matched,more:e.cursor!==void 0});let t=e.cursor;A.current=t?async()=>{let e=await v(t);r&&(k.current.count+=1,T(t=>[...t,...e.events]),b(e))}:void 0},S=JSON.stringify([a,h]);k.current.key!==S&&(k.current={key:S,count:1});let C=await v(),w=[...C.events];for(let e=1;(n===`panel`||e<k.current.count)&&C.cursor&&r;e++){let e=C.cursor;if(C=await v(e),C.cursor===e)throw Error(`Calendar returned an invalid page.`);w.push(...C.events)}r&&(T(w),D(p.data),b(C),j(`populated`))})().catch(e=>{r&&(M(e instanceof Error?e.message:String(e)),j(`error`))}),()=>{r=!1}},[e,t,n,_,y,x,N,a,d,f,m,g,l,c,u]);async function oe(e){if(!L.current){L.current=!0,I(!0),M(void 0);try{await e()}catch(e){M(e instanceof Error?e.message:String(e))}finally{L.current=!1,I(!1)}}}function K(e){if(e?.source)return;H(void 0),M(void 0),re(e??`new`);let t=e?.schedule;B({title:e?.title??``,prompt:e?.prompt??``,kind:t?.kind===`interval`?`Interval`:t?.kind===`cron`?`Cron`:`Once`,...we(t?.kind===`once`?t.at:Date.now()+36e5,t?.kind===`once`?t.tz:void 0),seconds:t?.kind===`interval`?String(t.seconds):`300`,delay:String(t?.randomDelaySeconds??0),expr:t?.kind===`cron`?t.expr:`0 9 * * 1-5`,tz:t&&t.kind!==`interval`?t.tz:Intl.DateTimeFormat().resolvedOptions().timeZone,targetKind:e?.target.kind===`existingSession`?`Existing session`:`New session`,targetId:e?.target.kind===`existingSession`?e.target.sessionId:e?.target.workspaceId??``})}function q(){j(`loading`),M(void 0),re(void 0),H(void 0),T([]),D(void 0)}let se={busy:F||te===`loading`,scope:e=>{e!==_&&(q(),v(e))},day:e=>{e!==x&&q(),S(e)},week:e=>{q(),b(t=>{let n=new Date(t);return n.setDate(n.getDate()+e*7),n.getTime()})},today:()=>{q(),b(Te(c())),S((new Date(c()).getDay()+6)%7),P(e=>e+1)},create:()=>K(),retry:()=>{q(),P(e=>e+1)},event(n,r){let i=C.find(e=>e.id===r);i&&(n===`edit`?K(i):oe(async()=>{let a=Se(e,G&&G.level!==`session`?G:i.owner,t);if(n===`history`){let n=await Se(e,G??i.owner,t).history({params:{id:r}});if(!n.ok)throw Error(n.error);H({event:i,items:n.data.occurrences,cursor:n.data.cursor});return}let o=await a[n===`pause`&&i.status===`paused`?`resume`:n]({params:{id:r}});if(!o.ok)throw Error(o.error||`Event could not be changed.`);q(),P(e=>e+1)}))}},ce=h(()=>[...C].sort((e,t)=>(e.projectedDueAt??e.nextDueAt??e.updatedAt)-(t.projectedDueAt??t.nextDueAt??t.updatedAt)),[C]),le=U?.workspaces.find(e=>W?.level!==`global`&&e.id===W?.workspaceId),J=U?.sessions.find(e=>xe(e.sessionId,t)===t),ue=le?.name.trim(),Y=J?.name.trim(),de={timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,workspace:ue&&ue!==le?.id?ue:`This workspace`,session:Y&&Y!==J?.sessionId&&Y!==t?Y:`This session`,days:Array.from({length:7},(e,t)=>{let n=new Date(y);return n.setDate(n.getDate()+t),n.toLocaleDateString(void 0,{weekday:`short`,day:`numeric`})}),selectedDay:x,range:new Date(y).toLocaleDateString(void 0,{month:`long`,year:`numeric`}),events:ce.map(Ee)},X=R&&R!==`new`?R.owner:G,fe=E&&X?{...E,workspaces:E.workspaces.filter(e=>X.level===`global`||e.id===X.workspaceId),sessions:E.sessions.filter(e=>X.level===`global`||(X.level===`session`?e.sessionId===X.sessionId:e.workspaceId===X.workspaceId))}:void 0,pe=R&&z&&fe?{fields:z,execution:R===`new`?void 0:R.workflow?`Workflow: ${R.workflow.key}`:R.action?`Action: ${R.action.launcherId}`:void 0,assignment:R!==`new`&&R.assignment?JSON.stringify(R.assignment):void 0,busy:F,error:ne,owner:R===`new`?G?.level===`global`?`Global`:_:R.owner.level===`global`?`Global`:R.owner.level===`workspace`?`Workspace`:`Session`,choices:z.targetKind===`New session`?fe.workspaces.filter(e=>e.active).map(e=>({id:e.id,name:e.name})):fe.sessions.map(e=>({id:e.sessionId,name:e.name+(e.asleep?` (asleep)`:``)})),set:(e,t)=>B(n=>n&&{...n,[e]:t,...e===`targetKind`?{targetId:``}:{}}),close:()=>re(void 0),save:()=>{oe(async()=>{if(!G)return;let n=Ce(z,fe,R===`new`?void 0:R),r=Se(e,R===`new`||G.level!==`session`?G:R.owner,t),i=R===`new`?await r.create({body:{...n,...o?{destinationHostId:o}:{}}}):await r.update({params:{id:R.id},body:n});if(!i.ok)throw Error(i.error||`Event could not be saved.`);re(void 0),q(),P(e=>e+1)})}}:void 0;return{data:de,owner:G,events:ce,total:O.total,matched:O.matched,more:O.more?()=>void oe(async()=>await A.current?.()):void 0,targets:E,actions:se,state:te,error:ne,editor:pe,editing:R,history:V,busy:F,closeHistory:()=>H(void 0),moreHistory:()=>{oe(async()=>{if(!V?.cursor)return;let n=await Se(e,G??V.event.owner,t).history({params:{id:V.event.id},query:{cursor:V.cursor}});if(!n.ok)throw Error(n.error);H({...V,items:[...V.items,...n.data.occurrences],cursor:n.data.cursor})})}}}function Oe(e){return e.projectedDueAt??e.nextDueAt??e.updatedAt}function ke(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.toDateString()===t?r:`${n.toLocaleDateString(void 0,{weekday:`short`})} ${r}`}var Ae=3;function je({dueToday:e,rows:t,state:n,onOpen:i,bodyOnly:a=!1}){if(a)return S(`div`,{className:`flex flex-col gap-2`,children:[e>0?g(K,{tone:`magenta`,className:`self-start`,children:`${e} today`}):null,n===`loading`?g(`p`,{className:`text-sm text-po-dim`,children:`Loading events…`}):null,n===`error`?g(`p`,{className:`text-sm text-po-dim`,children:`Could not load events`}):null,n===`populated`&&t.length===0?g(`p`,{className:`text-base text-po-dim`,children:`Nothing scheduled.`}):null,t.length>0?g(`ul`,{className:`space-y-2`,children:t.map(e=>S(`li`,{className:`flex gap-3 text-base`,children:[g(`span`,{className:`w-16 shrink-0 text-sm text-po-dim tabular-nums`,children:e.at}),S(`span`,{className:`flex min-w-0 flex-col`,children:[g(`span`,{className:`break-words text-po-text`,children:e.title}),e.owner?g(`span`,{className:`truncate text-sm text-po-dim`,children:e.owner}):null]})]},e.id))}):null,i?g(G,{variant:`ghost`,size:`sm`,onClick:i,className:`-ml-2.5 self-start`,children:`Open Calendar`}):null]});let o=n===`populated`&&t.length===0?g(H,{title:`Nothing scheduled`,description:`Scheduled prompts and workflows will appear here.`}):S(`ul`,{className:`divide-y divide-po-border-soft`,children:[n===`loading`?g(`li`,{className:`px-4 py-3 text-sm text-po-dim`,children:`Loading events…`}):null,n===`error`?g(`li`,{className:`px-4 py-3 text-sm text-po-dim`,children:`Could not load events`}):null,t.map(e=>S(`li`,{className:`flex flex-col gap-0.5 px-4 py-2.5`,children:[g(`span`,{className:`truncate text-base text-po-text`,children:`${e.at} · ${e.title}`}),e.owner?g(`span`,{className:`truncate text-sm text-po-dim`,children:e.owner}):null]},e.id))]});return S(r,{"data-testid":`calendar-home-card`,className:`overflow-hidden`,children:[S(`button`,{type:`button`,onClick:i,disabled:i===void 0,"aria-label":`Open Calendar`,className:`flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-po-selected/40 disabled:cursor-default`,children:[g(U,{"aria-hidden":`true`,className:`size-5 text-po-dim`}),g(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:`Calendar`}),e>0?g(K,{tone:`magenta`,children:`${e} today`}):null,g(z,{"aria-hidden":`true`,className:`size-4 text-po-faint`})]}),g(`div`,{className:`border-t border-po-border-soft`,children:o})]})}function Me(e){return g(Ne,{...e},e.workspaceId??`home`)}function Ne({openPage:e,workspaceId:t,bodyOnly:n=!1}){let r=De(J,``,`page`,void 0,{status:`active`},ue(),void 0,void 0,void 0,void 0,t),[i]=p(()=>new Date().toDateString());return g(je,{bodyOnly:n,dueToday:r.events.filter(e=>new Date(Oe(e)).toDateString()===i).length,rows:r.events.slice(0,Ae).map(e=>({id:e.id,at:ke(Oe(e),i),title:e.title,owner:fe(e,r.targets)})),state:r.state,...e?{onOpen:()=>e(`calendar`)}:{}})}var Pe=a({slot:`dashboard-tiles`,id:`calendar`,order:20,data:{version:1,title:`Coming up`,icon:U,size:`wide`,column:`side`,surfaces:[`home`,`workspace`]},component:e=>g(Me,{...e,bodyOnly:!0})}),Fe=a({slot:`home-apps`,id:`calendar`,data:{column:`main`},component:Me});function Ie({fixture:e,editor:t,delay:n,initialLevel:r=`Session`,initialSchedule:i=`Once`,initialTarget:a=`New session`,invalid:o=!1,edit:l=!1}){let[u,d]=p(t?.owner??r),[f,m]=p(i),[h,_]=p(a),v=n??(t?{seconds:t.fields.delay??`0`,onChange:e=>t.set(`delay`,e)}:void 0),y=t?.fields.kind??f,b=t?.fields.targetKind??h;return S(`form`,{onSubmit:e=>{e.preventDefault(),t?.save()},"aria-label":`Event design target`,className:`mx-auto flex w-full max-w-lg flex-col gap-4 bg-po-panel p-5 font-sans text-base text-po-text`,children:[S(`header`,{children:[g(`h1`,{className:`text-xl font-semibold text-po-hi`,children:l?`Edit event`:`New event`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Scheduled work, handled by Po.`})]}),S(`div`,{className:`flex flex-col gap-1.5`,children:[g(V,{htmlFor:`event-title`,children:`Title`}),g(B,{id:`event-title`,defaultValue:t?void 0:`Prepare release notes`,value:t?.fields.title,onChange:e=>t?.set(`title`,e.target.value),required:!0})]}),t?.execution?S(`p`,{className:`text-sm text-po-dim`,children:[t.execution,` (read-only)`]}):S(`div`,{className:`flex flex-col gap-1.5`,children:[g(V,{htmlFor:`event-prompt`,children:`What should Po do?`}),g(ee,{id:`event-prompt`,rows:3,defaultValue:t?void 0:`Review changes since the last release and draft concise release notes. Ask before publishing.`,value:t?.fields.prompt,onChange:e=>t?.set(`prompt`,e.target.value),required:!0})]}),t?.assignment?S(`p`,{className:`text-sm text-po-dim`,children:[`Agent setup (read-only): `,t.assignment]}):null,S(`fieldset`,{children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Belongs to`}),g(c,{value:u,onValueChange:d,children:g(E,{"aria-label":`Event owner level`,children:(t?[t.owner]:[`Session`,`Workspace`,`Global`]).map(e=>g(s,{value:e,children:e},e))})}),g(`p`,{className:`mt-2 text-sm text-po-dim`,children:u===`Session`?e.session:u===`Workspace`?`${e.workspace} workspace`:`Available across workspaces on this host`})]}),S(`fieldset`,{className:`flex flex-col gap-3`,children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Schedule`}),g(c,{value:y,onValueChange:e=>{m(e),t?.set(`kind`,e)},children:g(E,{"aria-label":`Schedule type`,children:[`Once`,`Interval`,`Cron`].map(e=>g(s,{value:e,children:e},e))})}),y===`Once`?S(`div`,{className:`grid grid-cols-2 gap-3`,children:[S(`div`,{children:[g(V,{htmlFor:`event-date`,children:`Date`}),g(B,{className:`mt-1 w-full`,id:`event-date`,type:`date`,defaultValue:t?void 0:`2026-10-22`,value:t?.fields.date,onChange:e=>t?.set(`date`,e.target.value),required:!0})]}),S(`div`,{children:[g(V,{htmlFor:`event-time`,children:`Time`}),g(B,{className:`mt-1 w-full`,id:`event-time`,type:`time`,defaultValue:t?void 0:`14:30`,value:t?.fields.time,onChange:e=>t?.set(`time`,e.target.value),required:!0})]})]}):y===`Interval`?S(`div`,{children:[g(V,{htmlFor:`event-interval`,children:`Every (seconds)`}),g(B,{className:`mt-1 w-full`,id:`event-interval`,type:`number`,min:30,max:3600,defaultValue:t?void 0:300,value:t?.fields.seconds,onChange:e=>t?.set(`seconds`,e.target.value)}),S(`p`,{className:`mt-1 text-sm text-po-dim`,children:[`30 to 3,600 seconds.`,` `,Number(v?.seconds)>0?`Delay also applies to the first run.`:`First run starts now.`]})]}):S(`div`,{children:[g(V,{htmlFor:`event-cron`,children:`Cron expression`}),g(B,{className:`mt-1 font-mono`,id:`event-cron`,defaultValue:t?void 0:`0 9 * * 1-5`,value:t?.fields.expr,onChange:e=>t?.set(`expr`,e.target.value)}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Every weekday at 09:00.`})]}),v?S(`div`,{children:[g(V,{htmlFor:`event-random-delay`,children:`Random delay, up to (seconds)`}),g(B,{className:`mt-1 w-full`,id:`event-random-delay`,type:`number`,min:0,max:3600,value:v.seconds,"aria-invalid":v.error?!0:void 0,"aria-describedby":v.error?`event-delay-help event-delay-error`:`event-delay-help`,onChange:e=>v.onChange(e.target.value)}),S(`p`,{id:`event-delay-help`,className:`mt-1 text-sm text-po-dim`,children:[`0 means no delay. `,y===`Interval`?`Use less than the interval.`:`Up to 60 minutes.`,y===`Cron`?` Each run starts before the next scheduled time.`:``]}),v.error?g(`p`,{id:`event-delay-error`,role:`alert`,className:`mt-1 text-sm text-po-red`,children:v.error}):null]}):null,S(`div`,{children:[g(V,{htmlFor:`event-timezone`,children:`Timezone`}),g(B,{className:`mt-1 w-full`,id:`event-timezone`,defaultValue:t?void 0:e.timezone,value:t?.fields.tz,onChange:e=>t?.set(`tz`,e.target.value)})]}),o||t?.error?g(`p`,{role:`alert`,className:`text-sm text-po-red`,children:t?.error??`Choose a time in the future. Your event has not been saved.`}):null]}),S(`fieldset`,{children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Run in`}),g(c,{value:b,onValueChange:e=>{_(e),t?.set(`targetKind`,e)},children:g(E,{"aria-label":`Event target`,children:[`New session`,`Existing session`].map(e=>g(s,{value:e,children:e},e))})}),S(`div`,{className:`mt-3`,children:[g(V,{htmlFor:`event-target`,children:b===`New session`?`Workspace`:`Session`}),t?S(`select`,{"aria-label":`Event target`,className:`w-full rounded border border-po-border bg-po-panel p-2`,value:t.fields.targetId,onChange:e=>t.set(`targetId`,e.target.value),children:[g(`option`,{value:``,children:`Choose a target`}),t.choices.map(e=>g(`option`,{value:e.id,children:e.name},e.id))]}):g(G,{className:`mt-1 w-full justify-start`,id:`event-target`,children:b===`New session`?e.workspace:e.session})]}),g(`p`,{className:`mt-2 text-sm text-po-dim`,children:b===`New session`?`A fresh session each run. Workflow sessions stay open.`:`Po wakes this session if it is asleep, then delivers your prompt.`})]}),g(`p`,{className:`text-sm text-po-dim`,children:`If Po is offline, the missed run is skipped. No catch-up burst.`}),S(`footer`,{className:`flex justify-end gap-2 border-t border-po-border pt-4`,children:[g(G,{variant:`ghost`,onClick:()=>t?.close(),children:`Cancel`}),g(G,{type:`submit`,variant:`primary`,disabled:t?.busy,children:l?`Save changes`:`Schedule event`})]})]})}function Le({model:e,sessionId:n,openSession:r}){return S(u,{children:[e.error?g(`p`,{role:`alert`,className:`text-po-red`,children:e.error}):null,e.editor?g(m,{open:!0,onOpenChange:t=>{!t&&!e.busy&&e.editor?.close()},children:S(f,{className:`max-h-[90vh] overflow-y-auto`,"aria-describedby":void 0,children:[g(t,{className:`sr-only`,children:e.editing===`new`?`New event`:`Edit event`}),g(Ie,{fixture:e.data,editor:e.editor,edit:e.editing!==`new`})]})}):null,e.history?g(m,{open:!0,onOpenChange:t=>{t||e.closeHistory()},children:S(f,{"aria-describedby":void 0,children:[g(b,{dismissible:!0,closeLabel:`Close history`,children:S(t,{className:`min-w-0 truncate text-base`,children:[`History: `,e.history.event.title]})}),S(ie,{children:[e.history.items.length===0?g(`p`,{className:`text-po-dim`,children:`No runs yet.`}):null,e.history.items.map(t=>S(`div`,{className:`flex flex-col gap-1 border-b border-po-border-soft pb-3 last:border-b-0`,children:[S(`p`,{children:[new Date(t.dueAt).toLocaleString(),` · `,t.state]}),t.error?g(`p`,{className:`text-sm text-po-dim`,children:t.error}):null,t.summary?g(`p`,{className:`text-sm text-po-dim`,children:t.summary}):null,t.workflowRun?S(`p`,{className:`break-words text-sm text-po-dim`,children:[`Workflow launch: `,JSON.stringify(t.workflowRun)]}):null,t.skippedCount?S(`p`,{className:`text-sm text-po-dim`,children:[`Skipped: `,t.skippedCount]}):null,t.sessionId&&r?g(G,{size:`sm`,variant:`secondary`,className:`self-start`,onClick:()=>{e.closeHistory(),r(xe(t.sessionId,n))},children:`Open run session`}):null]},t.id))]}),e.history.cursor?g(te,{children:g(G,{disabled:e.busy,onClick:e.moreHistory,children:`More history`})}):null]})}):null]})}function Re(e,t){let n=e=>e.projectedDueAt??e.nextDueAt??e.updatedAt;return[...e.map(e=>({...e,place:`cloud`})),...t.map(e=>({...e,place:`local`}))].sort((e,t)=>n(e)-n(t))}function ze(e,t,n){return{...e,busy:e.busy||t.busy,create:()=>t.create(),retry:()=>{e.retry(),t.retry()},event:(r,i)=>(n(i)?t:e).event(r,i)}}var Be=[[`open`,`Active or paused`],[`active`,`Active`],[`paused`,`Paused`],[`done`,`Done`],[`cancelled`,`Cancelled`],[`all`,`Any status`]],Ve=[[`all`,`Any schedule`],[`once`,`Once`],[`interval`,`Interval`],[`cron`,`Cron`]],He=[[`month`,`Month`],[`week`,`Week`],[`agenda`,`Agenda`]],Ue=3;function We({label:e,value:t,options:r,onChange:i}){return S(x,{value:t,onValueChange:i,children:[g(W,{"aria-label":e,className:`h-8 min-w-0 md:w-44`,children:g(R,{})}),g(n,{children:r.map(([e,t])=>g(oe,{value:e,children:t},e))})]})}var Ge=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ke({event:e,open:t,onOpen:n}){return S(`li`,{className:`flex items-start gap-3`,children:[g(`span`,{className:`w-12 shrink-0 pt-2.5 font-mono text-sm text-po-dim`,children:e.time}),g(`div`,{className:`min-w-0 flex-1`,children:S(G,{size:`card`,variant:`subtle`,"aria-pressed":t,onClick:n,children:[S(`span`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[S(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.profile?g(D,{name:e.profile,size:`sm`}):null,g(`span`,{className:`font-semibold text-po-hi`,children:e.title})]}),g(o,{tone:e.status===`done`?`ok`:`neutral`,className:`text-po-dim`,children:Ge(e.status)})]}),S(`span`,{className:`text-sm text-po-dim`,children:[e.schedule,` · `,e.target]}),g(`span`,{className:`text-sm text-po-dim`,children:e.owner})]})})]})}function qe({event:e,when:t,back:n,actions:r,runs:i,onAsk:a,onBack:s}){let[c,l]=p(``),[u,d]=p(!1),[f,m]=p(``),[h,_]=p(`Copy event id`),v=()=>{(navigator.clipboard?.writeText(e.id)??Promise.reject(Error(`No clipboard`))).then(()=>_(`Event id copied`),()=>_(`Copy failed, select the id instead`))},y=e.status===`cancelled`||e.status===`done`,b=r?.busy||u,x=t=>{t.preventDefault(),a&&c.trim()&&!u&&(d(!0),m(``),a(e.id,c.trim()).then(()=>l(``),e=>m(e instanceof Error?e.message:String(e))).finally(()=>d(!1)))},C=[[`This run`,t],[`Schedule`,e.schedule],[`Runs in`,e.target],[`Owner`,e.owner],[`Agent`,e.profile],[`Runs`,e.execution],[`Managed by`,e.source]],w=i?.id===e.id?i:void 0;return S(`div`,{className:`flex flex-col gap-4`,children:[S(G,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:s,children:[g(ne,{className:`size-4`,"aria-hidden":`true`}),n]}),S(`div`,{className:`flex flex-col gap-2`,children:[S(`div`,{className:`flex flex-wrap items-center gap-2`,children:[g(`h2`,{className:`text-xl font-semibold text-po-hi`,children:e.title}),g(o,{tone:e.status===`done`?`ok`:`neutral`,className:`text-po-dim`,children:Ge(e.status)})]}),S(`div`,{className:`flex items-center gap-1 text-sm text-po-dim`,children:[`Event id`,g(`code`,{className:`rounded bg-po-panel px-1.5 py-0.5 font-mono text-po-text`,children:e.id}),g(G,{variant:`ghost`,size:`icon`,"aria-label":h,title:h,onClick:v,children:g(T,{className:`size-4`,"aria-hidden":`true`})})]})]}),g(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`,children:C.map(([e,t])=>t?S(`div`,{className:`contents`,children:[g(`dt`,{className:`text-po-dim`,children:e}),g(`dd`,{className:`min-w-0 break-words text-po-text`,children:t})]},e):null)}),S(`section`,{"aria-label":`Prompt`,className:`flex flex-col gap-1`,children:[g(`h3`,{className:`font-semibold text-po-hi`,children:`Prompt`}),g(`p`,{className:`rounded bg-po-panel p-2 text-sm whitespace-pre-wrap`,children:e.prompt})]}),S(`section`,{"aria-label":`Recent runs`,className:`flex flex-col gap-1 text-sm`,children:[g(`h3`,{className:`text-base font-semibold text-po-hi`,children:`Recent runs`}),w?w.error?g(`p`,{className:`text-po-dim`,children:w.error}):w.items.length===0?g(`p`,{className:`text-po-dim`,children:`No runs yet`}):g(`ul`,{className:`flex flex-col gap-0.5`,children:w.items.map(e=>S(`li`,{children:[e.at,` · `,e.state,e.note?S(`span`,{className:`text-po-dim`,children:[` · `,e.note]}):null]},e.id))}):g(`p`,{className:`text-po-dim`,children:`Loading runs…`}),g(G,{variant:`link`,size:`xs`,className:`self-start px-0`,disabled:b,onClick:()=>r?.event(`history`,e.id),children:`View all history`})]}),a&&!y&&!e.source?S(`form`,{onSubmit:x,className:`flex flex-col gap-1`,children:[g(`label`,{htmlFor:`ask-${e.id}`,className:`font-semibold text-po-hi`,children:`Ask Po to change this event`}),S(`div`,{className:`relative`,children:[g(ee,{id:`ask-${e.id}`,rows:3,maxLength:2e3,className:`w-full pr-10`,placeholder:`e.g. Move this to 10:00 and skip Fridays`,value:c,disabled:u,onChange:e=>l(e.target.value)}),g(G,{type:`submit`,variant:`primary`,size:`icon-md`,"aria-label":`Ask Po`,className:`absolute right-1.5 bottom-1.5 rounded-full`,disabled:b||!c.trim(),children:g(N,{className:`size-4`,"aria-hidden":`true`})})]}),g(`p`,{className:`text-sm text-po-dim`,role:f?`alert`:void 0,children:f||(u?`Starting a session…`:`Po changes this event in a new session and opens it for you.`)})]}):null,y?null:S(`div`,{className:`flex flex-wrap gap-2`,children:[g(G,{variant:`primary`,size:`sm`,disabled:b,onClick:()=>r?.event(`runNow`,e.id),children:`Run now`}),e.source?null:g(G,{size:`sm`,disabled:b,onClick:()=>r?.event(`edit`,e.id),children:`Edit`}),g(G,{size:`sm`,disabled:b,onClick:()=>r?.event(`pause`,e.id),children:e.status===`paused`?`Resume`:`Pause`}),g(G,{size:`sm`,variant:`ghost`,disabled:b,onClick:()=>r?.event(`cancel`,e.id),children:`Cancel event`})]})]})}function Je({mode:e,cells:t,open:n,onOpen:r,...i}){let[a,o]=p(``),s=t.find(e=>e.key===a)??t.find(e=>e.today)??t.find(e=>!e.outside)??t[0],c=(e,t=``)=>{o(e),r(t)},l=s?.events.find(e=>e.id===n);return S(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[S(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g(`div`,{className:`grid grid-cols-7 border-b border-po-border-soft`,"aria-hidden":`true`,children:t.slice(0,7).map(e=>g(`span`,{className:`py-2 text-center text-sm text-po-dim`,children:e.weekday},e.key))}),g(`div`,{className:`grid grid-cols-7`,children:t.map(t=>{let r=e===`month`?t.events.slice(0,Ue):t.events,i=t.events.length-r.length;return S(`section`,{"aria-label":t.label,className:`flex min-w-0 flex-col gap-1 border-r border-b border-po-border-soft p-1.5 ${e===`week`?`min-h-96`:`min-h-28`} ${t.key===s?.key?`bg-po-deep/50`:``}`,children:[g(`button`,{type:`button`,"aria-label":t.label,"aria-pressed":t.key===s?.key,onClick:()=>c(t.key),className:`flex size-6 cursor-pointer items-center justify-center rounded-full text-sm outline-none focus-visible:ring-2 focus-visible:ring-po-green/50 ${t.today?`bg-po-green font-semibold text-po-rail`:t.outside?`text-po-faint hover:bg-po-panel`:`text-po-hi hover:bg-po-panel`}`,children:t.day}),r.map(e=>S(G,{size:`card`,variant:`subtle`,"aria-pressed":t.key===s?.key&&e.id===n,className:`gap-0 bg-po-panel px-1.5 py-1 text-sm`,onClick:()=>c(t.key,e.id),children:[S(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5`,children:[g(`span`,{className:`shrink-0 font-mono text-po-dim`,children:e.time}),g(`span`,{className:`line-clamp-2 font-semibold break-words text-po-hi`,children:e.title})]}),S(`span`,{className:`flex min-w-0 items-center justify-between gap-1 text-po-dim`,children:[S(`span`,{className:`flex min-w-0 items-center gap-1`,children:[e.profile?g(D,{name:e.profile,size:`sm`}):null,g(`span`,{className:`truncate`,children:e.owner.split(` · `).at(-1)})]}),e.status===`Scheduled`?null:g(`span`,{className:`shrink-0`,children:Ge(e.status)})]})]},e.id)),i>0?S(G,{size:`xs`,variant:`ghost`,className:`self-start`,onClick:()=>c(t.key),children:[i,` more`]}):null]},t.key)})})]}),s?g(`aside`,{"aria-label":l?l.title:s.label,className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-t border-po-border-soft px-4 py-3 lg:border-t-0 lg:border-l ${l?`lg:w-96`:`lg:w-80`}`,children:l?g(qe,{event:l,when:`${s.label}, ${l.time}`,back:`Back to ${s.label}`,onBack:()=>r(``),...i},l.id):S(u,{children:[S(`div`,{children:[g(`h2`,{className:`text-lg font-semibold text-po-hi`,children:s.label}),g(`p`,{className:`text-sm text-po-dim`,children:s.events.length===0?`Nothing scheduled`:`${s.events.length} scheduled ${s.events.length===1?`event`:`events`}`})]}),g(`ol`,{className:`flex flex-col gap-2`,children:s.events.map(e=>g(Ke,{event:e,open:!1,onOpen:()=>r(e.id)},e.id))})]})}):null]})}function Ye({days:e,total:t,matched:n=t,onMore:r,filters:i,workspaces:a,timezone:o,state:d=`populated`,mode:f=`agenda`,period:m,cells:h=[],actions:_,runs:v,onAsk:y,onOpen:b,onFilters:x,onMode:w,onMove:T,onClose:D,initialOpen:ee=``,children:k}){let[A,te]=p(ee),j=e=>{te(e),e&&b?.(e)},ne={actions:_,runs:v,onAsk:y},M=e.find(e=>e.events.some(e=>e.id===A)),N=M?.events.find(e=>e.id===A),P=f===`agenda`?e.reduce((e,t)=>e+t.events.length,0):new Set(h.flatMap(e=>e.events.map(e=>e.id))).size,F=i.query!==Y.query||i.workspace!==Y.workspace||i.status!==Y.status||i.kind!==Y.kind,I=e=>x?.({...i,...e});return S(`section`,{"aria-label":`Calendar`,className:`flex h-full min-h-0 w-full flex-col bg-po-rail font-sans text-base text-po-text`,children:[S(`header`,{className:`flex items-start justify-between gap-3 border-b border-po-border px-4 py-3`,children:[S(`div`,{className:`min-w-0`,children:[g(`h1`,{className:`text-xl font-semibold text-po-hi`,children:`Calendar`}),S(`p`,{className:`truncate text-sm text-po-dim`,children:[`All workspaces · Times in `,o]})]}),S(`div`,{className:`flex shrink-0 items-center gap-1`,children:[g(G,{variant:`primary`,disabled:_?.busy,onClick:()=>_?.create(),children:`New event`}),D?g(G,{variant:`ghost`,size:`icon`,"aria-label":`Close calendar`,onClick:D,children:g(l,{className:`size-4`})}):null]})]}),S(`div`,{className:`flex flex-col gap-2 border-b border-po-border-soft px-4 py-3 md:flex-row md:items-center`,children:[S(`div`,{className:`relative min-w-0 flex-1`,children:[g(O,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-po-faint`}),g(B,{type:`search`,"aria-label":`Search events`,className:`w-full pl-8`,placeholder:`Search events`,value:i.query,onChange:e=>I({query:e.target.value})})]}),S(`div`,{className:`grid grid-cols-3 gap-2 md:flex`,children:[g(We,{label:`Workspace`,value:i.workspace,options:[[`all`,`All workspaces`],...a.map(e=>[e.id,e.name])],onChange:e=>I({workspace:e})}),g(We,{label:`Status`,value:i.status,options:Be,onChange:e=>I({status:e})}),g(We,{label:`Schedule`,value:i.kind,options:Ve,onChange:e=>I({kind:e})})]})]}),S(c,{value:f,onValueChange:e=>w?.(e),className:`flex min-h-0 flex-1 flex-col`,children:[S(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-po-border-soft px-4 py-2`,children:[f===`agenda`?null:S(u,{children:[g(G,{variant:`ghost`,size:`icon-md`,"aria-label":`Previous ${f}`,onClick:()=>T?.(-1),children:g(z,{className:`size-4 rotate-180`})}),g(`h2`,{"aria-live":`polite`,className:`min-w-36 text-center text-lg font-semibold text-po-hi`,children:m}),g(G,{variant:`ghost`,size:`icon-md`,"aria-label":`Next ${f}`,onClick:()=>T?.(1),children:g(z,{className:`size-4`})}),g(G,{size:`sm`,variant:`subtle`,onClick:()=>T?.(0),children:`Today`})]}),S(`output`,{className:`text-sm text-po-dim`,children:[P,` of `,n,` `,n===1?`event`:`events`]}),r?g(G,{size:`sm`,variant:`subtle`,disabled:_?.busy,onClick:r,children:`Load more`}):null,F?g(G,{size:`sm`,variant:`ghost`,onClick:()=>x?.(Y),children:`Clear filters`}):n<t?g(G,{size:`sm`,variant:`ghost`,onClick:()=>I({status:`all`}),children:`Show finished events`}):null,g(E,{"aria-label":`Calendar view`,className:`ml-auto`,children:He.map(([e,t])=>g(s,{value:e,children:t},e))})]}),S(C,{value:f,className:`flex min-h-0 flex-col`,children:[k,d===`populated`&&f!==`agenda`?g(Je,{mode:f,cells:h,open:A,onOpen:j,...ne},m):S(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[g(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-3`,children:d===`loading`?g(`output`,{className:`py-6 text-po-dim`,children:`Loading your schedule…`}):d===`error`?S(`div`,{role:`alert`,className:`rounded border border-po-edge-red p-3`,children:[g(`p`,{className:`text-po-red`,children:`Calendar could not load.`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Your saved events are unchanged. Try again when the host is reachable.`}),g(G,{className:`mt-3`,variant:`outline`,onClick:()=>_?.retry(),children:`Try again`})]}):t===0?g(H,{title:`Nothing scheduled`,description:`Leave a prompt for later. Po will take it from here.`}):e.length===0?g(H,{title:`No events match`,description:F?`Try another search, or clear the filters.`:`Nothing is active or paused. Finished and cancelled events are hidden.`}):e.map(e=>S(`section`,{"aria-label":e.label,className:`flex flex-col gap-2`,children:[g(`h2`,{className:`text-sm font-semibold text-po-hi`,children:e.label}),g(`ol`,{className:`flex flex-col gap-2`,children:e.events.map(e=>g(Ke,{event:e,open:A===e.id,onOpen:()=>j(A===e.id?``:e.id)},e.id))})]},e.label))}),d===`populated`&&M&&N?g(`aside`,{"aria-label":N.title,className:`flex min-h-0 flex-col overflow-y-auto border-t border-po-border-soft px-4 py-3 lg:w-96 lg:border-t-0 lg:border-l`,children:g(qe,{event:N,when:`${M.label}, ${N.time}`,back:`Back to agenda`,onBack:()=>j(``),...ne},N.id)}):null]})]})]}),g(`footer`,{className:`border-t border-po-border px-4 py-2 text-sm text-po-dim`,children:`Sleeping sessions wake for their event. Missed runs are skipped.`})]})}var Xe=3,Ze=e=>({id:e.id,at:new Date(e.dueAt).toLocaleString(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),state:e.state.charAt(0).toUpperCase()+e.state.slice(1),note:e.error??e.summary??(e.skippedCount?`${e.skippedCount} skipped`:void 0)});function Qe(e){return y(ce,{scopes:le,basePath:`calendar`,transport:(t,n)=>e?_(i).fetch(t,n):Promise.reject(Error(`This Po is not signed in to Po Cloud.`)),sessionAddress:L})}function $e({openSession:e,poCloud:t}){let[n]=p(Date.now),[r,a]=p(`month`),[o,s]=p(n),c=r===`agenda`?void 0:ye(r,o),l=Intl.DateTimeFormat().resolvedOptions().timeZone,[u,d]=p(Y),[f,m]=p(u);w(()=>{let e=setTimeout(()=>m(u),250);return()=>clearTimeout(e)},[u]);let _=c&&{from:c.from,to:c.to,tz:l},v=ue(),y=De(J,``,`page`,_,de(f),v),b=t!==void 0,x=h(()=>Qe(b),[b]),C=De(x,``,`page`,_,de(f),v),T=b&&C.state===`populated`,E=b,D=T?Re(C.events,y.events):y.events.map(e=>({...e,place:`local`})),O=e=>T&&C.events.some(t=>t.id===e)?C:y,ee=e=>O(e)===C?x:J,[k,A]=p(``),[te,j]=p();w(()=>{if(!k)return;let e=!0;return(T&&C.events.some(e=>e.id===k)?x:J).host.history({params:{id:k}}).then(e=>{if(!e.ok)throw Error(e.error||`Runs could not load.`);return{id:k,items:e.data.occurrences.slice(0,Xe).map(Ze)}}).catch(e=>({id:k,items:[],error:e instanceof Error?e.message:String(e)})).then(t=>e&&j(t)),()=>{e=!1}},[k,y.events,C.events,T,x]);let ne=e&&(async(t,n)=>{let r=O(t)===C,a=await ee(t).host.ask({params:{id:t},body:{request:n}});if(!a.ok)throw Error(a.error||`Po could not start the change.`);e(r?`${i}/${a.data.sessionId}`:a.data.sessionId)}),M=e=>{let n=Ee(e),r=e.place===`cloud`?C.targets:y.targets,i=e.target.kind===`existingSession`?e.target.sessionId:void 0,a=r?.sessions.find(e=>e.sessionId===i)?.name,o=fe(e,r),s=e.place===`cloud`?t?.label:`This computer`;return{...n,target:a??n.target,owner:T?`${s} · ${o}`:o}},N=E?ze(y.actions,C.actions,e=>O(e)===C):y.actions,P=T&&(y.more||C.more)?()=>{y.more?.(),C.more?.()}:y.more,F=(e,t)=>new Date(e).toLocaleDateString(void 0,t),I=c?he(D,c.days,c.to).map((e,t)=>{let i=c.days[t];return{key:String(i),day:new Date(i).getDate(),label:F(i,{weekday:`long`,day:`numeric`,month:`long`}),weekday:F(i,{weekday:`short`}),outside:r===`month`&&new Date(i).getMonth()!==new Date(o).getMonth(),today:i<=n&&n<(c.days[t+1]??c.to),events:e.map(M)}}):void 0,L=c?r===`month`?F(o,{month:`long`,year:`numeric`}):`${F(c.from,{day:`numeric`,month:`short`})} to ${F(c.days.at(-1),{day:`numeric`,month:`short`,year:`numeric`})}`:void 0;return S(Ye,{days:c?[]:me(D,n).map(e=>({label:e.label,events:e.events.map(M)})),total:y.total+(T?C.total:0),matched:y.matched+(T?C.matched:0),onMore:P,filters:u,workspaces:[...T?pe(C.targets):[],...pe(y.targets)],timezone:y.data.timezone,state:T&&y.state===`error`?`populated`:y.state,mode:r,period:L,cells:I,actions:N,runs:te,onOpen:A,onAsk:ne,onFilters:d,onMode:a,onMove:e=>r!==`agenda`&&s(be(r,o,e,Date.now())),children:[g(Le,{model:y,sessionId:``,openSession:e}),E?g(Le,{model:C,sessionId:`${i}/`,openSession:e}):null,b&&C.state===`error`?S(`p`,{role:`alert`,className:`text-po-red`,children:[`Po Cloud events could not load. `,C.error]}):null]})}var et=a({slot:`page`,id:`calendar`,component:$e});function tt({openPage:e,activePageId:t}){let n=t===`calendar`;return g(`div`,{className:`px-3 pt-1 group-data-[rail=desktop]/rail:p-0 group-data-[rail=elegant]/rail:p-0`,children:S(G,{variant:`ghost`,size:`lg`,"data-testid":`calendar-open`,"aria-current":n?`page`:void 0,onClick:()=>e?.(`calendar`),className:n?`w-full justify-start gap-2.5 border border-po-edge-green bg-po-tint-green px-2 text-po-hi group-data-[rail=elegant]/rail:h-9 group-data-[rail=elegant]/rail:border-0 group-data-[rail=elegant]/rail:gap-3 group-data-[rail=elegant]/rail:text-base group-data-[rail=elegant]/rail:rounded-lg group-data-[rail=elegant]/rail:bg-po-panel group-data-[rail=elegant]/rail:px-2.5 group-data-[rail=elegant]/rail:font-medium group-data-[rail=desktop]/rail:h-auto group-data-[rail=desktop]/rail:gap-3 group-data-[rail=desktop]/rail:rounded-xl group-data-[rail=desktop]/rail:border-0 group-data-[rail=desktop]/rail:px-3 group-data-[rail=desktop]/rail:py-2 group-data-[rail=desktop]/rail:text-base group-data-[rail=desktop]/rail:font-medium group-data-[rail=desktop]/rail:text-po-hi group-data-[rail=desktop]/rail:bg-po-rail`:`w-full justify-start gap-2.5 border border-transparent px-2 text-po-text group-data-[rail=elegant]/rail:h-9 group-data-[rail=elegant]/rail:border-0 group-data-[rail=elegant]/rail:gap-3 group-data-[rail=elegant]/rail:text-base group-data-[rail=elegant]/rail:rounded-lg group-data-[rail=elegant]/rail:px-2.5 group-data-[rail=elegant]/rail:font-medium group-data-[rail=elegant]/rail:hover:bg-po-panel/50 group-data-[rail=desktop]/rail:h-auto group-data-[rail=desktop]/rail:gap-3 group-data-[rail=desktop]/rail:rounded-xl group-data-[rail=desktop]/rail:border-0 group-data-[rail=desktop]/rail:px-3 group-data-[rail=desktop]/rail:py-2 group-data-[rail=desktop]/rail:text-base group-data-[rail=desktop]/rail:font-medium group-data-[rail=desktop]/rail:text-po-hi group-data-[rail=desktop]/rail:hover:bg-po-rail`,children:[g(`span`,{className:`contents group-data-[rail=desktop]/rail:grid group-data-[rail=desktop]/rail:size-8 group-data-[rail=desktop]/rail:shrink-0 group-data-[rail=desktop]/rail:place-items-center group-data-[rail=desktop]/rail:rounded-lg group-data-[rail=desktop]/rail:bg-po-rail`,children:g(U,{"aria-hidden":`true`,className:n?`size-5 text-po-green group-data-[rail=elegant]/rail:size-4 group-data-[rail=desktop]/rail:size-4`:`size-5 text-po-dim group-data-[rail=elegant]/rail:size-4 group-data-[rail=desktop]/rail:size-4`})}),`Calendar`]})})}var nt=a({slot:`rail`,id:`calendar`,component:tt});function rt({event:e,actions:t}){let n=e.status===`cancelled`||e.status===`done`;return S(`div`,{className:`mt-2 flex flex-col gap-3 rounded border border-po-border bg-po-panel p-3`,children:[e.source?S(K,{tone:`neutral`,children:[`Managed by `,e.source]}):null,g(`p`,{children:e.prompt}),e.assignment?S(`p`,{className:`text-sm text-po-dim`,children:[`Agent setup: `,e.assignment]}):null,S(`p`,{className:`text-sm text-po-dim`,children:[`Target: `,e.target,`. `,n?`This event is ${e.status}.`:`Sleeping sessions wake automatically.`]}),S(`div`,{className:`flex flex-wrap gap-2`,children:[n?null:S(u,{children:[e.source?null:g(G,{size:`sm`,onClick:()=>t?.event(`edit`,e.id),disabled:t?.busy,children:`Edit event`}),g(G,{size:`sm`,onClick:()=>t?.event(`pause`,e.id),disabled:t?.busy,children:e.status===`paused`?`Resume`:`Pause`}),g(G,{size:`sm`,onClick:()=>t?.event(`runNow`,e.id),disabled:t?.busy,children:`Run now`})]}),g(G,{size:`sm`,onClick:()=>t?.event(`history`,e.id),disabled:t?.busy,children:`History`}),n?null:g(G,{size:`sm`,variant:`danger-outline`,disabled:t?.busy,onClick:()=>t?.event(`cancel`,e.id),children:`Cancel event`})]})]})}function it({fixture:e,actions:t,children:n,initialScope:r=`Session`,state:i=`populated`,detail:a=!1}){let[l,u]=p(r),[d,f]=p(`Thu 22`),m=t?e.days[e.selectedDay??0]:d,[h,_]=p(a?`reviews`:``),v=e.events.filter(e=>t||l===`Everything`||e.owner===`Session`||l===`Workspace`&&e.owner===`Workspace`);return S(`section`,{"aria-label":`Calendar design target`,className:`mx-auto flex min-h-screen w-full max-w-lg flex-col gap-4 border-x border-po-border bg-po-rail p-4 font-sans text-base text-po-text`,children:[S(`header`,{className:`flex items-start justify-between gap-3`,children:[S(`div`,{children:[g(`h1`,{className:`text-lg font-semibold text-po-hi`,children:`Calendar`}),g(`p`,{className:`text-sm text-po-dim`,children:`Po handles it, on your schedule.`})]}),g(G,{variant:`outline`,disabled:t?.busy,onClick:()=>t?.create(),children:`New event`})]}),S(c,{value:l,onValueChange:e=>{u(e),t?.scope(e)},children:[g(E,{"aria-label":`Calendar level`,children:[`Session`,`Workspace`,`Everything`].map(e=>g(s,{value:e,children:e},e))}),[`Session`,`Workspace`,`Everything`].map(t=>g(C,{value:t,className:`mt-2 text-sm text-po-dim`,children:t===`Session`?e.session:t===`Workspace`?`${e.workspace} and its sessions`:`All workspaces and sessions on this host`},t))]}),S(`div`,{className:`flex items-center justify-between gap-2`,children:[g(`h2`,{className:`font-semibold text-po-hi`,children:e.range??`19–25 October 2026`}),g(G,{size:`sm`,variant:`ghost`,onClick:()=>{f(`Thu 22`),t?.today()},children:`Today`})]}),t?S(`div`,{className:`flex justify-between`,children:[g(G,{onClick:()=>t?.week(-1),children:`Previous week`}),g(G,{onClick:()=>t?.week(1),children:`Next week`})]}):null,g(`div`,{className:`grid grid-cols-7 gap-1`,"aria-label":`Days this week`,children:e.days.map(n=>S(G,{"aria-pressed":m===n,variant:m===n?`primary`:`ghost`,className:`h-auto flex-col px-1 py-2`,onClick:()=>{f(n),t?.day(e.days.indexOf(n)),_(``)},children:[g(`span`,{className:`text-sm`,children:n.split(` `)[0]}),g(`span`,{children:n.split(` `)[1]})]},n))}),S(`div`,{children:[g(`h2`,{className:`font-semibold text-po-hi`,children:t?m:m===`Thu 22`?`Today · Thursday 22 October`:`${m} October`}),S(`p`,{className:`mt-1 text-sm text-po-dim`,children:[`Times in `,e.timezone]})]}),n,i===`loading`?g(`output`,{className:`py-6 text-po-dim`,children:`Loading your schedule…`}):i===`error`?S(`div`,{role:`alert`,className:`rounded border border-po-edge-red p-3`,children:[g(`p`,{className:`text-po-red`,children:`Calendar could not load.`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Your saved events are unchanged. Try again when the host is reachable.`}),g(G,{className:`mt-3`,variant:`outline`,onClick:()=>t?.retry(),children:`Try again`})]}):i===`denied`?g(H,{title:`This calendar is not available`,description:`You do not have permission to view this level. Your session calendar is still available.`}):i===`empty`||t&&v.length===0||!t&&m!==`Thu 22`?g(H,{title:`Nothing scheduled`,description:`Leave a prompt for later. Po will take it from here.`}):g(`ol`,{className:`flex flex-col gap-3`,children:v.map(n=>S(`li`,{className:`flex items-start gap-3`,children:[g(`span`,{className:`w-10 shrink-0 pt-3 text-sm text-po-dim`,children:n.time}),S(`div`,{className:`min-w-0 flex-1`,children:[S(G,{size:`card`,variant:`outline`,"aria-expanded":h===n.id,onClick:()=>_(h===n.id?``:n.id),children:[S(`span`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[g(`span`,{className:`font-semibold text-po-hi`,children:n.title}),n.status===`Scheduled`?g(o,{tone:`neutral`,className:`text-po-dim`,children:i===`blocked`&&n.id===`reviews`?`Paused`:`Scheduled`}):g(o,{tone:t?n.status===`done`?`ok`:`neutral`:i===`failed`?`error`:`ok`,children:t?n.status:i===`failed`?`Failed`:`Handled`})]}),S(`span`,{className:`text-sm text-po-dim`,children:[n.schedule,` · `,n.target]}),S(`span`,{className:`text-sm text-po-dim`,children:[n.owner,n.owner===`Global`?``:` · ${e.workspace}`]})]}),h===n.id?g(rt,{event:n,actions:t}):null]})]},n.id))}),i===`skipped`?S(`aside`,{className:`rounded border border-po-border p-3`,children:[g(K,{tone:`neutral`,children:`Skipped`}),g(`p`,{className:`mt-2`,children:`The inbox check yesterday did not run while Po was offline.`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`No catch-up burst. Next run: tomorrow at 09:00.`})]}):null,i===`blocked`?S(`aside`,{className:`rounded border border-po-edge-magenta bg-po-tint-magenta p-3`,children:[g(`p`,{className:`font-semibold text-po-magenta`,children:`Pick a session, whenever you are ready`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`The target for “Review pull requests” is no longer available. This event is paused.`}),g(G,{className:`mt-3`,variant:`secondary`,children:`Choose session`})]}):null,i===`failed`?S(`aside`,{className:`rounded border border-po-edge-red p-3`,children:[g(`p`,{className:`font-semibold text-po-red`,children:`Inbox check failed`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Po could not reach the mail service. The next scheduled run is unchanged.`}),g(G,{className:`mt-3`,children:`View run`})]}):null,g(`footer`,{className:`mt-auto border-t border-po-border pt-3 text-sm text-po-dim`,children:`Sleeping sessions wake for their event. Missed runs are skipped.`})]})}function at(e){return e.sessionId?g(ot,{sessionId:e.sessionId,openSession:e.openSession},e.sessionId):null}function ot({sessionId:e,openSession:t}){let n=De(J,e,`panel`,void 0,void 0,ue());return g(it,{fixture:n.data,actions:n.actions,state:n.state,children:g(Le,{model:n,sessionId:e,openSession:t})})}var st=v({id:`calendar`,label:`Calendar`,icon:U,order:40,panel:at}),ct=a({slot:`help.guides`,id:`Calendar`,order:20,data:{version:1,label:`Calendar`,guides:[{id:`schedule`,question:`How do I schedule a prompt?`,order:0,answer:`Ask Po to schedule a prompt for a time, then confirm the schedule. Calendar must be selected in your home default preset, and the server must stay running.`},{id:`repeat`,question:`Can Po run something on a repeat?`,order:1,answer:`Yes. Calendar supports intervals and cron schedules with a timezone. Intervals run immediately when created. Missed runs are skipped after downtime.`}]}}),lt=[`calendar_schedule`,`calendar_list`,`calendar_cancel`,`calendar_update`,`calendar_pause`,`calendar_resume`,`calendar_run_now`,`calendar_history`,`loop_start`,`loop_list`,`loop_stop`],ut={calendar_schedule:{outcome:`Scheduled`,tone:`ok`},calendar_update:{outcome:`Updated`,tone:`ok`},calendar_resume:{outcome:`Resumed`,tone:`ok`},calendar_run_now:{outcome:`Started now`,tone:`ok`,note:`This run does not change the schedule.`},calendar_cancel:{outcome:`Cancelled`,tone:`neutral`,note:`It will not run. Past runs stay in its history.`,quiet:!0},calendar_pause:{outcome:`Paused`,tone:`neutral`,note:`Nothing runs until it is resumed.`,quiet:!0}},dt={calendar_schedule:`Not scheduled`,calendar_update:`Not updated`,calendar_cancel:`Not cancelled`,calendar_pause:`Not paused`,calendar_resume:`Not resumed`,calendar_run_now:`Did not start`,calendar_list:`Could not list events`,calendar_history:`Could not read its history`,loop_start:`Not scheduled`,loop_list:`Could not list events`,loop_stop:`Not stopped`},ft={succeeded:{label:`Done`,tone:`ok`},failed:{label:`Failed`,tone:`error`},skipped:{label:`Skipped`,tone:`neutral`},blocked:{label:`Needs a session`,tone:`accent`},queued:{label:`Queued`,tone:`neutral`},running:{label:`Running`,tone:`running`},interrupted:{label:`Interrupted`,tone:`neutral`}};function Z(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Q(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function pt(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function mt(e,t){try{return new Intl.DateTimeFormat(void 0,{...t,...e?{timeZone:e}:{}})}catch{return new Intl.DateTimeFormat(void 0,t)}}function ht(e,t){return mt(t,{weekday:`short`,day:`numeric`,month:`short`,year:`numeric`,hour:`numeric`,minute:`2-digit`}).format(e)}function gt(e,t){return mt(t,{weekday:`short`,day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`}).format(e)}function _t(e){let[t,n]=e%3600==0?[e/3600,`hour`]:e%60==0?[e/60,`minute`]:[e,`second`];return t===1?`Every ${n}`:`Every ${t} ${n}s`}function vt(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function yt(e,t){let n=Z(e.target),r=Q(Z(e.workflow)?.key),i=Q(Z(e.action)?.launcherId),a=Q(n?.cwd),o=n?.kind===`newSession`,s=o?`new session${a?` in ${vt(a)}`:``}`:t&&Q(n?.sessionId)&&n?.sessionId!==t?`another session`:`this session`;return r?`Workflow ${r} in ${o?`a `:``}${s}`:i?`Action ${i} in ${o?`a `:``}${s}`:o?`N${s.slice(1)}`:`Prompt in ${s}`}function bt(e,t,n={}){let r=Z(e),i=Z(r?.schedule),a=Q(r?.title);if(!r||!i||!a)return;let o=Q(i.tz),s=pt(r.nextDueAt),c,l=!1;if(i.kind===`once`&&pt(i.at)!==void 0)c=ht(i.at,o);else if(i.kind===`interval`&&pt(i.seconds)!==void 0)c=_t(i.seconds);else if(i.kind===`cron`&&Q(i.expr))c=i.expr,l=!0;else return;let u=r.status===`paused`?{label:`Paused`,tone:`neutral`}:r.status===`cancelled`?{label:`Cancelled`,tone:`neutral`}:r.status===`done`?{label:`Done`,tone:`ok`}:void 0;return{title:a,when:c,...l?{cron:l}:{},...o&&i.kind!==`interval`?{zone:o}:{},...n.next!==!1&&i.kind!==`once`&&s!==void 0&&r.status===`active`?{next:gt(s,o)}:{},runs:yt(r,t),...n.prompt!==!1&&Q(r.prompt)?{prompt:r.prompt}:{},...u?{status:u}:{}}}function xt(e){let t=e.result?.details;if(t==null)return e.output;try{return JSON.stringify(t,null,2)}catch{return e.output}}function St(e,t){return e===0?`No ${t}s`:`${e} ${t}${e===1?``:`s`}`}function Ct(e){let{toolName:t,args:n,sessionId:r}=e,i=e.result?.details,a=xt(e),o=Q(n.title)??Q(Z(n.patch)?.title)??Q(Z(n.input)?.prompt)??``;if(e.running)return{tone:`running`,summary:o,details:``};if(e.isError)return{tone:`error`,summary:o,failure:{heading:dt[t]??`Calendar call failed`,detail:Q(e.output)??`Calendar gave no reason.`},...t.endsWith(`_list`)||t===`calendar_history`?{}:{note:`Nothing was saved.`},details:``};let s={tone:`ok`,summary:o,note:`This result has no summary. The details below are what Calendar returned.`,details:a},c=ut[t];if(c){let e=bt(i,r,{next:!c.quiet,prompt:!c.quiet});if(!e)return s;let{status:t,...n}=e;return{tone:c.tone,outcome:c.outcome,summary:e.title,event:n,...c.note?{note:c.note}:{},details:a}}switch(t){case`calendar_list`:{let e=Z(i),t=Array.isArray(i)?i:e?.events;if(!Array.isArray(t))return s;let n=t.flatMap(e=>{let t=Z(e);if(t?.view===`busy`){let e=Q(t.title),n=Q(t.schedule),r=Q(Z(t.owner)?.name);return e&&n&&r?[{title:e,when:n,runs:r}]:[]}let n=bt(t,r,{prompt:!1});return n?[n]:[]});return{tone:`ok`,summary:St(n.length,`event`),...n.length?{events:n}:{empty:e?`No events match this page.`:`Nothing scheduled in this session yet.`},details:a}}case`calendar_history`:{let e=Z(i)?.occurrences;if(!Array.isArray(e))return s;let t=e.flatMap(e=>{let t=Z(e),n=pt(t?.dueAt);if(!t||n===void 0)return[];let r=ft[String(t.state)]??{label:String(t.state),tone:`neutral`},i=Q(t.summary)??Q(t.error);return[{when:gt(n),...r,...i?{note:i}:{}}]});return{tone:`ok`,summary:St(t.length,`run`),...t.length?{runs:t}:{empty:`It has not run yet.`},...Q(Z(i)?.cursor)?{note:`Older runs are on the next page.`}:{},details:a}}case`loop_start`:{let e=Z(n.input),t=Z(i),r=Q(e?.cron),o=pt(e?.intervalSeconds),c=Q(e?.timezone),l=Q(t?.label)??Q(e?.prompt)??`Recurring event`;return!r&&o===void 0?{...s,outcome:`Started`,summary:l}:{tone:`ok`,outcome:`Scheduled`,summary:l,event:{title:l,when:r??_t(o),...r?{cron:!0}:{},...r&&c?{zone:c}:{},runs:`Prompt in this session`,...Q(e?.prompt)?{prompt:e?.prompt}:{}},details:a}}case`loop_list`:{let e=Z(i)?.instances;if(!Array.isArray(e))return s;let t=e.flatMap(e=>{let t=Z(e),n=Q(t?.label)??Q(t?.launcherLabel);return!t||!n?[]:[{title:n,when:Q(t.launcherLabel)??`Recurring`,runs:`This session`,...t.state===`running`?{}:{status:{label:`Stopping`,tone:`neutral`}}}]});return{tone:`ok`,summary:St(t.length,`recurring event`),...t.length?{events:t}:{empty:`Nothing recurring in this session.`},details:a}}case`loop_stop`:{let e=Z(i)?.stopped;return typeof e==`boolean`?{tone:`neutral`,outcome:e?`Stopped`:`Not found`,summary:Q(n.instanceId)??``,note:e?`It will not run again.`:`Nothing was running under that id.`,details:a}:s}default:return s}}var wt=new Set([...Object.keys(ut),`loop_start`,`loop_stop`]);function Tt(e){if(e.running||e.isError||!wt.has(e.toolName))return[];let t=Ct(e);if(!t.outcome)return[];let n=t.summary?` "${t.summary}"`:``;return[`${t.outcome}${n}${t.event?` · ${t.event.when}`:``}`]}function Et({label:e,children:t}){return S(`div`,{className:`flex gap-3`,children:[g(`dt`,{className:`w-12 shrink-0 pt-px text-sm text-po-dim`,children:e}),g(`dd`,{className:`min-w-0 flex-1 break-words text-base text-po-text`,children:t})]})}function Dt({event:e}){return S(u,{children:[e.cron?g(`code`,{className:`font-mono text-po-text`,children:e.when}):e.when,e.zone?S(`span`,{className:`text-sm text-po-dim`,children:[` · `,e.zone]}):null]})}function Ot({event:e}){return S(`div`,{className:`flex flex-col gap-3`,children:[S(`dl`,{className:`flex flex-col gap-1.5`,children:[g(Et,{label:`When`,children:g(Dt,{event:e})}),e.next?g(Et,{label:`Next`,children:e.next}):null,g(Et,{label:`Runs`,children:e.runs})]}),e.prompt?g(`p`,{className:`line-clamp-3 border-l-2 border-po-border-soft pl-3 text-base break-words text-po-text`,children:e.prompt}):null]})}function kt({event:e}){return S(`li`,{className:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`,children:[S(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[g(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.title}),S(`span`,{className:`text-sm break-words text-po-dim`,children:[g(Dt,{event:e}),e.next?` · Next ${e.next}`:null]})]}),e.status?g(o,{tone:e.status.tone,children:e.status.label}):null]})}function At({run:e}){return S(`li`,{className:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`,children:[S(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[g(`span`,{className:`text-base text-po-text`,children:e.when}),e.note?g(`span`,{className:`text-sm break-words text-po-dim`,children:e.note}):null]}),g(o,{tone:e.tone,children:e.label})]})}function jt({toolName:e,fixture:t,defaultExpanded:n=!1}){let r=t.details.split(`
|
|
2
|
-
`).map(e=>({text:e,tone:`text`}));return g(I,{tone:t.tone,expandable:t.details!==``,defaultExpanded:n,children:({expanded:n})=>S(u,{children:[g(j,{title:e,badge:t.outcome,children:g(`span`,{className:`min-w-0 truncate text-po-text`,children:t.summary})}),S(F,{className:`flex flex-col gap-3`,children:[t.failure?S(`div`,{className:`flex flex-col gap-1`,children:[g(`p`,{className:`text-base font-semibold text-po-red`,children:t.failure.heading}),g(`p`,{className:`text-sm break-words text-po-dim`,children:t.failure.detail})]}):null,t.event?g(Ot,{event:t.event}):null,t.events?.length?g(`ol`,{className:`flex flex-col divide-y divide-po-border-soft`,children:t.events.map(e=>g(kt,{event:e},`${e.title}-${e.when}`))}):null,t.runs?.length?g(`ol`,{className:`flex flex-col divide-y divide-po-border-soft`,children:t.runs.map(e=>g(At,{run:e},e.when))}):null,t.empty?g(`p`,{className:`text-base text-po-dim`,children:t.empty}):null,t.tone===`running`?g(q,{tone:`running`,children:`Saving to your calendar`}):null,t.note?g(`p`,{className:`text-sm text-po-dim`,children:t.note}):null,t.details?S(`div`,{className:`flex flex-col gap-3 border-t border-po-border-soft pt-3`,children:[g(q,{expands:!0,glyph:n?`⌄`:`›`,className:`text-sm text-po-dim`,children:n?`Hide details`:`Show details`}),n?g(se,{lines:r}):null]}):null]})]})})}function Mt(e){return g(jt,{toolName:e.toolName,fixture:Ct(e)})}var Nt=d({tools:[...lt],activity:Tt,message:Mt}),$=(e,t)=>t===void 0?void 0:{...e,...t},Pt=A({id:`calendar`,packageName:`@agimon-ai/po-calendar`,host:{get fills(){return[$({slot:`dashboard-tiles`,id:`calendar`},Pe),$({slot:`home-apps`,id:`calendar`},Fe),$({slot:`page`,id:`calendar`},et),$({slot:`rail`,id:`calendar`},nt)]}},session:{get dockFaces(){return[$({id:`calendar`},st)]},get fills(){return[$({slot:`help.guides`,id:`calendar`},ct)]},get toolRenderers(){return[$({tools:[`calendar`]},Nt)]}}});export{Pt as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,Ba as t,Gr as n,Hr as r,Ht as i,It as a,Ji as o,Jt as s,Ki as c,Lt as l,Nn as u,Oa as d,Pr as f,Qi as p,Rr as m,Rt as h,Ua as g,Un as _,Ur as v,Ut as y,Vt as b,Wr as x,Yi as S,Za as C,Zi as w,_r as T,aa as E,cr as D,da as O,ga as k,gr as A,hr as j,in as ee,io as M,jt as te,ki as N,mr as P,nn as F,oa as I,on as L,qi as R,qt as ne,ra as re,ti as z,wi as B,za as ie}from"../chunks/po-web-runtime-C-6-Rprr.js";var ae=/^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$/u,V=`domains`,H=`newDomain`,U={view:{method:`GET`,path:`/view`,response:void 0},toggle:{method:`POST`,path:`/toggle`,response:void 0},addToDomain:{method:`POST`,path:`/domain-plugins`,response:void 0},removeFromDomain:{method:`DELETE`,path:`/domain-plugins`,response:void 0},createDomain:{method:`POST`,path:`/domains`,response:void 0},deleteDomain:{method:`DELETE`,path:`/domains`,response:void 0},deletePlugin:{method:`DELETE`,path:`/plugins`,response:void 0},previewUpload:{method:`POST`,path:`/uploads/preview`,response:void 0},installUpload:{method:`POST`,path:`/uploads`,query:[V,H],response:void 0}};d(U,{scopes:[`session`],basePath:`domains`,transport:(e,t)=>te.fetch(e,t),sessionAddress:M});var W=d(U,{scopes:[`host`,`workspace`,`session`],basePath:`plugin-settings`,transport:(e,t)=>te.fetch(e,t),sessionAddress:M}),oe={"content-type":`application/json`},G={"content-type":`application/zip`};async function se(e,t){let n;try{n=await e.json()}catch{n=void 0}return e.ok?{value:n}:{error:typeof n==`object`&&n&&`error`in n&&typeof n.error==`string`?n.error:t}}async function K(e,t,n,r){try{return await se(await e(t,n),r)}catch(e){return{error:e instanceof Error?e.message:r}}}var q=e=>e===void 0?W.host:W.workspace(e);async function ce(e,t){return await K(e,q(t).view.url(),{},`Your plugins could not be read.`)}async function J(e,t,n,r){let i=q(r)[t];return await K(e,i.url(),{method:i.spec.method,headers:oe,body:JSON.stringify(n)},`The change could not be saved.`)}async function le(e,t){let n=W.host.previewUpload;return await K(e,n.url(),{method:n.spec.method,headers:G,body:t},`Po could not read the archive.`)}async function ue(e,t,n,r){let i=W.host.installUpload;return await K(e,i.url({query:{...n.length>0?{[V]:n.join(`,`)}:{},...r?{[H]:r}:{}}}),{method:i.spec.method,headers:G,body:t},`The plugin could not be added.`)}var Y=`standalone plugins`;function X(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function de(e){switch(e.origin.kind){case`uploaded`:return`Uploaded`;case`marketplace`:return`From ${e.origin.marketplace}`;case`folder`:return e.origin.path;case`remote`:return`From ${e.origin.source}`}}function Z({label:e,children:t}){return h(re,{children:[l(O,{asChild:!0,children:l(z,{variant:`ghost`,size:`icon`,"aria-label":e,children:l(ee,{"aria-hidden":!0,className:`size-4`})})}),l(E,{align:`end`,children:t})]})}var Q=5;function fe({label:e,names:t}){let[n,r]=s(0),o=Math.ceil(t.length/Q),c=n*Q,u=t.slice(c,c+Q);return h(a,{children:[u.map((e,t)=>h(i,{children:[t>0?`, `:``,l(`span`,{className:`font-mono whitespace-nowrap`,children:e})]},e)),o>1?h(`span`,{className:`ml-2 inline-flex items-center gap-1 align-middle whitespace-nowrap`,children:[l(z,{variant:`ghost`,size:`icon`,"aria-label":`Previous ${e}`,disabled:n===0,onClick:()=>r(n-1),children:l(N,{"aria-hidden":!0,className:`size-3.5 rotate-180`})}),l(`span`,{className:`tabular-nums`,children:`${String(c+1)}-${String(c+u.length)} of ${String(t.length)}`}),l(z,{variant:`ghost`,size:`icon`,"aria-label":`Next ${e}`,disabled:n===o-1,onClick:()=>r(n+1),children:l(N,{"aria-hidden":!0,className:`size-3.5`})})]}):null]})}function pe({plugin:e}){return h(a,{children:[l(j,{children:e.skills.length>0?h(a,{children:[`Skills: `,l(fe,{label:`skills of ${e.name}`,names:e.skills})]}):`No skills`}),h(j,{children:[e.mcpServers.length>0?h(a,{children:[`MCP servers: `,l(fe,{label:`MCP servers of ${e.name}`,names:e.mcpServers})]}):`No MCP servers`,e.hooks>0?`. ${X(e.hooks,`hook`)}, which Po does not run`:``]})]})}function me({plugin:e,domain:t,onToggle:n,onRemoveFromDomain:r,onDeletePlugin:i}){let o=`plugin-switch-${e.name}`,s=e.domains.filter(e=>e!==t);return l(P,{asChild:!0,className:`items-start`,children:h(`li`,{children:[h(A,{children:[h(T,{className:`flex items-baseline gap-2 first-letter:normal-case`,children:[l(`label`,{htmlFor:o,className:`font-mono`,children:e.name}),e.version?l(`span`,{className:`font-mono text-sm font-normal text-po-dim`,children:e.version}):null]}),e.description?l(j,{children:e.description}):null,e.missing?h(j,{children:[`Not downloaded yet, so its skills and servers are unknown. Run `,l(`span`,{className:`font-mono`,children:`po sync`}),` `,`to fetch it.`]}):l(pe,{plugin:e}),h(j,{children:[de(e),`.`,s.length>0?h(a,{children:[` `,`Also in `,l(`span`,{className:`font-mono`,children:s.join(`, `)}),`.`]}):null,e.enabled?e.domains.length===0?` On, so it loads in every session.`:null:` Off, so nothing from it loads.`]})]}),h(`div`,{className:`flex shrink-0 items-center gap-2`,children:[l(m,{id:o,checked:e.enabled,onCheckedChange:t=>n(e.name,t)}),t?l(z,{variant:`outline`,size:`sm`,onClick:()=>r(e.name,t),children:`Remove from ${t}`}):null,e.deletable?l(Z,{label:`More for ${e.name}`,children:l(I,{variant:`destructive`,onSelect:()=>i(e.name),children:`Delete plugin`})}):null]})]})})}function $({title:e,children:t}){return l(D,{asChild:!0,children:l(`ul`,{children:l(P,{asChild:!0,children:l(`li`,{children:h(A,{children:[l(T,{children:e}),l(j,{children:t})]})})})})})}function he({status:e,onRetry:t}){return e.kind===`error`?l(D,{asChild:!0,children:l(`ul`,{children:l(P,{asChild:!0,role:`alert`,children:h(`li`,{children:[h(A,{children:[l(T,{children:`Po couldn't read your plugins just now`}),l(j,{children:e.error})]}),l(z,{variant:`outline`,size:`sm`,onClick:t,children:`Try again`})]})})})}):l($,{title:`Reading your plugins`,children:`This takes a moment.`})}function ge({title:e,detail:t,actions:n}){return h(`div`,{className:`flex items-start justify-between gap-3`,children:[h(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[l(`h3`,{className:`text-lg font-semibold text-po-hi`,children:e}),l(`p`,{className:`text-sm text-po-dim`,children:t})]}),n?l(`div`,{className:`flex shrink-0 items-center gap-1`,children:n}):null]})}function _e({status:e,domains:t,plugins:i,selected:o,onSelect:s,onUpload:c,onRetry:d,onNewDomain:f,onAddPlugins:p,onDeleteDomain:m,notice:g,..._}){let y=e.kind===`ready`,b=i.filter(e=>e.domains.length===0);return h(`div`,{className:`flex flex-col gap-6`,children:[h(`div`,{className:`flex items-center justify-between gap-3`,children:[l(`span`,{className:`text-sm text-po-dim tabular-nums`,children:y&&i.length>0?X(i.length,`plugin`):``}),c?h(z,{variant:`primary`,size:`sm`,onClick:c,disabled:!y,children:[l(u,{"aria-hidden":!0,className:`size-3.5`}),`Upload plugin`]}):null]}),g?l(`p`,{role:`alert`,className:`text-sm text-po-red`,children:g}):null,y?h(r,{orientation:`vertical`,value:o,onValueChange:s,className:`flex items-start gap-6`,children:[h(`div`,{className:`flex w-44 shrink-0 flex-col gap-2`,children:[l(`span`,{className:`px-2 text-sm font-semibold text-po-dim`,children:`Domains`}),h(x,{"aria-label":`Plugin groups`,className:`flex-col items-stretch`,children:[t.map(e=>h(n,{value:e.name,className:`justify-between font-mono`,children:[e.name,l(`span`,{className:`font-sans text-sm tabular-nums`,children:i.filter(t=>t.domains.includes(e.name)).length})]},e.name)),h(n,{value:Y,className:`mt-3 justify-between`,children:[`Standalone`,l(`span`,{className:`text-sm tabular-nums`,children:b.length})]})]}),h(z,{variant:`ghost`,size:`sm`,className:`justify-start`,onClick:f,children:[l(u,{"aria-hidden":!0,className:`size-3.5`}),`New domain`]})]}),t.map(e=>{let t=i.filter(t=>t.domains.includes(e.name));return h(v,{value:e.name,className:`flex min-w-0 flex-col gap-4`,children:[l(ge,{title:l(`span`,{className:`font-mono`,children:e.name}),detail:`${e.description?`${e.description.replace(/[.!?]\s*$/u,``)}. `:``}These plugins load only in sessions that pick ${e.name}.`,actions:h(a,{children:[h(z,{variant:`primary`,size:`sm`,onClick:()=>p(e.name),children:[l(u,{"aria-hidden":!0,className:`size-3.5`}),`Add plugins`]}),l(Z,{label:`More for domain ${e.name}`,children:l(I,{variant:`destructive`,onSelect:()=>m(e.name),children:`Delete domain`})})]})}),t.length>0?l(D,{asChild:!0,children:l(`ul`,{"aria-label":`Plugins in ${e.name}`,children:t.map(t=>l(me,{plugin:t,domain:e.name,..._},t.name))})}):l($,{title:`No plugins in ${e.name} yet`,children:`Add plugins you already have, or upload a new one.`})]},e.name)}),h(v,{value:Y,className:`flex min-w-0 flex-col gap-4`,children:[l(ge,{title:`Standalone`,detail:`Plugins in no domain. Switch one on to load it in every session, or add it to a domain to load it only there.`}),b.length>0?l(D,{asChild:!0,children:l(`ul`,{"aria-label":`Standalone plugins`,children:b.map(e=>l(me,{plugin:e,..._},e.name))})}):l($,{title:i.length===0?`No plugins yet`:`Every plugin is in a domain`,children:i.length===0?`Upload a zipped Codex or Claude Code plugin folder to start.`:`A plugin you take out of its last domain shows here, switched off.`})]})]}):l(he,{status:e,onRetry:d})]})}function ve({open:t,domain:n,candidates:r,selected:i,onOpenChange:s,onToggle:u,onSubmit:d}){return l(c,{open:t,onOpenChange:s,children:h(o,{width:`md`,"aria-describedby":`add-plugins-description`,children:[l(p,{dismissible:!0,closeLabel:`Close`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h(e,{children:[`Add plugins to `,l(`span`,{className:`font-mono`,children:n})]}),h(S,{id:`add-plugins-description`,children:[`Sessions that pick `,n,` get the plugins you tick. A plugin can be in more than one domain.`]})]})}),h(`form`,{className:`flex min-h-0 flex-col`,onSubmit:e=>{e.preventDefault(),d()},children:[l(R,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:r.length>0?l(`ul`,{className:`flex flex-col gap-4`,children:r.map(e=>{let t=`add-plugin-${e.name}`;return h(`li`,{className:`flex items-start gap-2.5`,children:[l(B,{id:t,className:`mt-0.5`,checked:i.includes(e.name),onCheckedChange:t=>u(e.name,t===!0)}),h(`div`,{className:`flex min-w-0 flex-col items-start gap-0.5`,children:[h(L,{htmlFor:t,className:`flex items-baseline gap-2 font-normal`,children:[l(`span`,{className:`font-mono text-base text-po-text`,children:e.name}),e.version?l(`span`,{className:`font-mono text-sm text-po-dim`,children:e.version}):null]}),e.description?l(`span`,{className:`text-sm text-po-dim`,children:e.description}):null,l(pe,{plugin:e}),l(`span`,{className:`text-sm text-po-dim`,children:e.domains.length>0?h(a,{children:[`Already in `,l(`span`,{className:`font-mono`,children:e.domains.join(`, `)}),`.`]}):`Standalone now, so it loads in every session. Once added it loads only where a domain that has it is picked.`})]})]},e.name)})}):h(`p`,{className:`text-sm text-po-dim`,children:[`Every plugin is already in `,n,`. Upload a new one to add more.`]})}),h(w,{variant:`bar`,children:[l(`span`,{className:`text-sm text-po-dim`,children:`Changes apply to new sessions.`}),h(`div`,{className:`flex shrink-0 items-center gap-2 py-1.5`,children:[l(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),l(z,{type:`submit`,variant:`primary`,size:`sm`,disabled:i.length===0,children:i.length>1?`Add ${String(i.length)} plugins`:`Add plugin`})]})]})]})]})})}function ye({open:t,name:n,description:r,nameError:i,onOpenChange:a,onNameChange:s,onDescriptionChange:u,onSubmit:d}){return l(c,{open:t,onOpenChange:a,children:h(o,{width:`sm`,"aria-describedby":`new-domain-description`,children:[l(p,{dismissible:!0,closeLabel:`Close`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[l(e,{children:`New domain`}),l(S,{id:`new-domain-description`,children:`A session that picks this domain loads its plugins. You add plugins next.`})]})}),h(`form`,{className:`flex min-h-0 flex-col`,onSubmit:e=>{e.preventDefault(),d()},children:[h(R,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[h(`div`,{className:`flex flex-col gap-1.5`,children:[l(L,{htmlFor:`new-domain-name`,children:`Name`}),l(F,{id:`new-domain-name`,className:`font-mono`,value:n,placeholder:`writing`,required:!0,"aria-invalid":i!==void 0,"aria-describedby":`new-domain-name-hint`,onChange:e=>s(e.target.value)}),l(`p`,{id:`new-domain-name-hint`,className:i?`text-sm text-po-red`:`text-sm text-po-dim`,children:i??`Letters, numbers, dots, dashes or underscores, with no spaces.`})]}),h(`div`,{className:`flex flex-col gap-1.5`,children:[l(L,{htmlFor:`new-domain-description-input`,children:`Description`}),l(F,{id:`new-domain-description-input`,value:r,placeholder:`Drafting and editing long-form text`,"aria-describedby":`new-domain-description-hint`,onChange:e=>u(e.target.value)}),l(`p`,{id:`new-domain-description-hint`,className:`text-sm text-po-dim`,children:`Optional. Shown when someone picks a domain for a session.`})]})]}),l(w,{variant:`bar`,className:`justify-end`,children:h(`div`,{className:`flex shrink-0 items-center gap-2 py-1.5`,children:[l(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:`Cancel`}),l(z,{type:`submit`,variant:`primary`,size:`sm`,disabled:n.trim()===``||i!==void 0,children:`Create domain`})]})})]})]})})}function be({domains:e,selected:t,newDomain:n,newDomainError:r,onToggle:i,onNewDomainChange:a}){return h(`fieldset`,{className:`flex flex-col gap-3`,children:[l(`legend`,{className:`mb-1 text-base font-semibold text-po-hi`,children:`Domains`}),l(`p`,{className:`-mt-2 text-sm text-po-dim`,children:`Leave every domain unchecked to keep it standalone: it then loads in every session.`}),e.length>0?l(`ul`,{className:`flex flex-col gap-2`,children:e.map(e=>{let n=`domain-picker-${e.name}`;return h(`li`,{className:`flex items-start gap-2.5`,children:[l(B,{id:n,className:`mt-0.5`,checked:t.includes(e.name),onCheckedChange:t=>i(e.name,t===!0)}),h(L,{htmlFor:n,className:`flex min-w-0 flex-col items-start gap-0.5 font-normal`,children:[l(`span`,{className:`font-mono text-base text-po-text`,children:e.name}),e.description?l(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]})]},e.name)})}):l(`p`,{className:`text-sm text-po-dim`,children:`No domains yet. Name one below, or leave it standalone.`}),h(`div`,{className:`flex flex-col gap-1.5`,children:[l(L,{htmlFor:`domain-picker-new`,children:`New domain`}),l(F,{id:`domain-picker-new`,className:`font-mono`,value:n,placeholder:`writing`,"aria-invalid":r!==void 0,"aria-describedby":`domain-picker-new-hint`,onChange:e=>a(e.target.value)}),l(`p`,{id:`domain-picker-new-hint`,className:r?`text-sm text-po-red`:`text-sm text-po-dim`,children:r??`Optional. Letters, numbers, dots, dashes or underscores, with no spaces.`})]})]})}var xe=`.zip,application/zip`;function Se(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function Ce({onFile:e}){return h(`label`,{htmlFor:`upload-plugin-file`,className:`flex cursor-pointer flex-col items-center gap-2 rounded-lg border border-dashed border-po-border bg-po-deep px-6 py-8 text-center hover:border-po-green/50 focus-within:border-po-green`,onDragOver:e=>e.preventDefault(),onDrop:t=>{t.preventDefault();let n=t.dataTransfer.files[0];n&&e(n)},children:[l(k,{"aria-hidden":!0,className:`size-6 text-po-dim`}),l(`span`,{className:`text-base font-semibold text-po-hi`,children:`Drop a .zip here, or choose a file`}),l(`span`,{className:`max-w-md text-sm text-po-dim`,children:`A Codex or Claude Code plugin folder, zipped. Po keeps its skills and MCP servers.`}),l(`input`,{id:`upload-plugin-file`,type:`file`,accept:xe,className:`sr-only`,onChange:t=>{let n=t.target.files?.[0];n&&e(n)}})]})}function we({title:e,names:t,empty:n}){return h(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[h(`span`,{className:`text-sm font-semibold text-po-hi`,children:[e,` `,l(`span`,{className:`font-normal text-po-dim tabular-nums`,children:t.length})]}),t.length>0?l(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>l(`li`,{className:`truncate font-mono text-sm text-po-text`,children:e},e))}):l(`span`,{className:`text-sm text-po-dim`,children:n})]})}function Te({plugin:e}){return h(`section`,{"aria-label":`Plugin contents`,className:`flex flex-col gap-3 rounded-lg border border-po-border p-3`,children:[h(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[h(`span`,{className:`flex items-baseline gap-2`,children:[l(`span`,{className:`font-mono text-base font-semibold text-po-hi`,children:e.name}),e.version?l(`span`,{className:`font-mono text-sm text-po-dim`,children:e.version}):null]}),e.description?l(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]}),h(`div`,{className:`grid grid-cols-2 gap-4`,children:[l(we,{title:`Skills`,names:e.skills,empty:`None`}),l(we,{title:`MCP servers`,names:e.mcpServers,empty:`None`})]}),e.hooks>0?h(`p`,{className:`text-sm text-po-dim`,children:[`It also declares `,Se(e.hooks,`hook`),`. Po does not run hooks, so they stay unused.`]}):null]})}function Ee({open:t,step:n,domains:r,onOpenChange:i,onFile:s,onToggleDomain:u,onNewDomainChange:d,onChooseAgain:m,onSubmit:g}){return l(c,{open:t,onOpenChange:i,children:h(o,{width:`lg`,"aria-describedby":`upload-plugin-description`,children:[l(p,{dismissible:!0,closeLabel:`Close upload`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[l(e,{children:`Upload a plugin`}),l(S,{id:`upload-plugin-description`,children:`Po reads it first, so you can see what it brings before adding it.`})]})}),h(`form`,{className:`flex min-h-0 flex-col`,onSubmit:e=>{e.preventDefault(),g()},children:[h(R,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[n.kind===`choose`?l(Ce,{onFile:s}):null,n.kind===`reading`?h(`div`,{className:`flex items-center gap-2 rounded-lg border border-po-border px-3 py-6 text-sm text-po-dim`,children:[l(f,{className:`size-4`}),h(`span`,{children:[`Reading `,l(`span`,{className:`font-mono text-po-text`,children:n.fileName})]})]}):null,n.kind===`invalid`?h(`div`,{role:`alert`,className:`flex flex-col gap-1 rounded-lg border border-po-edge-red bg-po-tint-red p-3`,children:[h(`span`,{className:`text-base font-semibold text-po-red`,children:[`Po can't add `,l(`span`,{className:`font-mono`,children:n.fileName})]}),l(`span`,{className:`text-sm text-po-text`,children:n.reason})]}):null,n.kind===`preview`?h(a,{children:[l(Te,{plugin:n.plugin}),l(be,{domains:r,selected:n.selected,newDomain:n.newDomain,newDomainError:n.newDomainError,onToggle:u,onNewDomainChange:d})]}):null]}),h(w,{variant:`bar`,children:[l(`span`,{className:`min-w-0 truncate text-sm text-po-dim`,children:n.kind===`preview`?h(a,{children:[`Saved to `,l(`span`,{className:`font-mono`,children:n.destination})]}):`Nothing is saved until you add it.`}),h(`div`,{className:`flex shrink-0 items-center gap-2 py-1.5`,children:[l(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:`Cancel`}),n.kind===`invalid`?l(z,{type:`button`,variant:`outline`,size:`sm`,onClick:m,children:`Choose another file`}):l(z,{type:`submit`,variant:`primary`,size:`sm`,disabled:n.kind!==`preview`,loading:n.kind===`preview`&&n.submitting===!0,loadingLabel:`Adding the plugin`,children:`Add plugin`})]})]})]})]})})}var De={domains:[],plugins:[]};function Oe(e,t){let n=e.trim();if(n){if(!ae.test(n))return`Use letters, numbers, dots, dashes or underscores, with no spaces.`;if(t.domains.some(e=>e.name===n))return`A domain named ${n} already exists.`}}function ke({request:e,requestWithStepUp:t,workspaceId:n}){let[r,i]=s({kind:`loading`}),[o,c]=s(De),[u,d]=s(Y),[f,p]=s(),[m,g]=s(),[_,v]=s(),[x,S]=s({open:!1,step:{kind:`choose`}}),C=ne(void 0),w=b(async()=>{let t=await ce(e,n);`error`in t?i({kind:`error`,error:t.error}):(c(t.value),i({kind:`ready`}),d(e=>e!==`standalone plugins`||t.value.domains.length===0?e:t.value.domains[0].name))},[e,n]);y(()=>{w()},[w]);let T=e=>`error`in e?(p(e.error),!1):(c(e.value),p(void 0),!0),E=async(e,r)=>T(await J(t,e,r,n)),D=async e=>{if(e.size>6291456){S({open:!0,step:{kind:`invalid`,fileName:e.name,reason:`The archive is larger than 6 MB.`}});return}C.current=e,S({open:!0,step:{kind:`reading`,fileName:e.name}});let n=await le(t,e);S({open:!0,step:`error`in n?{kind:`invalid`,fileName:e.name,reason:n.error}:{kind:`preview`,fileName:e.name,plugin:n.value.plugin,destination:n.value.destination,selected:u===`standalone plugins`?[]:[u],newDomain:``}})},O=e=>S(t=>t.step.kind===`preview`?{...t,step:e(t.step)}:t),k=async()=>{let{step:e}=x,n=C.current;if(e.kind!==`preview`||!n||e.newDomainError||e.submitting)return;O(e=>({...e,submitting:!0}));let r=e.newDomain.trim()||void 0,i=await ue(t,n,e.selected,r);`error`in i?S({open:!0,step:{kind:`invalid`,fileName:e.fileName,reason:i.error}}):(T(i),C.current=void 0,S({open:!1,step:{kind:`choose`}}),d(e.selected[0]??r??`standalone plugins`))},A=async()=>{if(!_)return;let e=_.name.trim(),r=await J(t,`createDomain`,{name:e,..._.description.trim()?{description:_.description.trim()}:{}},n);`error`in r?v({..._,error:r.error}):(T(r),v(void 0),d(e))},j=m?.domain??``;return h(a,{children:[l(_e,{status:r,domains:o.domains,plugins:o.plugins,selected:u,notice:f,onSelect:d,onRetry:()=>{i({kind:`loading`}),w()},...n===void 0?{onUpload:()=>{C.current=void 0,S({open:!0,step:{kind:`choose`}})}}:{},onNewDomain:()=>v({name:``,description:``}),onToggle:(e,t)=>void E(`toggle`,{plugin:e,enabled:t}),onAddPlugins:e=>g({domain:e,selected:[]}),onRemoveFromDomain:(e,t)=>void E(`removeFromDomain`,{domain:t,plugin:e}),onDeletePlugin:e=>{window.confirm(`Delete ${e}? Po removes its folder from ~/.po/plugins.`)&&E(`deletePlugin`,{plugin:e})},onDeleteDomain:e=>{window.confirm(`Delete the domain ${e}? Its plugins stay installed.`)&&E(`deleteDomain`,{name:e}).then(e=>{e&&d(Y)})}}),l(ve,{open:m!==void 0,domain:j,candidates:o.plugins.filter(e=>!e.domains.includes(j)),selected:m?.selected??[],onOpenChange:e=>{e||g(void 0)},onToggle:(e,t)=>g(n=>n&&{...n,selected:t?[...n.selected,e]:n.selected.filter(t=>t!==e)}),onSubmit:()=>{m&&m.selected.length!==0&&E(`addToDomain`,{domain:m.domain,plugins:m.selected}).then(e=>{e&&g(void 0)})}}),l(ye,{open:_!==void 0,name:_?.name??``,description:_?.description??``,nameError:_?_.error??Oe(_.name,o):void 0,onOpenChange:e=>{e||v(void 0)},onNameChange:e=>v(t=>t&&{...t,name:e,error:void 0}),onDescriptionChange:e=>v(t=>t&&{...t,description:e}),onSubmit:()=>void A()}),l(Ee,{open:x.open,step:x.step,domains:o.domains,onOpenChange:e=>{e||S({open:!1,step:{kind:`choose`}})},onFile:e=>void D(e),onToggleDomain:(e,t)=>O(n=>({...n,selected:t?[...n.selected,e]:n.selected.filter(t=>t!==e)})),onNewDomainChange:e=>O(t=>{let n=Oe(e,o);return{...t,newDomain:e,...n?{newDomainError:n}:{newDomainError:void 0}}}),onChooseAgain:()=>S({open:!0,step:{kind:`choose`}}),onSubmit:()=>void k()})]})}var Ae=g({label:`Codex and Claude plugins`,detail:`Codex and Claude Code plugins: their skills and MCP servers. Put one in a domain to load it where that domain is picked, or switch it on standalone to load it everywhere.`,icon:_,order:0,menuGroup:`general`,component:ke}),je=ie({label:`Codex and Claude plugins`,detail:`This workspace's own domains, kept in its .po/domains.yaml. A domain edited here replaces the computer's domain of the same name in this workspace only.`,order:110,component:({repository:e,request:t,requestWithStepUp:n})=>e?l(ke,{request:t,requestWithStepUp:n,workspaceId:e.id},e.id):null}),Me=t({name:`domains`,command:`domains`,statusKey:`po-domain`,emptyLabel:`no domains`,multi:!0,order:20}),Ne=(e,t)=>t===void 0?void 0:{...e,...t},Pe=C({id:`domain`,packageName:`@agimon-ai/po-domain`,host:{get settingsPanels(){return[Ne({id:`plugins`},Ae)]}},workspace:{get repositorySettingsPanel(){return je}},session:{get selectionAxes(){return[Ne({name:`domains`},Me)]}}});export{Pe as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,Fa as t,It as n,Ja as r,Ji as i,Jt as a,Ki as o,Kr as s,La as c,Lt as l,Pi as u,Qi as d,Ra as f,Rt as p,Xr as ee,Yi as m,Za as h,Zi as g,_n as _,aa as v,da as y,gn as te,hn as b,in as x,ka as ne,nn as re,oa as S,on as C,qi as w,ra as T,ti as E,yn as ie}from"../chunks/po-web-runtime-C-6-Rprr.js";var D=`po-goal-current`,ae=` · `,O=/\[[0-9;]*m/gu;function k(e){if(e===void 0)return;let t=e.replace(O,``).trim(),n=t.indexOf(ae);if(n===-1)return;let r=t.slice(n+3).trim();return r===``?void 0:{state:t.slice(0,n).trim(),objective:r}}var A=ne({keys:`g e`,statusKey:D,marksBackgroundWork:!1,hideWhenEmpty:!0,order:35}),j=`/goal clear`,M=/\s+/gu,N=/^\d+(?:\.\d+)?[km]?$/iu;function P(e){let t=e.trim().replaceAll(M,` `);return t===``||t.length>4e3?void 0:t}function F(e){let t=e.indexOf(`/`);return t===-1?``:e.slice(t+1).trim()}function I(e,t){let n=P(e);if(n===void 0)return;let r=t.trim();return r===``?`/goal edit ${n}`:N.test(r)?`/goal edit --tokens ${r} ${n}`:void 0}function L({objective:t,budgetHint:n,open:r,onSubmit:s,onCancel:c}){let[u,f]=a(t),[h,_]=a(``),v=I(u,h),y=()=>{f(t),_(``),c()};return l(o,{open:r,onOpenChange:e=>{e||y()},children:p(i,{width:`sm`,"data-testid":`goal-edit-dialog`,"aria-describedby":void 0,children:[l(d,{children:l(e,{children:`edit goal`})}),p(w,{children:[l(m,{children:`this replaces the objective the agent is working to. it takes effect on the next turn.`}),p(`div`,{className:`flex flex-col gap-1`,children:[l(C,{htmlFor:`goal-edit-objective`,children:`objective`}),l(ee,{id:`goal-edit-objective`,"data-testid":`goal-edit-objective`,value:u,rows:3,spellCheck:!1,onChange:e=>f(e.target.value)})]}),p(`div`,{className:`flex flex-col gap-1`,children:[l(C,{htmlFor:`goal-edit-budget`,children:`token budget`}),l(re,{id:`goal-edit-budget`,"data-testid":`goal-edit-budget`,value:h,placeholder:n===``?`none; leave blank to keep it that way`:`${n}; blank keeps it`,onChange:e=>_(e.target.value)})]}),l(`p`,{"data-testid":`goal-edit-preview`,className:`truncate font-mono text-sm text-po-dim`,children:v??`nothing to send`}),p(g,{children:[l(E,{variant:`outline`,size:`md`,"data-testid":`goal-edit-cancel`,onClick:y,children:`cancel`}),l(E,{variant:`primary`,size:`md`,"data-testid":`goal-edit-save`,disabled:v===void 0,onClick:()=>{v!==void 0&&(s(v),_(``))},children:`save`})]})]})]})})}function R({objective:t,open:n,onConfirm:r,onCancel:a}){return l(o,{open:n,onOpenChange:e=>{e||a()},children:p(i,{width:`sm`,"data-testid":`goal-remove-dialog`,"aria-describedby":void 0,children:[l(d,{children:l(e,{children:`remove goal`})}),p(w,{children:[p(m,{children:[`this ends `,l(`span`,{className:`font-semibold text-po-hi`,children:t}),` and stops the current turn. it is archived to this repository's goal history, where it can be restarted.`]}),p(g,{children:[l(E,{variant:`outline`,size:`md`,"data-testid":`goal-remove-cancel`,autoFocus:!0,onClick:a,children:`cancel`}),l(E,{variant:`danger`,size:`md`,"data-testid":`goal-remove-confirm`,onClick:r,children:`remove`})]})]})]})})}function z({sessionId:e,statuses:t,sendSessionFrame:n}){let[r,i]=a(`view`),o=k(t[D]);if(o===void 0)return l(`p`,{"data-testid":`activity-goal-unavailable`,className:`px-1 text-sm text-po-dim`,children:`goal status unavailable`});let s=t=>{e!==null&&n(e,{type:`prompt`,message:t})};return p(`div`,{"data-testid":`activity-goal-row`,className:`flex flex-col gap-0.5`,children:[p(`div`,{className:`flex min-w-0 items-start gap-1.5 px-1`,children:[p(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[l(`span`,{"data-testid":`activity-goal-objective`,className:`text-base font-semibold text-po-hi`,children:o.objective}),l(`span`,{"data-testid":`activity-goal-state`,className:`text-sm tabular-nums text-po-dim`,children:o.state})]}),p(T,{open:r===`menu`,onOpenChange:e=>i(t=>e?`menu`:t===`menu`?`view`:t),children:[l(y,{asChild:!0,children:l(E,{variant:`ghost`,size:`icon`,"data-testid":`activity-goal-menu`,title:`goal actions`,disabled:e===null,className:`shrink-0 text-po-faint hover:bg-po-deep hover:text-po-hi data-[state=open]:bg-po-deep data-[state=open]:text-po-hi`,children:l(x,{className:`h-3 w-3`})})}),p(v,{"data-testid":`activity-goal-menu-list`,children:[l(S,{"data-testid":`activity-goal-edit`,onSelect:()=>i(`edit`),children:`edit`}),l(S,{variant:`destructive`,"data-testid":`activity-goal-remove`,onSelect:()=>i(`confirm`),children:`remove`})]})]})]}),r===`edit`?l(L,{open:!0,objective:o.objective,budgetHint:F(o.state),onSubmit:e=>{s(e),i(`view`)},onCancel:()=>i(`view`)}):null,l(R,{objective:o.objective,open:r===`confirm`,onConfirm:()=>{s(j),i(`view`)},onCancel:()=>i(`view`)})]})}var B=t({component:z}),V=t({slot:`help.guides`,id:`Goal`,order:30,data:{version:1,label:`Goal`,guides:[{id:`about`,question:`What is a goal?`,order:0,answer:`A goal keeps one objective active across agent turns. An independent check reviews the transcript and verification evidence when the session is idle.`},{id:`budget`,question:`How do I set a goal or token budget?`,order:1,answer:`Send /goal followed by your objective. For a budget, use /goal --tokens 100k followed by the objective. Budgets also accept values such as 1.5m.`,keywords:[`limit`,`tokens`]}]}}),H=c({path:[{key:`g`,label:`goal`,detail:`session objective`},{key:`g`,label:`current`,detail:`the goal being worked`}],command:`goal status`}),U=c({path:[{key:`g`,label:`goal`,detail:`session objective`},{key:`e`,label:`toggle`,detail:`start a session goal or end the current one`}],command:`mode goal`}),W=f({keys:`g e`,icon:s,statusKey:`goal`,order:40}),G=[`goal_complete`,`goal_blocked`],K=72;function q(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function J(e){let t=``;for(let n of e){let e=n.codePointAt(0)??0;t+=e<=31||e===127?` `:n}return t.replace(/\s+/gu,` `).trim()}function Y(e,t){let n=e[t];return typeof n==`string`&&J(n)||void 0}function X(e){if(e)return e.length>K?`${e.slice(0,69)}…`:e}function Z(e,t,n={}){return{text:e,tone:t,...n}}function oe(e){return e?J(e.content.flatMap(e=>{let t=q(e);return t?.type===`text`&&typeof t.text==`string`?[t.text]:[]}).join(` `)):``}function se(e,t){if(e===`goal_complete`){let e=X(Y(t,`summary`));return{action:`complete`,...e?{detail:e}:{},metadata:[]}}let n=X(Y(t,`reason`)),r=t.repeated_turns,i=typeof r==`number`&&Number.isFinite(r)?[`${r} ${r===1?`turn`:`turns`}`]:[];return{action:`blocked`,...n?{detail:n}:{},metadata:i}}function Q(e,t,n,r){if(r.isPartial)return[Z(`◐ recording the goal outcome`,`warning`)];let i=oe(n),a=r.isError||q(n?.details)?.error===!0?[Z(`✗ ${i||`${e} refused`}`,`error`)]:[Z(`✓ ${i||(e===`goal_complete`?`goal complete`:`goal blocked`)}`,`success`)];if(!r.expanded)return a;let o=e===`goal_complete`?[[`goal_id`,`goal`],[`summary`,`summary`]]:[[`goal_id`,`goal`],[`reason`,`reason`],[`evidence`,`evidence`]];for(let[e,n]of o){let r=Y(t,e);r&&a.push(Z(`${n} ${r}`,`text`))}return a}function ce({toolName:e,args:t,result:r,running:i,isError:a}){let o=se(e,t),s=Q(e,t,r,{expanded:!1,isError:a,isPartial:i}),c=Q(e,t,r,{expanded:!0,isError:a,isPartial:i});return l(b,{tone:u({running:i,isError:a}),expandable:c.length>s.length,children:({expanded:t})=>p(n,{children:[l(_,{title:e,children:p(`span`,{"data-testid":`tool-call-${e}`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[l(`span`,{className:`font-semibold text-po-hi`,children:o.action}),o.detail?l(`span`,{className:`min-w-0 truncate text-po-dim`,children:o.detail}):null,o.metadata.map(e=>p(`span`,{className:`shrink-0 text-po-dim`,children:[`· `,e]},e))]})}),(t?c:s).length>0?l(te,{"data-testid":`tool-result-${e}`,children:l(ie,{lines:t?c:s})}):null]})})}var le=r({tools:[...G],message:ce}),$=(e,t)=>t===void 0?void 0:{...e,...t},ue=h({id:`goal`,packageName:`@agimon-ai/po-goal`,session:{get activityGroups(){return[$({name:`goal`},A)]},get fills(){return[$({slot:`activity.goal`,id:`goal`},B),$({slot:`help.guides`,id:`goal`},V)]},get leaderBindings(){return[$({id:`goal.show`},H),$({id:`goal.toggle`},U)]},get modes(){return[$({name:`goal`},W)]},get toolRenderers(){return[$({tools:[`goal`]},le)]}}});export{ue as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ai as e,It as t,Ja as n,Lt as r,Pi as i,Qt as a,Rt as o,Za as s,_n as c,gn as l,hn as u,vn as d,xi as f}from"../chunks/po-web-runtime-C-6-Rprr.js";function p(e){let t=typeof e.limit==`number`&&Number.isFinite(e.limit)?e.limit:void 0;return{pattern:typeof e.pattern==`string`?e.pattern:``,details:[typeof e.path==`string`&&e.path.length>0?e.path:`.`,typeof e.glob==`string`?e.glob:void 0,e.ignoreCase===!0?`ignore case`:void 0,t===void 0?void 0:`${t} matches`].filter(e=>e!==void 0&&e.length>0)}}function m({args:n,result:s,output:m,running:h,isError:g}){let _=p(n),v=s===null||g?null:f(s,m,`grep`,!0);return r(u,{tone:i({running:h,isError:g}),expandable:!0,defaultExpanded:!1,children:({expanded:n})=>o(t,{children:[r(c,{title:`grep`,children:o(`span`,{"data-testid":`tool-call-grep`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[r(`span`,{className:`truncate text-po-text`,children:_.pattern}),_.details.length>0?o(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,_.details.join(` · `)]}):null]})}),n?g?o(l,{"data-testid":`tool-result-grep`,className:`flex flex-col`,children:[r(d,{tone:`error`,children:`failed`}),e(s,m).map((e,t)=>r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:e},`${String(t)}-${e}`))]}):v===null?h?r(l,{"data-testid":`tool-result-grep`,children:r(d,{tone:`running`,children:`running`})}):null:v.shown.length===0&&v.notice===void 0?null:o(l,{"data-testid":`tool-result-grep`,className:`flex flex-col gap-1`,children:[r(a,{lines:v.shown,gutter:v.gutter}),v.notice===void 0?null:r(`span`,{className:`text-po-faint`,children:v.notice})]}):null]})})}var h=n({message:m}),g=(e,t)=>t===void 0?void 0:{...e,...t},_=s({id:`grep`,packageName:`@agimon-ai/po-grep`,session:{get toolRenderers(){return[g({tools:[`grep`]},h)]}}});export{_ as webPlugin};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$t as e,Fa as t,It as n,Ja as r,Jt as i,Ka as a,Kt as o,La as s,Lt as c,Na as l,Oa as u,Pi as d,Ra as f,Rt as p,Ut as m,Vi as h,Xt as g,Za as _,Zn as v,_n as y,fi as b,gn as x,hn as S,io as C,jt as w,lr as T,nn as E,pa as D,qt as O,ti as k,ur as A,vi as j,vn as M,wa as ee,yi as te,yn as N}from"../chunks/po-web-runtime-C-6-Rprr.js";var P=u({simulation:{method:`GET`,path:`/simulation`,response:void 0},setSimulation:{method:`PUT`,path:`/simulation`,response:void 0},services:{method:`GET`,path:`/services`,response:void 0},slots:{method:`GET`,path:`/slots`,response:void 0}},{scopes:[`host`,`workspace`,`session`],basePath:`brain`,transport:(e,t)=>w.fetch(e,t),sessionAddress:C}),F=`po/codemode`,I=new Set([`po/server-scope`,`po/server-host`,`po/headless-host`,`po/host-services`]);function L(e,t){let n=new Set([...t.values()].flatMap(e=>[e.source,e.target]));return{nodes:[...e.values()].filter(e=>n.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),links:[...t.values()].sort((e,t)=>`${e.source}\0${e.target}`.localeCompare(`${t.source}\0${t.target}`))}}function R(e){let t=new Map(e.consumers.flatMap(e=>e.owner.kind===`package`&&e.owner.packageName?[[e.id,{name:e.owner.packageName,origin:e.owner.origin}]]:[])),n=new Map(e.services.map(e=>[e.id,e])),r=e.edges.flatMap(e=>{let r=t.get(e.consumer),i=e.service===null?void 0:n.get(e.service);return r&&i&&!I.has(i.name)?[{plugin:r,service:i}]:[]}),i=new Set(r.filter(e=>e.service.name===F).map(e=>e.plugin.name)),a=new Set(r.filter(e=>i.has(e.plugin.name)).map(e=>e.service.name)),o=new Map,s=new Map;for(let{plugin:e,service:t}of r){if(!t.public&&!a.has(t.name))continue;let n=`service:${t.name}`,r=o.get(n);(!r||t.description&&r.detail.endsWith(`No description.`))&&o.set(n,{id:n,label:t.name,role:a.has(t.name)?`codemode`:`public`,detail:`${t.public?`Public`:`Private`} service${a.has(t.name)?`, callable from code mode`:``}. Provided by ${t.owner.packageName??t.owner.kind}. ${t.description??`No description.`}`});let c=`plugin:${e.name}`;o.set(c,{id:c,label:e.name,role:e.origin===`personal`?`personal`:`plugin`,detail:`Plugin${i.has(e.name)?` that contributes to code mode`:``}.`}),s.set(`${c}\0${n}`,{source:c,target:n,label:`consumes`})}return L(o,s)}function z(e,t,n={}){let r=new Map(Object.values(n).map(e=>[e.slot,e.description])),i=new Map,a=new Map,o=(e,t)=>{let n=`slot:${e}`;return(!i.has(n)||t)&&i.set(n,{id:n,label:e,role:`slot`,detail:`Slot. ${t??r.get(e)??`No description.`}`}),n};for(let n of e){let e=t===`web`?n.web:n.native;if(!e||!n.owner.packageName)continue;let r=`plugin:${n.owner.packageName}`;i.set(r,{id:r,label:n.owner.packageName,role:n.owner.origin===`personal`?`personal`:`plugin`,detail:`Plugin with a ${t} half.`});for(let t of e.slots){let e=o(t.name,t.description);a.set(`${r}\0${e}`,{source:r,target:e,label:`declares`})}for(let t of e.fills){if(t.slot===null)continue;let e=o(t.slot);a.set(`${r}\0${e}`,{source:r,target:e,label:`fills`})}}return L(i,a)}function ne(e,t,n){return t===`backend`?R(e):z(t===`web`?e.clientPackages??e.packages:e.packages,t,n)}function re(e,t){let n=new Set([e]);for(let r of t)r.source===e&&n.add(r.target),r.target===e&&n.add(r.source);return n}function ie(e){return e.map((e,t)=>{let n=12*Math.sqrt(t+.5),r=t*2.399963229728653;return{id:e,x:Math.cos(r)*n,y:Math.sin(r)*n,vx:0,vy:0}})}function ae(e,t,n){if(e.length>400)throw Error(`Brain simulation node limit exceeded.`);let r=Math.max(0,Math.min(n,32))/(1e3/60),i=e.map(e=>({...e,vx:e.vx*.8**r,vy:e.vy*.8**r})),a=new Map(e.map((e,t)=>[e.id,t]));for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let a=e[t].x-e[n].x||(e[t].y===e[n].y?.5:0),o=e[t].y-e[n].y,s=Math.max(1,Math.hypot(a,o)),c=Math.min(4,1400/s**2)*r;i[t].vx+=a/s*c,i[t].vy+=o/s*c,i[n].vx-=a/s*c,i[n].vy-=o/s*c}for(let n of t){let t=a.get(n.source),o=a.get(n.target);if(t===void 0||o===void 0||t===o)continue;let s=e[o].x-e[t].x,c=e[o].y-e[t].y,l=Math.max(1,Math.hypot(s,c)),u=(l-70)*.01*r;i[t].vx+=s/l*u,i[t].vy+=c/l*u,i[o].vx-=s/l*u,i[o].vy-=c/l*u}for(let e of i)e.vx=Math.max(-8,Math.min(8,e.vx-e.x*.004*r)),e.vy=Math.max(-8,Math.min(8,e.vy-e.y*.004*r)),e.x+=e.vx*r,e.y+=e.vy*r;return i}function oe(e,t,n=300){let r=[...e];for(let e=0;e<n;e++)r=ae(r,t,1e3/60);return r}var se=[{id:`backend`,label:`Backend`},{id:`web`,label:`Web`},{id:`native`,label:`Native`}],B={public:`var(--po-green)`,codemode:`var(--po-blue)`,plugin:`var(--po-text)`,personal:`var(--po-magenta)`,slot:`var(--po-cyan)`},ce={public:`Public service`,codemode:`Code-mode service`,plugin:`Plugin`,personal:`Your plugin`,slot:`Slot`},le={backend:`No public or code-mode services are consumed in this scope yet.`,web:`No web slots or fills are published in this scope yet.`,native:`No native slot metadata yet. Packages publish it on their next build.`},ue=12,V=420;function de(e){if(e.length===0)return{x:-100,y:-100,w:200,h:200};let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.max(V,Math.max(...t)-Math.min(...t)+80),i=Math.max(V,Math.max(...n)-Math.min(...n)+80);return{x:(Math.max(...t)+Math.min(...t)-r)/2,y:(Math.max(...n)+Math.min(...n)-i)/2,w:r,h:i}}function H({services:e,state:t=`populated`,initialSelection:n,initialGraph:r=`backend`,simulation:a}){let[s,l]=i(r),[u,d]=i(n),[f,h]=i(),g=o(()=>{let t=ne(e,s,ee),n=new Map;for(let e of t.links)for(let t of[e.source,e.target])n.set(t,(n.get(t)??0)+1);let r=new Set([...t.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).slice(0,ue).map(e=>e.id)),i=t.nodes.length>400,a=ie(t.nodes.map(e=>e.id)),o=i?a:oe(a,t.links);return{...t,degree:n,hubs:r,tooLarge:i,seed:a,settled:o,home:de(o)}},[s,e]),[_,v]=i(),[y,b]=i(!1),x=a?.enabled===!0;m(()=>{if(!x||t!==`populated`||g.tooLarge){v(void 0);return}let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=g.seed,r=0,i=!1,a=()=>{i||(n=ae(n,g.links,1e3/60),v({model:g,points:n}),n.some(e=>Math.abs(e.vx)+Math.abs(e.vy)>.02)&&(r=requestAnimationFrame(a)))},o=()=>{cancelAnimationFrame(r),b(e.matches),e.matches?v(void 0):(n=g.seed,r=requestAnimationFrame(a))};return e.addEventListener(`change`,o),o(),()=>{i=!0,cancelAnimationFrame(r),e.removeEventListener(`change`,o)}},[g,x,t]);let S=x&&_?.model===g?_.points:g.settled,C=new Map(S.map(e=>[e.id,e])),[w,T]=i(),E=w?.model===g?w.box:g.home,D=O(null),A=O(void 0),j=(e,t=E.x+E.w/2,n=E.y+E.h/2)=>{let r=Math.min(g.home.w*4,Math.max(g.home.w/12,E.w*e)),i=r/E.w;T({model:g,box:{x:t-(t-E.x)*i,y:n-(n-E.y)*i,w:r,h:E.h*i}})},M=(e,t)=>{let n=D.current?.getScreenCTM()?.inverse();if(!D.current||!n)return{x:E.x+E.w/2,y:E.y+E.h/2};let r=new DOMPoint(e,t).matrixTransform(n);return{x:r.x,y:r.y}},te=t===`populated`&&g.nodes.length>0,N=O(()=>{});N.current=e=>{e.preventDefault();let t=M(e.clientX,e.clientY);j(Math.exp(e.deltaY*.0015),t.x,t.y)},m(()=>{let e=D.current;if(!e)return;let t=e=>N.current(e);return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[te]);let P=()=>{A.current=void 0},F=e=>{e.currentTarget.setPointerCapture(e.pointerId),A.current={x:e.clientX,y:e.clientY,box:E}},I=e=>{let t=A.current,n=D.current?.getBoundingClientRect();if(!t||!n?.width)return;let r=Math.max(t.box.w/n.width,t.box.h/n.height);T({model:g,box:{...t.box,x:t.box.x-(e.clientX-t.x)*r,y:t.box.y-(e.clientY-t.y)*r}})},L=g.nodes.some(e=>e.id===u)?u:void 0,R=f??L,z=R?re(R,g.links):void 0,V=g.home.w/E.w,H=E.w*.017,U=new Map(g.nodes.map(e=>[e.id,e])),W=L?U.get(L):void 0,G=W?g.links.filter(e=>e.source===W.id||e.target===W.id).map(e=>({link:e,other:U.get(e.source===W.id?e.target:e.source)})).sort((e,t)=>e.other.label.localeCompare(t.other.label)):[];return p(`section`,{className:`break-words bg-po-bg p-4 font-sans text-base text-po-text`,children:[p(`header`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[p(`div`,{children:[c(`h1`,{className:`text-2xl font-semibold text-po-hi`,children:`Brain`}),c(`p`,{className:`text-sm text-po-dim`,children:`What this scope can reach, and which plugins lean on it.`})]}),p(`div`,{className:`flex flex-wrap gap-2`,children:[c(`div`,{className:`flex gap-1 rounded-lg border border-po-border p-1`,role:`group`,"aria-label":`Graph`,children:se.map(e=>c(k,{size:`xs`,variant:s===e.id?`subtle`:`ghost`,"aria-pressed":s===e.id,onClick:()=>l(e.id),children:e.label},e.id))}),a&&p(k,{size:`xs`,variant:`outline`,"aria-label":`Physics simulation`,"aria-pressed":x,"aria-disabled":a.pending||void 0,"aria-busy":a.pending,className:`aria-disabled:pointer-events-none aria-disabled:opacity-40`,disabled:t!==`populated`||!x&&g.tooLarge,onClick:()=>{a.pending||a.onChange(!x)},children:[`Motion `,x?`on`:`off`]})]})]}),a?.error&&c(`p`,{role:`alert`,className:`mb-3 text-sm text-po-red`,children:a.error}),a&&(g.tooLarge||x&&y)&&c(`p`,{role:`status`,className:`mb-3 text-sm text-po-dim`,children:g.tooLarge?`Layout is paused above 400 nodes.`:`Motion is paused for your reduced-motion preference.`}),t!==`populated`||g.nodes.length===0?c(`p`,{role:t===`error`?`alert`:`status`,className:`py-12 text-po-text`,children:t===`loading`?`Reading the Brain snapshot…`:t===`error`?`The Brain snapshot could not be read. Your session is unchanged.`:le[s]}):p(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[p(`div`,{className:`relative overflow-hidden rounded-lg border border-po-border bg-po-panel`,children:[p(`svg`,{ref:D,viewBox:`${E.x} ${E.y} ${E.w} ${E.h}`,className:`block h-[min(70vh,640px)] w-full cursor-grab touch-none select-none active:cursor-grabbing`,"aria-hidden":`true`,onPointerDown:F,onPointerMove:I,onPointerUp:P,onPointerCancel:P,children:[g.links.map(e=>{let t=C.get(e.source),n=C.get(e.target);if(!t||!n)return null;let r=R!==void 0&&(e.source===R||e.target===R);return c(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:r?B[U.get(R).role]:`var(--po-dim)`,strokeDasharray:e.label===`declares`?`4 3`:void 0,strokeOpacity:r?.9:R?.06:.22,strokeWidth:r?1.5:1,vectorEffect:`non-scaling-stroke`},`${e.source}\0${e.target}`)}),g.nodes.map(e=>{let t=C.get(e.id),n=3+Math.sqrt(g.degree.get(e.id)??0)*1.6,r=z?.has(e.id)??!0,i=e.id===R||(z?.has(e.id)??!1)||g.hubs.has(e.id)||V>=2;return p(`g`,{className:`cursor-pointer`,opacity:r?1:.15,onPointerDown:e=>e.stopPropagation(),onPointerEnter:()=>h(e.id),onPointerLeave:()=>h(void 0),onClick:()=>d(e.id),children:[e.id===L&&c(`circle`,{cx:t.x,cy:t.y,r:n+4,fill:`none`,stroke:B[e.role],strokeOpacity:`0.5`,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),c(`circle`,{cx:t.x,cy:t.y,r:n,fill:B[e.role]}),i&&c(`text`,{x:t.x,y:t.y+n+H*1.1,textAnchor:`middle`,fontSize:H,className:`fill-po-text`,paintOrder:`stroke`,stroke:`var(--po-panel)`,strokeWidth:H*.25,children:e.label})]},e.id)})]}),p(`div`,{className:`absolute right-2 bottom-2 flex gap-1`,children:[c(k,{size:`xs`,variant:`outline`,"aria-label":`Zoom in`,onClick:()=>j(1/1.4),children:`+`}),c(k,{size:`xs`,variant:`outline`,"aria-label":`Zoom out`,onClick:()=>j(1.4),children:`−`}),c(k,{size:`xs`,variant:`outline`,onClick:()=>T(void 0),children:`Fit`})]}),c(`p`,{className:`pointer-events-none absolute top-2 left-3 flex flex-wrap gap-x-3 text-xs text-po-dim`,children:(s===`backend`?[`public`,`codemode`,`plugin`,`personal`]:[`slot`,`plugin`,`personal`]).map(e=>p(`span`,{className:`flex items-center gap-1`,children:[c(`svg`,{viewBox:`0 0 8 8`,className:`size-2`,"aria-hidden":`true`,children:c(`circle`,{cx:`4`,cy:`4`,r:`4`,fill:B[e]})}),ce[e]]},e))})]}),p(`aside`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Selection`,children:[W?p(`div`,{className:`rounded-lg border border-po-border p-3`,children:[c(`p`,{className:`text-sm text-po-dim`,children:ce[W.role]}),c(`h2`,{className:`break-all font-mono text-base font-semibold text-po-hi`,children:W.label}),c(`p`,{className:`mt-1 text-sm`,children:W.detail}),p(`h3`,{className:`mt-3 text-sm text-po-dim`,children:[`Connected (`,G.length,`)`]}),c(`ul`,{className:`mt-1 max-h-72 overflow-y-auto`,children:G.map(({link:e,other:t})=>c(`li`,{children:p(k,{size:`xs`,variant:`ghost`,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left`,onClick:()=>d(t.id),children:[c(`span`,{className:`font-mono`,children:t.label}),c(`span`,{className:`text-po-dim`,children:e.label})]})},t.id))})]}):c(`p`,{className:`rounded-lg border border-dashed border-po-border p-3 text-sm text-po-dim`,children:`Pick a node to see what it connects to. Scroll to zoom, drag to move around.`}),p(`details`,{className:`rounded-lg border border-po-border p-3`,children:[p(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`All nodes (`,g.nodes.length,`)`]}),c(`ul`,{className:`mt-2 max-h-72 overflow-y-auto`,children:g.nodes.map(e=>c(`li`,{children:c(k,{size:`xs`,variant:`ghost`,"aria-pressed":L===e.id,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left font-mono`,onClick:()=>d(e.id),children:e.label})},e.id))})]}),s===`backend`&&e.diagnostics.length>0&&p(`details`,{className:`rounded-lg border border-po-border p-3`,children:[p(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`Coverage notes (`,e.diagnostics.length,`)`]}),e.diagnostics.map(e=>c(`p`,{className:`mt-2 text-sm text-po-dim`,children:e},e))]})]})]})]})}var U={scope:{id:`pending`,level:`host`},scopes:[],packages:[],services:[],consumers:[],edges:[],diagnostics:[]};function W({sessionId:e,workspaceId:t}){let n=e?`session:${e}`:t?`workspace:${t}`:`host`,r=!!(e||t),a=o(()=>e?P.session(e):t?P.workspace(t):P.host,[e,t]),[s,l]=i(0),[u,d]=i(),[f,h]=i(),g=O(void 0);m(()=>{let e=new AbortController;return g.current=e,r?(h({target:n,pending:!0}),a.simulation({signal:e.signal}).then(t=>{if(!e.signal.aborted){if(!t.ok||typeof t.data?.enabled!=`boolean`)throw Error(`Simulation unavailable.`);h({target:n,enabled:t.data.enabled,pending:!1})}}).catch(()=>{e.signal.aborted||h({target:n,pending:!1,error:`Simulation could not be read. Refresh to try again.`})})):h(void 0),d(e=>e?.target===n?{...e,state:`loading`}:void 0),a.services({signal:e.signal}).then(t=>{if(!t.ok)throw Error(`Brain snapshot unavailable.`);e.signal.aborted||d({target:n,services:t.data,state:t.data.services.length+t.data.consumers.length+t.data.packages.length?`populated`:`empty`})}).catch(()=>{e.signal.aborted||d({target:n,services:U,state:`error`})}),()=>{e.abort(),g.current===e&&(g.current=void 0)}},[a,r,n,s]);let _=u?.target===n?u:void 0,v=_?.state??`loading`,y=f?.target===n?f:void 0;async function b(e){let t=g.current;if(r&&t&&!t.signal.aborted&&y&&y.enabled!==void 0&&!y.pending){h({...y,pending:!0,error:void 0});try{let r=await a.setSimulation({body:{enabled:e},signal:t.signal});if(t.signal.aborted)return;if(!r.ok||typeof r.data?.enabled!=`boolean`)throw Error(`Simulation unavailable.`);h({target:n,enabled:r.data.enabled,pending:!1})}catch{t.signal.aborted||h({...y,pending:!1,error:`Simulation could not be changed. Your graph is unchanged.`})}}}return p(`div`,{children:[p(`div`,{className:`flex items-center justify-between gap-3 bg-po-bg px-4 pt-4`,children:[p(`p`,{className:`text-sm text-po-dim`,children:[e?`Session`:t?`Workspace`:`Global`,` snapshot`]}),c(k,{size:`xs`,variant:`outline`,disabled:v===`loading`||y?.pending,onClick:()=>l(e=>e+1),children:`Refresh`})]}),c(H,{services:_?.services??U,state:v,simulation:r?{enabled:y?.enabled??!1,pending:y?.pending!==!1||y.enabled===void 0,error:y?.error,onChange:b}:void 0},n)]})}var G=t({slot:`page`,id:`brain`,component:W}),fe=e=>typeof e==`object`&&!!e&&!Array.isArray(e),K=(e,t)=>{if(typeof e!=`string`)return null;let n=e.trim();return n.length>0&&n.length<=t?n:null};function pe(e){if(!fe(e)||e.version!==1)return null;let t=K(e.label,80);if(!t||!Array.isArray(e.guides)||e.guides.length>64)return null;let n=[],r=new Set;for(let t of e.guides){if(!fe(t))return null;let e=K(t.id,80),i=K(t.question,240),a=K(t.answer,4e3);if(!e||!i||!a||r.has(e)||t.order!==void 0&&(typeof t.order!=`number`||!Number.isFinite(t.order)))return null;let o;if(t.keywords!==void 0){if(!Array.isArray(t.keywords)||t.keywords.length>16)return null;o=[];for(let e of t.keywords){let t=K(e,64);if(!t)return null;o.push(t)}}r.add(e),n.push({id:e,question:i,answer:a,...o===void 0?{}:{keywords:o},...t.order===void 0?{}:{order:t.order}})}return{version:1,label:t,guides:n}}var me={slot:`help.guides`,description:`Contribute a labelled set of searchable plain-text questions and answers to the Help panel.`,parse:pe};function he(e,t){let n=t.toLowerCase().trim().split(/\s+/).filter(Boolean);return e.flatMap(e=>{let t=e.data.guides.filter(t=>{let r=[e.data.label,t.question,t.answer,...t.keywords??[]].join(` `).toLowerCase();return n.every(e=>r.includes(e))}).sort((e,t)=>(e.order??0)-(t.order??0)||e.question.localeCompare(t.question));return t.length?[{...e,data:{...e.data,guides:t}}]:[]})}function ge(e){return c(_e,{fills:e.slotData(me)},e.sessionId)}function _e({fills:e,initialQuery:t=``,initialExpanded:n}){let[r,a]=i(t),o=he(e,r),s=e.some(e=>e.data.guides.length);return p(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-po-rail text-po-text font-sans`,children:[c(`div`,{className:`border-b border-po-border-soft p-3`,children:c(E,{"aria-label":`Search help`,placeholder:`Search help`,type:`search`,value:r,onChange:e=>a(e.target.value),className:`w-full placeholder:text-po-dim`})}),c(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:o.length===0?c(D,{title:s?`No matching guides`:`No help guides yet`,description:s?`Try a different word or a package name.`:`Guides from this session’s plugins will appear here.`}):c(`div`,{className:`flex flex-col gap-5`,children:o.map(e=>p(`section`,{children:[c(`h2`,{className:`mb-1 text-lg font-semibold text-po-hi break-words`,children:e.data.label}),c(g,{type:`single`,collapsible:!0,defaultValue:n?.[0]===e.pluginId&&n[1]===e.id?n[2]:void 0,children:e.data.guides.map(e=>p(j,{value:e.id,children:[c(h,{className:`text-base font-medium leading-relaxed break-words`,children:e.question}),c(T,{className:`whitespace-pre-wrap break-words text-base leading-relaxed text-po-text`,children:e.answer})]},e.id))})]},JSON.stringify([e.pluginId,e.id])))})})]})}var ve=l({id:`help`,label:`Help`,icon:e,order:50,requiredMode:`help`,panel:ge});function ye({openTransientTab:e}){return c(k,{variant:`outline`,size:`xs`,"data-testid":`activity-explore-brain`,onClick:()=>e({id:`help-brain-map`,label:`Brain`,panel:W}),children:`Explore`})}var be=t({slot:`activity-promo`,id:`brain-explore`,component:ye}),xe=t({slot:`help.guides`,id:`Help`,order:0,data:{version:1,label:`Help`,guides:[{id:`about`,question:`What does Help mode do?`,order:0,answer:`Help adds package guidance and read-only diagnostics for your setup. It does not change configuration or grant extra permissions.`,keywords:[`setup`,`diagnostics`]},{id:`toggle`,question:`How do I turn Help on or off?`,order:1,answer:`Use the mode menu, or send /mode help. Help is additive: other tools and modes keep their existing rules.`}]}}),Se=s({path:[{key:`h`,label:`help`,detail:`package docs and logs`},{key:`e`,label:`toggle`,detail:`load or hide package Help`}],command:`mode help`}),Ce=f({keys:`h e`,icon:e,order:10}),we=a(me),Te=new Set([`inactive`,`activating`,`active`,`degraded`]),q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),J=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0?e:void 0,Y=e=>typeof e==`string`&&e.trim()!==``?e.trim():void 0,X=e=>Array.isArray(e)?e.filter(q):[];function Z(e){return e.split(`
|
|
2
|
-
`).filter(e=>e.trim()!==``)}function Ee(e){return X(e).flatMap(e=>{let t=Y(e.name);if(t===void 0)return[];let n=Y(e.source),r=Y(e.reason);return[{name:t,active:e.active===!0,...n?{source:n}:{},...r?{reason:r}:{}}]})}function De(e){let t=Y(e.activation);if(t===void 0||!Te.has(t))return null;let n=q(e.counts)?e.counts:{},r=J(n.tools);return{kind:`status`,activation:t,skillCount:J(n.skills)??null,...r===void 0?{}:{toolCount:r},skills:Ee(e.skills),tools:Ee(e.tools),diagnostics:X(e.diagnostics).flatMap(e=>{let t=Y(e.code);if(t===void 0)return[];let n=Y(e.source);return[{code:t,...n?{source:n}:{}}]}),packages:X(e.packages).flatMap(e=>{let t=Y(e.packageName);if(t===void 0)return[];let n={scope:Y(e.scope),stage:Y(e.stage),reason:Y(e.reason)},r=Y(e.previous);return[{packageName:t,...Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0)),...r&&r!==`none`?{previous:r}:{}}]}),truncated:e.truncated===!0}}function Oe(e){let t=Y(e.status);if(t!==`checks-passed`&&t!==`issues-found`)return null;let n=q(e.appliedSelection)?e.appliedSelection:{},r=Y(n.preset),i=Y(n.profile),a=Y(e.limitations);return{kind:`setup`,passed:t===`checks-passed`,...r?{preset:r}:{},domains:Array.isArray(n.domains)?n.domains.flatMap(e=>Y(e)??[]):[],...i?{profile:i}:{},checks:X(e.checks).flatMap(e=>{let t=Y(e.area);if(t===void 0)return[];let n=J(e.problemCount),r=Y(e.guidance);return[{area:t,passed:e.status===`passed`,...n===void 0?{}:{problemCount:n},...r?{guidance:r}:{}}]}),skipped:Array.isArray(e.skipped)?e.skipped.flatMap(e=>Y(e)??[]):[],...a?{limitations:a}:{}}}function ke(e){let t;try{t=JSON.parse(e)}catch{return{kind:`text`,lines:Z(e)}}if(q(t)){let e=De(t)??Oe(t);if(e!==null)return e}return{kind:`text`,lines:Z(e)}}var Ae=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;function je(e){if(e.kind===`setup`){if(e.passed)return`Checks passed`;let t=e.checks.filter(e=>!e.passed).length;return t>0?`${Ae(t,`area`)} failed`:`Issues found`}return{inactive:`Help off`,activating:`Help activating`,active:`Help active`,degraded:`Help degraded`}[e.activation]}function Me(e){if(e.kind===`setup`){let t=e.checks.filter(e=>!e.passed).length;return[{label:`Checks passed`,value:`${String(e.checks.length-t)}/${String(e.checks.length)}`,tone:`text`},{label:`Failed`,value:String(t),tone:t>0?`error`:`text`},...e.skipped.length>0?[{label:`Skipped`,value:String(e.skipped.length),tone:`warning`}]:[]]}return e.activation===`inactive`?[]:[{label:`Skills`,value:e.skillCount===null?`pending`:String(e.skillCount),tone:`text`},...e.toolCount===void 0?[]:[{label:`Tools`,value:String(e.toolCount),tone:`text`}],...e.diagnostics.length>0?[{label:`Diagnostics`,value:String(e.diagnostics.length),tone:`warning`}]:[],...e.packages.length>0?[{label:`Failed packages`,value:String(e.packages.length),tone:`error`}]:[]]}function Ne(e){if(e.activation===`inactive`)return`Help mode is off in this session.`;if(e.activation===`activating`)return`Skills are counted once the session is ready.`}function Pe(e){return e.kind===`setup`?e.checks.length>0||e.skipped.length>0||e.limitations!==void 0:e.skills.length>0||e.tools.length>0||e.diagnostics.length>0||e.packages.length>0||e.truncated}var Fe=`Help diagnostics`,Ie={text:`truncate text-lg font-semibold tabular-nums text-po-hi`,warning:`truncate text-lg font-semibold tabular-nums text-po-yellow`,error:`truncate text-lg font-semibold tabular-nums text-po-red`};function Le({toolName:e,output:t,running:r,isError:i}){let a=d({running:r,isError:i}),o=r||i?null:ke(t);if(o!==null&&o.kind!==`text`)return c(Re,{toolName:e,tone:a,view:o});let s=o?.lines??Z(t);if(i)return p(S,{tone:a,children:[c(y,{title:e,children:c(`span`,{className:`min-w-0 truncate text-po-faint`,children:Fe})}),s.length>0?c(x,{children:c(`p`,{className:`whitespace-pre-wrap break-words text-po-red`,children:s.join(`
|
|
3
|
-
`)})}):null]});let l=s.map(e=>({text:e,tone:`text`}));return c(S,{tone:a,expandable:l.length>12,children:({expanded:t})=>{let i=b(l,12,t);return p(n,{children:[c(y,{title:e,children:c(`span`,{className:`min-w-0 truncate text-po-faint`,children:Fe})}),i.shown.length>0||r?p(x,{children:[c(N,{lines:i.shown}),i.hidden>0?p(M,{expands:!0,children:[i.hidden,` more lines`]}):null,r?c(M,{tone:`running`,children:`Inspecting this session`}):null]}):null]})}})}function Re({toolName:e,tone:t,view:r}){let i=Me(r),a=r.kind===`status`?Ne(r):void 0;return c(S,{tone:t,expandable:Pe(r),children:({expanded:t})=>p(n,{children:[c(y,{title:e,children:c(`span`,{"data-testid":`tool-call-${e}`,className:`max-w-[70%] shrink-0 truncate text-po-text`,children:je(r)})}),p(x,{"data-testid":`tool-result-${e}`,className:`flex flex-col gap-4`,children:[a===void 0?null:c(`p`,{className:`text-sm text-po-dim`,children:a}),i.length>0?c(`dl`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:i.map(e=>p(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[c(`dt`,{className:`truncate text-sm text-po-dim`,children:e.label}),c(`dd`,{className:Ie[e.tone],children:e.value})]},e.label))}):null,t?r.kind===`status`?c(ze,{view:r}):c(Be,{view:r}):null]})]})})}function ze({view:e}){return p(n,{children:[e.packages.length>0?p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:`Failed packages`}),e.packages.map((e,t)=>p(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[p(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[c(`span`,{className:`min-w-0 shrink truncate font-mono text-sm text-po-text`,children:e.packageName}),e.stage===void 0?null:p(`span`,{className:`min-w-0 flex-1 truncate text-right text-sm text-po-faint`,children:[e.stage,e.scope===void 0?``:` · ${e.scope}`]})]}),e.reason===void 0?null:c(`p`,{className:`break-words text-sm text-po-red`,children:e.reason}),e.previous===void 0?null:p(`p`,{className:`text-sm text-po-faint`,children:[`Previous build `,e.previous]})]},`${e.packageName}-${String(t)}`))]}):null,e.diagnostics.length>0?p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:`Diagnostics`}),e.diagnostics.map((e,t)=>p(`div`,{className:`flex min-w-0 items-center gap-2`,children:[c(A,{tone:`yellow`,size:`xs`,className:`shrink-0 font-mono`,children:e.code}),e.source===void 0?null:c(`span`,{className:`min-w-0 flex-1 truncate text-right font-mono text-sm text-po-dim`,children:e.source})]},`${e.code}-${String(t)}`))]}):null,c(Q,{label:`Skills`,rows:e.skills}),c(Q,{label:`Tools`,rows:e.tools}),e.truncated?c(`p`,{className:`text-sm text-po-faint`,children:`The tool capped its lists; more exist.`}):null]})}function Q({label:e,rows:t}){if(t.length===0)return null;let n=t.slice(0,10);return p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:e}),c(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2`,children:n.map((e,t)=>p(`li`,{className:`flex min-w-0 items-center gap-2`,children:[c(`span`,{className:e.active?`min-w-0 shrink truncate font-mono text-sm text-po-text`:`min-w-0 shrink truncate font-mono text-sm text-po-dim`,children:e.name}),e.active?null:c(A,{size:`xs`,className:`shrink-0`,children:e.reason??`inactive`}),e.source===void 0?null:c(`span`,{className:`min-w-0 flex-1 truncate text-right text-sm text-po-faint`,children:e.source})]},`${e.name}-${String(t)}`))}),t.length>n.length?p(`p`,{className:`text-sm text-po-faint`,children:[`and `,t.length-n.length,` more`]}):null]})}function Be({view:e}){let t=[...e.preset===void 0?[]:[`mode ${e.preset}`],...e.domains.map(e=>`domain ${e}`),...e.profile===void 0?[]:[`profile ${e.profile}`]];return p(n,{children:[t.length>0?p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:`Selection`}),c(`div`,{className:`flex flex-wrap items-center gap-2`,children:t.map(e=>c(A,{size:`xs`,children:e},e))})]}):null,e.checks.length>0?p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:`Checks`}),c(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`,children:e.checks.map(e=>p(`li`,{className:`flex min-w-0 flex-col gap-0.5`,children:[p(`div`,{className:`flex min-w-0 items-center gap-2`,children:[c(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e.area}),e.passed?c(te,{"aria-label":`passed`,className:`size-3.5 shrink-0 text-po-green`}):c(`span`,{className:`shrink-0 text-sm text-po-red`,children:e.problemCount===void 0?`failed`:`${String(e.problemCount)} problem${e.problemCount===1?``:`s`}`})]}),!e.passed&&e.guidance!==void 0?p(`span`,{className:`truncate text-sm text-po-faint`,children:[`Guide: `,e.guidance]}):null]},e.area))})]}):null,e.skipped.length>0?p(`section`,{className:`flex flex-col gap-2`,children:[c(v,{children:`Skipped`}),e.skipped.map(e=>c(`p`,{className:`text-sm text-po-yellow`,children:e},e))]}):null,e.limitations===void 0?null:c(`p`,{className:`text-sm text-po-faint`,children:e.limitations})]})}var Ve=r({tools:[`help_status`,`diagnose_setup`],message:Le}),$=(e,t)=>t===void 0?void 0:{...e,...t},He=_({id:`help`,packageName:`@agimon-ai/po-help`,host:{get fills(){return[$({slot:`page`,id:`brain`},G)]}},session:{get dockFaces(){return[$({id:`help`},ve)]},get fills(){return[$({slot:`activity-promo`,id:`brain`},be),$({slot:`help.guides`,id:`help`},xe)]},get leaderBindings(){return[$({id:`help.toggle`},Se)]},get modes(){return[$({name:`help`},Ce)]},get slots(){return[$({slot:`help.guides`},we)]},get toolRenderers(){return[$({tools:[`help_status`]},Ve)]}}});export{He as webPlugin};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{$n as e,Aa as t,Da as n,Fr as r,It as i,Ja as a,Jt as o,Lt as s,Oa as c,Pi as l,Pr as u,Qn as d,Rt as f,Ua as p,Ui as m,Ut as h,Wt as g,Za as _,Zn as v,_n as y,fi as b,gn as x,hn as S,io as C,ir as w,jt as T,pa as E,qt as ee,rr as D,ti as O,tr as te,ur as ne,vn as k,yn as A}from"../chunks/po-web-runtime-C-6-Rprr.js";var re=[`session`,`agent`,`model`,`provider`],ie=[`day`,`week`,`month`,`all`],j={dimension:`dimension`,period:`period`,focus:`focus`};function M(e){return`unavailable`in e}function ae(e){return`unavailable`in e}var oe=t({metrics:{method:`GET`,path:`/metrics`,query:[j.dimension,j.period,j.focus],response:n()},issues:{method:`GET`,path:`/issues`,query:[j.focus],response:n()},usage:{method:`GET`,path:`/usage`,response:n()},ingestLogs:{method:`POST`,path:`/v1/logs`,response:n()}}),N=c(oe,{scopes:[`host`,`workspace`,`session`],basePath:`log`,transport:(e,t)=>T.fetch(e,t),sessionAddress:C}),se=`The cockpit hub is unreachable.`,ce=`This cockpit is running a bundle without the log package API, so there are no metrics to read.`,le={unavailable:`no-api`,detail:ce};function ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e,t){if(e.status===0)return{error:t?.aborted===!0?``:se};let n=`The hub answered ${String(e.status)}.`;return e.data===void 0?e.ok?{noApi:!0}:{error:n}:ue(e.data)?e.ok?{body:e.data}:{error:e.error===``?n:e.error}:{error:`The hub returned a response the cockpit could not read.`}}async function de(e,t,n,r){let i=P(await N.host.metrics({query:{[j.dimension]:e,[j.period]:t,[j.focus]:n===``?void 0:n},...r===void 0?{}:{signal:r}}),r);if(`error`in i)return{error:i.error};if(`noApi`in i)return{report:le};let a=i.body;return!M(a)&&!Array.isArray(a.groups)?{error:`The hub returned a report the cockpit could not read.`}:{report:a}}async function fe(e,t,n={}){let r=P(await N.host.issues({query:{[j.focus]:e===``?void 0:e,...n},...t===void 0?{}:{signal:t}}),t);return`error`in r?{error:r.error}:`noApi`in r?{issues:{unavailable:`no-api`,detail:ce}}:{issues:r.body}}async function pe(e){let t=P(await N.host.usage(e===void 0?{}:{signal:e}),e);if(!(`body`in t))return[];let n=t.body.rows;return Array.isArray(n)?n:[]}function F(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:Math.min(1,e/t)}function I(e){return e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,0)}function L(e){return Number.isFinite(e)?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)):`Not reported`}function R(e,t){if(!Number.isFinite(e)||e<0)return`Not reported`;if(t===`seconds`){let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?n>0?`${t}h ${n}m`:`${t}h`:n>0?`${n}m`:`${Math.round(e)}s`}return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${Math.round(e)} B`}function me({rows:e}){return e.length===0?null:s(`dl`,{className:`grid grid-cols-2 gap-3 @3xl:grid-cols-4`,"data-testid":`host-usage`,children:e.map(e=>f(`div`,{className:`min-w-0 rounded-lg border border-po-border bg-po-panel p-4`,children:[s(`dt`,{className:`text-sm text-po-dim`,children:e.label}),f(`dd`,{className:`mt-2 text-lg font-semibold tabular-nums text-po-text`,children:[R(e.used,e.unit),e.limit===void 0?``:` of ${R(e.limit,e.unit)}`]}),s(`dd`,{className:`mt-1 text-sm text-po-dim`,children:e.detail})]},e.key))})}var z=5;function he({groups:e,totalTokens:t,focus:n,onFocus:r}){let[a,c]=o(!1),l=[...e].sort((e,t)=>t.totalTokens-e.totalTokens||e.key.localeCompare(t.key)),u=a?l:l.slice(0,z),d=t??I(e.map(e=>e.totalTokens));return f(`div`,{className:`flex flex-col gap-3`,children:[e.length===0?s(`p`,{className:`rounded-md border border-dashed border-po-border p-5 text-sm text-po-dim`,children:`No grouped usage was recorded for this selection.`}):null,s(`ul`,{className:`flex flex-col gap-1`,"data-testid":`metrics-group-bars`,children:u.map(e=>{let a=n===e.key,o=e.key===`unknown`||e.key===``,c=r!==void 0&&!o,l=F(e.totalTokens,d)*100,u=f(i,{children:[f(`span`,{className:`flex items-start justify-between gap-3`,children:[s(`span`,{className:`min-w-0 break-all text-left font-medium text-po-hi`,title:e.key,children:o?`Unattributed`:e.key}),s(`span`,{className:`shrink-0 text-right font-semibold tabular-nums text-po-hi`,title:String(e.totalTokens),children:L(e.totalTokens)})]}),s(`span`,{"aria-hidden":`true`,className:`mt-2 block h-1.5 overflow-hidden rounded-full bg-po-border`,children:s(`span`,{className:`block h-full rounded-full ${o?`bg-po-yellow`:`bg-po-blue`}`,style:{width:`${l}%`}})}),f(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-sm text-po-dim`,children:[s(`span`,{children:t!==void 0&&d>0?`${l.toFixed(1)}% of total`:`Relative token volume`}),f(`span`,{className:e.issueCount>0||e.failed?`text-po-yellow`:`text-po-dim`,children:[e.failed?`Failed · `:``,L(e.issueCount),` `,e.issueCount===1?`issue`:`issues`]})]})]});return s(`li`,{children:c?s(`button`,{type:`button`,onClick:()=>r?.(a?``:e.key),"aria-pressed":a,"aria-label":`Filter to ${e.key}`,"data-testid":`metrics-group-${e.key}`,className:`block w-full rounded-md p-3 text-base hover:bg-po-tint-blue focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue ${a?`bg-po-tint-blue`:``}`,children:u}):s(`div`,{className:`rounded-md p-3 text-base`,children:u})},e.key)})}),e.length>z?s(O,{variant:`ghost`,size:`sm`,onClick:()=>c(!a),"aria-expanded":a,children:a?`Show top 5`:`Show all ${e.length} returned groups`}):null]})}var B=[{key:`totalTokens`,label:`Total`},{key:`inputTokens`,label:`Input`},{key:`outputTokens`,label:`Output`}],V=600,H=160,ge=48;function _e({buckets:e,bucketUnit:t,onShorterPeriod:n}){let[r,i]=o(`totalTokens`),[a,c]=o(``),l=e.find(e=>e.label===a)??e.at(-1),u=I(e.map(e=>e[r])),d=t?`${t} `:``,p=V/Math.max(1,e.length),m=Math.min(ge,p*.65);return e.length===0?s(`p`,{className:`rounded-md border border-dashed border-po-border p-5 text-sm text-po-dim`,"data-testid":`metrics-timeline-chart`,children:`No timeline buckets were recorded for this selection.`}):e.length===1&&l!==void 0?s(`div`,{className:`flex flex-col gap-4`,"data-testid":`metrics-timeline-chart`,children:f(`div`,{className:`rounded-md border border-po-border bg-po-deep p-5`,children:[s(`p`,{className:`text-sm text-po-dim`,children:l.label}),f(`p`,{className:`mt-2 text-lg font-semibold tabular-nums text-po-blue`,title:String(l.totalTokens),children:[L(l.totalTokens),` tokens`]}),f(`p`,{className:`mt-3 text-sm leading-relaxed text-po-dim`,children:[`Only one `,d,`bucket was recorded. There is not enough history to show a trend.`]}),s(`p`,{className:`mt-2 text-sm text-po-dim`,children:`For more detail, pick a shorter period when one is available.`}),n===void 0?null:s(O,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:n,children:`View hourly detail`})]})}):f(`div`,{className:`flex flex-col gap-3`,"data-testid":`metrics-timeline-chart`,children:[f(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[s(`div`,{className:`flex gap-1`,role:`group`,"aria-label":`Timeline token counter`,children:B.map(e=>s(O,{size:`sm`,variant:r===e.key?`primary`:`ghost`,"aria-pressed":r===e.key,onClick:()=>i(e.key),children:e.label},e.key))}),f(`span`,{className:`text-sm text-po-dim`,children:[e.length,` recorded `,d,`buckets`]})]}),f(`div`,{className:`flex gap-3`,children:[f(`div`,{"aria-hidden":`true`,className:`flex w-12 shrink-0 flex-col justify-between text-right text-sm tabular-nums text-po-dim`,children:[s(`span`,{children:L(u)}),s(`span`,{children:L(u/2)}),s(`span`,{children:`0`})]}),f(`svg`,{viewBox:`0 0 ${V} ${H}`,preserveAspectRatio:`none`,className:`h-40 min-w-0 flex-1 overflow-visible`,role:`group`,"aria-label":`tokens per bucket, peak ${L(u)}`,children:[[0,H/2,H].map(e=>s(`line`,{x1:`0`,x2:V,y1:e,y2:e,className:`text-po-border`,stroke:`currentColor`,vectorEffect:`non-scaling-stroke`},e)),e.map((e,t)=>{let n=F(e[r],u)*H,i=`${e.label}: ${L(e[r])} ${B.find(e=>e.key===r)?.label.toLowerCase()} tokens`;return f(`g`,{children:[s(`rect`,{x:t*p+(p-m)/2,y:H-n,width:m,height:n,rx:`2`,fill:`currentColor`,className:l?.label===e.label?`text-po-cyan`:`text-po-blue`}),s(`rect`,{x:t*p,y:`0`,width:p,height:H,fill:`transparent`,tabIndex:0,role:`button`,"aria-label":i,"aria-pressed":l?.label===e.label,onMouseEnter:()=>c(e.label),onFocus:()=>c(e.label),onClick:()=>c(e.label),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),c(e.label))},className:`cursor-pointer focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-cyan`,children:s(`title`,{children:i})})]},e.label)})]})]}),f(`div`,{className:`ml-15 flex justify-between gap-3 text-sm text-po-dim`,children:[s(`span`,{children:e[0]?.label}),s(`span`,{className:`text-right`,children:e.at(-1)?.label})]}),f(`div`,{className:`flex flex-wrap justify-between gap-2 rounded-md bg-po-deep px-3 py-2 text-sm tabular-nums`,"aria-live":`polite`,"aria-atomic":`true`,children:[s(`span`,{className:`text-po-dim`,children:l?.label}),f(`span`,{className:`text-po-hi`,children:[L(l?.[r]??NaN),` `,B.find(e=>e.key===r)?.label.toLowerCase(),` tokens`]})]}),u===0?f(`p`,{className:`text-sm text-po-dim`,children:[`Recorded buckets contain zero `,B.find(e=>e.key===r)?.label.toLowerCase(),` tokens.`]}):null,f(`details`,{className:`text-sm text-po-dim`,children:[s(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`View exact bucket values`}),s(`div`,{className:`mt-3 overflow-x-auto`,children:f(`table`,{className:`w-full text-right tabular-nums`,children:[s(`caption`,{className:`sr-only`,children:`Independent token counters by recorded bucket`}),s(`thead`,{children:f(`tr`,{children:[s(`th`,{scope:`col`,className:`py-2 text-left`,children:`Bucket`}),s(`th`,{scope:`col`,className:`pl-3`,children:`Total`}),s(`th`,{scope:`col`,className:`pl-3`,children:`Input`}),s(`th`,{scope:`col`,className:`pl-3`,children:`Output`})]})}),s(`tbody`,{children:e.map(e=>f(`tr`,{className:`border-t border-po-border`,children:[s(`th`,{scope:`row`,className:`py-2 text-left font-normal`,children:e.label}),B.map(t=>s(`td`,{className:`pl-3`,children:Number.isFinite(e[t.key])?e[t.key].toLocaleString(`en-US`):`Not reported`},t.key))]},e.label))})]})})]})]})}function ve(e){return`${e.fingerprint===``?`${e.category}|${e.message}`:e.fingerprint}|${e.detail}`}function ye(e){let t=new Map;for(let n of e){let e=ve(n),r=t.get(e);r===void 0?t.set(e,{key:e,occurrences:n.occurrenceCount,category:n.category,detail:n.detail,tool:n.tool,errorType:n.errorType,agentName:n.agentName,model:n.model,statusCode:n.statusCode,lastSeen:n.timestamp,members:[n]}):(r.occurrences+=n.occurrenceCount,r.members.push(n),n.timestamp>r.lastSeen&&(r.lastSeen=n.timestamp),r.tool??=n.tool,r.errorType??=n.errorType,r.agentName??=n.agentName,r.model??=n.model,r.statusCode??=n.statusCode)}return[...t.values()].sort((e,t)=>t.occurrences-e.occurrences||e.detail.localeCompare(t.detail))}function U(e){return Object.entries(e).sort(([,e],[,t])=>t-e)}function be(e){return e.errorType===null?e.tool===null?e.category:`${e.tool} failed`:e.errorType}function xe({group:e,max:t,tools:n}){let[r,i]=o(!1),a=`${(F(e.occurrences,t)*100).toFixed(2)}%`,c=n.find(t=>t.name===e.tool)?.calls;return f(`li`,{className:`flex flex-col rounded-md border border-po-border`,children:[f(`div`,{className:`relative`,children:[s(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 h-1 rounded-xs bg-po-yellow/40`,style:{width:a}}),f(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":r,"data-testid":`metrics-issue-${e.key}`,className:`relative flex min-h-10 w-full flex-wrap items-start gap-3 rounded-md p-3 text-left text-base hover:bg-po-tint-blue focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:[s(`span`,{className:`w-8 shrink-0 text-right font-semibold text-po-yellow`,children:e.occurrences}),s(`span`,{className:`w-24 shrink-0 break-words font-medium text-po-hi`,children:be(e)}),s(`span`,{className:`min-w-40 flex-1 break-words text-po-dim`,children:e.detail}),c===void 0?null:f(`span`,{className:`shrink-0 text-po-dim`,children:[c,` token samples`]})]})]}),r?f(`div`,{className:`flex flex-col gap-1 px-3 py-3 text-base`,"data-testid":`metrics-issue-body-${e.key}`,children:[f(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-sm text-po-dim`,children:[f(`span`,{children:[`category `,e.category]}),e.tool===null?null:f(`span`,{children:[`tool `,e.tool]}),e.errorType===null?null:f(`span`,{children:[`error `,e.errorType]}),e.statusCode===null?null:f(`span`,{children:[`status `,e.statusCode]}),e.agentName===null?null:f(`span`,{children:[`agent `,e.agentName]}),e.model===null?null:f(`span`,{children:[`model `,e.model]}),f(`span`,{children:[`last seen `,e.lastSeen]})]}),s(`span`,{className:`break-words text-po-dim`,children:e.detail}),s(`ul`,{className:`flex flex-col gap-1 text-sm text-po-dim`,children:e.members.map((e,t)=>f(`li`,{className:`flex flex-wrap gap-x-2`,children:[s(`span`,{children:e.timestamp}),s(`span`,{children:e.level}),f(`span`,{children:[e.occurrenceCount,`×`]}),s(`span`,{className:`min-w-0 truncate`,children:e.message})]},`${e.timestamp}-${String(t)}`))})]}):null]})}function Se({view:e,tools:t,summaryCount:n}){let r=ye(e.samples),i=r[0]?.occurrences??0,a=new Map(t.map(e=>[e.name,e.calls]));return f(`div`,{className:`flex flex-col gap-3`,children:[n!==void 0&&n!==e.totalIssues?f(`p`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm leading-relaxed text-po-yellow`,role:`status`,"data-testid":`metrics-issue-count-mismatch`,children:[`The summary reports `,n,` `,n===1?`issue`:`issues`,`; incident analysis returned`,` `,e.totalIssues,`. The counts differ, so these details should not be treated as a complete explanation of the summary.`]}):null,f(`span`,{className:`text-sm text-po-dim`,children:[s(`span`,{className:`text-po-hi`,children:e.totalIssues}),` occurrences of`,` `,s(`span`,{className:`text-po-hi`,children:r.length}),` distinct problems in the returned samples, most frequent first`]}),r.length===0?s(`p`,{className:`rounded-md border border-dashed border-po-border p-4 text-sm text-po-dim`,children:e.totalIssues===0?`No issues were detected in the returned analysis. This does not establish coverage of unrecorded activity.`:`The analysis counted issues but returned no incident samples.`}):s(`ul`,{className:`flex flex-col gap-2`,"data-testid":`metrics-issue-groups`,children:r.map(e=>s(xe,{group:e,max:i,tools:t},e.key))}),Object.keys(e.byTool).length===0?null:f(`div`,{className:`flex flex-col gap-2 overflow-x-auto`,children:[s(`h4`,{className:`text-base font-semibold text-po-hi`,children:`Failures by tool`}),f(`table`,{className:`w-full text-sm`,"data-testid":`metrics-issues-tools`,children:[s(`thead`,{children:f(`tr`,{className:`text-sm text-po-dim`,children:[s(`th`,{scope:`col`,className:`py-2 text-left font-normal`,children:`Tool`}),s(`th`,{scope:`col`,className:`text-right font-normal`,children:`Failures`}),s(`th`,{scope:`col`,className:`text-right font-normal`,children:`Attribution context`})]})}),s(`tbody`,{children:U(e.byTool).map(([e,t])=>{let n=a.get(e);return f(`tr`,{className:`border-b border-po-border/40`,children:[s(`td`,{className:`min-w-0 break-all py-2 text-po-dim`,children:e}),s(`td`,{className:`w-16 py-2 text-right text-po-red`,children:t}),s(`td`,{className:`w-28 py-2 text-right text-po-dim`,children:n===void 0?`no token samples`:`${String(n)} token samples`})]},e)})})]})]}),f(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm text-po-dim`,children:[s(`span`,{className:`text-sm font-semibold text-po-dim`,children:`by category`}),U(e.byCategory).map(([e,t])=>f(`span`,{children:[e,` `,s(`span`,{className:`text-po-hi`,children:t})]},e))]})]})}function Ce({tools:e,focus:t,count:n,startTime:r,endTime:i,broaderScope:a=!1}){let[c,l]=o(),[d,p]=o(``),[m,_]=o(!1),[v,y]=o(!1),b=ee(void 0),x=g();return h(()=>(b.current?.abort(),l(void 0),p(``),_(!1),y(!1),()=>b.current?.abort()),[t,r,i]),f(`section`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-po-border bg-po-panel p-4`,"data-testid":`metrics-issues`,children:[f(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[f(`div`,{children:[f(`h3`,{className:`text-lg font-semibold text-po-hi`,children:[`Issues to investigate`,n===void 0?``:` · ${n} ${n===1?`issue`:`issues`}`]}),s(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Inspect recurring failures and the evidence behind them.`})]}),f(`div`,{className:`flex items-center gap-2`,children:[m?s(u,{label:`Reading issue details`}):null,s(O,{variant:`outline`,size:`md`,disabled:m,onClick:()=>{b.current?.abort();let e=new AbortController;b.current=e,y(!0),_(!0),p(``),l(void 0),fe(t,e.signal,{startTime:r,endTime:i}).then(t=>{e.signal.aborted||(_(!1),`error`in t?p(t.error||`Issue details could not be loaded.`):ae(t.issues)?p(t.issues.detail):l(t.issues))}).catch(t=>{e.signal.aborted||(_(!1),p(t instanceof Error?t.message:`Issue details could not be loaded.`))})},"aria-expanded":v,"aria-controls":x,"data-testid":v?`metrics-issues-reload`:`metrics-issues-open`,children:v?`Reload details`:`Inspect issues`}),v?s(O,{variant:`ghost`,size:`md`,onClick:()=>{b.current?.abort(),_(!1),y(!1)},"aria-controls":x,children:`Hide`}):null]})]}),f(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:[`Details are loaded on demand.`,` `,r===void 0?i===void 0?`This hub did not report a time window; details cover all available history.`:`Details cover available history up to report time; no start bound was supplied.`:`Details use the report’s recorded time window.`,` `,a?`LogSink cannot filter issue details by model, provider or agent, so this analysis covers all groups in that window.`:t===void 0?`Analysis covers all groups.`:`Filtered to this session.`]}),f(`div`,{id:x,hidden:!v,"aria-busy":m,children:[d===``?null:s(`p`,{role:`alert`,className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm text-po-yellow`,"data-testid":`metrics-issues-message`,children:d}),m?s(`p`,{role:`status`,className:`py-3 text-sm text-po-dim`,children:`Reading recorded incidents...`}):null,c===void 0?null:s(Se,{view:c,tools:a?[]:e,summaryCount:a?void 0:n})]})]})}function we({totals:e}){let t=[{label:`Total tokens`,value:e.totalTokens,detail:`Provider-reported total`,color:`text-po-blue`},{label:`Input tokens`,value:e.inputTokens,detail:`Reported input counter`,color:`text-po-hi`},{label:`Output tokens`,value:e.outputTokens,detail:`Reported output counter`,color:`text-po-hi`},{label:`Recorded issues`,value:e.issueCount,detail:`Detected in this selection`,color:e.issueCount>0?`text-po-yellow`:`text-po-hi`}];return s(`dl`,{className:`grid grid-cols-2 gap-3 @3xl:grid-cols-4`,"data-testid":`metrics-summary`,children:t.map(e=>f(`div`,{className:`min-w-0 rounded-lg border border-po-border bg-po-panel p-4`,children:[s(`dt`,{className:`text-sm text-po-dim`,children:e.label}),s(`dd`,{className:`mt-2 text-lg font-semibold tabular-nums ${e.color}`,title:Number.isFinite(e.value)?e.value.toLocaleString(`en-US`):`Not reported`,children:L(e.value)}),s(`dd`,{className:`mt-1 text-sm text-po-dim`,children:e.detail})]},e.label))})}function Te({tools:e}){let[t,n]=o(`p90TotalTokens`),r=[...e].sort((e,n)=>n[t]-e[t]||e.name.localeCompare(n.name));return f(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Tool token samples`,children:[f(`div`,{children:[s(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Tool token samples`}),s(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Which tools participate in token-heavy turns?`})]}),r.length===0?f(`div`,{className:`flex flex-1 flex-col justify-center gap-2 rounded-md border border-dashed border-po-border p-5`,"data-testid":`metrics-tools-empty`,children:[s(`p`,{className:`text-base font-semibold text-po-hi`,children:`No token-attributed tool calls`}),s(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Tool execution logs may exist, but this selection has no samples that connect tools to model usage. This does not mean no tools ran.`})]}):f(i,{children:[f(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Rank tool samples by`,children:[s(O,{size:`sm`,variant:t===`p90TotalTokens`?`primary`:`ghost`,"aria-pressed":t===`p90TotalTokens`,onClick:()=>n(`p90TotalTokens`),children:`P90 turn tokens`}),s(O,{size:`sm`,variant:t===`calls`?`primary`:`ghost`,"aria-pressed":t===`calls`,onClick:()=>n(`calls`),children:`Sampled calls`})]}),s(`div`,{className:`overflow-x-auto`,children:f(`table`,{className:`w-full text-base tabular-nums`,"data-testid":`metrics-tools`,children:[f(`caption`,{className:`sr-only`,children:[`Tools ranked by `,t===`calls`?`sampled calls`:`90th percentile whole-turn tokens`]}),s(`thead`,{children:f(`tr`,{className:`border-b border-po-border text-sm text-po-dim`,children:[s(`th`,{scope:`col`,className:`pb-2 text-left font-normal`,children:`Tool`}),s(`th`,{scope:`col`,className:`pb-2 pl-3 text-right font-normal`,children:`Sampled calls`}),s(`th`,{scope:`col`,className:`pb-2 pl-3 text-right font-normal`,children:`P90 turn tokens`})]})}),s(`tbody`,{children:r.map(e=>f(`tr`,{className:`border-b border-po-border/40`,children:[s(`th`,{scope:`row`,className:`max-w-48 break-all py-3 text-left font-normal text-po-hi`,children:e.name}),s(`td`,{className:`py-3 pl-3 text-right text-po-dim`,children:L(e.calls)}),s(`td`,{className:`py-3 pl-3 text-right text-po-blue`,title:String(e.p90TotalTokens),children:L(e.p90TotalTokens)})]},e.name))})]})})]}),f(`details`,{className:`text-sm leading-relaxed text-po-dim`,children:[s(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`How these samples are counted`}),s(`p`,{className:`mt-2`,children:`This view includes only calls with recorded token attribution; external MCP calls remain in the logs. P90 is the 90th percentile of the whole turn, not each tool's own consumption. Several tools may share a turn, so do not add these values together.`})]})]})}var W={session:`session`,agent:`agent`,model:`model`,provider:`provider`},G={session:`Session ids are hashed before export. Select a row to filter usage, not to open a session.`};function Ee({report:e,onFocus:t,onPeriodChange:n}){let r=W[e.dimension],i=e.groups.filter(e=>e.key===`unknown`||e.key===``).reduce((e,t)=>e+t.totalTokens,0),a=[{name:`Cache reads`,value:e.totals.cachedTokens},{name:`Reasoning tokens`,value:e.totals.reasoningTokens},{name:`Usage events`,value:e.totals.usageEventCount},{name:`Log and span records`,value:e.totals.totalRecords}],o=new Date(e.generatedAt);return f(`div`,{className:`@container flex w-full min-w-0 flex-col gap-4`,"data-testid":`metrics-report`,children:[s(we,{totals:e.totals}),f(`div`,{className:`grid min-w-0 grid-cols-1 gap-4 @3xl:grid-cols-3`,children:[f(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4 @3xl:col-span-2`,"aria-label":`Usage over time`,children:[f(`div`,{children:[s(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Usage over time`}),s(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Recorded tokens, not estimated spend.`})]}),s(_e,{buckets:e.timeline,bucketUnit:e.bucketUnit,onShorterPeriod:e.period===`day`||n===void 0?void 0:()=>n(`day`)})]}),f(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Reported counters`,children:[s(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Reported counters`}),s(`dl`,{className:`flex flex-col gap-3`,children:a.map(e=>f(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 border-b border-po-border/40 pb-3`,children:[s(`dt`,{className:`text-sm text-po-dim`,children:e.name}),s(`dd`,{className:`text-base font-semibold tabular-nums text-po-hi`,title:e.value===void 0?`Not reported`:String(e.value),children:L(e.value??NaN)})]},e.name))}),s(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Monetary cost is not included in this metrics report.`}),f(`details`,{className:`text-sm leading-relaxed text-po-dim`,children:[s(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`Why the counters may not add up`}),s(`p`,{className:`mt-2`,children:`The total is reported by providers. Input, output, cache reads and reasoning are independent counters and may overlap or be incomplete. They are not a breakdown and may not sum to the total. A gap is not evidence of cache traffic. Missing fields say Not reported; a recorded zero stays zero.`})]})]})]}),f(`div`,{className:`grid min-w-0 grid-cols-1 items-start gap-4 @3xl:grid-cols-2`,children:[f(`section`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Tokens by ${r}`,children:[f(`div`,{children:[f(`h3`,{className:`text-lg font-semibold text-po-hi`,children:[`Tokens by `,r]}),s(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Largest recorded consumers. Select a named row to filter.`})]}),i>0?f(`div`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3`,"data-testid":`metrics-attribution-notice`,children:[f(`p`,{className:`text-sm font-semibold text-po-yellow`,children:[r.charAt(0).toUpperCase()+r.slice(1),` attribution missing`]}),f(`p`,{className:`mt-1 text-sm leading-relaxed text-po-dim`,children:[L(i),` tokens have no `,r,` recorded. They are included in the total, but cannot be assigned to a named `,r,`.`]})]}):null,G[e.dimension]===void 0?null:s(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:G[e.dimension]}),s(he,{groups:e.groups,totalTokens:e.totals.totalTokens,focus:e.focus,onFocus:t},`${e.dimension}:${e.focus??``}`),f(`p`,{className:`text-sm text-po-dim`,children:[`Showing `,e.groups.length,` of `,L(e.totals.groupCount),` `,r,` groups. Bars show share of the reported total.`]}),e.totals.failedGroups>0?f(`p`,{className:`text-sm text-po-yellow`,children:[e.totals.failedGroups,` of `,e.totals.groupCount,` `,r,`s failed`]}):null]}),s(Te,{tools:e.tools})]}),s(Ce,{tools:e.tools,focus:e.dimension===`session`?e.focus:void 0,count:e.totals.issueCount,startTime:e.startTime,endTime:e.endTime,broaderScope:e.focus!==void 0&&e.dimension!==`session`},`${e.generatedAt}:${e.dimension}:${e.focus??``}`),f(`footer`,{className:`flex flex-wrap justify-between gap-2 border-t border-po-border pt-3 text-sm text-po-dim`,"data-testid":`metrics-provenance`,children:[f(`span`,{children:[`Source: LogSink ·`,` `,e.transport===`http`?`HTTP`:e.transport===`worker`?`database worker`:`transport not reported`]}),f(`span`,{title:e.generatedAt,children:[`Report generated `,Number.isNaN(o.getTime())?e.generatedAt:o.toLocaleString()]})]})]})}var De={"no-sink":`no log sink`,"no-data":`nothing recorded yet`,"no-api":`metrics not installed`,"query-error":`metrics could not be loaded`};function Oe({response:e}){return s(E,{title:De[e.unavailable],description:e.detail,"data-testid":`metrics-empty`})}function ke({requested:e,applied:t,dimension:n,onClear:r}){return e===``?null:t===void 0?f(`span`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm text-po-yellow`,"data-testid":`metrics-focus-refused`,children:[`this log sink does not support narrowing by `,W[n],`, so the numbers below are still everything`,s(O,{variant:`ghost`,size:`md`,className:`ml-2`,onClick:r,children:`clear`})]}):f(`span`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-po-border bg-po-panel p-3 text-sm text-po-dim`,"data-testid":`metrics-focus`,children:[`narrowed to `,s(`span`,{className:`min-w-0 break-all text-po-hi`,children:t}),s(O,{variant:`ghost`,size:`md`,className:`ml-2`,onClick:r,children:`clear`})]})}function Ae(){return f(`div`,{className:`flex flex-col gap-4`,role:`status`,"aria-live":`polite`,"data-testid":`metrics-loading`,children:[s(`span`,{className:`text-sm text-po-dim`,children:`Loading recorded metrics...`}),s(`div`,{"aria-hidden":`true`,className:`grid grid-cols-2 gap-3 @3xl:grid-cols-4`,children:[0,1,2,3].map(e=>s(`div`,{className:`h-24 animate-pulse rounded-lg border border-po-border bg-po-panel motion-reduce:animate-none`},e))}),s(`div`,{"aria-hidden":`true`,className:`h-48 animate-pulse rounded-lg border border-po-border bg-po-panel motion-reduce:animate-none`})]})}var je={day:`Past day`,week:`Past week`,month:`Past month`,all:`All history`};function Me(t){let[n,r]=o(`model`),[a,c]=o(`week`),[l,u]=o(``),[p,m]=o(0),[g,_]=o(),v=JSON.stringify([n,a,l,p]),[y,b]=o([]);h(()=>{let e=new AbortController;return pe(e.signal).then(t=>{e.signal.aborted||b(t)}).catch(()=>void 0),()=>e.abort()},[p]),h(()=>{let e=new AbortController;return de(n,a,l,e.signal).then(t=>{e.signal.aborted||_({key:v,result:t})}).catch(t=>{e.signal.aborted||_({key:v,result:{error:t instanceof Error?t.message:`Metrics could not be loaded.`}})}),()=>e.abort()},[n,a,l,v]);let x=g?.key===v?g.result:void 0,S=x===void 0,C=x!==void 0&&`report`in x?x.report:void 0,T=C===void 0||M(C)?void 0:C,E=x!==void 0&&`error`in x?x.error:``;return f(`div`,{className:`@container flex w-full min-w-0 flex-col gap-4`,"data-testid":`metrics-panel`,"aria-busy":S,children:[s(me,{rows:y}),f(`div`,{className:`flex min-w-0 flex-wrap items-end gap-3 rounded-lg border border-po-border bg-po-panel p-3`,children:[f(`div`,{className:`flex flex-col gap-2`,children:[s(`span`,{className:`text-base font-medium text-po-text`,children:`Group by`}),f(d,{value:n,onValueChange:e=>{u(``),r(e)},children:[s(D,{"aria-label":`Group metrics by`,"data-testid":`metrics-dimension`,className:`w-40 `,children:s(w,{})}),s(e,{children:re.map(e=>s(te,{value:e,children:W[e]},e))})]})]}),f(`div`,{className:`flex flex-col gap-2`,children:[s(`span`,{className:`text-base font-medium text-po-text`,children:`Period`}),f(d,{value:a,onValueChange:e=>c(e),children:[s(D,{"aria-label":`Metrics period`,"data-testid":`metrics-period`,className:`w-40 `,children:s(w,{})}),s(e,{children:ie.map(e=>s(te,{value:e,children:je[e]},e))})]})]}),s(O,{variant:`outline`,size:`md`,className:`ml-auto`,onClick:()=>m(e=>e+1),disabled:S,"data-testid":`metrics-refresh`,children:S?`Loading...`:`Refresh`})]}),S?s(Ae,{}):null,E===``?null:f(`p`,{role:`alert`,className:`rounded-lg border border-po-edge-red bg-po-tint-red p-4 text-sm text-po-red`,"data-testid":`metrics-error`,children:[E,` Use Refresh to try again.`]}),C!==void 0&&M(C)?s(Oe,{response:C}):null,T===void 0?null:f(i,{children:[s(ke,{requested:l,applied:T.focus,dimension:T.dimension,onClear:()=>u(``)}),s(Ee,{report:T,onFocus:u,onPeriodChange:c})]})]})}var Ne=p({label:`metrics`,detail:`recorded usage, token attribution and issues`,icon:m,component:Me});function Pe(e){return e.split(`
|
|
2
|
-
`).filter(Boolean)}var Fe=new Set([`tool_failure`,`infrastructure_failure`,`api_error`,`api_retries_exhausted`,`log_error`]),Ie=/[^.]*empty data[^.]*\.?/i,K=e=>typeof e==`object`&&!!e&&!Array.isArray(e),q=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0,J=e=>typeof e==`string`&&e.trim()!==``?e.trim():void 0;function Le(e){return K(e)?Object.entries(e).flatMap(([e,t])=>{let n=q(t);return n!==void 0&&n>0&&e.trim()!==``?[{key:e,label:e.replaceAll(`_`,` `),count:n,failure:Fe.has(e)}]:[]}).sort((e,t)=>t.count-e.count):[]}function Re(e){return Array.isArray(e)?e.flatMap(e=>{if(!K(e))return[];let t=J(e.name);return t===void 0?[]:[{name:t,invocations:q(e.invocations),p90TurnTokens:q(e.p90TurnTokens)}]}):[]}function ze(e){let t;try{t=JSON.parse(e)}catch{return null}if(!K(t))return null;let n=K(t.usage)?t.usage:{},r={scope:J(t.scope),period:J(t.period),evidence:J(t.evidence),code:J(t.code),capturedRecords:q(t.capturedRecords),capturedIssues:q(t.capturedIssues),categories:Le(t.issuesByCategory),inputTokens:q(n.inputTokens),outputTokens:q(n.outputTokens),tokenCoveragePercent:q(n.tokenCoveragePercent),tools:Re(t.tools),limitReached:typeof t.limitReached==`boolean`?t.limitReached:void 0,captureCompleteness:J(t.captureCompleteness),limitations:J(t.limitations)};return Object.values(r).some(e=>Array.isArray(e)?e.length>0:e!==void 0)?r:null}function Be(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}var Ve=e=>e.replaceAll(/[-_]/g,` `);function He(e){let t=[e.scope,e.period].flatMap(e=>e?[Ve(e)]:[]).join(` · `),n=e.capturedIssues,r=e.evidence===`unavailable`?`Telemetry unavailable`:e.evidence===`empty`?`Nothing captured`:n===void 0?`Captured agent evidence`:n===0?`No issues`:`${String(n)} ${n===1?`issue`:`issues`}`;return t===``?{primary:r}:{primary:r,context:t}}function Ue(e){let t=[];if(e.capturedRecords!==void 0&&t.push({label:`Records`,value:e.capturedRecords.toLocaleString(`en-US`),failure:!1}),e.capturedIssues!==void 0){let n=e.capturedIssues>0&&e.categories.some(e=>e.failure);t.push({label:`Issues`,value:e.capturedIssues.toLocaleString(`en-US`),failure:n})}if(e.inputTokens!==void 0||e.outputTokens!==void 0){let n=e=>e===void 0?`?`:Be(e);t.push({label:`Tokens in / out`,value:`${n(e.inputTokens)} / ${n(e.outputTokens)}`,failure:!1})}return e.tokenCoveragePercent!==void 0&&t.push({label:`Token coverage`,value:`${String(e.tokenCoveragePercent)}%`,failure:!1}),t}function We(e){let t=[e.captureCompleteness?`Capture completeness: ${Ve(e.captureCompleteness)}.`:void 0,e.limitations].filter(e=>e!==void 0);return t.length>0?t.join(` `):void 0}function Ge(e){return e.limitations?.match(Ie)?.[0].trim()??`Empty data is not proof of a healthy run.`}var Ke=`Captured agent evidence`;function qe({toolName:e,output:t,running:n,isError:r}){let a=l({running:n,isError:r}),o=n||r?null:ze(t);if(o)return s(Je,{toolName:e,tone:a,report:o});let c=Pe(t);if(r)return f(S,{tone:a,children:[s(y,{title:e,children:s(`span`,{className:`min-w-0 truncate text-po-faint`,children:Ke})}),c.length>0?s(x,{children:s(`p`,{className:`whitespace-pre-wrap break-words text-po-red`,children:c.join(`
|
|
3
|
-
`)})}):null]});let u=c.map(e=>({text:e,tone:`text`}));return s(S,{tone:a,expandable:u.length>12,children:({expanded:t})=>{let r=b(u,12,t);return f(i,{children:[s(y,{title:e,children:s(`span`,{className:`min-w-0 truncate text-po-faint`,children:Ke})}),r.shown.length>0||n?f(x,{children:[s(A,{lines:r.shown}),r.hidden>0?f(k,{expands:!0,children:[r.hidden,` more lines`]}):null,n?s(k,{tone:`running`,children:`Reading session telemetry`}):null]}):null]})}})}function Je({toolName:e,tone:t,report:n}){let a=He(n),o=Ue(n),c=We(n),l=n.evidence===`empty`,u=n.evidence===`unavailable`,d=Ge(n),p=l&&c===d?void 0:c,m=l||u?p!==void 0:n.categories.length>0||n.tools.length>0||c!==void 0;return s(S,{tone:u?`neutral`:t,expandable:m,children:({expanded:t})=>f(i,{children:[f(y,{title:e,children:[s(`span`,{className:`max-w-[60%] shrink-0 truncate text-po-text`,children:a.primary}),a.context?f(`span`,{className:`min-w-0 truncate text-po-faint`,children:[`· `,a.context]}):null]}),f(x,{className:`flex flex-col gap-4`,children:[u?f(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`span`,{className:`text-po-dim`,children:`The session's telemetry could not be read.`}),n.code?s(r,{size:`xs`,className:`font-mono`,children:n.code}):null]}):l?f(`div`,{className:`flex flex-col gap-1`,children:[s(`p`,{className:`text-po-text`,children:`No records were captured in this window.`}),s(`p`,{className:`text-sm text-po-dim`,children:d})]}):o.length>0?s(`dl`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:o.map(e=>f(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[s(`dt`,{className:`truncate text-sm text-po-dim`,children:e.label}),s(`dd`,{className:e.failure?`truncate text-lg font-semibold tabular-nums text-po-red`:`truncate text-lg font-semibold tabular-nums text-po-hi`,children:e.value})]},e.label))}):null,t&&!l&&!u&&n.categories.length>0?f(`section`,{className:`flex flex-col gap-2`,children:[s(v,{children:`Issues by category`}),s(`div`,{className:`flex flex-wrap gap-2`,children:n.categories.map(e=>f(ne,{tone:e.failure?`red`:`neutral`,children:[s(`span`,{children:e.label}),s(`span`,{className:`font-semibold tabular-nums`,children:e.count})]},e.key))})]}):null,t&&!l&&!u&&n.tools.length>0?f(`section`,{className:`flex flex-col gap-2`,children:[s(v,{children:`Tools`}),f(`table`,{className:`w-full text-base`,children:[s(`thead`,{children:f(`tr`,{className:`text-sm text-po-dim`,children:[s(`th`,{className:`w-full pb-1 text-left font-normal`,children:`Name`}),s(`th`,{className:`whitespace-nowrap pb-1 pl-4 text-right font-normal`,children:`Calls`}),s(`th`,{className:`whitespace-nowrap pb-1 pl-4 text-right font-normal`,children:`p90 turn tokens`})]})}),s(`tbody`,{children:n.tools.map(e=>f(`tr`,{className:`border-t border-po-border-soft`,children:[s(`td`,{className:`max-w-0 truncate py-1 font-mono text-po-text`,children:e.name}),s(`td`,{className:`whitespace-nowrap py-1 pl-4 text-right tabular-nums text-po-text`,children:e.invocations===void 0?`?`:e.invocations.toLocaleString(`en-US`)}),s(`td`,{className:`whitespace-nowrap py-1 pl-4 text-right tabular-nums text-po-text`,children:e.p90TurnTokens===void 0?`?`:Be(e.p90TurnTokens)})]},e.name))})]}),n.limitReached?f(`p`,{className:`text-sm text-po-dim`,children:[`Showing the first `,n.tools.length,` tools.`]}):null]}):null,t&&p?s(`p`,{className:`text-sm text-po-faint`,children:p}):null]})]})})}var Ye=a({tools:[`diagnose_agent`],message:qe}),Xe=[`logsink_status`,`logsink_search`,`logsink_agent_issues`,`logsink_trace`,`logsink_stats`,`logsink_services`,`logsink_metrics`];function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function X(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Z(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=100}function Q(e){return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}T/.test(e)&&Number.isFinite(Date.parse(e))}function Ze(e){let t=Y(e);if(!(!t||t.kind!==`session`&&t.kind!==`history`)&&(t.sessionId===void 0||typeof t.sessionId==`string`)&&(t.startTime===void 0||Q(t.startTime))&&(t.endTime===void 0||Q(t.endTime))&&(t.kind!==`history`||Q(t.startTime)&&Q(t.endTime))&&!(Q(t.startTime)&&Q(t.endTime)&&Date.parse(t.startTime)>Date.parse(t.endTime)))return[t.kind===`session`?`This session`:`History`,t.startTime,t.endTime,t.kind===`history`?t.sessionId:void 0].filter(Boolean).join(` · `)}function Qe(e){return Xe.some(t=>t===e)}function $e({toolName:e,args:t,result:n,output:r,running:i,isError:a}){let o=n?.details;if(o==null)try{o=JSON.parse(r)}catch{o=void 0}let s=Y(o),c=Ze(s?.scope),l=t.scope===`history`?[`Requested history`,t.startTime,t.endTime,t.sessionId].filter(e=>typeof e==`string`).join(` · `):`This session`,u=o===void 0?r:JSON.stringify(o,null,2),d={scope:c??l,evidence:u};if(i)return{...d,scope:l,state:`running`,heading:`Reading captured agent evidence`,note:`Only retained records are inspected.`};if(a)return{...d,state:`query-error`,heading:`Log query could not be completed.`,note:`No collector changes were made.`};let f={...d,state:`unavailable`,heading:`Log summary is unavailable.`,note:`Inspect the retained evidence for details.`},p=Y(s?.data);if(!c||!p)return f;let m={...d,state:`populated`,heading:``},h={...d,state:`empty`,heading:`No captured records in this window.`,note:`This does not establish that the run was healthy.`};switch(e){case`logsink_status`:return p.available===!1&&p.reason===`missing-database`?{...d,state:`missing`,heading:`No retained log database is available.`,note:`No collector changes were made.`}:p.available===!0?{...m,heading:`Retained log database is available.`,note:`This does not establish that the collector is capturing now.`}:f;case`logsink_search`:return!X(p.count)||!X(p.total)||typeof p.truncated!=`boolean`||!Array.isArray(p.results)?f:{...p.total===0?h:m,heading:p.total===0?h.heading:`Captured log records`,summary:`${p.count} returned · ${p.total} records`,note:p.truncated?`Results are truncated.`:p.total===0?h.note:void 0};case`logsink_agent_issues`:{if(!X(p.matchingLogs)||!X(p.uniqueIncidents)||!X(p.scanned)||!Z(p.coveragePercent)||typeof p.truncated!=`boolean`||!Array.isArray(p.issues))return f;let e=Y(p.byTool);return!e||!Object.values(e).every(X)?f:{...p.matchingLogs===0?h:m,heading:p.matchingLogs===0?`No captured agent issues in this window.`:`Captured agent issues`,summary:`${p.matchingLogs} records · ${p.uniqueIncidents} incidents`,coverage:`Coverage ${p.coveragePercent}% · ${p.scanned} scanned${p.truncated?` · Scan truncated`:``}`,tools:Object.entries(e).map(([e,t])=>({name:e,count:t})),note:p.matchingLogs===0?h.note:`Repeated events may describe one incident.`}}case`logsink_trace`:return!X(p.count)||typeof p.truncated!=`boolean`||!Array.isArray(p.timeline)?f:{...p.count===0?h:m,heading:p.count===0?h.heading:`Captured trace timeline`,summary:`${p.count} entries`,note:p.truncated?`Timeline is truncated.`:p.count===0?h.note:void 0};case`logsink_stats`:return!X(p.totalEntries)||!Array.isArray(p.statistics)||!p.statistics.every(e=>{let t=Y(e);return X(t?.count)&&typeof t?.service==`string`&&typeof t?.level==`string`})?f:{...p.totalEntries===0?h:m,heading:p.totalEntries===0?h.heading:`Retained entry statistics`,summary:`${p.totalEntries} entries · ${p.statistics.length} group${p.statistics.length===1?``:`s`}`,tools:p.statistics.map(e=>{let t=e;return{name:[t.service,t.level].filter(Boolean).join(` · `),count:t.count}})};case`logsink_services`:return!X(p.count)||typeof p.truncated!=`boolean`||!Array.isArray(p.services)||!p.services.every(e=>typeof e==`string`)?f:{...p.count===0?h:m,heading:p.count===0?h.heading:`Services with retained records`,summary:`${p.count} service${p.count===1?``:`s`}`,note:p.truncated?`Service list is truncated.`:p.count===0?h.note:void 0};case`logsink_metrics`:{let e=Y(p.totals);return!e||!X(e.totalRecords)||!X(e.totalTokens)||!X(e.issueCount)||!Z(e.tokenCoveragePercent)?f:{...e.totalRecords===0?h:m,heading:e.totalRecords===0?h.heading:`Captured usage and issues`,summary:`${e.totalRecords} records · ${e.totalTokens} tokens · ${e.issueCount} issues`,coverage:`Token coverage ${e.tokenCoveragePercent}%`,note:`${e.totalRecords===0?`${h.note} `:``}Tool turn costs are not exclusive per-tool token shares.`}}default:return f}}function et({toolName:e,running:t,isError:n,fixture:r,defaultExpanded:a=!1}){let o=r.state===`missing`,c=r.state===`unavailable`,u=r.evidence.split(`
|
|
4
|
-
`).map(e=>({text:e,tone:`text`}));return s(S,{tone:o||c?`neutral`:l({running:t,isError:n}),expandable:r.evidence.length>0,defaultExpanded:a,children:({expanded:a})=>f(i,{children:[s(y,{title:e,badge:n?`Query failed`:o?`No data`:void 0,children:s(`span`,{className:`truncate text-po-dim max-sm:hidden`,children:r.scope})}),f(x,{className:`flex flex-col gap-3`,children:[s(`p`,{className:`break-words text-sm text-po-dim sm:hidden`,children:r.scope}),f(`div`,{className:`flex flex-col gap-1`,children:[s(`p`,{className:`text-base font-semibold text-po-hi`,children:r.heading}),r.summary?s(`p`,{className:`text-base text-po-text`,children:r.summary}):null,r.coverage?s(`p`,{className:`text-sm text-po-dim`,children:r.coverage}):null]}),r.tools?s(`div`,{className:`flex flex-col gap-2 border-t border-po-border-soft pt-3`,children:r.tools.map(e=>f(`p`,{className:`flex flex-wrap items-center gap-4 text-base`,children:[s(`span`,{className:`font-mono text-po-text`,children:e.name}),f(`span`,{className:`text-po-dim`,children:[e.count,` occurrences`]})]},e.name))}):null,r.note?s(`p`,{className:`text-sm text-po-dim`,children:r.note}):null,t?s(k,{tone:`running`,children:`Reading telemetry`}):null,r.evidence?f(`div`,{className:`flex flex-col gap-3 border-t border-po-border-soft pt-3`,children:[s(k,{expands:!0,glyph:a?`⌄`:`›`,className:`text-sm text-po-dim`,children:a?`Hide evidence`:`Show evidence`}),a?s(A,{lines:u}):null]}):null]})]})})}function tt(e){return s(et,{...e,fixture:$e(e)})}var nt=a({tools:[`logsink_status`,`logsink_search`,`logsink_agent_issues`,`logsink_trace`,`logsink_stats`,`logsink_services`,`logsink_metrics`],matches:Qe,message:tt}),$=(e,t)=>t===void 0?void 0:{...e,...t},rt=_({id:`log`,packageName:`@agimon-ai/po-log`,host:{get settingsPanels(){return[$({id:`metrics`},Ne)]}},session:{get toolRenderers(){return[$({tools:[`diagnose_agent`]},Ye),$({tools:[`logsink`]},nt)]}}});export{rt as webPlugin};
|