orchestral-cli 0.4.1

A runtime for reliable, interactive AI agents.
Documentation
1
const CACHE_PREFIX="orchestral-dioxus-",BUILD_ID="dxh8c454f95db9d6852",CACHE_NAME=`${CACHE_PREFIX}${BUILD_ID}`,SHELL_FILES=["./","./index.html","./manifest.webmanifest","./icons/favicon.svg","./icons/icon-192.svg","./icons/icon-512.svg","./icons/maskable-icon.svg","./icons/apple-touch-icon.svg","./icons/icon-192.png","./icons/icon-512.png","./icons/maskable-icon.png","./icons/apple-touch-icon.png"],offlineDocument=new URL("./index.html",self.location.href).href;function isSensitive(n,t){if(n.headers.has("Authorization"))return!0;const i=`${t.pathname}${t.search}`.toLowerCase();return/(?:^|\/)api(?:\/|$)/.test(t.pathname.toLowerCase())||/(?:^|\/)(?:stream|transcript|token)(?:\/|$|[?&])/.test(i)||/[?&](?:access_?token|token|secret|transcript)=/.test(i)}self.addEventListener("install",n=>{n.waitUntil((async()=>{await(await caches.open(CACHE_NAME)).addAll(SHELL_FILES),await self.skipWaiting()})())}),self.addEventListener("activate",n=>{n.waitUntil((async()=>{const t=await caches.keys(),i=t.some(e=>e.startsWith(CACHE_PREFIX)&&e!==CACHE_NAME);await Promise.all(t.filter(e=>e.startsWith(CACHE_PREFIX)&&e!==CACHE_NAME).map(e=>caches.delete(e)));const a=await caches.open(CACHE_NAME),s=await a.keys();if(await Promise.all(s.map(e=>{const c=new URL(e.url);return isSensitive(e,c)?a.delete(e):Promise.resolve(!1)})),await self.clients.claim(),i){const e=await self.clients.matchAll({type:"window",includeUncontrolled:!0});for(const c of e)c.postMessage({type:"ORCHESTRAL_UPDATE_READY"})}})())}),self.addEventListener("fetch",n=>{const{request:t}=n;if(t.method!=="GET")return;const i=new URL(t.url);if(i.origin!==self.location.origin||isSensitive(t,i))return;if(t.mode==="navigate"){n.respondWith((async()=>{try{return await fetch(t,{cache:"no-store"})}catch{return await caches.match(offlineDocument)??new Response("Orchestral is offline",{status:503,headers:{"Content-Type":"text/plain; charset=utf-8"}})}})());return}(["/assets/","/wasm/","/icons/"].some(s=>i.pathname.includes(s))||i.pathname.endsWith(".webmanifest"))&&n.respondWith((async()=>{const s=await caches.match(t);if(s)return s;const e=await fetch(t);return e.ok&&e.type==="basic"&&await(await caches.open(CACHE_NAME)).put(t,e.clone()),e})())}),self.addEventListener("message",n=>{n.data?.type==="SKIP_WAITING"&&self.skipWaiting()}),self.addEventListener("notificationclick",n=>{n.notification.close(),n.waitUntil((async()=>{const t=new URL(n.notification.data?.url||"./",self.location.origin),i=t.origin===self.location.origin?t.href:new URL("./",self.location.href).href,s=(await self.clients.matchAll({type:"window",includeUncontrolled:!0})).find(e=>new URL(e.url).origin===self.location.origin);if(s){await s.focus(),"navigate"in s&&await s.navigate(i);return}await self.clients.openWindow(i)})())});