@yuriai/web 0.3.6-beta.15 → 0.3.6-beta.16

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 (155) hide show
  1. package/dist/assets/{AgentAvatar-DmUeOy5j.js → AgentAvatar-Cz7vWoUM.js} +1 -1
  2. package/dist/assets/{AgentSelector-p1Ai0tlg.js → AgentSelector-tguIbO8e.js} +1 -1
  3. package/dist/assets/{ArchivedSessionsDialog-Bjd3hgS2.js → ArchivedSessionsDialog-C0Vf38jt.js} +1 -1
  4. package/dist/assets/{AssistantConversationSurface-CTYtqGK_.js → AssistantConversationSurface-TNj9TKag.js} +3 -3
  5. package/dist/assets/{AssistantSessionCard-CX8zzXnW.js → AssistantSessionCard-BX_ck4KS.js} +2 -2
  6. package/dist/assets/{AssistantUnreadBadge-Nhei_TuI.js → AssistantUnreadBadge-DSjJfYrh.js} +1 -1
  7. package/dist/assets/{AssistantView-BvmJC0q9.js → AssistantView-eAuI94K6.js} +1 -1
  8. package/dist/assets/{AssistantWorkingAvatar-BKPxjA77.js → AssistantWorkingAvatar-OhfpjL1t.js} +1 -1
  9. package/dist/assets/{AssistantsSettingsPage-CPYKT5su.js → AssistantsSettingsPage-X19bTIju.js} +1 -1
  10. package/dist/assets/{BinaryFileFallback-DAmQpBO1.js → BinaryFileFallback-DDWawtzt.js} +1 -1
  11. package/dist/assets/{BtwPanel-BQgdeqj4.js → BtwPanel-Dhn1iVrH.js} +1 -1
  12. package/dist/assets/{BusyDots-CyVVXNMc.js → BusyDots-q2aVrHbQ.js} +1 -1
  13. package/dist/assets/{ChatContainer-_6gB1Tiu.js → ChatContainer-CYq3DRwu.js} +4 -4
  14. package/dist/assets/{ChatView-DfPX2ADw.js → ChatView-CD7B735C.js} +1 -1
  15. package/dist/assets/{DiagramView-BAZPsxz1.js → DiagramView-D8qMjsAQ.js} +1 -1
  16. package/dist/assets/{DiffView-B_03bICv.js → DiffView-BRUUP_UF.js} +1 -1
  17. package/dist/assets/{DiffViewToggle-CI-tbUKa.js → DiffViewToggle-Bn4WLr8E.js} +1 -1
  18. package/dist/assets/{ErrorBoundary-B1yQx4PN.js → ErrorBoundary-UqQdMytG.js} +1 -1
  19. package/dist/assets/{FadeInOnReveal-CyF7ie8o.js → FadeInOnReveal-BV_4xYNR.js} +1 -1
  20. package/dist/assets/{GuiPluginMount-jUR5ZEw-.js → GuiPluginMount-CEXVtLmV.js} +1 -1
  21. package/dist/assets/{GuiPluginPage-Du-pLMlp.js → GuiPluginPage-BziZa4M0.js} +1 -1
  22. package/dist/assets/{GuiPluginSurface-hCEJJ4PF.js → GuiPluginSurface-gxhtskj7.js} +1 -1
  23. package/dist/assets/{GuiPluginTitlebarItems-DrOGcHI0.js → GuiPluginTitlebarItems-mIMh81nb.js} +1 -1
  24. package/dist/assets/{GuiPluginWindow-CDiqRDYz.js → GuiPluginWindow-DvVG8u7w.js} +1 -1
  25. package/dist/assets/{Icon-D4ELZTbQ.js → Icon-C6Duv_oe.js} +1 -1
  26. package/dist/assets/{ImageLoadingPlaceholder-BKk1qYNK.js → ImageLoadingPlaceholder-BIQ6Y6SP.js} +1 -1
  27. package/dist/assets/{LoadingImage-BWknOYgx.js → LoadingImage-Dk4wxhnT.js} +1 -1
  28. package/dist/assets/{MarkdownRenderer-B8pnxnuP.js → MarkdownRenderer-BY310t1T.js} +2 -2
  29. package/dist/assets/{MarkdownRendererImpl-HvxkLk8k.js → MarkdownRendererImpl-nAHoW0Z9.js} +1 -1
  30. package/dist/assets/{MarkstreamRendererImpl-oBJscGhT.js → MarkstreamRendererImpl-shwGZ7Tl.js} +1 -1
  31. package/dist/assets/{MobileAssistantSettingsPage-ADZ_zb24.js → MobileAssistantSettingsPage-DOJwDh_T.js} +1 -1
  32. package/dist/assets/{MobileAssistantTab-D2B1DhXn.js → MobileAssistantTab-BAkvh3MP.js} +1 -1
  33. package/dist/assets/{MobileBtwPage-D9AHKfUL.js → MobileBtwPage-BdPAeG7v.js} +1 -1
  34. package/dist/assets/{MobileChangesSurface-C-fS41BA.js → MobileChangesSurface-DmlszV_t.js} +1 -1
  35. package/dist/assets/{MobileChatScreen-CpjY3NfP.js → MobileChatScreen-CEbQNMgn.js} +1 -1
  36. package/dist/assets/{MobileDetailNavigation-DyEDDj7j.js → MobileDetailNavigation-BUMzEYEL.js} +1 -1
  37. package/dist/assets/{MobileFilesSurface-i1CdOJt_.js → MobileFilesSurface-DCQsIn2I.js} +2 -2
  38. package/dist/assets/{MobileHtmlNetworkBoundary-B0eGttNW.js → MobileHtmlNetworkBoundary-DiuzUkq3.js} +2 -2
  39. package/dist/assets/{MobileOverlayPanel-BRsSjQB0.js → MobileOverlayPanel-DhGG1USg.js} +1 -1
  40. package/dist/assets/{MobileResizableSheet-Iz6IOJIC.js → MobileResizableSheet-BN5lO8_k.js} +1 -1
  41. package/dist/assets/{MobileSettingsTab-IFxVifD4.js → MobileSettingsTab-B4wkSo7K.js} +1 -1
  42. package/dist/assets/{MobileShareBridge-CYupKqbK.js → MobileShareBridge-DUHyEHab.js} +1 -1
  43. package/dist/assets/{MobileSurface-Dj0XqWPS.js → MobileSurface-CuAPWI6D.js} +1 -1
  44. package/dist/assets/{MobileTabPageHeader-DyDjEHij.js → MobileTabPageHeader-Bh1ILbqr.js} +1 -1
  45. package/dist/assets/{ModelLogo-Ddsuaz2-.js → ModelLogo-R0TXf5Pt.js} +1 -1
  46. package/dist/assets/{ModelSelector-BLqwVn9h.js → ModelSelector-D5pSGqN8.js} +1 -1
  47. package/dist/assets/{MultiRunWindow-DOpqKyhx.js → MultiRunWindow-DJb6RpVw.js} +1 -1
  48. package/dist/assets/{OnboardingScreen-CyYxHZ27.js → OnboardingScreen-CdHEr54c.js} +1 -1
  49. package/dist/assets/{OverlayScrollbar-DdK6iB_P.js → OverlayScrollbar-CrwDy2Pt.js} +1 -1
  50. package/dist/assets/{PierreDiffViewer-DnLcVaQ_.js → PierreDiffViewer-BYO9Wbwk.js} +1 -1
  51. package/dist/assets/{ProviderLogo-ClFNH0bR.js → ProviderLogo-C8aB3qlM.js} +1 -1
  52. package/dist/assets/{RemoteAssistantSessionCard-Bf3dzN6s.js → RemoteAssistantSessionCard-C_hCy6FE.js} +1 -1
  53. package/dist/assets/{RemoteDesktopPanel-CYrH1ew9.js → RemoteDesktopPanel-Cj6G6AyD.js} +1 -1
  54. package/dist/assets/{ScheduledTasksDialog-Cjl3xt0U.js → ScheduledTasksDialog-z2v4fwrE.js} +1 -1
  55. package/dist/assets/{ScrollableOverlay-CpChvNBP.js → ScrollableOverlay-BrA__-l0.js} +1 -1
  56. package/dist/assets/{SettingsGroup-DiF6MwFq.js → SettingsGroup-DMAcPhM4.js} +1 -1
  57. package/dist/assets/{SettingsView-BG9k0S0n.js → SettingsView-BuGjKeb9.js} +1 -1
  58. package/dist/assets/{SettingsWindow-CZqmOqJh.js → SettingsWindow-_sonrUby.js} +1 -1
  59. package/dist/assets/{SetupTourDialog-Dm893t6A.js → SetupTourDialog-Cf1Jm1Gl.js} +1 -1
  60. package/dist/assets/{SyncActions-DxL0WqMS.js → SyncActions-BWHWdbi_.js} +1 -1
  61. package/dist/assets/{TerminalView-Cm_Az2IR.js → TerminalView-DN60v7to.js} +1 -1
  62. package/dist/assets/{TextSelectionMenu-C-QA2JSI.js → TextSelectionMenu-YlWMOZkS.js} +1 -1
  63. package/dist/assets/{ToolOutputDialog-IbK1m1cQ.js → ToolOutputDialog-B388thfl.js} +1 -1
  64. package/dist/assets/{assistantMessagePreview-DbTwPLzY.js → assistantMessagePreview-DJVWTOKl.js} +1 -1
  65. package/dist/assets/{assistantQueries-DJyuR5Cm.js → assistantQueries-C_SpnqtF.js} +1 -1
  66. package/dist/assets/{auto-read-context-B0niCh-F.js → auto-read-context-BO5tE9k_.js} +1 -1
  67. package/dist/assets/{capgoAdapter-CXshem6r.js → capgoAdapter-qaeQqHpT.js} +1 -1
  68. package/dist/assets/{card-BCtykvi_.js → card-t-tgqQ79.js} +1 -1
  69. package/dist/assets/{chatUpwardIntent-DR7dxJwx.js → chatUpwardIntent-BEntur0S.js} +1 -1
  70. package/dist/assets/{checkbox-DsB97EEi.js → checkbox-D-OIaMB8.js} +1 -1
  71. package/dist/assets/{collapsible-acYUve5w.js → collapsible-CCc6anWP.js} +1 -1
  72. package/dist/assets/{connection-hint-BYkEkoO4.js → connection-hint-DAQZ45pI.js} +1 -1
  73. package/dist/assets/{context-menu-HoHZ2sEw.js → context-menu-BhnOdTDq.js} +1 -1
  74. package/dist/assets/{diagram-Bp_Qevoe.js → diagram-sCh-Ausk.js} +1 -1
  75. package/dist/assets/{dialog-CeXUC0Ej.js → dialog-C9DNMP08.js} +1 -1
  76. package/dist/assets/{dropdown-menu-CwcXAdvN.js → dropdown-menu-CcQq6JDI.js} +1 -1
  77. package/dist/assets/{fileMentionTouchSelection-vrvxc508.js → fileMentionTouchSelection-HhfJS8d1.js} +1 -1
  78. package/dist/assets/{gitApi-Di_eB3Io.js → gitApi-BNkkLnOi.js} +1 -1
  79. package/dist/assets/{icons-P6A_c8tb.js → icons-DlTcJ36Q.js} +1 -1
  80. package/dist/assets/{input-CozXpDTq.js → input-DVzjAzTw.js} +1 -1
  81. package/dist/assets/{insertionBoundaries-Cw7x86o4.js → insertionBoundaries-WYUnaIac.js} +1 -1
  82. package/dist/assets/{kbd-DPRFdABo.js → kbd-DA0IyUcd.js} +1 -1
  83. package/dist/assets/{main-DxvrNIsv.js → main-BfuLSPdJ.js} +4 -4
  84. package/dist/assets/{main-CmWGNM6N.js → main-BpAkYb0H.js} +2 -2
  85. package/dist/assets/{markdownHeightCache-BIB64pXI.js → markdownHeightCache-CcgRs1ER.js} +1 -1
  86. package/dist/assets/{mcpQueries-WWAWy_n9.js → mcpQueries-CCvxTdrj.js} +1 -1
  87. package/dist/assets/{miniChat-CA9XT4K1.js → miniChat-D2l_XXQe.js} +2 -2
  88. package/dist/assets/{mobile-BKQlIKz3.js → mobile-mVNRvGd5.js} +2 -2
  89. package/dist/assets/{mobileBackNavigation-CX_MC0oM.js → mobileBackNavigation-B8wJO_pZ.js} +1 -1
  90. package/dist/assets/{mobileConnections-DuohwVoG.js → mobileConnections-Ckzqn3Y9.js} +2 -2
  91. package/dist/assets/{multirun-DXO3dw9u.js → multirun-B34hqzTY.js} +1 -1
  92. package/dist/assets/{native-config-C_hqdruM.js → native-config-CD8pMBkt.js} +1 -1
  93. package/dist/assets/{nativeComposerCover-Cyi4eoBm.js → nativeComposerCover-CEyD3731.js} +1 -1
  94. package/dist/assets/{navigation-Bxjv649w.js → navigation-atykJu0I.js} +1 -1
  95. package/dist/assets/{openRemoteProjectSession-W9p1SC1j.js → openRemoteProjectSession-B63pkBaj.js} +1 -1
  96. package/dist/assets/{openSessionFromDeepLink-CeiBnoBN.js → openSessionFromDeepLink-Bz07xQfv.js} +2 -2
  97. package/dist/assets/{pluginPresentation-CWyI_3os.js → pluginPresentation-4xMNGtKI.js} +1 -1
  98. package/dist/assets/{pwa-RpFKwS6l.js → pwa-uLk3vYDP.js} +1 -1
  99. package/dist/assets/{queue-abort-optimistic-B624kCyc.js → queue-abort-optimistic-C_L5pmK0.js} +1 -1
  100. package/dist/assets/{reference-history-xOIH7D3x.js → reference-history-CN8H7cQY.js} +1 -1
  101. package/dist/assets/{remoteSessionReference-CNows8Mw.js → remoteSessionReference-BvbDndSv.js} +1 -1
  102. package/dist/assets/{renderElectronMiniChatApp-C0VEQ1ge.js → renderElectronMiniChatApp-BImqnwc-.js} +2 -2
  103. package/dist/assets/{renderMobileApp-ByzqYif5.js → renderMobileApp-DjKpQ6id.js} +4 -4
  104. package/dist/assets/{runtimeConfig-CnEfMg7l.js → runtimeConfig-Cs95Hj1_.js} +1 -1
  105. package/dist/assets/{runtimeEndpointReset-DFqTJZ0I.js → runtimeEndpointReset-BeO-ZC0f.js} +2 -2
  106. package/dist/assets/{select-B2UkBeQN.js → select-Cb6W8KRB.js} +1 -1
  107. package/dist/assets/{sessionLookup-DCk6ryrM.js → sessionLookup-MXum2sR5.js} +1 -1
  108. package/dist/assets/{sessionOwnership-BAee5GI3.js → sessionOwnership-CgeZg9fN.js} +1 -1
  109. package/dist/assets/{shortcuts-CiFlt2ws.js → shortcuts-5iHGo1f3.js} +1 -1
  110. package/dist/assets/{sortable-tabs-strip-Doz9wEki.js → sortable-tabs-strip-D5MuRWnZ.js} +1 -1
  111. package/dist/assets/{speechSettingsQueries-DxCvZVJ0.js → speechSettingsQueries-D2CugjM1.js} +1 -1
  112. package/dist/assets/{switch-YSNGU195.js → switch-DLlbkkU5.js} +1 -1
  113. package/dist/assets/{textarea-DxGZoBdI.js → textarea-Cg3Yz3Oc.js} +1 -1
  114. package/dist/assets/{tooltip-D2BtRCgs.js → tooltip-Chqxbwjz.js} +1 -1
  115. package/dist/assets/{truncated-path-ouBMaMLS.js → truncated-path-DWUl2HQC.js} +1 -1
  116. package/dist/assets/{types-B-Io5z5w.js → types-DfbaAnUB.js} +1 -1
  117. package/dist/assets/{ui-BwSpLYDL.js → ui-lbbchWJP.js} +4 -4
  118. package/dist/assets/{useAppFontEffects-Cuirbagj.js → useAppFontEffects-BDoatEWZ.js} +2 -2
  119. package/dist/assets/{useDesktopWindowControlsLayout-BBO7snRO.js → useDesktopWindowControlsLayout-C_VGQBG3.js} +1 -1
  120. package/dist/assets/{useEffectiveDirectory-DeoADFfu.js → useEffectiveDirectory-Dqdl58J7.js} +1 -1
  121. package/dist/assets/{useGitStore-BVToTkFp.js → useGitStore-kco1LBfw.js} +1 -1
  122. package/dist/assets/{useInlineCommentDraftStore-BN8BgIUL.js → useInlineCommentDraftStore-DFr7FLv-.js} +1 -1
  123. package/dist/assets/{useMcpConfigStore-CFUCk1mM.js → useMcpConfigStore-C9SxNeU1.js} +1 -1
  124. package/dist/assets/{useMobileSwipeActions-l0OHTMa8.js → useMobileSwipeActions-vvnhP5zs.js} +1 -1
  125. package/dist/assets/{useMobileTranscriptSyncHint-LoxQ23zb.js → useMobileTranscriptSyncHint-DVm8zIWR.js} +1 -1
  126. package/dist/assets/{useModelLists-RMIHCaOi.js → useModelLists-CU3ffp2-.js} +1 -1
  127. package/dist/assets/{useOpenCodeReadiness-Cw5UOeLB.js → useOpenCodeReadiness-KpQk8Bm7.js} +1 -1
  128. package/dist/assets/{usePluginsStore-Cnj8I3MZ.js → usePluginsStore-BJNtJkXv.js} +1 -1
  129. package/dist/assets/{useProjectGitActions-D9TZc59T.js → useProjectGitActions-DuzvQm-w.js} +1 -1
  130. package/dist/assets/{useProjectGitStore-qcnLHK_q.js → useProjectGitStore-U9tDVHik.js} +1 -1
  131. package/dist/assets/{useProjectRuntimeAPIs-BoNGczR0.js → useProjectRuntimeAPIs-DJubGUM_.js} +1 -1
  132. package/dist/assets/{useSessionBtwStore-DD2dFcs5.js → useSessionBtwStore-D5bVhQ1l.js} +1 -1
  133. package/dist/assets/{useStreamingTextThrottle-Cj6xIVZf.js → useStreamingTextThrottle-DlgF3Cnn.js} +1 -1
  134. package/dist/assets/{worktreeManager-CnxL8GZi.js → worktreeManager-BJCsjptu.js} +1 -1
  135. package/dist/assets/{worktreeSourceBranchPreference-ii7ydXPw.js → worktreeSourceBranchPreference-qDpG1uyC.js} +1 -1
  136. package/dist/index.html +5 -5
  137. package/dist/mini-chat.html +5 -5
  138. package/dist/mobile.html +1 -1
  139. package/package.json +1 -1
  140. package/server/index.js +1 -0
  141. package/server/lib/assistants/DOCUMENTATION.md +7 -3
  142. package/server/lib/assistants/builtin-skills.js +19 -3
  143. package/server/lib/assistants/builtin-skills.test.js +16 -0
  144. package/server/lib/assistants/harness.js +2 -1
  145. package/server/lib/assistants/routes.js +1 -0
  146. package/server/lib/assistants/service.js +6 -2
  147. package/server/lib/gui-customization/DOCUMENTATION.md +19 -7
  148. package/server/lib/gui-customization/projects-client.mjs +1 -1
  149. package/server/lib/gui-customization/projects.js +6 -6
  150. package/server/lib/gui-customization/projects.test.js +13 -2
  151. package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
  152. package/server/lib/gui-customization/remote-connections.js +6 -6
  153. package/server/lib/gui-customization/session-skill.js +15 -3
  154. package/server/lib/gui-customization/skill-caller.js +18 -0
  155. package/server/lib/opencode/feature-routes-runtime.js +20 -3
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./platform-B2ylz14u.js";import{st as n}from"./vendor-base-ui-wXsskyKm.js";import{r}from"./FadeInOnReveal-CyF7ie8o.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-B2ylz14u.js";import{st as n}from"./vendor-base-ui-wXsskyKm.js";import{r}from"./FadeInOnReveal-BV_4xYNR.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 +1 @@
1
- import{i as e,n as t}from"./runtime-switch-DEPKHgdL.js";import{W as n}from"./gitApiHttp-CrPYe9Oc.js";import{Yr as r,b as i,ci as a,di as o,f as s,fi as c,li as l,oi as u,ui as d}from"./ui-BwSpLYDL.js";import{d as f,i as p,l as m,m as h}from"./gitApi-Di_eB3Io.js";var g=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function _(e){let t=g(e),n=await m(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var v=6e4,y=500,b=1048576,x=new Map,S=new Map,C=0,w=(e,t)=>e.length+t.length,T=(e,t)=>{x.delete(e),x.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of x)n+=w(e,t.root);for(;x.size>y||n>b&&x.size>1;){let e=x.entries().next().value;if(!e)break;n-=w(e[0],e[1].root),x.delete(e[0])}};function E(e){if(C+=1,typeof e==`string`&&e){let t=g(e);x.delete(t),S.delete(t);return}x.clear(),S.clear()}var D=async e=>h(e).catch(()=>e),O=async e=>{let t=x.get(e);if(t&&Date.now()-t.resolvedAt<v)return x.delete(e),x.set(e,t),t.root;t&&x.delete(e);let n=S.get(e);if(n)return n;let r=C,i=D(e).then(t=>(C===r&&T(e,t),t)).catch(()=>e).finally(()=>{S.get(e)===i&&S.delete(e)});return S.set(e,i),i};async function k(e,t){let n=g(e);if(!n)return`HEAD`;try{let e=await O(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await m(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var A=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},ee=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:A(e),worktreeSource:`existing`}),j=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},M=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),N=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),P=(e,t)=>{let n=j(e);n&&s.setState(e=>{let r=!1,i=e=>j(e.path)!==n&&j(e.worktreeRoot??e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},F=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,I=e=>{let t=j(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},L=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(u(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},R=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=M(e.worktreeName??e.preferredName??``),i=N(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=N(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=L({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},z=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},B=new Map,V=new Map,H=new Map,U=new Map,W=new Map,G=new WeakMap,K=3e4,q=``,J=()=>{let n=`${t()}\u0000${e()}`;return n!==q&&(q=n,B.clear(),V.clear(),H.clear(),U.clear(),W.clear()),n},Y=e=>`${J()}\u0000${j(e)}`,X=(e,t=Y(e))=>H.get(t)??0,Z=e=>{let t=Y(e),r=U.get(t)??j(e),i=Y(r);W.set(i,(W.get(i)??0)+1);let a=new Set([t,i]);for(let[e,t]of U)e.startsWith(`${J()}\u0000`)&&t===r&&a.add(e);for(let e of a)H.set(e,(H.get(e)??0)+1),B.delete(e);n(r),j(e)!==r&&n(e)},te=async(e,t,i)=>{let a=j(await h(e)),o=j(e),s=`${t}\u0000${a}`,c=i&&G.get(i);i&&!c&&(c=new Map,G.set(i,c)),i&&!c?.has(s)&&t===J()&&Z(a);let l=W.get(s)??0,u=c?.get(s);(!u||u.generation!==l)&&(i&&u&&n(a),u={generation:l,value:f.worktree.list(a)},c?.set(s,u));let d=await u.value;t===J()&&U.set(`${t}\u0000${e}`,a);let p=d.filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let t=j(e.path),n=(e.branch||``).replace(/^refs\/heads\//,``).trim(),r=(e.name||``).trim(),i=ee(e,t);return{source:`sdk`,name:r||I(t),path:t,projectDirectory:a,branch:n,label:n||r||I(t),worktreeRoot:i.worktreeRoot,worktreeStatus:i.worktreeStatus,headState:i.headState,worktreeSource:i.worktreeSource}});return r(o,p).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},ne=async(e,t,n,r)=>{for(;;){let i=X(e,t),a=await te(e,n,r);if(n!==J())return a;if(i===X(e,t))return B.set(t,{value:a,at:Date.now()}),a}};async function Q(e,t){let n=j(e.path),r=J(),i=`${r}\u0000${n}`,a=B.get(i);if(a&&Date.now()-a.at<K)return a.value;let o=V.get(i);if(o)return o;let s=ne(n,i,r,t).finally(()=>{V.get(i)===s&&V.delete(i)});return V.set(i,s),s}var re=(e,t)=>{let n=l(e.worktreeRoot??e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},$=e=>{let t=new Set([...e].map(j));if(t.size===0)return;let n=s.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(j(i.path))&&r.delete(e);for(let[e,n]of i.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?j(n.worktreeRoot):``,a=typeof n.cwd==`string`&&n.cwd.trim()?j(n.cwd):``;(r&&t.has(r)||a&&t.has(a))&&i.getState().clearAttachment(e)}r.size!==n.size&&s.setState({worktreeMetadata:r})};async function ie(e,t={}){let n=j(e.path),i=Y(n);H.set(i,X(n)+1),B.delete(i),V.delete(i);let a=await Q({...e,path:n},t.refreshBatch??{}),o=U.get(i);if(t.isCurrent&&!t.isCurrent())return{worktrees:a,addedDirectories:[],removedDirectories:[],repositoryDirectory:o};let c=a,l=[],u=[];return s.setState(e=>{let t=e.availableWorktreesByProject,i=r(n,t.get(n)??[]),o=new Map(i.map(e=>[j(e.path),e])),s=a.map(e=>re(e,o.get(j(e.path)))),d=new Set(s.map(e=>j(e.path)));if(l=s.filter(e=>!o.has(j(e.path))).map(e=>e.path),u=i.filter(e=>!d.has(j(e.path))).map(e=>e.path),c=s,i.length===s.length&&i.every((e,t)=>{let n=s[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus})&&i.every((e,r)=>e===t.get(n)?.[r])&&i.length===(t.get(n)?.length??0))return{};let f=new Map(t);return f.set(n,s),{availableWorktreesByProject:f,availableWorktrees:[...f.values()].flat()}}),$(u),{worktrees:c,addedDirectories:l,removedDirectories:u,repositoryDirectory:o}}async function ae(e,t){let n=j(e.path),i=j(await h(n));U.set(Y(n),i);let a=n===j(i)?[]:await f.worktree.list(i),l=R(t,n),u=await f.worktree.create(n,l),p=typeof u?.name==`string`?u.name:``,m=typeof u?.branch==`string`?u.branch:``,g=typeof u?.path==`string`?u.path:``;if(!p||!g)throw Error(`Worktree create missing name/path`);let _={source:`sdk`,name:p,path:j(g),projectDirectory:i,branch:m,label:m||p,worktreeRoot:j(g),worktreeStatus:F(u?.bootstrapStatus),headState:m?`branch`:`unborn`,worktreeSource:`created-for-session`},v=r(n,[...a.filter(e=>!!e.path).map(e=>({path:e.path,worktreeRoot:e.path,projectDirectory:i,branch:e.branch??``,label:e.branch??``})),_]).find(e=>e.worktreeRoot===_.worktreeRoot)??_,y=v.worktreeRoot??v.path;u?.bootstrapStatus?o(y,u.bootstrapStatus):d(y),c(y,{onFailed:()=>P(y,`invalid`),onReady:()=>P(y,`ready`)}),Z(n),E();let b=n;return s.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(b)??[];return t.set(b,[...n.filter(e=>j(e.path)!==v.path),v]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),v}async function oe(e,t){let n=e.path,r=R(t,n);return f.worktree.validate(n,r)}async function se(e,t,n){let r=j(e.path),i=!!n?.deleteRemoteBranch,o=n?.deleteLocalBranch===!0,c=n?.remoteName;if(!(await f.worktree.remove(r,{directory:t.worktreeRoot??t.path,deleteLocalBranch:o}))?.success)throw Error(`Worktree removal failed`);a(t.worktreeRoot??t.path),Z(j(e.path)),E();let l=j(t.worktreeRoot??t.path),u=s.getState().availableWorktreesByProject,d=new Map(u),m=new Set([l,j(t.path)]);for(let[e,t]of u){let n=t.filter(e=>j(e.worktreeRoot??e.path)!==l||(m.add(j(e.path)),!1));n.length!==t.length&&(d.set(e,n),Z(e))}$(m),s.setState({availableWorktreesByProject:d,availableWorktrees:s.getState().availableWorktrees.filter(e=>j(e.worktreeRoot??e.path)!==l)});let h=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&h&&await p(r,{branch:h,remote:c}).catch(()=>void 0)}export{oe as a,_ as c,se as i,ie as n,z as o,Q as r,k as s,ae as t};
1
+ import{i as e,n as t}from"./runtime-switch-DEPKHgdL.js";import{W as n}from"./gitApiHttp-CrPYe9Oc.js";import{Yr as r,b as i,ci as a,di as o,f as s,fi as c,li as l,oi as u,ui as d}from"./ui-lbbchWJP.js";import{d as f,i as p,l as m,m as h}from"./gitApi-BNkkLnOi.js";var g=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function _(e){let t=g(e),n=await m(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var v=6e4,y=500,b=1048576,x=new Map,S=new Map,C=0,w=(e,t)=>e.length+t.length,T=(e,t)=>{x.delete(e),x.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of x)n+=w(e,t.root);for(;x.size>y||n>b&&x.size>1;){let e=x.entries().next().value;if(!e)break;n-=w(e[0],e[1].root),x.delete(e[0])}};function E(e){if(C+=1,typeof e==`string`&&e){let t=g(e);x.delete(t),S.delete(t);return}x.clear(),S.clear()}var D=async e=>h(e).catch(()=>e),O=async e=>{let t=x.get(e);if(t&&Date.now()-t.resolvedAt<v)return x.delete(e),x.set(e,t),t.root;t&&x.delete(e);let n=S.get(e);if(n)return n;let r=C,i=D(e).then(t=>(C===r&&T(e,t),t)).catch(()=>e).finally(()=>{S.get(e)===i&&S.delete(e)});return S.set(e,i),i};async function k(e,t){let n=g(e);if(!n)return`HEAD`;try{let e=await O(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await m(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var A=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},ee=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:A(e),worktreeSource:`existing`}),j=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},M=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),N=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),P=(e,t)=>{let n=j(e);n&&s.setState(e=>{let r=!1,i=e=>j(e.path)!==n&&j(e.worktreeRoot??e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},F=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,I=e=>{let t=j(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},L=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(u(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},R=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=M(e.worktreeName??e.preferredName??``),i=N(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=N(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=L({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},z=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},B=new Map,V=new Map,H=new Map,U=new Map,W=new Map,G=new WeakMap,K=3e4,q=``,J=()=>{let n=`${t()}\u0000${e()}`;return n!==q&&(q=n,B.clear(),V.clear(),H.clear(),U.clear(),W.clear()),n},Y=e=>`${J()}\u0000${j(e)}`,X=(e,t=Y(e))=>H.get(t)??0,Z=e=>{let t=Y(e),r=U.get(t)??j(e),i=Y(r);W.set(i,(W.get(i)??0)+1);let a=new Set([t,i]);for(let[e,t]of U)e.startsWith(`${J()}\u0000`)&&t===r&&a.add(e);for(let e of a)H.set(e,(H.get(e)??0)+1),B.delete(e);n(r),j(e)!==r&&n(e)},te=async(e,t,i)=>{let a=j(await h(e)),o=j(e),s=`${t}\u0000${a}`,c=i&&G.get(i);i&&!c&&(c=new Map,G.set(i,c)),i&&!c?.has(s)&&t===J()&&Z(a);let l=W.get(s)??0,u=c?.get(s);(!u||u.generation!==l)&&(i&&u&&n(a),u={generation:l,value:f.worktree.list(a)},c?.set(s,u));let d=await u.value;t===J()&&U.set(`${t}\u0000${e}`,a);let p=d.filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let t=j(e.path),n=(e.branch||``).replace(/^refs\/heads\//,``).trim(),r=(e.name||``).trim(),i=ee(e,t);return{source:`sdk`,name:r||I(t),path:t,projectDirectory:a,branch:n,label:n||r||I(t),worktreeRoot:i.worktreeRoot,worktreeStatus:i.worktreeStatus,headState:i.headState,worktreeSource:i.worktreeSource}});return r(o,p).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},ne=async(e,t,n,r)=>{for(;;){let i=X(e,t),a=await te(e,n,r);if(n!==J())return a;if(i===X(e,t))return B.set(t,{value:a,at:Date.now()}),a}};async function Q(e,t){let n=j(e.path),r=J(),i=`${r}\u0000${n}`,a=B.get(i);if(a&&Date.now()-a.at<K)return a.value;let o=V.get(i);if(o)return o;let s=ne(n,i,r,t).finally(()=>{V.get(i)===s&&V.delete(i)});return V.set(i,s),s}var re=(e,t)=>{let n=l(e.worktreeRoot??e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},$=e=>{let t=new Set([...e].map(j));if(t.size===0)return;let n=s.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(j(i.path))&&r.delete(e);for(let[e,n]of i.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?j(n.worktreeRoot):``,a=typeof n.cwd==`string`&&n.cwd.trim()?j(n.cwd):``;(r&&t.has(r)||a&&t.has(a))&&i.getState().clearAttachment(e)}r.size!==n.size&&s.setState({worktreeMetadata:r})};async function ie(e,t={}){let n=j(e.path),i=Y(n);H.set(i,X(n)+1),B.delete(i),V.delete(i);let a=await Q({...e,path:n},t.refreshBatch??{}),o=U.get(i);if(t.isCurrent&&!t.isCurrent())return{worktrees:a,addedDirectories:[],removedDirectories:[],repositoryDirectory:o};let c=a,l=[],u=[];return s.setState(e=>{let t=e.availableWorktreesByProject,i=r(n,t.get(n)??[]),o=new Map(i.map(e=>[j(e.path),e])),s=a.map(e=>re(e,o.get(j(e.path)))),d=new Set(s.map(e=>j(e.path)));if(l=s.filter(e=>!o.has(j(e.path))).map(e=>e.path),u=i.filter(e=>!d.has(j(e.path))).map(e=>e.path),c=s,i.length===s.length&&i.every((e,t)=>{let n=s[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus})&&i.every((e,r)=>e===t.get(n)?.[r])&&i.length===(t.get(n)?.length??0))return{};let f=new Map(t);return f.set(n,s),{availableWorktreesByProject:f,availableWorktrees:[...f.values()].flat()}}),$(u),{worktrees:c,addedDirectories:l,removedDirectories:u,repositoryDirectory:o}}async function ae(e,t){let n=j(e.path),i=j(await h(n));U.set(Y(n),i);let a=n===j(i)?[]:await f.worktree.list(i),l=R(t,n),u=await f.worktree.create(n,l),p=typeof u?.name==`string`?u.name:``,m=typeof u?.branch==`string`?u.branch:``,g=typeof u?.path==`string`?u.path:``;if(!p||!g)throw Error(`Worktree create missing name/path`);let _={source:`sdk`,name:p,path:j(g),projectDirectory:i,branch:m,label:m||p,worktreeRoot:j(g),worktreeStatus:F(u?.bootstrapStatus),headState:m?`branch`:`unborn`,worktreeSource:`created-for-session`},v=r(n,[...a.filter(e=>!!e.path).map(e=>({path:e.path,worktreeRoot:e.path,projectDirectory:i,branch:e.branch??``,label:e.branch??``})),_]).find(e=>e.worktreeRoot===_.worktreeRoot)??_,y=v.worktreeRoot??v.path;u?.bootstrapStatus?o(y,u.bootstrapStatus):d(y),c(y,{onFailed:()=>P(y,`invalid`),onReady:()=>P(y,`ready`)}),Z(n),E();let b=n;return s.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(b)??[];return t.set(b,[...n.filter(e=>j(e.path)!==v.path),v]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),v}async function oe(e,t){let n=e.path,r=R(t,n);return f.worktree.validate(n,r)}async function se(e,t,n){let r=j(e.path),i=!!n?.deleteRemoteBranch,o=n?.deleteLocalBranch===!0,c=n?.remoteName;if(!(await f.worktree.remove(r,{directory:t.worktreeRoot??t.path,deleteLocalBranch:o}))?.success)throw Error(`Worktree removal failed`);a(t.worktreeRoot??t.path),Z(j(e.path)),E();let l=j(t.worktreeRoot??t.path),u=s.getState().availableWorktreesByProject,d=new Map(u),m=new Set([l,j(t.path)]);for(let[e,t]of u){let n=t.filter(e=>j(e.worktreeRoot??e.path)!==l||(m.add(j(e.path)),!1));n.length!==t.length&&(d.set(e,n),Z(e))}$(m),s.setState({availableWorktreesByProject:d,availableWorktrees:s.getState().availableWorktrees.filter(e=>j(e.worktreeRoot??e.path)!==l)});let h=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&h&&await p(r,{branch:h,remote:c}).catch(()=>void 0)}export{oe as a,_ as c,se as i,ie as n,z as o,Q as r,k as s,ae as t};
@@ -1 +1 @@
1
- import{l as e,s as t}from"./gitApi-Di_eB3Io.js";import{s as n,t as r}from"./worktreeManager-CnxL8GZi.js";var i=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},a=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),o=e=>e.branchName?a(e.branchName):e.mode===`existing`?a(e.existingBranch||e.preferredName||``):a(e.preferredName||``),s=async r=>{let a=await n(r);try{let e=i((await t(r)).branches?.[a]?.tracking||null);if(e?.remote)return e.remote}catch{}try{let t=i((await e(r)).tracking);if(t?.remote)return t.remote}catch{}return null},c=async(e,t)=>{let n=await s(e),r=a(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},l=async(e,t,n)=>{let r=o(t),i=n?.resolvedRootTrackingRemote,s=i===void 0?await c(e,r):i&&a(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:a(r)}:null;return s?{...t,setUpstream:t.setUpstream??s.setUpstream,upstreamRemote:t.upstreamRemote||s.upstreamRemote,upstreamBranch:t.upstreamBranch||s.upstreamBranch}:t},u=async(e,t,n)=>{let i=await l(e.path,t,n);return r(e,i)},d=`yuri:lastWorktreeSourceBranch`,f=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,p=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t};export{s as a,u as i,p as n,l as o,f as r,d as t};
1
+ import{l as e,s as t}from"./gitApi-BNkkLnOi.js";import{s as n,t as r}from"./worktreeManager-BJCsjptu.js";var i=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},a=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),o=e=>e.branchName?a(e.branchName):e.mode===`existing`?a(e.existingBranch||e.preferredName||``):a(e.preferredName||``),s=async r=>{let a=await n(r);try{let e=i((await t(r)).branches?.[a]?.tracking||null);if(e?.remote)return e.remote}catch{}try{let t=i((await e(r)).tracking);if(t?.remote)return t.remote}catch{}return null},c=async(e,t)=>{let n=await s(e),r=a(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},l=async(e,t,n)=>{let r=o(t),i=n?.resolvedRootTrackingRemote,s=i===void 0?await c(e,r):i&&a(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:a(r)}:null;return s?{...t,setUpstream:t.setUpstream??s.setUpstream,upstreamRemote:t.upstreamRemote||s.upstreamRemote,upstreamBranch:t.upstreamBranch||s.upstreamBranch}:t},u=async(e,t,n)=>{let i=await l(e.path,t,n);return r(e,i)},d=`yuri:lastWorktreeSourceBranch`,f=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,p=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t};export{s as a,u as i,p as n,l as o,f as r,d 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-CmWGNM6N.js"></script>
574
+ <script type="module" crossorigin src="/assets/main-BpAkYb0H.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">
@@ -610,12 +610,12 @@
610
610
  <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-CrPYe9Oc.js">
611
611
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-CsTh04jY.js">
612
612
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CzZ_VAoB.js">
613
- <link rel="modulepreload" crossorigin href="/assets/types-B-Io5z5w.js">
614
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-CXshem6r.js">
615
- <link rel="modulepreload" crossorigin href="/assets/native-config-C_hqdruM.js">
613
+ <link rel="modulepreload" crossorigin href="/assets/types-DfbaAnUB.js">
614
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-qaeQqHpT.js">
615
+ <link rel="modulepreload" crossorigin href="/assets/native-config-CD8pMBkt.js">
616
616
  <link rel="modulepreload" crossorigin href="/assets/runtime-ead7P81A.js">
617
617
  <link rel="modulepreload" crossorigin href="/assets/bootstrap-eLlfzqAI.js">
618
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CnEfMg7l.js">
618
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Cs95Hj1_.js">
619
619
  <link rel="stylesheet" crossorigin href="/assets/src-BacdFOCS.css">
620
620
  </head>
621
621
  <body class="h-full bg-background text-foreground">
@@ -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-CA9XT4K1.js"></script>
80
+ <script type="module" crossorigin src="/assets/miniChat-D2l_XXQe.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">
@@ -116,12 +116,12 @@
116
116
  <link rel="modulepreload" crossorigin href="/assets/gitApiHttp-CrPYe9Oc.js">
117
117
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-CsTh04jY.js">
118
118
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-CzZ_VAoB.js">
119
- <link rel="modulepreload" crossorigin href="/assets/types-B-Io5z5w.js">
120
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-CXshem6r.js">
121
- <link rel="modulepreload" crossorigin href="/assets/native-config-C_hqdruM.js">
119
+ <link rel="modulepreload" crossorigin href="/assets/types-DfbaAnUB.js">
120
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-qaeQqHpT.js">
121
+ <link rel="modulepreload" crossorigin href="/assets/native-config-CD8pMBkt.js">
122
122
  <link rel="modulepreload" crossorigin href="/assets/runtime-ead7P81A.js">
123
123
  <link rel="modulepreload" crossorigin href="/assets/bootstrap-eLlfzqAI.js">
124
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CnEfMg7l.js">
124
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Cs95Hj1_.js">
125
125
  <link rel="stylesheet" crossorigin href="/assets/src-BacdFOCS.css">
126
126
  </head>
127
127
  <body class="h-full bg-background text-foreground">
package/dist/mobile.html CHANGED
@@ -64,7 +64,7 @@
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-BKQlIKz3.js"></script>
67
+ <script type="module" crossorigin src="/assets/mobile-mVNRvGd5.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">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuriai/web",
3
- "version": "0.3.6-beta.15",
3
+ "version": "0.3.6-beta.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
package/server/index.js CHANGED
@@ -1903,6 +1903,7 @@ async function main(options = {}) {
1903
1903
  remoteHostGateway,
1904
1904
  getRemoteProjectState: () => ({ hubId: remoteHostStore.hubId, hasRemoteProjects: remoteHostStore.hasProjects() }),
1905
1905
  remoteConnectionsAdapter: options.remoteConnectionsAdapter,
1906
+ getHostPort: () => tunnelRuntimeContext.getActivePort(),
1906
1907
  express,
1907
1908
  uiAuthController,
1908
1909
  crypto,
@@ -578,9 +578,13 @@ construction, no additional skill directories are scanned, and no skill/config
578
578
  copy, tool registration or permission is created. Missing/failed OpenCode skill
579
579
  reads retain the existing explicit tool errors. These pointers are absent from
580
580
  read-only background reviews and do not change ordinary Session instructions.
581
- The customization pointer explicitly has no bound desktop helper: SSH, config
582
- sync and Relay pairing remain unavailable in the contact, without a filesystem,
583
- credential or internal-HTTP fallback. GUI authoring instructions do not authorize
581
+ The customization pointer follows the OpenCode Session capability set: when the turn
582
+ has `bash` and `resolveCustomizationSkill(assistantID)` returns a binding, it names the
583
+ staged skill and the bound project and (with the Electron adapter) SSH/Relay helper
584
+ commands, so archive (`settle-session`), remote sessions, SSH and pairing work through
585
+ the same Host APIs. Otherwise SSH, config sync and Relay pairing stay unavailable,
586
+ without a filesystem, credential or internal-HTTP fallback. `service.hasAssistant`
587
+ backs the bridge's caller check. GUI authoring instructions do not authorize
584
588
  installation; substantive implementation still belongs in a worker.
585
589
  CLI authentication instructions, endpoint URLs and skill bodies are not duplicated
586
590
  in the permanent prompt. For other connected skills, load `opencode.catalog`,
@@ -1,16 +1,32 @@
1
1
  import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- const customizationSkillPath = fileURLToPath(new URL('../gui-customization/skill/SKILL.md', import.meta.url));
4
+ const shippedCustomizationSkillPath = fileURLToPath(new URL('../gui-customization/skill/SKILL.md', import.meta.url));
5
5
 
6
- export function formatAssistantBuiltinSkillsPrompt(tools) {
6
+ const CUSTOMIZATION_SCOPE = 'adding a directory as a project in Yuri, task/session archive or restore (归档/恢复; the task-view 「归档」 is settle-session), remote sessions, project/session resource ownership or yuri:// deep links, appearance, themes/CSS/layout, logos/Dock, GUI plugins, pages/tabs, widgets, file previews/exports, panels and settings, or SSH/config-sync/Relay pairing';
7
+
8
+ const customizationPointer = (tools, customizationSkill) => {
9
+ const names = new Set(tools.map((tool) => tool.name));
10
+ const bound = names.has('bash') && customizationSkill && typeof customizationSkill.file === 'string';
11
+ const skillPath = bound ? customizationSkill.file : shippedCustomizationSkillPath;
12
+ const load = `Load with read({"path":${JSON.stringify(skillPath)}}), then read only the matching references relative to ${JSON.stringify(path.dirname(skillPath))}.`;
13
+ const projects = bound && customizationSkill.projectsCommand
14
+ ? `Project, task/session archive and remote-session operations run through this bound API helper (bash); run its describe command first, then use the commands it returns: ${customizationSkill.projectsCommand}`
15
+ : 'Project registration uses granted yuri.projects tools, not a session-bound helper.';
16
+ const remote = bound && customizationSkill.remoteCommand
17
+ ? `SSH setup, configuration sync and Relay pairing run only through this bound helper (bash) after reading references/remote-connections.md: ${customizationSkill.remoteCommand}`
18
+ : 'This contact has no bound local desktop helper for SSH, configuration sync or Relay pairing; those operations are unavailable here.';
19
+ return `- yuri-customization: For ${CUSTOMIZATION_SCOPE}. ${load} ${projects} ${remote} Reading the skill does not create that authorization.`;
20
+ };
21
+
22
+ export function formatAssistantBuiltinSkillsPrompt(tools, { customizationSkill = null } = {}) {
7
23
  const names = new Set(tools.map((tool) => tool.name));
8
24
  const skills = [];
9
25
  if (names.has('read_opencode_skill')) {
10
26
  skills.push('- opencode: For OpenCode itself: configuration, agents, skills, tools, permissions, MCP, providers, plugins, CLI, SDK/API and troubleshooting. Load load_tools({"domain":"opencode.catalog"}), then read_opencode_skill({"id":"opencode"}); continue with nextOffset when partial. Use the current connected catalog, not a copied skill body or a virtual built-in file path.');
11
27
  }
12
28
  if (names.has('read')) {
13
- skills.push(`- yuri-customization: For adding a directory as a project in Yuri, project/session resource ownership or yuri:// deep links, appearance, themes/CSS/layout, logos/Dock, GUI plugins, pages/tabs, widgets, file previews/exports, panels and settings, or SSH/config-sync/Relay capability boundaries. Load with read({"path":${JSON.stringify(customizationSkillPath)}}), then read only the matching references relative to ${JSON.stringify(path.dirname(customizationSkillPath))}. Project registration uses granted yuri.projects tools, not a session-bound helper. This contact has no bound local desktop helper for SSH, configuration sync or Relay pairing; those operations are unavailable here. Reading the skill does not create that authorization.`);
29
+ skills.push(customizationPointer(tools, customizationSkill));
14
30
  }
15
31
  return skills.length > 0 ? [
16
32
  'Built-in skills (progressive instructions): load the matching skill before following its workflow. Reading instructions does not mount tools or grant permissions; use the actual contact tools, or assign substantive implementation to a worker with the relevant context.',
@@ -29,6 +29,22 @@ describe('assistant built-in skill pointers', () => {
29
29
  }
30
30
  });
31
31
 
32
+ it('hands a contact the bound helpers only when it can run them', () => {
33
+ const customizationSkill = { file: '/data/session-skills/yuri-customization-abc/SKILL.md', projectsCommand: 'run projects describe', remoteCommand: 'run remote describe' };
34
+ const withBash = formatAssistantBuiltinSkillsPrompt([{ name: 'read' }, { name: 'bash' }], { customizationSkill });
35
+ expect(withBash).toContain('settle-session');
36
+ expect(withBash).toContain('read({"path":"/data/session-skills/yuri-customization-abc/SKILL.md"})');
37
+ expect(withBash).toContain('run projects describe');
38
+ expect(withBash).toContain('run remote describe');
39
+ expect(withBash).not.toContain('no bound local desktop helper');
40
+ const withoutBash = formatAssistantBuiltinSkillsPrompt([{ name: 'read' }], { customizationSkill });
41
+ expect(withoutBash).not.toContain('run projects describe');
42
+ expect(withoutBash).toContain('no bound local desktop helper');
43
+ const noRemote = formatAssistantBuiltinSkillsPrompt([{ name: 'read' }, { name: 'bash' }], { customizationSkill: { ...customizationSkill, remoteCommand: null } });
44
+ expect(noRemote).toContain('run projects describe');
45
+ expect(noRemote).toContain('no bound local desktop helper');
46
+ });
47
+
32
48
  it('omits pointers whose readers were not granted', () => {
33
49
  expect(formatAssistantBuiltinSkillsPrompt([])).toBe('');
34
50
  const local = formatAssistantBuiltinSkillsPrompt([{ name: 'read' }]);
@@ -503,6 +503,7 @@ export async function runContactTurn({
503
503
  AgentImpl = Agent,
504
504
  signal = null,
505
505
  readOnly = false,
506
+ customizationSkill = null,
506
507
  allowWatchSession = false,
507
508
  allowSilent = false,
508
509
  }) {
@@ -539,7 +540,7 @@ export async function runContactTurn({
539
540
  cwd: runtime?.cwd,
540
541
  skillsPrompt: runtime?.skillsPrompt,
541
542
  }),
542
- readOnly ? '' : formatAssistantBuiltinSkillsPrompt([...codingTools, ...contactTools]),
543
+ readOnly ? '' : formatAssistantBuiltinSkillsPrompt([...codingTools, ...contactTools], { customizationSkill }),
543
544
  assistant.defaultPrompt,
544
545
  codingTools.length > 0 ? WORKSPACE_RESPONSE_PROTOCOL : '',
545
546
  'Actual tool results arrive in tool-role messages; never manufacture them.',
@@ -38,6 +38,7 @@ export const registerAssistantRoutes = (app, dependencies) => {
38
38
  listProjects: dependencies.listProjects,
39
39
  remoteHostGateway: dependencies.remoteHostGateway,
40
40
  registerProject: dependencies.registerProject,
41
+ resolveCustomizationSkill: dependencies.resolveCustomizationSkill,
41
42
  readModelPreferences: dependencies.readModelPreferences,
42
43
  listScheduledTasks: dependencies.listScheduledTasks,
43
44
  sessionIndexService: dependencies.sessionIndexService,
@@ -258,7 +258,7 @@ const awaitWithDeadline = async (work, ms = CONTACT_CATALOG_DEADLINE_MS, code =
258
258
  }
259
259
  };
260
260
 
261
- export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, getOpenCodeAuthHeaders, getServerId = async () => null, getAllowedRoots = () => [], listProjects = async () => [], registerProject = null, readModelPreferences = async () => null, listScheduledTasks = null, sessionIndexService = null, upsertScheduledTask = null, patchScheduledTask = null, syncScheduledTaskProject = null, globalEventHub = null, onRevisionTip = null, onContactTurnEvent = null, onContactTurnComplete = null, /** Host archive op: ({ sessionID, directory, archivedAt }) => Promise */ archiveSessionHost = null, /** Idempotent Host metadata drop after successful SDK delete */ forgetSessionHost = null, /** Host store write: (sessionId, patch) => Promise */ persistSessionMetadata = null, /** After Host isolation metadata is committed. */ onSystemSessionPersisted = null, clock = () => Date.now(), setIntervalFn = setInterval, clearIntervalFn = clearInterval, setImmediateFn = setImmediate, setTimeoutFn = setTimeout, clearTimeoutFn = clearTimeout, reconcileIntervalMs = 60_000, clientFactory, fetchImpl, remoteHostGateway = null, createChatCompletion = null, runContactTurn = defaultRunContactTurn, listWorktrees = defaultListWorktrees } = {}) => {
261
+ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, getOpenCodeAuthHeaders, getServerId = async () => null, getAllowedRoots = () => [], listProjects = async () => [], registerProject = null, /** (assistantID) => Promise<{file, projectsCommand, remoteCommand}|null> */ resolveCustomizationSkill = null, readModelPreferences = async () => null, listScheduledTasks = null, sessionIndexService = null, upsertScheduledTask = null, patchScheduledTask = null, syncScheduledTaskProject = null, globalEventHub = null, onRevisionTip = null, onContactTurnEvent = null, onContactTurnComplete = null, /** Host archive op: ({ sessionID, directory, archivedAt }) => Promise */ archiveSessionHost = null, /** Idempotent Host metadata drop after successful SDK delete */ forgetSessionHost = null, /** Host store write: (sessionId, patch) => Promise */ persistSessionMetadata = null, /** After Host isolation metadata is committed. */ onSystemSessionPersisted = null, clock = () => Date.now(), setIntervalFn = setInterval, clearIntervalFn = clearInterval, setImmediateFn = setImmediate, setTimeoutFn = setTimeout, clearTimeoutFn = clearTimeout, reconcileIntervalMs = 60_000, clientFactory, fetchImpl, remoteHostGateway = null, createChatCompletion = null, runContactTurn = defaultRunContactTurn, listWorktrees = defaultListWorktrees } = {}) => {
262
262
  const execution = createAssistantExecutionAccessor(remoteHostGateway);
263
263
  const targetFields = () => execution.current() ? { target: execution.current().target } : {};
264
264
  const scopedWork = (params, work) => execution.run(params, work);
@@ -3821,9 +3821,12 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
3821
3821
  } : null,
3822
3822
  }));
3823
3823
  controller.signal.throwIfAborted();
3824
+ const customizationSkill = typeof resolveCustomizationSkill === 'function'
3825
+ ? await Promise.resolve(resolveCustomizationSkill(row.assistant_id)).catch(() => null) : null;
3824
3826
  const generated = await runContactTurn({
3825
3827
  signal: controller.signal,
3826
3828
  readOnly: false,
3829
+ customizationSkill,
3827
3830
  assistant: assistantSnapshot,
3828
3831
  history: executionHistory,
3829
3832
  userText,
@@ -4363,7 +4366,8 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
4363
4366
  assertGeneration();
4364
4367
  return image;
4365
4368
  };
4366
- return { capability: async () => ({ supported: true, enabled: enabled(), revision: revision(), serverInstanceID: await getServerId(), sharingAvailable: false, archiveMetadataAvailable: typeof archiveSessionHost === 'function', sessionMetadataAvailable: false }), snapshot, channelPage, prepareChannelImage, ensureDefaultAssistant, createAssistant, updateAssistant, setEnabled: (input) => { if (!plainObject(input) || typeof input.enabled !== 'boolean' || input.expectedRevision !== revision()) fail('revision_conflict'); return { enabled: true, revision: revision() }; }, removeAssistant, ensure, createNew, compact, send, whenContactTurnSettled, abort, captureQueueDeliveryTarget, sendWithCapturedConfig, share, shareOperation, historicalMessages, contactMessages, clearContactMemory, resetContact, markContactRead, appendContactCard, deliverPeerMessage, listAssistantScheduledTasks, reportScheduledTaskResult, putAssistantContactAttachment, getAssistantContactAttachment, migrateContactAttachments, processEvent, reportAssignedSessionSettle: reportAssignedSession, reconcile, close: () => {
4369
+ const hasAssistant = (assistantID) => { const row = typeof assistantID === 'string' && assistantID ? assistant(assistantID) : null; return Boolean(row) && !row.tombstone_at; };
4370
+ return { hasAssistant, capability: async () => ({ supported: true, enabled: enabled(), revision: revision(), serverInstanceID: await getServerId(), sharingAvailable: false, archiveMetadataAvailable: typeof archiveSessionHost === 'function', sessionMetadataAvailable: false }), snapshot, channelPage, prepareChannelImage, ensureDefaultAssistant, createAssistant, updateAssistant, setEnabled: (input) => { if (!plainObject(input) || typeof input.enabled !== 'boolean' || input.expectedRevision !== revision()) fail('revision_conflict'); return { enabled: true, revision: revision() }; }, removeAssistant, ensure, createNew, compact, send, whenContactTurnSettled, abort, captureQueueDeliveryTarget, sendWithCapturedConfig, share, shareOperation, historicalMessages, contactMessages, clearContactMemory, resetContact, markContactRead, appendContactCard, deliverPeerMessage, listAssistantScheduledTasks, reportScheduledTaskResult, putAssistantContactAttachment, getAssistantContactAttachment, migrateContactAttachments, processEvent, reportAssignedSessionSettle: reportAssignedSession, reconcile, close: () => {
4367
4371
  assignedCompletion.dispose();
4368
4372
  remoteWatchReconciler.close();
4369
4373
  execution.close();
@@ -22,11 +22,22 @@ navigation protocol. Existing instance discovery/binding does not imply support
22
22
  identity-scoped session URLs; this skill update adds neither a self-identity helper
23
23
  nor a new deep-link parameter.
24
24
 
25
- Interactive Yuri contacts reuse this same shipped entry and references through
26
- the assistant-only pointer in `../assistants/builtin-skills.js`. Their pi tools
27
- run on the Host, so the pointer names the package-local resource directly rather
28
- than staging a Session instruction. It advertises no bound desktop helper and
29
- grants no SSH/config-sync/Relay capability. Read-only background reviews omit it.
25
+ Interactive Yuri contacts consume this same skill, staged resources and helpers
26
+ through the assistant-only pointer in `../assistants/builtin-skills.js`, so a
27
+ contact and an OpenCode Session have the same capability set. The Host resolves
28
+ `createCustomizationSkillInstaller(...).resolve({ assistantID }, bindings)` per turn
29
+ (`feature-routes-runtime.js`): the pointer names the staged `SKILL.md` and the bound
30
+ `projects.mjs` / `remote-connections.mjs` describe commands, which the contact runs
31
+ with its pi `bash` tool. The remote helper is bound only when the Electron adapter is
32
+ present. Without `bash`, a resolved binding, a shared service or a readable
33
+ registration, the pointer falls back to the shipped file with no helper and the
34
+ SSH/config-sync/Relay branch stays unavailable. Read-only background reviews omit it.
35
+
36
+ Both bridge routes accept exactly one caller: `{sessionID}` (admission-bound Session
37
+ metadata) or `{assistantID}` (a live, non-tombstoned contact checked through
38
+ `hasAssistant`). `skill-caller.js` owns that parsing and binding check; a body with
39
+ both or neither is `invalid_input`. Loopback, no Origin and the shared-service
40
+ credential still gate every call.
30
41
 
31
42
  References are organized by capability: project registration, window APIs, appearance, UI surfaces, plugin styles, global pages, work-status widgets, icons,
32
43
  file parsing/previews, preview actions/exports, and package workflow. Host contracts
@@ -40,8 +51,9 @@ independently of Electron's remote-connections adapter. `projects-client.mjs` is
40
51
  staged as `projects.mjs`; it and the remote helper share the staged
41
52
  `session-skill-command.mjs` command formatter. Only bound helpers are staged, and
42
53
  each resource combination has its own content fingerprint. Existing sessions keep
43
- their immutable staged references until a new session is admitted. Contacts use
44
- their own granted `yuri.projects` tools, not this session binding.
54
+ their immutable staged references until a new session is admitted. Contacts keep
55
+ their granted `yuri.projects` `register_project` tool for the assign flow and also
56
+ reach every other operation through the same helper, bound to their `assistantID`.
45
57
 
46
58
  `projects.js` owns `POST /api/yuri/session-skills/projects` (`describe`, `list`,
47
59
  `add`, `task-sessions`, `session-state`, `settle-session`, `unsettle-session`, `archive-session`, `unarchive-session`, `remote-hosts`, `add-remote`, `remote-projects`, `sessions`, `read-session`, `create-session`, `prompt-session`). `projects-remote.js` uses the injected `remoteHostGateway` and its immutable task leases; discovery returns authenticated `{hubId,hostId,instanceId}` targets, and explicit targets never fall back to local. `remote-hosts` includes authorized machines with no associated project, reports per-machine failures and releases each probe. `add-remote` uses `gateway.registerProject`, shared with the UI: the target validates/canonicalizes and registers the directory before the Hub saves a deduplicated reference and broadcasts project-order invalidation. A Hub write failure leaves the remote project intact; retrying the same target/path completes association. Paths are never resolved on the Hub filesystem. Lease cleanup runs on every outcome. Remote SDK requests preserve generated request data through the lease; bounded message reads use the existing Host turn-page route. No remote bodies are persisted on Hub. Session creation/prompt require stable caller IDs for ambiguous-result inspection, not automatic replay. This capability neither uses nor grants the desktop SSH helper. The global gate and route require the existing loopback service credential,
@@ -28,7 +28,7 @@ async function main() {
28
28
  const response = await fetch(new URL('/api/yuri/session-skills/projects', origin), {
29
29
  method: 'POST', redirect: 'error', signal: AbortSignal.timeout(['create-session', 'prompt-session'].includes(operation) ? 305_000 : 30_000),
30
30
  headers: { 'content-type': 'application/json', authorization: `Basic ${Buffer.from(`opencode:${registration.password}`).toString('base64')}` },
31
- body: JSON.stringify({ sessionID: binding.sessionID, operation, input }),
31
+ body: JSON.stringify({ ...(binding.assistantID ? { assistantID: binding.assistantID } : { sessionID: binding.sessionID }), operation, input }),
32
32
  });
33
33
  const result = await response.json();
34
34
  if (!response.ok) {
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { authorizeScheduledTaskSkillRequest } from '../scheduled-tasks/session-skill-contract.js';
3
3
  import { remoteProjectOperations, validRemoteProjectInput, runRemoteProjectOperation } from './projects-remote.js';
4
4
  import { lifecycleOperations, validLifecycleInput } from './projects-lifecycle.js';
5
+ import { isBoundSkillCaller, parseSkillCaller } from './skill-caller.js';
5
6
 
6
7
  export const PROJECTS_SKILL_PATH = '/api/yuri/session-skills/projects';
7
8
 
@@ -18,17 +19,16 @@ const validInput = (operation, input) => {
18
19
  };
19
20
 
20
21
  /** Session-bound Host registration; the shared project registry owns persistence. */
21
- export function registerProjectsSkill(app, { express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient, registerProject, readSettingsFromDiskStrict, sanitizeProjects, remoteHostGateway, sessionLifecycle }) {
22
+ export function registerProjectsSkill(app, { express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient, registerProject, readSettingsFromDiskStrict, sanitizeProjects, remoteHostGateway, sessionLifecycle, hasAssistant }) {
22
23
  app.post(PROJECTS_SKILL_PATH, express.json({ limit: '16kb' }), async (req, res) => {
23
24
  res.setHeader('Cache-Control', 'no-store');
24
25
  if (!getIsSharedOpenCodeService() || !authorizeScheduledTaskSkillRequest(req, getOpenCodeAuthHeaders())) return res.status(403).json({ error: 'Forbidden' });
25
- const { sessionID, operation, input = {} } = req.body ?? {};
26
- if (typeof sessionID !== 'string' || !sessionID || sessionID.length > 256
26
+ const { operation, input = {} } = req.body ?? {};
27
+ const caller = parseSkillCaller(req.body);
28
+ if (!caller
27
29
  || !['describe', 'list', 'add', ...lifecycleOperations, ...remoteProjectOperations].includes(operation) || !validInput(operation, input)) return res.status(400).json({ code: 'invalid_input', error: 'Invalid project input' });
28
30
  try {
29
- const session = await createClient().session.get({ sessionID });
30
- const hostOrigin = `http://${req.socket.localAddress === '::1' ? '[::1]' : '127.0.0.1'}:${req.socket.localPort}`;
31
- if (session.metadata?.yuri?.scheduledTaskSkill?.hostOrigin !== hostOrigin) return res.status(403).json({ error: 'Session is not bound to this Host' });
31
+ if (!await isBoundSkillCaller(req, caller, { createClient, hasAssistant })) return res.status(403).json({ error: 'Caller is not bound to this Host' });
32
32
  if (operation === 'describe') return res.json({ supported: true, remoteSupported: Boolean(remoteHostGateway?.supported && remoteHostGateway?.acquireTask), lifecycleSupported: Boolean(sessionLifecycle), inputs: { add: '{path: existing absolute Host directory, label?: display name}', list: '{}',
33
33
  'task-sessions': '{directory?: absolute bound-Host directory, cursor?: returned nextCursor} bounded Host index metadata, not full upstream history',
34
34
  'session-state': '{sessionID} read Host archive authority and nullable task projection; not upstream existence or live UI state',
@@ -12,7 +12,7 @@ import { createProjectDirectoryRuntime } from '../opencode/project-directory-run
12
12
  import { registerProjectsSkill, PROJECTS_SKILL_PATH } from './projects.js';
13
13
 
14
14
  describe('session project registration API', () => {
15
- let root, workspace, settingsPath, runtime, server, origin, getSession, binding, registerProject, shared, failWrites, tips, gateway;
15
+ let root, workspace, settingsPath, runtime, server, origin, getSession, binding, registerProject, shared, failWrites, tips, gateway, hasAssistant;
16
16
  const auth = { Authorization: `Basic ${Buffer.from('opencode:fixture').toString('base64')}` };
17
17
  beforeEach(async () => {
18
18
  root = await fs.mkdtemp(path.join(os.tmpdir(), 'project-skill-'));
@@ -30,12 +30,13 @@ describe('session project registration API', () => {
30
30
  const registry = createProjectRegistry({ persistSettings: runtime.persistSettings, validateDirectoryPath });
31
31
  registerProject = vi.fn((input) => registry.register(input));
32
32
  getSession = vi.fn(async () => ({ metadata: { yuri: { scheduledTaskSkill: { hostOrigin: binding } } } }));
33
+ hasAssistant = vi.fn(async (id) => id === 'ast_live');
33
34
  const app = express();
34
35
  gateway = { supported: true, acquireTask: vi.fn(), registerProject: vi.fn(), list: vi.fn(async () => ({ supported: true, hubId: 'hub', hosts: [], projects: [] })) };
35
36
  registerProjectsSkill(app, { express, getIsSharedOpenCodeService: () => shared, getOpenCodeAuthHeaders: () => auth,
36
37
  createClient: () => ({ session: { get: getSession } }), registerProject, readSettingsFromDiskStrict: runtime.readSettingsFromDiskStrict,
37
38
  sanitizeProjects: normalization.sanitizeProjects,
38
- remoteHostGateway: gateway,
39
+ remoteHostGateway: gateway, hasAssistant,
39
40
  });
40
41
  server = await new Promise((resolve) => { const s = app.listen(0, '127.0.0.1', () => resolve(s)); });
41
42
  origin = `http://127.0.0.1:${server.address().port}`; binding = origin;
@@ -65,6 +66,16 @@ describe('session project registration API', () => {
65
66
  expect(JSON.stringify({ added, listed })).not.toContain('private-settings');
66
67
  });
67
68
 
69
+ it('admits a live Assistant contact as the caller, without any Session lookup', async () => {
70
+ const call = (body) => fetch(`${origin}${PROJECTS_SKILL_PATH}`, { method: 'POST', headers: { 'content-type': 'application/json', ...auth }, body: JSON.stringify(body) });
71
+ const ok = await call({ assistantID: 'ast_live', operation: 'list', input: {} });
72
+ expect(ok.status).toBe(200);
73
+ expect(getSession).not.toHaveBeenCalled();
74
+ expect((await call({ assistantID: 'ast_gone', operation: 'list', input: {} })).status).toBe(403);
75
+ expect((await call({ assistantID: 'ast_live', sessionID: 'ses_one', operation: 'list', input: {} })).status).toBe(400);
76
+ expect((await call({ operation: 'list', input: {} })).status).toBe(400);
77
+ });
78
+
68
79
  it('rejects invalid input and nonexistent/file paths without changing saved state', async () => {
69
80
  await fs.writeFile(settingsPath, JSON.stringify({ projects: [], secret: 'saved' }));
70
81
  const before = await fs.readFile(settingsPath, 'utf8');
@@ -26,7 +26,7 @@ async function main() {
26
26
  const response = await fetch(new URL('/api/yuri/session-skills/remote-connections', origin), {
27
27
  method: 'POST', redirect: 'error', signal: AbortSignal.timeout(operation === 'pair' ? 250_000 : 30_000),
28
28
  headers: { 'content-type': 'application/json', authorization: `Basic ${Buffer.from(`opencode:${registration.password}`).toString('base64')}` },
29
- body: JSON.stringify({ sessionID: binding.sessionID, operation, input }),
29
+ body: JSON.stringify({ ...(binding.assistantID ? { assistantID: binding.assistantID } : { sessionID: binding.sessionID }), operation, input }),
30
30
  });
31
31
  const result = await response.json();
32
32
  if (!response.ok) {
@@ -1,4 +1,5 @@
1
1
  import { authorizeScheduledTaskSkillRequest } from '../scheduled-tasks/session-skill-contract.js';
2
+ import { isBoundSkillCaller, parseSkillCaller } from './skill-caller.js';
2
3
 
3
4
  export const REMOTE_CONNECTIONS_SKILL_PATH = '/api/yuri/session-skills/remote-connections';
4
5
 
@@ -18,17 +19,16 @@ const validInput = (operation, input) => {
18
19
  };
19
20
 
20
21
  /** Loopback + service credential + admitted-session binding, never browser/native IPC. */
21
- export function registerRemoteConnectionsSkill(app, { express, adapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient }) {
22
+ export function registerRemoteConnectionsSkill(app, { express, adapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient, hasAssistant }) {
22
23
  app.post(REMOTE_CONNECTIONS_SKILL_PATH, express.json({ limit: '16kb' }), async (req, res) => {
23
24
  res.setHeader('Cache-Control', 'no-store');
24
25
  if (!getIsSharedOpenCodeService() || !authorizeScheduledTaskSkillRequest(req, getOpenCodeAuthHeaders())) return res.status(403).json({ error: 'Forbidden' });
25
26
  if (!adapter) return res.status(501).json({ code: 'remote_connections_unsupported', error: 'Requires the local desktop Host' });
26
- const { sessionID, operation, input = {} } = req.body ?? {};
27
- if (typeof sessionID !== 'string' || !sessionID || !['describe', 'list', 'setup', 'pair'].includes(operation) || !validInput(operation, input)) return res.status(400).json({ code: 'invalid_input', error: 'Invalid connection input' });
27
+ const { operation, input = {} } = req.body ?? {};
28
+ const caller = parseSkillCaller(req.body);
29
+ if (!caller || !['describe', 'list', 'setup', 'pair'].includes(operation) || !validInput(operation, input)) return res.status(400).json({ code: 'invalid_input', error: 'Invalid connection input' });
28
30
  try {
29
- const session = await createClient().session.get({ sessionID });
30
- const hostOrigin = `http://${req.socket.localAddress === '::1' ? '[::1]' : '127.0.0.1'}:${req.socket.localPort}`;
31
- if (session.metadata?.yuri?.scheduledTaskSkill?.hostOrigin !== hostOrigin) return res.status(403).json({ error: 'Session is not bound to this Host' });
31
+ if (!await isBoundSkillCaller(req, caller, { createClient, hasAssistant })) return res.status(403).json({ error: 'Caller is not bound to this Host' });
32
32
  if (operation === 'describe') return res.json({ supported: true,
33
33
  inputs: { setup: '{sshCommand, nickname?} or {id}', pair: '{id?, relayUrl?, label?}; omitted id means this local desktop', list: '{}' },
34
34
  installation: 'New Linux SSH connections use the matching self-contained release (x64/arm64, glibc 2.36+), without system Node/npm/Python/compiler. Existing saved installation choices and macOS keep their package-manager path.',
@@ -29,14 +29,26 @@ export function createCustomizationSkillInstaller({ yuriDataDir }) {
29
29
  })().catch((error) => { resources.delete(key); throw error; }));
30
30
  return resources.get(key);
31
31
  };
32
- return async (client, sessionID, { remoteBinding, projectBinding } = {}) => {
32
+ /** Stage the resource set and format the bound helper commands for one caller (`{sessionID}` or `{assistantID}`). */
33
+ const resolve = async (caller, { remoteBinding, projectBinding } = {}) => {
33
34
  const file = await prepare(Boolean(remoteBinding), Boolean(projectBinding));
34
- const projects = projectBinding ? ` For local/remote project registration, task/session archive and restore, discovering authorized remote machines, or reading/creating/continuing remote sessions, read references/projects.md and run the bound project API helper.\nBound project helper: ${sessionSkillCommand(process.execPath, path.join(path.dirname(file), 'projects.mjs'), Buffer.from(JSON.stringify({ ...projectBinding, sessionID })).toString('base64url'), 'describe')}\n` : ' No bound project helper is provided; project registration, task/session archive and remote project/session access are unavailable through this session skill.';
35
- const remote = remoteBinding ? ` For SSH setup/config sync or Relay pairing, use only this bound helper after reading references/remote-connections.md. Bound local desktop helper: ${remoteConnectionsCommand(process.execPath, path.join(path.dirname(file), 'remote-connections.mjs'), Buffer.from(JSON.stringify({ ...remoteBinding, sessionID })).toString('base64url'), 'describe')}` : ' No bound SSH/Relay command is provided: these operations are unavailable in this session. Report that limit and stop this branch; use native Settings or a new supported local desktop session. A script or another capability\'s binding does not enable it. There is no credential/filesystem fallback for this capability.';
35
+ const encode = (binding) => Buffer.from(JSON.stringify({ ...binding, ...caller })).toString('base64url');
36
+ return {
37
+ file,
38
+ projectsCommand: projectBinding ? sessionSkillCommand(process.execPath, path.join(path.dirname(file), 'projects.mjs'), encode(projectBinding), 'describe') : null,
39
+ remoteCommand: remoteBinding ? remoteConnectionsCommand(process.execPath, path.join(path.dirname(file), 'remote-connections.mjs'), encode(remoteBinding), 'describe') : null,
40
+ };
41
+ };
42
+ const install = async (client, sessionID, { remoteBinding, projectBinding } = {}) => {
43
+ const { file, projectsCommand, remoteCommand } = await resolve({ sessionID }, { remoteBinding, projectBinding });
44
+ const projects = projectsCommand ? ` For local/remote project registration, task/session archive and restore, discovering authorized remote machines, or reading/creating/continuing remote sessions, read references/projects.md and run the bound project API helper.\nBound project helper: ${projectsCommand}\n` : ' No bound project helper is provided; project registration, task/session archive and remote project/session access are unavailable through this session skill.';
45
+ const remote = remoteCommand ? ` For SSH setup/config sync or Relay pairing, use only this bound helper after reading references/remote-connections.md. Bound local desktop helper: ${remoteCommand}` : ' No bound SSH/Relay command is provided: these operations are unavailable in this session. Report that limit and stop this branch; use native Settings or a new supported local desktop session. A script or another capability\'s binding does not enable it. There is no credential/filesystem fallback for this capability.';
36
46
  await client.session.instructions.entry.put({ sessionID, key: 'yuri.customization',
37
47
  value: `Yuri customization: for adding a directory as a project in Yuri (local or remote), task/session archive or restore (归档/恢复), remote sessions, project/session resource ownership or yuri:// deep links, SSH connections, configuration sync, Relay pairing, appearance (themes, CSS/layout, Logo, macOS Dock), work-status widgets, global pages/tabs, custom file parsing/previews, preview exports, or GUI panels/commands/settings, read ${JSON.stringify(file)} first. Use the matching reference and apply changes only when requested.${projects}${remote}`,
38
48
  });
39
49
  };
50
+ install.resolve = resolve;
51
+ return install;
40
52
  }
41
53
 
42
54
  /** Managed local servers share the resource filesystem; external servers do not. */
@@ -0,0 +1,18 @@
1
+ const validID = (value) => typeof value === 'string' && value.length > 0 && value.length <= 256;
2
+
3
+ /** A bridge caller is exactly one admitted Session or one live Assistant contact. */
4
+ export const parseSkillCaller = (body) => {
5
+ const { sessionID, assistantID } = body ?? {};
6
+ if (validID(sessionID) && assistantID === undefined) return { kind: 'session', id: sessionID };
7
+ if (validID(assistantID) && sessionID === undefined) return { kind: 'assistant', id: assistantID };
8
+ return null;
9
+ };
10
+
11
+ const hostOriginOf = (req) => `http://${req.socket.localAddress === '::1' ? '[::1]' : '127.0.0.1'}:${req.socket.localPort}`;
12
+
13
+ /** Loopback and service credential are checked by the route; this binds the caller to this Host. */
14
+ export const isBoundSkillCaller = async (req, caller, { createClient, hasAssistant }) => {
15
+ if (caller.kind === 'assistant') return Boolean(await hasAssistant?.(caller.id));
16
+ const session = await createClient().session.get({ sessionID: caller.id });
17
+ return session.metadata?.yuri?.scheduledTaskSkill?.hostOrigin === hostOriginOf(req);
18
+ };
@@ -23,7 +23,8 @@ import { registerProjectIconRoutes } from './project-icon-routes.js';
23
23
  import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
24
24
  import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-route.js';
25
25
  import { registerScheduledTaskSessionSkill } from '../scheduled-tasks/session-skill.js';
26
- import { registerCustomizationSessionSkill } from '../gui-customization/session-skill.js';
26
+ import { registerCustomizationSessionSkill, createCustomizationSkillInstaller } from '../gui-customization/session-skill.js';
27
+ import { readSharedServiceRegistration, resolveSharedServiceRegistrationPath } from './shared-service.js';
27
28
  import { registerConversationRoutes } from '../conversations/routes.js';
28
29
  import { registerHistoryImportRoutes } from '../history-import/routes.js';
29
30
  import { registerSessionTurnPageRoutes } from '../session-turn-pages/routes.js';
@@ -135,6 +136,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
135
136
  getIsExternalOpenCode = () => false,
136
137
  getIsSharedOpenCodeService = () => false,
137
138
  remoteConnectionsAdapter = null,
139
+ getHostPort = () => null,
138
140
  forceResolvedOpenCodeBinary = null,
139
141
  upgradeOpenCodeCli = null,
140
142
  restartOpenCode = null,
@@ -264,8 +266,22 @@ export const createFeatureRoutesRuntime = (dependencies) => {
264
266
  scheduledTaskRouter,
265
267
  remoteConnectionsAdapter,
266
268
  });
269
+ const hasAssistant = (assistantID) => assistantRoutesRuntime?.service?.hasAssistant(assistantID) ?? false;
270
+ // Contacts run on this Host, so they get the same staged helpers as admitted Sessions, bound to their own ID.
271
+ const customizationSkill = createCustomizationSkillInstaller({ yuriDataDir });
272
+ const resolveAssistantCustomizationSkill = async (assistantID) => {
273
+ const port = getHostPort();
274
+ if (!getIsSharedOpenCodeService() || !port) return null;
275
+ const registrationFile = resolveSharedServiceRegistrationPath();
276
+ const upstreamOrigin = new URL(buildOpenCodeUrl('/', '')).origin;
277
+ const registration = await readSharedServiceRegistration({ file: registrationFile });
278
+ if (!registration?.password || registration.origin !== upstreamOrigin
279
+ || getOpenCodeAuthHeaders().Authorization !== `Basic ${Buffer.from(`opencode:${registration.password}`).toString('base64')}`) return null;
280
+ const binding = { hostOrigin: `http://127.0.0.1:${port}`, upstreamOrigin, registrationFile };
281
+ return customizationSkill.resolve({ assistantID }, { projectBinding: binding, ...(remoteConnectionsAdapter ? { remoteBinding: binding } : {}) });
282
+ };
267
283
  registerRemoteConnectionsSkill(app, {
268
- express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
284
+ express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
269
285
  createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
270
286
  });
271
287
  registerCustomizationSessionSkill(app, {
@@ -310,7 +326,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
310
326
  const projectRegistry = createProjectRegistry({ persistSettings, validateDirectoryPath });
311
327
  registerProjectsSkill(app, {
312
328
  remoteHostGateway: routeDependencies.remoteHostGateway,
313
- express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
329
+ express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
314
330
  createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
315
331
  registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
316
332
  sessionLifecycle: createProjectSessionLifecycle({
@@ -354,6 +370,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
354
370
  getServerId,
355
371
  getAllowedRoots: () => assistantAllowedRoots,
356
372
  registerProject: registerAssistantProject,
373
+ resolveCustomizationSkill: resolveAssistantCustomizationSkill,
357
374
  listProjects: async () => {
358
375
  const settings = await readSettingsFromDiskMigrated();
359
376
  return sanitizeProjects(settings?.projects ?? [])