orc-ai 0.1.65 → 0.1.67

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 (112) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +1002 -879
  3. package/dist/skills/orc-platform/references/channels.md +1 -1
  4. package/dist/skills/orc-platform/references/chat-ui.md +1 -1
  5. package/dist/skills/orc-platform/references/execution.md +2 -2
  6. package/dist/skills/orc-platform/references/web.md +3 -3
  7. package/dist/web/assets/{Agents-CXxHOAVS.js → Agents-Btw9GSoH.js} +3 -3
  8. package/dist/web/assets/AreaChart-DcUZ3SzF.js +53 -0
  9. package/dist/web/assets/Audit-BrzyRS5i.js +1 -0
  10. package/dist/web/assets/BarChart-DAz5P98C.js +3 -0
  11. package/dist/web/assets/Chart-BNguc0T2.js +1 -0
  12. package/dist/web/assets/ChatAnalyticsCharts-B8DCNbHq.js +1 -0
  13. package/dist/web/assets/ChatUiRenderer-BR3sfc-Z.js +4 -0
  14. package/dist/web/assets/{ConfirmDialog-DKN0AVIw.js → ConfirmDialog-CtTOXkX8.js} +1 -1
  15. package/dist/web/assets/Dashboard-C5mM9PJs.js +1 -0
  16. package/dist/web/assets/{DocumentWorkspace-B9hQN2EX.js → DocumentWorkspace-BbG32kAW.js} +1 -1
  17. package/dist/web/assets/{FileEditor-BK8_4AJM.js → FileEditor-BCD6enuO.js} +1 -1
  18. package/dist/web/assets/IntegrationCallback-Bik_7SCS.js +1 -0
  19. package/dist/web/assets/JobWebhooks-RIKnoQh3.js +1 -0
  20. package/dist/web/assets/Jobs-CsSOIqGB.js +3 -0
  21. package/dist/web/assets/Knowledge-DKb5Bndb.js +1 -0
  22. package/dist/web/assets/{MarkdownRenderer-DM6lt7Sg.js → MarkdownRenderer-BCh_ruCd.js} +5 -5
  23. package/dist/web/assets/{NativeFolderField-D1ZqCzY1.js → NativeFolderField-D-0kw2x4.js} +1 -1
  24. package/dist/web/assets/{Notifications-Ciw_MC2q.js → Notifications-8mf4wQSZ.js} +1 -1
  25. package/dist/web/assets/PackageCatalog-DhD3xXBL.js +8 -0
  26. package/dist/web/assets/{PackageRunDialog-CW_N4ttU.js → PackageRunDialog-C4MAbUYz.js} +2 -2
  27. package/dist/web/assets/{PriorityBadge-CZt2elFq.js → PriorityBadge-CzL7cjTr.js} +1 -1
  28. package/dist/web/assets/Projects-CvtUb494.js +3 -0
  29. package/dist/web/assets/ReferenceLine-BPBQytfV.js +1 -0
  30. package/dist/web/assets/{ResponsiveFilters-BwU4JbGU.js → ResponsiveFilters-BDHgHwbe.js} +1 -1
  31. package/dist/web/assets/ResumeActions-CIHfpmTC.js +1 -0
  32. package/dist/web/assets/{Rules-Dqx8X4wX.js → Rules-D1bQTlzi.js} +4 -4
  33. package/dist/web/assets/ScratchpadDiagramEditor-DukGReMq.js +1 -0
  34. package/dist/web/assets/ScratchpadDiagramPreview-CICRpF10.js +1 -0
  35. package/dist/web/assets/Scratchpads-BPiujcq_.js +10 -0
  36. package/dist/web/assets/SessionContextChart-CfkrwDME.js +1 -0
  37. package/dist/web/assets/Settings-CM3tx3Gz.js +14 -0
  38. package/dist/web/assets/Skills-CwHwz6Er.js +3 -0
  39. package/dist/web/assets/{SourceEditor-CKe3Nz5k.js → SourceEditor-DGpMMbEA.js} +4 -4
  40. package/dist/web/assets/{TagInput-QqNDQOz_.js → TagInput-FeirXeiF.js} +1 -1
  41. package/dist/web/assets/TaskDetailSheet-CK2rs3F0.js +1 -0
  42. package/dist/web/assets/{Tasks-daCTnumY.js → Tasks-Dbxfmfm1.js} +7 -7
  43. package/dist/web/assets/Terminals-CeK7rAIg.js +1 -0
  44. package/dist/web/assets/Terminals-CmbOGMJQ.css +1 -0
  45. package/dist/web/assets/{ViewHeader-BiFirRWq.js → ViewHeader-CdTYgjcL.js} +1 -1
  46. package/dist/web/assets/Webhooks-1EQvtBPS.js +1 -0
  47. package/dist/web/assets/{badge-BEhHQEk0.js → badge-DkZMrS1S.js} +1 -1
  48. package/dist/web/assets/{button-BlVCkBiz.js → button-DeTgVWBh.js} +1 -1
  49. package/dist/web/assets/check-LRl-dSYs.js +1 -0
  50. package/dist/web/assets/chevron-down-DtC3kwL9.js +1 -0
  51. package/dist/web/assets/{circle-check-CrMHbBhC.js → circle-check-DmFYS6qN.js} +1 -1
  52. package/dist/web/assets/client-C0cF5m6-.js +1 -0
  53. package/dist/web/assets/{dist-BxZ8dALn.js → dist-CG7sCn9m.js} +1 -1
  54. package/dist/web/assets/dist-DxPLB3GS.js +1 -0
  55. package/dist/web/assets/{download-Cnjcb403.js → download-vwV9XGjB.js} +1 -1
  56. package/dist/web/assets/{highlighted-body-JLMTFACH-DqkWK4Ru.js → highlighted-body-JLMTFACH-DBFcem9W.js} +1 -1
  57. package/dist/web/assets/index-BoyulwgO.js +137 -0
  58. package/dist/web/assets/index-CMgQ_c5f.css +1 -0
  59. package/dist/web/assets/{maximize-2-ar3sWM7r.js → maximize-2-DkkQv64-.js} +1 -1
  60. package/dist/web/assets/mermaid-WFAXDIZX-DX9Leemp.js +1 -0
  61. package/dist/web/assets/scroll-area-Bz4B8g7w.js +1 -0
  62. package/dist/web/assets/{table-D2GMF--l.js → table-BghcPb3T.js} +1 -1
  63. package/dist/web/assets/{upload-Bbixlc7i.js → upload-DM_myzsG.js} +1 -1
  64. package/dist/web/assets/{useIntegrations-D5PIxedU.js → useIntegrations-CwksniBf.js} +1 -1
  65. package/dist/web/assets/{useJobs-DYaqHA8F.js → useJobs-CLj3jAlx.js} +1 -1
  66. package/dist/web/assets/{useListSelection-BKCFyGyf.js → useListSelection-BCmeXReo.js} +1 -1
  67. package/dist/web/assets/{useMemories-Ce1S_iFK.js → useMemories-xytUq8G9.js} +1 -1
  68. package/dist/web/assets/x-BbZ0euHI.js +1 -0
  69. package/dist/web/index.html +18 -15
  70. package/package.json +1 -1
  71. package/dist/web/assets/Audit-B38_H4W1.js +0 -1
  72. package/dist/web/assets/ChatUiRenderer-BYlgsVLZ.js +0 -4
  73. package/dist/web/assets/Dashboard-BZKUS4Tw.js +0 -1
  74. package/dist/web/assets/ErrorState-CpcyNx03.js +0 -1
  75. package/dist/web/assets/IntegrationCallback-DCf4a1AA.js +0 -1
  76. package/dist/web/assets/JobWebhooks-C2F4RzTr.js +0 -1
  77. package/dist/web/assets/Jobs-Dho4B9b-.js +0 -3
  78. package/dist/web/assets/Knowledge-CDhPBr8J.js +0 -1
  79. package/dist/web/assets/PackageCatalog-BuT4GoJo.js +0 -8
  80. package/dist/web/assets/Pager-B-GnS1ry.js +0 -1
  81. package/dist/web/assets/Projects-C27puQUE.js +0 -3
  82. package/dist/web/assets/ResumeActions-S3h5yKXv.js +0 -1
  83. package/dist/web/assets/ScratchpadDiagramEditor-iUkemC_h.js +0 -1
  84. package/dist/web/assets/ScratchpadDiagramPreview-Cmim9yNA.js +0 -1
  85. package/dist/web/assets/Scratchpads-DRIBlLwW.js +0 -10
  86. package/dist/web/assets/SessionContextChart-CXAR0czK.js +0 -53
  87. package/dist/web/assets/SessionHomeLink-DKoq9wT8.js +0 -1
  88. package/dist/web/assets/Sessions-DBthIWpR.js +0 -5
  89. package/dist/web/assets/Settings-DU-nfC2z.js +0 -14
  90. package/dist/web/assets/Skills-BPkciOfy.js +0 -3
  91. package/dist/web/assets/StatusBadge-Cz0GkMFG.js +0 -1
  92. package/dist/web/assets/TaskDetailSheet-BGAiFxPD.js +0 -1
  93. package/dist/web/assets/Terminals-CmRdwS_i.js +0 -2
  94. package/dist/web/assets/Terminals-D-D3Ovm0.css +0 -1
  95. package/dist/web/assets/Webhooks-8B-qbOiF.js +0 -1
  96. package/dist/web/assets/check-cnj-S1QW.js +0 -1
  97. package/dist/web/assets/chevron-down-CsfelGxA.js +0 -1
  98. package/dist/web/assets/chevron-up-COeKodk9.js +0 -1
  99. package/dist/web/assets/client-RPZmgRqE.js +0 -1
  100. package/dist/web/assets/dist-B-iYpxX5.js +0 -1
  101. package/dist/web/assets/dist-D8Wfxh48.js +0 -1
  102. package/dist/web/assets/dist-bytwC6rk.js +0 -1
  103. package/dist/web/assets/index-DMLXoHsj.css +0 -1
  104. package/dist/web/assets/index-DsVJrhHJ.js +0 -134
  105. package/dist/web/assets/live-sessions-DYGSpoN-.js +0 -1
  106. package/dist/web/assets/mermaid-WFAXDIZX-3nzsUtGy.js +0 -1
  107. package/dist/web/assets/scratchpad-kinds-BFBap9Ix.js +0 -1
  108. package/dist/web/assets/scratchpad-routes-DqBRARVl.js +0 -1
  109. package/dist/web/assets/scroll-area-BN-yOL-R.js +0 -1
  110. package/dist/web/assets/send-CwHls3BT.js +0 -1
  111. package/dist/web/assets/useSessions-D1nMvBf0.js +0 -1
  112. package/dist/web/assets/x-uOircJYm.js +0 -1
