@agimon-ai/po-cloudflare 0.0.2-alpha.75 → 0.0.2-alpha.76

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.
Files changed (203) hide show
  1. package/dist/{approval-DXPV7Vm5.js → approval-BlHIxC2J.js} +18 -5
  2. package/dist/{approvalPrompt-CBaxjb_g.js → approvalPrompt-w2k884MA.js} +25 -3
  3. package/dist/{approvalSession-C9bg7tPo.js → approvalSession-UtzXVEB4.js} +6 -4
  4. package/dist/assets/assets/{CodeEditorView-CfrVwzvL.js → CodeEditorView-CaFk98Ji.js} +2 -2
  5. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-B80H4Cm4.js → abnfDiagram-WEYOIA3C-gzdpxFaJ.js} +2 -2
  6. package/dist/assets/assets/{architecture-WOLXFQ4H-Dr4hXaql.js → architecture-WOLXFQ4H-TugrtWoO.js} +1 -1
  7. package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DWyt7oXu.js → architectureDiagram-ZHVYKT53-Xy_pnmaH.js} +2 -2
  8. package/dist/assets/assets/{blockDiagram-RJAE7QA3-OxNTLdmi.js → blockDiagram-RJAE7QA3-pH1-jWYL.js} +2 -2
  9. package/dist/assets/assets/{c4Diagram-XDPPPE54-B4YtcH0s.js → c4Diagram-XDPPPE54-CWmWk7y2.js} +2 -2
  10. package/dist/assets/assets/channel-CJxh7kPr.js +2 -0
  11. package/dist/assets/assets/{chunk-2E7WHVMD-CD6FFMOX.js → chunk-2E7WHVMD-C2O60zos.js} +2 -2
  12. package/dist/assets/assets/{chunk-4EMNKR2T-CEIoX5oo.js → chunk-4EMNKR2T-CEHzGYY0.js} +2 -2
  13. package/dist/assets/assets/{chunk-55XCU76K-CD3t0IJi.js → chunk-55XCU76K-CjyzuqJm.js} +2 -2
  14. package/dist/assets/assets/{chunk-7S6XSTFO-Cyt75UCF.js → chunk-7S6XSTFO-Db8_vjDs.js} +2 -2
  15. package/dist/assets/assets/{chunk-AQDTSKZB-DRtqYBj9.js → chunk-AQDTSKZB-92c_fipW.js} +2 -2
  16. package/dist/assets/assets/{chunk-DSNLSHJZ-C8Fx2F8s.js → chunk-DSNLSHJZ-DFGW_rzV.js} +2 -2
  17. package/dist/assets/assets/{chunk-HAGFOTED-wOLWRRnd.js → chunk-HAGFOTED-Cpx79XgA.js} +2 -2
  18. package/dist/assets/assets/{chunk-HNE4Q36P-CurJg4Hf.js → chunk-HNE4Q36P-cz6K5cWs.js} +2 -2
  19. package/dist/assets/assets/{chunk-NQOKRVIF-Dzcc5nOG.js → chunk-NQOKRVIF-Bhj8Cnrq.js} +2 -2
  20. package/dist/assets/assets/{chunk-UHW7PFBP-B_ULFf2h.js → chunk-UHW7PFBP-DugRZU3d.js} +2 -2
  21. package/dist/assets/assets/{chunk-VQ5W62QI-DH0VY4_p.js → chunk-VQ5W62QI-CFXU98Td.js} +2 -2
  22. package/dist/assets/assets/{chunk-WQQL4CDK-DNxfLyXM.js → chunk-WQQL4CDK-BDYjxxgH.js} +2 -2
  23. package/dist/assets/assets/chunk-XXDRQBXY-B7vCmBOn.js +2 -0
  24. package/dist/assets/assets/{chunk-YZO67HFG-COuMUh9U.js → chunk-YZO67HFG-Bw3Zv3ms.js} +2 -2
  25. package/dist/assets/assets/{chunk-ZAUX2LTX-BJrCnubF.js → chunk-ZAUX2LTX-reWd5PI6.js} +2 -2
  26. package/dist/assets/assets/{chunk-ZCHMQSOR-D1lFKPtk.js → chunk-ZCHMQSOR-RCmNKJ0K.js} +2 -2
  27. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DfZIbyVL.js → classDiagram-v2-4MYWR3UA-DOBOI7kO.js} +2 -2
  28. package/dist/assets/assets/{cose-bilkent-JH36ORCC-CpGhv9_S.js → cose-bilkent-JH36ORCC-Dnga9ThU.js} +2 -2
  29. package/dist/assets/assets/{cynefin-EF2NZ3EQ-Cxdc6nQl.js → cynefin-EF2NZ3EQ-mbxppeTd.js} +1 -1
  30. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-qoj0w3lp.js → cynefinDiagram-WF24UDRP-D5uSCW7P.js} +2 -2
  31. package/dist/assets/assets/{dagre-NK4GIZVX-DL6QbNDS.js → dagre-NK4GIZVX-D3Utujwv.js} +2 -2
  32. package/dist/assets/assets/{diagram-CBK3MWTC-CJB3jq1_.js → diagram-CBK3MWTC-Bg8QfzPb.js} +2 -2
  33. package/dist/assets/assets/{diagram-I5XIIV2D-4cPOxCxF.js → diagram-I5XIIV2D-NjETU96V.js} +2 -2
  34. package/dist/assets/assets/{diagram-ODIL2UCW-BG3-jAxE.js → diagram-ODIL2UCW-BRY10xxY.js} +2 -2
  35. package/dist/assets/assets/{diagram-PFBEJUXE-Bx8dFaXj.js → diagram-PFBEJUXE-CO5Nfc2a.js} +2 -2
  36. package/dist/assets/assets/{diagram-RJA3I4VV-CUUHND91.js → diagram-RJA3I4VV-jxuLnXXk.js} +2 -2
  37. package/dist/assets/assets/{diagram-TYUNFSNR-BDMoN-kr.js → diagram-TYUNFSNR-B-dUsynt.js} +2 -2
  38. package/dist/assets/assets/{dist-5AxNm-uy.js → dist-9C1WeAys.js} +2 -2
  39. package/dist/assets/assets/{dist-BjI0b36Z.js → dist-BMmgMuDM.js} +2 -2
  40. package/dist/assets/assets/{dist-9_Rmyj2I.js → dist-Bsp48Zck.js} +2 -2
  41. package/dist/assets/assets/{dist-BE3CLKv4.js → dist-C8son2cz.js} +2 -2
  42. package/dist/assets/assets/{dist-CjCWP21A.js → dist-CUuM0eUM.js} +2 -2
  43. package/dist/assets/assets/{dist-BfNCu-7x.js → dist-CXebcDwS.js} +2 -2
  44. package/dist/assets/assets/{dist-Ccxb9U1G.js → dist-DtWJqHVb.js} +2 -2
  45. package/dist/assets/assets/{dist-CM7b5P9a.js → dist-JCg255PN.js} +2 -2
  46. package/dist/assets/assets/{dist-DSTAktnR.js → dist-lOIB9DJk.js} +2 -2
  47. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BivOMXZb.js → ebnfDiagram-V4P3TTPT-KNVNlIfc.js} +2 -2
  48. package/dist/assets/assets/{elk-QONTBCTQ-CrJ1Qpy_.js → elk-QONTBCTQ-DsX7hxD1.js} +2 -2
  49. package/dist/assets/assets/{erDiagram-KYQIGQAA-w9Bqp4sV.js → erDiagram-KYQIGQAA-pjQN44eX.js} +2 -2
  50. package/dist/assets/assets/{eventmodeling-K75KTNOO-CBjFM3kV.js → eventmodeling-K75KTNOO-BCKz9w4V.js} +1 -1
  51. package/dist/assets/assets/flowDiagram-IUGLLWBU-BU7xmb8h.js +1 -0
  52. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CsWtGaqD.js → ganttDiagram-R7GPNTJY-CeuiGYpW.js} +2 -2
  53. package/dist/assets/assets/{gitGraph-VSP46ZUC-DsBSV9_h.js → gitGraph-VSP46ZUC-BsN0Vwsr.js} +1 -1
  54. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-D5GxuYHW.js → gitGraphDiagram-PDYL7XHY-ZIMBu3bo.js} +2 -2
  55. package/dist/assets/assets/{index-DWDYnZsq.js → index-fYkh5qQp.js} +86 -86
  56. package/dist/assets/assets/{info-OHQRW6UA-C7x5dSJu.js → info-OHQRW6UA-CJmrVYr6.js} +1 -1
  57. package/dist/assets/assets/{infoDiagram-MVDRKAX5-CwpI-uAa.js → infoDiagram-MVDRKAX5-BsAIEQmU.js} +2 -2
  58. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-DAa7J5G6.js → ishikawaDiagram-HPEHV2GE-BX_86A9r.js} +2 -2
  59. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BmiZnxE_.js → journeyDiagram-BOSHW7O7-DVGI0WoP.js} +2 -2
  60. package/dist/assets/assets/{kanban-definition-FNSA4HC5-DUR_mA3L.js → kanban-definition-FNSA4HC5-4RLBwWbL.js} +2 -2
  61. package/dist/assets/assets/{line-DHY49wSg.js → line-BL8hbik-.js} +2 -2
  62. package/dist/assets/assets/{linear-pTo-a9xT.js → linear-BWVrkBYc.js} +2 -2
  63. package/dist/assets/assets/{mermaid-parser.core-DMg3hN3T.js → mermaid-parser.core-CMk5l3Wp.js} +4 -4
  64. package/dist/assets/assets/{mermaid.core-DKtPCltA.js → mermaid.core-DZuf73R_.js} +5 -5
  65. package/dist/assets/assets/{mindmap-definition-6OY57UG3-DwTkFbnV.js → mindmap-definition-6OY57UG3-CPuk1tgo.js} +2 -2
  66. package/dist/assets/assets/{packet-JDAUHWVQ-Tu9TrQ1x.js → packet-JDAUHWVQ-pVue6YBL.js} +1 -1
  67. package/dist/assets/assets/{pegDiagram-ECIUJNBX-B7My4tsz.js → pegDiagram-ECIUJNBX-B8Ly6ehm.js} +2 -2
  68. package/dist/assets/assets/{pie-XZMESJXO-QPQm5Gdx.js → pie-XZMESJXO-DXAHc3bX.js} +1 -1
  69. package/dist/assets/assets/{pieDiagram-GNMPY74T-Bv-zAD_z.js → pieDiagram-GNMPY74T-9nVo6xZM.js} +2 -2
  70. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-HTjoGQPd.js → quadrantDiagram-D57K4MC3-DbBqshQw.js} +2 -2
  71. package/dist/assets/assets/{radar-ABXABTNO-LDBlEoFo.js → radar-ABXABTNO-CKPxbvS6.js} +1 -1
  72. package/dist/assets/assets/{railroad-I3PHUGI6-Dy3_ymgZ.js → railroad-I3PHUGI6-CULlMjWr.js} +1 -1
  73. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-QLVvYs6e.js → railroad-abnf-LNEFI6M7-BRjXoZsa.js} +1 -1
  74. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CFRlv9a8.js → railroad-ebnf-DWYD2UWJ-CD_uPeUF.js} +1 -1
  75. package/dist/assets/assets/{railroad-peg-JR7BVNR7-BOlq3d9c.js → railroad-peg-JR7BVNR7-Cv-b3SRa.js} +1 -1
  76. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-Chg32HoU.js → railroadDiagram-Y72NRBL7-DJ77wAhA.js} +2 -2
  77. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-VenIs_eg.js → requirementDiagram-EQYSW5RA-R7PFvkp-.js} +2 -2
  78. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-BdByqMKF.js → sankeyDiagram-SY24JHO5-DR2gLc8z.js} +2 -2
  79. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-D3Do4GJE.js → sequenceDiagram-BLEHNHQU-TwEQL0yK.js} +2 -2
  80. package/dist/assets/assets/{src-DmfN-DA-.js → src-Cv8dmcJt.js} +2 -2
  81. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-CZkRbPlf.js → stateDiagram-v2-A6IESKWZ-ShloXczl.js} +2 -2
  82. package/dist/assets/assets/{swimlanes-B3ENRKFQ-DRTdF9AF.js → swimlanes-B3ENRKFQ-D17E07lx.js} +2 -2
  83. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-i6-zDqZm.js +9 -0
  84. package/dist/assets/assets/{timeline-definition-JXYKGLGB-BVcuws_M.js → timeline-definition-JXYKGLGB-BEvN2l_s.js} +2 -2
  85. package/dist/assets/assets/{treeView-D4JQ5SDB-BLtOJGqO.js → treeView-D4JQ5SDB-B0QcYOKz.js} +1 -1
  86. package/dist/assets/assets/{treemap-SAJKECNS-Dn3BWJ4v.js → treemap-SAJKECNS-CIGIJniE.js} +1 -1
  87. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-CBExIKDY.js → usecaseDiagram-WPOLBNNX-DbS-GLv8.js} +2 -2
  88. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-C6FIx2L4.js → vennDiagram-Q3Y3IDCW-CEkmUNoT.js} +2 -2
  89. package/dist/assets/assets/{wardley-7MLQ67FV-Cjj2xSBp.js → wardley-7MLQ67FV-D9b-h7oE.js} +1 -1
  90. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-sQPCBCFK.js → wardleyDiagram-IVAIDKWA-BoWIYn_M.js} +2 -2
  91. package/dist/assets/assets/{webpack-DDCA0aDL.js → webpack-rEg3nylj.js} +2 -2
  92. package/dist/assets/assets/{xychartDiagram-4URNHDU4-bZ4rifSw.js → xychartDiagram-4URNHDU4-xJdWE_nx.js} +2 -2
  93. package/dist/assets/bundle-asset-policy.json +1 -1
  94. package/dist/assets/index.html +1 -1
  95. package/dist/assets/plugins/chunks/po-web-runtime-CQ9hLtG-.js +1 -0
  96. package/dist/assets/plugins/compositions.json +1 -1
  97. package/dist/assets/plugins/slots/approval.09e72f36-B4Y8Wjzl.js +2 -0
  98. package/dist/assets/plugins/slots/artifacts.50b639bb-5Kf50LM1.js +1 -0
  99. package/dist/assets/plugins/slots/author.ea449ace-BUAjd0RY.js +93 -0
  100. package/dist/assets/plugins/slots/{autocompact.ec8f713f-CDZpN7I7.js → autocompact.6f428144-DUwf4L4s.js} +1 -1
  101. package/dist/assets/plugins/slots/{backdrop-bamboo.1a4d85e9-qbifuMc6.js → backdrop-bamboo.6e4c928d-CT9PXrny.js} +1 -1
  102. package/dist/assets/plugins/slots/browse.fa1f1a50-ClrBioNv.js +1 -0
  103. package/dist/assets/plugins/slots/builtin-tools.75108f21-DmtavYBT.js +7 -0
  104. package/dist/assets/plugins/slots/calendar.d8b70190-DmudDrcG.js +2 -0
  105. package/dist/assets/plugins/slots/codemode.c58fb583-BkVR1X2Y.js +11 -0
  106. package/dist/assets/plugins/slots/domain.753f9f92-Bv-dlY79.js +1 -0
  107. package/dist/assets/plugins/slots/edit.804fec90-mJXCIk4G.js +7 -0
  108. package/dist/assets/plugins/slots/files.66ffc636-CCRW8t1-.js +2 -0
  109. package/dist/assets/plugins/slots/goal.45dffa01-q_Zh5QxW.js +1 -0
  110. package/dist/assets/plugins/slots/grep.98262cff-CTDwtVaK.js +1 -0
  111. package/dist/assets/plugins/slots/help.5fbd20f7-BBw7NYJI.js +3 -0
  112. package/dist/assets/plugins/slots/{log.07fd59a4-BRPa3cVs.js → log.cb964209-BLY7IzD1.js} +4 -4
  113. package/dist/assets/plugins/slots/mcp.82cc1ff5-5yoTabz8.js +55 -0
  114. package/dist/assets/plugins/slots/plan.3852ba52-DmdaEVVw.js +3 -0
  115. package/dist/assets/plugins/slots/profile.ab16dcec-DOw3MhWl.js +1 -0
  116. package/dist/assets/plugins/slots/prompts.ae48c07a-DQVmTxFZ.js +38 -0
  117. package/dist/assets/plugins/slots/read.4560591a-Bun0fKn1.js +1 -0
  118. package/dist/assets/plugins/slots/runner.6e494d59-BDtBIqmQ.js +9 -0
  119. package/dist/assets/plugins/slots/scaffold.d87a6ee0-DZOiNwOS.js +1 -0
  120. package/dist/assets/plugins/slots/session-mcp.2be84084-DQpF2DkA.js +2 -0
  121. package/dist/assets/plugins/slots/sessions.6f47cb4c-y61JDvak.js +1 -0
  122. package/dist/assets/plugins/slots/skill.62a0a1b3-C-mkriRv.js +4 -0
  123. package/dist/assets/plugins/slots/{space.056e8bbc-fbLHc-DX.js → space.65a27e5a-Cr1HSI_z.js} +1 -1
  124. package/dist/assets/plugins/slots/subagents.8bb9992c-CrpR1Jhi.js +7 -0
  125. package/dist/assets/plugins/slots/template-advanced.59f3f98a-CSuMHJ9x.js +1 -0
  126. package/dist/assets/plugins/slots/template-desktop.0f0b8491-C2ZheI0_.js +7 -0
  127. package/dist/assets/plugins/slots/template-elegant.0e3b0acf-Cq5Y_6VL.js +1 -0
  128. package/dist/assets/plugins/slots/vault.3cbfcdc3-ZKO66wy8.js +1 -0
  129. package/dist/assets/plugins/slots/voice.a952113d-CsdoPA4G.js +1 -0
  130. package/dist/assets/plugins/slots/{web-search.f6292793-NVh9fdvE.js → web-search.65013836-C7W5RyLj.js} +1 -1
  131. package/dist/assets/plugins/slots/workflows.cbc5c5c0-BLNlHcfa.js +16 -0
  132. package/dist/assets/pwa/sw.js +5 -5
  133. package/dist/{calendarSetup-CI3AACVo.js → calendarSetup-Do-hM0Li.js} +1 -1
  134. package/dist/{exports-CBp_9dVk.js → exports-t_BpzyPr.js} +1 -1
  135. package/dist/{index.edge-kJrIbDzE.js → index.edge-BRaAhap2.js} +1 -1
  136. package/dist/{profileSources-D1rymC97.js → profileSources-DIlA86Qk.js} +1 -1
  137. package/dist/{server-BcPD_6a2.js → server-2xgrdxY_.js} +2 -2
  138. package/dist/{server-B51reaJ9.js → server-7-DnO2Ww.js} +5 -4
  139. package/dist/{server-DebdjWjz.js → server-B3U0W7zD.js} +1 -1
  140. package/dist/{server-B3jB3q_h.js → server-BJssIIpm.js} +1 -1
  141. package/dist/{server-NKqdiQ5G.js → server-BLcw1z6S.js} +1 -1
  142. package/dist/{server-Byk0FT6E.js → server-BPS6xFya.js} +1 -1
  143. package/dist/{server-DLDK_aeG.js → server-BSpJMYLb.js} +2 -2
  144. package/dist/{server-BsjwqF7J.js → server-BUBijhBb.js} +2 -2
  145. package/dist/{server-CUGzeCH4.js → server-BUgDdcRW.js} +1 -1
  146. package/dist/{server-EYARWKpG.js → server-BeAYfrzJ.js} +1 -1
  147. package/dist/{server-DEKg8AVN.js → server-BlbuM_IJ.js} +2 -2
  148. package/dist/{server-_vSe9bTM.js → server-BqvkcVLn.js} +1 -1
  149. package/dist/{server-Dosi6o2W.js → server-CKQwNrO8.js} +4 -4
  150. package/dist/{server-B20agHjD.js → server-CLRgSPVY.js} +1 -1
  151. package/dist/{server-DYKXGQVY.js → server-CMov-S5-.js} +1 -1
  152. package/dist/{server-BsEMLlTz.js → server-CaFzaibK.js} +1 -1
  153. package/dist/{server-wQHKuB2m.js → server-CcKKktvn.js} +1 -1
  154. package/dist/{server-dBNqYUdX.js → server-D6-_DT9g.js} +1 -1
  155. package/dist/{server-vZL2icDV.js → server-DAFM6HnJ.js} +2 -2
  156. package/dist/{server-DI6YhDI5.js → server-DMbdJzSQ.js} +2 -2
  157. package/dist/{server-C-HBjWRo.js → server-DNpneoqA.js} +1 -1
  158. package/dist/{server-hJ4tYEt4.js → server-DPG7BH6w.js} +5 -5
  159. package/dist/{server-CpbBJ9ZU.js → server-DeFqeFTs.js} +1 -1
  160. package/dist/{server-BD_tbxwG.js → server-Dl3sng3O.js} +2 -2
  161. package/dist/{server-CqDWkfdL.js → server-Dnvp2U6V.js} +3 -3
  162. package/dist/{server-CQmb0lYL.js → server-HIbQWBba.js} +36 -17
  163. package/dist/{server-CAipGCpQ.js → server-OzzJbeaS.js} +2 -2
  164. package/dist/{server-DmqO6gBs.js → server-fYfb0gN8.js} +16 -8
  165. package/dist/{sessionConfig-UMlgu98q.js → sessionConfig-BYow7MOB.js} +1 -1
  166. package/dist/{web-B2sdV-F2.js → web-CLiZJpHK.js} +1 -1
  167. package/dist/worker.js +208 -130
  168. package/package.json +49 -49
  169. package/dist/assets/assets/channel-bXj00dGj.js +0 -2
  170. package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +0 -2
  171. package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +0 -1
  172. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +0 -9
  173. package/dist/assets/plugins/chunks/po-web-runtime-D8FIos2q.js +0 -1
  174. package/dist/assets/plugins/slots/approval.3e4ea6e4-DxS_uibk.js +0 -2
  175. package/dist/assets/plugins/slots/artifacts.84980c32-Cp37TAkd.js +0 -1
  176. package/dist/assets/plugins/slots/author.8eca1a3d-Ds9Y-tjN.js +0 -93
  177. package/dist/assets/plugins/slots/browse.61a8907a-CVYvo1M5.js +0 -1
  178. package/dist/assets/plugins/slots/builtin-tools.16ef5e25-Cq1ljoL-.js +0 -7
  179. package/dist/assets/plugins/slots/calendar.d337fc49-BBjpOs1v.js +0 -2
  180. package/dist/assets/plugins/slots/codemode.5f359b9c-DOR6OR7R.js +0 -11
  181. package/dist/assets/plugins/slots/domain.832848c8-CJrXxig9.js +0 -1
  182. package/dist/assets/plugins/slots/edit.7c802139-BFF7_xN9.js +0 -7
  183. package/dist/assets/plugins/slots/files.364f16c9-CzOlZrRm.js +0 -2
  184. package/dist/assets/plugins/slots/goal.a97b169d-BtQBp3sw.js +0 -1
  185. package/dist/assets/plugins/slots/grep.d8bf9f57-9bUDfjyT.js +0 -1
  186. package/dist/assets/plugins/slots/help.5c78c071-B4-y6gYK.js +0 -3
  187. package/dist/assets/plugins/slots/mcp.ea8b6aa2-CFtzPkPC.js +0 -55
  188. package/dist/assets/plugins/slots/plan.7b30f8d8-CH59Ff49.js +0 -3
  189. package/dist/assets/plugins/slots/profile.63bc3ae6-0e9fWWyE.js +0 -1
  190. package/dist/assets/plugins/slots/prompts.9d9b47cc-BTqYnBX5.js +0 -38
  191. package/dist/assets/plugins/slots/read.926c024f-C7fMXDEH.js +0 -1
  192. package/dist/assets/plugins/slots/runner.5393fa6c-CqrpqhW9.js +0 -9
  193. package/dist/assets/plugins/slots/scaffold.686222eb-9qY5gkYW.js +0 -1
  194. package/dist/assets/plugins/slots/session-mcp.8eb68fc9-Cf0cqopp.js +0 -2
  195. package/dist/assets/plugins/slots/sessions.8e378a3b-B1_eqPJQ.js +0 -1
  196. package/dist/assets/plugins/slots/skill.56c1cc07-D-SKX8iw.js +0 -4
  197. package/dist/assets/plugins/slots/subagents.31fc045b-Cm_YMEnn.js +0 -7
  198. package/dist/assets/plugins/slots/template-advanced.9e8350fe-L0WOM4JT.js +0 -1
  199. package/dist/assets/plugins/slots/template-desktop.69a46f62-By9BZlaL.js +0 -7
  200. package/dist/assets/plugins/slots/template-elegant.381f6acb-El05x7HK.js +0 -1
  201. package/dist/assets/plugins/slots/vault.587549ba-DpU_65Wy.js +0 -1
  202. package/dist/assets/plugins/slots/voice.9c687181-CvcuL__m.js +0 -1
  203. package/dist/assets/plugins/slots/workflows.8a13baad-OLKSY9PE.js +0 -16
