austere-axi 0.19.0 → 0.20.0

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/austere.js CHANGED
@@ -1787,12 +1787,12 @@ dataLane = Group("DATA STORES WITH A HEADING LONGER THAN THE COLUMN IS WIDE", [c
1787
1787
  <button type="button" data-act="queue" class="primary">Add to queue</button>
1788
1788
  </span>
1789
1789
  </div>
1790
- </div>`,document.body.appendChild(o);let r=o.querySelector(".austere-hover"),n=o.querySelector(".austere-hover-label"),i=o.querySelector(".austere-selbtn"),s=o.querySelector(".austere-pop"),l=o.querySelector(".austere-pop-path"),u=o.querySelector(".austere-pop-quote"),d=o.querySelector("textarea"),p=o.querySelector('[data-act="history"]'),f={},m=!1;function x(){let Y=v&&f[v.targetId]||0;p.hidden=Y<2,p.textContent=`History (${Y})`}d.addEventListener("focus",()=>e({type:"writing",on:!0})),d.addEventListener("blur",()=>e({type:"writing",on:!1}));let v=null,w=null,b=0,k=null,S=Y=>Y instanceof Element&&!!Y.closest(`[${xv}]`),I=Y=>Y instanceof Element&&Y.closest("[data-oui-id]")||null;function C(Y,ue,me=4){Y.style.left=`${ue.left-me}px`,Y.style.top=`${ue.top-me}px`,Y.style.width=`${ue.width+me*2}px`,Y.style.height=`${ue.height+me*2}px`}let M=null,A=null,D=null;function z(Y,ue){let me=ue?Re(ue):MX(Y);r.style.visibility=me?"":"hidden",me&&C(r,me)}function T(Y,ue=null,me=Y&&ue?TEt(Y,ue):null,Ce=NEt(ue)){if(M=Y,A=ue,D=me,!Y){r.hidden=!0;return}z(Y,ue),n.textContent=`${Y.getAttribute("data-oui-id")} \xB7 ${Y.getAttribute("data-oui-c")}${Ce}`,r.hidden=!1}function O(Y){a!=="annotate"||!s.hidden||(k=Y.target,!b&&(b=requestAnimationFrame(()=>{b=0;let ue=k;if(!(ue instanceof Element)||S(ue))return;let me=I(ue);T(me,me&&AEt(me,ue))})))}function B(){let Y=window.getSelection();return!!Y&&!Y.isCollapsed&&Y.toString().trim().length>0}function P(Y){if(a!=="annotate"||S(Y.target))return;if(!s.hidden){Y.preventDefault(),Y.stopPropagation();return}if(B())return;let ue=Y.target;if(!(ue instanceof Element)||!Y.altKey&&ue.closest(hOa))return;let me=I(ue);me&&(Y.preventDefault(),Y.stopPropagation(),te({target:me,el:ue,point:{x:Y.clientX,y:Y.clientY}}))}function H(){if(a!=="annotate"||!s.hidden)return;let Y=window.getSelection();if(!Y||Y.isCollapsed||!Y.rangeCount){i.hidden=!0,w=null;return}let ue=Y.toString().trim(),me=Y.getRangeAt(0),Ce=me.commonAncestorContainer,we=Ce instanceof Element?Ce:Ce.parentElement,K=I(we);if(!ue||!we||!K||S(we)){i.hidden=!0,w=null;return}let se=me.getBoundingClientRect();w={target:K,el:we,selection:eh(ue,600),point:{x:se.left,y:se.bottom}},i.hidden=!1;let xe=i.offsetWidth||140;i.style.left=`${Math.max(8,Math.min(window.innerWidth-xe-8,se.left+se.width/2-xe/2))}px`,i.style.top=`${Math.max(8,Math.min(window.innerHeight-40,se.bottom+8))}px`}let V=0;function W(){clearTimeout(V),V=window.setTimeout(H,120)}i.addEventListener("mousedown",Y=>Y.preventDefault()),i.addEventListener("click",Y=>{Y.preventDefault(),Y.stopPropagation(),w&&te(w),i.hidden=!0});function Z(){let Y=v;Y&&(l.textContent="",Y.path.forEach((ue,me)=>{let Ce=document.createElement("button");if(Ce.type="button",Ce.className="austere-chip"+(ue.id===Y.targetId?" active":""),Ce.textContent=ue.id,Ce.title=ue.component,Ce.addEventListener("click",()=>{Y.targetId=ue.id,Y.component=ue.component,x();let we=me===Y.path.length-1;if(!Y.target.isConnected){let se=Y.path[Y.path.length-1].id;Y.target=document.querySelector(`[data-oui-id="${CSS.escape(se)}"]`)??Y.target}let K=`[data-oui-id="${CSS.escape(ue.id)}"]`;T(Y.target.closest(K)??document.querySelector(K),we?Y.piece:null,we?Y.relocate:null,we?Y.pieceLabel:""),st(),Z(),d.focus()}),l.appendChild(Ce),me<Y.path.length-1){let we=document.createElement("span");we.className="austere-chip-sep",we.textContent="\u203A",l.appendChild(we)}}))}function te({target:Y,el:ue,selection:me,point:Ce}){let we=gOa(Y),K=yOa(Y,ue),se=_X(Y,ue),xe=AEt(Y,ue),le;if(!me){let Lt=se||ue;le=eh((Lt instanceof HTMLElement?Lt.innerText:void 0)||Lt.textContent,200)||void 0,se&&le===K?.part&&(le=void 0)}let rt=REt(Y);e({type:"focus",id:rt.id}),v={target:Y,piece:xe,relocate:xe&&TEt(Y,xe),pieceLabel:NEt(xe),targetId:rt.id,component:rt.component,path:we,selection:me||void 0,excerpt:le,detail:K},Z(),x();let Ze=me||le||K?.part||"";u.textContent=eh(Ze,220),u.hidden=!Ze,d.value="",r.hidden=!0,i.hidden=!0,T(Y,xe,v.relocate,v.pieceLabel),r.classList.add("locked"),s.hidden=!1,ae(Ce),d.focus()}function ae(Y){if(window.innerWidth<640){s.classList.add("sheet"),s.style.left=s.style.top="";return}s.classList.remove("sheet");let ue=s.offsetWidth||360,me=s.offsetHeight||200,Ce=Y.x+12,we=Y.y+12;Ce+ue>window.innerWidth-8&&(Ce=Math.max(8,Y.x-ue-12)),we+me>window.innerHeight-8&&(we=Math.max(8,Y.y-me-12)),s.style.left=`${Ce}px`,s.style.top=`${we}px`}function q(){document.activeElement===d&&d.blur(),s.hidden=!0,r.classList.remove("locked"),r.hidden=!0,v=null}function ne(){let Y=d.value.trim();if(!v)return;if(!Y&&!v.selection){d.focus(),d.classList.add("shake"),setTimeout(()=>d.classList.remove("shake"),400);return}let ue={kind:"annotation",target:v.targetId,component:v.component,path:v.path.map(we=>we.id),note:Y};v.selection&&(ue.selection=v.selection),v.excerpt&&!v.selection&&(ue.excerpt=v.excerpt),v.detail&&v.targetId===v.path[v.path.length-1].id&&(ue.detail=v.detail),e({type:"annotate",item:ue});let me=v.targetId,Ce=ue.detail?A:null;q(),window.getSelection()?.removeAllRanges(),Ce?.isConnected?Ve(Ce,"queued"):Ee([me],"queued")}s.addEventListener("click",Y=>{let ue=Y.target instanceof Element?Y.target.closest("[data-act]")?.getAttribute("data-act"):void 0;ue==="cancel"&&q(),ue==="queue"&&ne(),ue==="history"&&v&&e({type:"history",id:v.targetId})}),d.addEventListener("keydown",Y=>{Y.key==="Enter"&&!Y.shiftKey&&!Y.isComposing?(Y.preventDefault(),ne()):Y.key==="Escape"&&(Y.preventDefault(),d.value.trim()||q())}),document.addEventListener("mousemove",O,{passive:!0}),document.addEventListener("click",P,!0),document.addEventListener("mouseup",W),document.addEventListener("keyup",Y=>{(Y.shiftKey||Y.key.startsWith("Arrow"))&&W()}),document.addEventListener("selectionchange",()=>{"ontouchstart"in window&&W()}),document.addEventListener("keydown",Y=>{(Y.metaKey||Y.ctrlKey)&&(Y.key==="i"||Y.key==="I")?(Y.preventDefault(),e({type:"toggle-mode"})):m&&(Y.metaKey||Y.ctrlKey)&&!Y.altKey&&(Y.key==="k"||Y.key==="K")?(Y.preventDefault(),e({type:"quick-switch"})):m&&(Y.metaKey||Y.ctrlKey)&&!Y.altKey&&(Y.key==="b"||Y.key==="B")&&(Y.preventDefault(),e({type:"toggle-sidebar"}))}),window.addEventListener("scroll",()=>{if(!s.hidden)return Pe();r.hidden=!0,i.hidden=!0},{passive:!0}),document.addEventListener("mouseleave",()=>{s.hidden&&(r.hidden=!0)});function fe(Y,ue,me,Ce=new Set){if(Ce.has(Y))return[];Ce.add(Y);let we=document.querySelectorAll(`[data-oui-id="${CSS.escape(Y)}"]`);return we.length?Array.from(we):!ue||!me?[]:me(ue,Y).flatMap(K=>fe(K,ue,me,Ce))}function U(Y,ue,me){let Ce=new Set;for(let we of Y)for(let K of fe(we,ue,me))Ce.add(K);return Array.from(Ce).filter(we=>!Array.from(Ce).some(K=>K!==we&&K.contains(we)))}function Be(Y,ue){let me=document.createElement("div");return me.setAttribute(xv,""),me.className=ue,me.style.left=`${Y.left+window.scrollX-4}px`,me.style.top=`${Y.top+window.scrollY-4}px`,me.style.width=`${Y.width+8}px`,me.style.height=`${Y.height+8}px`,me}function We(Y){if(getComputedStyle(Y).display!=="contents")return CX(Y);let[ue,me,Ce,we]=[1/0,1/0,-1/0,-1/0],K=xe=>{!xe.width&&!xe.height||([ue,me,Ce,we]=[Math.min(ue,xe.left),Math.min(me,xe.top),Math.max(Ce,xe.right),Math.max(we,xe.bottom)])},se=xe=>{for(let le of xe.childNodes)if(le instanceof Element)getComputedStyle(le).display==="contents"?se(le):K(CX(le));else if(le.nodeType===Node.TEXT_NODE&&le.textContent?.trim()){let rt=document.createRange();rt.selectNodeContents(le),K(rt.getBoundingClientRect())}};return se(Y),{left:ue,top:me,right:Ce,bottom:we}}function Oe(Y){for(let ue=Y.closest("[hidden='until-found']");ue?.parentElement;ue=Y.closest("[hidden='until-found']"))Y=ue.parentElement;return Y}function Re(Y){let ue=Oe(Y),{left:me,top:Ce,right:we,bottom:K}=We(ue),se=we===me,xe=K===Ce;if(se&&xe)return null;for(let Ze=ue.parentElement;Ze&&Ze!==document.body;Ze=Ze.parentElement){let Lt=getComputedStyle(Ze),Ut=Lt.overflowX!=="visible",Ga=Lt.overflowY!=="visible";if(!Ut&&!Ga||Lt.display==="contents")continue;let Na=Ze.getBoundingClientRect();Ut&&([me,we]=[Math.max(me,Na.left),Math.min(we,Na.right)]),Ga&&([Ce,K]=[Math.max(Ce,Na.top),Math.min(K,Na.bottom)])}let le=se?we>=me:we>me,rt=xe?K>=Ce:K>Ce;return le&&rt?{left:me,top:Ce,width:we-me,height:K-Ce}:null}function Ve(Y,ue){let me=Re(Y);if(!me)return;let Ce=Be(me,`austere-flash ${ue}`);document.body.appendChild(Ce),setTimeout(()=>Ce.remove(),2400)}function Ee(Y,ue="changed",me,Ce){let we=U(Y,me,Ce);for(let K of we)Ve(K,ue);return we}function re(Y,ue,me){let Ce=fe(Y,ue,me);if(!Ce.length)return!1;for(let se=Ce[0].closest("[hidden='until-found']");se;se=Ce[0].closest("[hidden='until-found']"))se.removeAttribute("hidden"),se.dispatchEvent(new Event("beforematch"));let we=MX(Ce[0]),K=we.top+window.scrollY-Math.max(24,(window.innerHeight-we.height)/3);return window.scrollTo({top:Math.max(0,K),behavior:"smooth"}),setTimeout(()=>Ee([Y],"changed",ue,me),350),!0}let J=document.createElement("div");J.setAttribute(xv,""),o.appendChild(J);let ie=null,ge=0,Ae=document.createElement("div");Ae.setAttribute(xv,""),o.appendChild(Ae);let Me=[];function ct(){let[Y,ue]=ie&&t?t():[],me=[],Ce=[];for(let we of ie?U(ie,Y,ue):[]){let K=Re(we);K&&(me.push(we),Ce.push(K))}return J.replaceChildren(...Ce.map(we=>Be(we,"austere-mark"))),me}function st(){if(!(r.hidden||!M)){if(!M.isConnected){let Y=M.getAttribute("data-oui-id");M=document.querySelector(`[data-oui-id="${CSS.escape(Y)}"]`)}M&&A&&!A.isConnected&&(A=D?.(M)??A),M?z(M,A):r.hidden=!0}}function Pe(){ge||!ie&&r.hidden&&!Me.length||(ge=requestAnimationFrame(()=>{ge=0,ie&&ct(),Me.length&&St(),st()}))}window.addEventListener("resize",Pe,{passive:!0}),new ResizeObserver(Pe).observe(document.body),new MutationObserver(Y=>{Y.some(ue=>!S(ue.target.nodeType===1?ue.target:ue.target.parentElement))&&Pe()}).observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","x","y","width","height","d","transform","viewBox"]}),document.addEventListener("scroll",Y=>{Y.target!==document&&Pe()},{capture:!0,passive:!0});function Ft(Y,ue=!1){ie=Y.length?Y:null;let me=ct();if(ue&&me.length){let Ce=me.map(we=>MX(Oe(we)));if(!Ce.some(we=>we.bottom>0&&we.top<window.innerHeight)){let we=Ce[0],K=we.top+window.scrollY-Math.max(24,(window.innerHeight-we.height)/3);window.scrollTo({top:Math.max(0,K),behavior:"smooth"})}}return me.length}function St(){let[Y,ue]=Me.length&&t?t():[],me=new Map;for(let we of Me)me.set(we.statement,[...me.get(we.statement)??[],we]);let Ce=[];for(let[we,K]of me){let se=!1;for(let xe of U([we],Y,ue)){let le=Re(xe);if(!le)continue;let rt=Be(le,"austere-focus");if(rt.style.setProperty("--austere-viewer",K[0].colour),!se){se=!0;let Ze=document.createElement("div");Ze.className="austere-focus-names";for(let Lt of K){let Ut=document.createElement("span");Ut.textContent=Lt.name,Ut.style.background=Lt.colour,Ze.appendChild(Ut)}rt.appendChild(Ze)}Ce.push(rt)}}Ae.replaceChildren(...Ce)}function qt(Y){Me=Y,St()}return{setQuickSwitch(Y){m=Y},setHistory(Y){f=Y,v&&x()},setMode(Y){a=Y==="annotate"?"annotate":"explore",document.documentElement.classList.toggle("austere-annotating",a==="annotate"),a!=="annotate"&&(q(),i.hidden=!0,r.hidden=!0)},flash:Ee,reveal:re,highlight:Ft,focus:qt}}var DEt={shadcn:{name:"@austere-axi/pack-shadcn",version:"0.19.0",components:["Progress","Avatar","AvatarGroup","Tooltip","HoverCard","Breadcrumb","BreadcrumbItem","Kbd","Skeleton","Calendar","Timeline","TimelineItem"]}};function xOa(e){let t=e.lastIndexOf("@");return t<=0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}var vOa=/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,bOa=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function OEt(e){let t=[];for(let a of String(e||"").split(",")){let[o,r]=a.trim().split(/\s+/);if(!o)continue;let{name:n,version:i}=xOa(o);!vOa.test(n)||!bOa.test(i)||t.some(s=>s.name===n)||t.push(r&&/^sha(256|384|512)-[A-Za-z0-9+/=]+$/.test(r)?{name:n,version:i,integrity:r}:{name:n,version:i})}return t}var PEt="https://cdn.jsdelivr.net/npm";function BEt(e=document){let t=e.querySelector('meta[name="austere-packs"]');return t?OEt(t.getAttribute("content")||""):[]}function FEt(e,t){let a=[...t];for(let[o,r]of Object.entries(DEt))a.some(n=>n.name===r.name)||r.components.some(n=>new RegExp(`\\b${n}\\s*\\(`).test(e))&&a.push({name:r.name,version:r.version,bundled:o});return a}function AX(){return/\/__austere\/$/.test(w2)}function kOa(e){if(e.bundled)return{src:F4(`packs/${e.bundled}/pack.js`)||`${PEt}/austere-axi@${e.version}/dist/packs/${e.bundled}/pack.js`};if(AX()){let t=e.integrity?`?integrity=${encodeURIComponent(e.integrity)}`:"";return{src:`${w2}installed-packs/${encodeURIComponent(`${e.name}@${e.version}`)}/pack.js${t}`}}return{src:`${PEt}/${e.name}@${e.version}/dist/pack.js`,integrity:e.integrity}}function wOa(e,t){return new Promise((a,o)=>{let r=document.createElement("script");r.src=e,r.async=!0,t&&(r.integrity=t,r.crossOrigin="anonymous"),r.onload=()=>a(),r.onerror=()=>o(new Error(`could not load ${e}`)),document.head.appendChild(r)})}async function qEt(e,{onError:t}={}){let a=e.filter(o=>!hl().some(r=>r.name===o.name));return await Promise.all(a.map(o=>{let{src:r,integrity:n}=kOa(o);return wOa(r,n).then(()=>{hl().some(i=>i.name===o.name)||t?.(o,new Error(`${r} loaded but did not register pack ${o.name}`))},i=>t?.(o,i))})),hl()}function HEt(e){for(let t of e){if(!t.css)continue;let a=`austere-pack-css-${t.name.replace(/[^a-z0-9]/gi,"-")}`;if(document.getElementById(a))continue;let o=document.createElement("style");o.id=a,o.textContent=t.css,document.head.appendChild(o)}}var SOa=/[A-Za-z_$]/;function LOa(e){let t=[],a=String(e??""),o=0,r=1,n=a.length;for(;o<n;){let i=a[o];if(i===`
1790
+ </div>`,document.body.appendChild(o);let r=o.querySelector(".austere-hover"),n=o.querySelector(".austere-hover-label"),i=o.querySelector(".austere-selbtn"),s=o.querySelector(".austere-pop"),l=o.querySelector(".austere-pop-path"),u=o.querySelector(".austere-pop-quote"),d=o.querySelector("textarea"),p=o.querySelector('[data-act="history"]'),f={},m=!1;function x(){let Y=v&&f[v.targetId]||0;p.hidden=Y<2,p.textContent=`History (${Y})`}d.addEventListener("focus",()=>e({type:"writing",on:!0})),d.addEventListener("blur",()=>e({type:"writing",on:!1}));let v=null,w=null,b=0,k=null,S=Y=>Y instanceof Element&&!!Y.closest(`[${xv}]`),I=Y=>Y instanceof Element&&Y.closest("[data-oui-id]")||null;function C(Y,ue,me=4){Y.style.left=`${ue.left-me}px`,Y.style.top=`${ue.top-me}px`,Y.style.width=`${ue.width+me*2}px`,Y.style.height=`${ue.height+me*2}px`}let M=null,A=null,D=null;function z(Y,ue){let me=ue?Re(ue):MX(Y);r.style.visibility=me?"":"hidden",me&&C(r,me)}function T(Y,ue=null,me=Y&&ue?TEt(Y,ue):null,Ce=NEt(ue)){if(M=Y,A=ue,D=me,!Y){r.hidden=!0;return}z(Y,ue),n.textContent=`${Y.getAttribute("data-oui-id")} \xB7 ${Y.getAttribute("data-oui-c")}${Ce}`,r.hidden=!1}function O(Y){a!=="annotate"||!s.hidden||(k=Y.target,!b&&(b=requestAnimationFrame(()=>{b=0;let ue=k;if(!(ue instanceof Element)||S(ue))return;let me=I(ue);T(me,me&&AEt(me,ue))})))}function B(){let Y=window.getSelection();return!!Y&&!Y.isCollapsed&&Y.toString().trim().length>0}function P(Y){if(a!=="annotate"||S(Y.target))return;if(!s.hidden){Y.preventDefault(),Y.stopPropagation();return}if(B())return;let ue=Y.target;if(!(ue instanceof Element)||!Y.altKey&&ue.closest(hOa))return;let me=I(ue);me&&(Y.preventDefault(),Y.stopPropagation(),te({target:me,el:ue,point:{x:Y.clientX,y:Y.clientY}}))}function H(){if(a!=="annotate"||!s.hidden)return;let Y=window.getSelection();if(!Y||Y.isCollapsed||!Y.rangeCount){i.hidden=!0,w=null;return}let ue=Y.toString().trim(),me=Y.getRangeAt(0),Ce=me.commonAncestorContainer,we=Ce instanceof Element?Ce:Ce.parentElement,K=I(we);if(!ue||!we||!K||S(we)){i.hidden=!0,w=null;return}let se=me.getBoundingClientRect();w={target:K,el:we,selection:eh(ue,600),point:{x:se.left,y:se.bottom}},i.hidden=!1;let xe=i.offsetWidth||140;i.style.left=`${Math.max(8,Math.min(window.innerWidth-xe-8,se.left+se.width/2-xe/2))}px`,i.style.top=`${Math.max(8,Math.min(window.innerHeight-40,se.bottom+8))}px`}let V=0;function W(){clearTimeout(V),V=window.setTimeout(H,120)}i.addEventListener("mousedown",Y=>Y.preventDefault()),i.addEventListener("click",Y=>{Y.preventDefault(),Y.stopPropagation(),w&&te(w),i.hidden=!0});function Z(){let Y=v;Y&&(l.textContent="",Y.path.forEach((ue,me)=>{let Ce=document.createElement("button");if(Ce.type="button",Ce.className="austere-chip"+(ue.id===Y.targetId?" active":""),Ce.textContent=ue.id,Ce.title=ue.component,Ce.addEventListener("click",()=>{Y.targetId=ue.id,Y.component=ue.component,x();let we=me===Y.path.length-1;if(!Y.target.isConnected){let se=Y.path[Y.path.length-1].id;Y.target=document.querySelector(`[data-oui-id="${CSS.escape(se)}"]`)??Y.target}let K=`[data-oui-id="${CSS.escape(ue.id)}"]`;T(Y.target.closest(K)??document.querySelector(K),we?Y.piece:null,we?Y.relocate:null,we?Y.pieceLabel:""),st(),Z(),d.focus()}),l.appendChild(Ce),me<Y.path.length-1){let we=document.createElement("span");we.className="austere-chip-sep",we.textContent="\u203A",l.appendChild(we)}}))}function te({target:Y,el:ue,selection:me,point:Ce}){let we=gOa(Y),K=yOa(Y,ue),se=_X(Y,ue),xe=AEt(Y,ue),le;if(!me){let Lt=se||ue;le=eh((Lt instanceof HTMLElement?Lt.innerText:void 0)||Lt.textContent,200)||void 0,se&&le===K?.part&&(le=void 0)}let rt=REt(Y);e({type:"focus",id:rt.id}),v={target:Y,piece:xe,relocate:xe&&TEt(Y,xe),pieceLabel:NEt(xe),targetId:rt.id,component:rt.component,path:we,selection:me||void 0,excerpt:le,detail:K},Z(),x();let Ze=me||le||K?.part||"";u.textContent=eh(Ze,220),u.hidden=!Ze,d.value="",r.hidden=!0,i.hidden=!0,T(Y,xe,v.relocate,v.pieceLabel),r.classList.add("locked"),s.hidden=!1,ae(Ce),d.focus()}function ae(Y){if(window.innerWidth<640){s.classList.add("sheet"),s.style.left=s.style.top="";return}s.classList.remove("sheet");let ue=s.offsetWidth||360,me=s.offsetHeight||200,Ce=Y.x+12,we=Y.y+12;Ce+ue>window.innerWidth-8&&(Ce=Math.max(8,Y.x-ue-12)),we+me>window.innerHeight-8&&(we=Math.max(8,Y.y-me-12)),s.style.left=`${Ce}px`,s.style.top=`${we}px`}function q(){document.activeElement===d&&d.blur(),s.hidden=!0,r.classList.remove("locked"),r.hidden=!0,v=null}function ne(){let Y=d.value.trim();if(!v)return;if(!Y&&!v.selection){d.focus(),d.classList.add("shake"),setTimeout(()=>d.classList.remove("shake"),400);return}let ue={kind:"annotation",target:v.targetId,component:v.component,path:v.path.map(we=>we.id),note:Y};v.selection&&(ue.selection=v.selection),v.excerpt&&!v.selection&&(ue.excerpt=v.excerpt),v.detail&&v.targetId===v.path[v.path.length-1].id&&(ue.detail=v.detail),e({type:"annotate",item:ue});let me=v.targetId,Ce=ue.detail?A:null;q(),window.getSelection()?.removeAllRanges(),Ce?.isConnected?Ve(Ce,"queued"):Ee([me],"queued")}s.addEventListener("click",Y=>{let ue=Y.target instanceof Element?Y.target.closest("[data-act]")?.getAttribute("data-act"):void 0;ue==="cancel"&&q(),ue==="queue"&&ne(),ue==="history"&&v&&e({type:"history",id:v.targetId})}),d.addEventListener("keydown",Y=>{Y.key==="Enter"&&!Y.shiftKey&&!Y.isComposing?(Y.preventDefault(),ne()):Y.key==="Escape"&&(Y.preventDefault(),d.value.trim()||q())}),document.addEventListener("mousemove",O,{passive:!0}),document.addEventListener("click",P,!0),document.addEventListener("mouseup",W),document.addEventListener("keyup",Y=>{(Y.shiftKey||Y.key.startsWith("Arrow"))&&W()}),document.addEventListener("selectionchange",()=>{"ontouchstart"in window&&W()}),document.addEventListener("keydown",Y=>{(Y.metaKey||Y.ctrlKey)&&(Y.key==="i"||Y.key==="I")?(Y.preventDefault(),e({type:"toggle-mode"})):m&&(Y.metaKey||Y.ctrlKey)&&!Y.altKey&&(Y.key==="k"||Y.key==="K")?(Y.preventDefault(),e({type:"quick-switch"})):m&&(Y.metaKey||Y.ctrlKey)&&!Y.altKey&&(Y.key==="b"||Y.key==="B")&&(Y.preventDefault(),e({type:"toggle-sidebar"}))}),window.addEventListener("scroll",()=>{if(!s.hidden)return Pe();r.hidden=!0,i.hidden=!0},{passive:!0}),document.addEventListener("mouseleave",()=>{s.hidden&&(r.hidden=!0)});function fe(Y,ue,me,Ce=new Set){if(Ce.has(Y))return[];Ce.add(Y);let we=document.querySelectorAll(`[data-oui-id="${CSS.escape(Y)}"]`);return we.length?Array.from(we):!ue||!me?[]:me(ue,Y).flatMap(K=>fe(K,ue,me,Ce))}function U(Y,ue,me){let Ce=new Set;for(let we of Y)for(let K of fe(we,ue,me))Ce.add(K);return Array.from(Ce).filter(we=>!Array.from(Ce).some(K=>K!==we&&K.contains(we)))}function Be(Y,ue){let me=document.createElement("div");return me.setAttribute(xv,""),me.className=ue,me.style.left=`${Y.left+window.scrollX-4}px`,me.style.top=`${Y.top+window.scrollY-4}px`,me.style.width=`${Y.width+8}px`,me.style.height=`${Y.height+8}px`,me}function We(Y){if(getComputedStyle(Y).display!=="contents")return CX(Y);let[ue,me,Ce,we]=[1/0,1/0,-1/0,-1/0],K=xe=>{!xe.width&&!xe.height||([ue,me,Ce,we]=[Math.min(ue,xe.left),Math.min(me,xe.top),Math.max(Ce,xe.right),Math.max(we,xe.bottom)])},se=xe=>{for(let le of xe.childNodes)if(le instanceof Element)getComputedStyle(le).display==="contents"?se(le):K(CX(le));else if(le.nodeType===Node.TEXT_NODE&&le.textContent?.trim()){let rt=document.createRange();rt.selectNodeContents(le),K(rt.getBoundingClientRect())}};return se(Y),{left:ue,top:me,right:Ce,bottom:we}}function Oe(Y){for(let ue=Y.closest("[hidden='until-found']");ue?.parentElement;ue=Y.closest("[hidden='until-found']"))Y=ue.parentElement;return Y}function Re(Y){let ue=Oe(Y),{left:me,top:Ce,right:we,bottom:K}=We(ue),se=we===me,xe=K===Ce;if(se&&xe)return null;for(let Ze=ue.parentElement;Ze&&Ze!==document.body;Ze=Ze.parentElement){let Lt=getComputedStyle(Ze),Ut=Lt.overflowX!=="visible",Ga=Lt.overflowY!=="visible";if(!Ut&&!Ga||Lt.display==="contents")continue;let Na=Ze.getBoundingClientRect();Ut&&([me,we]=[Math.max(me,Na.left),Math.min(we,Na.right)]),Ga&&([Ce,K]=[Math.max(Ce,Na.top),Math.min(K,Na.bottom)])}let le=se?we>=me:we>me,rt=xe?K>=Ce:K>Ce;return le&&rt?{left:me,top:Ce,width:we-me,height:K-Ce}:null}function Ve(Y,ue){let me=Re(Y);if(!me)return;let Ce=Be(me,`austere-flash ${ue}`);document.body.appendChild(Ce),setTimeout(()=>Ce.remove(),2400)}function Ee(Y,ue="changed",me,Ce){let we=U(Y,me,Ce);for(let K of we)Ve(K,ue);return we}function re(Y,ue,me){let Ce=fe(Y,ue,me);if(!Ce.length)return!1;for(let se=Ce[0].closest("[hidden='until-found']");se;se=Ce[0].closest("[hidden='until-found']"))se.removeAttribute("hidden"),se.dispatchEvent(new Event("beforematch"));let we=MX(Ce[0]),K=we.top+window.scrollY-Math.max(24,(window.innerHeight-we.height)/3);return window.scrollTo({top:Math.max(0,K),behavior:"smooth"}),setTimeout(()=>Ee([Y],"changed",ue,me),350),!0}let J=document.createElement("div");J.setAttribute(xv,""),o.appendChild(J);let ie=null,ge=0,Ae=document.createElement("div");Ae.setAttribute(xv,""),o.appendChild(Ae);let Me=[];function ct(){let[Y,ue]=ie&&t?t():[],me=[],Ce=[];for(let we of ie?U(ie,Y,ue):[]){let K=Re(we);K&&(me.push(we),Ce.push(K))}return J.replaceChildren(...Ce.map(we=>Be(we,"austere-mark"))),me}function st(){if(!(r.hidden||!M)){if(!M.isConnected){let Y=M.getAttribute("data-oui-id");M=document.querySelector(`[data-oui-id="${CSS.escape(Y)}"]`)}M&&A&&!A.isConnected&&(A=D?.(M)??A),M?z(M,A):r.hidden=!0}}function Pe(){ge||!ie&&r.hidden&&!Me.length||(ge=requestAnimationFrame(()=>{ge=0,ie&&ct(),Me.length&&St(),st()}))}window.addEventListener("resize",Pe,{passive:!0}),new ResizeObserver(Pe).observe(document.body),new MutationObserver(Y=>{Y.some(ue=>!S(ue.target.nodeType===1?ue.target:ue.target.parentElement))&&Pe()}).observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open","x","y","width","height","d","transform","viewBox"]}),document.addEventListener("scroll",Y=>{Y.target!==document&&Pe()},{capture:!0,passive:!0});function Ft(Y,ue=!1){ie=Y.length?Y:null;let me=ct();if(ue&&me.length){let Ce=me.map(we=>MX(Oe(we)));if(!Ce.some(we=>we.bottom>0&&we.top<window.innerHeight)){let we=Ce[0],K=we.top+window.scrollY-Math.max(24,(window.innerHeight-we.height)/3);window.scrollTo({top:Math.max(0,K),behavior:"smooth"})}}return me.length}function St(){let[Y,ue]=Me.length&&t?t():[],me=new Map;for(let we of Me)me.set(we.statement,[...me.get(we.statement)??[],we]);let Ce=[];for(let[we,K]of me){let se=!1;for(let xe of U([we],Y,ue)){let le=Re(xe);if(!le)continue;let rt=Be(le,"austere-focus");if(rt.style.setProperty("--austere-viewer",K[0].colour),!se){se=!0;let Ze=document.createElement("div");Ze.className="austere-focus-names";for(let Lt of K){let Ut=document.createElement("span");Ut.textContent=Lt.name,Ut.style.background=Lt.colour,Ze.appendChild(Ut)}rt.appendChild(Ze)}Ce.push(rt)}}Ae.replaceChildren(...Ce)}function qt(Y){Me=Y,St()}return{setQuickSwitch(Y){m=Y},setHistory(Y){f=Y,v&&x()},setMode(Y){a=Y==="annotate"?"annotate":"explore",document.documentElement.classList.toggle("austere-annotating",a==="annotate"),a!=="annotate"&&(q(),i.hidden=!0,r.hidden=!0)},flash:Ee,reveal:re,highlight:Ft,focus:qt}}var DEt={shadcn:{name:"@austere-axi/pack-shadcn",version:"0.20.0",components:["Progress","Avatar","AvatarGroup","Tooltip","HoverCard","Breadcrumb","BreadcrumbItem","Kbd","Skeleton","Calendar","Timeline","TimelineItem"]}};function xOa(e){let t=e.lastIndexOf("@");return t<=0?{name:e,version:""}:{name:e.slice(0,t),version:e.slice(t+1)}}var vOa=/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,bOa=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function OEt(e){let t=[];for(let a of String(e||"").split(",")){let[o,r]=a.trim().split(/\s+/);if(!o)continue;let{name:n,version:i}=xOa(o);!vOa.test(n)||!bOa.test(i)||t.some(s=>s.name===n)||t.push(r&&/^sha(256|384|512)-[A-Za-z0-9+/=]+$/.test(r)?{name:n,version:i,integrity:r}:{name:n,version:i})}return t}var PEt="https://cdn.jsdelivr.net/npm";function BEt(e=document){let t=e.querySelector('meta[name="austere-packs"]');return t?OEt(t.getAttribute("content")||""):[]}function FEt(e,t){let a=[...t];for(let[o,r]of Object.entries(DEt))a.some(n=>n.name===r.name)||r.components.some(n=>new RegExp(`\\b${n}\\s*\\(`).test(e))&&a.push({name:r.name,version:r.version,bundled:o});return a}function AX(){return/\/__austere\/$/.test(w2)}function kOa(e){if(e.bundled)return{src:F4(`packs/${e.bundled}/pack.js`)||`${PEt}/austere-axi@${e.version}/dist/packs/${e.bundled}/pack.js`};if(AX()){let t=e.integrity?`?integrity=${encodeURIComponent(e.integrity)}`:"";return{src:`${w2}installed-packs/${encodeURIComponent(`${e.name}@${e.version}`)}/pack.js${t}`}}return{src:`${PEt}/${e.name}@${e.version}/dist/pack.js`,integrity:e.integrity}}function wOa(e,t){return new Promise((a,o)=>{let r=document.createElement("script");r.src=e,r.async=!0,t&&(r.integrity=t,r.crossOrigin="anonymous"),r.onload=()=>a(),r.onerror=()=>o(new Error(`could not load ${e}`)),document.head.appendChild(r)})}async function qEt(e,{onError:t}={}){let a=e.filter(o=>!hl().some(r=>r.name===o.name));return await Promise.all(a.map(o=>{let{src:r,integrity:n}=kOa(o);return wOa(r,n).then(()=>{hl().some(i=>i.name===o.name)||t?.(o,new Error(`${r} loaded but did not register pack ${o.name}`))},i=>t?.(o,i))})),hl()}function HEt(e){for(let t of e){if(!t.css)continue;let a=`austere-pack-css-${t.name.replace(/[^a-z0-9]/gi,"-")}`;if(document.getElementById(a))continue;let o=document.createElement("style");o.id=a,o.textContent=t.css,document.head.appendChild(o)}}var SOa=/[A-Za-z_$]/;function LOa(e){let t=[],a=String(e??""),o=0,r=1,n=a.length;for(;o<n;){let i=a[o];if(i===`
1791
1791
  `){r++,o++;continue}if(i===" "||i===" "||i==="\r"){o++;continue}if(i==="#"||i==="/"&&a[o+1]==="/"){for(;o<n&&a[o]!==`
1792
1792
  `;)o++;continue}let s=o,l=r,u=0,d=null,p=!1;for(;o<n;){let x=a[o];if(d){p?p=!1:x==="\\"?p=!0:x===d&&(d=null),x===`
1793
1793
  `&&r++,o++;continue}if(x==='"'||x==="'"){d=x,o++;continue}if(x==="#"||x==="/"&&a[o+1]==="/"){for(;o<n&&a[o]!==`
1794
1794
  `;)o++;continue}if(x==="("||x==="["||x==="{")u++;else if(x===")"||x==="]"||x==="}")u=Math.max(0,u-1);else if(x===`
1795
- `){if(u===0&&!IOa(a,o+1))break;r++}o++}let f=a.slice(s,o).replace(/\s+$/,""),m=/^\s*([A-Za-z_$][\w$]*)\s*=/.exec(f);m&&SOa.test(m[1][0])&&t.push({id:m[1],text:f,line:l,endLine:r})}return t}function IOa(e,t){let a=t;for(;a<e.length&&(e[a]===" "||e[a]===" ");)a++;return e[a]==="?"||e[a]===":"}function th(e){let t=new Map;for(let a of LOa(e))t.set(a.id,a);return t}function VEt(e,t){let a=th(e),o=th(t),r=[];for(let[n,i]of o){let s=a.get(n);(!s||jEt(s.text)!==jEt(i.text))&&r.push(n)}return r}function I9(e,t){let a=new RegExp(`(^|[^\\w$])${COa(t)}(?![\\w$])`),o=[];for(let[r,n]of e){if(r===t)continue;let i=n.text.slice(n.text.indexOf("=")+1);a.test(MOa(i))&&o.push(r)}return o}function MOa(e){return e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/gs,'""')}function jEt(e){return e.replace(/\s+/g," ").trim()}function COa(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}var bv=oe(mt(),1),RX="0.19.0",_Oa='script[type="text/openui"], script[type="text/openui-lang"]';function AOa(){if(document.getElementById("austere-styles"))return;let e=document.createElement("style");if(e.id="austere-styles",e.textContent=[Sre,bre,kre,wre].join(`
1795
+ `){if(u===0&&!IOa(a,o+1))break;r++}o++}let f=a.slice(s,o).replace(/\s+$/,""),m=/^\s*([A-Za-z_$][\w$]*)\s*=/.exec(f);m&&SOa.test(m[1][0])&&t.push({id:m[1],text:f,line:l,endLine:r})}return t}function IOa(e,t){let a=t;for(;a<e.length&&(e[a]===" "||e[a]===" ");)a++;return e[a]==="?"||e[a]===":"}function th(e){let t=new Map;for(let a of LOa(e))t.set(a.id,a);return t}function VEt(e,t){let a=th(e),o=th(t),r=[];for(let[n,i]of o){let s=a.get(n);(!s||jEt(s.text)!==jEt(i.text))&&r.push(n)}return r}function I9(e,t){let a=new RegExp(`(^|[^\\w$])${COa(t)}(?![\\w$])`),o=[];for(let[r,n]of e){if(r===t)continue;let i=n.text.slice(n.text.indexOf("=")+1);a.test(MOa(i))&&o.push(r)}return o}function MOa(e){return e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/gs,'""')}function jEt(e){return e.replace(/\s+/g," ").trim()}function COa(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}var bv=oe(mt(),1),RX="0.20.0",_Oa='script[type="text/openui"], script[type="text/openui-lang"]';function AOa(){if(document.getElementById("austere-styles"))return;let e=document.createElement("style");if(e.id="austere-styles",e.textContent=[Sre,bre,kre,wre].join(`
1796
1796
  `),document.head.appendChild(e),!document.querySelector('meta[name="viewport"]')){let t=document.createElement("meta");t.name="viewport",t.content="width=device-width, initial-scale=1",document.head.appendChild(t)}document.documentElement.classList.add("austere"),document.documentElement.style.colorScheme="dark"}function WEt(e){if(!e||typeof e!="object")return;let t={},a=Object.entries(e);for(let[o,r]of a)if(!o.startsWith("$"))if(r&&typeof r=="object"&&!Array.isArray(r))if("value"in r&&Object.keys(r).length<=3)t[o]=r.value;else{let n=WEt(r);n&&Object.keys(n).length&&(t[o]=n)}else t[o]=r;return Object.keys(t).length?t:void 0}function NOa(e){return!!e&&typeof e=="object"&&"austere"in e&&e.austere===1&&"type"in e&&typeof e.type=="string"}function TOa(){let e=window.parent&&window.parent!==window,t=new Map,a=o=>{e&&window.parent.postMessage({austere:1,...o},"*")};return window.addEventListener("message",o=>{if(o.source!==window.parent)return;let r=o.data;NOa(r)&&t.get(r.type)?.forEach(n=>n(r))}),{framed:e,connected:!1,send:a,on(o,r){let n=r,i=t.get(o)??new Set;return t.set(o,i),i.add(n),()=>{i.delete(n)}}}}function ZEt(e,t){e.framed?e.send({type:"open-url",url:t}):window.open(t,"_blank","noopener")}function NX(e){let t=document.createElement("div");t.className="austere-toast",t.setAttribute("data-austere-ui",""),t.textContent=e,document.body.appendChild(t),setTimeout(()=>t.classList.add("out"),2600),setTimeout(()=>t.remove(),3100)}function ROa(e){let t=[e.message];return e.form&&t.push(`form: ${JSON.stringify(e.form)}`),e.context!==void 0&&t.push(`context: ${JSON.stringify(e.context)}`),t.join(`
1797
1797
  `)}var TX=null,XEt=new Set,vv=yv,UEt="";function EOa(e,t){XEt.add(e.name);let a=!e.bundled&&AX()?" (`austere-axi check <file>` says why)":"";Ec({source:"pack",component:e.name,message:`pack ${e.name}@${e.version}: ${t.message}${a}`})}function zOa(){let e=hl(),t=e.map(a=>`${a.name}@${a.version}`).join(",");if(t===UEt)return vv;UEt=t,HEt(e);try{vv=e.length?IX(e.flatMap(a=>a.components),{onSkip:(a,o)=>Ec({source:"pack",component:a.name,message:o})}):yv}catch(a){Ec({source:"pack",message:`packs could not be added (${a.message}); rendering without them`}),vv=yv}return window.__austere.library=vv,vv}async function YEt(e){TX||(TX=BEt());let t=FEt(e,TX).filter(a=>!XEt.has(a.name));return t.some(a=>!hl().some(o=>o.name===a.name))&&await qEt(t,{onError:EOa}),zOa()}function DOa({programRef:e,initialLibrary:t,bridge:a,annotator:o,initialState:r}){let[n,i]=(0,Di.useState)({program:e.current,library:t}),s=n.program,l=(0,Di.useRef)(null);(0,Di.useEffect)(()=>a.on("source",async({program:f})=>{if(typeof f!="string"||f===e.current)return;let m=VEt(e.current,f);e.current=f,o?.highlight([]);let x=await YEt(f);e.current===f&&(l.current=m,i({program:f,library:x}))}),[a]),(0,Di.useEffect)(()=>a.on("reveal",({id:f})=>{o?.reveal(f,th(e.current),I9)}),[a,o]),(0,Di.useEffect)(()=>{let f=l.current;if(!f)return;l.current=null;let m=setTimeout(()=>{let x=th(e.current),v=f.filter(w=>w!=="root");o?.flash(v,"changed",x,I9),a.send({type:"changes",ids:v})},120);return()=>clearTimeout(m)},[s,o,a]);let u=(0,Di.useCallback)(f=>{if(f.type==="open_url"){let v=f.params?.url;typeof v=="string"&&/^(https?:|mailto:)/i.test(v)&&ZEt(a,v);return}if(f.type!=="continue_conversation")return;let m={kind:"action",message:f.humanFriendlyMessage||"(button)"},x=WEt(f.formState);if(x&&(m.form=x),f.params?.context!==void 0&&(m.context=f.params.context),a.connected)a.send({type:"action",item:m}),NX("Queued for the agent \u2014 press Send when ready");else{let v=ROa(m);navigator.clipboard?.writeText(v).then(()=>NX("Copied \u2014 paste it to your agent"),()=>NX(v))}},[a]),d=(0,Di.useCallback)(f=>{a.send({type:"errors",errors:(f||[]).map(m=>({source:m.source,code:m.code,statementId:m.statementId,message:m.message,hint:m.hint}))})},[a]),p=(0,Di.useCallback)(f=>a.send({type:"state",state:f}),[a]);return(0,bv.jsx)(vre,{mode:"dark",children:(0,bv.jsx)("main",{className:"austere-page",children:(0,bv.jsx)(b2,{response:s,library:n.library,isStreaming:!1,onAction:u,onError:d,onStateUpdate:p,initialState:r})})})}function $Et(){AOa();let t=document.querySelector(_Oa)?.textContent??"",a=document.createElement("div");a.id="austere-root",document.body.appendChild(a);let o=TOa(),r={current:t},n=null,i=null,s=YEt(t),l=f=>i||(i=s.then(m=>(0,GEt.createRoot)(a).render((0,bv.jsx)(DOa,{programRef:r,initialLibrary:m,bridge:o,annotator:n,initialState:f}))));if(!o.framed){l(void 0);return}let u={program:null,map:new Map},p=zEt({post:f=>o.send(f),lookup:()=>(u.program!==r.current&&(u={program:r.current,map:th(r.current)}),[u.map,I9])});n=p,o.on("highlight",({ids:f,scroll:m})=>{p.highlight(Array.isArray(f)?f.filter(x=>typeof x=="string"):[],!!m)}),o.on("history-counts",({counts:f})=>{let m={};if(f&&typeof f=="object")for(let[x,v]of Object.entries(f).slice(0,2e3))typeof v=="number"&&Number.isInteger(v)&&v>0&&(m[x]=v);p.setHistory(m)}),o.on("presence",({marks:f})=>{let m=x=>{let v=x;return!!v&&typeof v.statement=="string"&&typeof v.name=="string"&&typeof v.colour=="string"&&/^#[0-9a-f]{6}$/i.test(v.colour)};p.focus(Array.isArray(f)?f.filter(m).slice(0,50):[])}),document.addEventListener("click",f=>{if(f.defaultPrevented||f.button!==0)return;let m=f.target instanceof Element?f.target.closest("a[href]"):null;if(!(m instanceof HTMLAnchorElement)||!/^(https?|mailto):/i.test(m.href)||m.protocol===location.protocol&&m.host===location.host)return;let x=(m.getAttribute("target")||"").toLowerCase();!x||x==="_self"||(f.preventDefault(),ZEt(o,m.href))}),JQ(f=>o.send({type:"runtime-error",error:f})),o.on("init",async f=>{if(o.connected=!0,p.setMode(f.mode),p.setQuickSwitch(f.quickSwitch===!0),await l(f.state||void 0),f.scrollY>0){let m=0,x=()=>{window.scrollTo(0,f.scrollY),Math.abs(window.scrollY-f.scrollY)>2&&++m<20&&setTimeout(x,50)};setTimeout(x,30)}o.send({type:"ready",title:document.title,version:RX})}),o.on("mode",f=>p.setMode(f.mode)),window.addEventListener("scroll",()=>o.send({type:"scroll",y:window.scrollY}),{passive:!0}),o.send({type:"hello",title:document.title,version:RX}),setTimeout(()=>l(void 0),600)}window.__austere={version:RX,library:yv,packs:hl};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",$Et,{once:!0}):setTimeout($Et,0);})();
1798
1798
  }
package/dist/catalog.json CHANGED
@@ -1 +1 @@
1
- {"format":1,"pack":"core","version":"0.19.0","groups":[{"name":"Layout","notes":["- A page is root = Stack([...sections], \"column\", \"l\"). Each section is a Card([CardHeader(title, subtitle), ...content]).","- Side by side: Stack([a, b], \"row\", \"m\", \"stretch\", \"start\", true). Cards in a row share the width.","- Tabs for alternative views, Accordion for detail the reader may skip, Steps for ordered procedures. Several blocks in one Card: label each with InlineHeader.","- Card children must match its list; anything else (Accordion, Tag, a Callout row) can sit in a Stack inside the Card, or directly in root's Stack."]},{"name":"Content","notes":["- MarkDownRenderer for prose, bullet lists and inline code; one statement per paragraph group so each is annotatable.","- Callout for the one thing the reader must not miss: a risk, a decision needed, a caveat.","- CodeBlock for a whole snippet. Image src may be a path relative to the artifact file.","- Architecture for systems: services, stores, queues, trust boundaries. Name every Node, Edge and Group. Over ~15 nodes, use lanes or split the diagram.","- lanes: for systems split by owner, repo or tier. Groups are the columns, left to right as listed; put every node in one, in reading order (plain groups for a heading without a frame). About 4 columns fit a laptop; wider ones scroll (check warns). Phones get the lanes stacked as bands. Pin row only to put boxes side by side or line them up.","- Diff for code changes: show the hunks that matter, not whole files. Hunk counts are recomputed, so only start lines matter."]},{"name":"Data","notes":["- Table is COLUMN-oriented: Table([Col(\"Option\", names), Col(\"Effort\", efforts), Col(\"Risk\", risks)]). Col data may mix strings and components, e.g. [\"n/a\", Tag(\"high\", null, \"sm\", \"danger\")]. Cells are plain text (no markdown) and wrap; Col type \"number\" for figures.","- EntityList for key/value facts; OverviewCardBlock + OverviewCardItem + MetricIndicatorInline for a KPI row.","- EditableTable when the reviewer should correct or fill in values; edits arrive with the next @ToAssistant from its Form.","- Icon names are lucide kebab-case (circle-check, triangle-alert, git-branch)."]},{"name":"Charts","notes":["- Charts take column arrays: BarChart(labels, [Series(\"p50\", [..]), Series(\"p99\", [..])], \"grouped\", \"Week\", \"ms\").","- PieChart(labels, values) with plain number arrays."]},{"name":"Forms","notes":["- Form(name, buttons, fields). Define each FormControl as its own statement. Never nest a Form in a Form.","- To ask the reviewer to decide: OptionCards or RadioGroup inside a Form whose button is Button(\"Send decision\", @ToAssistant(\"Decision: rollout strategy\"), \"primary\"). The values arrive with that message as form: {<formName>: {<fieldName>: value}}; no context needed. Reviewers can always annotate and message, so add a notes field only when it belongs with the decision.","- OptionCards(\"pick\", \"single\", [OptionCard(\"a\", \"Option A\", \"why\", Icon(\"zap\")), OptionCard(\"b\", \"Option B\")], {required: true}, \"a\") — the last argument pre-selects.","- rules: {required: true, minLength: 10, ...}; the renderer shows the messages."]},{"name":"Buttons","notes":["- @ToAssistant(message, context?) queues a message to the agent; @OpenUrl(url) opens a link. A Button with no action sends its label.","- Use buttons for follow-ups the reviewer can pick in one click: \"Go with option B\", \"Split this into two PRs\"."]}],"components":[{"name":"Card","group":"Layout","signature":"Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Tabs | Stack | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.","tier":"core","pack":"core","examples":[]},{"name":"CardHeader","group":"Layout","signature":"CardHeader(title?: string, subtitle?: string)","description":"Header with optional title and subtitle","tier":"core","pack":"core","examples":[]},{"name":"TextContent","group":"Content","signature":"TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\")","description":"Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".","tier":"core","pack":"core","examples":[]},{"name":"MarkDownRenderer","group":"Content","signature":"MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\")","description":"Renders markdown text with optional container variant","tier":"core","pack":"core","examples":[]},{"name":"Callout","group":"Content","signature":"Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>)","description":"Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.","tier":"core","pack":"core","examples":[]},{"name":"Image","group":"Content","signature":"Image(alt: string, src?: string)","description":"Image with alt text and optional URL","tier":"core","pack":"core","examples":[]},{"name":"CodeBlock","group":"Content","signature":"CodeBlock(language: string, codeString: string)","description":"Syntax-highlighted code block","tier":"core","pack":"core","examples":[]},{"name":"InlineHeader","group":"Layout","signature":"InlineHeader(heading: string, description?: string)","description":"Compact section heading with an optional one-line description, for use inside cards.","tier":"core","pack":"core","examples":[]},{"name":"Table","group":"Data","signature":"Table(columns: Col[])","description":"Data table — column-oriented. Each Col holds its own data array.","tier":"core","pack":"core","examples":[]},{"name":"Col","group":"Data","signature":"Col(label: string, data: any, type?: \"string\" | \"number\" | \"action\")","description":"Column definition — holds label + data array","tier":"core","pack":"core","examples":[]},{"name":"EditableTable","group":"Data","signature":"EditableTable(name?: string, columns?: {type: \"text\" | \"number\" | \"date-single\" | \"select\" | \"url\", key?: string, header?: string, width?: number, options?: {value: string, label: string}[]}[], data?: {id: string, values: (string | number)[]}[])","description":"Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field","tier":"extended","pack":"core","examples":[]},{"name":"BarChart","group":"Charts","signature":"BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string, height?: number)","description":"Vertical bars; use for comparing values across categories with one or more series","tier":"core","pack":"core","examples":[]},{"name":"LineChart","group":"Charts","signature":"LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Lines over categories; use for trends and continuous data over time","tier":"core","pack":"core","examples":[]},{"name":"AreaChart","group":"Charts","signature":"AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Filled area under lines; use for cumulative totals or volume trends over time","tier":"extended","pack":"core","examples":[]},{"name":"HorizontalBarChart","group":"Charts","signature":"HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string)","description":"Horizontal bars; prefer when category labels are long or for ranked lists","tier":"extended","pack":"core","examples":[]},{"name":"Series","group":"Charts","signature":"Series(category: string, values: number[])","description":"One data series","tier":"core","pack":"core","examples":[]},{"name":"PieChart","group":"Charts","signature":"PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\", appearance?: \"circular\" | \"semiCircular\")","description":"Circular slices; use plucked arrays: PieChart(data.categories, data.values)","tier":"core","pack":"core","examples":[]},{"name":"ScatterChart","group":"Charts","signature":"ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string)","description":"X/Y scatter plot; use for correlations, distributions, and clustering","tier":"extended","pack":"core","examples":[]},{"name":"ScatterSeries","group":"Charts","signature":"ScatterSeries(name: string, points: Point[])","description":"Named dataset","tier":"extended","pack":"core","examples":[]},{"name":"Point","group":"Charts","signature":"Point(x: number, y: number, z?: number)","description":"Data point with numeric coordinates","tier":"extended","pack":"core","examples":[]},{"name":"Form","group":"Forms","signature":"Form(name: string, buttons: Buttons, fields?: FormControl[])","description":"Form container with fields and explicit action buttons","tier":"core","pack":"core","examples":[]},{"name":"FormControl","group":"Forms","signature":"FormControl(label: string, input: Input | TextArea | Select | Slider | CheckBoxGroup | RadioGroup | Chips | OptionCards, hint?: string)","description":"Field with label, input component, and optional hint text","tier":"core","pack":"core","examples":[]},{"name":"Label","group":"Forms","signature":"Label(text: string)","description":"Text label","tier":"extended","pack":"core","examples":[]},{"name":"Input","group":"Forms","signature":"Input(name: string, placeholder?: string, type?: \"text\" | \"email\" | \"password\" | \"number\" | \"url\", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"TextArea","group":"Forms","signature":"TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"Select","group":"Forms","signature":"Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>, size?: \"small\" | \"medium\" | \"large\")","description":"","tier":"core","pack":"core","examples":[]},{"name":"SelectItem","group":"Forms","signature":"SelectItem(value: string, label: string)","description":"Option for Select","tier":"core","pack":"core","examples":[]},{"name":"Slider","group":"Forms","signature":"Slider(name: string, variant: \"continuous\" | \"discrete\", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>)","description":"Numeric slider input; supports continuous and discrete (stepped) variants","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxGroup","group":"Forms","signature":"CheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxItem","group":"Forms","signature":"CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"RadioGroup","group":"Forms","signature":"RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"RadioItem","group":"Forms","signature":"RadioItem(label: string, description: string, value: string)","description":"","tier":"core","pack":"core","examples":[]},{"name":"SwitchGroup","group":"Forms","signature":"SwitchGroup(name: string, items: SwitchItem[], variant?: \"clear\" | \"card\" | \"sunk\", value?: $binding<Record<string, boolean>>)","description":"Group of switch toggles","tier":"extended","pack":"core","examples":[]},{"name":"SwitchItem","group":"Forms","signature":"SwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean)","description":"Individual switch toggle","tier":"extended","pack":"core","examples":[]},{"name":"ChipItem","group":"Forms","signature":"ChipItem(value: string, label: string, icon?: Icon, disabled?: boolean)","description":"A single selectable chip inside a Chips group, with a value, label and optional icon.","tier":"extended","pack":"core","examples":[]},{"name":"Chips","group":"Forms","signature":"Chips(name: string, type?: \"single\" | \"multiple\", items?: ChipItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.","tier":"extended","pack":"core","examples":[]},{"name":"OptionCard","group":"Forms","signature":"OptionCard(value: string, title: string, subtitle?: string, topContent?: Icon | Image, disabled?: boolean)","description":"A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.","tier":"core","pack":"core","examples":[]},{"name":"OptionCards","group":"Forms","signature":"OptionCards(name: string, type?: \"single\" | \"multiple\", items?: OptionCard[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.","tier":"core","pack":"core","examples":[]},{"name":"Button","group":"Buttons","signature":"Button(label: string, action?: ActionExpression, variant?: \"primary\" | \"secondary\" | \"tertiary\", type?: \"normal\" | \"destructive\", size?: \"extra-small\" | \"small\" | \"medium\" | \"large\")","description":"Clickable button","tier":"core","pack":"core","examples":[]},{"name":"Buttons","group":"Buttons","signature":"Buttons(buttons: Button[], direction?: \"row\" | \"column\")","description":"Group of Button components. direction: \"row\" (default) | \"column\".","tier":"core","pack":"core","examples":[]},{"name":"Stack","group":"Layout","signature":"Stack(children: any[], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".","tier":"core","pack":"core","examples":[]},{"name":"Tabs","group":"Layout","signature":"Tabs(items: TabItem[])","description":"Tabbed container","tier":"core","pack":"core","examples":[]},{"name":"TabItem","group":"Layout","signature":"TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is tab label, content is array of components","tier":"core","pack":"core","examples":[]},{"name":"Accordion","group":"Layout","signature":"Accordion(items: AccordionItem[])","description":"Collapsible sections","tier":"core","pack":"core","examples":[]},{"name":"AccordionItem","group":"Layout","signature":"AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is section title","tier":"core","pack":"core","examples":[]},{"name":"Steps","group":"Layout","signature":"Steps(items: StepsItem[])","description":"Step-by-step guide","tier":"core","pack":"core","examples":[]},{"name":"StepsItem","group":"Layout","signature":"StepsItem(title: string, details: string)","description":"title and details text for one step","tier":"core","pack":"core","examples":[]},{"name":"Separator","group":"Layout","signature":"Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean)","description":"Visual divider between content sections","tier":"core","pack":"core","examples":[]},{"name":"TagBlock","group":"Data","signature":"TagBlock(tags: string[], size?: \"sm\" | \"md\" | \"lg\")","description":"tags is an array of strings; optional size sm | md | lg","tier":"extended","pack":"core","examples":[]},{"name":"Tag","group":"Data","signature":"Tag(text: string, icon?: Icon, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\")","description":"Styled tag/badge with optional Icon and variant","tier":"core","pack":"core","examples":[]},{"name":"Icon","group":"Data","signature":"Icon(name: string, category?: string)","description":"A lucide icon by kebab-case name (e.g. 'circle-check'). Optional category picks a topical fallback when the name doesn't resolve.","tier":"core","pack":"core","examples":[]},{"name":"EntityList","group":"Data","signature":"EntityList(rows?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}[], size?: \"small\" | \"default\", header?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}, footer?: {left: string, right: string, rightVariant?: \"text\" | \"number\"})","description":"Two-column key/value rows (left label, right value). size 'default' supports optional header and footer rows; rightVariant 'number' uses tabular numbers.","tier":"core","pack":"core","examples":[]},{"name":"Text","group":"Data","signature":"Text(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Plain text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"core","pack":"core","examples":[]},{"name":"BoldText","group":"Data","signature":"BoldText(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Emphasized (bold) text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"extended","pack":"core","examples":[]},{"name":"IconText","group":"Data","signature":"IconText(icon: Icon, iconVariant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"inverted\" | \"filled\" | \"soft\", iconSize?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"sm\" | \"md\" | \"lg\", title: string, subtitle?: string, bold?: boolean, layout?: \"horizontal\" | \"vertical\")","description":"An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.","tier":"extended","pack":"core","examples":[]},{"name":"MetricIndicatorInline","group":"Data","signature":"MetricIndicatorInline(value: string, subtext?: string, trend?: {direction: \"up\" | \"down\", value: number})","description":"Headline metric value with an optional +/- percentage trend and subtext, all on one line.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardItem","group":"Data","signature":"OverviewCardItem(id?: string, top: IconText | Text, bottom?: MetricIndicatorInline)","description":"One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardBlock","group":"Data","signature":"OverviewCardBlock(items: OverviewCardItem[], layout?: \"grid\" | \"carousel\", responsive?: boolean, action?: ActionExpression, gap?: number | string)","description":"A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.","tier":"core","pack":"core","examples":[]},{"name":"Architecture","group":"Content","signature":"Architecture(nodes: Node[], edges: Edge[], groups?: Group[], direction?: \"auto\" | \"right\" | \"down\" | \"lanes\")","description":"System diagram laid out automatically: write no coordinates. Every Node, Edge and Group is its own statement and click target. direction auto (default) runs right when that fits the page legibly, else down; lanes makes each top-level Group a column.","tier":"core","pack":"core","examples":["platformMap = Architecture([browser, edge, api, sessions, cache], [toEdge, toApi, readSessions, readCache], [vpc])\nbrowser = Node(\"Browser\", \"external\")\nedge = Node(\"Edge worker\", \"cloud\", \"Cloudflare\")\napi = Node(\"API\", \"backend\", \"Node :8080\")\nsessions = Node(\"Sessions\", \"database\", \"Postgres\", \"new\")\ncache = Node(\"Redis\", \"database\", \"read-through\")\ntoEdge = Edge(browser, edge, \"HTTPS\", \"emphasis\")\ntoApi = Edge(edge, api)\nreadSessions = Edge(api, sessions, \"SQL\")\nreadCache = Edge(api, cache, \"cache\", \"dashed\")\nvpc = Group(\"Platform VPC\", [api, sessions, cache])","ownership = Architecture([web, ordersApi, ledger, ordersDb, billingJob], [placeOrder, writeOrder, readOrders, postLedger], [clients, ordersRepo, billingRepo], \"lanes\")\nweb = Node(\"Web app\", \"frontend\")\nordersApi = Node(\"Orders API\", \"backend\", \"Node :8080\")\nordersDb = Node(\"orders table\", \"database\", \"Postgres\", null, \"success\")\nbillingJob = Node(\"Nightly billing\", \"backend\", \"cron 02:00\")\nledger = Node(\"Ledger\", \"database\", \"append-only\", null, \"info\")\nplaceOrder = Edge(web, ordersApi, \"POST /orders\")\nwriteOrder = Edge(ordersApi, ordersDb, \"insert\")\nreadOrders = Edge(billingJob, ordersDb, \"read unbilled\", null, \"danger\")\npostLedger = Edge(billingJob, ledger, \"post\")\nclients = Group(\"CLIENTS\", [web], \"plain\")\nordersRepo = Group(\"orders-service\", [ordersApi, ordersDb])\nbillingRepo = Group(\"billing\", [billingJob, ledger])"]},{"name":"Node","group":"Content","signature":"Node(label: string, kind?: \"frontend\" | \"backend\" | \"database\" | \"messagebus\" | \"cloud\" | \"security\" | \"external\", detail?: string, tag?: string, tone?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"strong\", row?: number)","description":"A box in an Architecture. kind sets icon and color (default backend); detail is monospace, up to 2 lines (\\n breaks); tag is a small chip such as \"new\"; tone tints it (danger = risk, strong = where it ends); row pins it to a row (1, 2, ...) in lanes.","tier":"core","pack":"core","examples":[]},{"name":"Edge","group":"Content","signature":"Edge(from: Node, to: Node, label?: string, style?: \"solid\" | \"dashed\" | \"emphasis\" | \"security\", tone?: \"info\" | \"success\" | \"warning\" | \"danger\")","description":"An arrow between two Node statements (pass their names, not strings). style: dashed for async, emphasis for the main path, security for auth or trust flows. tone colors it, e.g. danger for a risky write, success for a read.","tier":"core","pack":"core","examples":[]},{"name":"Group","group":"Content","signature":"Group(label: string, members: Node[], kind?: \"region\" | \"security\" | \"plain\")","description":"A boundary around Node statements (a VPC, a cluster, a trust zone); members still sit where their edges put them. A group whose members are a subset of another's is drawn inside it; kind security draws it red, plain draws only its name.","tier":"core","pack":"core","examples":[]},{"name":"Diff","group":"Content","signature":"Diff(patch: string, title?: string)","description":"Unified diff (git diff output, one or more files) with line numbers. patch is a raw multi-line string. Clicked lines reach the agent as file:+line.","tier":"core","pack":"core","examples":["retryPatch = Diff(\"diff --git a/src/retry.ts b/src/retry.ts\n--- a/src/retry.ts\n+++ b/src/retry.ts\n@@ -10,2 +10,3 @@\n- for (let i = 0; i < 3; i++) {\n+ for (let i = 0; i < MAX_ATTEMPTS; i++) {\n+ if (i > 0) await sleep(backoff(i));\")"]},{"name":"FileTree","group":"Data","signature":"FileTree(entries: string[])","description":"File tree, one path per entry, optionally prefixed with a git status code (A new, M modified, D deleted, R old -> new) and suffixed with \" # note\". Folders are inferred. Clicked files and folders reach the agent by path.","tier":"core","pack":"core","examples":["changedFiles = FileTree([\"M src/session/store.ts # read-through to Postgres\", \"A src/session/pg-store.ts\", \"A migrations/0042_sessions.sql # table + expiry index\", \"R src/session/redis.ts -> src/session/redis-cache.ts\", \"D src/session/legacy.ts\", \"M src/config.ts # SESSIONS_PG flag\"])"]},{"name":"Progress","group":"Data","signature":"Progress(value: number, label?: string, max?: number)","description":"Progress bar. value counts toward max (default 100); label names what is progressing. Shows a percentage.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["migration = Progress(64, \"Rows migrated\")"]},{"name":"Avatar","group":"Data","signature":"Avatar(name: string, src?: string, size?: \"md\" | \"lg\")","description":"Round avatar for a person. Shows the initials of name; src is an optional https image URL.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["owner = Avatar(\"Ada Lovelace\")"]},{"name":"AvatarGroup","group":"Data","signature":"AvatarGroup(avatars: Avatar[], max?: number)","description":"Overlapping Avatars, for reviewers or owners. max (default 4) shows the rest as +N.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["team = AvatarGroup([ada, grace, linus], 2)\nada = Avatar(\"Ada Lovelace\")\ngrace = Avatar(\"Grace Hopper\")\nlinus = Avatar(\"Linus Torvalds\")"]},{"name":"Tooltip","group":"Content","signature":"Tooltip(text: string, tip: string)","description":"Inline text with a short hint on hover or focus (a term and its definition). Keep tip to one line.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["term = Tooltip(\"idempotent\", \"Safe to run twice with the same result.\")"]},{"name":"HoverCard","group":"Content","signature":"HoverCard(text: string, title: string, body?: string)","description":"Inline text that shows a small card (title and a line or two of body) on hover or focus, e.g. a person or a service.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["svc = HoverCard(\"billing-api\", \"billing-api\", \"Owns invoices and refunds. On call: payments team.\")"]},{"name":"Breadcrumb","group":"Content","signature":"Breadcrumb(items: BreadcrumbItem[])","description":"Path trail such as Repo / Package / File, from BreadcrumbItems. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["trail = Breadcrumb([repo, pkg, file])\nrepo = BreadcrumbItem(\"austere-axi\")\npkg = BreadcrumbItem(\"packs\")\nfile = BreadcrumbItem(\"shadcn\")"]},{"name":"BreadcrumbItem","group":"Content","signature":"BreadcrumbItem(label: string, href?: string)","description":"One step of a Breadcrumb. href is optional; the last item is the current page.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]},{"name":"Kbd","group":"Content","signature":"Kbd(keys: string)","description":"Keyboard shortcut. keys joins keys with \"+\", e.g. \"Ctrl+K\"; each key is drawn as a key cap.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["shortcut = Kbd(\"Ctrl+Shift+P\")"]},{"name":"Skeleton","group":"Content","signature":"Skeleton(lines?: number, shape?: \"lines\" | \"avatar\")","description":"Grey placeholder block for content not yet written or loaded (default 3 lines). shape avatar adds a round head.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["pending = Skeleton(3, \"avatar\")"]},{"name":"Calendar","group":"Data","signature":"Calendar(month: string, highlights?: string[])","description":"Read-only month grid (not a date picker). month is \"YYYY-MM\"; highlights lists \"YYYY-MM-DD\" or \"YYYY-MM-DD label\" entries to mark, e.g. a freeze or a release. Marked days are click targets.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["window = Calendar(\"2026-11\", [\"2026-11-04 Code freeze\", \"2026-11-12 Release\", \"2026-11-13\"])"]},{"name":"Timeline","group":"Content","signature":"Timeline(items: TimelineItem[])","description":"Vertical history or schedule of TimelineItems, oldest first. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["history = Timeline([found, fixed, rollout])\nfound = TimelineItem(\"Bug found\", \"Oct 28\", \"Retries double-charge on timeout.\")\nfixed = TimelineItem(\"Fix merged\", \"Oct 29\", \"Idempotency key added.\", \"current\")\nrollout = TimelineItem(\"Rollout\", \"Nov 3\", \"\", \"upcoming\")"]},{"name":"TimelineItem","group":"Content","signature":"TimelineItem(title: string, date?: string, detail?: string, state?: \"done\" | \"current\" | \"upcoming\")","description":"One event in a Timeline. state: done (default), current or upcoming.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]}]}
1
+ {"format":1,"pack":"core","version":"0.20.0","groups":[{"name":"Layout","notes":["- A page is root = Stack([...sections], \"column\", \"l\"). Each section is a Card([CardHeader(title, subtitle), ...content]).","- Side by side: Stack([a, b], \"row\", \"m\", \"stretch\", \"start\", true). Cards in a row share the width.","- Tabs for alternative views, Accordion for detail the reader may skip, Steps for ordered procedures. Several blocks in one Card: label each with InlineHeader.","- Card children must match its list; anything else (Accordion, Tag, a Callout row) can sit in a Stack inside the Card, or directly in root's Stack."]},{"name":"Content","notes":["- MarkDownRenderer for prose, bullet lists and inline code; one statement per paragraph group so each is annotatable.","- Callout for the one thing the reader must not miss: a risk, a decision needed, a caveat.","- CodeBlock for a whole snippet. Image src may be a path relative to the artifact file.","- Architecture for systems: services, stores, queues, trust boundaries. Name every Node, Edge and Group. Over ~15 nodes, use lanes or split the diagram.","- lanes: for systems split by owner, repo or tier. Groups are the columns, left to right as listed; put every node in one, in reading order (plain groups for a heading without a frame). About 4 columns fit a laptop; wider ones scroll (check warns). Phones get the lanes stacked as bands. Pin row only to put boxes side by side or line them up.","- Diff for code changes: show the hunks that matter, not whole files. Hunk counts are recomputed, so only start lines matter."]},{"name":"Data","notes":["- Table is COLUMN-oriented: Table([Col(\"Option\", names), Col(\"Effort\", efforts), Col(\"Risk\", risks)]). Col data may mix strings and components, e.g. [\"n/a\", Tag(\"high\", null, \"sm\", \"danger\")]. Cells are plain text (no markdown) and wrap; Col type \"number\" for figures.","- EntityList for key/value facts; OverviewCardBlock + OverviewCardItem + MetricIndicatorInline for a KPI row.","- EditableTable when the reviewer should correct or fill in values; edits arrive with the next @ToAssistant from its Form.","- Icon names are lucide kebab-case (circle-check, triangle-alert, git-branch)."]},{"name":"Charts","notes":["- Charts take column arrays: BarChart(labels, [Series(\"p50\", [..]), Series(\"p99\", [..])], \"grouped\", \"Week\", \"ms\").","- PieChart(labels, values) with plain number arrays."]},{"name":"Forms","notes":["- Form(name, buttons, fields). Define each FormControl as its own statement. Never nest a Form in a Form.","- To ask the reviewer to decide: OptionCards or RadioGroup inside a Form whose button is Button(\"Send decision\", @ToAssistant(\"Decision: rollout strategy\"), \"primary\"). The values arrive with that message as form: {<formName>: {<fieldName>: value}}; no context needed. Reviewers can always annotate and message, so add a notes field only when it belongs with the decision.","- OptionCards(\"pick\", \"single\", [OptionCard(\"a\", \"Option A\", \"why\", Icon(\"zap\")), OptionCard(\"b\", \"Option B\")], {required: true}, \"a\") — the last argument pre-selects.","- rules: {required: true, minLength: 10, ...}; the renderer shows the messages."]},{"name":"Buttons","notes":["- @ToAssistant(message, context?) queues a message to the agent; @OpenUrl(url) opens a link. A Button with no action sends its label.","- Use buttons for follow-ups the reviewer can pick in one click: \"Go with option B\", \"Split this into two PRs\"."]}],"components":[{"name":"Card","group":"Layout","signature":"Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Tabs | Stack | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.","tier":"core","pack":"core","examples":[]},{"name":"CardHeader","group":"Layout","signature":"CardHeader(title?: string, subtitle?: string)","description":"Header with optional title and subtitle","tier":"core","pack":"core","examples":[]},{"name":"TextContent","group":"Content","signature":"TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\")","description":"Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".","tier":"core","pack":"core","examples":[]},{"name":"MarkDownRenderer","group":"Content","signature":"MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\")","description":"Renders markdown text with optional container variant","tier":"core","pack":"core","examples":[]},{"name":"Callout","group":"Content","signature":"Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>)","description":"Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.","tier":"core","pack":"core","examples":[]},{"name":"Image","group":"Content","signature":"Image(alt: string, src?: string)","description":"Image with alt text and optional URL","tier":"core","pack":"core","examples":[]},{"name":"CodeBlock","group":"Content","signature":"CodeBlock(language: string, codeString: string)","description":"Syntax-highlighted code block","tier":"core","pack":"core","examples":[]},{"name":"InlineHeader","group":"Layout","signature":"InlineHeader(heading: string, description?: string)","description":"Compact section heading with an optional one-line description, for use inside cards.","tier":"core","pack":"core","examples":[]},{"name":"Table","group":"Data","signature":"Table(columns: Col[])","description":"Data table — column-oriented. Each Col holds its own data array.","tier":"core","pack":"core","examples":[]},{"name":"Col","group":"Data","signature":"Col(label: string, data: any, type?: \"string\" | \"number\" | \"action\")","description":"Column definition — holds label + data array","tier":"core","pack":"core","examples":[]},{"name":"EditableTable","group":"Data","signature":"EditableTable(name?: string, columns?: {type: \"text\" | \"number\" | \"date-single\" | \"select\" | \"url\", key?: string, header?: string, width?: number, options?: {value: string, label: string}[]}[], data?: {id: string, values: (string | number)[]}[])","description":"Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field","tier":"extended","pack":"core","examples":[]},{"name":"BarChart","group":"Charts","signature":"BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string, height?: number)","description":"Vertical bars; use for comparing values across categories with one or more series","tier":"core","pack":"core","examples":[]},{"name":"LineChart","group":"Charts","signature":"LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Lines over categories; use for trends and continuous data over time","tier":"core","pack":"core","examples":[]},{"name":"AreaChart","group":"Charts","signature":"AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Filled area under lines; use for cumulative totals or volume trends over time","tier":"extended","pack":"core","examples":[]},{"name":"HorizontalBarChart","group":"Charts","signature":"HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string)","description":"Horizontal bars; prefer when category labels are long or for ranked lists","tier":"extended","pack":"core","examples":[]},{"name":"Series","group":"Charts","signature":"Series(category: string, values: number[])","description":"One data series","tier":"core","pack":"core","examples":[]},{"name":"PieChart","group":"Charts","signature":"PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\", appearance?: \"circular\" | \"semiCircular\")","description":"Circular slices; use plucked arrays: PieChart(data.categories, data.values)","tier":"core","pack":"core","examples":[]},{"name":"ScatterChart","group":"Charts","signature":"ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string)","description":"X/Y scatter plot; use for correlations, distributions, and clustering","tier":"extended","pack":"core","examples":[]},{"name":"ScatterSeries","group":"Charts","signature":"ScatterSeries(name: string, points: Point[])","description":"Named dataset","tier":"extended","pack":"core","examples":[]},{"name":"Point","group":"Charts","signature":"Point(x: number, y: number, z?: number)","description":"Data point with numeric coordinates","tier":"extended","pack":"core","examples":[]},{"name":"Form","group":"Forms","signature":"Form(name: string, buttons: Buttons, fields?: FormControl[])","description":"Form container with fields and explicit action buttons","tier":"core","pack":"core","examples":[]},{"name":"FormControl","group":"Forms","signature":"FormControl(label: string, input: Input | TextArea | Select | Slider | CheckBoxGroup | RadioGroup | Chips | OptionCards, hint?: string)","description":"Field with label, input component, and optional hint text","tier":"core","pack":"core","examples":[]},{"name":"Label","group":"Forms","signature":"Label(text: string)","description":"Text label","tier":"extended","pack":"core","examples":[]},{"name":"Input","group":"Forms","signature":"Input(name: string, placeholder?: string, type?: \"text\" | \"email\" | \"password\" | \"number\" | \"url\", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"TextArea","group":"Forms","signature":"TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"Select","group":"Forms","signature":"Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>, size?: \"small\" | \"medium\" | \"large\")","description":"","tier":"core","pack":"core","examples":[]},{"name":"SelectItem","group":"Forms","signature":"SelectItem(value: string, label: string)","description":"Option for Select","tier":"core","pack":"core","examples":[]},{"name":"Slider","group":"Forms","signature":"Slider(name: string, variant: \"continuous\" | \"discrete\", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>)","description":"Numeric slider input; supports continuous and discrete (stepped) variants","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxGroup","group":"Forms","signature":"CheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxItem","group":"Forms","signature":"CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"RadioGroup","group":"Forms","signature":"RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"RadioItem","group":"Forms","signature":"RadioItem(label: string, description: string, value: string)","description":"","tier":"core","pack":"core","examples":[]},{"name":"SwitchGroup","group":"Forms","signature":"SwitchGroup(name: string, items: SwitchItem[], variant?: \"clear\" | \"card\" | \"sunk\", value?: $binding<Record<string, boolean>>)","description":"Group of switch toggles","tier":"extended","pack":"core","examples":[]},{"name":"SwitchItem","group":"Forms","signature":"SwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean)","description":"Individual switch toggle","tier":"extended","pack":"core","examples":[]},{"name":"ChipItem","group":"Forms","signature":"ChipItem(value: string, label: string, icon?: Icon, disabled?: boolean)","description":"A single selectable chip inside a Chips group, with a value, label and optional icon.","tier":"extended","pack":"core","examples":[]},{"name":"Chips","group":"Forms","signature":"Chips(name: string, type?: \"single\" | \"multiple\", items?: ChipItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.","tier":"extended","pack":"core","examples":[]},{"name":"OptionCard","group":"Forms","signature":"OptionCard(value: string, title: string, subtitle?: string, topContent?: Icon | Image, disabled?: boolean)","description":"A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.","tier":"core","pack":"core","examples":[]},{"name":"OptionCards","group":"Forms","signature":"OptionCards(name: string, type?: \"single\" | \"multiple\", items?: OptionCard[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.","tier":"core","pack":"core","examples":[]},{"name":"Button","group":"Buttons","signature":"Button(label: string, action?: ActionExpression, variant?: \"primary\" | \"secondary\" | \"tertiary\", type?: \"normal\" | \"destructive\", size?: \"extra-small\" | \"small\" | \"medium\" | \"large\")","description":"Clickable button","tier":"core","pack":"core","examples":[]},{"name":"Buttons","group":"Buttons","signature":"Buttons(buttons: Button[], direction?: \"row\" | \"column\")","description":"Group of Button components. direction: \"row\" (default) | \"column\".","tier":"core","pack":"core","examples":[]},{"name":"Stack","group":"Layout","signature":"Stack(children: any[], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".","tier":"core","pack":"core","examples":[]},{"name":"Tabs","group":"Layout","signature":"Tabs(items: TabItem[])","description":"Tabbed container","tier":"core","pack":"core","examples":[]},{"name":"TabItem","group":"Layout","signature":"TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is tab label, content is array of components","tier":"core","pack":"core","examples":[]},{"name":"Accordion","group":"Layout","signature":"Accordion(items: AccordionItem[])","description":"Collapsible sections","tier":"core","pack":"core","examples":[]},{"name":"AccordionItem","group":"Layout","signature":"AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is section title","tier":"core","pack":"core","examples":[]},{"name":"Steps","group":"Layout","signature":"Steps(items: StepsItem[])","description":"Step-by-step guide","tier":"core","pack":"core","examples":[]},{"name":"StepsItem","group":"Layout","signature":"StepsItem(title: string, details: string)","description":"title and details text for one step","tier":"core","pack":"core","examples":[]},{"name":"Separator","group":"Layout","signature":"Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean)","description":"Visual divider between content sections","tier":"core","pack":"core","examples":[]},{"name":"TagBlock","group":"Data","signature":"TagBlock(tags: string[], size?: \"sm\" | \"md\" | \"lg\")","description":"tags is an array of strings; optional size sm | md | lg","tier":"extended","pack":"core","examples":[]},{"name":"Tag","group":"Data","signature":"Tag(text: string, icon?: Icon, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\")","description":"Styled tag/badge with optional Icon and variant","tier":"core","pack":"core","examples":[]},{"name":"Icon","group":"Data","signature":"Icon(name: string, category?: string)","description":"A lucide icon by kebab-case name (e.g. 'circle-check'). Optional category picks a topical fallback when the name doesn't resolve.","tier":"core","pack":"core","examples":[]},{"name":"EntityList","group":"Data","signature":"EntityList(rows?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}[], size?: \"small\" | \"default\", header?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}, footer?: {left: string, right: string, rightVariant?: \"text\" | \"number\"})","description":"Two-column key/value rows (left label, right value). size 'default' supports optional header and footer rows; rightVariant 'number' uses tabular numbers.","tier":"core","pack":"core","examples":[]},{"name":"Text","group":"Data","signature":"Text(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Plain text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"core","pack":"core","examples":[]},{"name":"BoldText","group":"Data","signature":"BoldText(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Emphasized (bold) text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"extended","pack":"core","examples":[]},{"name":"IconText","group":"Data","signature":"IconText(icon: Icon, iconVariant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"inverted\" | \"filled\" | \"soft\", iconSize?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"sm\" | \"md\" | \"lg\", title: string, subtitle?: string, bold?: boolean, layout?: \"horizontal\" | \"vertical\")","description":"An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.","tier":"extended","pack":"core","examples":[]},{"name":"MetricIndicatorInline","group":"Data","signature":"MetricIndicatorInline(value: string, subtext?: string, trend?: {direction: \"up\" | \"down\", value: number})","description":"Headline metric value with an optional +/- percentage trend and subtext, all on one line.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardItem","group":"Data","signature":"OverviewCardItem(id?: string, top: IconText | Text, bottom?: MetricIndicatorInline)","description":"One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardBlock","group":"Data","signature":"OverviewCardBlock(items: OverviewCardItem[], layout?: \"grid\" | \"carousel\", responsive?: boolean, action?: ActionExpression, gap?: number | string)","description":"A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.","tier":"core","pack":"core","examples":[]},{"name":"Architecture","group":"Content","signature":"Architecture(nodes: Node[], edges: Edge[], groups?: Group[], direction?: \"auto\" | \"right\" | \"down\" | \"lanes\")","description":"System diagram laid out automatically: write no coordinates. Every Node, Edge and Group is its own statement and click target. direction auto (default) runs right when that fits the page legibly, else down; lanes makes each top-level Group a column.","tier":"core","pack":"core","examples":["platformMap = Architecture([browser, edge, api, sessions, cache], [toEdge, toApi, readSessions, readCache], [vpc])\nbrowser = Node(\"Browser\", \"external\")\nedge = Node(\"Edge worker\", \"cloud\", \"Cloudflare\")\napi = Node(\"API\", \"backend\", \"Node :8080\")\nsessions = Node(\"Sessions\", \"database\", \"Postgres\", \"new\")\ncache = Node(\"Redis\", \"database\", \"read-through\")\ntoEdge = Edge(browser, edge, \"HTTPS\", \"emphasis\")\ntoApi = Edge(edge, api)\nreadSessions = Edge(api, sessions, \"SQL\")\nreadCache = Edge(api, cache, \"cache\", \"dashed\")\nvpc = Group(\"Platform VPC\", [api, sessions, cache])","ownership = Architecture([web, ordersApi, ledger, ordersDb, billingJob], [placeOrder, writeOrder, readOrders, postLedger], [clients, ordersRepo, billingRepo], \"lanes\")\nweb = Node(\"Web app\", \"frontend\")\nordersApi = Node(\"Orders API\", \"backend\", \"Node :8080\")\nordersDb = Node(\"orders table\", \"database\", \"Postgres\", null, \"success\")\nbillingJob = Node(\"Nightly billing\", \"backend\", \"cron 02:00\")\nledger = Node(\"Ledger\", \"database\", \"append-only\", null, \"info\")\nplaceOrder = Edge(web, ordersApi, \"POST /orders\")\nwriteOrder = Edge(ordersApi, ordersDb, \"insert\")\nreadOrders = Edge(billingJob, ordersDb, \"read unbilled\", null, \"danger\")\npostLedger = Edge(billingJob, ledger, \"post\")\nclients = Group(\"CLIENTS\", [web], \"plain\")\nordersRepo = Group(\"orders-service\", [ordersApi, ordersDb])\nbillingRepo = Group(\"billing\", [billingJob, ledger])"]},{"name":"Node","group":"Content","signature":"Node(label: string, kind?: \"frontend\" | \"backend\" | \"database\" | \"messagebus\" | \"cloud\" | \"security\" | \"external\", detail?: string, tag?: string, tone?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"strong\", row?: number)","description":"A box in an Architecture. kind sets icon and color (default backend); detail is monospace, up to 2 lines (\\n breaks); tag is a small chip such as \"new\"; tone tints it (danger = risk, strong = where it ends); row pins it to a row (1, 2, ...) in lanes.","tier":"core","pack":"core","examples":[]},{"name":"Edge","group":"Content","signature":"Edge(from: Node, to: Node, label?: string, style?: \"solid\" | \"dashed\" | \"emphasis\" | \"security\", tone?: \"info\" | \"success\" | \"warning\" | \"danger\")","description":"An arrow between two Node statements (pass their names, not strings). style: dashed for async, emphasis for the main path, security for auth or trust flows. tone colors it, e.g. danger for a risky write, success for a read.","tier":"core","pack":"core","examples":[]},{"name":"Group","group":"Content","signature":"Group(label: string, members: Node[], kind?: \"region\" | \"security\" | \"plain\")","description":"A boundary around Node statements (a VPC, a cluster, a trust zone); members still sit where their edges put them. A group whose members are a subset of another's is drawn inside it; kind security draws it red, plain draws only its name.","tier":"core","pack":"core","examples":[]},{"name":"Diff","group":"Content","signature":"Diff(patch: string, title?: string)","description":"Unified diff (git diff output, one or more files) with line numbers. patch is a raw multi-line string. Clicked lines reach the agent as file:+line.","tier":"core","pack":"core","examples":["retryPatch = Diff(\"diff --git a/src/retry.ts b/src/retry.ts\n--- a/src/retry.ts\n+++ b/src/retry.ts\n@@ -10,2 +10,3 @@\n- for (let i = 0; i < 3; i++) {\n+ for (let i = 0; i < MAX_ATTEMPTS; i++) {\n+ if (i > 0) await sleep(backoff(i));\")"]},{"name":"FileTree","group":"Data","signature":"FileTree(entries: string[])","description":"File tree, one path per entry, optionally prefixed with a git status code (A new, M modified, D deleted, R old -> new) and suffixed with \" # note\". Folders are inferred. Clicked files and folders reach the agent by path.","tier":"core","pack":"core","examples":["changedFiles = FileTree([\"M src/session/store.ts # read-through to Postgres\", \"A src/session/pg-store.ts\", \"A migrations/0042_sessions.sql # table + expiry index\", \"R src/session/redis.ts -> src/session/redis-cache.ts\", \"D src/session/legacy.ts\", \"M src/config.ts # SESSIONS_PG flag\"])"]},{"name":"Progress","group":"Data","signature":"Progress(value: number, label?: string, max?: number)","description":"Progress bar. value counts toward max (default 100); label names what is progressing. Shows a percentage.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["migration = Progress(64, \"Rows migrated\")"]},{"name":"Avatar","group":"Data","signature":"Avatar(name: string, src?: string, size?: \"md\" | \"lg\")","description":"Round avatar for a person. Shows the initials of name; src is an optional https image URL.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["owner = Avatar(\"Ada Lovelace\")"]},{"name":"AvatarGroup","group":"Data","signature":"AvatarGroup(avatars: Avatar[], max?: number)","description":"Overlapping Avatars, for reviewers or owners. max (default 4) shows the rest as +N.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["team = AvatarGroup([ada, grace, linus], 2)\nada = Avatar(\"Ada Lovelace\")\ngrace = Avatar(\"Grace Hopper\")\nlinus = Avatar(\"Linus Torvalds\")"]},{"name":"Tooltip","group":"Content","signature":"Tooltip(text: string, tip: string)","description":"Inline text with a short hint on hover or focus (a term and its definition). Keep tip to one line.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["term = Tooltip(\"idempotent\", \"Safe to run twice with the same result.\")"]},{"name":"HoverCard","group":"Content","signature":"HoverCard(text: string, title: string, body?: string)","description":"Inline text that shows a small card (title and a line or two of body) on hover or focus, e.g. a person or a service.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["svc = HoverCard(\"billing-api\", \"billing-api\", \"Owns invoices and refunds. On call: payments team.\")"]},{"name":"Breadcrumb","group":"Content","signature":"Breadcrumb(items: BreadcrumbItem[])","description":"Path trail such as Repo / Package / File, from BreadcrumbItems. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["trail = Breadcrumb([repo, pkg, file])\nrepo = BreadcrumbItem(\"austere-axi\")\npkg = BreadcrumbItem(\"packs\")\nfile = BreadcrumbItem(\"shadcn\")"]},{"name":"BreadcrumbItem","group":"Content","signature":"BreadcrumbItem(label: string, href?: string)","description":"One step of a Breadcrumb. href is optional; the last item is the current page.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]},{"name":"Kbd","group":"Content","signature":"Kbd(keys: string)","description":"Keyboard shortcut. keys joins keys with \"+\", e.g. \"Ctrl+K\"; each key is drawn as a key cap.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["shortcut = Kbd(\"Ctrl+Shift+P\")"]},{"name":"Skeleton","group":"Content","signature":"Skeleton(lines?: number, shape?: \"lines\" | \"avatar\")","description":"Grey placeholder block for content not yet written or loaded (default 3 lines). shape avatar adds a round head.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["pending = Skeleton(3, \"avatar\")"]},{"name":"Calendar","group":"Data","signature":"Calendar(month: string, highlights?: string[])","description":"Read-only month grid (not a date picker). month is \"YYYY-MM\"; highlights lists \"YYYY-MM-DD\" or \"YYYY-MM-DD label\" entries to mark, e.g. a freeze or a release. Marked days are click targets.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["window = Calendar(\"2026-11\", [\"2026-11-04 Code freeze\", \"2026-11-12 Release\", \"2026-11-13\"])"]},{"name":"Timeline","group":"Content","signature":"Timeline(items: TimelineItem[])","description":"Vertical history or schedule of TimelineItems, oldest first. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["history = Timeline([found, fixed, rollout])\nfound = TimelineItem(\"Bug found\", \"Oct 28\", \"Retries double-charge on timeout.\")\nfixed = TimelineItem(\"Fix merged\", \"Oct 29\", \"Idempotency key added.\", \"current\")\nrollout = TimelineItem(\"Rollout\", \"Nov 3\", \"\", \"upcoming\")"]},{"name":"TimelineItem","group":"Content","signature":"TimelineItem(title: string, date?: string, detail?: string, state?: \"done\" | \"current\" | \"upcoming\")","description":"One event in a Timeline. state: done (default), current or upcoming.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]}]}
package/dist/cli.mjs CHANGED
@@ -23618,7 +23618,7 @@ var init_paths = __esm({
23618
23618
  HERE = path.dirname(fileURLToPath(import.meta.url));
23619
23619
  BUNDLED = true;
23620
23620
  ASSET_DIR = BUNDLED ? HERE : path.resolve(HERE, "../../dist");
23621
- VERSION = true ? "0.19.0" : packageVersion();
23621
+ VERSION = true ? "0.20.0" : packageVersion();
23622
23622
  CLI_ENTRY = BUNDLED ? fileURLToPath(import.meta.url) : path.resolve(HERE, "main.ts");
23623
23623
  REAL_PORT = 4388;
23624
23624
  securedDir = null;
@@ -31864,10 +31864,12 @@ var CALLER_HARNESSES, ENV, SESSION_ID, INTERPRETERS;
31864
31864
  var init_caller = __esm({
31865
31865
  "src/cli/caller.ts"() {
31866
31866
  "use strict";
31867
- CALLER_HARNESSES = ["omp", "copilot", "dsh"];
31867
+ CALLER_HARNESSES = ["omp", "copilot", "opencode", "dsh"];
31868
31868
  ENV = {
31869
31869
  omp: { id: "PI_SESSION_ID", file: "PI_SESSION_FILE" },
31870
31870
  copilot: { id: "COPILOT_AGENT_SESSION_ID" },
31871
+ // Set by our OpenCode plugin (src/harness/opencode.ts): OpenCode itself names no session there.
31872
+ opencode: { id: "OPENCODE_SESSION_ID" },
31871
31873
  dsh: { id: "DSH_SESSION_ID" }
31872
31874
  };
31873
31875
  SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
@@ -39905,6 +39907,7 @@ var init_dispatch = __esm({
39905
39907
  "PI_SESSION_ID",
39906
39908
  "PI_SESSION_FILE",
39907
39909
  "COPILOT_AGENT_SESSION_ID",
39910
+ "OPENCODE_SESSION_ID",
39908
39911
  "DSH_SESSION_ID"
39909
39912
  ];
39910
39913
  RUN_IMAGES = ["cmd.exe", "node.exe", "omp.exe", "copilot.exe", "bun.exe"];
@@ -45706,7 +45709,7 @@ var init_mcp = __esm({
45706
45709
  };
45707
45710
  session = {
45708
45711
  type: "string",
45709
- description: "Optional: the agent session you run in, as <harness>:<id> (omp, copilot, dsh), when your harness does not set PI_SESSION_ID, COPILOT_AGENT_SESSION_ID or DSH_SESSION_ID. Stays on this machine."
45712
+ description: "Optional: the agent session you run in, as <harness>:<id> (omp, copilot, opencode, dsh), when your harness does not set PI_SESSION_ID, COPILOT_AGENT_SESSION_ID, OPENCODE_SESSION_ID or DSH_SESSION_ID. Stays on this machine."
45710
45713
  };
45711
45714
  withSession = (a) => typeof a.session === "string" ? ["--session", a.session] : [];
45712
45715
  TOOLS = {
@@ -47503,7 +47506,8 @@ NOTES
47503
47506
  check warns when an Architecture diagram will not fit the page.
47504
47507
  check --render needs Chrome, Chromium or Edge (or CHROME_PATH).
47505
47508
  open, patch, poll, reply and feedback print \`session:\`, the agent session they ran in: from the
47506
- harness's environment (omp PI_SESSION_ID, Copilot CLI COPILOT_AGENT_SESSION_ID, dsh DSH_SESSION_ID)
47509
+ harness's environment (omp PI_SESSION_ID, Copilot CLI COPILOT_AGENT_SESSION_ID, OpenCode
47510
+ OPENCODE_SESSION_ID from the austere-axi plugin, dsh DSH_SESSION_ID)
47507
47511
  or --session <harness>:<id>. Session ids stay on this machine; \`${BIN5} sessions list\` shows them.
47508
47512
  With attach on, a note the owner sends or releases starts the attached harness headless
47509
47513
  (\`${BIN5} run list\`); limits in <state dir>/attach.json. A run gets AUSTERE_AXI_RUN_ID.
@@ -47516,7 +47520,7 @@ ENV
47516
47520
  A scope's token variable (registry add --token-env), sent only to that scope's registry
47517
47521
  `;
47518
47522
  }
47519
- var SESSION_FLAG = "the agent session this runs in, as <harness>:<id> (omp, copilot, dsh), when the harness's environment does not name it; the id stays on this machine";
47523
+ var SESSION_FLAG = "the agent session this runs in, as <harness>:<id> (omp, copilot, opencode, dsh), when the harness's environment does not name it; the id stays on this machine";
47520
47524
  var COMMANDS = {
47521
47525
  open: {
47522
47526
  usage: "<file> [--no-open]",
@@ -0,0 +1,336 @@
1
+ // src/harness/client.ts
2
+ import crypto from "node:crypto";
3
+ import fs from "node:fs";
4
+ import http from "node:http";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ var TICK_MS = 1e3;
8
+ var IDLE_TICKS = 2;
9
+ var POLL_MS = 5e4;
10
+ var BACKOFF_MS = 5e3;
11
+ var BACKOFF_MAX_MS = 6e4;
12
+ var MAX_FAILURES = 6;
13
+ var LOCK_FRESH_MS = 6e4;
14
+ function alive(pid) {
15
+ try {
16
+ process.kill(pid, 0);
17
+ return true;
18
+ } catch (err) {
19
+ return err.code === "EPERM";
20
+ }
21
+ }
22
+ function findServer(env = process.env) {
23
+ const dir = env.AUSTERE_AXI_STATE_DIR ? path.resolve(env.AUSTERE_AXI_STATE_DIR) : path.join(os.homedir(), ".austere-axi");
24
+ let key;
25
+ try {
26
+ key = fs.readFileSync(path.join(dir, "owner.key"), "utf8").trim();
27
+ } catch {
28
+ return null;
29
+ }
30
+ if (key.length < 22) return null;
31
+ const fixed = Number(env.AUSTERE_AXI_PORT);
32
+ if (Number.isInteger(fixed) && fixed > 0 && fixed < 65536) return { port: fixed, key };
33
+ let lock;
34
+ try {
35
+ lock = JSON.parse(fs.readFileSync(path.join(dir, "server.lock"), "utf8"));
36
+ } catch {
37
+ return null;
38
+ }
39
+ const { pid, port, at } = lock ?? {};
40
+ if (typeof port !== "number" || !Number.isInteger(port) || port <= 0 || port >= 65536)
41
+ return null;
42
+ if (!(Date.now() - Number(at) < LOCK_FRESH_MS)) return null;
43
+ return typeof pid === "number" && Number.isInteger(pid) && pid > 0 && alive(pid) ? { port, key } : null;
44
+ }
45
+ function call(link, method, route, body, {
46
+ auth = true,
47
+ signal,
48
+ timeoutMs = 0
49
+ } = {}) {
50
+ const { promise, resolve, reject } = Promise.withResolvers();
51
+ const payload = body === void 0 ? void 0 : JSON.stringify(body);
52
+ const req = http.request(
53
+ {
54
+ host: "127.0.0.1",
55
+ port: link.port,
56
+ method,
57
+ path: route,
58
+ signal,
59
+ headers: {
60
+ host: `127.0.0.1:${link.port}`,
61
+ ...auth ? { "x-austere-key": link.key } : {},
62
+ ...payload ? { "content-type": "application/json", "content-length": Buffer.byteLength(payload) } : {}
63
+ }
64
+ },
65
+ (res) => {
66
+ const chunks = [];
67
+ res.on("data", (c) => chunks.push(c));
68
+ res.on("end", () => {
69
+ try {
70
+ resolve({
71
+ status: res.statusCode ?? 0,
72
+ data: JSON.parse(Buffer.concat(chunks).toString("utf8"))
73
+ });
74
+ } catch (err) {
75
+ reject(err);
76
+ }
77
+ });
78
+ res.on("error", reject);
79
+ }
80
+ );
81
+ req.on("error", reject);
82
+ if (timeoutMs) req.setTimeout(timeoutMs, () => req.destroy(new Error("timeout")));
83
+ req.end(payload);
84
+ return promise;
85
+ }
86
+ async function proven(link) {
87
+ const nonce = crypto.randomBytes(16).toString("base64url");
88
+ try {
89
+ const r = await call(
90
+ link,
91
+ "GET",
92
+ `/api/health?nonce=${nonce}`,
93
+ void 0,
94
+ { auth: false, timeoutMs: 1200 }
95
+ );
96
+ if (r.status !== 200 || r.data.name !== "austere-axi" || typeof r.data.proof !== "string")
97
+ return false;
98
+ const want = crypto.createHmac("sha256", link.key).update(`${link.port}:${nonce}`).digest();
99
+ const got = Buffer.from(r.data.proof, "base64url");
100
+ return got.length === want.length && crypto.timingSafeEqual(got, want);
101
+ } catch {
102
+ return false;
103
+ }
104
+ }
105
+ function ranAustere(toolName, input) {
106
+ if (typeof toolName === "string" && toolName.includes("austere")) return true;
107
+ try {
108
+ return JSON.stringify(input ?? "").includes("austere-axi");
109
+ } catch {
110
+ return false;
111
+ }
112
+ }
113
+ var WakeClient = class {
114
+ host;
115
+ env;
116
+ /** This process, as the server tells two processes on one session apart. */
117
+ client = crypto.randomBytes(12).toString("base64url");
118
+ link = null;
119
+ timer = null;
120
+ inflight = null;
121
+ checking = false;
122
+ recheck = false;
123
+ idleTicks = 0;
124
+ failures = 0;
125
+ retryAt = 0;
126
+ constructor(host, env = process.env) {
127
+ this.host = host;
128
+ this.env = env;
129
+ }
130
+ /** Whether the session has a role and the client polls while it is idle. */
131
+ get active() {
132
+ return this.timer !== null;
133
+ }
134
+ route(op) {
135
+ const key = `${this.host.harness}:${this.host.sessionId()}`;
136
+ return `/api/sessions/${encodeURIComponent(key)}/${op}`;
137
+ }
138
+ /** A server proven to be ours, or null when none runs. Local files, then one health request. */
139
+ async connect() {
140
+ if (this.link) return this.link;
141
+ const link = findServer(this.env);
142
+ if (!link || !await proven(link)) return null;
143
+ return this.link = link;
144
+ }
145
+ /** The one cheap check: is there a server, and does it know this session on a page? */
146
+ async check() {
147
+ if (this.checking || this.active || !this.host.sessionId()) return;
148
+ this.checking = true;
149
+ try {
150
+ const link = await this.connect();
151
+ if (!link) return;
152
+ const r = await call(link, "POST", this.route("wake-poll"), {
153
+ client: this.client,
154
+ timeoutMs: 0
155
+ });
156
+ if (r.status !== 200 || r.data.status === "no_role") return;
157
+ this.start();
158
+ if (r.data.status === "wake") await this.deliver(link, r.data);
159
+ } catch {
160
+ this.link = null;
161
+ } finally {
162
+ this.checking = false;
163
+ }
164
+ }
165
+ start() {
166
+ this.failures = 0;
167
+ this.retryAt = 0;
168
+ this.timer = setInterval(() => this.tick(), TICK_MS);
169
+ this.timer.unref?.();
170
+ }
171
+ /** Inert again: no timer, no request. */
172
+ stop() {
173
+ clearInterval(this.timer ?? void 0);
174
+ this.timer = null;
175
+ this.inflight?.abort();
176
+ this.inflight = null;
177
+ this.idleTicks = 0;
178
+ }
179
+ /** A tool call ran: one that ran austere-axi makes the next turn end check again. */
180
+ toolRan(toolName, input) {
181
+ if (!this.active && ranAustere(toolName, input)) this.recheck = true;
182
+ }
183
+ /** A turn ended. */
184
+ turnEnd() {
185
+ if (!this.recheck) return;
186
+ this.recheck = false;
187
+ void this.check();
188
+ }
189
+ /** Each second while active: poll while idle, drop the poll when a turn starts. */
190
+ tick() {
191
+ if (!this.host.idle()) {
192
+ this.idleTicks = 0;
193
+ this.inflight?.abort();
194
+ return;
195
+ }
196
+ if (++this.idleTicks < IDLE_TICKS || this.inflight || Date.now() < this.retryAt) return;
197
+ void this.poll();
198
+ }
199
+ async poll() {
200
+ const ac = new AbortController();
201
+ this.inflight = ac;
202
+ try {
203
+ const link = await this.connect();
204
+ if (!link) throw new Error("no server");
205
+ const r = await call(
206
+ link,
207
+ "POST",
208
+ this.route("wake-poll"),
209
+ { client: this.client, timeoutMs: POLL_MS },
210
+ { signal: ac.signal }
211
+ );
212
+ if (r.status !== 200) throw new Error(`wake-poll answered ${r.status}`);
213
+ this.failures = 0;
214
+ if (r.data.status === "no_role") this.stop();
215
+ else if (r.data.status === "wake") await this.deliver(link, r.data);
216
+ } catch {
217
+ if (ac.signal.aborted) return;
218
+ this.link = null;
219
+ if (++this.failures >= MAX_FAILURES) return this.stop();
220
+ this.retryAt = Date.now() + Math.min(BACKOFF_MAX_MS, BACKOFF_MS * 2 ** (this.failures - 1));
221
+ } finally {
222
+ if (this.inflight === ac) this.inflight = null;
223
+ }
224
+ }
225
+ /** Start the turn while the session is still idle, then say so; a busy session, or a send the harness refused, hands the claim back. */
226
+ async deliver(link, wake) {
227
+ let delivered = this.host.idle();
228
+ if (delivered) {
229
+ try {
230
+ await this.host.send(wake.prompt);
231
+ } catch {
232
+ delivered = false;
233
+ }
234
+ }
235
+ const ack = {
236
+ client: this.client,
237
+ claim: wake.claim,
238
+ outcome: delivered ? "delivered" : "released"
239
+ };
240
+ for (let attempt = 0; attempt < 2; attempt++) {
241
+ try {
242
+ await call(link, "POST", this.route("wake-ack"), ack, { timeoutMs: 5e3 });
243
+ return;
244
+ } catch {
245
+ }
246
+ }
247
+ }
248
+ };
249
+
250
+ // src/harness/opencode.ts
251
+ var SESSION_VAR = "OPENCODE_SESSION_ID";
252
+ function opencodeWake(oc, env = process.env) {
253
+ const sessions = /* @__PURE__ */ new Map();
254
+ const parents = /* @__PURE__ */ new Map();
255
+ const root = (id) => {
256
+ const seen = /* @__PURE__ */ new Set();
257
+ while (parents.has(id) && !seen.has(id)) {
258
+ seen.add(id);
259
+ id = parents.get(id);
260
+ }
261
+ return id;
262
+ };
263
+ const watch = (id) => {
264
+ let w = sessions.get(id);
265
+ if (w) return w;
266
+ const state = {
267
+ busy: false,
268
+ client: new WakeClient(
269
+ {
270
+ harness: "opencode",
271
+ sessionId: () => id,
272
+ idle: () => !state.busy,
273
+ send: async (text) => {
274
+ state.busy = true;
275
+ const r = await oc.session.promptAsync({ path: { id }, body: { parts: [{ type: "text", text }] } }).catch((err) => ({ error: err }));
276
+ if (r?.error) {
277
+ state.busy = false;
278
+ throw new Error("promptAsync refused the wake");
279
+ }
280
+ }
281
+ },
282
+ env
283
+ )
284
+ };
285
+ sessions.set(id, w = state);
286
+ void state.client.check();
287
+ return state;
288
+ };
289
+ const hooks = {
290
+ async event({ event }) {
291
+ const p = event.properties ?? {};
292
+ if (event.type === "session.created" || event.type === "session.updated") {
293
+ const { id: id2, parentID } = p.info ?? {};
294
+ if (typeof id2 === "string" && typeof parentID === "string" && id2 !== parentID)
295
+ parents.set(id2, parentID);
296
+ return;
297
+ }
298
+ if (event.type === "session.deleted") {
299
+ const id2 = p.info?.id;
300
+ if (typeof id2 !== "string") return;
301
+ sessions.get(id2)?.client.stop();
302
+ sessions.delete(id2);
303
+ parents.delete(id2);
304
+ return;
305
+ }
306
+ const id = typeof p.sessionID === "string" ? p.sessionID : "";
307
+ if (!id || parents.has(id)) return;
308
+ if (event.type === "session.status") {
309
+ const w = watch(id);
310
+ const busy = p.status?.type !== "idle";
311
+ if (w.busy && !busy) {
312
+ w.busy = false;
313
+ w.client.turnEnd();
314
+ } else w.busy = busy;
315
+ } else if (event.type === "session.idle") {
316
+ const w = watch(id);
317
+ const was = w.busy;
318
+ w.busy = false;
319
+ if (was) w.client.turnEnd();
320
+ }
321
+ },
322
+ async "shell.env"(input, output) {
323
+ if (input.sessionID) output.env[SESSION_VAR] = root(input.sessionID);
324
+ },
325
+ async "tool.execute.after"(input) {
326
+ sessions.get(root(input.sessionID))?.client.toolRan(input.tool, input.args);
327
+ }
328
+ };
329
+ return { hooks, sessions };
330
+ }
331
+
332
+ // src/harness/opencode-plugin.ts
333
+ var AustereWake = async (input) => opencodeWake(input.client).hooks;
334
+ export {
335
+ AustereWake
336
+ };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "format": 1,
3
3
  "pack": "@austere-axi/pack-shadcn",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "groups": [
6
6
  {
7
7
  "name": "Data",
@@ -195,7 +195,7 @@
195
195
  }
196
196
  ],
197
197
  "api": 1,
198
- "integrity": "sha384-ghaKW7yohEuRveD4AqrDfCRogxN3ZhWhAXPI1xjri/1+FgILW0Q1llNxr9T4Q2qK",
198
+ "integrity": "sha384-qEaIt4yy/8ZsYcBZwYnZb2SFtEb1qfSgjyoMCPW3bBVUIQfN7Auw46yoi43C0lEl",
199
199
  "size": 16833,
200
200
  "css": true,
201
201
  "defs": {
@@ -276,4 +276,4 @@ rollout = TimelineItem("Rollout", "Nov 3", "", "upcoming")`});var he=`.sh-muted
276
276
  flex-wrap: wrap;
277
277
  gap: 4px 12px;
278
278
  }
279
- `;var y={components:[ee,M,te,ae,se,oe,H,ie,le,me,ue,K],css:he};var ge=t(l());(0,ge.registerPack)({name:"@austere-axi/pack-shadcn",version:"0.19.0",api:1,components:[].concat(y&&y.components?y.components:y),css:y&&y.css});})();
279
+ `;var y={components:[ee,M,te,ae,se,oe,H,ie,le,me,ue,K],css:he};var ge=t(l());(0,ge.registerPack)({name:"@austere-axi/pack-shadcn",version:"0.20.0",api:1,components:[].concat(y&&y.components?y.components:y),css:y&&y.css});})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "austere-axi",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Agent-authored review artifacts in OpenUI Lang: a few hundred tokens instead of a whole HTML page, with statement-level annotations fed back to the agent.",
5
5
  "keywords": [
6
6
  "agent",