@yuriai/web 0.3.2-beta.2 → 0.3.2-beta.4

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 (104) hide show
  1. package/dist/assets/{AgentAvatar-B9ucI2MO.js → AgentAvatar-Dl75CmK8.js} +1 -1
  2. package/dist/assets/AssistantConversationSurface-Dp6zs0yn.js +3 -0
  3. package/dist/assets/AssistantSessionCard-WrAhcmUB.js +2 -0
  4. package/dist/assets/{AssistantUnreadBadge-RQ0DmUi6.js → AssistantUnreadBadge-DuhElWPK.js} +1 -1
  5. package/dist/assets/{AssistantView-Bo5BZS0L.js → AssistantView-BZYpqpnI.js} +1 -1
  6. package/dist/assets/{DiagramView-B-78GB_f.js → DiagramView-GcCsdA5z.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-C-CtY8g9.js → FadeInOnReveal-Ct1rl1tS.js} +1 -1
  8. package/dist/assets/{GuiPluginPage-B1YKmblD.js → GuiPluginPage-DvExR9I-.js} +1 -1
  9. package/dist/assets/{GuiPluginSurface-hm7K6byY.js → GuiPluginSurface-BFnUCbwm.js} +1 -1
  10. package/dist/assets/{GuiPluginWindow-7DO5ZOvG.js → GuiPluginWindow-C3B4RM6F.js} +1 -1
  11. package/dist/assets/{Icon-C6CNZZkk.js → Icon-DgBJx_JJ.js} +1 -1
  12. package/dist/assets/{ImageLoadingPlaceholder-B6Zer2YL.js → ImageLoadingPlaceholder-CxCcAKA_.js} +1 -1
  13. package/dist/assets/{LoadingImage-BPX-DCAP.js → LoadingImage-BfbEFJO6.js} +1 -1
  14. package/dist/assets/{MarkdownRenderer-DrXbG9Y5.js → MarkdownRenderer-BGMefVz0.js} +2 -2
  15. package/dist/assets/{MarkdownRendererImpl-D9FUbv9O.js → MarkdownRendererImpl-CkjS_Et2.js} +2 -2
  16. package/dist/assets/{MarkstreamRendererImpl-BXEYnxur.js → MarkstreamRendererImpl-B0teEFDV.js} +2 -2
  17. package/dist/assets/{MobileDetailNavigation-CpjB_jck.js → MobileDetailNavigation-9113s_ma.js} +1 -1
  18. package/dist/assets/{MobileResizableSheet-Cn4FFye8.js → MobileResizableSheet-BJ-iOaK0.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-DuDpHmZD.js → MobileShareBridge-Dx3f6fUw.js} +1 -1
  20. package/dist/assets/MobileSurface-D9mhWzTr.js +2 -0
  21. package/dist/assets/{MultiRunWindow--3wAH_2i.js → MultiRunWindow-DN-EY73Y.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-Cr6g_uej.js → OnboardingScreen-ClBvuMe9.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-CHgqvqG3.js → OverlayScrollbar-PIPr1Evo.js} +1 -1
  24. package/dist/assets/{RemoteAssistantSessionCard-CE-B_FHL.js → RemoteAssistantSessionCard-CJiC-EkZ.js} +1 -1
  25. package/dist/assets/{SettingsView-BoQRiuVv.js → SettingsView-Bq_efBmE.js} +13 -13
  26. package/dist/assets/{SettingsWindow-B1JkVKIr.js → SettingsWindow-BuwGUijj.js} +1 -1
  27. package/dist/assets/{SetupTourDialog-B43dbK2I.js → SetupTourDialog-CvlBSC6d.js} +1 -1
  28. package/dist/assets/{TerminalView-DKS2KRh0.js → TerminalView-DuSAe2hR.js} +1 -1
  29. package/dist/assets/ToolOutputDialog-BVEHo8-L.js +16 -0
  30. package/dist/assets/{VoiceSettings-C6jznmzY.js → VoiceSettings-CK9kIRt_.js} +2 -2
  31. package/dist/assets/{capgoAdapter-B3s9u7sG.js → capgoAdapter-DcCzS0K2.js} +1 -1
  32. package/dist/assets/{checkbox-Cossbslk.js → checkbox-LxYTavVR.js} +1 -1
  33. package/dist/assets/{collapsible-Bt9trgB2.js → collapsible-QODzeNp0.js} +1 -1
  34. package/dist/assets/{context-menu-DUzve8Id.js → context-menu-COAkU7Ah.js} +1 -1
  35. package/dist/assets/{diagram-CCwMM241.js → diagram-C5Eusp6S.js} +1 -1
  36. package/dist/assets/dialog-Cc0snjnm.js +1 -0
  37. package/dist/assets/dialog-DYOEW9DC.css +1 -0
  38. package/dist/assets/{fileMentionTouchSelection-BsMdH79T.js → fileMentionTouchSelection-CgtX2i5j.js} +1 -1
  39. package/dist/assets/{gitApi-6bjyfJ0P.js → gitApi-2YB0zq5C.js} +1 -1
  40. package/dist/assets/{input-Dc9Few6S.js → input-BU5xc-yv.js} +1 -1
  41. package/dist/assets/{insertionBoundaries-DImWCHHe.js → insertionBoundaries-BythIGNL.js} +1 -1
  42. package/dist/assets/{main-C27KIa4w.js → main-9i7pD__G.js} +14 -14
  43. package/dist/assets/{main-ClvHuS1l.js → main-CH2eMc3E.js} +2 -2
  44. package/dist/assets/{markdownHeightCache-CgEzszwt.js → markdownHeightCache-MrVUTvbP.js} +1 -1
  45. package/dist/assets/{mcpQueries-D-c3h-8F.js → mcpQueries-DRVf_ZiV.js} +1 -1
  46. package/dist/assets/miniChat-BpjBFTDv.js +2 -0
  47. package/dist/assets/mobile-C2jRZnAH.js +2 -0
  48. package/dist/assets/{mobileBackNavigation-CX1dqatK.js → mobileBackNavigation-DAVsjgP7.js} +1 -1
  49. package/dist/assets/mobileConnections-CcRHORuJ.js +2 -0
  50. package/dist/assets/{multirun-BqGvXgzB.js → multirun-PwvGTGVN.js} +1 -1
  51. package/dist/assets/{native-config--i6wCD4P.js → native-config-xhyB-MaV.js} +1 -1
  52. package/dist/assets/{navigation-DEIXKsz9.js → navigation-s17OGXvr.js} +1 -1
  53. package/dist/assets/openRemoteProjectSession-DW8-T60S.js +1 -0
  54. package/dist/assets/projectMeta-BlxvELCP.js +1 -0
  55. package/dist/assets/{pwa-CUF8fchS.js → pwa-2oTUkDoj.js} +1 -1
  56. package/dist/assets/{queue-abort-optimistic-DnJeXLxG.js → queue-abort-optimistic-D1Jn8qwM.js} +1 -1
  57. package/dist/assets/{react-_vsw1y6L.js → react-MiIkeefI.js} +1 -1
  58. package/dist/assets/{readiness-jkhl68VV.js → readiness-E_AfME9f.js} +2 -2
  59. package/dist/assets/{reference-history-D9aLqiz1.js → reference-history-XALwogYf.js} +1 -1
  60. package/dist/assets/{remoteSessionReference-BODrh2wf.js → remoteSessionReference-CtOv1v_b.js} +1 -1
  61. package/dist/assets/{renderElectronMiniChatApp-Bj1TCHnZ.js → renderElectronMiniChatApp-3NuBbRwT.js} +2 -2
  62. package/dist/assets/renderMobileApp-CuZ9yAVb.js +29 -0
  63. package/dist/assets/{runtimeConfig-9qXX2ix1.js → runtimeConfig-D18VaKC1.js} +1 -1
  64. package/dist/assets/{runtimeEndpointReset-BUGfn7y0.css → runtimeEndpointReset-BIrMtGn5.css} +1 -1
  65. package/dist/assets/{runtimeEndpointReset-nUC5uMtu.js → runtimeEndpointReset-DVZ8ANvq.js} +9 -9
  66. package/dist/assets/{select-RfWO-Q8r.js → select-ByHtaCLt.js} +1 -1
  67. package/dist/assets/{sessionLookup-BnWJnI1i.js → sessionLookup-BxkJtFS9.js} +1 -1
  68. package/dist/assets/{sortable-tabs-strip-BQhg8ugs.js → sortable-tabs-strip-BC9YfP7U.js} +1 -1
  69. package/dist/assets/{speechSettingsQueries-B5nF726M.js → speechSettingsQueries-UKlLEXtl.js} +1 -1
  70. package/dist/assets/src-DRyZ4dLj.css +2 -0
  71. package/dist/assets/{textarea-7J-b5mR2.js → textarea-tBNaGlCt.js} +1 -1
  72. package/dist/assets/{tooltip-IVmealjG.js → tooltip-CcltSswM.js} +1 -1
  73. package/dist/assets/{types-fkNzcMt6.js → types-DoOzRsH8.js} +1 -1
  74. package/dist/assets/{useAppFontEffects-BGhC1aSo.js → useAppFontEffects-BCtKtzi1.js} +62 -62
  75. package/dist/assets/{useDesktopWindowControlsLayout-CqAP968J.js → useDesktopWindowControlsLayout-DkvuepaL.js} +1 -1
  76. package/dist/assets/{useEffectiveDirectory-D_gt64gp.js → useEffectiveDirectory-BpUyuk6I.js} +1 -1
  77. package/dist/assets/useMobileNavigationStore-DGdNSKHn.js +13 -0
  78. package/dist/assets/{usePluginsStore-GVUi9ssB.js → usePluginsStore-C4DtZir8.js} +1 -1
  79. package/dist/assets/{useProjectRuntimeAPIs-MBstcTXw.js → useProjectRuntimeAPIs-D-HLNg2d.js} +1 -1
  80. package/dist/assets/{useStreamingTextThrottle-B9fGpeQT.js → useStreamingTextThrottle-C4HYcuiO.js} +1 -1
  81. package/dist/index.html +6 -6
  82. package/dist/mini-chat.html +6 -6
  83. package/dist/mobile.html +2 -2
  84. package/package.json +1 -1
  85. package/server/lib/notifications/DOCUMENTATION.md +11 -1
  86. package/server/lib/notifications/session-unread-store.js +20 -6
  87. package/server/lib/notifications/session-unread.test.js +80 -0
  88. package/server/lib/scheduled-tasks/DOCUMENTATION.md +14 -5
  89. package/server/lib/scheduled-tasks/runtime.js +29 -25
  90. package/server/lib/scheduled-tasks/runtime.test.js +88 -1
  91. package/dist/assets/AssistantConversationSurface-Blm96EOU.js +0 -3
  92. package/dist/assets/AssistantSessionCard-DX38brAH.js +0 -2
  93. package/dist/assets/MobileSurface-D93ybkxD.js +0 -2
  94. package/dist/assets/ToolOutputDialog-CBk9ZNkY.js +0 -16
  95. package/dist/assets/dialog-CDfUL86v.js +0 -1
  96. package/dist/assets/dialog-CTYD3Sbr.css +0 -1
  97. package/dist/assets/miniChat-BV82mwxi.js +0 -2
  98. package/dist/assets/mobile-CiUCPZu-.js +0 -2
  99. package/dist/assets/mobileConnections-BdfBfyV4.js +0 -2
  100. package/dist/assets/openRemoteProjectSession-DkaBkopU.js +0 -1
  101. package/dist/assets/projectMeta-CX7xsn7U.js +0 -1
  102. package/dist/assets/renderMobileApp-ZBJF50-1.js +0 -29
  103. package/dist/assets/src-INJJ62RE.css +0 -2
  104. package/dist/assets/useMobileNavigationStore-Dlt-Ip-3.js +0 -13
