signetai 0.42.3 → 0.43.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/dashboard/_app/immutable/chunks/DD5zl3it.js +1 -0
- package/dashboard/_app/immutable/entry/{app.DyM7lGEH.js → app.Z2Afau45.js} +2 -2
- package/dashboard/_app/immutable/entry/start.B2jUT1ds.js +1 -0
- package/dashboard/_app/immutable/nodes/{1.C86LAzjx.js → 1.C22gbxJn.js} +1 -1
- package/dashboard/_app/version.json +1 -1
- package/dashboard/index.html +6 -6
- package/dist/daemon.js +212 -118
- package/package.json +1 -1
- package/dashboard/_app/immutable/chunks/D5aO9ubX.js +0 -1
- package/dashboard/_app/immutable/entry/start.CoXcqq-r.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ba as be,o as Ne,s as A,g as U,b as T,Q as ee,bb as pt}from"./DRrAwi3T.js";class ke{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ee{constructor(t,n){this.status=t,this.location=n}}class Se extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function gt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function mt(e){return e.split("%25").map(decodeURI).join("%25")}function _t(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function de({href:e}){return e.split("#")[0]}function vt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function wt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function yt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const bt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&G.delete(Re(e)),bt(e,t));const G=new Map;function kt(e,t){const n=Re(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&G.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=yt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Et(e,t,n){if(G.size>0){const r=Re(e,n),a=G.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);G.delete(r)}}return window.fetch(t,n)}function Re(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${wt(...a)}"]`}return r}const St=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Rt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Lt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return he(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return he(String.fromCharCode(...l.slice(2).split("-").map(v=>parseInt(v,16))));const d=St.exec(l),[,p,f,u,h]=d;return t.push({name:u,matcher:h,optional:!!p,rest:!!f,chained:f?c===1&&s[0]==="":!1}),f?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return he(l)}).join("")}).join("")}/?$`),params:t}}function xt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Lt(e){return e.slice(1).split("/").filter(xt)}function At(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function he(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ut({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:f}=Rt(o),u={id:o,exec:h=>{const v=p.exec(h);if(v)return At(v,f,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Me(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function je(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_15iy03h?.base??"",Tt=globalThis.__sveltekit_15iy03h?.assets??x??"",Pt="1772959453941",He="sveltekit:snapshot",We="sveltekit:scroll",Je="sveltekit:states",It="sveltekit:pageurl",K="sveltekit:history",H="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function Ye(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function D(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const De={...N,"":N.hover};function ze(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Xe(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=ze(e)}}function me(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||ce(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===xe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function te(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=V(o,"preload-code")),a===null&&(a=V(o,"preload-data")),t===null&&(t=V(o,"keepfocus")),n===null&&(n=V(o,"noscroll")),i===null&&(i=V(o,"reload")),s===null&&(s=V(o,"replacestate")),o=ze(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:De[r??"off"],preload_data:De[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function qe(e){const t=be(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const Qe={v:()=>{}};function Ot(){const{set:e,subscribe:t}=be(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Tt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==Pt;return s&&(e(!0),Qe.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function ce(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function sn(e){}const Ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Ze];const Ct=new Set([...Ze]);[...Ct];function $t(e){return e.filter(t=>t!=null)}function Le(e){return e instanceof ke||e instanceof Se?e.status:500}function Nt(e){return e instanceof Se?e.text:"Internal Error"}let k,W,pe;const jt=Ne.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ne.toString());jt?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},pe={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},W=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},pe=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},Qe.v=()=>pe.current=!0);function Dt(e){Object.assign(k,e)}const Ve={spanContext(){return qt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},qt={traceId:"",spanId:"",traceFlags:0},Vt=new Set(["icon","shortcut icon","apple-touch-icon"]),$=Me(We)??{},J=Me(He)??{},C={url:qe({}),page:qe({}),navigating:be(null),updated:Ot()};function Ae(e){$[e]=D()}function Kt(e,t){let n=e+1;for(;$[n];)delete $[n],n+=1;for(n=t+1;J[n];)delete J[n],n+=1}function Y(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function et(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ke(){}let Ue,_e,ne,P,ve,w;const re=[],ae=[];let L=null;function we(){L?.fork?.then(e=>e?.discard()),L=null}const Z=new Map,tt=new Set,Bt=new Set,M=new Set;let _={branch:[],error:null,url:null},nt=!1,oe=!1,Be=!0,z=!1,F=!1,rt=!1,Te=!1,at,y,R,j;const se=new Set,Fe=new Map;async function fn(e,t,n){globalThis.__sveltekit_15iy03h?.data&&globalThis.__sveltekit_15iy03h.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),Ue=Ut(e),P=document.documentElement,ve=t,_e=e.nodes[0],ne=e.nodes[1],_e(),ne(),y=history.state?.[K],R=history.state?.[H],y||(y=R=Date.now(),history.replaceState({...history.state,[K]:y,[H]:R},""));const r=$[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await tn(ve,n)):(await B({type:"enter",url:Ye(w.hash?an(new URL(location.href)):location.href),replace_state:!0}),a()),en()}function Ft(){re.length=0,Te=!1}function ot(e){ae.some(t=>t?.snapshot)&&(J[e]=ae.map(t=>t?.snapshot?.capture()))}function st(e){J[e]?.forEach((t,n)=>{ae[n]?.snapshot?.restore(t)})}function Ge(){Ae(y),je(We,$),ot(R),je(He,J)}async function Gt(e,t,n,r){let a;t.invalidateAll&&we(),await B({type:"goto",url:Ye(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Te=!0,a=[...Fe.keys()]),t.invalidate&&t.invalidate.forEach(Zt)}}),t.invalidateAll&&ee().then(ee).then(()=>{Fe.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function Mt(e){if(e.id!==L?.id){we();const t={};se.add(t),L={id:e.id,token:t,promise:ct({...e,preload:t}).then(n=>(se.delete(t),n.type==="loaded"&&n.state.error&&we(),n)),fork:null}}return L.promise}async function ge(e){const t=(await ue(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}async function it(e,t,n){_=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(k,e.props.page),at=new w.root({target:t,props:{...e.props,stores:C,components:ae},hydrate:n,sync:!1}),await Promise.resolve(),st(R),n){const a={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:$[y]??D()},willUnload:!1,type:"enter",complete:Promise.resolve()};M.forEach(i=>i(a))}oe=!0}function ie({url:e,params:t,branch:n,status:r,error:a,route:i,form:s}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const u of n)u?.slash!==void 0&&(o=u.slash);e.pathname=gt(e.pathname,o),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:i},props:{constructors:$t(n).map(u=>u.node.component),page:$e(k)}};s!==void 0&&(l.props.form=s);let c={},d=!k,p=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const h=n[u],v=_.branch[u];h?.data!==v?.data&&(d=!0),h&&(c={...c,...h.data},d&&(l.props[`data_${p}`]=c),p+=1)}return(!_.url||e.href!==_.url.href||_.error!==a||s!==void 0&&s!==k.form||d)&&(l.props.page={error:a,params:t,route:{id:i?.id??null},state:{},status:r,url:new URL(e),form:s??null,data:d?c:k.data}),l}async function Pe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...f){for(const u of f){const{href:h}=new URL(u,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Ve,current:Ve},route:new Proxy(a,{get:(f,u)=>(o&&(l.route=!0),f[u])}),params:new Proxy(r,{get:(f,u)=>(o&&l.params.add(u),f[u])}),data:i?.data??null,url:vt(n,()=>{o&&(l.url=!0)},f=>{o&&l.search_params.add(f)},w.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:h,promise:v}=lt(f,u,n);return o&&d(h.href),v},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(f){o=!1;try{return f()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function lt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=oe?Et(r,a.href,t):kt(r,t);return{resolved:a,promise:i}}function Ht(e,t,n,r,a,i){if(Te)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==_.params[s])return!0;for(const s of a.dependencies)if(re.some(o=>o(new URL(s))))return!0;return!1}function Ie(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Wt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Jt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:$e(k),constructors:[]}}}async function ct({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return se.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(m=>m?.().catch(()=>{})),c.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==le(_.url):!1,p=_.route?a.id!==_.route.id:!1,f=Wt(_.url,n);let u=!1;const h=c.map(async(m,g)=>{if(!m)return;const E=_.branch[g];return m[1]===E?.loader&&!Ht(u,p,d,f,E.universal?.uses,r)?E:(u=!0,Pe({loader:m[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let O=0;O<g;O+=1)Object.assign(I,(await h[O])?.data);return I},server_data_node:Ie(m[0]?{type:"skip"}:null,m[0]?E?.server:void 0)}))});for(const m of h)m.catch(()=>{});const v=[];for(let m=0;m<c.length;m+=1)if(c[m])try{v.push(await h[m])}catch(g){if(g instanceof Ee)return{type:"redirect",location:g.location};if(se.has(i))return Jt({error:await X(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let E=Le(g),S;if(g instanceof ke)S=g.body;else{if(await C.updated.check())return await et(),await Y(n);S=await X(g,{params:r,url:n,route:{id:a.id}})}const I=await Yt(m,v,s);return I?ie({url:n,params:r,branch:v.slice(0,I.idx).concat(I.node),status:E,error:S,route:a}):await ft(n,{id:a.id},S,E)}else v.push(void 0);return ie({url:n,params:r,branch:v,status:200,error:null,route:a,form:t?void 0:null})}async function Yt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Oe({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await Pe({loader:_e,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ie(i)}),o={node:await ne(),loader:ne,universal:null,server:null,data:null};return ie({url:n,params:a,branch:[s,o],status:e,error:t,route:null})}catch(s){if(s instanceof Ee)return Gt(new URL(s.location,location.href),{},0);throw s}}async function zt(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const r=(async()=>{let a=await w.hooks.reroute({url:new URL(e),fetch:async(i,s)=>lt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);w.hash?i.hash=a:i.pathname=a,a=i}return a})();Z.set(t,r),n=await r}catch{Z.delete(t);return}return n}async function ue(e,t){if(e&&!ce(e,x,w.hash)){const n=await zt(e);if(!n)return;const r=Xt(n);for(const a of Ue){const i=a.exec(r);if(i)return{id:le(e),invalidating:t,route:a,params:_t(i),url:e}}}}function Xt(e){return mt(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function le(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function ut({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ce(_,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return z||tt.forEach(c=>c(l)),s?null:o}async function B({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Ke,block:d=Ke,event:p}){const f=j;j=l;const u=await ue(t,!1),h=e==="enter"?Ce(_,u,t,e):ut({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:p});if(!h){d(),j===l&&(j=f);return}const v=y,m=R;c(),z=!0,oe&&h.navigation.type!=="enter"&&C.navigating.set(W.current=h.navigation);let g=u&&await ct(u);if(!g){if(ce(t,x,w.hash))return await Y(t,i);g=await ft(t,{id:null},await X(new Se(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,j!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await B({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Oe({status:500,error:await X(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await C.updated.check()&&(await et(),await Y(t,i));if(Ft(),Ae(v),ot(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const b=i?0:1,Q={[K]:y+=b,[H]:R+=b,[Je]:s};(i?history.replaceState:history.pushState).call(history,Q,"",t),i||Kt(y,R)}const E=u&&L?.id===u.id?L.fork:null;L=null,g.props.page.state=s;let S;if(oe){const b=(await Promise.all(Array.from(Bt,q=>q(h.navigation)))).filter(q=>typeof q=="function");if(b.length>0){let q=function(){b.forEach(fe=>{M.delete(fe)})};b.push(q),b.forEach(fe=>{M.add(fe)})}_=g.state,g.props.page&&(g.props.page.url=t);const Q=E&&await E;Q?S=Q.commit():(at.$set(g.props),Dt(g.props.page),S=pt?.()),rt=!0}else await it(g,ve,!1);const{activeElement:I}=document;await S,await ee(),await ee();let O=null;if(Be){const b=n?n.scroll:a?D():null;b?scrollTo(b.x,b.y):(O=t.hash&&document.getElementById(dt(t)))?O.scrollIntoView():scrollTo(0,0)}const ht=document.activeElement!==I&&document.activeElement!==document.body;!r&&!ht&&rn(t,!O),Be=!0,g.props.page&&Object.assign(k,g.props.page),z=!1,e==="popstate"&&st(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=D()),M.forEach(b=>b(h.navigation)),C.navigating.set(W.current=null)}async function ft(e,t,n,r,a){return e.origin===xe&&e.pathname===location.pathname&&!nt?await Oe({status:r,error:n,url:e,route:t}):await Y(e,a)}function Qt(){let e,t={element:void 0,href:void 0},n;P.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}P.addEventListener("mousedown",r),P.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(ge(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=Xe(o,P),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:f,download:u}=me(c,x,w.hash);if(f||u)return;const h=te(c),v=p&&le(_.url)===le(p);if(!(h.reload||v))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const m=await ue(p,!1);if(!m)return;Mt(m)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,ge(p))}function s(){a.disconnect();for(const o of P.querySelectorAll("a")){const{url:l,external:c,download:d}=me(o,x,w.hash);if(c||d)continue;const p=te(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&ge(l))}}M.add(s),s()}function X(e,t){if(e instanceof ke)return e.body;const n=Le(e),r=Nt(e);return w.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Zt(e){if(typeof e=="function")re.push(e);else{const{href:t}=new URL(e,location.href);re.push(n=>n.href===t)}}function en(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Ge(),!z){const r=Ce(_,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};tt.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ge()}),navigator.connection?.saveData||Qt(),P.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Xe(t.composedPath()[0],P);if(!n)return;const{url:r,external:a,target:i,download:s}=me(n,x,w.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=te(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(w.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===de(location);if(a||o.reload&&(!p||!d)){ut({url:r,type:"link",event:t})?z=!0:t.preventDefault();return}if(d!==void 0&&p){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(F=!0,Ae(y),e(r),!o.replace_state)return;F=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await B({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),P.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ce(s,x,!1))return;const o=t.target,l=te(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),B({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ye){if(t.state?.[K]){const n=t.state[K];if(j={},n===y)return;const r=$[n],a=t.state[Je]??{},i=new URL(t.state[It]??location.href),s=t.state[H],o=_.url?de(location)===de(_.url):!1;if(s===R&&(rt||o)){a!==k.state&&(k.state=a),e(i),$[y]=D(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await B({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:j,event:t})}else if(!F){const n=new URL(location.href);e(n),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[K]:++y,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Vt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&C.navigating.set(W.current=null)});function e(t){_.url=k.url=t,C.page.set($e(k)),C.page.notify()}}async function tn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){nt=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await ue(c,!1)||{}),d=Ue.find(({id:u})=>u===i.id);let p,f=!0;try{const u=r.map(async(v,m)=>{const g=o[m];return g?.uses&&(g.uses=nn(g.uses)),Pe({loader:w.nodes[v],url:c,params:a,route:i,parent:async()=>{const E={};for(let S=0;S<m;S+=1)Object.assign(E,(await u[S]).data);return E},server_data_node:Ie(g)})}),h=await Promise.all(u);if(d){const v=d.layouts;for(let m=0;m<v.length;m++)v[m]||h.splice(m,0,void 0)}p=ie({url:c,params:a,branch:h,status:t,error:n,form:l,route:d??null})}catch(u){if(u instanceof Ee){await Y(new URL(u.location,location.href));return}p=await Oe({status:Le(u),error:await X(u,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",f=!1}p.props.page&&(p.props.page.state={}),await it(p,e,f)}function nn(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let ye=!1;function rn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=dt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=D();setTimeout(()=>{const o=history.state;ye=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),ye=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ce(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:D()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function $e(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function an(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function dt(e){let t;if(w.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{fn as a,sn as l,k as p,C as s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DsRNLJkb.js","../chunks/DRrAwi3T.js","../assets/vendor-ui.BHIBfuhK.css","../assets/0.BnOlCuNp.css","../nodes/1.
|
|
2
|
-
import{_ as v}from"../chunks/PPVm8Dsz.js";import{a as Q,B as g,a5 as F,P as G,o as H,g as i,b as h,Q as K,q as l,i as b,d as N,h as d,l as S,s as p,m as E,C as P,J as O,c as U,r as W,z as C,u as x,t as X,e as Y,f as Z,a6 as $}from"../chunks/DRrAwi3T.js";const it={};var tt=C('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),et=C("<!> <!>",1);function at(a,t){Q(t,!0);let r=g(t,"components",23,()=>[]),_=g(t,"data_0",3,null),y=g(t,"data_1",3,null);F(()=>t.stores.page.set(t.page)),G(()=>{t.stores,t.page,t.constructors,r(),t.form,_(),y(),t.stores.page.notify()});let f=p(!1),j=p(!1),w=p(null);H(()=>{const e=t.stores.page.subscribe(()=>{i(f)&&(h(j,!0),K().then(()=>{h(w,document.title||"untitled page",!0)}))});return h(f,!0),e});const I=x(()=>t.constructors[1]);var R=et(),k=l(R);{var L=e=>{const s=x(()=>t.constructors[0]);var o=E(),m=l(o);P(m,()=>i(s),(n,c)=>{O(c(n,{get data(){return _()},get form(){return t.form},get params(){return t.page.params},children:(u,st)=>{var A=E(),z=l(A);P(z,()=>i(I),(B,J)=>{O(J(B,{get data(){return y()},get form(){return t.form},get params(){return t.page.params}}),M=>r()[1]=M,()=>r()?.[1])}),d(u,A)},$$slots:{default:!0}}),u=>r()[0]=u,()=>r()?.[0])}),d(e,o)},T=e=>{const s=x(()=>t.constructors[0]);var o=E(),m=l(o);P(m,()=>i(s),(n,c)=>{O(c(n,{get data(){return _()},get form(){return t.form},get params(){return t.page.params}}),u=>r()[0]=u,()=>r()?.[0])}),d(e,o)};b(k,e=>{t.constructors[1]?e(L):e(T,!1)})}var V=N(k,2);{var q=e=>{var s=tt(),o=U(s);{var m=n=>{var c=X();Y(()=>Z(c,i(w))),d(n,c)};b(o,n=>{i(j)&&n(m)})}W(s),d(e,s)};b(V,e=>{i(f)&&e(q)})}d(a,R),S()}const ct=$(at),dt=[()=>v(()=>import("../nodes/0.DsRNLJkb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),()=>v(()=>import("../nodes/1.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DsRNLJkb.js","../chunks/DRrAwi3T.js","../assets/vendor-ui.BHIBfuhK.css","../assets/0.BnOlCuNp.css","../nodes/1.C22gbxJn.js","../chunks/DD5zl3it.js","../nodes/2.C-O8KSxS.js","../chunks/DmRdylYe.js","../chunks/PPVm8Dsz.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as v}from"../chunks/PPVm8Dsz.js";import{a as Q,B as g,a5 as F,P as G,o as H,g as i,b as h,Q as K,q as l,i as b,d as N,h as d,l as S,s as p,m as E,C as P,J as O,c as U,r as W,z as C,u as x,t as X,e as Y,f as Z,a6 as $}from"../chunks/DRrAwi3T.js";const it={};var tt=C('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),et=C("<!> <!>",1);function at(a,t){Q(t,!0);let r=g(t,"components",23,()=>[]),_=g(t,"data_0",3,null),y=g(t,"data_1",3,null);F(()=>t.stores.page.set(t.page)),G(()=>{t.stores,t.page,t.constructors,r(),t.form,_(),y(),t.stores.page.notify()});let f=p(!1),j=p(!1),w=p(null);H(()=>{const e=t.stores.page.subscribe(()=>{i(f)&&(h(j,!0),K().then(()=>{h(w,document.title||"untitled page",!0)}))});return h(f,!0),e});const I=x(()=>t.constructors[1]);var R=et(),k=l(R);{var L=e=>{const s=x(()=>t.constructors[0]);var o=E(),m=l(o);P(m,()=>i(s),(n,c)=>{O(c(n,{get data(){return _()},get form(){return t.form},get params(){return t.page.params},children:(u,st)=>{var A=E(),z=l(A);P(z,()=>i(I),(B,J)=>{O(J(B,{get data(){return y()},get form(){return t.form},get params(){return t.page.params}}),M=>r()[1]=M,()=>r()?.[1])}),d(u,A)},$$slots:{default:!0}}),u=>r()[0]=u,()=>r()?.[0])}),d(e,o)},T=e=>{const s=x(()=>t.constructors[0]);var o=E(),m=l(o);P(m,()=>i(s),(n,c)=>{O(c(n,{get data(){return _()},get form(){return t.form},get params(){return t.page.params}}),u=>r()[0]=u,()=>r()?.[0])}),d(e,o)};b(k,e=>{t.constructors[1]?e(L):e(T,!1)})}var V=N(k,2);{var q=e=>{var s=tt(),o=U(s);{var m=n=>{var c=X();Y(()=>Z(c,i(w))),d(n,c)};b(o,n=>{i(j)&&n(m)})}W(s),d(e,s)};b(V,e=>{i(f)&&e(q)})}d(a,R),S()}const ct=$(at),dt=[()=>v(()=>import("../nodes/0.DsRNLJkb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),()=>v(()=>import("../nodes/1.C22gbxJn.js"),__vite__mapDeps([4,1,2,5]),import.meta.url),()=>v(()=>import("../nodes/2.C-O8KSxS.js"),__vite__mapDeps([6,7,8,1,2]),import.meta.url)],mt=[],ut={"/":[2]},D={handleError:(({error:a})=>{console.error(a)}),reroute:(()=>{}),transport:{}},rt=Object.fromEntries(Object.entries(D.transport).map(([a,t])=>[a,t.decode])),lt=Object.fromEntries(Object.entries(D.transport).map(([a,t])=>[a,t.encode])),_t=!1,ft=(a,t)=>rt[a](t);export{ft as decode,rt as decoders,ut as dictionary,lt as encoders,_t as hash,D as hooks,it as matchers,dt as nodes,ct as root,mt as server_loads};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as o,a as r}from"../chunks/DD5zl3it.js";export{o as load_css,r as start};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m,_ as u,q as g,e as l,h as d,l as v,z as _,c as a,r as s,d as x,f as o}from"../chunks/DRrAwi3T.js";import{s as $,p}from"../chunks/
|
|
1
|
+
import{a as m,_ as u,q as g,e as l,h as d,l as v,z as _,c as a,r as s,d as x,f as o}from"../chunks/DRrAwi3T.js";import{s as $,p}from"../chunks/DD5zl3it.js";const k={get error(){return p.error},get status(){return p.status}};$.updated.check;const c=k;var b=_("<h1> </h1> <p> </p>",1);function E(n,f){m(f,!1),u();var r=b(),t=g(r),h=a(t,!0);s(t);var e=x(t,2),i=a(e,!0);s(e),l(()=>{o(h,c.status),o(i,c.error?.message)}),d(n,r),v()}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"1772959453941"}
|
package/dashboard/index.html
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
document.documentElement.dataset.theme = t;
|
|
18
18
|
})();
|
|
19
19
|
</script>
|
|
20
|
-
<link href="/_app/immutable/entry/start.
|
|
21
|
-
<link href="/_app/immutable/chunks/
|
|
20
|
+
<link href="/_app/immutable/entry/start.B2jUT1ds.js" rel="modulepreload">
|
|
21
|
+
<link href="/_app/immutable/chunks/DD5zl3it.js" rel="modulepreload">
|
|
22
22
|
<link href="/_app/immutable/chunks/DRrAwi3T.js" rel="modulepreload">
|
|
23
|
-
<link href="/_app/immutable/entry/app.
|
|
23
|
+
<link href="/_app/immutable/entry/app.Z2Afau45.js" rel="modulepreload">
|
|
24
24
|
<link href="/_app/immutable/chunks/PPVm8Dsz.js" rel="modulepreload">
|
|
25
25
|
|
|
26
26
|
<link href="/_app/immutable/assets/vendor-ui.BHIBfuhK.css" rel="stylesheet">
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
<div style="display: contents">
|
|
30
30
|
<script>
|
|
31
31
|
{
|
|
32
|
-
|
|
32
|
+
__sveltekit_15iy03h = {
|
|
33
33
|
base: ""
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const element = document.currentScript.parentElement;
|
|
37
37
|
|
|
38
38
|
Promise.all([
|
|
39
|
-
import("/_app/immutable/entry/start.
|
|
40
|
-
import("/_app/immutable/entry/app.
|
|
39
|
+
import("/_app/immutable/entry/start.B2jUT1ds.js"),
|
|
40
|
+
import("/_app/immutable/entry/app.Z2Afau45.js")
|
|
41
41
|
]).then(([kit, app]) => {
|
|
42
42
|
kit.start(app, element);
|
|
43
43
|
});
|
package/dist/daemon.js
CHANGED
|
@@ -49615,12 +49615,15 @@ function createOpenCodeProvider(config) {
|
|
|
49615
49615
|
}
|
|
49616
49616
|
|
|
49617
49617
|
// ../daemon/src/pipeline/synthesis-worker.ts
|
|
49618
|
-
|
|
49618
|
+
function getAgentsDir() {
|
|
49619
|
+
return process.env.SIGNET_PATH || join19(homedir11(), ".agents");
|
|
49620
|
+
}
|
|
49619
49621
|
var CHECK_INTERVAL_MS = 60000;
|
|
49620
49622
|
var MIN_INTERVAL_MS = 60 * 60 * 1000;
|
|
49621
49623
|
var STARTUP_DELAY_MS = 60000;
|
|
49624
|
+
var DRAIN_TIMEOUT_BUFFER_MS = 1000;
|
|
49622
49625
|
function getLastSynthesisPath() {
|
|
49623
|
-
return join19(
|
|
49626
|
+
return join19(getAgentsDir(), ".daemon", "last-synthesis.json");
|
|
49624
49627
|
}
|
|
49625
49628
|
function readLastSynthesisTime() {
|
|
49626
49629
|
try {
|
|
@@ -49636,11 +49639,11 @@ function readLastSynthesisTime() {
|
|
|
49636
49639
|
function writeLastSynthesisTime(timestamp) {
|
|
49637
49640
|
try {
|
|
49638
49641
|
const path = getLastSynthesisPath();
|
|
49639
|
-
mkdirSync8(join19(
|
|
49642
|
+
mkdirSync8(join19(getAgentsDir(), ".daemon"), { recursive: true });
|
|
49640
49643
|
writeFileSync6(path, JSON.stringify({ lastRunAt: timestamp }));
|
|
49641
49644
|
} catch (e) {
|
|
49642
49645
|
logger.warn("synthesis", "Failed to persist synthesis timestamp", {
|
|
49643
|
-
error: e.message
|
|
49646
|
+
error: e instanceof Error ? e.message : String(e)
|
|
49644
49647
|
});
|
|
49645
49648
|
}
|
|
49646
49649
|
}
|
|
@@ -49667,7 +49670,7 @@ async function runSynthesis(config) {
|
|
|
49667
49670
|
});
|
|
49668
49671
|
try {
|
|
49669
49672
|
const lastRun = readLastSynthesisTime();
|
|
49670
|
-
const memoryMdExists = existsSync16(join19(
|
|
49673
|
+
const memoryMdExists = existsSync16(join19(getAgentsDir(), "MEMORY.md"));
|
|
49671
49674
|
const synthesisData = handleSynthesisRequest({ trigger: "scheduled" }, {
|
|
49672
49675
|
maxTokens: config.maxTokens,
|
|
49673
49676
|
sinceTimestamp: lastRun > 0 && memoryMdExists ? lastRun : undefined
|
|
@@ -49704,7 +49707,7 @@ async function runSynthesis(config) {
|
|
|
49704
49707
|
});
|
|
49705
49708
|
return "ok";
|
|
49706
49709
|
} catch (e) {
|
|
49707
|
-
logger.error("synthesis", "Synthesis failed", e);
|
|
49710
|
+
logger.error("synthesis", "Synthesis failed", e instanceof Error ? e : new Error(String(e)));
|
|
49708
49711
|
return "failed";
|
|
49709
49712
|
}
|
|
49710
49713
|
}
|
|
@@ -49712,7 +49715,30 @@ function startSynthesisWorker(config) {
|
|
|
49712
49715
|
let timer = null;
|
|
49713
49716
|
let stopped = false;
|
|
49714
49717
|
let isSynthesizing = false;
|
|
49718
|
+
let currentRunPromise = null;
|
|
49719
|
+
let nextLockToken = 1;
|
|
49720
|
+
let activeLockToken = null;
|
|
49721
|
+
let lockReleasedResolver = null;
|
|
49722
|
+
let lockReleasedPromise = Promise.resolve();
|
|
49715
49723
|
const idleGapMs = config.idleGapMinutes * 60 * 1000;
|
|
49724
|
+
function acquireWriteLock() {
|
|
49725
|
+
if (stopped || isSynthesizing)
|
|
49726
|
+
return null;
|
|
49727
|
+
isSynthesizing = true;
|
|
49728
|
+
activeLockToken = nextLockToken++;
|
|
49729
|
+
lockReleasedPromise = new Promise((resolve4) => {
|
|
49730
|
+
lockReleasedResolver = resolve4;
|
|
49731
|
+
});
|
|
49732
|
+
return activeLockToken;
|
|
49733
|
+
}
|
|
49734
|
+
function releaseWriteLock(token) {
|
|
49735
|
+
if (activeLockToken !== token)
|
|
49736
|
+
return;
|
|
49737
|
+
activeLockToken = null;
|
|
49738
|
+
isSynthesizing = false;
|
|
49739
|
+
lockReleasedResolver?.();
|
|
49740
|
+
lockReleasedResolver = null;
|
|
49741
|
+
}
|
|
49716
49742
|
async function tick() {
|
|
49717
49743
|
if (stopped)
|
|
49718
49744
|
return;
|
|
@@ -49745,15 +49771,21 @@ function startSynthesisWorker(config) {
|
|
|
49745
49771
|
scheduleTick(CHECK_INTERVAL_MS);
|
|
49746
49772
|
return;
|
|
49747
49773
|
}
|
|
49748
|
-
|
|
49774
|
+
const lockToken = acquireWriteLock();
|
|
49775
|
+
if (lockToken === null) {
|
|
49776
|
+
scheduleTick(CHECK_INTERVAL_MS);
|
|
49777
|
+
return;
|
|
49778
|
+
}
|
|
49749
49779
|
try {
|
|
49750
|
-
|
|
49780
|
+
currentRunPromise = runSynthesis(config);
|
|
49781
|
+
await currentRunPromise;
|
|
49751
49782
|
writeLastSynthesisTime(Date.now());
|
|
49752
49783
|
} finally {
|
|
49753
|
-
|
|
49784
|
+
currentRunPromise = null;
|
|
49785
|
+
releaseWriteLock(lockToken);
|
|
49754
49786
|
}
|
|
49755
49787
|
} catch (e) {
|
|
49756
|
-
logger.error("synthesis", "Unhandled tick error", e);
|
|
49788
|
+
logger.error("synthesis", "Unhandled tick error", e instanceof Error ? e : new Error(String(e)));
|
|
49757
49789
|
}
|
|
49758
49790
|
scheduleTick(CHECK_INTERVAL_MS);
|
|
49759
49791
|
}
|
|
@@ -49762,7 +49794,7 @@ function startSynthesisWorker(config) {
|
|
|
49762
49794
|
return;
|
|
49763
49795
|
timer = setTimeout(() => {
|
|
49764
49796
|
tick().catch((err) => {
|
|
49765
|
-
logger.error("synthesis", "Unhandled tick error", err);
|
|
49797
|
+
logger.error("synthesis", "Unhandled tick error", err instanceof Error ? err : new Error(String(err)));
|
|
49766
49798
|
});
|
|
49767
49799
|
}, delay);
|
|
49768
49800
|
}
|
|
@@ -49779,26 +49811,66 @@ function startSynthesisWorker(config) {
|
|
|
49779
49811
|
clearTimeout(timer);
|
|
49780
49812
|
logger.info("synthesis", "Synthesis worker stopped");
|
|
49781
49813
|
},
|
|
49814
|
+
async drain() {
|
|
49815
|
+
if (!isSynthesizing)
|
|
49816
|
+
return "completed";
|
|
49817
|
+
let timeoutId = null;
|
|
49818
|
+
let timedOut = false;
|
|
49819
|
+
try {
|
|
49820
|
+
await Promise.race([
|
|
49821
|
+
Promise.all([
|
|
49822
|
+
currentRunPromise ?? Promise.resolve(),
|
|
49823
|
+
lockReleasedPromise
|
|
49824
|
+
]).then(() => {
|
|
49825
|
+
return;
|
|
49826
|
+
}),
|
|
49827
|
+
new Promise((resolve4) => {
|
|
49828
|
+
timeoutId = setTimeout(() => {
|
|
49829
|
+
timedOut = true;
|
|
49830
|
+
logger.warn("synthesis", "drain() timed out waiting for in-flight synthesis");
|
|
49831
|
+
resolve4();
|
|
49832
|
+
}, config.timeout + DRAIN_TIMEOUT_BUFFER_MS);
|
|
49833
|
+
})
|
|
49834
|
+
]);
|
|
49835
|
+
return timedOut ? "timeout" : "completed";
|
|
49836
|
+
} finally {
|
|
49837
|
+
if (timeoutId !== null)
|
|
49838
|
+
clearTimeout(timeoutId);
|
|
49839
|
+
}
|
|
49840
|
+
},
|
|
49841
|
+
acquireWriteLock,
|
|
49842
|
+
releaseWriteLock,
|
|
49782
49843
|
get running() {
|
|
49783
49844
|
return !stopped;
|
|
49784
49845
|
},
|
|
49846
|
+
get isSynthesizing() {
|
|
49847
|
+
return isSynthesizing;
|
|
49848
|
+
},
|
|
49785
49849
|
get lastRunAt() {
|
|
49786
49850
|
return readLastSynthesisTime();
|
|
49787
49851
|
},
|
|
49788
49852
|
async triggerNow() {
|
|
49789
|
-
if (
|
|
49790
|
-
return { success: false, skipped: true, reason: "Synthesis
|
|
49853
|
+
if (stopped) {
|
|
49854
|
+
return { success: false, skipped: true, reason: "Synthesis worker stopped" };
|
|
49791
49855
|
}
|
|
49792
|
-
const
|
|
49793
|
-
|
|
49794
|
-
|
|
49795
|
-
|
|
49796
|
-
|
|
49797
|
-
|
|
49856
|
+
const lockToken = acquireWriteLock();
|
|
49857
|
+
if (lockToken === null) {
|
|
49858
|
+
return {
|
|
49859
|
+
success: false,
|
|
49860
|
+
skipped: true,
|
|
49861
|
+
reason: "Synthesis already in progress"
|
|
49862
|
+
};
|
|
49798
49863
|
}
|
|
49799
|
-
isSynthesizing = true;
|
|
49800
49864
|
try {
|
|
49801
|
-
const
|
|
49865
|
+
const lastRun = readLastSynthesisTime();
|
|
49866
|
+
const elapsed = Date.now() - lastRun;
|
|
49867
|
+
if (elapsed < MIN_INTERVAL_MS) {
|
|
49868
|
+
const reason = `Too recent \u2014 last run ${Math.round(elapsed / 60000)}m ago, minimum is ${Math.round(MIN_INTERVAL_MS / 60000)}m`;
|
|
49869
|
+
logger.info("synthesis", "Skipping manual trigger", { reason });
|
|
49870
|
+
return { success: false, skipped: true, reason };
|
|
49871
|
+
}
|
|
49872
|
+
currentRunPromise = runSynthesis(config);
|
|
49873
|
+
const result = await currentRunPromise;
|
|
49802
49874
|
writeLastSynthesisTime(Date.now());
|
|
49803
49875
|
return {
|
|
49804
49876
|
success: result === "ok",
|
|
@@ -49806,7 +49878,8 @@ function startSynthesisWorker(config) {
|
|
|
49806
49878
|
reason: result === "empty" ? "No session summaries to synthesize" : undefined
|
|
49807
49879
|
};
|
|
49808
49880
|
} finally {
|
|
49809
|
-
|
|
49881
|
+
currentRunPromise = null;
|
|
49882
|
+
releaseWriteLock(lockToken);
|
|
49810
49883
|
}
|
|
49811
49884
|
}
|
|
49812
49885
|
};
|
|
@@ -51152,6 +51225,10 @@ function startPipeline(accessor2, pipelineCfg, embeddingCfg, fetchEmbedding2, se
|
|
|
51152
51225
|
async function stopPipeline() {
|
|
51153
51226
|
if (synthesisWorkerHandle) {
|
|
51154
51227
|
synthesisWorkerHandle.stop();
|
|
51228
|
+
const drainResult = await synthesisWorkerHandle.drain();
|
|
51229
|
+
if (drainResult === "timeout") {
|
|
51230
|
+
logger.warn("pipeline", "Synthesis worker drain timed out during shutdown");
|
|
51231
|
+
}
|
|
51155
51232
|
synthesisWorkerHandle = null;
|
|
51156
51233
|
}
|
|
51157
51234
|
if (summaryWorkerHandle) {
|
|
@@ -51207,7 +51284,7 @@ init_logger();
|
|
|
51207
51284
|
import { readFileSync as readFileSync12 } from "fs";
|
|
51208
51285
|
import { homedir as homedir12 } from "os";
|
|
51209
51286
|
import { join as join20 } from "path";
|
|
51210
|
-
var
|
|
51287
|
+
var AGENTS_DIR4 = process.env.SIGNET_PATH ?? join20(homedir12(), ".agents");
|
|
51211
51288
|
function stripFrontmatter(content) {
|
|
51212
51289
|
if (!content.startsWith("---"))
|
|
51213
51290
|
return content;
|
|
@@ -51223,7 +51300,7 @@ function resolveSkillPrompt(basePrompt, skillName, skillMode) {
|
|
|
51223
51300
|
if (skillMode === "slash") {
|
|
51224
51301
|
return `/${skillName} ${basePrompt}`;
|
|
51225
51302
|
}
|
|
51226
|
-
const skillPath = join20(
|
|
51303
|
+
const skillPath = join20(AGENTS_DIR4, "skills", skillName, "SKILL.md");
|
|
51227
51304
|
try {
|
|
51228
51305
|
const raw2 = readFileSync12(skillPath, "utf-8");
|
|
51229
51306
|
const content = stripFrontmatter(raw2);
|
|
@@ -51333,7 +51410,7 @@ function emitTaskStream(event) {
|
|
|
51333
51410
|
init_logger();
|
|
51334
51411
|
var POLL_INTERVAL_MS2 = 15000;
|
|
51335
51412
|
var MAX_CONCURRENT = 3;
|
|
51336
|
-
var
|
|
51413
|
+
var AGENTS_DIR5 = process.env.SIGNET_PATH || join21(homedir13(), ".agents");
|
|
51337
51414
|
var TASK_MODEL_CACHE_TTL_MS = 5000;
|
|
51338
51415
|
var taskModelCache = new Map;
|
|
51339
51416
|
function isTaskHarness(value) {
|
|
@@ -51356,7 +51433,7 @@ function selectDueTasks(db, nowIso, limit) {
|
|
|
51356
51433
|
ORDER BY t.next_run_at ASC
|
|
51357
51434
|
LIMIT ?`).all(nowIso, limit);
|
|
51358
51435
|
}
|
|
51359
|
-
function resolveTaskModel(harness, agentsDir2 =
|
|
51436
|
+
function resolveTaskModel(harness, agentsDir2 = AGENTS_DIR5) {
|
|
51360
51437
|
if (harness !== "codex")
|
|
51361
51438
|
return;
|
|
51362
51439
|
const now = Date.now();
|
|
@@ -75170,11 +75247,11 @@ import { existsSync as existsSync17, readFileSync as readFileSync13, readdirSync
|
|
|
75170
75247
|
import { homedir as homedir14 } from "os";
|
|
75171
75248
|
import { join as join23 } from "path";
|
|
75172
75249
|
init_logger();
|
|
75173
|
-
function
|
|
75250
|
+
function getAgentsDir2() {
|
|
75174
75251
|
return process.env.SIGNET_PATH || join23(homedir14(), ".agents");
|
|
75175
75252
|
}
|
|
75176
75253
|
function getSkillsDir() {
|
|
75177
|
-
return join23(
|
|
75254
|
+
return join23(getAgentsDir2(), "skills");
|
|
75178
75255
|
}
|
|
75179
75256
|
var catalogCache = [];
|
|
75180
75257
|
var catalogFetchedAt = 0;
|
|
@@ -75517,7 +75594,7 @@ function mountSkillsRoutes(app) {
|
|
|
75517
75594
|
const pkg = source || name;
|
|
75518
75595
|
logger.info("skills", "Installing skill", { name, pkg });
|
|
75519
75596
|
const packageManager = resolvePrimaryPackageManager({
|
|
75520
|
-
agentsDir:
|
|
75597
|
+
agentsDir: getAgentsDir2(),
|
|
75521
75598
|
env: process.env
|
|
75522
75599
|
});
|
|
75523
75600
|
const skillsCommand = getSkillsRunnerCommand(packageManager.family, ["add", pkg, "--global", "--yes"]);
|
|
@@ -77625,11 +77702,11 @@ var DEFAULT_EXPOSURE_POLICY = {
|
|
|
77625
77702
|
var catalogCache2 = new Map;
|
|
77626
77703
|
var referenceCatalogCache = null;
|
|
77627
77704
|
var toolsCache = new Map;
|
|
77628
|
-
function
|
|
77705
|
+
function getAgentsDir3() {
|
|
77629
77706
|
return process.env.SIGNET_PATH || join25(homedir15(), ".agents");
|
|
77630
77707
|
}
|
|
77631
77708
|
function getMarketplaceDir() {
|
|
77632
|
-
return join25(
|
|
77709
|
+
return join25(getAgentsDir3(), "marketplace");
|
|
77633
77710
|
}
|
|
77634
77711
|
function getInstalledMcpPath() {
|
|
77635
77712
|
return join25(getMarketplaceDir(), "mcp-servers.json");
|
|
@@ -78724,11 +78801,11 @@ var DEFAULT_CONFIG2 = {
|
|
|
78724
78801
|
lastSyncAt: null,
|
|
78725
78802
|
lastSyncError: null
|
|
78726
78803
|
};
|
|
78727
|
-
function
|
|
78804
|
+
function getAgentsDir4() {
|
|
78728
78805
|
return process.env.SIGNET_PATH || join26(homedir16(), ".agents");
|
|
78729
78806
|
}
|
|
78730
78807
|
function getMarketplaceDir2() {
|
|
78731
|
-
return join26(
|
|
78808
|
+
return join26(getAgentsDir4(), "marketplace");
|
|
78732
78809
|
}
|
|
78733
78810
|
function getReviewsPath() {
|
|
78734
78811
|
return join26(getMarketplaceDir2(), "reviews.json");
|
|
@@ -79023,12 +79100,12 @@ function mountMarketplaceReviewsRoutes(app) {
|
|
|
79023
79100
|
}
|
|
79024
79101
|
|
|
79025
79102
|
// ../daemon/src/daemon.ts
|
|
79026
|
-
var
|
|
79027
|
-
var DAEMON_DIR = join27(
|
|
79103
|
+
var AGENTS_DIR6 = process.env.SIGNET_PATH || join27(homedir17(), ".agents");
|
|
79104
|
+
var DAEMON_DIR = join27(AGENTS_DIR6, ".daemon");
|
|
79028
79105
|
var PID_FILE = join27(DAEMON_DIR, "pid");
|
|
79029
79106
|
var LOG_DIR = join27(DAEMON_DIR, "logs");
|
|
79030
|
-
var MEMORY_DB2 = join27(
|
|
79031
|
-
var SCRIPTS_DIR = join27(
|
|
79107
|
+
var MEMORY_DB2 = join27(AGENTS_DIR6, "memory", "memories.db");
|
|
79108
|
+
var SCRIPTS_DIR = join27(AGENTS_DIR6, "scripts");
|
|
79032
79109
|
var PORT = Number.parseInt(process.env.SIGNET_PORT || "3850", 10);
|
|
79033
79110
|
var HOST = process.env.SIGNET_HOST || "localhost";
|
|
79034
79111
|
var providerTracker = createProviderTracker();
|
|
@@ -79042,7 +79119,7 @@ var projectionInFlight = new Map;
|
|
|
79042
79119
|
var projectionErrors = new Map;
|
|
79043
79120
|
var PROJECTION_ERROR_TTL_MS = 30000;
|
|
79044
79121
|
var hasMemoriesSessionIdColumnCache = null;
|
|
79045
|
-
var authConfig = parseAuthConfig(undefined,
|
|
79122
|
+
var authConfig = parseAuthConfig(undefined, AGENTS_DIR6);
|
|
79046
79123
|
var authSecret = null;
|
|
79047
79124
|
var authForgetLimiter = new AuthRateLimiter(60000, 30);
|
|
79048
79125
|
var authModifyLimiter = new AuthRateLimiter(60000, 60);
|
|
@@ -79274,7 +79351,7 @@ function isMissingEmbeddingsTableError(error48) {
|
|
|
79274
79351
|
return message.includes("no such table: embeddings");
|
|
79275
79352
|
}
|
|
79276
79353
|
async function runLegacyEmbeddingsExport(withVectors, limit, offset) {
|
|
79277
|
-
const scriptPath = join27(
|
|
79354
|
+
const scriptPath = join27(AGENTS_DIR6, "memory", "scripts", "export_embeddings.py");
|
|
79278
79355
|
if (!existsSync20(scriptPath)) {
|
|
79279
79356
|
return null;
|
|
79280
79357
|
}
|
|
@@ -79284,7 +79361,7 @@ async function runLegacyEmbeddingsExport(withVectors, limit, offset) {
|
|
|
79284
79361
|
}
|
|
79285
79362
|
return await new Promise((resolve4) => {
|
|
79286
79363
|
const proc = spawn5("python3", args, {
|
|
79287
|
-
cwd:
|
|
79364
|
+
cwd: AGENTS_DIR6,
|
|
79288
79365
|
stdio: "pipe",
|
|
79289
79366
|
timeout: withVectors ? 120000 : 30000
|
|
79290
79367
|
});
|
|
@@ -79509,7 +79586,7 @@ app.get("/health", (c2) => {
|
|
|
79509
79586
|
pid: process.pid,
|
|
79510
79587
|
version: CURRENT_VERSION,
|
|
79511
79588
|
port: PORT,
|
|
79512
|
-
agentsDir:
|
|
79589
|
+
agentsDir: AGENTS_DIR6,
|
|
79513
79590
|
db: dbOk,
|
|
79514
79591
|
updateAvailable: us.lastCheck?.updateAvailable ?? false,
|
|
79515
79592
|
pendingRestart: us.pendingRestartVersion !== null
|
|
@@ -79699,10 +79776,10 @@ app.get("/api/logs/stream", (c2) => {
|
|
|
79699
79776
|
app.get("/api/config", async (c2) => {
|
|
79700
79777
|
try {
|
|
79701
79778
|
const files = [];
|
|
79702
|
-
const dirFiles = readdirSync7(
|
|
79779
|
+
const dirFiles = readdirSync7(AGENTS_DIR6);
|
|
79703
79780
|
const configFiles = dirFiles.filter((f2) => f2.endsWith(".md") || f2.endsWith(".yaml"));
|
|
79704
79781
|
for (const fileName of configFiles) {
|
|
79705
|
-
const filePath = join27(
|
|
79782
|
+
const filePath = join27(AGENTS_DIR6, fileName);
|
|
79706
79783
|
const fileStat = statSync5(filePath);
|
|
79707
79784
|
if (fileStat.isFile()) {
|
|
79708
79785
|
const content = readFileSync16(filePath, "utf-8");
|
|
@@ -79739,7 +79816,7 @@ app.post("/api/config", async (c2) => {
|
|
|
79739
79816
|
if (!file2.endsWith(".md") && !file2.endsWith(".yaml")) {
|
|
79740
79817
|
return c2.json({ error: "Invalid file type" }, 400);
|
|
79741
79818
|
}
|
|
79742
|
-
writeFileSync9(join27(
|
|
79819
|
+
writeFileSync9(join27(AGENTS_DIR6, file2), content, "utf-8");
|
|
79743
79820
|
logger.info("api", "Config file updated", { file: file2 });
|
|
79744
79821
|
return c2.json({ success: true });
|
|
79745
79822
|
} catch (e) {
|
|
@@ -79749,7 +79826,7 @@ app.post("/api/config", async (c2) => {
|
|
|
79749
79826
|
});
|
|
79750
79827
|
app.get("/api/identity", (c2) => {
|
|
79751
79828
|
try {
|
|
79752
|
-
const content = readFileSync16(join27(
|
|
79829
|
+
const content = readFileSync16(join27(AGENTS_DIR6, "IDENTITY.md"), "utf-8");
|
|
79753
79830
|
const lines = content.split(`
|
|
79754
79831
|
`);
|
|
79755
79832
|
const identity2 = {
|
|
@@ -80239,7 +80316,7 @@ app.post("/api/memory/remember", async (c2) => {
|
|
|
80239
80316
|
const raw2 = body.content?.trim();
|
|
80240
80317
|
if (!raw2)
|
|
80241
80318
|
return c2.json({ error: "content is required" }, 400);
|
|
80242
|
-
const fullCfg = loadMemoryConfig(
|
|
80319
|
+
const fullCfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80243
80320
|
const pipelineCfg = fullCfg.pipelineV2;
|
|
80244
80321
|
if (pipelineCfg.mutationsFrozen) {
|
|
80245
80322
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
@@ -80462,7 +80539,7 @@ app.post("/api/memory/remember", async (c2) => {
|
|
|
80462
80539
|
}
|
|
80463
80540
|
let embedded = false;
|
|
80464
80541
|
try {
|
|
80465
|
-
const cfg = loadMemoryConfig(
|
|
80542
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80466
80543
|
const vec = await fetchEmbedding(normalizedContent.storageContent, cfg.embedding);
|
|
80467
80544
|
if (vec) {
|
|
80468
80545
|
if (vec.length !== cfg.embedding.dimensions) {
|
|
@@ -80637,7 +80714,7 @@ app.post("/api/memory/:id/recover", async (c2) => {
|
|
|
80637
80714
|
return c2.json({ error: "if_version must be a positive integer" }, 400);
|
|
80638
80715
|
}
|
|
80639
80716
|
const ifVersion = ifVersionBody ?? ifVersionQuery;
|
|
80640
|
-
const cfg = loadMemoryConfig(
|
|
80717
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80641
80718
|
if (cfg.pipelineV2.mutationsFrozen) {
|
|
80642
80719
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
80643
80720
|
}
|
|
@@ -80709,7 +80786,7 @@ app.patch("/api/memory/:id", async (c2) => {
|
|
|
80709
80786
|
if (!parsedPatch.ok) {
|
|
80710
80787
|
return c2.json({ error: parsedPatch.error }, 400);
|
|
80711
80788
|
}
|
|
80712
|
-
const cfg = loadMemoryConfig(
|
|
80789
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80713
80790
|
if (cfg.pipelineV2.mutationsFrozen) {
|
|
80714
80791
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
80715
80792
|
}
|
|
@@ -80806,7 +80883,7 @@ app.delete("/api/memory/:id", async (c2) => {
|
|
|
80806
80883
|
return c2.json({ error: "if_version must be a positive integer" }, 400);
|
|
80807
80884
|
}
|
|
80808
80885
|
const ifVersion = ifVersionBody ?? ifVersionQuery;
|
|
80809
|
-
const cfg = loadMemoryConfig(
|
|
80886
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80810
80887
|
if (cfg.pipelineV2.mutationsFrozen) {
|
|
80811
80888
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
80812
80889
|
}
|
|
@@ -80949,7 +81026,7 @@ app.post("/api/memory/forget", async (c2) => {
|
|
|
80949
81026
|
}, 400);
|
|
80950
81027
|
}
|
|
80951
81028
|
}
|
|
80952
|
-
const cfg = loadMemoryConfig(
|
|
81029
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80953
81030
|
if (cfg.pipelineV2.mutationsFrozen) {
|
|
80954
81031
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
80955
81032
|
}
|
|
@@ -80992,7 +81069,7 @@ app.post("/api/memory/modify", async (c2) => {
|
|
|
80992
81069
|
error: `patches[] exceeds maximum batch size (${MAX_MUTATION_BATCH})`
|
|
80993
81070
|
}, 400);
|
|
80994
81071
|
}
|
|
80995
|
-
const cfg = loadMemoryConfig(
|
|
81072
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
80996
81073
|
if (cfg.pipelineV2.mutationsFrozen) {
|
|
80997
81074
|
return c2.json({ error: "Mutations are frozen (kill switch active)" }, 503);
|
|
80998
81075
|
}
|
|
@@ -81090,7 +81167,7 @@ app.post("/api/memory/recall", async (c2) => {
|
|
|
81090
81167
|
const query = body.query?.trim() ?? "";
|
|
81091
81168
|
if (!query)
|
|
81092
81169
|
return c2.json({ error: "query is required" }, 400);
|
|
81093
|
-
const cfg = loadMemoryConfig(
|
|
81170
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
81094
81171
|
try {
|
|
81095
81172
|
const result = await hybridRecall({ ...body, query }, cfg, fetchEmbedding);
|
|
81096
81173
|
return c2.json(result);
|
|
@@ -81110,7 +81187,7 @@ app.get("/api/memory/search", async (c2) => {
|
|
|
81110
81187
|
const pinned = c2.req.query("pinned");
|
|
81111
81188
|
const importanceMin = c2.req.query("importance_min");
|
|
81112
81189
|
const since = c2.req.query("since");
|
|
81113
|
-
const cfg = loadMemoryConfig(
|
|
81190
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
81114
81191
|
try {
|
|
81115
81192
|
const result = await hybridRecall({
|
|
81116
81193
|
query: q2,
|
|
@@ -81267,13 +81344,13 @@ app.get("/api/embeddings", async (c2) => {
|
|
|
81267
81344
|
}
|
|
81268
81345
|
});
|
|
81269
81346
|
app.get("/api/embeddings/status", async (c2) => {
|
|
81270
|
-
const config2 = loadMemoryConfig(
|
|
81347
|
+
const config2 = loadMemoryConfig(AGENTS_DIR6);
|
|
81271
81348
|
const status = await checkEmbeddingProvider(config2.embedding);
|
|
81272
81349
|
const tracker = embeddingTrackerHandle?.getStats() ?? null;
|
|
81273
81350
|
return c2.json({ ...status, tracker });
|
|
81274
81351
|
});
|
|
81275
81352
|
app.get("/api/embeddings/health", async (c2) => {
|
|
81276
|
-
const cfg = loadMemoryConfig(
|
|
81353
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
81277
81354
|
const providerStatus = await checkEmbeddingProvider(cfg.embedding);
|
|
81278
81355
|
const report = getDbAccessor().withReadDb((db) => buildEmbeddingHealth(db, cfg.embedding, providerStatus));
|
|
81279
81356
|
return c2.json(report);
|
|
@@ -81816,7 +81893,7 @@ app.get("/api/harnesses", async (c2) => {
|
|
|
81816
81893
|
id: "opencode",
|
|
81817
81894
|
path: join27(homedir17(), ".config", "opencode", "AGENTS.md")
|
|
81818
81895
|
},
|
|
81819
|
-
{ name: "OpenClaw", id: "openclaw", path: join27(
|
|
81896
|
+
{ name: "OpenClaw", id: "openclaw", path: join27(AGENTS_DIR6, "AGENTS.md") }
|
|
81820
81897
|
];
|
|
81821
81898
|
const harnesses = configs.map((config2) => ({
|
|
81822
81899
|
name: config2.name,
|
|
@@ -81836,7 +81913,7 @@ app.post("/api/harnesses/regenerate", async (c2) => {
|
|
|
81836
81913
|
}
|
|
81837
81914
|
const proc = spawn5("python3", [script], {
|
|
81838
81915
|
timeout: 1e4,
|
|
81839
|
-
cwd:
|
|
81916
|
+
cwd: AGENTS_DIR6
|
|
81840
81917
|
});
|
|
81841
81918
|
let stdout = "";
|
|
81842
81919
|
let stderr = "";
|
|
@@ -82265,7 +82342,7 @@ app.post("/api/hooks/compaction-complete", async (c2) => {
|
|
|
82265
82342
|
}
|
|
82266
82343
|
});
|
|
82267
82344
|
app.get("/api/hooks/synthesis/config", (c2) => {
|
|
82268
|
-
const config2 = loadMemoryConfig(
|
|
82345
|
+
const config2 = loadMemoryConfig(AGENTS_DIR6).pipelineV2.synthesis;
|
|
82269
82346
|
return c2.json(config2);
|
|
82270
82347
|
});
|
|
82271
82348
|
app.post("/api/hooks/synthesis", async (c2) => {
|
|
@@ -82284,11 +82361,28 @@ app.post("/api/hooks/synthesis/complete", async (c2) => {
|
|
|
82284
82361
|
if (!body.content) {
|
|
82285
82362
|
return c2.json({ error: "content is required" }, 400);
|
|
82286
82363
|
}
|
|
82287
|
-
|
|
82288
|
-
|
|
82364
|
+
const worker = getSynthesisWorker();
|
|
82365
|
+
let lockToken = null;
|
|
82366
|
+
if (worker) {
|
|
82367
|
+
if (!worker.running) {
|
|
82368
|
+
return c2.json({ error: "Synthesis worker is shutting down" }, 503);
|
|
82369
|
+
}
|
|
82370
|
+
lockToken = worker.acquireWriteLock();
|
|
82371
|
+
if (lockToken === null) {
|
|
82372
|
+
return worker.running ? c2.json({ error: "Synthesis already in progress" }, 409) : c2.json({ error: "Synthesis worker is shutting down" }, 503);
|
|
82373
|
+
}
|
|
82374
|
+
}
|
|
82375
|
+
try {
|
|
82376
|
+
writeMemoryMd(body.content);
|
|
82377
|
+
logger.info("hooks", "MEMORY.md synthesized");
|
|
82378
|
+
} finally {
|
|
82379
|
+
if (worker && lockToken !== null) {
|
|
82380
|
+
worker.releaseWriteLock(lockToken);
|
|
82381
|
+
}
|
|
82382
|
+
}
|
|
82289
82383
|
return c2.json({ success: true });
|
|
82290
82384
|
} catch (e) {
|
|
82291
|
-
logger.error("hooks", "Synthesis complete failed", e);
|
|
82385
|
+
logger.error("hooks", "Synthesis complete failed", e instanceof Error ? e : new Error(String(e)));
|
|
82292
82386
|
return c2.json({ error: "Failed to save MEMORY.md" }, 500);
|
|
82293
82387
|
}
|
|
82294
82388
|
});
|
|
@@ -82307,7 +82401,7 @@ app.post("/api/synthesis/trigger", async (c2) => {
|
|
|
82307
82401
|
});
|
|
82308
82402
|
app.get("/api/synthesis/status", (c2) => {
|
|
82309
82403
|
const worker = getSynthesisWorker();
|
|
82310
|
-
const config2 = loadMemoryConfig(
|
|
82404
|
+
const config2 = loadMemoryConfig(AGENTS_DIR6).pipelineV2.synthesis;
|
|
82311
82405
|
const lastRunAt = readLastSynthesisTime();
|
|
82312
82406
|
return c2.json({
|
|
82313
82407
|
running: worker?.running ?? false,
|
|
@@ -82720,7 +82814,7 @@ app.get("/api/tasks/:id/runs", (c2) => {
|
|
|
82720
82814
|
return c2.json({ runs, total, hasMore: offset + limit < total });
|
|
82721
82815
|
});
|
|
82722
82816
|
app.get("/api/status", (c2) => {
|
|
82723
|
-
const config2 = loadMemoryConfig(
|
|
82817
|
+
const config2 = loadMemoryConfig(AGENTS_DIR6);
|
|
82724
82818
|
let health;
|
|
82725
82819
|
try {
|
|
82726
82820
|
const report = getDbAccessor().withReadDb((db) => getDiagnostics(db, providerTracker, getUpdateState()));
|
|
@@ -82735,7 +82829,7 @@ app.get("/api/status", (c2) => {
|
|
|
82735
82829
|
startedAt: new Date(Date.now() - process.uptime() * 1000).toISOString(),
|
|
82736
82830
|
port: PORT,
|
|
82737
82831
|
host: HOST,
|
|
82738
|
-
agentsDir:
|
|
82832
|
+
agentsDir: AGENTS_DIR6,
|
|
82739
82833
|
memoryDb: existsSync20(MEMORY_DB2),
|
|
82740
82834
|
pipelineV2: config2.pipelineV2,
|
|
82741
82835
|
...health ? { health } : {},
|
|
@@ -82771,7 +82865,7 @@ app.get("/api/diagnostics/:domain", (c2) => {
|
|
|
82771
82865
|
return c2.json(domainData);
|
|
82772
82866
|
});
|
|
82773
82867
|
app.get("/api/pipeline/status", (c2) => {
|
|
82774
|
-
const cfg = loadMemoryConfig(
|
|
82868
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82775
82869
|
const accessor2 = getDbAccessor();
|
|
82776
82870
|
const dbData = accessor2.withReadDb((db) => {
|
|
82777
82871
|
const memoryRows = db.prepare("SELECT status, COUNT(*) as count FROM memory_jobs GROUP BY status").all();
|
|
@@ -82816,19 +82910,19 @@ function resolveRepairContext(c2) {
|
|
|
82816
82910
|
return { reason, actor, actorType, requestId };
|
|
82817
82911
|
}
|
|
82818
82912
|
app.post("/api/repair/requeue-dead", (c2) => {
|
|
82819
|
-
const cfg = loadMemoryConfig(
|
|
82913
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82820
82914
|
const ctx = resolveRepairContext(c2);
|
|
82821
82915
|
const result = requeueDeadJobs(getDbAccessor(), cfg.pipelineV2, ctx, repairLimiter);
|
|
82822
82916
|
return c2.json(result, result.success ? 200 : 429);
|
|
82823
82917
|
});
|
|
82824
82918
|
app.post("/api/repair/release-leases", (c2) => {
|
|
82825
|
-
const cfg = loadMemoryConfig(
|
|
82919
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82826
82920
|
const ctx = resolveRepairContext(c2);
|
|
82827
82921
|
const result = releaseStaleLeases(getDbAccessor(), cfg.pipelineV2, ctx, repairLimiter);
|
|
82828
82922
|
return c2.json(result, result.success ? 200 : 429);
|
|
82829
82923
|
});
|
|
82830
82924
|
app.post("/api/repair/check-fts", async (c2) => {
|
|
82831
|
-
const cfg = loadMemoryConfig(
|
|
82925
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82832
82926
|
const ctx = resolveRepairContext(c2);
|
|
82833
82927
|
let repair = false;
|
|
82834
82928
|
try {
|
|
@@ -82839,7 +82933,7 @@ app.post("/api/repair/check-fts", async (c2) => {
|
|
|
82839
82933
|
return c2.json(result, result.success ? 200 : 429);
|
|
82840
82934
|
});
|
|
82841
82935
|
app.post("/api/repair/retention-sweep", (c2) => {
|
|
82842
|
-
const cfg = loadMemoryConfig(
|
|
82936
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82843
82937
|
const ctx = resolveRepairContext(c2);
|
|
82844
82938
|
return c2.json({
|
|
82845
82939
|
action: "triggerRetentionSweep",
|
|
@@ -82861,7 +82955,7 @@ function repairHttpStatus(result) {
|
|
|
82861
82955
|
return 500;
|
|
82862
82956
|
}
|
|
82863
82957
|
app.post("/api/repair/re-embed", async (c2) => {
|
|
82864
|
-
const cfg = loadMemoryConfig(
|
|
82958
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82865
82959
|
const ctx = resolveRepairContext(c2);
|
|
82866
82960
|
let batchSize = 50;
|
|
82867
82961
|
let dryRun = false;
|
|
@@ -82879,13 +82973,13 @@ app.post("/api/repair/re-embed", async (c2) => {
|
|
|
82879
82973
|
return c2.json(result, repairHttpStatus(result));
|
|
82880
82974
|
});
|
|
82881
82975
|
app.post("/api/repair/resync-vec", (c2) => {
|
|
82882
|
-
const cfg = loadMemoryConfig(
|
|
82976
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82883
82977
|
const ctx = resolveRepairContext(c2);
|
|
82884
82978
|
const result = resyncVectorIndex(getDbAccessor(), cfg.pipelineV2, ctx, repairLimiter);
|
|
82885
82979
|
return c2.json(result, repairHttpStatus(result));
|
|
82886
82980
|
});
|
|
82887
82981
|
app.post("/api/repair/clean-orphans", (c2) => {
|
|
82888
|
-
const cfg = loadMemoryConfig(
|
|
82982
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82889
82983
|
const ctx = resolveRepairContext(c2);
|
|
82890
82984
|
const result = cleanOrphanedEmbeddings(getDbAccessor(), cfg.pipelineV2, ctx, repairLimiter);
|
|
82891
82985
|
return c2.json(result, repairHttpStatus(result));
|
|
@@ -82895,7 +82989,7 @@ app.get("/api/repair/dedup-stats", (c2) => {
|
|
|
82895
82989
|
return c2.json(stats);
|
|
82896
82990
|
});
|
|
82897
82991
|
app.post("/api/repair/deduplicate", async (c2) => {
|
|
82898
|
-
const cfg = loadMemoryConfig(
|
|
82992
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6);
|
|
82899
82993
|
const ctx = resolveRepairContext(c2);
|
|
82900
82994
|
const options = {};
|
|
82901
82995
|
try {
|
|
@@ -83157,7 +83251,7 @@ function loadGitConfig() {
|
|
|
83157
83251
|
remote: "origin",
|
|
83158
83252
|
branch: "main"
|
|
83159
83253
|
};
|
|
83160
|
-
const paths = [join27(
|
|
83254
|
+
const paths = [join27(AGENTS_DIR6, "agent.yaml"), join27(AGENTS_DIR6, "AGENT.yaml")];
|
|
83161
83255
|
for (const p2 of paths) {
|
|
83162
83256
|
if (!existsSync20(p2))
|
|
83163
83257
|
continue;
|
|
@@ -83271,15 +83365,15 @@ async function getGhCliToken() {
|
|
|
83271
83365
|
}
|
|
83272
83366
|
}
|
|
83273
83367
|
async function hasAnyGitCredentials() {
|
|
83274
|
-
if (!isGitRepo(
|
|
83368
|
+
if (!isGitRepo(AGENTS_DIR6))
|
|
83275
83369
|
return false;
|
|
83276
|
-
const remoteUrl = await getRemoteUrl(
|
|
83370
|
+
const remoteUrl = await getRemoteUrl(AGENTS_DIR6, gitConfig.remote);
|
|
83277
83371
|
if (!remoteUrl)
|
|
83278
83372
|
return false;
|
|
83279
83373
|
if (remoteUrl.startsWith("git@"))
|
|
83280
83374
|
return true;
|
|
83281
83375
|
if (remoteUrl.startsWith("https://")) {
|
|
83282
|
-
const creds = await getCredentialHelperToken(remoteUrl,
|
|
83376
|
+
const creds = await getCredentialHelperToken(remoteUrl, AGENTS_DIR6);
|
|
83283
83377
|
if (creds)
|
|
83284
83378
|
return true;
|
|
83285
83379
|
}
|
|
@@ -83359,10 +83453,10 @@ function runGitCommand(args, cwd) {
|
|
|
83359
83453
|
});
|
|
83360
83454
|
}
|
|
83361
83455
|
async function gitPull() {
|
|
83362
|
-
if (!isGitRepo(
|
|
83456
|
+
if (!isGitRepo(AGENTS_DIR6)) {
|
|
83363
83457
|
return { success: false, message: "Not a git repository" };
|
|
83364
83458
|
}
|
|
83365
|
-
const creds = await resolveGitCredentials(
|
|
83459
|
+
const creds = await resolveGitCredentials(AGENTS_DIR6, gitConfig.remote);
|
|
83366
83460
|
if (creds.method === "no-remote") {
|
|
83367
83461
|
return {
|
|
83368
83462
|
success: true,
|
|
@@ -83372,9 +83466,9 @@ async function gitPull() {
|
|
|
83372
83466
|
}
|
|
83373
83467
|
let fetchResult;
|
|
83374
83468
|
if (creds.usePlainGit) {
|
|
83375
|
-
fetchResult = await runGitCommand(["fetch", gitConfig.remote, gitConfig.branch],
|
|
83469
|
+
fetchResult = await runGitCommand(["fetch", gitConfig.remote, gitConfig.branch], AGENTS_DIR6);
|
|
83376
83470
|
} else if (creds.authUrl) {
|
|
83377
|
-
fetchResult = await runGitCommand(["fetch", creds.authUrl, gitConfig.branch],
|
|
83471
|
+
fetchResult = await runGitCommand(["fetch", creds.authUrl, gitConfig.branch], AGENTS_DIR6);
|
|
83378
83472
|
} else {
|
|
83379
83473
|
return {
|
|
83380
83474
|
success: false,
|
|
@@ -83385,16 +83479,16 @@ async function gitPull() {
|
|
|
83385
83479
|
logger.warn("git", `Fetch failed: ${fetchResult.stderr}`);
|
|
83386
83480
|
return { success: false, message: `Fetch failed: ${fetchResult.stderr}` };
|
|
83387
83481
|
}
|
|
83388
|
-
const diffResult = await runGitCommand(["rev-list", "--count", `HEAD..${gitConfig.remote}/${gitConfig.branch}`],
|
|
83482
|
+
const diffResult = await runGitCommand(["rev-list", "--count", `HEAD..${gitConfig.remote}/${gitConfig.branch}`], AGENTS_DIR6);
|
|
83389
83483
|
const incomingChanges = Number.parseInt(diffResult.stdout.trim(), 10) || 0;
|
|
83390
83484
|
if (incomingChanges === 0) {
|
|
83391
83485
|
return { success: true, message: "Already up to date", changes: 0 };
|
|
83392
83486
|
}
|
|
83393
|
-
const statusResult = await runGitCommand(["status", "--porcelain"],
|
|
83487
|
+
const statusResult = await runGitCommand(["status", "--porcelain"], AGENTS_DIR6);
|
|
83394
83488
|
const hasLocalChanges = statusResult.stdout.trim().length > 0;
|
|
83395
83489
|
let stashed = false;
|
|
83396
83490
|
if (hasLocalChanges) {
|
|
83397
|
-
const stashResult = await runGitCommand(["stash", "push", "-m", "signet-auto-stash"],
|
|
83491
|
+
const stashResult = await runGitCommand(["stash", "push", "-m", "signet-auto-stash"], AGENTS_DIR6);
|
|
83398
83492
|
if (stashResult.code !== 0) {
|
|
83399
83493
|
logger.warn("git", `Stash failed: ${stashResult.stderr}`);
|
|
83400
83494
|
return {
|
|
@@ -83404,9 +83498,9 @@ async function gitPull() {
|
|
|
83404
83498
|
}
|
|
83405
83499
|
stashed = true;
|
|
83406
83500
|
}
|
|
83407
|
-
const pullResult = await runGitCommand(["merge", `${gitConfig.remote}/${gitConfig.branch}`, "--ff-only"],
|
|
83501
|
+
const pullResult = await runGitCommand(["merge", `${gitConfig.remote}/${gitConfig.branch}`, "--ff-only"], AGENTS_DIR6);
|
|
83408
83502
|
if (stashed) {
|
|
83409
|
-
const popResult = await runGitCommand(["stash", "pop"],
|
|
83503
|
+
const popResult = await runGitCommand(["stash", "pop"], AGENTS_DIR6);
|
|
83410
83504
|
if (popResult.code !== 0) {
|
|
83411
83505
|
logger.warn("git", `Stash pop failed \u2014 local changes preserved in git stash: ${popResult.stderr}`);
|
|
83412
83506
|
}
|
|
@@ -83423,10 +83517,10 @@ async function gitPull() {
|
|
|
83423
83517
|
};
|
|
83424
83518
|
}
|
|
83425
83519
|
async function gitPush() {
|
|
83426
|
-
if (!isGitRepo(
|
|
83520
|
+
if (!isGitRepo(AGENTS_DIR6)) {
|
|
83427
83521
|
return { success: false, message: "Not a git repository" };
|
|
83428
83522
|
}
|
|
83429
|
-
const creds = await resolveGitCredentials(
|
|
83523
|
+
const creds = await resolveGitCredentials(AGENTS_DIR6, gitConfig.remote);
|
|
83430
83524
|
if (creds.method === "no-remote") {
|
|
83431
83525
|
return {
|
|
83432
83526
|
success: true,
|
|
@@ -83434,16 +83528,16 @@ async function gitPush() {
|
|
|
83434
83528
|
changes: 0
|
|
83435
83529
|
};
|
|
83436
83530
|
}
|
|
83437
|
-
const diffResult = await runGitCommand(["rev-list", "--count", `${gitConfig.remote}/${gitConfig.branch}..HEAD`],
|
|
83531
|
+
const diffResult = await runGitCommand(["rev-list", "--count", `${gitConfig.remote}/${gitConfig.branch}..HEAD`], AGENTS_DIR6);
|
|
83438
83532
|
const outgoingChanges = Number.parseInt(diffResult.stdout.trim(), 10) || 0;
|
|
83439
83533
|
if (outgoingChanges === 0) {
|
|
83440
83534
|
return { success: true, message: "Nothing to push", changes: 0 };
|
|
83441
83535
|
}
|
|
83442
83536
|
let pushResult;
|
|
83443
83537
|
if (creds.usePlainGit) {
|
|
83444
|
-
pushResult = await runGitCommand(["push", gitConfig.remote, `HEAD:${gitConfig.branch}`],
|
|
83538
|
+
pushResult = await runGitCommand(["push", gitConfig.remote, `HEAD:${gitConfig.branch}`], AGENTS_DIR6);
|
|
83445
83539
|
} else if (creds.authUrl) {
|
|
83446
|
-
pushResult = await runGitCommand(["push", creds.authUrl, `HEAD:${gitConfig.branch}`],
|
|
83540
|
+
pushResult = await runGitCommand(["push", creds.authUrl, `HEAD:${gitConfig.branch}`], AGENTS_DIR6);
|
|
83447
83541
|
} else {
|
|
83448
83542
|
return {
|
|
83449
83543
|
success: false,
|
|
@@ -83520,16 +83614,16 @@ function stopGitSyncTimer() {
|
|
|
83520
83614
|
}
|
|
83521
83615
|
async function getGitStatus() {
|
|
83522
83616
|
const status = {
|
|
83523
|
-
isRepo: isGitRepo(
|
|
83617
|
+
isRepo: isGitRepo(AGENTS_DIR6),
|
|
83524
83618
|
hasCredentials: false,
|
|
83525
83619
|
autoSync: gitConfig.autoSync
|
|
83526
83620
|
};
|
|
83527
83621
|
if (!status.isRepo)
|
|
83528
83622
|
return status;
|
|
83529
|
-
const creds = await resolveGitCredentials(
|
|
83623
|
+
const creds = await resolveGitCredentials(AGENTS_DIR6, gitConfig.remote);
|
|
83530
83624
|
status.hasCredentials = creds.method !== "none" && creds.method !== "no-remote";
|
|
83531
83625
|
status.authMethod = creds.method;
|
|
83532
|
-
const branchResult = await runGitCommand(["rev-parse", "--abbrev-ref", "HEAD"],
|
|
83626
|
+
const branchResult = await runGitCommand(["rev-parse", "--abbrev-ref", "HEAD"], AGENTS_DIR6);
|
|
83533
83627
|
if (branchResult.code === 0) {
|
|
83534
83628
|
status.branch = branchResult.stdout.trim();
|
|
83535
83629
|
}
|
|
@@ -83537,17 +83631,17 @@ async function getGitStatus() {
|
|
|
83537
83631
|
if (lastGitSync) {
|
|
83538
83632
|
status.lastSync = lastGitSync.toISOString();
|
|
83539
83633
|
}
|
|
83540
|
-
const statusResult = await runGitCommand(["status", "--porcelain"],
|
|
83634
|
+
const statusResult = await runGitCommand(["status", "--porcelain"], AGENTS_DIR6);
|
|
83541
83635
|
if (statusResult.code === 0) {
|
|
83542
83636
|
status.uncommittedChanges = statusResult.stdout.trim().split(`
|
|
83543
83637
|
`).filter((l2) => l2.trim()).length;
|
|
83544
83638
|
}
|
|
83545
83639
|
if (status.hasCredentials) {
|
|
83546
|
-
const unpushedResult = await runGitCommand(["rev-list", "--count", `${gitConfig.remote}/${gitConfig.branch}..HEAD`],
|
|
83640
|
+
const unpushedResult = await runGitCommand(["rev-list", "--count", `${gitConfig.remote}/${gitConfig.branch}..HEAD`], AGENTS_DIR6);
|
|
83547
83641
|
if (unpushedResult.code === 0) {
|
|
83548
83642
|
status.unpushedCommits = Number.parseInt(unpushedResult.stdout.trim(), 10) || 0;
|
|
83549
83643
|
}
|
|
83550
|
-
const unpulledResult = await runGitCommand(["rev-list", "--count", `HEAD..${gitConfig.remote}/${gitConfig.branch}`],
|
|
83644
|
+
const unpulledResult = await runGitCommand(["rev-list", "--count", `HEAD..${gitConfig.remote}/${gitConfig.branch}`], AGENTS_DIR6);
|
|
83551
83645
|
if (unpulledResult.code === 0) {
|
|
83552
83646
|
status.unpulledCommits = Number.parseInt(unpulledResult.stdout.trim(), 10) || 0;
|
|
83553
83647
|
}
|
|
@@ -83614,12 +83708,12 @@ function scheduleAutoCommit(changedPath) {
|
|
|
83614
83708
|
commitPending = true;
|
|
83615
83709
|
const changes = [...pendingChanges];
|
|
83616
83710
|
pendingChanges = [];
|
|
83617
|
-
await gitAutoCommit(
|
|
83711
|
+
await gitAutoCommit(AGENTS_DIR6, changes);
|
|
83618
83712
|
commitPending = false;
|
|
83619
83713
|
}, COMMIT_DEBOUNCE_MS);
|
|
83620
83714
|
}
|
|
83621
83715
|
async function syncHarnessConfigs() {
|
|
83622
|
-
const agentsMdPath = join27(
|
|
83716
|
+
const agentsMdPath = join27(AGENTS_DIR6, "AGENTS.md");
|
|
83623
83717
|
if (!existsSync20(agentsMdPath))
|
|
83624
83718
|
return;
|
|
83625
83719
|
const rawContent = readFileSync16(agentsMdPath, "utf-8");
|
|
@@ -83633,7 +83727,7 @@ async function syncHarnessConfigs() {
|
|
|
83633
83727
|
{ name: "MEMORY.md", desc: "Working memory context" },
|
|
83634
83728
|
{ name: "agent.yaml", desc: "Configuration & settings" }
|
|
83635
83729
|
];
|
|
83636
|
-
const existingFiles = files.filter((f2) => existsSync20(join27(
|
|
83730
|
+
const existingFiles = files.filter((f2) => existsSync20(join27(AGENTS_DIR6, f2.name)));
|
|
83637
83731
|
const fileList = existingFiles.map((f2) => `# - ~/.agents/${f2.name} (${f2.desc})`).join(`
|
|
83638
83732
|
`);
|
|
83639
83733
|
return `# ${targetName}
|
|
@@ -83657,7 +83751,7 @@ ${fileList}
|
|
|
83657
83751
|
`;
|
|
83658
83752
|
};
|
|
83659
83753
|
const identityExtras = ["SOUL.md", "IDENTITY.md", "USER.md", "MEMORY.md"].map((name) => {
|
|
83660
|
-
const p2 = join27(
|
|
83754
|
+
const p2 = join27(AGENTS_DIR6, name);
|
|
83661
83755
|
if (!existsSync20(p2))
|
|
83662
83756
|
return "";
|
|
83663
83757
|
try {
|
|
@@ -83696,7 +83790,7 @@ ${c2}`;
|
|
|
83696
83790
|
ensureArchitectureDoc();
|
|
83697
83791
|
}
|
|
83698
83792
|
function ensureArchitectureDoc() {
|
|
83699
|
-
const archPath = join27(
|
|
83793
|
+
const archPath = join27(AGENTS_DIR6, "SIGNET-ARCHITECTURE.md");
|
|
83700
83794
|
try {
|
|
83701
83795
|
const archContent = buildArchitectureDoc();
|
|
83702
83796
|
const existing = existsSync20(archPath) ? readFileSync16(archPath, "utf-8") : "";
|
|
@@ -83725,14 +83819,14 @@ function scheduleSyncHarnessConfigs() {
|
|
|
83725
83819
|
}
|
|
83726
83820
|
function startFileWatcher() {
|
|
83727
83821
|
watcher = watch([
|
|
83728
|
-
join27(
|
|
83729
|
-
join27(
|
|
83730
|
-
join27(
|
|
83731
|
-
join27(
|
|
83732
|
-
join27(
|
|
83733
|
-
join27(
|
|
83734
|
-
join27(
|
|
83735
|
-
join27(
|
|
83822
|
+
join27(AGENTS_DIR6, "agent.yaml"),
|
|
83823
|
+
join27(AGENTS_DIR6, "AGENTS.md"),
|
|
83824
|
+
join27(AGENTS_DIR6, "SOUL.md"),
|
|
83825
|
+
join27(AGENTS_DIR6, "MEMORY.md"),
|
|
83826
|
+
join27(AGENTS_DIR6, "IDENTITY.md"),
|
|
83827
|
+
join27(AGENTS_DIR6, "USER.md"),
|
|
83828
|
+
join27(AGENTS_DIR6, "SIGNET-ARCHITECTURE.md"),
|
|
83829
|
+
join27(AGENTS_DIR6, "memory")
|
|
83736
83830
|
], {
|
|
83737
83831
|
persistent: true,
|
|
83738
83832
|
ignoreInitial: true,
|
|
@@ -84091,7 +84185,7 @@ async function ingestMemoryMarkdown(filePath) {
|
|
|
84091
84185
|
return inserted;
|
|
84092
84186
|
}
|
|
84093
84187
|
async function importExistingMemoryFiles() {
|
|
84094
|
-
const memoryDir = join27(
|
|
84188
|
+
const memoryDir = join27(AGENTS_DIR6, "memory");
|
|
84095
84189
|
if (!existsSync20(memoryDir)) {
|
|
84096
84190
|
logger.debug("daemon", "Memory directory does not exist, skipping initial import");
|
|
84097
84191
|
return 0;
|
|
@@ -84176,7 +84270,7 @@ process.on("uncaughtException", (err) => {
|
|
|
84176
84270
|
});
|
|
84177
84271
|
async function main() {
|
|
84178
84272
|
logger.info("daemon", "Signet Daemon starting");
|
|
84179
|
-
logger.info("daemon", "Agents directory", { path:
|
|
84273
|
+
logger.info("daemon", "Agents directory", { path: AGENTS_DIR6 });
|
|
84180
84274
|
logger.info("daemon", "Port configured", { port: PORT });
|
|
84181
84275
|
mkdirSync11(DAEMON_DIR, { recursive: true });
|
|
84182
84276
|
mkdirSync11(LOG_DIR, { recursive: true });
|
|
@@ -84186,7 +84280,7 @@ async function main() {
|
|
|
84186
84280
|
startFileWatcher();
|
|
84187
84281
|
logger.info("watcher", "File watcher started");
|
|
84188
84282
|
ensureArchitectureDoc();
|
|
84189
|
-
const memoryCfg = loadMemoryConfig(
|
|
84283
|
+
const memoryCfg = loadMemoryConfig(AGENTS_DIR6);
|
|
84190
84284
|
logger.info("config", "Resolved embedding config", {
|
|
84191
84285
|
provider: memoryCfg.embedding.provider,
|
|
84192
84286
|
model: memoryCfg.embedding.model,
|
|
@@ -84344,7 +84438,7 @@ async function main() {
|
|
|
84344
84438
|
const schedulerHandle = startSchedulerWorker(getDbAccessor());
|
|
84345
84439
|
checkpointPruneTimer = setInterval(() => {
|
|
84346
84440
|
try {
|
|
84347
|
-
const cfg = loadMemoryConfig(
|
|
84441
|
+
const cfg = loadMemoryConfig(AGENTS_DIR6).pipelineV2.continuity;
|
|
84348
84442
|
if (cfg.enabled) {
|
|
84349
84443
|
pruneCheckpoints(getDbAccessor(), cfg.retentionDays);
|
|
84350
84444
|
}
|
|
@@ -84355,7 +84449,7 @@ async function main() {
|
|
|
84355
84449
|
}
|
|
84356
84450
|
}, 3600000);
|
|
84357
84451
|
startGitSyncTimer();
|
|
84358
|
-
initUpdateSystem(CURRENT_VERSION,
|
|
84452
|
+
initUpdateSystem(CURRENT_VERSION, AGENTS_DIR6, () => {
|
|
84359
84453
|
const daemonScript = process.argv[1] ?? "";
|
|
84360
84454
|
if (!daemonScript) {
|
|
84361
84455
|
logger.warn("daemon", "Cannot self-restart: process.argv[1] is empty, falling back to clean exit");
|
|
@@ -84374,7 +84468,7 @@ async function main() {
|
|
|
84374
84468
|
env: {
|
|
84375
84469
|
...process.env,
|
|
84376
84470
|
SIGNET_PORT: String(PORT),
|
|
84377
|
-
SIGNET_PATH:
|
|
84471
|
+
SIGNET_PATH: AGENTS_DIR6
|
|
84378
84472
|
}
|
|
84379
84473
|
});
|
|
84380
84474
|
replacement.unref();
|
|
@@ -84383,7 +84477,7 @@ async function main() {
|
|
|
84383
84477
|
process.exit(0);
|
|
84384
84478
|
}, 500);
|
|
84385
84479
|
});
|
|
84386
|
-
initFeatureFlags(
|
|
84480
|
+
initFeatureFlags(AGENTS_DIR6);
|
|
84387
84481
|
startUpdateTimer();
|
|
84388
84482
|
serve({
|
|
84389
84483
|
fetch: app.fetch,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ba as be,o as Ne,s as A,g as U,b as T,Q as ee,bb as pt}from"./DRrAwi3T.js";class ke{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ee{constructor(t,n){this.status=t,this.location=n}}class Se extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function gt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function mt(e){return e.split("%25").map(decodeURI).join("%25")}function _t(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function de({href:e}){return e.split("#")[0]}function vt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function wt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function yt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const bt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&G.delete(Re(e)),bt(e,t));const G=new Map;function kt(e,t){const n=Re(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&G.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=yt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Et(e,t,n){if(G.size>0){const r=Re(e,n),a=G.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);G.delete(r)}}return window.fetch(t,n)}function Re(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${wt(...a)}"]`}return r}const St=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Rt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Lt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return he(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return he(String.fromCharCode(...l.slice(2).split("-").map(v=>parseInt(v,16))));const d=St.exec(l),[,p,f,u,h]=d;return t.push({name:u,matcher:h,optional:!!p,rest:!!f,chained:f?c===1&&s[0]==="":!1}),f?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return he(l)}).join("")}).join("")}/?$`),params:t}}function xt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Lt(e){return e.slice(1).split("/").filter(xt)}function At(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function he(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ut({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:f}=Rt(o),u={id:o,exec:h=>{const v=p.exec(h);if(v)return At(v,f,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Me(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function je(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_hdmqsa?.base??"",Tt=globalThis.__sveltekit_hdmqsa?.assets??x??"",Pt="1772814628184",He="sveltekit:snapshot",We="sveltekit:scroll",Je="sveltekit:states",It="sveltekit:pageurl",K="sveltekit:history",H="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},xe=location.origin;function Ye(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const qe={...N,"":N.hover};function ze(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Xe(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=ze(e)}}function me(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||ce(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===xe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function te(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=V(o,"preload-code")),a===null&&(a=V(o,"preload-data")),t===null&&(t=V(o,"keepfocus")),n===null&&(n=V(o,"noscroll")),i===null&&(i=V(o,"reload")),s===null&&(s=V(o,"replacestate")),o=ze(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:qe[r??"off"],preload_data:qe[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function De(e){const t=be(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const Qe={v:()=>{}};function Ot(){const{set:e,subscribe:t}=be(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Tt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==Pt;return s&&(e(!0),Qe.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function ce(e,t,n){return e.origin!==xe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function sn(e){}const Ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Ze];const Ct=new Set([...Ze]);[...Ct];function $t(e){return e.filter(t=>t!=null)}function Le(e){return e instanceof ke||e instanceof Se?e.status:500}function Nt(e){return e instanceof Se?e.text:"Internal Error"}let k,W,pe;const jt=Ne.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ne.toString());jt?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},pe={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},W=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},pe=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},Qe.v=()=>pe.current=!0);function qt(e){Object.assign(k,e)}const Ve={spanContext(){return Dt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Dt={traceId:"",spanId:"",traceFlags:0},Vt=new Set(["icon","shortcut icon","apple-touch-icon"]),$=Me(We)??{},J=Me(He)??{},C={url:De({}),page:De({}),navigating:be(null),updated:Ot()};function Ae(e){$[e]=q()}function Kt(e,t){let n=e+1;for(;$[n];)delete $[n],n+=1;for(n=t+1;J[n];)delete J[n],n+=1}function Y(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function et(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ke(){}let Ue,_e,ne,P,ve,w;const re=[],ae=[];let L=null;function we(){L?.fork?.then(e=>e?.discard()),L=null}const Z=new Map,tt=new Set,Bt=new Set,M=new Set;let _={branch:[],error:null,url:null},nt=!1,oe=!1,Be=!0,z=!1,F=!1,rt=!1,Te=!1,at,y,R,j;const se=new Set,Fe=new Map;async function fn(e,t,n){globalThis.__sveltekit_hdmqsa?.data&&globalThis.__sveltekit_hdmqsa.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),Ue=Ut(e),P=document.documentElement,ve=t,_e=e.nodes[0],ne=e.nodes[1],_e(),ne(),y=history.state?.[K],R=history.state?.[H],y||(y=R=Date.now(),history.replaceState({...history.state,[K]:y,[H]:R},""));const r=$[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await tn(ve,n)):(await B({type:"enter",url:Ye(w.hash?an(new URL(location.href)):location.href),replace_state:!0}),a()),en()}function Ft(){re.length=0,Te=!1}function ot(e){ae.some(t=>t?.snapshot)&&(J[e]=ae.map(t=>t?.snapshot?.capture()))}function st(e){J[e]?.forEach((t,n)=>{ae[n]?.snapshot?.restore(t)})}function Ge(){Ae(y),je(We,$),ot(R),je(He,J)}async function Gt(e,t,n,r){let a;t.invalidateAll&&we(),await B({type:"goto",url:Ye(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Te=!0,a=[...Fe.keys()]),t.invalidate&&t.invalidate.forEach(Zt)}}),t.invalidateAll&&ee().then(ee).then(()=>{Fe.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function Mt(e){if(e.id!==L?.id){we();const t={};se.add(t),L={id:e.id,token:t,promise:ct({...e,preload:t}).then(n=>(se.delete(t),n.type==="loaded"&&n.state.error&&we(),n)),fork:null}}return L.promise}async function ge(e){const t=(await ue(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}async function it(e,t,n){_=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(k,e.props.page),at=new w.root({target:t,props:{...e.props,stores:C,components:ae},hydrate:n,sync:!1}),await Promise.resolve(),st(R),n){const a={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:$[y]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};M.forEach(i=>i(a))}oe=!0}function ie({url:e,params:t,branch:n,status:r,error:a,route:i,form:s}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const u of n)u?.slash!==void 0&&(o=u.slash);e.pathname=gt(e.pathname,o),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:i},props:{constructors:$t(n).map(u=>u.node.component),page:$e(k)}};s!==void 0&&(l.props.form=s);let c={},d=!k,p=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const h=n[u],v=_.branch[u];h?.data!==v?.data&&(d=!0),h&&(c={...c,...h.data},d&&(l.props[`data_${p}`]=c),p+=1)}return(!_.url||e.href!==_.url.href||_.error!==a||s!==void 0&&s!==k.form||d)&&(l.props.page={error:a,params:t,route:{id:i?.id??null},state:{},status:r,url:new URL(e),form:s??null,data:d?c:k.data}),l}async function Pe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...f){for(const u of f){const{href:h}=new URL(u,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Ve,current:Ve},route:new Proxy(a,{get:(f,u)=>(o&&(l.route=!0),f[u])}),params:new Proxy(r,{get:(f,u)=>(o&&l.params.add(u),f[u])}),data:i?.data??null,url:vt(n,()=>{o&&(l.url=!0)},f=>{o&&l.search_params.add(f)},w.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:h,promise:v}=lt(f,u,n);return o&&d(h.href),v},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(f){o=!1;try{return f()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function lt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=oe?Et(r,a.href,t):kt(r,t);return{resolved:a,promise:i}}function Ht(e,t,n,r,a,i){if(Te)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==_.params[s])return!0;for(const s of a.dependencies)if(re.some(o=>o(new URL(s))))return!0;return!1}function Ie(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Wt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Jt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:$e(k),constructors:[]}}}async function ct({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return se.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(m=>m?.().catch(()=>{})),c.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==le(_.url):!1,p=_.route?a.id!==_.route.id:!1,f=Wt(_.url,n);let u=!1;const h=c.map(async(m,g)=>{if(!m)return;const E=_.branch[g];return m[1]===E?.loader&&!Ht(u,p,d,f,E.universal?.uses,r)?E:(u=!0,Pe({loader:m[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let O=0;O<g;O+=1)Object.assign(I,(await h[O])?.data);return I},server_data_node:Ie(m[0]?{type:"skip"}:null,m[0]?E?.server:void 0)}))});for(const m of h)m.catch(()=>{});const v=[];for(let m=0;m<c.length;m+=1)if(c[m])try{v.push(await h[m])}catch(g){if(g instanceof Ee)return{type:"redirect",location:g.location};if(se.has(i))return Jt({error:await X(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let E=Le(g),S;if(g instanceof ke)S=g.body;else{if(await C.updated.check())return await et(),await Y(n);S=await X(g,{params:r,url:n,route:{id:a.id}})}const I=await Yt(m,v,s);return I?ie({url:n,params:r,branch:v.slice(0,I.idx).concat(I.node),status:E,error:S,route:a}):await ft(n,{id:a.id},S,E)}else v.push(void 0);return ie({url:n,params:r,branch:v,status:200,error:null,route:a,form:t?void 0:null})}async function Yt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Oe({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await Pe({loader:_e,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ie(i)}),o={node:await ne(),loader:ne,universal:null,server:null,data:null};return ie({url:n,params:a,branch:[s,o],status:e,error:t,route:null})}catch(s){if(s instanceof Ee)return Gt(new URL(s.location,location.href),{},0);throw s}}async function zt(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const r=(async()=>{let a=await w.hooks.reroute({url:new URL(e),fetch:async(i,s)=>lt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);w.hash?i.hash=a:i.pathname=a,a=i}return a})();Z.set(t,r),n=await r}catch{Z.delete(t);return}return n}async function ue(e,t){if(e&&!ce(e,x,w.hash)){const n=await zt(e);if(!n)return;const r=Xt(n);for(const a of Ue){const i=a.exec(r);if(i)return{id:le(e),invalidating:t,route:a,params:_t(i),url:e}}}}function Xt(e){return mt(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function le(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function ut({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ce(_,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return z||tt.forEach(c=>c(l)),s?null:o}async function B({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Ke,block:d=Ke,event:p}){const f=j;j=l;const u=await ue(t,!1),h=e==="enter"?Ce(_,u,t,e):ut({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:p});if(!h){d(),j===l&&(j=f);return}const v=y,m=R;c(),z=!0,oe&&h.navigation.type!=="enter"&&C.navigating.set(W.current=h.navigation);let g=u&&await ct(u);if(!g){if(ce(t,x,w.hash))return await Y(t,i);g=await ft(t,{id:null},await X(new Se(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,j!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await B({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Oe({status:500,error:await X(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await C.updated.check()&&(await et(),await Y(t,i));if(Ft(),Ae(v),ot(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const b=i?0:1,Q={[K]:y+=b,[H]:R+=b,[Je]:s};(i?history.replaceState:history.pushState).call(history,Q,"",t),i||Kt(y,R)}const E=u&&L?.id===u.id?L.fork:null;L=null,g.props.page.state=s;let S;if(oe){const b=(await Promise.all(Array.from(Bt,D=>D(h.navigation)))).filter(D=>typeof D=="function");if(b.length>0){let D=function(){b.forEach(fe=>{M.delete(fe)})};b.push(D),b.forEach(fe=>{M.add(fe)})}_=g.state,g.props.page&&(g.props.page.url=t);const Q=E&&await E;Q?S=Q.commit():(at.$set(g.props),qt(g.props.page),S=pt?.()),rt=!0}else await it(g,ve,!1);const{activeElement:I}=document;await S,await ee(),await ee();let O=null;if(Be){const b=n?n.scroll:a?q():null;b?scrollTo(b.x,b.y):(O=t.hash&&document.getElementById(dt(t)))?O.scrollIntoView():scrollTo(0,0)}const ht=document.activeElement!==I&&document.activeElement!==document.body;!r&&!ht&&rn(t,!O),Be=!0,g.props.page&&Object.assign(k,g.props.page),z=!1,e==="popstate"&&st(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=q()),M.forEach(b=>b(h.navigation)),C.navigating.set(W.current=null)}async function ft(e,t,n,r,a){return e.origin===xe&&e.pathname===location.pathname&&!nt?await Oe({status:r,error:n,url:e,route:t}):await Y(e,a)}function Qt(){let e,t={element:void 0,href:void 0},n;P.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}P.addEventListener("mousedown",r),P.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(ge(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=Xe(o,P),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:f,download:u}=me(c,x,w.hash);if(f||u)return;const h=te(c),v=p&&le(_.url)===le(p);if(!(h.reload||v))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const m=await ue(p,!1);if(!m)return;Mt(m)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,ge(p))}function s(){a.disconnect();for(const o of P.querySelectorAll("a")){const{url:l,external:c,download:d}=me(o,x,w.hash);if(c||d)continue;const p=te(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&ge(l))}}M.add(s),s()}function X(e,t){if(e instanceof ke)return e.body;const n=Le(e),r=Nt(e);return w.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Zt(e){if(typeof e=="function")re.push(e);else{const{href:t}=new URL(e,location.href);re.push(n=>n.href===t)}}function en(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Ge(),!z){const r=Ce(_,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};tt.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ge()}),navigator.connection?.saveData||Qt(),P.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Xe(t.composedPath()[0],P);if(!n)return;const{url:r,external:a,target:i,download:s}=me(n,x,w.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=te(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(w.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===de(location);if(a||o.reload&&(!p||!d)){ut({url:r,type:"link",event:t})?z=!0:t.preventDefault();return}if(d!==void 0&&p){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(F=!0,Ae(y),e(r),!o.replace_state)return;F=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await B({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),P.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ce(s,x,!1))return;const o=t.target,l=te(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),B({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ye){if(t.state?.[K]){const n=t.state[K];if(j={},n===y)return;const r=$[n],a=t.state[Je]??{},i=new URL(t.state[It]??location.href),s=t.state[H],o=_.url?de(location)===de(_.url):!1;if(s===R&&(rt||o)){a!==k.state&&(k.state=a),e(i),$[y]=q(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await B({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:j,event:t})}else if(!F){const n=new URL(location.href);e(n),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[K]:++y,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Vt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&C.navigating.set(W.current=null)});function e(t){_.url=k.url=t,C.page.set($e(k)),C.page.notify()}}async function tn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){nt=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await ue(c,!1)||{}),d=Ue.find(({id:u})=>u===i.id);let p,f=!0;try{const u=r.map(async(v,m)=>{const g=o[m];return g?.uses&&(g.uses=nn(g.uses)),Pe({loader:w.nodes[v],url:c,params:a,route:i,parent:async()=>{const E={};for(let S=0;S<m;S+=1)Object.assign(E,(await u[S]).data);return E},server_data_node:Ie(g)})}),h=await Promise.all(u);if(d){const v=d.layouts;for(let m=0;m<v.length;m++)v[m]||h.splice(m,0,void 0)}p=ie({url:c,params:a,branch:h,status:t,error:n,form:l,route:d??null})}catch(u){if(u instanceof Ee){await Y(new URL(u.location,location.href));return}p=await Oe({status:Le(u),error:await X(u,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",f=!1}p.props.page&&(p.props.page.state={}),await it(p,e,f)}function nn(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let ye=!1;function rn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=dt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;ye=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),ye=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ce(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function $e(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function an(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function dt(e){let t;if(w.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{fn as a,sn as l,k as p,C as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as o,a as r}from"../chunks/D5aO9ubX.js";export{o as load_css,r as start};
|