orc-ai 0.1.52 → 0.1.53

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 (161) hide show
  1. package/dist/index.js +477 -477
  2. package/dist/web/assets/{Agents-DLu7phP7.js → Agents-D71JHI2H.js} +2 -2
  3. package/dist/web/assets/Attention-C_LKxdwf.js +2 -0
  4. package/dist/web/assets/{Audit-nUBNwvkU.js → Audit-BWh52YwS.js} +1 -1
  5. package/dist/web/assets/{ConfirmDialog-BGZ6sd6E.js → ConfirmDialog-D25Wf6Nc.js} +1 -1
  6. package/dist/web/assets/{Dashboard-Bhsm-LF4.js → Dashboard-DmYJjKna.js} +1 -1
  7. package/dist/web/assets/{DocumentWorkspace-C1HAVy0v.js → DocumentWorkspace-CW6S2i4-.js} +1 -1
  8. package/dist/web/assets/{ErrorState-B0KI2D4y.js → ErrorState-BoQqdsym.js} +1 -1
  9. package/dist/web/assets/FileEditor-_z3t0Dbd.js +1 -0
  10. package/dist/web/assets/JobWebhooks-Z4MXZNvH.js +1 -0
  11. package/dist/web/assets/Jobs-B-7i16mV.js +1 -0
  12. package/dist/web/assets/Knowledge-DX3nwzng.js +1 -0
  13. package/dist/web/assets/Markdown-BYChkZ3Z.js +2 -0
  14. package/dist/web/assets/{MarkdownEditor-BM9COcIb.js → MarkdownEditor-BMQq1cAY.js} +2 -2
  15. package/dist/web/assets/{MarkdownRenderer-C3UcCxdl.js → MarkdownRenderer-B5esWp7J.js} +96 -96
  16. package/dist/web/assets/PackageCatalog-CYF3tX8J.js +8 -0
  17. package/dist/web/assets/{PackageRunDialog-D3kvHk8o.js → PackageRunDialog-DxUs3Qnc.js} +2 -2
  18. package/dist/web/assets/{Pager-CMsNCI1_.js → Pager-DQCWHQWA.js} +1 -1
  19. package/dist/web/assets/PriorityBadge-ADp-pD5B.js +1 -0
  20. package/dist/web/assets/{Projects-BmfdCEv3.js → Projects-C2Ei5Q8Q.js} +2 -2
  21. package/dist/web/assets/QueryClientProvider-DlPztvhd.js +1 -0
  22. package/dist/web/assets/{RemoteFolderBrowser-ClOOMU0_.js → RemoteFolderBrowser-Btryj6gG.js} +1 -1
  23. package/dist/web/assets/{ResumeActions-gVze1Xjw.js → ResumeActions-1gJa3nsX.js} +1 -1
  24. package/dist/web/assets/{Rules-BMqF79Mt.js → Rules-CZvA-Eis.js} +4 -4
  25. package/dist/web/assets/ScratchpadDiagramEditor-D44NiVP_.js +159 -0
  26. package/dist/web/assets/Scratchpads-DP_v2hc8.js +10 -0
  27. package/dist/web/assets/Sessions-Ctd49sC9.js +3 -0
  28. package/dist/web/assets/{Settings-Dh7H43-p.js → Settings-BmbdT6Mp.js} +5 -5
  29. package/dist/web/assets/Skills-C_bBvy92.js +8 -0
  30. package/dist/web/assets/{SourceEditor-DlC3qNcT.js → SourceEditor-B5CtJBt0.js} +1 -1
  31. package/dist/web/assets/StatusBadge-CTFDUHuw.js +1 -0
  32. package/dist/web/assets/TagInput-T6rDuQ7O.js +1 -0
  33. package/dist/web/assets/TaskDetailSheet-BiIQ82AG.js +1 -0
  34. package/dist/web/assets/Tasks-OQmOaNqh.js +24 -0
  35. package/dist/web/assets/Terminals-DVu5OtGU.js +3 -0
  36. package/dist/web/assets/{ViewHeader-CX02p2eb.js → ViewHeader-DHM9SSkD.js} +1 -1
  37. package/dist/web/assets/{Webhooks-DUB9var7.js → Webhooks-CDNv5fUD.js} +1 -1
  38. package/dist/web/assets/{ar-SA-G6X2FPQ2-Br_n6QDe.js → ar-SA-G6X2FPQ2-9uLW-Aib.js} +1 -1
  39. package/dist/web/assets/{az-AZ-76LH7QW2-QyHk3dvA.js → az-AZ-76LH7QW2-DOqqo97y.js} +1 -1
  40. package/dist/web/assets/{bg-BG-XCXSNQG7-C6nlcNp_.js → bg-BG-XCXSNQG7-BHUaosi9.js} +1 -1
  41. package/dist/web/assets/{bn-BD-2XOGV67Q-4ptCYf5W.js → bn-BD-2XOGV67Q-_-LDSkWx.js} +1 -1
  42. package/dist/web/assets/button-BHKbOsmj.js +1 -0
  43. package/dist/web/assets/{ca-ES-6MX7JW3Y-Cgoa8y8g.js → ca-ES-6MX7JW3Y-D00wQc68.js} +1 -1
  44. package/dist/web/assets/{chunk-EIO257PC-D5rz2EHY.js → chunk-EIO257PC-BfeJ3EDs.js} +1 -1
  45. package/dist/web/assets/{client-BEiLQQ-F.js → client-BwhkVepQ.js} +1 -1
  46. package/dist/web/assets/{cs-CZ-2BRQDIVT-TiBX7ffm.js → cs-CZ-2BRQDIVT-EB-m3ztC.js} +1 -1
  47. package/dist/web/assets/{da-DK-5WZEPLOC-qeFhKopb.js → da-DK-5WZEPLOC-DWYR6cGM.js} +1 -1
  48. package/dist/web/assets/{de-DE-XR44H4JA-m_mVoRik.js → de-DE-XR44H4JA-Ck6sMUnJ.js} +1 -1
  49. package/dist/web/assets/{dist-EENe35AZ.js → dist-B9K53eWS.js} +1 -1
  50. package/dist/web/assets/{dist-BqZPrSfD.js → dist-ClOxCp9t.js} +1 -1
  51. package/dist/web/assets/{dist-C5yPNRzG.js → dist-D3PXSw6Q.js} +1 -1
  52. package/dist/web/assets/{dist-DcKneJwp.js → dist-HH469UWY.js} +1 -1
  53. package/dist/web/assets/{el-GR-BZB4AONW-BkZEWwVO.js → el-GR-BZB4AONW-DTkIqoGp.js} +1 -1
  54. package/dist/web/assets/{en-B4ZKOASM-DZ61I4Io.js → en-B4ZKOASM-Boq12EIA.js} +1 -1
  55. package/dist/web/assets/{es-ES-U4NZUMDT-N6PHqPGp.js → es-ES-U4NZUMDT-DY7ipP7c.js} +1 -1
  56. package/dist/web/assets/{eu-ES-A7QVB2H4-B0v57KpC.js → eu-ES-A7QVB2H4-D4Y6LEUc.js} +1 -1
  57. package/dist/web/assets/{fa-IR-HGAKTJCU-DRM3hyQI.js → fa-IR-HGAKTJCU-BlO1bnpc.js} +1 -1
  58. package/dist/web/assets/{fi-FI-Z5N7JZ37-BBhjlkHm.js → fi-FI-Z5N7JZ37-CQlPsyFJ.js} +1 -1
  59. package/dist/web/assets/{fr-FR-RHASNOE6-C6Ekm99g.js → fr-FR-RHASNOE6-DsyF_chP.js} +1 -1
  60. package/dist/web/assets/{gl-ES-HMX3MZ6V-BVrGslVP.js → gl-ES-HMX3MZ6V-BGAJPW2y.js} +1 -1
  61. package/dist/web/assets/{he-IL-6SHJWFNN-GiN2vY9l.js → he-IL-6SHJWFNN-BCFUF5Bi.js} +1 -1
  62. package/dist/web/assets/{hi-IN-IWLTKZ5I-tPRQ0szT.js → hi-IN-IWLTKZ5I-CWKeCfbn.js} +1 -1
  63. package/dist/web/assets/{highlighted-body-JLMTFACH-R4J_nfqS.js → highlighted-body-JLMTFACH-CYOy6uZ1.js} +1 -1
  64. package/dist/web/assets/{hu-HU-A5ZG7DT2-CkV1DDWQ.js → hu-HU-A5ZG7DT2-fqogn_m9.js} +1 -1
  65. package/dist/web/assets/{id-ID-SAP4L64H-DpzooQVd.js → id-ID-SAP4L64H-XFT4nLO5.js} +1 -1
  66. package/dist/web/assets/{image-GAAHSSAO-D7XRYD-a.js → image-GAAHSSAO-CtqEtsMw.js} +1 -1
  67. package/dist/web/assets/index-BCGI8JzG.css +1 -0
  68. package/dist/web/assets/{index-Ck-SDgTR.js → index-CMRGRbC9.js} +27 -28
  69. package/dist/web/assets/{it-IT-JPQ66NNP-C6oBozob.js → it-IT-JPQ66NNP-CjvUp5j1.js} +1 -1
  70. package/dist/web/assets/{ja-JP-DBVTYXUO-BG7OaLPP.js → ja-JP-DBVTYXUO-WaxwOOp1.js} +1 -1
  71. package/dist/web/assets/{kaa-6HZHGXH3-oYKKAQ51.js → kaa-6HZHGXH3-BABl6rMV.js} +1 -1
  72. package/dist/web/assets/{kab-KAB-ZGHBKWFO-B7LjxWHx.js → kab-KAB-ZGHBKWFO-vrrKDhKa.js} +1 -1
  73. package/dist/web/assets/{kk-KZ-P5N5QNE5-BjKAAAQx.js → kk-KZ-P5N5QNE5-DV0HT-Fa.js} +1 -1
  74. package/dist/web/assets/{km-KH-HSX4SM5Z-CP5JVtE5.js → km-KH-HSX4SM5Z-CMzRvYB5.js} +1 -1
  75. package/dist/web/assets/{ko-KR-MTYHY66A-skmsixpS.js → ko-KR-MTYHY66A-7XqecPXy.js} +1 -1
  76. package/dist/web/assets/{ku-TR-6OUDTVRD-BQGbWbVU.js → ku-TR-6OUDTVRD-D8O0bwyA.js} +1 -1
  77. package/dist/web/assets/label-BQ1Lr4sA.js +1 -0
  78. package/dist/web/assets/{lt-LT-XHIRWOB4-jPcUmdv0.js → lt-LT-XHIRWOB4-DrK90jMT.js} +1 -1
  79. package/dist/web/assets/{lv-LV-5QDEKY6T-BJimFBjM.js → lv-LV-5QDEKY6T-D7Xl2RRC.js} +1 -1
  80. package/dist/web/assets/mermaid-WFAXDIZX-CiFtUZlz.js +1 -0
  81. package/dist/web/assets/{mr-IN-CRQNXWMA-BJCZe-ef.js → mr-IN-CRQNXWMA-CjH1Q3x7.js} +1 -1
  82. package/dist/web/assets/{my-MM-5M5IBNSE-CzqI7mKR.js → my-MM-5M5IBNSE-CvdwmXcF.js} +1 -1
  83. package/dist/web/assets/{nb-NO-T6EIAALU-DOipNzcK.js → nb-NO-T6EIAALU-BWMKi1Br.js} +1 -1
  84. package/dist/web/assets/{nl-NL-IS3SIHDZ-m_uDUlnM.js → nl-NL-IS3SIHDZ-D5A6sC_f.js} +1 -1
  85. package/dist/web/assets/{nn-NO-6E72VCQL-ChLlN8eQ.js → nn-NO-6E72VCQL-D-p6QrsB.js} +1 -1
  86. package/dist/web/assets/{oc-FR-POXYY2M6-BJLoLhGq.js → oc-FR-POXYY2M6-6fyqLMv5.js} +1 -1
  87. package/dist/web/assets/{pa-IN-N4M65BXN-uYfxnmgm.js → pa-IN-N4M65BXN-D99Vs_Tb.js} +1 -1
  88. package/dist/web/assets/{percentages-BXMCSKIN--kwJevql.js → percentages-BXMCSKIN-B0BZzQvB.js} +1 -1
  89. package/dist/web/assets/{pl-PL-T2D74RX3-CDCLDsvJ.js → pl-PL-T2D74RX3-cl5WZaGT.js} +1 -1
  90. package/dist/web/assets/{pt-BR-5N22H2LF-CIrdrTZX.js → pt-BR-5N22H2LF-T6l12jm6.js} +1 -1
  91. package/dist/web/assets/{pt-PT-UZXXM6DQ-4Aps73mI.js → pt-PT-UZXXM6DQ-DnxUMvhO.js} +1 -1
  92. package/dist/web/assets/{ro-RO-JPDTUUEW-fgJWBuSP.js → ro-RO-JPDTUUEW-w6wCZHtR.js} +1 -1
  93. package/dist/web/assets/{ru-RU-B4JR7IUQ-D98t4_hW.js → ru-RU-B4JR7IUQ-DMaA4CQ-.js} +1 -1
  94. package/dist/web/assets/scratchpad-routes-B75DnNPp.js +1 -0
  95. package/dist/web/assets/scroll-area-DMjOmHf5.js +1 -0
  96. package/dist/web/assets/select-CBHDS40x.js +1 -0
  97. package/dist/web/assets/{si-LK-N5RQ5JYF-DNwP7Qip.js → si-LK-N5RQ5JYF-Coe9-5Yb.js} +1 -1
  98. package/dist/web/assets/{sk-SK-C5VTKIMK-BfncC8rh.js → sk-SK-C5VTKIMK-Bq23BXvP.js} +1 -1
  99. package/dist/web/assets/{sl-SI-NN7IZMDC-IXH265Xx.js → sl-SI-NN7IZMDC-WZEKy1qu.js} +1 -1
  100. package/dist/web/assets/subset-shared.chunk-CAD0Eg6H.js +1 -0
  101. package/dist/web/assets/{subset-worker.chunk-BNdMWEQD.js → subset-worker.chunk-CAbfOFrS.js} +1 -1
  102. package/dist/web/assets/{sv-SE-XGPEYMSR-CWjE7XZA.js → sv-SE-XGPEYMSR-p1gc_GrE.js} +1 -1
  103. package/dist/web/assets/{ta-IN-2NMHFXQM-mzDgApaO.js → ta-IN-2NMHFXQM-o8J0vNj1.js} +1 -1
  104. package/dist/web/assets/table-ByS-sgsb.js +1 -0
  105. package/dist/web/assets/tabs-DltQVo38.js +1 -0
  106. package/dist/web/assets/{th-TH-HPSO5L25-sCRbUk4w.js → th-TH-HPSO5L25-pt7Zt9xm.js} +1 -1
  107. package/dist/web/assets/{tr-TR-DEFEU3FU-BJVVhuUn.js → tr-TR-DEFEU3FU-BENdvVvp.js} +1 -1
  108. package/dist/web/assets/{uk-UA-QMV73CPH-CoaqtD6Z.js → uk-UA-QMV73CPH-CenI2hX1.js} +1 -1
  109. package/dist/web/assets/useDetailRoute-C8xQeILG.js +1 -0
  110. package/dist/web/assets/useJobs-CCQUWZt3.js +1 -0
  111. package/dist/web/assets/useKnowledge-DbjT1a0E.js +1 -0
  112. package/dist/web/assets/{useListSelection-DcULI867.js → useListSelection-CgpNqqAb.js} +1 -1
  113. package/dist/web/assets/useMemories-D0tEN20z.js +1 -0
  114. package/dist/web/assets/useMutation-HX90wI4L.js +1 -0
  115. package/dist/web/assets/useProjectScope-CZEfU9mq.js +1 -0
  116. package/dist/web/assets/useSessions-C2GU4FkG.js +1 -0
  117. package/dist/web/assets/{vi-VN-M7AON7JQ-C_1RRSxn.js → vi-VN-M7AON7JQ-REgvRLzg.js} +1 -1
  118. package/dist/web/assets/{view-params-DNioxw0G.js → view-params-BqRwdnv0.js} +1 -1
  119. package/dist/web/assets/{x-CtXhMM9g.js → x-BKorzD7S.js} +1 -1
  120. package/dist/web/assets/{zh-CN-LNUGB5OW-BRsIz_fP.js → zh-CN-LNUGB5OW-Ceo4z5r5.js} +1 -1
  121. package/dist/web/assets/{zh-HK-E62DVLB3-DwjC6Cwv.js → zh-HK-E62DVLB3-CFQOn9E1.js} +1 -1
  122. package/dist/web/assets/{zh-TW-RAJ6MFWO-DrD43hHv.js → zh-TW-RAJ6MFWO-GpxYPogk.js} +1 -1
  123. package/dist/web/index.html +16 -16
  124. package/package.json +1 -1
  125. package/dist/web/assets/Attention-D80Q2fL4.js +0 -2
  126. package/dist/web/assets/FileEditor-B1pLaZil.js +0 -1
  127. package/dist/web/assets/JobWebhooks-DIfKugwY.js +0 -1
  128. package/dist/web/assets/Jobs-0VP8O03Z.js +0 -1
  129. package/dist/web/assets/Knowledge-DCsSHLqC.js +0 -1
  130. package/dist/web/assets/Markdown-CenDHcGi.js +0 -2
  131. package/dist/web/assets/PackageCatalog-oQ9U4WEt.js +0 -8
  132. package/dist/web/assets/PriorityBadge-_KMVnMst.js +0 -1
  133. package/dist/web/assets/ScratchpadDiagramEditor-BtuYQvFc.js +0 -159
  134. package/dist/web/assets/Scratchpads-D98SMUv3.js +0 -10
  135. package/dist/web/assets/Sessions-CLDdpR36.js +0 -3
  136. package/dist/web/assets/Skills-B5OEYsYx.js +0 -8
  137. package/dist/web/assets/StatusBadge-CZQsVLgL.js +0 -1
  138. package/dist/web/assets/TagInput-D7ZsM-Dr.js +0 -1
  139. package/dist/web/assets/TaskDetailSheet-0hZx_-me.js +0 -1
  140. package/dist/web/assets/Tasks-c1HlLJhH.js +0 -24
  141. package/dist/web/assets/Terminals-DQ8HWVlI.js +0 -3
  142. package/dist/web/assets/button-PNx108iL.js +0 -1
  143. package/dist/web/assets/index-Bpb-AzH6.css +0 -1
  144. package/dist/web/assets/label-Ce3QFsX5.js +0 -1
  145. package/dist/web/assets/mermaid-WFAXDIZX-DmWpYePv.js +0 -1
  146. package/dist/web/assets/pencil-BPI6pWhy.js +0 -1
  147. package/dist/web/assets/scratchpad-routes-BwYHUs6J.js +0 -1
  148. package/dist/web/assets/scroll-area-Alw_ieLV.js +0 -1
  149. package/dist/web/assets/select-Cg0xEvji.js +0 -1
  150. package/dist/web/assets/subset-shared.chunk-BJl1UMhd.js +0 -1
  151. package/dist/web/assets/table-DC8IBMHg.js +0 -1
  152. package/dist/web/assets/tabs-DWq5oObc.js +0 -1
  153. package/dist/web/assets/trash-D7o9t0-a.js +0 -1
  154. package/dist/web/assets/useDetailRoute-1i4Z0-d5.js +0 -1
  155. package/dist/web/assets/useJobs-B2MCCWKa.js +0 -1
  156. package/dist/web/assets/useKnowledge-oAVI1FoA.js +0 -1
  157. package/dist/web/assets/useMemories-CcDhzt2Y.js +0 -1
  158. package/dist/web/assets/useMutation-DDLZlpLS.js +0 -1
  159. package/dist/web/assets/useProjectScope-C7yZQa4i.js +0 -1
  160. package/dist/web/assets/useSessions-Bx-Bw75y.js +0 -1
  161. package/dist/web/assets/utils-Q1DAuYRG.js +0 -1