@@ -1,2 +0,0 @@
1
- import{$a as e,$n as t,$r as n,At as r,Br as i,Da as a,Di as o,En as s,Ft as c,Ga as l,Gi as u,Gt as d,Ha as f,Hi as p,Hr as m,Ht as h,It as g,Ja as _,Ji as v,Jn as y,Jr as b,Jt as x,Ki as S,Kt as C,Lt as w,Nr as T,Pi as E,Qa as D,Sa as O,Ur as k,Vr as A,Wi as j,Xi as M,Xn as N,Yi as P,Zi as F,Zn as I,_n as L,an as R,ba as z,ca as B,cr as V,di as H,gn as ee,hn as te,in as U,jt as W,ka as G,mn as ne,nr as K,qa as re,qt as q,rr as ie,tn as J,tr as ae,vn as oe}from"../chunks/po-web-runtime-D8FIos2q.js";var se={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}},Y=[`host`,`workspace`,`session`],X=O(se,{scopes:Y,basePath:`calendar`,transport:(e,t)=>r.fetch(e,t),sessionAddress:D});function ce(){let t=re(`calendar`);return x(n=>e(t,n),()=>_(t))}var le={query:``,workspace:`all`,status:`open`,kind:`all`};function ue({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 de(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`} · ${de(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;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.`);r={kind:`interval`,seconds:t}}else if(e.kind===`Cron`){if(!e.expr.trim())throw Error(`Add a cron expression.`);r={kind:`cron`,expr:e.expr,tz:e.tz}}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.`);r={kind:`once`,at:t,tz:e.tz}}let i;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.`);i={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.`);i={kind:`existingSession`,sessionId:n.sessionId}}return n?.target.kind===i.kind&&(n.target.kind===`newSession`?n.target.workspaceId:n.target.sessionId)===e.targetId&&(i=n.target),{title:e.title.trim(),schedule:r,target:i,...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`,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:f,to:p,tz:m}=r??{},g=JSON.stringify(i??{}),[_,v]=q(n===`page`?`Everything`:s),[y,b]=q(()=>Te(c())),[x,S]=q(()=>(new Date(c()).getDay()+6)%7),[w,T]=q([]),[E,D]=q(),[O,k]=q({total:0,matched:0,more:!1}),A=C({key:``,count:1}),j=C(void 0),[M,N]=q(`loading`),[P,F]=q(),[I,L]=q(0),[R,z]=q(!1),B=C(!1),[V,H]=q(),[ee,te]=q(),[U,W]=q(),[G,ne]=q(),K=u===void 0?n===`page`||_===`Everything`?{level:`global`}:_===`Workspace`&&G&&G.level!==`global`?{level:`workspace`,workspaceId:G.workspaceId}:G:{level:`workspace`,workspaceId:u};h(()=>{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&&ne(i.data.owner);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=f!==void 0&&p!==void 0?{from:f,to:p,...m?{tz:m}:{}}:n!==`page`||l?_e(y,x):ve(c()),s=Se(e,a,t),d=await s.targets();if(!d.ok)throw Error(d.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=>{k({total:e.total,matched:e.matched,more:e.cursor!==void 0});let t=e.cursor;j.current=t?async()=>{let e=await v(t);r&&(A.current.count+=1,T(t=>[...t,...e.events]),b(e))}:void 0},S=JSON.stringify([a,h]);A.current.key!==S&&(A.current={key:S,count:1});let C=await v(),w=[...C.events];for(let e=1;(n===`panel`||e<A.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(d.data),b(C),N(`populated`))})().catch(e=>{r&&(F(e instanceof Error?e.message:String(e)),N(`error`))}),()=>{r=!1}},[e,t,n,_,y,x,I,a,f,p,m,g,l,c,u]);async function re(e){if(!B.current){B.current=!0,z(!0),F(void 0);try{await e()}catch(e){F(e instanceof Error?e.message:String(e))}finally{B.current=!1,z(!1)}}}function ie(e){if(e?.source)return;W(void 0),F(void 0),H(e??`new`);let t=e?.schedule;te({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`,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 J(){N(`loading`),F(void 0),H(void 0),W(void 0),T([]),D(void 0)}let ae={busy:R||M===`loading`,scope:e=>{e!==_&&(J(),v(e))},day:e=>{e!==x&&J(),S(e)},week:e=>{J(),b(t=>{let n=new Date(t);return n.setDate(n.getDate()+e*7),n.getTime()})},today:()=>{J(),b(Te(c())),S((new Date(c()).getDay()+6)%7),L(e=>e+1)},create:()=>ie(),retry:()=>{J(),L(e=>e+1)},event(n,r){let i=w.find(e=>e.id===r);i&&(n===`edit`?ie(i):re(async()=>{let a=Se(e,K&&K.level!==`session`?K:i.owner,t);if(n===`history`){let n=await Se(e,K??i.owner,t).history({params:{id:r}});if(!n.ok)throw Error(n.error);W({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.`);J(),L(e=>e+1)}))}},oe=d(()=>[...w].sort((e,t)=>(e.projectedDueAt??e.nextDueAt??e.updatedAt)-(t.projectedDueAt??t.nextDueAt??t.updatedAt)),[w]),se={timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,workspace:G&&G.level!==`global`?G.workspaceId:`Workspace`,session:t,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:oe.map(Ee)},Y=V&&V!==`new`?V.owner:K,X=E&&Y?{...E,workspaces:E.workspaces.filter(e=>Y.level===`global`||e.id===Y.workspaceId),sessions:E.sessions.filter(e=>Y.level===`global`||(Y.level===`session`?e.sessionId===Y.sessionId:e.workspaceId===Y.workspaceId))}:void 0,ce=V&&ee&&X?{fields:ee,execution:V===`new`?void 0:V.workflow?`Workflow: ${V.workflow.key}`:V.action?`Action: ${V.action.launcherId}`:void 0,assignment:V!==`new`&&V.assignment?JSON.stringify(V.assignment):void 0,busy:R,error:P,owner:V===`new`?K?.level===`global`?`Global`:_:V.owner.level===`global`?`Global`:V.owner.level===`workspace`?`Workspace`:`Session`,choices:ee.targetKind===`New session`?X.workspaces.filter(e=>e.active).map(e=>({id:e.id,name:e.name})):X.sessions.map(e=>({id:e.sessionId,name:e.name+(e.asleep?` (asleep)`:``)})),set:(e,t)=>te(n=>n&&{...n,[e]:t,...e===`targetKind`?{targetId:``}:{}}),close:()=>H(void 0),save:()=>{re(async()=>{if(!K)return;let n=Ce(ee,X,V===`new`?void 0:V),r=Se(e,V===`new`||K.level!==`session`?K:V.owner,t),i=V===`new`?await r.create({body:{...n,...o?{destinationHostId:o}:{}}}):await r.update({params:{id:V.id},body:n});if(!i.ok)throw Error(i.error||`Event could not be saved.`);H(void 0),J(),L(e=>e+1)})}}:void 0;return{data:se,owner:K,events:oe,total:O.total,matched:O.matched,more:O.more?()=>void re(async()=>await j.current?.()):void 0,targets:E,actions:ae,state:M,error:P,editor:ce,editing:V,history:U,busy:R,closeHistory:()=>W(void 0),moreHistory:()=>{re(async()=>{if(!U?.cursor)return;let n=await Se(e,K??U.event.owner,t).history({params:{id:U.event.id},query:{cursor:U.cursor}});if(!n.ok)throw Error(n.error);W({...U,items:[...U.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:r,onOpen:i,bodyOnly:a=!1}){if(a)return w(`div`,{className:`flex flex-col gap-2`,children:[e>0?g(V,{tone:`magenta`,className:`self-start`,children:`${e} today`}):null,r===`loading`?g(`p`,{className:`text-sm text-po-dim`,children:`Loading events…`}):null,r===`error`?g(`p`,{className:`text-sm text-po-dim`,children:`Could not load events`}):null,r===`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=>w(`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}),w(`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(n,{variant:`ghost`,size:`sm`,onClick:i,className:`-ml-2.5 self-start`,children:`Open Calendar`}):null]});let c=r===`populated`&&t.length===0?g(B,{title:`Nothing scheduled`,description:`Scheduled prompts and workflows will appear here.`}):w(`ul`,{className:`divide-y divide-po-border-soft`,children:[r===`loading`?g(`li`,{className:`px-4 py-3 text-sm text-po-dim`,children:`Loading events…`}):null,r===`error`?g(`li`,{className:`px-4 py-3 text-sm text-po-dim`,children:`Could not load events`}):null,t.map(e=>w(`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 w(s,{"data-testid":`calendar-home-card`,className:`overflow-hidden`,children:[w(`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(H,{"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(V,{tone:`magenta`,children:`${e} today`}):null,g(o,{"aria-hidden":`true`,className:`size-4 text-po-faint`})]}),g(`div`,{className:`border-t border-po-border-soft`,children:c})]})}function Me(e){return g(Ne,{...e},e.workspaceId??`home`)}function Ne({openPage:e,workspaceId:t,bodyOnly:n=!1}){let r=De(X,``,`page`,void 0,{status:`active`},ce(),void 0,void 0,void 0,void 0,t),[i]=q(()=>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=G({slot:`dashboard-tiles`,id:`calendar`,order:20,data:{version:1,title:`Coming up`,icon:H,size:`wide`,column:`side`,surfaces:[`home`,`workspace`]},component:e=>g(Me,{...e,bodyOnly:!0})}),Fe=G({slot:`home-apps`,id:`calendar`,data:{column:`main`},component:Me});function Ie({fixture:e,editor:t,initialLevel:r=`Session`,initialSchedule:a=`Once`,initialTarget:o=`New session`,invalid:s=!1,edit:c=!1}){let[l,u]=q(t?.owner??r),[d,f]=q(a),[p,h]=q(o),_=t?.fields.kind??d,v=t?.fields.targetKind??p;return w(`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:[w(`header`,{children:[g(`h1`,{className:`text-xl font-semibold text-po-hi`,children:c?`Edit event`:`New event`}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Scheduled work, handled by Po.`})]}),w(`div`,{className:`flex flex-col gap-1.5`,children:[g(R,{htmlFor:`event-title`,children:`Title`}),g(J,{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?w(`p`,{className:`text-sm text-po-dim`,children:[t.execution,` (read-only)`]}):w(`div`,{className:`flex flex-col gap-1.5`,children:[g(R,{htmlFor:`event-prompt`,children:`What should Po do?`}),g(b,{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?w(`p`,{className:`text-sm text-po-dim`,children:[`Agent setup (read-only): `,t.assignment]}):null,w(`fieldset`,{children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Belongs to`}),g(i,{value:l,onValueChange:u,children:g(m,{"aria-label":`Event owner level`,children:(t?[t.owner]:[`Session`,`Workspace`,`Global`]).map(e=>g(k,{value:e,children:e},e))})}),g(`p`,{className:`mt-2 text-sm text-po-dim`,children:l===`Session`?e.session:l===`Workspace`?`${e.workspace} workspace`:`Available across workspaces on this host`})]}),w(`fieldset`,{className:`flex flex-col gap-3`,children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Schedule`}),g(i,{value:_,onValueChange:e=>{f(e),t?.set(`kind`,e)},children:g(m,{"aria-label":`Schedule type`,children:[`Once`,`Interval`,`Cron`].map(e=>g(k,{value:e,children:e},e))})}),_===`Once`?w(`div`,{className:`grid grid-cols-2 gap-3`,children:[w(`div`,{children:[g(R,{htmlFor:`event-date`,children:`Date`}),g(J,{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})]}),w(`div`,{children:[g(R,{htmlFor:`event-time`,children:`Time`}),g(J,{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})]})]}):_===`Interval`?w(`div`,{children:[g(R,{htmlFor:`event-interval`,children:`Every (seconds)`}),g(J,{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)}),g(`p`,{className:`mt-1 text-sm text-po-dim`,children:`30 to 3,600 seconds. First run starts now.`})]}):w(`div`,{children:[g(R,{htmlFor:`event-cron`,children:`Cron expression`}),g(J,{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.`})]}),w(`div`,{children:[g(R,{htmlFor:`event-timezone`,children:`Timezone`}),g(J,{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)})]}),s||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]}),w(`fieldset`,{children:[g(`legend`,{className:`mb-2 font-medium text-po-hi`,children:`Run in`}),g(i,{value:v,onValueChange:e=>{h(e),t?.set(`targetKind`,e)},children:g(m,{"aria-label":`Event target`,children:[`New session`,`Existing session`].map(e=>g(k,{value:e,children:e},e))})}),w(`div`,{className:`mt-3`,children:[g(R,{htmlFor:`event-target`,children:v===`New session`?`Workspace`:`Session`}),t?w(`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(n,{className:`mt-1 w-full justify-start`,id:`event-target`,children:v===`New session`?e.workspace:e.session})]}),g(`p`,{className:`mt-2 text-sm text-po-dim`,children:v===`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.`}),w(`footer`,{className:`flex justify-end gap-2 border-t border-po-border pt-4`,children:[g(n,{variant:`ghost`,onClick:()=>t?.close(),children:`Cancel`}),g(n,{type:`submit`,variant:`primary`,disabled:t?.busy,children:c?`Save changes`:`Schedule event`})]})]})}function Le({model:e,sessionId:t,openSession:r}){return w(c,{children:[e.error?g(`p`,{role:`alert`,className:`text-po-red`,children:e.error}):null,e.editor?g(j,{open:!0,onOpenChange:t=>{!t&&!e.busy&&e.editor?.close()},children:w(S,{className:`max-h-[90vh] overflow-y-auto`,"aria-describedby":void 0,children:[g(F,{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(j,{open:!0,onOpenChange:t=>{t||e.closeHistory()},children:w(S,{"aria-describedby":void 0,children:[g(M,{dismissible:!0,closeLabel:`Close history`,children:w(F,{className:`min-w-0 truncate text-base`,children:[`History: `,e.history.event.title]})}),w(u,{children:[e.history.items.length===0?g(`p`,{className:`text-po-dim`,children:`No runs yet.`}):null,e.history.items.map(i=>w(`div`,{className:`flex flex-col gap-1 border-b border-po-border-soft pb-3 last:border-b-0`,children:[w(`p`,{children:[new Date(i.dueAt).toLocaleString(),` · `,i.state]}),i.error?g(`p`,{className:`text-sm text-po-dim`,children:i.error}):null,i.summary?g(`p`,{className:`text-sm text-po-dim`,children:i.summary}):null,i.workflowRun?w(`p`,{className:`break-words text-sm text-po-dim`,children:[`Workflow launch: `,JSON.stringify(i.workflowRun)]}):null,i.skippedCount?w(`p`,{className:`text-sm text-po-dim`,children:[`Skipped: `,i.skippedCount]}):null,i.sessionId&&r?g(n,{size:`sm`,variant:`secondary`,className:`self-start`,onClick:()=>{e.closeHistory(),r(xe(i.sessionId,t))},children:`Open run session`}):null]},i.id))]}),e.history.cursor?g(P,{children:g(n,{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:n,options:r,onChange:i}){return w(N,{value:n,onValueChange:i,children:[g(ae,{"aria-label":e,className:`h-8 min-w-0 md:w-44`,children:g(K,{})}),g(I,{children:r.map(([e,n])=>g(t,{value:e,children:n},e))})]})}var Ge=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ke({event:e,open:t,onOpen:r}){return w(`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:w(n,{size:`card`,variant:`subtle`,"aria-pressed":t,onClick:r,children:[w(`span`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[w(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.profile?g(v,{name:e.profile,size:`sm`}):null,g(`span`,{className:`font-semibold text-po-hi`,children:e.title})]}),g(T,{tone:e.status===`done`?`ok`:`neutral`,className:`text-po-dim`,children:Ge(e.status)})]}),w(`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:r,actions:i,runs:a,onAsk:o,onBack:s}){let[c,l]=q(``),[u,d]=q(!1),[f,m]=q(``),[h,_]=q(`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`,x=i?.busy||u,S=t=>{t.preventDefault(),o&&c.trim()&&!u&&(d(!0),m(``),o(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]],E=a?.id===e.id?a:void 0;return w(`div`,{className:`flex flex-col gap-4`,children:[w(n,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:s,children:[g(U,{className:`size-4`,"aria-hidden":`true`}),r]}),w(`div`,{className:`flex flex-col gap-2`,children:[w(`div`,{className:`flex flex-wrap items-center gap-2`,children:[g(`h2`,{className:`text-xl font-semibold text-po-hi`,children:e.title}),g(T,{tone:e.status===`done`?`ok`:`neutral`,className:`text-po-dim`,children:Ge(e.status)})]}),w(`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(n,{variant:`ghost`,size:`icon`,"aria-label":h,title:h,onClick:v,children:g(p,{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?w(`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)}),w(`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})]}),w(`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`}),E?E.error?g(`p`,{className:`text-po-dim`,children:E.error}):E.items.length===0?g(`p`,{className:`text-po-dim`,children:`No runs yet`}):g(`ul`,{className:`flex flex-col gap-0.5`,children:E.items.map(e=>w(`li`,{children:[e.at,` · `,e.state,e.note?w(`span`,{className:`text-po-dim`,children:[` · `,e.note]}):null]},e.id))}):g(`p`,{className:`text-po-dim`,children:`Loading runs…`}),g(n,{variant:`link`,size:`xs`,className:`self-start px-0`,disabled:x,onClick:()=>i?.event(`history`,e.id),children:`View all history`})]}),o&&!y&&!e.source?w(`form`,{onSubmit:S,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`}),w(`div`,{className:`relative`,children:[g(b,{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(n,{type:`submit`,variant:`primary`,size:`icon-md`,"aria-label":`Ask Po`,className:`absolute right-1.5 bottom-1.5 rounded-full`,disabled:x||!c.trim(),children:g(ie,{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:w(`div`,{className:`flex flex-wrap gap-2`,children:[g(n,{variant:`primary`,size:`sm`,disabled:x,onClick:()=>i?.event(`runNow`,e.id),children:`Run now`}),e.source?null:g(n,{size:`sm`,disabled:x,onClick:()=>i?.event(`edit`,e.id),children:`Edit`}),g(n,{size:`sm`,disabled:x,onClick:()=>i?.event(`pause`,e.id),children:e.status===`paused`?`Resume`:`Pause`}),g(n,{size:`sm`,variant:`ghost`,disabled:x,onClick:()=>i?.event(`cancel`,e.id),children:`Cancel event`})]})]})}function Je({mode:e,cells:t,open:r,onOpen:i,...a}){let[o,s]=q(``),l=t.find(e=>e.key===o)??t.find(e=>e.today)??t.find(e=>!e.outside)??t[0],u=(e,t=``)=>{s(e),i(t)},d=l?.events.find(e=>e.id===r);return w(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[w(`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 i=e===`month`?t.events.slice(0,Ue):t.events,a=t.events.length-i.length;return w(`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===l?.key?`bg-po-deep/50`:``}`,children:[g(`button`,{type:`button`,"aria-label":t.label,"aria-pressed":t.key===l?.key,onClick:()=>u(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}),i.map(e=>w(n,{size:`card`,variant:`subtle`,"aria-pressed":t.key===l?.key&&e.id===r,className:`gap-0 bg-po-panel px-1.5 py-1 text-sm`,onClick:()=>u(t.key,e.id),children:[w(`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})]}),w(`span`,{className:`flex min-w-0 items-center justify-between gap-1 text-po-dim`,children:[w(`span`,{className:`flex min-w-0 items-center gap-1`,children:[e.profile?g(v,{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)),a>0?w(n,{size:`xs`,variant:`ghost`,className:`self-start`,onClick:()=>u(t.key),children:[a,` more`]}):null]},t.key)})})]}),l?g(`aside`,{"aria-label":d?d.title:l.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 ${d?`lg:w-96`:`lg:w-80`}`,children:d?g(qe,{event:d,when:`${l.label}, ${d.time}`,back:`Back to ${l.label}`,onBack:()=>i(``),...a},d.id):w(c,{children:[w(`div`,{children:[g(`h2`,{className:`text-lg font-semibold text-po-hi`,children:l.label}),g(`p`,{className:`text-sm text-po-dim`,children:l.events.length===0?`Nothing scheduled`:`${l.events.length} scheduled ${l.events.length===1?`event`:`events`}`})]}),g(`ol`,{className:`flex flex-col gap-2`,children:l.events.map(e=>g(Ke,{event:e,open:!1,onOpen:()=>i(e.id)},e.id))})]})}):null]})}function Ye({days:e,total:t,matched:r=t,onMore:a,filters:s,workspaces:l,timezone:u,state:d=`populated`,mode:f=`agenda`,period:p,cells:h=[],actions:_,runs:v,onAsk:b,onOpen:x,onFilters:S,onMode:C,onMove:T,onClose:D,initialOpen:O=``,children:j}){let[M,N]=q(O),P=e=>{N(e),e&&x?.(e)},F={actions:_,runs:v,onAsk:b},I=e.find(e=>e.events.some(e=>e.id===M)),L=I?.events.find(e=>e.id===M),R=f===`agenda`?e.reduce((e,t)=>e+t.events.length,0):new Set(h.flatMap(e=>e.events.map(e=>e.id))).size,z=s.query!==le.query||s.workspace!==le.workspace||s.status!==le.status||s.kind!==le.kind,V=e=>S?.({...s,...e});return w(`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:[w(`header`,{className:`flex items-start justify-between gap-3 border-b border-po-border px-4 py-3`,children:[w(`div`,{className:`min-w-0`,children:[g(`h1`,{className:`text-xl font-semibold text-po-hi`,children:`Calendar`}),w(`p`,{className:`truncate text-sm text-po-dim`,children:[`All workspaces · Times in `,u]})]}),w(`div`,{className:`flex shrink-0 items-center gap-1`,children:[g(n,{variant:`primary`,disabled:_?.busy,onClick:()=>_?.create(),children:`New event`}),D?g(n,{variant:`ghost`,size:`icon`,"aria-label":`Close calendar`,onClick:D,children:g(E,{className:`size-4`})}):null]})]}),w(`div`,{className:`flex flex-col gap-2 border-b border-po-border-soft px-4 py-3 md:flex-row md:items-center`,children:[w(`div`,{className:`relative min-w-0 flex-1`,children:[g(y,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-po-faint`}),g(J,{type:`search`,"aria-label":`Search events`,className:`w-full pl-8`,placeholder:`Search events`,value:s.query,onChange:e=>V({query:e.target.value})})]}),w(`div`,{className:`grid grid-cols-3 gap-2 md:flex`,children:[g(We,{label:`Workspace`,value:s.workspace,options:[[`all`,`All workspaces`],...l.map(e=>[e.id,e.name])],onChange:e=>V({workspace:e})}),g(We,{label:`Status`,value:s.status,options:Be,onChange:e=>V({status:e})}),g(We,{label:`Schedule`,value:s.kind,options:Ve,onChange:e=>V({kind:e})})]})]}),w(i,{value:f,onValueChange:e=>C?.(e),className:`flex min-h-0 flex-1 flex-col`,children:[w(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-po-border-soft px-4 py-2`,children:[f===`agenda`?null:w(c,{children:[g(n,{variant:`ghost`,size:`icon-md`,"aria-label":`Previous ${f}`,onClick:()=>T?.(-1),children:g(o,{className:`size-4 rotate-180`})}),g(`h2`,{"aria-live":`polite`,className:`min-w-36 text-center text-lg font-semibold text-po-hi`,children:p}),g(n,{variant:`ghost`,size:`icon-md`,"aria-label":`Next ${f}`,onClick:()=>T?.(1),children:g(o,{className:`size-4`})}),g(n,{size:`sm`,variant:`subtle`,onClick:()=>T?.(0),children:`Today`})]}),w(`output`,{className:`text-sm text-po-dim`,children:[R,` of `,r,` `,r===1?`event`:`events`]}),a?g(n,{size:`sm`,variant:`subtle`,disabled:_?.busy,onClick:a,children:`Load more`}):null,z?g(n,{size:`sm`,variant:`ghost`,onClick:()=>S?.(le),children:`Clear filters`}):r<t?g(n,{size:`sm`,variant:`ghost`,onClick:()=>V({status:`all`}),children:`Show finished events`}):null,g(m,{"aria-label":`Calendar view`,className:`ml-auto`,children:He.map(([e,t])=>g(k,{value:e,children:t},e))})]}),w(A,{value:f,className:`flex min-h-0 flex-col`,children:[j,d===`populated`&&f!==`agenda`?g(Je,{mode:f,cells:h,open:M,onOpen:P,...F},p):w(`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`?w(`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(n,{className:`mt-3`,variant:`outline`,onClick:()=>_?.retry(),children:`Try again`})]}):t===0?g(B,{title:`Nothing scheduled`,description:`Leave a prompt for later. Po will take it from here.`}):e.length===0?g(B,{title:`No events match`,description:z?`Try another search, or clear the filters.`:`Nothing is active or paused. Finished and cancelled events are hidden.`}):e.map(e=>w(`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:M===e.id,onOpen:()=>P(M===e.id?``:e.id)},e.id))})]},e.label))}),d===`populated`&&I&&L?g(`aside`,{"aria-label":L.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:L,when:`${I.label}, ${L.time}`,back:`Back to agenda`,onBack:()=>P(``),...F},L.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 O(se,{scopes:Y,basePath:`calendar`,transport:(t,n)=>e?W(z).fetch(t,n):Promise.reject(Error(`This Po is not signed in to Po Cloud.`)),sessionAddress:D})}function $e({openSession:e,poCloud:t}){let[n]=q(Date.now),[r,i]=q(`month`),[a,o]=q(n),s=r===`agenda`?void 0:ye(r,a),c=Intl.DateTimeFormat().resolvedOptions().timeZone,[l,u]=q(le),[f,p]=q(l);h(()=>{let e=setTimeout(()=>p(l),250);return()=>clearTimeout(e)},[l]);let m=s&&{from:s.from,to:s.to,tz:c},_=ce(),v=De(X,``,`page`,m,ue(f),_),y=t!==void 0,b=d(()=>Qe(y),[y]),x=De(b,``,`page`,m,ue(f),_),S=y&&x.state===`populated`,C=y,T=S?Re(x.events,v.events):v.events.map(e=>({...e,place:`local`})),E=e=>S&&x.events.some(t=>t.id===e)?x:v,D=e=>E(e)===x?b:X,[O,k]=q(``),[A,j]=q();h(()=>{if(!O)return;let e=!0;return(S&&x.events.some(e=>e.id===O)?b:X).host.history({params:{id:O}}).then(e=>{if(!e.ok)throw Error(e.error||`Runs could not load.`);return{id:O,items:e.data.occurrences.slice(0,Xe).map(Ze)}}).catch(e=>({id:O,items:[],error:e instanceof Error?e.message:String(e)})).then(t=>e&&j(t)),()=>{e=!1}},[O,v.events,x.events,S,b]);let M=e&&(async(t,n)=>{let r=E(t)===x,i=await D(t).host.ask({params:{id:t},body:{request:n}});if(!i.ok)throw Error(i.error||`Po could not start the change.`);e(r?`${z}/${i.data.sessionId}`:i.data.sessionId)}),N=e=>{let n=Ee(e),r=e.place===`cloud`?x.targets:v.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:S?`${s} · ${o}`:o}},P=C?ze(v.actions,x.actions,e=>E(e)===x):v.actions,F=S&&(v.more||x.more)?()=>{v.more?.(),x.more?.()}:v.more,I=(e,t)=>new Date(e).toLocaleDateString(void 0,t),L=s?he(T,s.days,s.to).map((e,t)=>{let i=s.days[t];return{key:String(i),day:new Date(i).getDate(),label:I(i,{weekday:`long`,day:`numeric`,month:`long`}),weekday:I(i,{weekday:`short`}),outside:r===`month`&&new Date(i).getMonth()!==new Date(a).getMonth(),today:i<=n&&n<(s.days[t+1]??s.to),events:e.map(N)}}):void 0,R=s?r===`month`?I(a,{month:`long`,year:`numeric`}):`${I(s.from,{day:`numeric`,month:`short`})} to ${I(s.days.at(-1),{day:`numeric`,month:`short`,year:`numeric`})}`:void 0;return w(Ye,{days:s?[]:me(T,n).map(e=>({label:e.label,events:e.events.map(N)})),total:v.total+(S?x.total:0),matched:v.matched+(S?x.matched:0),onMore:F,filters:l,workspaces:[...S?pe(x.targets):[],...pe(v.targets)],timezone:v.data.timezone,state:S&&v.state===`error`?`populated`:v.state,mode:r,period:R,cells:L,actions:P,runs:A,onOpen:k,onAsk:M,onFilters:u,onMode:i,onMove:e=>r!==`agenda`&&o(be(r,a,e,Date.now())),children:[g(Le,{model:v,sessionId:``,openSession:e}),C?g(Le,{model:x,sessionId:`${z}/`,openSession:e}):null,y&&x.state===`error`?w(`p`,{role:`alert`,className:`text-po-red`,children:[`Po Cloud events could not load. `,x.error]}):null]})}var et=G({slot:`page`,id:`calendar`,component:$e});function tt({openPage:e,activePageId:t}){let r=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:w(n,{variant:`ghost`,size:`lg`,"data-testid":`calendar-open`,"aria-current":r?`page`:void 0,onClick:()=>e?.(`calendar`),className:r?`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(H,{"aria-hidden":`true`,className:r?`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=G({slot:`rail`,id:`calendar`,component:tt});function rt({event:e,actions:t}){let r=e.status===`cancelled`||e.status===`done`;return w(`div`,{className:`mt-2 flex flex-col gap-3 rounded border border-po-border bg-po-panel p-3`,children:[e.source?w(V,{tone:`neutral`,children:[`Managed by `,e.source]}):null,g(`p`,{children:e.prompt}),e.assignment?w(`p`,{className:`text-sm text-po-dim`,children:[`Agent setup: `,e.assignment]}):null,w(`p`,{className:`text-sm text-po-dim`,children:[`Target: `,e.target,`. `,r?`This event is ${e.status}.`:`Sleeping sessions wake automatically.`]}),w(`div`,{className:`flex flex-wrap gap-2`,children:[r?null:w(c,{children:[e.source?null:g(n,{size:`sm`,onClick:()=>t?.event(`edit`,e.id),disabled:t?.busy,children:`Edit event`}),g(n,{size:`sm`,onClick:()=>t?.event(`pause`,e.id),disabled:t?.busy,children:e.status===`paused`?`Resume`:`Pause`}),g(n,{size:`sm`,onClick:()=>t?.event(`runNow`,e.id),disabled:t?.busy,children:`Run now`})]}),g(n,{size:`sm`,onClick:()=>t?.event(`history`,e.id),disabled:t?.busy,children:`History`}),r?null:g(n,{size:`sm`,variant:`danger-outline`,disabled:t?.busy,onClick:()=>t?.event(`cancel`,e.id),children:`Cancel event`})]})]})}function it({fixture:e,actions:t,children:r,initialScope:a=`Session`,state:o=`populated`,detail:s=!1}){let[c,l]=q(a),[u,d]=q(`Thu 22`),f=t?e.days[e.selectedDay??0]:u,[p,h]=q(s?`reviews`:``),_=e.events.filter(e=>t||c===`Everything`||e.owner===`Session`||c===`Workspace`&&e.owner===`Workspace`);return w(`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:[w(`header`,{className:`flex items-start justify-between gap-3`,children:[w(`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(n,{variant:`outline`,disabled:t?.busy,onClick:()=>t?.create(),children:`New event`})]}),w(i,{value:c,onValueChange:e=>{l(e),t?.scope(e)},children:[g(m,{"aria-label":`Calendar level`,children:[`Session`,`Workspace`,`Everything`].map(e=>g(k,{value:e,children:e},e))}),[`Session`,`Workspace`,`Everything`].map(t=>g(A,{value:t,className:`mt-2 text-sm text-po-dim`,children:t===`Session`?e.session:t===`Workspace`?`${e.workspace} workspace and its sessions`:`All workspaces and sessions on this host`},t))]}),w(`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(n,{size:`sm`,variant:`ghost`,onClick:()=>{d(`Thu 22`),t?.today()},children:`Today`})]}),t?w(`div`,{className:`flex justify-between`,children:[g(n,{onClick:()=>t?.week(-1),children:`Previous week`}),g(n,{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(r=>w(n,{"aria-pressed":f===r,variant:f===r?`primary`:`ghost`,className:`h-auto flex-col px-1 py-2`,onClick:()=>{d(r),t?.day(e.days.indexOf(r)),h(``)},children:[g(`span`,{className:`text-sm`,children:r.split(` `)[0]}),g(`span`,{children:r.split(` `)[1]})]},r))}),w(`div`,{children:[g(`h2`,{className:`font-semibold text-po-hi`,children:t?f:f===`Thu 22`?`Today · Thursday 22 October`:`${f} October`}),w(`p`,{className:`mt-1 text-sm text-po-dim`,children:[`Times in `,e.timezone]})]}),r,o===`loading`?g(`output`,{className:`py-6 text-po-dim`,children:`Loading your schedule…`}):o===`error`?w(`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(n,{className:`mt-3`,variant:`outline`,onClick:()=>t?.retry(),children:`Try again`})]}):o===`denied`?g(B,{title:`This calendar is not available`,description:`You do not have permission to view this level. Your session calendar is still available.`}):o===`empty`||t&&_.length===0||!t&&f!==`Thu 22`?g(B,{title:`Nothing scheduled`,description:`Leave a prompt for later. Po will take it from here.`}):g(`ol`,{className:`flex flex-col gap-3`,children:_.map(r=>w(`li`,{className:`flex items-start gap-3`,children:[g(`span`,{className:`w-10 shrink-0 pt-3 text-sm text-po-dim`,children:r.time}),w(`div`,{className:`min-w-0 flex-1`,children:[w(n,{size:`card`,variant:`outline`,"aria-expanded":p===r.id,onClick:()=>h(p===r.id?``:r.id),children:[w(`span`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[g(`span`,{className:`font-semibold text-po-hi`,children:r.title}),r.status===`Scheduled`?g(T,{tone:`neutral`,className:`text-po-dim`,children:o===`blocked`&&r.id===`reviews`?`Paused`:`Scheduled`}):g(T,{tone:t?r.status===`done`?`ok`:`neutral`:o===`failed`?`error`:`ok`,children:t?r.status:o===`failed`?`Failed`:`Handled`})]}),w(`span`,{className:`text-sm text-po-dim`,children:[r.schedule,` · `,r.target]}),w(`span`,{className:`text-sm text-po-dim`,children:[r.owner,r.owner===`Global`?``:` · ${e.workspace}`]})]}),p===r.id?g(rt,{event:r,actions:t}):null]})]},r.id))}),o===`skipped`?w(`aside`,{className:`rounded border border-po-border p-3`,children:[g(V,{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,o===`blocked`?w(`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(n,{className:`mt-3`,variant:`secondary`,children:`Choose session`})]}):null,o===`failed`?w(`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(n,{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(X,e,`panel`,void 0,void 0,ce());return g(it,{fixture:n.data,actions:n.actions,state:n.state,children:g(Le,{model:n,sessionId:e,openSession:t})})}var st=a({id:`calendar`,label:`Calendar`,icon:H,order:40,panel:at}),ct=G({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`:{if(!Array.isArray(i))return s;let e=i.map(e=>bt(e,r,{prompt:!1})).filter(e=>e!==void 0);return{tone:`ok`,summary:St(e.length,`event`),...e.length?{events:e}:{empty:`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}}function wt({label:e,children:t}){return w(`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 Tt({event:e}){return w(c,{children:[e.cron?g(`code`,{className:`font-mono text-po-text`,children:e.when}):e.when,e.zone?w(`span`,{className:`text-sm text-po-dim`,children:[` · `,e.zone]}):null]})}function Et({event:e}){return w(`div`,{className:`flex flex-col gap-3`,children:[w(`dl`,{className:`flex flex-col gap-1.5`,children:[g(wt,{label:`When`,children:g(Tt,{event:e})}),e.next?g(wt,{label:`Next`,children:e.next}):null,g(wt,{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 Dt({event:e}){return w(`li`,{className:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`,children:[w(`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}),w(`span`,{className:`text-sm break-words text-po-dim`,children:[g(Tt,{event:e}),e.next?` · Next ${e.next}`:null]})]}),e.status?g(T,{tone:e.status.tone,children:e.status.label}):null]})}function Ot({run:e}){return w(`li`,{className:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`,children:[w(`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(T,{tone:e.tone,children:e.label})]})}function kt({toolName:e,fixture:t,defaultExpanded:n=!1}){let r=t.details.split(`
2
- `).map(e=>({text:e,tone:`text`}));return g(ne,{tone:t.tone,expandable:t.details!==``,defaultExpanded:n,children:({expanded:n})=>w(c,{children:[g(ee,{title:e,badge:t.outcome,children:g(`span`,{className:`min-w-0 truncate text-po-text`,children:t.summary})}),w(te,{className:`flex flex-col gap-3`,children:[t.failure?w(`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(Et,{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(Dt,{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(Ot,{run:e},e.when))}):null,t.empty?g(`p`,{className:`text-base text-po-dim`,children:t.empty}):null,t.tone===`running`?g(L,{tone:`running`,children:`Saving to your calendar`}):null,t.note?g(`p`,{className:`text-sm text-po-dim`,children:t.note}):null,t.details?w(`div`,{className:`flex flex-col gap-3 border-t border-po-border-soft pt-3`,children:[g(L,{expands:!0,glyph:n?`⌄`:`›`,className:`text-sm text-po-dim`,children:n?`Hide details`:`Show details`}),n?g(oe,{lines:r}):null]}):null]})]})})}function At(e){return g(kt,{toolName:e.toolName,fixture:Ct(e)})}var jt=f({tools:[...lt],message:At}),$=(e,t)=>t===void 0?void 0:{...e,...t},Mt=l({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`]},jt)]}}});export{Mt as webPlugin};
@@ -1,11 +0,0 @@
1
- import{$i as e,$r as t,Fi as n,Ft as r,Ga as i,Ha as a,Ia as o,It as s,Lt as c,Mi as l,Pt as u,Ta as d,_n as f,gn as p,hn as m,ka as h,mn as g,ri as _,sn as v,un as y,xi as b}from"../chunks/po-web-runtime-D8FIos2q.js";var x=`codemode_background`,S=`background-scripts-stop`,C={scripts:[],stopRequested:[]};function w(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.label==`string`&&typeof t.startedAt==`string`&&(t.status===`running`||t.status===`reporting`)}function ee(e){if(typeof e!=`object`||!e)return null;let t=e.scripts;return Array.isArray(t)?{scripts:t.filter(w)}:null}function te(e,t){let n=new Set(t.scripts.filter(e=>e.status===`running`).map(e=>e.id));return{...t,stopRequested:e.stopRequested.filter(e=>n.has(e))}}function ne(e,t){return{...e,stopRequested:[...e.stopRequested.filter(e=>e!==t),t]}}var T=o(C);function E(e,t,n){e(t,{type:`prompt`,message:`/${S} ${n}`}),T.update(t,e=>ne(e,n))}var D=T.channel({channel:x,parse:ee,reduce:te}),O=d(D);function k({sessionId:n,sendSessionFrame:r}){let i=u(T.store,e=>T.select(e,n));return i.scripts.length===0?null:s(`div`,{"data-testid":`activity-background-scripts`,className:`flex flex-col gap-0.5`,children:i.scripts.map(a=>{let o=i.stopRequested.includes(a.id);return c(`div`,{"data-testid":`activity-background-script-${a.id}`,className:`flex min-w-0 flex-col gap-0.5 rounded-md px-1 py-1`,children:[c(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[s(e,{tone:`yellow`,pulse:a.status===`running`}),s(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:`Background script`}),a.status===`reporting`?s(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`finishing…`}):s(v,{label:`up`,since:Date.parse(a.startedAt),className:`shrink-0 text-sm text-po-dim`}),n!==null&&a.status===`running`?s(t,{variant:o?`outline`:`danger-outline`,size:`xs`,"data-testid":`activity-background-script-stop-${a.id}`,"aria-disabled":o,title:o?`stop requested; the script reports its own end`:`stop this background script`,className:`px-1.5`,onClick:()=>{o||E(r,n,a.id)},children:o?`stopping…`:`stop`}):null]}),s(`span`,{className:`truncate pl-3 font-mono text-sm text-po-dim`,children:a.label})]},a.id)})})}var A=h({order:1100,component:k}),j=`exec`,M=`discover`,N=120,P=160,re=50,ie=/^image\/(?:png|jpeg|webp|gif)$/u,ae=/^Saved as (\S+) \((.+)\)$/u,F=/^(?:#{1,6} |```)/mu;function I(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function L(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function R(e){return typeof e.code==`string`?e.code:``}function z(e){let t=R(e).split(`
2
- `).map(e=>e.trim()).find(e=>e!==``);return t===void 0?`script`:L(t.replace(/^\/\/+\s*/u,``),N)}function B(e){let t=I(e);if(t===void 0||typeof t.name!=`string`||t.name===``)return;let n=I(t.result);return{name:t.name,args:I(t.args)??{},ok:t.ok!==!1,ms:typeof t.ms==`number`&&Number.isFinite(t.ms)&&t.ms>=0?Math.round(t.ms):0,...typeof t.tool==`string`&&t.tool!==``?{tool:t.tool}:{},...typeof t.error==`string`&&t.error!==``?{error:t.error}:{},...n!==void 0&&Array.isArray(n.content)?{result:{content:n.content,details:n.details}}:{}}}function V(e){let t=I(e)?.calls;return Array.isArray(t)?t.slice(0,re).map(B).filter(e=>e!==void 0):[]}function H(e){return L(Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`string`?t:JSON.stringify(t)??String(t)}`).join(` · `),P)}function U(e){let t;try{t=JSON.parse(e)}catch{return e.split(`
3
- `).join(` `)}let n=I(t);return n!==void 0&&Object.keys(n).length>0?H(n):L(JSON.stringify(t),P)}function W(e){if(e===null)return{lines:[],images:[]};let t,n=[],r=[];for(let i of e.content){let e=I(i);if(e?.type===`text`&&typeof e.text==`string`){let r=ae.exec(e.text.trim());r?.[1]!==void 0&&r[2]!==void 0?t={id:r[1],path:r[2]}:n.push(e.text)}else e?.type===`image`&&typeof e.data==`string`&&typeof e.mimeType==`string`&&ie.test(e.mimeType)&&r.push({mimeType:e.mimeType,data:e.data})}let i=n.join(`
4
- `).replaceAll(`\r
5
- `,`
6
- `).replaceAll(`\r`,`
7
- `).replaceAll(` `,` `).split(`
8
- `);for(;i.length>0&&i.at(-1)?.trim()===``;)i.pop();return{lines:i,...t===void 0?{}:{saved:t},images:r}}function G(e){return F.test(e)}function K(e){return typeof e.namespace==`string`&&e.namespace!==``?e.namespace:typeof e.query==`string`&&e.query!==``?`find "${L(e.query,N)}"`:`namespaces and scripts`}function q({args:e,output:t,running:i,isError:a,defaultExpanded:o=!1}){let u=typeof e.namespace==`string`&&e.namespace!==``&&!a;return s(g,{tone:l({running:i,isError:a}),expandable:!0,defaultExpanded:o,children:({expanded:o})=>c(r,{children:[s(p,{title:M,children:s(`span`,{"data-testid":`tool-call-${M}`,className:`min-w-0 flex-1 truncate text-po-text`,children:K(e)})}),o?c(m,{"data-testid":`tool-result-${M}`,className:`flex flex-col gap-2`,children:[i&&t===``?s(f,{tone:`running`,children:`running`}):null,t===``?null:u?s(`div`,{className:`max-h-96 overflow-auto`,children:s(n,{text:t,className:`language-ts`})}):s(`pre`,{"data-testid":`tool-output`,className:`max-h-96 overflow-auto font-mono text-sm break-words whitespace-pre-wrap ${a?`text-po-red`:`text-po-text`}`,children:t})]}):null]})})}var oe=a({message:q});function se({label:e,children:t}){return c(`section`,{className:`flex flex-col gap-1.5`,children:[s(`h4`,{className:`text-sm font-medium text-po-dim`,children:e}),t]})}var J=`relative before:absolute before:top-[1.125rem] before:-left-4 before:w-3 before:border-t before:border-po-border-soft`,Y=`flex min-h-6 cursor-pointer list-none items-center gap-x-2 gap-y-0.5 [&::-webkit-details-marker]:hidden`;function X(){return s(`span`,{"aria-hidden":!0,className:`w-3 shrink-0 text-center text-po-dim transition-transform group-open:rotate-90`,children:`›`})}function Z({text:e,images:t,label:n,review:i}){return c(r,{children:[G(e)?s(`div`,{"data-testid":`tool-output-document`,className:`max-h-96 overflow-auto text-sm`,children:s(y,{text:e,renderMediaReview:i})}):null,t.map((e,t)=>s(_,{src:`data:${e.mimeType};base64,${e.data}`,alt:`${n} image ${String(t+1)}`,renderReview:i,"data-testid":`tool-output-image`,className:`max-h-48 max-w-full rounded-md border border-po-border-soft`},`${e.mimeType}-${String(t)}`))]})}function ce({call:e,review:t,suppressOutputs:i}){let a=W(e.result??null),o=a.lines.join(`
9
- `),l=o!==``&&(!e.ok||!G(o)),u=Object.keys(e.args).length>0||l||e.error!==void 0,d=c(r,{children:[s(`span`,{className:`shrink-0 truncate font-mono font-semibold text-po-text max-sm:basis-full`,children:e.name}),s(`span`,{className:`min-w-0 flex-1 truncate font-mono text-po-dim group-open:invisible`,children:H(e.args)}),s(`span`,{"aria-hidden":!0,className:`w-3 shrink-0 text-center ${e.ok?`text-po-green`:`text-po-red`}`,children:e.ok?`✓`:`✗`}),s(`span`,{className:`sr-only`,children:e.ok?`completed`:`failed`}),c(`span`,{className:`w-16 shrink-0 text-right tabular-nums text-po-dim`,children:[e.ms,` ms`]})]});return c(`div`,{"data-testid":`exec-call`,className:`flex flex-col gap-2 py-1.5`,children:[u?c(`details`,{className:`group text-sm`,children:[c(`summary`,{className:`${Y} flex-wrap`,children:[d,s(X,{})]}),c(`div`,{className:`mt-2 flex flex-col gap-2`,children:[Object.keys(e.args).length>0?s(n,{text:JSON.stringify(e.args,null,2),className:`language-json`}):null,l?s(`pre`,{"data-testid":`exec-call-output`,className:`max-h-72 overflow-auto font-mono text-sm break-words whitespace-pre-wrap text-po-text`,children:o}):null,e.error===void 0?null:s(`p`,{className:`text-sm break-words text-po-red`,children:e.error})]})]}):s(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:d}),i?null:s(Z,{text:e.ok?o:``,images:a.images,label:e.name,review:t})]})}function le({result:e,isError:t,review:n,suppressOutputs:r}){let i=W(e),a=i.lines.join(`
10
- `),o=t?`Error`:`Returned`,l=t?`text-po-red`:`text-po-text`;return c(`div`,{"data-testid":`tool-result-${j}`,className:`flex flex-col gap-2`,children:[i.lines.length===0?s(`p`,{className:`text-sm text-po-dim`,children:t?`Failed with no output.`:`Returned nothing.`}):!t&&G(a)?s(`p`,{className:`text-sm font-semibold text-po-dim`,children:o}):c(`details`,{className:`group text-sm`,children:[c(`summary`,{className:`${Y} text-po-dim hover:text-po-blue`,children:[s(`span`,{className:`shrink-0 font-semibold`,children:o}),s(`span`,{className:`min-w-0 flex-1 truncate font-mono group-open:hidden ${l}`,children:U(a)}),s(X,{})]}),s(`pre`,{"data-testid":`tool-output`,className:`mt-1 max-h-72 overflow-auto font-mono text-sm break-words whitespace-pre-wrap ${l}`,children:a})]}),r?null:s(Z,{text:t?``:a,images:i.images,label:`Script`,review:n})]})}function ue(e){let{args:t,result:i,running:a,isError:o,defaultExpanded:u=!1,renderTool:d,suppressOutputs:f}=e,h=b(e),_=R(t),v=W(i).saved,y=V(i?.details),x=y.filter(e=>!e.ok).length,S=!a||i!==null;return s(g,{tone:l({running:a,isError:o}),expandable:_!==``,defaultExpanded:u,children:({expanded:e})=>c(r,{children:[c(p,{title:j,children:[s(`span`,{"data-testid":`tool-call-${j}`,className:`min-w-0 flex-1 truncate text-po-text`,children:z(t)}),y.length>0?c(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[y.length,` `,y.length===1?`call`:`calls`,x>0?c(`span`,{className:`text-po-red`,children:[`, `,x,` failed`]}):null]}):null]}),e?c(m,{className:`flex flex-col gap-2`,children:[s(se,{label:`Code`,children:s(n,{text:_,className:`language-ts`})}),v===void 0?null:c(`p`,{className:`text-sm text-po-dim`,title:v.path,children:[`Saved as `,s(`span`,{className:`font-mono text-po-text`,children:v.id})]})]}):null,S?c(`ol`,{"aria-label":`Script calls`,className:`mx-4 mb-3 flex flex-col gap-2 border-l border-po-border-soft pl-4 sm:ml-[2.125rem]`,children:[y.map((e,t)=>{let n=e.tool===void 0||d===void 0?null:d({toolName:e.tool,args:e.args,result:e.result??null,isError:!e.ok});return s(`li`,{className:`${J} flex flex-col gap-2`,children:n===null?s(ce,{call:e,review:h,suppressOutputs:f}):c(r,{children:[n,f?null:s(Z,{text:``,images:W(e.result??null).images,label:e.name,review:h})]})},`${String(t)}-${e.name}`)}),a?null:s(`li`,{className:J,children:s(le,{result:i,isError:o,review:h,suppressOutputs:f})})]}):null]})})}function Q(e){let t=b(e),n=[],r=(e,r,i,a)=>{let o=W(e).lines.join(`
11
- `);!a&&G(o)&&n.push({id:`${r}:document`,title:i,content:s(Z,{text:o,images:[],label:i,review:t})}),(e?.content??[]).forEach((e,a)=>{typeof e==`object`&&e&&`type`in e&&e.type===`image`&&n.push({id:`${r}:image:${String(a)}`,title:`${i} image ${String(a+1)}`,content:s(Z,{text:``,images:W({content:[e],details:null}).images,label:i,review:t})})})};return V(e.result?.details).forEach((t,i)=>{let a=t.tool===void 0?[]:e.toolOutputs?.({toolName:t.tool,args:t.args,result:t.result??null,isError:!t.ok})??[];if(a.length===0)r(t.result??null,`call:${String(i)}`,t.name,!t.ok);else for(let e of a)n.push({...e,id:`call:${String(i)}:${e.id}`})}),r(e.result,`returned`,`Script`,e.isError),n}var de=a({message:ue,outputs:Q}),$=(e,t)=>t===void 0?void 0:{...e,...t},fe=i({id:`codemode`,packageName:`@agimon-ai/po-codemode`,session:{get channels(){return[$({channel:`codemode_background`},O)]},get fills(){return[$({slot:`activity.runners`,id:`background-scripts`},A)]},get toolRenderers(){return[$({tools:[`discover`]},oe),$({tools:[`exec`]},de)]}}});export{fe as webPlugin};
@@ -1 +0,0 @@
1
- import{$r as e,At as t,Br as n,Bt as r,Di as i,Ft as a,Ga as o,Gi as s,Hr as c,Ht as l,Ir as u,It as d,Ki as f,Kt as p,La as m,Lt as h,Mr as g,Na as _,Pa as v,Qa as y,Sa as b,Si as x,Ur as S,Vn as C,Vr as w,Vt as T,Wi as E,Xi as D,Yi as O,Zi as k,an as A,da as j,ea as ee,fr as M,hr as N,jn as P,mr as F,na as te,oa as ne,or as I,pr as L,qi as R,qt as z,ra as re,rn as ie,tn as B}from"../chunks/po-web-runtime-D8FIos2q.js";var ae=/^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$/u,oe=`domains`,V=`newDomain`,H={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:[oe,V],response:void 0}};b(H,{scopes:[`session`],basePath:`domains`,transport:(e,n)=>t.fetch(e,n),sessionAddress:y});var U=b(H,{scopes:[`host`,`workspace`,`session`],basePath:`plugin-settings`,transport:(e,n)=>t.fetch(e,n),sessionAddress:y}),se={"content-type":`application/json`},ce={"content-type":`application/zip`};async function le(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 W(e,t,n,r){try{return await le(await e(t,n),r)}catch(e){return{error:e instanceof Error?e.message:r}}}var G=e=>e===void 0?U.host:U.workspace(e);async function ue(e,t){return await W(e,G(t).view.url(),{},`Your plugins could not be read.`)}async function K(e,t,n,r){let i=G(r)[t];return await W(e,i.url(),{method:i.spec.method,headers:se,body:JSON.stringify(n)},`The change could not be saved.`)}async function de(e,t){let n=U.host.previewUpload;return await W(e,n.url(),{method:n.spec.method,headers:ce,body:t},`Po could not read the archive.`)}async function fe(e,t,n,r){let i=U.host.installUpload;return await W(e,i.url({query:{...n.length>0?{[oe]:n.join(`,`)}:{},...r?{[V]:r}:{}}}),{method:i.spec.method,headers:ce,body:t},`The plugin could not be added.`)}var q=`standalone plugins`;function J(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function pe(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 Y({label:t,children:n}){return h(ee,{children:[d(ne,{asChild:!0,children:d(e,{variant:`ghost`,size:`icon`,"aria-label":t,children:d(ie,{"aria-hidden":!0,className:`size-4`})})}),d(te,{align:`end`,children:n})]})}var X=5;function Z({label:t,names:n}){let[r,o]=z(0),s=Math.ceil(n.length/X),c=r*X,l=n.slice(c,c+X);return h(a,{children:[l.map((e,t)=>h(T,{children:[t>0?`, `:``,d(`span`,{className:`font-mono whitespace-nowrap`,children:e})]},e)),s>1?h(`span`,{className:`ml-2 inline-flex items-center gap-1 align-middle whitespace-nowrap`,children:[d(e,{variant:`ghost`,size:`icon`,"aria-label":`Previous ${t}`,disabled:r===0,onClick:()=>o(r-1),children:d(i,{"aria-hidden":!0,className:`size-3.5 rotate-180`})}),d(`span`,{className:`tabular-nums`,children:`${String(c+1)}-${String(c+l.length)} of ${String(n.length)}`}),d(e,{variant:`ghost`,size:`icon`,"aria-label":`Next ${t}`,disabled:r===s-1,onClick:()=>o(r+1),children:d(i,{"aria-hidden":!0,className:`size-3.5`})})]}):null]})}function me({plugin:e}){return h(a,{children:[d(L,{children:e.skills.length>0?h(a,{children:[`Skills: `,d(Z,{label:`skills of ${e.name}`,names:e.skills})]}):`No skills`}),h(L,{children:[e.mcpServers.length>0?h(a,{children:[`MCP servers: `,d(Z,{label:`MCP servers of ${e.name}`,names:e.mcpServers})]}):`No MCP servers`,e.hooks>0?`. ${J(e.hooks,`hook`)}, which Po does not run`:``]})]})}function he({plugin:t,domain:n,onToggle:r,onRemoveFromDomain:i,onDeletePlugin:o}){let s=`plugin-switch-${t.name}`,c=t.domains.filter(e=>e!==n);return d(M,{asChild:!0,className:`items-start`,children:h(`li`,{children:[h(F,{children:[h(N,{className:`flex items-baseline gap-2 first-letter:normal-case`,children:[d(`label`,{htmlFor:s,className:`font-mono`,children:t.name}),t.version?d(`span`,{className:`font-mono text-sm font-normal text-po-dim`,children:t.version}):null]}),t.description?d(L,{children:t.description}):null,t.missing?h(L,{children:[`Not downloaded yet, so its skills and servers are unknown. Run `,d(`span`,{className:`font-mono`,children:`po sync`}),` `,`to fetch it.`]}):d(me,{plugin:t}),h(L,{children:[pe(t),`.`,c.length>0?h(a,{children:[` `,`Also in `,d(`span`,{className:`font-mono`,children:c.join(`, `)}),`.`]}):null,t.enabled?t.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:[d(u,{id:s,checked:t.enabled,onCheckedChange:e=>r(t.name,e)}),n?d(e,{variant:`outline`,size:`sm`,onClick:()=>i(t.name,n),children:`Remove from ${n}`}):null,t.deletable?d(Y,{label:`More for ${t.name}`,children:d(re,{variant:`destructive`,onSelect:()=>o(t.name),children:`Delete plugin`})}):null]})]})})}function Q({title:e,children:t}){return d(I,{asChild:!0,children:d(`ul`,{children:d(M,{asChild:!0,children:d(`li`,{children:h(F,{children:[d(N,{children:e}),d(L,{children:t})]})})})})})}function ge({status:t,onRetry:n}){return t.kind===`error`?d(I,{asChild:!0,children:d(`ul`,{children:d(M,{asChild:!0,role:`alert`,children:h(`li`,{children:[h(F,{children:[d(N,{children:`Po couldn't read your plugins just now`}),d(L,{children:t.error})]}),d(e,{variant:`outline`,size:`sm`,onClick:n,children:`Try again`})]})})})}):d(Q,{title:`Reading your plugins`,children:`This takes a moment.`})}function $({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:[d(`h3`,{className:`text-lg font-semibold text-po-hi`,children:e}),d(`p`,{className:`text-sm text-po-dim`,children:t})]}),n?d(`div`,{className:`flex shrink-0 items-center gap-1`,children:n}):null]})}function _e({status:t,domains:r,plugins:i,selected:o,onSelect:s,onUpload:l,onRetry:u,onNewDomain:f,onAddPlugins:p,onDeleteDomain:m,notice:g,..._}){let v=t.kind===`ready`,y=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:[d(`span`,{className:`text-sm text-po-dim tabular-nums`,children:v&&i.length>0?J(i.length,`plugin`):``}),l?h(e,{variant:`primary`,size:`sm`,onClick:l,disabled:!v,children:[d(P,{"aria-hidden":!0,className:`size-3.5`}),`Upload plugin`]}):null]}),g?d(`p`,{role:`alert`,className:`text-sm text-po-red`,children:g}):null,v?h(n,{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:[d(`span`,{className:`px-2 text-sm font-semibold text-po-dim`,children:`Domains`}),h(c,{"aria-label":`Plugin groups`,className:`flex-col items-stretch`,children:[r.map(e=>h(S,{value:e.name,className:`justify-between font-mono`,children:[e.name,d(`span`,{className:`font-sans text-sm tabular-nums`,children:i.filter(t=>t.domains.includes(e.name)).length})]},e.name)),h(S,{value:q,className:`mt-3 justify-between`,children:[`Standalone`,d(`span`,{className:`text-sm tabular-nums`,children:y.length})]})]}),h(e,{variant:`ghost`,size:`sm`,className:`justify-start`,onClick:f,children:[d(P,{"aria-hidden":!0,className:`size-3.5`}),`New domain`]})]}),r.map(t=>{let n=i.filter(e=>e.domains.includes(t.name));return h(w,{value:t.name,className:`flex min-w-0 flex-col gap-4`,children:[d($,{title:d(`span`,{className:`font-mono`,children:t.name}),detail:`${t.description?`${t.description.replace(/[.!?]\s*$/u,``)}. `:``}These plugins load only in sessions that pick ${t.name}.`,actions:h(a,{children:[h(e,{variant:`primary`,size:`sm`,onClick:()=>p(t.name),children:[d(P,{"aria-hidden":!0,className:`size-3.5`}),`Add plugins`]}),d(Y,{label:`More for domain ${t.name}`,children:d(re,{variant:`destructive`,onSelect:()=>m(t.name),children:`Delete domain`})})]})}),n.length>0?d(I,{asChild:!0,children:d(`ul`,{"aria-label":`Plugins in ${t.name}`,children:n.map(e=>d(he,{plugin:e,domain:t.name,..._},e.name))})}):d(Q,{title:`No plugins in ${t.name} yet`,children:`Add plugins you already have, or upload a new one.`})]},t.name)}),h(w,{value:q,className:`flex min-w-0 flex-col gap-4`,children:[d($,{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.`}),y.length>0?d(I,{asChild:!0,children:d(`ul`,{"aria-label":`Standalone plugins`,children:y.map(e=>d(he,{plugin:e,..._},e.name))})}):d(Q,{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.`})]})]}):d(ge,{status:t,onRetry:u})]})}function ve({open:t,domain:n,candidates:r,selected:i,onOpenChange:o,onToggle:c,onSubmit:l}){return d(E,{open:t,onOpenChange:o,children:h(f,{width:`md`,"aria-describedby":`add-plugins-description`,children:[d(D,{dismissible:!0,closeLabel:`Close`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[h(k,{children:[`Add plugins to `,d(`span`,{className:`font-mono`,children:n})]}),h(R,{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(),l()},children:[d(s,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:r.length>0?d(`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:[d(x,{id:t,className:`mt-0.5`,checked:i.includes(e.name),onCheckedChange:t=>c(e.name,t===!0)}),h(`div`,{className:`flex min-w-0 flex-col items-start gap-0.5`,children:[h(A,{htmlFor:t,className:`flex items-baseline gap-2 font-normal`,children:[d(`span`,{className:`font-mono text-base text-po-text`,children:e.name}),e.version?d(`span`,{className:`font-mono text-sm text-po-dim`,children:e.version}):null]}),e.description?d(`span`,{className:`text-sm text-po-dim`,children:e.description}):null,d(me,{plugin:e}),d(`span`,{className:`text-sm text-po-dim`,children:e.domains.length>0?h(a,{children:[`Already in `,d(`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(O,{variant:`bar`,children:[d(`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:[d(e,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:`Cancel`}),d(e,{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:o,onDescriptionChange:c,onSubmit:l}){return d(E,{open:t,onOpenChange:a,children:h(f,{width:`sm`,"aria-describedby":`new-domain-description`,children:[d(D,{dismissible:!0,closeLabel:`Close`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[d(k,{children:`New domain`}),d(R,{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(),l()},children:[h(s,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[h(`div`,{className:`flex flex-col gap-1.5`,children:[d(A,{htmlFor:`new-domain-name`,children:`Name`}),d(B,{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=>o(e.target.value)}),d(`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:[d(A,{htmlFor:`new-domain-description-input`,children:`Description`}),d(B,{id:`new-domain-description-input`,value:r,placeholder:`Drafting and editing long-form text`,"aria-describedby":`new-domain-description-hint`,onChange:e=>c(e.target.value)}),d(`p`,{id:`new-domain-description-hint`,className:`text-sm text-po-dim`,children:`Optional. Shown when someone picks a domain for a session.`})]})]}),d(O,{variant:`bar`,className:`justify-end`,children:h(`div`,{className:`flex shrink-0 items-center gap-2 py-1.5`,children:[d(e,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:`Cancel`}),d(e,{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:[d(`legend`,{className:`mb-1 text-base font-semibold text-po-hi`,children:`Domains`}),d(`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?d(`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:[d(x,{id:n,className:`mt-0.5`,checked:t.includes(e.name),onCheckedChange:t=>i(e.name,t===!0)}),h(A,{htmlFor:n,className:`flex min-w-0 flex-col items-start gap-0.5 font-normal`,children:[d(`span`,{className:`font-mono text-base text-po-text`,children:e.name}),e.description?d(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]})]},e.name)})}):d(`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:[d(A,{htmlFor:`domain-picker-new`,children:`New domain`}),d(B,{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)}),d(`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:[d(j,{"aria-hidden":!0,className:`size-6 text-po-dim`}),d(`span`,{className:`text-base font-semibold text-po-hi`,children:`Drop a .zip here, or choose a file`}),d(`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.`}),d(`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,` `,d(`span`,{className:`font-normal text-po-dim tabular-nums`,children:t.length})]}),t.length>0?d(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>d(`li`,{className:`truncate font-mono text-sm text-po-text`,children:e},e))}):d(`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:[d(`span`,{className:`font-mono text-base font-semibold text-po-hi`,children:e.name}),e.version?d(`span`,{className:`font-mono text-sm text-po-dim`,children:e.version}):null]}),e.description?d(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]}),h(`div`,{className:`grid grid-cols-2 gap-4`,children:[d(we,{title:`Skills`,names:e.skills,empty:`None`}),d(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:o,onToggleDomain:c,onNewDomainChange:l,onChooseAgain:u,onSubmit:p}){return d(E,{open:t,onOpenChange:i,children:h(f,{width:`lg`,"aria-describedby":`upload-plugin-description`,children:[d(D,{dismissible:!0,closeLabel:`Close upload`,children:h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[d(k,{children:`Upload a plugin`}),d(R,{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(),p()},children:[h(s,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[n.kind===`choose`?d(Ce,{onFile:o}):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:[d(g,{className:`size-4`}),h(`span`,{children:[`Reading `,d(`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 `,d(`span`,{className:`font-mono`,children:n.fileName})]}),d(`span`,{className:`text-sm text-po-text`,children:n.reason})]}):null,n.kind===`preview`?h(a,{children:[d(Te,{plugin:n.plugin}),d(be,{domains:r,selected:n.selected,newDomain:n.newDomain,newDomainError:n.newDomainError,onToggle:c,onNewDomainChange:l})]}):null]}),h(O,{variant:`bar`,children:[d(`span`,{className:`min-w-0 truncate text-sm text-po-dim`,children:n.kind===`preview`?h(a,{children:[`Saved to `,d(`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:[d(e,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:`Cancel`}),n.kind===`invalid`?d(e,{type:`button`,variant:`outline`,size:`sm`,onClick:u,children:`Choose another file`}):d(e,{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[i,o]=z({kind:`loading`}),[s,c]=z(De),[u,f]=z(q),[m,g]=z(),[_,v]=z(),[y,b]=z(),[x,S]=z({open:!1,step:{kind:`choose`}}),C=p(void 0),w=r(async()=>{let t=await ue(e,n);`error`in t?o({kind:`error`,error:t.error}):(c(t.value),o({kind:`ready`}),f(e=>e!==`standalone plugins`||t.value.domains.length===0?e:t.value.domains[0].name))},[e,n]);l(()=>{w()},[w]);let T=e=>`error`in e?(g(e.error),!1):(c(e.value),g(void 0),!0),E=async(e,r)=>T(await K(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 de(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 fe(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`}}),f(e.selected[0]??r??`standalone plugins`))},A=async()=>{if(!y)return;let e=y.name.trim(),r=await K(t,`createDomain`,{name:e,...y.description.trim()?{description:y.description.trim()}:{}},n);`error`in r?b({...y,error:r.error}):(T(r),b(void 0),f(e))},j=_?.domain??``;return h(a,{children:[d(_e,{status:i,domains:s.domains,plugins:s.plugins,selected:u,notice:m,onSelect:f,onRetry:()=>{o({kind:`loading`}),w()},...n===void 0?{onUpload:()=>{C.current=void 0,S({open:!0,step:{kind:`choose`}})}}:{},onNewDomain:()=>b({name:``,description:``}),onToggle:(e,t)=>void E(`toggle`,{plugin:e,enabled:t}),onAddPlugins:e=>v({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&&f(q)})}}),d(ve,{open:_!==void 0,domain:j,candidates:s.plugins.filter(e=>!e.domains.includes(j)),selected:_?.selected??[],onOpenChange:e=>{e||v(void 0)},onToggle:(e,t)=>v(n=>n&&{...n,selected:t?[...n.selected,e]:n.selected.filter(t=>t!==e)}),onSubmit:()=>{_&&_.selected.length!==0&&E(`addToDomain`,{domain:_.domain,plugins:_.selected}).then(e=>{e&&v(void 0)})}}),d(ye,{open:y!==void 0,name:y?.name??``,description:y?.description??``,nameError:y?y.error??Oe(y.name,s):void 0,onOpenChange:e=>{e||b(void 0)},onNameChange:e=>b(t=>t&&{...t,name:e,error:void 0}),onDescriptionChange:e=>b(t=>t&&{...t,description:e}),onSubmit:()=>void A()}),d(Ee,{open:x.open,step:x.step,domains:s.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,s);return{...t,newDomain:e,...n?{newDomainError:n}:{newDomainError:void 0}}}),onChooseAgain:()=>S({open:!0,step:{kind:`choose`}}),onSubmit:()=>void k()})]})}var Ae=m({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:C,order:0,menuGroup:`general`,component:ke}),je=_({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?d(ke,{request:t,requestWithStepUp:n,workspaceId:e.id},e.id):null}),Me=v({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=o({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,7 +0,0 @@
1
- import{Ft as e,Ga as t,Ha as n,It as r,Lr as i,Lt as a,Mi as o,Ni as s,Xr as c,_n as l,gn as u,hn as d,mn as f}from"../chunks/po-web-runtime-D8FIos2q.js";var p=/^([+\- ])( *\d*) (.*)$/u,m=` `;function h(e){let t=Array.isArray(e.edits)?e.edits.length:0;return{path:typeof e.path==`string`?e.path:``,ranges:`${t} ${t===1?`range`:`ranges`}`}}function g(e){return e===`+`||e===`-`?e:m}function _(e){return e.split(`
2
- `).map(e=>{let t=e.replaceAll(` `,` `),n=p.exec(t);return n?{marker:g(n[1]),lineNumber:(n[2]??``).trim(),content:n[3]??``}:{marker:m,lineNumber:``,content:t}})}function v(e){let t=e?.details;if(typeof t!=`object`||!t)return;let n=t.diff;if(typeof n!=`string`||n.length===0)return;let r=_(n);return{rows:r,gutter:r.reduce((e,t)=>Math.max(e,t.lineNumber.length),1)}}function y(e,t){let n=(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(`
3
- `)).replaceAll(` `,` `).replaceAll(`\r
4
- `,`
5
- `).split(`
6
- `);for(;n.at(-1)===``;)n.pop();return n}var b={"+":`bg-po-tint-green text-po-green`,"-":`bg-po-tint-red text-po-red`," ":`text-po-dim`};function x({rows:t,gutter:n,path:o}){let c=s(t.map(e=>e.content).join(`
7
- `),{path:o});return r(e,{children:t.map((e,t)=>a(`span`,{className:`flex gap-2 ${b[e.marker]}`,children:[r(`span`,{className:`shrink-0 text-right text-po-faint`,style:{width:`${String(n)}ch`},children:e.lineNumber}),r(`span`,{className:`w-2 shrink-0`,children:e.marker===` `?``:e.marker}),r(i,{spans:c?.[t],text:e.content,className:`min-w-0 whitespace-pre-wrap break-words`})]},`${String(t)}-${e.lineNumber}`))})}function S({args:t,result:n,output:i,running:s,isError:p,fileTabFor:m,openTransientTab:g}){let _=h(t),b=n===null||p?void 0:v(n),S=m(_.path);return r(f,{tone:o({running:s,isError:p}),expandable:!0,children:({expanded:t})=>a(e,{children:[r(u,{title:`edit`,children:a(`span`,{"data-testid":`tool-call-edit`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[r(c,{path:_.path,...S===void 0?{}:{onOpen:()=>g(S)}}),a(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,_.ranges]})]})}),t?p?a(d,{"data-testid":`tool-result-edit`,className:`flex flex-col`,children:[r(l,{tone:`error`,children:`failed`}),y(n,i).map((e,t)=>r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:e},`${String(t)}-${e}`))]}):b===void 0?s?r(d,{"data-testid":`tool-result-edit`,children:r(l,{tone:`running`,children:`running`})}):null:r(d,{"data-testid":`tool-result-edit`,className:`flex flex-col font-mono`,children:r(x,{rows:b.rows,gutter:b.gutter,path:_.path})}):null]})})}var C=n({message:S}),w=(e,t)=>t===void 0?void 0:{...e,...t},T=t({id:`edit`,packageName:`@agimon-ai/po-edit`,session:{get toolRenderers(){return[w({tools:[`edit`]},C)]}}});export{T as webPlugin};
@@ -1,2 +0,0 @@
1
- import{$r as e,At as t,Bt as n,Ci as r,Ft as i,Ga as a,Gi as o,Ht as s,Ia as c,Ii as l,It as u,Ki as d,Kn as f,Kt as p,Lt as m,Oa as h,Pt as g,Qa as _,Qi as v,Sa as y,Ta as b,Wi as x,Xi as S,Yi as C,Yr as ee,Zi as w,ci as T,cr as te,ea as ne,fn as E,hi as D,ki as re,na as ie,oa as ae,qi as O,qt as k,ra as A,rn as oe,un as se,xi as ce}from"../chunks/po-web-runtime-D8FIos2q.js";var le=`file_edits`;function j(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function M(e){return j(e)&&typeof e.path==`string`&&typeof e.relPath==`string`&&typeof e.tool==`string`&&typeof e.at==`number`&&typeof e.count==`number`}function N(e){return!j(e)||!Array.isArray(e.items)?null:{items:e.items.filter(M)}}var P=c({items:[],detail:{},loading:[],errors:{},comments:[]}),F=P.channel({channel:le,parse:N,reduce:(e,{items:t})=>({...e,items:t})});function ue(e,t){P.update(e,e=>e.loading.includes(t)?e:{...e,loading:[...e.loading,t],errors:L(e.errors,t)})}function de(e,t){P.update(e,e=>({...e,detail:{...e.detail,[t.path]:t},loading:e.loading.filter(e=>e!==t.path),errors:L(e.errors,t.path)}))}function I(e,t,n){P.update(e,e=>({...e,loading:e.loading.filter(e=>e!==t),errors:{...e.errors,[t]:n}}))}function fe(e,t){P.update(e,e=>({...e,comments:[...e.comments,t]}))}function pe(e,t){P.update(e,e=>({...e,comments:e.comments.filter(e=>e.id!==t)}))}function me(e,t){P.update(e,e=>({...e,comments:e.comments.filter(e=>e.path!==t)}))}function L(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}var R=b(F),z=y({detail:{method:`GET`,path:`/detail`,query:[`path`],response:void 0},preview:{method:`GET`,path:`/preview`,query:[`path`],response:void 0},save:{method:`PUT`,path:`/content`,response:void 0},remove:{method:`DELETE`,path:`/content`,query:[`path`]},file:{method:`GET`,path:`/file`,raw:!0,query:[`path`],host:!0}},{scopes:[`session`],basePath:`file-edits`,transport:(e,n)=>t.fetch(e,n),sessionAddress:_}),B=`path`,V=`The session is unreachable.`;function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e,t){return z.session(e).file.url({query:{[B]:t}})}function W(e){return e.status===0?V:e.error===``?`The session answered ${e.status}.`:e.error}async function he(e,t){let n=await z.session(e).detail({query:{[B]:t}});return n.ok?H(n.data)?{ok:!0,detail:n.data}:{ok:!1,error:`The session answered with no detail.`}:{ok:!1,error:W(n)}}async function G(e,t){let n=await z.session(e).preview({query:{[B]:t}});return n.ok?H(n.data)?{ok:!0,preview:n.data}:{ok:!1,error:`The session answered with no file.`}:{ok:!1,error:W(n)}}async function ge(e,t,n,r){let i=await z.session(e).save({body:{path:t,expectedHash:n,content:r}});if(i.status===409){let e=i.ok?void 0:i.data,t=H(e)&&typeof e.hash==`string`?e.hash:void 0;return{ok:!1,stale:!0,error:i.ok?`The file changed since it was opened.`:W(i),...t===void 0?{}:{hash:t}}}return i.ok?{ok:!0,hash:H(i.data)&&typeof i.data.hash==`string`?i.data.hash:``}:{ok:!1,stale:!1,error:W(i)}}async function _e(e,t){let n=await z.session(e).remove({query:{[B]:t}});return n.ok?{ok:!0}:{ok:!1,error:W(n)}}function K(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function q(e){let t=e.replaceAll(/[^a-zA-Z0-9]+/gu,`-`).replace(/^-|-$/gu,``);return`files-file-${K(e)}-${t.slice(-40)}`}var J={edit:`edit`,write:`write`,bash:`command`,user:`you`};function ve(e,t){if(r(e)!==`download`)return`media`;if(t)return`unavailable`;let n=e.toLowerCase();return n.endsWith(`.md`)||n.endsWith(`.markdown`)?`markdown`:n.endsWith(`.html`)||n.endsWith(`.htm`)?`html`:D(e)===void 0?`text`:`code`}function ye(e,t){try{e({type:`follow_up`,message:T(t)});return}catch(e){return e instanceof Error?e.message:String(e)}}function be({relPath:t,open:n,onConfirm:r,onCancel:i}){return u(x,{open:n,onOpenChange:e=>{e||i()},children:m(d,{width:`sm`,"data-testid":`files-delete-dialog`,"aria-describedby":void 0,children:[u(S,{children:u(w,{children:`delete file`})}),m(o,{children:[m(O,{children:[`this removes `,u(`span`,{className:`font-semibold text-po-hi`,children:t}),` from disk. the session keeps its record of the change, but the file itself is gone.`]}),m(C,{children:[u(e,{variant:`outline`,size:`md`,"data-testid":`files-delete-cancel`,autoFocus:!0,onClick:i,children:`cancel`}),u(e,{variant:`danger`,size:`md`,"data-testid":`files-delete-confirm`,onClick:r,children:`delete`})]})]})]})})}function xe({src:e,path:n,"data-testid":r}){let[i,a]=k();s(()=>{if(e===``)return;let n=new AbortController,r;return(async()=>{let i=await t.fetch(e,{signal:n.signal,cache:`no-store`});if(!i.ok)throw Error(`Media could not be loaded (${i.status}).`);let o=await i.blob();n.signal.aborted||(r=URL.createObjectURL(o),a({source:e,url:r,contentType:(i.headers.get(`content-type`)??o.type).split(`;`,1)[0]?.trim().toLowerCase()??``}))})().catch(t=>{n.signal.aborted||a({source:e,error:t instanceof Error?t.message:String(t)})}),()=>{n.abort(),r!==void 0&&URL.revokeObjectURL(r)}},[e]);let o=i?.source===e?i:void 0;return o?.url===void 0?u(`p`,{role:o?.error?`alert`:`status`,children:o?.error??`Loading media...`}):u(E,{src:o.url,path:n,contentType:o.contentType,"data-testid":r})}async function Se(e,n,r){if(e===null)throw Error(`The session is unavailable.`);let i=n.slice(0,n.lastIndexOf(`/`)+1),a=r.startsWith(`/`)?r:`${i}${r}`,o=await t.fetch(U(e,a),{cache:`no-store`});if(!o.ok)throw Error(`Image could not be loaded (${o.status}).`);let s=URL.createObjectURL(await o.blob());return{url:s,dispose:()=>URL.revokeObjectURL(s),path:a}}function Ce(e){let t=new Date(e.at).toLocaleTimeString(),n=e.hunks===void 0?``:` +${e.additions} -${e.removals}`;return`${t} · ${J[e.tool]??e.tool}${n}`}function we(t){let{filePath:r,relPath:a,sessionId:o,sendSessionFrame:c,closeTransientTab:d}=t,h=g(P.store,e=>P.select(e,o)),_=h.detail[r],y=h.errors[r],b=h.loading.includes(r),x=h.comments.filter(e=>e.path===r),[S,C]=k(`preview`),[w,T]=k(void 0),[E,D]=k(void 0),[O,le]=k(void 0),[j,M]=k(!1),[N,F]=k(void 0),[L,R]=k(!1),[z,B]=k(void 0),V=p(void 0),H=h.items.find(e=>e.path===r)?.count??0;s(()=>{if(o===null)return;let e=!1;return ue(o,r),he(o,r).then(t=>{e||(t.ok?(de(o,t.detail),D(void 0),F(void 0)):I(o,r,t.error))}),()=>{e=!0}},[o,r,H]);let W=_?.working,G=a===`..`||a.startsWith(`../`)||a.startsWith(`/`),K=E??W?.content??``,J=ve(a,W?.unavailable===!0),we=n(e=>Se(o,a,e),[o,a]),Y=o===null?``:U(o,a),X=e=>{T(e)},Z=()=>{let e=V.current;e!==void 0&&e.text.trim()!==``&&X({snippet:e.text,startLine:e.startLine,endLine:e.endLine})},Te=e=>{o!==null&&w!==void 0&&(fe(o,{id:`${r}:${w.side??`new`}:${w.startLine??0}:${x.length}:${e.length}`,path:r,relPath:a,...w.side===void 0?{}:{side:w.side},...w.startLine===void 0?{}:{startLine:w.startLine},...w.endLine===void 0?{}:{endLine:w.endLine},snippet:w.snippet,body:e}),T(void 0))},Ee=()=>{if(o===null||x.length===0)return;let e=ye(e=>c(o,e),x);B(e),e===void 0&&me(o,r)},Q=async()=>{if(o===null)return;R(!1);let e=await _e(o,r);e.ok?d(q(r)):I(o,r,e.error)},$=async()=>{if(o===null||W===void 0||E===void 0)return;M(!0);let e=await ge(o,r,W.hash,E);if(M(!1),e.ok){F(`saved`),D(void 0),ue(o,r);let e=await he(o,r);e.ok?de(o,e.detail):I(o,r,e.error)}else F(e.error)};return m(`div`,{"data-testid":`files-file-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[m(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2`,children:[u(ee,{path:a,"data-testid":`files-breadcrumb`,className:`min-w-0 flex-1`}),S===`edit`?u(te,{tone:`neutral`,"data-testid":`files-editing`,className:`shrink-0 `,children:`editing`}):null,_===void 0?null:m(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[`+`,_.cumulative.additions,` -`,_.cumulative.removals]}),u(`nav`,{className:`flex shrink-0 items-center gap-1`,children:[`preview`,`diff`].map(t=>u(e,{variant:S===t?`outline`:`ghost`,size:`xs`,"data-testid":`files-view-${t}`,onClick:()=>C(t),className:``,children:t},t))}),m(ne,{children:[u(ae,{asChild:!0,children:u(e,{variant:`ghost`,size:`icon`,"data-testid":`files-menu`,title:`file actions`,className:`shrink-0 text-po-faint hover:text-po-hi`,children:u(oe,{className:`h-3 w-3`})})}),m(ie,{"data-testid":`files-menu-list`,children:[u(A,{"data-testid":`files-edit`,disabled:G||W?.unavailable===!0,onSelect:()=>C(`edit`),children:`edit`}),u(A,{variant:`destructive`,"data-testid":`files-delete`,disabled:G||W?.unavailable===!0,onSelect:()=>R(!0),children:`delete`}),u(A,{"data-testid":`files-close`,onSelect:()=>d(q(r)),children:`close`})]})]})]}),u(be,{relPath:a,open:L,onConfirm:()=>void Q(),onCancel:()=>R(!1)}),b&&_===void 0?u(`p`,{"data-testid":`files-loading`,className:`px-4 py-3 text-sm text-po-dim`,children:`reading this file's history…`}):null,y===void 0?null:u(`p`,{"data-testid":`files-error`,className:`px-4 py-3 text-sm text-po-red`,children:y}),u(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:_===void 0?null:S===`diff`?m(`div`,{className:`flex flex-col`,children:[_.cumulative.note===void 0?null:u(`p`,{"data-testid":`files-cumulative-note`,className:`px-4 py-2 text-sm text-po-yellow`,children:_.cumulative.note}),_.cumulative.hunks===void 0?null:u(v,{hunks:_.cumulative.hunks,testId:`files-cumulative-diff`,onSelect:e=>X(e)}),m(`section`,{className:`mt-2 border-t border-po-border`,children:[m(`h2`,{className:`px-4 py-2 text-lg font-semibold text-po-hi `,children:[_.versions.length,` `,_.versions.length===1?`change`:`changes`,` this session`]}),_.versions.map(t=>m(`article`,{"data-testid":`files-version-${t.index}`,children:[u(e,{variant:`ghost`,size:`card`,"data-testid":`files-version-toggle-${t.index}`,onClick:()=>le(O===t.index?void 0:t.index),className:`w-full gap-2 rounded-none px-4 py-1.5 hover:bg-po-panel`,children:m(`span`,{className:`flex w-full min-w-0 items-center gap-2`,children:[m(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[`#`,t.index]}),u(`span`,{className:`min-w-0 flex-1 truncate text-left text-base text-po-text`,children:Ce(t)}),t.origin===`scan`?u(te,{tone:`neutral`,className:`shrink-0 `,children:`no baseline`}):null,u(`span`,{className:`shrink-0 text-sm text-po-dim`,children:O===t.index?`▾`:`▸`})]})}),O===t.index?t.hunks===void 0?u(`p`,{className:`px-4 py-1.5 text-sm text-po-dim`,children:t.note??`nothing to show`}):u(v,{hunks:t.hunks,testId:`files-version-diff-${t.index}`,onSelect:e=>X(e)}):null]},t.index))]})]}):S===`edit`?u(`div`,{className:`flex h-full flex-col gap-2 p-3`,children:W?.unavailable===!0?u(`p`,{"data-testid":`files-source-unavailable`,className:`text-sm text-po-dim`,children:W.reason??`this file cannot be shown`}):m(i,{children:[u(`div`,{className:`min-h-[24rem] flex-1`,onMouseUp:Z,onKeyUp:e=>{e.shiftKey&&Z()},children:u(l,{"data-testid":`files-source`,value:K,path:a,onChange:D,onSelect:e=>{V.current=e},className:`h-full rounded border border-po-border`})}),m(`div`,{className:`flex shrink-0 items-center gap-2`,children:[u(e,{variant:`outline`,size:`xs`,"data-testid":`files-save`,loading:j,disabled:E===void 0||j,onClick:()=>void $(),className:``,children:`save to disk`}),E===void 0?null:u(e,{variant:`ghost`,size:`xs`,"data-testid":`files-revert`,onClick:()=>D(void 0),className:``,children:`discard edits`}),N===void 0?null:u(`span`,{"data-testid":`files-save-note`,className:N===`saved`?`text-sm text-po-green`:`text-sm text-po-red`,children:N})]})]})}):m(`div`,{"data-testid":`files-preview`,"data-mode":J,className:J===`code`?`flex h-full flex-col gap-2 p-4 text-base text-po-text`:`flex flex-col gap-2 p-4 text-base text-po-text`,onMouseUp:()=>{if(J===`code`){Z();return}let e=globalThis.getSelection?.()?.toString()??``;e.trim()!==``&&X({snippet:e})},children:[J===`unavailable`?u(`p`,{"data-testid":`files-preview-unavailable`,className:`text-sm text-po-dim`,children:W?.reason??`this file cannot be shown`}):null,J===`media`||J===`unavailable`?u(xe,{src:Y,path:a,"data-testid":`files-preview-media`}):J===`markdown`?u(se,{text:K,loadImage:we,documentPath:a,renderMediaReview:ce(t)}):J===`html`?u(`iframe`,{"data-testid":`files-preview-html`,title:a,sandbox:``,srcDoc:K,className:`h-[36rem] w-full rounded border border-po-border bg-po-deep`}):J===`code`?u(l,{"data-testid":`files-preview-code`,value:K,path:a,readOnly:!0,onSelect:e=>{V.current=e},className:`min-h-[24rem] flex-1 rounded border border-po-border`}):u(`pre`,{"data-testid":`files-preview-text`,className:`whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text`,children:K})]})}),w===void 0?null:u(f,{testIdPrefix:`files-comment`,snippet:w.snippet,...w.side===void 0?{}:{side:w.side},...w.startLine===void 0?{}:{startLine:w.startLine},...w.endLine===void 0?{}:{endLine:w.endLine},onSubmit:Te,onCancel:()=>T(void 0)}),x.length===0?null:m(`footer`,{"data-testid":`files-review`,className:`shrink-0 border-t border-po-border px-3 py-2`,children:[m(`div`,{className:`flex items-center gap-2 pb-1`,children:[m(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:[x.length,` `,x.length===1?`comment`:`comments`]}),u(e,{variant:`outline`,size:`xs`,"data-testid":`files-send-review`,onClick:Ee,className:``,children:`send review`})]}),z===void 0?null:m(`p`,{role:`alert`,"data-testid":`files-review-error`,className:`pb-1 text-sm text-po-red`,children:[`review not sent: `,z]}),x.map(t=>m(`div`,{"data-testid":`files-review-comment`,className:`flex items-start gap-2 py-0.5`,children:[u(`span`,{className:`shrink-0 text-sm text-po-dim`,children:re(t)}),u(`span`,{className:`min-w-0 flex-1 truncate text-base text-po-text`,children:t.body}),u(e,{variant:`ghost`,size:`xs`,"data-testid":`files-review-remove`,onClick:()=>{o!==null&&pe(o,t.id)},className:`shrink-0 `,children:`remove`})]},t.id))]})]})}function Y(e,t){return{id:q(e),label:t.split(`/`).at(-1)??t,panel:n=>u(we,{...n,filePath:e,relPath:t})}}function X(t){let{filePath:r,sessionId:i,closeTransientTab:a}=t,[o,c]=k(void 0);s(()=>{if(i===null)return;let e=!1;return G(i,r).then(t=>{e||c(t.ok?{sessionId:i,path:r,preview:t.preview}:{sessionId:i,path:r,error:t.error})}),()=>{e=!0}},[i,r]);let d=o?.path===r&&o.sessionId===i?o:void 0,f=d?.preview,p=d?.error,h=f?.relPath??r,g=f?.working,_=g?.content??``,v=ve(h,g?.unavailable===!0),y=n(e=>Se(i,h,e),[i,h]),b=i===null?``:U(i,h);return m(`div`,{"data-testid":`files-preview-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[m(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2`,children:[u(ee,{path:h,"data-testid":`files-preview-breadcrumb`,className:`min-w-0 flex-1`}),u(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`unchanged`}),u(e,{variant:`ghost`,size:`xs`,"data-testid":`files-preview-close`,onClick:()=>a(Z(r)),className:`shrink-0 `,children:`close`})]}),p===void 0?null:u(`p`,{"data-testid":`files-preview-error`,className:`px-4 py-3 text-sm text-po-red`,children:p}),f===void 0&&p===void 0?u(`p`,{"data-testid":`files-preview-loading`,className:`px-4 py-3 text-sm text-po-dim`,children:`reading this file…`}):null,f===void 0?null:u(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m(`div`,{"data-testid":`files-preview`,"data-mode":v,className:`flex h-full flex-col gap-2 p-4 text-base text-po-text`,children:[v===`unavailable`?u(`p`,{"data-testid":`files-preview-unavailable`,className:`text-sm text-po-dim`,children:g?.reason??`this file cannot be shown`}):null,v===`media`||v===`unavailable`?u(xe,{src:b,path:h,"data-testid":`files-preview-media`}):v===`markdown`?u(se,{text:_,loadImage:y,documentPath:h,renderMediaReview:ce(t)}):v===`html`?u(`iframe`,{"data-testid":`files-preview-html`,title:h,sandbox:``,srcDoc:_,className:`h-[36rem] w-full rounded border border-po-border bg-po-deep`}):v===`code`?u(l,{"data-testid":`files-preview-code`,value:_,path:h,readOnly:!0,className:`min-h-[24rem] flex-1 rounded border border-po-border`}):u(`pre`,{"data-testid":`files-preview-text`,className:`whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text`,children:_})]})})]})}function Z(e){return`${q(e)}-preview`}function Te(e){return{id:Z(e),label:e.split(`/`).at(-1)??e,panel:t=>u(X,{...t,filePath:e})}}var Ee=/:\d+(?::\d+)?$/;function Q(e){return P.select(P.store.state,e).items}function $(e,t){let n=t.trim().replace(Ee,``);if(n!==``)return Q(e).find(e=>e.relPath===n||e.path===n)}var De=h({subscribe(e){let t=P.store.subscribe(e);return()=>t.unsubscribe()},fingerprint:e=>Q(e).map(e=>e.relPath).join(`
2
- `),resolve:(e,t)=>{let n=$(e,t);return n===void 0?void 0:Y(n.path,n.relPath)},openPath:(e,t)=>{let n=$(e,t);if(n!==void 0)return Y(n.path,n.relPath);let r=t.trim();return r===``||r.startsWith(`artifact:`)?void 0:Te(r)}}),Oe=(e,t)=>t===void 0?void 0:{...e,...t},ke=a({id:`files`,packageName:`@agimon-ai/po-file-edit`,session:{get channels(){return[Oe({channel:`file_edits`},R)]},get fileLinks(){return De}}});export{ke as webPlugin};
@@ -1 +0,0 @@
1
- import{$r as e,Ca as t,Ft as n,Ga as r,Gi as i,Ha as a,It as o,Jr as s,Ki as c,Lt as l,Ma as u,Mi as d,Wi as f,Wr as p,Xi as m,Yi as h,Zi as g,an as _,ea as v,gn as y,hn as b,ja as x,ka as S,mn as C,na as w,oa as ee,qi as T,qt as E,ra as D,rn as te,tn as ne,vn as re}from"../chunks/po-web-runtime-D8FIos2q.js";var O=`po-goal-current`,ie=` · `,ae=/\[[0-9;]*m/gu;function k(e){if(e===void 0)return;let t=e.replace(ae,``).trim(),n=t.indexOf(ie);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=t({keys:`g e`,statusKey:O,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:a,onCancel:u}){let[d,p]=E(t),[v,y]=E(``),b=I(d,v),x=()=>{p(t),y(``),u()};return o(f,{open:r,onOpenChange:e=>{e||x()},children:l(c,{width:`sm`,"data-testid":`goal-edit-dialog`,"aria-describedby":void 0,children:[o(m,{children:o(g,{children:`edit goal`})}),l(i,{children:[o(T,{children:`this replaces the objective the agent is working to. it takes effect on the next turn.`}),l(`div`,{className:`flex flex-col gap-1`,children:[o(_,{htmlFor:`goal-edit-objective`,children:`objective`}),o(s,{id:`goal-edit-objective`,"data-testid":`goal-edit-objective`,value:d,rows:3,spellCheck:!1,onChange:e=>p(e.target.value)})]}),l(`div`,{className:`flex flex-col gap-1`,children:[o(_,{htmlFor:`goal-edit-budget`,children:`token budget`}),o(ne,{id:`goal-edit-budget`,"data-testid":`goal-edit-budget`,value:v,placeholder:n===``?`none; leave blank to keep it that way`:`${n}; blank keeps it`,onChange:e=>y(e.target.value)})]}),o(`p`,{"data-testid":`goal-edit-preview`,className:`truncate font-mono text-sm text-po-dim`,children:b??`nothing to send`}),l(h,{children:[o(e,{variant:`outline`,size:`md`,"data-testid":`goal-edit-cancel`,onClick:x,children:`cancel`}),o(e,{variant:`primary`,size:`md`,"data-testid":`goal-edit-save`,disabled:b===void 0,onClick:()=>{b!==void 0&&(a(b),y(``))},children:`save`})]})]})]})})}function R({objective:t,open:n,onConfirm:r,onCancel:a}){return o(f,{open:n,onOpenChange:e=>{e||a()},children:l(c,{width:`sm`,"data-testid":`goal-remove-dialog`,"aria-describedby":void 0,children:[o(m,{children:o(g,{children:`remove goal`})}),l(i,{children:[l(T,{children:[`this ends `,o(`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.`]}),l(h,{children:[o(e,{variant:`outline`,size:`md`,"data-testid":`goal-remove-cancel`,autoFocus:!0,onClick:a,children:`cancel`}),o(e,{variant:`danger`,size:`md`,"data-testid":`goal-remove-confirm`,onClick:r,children:`remove`})]})]})]})})}function z({sessionId:t,statuses:n,sendSessionFrame:r}){let[i,a]=E(`view`),s=k(n[O]);if(s===void 0)return o(`p`,{"data-testid":`activity-goal-unavailable`,className:`px-1 text-sm text-po-dim`,children:`goal status unavailable`});let c=e=>{t!==null&&r(t,{type:`prompt`,message:e})};return l(`div`,{"data-testid":`activity-goal-row`,className:`flex flex-col gap-0.5`,children:[l(`div`,{className:`flex min-w-0 items-start gap-1.5 px-1`,children:[l(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[o(`span`,{"data-testid":`activity-goal-objective`,className:`text-base font-semibold text-po-hi`,children:s.objective}),o(`span`,{"data-testid":`activity-goal-state`,className:`text-sm tabular-nums text-po-dim`,children:s.state})]}),l(v,{open:i===`menu`,onOpenChange:e=>a(t=>e?`menu`:t===`menu`?`view`:t),children:[o(ee,{asChild:!0,children:o(e,{variant:`ghost`,size:`icon`,"data-testid":`activity-goal-menu`,title:`goal actions`,disabled:t===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:o(te,{className:`h-3 w-3`})})}),l(w,{"data-testid":`activity-goal-menu-list`,children:[o(D,{"data-testid":`activity-goal-edit`,onSelect:()=>a(`edit`),children:`edit`}),o(D,{variant:`destructive`,"data-testid":`activity-goal-remove`,onSelect:()=>a(`confirm`),children:`remove`})]})]})]}),i===`edit`?o(L,{open:!0,objective:s.objective,budgetHint:F(s.state),onSubmit:e=>{c(e),a(`view`)},onCancel:()=>a(`view`)}):null,o(R,{objective:s.objective,open:i===`confirm`,onConfirm:()=>{c(j),a(`view`)},onCancel:()=>a(`view`)})]})}var B=S({component:z}),V=S({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=x({path:[{key:`g`,label:`goal`,detail:`session objective`},{key:`g`,label:`current`,detail:`the goal being worked`}],command:`goal status`}),U=x({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=u({keys:`g e`,icon:p,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 s=se(e,t),c=Q(e,t,r,{expanded:!1,isError:a,isPartial:i}),u=Q(e,t,r,{expanded:!0,isError:a,isPartial:i});return o(C,{tone:d({running:i,isError:a}),expandable:u.length>c.length,children:({expanded:t})=>l(n,{children:[o(y,{title:e,children:l(`span`,{"data-testid":`tool-call-${e}`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[o(`span`,{className:`font-semibold text-po-hi`,children:s.action}),s.detail?o(`span`,{className:`min-w-0 truncate text-po-dim`,children:s.detail}):null,s.metadata.map(e=>l(`span`,{className:`shrink-0 text-po-dim`,children:[`· `,e]},e))]})}),(t?u:c).length>0?o(b,{"data-testid":`tool-result-${e}`,children:o(re,{lines:t?u:c})}):null]})})}var le=a({tools:[...G],message:ce}),$=(e,t)=>t===void 0?void 0:{...e,...t},ue=r({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{Ft as e,Ga as t,Ha as n,It as r,Lt as i,Mi as a,Oi as o,Zt as s,_n as c,gn as l,hn as u,mn as d,yi as f}from"../chunks/po-web-runtime-D8FIos2q.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:t,result:n,output:m,running:h,isError:g}){let _=p(t),v=n===null||g?null:f(n,m,`grep`,!0);return r(d,{tone:a({running:h,isError:g}),expandable:!0,defaultExpanded:!1,children:({expanded:t})=>i(e,{children:[r(l,{title:`grep`,children:i(`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?i(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,_.details.join(` · `)]}):null]})}),t?g?i(u,{"data-testid":`tool-result-grep`,className:`flex flex-col`,children:[r(c,{tone:`error`,children:`failed`}),o(n,m).map((e,t)=>r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:e},`${String(t)}-${e}`))]}):v===null?h?r(u,{"data-testid":`tool-result-grep`,children:r(c,{tone:`running`,children:`running`})}):null:v.shown.length===0&&v.notice===void 0?null:i(u,{"data-testid":`tool-result-grep`,className:`flex flex-col gap-1`,children:[r(s,{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},_=t({id:`grep`,packageName:`@agimon-ai/po-grep`,session:{get toolRenderers(){return[g({tools:[`grep`]},h)]}}});export{_ as webPlugin};
@@ -1,3 +0,0 @@
1
- import{$r as e,At as t,Ba as n,Da as r,Ft as i,Ga as a,Gt as o,Ha as s,Ht as c,It as l,Kt as u,Lt as d,Ma as f,Mi as p,Qa as m,Qt as h,Sa as g,Yn as _,Yt as v,_i as y,_n as b,ca as x,cr as S,gi as C,gn as w,hn as T,ja as E,ka as D,mn as O,qt as k,sr as A,tn as j,ui as ee,vn as te,ya as ne,zi as M}from"../chunks/po-web-runtime-D8FIos2q.js";var N=g({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,n)=>t.fetch(e,n),sessionAddress:m}),P=`po/codemode`,F=new Set([`po/server-scope`,`po/server-host`,`po/headless-host`,`po/host-services`]);function I(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 L(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&&!F.has(i.name)?[{plugin:r,service:i}]:[]}),i=new Set(r.filter(e=>e.service.name===P).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 I(o,s)}function R(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 I(i,a)}function re(e,t,n){return t===`backend`?L(e):R(t===`web`?e.clientPackages??e.packages:e.packages,t,n)}function ie(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 ae(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 z(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=z(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)`},V={public:`Public service`,codemode:`Code-mode service`,plugin:`Plugin`,personal:`Your plugin`,slot:`Slot`},ce={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.`},le=12,H=420;function ue(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(H,Math.max(...t)-Math.min(...t)+80),i=Math.max(H,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 U({services:t,state:n=`populated`,initialSelection:r,initialGraph:i=`backend`,simulation:a}){let[s,f]=k(i),[p,m]=k(r),[h,g]=k(),_=o(()=>{let e=re(t,s,ne),n=new Map;for(let t of e.links)for(let e of[t.source,t.target])n.set(e,(n.get(e)??0)+1);let r=new Set([...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).slice(0,le).map(e=>e.id)),i=e.nodes.length>400,a=ae(e.nodes.map(e=>e.id)),o=i?a:oe(a,e.links);return{...e,degree:n,hubs:r,tooLarge:i,seed:a,settled:o,home:ue(o)}},[s,t]),[v,y]=k(),[b,x]=k(!1),S=a?.enabled===!0;c(()=>{if(!S||n!==`populated`||_.tooLarge){y(void 0);return}let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=_.seed,r=0,i=!1,a=()=>{i||(t=z(t,_.links,1e3/60),y({model:_,points:t}),t.some(e=>Math.abs(e.vx)+Math.abs(e.vy)>.02)&&(r=requestAnimationFrame(a)))},o=()=>{cancelAnimationFrame(r),x(e.matches),e.matches?y(void 0):(t=_.seed,r=requestAnimationFrame(a))};return e.addEventListener(`change`,o),o(),()=>{i=!0,cancelAnimationFrame(r),e.removeEventListener(`change`,o)}},[_,S,n]);let C=S&&v?.model===_?v.points:_.settled,w=new Map(C.map(e=>[e.id,e])),[T,E]=k(),D=T?.model===_?T.box:_.home,O=u(null),A=u(void 0),j=(e,t=D.x+D.w/2,n=D.y+D.h/2)=>{let r=Math.min(_.home.w*4,Math.max(_.home.w/12,D.w*e)),i=r/D.w;E({model:_,box:{x:t-(t-D.x)*i,y:n-(n-D.y)*i,w:r,h:D.h*i}})},ee=(e,t)=>{let n=O.current?.getScreenCTM()?.inverse();if(!O.current||!n)return{x:D.x+D.w/2,y:D.y+D.h/2};let r=new DOMPoint(e,t).matrixTransform(n);return{x:r.x,y:r.y}},te=n===`populated`&&_.nodes.length>0,M=u(()=>{});M.current=e=>{e.preventDefault();let t=ee(e.clientX,e.clientY);j(Math.exp(e.deltaY*.0015),t.x,t.y)},c(()=>{let e=O.current;if(!e)return;let t=e=>M.current(e);return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[te]);let N=()=>{A.current=void 0},P=e=>{e.currentTarget.setPointerCapture(e.pointerId),A.current={x:e.clientX,y:e.clientY,box:D}},F=e=>{let t=A.current,n=O.current?.getBoundingClientRect();if(!t||!n?.width)return;let r=Math.max(t.box.w/n.width,t.box.h/n.height);E({model:_,box:{...t.box,x:t.box.x-(e.clientX-t.x)*r,y:t.box.y-(e.clientY-t.y)*r}})},I=_.nodes.some(e=>e.id===p)?p:void 0,L=h??I,R=L?ie(L,_.links):void 0,H=_.home.w/D.w,U=D.w*.017,W=new Map(_.nodes.map(e=>[e.id,e])),G=I?W.get(I):void 0,K=G?_.links.filter(e=>e.source===G.id||e.target===G.id).map(e=>({link:e,other:W.get(e.source===G.id?e.target:e.source)})).sort((e,t)=>e.other.label.localeCompare(t.other.label)):[];return d(`section`,{className:`break-words bg-po-bg p-4 font-sans text-base text-po-text`,children:[d(`header`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[d(`div`,{children:[l(`h1`,{className:`text-2xl font-semibold text-po-hi`,children:`Brain`}),l(`p`,{className:`text-sm text-po-dim`,children:`What this scope can reach, and which plugins lean on it.`})]}),d(`div`,{className:`flex flex-wrap gap-2`,children:[l(`div`,{className:`flex gap-1 rounded-lg border border-po-border p-1`,role:`group`,"aria-label":`Graph`,children:se.map(t=>l(e,{size:`xs`,variant:s===t.id?`subtle`:`ghost`,"aria-pressed":s===t.id,onClick:()=>f(t.id),children:t.label},t.id))}),a&&d(e,{size:`xs`,variant:`outline`,"aria-label":`Physics simulation`,"aria-pressed":S,"aria-disabled":a.pending||void 0,"aria-busy":a.pending,className:`aria-disabled:pointer-events-none aria-disabled:opacity-40`,disabled:n!==`populated`||!S&&_.tooLarge,onClick:()=>{a.pending||a.onChange(!S)},children:[`Motion `,S?`on`:`off`]})]})]}),a?.error&&l(`p`,{role:`alert`,className:`mb-3 text-sm text-po-red`,children:a.error}),a&&(_.tooLarge||S&&b)&&l(`p`,{role:`status`,className:`mb-3 text-sm text-po-dim`,children:_.tooLarge?`Layout is paused above 400 nodes.`:`Motion is paused for your reduced-motion preference.`}),n!==`populated`||_.nodes.length===0?l(`p`,{role:n===`error`?`alert`:`status`,className:`py-12 text-po-text`,children:n===`loading`?`Reading the Brain snapshot…`:n===`error`?`The Brain snapshot could not be read. Your session is unchanged.`:ce[s]}):d(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[d(`div`,{className:`relative overflow-hidden rounded-lg border border-po-border bg-po-panel`,children:[d(`svg`,{ref:O,viewBox:`${D.x} ${D.y} ${D.w} ${D.h}`,className:`block h-[min(70vh,640px)] w-full cursor-grab touch-none select-none active:cursor-grabbing`,"aria-hidden":`true`,onPointerDown:P,onPointerMove:F,onPointerUp:N,onPointerCancel:N,children:[_.links.map(e=>{let t=w.get(e.source),n=w.get(e.target);if(!t||!n)return null;let r=L!==void 0&&(e.source===L||e.target===L);return l(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:r?B[W.get(L).role]:`var(--po-dim)`,strokeDasharray:e.label===`declares`?`4 3`:void 0,strokeOpacity:r?.9:L?.06:.22,strokeWidth:r?1.5:1,vectorEffect:`non-scaling-stroke`},`${e.source}\0${e.target}`)}),_.nodes.map(e=>{let t=w.get(e.id),n=3+Math.sqrt(_.degree.get(e.id)??0)*1.6,r=R?.has(e.id)??!0,i=e.id===L||(R?.has(e.id)??!1)||_.hubs.has(e.id)||H>=2;return d(`g`,{className:`cursor-pointer`,opacity:r?1:.15,onPointerDown:e=>e.stopPropagation(),onPointerEnter:()=>g(e.id),onPointerLeave:()=>g(void 0),onClick:()=>m(e.id),children:[e.id===I&&l(`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`}),l(`circle`,{cx:t.x,cy:t.y,r:n,fill:B[e.role]}),i&&l(`text`,{x:t.x,y:t.y+n+U*1.1,textAnchor:`middle`,fontSize:U,className:`fill-po-text`,paintOrder:`stroke`,stroke:`var(--po-panel)`,strokeWidth:U*.25,children:e.label})]},e.id)})]}),d(`div`,{className:`absolute right-2 bottom-2 flex gap-1`,children:[l(e,{size:`xs`,variant:`outline`,"aria-label":`Zoom in`,onClick:()=>j(1/1.4),children:`+`}),l(e,{size:`xs`,variant:`outline`,"aria-label":`Zoom out`,onClick:()=>j(1.4),children:`−`}),l(e,{size:`xs`,variant:`outline`,onClick:()=>E(void 0),children:`Fit`})]}),l(`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=>d(`span`,{className:`flex items-center gap-1`,children:[l(`svg`,{viewBox:`0 0 8 8`,className:`size-2`,"aria-hidden":`true`,children:l(`circle`,{cx:`4`,cy:`4`,r:`4`,fill:B[e]})}),V[e]]},e))})]}),d(`aside`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Selection`,children:[G?d(`div`,{className:`rounded-lg border border-po-border p-3`,children:[l(`p`,{className:`text-sm text-po-dim`,children:V[G.role]}),l(`h2`,{className:`break-all font-mono text-base font-semibold text-po-hi`,children:G.label}),l(`p`,{className:`mt-1 text-sm`,children:G.detail}),d(`h3`,{className:`mt-3 text-sm text-po-dim`,children:[`Connected (`,K.length,`)`]}),l(`ul`,{className:`mt-1 max-h-72 overflow-y-auto`,children:K.map(({link:t,other:n})=>l(`li`,{children:d(e,{size:`xs`,variant:`ghost`,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left`,onClick:()=>m(n.id),children:[l(`span`,{className:`font-mono`,children:n.label}),l(`span`,{className:`text-po-dim`,children:t.label})]})},n.id))})]}):l(`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.`}),d(`details`,{className:`rounded-lg border border-po-border p-3`,children:[d(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`All nodes (`,_.nodes.length,`)`]}),l(`ul`,{className:`mt-2 max-h-72 overflow-y-auto`,children:_.nodes.map(t=>l(`li`,{children:l(e,{size:`xs`,variant:`ghost`,"aria-pressed":I===t.id,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left font-mono`,onClick:()=>m(t.id),children:t.label})},t.id))})]}),s===`backend`&&t.diagnostics.length>0&&d(`details`,{className:`rounded-lg border border-po-border p-3`,children:[d(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`Coverage notes (`,t.diagnostics.length,`)`]}),t.diagnostics.map(e=>l(`p`,{className:`mt-2 text-sm text-po-dim`,children:e},e))]})]})]})]})}var W={scope:{id:`pending`,level:`host`},scopes:[],packages:[],services:[],consumers:[],edges:[],diagnostics:[]};function G({sessionId:t,workspaceId:n}){let r=t?`session:${t}`:n?`workspace:${n}`:`host`,i=!!(t||n),a=o(()=>t?N.session(t):n?N.workspace(n):N.host,[t,n]),[s,f]=k(0),[p,m]=k(),[h,g]=k(),_=u(void 0);c(()=>{let e=new AbortController;return _.current=e,i?(g({target:r,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.`);g({target:r,enabled:t.data.enabled,pending:!1})}}).catch(()=>{e.signal.aborted||g({target:r,pending:!1,error:`Simulation could not be read. Refresh to try again.`})})):g(void 0),m(e=>e?.target===r?{...e,state:`loading`}:void 0),a.services({signal:e.signal}).then(t=>{if(!t.ok)throw Error(`Brain snapshot unavailable.`);e.signal.aborted||m({target:r,services:t.data,state:t.data.services.length+t.data.consumers.length+t.data.packages.length?`populated`:`empty`})}).catch(()=>{e.signal.aborted||m({target:r,services:W,state:`error`})}),()=>{e.abort(),_.current===e&&(_.current=void 0)}},[a,i,r,s]);let v=p?.target===r?p:void 0,y=v?.state??`loading`,b=h?.target===r?h:void 0;async function x(e){let t=_.current;if(i&&t&&!t.signal.aborted&&b&&b.enabled!==void 0&&!b.pending){g({...b,pending:!0,error:void 0});try{let n=await a.setSimulation({body:{enabled:e},signal:t.signal});if(t.signal.aborted)return;if(!n.ok||typeof n.data?.enabled!=`boolean`)throw Error(`Simulation unavailable.`);g({target:r,enabled:n.data.enabled,pending:!1})}catch{t.signal.aborted||g({...b,pending:!1,error:`Simulation could not be changed. Your graph is unchanged.`})}}}return d(`div`,{children:[d(`div`,{className:`flex items-center justify-between gap-3 bg-po-bg px-4 pt-4`,children:[d(`p`,{className:`text-sm text-po-dim`,children:[t?`Session`:n?`Workspace`:`Global`,` snapshot`]}),l(e,{size:`xs`,variant:`outline`,disabled:y===`loading`||b?.pending,onClick:()=>f(e=>e+1),children:`Refresh`})]}),l(U,{services:v?.services??W,state:y,simulation:i?{enabled:b?.enabled??!1,pending:b?.pending!==!1||b.enabled===void 0,error:b?.error,onChange:x}:void 0},r)]})}var K=D({slot:`page`,id:`brain`,component:G}),de=e=>typeof e==`object`&&!!e&&!Array.isArray(e),q=(e,t)=>{if(typeof e!=`string`)return null;let n=e.trim();return n.length>0&&n.length<=t?n:null};function fe(e){if(!de(e)||e.version!==1)return null;let t=q(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(!de(t))return null;let e=q(t.id,80),i=q(t.question,240),a=q(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=q(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 pe={slot:`help.guides`,description:`Contribute a labelled set of searchable plain-text questions and answers to the Help panel.`,parse:fe};function me(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 he(e){return l(ge,{fills:e.slotData(pe)},e.sessionId)}function ge({fills:e,initialQuery:t=``,initialExpanded:n}){let[r,i]=k(t),a=me(e,r),o=e.some(e=>e.data.guides.length);return d(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-po-rail text-po-text font-sans`,children:[l(`div`,{className:`border-b border-po-border-soft p-3`,children:l(j,{"aria-label":`Search help`,placeholder:`Search help`,type:`search`,value:r,onChange:e=>i(e.target.value),className:`w-full placeholder:text-po-dim`})}),l(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:a.length===0?l(x,{title:o?`No matching guides`:`No help guides yet`,description:o?`Try a different word or a package name.`:`Guides from this session’s plugins will appear here.`}):l(`div`,{className:`flex flex-col gap-5`,children:a.map(e=>d(`section`,{children:[l(`h2`,{className:`mb-1 text-lg font-semibold text-po-hi break-words`,children:e.data.label}),l(v,{type:`single`,collapsible:!0,defaultValue:n?.[0]===e.pluginId&&n[1]===e.id?n[2]:void 0,children:e.data.guides.map(e=>d(C,{value:e.id,children:[l(M,{className:`text-base font-medium leading-relaxed break-words`,children:e.question}),l(A,{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 _e=r({id:`help`,label:`Help`,icon:h,order:50,requiredMode:`help`,panel:he});function ve({openTransientTab:t}){return l(e,{variant:`outline`,size:`xs`,"data-testid":`activity-explore-brain`,onClick:()=>t({id:`help-brain-map`,label:`Brain`,panel:G}),children:`Explore`})}var ye=D({slot:`activity-promo`,id:`brain-explore`,component:ve}),be=D({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.`}]}}),xe=E({path:[{key:`h`,label:`help`,detail:`package docs and logs`},{key:`e`,label:`toggle`,detail:`load or hide package Help`}],command:`mode help`}),Se=f({keys:`h e`,icon:h,order:10}),Ce=n(pe),we=new Set([`inactive`,`activating`,`active`,`degraded`]),J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0?e:void 0,X=e=>typeof e==`string`&&e.trim()!==``?e.trim():void 0,Z=e=>Array.isArray(e)?e.filter(J):[];function Q(e){return e.split(`
2
- `).filter(e=>e.trim()!==``)}function Te(e){return Z(e).flatMap(e=>{let t=X(e.name);if(t===void 0)return[];let n=X(e.source),r=X(e.reason);return[{name:t,active:e.active===!0,...n?{source:n}:{},...r?{reason:r}:{}}]})}function Ee(e){let t=X(e.activation);if(t===void 0||!we.has(t))return null;let n=J(e.counts)?e.counts:{},r=Y(n.tools);return{kind:`status`,activation:t,skillCount:Y(n.skills)??null,...r===void 0?{}:{toolCount:r},skills:Te(e.skills),tools:Te(e.tools),diagnostics:Z(e.diagnostics).flatMap(e=>{let t=X(e.code);if(t===void 0)return[];let n=X(e.source);return[{code:t,...n?{source:n}:{}}]}),packages:Z(e.packages).flatMap(e=>{let t=X(e.packageName);if(t===void 0)return[];let n={scope:X(e.scope),stage:X(e.stage),reason:X(e.reason)},r=X(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 De(e){let t=X(e.status);if(t!==`checks-passed`&&t!==`issues-found`)return null;let n=J(e.appliedSelection)?e.appliedSelection:{},r=X(n.preset),i=X(n.profile),a=X(e.limitations);return{kind:`setup`,passed:t===`checks-passed`,...r?{preset:r}:{},domains:Array.isArray(n.domains)?n.domains.flatMap(e=>X(e)??[]):[],...i?{profile:i}:{},checks:Z(e.checks).flatMap(e=>{let t=X(e.area);if(t===void 0)return[];let n=Y(e.problemCount),r=X(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=>X(e)??[]):[],...a?{limitations:a}:{}}}function Oe(e){let t;try{t=JSON.parse(e)}catch{return{kind:`text`,lines:Q(e)}}if(J(t)){let e=Ee(t)??De(t);if(e!==null)return e}return{kind:`text`,lines:Q(e)}}var ke=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;function Ae(e){if(e.kind===`setup`){if(e.passed)return`Checks passed`;let t=e.checks.filter(e=>!e.passed).length;return t>0?`${ke(t,`area`)} failed`:`Issues found`}return{inactive:`Help off`,activating:`Help activating`,active:`Help active`,degraded:`Help degraded`}[e.activation]}function je(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 Me(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 Ne(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 Pe=`Help diagnostics`,Fe={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 Ie({toolName:e,output:t,running:n,isError:r}){let a=p({running:n,isError:r}),o=n||r?null:Oe(t);if(o!==null&&o.kind!==`text`)return l(Le,{toolName:e,tone:a,view:o});let s=o?.lines??Q(t);if(r)return d(O,{tone:a,children:[l(w,{title:e,children:l(`span`,{className:`min-w-0 truncate text-po-faint`,children:Pe})}),s.length>0?l(T,{children:l(`p`,{className:`whitespace-pre-wrap break-words text-po-red`,children:s.join(`
3
- `)})}):null]});let c=s.map(e=>({text:e,tone:`text`}));return l(O,{tone:a,expandable:c.length>12,children:({expanded:t})=>{let r=ee(c,12,t);return d(i,{children:[l(w,{title:e,children:l(`span`,{className:`min-w-0 truncate text-po-faint`,children:Pe})}),r.shown.length>0||n?d(T,{children:[l(te,{lines:r.shown}),r.hidden>0?d(b,{expands:!0,children:[r.hidden,` more lines`]}):null,n?l(b,{tone:`running`,children:`Inspecting this session`}):null]}):null]})}})}function Le({toolName:e,tone:t,view:n}){let r=je(n),a=n.kind===`status`?Me(n):void 0;return l(O,{tone:t,expandable:Ne(n),children:({expanded:t})=>d(i,{children:[l(w,{title:e,children:l(`span`,{"data-testid":`tool-call-${e}`,className:`max-w-[70%] shrink-0 truncate text-po-text`,children:Ae(n)})}),d(T,{"data-testid":`tool-result-${e}`,className:`flex flex-col gap-4`,children:[a===void 0?null:l(`p`,{className:`text-sm text-po-dim`,children:a}),r.length>0?l(`dl`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:r.map(e=>d(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[l(`dt`,{className:`truncate text-sm text-po-dim`,children:e.label}),l(`dd`,{className:Fe[e.tone],children:e.value})]},e.label))}):null,t?n.kind===`status`?l(Re,{view:n}):l(Be,{view:n}):null]})]})})}function Re({view:e}){return d(i,{children:[e.packages.length>0?d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:`Failed packages`}),e.packages.map((e,t)=>d(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[d(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[l(`span`,{className:`min-w-0 shrink truncate font-mono text-sm text-po-text`,children:e.packageName}),e.stage===void 0?null:d(`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:l(`p`,{className:`break-words text-sm text-po-red`,children:e.reason}),e.previous===void 0?null:d(`p`,{className:`text-sm text-po-faint`,children:[`Previous build `,e.previous]})]},`${e.packageName}-${String(t)}`))]}):null,e.diagnostics.length>0?d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:`Diagnostics`}),e.diagnostics.map((e,t)=>d(`div`,{className:`flex min-w-0 items-center gap-2`,children:[l(S,{tone:`yellow`,size:`xs`,className:`shrink-0 font-mono`,children:e.code}),e.source===void 0?null:l(`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,l(ze,{label:`Skills`,rows:e.skills}),l(ze,{label:`Tools`,rows:e.tools}),e.truncated?l(`p`,{className:`text-sm text-po-faint`,children:`The tool capped its lists; more exist.`}):null]})}function ze({label:e,rows:t}){if(t.length===0)return null;let n=t.slice(0,10);return d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:e}),l(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2`,children:n.map((e,t)=>d(`li`,{className:`flex min-w-0 items-center gap-2`,children:[l(`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:l(S,{size:`xs`,className:`shrink-0`,children:e.reason??`inactive`}),e.source===void 0?null:l(`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?d(`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 d(i,{children:[t.length>0?d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:`Selection`}),l(`div`,{className:`flex flex-wrap items-center gap-2`,children:t.map(e=>l(S,{size:`xs`,children:e},e))})]}):null,e.checks.length>0?d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:`Checks`}),l(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`,children:e.checks.map(e=>d(`li`,{className:`flex min-w-0 flex-col gap-0.5`,children:[d(`div`,{className:`flex min-w-0 items-center gap-2`,children:[l(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e.area}),e.passed?l(y,{"aria-label":`passed`,className:`size-3.5 shrink-0 text-po-green`}):l(`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?d(`span`,{className:`truncate text-sm text-po-faint`,children:[`Guide: `,e.guidance]}):null]},e.area))})]}):null,e.skipped.length>0?d(`section`,{className:`flex flex-col gap-2`,children:[l(_,{children:`Skipped`}),e.skipped.map(e=>l(`p`,{className:`text-sm text-po-yellow`,children:e},e))]}):null,e.limitations===void 0?null:l(`p`,{className:`text-sm text-po-faint`,children:e.limitations})]})}var Ve=s({tools:[`help_status`,`diagnose_setup`],message:Ie}),$=(e,t)=>t===void 0?void 0:{...e,...t},He=a({id:`help`,packageName:`@agimon-ai/po-help`,host:{get fills(){return[$({slot:`page`,id:`brain`},K)]}},session:{get dockFaces(){return[$({id:`help`},_e)]},get fills(){return[$({slot:`activity-promo`,id:`brain`},ye),$({slot:`help.guides`,id:`help`},be)]},get leaderBindings(){return[$({id:`help.toggle`},xe)]},get modes(){return[$({name:`help`},Se)]},get slots(){return[$({slot:`help.guides`},Ce)]},get toolRenderers(){return[$({tools:[`help_status`]},Ve)]}}});export{He as webPlugin};