@agimon-ai/po-cloudflare 0.0.2-alpha.21 → 0.0.2-alpha.23

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 (220) hide show
  1. package/dist/{agent-DZ-OKOHn.js → agent-UIPyeBP5.js} +1 -1
  2. package/dist/{apiContracts-b33nSAAI.js → apiContracts-C1eQw3aV.js} +14 -3
  3. package/dist/{approval-r3NnI1VC.js → approval-ClwOu7uT.js} +2 -2
  4. package/dist/{approvalPrompt-DWoXxu3S.js → approvalPrompt-DvHkKcy-.js} +2 -2
  5. package/dist/artifactFiles-BvCt577E.js +1 -0
  6. package/dist/assets/assets/{CodeEditorView-XeNS0L9M.js → CodeEditorView--WN6dPrx.js} +2 -2
  7. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-B6ZW0nkR.js → abnfDiagram-WEYOIA3C-gI5VY9d1.js} +2 -2
  8. package/dist/assets/assets/{architecture-WOLXFQ4H-bVR64sHO.js → architecture-WOLXFQ4H-rOlWdr7M.js} +1 -1
  9. package/dist/assets/assets/{architectureDiagram-ZHVYKT53-D7tZz3io.js → architectureDiagram-ZHVYKT53-LgdRA8o3.js} +2 -2
  10. package/dist/assets/assets/{blockDiagram-RJAE7QA3-DdwScfiX.js → blockDiagram-RJAE7QA3-Cnbl1Xjw.js} +2 -2
  11. package/dist/assets/assets/{c4Diagram-XDPPPE54-DgSxZJCV.js → c4Diagram-XDPPPE54-IZR9ycqL.js} +2 -2
  12. package/dist/assets/assets/channel-CrD4lVRl.js +2 -0
  13. package/dist/assets/assets/{chunk-2E7WHVMD-D5TXC2SM.js → chunk-2E7WHVMD-BWuCn-Ur.js} +2 -2
  14. package/dist/assets/assets/{chunk-4EMNKR2T-BWhOSvo1.js → chunk-4EMNKR2T-BKCM3XwF.js} +2 -2
  15. package/dist/assets/assets/{chunk-55XCU76K-HkkBzLtZ.js → chunk-55XCU76K-D-cpZWTC.js} +2 -2
  16. package/dist/assets/assets/{chunk-7S6XSTFO-CBnjycLU.js → chunk-7S6XSTFO-CuzMc4IC.js} +2 -2
  17. package/dist/assets/assets/{chunk-AQDTSKZB-75lIIq8T.js → chunk-AQDTSKZB-DbaQ40ow.js} +2 -2
  18. package/dist/assets/assets/{chunk-DSNLSHJZ-D8PpnXMk.js → chunk-DSNLSHJZ-BdxxGpAN.js} +2 -2
  19. package/dist/assets/assets/{chunk-HAGFOTED-CXRS2NIN.js → chunk-HAGFOTED-Zh_11Odb.js} +2 -2
  20. package/dist/assets/assets/{chunk-HNE4Q36P-BocUqS94.js → chunk-HNE4Q36P-DlZujxY1.js} +2 -2
  21. package/dist/assets/assets/{chunk-NQOKRVIF-CHf_ogYT.js → chunk-NQOKRVIF-CiGV2Oc0.js} +2 -2
  22. package/dist/assets/assets/{chunk-UHW7PFBP-DrW1PaIv.js → chunk-UHW7PFBP-DRG6Judb.js} +2 -2
  23. package/dist/assets/assets/{chunk-VQ5W62QI-CLoA7bFm.js → chunk-VQ5W62QI-DG2HdXG0.js} +2 -2
  24. package/dist/assets/assets/{chunk-WQQL4CDK-BmBsrj9I.js → chunk-WQQL4CDK-CPuleSF6.js} +2 -2
  25. package/dist/assets/assets/chunk-XXDRQBXY-BjrgiCuI.js +2 -0
  26. package/dist/assets/assets/{chunk-YZO67HFG-DShE_cgv.js → chunk-YZO67HFG-of316ftl.js} +2 -2
  27. package/dist/assets/assets/{chunk-ZAUX2LTX-B3oLvSXy.js → chunk-ZAUX2LTX-CPrtYqQo.js} +2 -2
  28. package/dist/assets/assets/{chunk-ZCHMQSOR-B14vKK7C.js → chunk-ZCHMQSOR-DeBdEbUA.js} +2 -2
  29. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Da8elIW2.js → classDiagram-v2-4MYWR3UA-BwVXVR6k.js} +2 -2
  30. package/dist/assets/assets/{cose-bilkent-JH36ORCC-Du4tGtiJ.js → cose-bilkent-JH36ORCC-CT6olnsr.js} +2 -2
  31. package/dist/assets/assets/{cynefin-EF2NZ3EQ-Cyj6i_WI.js → cynefin-EF2NZ3EQ-DuULfWya.js} +1 -1
  32. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-DFWXwO7A.js → cynefinDiagram-WF24UDRP-DUb0X7dq.js} +2 -2
  33. package/dist/assets/assets/{dagre-NK4GIZVX-C1wB_cf-.js → dagre-NK4GIZVX-B74VlwTw.js} +2 -2
  34. package/dist/assets/assets/{diagram-CBK3MWTC-MYCOBYl6.js → diagram-CBK3MWTC-DamT65hF.js} +2 -2
  35. package/dist/assets/assets/{diagram-I5XIIV2D-BFYbKUFf.js → diagram-I5XIIV2D-bB1cvJ50.js} +2 -2
  36. package/dist/assets/assets/{diagram-ODIL2UCW-6siqTpv_.js → diagram-ODIL2UCW-BRM0DVMM.js} +2 -2
  37. package/dist/assets/assets/{diagram-PFBEJUXE-CaBr9CoB.js → diagram-PFBEJUXE-BpX2wcGT.js} +2 -2
  38. package/dist/assets/assets/{diagram-RJA3I4VV-DAvmuDpc.js → diagram-RJA3I4VV-B-uUsxzB.js} +2 -2
  39. package/dist/assets/assets/{diagram-TYUNFSNR-CJnhgCpo.js → diagram-TYUNFSNR-B9exo1Dw.js} +2 -2
  40. package/dist/assets/assets/{dist-BQ4W1R18.js → dist-AmWXTl04.js} +2 -2
  41. package/dist/assets/assets/{dist-BnzFckPF.js → dist-BVj75dV9.js} +2 -2
  42. package/dist/assets/assets/{dist-qYlLXIa8.js → dist-Bez-acag.js} +2 -2
  43. package/dist/assets/assets/{dist-DNyn1p9Z.js → dist-C5qTd_01.js} +2 -2
  44. package/dist/assets/assets/{dist-CFtBpcYL.js → dist-C842uE1e.js} +2 -2
  45. package/dist/assets/assets/{dist-ChHYoe9_.js → dist-C87J3zaw.js} +2 -2
  46. package/dist/assets/assets/{dist-CIQX1z4W.js → dist-Ci0X1uP4.js} +2 -2
  47. package/dist/assets/assets/{dist-DKxZO8d9.js → dist-CzE956dI.js} +2 -2
  48. package/dist/assets/assets/{dist-DL6z28wl.js → dist-DzjRCuwU.js} +2 -2
  49. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-AUcqDTM3.js → ebnfDiagram-V4P3TTPT-D5jOT9Db.js} +2 -2
  50. package/dist/assets/assets/{elk-QONTBCTQ-aA10PEHJ.js → elk-QONTBCTQ-B_DwVG6P.js} +2 -2
  51. package/dist/assets/assets/{erDiagram-KYQIGQAA-hhYiqA-x.js → erDiagram-KYQIGQAA-CX_3h1Ot.js} +2 -2
  52. package/dist/assets/assets/{eventmodeling-K75KTNOO-BQZqbRo5.js → eventmodeling-K75KTNOO-DbiKG6BL.js} +1 -1
  53. package/dist/assets/assets/flowDiagram-IUGLLWBU-Cjl0PLdm.js +1 -0
  54. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CLON1GpW.js → ganttDiagram-R7GPNTJY-elZusB4K.js} +2 -2
  55. package/dist/assets/assets/{gitGraph-VSP46ZUC-DbmvNwR2.js → gitGraph-VSP46ZUC-B9Den7o-.js} +1 -1
  56. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-DJVO0WlL.js → gitGraphDiagram-PDYL7XHY-ROGyaCyn.js} +2 -2
  57. package/dist/assets/assets/index-di6cU4Gj.js +155 -0
  58. package/dist/assets/assets/{info-OHQRW6UA-CAt3Nt3g.js → info-OHQRW6UA-CpOqErak.js} +1 -1
  59. package/dist/assets/assets/{infoDiagram-MVDRKAX5-DTuqH-Zb.js → infoDiagram-MVDRKAX5-0Allx5ry.js} +2 -2
  60. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-BnWvdonT.js → ishikawaDiagram-HPEHV2GE-D9OuW5ON.js} +2 -2
  61. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-Btxtcgvl.js → journeyDiagram-BOSHW7O7-BTECHgM0.js} +2 -2
  62. package/dist/assets/assets/{kanban-definition-FNSA4HC5-q7ek9o_H.js → kanban-definition-FNSA4HC5-aQrr1OKW.js} +2 -2
  63. package/dist/assets/assets/{line-B7yLilmC.js → line-v9bOz1Ey.js} +2 -2
  64. package/dist/assets/assets/{linear-y8aSKEli.js → linear-Dq8OX6Zn.js} +2 -2
  65. package/dist/assets/assets/{mermaid-parser.core-B4rH50nD.js → mermaid-parser.core-D5CkBH4_.js} +4 -4
  66. package/dist/assets/assets/{mermaid.core-DnRVHTjE.js → mermaid.core-mHckPBfv.js} +5 -5
  67. package/dist/assets/assets/{mindmap-definition-6OY57UG3-DT9Afs2v.js → mindmap-definition-6OY57UG3-BCwuUCFw.js} +2 -2
  68. package/dist/assets/assets/{packet-JDAUHWVQ-CnqNbu4p.js → packet-JDAUHWVQ-EX4yzef7.js} +1 -1
  69. package/dist/assets/assets/{pegDiagram-ECIUJNBX-cvxdBBFq.js → pegDiagram-ECIUJNBX-4fWFIvd_.js} +2 -2
  70. package/dist/assets/assets/{pie-XZMESJXO-etXMNsaL.js → pie-XZMESJXO-CYvVJy_o.js} +1 -1
  71. package/dist/assets/assets/{pieDiagram-GNMPY74T-CBN-R3_j.js → pieDiagram-GNMPY74T-CBP6z66Q.js} +2 -2
  72. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-C5jjVPIH.js → quadrantDiagram-D57K4MC3-BSup4HmC.js} +2 -2
  73. package/dist/assets/assets/{radar-ABXABTNO-CAMd_mrV.js → radar-ABXABTNO-jVnoSObM.js} +1 -1
  74. package/dist/assets/assets/{railroad-I3PHUGI6-DIs3auoe.js → railroad-I3PHUGI6-mOKON3h5.js} +1 -1
  75. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-CJXr1qWy.js → railroad-abnf-LNEFI6M7-DD318mU6.js} +1 -1
  76. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-DfwtykqI.js → railroad-ebnf-DWYD2UWJ-BNtG2NvS.js} +1 -1
  77. package/dist/assets/assets/{railroad-peg-JR7BVNR7-B8beAhTs.js → railroad-peg-JR7BVNR7-CLCSnjiF.js} +1 -1
  78. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-BDcQE-EL.js → railroadDiagram-Y72NRBL7-Cc3oTcyZ.js} +2 -2
  79. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-KJ4-QjZM.js → requirementDiagram-EQYSW5RA-CqAB-seK.js} +2 -2
  80. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-VjIB-Ybr.js → sankeyDiagram-SY24JHO5-CKupkkvN.js} +2 -2
  81. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-MfMuWq1M.js → sequenceDiagram-BLEHNHQU-nFuDyVeJ.js} +2 -2
  82. package/dist/assets/assets/{src-BAxIj8GJ.js → src-DMdFFaDQ.js} +2 -2
  83. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-mHwLRRCY.js → stateDiagram-v2-A6IESKWZ-7-tKqPT6.js} +2 -2
  84. package/dist/assets/assets/{swimlanes-B3ENRKFQ-PArlYoqV.js → swimlanes-B3ENRKFQ-DHDGmhsR.js} +2 -2
  85. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-xMPKHKuu.js +9 -0
  86. package/dist/assets/assets/{timeline-definition-JXYKGLGB-B2nKiNFU.js → timeline-definition-JXYKGLGB-Djbb1TcP.js} +2 -2
  87. package/dist/assets/assets/{treeView-D4JQ5SDB-gU23_RuI.js → treeView-D4JQ5SDB-C4hXjFlO.js} +1 -1
  88. package/dist/assets/assets/{treemap-SAJKECNS-CiqoMvZa.js → treemap-SAJKECNS-CzvybDVC.js} +1 -1
  89. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-DpeoWpMK.js → usecaseDiagram-WPOLBNNX-BYqUavId.js} +2 -2
  90. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-C31iGKvM.js → vennDiagram-Q3Y3IDCW-BEp6yQ4L.js} +2 -2
  91. package/dist/assets/assets/{wardley-7MLQ67FV-CIzHhzNw.js → wardley-7MLQ67FV-qjxSE1QX.js} +1 -1
  92. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-DIIkoezc.js → wardleyDiagram-IVAIDKWA-kyLL21Iq.js} +2 -2
  93. package/dist/assets/assets/{webpack-RFseiMZW.js → webpack-CArfpWUA.js} +2 -2
  94. package/dist/assets/assets/{xychartDiagram-4URNHDU4-QiHL91kC.js → xychartDiagram-4URNHDU4-Du2PzsYQ.js} +2 -2
  95. package/dist/assets/bundle-asset-policy.json +1 -1
  96. package/dist/assets/index.html +1 -1
  97. package/dist/assets/plugins/assets/base-DuiJLOs_.css +2 -0
  98. package/dist/assets/plugins/chunks/po-web-runtime-EI_2k5Ip.js +1 -0
  99. package/dist/assets/plugins/compositions.json +1 -1
  100. package/dist/assets/plugins/slots/approval.3e4ea6e4-C0RmI2Pn.js +2 -0
  101. package/dist/assets/plugins/slots/artifacts.84980c32-B1aPICeE.js +1 -0
  102. package/dist/assets/plugins/slots/author.6acaa90f-Cipl-lB-.js +93 -0
  103. package/dist/assets/plugins/slots/{autocompact.dd97d013-IVq4Z6qm.js → autocompact.ec8f713f-d2vXqeFV.js} +1 -1
  104. package/dist/assets/plugins/slots/builtin-tools.16ef5e25-DhfnwpOa.js +7 -0
  105. package/dist/assets/plugins/slots/{codemode.8eaee717-VWt9PqsU.js → codemode.5f359b9c-CkCZsOKf.js} +4 -4
  106. package/dist/assets/plugins/slots/domain.832848c8-CJapYFeI.js +1 -0
  107. package/dist/assets/plugins/slots/edit.7c802139-4Rr7kXo0.js +7 -0
  108. package/dist/assets/plugins/slots/files.364f16c9-Bq_yVeTP.js +2 -0
  109. package/dist/assets/plugins/slots/goal.4c392100-B75Qo1Zd.js +1 -0
  110. package/dist/assets/plugins/slots/grep.d8bf9f57-DzeQomFK.js +1 -0
  111. package/dist/assets/plugins/slots/help.2ace5e43-usXaZfqP.js +3 -0
  112. package/dist/assets/plugins/slots/log.07fd59a4-D9njASDU.js +4 -0
  113. package/dist/assets/plugins/slots/mcp.ea8b6aa2-CXSgAVZB.js +109 -0
  114. package/dist/assets/plugins/slots/plan.b526667a-glf-Yrt8.js +3 -0
  115. package/dist/assets/plugins/slots/{profile.48851a1d-yX6tzV3x.js → profile.63bc3ae6-DDweHjSq.js} +1 -1
  116. package/dist/assets/plugins/slots/prompts.9d9b47cc-D28EtCWM.js +3 -0
  117. package/dist/assets/plugins/slots/read.926c024f-DMVigX9G.js +1 -0
  118. package/dist/assets/plugins/slots/runner.5393fa6c-ty8qh-Hn.js +8 -0
  119. package/dist/assets/plugins/slots/{skill.086701a4-CL6h_F-x.js → skill.56c1cc07-CptqANvN.js} +2 -2
  120. package/dist/assets/plugins/slots/subagents.dd77306a-DowwoyAz.js +7 -0
  121. package/dist/assets/plugins/slots/vault.587549ba-BlCwV79H.js +1 -0
  122. package/dist/assets/plugins/slots/voice.920972c8-BkULz7Nz.js +1 -0
  123. package/dist/{atomicJson-C_7F2zD1.js → atomicJson-BQhr0b4x.js} +2 -2
  124. package/dist/{backgroundWork-B1mPDYlf.js → backgroundWork-DZBsxltI.js} +1 -1
  125. package/dist/{codemode-DQFmrosw.js → codemode-ZkWnuAI8.js} +1 -1
  126. package/dist/{contracts-DD3f1Lpn.js → contracts-DPEebkOJ.js} +1 -1
  127. package/dist/{exports-D09VsUk-.js → exports-BDpoeBYv.js} +6 -6
  128. package/dist/{exports-nV43ShA7.js → exports-BMON3TcD.js} +9 -9
  129. package/dist/{exports-B0WMEXCP.js → exports-C9o38AKd.js} +2 -2
  130. package/dist/extensionFile-DIbg2lby.js +121 -0
  131. package/dist/{harnessState-Dwrk3lfv.js → harnessState-DFd42aw_.js} +3 -3
  132. package/dist/{harnessStore-Z7yDLO45.js → harnessStore-BG2zfn0y.js} +4 -4
  133. package/dist/{help-w6vVEZGL.js → help-BRf69VyB.js} +2 -2
  134. package/dist/{hubChannel-Cm-sxOvU.js → hubChannel-DckivLhM.js} +1 -1
  135. package/dist/{index.edge-Xa5LLtxz.js → index.edge-CkEELgJZ.js} +2 -2
  136. package/dist/{index.edge-DyYmurS7.js → index.edge-Dy1OxB6o.js} +1 -0
  137. package/dist/{index.edge-K0w5auwG.js → index.edge-Nnw3s5U5.js} +2 -2
  138. package/dist/{layeredConfig-CUkYUs1f.js → layeredConfig-C4fvE8Su.js} +3 -3
  139. package/dist/majorModes-CROQp_qf.js +1 -0
  140. package/dist/{majorModes-BB0PXgFn.js → majorModes-NI9R9cdG.js} +3 -3
  141. package/dist/{mcpProjection-BtKzB6oK.js → mcpProjection-BAFCLInc.js} +2 -2
  142. package/dist/{narration-CpRurWLO.js → narration-Iro44gEb.js} +2 -2
  143. package/dist/{notification-kckG3leF.js → notification-BmlTSXKU.js} +2 -2
  144. package/dist/{packageApi-t1oCjNDU.js → packageApi-Be2PgMFg.js} +1 -1
  145. package/dist/{piConfig-DQzlbPY4.js → piConfig-CTIrk5Sf.js} +4 -4
  146. package/dist/piSettings-F4H1df-n.js +1 -0
  147. package/dist/{platform-BIEiM4TG.js → platform-CIq8Kome.js} +1 -1
  148. package/dist/{pluginProtocol-BqXXyI4z.js → pluginProtocol-vfpJc92C.js} +2 -2
  149. package/dist/{protocol-DDL8geoS.js → protocol-CY4BiIpC.js} +2 -2
  150. package/dist/{server-KBgW77zh.js → server-B6_lwFVd.js} +3 -3
  151. package/dist/{server-DymH4Ucq.js → server-B6d00a08.js} +4 -4
  152. package/dist/{server-oxyEbv1a.js → server-B7f7QKc7.js} +8 -8
  153. package/dist/{server-AbXyhXlY.js → server-BFIwOGAA.js} +4 -4
  154. package/dist/{server-DsdPEYGu.js → server-BHZoezDN.js} +5 -5
  155. package/dist/{server-nkUlqnAL.js → server-BNumwxSM.js} +10 -10
  156. package/dist/{server-BJ7DNzCp.js → server-BR_dbEMf.js} +7 -7
  157. package/dist/{server-DH7PfLln.js → server-BVYZMr8z.js} +5 -5
  158. package/dist/{server-CuEPb7u-.js → server-BsCxTCv0.js} +2 -2
  159. package/dist/{server-BbSHYRnY.js → server-CBfCgKl2.js} +3 -3
  160. package/dist/{server-Co_UWKrR.js → server-CJtR2Sru.js} +5 -5
  161. package/dist/{server-CIHM4jqu.js → server-COl1e25y.js} +9 -9
  162. package/dist/{server-RW_9R3R3.js → server-CPgGcnWc.js} +6 -6
  163. package/dist/{server-IqECnUrb.js → server-CczrVvaO.js} +13 -13
  164. package/dist/{server-aUit8j6r.js → server-CuexObML.js} +7 -7
  165. package/dist/{server-DYdp0W9v.js → server-D7ltUBhP.js} +7 -7
  166. package/dist/{server-Busl0pQI.js → server-DEjEmSss.js} +8 -8
  167. package/dist/{server-B6dqQoh2.js → server-DFhOl3ch.js} +7 -7
  168. package/dist/{server-BT2ORK83.js → server-DILDgYKb.js} +9 -9
  169. package/dist/{server-CgWSSdvd.js → server-DJek9T1E.js} +6 -6
  170. package/dist/{server-ub3s16Mc.js → server-DPviMT6J.js} +4 -4
  171. package/dist/{server-DCyf2Asb.js → server-DfkiwDYb.js} +3 -3
  172. package/dist/{server-gifRriZK.js → server-DkeqHklt.js} +10 -10
  173. package/dist/{server-DJ8bc89M.js → server-DsUu0QU_.js} +3 -3
  174. package/dist/{server-BIHo9TFu.js → server-Dxa0NtKz.js} +4 -4
  175. package/dist/{server-BR7SZtj7.js → server-DzU8k3tY.js} +10 -10
  176. package/dist/{server-D40q2Jpx.js → server-_f8nacEA.js} +6 -6
  177. package/dist/{server-BqoKlEGk.js → server-nl7Kb6NK.js} +8 -8
  178. package/dist/{server-BO-j_GbD.js → server-pwBR7ut8.js} +12 -12
  179. package/dist/{server-BQzAiMns.js → server-uZBMAHRY.js} +11 -11
  180. package/dist/{serverPlugin-CELT6P0Q.js → serverPlugin-CFEhyxga.js} +319 -7
  181. package/dist/{sessionConfig-RQGvfm6E.js → sessionConfig-BznfkRmn.js} +9 -9
  182. package/dist/{type-ASYnCGVW.js → type-BxD21peU.js} +6 -6
  183. package/dist/{validation-BJxVSAwx.js → validation-DbxpyQ_I.js} +2 -2
  184. package/dist/{value-_W31So3B.js → value-CKjNDElQ.js} +1 -1
  185. package/dist/{vaultSettings-Di3n5YIg.js → vaultSettings-B0Fm3-rm.js} +1 -1
  186. package/dist/{voiceTools-RMn4HvWo.js → voiceTools-D_g-1t1o.js} +1 -1
  187. package/dist/web-Bb6qSzGG.js +3 -0
  188. package/dist/worker.js +534 -96
  189. package/dist/{workflow-B7qx0Vv9.js → workflow-CCXu-Egt.js} +1 -1
  190. package/package.json +38 -37
  191. package/dist/artifactFiles-DLCReI0-.js +0 -1
  192. package/dist/assets/assets/channel-TPcVvp_3.js +0 -2
  193. package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +0 -2
  194. package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +0 -1
  195. package/dist/assets/assets/index-BiTVAj5E.js +0 -155
  196. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +0 -9
  197. package/dist/assets/plugins/assets/base-CKKRZ7-h.css +0 -2
  198. package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +0 -1
  199. package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +0 -2
  200. package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +0 -1
  201. package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +0 -93
  202. package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +0 -7
  203. package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +0 -1
  204. package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +0 -7
  205. package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +0 -2
  206. package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +0 -1
  207. package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +0 -1
  208. package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +0 -3
  209. package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +0 -4
  210. package/dist/assets/plugins/slots/mcp.974af249-DPNHn9XH.js +0 -109
  211. package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +0 -3
  212. package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +0 -3
  213. package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +0 -1
  214. package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +0 -8
  215. package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +0 -1
  216. package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.js +0 -1
  217. package/dist/extensionFile-DNM4xsje.js +0 -433
  218. package/dist/majorModes-C7vtBs4D.js +0 -1
  219. package/dist/piSettings-Cf1QofNe.js +0 -1
  220. package/dist/web-DCP7ELJj.js +0 -3
