@yuriai/web 0.3.2-beta.12 → 0.3.2-beta.15

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 (98) hide show
  1. package/dist/assets/{AgentAvatar-BJffjMB2.js → AgentAvatar-BzOcEUoS.js} +1 -1
  2. package/dist/assets/{AssistantConversationSurface--yxDjnQu.js → AssistantConversationSurface-Uot7OIYk.js} +3 -3
  3. package/dist/assets/{AssistantSessionCard-DdPqL_g8.js → AssistantSessionCard-1TQVLard.js} +2 -2
  4. package/dist/assets/{AssistantUnreadBadge-DM_fwozo.js → AssistantUnreadBadge-hL6MbaaH.js} +1 -1
  5. package/dist/assets/{AssistantView-dUWmrucP.js → AssistantView-Dyv1xxU2.js} +1 -1
  6. package/dist/assets/{DiagramView-CpoBNbaR.js → DiagramView-D20kMzCZ.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-CJqre5kV.js → FadeInOnReveal-D3eUin-b.js} +1 -1
  8. package/dist/assets/{GuiPluginPage-CM-Sop6a.js → GuiPluginPage-DA4wM2Ev.js} +1 -1
  9. package/dist/assets/{GuiPluginSurface-CAN_zgP3.js → GuiPluginSurface-DUD4zzGY.js} +1 -1
  10. package/dist/assets/{GuiPluginWindow-unA50cUu.js → GuiPluginWindow-DH9PaNLv.js} +1 -1
  11. package/dist/assets/{Icon-DSX7wjSw.js → Icon-RGzME9hn.js} +1 -1
  12. package/dist/assets/{ImageLoadingPlaceholder-PLO0B9my.js → ImageLoadingPlaceholder-DfFaijIL.js} +1 -1
  13. package/dist/assets/{LoadingImage-BAUw--5b.js → LoadingImage-C81TMCeu.js} +1 -1
  14. package/dist/assets/{MarkdownRenderer-C-hlqlA0.js → MarkdownRenderer-DMo1Znj3.js} +2 -2
  15. package/dist/assets/{MarkdownRendererImpl-CA9zIauD.js → MarkdownRendererImpl-CCNOjLII.js} +1 -1
  16. package/dist/assets/{MarkstreamRendererImpl-CwsjUaGC.js → MarkstreamRendererImpl-Clgt9ceq.js} +1 -1
  17. package/dist/assets/{MobileDetailNavigation-FfSrd8rW.js → MobileDetailNavigation-C4jx-32g.js} +1 -1
  18. package/dist/assets/{MobileResizableSheet-_VhodKQ3.js → MobileResizableSheet-DrdGceem.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-DtCqMWXT.js → MobileShareBridge-BTY3GYk0.js} +1 -1
  20. package/dist/assets/{MobileSurface-34aws7qB.js → MobileSurface-DvNuNZh9.js} +1 -1
  21. package/dist/assets/{MultiRunWindow-DCCjgHNE.js → MultiRunWindow-WpaJ5PuX.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-D7YC-sBK.js → OnboardingScreen-CExqFpo7.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-Ce9Mr4_V.js → OverlayScrollbar-V6sTSoqD.js} +1 -1
  24. package/dist/assets/{RemoteAssistantSessionCard-Csb19vol.js → RemoteAssistantSessionCard-CElTuysr.js} +1 -1
  25. package/dist/assets/{SettingsView-BF-DV5jC.js → SettingsView-C75-tcnH.js} +3 -3
  26. package/dist/assets/{SettingsWindow-BGec9rhJ.js → SettingsWindow-BCN8jnuO.js} +1 -1
  27. package/dist/assets/{SetupTourDialog-Du963bwh.js → SetupTourDialog-BFccOdFN.js} +1 -1
  28. package/dist/assets/{TerminalView-BLmis6W4.js → TerminalView-DC5D6Tn5.js} +1 -1
  29. package/dist/assets/{ToolOutputDialog-D5vUeeCg.js → ToolOutputDialog-BOs3HYPC.js} +1 -1
  30. package/dist/assets/{VoiceSettings-Cz4DTeu1.js → VoiceSettings-DPAqJ2XK.js} +1 -1
  31. package/dist/assets/{YuriWordmark-jFHGvbDP.js → YuriWordmark-D2e-o9nW.js} +1 -1
  32. package/dist/assets/{capgoAdapter-vcXrgtcl.js → capgoAdapter-BvecNhGW.js} +1 -1
  33. package/dist/assets/{checkbox-lnltTd4O.js → checkbox-Cim5LAVq.js} +1 -1
  34. package/dist/assets/{client-BsLh14yh.js → client-CzjApAA4.js} +4 -4
  35. package/dist/assets/{collapsible-B3_mc5eD.js → collapsible-D9TTgMWS.js} +1 -1
  36. package/dist/assets/{context-menu-CeBwB9rZ.js → context-menu-BXng4pmA.js} +1 -1
  37. package/dist/assets/{diagram-DUBp-_Yd.js → diagram-kKbfnx6q.js} +1 -1
  38. package/dist/assets/{dialog-f0jnPiqM.js → dialog-xzBmheBR.js} +1 -1
  39. package/dist/assets/{fileMentionTouchSelection-D5yvbxbi.js → fileMentionTouchSelection-BzdQxbUd.js} +1 -1
  40. package/dist/assets/{gitApi-BMcLfk7G.js → gitApi-DIxtL0wo.js} +1 -1
  41. package/dist/assets/gitApiHttp-BgUDBfaJ.js +3 -0
  42. package/dist/assets/{input-CTFR9La6.js → input-2AT-WL0G.js} +1 -1
  43. package/dist/assets/{insertionBoundaries-CVbCae7y.js → insertionBoundaries-C_905LuX.js} +1 -1
  44. package/dist/assets/{main-CUu7EunU.js → main-B5cE3xWa.js} +2 -2
  45. package/dist/assets/{main-BJ6CmPDc.js → main-DMfK7-mV.js} +7 -7
  46. package/dist/assets/{markdownHeightCache-BXL8JbYG.js → markdownHeightCache-VT58IYRV.js} +1 -1
  47. package/dist/assets/{mcpQueries-CvgW0Bl6.js → mcpQueries-Cy73FieQ.js} +1 -1
  48. package/dist/assets/{miniChat-J9pxSQyx.js → miniChat-Dx7bni4S.js} +2 -2
  49. package/dist/assets/{mobile-DYjeIixi.js → mobile-DPPD4h3P.js} +2 -2
  50. package/dist/assets/{mobileBackNavigation-hjJm8naw.js → mobileBackNavigation-BSKfSZVx.js} +1 -1
  51. package/dist/assets/{mobileConnections-BEr-iBDA.js → mobileConnections-C-97caJA.js} +2 -2
  52. package/dist/assets/{multirun-CntRJAjm.js → multirun-B9dQRCJu.js} +1 -1
  53. package/dist/assets/{native-config-DdAtv91r.js → native-config-DIGFHpiF.js} +1 -1
  54. package/dist/assets/{navigation-XRMYLkiK.js → navigation-BqH7w8k6.js} +1 -1
  55. package/dist/assets/{openRemoteProjectSession-C9_o5Yvr.js → openRemoteProjectSession-DEUCz51d.js} +1 -1
  56. package/dist/assets/{projectMeta-DyXicvG2.js → projectMeta-n_yR2IfR.js} +1 -1
  57. package/dist/assets/{pwa-B8e09BUU.js → pwa-pFzmmDsA.js} +1 -1
  58. package/dist/assets/queue-abort-optimistic-BKiCeb8W.js +1 -0
  59. package/dist/assets/{react-DAdu4yTi.js → react-Casi179K.js} +1 -1
  60. package/dist/assets/{readiness-Bxbkh3nB.js → readiness-Cn6GJ2pJ.js} +2 -2
  61. package/dist/assets/{reference-history-DtWYTywa.js → reference-history-ByfqEE3k.js} +1 -1
  62. package/dist/assets/{remoteProjectQueries-B-IcENvi.js → remoteProjectQueries-yX3kOkR6.js} +1 -1
  63. package/dist/assets/{remoteSessionReference-BEtE3Q92.js → remoteSessionReference-D56hccpi.js} +1 -1
  64. package/dist/assets/{renderElectronMiniChatApp-Dp6stG7q.js → renderElectronMiniChatApp-CFFBlM11.js} +2 -2
  65. package/dist/assets/{renderMobileApp-YITzRrOh.js → renderMobileApp-B_BVk8VQ.js} +5 -5
  66. package/dist/assets/{runtimeConfig-Ccbs_U5j.js → runtimeConfig-BskrN2gH.js} +1 -1
  67. package/dist/assets/runtimeEndpointReset-OJQs3Ji5.js +151 -0
  68. package/dist/assets/{select-CWX5Iu4G.js → select-CMPdA7Jz.js} +1 -1
  69. package/dist/assets/{sessionLookup-Cc1qteBf.js → sessionLookup-DC57HXZJ.js} +1 -1
  70. package/dist/assets/{sortable-tabs-strip-Dr7EhUHW.js → sortable-tabs-strip-CDuJ3SAL.js} +1 -1
  71. package/dist/assets/{speechSettingsQueries-C9SqPtzI.js → speechSettingsQueries-Cb01W_rF.js} +1 -1
  72. package/dist/assets/{src-BNTtvddA.css → src-DtLw-95J.css} +1 -1
  73. package/dist/assets/{terminalApi-Bk77qMTK.js → terminalApi-CwTOFYhX.js} +1 -1
  74. package/dist/assets/{textarea-C9CubBIs.js → textarea-Dd1TJka3.js} +1 -1
  75. package/dist/assets/{tooltip-Bk9lQalb.js → tooltip-JnhOGZST.js} +1 -1
  76. package/dist/assets/{types-Dhselvhe.js → types-CukQF3zY.js} +1 -1
  77. package/dist/assets/{useAppFontEffects-C7rRTGhP.js → useAppFontEffects-IARf1foL.js} +62 -62
  78. package/dist/assets/{useDesktopWindowControlsLayout-PzEwONdf.js → useDesktopWindowControlsLayout-qHhxNbBF.js} +1 -1
  79. package/dist/assets/{useDictation-CLxZQYs_.js → useDictation-OLmxagFb.js} +1 -1
  80. package/dist/assets/{useEffectiveDirectory-D0EiFP2j.js → useEffectiveDirectory-aRQ3KLec.js} +1 -1
  81. package/dist/assets/{useFontPreferences-DthR4yan.js → useFontPreferences-DN1mCOsX.js} +1 -1
  82. package/dist/assets/{useMobileNavigationStore-CWShXc31.js → useMobileNavigationStore-CRoFDKhN.js} +12 -12
  83. package/dist/assets/{usePluginsStore-CEq5xgbZ.js → usePluginsStore-Dn9fFq18.js} +1 -1
  84. package/dist/assets/{useProjectRuntimeAPIs-BDy_DoSn.js → useProjectRuntimeAPIs-CaH03MHY.js} +1 -1
  85. package/dist/assets/{useStreamingTextThrottle-BZuJKyrE.js → useStreamingTextThrottle-uA3MhkdT.js} +1 -1
  86. package/dist/index.html +9 -9
  87. package/dist/mini-chat.html +9 -9
  88. package/dist/mobile.html +2 -2
  89. package/package.json +1 -1
  90. package/server/lib/remote-hosts/DOCUMENTATION.md +7 -0
  91. package/server/lib/remote-hosts/gateway.js +14 -4
  92. package/server/lib/remote-hosts/routes.js +8 -0
  93. package/server/lib/remote-hosts/routes.test.js +62 -0
  94. package/server/lib/session-index/DOCUMENTATION.md +3 -0
  95. package/server/lib/session-index/service.js +4 -4
  96. package/dist/assets/gitApiHttp-Dk5fNrOy.js +0 -3
  97. package/dist/assets/queue-abort-optimistic-Buq-SBlq.js +0 -1
  98. package/dist/assets/runtimeEndpointReset-CcoaDynZ.js +0 -151