@@ -1 +1 @@
1
- import{i as e,n as t}from"./runtime-switch-BMjl5Y5W.js";import{n}from"./runtime-fetch-DKZOpfzo.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-CgAFd1ew.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-DnhWnndu.js";import{t as v}from"./i18n-OsFhnlRH.js";import{In as y,Rn as b,Va as x,za as S}from"./useMobileNavigationStore-Dlt-Ip-3.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=b(`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)(y,{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=b(`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=b(`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=b(`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=b(`yuri-settings-group-row yuri-settings-split-row`,s),t[0]=s,t[1]=u);let d;t[2]===c?d=t[3]:(d=b(`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=b(`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=b(`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 x;t[10]===i?x=t[11]:(x=(0,w.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:i}),t[10]=i,t[11]=x);let S;t[12]===o?S=t[13]:(S=o?(0,w.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:o}):null,t[12]=o,t[13]=S);let T;t[14]!==S||t[15]!==x?(T=(0,w.jsxs)(`div`,{className:`yuri-settings-split-row-copy`,children:[x,S]}),t[14]=S,t[15]=x,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=S(),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=S(),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=x(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=x(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=x(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=x.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-BMjl5Y5W.js";import{n}from"./runtime-fetch-DKZOpfzo.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-CgAFd1ew.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-DnhWnndu.js";import{t as v}from"./i18n-OsFhnlRH.js";import{Ba as y,Ha as b,In as x,Rn as S}from"./useMobileNavigationStore-DGdNSKHn.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-DnhWnndu.js";import{r as a}from"./terminalApi-eR_918UZ.js";import{$n as o}from"./useMobileNavigationStore-Dlt-Ip-3.js";import{n as s}from"./useEffectiveDirectory-D_gt64gp.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-DnhWnndu.js";import{r as a}from"./terminalApi-eR_918UZ.js";import{$n as o}from"./useMobileNavigationStore-DGdNSKHn.js";import{n as s}from"./useEffectiveDirectory-BpUyuk6I.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-wF65ZFgV.js";import{st as n}from"./vendor-base-ui-fom6orB6.js";import{r}from"./FadeInOnReveal-C-CtY8g9.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-wF65ZFgV.js";import{st as n}from"./vendor-base-ui-fom6orB6.js";import{r}from"./FadeInOnReveal-Ct1rl1tS.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-ClvHuS1l.js"></script>
574
+ <script type="module" crossorigin src="/assets/main-CH2eMc3E.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">
@@ -608,13 +608,13 @@
608
608
  <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-BEMPJCIG.js">
