@agimon-ai/po-cloudflare 0.0.2-alpha.70 → 0.0.2-alpha.71

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 (192) hide show
  1. package/dist/assets/assets/{CodeEditorView-i4Ppo-Ez.js → CodeEditorView-CfrVwzvL.js} +2 -2
  2. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-DyhZRVQg.js → abnfDiagram-WEYOIA3C-B80H4Cm4.js} +2 -2
  3. package/dist/assets/assets/{architecture-WOLXFQ4H-BBs2Sd0N.js → architecture-WOLXFQ4H-Dr4hXaql.js} +1 -1
  4. package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DsCX6klV.js → architectureDiagram-ZHVYKT53-DWyt7oXu.js} +2 -2
  5. package/dist/assets/assets/{blockDiagram-RJAE7QA3-BI3vEkHp.js → blockDiagram-RJAE7QA3-OxNTLdmi.js} +2 -2
  6. package/dist/assets/assets/{c4Diagram-XDPPPE54-BPQ3l3Wo.js → c4Diagram-XDPPPE54-B4YtcH0s.js} +2 -2
  7. package/dist/assets/assets/channel-bXj00dGj.js +2 -0
  8. package/dist/assets/assets/{chunk-2E7WHVMD-w1BaZW2E.js → chunk-2E7WHVMD-CD6FFMOX.js} +2 -2
  9. package/dist/assets/assets/{chunk-4EMNKR2T-CUW8s7jF.js → chunk-4EMNKR2T-CEIoX5oo.js} +2 -2
  10. package/dist/assets/assets/{chunk-55XCU76K-By6CWPPC.js → chunk-55XCU76K-CD3t0IJi.js} +2 -2
  11. package/dist/assets/assets/{chunk-7S6XSTFO-BBrnzWpC.js → chunk-7S6XSTFO-Cyt75UCF.js} +2 -2
  12. package/dist/assets/assets/{chunk-AQDTSKZB-DPdxwHEp.js → chunk-AQDTSKZB-DRtqYBj9.js} +2 -2
  13. package/dist/assets/assets/{chunk-DSNLSHJZ-DYgD5g3I.js → chunk-DSNLSHJZ-C8Fx2F8s.js} +2 -2
  14. package/dist/assets/assets/{chunk-HAGFOTED-DQK-CQol.js → chunk-HAGFOTED-wOLWRRnd.js} +2 -2
  15. package/dist/assets/assets/{chunk-HNE4Q36P-B7wgFR7D.js → chunk-HNE4Q36P-CurJg4Hf.js} +2 -2
  16. package/dist/assets/assets/{chunk-NQOKRVIF-CCLgsSmY.js → chunk-NQOKRVIF-Dzcc5nOG.js} +2 -2
  17. package/dist/assets/assets/{chunk-UHW7PFBP-ynXsycud.js → chunk-UHW7PFBP-B_ULFf2h.js} +2 -2
  18. package/dist/assets/assets/{chunk-VQ5W62QI-g-S-R-1r.js → chunk-VQ5W62QI-DH0VY4_p.js} +2 -2
  19. package/dist/assets/assets/{chunk-WQQL4CDK-BacAjFnN.js → chunk-WQQL4CDK-DNxfLyXM.js} +2 -2
  20. package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +2 -0
  21. package/dist/assets/assets/{chunk-YZO67HFG-BpftQis1.js → chunk-YZO67HFG-COuMUh9U.js} +2 -2
  22. package/dist/assets/assets/{chunk-ZAUX2LTX-DJdy-AMG.js → chunk-ZAUX2LTX-BJrCnubF.js} +2 -2
  23. package/dist/assets/assets/{chunk-ZCHMQSOR-87ga4cjt.js → chunk-ZCHMQSOR-D1lFKPtk.js} +2 -2
  24. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-CpsLBpS_.js → classDiagram-v2-4MYWR3UA-DfZIbyVL.js} +2 -2
  25. package/dist/assets/assets/{cose-bilkent-JH36ORCC-DJaIzCvD.js → cose-bilkent-JH36ORCC-CpGhv9_S.js} +2 -2
  26. package/dist/assets/assets/{cynefin-EF2NZ3EQ-CI6zLM35.js → cynefin-EF2NZ3EQ-Cxdc6nQl.js} +1 -1
  27. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-DfzAHZ0M.js → cynefinDiagram-WF24UDRP-qoj0w3lp.js} +2 -2
  28. package/dist/assets/assets/{dagre-NK4GIZVX-B8tLPoML.js → dagre-NK4GIZVX-DL6QbNDS.js} +2 -2
  29. package/dist/assets/assets/{diagram-CBK3MWTC-Dr80S-jH.js → diagram-CBK3MWTC-CJB3jq1_.js} +2 -2
  30. package/dist/assets/assets/{diagram-I5XIIV2D-B8UFhfTz.js → diagram-I5XIIV2D-4cPOxCxF.js} +2 -2
  31. package/dist/assets/assets/{diagram-ODIL2UCW-CcuwPetk.js → diagram-ODIL2UCW-BG3-jAxE.js} +2 -2
  32. package/dist/assets/assets/{diagram-PFBEJUXE-RcrmwqS-.js → diagram-PFBEJUXE-Bx8dFaXj.js} +2 -2
  33. package/dist/assets/assets/{diagram-RJA3I4VV-L0etfW8v.js → diagram-RJA3I4VV-CUUHND91.js} +2 -2
  34. package/dist/assets/assets/{diagram-TYUNFSNR-qAWwJAuP.js → diagram-TYUNFSNR-BDMoN-kr.js} +2 -2
  35. package/dist/assets/assets/{dist-DGxK4Eqg.js → dist-5AxNm-uy.js} +2 -2
  36. package/dist/assets/assets/{dist-CzUZg8tE.js → dist-9_Rmyj2I.js} +2 -2
  37. package/dist/assets/assets/{dist-8Be2UxDt.js → dist-BE3CLKv4.js} +2 -2
  38. package/dist/assets/assets/{dist-BH9U8iUV.js → dist-BfNCu-7x.js} +2 -2
  39. package/dist/assets/assets/{dist-engyz38V.js → dist-BjI0b36Z.js} +2 -2
  40. package/dist/assets/assets/{dist-BEo-JIto.js → dist-CM7b5P9a.js} +2 -2
  41. package/dist/assets/assets/{dist-GAOFeWFO.js → dist-Ccxb9U1G.js} +2 -2
  42. package/dist/assets/assets/{dist-CpVa1sRY.js → dist-CjCWP21A.js} +2 -2
  43. package/dist/assets/assets/{dist-CgWFM0mc.js → dist-DSTAktnR.js} +2 -2
  44. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BprXAPMU.js → ebnfDiagram-V4P3TTPT-BivOMXZb.js} +2 -2
  45. package/dist/assets/assets/{elk-QONTBCTQ-D523_9vu.js → elk-QONTBCTQ-CrJ1Qpy_.js} +2 -2
  46. package/dist/assets/assets/{erDiagram-KYQIGQAA-QpR6wQYW.js → erDiagram-KYQIGQAA-w9Bqp4sV.js} +2 -2
  47. package/dist/assets/assets/{eventmodeling-K75KTNOO-BaGn1fXz.js → eventmodeling-K75KTNOO-CBjFM3kV.js} +1 -1
  48. package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +1 -0
  49. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CdOyCuYE.js → ganttDiagram-R7GPNTJY-CsWtGaqD.js} +2 -2
  50. package/dist/assets/assets/{gitGraph-VSP46ZUC-EsAHczV6.js → gitGraph-VSP46ZUC-DsBSV9_h.js} +1 -1
  51. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BIujo2Py.js → gitGraphDiagram-PDYL7XHY-D5GxuYHW.js} +2 -2
  52. package/dist/assets/assets/{index-BpJxd2yX.js → index-DWDYnZsq.js} +90 -90
  53. package/dist/assets/assets/{info-OHQRW6UA-LjorJFXn.js → info-OHQRW6UA-C7x5dSJu.js} +1 -1
  54. package/dist/assets/assets/{infoDiagram-MVDRKAX5-DH9gnzLg.js → infoDiagram-MVDRKAX5-CwpI-uAa.js} +2 -2
  55. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-hX3Vi2D5.js → ishikawaDiagram-HPEHV2GE-DAa7J5G6.js} +2 -2
  56. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-D_DP_Ais.js → journeyDiagram-BOSHW7O7-BmiZnxE_.js} +2 -2
  57. package/dist/assets/assets/{kanban-definition-FNSA4HC5-xjXWPA_c.js → kanban-definition-FNSA4HC5-DUR_mA3L.js} +2 -2
  58. package/dist/assets/assets/{line-DmYSe7_a.js → line-DHY49wSg.js} +2 -2
  59. package/dist/assets/assets/{linear-bTjWiO8g.js → linear-pTo-a9xT.js} +2 -2
  60. package/dist/assets/assets/{mermaid-parser.core-Canr1bD7.js → mermaid-parser.core-DMg3hN3T.js} +4 -4
  61. package/dist/assets/assets/{mermaid.core-CzdNzF6I.js → mermaid.core-DKtPCltA.js} +5 -5
  62. package/dist/assets/assets/{mindmap-definition-6OY57UG3-DADwSr-4.js → mindmap-definition-6OY57UG3-DwTkFbnV.js} +2 -2
  63. package/dist/assets/assets/{packet-JDAUHWVQ-Bbicx2nv.js → packet-JDAUHWVQ-Tu9TrQ1x.js} +1 -1
  64. package/dist/assets/assets/{pegDiagram-ECIUJNBX-CsayWcP2.js → pegDiagram-ECIUJNBX-B7My4tsz.js} +2 -2
  65. package/dist/assets/assets/{pie-XZMESJXO-Blegt3hx.js → pie-XZMESJXO-QPQm5Gdx.js} +1 -1
  66. package/dist/assets/assets/{pieDiagram-GNMPY74T-CVDQwYsb.js → pieDiagram-GNMPY74T-Bv-zAD_z.js} +2 -2
  67. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-B_3o8LPt.js → quadrantDiagram-D57K4MC3-HTjoGQPd.js} +2 -2
  68. package/dist/assets/assets/{radar-ABXABTNO-RkOj7KMI.js → radar-ABXABTNO-LDBlEoFo.js} +1 -1
  69. package/dist/assets/assets/{railroad-I3PHUGI6-BJRK-sej.js → railroad-I3PHUGI6-Dy3_ymgZ.js} +1 -1
  70. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-zDVbNx_e.js → railroad-abnf-LNEFI6M7-QLVvYs6e.js} +1 -1
  71. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-DR--F1w_.js → railroad-ebnf-DWYD2UWJ-CFRlv9a8.js} +1 -1
  72. package/dist/assets/assets/{railroad-peg-JR7BVNR7-DUU7CG0O.js → railroad-peg-JR7BVNR7-BOlq3d9c.js} +1 -1
  73. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-BTI5d3Dh.js → railroadDiagram-Y72NRBL7-Chg32HoU.js} +2 -2
  74. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-ryj3WI8d.js → requirementDiagram-EQYSW5RA-VenIs_eg.js} +2 -2
  75. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-CpxzEis6.js → sankeyDiagram-SY24JHO5-BdByqMKF.js} +2 -2
  76. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Ck0eH0AG.js → sequenceDiagram-BLEHNHQU-D3Do4GJE.js} +2 -2
  77. package/dist/assets/assets/{src-CVheRzH-.js → src-DmfN-DA-.js} +2 -2
  78. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-BUP0MEeM.js → stateDiagram-v2-A6IESKWZ-CZkRbPlf.js} +2 -2
  79. package/dist/assets/assets/{swimlanes-B3ENRKFQ-Bv0gbKOG.js → swimlanes-B3ENRKFQ-DRTdF9AF.js} +2 -2
  80. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +9 -0
  81. package/dist/assets/assets/{timeline-definition-JXYKGLGB-Bvln6k4A.js → timeline-definition-JXYKGLGB-BVcuws_M.js} +2 -2
  82. package/dist/assets/assets/{treeView-D4JQ5SDB-DTTZJ9g6.js → treeView-D4JQ5SDB-BLtOJGqO.js} +1 -1
  83. package/dist/assets/assets/{treemap-SAJKECNS-DvSBR2VN.js → treemap-SAJKECNS-Dn3BWJ4v.js} +1 -1
  84. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-DDmtJ3Uv.js → usecaseDiagram-WPOLBNNX-CBExIKDY.js} +2 -2
  85. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-CgTKk1M4.js → vennDiagram-Q3Y3IDCW-C6FIx2L4.js} +2 -2
  86. package/dist/assets/assets/{wardley-7MLQ67FV-Dc3Gbgal.js → wardley-7MLQ67FV-Cjj2xSBp.js} +1 -1
  87. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-Bt6AAQZb.js → wardleyDiagram-IVAIDKWA-sQPCBCFK.js} +2 -2
  88. package/dist/assets/assets/{webpack-Vcj694ip.js → webpack-DDCA0aDL.js} +2 -2
  89. package/dist/assets/assets/{xychartDiagram-4URNHDU4-4WaL7qQg.js → xychartDiagram-4URNHDU4-bZ4rifSw.js} +2 -2
  90. package/dist/assets/bundle-asset-policy.json +1 -1
  91. package/dist/assets/index.html +1 -1
  92. package/dist/assets/plugins/chunks/po-web-runtime-D8FIos2q.js +1 -0
  93. package/dist/assets/plugins/compositions.json +1 -1
  94. package/dist/assets/plugins/slots/approval.09e72f36-DxS_uibk.js +2 -0
  95. package/dist/assets/plugins/slots/artifacts.50b639bb-Cp37TAkd.js +1 -0
  96. package/dist/assets/plugins/slots/author.ea449ace-Ds9Y-tjN.js +93 -0
  97. package/dist/assets/plugins/slots/{autocompact.ec8f713f-Dn7Bt8Bf.js → autocompact.6f428144-CDZpN7I7.js} +1 -1
  98. package/dist/assets/plugins/slots/{backdrop-bamboo.1a4d85e9-B7xkLXXQ.js → backdrop-bamboo.6e4c928d-qbifuMc6.js} +1 -1
  99. package/dist/assets/plugins/slots/browse.fa1f1a50-CVYvo1M5.js +1 -0
  100. package/dist/assets/plugins/slots/{builtin-tools.16ef5e25-HORNeYBw.js → builtin-tools.75108f21-Cq1ljoL-.js} +3 -3
  101. package/dist/assets/plugins/slots/calendar.d8b70190-BBjpOs1v.js +2 -0
  102. package/dist/assets/plugins/slots/codemode.c58fb583-DOR6OR7R.js +11 -0
  103. package/dist/assets/plugins/slots/domain.753f9f92-CJrXxig9.js +1 -0
  104. package/dist/assets/plugins/slots/{edit.7c802139-DyVlM6he.js → edit.804fec90-BFF7_xN9.js} +3 -3
  105. package/dist/assets/plugins/slots/files.66ffc636-CzOlZrRm.js +2 -0
  106. package/dist/assets/plugins/slots/goal.45dffa01-BtQBp3sw.js +1 -0
  107. package/dist/assets/plugins/slots/grep.98262cff-9bUDfjyT.js +1 -0
  108. package/dist/assets/plugins/slots/help.5fbd20f7-B4-y6gYK.js +3 -0
  109. package/dist/assets/plugins/slots/log.cb964209-BRPa3cVs.js +4 -0
  110. package/dist/assets/plugins/slots/mcp.82cc1ff5-CFtzPkPC.js +55 -0
  111. package/dist/assets/plugins/slots/plan.3852ba52-CH59Ff49.js +3 -0
  112. package/dist/assets/plugins/slots/{profile.63bc3ae6-DKIhEgIG.js → profile.ab16dcec-0e9fWWyE.js} +1 -1
  113. package/dist/assets/plugins/slots/{prompts.9d9b47cc-B1gwBWg8.js → prompts.ae48c07a-BTqYnBX5.js} +2 -2
  114. package/dist/assets/plugins/slots/read.4560591a-C7fMXDEH.js +1 -0
  115. package/dist/assets/plugins/slots/runner.6e494d59-CqrpqhW9.js +9 -0
  116. package/dist/assets/plugins/slots/scaffold.d87a6ee0-9qY5gkYW.js +1 -0
  117. package/dist/assets/plugins/slots/session-mcp.2be84084-Cf0cqopp.js +2 -0
  118. package/dist/assets/plugins/slots/{sessions.8e378a3b-BfIRgip7.js → sessions.6f47cb4c-B1_eqPJQ.js} +1 -1
  119. package/dist/assets/plugins/slots/skill.62a0a1b3-D-SKX8iw.js +4 -0
  120. package/dist/assets/plugins/slots/{space.056e8bbc-DIA3v5sn.js → space.65a27e5a-fbLHc-DX.js} +1 -1
  121. package/dist/assets/plugins/slots/subagents.8bb9992c-Cm_YMEnn.js +7 -0
  122. package/dist/assets/plugins/slots/template-advanced.59f3f98a-L0WOM4JT.js +1 -0
  123. package/dist/assets/plugins/slots/template-desktop.0f0b8491-By9BZlaL.js +7 -0
  124. package/dist/assets/plugins/slots/template-elegant.0e3b0acf-El05x7HK.js +1 -0
  125. package/dist/assets/plugins/slots/vault.3cbfcdc3-DpU_65Wy.js +1 -0
  126. package/dist/assets/plugins/slots/voice.a952113d-CvcuL__m.js +1 -0
  127. package/dist/assets/plugins/slots/{web-search.f6292793-uk9YiOK-.js → web-search.65013836-NVh9fdvE.js} +1 -1
  128. package/dist/assets/plugins/slots/workflows.cbc5c5c0-OLKSY9PE.js +16 -0
  129. package/dist/assets/pwa/pwa.js +2 -2
  130. package/dist/assets/pwa/sw.js +1 -1
  131. package/dist/{browser-Cw6DqE4e.js → browser-ks_k-6KA.js} +2 -0
  132. package/dist/{index.edge-CfP4Hcva.js → index.edge-BiVQ9LoZ.js} +1 -1
  133. package/dist/{server-rYmfX6Hw.js → server-AKM07WcM.js} +1 -1
  134. package/dist/{server-D8lpe7s-.js → server-B0tM5Ygf.js} +1 -1
  135. package/dist/{server-BRWPQZ3b.js → server-B8-vStCx.js} +1 -1
  136. package/dist/{server-BPV1OpOD.js → server-BAbdiL38.js} +1 -1
  137. package/dist/{server-B3hOw2hW.js → server-BCZ_R3kX.js} +1 -1
  138. package/dist/{server-BZE1vhGE.js → server-BGKAeB3M.js} +2 -2
  139. package/dist/{server-BmUYK0Ig.js → server-BIQhg1jS.js} +2253 -2455
  140. package/dist/{server-C5LjIK29.js → server-BeoA0QB-.js} +1 -1
  141. package/dist/{server-i_olh10z.js → server-BsgvOpBF.js} +1 -1
  142. package/dist/{server-BbHDXrj8.js → server-BtnOqSB5.js} +1 -1
  143. package/dist/{server-D70beQ8N.js → server-C0Lt6nTt.js} +1 -1
  144. package/dist/{server-D50y-w6B.js → server-CMaWF5UA.js} +1 -1
  145. package/dist/{server-HOmc-Wq6.js → server-CWR34Vx6.js} +1 -1
  146. package/dist/{server-BtBc4Sdj.js → server-Cjtr0oVJ.js} +1 -1
  147. package/dist/{server-B9tL6m4q.js → server-CkJQJ3Oo.js} +1 -1
  148. package/dist/{server-BWZTwInM.js → server-Cy2FhGBm.js} +1 -1
  149. package/dist/{server-D4VFb4Uf.js → server-D8yEblCB.js} +1 -1
  150. package/dist/{server-C3H2x8Rn.js → server-DF0YIUeI.js} +1 -1
  151. package/dist/{server-BHjAYOdl.js → server-DRFESCq1.js} +1 -1
  152. package/dist/{server-BW1v1CXw.js → server-Dkc9Kth2.js} +7 -2
  153. package/dist/{server-D39LRN9f.js → server-_HZm8wEC.js} +1 -1
  154. package/dist/{server-G7w-rLJ4.js → server-_jWkMESg.js} +3 -2
  155. package/dist/{server-BXCRqk1Y.js → server-nHPXbRDA.js} +1 -1
  156. package/dist/{server-DIArHmjQ.js → server-p7qANgrf.js} +1 -1
  157. package/dist/{server-W6fE1shC.js → server-vhmQi3co.js} +1 -1
  158. package/dist/worker.js +7036 -6010
  159. package/dist/workflowServices-RlswfHWp.js +300 -0
  160. package/package.json +49 -49
  161. package/dist/assets/assets/channel-1ehKCuz-.js +0 -2
  162. package/dist/assets/assets/chunk-XXDRQBXY-CpS2hTCb.js +0 -2
  163. package/dist/assets/assets/flowDiagram-IUGLLWBU-BLGi2Tcw.js +0 -1
  164. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BMOkq2v_.js +0 -9
  165. package/dist/assets/plugins/chunks/po-web-runtime-Yjk5kSCS.js +0 -1
  166. package/dist/assets/plugins/slots/approval.3e4ea6e4-CFdw9ob_.js +0 -2
  167. package/dist/assets/plugins/slots/artifacts.84980c32-ocCs81ac.js +0 -1
  168. package/dist/assets/plugins/slots/author.8eca1a3d-Dht6Emzx.js +0 -93
  169. package/dist/assets/plugins/slots/browse.61a8907a-B8xsrCRp.js +0 -1
  170. package/dist/assets/plugins/slots/calendar.d337fc49-ZApjFb8a.js +0 -2
  171. package/dist/assets/plugins/slots/codemode.5f359b9c-B60BP7uB.js +0 -11
  172. package/dist/assets/plugins/slots/domain.832848c8-Cwu_vvzo.js +0 -1
  173. package/dist/assets/plugins/slots/files.364f16c9-BZpLJy01.js +0 -2
  174. package/dist/assets/plugins/slots/goal.a97b169d-Bi5YKBZC.js +0 -1
  175. package/dist/assets/plugins/slots/grep.d8bf9f57-hqVwtdze.js +0 -1
  176. package/dist/assets/plugins/slots/help.5c78c071-Drhx02TI.js +0 -3
  177. package/dist/assets/plugins/slots/log.07fd59a4-CoJHv8w_.js +0 -4
  178. package/dist/assets/plugins/slots/mcp.ea8b6aa2-C8Fnd-JT.js +0 -55
  179. package/dist/assets/plugins/slots/plan.7b30f8d8-CZYr2pT-.js +0 -3
  180. package/dist/assets/plugins/slots/read.926c024f-ClmLDj9R.js +0 -1
  181. package/dist/assets/plugins/slots/runner.5393fa6c-ttJbdJZ2.js +0 -9
  182. package/dist/assets/plugins/slots/scaffold.686222eb-3wV6oBNu.js +0 -1
  183. package/dist/assets/plugins/slots/session-mcp.8eb68fc9-B-Xa5onX.js +0 -2
  184. package/dist/assets/plugins/slots/skill.56c1cc07-BqmMUx5M.js +0 -4
  185. package/dist/assets/plugins/slots/subagents.31fc045b-BZXTwTSN.js +0 -7
  186. package/dist/assets/plugins/slots/template-advanced.9e8350fe-jSxtKth9.js +0 -1
  187. package/dist/assets/plugins/slots/template-desktop.69a46f62-IV-rW8Gz.js +0 -7
  188. package/dist/assets/plugins/slots/template-elegant.381f6acb-Dr2lz9D3.js +0 -1
  189. package/dist/assets/plugins/slots/vault.587549ba-CLv0qsTB.js +0 -1
  190. package/dist/assets/plugins/slots/voice.9c687181-d6cHs1CH.js +0 -1
  191. package/dist/assets/plugins/slots/workflows.8a13baad-B4cnDzRF.js +0 -16
  192. package/dist/workflowLibrary-DGa6qbh_.js +0 -59