@@ -0,0 +1,2 @@
1
+ import{$t as e,An as t,Dn as n,Dr as r,En as i,Fn as a,G as o,In as s,Lt as ee,On as c,Pn as l,S as u,Tn as d,Un as f,Vt as p,Yt as m,a as te,b as ne,c as re,fr as ie,h,i as ae,in as g,jn as _,jr as v,kn as y,ln as oe,lr as b,m as se,n as x,o as S,or as C,rn as ce,rr as le,rt as w,s as T,u as E,vn as D,wn as O,yr as k}from"../chunks/po-web-runtime-EI_2k5Ip.js";var ue=`file_edits`;function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function j(e){return A(e)&&typeof e.path==`string`&&typeof e.relPath==`string`&&typeof e.tool==`string`&&typeof e.at==`number`&&typeof e.count==`number`}function M(e){return!A(e)||!Array.isArray(e.items)?null:{items:e.items.filter(j)}}var N=k({items:[],detail:{},loading:[],errors:{},comments:[]}),P=N.channel({channel:ue,parse:M,reduce:(e,{items:t})=>({...e,items:t})});function de(e,t){N.update(e,e=>e.loading.includes(t)?e:{...e,loading:[...e.loading,t],errors:I(e.errors,t)})}function fe(e,t){N.update(e,e=>({...e,detail:{...e.detail,[t.path]:t},loading:e.loading.filter(e=>e!==t.path),errors:I(e.errors,t.path)}))}function F(e,t,n){N.update(e,e=>({...e,loading:e.loading.filter(e=>e!==t),errors:{...e.errors,[t]:n}}))}function pe(e,t){N.update(e,e=>({...e,comments:[...e.comments,t]}))}function me(e,t){N.update(e,e=>({...e,comments:e.comments.filter(e=>e.id!==t)}))}function he(e,t){N.update(e,e=>({...e,comments:e.comments.filter(e=>e.path!==t)}))}function I(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}var L=b(P),R=C({detail:{method:`GET`,path:`/detail`,query:[`path`],response:void 0},preview:{method:`GET`,path:`/preview`,query:[`path`],response:void 0},save:{method:`PUT`,path:`/content`,response:void 0},remove:{method:`DELETE`,path:`/content`,query:[`path`]},file:{method:`GET`,path:`/file`,raw:!0,query:[`path`],host:!0}},{scopes:[`session`],basePath:`file-edits`,transport:(e,t)=>x.fetch(e,t),sessionAddress:v}),z=`path`,B=`The session is unreachable.`;function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H(e,t){return R.session(e).file.url({query:{[z]:t}})}function U(e){return e.status===0?B:e.error===``?`The session answered ${e.status}.`:e.error}async function ge(e,t){let n=await R.session(e).detail({query:{[z]:t}});return n.ok?V(n.data)?{ok:!0,detail:n.data}:{ok:!1,error:`The session answered with no detail.`}:{ok:!1,error:U(n)}}async function W(e,t){let n=await R.session(e).preview({query:{[z]:t}});return n.ok?V(n.data)?{ok:!0,preview:n.data}:{ok:!1,error:`The session answered with no file.`}:{ok:!1,error:U(n)}}async function _e(e,t,n,r){let i=await R.session(e).save({body:{path:t,expectedHash:n,content:r}});if(i.status===409){let e=i.ok?void 0:i.data,t=V(e)&&typeof e.hash==`string`?e.hash:void 0;return{ok:!1,stale:!0,error:i.ok?`The file changed since it was opened.`:U(i),...t===void 0?{}:{hash:t}}}return i.ok?{ok:!0,hash:V(i.data)&&typeof i.data.hash==`string`?i.data.hash:``}:{ok:!1,stale:!1,error:U(i)}}async function ve(e,t){let n=await R.session(e).remove({query:{[z]:t}});return n.ok?{ok:!0}:{ok:!1,error:U(n)}}function G(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function K(e){let t=e.replaceAll(/[^a-zA-Z0-9]+/gu,`-`).replace(/^-|-$/gu,``);return`files-file-${G(e)}-${t.slice(-40)}`}var q={edit:`edit`,write:`write`,bash:`command`,user:`you`};function ye(t,n){if(g(t)!==`download`)return`media`;if(n)return`unavailable`;let r=t.toLowerCase();return r.endsWith(`.md`)||r.endsWith(`.markdown`)?`markdown`:r.endsWith(`.html`)||r.endsWith(`.htm`)?`html`:e(t)===void 0?`text`:`code`}function be(e,t){try{e({type:`follow_up`,message:m(t)});return}catch(e){return e instanceof Error?e.message:String(e)}}function xe({relPath:e,open:r,onConfirm:a,onCancel:o}){return S(O,{open:r,onOpenChange:e=>{e||o()},children:T(i,{width:`sm`,"data-testid":`files-delete-dialog`,"aria-describedby":void 0,children:[S(y,{children:S(t,{children:`delete file`})}),T(d,{children:[T(n,{children:[`this removes `,S(`span`,{className:`font-semibold text-po-hi`,children:e}),` from disk. the session keeps its record of the change, but the file itself is gone.`]}),T(c,{children:[S(p,{variant:`outline`,size:`md`,"data-testid":`files-delete-cancel`,autoFocus:!0,onClick:o,children:`cancel`}),S(p,{variant:`danger`,size:`md`,"data-testid":`files-delete-confirm`,onClick:a,children:`delete`})]})]})]})})}function Se({src:e,path:t,"data-testid":n}){let[r,i]=h();E(()=>{if(e===``)return;let t=new AbortController,n;return(async()=>{let r=await x.fetch(e,{signal:t.signal,cache:`no-store`});if(!r.ok)throw Error(`Media could not be loaded (${r.status}).`);let a=await r.blob();t.signal.aborted||(n=URL.createObjectURL(a),i({source:e,url:n,contentType:(r.headers.get(`content-type`)??a.type).split(`;`,1)[0]?.trim().toLowerCase()??``}))})().catch(n=>{t.signal.aborted||i({source:e,error:n instanceof Error?n.message:String(n)})}),()=>{t.abort(),n!==void 0&&URL.revokeObjectURL(n)}},[e]);let a=r?.source===e?r:void 0;return a?.url===void 0?S(`p`,{role:a?.error?`alert`:`status`,children:a?.error??`Loading media...`}):S(u,{src:a.url,path:t,contentType:a.contentType,"data-testid":n})}async function Ce(e,t,n){if(e===null)throw Error(`The session is unavailable.`);let r=t.slice(0,t.lastIndexOf(`/`)+1),i=n.startsWith(`/`)?n:`${r}${n}`,a=await x.fetch(H(e,i),{cache:`no-store`});if(!a.ok)throw Error(`Image could not be loaded (${a.status}).`);let o=URL.createObjectURL(await a.blob());return{url:o,dispose:()=>URL.revokeObjectURL(o),path:i}}function we(e){let t=new Date(e.at).toLocaleTimeString(),n=e.hunks===void 0?``:` +${e.additions} -${e.removals}`;return`${t} · ${q[e.tool]??e.tool}${n}`}function Te(e){let{filePath:t,relPath:n,sessionId:r,sendSessionFrame:i,closeTransientTab:c}=e,u=ae(N.store,e=>N.select(e,r)),d=u.detail[t],m=u.errors[t],ie=u.loading.includes(t),g=u.comments.filter(e=>e.path===t),[v,y]=h(`preview`),[b,x]=h(void 0),[C,O]=h(void 0),[k,ue]=h(void 0),[A,j]=h(!1),[M,P]=h(void 0),[I,L]=h(!1),[R,z]=h(void 0),B=se(void 0),V=u.items.find(e=>e.path===t)?.count??0;E(()=>{if(r===null)return;let e=!1;return de(r,t),ge(r,t).then(n=>{e||(n.ok?(fe(r,n.detail),O(void 0),P(void 0)):F(r,t,n.error))}),()=>{e=!0}},[r,t,V]);let U=d?.working,W=n===`..`||n.startsWith(`../`)||n.startsWith(`/`),G=C??U?.content??``,q=ye(n,U?.unavailable===!0),Te=re(e=>Ce(r,n,e),[r,n]),J=r===null?``:H(r,n),Y=e=>{x(e)},X=()=>{let e=B.current;e!==void 0&&e.text.trim()!==``&&Y({snippet:e.text,startLine:e.startLine,endLine:e.endLine})},Z=e=>{r!==null&&b!==void 0&&(pe(r,{id:`${t}:${b.side??`new`}:${b.startLine??0}:${g.length}:${e.length}`,path:t,relPath:n,...b.side===void 0?{}:{side:b.side},...b.startLine===void 0?{}:{startLine:b.startLine},...b.endLine===void 0?{}:{endLine:b.endLine},snippet:b.snippet,body:e}),x(void 0))},Ee=()=>{if(r===null||g.length===0)return;let e=be(e=>i(r,e),g);z(e),e===void 0&&he(r,t)},Q=async()=>{if(r===null)return;L(!1);let e=await ve(r,t);e.ok?c(K(t)):F(r,t,e.error)},$=async()=>{if(r===null||U===void 0||C===void 0)return;j(!0);let e=await _e(r,t,U.hash,C);if(j(!1),e.ok){P(`saved`),O(void 0),de(r,t);let e=await ge(r,t);e.ok?fe(r,e.detail):F(r,t,e.error)}else P(e.error)};return T(`div`,{"data-testid":`files-file-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[T(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2`,children:[S(ee,{path:n,"data-testid":`files-breadcrumb`,className:`min-w-0 flex-1`}),v===`edit`?S(w,{tone:`neutral`,"data-testid":`files-editing`,className:`shrink-0 `,children:`editing`}):null,d===void 0?null:T(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[`+`,d.cumulative.additions,` -`,d.cumulative.removals]}),S(`nav`,{className:`flex shrink-0 items-center gap-1`,children:[`preview`,`diff`].map(e=>S(p,{variant:v===e?`outline`:`ghost`,size:`xs`,"data-testid":`files-view-${e}`,onClick:()=>y(e),className:``,children:e},e))}),T(l,{children:[S(f,{asChild:!0,children:S(p,{variant:`ghost`,size:`icon`,"data-testid":`files-menu`,title:`file actions`,className:`shrink-0 text-po-faint hover:text-po-hi`,children:S(le,{className:`h-3 w-3`})})}),T(a,{"data-testid":`files-menu-list`,children:[S(s,{"data-testid":`files-edit`,disabled:W||U?.unavailable===!0,onSelect:()=>y(`edit`),children:`edit`}),S(s,{variant:`destructive`,"data-testid":`files-delete`,disabled:W||U?.unavailable===!0,onSelect:()=>L(!0),children:`delete`}),S(s,{"data-testid":`files-close`,onSelect:()=>c(K(t)),children:`close`})]})]})]}),S(xe,{relPath:n,open:I,onConfirm:()=>void Q(),onCancel:()=>L(!1)}),ie&&d===void 0?S(`p`,{"data-testid":`files-loading`,className:`px-4 py-3 text-sm text-po-dim`,children:`reading this file's history…`}):null,m===void 0?null:S(`p`,{"data-testid":`files-error`,className:`px-4 py-3 text-sm text-po-red`,children:m}),S(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:d===void 0?null:v===`diff`?T(`div`,{className:`flex flex-col`,children:[d.cumulative.note===void 0?null:S(`p`,{"data-testid":`files-cumulative-note`,className:`px-4 py-2 text-sm text-po-yellow`,children:d.cumulative.note}),d.cumulative.hunks===void 0?null:S(_,{hunks:d.cumulative.hunks,testId:`files-cumulative-diff`,onSelect:e=>Y(e)}),T(`section`,{className:`mt-2 border-t border-po-border`,children:[T(`h2`,{className:`px-4 py-2 text-lg font-semibold text-po-hi `,children:[d.versions.length,` `,d.versions.length===1?`change`:`changes`,` this session`]}),d.versions.map(e=>T(`article`,{"data-testid":`files-version-${e.index}`,children:[S(p,{variant:`ghost`,size:`card`,"data-testid":`files-version-toggle-${e.index}`,onClick:()=>ue(k===e.index?void 0:e.index),className:`w-full gap-2 rounded-none px-4 py-1.5 hover:bg-po-panel`,children:T(`span`,{className:`flex w-full min-w-0 items-center gap-2`,children:[T(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[`#`,e.index]}),S(`span`,{className:`min-w-0 flex-1 truncate text-left text-base text-po-text`,children:we(e)}),e.origin===`scan`?S(w,{tone:`neutral`,className:`shrink-0 `,children:`no baseline`}):null,S(`span`,{className:`shrink-0 text-sm text-po-dim`,children:k===e.index?`▾`:`▸`})]})}),k===e.index?e.hunks===void 0?S(`p`,{className:`px-4 py-1.5 text-sm text-po-dim`,children:e.note??`nothing to show`}):S(_,{hunks:e.hunks,testId:`files-version-diff-${e.index}`,onSelect:e=>Y(e)}):null]},e.index))]})]}):v===`edit`?S(`div`,{className:`flex h-full flex-col gap-2 p-3`,children:U?.unavailable===!0?S(`p`,{"data-testid":`files-source-unavailable`,className:`text-sm text-po-dim`,children:U.reason??`this file cannot be shown`}):T(te,{children:[S(`div`,{className:`min-h-[24rem] flex-1`,onMouseUp:X,onKeyUp:e=>{e.shiftKey&&X()},children:S(D,{"data-testid":`files-source`,value:G,path:n,onChange:O,onSelect:e=>{B.current=e},className:`h-full rounded border border-po-border`})}),T(`div`,{className:`flex shrink-0 items-center gap-2`,children:[S(p,{variant:`outline`,size:`xs`,"data-testid":`files-save`,loading:A,disabled:C===void 0||A,onClick:()=>void $(),className:``,children:`save to disk`}),C===void 0?null:S(p,{variant:`ghost`,size:`xs`,"data-testid":`files-revert`,onClick:()=>O(void 0),className:``,children:`discard edits`}),M===void 0?null:S(`span`,{"data-testid":`files-save-note`,className:M===`saved`?`text-sm text-po-green`:`text-sm text-po-red`,children:M})]})]})}):T(`div`,{"data-testid":`files-preview`,"data-mode":q,className:q===`code`?`flex h-full flex-col gap-2 p-4 text-base text-po-text`:`flex flex-col gap-2 p-4 text-base text-po-text`,onMouseUp:()=>{if(q===`code`){X();return}let e=globalThis.getSelection?.()?.toString()??``;e.trim()!==``&&Y({snippet:e})},children:[q===`unavailable`?S(`p`,{"data-testid":`files-preview-unavailable`,className:`text-sm text-po-dim`,children:U?.reason??`this file cannot be shown`}):null,q===`media`||q===`unavailable`?S(Se,{src:J,path:n,"data-testid":`files-preview-media`}):q===`markdown`?S(ne,{text:G,loadImage:Te,documentPath:n,renderMediaReview:ce(e)}):q===`html`?S(`iframe`,{"data-testid":`files-preview-html`,title:n,sandbox:``,srcDoc:G,className:`h-[36rem] w-full rounded border border-po-border bg-po-deep`}):q===`code`?S(D,{"data-testid":`files-preview-code`,value:G,path:n,readOnly:!0,onSelect:e=>{B.current=e},className:`min-h-[24rem] flex-1 rounded border border-po-border`}):S(`pre`,{"data-testid":`files-preview-text`,className:`whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text`,children:G})]})}),b===void 0?null:S(o,{testIdPrefix:`files-comment`,snippet:b.snippet,...b.side===void 0?{}:{side:b.side},...b.startLine===void 0?{}:{startLine:b.startLine},...b.endLine===void 0?{}:{endLine:b.endLine},onSubmit:Z,onCancel:()=>x(void 0)}),g.length===0?null:T(`footer`,{"data-testid":`files-review`,className:`shrink-0 border-t border-po-border px-3 py-2`,children:[T(`div`,{className:`flex items-center gap-2 pb-1`,children:[T(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:[g.length,` `,g.length===1?`comment`:`comments`]}),S(p,{variant:`outline`,size:`xs`,"data-testid":`files-send-review`,onClick:Ee,className:``,children:`send review`})]}),R===void 0?null:T(`p`,{role:`alert`,"data-testid":`files-review-error`,className:`pb-1 text-sm text-po-red`,children:[`review not sent: `,R]}),g.map(e=>T(`div`,{"data-testid":`files-review-comment`,className:`flex items-start gap-2 py-0.5`,children:[S(`span`,{className:`shrink-0 text-sm text-po-dim`,children:oe(e)}),S(`span`,{className:`min-w-0 flex-1 truncate text-base text-po-text`,children:e.body}),S(p,{variant:`ghost`,size:`xs`,"data-testid":`files-review-remove`,onClick:()=>{r!==null&&me(r,e.id)},className:`shrink-0 `,children:`remove`})]},e.id))]})]})}function J(e,t){return{id:K(e),label:t.split(`/`).at(-1)??t,panel:n=>S(Te,{...n,filePath:e,relPath:t})}}function Y(e){let{filePath:t,sessionId:n,closeTransientTab:r}=e,[i,a]=h(void 0);E(()=>{if(n===null)return;let e=!1;return W(n,t).then(r=>{e||a(r.ok?{sessionId:n,path:t,preview:r.preview}:{sessionId:n,path:t,error:r.error})}),()=>{e=!0}},[n,t]);let o=i?.path===t&&i.sessionId===n?i:void 0,s=o?.preview,c=o?.error,l=s?.relPath??t,u=s?.working,d=u?.content??``,f=ye(l,u?.unavailable===!0),m=re(e=>Ce(n,l,e),[n,l]),te=n===null?``:H(n,l);return T(`div`,{"data-testid":`files-preview-panel`,className:`flex min-h-0 flex-1 flex-col`,children:[T(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-po-border px-4 py-2`,children:[S(ee,{path:l,"data-testid":`files-preview-breadcrumb`,className:`min-w-0 flex-1`}),S(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`unchanged`}),S(p,{variant:`ghost`,size:`xs`,"data-testid":`files-preview-close`,onClick:()=>r(X(t)),className:`shrink-0 `,children:`close`})]}),c===void 0?null:S(`p`,{"data-testid":`files-preview-error`,className:`px-4 py-3 text-sm text-po-red`,children:c}),s===void 0&&c===void 0?S(`p`,{"data-testid":`files-preview-loading`,className:`px-4 py-3 text-sm text-po-dim`,children:`reading this file…`}):null,s===void 0?null:S(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:T(`div`,{"data-testid":`files-preview`,"data-mode":f,className:`flex h-full flex-col gap-2 p-4 text-base text-po-text`,children:[f===`unavailable`?S(`p`,{"data-testid":`files-preview-unavailable`,className:`text-sm text-po-dim`,children:u?.reason??`this file cannot be shown`}):null,f===`media`||f===`unavailable`?S(Se,{src:te,path:l,"data-testid":`files-preview-media`}):f===`markdown`?S(ne,{text:d,loadImage:m,documentPath:l,renderMediaReview:ce(e)}):f===`html`?S(`iframe`,{"data-testid":`files-preview-html`,title:l,sandbox:``,srcDoc:d,className:`h-[36rem] w-full rounded border border-po-border bg-po-deep`}):f===`code`?S(D,{"data-testid":`files-preview-code`,value:d,path:l,readOnly:!0,className:`min-h-[24rem] flex-1 rounded border border-po-border`}):S(`pre`,{"data-testid":`files-preview-text`,className:`whitespace-pre-wrap break-words font-mono text-sm leading-normal text-po-text`,children:d})]})})]})}function X(e){return`${K(e)}-preview`}function Z(e){return{id:X(e),label:e.split(`/`).at(-1)??e,panel:t=>S(Y,{...t,filePath:e})}}var Ee=/:\d+(?::\d+)?$/;function Q(e){return N.select(N.store.state,e).items}function $(e,t){let n=t.trim().replace(Ee,``);if(n!==``)return Q(e).find(e=>e.relPath===n||e.path===n)}var De=ie({subscribe(e){let t=N.store.subscribe(e);return()=>t.unsubscribe()},fingerprint:e=>Q(e).map(e=>e.relPath).join(`
2
+ `),resolve:(e,t)=>{let n=$(e,t);return n===void 0?void 0:J(n.path,n.relPath)},openPath:(e,t)=>{let n=$(e,t);if(n!==void 0)return J(n.path,n.relPath);let r=t.trim();return r===``||r.startsWith(`artifact:`)?void 0:Z(r)}}),Oe=(e,t)=>t===void 0?void 0:{...e,...t},ke=r({id:`files`,session:{get channels(){return[Oe({channel:`file_edits`},L)]},get fileLinks(){return De}}});export{ke as webPlugin};
@@ -0,0 +1 @@
1
+ import{An as e,Bt as t,C as n,Dn as r,Dr as i,En as a,Fn as o,In as s,O as c,On as l,Pn as u,T as d,Tn as f,Un as p,Vt as m,a as h,fn as g,gr as _,h as v,hr as y,ir as b,kn as x,o as S,pr as C,rr as ee,s as w,sr as te,tr as T,w as E,wn as D,wr as ne}from"../chunks/po-web-runtime-EI_2k5Ip.js";var O=`po-goal-current`,re=` · `,ie=/\[[0-9;]*m/gu;function ae(e){if(e===void 0)return;let t=e.replace(ie,``).trim(),n=t.indexOf(re);if(n===-1)return;let r=t.slice(n+3).trim();return r===``?void 0:{state:t.slice(0,n).trim(),objective:r}}var k=te({keys:`g e`,statusKey:O,marksBackgroundWork:!1,hideWhenEmpty:!0,order:35}),A=`/goal clear`,j=/\s+/gu,M=/^\d+(?:\.\d+)?[km]?$/iu;function N(e){let t=e.trim().replaceAll(j,` `);return t===``||t.length>4e3?void 0:t}function P(e){let t=e.indexOf(`/`);return t===-1?``:e.slice(t+1).trim()}function F(e,t){let n=N(e);if(n===void 0)return;let r=t.trim();return r===``?`/goal edit ${n}`:M.test(r)?`/goal edit --tokens ${r} ${n}`:void 0}function I({objective:n,budgetHint:i,open:o,onSubmit:s,onCancel:c}){let[u,d]=v(n),[p,h]=v(``),g=F(u,p),_=()=>{d(n),h(``),c()};return S(D,{open:o,onOpenChange:e=>{e||_()},children:w(a,{width:`sm`,"data-testid":`goal-edit-dialog`,"aria-describedby":void 0,children:[S(x,{children:S(e,{children:`edit goal`})}),w(f,{children:[S(r,{children:`this replaces the objective the agent is working to. it takes effect on the next turn.`}),w(`div`,{className:`flex flex-col gap-1`,children:[S(b,{htmlFor:`goal-edit-objective`,children:`objective`}),S(t,{id:`goal-edit-objective`,"data-testid":`goal-edit-objective`,value:u,rows:3,spellCheck:!1,onChange:e=>d(e.target.value)})]}),w(`div`,{className:`flex flex-col gap-1`,children:[S(b,{htmlFor:`goal-edit-budget`,children:`token budget`}),S(T,{id:`goal-edit-budget`,"data-testid":`goal-edit-budget`,value:p,placeholder:i===``?`none; leave blank to keep it that way`:`${i}; blank keeps it`,onChange:e=>h(e.target.value)})]}),S(`p`,{"data-testid":`goal-edit-preview`,className:`truncate font-mono text-sm text-po-dim`,children:g??`nothing to send`}),w(l,{children:[S(m,{variant:`outline`,size:`md`,"data-testid":`goal-edit-cancel`,onClick:_,children:`cancel`}),S(m,{variant:`primary`,size:`md`,"data-testid":`goal-edit-save`,disabled:g===void 0,onClick:()=>{g!==void 0&&(s(g),h(``))},children:`save`})]})]})]})})}function L({objective:t,open:n,onConfirm:i,onCancel:o}){return S(D,{open:n,onOpenChange:e=>{e||o()},children:w(a,{width:`sm`,"data-testid":`goal-remove-dialog`,"aria-describedby":void 0,children:[S(x,{children:S(e,{children:`remove goal`})}),w(f,{children:[w(r,{children:[`this ends `,S(`span`,{className:`font-semibold text-po-hi`,children:t}),` and stops the current turn. it is archived to this repository's goal history, where it can be restarted.`]}),w(l,{children:[S(m,{variant:`outline`,size:`md`,"data-testid":`goal-remove-cancel`,autoFocus:!0,onClick:o,children:`cancel`}),S(m,{variant:`danger`,size:`md`,"data-testid":`goal-remove-confirm`,onClick:i,children:`remove`})]})]})]})})}function R({sessionId:e,statuses:t,sendSessionFrame:n}){let[r,i]=v(`view`),a=ae(t[O]);if(a===void 0)return S(`p`,{"data-testid":`activity-goal-unavailable`,className:`px-1 text-sm text-po-dim`,children:`goal status unavailable`});let c=t=>{e!==null&&n(e,{type:`prompt`,message:t})};return w(`div`,{"data-testid":`activity-goal-row`,className:`flex flex-col gap-0.5`,children:[w(`div`,{className:`flex min-w-0 items-start gap-1.5 px-1`,children:[w(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[S(`span`,{"data-testid":`activity-goal-objective`,className:`text-base font-semibold text-po-hi`,children:a.objective}),S(`span`,{"data-testid":`activity-goal-state`,className:`text-sm tabular-nums text-po-dim`,children:a.state})]}),w(u,{open:r===`menu`,onOpenChange:e=>i(t=>e?`menu`:t===`menu`?`view`:t),children:[S(p,{asChild:!0,children:S(m,{variant:`ghost`,size:`icon`,"data-testid":`activity-goal-menu`,title:`goal actions`,disabled:e===null,className:`shrink-0 text-po-faint hover:bg-po-deep hover:text-po-hi data-[state=open]:bg-po-deep data-[state=open]:text-po-hi`,children:S(ee,{className:`h-3 w-3`})})}),w(o,{"data-testid":`activity-goal-menu-list`,children:[S(s,{"data-testid":`activity-goal-edit`,onSelect:()=>i(`edit`),children:`edit`}),S(s,{variant:`destructive`,"data-testid":`activity-goal-remove`,onSelect:()=>i(`confirm`),children:`remove`})]})]})]}),r===`edit`?S(I,{open:!0,objective:a.objective,budgetHint:P(a.state),onSubmit:e=>{c(e),i(`view`)},onCancel:()=>i(`view`)}):null,S(L,{objective:a.objective,open:r===`confirm`,onConfirm:()=>{c(A),i(`view`)},onCancel:()=>i(`view`)})]})}var z=C({component:R}),B=C({slot:`help.guides`,id:`Goal`,order:30,data:{version:1,label:`Goal`,guides:[{id:`about`,question:`What is a goal?`,order:0,answer:`A goal keeps one objective active across agent turns. An independent check reviews the transcript and verification evidence when the session is idle.`},{id:`budget`,question:`How do I set a goal or token budget?`,order:1,answer:`Send /goal followed by your objective. For a budget, use /goal --tokens 100k followed by the objective. Budgets also accept values such as 1.5m.`,keywords:[`limit`,`tokens`]}]}}),V=y({path:[{key:`g`,label:`goal`,detail:`session objective`},{key:`g`,label:`current`,detail:`the goal being worked`}],command:`goal status`}),H=y({path:[{key:`g`,label:`goal`,detail:`session objective`},{key:`e`,label:`toggle`,detail:`start a session goal or end the current one`}],command:`minor goal`}),U=_({keys:`g e`,statusKey:`goal`,order:40}),W=[`goal_complete`,`goal_blocked`],G=72;function K(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function q(e){let t=``;for(let n of e){let e=n.codePointAt(0)??0;t+=e<=31||e===127?` `:n}return t.replace(/\s+/gu,` `).trim()}function J(e,t){let n=e[t];return typeof n==`string`&&q(n)||void 0}function Y(e){if(e)return e.length>G?`${e.slice(0,69)}…`:e}function X(e,t,n={}){return{text:e,tone:t,...n}}function oe(e){return e?q(e.content.flatMap(e=>{let t=K(e);return t?.type===`text`&&typeof t.text==`string`?[t.text]:[]}).join(` `)):``}function se(e,t){if(e===`goal_complete`){let e=Y(J(t,`summary`));return{action:`complete`,...e?{detail:e}:{},metadata:[]}}let n=Y(J(t,`reason`)),r=t.repeated_turns,i=typeof r==`number`&&Number.isFinite(r)?[`${r} ${r===1?`turn`:`turns`}`]:[];return{action:`blocked`,...n?{detail:n}:{},metadata:i}}function Z(e,t,n,r){if(r.isPartial)return[X(`◐ recording the goal outcome`,`warning`)];let i=oe(n),a=r.isError||K(n?.details)?.error===!0?[X(`✗ ${i||`${e} refused`}`,`error`)]:[X(`✓ ${i||(e===`goal_complete`?`goal complete`:`goal blocked`)}`,`success`)];if(!r.expanded)return a;let o=e===`goal_complete`?[[`goal_id`,`goal`],[`summary`,`summary`]]:[[`goal_id`,`goal`],[`reason`,`reason`],[`evidence`,`evidence`]];for(let[e,n]of o){let r=J(t,e);r&&a.push(X(`${n} ${r}`,`text`))}return a}function ce({toolName:e,args:t,result:r,running:i,isError:a}){let o=se(e,t),s=Z(e,t,r,{expanded:!1,isError:a,isPartial:i}),l=Z(e,t,r,{expanded:!0,isError:a,isPartial:i});return S(n,{tone:g({running:i,isError:a}),expandable:l.length>s.length,children:({expanded:t})=>w(h,{children:[S(d,{title:e,children:w(`span`,{"data-testid":`tool-call-${e}`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[S(`span`,{className:`font-semibold text-po-hi`,children:o.action}),o.detail?S(`span`,{className:`min-w-0 truncate text-po-dim`,children:o.detail}):null,o.metadata.map(e=>w(`span`,{className:`shrink-0 text-po-dim`,children:[`· `,e]},e))]})}),(t?l:s).length>0?S(E,{"data-testid":`tool-result-${e}`,children:S(c,{lines:t?l:s})}):null]})})}var le=ne({tools:[...W],message:ce}),Q=(e,t)=>t===void 0?void 0:{...e,...t},$=i({id:`goal`,session:{get activityGroups(){return[Q({name:`goal`},k)]},get fills(){return[Q({slot:`activity.goal`,id:`goal`},z),Q({slot:`help.guides`,id:`goal`},B)]},get leaderBindings(){return[Q({id:`goal.show`},V),Q({id:`goal.toggle`},H)]},get minorModes(){return[Q({name:`goal`},U)]},get toolRenderers(){return[Q({tools:[`goal`]},le)]}}});export{$ as webPlugin};
@@ -0,0 +1 @@
1
+ import{C as e,Dr as t,E as n,T as r,Zn as i,a,cn as o,fn as s,o as c,s as l,tn as u,w as d,wr as f}from"../chunks/po-web-runtime-EI_2k5Ip.js";function p(e){let t=typeof e.limit==`number`&&Number.isFinite(e.limit)?e.limit:void 0;return{pattern:typeof e.pattern==`string`?e.pattern:``,details:[typeof e.path==`string`&&e.path.length>0?e.path:`.`,typeof e.glob==`string`?e.glob:void 0,e.ignoreCase===!0?`ignore case`:void 0,t===void 0?void 0:`${t} matches`].filter(e=>e!==void 0&&e.length>0)}}function m({args:t,result:f,output:m,running:h,isError:g}){let _=p(t),v=f===null||g?null:u(f,m,`grep`,!0);return c(e,{tone:s({running:h,isError:g}),expandable:!0,defaultExpanded:!1,children:({expanded:e})=>l(a,{children:[c(r,{title:`grep`,children:l(`span`,{"data-testid":`tool-call-grep`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[c(`span`,{className:`truncate text-po-text`,children:_.pattern}),_.details.length>0?l(`span`,{className:`shrink-0 text-po-faint`,children:[`· `,_.details.join(` · `)]}):null]})}),e?g?l(d,{"data-testid":`tool-result-grep`,className:`flex flex-col`,children:[c(n,{tone:`error`,children:`failed`}),o(f,m).map((e,t)=>c(`span`,{className:`whitespace-pre-wrap break-words text-po-red`,children:e},`${String(t)}-${e}`))]}):v===null?h?c(d,{"data-testid":`tool-result-grep`,children:c(n,{tone:`running`,children:`running`})}):null:v.shown.length===0&&v.notice===void 0?null:l(d,{"data-testid":`tool-result-grep`,className:`flex flex-col gap-1`,children:[c(i,{lines:v.shown,gutter:v.gutter}),v.notice===void 0?null:c(`span`,{className:`text-po-faint`,children:v.notice})]}):null]})})}var h=f({message:m}),g=(e,t)=>t===void 0?void 0:{...e,...t},_=t({id:`grep`,session:{get toolRenderers(){return[g({tools:[`grep`]},h)]}}});export{_ as webPlugin};
@@ -0,0 +1,3 @@
1
+ import{$n as e,C as t,Cr as n,Dr as r,E as i,Gn as a,J as o,O as s,Sn as c,T as l,Vt as u,Zt as d,_ as f,a as p,bt as m,dr as h,fn as g,gr as _,h as v,hr as y,jr as b,kr as ee,m as x,n as S,nn as C,o as w,or as T,p as E,pn as D,pr as O,rt as k,s as A,tr as te,u as j,w as M,wr as N}from"../chunks/po-web-runtime-EI_2k5Ip.js";var P=T({simulation:{method:`GET`,path:`/simulation`,response:void 0},setSimulation:{method:`PUT`,path:`/simulation`,response:void 0},services:{method:`GET`,path:`/services`,response:void 0},slots:{method:`GET`,path:`/slots`,response:void 0}},{scopes:[`global`,`workspace`,`session`],basePath:`brain`,transport:(e,t)=>S.fetch(e,t),sessionAddress:b}),F=`po/codemode`,I=new Set([`po/server-scope`,`po/server-host`,`po/headless-host`,`po/global-services`]);function L(e,t){let n=new Set([...t.values()].flatMap(e=>[e.source,e.target]));return{nodes:[...e.values()].filter(e=>n.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),links:[...t.values()].sort((e,t)=>`${e.source}\0${e.target}`.localeCompare(`${t.source}\0${t.target}`))}}function R(e){let t=new Map(e.consumers.flatMap(e=>e.owner.kind===`package`&&e.owner.packageName?[[e.id,{name:e.owner.packageName,origin:e.owner.origin}]]:[])),n=new Map(e.services.map(e=>[e.id,e])),r=e.edges.flatMap(e=>{let r=t.get(e.consumer),i=e.service===null?void 0:n.get(e.service);return r&&i&&!I.has(i.name)?[{plugin:r,service:i}]:[]}),i=new Set(r.filter(e=>e.service.name===F).map(e=>e.plugin.name)),a=new Set(r.filter(e=>i.has(e.plugin.name)).map(e=>e.service.name)),o=new Map,s=new Map;for(let{plugin:e,service:t}of r){if(!t.public&&!a.has(t.name))continue;let n=`service:${t.name}`,r=o.get(n);(!r||t.description&&r.detail.endsWith(`No description.`))&&o.set(n,{id:n,label:t.name,role:a.has(t.name)?`codemode`:`public`,detail:`${t.public?`Public`:`Private`} service${a.has(t.name)?`, callable from code mode`:``}. Provided by ${t.owner.packageName??t.owner.kind}. ${t.description??`No description.`}`});let c=`plugin:${e.name}`;o.set(c,{id:c,label:e.name,role:e.origin===`personal`?`personal`:`plugin`,detail:`Plugin${i.has(e.name)?` that contributes to code mode`:``}.`}),s.set(`${c}\0${n}`,{source:c,target:n,label:`consumes`})}return L(o,s)}function z(e,t,n={}){let r=new Map(Object.values(n).map(e=>[e.slot,e.description])),i=new Map,a=new Map,o=(e,t)=>{let n=`slot:${e}`;return(!i.has(n)||t)&&i.set(n,{id:n,label:e,role:`slot`,detail:`Slot. ${t??r.get(e)??`No description.`}`}),n};for(let n of e){let e=t===`web`?n.web:n.native;if(!e||!n.owner.packageName)continue;let r=`plugin:${n.owner.packageName}`;i.set(r,{id:r,label:n.owner.packageName,role:n.owner.origin===`personal`?`personal`:`plugin`,detail:`Plugin with a ${t} half.`});for(let t of e.slots){let e=o(t.name,t.description);a.set(`${r}\0${e}`,{source:r,target:e,label:`declares`})}for(let t of e.fills){if(t.slot===null)continue;let e=o(t.slot);a.set(`${r}\0${e}`,{source:r,target:e,label:`fills`})}}return L(i,a)}function ne(e,t,n){return t===`backend`?R(e):z(t===`web`?e.clientPackages??e.packages:e.packages,t,n)}function re(e,t){let n=new Set([e]);for(let r of t)r.source===e&&n.add(r.target),r.target===e&&n.add(r.source);return n}function ie(e){return e.map((e,t)=>{let n=12*Math.sqrt(t+.5),r=t*2.399963229728653;return{id:e,x:Math.cos(r)*n,y:Math.sin(r)*n,vx:0,vy:0}})}function B(e,t,n){if(e.length>400)throw Error(`Brain simulation node limit exceeded.`);let r=Math.max(0,Math.min(n,32))/(1e3/60),i=e.map(e=>({...e,vx:e.vx*.8**r,vy:e.vy*.8**r})),a=new Map(e.map((e,t)=>[e.id,t]));for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let a=e[t].x-e[n].x||(e[t].y===e[n].y?.5:0),o=e[t].y-e[n].y,s=Math.max(1,Math.hypot(a,o)),c=Math.min(4,1400/s**2)*r;i[t].vx+=a/s*c,i[t].vy+=o/s*c,i[n].vx-=a/s*c,i[n].vy-=o/s*c}for(let n of t){let t=a.get(n.source),o=a.get(n.target);if(t===void 0||o===void 0||t===o)continue;let s=e[o].x-e[t].x,c=e[o].y-e[t].y,l=Math.max(1,Math.hypot(s,c)),u=(l-70)*.01*r;i[t].vx+=s/l*u,i[t].vy+=c/l*u,i[o].vx-=s/l*u,i[o].vy-=c/l*u}for(let e of i)e.vx=Math.max(-8,Math.min(8,e.vx-e.x*.004*r)),e.vy=Math.max(-8,Math.min(8,e.vy-e.y*.004*r)),e.x+=e.vx*r,e.y+=e.vy*r;return i}function ae(e,t,n=300){let r=[...e];for(let e=0;e<n;e++)r=B(r,t,1e3/60);return r}var oe=[{id:`backend`,label:`Backend`},{id:`web`,label:`Web`},{id:`native`,label:`Native`}],V={public:`var(--po-green)`,codemode:`var(--po-blue)`,plugin:`var(--po-text)`,personal:`var(--po-magenta)`,slot:`var(--po-cyan)`},se={public:`Public service`,codemode:`Code-mode service`,plugin:`Plugin`,personal:`Your plugin`,slot:`Slot`},ce={backend:`No public or code-mode services are consumed in this scope yet.`,web:`No web slots or fills are published in this scope yet.`,native:`No native slot metadata yet. Packages publish it on their next build.`},le=12,H=420;function ue(e){if(e.length===0)return{x:-100,y:-100,w:200,h:200};let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.max(H,Math.max(...t)-Math.min(...t)+80),i=Math.max(H,Math.max(...n)-Math.min(...n)+80);return{x:(Math.max(...t)+Math.min(...t)-r)/2,y:(Math.max(...n)+Math.min(...n)-i)/2,w:r,h:i}}function U({services:e,state:t=`populated`,initialSelection:n,initialGraph:r=`backend`,simulation:i}){let[a,o]=v(r),[s,c]=v(n),[l,d]=v(),f=E(()=>{let t=ne(e,a,ee),n=new Map;for(let e of t.links)for(let t of[e.source,e.target])n.set(t,(n.get(t)??0)+1);let r=new Set([...t.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).slice(0,le).map(e=>e.id)),i=t.nodes.length>400,o=ie(t.nodes.map(e=>e.id)),s=i?o:ae(o,t.links);return{...t,degree:n,hubs:r,tooLarge:i,seed:o,settled:s,home:ue(s)}},[a,e]),[p,m]=v(),[h,g]=v(!1),_=i?.enabled===!0;j(()=>{if(!_||t!==`populated`||f.tooLarge){m(void 0);return}let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=f.seed,r=0,i=!1,a=()=>{i||(n=B(n,f.links,1e3/60),m({model:f,points:n}),n.some(e=>Math.abs(e.vx)+Math.abs(e.vy)>.02)&&(r=requestAnimationFrame(a)))},o=()=>{cancelAnimationFrame(r),g(e.matches),e.matches?m(void 0):(n=f.seed,r=requestAnimationFrame(a))};return e.addEventListener(`change`,o),o(),()=>{i=!0,cancelAnimationFrame(r),e.removeEventListener(`change`,o)}},[f,_,t]);let y=_&&p?.model===f?p.points:f.settled,b=new Map(y.map(e=>[e.id,e])),[S,C]=v(),T=S?.model===f?S.box:f.home,D=x(null),O=x(void 0),k=(e,t=T.x+T.w/2,n=T.y+T.h/2)=>{let r=Math.min(f.home.w*4,Math.max(f.home.w/12,T.w*e)),i=r/T.w;C({model:f,box:{x:t-(t-T.x)*i,y:n-(n-T.y)*i,w:r,h:T.h*i}})},te=(e,t)=>{let n=D.current?.getScreenCTM()?.inverse();if(!D.current||!n)return{x:T.x+T.w/2,y:T.y+T.h/2};let r=new DOMPoint(e,t).matrixTransform(n);return{x:r.x,y:r.y}},M=t===`populated`&&f.nodes.length>0,N=x(()=>{});N.current=e=>{e.preventDefault();let t=te(e.clientX,e.clientY);k(Math.exp(e.deltaY*.0015),t.x,t.y)},j(()=>{let e=D.current;if(!e)return;let t=e=>N.current(e);return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[M]);let P=()=>{O.current=void 0},F=e=>{e.currentTarget.setPointerCapture(e.pointerId),O.current={x:e.clientX,y:e.clientY,box:T}},I=e=>{let t=O.current,n=D.current?.getBoundingClientRect();if(!t||!n?.width)return;let r=Math.max(t.box.w/n.width,t.box.h/n.height);C({model:f,box:{...t.box,x:t.box.x-(e.clientX-t.x)*r,y:t.box.y-(e.clientY-t.y)*r}})},L=f.nodes.some(e=>e.id===s)?s:void 0,R=l??L,z=R?re(R,f.links):void 0,H=f.home.w/T.w,U=T.w*.017,W=new Map(f.nodes.map(e=>[e.id,e])),G=L?W.get(L):void 0,K=G?f.links.filter(e=>e.source===G.id||e.target===G.id).map(e=>({link:e,other:W.get(e.source===G.id?e.target:e.source)})).sort((e,t)=>e.other.label.localeCompare(t.other.label)):[];return A(`section`,{className:`break-words bg-po-bg p-4 font-sans text-base text-po-text`,children:[A(`header`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[A(`div`,{children:[w(`h1`,{className:`text-2xl font-semibold text-po-hi`,children:`Brain`}),w(`p`,{className:`text-sm text-po-dim`,children:`What this scope can reach, and which plugins lean on it.`})]}),A(`div`,{className:`flex flex-wrap gap-2`,children:[w(`div`,{className:`flex gap-1 rounded-lg border border-po-border p-1`,role:`group`,"aria-label":`Graph`,children:oe.map(e=>w(u,{size:`xs`,variant:a===e.id?`subtle`:`ghost`,"aria-pressed":a===e.id,onClick:()=>o(e.id),children:e.label},e.id))}),i&&A(u,{size:`xs`,variant:`outline`,"aria-label":`Physics simulation`,"aria-pressed":_,"aria-disabled":i.pending||void 0,"aria-busy":i.pending,className:`aria-disabled:pointer-events-none aria-disabled:opacity-40`,disabled:t!==`populated`||!_&&f.tooLarge,onClick:()=>{i.pending||i.onChange(!_)},children:[`Motion `,_?`on`:`off`]})]})]}),i?.error&&w(`p`,{role:`alert`,className:`mb-3 text-sm text-po-red`,children:i.error}),i&&(f.tooLarge||_&&h)&&w(`p`,{role:`status`,className:`mb-3 text-sm text-po-dim`,children:f.tooLarge?`Layout is paused above 400 nodes.`:`Motion is paused for your reduced-motion preference.`}),t!==`populated`||f.nodes.length===0?w(`p`,{role:t===`error`?`alert`:`status`,className:`py-12 text-po-text`,children:t===`loading`?`Reading the Brain snapshot…`:t===`error`?`The Brain snapshot could not be read. Your session is unchanged.`:ce[a]}):A(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[A(`div`,{className:`relative overflow-hidden rounded-lg border border-po-border bg-po-panel`,children:[A(`svg`,{ref:D,viewBox:`${T.x} ${T.y} ${T.w} ${T.h}`,className:`block h-[min(70vh,640px)] w-full cursor-grab touch-none select-none active:cursor-grabbing`,"aria-hidden":`true`,onPointerDown:F,onPointerMove:I,onPointerUp:P,onPointerCancel:P,children:[f.links.map(e=>{let t=b.get(e.source),n=b.get(e.target);if(!t||!n)return null;let r=R!==void 0&&(e.source===R||e.target===R);return w(`line`,{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:r?V[W.get(R).role]:`var(--po-dim)`,strokeDasharray:e.label===`declares`?`4 3`:void 0,strokeOpacity:r?.9:R?.06:.22,strokeWidth:r?1.5:1,vectorEffect:`non-scaling-stroke`},`${e.source}\0${e.target}`)}),f.nodes.map(e=>{let t=b.get(e.id),n=3+Math.sqrt(f.degree.get(e.id)??0)*1.6,r=z?.has(e.id)??!0,i=e.id===R||(z?.has(e.id)??!1)||f.hubs.has(e.id)||H>=2;return A(`g`,{className:`cursor-pointer`,opacity:r?1:.15,onPointerDown:e=>e.stopPropagation(),onPointerEnter:()=>d(e.id),onPointerLeave:()=>d(void 0),onClick:()=>c(e.id),children:[e.id===L&&w(`circle`,{cx:t.x,cy:t.y,r:n+4,fill:`none`,stroke:V[e.role],strokeOpacity:`0.5`,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),w(`circle`,{cx:t.x,cy:t.y,r:n,fill:V[e.role]}),i&&w(`text`,{x:t.x,y:t.y+n+U*1.1,textAnchor:`middle`,fontSize:U,className:`fill-po-text`,paintOrder:`stroke`,stroke:`var(--po-panel)`,strokeWidth:U*.25,children:e.label})]},e.id)})]}),A(`div`,{className:`absolute right-2 bottom-2 flex gap-1`,children:[w(u,{size:`xs`,variant:`outline`,"aria-label":`Zoom in`,onClick:()=>k(1/1.4),children:`+`}),w(u,{size:`xs`,variant:`outline`,"aria-label":`Zoom out`,onClick:()=>k(1.4),children:`−`}),w(u,{size:`xs`,variant:`outline`,onClick:()=>C(void 0),children:`Fit`})]}),w(`p`,{className:`pointer-events-none absolute top-2 left-3 flex flex-wrap gap-x-3 text-xs text-po-dim`,children:(a===`backend`?[`public`,`codemode`,`plugin`,`personal`]:[`slot`,`plugin`,`personal`]).map(e=>A(`span`,{className:`flex items-center gap-1`,children:[w(`svg`,{viewBox:`0 0 8 8`,className:`size-2`,"aria-hidden":`true`,children:w(`circle`,{cx:`4`,cy:`4`,r:`4`,fill:V[e]})}),se[e]]},e))})]}),A(`aside`,{className:`flex min-w-0 flex-col gap-3`,"aria-label":`Selection`,children:[G?A(`div`,{className:`rounded-lg border border-po-border p-3`,children:[w(`p`,{className:`text-sm text-po-dim`,children:se[G.role]}),w(`h2`,{className:`break-all font-mono text-base font-semibold text-po-hi`,children:G.label}),w(`p`,{className:`mt-1 text-sm`,children:G.detail}),A(`h3`,{className:`mt-3 text-sm text-po-dim`,children:[`Connected (`,K.length,`)`]}),w(`ul`,{className:`mt-1 max-h-72 overflow-y-auto`,children:K.map(({link:e,other:t})=>w(`li`,{children:A(u,{size:`xs`,variant:`ghost`,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left`,onClick:()=>c(t.id),children:[w(`span`,{className:`font-mono`,children:t.label}),w(`span`,{className:`text-po-dim`,children:e.label})]})},t.id))})]}):w(`p`,{className:`rounded-lg border border-dashed border-po-border p-3 text-sm text-po-dim`,children:`Pick a node to see what it connects to. Scroll to zoom, drag to move around.`}),A(`details`,{className:`rounded-lg border border-po-border p-3`,children:[A(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`All nodes (`,f.nodes.length,`)`]}),w(`ul`,{className:`mt-2 max-h-72 overflow-y-auto`,children:f.nodes.map(e=>w(`li`,{children:w(u,{size:`xs`,variant:`ghost`,"aria-pressed":L===e.id,className:`h-auto w-full justify-start whitespace-normal break-all py-1 text-left font-mono`,onClick:()=>c(e.id),children:e.label})},e.id))})]}),a===`backend`&&e.diagnostics.length>0&&A(`details`,{className:`rounded-lg border border-po-border p-3`,children:[A(`summary`,{className:`cursor-pointer text-sm text-po-dim`,children:[`Coverage notes (`,e.diagnostics.length,`)`]}),e.diagnostics.map(e=>w(`p`,{className:`mt-2 text-sm text-po-dim`,children:e},e))]})]})]})]})}var W={scope:{id:`pending`,level:`global`},scopes:[],packages:[],services:[],consumers:[],edges:[],diagnostics:[]};function G({sessionId:e,workspaceId:t}){let n=e?`session:${e}`:t?`workspace:${t}`:`global`,r=!!(e||t),i=E(()=>e?P.session(e):t?P.workspace(t):P.global,[e,t]),[a,o]=v(0),[s,c]=v(),[l,d]=v(),f=x(void 0);j(()=>{let e=new AbortController;return f.current=e,r?(d({target:n,pending:!0}),i.simulation({signal:e.signal}).then(t=>{if(!e.signal.aborted){if(!t.ok||typeof t.data?.enabled!=`boolean`)throw Error(`Simulation unavailable.`);d({target:n,enabled:t.data.enabled,pending:!1})}}).catch(()=>{e.signal.aborted||d({target:n,pending:!1,error:`Simulation could not be read. Refresh to try again.`})})):d(void 0),c(e=>e?.target===n?{...e,state:`loading`}:void 0),i.services({signal:e.signal}).then(t=>{if(!t.ok)throw Error(`Brain snapshot unavailable.`);e.signal.aborted||c({target:n,services:t.data,state:t.data.services.length+t.data.consumers.length+t.data.packages.length?`populated`:`empty`})}).catch(()=>{e.signal.aborted||c({target:n,services:W,state:`error`})}),()=>{e.abort(),f.current===e&&(f.current=void 0)}},[i,r,n,a]);let p=s?.target===n?s:void 0,m=p?.state??`loading`,h=l?.target===n?l:void 0;async function g(e){let t=f.current;if(r&&t&&!t.signal.aborted&&h&&h.enabled!==void 0&&!h.pending){d({...h,pending:!0,error:void 0});try{let r=await i.setSimulation({body:{enabled:e},signal:t.signal});if(t.signal.aborted)return;if(!r.ok||typeof r.data?.enabled!=`boolean`)throw Error(`Simulation unavailable.`);d({target:n,enabled:r.data.enabled,pending:!1})}catch{t.signal.aborted||d({...h,pending:!1,error:`Simulation could not be changed. Your graph is unchanged.`})}}}return A(`div`,{children:[A(`div`,{className:`flex items-center justify-between gap-3 bg-po-bg px-4 pt-4`,children:[A(`p`,{className:`text-sm text-po-dim`,children:[e?`Session`:t?`Workspace`:`Global`,` snapshot`]}),w(u,{size:`xs`,variant:`outline`,disabled:m===`loading`||h?.pending,onClick:()=>o(e=>e+1),children:`Refresh`})]}),w(U,{services:p?.services??W,state:m,simulation:r?{enabled:h?.enabled??!1,pending:h?.pending!==!1||h.enabled===void 0,error:h?.error,onChange:g}:void 0},n)]})}var K=O({slot:`page`,id:`brain`,component:G}),de=e=>typeof e==`object`&&!!e&&!Array.isArray(e),q=(e,t)=>{if(typeof e!=`string`)return null;let n=e.trim();return n.length>0&&n.length<=t?n:null};function fe(e){if(!de(e)||e.version!==1)return null;let t=q(e.label,80);if(!t||!Array.isArray(e.guides)||e.guides.length>64)return null;let n=[],r=new Set;for(let t of e.guides){if(!de(t))return null;let e=q(t.id,80),i=q(t.question,240),a=q(t.answer,4e3);if(!e||!i||!a||r.has(e)||t.order!==void 0&&(typeof t.order!=`number`||!Number.isFinite(t.order)))return null;let o;if(t.keywords!==void 0){if(!Array.isArray(t.keywords)||t.keywords.length>16)return null;o=[];for(let e of t.keywords){let t=q(e,64);if(!t)return null;o.push(t)}}r.add(e),n.push({id:e,question:i,answer:a,...o===void 0?{}:{keywords:o},...t.order===void 0?{}:{order:t.order}})}return{version:1,label:t,guides:n}}var pe={slot:`help.guides`,description:`Contribute a labelled set of searchable plain-text questions and answers to the Help panel.`,parse:fe};function me(e,t){let n=t.toLowerCase().trim().split(/\s+/).filter(Boolean);return e.flatMap(e=>{let t=e.data.guides.filter(t=>{let r=[e.data.label,t.question,t.answer,...t.keywords??[]].join(` `).toLowerCase();return n.every(e=>r.includes(e))}).sort((e,t)=>(e.order??0)-(t.order??0)||e.question.localeCompare(t.question));return t.length?[{...e,data:{...e.data,guides:t}}]:[]})}function he(e){return w(ge,{fills:e.slotData(pe)},e.sessionId)}function ge({fills:e,initialQuery:t=``,initialExpanded:n}){let[r,i]=v(t),o=me(e,r),s=e.some(e=>e.data.guides.length);return A(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-po-rail text-po-text font-sans`,children:[w(`div`,{className:`border-b border-po-border-soft p-3`,children:w(te,{"aria-label":`Search help`,placeholder:`Search help`,type:`search`,value:r,onChange:e=>i(e.target.value),className:`w-full placeholder:text-po-dim`})}),w(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:o.length===0?w(a,{title:s?`No matching guides`:`No help guides yet`,description:s?`Try a different word or a package name.`:`Guides from this session’s plugins will appear here.`}):w(`div`,{className:`flex flex-col gap-5`,children:o.map(e=>A(`section`,{children:[w(`h2`,{className:`mb-1 text-lg font-semibold text-po-hi break-words`,children:e.data.label}),w(f,{type:`single`,collapsible:!0,defaultValue:n?.[0]===e.pluginId&&n[1]===e.id?n[2]:void 0,children:e.data.guides.map(e=>A(D,{value:e.id,children:[w(c,{className:`text-base font-medium leading-relaxed break-words`,children:e.question}),w(m,{className:`whitespace-pre-wrap break-words text-base leading-relaxed text-po-text`,children:e.answer})]},e.id))})]},JSON.stringify([e.pluginId,e.id])))})})]})}var _e=h({id:`help`,label:`Help`,icon:e,order:50,requiredMinorMode:`help`,panel:he});function ve({openTransientTab:e}){return w(u,{variant:`outline`,size:`xs`,"data-testid":`activity-explore-brain`,onClick:()=>e({id:`help-brain-map`,label:`Brain`,panel:G}),children:`Explore`})}var ye=O({slot:`activity-promo`,id:`brain-explore`,component:ve}),be=O({slot:`help.guides`,id:`Help`,order:0,data:{version:1,label:`Help`,guides:[{id:`about`,question:`What does Help mode do?`,order:0,answer:`Help adds package guidance and read-only diagnostics for your setup. It does not change configuration or grant extra permissions.`,keywords:[`setup`,`diagnostics`]},{id:`toggle`,question:`How do I turn Help on or off?`,order:1,answer:`Use the minor-mode menu, or send /minor help. Help is additive: other tools and modes keep their existing rules.`}]}}),xe=y({path:[{key:`h`,label:`help`,detail:`package docs and logs`},{key:`e`,label:`toggle`,detail:`load or hide package Help`}],command:`minor help`}),Se=_({keys:`h e`,order:10}),Ce=n(pe),we=new Set([`inactive`,`activating`,`active`,`degraded`]),J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0?e:void 0,X=e=>typeof e==`string`&&e.trim()!==``?e.trim():void 0,Z=e=>Array.isArray(e)?e.filter(J):[];function Q(e){return e.split(`
2
+ `).filter(e=>e.trim()!==``)}function Te(e){return Z(e).flatMap(e=>{let t=X(e.name);if(t===void 0)return[];let n=X(e.source),r=X(e.reason);return[{name:t,active:e.active===!0,...n?{source:n}:{},...r?{reason:r}:{}}]})}function Ee(e){let t=X(e.activation);if(t===void 0||!we.has(t))return null;let n=J(e.counts)?e.counts:{},r=Y(n.tools);return{kind:`status`,activation:t,skillCount:Y(n.skills)??null,...r===void 0?{}:{toolCount:r},skills:Te(e.skills),tools:Te(e.tools),diagnostics:Z(e.diagnostics).flatMap(e=>{let t=X(e.code);if(t===void 0)return[];let n=X(e.source);return[{code:t,...n?{source:n}:{}}]}),packages:Z(e.packages).flatMap(e=>{let t=X(e.packageName);if(t===void 0)return[];let n={scope:X(e.scope),stage:X(e.stage),reason:X(e.reason)},r=X(e.previous);return[{packageName:t,...Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0)),...r&&r!==`none`?{previous:r}:{}}]}),truncated:e.truncated===!0}}function De(e){let t=X(e.status);if(t!==`checks-passed`&&t!==`issues-found`)return null;let n=J(e.appliedSelection)?e.appliedSelection:{},r=X(n.majorMode),i=X(n.profile),a=X(e.limitations);return{kind:`setup`,passed:t===`checks-passed`,...r?{majorMode:r}:{},domains:Array.isArray(n.domains)?n.domains.flatMap(e=>X(e)??[]):[],...i?{profile:i}:{},checks:Z(e.checks).flatMap(e=>{let t=X(e.area);if(t===void 0)return[];let n=Y(e.problemCount),r=X(e.guidance);return[{area:t,passed:e.status===`passed`,...n===void 0?{}:{problemCount:n},...r?{guidance:r}:{}}]}),skipped:Array.isArray(e.skipped)?e.skipped.flatMap(e=>X(e)??[]):[],...a?{limitations:a}:{}}}function Oe(e){let t;try{t=JSON.parse(e)}catch{return{kind:`text`,lines:Q(e)}}if(J(t)){let e=Ee(t)??De(t);if(e!==null)return e}return{kind:`text`,lines:Q(e)}}var ke=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;function Ae(e){if(e.kind===`setup`){if(e.passed)return`Checks passed`;let t=e.checks.filter(e=>!e.passed).length;return t>0?`${ke(t,`area`)} failed`:`Issues found`}return{inactive:`Help off`,activating:`Help activating`,active:`Help active`,degraded:`Help degraded`}[e.activation]}function je(e){if(e.kind===`setup`){let t=e.checks.filter(e=>!e.passed).length;return[{label:`Checks passed`,value:`${String(e.checks.length-t)}/${String(e.checks.length)}`,tone:`text`},{label:`Failed`,value:String(t),tone:t>0?`error`:`text`},...e.skipped.length>0?[{label:`Skipped`,value:String(e.skipped.length),tone:`warning`}]:[]]}return e.activation===`inactive`?[]:[{label:`Skills`,value:e.skillCount===null?`pending`:String(e.skillCount),tone:`text`},...e.toolCount===void 0?[]:[{label:`Tools`,value:String(e.toolCount),tone:`text`}],...e.diagnostics.length>0?[{label:`Diagnostics`,value:String(e.diagnostics.length),tone:`warning`}]:[],...e.packages.length>0?[{label:`Failed packages`,value:String(e.packages.length),tone:`error`}]:[]]}function Me(e){if(e.activation===`inactive`)return`Help mode is off in this session.`;if(e.activation===`activating`)return`Skills are counted once the session is ready.`}function Ne(e){return e.kind===`setup`?e.checks.length>0||e.skipped.length>0||e.limitations!==void 0:e.skills.length>0||e.tools.length>0||e.diagnostics.length>0||e.packages.length>0||e.truncated}var Pe=`Help diagnostics`,Fe={text:`truncate text-lg font-semibold tabular-nums text-po-hi`,warning:`truncate text-lg font-semibold tabular-nums text-po-yellow`,error:`truncate text-lg font-semibold tabular-nums text-po-red`};function Ie({toolName:e,output:n,running:r,isError:a}){let o=g({running:r,isError:a}),c=r||a?null:Oe(n);if(c!==null&&c.kind!==`text`)return w(Le,{toolName:e,tone:o,view:c});let u=c?.lines??Q(n);if(a)return A(t,{tone:o,children:[w(l,{title:e,children:w(`span`,{className:`min-w-0 truncate text-po-faint`,children:Pe})}),u.length>0?w(M,{children:w(`p`,{className:`whitespace-pre-wrap break-words text-po-red`,children:u.join(`
3
+ `)})}):null]});let f=u.map(e=>({text:e,tone:`text`}));return w(t,{tone:o,expandable:f.length>12,children:({expanded:t})=>{let n=d(f,12,t);return A(p,{children:[w(l,{title:e,children:w(`span`,{className:`min-w-0 truncate text-po-faint`,children:Pe})}),n.shown.length>0||r?A(M,{children:[w(s,{lines:n.shown}),n.hidden>0?A(i,{expands:!0,children:[n.hidden,` more lines`]}):null,r?w(i,{tone:`running`,children:`Inspecting this session`}):null]}):null]})}})}function Le({toolName:e,tone:n,view:r}){let i=je(r),a=r.kind===`status`?Me(r):void 0;return w(t,{tone:n,expandable:Ne(r),children:({expanded:t})=>A(p,{children:[w(l,{title:e,children:w(`span`,{"data-testid":`tool-call-${e}`,className:`max-w-[70%] shrink-0 truncate text-po-text`,children:Ae(r)})}),A(M,{"data-testid":`tool-result-${e}`,className:`flex flex-col gap-4`,children:[a===void 0?null:w(`p`,{className:`text-sm text-po-dim`,children:a}),i.length>0?w(`dl`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:i.map(e=>A(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[w(`dt`,{className:`truncate text-sm text-po-dim`,children:e.label}),w(`dd`,{className:Fe[e.tone],children:e.value})]},e.label))}):null,t?r.kind===`status`?w(Re,{view:r}):w(Be,{view:r}):null]})]})})}function Re({view:e}){return A(p,{children:[e.packages.length>0?A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:`Failed packages`}),e.packages.map((e,t)=>A(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[A(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[w(`span`,{className:`min-w-0 shrink truncate font-mono text-sm text-po-text`,children:e.packageName}),e.stage===void 0?null:A(`span`,{className:`min-w-0 flex-1 truncate text-right text-sm text-po-faint`,children:[e.stage,e.scope===void 0?``:` · ${e.scope}`]})]}),e.reason===void 0?null:w(`p`,{className:`break-words text-sm text-po-red`,children:e.reason}),e.previous===void 0?null:A(`p`,{className:`text-sm text-po-faint`,children:[`Previous build `,e.previous]})]},`${e.packageName}-${String(t)}`))]}):null,e.diagnostics.length>0?A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:`Diagnostics`}),e.diagnostics.map((e,t)=>A(`div`,{className:`flex min-w-0 items-center gap-2`,children:[w(k,{tone:`yellow`,size:`xs`,className:`shrink-0 font-mono`,children:e.code}),e.source===void 0?null:w(`span`,{className:`min-w-0 flex-1 truncate text-right font-mono text-sm text-po-dim`,children:e.source})]},`${e.code}-${String(t)}`))]}):null,w(ze,{label:`Skills`,rows:e.skills}),w(ze,{label:`Tools`,rows:e.tools}),e.truncated?w(`p`,{className:`text-sm text-po-faint`,children:`The tool capped its lists; more exist.`}):null]})}function ze({label:e,rows:t}){if(t.length===0)return null;let n=t.slice(0,10);return A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:e}),w(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2`,children:n.map((e,t)=>A(`li`,{className:`flex min-w-0 items-center gap-2`,children:[w(`span`,{className:e.active?`min-w-0 shrink truncate font-mono text-sm text-po-text`:`min-w-0 shrink truncate font-mono text-sm text-po-dim`,children:e.name}),e.active?null:w(k,{size:`xs`,className:`shrink-0`,children:e.reason??`inactive`}),e.source===void 0?null:w(`span`,{className:`min-w-0 flex-1 truncate text-right text-sm text-po-faint`,children:e.source})]},`${e.name}-${String(t)}`))}),t.length>n.length?A(`p`,{className:`text-sm text-po-faint`,children:[`and `,t.length-n.length,` more`]}):null]})}function Be({view:e}){let t=[...e.majorMode===void 0?[]:[`mode ${e.majorMode}`],...e.domains.map(e=>`domain ${e}`),...e.profile===void 0?[]:[`profile ${e.profile}`]];return A(p,{children:[t.length>0?A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:`Selection`}),w(`div`,{className:`flex flex-wrap items-center gap-2`,children:t.map(e=>w(k,{size:`xs`,children:e},e))})]}):null,e.checks.length>0?A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:`Checks`}),w(`ul`,{className:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`,children:e.checks.map(e=>A(`li`,{className:`flex min-w-0 flex-col gap-0.5`,children:[A(`div`,{className:`flex min-w-0 items-center gap-2`,children:[w(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e.area}),e.passed?w(C,{"aria-label":`passed`,className:`size-3.5 shrink-0 text-po-green`}):w(`span`,{className:`shrink-0 text-sm text-po-red`,children:e.problemCount===void 0?`failed`:`${String(e.problemCount)} problem${e.problemCount===1?``:`s`}`})]}),!e.passed&&e.guidance!==void 0?A(`span`,{className:`truncate text-sm text-po-faint`,children:[`Guide: `,e.guidance]}):null]},e.area))})]}):null,e.skipped.length>0?A(`section`,{className:`flex flex-col gap-2`,children:[w(o,{children:`Skipped`}),e.skipped.map(e=>w(`p`,{className:`text-sm text-po-yellow`,children:e},e))]}):null,e.limitations===void 0?null:w(`p`,{className:`text-sm text-po-faint`,children:e.limitations})]})}var Ve=N({tools:[`help_status`,`diagnose_setup`],message:Ie}),$=(e,t)=>t===void 0?void 0:{...e,...t},He=r({id:`help`,global:{get fills(){return[$({slot:`page`,id:`brain`},K)]}},session:{get dockFaces(){return[$({id:`help`},_e)]},get fills(){return[$({slot:`activity-promo`,id:`brain`},ye),$({slot:`help.guides`,id:`help`},be)]},get leaderBindings(){return[$({id:`help.toggle`},xe)]},get minorModes(){return[$({name:`help`},Se)]},get slots(){return[$({slot:`help.guides`},Ce)]},get toolRenderers(){return[$({tools:[`help_status`]},Ve)]}}});export{He as webPlugin};
@@ -0,0 +1,4 @@
1
+ import{$ as e,C as t,Cn as n,Dr as r,Dt as i,E as a,Gn as o,J as s,O as c,Ot as l,Q as u,T as d,Vt as f,X as p,Y as m,Z as h,Zt as g,a as _,ar as v,br as y,cr as b,d as x,fn as S,h as C,jr as w,m as ee,n as te,o as T,or as ne,rt as re,s as E,u as ie,w as D,wr as O}from"../chunks/po-web-runtime-EI_2k5Ip.js";var ae=[`session`,`agent`,`model`,`provider`],oe=[`day`,`week`,`month`,`all`],k={dimension:`dimension`,period:`period`,focus:`focus`};function A(e){return`unavailable`in e}function se(e){return`unavailable`in e}var ce=b({metrics:{method:`GET`,path:`/metrics`,query:[k.dimension,k.period,k.focus],response:v()},issues:{method:`GET`,path:`/issues`,query:[k.focus],response:v()},ingestLogs:{method:`POST`,path:`/v1/logs`,response:v()}}),j=ne(ce,{scopes:[`global`,`workspace`,`session`],basePath:`log`,transport:(e,t)=>te.fetch(e,t),sessionAddress:w}),le=`The cockpit hub is unreachable.`,M=`This cockpit is running a bundle without the log package API, so there are no metrics to read.`,ue={unavailable:`no-api`,detail:M};function de(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e,t){if(e.status===0)return{error:t?.aborted===!0?``:le};let n=`The hub answered ${String(e.status)}.`;return e.data===void 0?e.ok?{noApi:!0}:{error:n}:de(e.data)?e.ok?{body:e.data}:{error:e.error===``?n:e.error}:{error:`The hub returned a response the cockpit could not read.`}}async function fe(e,t,n,r){let i=N(await j.global.metrics({query:{[k.dimension]:e,[k.period]:t,[k.focus]:n===``?void 0:n},...r===void 0?{}:{signal:r}}),r);if(`error`in i)return{error:i.error};if(`noApi`in i)return{report:ue};let a=i.body;return!A(a)&&!Array.isArray(a.groups)?{error:`The hub returned a report the cockpit could not read.`}:{report:a}}async function pe(e,t,n={}){let r=N(await j.global.issues({query:{[k.focus]:e===``?void 0:e,...n},...t===void 0?{}:{signal:t}}),t);return`error`in r?{error:r.error}:`noApi`in r?{issues:{unavailable:`no-api`,detail:M}}:{issues:r.body}}function P(e,t){return!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?0:Math.min(1,e/t)}function F(e){return e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,0)}function I(e){return Number.isFinite(e)?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)):`Not reported`}var L=5;function me({groups:e,totalTokens:t,focus:n,onFocus:r}){let[i,a]=C(!1),o=[...e].sort((e,t)=>t.totalTokens-e.totalTokens||e.key.localeCompare(t.key)),s=i?o:o.slice(0,L),c=t??F(e.map(e=>e.totalTokens));return E(`div`,{className:`flex flex-col gap-3`,children:[e.length===0?T(`p`,{className:`rounded-md border border-dashed border-po-border p-5 text-sm text-po-dim`,children:`No grouped usage was recorded for this selection.`}):null,T(`ul`,{className:`flex flex-col gap-1`,"data-testid":`metrics-group-bars`,children:s.map(e=>{let i=n===e.key,a=e.key===`unknown`||e.key===``,o=r!==void 0&&!a,s=P(e.totalTokens,c)*100,l=E(_,{children:[E(`span`,{className:`flex items-start justify-between gap-3`,children:[T(`span`,{className:`min-w-0 break-all text-left font-medium text-po-hi`,title:e.key,children:a?`Unattributed`:e.key}),T(`span`,{className:`shrink-0 text-right font-semibold tabular-nums text-po-hi`,title:String(e.totalTokens),children:I(e.totalTokens)})]}),T(`span`,{"aria-hidden":`true`,className:`mt-2 block h-1.5 overflow-hidden rounded-full bg-po-border`,children:T(`span`,{className:`block h-full rounded-full ${a?`bg-po-yellow`:`bg-po-blue`}`,style:{width:`${s}%`}})}),E(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2 text-sm text-po-dim`,children:[T(`span`,{children:t!==void 0&&c>0?`${s.toFixed(1)}% of total`:`Relative token volume`}),E(`span`,{className:e.issueCount>0||e.failed?`text-po-yellow`:`text-po-dim`,children:[e.failed?`Failed · `:``,I(e.issueCount),` `,e.issueCount===1?`issue`:`issues`]})]})]});return T(`li`,{children:o?T(`button`,{type:`button`,onClick:()=>r?.(i?``:e.key),"aria-pressed":i,"aria-label":`Filter to ${e.key}`,"data-testid":`metrics-group-${e.key}`,className:`block w-full rounded-md p-3 text-base hover:bg-po-tint-blue focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue ${i?`bg-po-tint-blue`:``}`,children:l}):T(`div`,{className:`rounded-md p-3 text-base`,children:l})},e.key)})}),e.length>L?T(f,{variant:`ghost`,size:`sm`,onClick:()=>a(!i),"aria-expanded":i,children:i?`Show top 5`:`Show all ${e.length} returned groups`}):null]})}var R=[{key:`totalTokens`,label:`Total`},{key:`inputTokens`,label:`Input`},{key:`outputTokens`,label:`Output`}],z=600,B=160,he=48;function ge({buckets:e,bucketUnit:t,onShorterPeriod:n}){let[r,i]=C(`totalTokens`),[a,o]=C(``),s=e.find(e=>e.label===a)??e.at(-1),c=F(e.map(e=>e[r])),l=t?`${t} `:``,u=z/Math.max(1,e.length),d=Math.min(he,u*.65);return e.length===0?T(`p`,{className:`rounded-md border border-dashed border-po-border p-5 text-sm text-po-dim`,"data-testid":`metrics-timeline-chart`,children:`No timeline buckets were recorded for this selection.`}):e.length===1&&s!==void 0?T(`div`,{className:`flex flex-col gap-4`,"data-testid":`metrics-timeline-chart`,children:E(`div`,{className:`rounded-md border border-po-border bg-po-deep p-5`,children:[T(`p`,{className:`text-sm text-po-dim`,children:s.label}),E(`p`,{className:`mt-2 text-lg font-semibold tabular-nums text-po-blue`,title:String(s.totalTokens),children:[I(s.totalTokens),` tokens`]}),E(`p`,{className:`mt-3 text-sm leading-relaxed text-po-dim`,children:[`Only one `,l,`bucket was recorded. There is not enough history to show a trend.`]}),T(`p`,{className:`mt-2 text-sm text-po-dim`,children:`For more detail, pick a shorter period when one is available.`}),n===void 0?null:T(f,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:n,children:`View hourly detail`})]})}):E(`div`,{className:`flex flex-col gap-3`,"data-testid":`metrics-timeline-chart`,children:[E(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[T(`div`,{className:`flex gap-1`,role:`group`,"aria-label":`Timeline token counter`,children:R.map(e=>T(f,{size:`sm`,variant:r===e.key?`primary`:`ghost`,"aria-pressed":r===e.key,onClick:()=>i(e.key),children:e.label},e.key))}),E(`span`,{className:`text-sm text-po-dim`,children:[e.length,` recorded `,l,`buckets`]})]}),E(`div`,{className:`flex gap-3`,children:[E(`div`,{"aria-hidden":`true`,className:`flex w-12 shrink-0 flex-col justify-between text-right text-sm tabular-nums text-po-dim`,children:[T(`span`,{children:I(c)}),T(`span`,{children:I(c/2)}),T(`span`,{children:`0`})]}),E(`svg`,{viewBox:`0 0 ${z} ${B}`,preserveAspectRatio:`none`,className:`h-40 min-w-0 flex-1 overflow-visible`,role:`group`,"aria-label":`tokens per bucket, peak ${I(c)}`,children:[[0,B/2,B].map(e=>T(`line`,{x1:`0`,x2:z,y1:e,y2:e,className:`text-po-border`,stroke:`currentColor`,vectorEffect:`non-scaling-stroke`},e)),e.map((e,t)=>{let n=P(e[r],c)*B,i=`${e.label}: ${I(e[r])} ${R.find(e=>e.key===r)?.label.toLowerCase()} tokens`;return E(`g`,{children:[T(`rect`,{x:t*u+(u-d)/2,y:B-n,width:d,height:n,rx:`2`,fill:`currentColor`,className:s?.label===e.label?`text-po-cyan`:`text-po-blue`}),T(`rect`,{x:t*u,y:`0`,width:u,height:B,fill:`transparent`,tabIndex:0,role:`button`,"aria-label":i,"aria-pressed":s?.label===e.label,onMouseEnter:()=>o(e.label),onFocus:()=>o(e.label),onClick:()=>o(e.label),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e.label))},className:`cursor-pointer focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-cyan`,children:T(`title`,{children:i})})]},e.label)})]})]}),E(`div`,{className:`ml-15 flex justify-between gap-3 text-sm text-po-dim`,children:[T(`span`,{children:e[0]?.label}),T(`span`,{className:`text-right`,children:e.at(-1)?.label})]}),E(`div`,{className:`flex flex-wrap justify-between gap-2 rounded-md bg-po-deep px-3 py-2 text-sm tabular-nums`,"aria-live":`polite`,"aria-atomic":`true`,children:[T(`span`,{className:`text-po-dim`,children:s?.label}),E(`span`,{className:`text-po-hi`,children:[I(s?.[r]??NaN),` `,R.find(e=>e.key===r)?.label.toLowerCase(),` tokens`]})]}),c===0?E(`p`,{className:`text-sm text-po-dim`,children:[`Recorded buckets contain zero `,R.find(e=>e.key===r)?.label.toLowerCase(),` tokens.`]}):null,E(`details`,{className:`text-sm text-po-dim`,children:[T(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`View exact bucket values`}),T(`div`,{className:`mt-3 overflow-x-auto`,children:E(`table`,{className:`w-full text-right tabular-nums`,children:[T(`caption`,{className:`sr-only`,children:`Independent token counters by recorded bucket`}),T(`thead`,{children:E(`tr`,{children:[T(`th`,{scope:`col`,className:`py-2 text-left`,children:`Bucket`}),T(`th`,{scope:`col`,className:`pl-3`,children:`Total`}),T(`th`,{scope:`col`,className:`pl-3`,children:`Input`}),T(`th`,{scope:`col`,className:`pl-3`,children:`Output`})]})}),T(`tbody`,{children:e.map(e=>E(`tr`,{className:`border-t border-po-border`,children:[T(`th`,{scope:`row`,className:`py-2 text-left font-normal`,children:e.label}),R.map(t=>T(`td`,{className:`pl-3`,children:Number.isFinite(e[t.key])?e[t.key].toLocaleString(`en-US`):`Not reported`},t.key))]},e.label))})]})})]})]})}function _e(e){return`${e.fingerprint===``?`${e.category}|${e.message}`:e.fingerprint}|${e.detail}`}function ve(e){let t=new Map;for(let n of e){let e=_e(n),r=t.get(e);r===void 0?t.set(e,{key:e,occurrences:n.occurrenceCount,category:n.category,detail:n.detail,tool:n.tool,errorType:n.errorType,agentName:n.agentName,model:n.model,statusCode:n.statusCode,lastSeen:n.timestamp,members:[n]}):(r.occurrences+=n.occurrenceCount,r.members.push(n),n.timestamp>r.lastSeen&&(r.lastSeen=n.timestamp),r.tool??=n.tool,r.errorType??=n.errorType,r.agentName??=n.agentName,r.model??=n.model,r.statusCode??=n.statusCode)}return[...t.values()].sort((e,t)=>t.occurrences-e.occurrences||e.detail.localeCompare(t.detail))}function V(e){return Object.entries(e).sort(([,e],[,t])=>t-e)}function ye(e){return e.errorType===null?e.tool===null?e.category:`${e.tool} failed`:e.errorType}function be({group:e,max:t,tools:n}){let[r,i]=C(!1),a=`${(P(e.occurrences,t)*100).toFixed(2)}%`,o=n.find(t=>t.name===e.tool)?.calls;return E(`li`,{className:`flex flex-col rounded-md border border-po-border`,children:[E(`div`,{className:`relative`,children:[T(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 h-1 rounded-xs bg-po-yellow/40`,style:{width:a}}),E(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":r,"data-testid":`metrics-issue-${e.key}`,className:`relative flex min-h-10 w-full flex-wrap items-start gap-3 rounded-md p-3 text-left text-base hover:bg-po-tint-blue focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:[T(`span`,{className:`w-8 shrink-0 text-right font-semibold text-po-yellow`,children:e.occurrences}),T(`span`,{className:`w-24 shrink-0 break-words font-medium text-po-hi`,children:ye(e)}),T(`span`,{className:`min-w-40 flex-1 break-words text-po-dim`,children:e.detail}),o===void 0?null:E(`span`,{className:`shrink-0 text-po-dim`,children:[o,` token samples`]})]})]}),r?E(`div`,{className:`flex flex-col gap-1 px-3 py-3 text-base`,"data-testid":`metrics-issue-body-${e.key}`,children:[E(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-sm text-po-dim`,children:[E(`span`,{children:[`category `,e.category]}),e.tool===null?null:E(`span`,{children:[`tool `,e.tool]}),e.errorType===null?null:E(`span`,{children:[`error `,e.errorType]}),e.statusCode===null?null:E(`span`,{children:[`status `,e.statusCode]}),e.agentName===null?null:E(`span`,{children:[`agent `,e.agentName]}),e.model===null?null:E(`span`,{children:[`model `,e.model]}),E(`span`,{children:[`last seen `,e.lastSeen]})]}),T(`span`,{className:`break-words text-po-dim`,children:e.detail}),T(`ul`,{className:`flex flex-col gap-1 text-sm text-po-dim`,children:e.members.map((e,t)=>E(`li`,{className:`flex flex-wrap gap-x-2`,children:[T(`span`,{children:e.timestamp}),T(`span`,{children:e.level}),E(`span`,{children:[e.occurrenceCount,`×`]}),T(`span`,{className:`min-w-0 truncate`,children:e.message})]},`${e.timestamp}-${String(t)}`))})]}):null]})}function xe({view:e,tools:t,summaryCount:n}){let r=ve(e.samples),i=r[0]?.occurrences??0,a=new Map(t.map(e=>[e.name,e.calls]));return E(`div`,{className:`flex flex-col gap-3`,children:[n!==void 0&&n!==e.totalIssues?E(`p`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm leading-relaxed text-po-yellow`,role:`status`,"data-testid":`metrics-issue-count-mismatch`,children:[`The summary reports `,n,` `,n===1?`issue`:`issues`,`; incident analysis returned`,` `,e.totalIssues,`. The counts differ, so these details should not be treated as a complete explanation of the summary.`]}):null,E(`span`,{className:`text-sm text-po-dim`,children:[T(`span`,{className:`text-po-hi`,children:e.totalIssues}),` occurrences of`,` `,T(`span`,{className:`text-po-hi`,children:r.length}),` distinct problems in the returned samples, most frequent first`]}),r.length===0?T(`p`,{className:`rounded-md border border-dashed border-po-border p-4 text-sm text-po-dim`,children:e.totalIssues===0?`No issues were detected in the returned analysis. This does not establish coverage of unrecorded activity.`:`The analysis counted issues but returned no incident samples.`}):T(`ul`,{className:`flex flex-col gap-2`,"data-testid":`metrics-issue-groups`,children:r.map(e=>T(be,{group:e,max:i,tools:t},e.key))}),Object.keys(e.byTool).length===0?null:E(`div`,{className:`flex flex-col gap-2 overflow-x-auto`,children:[T(`h4`,{className:`text-base font-semibold text-po-hi`,children:`Failures by tool`}),E(`table`,{className:`w-full text-sm`,"data-testid":`metrics-issues-tools`,children:[T(`thead`,{children:E(`tr`,{className:`text-sm text-po-dim`,children:[T(`th`,{scope:`col`,className:`py-2 text-left font-normal`,children:`Tool`}),T(`th`,{scope:`col`,className:`text-right font-normal`,children:`Failures`}),T(`th`,{scope:`col`,className:`text-right font-normal`,children:`Attribution context`})]})}),T(`tbody`,{children:V(e.byTool).map(([e,t])=>{let n=a.get(e);return E(`tr`,{className:`border-b border-po-border/40`,children:[T(`td`,{className:`min-w-0 break-all py-2 text-po-dim`,children:e}),T(`td`,{className:`w-16 py-2 text-right text-po-red`,children:t}),T(`td`,{className:`w-28 py-2 text-right text-po-dim`,children:n===void 0?`no token samples`:`${String(n)} token samples`})]},e)})})]})]}),E(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm text-po-dim`,children:[T(`span`,{className:`text-sm font-semibold text-po-dim`,children:`by category`}),V(e.byCategory).map(([e,t])=>E(`span`,{children:[e,` `,T(`span`,{className:`text-po-hi`,children:t})]},e))]})]})}function Se({tools:e,focus:t,count:n,startTime:r,endTime:a,broaderScope:o=!1}){let[s,c]=C(),[l,u]=C(``),[d,p]=C(!1),[m,h]=C(!1),g=ee(void 0),_=x();return ie(()=>(g.current?.abort(),c(void 0),u(``),p(!1),h(!1),()=>g.current?.abort()),[t,r,a]),E(`section`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-po-border bg-po-panel p-4`,"data-testid":`metrics-issues`,children:[E(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[E(`div`,{children:[E(`h3`,{className:`text-lg font-semibold text-po-hi`,children:[`Issues to investigate`,n===void 0?``:` · ${n} ${n===1?`issue`:`issues`}`]}),T(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Inspect recurring failures and the evidence behind them.`})]}),E(`div`,{className:`flex items-center gap-2`,children:[d?T(i,{label:`Reading issue details`}):null,T(f,{variant:`outline`,size:`md`,disabled:d,onClick:()=>{g.current?.abort();let e=new AbortController;g.current=e,h(!0),p(!0),u(``),c(void 0),pe(t,e.signal,{startTime:r,endTime:a}).then(t=>{e.signal.aborted||(p(!1),`error`in t?u(t.error||`Issue details could not be loaded.`):se(t.issues)?u(t.issues.detail):c(t.issues))}).catch(t=>{e.signal.aborted||(p(!1),u(t instanceof Error?t.message:`Issue details could not be loaded.`))})},"aria-expanded":m,"aria-controls":_,"data-testid":m?`metrics-issues-reload`:`metrics-issues-open`,children:m?`Reload details`:`Inspect issues`}),m?T(f,{variant:`ghost`,size:`md`,onClick:()=>{g.current?.abort(),p(!1),h(!1)},"aria-controls":_,children:`Hide`}):null]})]}),E(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:[`Details are loaded on demand.`,` `,r===void 0?a===void 0?`This hub did not report a time window; details cover all available history.`:`Details cover available history up to report time; no start bound was supplied.`:`Details use the report’s recorded time window.`,` `,o?`LogSink cannot filter issue details by model, provider or agent, so this analysis covers all groups in that window.`:t===void 0?`Analysis covers all groups.`:`Filtered to this session.`]}),E(`div`,{id:_,hidden:!m,"aria-busy":d,children:[l===``?null:T(`p`,{role:`alert`,className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm text-po-yellow`,"data-testid":`metrics-issues-message`,children:l}),d?T(`p`,{role:`status`,className:`py-3 text-sm text-po-dim`,children:`Reading recorded incidents...`}):null,s===void 0?null:T(xe,{view:s,tools:o?[]:e,summaryCount:o?void 0:n})]})]})}function Ce({totals:e}){let t=[{label:`Total tokens`,value:e.totalTokens,detail:`Provider-reported total`,color:`text-po-blue`},{label:`Input tokens`,value:e.inputTokens,detail:`Reported input counter`,color:`text-po-hi`},{label:`Output tokens`,value:e.outputTokens,detail:`Reported output counter`,color:`text-po-hi`},{label:`Recorded issues`,value:e.issueCount,detail:`Detected in this selection`,color:e.issueCount>0?`text-po-yellow`:`text-po-hi`}];return T(`dl`,{className:`grid grid-cols-2 gap-3 @3xl:grid-cols-4`,"data-testid":`metrics-summary`,children:t.map(e=>E(`div`,{className:`min-w-0 rounded-lg border border-po-border bg-po-panel p-4`,children:[T(`dt`,{className:`text-sm text-po-dim`,children:e.label}),T(`dd`,{className:`mt-2 text-lg font-semibold tabular-nums ${e.color}`,title:Number.isFinite(e.value)?e.value.toLocaleString(`en-US`):`Not reported`,children:I(e.value)}),T(`dd`,{className:`mt-1 text-sm text-po-dim`,children:e.detail})]},e.label))})}function we({tools:e}){let[t,n]=C(`p90TotalTokens`),r=[...e].sort((e,n)=>n[t]-e[t]||e.name.localeCompare(n.name));return E(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Tool token samples`,children:[E(`div`,{children:[T(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Tool token samples`}),T(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Which tools participate in token-heavy turns?`})]}),r.length===0?E(`div`,{className:`flex flex-1 flex-col justify-center gap-2 rounded-md border border-dashed border-po-border p-5`,"data-testid":`metrics-tools-empty`,children:[T(`p`,{className:`text-base font-semibold text-po-hi`,children:`No token-attributed tool calls`}),T(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Tool execution logs may exist, but this selection has no samples that connect tools to model usage. This does not mean no tools ran.`})]}):E(_,{children:[E(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Rank tool samples by`,children:[T(f,{size:`sm`,variant:t===`p90TotalTokens`?`primary`:`ghost`,"aria-pressed":t===`p90TotalTokens`,onClick:()=>n(`p90TotalTokens`),children:`P90 turn tokens`}),T(f,{size:`sm`,variant:t===`calls`?`primary`:`ghost`,"aria-pressed":t===`calls`,onClick:()=>n(`calls`),children:`Sampled calls`})]}),T(`div`,{className:`overflow-x-auto`,children:E(`table`,{className:`w-full text-base tabular-nums`,"data-testid":`metrics-tools`,children:[E(`caption`,{className:`sr-only`,children:[`Tools ranked by `,t===`calls`?`sampled calls`:`90th percentile whole-turn tokens`]}),T(`thead`,{children:E(`tr`,{className:`border-b border-po-border text-sm text-po-dim`,children:[T(`th`,{scope:`col`,className:`pb-2 text-left font-normal`,children:`Tool`}),T(`th`,{scope:`col`,className:`pb-2 pl-3 text-right font-normal`,children:`Sampled calls`}),T(`th`,{scope:`col`,className:`pb-2 pl-3 text-right font-normal`,children:`P90 turn tokens`})]})}),T(`tbody`,{children:r.map(e=>E(`tr`,{className:`border-b border-po-border/40`,children:[T(`th`,{scope:`row`,className:`max-w-48 break-all py-3 text-left font-normal text-po-hi`,children:e.name}),T(`td`,{className:`py-3 pl-3 text-right text-po-dim`,children:I(e.calls)}),T(`td`,{className:`py-3 pl-3 text-right text-po-blue`,title:String(e.p90TotalTokens),children:I(e.p90TotalTokens)})]},e.name))})]})})]}),E(`details`,{className:`text-sm leading-relaxed text-po-dim`,children:[T(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`How these samples are counted`}),T(`p`,{className:`mt-2`,children:`This view includes only calls with recorded token attribution; external MCP calls remain in the logs. P90 is the 90th percentile of the whole turn, not each tool's own consumption. Several tools may share a turn, so do not add these values together.`})]})]})}var H={session:`session`,agent:`agent`,model:`model`,provider:`provider`},Te={session:`Session ids are hashed before export. Select a row to filter usage, not to open a session.`};function Ee({report:e,onFocus:t,onPeriodChange:n}){let r=H[e.dimension],i=e.groups.filter(e=>e.key===`unknown`||e.key===``).reduce((e,t)=>e+t.totalTokens,0),a=[{name:`Cache reads`,value:e.totals.cachedTokens},{name:`Reasoning tokens`,value:e.totals.reasoningTokens},{name:`Usage events`,value:e.totals.usageEventCount},{name:`Log and span records`,value:e.totals.totalRecords}],o=new Date(e.generatedAt);return E(`div`,{className:`@container flex w-full min-w-0 flex-col gap-4`,"data-testid":`metrics-report`,children:[T(Ce,{totals:e.totals}),E(`div`,{className:`grid min-w-0 grid-cols-1 gap-4 @3xl:grid-cols-3`,children:[E(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4 @3xl:col-span-2`,"aria-label":`Usage over time`,children:[E(`div`,{children:[T(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Usage over time`}),T(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Recorded tokens, not estimated spend.`})]}),T(ge,{buckets:e.timeline,bucketUnit:e.bucketUnit,onShorterPeriod:e.period===`day`||n===void 0?void 0:()=>n(`day`)})]}),E(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Reported counters`,children:[T(`h3`,{className:`text-lg font-semibold text-po-hi`,children:`Reported counters`}),T(`dl`,{className:`flex flex-col gap-3`,children:a.map(e=>E(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 border-b border-po-border/40 pb-3`,children:[T(`dt`,{className:`text-sm text-po-dim`,children:e.name}),T(`dd`,{className:`text-base font-semibold tabular-nums text-po-hi`,title:e.value===void 0?`Not reported`:String(e.value),children:I(e.value??NaN)})]},e.name))}),T(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Monetary cost is not included in this metrics report.`}),E(`details`,{className:`text-sm leading-relaxed text-po-dim`,children:[T(`summary`,{className:`cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue`,children:`Why the counters may not add up`}),T(`p`,{className:`mt-2`,children:`The total is reported by providers. Input, output, cache reads and reasoning are independent counters and may overlap or be incomplete. They are not a breakdown and may not sum to the total. A gap is not evidence of cache traffic. Missing fields say Not reported; a recorded zero stays zero.`})]})]})]}),E(`div`,{className:`grid min-w-0 grid-cols-1 items-start gap-4 @3xl:grid-cols-2`,children:[E(`section`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-po-border bg-po-panel p-4`,"aria-label":`Tokens by ${r}`,children:[E(`div`,{children:[E(`h3`,{className:`text-lg font-semibold text-po-hi`,children:[`Tokens by `,r]}),T(`p`,{className:`mt-1 text-sm text-po-dim`,children:`Largest recorded consumers. Select a named row to filter.`})]}),i>0?E(`div`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3`,"data-testid":`metrics-attribution-notice`,children:[E(`p`,{className:`text-sm font-semibold text-po-yellow`,children:[r.charAt(0).toUpperCase()+r.slice(1),` attribution missing`]}),E(`p`,{className:`mt-1 text-sm leading-relaxed text-po-dim`,children:[I(i),` tokens have no `,r,` recorded. They are included in the total, but cannot be assigned to a named `,r,`.`]})]}):null,Te[e.dimension]===void 0?null:T(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:Te[e.dimension]}),T(me,{groups:e.groups,totalTokens:e.totals.totalTokens,focus:e.focus,onFocus:t},`${e.dimension}:${e.focus??``}`),E(`p`,{className:`text-sm text-po-dim`,children:[`Showing `,e.groups.length,` of `,I(e.totals.groupCount),` `,r,` groups. Bars show share of the reported total.`]}),e.totals.failedGroups>0?E(`p`,{className:`text-sm text-po-yellow`,children:[e.totals.failedGroups,` of `,e.totals.groupCount,` `,r,`s failed`]}):null]}),T(we,{tools:e.tools})]}),T(Se,{tools:e.tools,focus:e.dimension===`session`?e.focus:void 0,count:e.totals.issueCount,startTime:e.startTime,endTime:e.endTime,broaderScope:e.focus!==void 0&&e.dimension!==`session`},`${e.generatedAt}:${e.dimension}:${e.focus??``}`),E(`footer`,{className:`flex flex-wrap justify-between gap-2 border-t border-po-border pt-3 text-sm text-po-dim`,"data-testid":`metrics-provenance`,children:[E(`span`,{children:[`Source: LogSink ·`,` `,e.transport===`http`?`HTTP`:e.transport===`worker`?`database worker`:`transport not reported`]}),E(`span`,{title:e.generatedAt,children:[`Report generated `,Number.isNaN(o.getTime())?e.generatedAt:o.toLocaleString()]})]})]})}var De={"no-sink":`no log sink`,"no-data":`nothing recorded yet`,"no-api":`metrics not installed`,"query-error":`metrics could not be loaded`};function Oe({response:e}){return T(o,{title:De[e.unavailable],description:e.detail,"data-testid":`metrics-empty`})}function ke({requested:e,applied:t,dimension:n,onClear:r}){return e===``?null:t===void 0?E(`span`,{className:`rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm text-po-yellow`,"data-testid":`metrics-focus-refused`,children:[`this log sink does not support narrowing by `,H[n],`, so the numbers below are still everything`,T(f,{variant:`ghost`,size:`md`,className:`ml-2`,onClick:r,children:`clear`})]}):E(`span`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-po-border bg-po-panel p-3 text-sm text-po-dim`,"data-testid":`metrics-focus`,children:[`narrowed to `,T(`span`,{className:`min-w-0 break-all text-po-hi`,children:t}),T(f,{variant:`ghost`,size:`md`,className:`ml-2`,onClick:r,children:`clear`})]})}function Ae(){return E(`div`,{className:`flex flex-col gap-4`,role:`status`,"aria-live":`polite`,"data-testid":`metrics-loading`,children:[T(`span`,{className:`text-sm text-po-dim`,children:`Loading recorded metrics...`}),T(`div`,{"aria-hidden":`true`,className:`grid grid-cols-2 gap-3 @3xl:grid-cols-4`,children:[0,1,2,3].map(e=>T(`div`,{className:`h-24 animate-pulse rounded-lg border border-po-border bg-po-panel motion-reduce:animate-none`},e))}),T(`div`,{"aria-hidden":`true`,className:`h-48 animate-pulse rounded-lg border border-po-border bg-po-panel motion-reduce:animate-none`})]})}var je={day:`Past day`,week:`Past week`,month:`Past month`,all:`All history`};function Me(t){let[n,r]=C(`model`),[i,a]=C(`week`),[o,s]=C(``),[c,l]=C(0),[d,g]=C(),v=JSON.stringify([n,i,o,c]);ie(()=>{let e=new AbortController;return fe(n,i,o,e.signal).then(t=>{e.signal.aborted||g({key:v,result:t})}).catch(t=>{e.signal.aborted||g({key:v,result:{error:t instanceof Error?t.message:`Metrics could not be loaded.`}})}),()=>e.abort()},[n,i,o,v]);let y=d?.key===v?d.result:void 0,b=y===void 0,x=y!==void 0&&`report`in y?y.report:void 0,S=x===void 0||A(x)?void 0:x,w=y!==void 0&&`error`in y?y.error:``;return E(`div`,{className:`@container flex w-full min-w-0 flex-col gap-4`,"data-testid":`metrics-panel`,"aria-busy":b,children:[E(`div`,{className:`flex min-w-0 flex-wrap items-end gap-3 rounded-lg border border-po-border bg-po-panel p-3`,children:[E(`div`,{className:`flex flex-col gap-2`,children:[T(`span`,{className:`text-base font-medium text-po-text`,children:`Group by`}),E(m,{value:n,onValueChange:e=>{s(``),r(e)},children:[T(u,{"aria-label":`Group metrics by`,"data-testid":`metrics-dimension`,className:`w-40 `,children:T(e,{})}),T(p,{children:ae.map(e=>T(h,{value:e,children:H[e]},e))})]})]}),E(`div`,{className:`flex flex-col gap-2`,children:[T(`span`,{className:`text-base font-medium text-po-text`,children:`Period`}),E(m,{value:i,onValueChange:e=>a(e),children:[T(u,{"aria-label":`Metrics period`,"data-testid":`metrics-period`,className:`w-40 `,children:T(e,{})}),T(p,{children:oe.map(e=>T(h,{value:e,children:je[e]},e))})]})]}),T(f,{variant:`outline`,size:`md`,className:`ml-auto`,onClick:()=>l(e=>e+1),disabled:b,"data-testid":`metrics-refresh`,children:b?`Loading...`:`Refresh`})]}),b?T(Ae,{}):null,w===``?null:E(`p`,{role:`alert`,className:`rounded-lg border border-po-edge-red bg-po-tint-red p-4 text-sm text-po-red`,"data-testid":`metrics-error`,children:[w,` Use Refresh to try again.`]}),x!==void 0&&A(x)?T(Oe,{response:x}):null,S===void 0?null:E(_,{children:[T(ke,{requested:o,applied:S.focus,dimension:S.dimension,onClear:()=>s(``)}),T(Ee,{report:S,onFocus:s,onPeriodChange:a})]})]})}var Ne=y({label:`metrics`,detail:`recorded usage, token attribution and issues`,icon:n,component:Me});function Pe(e){return e.split(`
2
+ `).filter(Boolean)}var Fe=new Set([`tool_failure`,`infrastructure_failure`,`api_error`,`api_retries_exhausted`,`log_error`]),Ie=/[^.]*empty data[^.]*\.?/i,U=e=>typeof e==`object`&&!!e&&!Array.isArray(e),W=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0,G=e=>typeof e==`string`&&e.trim()!==``?e.trim():void 0;function Le(e){return U(e)?Object.entries(e).flatMap(([e,t])=>{let n=W(t);return n!==void 0&&n>0&&e.trim()!==``?[{key:e,label:e.replaceAll(`_`,` `),count:n,failure:Fe.has(e)}]:[]}).sort((e,t)=>t.count-e.count):[]}function Re(e){return Array.isArray(e)?e.flatMap(e=>{if(!U(e))return[];let t=G(e.name);return t===void 0?[]:[{name:t,invocations:W(e.invocations),p90TurnTokens:W(e.p90TurnTokens)}]}):[]}function ze(e){let t;try{t=JSON.parse(e)}catch{return null}if(!U(t))return null;let n=U(t.usage)?t.usage:{},r={scope:G(t.scope),period:G(t.period),evidence:G(t.evidence),code:G(t.code),capturedRecords:W(t.capturedRecords),capturedIssues:W(t.capturedIssues),categories:Le(t.issuesByCategory),inputTokens:W(n.inputTokens),outputTokens:W(n.outputTokens),tokenCoveragePercent:W(n.tokenCoveragePercent),tools:Re(t.tools),limitReached:typeof t.limitReached==`boolean`?t.limitReached:void 0,captureCompleteness:G(t.captureCompleteness),limitations:G(t.limitations)};return Object.values(r).some(e=>Array.isArray(e)?e.length>0:e!==void 0)?r:null}function K(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}var q=e=>e.replaceAll(/[-_]/g,` `);function Be(e){let t=[e.scope,e.period].flatMap(e=>e?[q(e)]:[]).join(` · `),n=e.capturedIssues,r=e.evidence===`unavailable`?`Telemetry unavailable`:e.evidence===`empty`?`Nothing captured`:n===void 0?`Captured agent evidence`:n===0?`No issues`:`${String(n)} ${n===1?`issue`:`issues`}`;return t===``?{primary:r}:{primary:r,context:t}}function Ve(e){let t=[];if(e.capturedRecords!==void 0&&t.push({label:`Records`,value:e.capturedRecords.toLocaleString(`en-US`),failure:!1}),e.capturedIssues!==void 0){let n=e.capturedIssues>0&&e.categories.some(e=>e.failure);t.push({label:`Issues`,value:e.capturedIssues.toLocaleString(`en-US`),failure:n})}if(e.inputTokens!==void 0||e.outputTokens!==void 0){let n=e=>e===void 0?`?`:K(e);t.push({label:`Tokens in / out`,value:`${n(e.inputTokens)} / ${n(e.outputTokens)}`,failure:!1})}return e.tokenCoveragePercent!==void 0&&t.push({label:`Token coverage`,value:`${String(e.tokenCoveragePercent)}%`,failure:!1}),t}function He(e){let t=[e.captureCompleteness?`Capture completeness: ${q(e.captureCompleteness)}.`:void 0,e.limitations].filter(e=>e!==void 0);return t.length>0?t.join(` `):void 0}function Ue(e){return e.limitations?.match(Ie)?.[0].trim()??`Empty data is not proof of a healthy run.`}var J=`Captured agent evidence`;function We({toolName:e,output:n,running:r,isError:i}){let o=S({running:r,isError:i}),s=r||i?null:ze(n);if(s)return T(Ge,{toolName:e,tone:o,report:s});let l=Pe(n);if(i)return E(t,{tone:o,children:[T(d,{title:e,children:T(`span`,{className:`min-w-0 truncate text-po-faint`,children:J})}),l.length>0?T(D,{children:T(`p`,{className:`whitespace-pre-wrap break-words text-po-red`,children:l.join(`
3
+ `)})}):null]});let u=l.map(e=>({text:e,tone:`text`}));return T(t,{tone:o,expandable:u.length>12,children:({expanded:t})=>{let n=g(u,12,t);return E(_,{children:[T(d,{title:e,children:T(`span`,{className:`min-w-0 truncate text-po-faint`,children:J})}),n.shown.length>0||r?E(D,{children:[T(c,{lines:n.shown}),n.hidden>0?E(a,{expands:!0,children:[n.hidden,` more lines`]}):null,r?T(a,{tone:`running`,children:`Reading session telemetry`}):null]}):null]})}})}function Ge({toolName:e,tone:n,report:r}){let i=Be(r),a=Ve(r),o=He(r),c=r.evidence===`empty`,u=r.evidence===`unavailable`,f=Ue(r),p=c&&o===f?void 0:o,m=c||u?p!==void 0:r.categories.length>0||r.tools.length>0||o!==void 0;return T(t,{tone:u?`neutral`:n,expandable:m,children:({expanded:t})=>E(_,{children:[E(d,{title:e,children:[T(`span`,{className:`max-w-[60%] shrink-0 truncate text-po-text`,children:i.primary}),i.context?E(`span`,{className:`min-w-0 truncate text-po-faint`,children:[`· `,i.context]}):null]}),E(D,{className:`flex flex-col gap-4`,children:[u?E(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T(`span`,{className:`text-po-dim`,children:`The session's telemetry could not be read.`}),r.code?T(l,{size:`xs`,className:`font-mono`,children:r.code}):null]}):c?E(`div`,{className:`flex flex-col gap-1`,children:[T(`p`,{className:`text-po-text`,children:`No records were captured in this window.`}),T(`p`,{className:`text-sm text-po-dim`,children:f})]}):a.length>0?T(`dl`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:a.map(e=>E(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[T(`dt`,{className:`truncate text-sm text-po-dim`,children:e.label}),T(`dd`,{className:e.failure?`truncate text-lg font-semibold tabular-nums text-po-red`:`truncate text-lg font-semibold tabular-nums text-po-hi`,children:e.value})]},e.label))}):null,t&&!c&&!u&&r.categories.length>0?E(`section`,{className:`flex flex-col gap-2`,children:[T(s,{children:`Issues by category`}),T(`div`,{className:`flex flex-wrap gap-2`,children:r.categories.map(e=>E(re,{tone:e.failure?`red`:`neutral`,children:[T(`span`,{children:e.label}),T(`span`,{className:`font-semibold tabular-nums`,children:e.count})]},e.key))})]}):null,t&&!c&&!u&&r.tools.length>0?E(`section`,{className:`flex flex-col gap-2`,children:[T(s,{children:`Tools`}),E(`table`,{className:`w-full text-base`,children:[T(`thead`,{children:E(`tr`,{className:`text-sm text-po-dim`,children:[T(`th`,{className:`w-full pb-1 text-left font-normal`,children:`Name`}),T(`th`,{className:`whitespace-nowrap pb-1 pl-4 text-right font-normal`,children:`Calls`}),T(`th`,{className:`whitespace-nowrap pb-1 pl-4 text-right font-normal`,children:`p90 turn tokens`})]})}),T(`tbody`,{children:r.tools.map(e=>E(`tr`,{className:`border-t border-po-border-soft`,children:[T(`td`,{className:`max-w-0 truncate py-1 font-mono text-po-text`,children:e.name}),T(`td`,{className:`whitespace-nowrap py-1 pl-4 text-right tabular-nums text-po-text`,children:e.invocations===void 0?`?`:e.invocations.toLocaleString(`en-US`)}),T(`td`,{className:`whitespace-nowrap py-1 pl-4 text-right tabular-nums text-po-text`,children:e.p90TurnTokens===void 0?`?`:K(e.p90TurnTokens)})]},e.name))})]}),r.limitReached?E(`p`,{className:`text-sm text-po-dim`,children:[`Showing the first `,r.tools.length,` tools.`]}):null]}):null,t&&p?T(`p`,{className:`text-sm text-po-faint`,children:p}):null]})]})})}var Ke=O({tools:[`diagnose_agent`],message:We}),qe=[`logsink_status`,`logsink_search`,`logsink_agent_issues`,`logsink_trace`,`logsink_stats`,`logsink_services`,`logsink_metrics`];function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function X(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Z(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=100}function Q(e){return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}T/.test(e)&&Number.isFinite(Date.parse(e))}function Je(e){let t=Y(e);if(!(!t||t.kind!==`session`&&t.kind!==`history`)&&(t.sessionId===void 0||typeof t.sessionId==`string`)&&(t.startTime===void 0||Q(t.startTime))&&(t.endTime===void 0||Q(t.endTime))&&(t.kind!==`history`||Q(t.startTime)&&Q(t.endTime))&&!(Q(t.startTime)&&Q(t.endTime)&&Date.parse(t.startTime)>Date.parse(t.endTime)))return[t.kind===`session`?`This session`:`History`,t.startTime,t.endTime,t.kind===`history`?t.sessionId:void 0].filter(Boolean).join(` · `)}function Ye(e){return qe.some(t=>t===e)}function Xe({toolName:e,args:t,result:n,output:r,running:i,isError:a}){let o=n?.details;if(o==null)try{o=JSON.parse(r)}catch{o=void 0}let s=Y(o),c=Je(s?.scope),l=t.scope===`history`?[`Requested history`,t.startTime,t.endTime,t.sessionId].filter(e=>typeof e==`string`).join(` · `):`This session`,u=o===void 0?r:JSON.stringify(o,null,2),d={scope:c??l,evidence:u};if(i)return{...d,scope:l,state:`running`,heading:`Reading captured agent evidence`,note:`Only retained records are inspected.`};if(a)return{...d,state:`query-error`,heading:`Log query could not be completed.`,note:`No collector changes were made.`};let f={...d,state:`unavailable`,heading:`Log summary is unavailable.`,note:`Inspect the retained evidence for details.`},p=Y(s?.data);if(!c||!p)return f;let m={...d,state:`populated`,heading:``},h={...d,state:`empty`,heading:`No captured records in this window.`,note:`This does not establish that the run was healthy.`};switch(e){case`logsink_status`:return p.available===!1&&p.reason===`missing-database`?{...d,state:`missing`,heading:`No retained log database is available.`,note:`No collector changes were made.`}:p.available===!0?{...m,heading:`Retained log database is available.`,note:`This does not establish that the collector is capturing now.`}:f;case`logsink_search`:return!X(p.count)||!X(p.total)||typeof p.truncated!=`boolean`||!Array.isArray(p.results)?f:{...p.total===0?h:m,heading:p.total===0?h.heading:`Captured log records`,summary:`${p.count} returned · ${p.total} records`,note:p.truncated?`Results are truncated.`:p.total===0?h.note:void 0};case`logsink_agent_issues`:{if(!X(p.matchingLogs)||!X(p.uniqueIncidents)||!X(p.scanned)||!Z(p.coveragePercent)||typeof p.truncated!=`boolean`||!Array.isArray(p.issues))return f;let e=Y(p.byTool);return!e||!Object.values(e).every(X)?f:{...p.matchingLogs===0?h:m,heading:p.matchingLogs===0?`No captured agent issues in this window.`:`Captured agent issues`,summary:`${p.matchingLogs} records · ${p.uniqueIncidents} incidents`,coverage:`Coverage ${p.coveragePercent}% · ${p.scanned} scanned${p.truncated?` · Scan truncated`:``}`,tools:Object.entries(e).map(([e,t])=>({name:e,count:t})),note:p.matchingLogs===0?h.note:`Repeated events may describe one incident.`}}case`logsink_trace`:return!X(p.count)||typeof p.truncated!=`boolean`||!Array.isArray(p.timeline)?f:{...p.count===0?h:m,heading:p.count===0?h.heading:`Captured trace timeline`,summary:`${p.count} entries`,note:p.truncated?`Timeline is truncated.`:p.count===0?h.note:void 0};case`logsink_stats`:return!X(p.totalEntries)||!Array.isArray(p.statistics)||!p.statistics.every(e=>{let t=Y(e);return X(t?.count)&&typeof t?.service==`string`&&typeof t?.level==`string`})?f:{...p.totalEntries===0?h:m,heading:p.totalEntries===0?h.heading:`Retained entry statistics`,summary:`${p.totalEntries} entries · ${p.statistics.length} group${p.statistics.length===1?``:`s`}`,tools:p.statistics.map(e=>{let t=e;return{name:[t.service,t.level].filter(Boolean).join(` · `),count:t.count}})};case`logsink_services`:return!X(p.count)||typeof p.truncated!=`boolean`||!Array.isArray(p.services)||!p.services.every(e=>typeof e==`string`)?f:{...p.count===0?h:m,heading:p.count===0?h.heading:`Services with retained records`,summary:`${p.count} service${p.count===1?``:`s`}`,note:p.truncated?`Service list is truncated.`:p.count===0?h.note:void 0};case`logsink_metrics`:{let e=Y(p.totals);return!e||!X(e.totalRecords)||!X(e.totalTokens)||!X(e.issueCount)||!Z(e.tokenCoveragePercent)?f:{...e.totalRecords===0?h:m,heading:e.totalRecords===0?h.heading:`Captured usage and issues`,summary:`${e.totalRecords} records · ${e.totalTokens} tokens · ${e.issueCount} issues`,coverage:`Token coverage ${e.tokenCoveragePercent}%`,note:`${e.totalRecords===0?`${h.note} `:``}Tool turn costs are not exclusive per-tool token shares.`}}default:return f}}function Ze({toolName:e,running:n,isError:r,fixture:i,defaultExpanded:o=!1}){let s=i.state===`missing`,l=i.state===`unavailable`,u=i.evidence.split(`
4
+ `).map(e=>({text:e,tone:`text`}));return T(t,{tone:s||l?`neutral`:S({running:n,isError:r}),expandable:i.evidence.length>0,defaultExpanded:o,children:({expanded:t})=>E(_,{children:[T(d,{title:e,badge:r?`Query failed`:s?`No data`:void 0,children:T(`span`,{className:`truncate text-po-dim max-sm:hidden`,children:i.scope})}),E(D,{className:`flex flex-col gap-3`,children:[T(`p`,{className:`break-words text-sm text-po-dim sm:hidden`,children:i.scope}),E(`div`,{className:`flex flex-col gap-1`,children:[T(`p`,{className:`text-base font-semibold text-po-hi`,children:i.heading}),i.summary?T(`p`,{className:`text-base text-po-text`,children:i.summary}):null,i.coverage?T(`p`,{className:`text-sm text-po-dim`,children:i.coverage}):null]}),i.tools?T(`div`,{className:`flex flex-col gap-2 border-t border-po-border-soft pt-3`,children:i.tools.map(e=>E(`p`,{className:`flex flex-wrap items-center gap-4 text-base`,children:[T(`span`,{className:`font-mono text-po-text`,children:e.name}),E(`span`,{className:`text-po-dim`,children:[e.count,` occurrences`]})]},e.name))}):null,i.note?T(`p`,{className:`text-sm text-po-dim`,children:i.note}):null,n?T(a,{tone:`running`,children:`Reading telemetry`}):null,i.evidence?E(`div`,{className:`flex flex-col gap-3 border-t border-po-border-soft pt-3`,children:[T(a,{expands:!0,glyph:t?`⌄`:`›`,className:`text-sm text-po-dim`,children:t?`Hide evidence`:`Show evidence`}),t?T(c,{lines:u}):null]}):null]})]})})}function Qe(e){return T(Ze,{...e,fixture:Xe(e)})}var $e=O({tools:[`logsink_status`,`logsink_search`,`logsink_agent_issues`,`logsink_trace`,`logsink_stats`,`logsink_services`,`logsink_metrics`],matches:Ye,message:Qe}),$=(e,t)=>t===void 0?void 0:{...e,...t},et=r({id:`log`,global:{get settingsPanels(){return[$({id:`metrics`},Ne)]}},session:{get toolRenderers(){return[$({tools:[`diagnose_agent`]},Ke),$({tools:[`logsink`]},$e)]}}});export{et as webPlugin};