tencil 0.6.0 → 0.6.1
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/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/overlay.global.js +106 -8
- package/dist/{server-COf9gtqR.mjs → server-CbF3t-Cx.mjs} +31 -6
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as parsePairingInput, a as detectAgents, c as savedProvider, f as VERSION, g as exchangePairingCredential, h as createLocalPairingCode, i as PROVIDERS, m as DEFAULT_T3_URL, n as probeDaemon, o as providerLabel, p as CredentialStore, r as startDaemon, s as saveProvider, t as DEFAULT_PORT, u as defaultDataDir, v as withoutNpmEnv, y as loadAgentSdk } from "./server-
|
|
2
|
+
import { _ as parsePairingInput, a as detectAgents, c as savedProvider, f as VERSION, g as exchangePairingCredential, h as createLocalPairingCode, i as PROVIDERS, m as DEFAULT_T3_URL, n as probeDaemon, o as providerLabel, p as CredentialStore, r as startDaemon, s as saveProvider, t as DEFAULT_PORT, u as defaultDataDir, v as withoutNpmEnv, y as loadAgentSdk } from "./server-CbF3t-Cx.mjs";
|
|
3
3
|
import { t as DEFAULT_CLOUD_URL } from "./cloud-CiwIrP1h.mjs";
|
|
4
4
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
5
5
|
import { existsSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as renderPrompt, S as Bridge, b as ProjectResolver, d as projectStorePath, l as FileThreadStore, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, u as defaultDataDir, w as stripContext, x as projectRoot } from "./server-
|
|
1
|
+
import { C as renderPrompt, S as Bridge, b as ProjectResolver, d as projectStorePath, l as FileThreadStore, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, u as defaultDataDir, w as stripContext, x as projectRoot } from "./server-CbF3t-Cx.mjs";
|
|
2
2
|
export { Bridge, DEFAULT_PORT, ProjectResolver, FileThreadStore as ThreadStore, defaultDataDir, probeDaemon, projectRoot, projectStorePath, renderPrompt, startDaemon, stripContext };
|
package/dist/overlay.global.js
CHANGED
|
@@ -66,11 +66,11 @@ let Po=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Fo=[`rsc://`,`file:///`,`webpack-internal://`
|
|
|
66
66
|
`),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,[r]=Yo(n);if(!r?.fileName)break;let i=mo(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),gc.set(e,n),n}while(a>=1&&o>=0);break}}}finally{hc=!1,Go(r),pc(i),console.error=a,console.warn=o}let s=mo(e),c=s?Z(s):``;return gc.set(e,c),c},vc=(e,t)=>{let n=``,r=Qa(e);switch(e.tag){case r.ActivityComponent:n=Z(`Activity`);break;case r.ClassComponent:n=_c(e.type,!0);break;case r.ForwardRef:n=_c(po(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=_c(po(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=Z(e.type));break;case r.LazyComponent:n=Z(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?Z(`Suspense Fallback`):Z(`Suspense`);break;case r.SuspenseListComponent:n=Z(`SuspenseList`);break;case r.ViewTransitionComponent:n=Z(`ViewTransition`);break;default:return``}return n},yc=e=>{try{let t=``,n=e,r=null;do{t+=vc(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=mc(r.name,r.env,r.debugLocation))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nBippy couldn’t generate the stack: ${e.message}\n${e.stack}`:``}},bc=e=>{let t=e;if(!t)return``;t.startsWith(`Error: react-stack-top-frame
|
|
67
67
|
`)&&(t=t.slice(29));let n=t.indexOf(`
|
|
68
68
|
`);n!==-1&&(t=t.slice(n+1));let r=Math.max(...Ho.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
|
|
69
|
-
`,r)),r!==-1)t=t.slice(0,r);else return``;return t},xc=e=>!!(e.functionName&&e.fileName&&Tc(e.fileName)),Sc=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Cc=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!xc(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>Sc(e,n))||(r.push(n),t.set(e,r))}return t},wc=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(Vo,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},Tc=e=>Io.some(t=>e.startsWith(t)),Ec=e=>!e.isServer&&e.fileName&&Tc(e.fileName)?{...e,isServer:!0}:e,Dc=e=>{let t=[],n=e;for(;n;)if(uc(n)){let e=n;if(n=e._debugOwner,n&&lc(e)){let{frames:n,isTrusted:r}=is(e._debugStack);if(r)for(let e of n)t.push(Ec(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of is(e.debugStack).frames)t.push({...n,isServer:!0})}return t},Oc=e=>{let t=[];return co(e,e=>{if(!lc(e))return;let{frames:n,isTrusted:r}=is(e._debugStack);r&&t.push(...n)},!0),t},kc=e=>{let t=Oc(e),n=Yo(yc(e)),r=Cc(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&Vo.test(e.source)?wc(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},Ac=async(e,t=!0,n,r={})=>cc(kc(e),t,n,r),jc=e=>!!e.fileName&&!e.isIgnoreListed,Mc=async(e,t=!0,n,r={})=>{let i=Dc(e);if(i.length>0){let a=dc(e)??{};a.functionName=mo(e.type)??a.functionName;let o=await cc([a,...i],t,n,r);if(o.some((e,t)=>t>0&&jc(e)))return o}return Ac(e,t,n,r)},Nc=e=>e.split(`/`).filter(Boolean).length,Pc=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(Nc(n)!==1)return e;let r=e.slice(t);if(!Ro.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},Fc=e=>{if(!e||Lo.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=Pc(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of Fo)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(Po);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);Bo.test(e)&&(t=t.slice(0,i))}return t},Ic=e=>{let t=Fc(e);return!(!t||!Ro.test(t)||zo.test(t))},Lc=Symbol.for(`react.context`),Rc=Symbol.for(`react.recoverable`),zc=[],Bc=null,Vc=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),Q=()=>{let e=Bc;return e!==null&&(Bc=e.next),e},Hc=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,Uc=e=>typeof e==`object`&&!!e&&`current`in e,Wc=e=>typeof e==`object`&&!!e&&`_currentValue`in e,Gc=e=>e._currentValue,$=(e,t,n,r=null,i=null)=>{zc.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},Kc=e=>{if(typeof e==`object`&&e){if(Hc(e)){let t=e,n=Hc(t)?t:e;switch(n.status){case`fulfilled`:return $(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw $(`Unresolved`,n,`Use`,null,n._debugInfo??null),Vc}if(`$$typeof`in e&&e.$$typeof===Rc){$(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===Lc&&Wc(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=Gc(t);return $(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new eo(`use() received an unsupported value: `+String(e))},qc=e=>{let t=Gc(e);return $(`Context`,t,`Context`,e.displayName||null),t},Jc=e=>{let t=Q(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return $(`State`,n,`State`),[n,()=>{}]},Yc=(e,t,n)=>{let r=Q(),i=r===null?n===void 0?t:n(t):r.memoizedState;return $(`Reducer`,i,`Reducer`),[i,()=>{}]},Xc=e=>{let t=Q(),n=Uc(t?.memoizedState)?t.memoizedState:{current:e};return $(`Ref`,n.current,`Ref`),n},Zc=()=>{let e=Q();return $(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Qc=e=>{Q(),$(`LayoutEffect`,e,`LayoutEffect`)},$c=e=>{Q(),$(`InsertionEffect`,e,`InsertionEffect`)},el=e=>{Q(),$(`Effect`,e,`Effect`)},tl=e=>{Q();let t=Uc(e)?e.current:void 0;$(`ImperativeHandle`,t,`ImperativeHandle`)},nl=(e,t)=>{$(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},rl=e=>{let t=Q();return $(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},il=e=>{let t=Q(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return $(`Memo`,n,`Memo`),n},al=(e,t)=>{let n=Q();Q();let r=n===null?t():n.memoizedState;return $(`SyncExternalStore`,r,`SyncExternalStore`),r},ol=()=>{let e=Q();Q();let t=e?.memoizedState===!0;return $(`Transition`,t,`Transition`),[t,()=>{}]},sl=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`DeferredValue`,n,`DeferredValue`),n},cl=()=>{let e=Q(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return $(`Id`,t,`Id`),t},ll=e=>[],ul=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`Optimistic`,n,`Optimistic`),[n,()=>{}]},dl=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(Hc(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=Vc,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},fl=e=>(t,n)=>{let r=Q();Q(),Q();let{value:i,debugInfo:a,error:o}=dl(r,n);if($(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},pl=fl(`ActionState`),ml={readContext:Gc,use:Kc,useCallback:rl,useContext:qc,useEffect:el,useImperativeHandle:tl,useLayoutEffect:Qc,useInsertionEffect:$c,useMemo:il,useReducer:Yc,useRef:Xc,useState:Jc,useDebugValue:nl,useDeferredValue:sl,useTransition:ol,useSyncExternalStore:al,useId:cl,useHostTransitionStatus:()=>{let e=Gc({_currentValue:null});return $(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:fl(`FormState`),useActionState:pl,useOptimistic:ul,useMemoCache:ll,useCacheRefresh:Zc,useEffectEvent:e=>(Q(),$(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(ml,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new to(`The React dispatcher is missing method `+t)}});let hl=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return hl(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([$,...Object.values(ml)].map(e=>hl(e.name)));async function gl(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim();return{tagName:e.tagName.toLowerCase(),selector:vl(e),html:Cl(e),text:Tl(e),components:await El(e),rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function _l(e){let t=e.tagName.toLowerCase(),n=Ml(e);if(!n)return t;let r=null;return co(n,e=>so(e)?(r=mo(e.type),!(!r||Nl(r))):!1,!0),r?`${r} · ${t}`:t}function vl(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=yl(n);if(r){t.unshift(r);let n=t.join(` > `);if(xl(n,e))return n}else{t.unshift(bl(n));let r=t.join(` > `);if(t.length>=2&&xl(r,e))return r}n=n.parentElement}return t.join(` > `)}function yl(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function bl(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function xl(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let Sl=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function Cl(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>wl(e.name)-wl(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${Ll(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:Ll(e.textContent?.trim()??``,100)}</${t}>`}function wl(e){let t=Sl.indexOf(e);return t===-1?Sl.length:t}function Tl(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?Ll(t,200):void 0}async function El(e){let t=Dl(e);if(t.length>0)return t;let n=Ml(e);if(!n)return[];try{let e=await Rl(Mc(n),1500),t=kl(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!Nl(e.functionName)).slice(0,6).map(e=>Al(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return jl(n)}function Dl(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??Ol(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function Ol(e){return e.slice(e.lastIndexOf(`/`)+1)}function kl(e){let t=/* @__PURE__ */ new Map;try{for(let n of Dc(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,Fl(n.fileName))}catch{}return t}function Al(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=Il(e.fileName);return r?{name:n,library:r}:Ic(e.fileName)?{name:n,source:{file:Pl(Fl(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function jl(e){let t=[];return co(e,e=>{if(so(e)){let n=mo(e.type);n&&!Nl(n)&&t.push({name:n})}return t.length>=6},!0),t}function Ml(e){try{return No(e)}catch{return null}}function Nl(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function Pl(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function Fl(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function Il(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function Ll(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function Rl(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let zl=I(()=>{let e=/* @__PURE__ */ new Map,t=[...bn.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function Bl(){let e=Cn.value.flatMap(e=>{let t=zl.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&U({type:`drafts.send`,drafts:e})&&(K.value=e[0]?.threadId??null)}function Vl(){if(dn.value)return null;let e=G.value;return/* @__PURE__ */ Y(S,{children:[xn.value.map(e=>/* @__PURE__ */ Y(Hl,{thread:e},e.id)),e&&/* @__PURE__ */ Y(Jl,{})]})}function Hl({thread:e}){if(_n.value,!e.anchor)return null;let t=gn.value,n=t?.threadId===e.id,r=n?t.point:jn(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Y(`button`,{type:`button`,class:`pin pin-${Yl(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Wl(t,e,r),onClick:()=>{if(Ul===e.id){Ul=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:zl.value.get(e.id)??`•`})})}let Ul=null;function Wl(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Ul=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!gn.value&&Math.hypot(r,o)<4||(gn.value={threadId:t.id,point:{x:n.x+r,y:n.y+o}})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Gl,!0);let n=gn.value;n&&(gn.value=null,Ul=t.id,e.type===`pointerup`&&Kl(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Gl,!0)}function Gl(e){e.preventDefault()}function Kl(e,t){let n=ql(t);if(!n)return;let r={selector:vl(n),...Mn(n,t)};U({type:`thread.move`,threadId:e.id,anchor:r})&&en({...e,anchor:r})}function ql(e){let t=kn();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??null}function Jl(){_n.value;let e=G.value,t=jn(e.anchor,e.element);return t?/* @__PURE__ */ Y(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:`+`})}):null}function Yl(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let Xl=`tencil:open`;function Zl(){let[e,t]=A(`page`),n=z.value?.label??`Agent`,r=R.value===`open`&&z.value?.state===`ready`,i=z.value?.id;return Me(()=>{r&&q.value&&e===`provider`&&an()},[e,q.value,r,i]),q.value?/* @__PURE__ */ Y(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Y(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Y(`div`,{class:`segmented`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{q.value=!1},children:/* @__PURE__ */ Y(ea,{})})]}),e===`provider`?/* @__PURE__ */ Y($l,{label:n}):/* @__PURE__ */ Y(Ql,{scope:e})]}):null}function Ql({scope:e}){let t=bn.value.filter(e=>un.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&yn(t.pageUrl)===vn.value);return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Y(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Y(`input`,{type:`checkbox`,class:`checkbox-input`,checked:un.value,onChange:e=>{un.value=e.target.checked}}),/* @__PURE__ */ Y(Xi,{})]}),`Show resolved`]}),/* @__PURE__ */ Y(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`No pins yet. Press `,/* @__PURE__ */ Y(`kbd`,{children:`C`}),` and click anything on the page.`]}):t.map(e=>/* @__PURE__ */ Y(nu,{thread:e},e.id))})]})}function $l({label:e}){let t=zt.value;return t?t.length===0?/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Y(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Y(eu,{summary:e},e.id))}):/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function eu({summary:e}){let t=Bt.value,n=[...V.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Y(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=sn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Y(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Y(tu,{project:t}),/* @__PURE__ */ Y(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Y(`span`,{class:`provider-item-state state-${e.status}`,children:au(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Y(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Y(`span`,{class:`provider-item-time`,children:ou(e.updatedAt)})]}),/* @__PURE__ */ Y(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Y(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Y(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Y(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Y(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Y(Ui,{agent:e.agent})]})]})}function tu({project:e}){return e.emoji?/* @__PURE__ */ Y(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Y(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Y(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function nu({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||yn(e.pageUrl)===vn.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Y(`button`,{type:`button`,class:`inbox-item${K.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(Xl,e.id),location.href=e.pageUrl;return}K.value=e.id,ru(e)},children:[t?/* @__PURE__ */ Y(`span`,{class:`pin pin-static pin-${Yl(e)}`,children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:zl.value.get(e.id)})}):/* @__PURE__ */ Y(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Y(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Y(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Y(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Y(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Y(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),iu(e),` · `,ou(e.updatedAt)]}),r&&/* @__PURE__ */ Y(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function ru(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function iu(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function au(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function ou(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function su({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=A(t),u=j(null);Me(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Me(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Y(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Y(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Y(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Y(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Y(`span`,{class:`spinner`}):/* @__PURE__ */ Y(Ji,{})})]})]})}let cu=F(null);function lu(){_n.value;let e=G.value,t=j(null),[n,r]=A(140),[i,a]=A(!1),[o,s]=A(!1),[c,l]=A(null),u=z.value?.state===`ready`,d=z.value?.id;if(Me(()=>{e&&u&&(an(),on())},[e,u,d]),Me(()=>{cu.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=jn(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Pn(f,{width:340,height:n}),g=z.value,_=g?.state===`ready`,v=mn.value,y=v?null:cu.value,b=y?void 0:uu(g?.id);return/* @__PURE__ */ Y(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Y(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Y(`span`,{class:`chip`,children:[/* @__PURE__ */ Y(na,{}),e.label]}),g&&v&&/* @__PURE__ */ Y(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Cn.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Y(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Y(oa,{})]})]}),c===`target`&&!v&&/* @__PURE__ */ Y(fu,{onPick:e=>{cu.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Y(du,{choices:b,onPick:e=>{U({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Y(su,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=await e.context,r=[];if(i){let t=await Ri(e.element,kn());t&&r.push(t)}let a=It(),o={...e.anchor,selector:n.selector};if(!U({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();en({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),G.value=null,v?Tn():K.value=a}finally{s(!1)}},onCancel:()=>{G.value=null},children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Y(ta,{})}),fn.value&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{pn.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Y(aa,{})}),b&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Y(Ui,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Y(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Y(oa,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Y(`p`,{class:`hint`,children:g.detail})]})}function uu(e){let t=Vt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(B.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function du({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Y(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Y(Ui,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function fu({onPick:e}){let t=zt.value,n=cu.value?.id??null;return/* @__PURE__ */ Y(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Y(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Y(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Y(Ui,{agent:t.agent,size:12}),/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:ou(t.updatedAt)})]},t.id))]})}function pu(){_n.value;let e=cn.value;if(W.value!==`picking`||!e)return null;let t=e.getBoundingClientRect(),n=t.top<28;return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`highlight`,style:{transform:`translate(${t.left}px, ${t.top}px)`,width:`${t.width}px`,height:`${t.height}px`}}),/* @__PURE__ */ Y(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[_l(e),/* @__PURE__ */ Y(`span`,{class:`highlight-size`,children:[Math.round(t.width),`×`,Math.round(t.height)]})]})]})}function mu({text:e,animate:t=!1}){let n=t?yu(e):0;return/* @__PURE__ */ Y(`div`,{class:`md`,children:hu(e,{index:0,animateFrom:t?n-48:1/0})})}function hu(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
69
|
+
`,r)),r!==-1)t=t.slice(0,r);else return``;return t},xc=e=>!!(e.functionName&&e.fileName&&Tc(e.fileName)),Sc=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Cc=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!xc(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>Sc(e,n))||(r.push(n),t.set(e,r))}return t},wc=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(Vo,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},Tc=e=>Io.some(t=>e.startsWith(t)),Ec=e=>!e.isServer&&e.fileName&&Tc(e.fileName)?{...e,isServer:!0}:e,Dc=e=>{let t=[],n=e;for(;n;)if(uc(n)){let e=n;if(n=e._debugOwner,n&&lc(e)){let{frames:n,isTrusted:r}=is(e._debugStack);if(r)for(let e of n)t.push(Ec(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of is(e.debugStack).frames)t.push({...n,isServer:!0})}return t},Oc=e=>{let t=[];return co(e,e=>{if(!lc(e))return;let{frames:n,isTrusted:r}=is(e._debugStack);r&&t.push(...n)},!0),t},kc=e=>{let t=Oc(e),n=Yo(yc(e)),r=Cc(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&Vo.test(e.source)?wc(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},Ac=async(e,t=!0,n,r={})=>cc(kc(e),t,n,r),jc=e=>!!e.fileName&&!e.isIgnoreListed,Mc=async(e,t=!0,n,r={})=>{let i=Dc(e);if(i.length>0){let a=dc(e)??{};a.functionName=mo(e.type)??a.functionName;let o=await cc([a,...i],t,n,r);if(o.some((e,t)=>t>0&&jc(e)))return o}return Ac(e,t,n,r)},Nc=e=>e.split(`/`).filter(Boolean).length,Pc=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(Nc(n)!==1)return e;let r=e.slice(t);if(!Ro.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},Fc=e=>{if(!e||Lo.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=Pc(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of Fo)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(Po);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);Bo.test(e)&&(t=t.slice(0,i))}return t},Ic=e=>{let t=Fc(e);return!(!t||!Ro.test(t)||zo.test(t))},Lc=Symbol.for(`react.context`),Rc=Symbol.for(`react.recoverable`),zc=[],Bc=null,Vc=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),Q=()=>{let e=Bc;return e!==null&&(Bc=e.next),e},Hc=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,Uc=e=>typeof e==`object`&&!!e&&`current`in e,Wc=e=>typeof e==`object`&&!!e&&`_currentValue`in e,Gc=e=>e._currentValue,$=(e,t,n,r=null,i=null)=>{zc.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},Kc=e=>{if(typeof e==`object`&&e){if(Hc(e)){let t=e,n=Hc(t)?t:e;switch(n.status){case`fulfilled`:return $(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw $(`Unresolved`,n,`Use`,null,n._debugInfo??null),Vc}if(`$$typeof`in e&&e.$$typeof===Rc){$(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===Lc&&Wc(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=Gc(t);return $(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new eo(`use() received an unsupported value: `+String(e))},qc=e=>{let t=Gc(e);return $(`Context`,t,`Context`,e.displayName||null),t},Jc=e=>{let t=Q(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return $(`State`,n,`State`),[n,()=>{}]},Yc=(e,t,n)=>{let r=Q(),i=r===null?n===void 0?t:n(t):r.memoizedState;return $(`Reducer`,i,`Reducer`),[i,()=>{}]},Xc=e=>{let t=Q(),n=Uc(t?.memoizedState)?t.memoizedState:{current:e};return $(`Ref`,n.current,`Ref`),n},Zc=()=>{let e=Q();return $(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Qc=e=>{Q(),$(`LayoutEffect`,e,`LayoutEffect`)},$c=e=>{Q(),$(`InsertionEffect`,e,`InsertionEffect`)},el=e=>{Q(),$(`Effect`,e,`Effect`)},tl=e=>{Q();let t=Uc(e)?e.current:void 0;$(`ImperativeHandle`,t,`ImperativeHandle`)},nl=(e,t)=>{$(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},rl=e=>{let t=Q();return $(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},il=e=>{let t=Q(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return $(`Memo`,n,`Memo`),n},al=(e,t)=>{let n=Q();Q();let r=n===null?t():n.memoizedState;return $(`SyncExternalStore`,r,`SyncExternalStore`),r},ol=()=>{let e=Q();Q();let t=e?.memoizedState===!0;return $(`Transition`,t,`Transition`),[t,()=>{}]},sl=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`DeferredValue`,n,`DeferredValue`),n},cl=()=>{let e=Q(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return $(`Id`,t,`Id`),t},ll=e=>[],ul=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`Optimistic`,n,`Optimistic`),[n,()=>{}]},dl=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(Hc(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=Vc,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},fl=e=>(t,n)=>{let r=Q();Q(),Q();let{value:i,debugInfo:a,error:o}=dl(r,n);if($(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},pl=fl(`ActionState`),ml={readContext:Gc,use:Kc,useCallback:rl,useContext:qc,useEffect:el,useImperativeHandle:tl,useLayoutEffect:Qc,useInsertionEffect:$c,useMemo:il,useReducer:Yc,useRef:Xc,useState:Jc,useDebugValue:nl,useDeferredValue:sl,useTransition:ol,useSyncExternalStore:al,useId:cl,useHostTransitionStatus:()=>{let e=Gc({_currentValue:null});return $(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:fl(`FormState`),useActionState:pl,useOptimistic:ul,useMemoCache:ll,useCacheRefresh:Zc,useEffectEvent:e=>(Q(),$(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(ml,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new to(`The React dispatcher is missing method `+t)}});let hl=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return hl(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([$,...Object.values(ml)].map(e=>hl(e.name)));async function gl(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim();return{tagName:e.tagName.toLowerCase(),selector:vl(e),html:Cl(e),text:Tl(e),components:await El(e),rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function _l(e){let t=e.tagName.toLowerCase(),n=Ml(e);if(!n)return t;let r=null;return co(n,e=>so(e)?(r=mo(e.type),!(!r||Nl(r))):!1,!0),r?`${r} · ${t}`:t}function vl(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=yl(n);if(r){t.unshift(r);let n=t.join(` > `);if(xl(n,e))return n}else{t.unshift(bl(n));let r=t.join(` > `);if(t.length>=2&&xl(r,e))return r}n=n.parentElement}return t.join(` > `)}function yl(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function bl(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function xl(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let Sl=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function Cl(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>wl(e.name)-wl(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${Ll(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:Ll(e.textContent?.trim()??``,100)}</${t}>`}function wl(e){let t=Sl.indexOf(e);return t===-1?Sl.length:t}function Tl(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?Ll(t,200):void 0}async function El(e){let t=Dl(e);if(t.length>0)return t;let n=Ml(e);if(!n)return[];try{let e=await Rl(Mc(n),1500),t=kl(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!Nl(e.functionName)).slice(0,6).map(e=>Al(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return jl(n)}function Dl(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??Ol(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function Ol(e){return e.slice(e.lastIndexOf(`/`)+1)}function kl(e){let t=/* @__PURE__ */ new Map;try{for(let n of Dc(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,Fl(n.fileName))}catch{}return t}function Al(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=Il(e.fileName);return r?{name:n,library:r}:Ic(e.fileName)?{name:n,source:{file:Pl(Fl(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function jl(e){let t=[];return co(e,e=>{if(so(e)){let n=mo(e.type);n&&!Nl(n)&&t.push({name:n})}return t.length>=6},!0),t}function Ml(e){try{return No(e)}catch{return null}}function Nl(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function Pl(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function Fl(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function Il(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function Ll(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function Rl(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let zl=I(()=>{let e=/* @__PURE__ */ new Map,t=[...bn.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function Bl(){let e=Cn.value.flatMap(e=>{let t=zl.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&U({type:`drafts.send`,drafts:e})&&(K.value=e[0]?.threadId??null)}function Vl(){let e=Hl();if(dn.value)return null;let t=G.value;return/* @__PURE__ */ Y(S,{children:[xn.value.map(e=>/* @__PURE__ */ Y(Wl,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Y(Ul,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Y(Zl,{})]})}function Hl(){let e=xn.value,t=vn.value,n=j({page:t,pins:[]}),[r,i]=A([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:zl.value.get(e.id),variant:Ql(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:V.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function Ul({pin:e}){_n.value;let t=e.thread.anchor?jn(e.thread.anchor):null;return t?/* @__PURE__ */ Y(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Y(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Y(Xi,{})}),/* @__PURE__ */ Y(`span`,{class:`pin-shine`})]})]})}):null}function Wl({thread:e}){if(_n.value,!e.anchor)return null;let t=gn.value,n=t?.threadId===e.id,r=n?t.point:jn(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Y(`button`,{type:`button`,class:`pin pin-${Ql(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Kl(t,e,r),onClick:()=>{if(Gl===e.id){Gl=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:zl.value.get(e.id)??`•`})})}let Gl=null;function Kl(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Gl=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!gn.value&&Math.hypot(r,o)<4||(gn.value={threadId:t.id,point:ql({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Jl,!0);let n=gn.value;n&&(gn.value=null,Gl=t.id,e.type===`pointerup`&&Yl(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Jl,!0)}function ql(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Jl(e){e.preventDefault()}function Yl(e,t){let n=Xl(t);if(!n)return;let r={selector:vl(n),...Mn(n,t)};U({type:`thread.move`,threadId:e.id,anchor:r})&&en({...e,anchor:r})}function Xl(e){let t=kn();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function Zl(){_n.value;let e=G.value,t=jn(e.anchor,e.element);return t?/* @__PURE__ */ Y(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:`+`})}):null}function Ql(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let $l=`tencil:open`;function eu(){let[e,t]=A(`page`),n=z.value?.label??`Agent`,r=R.value===`open`&&z.value?.state===`ready`,i=z.value?.id;return Me(()=>{r&&q.value&&e===`provider`&&an()},[e,q.value,r,i]),q.value?/* @__PURE__ */ Y(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Y(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Y(`div`,{class:`segmented`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{q.value=!1},children:/* @__PURE__ */ Y(ea,{})})]}),e===`provider`?/* @__PURE__ */ Y(nu,{label:n}):/* @__PURE__ */ Y(tu,{scope:e})]}):null}function tu({scope:e}){let t=bn.value.filter(e=>un.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&yn(t.pageUrl)===vn.value);return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Y(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Y(`input`,{type:`checkbox`,class:`checkbox-input`,checked:un.value,onChange:e=>{un.value=e.target.checked}}),/* @__PURE__ */ Y(Xi,{})]}),`Show resolved`]}),/* @__PURE__ */ Y(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`No pins yet. Press `,/* @__PURE__ */ Y(`kbd`,{children:`C`}),` and click anything on the page.`]}):t.map(e=>/* @__PURE__ */ Y(au,{thread:e},e.id))})]})}function nu({label:e}){let t=zt.value;return t?t.length===0?/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Y(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Y(ru,{summary:e},e.id))}):/* @__PURE__ */ Y(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function ru({summary:e}){let t=Bt.value,n=[...V.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Y(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=sn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Y(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Y(iu,{project:t}),/* @__PURE__ */ Y(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Y(`span`,{class:`provider-item-state state-${e.status}`,children:cu(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Y(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Y(`span`,{class:`provider-item-time`,children:lu(e.updatedAt)})]}),/* @__PURE__ */ Y(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Y(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Y(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Y(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Y(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Y(Ui,{agent:e.agent})]})]})}function iu({project:e}){return e.emoji?/* @__PURE__ */ Y(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Y(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Y(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function au({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||yn(e.pageUrl)===vn.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Y(`button`,{type:`button`,class:`inbox-item${K.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem($l,e.id),location.href=e.pageUrl;return}K.value=e.id,ou(e)},children:[t?/* @__PURE__ */ Y(`span`,{class:`pin pin-static pin-${Ql(e)}`,children:/* @__PURE__ */ Y(`span`,{class:`pin-body`,children:zl.value.get(e.id)})}):/* @__PURE__ */ Y(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Y(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Y(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Y(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Y(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Y(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),su(e),` · `,lu(e.updatedAt)]}),r&&/* @__PURE__ */ Y(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function ou(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function su(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function cu(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function lu(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function uu({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=A(t),u=j(null);Me(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Me(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Y(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Y(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Y(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Y(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Y(`span`,{class:`spinner`}):/* @__PURE__ */ Y(Ji,{})})]})]})}let du=F(null);function fu(){_n.value;let e=G.value,t=j(null),[n,r]=A(140),[i,a]=A(!1),[o,s]=A(!1),[c,l]=A(null),u=z.value?.state===`ready`,d=z.value?.id;if(Me(()=>{e&&u&&(an(),on())},[e,u,d]),Me(()=>{du.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=jn(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Pn(f,{width:340,height:n}),g=z.value,_=g?.state===`ready`,v=mn.value,y=v?null:du.value,b=y?void 0:pu(g?.id);return/* @__PURE__ */ Y(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Y(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Y(`span`,{class:`chip`,children:[/* @__PURE__ */ Y(na,{}),e.label]}),g&&v&&/* @__PURE__ */ Y(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Cn.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Y(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Y(oa,{})]})]}),c===`target`&&!v&&/* @__PURE__ */ Y(hu,{onPick:e=>{du.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Y(mu,{choices:b,onPick:e=>{U({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Y(uu,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=await e.context,r=[];if(i){let t=await Ri(e.element,kn());t&&r.push(t)}let a=It(),o={...e.anchor,selector:n.selector};if(!U({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();en({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),G.value=null,v?Tn():K.value=a}finally{s(!1)}},onCancel:()=>{G.value=null},children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Y(ta,{})}),fn.value&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{pn.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Y(aa,{})}),b&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Y(Ui,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Y(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Y(oa,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Y(`p`,{class:`hint`,children:g.detail})]})}function pu(e){let t=Vt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(B.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function mu({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Y(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Y(Ui,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function hu({onPick:e}){let t=zt.value,n=du.value?.id??null;return/* @__PURE__ */ Y(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Y(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Y(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Y(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Y(Ui,{agent:t.agent,size:12}),/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:lu(t.updatedAt)})]},t.id))]})}function gu(){_n.value;let e=cn.value;if(W.value!==`picking`||!e)return null;let t=e.getBoundingClientRect(),n=t.top<28;return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`highlight`,style:{transform:`translate(${t.left}px, ${t.top}px)`,width:`${t.width}px`,height:`${t.height}px`}}),/* @__PURE__ */ Y(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[_l(e),/* @__PURE__ */ Y(`span`,{class:`highlight-size`,children:[Math.round(t.width),`×`,Math.round(t.height)]})]})]})}function _u({text:e,animate:t=!1}){let n=t?Su(e):0;return/* @__PURE__ */ Y(`div`,{class:`md`,children:vu(e,{index:0,animateFrom:t?n-48:1/0})})}function vu(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
70
70
|
`).split(`
|
|
71
|
-
`),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=
|
|
71
|
+
`),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=Su(e.join(`
|
|
72
72
|
`)),n.push(/* @__PURE__ */ Y(`pre`,{children:/* @__PURE__ */ Y(`code`,{children:e.join(`
|
|
73
|
-
`)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ Y(`li`,{children:_u(e,t)},n));n.push(Y(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ Y(`p`,{class:`md-heading`,children:_u(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ Y(`p`,{children:_u(s.join(` `),t)},a++))}return n}let gu=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function _u(e,t){return e.split(gu).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=yu(e),/* @__PURE__ */ Y(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ Y(`strong`,{children:vu(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ Y(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:vu(r[1],t)},n):vu(e,t)})}function vu(e,t){return t.animateFrom===1/0?(t.index+=yu(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ Y(`span`,{class:`w`,children:e},`w${n}`):e})}function yu(e){let t=e.match(/\S+/g);return t?t.length:0}function bu(){_n.value;let e=K.value,t=e?V.value.get(e):void 0,n=j(null),[r,i]=A(320);if(Ne(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=gn.value,o=a?.threadId===t.id?a.point:t.anchor?jn(t.anchor):null,{left:s,top:c,origin:l}=o?Pn(o,{width:380,height:r}):{left:window.innerWidth-380-(q.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ Y(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ Y(Su,{thread:t}),t.status===`draft`?/* @__PURE__ */ Y(xu,{thread:t}):/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(Cu,{thread:t},t.id),/* @__PURE__ */ Y(Eu,{thread:t},t.id),/* @__PURE__ */ Y(su,{placeholder:wt.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||wt.value!==null,onSubmit:e=>{U({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{K.value=null}})]})]})}function xu({thread:e}){let t=e.messages[0]?.text??``,n=Cn.value.length;return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ Y(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ Y(`button`,{type:`button`,class:`stop`,onClick:Bl,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ Y(su,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&U({type:`thread.edit`,threadId:e.id,prompt:n}),K.value=null},onCancel:()=>{K.value=null}},`${e.id}:${t}`)]})}function Su({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ Y(`div`,{class:`thread-header`,children:[/* @__PURE__ */ Y(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`span`,{class:`thread-number`,children:[`#`,zl.value.get(e.id)]}),/* @__PURE__ */ Y(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ Y(na,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ Y(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ Y(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ Y(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ Y(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${rn(e.provider.id)}`,children:/* @__PURE__ */ Y($i,{})}),e.status!==`draft`&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{U({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(K.value=null)},children:e.resolved?/* @__PURE__ */ Y(Zi,{}):/* @__PURE__ */ Y(Xi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{U({type:`thread.delete`,threadId:e.id}),K.value=null},children:/* @__PURE__ */ Y(Qi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{K.value=null},children:/* @__PURE__ */ Y(ea,{})})]})]})}function Cu({thread:e}){let t=j(null),n=j(null),r=j(!0),[i,a]=A(!1),o=e.messages[e.messages.length-1];return Ne(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Ne(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ Y(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ Y(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ Y(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ Y(wu,{message:e},e.id))})})}function wu({message:e}){let[t]=A(e.streaming);return/* @__PURE__ */ Y(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ Y(mu,{text:e.text,animate:t})})}function Tu({text:e}){let t=[...e];return/* @__PURE__ */ Y(`span`,{class:`shimmer`,children:[/* @__PURE__ */ Y(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ Y(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function Eu({thread:e}){let[t,n]=A(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ Y(S,{children:[t&&r.length>0&&/* @__PURE__ */ Y(Ou,{steps:r,follow:a}),/* @__PURE__ */ Y(Nu,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ Y(`div`,{class:`status-line`,children:/* @__PURE__ */ Y(Du,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,ju(r)?` · ${ju(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ Y(Pu,{delivery:e.delivery})]})}function Du({open:e,onToggle:t,children:n}){return/* @__PURE__ */ Y(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ Y(oa,{})]})}function Ou({steps:e,follow:t}){let n=j(null),r=j(!0);return Ne(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ Y(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ Y(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ Y(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ Y(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ Y(Xi,{}):e.status===`failed`?/* @__PURE__ */ Y(ea,{}):`–`}),/* @__PURE__ */ Y(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ Y(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ Y(`span`,{class:`step-time`,children:Au(e)})]},e.id))})}function ku(e){return e.findLast(e=>e.status===`running`)}function Au(e){return e.endedAt?Mu((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function ju(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return Mu((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function Mu(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function Nu({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ Y(`div`,{class:`status-line`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Tu,{text:`Starting a thread in ${rn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ Y(`div`,{class:`status-line`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),t?/* @__PURE__ */ Y(Du,{...t,children:/* @__PURE__ */ Y(Tu,{text:`${ku(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ Y(Tu,{text:`Working…`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`stop`,onClick:()=>U({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ Y(Yi,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ Y(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ Y(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ Y(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function Pu({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ Y(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ Y(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Tu,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Tu,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ Y(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ Y(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Y(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ Y(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Y(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let Fu=`tencil:dock`,Iu=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],Lu,Ru=F(zu());function zu(){try{let e=localStorage.getItem(Fu);return e&&Iu.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function Bu(e){Ru.value=e;try{localStorage.setItem(Fu,e)}catch{}}function Vu(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function Hu(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=Ku(t);Lu?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,Uu,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=qu(t);Gu(t,p,Vu(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,Uu,!0)}function Uu(e){e.preventDefault()}function Wu(e,t){let[n,r]=Ru.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(Bu(o),t.style.translate=``,!0):!1}function Gu(e,t,n){Bu(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Lu=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};Lu=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Lu=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=qu(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function Ku(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function qu(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let Ju=F(null);function Yu(){let e=()=>{let e=Zu(),t=Ju.value;Qu(e,t)||(Ju.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function Xu(e,t){return!t||e.endsWith(`center`)||Vu((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function Zu(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function Qu(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}function $u(){let[e,t]=A(``),n=Ht.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>U({type:`project.select`,root:e});return/* @__PURE__ */ Y(`div`,{class:`project-picker`,children:[/* @__PURE__ */ Y(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ Y(`p`,{class:`project-picker-empty`,children:Ut.value??`No projects found.`}):/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ Y(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ Y(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ Y(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ Y(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ Y(`span`,{class:`project-picker-root`,children:e.root})]},e.root))]})]})]})}function ed(){if(!ln.value)return null;let e=B.value,t=z.value,n=()=>{ln.value=!1};return/* @__PURE__ */ Y(`section`,{class:`settings-panel`,role:`dialog`,"aria-label":`Project settings`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[/* @__PURE__ */ Y(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Y(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Y(`strong`,{children:`Settings`}),Lt.value&&/* @__PURE__ */ Y(`span`,{class:`settings-project`,children:Lt.value.name})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:n,children:/* @__PURE__ */ Y(ea,{})})]}),e?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Y(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Y(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Y(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Y(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>U({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Y(Ui,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:td(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Y(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Y(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}),/* @__PURE__ */ Y(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-label`,children:`Batch mode`}),/* @__PURE__ */ Y(`span`,{class:`settings-help`,children:[`Adds `,/* @__PURE__ */ Y(aa,{}),` to the comment box to queue comments and send them together.`]})]}),/* @__PURE__ */ Y(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:e.batch,"aria-checked":e.batch,onChange:e=>hn(e.currentTarget.checked)})]})]}):/* @__PURE__ */ Y(`p`,{class:`empty`,children:`Connecting…`}),L.value&&/* @__PURE__ */ Y(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Y(`strong`,{children:L.value.login?`@${L.value.login}`:L.value.name})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`hint-action`,onClick:()=>{At(Xt()),Zt()},children:`Sign out`})]})]})}function td(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function nd({tone:e,label:t}){let[n,r]=A(!1),i=j(void 0);Me(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Y(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Y(`span`,{class:`status-dot status-${e}`,children:wn.value>0&&/* @__PURE__ */ Y(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Y(rd,{tone:e})]})}function rd({tone:e}){let t=z.value,n=R.value,r=Cn.value.length,i=wn.value;return/* @__PURE__ */ Y(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Y(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Y(ia,{size:18}),/* @__PURE__ */ Y(`strong`,{children:`Tencil`}),Rt.value&&/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:[`v`,Rt.value]})]}),/* @__PURE__ */ Y(`dl`,{class:`status-card-rows`,children:[/* @__PURE__ */ Y(id,{label:Yt()?`Tencil Cloud`:`Daemon`,children:[/* @__PURE__ */ Y(`span`,{class:`status-card-tone tone-${n===`open`?`ok`:e}`}),n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`]}),/* @__PURE__ */ Y(id,{label:`Address`,children:$t()}),/* @__PURE__ */ Y(id,{label:`Project`,children:Ht.value?`Not picked yet`:Lt.value?/* @__PURE__ */ Y(`span`,{title:Lt.value.root,children:Lt.value.name}):`…`}),/* @__PURE__ */ Y(id,{label:`Agent`,children:t?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`span`,{class:`status-card-tone tone-${t.state===`ready`?`ok`:e}`}),t.label,/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:td(t)})]}):`…`}),t?.target&&/* @__PURE__ */ Y(id,{label:`Workspace`,children:t.target}),L.value&&/* @__PURE__ */ Y(id,{label:`Signed in`,children:[L.value.login?`@${L.value.login}`:L.value.name,L.value.access===`read`&&/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:`view only`})]}),(i>0||r>0)&&/* @__PURE__ */ Y(id,{label:`Pins`,children:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)})]}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Y(`p`,{class:`status-card-detail`,children:t.detail})]})}function id({label:e,children:t}){return/* @__PURE__ */ Y(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Y(`dt`,{children:e}),/* @__PURE__ */ Y(`dd`,{children:t})]})}function ad(){let e=sd(),t=W.value===`picking`,n=j(null);return/* @__PURE__ */ Y(`div`,{ref:n,class:`toolbar-wrap dock-${Ru.value}`,style:Xu(Ru.value,Ju.value),children:[t&&/* @__PURE__ */ Y(`div`,{class:`toolbar-hint`,children:`Click any element to pin a prompt · Esc to cancel`}),!t&&/* @__PURE__ */ Y(ed,{}),!t&&Ht.value&&/* @__PURE__ */ Y($u,{}),!t&&!Ht.value&&e.hint&&/* @__PURE__ */ Y(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),/* @__PURE__ */ Y(`div`,{class:`toolbar`,children:[/* @__PURE__ */ Y(nd,{tone:e.tone,label:e.title}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>n.current&&Hu(e,n.current),onKeyDown:e=>{n.current&&Wu(e.key,n.current)&&e.preventDefault()}}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${t?` tool-active`:``}`,title:wt.value??`Comment (C)`,disabled:wt.value!==null,onClick:()=>t?En():Tn(),children:[/* @__PURE__ */ Y(Wi,{}),/* @__PURE__ */ Y(`span`,{class:`tool-label`,children:`Comment`}),/* @__PURE__ */ Y(`kbd`,{children:`C`})]}),Cn.value.length>0&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:z.value?.state!==`ready`,onClick:Bl,children:[/* @__PURE__ */ Y(Ji,{}),/* @__PURE__ */ Y(`span`,{class:`tool-label`,children:[`Send `,Cn.value.length]})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${q.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{q.value=!q.value,ln.value=!1},children:[/* @__PURE__ */ Y(Gi,{}),Sn.value>0&&/* @__PURE__ */ Y(`span`,{class:`badge`,children:Sn.value})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool`,title:dn.value?`Show pins`:`Hide pins`,onClick:()=>{dn.value=!dn.value,dn.value&&En()},children:dn.value?/* @__PURE__ */ Y(Ki,{}):/* @__PURE__ */ Y(qi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${ln.value?` tool-active`:``}`,title:`Project settings`,disabled:!Lt.value,onClick:()=>{ln.value=!ln.value,q.value=!1},children:/* @__PURE__ */ Y(ra,{})})]})]})}let od={label:`Switch agent`,run:()=>{ln.value=!0,q.value=!1}};function sd(){if(R.value!==`open`)return Yt()?{tone:`error`,title:`Tencil Cloud unreachable`,hint:R.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`}:{tone:`error`,title:`Tencil daemon offline`,hint:R.value===`connecting`?void 0:`The Tencil daemon stopped. Start it again with npx tencil start.`};let e=St.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:Ct.value?void 0:{label:`Sign in`,run:()=>cd(e.signIn)}};if(Ht.value)return{tone:`warn`,title:`Pick this page's project`};let t=z.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>U({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:od};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:od};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function cd(e){jt(Xt(),e).then(Zt,e=>{Wt.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function ld(){return dd(),/* @__PURE__ */ Y(`div`,{class:`root${W.value===`picking`?` picking`:``}`,children:[/* @__PURE__ */ Y(pu,{}),/* @__PURE__ */ Y(Vl,{}),/* @__PURE__ */ Y(lu,{}),/* @__PURE__ */ Y(bu,{}),/* @__PURE__ */ Y(Zl,{}),/* @__PURE__ */ Y(ud,{}),/* @__PURE__ */ Y(ad,{})]})}function ud(){let e=Wt.value,[t,n]=A(!1);return Me(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ Y(`div`,{class:`toast`,children:e.message})}function dd(){let e=V.value;Me(()=>{let t=sessionStorage.getItem(Xl);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(Xl),K.value=t,ru(n))},[e])}let fd=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function pd(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=e=>{W.value===`picking`&&(cn.value=t(e)?null:n(e.clientX,e.clientY))},i=e=>{if(W.value===`idle`&&e.type===`pointerdown`&&!t(e)){ln.value=!1,(K.value?V.value.get(K.value):void 0)?.anchor&&(K.value=null);return}W.value!==`picking`||t(e)||(e.preventDefault(),e.stopImmediatePropagation())},a=e=>{if(W.value!==`picking`||t(e))return;e.preventDefault(),e.stopImmediatePropagation();let r=n(e.clientX,e.clientY);if(!r)return;En();let i=gl(r);G.value={element:r,label:_l(r),anchor:{selector:``,...Mn(r,{x:e.clientX,y:e.clientY})},context:i}},o=e=>{if(!t(e)){if(e.key===`Escape`){if(W.value===`picking`)En();else if(G.value)G.value=null;else if(K.value)K.value=null;else if(q.value)q.value=!1;else return;e.preventDefault();return}md(e)||e.key.toLowerCase()===`c`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),dn.value=!1,W.value===`picking`?En():Tn())}},s=0,c=()=>{s||=requestAnimationFrame(()=>{s=0,_n.value++})},l=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||c()});l.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let u=setInterval(()=>{let e=yn(location.href);e!==vn.value&&(vn.value=e,G.value=null,K.value=null)},400);window.addEventListener(`pointermove`,r,{capture:!0,passive:!0});for(let e of fd)window.addEventListener(e,i,!0);return window.addEventListener(`click`,a,!0),window.addEventListener(`keydown`,o,!0),window.addEventListener(`scroll`,c,{capture:!0,passive:!0}),window.addEventListener(`resize`,c,{passive:!0}),()=>{window.removeEventListener(`pointermove`,r,!0);for(let e of fd)window.removeEventListener(e,i,!0);window.removeEventListener(`click`,a,!0),window.removeEventListener(`keydown`,o,!0),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),l.disconnect(),clearInterval(u),cancelAnimationFrame(s)}}function md(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function hd(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function gd(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function _d(e,t){let n=document.createElement(`tencil-overlay`);n.setAttribute(`data-tencil`,``),n.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=`
|
|
73
|
+
`)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ Y(`li`,{children:bu(e,t)},n));n.push(Y(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ Y(`p`,{class:`md-heading`,children:bu(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ Y(`p`,{children:bu(s.join(` `),t)},a++))}return n}let yu=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function bu(e,t){return e.split(yu).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=Su(e),/* @__PURE__ */ Y(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ Y(`strong`,{children:xu(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ Y(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:xu(r[1],t)},n):xu(e,t)})}function xu(e,t){return t.animateFrom===1/0?(t.index+=Su(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ Y(`span`,{class:`w`,children:e},`w${n}`):e})}function Su(e){let t=e.match(/\S+/g);return t?t.length:0}function Cu(){_n.value;let e=K.value,t=e?V.value.get(e):void 0,n=j(null),[r,i]=A(320);if(Ne(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=gn.value,o=a?.threadId===t.id?a.point:t.anchor?jn(t.anchor):null,{left:s,top:c,origin:l}=o?Pn(o,{width:380,height:r}):{left:window.innerWidth-380-(q.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ Y(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ Y(Tu,{thread:t}),t.status===`draft`?/* @__PURE__ */ Y(wu,{thread:t}):/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(Eu,{thread:t},t.id),/* @__PURE__ */ Y(ku,{thread:t},t.id),/* @__PURE__ */ Y(uu,{placeholder:wt.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||wt.value!==null,onSubmit:e=>{U({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{K.value=null}})]})]})}function wu({thread:e}){let t=e.messages[0]?.text??``,n=Cn.value.length;return/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ Y(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ Y(`button`,{type:`button`,class:`stop`,onClick:Bl,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ Y(uu,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&U({type:`thread.edit`,threadId:e.id,prompt:n}),K.value=null},onCancel:()=>{K.value=null}},`${e.id}:${t}`)]})}function Tu({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ Y(`div`,{class:`thread-header`,children:[/* @__PURE__ */ Y(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`span`,{class:`thread-number`,children:[`#`,zl.value.get(e.id)]}),/* @__PURE__ */ Y(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ Y(na,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ Y(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ Y(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ Y(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ Y(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${rn(e.provider.id)}`,children:/* @__PURE__ */ Y($i,{})}),e.status!==`draft`&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{U({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(K.value=null)},children:e.resolved?/* @__PURE__ */ Y(Zi,{}):/* @__PURE__ */ Y(Xi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{U({type:`thread.delete`,threadId:e.id}),K.value=null},children:/* @__PURE__ */ Y(Qi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{K.value=null},children:/* @__PURE__ */ Y(ea,{})})]})]})}function Eu({thread:e}){let t=j(null),n=j(null),r=j(!0),[i,a]=A(!1),o=e.messages[e.messages.length-1];return Ne(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Ne(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ Y(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ Y(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ Y(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ Y(Du,{message:e},e.id))})})}function Du({message:e}){let[t]=A(e.streaming);return/* @__PURE__ */ Y(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ Y(_u,{text:e.text,animate:t})})}function Ou({text:e}){let t=[...e];return/* @__PURE__ */ Y(`span`,{class:`shimmer`,children:[/* @__PURE__ */ Y(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ Y(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function ku({thread:e}){let[t,n]=A(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ Y(S,{children:[t&&r.length>0&&/* @__PURE__ */ Y(ju,{steps:r,follow:a}),/* @__PURE__ */ Y(Iu,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ Y(`div`,{class:`status-line`,children:/* @__PURE__ */ Y(Au,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,Pu(r)?` · ${Pu(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ Y(Lu,{delivery:e.delivery})]})}function Au({open:e,onToggle:t,children:n}){return/* @__PURE__ */ Y(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ Y(oa,{})]})}function ju({steps:e,follow:t}){let n=j(null),r=j(!0);return Ne(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ Y(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ Y(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ Y(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ Y(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ Y(Xi,{}):e.status===`failed`?/* @__PURE__ */ Y(ea,{}):`–`}),/* @__PURE__ */ Y(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ Y(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ Y(`span`,{class:`step-time`,children:Nu(e)})]},e.id))})}function Mu(e){return e.findLast(e=>e.status===`running`)}function Nu(e){return e.endedAt?Fu((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function Pu(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return Fu((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function Fu(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function Iu({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ Y(`div`,{class:`status-line`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Ou,{text:`Starting a thread in ${rn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ Y(`div`,{class:`status-line`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),t?/* @__PURE__ */ Y(Au,{...t,children:/* @__PURE__ */ Y(Ou,{text:`${Mu(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ Y(Ou,{text:`Working…`}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`stop`,onClick:()=>U({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ Y(Yi,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ Y(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ Y(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ Y(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function Lu({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ Y(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ Y(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Ou,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ Y(`span`,{class:`live-dot`}),/* @__PURE__ */ Y(Ou,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ Y(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ Y(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Y(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ Y(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ Y(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ Y(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let Ru=`tencil:dock`,zu=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],Bu,Vu=F(Hu());function Hu(){try{let e=localStorage.getItem(Ru);return e&&zu.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function Uu(e){Vu.value=e;try{localStorage.setItem(Ru,e)}catch{}}function Wu(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function Gu(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=Yu(t);Bu?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,Ku,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=Xu(t);Ju(t,p,Wu(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,Ku,!0)}function Ku(e){e.preventDefault()}function qu(e,t){let[n,r]=Vu.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(Uu(o),t.style.translate=``,!0):!1}function Ju(e,t,n){Uu(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Bu=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};Bu=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),Bu=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=Xu(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function Yu(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function Xu(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let Zu=F(null);function Qu(){let e=()=>{let e=ed(),t=Zu.value;td(e,t)||(Zu.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function $u(e,t){return!t||e.endsWith(`center`)||Wu((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function ed(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function td(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}function nd(){let[e,t]=A(``),n=Ht.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>U({type:`project.select`,root:e});return/* @__PURE__ */ Y(`div`,{class:`project-picker`,children:[/* @__PURE__ */ Y(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ Y(`p`,{class:`project-picker-empty`,children:Ut.value??`No projects found.`}):/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ Y(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ Y(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ Y(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ Y(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ Y(`span`,{class:`project-picker-root`,children:e.root})]},e.root))]})]})]})}function rd(){if(!ln.value)return null;let e=B.value,t=z.value,n=()=>{ln.value=!1};return/* @__PURE__ */ Y(`section`,{class:`settings-panel`,role:`dialog`,"aria-label":`Project settings`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[/* @__PURE__ */ Y(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Y(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Y(`strong`,{children:`Settings`}),Lt.value&&/* @__PURE__ */ Y(`span`,{class:`settings-project`,children:Lt.value.name})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:n,children:/* @__PURE__ */ Y(ea,{})})]}),e?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Y(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Y(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Y(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Y(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>U({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Y(Ui,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Y(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Y(`span`,{class:`target-option-meta`,children:id(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Y(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Y(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}),/* @__PURE__ */ Y(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-label`,children:`Batch mode`}),/* @__PURE__ */ Y(`span`,{class:`settings-help`,children:[`Adds `,/* @__PURE__ */ Y(aa,{}),` to the comment box to queue comments and send them together.`]})]}),/* @__PURE__ */ Y(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:e.batch,"aria-checked":e.batch,onChange:e=>hn(e.currentTarget.checked)})]})]}):/* @__PURE__ */ Y(`p`,{class:`empty`,children:`Connecting…`}),L.value&&/* @__PURE__ */ Y(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Y(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Y(`strong`,{children:L.value.login?`@${L.value.login}`:L.value.name})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`hint-action`,onClick:()=>{At(Xt()),Zt()},children:`Sign out`})]})]})}function id(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function ad({tone:e,label:t}){let[n,r]=A(!1),i=j(void 0);Me(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Y(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Y(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Y(`span`,{class:`status-dot status-${e}`,children:wn.value>0&&/* @__PURE__ */ Y(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Y(od,{tone:e})]})}function od({tone:e}){let t=z.value,n=R.value,r=Cn.value.length,i=wn.value;return/* @__PURE__ */ Y(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Y(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Y(ia,{size:18}),/* @__PURE__ */ Y(`strong`,{children:`Tencil`}),Rt.value&&/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:[`v`,Rt.value]})]}),/* @__PURE__ */ Y(`dl`,{class:`status-card-rows`,children:[/* @__PURE__ */ Y(sd,{label:Yt()?`Tencil Cloud`:`Daemon`,children:[/* @__PURE__ */ Y(`span`,{class:`status-card-tone tone-${n===`open`?`ok`:e}`}),n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`]}),/* @__PURE__ */ Y(sd,{label:`Address`,children:$t()}),/* @__PURE__ */ Y(sd,{label:`Project`,children:Ht.value?`Not picked yet`:Lt.value?/* @__PURE__ */ Y(`span`,{title:Lt.value.root,children:Lt.value.name}):`…`}),/* @__PURE__ */ Y(sd,{label:`Agent`,children:t?/* @__PURE__ */ Y(S,{children:[/* @__PURE__ */ Y(`span`,{class:`status-card-tone tone-${t.state===`ready`?`ok`:e}`}),t.label,/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:id(t)})]}):`…`}),t?.target&&/* @__PURE__ */ Y(sd,{label:`Workspace`,children:t.target}),L.value&&/* @__PURE__ */ Y(sd,{label:`Signed in`,children:[L.value.login?`@${L.value.login}`:L.value.name,L.value.access===`read`&&/* @__PURE__ */ Y(`span`,{class:`status-card-muted`,children:`view only`})]}),(i>0||r>0)&&/* @__PURE__ */ Y(sd,{label:`Pins`,children:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)})]}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Y(`p`,{class:`status-card-detail`,children:t.detail})]})}function sd({label:e,children:t}){return/* @__PURE__ */ Y(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Y(`dt`,{children:e}),/* @__PURE__ */ Y(`dd`,{children:t})]})}function cd(){let e=ud(),t=W.value===`picking`,n=j(null);return/* @__PURE__ */ Y(`div`,{ref:n,class:`toolbar-wrap dock-${Vu.value}`,style:$u(Vu.value,Zu.value),children:[t&&/* @__PURE__ */ Y(`div`,{class:`toolbar-hint`,children:`Click any element to pin a prompt · Esc to cancel`}),!t&&/* @__PURE__ */ Y(rd,{}),!t&&Ht.value&&/* @__PURE__ */ Y(nd,{}),!t&&!Ht.value&&e.hint&&/* @__PURE__ */ Y(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),/* @__PURE__ */ Y(`div`,{class:`toolbar`,children:[/* @__PURE__ */ Y(ad,{tone:e.tone,label:e.title}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>n.current&&Gu(e,n.current),onKeyDown:e=>{n.current&&qu(e.key,n.current)&&e.preventDefault()}}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${t?` tool-active`:``}`,title:wt.value??`Comment (C)`,disabled:wt.value!==null,onClick:()=>t?En():Tn(),children:[/* @__PURE__ */ Y(Wi,{}),/* @__PURE__ */ Y(`span`,{class:`tool-label`,children:`Comment`}),/* @__PURE__ */ Y(`kbd`,{children:`C`})]}),Cn.value.length>0&&/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:z.value?.state!==`ready`,onClick:Bl,children:[/* @__PURE__ */ Y(Ji,{}),/* @__PURE__ */ Y(`span`,{class:`tool-label`,children:[`Send `,Cn.value.length]})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${q.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{q.value=!q.value,ln.value=!1},children:[/* @__PURE__ */ Y(Gi,{}),Sn.value>0&&/* @__PURE__ */ Y(`span`,{class:`badge`,children:Sn.value})]}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool`,title:dn.value?`Show pins`:`Hide pins`,onClick:()=>{dn.value=!dn.value,dn.value&&En()},children:dn.value?/* @__PURE__ */ Y(Ki,{}):/* @__PURE__ */ Y(qi,{})}),/* @__PURE__ */ Y(`button`,{type:`button`,class:`tool${ln.value?` tool-active`:``}`,title:`Project settings`,disabled:!Lt.value,onClick:()=>{ln.value=!ln.value,q.value=!1},children:/* @__PURE__ */ Y(ra,{})})]})]})}let ld={label:`Switch agent`,run:()=>{ln.value=!0,q.value=!1}};function ud(){if(R.value!==`open`)return Yt()?{tone:`error`,title:`Tencil Cloud unreachable`,hint:R.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`}:{tone:`error`,title:`Tencil daemon offline`,hint:R.value===`connecting`?void 0:`The Tencil daemon stopped. Start it again with npx tencil start.`};let e=St.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:Ct.value?void 0:{label:`Sign in`,run:()=>dd(e.signIn)}};if(Ht.value)return{tone:`warn`,title:`Pick this page's project`};let t=z.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>U({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:ld};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:ld};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function dd(e){jt(Xt(),e).then(Zt,e=>{Wt.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function fd(){return md(),/* @__PURE__ */ Y(`div`,{class:`root${W.value===`picking`?` picking`:``}`,children:[/* @__PURE__ */ Y(gu,{}),/* @__PURE__ */ Y(Vl,{}),/* @__PURE__ */ Y(fu,{}),/* @__PURE__ */ Y(Cu,{}),/* @__PURE__ */ Y(eu,{}),/* @__PURE__ */ Y(pd,{}),/* @__PURE__ */ Y(cd,{})]})}function pd(){let e=Wt.value,[t,n]=A(!1);return Me(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ Y(`div`,{class:`toast`,children:e.message})}function md(){let e=V.value;Me(()=>{let t=sessionStorage.getItem($l);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem($l),K.value=t,ou(n))},[e])}let hd=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function gd(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=e=>{W.value===`picking`&&(cn.value=t(e)?null:n(e.clientX,e.clientY))},i=e=>{if(W.value===`idle`&&e.type===`pointerdown`&&!t(e)){ln.value=!1,(K.value?V.value.get(K.value):void 0)?.anchor&&(K.value=null);return}W.value!==`picking`||t(e)||(e.preventDefault(),e.stopImmediatePropagation())},a=e=>{if(W.value!==`picking`||t(e))return;e.preventDefault(),e.stopImmediatePropagation();let r=n(e.clientX,e.clientY);if(!r)return;En();let i=gl(r);G.value={element:r,label:_l(r),anchor:{selector:``,...Mn(r,{x:e.clientX,y:e.clientY})},context:i}},o=e=>{if(!t(e)){if(e.key===`Escape`){if(W.value===`picking`)En();else if(G.value)G.value=null;else if(K.value)K.value=null;else if(q.value)q.value=!1;else return;e.preventDefault();return}_d(e)||e.key.toLowerCase()===`c`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),dn.value=!1,W.value===`picking`?En():Tn())}},s=0,c=()=>{s||=requestAnimationFrame(()=>{s=0,_n.value++})},l=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||c()});l.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let u=setInterval(()=>{let e=yn(location.href);e!==vn.value&&(vn.value=e,G.value=null,K.value=null)},400);window.addEventListener(`pointermove`,r,{capture:!0,passive:!0});for(let e of hd)window.addEventListener(e,i,!0);return window.addEventListener(`click`,a,!0),window.addEventListener(`keydown`,o,!0),window.addEventListener(`scroll`,c,{capture:!0,passive:!0}),window.addEventListener(`resize`,c,{passive:!0}),()=>{window.removeEventListener(`pointermove`,r,!0);for(let e of hd)window.removeEventListener(e,i,!0);window.removeEventListener(`click`,a,!0),window.removeEventListener(`keydown`,o,!0),window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),l.disconnect(),clearInterval(u),cancelAnimationFrame(s)}}function _d(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function vd(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function yd(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function bd(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function xd(e,t){bd();let n=document.createElement(`tencil-overlay`);n.setAttribute(`data-tencil`,``),n.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=`
|
|
74
74
|
:host { all: initial; }
|
|
75
75
|
* { box-sizing: border-box; }
|
|
76
76
|
|
|
@@ -217,15 +217,109 @@ kbd {
|
|
|
217
217
|
.pin-draft .pin-body { background: white; border-color: var(--accent); color: var(--accent); }
|
|
218
218
|
/* Queued for a batch: not sent yet, so outlined rather than filled. */
|
|
219
219
|
.pin-queued .pin-body { background: white; color: var(--accent); border: 2px dashed var(--accent); }
|
|
220
|
+
/*
|
|
221
|
+
* Working: the pin turns into the logo (solid, no white rim) and a light travels
|
|
222
|
+
* round its edge, a bright head with a long tail. The fill and the 2px edge are
|
|
223
|
+
* ::before, the blurred glow ::after; both sit under the number, and isolation
|
|
224
|
+
* keeps them under the body's own stacking context however it's scaled.
|
|
225
|
+
*/
|
|
226
|
+
.pin-working .pin-body {
|
|
227
|
+
isolation: isolate;
|
|
228
|
+
background: transparent; border-color: transparent;
|
|
229
|
+
}
|
|
230
|
+
.pin-working .pin-body::before, .pin-working .pin-body::after {
|
|
231
|
+
content: ""; position: absolute; inset: -2px; z-index: -1;
|
|
232
|
+
border-radius: inherit;
|
|
233
|
+
animation: rim-travel 2s linear infinite;
|
|
234
|
+
}
|
|
235
|
+
/* The edge: white at the head on the pin's own colour, so it reads on any page. */
|
|
236
|
+
.pin-working .pin-body::before {
|
|
237
|
+
border: 2px solid transparent;
|
|
238
|
+
background: linear-gradient(var(--pin), var(--pin)) padding-box,
|
|
239
|
+
conic-gradient(from var(--tencil-rim), #fff 0deg, #d9e8ff 22deg, #8fbcff 50deg,
|
|
240
|
+
color-mix(in oklab, var(--pin), white 22%) 96deg 312deg, #d9e8ff 348deg, #fff 360deg) border-box;
|
|
241
|
+
}
|
|
242
|
+
/* The glow: saturated, since a white one vanishes on a light page. */
|
|
220
243
|
.pin-working .pin-body::after {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
244
|
+
inset: -3px; z-index: -2;
|
|
245
|
+
background: conic-gradient(from var(--tencil-rim), var(--pin) 0deg,
|
|
246
|
+
color-mix(in oklab, var(--pin), white 20%) 30deg, color-mix(in oklab, var(--pin), white 50%) 60deg,
|
|
247
|
+
transparent 110deg 300deg, var(--pin) 360deg);
|
|
248
|
+
filter: blur(5px);
|
|
225
249
|
}
|
|
226
250
|
.pin-static { position: relative; width: 28px; height: 28px; flex: none; pointer-events: none; }
|
|
227
251
|
.pin-static .pin-body { transform: none; border-color: var(--surface); box-shadow: none; }
|
|
228
252
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
253
|
+
/* Counter-clockwise, so the tail trails the head. Needs --tencil-rim registered (index.ts). */
|
|
254
|
+
@keyframes rim-travel { from { --tencil-rim: 360deg; } to { --tencil-rim: 0deg; } }
|
|
255
|
+
|
|
256
|
+
/*
|
|
257
|
+
* A new pin blooms out of its tip: a burst of glow behind it, then one lap of
|
|
258
|
+
* the working pin's light round its edge.
|
|
259
|
+
*/
|
|
260
|
+
.pin-draft::before, .pin-resolving::before {
|
|
261
|
+
content: ""; position: absolute; left: 0; top: 0; width: 80px; height: 80px;
|
|
262
|
+
translate: -50% -50%; border-radius: 50%; pointer-events: none; opacity: 0;
|
|
263
|
+
}
|
|
264
|
+
.pin-draft::before {
|
|
265
|
+
background: radial-gradient(closest-side, color-mix(in oklab, var(--accent), white 30%), transparent);
|
|
266
|
+
animation: pin-burst 700ms var(--ease-out);
|
|
267
|
+
}
|
|
268
|
+
.pin-draft .pin-body {
|
|
269
|
+
animation: pin-bloom 460ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
|
|
270
|
+
@starting-style { opacity: 1; transform: scale(1.1); }
|
|
271
|
+
}
|
|
272
|
+
.pin-draft .pin-body::before {
|
|
273
|
+
content: ""; position: absolute; inset: -2px; padding: 2px; border-radius: inherit;
|
|
274
|
+
pointer-events: none; opacity: 0;
|
|
275
|
+
background: conic-gradient(from var(--tencil-rim), #fff 0deg, #d9e8ff 30deg, transparent 120deg 360deg);
|
|
276
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
277
|
+
animation: pin-lap 800ms 180ms cubic-bezier(0.4, 0, 0.2, 1) both;
|
|
278
|
+
}
|
|
279
|
+
/*
|
|
280
|
+
* A pin leaving the page (resolved or deleted) floats up and blurs away. A
|
|
281
|
+
* resolved one first turns green and swaps its number for a check as a shine
|
|
282
|
+
* crosses it, then leaves in a green glow. Pins.tsx keeps it mounted meanwhile.
|
|
283
|
+
*/
|
|
284
|
+
.pin-leaving { pointer-events: none; }
|
|
285
|
+
.pin-leaving .pin-body {
|
|
286
|
+
transition: none;
|
|
287
|
+
animation: pin-dissolve 420ms cubic-bezier(0.55, 0, 1, 0.45) both;
|
|
288
|
+
}
|
|
289
|
+
.pin-resolving .pin-body {
|
|
290
|
+
animation: pin-done 220ms var(--ease-out) both,
|
|
291
|
+
pin-dissolve 420ms 480ms cubic-bezier(0.55, 0, 1, 0.45) both;
|
|
292
|
+
}
|
|
293
|
+
/* A working pin draws its fill on these; without them it turns green like the rest. */
|
|
294
|
+
.pin-resolving .pin-body::before, .pin-resolving .pin-body::after { content: none; }
|
|
295
|
+
.pin-resolving::before {
|
|
296
|
+
background: radial-gradient(closest-side, color-mix(in oklab, var(--done), white 30%), transparent);
|
|
297
|
+
animation: pin-burst 600ms 480ms var(--ease-out) both;
|
|
298
|
+
}
|
|
299
|
+
.pin-glyph { display: grid; place-items: center; }
|
|
300
|
+
/* Laid over the number, so the pin keeps its width. */
|
|
301
|
+
.pin-check { position: absolute; inset: 0; opacity: 0; }
|
|
302
|
+
.pin-check svg { width: 13px; height: 13px; stroke-width: 3; }
|
|
303
|
+
.pin-resolving .pin-glyph:first-child { animation: pin-glyph-out 160ms ease-in both; }
|
|
304
|
+
.pin-resolving .pin-check { animation: pin-glyph-in 260ms 60ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
|
|
305
|
+
.pin-shine {
|
|
306
|
+
position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
|
|
307
|
+
background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.75) 50%, transparent 70%)
|
|
308
|
+
100% 0 / 250% 100% no-repeat;
|
|
309
|
+
animation: pin-shine 520ms var(--ease-out) both;
|
|
310
|
+
}
|
|
311
|
+
@keyframes pin-bloom { from { scale: 0; opacity: 0; } 30% { opacity: 1; } }
|
|
312
|
+
@keyframes pin-burst { from { scale: 0.08; opacity: 1; } to { scale: 1; opacity: 0; } }
|
|
313
|
+
@keyframes pin-lap {
|
|
314
|
+
from { --tencil-rim: 220deg; opacity: 0; }
|
|
315
|
+
15%, 75% { opacity: 1; }
|
|
316
|
+
to { --tencil-rim: -140deg; opacity: 0; }
|
|
317
|
+
}
|
|
318
|
+
@keyframes pin-done { to { background-color: var(--done); border-color: white; } }
|
|
319
|
+
@keyframes pin-dissolve { to { translate: 0 -12px; scale: 1.15; opacity: 0; filter: blur(6px); } }
|
|
320
|
+
@keyframes pin-glyph-out { to { scale: 0.4; opacity: 0; filter: blur(2px); } }
|
|
321
|
+
@keyframes pin-glyph-in { from { scale: 0.4; opacity: 0; filter: blur(2px); } to { opacity: 1; } }
|
|
322
|
+
@keyframes pin-shine { to { background-position: 0 0; } }
|
|
229
323
|
|
|
230
324
|
/* -------------------------------- popovers -------------------------------- */
|
|
231
325
|
.popover {
|
|
@@ -745,6 +839,10 @@ kbd {
|
|
|
745
839
|
transition-property: opacity, background-color, color;
|
|
746
840
|
}
|
|
747
841
|
.w { animation: none; }
|
|
842
|
+
.pin-working .pin-body::before, .pin-working .pin-body::after { animation-duration: 6s; }
|
|
843
|
+
.pin-draft::before, .pin-resolving::before, .pin-draft .pin-body::before, .pin-shine { display: none; }
|
|
844
|
+
@keyframes pin-bloom { from { opacity: 0; } }
|
|
845
|
+
@keyframes pin-dissolve { to { opacity: 0; } }
|
|
748
846
|
.shimmer > span[aria-hidden], .status-ping, .live-dot { animation: none; }
|
|
749
847
|
}
|
|
750
|
-
`;let a=document.querySelector(`script[nonce]`)?.nonce;a&&(i.nonce=a),r.append(i);let o=document.createElement(`div`);r.append(o),On(n),document.body.append(n);let s=new MutationObserver(()=>{n.isConnected||document.body.append(n)});s.observe(document.body,{childList:!0});let c=
|
|
848
|
+
`;let a=document.querySelector(`script[nonce]`)?.nonce;a&&(i.nonce=a),r.append(i);let o=document.createElement(`div`);r.append(o),On(n),document.body.append(n);let s=new MutationObserver(()=>{n.isConnected||document.body.append(n)});s.observe(document.body,{childList:!0});let c=gd(n),l=Qu();ge(te(fd,{}),o),Jt(e,t),window.__TENCIL__={version:1,bridgeUrl:e,destroy(){s.disconnect(),c(),l(),ge(null,o),n.remove(),window.__TENCIL__=void 0}}}if(typeof window<`u`&&!window.__TENCIL__){let e=vd(),t=yd();document.body?xd(e,t):document.addEventListener(`DOMContentLoaded`,()=>xd(e,t),{once:!0})}})();
|
|
@@ -2399,6 +2399,15 @@ async function persist(socket, threadId, messageId, attachments) {
|
|
|
2399
2399
|
}))
|
|
2400
2400
|
})).attachments;
|
|
2401
2401
|
}
|
|
2402
|
+
/** Requests the user answers; T3 Code resolves `auth_refresh` and `dynamic_tool_call` itself. */
|
|
2403
|
+
const USER_REQUEST_KINDS = /* @__PURE__ */ new Set([
|
|
2404
|
+
"command",
|
|
2405
|
+
"file-read",
|
|
2406
|
+
"file-change",
|
|
2407
|
+
"mcp-elicitation",
|
|
2408
|
+
"permission",
|
|
2409
|
+
"user_input"
|
|
2410
|
+
]);
|
|
2402
2411
|
const ACTIVE_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
2403
2412
|
"preparing",
|
|
2404
2413
|
"starting",
|
|
@@ -2407,6 +2416,7 @@ const ACTIVE_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
|
2407
2416
|
]);
|
|
2408
2417
|
var V2ThreadTracker = class {
|
|
2409
2418
|
#runs = /* @__PURE__ */ new Map();
|
|
2419
|
+
#requests = /* @__PURE__ */ new Map();
|
|
2410
2420
|
#messages = /* @__PURE__ */ new Map();
|
|
2411
2421
|
#lastStatusKey = "";
|
|
2412
2422
|
apply(raw) {
|
|
@@ -2415,6 +2425,7 @@ var V2ThreadTracker = class {
|
|
|
2415
2425
|
let gone = false;
|
|
2416
2426
|
if (item.kind === "snapshot") {
|
|
2417
2427
|
for (const run of item.projection.runs ?? []) this.#runs.set(run.id, run);
|
|
2428
|
+
for (const request of item.projection.runtimeRequests ?? []) this.#requests.set(request.id, request);
|
|
2418
2429
|
for (const message of item.projection.messages ?? []) this.#upsertMessage(message, changed);
|
|
2419
2430
|
for (const turnItem of item.projection.turnItems ?? []) this.#upsertTurnItem(turnItem, changed);
|
|
2420
2431
|
} else if (item.kind === "event") {
|
|
@@ -2422,6 +2433,9 @@ var V2ThreadTracker = class {
|
|
|
2422
2433
|
if (type === "run.created" || type === "run.updated") {
|
|
2423
2434
|
const run = payload;
|
|
2424
2435
|
this.#runs.set(run.id, run);
|
|
2436
|
+
} else if (type === "runtime-request.updated") {
|
|
2437
|
+
const request = payload;
|
|
2438
|
+
this.#requests.set(request.id, request);
|
|
2425
2439
|
} else if (type === "message.updated") this.#upsertMessage(payload, changed);
|
|
2426
2440
|
else if (type === "turn-item.updated") this.#upsertTurnItem(payload, changed);
|
|
2427
2441
|
else if (type === "thread.deleted") gone = true;
|
|
@@ -2443,11 +2457,8 @@ var V2ThreadTracker = class {
|
|
|
2443
2457
|
case "preparing":
|
|
2444
2458
|
case "queued":
|
|
2445
2459
|
case "starting":
|
|
2446
|
-
case "running":
|
|
2447
|
-
case "waiting": return {
|
|
2448
|
-
status: "waiting",
|
|
2449
|
-
detail: "Waiting for approval in T3 Code"
|
|
2450
|
-
};
|
|
2460
|
+
case "running":
|
|
2461
|
+
case "waiting": return this.#pendingRequest(latest) ?? { status: "working" };
|
|
2451
2462
|
case "failed": return {
|
|
2452
2463
|
status: "error",
|
|
2453
2464
|
detail: "Run failed"
|
|
@@ -2468,6 +2479,20 @@ var V2ThreadTracker = class {
|
|
|
2468
2479
|
}
|
|
2469
2480
|
return active?.id;
|
|
2470
2481
|
}
|
|
2482
|
+
/**
|
|
2483
|
+
* Approvals and questions don't change the run's status; they're runtime requests.
|
|
2484
|
+
* A stopped run can leave one pending, so only count those made during `run`.
|
|
2485
|
+
*/
|
|
2486
|
+
#pendingRequest(run) {
|
|
2487
|
+
for (const request of this.#requests.values()) {
|
|
2488
|
+
if (request.status !== "pending" || !USER_REQUEST_KINDS.has(request.kind)) continue;
|
|
2489
|
+
if (run.requestedAt && request.createdAt && request.createdAt < run.requestedAt) continue;
|
|
2490
|
+
return {
|
|
2491
|
+
status: "waiting",
|
|
2492
|
+
detail: request.kind === "user_input" ? "Waiting for your answer in T3 Code" : "Waiting for approval in T3 Code"
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2471
2496
|
#latestRun() {
|
|
2472
2497
|
let latest;
|
|
2473
2498
|
for (const run of this.#runs.values()) if (!latest || run.ordinal > latest.ordinal) latest = run;
|
|
@@ -3141,7 +3166,7 @@ function errorMessage(error) {
|
|
|
3141
3166
|
}
|
|
3142
3167
|
//#endregion
|
|
3143
3168
|
//#region src/version.ts
|
|
3144
|
-
const VERSION = "0.6.
|
|
3169
|
+
const VERSION = "0.6.1";
|
|
3145
3170
|
//#endregion
|
|
3146
3171
|
//#region src/daemon/thread-store.ts
|
|
3147
3172
|
const StoreFile = z.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tencil",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Point at any element of your running app and tell your coding agent what to fix.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Pixel Perfect Agency",
|
|
@@ -93,9 +93,9 @@
|
|
|
93
93
|
"@types/ws": "^8.18.2",
|
|
94
94
|
"react": "^19.3.0",
|
|
95
95
|
"tsdown": "^0.23.0",
|
|
96
|
-
"@tencildev/overlay": "0.0.0",
|
|
97
96
|
"@tencildev/bridge": "0.2.0",
|
|
98
97
|
"@tencildev/protocol": "0.2.0",
|
|
98
|
+
"@tencildev/overlay": "0.0.0",
|
|
99
99
|
"@tencildev/provider-claude-code": "0.0.0",
|
|
100
100
|
"@tencildev/provider-t3code": "0.0.0",
|
|
101
101
|
"@tencildev/testing": "0.1.1",
|