@@ -1,9 +0,0 @@
1
- import{At as e,Bt as t,Ca as n,Ci as r,En as i,Ft as a,Ga as o,Gt as s,Ha as c,Ht as l,Ia as u,It as d,Jt as f,Kt as p,Ln as m,Lt as h,Mr as g,Pt as _,Qa as v,Qi as y,Rr as b,Sa as x,Ta as S,Vt as C,Yr as w,en as T,fa as E,gn as ee,hn as te,ia as ne,ji as D,jn as re,ka as O,kn as ie,ma as k,mn as ae,oi as oe,pn as A,qn as se,qr as j,qt as M,sa as N,ta as P,ua as ce,un as F}from"../chunks/po-web-runtime-Yjk5kSCS.js";var le=`/runners start`,I={command:'exec "${SHELL:-/bin/bash}" -l',name:`shell`,interactive:!0};function ue(e,t){let n=t.trim()===``?{}:{cwd:t};return e.trim()===``?{...I,...n}:{command:e,...n,preferInteractive:!0}}function L(e){return/\s/u.test(e)?`"${e}"`:e}function R(e){let t=e.cwd?.trim()??``,n=e.name?.trim()??``;return[le,...n===``?[]:[`name=${L(n)}`],...t===``?[]:[`cwd=${L(t)}`],...e.interactive===!0?[`interactive=true`]:e.preferInteractive===!0?[`interactive=prefer`]:[],`--`,e.command.trim()].join(` `)}var de=`runner_runs`,z=`/runners stop`,B=u({runs:[],stopRequested:[]});function V(e,t=Date.now()){return e.state===`running`&&t-Date.parse(e.startedAt)>3e3}var H={subscribe(e){let t,n=()=>{clearTimeout(t);let r=Date.now(),i=1/0;for(let e of Object.values(B.store.state))if(e)for(let t of e.runs){if(t.state!==`running`)continue;let e=Date.parse(t.startedAt)+3001;e>r&&(i=Math.min(i,e))}Number.isFinite(i)&&(t=setTimeout(()=>{e(),n()},Math.min(i-r,2147483647)))},r=B.store.subscribe(()=>{e(),n()});return n(),()=>{r.unsubscribe(),clearTimeout(t)}},isActive(e){return B.select(B.store.state,e).runs.some(e=>V(e))}};function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e,t,n){e(t,{type:`prompt`,message:`${z} ${n}`}),B.update(t,e=>({...e,stopRequested:[...e.stopRequested.filter(e=>e!==n),n]}))}function G(e,t,n){e(t,{type:`prompt`,message:R(n)})}var K=B.channel({channel:de,parse(e){if(!U(e)||!Array.isArray(e.runs))return null;let t=e.startFailure;return{runs:e.runs.filter(U),...typeof e.sessionDirectory==`string`?{sessionDirectory:e.sessionDirectory}:{},...U(t)&&typeof t.id==`string`&&typeof t.message==`string`?{startFailure:{id:t.id,message:t.message}}:{}}},reduce(e,t){let n=new Set(t.runs.filter(e=>e.state===`running`).map(e=>e.id));return{...t,stopRequested:e.stopRequested.filter(e=>n.has(e))}}});function fe(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`unknown`;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`${r}s`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function pe(e,t,n,r={}){let i=e.split(`
2
- `);i.length>0&&i[i.length-1]===``&&i.pop(),r.dropPartialTail===!0&&i.length>0&&i.pop();let a=[...i,...t],o=a.slice(-n);return{lines:o,hidden:a.length-o.length}}function me(e,t){let n=Math.max(1,e-t+1);return Array.from({length:t},(e,t)=>n+t)}function he(e,t,n){return e&&!t&&n}function ge(e,t){return e===``||e===t?t===void 0?`session directory`:t.split(`/`).pop()??t:t!==void 0&&e.startsWith(`${t}/`)?e.slice(t.length+1):e}function _e(e,t,n){let r=new Set([...e,t]);return r.delete(``),n!==void 0&&r.delete(n),[...r]}function ve(e){return e===void 0?{tone:`neutral`,label:`gone`}:e.state===`running`?{tone:`running`,label:`running`}:e.exit===void 0||e.exit.reason===`stopped`?{tone:`neutral`,label:`stopped`}:e.exit.reason===`completed`&&(e.exit.code===0||e.exit.code===null)?{tone:`ok`,label:`done`}:{tone:`error`,label:e.exit.reason.replace(`_`,` `)}}function ye({command:e,onCommandChange:t,cwd:n,onCwdChange:a,sessionDirectory:o,folders:s,problem:c,onLaunch:l,defaultFolderOpen:u=!1}){let[f,p]=M(u),[g,_]=M(``),v=ge(n,o),y=e=>{a(e),_(``),p(!1)},b=[{value:``,title:`Session directory`,subtitle:o??`Where this session started`},..._e(s,n,o).map(e=>({value:e,title:ge(e,o),subtitle:e}))];return h(`div`,{className:`flex shrink-0 flex-col gap-1.5 border-b border-po-border-soft px-3 py-3 sm:px-[26px]`,children:[h(`div`,{className:`flex flex-wrap items-center gap-2 sm:flex-nowrap`,children:[h(`span`,{className:`relative flex min-w-0 flex-1 basis-full items-center sm:basis-auto`,children:[d(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute left-3 font-mono text-base text-po-faint`,children:`$`}),d(T,{size:`lg`,"data-testid":`runners-panel-command`,"aria-label":`Command to run`,value:e,placeholder:`a command, like pnpm dev`,autoComplete:`off`,spellCheck:!1,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},className:`w-full pl-7 font-mono`})]}),h(re,{open:f,onOpenChange:p,children:[d(m,{asChild:!0,children:h(w,{variant:`outline`,size:`lg`,"data-testid":`runners-panel-cwd`,"aria-label":`Runs in ${v}`,"aria-invalid":c!==void 0||void 0,title:n===``?o:n,className:`max-w-56 gap-1.5 px-3 font-mono ${c===void 0?``:`border-po-red`}`,children:[d(k,{className:`h-3.5 w-3.5 shrink-0 text-po-faint`}),d(`span`,{className:`truncate`,children:v}),d(r,{className:`size-3.5 shrink-0 opacity-60`})]})}),d(i,{side:`bottom`,align:`start`,title:`Runs in`,items:b,value:[n],onSelect:y,footer:h(`span`,{className:`relative flex items-center px-3 py-2`,children:[d(k,{className:`pointer-events-none absolute left-5.5 h-3.5 w-3.5 text-po-faint`}),d(T,{"data-testid":`runners-panel-cwd-path`,"aria-label":`Another folder`,value:g,placeholder:`another folder, like packages/web`,spellCheck:!1,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g.trim()!==``&&y(g.trim())},className:`w-full pl-8 font-mono`})]})})]}),d(w,{variant:`primary`,size:`lg`,"data-testid":`runners-panel-run`,onClick:l,children:e.trim()===``?`Open shell`:`Run`})]}),c===void 0?d(`span`,{className:`text-sm text-po-dim`,children:`Runs in its own terminal and keeps going after Po's turn ends. Leave it empty for a plain shell.`}):h(`span`,{role:`alert`,"data-testid":`runners-panel-problem`,className:`flex items-center gap-1.5 text-sm text-po-red`,children:[d(P,{className:`size-3.5 shrink-0`}),c]})]})}var q=`runId`,be=`screen`,xe=`append`,J={lines:`lines`,grep:`grep`,ignoreCase:`ignoreCase`,contextLines:`contextLines`,from:`from`,generation:`generation`},Se={log:{method:`GET`,path:`/runners/:${q}/log`,query:[J.lines,J.grep,J.ignoreCase,J.contextLines],response:void 0},logStream:{method:`GET`,path:`/runners/:${q}/log/stream`,query:[J.from],stream:!0},screenStream:{method:`GET`,path:`/runners/:${q}/screen/stream`,query:[J.from],stream:!0},logRead:{method:`GET`,path:`/runners/:${q}/log/read`,query:[J.from],response:void 0},screenRead:{method:`GET`,path:`/runners/:${q}/screen/read`,query:[J.from,J.generation],response:void 0},input:{method:`POST`,path:`/runners/:${q}/screen/input`}},Y=x(Se,{scopes:[`session`],basePath:`runner`,transport:(t,n)=>e.fetch(t,n),sessionAddress:v});function Ce(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}var we=5,Te=500;function Ee(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function De(e,t,n,r){let i=n,a=0,o=!1,s,c,l=()=>{if(o)return;let n=new EventSource(Y.session(e).screenStream.url({params:{[q]:t},query:{[J.from]:i}}));s=n,n.addEventListener(be,e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(!Ee(t)||typeof t.chunk!=`string`)return;let s=t;typeof s.offset==`number`&&(i=s.offset),a=0,s.ended===!0&&(o=!0,n.close()),r.onEvent(s)}),n.addEventListener(`error`,()=>{n.close(),!o&&(a+=1,a>we?r.onLost():c=setTimeout(l,Te*2**(a-1)))})};return l(),{close:()=>{o=!0,c!==void 0&&clearTimeout(c),s?.close()}}}async function Oe(e,t,n){let r={text:n};return(await Y.session(e).input({params:{[q]:t},body:r})).ok}var ke=`The cockpit hub is unreachable.`;function Ae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function je(e,t,n={},r){let i=await Y.session(e).log({params:{[q]:t},query:{[J.lines]:n.lines,[J.grep]:n.grep===``?void 0:n.grep,[J.ignoreCase]:n.ignoreCase===!0||void 0,[J.contextLines]:n.contextLines},...r===void 0?{}:{signal:r}});return i.ok?!Ae(i.data)||typeof i.data.text!=`string`?{error:`The hub answered ${String(i.status)}.`}:{slice:i.data}:i.status===0?{error:r?.aborted===!0?``:ke}:{error:i.error===``?`The hub answered ${String(i.status)}.`:i.error}}var Me=5,Ne=500,Pe=2e3;function Fe(e,t,n,r){let i=n,a=0,o=!1,s=!1,c,l,u=new AbortController,d=new TextDecoder,f=``,p=e=>{o||(typeof e.offset==`number`&&(i=e.offset),e.ended===!0&&(o=!0,c?.close()),r.onEvent(e))},m=async()=>{if(o)return;let n=Pe;try{let r=await Y.session(e).logRead({params:{[q]:t},query:{[J.from]:i},signal:u.signal});if(o||!r.ok)return;let a=r.data;a.reset&&(d=new TextDecoder,f=``),f+=d.decode(Ce(a.chunk),{stream:!a.ended});let s=f.split(`
3
- `);f=s.pop()??``,a.ended&&f!==``&&(s.push(f),f=``),p({lines:s,offset:a.offset,ended:a.ended}),a.hasMore&&(n=0)}catch{}finally{o||(l=setTimeout(()=>void m(),n))}},h=()=>{if(o)return;let n;try{n=new EventSource(Y.session(e).logStream.url({params:{[q]:t},query:{[J.from]:i}}))}catch{m();return}c=n,n.addEventListener(`open`,()=>{s=!0}),n.addEventListener(xe,e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(!Ae(t)||!Array.isArray(t.lines))return;let n=t;s=!0,a=0,p(n)}),n.addEventListener(`error`,()=>{n.close(),!o&&(a+=1,!s||a>Me?m():l=setTimeout(h,Ne*2**(a-1)))})};return h(),{close:()=>{o=!0,l!==void 0&&clearTimeout(l),c?.close(),u.abort()}}}var Ie=`runner-log-`,Le=2e3,Re=2,ze=200,Be=24,X=1024,Ve=X*X;function Z(e){let t=e.id;return{id:`${Ie}${t}`,label:`log · ${e.name}`,panel:e=>d(Ge,{...e,runId:t})}}function He(e){return e<X?`${e} B`:e<Ve?`${(e/X).toFixed(1)} KB`:`${(e/Ve).toFixed(1)} MB`}function Ue(e,t,n){return t===``?!1:n?e.toLowerCase().includes(t.toLowerCase()):e.includes(t)}function We({number:e,line:t,matched:n,dimmed:r}){return h(`div`,{"data-testid":`runner-log-row`,"data-matched":n,className:`flex min-w-0 gap-2`,children:[e===void 0?null:d(`span`,{className:`w-12 shrink-0 select-none text-right font-mono text-sm leading-relaxed text-po-faint`,children:e}),d(`span`,{"aria-hidden":!0,className:`w-4 shrink-0 select-none font-mono text-sm leading-relaxed ${n?`text-po-yellow`:`text-po-faint`}`,children:n?`>>`:``}),d(ne,{line:t,className:`min-w-0 flex-1 whitespace-pre-wrap break-words font-mono text-sm leading-relaxed ${r?`text-po-dim`:`text-po-text`}`})]})}function Ge({sessionId:e,runId:n,sendSessionFrame:i,onTerminal:o}){let{runs:c,stopRequested:u}=_(B.store,t=>B.select(t,e)),f=c.find(e=>e.id===n),[m,v]=M(``),[y,b]=M(``),[x,S]=M(!1),[E,ee]=M(Re),[te,ne]=M(!0),[D,re]=M(void 0),[O,ie]=M(void 0),[k,ae]=M([]),[oe,A]=M(0),[j,N]=M(void 0),[P,ce]=M(!0),[F,le]=M(!1),I=p(null),ue=p(null),L=y!==``,R=he(te,L,D?.running===!0);l(()=>{let e=setTimeout(()=>b(m),ze);return()=>clearTimeout(e)},[m]);let de=t(t=>{e!==null&&je(e,n,L?{grep:y,ignoreCase:x,contextLines:E}:{},t).then(e=>{t.aborted||(`error`in e?e.error!==``&&N(e.error):(N(void 0),ae([]),A(0),re(e.slice),ie(e.slice.completeBytes)))})},[e,n,L,y,x,E]);l(()=>{let e=new AbortController;return de(e.signal),()=>e.abort()},[de]),l(()=>{if(!R||e===null||O===void 0)return;let t=Fe(e,n,O,{onEvent:e=>{e.lines.length>0&&ae(t=>[...t,...e.lines].slice(-2e3)),typeof e.offset==`number`&&A(e.offset),e.ended===!0&&ne(!1)}});return()=>t.close()},[R,e,n,O]);let z=D!==void 0&&D.exists&&D.completeBytes<D.fileSize,V=pe(D?.text??``,k,Le,{dropPartialTail:R&&z}),H=s(()=>D===void 0?[]:L?D.lineNumbers??[]:me(D.totalLines+k.length-(R&&z?1:0),V.lines.length),[D,L,k.length,R,z,V.lines.length]);l(()=>{R&&P&&I.current?.scrollIntoView({block:`end`})},[R,P,V.lines.length]);let U=()=>{let e=ue.current;e!==null&&ce(e.scrollHeight-e.scrollTop-e.clientHeight<=Be)},G=ve(f),K=f!==void 0&&u.includes(f.id);return h(`div`,{"data-testid":`runner-log-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[h(`div`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-2 border-b border-po-border-soft px-3 py-2 sm:h-11 sm:flex-nowrap sm:gap-2.5 sm:px-[26px] sm:py-0`,children:[d(`span`,{"data-testid":`runner-log-name`,className:`shrink-0 truncate text-base font-semibold text-po-hi`,children:f?.name??n}),d(g,{tone:G.tone,size:`md`,"data-testid":`runner-log-state`,children:G.label}),f?h(a,{children:[d(Ke,{run:f}),d(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`pid ${String(f.pid)} · ${f.backend}${f.interactive?` · tty`:``}`})]}):d(`span`,{"data-testid":`runner-log-gone`,className:`text-sm text-po-dim`,children:`no longer listed; its log stays readable`}),d(`span`,{className:`min-w-0 flex-1`}),o?d(w,{variant:`outline`,size:`sm`,"data-testid":`runner-log-terminal`,onClick:o,children:`Back to terminal`}):null,f!==void 0&&f.state===`running`&&e!==null?d(w,{variant:K?`outline`:`danger-outline`,size:`sm`,"data-testid":`runner-log-stop`,disabled:K,title:K?`stop requested; the runner reports its own exit`:`ask the runtime to stop this runner`,onClick:()=>W(i,e,f.id),children:K?`Stopping…`:`Stop`}):null]}),f?d(`div`,{className:`shrink-0 border-b border-po-border-soft px-3 py-3 sm:px-[26px]`,children:h(`div`,{className:`flex items-start gap-2 rounded-md bg-po-deep px-3 py-2`,children:[h(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[h(`span`,{"data-testid":`runner-log-command`,title:F?void 0:`${f.command}\nin ${f.cwd}`,className:`font-mono text-base text-po-hi ${F?`break-all`:`truncate`}`,children:[h(`span`,{"aria-hidden":!0,className:`select-none text-po-faint`,children:[`$`,` `]}),f.command]}),F?h(`span`,{className:`break-all font-mono text-sm text-po-dim`,children:[`in `,f.cwd]}):null]}),d(`button`,{type:`button`,"data-testid":`runner-log-command-toggle`,"aria-expanded":F,"aria-label":F?`Collapse command`:`Expand command`,className:`flex size-6 shrink-0 items-center justify-center rounded text-po-faint hover:text-po-hi`,onClick:()=>le(e=>!e),children:d(r,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})})]})}):null,h(`div`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-2 border-b border-po-border-soft px-3 py-2 sm:flex-nowrap sm:gap-2.5 sm:px-[26px]`,children:[h(`span`,{className:`relative flex min-w-0 flex-1 items-center sm:w-72 sm:flex-none`,children:[d(se,{className:`pointer-events-none absolute left-2.5 h-3.5 w-3.5 text-po-faint`}),d(T,{size:`md`,"data-testid":`runner-log-search`,value:m,placeholder:`Search output`,onChange:e=>v(e.target.value),className:`w-full pl-8`})]}),d(w,{variant:x?`subtle`:`outline`,size:`sm`,"data-testid":`runner-log-ignore-case`,"aria-pressed":x,title:`match regardless of case`,onClick:()=>S(e=>!e),children:x?`Any case`:`Match case`}),d(w,{variant:E>0&&L?`subtle`:`outline`,size:`sm`,"data-testid":`runner-log-context`,disabled:!L,title:`lines of context kept either side of a match`,onClick:()=>ee(e=>e===0?Re:0),children:`± ${String(E)} lines`}),d(`span`,{className:`min-w-0 flex-1`}),h(`span`,{"data-testid":`runner-log-stats`,className:`min-w-0 basis-full truncate text-sm text-po-dim sm:basis-auto`,children:[D===void 0?`reading…`:L?`${String(D.lineCount)} matching of ${D.totalLines.toLocaleString(`en-US`)} lines`:`${R?`tailing`:`showing`} last ${String(V.lines.length)} of ${(D.totalLines+(R?k.length:0)).toLocaleString(`en-US`)} lines`,V.hidden>0?` · ${V.hidden.toLocaleString(`en-US`)} older hidden`:``]}),d(w,{variant:R?`subtle`:`outline`,size:`sm`,"data-testid":`runner-log-follow`,"aria-pressed":R,disabled:L||D?.running!==!0,title:L?`a filtered view is a snapshot; clear the query to follow`:`follow the log as it grows`,onClick:()=>ne(e=>!e),children:L?`Paused while searching`:R?`Following`:`Follow`})]}),h(`div`,{className:`relative min-h-0 flex-1`,children:[h(`div`,{ref:ue,onScroll:U,"data-testid":`runner-log-body`,className:`h-full overflow-auto bg-po-deep px-3 py-3 sm:px-[26px]`,children:[j===void 0?D===void 0?d(`p`,{"data-testid":`runner-log-reading`,className:`text-sm text-po-dim`,children:`reading…`}):D.exists===!1?d(`p`,{className:`text-sm text-po-dim`,children:`This runner has not printed anything yet.`}):V.lines.length===0?d(`p`,{className:`text-sm text-po-dim`,children:L?`Nothing matched.`:`The log is empty.`}):V.lines.map((e,t)=>{let n=H[t],r=H[t-1],i=r!==void 0&&n!==void 0&&n-r>1;return h(C,{children:[i?d(`div`,{"data-testid":`runner-log-gap`,"aria-hidden":!0,className:`select-none py-0.5 pl-14 text-sm leading-relaxed text-po-faint`,children:`⋯`}):null,d(We,{number:n,line:e,matched:L&&Ue(e,y,x),dimmed:L&&!Ue(e,y,x)})]},n??`row-${String(t)}`)}):d(`p`,{"data-testid":`runner-log-error`,className:`text-sm text-po-red`,children:j}),d(`div`,{ref:I})]}),R&&!P?d(w,{variant:`subtle`,size:`sm`,"data-testid":`runner-log-jump`,title:`scroll back to the newest lines and keep following`,onClick:()=>{ce(!0),I.current?.scrollIntoView({block:`end`})},className:`absolute bottom-3 right-3`,children:`Jump to latest`}):null]}),h(`div`,{className:`flex h-8 shrink-0 items-center gap-2.5 border-t border-po-border-soft px-3 sm:px-[26px]`,children:[d(`span`,{"data-testid":`runner-log-path`,className:`min-w-0 flex-1 truncate font-mono text-sm text-po-dim`,children:f?.logPath??D?.path??``}),D===void 0?null:d(`span`,{className:`shrink-0 text-sm text-po-dim`,children:He(Math.max(D.fileSize,oe))})]})]})}function Ke({run:e}){let t=p(null),[n]=M(Date.now);return l(()=>{if(e.exit||e.state!==`running`)return;let n=()=>{let n=t.current?.firstChild;n&&(n.nodeValue=fe(e.startedAt,Date.now()))};n();let r=setInterval(n,1e3);return()=>clearInterval(r)},[e.startedAt,e.state,e.exit]),d(`span`,{ref:t,className:`shrink-0 text-sm text-po-dim`,children:fe(e.startedAt,e.exit?Date.parse(e.exit.finishedAt):n)})}var qe=30;function Je({sessionId:e,runId:t,sendSessionFrame:n,openTransientTab:r,onSearch:i}){let{runs:a,stopRequested:o}=_(B.store,t=>B.select(t,e)),s=a.find(e=>e.id===t),[c,u]=M(!1),[f,m]=M(!1),[v,y]=M(!1),b=p(null),x=p([]),S=p(void 0);l(()=>{if(e===null||!v)return;let n=De(e,t,0,{onEvent:e=>{e.chunk!==``&&b.current?.write(Ce(e.chunk)),e.ended===!0&&u(!0)},onLost:()=>m(!0)});return()=>n.close()},[e,t,v]),l(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);let C=n=>{e!==null&&(x.current.push(n),S.current===void 0&&(S.current=setTimeout(()=>{let n=x.current.join(``);x.current=[],S.current=void 0,n!==``&&Oe(e,t,n)},qe)))},T=s?.state===`running`&&!c,E=o.includes(t);return h(`div`,{"data-testid":`runner-shell-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[h(`div`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-2 border-b border-po-border-soft px-3 py-2 sm:flex-nowrap sm:gap-2.5 sm:px-[26px] sm:py-1.5`,children:[d(`span`,{"data-testid":`runner-shell-name`,className:`shrink-0 truncate text-base font-semibold text-po-hi`,children:s?.name??t}),d(g,{tone:T?`running`:`neutral`,size:`md`,"data-testid":`runner-shell-state`,children:T?`Running`:`Ended`}),s?d(`span`,{className:`min-w-0 truncate font-mono text-sm text-po-dim`,children:s.command}):null,d(`span`,{className:`min-w-0 flex-1`}),f?d(`span`,{"data-testid":`runner-shell-lost`,className:`shrink-0 text-sm text-po-red`,children:`The connection to this terminal dropped. Reopen the runner to attach again.`}):null,s?h(w,{variant:`outline`,size:`sm`,"data-testid":`runner-shell-search`,title:`search everything this runner has printed`,onClick:()=>i?i():r(Z(s)),className:`gap-1.5`,children:[d(se,{className:`h-3.5 w-3.5`}),`Search output`]}):null,T?d(w,{variant:`outline`,size:`sm`,"data-testid":`runner-shell-interrupt`,title:`send ctrl-c`,onClick:()=>C(``),children:`Ctrl-C`}):null,T&&e!==null?d(w,{variant:E?`outline`:`danger-outline`,size:`sm`,"data-testid":`runner-shell-stop`,disabled:E,title:E?`stop requested; the runner reports its own exit`:`ask the runtime to stop this runner`,onClick:()=>W(n,e,t),children:E?`Stopping…`:`Stop`}):null]}),h(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-po-deep px-3 py-2 sm:px-[26px]`,children:[d(j,{ref:b,"data-testid":`runner-shell-terminal`,onData:e=>C(e),onReady:()=>y(!0)}),v?null:d(`p`,{"data-testid":`runner-shell-reading`,className:`text-sm text-po-dim`,children:`attaching…`})]}),d(`div`,{className:`flex h-8 shrink-0 items-center border-t border-po-border-soft px-3 sm:px-[26px]`,children:d(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,children:T?`Typing goes straight to ${s?.name??`the runner`}. Ctrl-C stops what is running.`:`This runner has ended. Its output stays searchable.`})})]})}var Ye=3e4,Xe=`runner-runs`;function Ze(){return{id:Xe,label:`runners`,panel:Qe}}function Qe(e){let{sessionId:t,sendSessionFrame:n}=e,r=_(B.store,e=>B.select(e,t)),i=r.runs.filter(e=>e.state===`running`),[o,s]=M(``),[c,u]=M(``),[f,m]=M(void 0),[g,v]=M(void 0),b=p(null),x=p(``),S=p(void 0),C=i.find(e=>e.id===f)??i[0],T=()=>{t!==null&&(b.current=new Set(r.runs.map(e=>e.id)),clearTimeout(S.current),S.current=setTimeout(()=>{b.current=null},Ye),G(n,t,ue(o,c)),x.current=o,s(``))};l(()=>{let e=b.current;if(e===null)return;let t=r.runs.find(t=>t.state===`running`&&!e.has(t.id));t&&(b.current=null,clearTimeout(S.current),m(t.id))},[r.runs]);let E=r.startFailure?.id;return l(()=>{E!==void 0&&b.current!==null&&(b.current=null,clearTimeout(S.current),s(x.current))},[E]),l(()=>()=>clearTimeout(S.current),[]),h(`div`,{"data-testid":`runners-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[h(`div`,{className:`flex h-11 shrink-0 items-center gap-2.5 border-b border-po-border-soft px-3 sm:px-[26px]`,children:[d(`span`,{className:`text-lg font-semibold text-po-hi`,children:`Runners`}),d(`span`,{"data-testid":`runners-panel-count`,className:`text-sm text-po-dim`,children:i.length===0?`Nothing running`:`${String(i.length)} running`})]}),t===null?null:d(ye,{command:o,onCommandChange:s,cwd:c,onCwdChange:u,folders:i.map(e=>e.cwd),...r.sessionDirectory===void 0?{}:{sessionDirectory:r.sessionDirectory},...r.startFailure===void 0?{}:{problem:r.startFailure.message},onLaunch:T}),C===void 0?d(N,{"data-testid":`runners-panel-empty`,className:`px-4 py-8`,title:`Nothing running yet`,description:t===null?`Open a session to start a runner.`:`Type a command above, like pnpm dev, and it opens here as a live terminal.`}):h(a,{children:[d(`div`,{"data-testid":`runners-panel-picker`,className:`flex shrink-0 flex-wrap gap-1.5 px-3 pt-3 sm:px-[26px]`,children:i.map(e=>h(w,{variant:e===C?`subtle`:`ghost`,size:`sm`,"data-testid":`runners-panel-pick-${e.id}`,"aria-pressed":e===C,title:e.command,onClick:()=>m(e.id),className:`gap-1.5 ${e===C?`text-po-hi`:``}`,children:[d(y,{tone:`yellow`,pulse:!0}),e.name]},e.id))}),d(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col border-t border-po-border-soft`,children:C.interactive&&g!==C.id?d(Je,{...e,runId:C.id,onSearch:()=>v(C.id)},C.id):d(Ge,{...e,runId:C.id,...C.interactive?{onTerminal:()=>v(void 0)}:{}},C.id)})]})]})}var $e=n({keys:`r l`,icon:ie,activeSource:H,transientTab:Ze,order:20}),et=S(K),tt=5;function nt(e){for(let t=e.length-1;t>=0;--t){let n=oe(e[t]??``).map(e=>e.text).join(``).trim();if(n.length>0)return n}}function rt(e,t,n){let[r,i]=M(void 0);return l(()=>{if(!n||e===null)return;let r=!0,a,o=new AbortController;return je(e,t,{lines:tt},o.signal).then(n=>{if(!r||`error`in n)return;let o=nt(n.slice.text.split(`
4
- `));o!==void 0&&i({runId:t,text:o}),n.slice.running&&(a=Fe(e,t,n.slice.completeBytes,{onEvent:e=>{let n=nt(e.lines);r&&n!==void 0&&i({runId:t,text:n})}}))}),()=>{r=!1,o.abort(),a?.close()}},[e,t,n]),n&&r?.runId===t?r.text:void 0}function it({sessionId:e,sendSessionFrame:t,openTransientTab:n}){let r=_(B.store,t=>B.select(t,e)),i=()=>r.runs.filter(e=>V(e)).length;f(H.subscribe,i,i);let a=r.runs.filter(e=>V(e));return a.length===0?h(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[d(`p`,{"data-testid":`activity-summary-runners`,className:`text-sm text-po-dim`,children:`Idle`}),e===null?null:h(w,{variant:`link`,size:`sm`,"data-testid":`activity-runner-launch`,className:`h-auto gap-1 px-0 text-po-green`,onClick:()=>n(Ze()),children:[`Launch a runner`,d(F,{"aria-hidden":!0,className:`size-3.5`})]})]}):d(`div`,{"data-testid":`activity-runner-runs`,className:`flex flex-col gap-0.5`,children:a.map(i=>d(at,{run:i,stopRequested:r.stopRequested.includes(i.id),sessionId:e,sendSessionFrame:t,openTransientTab:n},i.id))})}function at({run:e,stopRequested:t,sessionId:n,sendSessionFrame:r,openTransientTab:i}){let a=rt(n,e.id,e.state===`running`);return h(w,{variant:`ghost`,size:`card`,"data-testid":`activity-runner-${e.id}`,"data-runner-tone":`running`,title:`open this runner's log`,onClick:()=>{n!==null&&i(Z(e))},className:`min-w-0 gap-0.5 rounded-md px-1 py-1 hover:bg-po-panel`,children:[h(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[d(y,{tone:`yellow`,pulse:!0}),d(`span`,{className:`min-w-0 flex-1 truncate text-left text-base font-semibold text-po-hi`,children:e.name}),h(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[d(Ke,{run:e}),e.interactive?` · tty`:``]}),n===null?null:d(w,{asChild:!0,variant:t?`outline`:`danger-outline`,size:`xs`,"data-testid":`activity-runner-stop-${e.id}`,"data-stopping":t,title:t?`stop requested; the runner reports its own exit`:`ask the runtime to stop this runner`,className:`px-1.5`,children:d(`span`,{role:`button`,tabIndex:t?-1:0,"aria-disabled":t,onClick:i=>{i.stopPropagation(),t||W(r,n,e.id)},onKeyDown:i=>{(i.key===`Enter`||i.key===` `)&&(i.preventDefault(),i.stopPropagation(),t||W(r,n,e.id))},children:t?`stopping…`:`stop`})})]}),d(`span`,{"data-testid":`activity-runner-detail-${e.id}`,"data-detail":a===void 0?`command`:`tail`,className:`truncate pl-3 text-left text-sm text-po-dim`,children:a??e.command})]})}var ot=O({component:it}),st=`…`,ct=` … `,lt=160,ut=12,Q=1024,dt=Q*Q,ft=/(?<![\w.-])(?:\/Users|\/home)\/[^/\s]+(?=\/|\s|$)/g;function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mt(e){if(!pt(e))return{};let t={};return typeof e.id==`string`&&(t.id=e.id),typeof e.runner==`string`&&(t.runner=e.runner),(typeof e.exitCode==`number`||e.exitCode===null)&&(t.exitCode=e.exitCode),typeof e.logPath==`string`&&(t.logPath=e.logPath),typeof e.fileSize==`number`&&(t.fileSize=e.fileSize),typeof e.lines==`number`&&(t.lines=e.lines),e.timedOut===!0&&(t.timedOut=!0),e.promoted===!0&&(t.promoted=!0),typeof e.reason==`string`&&(t.reason=e.reason),typeof e.tail==`string`&&(t.tail=e.tail),typeof e.tailLines==`number`&&(t.tailLines=e.tailLines),typeof e.sequenceId==`string`&&(t.sequenceId=e.sequenceId,Array.isArray(e.stages)&&(t.stages=e.stages.flatMap(e=>!pt(e)||!Number.isInteger(e.index)||Number(e.index)<0||typeof e.state!=`string`?[]:[{index:Number(e.index),state:e.state,...typeof e.logPath==`string`?{logPath:e.logPath}:{}}]))),t}function ht(e){return e.replace(ft,`~`)}function gt(e){let t=e.split(`
5
- `).map(e=>e.trim()).filter(e=>e.length>0),n=t[0]??``;return t.length>1?`${n} ${st} +${t.length-1} lines`:n}function _t(e,t=lt){if(e.length<=t)return e;let n=t-3,r=Math.ceil(n/2),i=e.slice(0,r),a=e.slice(e.length-(n-r)),o=i.lastIndexOf(` `);o>i.length/2&&(i=i.slice(0,o));let s=a.indexOf(` `);return s>=0&&s<a.length/2&&(a=a.slice(s+1)),`${i}${ct}${a}`}function vt(e){return typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`
6
-
7
- `):``}function yt(e){let t=vt(e);if(t.length===0)return``;let n=Array.isArray(e)?vt(e[0]):t,r=Array.isArray(e)&&e.length>1?` ${st} +${e.length-1} commands`:``;return _t(`${ht(gt(n))}${r}`)}function bt(e){let t=[];return e.background===!0&&t.push(`bg`),e.interactive===!0&&t.push(`tty`),typeof e.timeout==`number`&&t.push(`${e.timeout}s`),typeof e.name==`string`&&e.name.length>0&&t.push(e.name),t}function xt(e){return e<Q?`${e} B`:e<dt?`${(e/Q).toFixed(1)} KB`:`${(e/dt).toFixed(1)} MB`}function St(e){let t=[];return e.lines!==void 0&&t.push(`${e.lines.toLocaleString(`en-US`)} lines`),e.fileSize!==void 0&&t.push(xt(e.fileSize)),e.runner!==void 0&&t.push(e.runner),t.join(` · `)}function Ct(e,t){let n=e.split(`
8
- `);for(;n.length>0&&n[n.length-1]?.trim()===``;)n.pop();return n.length<=t?n:n.slice(-t)}function wt(e){let t=mt(e.details),n=(t.stages??[]).flatMap(e=>e.logPath===void 0?[]:[`stage ${e.index+1} · ${e.state} · ${e.logPath}`]);if(e.isPartial)return{lines:[...n,...Ct(e.output,ut)],status:{glyph:`◐`,tone:`running`,text:`running`},hidden:0};if(e.isError){let r=Ct(t.sequenceId===void 0?e.output:t.tail??e.output,2**53-1),i=[...n,...e.expanded?r:r.slice(-12)],a=St(t);return{lines:i,status:{glyph:`✗`,tone:`error`,text:a.length>0?a:`failed`},hidden:Math.max(0,r.length+n.length-i.length)}}if(t.promoted===!0)return{lines:n,status:{glyph:`●`,tone:`background`,text:`${t.runner??t.id??`runner`}${t.id===void 0?``:` · ${t.id}`} · background`},hidden:0};let r=Ct(t.tail??(t.sequenceId===void 0?``:e.output),2**53-1),i=[...n,...e.expanded?r:r.slice(-12)],a=t.exitCode!==void 0&&t.exitCode!==null,o=t.timedOut===!0||a&&t.exitCode!==0,s=[];t.timedOut===!0?s.push(`timed out`):o&&s.push(`exit ${t.exitCode}`);let c=St(t);c.length>0&&s.push(c);let l=s.length>0?s.join(` · `):o?`failed`:i.length===0?`done`:``;return{lines:i,status:l.length>0?{glyph:o?`✗`:`✓`,tone:o?`error`:`ok`,text:l}:null,hidden:Math.max(0,r.length+n.length-i.length)}}function Tt(e){if(e===void 0)return{tone:`info`,badge:`In background`};if(e.exit===void 0)return{tone:`running`,badge:`In background`};let{reason:t,code:n}=e.exit,r=n===null?``:` · exit ${n}`;return t===`completed`?{tone:`ok`,badge:`Completed${r}`}:t===`stopped`?{tone:`neutral`,badge:`Stopped`}:{tone:`error`,badge:`Failed${r}`}}var Et={running:`running`,ok:`ok`,error:`error`,background:`info`};function Dt({sessionId:e,args:t,result:n,output:r,running:i,isError:o,sendSessionFrame:s,openTransientTab:c}){let l=mt(n?.details),u=l.sequenceId===void 0?l.id:void 0,f=l.promoted===!0?u:void 0,p=_(B.store,t=>u===void 0?void 0:B.select(t,e).runs.find(e=>e.id===u)),m=_(B.store,t=>f!==void 0&&B.select(t,e).stopRequested.includes(f)),g=vt(t.command),v=yt(t.command),y=bt(t),x=e!==null&&f!==void 0&&p!==void 0&&p.exit===void 0,S=f===void 0?void 0:Tt(p);return d(A,{tone:S?.tone??D({running:i,isError:o}),expandable:!0,children:({expanded:t})=>{let u=wt({details:n?.details,output:r,expanded:!0,isPartial:i,isError:o});return h(a,{children:[h(te,{title:`bash`,...S?{badge:S.badge}:{},children:[h(`span`,{"data-testid":`tool-call-bash`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[d(`span`,{className:`min-w-0 flex-1 truncate font-mono text-po-text`,children:v}),y.length>0?h(`span`,{className:`hidden shrink-0 text-po-dim sm:inline`,children:[`· `,y.join(` · `)]}):null]}),p!==void 0&&e!==null?h(w,{variant:`outline`,size:`xs`,"data-testid":`tool-result-bash-open-log`,title:`open this runner's full log`,onClick:e=>{e.stopPropagation(),c(Z(p))},className:`shrink-0 gap-1 px-1.5 `,children:[d(ce,{className:`h-2.5 w-2.5`}),`log`]}):null,x?d(w,{size:`xs`,variant:m?`outline`:`danger-outline`,disabled:m,"data-testid":`tool-result-bash-stop`,"data-stopping":m,title:m?`stop requested; the runner reports its own exit`:`ask the runtime to stop this runner`,onClick:t=>{t.stopPropagation(),e!==null&&f!==void 0&&W(s,e,f)},className:`shrink-0 px-1.5 `,children:m?`stopping…`:`stop`}):null]}),t?h(ae,{"data-testid":`tool-result-bash`,className:`flex flex-col gap-2`,children:[g.length>0?d(b,{"data-testid":`tool-result-bash-command`,grammar:`shell`,text:g,className:`max-h-40 overflow-auto text-po-text`}):null,u.lines.length>0?d(E,{"data-testid":`tool-result-bash-output`,text:u.lines.join(`
9
- `),className:`max-h-96 overflow-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere] border-po-border-soft border-t pt-2 font-mono text-po-dim`}):null,u.status?d(ee,{"data-testid":`tool-result-bash-status`,tone:Et[u.status.tone],glyph:u.status.glyph,className:`min-w-0`,children:d(`span`,{className:`break-words`,children:u.status.text})}):null,l.sequenceId===void 0&&l.logPath!==void 0?h(`span`,{"data-testid":`tool-result-bash-log`,className:`min-w-0 break-all text-po-dim`,children:[`full log · `,d(`span`,{className:`text-po-dim`,children:l.logPath})]}):null]}):null]})}})}var Ot=c({message:Dt}),$=(e,t)=>t===void 0?void 0:{...e,...t},kt=o({id:`runner`,packageName:`@agimon-ai/po-runner`,session:{get activityGroups(){return[$({name:`runners`},$e)]},get channels(){return[$({channel:`runner_runs`},et)]},get fills(){return[$({slot:`activity.runners`,id:`runners`},ot)]},get toolRenderers(){return[$({tools:[`bash`]},Ot)]}}});export{kt as webPlugin};
@@ -1 +0,0 @@
1
- import{At as e,Bt as t,Ft as n,Ga as r,Gi as i,Ht as a,Ir as o,It as s,Ki as c,La as l,Lt as u,Na as d,Qa as f,Sa as p,Ti as m,Ui as h,Wi as g,Xi as _,Yi as v,Yr as y,_r as b,dr as x,ei as S,fr as C,gr as w,hr as T,in as E,ma as D,mr as O,or as k,pr as A,qi as ee,qt as j,sa as M,tr as N,vr as P}from"../chunks/po-web-runtime-Yjk5kSCS.js";var F=p({listSets:{method:`GET`,path:`/sets`,response:void 0},setEnabled:{method:`PUT`,path:`/sets/enabled`,response:void 0},removeSet:{method:`DELETE`,path:`/sets`,query:[`id`,`scope`],response:void 0}},{scopes:[`host`,`workspace`,`session`],basePath:`scaffolds`,transport:(t,n)=>e.fetch(t,n),sessionAddress:f});async function I(e,t){let n=await e.json().catch(()=>void 0);if(!e.ok)throw Error(typeof n?.error==`string`?n.error:t);return n}var L=e=>e?F.workspace(e):F.host;async function R(e,t){return I(await e(L(t).listSets.url()),`Po could not read your template sets.`)}async function z(e,t,n){let r=L(n).setEnabled;return I(await e(r.url(),{method:r.spec.method,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),`Po could not change this template set.`)}async function B(e,t,n){let r=L(n).removeSet;return I(await e(r.url({query:{id:t.id,...t.scope?{scope:t.scope}:{}}}),{method:r.spec.method}),`Po could not remove this template set.`)}function V(e,t){switch(e){case`builtin`:return{label:`Built in`,tone:`neutral`};case`plugin`:return{label:`Plugin`,tone:`blue`};case`host`:return t===`org`?{label:`Your org`,tone:`cyan`}:{label:`This computer`,tone:`magenta`};case`personal`:return{label:`Yours`,tone:`magenta`};case`workspace`:return{label:`This repository`,tone:`magenta`}}}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function U({set:e,host:t}){let r=V(e.origin,t);return u(n,{children:[s(N,{tone:r.tone,children:r.label}),e.overrides?u(N,{children:[`Replaces `,V(e.overrides,t).label.toLowerCase()]}):null,e.error?s(N,{tone:`red`,children:`Can't be read`}):null]})}function W(e){let t=e.templates.filter(e=>e.kind===`boilerplate`).length,n=e.templates.length-t,r=e.origin===`plugin`&&e.owner?` from ${e.owner}`:``;return`${H(t,`starter`)}, ${H(n,`feature`)}${r}`}function G(e){let t=e.variablesSchema,n=new Set(Array.isArray(t.required)?t.required.map(String):[]);return Object.keys(t.properties??{}).map(e=>({name:e,required:n.has(e)})).sort((e,t)=>Number(t.required)-Number(e.required))}function K({set:e,scope:t,label:n,checked:r=e.enabled,busy:i,onToggle:a}){return s(o,{"aria-label":n,checked:r&&!e.error,disabled:i!==void 0||!!e.error,onCheckedChange:n=>a?.(e.id,n,t)})}function q(e,t){return e.personal?{scope:`personal`,label:`Agents can use ${t.label} in your sessions`}:{scope:e.scope,label:`Agents can use ${t.label}`}}function J({set:e,host:t}){return e.origin===`personal`?s(n,{children:`Saved by you`}):e.origin===`host`&&t===`org`?s(n,{children:`Saved for your org`}):e.path?s(`span`,{className:`font-mono break-all`,children:e.path}):e.owner?s(`span`,{className:`font-mono`,children:e.owner}):s(n,{children:`Ships with Po`})}function Y(e){let{sets:t,busy:n}=e;return t.length===0?s(M,{title:`No template sets yet`,description:`Ask Po in Help mode to save one, and it appears here.`,className:`py-12`}):s(k,{asChild:!0,children:s(`ul`,{"aria-label":`Template sets`,children:t.map(t=>s(x,{asChild:!0,children:u(`li`,{"data-testid":`scaffold-set-${t.id}`,"aria-busy":n===t.id,children:[u(A,{children:[u(O,{className:`flex flex-wrap items-center gap-2`,children:[t.label,s(U,{set:t,host:e.host})]}),t.description?s(C,{children:t.description}):null,t.error?s(C,{className:`text-po-red first-letter:normal-case`,children:t.error}):s(C,{children:W(t)})]}),u(`div`,{className:`flex items-center gap-2`,children:[s(K,{set:t,busy:n,onToggle:e.onToggle,...q(e,t)}),s(y,{variant:`ghost`,size:`icon`,"aria-label":`Open ${t.label}`,onClick:()=>e.onOpen?.(t.id),children:s(m,{className:`size-3.5`})})]})]})},t.id))})})}function X(e){let{set:t,scope:r,busy:i,host:a}=e,o=t.origin===r||e.personal===!0&&t.origin===`personal`;return u(`div`,{className:`flex flex-col gap-5`,children:[s(`div`,{children:u(y,{variant:`ghost`,size:`sm`,onClick:e.onBack,children:[s(E,{className:`size-3.5`}),`All template sets`]})}),u(T,{children:[u(b,{children:[u(P,{className:`flex flex-wrap items-center gap-2`,children:[t.label,s(U,{set:t,host:a})]}),t.description?s(w,{children:t.description}):null]}),u(k,{children:[e.personal?u(n,{children:[t.origin===`personal`||a!==`org`?null:u(x,{children:[u(A,{children:[s(O,{children:`On for everyone in your org`}),s(C,{children:`Your org's choice. Anyone in the org can change it.`})]}),s(K,{set:t,scope:`host`,label:`Everyone in your org can use ${t.label}`,checked:t.hostEnabled??t.enabled,busy:i,onToggle:e.onToggle})]}),u(x,{children:[u(A,{children:[s(O,{children:`On in your sessions`}),s(C,{children:t.origin===`personal`?`Only you see this set.`:`Only you. Overrides your org's choice.`})]}),s(K,{set:t,scope:`personal`,label:`Agents can use ${t.label} in your sessions`,busy:i,onToggle:e.onToggle})]})]}):u(x,{children:[u(A,{children:[s(O,{children:`Agents can use this set`}),s(C,{children:r===`workspace`?`Applies to sessions in this repository, even if the set is off on this computer.`:`Applies to every repository that has not chosen otherwise.`})]}),s(K,{set:t,scope:r,label:`Agents can use ${t.label}`,busy:i,onToggle:e.onToggle})]}),u(x,{children:[u(A,{children:[s(O,{children:`Source`}),s(C,{className:`first-letter:normal-case`,children:s(J,{set:t,host:a})})]}),o?u(y,{variant:`danger-outline`,size:`sm`,disabled:i!==void 0,onClick:()=>e.onAskRemove?.(t.id),children:[s(S,{className:`size-3.5`}),`Remove set`]}):null]})]}),t.error?s(`p`,{role:`alert`,className:`text-sm text-po-red`,children:t.error}):null]}),t.templates.length>0?u(T,{children:[u(b,{children:[s(P,{children:`Templates`}),s(w,{children:`What an agent can start or add with this set, and what it asks for.`})]}),s(k,{asChild:!0,children:s(`ul`,{"aria-label":`Templates in ${t.label}`,children:t.templates.map(e=>s(x,{asChild:!0,children:s(`li`,{children:u(A,{children:[u(O,{className:`flex flex-wrap items-center gap-2`,children:[s(`span`,{className:`font-mono`,children:e.name}),s(N,{tone:e.kind===`boilerplate`?`teal`:`violet`,children:e.kind===`boilerplate`?`Starter`:`Feature`})]}),e.description?s(C,{children:e.description}):null,G(e).length>0?s(C,{className:`flex flex-wrap gap-1.5`,children:G(e).map(e=>u(`span`,{className:`font-mono`,children:[e.name,e.required?``:`?`]},e.name))}):null]})})},`${e.kind}:${e.name}`))})})]}):null,t.files&&t.files.length>0?u(T,{children:[s(b,{children:s(P,{children:`Files`})}),s(k,{asChild:!0,children:s(`ul`,{"aria-label":`Files in ${t.label}`,children:t.files.map(e=>s(x,{asChild:!0,className:`py-2`,children:s(`li`,{className:`font-mono text-sm break-all text-po-text`,children:e})},e))})})]}):null]})}function Z(e){let{sets:t,error:r,selected:a,confirming:o,busy:l}=e,d=a===void 0?void 0:t?.find(e=>e.id===a),f=o===void 0?void 0:t?.find(e=>e.id===o);return u(`div`,{"data-testid":`scaffold-library`,className:`flex flex-col gap-3`,children:[r?s(`p`,{role:`alert`,className:`text-sm text-po-red`,children:r}):null,t===void 0?s(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading template sets…`}):d?s(X,{...e,set:d}):s(Y,{...e,sets:t}),s(h,{open:f!==void 0,onOpenChange:t=>t?void 0:e.onCancelRemove?.(),children:u(i,{children:[s(v,{children:u(_,{children:[`Remove `,f?.label,`?`]})}),s(g,{children:s(c,{children:f?.origin===`personal`?`Its files are deleted. Your sessions stop offering it at once.`:f?.origin===`host`&&e.host===`org`?`Its files are deleted for everyone in your org. Agents stop offering it at once.`:u(n,{children:[`Its folder `,s(`span`,{className:`font-mono`,children:f?.path}),` and every file in it are deleted. Agents stop offering it at once.`]})})}),u(ee,{children:[s(y,{onClick:e.onCancelRemove,children:`Keep set`}),s(y,{variant:`danger-outline`,disabled:l!==void 0,onClick:()=>f?e.onConfirmRemove?.(f.id):void 0,children:`Remove set`})]})]})})]})}var Q=(e,t)=>e instanceof Error?e.message:t;function $({request:e,requestWithStepUp:n,repositoryId:r}){let[i,o]=j(),[c,l]=j(r?`workspace`:`host`),[u,d]=j({}),[f,p]=j(),[m,h]=j(),[g,_]=j(),[v,y]=j(),b=t(async()=>{try{let t=await R(e,r);o(t.sets),l(t.scope),d({host:t.host,personal:t.personal}),p(void 0)}catch(e){o(e=>e??[]),p(Q(e,`Po could not read your template sets.`))}},[e,r]);a(()=>{b()},[b]);let x=async(e,t,n)=>{_(e);try{o((await t()).sets),p(void 0)}catch(e){await b(),p(Q(e,n))}finally{_(void 0)}};return s(Z,{scope:c,...u.host?{host:u.host}:{},personal:u.personal===!0,sets:i,error:f,selected:m,busy:g,confirming:v,onOpen:h,onBack:()=>h(void 0),onToggle:(e,t,i)=>void x(e,()=>z(n,{id:e,enabled:t,scope:i},r),`Po could not change this template set.`),onAskRemove:y,onCancelRemove:()=>y(void 0),onConfirmRemove:e=>{let t=i?.find(t=>t.id===e)?.origin===`personal`;y(void 0),h(void 0),x(e,()=>B(n,{id:e,...t?{scope:`personal`}:{}},r),`Po could not remove this template set.`)}})}var te=l({label:`Scaffolds`,detail:`The template sets agents use to start projects, documents and plugins, and which of them they may use.`,order:140,icon:D,component:({request:e,requestWithStepUp:t})=>s($,{request:e,requestWithStepUp:t})}),ne=d({label:`Scaffolds`,detail:`The template sets this repository's sessions see. A choice here overrides this computer's, for this repository only.`,order:120,icon:D,component:({repository:e,request:t,requestWithStepUp:n})=>e?s($,{request:t,requestWithStepUp:n,repositoryId:e.id},e.id):null}),re=(e,t)=>t===void 0?void 0:{...e,...t},ie=r({id:`scaffold`,packageName:`@agimon-ai/po-scaffold`,host:{get settingsPanels(){return[re({id:`scaffolds`},te)]}},workspace:{get repositorySettingsPanel(){return ne}}});export{ie as webPlugin};
@@ -1,2 +0,0 @@
1
- import{$a as e,At as t,Bt as n,Da as r,Ft as i,Ga as a,Gt as o,Ht as s,It as c,Ja as l,Jn as u,Jt as ee,La as d,Lt as f,Mr as p,Pi as m,Pt as h,Qn as g,Va as _,Wt as te,Xn as ne,Yn as re,Yr as v,Yt as y,_r as ie,ar as ae,cr as b,dr as x,en as S,er as oe,fr as C,gr as se,hr as ce,ir as w,jr as le,ka as T,kt as E,lr as D,mr as O,nr as ue,or as k,pr as A,qt as j,sa as M,to as N,tr as de,vi as P,vr as fe,zi as F}from"../chunks/po-web-runtime-Yjk5kSCS.js";var I=`load_context`,L=`load_extra_tools`,R=`use_extra_tools`;function z(e,t){return t?`${t}_${e}`:e}function B(e,t){let n=new Set(e.map(e=>e.name)),r=e=>z(e,t),i=[`Use the Po MCP tools below for work in the Po session repository. They run on the Po host, not on your local machine.`,`Prefer them over your built-in bash, read, edit, write, grep, find, or ls tools for that repository.`];return t&&i.push(`Every tool name starts with "${t}_".`),n.has(I)&&i.push(`Start each task with ${r(I)}.`),n.has(L)&&n.has(R)&&i.push(`${r(L)} lists tools added or changed after you connected. Run one of those with ${r(R)}, passing the exact name it returns.`),i.push(`If a tool below is not in your visible tool list, find it in ALL_TOOLS (code mode) before concluding it is missing; do not use tool search or guess names.`,`Await every call, print its result, and check isError. If a call may have changed files or state, inspect before retrying.`,``,`Tools:`,...e.map(e=>`- ${r(e.name)}: ${e.description.replace(/\s+/g,` `).trim()}`)),i.join(`
2
- `)}var V={"Content-Type":`application/json`,"X-Po-Mcp-Csrf":`1`},H=`The cockpit hub is unreachable.`;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return e===void 0||typeof e==`string`}function G(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function K(e){return U(e)&&typeof e.clientId==`string`&&typeof e.name==`string`&&typeof e.redirectUri==`string`&&(e.tokenEndpointAuthMethod===`client_secret_post`||e.tokenEndpointAuthMethod===`api_key`||e.tokenEndpointAuthMethod===`url_token`)&&typeof e.createdAt==`number`&&(e.scope===void 0||e.scope===`restricted`||e.scope===`session`)&&(e.routing===void 0||e.routing===`conversation`)&&G(e.tools)&&G(e.skills)&&typeof e.audience==`string`&&W(e.toolPrefix)}function q(e){if(K(e))return{clientId:e.clientId,name:e.name,redirectUri:e.redirectUri,tokenEndpointAuthMethod:e.tokenEndpointAuthMethod,createdAt:e.createdAt,scope:e.scope===`session`?`session`:`restricted`,routing:`conversation`,tools:e.tools,skills:e.skills,audience:e.audience,...e.toolPrefix===void 0?{}:{toolPrefix:e.toolPrefix}}}function J(e,t){return`/api/workspaces/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/mcp`}async function Y(e,t,n,r){let i;try{i=await e(t,n)}catch{return{error:H}}let a=await i.json().catch(()=>void 0);if(i.ok&&U(a)){let e=r(a);if(e!==void 0)return e}return{error:U(a)&&typeof a.error==`string`?a.error:`The hub answered ${String(i.status)}.`}}function pe(e,t,n){return Y(e,`${J(t,n)}/clients`,{cache:`no-store`},e=>{if(!Array.isArray(e.clients))return;let t=e.clients.map(q);return t.every(e=>e!==void 0)?{clients:t}:void 0})}function me(e,t,n,r){return Y(e,`${J(t,n)}/clients/${encodeURIComponent(r)}`,{method:`DELETE`,headers:{"X-Po-Mcp-Csrf":`1`}},e=>e.ok===!0?{ok:!0}:void 0)}function he(e,t,n,r){return Y(e,`${J(t,n)}/conversations/${encodeURIComponent(r)}`,{method:`DELETE`,headers:V},e=>e.ok===!0?{ok:!0}:void 0)}var ge=(e,n)=>t.fetch(e,n);function _e(e,t,n){return Y(ge,e,t,n)}function ve(e){return U(e)&&typeof e.name==`string`&&typeof e.label==`string`&&typeof e.description==`string`}function ye(e){return U(e)&&typeof e.name==`string`&&typeof e.description==`string`&&typeof e.uri==`string`}function be(e){return U(e)&&typeof e.audience==`string`&&typeof e.mcpUrl==`string`&&typeof e.mcpAppUrl==`string`&&typeof e.authorizationEndpoint==`string`&&typeof e.tokenEndpoint==`string`&&Array.isArray(e.tools)&&e.tools.every(ve)&&Array.isArray(e.skills)&&e.skills.every(ye)}function xe(e){return!K(e)||!U(e)?!1:e.tokenEndpointAuthMethod===`url_token`?typeof e.connectionUrl==`string`&&e.connectionUrl!==``&&typeof e.mcpAppConnectionUrl==`string`&&e.mcpAppConnectionUrl!==``&&e.clientSecret===void 0:typeof e.clientSecret==`string`&&e.clientSecret!==``&&e.connectionUrl===void 0&&e.mcpAppConnectionUrl===void 0}async function Se(e,t){let n=await _e(`${J(e,t)}/config`,{cache:`no-store`},e=>be(e)?{config:e}:void 0);return`error`in n&&n.error===`Session MCP public origin is unavailable.`?{config:void 0}:n}function Ce(e,t){return pe(ge,e,t)}async function we(e,t,n){let r=await _e(`${J(e,t)}/clients`,{method:`POST`,headers:V,body:JSON.stringify(n)},e=>xe(e.client)?{client:e.client}:void 0);return`client`in r&&r.client.routing!==`conversation`?{error:`The host did not enable automatic per-conversation worktrees. Restart an updated host before creating this connection.`}:r}function Te(e,t,n){return me(ge,e,t,n)}function Ee(e){return!U(e)||typeof e.enabled!=`boolean`||typeof e.available!=`boolean`||!Number.isSafeInteger(e.total)||Number(e.total)<0||e.nextBefore!==void 0&&(!Number.isSafeInteger(e.nextBefore)||Number(e.nextBefore)<=0)||!W(e.toolPrefix)||!Array.isArray(e.tools)||!Array.isArray(e.calls)?!1:e.tools.every(e=>U(e)&&ve(e)&&U(e.inputSchema)&&G(e.connections))&&e.calls.every(e=>U(e)&&Number.isSafeInteger(e.sequence)&&Number(e.sequence)>0&&typeof e.id==`string`&&typeof e.toolName==`string`&&typeof e.clientName==`string`&&typeof e.startedAt==`number`&&Number.isFinite(e.startedAt)&&(e.finishedAt===void 0||typeof e.finishedAt==`number`&&Number.isFinite(e.finishedAt))&&[`running`,`succeeded`,`failed`,`cancelled`,`interrupted`].includes(String(e.status))&&typeof e.input==`string`&&(e.output===void 0||typeof e.output==`string`))}function De(e,t,n){let r=n===void 0?``:`?before=${encodeURIComponent(String(n))}`;return _e(`${J(e,t)}/activity${r}`,{cache:`no-store`},e=>Ee(e)?{activity:e}:void 0)}var X=new E({});function Oe(e){return e!==null&&X.state[e]===!0}function ke(e){return h(X,t=>e!==null&&t[e]===!0)}function Ae(t,n){let r=N(t??``,`session-mcp:${n??``}`),i=ee(t=>e(r,t),()=>l(r)),a=JSON.stringify([t,n]),[o,c]=j({key:a}),u=o.key===a?o.before:void 0,[d,f]=j(0),[p,m]=j();s(()=>{if(t===void 0||n===void 0)return;let e=!1;return(async()=>{let r=await De(t,n,u);if(!e){if(`activity`in r&&X.state[n]!==r.activity.enabled){let e=r.activity.enabled;X.setState(t=>({...t,[n]:e}))}m(e=>{let t=`activity`in r?{key:a,before:u,snapshot:r.activity}:{key:a,before:u,snapshot:e?.key===a?e.snapshot:void 0,error:r.error};return e!==void 0&&JSON.stringify(e)===JSON.stringify(t)?e:t})}})(),()=>{e=!0}},[a,t,n,u,d,i]);let h=p?.key===a?p:void 0;return{snapshot:h?.snapshot,loading:h===void 0||h.before!==u,error:h?.error,before:u,showLatest:()=>c({key:a}),loadOlder:()=>{h?.snapshot?.nextBefore!==void 0&&c({key:a,before:h.snapshot.nextBefore})},refresh:()=>f(e=>e+1)}}var je={running:`running`,succeeded:`ok`,failed:`error`,cancelled:`neutral`,interrupted:`neutral`};function Me({status:e}){return c(p,{tone:je[e],size:`xs`,children:e})}function Ne({state:e}){return e.error===void 0?null:f(`div`,{role:`alert`,className:`flex items-center justify-between gap-3 border-b border-po-border px-4 py-3 text-sm text-po-red`,children:[f(`span`,{children:[e.error,` Displayed data may be out of date.`]}),c(v,{variant:`outline`,size:`xs`,onClick:e.refresh,children:`retry`})]})}function Pe({state:e}){let t=e.snapshot?.calls??[];return f(`section`,{"data-testid":`session-mcp-history`,"aria-label":`MCP call history`,className:`flex h-full min-h-0 flex-col bg-po-bg text-po-text`,children:[f(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-po-border px-5 py-4`,children:[f(`div`,{children:[c(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Remote MCP activity`}),f(`p`,{className:`mt-1 text-sm text-po-dim`,children:[e.snapshot?.total??0,` calls recorded · `,e.before===void 0?`latest calls`:`older calls`]})]}),e.before===void 0?c(p,{tone:e.error?`error`:`info`,size:`sm`,children:e.error?`offline`:`live`}):c(v,{variant:`outline`,size:`sm`,onClick:e.showLatest,children:`latest calls`})]}),c(Ne,{state:e}),c(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5`,"aria-busy":e.loading,children:e.loading?c(M,{title:`loading MCP calls`,description:`Reading this session's remote tool history.`,className:`py-8`}):t.length===0?c(M,{title:`no MCP calls recorded yet`,description:`Remote tool calls will appear here as they start. Calls made before history capture was added are not available.`,className:`py-8`}):c(y,{type:`multiple`,children:t.map(e=>f(P,{value:e.id,children:[c(F,{className:`py-3`,"data-testid":`mcp-call-${e.id}`,children:f(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1`,children:[c(Me,{status:e.status}),c(`span`,{className:`min-w-0 break-all text-base font-semibold text-po-hi`,children:e.toolName}),f(`span`,{className:`ml-auto flex shrink-0 items-center gap-3 text-sm text-po-dim`,children:[c(`span`,{children:e.finishedAt===void 0?`in progress`:`${Math.max(0,e.finishedAt-e.startedAt).toLocaleString()} ms`}),c(`time`,{dateTime:new Date(e.startedAt).toISOString(),title:new Date(e.startedAt).toLocaleString(),children:new Date(e.startedAt).toLocaleTimeString()})]})]})}),f(D,{className:`space-y-3 pb-4`,children:[f(`p`,{className:`text-sm text-po-dim`,children:[e.clientName,` · `,new Date(e.startedAt).toLocaleString()]}),c(u,{children:`arguments`}),c(`div`,{className:`max-h-64 overflow-auto`,children:c(m,{text:e.input,className:`language-json`})}),c(u,{children:`result`}),e.output===void 0?c(`p`,{className:`text-sm text-po-dim`,children:e.status===`interrupted`?`The host stopped before a result was recorded.`:`Waiting for the tool result.`}):c(`div`,{className:`max-h-80 overflow-auto`,children:c(m,{text:e.output,className:`language-json`})})]})]},e.id))})}),f(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-po-border px-5 py-3`,children:[c(`p`,{className:`text-sm text-po-dim`,children:`Text previews are limited to 16 KB. Common credential fields are redacted.`}),c(v,{variant:`outline`,size:`sm`,disabled:e.loading||e.snapshot?.nextBefore===void 0,onClick:e.loadOlder,children:`older calls`})]})]})}function Fe({state:e}){let[t,n]=j(``),[r,i]=j(`idle`),a=e.snapshot?.tools??[],o=e.snapshot?.toolPrefix;async function s(){if(navigator.clipboard===void 0)i(`failed`);else try{await navigator.clipboard.writeText(B(a,o)),i(`copied`)}catch{i(`failed`)}}let l=a.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(t.trim().toLowerCase()));return f(`section`,{"data-testid":`session-mcp-tools`,"aria-label":`Available MCP tools`,className:`flex min-h-0 flex-1 flex-col text-po-text`,children:[f(`div`,{className:`space-y-3 border-b border-po-border-soft px-4 py-3`,children:[f(`div`,{className:`flex items-center justify-between gap-2`,children:[c(u,{children:`available tools`}),f(`div`,{className:`flex items-center gap-2`,children:[c(v,{type:`button`,variant:`outline`,size:`xs`,"data-testid":`session-mcp-copy-prompt`,disabled:!e.snapshot?.available||a.length===0,onClick:()=>void s(),children:r===`copied`?`copied`:`copy as prompt`}),c(p,{tone:`info`,size:`xs`,children:a.length})]})]}),f(`div`,{className:`text-sm text-po-dim`,children:[c(`p`,{children:`Tools granted to this session's remote connections.`}),o?f(`p`,{className:`mt-1`,"data-testid":`session-mcp-remote-prefix`,children:[`remote names start with `,f(`code`,{className:`text-po-text`,children:[o,`_`]})]}):null,f(`output`,{"aria-live":`polite`,children:[r===`failed`?`copying the prompt was blocked. allow clipboard access and try again.`:``,r===`copied`?`prompt copied.`:``]})]}),c(S,{"aria-label":`Search MCP tools`,placeholder:`search tools...`,value:t,onChange:e=>n(e.target.value)})]}),c(Ne,{state:e}),c(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4`,"aria-busy":e.loading,children:e.snapshot===void 0&&e.loading?c(M,{title:`loading tools`,className:`py-5`}):e.snapshot?.available?l.length===0?c(M,{title:t?`no matching tools`:`no tools granted`,description:t?`Try a different tool name.`:`This connection does not currently grant any tools.`,className:`py-5`}):c(y,{type:`multiple`,children:l.map(e=>f(P,{value:e.name,children:[c(F,{className:`py-3`,children:c(`span`,{className:`min-w-0 break-all text-base font-semibold text-po-hi`,children:e.name})}),f(D,{className:`space-y-3 pb-3`,children:[c(`p`,{className:`whitespace-pre-wrap break-words text-base leading-relaxed`,children:e.description}),c(`p`,{className:`text-sm text-po-dim`,children:e.connections.join(`, `)}),c(u,{children:`input schema`}),c(`div`,{className:`max-h-64 overflow-auto`,children:c(m,{text:JSON.stringify(e.inputSchema,null,2),className:`language-json`})})]})]},e.name))}):c(M,{title:`no active MCP connection`,description:`History is retained. Available tools return when the session and its remote connection are active.`,className:`py-5`})})]})}function Ie({sessionId:e,sessionContext:t}){return Ae(t?.workspaceId,e??void 0)}function Le(e){return c(Pe,{state:Ie(e)},e.sessionId)}function Re(e){return c(Fe,{state:Ie(e)},e.sessionId)}function ze(e){return Ie(e),null}var Be=r({label:`MCP`,icon:w,order:0,panel:Re,visibility:{subscribe(e){let t=X.subscribe(e);return()=>t.unsubscribe()},isVisible:Oe}}),Ve=T({data:{claims:()=>!0,async remove({workspaceId:e,sessionId:t,setupId:n},r){let i=await he(r,e,t,n);return`error`in i?{error:i.error}:void 0}}}),He=T({component:ze}),Ue=new Map;function We(e,t){let n=Ue.get(e);return n===void 0&&(n=new E(typeof t==`function`?t():t),Ue.set(e,n)),n}function Z(e,t){let r=We(e,t);return[h(r),n(e=>{r.setState(t=>typeof e==`function`?e(t):e)},[r]),r]}function Ge(e){try{let t=new URL(e);return t.protocol===`https:`&&t.username===``&&t.password===``&&t.hash===``}catch{return!1}}function Ke(e){let{clientSecret:t,connectionUrl:n,mcpAppConnectionUrl:r,...i}=e;return i}var qe={url_token:`Signed URL`,api_key:`API key`,client_secret_post:`OAuth`};function Q({label:e,value:t,testId:n}){let[r,i]=j(`idle`);async function a(){if(navigator.clipboard===void 0)i(`failed`);else try{await navigator.clipboard.writeText(t),i(`copied`)}catch{i(`failed`)}}return f(x,{children:[f(A,{children:[c(O,{children:e}),c(`code`,{className:`break-all font-mono text-sm text-po-text`,"data-testid":n,children:t}),f(`output`,{"aria-live":`polite`,className:`text-sm text-po-dim empty:hidden`,children:[r===`failed`?`Copying was blocked. Select the value above to copy it by hand.`:``,r===`copied`?`${e} copied.`:``]})]}),c(v,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`${n}-copy`,"aria-label":`Copy ${e}`,onClick:()=>void a(),children:r===`copied`?`Copied`:`Copy`})]})}function Je({listSessions:e,activeSessionId:n=null}){let r=o(()=>e?.()??[],[e]),a=n,[l,u]=Z(`session-mcp/session`,()=>a??r[0]?.id??``),ee=r.find(e=>e.id===l),d=ee?.workspaceId,p=d!==void 0,m=`${d??``}\u0000${l}`,[,h,_]=Z(`session-mcp/selection`,m),y=t.active(),[w,T]=Z(`session-mcp/config`,void 0),[E,D,j]=Z(`session-mcp/clients`,[]),[M,N]=Z(`session-mcp/redirect`,``),[P,F]=Z(`session-mcp/tool-prefix`,``),[I,L]=Z(`session-mcp/auth-method`,`url_token`),[R,z]=Z(`session-mcp/created`,void 0),B=R?.sessionId===l?R.client:void 0,[V,H]=Z(`session-mcp/loading`,!1),[U,W,G]=Z(`session-mcp/busy`,!1),[K,q]=Z(`session-mcp/error`,void 0);te(()=>{_.state===m&&p||(h(m),z(void 0),N(``),F(``),T(void 0),D([]),q(void 0),W(!1))},[p,m,_,h,z,N,F,T,D,q,W]),s(()=>()=>z(void 0),[z]),s(()=>{if(r.some(e=>e.id===l))return;let e=r.find(e=>e.id===a)??r[0];u(e?.id??``)},[r,l,a,u]),s(()=>{let e=!0,t=j.state;return!p||d===void 0?(H(!1),()=>{e=!1}):(H(!0),Promise.all([Se(d,l),Ce(d,l)]).then(([n,r])=>{e&&(`error`in n?q(n.error):T(n.config),`error`in r?q(e=>e??r.error):!G.state&&j.state===t&&D(r.clients),H(!1))}),()=>{e=!1})},[p,l,d,j,G,T,D,q,H]);let J=I===`oauth`&&M!==``&&!Ge(M),Y=p&&!y&&w!==void 0&&(I!==`oauth`||Ge(M))&&!U;async function pe(){if(!Y||d===void 0||G.state)return;let e=m;W(!0),q(void 0);let t=P.trim(),n=t===``?{}:{toolPrefix:t},r=await we(d,l,I===`oauth`?{redirectUri:M.trim(),scope:`session`,routing:`conversation`,...n}:{authMethod:I,scope:`session`,routing:`conversation`,...n});_.state===e&&(W(!1),`error`in r?q(r.error):(z({sessionId:l,client:r.client}),D(e=>[Ke(r.client),...e]),N(``),F(``)))}async function me(e){if(d===void 0||G.state)return;let t=m;W(!0),q(void 0);let n=await Te(d,l,e);_.state===t&&(W(!1),`error`in n?q(n.error):(D(t=>t.filter(t=>t.clientId!==e)),B?.clientId===e&&z(void 0)))}return f(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`session-mcp-settings`,children:[f(ce,{children:[f(k,{children:[f(x,{children:[f(A,{children:[c(O,{id:`session-mcp-picker-label`,children:`Session`}),c(C,{children:V?f(`span`,{className:`inline-flex items-center gap-2`,children:[c(le,{label:`Reading the session MCP connection`}),`Reading the connection…`]}):ee===void 0?`Start a session first, then come back to connect a client to it.`:p?!V&&w===void 0&&K===void 0?`Turn on remote control with a public HTTPS address first. Clients connect through it.`:`Clients connect to this session and work with its tools and permissions.`:`This session belongs to no workspace, so clients cannot connect to it.`})]}),f(re,{value:l,disabled:r.length===0,onValueChange:u,children:[c(oe,{id:`session-mcp-picker`,"data-testid":`session-mcp-session`,"aria-labelledby":`session-mcp-picker-label`,className:`w-full sm:w-72`,children:c(ue,{placeholder:`No live session`})}),c(ne,{children:r.map(e=>f(g,{value:e.id,children:[e.name,` · `,e.detail]},e.id))})]})]}),w===void 0?null:f(i,{children:[c(Q,{label:`MCP`,value:w.mcpUrl,testId:`session-mcp-url`}),c(Q,{label:`MCP with widgets`,value:w.mcpAppUrl,testId:`session-mcp-app-url`}),f(`details`,{children:[c(`summary`,{className:`cursor-pointer px-5 py-3 text-sm text-po-dim hover:text-po-hi`,children:`OAuth endpoints`}),f(`dl`,{className:`grid gap-x-6 gap-y-1 border-t border-po-border-soft px-5 py-4 text-sm sm:grid-cols-[auto_minmax(0,1fr)]`,children:[c(`dt`,{className:`text-po-dim`,children:`Authorization`}),c(`dd`,{className:`break-all font-mono text-po-text`,children:w.authorizationEndpoint}),c(`dt`,{className:`text-po-dim`,children:`Token`}),c(`dd`,{className:`break-all font-mono text-po-text`,children:w.tokenEndpoint})]})]})]})]}),K?c(`p`,{role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:K}):null]}),w===void 0||y?null:f(ce,{"data-testid":`session-mcp-create`,children:[f(ie,{children:[c(fe,{children:`Connect a client`}),c(se,{children:`A signed URL is the simplest way to connect ChatGPT: the key travels inside the URL, so there is no OAuth callback or header to set up. Other clients can use an API key or OAuth.`})]}),f(k,{children:[f(x,{children:[f(A,{children:[c(O,{id:`session-mcp-auth-method-label`,children:`Sign-in method`}),c(C,{children:`How the client proves it is allowed in.`})]}),f(re,{value:I,onValueChange:e=>L(e),children:[c(oe,{id:`session-mcp-auth-method`,"data-testid":`session-mcp-auth-method`,"aria-labelledby":`session-mcp-auth-method-label`,className:`w-full sm:w-72`,children:c(ue,{})}),f(ne,{children:[c(g,{value:`url_token`,children:`Signed URL (JWT)`}),c(g,{value:`api_key`,children:`API key (Bearer)`}),c(g,{value:`oauth`,children:`OAuth (callback required)`})]})]})]}),I===`oauth`?f(x,{children:[f(A,{children:[c(O,{children:c(`label`,{htmlFor:`session-mcp-callback`,children:`Redirect URL`})}),c(C,{id:`session-mcp-callback-help`,children:J?c(`span`,{className:`text-po-red`,children:`Use an absolute HTTPS URL without credentials or a fragment.`}):`Copy it from your OAuth client. Don’t work it out from the MCP URL.`})]}),c(S,{id:`session-mcp-callback`,"data-testid":`session-mcp-callback`,type:`url`,value:M,placeholder:`https://chatgpt.com/connector/oauth/…`,"aria-invalid":J,"aria-describedby":`session-mcp-callback-help`,spellCheck:!1,onChange:e=>N(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]}):null,f(x,{children:[f(A,{children:[c(O,{children:c(`label`,{htmlFor:`session-mcp-tool-prefix`,children:`Tool prefix`})}),f(C,{id:`session-mcp-tool-prefix-help`,children:[`Tools appear as `,c(`code`,{className:`font-mono`,children:`prefix_bash`}),`,`,` `,c(`code`,{className:`font-mono`,children:`prefix_read`}),`. Lowercase letters and digits, joined by single underscores, up to 24 characters.`]})]}),c(S,{id:`session-mcp-tool-prefix`,"data-testid":`session-mcp-tool-prefix`,value:P,placeholder:`The session name`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`session-mcp-tool-prefix-help`,onChange:e=>F(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]})]}),f(`div`,{className:`flex flex-col gap-2`,"data-testid":`session-mcp-routing`,children:[c(b,{children:`Every conversation is automatically routed to its own worktree before tools run, never to the checkout this session uses. While a worktree is provisioning or recovering, tools wait; if recovery can't finish, the conversation reports it rather than falling back to this session.`}),c(b,{children:`Access follows this session's mode, domains and profile as they change, and tools run with its permissions.`})]}),c(ae,{children:c(v,{"data-testid":`session-mcp-create-button`,size:`sm`,variant:Y?`primary`:`outline`,loading:U,disabled:!Y,onClick:()=>void pe(),children:I===`url_token`?`Create signed URL`:I===`api_key`?`Create API key`:`Create OAuth client`})})]}),f(ce,{"data-testid":`session-mcp-clients`,children:[f(ie,{children:[c(fe,{children:`Clients`}),E.length>0?f(`span`,{className:`text-sm text-po-dim tabular-nums`,children:[E.length,` connected`]}):null]}),y?c(b,{"data-testid":`session-mcp-remote-note`,children:`New clients can only be created on the machine Po runs on. From here you can still see and revoke existing ones, if the host allows it.`}):null,B===void 0?null:f(k,{className:`border-po-green/50`,"data-testid":`session-mcp-secret`,children:[f(x,{children:[f(A,{children:[f(O,{className:`flex flex-wrap items-center gap-2`,children:[`Save these details now`,B.toolPrefix?f(de,{tone:`neutral`,className:`font-mono`,"data-testid":`session-mcp-created-prefix`,children:[B.toolPrefix,`_*`]}):null]}),f(C,{children:[B.tokenEndpointAuthMethod===`url_token`?`In ChatGPT, paste either URL into Server URL and choose no additional authentication. Treat both like a password: they are shown once and work until you revoke the client.`:B.tokenEndpointAuthMethod===`api_key`?`In ChatGPT, choose API key with a Bearer header and paste the key. It is shown once and disappears when you dismiss it, leave this page or switch session.`:null,B.tokenEndpointAuthMethod===`url_token`||B.tokenEndpointAuthMethod===`api_key`?null:f(i,{children:[`Paste the client ID and secret into your OAuth client and choose`,` `,c(`code`,{className:`font-mono`,children:`client_secret_post`}),` as the token endpoint auth method. The secret is shown once.`]})]})]}),c(v,{variant:`ghost`,size:`sm`,onClick:()=>z(void 0),children:`Dismiss`})]}),B.tokenEndpointAuthMethod===`url_token`?f(i,{children:[c(Q,{label:`Signed MCP URL`,value:B.connectionUrl,testId:`session-mcp-created-url`}),c(Q,{label:`Signed MCP with widgets URL`,value:B.mcpAppConnectionUrl,testId:`session-mcp-created-app-url`})]}):f(i,{children:[w===void 0?null:f(i,{children:[c(Q,{label:`MCP`,value:w.mcpUrl,testId:`session-mcp-created-url`}),c(Q,{label:`MCP with widgets`,value:w.mcpAppUrl,testId:`session-mcp-created-app-url`})]}),B.tokenEndpointAuthMethod===`api_key`?null:c(Q,{label:`Client ID`,value:B.clientId,testId:`session-mcp-created-id`}),c(Q,{label:B.tokenEndpointAuthMethod===`api_key`?`API key`:`Client secret`,value:B.clientSecret,testId:`session-mcp-created-secret`})]})]}),E.length===0?V?null:c(k,{children:c(x,{children:f(A,{children:[c(O,{children:`No clients yet`}),c(C,{children:`Clients you connect to this session will be listed here.`})]})})}):c(k,{asChild:!0,children:c(`ul`,{children:E.map(e=>c(x,{asChild:!0,children:f(`li`,{children:[f(A,{children:[f(O,{className:`flex flex-wrap items-center gap-2`,children:[e.name,c(de,{tone:`neutral`,children:qe[e.tokenEndpointAuthMethod]??e.tokenEndpointAuthMethod}),e.toolPrefix?f(de,{tone:`neutral`,className:`font-mono`,children:[e.toolPrefix,`_*`]}):null]}),c(C,{children:e.scope===`session`?`Session access. Worktree per conversation.`:`Restricted access. Tools: ${e.tools.join(`, `)||`none`}. Skills: ${e.skills.join(`, `)||`none`}.`}),c(`code`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.clientId}),e.redirectUri?c(`span`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.redirectUri}):null]}),c(v,{variant:`ghost`,size:`sm`,disabled:U,onClick:()=>void me(e.clientId),children:`Revoke`})]})},e.clientId))})}),c(b,{children:`Signed URLs and API keys belong to this session and survive a restart until you revoke them. OAuth sign-ins last only while Po runs, so a client may ask to authorise again.`})]})]})}var Ye=d({label:`Session MCP`,detail:`Let ChatGPT or another MCP client work inside one live Po session. Separate from the MCP servers Po calls out to.`,menuGroup:`general`,component:Je}),Xe=_({label:`MCP`,panel:Le,useVisible:ke}),$=(e,t)=>t===void 0?void 0:{...e,...t},Ze=a({id:`session-mcp`,packageName:`@agimon-ai/po-session-mcp`,host:{get dockFaces(){return[$({id:`mcp`},Be)]},get fills(){return[$({slot:`session-setup-actions`,id:`mcp-setup`},Ve),$({slot:`overlay`,id:`mcp-watcher`},He)]},get settingsPanels(){return[$({id:`session-mcp`},Ye)]},get tabs(){return[$({id:`mcp`},Xe)]}}});export{Ze as webPlugin};
@@ -1,4 +0,0 @@
1
- import{Ft as e,Ga as t,Ha as n,It as r,Lt as i,Yr as a,gn as o,hn as s,ji as c,ln as l,mn as u,pn as d,qt as f}from"../chunks/po-web-runtime-Yjk5kSCS.js";function p(e,t){return e===null?t:e.content.flatMap(e=>{let t=typeof e==`object`&&e?e:{};return t.type===`text`&&typeof t.text==`string`?[t.text]:[]}).join(`
2
- `)}function m(e){return typeof e.name==`string`?e.name:``}function h(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,``).trim()}function g(e,t=12){let n=e.split(`
3
- `);if(n.length<=t)return{text:e,hidden:0};let r=n.slice(0,t).map(e=>e.trimStart().startsWith("```")),i=r.filter(Boolean).length%2==1?r.lastIndexOf(!0):t;return i<=0?{text:e,hidden:0}:{text:n.slice(0,i).join(`
4
- `).trimEnd(),hidden:n.length-i}}function _(e){let t=typeof e.query==`string`?e.query.trim():``;return t.length>0?t:void 0}function v(e,t){let n;try{n=JSON.parse(p(e,t))}catch{return[]}return Array.isArray(n)?n.flatMap(e=>{let t=typeof e==`object`&&e?e:{};return typeof t.name==`string`?[{name:t.name,description:typeof t.description==`string`?t.description:``}]:[]}):[]}function y({body:e}){let[t,n]=f(!1),o=g(e),s=t||o.hidden===0;return i(u,{"data-testid":`tool-result-load_skill`,className:`flex flex-col gap-2`,children:[r(l,{text:s?e:o.text}),s?null:i(`span`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-sm text-po-dim`,children:[o.hidden,` more lines`]}),r(a,{variant:`ghost`,size:`sm`,onClick:()=>n(!0),children:`Show more`})]})]})}function b({args:t,result:n,output:a,running:l,isError:f}){let g=m(t),_=n===null||f?``:h(p(n,a));return r(d,{tone:c({running:l,isError:f}),expandable:!0,children:({expanded:t})=>i(e,{children:[r(s,{title:`load_skill`,children:r(`span`,{"data-testid":`tool-call-load_skill`,className:`flex min-w-0 flex-1 items-center gap-2`,children:r(`span`,{className:`truncate text-po-text`,children:g})})}),t?f?r(u,{"data-testid":`tool-result-load_skill`,className:`flex flex-col`,children:r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:p(n,a)})}):n===null?l?r(u,{"data-testid":`tool-result-load_skill`,children:r(o,{tone:`running`,children:`running`})}):null:_.length===0?null:r(y,{body:_}):null]})})}var x=n({message:b});function S({args:t,result:n,output:a,running:l,isError:f}){let m=_(t),h=n===null||f?[]:v(n,a),g=n===null||f?void 0:`${h.length} ${h.length===1?`skill`:`skills`}`;return r(d,{tone:c({running:l,isError:f}),expandable:!0,children:({expanded:t})=>i(e,{children:[r(s,{title:`search_skills`,children:i(`span`,{"data-testid":`tool-call-search_skills`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[m===void 0?r(`span`,{className:`truncate text-po-dim`,children:`all skills`}):r(`span`,{className:`truncate text-po-text`,children:m}),g===void 0?null:i(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,g]})]})}),t?f?r(u,{"data-testid":`tool-result-search_skills`,className:`flex flex-col`,children:r(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:p(n,a)})}):n===null?l?r(u,{"data-testid":`tool-result-search_skills`,children:r(o,{tone:`running`,children:`running`})}):null:h.length===0?r(u,{"data-testid":`tool-result-search_skills`,children:r(`span`,{className:`text-po-dim`,children:`No skills match.`})}):r(u,{"data-testid":`tool-result-search_skills`,className:`flex flex-col gap-2`,children:h.map(e=>i(`span`,{className:`flex flex-col`,children:[r(`span`,{className:`font-semibold text-po-hi`,children:e.name}),e.description.length>0?r(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]},e.name))}):null]})})}var C=n({message:S}),w=(e,t)=>t===void 0?void 0:{...e,...t},T=t({id:`skill`,packageName:`@agimon-ai/po-skill`,session:{get toolRenderers(){return[w({tools:[`load_skill`]},x),w({tools:[`search_skills`]},C)]}}});export{T as webPlugin};
@@ -1,7 +0,0 @@
1
- import{$i as e,$n as t,At as n,Ba as r,Bt as i,Ca as a,Ci as o,Ea as s,Ft as c,Ga as l,Gi as u,Ha as d,Ht as f,Ia as p,It as m,Ji as h,Jr as g,Ki as _,Kn as v,Kt as y,La as b,Lt as x,Mr as S,Na as C,Pt as w,Qa as ee,Qi as te,Qn as T,Ra as ne,Sr as re,Ta as E,Tn as D,Tr as ie,Ui as O,Ut as ae,Xa as oe,Xi as se,Xn as ce,Yi as le,Yn as k,Yr as A,Zn as j,aa as M,ar as N,br as ue,ci as de,cr as fe,dr as pe,ea as me,en as he,er as ge,fr as _e,gn as P,hn as ve,ja as ye,ji as be,ka as xe,mn as Se,mr as Ce,na as we,nn as Te,nr as Ee,or as De,pn as Oe,pr as ke,qi as Ae,qt as F,ra as je,rr as Me,ti as Ne,tr as I,un as Pe,wr as Fe,xr as Ie,za as Le}from"../chunks/po-web-runtime-Yjk5kSCS.js";var Re=`team`,ze=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Be=`team-settings`,Ve=`/agents`,He=[{id:`model`,label:`default model`,keyPath:[`subagents`,`model`],placeholder:`inherit existing defaults`,detail:`model used when the agent frontmatter does not set one.`,models:!0},{id:`thinking`,label:`default thinking`,keyPath:[`subagents`,`thinking`],placeholder:`inherit`,detail:`thinking level used when the agent frontmatter does not set one. off disables thinking by default.`,options:ze},{id:`fallbackModels`,label:`fallback models`,keyPath:[`subagents`,`fallbackModels`],placeholder:`provider/model:thinking, provider/model`,detail:`comma-separated model specs, tried in order. each may include a :thinking suffix.`},{id:`excludeTools`,label:`excluded tools`,keyPath:[`subagents`,`excludeTools`],placeholder:`tool-one, tool-two`,detail:`comma-separated tool names added to the layer exclusions. existing restrictions still apply.`}],Ue=`subagents.model`,We=`subagents.fallbackModels`,Ge=`Loaded by a plugin or domain when a session starts.`;function L(e,t){return`subagents.agents.${e}.${t}`}function Ke(e){let t=e===void 0?`/api`:`/api/workspaces/${encodeURIComponent(e)}`;return{agents:`${t}/plugins/${Be}${Ve}`,read:`${t}/settings`,write:`${t}/settings/value`,models:`/api/plugins/po/models`}}function qe(e){let t=e.lastIndexOf(`:`);return t!==-1&&ze.includes(e.slice(t+1))?e.slice(0,t):e}function Je(e){let t=new Set(e.available),n=e=>e!==void 0&&e.trim()!==``&&(t.size===0||t.has(qe(e)));if(n(e.setting))return{model:e.setting,from:`agent setting`};if(n(e.file))return{model:e.file,from:`agent file`};let r=e.defaults.find(n);return r===void 0?void 0:{model:r,from:`team default`}}function Ye(e){return(e??``).split(`,`).map(e=>e.trim()).filter(Boolean)}function Xe(e,t,n,r){let i=e=>t.values[e],a=[i(Ue)?.value,...Ye(i(We)?.value)].filter(e=>!!e),o=r.map(e=>e.value);return e.map(e=>{let t=i(L(e.name,`model`)),r=i(L(e.name,`thinking`)),s={...t?.origin===n&&t.value?{model:t.value}:{},...r?.origin===n&&r.value?{thinking:r.value}:{}},c=Je({setting:t?.value,file:e.model,defaults:a,available:o});return{name:e.name,description:e.description||Ge,...c?{runsOn:c}:{},...Object.keys(s).length>0?{here:s}:{},...n===`host`&&(t?.origin===`repository`||r?.origin===`repository`)?{overridden:!0}:{}}})}function Ze(e){return Object.entries(e).flatMap(([e,t])=>[`model`,`thinking`].filter(e=>t[e]!==void 0).map(n=>({keyPath:[`subagents`,`agents`,e,n],value:t[n]??null})))}function R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Qe(e){let t=await e.text();try{return t===``?void 0:JSON.parse(t)}catch{return}}function $e(e,t){return R(e)&&typeof e.error==`string`&&e.error!==``?e.error:`Po answered ${t}.`}async function et(e,t){let n=Ke(t),r=await e(n.agents),i=await Qe(r);if(!r.ok||!R(i)||!Array.isArray(i.agents))throw Error($e(i,r.status));let a=i.agents,o=new URLSearchParams;for(let e of[Ue,We,...a.flatMap(e=>[L(e.name,`model`),L(e.name,`thinking`)])])o.append(`key`,e);let[s,c]=await Promise.all([e(`${n.read}?${o.toString()}`),e(n.models)]),l=await Qe(s);if(!s.ok||!R(l)||typeof l.repoRoot!=`string`||!R(l.values))throw Error($e(l,s.status));let u=await Qe(c);return{agents:a,config:l,models:c.ok&&R(u)&&Array.isArray(u.models)?u.models:[]}}async function tt(e,t,n){let r=await e(Ke(t).write,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({repoRoot:n.config.repoRoot,scope:n.scope,edits:Ze(n.drafts),expectedHash:n.config.hashes[n.scope]})});return r.ok?{ok:!0}:{ok:!1,stale:r.status===409,error:$e(await Qe(r),r.status)}}var nt=`__inherit__`,rt={"agent file":`from its agent file`,"agent setting":`from agent settings`,"team default":`from the Team defaults`,"pi settings":`from Pi settings`};function it(e,t,n){let r=t?.[n];return r===void 0?e.here?.[n]??``:r??``}function at(e){return e!==void 0&&Object.keys(e).length>0}function ot({agent:e,label:n,value:r,options:i,disabled:a,onChange:o}){let s=[...new Set(i.map(e=>e.group??``))],c=r!==``&&!i.some(e=>e.value===r)?r:void 0;return x(k,{value:r===``?nt:r,disabled:a,onValueChange:e=>o(e===nt?null:e),children:[m(ge,{"data-testid":`agent-models-${n.toLowerCase()}-${e}`,"aria-label":`${n} for ${e}`,className:`w-full text-sm`,children:m(Ee,{placeholder:`Inherit`})}),x(ce,{children:[m(T,{value:nt,children:`Inherit`}),c===void 0?null:x(T,{value:c,children:[c,` · not in catalog`]}),s.map(e=>x(j,{children:[e===``?null:m(t,{children:e}),i.filter(t=>(t.group??``)===e).map(e=>m(T,{value:e.value,children:e.label},e.value))]},e))]})]})}function st({row:e,draft:t,models:n,thinkingLevels:r,busy:i=!1,onDraft:a}){let o=at(t),s=e.here?.model!==void 0||e.here?.thinking!==void 0,c=r.map(e=>({value:e,label:e}));return x(pe,{"data-testid":`agent-models-row-${e.name}`,"data-dirty":o,changed:s,className:`items-start`,children:[x(ke,{className:`gap-1`,children:[x(Ce,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[m(`span`,{className:`min-w-0 break-all`,children:e.name}),s?m(`span`,{className:`sr-only`,children:`, set here`}):null,e.overridden?m(I,{tone:`yellow`,className:`shrink-0`,children:`Overridden by repository`}):null,o?m(I,{tone:`cyan`,className:`shrink-0`,children:`Unsaved`}):null,o?m(A,{variant:`ghost`,size:`xs`,"data-testid":`agent-models-revert-${e.name}`,disabled:i,onClick:()=>{a(e.name,`model`,void 0),a(e.name,`thinking`,void 0)},className:`text-po-dim`,children:`Revert`}):s?m(A,{variant:`ghost`,size:`xs`,"data-testid":`agent-models-reset-${e.name}`,disabled:i,onClick:()=>{e.here?.model!==void 0&&a(e.name,`model`,null),e.here?.thinking!==void 0&&a(e.name,`thinking`,null)},className:`text-po-dim`,children:`Reset`}):null]}),m(_e,{children:e.description}),e.runsOn===void 0?m(`span`,{className:`text-sm text-po-dim`,children:`Runs on the session's own model`}):x(`span`,{className:`text-sm text-po-dim`,children:[`Runs on `,m(`code`,{className:`break-all font-mono text-sm text-po-text`,children:e.runsOn.model}),`,`,` `,s?`set here`:rt[e.runsOn.from]]}),x(`code`,{className:`min-w-0 max-w-full break-all font-mono text-sm text-po-dim`,children:[`subagents.agents.`,e.name]})]}),x(`div`,{className:`flex w-full flex-col gap-2 sm:w-64`,children:[m(ot,{agent:e.name,label:`Model`,value:it(e,t,`model`),options:n,disabled:i,onChange:t=>a(e.name,`model`,t)}),m(ot,{agent:e.name,label:`Thinking`,value:it(e,t,`thinking`),options:c,disabled:i,onChange:t=>a(e.name,`thinking`,t)})]})]})}function ct(e){let{scope:t,agents:n,drafts:r,busy:i=!1,error:a,onSave:o,onDiscard:s,onReload:c,notice:l}=e,u=Object.values(r).filter(at).length,d=t===`host`?`this host`:`this repository`;return l===void 0?x(`div`,{className:`flex min-w-0 flex-col gap-4`,"data-testid":`agent-models`,children:[a===void 0||a===``?null:m(De,{children:x(pe,{children:[x(ke,{role:`alert`,children:[m(Ce,{children:`Po couldn't load or save agent models`}),m(_e,{"data-testid":`agent-models-error`,className:`text-po-red`,children:a})]}),m(A,{size:`sm`,variant:`outline`,disabled:i,onClick:c,children:`Reload agents`})]})}),n===void 0?a?null:m(fe,{"aria-busy":`true`,"data-testid":`agent-models-loading`,children:`Loading agents…`}):n.length===0?m(De,{children:m(pe,{children:x(ke,{children:[m(Ce,{children:`No agents yet`}),m(_e,{children:`When you add a subagent, it shows up here. In Help mode, ask Po to add one.`})]})})}):m(De,{children:n.map(t=>m(st,{...e,row:t,draft:r[t.name]},t.name))}),n===void 0||n.length===0?null:x(N,{children:[m(A,{variant:u>0?`primary`:`outline`,size:`sm`,"data-testid":`agent-models-save`,loading:i,disabled:i||u===0,onClick:o,children:`Save`}),u===0?null:m(A,{variant:`ghost`,size:`sm`,"data-testid":`agent-models-discard`,disabled:i,onClick:s,children:`Discard`}),m(fe,{"data-testid":`agent-models-note`,children:u>0?`${u} ${u===1?`agent`:`agents`} changed. Saving writes ${d}'s config.yaml for new sessions.`:`Changes apply to new sessions on ${d}.`})]})]}):m(fe,{"data-testid":`agent-models-notice`,children:l})}var lt=`Pick a repository above to choose its agent models.`,ut=e=>e instanceof Error?e.message:String(e);function dt({scope:e,workspaceId:t,request:n,requestWithStepUp:r}){let[a,o]=F(),[s,c]=F([]),[l,u]=F(),[d,p]=F({}),[h,g]=F(!1),[_,v]=F(),y=e===`repository`&&t===void 0,b=i(t=>{v(void 0),c(t.models),u(t.config),o(Xe(t.agents,t.config,e,t.models))},[e]),x=async()=>{try{b(await et(n,t))}catch(e){v(ut(e))}};f(()=>{if(y)return;let e=!0;return et(n,t).then(t=>e&&b(t),t=>e&&v(ut(t))),()=>{e=!1}},[n,b,y,t]);let S=(e,t,n)=>p(r=>{let i={...r[e]};n===void 0?delete i[t]:i[t]=n;let a=Object.fromEntries(Object.entries(r).filter(([t])=>t!==e));return Object.keys(i).length===0?a:{...a,[e]:i}}),C=async()=>{if(l&&Ze(d).length!==0){g(!0);try{let n=await tt(r,t,{config:l,scope:e,drafts:d});if(n.ok){p({}),await x();return}n.stale&&await x(),v(n.error)}catch(e){v(ut(e))}finally{g(!1)}}};return m(ct,{scope:e,agents:a,models:s,thinkingLevels:ze,drafts:d,busy:h,..._===void 0?{}:{error:_},...y?{notice:lt}:{},onDraft:S,onSave:()=>void C(),onDiscard:()=>p({}),onReload:()=>void x()})}function ft({request:e,requestWithStepUp:t}){return m(dt,{scope:`host`,request:e,requestWithStepUp:t})}var pt=b({label:`Agent models`,detail:`Choose a model or thinking level for one agent. It wins over its agent file and the Team defaults.`,order:100,component:ft}),mt={id:Re,label:`Team`,detail:`subagent defaults for new sessions, used only where agent frontmatter is unset. existing overrides still apply.`,order:50,fields:He.map(e=>({id:e.id,label:e.label,kind:e.models===!0||e.options!==void 0?`select`:`text`,keyPath:e.keyPath,detail:e.detail,placeholder:e.placeholder,...e.models===!0?{optionsFrom:`models`}:{},...e.options===void 0?{}:{options:e.options.map(e=>({value:e,label:e}))}}))},ht=ne({...mt,icon:Ne}),gt=xe({data:{version:1,label:`Team`,source:`subagent_runs`,destination:`agents`,icon:Ne}});function _t({repository:e,request:t,requestWithStepUp:n}){return m(dt,{scope:`repository`,...e?{workspaceId:e.id}:{},request:t,requestWithStepUp:n},e?.id??`none`)}var vt=C({label:`Agent models`,detail:`Choose a model or thinking level for one agent. It wins over its agent file and the Team defaults.`,order:100,component:_t}),yt=ne({...mt,icon:Ne}),bt=`subagent_runs`,xt=`subagent_catalog`;function St(e,t){return oe(ee(e),`team`,t)}function z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function B(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Ct(e){return z(e)&&typeof e.name==`string`&&typeof e.description==`string`&&typeof e.filePath==`string`&&[`project`,`user`,`plugin`].includes(String(e.source))&&(e.packageName===void 0||typeof e.packageName==`string`)&&(e.model===void 0||typeof e.model==`string`)&&B(e.fallbackModels)&&B(e.tools)&&B(e.skills)&&B(e.extensions)&&(e.defaultContext===`fresh`||e.defaultContext===`fork`)}async function wt(e,t){let r=await n.fetch(St(e,`/catalog`),{signal:t,cache:`no-store`}),i=await r.json();if(!r.ok)throw Error(z(i)&&typeof i.error==`string`?i.error:`Agent catalog could not be loaded (${r.status}).`);if(!z(i)||typeof i.cwd!=`string`||!Array.isArray(i.agents)||!i.agents.every(Ct)||!B(i.models))throw Error(`The server returned an invalid agent catalog.`);return{cwd:i.cwd,agents:i.agents,models:i.models}}async function Tt(e,t){let r=await n.fetch(St(e,`/run`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=await r.json();if(!r.ok)throw Error(z(i)&&typeof i.error==`string`?i.error:`Agent could not be launched (${r.status}).`);if(!z(i)||typeof i.runId!=`string`||i.runId===``)throw Error(`The server returned an invalid run ID.`);return i.runId}function Et(e){return e===`delivered`||e===`failed`||e===`pending`}async function Dt(e,t,r){let i=await n.fetch(St(e,`/steer`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({runId:t,message:r})}),a=await i.json();if(!i.ok)throw Error(z(a)&&typeof a.error==`string`?a.error:`Guidance could not be sent (${i.status}).`);if(!z(a)||!Et(a.state)||typeof a.message!=`string`)throw Error(`The server returned an invalid steer result.`);return{state:a.state,message:a.message}}async function Ot(e,t){let r=await n.fetch(St(e,`/stop`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({runId:t})}),i=await r.json();if(!r.ok)throw Error(z(i)&&typeof i.error==`string`?i.error:`The run could not be stopped (${r.status}).`)}var V=p({cwd:``,agents:[],models:[],warning:void 0,loading:!1,requestId:0,open:!1,filter:``,task:``,selected:void 0,inspected:void 0,launch:void 0});function kt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function At(e,t=``){V.update(e,e=>({...e,open:!0,task:t}))}function jt(e,t){e.sessionId!==null&&(At(e.sessionId,e.item.content),e.openTransientTab(t()))}function Mt(e){V.update(e,e=>({...e,open:!1,task:``,launch:void 0}))}function Nt(e){let t=new AbortController,n=V.select(V.store.state,e).requestId+1;V.update(e,e=>({...e,requestId:n,loading:!0,warning:void 0}));let r=()=>!t.signal.aborted&&V.store.state[e]?.requestId===n;return wt(e,t.signal).then(t=>{r()&&Pt.apply(e,t)}).catch(t=>{r()&&V.update(e,e=>({...e,warning:t instanceof Error?t.message:String(t)}))}).finally(()=>{r()&&V.update(e,e=>({...e,loading:!1}))}),()=>{r()&&V.update(e,e=>({...e,loading:!1})),t.abort()}}var Pt=V.channel({channel:xt,parse(e){if(!kt(e)||typeof e.cwd!=`string`||!Array.isArray(e.agents))return null;let t=Array.isArray(e.models)?e.models.filter(e=>typeof e==`string`):[];return{cwd:e.cwd,agents:e.agents.filter(kt),models:t,...typeof e.warning==`string`?{warning:e.warning}:{}}},reduce(e,t){let n=new Set(t.agents.map(e=>e.name));return{...e,cwd:t.cwd,agents:t.agents,models:t.models,warning:t.warning,selected:e.selected!==void 0&&n.has(e.selected)?e.selected:void 0,inspected:e.inspected!==void 0&&n.has(e.inspected)?e.inspected:void 0,launch:e.launch!==void 0&&n.has(e.launch.agent)?e.launch:void 0}}}),H=6e4,Ft=60*H;function It(e){if(e<H)return`<1m`;if(e<Ft)return`${Math.floor(e/H)}m`;let t=Math.floor(e/Ft),n=Math.floor(e%Ft/H);return`${t}h ${String(n).padStart(2,`0`)}m`}function Lt(e){let t=/^\/(?:Users|home)\/[^/]+/u.exec(e);return t?`~${e.slice(t[0].length)}`:e}function Rt(e){return U(e).name}function zt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=e.identity?.split(`-`)[0];return!e.identity||!t?{name:e.agent,role:``,seed:e.agent}:{name:zt(t),role:e.agent,seed:e.identity}}var Bt=Le({slot:`subagents.run-actions`}),Vt=new Set([`done`,`failed`,`stopped`]);function W(e){return Vt.has(e.state)}var G=p({runs:[],dismissed:[],stopRequested:[],openRunId:void 0,pendingLaunch:void 0,autoOpenRunId:void 0});function Ht(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ut(e,t){return e.filter(e=>e!==t)}function Wt(e){return e.runs.filter(t=>!e.dismissed.includes(t.runId)).sort((e,t)=>Number(W(e))-Number(W(t)))}function Gt(e){return Wt(e).filter(e=>e.state===`queued`||e.state===`running`)}async function Kt(e,t){G.update(e,e=>({...e,stopRequested:[...Ut(e.stopRequested,t),t]}));try{await Ot(e,t)}catch(n){throw G.update(e,e=>({...e,stopRequested:Ut(e.stopRequested,t)})),n}}function qt(e,t){G.update(e,e=>({...e,dismissed:[...Ut(e.dismissed,t),t],openRunId:e.openRunId===t?void 0:e.openRunId}))}function Jt(e,t){G.update(e,e=>({...e,pendingLaunch:{agent:t,knownRunIds:e.runs.map(e=>e.runId)}}))}function Yt(e){G.update(e,e=>({...e,pendingLaunch:void 0}))}function Xt(e){G.update(e,e=>({...e,autoOpenRunId:void 0}))}function Zt(e,t){G.update(e,e=>({...e,openRunId:t}))}var Qt=G.channel({channel:bt,parse(e){return!Ht(e)||!Array.isArray(e.runs)?null:{runs:e.runs.filter(Ht)}},reduce(e,{runs:t}){let n=new Map(t.map(e=>[e.runId,e])),r=e.stopRequested.filter(e=>{let t=n.get(e);return t!==void 0&&!W(t)}),i=e.dismissed.filter(e=>n.has(e)),a=e.pendingLaunch===void 0?void 0:t.find(t=>t.agent===e.pendingLaunch?.agent&&!e.pendingLaunch.knownRunIds.includes(t.runId));return{...e,runs:t,stopRequested:r,dismissed:i,pendingLaunch:a===void 0?e.pendingLaunch:void 0,autoOpenRunId:a===void 0?e.autoOpenRunId:a.runId}}});function $t(e,t){let n=t.trim().toLowerCase();return n===``?[...e]:e.filter(e=>[e.name,e.source,e.packageName??``,e.description,...e.tools].some(e=>e.toLowerCase().includes(n)))}function en(e,t){let n=new Set,r=[];for(let i of[e.model??``,...e.fallbackModels,...t])i===``||n.has(i)||(n.add(i),r.push(i));return r}var tn={project:`Project`,user:`User`,plugin:`Package`};function nn({label:e,value:t,onChange:n,options:r,disabled:i}){return x(k,{disabled:i,value:t,onValueChange:n,children:[m(ge,{"aria-label":e,className:`h-9 w-full`,children:m(Ee,{})}),m(ce,{children:r.map(([e,t])=>m(T,{value:e,children:t},e))})]})}function rn({agents:e,models:t,initialSearch:n=``,initialSelected:r,initialTask:i=``,initialFork:a,loading:o=!1,warning:s,cwd:l=``,catalogNote:d,runNote:f,onClose:p,onLaunch:h,onSource:v}){let[b,S]=F(n),[C,w]=F(`all`),[ee,te]=F(r),[T,ne]=F(i),[re,E]=F(a===void 0?void 0:a?`fork`:`fresh`),[D,ie]=F(`default`),[O,ae]=F(!1),oe=y(!1),[ce,k]=F(),j=$t(e,b).filter(e=>C===`all`||e.source===C),M=ee===void 0?j[0]:j.find(e=>e.name===ee),N=re??M?.defaultContext??`fresh`,ue=e=>{te(e.name),E(e.defaultContext),ie(`default`),k(void 0)},de=async()=>{if(!(!M||o||oe.current)){oe.current=!0,ae(!0),k(void 0);try{await h({agent:M.name,task:T,fork:N===`fork`,...D==="default"?{}:{model:D}})}catch(e){k(e instanceof Error?e.message:String(e))}finally{oe.current=!1,ae(!1)}}},fe=D==="default"?M?.model??`Runtime default`:D,pe=N===`fresh`?`Fresh context`:`This conversation`;return x(u,{"data-testid":`launch-dialog`,className:`w-6xl`,"aria-describedby":`launcher-description`,children:[m(le,{dismissible:!0,closeLabel:`Close new agent run`,className:`p-6 sm:px-6`,children:x(`div`,{className:`space-y-1`,children:[m(se,{children:`New agent run`}),m(_,{id:`launcher-description`,children:`Choose an agent, review its setup, then give it a task.`})]})}),x(`div`,{className:`grid min-h-0 overflow-y-auto md:grid-cols-3`,children:[x(`aside`,{"aria-label":`Agent catalog`,onKeyDown:e=>{if(!(O||e.target.getAttribute(`role`)===`combobox`)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=j.findIndex(e=>e.name===M?.name),n=j[(t+(e.key===`ArrowDown`?1:-1)+j.length)%j.length];n&&ue(n)}if(e.target.tagName!==`INPUT`&&(e.key===`f`&&E(`fork`),e.key===`i`)){let t=e.currentTarget.parentElement?.querySelector(`details`);t&&(t.open=!t.open)}}},className:`flex flex-col gap-3 border-b border-po-border p-5 md:border-r md:border-b-0`,children:[m(he,{autoFocus:!0,"data-testid":`catalog-filter`,disabled:O,"aria-label":`Find an agent`,placeholder:`Find an agent…`,value:b,onChange:e=>S(e.target.value)}),m(nn,{disabled:O,label:`Source filter`,value:C,onChange:w,options:[[`all`,`All sources`],[`project`,`Project`],[`user`,`User`],[`plugin`,`Package`]]}),x(`div`,{className:`flex flex-col gap-1 py-2`,children:[o?m(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading agents…`}):null,s?m(`p`,{role:`alert`,className:`text-sm text-po-red`,children:s}):null,j.map(e=>x(A,{variant:`ghost`,size:`card`,"aria-pressed":M?.name===e.name,className:M?.name===e.name?`border-l-4 border-po-green bg-po-selected/15`:`border-l-4 border-transparent`,disabled:O,onClick:()=>{ue(e)},children:[m(`span`,{className:`font-semibold text-po-hi`,children:e.name}),m(`span`,{className:`text-sm text-po-dim`,children:e.description.split(`.`)[0]}),x(`span`,{className:`text-sm text-po-dim`,children:[tn[e.source],` · `,e.model??`Default model`]})]},e.name)),j.length===0&&!o?x(`div`,{className:`space-y-3 py-6`,children:[m(`p`,{className:`text-base text-po-hi`,children:`No matching agents`}),m(`p`,{className:`text-sm text-po-dim`,children:`Try another name or source.`}),m(A,{onClick:()=>{S(``),w(`all`)},children:`Clear filters`})]}):null]}),x(`p`,{className:`mt-auto text-sm text-po-dim`,children:[j.length,` agents`,d?` · ${d}`:``]})]}),m(`section`,{className:`space-y-5 p-6 md:col-span-2`,"aria-label":`Agent definition and run`,children:M?x(c,{children:[x(`div`,{className:`space-y-2`,children:[m(`p`,{className:`text-sm text-po-dim`,children:`Agent definition`}),x(`div`,{className:`flex items-center gap-3`,children:[m(`h2`,{className:`text-2xl font-semibold text-po-hi`,children:M.name}),m(I,{children:tn[M.source]})]}),m(`p`,{className:`text-base text-po-text`,children:M.description}),m(`p`,{className:`break-all font-mono text-sm text-po-dim`,children:v?.(M)?m(`button`,{type:`button`,className:`text-left text-po-green underline`,onClick:v(M),children:M.filePath}):M.filePath}),M.packageName?m(`p`,{className:`text-sm text-po-dim`,children:M.packageName}):null,x(`details`,{className:`text-base text-po-text`,children:[m(`summary`,{className:`cursor-pointer text-po-green`,children:`View instructions`}),m(`p`,{className:`mt-2 whitespace-pre-wrap rounded-md bg-po-deep p-3 text-sm`,children:v?.(M)?m(A,{variant:`link`,onClick:v(M),children:`Open source instructions`}):`Instructions stay in the source definition. File viewing is not available in this host.`})]})]}),m(`dl`,{className:`grid gap-x-6 gap-y-3 text-base sm:grid-cols-2`,children:[[`Model`,M.model??`Runtime default`],[`Tools`,M.tools.length?M.tools.join(` · `):`All session tools (not narrowed)`],[`Fallback models`,M.fallbackModels.join(` · `)||`None specified`],[`Skills`,M.skills.join(` · `)||`None specified`],[`Default context`,M.defaultContext===`fresh`?`Fresh`:`This conversation`],[`Extensions`,M.extensions.join(` · `)||`None specified`]].map(([e,t])=>x(`div`,{className:`space-y-1`,children:[m(`dt`,{className:`text-sm text-po-dim`,children:e}),m(`dd`,{className:`break-words text-po-text`,children:t})]},e))}),x(`div`,{className:`space-y-3 border-t border-po-border pt-4`,children:[m(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`This run`}),x(`label`,{className:`flex flex-col gap-1 text-base text-po-text`,children:[`Task`,m(g,{"data-testid":`launch-task`,disabled:O,placeholder:`What should the agent do? Leave empty to use its own prompt.`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),de())},rows:3,value:T,onChange:e=>{ne(e.target.value),k(void 0)}})]}),x(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x(`div`,{className:`space-y-1`,children:[m(`p`,{className:`text-base text-po-text`,children:`Context`}),m(nn,{disabled:O,label:`Context`,value:N,onChange:E,options:[[`fresh`,`Fresh context`],[`fork`,`This conversation`]]}),m(`p`,{className:`text-sm text-po-dim`,children:`Start clean, or include this conversation.`})]}),x(`div`,{className:`space-y-1`,children:[m(`p`,{className:`text-base text-po-text`,children:`Model override`}),m(nn,{disabled:O,label:`Model override`,value:D,onChange:ie,options:[[`default`,`Use agent default`],...en(M,t).map(e=>[e,e])]}),m(`p`,{className:`text-sm text-po-dim`,children:`Changes apply only to this run.`})]})]})]})]}):m(`p`,{className:`py-12 text-base text-po-dim`,children:`Choose an agent to review its definition. Clear the filters if no agents match.`})})]}),x(Ae,{variant:`bar`,className:`gap-3 p-4 sm:px-6 sm:py-4`,children:[x(`div`,{className:`min-w-0 flex-1 space-y-1 text-sm text-po-dim`,children:[m(`p`,{className:`break-words`,children:M?`${M.name} · ${pe} · ${fe}`:`No agent selected`}),m(`p`,{role:`status`,children:f??`Enter starts the run · Shift+Enter for a new line${l?` · ${l}`:``}`}),ce?m(`p`,{role:`alert`,className:`text-po-red`,children:ce}):null]}),m(A,{"data-testid":`launch-cancel`,onClick:p,children:`Cancel`}),m(A,{"data-testid":`launch-submit`,variant:`primary`,disabled:!M||O||o,onClick:()=>void de(),children:O?`Starting…`:`Start run`})]})]})}function an({sessionId:e,agent:t,agents:n,loading:r,warning:i,onSource:a,cwd:o,models:s,fork:c,initialTask:l,onClose:u,onLaunched:d}){return m(O,{open:!0,onOpenChange:e=>{e||u()},children:m(rn,{agents:n??(t?[t]:[]),models:s,initialSelected:t?.name,initialTask:l,initialFork:c,loading:r,warning:i,cwd:o,onSource:a,onClose:u,onLaunch:async t=>{Jt(e,t.agent);try{await Tt(e,t),d()}catch(t){throw Yt(e),t}}})})}function on({sessionId:e,onClose:t,onSource:n}){let r=w(V.store,t=>V.select(t,e));return m(an,{sessionId:e,agents:r.agents,agent:r.agents.find(e=>e.name===(r.launch?.agent??r.selected)),cwd:r.cwd,models:r.models,fork:r.launch?.fork,initialTask:r.task,loading:r.loading,warning:r.warning,onSource:n,onClose:t,onLaunched:t})}var sn={queued:{label:`QUEUED`,tone:`neutral`},running:{label:`RUNNING`,tone:`running`},done:{label:`DONE`,tone:`ok`},failed:{label:`FAILED`,tone:`error`},stopped:{label:`STOPPED`,tone:`neutral`}};function cn(e,t){let n=e.endedAt??(e.state===`running`||e.state===`queued`?t:e.lastUpdate);return It(Math.max(0,n-e.startedAt))}function ln({run:e}){let t=y(null),[n]=F(Date.now);return f(()=>{let n,r=()=>{let i=t.current?.firstChild,a=Date.now();i&&(i.nodeValue=cn(e,a)),!W(e)&&e.endedAt===void 0&&(n=setTimeout(r,6e4-Math.max(0,a-e.startedAt)%6e4))};return r(),()=>clearTimeout(n)},[e]),m(`span`,{ref:t,children:cn(e,n)})}function un({sessionId:e,run:t,stopping:n}){let[r,i]=F(),a=(e,t)=>{e.stopPropagation(),t()},o=()=>{i(void 0),Kt(e,t.runId).catch(e=>i(e instanceof Error?e.message:String(e)))};return W(t)?m(A,{variant:`outline`,size:`xs`,"data-testid":`run-clear-${t.runId}`,title:`clear this run from the grid`,onClick:n=>a(n,()=>qt(e,t.runId)),children:`clear`}):x(c,{children:[r?m(`span`,{role:`alert`,"data-testid":`run-stop-error-${t.runId}`,title:r,className:`min-w-0 truncate text-sm text-po-red`,children:r}):null,m(A,{variant:n?`outline`:`danger-outline`,size:`xs`,"data-testid":`run-stop-${t.runId}`,"data-stopping":n,disabled:n,title:n?`stop requested; the run reports its own final state`:`ask the runtime to stop this run`,onClick:e=>a(e,o),children:n?`stopping…`:`stop`})]})}var K=`Not reported`,dn={done:`This run has finished. Start a new run from Agents.`,failed:`This run failed. Start a new run from Agents.`,stopped:`This run was stopped. Start a new run from Agents.`};function q({label:e,children:t}){return x(`div`,{className:`flex gap-3`,children:[m(`span`,{className:`w-24 shrink-0 text-sm text-po-dim`,children:e}),m(`div`,{className:`min-w-0 flex-1 break-words text-base text-po-text`,children:t})]})}function fn({run:e}){let t=[e?.toolCount===void 0?void 0:`${e.toolCount} tools`,e?.tokens===void 0?void 0:`${e.tokens.toLocaleString()} tokens`].filter(Boolean).join(` · `);return x(c,{children:[x(q,{label:`Agent`,children:[m(`span`,{className:`font-semibold text-po-hi`,children:e?.agent??K}),e?.agentDescription?m(`p`,{className:`text-po-dim`,children:e.agentDescription}):null,e?.agentFilePath?m(`p`,{className:`font-mono text-sm text-po-dim`,children:e.agentFilePath}):null]}),x(q,{label:`Model`,children:[e?.model??K,e?.model&&e.modelSource===`configured`?m(`span`,{className:`text-po-dim`,children:` · configured, not confirmed by the runtime`}):null]}),m(q,{label:`Thinking`,children:m(`span`,{className:`capitalize`,children:e?.thinking??K})}),m(q,{label:`Prompt`,children:e?.promptWithheld?m(`span`,{className:`text-po-dim`,children:`Withheld: this task was marked sensitive.`}):m(`pre`,{className:`max-h-40 overflow-y-auto rounded-md bg-po-deep px-3 py-2 font-sans whitespace-pre-wrap break-words`,children:e?.task||K})}),e?.taskRef?m(q,{label:`Task`,children:m(I,{tone:`violet`,size:`xs`,className:`rounded-sm bg-po-violet/10`,children:e.taskRef})}):null,m(q,{label:`Folder`,children:m(`span`,{className:`font-mono text-sm`,children:e?.cwd?Lt(e.cwd):K})}),m(q,{label:`Usage`,children:m(`span`,{className:`text-po-dim`,children:t||K})})]})}function pn({run:e,gone:t,elapsed:n,stopControl:r,thread:i,canSteer:a,stopping:s,guidance:c,sending:l,error:u,notice:d,onGuidanceChange:f,onSubmit:p,initialInfoOpen:_=!1}){let[v,y]=F(_),b=ae(),C=e?sn[e.state]:void 0,w={variant:`outline`,size:`md`,className:`min-w-0 max-w-full gap-2`,"aria-expanded":v,"aria-controls":b,onClick:()=>y(e=>!e)},ee=e&&W(e)?dn[e.state]:e?.canSteer===!1&&!t?`This runtime does not take guidance while it runs.`:`Guidance is unavailable for this run.`;return x(`div`,{"data-testid":`agent-thread-panel`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-po-bg`,children:[x(`div`,{"data-testid":`agent-thread-header`,className:`flex h-11 shrink-0 items-center gap-2.5 border-b border-po-border-soft bg-po-rail px-[26px]`,children:[e?m(h,{name:U(e).name,seed:U(e).seed,size:`sm`}):null,m(`span`,{"data-testid":`agent-thread-agent`,className:`min-w-0 shrink truncate text-base font-semibold text-po-hi`,children:e?Rt(e):`Agent run`}),e&&U(e).role?m(`span`,{className:`min-w-0 shrink truncate text-sm text-po-dim`,children:U(e).role}):null,C?m(S,{tone:C.tone,"data-testid":`agent-thread-state`,className:`shrink-0`,children:s&&e&&!W(e)?`STOPPING…`:C.label}):null,m(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,children:n}),r]}),t?m(`div`,{"data-testid":`agent-thread-gone`,className:`shrink-0 border-b border-po-border-soft px-[26px] py-2 text-sm text-po-dim`,children:`This run is no longer listed. Its thread stays readable.`}):null,m(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:i}),m(`section`,{id:b,"aria-label":`Run info`,"data-testid":`run-info`,hidden:!v,className:`mx-[26px] mb-2 flex max-h-[40vh] shrink-0 flex-col gap-3 overflow-y-auto rounded-lg border border-po-border bg-po-panel px-4 py-3`,children:m(fn,{run:e})}),a?m(`form`,{"data-testid":`agent-steer-composer`,className:`shrink-0 px-[26px] pt-2 pb-2`,onSubmit:e=>{e.preventDefault(),p()},children:x(`div`,{className:`rounded-lg border border-po-border bg-po-panel transition-colors focus-within:border-po-blue/60`,children:[m(g,{variant:`bare`,"data-testid":`agent-steer-input`,"aria-label":`Steering guidance`,rows:2,value:c,readOnly:l,disabled:s,placeholder:s?`Stopping, guidance paused`:`Guide this agent · it reads this at its next step`,className:`w-full px-4 pt-3 text-lg leading-relaxed`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),u?m(`p`,{role:`alert`,"data-testid":`agent-steer-error`,className:`px-4 pt-1 text-sm text-po-red`,children:u}):null,x(`div`,{className:`flex items-center gap-3 px-4 pt-1 pb-3`,children:[m(`span`,{className:`min-w-0 flex-1`}),m(`span`,{role:`status`,"data-testid":`agent-steer-hint`,title:d,className:`min-w-0 truncate text-sm text-po-dim`,children:d??`Shift + Enter for a new line`}),x(A,{"data-testid":`agent-steer-submit`,type:`submit`,variant:`primary`,size:`lg`,className:`shrink-0 gap-2`,disabled:s||l||c.trim()===``,children:[m(Me,{className:`size-4`}),l?`Sending…`:`Send`]})]})]})}):m(`div`,{"data-testid":`agent-thread-end`,className:`shrink-0 px-[26px] pt-3 pb-2 text-sm text-po-dim`,children:ee}),x(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 px-[26px] pb-4`,children:[x(A,{...w,"data-testid":`run-chip-agent`,children:[m(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-po-magenta`}),m(`span`,{className:`truncate`,children:e?.agent??`Agent`}),m(o,{"aria-hidden":!0,className:`size-3.5 shrink-0`})]}),x(A,{...w,"data-testid":`run-chip-model`,children:[m(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-po-green`}),m(`span`,{className:`truncate`,children:e?.model?e.model.split(`/`).pop()??e.model:`Model not reported`}),e?.thinking?m(`span`,{className:`shrink-0 text-po-dim`,children:e.thinking}):null,m(o,{"aria-hidden":!0,className:`size-3.5 shrink-0`})]}),x(A,{...w,"data-testid":`run-chip-prompt`,children:[m(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-po-blue`}),`Prompt`,m(o,{"aria-hidden":!0,className:`size-3.5 shrink-0`})]})]})]})}var mn=`subagents-run-`;function hn(e){let t=e.runId;return{id:`${mn}${t}`,label:Rt(e),panel:e=>m(gn,{...e,runId:t},`${e.sessionId}:${t}`)}}function gn({sessionId:e,runId:t,renderThread:n}){let{runs:r,stopRequested:i}=w(G.store,t=>G.select(t,e)),a=r.find(e=>e.runId===t),[o,s]=F(a);a!==void 0&&a!==o&&s(a);let c=a??o,l=a===void 0,[u,d]=F(``),[f,p]=F(!1),[h,g]=F(),[_,v]=F(),y=e!==null&&a!==void 0&&!W(a),b=i.includes(t),x=y&&a.canSteer!==!1,S=async()=>{let n=u.trim();if(x&&!b&&n&&!f){p(!0),g(void 0),v(void 0);try{let r=await Dt(e,t,n);if(r.state===`failed`){g(r.message);return}d(``),r.state===`pending`&&v(r.message)}catch(e){g(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return m(pn,{run:c,gone:l,elapsed:c?m(ln,{run:l?{...c,endedAt:c.endedAt??c.lastUpdate}:c}):void 0,stopControl:y?m(un,{sessionId:e,run:a,stopping:b}):void 0,thread:n(t),canSteer:x,stopping:b,guidance:u,sending:f,error:h,notice:_,onGuidanceChange:d,onSubmit:()=>void S()})}var _n=`subagents-fleet`,vn=8;function yn({run:e}){let t=e.task.split(`
2
- `).find(e=>e.trim()!==``)??``;return e.taskRef?x(`div`,{className:`flex items-center gap-2 px-3 pb-2.5`,children:[x(I,{tone:`violet`,size:`xs`,className:`shrink-0 rounded-sm bg-po-violet/10`,children:[`TASK `,e.taskRef]}),m(`span`,{"data-testid":`run-work`,className:`min-w-0 truncate text-base text-po-hi`,children:t})]}):x(`div`,{className:`flex items-center gap-2 px-3 pb-2.5`,children:[m(`span`,{className:`shrink-0 text-base font-medium text-po-dim`,children:`Prompt`}),m(`span`,{"data-testid":`run-work`,className:`min-w-0 truncate text-base text-po-dim`,children:t})]})}function bn({sessionId:t,run:n,stopping:r,onOpenThread:i,onOpenDetail:a}){let[o,s]=F();return x(c,{children:[o?m(`span`,{role:`alert`,"data-testid":`run-menu-stop-error-${n.runId}`,title:o,className:`min-w-0 truncate text-sm text-po-red`,children:o}):null,x(e,{children:[m(M,{asChild:!0,children:m(A,{variant:`ghost`,size:`icon`,"data-testid":`run-menu-${n.runId}`,title:`what this run can do`,"aria-label":`run actions`,onClick:e=>e.stopPropagation(),children:m(Te,{className:`h-3 w-3`})})}),x(me,{"data-testid":`run-menu-content-${n.runId}`,children:[m(we,{"data-testid":`run-open-${n.runId}`,onSelect:i,children:`open thread`}),m(we,{"data-testid":`run-detail-${n.runId}`,onSelect:a,children:`details`}),m(je,{}),W(n)?m(we,{"data-testid":`run-clear-${n.runId}`,onSelect:()=>qt(t,n.runId),children:`clear from the grid`}):m(we,{variant:`destructive`,"data-testid":`run-stop-${n.runId}`,"data-stopping":r,disabled:r,onSelect:()=>{s(void 0),Kt(t,n.runId).catch(e=>s(e instanceof Error?e.message:String(e)))},children:r?`stopping…`:`stop`})]})]})]})}function xn({sessionId:e,run:t,stopping:n,renderThread:r,onOpenThread:i,onOpenDetail:a}){let o=sn[t.state],s=U(t);return m(D,{asChild:!0,className:de(`flex h-[280px] min-w-0 flex-col text-left transition-colors outline-none hover:border-po-blue/50 focus-within:border-po-blue`,v[o.tone]),children:x(`div`,{"data-testid":`run-card-${t.runId}`,"data-run-state":t.state,children:[x(`div`,{role:`button`,tabIndex:0,"data-testid":`run-open-card-${t.runId}`,className:`flex min-h-0 flex-1 cursor-pointer flex-col outline-none`,title:`open this run's own thread in a tab`,onClick:i,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[x(`div`,{className:`flex items-center gap-2 px-3 pt-2.5 pb-1.5`,children:[m(h,{name:s.name,seed:s.seed,size:`sm`}),m(`span`,{"data-testid":`run-agent`,className:`truncate text-base font-semibold text-po-hi`,children:s.name}),s.role?m(`span`,{className:`truncate text-sm text-po-dim`,children:s.role}):null,m(`span`,{className:`min-w-0 flex-1`}),m(`span`,{className:`shrink-0 text-sm text-po-dim`,children:m(ln,{run:t})}),m(S,{tone:o.tone,"data-testid":`run-state`,children:o.label})]}),m(yn,{run:t}),m(`div`,{"data-testid":`run-stream`,className:`pointer-events-none flex min-h-0 flex-1 flex-col overflow-hidden border-t border-po-border-soft bg-po-deep`,children:r(t.runId,{limit:vn,compact:!0})}),t.state===`failed`&&t.error?m(`span`,{"data-testid":`run-error`,className:`truncate border-t border-po-border-soft px-3 py-1.5 text-sm text-po-red`,children:t.error}):null]}),x(`div`,{className:`flex shrink-0 items-center gap-3 border-t border-po-border-soft px-3 py-1.5`,children:[x(`span`,{className:`truncate text-sm text-po-dim`,children:[t.toolCount===void 0?`—`:`${t.toolCount} tools`,t.tokens===void 0?``:` · ${t.tokens.toLocaleString()} tk`,t.model?` · ${t.model.split(`/`).pop()??t.model}`:``]}),m(`span`,{className:`min-w-0 flex-1`}),m(bn,{sessionId:e,run:t,stopping:n,onOpenThread:i,onOpenDetail:a})]})]})})}function J({label:e,value:t,tone:n=`text-po-dim`}){return x(`div`,{className:`flex gap-2.5`,children:[m(`span`,{className:`w-11 shrink-0 text-sm text-po-dim`,children:e}),m(`span`,{className:`min-w-0 break-words text-base ${n}`,children:t})]})}function Sn({label:e,text:t,testId:n,tone:r}){return x(`div`,{className:`flex flex-col gap-1 rounded-md border border-po-border bg-po-deep px-3 py-2.5`,children:[m(`span`,{className:`text-base font-medium text-po-dim`,children:e}),m(`pre`,{"data-testid":n,className:`overflow-x-auto whitespace-pre-wrap break-words text-base leading-relaxed ${r??`text-po-text`}`,children:t})]})}function Cn({sessionId:e,run:t,stopping:n,renderSlot:r,onClose:i}){let a=sn[t.state];return m(ue,{open:!0,onOpenChange:e=>{e||i()},children:x(re,{"data-testid":`run-sheet`,"aria-describedby":void 0,children:[x(Fe,{closeLabel:`close the run detail`,children:[m(ie,{"data-testid":`sheet-agent`,children:Rt(t)}),m(S,{tone:a.tone,children:a.label}),m(`span`,{className:`min-w-0 flex-1`}),m(`span`,{className:`text-sm text-po-dim`,children:m(ln,{run:t})}),r(Bt.slot),m(un,{sessionId:e,run:t,stopping:n})]}),x(Ie,{children:[x(`div`,{className:`flex flex-col gap-1.5`,children:[m(J,{label:`run`,value:t.runId}),t.taskRef?m(J,{label:`task`,value:t.taskRef,tone:`text-po-violet`}):null,m(J,{label:`model`,value:t.model??`the runtime default`}),m(J,{label:`cwd`,value:Lt(t.cwd)}),m(J,{label:`work`,value:`${t.toolCount===void 0?`no`:String(t.toolCount)} tools${t.tokens===void 0?``:` · ${t.tokens.toLocaleString()} tk`}`})]}),m(Sn,{label:`PROMPT FROM THE MAIN AGENT`,testId:`sheet-task`,text:t.task||`(no prompt recorded)`}),t.summary?m(Sn,{label:`REPORT`,testId:`sheet-summary`,text:t.summary}):null,t.error?m(Sn,{label:`FAILURE`,testId:`sheet-error`,text:t.error,tone:`text-po-red`}):null]})]})})}function wn({sessionId:e,renderSlot:t,renderThread:n,openTransientTab:r,fileTabFor:i}){let a=w(G.store,t=>Wt(G.select(t,e))),{openRunId:o,stopRequested:s,autoOpenRunId:l}=w(G.store,t=>G.select(t,e)),u=w(V.store,t=>V.select(t,e));f(()=>{if(e!==null&&u.open)return Nt(e)},[e,u.open]),f(()=>{if(l===void 0||e===null)return;let t=a.find(e=>e.runId===l);t&&r(hn(t)),Xt(e)},[l,a,e,r]);let d=o===void 0?void 0:a.find(e=>e.runId===o),p=e=>s.includes(e.runId),h=a.filter(e=>e.state===`running`||e.state===`queued`).length,g=a.filter(e=>e.state===`done`).length,_=a.filter(e=>e.state===`failed`||e.state===`stopped`).length;return x(`div`,{"data-testid":`subagents-panel`,className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[x(`div`,{className:`@container flex min-w-0 flex-1 flex-col overflow-y-auto px-3 py-3 sm:px-[26px] sm:py-[18px]`,children:[x(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-3`,children:[m(`span`,{className:`text-lg font-semibold text-po-hi`,children:`Agents · this session`}),m(`span`,{className:`hidden min-w-0 flex-1 sm:block`}),m(`span`,{"data-testid":`subagents-tally`,className:`order-3 w-full text-sm text-po-dim sm:order-none sm:w-auto`,children:a.length===0?`no runs yet`:`${h} running · ${g} done · ${_} failed`}),m(A,{variant:`primary`,className:`ml-auto sm:ml-0`,"data-testid":`subagents-launch`,title:`pick an agent from the catalog and launch it`,onClick:()=>{e!==null&&(Zt(e,void 0),At(e))},children:`New agent run`})]}),a.length===0?x(`div`,{"data-testid":`subagents-empty`,className:`text-base text-po-dim`,children:[m(`p`,{children:`No runs yet`}),m(`p`,{children:`Start an agent run to get help with your work.`}),m(`p`,{className:`py-32 text-center text-sm`,children:`Agent runs will appear here once you start one.`})]}):x(c,{children:[m(`div`,{"data-testid":`subagents-grid`,className:`grid grid-cols-1 gap-4 @2xl:grid-cols-2`,children:e===null?null:a.map(t=>m(xn,{sessionId:e,run:t,stopping:p(t),renderThread:n,onOpenThread:()=>{Mt(e),r(hn(t))},onOpenDetail:()=>{Mt(e),Zt(e,t.runId)}},t.runId))}),m(`span`,{className:`pt-3 text-sm text-po-dim`,children:`click a card to open the run's thread · the card menu holds details, stop and clear · finished runs leave the grid after 10m`})]})]}),e!==null&&u.open?m(on,{sessionId:e,onClose:()=>Mt(e),onSource:t=>{let n=i(t.filePath);return n?()=>{Mt(e),r(n)}:void 0}}):null,d&&e!==null?m(Cn,{sessionId:e,run:d,stopping:p(d),renderSlot:t,onClose:()=>Zt(e,void 0)}):null]})}function Y(){return{id:_n,label:`Agents`,panel:wn}}var Tn=s({label:`Launch Agent`,detail:`Choose an agent, review the task, then launch it.`,kinds:[`work-item`],order:10,run:e=>jt(e,Y)}),En=a({keys:`a r`,icon:Ne,statusKey:`po-team-agents`,activeSource:{subscribe(e){let t=G.store.subscribe(e);return()=>t.unsubscribe()},isActive(e){return Gt(G.select(G.store.state,e)).some(e=>!W(e))}},transientTab:Y,order:10}),Dn=E(Pt),On=E(Qt),kn={queued:`waiting`,running:`running`,done:`done`,failed:`failed`,stopped:`done`};function An(e){return e.state===`failed`&&e.error?e.error:e.summary?e.summary.split(`
3
- `).find(e=>e.trim()!==``)??``:e.currentTool??e.tail.at(-1)??(e.state===`running`?``:e.state)}function jn({sessionId:e,openTransientTab:t}){let n=w(G.store,t=>Gt(G.select(t,e)));return n.length===0?x(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[m(`p`,{"data-testid":`activity-summary-agents`,className:`text-sm text-po-dim`,children:`Idle`}),x(A,{variant:`link`,size:`sm`,"data-testid":`activity-agents-launch`,className:`h-auto gap-1 px-0 text-sm text-po-green`,onClick:()=>{e!==null&&(At(e),t(Y()))},children:[`Launch an agent`,m(Pe,{"aria-hidden":!0,className:`size-3.5`})]})]}):m(`div`,{"data-testid":`activity-agent-runs`,className:`flex flex-col gap-0.5`,children:n.map(n=>{let r=U(n),i=An(n);return m(A,{variant:`ghost`,size:`card`,"data-testid":`activity-run-${n.runId}`,"data-run-state":n.state,title:`open this run's conversation`,onClick:()=>{e!==null&&t(hn(n))},className:`min-w-0 gap-0.5 rounded-md px-1 py-1 hover:bg-po-panel`,children:x(`span`,{className:`flex min-w-0 items-center gap-2`,children:[m(h,{name:r.name,seed:r.seed,state:kn[n.state],size:`sm`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col text-left`,children:[x(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[m(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:r.name}),r.role?m(`span`,{className:`truncate text-sm text-po-dim`,children:r.role}):null]}),i?m(`span`,{className:`truncate text-sm ${n.state===`failed`?`text-po-red`:`text-po-dim`}`,children:i}):null]}),x(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[m(ln,{run:n}),n.toolCount===void 0?``:` · ${n.toolCount} tools`]})]})},n.runId)})})}var Mn=xe({component:jn}),Nn={key:`a`,label:`agents`,detail:`subagent resources and runs`},Pn=ye({path:[Nn,{key:`l`,label:`launch`,detail:`pick an agent and launch it`}],run:e=>{e.sessionId!==null&&At(e.sessionId),e.openTransientTab(Y())}}),Fn=ye({path:[Nn,{key:`r`,label:`runs`,detail:`runs in this session`}],run:e=>e.openTransientTab(Y())}),In=r({description:`Render an action beside the stop control in a subagent run detail sheet, using that run's props.`}),Ln=72,Rn=`…`;function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return typeof e==`string`?e:``}function zn(e){switch(e.action){case`agents`:return Z(e.name);case`run`:{let t=Array.isArray(e.requests)?e.requests:[],n=t.map(e=>X(e)?Z(e.agent):``).filter(Boolean),r=`${t.length} agent${t.length===1?``:`s`}`;return n.length>0?`${r} · ${n.join(`, `)}`:r}case`status`:return e.id?`run`:`fleet`;default:return``}}function Bn(e){let t=e.split(`
4
- `);for(;t.length>0&&t.at(-1)?.trim()===``;)t.pop();return t.length===1&&t[0]===``?[]:t}function Vn(e,t){let n=Bn(e);if(t.isPartial)return{lines:n.slice(-12),glyph:`running`,hidden:0};let r=t.expanded?n:n.slice(0,12),i=n.length-r.length;return t.isError?{lines:r,glyph:`failed`,hidden:i}:i>0?{lines:r,glyph:`more`,hidden:i}:r.length===0?{lines:r,glyph:`done`,hidden:0}:{lines:r,glyph:`none`,hidden:0}}function Q(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ln?`${t.slice(0,71)}${Rn}`:t}function Hn(e){return Array.isArray(e)?e.filter(X):[]}function Un(e){return e.filter(e=>typeof e==`string`&&e.trim()!==``).join(` · `)}function Wn(e){if(e===`failed`||e===`error`)return`failed`;if(e===`running`||e===`starting`)return`running`;if(e===`queued`)return`waiting`;if(e===`complete`||e===`completed`||e===`stopped`)return`done`}function Gn(e){return e===`failed`||e===`error`?`error`:e===`complete`||e===`completed`?`ok`:e===`running`||e===`starting`?`running`:`idle`}function Kn(e,t){return e===0?`no ${t}s`:`${e} ${t}${e===1?``:`s`}`}function qn(e){let t=Hn(e).map((e,t)=>({key:`${Z(e.name)}-${t}`,label:Z(e.name),seed:Z(e.name),detail:Q(Z(e.description)),state:Z(e.source),tone:`idle`}));return{kind:`agents`,rows:t,summary:Kn(t.length,`agent`),tone:`idle`}}function Jn(e){let t=Hn(e).map((e,t)=>{let n=Z(e.runId);return{key:n||`${Z(e.agent)}-${t}`,label:Z(e.agent),seed:Z(e.agent),avatar:n?`running`:`failed`,detail:Q(Z(n?e.task:e.error))||(n?``:`unknown error`),state:n?`started`:`failed`,tone:n?`ok`:`error`}}),n=t.filter(e=>e.state===`started`).length,r=t.length-n;return{kind:`run`,rows:t,summary:r===0?`${n} started`:`${n} started · ${r} failed`,tone:r===0?`ok`:`error`}}function Yn(e){let t=Hn(e).map((e,t)=>{let n=Z(e.status)||`starting`,r=U({agent:Z(e.agent),identity:Z(e.identity)||void 0});return{key:Z(e.runId)||`run-${t}`,label:r.name,seed:r.seed,avatar:Wn(n),detail:Q(Un([r.role,e.currentTool,e.activityState,e.attentionReason,e.error])),state:n,tone:Gn(n)}});return{kind:`fleet`,rows:t,summary:Kn(t.length,`run`),tone:`idle`}}function Xn(e){let t=Z(e.runId),n=X(e.status)?e.status:void 0,r=n?Z(n.state):``;if(!r)return{kind:`status`,rows:[],summary:`no status yet`,tone:`idle`};let i=U({agent:Z(n?.agent),identity:Z(n?.identity)||void 0});return{kind:`status`,rows:[{key:t,label:i.name,seed:i.seed,avatar:Wn(r),detail:Q(Un([i.role,n?.activityState,n?.summary,n?.error])),state:r,tone:Gn(r)}],summary:``,tone:Gn(r)}}function Zn(e,t){return{kind:`control`,rows:[],summary:e,tone:t}}function Qn(e){if(!X(e)||e.partial===!0)return null;if(Array.isArray(e.agents))return qn(e.agents);if(Array.isArray(e.outcomes))return Jn(e.outcomes);if(X(e.spawn)&&Array.isArray(e.spawn.outcomes))return Jn(e.spawn.outcomes);if(Array.isArray(e.runs))return Yn(e.runs);if(Array.isArray(e.fleet))return Yn(e.fleet);if(X(e.control))return Zn(`stop requested`,`ok`);if(X(e.steer)){let t=Z(e.steer.state);return Zn(`steer ${t}${e.steer.message?`: ${Q(Z(e.steer.message))}`:``}`,t===`failed`?`error`:`ok`)}return typeof e.runId==`string`?Xn(e):null}function $n(e,t){let n=Z(e.action),r=X(t)?Z(t.toName).trim():``;switch(n){case`send`:case`ask`:return{action:n,target:r||Z(e.to),message:Q(Z(e.message))};case`reply`:return{action:n,target:Z(e.requestId),message:Q(Z(e.message))};default:return{action:n,target:``,message:``}}}function er(e){return X(e)?e.delivered===!0?{outcome:`delivered`,who:Z(e.to),reply:``}:e.state===`queued`?{outcome:`queued`,who:Z(e.to),reply:``}:typeof e.reply==`string`?{outcome:`answered`,who:Z(e.from),reply:e.reply}:typeof e.requestId==`string`&&typeof e.to==`string`?{outcome:`replied`,who:e.to,reply:``}:{outcome:`none`,who:``,reply:``}:{outcome:`none`,who:``,reply:``}}function tr(e){return X(e)?Z(e.sender):``}var nr={delivered:{tone:`neutral`,glyph:`✓`,text:`Delivered`},queued:{tone:`running`,glyph:void 0,text:`Queued, not yet confirmed`},replied:{tone:`neutral`,glyph:`✓`,text:`Replied`}},rr={ask:`Asked`,send:`Message`,reply:`Reply`};function ir({name:e,chip:t,state:n,testId:r,children:i}){return x(`div`,{"data-testid":r,className:`flex items-start gap-2`,children:[m(h,{name:e,size:`sm`,...n?{state:n}:{}}),x(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[x(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[m(`span`,{className:`truncate font-semibold text-po-hi`,children:e}),t]}),i]})]})}function ar({args:e,result:t,output:n,running:r,isError:i}){let a=$n(e,t?.details),o=Vn(n,{expanded:!1,isPartial:r,isError:i}),s=r||i?{outcome:`none`,who:``,reply:``}:er(t?.details),l=s.outcome===`none`||s.outcome===`answered`?null:nr[s.outcome],u=typeof e.message==`string`?e.message.trim():``,d=a.action===`reply`?s.who:a.target,f=tr(t?.details),p=rr[a.action];return m(Oe,{tone:be({running:r,isError:i}),expandable:o.glyph===`more`,children:({expanded:e})=>{let t=e?Vn(n,{expanded:!0,isPartial:r,isError:i}):o;return x(c,{children:[m(ve,{title:`intercom`,children:x(`span`,{"data-testid":`tool-call-intercom`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[m(`span`,{className:`text-po-hi`,children:a.action}),d?x(`span`,{className:`shrink-0 text-po-cyan`,children:[`→ `,d]}):null]})}),x(Se,{"data-testid":`tool-result-intercom`,className:`flex flex-col gap-3`,children:[u&&!i?x(`div`,{"data-testid":`intercom-outgoing`,className:`flex flex-col items-end gap-1`,children:[x(`div`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[p?m(I,{tone:`neutral`,size:`xs`,children:p}):null,f?x(c,{children:[m(h,{name:f,size:`sm`}),m(`span`,{className:`truncate font-semibold text-po-hi`,children:f})]}):null]}),m(`p`,{className:`max-w-xl rounded-lg bg-po-tint-green px-3 py-2 text-base break-words whitespace-pre-wrap text-po-hi`,children:u}),l?m(P,{tone:l.tone,glyph:l.glyph,children:l.text}):null,r&&a.action!==`ask`?m(P,{tone:`running`,children:`Sending`}):null]}):null,r&&u&&a.action===`ask`?m(ir,{testId:`intercom-replying`,name:d||`reply`,state:`running`,chip:m(`span`,{className:`text-po-dim`,children:`is replying`}),children:x(`div`,{role:`status`,"aria-label":`${d||`The recipient`} is replying`,className:`flex items-center gap-1.5 rounded-lg bg-po-rail px-3 py-3`,children:[m(te,{tone:`muted`,size:`md`,pulse:!0}),m(te,{tone:`muted`,size:`md`,pulse:!0}),m(te,{tone:`muted`,size:`md`,pulse:!0})]})}):null,s.outcome===`answered`?m(ir,{testId:`intercom-incoming`,name:s.who,chip:m(I,{tone:`green`,size:`xs`,children:`Replied`}),children:m(`p`,{className:`max-w-xl rounded-lg bg-po-rail px-3 py-2 text-base break-words whitespace-pre-wrap text-po-hi`,children:s.reply})}):null,i?m(`p`,{role:`alert`,className:`text-base break-words text-po-red`,children:t.lines.join(`
5
- `)||`Failed`}):null,!u&&!i&&t.lines.length>0?m(`p`,{className:`${e?`whitespace-pre-wrap break-words`:`truncate`} text-po-dim`,children:t.lines.join(`
6
- `)}):null,t.glyph===`more`?x(P,{expands:!0,children:[t.hidden,` more line(s)`]}):null]})]})}})}var or=d({message:ar}),sr={running:{tone:`running`,text:`Running`},failed:{tone:`error`,text:`Failed`},done:{tone:`ok`,text:`Done`}},cr={ok:`ok`,error:`error`,running:`running`,idle:`neutral`},lr={ok:`ok`,error:`error`,running:`running`,idle:`ok`};function ur({row:e}){return x(`li`,{"data-testid":`tool-result-subagent-row`,className:`flex items-center gap-3 rounded-md px-2 py-1.5`,children:[m(h,{name:e.label,seed:e.seed,state:e.avatar}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[m(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.label}),e.detail?m(`span`,{className:`truncate text-sm text-po-dim`,children:e.detail}):null]}),e.state?m(S,{tone:cr[e.tone],size:`md`,className:cr[e.tone]===`neutral`?`bg-po-rail`:void 0,children:e.state}):null]})}function dr({args:e,result:t,output:n,running:r,isError:i,openTransientTab:a}){let o=typeof e.action==`string`?e.action:``,s=zn(e),l=r||i?null:Qn(t?.details),u=l?Math.max(0,l.rows.length-8):0,d=l?null:Vn(n,{expanded:!1,isPartial:r,isError:i});return m(Oe,{tone:be({running:r,isError:i}),expandable:l?u>0:d?.glyph===`more`,children:({expanded:e})=>{let t=l||!d?null:e?Vn(n,{expanded:!0,isPartial:r,isError:i}):d,f=!t||t.glyph===`none`||t.glyph===`more`?null:sr[t.glyph],p=l?e?l.rows:l.rows.slice(0,8):[];return x(c,{children:[m(ve,{title:`subagent`,children:x(`span`,{"data-testid":`tool-call-subagent`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[m(`span`,{className:`text-po-dim`,children:o}),s?m(`span`,{className:`min-w-0 truncate text-po-dim`,children:s}):null]})}),x(Se,{"data-testid":`tool-result-subagent`,className:`flex flex-col gap-1`,children:[p.length>0?m(`ul`,{className:`-mx-2 flex flex-col`,children:p.map(e=>m(ur,{row:e},e.key))}):null,t&&t.lines.length>0?m(`pre`,{className:`${e?`whitespace-pre-wrap break-words`:`truncate`} text-po-dim`,children:t.lines.join(`
7
- `)}):null,!e&&u>0?x(P,{expands:!0,children:[u,` more`]}):null,f?m(P,{tone:f.tone,children:f.text}):null,t?.glyph===`more`?x(P,{expands:!0,children:[t.hidden,` more line(s)`]}):null,x(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 ${p.length>0?`mt-1 border-t border-po-border-soft pt-2.5`:``}`,children:[l&&l.summary?m(P,{"data-testid":`tool-result-subagent-summary`,tone:lr[l.tone],children:l.summary}):null,x(A,{variant:`link`,size:`sm`,"data-testid":`tool-result-subagent-open`,onClick:()=>a(Y()),className:`h-auto gap-1 px-0 text-sm text-po-green`,children:[`Open subagents`,m(Pe,{"aria-hidden":!0,className:`size-3.5`})]})]})]})]})}})}var fr=d({message:dr}),$=(e,t)=>t===void 0?void 0:{...e,...t},pr=l({id:`subagents`,packageName:`@agimon-ai/po-team`,host:{get settingsPanels(){return[$({id:`agent-models`},pt)]},get settingsSections(){return[$({id:`team`},ht)]}},workspace:{get fills(){return[$({slot:`home`,id:`team`},gt)]},get repositorySettingsPanel(){return vt},get settingsSections(){return[$({id:`team`},yt)]}},session:{get activityGroups(){return[$({name:`agents`},En)]},get channels(){return[$({channel:`subagent_catalog`},Dn),$({channel:`subagent_runs`},On)]},get contextActions(){return[$({id:`launch-agent`},Tn)]},get fills(){return[$({slot:`activity.agents`,id:`agents`},Mn)]},get leaderBindings(){return[$({id:`subagents.catalog`},Pn),$({id:`subagents.fleet`},Fn)]},get slots(){return[$({slot:`subagents.run-actions`},In)]},get toolRenderers(){return[$({tools:[`intercom`]},or),$({tools:[`subagent`]},fr)]}}});export{pr as webPlugin};
@@ -1 +0,0 @@
1
- import{$i as e,A as t,An as n,B as r,Bi as i,Bt as a,C as o,Ci as s,Cn as c,D as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,Ga as g,Gi as _,H as v,Ht as y,It as b,J as x,Jr as S,K as C,Ka as w,Ki as T,Kt as E,L as D,Lt as O,M as k,Mi as A,N as j,Nr as M,O as N,On as P,Ot as F,P as I,Pt as L,Q as R,Qt as z,R as ee,Rn as te,S as B,St as ne,T as re,Ti as ie,Tt as ae,Ui as V,Un as oe,Ut as se,Wi as H,X as U,Xi as W,Y as ce,Yi as G,Yr as K,Z as le,Za as ue,_ as de,_a as fe,_t as q,a as pe,aa as J,at as me,b as he,bn as ge,bt as _e,c as ve,ci as ye,d as be,dt as xe,ea as Y,ei as Se,en as X,et as Ce,f as we,fn as Te,ft as Ee,g as De,ga as Oe,gt as ke,h as Ae,ha as je,ii as Me,in as Ne,it as Pe,j as Fe,ki as Ie,kr as Le,lt as Re,ma as ze,mi as Be,mt as Ve,n as He,na as Z,nn as Ue,nt as We,o as Ge,oa as Ke,on as qe,ot as Je,p as Ye,pt as Xe,q as Ze,qi as Q,qt as $,r as Qe,s as $e,sn as et,st as tt,t as nt,ta as rt,ti as it,tn as at,tr as ot,u as st,ut as ct,v as lt,w as ut,wt as dt,x as ft,xt as pt,y as mt,yi as ht,yn as gt,z as _t,zt as vt}from"../chunks/po-web-runtime-Yjk5kSCS.js";function yt(e){return e.slice(e.lastIndexOf(`/`)+1)||e}function bt({start:e,listDirectory:t,onSelect:n}){let[r,i]=$(e),[a,o]=$(null),[s,l]=$(``);return y(()=>{let e=!1;return t(r).then(t=>{e||(`error`in t?l(t.error):(l(``),o(t)))}),()=>{e=!0}},[r,t]),O(`div`,{"data-testid":`folder-browser`,className:`flex flex-col gap-1 rounded border border-po-border bg-po-deep p-1`,children:[O(`div`,{className:`flex items-center gap-1 px-1`,children:[b(K,{variant:`ghost`,size:`icon`,"data-testid":`folder-browser-up`,title:`parent folder`,"aria-label":`parent folder`,disabled:a?.parent===void 0,onClick:()=>a?.parent!==void 0&&i(a.parent),children:b(Ie,{className:`h-3 w-3`})}),b(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,title:a?.path,children:a?.path??`loading…`}),b(K,{variant:`outline`,size:`xs`,"data-testid":`folder-browser-select`,disabled:a===null,onClick:()=>a!==null&&n(a.path),children:`use this folder`})]}),s?b(`p`,{className:`px-2 py-1 text-sm text-po-red`,children:s}):null,O(`div`,{role:`listbox`,"aria-label":`folders`,className:`max-h-40 overflow-y-auto`,children:[a!==null&&a.directories.length===0?b(`p`,{className:`px-2 py-1 text-sm text-po-dim`,children:`no folders here`}):null,a?.directories.map(e=>b(c,{density:`compact`,"data-testid":`folder-browser-entry`,onClick:()=>i(e),className:`w-full px-2.5 py-1 `,children:yt(e)},e))]})]})}var xt=120,St=-1,Ct=/\/+$/u;function wt(e){let t=e.trim().replace(Ct,``);return t.slice(t.lastIndexOf(`/`)+1)}function Tt({suggestedPaths:e,actions:t}){let n=L(u,e=>e),r=n.path??e[0]??``,[i,a]=$({path:``,directories:[]});return y(()=>{let e=r.trim();if(e===``)return;let n=!1,i=setTimeout(async()=>{let i=await t.searchDirectories(e);n||a({path:r,directories:i.filter(t=>t!==e)})},xt);return()=>{n=!0,clearTimeout(i)}},[r,t]),y(()=>h(r,t.discoverWorkspaces),[r,t.discoverWorkspaces]),b(Et,{suggestions:r.trim()!==``&&i.path===r?i.directories:[],suggestedPaths:e,actions:t,draft:n,updateDraft:Ee})}function Et({suggestedPaths:e,actions:t,draft:n,updateDraft:r,style:i,suggestions:a=[]}){let{name:o,nameEdited:s,instructions:l,pending:u,error:d,discovery:f}=n,p=n.path??e[0]??``,h=e=>r({name:e}),g=e=>r({nameEdited:e}),v=e=>r({path:e}),[y,x]=$(!1),[C,w]=$(St),T=E(null),D=s?o:wt(p),k=e=>{u||(v(e),w(St))},A=e=>{k(`${e}/`),T.current?.focus()},j=p.trim().replace(Ct,``)||(p.trim()===``?``:`/`),M=n.discovering||!!p.trim()&&t.discoverWorkspaces!==void 0&&n.discoveryPath!==p,N=f&&`error`in f?f.error:``,P=f&&`declarations`in f&&f.declarations.length>0?f.declarations:void 0,F=e=>P?.find(t=>t.name===e)?.workspaceId??n.results.find(t=>t.name===e)?.workspaceId,I=P?.filter(e=>n.checked.includes(e.name)&&!F(e.name)).map(e=>e.name)??[],L=!P&&!M&&!N,R=!u&&!M&&!N&&(P?I.length>0&&t.addDeclaredWorkspaces!==void 0:j!==``||D.trim()!==``),z=async()=>{R&&(P?await t.addDeclaredWorkspaces?.({path:f&&`root`in f?f.root:j,names:I}):await t.addWorkspace({...l===``?{}:{instructions:l},name:D.trim(),...j===``?{}:{path:j}}))};return b(V,{open:!0,onOpenChange:e=>!e&&!u&&t.closeAddWorkspace(),children:O(_,{style:i,width:`md`,"data-testid":`add-workspace-dialog`,"aria-describedby":void 0,children:[b(G,{children:b(W,{children:`Add workspace`})}),O(H,{children:[O(`label`,{htmlFor:`add-workspace-root`,className:`flex flex-col gap-1`,children:[b(`span`,{className:`text-base font-medium text-po-dim`,children:`Folder`}),O(`span`,{className:`flex items-center gap-1.5`,children:[b(X,{id:`add-workspace-root`,ref:T,"data-testid":`add-workspace-root`,value:p,autoFocus:!0,disabled:u,onChange:e=>k(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`&&a.length>0)e.preventDefault(),w(e=>(e+1)%a.length);else if(e.key===`ArrowUp`&&a.length>0)e.preventDefault(),w(e=>e<=0?a.length-1:e-1);else if(e.key===`Enter`){let e=C===St?void 0:a[C];e===void 0?z():A(e)}},placeholder:`~/workspace/my-project`,className:`min-w-0 flex-1 font-mono`}),b(K,{variant:y?`subtle`:`outline`,size:`md`,"data-testid":`add-workspace-browse`,"aria-pressed":y,disabled:u,onClick:()=>x(e=>!e),children:`Browse`})]})]}),y?b(bt,{...j.startsWith(`/`)?{start:j}:{},listDirectory:t.listDirectory,onSelect:e=>{k(e),x(!1)}}):a.length>0?b(`div`,{role:`listbox`,"aria-label":`matching directories`,"data-testid":`add-workspace-suggestions`,className:`max-h-40 overflow-y-auto rounded border border-po-border bg-po-deep p-1`,children:a.map((e,t)=>b(c,{density:`compact`,active:t===C,"data-testid":`add-workspace-suggestion`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>w(t),onClick:()=>A(e),className:`w-full px-2.5 py-1 `,children:e},e))}):null,e.length>0?b(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,4).map(e=>b(K,{variant:`outline`,size:`xs`,disabled:u,onClick:()=>k(e),children:e},e))}):null,M?b(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Reading workspace declarations…`}):null,N?b(`p`,{role:`alert`,className:`text-sm text-po-red`,children:N}):null,P?O(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[b(`legend`,{className:`mb-1 text-base font-medium text-po-hi`,children:`Workspaces`}),b(`p`,{className:`mb-1 text-sm text-po-dim`,children:`Declared in .po/config.yaml. Choose which to add.`}),P.map((e,t)=>{let i=F(e.name)!==void 0,a=i||n.checked.includes(e.name),o=n.results.find(t=>t.name===e.name)?.error;return b(`div`,{"data-checked":a,className:`rounded-sm px-2 py-1.5 data-[checked=true]:bg-po-tint-green`,children:O(`label`,{htmlFor:`add-workspace-declaration-${t}`,className:`flex min-w-0 cursor-pointer items-start gap-2.5`,children:[b(ht,{id:`add-workspace-declaration-${t}`,checked:a,disabled:i||u,onCheckedChange:()=>r({checked:a?n.checked.filter(t=>t!==e.name):[...n.checked,e.name]}),className:`mt-1`}),O(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),b(`span`,{className:`truncate text-sm text-po-dim`,title:e.instructions,children:e.instructions}),o?b(`span`,{role:`alert`,className:`text-sm text-po-red`,children:o}):null]}),i?b(`span`,{className:`text-sm text-po-dim`,children:`Added`}):null]})},e.name)})]}):L?O(m,{children:[O(`label`,{htmlFor:`add-workspace-name`,className:`flex flex-col gap-1`,children:[b(`span`,{className:`text-base font-medium text-po-dim`,children:`Name`}),b(X,{id:`add-workspace-name`,"data-testid":`add-workspace-name`,value:D,disabled:u,onChange:e=>{g(!0),h(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&z()},placeholder:`my-project`})]}),O(`label`,{htmlFor:`add-workspace-instructions`,className:`flex flex-col gap-1`,children:[O(`span`,{className:`text-base font-medium text-po-dim`,children:[`Instructions `,b(`span`,{className:`font-normal`,children:`(optional)`})]}),b(S,{id:`add-workspace-instructions`,rows:3,value:l,disabled:u,onChange:e=>r({instructions:e.target.value})}),b(`span`,{className:`text-sm text-po-dim`,children:`For main sessions in this workspace.`})]})]}):null,L&&j===``&&D.trim()!==``?O(`p`,{"data-testid":`add-workspace-default-hint`,className:`text-sm text-po-dim`,children:[`creates ~/.po/workspace/`,D.trim()]}):null,d?b(`pre`,{className:`max-h-28 overflow-y-auto rounded border border-po-edge-red bg-po-tint-red/40 px-2.5 py-2 text-sm whitespace-pre-wrap text-po-red`,children:d}):null,O(Q,{children:[b(K,{variant:`outline`,onClick:()=>t.closeAddWorkspace(),disabled:u,children:`Cancel`}),b(K,{variant:`primary`,"data-testid":`add-workspace-confirm`,onClick:()=>void z(),disabled:!R,children:u?`Adding…`:P?`Add ${I.length} ${I.length===1?`workspace`:`workspaces`}`:`Add workspace`})]})]})]})})}var Dt=`rail/workflow-steps-expanded`,Ot=e=>e.awaitingInput||(e.waitingCount??0)>0;function kt(e){let t=new Set(e.map(({session:e})=>e.id)),n=new Map,r=[];for(let i of e){let e=i.session.parentId;i.session.provenance===`workflow`&&e!==void 0&&t.has(e)?n.set(e,[...n.get(e)??[],i]):r.push(i)}let i=r.sort((e,t)=>(t.session.lastActivityAt??0)-(e.session.lastActivityAt??0)).map(e=>[e,...n.get(e.session.id)??[]]),a=e=>e.some(({session:e})=>Ot(e));return[{key:`needs`,title:`Needs you`,data:i.filter(a).flat()},{key:`recent`,title:`Recent`,data:i.filter(e=>!a(e)).flat()}].filter(e=>e.data.length>0)}function At({sessionId:t,setup:n,actions:r}){let i=JSON.stringify([`rail/setup`,t,n.id]),[a,o,s]=q(`${i}/busy`,!1),[c,l]=q(`${i}/error`,``),u=async()=>{if(s.state)return;o(!0),l(``);let e=await r.removePendingSetup(t,n.id);o(!1),e!==void 0&&l(e.error)};return O(`div`,{"data-testid":`pending-session-${n.id}`,className:`ml-4 rounded-md border border-po-border-soft bg-po-panel p-3`,children:[O(`div`,{className:`flex items-center justify-between gap-2`,children:[b(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:n.name}),O(e,{children:[b(J,{asChild:!0,children:b(K,{variant:`ghost`,size:`icon`,title:`session setup actions`,disabled:a,"data-testid":`pending-session-menu-${n.id}`,children:b(Ue,{className:`h-3 w-3`})})}),b(Y,{children:b(Z,{variant:`destructive`,onSelect:()=>void u(),children:`remove setup`})})]})]}),b(`p`,{className:n.failed?`text-sm text-po-red`:`text-sm text-po-dim`,children:n.status}),n.recovery?b(`p`,{role:n.failed?`alert`:void 0,className:`text-sm text-po-dim`,children:n.recovery}):null,c?b(`p`,{role:`alert`,className:`text-sm text-po-red`,children:c}):null]})}function jt(e,t,n=[]){return[...new Set([...e.flatMap(e=>e.groups??[]),...n])].map(n=>({name:n,members:e.filter(e=>e.id!==t&&e.groups?.includes(n)===!0).map(e=>e.name||`Untitled`)}))}function Mt(e,t){if(e.length>32)return`group names are at most 32 characters.`;if(t>=8)return`a session can belong to at most 8 groups.`}function Nt({groups:e}){return O(`span`,{"data-testid":`session-groups`,"aria-label":`groups`,className:`flex min-w-0 items-start gap-1.5 text-sm text-po-dim`,children:[b(it,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),b(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:e.map(e=>b(ot,{tone:`magenta`,size:`xs`,className:`font-normal`,children:e},e))})]})}function Pt({options:e,value:t,query:r,active:i,renaming:a,deleting:o,error:s,busy:c=!1,onQueryChange:l,onToggle:u,onCreate:d,onActive:f,onRenameStart:p,onRenameDraft:m,onRenameConfirm:h,onDeleteStart:g,onDeleteConfirm:_,onRowCancel:v,onCancel:y,onSave:x}){let S=se(),C=r.trim(),w=e.filter(e=>e.name.includes(C)),E=C!==``&&!e.some(e=>e.name===C),D=E?Mt(C,t.length):void 0;return O(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),x()},children:[b(T,{children:`sessions that share a group can message each other.`}),O(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-po-border focus-within:border-po-edge-green`,children:[O(`div`,{className:`flex flex-wrap items-center gap-1 bg-po-deep px-2 py-1.5`,children:[t.map(e=>O(ot,{tone:`magenta`,size:`xs`,className:`font-normal`,children:[e,b(`button`,{type:`button`,"aria-label":`remove ${e}`,className:`text-po-magenta`,onClick:()=>u(e),children:b(A,{"aria-hidden":!0,className:`size-2.5`})})]},e)),b(X,{variant:`bare`,"data-testid":`session-groups-query`,"aria-label":`find or create a group`,autoFocus:!0,placeholder:t.length===0?`find or create a group`:`add another`,value:r,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C!==``&&(e.preventDefault(),E?D===void 0&&d():w[0]!==void 0&&(u(w[0].name),l(``)))},className:`h-6 min-w-24 flex-1`})]}),O(`div`,{className:`flex flex-col border-t border-po-border-soft p-1`,onMouseLeave:()=>f(void 0),children:[w.map((e,n)=>{let r=t.includes(e.name),s=`${S}-${String(n)}`,l=e.members.length+ +!!r,d=l===1?`its one session`:`all ${String(l)} sessions`;return a?.group===e.name?O(`div`,{className:`flex flex-col gap-1 rounded-sm bg-po-deep px-2 py-1.5`,children:[O(`span`,{className:`flex items-center gap-2`,children:[b(X,{"aria-label":`rename ${e.name}`,value:a.draft,autoFocus:!0,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h())},className:`h-7 flex-1`}),b(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:v,children:`cancel`}),b(K,{type:`button`,variant:`outline`,size:`sm`,disabled:c||a.draft.trim()===``,onClick:h,children:`rename`})]}),O(`span`,{className:`text-sm text-po-dim`,children:[`renames it on `,d,`.`]})]},e.name):o===e.name?O(`div`,{className:`flex items-center gap-2 rounded-sm border border-po-red/40 px-2 py-1.5`,children:[O(`span`,{className:`flex-1 text-sm text-po-text`,children:[`remove `,b(`span`,{className:`font-semibold text-po-hi`,children:e.name}),` from `,d,`? they can no longer message through it.`]}),b(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:v,children:`cancel`}),b(K,{type:`button`,variant:`danger`,size:`sm`,disabled:c,onClick:_,children:`delete`})]},e.name):O(`div`,{"data-testid":`session-group-${e.name}`,onMouseEnter:()=>f(e.name),className:`group flex items-start gap-2.5 rounded-sm px-2 py-1.5 ${r?`bg-po-tint-green`:i===e.name?`bg-po-deep`:``}`,children:[O(`label`,{htmlFor:s,className:`flex min-w-0 flex-1 cursor-pointer items-start gap-2.5`,children:[b(ht,{id:s,checked:r,onCheckedChange:()=>u(e.name),className:`mt-1`}),O(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`span`,{className:`text-base ${r?`font-semibold text-po-hi`:`text-po-text`}`,children:e.name}),b(`span`,{className:`truncate text-sm text-po-dim`,title:e.members.join(`, `),children:e.members.length===0?`no other sessions yet`:e.members.join(`, `)})]})]}),O(`span`,{className:`flex shrink-0 items-center gap-0.5 ${i===e.name?`opacity-100`:`opacity-0 group-focus-within:opacity-100`}`,children:[b(K,{type:`button`,variant:`ghost`,size:`icon`,title:`rename ${e.name}`,onClick:()=>p(e.name),children:b(Ke,{"aria-hidden":!0,className:`size-3.5`})}),b(K,{type:`button`,variant:`ghost`,size:`icon`,title:`delete ${e.name}`,onClick:()=>g(e.name),children:b(Se,{"aria-hidden":!0,className:`size-3.5`})})]})]},e.name)}),E?O(`button`,{type:`button`,"data-testid":`session-groups-create`,disabled:D!==void 0,onClick:d,className:`flex flex-col gap-0.5 rounded-sm px-2 py-1.5 text-left ${D===void 0?`bg-po-deep`:``}`,children:[O(`span`,{className:`flex items-center gap-2.5 text-base ${D===void 0?`text-po-magenta`:`text-po-faint`}`,children:[b(n,{"aria-hidden":!0,className:`size-3.5`}),O(`span`,{className:`truncate`,children:[`create group “`,C,`”`]})]}),D===void 0?null:b(`span`,{className:`pl-6 text-sm text-po-red`,children:D})]}):null]})]}),O(`span`,{className:`text-sm text-po-dim`,children:[t.length,` of `,8,` groups`]}),s===void 0?null:b(`span`,{"data-testid":`session-groups-error`,className:`text-sm text-po-red`,children:s}),O(Q,{children:[b(K,{type:`button`,variant:`outline`,size:`md`,onClick:y,children:`cancel`}),b(K,{type:`submit`,variant:`primary`,size:`md`,disabled:c,children:`save`})]})]})}function Ft({session:e,sessions:t,actions:n,onClose:r}){let[i,a]=$(()=>[...e.groups??[]]),[o,s]=$(``),[c,l]=$(),[u,d]=$(),[f,p]=$(),[m,h]=$(),[g,v]=$(!1),y=async(e,t)=>{v(!0),h(void 0);let n=await e();v(!1),n===void 0?t():h(n.error)},x=()=>{d(void 0),p(void 0)};return b(V,{open:!0,onOpenChange:e=>!e&&!g&&r(),children:O(_,{width:`sm`,"data-testid":`session-groups-dialog-${e.id}`,"aria-describedby":void 0,children:[b(G,{children:b(W,{children:`session groups`})}),b(H,{children:b(Pt,{options:jt(t,e.id,i),value:i,query:o,active:c,renaming:u,deleting:f,error:m,busy:g,onQueryChange:s,onToggle:e=>{h(void 0),i.includes(e)?a(i.filter(t=>t!==e)):i.length>=8?h(Mt(``,i.length)):a([...i,e])},onCreate:()=>{let e=o.trim();e!==``&&Mt(e,i.length)===void 0&&(a([...i,e]),s(``))},onActive:l,onRenameStart:e=>{p(void 0),d({group:e,draft:e})},onRenameDraft:e=>d(t=>t===void 0?t:{...t,draft:e}),onRenameConfirm:()=>{if(u===void 0)return;let e=u.draft.trim();e===``||e===u.group?x():y(()=>n.renameGroup(u.group,e),()=>{a(t=>[...new Set(t.map(t=>t===u.group?e:t))]),x()})},onDeleteStart:e=>{d(void 0),p(e)},onDeleteConfirm:()=>{f!==void 0&&y(()=>n.deleteGroup(f),()=>{a(e=>e.filter(e=>e!==f)),x()})},onRowCancel:x,onCancel:r,onSave:()=>void y(()=>n.setSessionGroups(e.id,i),r)})})]})})}function It(e=[],t=[]){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Lt(e){return e.filter(e=>e.groups!==void 0&&e.groups.length>0)}function Rt(e,t){if(e.session!==t.session||e.actions!==t.actions||e.workspaceName!==t.workspaceName||e.coordinates!==t.coordinates||e.coordinatorEligible!==t.coordinatorEligible||e.coordinator!==t.coordinator||e.readOnly!==t.readOnly||e.stepsExpanded!==t.stepsExpanded||e.onToggleSteps!==t.onToggleSteps)return!1;let n=Lt(e.sessions),r=Lt(t.sessions);return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.id===n.id&&e.name===n.name&&It(e.groups,n.groups)})}function zt({session:e,className:t}){let n=e.waitingCount??+!!e.awaitingInput;return n<=0?null:O(m,{children:[b(ge,{ask:!0,"aria-hidden":!0,"data-testid":`session-awaiting-input`,className:t,children:n}),O(`span`,{className:`sr-only`,children:[`, `,n,` waiting for you`]})]})}var Bt=vt(function({session:t,sessions:n,actions:r,workspaceName:a,coordinates:o,coordinatorEligible:c=!1,coordinator:l,readOnly:u=!1,stepsExpanded:d,onToggleSteps:f}){let p=`rail/session/${t.id}`,[h,g]=q(`${p}/mode`,`view`),[v,y]=q(`${p}/draft`,``),[x,S]=q(`${p}/error`,``),[C,w]=q(`${p}/role-error`,``),[,D,k]=q(`${p}/removing`,!1),A=E(h),j=e=>{A.current=e,g(e)},{active:N}=t,F=x||C||t.error,I=async e=>{j(`view`),w(``);let n=await r.setSessionRole?.(t.id,e);n!==void 0&&w(n.error)},L=r.setSessionRole===void 0||!c||t.coordinatorEligible!==!0||o===void 0?null:t.coordinator?b(Z,{"data-testid":`session-make-regular-${t.id}`,disabled:t.restartBlocked===!0,onSelect:()=>void I(!1),children:`Make regular session`}):b(Z,{"data-testid":`session-make-coordinator-${t.id}`,disabled:t.restartBlocked===!0,onSelect:()=>l===void 0?void I(!0):j(`promote`),children:`Make coordinator`}),R=N?`rounded-lg border border-po-edge-green bg-po-tint-green px-3 py-3 hover:bg-po-tint-green`:`rounded-lg border border-transparent px-3 py-3 hover:bg-po-panel`,z=()=>{r.renameSession(t.id,v),j(`view`)},ee=async()=>{if(k.state)return;D(!0),j(`view`),S(``);let e=await r.removeSession(t.id);D(!1),e!==void 0&&S(e.error)},B=t.status.startsWith(`failed`)||t.status.includes(` failed`),ne=t.status.startsWith(`running`),re=O(`span`,{className:`flex min-w-0 items-start gap-1.5 text-sm leading-snug ${B?`text-po-red`:ne?`text-po-yellow`:N?`text-po-text`:`text-po-dim`}`,children:[ne?b(et,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0 animate-spin`}):B?b(rt,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}):null,t.clock?b(qe,{"data-testid":`session-status`,className:N?`line-clamp-2`:`truncate`,label:t.clock.label,since:t.clock.since}):b(`span`,{"data-testid":`session-status`,className:N?`line-clamp-2`:`truncate`,children:t.status})]}),ae=O(`span`,{className:`flex min-w-0 items-start gap-2`,children:[t.nested&&t.provenance===`workflow-session`?b(i,{"aria-label":`workflow session`,className:`mt-1 size-3 shrink-0 ${N?`text-po-green`:`text-po-faint`}`}):t.provenance===`workflow`?b(Me,{"aria-label":`workflow step`,className:`mt-1 size-3 shrink-0 ${N?`text-po-green`:`text-po-faint`}`}):t.nested&&t.provenance?b(je,{"aria-label":t.provenance===`worktree`?`automatic per-conversation worktree`:t.provenance,className:`mt-1 size-3 shrink-0 ${N?`text-po-green`:`text-po-faint`}`}):null,b(`span`,{className:`min-w-0 flex-1 text-base font-semibold break-words text-po-hi`,children:t.name||`Untitled`}),(t.waitingCount??+!!t.awaitingInput)>0?b(zt,{session:t,className:`mt-0.5 shrink-0 transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`}):t.ordinal>=1&&t.ordinal<=9?b(`span`,{title:`press ${String(t.ordinal)} to focus`,className:`grid size-5 shrink-0 place-items-center rounded-full bg-po-panel text-2xs text-po-dim transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`,children:t.ordinal}):null]}),se=O(m,{children:[ae,O(`span`,{className:`flex w-full min-w-0 items-end gap-2`,children:[O(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[re,t.coordinator?O(`span`,{"data-testid":`session-coordinator`,className:`text-sm text-po-dim`,children:[`Coordinates `,o??`workspace`]}):null,a?O(`span`,{"data-testid":`session-workspace`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[b(ze,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),b(`span`,{className:`truncate`,children:a})]}):null,t.git?O(`span`,{"data-testid":`session-branch`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[b(M,{className:`size-3.5 shrink-0 ${N?`text-po-green`:``}`}),b(`span`,{className:`truncate font-mono`,children:t.git.branch}),t.git.dirty?b(`span`,{className:`shrink-0 text-po-yellow`,children:`modified`}):null]}):null]}),t.profile?O(P,{"data-testid":`session-avatar`,"aria-label":t.profile.label,title:t.profile.label,className:`size-8 shrink-0 rounded-full`,children:[t.profile.avatarUrl?b(oe,{src:t.profile.avatarUrl,alt:``}):null,b(te,{className:`bg-po-tint-green text-xs font-semibold text-po-green`,children:t.profile.initials})]}):null]}),t.groups!==void 0&&t.groups.length>0?b(Nt,{groups:t.groups}):null,F?b(`span`,{"data-testid":`session-error`,className:`line-clamp-3 text-sm break-words text-po-red`,children:F}):null]}),U=h===`menu`;return O(m,{children:[O(`div`,{className:ye(`group relative`,t.provenance===`workflow`?`pl-10`:(t.nested||d!==void 0)&&`pl-5`),"data-testid":`session-card-${t.id}`,"data-active":N,"data-nested":t.nested,children:[d===void 0?null:b(`button`,{type:`button`,"data-testid":`session-steps-${t.id}`,"aria-expanded":d,"aria-label":`${d?`Hide`:`Show`} steps of ${t.name||`this workflow`}`,onClick:()=>f?.(t.id),className:`absolute top-3.5 left-0 grid size-5 place-items-center rounded-sm text-po-faint outline-none hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green/50`,children:b(d?s:ie,{"aria-hidden":!0,className:`size-3.5`})}),b(K,{variant:`ghost`,size:`card`,"data-testid":`session-open-${t.id}`,onClick:()=>r.openSession(t.id),className:R,children:se}),!u&&(h===`view`||U)?b(`div`,{className:`absolute top-2 right-2 transition-opacity ${U?`opacity-100`:`opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`}`,children:O(e,{open:U,onOpenChange:e=>{let t=A.current;j(e?`menu`:t===`menu`?`view`:t)},children:[b(J,{asChild:!0,children:b(K,{variant:`ghost`,size:`icon`,"data-testid":`session-menu-${t.id}`,title:`session actions`,className:N?`text-po-dim hover:bg-po-tint-green hover:text-po-hi data-[state=open]:bg-po-tint-green data-[state=open]:text-po-hi`:`text-po-faint hover:bg-po-deep hover:text-po-hi data-[state=open]:bg-po-deep data-[state=open]:text-po-hi`,children:b(Ue,{className:`h-3 w-3`})})}),O(Y,{"data-testid":`session-menu-list-${t.id}`,onCloseAutoFocus:e=>{A.current!==`view`&&e.preventDefault()},children:[r.renderSessionMenuItems(t.id),t.canInteract===!1?null:O(m,{children:[L,b(Z,{"data-testid":`session-rename-${t.id}`,onSelect:()=>{y(t.name),j(`rename`)},children:`Rename`}),b(Z,{"data-testid":`session-groups-${t.id}`,onSelect:()=>j(`groups`),children:`Groups`}),b(Z,{"data-testid":`session-resume-${t.id}`,onSelect:()=>r.resumeSession(t.id),children:`Resume`}),r.openMoveSession&&t.move?b(Z,{"data-testid":`session-move-${t.id}`,disabled:t.restarting||t.move.blocked,onSelect:()=>r.openMoveSession(t.id),children:`Move to workspace…`}):null,b(Z,{"data-testid":`session-restart-${t.id}`,disabled:t.restarting||t.restartBlocked===!0,onSelect:()=>r.restartSession(t.id),children:`Restart`}),b(Z,{variant:`destructive`,"data-testid":`session-stop-${t.id}`,onSelect:()=>j(`confirm`),children:`Remove`})]})]})]})}):null,b(V,{open:t.canInteract!==!1&&h===`rename`,onOpenChange:e=>!e&&j(`view`),children:O(_,{width:`sm`,"data-testid":`session-rename-dialog-${t.id}`,"aria-describedby":void 0,children:[b(G,{children:b(W,{children:`rename session`})}),b(H,{children:O(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),z()},children:[b(X,{"data-testid":`session-name-input-${t.id}`,"aria-label":`session name`,value:v,autoFocus:!0,onChange:e=>y(e.target.value)}),O(Q,{children:[b(K,{type:`button`,variant:`outline`,size:`md`,"data-testid":`session-rename-cancel-${t.id}`,onClick:()=>j(`view`),children:`cancel`}),b(K,{type:`submit`,variant:`primary`,size:`md`,"data-testid":`session-rename-confirm-${t.id}`,disabled:v.trim()===``,children:`rename`})]})]})})]})}),t.canInteract!==!1&&h===`groups`?b(Ft,{session:t,sessions:n,actions:r,onClose:()=>j(`view`)}):null,b(V,{open:t.canInteract!==!1&&h===`confirm`,onOpenChange:e=>!e&&j(`view`),children:O(_,{width:`sm`,"data-testid":`session-stop-dialog-${t.id}`,"aria-describedby":void 0,children:[b(G,{children:b(W,{children:`remove session`})}),O(H,{children:[O(T,{children:[`this stops `,b(`span`,{className:`font-semibold text-po-hi`,children:t.name||`untitled`}),` and removes it from the rail. anything it is running ends now. you can restore it for 7 days.`]}),O(Q,{children:[b(K,{variant:`outline`,size:`md`,"data-testid":`session-stop-cancel-${t.id}`,autoFocus:!0,onClick:()=>j(`view`),children:`cancel`}),b(K,{variant:`danger`,size:`md`,"data-testid":`session-stop-confirm-${t.id}`,onClick:()=>void ee(),children:`remove`})]})]})]})}),b(V,{open:t.canInteract!==!1&&h===`promote`,onOpenChange:e=>!e&&j(`view`),children:O(_,{width:`sm`,"data-testid":`session-promote-dialog-${t.id}`,"aria-describedby":void 0,children:[b(G,{children:O(W,{children:[`Make `,t.name||`Untitled`,` the coordinator of `,o,`?`]})}),O(H,{children:[O(T,{children:[b(`span`,{className:`font-semibold text-po-hi`,children:t.name||`Untitled`}),` will see every session in`,` `,o,`, message them, and start new ones.`,` `,b(`span`,{className:`font-semibold text-po-hi`,children:l}),` becomes a regular session. Both restart to take on their new roles, so anything they are running stops now.`]}),O(Q,{children:[b(K,{variant:`outline`,size:`md`,"data-testid":`session-promote-cancel-${t.id}`,autoFocus:!0,onClick:()=>j(`view`),children:`Cancel`}),b(K,{variant:`primary`,size:`md`,"data-testid":`session-promote-confirm-${t.id}`,onClick:()=>void I(!0),children:`Make coordinator`})]})]})]})})]}),t.pendingSetups.map(e=>b(At,{sessionId:t.id,setup:e,actions:r},`setup:${e.id}`))]})},Rt);function Vt({workspace:t,sessions:r,actions:i,quiet:o=!1,readOnly:s=!1}){let c=`rail/workspace/${t.id}`,[l,u]=q(`${c}/open`,!1),[d,f]=q(`${c}/error`,``),[p,h,g]=q(`${c}/removing`,!1),[v,y]=q(`${c}/coordinator-error`,``),[x,S]=q(Dt,[]),C=a(e=>S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[S]),{id:w,name:E,root:D,available:k,legacy:A}=t,j=t.sessions.find(e=>e.coordinator),M=ue(t.sessions,new Set(x)),N=e=>M.withSteps.has(e)?{stepsExpanded:x.includes(e),onToggleSteps:C}:{},P=async()=>{y(``);let e=await i.addCoordinator?.(w);e!==void 0&&y(e.error)};if(t.kind===`session`)return t.sessions.length===0?null:b(`div`,{"data-testid":`session-group-${w}`,className:`flex flex-col gap-1`,children:M.sessions.map(e=>b(Bt,{session:e,sessions:r,actions:i,readOnly:s,coordinates:`Home`,coordinatorEligible:e.coordinatorEligible===!0,coordinator:j?.id===e.id?void 0:j?.name,...N(e.id)},e.id))});let F=async()=>{if(g.state)return;h(!0),f(``);let e=await i.deleteWorkspace(w);h(!1),e===void 0?u(!1):f(e.error)};return O(`section`,{"data-testid":`workspace-group-${w}`,"data-available":k,className:`flex flex-col gap-1.5`,children:[O(`div`,{className:`flex min-w-0 items-start gap-2.5 rounded-md px-2 py-1 transition-colors hover:bg-po-panel/60`,children:[o?null:b(ze,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-dim`}),O(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[!A&&i.openWorkspace?b(`button`,{type:`button`,"data-testid":`workspace-open-${w}`,onClick:()=>i.openWorkspace?.(w),className:`truncate rounded-sm text-left text-base text-po-hi outline-none focus-visible:ring-2 focus-visible:ring-po-green/50 ${o?`font-medium`:`font-semibold`}`,title:o?D:`Open ${E} workspace`,children:E}):b(`p`,{className:`truncate text-base text-po-hi ${o?`font-medium`:`font-semibold`}`,title:o?D:void 0,children:E}),o?null:b(`p`,{className:`truncate font-mono text-sm text-po-dim`,title:D,children:D})]}),A||s?null:O(m,{children:[b(K,{variant:`ghost`,size:`icon`,"data-testid":`workspace-new-session-${w}`,title:`New session`,"aria-label":`New session in ${E}`,disabled:!k,onClick:()=>i.createSession(w),className:`text-po-faint hover:text-po-hi`,children:b(n,{className:`size-3.5`})}),O(e,{children:[b(J,{asChild:!0,children:b(K,{variant:`ghost`,size:`icon`,"data-testid":`workspace-menu-${w}`,title:`Workspace actions`,"aria-label":`${E} actions`,className:`text-po-faint hover:text-po-hi`,children:b(Ue,{className:`size-3.5`})})}),O(Y,{children:[b(Z,{disabled:!k,onSelect:()=>i.resumeInWorkspace(w),children:`Resume Session`}),i.addCoordinator?b(Z,{"data-testid":`workspace-add-coordinator-${w}`,disabled:!k,onSelect:()=>void P(),children:`Add bot`}):null,b(Z,{disabled:!k,onSelect:()=>i.openWorkspaceSettings(w),children:`Workspace Settings`}),b(Z,{variant:`destructive`,"data-testid":`workspace-delete-${w}`,onSelect:()=>{f(``),u(!0)},children:`Delete Workspace`})]})]})]})]}),k?null:b(`p`,{className:`px-9 text-sm text-po-red`,children:`Workspace unavailable`}),v?b(`p`,{"data-testid":`workspace-coordinator-error-${w}`,className:`px-9 text-sm text-po-red`,children:v}):null,t.sessions.length>0?b(`div`,{className:`flex flex-col gap-1`,children:M.sessions.map(e=>b(Bt,{session:e,sessions:r,actions:i,readOnly:s,coordinates:E,coordinatorEligible:e.coordinatorEligible===!0,coordinator:j?.id===e.id?void 0:j?.name,...N(e.id)},e.id))}):null,b(V,{open:l,onOpenChange:e=>!e&&!p&&u(!1),children:O(_,{width:`sm`,"data-testid":`workspace-delete-dialog-${w}`,"aria-describedby":void 0,children:[b(G,{children:b(W,{children:`delete workspace`})}),O(H,{children:[O(T,{children:[`this removes `,b(`span`,{className:`font-semibold text-po-hi`,children:E}),` and all its sessions from Po. running work will stop. files at `,b(`code`,{children:D}),` stay on disk.`]}),d?b(`p`,{"data-testid":`workspace-delete-error-${w}`,className:`text-sm text-po-red`,children:d}):null,O(Q,{children:[b(K,{variant:`outline`,size:`md`,"data-testid":`workspace-delete-cancel-${w}`,disabled:p,autoFocus:!0,onClick:()=>u(!1),children:`cancel`}),b(K,{variant:`danger`,size:`md`,"data-testid":`workspace-delete-confirm-${w}`,disabled:p,onClick:()=>void F(),children:p?`deleting…`:`delete`})]})]})]})})]})}var Ht=`po.session-view`,Ut=`self-host`,Wt=`po.other-workspaces-open`,Gt=[{value:`workspaces`,title:`Workspaces`,description:`Sessions grouped by workspace`,Icon:ze},{value:`sessions`,title:`Sessions`,description:`Needs you first, then latest change`,Icon:Te}];function Kt(e){try{return window.localStorage.getItem(e)}catch{return null}}function qt(e,t){try{window.localStorage.setItem(e,t)}catch{}}function Jt(){return typeof window<`u`&&window.poDesktop?.cloud!==void 0}function Yt(){return typeof window<`u`&&window.poDesktop?.platform===Ut}function Xt(){window.history.pushState(null,``,`/cloud`),window.dispatchEvent(new PopStateEvent(`popstate`))}var Zt=e=>e.kind!==`session`&&e.sessions.length===0;function Qt({rail:e,onClose:t,selfHost:n=Yt(),cloud:r=Jt()&&!n}){let{actions:i}=e;return O(`div`,{className:`flex min-h-full flex-col`,children:[O(`div`,{"data-po-session-rail-header":!0,className:`flex min-h-16 items-center justify-between gap-2 px-5 py-3`,children:[O(`span`,{className:`flex items-center gap-2.5`,"aria-label":`Po`,children:[b(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-9 rounded-lg`}),b(`span`,{"aria-hidden":`true`,className:`text-2xl font-semibold text-po-hi`,children:`Po`})]}),O(`span`,{className:`flex items-center gap-1`,children:[b(`div`,{"data-rail-status":`advanced-action`,className:`contents`,children:b(lt,{slot:F.railStatus,sessionId:null})}),b(K,{variant:`ghost`,size:`icon`,"data-testid":`mobile-sessions-close`,title:`Hide sessions`,"aria-label":`Hide sessions`,onClick:t,className:`text-po-dim md:hidden`,children:b(A,{className:`size-3.5`})})]})]}),b(`div`,{className:`px-3 pt-4`,children:O(K,{variant:`ghost`,size:`lg`,"data-testid":`home-open`,"aria-current":e.homeActive?`page`:void 0,onClick:i.openHome,className:e.homeActive?`w-full justify-start gap-2.5 border border-po-edge-green bg-po-tint-green px-2 text-po-hi`:`w-full justify-start gap-2.5 border border-transparent px-2 text-po-text`,children:[b(z,{"aria-hidden":`true`,className:e.homeActive?`size-5 text-po-green`:`size-5 text-po-dim`}),`Home`]})}),e.pluginContent,b($t,{rail:e}),b(`div`,{className:`flex-1`}),O(`div`,{className:`sticky bottom-0 mt-auto shrink-0 bg-po-rail`,children:[b(`div`,{"data-rail-status":`advanced-banner`,className:`contents`,children:b(lt,{slot:F.railStatus,sessionId:null})}),O(`div`,{className:`flex flex-col gap-1 border-t border-po-border-soft px-3 py-3`,children:[O(K,{variant:`ghost`,size:`lg`,"data-testid":`settings-open`,onClick:i.openSettings,className:`justify-start gap-2.5 px-2 text-po-text`,children:[b(Oe,{className:`size-5 text-po-dim`}),`Settings`]}),r?O(K,{variant:`ghost`,size:`lg`,"data-testid":`cloud-open`,onClick:Xt,className:`justify-start gap-2.5 px-2 text-po-text`,children:[b(fe,{className:`size-5 text-po-dim`}),`Po Cloud`]}):null,O(`span`,{className:`px-2 text-sm text-po-dim max-sm:hidden`,children:[b(at,{className:`bg-po-panel`,children:`ctrl+k`}),` commands · `,b(at,{className:`bg-po-panel`,children:`ctrl+t`}),` new session`]})]})]})]})}function $t({rail:t,createMenuDefaultOpen:r=!1}){let{actions:i}=t,o=t.coordinatorHosts??[],[c,l]=q(`rail/coordinator-error`,``),u=async e=>{l(``);let t=await i.addCoordinator?.(void 0,e);t!==void 0&&l(t.error)},d=t.workspaces.flatMap(e=>e.sessions),[f,p]=q(Dt,[]),h=a(e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[p]),g=ue(d,new Set(f)),_=new Set(g.sessions.map(e=>e.id)),v=t.workspaces.every(e=>e.kind===`session`&&e.sessions.length===0),x=t.workspaces.filter(Zt),S=E(null),[C,w]=q(`rail/initial-selection-revealed`,!1),[T,D]=q(`rail/session-view`,()=>Kt(Ht)===`sessions`?`sessions`:`workspaces`),[k,A]=q(`rail/other-workspaces-open`,()=>Kt(Wt)===`true`),j=Gt.find(e=>e.value===T)??Gt[0];return y(()=>{if(C)return;let e=S.current?.querySelector(`[data-active="true"]`);e&&(e.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`}),w(!0))},[t.workspaces,C,w]),O(m,{children:[O(`div`,{className:`flex items-center justify-between px-5 pt-4 pb-2`,children:[b(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Sessions`}),O(`span`,{className:`flex items-center gap-1`,children:[O(e,{children:[b(J,{asChild:!0,children:b(K,{variant:`ghost`,size:`icon`,"data-testid":`session-view-menu`,title:`View: ${j.title}`,"aria-label":`View: ${j.title}`,className:`text-po-dim hover:text-po-hi`,children:b(Le,{className:`size-3.5`})})}),b(Y,{align:`end`,"aria-label":`View`,children:Gt.map(({value:e,title:t,description:n,Icon:r})=>O(Z,{"data-testid":`session-view-${e}`,"aria-checked":T===e,role:`menuitemradio`,onSelect:()=>{D(e),qt(Ht,e)},className:`items-start gap-2.5 ${T===e?`bg-po-tint-green`:``}`,children:[b(r,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${T===e?`text-po-green`:`text-po-dim`}`}),O(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`span`,{className:`text-po-hi`,children:t}),b(`span`,{className:`text-sm text-po-dim`,children:n})]}),T===e?b(Be,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-green`}):null]},e))})]}),O(e,{defaultOpen:r,children:[b(J,{asChild:!0,children:b(K,{variant:`ghost`,size:`icon`,"data-testid":`session-create-menu`,title:`Create workspace, session or bot`,"aria-label":`Create workspace, session or bot`,className:`text-po-dim hover:text-po-hi`,children:b(n,{className:`size-3.5`})})}),O(Y,{children:[b(Z,{"data-testid":`add-workspace-open`,onSelect:i.openAddWorkspace,children:`Create workspace`}),i.createGeneralSession?b(Z,{"data-testid":`new-session-open`,onSelect:i.createGeneralSession,children:`Create session`}):null,i.addCoordinator?o.map(e=>b(Z,{"data-testid":e.hostId?`coordinator-create-${e.hostId}`:`coordinator-create`,onSelect:()=>void u(e.hostId),children:o.length>1?`Create bot on ${e.label}`:`Create bot`},e.hostId??`local`)):null]})]})]})]}),c?b(`p`,{"data-testid":`coordinator-create-error`,className:`px-5 text-sm text-po-red`,children:c}):null,O(`div`,{ref:S,className:`flex flex-col gap-4 px-3 pb-3`,children:[T===`sessions`?kt(t.workspaces.flatMap(e=>e.sessions.filter(e=>_.has(e.id)).map(t=>({session:t,workspaceName:e.kind===`session`?void 0:e.name,coordinates:e.kind===`session`?`Home`:e.name,coordinatorEligible:t.coordinatorEligible===!0,coordinator:e.sessions.find(e=>e.coordinator&&e.id!==t.id)?.name})))).map(e=>O(`section`,{"data-testid":`session-timeline-${e.key}`,className:`flex flex-col gap-1`,children:[b(`h3`,{className:`px-2 text-xs font-semibold tracking-wide text-po-dim uppercase`,children:e.title}),e.data.map(({session:e,workspaceName:t,coordinates:n,coordinatorEligible:r,coordinator:a})=>b(Bt,{session:e,sessions:d,actions:i,workspaceName:t,coordinates:n,coordinatorEligible:r,coordinator:a,...g.withSteps.has(e.id)?{stepsExpanded:f.includes(e.id),onToggleSteps:h}:{}},e.id))]},e.key)):t.workspaces.filter(e=>!Zt(e)).map(e=>b(Vt,{workspace:e,sessions:d,actions:i},e.id)),T===`workspaces`&&x.length>0?O(`section`,{"data-testid":`other-workspaces`,className:`flex flex-col gap-1`,children:[O(`button`,{type:`button`,"data-testid":`other-workspaces-toggle`,"aria-expanded":k,"aria-label":`Other workspaces, ${String(x.length)} without sessions`,onClick:()=>{A(!k),qt(Wt,String(!k))},className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors outline-none hover:bg-po-panel/60 focus-visible:ring-2 focus-visible:ring-po-green/50`,children:[b(k?s:ie,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}),b(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:`Other workspaces`}),b(`span`,{className:`min-w-5.5 rounded-full bg-po-panel px-1.5 text-center text-xs text-po-dim`,children:x.length})]}),k?b(`div`,{className:`flex flex-col gap-0.5 pl-4`,children:x.map(e=>b(Vt,{workspace:e,sessions:d,actions:i,quiet:!0},e.id))}):null]}):null,v||T===`sessions`&&d.length===0?b(`p`,{className:`px-2 text-sm text-po-dim`,children:`Start a session to work with Po. No workspace needed.`}):null]})]})}function en({view:e,slots:t,rail:n,navigationOpen:r,desktopActivityOpen:i,mobileActivityOpen:a,onNavigationOpenChange:o,onDesktopActivityOpenChange:s,onMobileActivityOpenChange:c}){let{scrollRef:l}=n,u=e===`conversation`||e===`welcome`,d=a?i?`fixed inset-y-0 right-0 z-40 flex lg:static lg:z-auto`:`fixed inset-y-0 right-0 z-40 flex lg:hidden`:i?`hidden lg:flex`:`hidden`;return O(`div`,{className:`relative flex h-full min-w-0 overflow-hidden [--po-backdrop-blur:0px]`,children:[b(`aside`,{ref:l,"data-testid":`session-rail-panel`,"data-po-region":`rail`,className:`fixed inset-y-0 left-0 z-40 flex w-[min(320px,calc(100vw-48px))] shrink-0 flex-col overflow-y-auto border-r border-po-border-soft bg-po-rail transition-transform md:visible md:static md:z-auto md:w-[320px] md:translate-x-0 ${r?`visible translate-x-0`:`invisible -translate-x-full`}`,children:b(Qt,{rail:n,onClose:()=>o(!1)})}),r?b(K,{variant:`ghost`,"data-testid":`mobile-drawer-backdrop`,"aria-label":`Hide sessions`,className:`fixed inset-0 z-30 h-auto w-auto rounded-none bg-black/55 p-0 hover:bg-black/55 md:hidden`,onClick:()=>o(!1)}):null,O(`main`,{"data-po-region":`content`,className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[t.notices,t.header({navigationToggle:`mobile`,activityToggle:`mobile`}),O(`div`,{"data-testid":`template-content`,className:u?`mx-auto flex min-h-0 w-full max-w-[960px] flex-1 flex-col overflow-hidden px-2 sm:px-4`:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[t.content,t.composer,t.controls]})]}),t.activity==null?null:i||a?b(`div`,{"data-po-region":`activity`,className:d,children:t.activity}):b(K,{variant:`ghost`,"data-testid":`activity-show`,title:`Show activity`,onClick:()=>s(!0),className:`hidden h-auto shrink-0 rounded-none border-l border-po-border-soft bg-po-rail px-2 py-3 font-semibold text-po-dim hover:bg-po-panel hover:text-po-hi lg:flex`,style:{writingMode:`vertical-rl`},children:`Activity`}),a?b(K,{variant:`ghost`,"data-testid":`mobile-activity-backdrop`,"aria-label":`Hide activity`,className:`fixed inset-0 z-30 h-auto w-auto rounded-none bg-black/55 p-0 hover:bg-black/55 lg:hidden`,onClick:()=>c(!1)}):null,n.addWorkspace?b(Tt,{suggestedPaths:n.addWorkspace.suggestedPaths,actions:n.actions}):null]})}function tn({onDismiss:e,...t}){return b(en,{...t,rail:v({onDismiss:e})})}function nn({homeHosts:e}){dt();let t=L(xe,e=>e.dockOpen),[n,i]=$(!1),[a,o]=$(!1),{kind:s,sessionId:c,tabId:l,pageId:u,pluginId:d,workspaceId:h}=ke(),g=ne(c??null),_=L(Pe,e=>e.activeId),v=L(Pe,e=>e.transferringToId===null?null:e.byId[e.transferringToId]?.summary.name??`destination session`),y=pt(),S=Ve(),w=S?.summary.dormant===!0?S:null,T=Xe(e=>e.dialog?.id??null),E=L(ct,e=>Ze(e,c,l)),k=E===void 0?void 0:R(c??null).map(e=>e.transientTab?.()).find(e=>e?.id===E.id)??E,A=(l===void 0?void 0:f(c??null).find(e=>e.id===l))??k,M=A===k?k?.composerContext:void 0,P=A!==void 0&&A===k&&k.retainComposer===!0&&k.composerAside===!0,I=_e(`(min-width: 1024px)`),z=L(xe,e=>C(e,_)),te=P&&A!==void 0?b(ve,{label:A.label,composer:b(D,{quiet:!0,composerContext:M})}):null,B=`${s}\u0000${c??``}\u0000${l??``}\u0000${u??``}\u0000${h??``}`,[ie,ae]=$(B);ie!==B&&(ae(B),i(!1),o(!1));let[V,oe]=$(T);V!==T&&(oe(T),T!==null&&(o(!1),i(!1)));let se=()=>{a?o(!1):me(!1)},H=u===void 0?s===`workspace`&&h!==void 0?b(r,{workspaceId:h,onShowSessions:()=>i(!0)}):s===`home`&&!y?b(be,{hosts:e,onShowSessions:()=>i(!0)}):null:O(de,{pageId:u,sessionId:null,workspaceId:h,onShowSessions:()=>i(!0),children:[u===x?b(mt,{workspaceId:h,pluginId:d}):null,u===ce?b(j,{}):null]});return O(`div`,{"data-testid":`cockpit`,className:`h-full min-w-0 overflow-hidden`,children:[b(tn,{view:H||A?`panel`:y?`welcome`:`conversation`,navigationOpen:n,desktopActivityOpen:t,mobileActivityOpen:a,onNavigationOpenChange:i,onDesktopActivityOpenChange:me,onMobileActivityOpenChange:o,onDismiss:()=>i(!1),slots:{header:e=>H?null:O(m,{children:[b(ee,{...e,view:A?.id??`conversation`,onShowSessions:()=>{o(!1),i(!0)},onShowActivity:()=>{i(!1),o(!0)}}),b(`div`,{className:`shrink-0 px-3 pt-2 empty:hidden sm:px-6`,children:b(lt,{slot:F.conversationStrip,sessionId:c??null})})]}),notices:v===null?null:O(`output`,{"data-testid":`voice-transfer-transition`,className:`border-b border-po-cyan/30 bg-po-cyan/10 px-4 py-2 text-center text-base font-medium text-po-cyan`,children:[`Transferring voice to `,v,`...`]}),content:H||(A?P?b(Ge,{narrow:!I,conversationShown:I&&t&&z===`conversation`,onOpenRail:()=>{me(!0),Je(_,`conversation`)},conversation:te,children:b(A.panel,{...g})},A.id):b(A.panel,{...g}):b(y?_t:p,{})),composer:H?null:A?A.retainComposer===!0&&!P?b(D,{composerContext:M}):null:y?null:b(D,{}),controls:!H&&(!A||A.targetSessionId!==void 0)&&!y&&w===null?b(re,{}):null,activity:H?null:b(st,{conversation:P&&I&&t?te:void 0,conversationBeside:P?k?.asideFace:void 0,conversationLabel:P?A?.label:void 0,scope:A===k&&k?.targetSessionId!==void 0?k.activityScope:void 0,onClose:se,onOpenContent:()=>o(!1)})}}),b(N,{})]})}function rn({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r=`unavailable`}={}){dt();let{section:i,workspaceId:a}=ke(),o=He(),s=L(Pe,e=>e.activeId),[c,l]=$(),[u,d]=$(!1),[f,p]=q(`settings/template-target`,`global`),m=r===`available`,h=tt(i,e,{canManageHosts:m}),g=h?.workspace??(i?.startsWith(`repository-`)?`repository`:`general`);return y(()=>{if(h||i===`hosts`&&r===`loading`||g===`repository`&&!u)return;let t=!1;return Ce().then(()=>{if(t||tt(i,e,{canManageHosts:m}))return;let n=U(i);o(n===void 0?{to:`/settings/$section`,params:{section:We},search:{workspace:a},replace:!0}:{to:`/plugins/$pluginId`,params:{pluginId:n},search:{workspace:a},hash:`settings`,replace:!0})}).catch(e=>{t||l(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[h,i,o,g,a,u,r,m,e]),O(`div`,{"data-testid":`settings`,"data-po-region":`content`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-po-bg [--po-backdrop-blur:0px]`,children:[O(`header`,{className:`grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-2 border-b border-po-border px-3 py-2 sm:h-14 sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] sm:px-6 sm:py-0`,children:[b(`h1`,{className:`order-1 min-w-0 truncate text-xl font-semibold text-po-hi sm:order-none`,children:`Settings`}),O(`nav`,{className:`order-3 col-span-2 flex w-full items-center gap-1 rounded-lg bg-po-panel p-1 sm:order-none sm:col-span-1 sm:w-auto`,"aria-label":`settings workspace`,children:[b(gt,{asChild:!0,active:g===`general`,className:`min-h-8 flex-1 justify-center rounded-md px-4 focus-visible:ring-2 focus-visible:ring-po-green sm:flex-none`,"aria-current":g===`general`?`true`:void 0,children:b(nt,{to:`/settings/$section`,params:{section:We},search:{workspace:a},"data-testid":`settings-workspace-general`,children:`General`})}),b(gt,{asChild:!0,active:g===`repository`,className:`min-h-8 flex-1 justify-center rounded-md px-4 focus-visible:ring-2 focus-visible:ring-po-green sm:flex-none`,"aria-current":g===`repository`?`true`:void 0,children:b(nt,{to:`/settings/$section`,params:{section:le},search:{workspace:a},"data-testid":`settings-workspace-repository`,children:`Workspaces`})})]}),b(K,{asChild:!0,variant:`outline`,size:`sm`,className:`order-2 gap-1.5 sm:order-none sm:justify-self-end`,children:s===null?O(nt,{to:`/`,"data-testid":`settings-close`,children:[b(Ne,{"aria-hidden":!0,className:`size-3.5`}),`Back`]}):O(nt,{to:`/session/$sessionId`,params:{sessionId:s},"data-testid":`settings-close`,children:[b(Ne,{"aria-hidden":!0,className:`size-3.5`}),b(`span`,{className:`sm:hidden`,children:`Back`}),b(`span`,{className:`hidden sm:inline`,children:`Back to session`})]})})]}),b(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:g===`repository`?b(ut,{current:h??{id:i??``,label:``,detail:``,workspace:`repository`},initialRepositoryId:a,onRepositoryChange:e=>{o({to:`/settings/$section`,params:{section:h?.id??i??le},search:{workspace:e},replace:!0})},onReady:d},a??`remembered-workspace`):O(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[b(Fe,{hosts:n,isSignedInWorkerOrigin:e,canManageHosts:m,active:h?.id,workspace:`general`,repositoryId:a}),b(`section`,{"data-testid":`settings-content`,className:`min-w-0 flex-1 overflow-y-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8 lg:py-10`,children:O(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[!h&&c?b(`p`,{role:`alert`,children:c}):null,i===`hosts`&&r===`loading`?b(`p`,{role:`status`,children:`Checking host access…`}):null,h?.id===`hosts`?b(we,{}):null,h?.id===`account-preferences`?t??b(`p`,{children:`Account settings are read-only on this host.`}):null,h?.id===`providers`?b(B,{}):null,h?.id===`devices`?b(ft,{}):null,h?.id===`appearance`?b(Ae,{templateTarget:f,onTemplateTargetChange:p}):null,h?.id===`notifications`?b(De,{}):null,h?.id===`images`?b(Ye,{}):null,h?.id===`presets`?b(he,{}):null,h?.id===`account`?b(Qe,{}):null,h?.contribution===void 0?null:b(pe,{section:h.contribution,scope:`host`}),h?.panel===void 0?null:b(k,{panel:h.panel})]})})]})})]})}var an={thread:(e,t,n)=>b(I,{sessionId:e,threadId:t,options:n}),activity:(e,t)=>b(d,{sessionId:e,onOpenConversation:t}),transcript:(e,n)=>b(t,{sessionId:e,options:n,watch:ae})};function on({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r}={}){let i=ke(),a=L(Pe,e=>e.activeId);return O(Re,{value:an,children:[i.kind===`settings`?b(rn,{homeHosts:n,isSignedInWorkerOrigin:e,hostManagement:r,accountSettings:t}):b(nn,{homeHosts:n}),b($e,{}),b(o,{}),b(l,{}),b(lt,{slot:F.overlay,sessionId:a})]})}function sn(){return O(`div`,{className:`flex size-full`,children:[O(`div`,{className:`flex w-1/4 flex-col gap-1 border-r border-po-border bg-po-rail p-1.5`,children:[b(`span`,{className:`h-1 w-1/2 rounded-full bg-po-dim`}),b(`span`,{className:`mt-1 h-3 w-full rounded-sm bg-po-tint-green`}),b(`span`,{className:`h-1 w-3/4 rounded-full bg-po-faint`}),b(`span`,{className:`h-1 w-2/3 rounded-full bg-po-faint`})]}),O(`div`,{className:`flex flex-1 flex-col justify-between p-2`,children:[O(`div`,{className:`flex flex-col gap-1`,children:[b(`span`,{className:`h-1 w-2/3 rounded-full bg-po-dim`}),b(`span`,{className:`h-1 w-1/2 rounded-full bg-po-faint`}),b(`span`,{className:`h-3 w-3/4 rounded-sm border border-po-border bg-po-panel`})]}),b(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})]}),O(`div`,{className:`flex w-1/4 flex-col gap-1 border-l border-po-border bg-po-rail p-1.5`,children:[b(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`}),b(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})]})]})}var cn={label:`Advanced`,description:`The full cockpit with persistent session navigation and an activity dock.`,contractVersion:3,app:on,preview:sn},ln=w(cn),un=w(cn),dn=w(cn),fn=(e,t)=>t===void 0?void 0:{...e,...t},pn=g({id:`template-advanced`,packageName:`@agimon-ai/po-template-advanced`,host:{get templates(){return[fn({id:`po-template-advanced`},ln)]}},workspace:{get templates(){return[fn({id:`po-template-advanced`},un)]}},session:{get templates(){return[fn({id:`po-template-advanced`},dn)]}}});export{pn as webPlugin};