609
609
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-eR_918UZ.js">
610
610
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-Dc459c9e.js">
611
- <link rel="modulepreload" crossorigin href="/assets/types-fkNzcMt6.js">
612
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B3s9u7sG.js">
613
- <link rel="modulepreload" crossorigin href="/assets/native-config--i6wCD4P.js">
611
+ <link rel="modulepreload" crossorigin href="/assets/types-DoOzRsH8.js">
612
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DcCzS0K2.js">
613
+ <link rel="modulepreload" crossorigin href="/assets/native-config-xhyB-MaV.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-9qXX2ix1.js">
617
- <link rel="stylesheet" crossorigin href="/assets/src-INJJ62RE.css">
616
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D18VaKC1.js">
617
+ <link rel="stylesheet" crossorigin href="/assets/src-DRyZ4dLj.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-BV82mwxi.js"></script>
80
+ <script type="module" crossorigin src="/assets/miniChat-BpjBFTDv.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">
@@ -114,13 +114,13 @@
114
114
  <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-BEMPJCIG.js">
115
115
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-eR_918UZ.js">
116
116
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-Dc459c9e.js">
117
- <link rel="modulepreload" crossorigin href="/assets/types-fkNzcMt6.js">
118
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B3s9u7sG.js">
119
- <link rel="modulepreload" crossorigin href="/assets/native-config--i6wCD4P.js">
117
+ <link rel="modulepreload" crossorigin href="/assets/types-DoOzRsH8.js">
118
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DcCzS0K2.js">
119
+ <link rel="modulepreload" crossorigin href="/assets/native-config-xhyB-MaV.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-9qXX2ix1.js">
123
- <link rel="stylesheet" crossorigin href="/assets/src-INJJ62RE.css">
122
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D18VaKC1.js">
123
+ <link rel="stylesheet" crossorigin href="/assets/src-DRyZ4dLj.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-CiUCPZu-.js"></script>
67
+ <script type="module" crossorigin src="/assets/mobile-C2jRZnAH.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-INJJ62RE.css">
71
+ <link rel="stylesheet" crossorigin href="/assets/src-DRyZ4dLj.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.2",
3
+ "version": "0.3.2-beta.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -42,6 +42,16 @@ client notification store had no durable data to migrate).
42
42
  - Successful commits publish `yuri:session-unread-changed` revision tips through