@@ -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-CRAWY7v2.js";import{t as i}from"./button-BlVCkBiz.js";import{n as a}from"./client-RPZmgRqE.js";import{Gt as o,Yr as s}from"./index-DsVJrhHJ.js";var c=e(t(),1),l=n();function u(e,t=`the folder`){let n=e.level===`identical`?`Identical to`:e.level===`near`?`Near copy of`:`Similar to`,r=e.where===`orc`?`in ORC`:`in ${t}`;return`${n} ${e.name} ${r} (${Math.round(e.score*100)}%)`}function d({match:e,folder:t}){return e?(0,l.jsx)(`span`,{className:`block text-xs text-warning wrap-break-word`,"data-testid":`transfer-match`,children:u(e,t)}):null}var f=`project:`;function p({withSkillsOnly:e}){return(r({queryKey:[`skills`,`project-folders`],queryFn:()=>a.skills.projectFolders()}).data?.projects??[]).map(t=>{let n=t.folders.filter(t=>!e||t.skills>0);return n.length?(0,l.jsx)(`optgroup`,{label:`Project ${t.project_name} (${t.root})`,children:n.map(e=>(0,l.jsxs)(`option`,{value:`${f}${e.dir}`,children:[t.project_name,`: `,e.label,` (`,e.dir,e.skills?`, ${e.skills} skills`:``,`)`]},e.dir))},t.root):null})}function m({id:e,label:t,value:n,onChange:r,disabled:a}){let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,l.jsx)(s,{id:e,"data-testid":e,value:n,disabled:a,placeholder:`Absolute folder path on the API host`,onChange:e=>r(e.target.value)}),(0,l.jsx)(i,{type:`button`,variant:`outline`,ref:f,"data-testid":`${e}-browse`,disabled:a,onClick:()=>d(!0),children:`Browse`})]}),(0,l.jsx)(o,{open:u,onOpenChange:d,host:null,initial:n,onPick:r,returnFocusRef:f})]})}export{p as i,m as n,f as r,d 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-CRAWY7v2.js";import{t as i}from"./button-DeTgVWBh.js";import{n as a}from"./client-C0cF5m6-.js";import{Xt as o,_i as s}from"./index-BoyulwgO.js";var c=e(t(),1),l=n();function u(e,t=`the folder`){let n=e.level===`identical`?`Identical to`:e.level===`near`?`Near copy of`:`Similar to`,r=e.where===`orc`?`in ORC`:`in ${t}`;return`${n} ${e.name} ${r} (${Math.round(e.score*100)}%)`}function d({match:e,folder:t}){return e?(0,l.jsx)(`span`,{className:`block text-xs text-warning wrap-break-word`,"data-testid":`transfer-match`,children:u(e,t)}):null}var f=`project:`;function p({withSkillsOnly:e}){return(r({queryKey:[`skills`,`project-folders`],queryFn:()=>a.skills.projectFolders()}).data?.projects??[]).map(t=>{let n=t.folders.filter(t=>!e||t.skills>0);return n.length?(0,l.jsx)(`optgroup`,{label:`Project ${t.project_name} (${t.root})`,children:n.map(e=>(0,l.jsxs)(`option`,{value:`${f}${e.dir}`,children:[t.project_name,`: `,e.label,` (`,e.dir,e.skills?`, ${e.skills} skills`:``,`)`]},e.dir))},t.root):null})}function m({id:e,label:t,value:n,onChange:r,disabled:a}){let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,l.jsx)(s,{id:e,"data-testid":e,value:n,disabled:a,placeholder:`Absolute folder path on the API host`,onChange:e=>r(e.target.value)}),(0,l.jsx)(i,{type:`button`,variant:`outline`,ref:f,"data-testid":`${e}-browse`,disabled:a,onClick:()=>d(!0),children:`Browse`})]}),(0,l.jsx)(o,{open:u,onOpenChange:d,host:null,initial:n,onPick:r,returnFocusRef:f})]})}export{p as i,m as n,f as r,d 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{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-BlVCkBiz.js";import{Bi as o,Fi as s,Ln as c,Rn as l}from"./index-DsVJrhHJ.js";import{t as u}from"./ViewHeader-BiFirRWq.js";var d=e(t(),1),f=n();function p(){let e=l(),t=r(),[n]=i(),p=n.get(`request`),m=e.setSelected;return(0,d.useEffect)(()=>{p&&m(p)},[p,m]),(0,f.jsxs)(`div`,{"data-testid":`notifications-page`,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[e.phone?(0,f.jsxs)(`header`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border px-2`,children:[(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-back`,"aria-label":`Back`,className:`min-h-11 min-w-11`,onClick:()=>{(window.history.state?.idx??0)>0?t(-1):t(`/activity`)},children:(0,f.jsx)(o,{})}),(0,f.jsx)(`h1`,{className:`min-w-0 truncate font-headline text-base font-medium text-on-surface`,children:`Notifications`}),e.unread>0&&(0,f.jsxs)(`span`,{className:`shrink-0 text-sm text-outline`,children:[e.unread,` unread`]}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-mark-all-read`,"aria-label":`Mark all read`,title:`Mark all read`,className:`min-h-11 min-w-11`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:(0,f.jsx)(s,{})})]}):(0,f.jsx)(`div`,{className:`shrink-0 px-6 pt-6`,children:(0,f.jsx)(u,{title:`Notifications`,meta:`${e.unread} unread`,action:(0,f.jsxs)(a,{size:`sm`,variant:`ghost`,"data-testid":`notifications-mark-all-read`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:[(0,f.jsx)(s,{}),` Mark all read`]})})}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]`,children:(0,f.jsx)(c,{onOpenRequest:t=>{e.setSelected(t);let n=e.items.find(e=>e.type===`human.request`&&e.source_id===t);n&&!n.read_at&&e.setRead(n.id,!0)}})})]})}export{p as default};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-DeTgVWBh.js";import{aa as o,ar as s,or as c,ua as l}from"./index-BoyulwgO.js";import{t as u}from"./ViewHeader-CdTYgjcL.js";var d=e(t(),1),f=n();function p(){let e=c(),t=r(),[n]=i(),p=n.get(`request`),m=e.setSelected;return(0,d.useEffect)(()=>{p&&m(p)},[p,m]),(0,f.jsxs)(`div`,{"data-testid":`notifications-page`,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[e.phone?(0,f.jsxs)(`header`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border px-2`,children:[(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-back`,"aria-label":`Back`,className:`min-h-11 min-w-11`,onClick:()=>{(window.history.state?.idx??0)>0?t(-1):t(`/activity`)},children:(0,f.jsx)(l,{})}),(0,f.jsx)(`h1`,{className:`min-w-0 truncate font-headline text-base font-medium text-on-surface`,children:`Notifications`}),e.unread>0&&(0,f.jsxs)(`span`,{className:`shrink-0 text-sm text-outline`,children:[e.unread,` unread`]}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-mark-all-read`,"aria-label":`Mark all read`,title:`Mark all read`,className:`min-h-11 min-w-11`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:(0,f.jsx)(o,{})})]}):(0,f.jsx)(`div`,{className:`shrink-0 px-6 pt-6`,children:(0,f.jsx)(u,{title:`Notifications`,meta:`${e.unread} unread`,action:(0,f.jsxs)(a,{size:`sm`,variant:`ghost`,"data-testid":`notifications-mark-all-read`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:[(0,f.jsx)(o,{}),` Mark all read`]})})}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]`,children:(0,f.jsx)(s,{onOpenRequest:t=>{e.setSelected(t);let n=e.items.find(e=>e.type===`human.request`&&e.source_id===t);n&&!n.read_at&&e.setRead(n.id,!0)}})})]})}export{p as default};
@@ -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-CRAWY7v2.js";import{f as o,h as s}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as c}from"./button-DeTgVWBh.js";import{P as l,n as u}from"./client-C0cF5m6-.js";import{t as d}from"./ResponsiveFilters-BDHgHwbe.js";import{t as f}from"./upload-DM_myzsG.js";import{At as p,Cn as m,Ei as h,On as g,Ot as _,Qi as v,Tn as y,_i as b,_n as x,bn as S,di as C,fi as w,gi as T,gn as E,hn as D,it as O,kn as k,li as A,wn as j,yn as M}from"./index-BoyulwgO.js";import{t as N}from"./save-file-3ZpJah8W.js";import{a as P,i as F,n as ee,r as I,t as te}from"./PackageRunDialog-C4MAbUYz.js";import{t as L}from"./ViewHeader-CdTYgjcL.js";import{t as R}from"./useDetailRoute-B-xjWsyW.js";import{t as z}from"./view-params-YEmeZppw.js";import{t as B}from"./primitive-files-BKGHFjYN.js";var V={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`}]]};V.node;var ne=l(V),H=Uint8Array,U=Uint16Array,W=Int32Array,G=new H([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 H([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]),K=new H([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ie=function(e,t){for(var n=new U(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new W(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}},q=ie(G,2),ae=q.b,oe=q.r;ae[28]=258,oe[258]=28;for(var se=ie(re,0),ce=se.b,J=se.r,le=new U(32768),Y=0;Y<32768;++Y){var ue=(Y&43690)>>1|(Y&21845)<<1;ue=(ue&52428)>>2|(ue&13107)<<2,ue=(ue&61680)>>4|(ue&3855)<<4,le[Y]=((ue&65280)>>8|(ue&255)<<8)>>1}for(var de=(function(e,t,n){for(var r=e.length,i=0,a=new U(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new U(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new U(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[le[d]>>c]=l}else for(s=new U(r),i=0;i<r;++i)e[i]&&(s[i]=le[o[e[i]-1]++]>>15-e[i]);return s}),fe=new H(288),Y=0;Y<144;++Y)fe[Y]=8;for(var Y=144;Y<256;++Y)fe[Y]=9;for(var Y=256;Y<280;++Y)fe[Y]=7;for(var Y=280;Y<288;++Y)fe[Y]=8;for(var pe=new H(32),Y=0;Y<32;++Y)pe[Y]=5;var me=de(fe,9,0),he=de(fe,9,1),ge=de(pe,5,0),_e=de(pe,5,1),ve=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ye=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},be=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},xe=function(e){return(e+7)/8|0},Se=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new H(e.subarray(t,n))},Ce=[`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||Ce[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,X),!n)throw r;return r},we=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new H(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new H(i*3));var l=function(e){var t=n.length;if(e>t){var r=new H(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=ye(e,d,1);var v=ye(e,d+1,3);if(d+=3,!v){var y=xe(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=he,m=_e,h=9,g=5;else if(v==2){var S=ye(e,d,31)+257,C=ye(e,d+10,15)+4,w=S+ye(e,d+5,31)+1;d+=14;for(var T=new H(w),E=new H(19),D=0;D<C;++D)E[K[D]]=ye(e,d+D*3,7);d+=C*3;for(var O=ve(E),k=(1<<O)-1,A=de(E,O,1),D=0;D<w;){var j=A[ye(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+ye(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+ye(e,d,7),d+=3):y==18&&(N=11+ye(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=ve(P),g=ve(F),p=de(P,h,1),m=de(F,g,1)}else X(1);if(d>_){c&&X(0);break}}s&&l(f+131072);for(var ee=(1<<h)-1,I=(1<<g)-1,te=d;;te=d){var M=p[be(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){te=d,p=null;break}else{var R=L-254;if(L>264){var D=L-257,z=G[D];R=ye(e,d,(1<<z)-1)+ae[D],d+=z}var B=m[be(e,d)&I],V=B>>4;B||X(3),d+=B&15;var F=ce[V];if(V>3){var z=re[V];F+=be(e,d)&(1<<z)-1,d+=z}if(d>_){c&&X(0);break}s&&l(f+131072);var ne=f+R;if(f<F){var U=a-F,W=Math.min(F,ne);for(U+f<0&&X(3);f<W;++f)n[f]=r[U+f]}for(;f<ne;++f)n[f]=n[f-F]}}t.l=p,t.p=te,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?Se(n,0,f):n.subarray(0,f)},Te=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Ee=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},De=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:Pe,l:0};if(i==1){var o=new H(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 U(f+1),m=Oe(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 H(p),l:m}},Oe=function(e,t,n){return e.s==-1?Math.max(Oe(e.l,t,n+1),Oe(e.r,t,n+1)):t[e.s]=n},ke=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new U(++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}},Ae=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},je=function(e,t,n){var r=n.length,i=xe(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},Me=function(e,t,n,r,i,a,o,s,c,l,u){Te(t,u++,n),++i[256];for(var d=De(i,15),f=d.t,p=d.l,m=De(a,15),h=m.t,g=m.l,_=ke(f),v=_.c,y=_.n,b=ke(h),x=b.c,S=b.n,C=new U(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=De(C,7),E=T.t,D=T.l,O=19;O>4&&!E[K[O-1]];--O);var k=l+5<<3,A=Ae(i,fe)+Ae(a,pe)+o,j=Ae(i,f)+Ae(a,h)+o+14+3*O+Ae(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return je(t,u,e.subarray(c,c+l));var M,N,P,F;if(Te(t,u,1+(j<A)),u+=2,j<A){M=de(f,p,0),N=f,P=de(h,g,0),F=h;var ee=de(E,D,0);Te(t,u,y-257),Te(t,u+5,S-1),Te(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)Te(t,u+3*w,E[K[w]]);u+=3*O;for(var I=[v,x],te=0;te<2;++te)for(var L=I[te],w=0;w<L.length;++w){var R=L[w]&31;Te(t,u,ee[R]),u+=E[R],R>15&&(Te(t,u,L[w]>>5&127),u+=L[w]>>12)}}else M=me,N=fe,P=ge,F=pe;for(var w=0;w<s;++w){var z=r[w];if(z>255){var R=z>>18&31;Ee(t,u,M[R+257]),u+=N[R+257],R>7&&(Te(t,u,z>>23&31),u+=G[R]);var B=z&31;Ee(t,u,P[B]),u+=F[B],B>3&&(Ee(t,u,z>>5&8191),u+=re[B])}else Ee(t,u,M[z]),u+=N[z]}return Ee(t,u,M[256]),u+N[256]},Ne=new W([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pe=new H(0),Fe=function(e,t,n,r,i,a){var o=a.z||e.length,s=new H(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=Ne[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new U(32768),g=a.h||new U(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new W(25e3),x=new U(288),S=new U(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=Me(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,I=A-j&32767;if(M>2&&k==y(T-I))for(var te=Math.min(f,M)-1,L=Math.min(32767,T),R=Math.min(258,M);I<=L&&--ee&&A!=j;){if(e[T+P]==e[T+P-I]){for(var z=0;z<R&&e[T+z]==e[T+z-I];++z);if(z>P){if(P=z,F=I,z>te)break;for(var B=Math.min(I,z-2),V=0,N=0;N<B;++N){var ne=T-I+N&32767,K=ne-h[ne]&32767;K>V&&(V=K,j=ne)}}}A=j,j=h[A],I+=A-j&32767}if(F){b[E++]=268435456|oe[P]<<18|J[F];var ie=oe[P]&31,q=J[F]&31;w+=G[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=Me(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=je(c,u+1,e.subarray(T,ae))}a.i=o}return Se(s,0,r+xe(u)+i)},Ie=(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})(),Le=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Ie[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Re=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new H(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Fe(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)},ze=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},Be=function(e,t){return e[t]|e[t+1]<<8},Ve=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},He=function(e,t){return Ve(e,t)+Ve(e,t+4)*4294967296},Z=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ue(e,t){return Re(e,t||{},0,0)}function We(e,t){return we(e,{i:2},t&&t.out,t&&t.dictionary)}var Ge=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=ze(r,a[1]),a=a[0]),ArrayBuffer.isView(a)?n[o]=[a,s]:(n[o+=`/`]=[new H(0),s],Ge(a,o,n,r))}},Ke=typeof TextEncoder<`u`&&new TextEncoder,qe=typeof TextDecoder<`u`&&new TextDecoder;try{qe.decode(Pe,{stream:!0})}catch{}var Je=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:Se(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 Ye(e,t){if(t){for(var n=new H(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Ke)return Ke.encode(e);for(var i=e.length,a=new H(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 H(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 Se(a,0,o)}function Xe(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(qe)return qe.decode(e);var i=Je(e),a=i.s,n=i.r;return n.length&&X(8),a}var Ze=function(e,t){return t+30+Be(e,t+26)+Be(e,t+28)},Qe=function(e,t,n){var r=Be(e,t+28),i=Be(e,t+30),a=Xe(e.subarray(t+46,t+46+r),!(Be(e,t+8)&2048)),o=t+46+r,s=$e(e,o,i,n,Ve(e,t+20),Ve(e,t+24),Ve(e,t+42)),c=s[0],l=s[1],u=s[2];return[Be(e,t+10),c,l,a,o+i+Be(e,t+32),u]},$e=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+Be(e,t+2))if(Be(e,t)==1)return[s?He(e,t+4+8*c):i,c?He(e,t+4):a,l?He(e,t+4+8*(c+s)):o,1];r<2&&X(13)}return[i,a,o,0]},et=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},tt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=et(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},nt=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 rt(e,t){t||={};var n={},r=[];Ge(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=Ye(o),f=d.length,p=l.comment,m=p&&Ye(p),h=m&&m.length,g=et(l.extra);f>65535&&X(11);var _=u?Ue(c,l):c,v=_.length,y=Le();y.p(c),r.push(ze(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 H(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];tt(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+et(d.extra);b.set(d.c,d.o+w),tt(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return nt(b,i,r.length,S,x),b}function it(e,t){for(var n={},r=e.length-22;Ve(e,r)!=101010256;--r)(!r||e.length-r>65558)&&X(13);var i=Be(e,r+8);if(!i)return{};var a=Ve(e,r+16),o=Ve(e,r-20)==117853008;if(o){var s=Ve(e,r-12);o=Ve(e,s)==101075792,o&&(i=Ve(e,s+32),a=Ve(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=Qe(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=Ze(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=We(e.subarray(_,_+f),{out:new H(p)}):X(14,`unknown compression type `+d):n[m]=Se(e,_,_+f))}return n}var Q=e(t(),1),$=n();function at({files:e,readOnly:t=!1,onChange:n,testId:r}){let[i,a]=z(t?`packageFile`:`packageDraftFile`,e[0]?.path??``),[o,s]=z(`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)(_,{mode:p(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 ot({name:e,onClose:t,onUse:n,onEdit:r,onDelete:a,onExport:o,onSource:s,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]}}),h=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)(m,{open:!0,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(y,{defaultWidth:960,resizeKey:`packages`,"data-testid":`package-detail-sheet`,children:[(0,$.jsx)(g,{children:(0,$.jsx)(k,{children:e})}),(0,$.jsxs)(j,{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`,h?` · ${h}`:``,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)(c,{size:`sm`,"data-testid":`package-detail-run`,onClick:n,disabled:l,children:`Use package`}),r&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-edit`,variant:`ghost`,onClick:r,disabled:l,children:`Edit`}),a&&(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`text-destructive`,"data-testid":`package-detail-delete`,onClick:a,disabled:l,children:`Delete package`}),o&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-export-artifact`,variant:`ghost`,onClick:o,disabled:l,children:l?`Preparing…`:`Installation export`}),s&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-export`,variant:`ghost`,onClick:s,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)(at,{files:p.data??[],readOnly:!0,testId:`package-file-content`})]})]})]})})}var st=`https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`;function ct(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:st,name:`my-agent-package`,version:`1.0.0`,description:`Describe when to use this configuration`},null,2)}function lt(e,t){let n=t===`apm`?ee(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 ut(e,t,n,r){if(t===`agent-plugin`)return JSON.stringify({...lt(e,t),[n]:r},null,2);let i=ee(e);if(i.errors.length)throw Error(`Fix the manifest before switching to fields`);return i.set(n,r),i.toString()}function dt(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 ft(e,t){return`${e?.match(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n)?/)?.[0]??`---
6
+ description: Shared package instructions
7
+ ---
8
+ `}${t}`}function pt(e,t){let n=ee(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=ee(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);F(a)&&(a.flow=!1);let o=i.getIn([`dependencies`,`mcp`],!0);if(P(o)){o.flow=!1;for(let e of o.items)F(e)&&(e.flow=!1)}return i.toString()}function mt(e,t){let n=lt(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 ht=new Map;typeof window<`u`&&window.addEventListener(`beforeunload`,e=>{ht.size&&(e.preventDefault(),e.returnValue=``)});function gt(e){ht.delete(e)}function _t(e){return ht.get(e)?.baseline}function vt(e){return ht.has(e)?window.confirm(`Discard unsaved package changes?`)?(gt(e),!0):!1:!0}var yt=`.apm/instructions/general.instructions.md`;function bt({initial:e,pending:t,error:n,onSave:r}){let[a,o]=z(`packageFormat`,``,[``,`apm`,`agent-plugin`]),s=(0,Q.useRef)(ht.get(e?.name??`new`)),l=e?.format??(a||void 0),d=l,[f,p]=(0,Q.useState)(s.current?.source??e?.content??ct(l??`apm`)),[m,h]=(0,Q.useState)(s.current?.files??e?.files??[]),[g,v]=(0,Q.useState)(s.current?.selectedSkills??[]),[y,C]=(0,Q.useState)(``),[w,D]=z(`packageTab`,e?`files`:`configuration`,[`files`,`configuration`,`skills`]),[k,A]=z(`packageSource`,`fields`,[`fields`,`source`]),j=k===`source`,N=e=>A(e?`source`:`fields`),[P,F]=(0,Q.useState)(),[ee,te]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(``),[V,ne]=(0,Q.useState)(s.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}}}),G=i({queryKey:[`agents`],queryFn:u.agents.list}),re=(0,Q.useMemo)(()=>{try{return{fields:lt(f,d??`apm`),error:void 0}}catch(e){return{fields:void 0,error:e.message}}},[f,d]),K=re.fields,ie=typeof K?.name==`string`?K.name:``,q=t||ee,ae=m.find(e=>e.path===yt),oe=ae?.content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,``)??``,se=m.find(e=>e.path===`mcp.json`);(0,Q.useEffect)(()=>{f!==(e?.content??ct(d??`apm`))||JSON.stringify(m)!==JSON.stringify(e?.files??[])||g.length>0||V!==void 0?ht.set(e?.name??`new`,{format:d??ht.get(e?.name??`new`)?.format??s.current?.format,source:f,files:m,selectedSkills:g,mcpDraft:V,baseline:s.current?.baseline??e}):ht.delete(e?.name??`new`)},[f,m,g,V,d,e]);function ce(e,t){try{p(ut(f,d??`apm`,e,t)),F(void 0)}catch(e){F(e.message)}}function J(t){let n=ht.get(e?.name??`new`);n&&n.format===t?(o(t),p(n.source),h(n.files),v(n.selectedSkills),ne(n.mcpDraft)):(!n||vt(e?.name??`new`))&&(o(t),p(ct(t)),h([]),v([]),ne(void 0))}return(0,$.jsxs)(E,{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)(M,{children:[(0,$.jsx)(S,{className:`wrap-break-word pr-8`,children:e?`Edit ${e.name}`:`New package`}),(0,$.jsx)(x,{children:`Save a configuration once, then use it in any project.`})]}),d?(0,$.jsxs)(`form`,{className:`min-w-0 space-y-4`,onSubmit:e=>{if(e.preventDefault(),!H){F(void 0);try{let e=mt(f,d);d===`agent-plugin`&&se&&JSON.parse(se.content),r({name:e.name,content:f,files:m,format:d,skills:g})}catch(e){F(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:d===`apm`?`APM`:`Plugin`}),!e&&(0,$.jsx)(c,{type:`button`,variant:`ghost`,disabled:q,onClick:()=>{vt(`new`)&&(o(``),p(ct(`apm`)),h([]),v([]),ne(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)(c,{type:`button`,role:`tab`,"aria-selected":w===e,variant:w===e?`default`:`ghost`,"data-testid":`package-editor-${e}`,onClick:()=>D(e),children:[e[0]?.toUpperCase(),e.slice(1),e===`skills`&&g.length?` (${g.length})`:``]},e))}),(0,$.jsxs)(`fieldset`,{disabled:q,className:`min-w-0 space-y-4`,children:[w===`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:d===`apm`?`APM configuration`:`Portable plugin identity`}),(0,$.jsx)(c,{type:`button`,variant:`outline`,"data-testid":`package-editor-mode`,disabled:!!H||j&&!!re.error,onClick:()=>{N(!j),ne(void 0)},children:j?`Edit fields`:d===`apm`?`Edit YAML`:`Edit JSON`})]}),j?(0,$.jsx)(_,{id:`package-yaml`,testId:`package-yaml-input`,path:d===`apm`?`apm.yml`:`plugin.json`,value:f,onChange:p,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)(O,{htmlFor:`package-${t}`,children:n}),(0,$.jsx)(b,{id:`package-${t}`,"data-testid":`package-${t}-input`,disabled:t===`name`&&!!e,value:typeof K?.[t]==`string`?K[t]:``,onChange:e=>ce(t,e.target.value)})]},t))}),d===`apm`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(O,{htmlFor:`package-apm-mcp`,children:`MCP servers (YAML declarations)`}),(0,$.jsx)(_,{id:`package-apm-mcp`,path:`mcp-dependencies.yml`,testId:`package-apm-mcp`,height:180,readOnly:q,value:V??I(K?.dependencies?.mcp??[]),onChange:e=>{ne(e);try{p(pt(f,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)(O,{htmlFor:`package-instructions`,children:`Shared instructions`}),(0,$.jsx)(T,{id:`package-instructions`,"data-testid":`package-instructions`,rows:7,placeholder:`What should the agent know and how should it work?`,value:oe,onChange:e=>h(dt(m,yt,ft(ae?.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)(O,{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){te(!0);try{let e=await u.agents.get(t),n=t.split(`/`).slice(-1)[0]?.replace(/[^a-zA-Z0-9-]/g,`-`)??`agent`;h(t=>dt(t,`.apm/agents/${n}.agent.md`,e.raw))}catch(e){F(e.message)}finally{te(!1)}}},children:[(0,$.jsx)(`option`,{value:``,children:`Select an agent to copy into this package…`}),G.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)(O,{children:`mcp.json (optional)`}),(0,$.jsx)(_,{path:`mcp.json`,testId:`package-mcp-input`,height:220,value:se?.content??JSON.stringify({$schema:`https://agent-plugins.org/schemas/1.0.0/mcp.schema.json`,mcpServers:{}},null,2),readOnly:q,onChange:e=>h(dt(m,`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.`})]})]})]})]}),w===`skills`&&(0,$.jsxs)($.Fragment,{children:[m.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)(c,{type:`button`,variant:`outline`,"data-testid":`package-skill-remove`,onClick:()=>h(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)(b,{"aria-label":`Search existing skills`,"data-testid":`package-skill-search`,placeholder:`Search your skills…`,value:y,onChange:e=>C(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(y.toLowerCase())).map(e=>{let t=e.name.split(`/`).slice(-1)[0],n=m.some(e=>e.path===`${d===`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||g.includes(e.name),disabled:n||q||!g.includes(e.name)&&g.length>=32,onChange:t=>v(t.target.checked?[...g,e.name]:g.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.`})]}),w===`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)(O,{htmlFor:`package-files`,children:`Add files from a folder`}),(0,$.jsx)(b,{id:`package-files`,"data-testid":`package-files-input`,type:`file`,multiple:!0,webkitdirectory:``,onChange:async e=>{let t=e.target.files;if(t?.length){te(!0);try{let e=(await B(t)).filter(e=>![`apm.yml`,`plugin.json`].includes(e.path));h(t=>[...t.filter(t=>!e.some(e=>e.path===t.path)),...e]),F(void 0)}catch(e){F(e.message)}finally{te(!1)}}}}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(b,{"aria-label":`New file path`,"data-testid":`package-new-file-path`,placeholder:d===`apm`?`.apm/agents/reviewer.agent.md`:`skills/my-skill/SKILL.md`,value:L,onChange:e=>R(e.target.value)}),(0,$.jsx)(c,{type:`button`,variant:`outline`,disabled:!L||m.some(e=>e.path===L),onClick:()=>{h(e=>[...e,{path:L,content:``,encoding:`utf8`}]),R(``)},children:`Add file`})]})]}),(0,$.jsx)(at,{files:[{path:d===`apm`?`apm.yml`:`plugin.json`,content:f},...m],readOnly:q,testId:`package-file-input`,onChange:(e,t)=>{e===(d===`apm`?`apm.yml`:`plugin.json`)?p(t):h(n=>dt(n,e,t))}})]})]}),(n||P||re.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-editor-error`,className:`text-sm text-destructive`,children:n||P||re.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:[m.length,` files · `,g.length,` skills selected`]}),(0,$.jsx)(c,{type:`submit`,"data-testid":`package-submit`,disabled:q||!ie.trim()||!!(re.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:()=>J(`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:()=>J(`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 xt(e){if(e.length>16777216)throw Error(`Archive exceeds 16 MiB`);let t=0,n=0,r=it(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 St({onClose:e,onImported:t}){let[n,r]=z(`importMethod`,`git`,[`git`,`zip`,`folder`]),[i,o]=(0,Q.useState)(``),[s,l]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(`auto`),[p,m]=(0,Q.useState)(),[h,g]=(0,Q.useState)(!1),_=a({mutationFn:u.agentPackages.discover}),v=a({mutationFn:u.agentPackages.importGit,onSuccess:e=>t(e.name)}),y=a({mutationFn:u.agentPackages.acquire}),C=a({mutationFn:u.agentPackages.importAcquired,onSuccess:e=>t(e.name)}),w=_.isPending||v.isPending||y.isPending||C.isPending||h,T=_.data?.packages??y.data?.packages,k=T?.find(e=>`${e.format}:${e.path}`===s);async function A(){l(``),_.reset(),y.reset(),v.reset(),C.reset();let e=i.trim();if(!e.includes(`://`)||/^https:\/\/github\.com\//i.test(e))try{await _.mutateAsync(e);return}catch{_.reset()}y.mutate(e)}async function j(e){let n=e.find(e=>e.path===`apm.yml`),r=e.find(e=>e.path===`plugin.json`);if(d===`auto`&&n&&r)throw Error(`Both manifests are present. Select a format before importing.`);let i=d===`auto`?n?`apm`:`agent-plugin`:d,a=i===`apm`?n:r;if(!a||a.encoding===`base64`)throw Error(`The selected format's manifest is missing`);let o=lt(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)(D,{open:!0,onOpenChange:t=>!t&&!w&&e(),children:(0,$.jsxs)(E,{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)(M,{children:[(0,$.jsx)(S,{children:`Import a package`}),(0,$.jsx)(x,{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)(c,{role:`tab`,"aria-selected":n===e,"data-testid":`package-import-${e}`,variant:n===e?`default`:`outline`,disabled:w,onClick:()=>{r(e),m(void 0)},children:t},e))}),n===`git`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,$.jsx)(O,{htmlFor:`package-git-source`,children:`Repository URL`}),(0,$.jsx)(b,{id:`package-git-source`,"data-testid":`package-git-source`,placeholder:`https://github.com/owner/repository`,value:i,disabled:w,onChange:e=>{o(e.target.value),_.reset(),y.reset(),v.reset(),C.reset(),l(``)}}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Paste a GitHub, GitLab, Bitbucket or Azure DevOps repository or package link.`}),(0,$.jsx)(c,{type:`submit`,"data-testid":`package-git-discover`,disabled:w||!i.trim(),children:_.isPending||y.isPending?`Finding packages…`:`Find packages`})]}),T&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`max-h-[40dvh] space-y-2 overflow-auto`,children:T.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:w||e.installed,checked:s===`${e.format}:${e.path}`,onChange:()=>l(`${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}`))}),!T.length&&(0,$.jsx)(`p`,{children:`No APM or Plugin packages found in this repository.`}),_.data?.issues.map(e=>(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive wrap-break-word`,children:[e.path,`: `,e.error]},e.path))]}),T&&(0,$.jsx)(c,{"data-testid":`package-git-import`,disabled:w||!k,onClick:()=>{k&&(_.data?v.mutate({source:_.data.source,commit:_.data.commit,path:k.path,format:k.format}):y.data&&C.mutate({token:y.data.token,path:k.path}))},children:v.isPending||C.isPending?`Importing…`:`Import to catalog`})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(O,{htmlFor:`package-import-format`,children:`Package format`}),(0,$.jsxs)(`select`,{id:`package-import-format`,"data-testid":`package-import-format`,disabled:w,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:d,onChange:e=>f(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)(O,{htmlFor:`agent-package-folder`,children:n===`folder`?`Package folder`:`Package source ZIP`}),(0,$.jsx)(b,{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:w,onChange:async e=>{let t=e.target.files;if(t?.length){g(!0),m(void 0);try{await j(n===`folder`?await B(t):xt(new Uint8Array(await t[0].arrayBuffer())))}catch(e){m(e.message)}finally{g(!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.`})]}),(_.error||v.error||y.error||C.error||p)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-import-error`,className:`text-sm text-destructive`,children:_.error?.message??v.error?.message??y.error?.message??C.error?.message??p})]})})}function Ct(e,t){N(new Blob([new Uint8Array(t)],{type:`application/zip`}),e)}function wt(){let e=r(),[t,n]=s(),l=o(),[p,m]=z(`packageAction`,``,[``,`new`,`import`,`edit`]),g=i({queryKey:[`agent-packages`],queryFn:u.agentPackages.list}),_=i({queryKey:[`package-tools`],queryFn:()=>u.packageTools.list()}),{selectedId:y,closeDetail:T}=R(`/packages/item`,`packageName`),O=p===`new`,k=e=>m(e?`new`:``),[j,N]=(0,Q.useState)(),P=p===`import`,F=e=>m(e?`import`:``);function ee(e){let t=new URLSearchParams(window.location.search);t.delete(`packageAction`),l(`/packages/item/${encodeURIComponent(e)}?${t}`)}function I(e){let t=new URLSearchParams(window.location.search);t.set(`packageAction`,`edit`),l(`/packages/item/${encodeURIComponent(e)}?${t}`)}let[B,V]=(0,Q.useState)(),[H,U]=(0,Q.useState)(),[W,G]=(0,Q.useState)(!1),[re,K]=(0,Q.useState)(),ie=t.get(`q`)??``,q=t.get(`format`)??`all`;async function ae(){await Promise.all([`agent-packages`,`agents`,`skills`,`package-skill-picker`,`agent-package`,`agent-package-files`].map(t=>e.invalidateQueries({queryKey:[t]})))}let oe=a({mutationFn:e=>j?u.agentPackages.update(j.name,{content:e.content,files:e.files,skills:e.skills,expectedRevision:j.revision}):u.agentPackages.create(e),onSuccess:async e=>{await ae(),gt(j?.name??`new`),k(!1),N(void 0),K(`${e.name} saved to your catalog.`),ee(e.name)}}),[se,ce]=(0,Q.useState)(),J=a({mutationFn:e=>u.agentPackages.delete(e.name,e.revision),onSuccess:async(e,t)=>{ce(void 0),y===t.name&&T(),gt(t.name),K(`${t.name} deleted from your catalog.`),await ae()}});async function le(e){G(!0),U(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`);ce({name:t.name,revision:t.revision})}catch(e){U(e instanceof Error?e.message:`Could not open package deletion.`)}finally{G(!1)}}let Y=oe.reset;(0,Q.useEffect)(()=>{let e=!0;if(N(void 0),p!==`edit`||!y)G(!1);else return G(!0),U(void 0),Y(),(async()=>{try{let t=await u.agentPackages.get(y),n=await Promise.all(t.files.map(async e=>{let t=await u.agentPackages.get(y,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=_t(y);e&&N(r?{...t,content:r.content,format:r.format,revision:r.revision??t.revision,draftFiles:r.files}:{...t,draftFiles:n})}catch(t){e&&U(t.message)}finally{e&&G(!1)}})(),()=>{e=!1}},[p,y,Y]);function ue(e){let t=g.data?.packages.find(t=>t.name===e);T(),V({name:`${e.replace(/\./g,`-`)}-setup`,packages:[e],backend:t?.format===`agent-plugin`?`copilot`:`claude`,tool:`apm`,cwd:``,prompt:``})}async function de(e){G(!0),U(void 0);try{let t=await u.agentPackages.get(e),n={[`${e}/${t.manifestFile}`]:Ye(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)):Ye(t.content)}Ct(`${e}-source.zip`,rt(n))}catch(e){U(e.message)}finally{G(!1)}}async function fe(e){G(!0),U(void 0),K(`APM is building the installation archive…`);try{let t=await u.agentPackages.exportArtifact(e);Ct(t.filename,Uint8Array.from(atob(t.content),e=>e.charCodeAt(0))),K(`Exported ${t.format} installation archive.`)}catch(e){U(e.message),K(void 0)}finally{G(!1)}}let pe=g.data?.packages.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(ie.toLowerCase())&&(q===`all`||e.format===q))??[];return(0,$.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,$.jsx)(L,{title:`Packages`,meta:`${g.data?.packages.length??0} in your catalog`,help:`Packages combine instructions, skills and tools for reuse. Use a package in chat or a terminal on the host and folder you choose.`,action:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(c,{variant:`ghost`,"data-testid":`package-import-button`,onClick:()=>F(!0),children:[(0,$.jsx)(f,{size:16,className:`mr-2`}),`Import`]}),(0,$.jsxs)(c,{"data-testid":`new-agent-package-button`,onClick:()=>{oe.reset(),k(!0)},children:[(0,$.jsx)(ne,{size:16,className:`mr-2`}),`New package`]})]})}),re&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-primary wrap-break-word`,children:re}),(H||g.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-error`,className:`text-sm text-destructive`,children:(0,$.jsx)(`span`,{"data-testid":`page-error`,children:H??g.error?.message})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 lg:max-w-md`,children:[(0,$.jsx)(h,{size:14,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(b,{className:`pl-9`,"data-testid":`package-search`,"aria-label":`Search packages`,placeholder:`Find a configuration by name or purpose…`,value:ie,onChange:e=>{let r=new URLSearchParams(t);e.target.value?r.set(`q`,e.target.value):r.delete(`q`),n(r,{replace:!0})}})]}),(0,$.jsx)(d,{activeCount:Number(q!==`all`),children:(0,$.jsxs)(`select`,{"aria-label":`Filter package type`,"data-testid":`package-format-filter`,className:`form-control form-control-single w-full lg:w-auto`,value:q,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`})]})})]}),g.isLoading&&(0,$.jsx)(`p`,{role:`status`,"data-testid":`page-loading`,children:`Loading your catalog…`}),(0,$.jsx)(`div`,{className:`divide-y divide-outline-variant`,children:pe.map(e=>(0,$.jsxs)(`article`,{"data-testid":`agent-package-row`,"data-package-name":e.name,className:`flex min-w-0 flex-wrap items-start justify-between gap-x-6 gap-y-2 px-2 py-3 sm:flex-nowrap`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`package-inspect`,onClick:()=>ee(e.name),className:`min-h-8 text-left text-sm font-medium wrap-break-word hover:text-primary`,children:e.name}),(0,$.jsxs)(`span`,{className:`ml-3 text-xs text-muted-foreground`,children:[e.format===`apm`?`APM package`:`Agent Plugins`,e.version?` · v${e.version}`:``]}),e.description&&(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm text-muted-foreground wrap-break-word`,children:e.description}),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:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(c,{size:`sm`,variant:`ghost`,"data-testid":`package-run`,disabled:W,onClick:()=>ue(e.name),children:`Use package`}),(0,$.jsxs)(A,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(c,{variant:`ghost`,size:`icon`,"data-testid":`package-actions-menu`,"aria-label":`Actions for ${e.name}`,children:(0,$.jsx)(v,{size:16})})}),(0,$.jsxs)(C,{"aria-label":`Package actions`,align:`end`,className:`w-44 space-y-1 p-1`,children:[(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`w-full justify-start`,"data-testid":`package-card-edit`,onClick:()=>void I(e.name),children:`Edit package`}),(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`w-full justify-start text-destructive`,"data-testid":`package-card-delete`,disabled:W||J.isPending,onClick:()=>void le(e.name),children:`Delete package`})]})]})]})]},e.name))}),!g.isLoading&&!g.error&&!pe.length&&(0,$.jsx)(`div`,{"data-testid":`page-empty`,className:`px-4 py-16 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ie||q!==`all`?`No matching packages`:`No packages configured`})}),g.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.`}),y&&!p&&(0,$.jsx)(ot,{name:y,onClose:T,onUse:()=>ue(y),onEdit:()=>void I(y),onDelete:()=>void le(y),onExport:()=>void fe(y),onSource:()=>void de(y),busy:W,operationError:H},y),(0,$.jsx)(D,{open:O||p===`edit`,onOpenChange:e=>{if(!e&&!oe.isPending){if(!vt(j?.name??`new`))return;k(!1),N(void 0)}},children:O||p===`edit`&&j?(0,$.jsx)(bt,{initial:j?{name:j.name,content:j.content,format:j.format,files:j.draftFiles,revision:j.revision}:void 0,pending:oe.isPending,error:oe.error?.message,onSave:e=>oe.mutate(e)}):p===`edit`?(0,$.jsxs)(E,{children:[(0,$.jsx)(M,{children:(0,$.jsx)(S,{children:`Package editor`})}),(0,$.jsx)(`p`,{role:H?`alert`:`status`,children:H??`Opening package editor…`})]}):null}),(0,$.jsx)(D,{open:!!se,onOpenChange:e=>{!e&&!J.isPending&&ce(void 0)},children:(0,$.jsxs)(E,{"data-testid":`package-delete-dialog`,children:[(0,$.jsxs)(M,{children:[(0,$.jsx)(S,{children:`Delete package?`}),(0,$.jsxs)(x,{children:[`Delete `,se?.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)(c,{variant:`outline`,"data-testid":`package-delete-cancel`,disabled:J.isPending,onClick:()=>ce(void 0),children:`Cancel`}),(0,$.jsx)(c,{variant:`destructive`,"data-testid":`package-delete-confirm`,disabled:J.isPending||!se,onClick:()=>{se&&J.mutate(se)},children:J.isPending?`Deleting…`:`Delete package`})]})]})}),P&&(0,$.jsx)(St,{onClose:()=>F(!1),onImported:e=>{ae(),F(!1),K(`${e} added to your catalog.`),ee(e)}}),B&&(0,$.jsx)(te,{initial:B,onClose:()=>V(void 0)},B.name)]})}export{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{n as r,t as i}from"./useMutation-CRAWY7v2.js";import{f as a,u as o}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as s}from"./button-BlVCkBiz.js";import{n as c}from"./client-RPZmgRqE.js";import{t as l}from"./download-Cnjcb403.js";import{$ as u,Cn as d,Gt as f,Jn as p,Jr as m,Nt as h,Q as g,Qn as _,Ur as v,Vr as y,Wr as b,Yr as x,an as S,cn as ee,ct as te,et as ne,in as re,on as ie,rn as ae,sn as oe,tt as se,yn as ce}from"./index-DsVJrhHJ.js";var le=Symbol.for(`yaml.alias`),ue=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),de=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),fe=e=>!!e&&typeof e==`object`&&e[E]===le,pe=e=>!!e&&typeof e==`object`&&e[E]===ue,D=e=>!!e&&typeof e==`object`&&e[E]===C,O=e=>!!e&&typeof e==`object`&&e[E]===w,k=e=>!!e&&typeof e==`object`&&e[E]===T,A=e=>!!e&&typeof e==`object`&&e[E]===de;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case de:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case le:case C:case T:case de:return!0}return!1}var me=e=>(k(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),P=Symbol(`skip children`),F=Symbol(`remove node`);function he(e,t){let n=ge(t);pe(e)?I(null,e.contents,n,Object.freeze([e]))===F&&(e.contents=null):I(null,e,n,Object.freeze([]))}he.BREAK=N,he.SKIP=P,he.REMOVE=F;function I(e,t,n,r){let i=_e(e,t,n,r);if(M(i)||O(i))return ve(e,r,i),I(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=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===F&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===N)return N;e===F&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===N)return N;i===F&&(t.value=null)}}return i}function ge(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 _e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(D(t))return n.Map?.(e,t,r);if(A(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(fe(t))return n.Alias?.(e,t,r)}function ve(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(pe(r))r.contents=n;else{let e=fe(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var L={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},R=e=>e.replace(/[!,[\]{}]/g,e=>L[e]),z=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+R(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={};he(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-CRAWY7v2.js";import{f as a,u as o}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as s}from"./button-DeTgVWBh.js";import{n as c}from"./client-C0cF5m6-.js";import{t as l}from"./download-vwV9XGjB.js";import{It as u,Rn as d,Wn as f,Xt as p,_i as m,_n as h,an as g,bn as _,di as v,fi as y,gi as b,gn as x,hn as S,hr as ee,in as te,it as ne,kr as re,li as ie,on as ae,rn as oe,vn as se,yn as ce}from"./index-BoyulwgO.js";var le=Symbol.for(`yaml.alias`),ue=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),de=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),fe=e=>!!e&&typeof e==`object`&&e[E]===le,pe=e=>!!e&&typeof e==`object`&&e[E]===ue,D=e=>!!e&&typeof e==`object`&&e[E]===C,O=e=>!!e&&typeof e==`object`&&e[E]===w,k=e=>!!e&&typeof e==`object`&&e[E]===T,A=e=>!!e&&typeof e==`object`&&e[E]===de;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case de:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case le:case C:case T:case de:return!0}return!1}var me=e=>(k(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),P=Symbol(`skip children`),F=Symbol(`remove node`);function he(e,t){let n=ge(t);pe(e)?I(null,e.contents,n,Object.freeze([e]))===F&&(e.contents=null):I(null,e,n,Object.freeze([]))}he.BREAK=N,he.SKIP=P,he.REMOVE=F;function I(e,t,n,r){let i=_e(e,t,n,r);if(M(i)||O(i))return ve(e,r,i),I(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=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===F&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===N)return N;e===F&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===N)return N;i===F&&(t.value=null)}}return i}function ge(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 _e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(D(t))return n.Map?.(e,t,r);if(A(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(fe(t))return n.Alias?.(e,t,r)}function ve(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(pe(r))r.contents=n;else{let e=fe(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var L={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},R=e=>e.replace(/[!,[\]{}]/g,e=>L[e]),z=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+R(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={};he(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
  `)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function B(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 V(e){let t=new Set;return he(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ye(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function be(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=V(e);let a=ye(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(k(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||!me(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 W=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(!pe(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}},xe=class extends W{constructor(e){super(le),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=[],he(e,{Node:(e,t)=>{(fe(t)||me(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=Se(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(B(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 Se(e,t,n){if(fe(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=Se(e,i,n);t>r&&(r=t)}return r}if(O(t)){let r=Se(e,t.key,n),i=Se(e,t.value,n);return Math.max(r,i)}return 1}var Ce=e=>!e||typeof e!=`function`&&typeof e!=`object`,G=class extends W{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)}};G.BLOCK_FOLDED=`BLOCK_FOLDED`,G.BLOCK_LITERAL=`BLOCK_LITERAL`,G.PLAIN=`PLAIN`,G.QUOTE_DOUBLE=`QUOTE_DOUBLE`,G.QUOTE_SINGLE=`QUOTE_SINGLE`;var we=`tag:yaml.org,2002:`;function Te(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 Ee(e,t,n){if(pe(e)&&(e=e.contents),M(e))return e;if(O(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 xe(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=we+t.slice(2));let l=Te(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new G(e);return c&&(c.node=t),t}l=e instanceof Map?o[C]:Symbol.iterator in Object(e)?o[de]: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 G(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function De(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 Ee(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Oe=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ke=class extends W{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)||O(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Oe(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,De(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&&k(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!O(t))return!1;let n=t.value;return n==null||e&&k(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,De(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ae=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function K(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var je=(e,t,n)=>e.endsWith(`
3
3
  `)?K(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)){br(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(hr(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=yr(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(hr(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(_r(t.key)&&!hr(t.sep,`newline`)){let e=yr(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]}):hr(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&&!hr(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)){br(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||hr(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=yr(vr(t));xr(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=yr(vr(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=yr(vr(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 Cr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mr||null,prettyErrors:t}}function wr(e,t={}){let{lineCounter:n,prettyErrors:r}=Cr(t),i=new Sr(n?.addNewLine),a=new tr(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 _n(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(yn(e,n)),o.warnings.forEach(yn(e,n))),o}function Tr(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 pe(e)&&!r?e.toString(n):new mn(e,r,n).toString(n)}var Q=e(t(),1),$=n();function Er({initial:e,onClose:t}){let[n,le]=(0,Q.useState)({...e,tool:`apm`}),[ue,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[de,E]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(`run`),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=a(),A=o(),j=ce(),M=d(),me=p(),N=_(),P=n.host===void 0?M.data?.host??null:n.host,[F,he]=(0,Q.useState)(`terminal`),[I,ge]=(0,Q.useState)(`context`),[_e,ve]=(0,Q.useState)(!1),L=r({queryKey:[`package-tools`,P],queryFn:()=>c.packageTools.list(P),enabled:!!M.data}),R=r({queryKey:[`package-launch-host`,P],queryFn:()=>c.terminals.list(P),enabled:!!M.data,retry:!1}),z=r({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>c.agentPackages.get(e)))}),B=r({queryKey:[`agent`,n.agent],queryFn:()=>c.agents.get(n.agent),enabled:!!n.agent}),V=i({mutationFn:c.agentSetups.command});(0,Q.useEffect)(()=>{V.data&&D.current?.scrollIntoView({block:`nearest`})},[V.data]);let ye=z.data?.some(e=>e.format===`agent-plugin`),be=ye&&n.backend===`claude`,H=z.data?.some(e=>e.format===`apm`||n.backend!==`codex`),U=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&L.data?.bun&&(!H||L.data?.apm)&&!be&&!z.error&&!z.isFetching&&!B.error&&!B.isFetching&&!R.isFetching&&!R.error;function W(e){le(t=>({...t,...e})),V.reset(),E(!1),C(void 0),ve(!1)}async function xe(e){T(!0),C(void 0);try{if(e===`run`&&F===`chat`){let e=await c.chat.fromSetup({...n,host:P});N.openThread(e,{follow:!1}),n.prompt.trim()&&N.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 j.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:P,setup:{...n,host:P,operation:e}});t(),k(h(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(ae,{open:!0,onOpenChange:e=>!e&&!_e&&!w&&!V.isPending&&t(),children:(0,$.jsxs)(re,{closeDisabled:w||V.isPending||_e,className:`flex min-w-0 w-[min(960px,calc(100vw-2rem))] max-w-none max-h-[calc(var(--app-height,100dvh)-2rem)] flex-col gap-0 overflow-hidden p-0`,children:[(0,$.jsxs)(oe,{className:`shrink-0 border-b px-4 py-4 pr-12 sm:px-6`,children:[(0,$.jsx)(ee,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(S,{className:`sr-only`,children:`Choose the context and instructions, then launch or install configuration.`})]}),(0,$.jsxs)(g,{value:I,onValueChange:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(ne,{"aria-label":`Launch setup`,className:`shrink-0 justify-start border-b rounded-none px-4 sm:px-6`,children:[(0,$.jsx)(se,{value:`context`,"data-testid":`setup-context-tab`,disabled:w||V.isPending,children:`Context`}),(0,$.jsx)(se,{value:`instructions`,"data-testid":`setup-instructions-tab`,disabled:w||V.isPending,children:`Instructions`})]}),(0,$.jsxs)(`div`,{"data-testid":`package-setup-body`,className:`min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6`,children:[(0,$.jsxs)(`fieldset`,{disabled:w||V.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(u,{value:`context`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`form-control form-control-single`,value:P??``,onChange:e=>W({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...M.data?.hosts??[],...M.data?.host?[M.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`form-control form-control-single`,value:n.backend,onChange:e=>W({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(ye&&e===`claude`),children:[e,ye&&e===`claude`?` · unsupported for this plugin`:R.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(te,{htmlFor:`setup-cwd`,children:[`Working folder on `,P??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`form-control form-control-single`,value:``,onChange:e=>{e.target.value&&W({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),me.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=>W({cwd:e.target.value})}),(0,$.jsx)(s,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,ref:O,disabled:R.isFetching||!!R.error||!P&&!R.data?.ready,onClick:async()=>{if(P)ve(!0);else try{let e=await c.terminals.pickFolder(n.cwd||void 0,null);e.path&&W({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),(0,$.jsx)(f,{open:_e&&!!P,onOpenChange:ve,host:P,initial:n.cwd,onPick:e=>W({cwd:e}),returnFocusRef:O})]}),(0,$.jsxs)(`details`,{"data-testid":`setup-components`,className:`text-sm space-y-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 content-center sm:min-h-8`,children:`Configuration to apply`}),B.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[B.data.name,` · agent instructions`,B.data.fields.model?` · ${B.data.fields.model}`:``]}),P&&(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 `,P,`.`]})]}),z.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),z.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)(u,{value:`instructions`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(m,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:5,value:n.prompt,onChange:e=>W({prompt:e.target.value})})]})})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 flex items-center sm:min-h-8`,children:`How configuration is applied`}),(0,$.jsx)(`p`,{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.`})]}),be&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),L.data&&H&&!L.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,P??`Local`,`.`]}),L.data&&!L.data.bun&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Bun must be available on `,P??`Local`,`.`]}),!R.data?.ready&&F===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:R.data?.reason??`Checking terminal availability…`}),F===`chat`&&n.backend===`copilot`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Chat requires Claude or Codex. Choose another coding agent in Context.`}),(ue||V.error||z.error||B.error||L.error||R.error||M.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:ue??V.error?.message??z.error?.message??B.error?.message??L.error?.message??R.error?.message??M.error?.message}),(0,$.jsxs)(`div`,{hidden:I!==`instructions`||F!==`command`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`form-control form-control-single`,disabled:w||V.isPending,value:fe,onChange:e=>{pe(e.target.value),V.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),V.data&&(0,$.jsxs)(`div`,{ref:D,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(te,{htmlFor:`package-command`,children:[`Run in `,V.data.shell,` on `,P??`Local`]}),(0,$.jsx)(m,{id:`package-command`,"data-testid":`package-command`,value:V.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(s,{variant:`outline`,disabled:w||V.isPending,onClick:async()=>{try{await navigator.clipboard.writeText(V.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:de?`Copied`:`Copy command`})]})]})]})]}),(0,$.jsxs)(ie,{className:`shrink-0 flex-row flex-nowrap items-center gap-2 border-t px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] sm:px-6`,children:[(0,$.jsxs)(y,{children:[(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,actionHelp:!1,"aria-label":`Install configuration`,title:`Install configuration`,"data-testid":`setup-install-info`,disabled:w||V.isPending,className:`shrink-0 mr-auto`,children:(0,$.jsx)(l,{"aria-hidden":`true`})})}),(0,$.jsxs)(v,{align:`start`,side:`top`,className:`w-80 space-y-3`,"data-testid":`setup-install-explanation`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Install package configuration for your coding agent on `,P??`Local`,`, without launching an agent. Configuration remains after the session. Installer trust or conflict prompts open in a terminal.`]}),!n.packages.length&&(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose a package to install configuration separately. This saved agent can be launched directly.`}),(0,$.jsx)(s,{"data-testid":`setup-install`,variant:`ghost`,disabled:w||V.isPending||!U||!R.data?.ready||!n.packages.length,onClick:()=>void xe(`install`),children:`Install configuration`})]})]}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,"aria-label":`Launch action`,className:`form-control form-control-single w-auto min-w-0 max-w-36`,disabled:w||V.isPending,value:F,onChange:e=>{let t=e.target.value;he(t),t===`command`&&ge(`instructions`)},children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · requires Claude or Codex`:``]}),(0,$.jsx)(`option`,{value:`command`,children:`Command`})]}),(0,$.jsx)(s,{"data-testid":F===`command`?`setup-command`:`setup-launch`,className:`shrink-0`,disabled:w||V.isPending||!U||(F===`command`?!1:F===`terminal`?!R.data?.ready||!R.data?.launchers.includes(n.backend):!N.ready||n.backend===`copilot`),onClick:()=>F===`command`?V.mutate({...n,host:P,operation:fe}):void xe(`run`),children:w||V.isPending?`Preparing…`:F===`command`?`Generate`:F===`chat`?`Open chat`:`Run`})]})]})})}export{A as a,D as i,wr as n,Tr as r,Er 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=yr(vr(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=yr(vr(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 Cr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mr||null,prettyErrors:t}}function wr(e,t={}){let{lineCounter:n,prettyErrors:r}=Cr(t),i=new Sr(n?.addNewLine),a=new tr(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 _n(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(yn(e,n)),o.warnings.forEach(yn(e,n))),o}function Tr(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 pe(e)&&!r?e.toString(n):new mn(e,r,n).toString(n)}var Q=e(t(),1),$=n();function Er({initial:e,onClose:t}){let[n,le]=(0,Q.useState)({...e,tool:`apm`}),[ue,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[de,E]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(`run`),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=a(),A=o(),j=d(),M=f(),me=re(),N=ee(),P=n.host===void 0?M.data?.host??null:n.host,[F,he]=(0,Q.useState)(`terminal`),[I,ge]=(0,Q.useState)(`context`),[_e,ve]=(0,Q.useState)(!1),L=r({queryKey:[`package-tools`,P],queryFn:()=>c.packageTools.list(P),enabled:!!M.data}),R=r({queryKey:[`package-launch-host`,P],queryFn:()=>c.terminals.list(P),enabled:!!M.data,retry:!1}),z=r({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>c.agentPackages.get(e)))}),B=r({queryKey:[`agent`,n.agent],queryFn:()=>c.agents.get(n.agent),enabled:!!n.agent}),V=i({mutationFn:c.agentSetups.command});(0,Q.useEffect)(()=>{V.data&&D.current?.scrollIntoView({block:`nearest`})},[V.data]);let ye=z.data?.some(e=>e.format===`agent-plugin`),be=ye&&n.backend===`claude`,H=z.data?.some(e=>e.format===`apm`||n.backend!==`codex`),U=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&L.data?.bun&&(!H||L.data?.apm)&&!be&&!z.error&&!z.isFetching&&!B.error&&!B.isFetching&&!R.isFetching&&!R.error;function W(e){le(t=>({...t,...e})),V.reset(),E(!1),C(void 0),ve(!1)}async function xe(e){T(!0),C(void 0);try{if(e===`run`&&F===`chat`){let e=await c.chat.fromSetup({...n,host:P});N.openThread(e,{follow:!1}),n.prompt.trim()&&N.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 j.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:P,setup:{...n,host:P,operation:e}});t(),k(u(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(S,{open:!0,onOpenChange:e=>!e&&!_e&&!w&&!V.isPending&&t(),children:(0,$.jsxs)(x,{closeDisabled:w||V.isPending||_e,className:`flex min-w-0 w-[min(960px,calc(100vw-2rem))] max-w-none max-h-[calc(var(--app-height,100dvh)-2rem)] flex-col gap-0 overflow-hidden p-0`,children:[(0,$.jsxs)(ce,{className:`shrink-0 border-b px-4 py-4 pr-12 sm:px-6`,children:[(0,$.jsx)(_,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(h,{className:`sr-only`,children:`Choose the context and instructions, then launch or install configuration.`})]}),(0,$.jsxs)(oe,{value:I,onValueChange:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(g,{"aria-label":`Launch setup`,className:`shrink-0 justify-start border-b rounded-none px-4 sm:px-6`,children:[(0,$.jsx)(ae,{value:`context`,"data-testid":`setup-context-tab`,disabled:w||V.isPending,children:`Context`}),(0,$.jsx)(ae,{value:`instructions`,"data-testid":`setup-instructions-tab`,disabled:w||V.isPending,children:`Instructions`})]}),(0,$.jsxs)(`div`,{"data-testid":`package-setup-body`,className:`min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6`,children:[(0,$.jsxs)(`fieldset`,{disabled:w||V.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(te,{value:`context`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(ne,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`form-control form-control-single`,value:P??``,onChange:e=>W({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...M.data?.hosts??[],...M.data?.host?[M.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(ne,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`form-control form-control-single`,value:n.backend,onChange:e=>W({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(ye&&e===`claude`),children:[e,ye&&e===`claude`?` · unsupported for this plugin`:R.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(ne,{htmlFor:`setup-cwd`,children:[`Working folder on `,P??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`form-control form-control-single`,value:``,onChange:e=>{e.target.value&&W({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),me.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)(m,{id:`setup-cwd`,"data-testid":`setup-cwd`,value:n.cwd,onChange:e=>W({cwd:e.target.value})}),(0,$.jsx)(s,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,ref:O,disabled:R.isFetching||!!R.error||!P&&!R.data?.ready,onClick:async()=>{if(P)ve(!0);else try{let e=await c.terminals.pickFolder(n.cwd||void 0,null);e.path&&W({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),(0,$.jsx)(p,{open:_e&&!!P,onOpenChange:ve,host:P,initial:n.cwd,onPick:e=>W({cwd:e}),returnFocusRef:O})]}),(0,$.jsxs)(`details`,{"data-testid":`setup-components`,className:`text-sm space-y-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 content-center sm:min-h-8`,children:`Configuration to apply`}),B.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[B.data.name,` · agent instructions`,B.data.fields.model?` · ${B.data.fields.model}`:``]}),P&&(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 `,P,`.`]})]}),z.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),z.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)(te,{value:`instructions`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(ne,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(b,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:5,value:n.prompt,onChange:e=>W({prompt:e.target.value})})]})})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 flex items-center sm:min-h-8`,children:`How configuration is applied`}),(0,$.jsx)(`p`,{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.`})]}),be&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),L.data&&H&&!L.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,P??`Local`,`.`]}),L.data&&!L.data.bun&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Bun must be available on `,P??`Local`,`.`]}),!R.data?.ready&&F===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:R.data?.reason??`Checking terminal availability…`}),F===`chat`&&n.backend===`copilot`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Chat requires Claude or Codex. Choose another coding agent in Context.`}),(ue||V.error||z.error||B.error||L.error||R.error||M.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:ue??V.error?.message??z.error?.message??B.error?.message??L.error?.message??R.error?.message??M.error?.message}),(0,$.jsxs)(`div`,{hidden:I!==`instructions`||F!==`command`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(ne,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`form-control form-control-single`,disabled:w||V.isPending,value:fe,onChange:e=>{pe(e.target.value),V.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),V.data&&(0,$.jsxs)(`div`,{ref:D,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(ne,{htmlFor:`package-command`,children:[`Run in `,V.data.shell,` on `,P??`Local`]}),(0,$.jsx)(b,{id:`package-command`,"data-testid":`package-command`,value:V.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(s,{variant:`outline`,disabled:w||V.isPending,onClick:async()=>{try{await navigator.clipboard.writeText(V.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:de?`Copied`:`Copy command`})]})]})]})]}),(0,$.jsxs)(se,{className:`shrink-0 flex-row flex-nowrap items-center gap-2 border-t px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] sm:px-6`,children:[(0,$.jsxs)(ie,{children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,actionHelp:!1,"aria-label":`Install configuration`,title:`Install configuration`,"data-testid":`setup-install-info`,disabled:w||V.isPending,className:`shrink-0 mr-auto`,children:(0,$.jsx)(l,{"aria-hidden":`true`})})}),(0,$.jsxs)(v,{align:`start`,side:`top`,className:`w-80 space-y-3`,"data-testid":`setup-install-explanation`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Install package configuration for your coding agent on `,P??`Local`,`, without launching an agent. Configuration remains after the session. Installer trust or conflict prompts open in a terminal.`]}),!n.packages.length&&(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose a package to install configuration separately. This saved agent can be launched directly.`}),(0,$.jsx)(s,{"data-testid":`setup-install`,variant:`ghost`,disabled:w||V.isPending||!U||!R.data?.ready||!n.packages.length,onClick:()=>void xe(`install`),children:`Install configuration`})]})]}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,"aria-label":`Launch action`,className:`form-control form-control-single w-auto min-w-0 max-w-36`,disabled:w||V.isPending,value:F,onChange:e=>{let t=e.target.value;he(t),t===`command`&&ge(`instructions`)},children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · requires Claude or Codex`:``]}),(0,$.jsx)(`option`,{value:`command`,children:`Command`})]}),(0,$.jsx)(s,{"data-testid":F===`command`?`setup-command`:`setup-launch`,className:`shrink-0`,disabled:w||V.isPending||!U||(F===`command`?!1:F===`terminal`?!R.data?.ready||!R.data?.launchers.includes(n.backend):!N.ready||n.backend===`copilot`),onClick:()=>F===`command`?V.mutate({...n,host:P,operation:fe}):void xe(`run`),children:w||V.isPending?`Preparing…`:F===`command`?`Generate`:F===`chat`?`Open chat`:`Run`})]})]})})}export{A as a,D as i,wr as n,Tr as r,Er as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{c as t}from"./button-BlVCkBiz.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
+ import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{s as t}from"./button-DeTgVWBh.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};
@@ -0,0 +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{h as r,t as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-DeTgVWBh.js";import{t as o}from"./TaskDetailSheet-CK2rs3F0.js";import{t as s}from"./ResponsiveFilters-BDHgHwbe.js";import{$ as c,Ai as l,Ar as ee,Ei as u,Er as d,G as f,J as p,K as te,Or as ne,Q as m,Sn as h,Tt as re,W as g,X as _,Y as v,Z as y,_i as b,an as x,at as S,b as C,bi as w,bn as T,ct as E,dt as D,et as O,gi as k,in as A,it as j,jr as M,kr as ie,nt as N,on as P,ot as F,pr as I,rn as L,rt as R,st as z,tt as B,v as V,vn as H,yn as U,z as W}from"./index-BoyulwgO.js";import{t as G}from"./ConfirmDialog-CtTOXkX8.js";import{t as K}from"./ViewHeader-CdTYgjcL.js";import{t as q}from"./useDetailRoute-B-xjWsyW.js";import{t as J}from"./view-params-YEmeZppw.js";import{t as ae}from"./EmptyState-YM4VSLR9.js";import{a as oe,i as Y,n as se,o as ce,r as X,t as le}from"./table-BghcPb3T.js";import{n as ue,t as de}from"./useListSelection-BCmeXReo.js";var Z=e(t(),1),Q=n(),fe=[{value:`all`,label:`All`},{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`paused`,label:`Paused`}];function pe(){let e=I(`xl`),{data:t,isLoading:n,error:i,refetch:c}=ie(),[p,te]=J(`projectQuery`,``),[,ne]=r(),[m,_]=J(`status`,`all`,[`all`,`active`,`archived`,`paused`]),[v,y]=(0,Z.useState)(!1),[S,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),{selectedId:j,openDetail:M,closeDetail:N}=q(`/projects`,`projectId`),F=d(),R=j?(t??[]).find(e=>e.id===j)??null:null,z=(0,Z.useMemo)(()=>{let e=p.trim().toLowerCase();return(t??[]).filter(t=>!e||`${t.name} ${t.description??``} ${t.scope??``} ${(t.tags??[]).join(` `)}`.toLowerCase().includes(e))},[t,p]),B=(0,Z.useMemo)(()=>m===`all`?z:z.filter(e=>e.status===m),[z,m]),V=JSON.stringify([m,p]),H=de(B.map(e=>e.id),V),U=ee(),W=U.data?.scope===V?U.data:void 0;async function pe(e){let t=await U.mutateAsync({ids:H.selectedIds,status:e,scope:V});H.select(t.failed.map(e=>e.id))}let $=(0,Z.useMemo)(()=>z.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),[z]);return i?(0,Q.jsx)(re,{message:i.message,onRetry:()=>c()}):(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{title:`Projects`,meta:p||m!==`all`?`${B.length} of ${(t??[]).length}`:(t??[]).length,action:(0,Q.jsxs)(a,{"data-testid":`new-project-button`,size:`sm`,onClick:()=>y(!0),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,Q.jsx)(l,{size:12,className:`mr-1`}),`New project`]})}),(0,Q.jsxs)(L,{value:m,onValueChange:e=>_(e),className:`mb-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 lg:max-w-md`,children:[(0,Q.jsx)(u,{size:14,"aria-hidden":!0,className:`absolute left-3 top-1/2 -translate-y-1/2 text-outline`}),(0,Q.jsx)(b,{type:`search`,"data-testid":`project-search`,"aria-label":`Search projects`,placeholder:`Search projects…`,value:p,onChange:e=>te(e.target.value,{replace:!0}),className:`pl-9`})]}),(0,Q.jsx)(s,{activeCount:Number(m!==`all`),children:(0,Q.jsx)(x,{"aria-label":`Project status`,className:`bg-transparent gap-1 h-auto max-w-full flex-wrap justify-start p-0`,children:fe.map(({value:e,label:t})=>(0,Q.jsxs)(P,{"data-testid":`projects-filter-${e}`,value:e,className:`font-label text-[13px] px-3 py-1.5 rounded-md
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,Q.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground px-1.5 py-0.5`,children:$[e]})]},e))})})]}),B.length>0&&(0,Q.jsx)(ue,{resourceLabel:`projects`,count:H.selectedIds.length,allSelected:H.allSelected,someSelected:H.someSelected,onSelectAll:H.selectAll,onClear:H.clear,disabled:U.isPending,children:f.map(e=>(0,Q.jsxs)(a,{type:`button`,size:`sm`,variant:`outline`,disabled:U.isPending,"data-testid":`projects-bulk-${e}`,onClick:()=>void pe(e),children:[e===`active`?`Activate`:e===`paused`?`Pause`:`Archive`,` `,`selected`]},e))}),U.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`mb-3 text-sm text-outline`,children:`Updating selected projects...`}),!U.isPending&&W&&(0,Q.jsxs)(`div`,{role:`status`,className:`mb-3 space-y-1 text-sm`,"data-testid":`projects-bulk-result`,children:[(0,Q.jsxs)(`p`,{children:[W.succeeded.length,` `,W.succeeded.length===1?`project`:`projects`,` set to`,` `,W.status,`.`]}),W.failed.map(e=>(0,Q.jsxs)(`p`,{className:`text-error`,children:[t?.find(t=>t.id===e.id)?.name??e.id,`: `,e.error,`. Still selected for retry.`]},e.id))]}),(0,Q.jsx)(A,{value:m,children:n?(0,Q.jsx)(`div`,{className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,Q.jsx)(h,{className:`h-12 w-full bg-surface-highest`},t))}):B.length===0?p||m!==`all`?(0,Q.jsxs)(`div`,{"data-testid":`empty-state`,className:`flex flex-col items-center justify-center gap-2 py-16 text-sm text-outline`,children:[(0,Q.jsx)(`p`,{children:`No matching projects`}),(0,Q.jsx)(a,{variant:`ghost`,"data-testid":`project-clear-filters`,onClick:()=>ne(e=>{let t=new URLSearchParams(e);return t.delete(`projectQuery`),t.delete(`status`),t}),children:`Clear filters`})]}):(0,Q.jsx)(ae,{message:`No projects`}):e?(0,Q.jsx)(`div`,{className:`overflow-hidden`,children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{children:(0,Q.jsxs)(ce,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,Q.jsx)(Y,{className:`w-11`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Select projects`})}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground`,children:`Name`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-28`,children:`Status`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-36`,children:`Tags`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-24`,children:`Max workers`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-24`,children:`Created`}),(0,Q.jsx)(Y,{className:`w-10`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Q.jsx)(se,{children:B.map(e=>(0,Q.jsxs)(ce,{"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:()=>M(e.id),children:[(0,Q.jsx)(X,{children:(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:H.selectedIds.includes(e.id),disabled:U.isPending,onClick:e=>e.stopPropagation(),onChange:()=>H.toggle(e.id)})}),(0,Q.jsx)(X,{className:`font-body text-sm font-medium text-on-surface`,children:(0,Q.jsx)(`button`,{type:`button`,className:`min-h-8 text-left hover:text-primary`,"aria-label":`Edit project: ${e.name}`,onClick:t=>{t.stopPropagation(),M(e.id)},children:e.name})}),(0,Q.jsx)(X,{className:`font-body text-sm text-muted-foreground max-w-xs truncate`,children:e.description??`—`}),(0,Q.jsx)(X,{children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs font-normal capitalize text-muted-foreground`,children:[(0,Q.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,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.tags??[]).map(e=>(0,Q.jsx)(`span`,{className:`font-label text-sm px-1.5 py-0.5 text-muted-foreground`,children:e},e))})}),(0,Q.jsx)(X,{className:`font-label text-sm text-on-surface text-center`,children:e.max_workers??`—`}),(0,Q.jsx)(X,{className:`font-label text-sm text-muted-foreground`,children:new Date(e.created_at).toLocaleDateString()}),(0,Q.jsx)(X,{children:(0,Q.jsx)(`button`,{type:`button`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:t=>{t.stopPropagation(),k(e)},className:`text-muted-foreground hover:text-error transition-colors p-1`,children:(0,Q.jsx)(w,{size:12})})})]},e.id))})]})}):(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:B.map(e=>(0,Q.jsxs)(`article`,{"data-testid":`project-row`,"data-project-id":e.id,"data-project-name":e.name,className:`flex min-w-0 items-start gap-1 py-3`,children:[(0,Q.jsx)(`label`,{className:`flex size-11 shrink-0 items-center justify-center`,children:(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:H.selectedIds.includes(e.id),disabled:U.isPending,onChange:()=>H.toggle(e.id)})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`project-open`,"aria-label":`Edit project: ${e.name}`,className:`min-h-11 w-full text-left text-sm font-medium wrap-break-word hover:text-primary`,onClick:()=>M(e.id),children:e.name}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 capitalize`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full ${e.status===`active`?`bg-secondary`:e.status===`paused`?`bg-tertiary`:`bg-outline`}`}),e.status]}),e.max_workers!=null&&(0,Q.jsxs)(`span`,{children:[e.max_workers,` workers`]})]}),e.description&&(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground wrap-break-word`,children:e.description})]}),(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:()=>k(e),className:`shrink-0 text-muted-foreground hover:text-error`,children:(0,Q.jsx)(w,{size:14})})]},e.id))})})]}),v&&(0,Q.jsx)(g,{open:v,onClose:()=>y(!1),onFirstTask:T}),S&&(0,Q.jsx)(C,{open:!0,defaultProjectId:S,onClose:()=>T(null),onCreated:D}),(0,Q.jsx)(o,{taskId:E,open:!!E,onOpenChange:e=>{e||D(null)}}),R&&(0,Q.jsx)(me,{open:!!R,project:R,onClose:N,onFirstTask:e=>{N(),T(e)}},R.id),O&&(0,Q.jsx)(G,{open:!!O,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:F.isPending,onConfirm:()=>{F.mutate(O.id,{onSuccess:()=>k(null)})},onCancel:()=>k(null)})]})}function me({open:e,project:t,onClose:n,onFirstTask:r}){let i=y([{id:`details`,label:`Details`},{id:`configuration`,label:`Configuration`},{id:`workspace`,label:`Workspace`}],e),[o,s]=(0,Z.useState)(t.name),[l,ee]=(0,Z.useState)(t.description??``),[u,d]=(0,Z.useState)(t.status),[h,re]=(0,Z.useState)((t.tags??[]).join(`, `)),[g,x]=(0,Z.useState)(t.scope??``),[C,w]=(0,Z.useState)(t.git_remote_url??``),[A,ie]=(0,Z.useState)(t.github_sync??{enabled:!1,status_labels:D}),[P,I]=(0,Z.useState)(t.upload_directory??``),[L,V]=(0,Z.useState)(t.max_workers==null?``:String(t.max_workers)),[W,G]=(0,Z.useState)(()=>t.workspace?E(t.workspace):z()),K=M(),{data:q}=ne(t.id),J=JSON.stringify([o,l,u,h,g,C,A,L,P,W])!==JSON.stringify([t.name,t.description??``,t.status,(t.tags??[]).join(`, `),t.scope??``,t.git_remote_url??``,t.github_sync??{enabled:!1,status_labels:D},t.max_workers==null?``:String(t.max_workers),t.upload_directory??``,t.workspace?E(t.workspace):z()]),ae=(e,n)=>{if(e.preventDefault(),!o.trim())return;let r=F.safeParse(W);if(!r.success){i.invalid(`workspace`,r.error.issues[0].message);return}let a={id:t.id,name:o.trim(),description:l.trim()||null,status:u,tags:h.trim()?h.split(`,`).map(e=>e.trim()).filter(Boolean):null,scope:g.trim()||null,git_remote_url:C.trim()||null,github_sync:A,max_workers:L?Number(L):null,upload_directory:P.trim()||null,workspace:r.data};K.mutate(a,{onSuccess:n})};return(0,Q.jsx)(S,{open:e,onClose:n,dirty:J,busy:K.isPending,testId:`edit-project-dialog`,children:(e,n)=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(T,{className:`font-headline text-base text-on-surface`,children:`Edit project`})}),(0,Q.jsx)(`form`,{noValidate:!0,ref:i.form,onSubmit:e=>i.submit(e,()=>ae(e,n)),className:`min-h-0`,children:(0,Q.jsxs)(_,{steps:i,children:[(0,Q.jsxs)(`div`,{className:`work-form-body space-y-4`,children:[(0,Q.jsxs)(v,{steps:i,id:`details`,children:[q&&(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:(0,Q.jsx)($,{summary:q,allowNavigation:!J})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:col-span-2`,children:[(0,Q.jsx)(a,{type:`button`,"data-testid":`project-create-task`,variant:`outline`,size:`sm`,onClick:()=>r(t.id),disabled:J||K.isPending,children:`Create task in this project`}),J&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Save changes before opening related work.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Name *`}),(0,Q.jsx)(b,{"aria-label":`Name`,"data-testid":`edit-project-name-input`,required:!0,value:o,onChange:e=>s(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,Q.jsx)(k,{"aria-label":`Description`,value:l,onChange:e=>ee(e.target.value),rows:2,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(m,{value:u,onValueChange:e=>d(e),children:[(0,Q.jsx)(B,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-sm`,children:(0,Q.jsx)(N,{})}),(0,Q.jsx)(c,{className:`bg-surface border-outline-variant`,children:f.map(e=>(0,Q.jsx)(O,{value:e,className:`font-label text-sm`,children:e},e))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Tags (comma separated)`}),(0,Q.jsx)(b,{"aria-label":`Tags (comma separated)`,value:h,onChange:e=>re(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,Q.jsxs)(v,{steps:i,id:`configuration`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Scope`}),(0,Q.jsx)(b,{"aria-label":`Scope`,value:g,onChange:e=>x(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 md:col-span-2`,children:[(0,Q.jsx)(j,{htmlFor:`edit-project-git-remote-url`,className:`font-label text-sm text-muted-foreground`,children:`Git remote URL (optional)`}),(0,Q.jsx)(b,{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:C,onChange:e=>w(e.target.value),placeholder:`https://github.com/owner/repo.git or git@github.com:owner/repo.git`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Clear this field to remove the saved address.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 md:col-span-2`,children:[(0,Q.jsx)(j,{htmlFor:`edit-project-upload-directory`,children:`Upload directory (optional)`}),(0,Q.jsx)(b,{id:`edit-project-upload-directory`,"data-testid":`edit-project-upload-directory`,value:P,onChange:e=>I(e.target.value),placeholder:`.orc/sessions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Relative to the conversation folder, or an absolute path on its execution host. External folders may require agent read permission. Empty uses .orc/sessions.`})]}),(0,Q.jsx)(R,{value:A,onChange:ie,state:t.github_sync_state}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(j,{className:`font-label text-sm text-muted-foreground`,children:`Max workers`}),(0,Q.jsx)(b,{"aria-label":`Max Workers`,type:`number`,min:1,value:L,onChange:e=>V(e.target.value),placeholder:`1`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,Q.jsx)(v,{steps:i,id:`workspace`,children:(0,Q.jsx)(te,{value:W,onChange:G})}),K.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error md:col-span-2`,children:K.error.message}),i.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:i.error})]}),(0,Q.jsxs)(H,{className:`work-form-footer`,children:[(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:e,className:`font-label text-sm text-muted-foreground`,children:`Cancel`}),(0,Q.jsx)(p,{steps:i,busy:K.isPending,children:(0,Q.jsx)(a,{"data-testid":`edit-project-submit`,type:`submit`,size:`sm`,disabled:K.isPending,className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:K.isPending?`Saving…`:`Save changes`})})]})]})})]})})}function $({summary:e,allowNavigation:t=!0}){return(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 py-3 border-t border-outline-variant mt-2`,children:[(0,Q.jsxs)(W,{label:`Tasks`,children:[(0,Q.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.tasks.total}),Object.keys(e.tasks.by_status).length>0&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground text-sm ml-1`,children:[`(`,Object.entries(e.tasks.by_status).map(([e,t])=>`${t} ${e}`).join(`, `),`)`]})]}),(0,Q.jsx)(W,{label:`Memories`,children:t?(0,Q.jsx)(i,{"data-testid":`project-memories-link`,to:`${V}?project=${encodeURIComponent(e.project.id)}`,className:`font-label text-sm text-primary underline`,children:e.memories}):(0,Q.jsx)(`span`,{className:`font-label text-sm text-muted-foreground`,children:e.memories})}),(0,Q.jsx)(W,{label:`Jobs`,children:(0,Q.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.jobs})})]})}export{pe as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t}from"./jsx-runtime-CVMpzJz9.js";import{t as n}from"./clsx-DB0hHKMi.js";import{Bt as r,Dt as i,Et as a,H as o,I as s,J as c,M as l,N as u,Ot as d,Pt as f,Q as p,Y as m,f as h,ft as g,h as _,m as v,p as y,ut as b,wt as x,zt as S}from"./AreaChart-DcUZ3SzF.js";var C=e(t()),w=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?T(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){var t=k(e,`string`);return typeof t==`symbol`?t:t+``}function k(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}var j=(e,t)=>{var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!x(t.x1)||!x(t.y1)||!x(t.x2)||!x(t.y2))return null;n=C.createElement(`line`,A({},t,{className:`recharts-reference-line-line`}))}return n},M=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!x(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},N=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!x(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},P=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},F=(e,t,n,r,i,a,o)=>{var s=o.x,c=o.y,l=o.segment,u=o.ifOverflow,d=f(s);return f(c)?M(c,u,r,a,t,n):d?N(s,u,r,i,e,n):l!=null&&l.length===2?P(l,u,r,new w({x:e,y:t})):null};function I(e){var t=a();return(0,C.useEffect)(()=>(t(y(e)),()=>{t(v(e))})),null}function L(e){var t=e.xAxisId,a=e.yAxisId,d=e.shape,f=e.className,p=e.ifOverflow,v=g(),y=h(),x=i(e=>c(e,t)),w=i(e=>m(e,a)),T=i(e=>o(e,`xAxis`,t,v)),D=i(e=>o(e,`yAxis`,a,v)),O=b();if(!y||!O||x==null||w==null||T==null||D==null)return null;var k=F(T,D,O,e.position,x.orientation,w.orientation,e);if(!k)return null;var M=k[0],N=k[1];if(M==null||N==null)return null;var P=M.x,I=M.y,L=N.x,R=N.y,z=E(E({clipPath:p===`hidden`?`url(#${y})`:void 0},r(e)),{},{x1:P,y1:I,x2:L,y2:R}),B=_({x1:P,y1:I,x2:L,y2:R});return C.createElement(s,{zIndex:e.zIndex},C.createElement(S,{className:n(`recharts-reference-line`,f)},j(d,z),C.createElement(l,A({},B,{lowerWidth:B.width,upperWidth:B.width}),C.createElement(u,{label:e.label}),e.children)))}var R={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:p.line};function z(e){var t=d(e,R);return C.createElement(C.Fragment,null,C.createElement(I,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),C.createElement(L,t))}z.displayName=`ReferenceLine`;export{z 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{c as r,t as i}from"./button-BlVCkBiz.js";import{h as a}from"./client-RPZmgRqE.js";var o={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};o.node;var s=a(o),c=e(t(),1),l=n();function u({children:e,activeCount:t=0}){let[n,a]=(0,c.useState)(!1),o=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`contents`,children:[(0,l.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0 lg:hidden`,"aria-expanded":n,"aria-controls":o,"data-testid":`view-filters-toggle`,onClick:()=>a(!n),children:[(0,l.jsx)(s,{"aria-hidden":!0}),`Filters`,t>0?` (${t})`:``]}),(0,l.jsx)(`div`,{id:o,"data-testid":`view-filters`,className:r(`order-last w-full flex-wrap items-center gap-2 border-t border-border pt-3 lg:order-none lg:flex lg:w-auto lg:border-0 lg:pt-0 lg:[&>select]:w-auto`,n?`flex`:`hidden`),children:e})]})}export{u 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{s as r,t as i}from"./button-DeTgVWBh.js";import{P as a}from"./client-C0cF5m6-.js";var o={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};o.node;var s=a(o),c=e(t(),1),l=n();function u({children:e,activeCount:t=0}){let[n,a]=(0,c.useState)(!1),o=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`contents`,children:[(0,l.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0 lg:hidden`,"aria-expanded":n,"aria-controls":o,"data-testid":`view-filters-toggle`,onClick:()=>a(!n),children:[(0,l.jsx)(s,{"aria-hidden":!0}),`Filters`,t>0?` (${t})`:``]}),(0,l.jsx)(`div`,{id:o,"data-testid":`view-filters`,className:r(`order-last w-full flex-wrap items-center gap-2 border-t border-border pt-3 lg:order-none lg:flex lg:w-auto lg:border-0 lg:pt-0 lg:[&>select]:w-auto`,n?`flex`:`hidden`),children:e})]})}export{u as t};
@@ -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";import{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{P as a,n as o}from"./client-C0cF5m6-.js";import{t as s}from"./check-LRl-dSYs.js";import{t as c}from"./chevron-down-DtC3kwL9.js";import{$i as l,Bi as u,Bn as d,Dt as f,Fi as ee,Fn as p,Hn as te,In as m,Ir as ne,Mi as re,Pn as h,Rn as g,Vn as _,Xi as v,Yi as ie,di as y,fi as b,hr as x,jn as S,li as C,pn as w,xi as T,zn as E}from"./index-BoyulwgO.js";var D={name:`split`,size:24,node:[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]};D.node;var O=a(D),k=e(t(),1),A=n(),j=`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`,M=`${j} min-h-11 w-full justify-start border-0`;function N({session:e}){let{openLiveSession:t,info:n,terminals:a}=g(),c=r(),y=x(),b=w(),[C]=i(),[D,N]=(0,k.useState)(!1),[F,I]=(0,k.useState)(!1),[L,R]=(0,k.useState)(!1),[z,B]=(0,k.useState)(null),[V,H]=(0,k.useState)(null),[U,W]=(0,k.useState)(!1),G=h(e),K=S(e),q=d(a,e.id),J=C.get(`project`)??e.project_id,Y=!!(G||q||K),ae=q?null:n?.reason??`Integrated terminals are unavailable`,X=ne(e.agent)??(!G||!e.cwd?`Session has no native session ID or working folder.`:void 0),Z=D||L||F||b.isPending;(0,k.useEffect)(()=>{if(!V)return;let e=setTimeout(()=>H(null),2e3);return()=>clearTimeout(e)},[V]);async function oe(){if(B(null),q)c(m(te(q.id),J));else{N(!0);try{await t(e)}catch(e){B(e instanceof Error?e.message:`Could not open terminal`)}finally{N(!1)}}}async function se(){B(null),I(!0);try{await t(e,void 0,!0)}catch(e){B(e instanceof Error?e.message:`Could not fork the session`)}finally{I(!1)}}async function ce(t){B(null);try{await b.mutateAsync({id:e.id,hidden:t})}catch(e){B(e instanceof Error?e.message:`Could not update the session`)}}async function Q(e,t){B(null);try{await navigator.clipboard.writeText(e),H(t)}catch{B(`Clipboard access failed. Allow clipboard access and try again.`)}}async function le(){R(!0),B(null);try{y.openThread(await o.chat.resume(e.id));let t=new URLSearchParams(C);t.delete(`session`),t.set(`chat`,`open`),c({search:t.toString()})}catch(e){B(e instanceof Error?e.message:`Could not resume in chat`)}finally{R(!1)}}let $=t=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,"data-testid":`rename-session`,disabled:Z,onClick:()=>{t(),W(!0)},className:M,children:[(0,A.jsx)(re,{size:13}),`Rename`]}),(0,A.jsxs)(`button`,{type:`button`,"data-testid":e.hidden?`unhide-session`:`hide-session`,disabled:Z,title:e.hidden?`Show this session in the list again`:`Keep this session but leave it out of the list`,onClick:()=>{t(),ce(!e.hidden)},className:M,children:[e.hidden?(0,A.jsx)(ie,{size:13}):(0,A.jsx)(v,{size:13}),e.hidden?`Show in list`:`Hide from list`]})]});return(0,A.jsxs)(`div`,{className:`max-w-72 space-y-1 text-left`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:Y?(0,A.jsxs)(`fieldset`,{"aria-label":`Resume session`,className:`inline-flex`,children:[(0,A.jsxs)(`button`,{type:`button`,"data-testid":`open-chat-resume`,disabled:Z||!!X,title:X??`Resume in chat`,onClick:()=>void le(),className:`${j} rounded-r-none`,children:[(0,A.jsx)(ee,{size:13}),L?`Resuming…`:`Resume`]}),(0,A.jsx)(P,{triggerTestId:`resume-actions-menu`,triggerLabel:`More session actions`,triggerClass:`${j} rounded-l-none border-l-0 px-2`,extra:t=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,"data-testid":`open-terminal-resume`,disabled:Z||!q&&!n?.ready,title:ae??`Resume in terminal`,onClick:()=>{t(),oe()},className:M,children:[(0,A.jsx)(T,{size:13}),D?`Resuming…`:`Terminal`]}),K&&(0,A.jsxs)(`button`,{type:`button`,"data-testid":`fork-terminal-session`,disabled:Z||!n?.ready,title:n?.ready?`Open a new session that starts from this history; the original stays untouched`:n?.reason??`Integrated terminals are unavailable`,onClick:()=>{t(),se()},className:M,children:[(0,A.jsx)(O,{size:13}),F?`Forking…`:`Fork in terminal`]}),G&&(0,A.jsxs)(`button`,{type:`button`,"data-testid":`copy-resume`,className:M,title:G,onClick:()=>{t(),Q(G,`Resume command copied`)},children:[V===`Resume command copied`?(0,A.jsx)(s,{size:13}):(0,A.jsx)(l,{size:13}),`Copy resume command`]}),(0,A.jsxs)(`button`,{type:`button`,"data-testid":`copy-terminal-link`,className:M,"aria-label":`Copy terminal link`,title:`Copy terminal link`,onClick:()=>{t(),Q(E(m(_(e.id),J)),`Terminal link copied`)},children:[(0,A.jsx)(u,{size:13}),`Copy terminal link`]})]}),housekeeping:$})]}):(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,A.jsx)(`span`,{"data-testid":`resume-unavailable`,className:`max-w-56 text-xs text-outline`,children:p(e)}),(0,A.jsx)(P,{triggerTestId:`session-actions-menu`,triggerLabel:`Session actions`,triggerClass:`${j} px-2`,housekeeping:$})]})}),X&&Y&&(0,A.jsx)(`p`,{"data-testid":`chat-resume-unavailable`,className:`text-xs text-outline`,children:X}),V&&(0,A.jsx)(`p`,{role:`status`,"data-testid":`resume-feedback`,className:`text-xs text-outline`,children:V}),z&&(0,A.jsx)(`p`,{role:`alert`,className:`text-xs text-error wrap-break-word`,children:z}),(0,A.jsx)(f,{session:e,open:U,onClose:()=>W(!1)})]})}function P({triggerTestId:e,triggerLabel:t,triggerClass:n,extra:r,housekeeping:i}){let[a,o]=(0,k.useState)(!1),s=()=>o(!1);return(0,A.jsxs)(C,{open:a,onOpenChange:o,children:[(0,A.jsx)(b,{asChild:!0,children:(0,A.jsx)(`button`,{type:`button`,"data-testid":e,"aria-label":t,className:n,children:(0,A.jsx)(c,{size:13})})}),(0,A.jsxs)(y,{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:[r?.(s),i(s)]})]})}export{N as t};