@@ -0,0 +1,8 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{n as i,t as a}from"./useMutation-HX90wI4L.js";import{t as o}from"./button-BHKbOsmj.js";import{t as s}from"./label-BQ1Lr4sA.js";import{t as c}from"./createLucideIcon-jLuHkL03.js";import{t as l}from"./upload-Djrxq3zy.js";import{n as u}from"./client-BwhkVepQ.js";import{t as d}from"./file-kind-BYU1kv95.js";import{An as f,At as p,Dt as m,En as h,Et as g,G as _,K as v,Nt as y,On as b,Tt as x,W as S,X as C,Y as w,ct as T,in as E,kn as D,kt as O,wt as k}from"./index-CMRGRbC9.js";import{t as A}from"./save-file-3ZpJah8W.js";import{a as j,i as M,n as N,r as P,t as F}from"./PackageRunDialog-DxUs3Qnc.js";import{t as ee}from"./ViewHeader-DHM9SSkD.js";import{t as te}from"./useDetailRoute-C8xQeILG.js";import{t as I}from"./view-params-BqRwdnv0.js";import{t as L}from"./primitive-files-BKGHFjYN.js";var R={name:`file-box`,size:24,node:[[`path`,{d:`M14 2v5a1 1 0 001 1h5`,key:`9v5fu7`}],[`path`,{d:`M14.692 22H18a2 2 0 002-2V8a2.4 2.4 0 00-.706-1.706l-3.588-3.588A2.4 2.4 0 0014 2H6a2 2 0 00-2 2v3.804`,key:`1ne0j7`}],[`path`,{d:`M2.264 13.752 7 16.5l4.737-2.748`,key:`t73mg3`}],[`path`,{d:`M2.995 13.014A2 2 0 002 14.744v3.516a2 2 0 00.996 1.73l3 1.74a2 2 0 002.008 0l3-1.74A2 2 0 0012 18.26v-3.517a2 2 0 00-.995-1.73l-3-1.742a2 2 0 00-1.892-.064z`,key:`h4qck`}],[`path`,{d:`M7 16.5V22`,key:`1i1gou`}]]};R.node;var z=c(R),B={name:`package-plus`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};B.node;var ne=c(B),V=Uint8Array,H=Uint16Array,U=Int32Array,W=new V([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),re=new V([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),G=new V([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),K=function(e,t){for(var n=new H(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new U(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},ie=K(W,2),q=ie.b,J=ie.r;q[28]=258,J[258]=28;for(var ae=K(re,0),oe=ae.b,se=ae.r,ce=new H(32768),Y=0;Y<32768;++Y){var le=(Y&43690)>>1|(Y&21845)<<1;le=(le&52428)>>2|(le&13107)<<2,le=(le&61680)>>4|(le&3855)<<4,ce[Y]=((le&65280)>>8|(le&255)<<8)>>1}for(var ue=(function(e,t,n){for(var r=e.length,i=0,a=new H(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new H(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new H(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ce[d]>>c]=l}else for(s=new H(r),i=0;i<r;++i)e[i]&&(s[i]=ce[o[e[i]-1]++]>>15-e[i]);return s}),de=new V(288),Y=0;Y<144;++Y)de[Y]=8;for(var Y=144;Y<256;++Y)de[Y]=9;for(var Y=256;Y<280;++Y)de[Y]=7;for(var Y=280;Y<288;++Y)de[Y]=8;for(var fe=new V(32),Y=0;Y<32;++Y)fe[Y]=5;var pe=ue(de,9,0),me=ue(de,9,1),he=ue(fe,5,0),ge=ue(fe,5,1),_e=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ve=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ye=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},be=function(e){return(e+7)/8|0},xe=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new V(e.subarray(t,n))},Se=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],X=function(e,t,n){var r=Error(t||Se[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,X),!n)throw r;return r},Ce=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new V(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new V(i*3));var l=function(e){var t=n.length;if(e>t){var r=new V(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=ve(e,d,1);var v=ve(e,d+1,3);if(d+=3,!v){var y=be(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&X(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=me,m=ge,h=9,g=5;else if(v==2){var S=ve(e,d,31)+257,C=ve(e,d+10,15)+4,w=S+ve(e,d+5,31)+1;d+=14;for(var T=new V(w),E=new V(19),D=0;D<C;++D)E[G[D]]=ve(e,d+D*3,7);d+=C*3;for(var O=_e(E),k=(1<<O)-1,A=ue(E,O,1),D=0;D<w;){var j=A[ve(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+ve(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+ve(e,d,7),d+=3):y==18&&(N=11+ve(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=_e(P),g=_e(F),p=ue(P,h,1),m=ue(F,g,1)}else X(1);if(d>_){c&&X(0);break}}s&&l(f+131072);for(var ee=(1<<h)-1,te=(1<<g)-1,I=d;;I=d){var M=p[ye(e,d)&ee],L=M>>4;if(d+=M&15,d>_){c&&X(0);break}if(M||X(2),L<256)n[f++]=L;else if(L==256){I=d,p=null;break}else{var R=L-254;if(L>264){var D=L-257,z=W[D];R=ve(e,d,(1<<z)-1)+q[D],d+=z}var B=m[ye(e,d)&te],ne=B>>4;B||X(3),d+=B&15;var F=oe[ne];if(ne>3){var z=re[ne];F+=ye(e,d)&(1<<z)-1,d+=z}if(d>_){c&&X(0);break}s&&l(f+131072);var H=f+R;if(f<F){var U=a-F,K=Math.min(F,H);for(U+f<0&&X(3);f<K;++f)n[f]=r[U+f]}for(;f<H;++f)n[f]=n[f-F]}}t.l=p,t.p=I,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?xe(n,0,f):n.subarray(0,f)},we=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Te=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Ee=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Ne,l:0};if(i==1){var o=new V(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new H(f+1),m=De(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new V(p),l:m}},De=function(e,t,n){return e.s==-1?Math.max(De(e.l,t,n+1),De(e.r,t,n+1)):t[e.s]=n},Oe=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new H(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},ke=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ae=function(e,t,n){var r=n.length,i=be(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},je=function(e,t,n,r,i,a,o,s,c,l,u){we(t,u++,n),++i[256];for(var d=Ee(i,15),f=d.t,p=d.l,m=Ee(a,15),h=m.t,g=m.l,_=Oe(f),v=_.c,y=_.n,b=Oe(h),x=b.c,S=b.n,C=new H(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Ee(C,7),E=T.t,D=T.l,O=19;O>4&&!E[G[O-1]];--O);var k=l+5<<3,A=ke(i,de)+ke(a,fe)+o,j=ke(i,f)+ke(a,h)+o+14+3*O+ke(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Ae(t,u,e.subarray(c,c+l));var M,N,P,F;if(we(t,u,1+(j<A)),u+=2,j<A){M=ue(f,p,0),N=f,P=ue(h,g,0),F=h;var ee=ue(E,D,0);we(t,u,y-257),we(t,u+5,S-1),we(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)we(t,u+3*w,E[G[w]]);u+=3*O;for(var te=[v,x],I=0;I<2;++I)for(var L=te[I],w=0;w<L.length;++w){var R=L[w]&31;we(t,u,ee[R]),u+=E[R],R>15&&(we(t,u,L[w]>>5&127),u+=L[w]>>12)}}else M=pe,N=de,P=he,F=fe;for(var w=0;w<s;++w){var z=r[w];if(z>255){var R=z>>18&31;Te(t,u,M[R+257]),u+=N[R+257],R>7&&(we(t,u,z>>23&31),u+=W[R]);var B=z&31;Te(t,u,P[B]),u+=F[B],B>3&&(Te(t,u,z>>5&8191),u+=re[B])}else Te(t,u,M[z]),u+=N[z]}return Te(t,u,M[256]),u+N[256]},Me=new U([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ne=new V(0),Pe=function(e,t,n,r,i,a){var o=a.z||e.length,s=new V(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Me[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new H(32768),g=a.h||new H(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new U(25e3),x=new H(288),S=new H(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=je(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,ee=p,te=A-j&32767;if(M>2&&k==y(T-te))for(var I=Math.min(f,M)-1,L=Math.min(32767,T),R=Math.min(258,M);te<=L&&--ee&&A!=j;){if(e[T+P]==e[T+P-te]){for(var z=0;z<R&&e[T+z]==e[T+z-te];++z);if(z>P){if(P=z,F=te,z>I)break;for(var B=Math.min(te,z-2),ne=0,N=0;N<B;++N){var G=T-te+N&32767,K=G-h[G]&32767;K>ne&&(ne=K,j=G)}}}A=j,j=h[A],te+=A-j&32767}if(F){b[E++]=268435456|J[P]<<18|se[F];var ie=J[P]&31,q=se[F]&31;w+=W[ie]+re[q],++x[257+ie],++S[q],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=je(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var ae=T+65535;ae>=o&&(c[u/8|0]=l,ae=o),u=Ae(c,u+1,e.subarray(T,ae))}a.i=o}return xe(s,0,r+be(u)+i)},Fe=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),Ie=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Fe[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Le=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new V(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Pe(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Re=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ze=function(e,t){return e[t]|e[t+1]<<8},Be=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Ve=function(e,t){return Be(e,t)+Be(e,t+4)*4294967296},Z=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function He(e,t){return Le(e,t||{},0,0)}function Ue(e,t){return Ce(e,{i:2},t&&t.out,t&&t.dictionary)}var We=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=Re(r,a[1]),a=a[0]),ArrayBuffer.isView(a)?n[o]=[a,s]:(n[o+=`/`]=[new V(0),s],We(a,o,n,r))}},Ge=typeof TextEncoder<`u`&&new TextEncoder,Ke=typeof TextDecoder<`u`&&new TextDecoder;try{Ke.decode(Ne,{stream:!0})}catch{}var qe=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:xe(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function Je(e,t){if(t){for(var n=new V(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Ge)return Ge.encode(e);for(var i=e.length,a=new V(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new V(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return xe(a,0,o)}function Ye(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Ke)return Ke.decode(e);var i=qe(e),a=i.s,n=i.r;return n.length&&X(8),a}var Xe=function(e,t){return t+30+ze(e,t+26)+ze(e,t+28)},Ze=function(e,t,n){var r=ze(e,t+28),i=ze(e,t+30),a=Ye(e.subarray(t+46,t+46+r),!(ze(e,t+8)&2048)),o=t+46+r,s=Qe(e,o,i,n,Be(e,t+20),Be(e,t+24),Be(e,t+42)),c=s[0],l=s[1],u=s[2];return[ze(e,t+10),c,l,a,o+i+ze(e,t+32),u]},Qe=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+ze(e,t+2))if(ze(e,t)==1)return[s?Ve(e,t+4+8*c):i,c?Ve(e,t+4):a,l?Ve(e,t+4+8*(c+s)):o,1];r<2&&X(13)}return[i,a,o,0]},$e=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&X(9),t+=r+4}return t},et=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=$e(l);Z(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&X(10),Z(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Z(e,t,n.crc),Z(e,t+4,a<0?-a-2:a),Z(e,t+8,n.size)),Z(e,t+12,c),Z(e,t+14,d),t+=16,o!=null&&(Z(e,t,u),Z(e,t+6,n.attrs),Z(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Z(e,t,+m),Z(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},tt=function(e,t,n,r,i){Z(e,t,101010256),Z(e,t+8,n),Z(e,t+10,n),Z(e,t+12,r),Z(e,t+16,i)};function nt(e,t){t||={};var n={},r=[];We(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=Je(o),f=d.length,p=l.comment,m=p&&Je(p),h=m&&m.length,g=$e(l.extra);f>65535&&X(11);var _=u?He(c,l):c,v=_.length,y=Ie();y.p(c),r.push(Re(l,{size:c.length,crc:y.d(),c:_,f:d,m,u:f!=o.length||m&&p.length!=h,o:i,compression:u})),i+=30+f+g+v,a+=76+2*(f+g)+(h||0)+v}for(var b=new V(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];et(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+$e(d.extra);b.set(d.c,d.o+w),et(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return tt(b,i,r.length,S,x),b}function rt(e,t){for(var n={},r=e.length-22;Be(e,r)!=101010256;--r)(!r||e.length-r>65558)&&X(13);var i=ze(e,r+8);if(!i)return{};var a=Be(e,r+16),o=Be(e,r-20)==117853008;if(o){var s=Be(e,r-12);o=Be(e,s)==101075792,o&&(i=Be(e,s+32),a=Be(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=Ze(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=Xe(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=Ue(e.subarray(_,_+f),{out:new V(p)}):X(14,`unknown compression type `+d):n[m]=xe(e,_,_+f))}return n}var Q=e(t(),1),$=n();function it({files:e,readOnly:t=!1,onChange:n,testId:r}){let[i,a]=I(t?`packageFile`:`packageDraftFile`,e[0]?.path??``),[o,s]=I(`editorMode`,t?`read`:`edit`,[`read`,`edit`,`split`]),[c,l]=(0,Q.useState)([e[0]?.path??``]),u=e.some(e=>e.path===i)?i:e[0]?.path;return(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-surface-highest`,children:[(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Package files`,className:`flex overflow-x-auto bg-background`,children:e.map(t=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":u===t.path,"data-testid":`package-file`,"data-file-name":t.path,title:t.path,className:`shrink-0 border-r border-surface-highest px-4 py-3 text-sm ${u===t.path?`border-t-2 border-t-transparent bg-surface-highest text-on-surface`:`border-t-2 border-t-transparent text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,onClick:()=>{a(t.path),l(e=>e.includes(t.path)?e:[...e,t.path])},onKeyDown:n=>{let r=e.findIndex(e=>e.path===t.path),i=n.key===`ArrowRight`?r+1:n.key===`ArrowLeft`?r-1:void 0;if(i===void 0)return;n.preventDefault();let a=n.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)?.[(i+e.length)%e.length];a?.focus(),a?.click()},children:t.path.endsWith(`/SKILL.md`)?t.path.split(`/`).slice(-2).join(`/`):t.path.split(`/`).pop()},t.path))}),e.filter(e=>c.includes(e.path)||u===e.path).map(e=>(0,$.jsxs)(`div`,{role:`tabpanel`,"aria-label":e.path,hidden:u!==e.path,className:`[&_[data-testid=code-editor]>div>span[title]]:hidden [&_[data-testid=markdown-editor]>div>span[title]]:hidden`,children:[(0,$.jsx)(T,{mode:d(e.path)?o:void 0,onModeChange:s,path:e.path,value:e.content,onChange:n?t=>n(e.path,t):void 0,readOnly:t||e.encoding===`base64`,height:420,testId:u===e.path?r:void 0}),e.encoding===`base64`&&(0,$.jsx)(`p`,{className:`px-4 py-2 text-xs text-outline`,children:`Binary asset shown as base64.`})]},e.path))]})}function at({name:e,onClose:t,onUse:n,onEdit:r,onDelete:a,onExport:s,onSource:c,busy:l,operationError:d}){let f=i({queryKey:[`agent-package`,e],queryFn:()=>u.agentPackages.get(e)}),p=i({enabled:!!f.data,queryKey:[`agent-package-files`,e],queryFn:async()=>{let t=f.data;if(!t)return[];let n=await Promise.all(t.files.map(async t=>{let n=await u.agentPackages.get(e,t.name);return{path:t.name,content:n.content,encoding:n.encoding}}));return[{path:t.manifestFile,content:t.content},...n]}}),m=f.data?[{label:`skills`,count:f.data.files.filter(e=>/(^|\/)SKILL\.md$/.test(e.name)).length},{label:`instruction files`,count:f.data.files.filter(e=>e.name.endsWith(`.instructions.md`)).length},{label:`agent definitions`,count:f.data.files.filter(e=>e.name.endsWith(`.agent.md`)).length}].filter(e=>e.count>0).map(e=>`${e.count} ${e.label}`).join(` · `):``;return(0,$.jsx)(S,{open:!0,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(v,{defaultWidth:960,resizeKey:`packages`,"data-testid":`package-detail-sheet`,children:[(0,$.jsx)(w,{children:(0,$.jsx)(C,{children:e})}),(0,$.jsxs)(_,{children:[(0,$.jsxs)(`div`,{className:`mb-5 space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-outline wrap-break-word`,children:f.data?.description}),f.data&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[f.data.format===`apm`?`APM package`:`Agent Plugin`,m?` · ${m}`:``,f.data.files.some(e=>e.name===`mcp.json`)?` · MCP tools`:``]}),f.data?.warnings.map(e=>(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive wrap-break-word`,children:e},e)),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-outline-variant pb-3`,"data-testid":`package-actions`,children:[n&&(0,$.jsx)(o,{size:`sm`,"data-testid":`package-detail-run`,onClick:n,disabled:l,children:`Use package`}),r&&(0,$.jsx)(o,{size:`sm`,"data-testid":`package-edit`,variant:`ghost`,onClick:r,disabled:l,children:`Edit`}),a&&(0,$.jsx)(o,{size:`sm`,variant:`ghost`,className:`text-destructive`,"data-testid":`package-detail-delete`,onClick:a,disabled:l,children:`Delete package`}),s&&(0,$.jsx)(o,{size:`sm`,"data-testid":`package-export-artifact`,variant:`ghost`,onClick:s,disabled:l,children:l?`Preparing…`:`Installation export`}),c&&(0,$.jsx)(o,{size:`sm`,"data-testid":`package-export`,variant:`ghost`,onClick:c,disabled:l,children:`Source ZIP`})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`About exports`}),(0,$.jsxs)(`p`,{className:`mt-2`,children:[`APM builds installation exports (`,f.data?.format===`agent-plugin`?`portable Agent Plugin`:`Claude plugin`,`). Download source preserves the editable manifest and all files.`]})]}),d&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:d})]}),f.error||p.error?(0,$.jsx)(`p`,{role:`alert`,children:(f.error??p.error)?.message}):p.isLoading?(0,$.jsx)(`p`,{children:`Loading files…`}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-medium`,children:`Package files`}),(0,$.jsx)(it,{files:p.data??[],readOnly:!0,testId:`package-file-content`})]})]})]})})}var ot=`https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`;function st(e){return e===`apm`?`name: my-agent-package
2
+ version: '1.0.0'
3
+ description: Describe when to use this configuration
4
+ dependencies: {}
5
+ `:JSON.stringify({$schema:ot,name:`my-agent-package`,version:`1.0.0`,description:`Describe when to use this configuration`},null,2)}function ct(e,t){let n=t===`apm`?N(e):null;if(n?.errors.length)throw Error(n.errors[0]?.message);let r=n?n.toJS():JSON.parse(e);if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Manifest must be an object`);return r}function lt(e,t,n,r){if(t===`agent-plugin`)return JSON.stringify({...ct(e,t),[n]:r},null,2);let i=N(e);if(i.errors.length)throw Error(`Fix the manifest before switching to fields`);return i.set(n,r),i.toString()}function ut(e,t,n){return e.some(e=>e.path===t)?e.map(e=>e.path===t?{...e,content:n,encoding:`utf8`}:e):[...e,{path:t,content:n,encoding:`utf8`}]}function dt(e,t){return`${e?.match(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n)?/)?.[0]??`---
6
+ description: Shared package instructions
7
+ ---
8
+ `}${t}`}function ft(e,t){let n=N(t);if(n.errors.length)throw Error(`Fix the MCP YAML before saving`);let r=n.toJS();if(!Array.isArray(r))throw Error(`MCP declarations must be a YAML list (use [] for none)`);let i=N(e);if(i.errors.length)throw Error(`Fix apm.yml before editing MCP declarations`);i.setIn([`dependencies`,`mcp`],r);let a=i.get(`dependencies`,!0);M(a)&&(a.flow=!1);let o=i.getIn([`dependencies`,`mcp`],!0);if(j(o)){o.flow=!1;for(let e of o.items)M(e)&&(e.flow=!1)}return i.toString()}function pt(e,t){let n=ct(e,t);if(typeof n.name!=`string`||!/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/.test(n.name)||n.name.length>64)throw Error(`Use a lowercase package name with single hyphens or periods (up to 64 characters)`);if(t===`apm`&&(!n.version||typeof n.version!=`string`))throw Error(`APM packages require a version`);if(t===`agent-plugin`&&n.$schema!==`https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`)throw Error(`Use the Agent Plugins v1 schema`);return n}var mt=new Map;typeof window<`u`&&window.addEventListener(`beforeunload`,e=>{mt.size&&(e.preventDefault(),e.returnValue=``)});function ht(e){mt.delete(e)}function gt(e){return mt.get(e)?.baseline}function _t(e){return mt.has(e)?window.confirm(`Discard unsaved package changes?`)?(ht(e),!0):!1:!0}var vt=`.apm/instructions/general.instructions.md`;function yt({initial:e,pending:t,error:n,onSave:r}){let[a,c]=I(`packageFormat`,``,[``,`apm`,`agent-plugin`]),l=(0,Q.useRef)(mt.get(e?.name??`new`)),d=e?.format??(a||void 0),f=d,[h,_]=(0,Q.useState)(l.current?.source??e?.content??st(d??`apm`)),[v,b]=(0,Q.useState)(l.current?.files??e?.files??[]),[x,S]=(0,Q.useState)(l.current?.selectedSkills??[]),[C,w]=(0,Q.useState)(``),[E,D]=I(`packageTab`,e?`files`:`configuration`,[`files`,`configuration`,`skills`]),[A,j]=I(`packageSource`,`fields`,[`fields`,`source`]),M=A===`source`,N=e=>j(e?`source`:`fields`),[F,ee]=(0,Q.useState)(),[te,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(``),[ne,V]=(0,Q.useState)(l.current?.mcpDraft),[H,U]=(0,Q.useState)(),W=i({queryKey:[`package-skill-picker`],queryFn:async()=>{let e=await u.skills.list({limit:500}),t=[...e.skills],n=e.next_offset;for(;n!==null;){let e=await u.skills.list({limit:500,offset:n});t.push(...e.skills),n=e.next_offset}return{...e,skills:t}}}),re=i({queryKey:[`agents`],queryFn:u.agents.list}),G=(0,Q.useMemo)(()=>{try{return{fields:ct(h,f??`apm`),error:void 0}}catch(e){return{fields:void 0,error:e.message}}},[h,f]),K=G.fields,ie=typeof K?.name==`string`?K.name:``,q=t||te,J=v.find(e=>e.path===vt),ae=J?.content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,``)??``,oe=v.find(e=>e.path===`mcp.json`);(0,Q.useEffect)(()=>{h!==(e?.content??st(f??`apm`))||JSON.stringify(v)!==JSON.stringify(e?.files??[])||x.length>0||ne!==void 0?mt.set(e?.name??`new`,{format:f??mt.get(e?.name??`new`)?.format??l.current?.format,source:h,files:v,selectedSkills:x,mcpDraft:ne,baseline:l.current?.baseline??e}):mt.delete(e?.name??`new`)},[h,v,x,ne,f,e]);function se(e,t){try{_(lt(h,f??`apm`,e,t)),ee(void 0)}catch(e){ee(e.message)}}function ce(t){let n=mt.get(e?.name??`new`);n&&n.format===t?(c(t),_(n.source),b(n.files),S(n.selectedSkills),V(n.mcpDraft)):(!n||_t(e?.name??`new`))&&(c(t),_(st(t)),b([]),S([]),V(void 0))}return(0,$.jsxs)(g,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-4xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(p,{className:`wrap-break-word pr-8`,children:e?`Edit ${e.name}`:`New package`}),(0,$.jsx)(m,{children:`Save a configuration once, then use it in any project.`})]}),f?(0,$.jsxs)(`form`,{className:`min-w-0 space-y-4`,onSubmit:e=>{if(e.preventDefault(),!H){ee(void 0);try{let e=pt(h,f);f===`agent-plugin`&&oe&&JSON.parse(oe.content),r({name:e.name,content:h,files:v,format:f,skills:x})}catch(e){ee(e.message)}}},children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`rounded bg-surface-high px-3 py-1`,children:f===`apm`?`APM`:`Plugin`}),!e&&(0,$.jsx)(o,{type:`button`,variant:`ghost`,disabled:q,onClick:()=>{_t(`new`)&&(c(``),_(st(`apm`)),b([]),S([]),V(void 0))},children:`Change type`})]}),(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Package editor`,className:`flex flex-wrap gap-1 border-b border-surface-highest pb-2`,children:[`configuration`,`skills`,`files`].map(e=>(0,$.jsxs)(o,{type:`button`,role:`tab`,"aria-selected":E===e,variant:E===e?`default`:`ghost`,"data-testid":`package-editor-${e}`,onClick:()=>D(e),children:[e[0]?.toUpperCase(),e.slice(1),e===`skills`&&x.length?` (${x.length})`:``]},e))}),(0,$.jsxs)(`fieldset`,{disabled:q,className:`min-w-0 space-y-4`,children:[E===`configuration`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:f===`apm`?`APM configuration`:`Portable plugin identity`}),(0,$.jsx)(o,{type:`button`,variant:`outline`,"data-testid":`package-editor-mode`,disabled:!!H||M&&!!G.error,onClick:()=>{N(!M),V(void 0)},children:M?`Edit fields`:f===`apm`?`Edit YAML`:`Edit JSON`})]}),M?(0,$.jsx)(T,{id:`package-yaml`,testId:`package-yaml-input`,path:f===`apm`?`apm.yml`:`plugin.json`,value:h,onChange:_,readOnly:q,height:320}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`name`,`Package name`],[`version`,`Version`],[`description`,`When would you use this?`]].map(([t,n])=>(0,$.jsxs)(`div`,{className:t===`description`?`space-y-1 sm:col-span-2`:`space-y-1`,children:[(0,$.jsx)(s,{htmlFor:`package-${t}`,children:n}),(0,$.jsx)(k,{id:`package-${t}`,"data-testid":`package-${t}-input`,disabled:t===`name`&&!!e,value:typeof K?.[t]==`string`?K[t]:``,onChange:e=>se(t,e.target.value)})]},t))}),f===`apm`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(s,{htmlFor:`package-apm-mcp`,children:`MCP servers (YAML declarations)`}),(0,$.jsx)(T,{id:`package-apm-mcp`,path:`mcp-dependencies.yml`,testId:`package-apm-mcp`,height:180,readOnly:q,value:ne??P(K?.dependencies?.mcp??[]),onChange:e=>{V(e);try{_(ft(h,e)),U(void 0)}catch(e){U(e.message)}}}),(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Use registry names, or named APM mappings with transport and command/URL. Credentials use environment references such as`,` `,(0,$.jsxs)(`code`,{children:[`$`,`{API_TOKEN}`]}),`.`]}),H&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:H})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(s,{htmlFor:`package-instructions`,children:`Shared instructions`}),(0,$.jsx)(y,{id:`package-instructions`,"data-testid":`package-instructions`,rows:7,placeholder:`What should the agent know and how should it work?`,value:ae,onChange:e=>b(ut(v,vt,dt(J?.content,e.target.value)))}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Saved as an APM instruction primitive. Agent-specific model and tool configuration belongs in an agent definition.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(s,{htmlFor:`package-agent-picker`,children:`Add an existing agent definition`}),(0,$.jsxs)(`select`,{id:`package-agent-picker`,"data-testid":`package-agent-picker`,className:`w-full rounded border border-control-border bg-background p-3`,value:``,onChange:async e=>{let t=e.target.value;if(t){R(!0);try{let e=await u.agents.get(t),n=t.split(`/`).slice(-1)[0]?.replace(/[^a-zA-Z0-9-]/g,`-`)??`agent`;b(t=>ut(t,`.apm/agents/${n}.agent.md`,e.raw))}catch(e){ee(e.message)}finally{R(!1)}}},children:[(0,$.jsx)(`option`,{value:``,children:`Select an agent to copy into this package…`}),re.data?.agents.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Configure targets, MCP dependencies and launch scripts in Edit YAML. Supporting agent files are editable in Files.`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Agent Plugins v1 contains skills and MCP. Choose APM if you need shared instructions or agent profiles.`}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(s,{children:`mcp.json (optional)`}),(0,$.jsx)(T,{path:`mcp.json`,testId:`package-mcp-input`,height:220,value:oe?.content??JSON.stringify({$schema:`https://agent-plugins.org/schemas/1.0.0/mcp.schema.json`,mcpServers:{}},null,2),readOnly:q,onChange:e=>b(ut(v,`mcp.json`,e))}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Credentials are managed by the coding agent. Keep secrets out of package files.`})]})]})]})]}),E===`skills`&&(0,$.jsxs)($.Fragment,{children:[v.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.path)).map(e=>{let t=e.path.slice(0,-8);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-outline-variant p-3`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word text-sm`,children:[`Included: `,t.split(`/`).slice(-2)[0]]}),(0,$.jsx)(o,{type:`button`,variant:`outline`,"data-testid":`package-skill-remove`,onClick:()=>b(e=>e.filter(e=>!e.path.startsWith(t))),children:`Remove from package`})]},e.path)}),(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose skills from your library. Their SKILL.md, scripts, references and assets are copied into this package; the originals stay available independently.`}),(0,$.jsx)(k,{"aria-label":`Search existing skills`,"data-testid":`package-skill-search`,placeholder:`Search your skills…`,value:C,onChange:e=>w(e.target.value)}),W.error&&(0,$.jsx)(`p`,{role:`alert`,children:W.error.message}),W.isLoading&&(0,$.jsx)(`p`,{children:`Loading skills…`}),(0,$.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto space-y-2`,children:W.data?.skills.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(C.toLowerCase())).map(e=>{let t=e.name.split(`/`).slice(-1)[0],n=v.some(e=>e.path===`${f===`apm`?`.apm/skills`:`skills`}/${t}/SKILL.md`);return(0,$.jsxs)(`label`,{className:`flex items-start gap-3 border-b border-outline-variant p-3`,"data-testid":`package-skill-option`,"data-skill-name":e.name,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-5 shrink-0`,"data-testid":`package-skill-select`,checked:n||x.includes(e.name),disabled:n||q||!x.includes(e.name)&&x.length>=32,onChange:t=>S(t.target.checked?[...x,e.name]:x.filter(t=>t!==e.name))}),(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word`,children:[(0,$.jsxs)(`span`,{className:`block text-sm font-medium`,children:[e.name,n?` · included`:``]}),(0,$.jsx)(`span`,{className:`block text-xs text-outline line-clamp-2`,children:e.description})]})]},e.name)})}),!W.isLoading&&W.data?.skills.length===0&&(0,$.jsx)(`p`,{children:`No skills yet. Import skills into your library first, or add skill files directly in Files.`})]}),E===`files`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`details`,{className:`border-t border-outline-variant p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Add a file or folder`}),(0,$.jsx)(s,{htmlFor:`package-files`,children:`Add files from a folder`}),(0,$.jsx)(k,{id:`package-files`,"data-testid":`package-files-input`,type:`file`,multiple:!0,webkitdirectory:``,onChange:async e=>{let t=e.target.files;if(t?.length){R(!0);try{let e=(await L(t)).filter(e=>![`apm.yml`,`plugin.json`].includes(e.path));b(t=>[...t.filter(t=>!e.some(e=>e.path===t.path)),...e]),ee(void 0)}catch(e){ee(e.message)}finally{R(!1)}}}}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(k,{"aria-label":`New file path`,"data-testid":`package-new-file-path`,placeholder:f===`apm`?`.apm/agents/reviewer.agent.md`:`skills/my-skill/SKILL.md`,value:z,onChange:e=>B(e.target.value)}),(0,$.jsx)(o,{type:`button`,variant:`outline`,disabled:!z||v.some(e=>e.path===z),onClick:()=>{b(e=>[...e,{path:z,content:``,encoding:`utf8`}]),B(``)},children:`Add file`})]})]}),(0,$.jsx)(it,{files:[{path:f===`apm`?`apm.yml`:`plugin.json`,content:h},...v],readOnly:q,testId:`package-file-input`,onChange:(e,t)=>{e===(f===`apm`?`apm.yml`:`plugin.json`)?_(t):b(n=>ut(n,e,t))}})]})]}),(n||F||G.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-editor-error`,className:`text-sm text-destructive`,children:n||F||G.error}),(0,$.jsxs)(`div`,{className:`sticky bottom-0 border-t border-surface-highest bg-surface pt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-outline`,children:[v.length,` files · `,x.length,` skills selected`]}),(0,$.jsx)(o,{type:`submit`,"data-testid":`package-submit`,disabled:q||!ie.trim()||!!(G.error||H),children:t?`Saving…`:e?`Save changes`:`Save to catalog`})]})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,"data-testid":`package-type-choice`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`package-type-apm`,onClick:()=>ce(`apm`),className:`rounded-lg border border-outline-variant p-5 text-left hover:bg-surface-low`,children:[(0,$.jsx)(`strong`,{className:`block mb-2`,children:`APM package`}),(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:`Instructions, agents, skills, MCP and dependencies. Configure with apm.yml.`})]}),(0,$.jsxs)(`button`,{type:`button`,"data-testid":`package-type-agent-plugin`,onClick:()=>ce(`agent-plugin`),className:`rounded-lg border border-outline-variant p-5 text-left hover:bg-surface-low`,children:[(0,$.jsx)(`strong`,{className:`block mb-2`,children:`Agent Plugin`}),(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:`Portable skills and MCP. Configure with plugin.json and mcp.json.`})]})]})]})}function bt(e){if(e.length>16777216)throw Error(`Archive exceeds 16 MiB`);let t=0,n=0,r=rt(e,{filter:e=>{if(e.name.endsWith(`/`))return!1;if(t+=e.originalSize,n++,e.originalSize>8388608||t>16777216||n>513)throw Error(`Archive exceeds package file or size limits`);return!0}}),i=Object.keys(r),a=i.filter(e=>/(^|\/)(apm\.yml|plugin\.json)$/.test(e)).sort((e,t)=>e.split(`/`).length-t.split(`/`).length)[0];if(!a)throw Error(`Choose a source ZIP containing apm.yml or portable plugin.json`);let o=a.includes(`/`)?a.slice(0,a.lastIndexOf(`/`)+1):``;if(i.some(e=>!e.startsWith(o)))throw Error(`Choose an archive containing one package folder`);return Object.entries(r).map(([e,t])=>{let n=``;for(let e of t)n+=String.fromCharCode(e);try{let n=new TextDecoder(`utf8`,{fatal:!0,ignoreBOM:!0}).decode(t);if(!n.includes(`\0`))return{path:e.slice(o.length),content:n,encoding:`utf8`}}catch{}return{path:e.slice(o.length),content:btoa(n),encoding:`base64`}})}function xt({onClose:e,onImported:t}){let[n,r]=I(`importMethod`,`git`,[`git`,`zip`,`folder`]),[i,c]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(``),[f,h]=(0,Q.useState)(`auto`),[_,v]=(0,Q.useState)(),[y,b]=(0,Q.useState)(!1),S=a({mutationFn:u.agentPackages.discover}),C=a({mutationFn:u.agentPackages.importGit,onSuccess:e=>t(e.name)}),w=a({mutationFn:u.agentPackages.acquire}),T=a({mutationFn:u.agentPackages.importAcquired,onSuccess:e=>t(e.name)}),E=S.isPending||C.isPending||w.isPending||T.isPending||y,D=S.data?.packages??w.data?.packages,A=D?.find(e=>`${e.format}:${e.path}`===l);async function j(){d(``),S.reset(),w.reset(),C.reset(),T.reset();let e=i.trim();if(!e.includes(`://`)||/^https:\/\/github\.com\//i.test(e))try{await S.mutateAsync(e);return}catch{S.reset()}w.mutate(e)}async function M(e){let n=e.find(e=>e.path===`apm.yml`),r=e.find(e=>e.path===`plugin.json`);if(f===`auto`&&n&&r)throw Error(`Both manifests are present. Select a format before importing.`);let i=f===`auto`?n?`apm`:`agent-plugin`:f,a=i===`apm`?n:r;if(!a||a.encoding===`base64`)throw Error(`The selected format's manifest is missing`);let o=ct(a.content,i);if(typeof o.name!=`string`)throw Error(`Manifest is missing a package name`);t((await u.agentPackages.create({name:o.name,content:a.content,format:i,imported:!0,files:e.filter(e=>e!==a&&(i!==`agent-plugin`||e.path!==`apm.yml`))})).name)}return(0,$.jsx)(x,{open:!0,onOpenChange:t=>!t&&!E&&e(),children:(0,$.jsxs)(g,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(p,{children:`Import a package`}),(0,$.jsx)(m,{children:`Add reusable configuration to your catalog, then choose where to install it.`})]}),(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Import source`,className:`flex flex-wrap gap-2`,children:[[`git`,`Git repository`],[`zip`,`ZIP file`],[`folder`,`Folder`]].map(([e,t])=>(0,$.jsx)(o,{role:`tab`,"aria-selected":n===e,"data-testid":`package-import-${e}`,variant:n===e?`default`:`outline`,disabled:E,onClick:()=>{r(e),v(void 0)},children:t},e))}),n===`git`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,$.jsx)(s,{htmlFor:`package-git-source`,children:`Repository URL`}),(0,$.jsx)(k,{id:`package-git-source`,"data-testid":`package-git-source`,placeholder:`https://github.com/owner/repository`,value:i,disabled:E,onChange:e=>{c(e.target.value),S.reset(),w.reset(),C.reset(),T.reset(),d(``)}}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Paste a GitHub, GitLab, Bitbucket or Azure DevOps repository or package link.`}),(0,$.jsx)(o,{type:`submit`,"data-testid":`package-git-discover`,disabled:E||!i.trim(),children:S.isPending||w.isPending?`Finding packages…`:`Find packages`})]}),D&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`max-h-[40dvh] space-y-2 overflow-auto`,children:D.map(e=>(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded border border-surface-highest p-3`,"data-testid":`remote-package`,children:[(0,$.jsx)(`input`,{className:`mt-1 size-5`,type:`radio`,name:`package-import-selection`,disabled:E||e.installed,checked:l===`${e.format}:${e.path}`,onChange:()=>d(`${e.format}:${e.path}`)}),(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word`,children:[(0,$.jsxs)(`strong`,{className:`block text-sm`,children:[e.name,e.installed?` · already in catalog`:``]}),(0,$.jsx)(`span`,{className:`block text-xs text-outline`,children:e.description}),(0,$.jsxs)(`span`,{className:`block text-xs text-outline`,children:[e.format===`apm`?`APM`:`Plugin`,` ·`,` `,e.path||`Repository root`]})]})]},`${e.format}:${e.path}`))}),!D.length&&(0,$.jsx)(`p`,{children:`No APM or Plugin packages found in this repository.`}),S.data?.issues.map(e=>(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive wrap-break-word`,children:[e.path,`: `,e.error]},e.path))]}),D&&(0,$.jsx)(o,{"data-testid":`package-git-import`,disabled:E||!A,onClick:()=>{A&&(S.data?C.mutate({source:S.data.source,commit:S.data.commit,path:A.path,format:A.format}):w.data&&T.mutate({token:w.data.token,path:A.path}))},children:C.isPending||T.isPending?`Importing…`:`Import to catalog`})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(s,{htmlFor:`package-import-format`,children:`Package format`}),(0,$.jsxs)(`select`,{id:`package-import-format`,"data-testid":`package-import-format`,disabled:E,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:f,onChange:e=>h(e.target.value),children:[(0,$.jsx)(`option`,{value:`auto`,children:`Detect from manifest`}),(0,$.jsx)(`option`,{value:`apm`,children:`APM`}),(0,$.jsx)(`option`,{value:`agent-plugin`,children:`Agent Plugin`})]}),(0,$.jsx)(s,{htmlFor:`agent-package-folder`,children:n===`folder`?`Package folder`:`Package source ZIP`}),(0,$.jsx)(k,{id:`agent-package-folder`,"data-testid":n===`folder`?`agent-package-folder`:`package-zip-input`,type:`file`,accept:n===`zip`?`.zip`:void 0,multiple:n===`folder`,...n===`folder`?{webkitdirectory:``}:{},disabled:E,onChange:async e=>{let t=e.target.files;if(t?.length){b(!0),v(void 0);try{await M(n===`folder`?await L(t):bt(new Uint8Array(await t[0].arrayBuffer())))}catch(e){v(e.message)}finally{b(!1)}}}},n),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Original manifests and supporting files are preserved. Import does not launch an agent or run package scripts. Use ZIP on phones where folder selection is unavailable.`})]}),(S.error||C.error||w.error||T.error||_)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-import-error`,className:`text-sm text-destructive`,children:S.error?.message??C.error?.message??w.error?.message??T.error?.message??_})]})})}function St(e,t){A(new Blob([new Uint8Array(t)],{type:`application/zip`}),e)}function Ct(){let{agentId:e}=D();return(0,$.jsx)(h,{replace:!0,to:`/packages/agents${e?`/${encodeURIComponent(e)}`:``}`})}function wt(){let e=r(),[t,n]=f(),s=b(),[c,d]=I(`packageAction`,``,[``,`new`,`import`,`edit`]),h=i({queryKey:[`agent-packages`],queryFn:u.agentPackages.list}),_=i({queryKey:[`package-tools`],queryFn:()=>u.packageTools.list()}),{selectedId:v,closeDetail:y}=te(`/packages/item`,`packageName`),S=c===`new`,C=e=>d(e?`new`:``),[w,T]=(0,Q.useState)(),D=c===`import`,A=e=>d(e?`import`:``);function j(e){let t=new URLSearchParams(window.location.search);t.delete(`packageAction`),s(`/packages/item/${encodeURIComponent(e)}?${t}`)}function M(e){let t=new URLSearchParams(window.location.search);t.set(`packageAction`,`edit`),s(`/packages/item/${encodeURIComponent(e)}?${t}`)}let[N,P]=(0,Q.useState)(),[L,R]=(0,Q.useState)(),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(),W=t.get(`q`)??``,re=t.get(`format`)??`all`;async function G(){await Promise.all([`agent-packages`,`agents`,`skills`,`package-skill-picker`,`agent-package`,`agent-package-files`].map(t=>e.invalidateQueries({queryKey:[t]})))}let K=a({mutationFn:e=>w?u.agentPackages.update(w.name,{content:e.content,files:e.files,skills:e.skills,expectedRevision:w.revision}):u.agentPackages.create(e),onSuccess:async e=>{await G(),ht(w?.name??`new`),C(!1),T(void 0),U(`${e.name} saved to your catalog.`),j(e.name)}}),[ie,q]=(0,Q.useState)(),J=a({mutationFn:e=>u.agentPackages.delete(e.name,e.revision),onSuccess:async(e,t)=>{q(void 0),v===t.name&&y(),ht(t.name),U(`${t.name} deleted from your catalog.`),await G()}});async function ae(e){V(!0),R(void 0),J.reset();try{let t=await u.agentPackages.get(e);if(!t.revision)throw Error(`Package revision is missing; update the API before deleting`);q({name:t.name,revision:t.revision})}catch(e){R(e instanceof Error?e.message:`Could not open package deletion.`)}finally{V(!1)}}let oe=K.reset;(0,Q.useEffect)(()=>{let e=!0;if(T(void 0),c!==`edit`||!v)V(!1);else return V(!0),R(void 0),oe(),(async()=>{try{let t=await u.agentPackages.get(v),n=await Promise.all(t.files.map(async e=>{let t=await u.agentPackages.get(v,e.name);return{path:e.name,content:t.content,encoding:t.encoding}}));if(!t.revision)throw Error(`Package revision is missing; update the API before editing`);let r=gt(v);e&&T(r?{...t,content:r.content,format:r.format,revision:r.revision??t.revision,draftFiles:r.files}:{...t,draftFiles:n})}catch(t){e&&R(t.message)}finally{e&&V(!1)}})(),()=>{e=!1}},[c,v,oe]);function se(e){let t=h.data?.packages.find(t=>t.name===e);y(),P({name:`${e.replace(/\./g,`-`)}-setup`,packages:[e],backend:t?.format===`agent-plugin`?`copilot`:`claude`,tool:`apm`,cwd:``,prompt:``})}async function ce(e){V(!0),R(void 0);try{let t=await u.agentPackages.get(e),n={[`${e}/${t.manifestFile}`]:Je(t.content)};for(let r of t.files){let t=await u.agentPackages.get(e,r.name);n[`${e}/${r.name}`]=t.encoding===`base64`?Uint8Array.from(atob(t.content),e=>e.charCodeAt(0)):Je(t.content)}St(`${e}-source.zip`,nt(n))}catch(e){R(e.message)}finally{V(!1)}}async function Y(e){V(!0),R(void 0),U(`APM is building the installation archive…`);try{let t=await u.agentPackages.exportArtifact(e);St(t.filename,Uint8Array.from(atob(t.content),e=>e.charCodeAt(0))),U(`Exported ${t.format} installation archive.`)}catch(e){R(e.message),U(void 0)}finally{V(!1)}}let le=h.data?.packages.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(W.toLowerCase())&&(re===`all`||e.format===re))??[];return(0,$.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,$.jsx)(ee,{title:`Packages`,meta:`${h.data?.packages.length??0} in your catalog`,action:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(o,{variant:`outline`,"data-testid":`package-import-button`,onClick:()=>A(!0),children:[(0,$.jsx)(l,{size:16,className:`mr-2`}),`Import`]}),(0,$.jsxs)(o,{"data-testid":`new-agent-package-button`,onClick:()=>{K.reset(),C(!0)},children:[(0,$.jsx)(ne,{size:16,className:`mr-2`}),`New package`]})]})}),(0,$.jsx)(`div`,{className:`space-y-1`,children:(0,$.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:`Keep the instructions, skills and tools you trust in one place. Save a package once, then launch it in chat or a terminal on the host and folder you choose.`})}),H&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-primary wrap-break-word`,children:H}),(L||h.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-error`,className:`text-sm text-destructive`,children:(0,$.jsx)(`span`,{"data-testid":`page-error`,children:L??h.error?.message})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(E,{size:16,className:`absolute left-3 top-3 text-muted-foreground`}),(0,$.jsx)(k,{className:`pl-9`,"data-testid":`package-search`,"aria-label":`Search packages`,placeholder:`Find a configuration by name or purpose…`,value:W,onChange:e=>{let r=new URLSearchParams(t);e.target.value?r.set(`q`,e.target.value):r.delete(`q`),n(r,{replace:!0})}})]}),(0,$.jsxs)(`select`,{"aria-label":`Filter package type`,"data-testid":`package-format-filter`,className:`rounded border border-control-border bg-background p-2 text-sm`,value:re,onChange:e=>{let r=new URLSearchParams(t);r.set(`format`,e.target.value),n(r,{replace:!0})},children:[(0,$.jsx)(`option`,{value:`all`,children:`All formats`}),(0,$.jsx)(`option`,{value:`apm`,children:`APM packages`}),(0,$.jsx)(`option`,{value:`agent-plugin`,children:`Agent Plugins`})]})]}),h.isLoading&&(0,$.jsx)(`p`,{role:`status`,"data-testid":`page-loading`,children:`Loading your catalog…`}),(0,$.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:le.map(e=>(0,$.jsxs)(`article`,{"data-testid":`agent-package-row`,"data-package-name":e.name,className:`min-w-0 flex flex-col border-b border-outline-variant p-4`,children:[(0,$.jsxs)(`span`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.format===`apm`?`APM package`:`Agent Plugins`,e.version?` · v${e.version}`:``]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`package-inspect`,onClick:()=>j(e.name),className:`text-left font-medium wrap-break-word hover:text-primary`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-2 flex-1 text-sm text-muted-foreground wrap-break-word`,children:e.description||`Add a description to help you choose this configuration later.`}),e.warnings.map(e=>(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground wrap-break-word`,children:e},e)),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-1`,children:[(0,$.jsx)(o,{size:`sm`,variant:`outline`,"data-testid":`package-run`,disabled:B,onClick:()=>se(e.name),children:`Use package`}),(0,$.jsx)(o,{size:`sm`,variant:`ghost`,"data-testid":`package-card-edit`,onClick:()=>void M(e.name),children:`Edit package`}),(0,$.jsx)(o,{size:`sm`,variant:`ghost`,className:`text-destructive`,"data-testid":`package-card-delete`,disabled:B||J.isPending,onClick:()=>void ae(e.name),children:`Delete package`})]})]},e.name))}),!h.isLoading&&!h.error&&!le.length&&(0,$.jsxs)(`div`,{"data-testid":`page-empty`,className:`rounded-lg border border-dashed border-outline-variant px-4 py-10 text-center`,children:[(0,$.jsx)(z,{size:32,className:`mx-auto mb-3 text-muted-foreground`}),(0,$.jsx)(`h3`,{className:`font-medium`,children:W||re!==`all`?`No matching configurations`:`Build your personal agent catalog`}),(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-muted-foreground`,children:W||re!==`all`?`Try another search or package format.`:`Create an APM package with your instructions and existing skills, or import an Agent Plugin from GitHub.`}),!W&&re===`all`&&(0,$.jsx)(o,{className:`mt-4`,onClick:()=>{K.reset(),C(!0)},children:`Create your first package`})]}),h.data?.broken.map(e=>(0,$.jsxs)(`p`,{role:`alert`,className:`text-destructive wrap-break-word`,children:[e.path,`: `,e.error]},e.path)),_.data&&!_.data.apm&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Catalog editing is available. Installation, Git acquisition and installation exports require APM on this ORC machine.`}),v&&!c&&(0,$.jsx)(at,{name:v,onClose:y,onUse:()=>se(v),onEdit:()=>void M(v),onDelete:()=>void ae(v),onExport:()=>void Y(v),onSource:()=>void ce(v),busy:B,operationError:L},v),(0,$.jsx)(x,{open:S||c===`edit`,onOpenChange:e=>{if(!e&&!K.isPending){if(!_t(w?.name??`new`))return;C(!1),T(void 0)}},children:S||c===`edit`&&w?(0,$.jsx)(yt,{initial:w?{name:w.name,content:w.content,format:w.format,files:w.draftFiles,revision:w.revision}:void 0,pending:K.isPending,error:K.error?.message,onSave:e=>K.mutate(e)}):c===`edit`?(0,$.jsxs)(g,{children:[(0,$.jsx)(O,{children:(0,$.jsx)(p,{children:`Package editor`})}),(0,$.jsx)(`p`,{role:L?`alert`:`status`,children:L??`Opening package editor…`})]}):null}),(0,$.jsx)(x,{open:!!ie,onOpenChange:e=>{!e&&!J.isPending&&q(void 0)},children:(0,$.jsxs)(g,{"data-testid":`package-delete-dialog`,children:[(0,$.jsxs)(O,{children:[(0,$.jsx)(p,{children:`Delete package?`}),(0,$.jsxs)(m,{children:[`Delete `,ie?.name,` from your catalog? Copies already installed in project folders will remain.`]})]}),J.error&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-delete-error`,className:`text-sm text-destructive`,children:J.error.message}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(o,{variant:`outline`,"data-testid":`package-delete-cancel`,disabled:J.isPending,onClick:()=>q(void 0),children:`Cancel`}),(0,$.jsx)(o,{variant:`destructive`,"data-testid":`package-delete-confirm`,disabled:J.isPending||!ie,onClick:()=>{ie&&J.mutate(ie)},children:J.isPending?`Deleting…`:`Delete package`})]})]})}),D&&(0,$.jsx)(xt,{onClose:()=>A(!1),onImported:e=>{G(),A(!1),U(`${e} added to your catalog.`),j(e)}}),N&&(0,$.jsx)(F,{initial:N,onClose:()=>P(void 0)},N.name)]})}export{Ct as LegacyAgentsRedirect,wt as default};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./button-PNx108iL.js";import{n as i,t as a}from"./useMutation-DDLZlpLS.js";import{t as o}from"./label-Ce3QFsX5.js";import{n as s}from"./client-BEiLQQ-F.js";import{At as c,Dn as l,Dt as u,En as d,Et as f,Lt as p,Nt as m,Pt as h,St as g,Tt as _,_t as v,h as y,kt as b,wt as x}from"./index-Ck-SDgTR.js";import{t as S}from"./RemoteFolderBrowser-ClOOMU0_.js";var ee=Symbol.for(`yaml.alias`),te=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),ne=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),D=e=>!!e&&typeof e==`object`&&e[E]===ee,re=e=>!!e&&typeof e==`object`&&e[E]===te,O=e=>!!e&&typeof e==`object`&&e[E]===C,k=e=>!!e&&typeof e==`object`&&e[E]===w,A=e=>!!e&&typeof e==`object`&&e[E]===T,ie=e=>!!e&&typeof e==`object`&&e[E]===ne;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case ne:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case ee:case C:case T:case ne:return!0}return!1}var ae=e=>(A(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),oe=Symbol(`skip children`),se=Symbol(`remove node`);function P(e,t){let n=ce(t);re(e)?F(null,e.contents,n,Object.freeze([e]))===se&&(e.contents=null):F(null,e,n,Object.freeze([]))}P.BREAK=N,P.SKIP=oe,P.REMOVE=se;function F(e,t,n,r){let i=I(e,t,n,r);if(M(i)||k(i))return L(e,r,i),F(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=F(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===se&&(t.items.splice(e,1),--e)}}else if(k(t)){r=Object.freeze(r.concat(t));let e=F(`key`,t.key,n,r);if(e===N)return N;e===se&&(t.key=null);let i=F(`value`,t.value,n,r);if(i===N)return N;i===se&&(t.value=null)}}return i}function ce(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function I(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(O(t))return n.Map?.(e,t,r);if(ie(t))return n.Seq?.(e,t,r);if(k(t))return n.Pair?.(e,t,r);if(A(t))return n.Scalar?.(e,t,r);if(D(t))return n.Alias?.(e,t,r)}function L(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(k(r))e===`key`?r.key=n:r.value=n;else if(re(r))r.contents=n;else{let e=D(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var R={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},z=e=>e.replace(/[!,[\]{}]/g,e=>R[e]),B=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+z(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&M(e.contents)){let t={};P(e.contents,(e,n)=>{M(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r,t as i}from"./useMutation-HX90wI4L.js";import{t as a}from"./button-BHKbOsmj.js";import{t as o}from"./label-BQ1Lr4sA.js";import{n as s}from"./client-BwhkVepQ.js";import{At as c,Dn as l,Dt as u,Et as d,Lt as f,Nt as p,On as m,Pt as h,St as g,Tt as _,_t as v,h as y,kt as b,wt as x}from"./index-CMRGRbC9.js";import{t as S}from"./RemoteFolderBrowser-Btryj6gG.js";var ee=Symbol.for(`yaml.alias`),te=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),ne=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),D=e=>!!e&&typeof e==`object`&&e[E]===ee,re=e=>!!e&&typeof e==`object`&&e[E]===te,O=e=>!!e&&typeof e==`object`&&e[E]===C,k=e=>!!e&&typeof e==`object`&&e[E]===w,A=e=>!!e&&typeof e==`object`&&e[E]===T,ie=e=>!!e&&typeof e==`object`&&e[E]===ne;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case ne:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case ee:case C:case T:case ne:return!0}return!1}var ae=e=>(A(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),oe=Symbol(`skip children`),se=Symbol(`remove node`);function P(e,t){let n=ce(t);re(e)?F(null,e.contents,n,Object.freeze([e]))===se&&(e.contents=null):F(null,e,n,Object.freeze([]))}P.BREAK=N,P.SKIP=oe,P.REMOVE=se;function F(e,t,n,r){let i=I(e,t,n,r);if(M(i)||k(i))return L(e,r,i),F(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=F(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===se&&(t.items.splice(e,1),--e)}}else if(k(t)){r=Object.freeze(r.concat(t));let e=F(`key`,t.key,n,r);if(e===N)return N;e===se&&(t.key=null);let i=F(`value`,t.value,n,r);if(i===N)return N;i===se&&(t.value=null)}}return i}function ce(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function I(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(O(t))return n.Map?.(e,t,r);if(ie(t))return n.Seq?.(e,t,r);if(k(t))return n.Pair?.(e,t,r);if(A(t))return n.Scalar?.(e,t,r);if(D(t))return n.Alias?.(e,t,r)}function L(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(k(r))e===`key`?r.key=n:r.value=n;else if(re(r))r.contents=n;else{let e=D(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var R={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},z=e=>e.replace(/[!,[\]{}]/g,e=>R[e]),B=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+z(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&M(e.contents)){let t={};P(e.contents,(e,n)=>{M(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
2
2
  `)}};B.defaultYaml={explicit:!1,version:`1.2`},B.defaultTags={"!!":`tag:yaml.org,2002:`};function le(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function ue(e){let t=new Set;return P(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function de(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function V(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=ue(e);let a=de(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(A(t.node)||j(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function H(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=H(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=H(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=H(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=H(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function U(e,t,n){if(Array.isArray(e))return e.map((e,t)=>U(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ae(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var fe=class{constructor(e){Object.defineProperty(this,E,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!re(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=U(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?H(i,{"":o},``,o):o}},pe=class extends fe{constructor(e){super(ee),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],P(e,{Node:(e,t)=>{(D(t)||ae(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(U(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=me(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(le(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function me(e,t,n){if(D(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(j(t)){let r=0;for(let i of t.items){let t=me(e,i,n);t>r&&(r=t)}return r}if(k(t)){let r=me(e,t.key,n),i=me(e,t.value,n);return Math.max(r,i)}return 1}var he=e=>!e||typeof e!=`function`&&typeof e!=`object`,W=class extends fe{constructor(e){super(T),this.value=e}toJSON(e,t){return t?.keep?this.value:U(this.value,e,t)}toString(){return String(this.value)}};W.BLOCK_FOLDED=`BLOCK_FOLDED`,W.BLOCK_LITERAL=`BLOCK_LITERAL`,W.PLAIN=`PLAIN`,W.QUOTE_DOUBLE=`QUOTE_DOUBLE`,W.QUOTE_SINGLE=`QUOTE_SINGLE`;var ge=`tag:yaml.org,2002:`;function _e(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ve(e,t,n){if(re(e)&&(e=e.contents),M(e))return e;if(k(e)){let t=n.schema[C].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new pe(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ge+t.slice(2));let l=_e(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new W(e);return c&&(c.node=t),t}l=e instanceof Map?o[C]:Symbol.iterator in Object(e)?o[ne]:o[C]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new W(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ye(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ve(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var be=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,xe=class extends fe{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>M(t)||k(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(be(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(j(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ye(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(j(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&A(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!k(t))return!1;let n=t.value;return n==null||e&&A(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return j(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(j(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ye(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Se=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function G(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ce=(e,t,n)=>e.endsWith(`
3
3
  `)?G(n,t):n.includes(`
4
4
  `)?`
@@ -102,4 +102,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
102
102
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
103
103
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){dr(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(Z(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=ur(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(cr(t.key)&&!Z(t.sep,`newline`)){let e=ur(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Z(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!Z(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){dr(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||Z(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=ur(lr(t));fr(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
104
104
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
105
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=ur(lr(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=ur(lr(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function mr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new or||null,prettyErrors:t}}function hr(e,t={}){let{lineCounter:n,prettyErrors:r}=mr(t),i=new pr(n?.addNewLine),a=new qn(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ln(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(dn(e,n)),o.warnings.forEach(dn(e,n))),o}function gr(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return re(e)&&!r?e.toString(n):new on(e,r,n).toString(n)}var Q=e(t(),1),$=n();function _r({initial:e,onClose:t}){let[n,ee]=(0,Q.useState)({...e,tool:`apm`}),[te,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[ne,E]=(0,Q.useState)(!1),[D,re]=(0,Q.useState)(`run`),O=(0,Q.useRef)(null),k=l(),A=d(),ie=h(),j=g(),M=v(),ae=p(),N=n.host===void 0?j.data?.host??null:n.host,[oe,se]=(0,Q.useState)(`terminal`),[P,F]=(0,Q.useState)(!1),ce=i({queryKey:[`package-tools`,N],queryFn:()=>s.packageTools.list(N),enabled:!!j.data}),I=i({queryKey:[`package-launch-host`,N],queryFn:()=>s.terminals.list(N),enabled:!!j.data,retry:!1}),L=i({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>s.agentPackages.get(e)))}),R=i({queryKey:[`agent`,n.agent],queryFn:()=>s.agents.get(n.agent),enabled:!!n.agent}),z=a({mutationFn:s.agentSetups.command});(0,Q.useEffect)(()=>{z.data&&O.current?.scrollIntoView({block:`nearest`})},[z.data]);let B=L.data?.some(e=>e.format===`agent-plugin`),le=B&&n.backend===`claude`,ue=L.data?.some(e=>e.format===`apm`||n.backend!==`codex`),de=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&ce.data?.bun&&(!ue||ce.data?.apm)&&!le&&!L.error&&!L.isFetching&&!R.error&&!R.isFetching&&!I.isFetching&&!I.error;function V(e){ee(t=>({...t,...e})),z.reset(),E(!1),C(void 0),F(!1)}async function H(e){T(!0),C(void 0);try{if(e===`run`&&oe===`chat`){let e=await s.chat.fromSetup({...n,host:N});ae.openThread(e,{follow:!1}),n.prompt.trim()&&ae.send(n.prompt);let r=new URLSearchParams(A.search);r.set(`chat`,`open`),r.set(`chatThread`,e.id),t(),k(`${A.pathname}?${r}`);return}let r=await ie.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:N,setup:{...n,host:N,operation:e}});t(),k(y(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(_,{open:!0,onOpenChange:e=>!e&&!w&&!z.isPending&&t(),children:(0,$.jsxs)(f,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-2xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(b,{children:[(0,$.jsx)(c,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(u,{children:`Install it for your coding agent, launch here, or copy a command for your own terminal.`})]}),(0,$.jsxs)(`fieldset`,{disabled:w||z.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:N??``,onChange:e=>V({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...j.data?.hosts??[],...j.data?.host?[j.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:n.backend,onChange:e=>V({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(B&&e===`claude`),children:[e,B&&e===`claude`?` · unsupported for this plugin`:I.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-destination`,children:`Open in`}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:oe,onChange:e=>se(e.target.value),children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · choose Claude or Codex`:``]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(o,{htmlFor:`setup-cwd`,children:[`Working folder on `,N??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`w-full rounded border border-control-border bg-surface-low p-3 text-sm`,value:``,onChange:e=>{e.target.value&&V({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),M.data?.filter(e=>e.scope).map(e=>(0,$.jsx)(`option`,{value:e.scope??``,children:e.name},e.id))]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(x,{id:`setup-cwd`,"data-testid":`setup-cwd`,value:n.cwd,onChange:e=>V({cwd:e.target.value})}),(0,$.jsx)(r,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,disabled:I.isFetching||!!I.error||!N&&!I.data?.ready,onClick:async()=>{if(N)F(!0);else try{let e=await s.terminals.pickFolder(n.cwd||void 0,null);e.path&&V({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),P&&N&&(0,$.jsx)(S,{initial:n.cwd,host:N,onPick:e=>V({cwd:e}),onClose:()=>F(!1)},N)]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(m,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:3,value:n.prompt,onChange:e=>V({prompt:e.target.value})})]}),(0,$.jsxs)(`div`,{"data-testid":`setup-components`,className:`rounded-lg bg-surface-low p-3 text-sm space-y-1`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Configuration to apply`}),R.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[R.data.name,` · agent instructions`,R.data.fields.model?` · ${R.data.fields.model}`:``]}),N&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Supporting files referenced by this agent are not transferred. Make them available at the referenced paths on `,N,`.`]})]}),L.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),L.data?.map(e=>(0,$.jsxs)(`p`,{className:`wrap-break-word`,children:[e.name,`:`,` `,e.files.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.name)).length,` `,`skill files`,e.files.some(e=>e.name===`mcp.json`)?`, native MCP configuration`:``,e.files.some(e=>e.name.endsWith(`.instructions.md`))?`, shared instructions`:``]},e.name))]})]}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Package files are transferred to the selected host when needed. APM deploys agent configuration into the working folder; Codex plugins install into Codex's user cache on that host. These tools must already be installed. Configuration remains after the session; use a terminal for installer trust or conflict prompts.`}),le&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),ce.data&&ue&&!ce.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,N??`Local`,`.`]}),!I.data?.ready&&oe===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:I.data?.reason??`Checking terminal availability…`}),(te||z.error||L.error||R.error||I.error||j.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:te??z.error?.message??L.error?.message??R.error?.message??I.error?.message??j.error?.message}),(0,$.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,$.jsx)(r,{"data-testid":`setup-install`,variant:`outline`,disabled:w||!de||!I.data?.ready||!n.packages.length,onClick:()=>void H(`install`),children:`Install for coding agent`}),(0,$.jsx)(r,{"data-testid":`setup-launch`,disabled:w||!de||(oe===`terminal`?!I.data?.ready||!I.data?.launchers.includes(n.backend):!ae.ready||n.backend===`copilot`),onClick:()=>void H(`run`),children:w?`Preparing…`:oe===`chat`?`Open in chat`:`Run in ORC terminal`}),(0,$.jsx)(r,{"data-testid":`setup-command`,variant:`outline`,disabled:w||z.isPending||!de,onClick:()=>z.mutate({...n,host:N,operation:D}),children:z.isPending?`Preparing command…`:`Command for my terminal`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`w-full rounded border border-control-border bg-surface-low p-3 text-sm`,disabled:w||z.isPending,value:D,onChange:e=>{re(e.target.value),z.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),z.data&&(0,$.jsxs)(`div`,{ref:O,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(o,{htmlFor:`package-command`,children:[`Run in `,z.data.shell,` on `,N??`Local`]}),(0,$.jsx)(m,{id:`package-command`,"data-testid":`package-command`,value:z.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(r,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(z.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:ne?`Copied`:`Copy command`})]})]})})}export{ie as a,O as i,hr as n,gr as r,_r as t};
105
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=ur(lr(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=ur(lr(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function mr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new or||null,prettyErrors:t}}function hr(e,t={}){let{lineCounter:n,prettyErrors:r}=mr(t),i=new pr(n?.addNewLine),a=new qn(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ln(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(dn(e,n)),o.warnings.forEach(dn(e,n))),o}function gr(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return re(e)&&!r?e.toString(n):new on(e,r,n).toString(n)}var Q=e(t(),1),$=n();function _r({initial:e,onClose:t}){let[n,ee]=(0,Q.useState)({...e,tool:`apm`}),[te,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[ne,E]=(0,Q.useState)(!1),[D,re]=(0,Q.useState)(`run`),O=(0,Q.useRef)(null),k=m(),A=l(),ie=h(),j=g(),M=v(),ae=f(),N=n.host===void 0?j.data?.host??null:n.host,[oe,se]=(0,Q.useState)(`terminal`),[P,F]=(0,Q.useState)(!1),ce=r({queryKey:[`package-tools`,N],queryFn:()=>s.packageTools.list(N),enabled:!!j.data}),I=r({queryKey:[`package-launch-host`,N],queryFn:()=>s.terminals.list(N),enabled:!!j.data,retry:!1}),L=r({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>s.agentPackages.get(e)))}),R=r({queryKey:[`agent`,n.agent],queryFn:()=>s.agents.get(n.agent),enabled:!!n.agent}),z=i({mutationFn:s.agentSetups.command});(0,Q.useEffect)(()=>{z.data&&O.current?.scrollIntoView({block:`nearest`})},[z.data]);let B=L.data?.some(e=>e.format===`agent-plugin`),le=B&&n.backend===`claude`,ue=L.data?.some(e=>e.format===`apm`||n.backend!==`codex`),de=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&ce.data?.bun&&(!ue||ce.data?.apm)&&!le&&!L.error&&!L.isFetching&&!R.error&&!R.isFetching&&!I.isFetching&&!I.error;function V(e){ee(t=>({...t,...e})),z.reset(),E(!1),C(void 0),F(!1)}async function H(e){T(!0),C(void 0);try{if(e===`run`&&oe===`chat`){let e=await s.chat.fromSetup({...n,host:N});ae.openThread(e,{follow:!1}),n.prompt.trim()&&ae.send(n.prompt);let r=new URLSearchParams(A.search);r.set(`chat`,`open`),r.set(`chatThread`,e.id),t(),k(`${A.pathname}?${r}`);return}let r=await ie.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:N,setup:{...n,host:N,operation:e}});t(),k(y(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(_,{open:!0,onOpenChange:e=>!e&&!w&&!z.isPending&&t(),children:(0,$.jsxs)(d,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-2xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(b,{children:[(0,$.jsx)(c,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(u,{children:`Install it for your coding agent, launch here, or copy a command for your own terminal.`})]}),(0,$.jsxs)(`fieldset`,{disabled:w||z.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:N??``,onChange:e=>V({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...j.data?.hosts??[],...j.data?.host?[j.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:n.backend,onChange:e=>V({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(B&&e===`claude`),children:[e,B&&e===`claude`?` · unsupported for this plugin`:I.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-destination`,children:`Open in`}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:oe,onChange:e=>se(e.target.value),children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · choose Claude or Codex`:``]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(o,{htmlFor:`setup-cwd`,children:[`Working folder on `,N??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`w-full rounded border border-control-border bg-surface-low p-3 text-sm`,value:``,onChange:e=>{e.target.value&&V({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),M.data?.filter(e=>e.scope).map(e=>(0,$.jsx)(`option`,{value:e.scope??``,children:e.name},e.id))]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(x,{id:`setup-cwd`,"data-testid":`setup-cwd`,value:n.cwd,onChange:e=>V({cwd:e.target.value})}),(0,$.jsx)(a,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,disabled:I.isFetching||!!I.error||!N&&!I.data?.ready,onClick:async()=>{if(N)F(!0);else try{let e=await s.terminals.pickFolder(n.cwd||void 0,null);e.path&&V({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),P&&N&&(0,$.jsx)(S,{initial:n.cwd,host:N,onPick:e=>V({cwd:e}),onClose:()=>F(!1)},N)]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(p,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:3,value:n.prompt,onChange:e=>V({prompt:e.target.value})})]}),(0,$.jsxs)(`div`,{"data-testid":`setup-components`,className:`rounded-lg bg-surface-low p-3 text-sm space-y-1`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Configuration to apply`}),R.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[R.data.name,` · agent instructions`,R.data.fields.model?` · ${R.data.fields.model}`:``]}),N&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Supporting files referenced by this agent are not transferred. Make them available at the referenced paths on `,N,`.`]})]}),L.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),L.data?.map(e=>(0,$.jsxs)(`p`,{className:`wrap-break-word`,children:[e.name,`:`,` `,e.files.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.name)).length,` `,`skill files`,e.files.some(e=>e.name===`mcp.json`)?`, native MCP configuration`:``,e.files.some(e=>e.name.endsWith(`.instructions.md`))?`, shared instructions`:``]},e.name))]})]}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Package files are transferred to the selected host when needed. APM deploys agent configuration into the working folder; Codex plugins install into Codex's user cache on that host. These tools must already be installed. Configuration remains after the session; use a terminal for installer trust or conflict prompts.`}),le&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),ce.data&&ue&&!ce.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,N??`Local`,`.`]}),!I.data?.ready&&oe===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:I.data?.reason??`Checking terminal availability…`}),(te||z.error||L.error||R.error||I.error||j.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:te??z.error?.message??L.error?.message??R.error?.message??I.error?.message??j.error?.message}),(0,$.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,$.jsx)(a,{"data-testid":`setup-install`,variant:`outline`,disabled:w||!de||!I.data?.ready||!n.packages.length,onClick:()=>void H(`install`),children:`Install for coding agent`}),(0,$.jsx)(a,{"data-testid":`setup-launch`,disabled:w||!de||(oe===`terminal`?!I.data?.ready||!I.data?.launchers.includes(n.backend):!ae.ready||n.backend===`copilot`),onClick:()=>void H(`run`),children:w?`Preparing…`:oe===`chat`?`Open in chat`:`Run in ORC terminal`}),(0,$.jsx)(a,{"data-testid":`setup-command`,variant:`outline`,disabled:w||z.isPending||!de,onClick:()=>z.mutate({...n,host:N,operation:D}),children:z.isPending?`Preparing command…`:`Command for my terminal`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(o,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`w-full rounded border border-control-border bg-surface-low p-3 text-sm`,disabled:w||z.isPending,value:D,onChange:e=>{re(e.target.value),z.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),z.data&&(0,$.jsxs)(`div`,{ref:O,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(o,{htmlFor:`package-command`,children:[`Run in `,z.data.shell,` on `,N??`Local`]}),(0,$.jsx)(p,{id:`package-command`,"data-testid":`package-command`,value:z.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(a,{variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(z.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:ne?`Copied`:`Copy command`})]})]})})}export{ie as a,O as i,hr as n,gr as r,_r as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{fn as t,pn as n}from"./index-Ck-SDgTR.js";var r=e(),i=`inline-flex min-h-11 items-center gap-1 font-label text-xs text-primary hover:text-on-surface disabled:opacity-40 disabled:hover:text-primary`;function a({page:e,pageSize:a,total:o,onPage:s}){let c=Math.max(1,Math.ceil(o/a));if(o<=a)return null;let l=e*a+1,u=Math.min(o,(e+1)*a);return(0,r.jsxs)(`div`,{"data-testid":`pager`,className:`flex flex-wrap gap-2 items-center justify-between border-t border-surface-highest px-3 py-2`,children:[(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[l,`–`,u,` of `,o]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-prev`,className:i,disabled:e===0,onClick:()=>s(e-1),children:[(0,r.jsx)(n,{className:`h-3 w-3`}),`Prev`]}),(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[`Page `,e+1,` / `,c]}),(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-next`,className:i,disabled:e>=c-1,onClick:()=>s(e+1),children:[`Next`,(0,r.jsx)(t,{className:`h-3 w-3`})]})]})]})}export{a as t};
1
+ import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{hn as t,mn as n}from"./index-CMRGRbC9.js";var r=e(),i=`inline-flex min-h-11 items-center gap-1 font-label text-xs text-primary hover:text-on-surface disabled:opacity-40 disabled:hover:text-primary`;function a({page:e,pageSize:a,total:o,onPage:s}){let c=Math.max(1,Math.ceil(o/a));if(o<=a)return null;let l=e*a+1,u=Math.min(o,(e+1)*a);return(0,r.jsxs)(`div`,{"data-testid":`pager`,className:`flex flex-wrap gap-2 items-center justify-between border-t border-surface-highest px-3 py-2`,children:[(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[l,`–`,u,` of `,o]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-prev`,className:i,disabled:e===0,onClick:()=>s(e-1),children:[(0,r.jsx)(t,{className:`h-3 w-3`}),`Prev`]}),(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[`Page `,e+1,` / `,c]}),(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-next`,className:i,disabled:e>=c-1,onClick:()=>s(e+1),children:[`Next`,(0,r.jsx)(n,{className:`h-3 w-3`})]})]})]})}export{a as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{r as t}from"./button-BHKbOsmj.js";var n=e(),r={critical:`text-error font-bold`,high:`text-tertiary font-semibold`,normal:`text-on-surface-variant`,low:`text-outline`};function i({priority:e,className:i}){return(0,n.jsx)(`span`,{className:t(`font-label text-xs `,r[e],i),children:e.charAt(0).toUpperCase()+e.slice(1)})}export{i as t};
@@ -1,3 +1,3 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./button-PNx108iL.js";import{i,n as a,r as o,t as s}from"./tabs-DWq5oObc.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-Cg0xEvji.js";import{t as p}from"./label-Ce3QFsX5.js";import{t as m}from"./TaskDetailSheet-0hZx_-me.js";import{t as h}from"./trash-D7o9t0-a.js";import{At as g,E as _,Et as v,Nt as y,Ot as b,Tt as x,U as S,_t as C,an as w,gt as T,ht as E,kt as D,mt as O,pt as k,st as A,vt as j,w as M,wn as N,wt as P,yt as F}from"./index-Ck-SDgTR.js";import{t as I}from"./ConfirmDialog-BGZ6sd6E.js";import{t as L}from"./ErrorState-B0KI2D4y.js";import{t as R}from"./ViewHeader-CX02p2eb.js";import{t as z}from"./useDetailRoute-1i4Z0-d5.js";import{t as B}from"./view-params-DNioxw0G.js";import{t as V}from"./EmptyState-YM4VSLR9.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./table-DC8IBMHg.js";import{n as J,t as ee}from"./useListSelection-DcULI867.js";var Y=e(t(),1),X=n(),te=[{value:`all`,label:`All`},{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`paused`,label:`Paused`}];function Z(){let{data:e,isLoading:t,error:n,refetch:c}=C(),[l,u]=B(`status`,`all`,[`all`,`active`,`archived`,`paused`]),[d,f]=(0,Y.useState)(!1),[p,g]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),{selectedId:T,openDetail:D,closeDetail:A}=z(`/projects`,`projectId`),M=E(),N=T?(e??[]).find(e=>e.id===T)??null:null,P=(0,Y.useMemo)(()=>{let t=e??[];return l===`all`?t:t.filter(e=>e.status===l)},[e,l]),F=ee(P.map(e=>e.id),l),Z=j(),Q=Z.data?.scope===l?Z.data:void 0;async function re(e){let t=await Z.mutateAsync({ids:F.selectedIds,status:e,scope:l});F.select(t.failed.map(e=>e.id))}let $=(0,Y.useMemo)(()=>(e??[]).reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),[e]);return n?(0,X.jsx)(L,{message:n.message,onRetry:()=>c()}):(0,X.jsxs)(`div`,{children:[(0,X.jsx)(R,{title:`Projects`,meta:`${(e??[]).length} total`,action:(0,X.jsxs)(r,{"data-testid":`new-project-button`,size:`sm`,onClick:()=>f(!0),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,X.jsx)(w,{size:12,className:`mr-1`}),`New project`]})}),(0,X.jsxs)(s,{value:l,onValueChange:e=>u(e),className:`mb-4`,children:[(0,X.jsx)(o,{className:`bg-transparent gap-1 h-auto max-w-full flex-wrap justify-start p-0`,children:te.map(({value:e,label:t})=>(0,X.jsxs)(i,{"data-testid":`projects-filter-${e}`,value:e,className:`font-label text-sm px-4 py-2 rounded-md
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./button-BHKbOsmj.js";import{i,n as a,r as o,t as s}from"./tabs-DltQVo38.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-CBHDS40x.js";import{t as p}from"./label-BQ1Lr4sA.js";import{t as m}from"./TaskDetailSheet-BiIQ82AG.js";import{At as h,E as g,Et as _,Nt as v,Ot as y,Tn as b,Tt as x,U as S,_t as C,en as w,gt as T,ht as E,kt as D,mt as O,on as k,pt as A,st as j,vt as M,w as N,wt as P,yt as F}from"./index-CMRGRbC9.js";import{t as I}from"./ConfirmDialog-D25Wf6Nc.js";import{t as L}from"./ErrorState-BoQqdsym.js";import{t as R}from"./ViewHeader-DHM9SSkD.js";import{t as z}from"./useDetailRoute-C8xQeILG.js";import{t as B}from"./view-params-BqRwdnv0.js";import{t as V}from"./EmptyState-YM4VSLR9.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./table-ByS-sgsb.js";import{n as J,t as ee}from"./useListSelection-CgpNqqAb.js";var Y=e(t(),1),X=n(),te=[{value:`all`,label:`All`},{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`paused`,label:`Paused`}];function Z(){let{data:e,isLoading:t,error:n,refetch:c}=C(),[l,u]=B(`status`,`all`,[`all`,`active`,`archived`,`paused`]),[d,f]=(0,Y.useState)(!1),[p,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),{selectedId:x,openDetail:T,closeDetail:D}=z(`/projects`,`projectId`),j=E(),N=x?(e??[]).find(e=>e.id===x)??null:null,P=(0,Y.useMemo)(()=>{let t=e??[];return l===`all`?t:t.filter(e=>e.status===l)},[e,l]),F=ee(P.map(e=>e.id),l),Z=M(),Q=Z.data?.scope===l?Z.data:void 0;async function re(e){let t=await Z.mutateAsync({ids:F.selectedIds,status:e,scope:l});F.select(t.failed.map(e=>e.id))}let $=(0,Y.useMemo)(()=>(e??[]).reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),[e]);return n?(0,X.jsx)(L,{message:n.message,onRetry:()=>c()}):(0,X.jsxs)(`div`,{children:[(0,X.jsx)(R,{title:`Projects`,meta:`${(e??[]).length} total`,action:(0,X.jsxs)(r,{"data-testid":`new-project-button`,size:`sm`,onClick:()=>f(!0),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,X.jsx)(k,{size:12,className:`mr-1`}),`New project`]})}),(0,X.jsxs)(s,{value:l,onValueChange:e=>u(e),className:`mb-4`,children:[(0,X.jsx)(o,{className:`bg-transparent gap-1 h-auto max-w-full flex-wrap justify-start p-0`,children:te.map(({value:e,label:t})=>(0,X.jsxs)(i,{"data-testid":`projects-filter-${e}`,value:e,className:`font-label text-sm px-4 py-2 rounded-md
2
2
  data-[state=active]:bg-surface-highest data-[state=active]:text-on-surface data-[state=active]:shadow-none
3
- text-muted-foreground hover:text-on-surface`,children:[t,e!==`all`&&$[e]!=null&&(0,X.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground px-1.5 py-0.5`,children:$[e]})]},e))}),P.length>0&&(0,X.jsx)(J,{resourceLabel:`projects`,count:F.selectedIds.length,allSelected:F.allSelected,someSelected:F.someSelected,onSelectAll:F.selectAll,onClear:F.clear,disabled:Z.isPending,children:O.map(e=>(0,X.jsxs)(r,{type:`button`,size:`sm`,variant:`outline`,disabled:Z.isPending,"data-testid":`projects-bulk-${e}`,onClick:()=>void re(e),children:[e===`active`?`Activate`:e===`paused`?`Pause`:`Archive`,` `,`selected`]},e))}),Z.isPending&&(0,X.jsx)(`p`,{role:`status`,className:`mb-3 text-sm text-outline`,children:`Updating selected projects...`}),!Z.isPending&&Q&&(0,X.jsxs)(`div`,{role:`status`,className:`mb-3 space-y-1 text-sm`,"data-testid":`projects-bulk-result`,children:[(0,X.jsxs)(`p`,{children:[Q.succeeded.length,` projects set to `,Q.status,`.`]}),Q.failed.map(t=>(0,X.jsxs)(`p`,{className:`text-error`,children:[e?.find(e=>e.id===t.id)?.name??t.id,`: `,t.error,`. Still selected for retry.`]},t.id))]}),(0,X.jsx)(a,{value:l,children:t?(0,X.jsx)(`div`,{className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,X.jsx)(S,{className:`h-12 w-full bg-surface-highest`},t))}):P.length===0?(0,X.jsx)(V,{message:`No projects`}):(0,X.jsx)(`div`,{className:`overflow-hidden`,children:(0,X.jsxs)(q,{children:[(0,X.jsx)(H,{children:(0,X.jsxs)(G,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,X.jsx)(U,{className:`w-11`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Select projects`})}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground`,children:`Name`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-28`,children:`Status`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-36`,children:`Tags`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-24`,children:`Max Workers`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-24`,children:`Created`}),(0,X.jsx)(U,{className:`w-10`})]})}),(0,X.jsx)(W,{children:P.map(e=>(0,X.jsxs)(G,{"data-testid":`project-row`,"data-project-id":e.id,"data-project-name":e.name,className:`border-b border-outline-variant/50 hover:bg-surface-high cursor-pointer`,onClick:()=>D(e.id),children:[(0,X.jsx)(K,{children:(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:F.selectedIds.includes(e.id),disabled:Z.isPending,onClick:e=>e.stopPropagation(),onChange:()=>F.toggle(e.id)})}),(0,X.jsx)(K,{className:`font-body text-sm font-medium text-on-surface`,children:(0,X.jsx)(`button`,{type:`button`,className:`min-h-11 text-left hover:text-primary`,"aria-label":`Edit project: ${e.name}`,onClick:t=>{t.stopPropagation(),D(e.id)},children:e.name})}),(0,X.jsx)(K,{className:`font-body text-sm text-muted-foreground max-w-xs truncate`,children:e.description??`—`}),(0,X.jsx)(K,{children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs font-normal capitalize text-muted-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e.status===`active`?`bg-secondary`:e.status===`paused`?`bg-tertiary`:`bg-outline`}`}),e.status]})}),(0,X.jsx)(K,{children:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.tags??[]).map(e=>(0,X.jsx)(`span`,{className:`font-label text-sm px-1.5 py-0.5 text-muted-foreground`,children:e},e))})}),(0,X.jsx)(K,{className:`font-label text-sm text-on-surface text-center`,children:e.max_workers??`—`}),(0,X.jsx)(K,{className:`font-label text-sm text-muted-foreground`,children:new Date(e.created_at).toLocaleDateString()}),(0,X.jsx)(K,{children:(0,X.jsx)(`button`,{type:`button`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:t=>{t.stopPropagation(),x(e)},className:`text-muted-foreground hover:text-error transition-colors p-1`,children:(0,X.jsx)(h,{size:12})})})]},e.id))})]})})})]}),d&&(0,X.jsx)(k,{open:d,onClose:()=>f(!1),onFirstTask:g}),p&&(0,X.jsx)(_,{open:!0,defaultProjectId:p,onClose:()=>g(null),onCreated:y}),(0,X.jsx)(m,{taskId:v,open:!!v,onOpenChange:e=>{e||y(null)}}),N&&(0,X.jsx)(ne,{open:!!N,project:N,onClose:A,onFirstTask:e=>{A(),g(e)}},N.id),b&&(0,X.jsx)(I,{open:!!b,title:`Delete project`,description:`This deletes the project, its memories and its scratchpads. Its tasks, jobs and sessions are kept without a project. This action cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:M.isPending,onConfirm:()=>{M.mutate(b.id,{onSuccess:()=>x(null)})},onCancel:()=>x(null)})]})}function ne({open:e,project:t,onClose:n,onFirstTask:i}){let[a,o]=(0,Y.useState)(t.name),[s,m]=(0,Y.useState)(t.description??``),[h,_]=(0,Y.useState)(t.status),[S,C]=(0,Y.useState)((t.tags??[]).join(`, `)),[w,E]=(0,Y.useState)(t.scope??``),[k,A]=(0,Y.useState)(t.git_remote_url??``),[j,M]=(0,Y.useState)(t.max_workers==null?``:String(t.max_workers)),N=F(),{data:I}=T(t.id);return(0,X.jsx)(x,{open:e,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(v,{"data-testid":`edit-project-dialog`,className:`bg-surface border-outline-variant max-w-lg max-h-[calc(100dvh-2rem)] overflow-y-auto`,children:[(0,X.jsx)(D,{children:(0,X.jsx)(g,{className:`font-headline text-base text-on-surface`,children:`Edit Project`})}),I&&(0,X.jsx)(Q,{summary:I}),(0,X.jsx)(r,{type:`button`,"data-testid":`project-create-task`,variant:`outline`,size:`sm`,onClick:()=>i(t.id),children:`Create task in this project`}),(0,X.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!a.trim())return;let r={id:t.id,name:a.trim(),description:s.trim()||null,status:h,tags:S.trim()?S.split(`,`).map(e=>e.trim()).filter(Boolean):null,scope:w.trim()||null,git_remote_url:k.trim()||null,max_workers:j?Number(j):null};N.mutate(r,{onSuccess:()=>n()})},className:`space-y-4 mt-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Name *`}),(0,X.jsx)(P,{"aria-label":`Name`,"data-testid":`edit-project-name-input`,value:a,onChange:e=>o(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,X.jsx)(y,{"aria-label":`Description`,value:s,onChange:e=>m(e.target.value),rows:2,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Status`}),(0,X.jsxs)(f,{value:h,onValueChange:e=>_(e),children:[(0,X.jsx)(l,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-sm`,children:(0,X.jsx)(c,{})}),(0,X.jsx)(u,{className:`bg-surface border-outline-variant`,children:O.map(e=>(0,X.jsx)(d,{value:e,className:`font-label text-sm`,children:e},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Max Workers`}),(0,X.jsx)(P,{"aria-label":`Max Workers`,type:`number`,min:1,value:j,onChange:e=>M(e.target.value),placeholder:`1`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Tags (comma separated)`}),(0,X.jsx)(P,{"aria-label":`Tags (comma separated)`,value:S,onChange:e=>C(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Scope`}),(0,X.jsx)(P,{"aria-label":`Scope`,value:w,onChange:e=>E(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{htmlFor:`edit-project-git-remote-url`,className:`font-label text-sm text-muted-foreground`,children:`Git remote URL (optional)`}),(0,X.jsx)(P,{id:`edit-project-git-remote-url`,className:`bg-background border-control-border text-on-surface font-body text-sm`,"data-testid":`edit-project-git-remote-url`,value:k,onChange:e=>A(e.target.value),placeholder:`https://github.com/owner/repo.git or git@github.com:owner/repo.git`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Clear this field to remove the saved address.`})]}),(0,X.jsxs)(b,{children:[(0,X.jsx)(r,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,className:`font-label text-sm text-muted-foreground`,children:`Cancel`}),(0,X.jsx)(r,{"data-testid":`edit-project-submit`,type:`submit`,size:`sm`,disabled:N.isPending||!a.trim(),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:N.isPending?`Saving...`:`Save`})]}),N.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:N.error.message})]})]})})}function Q({summary:e}){return(0,X.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 py-3 border-t border-outline-variant mt-2`,children:[(0,X.jsxs)(A,{label:`Tasks`,children:[(0,X.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.tasks.total}),Object.keys(e.tasks.by_status).length>0&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-sm ml-1`,children:[`(`,Object.entries(e.tasks.by_status).map(([e,t])=>`${t} ${e}`).join(`, `),`)`]})]}),(0,X.jsx)(A,{label:`Memories`,children:(0,X.jsx)(N,{"data-testid":`project-memories-link`,to:`${M}?project=${encodeURIComponent(e.project.id)}`,className:`font-label text-sm text-primary underline`,children:e.memories})}),(0,X.jsx)(A,{label:`Jobs`,children:(0,X.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.jobs})})]})}export{Z as default};
3
+ text-muted-foreground hover:text-on-surface`,children:[t,e!==`all`&&$[e]!=null&&(0,X.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground px-1.5 py-0.5`,children:$[e]})]},e))}),P.length>0&&(0,X.jsx)(J,{resourceLabel:`projects`,count:F.selectedIds.length,allSelected:F.allSelected,someSelected:F.someSelected,onSelectAll:F.selectAll,onClear:F.clear,disabled:Z.isPending,children:O.map(e=>(0,X.jsxs)(r,{type:`button`,size:`sm`,variant:`outline`,disabled:Z.isPending,"data-testid":`projects-bulk-${e}`,onClick:()=>void re(e),children:[e===`active`?`Activate`:e===`paused`?`Pause`:`Archive`,` `,`selected`]},e))}),Z.isPending&&(0,X.jsx)(`p`,{role:`status`,className:`mb-3 text-sm text-outline`,children:`Updating selected projects...`}),!Z.isPending&&Q&&(0,X.jsxs)(`div`,{role:`status`,className:`mb-3 space-y-1 text-sm`,"data-testid":`projects-bulk-result`,children:[(0,X.jsxs)(`p`,{children:[Q.succeeded.length,` projects set to `,Q.status,`.`]}),Q.failed.map(t=>(0,X.jsxs)(`p`,{className:`text-error`,children:[e?.find(e=>e.id===t.id)?.name??t.id,`: `,t.error,`. Still selected for retry.`]},t.id))]}),(0,X.jsx)(a,{value:l,children:t?(0,X.jsx)(`div`,{className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,X.jsx)(S,{className:`h-12 w-full bg-surface-highest`},t))}):P.length===0?(0,X.jsx)(V,{message:`No projects`}):(0,X.jsx)(`div`,{className:`overflow-hidden`,children:(0,X.jsxs)(q,{children:[(0,X.jsx)(H,{children:(0,X.jsxs)(G,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,X.jsx)(U,{className:`w-11`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Select projects`})}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground`,children:`Name`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-28`,children:`Status`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-36`,children:`Tags`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-24`,children:`Max Workers`}),(0,X.jsx)(U,{className:`font-label text-sm text-muted-foreground w-24`,children:`Created`}),(0,X.jsx)(U,{className:`w-10`})]})}),(0,X.jsx)(W,{children:P.map(e=>(0,X.jsxs)(G,{"data-testid":`project-row`,"data-project-id":e.id,"data-project-name":e.name,className:`border-b border-outline-variant/50 hover:bg-surface-high cursor-pointer`,onClick:()=>T(e.id),children:[(0,X.jsx)(K,{children:(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:F.selectedIds.includes(e.id),disabled:Z.isPending,onClick:e=>e.stopPropagation(),onChange:()=>F.toggle(e.id)})}),(0,X.jsx)(K,{className:`font-body text-sm font-medium text-on-surface`,children:(0,X.jsx)(`button`,{type:`button`,className:`min-h-11 text-left hover:text-primary`,"aria-label":`Edit project: ${e.name}`,onClick:t=>{t.stopPropagation(),T(e.id)},children:e.name})}),(0,X.jsx)(K,{className:`font-body text-sm text-muted-foreground max-w-xs truncate`,children:e.description??`—`}),(0,X.jsx)(K,{children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs font-normal capitalize text-muted-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e.status===`active`?`bg-secondary`:e.status===`paused`?`bg-tertiary`:`bg-outline`}`}),e.status]})}),(0,X.jsx)(K,{children:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.tags??[]).map(e=>(0,X.jsx)(`span`,{className:`font-label text-sm px-1.5 py-0.5 text-muted-foreground`,children:e},e))})}),(0,X.jsx)(K,{className:`font-label text-sm text-on-surface text-center`,children:e.max_workers??`—`}),(0,X.jsx)(K,{className:`font-label text-sm text-muted-foreground`,children:new Date(e.created_at).toLocaleDateString()}),(0,X.jsx)(K,{children:(0,X.jsx)(`button`,{type:`button`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:t=>{t.stopPropagation(),b(e)},className:`text-muted-foreground hover:text-error transition-colors p-1`,children:(0,X.jsx)(w,{size:12})})})]},e.id))})]})})})]}),d&&(0,X.jsx)(A,{open:d,onClose:()=>f(!1),onFirstTask:h}),p&&(0,X.jsx)(g,{open:!0,defaultProjectId:p,onClose:()=>h(null),onCreated:v}),(0,X.jsx)(m,{taskId:_,open:!!_,onOpenChange:e=>{e||v(null)}}),N&&(0,X.jsx)(ne,{open:!!N,project:N,onClose:D,onFirstTask:e=>{D(),h(e)}},N.id),y&&(0,X.jsx)(I,{open:!!y,title:`Delete project`,description:`This deletes the project, its memories and its scratchpads. Its tasks, jobs and sessions are kept without a project. This action cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:j.isPending,onConfirm:()=>{j.mutate(y.id,{onSuccess:()=>b(null)})},onCancel:()=>b(null)})]})}function ne({open:e,project:t,onClose:n,onFirstTask:i}){let[a,o]=(0,Y.useState)(t.name),[s,m]=(0,Y.useState)(t.description??``),[g,b]=(0,Y.useState)(t.status),[S,C]=(0,Y.useState)((t.tags??[]).join(`, `)),[w,E]=(0,Y.useState)(t.scope??``),[k,A]=(0,Y.useState)(t.git_remote_url??``),[j,M]=(0,Y.useState)(t.max_workers==null?``:String(t.max_workers)),N=F(),{data:I}=T(t.id);return(0,X.jsx)(x,{open:e,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(_,{"data-testid":`edit-project-dialog`,className:`bg-surface border-outline-variant max-w-lg max-h-[calc(100dvh-2rem)] overflow-y-auto`,children:[(0,X.jsx)(D,{children:(0,X.jsx)(h,{className:`font-headline text-base text-on-surface`,children:`Edit Project`})}),I&&(0,X.jsx)(Q,{summary:I}),(0,X.jsx)(r,{type:`button`,"data-testid":`project-create-task`,variant:`outline`,size:`sm`,onClick:()=>i(t.id),children:`Create task in this project`}),(0,X.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!a.trim())return;let r={id:t.id,name:a.trim(),description:s.trim()||null,status:g,tags:S.trim()?S.split(`,`).map(e=>e.trim()).filter(Boolean):null,scope:w.trim()||null,git_remote_url:k.trim()||null,max_workers:j?Number(j):null};N.mutate(r,{onSuccess:()=>n()})},className:`space-y-4 mt-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Name *`}),(0,X.jsx)(P,{"aria-label":`Name`,"data-testid":`edit-project-name-input`,value:a,onChange:e=>o(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,X.jsx)(v,{"aria-label":`Description`,value:s,onChange:e=>m(e.target.value),rows:2,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Status`}),(0,X.jsxs)(f,{value:g,onValueChange:e=>b(e),children:[(0,X.jsx)(l,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-sm`,children:(0,X.jsx)(c,{})}),(0,X.jsx)(u,{className:`bg-surface border-outline-variant`,children:O.map(e=>(0,X.jsx)(d,{value:e,className:`font-label text-sm`,children:e},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Max Workers`}),(0,X.jsx)(P,{"aria-label":`Max Workers`,type:`number`,min:1,value:j,onChange:e=>M(e.target.value),placeholder:`1`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Tags (comma separated)`}),(0,X.jsx)(P,{"aria-label":`Tags (comma separated)`,value:S,onChange:e=>C(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{className:`font-label text-sm text-muted-foreground`,children:`Scope`}),(0,X.jsx)(P,{"aria-label":`Scope`,value:w,onChange:e=>E(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(p,{htmlFor:`edit-project-git-remote-url`,className:`font-label text-sm text-muted-foreground`,children:`Git remote URL (optional)`}),(0,X.jsx)(P,{id:`edit-project-git-remote-url`,className:`bg-background border-control-border text-on-surface font-body text-sm`,"data-testid":`edit-project-git-remote-url`,value:k,onChange:e=>A(e.target.value),placeholder:`https://github.com/owner/repo.git or git@github.com:owner/repo.git`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Clear this field to remove the saved address.`})]}),(0,X.jsxs)(y,{children:[(0,X.jsx)(r,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,className:`font-label text-sm text-muted-foreground`,children:`Cancel`}),(0,X.jsx)(r,{"data-testid":`edit-project-submit`,type:`submit`,size:`sm`,disabled:N.isPending||!a.trim(),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:N.isPending?`Saving...`:`Save`})]}),N.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:N.error.message})]})]})})}function Q({summary:e}){return(0,X.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 py-3 border-t border-outline-variant mt-2`,children:[(0,X.jsxs)(j,{label:`Tasks`,children:[(0,X.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.tasks.total}),Object.keys(e.tasks.by_status).length>0&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-sm ml-1`,children:[`(`,Object.entries(e.tasks.by_status).map(([e,t])=>`${t} ${e}`).join(`, `),`)`]})]}),(0,X.jsx)(j,{label:`Memories`,children:(0,X.jsx)(b,{"data-testid":`project-memories-link`,to:`${N}?project=${encodeURIComponent(e.project.id)}`,className:`font-label text-sm text-primary underline`,children:e.memories})}),(0,X.jsx)(j,{label:`Jobs`,children:(0,X.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.jobs})})]})}export{Z as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t}));export{o as n,s as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./useMutation-DDLZlpLS.js";import{n as i}from"./client-BEiLQQ-F.js";import{_n as a,un as o}from"./index-Ck-SDgTR.js";var s=e(t(),1),c=n();function l({initial:e,host:t,onPick:n,onClose:l}){let[u,d]=(0,s.useState)(e),{data:f,error:p,isFetching:m}=r({queryKey:[`terminals`,`browse`,t,u],queryFn:()=>i.terminals.browse(u||void 0,t),retry:!1}),h=e=>f?`${f.path.replace(/\/$/,``)}/${e}`:e;return(0,c.jsxs)(`div`,{"data-testid":`remote-folder-browser`,className:`border border-outline-variant rounded-md bg-background p-1 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,c.jsx)(`button`,{type:`button`,"data-testid":`remote-folder-up`,disabled:!f?.parent,onClick:()=>f?.parent&&d(f.parent),"aria-label":`Parent folder`,title:`Parent folder`,className:`shrink-0 min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 inline-flex items-center justify-center p-1 rounded-md text-on-surface-variant hover:bg-surface hover:text-on-surface disabled:opacity-40`,children:(0,c.jsx)(a,{size:12})}),(0,c.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-body text-xs text-on-surface`,title:f?.path,children:[f?.host?`${f.host}:`:``,f?.path??u]})]}),p&&(0,c.jsx)(`p`,{className:`px-1 font-body text-xs text-error wrap-break-word`,children:p instanceof Error?p.message:String(p)}),(0,c.jsxs)(`ul`,{className:`max-h-48 overflow-y-auto`,children:[f?.directories.map(e=>(0,c.jsx)(`li`,{children:(0,c.jsxs)(`button`,{type:`button`,"data-testid":`remote-folder-entry`,onClick:()=>d(h(e)),className:`w-full min-h-11 flex items-center gap-1.5 px-1 py-0.5 rounded-md font-body text-xs text-on-surface-variant hover:bg-surface hover:text-on-surface`,children:[(0,c.jsx)(o,{size:11,className:`shrink-0 text-on-surface-variant`}),(0,c.jsx)(`span`,{className:`truncate`,children:e})]})},e)),f&&f.directories.length===0&&!m&&(0,c.jsx)(`li`,{className:`px-1 py-0.5 font-body text-xs text-on-surface-variant`,children:`No subfolders`})]}),(0,c.jsxs)(`div`,{className:`flex justify-end gap-1 px-1`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:l,className:`min-h-11 px-2 py-0.5 rounded-md font-label text-xs text-on-surface-variant hover:text-on-surface`,children:`Cancel`}),(0,c.jsx)(`button`,{type:`button`,"data-testid":`remote-folder-pick`,disabled:!f,onClick:()=>f&&n(f.path),className:`min-h-11 px-2 py-0.5 rounded-md bg-transparent border border-control-border text-on-surface font-label text-xs hover:bg-surface disabled:opacity-50`,children:`Use folder`})]})]})}export{l as t};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./useMutation-HX90wI4L.js";import{n as i}from"./client-BwhkVepQ.js";import{fn as a,yn as o}from"./index-CMRGRbC9.js";var s=e(t(),1),c=n();function l({initial:e,host:t,onPick:n,onClose:l}){let[u,d]=(0,s.useState)(e),{data:f,error:p,isFetching:m}=r({queryKey:[`terminals`,`browse`,t,u],queryFn:()=>i.terminals.browse(u||void 0,t),retry:!1}),h=e=>f?`${f.path.replace(/\/$/,``)}/${e}`:e;return(0,c.jsxs)(`div`,{"data-testid":`remote-folder-browser`,className:`border border-outline-variant rounded-md bg-background p-1 space-y-1`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,c.jsx)(`button`,{type:`button`,"data-testid":`remote-folder-up`,disabled:!f?.parent,onClick:()=>f?.parent&&d(f.parent),"aria-label":`Parent folder`,title:`Parent folder`,className:`shrink-0 min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 inline-flex items-center justify-center p-1 rounded-md text-on-surface-variant hover:bg-surface hover:text-on-surface disabled:opacity-40`,children:(0,c.jsx)(o,{size:12})}),(0,c.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-body text-xs text-on-surface`,title:f?.path,children:[f?.host?`${f.host}:`:``,f?.path??u]})]}),p&&(0,c.jsx)(`p`,{className:`px-1 font-body text-xs text-error wrap-break-word`,children:p instanceof Error?p.message:String(p)}),(0,c.jsxs)(`ul`,{className:`max-h-48 overflow-y-auto`,children:[f?.directories.map(e=>(0,c.jsx)(`li`,{children:(0,c.jsxs)(`button`,{type:`button`,"data-testid":`remote-folder-entry`,onClick:()=>d(h(e)),className:`w-full min-h-11 flex items-center gap-1.5 px-1 py-0.5 rounded-md font-body text-xs text-on-surface-variant hover:bg-surface hover:text-on-surface`,children:[(0,c.jsx)(a,{size:11,className:`shrink-0 text-on-surface-variant`}),(0,c.jsx)(`span`,{className:`truncate`,children:e})]})},e)),f&&f.directories.length===0&&!m&&(0,c.jsx)(`li`,{className:`px-1 py-0.5 font-body text-xs text-on-surface-variant`,children:`No subfolders`})]}),(0,c.jsxs)(`div`,{className:`flex justify-end gap-1 px-1`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:l,className:`min-h-11 px-2 py-0.5 rounded-md font-label text-xs text-on-surface-variant hover:text-on-surface`,children:`Cancel`}),(0,c.jsx)(`button`,{type:`button`,"data-testid":`remote-folder-pick`,disabled:!f,onClick:()=>f&&n(f.path),className:`min-h-11 px-2 py-0.5 rounded-md bg-transparent border border-control-border text-on-surface font-label text-xs hover:bg-surface disabled:opacity-50`,children:`Use folder`})]})]})}export{l as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./check-hFtKhUSV.js";import{t as i}from"./chevron-down-D2sszSv3.js";import{t as a}from"./copy-d40YbOUX.js";import{t as o}from"./link-2-DSYfKX_9.js";import{n as s}from"./client-BEiLQQ-F.js";import{Cn as c,Dn as l,Lt as u,Pt as d,Sn as f,bn as p,en as m,kn as h,on as g,xn as _}from"./index-Ck-SDgTR.js";import{c as v,o as y,s as b}from"./live-sessions-D07BClP7.js";import{i as x,n as S,r as C,t as w}from"./terminal-links-B3ce99i1.js";var T=e(t(),1),E=n(),D=`inline-flex min-h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2 py-1 text-xs text-primary hover:bg-surface-highest disabled:opacity-50`;function O({session:e}){let{openLiveSession:t,info:n,terminals:O}=d(),k=l(),A=u(),[j]=h(),[M,N]=(0,T.useState)(!1),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(null),[B,V]=(0,T.useState)(!1),H=y(e),U=S(O,e.id),W=j.get(`project`)??e.project_id,G=[`claude`,`codex`].includes(e.agent)?!H||!e.cwd?`Session has no native session ID or working folder.`:e.status===`running`||e.status===`idle`?`End the original agent session before resuming it in chat.`:void 0:`Chat currently supports Claude and Codex sessions.`;(0,T.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2e3);return()=>clearTimeout(e)},[R]);async function K(){if(L(null),U)k(v(x(U.id),W));else{N(!0);try{await t(e)}catch(e){L(e instanceof Error?e.message:`Could not open terminal`)}finally{N(!1)}}}async function q(e,t){V(!1),L(null);try{await navigator.clipboard.writeText(e),z(t)}catch{L(`Clipboard access failed. Allow clipboard access and try again.`)}}async function J(){V(!1),F(!0),L(null);try{A.openThread(await s.chat.resume(e.id));let t=new URLSearchParams(j);t.delete(`session`),t.set(`chat`,`open`),k({search:t.toString()})}catch(e){L(e instanceof Error?e.message:`Could not resume in chat`)}finally{F(!1)}}return!H&&!U?(0,E.jsx)(`span`,{"data-testid":`resume-unavailable`,className:`block max-w-64 text-xs text-outline`,children:b(e)}):(0,E.jsxs)(`div`,{className:`max-w-72 space-y-1 text-left`,children:[(0,E.jsxs)(`fieldset`,{"aria-label":`Resume session`,className:`inline-flex`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`open-terminal-resume`,disabled:M||P||!U&&!n?.ready,onClick:()=>void K(),className:`${D} rounded-r-none`,children:[(0,E.jsx)(m,{size:13}),M?`Resuming…`:`Resume in terminal`]}),(0,E.jsxs)(p,{open:B,onOpenChange:V,children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,"data-testid":`resume-actions-menu`,"aria-label":`More session actions`,className:`${D} rounded-l-none border-l-0 px-2`,children:(0,E.jsx)(i,{size:13})})}),(0,E.jsx)(f,{children:(0,E.jsxs)(_,{align:`end`,sideOffset:4,collisionPadding:8,"aria-label":`Session actions`,"data-testid":`resume-actions-dropdown`,className:`z-50 w-56 rounded-md border border-border bg-surface-high p-1 shadow-lg`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`open-chat-resume`,disabled:M||P||!!G,title:G,onClick:()=>void J(),className:`${D} min-h-11 w-full justify-start border-0`,children:[(0,E.jsx)(g,{size:13}),P?`Resuming…`:`Continue in chat`]}),H&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`copy-resume`,className:`${D} w-full justify-start border-0`,title:H,onClick:()=>void q(H,`Resume command copied`),children:[R===`Resume command copied`?(0,E.jsx)(r,{size:13}):(0,E.jsx)(a,{size:13}),`Copy resume command`]}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`copy-terminal-link`,className:`${D} w-full justify-start border-0`,"aria-label":`Copy terminal link`,title:`Copy terminal link`,onClick:()=>void q(w(v(C(e.id),W)),`Terminal link copied`),children:[(0,E.jsx)(o,{size:13}),`Copy terminal link`]})]})})]})]}),n&&!n.ready&&!U&&(0,E.jsx)(`p`,{className:`text-xs text-outline`,children:n.reason??`Integrated terminals unavailable. Use the copied command in your own terminal.`}),R&&(0,E.jsx)(`p`,{role:`status`,"data-testid":`resume-feedback`,className:`text-xs text-outline`,children:R}),I&&(0,E.jsx)(`p`,{role:`alert`,className:`text-xs text-error wrap-break-word`,children:I})]})}export{O as t};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{t as r}from"./check-hFtKhUSV.js";import{t as i}from"./chevron-down-D2sszSv3.js";import{t as a}from"./copy-d40YbOUX.js";import{t as o}from"./link-2-DSYfKX_9.js";import{n as s}from"./client-BwhkVepQ.js";import{An as c,Cn as l,Lt as u,On as d,Pt as f,Sn as p,cn as m,tn as h,wn as g,xn as _}from"./index-CMRGRbC9.js";import{c as v,o as y,s as b}from"./live-sessions-D07BClP7.js";import{i as x,n as S,r as C,t as w}from"./terminal-links-B3ce99i1.js";var T=e(t(),1),E=n(),D=`inline-flex min-h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2 py-1 text-xs text-primary hover:bg-surface-highest disabled:opacity-50`;function O({session:e}){let{openLiveSession:t,info:n,terminals:O}=f(),k=d(),A=u(),[j]=c(),[M,N]=(0,T.useState)(!1),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(null),[B,V]=(0,T.useState)(!1),H=y(e),U=S(O,e.id),W=j.get(`project`)??e.project_id,G=[`claude`,`codex`].includes(e.agent)?!H||!e.cwd?`Session has no native session ID or working folder.`:e.status===`running`||e.status===`idle`?`End the original agent session before resuming it in chat.`:void 0:`Chat currently supports Claude and Codex sessions.`;(0,T.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2e3);return()=>clearTimeout(e)},[R]);async function K(){if(L(null),U)k(v(x(U.id),W));else{N(!0);try{await t(e)}catch(e){L(e instanceof Error?e.message:`Could not open terminal`)}finally{N(!1)}}}async function q(e,t){V(!1),L(null);try{await navigator.clipboard.writeText(e),z(t)}catch{L(`Clipboard access failed. Allow clipboard access and try again.`)}}async function J(){V(!1),F(!0),L(null);try{A.openThread(await s.chat.resume(e.id));let t=new URLSearchParams(j);t.delete(`session`),t.set(`chat`,`open`),k({search:t.toString()})}catch(e){L(e instanceof Error?e.message:`Could not resume in chat`)}finally{F(!1)}}return!H&&!U?(0,E.jsx)(`span`,{"data-testid":`resume-unavailable`,className:`block max-w-64 text-xs text-outline`,children:b(e)}):(0,E.jsxs)(`div`,{className:`max-w-72 space-y-1 text-left`,children:[(0,E.jsxs)(`fieldset`,{"aria-label":`Resume session`,className:`inline-flex`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`open-terminal-resume`,disabled:M||P||!U&&!n?.ready,onClick:()=>void K(),className:`${D} rounded-r-none`,children:[(0,E.jsx)(h,{size:13}),M?`Resuming…`:`Resume in terminal`]}),(0,E.jsxs)(_,{open:B,onOpenChange:V,children:[(0,E.jsx)(g,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,"data-testid":`resume-actions-menu`,"aria-label":`More session actions`,className:`${D} rounded-l-none border-l-0 px-2`,children:(0,E.jsx)(i,{size:13})})}),(0,E.jsx)(l,{children:(0,E.jsxs)(p,{align:`end`,sideOffset:4,collisionPadding:8,"aria-label":`Session actions`,"data-testid":`resume-actions-dropdown`,className:`z-50 w-56 rounded-md border border-border bg-surface-high p-1 shadow-lg`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`open-chat-resume`,disabled:M||P||!!G,title:G,onClick:()=>void J(),className:`${D} min-h-11 w-full justify-start border-0`,children:[(0,E.jsx)(m,{size:13}),P?`Resuming…`:`Continue in chat`]}),H&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`copy-resume`,className:`${D} w-full justify-start border-0`,title:H,onClick:()=>void q(H,`Resume command copied`),children:[R===`Resume command copied`?(0,E.jsx)(r,{size:13}):(0,E.jsx)(a,{size:13}),`Copy resume command`]}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`copy-terminal-link`,className:`${D} w-full justify-start border-0`,"aria-label":`Copy terminal link`,title:`Copy terminal link`,onClick:()=>void q(w(v(C(e.id),W)),`Terminal link copied`),children:[(0,E.jsx)(o,{size:13}),`Copy terminal link`]})]})})]})]}),n&&!n.ready&&!U&&(0,E.jsx)(`p`,{className:`text-xs text-outline`,children:n.reason??`Integrated terminals unavailable. Use the copied command in your own terminal.`}),R&&(0,E.jsx)(`p`,{role:`status`,"data-testid":`resume-feedback`,className:`text-xs text-outline`,children:R}),I&&(0,E.jsx)(`p`,{role:`alert`,className:`text-xs text-error wrap-break-word`,children:I})]})}export{O as t};