43
43
  `/api/yuri/events`. Clients lead with GET and recover on stream-ready/reconnect.
44
44
 
45
+ Multiple Host processes sharing the same data directory (such as desktop and HMR)
46
+ also share the database but not SSE clients. Each file-backed store checks the
47
+ single global revision row once per second and publishes only newer revisions to
48
+ its own clients, including commits from another process. This is independent of
49
+ session count and never reads transcripts or scans session rows on a tick. Local
50
+ commits still publish immediately; duplicate tips are suppressed. Failed checks
51
+ retain the published revision and retry on the next tick. In-memory stores have
52
+ no timer; closing a file-backed store clears its timer. Snapshot revision and rows
53
+ are read in one transaction so concurrent external commits cannot mix versions.
54
+
45
55
  All authenticated clients of one Host share this state (not per-device or
46
56
  per-client-token). Web, Electron, hosted mobile and Capacitor use the same
47
57
  authenticated runtime HTTP/SSE transport, including Relay. Standalone VS Code
@@ -68,7 +78,7 @@ Android notification-only subscriptions send the App locale in `Accept-Language`
68
78
  existing contact notification path, while an explicit silent review sends
69
79
  nothing. Unowned tasks retain `notifyOnScheduledTasks` and the manual-run gate.
70
80
  Result handoff/recovery belongs to `scheduled-tasks`, not this notification module.
71
- - `family-completion-gate.js` (with a TypeScript declaration): dependency-free, runtime-local completion barrier shared by Host fanout and the VS Code webview. The Host supplies authoritative HTTP reads; VS Code supplies official SDK reads.
81
+ - `family-completion-gate.js` (with a TypeScript declaration): dependency-free, runtime-local completion barrier shared by Host fanout and the VS Code webview. The Host supplies authoritative HTTP reads; VS Code supplies official SDK reads. Scheduled-task settlement/recovery also reuses its bounded `readSessionFamilyActivity` ancestry reader, with run-scoped SDK cancellation; scheduling remains owned by `scheduled-tasks`.
72
82
  - `packages/web/server/lib/notifications/live-activity-refresh-runtime.js`: periodic Live Activity snapshot refresh (default 30s, `YURI_LIVE_ACTIVITY_REFRESH_INTERVAL_MS` overrides, `0` disables). Each tick snapshots the authoritative session states once, recomputes every persisted Live Activity token's snapshot, and pushes updates only for real changes — busy→retry transitions, newly visible top-level sessions, idle completions the event path missed, and stale-row recovery. Entries whose recomputed snapshot is unchanged never send (APNs budgets Live Activity updates per hour). Rows for sessions without authoritative server state are preserved as-is; server-side-only sub-states (`permission`/`input`/`tool`) keep their last value while the session stays busy. When no row is working anymore the refresh sends `end` and clears accepted tokens.
73
83
  - `packages/web/server/lib/notifications/template-runtime.js`: notification template variables and session text/title enrichment runtime. Zen-model helpers are retained as compatibility stubs only.
74
84
  - `packages/web/server/lib/notifications/message.js`: helper implementation module.
@@ -22,15 +22,29 @@ export function createSessionUnreadStore({ dbPath, onChanged = () => {} }) {
22
22
  );
23
23
  `);
24
24
  const find = db.prepare('SELECT * FROM session_unread WHERE id = ?');
25
- const revision = () => db.prepare('SELECT revision FROM unread_meta WHERE id = 1').get().revision;
25
+ const readRevision = db.prepare('SELECT revision FROM unread_meta WHERE id = 1');
26
+ const revision = () => readRevision.get().revision;
27
+ let publishedRevision = revision();
28
+ const publish = () => {
29
+ const next = revision();
30
+ if (next <= publishedRevision) return;
31
+ onChanged(next);
32
+ publishedRevision = next;
33
+ };
34
+ // Desktop and development Hosts can share this file, but not their SSE clients.
35
+ const peerTimer = dbPath === ':memory:' ? null : setInterval(() => {
36
+ try { publish(); }
37
+ catch { console.warn('[session-unread] shared revision check failed; retrying'); }
38
+ }, 1000);
39
+ peerTimer?.unref();
26
40
  const publicRow = (row) => ({
27
41
  directory: row.directory, unreadCount: row.unreadCount, hasError: Boolean(row.hasError),
28
42
  manual: Boolean(row.manual), revision: row.revision,
29
43
  });
30
- const snapshot = () => ({
44
+ const snapshot = db.transaction(() => ({
31
45
  revision: revision(),
32
46
  sessions: Object.fromEntries(db.prepare('SELECT * FROM session_unread').all().map(row => [row.id, publicRow(row)])),
33
- });
47
+ }));
34
48
  const writeRow = db.prepare(`INSERT OR REPLACE INTO session_unread
