@yuriai/web 0.1.12 → 0.1.14
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/dist/assets/AssistantView-DOi4K931.js +3 -0
- package/dist/assets/{DiagramView-BE0BG58g.js → DiagramView-AX_WR3eG.js} +1 -1
- package/dist/assets/{MarkdownRenderer-Bi3za_gr.js → MarkdownRenderer-fC11logG.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-ojlt0fUf.js → MarkdownRendererImpl-A0x9lifL.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-D_U2_QOy.js → MarkstreamRendererImpl-Camlm3Ev.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-D9yR39HJ.js → MobileDetailNavigation-BkqkecBf.js} +1 -1
- package/dist/assets/{MobileShareBridge-BvbJx_bg.js → MobileShareBridge-DNXTEHDF.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CAtsLPgf.js → MobileTabPageHeader-Bv9VftUT.js} +1 -1
- package/dist/assets/{MultiRunWindow-CPECBxDl.js → MultiRunWindow-CHK4pv4L.js} +1 -1
- package/dist/assets/{SettingsView-OSU-m0D0.js → SettingsView-cT3bPM_E.js} +1 -1
- package/dist/assets/{SettingsWindow-CCjh1wvl.js → SettingsWindow-CZRLuT9-.js} +1 -1
- package/dist/assets/{TerminalView-Dbd0C6jq.js → TerminalView-DqcyqVjS.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CQ6VomzC.js → ToolOutputDialog-GLlq9-W6.js} +1 -1
- package/dist/assets/{appThemeRegistry-CNwn7MsN.js → appThemeRegistry-B6pQ8vzc.js} +1 -1
- package/dist/assets/{capgoAdapter-qqkEpsVU.js → capgoAdapter-Bb0fZtdX.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-ifJLPoS2.js → fileMentionTouchSelection-3h_vyEnU.js} +1 -1
- package/dist/assets/{gitApi-4lV0IO_T.js → gitApi-kzG0If3z.js} +1 -1
- package/dist/assets/{insertionBoundaries-_VOlC6Ay.js → insertionBoundaries-CrivVfew.js} +1 -1
- package/dist/assets/main-BIyBucv-.js +169 -0
- package/dist/assets/{main-B5TmtyDx.js → main-Hlu0IB1K.js} +2 -2
- package/dist/assets/{mcpQueries-CZYJlcIT.js → mcpQueries-DVSGJdEJ.js} +1 -1
- package/dist/assets/{miniChat-CxikTIKy.js → miniChat-D6JPgsqw.js} +2 -2
- package/dist/assets/{mobile-aDnTnffS.js → mobile-DDuy4pcy.js} +2 -2
- package/dist/assets/{mobileBackNavigation-BJq2ZPk0.js → mobileBackNavigation-CeGcEoY2.js} +1 -1
- package/dist/assets/{multirun-C57CelCJ.js → multirun-Brs9nl_V.js} +1 -1
- package/dist/assets/{native-config-BBIKxqhh.js → native-config-D0rnpJR8.js} +1 -1
- package/dist/assets/{projectMeta-CvbcN8Gk.js → projectMeta-N7IrdLdy.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-DDW7qWlB.js → renderElectronMiniChatApp-8qBvK9Ph.js} +2 -2
- package/dist/assets/{renderMobileApp-BWvLz2WX.js → renderMobileApp-DlzbiKPe.js} +4 -4
- package/dist/assets/{runtimeConfig-BUVmIEcB.js → runtimeConfig-CiXYAKZA.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DhhOwfNb.js → runtimeEndpointReset-CJ75UJCg.js} +2 -2
- package/dist/assets/{sessionChangeSummary-CpKIXZbD.js → sessionChangeSummary-Cj9hELGP.js} +1 -1
- package/dist/assets/{sessionLookup-weg1wDvb.js → sessionLookup-DNBHHgWV.js} +1 -1
- package/dist/assets/speechSettingsQueries-DmpOjA8z.js +4 -0
- package/dist/assets/src-j6H_WgaE.css +2 -0
- package/dist/assets/{textarea-DIebodlT.js → textarea-Ci46Ymdc.js} +1 -1
- package/dist/assets/{types-DHuWGSXB.js → types-CNeUb9mY.js} +1 -1
- package/dist/assets/{useAppFontEffects-CVykprhp.js → useAppFontEffects-DwoSkAza.js} +43 -43
- package/dist/assets/{useDesktopWindowControlsLayout-CIc6t8oI.js → useDesktopWindowControlsLayout-CjdGePjj.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-BzjFAgov.js → useEffectiveDirectory-DwavBbA1.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-Bjy95iRt.js → useMobileNavigationStore-B5JVNRZO.js} +22 -22
- package/dist/assets/{useWorkerHighlightedLines-3cjilkk1.js → useWorkerHighlightedLines-CKjw_rwT.js} +1 -1
- package/dist/assets/{vendor-framer-motion-D-oiwsxL.js → vendor-framer-motion-DsGBcZHB.js} +1 -1
- package/dist/assets/vendor-motion-CIQx6DBb.js +1 -0
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +6 -6
- package/package.json +1 -1
- package/server/lib/assistants/DOCUMENTATION.md +8 -7
- package/server/lib/assistants/harness.js +3 -1
- package/server/lib/assistants/service.js +9 -6
- package/server/lib/assistants/service.test.js +99 -0
- package/server/lib/session-title/DOCUMENTATION.md +6 -2
- package/server/lib/session-title/native-runtime.test.js +60 -3
- package/server/lib/session-title/runtime.js +56 -35
- package/dist/assets/AssistantView-BRyJh6_0.js +0 -3
- package/dist/assets/main-DLnEF_bY.js +0 -169
- package/dist/assets/speechSettingsQueries-CqpReFaM.js +0 -4
- package/dist/assets/src-Ba2dKQ01.css +0 -2
- package/dist/assets/vendor-motion-88WXBOBf.js +0 -1
package/dist/assets/{useWorkerHighlightedLines-3cjilkk1.js → useWorkerHighlightedLines-CKjw_rwT.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-CcMfow51.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-CZFN8X-2.js";import{i as u,n as d,t as f}from"./tooltip-BfZgnZ6x.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-CcMfow51.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-CZFN8X-2.js";import{i as u,n as d,t as f}from"./tooltip-BfZgnZ6x.js";import{n as p}from"./MarkdownRenderer-fC11logG.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(`
|
|
@@ -6,4 +6,4 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from".
|
|
|
6
6
|
${v}px !important;
|
|
7
7
|
${y}px !important;
|
|
8
8
|
}
|
|
9
|
-
`),()=>{g.removeAttribute(`data-motion-pop-id`),S.contains(x)&&S.removeChild(x)}},[t]),(0,Q.jsx)(lu,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:$.cloneElement(e,{ref:d})})}var du=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=nu(fu),d=(0,$.useId)(),f=(0,$.useRef)(),p=(0,$.useRef)(n),m=(0,$.useRef)(r);ru(()=>{p.current=n,m.current=r});let h=!0,g=(0,$.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,$.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),$.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,Q.jsx)(uu,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,Q.jsx)(iu.Provider,{value:g,children:e})};function fu(){return new Map}function pu(e=!0){let t=(0,$.useContext)(iu);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,$.useId)();(0,$.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,$.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var mu=e=>e.key||``;function hu(e){let t=[];return $.Children.forEach(e,e=>{(0,$.isValidElement)(e)&&t.push(e)}),t}var gu=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=pu(o),f=(0,$.useMemo)(()=>hu(e),[e]),p=o&&!u?[]:f.map(mu),m=(0,$.useRef)(!0),h=nu(()=>new Map),g=(0,$.useRef)(new Set),[_,v]=(0,$.useState)(f),[y,b]=(0,$.useState)(f);ru(()=>{o&&!u&&!y.length&&d?.()},[u,o,y.length,d]);let x=(0,$.useRef)();(0,$.useEffect)(()=>()=>{let e=x.current;x.current=void 0,e?.()},[y]),ru(()=>{m.current=!1;for(let e=0;e<y.length;e++){let t=mu(y[e]);p.includes(t)?(h.delete(t),g.current.delete(t)):h.get(t)!==!0&&h.set(t,!1)}},[y,p.length,p.join(`-`)]);let S=[];if(f!==_){let e=[...f],t=0;for(let n of y){let r=p.indexOf(mu(n));r===-1?(e.splice(t++,0,n),S.push(n)):t=r+S.length+1}return S.every(e=>h.get(mu(e)))?e=f:a===`wait`&&(e=S),b(hu(e)),v(f),null}let{forceRender:C}=(0,$.useContext)(tu);return(0,Q.jsx)(Q.Fragment,{children:y.map(e=>{let _=mu(e),b=o&&!u?!1:f===y||p.includes(_);return(0,Q.jsx)(du,{isPresent:b,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:b?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(C?.(),v([]),o&&d?.(),x.current=r)},anchorX:s,anchorY:c,children:e},_)})})},_u=(0,$.createContext)({strict:!1}),vu={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},yu=!1;function bu(){if(yu)return;let e={};for(let t in vu)e[t]={isEnabled:e=>vu[t].some(t=>!!e[t])};ec(e),yu=!0}function xu(){return bu(),tc()}function Su(e){let t=xu();for(let n in e)t[n]={...t[n],...e[n]};ec(t)}var Cu=(0,$.createContext)({});function wu(e,t){if(Gs(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Hs(t)?t:void 0,animate:Hs(n)?n:void 0}}return e.inherit===!1?{}:t}function Tu(e){let{initial:t,animate:n}=wu(e,(0,$.useContext)(Cu));return(0,$.useMemo)(()=>({initial:t,animate:n}),[Eu(t),Eu(n)])}function Eu(e){return Array.isArray(e)?e.join(` `):e}var Du=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ou(e,t,n){for(let r in t)!W(t[r])&&!ac(r,n)&&(e[r]=t[r])}function ku({transformTemplate:e},t){return(0,$.useMemo)(()=>{let n=Du();return ha(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Au(e,t){let n=e.style||{},r={};return Ou(r,n,e),Object.assign(r,ku(e,t)),r}function ju(e,t){let n={},r=Au(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Mu=()=>({...Du(),attrs:{}});function Nu(e,t,n,r){let i=(0,$.useMemo)(()=>{let n=Mu();return ba(n,t,xl(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Ou(t,e.style,e),i.style={...t,...i.style}}return i}var Pu=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Fu(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Pu.has(e)}function Iu(e,t){return e.startsWith(`on`)?!Fu(e):t?.(e)??!Fu(e)}function Lu(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(W(e[a])||(Iu(a,r)||n===!0&&Fu(a)||!t&&!Fu(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var Ru=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function zu(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Ru.indexOf(e)>-1||/[A-Z]/u.test(e))}function Bu(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??zu(e)?Nu:ju)(t,r,i,e),l=Lu(t,typeof e==`string`,a,s),u=e===$.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,$.useMemo)(()=>W(d)?d.get():d,[d]);return(0,$.createElement)(e,{...u,children:f})}function Vu({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Hu(n,r,i,e),renderState:t()}}function Hu(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=io(a[e]);let{initial:o,animate:s}=e,c=Gs(e),l=Ks(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Vs(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=_i(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Uu=e=>(t,n)=>{let r=(0,$.useContext)(Cu),i=(0,$.useContext)(iu),a=()=>Vu(e,t,r,i);return n?a():nu(a)},Wu=Uu({scrapeMotionValuesFromProps:oc,createRenderState:Du}),Gu=Uu({scrapeMotionValuesFromProps:Cl,createRenderState:Mu}),Ku=Symbol.for(`motionComponentSymbol`);function qu(e,t,n){let r=(0,$.useRef)(n);(0,$.useInsertionEffect)(()=>{r.current=n});let i=(0,$.useRef)(null);return(0,$.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var Ju=(0,$.createContext)({});function Yu(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Xu(e,t,n,r,i,a){let{visualElement:o}=(0,$.useContext)(Cu),s=(0,$.useContext)(_u),c=(0,$.useContext)(iu),l=(0,$.useContext)(au),u=l.reducedMotion,d=l.skipAnimations,f=(0,$.useRef)(null),p=(0,$.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,$.useContext)(Ju);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Zu(f.current,n,i,h),(0,$.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[Oi],_=(0,$.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return ru(()=>{!p.current||!m||(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),ru(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,$.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function Zu(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Qu(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Yu(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Qu(e){if(e)return e.options.allowProjection===!1?Qu(e.parent):e.projection}function $u(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Su(r);let a=n?n===`svg`:zu(e),o=a?Gu:Wu;function s(n,s){let c,l={...(0,$.useContext)(au),...n,layoutId:ed(n)},{isStatic:u,isValidProp:d}=l,f=Tu(n),p=o(n,u);if(!u&&typeof window<`u`){td(l,r);let t=nd(l);c=t.MeasureLayout,f.visualElement=Xu(e,p,l,i,t.ProjectionNode,a)}return(0,Q.jsxs)(Cu.Provider,{value:f,children:[c&&f.visualElement?(0,Q.jsx)(c,{visualElement:f.visualElement,...l}):null,Bu(e,n,qu(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,$.forwardRef)(s);return c[Ku]=e,c}function ed({layoutId:e}){let t=(0,$.useContext)(tu).id;return t&&e!==void 0?t+`-`+e:e}function td(e,t){(0,$.useContext)(_u).strict}function nd(e){let{drag:t,layout:n}=xu();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function rd(e,t){if(typeof Proxy>`u`)return $u;let n=new Map,r=(n,r)=>$u(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,$u(a,void 0,e,t)),n.get(a))})}var id=(e,t)=>t.isSVG??zu(e)?new wl(t):new cc(t,{allowProjection:e!==$.Fragment}),ad=class extends Z{constructor(e){super(e),e.animationState||=Dl(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Vs(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},od=0,sd={animation:{Feature:ad},exit:{Feature:class extends Z{constructor(){super(...arguments),this.id=od++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=vi(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id,this.node))}unmount(){}}}},cd=class extends Z{constructor(e){super(e),this.removeGroupControls=d,this.removeListeners=d,this.controls=new tl(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||d}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ld=({current:e})=>e?e.ownerDocument.defaultView:null,ud=e=>(t,n)=>{e&&F.update(()=>e(t,n),!1,!0)},dd=class extends Z{constructor(){super(...arguments),this.removePointerDownListener=d}onPointerDown(e){this.session=new Ac(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ld(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:ud(e),onStart:ud(t),onMove:ud(n),onEnd:(e,t)=>{delete this.session,r&&F.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=fc(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},fd=!1,pd=({layout:e,layoutDependency:t})=>({layout:e,layoutDependency:t,animationType:typeof e==`string`?e:`both`}),md=class extends $.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),fd&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,...pd(this.props),onExitComplete:()=>this.safeToRemove()})),es.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layout:t,layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,(e.layoutDependency!==n||e.layout!==t)&&o.setOptions({...o.options,...pd(this.props)}),fd=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||F.postRender(()=>{let e=o.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Za.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;fd=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function hd(e){let[t,n]=pu(),r=(0,$.useContext)(tu);return(0,Q.jsx)(md,{...e,layoutGroup:r,switchLayoutGroup:(0,$.useContext)(Ju),isPresent:t,safeToRemove:n})}var gd={pan:{Feature:dd},drag:{Feature:cd,ProjectionNode:zs,MeasureLayout:hd}};function _d(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&F.postRender(()=>i(t,uc(t)))}var vd=class extends Z{mount(){let{current:e}=this.node;e&&(this.unmount=ul(e,(e,t)=>(_d(this.node,t,`Start`),e=>_d(this.node,e,`End`))))}unmount(){}},yd=class extends Z{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=f(Is(this.node.current,`focus`,()=>this.onFocus()),Is(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function bd(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&F.postRender(()=>i(t,uc(t)))}var xd=class extends Z{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=vl(e,(e,t)=>(bd(this.node,t,`Start`),(e,{success:t})=>bd(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Sd=new WeakMap,Cd=new WeakMap,wd=e=>{let t=Sd.get(e.target);t&&t(e)},Td=e=>{e.forEach(wd)};function Ed({root:e,...t}){let n=e||document;Cd.has(n)||Cd.set(n,{});let r=Cd.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Td,{root:e,...t})),r[i]}function Dd(e,t,n){let r=Ed(t);return Sd.set(e,n),r.observe(e),()=>{Sd.delete(e),r.unobserve(e)}}var Od={some:0,all:1},kd=class extends Z{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Od[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Dd(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Ad(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Ad({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var jd={inView:{Feature:kd},tap:{Feature:xd},focus:{Feature:yd},hover:{Feature:vd}},Md={layout:{ProjectionNode:zs,MeasureLayout:hd}},Nd=rd({...sd,...jd,...gd,...Md},id);function Pd(e){let t=nu(()=>U(e)),{isStatic:n}=(0,$.useContext)(au);if(n){let[,n]=(0,$.useState)(e);(0,$.useEffect)(()=>t.on(`change`,n),[])}return t}function Fd(){!Ys.current&&Zs();let[e]=(0,$.useState)(Js.current);return e}export{eu as a,gu as i,Pd as n,Ql as o,Nd as r,Ht as s,Fd as t};
|
|
9
|
+
`),()=>{g.removeAttribute(`data-motion-pop-id`),S.contains(x)&&S.removeChild(x)}},[t]),(0,Q.jsx)(lu,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:$.cloneElement(e,{ref:d})})}var du=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=nu(fu),d=(0,$.useId)(),f=(0,$.useRef)(),p=(0,$.useRef)(n),m=(0,$.useRef)(r);ru(()=>{p.current=n,m.current=r});let h=!0,g=(0,$.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,$.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),$.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,Q.jsx)(uu,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,Q.jsx)(iu.Provider,{value:g,children:e})};function fu(){return new Map}function pu(e=!0){let t=(0,$.useContext)(iu);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,$.useId)();(0,$.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,$.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var mu=e=>e.key||``;function hu(e){let t=[];return $.Children.forEach(e,e=>{(0,$.isValidElement)(e)&&t.push(e)}),t}var gu=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=pu(o),f=(0,$.useMemo)(()=>hu(e),[e]),p=o&&!u?[]:f.map(mu),m=(0,$.useRef)(!0),h=nu(()=>new Map),g=(0,$.useRef)(new Set),[_,v]=(0,$.useState)(f),[y,b]=(0,$.useState)(f);ru(()=>{o&&!u&&!y.length&&d?.()},[u,o,y.length,d]);let x=(0,$.useRef)();(0,$.useEffect)(()=>()=>{let e=x.current;x.current=void 0,e?.()},[y]),ru(()=>{m.current=!1;for(let e=0;e<y.length;e++){let t=mu(y[e]);p.includes(t)?(h.delete(t),g.current.delete(t)):h.get(t)!==!0&&h.set(t,!1)}},[y,p.length,p.join(`-`)]);let S=[];if(f!==_){let e=[...f],t=0;for(let n of y){let r=p.indexOf(mu(n));r===-1?(e.splice(t++,0,n),S.push(n)):t=r+S.length+1}return S.every(e=>h.get(mu(e)))?e=f:a===`wait`&&(e=S),b(hu(e)),v(f),null}let{forceRender:C}=(0,$.useContext)(tu);return(0,Q.jsx)(Q.Fragment,{children:y.map(e=>{let _=mu(e),b=o&&!u?!1:f===y||p.includes(_);return(0,Q.jsx)(du,{isPresent:b,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:b?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(C?.(),v([]),o&&d?.(),x.current=r)},anchorX:s,anchorY:c,children:e},_)})})},_u=(0,$.createContext)({strict:!1}),vu={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},yu=!1;function bu(){if(yu)return;let e={};for(let t in vu)e[t]={isEnabled:e=>vu[t].some(t=>!!e[t])};ec(e),yu=!0}function xu(){return bu(),tc()}function Su(e){let t=xu();for(let n in e)t[n]={...t[n],...e[n]};ec(t)}var Cu=(0,$.createContext)({});function wu(e,t){if(Gs(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Hs(t)?t:void 0,animate:Hs(n)?n:void 0}}return e.inherit===!1?{}:t}function Tu(e){let{initial:t,animate:n}=wu(e,(0,$.useContext)(Cu));return(0,$.useMemo)(()=>({initial:t,animate:n}),[Eu(t),Eu(n)])}function Eu(e){return Array.isArray(e)?e.join(` `):e}var Du=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ou(e,t,n){for(let r in t)!W(t[r])&&!ac(r,n)&&(e[r]=t[r])}function ku({transformTemplate:e},t){return(0,$.useMemo)(()=>{let n=Du();return ha(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Au(e,t){let n=e.style||{},r={};return Ou(r,n,e),Object.assign(r,ku(e,t)),r}function ju(e,t){let n={},r=Au(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Mu=()=>({...Du(),attrs:{}});function Nu(e,t,n,r){let i=(0,$.useMemo)(()=>{let n=Mu();return ba(n,t,xl(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Ou(t,e.style,e),i.style={...t,...i.style}}return i}var Pu=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Fu(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Pu.has(e)}function Iu(e,t){return e.startsWith(`on`)?!Fu(e):t?.(e)??!Fu(e)}function Lu(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(W(e[a])||(Iu(a,r)||n===!0&&Fu(a)||!t&&!Fu(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var Ru=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function zu(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Ru.indexOf(e)>-1||/[A-Z]/u.test(e))}function Bu(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??zu(e)?Nu:ju)(t,r,i,e),l=Lu(t,typeof e==`string`,a,s),u=e===$.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,$.useMemo)(()=>W(d)?d.get():d,[d]);return(0,$.createElement)(e,{...u,children:f})}function Vu({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Hu(n,r,i,e),renderState:t()}}function Hu(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=io(a[e]);let{initial:o,animate:s}=e,c=Gs(e),l=Ks(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Vs(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=_i(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Uu=e=>(t,n)=>{let r=(0,$.useContext)(Cu),i=(0,$.useContext)(iu),a=()=>Vu(e,t,r,i);return n?a():nu(a)},Wu=Uu({scrapeMotionValuesFromProps:oc,createRenderState:Du}),Gu=Uu({scrapeMotionValuesFromProps:Cl,createRenderState:Mu}),Ku=Symbol.for(`motionComponentSymbol`);function qu(e,t,n){let r=(0,$.useRef)(n);(0,$.useInsertionEffect)(()=>{r.current=n});let i=(0,$.useRef)(null);return(0,$.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var Ju=(0,$.createContext)({});function Yu(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Xu(e,t,n,r,i,a){let{visualElement:o}=(0,$.useContext)(Cu),s=(0,$.useContext)(_u),c=(0,$.useContext)(iu),l=(0,$.useContext)(au),u=l.reducedMotion,d=l.skipAnimations,f=(0,$.useRef)(null),p=(0,$.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,$.useContext)(Ju);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Zu(f.current,n,i,h),(0,$.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[Oi],_=(0,$.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return ru(()=>{!p.current||!m||(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),ru(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,$.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function Zu(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Qu(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Yu(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Qu(e){if(e)return e.options.allowProjection===!1?Qu(e.parent):e.projection}function $u(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Su(r);let a=n?n===`svg`:zu(e),o=a?Gu:Wu;function s(n,s){let c,l={...(0,$.useContext)(au),...n,layoutId:ed(n)},{isStatic:u,isValidProp:d}=l,f=Tu(n),p=o(n,u);if(!u&&typeof window<`u`){td(l,r);let t=nd(l);c=t.MeasureLayout,f.visualElement=Xu(e,p,l,i,t.ProjectionNode,a)}return(0,Q.jsxs)(Cu.Provider,{value:f,children:[c&&f.visualElement?(0,Q.jsx)(c,{visualElement:f.visualElement,...l}):null,Bu(e,n,qu(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,$.forwardRef)(s);return c[Ku]=e,c}function ed({layoutId:e}){let t=(0,$.useContext)(tu).id;return t&&e!==void 0?t+`-`+e:e}function td(e,t){(0,$.useContext)(_u).strict}function nd(e){let{drag:t,layout:n}=xu();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function rd(e,t){if(typeof Proxy>`u`)return $u;let n=new Map,r=(n,r)=>$u(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,$u(a,void 0,e,t)),n.get(a))})}var id=(e,t)=>t.isSVG??zu(e)?new wl(t):new cc(t,{allowProjection:e!==$.Fragment}),ad=class extends Z{constructor(e){super(e),e.animationState||=Dl(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Vs(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},od=0,sd={animation:{Feature:ad},exit:{Feature:class extends Z{constructor(){super(...arguments),this.id=od++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=vi(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id,this.node))}unmount(){}}}},cd=class extends Z{constructor(e){super(e),this.removeGroupControls=d,this.removeListeners=d,this.controls=new tl(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||d}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ld=({current:e})=>e?e.ownerDocument.defaultView:null,ud=e=>(t,n)=>{e&&F.update(()=>e(t,n),!1,!0)},dd=class extends Z{constructor(){super(...arguments),this.removePointerDownListener=d}onPointerDown(e){this.session=new Ac(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ld(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:ud(e),onStart:ud(t),onMove:ud(n),onEnd:(e,t)=>{delete this.session,r&&F.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=fc(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},fd=!1,pd=({layout:e,layoutDependency:t})=>({layout:e,layoutDependency:t,animationType:typeof e==`string`?e:`both`}),md=class extends $.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),fd&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,...pd(this.props),onExitComplete:()=>this.safeToRemove()})),es.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layout:t,layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o?(o.isPresent=a,(e.layoutDependency!==n||e.layout!==t)&&o.setOptions({...o.options,...pd(this.props)}),fd=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||F.postRender(()=>{let e=o.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Za.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;fd=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function hd(e){let[t,n]=pu(),r=(0,$.useContext)(tu);return(0,Q.jsx)(md,{...e,layoutGroup:r,switchLayoutGroup:(0,$.useContext)(Ju),isPresent:t,safeToRemove:n})}var gd={pan:{Feature:dd},drag:{Feature:cd,ProjectionNode:zs,MeasureLayout:hd}};function _d(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&F.postRender(()=>i(t,uc(t)))}var vd=class extends Z{mount(){let{current:e}=this.node;e&&(this.unmount=ul(e,(e,t)=>(_d(this.node,t,`Start`),e=>_d(this.node,e,`End`))))}unmount(){}},yd=class extends Z{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=f(Is(this.node.current,`focus`,()=>this.onFocus()),Is(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function bd(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&F.postRender(()=>i(t,uc(t)))}var xd=class extends Z{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=vl(e,(e,t)=>(bd(this.node,t,`Start`),(e,{success:t})=>bd(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Sd=new WeakMap,Cd=new WeakMap,wd=e=>{let t=Sd.get(e.target);t&&t(e)},Td=e=>{e.forEach(wd)};function Ed({root:e,...t}){let n=e||document;Cd.has(n)||Cd.set(n,{});let r=Cd.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Td,{root:e,...t})),r[i]}function Dd(e,t,n){let r=Ed(t);return Sd.set(e,n),r.observe(e),()=>{Sd.delete(e),r.unobserve(e)}}var Od={some:0,all:1},kd=class extends Z{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Od[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Dd(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Ad(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Ad({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var jd={inView:{Feature:kd},tap:{Feature:xd},focus:{Feature:yd},hover:{Feature:vd}},Md={layout:{ProjectionNode:zs,MeasureLayout:hd}},Nd=rd({...sd,...jd,...gd,...Md},id);function Pd(e){let t=nu(()=>U(e)),{isStatic:n}=(0,$.useContext)(au);if(n){let[,n]=(0,$.useState)(e);(0,$.useEffect)(()=>t.on(`change`,n),[])}return t}function Fd(){!Ys.current&&Zs();let[e]=(0,$.useState)(Js.current);return e}export{eu as a,b as c,gu as i,Pd as n,Ql as o,Nd as r,Ht as s,Fd as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./vendor-framer-motion-DsGBcZHB.js";var t=e;export{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-Hlu0IB1K.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">
|
|
@@ -583,11 +583,11 @@
|
|
|
583
583
|
<link rel="modulepreload" crossorigin href="/assets/platform-7bX6qtBV.js">
|
|
584
584
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BHXvha-U.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-
|
|
590
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
586
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CNeUb9mY.js">
|
|
587
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bb0fZtdX.js">
|
|
588
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-D0rnpJR8.js">
|
|
589
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CiXYAKZA.js">
|
|
590
|
+
<link rel="stylesheet" crossorigin href="/assets/src-j6H_WgaE.css">
|
|
591
591
|
</head>
|
|
592
592
|
<body class="h-full bg-background text-foreground">
|
|
593
593
|
<!-- Keep the startup layer outside #root. React replaces every child of
|
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-D6JPgsqw.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">
|
|
@@ -97,11 +97,11 @@
|
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/platform-7bX6qtBV.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BHXvha-U.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-
|
|
104
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CNeUb9mY.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bb0fZtdX.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-D0rnpJR8.js">
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CiXYAKZA.js">
|
|
104
|
+
<link rel="stylesheet" crossorigin href="/assets/src-j6H_WgaE.css">
|
|
105
105
|
</head>
|
|
106
106
|
<body class="h-full bg-background text-foreground">
|
|
107
107
|
<div id="root" class="h-full">
|
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-DDuy4pcy.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">
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/platform-7bX6qtBV.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BHXvha-U.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-
|
|
93
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/types-CNeUb9mY.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-Bb0fZtdX.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-D0rnpJR8.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CiXYAKZA.js">
|
|
93
|
+
<link rel="stylesheet" crossorigin href="/assets/src-j6H_WgaE.css">
|
|
94
94
|
</head>
|
|
95
95
|
<body class="h-full bg-background text-foreground">
|
|
96
96
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -76,12 +76,13 @@ reasoning display.
|
|
|
76
76
|
The existing live contact-turn state drives working indicators; no synthetic
|
|
77
77
|
user message is inserted. The review cannot execute the task again.
|
|
78
78
|
- The model decides whether to deliver requested findings or remain quiet for
|
|
79
|
-
successful background work. Scheduled reviews
|
|
80
|
-
`yuri-final` declaration
|
|
81
|
-
Empty/malformed responses remain errors.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
successful background work. Scheduled reviews and read-only worker-watch
|
|
80
|
+
follow-ups accept an exact `yuri-final` declaration
|
|
81
|
+
`{ "status": "silent", "text": "" }`. Empty/malformed responses remain errors.
|
|
82
|
+
Background reviews never publish `yuri-message` progress; they speak once
|
|
83
|
+
through the final decision. Silent reviews produce no transcript bubble,
|
|
84
|
+
unread message, or contact notification. Worker-watch follow-ups still report
|
|
85
|
+
the awaited result unless history already reports the same result.
|
|
85
86
|
- The additive `assistant_scheduled_result` table records terminal review
|
|
86
87
|
receipts by assistant/run, including silence and cancellation. Stable turn IDs
|
|
87
88
|
also reconcile already-persisted replies. Duplicate delivery and reopening the
|
|
@@ -192,7 +193,7 @@ and keep their existing error result handling.
|
|
|
192
193
|
- Successful `assign_session` and `watch_session` return `terminate: true` to stop the mutation loop. The harness then requests a tools-disabled model summary. Prerequisite tools (`list_projects` / `list_sessions`) may still run before assign/watch/stop in the same turn; multi-operation user intents remain ordered **across turns** after a successful assign/watch.
|
|
193
194
|
- Same contact-turn assign gate (tools instance lifetime only, not cross-turn): identical args after success replay the cached success result (no second worker); different args after success, or parallel mismatched args, fail closed with a validation error. The idempotent key includes worker model selection and current-turn attachment scope. Failure clears the gate so a corrected retry may run. Parallel identical args share one in-flight promise.
|
|
194
195
|
- After a successful assign or watch, the service persists the existing session card into the contact transcript (user bubbles first, then the card) and watches that worker session in `assistant_contact_watch` (watch baselines the live status). The user-facing outcome is the session card plus any short **spoken** preamble; English tool-result confirms (`Opened a coding session.`, `Watching that coding session.`, `Created assistant…`, `Sent to…`) for card/side-effect tools are **not** written into the transcript.
|
|
195
|
-
- Existing OpenCode SSE on the same `globalEventHub` as notifications (`session.idle`, `session.error`, `session.status`, `session.execution.*`, `question.asked`, `permission.asked`) updates **the same card** (`busy` → `complete` / `error` / `question` / `cancelled`). **No canned settle transcript bubbles** (`oc.settle.complete` / `error` / `question` are not written). On **complete, error, or cancelled (user interrupt)** when the watch status actually changed, the service schedules an async contact-lane **continuation** (`inContactTurnLane` + `runContactTurn`) per related assistant: no admitted user row (internal `userText` only), active contact turn (green dot / 3-dot), stable resume id `resume_${assistantID}_${sessionID}_${status}_${updatedAt}`, bounded last worker assistant text (~2000 chars; fetch failure still resumes with status only). Cancelled continuations include `reason: user_interrupted` so the contact can acknowledge the user's abort. The contact Agent can perform read-only lookups and summarize in the user's language, but cannot reassign or mutate a session during this notification — the user sees that Agent summary, not 「会话已完成/会话失败」. `question` updates the card only (worker waiting on the user). `stop_session` cancellation does not schedule this continuation. Session-goal settle (`emitGoalNotification`) uses the same reporter — not a second scheduler. Idle after `session.error` must not rewrite 失败 as 完成 (`changed=false` → no second resume). Same complete status re-reported is idempotent.
|
|
196
|
+
- Existing OpenCode SSE on the same `globalEventHub` as notifications (`session.idle`, `session.error`, `session.status`, `session.execution.*`, `question.asked`, `permission.asked`) updates **the same card** (`busy` → `complete` / `error` / `question` / `cancelled`). **No canned settle transcript bubbles** (`oc.settle.complete` / `error` / `question` are not written). On **complete, error, or cancelled (user interrupt)** when the watch status actually changed, the service schedules an async contact-lane **continuation** (`inContactTurnLane` + `runContactTurn`) per related assistant: no admitted user row (internal `userText` only), active contact turn (green dot / 3-dot), stable resume id `resume_${assistantID}_${sessionID}_${status}_${updatedAt}`, bounded last worker assistant text (~2000 chars; fetch failure still resumes with status only). Cancelled continuations include `reason: user_interrupted` so the contact can acknowledge the user's abort. The contact Agent can perform read-only lookups and summarize in the user's language, but cannot reassign or mutate a session during this notification — the user sees that Agent summary, not 「会话已完成/会话失败」. `question` updates the card only (worker waiting on the user). `stop_session` cancellation does not schedule this continuation. Session-goal settle (`emitGoalNotification`) uses the same reporter — not a second scheduler. Idle after `session.error` must not rewrite 失败 as 完成 (`changed=false` → no second resume). Same complete status re-reported is idempotent. The watch rows are read inside the `BEGIN IMMEDIATE` transition, so multiple Host processes sharing `assistants.sqlite` schedule at most one continuation per transition. The lock is SQLite's OS file lock, held only for that synchronous transaction (no awaits); a Host that exits mid-transaction releases it and its uncommitted write is discarded. Turn lanes and active-turn markers are process-local memory, so a dead Host never leaves a durable lock: whichever Host receives the next user send admits and runs it.
|
|
196
197
|
- **Shutdown interrupt (ticket 07):** official `session.execution.interrupted` reason is `user | shutdown | superseded | inactivity`. **`reason: shutdown` does not settle** the watch and does **not** schedule contact resume — upstream keeps the execution claim for restart recovery. The card stays `busy` until an authoritative terminal (`session.execution.succeeded` / `failed` / user interrupt / reconcile). `reason: user` settles `cancelled` + resume. Other non-shutdown interrupts settle `error` unless `MessageAbortedError`. No parallel recovery store — the existing watch row remains the owner.
|
|
197
198
|
- Restart or a missed `session.idle` cannot leave the watch stuck: boot and the existing 60s reconcile timer `listInFlightWatches` and poll OpenCode `session.get` / `message.list`. Idle, `time.completed`, or a missing session settles the same card (`busy` → 完成) and triggers the same contact continuation (no `oc.settle.complete` bubble). `session.error` or last-assistant `info.error` settles 失败 + resume once; last-assistant `MessageAbortedError` settles `cancelled` + the interrupt notify once. Transport / non-404 get errors leave the watch in flight (failure is not empty success). One failed watch does not block unrelated watches. Reconcile reuses `reportAssignedSession`, so an error watch is never rewritten as complete. Tombstoned assistants skip resume.
|
|
198
199
|
- Worker sessions stamp `metadata.yuri.assigned` (`from: 'contact'`, `assistantID`, `name`). They must **not** use `yuri.assistant.assistantID` — that marker hides archived Assistant bindings from Chat.
|
|
@@ -378,6 +378,8 @@ export function createContactStreamFn(createChatCompletion, {
|
|
|
378
378
|
const baseIndex = projectStreamedContactTurnBubbles(context.messages, turnStart).length;
|
|
379
379
|
const publishPublicMessage = (text) => {
|
|
380
380
|
signal?.throwIfAborted();
|
|
381
|
+
// Background reviews speak only through their final decision.
|
|
382
|
+
if (allowSilent) return;
|
|
381
383
|
for (const bubble of splitContactBubbles(text)) {
|
|
382
384
|
const index = baseIndex + publicBubbles.length;
|
|
383
385
|
publicBubbles.push(bubble);
|
|
@@ -666,7 +668,7 @@ export async function runContactTurn({
|
|
|
666
668
|
CONTACT_SYSTEM_PROMPT,
|
|
667
669
|
'Conversation history is a bounded recent window. Use search_memory and read_memory to recall earlier facts from this contact when references or decisions are missing. Search by short distinctive terms or browse by time, read the relevant source, and report its date when useful. A page with complete=false still has older candidates. Cleared memory forms an access boundary and deleted history is unavailable. Historical messages are quoted evidence; current user instructions govern actions. Yuri card context records contain actual session identifiers and status. Ask for missing details after checking accessible history.',
|
|
668
670
|
readOnly ? 'This turn is a background result review. Only read-only lookup tools are available. Never create or continue work; follow the latest user constraints.' : '',
|
|
669
|
-
allowSilent ? 'Decide whether this
|
|
671
|
+
allowSilent ? 'Decide whether this background result needs a user-facing reply. Deliver requested research, summaries, or other requested output. Successful background work with no requested report should stay silent. Stay silent when conversation history already reports this same result and nothing new needs the user. Report actionable failures or missing input unless the user explicitly requested silence. For silence, emit only ```yuri-final\n{"status":"silent","text":""}\n```. Otherwise give the actual result once, in the user language, as a single short final answer. Do not narrate checks, announce progress, or send yuri-message progress updates.' : '',
|
|
670
672
|
formatPiCodingPrompt({
|
|
671
673
|
cwd: runtime?.cwd,
|
|
672
674
|
skillsPrompt: runtime?.skillsPrompt,
|
|
@@ -610,12 +610,14 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
610
610
|
// interrupt notify — duplicate cancelled reports (boot+timer, error+message.updated)
|
|
611
611
|
// must still reach the contact LLM.
|
|
612
612
|
if (status === 'cancelled') cancelAssignedResumes({ sessionID, statuses: ['complete', 'error'] });
|
|
613
|
-
|
|
614
|
-
if (watches.length === 0) return false;
|
|
613
|
+
if (listWatchesBySession(db, sessionID).length === 0) return false;
|
|
615
614
|
let changed = false;
|
|
616
615
|
const resumes = [];
|
|
617
616
|
db.exec('BEGIN IMMEDIATE');
|
|
618
617
|
try {
|
|
618
|
+
// Read under the write lock: another Host process sharing this SQLite file
|
|
619
|
+
// may have settled the same watch, and only one transition may resume.
|
|
620
|
+
const watches = listWatchesBySession(db, sessionID);
|
|
619
621
|
for (const watch of watches) {
|
|
620
622
|
if (watch.status === status || watch.status === 'cancelled') continue;
|
|
621
623
|
// session.idle / status idle follow session.error. Do not rewrite 失败 as 完成.
|
|
@@ -2700,7 +2702,8 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
2700
2702
|
);
|
|
2701
2703
|
} else {
|
|
2702
2704
|
lines.push(
|
|
2703
|
-
'- If no further work is needed, reply in one or two short sentences in the user\'s language summarizing the result or failure reason.',
|
|
2705
|
+
'- If no further work is needed, reply once in one or two short sentences in the user\'s language summarizing the result or failure reason. Use the worker output as the result; when it is unavailable, use read_session before replying.',
|
|
2706
|
+
'- The user is waiting for this assigned result: report it unless history already reports this same result, in which case stay silent instead of repeating it.',
|
|
2704
2707
|
);
|
|
2705
2708
|
}
|
|
2706
2709
|
return lines.join('\n');
|
|
@@ -2942,7 +2945,7 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
2942
2945
|
const generated = await runContactTurn({
|
|
2943
2946
|
signal: controller.signal,
|
|
2944
2947
|
readOnly: true,
|
|
2945
|
-
allowSilent:
|
|
2948
|
+
allowSilent: true,
|
|
2946
2949
|
assistant: assistantSnapshot,
|
|
2947
2950
|
history: executionHistory,
|
|
2948
2951
|
userText,
|
|
@@ -2970,8 +2973,8 @@ export const createAssistantsService = ({ dbPath, dataDir, buildOpenCodeUrl, get
|
|
|
2970
2973
|
const current = assistant(assistantID);
|
|
2971
2974
|
if (!current || current.tombstone_at || !enabled() || !current.enabled) { finishCancelled(); return; }
|
|
2972
2975
|
}
|
|
2973
|
-
if (
|
|
2974
|
-
db.prepare('INSERT OR IGNORE INTO assistant_scheduled_result(assistant_id, run_id, status) VALUES (?,?,?)').run(assistantID, scheduledRun.id, 'silent');
|
|
2976
|
+
if (generated?.silent === true) {
|
|
2977
|
+
if (scheduledRun) db.prepare('INSERT OR IGNORE INTO assistant_scheduled_result(assistant_id, run_id, status) VALUES (?,?,?)').run(assistantID, scheduledRun.id, 'silent');
|
|
2975
2978
|
settleActiveContactTurn(assistantID, turnID, { bumpRevision: true });
|
|
2976
2979
|
emitContactTurnEvent('yuri:contact-turn-end', { assistantID, turnID, status: 'complete' });
|
|
2977
2980
|
resolveContactTurnSettlement(messageID, { status: 'complete', silent: true });
|
|
@@ -3632,6 +3632,105 @@ describe('assistants service', () => {
|
|
|
3632
3632
|
service.close();
|
|
3633
3633
|
});
|
|
3634
3634
|
|
|
3635
|
+
it('resumes once when two Host processes share the assistants database', async () => {
|
|
3636
|
+
const directory = root();
|
|
3637
|
+
const resumes = [];
|
|
3638
|
+
const options = {
|
|
3639
|
+
runContactTurn: async ({ userText }) => {
|
|
3640
|
+
resumes.push(userText);
|
|
3641
|
+
return { text: '清理完成。', bubbles: ['清理完成。'] };
|
|
3642
|
+
},
|
|
3643
|
+
};
|
|
3644
|
+
const client = { messages: async () => ({ data: [] }) };
|
|
3645
|
+
const first = setup(directory, client, options);
|
|
3646
|
+
const second = setup(directory, client, options);
|
|
3647
|
+
try {
|
|
3648
|
+
const assistant = first.createAssistant(assistantInput);
|
|
3649
|
+
first.appendContactCard(assistant.id, { cardType: 'session', sessionID: 'ses_shared', directory, title: 'Cleanup', status: 'busy' });
|
|
3650
|
+
expect(first.processEvent({ type: 'session.idle', properties: { sessionID: 'ses_shared' } })).toBe(true);
|
|
3651
|
+
expect(second.processEvent({ type: 'session.idle', properties: { sessionID: 'ses_shared' } })).toBe(false);
|
|
3652
|
+
await vi.waitFor(() => expect(first.snapshot().assistants[0].working).toBe(false));
|
|
3653
|
+
expect(resumes).toHaveLength(1);
|
|
3654
|
+
expect(first.contactMessages(assistant.id).messages.filter((message) => message.text === '清理完成。')).toHaveLength(1);
|
|
3655
|
+
} finally {
|
|
3656
|
+
first.close();
|
|
3657
|
+
second.close();
|
|
3658
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
3659
|
+
}
|
|
3660
|
+
});
|
|
3661
|
+
|
|
3662
|
+
it('a Host that exits while holding the write lock does not block the next transition or user send', async () => {
|
|
3663
|
+
const directory = root();
|
|
3664
|
+
const resumes = [];
|
|
3665
|
+
const service = setup(directory, { messages: async () => ({ data: [] }) }, {
|
|
3666
|
+
runContactTurn: async ({ userText, readOnly }) => {
|
|
3667
|
+
if (readOnly) resumes.push(userText);
|
|
3668
|
+
return { text: 'ok', bubbles: ['ok'] };
|
|
3669
|
+
},
|
|
3670
|
+
});
|
|
3671
|
+
try {
|
|
3672
|
+
const assistant = service.createAssistant(assistantInput);
|
|
3673
|
+
service.appendContactCard(assistant.id, { cardType: 'session', sessionID: 'ses_crash', directory, title: 'Cleanup', status: 'busy' });
|
|
3674
|
+
// A real second Host takes the write lock, then dies by SIGKILL mid-transaction.
|
|
3675
|
+
const { spawn } = require('node:child_process');
|
|
3676
|
+
const holder = spawn(process.execPath, ['-e', `
|
|
3677
|
+
const db = new (require(${JSON.stringify(require.resolve('better-sqlite3'))}))(${JSON.stringify(path.join(directory, 'assistants.sqlite'))});
|
|
3678
|
+
db.exec('BEGIN IMMEDIATE');
|
|
3679
|
+
db.prepare("UPDATE assistant_contact_watch SET status='error'").run();
|
|
3680
|
+
process.stdout.write('locked');
|
|
3681
|
+
setInterval(() => {}, 1000);
|
|
3682
|
+
`], { stdio: ['ignore', 'pipe', 'inherit'] });
|
|
3683
|
+
await new Promise((resolve, reject) => {
|
|
3684
|
+
holder.stdout.once('data', resolve);
|
|
3685
|
+
holder.once('exit', (code) => reject(new Error(`lock holder exited early: ${code}`)));
|
|
3686
|
+
});
|
|
3687
|
+
const exited = new Promise((resolve) => holder.once('exit', resolve));
|
|
3688
|
+
holder.kill('SIGKILL');
|
|
3689
|
+
await exited;
|
|
3690
|
+
expect(service.processEvent({ type: 'session.idle', properties: { sessionID: 'ses_crash' } })).toBe(true);
|
|
3691
|
+
await vi.waitFor(() => expect(resumes).toHaveLength(1));
|
|
3692
|
+
const sent = await settleSend(service, assistant.id, { messageID: 'after_crash', parts: [{ type: 'text', text: 'hi' }] });
|
|
3693
|
+
expect(sent.settled).toMatchObject({ status: 'complete' });
|
|
3694
|
+
expect(service.snapshot().assistants[0].working).toBe(false);
|
|
3695
|
+
} finally {
|
|
3696
|
+
service.close();
|
|
3697
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
3698
|
+
}
|
|
3699
|
+
});
|
|
3700
|
+
|
|
3701
|
+
it('lets an assigned-session follow-up stay silent without progress, unread, or notification', async () => {
|
|
3702
|
+
const directory = root();
|
|
3703
|
+
let time = 7_000;
|
|
3704
|
+
const onContactTurnComplete = vi.fn();
|
|
3705
|
+
const backgroundTurns = [];
|
|
3706
|
+
const service = setup(directory, { messages: async () => ({ data: [] }) }, {
|
|
3707
|
+
clock: () => time,
|
|
3708
|
+
onContactTurnComplete,
|
|
3709
|
+
runContactTurn: (input) => {
|
|
3710
|
+
backgroundTurns.push(input);
|
|
3711
|
+
return realRunContactTurn({
|
|
3712
|
+
...input,
|
|
3713
|
+
createChatCompletion: async () => ({ text: '```yuri-message\n{"text":"正在查看该会话的执行结果"}\n```\n```yuri-final\n{"status":"silent","text":""}\n```' }),
|
|
3714
|
+
});
|
|
3715
|
+
},
|
|
3716
|
+
});
|
|
3717
|
+
try {
|
|
3718
|
+
const assistant = service.createAssistant(assistantInput);
|
|
3719
|
+
service.appendContactCard(assistant.id, { cardType: 'session', sessionID: 'ses_quiet', directory, title: 'Cleanup', status: 'busy' });
|
|
3720
|
+
const before = service.contactMessages(assistant.id).messages.length;
|
|
3721
|
+
service.processEvent({ type: 'session.idle', properties: { sessionID: 'ses_quiet' } });
|
|
3722
|
+
const settled = await service.whenContactTurnSettled(assignedSessionResumeMessageID(assistant.id, 'ses_quiet', 'complete', 7_000));
|
|
3723
|
+
expect(settled).toMatchObject({ status: 'complete', silent: true });
|
|
3724
|
+
expect(backgroundTurns[0]).toMatchObject({ readOnly: true, allowSilent: true });
|
|
3725
|
+
expect(service.contactMessages(assistant.id).messages).toHaveLength(before);
|
|
3726
|
+
expect(onContactTurnComplete).not.toHaveBeenCalled();
|
|
3727
|
+
expect(service.snapshot().assistants[0].working).toBe(false);
|
|
3728
|
+
} finally {
|
|
3729
|
+
service.close();
|
|
3730
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
3731
|
+
}
|
|
3732
|
+
});
|
|
3733
|
+
|
|
3635
3734
|
it('reconciles a missed assigned-session idle on boot and the 60s timer with resume and no canned settle', async () => {
|
|
3636
3735
|
const directory = root();
|
|
3637
3736
|
const first = setup(directory);
|
|
@@ -25,8 +25,12 @@ Only changed `titleRefresh` fields are persisted. Transient fields are removed
|
|
|
25
25
|
with RFC 7386 `null`, so `isGenerating` and `requestedAt` cannot survive a clear.
|
|
26
26
|
Manual rename clears loading, pending requests, and old errors; a new smart-title
|
|
27
27
|
request clears stale loading/errors before admission. Model generation has a
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
10-second deadline per attempt. Failed, empty, or timed-out generations retry
|
|
29
|
+
twice after 1s and 2s backoff (three attempts maximum); loading is set for each
|
|
30
|
+
attempt and clears before backoff, on success, failure, or timeout. Each attempt
|
|
31
|
+
publishes `generationExpiresAt` (10s deadline); clients expire loading locally
|
|
32
|
+
even if cleanup events are lost or the Host exits. Stopping the runtime or
|
|
33
|
+
receiving a newer request prevents further retries. Late timed-out results cannot write titles. A request received
|
|
30
34
|
during generation is retained and runs after that attempt settles; the obsolete
|
|
31
35
|
attempt does not commit its title or consume the newer request. Cleanup writes
|
|
32
36
|
the narrow metadata patch directly rather than depending on another session GET.
|
|
@@ -45,7 +45,7 @@ it.each([false, true, 'timeout'])('runs a Host smart-title request and clears lo
|
|
|
45
45
|
sessionID: session.id, directory: '/repo', metadata,
|
|
46
46
|
} });
|
|
47
47
|
await vi.runAllTimersAsync();
|
|
48
|
-
expect(generate).toHaveBeenCalledTimes(1);
|
|
48
|
+
expect(generate).toHaveBeenCalledTimes(fail ? 3 : 1);
|
|
49
49
|
expect(session.title).toBe(fail ? 'Original' : 'Title refresh');
|
|
50
50
|
if (fail) expect(session.metadata.yuri.titleRefresh.lastError).toBe(fail === 'timeout' ? 'Title generation timed out' : 'title model unavailable');
|
|
51
51
|
expect(session.metadata.yuri.titleRefresh.isGenerating).not.toBe(true);
|
|
@@ -56,6 +56,63 @@ it.each([false, true, 'timeout'])('runs a Host smart-title request and clears lo
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
it.each(['timeout', 'error', 'empty', 'stop'])('bounds automatic title retries with backoff (%s)', async (failure) => {
|
|
60
|
+
vi.useFakeTimers();
|
|
61
|
+
const session = { id: 'ses_backoff', title: 'Original', metadata: { yuri: {
|
|
62
|
+
titleRefresh: { lastAutoTitle: 'Original', requestedAt: 1000 },
|
|
63
|
+
} } };
|
|
64
|
+
const lateResults = [];
|
|
65
|
+
const generate = vi.fn().mockImplementation(() => {
|
|
66
|
+
if (failure === 'timeout') return new Promise((resolve) => lateResults.push(resolve));
|
|
67
|
+
if (failure === 'empty') return Promise.resolve({ text: ' ' });
|
|
68
|
+
return Promise.reject(new Error('Unavailable'));
|
|
69
|
+
});
|
|
70
|
+
const runtime = createSessionTitleRuntime({
|
|
71
|
+
sessionAccess: {
|
|
72
|
+
get: async () => structuredClone(session),
|
|
73
|
+
messages: async () => [{ info: { id: 'u1', role: 'user' }, parts: [{ type: 'text', text: 'Title retry' }] }],
|
|
74
|
+
update: async (_id, _directory, patch) => {
|
|
75
|
+
if (patch.metadata) session.metadata = mergeMetadataPatch(session.metadata, patch.metadata);
|
|
76
|
+
if (patch.title) session.title = patch.title;
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
getSmallModelService: async () => ({ generateSmallModelText: generate }),
|
|
80
|
+
});
|
|
81
|
+
try {
|
|
82
|
+
runtime.processPayload({ type: 'yuri:session-metadata', properties: {
|
|
83
|
+
sessionID: session.id, metadata: session.metadata,
|
|
84
|
+
} });
|
|
85
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
86
|
+
expect(generate).toHaveBeenCalledTimes(1);
|
|
87
|
+
const duration = failure === 'timeout' ? 10_000 : 0;
|
|
88
|
+
await vi.advanceTimersByTimeAsync(duration + 999);
|
|
89
|
+
expect(generate).toHaveBeenCalledTimes(1);
|
|
90
|
+
expect(session.metadata.yuri.titleRefresh.isGenerating).toBeUndefined();
|
|
91
|
+
expect(session.metadata.yuri.titleRefresh.generationExpiresAt).toBeUndefined();
|
|
92
|
+
if (failure === 'stop') {
|
|
93
|
+
runtime.stop();
|
|
94
|
+
await vi.runAllTimersAsync();
|
|
95
|
+
expect(generate).toHaveBeenCalledTimes(1);
|
|
96
|
+
expect(session.metadata.yuri.titleRefresh.isGenerating).toBeUndefined();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
100
|
+
expect(generate).toHaveBeenCalledTimes(2);
|
|
101
|
+
await vi.advanceTimersByTimeAsync(duration + 1999);
|
|
102
|
+
expect(generate).toHaveBeenCalledTimes(2);
|
|
103
|
+
generate.mockResolvedValueOnce({ text: 'Recovered', providerID: 'test', modelID: 'test' });
|
|
104
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
105
|
+
expect(generate).toHaveBeenCalledTimes(3);
|
|
106
|
+
expect(session.title).toBe('Recovered');
|
|
107
|
+
expect(session.metadata.yuri.titleRefresh.isGenerating).toBeUndefined();
|
|
108
|
+
expect(session.metadata.yuri.titleRefresh.lastError).toBeUndefined();
|
|
109
|
+
for (const resolve of lateResults) resolve({ text: 'Obsolete' });
|
|
110
|
+
await vi.runAllTimersAsync();
|
|
111
|
+
expect(generate).toHaveBeenCalledTimes(3);
|
|
112
|
+
expect(session.title).toBe('Recovered');
|
|
113
|
+
} finally { runtime.stop(); }
|
|
114
|
+
});
|
|
115
|
+
|
|
59
116
|
it('runs a retry after a hung generation expires and ignores its late result', async () => {
|
|
60
117
|
vi.useFakeTimers();
|
|
61
118
|
const session = { id: 'ses_retry', title: 'Original', metadata: { yuri: {
|
|
@@ -345,7 +402,7 @@ it.each([false, true].flatMap((missedEvent) =>
|
|
|
345
402
|
runtime.processPayload(firstAdmission);
|
|
346
403
|
await vi.runAllTimersAsync();
|
|
347
404
|
}
|
|
348
|
-
expect(generate).toHaveBeenCalledTimes(1);
|
|
405
|
+
expect(generate).toHaveBeenCalledTimes(result === 'failure' ? 3 : 1);
|
|
349
406
|
expect(generate.mock.calls[0][0].prompt).toContain('Implement the alternate direction');
|
|
350
407
|
expect(session.title).toBe(['new-title', 'metadata-retry'].includes(result) ? 'Fork direction' : 'Original (fork #1)');
|
|
351
408
|
expect(session.metadata.yuri.titleRefresh.isGenerating).toBeUndefined();
|
|
@@ -360,7 +417,7 @@ it.each([false, true].flatMap((missedEvent) =>
|
|
|
360
417
|
await vi.runAllTimersAsync();
|
|
361
418
|
runtime.processPayload({ type: 'session.execution.succeeded', data: { sessionID: session.id } });
|
|
362
419
|
await vi.runAllTimersAsync();
|
|
363
|
-
expect(generate).toHaveBeenCalledTimes(1);
|
|
420
|
+
expect(generate).toHaveBeenCalledTimes(result === 'failure' ? 3 : 1);
|
|
364
421
|
} finally { runtime.stop(); }
|
|
365
422
|
});
|
|
366
423
|
|