@@ -1 +1 @@
1
- import{i as e,n as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{a as r,i,r as a}from"./vendor-zustand-CNn3HHhT.js";import{o,ot as s,s as c}from"./vendor-base-ui-fom6orB6.js";import{t as l}from"./safeStorage-DTOhKN0V.js";import{n as u}from"./client-BsLh14yh.js";import{n as d}from"./vendor-react-D5BntRmA.js";import{s as f}from"./vendor-tanstack-react-query-ChSd65dm.js";import{E as p,J as m,K as h,q as g,z as _}from"./runtime-file-resource-CKQQEwNv.js";import{t as v}from"./i18n-BvjeIWrT.js";import{Ba as y,Ha as b,In as x,Rn as S}from"./useMobileNavigationStore-CWShXc31.js";var C=d(),w=s();function ee(e){let t=(0,C.c)(17),{checked:n,onChange:r,disabled:i,ariaLabel:a,className:s}=e,l=i!==void 0&&i,{t:u}=v(),d;t[0]!==n||t[1]!==l||t[2]!==r?(d=e=>{!l&&e!==n&&r(e)},t[0]=n,t[1]=l,t[2]=r,t[3]=d):d=t[3];let f;t[4]===s?f=t[5]:(f=S(`yuri-settings-switch`,s),t[4]=s,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=[!1,!0],t[6]=p):p=t[6];let m;t[7]!==n||t[8]!==u?(m=p.map(e=>(0,w.jsxs)(c,{value:e,nativeButton:!0,render:(0,w.jsx)(x,{variant:`ghost`,size:`xs`}),className:`yuri-settings-switch-option`,children:[n===e&&(0,w.jsx)(`span`,{"aria-hidden":!0,className:`yuri-segmented-selected-pill yuri-settings-switch-pill`}),(0,w.jsx)(`span`,{className:`relative`,children:u(e?`settings.switch.on`:`settings.switch.off`)})]},String(e))),t[7]=n,t[8]=u,t[9]=m):m=t[9];let h;return t[10]!==a||t[11]!==n||t[12]!==l||t[13]!==d||t[14]!==f||t[15]!==m?(h=(0,w.jsx)(o,{value:n,onValueChange:d,disabled:l,"aria-label":a,"aria-orientation":`horizontal`,"data-slot":`settings-switch`,className:f,onClick:E,onKeyDown:T,children:m}),t[10]=a,t[11]=n,t[12]=l,t[13]=d,t[14]=f,t[15]=m,t[16]=h):h=t[16],h}function T(e){return e.stopPropagation()}function E(e){return e.stopPropagation()}function D(e){let t=(0,C.c)(10),{children:n,actions:r,className:i}=e,a;t[0]===i?a=t[1]:(a=S(`flex shrink-0 items-center justify-between gap-3 py-3`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,w.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,w.jsx)(`div`,{className:`flex max-w-[70%] shrink-0 flex-wrap items-center justify-end gap-2 [&_button]:max-w-full [&_button]:whitespace-normal`,children:r}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,w.jsxs)(`header`,{"data-settings-action-header":``,className:a,children:[o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function O(e){let t=(0,C.c)(21),{label:n,actions:r,children:i,description:a,itemId:o,ariaLabel:s,className:c,cardClassName:l,cardId:u}=e,d=typeof n==`string`&&/^[\p{Script=Latin}\p{Number}\p{Punctuation}\p{Separator}]+$/u.test(n)?`latin`:void 0,f;t[0]===c?f=t[1]:(f=S(`yuri-settings-group`,c),t[0]=c,t[1]=f);let p;t[2]!==r||t[3]!==n||t[4]!==d?(p=r?(0,w.jsx)(D,{className:`py-0`,actions:r,children:n?(0,w.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null}):n?(0,w.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null,t[2]=r,t[3]=n,t[4]=d,t[5]=p):p=t[5];let m;t[6]===l?m=t[7]:(m=S(`yuri-settings-group-card`,l),t[6]=l,t[7]=m);let h;t[8]!==u||t[9]!==i||t[10]!==o||t[11]!==m?(h=(0,w.jsx)(`div`,{id:u,"data-settings-item":o,className:m,children:i}),t[8]=u,t[9]=i,t[10]=o,t[11]=m,t[12]=h):h=t[12];let g;t[13]===a?g=t[14]:(g=a?(0,w.jsx)(`p`,{className:`yuri-settings-group-description text-muted-foreground`,children:a}):null,t[13]=a,t[14]=g);let _;return t[15]!==s||t[16]!==f||t[17]!==p||t[18]!==h||t[19]!==g?(_=(0,w.jsxs)(`section`,{className:f,"aria-label":s,children:[p,h,g]}),t[15]=s,t[16]=f,t[17]=p,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function te(e){let t=(0,C.c)(20),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({label:s,description:a,descriptionPlacement:l,ariaLabel:n,groupClassName:o,cardClassName:r,children:i,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`inside`:l,d=u===`outside`?a:void 0,f=u===`inside`?a:void 0,p;t[9]!==i||t[10]!==s||t[11]!==c||t[12]!==f?(p=(0,w.jsx)(k,{label:s,description:f,...c,children:i}),t[9]=i,t[10]=s,t[11]=c,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==n||t[15]!==r||t[16]!==o||t[17]!==d||t[18]!==p?(m=(0,w.jsx)(O,{ariaLabel:n,className:o,cardClassName:r,description:d,children:p}),t[14]=n,t[15]=r,t[16]=o,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function k(e){let t=(0,C.c)(25),{label:n,children:r,description:i,footer:a,itemId:o,className:s,copyClassName:c,controlClassName:l}=e,u;t[0]===s?u=t[1]:(u=S(`yuri-settings-group-row yuri-settings-split-row`,s),t[0]=s,t[1]=u);let d;t[2]===c?d=t[3]:(d=S(`yuri-settings-split-row-copy`,c),t[2]=c,t[3]=d);let f;t[4]===n?f=t[5]:(f=n?(0,w.jsx)(`div`,{className:`typography-ui-label text-foreground`,children:n}):null,t[4]=n,t[5]=f);let p;t[6]===i?p=t[7]:(p=i?(0,w.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:i}):null,t[6]=i,t[7]=p);let m;t[8]!==d||t[9]!==f||t[10]!==p?(m=(0,w.jsxs)(`div`,{className:d,children:[f,p]}),t[8]=d,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===l?h=t[13]:(h=S(`yuri-settings-split-row-control`,l),t[12]=l,t[13]=h);let g;t[14]!==r||t[15]!==h?(g=(0,w.jsx)(`div`,{"data-settings-value":``,className:h,children:r}),t[14]=r,t[15]=h,t[16]=g):g=t[16];let _;t[17]===a?_=t[18]:(_=a?(0,w.jsx)(`div`,{"data-slot":`settings-row-footer`,className:`col-span-full min-w-0`,children:a}):null,t[17]=a,t[18]=_);let v;return t[19]!==o||t[20]!==u||t[21]!==m||t[22]!==g||t[23]!==_?(v=(0,w.jsxs)(`div`,{"data-settings-item":o,className:u,children:[m,g,_]}),t[19]=o,t[20]=u,t[21]=m,t[22]=g,t[23]=_,t[24]=v):v=t[24],v}function ne(e){let t=(0,C.c)(32),{checked:n,onChange:r,label:i,ariaLabel:a,description:o,itemId:s,disabled:c,className:l}=e,u=c!==void 0&&c,d;t[0]!==n||t[1]!==u||t[2]!==r?(d=()=>{u||r(!n)},t[0]=n,t[1]=u,t[2]=r,t[3]=d):d=t[3];let f=d,p=re,m=u?`cursor-not-allowed`:`cursor-pointer`,h;t[4]!==l||t[5]!==m?(h=S(`yuri-settings-group-row yuri-settings-split-row group`,m,l),t[4]=l,t[5]=m,t[6]=h):h=t[6];let g=u?-1:0,_=u||void 0,v,y;t[7]===f?(v=t[8],y=t[9]):(v=e=>{p(e.target)||f()},y=e=>{p(e.target)||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),f())},t[7]=f,t[8]=v,t[9]=y);let b;t[10]===i?b=t[11]:(b=(0,w.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:i}),t[10]=i,t[11]=b);let x;t[12]===o?x=t[13]:(x=o?(0,w.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:o}):null,t[12]=o,t[13]=x);let T;t[14]!==x||t[15]!==b?(T=(0,w.jsxs)(`div`,{className:`yuri-settings-split-row-copy`,children:[b,x]}),t[14]=x,t[15]=b,t[16]=T):T=t[16];let E;t[17]!==a||t[18]!==n||t[19]!==u||t[20]!==r?(E=(0,w.jsx)(`div`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,w.jsx)(ee,{checked:n,onChange:r,disabled:u,ariaLabel:a})}),t[17]=a,t[18]=n,t[19]=u,t[20]=r,t[21]=E):E=t[21];let D;return t[22]!==n||t[23]!==s||t[24]!==T||t[25]!==E||t[26]!==h||t[27]!==g||t[28]!==_||t[29]!==v||t[30]!==y?(D=(0,w.jsxs)(`div`,{"data-settings-item":s,className:h,role:`button`,tabIndex:g,"aria-pressed":n,"aria-disabled":_,onClick:v,onKeyDown:y,children:[T,E]}),t[22]=n,t[23]=s,t[24]=T,t[25]=E,t[26]=h,t[27]=g,t[28]=_,t[29]=v,t[30]=y,t[31]=D):D=t[31],D}function re(e){return e instanceof HTMLElement&&e.closest(`button, a, input, select, textarea`)!==null}var A=e=>{let t=e?.trim();return t?{location:{directory:t}}:void 0},ie=()=>{let e=u.getSdkClient().plugin;if(!e?.list||!e.check||!e.update)throw Error(`OpenCode plugin status is not available`);return e},ae=e=>{switch(e.type){case`package`:return{kind:`package`,target:e.target,version:e.version??null,outdated:e.outdated===!0,updating:e.updating===!0};case`local`:return{kind:`local`,path:e.path};case`builtin`:case`sdk`:return{kind:`builtin`};default:throw Error(`Unexpected plugin source: ${JSON.stringify(e)}`)}},oe=e=>{if(e.status===`active`)return{kind:`active`};if(e.status===`failed`)return{kind:`failed`,error:e.error,ref:e.ref??null};throw Error(`Unexpected plugin state: ${JSON.stringify(e)}`)},se=e=>({source:ae(e.source),state:oe(e.state)}),ce=e=>{if(!Array.isArray(e))throw Error(`OpenCode plugin status payload is invalid`);return e.map(e=>se(e))};async function j(e,t){return ce((await ie().list(A(e),t?{signal:t}:void 0))?.data)}async function le(e,t,n){let r=t.trim();if(!r)throw Error(`plugin.update requires a target`);await ie().update({...A(e),targets:[r]},n?{signal:n}:void 0)}function ue(e){return e instanceof Error&&e.message.trim()?e.message:typeof e==`string`&&e.trim()?e:`plugin operation failed`}var de=1500,M=e=>e?.trim()||null,N=(t,n=e())=>m.plugins.list(t,n),P=(t,n,r=!1,i=e())=>m.plugins.registry(t,n,r,i),F=(t,n=e())=>m.plugins.runtime(t,n),I=0,L=()=>(I+=1,I),R=(e,t,n)=>e.getQueryData(F(t,n)),z=(t=y(),n=e(),r)=>{let i=r?t??r.location.directory:M(t),a=_(r);return{queryKey:a.key(N(i,n)),queryFn:async({signal:e})=>{let t=await a.fetch(_e(`/api/config/plugins`,i),{headers:U(i),signal:e});if(!t.ok)throw Error(`Failed to load plugins`);let n=await t.json();return a.assertCurrent(e),{entries:n.entries??[],files:n.files??[]}},staleTime:5e3,retry:2}},B=(t,r,i=!1,a=e(),o=!1)=>{let s=M(t),c=h(r);return{queryKey:o?[...P(s,c,i,a),`details`]:P(s,c,i,a),queryFn:async({signal:e})=>{let t={};for(let r of ye(c)){let a=ve(r,i,s),c=await n(o?`${a}&details=true`:a,{headers:U(s),signal:e});if(!c.ok)throw Error(`Failed to load plugin registry info`);let l=await c.json();for(let e of l.results??[])t[e.spec]=e}return t},staleTime:i?0:3e5,retry:2}},fe=(t=y(),n=e(),r)=>{let i=r?t??r.location.directory:M(t),a=_(r);return{queryKey:a.key(F(i,n)),queryFn:async({signal:e})=>{if(r){let t=await r.sdk().plugin.list({location:{directory:i??r.location.directory}},{signal:e});if(a.assertCurrent(e),!Array.isArray(t.data))throw Error(`Failed to load remote plugin runtime`);return t.data.map(e=>({source:e.source.type===`package`?{kind:`package`,target:e.source.target,version:e.source.version??null,outdated:e.source.outdated===!0,updating:e.source.updating===!0}:e.source.type===`local`?{kind:`local`,path:e.source.path}:{kind:`builtin`},state:e.state.status===`failed`?{kind:`failed`,error:e.state.error,ref:e.state.ref??null}:{kind:`active`}}))}let t=L(),o=await j(i,e);if(t!==I){let e=R(g,i,n);if(e)return e;throw Error(`Stale plugin runtime read`)}return o},staleTime:5e3,retry:!1}},pe=e=>{let t=(0,C.c)(11),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n,i=p(),a=b(be),o;t[2]!==a||t[3]!==i?.entry.location.directory?(o=i?.entry.location.directory??M(a)??M(u.getDirectory()),t[2]=a,t[3]=i?.entry.location.directory,t[4]=o):o=t[4];let s=i?.entry,c;t[5]!==o||t[6]!==s?(c=z(o,void 0,s),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r.enabled||t[9]!==c?(l={...c,enabled:r.enabled},t[8]=r.enabled,t[9]=c,t[10]=l):l=t[10],f(l)},me=(e,t)=>{let n=(0,C.c)(6),r=t!==void 0&&t,i=b(xe),a;n[0]!==i||n[1]!==r||n[2]!==e?(a=B(M(i)??M(u.getDirectory()),e,r),n[0]=i,n[1]=r,n[2]=e,n[3]=a):a=n[3];let o;return n[4]===a?o=n[5]:(o={...a},n[4]=a,n[5]=o),f(o)},V=()=>{let e=(0,C.c)(2),t=b(Se),n;return e[0]===t?n=e[1]:(n=M(t)??M(u.getDirectory()),e[0]=t,e[1]=n),n},he=e=>{let t=(0,C.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n,i=p(),a=V(),o=i?.entry.location.directory??a,s=i?.entry,c;t[2]!==o||t[3]!==s?(c=fe(o,void 0,s),t[2]=o,t[3]=s,t[4]=c):c=t[4];let l;return t[5]!==r.enabled||t[6]!==c?(l={...c,enabled:r.enabled},t[5]=r.enabled,t[6]=c,t[7]=l):l=t[7],f(l)},H=async(t,n,r)=>{let i=M(n);return e()===r?t.fetchQuery({...z(i,r),staleTime:0}):t.getQueryData(N(i,r))??{entries:[],files:[]}},ge=async(t,n,r)=>{let i=M(n);if(e()!==r)return R(t,i,r);let a=L(),o=await j(i);return a!==I||e()!==r?R(t,i,r):(t.setQueryData(F(i,r),o),o)};function _e(e,t){return`${e}${t?`?directory=${encodeURIComponent(t)}`:``}`}function ve(e,t,n){let r=new URLSearchParams;t&&r.set(`refresh`,`true`),n&&r.set(`directory`,n);let i=r.toString();return`/api/config/plugins/registry?${`specs=${e.map(encodeURIComponent).join(`,`)}`}${i?`&${i}`:``}`}function ye(e){let t=[],n=[],r=0;for(let i of e){let e=encodeURIComponent(i),a=n.length===0?e.length:r+1+e.length;if(n.length>0&&a>de){t.push(n),n=[i],r=e.length;continue}n.push(i),r=a}return n.length>0&&t.push(n),t}function U(e){return e?{"x-opencode-directory":e}:void 0}function be(e){return e.getActiveProject?.()?.path??null}function xe(e){return e.getActiveProject?.()?.path??null}function Se(e){return e.getActiveProject?.()?.path??null}var W=()=>{try{let e=b.getState().getActiveProject?.();if(e?.path?.trim())return e.path.trim();let t=u.getDirectory();if(t?.trim())return t.trim()}catch(e){console.warn(`[PluginsStore] Error resolving config directory:`,e)}return null},Ce=5e3,we=`__default__`,G=new Map,K=new Map,Te=1500,q=e=>e?.trim()||we,Ee=e=>{G.delete(q(e))},J=r()(a(i((r,i)=>({entries:[],files:[],selectedId:null,isLoading:!1,registryInfo:{},isLoadingRegistry:!1,draft:null,setSelected:e=>r({selectedId:e}),setDraft:e=>r({draft:e}),loadPlugins:async n=>{let a=W(),o=e(),s=t(),c=()=>o===e()&&s===t()&&a===W(),l=q(a),u=Date.now(),d=G.get(l)??0,f=i().entries.length>0||i().files.length>0;if(!n?.force&&f&&u-d<Ce)return!0;let p=K.get(l);if(!n?.force&&p)return p;let m=(async()=>{r({isLoading:!0});try{let e=n?.force?await H(g,a,o):await g.fetchQuery(z(a,o));return c()?(r({entries:e.entries??[],files:e.files??[],isLoading:!1}),G.set(l,Date.now()),n?.force||i().loadRegistryInfo(),!0):!1}catch(e){return console.error(`[PluginsStore] Failed to load plugins:`,e),c()&&r({isLoading:!1}),!1}})();K.set(l,m);try{return await m}finally{K.delete(l)}},loadRegistryInfo:async e=>{let t=Oe(e?.specs??i().entries.map(e=>e.spec));if(t.length===0){r({isLoadingRegistry:!1});return}r({isLoadingRegistry:!0});try{let a=W(),o={...i().registryInfo};for(let r of ke(t)){let t=await n(De(r,e?.force===!0,a),{headers:X(a)});if(!t.ok)throw Error(`Failed to load plugin registry info`);let i=await $(t);for(let e of i.results??[])o[e.spec]=e}r({registryInfo:o,isLoadingRegistry:!1})}catch(e){console.error(`[PluginsStore] Failed to load plugin registry info:`,e),r({isLoadingRegistry:!1})}},updateToLatest:async e=>{let t=i().entries.find(t=>t.id===e);if(!t)return{ok:!1};let n=i().registryInfo[t.spec];return!n||n.kind!==`npm-ok`||!n.hasUpdate||!n.latestVersion?{ok:!1}:await i().updateEntry(e,{spec:`${n.name}@${n.latestVersion}`})},createEntry:async e=>{let t=await Q(async t=>await n(Y(`/api/config/plugins/entry`,t),{method:`POST`,headers:Z(t),body:JSON.stringify(Ae(e))}));return t.ok&&i().loadRegistryInfo({specs:[e.spec],force:!0}),t},updateEntry:async(t,r)=>{let a=(g.getQueryData(z(W(),e()).queryKey)?.entries??i().entries).find(e=>e.id===t),o=a?.spec,s=r.spec??o,c=await Q(async e=>await n(Y(`/api/config/plugins/entry/${encodeURIComponent(t)}`,e),{method:`PATCH`,headers:Z(e),body:JSON.stringify(Ae(r))}),a&&s?{...a,spec:s}:void 0);return c.ok&&s&&i().loadRegistryInfo({specs:[s],force:!0}),c},deleteEntry:async e=>{let t=i().entries.find(t=>t.id===e),a=await Q(async t=>await n(Y(`/api/config/plugins/entry/${encodeURIComponent(e)}`,t),{method:`DELETE`,headers:X(t)}));if(a.ok&&i().selectedId===e&&r({selectedId:null}),a.ok&&t){let e={...i().registryInfo};delete e[t.spec],r({registryInfo:e})}return a},readFile:async e=>{try{let t=W(),r=await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,t),{headers:X(t)});if(!r.ok)throw Error(`Failed to read plugin file`);return await $(r)}catch(e){return console.error(`[PluginsStore] Failed to read plugin file:`,e),null}},createFile:async e=>Q(async t=>await n(Y(`/api/config/plugins/file`,t),{method:`POST`,headers:Z(t),body:JSON.stringify(e)})),updateFile:async(e,t)=>Q(async r=>await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,r),{method:`PUT`,headers:Z(r),body:JSON.stringify(t)})),deleteFile:async e=>{let t=await Q(async t=>await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,t),{method:`DELETE`,headers:X(t)}));return t.ok&&i().selectedId===e&&r({selectedId:null}),t},getById:e=>i().entries.find(t=>t.id===e)??i().files.find(t=>t.id===e)}),{name:`plugins-store`,storage:l(),partialize:e=>({selectedId:e.selectedId})}),{name:`plugins-store`}));function Y(e,t){return`${e}${t?`?directory=${encodeURIComponent(t)}`:``}`}function De(e,t,n){let r=new URLSearchParams;t&&r.set(`refresh`,`true`),n&&r.set(`directory`,n);let i=r.toString();return`/api/config/plugins/registry?${`specs=${e.map(encodeURIComponent).join(`,`)}`}${i?`&${i}`:``}`}function Oe(e){return Array.from(new Set(e.map(e=>e.trim()).filter(Boolean)))}function ke(e){let t=[],n=[],r=0;for(let i of e){let e=encodeURIComponent(i),a=n.length===0?e.length:r+1+e.length;n.length>0&&a>Te?(t.push(n),n=[i],r=e.length):(n.push(i),r=a)}return n.length>0&&t.push(n),t}function X(e){return e?{"x-opencode-directory":e}:void 0}function Z(e){return{"Content-Type":`application/json`,...e?{"x-opencode-directory":e}:{}}}function Ae(e){let t={};return e.spec!==void 0&&(t.spec=e.spec),e.options!==void 0&&(t.options=e.options),e.scope!==void 0&&(t.scope=e.scope),t}async function Q(n,r){let i=e(),a=t();try{let o=W(),s=await n(o),c=await $(s).catch(()=>null);if(!s.ok)throw Error(c?.error||`Failed to update plugin configuration`);if(i!==e()||a!==t())return{ok:!0};Ee(o);let l=await H(g,o,i);if(o===W()&&i===e()&&a===t()){let e=r&&J.getState().selectedId===r.id?l.entries.find(e=>e.spec===r.spec&&e.scope===r.scope&&e.sourcePath===r.sourcePath):void 0;J.setState({entries:l.entries,files:l.files,...e?{selectedId:e.id}:{}}),G.set(q(o),Date.now())}return{ok:!0,reloadFailed:c?.reloadFailed===!0,message:c?.message,warning:c?.warning}}catch(e){return console.error(`[PluginsStore] Failed to update plugin configuration:`,e),{ok:!1}}}async function $(e){return await e.json()}export{V as a,pe as c,te as d,O as f,ee as g,D as h,ge as i,ue as l,ne as m,B as n,me as o,k as p,z as r,he as s,J as t,le as u};
1
+ import{i as e,n as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{a as r,i,r as a}from"./vendor-zustand-CNn3HHhT.js";import{o,ot as s,s as c}from"./vendor-base-ui-fom6orB6.js";import{t as l}from"./safeStorage-DTOhKN0V.js";import{n as u}from"./client-CzjApAA4.js";import{n as d}from"./vendor-react-D5BntRmA.js";import{s as f}from"./vendor-tanstack-react-query-ChSd65dm.js";import{E as p,J as m,K as h,q as g,z as _}from"./runtime-file-resource-CKQQEwNv.js";import{t as v}from"./i18n-BvjeIWrT.js";import{Ba as y,Ha as b,In as x,Rn as S}from"./useMobileNavigationStore-CRoFDKhN.js";var C=d(),w=s();function ee(e){let t=(0,C.c)(17),{checked:n,onChange:r,disabled:i,ariaLabel:a,className:s}=e,l=i!==void 0&&i,{t:u}=v(),d;t[0]!==n||t[1]!==l||t[2]!==r?(d=e=>{!l&&e!==n&&r(e)},t[0]=n,t[1]=l,t[2]=r,t[3]=d):d=t[3];let f;t[4]===s?f=t[5]:(f=S(`yuri-settings-switch`,s),t[4]=s,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=[!1,!0],t[6]=p):p=t[6];let m;t[7]!==n||t[8]!==u?(m=p.map(e=>(0,w.jsxs)(c,{value:e,nativeButton:!0,render:(0,w.jsx)(x,{variant:`ghost`,size:`xs`}),className:`yuri-settings-switch-option`,children:[n===e&&(0,w.jsx)(`span`,{"aria-hidden":!0,className:`yuri-segmented-selected-pill yuri-settings-switch-pill`}),(0,w.jsx)(`span`,{className:`relative`,children:u(e?`settings.switch.on`:`settings.switch.off`)})]},String(e))),t[7]=n,t[8]=u,t[9]=m):m=t[9];let h;return t[10]!==a||t[11]!==n||t[12]!==l||t[13]!==d||t[14]!==f||t[15]!==m?(h=(0,w.jsx)(o,{value:n,onValueChange:d,disabled:l,"aria-label":a,"aria-orientation":`horizontal`,"data-slot":`settings-switch`,className:f,onClick:E,onKeyDown:T,children:m}),t[10]=a,t[11]=n,t[12]=l,t[13]=d,t[14]=f,t[15]=m,t[16]=h):h=t[16],h}function T(e){return e.stopPropagation()}function E(e){return e.stopPropagation()}function D(e){let t=(0,C.c)(10),{children:n,actions:r,className:i}=e,a;t[0]===i?a=t[1]:(a=S(`flex shrink-0 items-center justify-between gap-3 py-3`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,w.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,w.jsx)(`div`,{className:`flex max-w-[70%] shrink-0 flex-wrap items-center justify-end gap-2 [&_button]:max-w-full [&_button]:whitespace-normal`,children:r}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,w.jsxs)(`header`,{"data-settings-action-header":``,className:a,children:[o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function O(e){let t=(0,C.c)(21),{label:n,actions:r,children:i,description:a,itemId:o,ariaLabel:s,className:c,cardClassName:l,cardId:u}=e,d=typeof n==`string`&&/^[\p{Script=Latin}\p{Number}\p{Punctuation}\p{Separator}]+$/u.test(n)?`latin`:void 0,f;t[0]===c?f=t[1]:(f=S(`yuri-settings-group`,c),t[0]=c,t[1]=f);let p;t[2]!==r||t[3]!==n||t[4]!==d?(p=r?(0,w.jsx)(D,{className:`py-0`,actions:r,children:n?(0,w.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null}):n?(0,w.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null,t[2]=r,t[3]=n,t[4]=d,t[5]=p):p=t[5];let m;t[6]===l?m=t[7]:(m=S(`yuri-settings-group-card`,l),t[6]=l,t[7]=m);let h;t[8]!==u||t[9]!==i||t[10]!==o||t[11]!==m?(h=(0,w.jsx)(`div`,{id:u,"data-settings-item":o,className:m,children:i}),t[8]=u,t[9]=i,t[10]=o,t[11]=m,t[12]=h):h=t[12];let g;t[13]===a?g=t[14]:(g=a?(0,w.jsx)(`p`,{className:`yuri-settings-group-description text-muted-foreground`,children:a}):null,t[13]=a,t[14]=g);let _;return t[15]!==s||t[16]!==f||t[17]!==p||t[18]!==h||t[19]!==g?(_=(0,w.jsxs)(`section`,{className:f,"aria-label":s,children:[p,h,g]}),t[15]=s,t[16]=f,t[17]=p,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function te(e){let t=(0,C.c)(20),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({label:s,description:a,descriptionPlacement:l,ariaLabel:n,groupClassName:o,cardClassName:r,children:i,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`inside`:l,d=u===`outside`?a:void 0,f=u===`inside`?a:void 0,p;t[9]!==i||t[10]!==s||t[11]!==c||t[12]!==f?(p=(0,w.jsx)(k,{label:s,description:f,...c,children:i}),t[9]=i,t[10]=s,t[11]=c,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==n||t[15]!==r||t[16]!==o||t[17]!==d||t[18]!==p?(m=(0,w.jsx)(O,{ariaLabel:n,className:o,cardClassName:r,description:d,children:p}),t[14]=n,t[15]=r,t[16]=o,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function k(e){let t=(0,C.c)(25),{label:n,children:r,description:i,footer:a,itemId:o,className:s,copyClassName:c,controlClassName:l}=e,u;t[0]===s?u=t[1]:(u=S(`yuri-settings-group-row yuri-settings-split-row`,s),t[0]=s,t[1]=u);let d;t[2]===c?d=t[3]:(d=S(`yuri-settings-split-row-copy`,c),t[2]=c,t[3]=d);let f;t[4]===n?f=t[5]:(f=n?(0,w.jsx)(`div`,{className:`typography-ui-label text-foreground`,children:n}):null,t[4]=n,t[5]=f);let p;t[6]===i?p=t[7]:(p=i?(0,w.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:i}):null,t[6]=i,t[7]=p);let m;t[8]!==d||t[9]!==f||t[10]!==p?(m=(0,w.jsxs)(`div`,{className:d,children:[f,p]}),t[8]=d,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===l?h=t[13]:(h=S(`yuri-settings-split-row-control`,l),t[12]=l,t[13]=h);let g;t[14]!==r||t[15]!==h?(g=(0,w.jsx)(`div`,{"data-settings-value":``,className:h,children:r}),t[14]=r,t[15]=h,t[16]=g):g=t[16];let _;t[17]===a?_=t[18]:(_=a?(0,w.jsx)(`div`,{"data-slot":`settings-row-footer`,className:`col-span-full min-w-0`,children:a}):null,t[17]=a,t[18]=_);let v;return t[19]!==o||t[20]!==u||t[21]!==m||t[22]!==g||t[23]!==_?(v=(0,w.jsxs)(`div`,{"data-settings-item":o,className:u,children:[m,g,_]}),t[19]=o,t[20]=u,t[21]=m,t[22]=g,t[23]=_,t[24]=v):v=t[24],v}function ne(e){let t=(0,C.c)(32),{checked:n,onChange:r,label:i,ariaLabel:a,description:o,itemId:s,disabled:c,className:l}=e,u=c!==void 0&&c,d;t[0]!==n||t[1]!==u||t[2]!==r?(d=()=>{u||r(!n)},t[0]=n,t[1]=u,t[2]=r,t[3]=d):d=t[3];let f=d,p=re,m=u?`cursor-not-allowed`:`cursor-pointer`,h;t[4]!==l||t[5]!==m?(h=S(`yuri-settings-group-row yuri-settings-split-row group`,m,l),t[4]=l,t[5]=m,t[6]=h):h=t[6];let g=u?-1:0,_=u||void 0,v,y;t[7]===f?(v=t[8],y=t[9]):(v=e=>{p(e.target)||f()},y=e=>{p(e.target)||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),f())},t[7]=f,t[8]=v,t[9]=y);let b;t[10]===i?b=t[11]:(b=(0,w.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:i}),t[10]=i,t[11]=b);let x;t[12]===o?x=t[13]:(x=o?(0,w.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:o}):null,t[12]=o,t[13]=x);let T;t[14]!==x||t[15]!==b?(T=(0,w.jsxs)(`div`,{className:`yuri-settings-split-row-copy`,children:[b,x]}),t[14]=x,t[15]=b,t[16]=T):T=t[16];let E;t[17]!==a||t[18]!==n||t[19]!==u||t[20]!==r?(E=(0,w.jsx)(`div`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,w.jsx)(ee,{checked:n,onChange:r,disabled:u,ariaLabel:a})}),t[17]=a,t[18]=n,t[19]=u,t[20]=r,t[21]=E):E=t[21];let D;return t[22]!==n||t[23]!==s||t[24]!==T||t[25]!==E||t[26]!==h||t[27]!==g||t[28]!==_||t[29]!==v||t[30]!==y?(D=(0,w.jsxs)(`div`,{"data-settings-item":s,className:h,role:`button`,tabIndex:g,"aria-pressed":n,"aria-disabled":_,onClick:v,onKeyDown:y,children:[T,E]}),t[22]=n,t[23]=s,t[24]=T,t[25]=E,t[26]=h,t[27]=g,t[28]=_,t[29]=v,t[30]=y,t[31]=D):D=t[31],D}function re(e){return e instanceof HTMLElement&&e.closest(`button, a, input, select, textarea`)!==null}var A=e=>{let t=e?.trim();return t?{location:{directory:t}}:void 0},ie=()=>{let e=u.getSdkClient().plugin;if(!e?.list||!e.check||!e.update)throw Error(`OpenCode plugin status is not available`);return e},ae=e=>{switch(e.type){case`package`:return{kind:`package`,target:e.target,version:e.version??null,outdated:e.outdated===!0,updating:e.updating===!0};case`local`:return{kind:`local`,path:e.path};case`builtin`:case`sdk`:return{kind:`builtin`};default:throw Error(`Unexpected plugin source: ${JSON.stringify(e)}`)}},oe=e=>{if(e.status===`active`)return{kind:`active`};if(e.status===`failed`)return{kind:`failed`,error:e.error,ref:e.ref??null};throw Error(`Unexpected plugin state: ${JSON.stringify(e)}`)},se=e=>({source:ae(e.source),state:oe(e.state)}),ce=e=>{if(!Array.isArray(e))throw Error(`OpenCode plugin status payload is invalid`);return e.map(e=>se(e))};async function j(e,t){return ce((await ie().list(A(e),t?{signal:t}:void 0))?.data)}async function le(e,t,n){let r=t.trim();if(!r)throw Error(`plugin.update requires a target`);await ie().update({...A(e),targets:[r]},n?{signal:n}:void 0)}function ue(e){return e instanceof Error&&e.message.trim()?e.message:typeof e==`string`&&e.trim()?e:`plugin operation failed`}var de=1500,M=e=>e?.trim()||null,N=(t,n=e())=>m.plugins.list(t,n),P=(t,n,r=!1,i=e())=>m.plugins.registry(t,n,r,i),F=(t,n=e())=>m.plugins.runtime(t,n),I=0,L=()=>(I+=1,I),R=(e,t,n)=>e.getQueryData(F(t,n)),z=(t=y(),n=e(),r)=>{let i=r?t??r.location.directory:M(t),a=_(r);return{queryKey:a.key(N(i,n)),queryFn:async({signal:e})=>{let t=await a.fetch(_e(`/api/config/plugins`,i),{headers:U(i),signal:e});if(!t.ok)throw Error(`Failed to load plugins`);let n=await t.json();return a.assertCurrent(e),{entries:n.entries??[],files:n.files??[]}},staleTime:5e3,retry:2}},B=(t,r,i=!1,a=e(),o=!1)=>{let s=M(t),c=h(r);return{queryKey:o?[...P(s,c,i,a),`details`]:P(s,c,i,a),queryFn:async({signal:e})=>{let t={};for(let r of ye(c)){let a=ve(r,i,s),c=await n(o?`${a}&details=true`:a,{headers:U(s),signal:e});if(!c.ok)throw Error(`Failed to load plugin registry info`);let l=await c.json();for(let e of l.results??[])t[e.spec]=e}return t},staleTime:i?0:3e5,retry:2}},fe=(t=y(),n=e(),r)=>{let i=r?t??r.location.directory:M(t),a=_(r);return{queryKey:a.key(F(i,n)),queryFn:async({signal:e})=>{if(r){let t=await r.sdk().plugin.list({location:{directory:i??r.location.directory}},{signal:e});if(a.assertCurrent(e),!Array.isArray(t.data))throw Error(`Failed to load remote plugin runtime`);return t.data.map(e=>({source:e.source.type===`package`?{kind:`package`,target:e.source.target,version:e.source.version??null,outdated:e.source.outdated===!0,updating:e.source.updating===!0}:e.source.type===`local`?{kind:`local`,path:e.source.path}:{kind:`builtin`},state:e.state.status===`failed`?{kind:`failed`,error:e.state.error,ref:e.state.ref??null}:{kind:`active`}}))}let t=L(),o=await j(i,e);if(t!==I){let e=R(g,i,n);if(e)return e;throw Error(`Stale plugin runtime read`)}return o},staleTime:5e3,retry:!1}},pe=e=>{let t=(0,C.c)(11),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n,i=p(),a=b(be),o;t[2]!==a||t[3]!==i?.entry.location.directory?(o=i?.entry.location.directory??M(a)??M(u.getDirectory()),t[2]=a,t[3]=i?.entry.location.directory,t[4]=o):o=t[4];let s=i?.entry,c;t[5]!==o||t[6]!==s?(c=z(o,void 0,s),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r.enabled||t[9]!==c?(l={...c,enabled:r.enabled},t[8]=r.enabled,t[9]=c,t[10]=l):l=t[10],f(l)},me=(e,t)=>{let n=(0,C.c)(6),r=t!==void 0&&t,i=b(xe),a;n[0]!==i||n[1]!==r||n[2]!==e?(a=B(M(i)??M(u.getDirectory()),e,r),n[0]=i,n[1]=r,n[2]=e,n[3]=a):a=n[3];let o;return n[4]===a?o=n[5]:(o={...a},n[4]=a,n[5]=o),f(o)},V=()=>{let e=(0,C.c)(2),t=b(Se),n;return e[0]===t?n=e[1]:(n=M(t)??M(u.getDirectory()),e[0]=t,e[1]=n),n},he=e=>{let t=(0,C.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n,i=p(),a=V(),o=i?.entry.location.directory??a,s=i?.entry,c;t[2]!==o||t[3]!==s?(c=fe(o,void 0,s),t[2]=o,t[3]=s,t[4]=c):c=t[4];let l;return t[5]!==r.enabled||t[6]!==c?(l={...c,enabled:r.enabled},t[5]=r.enabled,t[6]=c,t[7]=l):l=t[7],f(l)},H=async(t,n,r)=>{let i=M(n);return e()===r?t.fetchQuery({...z(i,r),staleTime:0}):t.getQueryData(N(i,r))??{entries:[],files:[]}},ge=async(t,n,r)=>{let i=M(n);if(e()!==r)return R(t,i,r);let a=L(),o=await j(i);return a!==I||e()!==r?R(t,i,r):(t.setQueryData(F(i,r),o),o)};function _e(e,t){return`${e}${t?`?directory=${encodeURIComponent(t)}`:``}`}function ve(e,t,n){let r=new URLSearchParams;t&&r.set(`refresh`,`true`),n&&r.set(`directory`,n);let i=r.toString();return`/api/config/plugins/registry?${`specs=${e.map(encodeURIComponent).join(`,`)}`}${i?`&${i}`:``}`}function ye(e){let t=[],n=[],r=0;for(let i of e){let e=encodeURIComponent(i),a=n.length===0?e.length:r+1+e.length;if(n.length>0&&a>de){t.push(n),n=[i],r=e.length;continue}n.push(i),r=a}return n.length>0&&t.push(n),t}function U(e){return e?{"x-opencode-directory":e}:void 0}function be(e){return e.getActiveProject?.()?.path??null}function xe(e){return e.getActiveProject?.()?.path??null}function Se(e){return e.getActiveProject?.()?.path??null}var W=()=>{try{let e=b.getState().getActiveProject?.();if(e?.path?.trim())return e.path.trim();let t=u.getDirectory();if(t?.trim())return t.trim()}catch(e){console.warn(`[PluginsStore] Error resolving config directory:`,e)}return null},Ce=5e3,we=`__default__`,G=new Map,K=new Map,Te=1500,q=e=>e?.trim()||we,Ee=e=>{G.delete(q(e))},J=r()(a(i((r,i)=>({entries:[],files:[],selectedId:null,isLoading:!1,registryInfo:{},isLoadingRegistry:!1,draft:null,setSelected:e=>r({selectedId:e}),setDraft:e=>r({draft:e}),loadPlugins:async n=>{let a=W(),o=e(),s=t(),c=()=>o===e()&&s===t()&&a===W(),l=q(a),u=Date.now(),d=G.get(l)??0,f=i().entries.length>0||i().files.length>0;if(!n?.force&&f&&u-d<Ce)return!0;let p=K.get(l);if(!n?.force&&p)return p;let m=(async()=>{r({isLoading:!0});try{let e=n?.force?await H(g,a,o):await g.fetchQuery(z(a,o));return c()?(r({entries:e.entries??[],files:e.files??[],isLoading:!1}),G.set(l,Date.now()),n?.force||i().loadRegistryInfo(),!0):!1}catch(e){return console.error(`[PluginsStore] Failed to load plugins:`,e),c()&&r({isLoading:!1}),!1}})();K.set(l,m);try{return await m}finally{K.delete(l)}},loadRegistryInfo:async e=>{let t=Oe(e?.specs??i().entries.map(e=>e.spec));if(t.length===0){r({isLoadingRegistry:!1});return}r({isLoadingRegistry:!0});try{let a=W(),o={...i().registryInfo};for(let r of ke(t)){let t=await n(De(r,e?.force===!0,a),{headers:X(a)});if(!t.ok)throw Error(`Failed to load plugin registry info`);let i=await $(t);for(let e of i.results??[])o[e.spec]=e}r({registryInfo:o,isLoadingRegistry:!1})}catch(e){console.error(`[PluginsStore] Failed to load plugin registry info:`,e),r({isLoadingRegistry:!1})}},updateToLatest:async e=>{let t=i().entries.find(t=>t.id===e);if(!t)return{ok:!1};let n=i().registryInfo[t.spec];return!n||n.kind!==`npm-ok`||!n.hasUpdate||!n.latestVersion?{ok:!1}:await i().updateEntry(e,{spec:`${n.name}@${n.latestVersion}`})},createEntry:async e=>{let t=await Q(async t=>await n(Y(`/api/config/plugins/entry`,t),{method:`POST`,headers:Z(t),body:JSON.stringify(Ae(e))}));return t.ok&&i().loadRegistryInfo({specs:[e.spec],force:!0}),t},updateEntry:async(t,r)=>{let a=(g.getQueryData(z(W(),e()).queryKey)?.entries??i().entries).find(e=>e.id===t),o=a?.spec,s=r.spec??o,c=await Q(async e=>await n(Y(`/api/config/plugins/entry/${encodeURIComponent(t)}`,e),{method:`PATCH`,headers:Z(e),body:JSON.stringify(Ae(r))}),a&&s?{...a,spec:s}:void 0);return c.ok&&s&&i().loadRegistryInfo({specs:[s],force:!0}),c},deleteEntry:async e=>{let t=i().entries.find(t=>t.id===e),a=await Q(async t=>await n(Y(`/api/config/plugins/entry/${encodeURIComponent(e)}`,t),{method:`DELETE`,headers:X(t)}));if(a.ok&&i().selectedId===e&&r({selectedId:null}),a.ok&&t){let e={...i().registryInfo};delete e[t.spec],r({registryInfo:e})}return a},readFile:async e=>{try{let t=W(),r=await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,t),{headers:X(t)});if(!r.ok)throw Error(`Failed to read plugin file`);return await $(r)}catch(e){return console.error(`[PluginsStore] Failed to read plugin file:`,e),null}},createFile:async e=>Q(async t=>await n(Y(`/api/config/plugins/file`,t),{method:`POST`,headers:Z(t),body:JSON.stringify(e)})),updateFile:async(e,t)=>Q(async r=>await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,r),{method:`PUT`,headers:Z(r),body:JSON.stringify(t)})),deleteFile:async e=>{let t=await Q(async t=>await n(Y(`/api/config/plugins/file/${encodeURIComponent(e)}`,t),{method:`DELETE`,headers:X(t)}));return t.ok&&i().selectedId===e&&r({selectedId:null}),t},getById:e=>i().entries.find(t=>t.id===e)??i().files.find(t=>t.id===e)}),{name:`plugins-store`,storage:l(),partialize:e=>({selectedId:e.selectedId})}),{name:`plugins-store`}));function Y(e,t){return`${e}${t?`?directory=${encodeURIComponent(t)}`:``}`}function De(e,t,n){let r=new URLSearchParams;t&&r.set(`refresh`,`true`),n&&r.set(`directory`,n);let i=r.toString();return`/api/config/plugins/registry?${`specs=${e.map(encodeURIComponent).join(`,`)}`}${i?`&${i}`:``}`}function Oe(e){return Array.from(new Set(e.map(e=>e.trim()).filter(Boolean)))}function ke(e){let t=[],n=[],r=0;for(let i of e){let e=encodeURIComponent(i),a=n.length===0?e.length:r+1+e.length;n.length>0&&a>Te?(t.push(n),n=[i],r=e.length):(n.push(i),r=a)}return n.length>0&&t.push(n),t}function X(e){return e?{"x-opencode-directory":e}:void 0}function Z(e){return{"Content-Type":`application/json`,...e?{"x-opencode-directory":e}:{}}}function Ae(e){let t={};return e.spec!==void 0&&(t.spec=e.spec),e.options!==void 0&&(t.options=e.options),e.scope!==void 0&&(t.scope=e.scope),t}async function Q(n,r){let i=e(),a=t();try{let o=W(),s=await n(o),c=await $(s).catch(()=>null);if(!s.ok)throw Error(c?.error||`Failed to update plugin configuration`);if(i!==e()||a!==t())return{ok:!0};Ee(o);let l=await H(g,o,i);if(o===W()&&i===e()&&a===t()){let e=r&&J.getState().selectedId===r.id?l.entries.find(e=>e.spec===r.spec&&e.scope===r.scope&&e.sourcePath===r.sourcePath):void 0;J.setState({entries:l.entries,files:l.files,...e?{selectedId:e.id}:{}}),G.set(q(o),Date.now())}return{ok:!0,reloadFailed:c?.reloadFailed===!0,message:c?.message,warning:c?.warning}}catch(e){return console.error(`[PluginsStore] Failed to update plugin configuration:`,e),{ok:!1}}}async function $(e){return await e.json()}export{V as a,pe as c,te as d,O as f,ee as g,D as h,ge as i,ue as l,ne as m,B as n,me as o,k as p,z as r,he as s,J as t,le as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{st as t}from"./vendor-base-ui-fom6orB6.js";import{E as n,R as r,V as i}from"./runtime-file-resource-CKQQEwNv.js";import{r as a}from"./terminalApi-Bk77qMTK.js";import{$n as o}from"./useMobileNavigationStore-CWShXc31.js";import{n as s}from"./useEffectiveDirectory-D0EiFP2j.js";var c=e(t(),1);function l(){return s()}function u(){let e=i(),t=n(),s=t?.entry.location.hostId?t.entry:void 0,l=(0,c.useMemo)(()=>{if(!s)return null;let e,t=!1,n=()=>{if(t)throw new DOMException(`Project terminal owner ended`,`AbortError`);return e??=a(s)};return{files:r(s),git:o(s),terminal:{createSession:e=>n().createTerminalSession(e),restartSession:(e,t)=>n().restartTerminalSession(e,t),connect:(e,t,r)=>({close:n().connectTerminalStream(e,t.onEvent,t.onError,{maxRetries:r?.retry?.maxRetries,initialRetryDelay:r?.retry?.initialDelayMs,maxRetryDelay:r?.retry?.maxDelayMs,connectionTimeout:r?.connectionTimeoutMs})}),sendInput:(e,t)=>n().sendTerminalInput(e,t),resize:async({sessionId:e,cols:t,rows:r})=>{await n().resizeTerminal(e,t,r)},close:e=>n().closeTerminal(e)},activate:()=>{t=!1},dispose:()=>{t=!0,e?.dispose(),e=void 0}}},[s]);return(0,c.useEffect)(()=>(l?.activate(),()=>l?.dispose()),[l]),(0,c.useMemo)(()=>l?{...e,files:l.files,git:l.git,terminal:l.terminal,github:void 0,editor:void 0,projectScope:s}:{...e,projectScope:void 0},[e,l,s])}export{u as n,l as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{st as t}from"./vendor-base-ui-fom6orB6.js";import{E as n,R as r,V as i}from"./runtime-file-resource-CKQQEwNv.js";import{r as a}from"./terminalApi-CwTOFYhX.js";import{$n as o}from"./useMobileNavigationStore-CRoFDKhN.js";import{n as s}from"./useEffectiveDirectory-aRQ3KLec.js";var c=e(t(),1);function l(){return s()}function u(){let e=i(),t=n(),s=t?.entry.location.hostId?t.entry:void 0,l=(0,c.useMemo)(()=>{if(!s)return null;let e,t=!1,n=()=>{if(t)throw new DOMException(`Project terminal owner ended`,`AbortError`);return e??=a(s)};return{files:r(s),git:o(s),terminal:{createSession:e=>n().createTerminalSession(e),restartSession:(e,t)=>n().restartTerminalSession(e,t),connect:(e,t,r)=>({close:n().connectTerminalStream(e,t.onEvent,t.onError,{maxRetries:r?.retry?.maxRetries,initialRetryDelay:r?.retry?.initialDelayMs,maxRetryDelay:r?.retry?.maxDelayMs,connectionTimeout:r?.connectionTimeoutMs})}),sendInput:(e,t)=>n().sendTerminalInput(e,t),resize:async({sessionId:e,cols:t,rows:r})=>{await n().resizeTerminal(e,t,r)},close:e=>n().closeTerminal(e)},activate:()=>{t=!1},dispose:()=>{t=!0,e?.dispose(),e=void 0}}},[s]);return(0,c.useEffect)(()=>(l?.activate(),()=>l?.dispose()),[l]),(0,c.useMemo)(()=>l?{...e,files:l.files,git:l.git,terminal:l.terminal,github:void 0,editor:void 0,projectScope:s}:{...e,projectScope:void 0},[e,l,s])}export{u as n,l as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./platform-CiUKDeXd.js";import{st as n}from"./vendor-base-ui-fom6orB6.js";import{r}from"./FadeInOnReveal-CJqre5kV.js";var i=e(n(),1),a=(e,t,n)=>{let r=t-e;return Math.max(0,n-r)},o=e=>{e.timer&&=(clearTimeout(e.timer),null)},s=({text:e,isStreaming:n,throttleMs:s=r(t()).textThrottleMs,identityKey:c})=>{let[l,u]=i.useState(e),d=i.useRef(e),f=i.useRef(l),p=i.useRef({timer:null,pendingText:e,lastEmitAt:0});return i.useEffect(()=>{d.current=e},[e]),i.useEffect(()=>{f.current=l},[l]),i.useEffect(()=>{let e=p.current;o(e),e.pendingText=d.current,e.lastEmitAt=0,u(d.current)},[c]),i.useEffect(()=>{let t=p.current;t.pendingText=e;let r=f.current,i=n&&r.length>e.length?r:e;if(!n){o(t),t.lastEmitAt=Date.now(),u(i);return}let c=Date.now(),l=a(t.lastEmitAt,c,s);if(l<=0){o(t),t.lastEmitAt=c,u(i);return}return o(t),t.timer=setTimeout(()=>{t.timer=null,t.lastEmitAt=Date.now(),u(e=>n&&e.length>t.pendingText.length?e:t.pendingText)},l),()=>{o(t)}},[n,e,s]),i.useEffect(()=>{let e=p.current;return()=>{o(e)}},[]),l};export{s as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./platform-CiUKDeXd.js";import{st as n}from"./vendor-base-ui-fom6orB6.js";import{r}from"./FadeInOnReveal-D3eUin-b.js";var i=e(n(),1),a=(e,t,n)=>{let r=t-e;return Math.max(0,n-r)},o=e=>{e.timer&&=(clearTimeout(e.timer),null)},s=({text:e,isStreaming:n,throttleMs:s=r(t()).textThrottleMs,identityKey:c})=>{let[l,u]=i.useState(e),d=i.useRef(e),f=i.useRef(l),p=i.useRef({timer:null,pendingText:e,lastEmitAt:0});return i.useEffect(()=>{d.current=e},[e]),i.useEffect(()=>{f.current=l},[l]),i.useEffect(()=>{let e=p.current;o(e),e.pendingText=d.current,e.lastEmitAt=0,u(d.current)},[c]),i.useEffect(()=>{let t=p.current;t.pendingText=e;let r=f.current,i=n&&r.length>e.length?r:e;if(!n){o(t),t.lastEmitAt=Date.now(),u(i);return}let c=Date.now(),l=a(t.lastEmitAt,c,s);if(l<=0){o(t),t.lastEmitAt=c,u(i);return}return o(t),t.timer=setTimeout(()=>{t.timer=null,t.lastEmitAt=Date.now(),u(e=>n&&e.length>t.pendingText.length?e:t.pendingText)},l),()=>{o(t)}},[n,e,s]),i.useEffect(()=>{let e=p.current;return()=>{o(e)}},[]),l};export{s as t};
package/dist/index.html CHANGED
@@ -571,7 +571,7 @@
571
571
  opacity: 0.72;
572
572
  }
573
573
  </style>
574
- <script type="module" crossorigin src="/assets/main-CUu7EunU.js"></script>
574
+ <script type="module" crossorigin src="/assets/main-B5cE3xWa.js"></script>
575
575
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
576
576
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
577
577
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
@@ -601,20 +601,20 @@
601
601
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
602
602
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-CKQQEwNv.js">
603
603
  <link rel="modulepreload" crossorigin href="/assets/prompt-attachment-upload-Bem87nmm.js">
604
- <link rel="modulepreload" crossorigin href="/assets/client-BsLh14yh.js">
604
+ <link rel="modulepreload" crossorigin href="/assets/client-CzjApAA4.js">
605
605
  <link rel="modulepreload" crossorigin href="/assets/useMobileHtmlPreviewStore-DzzgY1eS.js">
606
606
  <link rel="modulepreload" crossorigin href="/assets/useUIStore-DjizmHAt.js">
607
607
  <link rel="modulepreload" crossorigin href="/assets/uuid-D-SDZijH.js">
608
- <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-Dk5fNrOy.js">
609
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-Bk77qMTK.js">
608
+ <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-BgUDBfaJ.js">
609
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-CwTOFYhX.js">
610
610
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DxL4XbME.js">
611
- <link rel="modulepreload" crossorigin href="/assets/types-Dhselvhe.js">
612
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-vcXrgtcl.js">
613
- <link rel="modulepreload" crossorigin href="/assets/native-config-DdAtv91r.js">
611
+ <link rel="modulepreload" crossorigin href="/assets/types-CukQF3zY.js">
612
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BvecNhGW.js">
613
+ <link rel="modulepreload" crossorigin href="/assets/native-config-DIGFHpiF.js">
614
614
  <link rel="modulepreload" crossorigin href="/assets/runtime-ead7P81A.js">
615
615
  <link rel="modulepreload" crossorigin href="/assets/bootstrap-eLlfzqAI.js">
616
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Ccbs_U5j.js">
617
- <link rel="stylesheet" crossorigin href="/assets/src-BNTtvddA.css">
616
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BskrN2gH.js">
617
+ <link rel="stylesheet" crossorigin href="/assets/src-DtLw-95J.css">
618
618
  </head>
619
619
  <body class="h-full bg-background text-foreground">
620
620
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -77,7 +77,7 @@
77
77
  .dark #initial-loading img { filter: invert(1); }
78
78
  </style>
79
79
 
80
- <script type="module" crossorigin src="/assets/miniChat-J9pxSQyx.js"></script>
80
+ <script type="module" crossorigin src="/assets/miniChat-Dx7bni4S.js"></script>
81
81
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
@@ -107,20 +107,20 @@
107
107
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-CKQQEwNv.js">
109
109
  <link rel="modulepreload" crossorigin href="/assets/prompt-attachment-upload-Bem87nmm.js">
110
- <link rel="modulepreload" crossorigin href="/assets/client-BsLh14yh.js">
110
+ <link rel="modulepreload" crossorigin href="/assets/client-CzjApAA4.js">
111
111
  <link rel="modulepreload" crossorigin href="/assets/useMobileHtmlPreviewStore-DzzgY1eS.js">
112
112
  <link rel="modulepreload" crossorigin href="/assets/useUIStore-DjizmHAt.js">
113
113
  <link rel="modulepreload" crossorigin href="/assets/uuid-D-SDZijH.js">
114
- <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-Dk5fNrOy.js">
115
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-Bk77qMTK.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-BgUDBfaJ.js">
115
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-CwTOFYhX.js">
116
116
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DxL4XbME.js">
117
- <link rel="modulepreload" crossorigin href="/assets/types-Dhselvhe.js">
118
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-vcXrgtcl.js">
119
- <link rel="modulepreload" crossorigin href="/assets/native-config-DdAtv91r.js">
117
+ <link rel="modulepreload" crossorigin href="/assets/types-CukQF3zY.js">
118
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BvecNhGW.js">
119
+ <link rel="modulepreload" crossorigin href="/assets/native-config-DIGFHpiF.js">
120
120
  <link rel="modulepreload" crossorigin href="/assets/runtime-ead7P81A.js">
121
121
  <link rel="modulepreload" crossorigin href="/assets/bootstrap-eLlfzqAI.js">
122
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Ccbs_U5j.js">
123
- <link rel="stylesheet" crossorigin href="/assets/src-BNTtvddA.css">
122
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BskrN2gH.js">
123
+ <link rel="stylesheet" crossorigin href="/assets/src-DtLw-95J.css">
124
124
  </head>
125
125
  <body class="h-full bg-background text-foreground">
126
126
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -64,11 +64,11 @@
64
64
  </script>
65
65
 
66
66
  <style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
67
- <script type="module" crossorigin src="/assets/mobile-DYjeIixi.js"></script>
67
+ <script type="module" crossorigin src="/assets/mobile-DPPD4h3P.js"></script>
68
68
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
70
70
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
71
- <link rel="stylesheet" crossorigin href="/assets/src-BNTtvddA.css">
71
+ <link rel="stylesheet" crossorigin href="/assets/src-DtLw-95J.css">
72
72
  </head>
73
73
  <body class="h-full bg-background text-foreground">
74
74
  <div id="root" class="h-full">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuriai/web",
3
- "version": "0.3.2-beta.12",
3
+ "version": "0.3.2-beta.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -59,6 +59,13 @@ task status callbacks.
59
59
  the existing session-index service and its newest-20 directory bound. Each
60
60
  partition hashes `hub:<stable Hub ID>:remote-host:<host ID>`; no mutable local
61
61
  runtime endpoint or local filesystem resolution participates.
62
+ Remote pin membership also belongs to this Hub partition. Existing persisted
63
+ pins are retained; refresh never imports or clears pins from a Host snapshot.
64
+ `POST`/`DELETE /api/hosts/:hostId/api/yuri/session-index/session/:id/pin`
65
+ terminate on the Hub before the generic proxy, use the existing index DB and
66
+ emit the existing host-scoped index-change tip. Unpin is idempotent, requires no
67
+ remote connection, and cannot modify the same session ID on another Host.
68
+ The target-instance fence and aggregate client authorization still apply.
62
69
  - `transport.js` owns authenticated direct/SSH-forwarded requests and reuses the
63
70
  normative E2EE Relay client. `build:remote-host-relay` compiles that client once;
64
71
  normal web build/prepack and `build:llm-bridge` include the build. The generated
@@ -358,10 +358,8 @@ export function createRemoteHostGateway({ store, indexDbPath, adapter, broadcast
358
358
  if (status?.type) service.updateStatus(session.id, status.type, status.changedAt || Date.now());
359
359
  }
360
360
  }
361
- const previousPins = service.snapshot().pinnedSessionIds;
362
- const pins = new Set(snapshot.pinnedSessionIds || []);
363
- for (const pin of previousPins) if (!pins.has(pin)) service.clearPinned(pin);
364
- for (const pin of pins) service.setPinned(pin);
361
+ // Pins belong to this Hub's existing host-partitioned index. Remote
362
+ // snapshots must not overwrite a user's pin or resurrect a cleared pin.
365
363
  const remote = await json(connection.host.id, '/api/projects', { signal: controller.signal }, { refresh: true });
366
364
  if (!Array.isArray(remote.projects) || !current(connection) || controller.signal.aborted) return;
367
365
  for (const reference of references) {
@@ -658,6 +656,18 @@ export function createRemoteHostGateway({ store, indexDbPath, adapter, broadcast
658
656
  ...(!adapter ? { reason: 'pc_hub_required' } : {}) };
659
657
  },
660
658
  async connect(id) { const connection = await ensure(id); startStatus(connection); return hostView(connection.host); },
659
+ setSessionPinned(id, sessionId, pinned, instanceId) {
660
+ if (stopped) throw remoteFailure('host_unavailable', 404);
661
+ if (!store.projects(id).length) throw remoteFailure('project_not_found', 404);
662
+ if (instanceId !== undefined && instanceId !== store.instanceFor(id)) throw remoteFailure('remote_instance_mismatch', 409);
663
+ if (typeof sessionId !== 'string' || !sessionId.trim() || sessionId.length > 512 || /[\u0000-\u001f]/.test(sessionId)) {
664
+ throw remoteFailure('validation_error', 400);
665
+ }
666
+ const service = indexFor(id);
667
+ if (pinned) service.setPinned(sessionId.trim());
668
+ else service.clearPinned(sessionId.trim());
669
+ emit(id, { type: 'yuri:session-index-changed', properties: { cause: 'change' } });
670
+ },
661
671
  summaries(id) {
662
672
  if (stopped) throw remoteFailure('host_unavailable', 404);
663
673
  const references = new Set(store.projects(id).map((p) => directoryKey(p.path)));
@@ -224,6 +224,14 @@ export function registerRemoteHostRoutes(app, { gateway, getAuth, server, isRequ
224
224
  app.get('/api/hosts/:hostId/summaries', (req, res) => {
225
225
  try { res.json(gateway.summaries(req.params.hostId)); } catch (error) { report(res, error); }
226
226
  });
227
+ for (const method of ['post', 'delete']) {
228
+ app[method]('/api/hosts/:hostId/api/yuri/session-index/session/:id/pin', (req, res) => {
229
+ try {
230
+ gateway.setSessionPinned(req.params.hostId, req.params.id, method === 'post', req.get('x-yuri-target-instance') || undefined);
231
+ res.status(204).end();
232
+ } catch (error) { report(res, error); }
233
+ });
234
+ }
227
235
  app.post('/api/hosts/:hostId/connect', async (req, res) => {
228
236
  try { res.json({ host: await gateway.connect(req.params.hostId) }); } catch (error) { report(res, error); }
229
237
  });
@@ -20,6 +20,7 @@ import { createRemoteClientAuthRuntime } from '../client-auth/remote-clients.js'
20
20
  import { createGlobalUiEventBroadcaster } from '../event-stream/runtime.js';
21
21
  import { createRemoteHostStore } from './store.js';
22
22
  import { createRemoteHostGateway } from './gateway.js';
23
+ import { createSessionIndexService } from '../session-index/service.js';
23
24
  import { registerRemoteHostRoutes } from './routes.js';
24
25
  import { registerTranscriptCacheRoutes } from '../transcript-cache/routes.js';
25
26
  import { registerFsRoutes } from '../fs/routes.js';
@@ -246,6 +247,67 @@ async function assertBrowserTcp(hub, route, remote) {
246
247
  }
247
248
 
248
249
  describe('Remote Host production HTTP contract', () => {
250
+ it('pins and unpins remote sessions in the Hub DB without remote mutations or refresh resurrection', async () => {
251
+ const { hub, remote } = await aggregate();
252
+ const remotePin = vi.fn((_req, res) => res.status(204).end());
253
+ remote.app.post('/api/yuri/session-index/session/:id/pin', remotePin);
254
+ remote.app.delete('/api/yuri/session-index/session/:id/pin', remotePin);
255
+ const session = { id: 'pin-session', directory: '/same/path', title: 'Pin target', time: { created: 1, updated: 2 } };
256
+ remote.setSummaries({ directories: [{ directory: '/same/path', hasMore: false, sessions: [session] }], pinnedSessionIds: [] });
257
+ await hub.call('/api/hosts/remote-1/projects', 'POST', { path: '/same/path' });
258
+ const abort = new AbortController();
259
+ const stream = await fetch(`${hub.url}/api/global/event`, { headers: hub.headers, signal: abort.signal });
260
+ const read = async () => (await hub.call('/api/hosts/remote-1/summaries')).json();
261
+ const persistedPins = () => {
262
+ const index = createSessionIndexService({ dbPath: path.join(hub.directory, 'session-index.sqlite'),
263
+ getRuntimeConfig: () => ({ apiBaseUrl: `hub:${hub.store.hubId}:remote-host:remote-1` }) });
264
+ try { return index.snapshot().pinnedSessionIds; } finally { index.close(); }
265
+ };
266
+ const refresh = async (snapshot) => {
267
+ const before = (await read()).lastSyncedAt;
268
+ remote.setSummaries(snapshot);
269
+ remote.emit({ type: 'yuri:session-index-changed', properties: { cause: 'change' } });
270
+ await wait(async () => expect((await read()).lastSyncedAt).toBeGreaterThan(before));
271
+ };
272
+ const pinPath = '/api/hosts/remote-1/api/yuri/session-index/session/pin-session/pin';
273
+ try {
274
+ await wait(async () => expect((await read()).directories[0]?.sessions[0]?.id).toBe('pin-session'));
275
+ expect((await hub.call(pinPath, 'POST')).status).toBe(204);
276
+ expect(remotePin.mock.calls.length).toBe(0);
277
+ expect((await read()).pinnedSessionIds).toEqual(['pin-session']);
278
+ expect(persistedPins()).toEqual(['pin-session']);
279
+ hub.store.saveProject('remote-2', { id: 'other-project', path: '/same/path' });
280
+ const otherPinPath = pinPath.replace('remote-1', 'remote-2');
281
+ expect((await hub.call(otherPinPath, 'POST')).status).toBe(204);
282
+ await refresh({ directories: [{ directory: '/same/path', sessions: [session] }], pinnedSessionIds: [] });
283
+ expect((await read()).pinnedSessionIds).toEqual(['pin-session']);
284
+ const Database = require('better-sqlite3');
285
+ const failureDb = new Database(path.join(hub.directory, 'session-index.sqlite'));
286
+ try {
287
+ failureDb.exec("CREATE TRIGGER reject_pin_delete BEFORE UPDATE OF pinned_at ON session_summary BEGIN SELECT RAISE(ABORT, 'injected storage failure'); END");
288
+ expect((await hub.call(pinPath, 'DELETE')).status).toBe(503);
289
+ expect((await read()).pinnedSessionIds).toEqual(['pin-session']);
290
+ expect(persistedPins()).toEqual(['pin-session']);
291
+ } finally {
292
+ failureDb.exec('DROP TRIGGER IF EXISTS reject_pin_delete');
293
+ failureDb.close();
294
+ }
295
+ expect((await hub.call(pinPath, 'DELETE')).status).toBe(204);
296
+ expect((await hub.call(pinPath, 'DELETE')).status).toBe(204);
297
+ expect((await read()).pinnedSessionIds).toEqual([]);
298
+ expect(persistedPins()).toEqual([]);
299
+ expect((await (await hub.call('/api/hosts/remote-2/summaries')).json()).pinnedSessionIds).toEqual(['pin-session']);
300
+ await refresh({ directories: [{ directory: '/same/path', sessions: [{ ...session, time: { ...session.time, pinned: 123 } }] }], pinnedSessionIds: ['pin-session'] });
301
+ const snapshot = await read();
302
+ expect(snapshot.pinnedSessionIds).toEqual([]);
303
+ expect(snapshot.directories[0].sessions[0].time.pinned).toBeUndefined();
304
+ expect(persistedPins()).toEqual([]);
305
+ expect(remotePin.mock.calls.length).toBe(0);
306
+ const mismatched = await fetch(`${hub.url}${pinPath}`, { method: 'POST', headers: { ...hub.headers, 'x-yuri-target-instance': 'other-instance' } });
307
+ expect(mismatched.status).toBe(409);
308
+ expect(persistedPins()).toEqual([]);
309
+ } finally { abort.abort(); await stream.body.cancel().catch(() => {}); }
310
+ });
249
311
  it('routes Browser SOCKS to the Remote Project Host with URL auth and real Origin checks', async () => {
250
312
  const { hub, remote } = await aggregate({ productionGuiNetwork: true, requireClientAuth: true, requestTimeoutMs: 5000 });
251
313
  await assertBrowserTcp(hub, '/api/hosts/remote-1/api/gui-network/ws', remote);
@@ -69,6 +69,9 @@ development index without changing settings or authentication storage.
69
69
  Rows are partitioned by a runtime key derived from the desktop
70
70
  `apiBaseUrl` (Electron falls back to the local sidecar URL so the key stays
71
71
  stable between server listen and window activation).
72
+ Pin/unpin updates the independent pin record and summary `pinned_at` in one
73
+ transaction. A failed second write rolls both back; reopening cannot resurrect
74
+ a partially cleared pin from legacy summary backfill.
72
75
  `service.js` exclusively owns the WAL database and stores at most the
73
76
  newest 20 root-session summaries per runtime and directory. It also retains the
74
77
  minimal session `model: { providerID, id, variant? }` reference (each string is
@@ -717,7 +717,7 @@ export const createSessionIndexService = ({ dbPath, getRuntimeConfig = () => nul
717
717
  return result.changes > 0;
718
718
  };
719
719
 
720
- const setPinned = (sessionID, pinnedAt = Date.now()) => {
720
+ const setPinned = db.transaction((sessionID, pinnedAt = Date.now()) => {
721
721
  if (typeof sessionID !== 'string' || !sessionID) return false;
722
722
  const timestamp = toTimestamp(pinnedAt);
723
723
  if (!timestamp) return false;
@@ -725,15 +725,15 @@ export const createSessionIndexService = ({ dbPath, getRuntimeConfig = () => nul
725
725
  upsertPin.run(key, sessionID, timestamp);
726
726
  writeSummaryPinnedAt.run(timestamp, key, sessionID);
727
727
  return true;
728
- };
728
+ });
729
729
 
730
- const clearPinned = (sessionID) => {
730
+ const clearPinned = db.transaction((sessionID) => {
731
731
  if (typeof sessionID !== 'string' || !sessionID) return false;
732
732
  const key = runtimeKey();
733
733
  const pinResult = deletePin.run(key, sessionID);
734
734
  const summaryResult = writeSummaryPinnedAt.run(null, key, sessionID);
735
735
  return pinResult.changes > 0 || summaryResult.changes > 0;
736
- };
736
+ });
737
737
 
738
738
  const replaceChildSessions = db.transaction((directory, parentSessionID, children) => {
739
739
  const normalizedDirectory = normalizeDirectory(directory);