fix(webui): read a capture beside the list, not over it

The capture detail was the app's only sheet: it covered the list it was
opened from, had to be dismissed between rows, and held no address. It is
now a pane that sits with the list -- sticky and internally scrolling on the
wide layout, stacked under the list below 1100px, where selecting scrolls it
into view. The selection rides in the URL (?capture=N) with replace, so a
capture survives a reload and can be linked, and a page opened without a
selection shows the newest event rather than an empty box.
This commit is contained in:
sam committed 2026-09-21 01:17:04 +10:00
1 parent 7f1da81d52
commit ddb9c88f4f
7 files changed
+130 -83

No files matched your search

+1 -1
View File
@@ -1,2 +1,2 @@
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scrollbar-thumb:#0000;--tw-scrollbar-track:#0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--scroll-fade-t:0;--scroll-fade-b:0;--scroll-fade-s:0;--scroll-fade-e:0;--scroll-fade-mask:initial;--shimmer-image:initial;--shimmer-text-fill:initial}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-cyrillic-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-cyrillic-wght-normal.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-vietnamese-wght-normal.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-latin-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-latin-wght-normal.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:"Geist Variable", sans-serif;--color-black:#000;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-md:10px;--radius-4xl:2rem;--shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2sLine truncated
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scrollbar-thumb:#0000;--tw-scrollbar-track:#0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--scroll-fade-t:0;--scroll-fade-b:0;--scroll-fade-s:0;--scroll-fade-e:0;--scroll-fade-mask:initial;--shimmer-image:initial;--shimmer-text-fill:initial}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-cyrillic-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-cyrillic-wght-normal.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-vietnamese-wght-normal.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-latin-ext-wght-normal.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/geist-latin-wght-normal.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--font-sans:"Geist Variable", sans-serif;--color-black:#000;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-lg:32rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-md:10px;--radius-4xl:2rem;--shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .Line truncated
+8 -8
View File
@@ -5,15 +5,15 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Dp;function Op(e){Dp=e}var kp=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Ap(e){let t=e instanceof kp?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function jp(e,t){let n=await fetch(e,t);if(Dp?.(n.status===401),!n.ok)throw new kp(await Ep(n),n.status);return n}async function Mp(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=wp,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await jp(e,s);return a?await c.json():void 0}var Y={health:()=>Mp(`/health/detailed`),summary:()=>Mp(`/api/summary`),tasks:()=>Mp(`/api/tasks`),taskMeta:()=>Mp(`/api/task-meta`),task:e=>Mp(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Mp(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Mp(`/api/tasks/${encodeURIComponent(e)}/changes`+Tp(t)),taskDebug:(e,t)=>Mp(`/api/tasks/${encodeURIComponent(e)}/debug`+Tp(t)),taskAction:(e,t)=>Mp(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t}}),setup:()=>Mp(`/api/setup`),capabilities:()=>Mp(`/api/capabilities`),workflows:()=>Mp(`/api/workflows`),workRequest:e=>Mp(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Mp(`/api/skills`),channels:()=>Mp(`/api/channels`),curators:()=>Mp(`/api/curators`),channelReload:e=>Mp(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Mp(`/api/config`),configUpdate:e=>Mp(`/api/config`,{method:`PATCH`,body:{updates:e}}),configRepoUpdate:(e,t,n,r)=>Mp(`/api/config/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PATCH`,body:{field:n,value:r}}),configReset:e=>Mp(`/api/config/reset`,{method:`POST`,body:{key:e}}),logs:e=>Mp(`/api/logs`+Tp(e)),taskLogs:(e,t)=>Mp(`/api/tasks/${encodeURIComponent(e)}/logs`+Tp(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),captures:e=>Mp(`/api/captures`+Tp({limit:e})),mappings:()=>Mp(`/api/mappings`),mappingCreate:e=>Mp(`/api/mappings`,{method:`POST`,body:e}),mappingUpdate:(e,t)=>Mp(`/api/mappings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),mappingDelete:e=>Mp(`/api/mappings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),mappingPreview:(e,t)=>Mp(`/api/mappings/preview`,{method:`POST`,body:{capture_id:e,fields:t}}),bindings:()=>Mp(`/api/bindings`),bindingCreate:e=>Mp(`/api/bindings`,{method:`POST`,body:e}),bindingUpdate:(e,t)=>Mp(`/api/bindings/${encodeURIComponent(e)}`,{method:`PATCH`,body:t}),bindingDelete:e=>Mp(`/api/bindings/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),bindingApprove:e=>Mp(`/api/bindings/${encodeURIComponent(e)}/approve`,{method:`POST`}),chatSessions:()=>Mp(`/api/chat/sessions`),chatMessages:e=>Mp(`/api/chat/sessions/${encodeURIComponent(e)}/messages`),chatTurns:e=>Mp(`/api/chat/sessions/${encodeURIComponent(e)}/turns`),chatCancel:e=>Mp(`/api/chat/cancel`,{method:`POST`,body:{session_id:e}}),chatMessage:(e,t)=>Mp(`/api/chat/message`,{method:`POST`,body:{channel_id:e,source_id:Cp(),text:t,page:location.pathname+location.search||`/`}}),chatPersona:(e,t)=>Mp(`/api/chat/persona`,{method:`POST`,body:{session_id:e,name:t}}),chatDangerous:()=>Mp(`/api/chat/dangerous`),chatDangerousRequest:(e,t)=>Mp(`/api/chat/dangerous/${encodeURIComponent(e)}`,{method:`POST`,body:{spec:t}}),chatDangerousDecision:(e,t)=>Mp(`/api/chat/dangerous/${encodeURIComponent(e)}/decision`,{method:`POST`,body:{decision:t}}),chatStream:(e,t={})=>jp(`/api/chat/stream`,{method:`POST`,headers:{Accept:`text/event-stream`,"Content-Type":`application/json`,"X-Archie-CSRF":`1`},body:JSON.stringify(e),signal:t.signal})};function Np(e,t){let n=new EventSource(`/events`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(`reconnecting`),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}function Pp(e,t){let n=new EventSource(`/api/logs/stream`);return n.onopen=()=>t?.(`live`),n.onerror=()=>t?.(Sp(n.readyState)),n.onmessage=t=>{try{e(JSON.parse(t.data))}catch{}},()=>n.close()}var Fp=`archie.web.chat.channel`;function Ip(){let e=localStorage.getItem(Fp);return e||(e=Cp(),localStorage.setItem(Fp,e)),e}var Lp=/(?:^|\s)\/([^\s]*)$/,Rp=/(?:^|\s)\/[^\s]*$/,zp=8;function Bp(e,t,n){let r=t.slice(0,n).match(Lp);if(!r)return[];let i=r[1].toLowerCase();return e.filter(e=>`${e.command} ${e.description??``}`.toLowerCase().includes(i)).slice(0,zp)}function Vp(e,t,n){let r=e.slice(0,t),i=e.slice(t),a=r.search(Rp),o=a<0?r.length:a+ +(r[a]===` `);return{text:`${r.slice(0,o)}${n} ${i}`,cursor:o+n.length+1}}function Hp(e,t){let n=t.trim();return e.some(e=>e.command===n)}function Up(e){return{text:e,sourceID:Cp()}}function Wp(e){return{...e}}fun Line truncated
`);u=r.pop()||``;for(let e of r){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Yp.value=n.session_id),n.type===`delta`&&(o+=n.text,em.value=em.value?{...em.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],em.value=em.value?{...em.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Xp.value=[...Xp.value,{from:`assistant`,text:o,tool_calls:a}],em.value=null,Qp.value=`Ready`,await hm()}catch(e){let t=e;t.name===`AbortError`&&!c?(em.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Qp.value=`Stopped`):(em.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Wp(r):void 0,isRetry:i},Qp.value=`Error — retry available`)}finally{clearTimeout(l),pm=null,$p.value=!1}}function Om(){Qp.value=`Stopping…`,Yp.value&&Y.chatCancel(Yp.value).catch(()=>{}),mm()}function km(){ra(()=>{hm().catch(e=>{Qp.value=e.message||`Chat unavailable`})}),sa(()=>{mm()})}var Am=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],jm=N({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(L(),R(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full bg-linear-to-br from-primary to-[var(--brand-alt)] text-primary-foreground shadow-[var(--shadow-md)] transition-[transform,box-shadow] duration-[140ms] hover:-translate-y-px hover:shadow-[0_12px_34px_var(--primary-soft)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":A(Kp),onClick:i[0]||=e=>n(`toggle`)},[B(`span`,{"aria-hidden":`true`,class:D(r(!e.open))},[V(A(jd),{size:22})],2),B(`span`,{"aria-hidden":`true`,class:D(r(e.open))},[V(A(Kd),{size:22})],2)],8,Am))}});function Mm(e){return typeof e==`string`?`'${e}'`:new Im().serialize(e)}var Nm=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Pm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Nm.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Fm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Pm[n]?Pm[n]:n+128,s=a<128&&Pm[a]?Pm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Im=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Fm(e,t):n===`number`&&r===`number`?e-t:Fm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Fm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`InLine truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Yp.value=n.session_id),n.type===`delta`&&(o+=n.text,em.value=em.value?{...em.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],em.value=em.value?{...em.value,tools:a}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Xp.value=[...Xp.value,{from:`assistant`,text:o,tool_calls:a}],em.value=null,Qp.value=`Ready`,await hm()}catch(e){let t=e;t.name===`AbortError`&&!c?(em.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Qp.value=`Stopped`):(em.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Wp(r):void 0,isRetry:i},Qp.value=`Error — retry available`)}finally{clearTimeout(l),pm=null,$p.value=!1}}function Om(){Qp.value=`Stopping…`,Yp.value&&Y.chatCancel(Yp.value).catch(()=>{}),mm()}function km(){ra(()=>{hm().catch(e=>{Qp.value=e.message||`Chat unavailable`})}),sa(()=>{mm()})}var Am=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],jm=N({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(L(),R(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full bg-linear-to-br from-primary to-[var(--brand-alt)] text-primary-foreground shadow-[var(--shadow-md)] transition-[transform,box-shadow] duration-[140ms] hover:-translate-y-px hover:shadow-[0_12px_34px_var(--primary-soft)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":A(Kp),onClick:i[0]||=e=>n(`toggle`)},[B(`span`,{"aria-hidden":`true`,class:D(r(!e.open))},[V(A(jd),{size:22})],2),B(`span`,{"aria-hidden":`true`,class:D(r(e.open))},[V(A(Kd),{size:22})],2)],8,Am))}});function Mm(e){return typeof e==`string`?`'${e}'`:new Im().serialize(e)}var Nm=` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`,Pm=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[Nm.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function Fm(e,t){if(e===t)return 0;let n=Math.min(e.length,t.length),r=0;for(let i=0;i<n;i++){let n=e.charCodeAt(i),a=t.charCodeAt(i);if(n===a)continue;let o=n<128&&Pm[n]?Pm[n]:n+128,s=a<128&&Pm[a]?Pm[a]:a+128;if(o!==s)return o<s?-1:1;r===0&&(r=n>a?-1:1)}return e.length===t.length?r:e.length<t.length?-1:1}var Im=(function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?Fm(e,t):n===`number`&&r===`number`?e-t:Fm(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let i=Object.keys(e).sort(Fm),a=`${r}{`;for(let t=0;t<i.length;t++){let n=i[t];a+=`${n}:${this.serialize(e[n])}`,t<i.length-1&&(a+=`,`)}return a+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`InLine truncated
`)].join(`
`))}return()=>i.value||r.value||o.value?ic(t.default({present:o.value})[0],{ref:e=>{let t=hh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),xg=N({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=wh(n.default()),r=e.findIndex(e=>e.type!==ps);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?W(t,i.props):t,o=Os({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),Sg=[`area`,`img`,`input`],Z=N({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&Sg.includes(r)?()=>ic(r,t):r===`template`?()=>ic(xg,t,{default:n.default}):()=>ic(e.as,t,{default:n.default})}});function Cg(){let e=k();return{primitiveElement:e,currentElement:G(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:hh(e))}}function wg({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Tg({type:e,defaultValue:t,modelValue:n}){return e||wg({type:e,defaultValue:t,modelValue:n})}function Eg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Dg(e,t){let n=G(()=>Tg(e)),r=Ch(e,`modelValue`,t,{defaultValue:Eg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Lm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Um(t,e)){let n=t.findIndex(t=>Lm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:G(()=>n.value===`single`)}}var[Og,kg]=zm(`DialogRoot`),Ag=N({inheritAttrs:!1,__name:`DialogRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=Ch(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=k(),a=k(),{modal:o,unmountOnHide:s}=En(n);return kg({open:r,modal:o,unmountOnHide:s,openModal:()=>{r.value=!0},onOpenChange:e=>{r.value=e},onOpenToggle:()=>{r.value=!r.value},contentId:``,titleId:``,descriptionId:``,triggerElement:i,contentElement:a}),(e,t)=>F(e.$slots,`default`,{open:A(r),close:()=>r.value=!1})}}),jg=N({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;X();let n=Og();return(e,r)=>(L(),z(A(Z),W(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>A(n).onOpenChange(!1)}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`type`]))}}),Mg=`dismissableLayer.pointerDownOutside`,Ng=`dismissableLayer.focusOutside`;function Pg(e,t){if(!(t instanceof Element))return!1;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function Fg(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=k(!1),a=k(()=>{});return Ar(o=>{if(!qm||!xn(n))return;let s=async n=>{let o=n.target;if(t?.value&&o){if(Pg(t.value,o)){i.value=!1;return}if(n.target&&!i.value){let t={originalEvent:n};function i(){Vm(Mg,e,t)}n.pointerType===`touch`?(r.removeEventListener(`click`,a.value),a.value=i,r.addEventListener(`click`,a.value,{once:!0})):i()}else r.removeEventListener(`click`,a.value);i.value=!1}},c=window.setTimeout(()=>{r.addEventListener(`pointerdown`,s)},0);o(()=>{window.clearTimeout(c),r.removeEventListener(`pointerdown`,s),r.removeEventListener(`click`,a.value)})}),{onPointerDownCapture:()=>{xn(n)&&(i.value=!0)}}}function Ig(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=k(!1);return Ar(a=>{if(!qm||!xn(n))return;let o=async n=>{if(!t?.value)return;await ar(),await ar();let r=n.target;t.value&&r&&!Pg(t.value,r)&&n.target&&!i.value&&Vm(Ng,e,{originalEvent:n})};r.addEventListener(`focusin`,o),a(()=>r.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{xn(n)&&(i.value=!0)},onBlurCapture:()=>{xn(n)&&(i.value=!1)}}}var Lg=N({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=X(),o=G(()=>a.value?.ownerDocument??globalThis.document),s=G(()=>Ah.layersRoot),c=G(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=G(()=>Ah.layersWithOutsidePointerEventsDisabled.size>0),u=G(()=>{let e=Array.from(s.value),[t]=[...Ah.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=Fg Line truncated
`))}return()=>i.value||r.value||o.value?ic(t.default({present:o.value})[0],{ref:e=>{let t=uh(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),gg=N({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{if(!n.default)return null;let e=yh(n.default()),r=e.findIndex(e=>e.type!==ps);if(r===-1)return e;let i=e[r];delete i.props?.ref;let a=i.props?W(t,i.props):t,o=Os({...i,props:{}},a);return e.length===1?o:(e[r]=o,e)}}}),_g=[`area`,`img`,`input`],Z=N({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:t,slots:n}){let r=e.asChild?`template`:e.as;return typeof r==`string`&&_g.includes(r)?()=>ic(r,t):r===`template`?()=>ic(gg,t,{default:n.default}):()=>ic(e.as,t,{default:n.default})}});function vg(){let e=k();return{primitiveElement:e,currentElement:G(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:uh(e))}}function yg({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function bg({type:e,defaultValue:t,modelValue:n}){return e||yg({type:e,defaultValue:t,modelValue:n})}function xg({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Sg(e,t){let n=G(()=>bg(e)),r=vh(e,`modelValue`,t,{defaultValue:xg(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Lm(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Um(t,e)){let n=t.findIndex(t=>Lm(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:G(()=>n.value===`single`)}}var[Cg,wg]=zm(`DialogRoot`),Tg=N({inheritAttrs:!1,__name:`DialogRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:t}){let n=e,r=vh(n,`open`,t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=k(),a=k(),{modal:o,unmountOnHide:s}=En(n);return wg({open:r,modal:o,unmountOnHide:s,openModal:()=>{r.value=!0},onOpenChange:e=>{r.value=e},onOpenToggle:()=>{r.value=!r.value},contentId:``,titleId:``,descriptionId:``,triggerElement:i,contentElement:a}),(e,t)=>F(e.$slots,`default`,{open:A(r),close:()=>r.value=!1})}}),Eg=N({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;X();let n=Cg();return(e,r)=>(L(),z(A(Z),W(t,{type:e.as===`button`?`button`:void 0,onClick:r[0]||=e=>A(n).onOpenChange(!1)}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`type`]))}}),Dg=`dismissableLayer.pointerDownOutside`,Og=`dismissableLayer.focusOutside`;function kg(e,t){if(!(t instanceof Element))return!1;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function Ag(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=k(!1),a=k(()=>{});return Ar(o=>{if(!qm||!xn(n))return;let s=async n=>{let o=n.target;if(t?.value&&o){if(kg(t.value,o)){i.value=!1;return}if(n.target&&!i.value){let t={originalEvent:n};function i(){Vm(Dg,e,t)}n.pointerType===`touch`?(r.removeEventListener(`click`,a.value),a.value=i,r.addEventListener(`click`,a.value,{once:!0})):i()}else r.removeEventListener(`click`,a.value);i.value=!1}},c=window.setTimeout(()=>{r.addEventListener(`pointerdown`,s)},0);o(()=>{window.clearTimeout(c),r.removeEventListener(`pointerdown`,s),r.removeEventListener(`click`,a.value)})}),{onPointerDownCapture:()=>{xn(n)&&(i.value=!0)}}}function jg(e,t,n=!0){let r=t?.value?.ownerDocument??globalThis?.document,i=k(!1);return Ar(a=>{if(!qm||!xn(n))return;let o=async n=>{if(!t?.value)return;await ar(),await ar();let r=n.target;t.value&&r&&!kg(t.value,r)&&n.target&&!i.value&&Vm(Og,e,{originalEvent:n})};r.addEventListener(`focusin`,o),a(()=>r.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{xn(n)&&(i.value=!0)},onBlurCapture:()=>{xn(n)&&(i.value=!1)}}}var Mg=N({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=X(),o=G(()=>a.value?.ownerDocument??globalThis.document),s=G(()=>Th.layersRoot),c=G(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=G(()=>Th.layersWithOutsidePointerEventsDisabled.size>0),u=G(()=>{let e=Array.from(s.value),[t]=[...Th.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=Ag Line truncated
- a positive number
- less than the value passed to \`max\` (or ${wx} if no \`max\` prop is set)
- less than the value passed to \`max\` (or ${yx} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`),null)}function kx(e){return Dx(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${wx}\`.`),wx)}var Ax=N({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:wx},getValueLabel:{type:Function,required:!1,default:(e,t)=>Dx(e)?`${Math.round(e/t*wx)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;X();let i=Ch(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=Ch(n,`max`,r,{passive:n.max===void 0});M(()=>i.value,async e=>{let t=Ox(e,n.max);t!==e&&(await ar(),i.value=t)},{immediate:!0}),M(()=>n.max,e=>{let t=kx(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=G(()=>Hm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return Ex({modelValue:i,max:a,progressState:o}),(e,t)=>(L(),z(A(Z),{"as-child":e.asChild,as:e.as,"aria-valuemax":A(a),"aria-valuemin":0,"aria-valuenow":Dx(A(i))?A(i):void 0,"aria-valuetext":e.getValueText?.(A(i),A(a)),"aria-label":e.getValueLabel(A(i),A(a)),role:`progressbar`,"data-state":o.value,"data-value":A(i)??void 0,"data-max":A(a)},{default:j(()=>[F(e.$slots,`default`,{modelValue:A(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),jx=N({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=Tx();return X(),(e,r)=>(L(),z(A(Z),W(t,{"data-state":A(n).progressState.value,"data-value":A(n).modelValue?.value??void 0,"data-max":A(n).max.value}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),[Mx,Nx]=zm(`ScrollAreaRoot`),Px=N({__name:`ScrollAreaRoot`,props:{type:{type:String,required:!1,default:`hover`},dir:{type:String,required:!1},scrollHideDelay:{type:Number,required:!1,default:600},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:t}){let n=e,r=k(0),i=k(0),a=k(),o=k(),s=k(),c=k(),l=k(!1),u=k(!1),{type:d,dir:f,scrollHideDelay:p}=En(n),m=zh(f);function h(){a.value?.scrollTo({top:0})}function g(){a.value?.scrollTo({top:0,left:0})}t({viewport:a,scrollTop:h,scrollTopLeft:g});let{forwardRef:_,currentElement:v}=X();return Nx({type:d,dir:m,scrollHideDelay:p,scrollArea:v,viewport:a,onViewportChange:e=>{a.value=e||void 0},content:o,onContentChange:e=>{o.value=e},scrollbarX:s,scrollbarXEnabled:l,scrollbarY:c,scrollbarYEnabled:u,onScrollbarXChange:e=>{s.value=e||void 0},onScrollbarYChange:e=>{c.value=e||void 0},onScrollbarXEnabledChange:e=>{l.value=e},onScrollbarYEnabledChange:e=>{u.value=e},onCornerWidthChange:e=>{r.value=e},onCornerHeightChange:e=>{i.value=e}}),(e,t)=>(L(),z(A(Z),{ref:A(_),"as-child":n.asChild,as:e.as,dir:A(m),style:ve({position:`relative`,"--reka-scroll-area-corner-width":`${r.value}px`,"--reka-scroll-area-corner-height":`${i.value}px`})},{default:j(()=>[F(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`dir`,`style`]))}}),Fx=N({__name:`ScrollAreaCornerImpl`,setup(e){let t=Mx(),n=k(0),r=k(0),i=G(()=>!!n.value&&!!r.value);function a(){let e=t.scrollbarX.value?.offsetHeight||0;t.onCornerHeightChange(e),r.value=e}function o(){let e=t.scrollbarY.value?.offsetWidth||0;t.onCornerWidthChange(e),n.value=e}return Sh(t.scrollbarX.value,a),Sh(t.scrollbarY.value,o),M(()=>t.scrollbarX.value,a),M(()=>t.scrollbarY.value,o),(e,a)=>i.value?(L(),z(A(Z),W({key:0,style:{width:`${n.value}px`,height:`${r.value}px`,position:`absolute`,right:A(t).dir.value===`ltr`?0:void 0,left:A(t).dir.value===`rtl`?0:void 0,bottom:0}},e.$parent?.$props),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`style`])):U(`v-if`,!0)}}),Ix=N({__name:`ScrollAreaCorner`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{forwardRef:n}=X(),r=Mx(),i=G(()=>!!r.scrollbarX.value&&!!r.scrollbarY.value),a=G(()=>r.type.value!==`scroll`&&i.value);return(e,r)=>a.value?(L(),z(Fx,W({key:0},t,{ref:A(n)}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16)):U(`v-if`,!0)}});function Lx(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Rx(e){let t=zx(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function zx(e,t){let n=e/t;return Number.isNaN(n)?0:n}function Bx(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}function Vx(e,t,n=`ltr`){let r=Rx(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=n===`ltr`?[0,o]:[o*-1,0],l=Rm(e,c[0],c[1]);return Lx([0,o],[0,s])(l)}functLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:CT(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>CT(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=TT(c),u=e+1<n.length?TT(n[e+1]):null;if(l&&u&&ET(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=TT(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>CT(e)),rows:r.map(e=>e.map(e=>CT(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:CT(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:CT(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function TT(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function ET(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var DT={class:`[overflow-wrap:anywhere]`},OT={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},kT={class:`font-mono text-[0.85em]`},AT={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},jT={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},MT={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},NT={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},PT={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},FT={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},IT={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},LT={key:8,class:`mb-2.5 last:mb-0`},RT=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=G(()=>wT(t.text));return(e,t)=>(L(),R(`div`,DT,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(I,{key:t},[e.kind===`pre`?(L(),R(`pre`,OT,[B(`code`,kT,O(e.code),1)])):e.kind===`table`?(L(),R(`table`,AT,[B(`thead`,null,[B(`tr`,null,[(L(!0),R(I,null,P(e.head,(e,t)=>(L(),R(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[V(xT,{inline:e},null,8,[`inline`])]))),128))])]),B(`tbody`,null,[(L(!0),R(I,null,P(e.rows,(e,t)=>(L(),R(`tr`,{key:t},[(L(!0),R(I,null,P(e,(e,t)=>(L(),R(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[V(xT,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),R(`blockquote`,jT,[V(xT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),R(`h1`,MT,[V(xT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),R(`h2`,NT,[V(xT,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),R(`h3`,PT,[V(xT,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),R(`ul`,FT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(xT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),R(`ol`,IT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(xT,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),R(`p`,LT,[V(xT,{inline:e.inline},null,8,[`inline`])])):U(``,!0)],64))),128))]))}}),zT={class:`truncate`},BT=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ma(`RouterLink`);return L(),z(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[V(A(yd),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),B(`span`,zT,O(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),VT={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},HT={class:`font-semibold text-foreground`},UT={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},WT=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=G(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=G(()=>t.tool.parameters||t.tool.Parameters||``),i=G(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=G(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(L(),z(BT,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(L(),R(`div`,VT,[V(A(Gd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),B(`span`,HT,O(n.value),1),r.value?(L(),R(`code`,UT,O(r.value),1)):U(``,!0),B(`span`,{class:D(A(J)(`text-fg-muted`,i.value&&`text-danger`))},O(a.value),3)]))}}),GT={key:0,class:`mb-2 grid gap-0.5 text-xs`},KT={key:2,class:`whitespace-pre-wrap`},qT=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),R(`div`,{class:D([`flex`,e.assistant?`justify-start`:`justify-end`])},[B(`div`,{class:D(A(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(L(),R(`div`,GT,[(L(!0),R(I,null,P(e.tools,(t,n)=>(L(),z(WT,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):U(``,!0),e.assistant?(L(),z(RT,{key:1,text:e.text},null,8,[`text`])):(L(),R(`div`,KT,O(e.text),1)),F(t.$slots,`default`)],2)],2))}}),JT={class:`w-full self-center justify-self-center py-6 text-center`},YT={class:`grid gap-2`},XT=[`onClick`],ZT=N({__name:`ChatEmptyState`,emits:[`prompt`],setup(e,{emit:t}){let n=t,r=[`Summarise active tasks`,`Show running agents`,`Check system status`];return(e,t)=>(L(),R(`div`,JT,[t[0]||=B(`span`,{"aria-hidden":`true`,class:`mx-auto mb-3 grid size-9 placLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>cj?`${n.slice(0,cj).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var uj=[`title`],dj=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>NA(n.event)),a=G(()=>lj(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=G(()=>n.event.at?Nk(n.event.at):`—`);return(e,t)=>(L(),z(A(rk),{class:D(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[du(lu(o,[`prevent`]),[`enter`]),du(lu(o,[`prevent`]),[`space`])]},{default:j(()=>[V(A(Q),{class:`font-medium`},{default:j(()=>[H(O(n.event.kind||n.event.type||`event`),1)]),_:1}),V(A(Q),{class:`font-mono`},{default:j(()=>[H(O(i.value>0?`#${i.value}`:`—`),1)]),_:1}),V(A(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[B(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},O(a.value.text),9,uj)]),_:1}),V(A(Q),null,{default:j(()=>[H(O(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),fj={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},pj=N({__name:`LiveActivityCard`,setup(e){let t=bE(),{activity:n,streamKind:r,streamState:i}=ad(hO());function a(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(L(),z(A(RO),null,{default:j(()=>[V(A(UO),null,{default:j(()=>[V(A(WO),null,{default:j(()=>[...t[0]||=[H(`Live activity`,-1)]]),_:1}),V(A(VO),null,{default:j(()=>[...t[1]||=[H(`Last 50, newest first`,-1)]]),_:1}),V(A(zO),null,{default:j(()=>[V(A(ak),{variant:A(r)},{default:j(()=>[H(O(A(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),V(A(BO),null,{default:j(()=>[B(`div`,fj,[V(A(tk),null,{default:j(()=>[V(A(ik),null,{default:j(()=>[V(A(rk),null,{default:j(()=>[V(A($),null,{default:j(()=>[...t[2]||=[H(`Event`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[3]||=[H(`Task`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[4]||=[H(`Detail`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[5]||=[H(`When`,-1)]]),_:1})]),_:1})]),_:1}),V(A(nk),null,{default:j(()=>[A(n).length?(L(!0),R(I,{key:1},P(A(n),(e,t)=>(L(),z(dj,{key:t,event:e,onOpen:a},null,8,[`event`]))),128)):(L(),z(A(rk),{key:0},{default:j(()=>[V(A(Q),{colspan:`4`},{default:j(()=>[V(A(GO),null,{default:j(()=>[V(A(JO),null,{default:j(()=>[V(A(ZO),null,{default:j(()=>[...t[6]||=[H(`Waiting for activity`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1})]),_:1})])]),_:1})]),_:1}))}}),mj=N({__name:`Progress`,props:{modelValue:{default:0},max:{},getValueLabel:{},getValueText:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=EC(t,`class`);return(e,r)=>(L(),z(A(Ax),W({"data-slot":`progress`},A(n),{class:A(J)(`bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class)}),{default:j(()=>[V(A(jx),{"data-slot":`progress-indicator`,class:`bg-primary size-full flex-1 transition-all`,style:ve(`transform: translateX(-${100-(t.modelValue??0)}%);`)},null,8,[`style`])]),_:1},16,[`class`]))}}),hj=`archie.setup-complete.dismissed.v1`;function gj(e,t=globalThis.localStorage){if(!e?.steps?.length)return{kind:`omit`,remaining:[]};let n=e.steps.filter(e=>!e.done);return n.length?(t?.removeItem?.(hj),{kind:`incomplete`,remaining:n}):t?.getItem?.(`archie.setup-complete.dismissed.v1`)===`1`?{kind:`dismissed`,remaining:[]}:{kind:`complete`,remaining:[]}}function _j(e=globalThis.localStorage){e?.setItem?.(hj,`1`)}var vj={class:`text-lg font-semibold text-link`},yj={class:`flex flex-col gap-3`},bj={key:0,class:`mt-0.5 text-xs text-fg-subtle`},xj=N({__name:`SetupPanel`,setup(e){let t=k(gj(EA.value));M(EA,()=>{t.value=gj(EA.value)});let n=G(()=>EA.value?.steps??[]),r=G(()=>{let e=n.value.length;return e?Math.round((e-t.value.remaining.length)/e*100):0});function i(){_j(),t.value=gj(EA.value)}return(e,a)=>t.value.kind===`incomplete`?(L(),z(A(RO),{key:0},{default:j(()=>[V(A(UO),null,{default:j(()=>[V(A(WO),null,{default:j(()=>[...a[0]||=[H(`Finish setting up`,-1)]]),_:1}),V(A(VO),null,{default:j(()=>[...a[1]||=[H(`Archie needs these before it can work on its own.`,-1)]]),_:1}),V(A(zO),null,{default:j(()=>[B(`span`,vj,O(r.value)+`%`,1)]),_:1})]),_:1}),V(A(BO),null,{default:j(()=>[V(A(mj),{"model-value":r.value,class:`mb-4`},null,8,[`model-value`]),B(`ul`,yj,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(`li`,{key:t,class:`flex items-start gap-3`},[B(`span`,{class:D([`mt-px grid size-[18px] flex-none place-items-center rounded-full border-[1.5px] border-border-strong text-xs text-fg-subtle`,e.done?`border-transparent bg-ok-soft text-ok`:``])},[e.done?(L(),z(A(bd),{key:0,class:`size-3`})):U(``,!0)],2),B(`div`,null,[B(`div`,{class:D([`text-sm`,e.done?`text-fg-muted line-through`:``])},O(e.title),3),e.detail?(L(),R(`div`,bj,O(e.detail),1)):U(``,!0)])]))),128))])]),_:1})]),_:1})):t.value.kind===`complete`?(L(),z(A(RO),{key:1},{default:j(()=>[V(A(UO),null,{default:j(()=>[V(A(WO),null,{default:j(()=>[...a[2]||=[H(`Setup complete`,-1) Line truncated
Defaulting to \`null\`.`),null)}function wx(e){return Sx(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${yx}\`.`),yx)}var Tx=N({__name:`ProgressRoot`,props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:yx},getValueLabel:{type:Function,required:!1,default:(e,t)=>Sx(e)?`${Math.round(e/t*yx)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:modelValue`,`update:max`],setup(e,{emit:t}){let n=e,r=t;X();let i=vh(n,`modelValue`,r,{passive:n.modelValue===void 0}),a=vh(n,`max`,r,{passive:n.max===void 0});M(()=>i.value,async e=>{let t=Cx(e,n.max);t!==e&&(await ar(),i.value=t)},{immediate:!0}),M(()=>n.max,e=>{let t=wx(n.max);t!==e&&(a.value=t)},{immediate:!0});let o=G(()=>Hm(i.value)?`indeterminate`:i.value===a.value?`complete`:`loading`);return xx({modelValue:i,max:a,progressState:o}),(e,t)=>(L(),z(A(Z),{"as-child":e.asChild,as:e.as,"aria-valuemax":A(a),"aria-valuemin":0,"aria-valuenow":Sx(A(i))?A(i):void 0,"aria-valuetext":e.getValueText?.(A(i),A(a)),"aria-label":e.getValueLabel(A(i),A(a)),role:`progressbar`,"data-state":o.value,"data-value":A(i)??void 0,"data-max":A(a)},{default:j(()=>[F(e.$slots,`default`,{modelValue:A(i)})]),_:3},8,[`as-child`,`as`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`,`aria-label`,`data-state`,`data-value`,`data-max`]))}}),Ex=N({__name:`ProgressIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=bx();return X(),(e,r)=>(L(),z(A(Z),W(t,{"data-state":A(n).progressState.value,"data-value":A(n).modelValue?.value??void 0,"data-max":A(n).max.value}),{default:j(()=>[F(e.$slots,`default`)]),_:3},16,[`data-state`,`data-value`,`data-max`]))}}),Dx=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ox=[` `,`Enter`];function kx(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(e=>Ax(e,t,n)):Ax(e,t,n)}function Ax(e,t,n){return e===void 0||t===void 0?!1:typeof e==`string`?e===t:typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]===t?.[n]:Lm(e,t)}function jx(e){return e==null||e===``||Array.isArray(e)&&e.length===0}var Mx=[`value`],[Nx,Px]=zm(`SelectRoot`),Fx=N({inheritAttrs:!1,__name:`SelectRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},nullableValue:{type:String,required:!1,default:``},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=e,r=t,{required:i,disabled:a,multiple:o,dir:s}=En(n),c=vh(n,`modelValue`,r,{defaultValue:n.defaultValue??(o.value?[]:void 0),passive:n.modelValue===void 0,deep:!0}),l=vh(n,`open`,r,{defaultValue:n.defaultOpen,passive:n.open===void 0}),u=k(),d=k(),f=k({x:0,y:0}),p=G(()=>o.value&&Array.isArray(c.value)?c.value?.length===0:Hm(c.value));E_({isProvider:!0});let m=Ph(s),h=zh(u),g=k(new Set),_=G(()=>Array.from(g.value).map(e=>e.value).join(`;`));function v(e){if(o.value){let t=Array.isArray(c.value)?[...c.value]:[],r=t.findIndex(t=>Ax(t,e,n.by));r===-1?t.push(e):t.splice(r,1),c.value=[...t]}else c.value=e}function y(e){return Array.from(g.value).find(t=>kx(e,t.value,n.by))}return Px({triggerElement:u,onTriggerChange:e=>{u.value=e},valueElement:d,onValueElementChange:e=>{d.value=e},contentId:``,modelValue:c,onValueChange:v,by:n.by,open:l,multiple:o,required:i,onOpenChange:e=>{l.value=e},dir:m,triggerPointerDownPosRef:f,disabled:a,isEmptyModelValue:p,optionsSet:g,onOptionAdd:e=>{let t=y(e.value);t&&g.value.delete(t),g.value.add(e)},onOptionRemove:e=>{let t=y(e.value);t&&g.value.delete(t)}}),(e,t)=>(L(),z(A(z_),null,{default:j(()=>[F(e.$slots,`default`,{modelValue:A(c),open:A(l)}),A(h)&&e.name?(L(),z(Ix,{key:_.value,"aria-hidden":`true`,tabindex:`-1`,multiple:A(o),required:A(i),name:e.name,autocomplete:e.autocomplete,disabled:A(a),value:A(c)},{default:j(()=>[A(Hm)(A(c))?(L(),R(`option`,{key:0,value:e.nullableValue},null,8,Mx)):U(`v-if`,!0),(L(!0),R(I,null,P(Array.from(g.value),e=>(L(),R(`option`,W({key:e.value??``},{ref_for:!0},e),null,16))),128))]),_:1},8,[`multiple`,`required`,`name`,`autocomplete`,`disabled`,`value`])):U(`v-if`,!0)]),_:3}))}}),Ix=N({__name:`BubbleSelect`,props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(e){let t=e,n=k(),r=Nx();M(()=>t.value,(e,t)=>{let r=window.HTMLSelectElement.prototype,i=Object.getOwnPropertyDescrLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:Vw(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>Vw(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=Uw(c),u=e+1<n.length?Uw(n[e+1]):null;if(l&&u&&Ww(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Uw(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>Vw(e)),rows:r.map(e=>e.map(e=>Vw(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:Vw(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1]);continue}if(c.startsWith(`>`)){o(),s(),t.push({kind:`blockquote`,inline:Vw(c.replace(/^>\s?/,``))});continue}r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function Uw(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function Ww(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Gw={class:`[overflow-wrap:anywhere]`},Kw={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},qw={class:`font-mono text-[0.85em]`},Jw={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Yw={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Xw={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Zw={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Qw={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},$w={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},eT={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},tT={key:8,class:`mb-2.5 last:mb-0`},nT=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=G(()=>Hw(t.text));return(e,t)=>(L(),R(`div`,Gw,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(I,{key:t},[e.kind===`pre`?(L(),R(`pre`,Kw,[B(`code`,qw,O(e.code),1)])):e.kind===`table`?(L(),R(`table`,Jw,[B(`thead`,null,[B(`tr`,null,[(L(!0),R(I,null,P(e.head,(e,t)=>(L(),R(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[V(zw,{inline:e},null,8,[`inline`])]))),128))])]),B(`tbody`,null,[(L(!0),R(I,null,P(e.rows,(e,t)=>(L(),R(`tr`,{key:t},[(L(!0),R(I,null,P(e,(e,t)=>(L(),R(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[V(zw,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),R(`blockquote`,Yw,[V(zw,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),R(`h1`,Xw,[V(zw,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),R(`h2`,Zw,[V(zw,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),R(`h3`,Qw,[V(zw,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),R(`ul`,$w,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(zw,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),R(`ol`,eT,[(L(!0),R(I,null,P(e.items,(e,t)=>(L(),R(`li`,{key:t},[V(zw,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),R(`p`,tT,[V(zw,{inline:e.inline},null,8,[`inline`])])):U(``,!0)],64))),128))]))}}),rT={class:`truncate`},iT=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=ma(`RouterLink`);return L(),z(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[V(A(yd),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),B(`span`,rT,O(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),aT={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},oT={class:`font-semibold text-foreground`},sT={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},cT=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=G(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=G(()=>t.tool.parameters||t.tool.Parameters||``),i=G(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=G(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(L(),z(iT,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(L(),R(`div`,aT,[V(A(Gd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),B(`span`,oT,O(n.value),1),r.value?(L(),R(`code`,sT,O(r.value),1)):U(``,!0),B(`span`,{class:D(A(J)(`text-fg-muted`,i.value&&`text-danger`))},O(a.value),3)]))}}),lT={key:0,class:`mb-2 grid gap-0.5 text-xs`},uT={key:2,class:`whitespace-pre-wrap`},dT=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),R(`div`,{class:D([`flex`,e.assistant?`justify-start`:`justify-end`])},[B(`div`,{class:D(A(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(L(),R(`div`,lT,[(L(!0),R(I,null,P(e.tools,(t,n)=>(L(),z(cT,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):U(``,!0),e.assistant?(L(),z(nT,{key:1,text:e.text},null,8,[`text`])):(L(),R(`div`,uT,O(e.text),1)),F(t.$slots,`default`)],2)],2))}}),fT={class:`w-full self-center justify-self-center py-6 text-center`},pT={class:`grid gap-2`},mT=[`onClick`],hT=N({__name:`ChatEmptyState`,emits:[`prompt`],setup(e,{emit:t}){let n=t,r=[`Summarise active tasks`,`Show running agents`,`Check system status`];return(e,t)=>(L(),R(`div`,fT,[t[0]||=B(`span`,{"aria-hidden":`true`,class:`mx-auto mb-3 grid size-9 placLine truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>xA?`${n.slice(0,xA).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}var CA=[`title`],wA=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=G(()=>Kk(n.event)),a=G(()=>SA(n.event));function o(){i.value>0&&r(`open`,i.value)}let s=G(()=>n.event.at?UO(n.event.at):`—`);return(e,t)=>(L(),z(A(xO),{class:D(i.value>0?`cursor-pointer`:``),role:i.value>0?`link`:void 0,tabindex:i.value>0?0:void 0,title:i.value>0?`Open task details`:void 0,onClick:o,onKeydown:[du(lu(o,[`prevent`]),[`enter`]),du(lu(o,[`prevent`]),[`space`])]},{default:j(()=>[V(A(Q),{class:`font-medium`},{default:j(()=>[H(O(n.event.kind||n.event.type||`event`),1)]),_:1}),V(A(Q),{class:`font-mono`},{default:j(()=>[H(O(i.value>0?`#${i.value}`:`—`),1)]),_:1}),V(A(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[B(`span`,{class:`block truncate`,title:a.value.truncated?a.value.full:void 0},O(a.value.text),9,CA)]),_:1}),V(A(Q),null,{default:j(()=>[H(O(s.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),TA={role:`region`,"aria-label":`Live activity`,"aria-live":`polite`},EA=N({__name:`LiveActivityCard`,setup(e){let t=RT(),{activity:n,streamKind:r,streamState:i}=ad(ND());function a(e){t.push(`/tasks?task=${encodeURIComponent(e)}`)}return(e,t)=>(L(),z(A(nO),null,{default:j(()=>[V(A(sO),null,{default:j(()=>[V(A(cO),null,{default:j(()=>[...t[0]||=[H(`Live activity`,-1)]]),_:1}),V(A(aO),null,{default:j(()=>[...t[1]||=[H(`Last 50, newest first`,-1)]]),_:1}),V(A(rO),null,{default:j(()=>[V(A(CO),{variant:A(r)},{default:j(()=>[H(O(A(i)),1)]),_:1},8,[`variant`])]),_:1})]),_:1}),V(A(iO),null,{default:j(()=>[B(`div`,TA,[V(A(yO),null,{default:j(()=>[V(A(SO),null,{default:j(()=>[V(A(xO),null,{default:j(()=>[V(A($),null,{default:j(()=>[...t[2]||=[H(`Event`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[3]||=[H(`Task`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[4]||=[H(`Detail`,-1)]]),_:1}),V(A($),null,{default:j(()=>[...t[5]||=[H(`When`,-1)]]),_:1})]),_:1})]),_:1}),V(A(bO),null,{default:j(()=>[A(n).length?(L(!0),R(I,{key:1},P(A(n),(e,t)=>(L(),z(wA,{key:t,event:e,onOpen:a},null,8,[`event`]))),128)):(L(),z(A(xO),{key:0},{default:j(()=>[V(A(Q),{colspan:`4`},{default:j(()=>[V(A(lO),null,{default:j(()=>[V(A(fO),null,{default:j(()=>[V(A(hO),null,{default:j(()=>[...t[6]||=[H(`Waiting for activity`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1})]),_:1})])]),_:1})]),_:1}))}}),DA=N({__name:`Progress`,props:{modelValue:{default:0},max:{},getValueLabel:{},getValueText:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=GS(t,`class`);return(e,r)=>(L(),z(A(Tx),W({"data-slot":`progress`},A(n),{class:A(J)(`bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden`,t.class)}),{default:j(()=>[V(A(Ex),{"data-slot":`progress-indicator`,class:`bg-primary size-full flex-1 transition-all`,style:ve(`transform: translateX(-${100-(t.modelValue??0)}%);`)},null,8,[`style`])]),_:1},16,[`class`]))}}),OA=`archie.setup-complete.dismissed.v1`;function kA(e,t=globalThis.localStorage){if(!e?.steps?.length)return{kind:`omit`,remaining:[]};let n=e.steps.filter(e=>!e.done);return n.length?(t?.removeItem?.(OA),{kind:`incomplete`,remaining:n}):t?.getItem?.(`archie.setup-complete.dismissed.v1`)===`1`?{kind:`dismissed`,remaining:[]}:{kind:`complete`,remaining:[]}}function AA(e=globalThis.localStorage){e?.setItem?.(OA,`1`)}var jA={class:`text-lg font-semibold text-link`},MA={class:`flex flex-col gap-3`},NA={key:0,class:`mt-0.5 text-xs text-fg-subtle`},PA=N({__name:`SetupPanel`,setup(e){let t=k(kA(zk.value));M(zk,()=>{t.value=kA(zk.value)});let n=G(()=>zk.value?.steps??[]),r=G(()=>{let e=n.value.length;return e?Math.round((e-t.value.remaining.length)/e*100):0});function i(){AA(),t.value=kA(zk.value)}return(e,a)=>t.value.kind===`incomplete`?(L(),z(A(nO),{key:0},{default:j(()=>[V(A(sO),null,{default:j(()=>[V(A(cO),null,{default:j(()=>[...a[0]||=[H(`Finish setting up`,-1)]]),_:1}),V(A(aO),null,{default:j(()=>[...a[1]||=[H(`Archie needs these before it can work on its own.`,-1)]]),_:1}),V(A(rO),null,{default:j(()=>[B(`span`,jA,O(r.value)+`%`,1)]),_:1})]),_:1}),V(A(iO),null,{default:j(()=>[V(A(DA),{"model-value":r.value,class:`mb-4`},null,8,[`model-value`]),B(`ul`,MA,[(L(!0),R(I,null,P(n.value,(e,t)=>(L(),R(`li`,{key:t,class:`flex items-start gap-3`},[B(`span`,{class:D([`mt-px grid size-[18px] flex-none place-items-center rounded-full border-[1.5px] border-border-strong text-xs text-fg-subtle`,e.done?`border-transparent bg-ok-soft text-ok`:``])},[e.done?(L(),z(A(bd),{key:0,class:`size-3`})):U(``,!0)],2),B(`div`,null,[B(`div`,{class:D([`text-sm`,e.done?`text-fg-muted line-through`:``])},O(e.title),3),e.detail?(L(),R(`div`,NA,O(e.detail),1)):U(``,!0)])]))),128))])]),_:1})]),_:1})):t.value.kind===`complete`?(L(),z(A(nO),{key:1},{default:j(()=>[V(A(sO),null,{default:j(()=>[V(A(cO),null,{default:j(()=>[...a[2]||=[H(`Setup complete`,-1) Line truncated
+55
View File
@@ -0,0 +1,55 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { ago } from "@/lib/format";
import CapturePayload from "./CapturePayload.vue";
import { selected } from "./state";
/**
* The selected capture's payload and headers, beside the list.
*
* A pane rather than a sheet: a sheet covers the list it was opened from and
* has to be dismissed between rows, while an inspector is read by moving down
* the list with the payload in view. On the wide layout it sticks beside the
* list and scrolls internally, so a long payload cannot take the page with it;
* stacked under the list, a selection brings it into view, because a tap that
* changes something off-screen reads as a tap that did nothing.
*
* Nothing here goes stale: a stored capture is never rewritten.
*/
const pane = ref<HTMLElement | null>(null);
const meta = computed(() => {
const capture = selected.value;
if (!capture) return "";
return [ago(capture.received_at), capture.content_type || "no content type", capture.remote_addr]
.filter(Boolean)
.join(" · ");
});
// Below the split's breakpoint the pane sits after the list, so a row click has
// to bring it into view. Same breakpoint as the grid in CapturesPage: one
// layout decision, expressed twice because CSS cannot hand it to script.
const STACKED = "(max-width: 1099px)";
watch(selected, () => {
if (!window.matchMedia(STACKED).matches) return;
pane.value?.scrollIntoView({ block: "start", behavior: "smooth" });
});
</script>
<template>
<div v-if="selected" ref="pane" class="min-w-0 min-[1100px]:sticky min-[1100px]:top-4">
<Card class="min-[1100px]:max-h-[calc(100vh-3rem)] min-[1100px]:overflow-y-auto">
<CardHeader>
<CardTitle class="font-mono">{{ selected.source || "Unknown source" }}</CardTitle>
<CardDescription>{{ meta }}</CardDescription>
</CardHeader>
<CardContent class="flex flex-col gap-5">
<CapturePayload label="Payload" :raw="selected.body" />
<CapturePayload label="Headers" :raw="selected.headers" />
</CardContent>
</Card>
</div>
</template>
-52
View File
@@ -1,52 +0,0 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@/components/ui/sheet";
import { ago } from "@/lib/format";
import CapturePayload from "./CapturePayload.vue";
import { selected, type Capture } from "./state";
/**
* One capture's payload and headers, opened from its row. A side panel rather
* than a taller row: a payload runs to thousands of characters, and the list
* has to stay a list while it is read.
*/
const open = computed({
get: () => selected.value !== null,
set: (value: boolean) => {
if (!value) selected.value = null;
},
});
// What the panel renders. The list drops the selection as soon as this sheet
// reports closed, and the panel stays mounted through the close animation, so
// reading the shared ref would blank it halfway out. Nothing goes stale here:
// a stored capture is never rewritten.
const shown = ref<Capture | null>(null);
watch(selected, (next) => {
if (next) shown.value = next;
});
</script>
<template>
<Sheet v-model:open="open">
<SheetContent class="w-full gap-0 sm:max-w-2xl">
<SheetHeader>
<SheetTitle>{{ shown?.source || "Unknown source" }}</SheetTitle>
<SheetDescription>
{{ ago(shown?.received_at) }} · {{ shown?.content_type || "no content type" }}
</SheetDescription>
</SheetHeader>
<Separator />
<ScrollArea class="min-h-0 flex-1">
<div class="flex flex-col gap-5 p-4">
<CapturePayload label="Payload" :raw="shown?.body" />
<CapturePayload label="Headers" :raw="shown?.headers" />
</div>
</ScrollArea>
</SheetContent>
</Sheet>
</template>
+5 -5
View File
@@ -9,9 +9,9 @@ import { selected, type Capture } from "./state";
/**
* One captured event. The row is the control, not a button sitting in one
* cell: opening the payload is the row's whole job, and a keyboard user has to
* reach what a mouse user clicks -- which is why it is focusable and both
* Enter and Space open it.
* cell: selecting is the row's whole job, and a keyboard user has to reach what
* a mouse user clicks -- which is why it is focusable and both Enter and Space
* select it.
*/
const props = defineProps<{ capture: Capture }>();
@@ -19,7 +19,7 @@ const isSelected = computed(() => selected.value?.id === props.capture.id);
// The name is set here because role="button" makes the cells presentational:
// what a screen reader reads is this, not five unrelated columns.
const label = computed(() => `View the payload received from ${props.capture.source || "an unknown source"}`);
const label = computed(() => `Show the payload received from ${props.capture.source || "an unknown source"}`);
function open(): void {
selected.value = props.capture;
@@ -31,7 +31,7 @@ function open(): void {
:data-state="isSelected ? 'selected' : undefined"
role="button"
tabindex="0"
aria-haspopup="dialog"
:aria-current="isSelected ? 'true' : undefined"
:aria-label="label"
class="cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
@click="open"
+37 -9
View File
@@ -1,21 +1,49 @@
<script setup lang="ts">
import CaptureDetailSheet from "./CaptureDetailSheet.vue";
import { onMounted, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import CaptureDetail from "./CaptureDetail.vue";
import CapturesCard from "./CapturesCard.vue";
import CapturesHeader from "./CapturesHeader.vue";
import { useCaptures } from "./state";
import { load, selectById, selectNewest, selected, useCaptures } from "./state";
/**
* Event inspector (t2db.2): the operator-facing half of capture. Recent
* inbound events, newest first, with the full redacted payload explorable from
* each row -- see docs/prds/event-capture-storage.md for what the backend
* guarantees (retention, redaction, disk bounds). Composes the page; it holds
* no state of its own.
* Event inspector: recent inbound events, newest first, with the selected
* event's payload read beside the list rather than over it -- see
* docs/prds/event-capture-storage.md for what the backend guarantees
* (retention, redaction, disk bounds).
*
* The selection lives in the address bar (`?capture=7`): a row an operator is
* reading survives a reload and can be linked to. Selecting is a `replace`, not
* a push, so walking the list adds no history entries to back out through.
* Narrow screens stack the pane under the list.
*/
useCaptures();
const route = useRoute();
const router = useRouter();
onMounted(async () => {
await load();
// The URL names a selection before the window is read, so the restore waits
// for the list; an id it no longer holds falls back to the newest capture,
// which is what a page opened with nothing named starts on too.
const named = Number(route.query.capture);
if (!Number.isInteger(named) || !selectById(named)) selectNewest();
});
watch(selected, (capture) => {
const query = { ...route.query };
if (capture) query.capture = String(capture.id);
else delete query.capture;
void router.replace({ query });
});
</script>
<template>
<CapturesHeader />
<CapturesCard />
<CaptureDetailSheet />
<div class="grid min-w-0 items-start gap-4 min-[1100px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
<CapturesCard class="min-w-0" />
<CaptureDetail />
</div>
</template>
+24 -8
View File
@@ -1,4 +1,4 @@
import { onMounted, ref } from "vue";
import { ref } from "vue";
import { api } from "@/lib/api";
import { useLiveResource } from "@/stores/live-updates";
@@ -6,7 +6,7 @@ import { useLiveResource } from "@/stores/live-updates";
/**
* The event inspector's shared state.
*
* The list, the stream's state beside it and the sheet that shows one
* The list, the stream's state beside it and the detail pane that shows one
* capture's payload all read it, so it lives in a module rather than being
* threaded down through a chain of props.
*/
@@ -44,9 +44,9 @@ export const error = ref<string | null>(null);
export const loading = ref(true);
/**
* The open row's capture, or null. Held by value rather than by id: the list
* is re-read on every capture event, so resolving an id again would close the
* sheet under an operator reading a capture that has just aged out of the
* The selected capture, or null. Held by value rather than by id: the list is
* re-read on every capture event, so resolving an id again would blank the
* pane under an operator reading a capture that has just aged out of the
* window.
*/
export const selected = ref<Capture | null>(null);
@@ -72,9 +72,25 @@ export async function load(): Promise<void> {
}
}
/** Owns the initial read and the live stream that invalidates it, for the
* page's lifetime. */
/** selectById restores the selection the URL names, if the window still holds
* it. A capture that has aged out cannot be resolved: the list is the only
* read of a capture's body, so an id it no longer carries has nothing to show.
* Reports whether it found one. */
export function selectById(id: number): boolean {
const found = captures.value.find((capture) => capture.id === id);
if (found) selected.value = found;
return Boolean(found);
}
/** selectNewest fills a page opened without a selection, so the pane is useful
* on arrival rather than an empty box beside the list. */
export function selectNewest(): void {
if (captures.value.length) selected.value = captures.value[0];
}
/** Owns the live stream that invalidates the list, for the page's lifetime.
* The initial read belongs to the page, which has to await it before it can
* restore a selection from the address bar. */
export function useCaptures(): void {
useLiveResource("captures", () => void load());
onMounted(load);
}