35
49
  (id, directory, unreadCount, hasError, manual, revision, terminal, eventAt, sequence)
36
50
  VALUES (@id, @directory, @unreadCount, @hasError, @manual, @revision, @terminal, @eventAt, @sequence)`);
@@ -46,7 +60,7 @@ export function createSessionUnreadStore({ dbPath, onChanged = () => {} }) {
46
60
  writeRow.run(next.row);
47
61
  return next.publish;
48
62
  })();
49
- if (changed) onChanged(revision());
63
+ if (changed) publish();
50
64
  };
51
65
  return {
52
66
  snapshot,
@@ -86,8 +100,8 @@ export function createSessionUnreadStore({ dbPath, onChanged = () => {} }) {
86
100
  db.prepare('UPDATE unread_meta SET revision = revision + 1 WHERE id = 1').run();
87
101
  return true;
88
102
  })();
89
- if (changed) onChanged(revision());
103
+ if (changed) publish();
90
104
  },
91
- close: () => db.close(),
105
+ close: () => { clearInterval(peerTimer); db.close(); },
92
106
  };
93
107
  }
@@ -3,6 +3,7 @@ import fs from 'node:fs';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { createRequire } from 'node:module';
6
+ import { execFileSync } from 'node:child_process';
6
7
  import express from 'express';
7
8
  import request from 'supertest';
8
9
  import { createSessionUnreadStore } from './session-unread-store.js';
@@ -184,6 +185,85 @@ describe('shared session unread', () => {
184
185
  expect(second.snapshot()).toEqual(expected);
185
186
  });
186
187
 
188
+ it('notifies both Host clients when another connection marks shared state read or unread', async () => {
189
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-unread-peers-'));
190
+ cleanup.push(() => fs.rmSync(dir, { recursive: true, force: true }));
191
+ const dbPath = path.join(dir, 'state.sqlite');
192
+ let desktopView;
193
+ let webView;
194
+ const desktopChanged = vi.fn(() => { desktopView = desktop.snapshot(); });
195
+ const webChanged = vi.fn(() => { webView = web.snapshot(); });
196
+ const desktop = createSessionUnreadStore({ dbPath, onChanged: desktopChanged });
197
+ cleanup.push(() => desktop.close());
198
+ const web = createSessionUnreadStore({ dbPath, onChanged: webChanged });
199
+ cleanup.push(() => web.close());
200
+ desktopView = desktop.snapshot();
201
+ webView = web.snapshot();
202
+
203
+ web.mark({ id: 'one', directory: '/project', unread: true });
204
+ await vi.waitFor(() => expect(desktopView).toEqual(webView), { timeout: 2500 });
205
+ expect(desktopView.sessions.one.unreadCount).toBe(1);
206
+ desktop.mark({ id: 'one', unread: false, expectedRevision: desktopView.sessions.one.revision });
207
+ await vi.waitFor(() => expect(webView).toEqual(desktopView), { timeout: 2500 });
208
+ expect(webView.sessions.one.unreadCount).toBe(0);
209
+ expect(desktopChanged).toHaveBeenCalledTimes(2);
210
+ expect(webChanged).toHaveBeenCalledTimes(2);
211
+ });
212
+
213
+ it('suppresses repeated and non-public peer changes and clears revision timers on close', () => {
214
+ vi.useFakeTimers();
215
+ const baseline = vi.getTimerCount();
216
+ const memory = createSessionUnreadStore({ dbPath: ':memory:' });
217
+ expect(vi.getTimerCount()).toBe(baseline);
218
+ memory.close();
219
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-unread-peer-timers-'));
220
+ cleanup.push(() => fs.rmSync(dir, { recursive: true, force: true }));
221
+ const dbPath = path.join(dir, 'state.sqlite');
222
+ const desktopChanged = vi.fn();
223
+ const webChanged = vi.fn();
224
+ const desktop = createSessionUnreadStore({ dbPath, onChanged: desktopChanged });
225
+ const web = createSessionUnreadStore({ dbPath, onChanged: webChanged });
226
+ try {
227
+ expect(vi.getTimerCount()).toBe(baseline + 2);
228
+ web.mark({ id: 'one', unread: true });
229
+ vi.advanceTimersByTime(50_000);
230
+ expect(desktopChanged).toHaveBeenCalledExactlyOnceWith(1);
231
+ expect(webChanged).toHaveBeenCalledExactlyOnceWith(1);
232
+ for (let i = 0; i < 50; i++) {
233
+ web.observe({ id: 'one', kind: 'running', sequence: i + 1 });
234
+ vi.advanceTimersByTime(1000);
235
+ }
236
+ expect(desktopChanged).toHaveBeenCalledTimes(1);
237
+ expect(webChanged).toHaveBeenCalledTimes(1);
238
+ desktop.remove('one');
239
+ vi.advanceTimersByTime(1000);
240
+ expect(webChanged).toHaveBeenLastCalledWith(2);
241
+ expect(web.snapshot()).toEqual({ revision: 2, sessions: {} });
242
+ } finally {
243
+ desktop.close(); web.close();
244
+ expect(vi.getTimerCount()).toBe(baseline);
245
+ vi.useRealTimers();
246
+ }
247
+ });
248
+
249
+ it('detects a separate process commit without a local lifecycle event or client refresh', async () => {
250
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-unread-process-'));
251
+ cleanup.push(() => fs.rmSync(dir, { recursive: true, force: true }));
252
+ const dbPath = path.join(dir, 'state.sqlite');
253
+ const changed = vi.fn();
254
+ const store = createSessionUnreadStore({ dbPath, onChanged: changed });
255
+ cleanup.push(() => store.close());
256
+ const moduleUrl = new URL('./session-unread-store.js', import.meta.url).href;
257
+ execFileSync(process.execPath, ['--input-type=module', '-e', `
258
+ import { createSessionUnreadStore } from ${JSON.stringify(moduleUrl)};
259
+ const store = createSessionUnreadStore({ dbPath: ${JSON.stringify(dbPath)} });
260
+ store.mark({ id: 'one', directory: '/project', unread: true });
261
+ store.close();
262
+ `], { timeout: 5000 });
263
+ await vi.waitFor(() => expect(changed).toHaveBeenCalledExactlyOnceWith(1), { timeout: 2500 });
264
+ expect(store.snapshot().sessions.one.unreadCount).toBe(1);
265
+ });
266
+
187
267
  it('isolates failures, subagents and system sessions; new execution clears only its error', async () => {
188
268
  const { store, event, loadSession } = fixture();
189
269
  loadSession.mockImplementation(async id => ({ id, directory: '/project',
@@ -243,8 +243,11 @@ of at most 20 running rows every five seconds, wrapping after the last page.
243
243
  Each pass has a ten-second upstream request deadline. It skips locally owned
244
244
  executions and rows without a session; missing session association is not proof
245
245
  of execution failure. Such rows remain unresolved rather than inventing a result.
246
- Recovery checks live `session.active` before examining terminal messages or Host
247
- goal state. Active, unavailable, malformed, and incomplete results remain pending.
246
+ Recovery checks live `session.active` and the active sessions' authoritative parent
247
+ chains before examining terminal messages or Host goal state. An idle parent with
248
+ an active descendant remains running. Active, unavailable, malformed, unknown
249
+ ancestry, and incomplete results remain pending; unrelated active roots do not
250
+ block a confirmed-complete family.
248
251
  A session OpenCode confirms deleted (`SessionNotFoundError`) settles as `error`.
249
252
  Only confirmed terminal evidence finalizes history, with duration through the
250
253
  time recovery observes completion. It neither dispatches a new prompt nor sends
@@ -348,11 +351,17 @@ Every actual run (timer or manual):
348
351
  **Admission is not completion:** `session.prompt` / command return when the
349
352
  turn is accepted, not when the agent finishes.
350
353
  7. Wait for the real session outcome (bounded by the same watchdog):
351
- - Poll `session.active` + `message.list` until the session is idle and
352
- the **latest-side** message page settles. Settlement always uses
354
+ - Poll `session.active` + `message.list` until the session and all its descendants are idle and
355
+ the **latest-side** message page settles. Settlement always uses
353
356
  `message.list({ limit: 50, order: 'desc' })` (newest first) — never
354
357
  `order: 'asc'` page-0 + `at(-1)`, which reads an old page once the
355
- session exceeds the limit.
358
+ session exceeds the limit.
359
+ - Family membership reuses `notifications/family-completion-gate.js`'s
360
+ `readSessionFamilyActivity`: only active IDs need metadata reads, shared
361
+ ancestors deduplicate within a probe, and concurrency is bounded to four.
362
+ Reads carry the run/recovery abort signal. A failed or malformed ancestry
363
+ read stays unknown; it cannot become successful empty activity. This same
364
+ rule covers ordinary and Goal runs, restart recovery, and continuation.
356
365
  - OpenCode 2.0.16 emits a native `idle` tail whose `outcome` is authoritative:
357
366
  `succeeded` → success; `failed` / `interrupted` → error. An unknown idle
358
367
  outcome keeps polling. Read it only after `session.active` confirms the
@@ -3,6 +3,7 @@ import { DateTime } from 'luxon';
3
3
  import parser from 'cron-parser';
4
4
  import { makeOpenCodeV2Client } from '../opencode/v2-client.js';
5
5
  import { getNativeSessionGoal } from '../opencode/native-goal.js';
6
+ import { readSessionFamilyActivity } from '../notifications/family-completion-gate.js';
6
7
  import { buildScheduledTaskMetadata } from '../session-metadata/system-session.js';
7
8
  import { SCHEDULED_SLOT_CLAIMED_CODE } from './run-history-store.js';
8
9
  import {
@@ -389,6 +390,24 @@ const isSessionNotFoundError = (error) => {
389
390
  return Number(error.status ?? error.statusCode ?? error.response?.status) === 404;
390
391
  };
391
392
 
393
+ const isSessionFamilyBusy = async (client, sessionID, requestOptions) => {
394
+ const activeMap = await client.session.active(requestOptions);
395
+ if (!activeMap || typeof activeMap !== 'object' || Array.isArray(activeMap)) {
396
+ throw new Error('Unknown session activity');
397
+ }
398
+ if (Object.prototype.hasOwnProperty.call(activeMap, sessionID)) return true;
399
+ const { activeRoots } = await readSessionFamilyActivity({
400
+ loadActiveSessionIds: () => Object.keys(activeMap),
401
+ loadParent: async (id) => {
402
+ if (id === sessionID) return null;
403
+ const session = await client.session.get({ sessionID: id }, requestOptions);
404
+ if (!session || session.id !== id || session.error) throw new Error('Unknown session ancestry');
405
+ return session.parentID ?? null;
406
+ },
407
+ });
408
+ return activeRoots.has(sessionID);
409
+ };
410
+
392
411
  const snapshotSessionOutcome = async ({
393
412
  client,
394
413
  sessionID,
@@ -398,21 +417,12 @@ const snapshotSessionOutcome = async ({
398
417
  }) => {
399
418
  const requestOptions = signal ? { signal } : undefined;
400
419
 
401
- if (typeof client?.session?.active === 'function') {
402
- try {
403
- const activeMap = await client.session.active(requestOptions);
404
- if (!(activeMap && typeof activeMap === 'object' && !Array.isArray(activeMap))) {
405
- // Malformed active payload is unknown — never idle-success.
406
- return { outcome: 'busy' };
407
- }
408
- if (Object.prototype.hasOwnProperty.call(activeMap, sessionID)) {
409
- return { outcome: 'busy' };
410
- }
411
- } catch (error) {
412
- if (signal?.aborted) throw error;
413
- // active failure = unknown; do not fall through to message.list success.
414
- return { outcome: 'busy' };
415
- }
420
+ try {
421
+ if (await isSessionFamilyBusy(client, sessionID, requestOptions)) return { outcome: 'busy' };
422
+ } catch (error) {
423
+ if (signal?.aborted) throw error;
424
+ // Activity or ancestry failure stays unknown, never idle-success.
425
+ return { outcome: 'busy' };
416
426
  }
417
427
 
418
428
  if (goalEnabled) {
@@ -865,16 +875,10 @@ export const createScheduledTasksRuntime = (deps) => {
865
875
  signal?.throwIfAborted?.();
866
876
 
867
877
  let sessionBusy = null;
868
- if (typeof client?.session?.active === 'function') {
869
- try {
870
- const activeMap = await client.session.active(requestOptions);
871
- if (activeMap && typeof activeMap === 'object' && !Array.isArray(activeMap)) {
872
- sessionBusy = Object.prototype.hasOwnProperty.call(activeMap, sessionID);
873
- }
874
- // Malformed / thrown active stays null → unknown, keep polling.
875
- } catch (error) {
876
- if (signal?.aborted) throw error;
877
- }
878
+ try {
879
+ sessionBusy = await isSessionFamilyBusy(client, sessionID, requestOptions);
880
+ } catch (error) {
881
+ if (signal?.aborted) throw error;
878
882
  }
879
883
 
880
884
  if (sessionBusy !== false) {
@@ -95,6 +95,52 @@ describe('scheduled-tasks development isolation', () => {
95
95
  });
96
96
 
97
97
  describe('scheduled-tasks history recovery', () => {
98
+ it.each(['descendant', 'unknown', 'malformed', 'cyclic', 'unrelated'])('uses %s ancestry before recovering running history or task state', async (ancestry) => {
99
+ vi.useFakeTimers();
100
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'scheduled-family-recovery-'));
101
+ const store = createScheduledTaskRunHistoryStore({ dbPath: path.join(directory, 'runs.sqlite') });
102
+ const startedAt = Date.now() - 1000;
103
+ store.startRun({ id: 'run', projectId: 'project-1', taskId: 'task-1', startedAt });
104
+ store.attachSession('run', 'ses_parent');
105
+ let task = { ...scheduledTask, state: { ...scheduledTask.state, lastStatus: 'running', lastRunAt: startedAt, lastSessionId: 'ses_parent' } };
106
+ let childRunning = true;
107
+ const get = vi.fn(async ({ sessionID }) => {
108
+ if (ancestry === 'unknown') throw new Error('offline');
109
+ if (ancestry === 'malformed') return { id: 'wrong-session' };
110
+ return { id: sessionID, parentID: ancestry === 'cyclic' ? sessionID : ancestry === 'unrelated' ? undefined : 'ses_parent' };
111
+ });
112
+ const list = vi.fn(async () => ({ data: [{ type: 'idle', outcome: 'succeeded' }] }));
113
+ makeOpenCodeV2Client.mockReturnValue({ session: { active: async () => childRunning ? { ses_child: { type: 'running' } } : {}, get }, message: { list } });
114
+ const runtime = createRuntime(null, {
115
+ runHistoryStore: store,
116
+ projectConfigRuntime: {
117
+ listScheduledTasks: async () => [task],
118
+ updateScheduledTaskState: async (_project, _id, patch) => {
119
+ task = { ...task, state: { ...task.state, ...patch } };
120
+ return { task };
121
+ },
122
+ },
123
+ });
124
+ try {
125
+ await runtime.start();
126
+ await vi.advanceTimersByTimeAsync(0);
127
+ const expected = ancestry === 'unrelated' ? 'success' : 'running';
128
+ expect(store.listRuns().runs[0].status).toBe(expected);
129
+ expect(task.state.lastStatus).toBe(expected);
130
+ if (expected === 'running') expect(list).not.toHaveBeenCalled();
131
+ childRunning = false;
132
+ await vi.advanceTimersByTimeAsync(5000);
133
+ expect(store.listRuns().runs[0].status).toBe('success');
134
+ expect(task.state.lastStatus).toBe('success');
135
+ expect(get.mock.calls.every(([, options]) => options.signal instanceof AbortSignal)).toBe(true);
136
+ } finally {
137
+ runtime.stop();
138
+ store.close();
139
+ fs.rmSync(directory, { recursive: true, force: true });
140
+ vi.useRealTimers();
141
+ }
142
+ });
143
+
98
144
  it.each(['success', 'error', 'busy', 'unavailable', 'incomplete', 'restarted'])('repairs a running task snapshot with %s authority independently of history recovery', async (outcome) => {
99
145
  vi.useFakeTimers();
100
146
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'scheduled-state-recovery-'));
@@ -237,7 +283,10 @@ describe('scheduled-tasks history recovery', () => {
237
283
  return { data: [{ type: 'idle', outcome: sessionID === 'ses_failed' ? 'failed' : 'succeeded' }] };
238
284
  });
239
285
  makeOpenCodeV2Client.mockReturnValue({
240
- session: { active: vi.fn(async () => busy ? { ses_live: {} } : {}) },
286
+ session: {
287
+ active: vi.fn(async () => busy ? { ses_live: { type: 'running' } } : {}),
288
+ get: vi.fn(async ({ sessionID }) => ({ id: sessionID })),
289
+ },
241
290
  message: { list: messageList },
242
291
  });
243
292
  const runtime = createRuntime(vi.fn(async () => ({ task: null })), { runHistoryStore: store });
@@ -1100,6 +1149,44 @@ describe('scheduled-tasks run history and session lifecycle', () => {
1100
1149
  vi.useRealTimers();
1101
1150
  });
1102
1151
 
1152
+ it.each([false, true])('does not finalize or notify while an idle scheduled session has a live nested subagent (goal=%s)', async (goalEnabled) => {
1153
+ vi.useFakeTimers();
1154
+ const history = createHistoryStore();
1155
+ let childRunning = true;
1156
+ const client = createSuccessfulClient({ activeImpl: () => childRunning ? { ses_nested: { type: 'running' } } : {} });
1157
+ client.get.mockImplementation(async ({ sessionID }) => ({ id: sessionID, parentID: sessionID === 'ses_nested' ? 'ses_child' : 'ses_1' }));
1158
+ const notifyTaskRun = vi.fn();
1159
+ getNativeSessionGoal.mockResolvedValue({ status: 'complete' });
1160
+ const update = vi.fn(async (_project, _task, state) => ({ task: { ...scheduledTask, state: { ...scheduledTask.state, ...state } } }));
1161
+ const runtime = createRuntime(update, {
1162
+ runHistoryStore: history, notifyTaskRun, waitForOpenCodeReady: async () => {},
1163
+ projectConfigRuntime: {
1164
+ listScheduledTasks: async () => [{ ...scheduledTask, execution: { ...scheduledTask.execution, goalEnabled } }],
1165
+ updateScheduledTaskState: update,
1166
+ },
1167
+ });
1168
+ try {
1169
+ await runtime.syncProject('project-1');
1170
+ const run = runtime.runNow('project-1', 'task-1');
1171
+ await vi.advanceTimersByTimeAsync(0);
1172
+ expect(history.finishRun).not.toHaveBeenCalled();
1173
+ expect(notifyTaskRun).not.toHaveBeenCalled();
1174
+ expect(client.messageList).not.toHaveBeenCalled();
1175
+ expect(getNativeSessionGoal).not.toHaveBeenCalled();
1176
+ await vi.advanceTimersByTimeAsync(1000);
1177
+ expect(history.finishRun).not.toHaveBeenCalled();
1178
+ childRunning = false;
1179
+ await vi.advanceTimersByTimeAsync(1000);
1180
+ expect((await run).ok).toBe(true);
1181
+ expect(history.finishRun).toHaveBeenCalledTimes(1);
1182
+ expect(notifyTaskRun).toHaveBeenCalledTimes(1);
1183
+ expect(client.get).toHaveBeenCalledWith({ sessionID: 'ses_nested' }, expect.objectContaining({ signal: expect.any(AbortSignal) }));
1184
+ } finally {
1185
+ runtime.stop();
1186
+ vi.useRealTimers();
1187
+ }
1188
+ });
1189
+
1103
1190
  it('does not prompt when attachSession fails and finalizes the run as error', async () => {
1104
1191
  const history = createHistoryStore();
1105
1192
  const client = createSuccessfulClient();