@yuriai/web 0.1.22 → 0.1.23
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.
- package/README.md +1 -1
- package/dist/assets/{AssistantView-B-vEm0jN.js → AssistantView-Cl8dtJE-.js} +3 -3
- package/dist/assets/{DiagramView-DT5CPdtn.js → DiagramView-zXlQky2c.js} +1 -1
- package/dist/assets/{MarkdownRenderer-kDYymiH3.js → MarkdownRenderer-C1PXw_8U.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-cS5FXxon.js → MarkdownRendererImpl-CWVOJcvk.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-CO1AzJsB.js → MarkstreamRendererImpl-BwkPAY1P.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-RLH6AQBN.js → MobileDetailNavigation-B4ZBK4cl.js} +1 -1
- package/dist/assets/{MobileShareBridge-CijqYDMo.js → MobileShareBridge-B5LUJJ99.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-BZKymEeY.js → MobileTabPageHeader-CkUhuZP6.js} +1 -1
- package/dist/assets/{MultiRunWindow-BBADn01m.js → MultiRunWindow-CqNrUij5.js} +1 -1
- package/dist/assets/{OverlayScrollbar-Dxdkid6A.js → OverlayScrollbar-eBG-DXgX.js} +1 -1
- package/dist/assets/{SettingsView-BDw1UGgS.js → SettingsView-vZx4AKc1.js} +1 -1
- package/dist/assets/{SettingsWindow-DQz1f-kO.js → SettingsWindow-Rqxks-AG.js} +1 -1
- package/dist/assets/{TerminalView-CpGeHiw4.js → TerminalView-CGYEbWpv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-qF2onmML.js → ToolOutputDialog-B24XEhve.js} +1 -1
- package/dist/assets/{appThemeRegistry-DmRKfJL3.js → appThemeRegistry-DD8LRHDT.js} +1 -1
- package/dist/assets/{capgoAdapter-BmTEnR2_.js → capgoAdapter-BCy22KX-.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-BXRbrWW5.js → dropdown-menu.styles-BqAI_N66.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-FDObhofW.js → fileMentionTouchSelection-CnxrRlNO.js} +1 -1
- package/dist/assets/{gitApi-D8IPglEo.js → gitApi-D3cHH50Y.js} +1 -1
- package/dist/assets/{insertionBoundaries-DE8RyJf4.js → insertionBoundaries-19EJsmCA.js} +1 -1
- package/dist/assets/{main-Bh0kUjiw.js → main-BO2UnYBd.js} +2 -2
- package/dist/assets/{main-BLMeK7Ed.js → main-b2a4ZRXC.js} +4 -4
- package/dist/assets/{mcpQueries-BFkB-7V_.js → mcpQueries-BBt1ELI8.js} +1 -1
- package/dist/assets/{miniChat-Ciy0u8ci.js → miniChat-BpvsuSKB.js} +2 -2
- package/dist/assets/{mobile-Bm0sCDXq.js → mobile-CyklTbWh.js} +2 -2
- package/dist/assets/{mobileBackNavigation-BwxOTY4b.js → mobileBackNavigation-Df81BnZ5.js} +1 -1
- package/dist/assets/{multirun-CyHj2_Qf.js → multirun-BrpKcjYv.js} +1 -1
- package/dist/assets/{native-config-BDst1Okm.js → native-config-C3EM05Jz.js} +1 -1
- package/dist/assets/{platform-7bX6qtBV.js → platform-CCTs9UKZ.js} +1 -1
- package/dist/assets/{projectMeta-C75m7wMM.js → projectMeta-DOs0HlSf.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BSX59NyD.js → renderElectronMiniChatApp-DaeIwT-e.js} +2 -2
- package/dist/assets/{renderMobileApp-BM8Bg3sb.js → renderMobileApp-C-Rhiqyk.js} +4 -4
- package/dist/assets/{runtimeConfig-D0UDGecm.js → runtimeConfig-CQ3TyMLm.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-Df4Jlmne.js → runtimeEndpointReset-CINPdy23.js} +1 -1
- package/dist/assets/{scheduledTaskNavigation-BE3Okq7X.js → scheduledTaskNavigation-FME9NQYP.js} +1 -1
- package/dist/assets/{sessionChangeSummary-DkIJkqeG.js → sessionChangeSummary-DYp-0K8f.js} +1 -1
- package/dist/assets/{sessionLookup-DhcUVJQR.js → sessionLookup-BMSCT9Y1.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-CQR5TsUS.js → sortable-tabs-strip-DiXAHgws.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BWIoMe5c.js → speechSettingsQueries-Ci2kILTe.js} +1 -1
- package/dist/assets/{terminalApi-BHXvha-U.js → terminalApi-DhXTmxps.js} +1 -1
- package/dist/assets/{textarea-pQCq-iLS.js → textarea-BZhmG_bD.js} +1 -1
- package/dist/assets/{types-2CUEL3Ja.js → types-Du8LnIGl.js} +1 -1
- package/dist/assets/{useAppFontEffects-C9CPKD-1.js → useAppFontEffects-C-CZuq33.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-Cw3ZRPXc.js → useDesktopWindowControlsLayout-C8BGnh2S.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-Cw-vfohq.js → useEffectiveDirectory-B85HOZow.js} +1 -1
- package/dist/assets/{useFontPreferences-D9PX5t6Y.js → useFontPreferences-CMyrMAmq.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-K23K6qFK.js → useMobileNavigationStore-_8410bpu.js} +5 -5
- package/dist/assets/{useWorkerHighlightedLines-U3DE5CRZ.js → useWorkerHighlightedLines-D4HmbcHr.js} +1 -1
- package/dist/assets/vendor-opencode-client-XDI8AfPJ.js +12 -0
- package/dist/index.html +8 -8
- package/dist/mini-chat.html +8 -8
- package/dist/mobile.html +8 -8
- package/package.json +3 -3
- package/server/lib/opencode/DOCUMENTATION.md +9 -9
- package/server/lib/opencode/ensure-cli.js +12 -14
- package/server/lib/opencode/ensure-cli.test.js +8 -8
- package/server/lib/opencode/env-runtime.test.js +1 -1
- package/server/lib/opencode/opencode2-pin.js +3 -4
- package/server/lib/opencode/opencode2-pin.test.js +5 -4
- package/server/lib/opencode/owned-runtime-upgrade.js +4 -11
- package/server/lib/opencode/owned-runtime-upgrade.test.js +4 -0
- package/server/lib/opencode/routes.js +2 -1
- package/server/lib/opencode/routes.test.js +1 -1
- package/server/lib/opencode/runtime-contract.js +3 -4
- package/server/lib/opencode/session-directory-runtime.js +2 -13
- package/server/lib/opencode/session-directory-runtime.test.js +69 -4
- package/server/lib/opencode/upgrade-screen.js +9 -5
- package/server/lib/opencode/upgrade-screen.test.js +20 -0
- package/server/lib/opencode/version-alignment.test.js +6 -6
- package/server/lib/session-index/DOCUMENTATION.md +18 -8
- package/server/lib/session-index/routes.js +3 -1
- package/server/lib/session-index/routes.test.js +2 -0
- package/server/lib/session-index/service.js +23 -0
- package/server/lib/session-index/sync-runtime.js +75 -20
- package/server/lib/session-index/sync-runtime.test.js +5 -5
- package/dist/assets/vendor-opencode-client-MF2GBrFx.js +0 -12
package/dist/assets/{useWorkerHighlightedLines-U3DE5CRZ.js → useWorkerHighlightedLines-D4HmbcHr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-LPikURUk.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-DKFfVCeK.js";import{i as u,n as d,t as f}from"./tooltip-CFuO3PUH.js";import{n as p}from"./MarkdownRenderer-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-LPikURUk.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-DKFfVCeK.js";import{i as u,n as d,t as f}from"./tooltip-CFuO3PUH.js";import{n as p}from"./MarkdownRenderer-C1PXw_8U.js";import{n as m,o as h,s as g,t as _}from"./markdown-worker-7FvUo2nm.js";import{t as v}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as y}from"./markdownTheme-DHoKvD6O.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=y(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return _(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):g(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},ce=(e,t)=>{try{let n=e.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,S.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,S.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,S.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,S.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},le={backgroundColor:`var(--status-info)`,opacity:.6},ue=(e,t,n)=>{try{let i=e.trim().split(`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i={};r(i,{SharedEvents:()=>i,make:()=>a});function a(e){let t,n=4096;function r(e){e.connected=void 0,e.controller.abort(),t===e&&(t=void 0)}async function i(t){let n,i={};try{if(t.controller.signal.aborted)return;for(n=e(t.controller.signal,()=>{t.subscribers.forEach(e=>e.activity?.())})[Symbol.asyncIterator]();!t.controller.signal.aborted;){let e=await n.next();if(e.done||t.controller.signal.aborted)break;e.value.type===`server.connected`&&(t.connected=e.value),t.subscribers.forEach(t=>t.push(e.value))}}catch(e){i={error:e}}finally{r(t);try{await n?.return?.()}catch(e){`error`in i||(i={error:e})}t.subscribers.forEach(e=>e.finish(i))}}return{subscribe(e){return{[Symbol.asyncIterator](){let a=[],o=[],s=!1,c,l,u=e?.types?.length?new Set(e.types):void 0,d=e=>!u||e.type===`server.connected`||u.has(e.type);function f(t,n=!0){c=t,n&&(o.length=0),e?.signal?.removeEventListener(`abort`,p),l?.subscribers.delete(m)&&!l.subscribers.size&&r(l),a.splice(0).forEach(e=>{`error`in t?e.reject(t.error):e.resolve({done:!0,value:void 0})})}function p(){f({})}let m={activity:e?.onActivity,finish(e){f(e,!1)},push(e){if(c||!d(e))return;let t=a.shift();if(t){t.resolve({done:!1,value:e});return}if(o.length===n){f({error:Error(`Event subscriber exceeded its ${n}-event capacity`)});return}o.push(e)}};function h(){if(c)return;let e=!t;l=t??{controller:new AbortController,subscribers:new Set},t=l,l.subscribers.add(m),l.connected&&m.push(l.connected),e&&i(l)}return{next(){let t=o.shift();if(t)return Promise.resolve({done:!1,value:t});if(c)return`error`in c?Promise.reject(c.error):Promise.resolve({done:!0,value:void 0});if(e?.signal?.aborted)return p(),Promise.resolve({done:!0,value:void 0});let n=Promise.withResolvers();return a.push(n),s||(s=!0,e?.signal?.addEventListener(`abort`,p,{once:!0}),h()),n.promise},return(){return f({}),Promise.resolve({done:!0,value:void 0})}}}}}}}var o=class extends Error{reason;name=`ClientError`;constructor(e,t){let n=t?.detail??(t?.cause instanceof Error?t.cause.message:void 0);super(n?`${e}: ${n}`:e,t),this.reason=e}};r({},{make:()=>c});var s=16777216;function c(e){let t=e.fetch??globalThis.fetch,n=(t,n)=>{let r=new URL(e.baseUrl);r.pathname.endsWith(`/`)||(r.pathname+=`/`);let i=new URL(t.path.slice(1),r);for(let[e,n]of Object.entries(t.query??{}))u(i.searchParams,e,n);let a=new Headers(e.headers);for(let[e,n]of Object.entries(t.headers??{}))n!=null&&a.set(e,String(n));for(let[e,t]of new Headers(n?.headers))a.set(e,t);return t.body!==void 0&&!a.has(`content-type`)&&a.set(`content-type`,t.binaryBody?`application/octet-stream`:`application/json`),{url:i,init:{method:t.method,signal:n?.signal,headers:a,body:t.body===void 0?void 0:t.binaryBody?t.body:JSON.stringify(t.body)}}},r=async(e,r)=>{try{let i=n(e,r);return await t(i.url,i.init)}catch(e){throw new o(`Transport`,{cause:e})}},i=async(e,t)=>{if(t.declaredStatuses.includes(e.status))throw f(await d(e));try{await e.body?.cancel()}catch{}throw new o(`UnexpectedStatus`,{cause:{status:e.status},detail:String(e.status)})},a=async(e,t)=>{let n=await r(e,t);if(n.status!==e.successStatus)return i(n,e);if(e.binary)return new Uint8Array(await n.arrayBuffer());if(e.empty){try{await n.body?.cancel()}catch{}return}return await d(n)},c=(e,t)=>({async*[Symbol.asyncIterator](){let n=await r(e,t);if(n.status!==e.successStatus&&await i(n,e),!p(n,`text/event-stream`)){try{await n.body?.cancel()}catch{}throw new o(`UnsupportedContentType`,{detail:n.headers.get(`content-type`)})}if(n.body===null)throw new o(`MalformedResponse`);let a=n.body.getReader(),c=new TextDecoder,l=``;try{for(;;){let e;try{e=await a.read()}catch(e){throw new o(`Transport`,{cause:e})}if(e.done||t?.onActivity?.(),l+=c.decode(e.value,{stream:!e.done}),l.length>s)throw new o(`SseEventTooLarge`);let n=!e.done&&l.endsWith(`\r`);n&&(l=l.slice(0,-1)),l=l.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).replaceAll(`\r`,`
|
|
4
|
+
`),n&&(l+=`\r`),e.done&&l!==``&&(l+=`
|
|
5
|
+
|
|
6
|
+
`);let r=l.indexOf(`
|
|
7
|
+
|
|
8
|
+
`);for(;r>=0;){let e=l.slice(0,r);l=l.slice(r+2);let t=e.split(`
|
|
9
|
+
`).flatMap(e=>e.startsWith(`data:`)?[e.slice(5).trimStart()]:[]).join(`
|
|
10
|
+
`);if(t!==``)try{yield JSON.parse(t)}catch(e){throw new o(`MalformedResponse`,{cause:e})}r=l.indexOf(`
|
|
11
|
+
|
|
12
|
+
`)}if(e.done)return}}finally{try{await a.cancel()}catch{}a.releaseLock()}}});return{server:{info:e=>a({method:`GET`,path:`/api/info`,successStatus:200,declaredStatuses:[400,401],empty:!1},e),pair:e=>a({method:`POST`,path:`/api/pair`,successStatus:200,declaredStatuses:[400,401],empty:!1},e),connect:(e,t)=>a({method:`GET`,path:`/auth/connect/${encodeURIComponent(e.code)}`,successStatus:200,declaredStatuses:[400,401],empty:!1},t)},location:{get:(e,t)=>a({method:`GET`,path:`/api/location`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),reload:e=>a({method:`POST`,path:`/api/location/reload`,successStatus:204,declaredStatuses:[400,401,503],empty:!0},e)},agent:{list:(e,t)=>a({method:`GET`,path:`/api/agent`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>a({method:`GET`,path:`/api/agent/${encodeURIComponent(e.agentID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},plugin:{list:(e,t)=>a({method:`GET`,path:`/api/plugin`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),gui:(e,t)=>a({method:`GET`,path:`/api/plugin/gui`,query:{location:e.location,id:e.id},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),check:(e,t)=>a({method:`POST`,path:`/api/plugin/check`,query:{location:e?.location},body:{target:e?.target},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>a({method:`POST`,path:`/api/plugin/update`,query:{location:e.location},body:{targets:e.targets},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t)},session:{list:(e,t)=>a({method:`GET`,path:`/api/session`,query:{limit:e?.limit,order:e?.order,search:e?.search,parentID:e?.parentID,archived:e?.archived,directory:e?.directory,project:e?.project,subpath:e?.subpath,cursor:e?.cursor},successStatus:200,declaredStatuses:[400,401],empty:!1},t),stats:(e,t)=>a({method:`GET`,path:`/api/experimental/session/stats`,query:{from:e?.from,to:e?.to,project:e?.project,timezone:e?.timezone,tools:e?.tools},successStatus:200,declaredStatuses:[400,401],empty:!1},t).then(e=>e.data),create:(e,t)=>a({method:`POST`,path:`/api/session`,body:{id:e?.id,parentID:e?.parentID,title:e?.title,agent:e?.agent,model:e?.model,location:e?.location,metadata:e?.metadata,permissions:e?.permissions},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),import:(e,t)=>a({method:`POST`,path:`/api/experimental/session/import`,body:{info:e.info,messages:e.messages,location:e.location},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),export:(e,t)=>a({method:`GET`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/export`,query:{sanitize:e.sanitize},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then(e=>e.data),active:e=>a({method:`GET`,path:`/api/session/active`,successStatus:200,declaredStatuses:[400,401],empty:!1},e).then(e=>e.data),get:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),remove:(e,t)=>a({method:`DELETE`,path:`/api/session/${encodeURIComponent(e.sessionID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),fork:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/fork`,body:{before:e.before},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),switchAgent:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/agent`,body:{agent:e.agent},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),switchModel:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/model`,body:{model:e.model},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>a({method:`PATCH`,path:`/api/session/${encodeURIComponent(e.sessionID)}`,body:{title:e.title,metadata:e.metadata,permissions:e.permissions,archived:e.archived},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),move:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/move`,body:{directory:e.directory,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),prompt:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/prompt`,body:{id:e.id,text:e.text,files:e.files,agents:e.agents,skills:e.skills,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),command:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/command`,body:{name:e.name,text:e.text,files:e.files,agents:e.agents,skills:e.skills,delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,500],empty:!0},t),skill:(e,t)=>a({method:`POST`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/skill`,body:{id:e.id,resume:e.resume},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),synthetic:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/synthetic`,body:{id:e.id,text:e.text,description:e.description,metadata:e.metadata,delivery:e.delivery,resume:e.resume},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),shell:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/shell`,body:{id:e.id,command:e.command},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),compact:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/compact`,body:{id:e.id,delivery:e.delivery},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),wait:(e,t)=>a({method:`POST`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/wait`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),revert:{stage:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/stage`,body:{messageID:e.messageID,files:e.files},successStatus:200,declaredStatuses:[400,401,404,409,500],empty:!1},t).then(e=>e.data),clear:(e,t)=>a({method:`DELETE`,path:`/api/session/${encodeURIComponent(e.sessionID)}/revert`,successStatus:204,declaredStatuses:[400,401,404,409,500],empty:!0},t),commit:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/revert/commit`,successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},context:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/context`,successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then(e=>e.data),diff:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/diff`,query:{from:e.from,to:e.to,context:e.context},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t).then(e=>e.data),inbox:{list:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),cancel:(e,t)=>a({method:`DELETE`,path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),update:(e,t)=>a({method:`PATCH`,path:`/api/session/${encodeURIComponent(e.sessionID)}/inbox/${encodeURIComponent(e.inboxID)}`,body:{delivery:e.delivery},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},instructions:{entry:{list:(e,t)=>a({method:`GET`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),put:(e,t)=>a({method:`PUT`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,body:{value:e.value},successStatus:204,declaredStatuses:[400,401,404,413],empty:!0},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/instructions/entries/${encodeURIComponent(e.key)}`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},generate:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/generate`,body:{prompt:e.prompt},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then(e=>e.data),log:(e,t)=>c({method:`GET`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/log`,query:{after:e.after,follow:e.follow},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),interrupt:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/interrupt`,query:{resume:e.resume},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),background:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/background`,successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),message:{get:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/message/${encodeURIComponent(e.messageID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data)},form:{list:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),create:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/form`,body:{id:e.id,title:e.title,metadata:e.metadata,fields:e.fields},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),get:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),reply:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}/reply`,body:{answer:e.answer},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t),cancel:(e,t)=>a({method:`DELETE`,path:`/api/session/${encodeURIComponent(e.sessionID)}/form/${encodeURIComponent(e.formID)}`,query:{message:e.message},successStatus:204,declaredStatuses:[400,401,404,409],empty:!0},t)},environment:(e,t)=>a({method:`PUT`,path:`/api/session/${encodeURIComponent(e.sessionID)}/environment`,body:{variables:e.variables},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),view:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/view`,body:{idle:e.idle},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},message:{list:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/message`,query:{limit:e.limit,order:e.order,cursor:e.cursor,type:e.type},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},model:{list:(e,t)=>a({method:`GET`,path:`/api/model`,query:{location:e?.location,types:e?.types},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),default:(e,t)=>a({method:`GET`,path:`/api/model/default`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},generate:{text:(e,t)=>a({method:`POST`,path:`/api/experimental/generate/text`,body:{prompt:e.prompt,model:e.model},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then(e=>e.data),image:(e,t)=>a({method:`POST`,path:`/api/experimental/generate/image`,body:{model:e.model,prompt:e.prompt,images:e.images,n:e.n,aspect:e.aspect,resolution:e.resolution},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then(e=>e.data),decisions:(e,t)=>a({method:`POST`,path:`/api/experimental/generate/decisions`,body:{model:e.model,input:e.input,questions:e.questions},successStatus:200,declaredStatuses:[400,401,404,422,502,503],empty:!1},t).then(e=>e.data)},voice:{models:e=>a({method:`GET`,path:`/api/experimental/voice/models`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},e).then(e=>e.data),session:(e,t)=>a({method:`POST`,path:`/api/experimental/voice/session`,body:{model:e.model,session:e.session,transport:e.transport},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then(e=>e.data)},provider:{list:(e,t)=>a({method:`GET`,path:`/api/provider`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),get:(e,t)=>a({method:`GET`,path:`/api/provider/${encodeURIComponent(e.providerID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},integration:{list:(e,t)=>a({method:`GET`,path:`/api/integration`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>a({method:`GET`,path:`/api/integration/${encodeURIComponent(e.integrationID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),wellknown:{add:(e,t)=>a({method:`POST`,path:`/api/experimental/integration/wellknown`,query:{location:e.location},body:{url:e.url},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},connect:{key:(e,t)=>a({method:`POST`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/key`,query:{location:e.location},body:{key:e.key,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),external:(e,t)=>a({method:`POST`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/external`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},oauth:{connect:(e,t)=>a({method:`POST`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth`,query:{location:e.location},body:{methodID:e.methodID,answer:e.answer,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>a({method:`GET`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),complete:(e,t)=>a({method:`POST`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}/complete`,query:{location:e.location},body:{code:e.code},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),cancel:(e,t)=>a({method:`DELETE`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/oauth/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},command:{connect:(e,t)=>a({method:`POST`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command`,query:{location:e.location},body:{methodID:e.methodID,label:e.label},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),status:(e,t)=>a({method:`GET`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),cancel:(e,t)=>a({method:`DELETE`,path:`/api/integration/${encodeURIComponent(e.integrationID)}/connect/command/${encodeURIComponent(e.attemptID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}},mcp:{list:(e,t)=>a({method:`GET`,path:`/api/mcp`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),add:(e,t)=>a({method:`PUT`,path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},body:{config:e.config},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/experimental/mcp/${encodeURIComponent(e.server)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:(e,t)=>a({method:`POST`,path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/connect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),disconnect:(e,t)=>a({method:`POST`,path:`/api/experimental/mcp/${encodeURIComponent(e.server)}/disconnect`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),resource:{catalog:(e,t)=>a({method:`GET`,path:`/api/mcp/resource`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},client:{token:(e,t)=>a({method:`POST`,path:`/api/experimental/client-mcp/token`,query:{location:e.location,name:e.name},headers:{"x-opencode-ticket":e[`x-opencode-ticket`]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},credential:{list:e=>a({method:`GET`,path:`/api/credential`,successStatus:200,declaredStatuses:[400,401],empty:!1},e).then(e=>e.data),create:(e,t)=>a({method:`POST`,path:`/api/credential`,body:{id:e.id,integrationID:e.integrationID,label:e.label,value:e.value,activate:e.activate},successStatus:200,declaredStatuses:[400,401,409],empty:!1},t).then(e=>e.data),update:(e,t)=>a({method:`PATCH`,path:`/api/credential/${encodeURIComponent(e.credentialID)}`,body:{label:e.label},successStatus:204,declaredStatuses:[400,401],empty:!0},t),activate:(e,t)=>a({method:`POST`,path:`/api/credential/${encodeURIComponent(e.credentialID)}/activate`,successStatus:204,declaredStatuses:[400,401],empty:!0},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/credential/${encodeURIComponent(e.credentialID)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},project:{list:(e,t)=>a({method:`GET`,path:`/api/project`,query:{archived:e?.archived},successStatus:200,declaredStatuses:[400,401],empty:!1},t),update:(e,t)=>a({method:`PATCH`,path:`/api/project/${encodeURIComponent(e.projectID)}`,body:{canonical:e.canonical,name:e.name,icon:e.icon,commands:e.commands},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},form:{list:(e,t)=>a({method:`GET`,path:`/api/form`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},permission:{request:{list:(e,t)=>a({method:`GET`,path:`/api/permission/request`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},saved:{list:(e,t)=>a({method:`GET`,path:`/api/permission/saved`,query:{projectID:e?.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),update:(e,t)=>a({method:`PATCH`,path:`/api/permission/saved/${encodeURIComponent(e.id)}`,body:{action:e.action,resource:e.resource},successStatus:200,declaredStatuses:[400,401,404,409],empty:!1},t).then(e=>e.data),remove:(e,t)=>a({method:`DELETE`,path:`/api/permission/saved/${encodeURIComponent(e.id)}`,successStatus:204,declaredStatuses:[400,401],empty:!0},t)},create:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,body:{id:e.id,action:e.action,resources:e.resources,save:e.save,metadata:e.metadata,source:e.source,agent:e.agent},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),list:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/permission`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),get:(e,t)=>a({method:`GET`,path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},t).then(e=>e.data),reply:(e,t)=>a({method:`POST`,path:`/api/session/${encodeURIComponent(e.sessionID)}/permission/${encodeURIComponent(e.requestID)}/reply`,body:{decision:e.decision,message:e.message},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},file:{read:(e,t)=>a({method:`GET`,path:`/api/fs/read/${l(e.path)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t),list:(e,t)=>a({method:`GET`,path:`/api/fs/list`,query:{location:e?.location,path:e?.path},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),find:(e,t)=>a({method:`GET`,path:`/api/fs/find`,query:{location:e.location,query:e.query,type:e.type,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),write:(e,t)=>a({method:`POST`,path:`/api/experimental/fs/write`,query:{location:e.location,path:e.path},body:e.payload,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binaryBody:!0},t),watch:(e,t)=>a({method:`POST`,path:`/api/experimental/fs/watch`,query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),unwatch:(e,t)=>a({method:`DELETE`,path:`/api/experimental/fs/watch`,query:{location:e.location},body:{path:e.path},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},command:{list:(e,t)=>a({method:`GET`,path:`/api/command`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},skill:{list:(e,t)=>a({method:`GET`,path:`/api/skill`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},rpc:{call:(e,t)=>a({method:`POST`,path:`/api/rpc/${encodeURIComponent(e.rpcID)}/${encodeURIComponent(e.method)}`,query:{location:e.location},body:{input:e.input},successStatus:200,declaredStatuses:[400,401,404,500],empty:!1},t)},event:{subscribe:(e,t)=>c({method:`GET`,path:`/api/event`,query:{types:e?.types},successStatus:200,declaredStatuses:[400,401],empty:!1},t)},pty:{list:(e,t)=>a({method:`GET`,path:`/api/pty`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>a({method:`POST`,path:`/api/pty`,query:{location:e?.location},body:{command:e?.command,args:e?.args,cwd:e?.cwd,title:e?.title,env:e?.env},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>a({method:`GET`,path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),update:(e,t)=>a({method:`PUT`,path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},body:{title:e.title,size:e.size},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/pty/${encodeURIComponent(e.ptyID)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),connect:{token:(e,t)=>a({method:`POST`,path:`/api/pty/${encodeURIComponent(e.ptyID)}/connect-token`,query:{location:e.location},headers:{"x-opencode-ticket":e[`x-opencode-ticket`]},successStatus:200,declaredStatuses:[400,401,403,404],empty:!1},t)}},experimental:{persistentPty:{read:(e,t)=>a({method:`GET`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal/read`,query:{lines:e.lines},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then(e=>e.data),list:(e,t)=>a({method:`GET`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then(e=>e.data),create:(e,t)=>a({method:`POST`,path:`/api/experimental/session/${encodeURIComponent(e.sessionID)}/terminal`,body:{command:e.command,args:e.args,cwd:e.cwd,title:e.title,env:e.env,size:e.size},successStatus:200,declaredStatuses:[400,401,503],empty:!1},t).then(e=>e.data),shutdown:e=>a({method:`POST`,path:`/api/experimental/persistent-pty/shutdown`,successStatus:204,declaredStatuses:[400,401,503],empty:!0},e),handoff:e=>a({method:`POST`,path:`/api/experimental/persistent-pty/handoff`,successStatus:200,declaredStatuses:[400,401,503],empty:!1},e),get:(e,t)=>a({method:`GET`,path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then(e=>e.data),update:(e,t)=>a({method:`PUT`,path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,body:{attachmentID:e.attachmentID,size:e.size},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then(e=>e.data),snapshot:(e,t)=>a({method:`GET`,path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/snapshot`,successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t).then(e=>e.data),remove:(e,t)=>a({method:`DELETE`,path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}`,successStatus:204,declaredStatuses:[400,401,404,503],empty:!0},t),connectToken:(e,t)=>a({method:`POST`,path:`/api/experimental/persistent-pty/${encodeURIComponent(e.ptyID)}/connect-token`,headers:{"x-opencode-ticket":e[`x-opencode-ticket`]},successStatus:200,declaredStatuses:[400,401,403,404,503],empty:!1},t).then(e=>e.data)},media:{get:(e,t)=>a({method:`GET`,path:`/api/experimental/media/${encodeURIComponent(e.hash)}`,successStatus:200,declaredStatuses:[400,401,404],empty:!1,binary:!0},t)}},shell:{list:(e,t)=>a({method:`GET`,path:`/api/shell`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>a({method:`POST`,path:`/api/shell`,query:{location:e.location},body:{command:e.command,cwd:e.cwd,timeout:e.timeout,metadata:e.metadata},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),get:(e,t)=>a({method:`GET`,path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),output:(e,t)=>a({method:`GET`,path:`/api/shell/${encodeURIComponent(e.id)}/output`,query:{location:e.location,cursor:e.cursor,limit:e.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/shell/${encodeURIComponent(e.id)}`,query:{location:e.location},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},reference:{list:(e,t)=>a({method:`GET`,path:`/api/reference`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},worktree:{list:(e,t)=>a({method:`GET`,path:`/api/worktree`,query:{projectID:e.projectID},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),create:(e,t)=>a({method:`POST`,path:`/api/worktree`,body:{projectID:e.projectID,from:e.from,branch:e.branch,directory:e.directory,name:e.name},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),remove:(e,t)=>a({method:`DELETE`,path:`/api/worktree`,body:{projectID:e.projectID,directory:e.directory,force:e.force},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t),refresh:(e,t)=>a({method:`POST`,path:`/api/worktree/refresh`,body:{projectID:e.projectID},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)},vcs:{init:(e,t)=>a({method:`POST`,path:`/api/vcs/init`,query:{location:e?.location,provider:e?.provider},successStatus:204,declaredStatuses:[400,401,404,409,501,503],empty:!0},t),get:(e,t)=>a({method:`GET`,path:`/api/vcs`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),base:(e,t)=>a({method:`GET`,path:`/api/vcs/base`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),status:(e,t)=>a({method:`GET`,path:`/api/vcs/status`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),branch:{list:(e,t)=>a({method:`GET`,path:`/api/vcs/branch`,query:{location:e?.location,search:e?.search,limit:e?.limit},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t)},diff:(e,t)=>a({method:`GET`,path:`/api/vcs/diff`,query:{location:e.location,mode:e.mode,base:e.base,context:e.context,untracked:e.untracked},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},debug:{heapDump:(e,t)=>a({method:`POST`,path:`/api/debug/heap-dump`,query:{directory:e?.directory},successStatus:200,declaredStatuses:[400,401,500],empty:!1},t),location:{list:e=>a({method:`GET`,path:`/api/debug/location`,successStatus:200,declaredStatuses:[400,401],empty:!1},e),evict:(e,t)=>a({method:`DELETE`,path:`/api/debug/location`,query:{location:e?.location},successStatus:204,declaredStatuses:[400,401],empty:!0},t)}},migration:{v1:{status:e=>a({method:`GET`,path:`/api/experimental/migration/v1`,successStatus:200,declaredStatuses:[400,401],empty:!1},e)}},websearch:{providers:(e,t)=>a({method:`GET`,path:`/api/websearch/provider`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t),query:(e,t)=>a({method:`POST`,path:`/api/websearch`,query:{location:e.location},body:{query:e.query,providerID:e.providerID},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},usage:{limits:(e,t)=>a({method:`GET`,path:`/api/experimental/usage/limits`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404,503],empty:!1},t)},config:{get:(e,t)=>a({method:`GET`,path:`/api/config`,query:{location:e?.location},successStatus:200,declaredStatuses:[400,401,404],empty:!1},t),shells:e=>a({method:`GET`,path:`/api/config/shell`,successStatus:200,declaredStatuses:[400,401,404],empty:!1},e),update:(e,t)=>a({method:`PATCH`,path:`/api/experimental/config`,body:{shell:e.shell},successStatus:204,declaredStatuses:[400,401,404],empty:!0},t)}}}function l(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function u(e,t,n){if(n!==void 0){if(n===null){e.append(t,`null`);return}if(Array.isArray(n)){for(let r of n)u(e,t,r);return}if(typeof n==`object`){for(let[r,i]of Object.entries(n))u(e,`${t}[${r}]`,i);return}e.append(t,String(n))}}async function d(e){if(!p(e,`application/json`)&&!e.headers.get(`content-type`)?.includes(`+json`)){try{await e.body?.cancel()}catch{}throw new o(`UnsupportedContentType`,{detail:e.headers.get(`content-type`)})}let t;try{t=await e.text()}catch(e){throw new o(`Transport`,{cause:e})}if(t===``)throw new o(`MalformedResponse`);try{return JSON.parse(t)}catch(e){throw new o(`MalformedResponse`,{cause:e})}}function f(e){let t=Object.assign(Error(e.message??e.data?.message),e);return e._tag&&(t.name=e._tag),t}function p(e,t){return e.headers.get(`content-type`)?.split(`;`,1)[0]?.trim().toLowerCase()===t}var m=e=>typeof e==`object`&&!!e&&`_tag`in e&&e._tag===`PermissionNotFoundError`,h=e=>typeof e==`object`&&!!e&&`_tag`in e&&e._tag===`RpcError`,g=e=>typeof e==`object`&&!!e&&`_tag`in e&&e._tag===`RpcInternalError`;function _(e,t){return n=>{let r=(e,r)=>{if(!Object.hasOwn(n.events,e))throw Error(`Unknown RPC event: ${n.id}.${e}`);let i=v(n,e);return{[Symbol.asyncIterator](){let e=new AbortController,n=r?.signal?AbortSignal.any([e.signal,r.signal]):e.signal,a=async function*(){try{for await(let e of t.subscribe({signal:n})){if(n.aborted)return;e.type===i&&(yield e)}}catch(e){if(!n.aborted)throw e}finally{e.abort()}}();return{next:()=>a.next(),return:()=>(e.abort(),a.return())}}}};return Object.assign(Object.fromEntries(Object.keys(n.methods).map(t=>[t,async(r,i)=>{try{return(await e.rpc.call({rpcID:n.id,method:t,input:r,location:i?.location},{signal:i?.signal,headers:i?.headers})).output}catch(e){throw!h(e)&&!g(e)?e:e.data===void 0?{type:e.type,message:e.message}:{type:e.type,message:e.message,data:e.data}}}])),{events:{subscribe:r,on:(e,t,n)=>{let i=new AbortController,a=n?.signal?AbortSignal.any([i.signal,n.signal]):i.signal,o=r(e,{signal:a});return(async()=>{for await(let e of o)await t(e)})().catch(e=>console.error(e)),()=>i.abort()}}})}}function v(e,t){return`rpc.${e.id}.${t}`}var y={};r(y,{OpenCode:()=>y,make:()=>b});function b(e){let t=c(e),n=a((e,n)=>t.event.subscribe(void 0,{signal:e,onActivity:n}));return{...t,rpc:Object.assign(_(t,n),t.rpc),event:n}}export{m as n,o as r,y as t};
|
package/dist/index.html
CHANGED
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
opacity: 0.72;
|
|
561
561
|
}
|
|
562
562
|
</style>
|
|
563
|
-
<script type="module" crossorigin src="/assets/main-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-BO2UnYBd.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -576,17 +576,17 @@
|
|
|
576
576
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
577
577
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
578
578
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
579
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
579
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
580
580
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
581
581
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
582
582
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
583
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
584
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
583
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
584
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
585
585
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.js">
|
|
586
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
587
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
588
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
589
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
586
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Du8LnIGl.js">
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
588
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
589
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
590
590
|
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
591
591
|
</head>
|
|
592
592
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-BpvsuSKB.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -90,17 +90,17 @@
|
|
|
90
90
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.js">
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
103
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Du8LnIGl.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
104
104
|
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
105
105
|
</head>
|
|
106
106
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-CyklTbWh.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -79,17 +79,17 @@
|
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/persistence-Dzooc9Xg.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-DW8THEMC.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-BFn1FsR3.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-XDI8AfPJ.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-CdqCAt40.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-C1k5nbWb.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
87
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
86
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-CCTs9UKZ.js">
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-DhXTmxps.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-DAOam_oV.js">
|
|
89
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
91
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Du8LnIGl.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-BCy22KX-.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C3EM05Jz.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CQ3TyMLm.js">
|
|
93
93
|
<link rel="stylesheet" crossorigin href="/assets/src-DlJVKekb.css">
|
|
94
94
|
</head>
|
|
95
95
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuriai/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@clack/prompts": "^1.1.0",
|
|
27
27
|
"@earendil-works/pi-agent-core": "0.84.4",
|
|
28
28
|
"@octokit/rest": "^22.0.1",
|
|
29
|
-
"@opencode/client": "2.0.23",
|
|
30
|
-
"@opencode/schema": "2.0.23",
|
|
29
|
+
"@opencode/client": "^2.0.23",
|
|
30
|
+
"@opencode/schema": "^2.0.23",
|
|
31
31
|
"@simplewebauthn/server": "13.3.1",
|
|
32
32
|
"adm-zip": "^0.5.16",
|
|
33
33
|
"better-sqlite3": "^12.10.0",
|
|
@@ -20,7 +20,7 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
20
20
|
connection shortcuts to exclude themselves without changing management lists.
|
|
21
21
|
- `plugins.js`: config entries and plugin-directory files are inventory, not compatibility checks. They do not synthesize `compatibility` or `compatible` fields; Settings uses the OpenCode runtime inventory for actual load status and errors.
|
|
22
22
|
- Reads native V2 `plugins` (strings or `{ package, options }`) with legacy `plugin`/tuple fallback. A native array, including an empty one, wins within each document. Entry mutations write only `plugins`, convert retained legacy tuples, and remove the shadowed legacy key in the touched source file. Options, ordering, unrelated configuration and JSONC comments are preserved through the shared atomic config writer; malformed entries or write failures do not replace the original file. Web, Electron and mobile use this host implementation; VS Code mirrors the same persistence contract.
|
|
23
|
-
- `session-directory-runtime.js`: Host-side physical directory identity for session index/list/detail/live projection. Uses a runtime-scoped, bounded 256-entry cache (60s success / 5s failed resolution), cleared when the upstream URL changes. Local directory lists use
|
|
23
|
+
- `session-directory-runtime.js`: Host-side physical directory identity for session index/list/detail/live projection. Uses a runtime-scoped, bounded 256-entry cache (60s success / 5s failed resolution), cleared when the upstream URL changes. Local directory lists use session pages and physical-directory filtering to include legacy symlink sessions without mixing worktrees; they never request `/location` to discover project identity. Startup backfill reads one global session stream rather than one stream per project. One request reads one page and preserves opaque cursors; consumers must follow continuations even after filtered-empty pages. Non-loopback upstreams keep their own path namespace.
|
|
24
24
|
- `packages/web/server/lib/opencode/index.js`: public entrypoint (currently baseline placeholder).
|
|
25
25
|
- `packages/web/server/lib/opencode/auth.js`: host-only authoritative provider credential API reads and deletion.
|
|
26
26
|
- `packages/web/server/lib/opencode/auth-state-runtime.js`: managed OpenCode server auth password/header runtime.
|
|
@@ -32,8 +32,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
32
32
|
- `packages/web/server/lib/opencode/v1-migration-gate.js`: pure V1→v2 migration admission gate (`GET /api/experimental/migration/v1` → whether transcript may be fetched).
|
|
33
33
|
- `packages/web/server/lib/opencode/managed-capabilities-runtime.js`: managed-child scheduled-task resources, config injection, rotating bridge identity, and bridge authorization.
|
|
34
34
|
- `packages/web/server/lib/opencode/env-runtime.js`: OpenCode CLI/binary resolution and shell environment runtime.
|
|
35
|
-
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists
|
|
36
|
-
- `packages/web/server/lib/opencode/upgrade-screen.js`: startup gate for the running OpenCode below `2.0.20`. Client/schema dependencies
|
|
35
|
+
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists. Registry lookup failures remain errors; verified cached installations can be reused offline. Never uses a packaged/bundled binary.
|
|
36
|
+
- `packages/web/server/lib/opencode/upgrade-screen.js`: startup gate for the running OpenCode below `2.0.20`. Client/schema dependencies accept compatible 2.x updates; fresh installations and required upgrades resolve latest stable 2.x at installation time. The compatible execution floor is independently `2.0.20` (credential API). An unreadable running version is unavailable even when the local CLI is compatible. `POST /api/opencode/install-required` upgrades the selected shared global CLI in place; other supported local installations use the owned-cache installer. Global upgrades do not persist a binary override, so subsequent launches still follow shell discovery. Success requires the running service to meet both the floor and selected target. External services are not replaced; compatible newer shared services are not automatically downgraded. Failure restores binary selection and reports `upgraded: false`, without claiming process or package-manager rollback.
|
|
37
37
|
- `packages/web/server/lib/opencode/env-config.js`: OpenCode-related environment variable parsing and validation (host/port/hostname).
|
|
38
38
|
- `packages/web/server/lib/opencode/hmr-state-runtime.js`: HMR-persistent runtime state initialization, auth-state bootstrap, and HMR sync helpers.
|
|
39
39
|
- `packages/web/server/lib/opencode/bootstrap-runtime.js`: base app bootstrap runtime for status/auth/tts/notification/Yuri route wiring.
|
|
@@ -111,8 +111,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
111
111
|
- `POST /api/opencode/upgrade` (ticket 12): upgrades the remote latest or explicitly targeted version. Shared services using a global CLI invoke that selected installation's `upgrade <version>` and verify its disk version; owned-cache installations download into `~/.config/yuri/opencode-cli/<version>/`. Shared services restart through the selected CLI entry path and adopt its registration again. Success requires fresh CLI/service version probes and runtime contract verification. Global upgrades never switch to an owned cache on failure. Arbitrary external servers, private processes using global CLI, and private bundled binaries return HTTP 409. Concurrent upgrades are single-flight (`operation` state). Active sessions do not block an explicitly requested upgrade or require additional confirmation. Failure restores binary selection and reports the failed phase; it cannot undo package-manager changes and does not claim process restoration.
|
|
112
112
|
- `GET /api/opencode/upgrade-status`: returns `currentVersion`/`serveVersion`/`cliVersion`, `targetVersion`/`latestVersion` (official npm `@opencode/cli` latest stable 2.x release), `supplySource`, `ownership`, `canManage`, `management`, `guidance`, `contract`, and `operation`. Official shared services report `ownership: 'shared-service'`, `processOwnership: 'shared'`, and `canManage: true`. `available` is true only when `canManage` and target > current; unmanaged global/external runtimes report `available: null` plus manual guidance. `update-discovery.js` shares one in-flight registry request per host, caches successful checks for five minutes and failed checks for thirty seconds, with a five-second request deadline. Failed registry checks return HTTP 500 with `available: null`, never a false up-to-date result. An upgrade without an explicit target resolves this same remote release. Shared Web/Electron/hosted-mobile/Capacitor clients check after startup, every five minutes while visible, on focus/reconnect, and on runtime changes; query results and dismissed notifications are scoped to the host. Successful upgrade already includes process restart and live version verification, so no second reload is needed.
|
|
113
113
|
- `GET /api/opencode/compatibility`: startup upgrade-screen status. `compatible` requires the running OpenCode 2.x at `2.0.20` or newer; older/invalid versions are `incompatible`; unreadable running versions are `unavailable`. External serves are not replaced.
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
- `POST /api/opencode/install-required`: resolves the latest stable 2.x release (never below the `2.0.20` floor), upgrades the selected shared global CLI or owned cache, and restarts through the existing lifecycle. Discovery failure does not install a historical fallback. `upgraded: true` requires live version verification. Concurrent installs are single-flight; failures remain errors. Compatibility status reports the minimum before installation resolves its actual target.
|
|
115
|
+
- `GET /api/opencode/contract`: runtime contract admission for the **running serve**. Reachability, auth, execution, migration, and CLI↔serve mismatch are separate. The `2.0.20` floor is independent of installation targets; compatible newer 2.x services remain admitted. The legacy `pinnedVersion` response field is null.
|
|
116
116
|
- `GET /api/opencode/health`: probes managed OpenCode `GET /api/info` (Basic auth, 4s timeout). `healthy` is reachability/version shape via `evaluateOpenCodeHealthBody` (admits official 2.x `ServerInfo` and classic `{ healthy: true, version }`; rejects 1.x / missing / `healthy: false`). Response also includes `executionAllowed`, `protocolCompatible`, and `contract` so clients do not treat health success as full execution semantics. Upstream non-OK responses pass through status with `{ healthy: false, error, contract }`; transport failures return HTTP 503.
|
|
117
117
|
- `GET /api/opencode/version`: serve + CLI versions, mismatch flag, and contract snapshot
|
|
118
118
|
- `POST /api/opencode/directory`
|
|
@@ -145,12 +145,12 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
145
145
|
- Native `session.execution.started/succeeded/failed/interrupted` and `session.retry.scheduled` feed the same status/activity/attention transitions. Shutdown interruption retains busy ownership; other terminal events settle idle. `extractSessionStatusUpdate` is shared by Host forwarding, index ingestion and Goal timer handling so retry metadata and shutdown semantics stay aligned.
|
|
146
146
|
|
|
147
147
|
## Public exports (opencode2-pin.js)
|
|
148
|
-
- `
|
|
148
|
+
- `MINIMUM_OPENCODE2_VERSION`: compatibility floor, not an installation pin.
|
|
149
149
|
- `OPENCODE2_NPM_PACKAGE`: `@opencode/cli` (global install that ships the official `opencode` v2 binary; not 1.x `opencode-ai`).
|
|
150
150
|
- `parseOpenCode2VersionOutput(stdout)` / `compareOpenCode2Versions(left, right)` / `isOpenCode2VersionAtLeast(version, minimum)`: CLI `--version` parse and pin comparison.
|
|
151
151
|
- `openCode2BinaryName(platform)` / `npmPackageForOpenCode2(platform, arch)`: staged binary name `opencode` (`opencode.exe` on Windows) and official platform package `@opencode/cli-<os>-<arch>[-baseline]`.
|
|
152
152
|
- `isOpenCode1xVersion(value)` / `isAcceptableOpenCode2HealthVersion(value)` / `evaluateOpenCodeHealthBody(body)`: health admission accepts only 2.x. 1.x, `0.x` pre-2 binaries, and missing/unknown versions are rejected even when `healthy: true`.
|
|
153
|
-
- `resolveOpenCode2UpgradeTarget(target)` / `rejectOpenCode1xUpgradeTarget(target)`:
|
|
153
|
+
- `resolveOpenCode2UpgradeTarget(target)` / `rejectOpenCode1xUpgradeTarget(target)`: require a resolved upgrade target and refuse 1.x; no historical default.
|
|
154
154
|
|
|
155
155
|
## Public exports (runtime-contract.js)
|
|
156
156
|
- Pure admission matrix. `RUNTIME_CONTRACT_MIN_VERIFIED` (`2.0.20`) is the documented 2.x floor, shared with the startup gate through `MINIMUM_OPENCODE2_VERSION`; the VS Code sidecar mirrors this floor. Capabilities include `core.protocol`, `session.prompt`, `session.queuedInput`, `session.background`, `session.generationFallback`, `migration.v1Read`.
|
|
@@ -167,8 +167,8 @@ This module provides OpenCode server integration utilities for the web server ru
|
|
|
167
167
|
- `buildUpgradeStatusSnapshot` / `evaluateOwnedUpgradeResult` / `createUpgradeOperationState` / `resolveOwnedCacheBinaryPath`.
|
|
168
168
|
|
|
169
169
|
## Public exports (ensure-cli.js)
|
|
170
|
-
- `ensurePinnedOpenCode2Cli({ discoveredPath, pin, autoInstall, install, readVersion })`: reuse any discovered acceptable 2.x CLI (official name `opencode`), then the newest verified owned cache. Only a fresh installation queries the stable 2.x release via `update-discovery.js`;
|
|
171
|
-
- `installPinnedOpenCode2Cli(options)`: download `@opencode/cli-<os>-<arch
|
|
170
|
+
- `ensurePinnedOpenCode2Cli({ discoveredPath, pin, autoInstall, install, readVersion })`: reuse any discovered acceptable 2.x CLI (official name `opencode`), then the newest verified owned cache. Only a fresh installation queries the stable 2.x release via `update-discovery.js`; the optional explicit `pin` remains an override, not a product default. Registry errors propagate without a historical fallback. Downloads stay under `~/.config/yuri/opencode-cli/<version>/opencode`. `YURI_OPENCODE2_AUTO_INSTALL=0` disables download (`OPENCODE_CLI_MISSING`).
|
|
171
|
+
- `installPinnedOpenCode2Cli(options)`: resolve latest stable 2.x unless a concrete version was supplied, download its `@opencode/cli-<os>-<arch>` package, extract, copy as `opencode`, chmod, verify `--version` against the resolved version.
|
|
172
172
|
- `installedOpenCode2BinaryPath(version)` / `installedOpenCode2BinaryCandidates(options)` / `readOpenCode2BinaryVersion(path)` / `isOpenCode2AutoInstallEnabled()`. Cache candidates are stable 2.x directories ordered by numeric version, so an offline restart discovers a newer installation rather than reverting to the packaged pin.
|
|
173
173
|
- `terminal-path.js` exposes owned-cache CLIs to new terminals on installation/reuse. It writes an idempotent source line to zsh `.zprofile`/`.zshrc` (including `ZDOTDIR`), bash `.bashrc` and the active login profile, POSIX `.profile`, or fish `config.fish`. The sourced file in the Yuri data directory selects the verified executable directory. Windows updates only user PATH, retaining unrelated entries, broadcasts the environment change, and records `opencode-path.windows` in the data directory. Subsequent owned-cache upgrades refresh an existing terminal integration after binary verification. Existing global installations do not trigger shell edits. PATH-setup failure warns and keeps the working Yuri runtime; a later startup retries. Existing terminal processes need a new shell, and shell-file changes already completed before a failure are retained.
|
|
174
174
|
- `upgradeSelectedOpenCodeCli({ binaryPath, version, launchSpec, env })`: runs the selected CLI's official `upgrade <version>` without a shell, with a five-minute deadline and bounded captured output. Returns the original CLI entry path, preserving Homebrew symlinks. Windows launch specs unwrap native/runtime shims; unresolved batch wrappers require terminal upgrade instead of spawning console grandchildren. Child output is not returned or logged. Package-manager failures never fall back to another installation; callers verify the original entry's version before restarting. Package-manager file changes cannot be rolled back by restoring Yuri's binary selection.
|
|
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
import { createOpenCodeUpdateDiscovery } from './update-discovery.js';
|
|
6
6
|
import { configureOpenCodeTerminalPath } from './terminal-path.js';
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
MINIMUM_OPENCODE2_VERSION,
|
|
9
9
|
compareOpenCode2Versions,
|
|
10
10
|
isAcceptableOpenCode2HealthVersion,
|
|
11
11
|
isOpenCode2VersionAtLeast,
|
|
@@ -54,7 +54,7 @@ export function resolveYuriDataDir(env = process.env, homedir = os.homedir) {
|
|
|
54
54
|
return path.join(home, '.config', 'yuri');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function installedOpenCode2BinaryPath(version =
|
|
57
|
+
export function installedOpenCode2BinaryPath(version = MINIMUM_OPENCODE2_VERSION, options = {}) {
|
|
58
58
|
const dataDir = options.dataDir || resolveYuriDataDir(options.env, options.homedir);
|
|
59
59
|
return path.join(dataDir, 'opencode-cli', version, openCodeBinaryName(options.platform));
|
|
60
60
|
}
|
|
@@ -160,7 +160,10 @@ const findBinary = (root, binaryName) => {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
export async function installPinnedOpenCode2Cli(options = {}) {
|
|
163
|
-
const version = options.version ||
|
|
163
|
+
const version = options.version || await discoverLatestVersion();
|
|
164
|
+
if (!/^2\.\d+\.\d+$/.test(version) || (!options.version && !isOpenCode2VersionAtLeast(version))) {
|
|
165
|
+
throw new Error(`Invalid stable OpenCode installation target: ${version}`);
|
|
166
|
+
}
|
|
164
167
|
const platform = options.platform || process.platform;
|
|
165
168
|
const arch = options.arch || process.arch;
|
|
166
169
|
const dataDir = options.dataDir || resolveYuriDataDir(options.env, options.homedir);
|
|
@@ -239,10 +242,10 @@ export async function installPinnedOpenCode2Cli(options = {}) {
|
|
|
239
242
|
|
|
240
243
|
/**
|
|
241
244
|
* Reuse any discovered acceptable 2.x CLI. Fresh installs resolve stable 2.x;
|
|
242
|
-
*
|
|
245
|
+
* registry failures remain errors when no usable local installation exists.
|
|
243
246
|
*/
|
|
244
247
|
export async function ensurePinnedOpenCode2Cli(input = {}) {
|
|
245
|
-
const pin = input.pin ||
|
|
248
|
+
const pin = input.pin || MINIMUM_OPENCODE2_VERSION;
|
|
246
249
|
const discoveredPath = typeof input.discoveredPath === 'string' ? input.discoveredPath.trim() : '';
|
|
247
250
|
const autoInstall = input.autoInstall ?? isOpenCode2AutoInstallEnabled(input.env);
|
|
248
251
|
const readVersion = typeof input.readVersion === 'function'
|
|
@@ -276,20 +279,15 @@ export async function ensurePinnedOpenCode2Cli(input = {}) {
|
|
|
276
279
|
|
|
277
280
|
if (!autoInstall) {
|
|
278
281
|
const error = new Error(
|
|
279
|
-
|
|
282
|
+
'Unable to locate OpenCode 2. Set OPENCODE_BINARY or install @opencode/cli@2.',
|
|
280
283
|
);
|
|
281
284
|
error.code = 'OPENCODE_CLI_MISSING';
|
|
282
285
|
throw error;
|
|
283
286
|
}
|
|
284
287
|
|
|
285
|
-
|
|
286
|
-
if (!
|
|
287
|
-
|
|
288
|
-
const latest = await (input.resolveLatestVersion || discoverLatestVersion)();
|
|
289
|
-
if (/^2\.\d+\.\d+$/.test(latest) && isOpenCode2VersionAtLeast(latest, pin)) target = latest;
|
|
290
|
-
} catch {
|
|
291
|
-
console.warn('[OpenCode] Latest version lookup failed; using the tested fallback version.');
|
|
292
|
-
}
|
|
288
|
+
const target = input.pin || await (input.resolveLatestVersion || discoverLatestVersion)();
|
|
289
|
+
if (!/^2\.\d+\.\d+$/.test(target) || !isOpenCode2VersionAtLeast(target)) {
|
|
290
|
+
throw new Error(`Invalid stable OpenCode installation target: ${target}`);
|
|
293
291
|
}
|
|
294
292
|
const installedPath = await install({ ...input, version: target });
|
|
295
293
|
const version = readVersion(installedPath);
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
-
|
|
5
|
+
const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
6
6
|
import { configureOpenCodeTerminalPath } from './terminal-path.js';
|
|
7
7
|
import {
|
|
8
8
|
ensurePinnedOpenCode2Cli,
|
|
@@ -45,11 +45,11 @@ describe('ensurePinnedOpenCode2Cli', () => {
|
|
|
45
45
|
|
|
46
46
|
it.each(['1.18.4', '3.0.0', '2.9.1-beta.1', '2.0.1'])('never chooses an unsuitable fresh-install target %s', async (latest) => {
|
|
47
47
|
const install = vi.fn(async () => '/installed/opencode');
|
|
48
|
-
await ensurePinnedOpenCode2Cli({ dataDir: createTempDir('yuri-invalid-cli-'), install,
|
|
48
|
+
await expect(ensurePinnedOpenCode2Cli({ dataDir: createTempDir('yuri-invalid-cli-'), install,
|
|
49
49
|
resolveLatestVersion: async () => latest,
|
|
50
50
|
readVersion: (file) => file === '/installed/opencode' ? PINNED_OPENCODE2_VERSION : '',
|
|
51
|
-
});
|
|
52
|
-
expect(install).
|
|
51
|
+
})).rejects.toThrow('Invalid stable OpenCode installation target');
|
|
52
|
+
expect(install).not.toHaveBeenCalled();
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('reuses the newest verified cache offline instead of reinstalling the pin', async () => {
|
|
@@ -67,14 +67,14 @@ describe('ensurePinnedOpenCode2Cli', () => {
|
|
|
67
67
|
expect(resolveLatestVersion).not.toHaveBeenCalled();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
it('
|
|
70
|
+
it('reports registry failure without installing an obsolete fallback', async () => {
|
|
71
71
|
const dataDir = createTempDir('yuri-offline-cli-');
|
|
72
72
|
const install = vi.fn(async () => '/installed/opencode');
|
|
73
|
-
await ensurePinnedOpenCode2Cli({ dataDir, install,
|
|
73
|
+
await expect(ensurePinnedOpenCode2Cli({ dataDir, install,
|
|
74
74
|
resolveLatestVersion: async () => { throw new Error('offline'); },
|
|
75
75
|
readVersion: (file) => file === '/installed/opencode' ? PINNED_OPENCODE2_VERSION : '',
|
|
76
|
-
});
|
|
77
|
-
expect(install).
|
|
76
|
+
})).rejects.toThrow('offline');
|
|
77
|
+
expect(install).not.toHaveBeenCalled();
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('runs upgrade through the selected launch target and preserves its CLI entry path', async () => {
|
|
@@ -4,7 +4,7 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
6
|
import { createOpenCodeEnvRuntime } from './env-runtime.js';
|
|
7
|
-
|
|
7
|
+
const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
8
8
|
|
|
9
9
|
const originalOpencodeBinary = process.env.OPENCODE_BINARY;
|
|
10
10
|
const originalComSpec = process.env.ComSpec;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
export const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
1
|
+
// Runtime compatibility floor, independent of the latest stable installation target.
|
|
3
2
|
export const MINIMUM_OPENCODE2_VERSION = '2.0.20';
|
|
4
3
|
|
|
5
4
|
// Global npm/bun package that installs the opencode v2 binary (not 1.x opencode-ai).
|
|
@@ -66,7 +65,7 @@ export function resolveOpenCode2UpgradeTarget(target) {
|
|
|
66
65
|
rejectOpenCode1xUpgradeTarget(trimmed);
|
|
67
66
|
return trimmed;
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
throw new Error('Resolve a stable OpenCode 2.x version before upgrading');
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
@@ -134,7 +133,7 @@ export function compareOpenCode2Versions(left, right) {
|
|
|
134
133
|
return 0;
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
export function isOpenCode2VersionAtLeast(version, minimum =
|
|
136
|
+
export function isOpenCode2VersionAtLeast(version, minimum = MINIMUM_OPENCODE2_VERSION) {
|
|
138
137
|
if (!isAcceptableOpenCode2HealthVersion(version)) return false;
|
|
139
138
|
return compareOpenCode2Versions(version, minimum) >= 0;
|
|
140
139
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import {
|
|
3
3
|
OPENCODE2_NPM_PACKAGE,
|
|
4
|
-
PINNED_OPENCODE2_VERSION,
|
|
5
4
|
compareOpenCode2Versions,
|
|
6
5
|
evaluateOpenCodeHealthBody,
|
|
7
6
|
isAcceptableOpenCode2HealthVersion,
|
|
@@ -13,6 +12,8 @@ import {
|
|
|
13
12
|
resolveOpenCode2UpgradeTarget,
|
|
14
13
|
} from './opencode2-pin.js';
|
|
15
14
|
|
|
15
|
+
const PINNED_OPENCODE2_VERSION = '2.0.23';
|
|
16
|
+
|
|
16
17
|
describe('opencode2 pin (ticket 12)', () => {
|
|
17
18
|
it('rejects 1.x version strings and accepts the pinned v2', () => {
|
|
18
19
|
expect(isOpenCode1xVersion('1.18.4')).toBe(true);
|
|
@@ -25,11 +26,11 @@ describe('opencode2 pin (ticket 12)', () => {
|
|
|
25
26
|
expect(isOpenCode1xVersion(null)).toBe(false);
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
it('throws on 1.x upgrade targets
|
|
29
|
+
it('throws on 1.x or unresolved upgrade targets', () => {
|
|
29
30
|
expect(() => rejectOpenCode1xUpgradeTarget('1.18.4')).toThrow(/1\.x/);
|
|
30
31
|
expect(() => rejectOpenCode1xUpgradeTarget('1.18.4')).toThrow(expect.objectContaining({ code: 'OPENCODE_UPGRADE_1X_REFUSED' }));
|
|
31
|
-
expect(resolveOpenCode2UpgradeTarget(undefined)).
|
|
32
|
-
expect(resolveOpenCode2UpgradeTarget('')).
|
|
32
|
+
expect(() => resolveOpenCode2UpgradeTarget(undefined)).toThrow('Resolve a stable');
|
|
33
|
+
expect(() => resolveOpenCode2UpgradeTarget('')).toThrow('Resolve a stable');
|
|
33
34
|
expect(resolveOpenCode2UpgradeTarget(PINNED_OPENCODE2_VERSION)).toBe(PINNED_OPENCODE2_VERSION);
|
|
34
35
|
expect(() => resolveOpenCode2UpgradeTarget('1.18.18')).toThrow(/1\.x/);
|
|
35
36
|
});
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
import path from 'node:path';
|
|
16
16
|
import {
|
|
17
|
-
PINNED_OPENCODE2_VERSION,
|
|
18
17
|
compareOpenCode2Versions,
|
|
19
18
|
isOpenCode1xVersion,
|
|
20
19
|
resolveOpenCode2UpgradeTarget,
|
|
@@ -176,15 +175,9 @@ export function buildUpgradeStatusSnapshot(input) {
|
|
|
176
175
|
const serveVersion = normalizeRuntimeVersion(input.serveVersion);
|
|
177
176
|
const cliVersion = normalizeRuntimeVersion(input.cliVersion);
|
|
178
177
|
const currentVersion = serveVersion || cliVersion;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
} catch {
|
|
183
|
-
targetVersion = PINNED_OPENCODE2_VERSION;
|
|
184
|
-
}
|
|
185
|
-
if (isOpenCode1xVersion(targetVersion)) {
|
|
186
|
-
targetVersion = PINNED_OPENCODE2_VERSION;
|
|
187
|
-
}
|
|
178
|
+
const targetVersion = input.targetVersion
|
|
179
|
+
? resolveOpenCode2UpgradeTarget(input.targetVersion)
|
|
180
|
+
: null;
|
|
188
181
|
|
|
189
182
|
const contract = input.contract || evaluateRuntimeContract({
|
|
190
183
|
serveVersion,
|
|
@@ -201,7 +194,7 @@ export function buildUpgradeStatusSnapshot(input) {
|
|
|
201
194
|
&& !isOpenCode1xVersion(currentVersion)
|
|
202
195
|
&& compareOpenCode2Versions(targetVersion, currentVersion) > 0,
|
|
203
196
|
);
|
|
204
|
-
const available = canManage &&
|
|
197
|
+
const available = canManage && targetVersion ? newerTarget : null;
|
|
205
198
|
|
|
206
199
|
/** @type {string | null} */
|
|
207
200
|
let reason = ownership.reason;
|
|
@@ -56,6 +56,10 @@ describe('owned runtime upgrade (ticket 12)', () => {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('upgrade-status exposes manage rights and manual guidance', () => {
|
|
59
|
+
expect(buildUpgradeStatusSnapshot({
|
|
60
|
+
ownership: classifyRuntimeOwnership({ binarySource: 'installed', binaryPath: ownedBinary, dataDir }),
|
|
61
|
+
serveVersion: '2.2.0',
|
|
62
|
+
})).toMatchObject({ available: null, targetVersion: null });
|
|
59
63
|
const globalStatus = buildUpgradeStatusSnapshot({
|
|
60
64
|
ownership: classifyRuntimeOwnership({ isExternal: false, binarySource: 'path' }),
|
|
61
65
|
serveVersion: '2.0.12',
|
|
@@ -285,6 +285,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
285
285
|
isSharedService: () => getIsSharedOpenCodeService() === true,
|
|
286
286
|
install: (options) => installPinnedOpenCode2Cli({ ...options, dataDir: resolveDataDir() }),
|
|
287
287
|
upgradeCli: upgradeOpenCodeCli,
|
|
288
|
+
resolveLatestVersion: discoverOpenCodeUpdate,
|
|
288
289
|
readBinaryVersion: readOpenCode2BinaryVersion,
|
|
289
290
|
});
|
|
290
291
|
|
|
@@ -343,7 +344,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
|
|
|
343
344
|
if (isOpenCode1xVersion(rawTarget)) {
|
|
344
345
|
return res.status(400).json({
|
|
345
346
|
success: false,
|
|
346
|
-
error: 'OpenCode upgrade refuses 1.x targets. Only
|
|
347
|
+
error: 'OpenCode upgrade refuses 1.x targets. Only OpenCode 2.x is allowed.',
|
|
347
348
|
errorCode: 'OPENCODE_UPGRADE_1X_REFUSED',
|
|
348
349
|
});
|
|
349
350
|
}
|