@signetai/connector-pi 0.147.21 → 0.147.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension-bundle.d.ts +1 -1
- package/dist/index.js +85 -85
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname as dirname6, join as join6 } from "node:path";
|
|
|
4
4
|
|
|
5
5
|
// ../../../libs/connector-base/dist/index.js
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
7
|
-
import { existsSync, readFileSync, renameSync, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
7
|
+
import { existsSync, readFileSync, renameSync, statSync, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { dirname as dirname2, join as join3, resolve } from "node:path";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
@@ -22100,7 +22100,7 @@ var CODE_EXTS2 = new Set([
|
|
|
22100
22100
|
var SKIP_FILES2 = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules", ".git", ".env", ".env.local"]);
|
|
22101
22101
|
|
|
22102
22102
|
// src/extension-bundle.ts
|
|
22103
|
-
var EXTENSION_BUNDLE = `var j9=Object.defineProperty;var R9=(Z)=>Z;function S9(Z,X){this[Z]=R9.bind(null,X)}var m6=(Z,X)=>{for(var z in X)j9(Z,z,{get:X[z],enumerable:!0,configurable:!0,set:S9.bind(X,z)})};import{existsSync as fJ,readFileSync as bJ}from"node:fs";import{join as xJ}from"node:path";import{createRequire as C9}from"node:module";import{dirname as
|
|
22103
|
+
var EXTENSION_BUNDLE = `var j9=Object.defineProperty;var R9=(Z)=>Z;function S9(Z,X){this[Z]=R9.bind(null,X)}var m6=(Z,X)=>{for(var z in X)j9(Z,z,{get:X[z],enumerable:!0,configurable:!0,set:S9.bind(X,z)})};import{existsSync as fJ,readFileSync as bJ}from"node:fs";import{join as xJ}from"node:path";import{createRequire as C9}from"node:module";import{dirname as Uz,join as ZY}from"node:path";import{fileURLToPath as Gz}from"node:url";import{createRequire as LQ}from"node:module";import{homedir as l6,platform as FQ}from"node:os";import{basename as BY,dirname as UY,resolve as L8}from"node:path";import{existsSync as s8,readFileSync as Q5,readdirSync as AY,realpathSync as LY,statSync as DY}from"node:fs";import{dirname as FY,join as W5}from"node:path";import{existsSync as jQ,mkdirSync as KY,readFileSync as RQ,rmSync as jY,writeFileSync as RY}from"node:fs";import{homedir as D8}from"node:os";import{dirname as EY,join as O8,resolve as SQ}from"node:path";import{homedir as yQ}from"node:os";var{create:E9,getPrototypeOf:I9,defineProperty:y5,getOwnPropertyNames:T9}=Object,P9=Object.prototype.hasOwnProperty;function w9(Z){return this[Z]}var k9,f9,r5=(Z,X,z)=>{var W=Z!=null&&typeof Z==="object";if(W){var Y=X?k9??=new WeakMap:f9??=new WeakMap,q=Y.get(Z);if(q)return q}z=Z!=null?E9(I9(Z)):{};let B=X||!Z||!Z.__esModule?y5(z,"default",{value:Z,enumerable:!0}):z;for(let U of T9(Z))if(!P9.call(B,U))y5(B,U,{get:w9.bind(Z,U),enumerable:!0});if(W)Y.set(Z,B);return B},w=(Z,X)=>()=>(X||Z((X={exports:{}}).exports,X),X.exports),a8=C9(import.meta.url),u=w((Z)=>{var X=Symbol.for("yaml.alias"),z=Symbol.for("yaml.document"),W=Symbol.for("yaml.map"),Y=Symbol.for("yaml.pair"),q=Symbol.for("yaml.scalar"),B=Symbol.for("yaml.seq"),U=Symbol.for("yaml.node.type"),G=(L)=>!!L&&typeof L==="object"&&L[U]===X,H=(L)=>!!L&&typeof L==="object"&&L[U]===z,_=(L)=>!!L&&typeof L==="object"&&L[U]===W,$=(L)=>!!L&&typeof L==="object"&&L[U]===Y,Q=(L)=>!!L&&typeof L==="object"&&L[U]===q,J=(L)=>!!L&&typeof L==="object"&&L[U]===B;function V(L){if(L&&typeof L==="object")switch(L[U]){case W:case B:return!0}return!1}function M(L){if(L&&typeof L==="object")switch(L[U]){case X:case W:case q:case B:return!0}return!1}var A=(L)=>(Q(L)||V(L))&&!!L.anchor;Z.ALIAS=X,Z.DOC=z,Z.MAP=W,Z.NODE_TYPE=U,Z.PAIR=Y,Z.SCALAR=q,Z.SEQ=B,Z.hasAnchor=A,Z.isAlias=G,Z.isCollection=V,Z.isDocument=H,Z.isMap=_,Z.isNode=M,Z.isPair=$,Z.isScalar=Q,Z.isSeq=J}),r8=w((Z)=>{var X=u(),z=Symbol("break visit"),W=Symbol("skip children"),Y=Symbol("remove node");function q(Q,J){let V=H(J);if(X.isDocument(Q)){if(B(null,Q.contents,V,Object.freeze([Q]))===Y)Q.contents=null}else B(null,Q,V,Object.freeze([]))}q.BREAK=z,q.SKIP=W,q.REMOVE=Y;function B(Q,J,V,M){let A=_(Q,J,V,M);if(X.isNode(A)||X.isPair(A))return $(Q,M,A),B(Q,A,V,M);if(typeof A!=="symbol"){if(X.isCollection(J)){M=Object.freeze(M.concat(J));for(let L=0;L<J.items.length;++L){let D=B(L,J.items[L],V,M);if(typeof D==="number")L=D-1;else if(D===z)return z;else if(D===Y)J.items.splice(L,1),L-=1}}else if(X.isPair(J)){M=Object.freeze(M.concat(J));let L=B("key",J.key,V,M);if(L===z)return z;else if(L===Y)J.key=null;let D=B("value",J.value,V,M);if(D===z)return z;else if(D===Y)J.value=null}}return A}async function U(Q,J){let V=H(J);if(X.isDocument(Q)){if(await G(null,Q.contents,V,Object.freeze([Q]))===Y)Q.contents=null}else await G(null,Q,V,Object.freeze([]))}U.BREAK=z,U.SKIP=W,U.REMOVE=Y;async function G(Q,J,V,M){let A=await _(Q,J,V,M);if(X.isNode(A)||X.isPair(A))return $(Q,M,A),G(Q,A,V,M);if(typeof A!=="symbol"){if(X.isCollection(J)){M=Object.freeze(M.concat(J));for(let L=0;L<J.items.length;++L){let D=await G(L,J.items[L],V,M);if(typeof D==="number")L=D-1;else if(D===z)return z;else if(D===Y)J.items.splice(L,1),L-=1}}else if(X.isPair(J)){M=Object.freeze(M.concat(J));let L=await G("key",J.key,V,M);if(L===z)return z;else if(L===Y)J.key=null;let D=await G("value",J.value,V,M);if(D===z)return z;else if(D===Y)J.value=null}}return A}function H(Q){if(typeof Q==="object"&&(Q.Collection||Q.Node||Q.Value))return Object.assign({Alias:Q.Node,Map:Q.Node,Scalar:Q.Node,Seq:Q.Node},Q.Value&&{Map:Q.Value,Scalar:Q.Value,Seq:Q.Value},Q.Collection&&{Map:Q.Collection,Seq:Q.Collection},Q);return Q}function _(Q,J,V,M){if(typeof V==="function")return V(Q,J,M);if(X.isMap(J))return V.Map?.(Q,J,M);if(X.isSeq(J))return V.Seq?.(Q,J,M);if(X.isPair(J))return V.Pair?.(Q,J,M);if(X.isScalar(J))return V.Scalar?.(Q,J,M);if(X.isAlias(J))return V.Alias?.(Q,J,M);return}function $(Q,J,V){let M=J[J.length-1];if(X.isCollection(M))M.items[Q]=V;else if(X.isPair(M))if(Q==="key")M.key=V;else M.value=V;else if(X.isDocument(M))M.contents=V;else{let A=X.isAlias(M)?"alias":"scalar";throw Error(\`Cannot replace node with \${A} parent\`)}}Z.visit=q,Z.visitAsync=U}),t5=w((Z)=>{var X=u(),z=r8(),W={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Y=(B)=>B.replace(/[!,[\\]{}]/g,(U)=>W[U]);class q{constructor(B,U){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},q.defaultYaml,B),this.tags=Object.assign({},q.defaultTags,U)}clone(){let B=new q(this.yaml,this.tags);return B.docStart=this.docStart,B}atDocument(){let B=new q(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:q.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},q.defaultTags);break}return B}add(B,U){if(this.atNextDocument)this.yaml={explicit:q.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},q.defaultTags),this.atNextDocument=!1;let G=B.trim().split(/[ \\t]+/),H=G.shift();switch(H){case"%TAG":{if(G.length!==2){if(U(0,"%TAG directive should contain exactly two parts"),G.length<2)return!1}let[_,$]=G;return this.tags[_]=$,!0}case"%YAML":{if(this.yaml.explicit=!0,G.length!==1)return U(0,"%YAML directive should contain exactly one part"),!1;let[_]=G;if(_==="1.1"||_==="1.2")return this.yaml.version=_,!0;else{let $=/^\\d+\\.\\d+$/.test(_);return U(6,\`Unsupported YAML version \${_}\`,$),!1}}default:return U(0,\`Unknown directive \${H}\`,!0),!1}}tagName(B,U){if(B==="!")return"!";if(B[0]!=="!")return U(\`Not a valid tag: \${B}\`),null;if(B[1]==="<"){let $=B.slice(2,-1);if($==="!"||$==="!!")return U(\`Verbatim tags aren't resolved, so \${B} is invalid.\`),null;if(B[B.length-1]!==">")U("Verbatim tags must end with a >");return $}let[,G,H]=B.match(/^(.*!)([^!]*)$/s);if(!H)U(\`The \${B} tag has no suffix\`);let _=this.tags[G];if(_)try{return _+decodeURIComponent(H)}catch($){return U(String($)),null}if(G==="!")return B;return U(\`Could not resolve tag: \${B}\`),null}tagString(B){for(let[U,G]of Object.entries(this.tags))if(B.startsWith(G))return U+Y(B.substring(G.length));return B[0]==="!"?B:\`!<\${B}>\`}toString(B){let U=this.yaml.explicit?[\`%YAML \${this.yaml.version||"1.2"}\`]:[],G=Object.entries(this.tags),H;if(B&&G.length>0&&X.isNode(B.contents)){let _={};z.visit(B.contents,($,Q)=>{if(X.isNode(Q)&&Q.tag)_[Q.tag]=!0}),H=Object.keys(_)}else H=[];for(let[_,$]of G){if(_==="!!"&&$==="tag:yaml.org,2002:")continue;if(!B||H.some((Q)=>Q.startsWith($)))U.push(\`%TAG \${_} \${$}\`)}return U.join(\`
|
|
22104
22104
|
\`)}}q.defaultYaml={explicit:!1,version:"1.2"},q.defaultTags={"!!":"tag:yaml.org,2002:"},Z.Directives=q}),o6=w((Z)=>{var X=u(),z=r8();function W(U){if(/[\\x00-\\x19\\s,[\\]{}]/.test(U)){let H=\`Anchor must not contain whitespace or control characters: \${JSON.stringify(U)}\`;throw Error(H)}return!0}function Y(U){let G=new Set;return z.visit(U,{Value(H,_){if(_.anchor)G.add(_.anchor)}}),G}function q(U,G){for(let H=1;;++H){let _=\`\${U}\${H}\`;if(!G.has(_))return _}}function B(U,G){let H=[],_=new Map,$=null;return{onAnchor:(Q)=>{H.push(Q),$??($=Y(U));let J=q(G,$);return $.add(J),J},setAnchors:()=>{for(let Q of H){let J=_.get(Q);if(typeof J==="object"&&J.anchor&&(X.isScalar(J.node)||X.isCollection(J.node)))J.node.anchor=J.anchor;else{let V=Error("Failed to resolve repeated object (this should not happen)");throw V.source=Q,V}}},sourceObjects:_}}Z.anchorIsValid=W,Z.anchorNames=Y,Z.createNodeAnchors=B,Z.findNewAnchor=q}),e5=w((Z)=>{function X(z,W,Y,q){if(q&&typeof q==="object")if(Array.isArray(q))for(let B=0,U=q.length;B<U;++B){let G=q[B],H=X(z,q,String(B),G);if(H===void 0)delete q[B];else if(H!==G)q[B]=H}else if(q instanceof Map)for(let B of Array.from(q.keys())){let U=q.get(B),G=X(z,q,B,U);if(G===void 0)q.delete(B);else if(G!==U)q.set(B,G)}else if(q instanceof Set)for(let B of Array.from(q)){let U=X(z,q,B,B);if(U===void 0)q.delete(B);else if(U!==B)q.delete(B),q.add(U)}else for(let[B,U]of Object.entries(q)){let G=X(z,q,B,U);if(G===void 0)delete q[B];else if(G!==U)q[B]=G}return z.call(W,Y,q)}Z.applyReviver=X}),xZ=w((Z)=>{var X=u();function z(W,Y,q){if(Array.isArray(W))return W.map((B,U)=>z(B,String(U),q));if(W&&typeof W.toJSON==="function"){if(!q||!X.hasAnchor(W))return W.toJSON(Y,q);let B={aliasCount:0,count:1,res:void 0};q.anchors.set(W,B),q.onCreate=(G)=>{B.res=G,delete q.onCreate};let U=W.toJSON(Y,q);if(q.onCreate)q.onCreate(U);return U}if(typeof W==="bigint"&&!q?.keep)return Number(W);return W}Z.toJS=z}),s6=w((Z)=>{var X=e5(),z=u(),W=xZ();class Y{constructor(q){Object.defineProperty(this,z.NODE_TYPE,{value:q})}clone(){let q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)q.range=this.range.slice();return q}toJS(q,{mapAsMap:B,maxAliasCount:U,onAnchor:G,reviver:H}={}){if(!z.isDocument(q))throw TypeError("A document argument is required");let _={anchors:new Map,doc:q,keep:!0,mapAsMap:B===!0,mapKeyWarned:!1,maxAliasCount:typeof U==="number"?U:100},$=W.toJS(this,"",_);if(typeof G==="function")for(let{count:Q,res:J}of _.anchors.values())G(J,Q);return typeof H==="function"?X.applyReviver(H,{"":$},"",$):$}}Z.NodeBase=Y}),t8=w((Z)=>{var X=o6(),z=r8(),W=u(),Y=s6(),q=xZ();class B extends Y.NodeBase{constructor(G){super(W.ALIAS);this.source=G,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(G,H){let _;if(H?.aliasResolveCache)_=H.aliasResolveCache;else if(_=[],z.visit(G,{Node:(Q,J)=>{if(W.isAlias(J)||W.hasAnchor(J))_.push(J)}}),H)H.aliasResolveCache=_;let $=void 0;for(let Q of _){if(Q===this)break;if(Q.anchor===this.source)$=Q}return $}toJSON(G,H){if(!H)return{source:this.source};let{anchors:_,doc:$,maxAliasCount:Q}=H,J=this.resolve($,H);if(!J){let M=\`Unresolved alias (the anchor must be set before the alias): \${this.source}\`;throw ReferenceError(M)}let V=_.get(J);if(!V)q.toJS(J,null,H),V=_.get(J);if(V?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(Q>=0){if(V.count+=1,V.aliasCount===0)V.aliasCount=U($,J,_);if(V.count*V.aliasCount>Q)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return V.res}toString(G,H,_){let $=\`*\${this.source}\`;if(G){if(X.anchorIsValid(this.source),G.options.verifyAliasOrder&&!G.anchors.has(this.source)){let Q=\`Unresolved alias (the anchor must be set before the alias): \${this.source}\`;throw Error(Q)}if(G.implicitKey)return\`\${$} \`}return $}}function U(G,H,_){if(W.isAlias(H)){let $=H.resolve(G),Q=_&&$&&_.get($);return Q?Q.count*Q.aliasCount:0}else if(W.isCollection(H)){let $=0;for(let Q of H.items){let J=U(G,Q,_);if(J>$)$=J}return $}else if(W.isPair(H)){let $=U(G,H.key,_),Q=U(G,H.value,_);return Math.max($,Q)}return 1}Z.Alias=B}),q0=w((Z)=>{var X=u(),z=s6(),W=xZ(),Y=(B)=>!B||typeof B!=="function"&&typeof B!=="object";class q extends z.NodeBase{constructor(B){super(X.SCALAR);this.value=B}toJSON(B,U){return U?.keep?this.value:W.toJS(this.value,B,U)}toString(){return String(this.value)}}q.BLOCK_FOLDED="BLOCK_FOLDED",q.BLOCK_LITERAL="BLOCK_LITERAL",q.PLAIN="PLAIN",q.QUOTE_DOUBLE="QUOTE_DOUBLE",q.QUOTE_SINGLE="QUOTE_SINGLE",Z.Scalar=q,Z.isScalarValue=Y}),e8=w((Z)=>{var X=t8(),z=u(),W=q0(),Y="tag:yaml.org,2002:";function q(U,G,H){if(G){let _=H.filter((Q)=>Q.tag===G),$=_.find((Q)=>!Q.format)??_[0];if(!$)throw Error(\`Tag \${G} not found\`);return $}return H.find((_)=>_.identify?.(U)&&!_.format)}function B(U,G,H){if(z.isDocument(U))U=U.contents;if(z.isNode(U))return U;if(z.isPair(U)){let D=H.schema[z.MAP].createNode?.(H.schema,null,H);return D.items.push(U),D}if(U instanceof String||U instanceof Number||U instanceof Boolean||typeof BigInt<"u"&&U instanceof BigInt)U=U.valueOf();let{aliasDuplicateObjects:_,onAnchor:$,onTagObj:Q,schema:J,sourceObjects:V}=H,M=void 0;if(_&&U&&typeof U==="object")if(M=V.get(U),M)return M.anchor??(M.anchor=$(U)),new X.Alias(M.anchor);else M={anchor:null,node:null},V.set(U,M);if(G?.startsWith("!!"))G=Y+G.slice(2);let A=q(U,G,J.tags);if(!A){if(U&&typeof U.toJSON==="function")U=U.toJSON();if(!U||typeof U!=="object"){let D=new W.Scalar(U);if(M)M.node=D;return D}A=U instanceof Map?J[z.MAP]:(Symbol.iterator in Object(U))?J[z.SEQ]:J[z.MAP]}if(Q)Q(A),delete H.onTagObj;let L=A?.createNode?A.createNode(H.schema,U,H):typeof A?.nodeClass?.from==="function"?A.nodeClass.from(H.schema,U,H):new W.Scalar(U);if(G)L.tag=G;else if(!A.default)L.tag=A.tag;if(M)M.node=L;return L}Z.createNode=B}),a6=w((Z)=>{var X=e8(),z=u(),W=s6();function Y(U,G,H){let _=H;for(let $=G.length-1;$>=0;--$){let Q=G[$];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let J=[];J[Q]=_,_=J}else _=new Map([[Q,_]])}return X.createNode(_,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:U,sourceObjects:new Map})}var q=(U)=>U==null||typeof U==="object"&&!!U[Symbol.iterator]().next().done;class B extends W.NodeBase{constructor(U,G){super(U);Object.defineProperty(this,"schema",{value:G,configurable:!0,enumerable:!1,writable:!0})}clone(U){let G=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(U)G.schema=U;if(G.items=G.items.map((H)=>z.isNode(H)||z.isPair(H)?H.clone(U):H),this.range)G.range=this.range.slice();return G}addIn(U,G){if(q(U))this.add(G);else{let[H,..._]=U,$=this.get(H,!0);if(z.isCollection($))$.addIn(_,G);else if($===void 0&&this.schema)this.set(H,Y(this.schema,_,G));else throw Error(\`Expected YAML collection at \${H}. Remaining path: \${_}\`)}}deleteIn(U){let[G,...H]=U;if(H.length===0)return this.delete(G);let _=this.get(G,!0);if(z.isCollection(_))return _.deleteIn(H);else throw Error(\`Expected YAML collection at \${G}. Remaining path: \${H}\`)}getIn(U,G){let[H,..._]=U,$=this.get(H,!0);if(_.length===0)return!G&&z.isScalar($)?$.value:$;else return z.isCollection($)?$.getIn(_,G):void 0}hasAllNullValues(U){return this.items.every((G)=>{if(!z.isPair(G))return!1;let H=G.value;return H==null||U&&z.isScalar(H)&&H.value==null&&!H.commentBefore&&!H.comment&&!H.tag})}hasIn(U){let[G,...H]=U;if(H.length===0)return this.has(G);let _=this.get(G,!0);return z.isCollection(_)?_.hasIn(H):!1}setIn(U,G){let[H,..._]=U;if(_.length===0)this.set(H,G);else{let $=this.get(H,!0);if(z.isCollection($))$.setIn(_,G);else if($===void 0&&this.schema)this.set(H,Y(this.schema,_,G));else throw Error(\`Expected YAML collection at \${H}. Remaining path: \${_}\`)}}}Z.Collection=B,Z.collectionFromPath=Y,Z.isEmptyPath=q}),Z6=w((Z)=>{var X=(Y)=>Y.replace(/^(?!$)(?: $)?/gm,"#");function z(Y,q){if(/^\\n+$/.test(Y))return Y.substring(1);return q?Y.replace(/^(?! *$)/gm,q):Y}var W=(Y,q,B)=>Y.endsWith(\`
|
|
22105
22105
|
\`)?z(B,q):B.includes(\`
|
|
22106
22106
|
\`)?\`
|
|
@@ -22238,12 +22238,14 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22238
22238
|
\`)+1;while(Q!==0)this.onNewLine(this.offset+Q),Q=this.source.indexOf(\`
|
|
22239
22239
|
\`,Q)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Q=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Q.value){let J="end"in Q.value?Q.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"space":case"comment":if(Q.value)$.items.push({start:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else{if(this.atIndentedComment(Q.start,$.indent)){let V=$.items[$.items.length-2]?.value?.end;if(Array.isArray(V)){Array.prototype.push.apply(V,Q.start),V.push(this.sourceToken),$.items.pop();return}}Q.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let J=!this.onKeyLine&&this.indent===$.indent,V=J&&(Q.sep||Q.explicitKey)&&this.type!=="seq-item-ind",M=[];if(V&&Q.sep&&!Q.value){let A=[];for(let L=0;L<Q.sep.length;++L){let D=Q.sep[L];switch(D.type){case"newline":A.push(L);break;case"space":break;case"comment":if(D.indent>$.indent)A.length=0;break;default:A.length=0}}if(A.length>=2)M=Q.sep.splice(A[1])}switch(this.type){case"anchor":case"tag":if(V||Q.value)M.push(this.sourceToken),$.items.push({start:M}),this.onKeyLine=!0;else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Q.sep&&!Q.explicitKey)Q.start.push(this.sourceToken),Q.explicitKey=!0;else if(V||Q.value)M.push(this.sourceToken),$.items.push({start:M,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Q.explicitKey)if(!Q.sep)if(Y(Q.start,"newline"))Object.assign(Q,{key:null,sep:[this.sourceToken]});else{let A=G(Q.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:A,key:null,sep:[this.sourceToken]}]})}else if(Q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Y(Q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:M,key:null,sep:[this.sourceToken]}]});else if(B(Q.key)&&!Y(Q.sep,"newline")){let A=G(Q.start),L=Q.key,D=Q.sep;D.push(this.sourceToken),delete Q.key,delete Q.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:A,key:L,sep:D}]})}else if(M.length>0)Q.sep=Q.sep.concat(M,this.sourceToken);else Q.sep.push(this.sourceToken);else if(!Q.sep)Object.assign(Q,{key:null,sep:[this.sourceToken]});else if(Q.value||V)$.items.push({start:M,key:null,sep:[this.sourceToken]});else if(Y(Q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Q.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let A=this.flowScalar(this.type);if(V||Q.value)$.items.push({start:M,key:A,sep:[]}),this.onKeyLine=!0;else if(Q.sep)this.stack.push(A);else Object.assign(Q,{key:A,sep:[]}),this.onKeyLine=!0;return}default:{let A=this.startBlockValue($);if(A){if(A.type==="block-seq"){if(!Q.explicitKey&&Q.sep&&!Y(Q.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(J)$.items.push({start:M});this.stack.push(A);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Q=$.items[$.items.length-1];switch(this.type){case"newline":if(Q.value){let J="end"in Q.value?Q.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Q.start.push(this.sourceToken);return;case"space":case"comment":if(Q.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Q.start,$.indent)){let V=$.items[$.items.length-2]?.value?.end;if(Array.isArray(V)){Array.prototype.push.apply(V,Q.start),V.push(this.sourceToken),$.items.pop();return}}Q.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Q.value||this.indent<=$.indent)break;Q.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Q.value||Y(Q.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Q.start.push(this.sourceToken);return}if(this.indent>$.indent){let J=this.startBlockValue($);if(J){this.stack.push(J);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Q=$.items[$.items.length-1];if(this.type==="flow-error-end"){let J;do yield*this.pop(),J=this.peek(1);while(J?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Q||Q.sep)$.items.push({start:[this.sourceToken]});else Q.start.push(this.sourceToken);return;case"map-value-ind":if(!Q||Q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else Object.assign(Q,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Q||Q.value)$.items.push({start:[this.sourceToken]});else if(Q.sep)Q.sep.push(this.sourceToken);else Q.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let V=this.flowScalar(this.type);if(!Q||Q.value)$.items.push({start:[],key:V,sep:[]});else if(Q.sep)this.stack.push(V);else Object.assign(Q,{key:V,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let J=this.startBlockValue($);if(J)this.stack.push(J);else yield*this.pop(),yield*this.step()}else{let J=this.peek(2);if(J.type==="block-map"&&(this.type==="map-value-ind"&&J.indent===$.indent||this.type==="newline"&&!J.items[J.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&J.type!=="flow-collection"){let V=U(J),M=G(V);H($);let A=$.end.splice(1,$.end.length);A.push(this.sourceToken);let L={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:M,key:$,sep:A}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=L}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Q=this.source.indexOf(\`
|
|
22240
22240
|
\`)+1;while(Q!==0)this.onNewLine(this.offset+Q),Q=this.source.indexOf(\`
|
|
22241
|
-
\`,Q)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Q=U($),J=G(Q);return J.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Q=U($),J=G(Q);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Q){if(this.type!=="comment")return!1;if(this.indent<=Q)return!1;return $.every((J)=>J.type==="newline"||J.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Z.Parser=_}),Xz=w((Z)=>{var X=M7(),z=Q6(),W=W6(),Y=Z7(),q=u(),B=L7(),U=D7();function G(J){let V=J.prettyErrors!==!1;return{lineCounter:J.lineCounter||V&&new B.LineCounter||null,prettyErrors:V}}function H(J,V={}){let{lineCounter:M,prettyErrors:A}=G(V),L=new U.Parser(M?.addNewLine),D=new X.Composer(V),F=Array.from(D.compose(L.parse(J)));if(A&&M)for(let j of F)j.errors.forEach(W.prettifyError(J,M)),j.warnings.forEach(W.prettifyError(J,M));if(F.length>0)return F;return Object.assign([],{empty:!0},D.streamInfo())}function _(J,V={}){let{lineCounter:M,prettyErrors:A}=G(V),L=new U.Parser(M?.addNewLine),D=new X.Composer(V),F=null;for(let j of D.compose(L.parse(J),!0,J.length))if(!F)F=j;else if(F.options.logLevel!=="silent"){F.errors.push(new W.YAMLParseError(j.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(A&&M)F.errors.forEach(W.prettifyError(J,M)),F.warnings.forEach(W.prettifyError(J,M));return F}function $(J,V,M){let A=void 0;if(typeof V==="function")A=V;else if(M===void 0&&V&&typeof V==="object")M=V;let L=_(J,M);if(!L)return null;if(L.warnings.forEach((D)=>Y.warn(L.options.logLevel,D)),L.errors.length>0)if(L.options.logLevel!=="silent")throw L.errors[0];else L.errors=[];return L.toJS(Object.assign({reviver:A},M))}function Q(J,V,M){let A=null;if(typeof V==="function"||Array.isArray(V))A=V;else if(M===void 0&&V)M=V;if(typeof M==="string")M=M.length;if(typeof M==="number"){let L=Math.round(M);M=L<1?void 0:L>8?{indent:8}:{indent:L}}if(J===void 0){let{keepUndefined:L}=M??V??{};if(!L)return}if(q.isDocument(J)&&!A)return J.toString(M);return new z.Document(J,A,M).toString(M)}Z.parse=$,Z.parseAllDocuments=H,Z.parseDocument=_,Z.stringify=Q}),O7=w((Z)=>{var X=M7(),z=Q6(),W=_7(),Y=W6(),q=t8(),B=u(),U=gZ(),G=q0(),H=hZ(),_=vZ(),$=X5(),Q=A7(),J=L7(),V=D7(),M=Xz(),A=r8();Z.Composer=X.Composer,Z.Document=z.Document,Z.Schema=W.Schema,Z.YAMLError=Y.YAMLError,Z.YAMLParseError=Y.YAMLParseError,Z.YAMLWarning=Y.YAMLWarning,Z.Alias=q.Alias,Z.isAlias=B.isAlias,Z.isCollection=B.isCollection,Z.isDocument=B.isDocument,Z.isMap=B.isMap,Z.isNode=B.isNode,Z.isPair=B.isPair,Z.isScalar=B.isScalar,Z.isSeq=B.isSeq,Z.Pair=U.Pair,Z.Scalar=G.Scalar,Z.YAMLMap=H.YAMLMap,Z.YAMLSeq=_.YAMLSeq,Z.CST=$,Z.Lexer=Q.Lexer,Z.LineCounter=J.LineCounter,Z.Parser=V.Parser,Z.parse=M.parse,Z.parseAllDocuments=M.parseAllDocuments,Z.parseDocument=M.parseDocument,Z.stringify=M.stringify,Z.visit=A.visit,Z.visitAsync=A.visitAsync});var F7=["none","acpx","llama-cpp","ollama","claude-code","codex","opencode","anthropic","openrouter","openai-compatible","command"],zz=F7.filter((Z)=>Z!=="command");var rJ=new Set(F7),tJ=new Set(zz);
|
|
22241
|
+
\`,Q)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Q=U($),J=G(Q);return J.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Q=U($),J=G(Q);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Q){if(this.type!=="comment")return!1;if(this.indent<=Q)return!1;return $.every((J)=>J.type==="newline"||J.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Z.Parser=_}),Xz=w((Z)=>{var X=M7(),z=Q6(),W=W6(),Y=Z7(),q=u(),B=L7(),U=D7();function G(J){let V=J.prettyErrors!==!1;return{lineCounter:J.lineCounter||V&&new B.LineCounter||null,prettyErrors:V}}function H(J,V={}){let{lineCounter:M,prettyErrors:A}=G(V),L=new U.Parser(M?.addNewLine),D=new X.Composer(V),F=Array.from(D.compose(L.parse(J)));if(A&&M)for(let j of F)j.errors.forEach(W.prettifyError(J,M)),j.warnings.forEach(W.prettifyError(J,M));if(F.length>0)return F;return Object.assign([],{empty:!0},D.streamInfo())}function _(J,V={}){let{lineCounter:M,prettyErrors:A}=G(V),L=new U.Parser(M?.addNewLine),D=new X.Composer(V),F=null;for(let j of D.compose(L.parse(J),!0,J.length))if(!F)F=j;else if(F.options.logLevel!=="silent"){F.errors.push(new W.YAMLParseError(j.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(A&&M)F.errors.forEach(W.prettifyError(J,M)),F.warnings.forEach(W.prettifyError(J,M));return F}function $(J,V,M){let A=void 0;if(typeof V==="function")A=V;else if(M===void 0&&V&&typeof V==="object")M=V;let L=_(J,M);if(!L)return null;if(L.warnings.forEach((D)=>Y.warn(L.options.logLevel,D)),L.errors.length>0)if(L.options.logLevel!=="silent")throw L.errors[0];else L.errors=[];return L.toJS(Object.assign({reviver:A},M))}function Q(J,V,M){let A=null;if(typeof V==="function"||Array.isArray(V))A=V;else if(M===void 0&&V)M=V;if(typeof M==="string")M=M.length;if(typeof M==="number"){let L=Math.round(M);M=L<1?void 0:L>8?{indent:8}:{indent:L}}if(J===void 0){let{keepUndefined:L}=M??V??{};if(!L)return}if(q.isDocument(J)&&!A)return J.toString(M);return new z.Document(J,A,M).toString(M)}Z.parse=$,Z.parseAllDocuments=H,Z.parseDocument=_,Z.stringify=Q}),O7=w((Z)=>{var X=M7(),z=Q6(),W=_7(),Y=W6(),q=t8(),B=u(),U=gZ(),G=q0(),H=hZ(),_=vZ(),$=X5(),Q=A7(),J=L7(),V=D7(),M=Xz(),A=r8();Z.Composer=X.Composer,Z.Document=z.Document,Z.Schema=W.Schema,Z.YAMLError=Y.YAMLError,Z.YAMLParseError=Y.YAMLParseError,Z.YAMLWarning=Y.YAMLWarning,Z.Alias=q.Alias,Z.isAlias=B.isAlias,Z.isCollection=B.isCollection,Z.isDocument=B.isDocument,Z.isMap=B.isMap,Z.isNode=B.isNode,Z.isPair=B.isPair,Z.isScalar=B.isScalar,Z.isSeq=B.isSeq,Z.Pair=U.Pair,Z.Scalar=G.Scalar,Z.YAMLMap=H.YAMLMap,Z.YAMLSeq=_.YAMLSeq,Z.CST=$,Z.Lexer=Q.Lexer,Z.LineCounter=J.LineCounter,Z.Parser=V.Parser,Z.parse=M.parse,Z.parseAllDocuments=M.parseAllDocuments,Z.parseDocument=M.parseDocument,Z.stringify=M.stringify,Z.visit=A.visit,Z.visitAsync=A.visitAsync});var F7=["none","acpx","llama-cpp","ollama","claude-code","codex","opencode","anthropic","openrouter","openai-compatible","command"],zz=F7.filter((Z)=>Z!=="command");var rJ=new Set(F7),tJ=new Set(zz);function bZ(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function z5(Z){return Object.fromEntries(Object.entries(Z).filter(([,X])=>X!==void 0))}function $z(Z){if(typeof Z==="string"){let X=Z.split(",").map((z)=>z.trim()).filter((z)=>z.length>0).join(",");return X.length>0?X:void 0}if(Array.isArray(Z)){let X=Z.map((z)=>z.trim()).filter((z)=>z.length>0).join(",");return X.length>0?X:void 0}return}function Qz(Z){if(typeof Z!=="number"||!Number.isFinite(Z))return 10;return Math.min(100,Math.max(1,Math.trunc(Z)))}function Wz(Z){return{primary:Z.filter((X)=>X.supplementary!==!0),supporting:Z.filter((X)=>X.supplementary===!0)}}function Hz(Z,X){if(!bZ(Z))return{totalReturned:X,hasSupplementary:!1,noHits:X===0};let z=typeof Z.totalReturned==="number"?Z.totalReturned:X,W=Z.hasSupplementary===!0,Y="noHits"in Z?Z.noHits===!0:z===0,q=bZ(Z.dedupe)?{enabled:Z.dedupe.enabled===!0,contextEpoch:typeof Z.dedupe.contextEpoch==="number"?Z.dedupe.contextEpoch:void 0,suppressed:typeof Z.dedupe.suppressed==="number"?Z.dedupe.suppressed:0,repeatedReturned:typeof Z.dedupe.repeatedReturned==="number"?Z.dedupe.repeatedReturned:0}:void 0,B=bZ(Z.temporal)?Z.temporal:void 0;return{totalReturned:z,hasSupplementary:W,noHits:Y,...q?{dedupe:q}:{},...B?{temporal:B}:{}}}function R8(Z){let X=bZ(Z)?Z:{},W=(Array.isArray(X.results)?X.results:Array.isArray(X.memories)?X.memories:[]).filter(bZ);return{query:typeof X.query==="string"?X.query:void 0,method:typeof X.method==="string"?X.method:void 0,rows:W,meta:Hz(X.meta,W.length),message:typeof X.message==="string"?X.message:void 0}}function Jz(Z){return typeof Z==="string"&&Z.length>0?Z.slice(0,10):"unknown"}function n6(Z,X){let z=typeof Z.score==="number"?\`[\${(Z.score*100).toFixed(0)}%] \`:"",W=typeof Z.source==="string"?Z.source:"unknown",Y=typeof Z.type==="string"?Z.type:"memory",q=typeof Z.who==="string"&&Z.who.length>0?\`, by \${Z.who}\`:"",B=Jz(Z.created_at),U=typeof Z.id==="string"&&Z.id.length>0?\`id: \${Z.id}; \`:"";return\`\${X?.includeIndex?\`\${X.includeIndex}. \`:"- "}\${z}\${U}\${Z.content??""} (\${Y}, \${W}, \${B}\${q})\`}function Yz(Z){if(Z.temporal_facet==="session")return"Sessions";if(Z.temporal_facet==="source")return"Source Activity";if(Z.temporal_facet==="occurred"||Z.temporal_facet==="observed"||Z.temporal_facet==="valid")return"Events";return"Memories Captured"}function Vz(Z){let X=new Date(Z);if(Number.isNaN(X.getTime()))return Z.slice(0,10);return X.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric",timeZone:"UTC"})}function _z(Z,X){let z=[Vz(X.start)],W=new Map;for(let Y of Z){let q=Yz(Y);W.set(q,[...W.get(q)??[],Y])}for(let Y of["Sessions","Source Activity","Events","Memories Captured"]){let q=W.get(Y);if(!q||q.length===0)continue;z.push("",Y,...q.map((B)=>n6(B)))}return z.join(\`
|
|
22242
|
+
\`)}function J6(Z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return typeof Z==="string"?Z:JSON.stringify(Z,null,2);let X=Z,z=R8(X);if(z.message&&z.rows.length===0)return z.message;if(z.meta.noHits||z.rows.length===0)return"No matching memories found.";let{primary:W,supporting:Y}=Wz(z.rows);if(z.meta.temporal?.mode==="timeline")return _z(W,z.meta.temporal);let q=z.meta.totalReturned===1?"memory":"memories",B=X.aggregate?.partial===!0&&typeof X.aggregate.message==="string"?[X.aggregate.message,"",\`Found \${z.meta.totalReturned} \${q}\${z.method?\` (\${z.method})\`:""}.\`]:[\`Found \${z.meta.totalReturned} \${q}\${z.method?\` (\${z.method})\`:""}.\`];if(W.length>0)B.push("","Primary matches:",...W.map((U)=>n6(U)));if(Y.length>0)B.push("","Supporting context:",...Y.map((U)=>n6(U)));return B.join(\`
|
|
22243
|
+
\`)}function $5(Z,X={}){return z5({query:Z,keywordQuery:X.keywordQuery??X.keyword_query,limit:Qz(X.limit),project:X.project,type:X.type,tags:X.tags,who:X.who,pinned:X.pinned===!0?!0:void 0,importance_min:X.importance_min,since:X.since,until:X.until,time:X.time,expand:X.expand===!0?!0:void 0,agentId:X.agentId??X.agent_id??X.contextAgentId,sessionKey:X.sessionKey??X.session_key,includeRecalled:X.includeRecalled===!0||X.include_recalled===!0?!0:void 0,scope:X.scope,sourceOnly:X.sourceOnly===!0||X.source_only===!0?!0:void 0,aggregate:X.aggregate===!0?!0:void 0,aggregateBudget:X.aggregateBudget??X.aggregate_budget,saveAggregate:X.saveAggregate===!1||X.save_aggregate===!1?!1:X.saveAggregate===!0||X.save_aggregate===!0?!0:void 0})}function Bz(Z){if(!bZ(Z))return Z;let X=Z.aspects;if(!Array.isArray(X))return Z;return{...Z,aspects:X.map((z)=>{if(!bZ(z))return z;if(typeof z.entityName==="string"&&Array.isArray(z.attributes))return z;if(typeof z.entity==="string"&&typeof z.aspect==="string"&&typeof z.value==="string")return{entityName:z.entity,aspect:z.aspect,attributes:[z5({content:z.value,groupKey:typeof z.groupKey==="string"?z.groupKey:void 0,claimKey:typeof z.claimKey==="string"?z.claimKey:void 0,confidence:typeof z.confidence==="number"?z.confidence:void 0,importance:typeof z.importance==="number"?z.importance:void 0})]};return z})}}function N7(Z,X={}){return z5({content:Z,type:X.type,importance:X.importance,tags:$z(X.tags),who:X.who,pinned:X.pinned===!0?!0:void 0,sourceType:X.sourceType,sourceId:X.sourceId,sourcePath:X.sourcePath,createdAt:X.createdAt,occurredAt:X.occurredAt,observedAt:X.observedAt,validFrom:X.validFrom,validUntil:X.validUntil,sourceCreatedAt:X.sourceCreatedAt,hints:X.hints,transcript:X.transcript,structured:Bz(X.structured),agentId:X.agentId,visibility:X.visibility,mode:X.mode,idempotencyKey:X.idempotencyKey,runtimePath:X.runtimePath,harness:X.harness,source:X.source})}var K7="unicode61";function qz(Z){return Z.replace(/\\s+/g," ").trim().toLowerCase()}function j7(Z){Z.exec(\`
|
|
22242
22244
|
CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
|
|
22243
22245
|
content,
|
|
22244
22246
|
content='memories',
|
|
22245
22247
|
content_rowid='rowid',
|
|
22246
|
-
tokenize='\${
|
|
22248
|
+
tokenize='\${K7}'
|
|
22247
22249
|
);
|
|
22248
22250
|
\`),Z.exec(\`
|
|
22249
22251
|
CREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN
|
|
@@ -22258,7 +22260,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22258
22260
|
INSERT INTO memories_fts(memories_fts, rowid, content) VALUES('delete', old.rowid, old.content);
|
|
22259
22261
|
INSERT INTO memories_fts(rowid, content) VALUES (new.rowid, new.content);
|
|
22260
22262
|
END;
|
|
22261
|
-
\`)}function
|
|
22263
|
+
\`)}function Mz(Z){Z.exec("DROP TRIGGER IF EXISTS memories_ai"),Z.exec("DROP TRIGGER IF EXISTS memories_ad"),Z.exec("DROP TRIGGER IF EXISTS memories_au"),Z.exec("DROP TABLE IF EXISTS memories_fts"),j7(Z),Z.exec("INSERT INTO memories_fts(rowid, content) SELECT rowid, content FROM memories")}function Az(Z){let X=Z.prepare("SELECT sql FROM sqlite_master WHERE name = 'memories_fts' AND type = 'table'").get();return typeof X?.sql==="string"?X.sql:null}function Lz(Z){if(Z===null)return!1;let X=qz(Z);if(X.includes("porter unicode61"))return!0;return!X.includes(\`tokenize='\${K7}'\`)}function Dz(Z){Z.exec(\`
|
|
22262
22264
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
22263
22265
|
version INTEGER PRIMARY KEY,
|
|
22264
22266
|
applied_at TEXT NOT NULL,
|
|
@@ -22340,7 +22342,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22340
22342
|
CREATE VIRTUAL TABLE IF NOT EXISTS vec_embeddings USING vec0(
|
|
22341
22343
|
embedding FLOAT[768]
|
|
22342
22344
|
);
|
|
22343
|
-
\`)}catch{}
|
|
22345
|
+
\`)}catch{}j7(Z)}function Oz(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function R0(Z,X,z,W){if(!Oz(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function Fz(Z){R0(Z,"memories","content_hash","TEXT"),R0(Z,"memories","normalized_content","TEXT"),R0(Z,"memories","is_deleted","INTEGER DEFAULT 0"),R0(Z,"memories","deleted_at","TEXT"),R0(Z,"memories","extraction_status","TEXT DEFAULT 'none'"),R0(Z,"memories","embedding_model","TEXT"),R0(Z,"memories","extraction_model","TEXT"),R0(Z,"memories","update_count","INTEGER DEFAULT 0"),R0(Z,"memories","who","TEXT"),R0(Z,"memories","why","TEXT"),R0(Z,"memories","project","TEXT"),R0(Z,"memories","pinned","INTEGER DEFAULT 0"),R0(Z,"memories","importance","REAL DEFAULT 0.5"),R0(Z,"memories","last_accessed","TEXT"),R0(Z,"memories","access_count","INTEGER DEFAULT 0"),Z.exec(\`
|
|
22344
22346
|
CREATE TABLE IF NOT EXISTS memory_history (
|
|
22345
22347
|
id TEXT PRIMARY KEY,
|
|
22346
22348
|
memory_id TEXT NOT NULL,
|
|
@@ -22427,7 +22429,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22427
22429
|
ON relations(target_entity_id);
|
|
22428
22430
|
CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity
|
|
22429
22431
|
ON memory_entity_mentions(entity_id);
|
|
22430
|
-
\`)}function m5(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return!1;return Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`),!0}function
|
|
22432
|
+
\`)}function m5(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return!1;return Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`),!0}function Nz(Z){m5(Z,"memories","why","TEXT"),m5(Z,"memories","project","TEXT"),Z.exec("DROP INDEX IF EXISTS idx_memories_content_hash"),Z.exec(\`
|
|
22431
22433
|
UPDATE memories
|
|
22432
22434
|
SET content_hash = NULL
|
|
22433
22435
|
WHERE content_hash IS NOT NULL
|
|
@@ -22448,7 +22450,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22448
22450
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_memories_content_hash_unique
|
|
22449
22451
|
ON memories(content_hash)
|
|
22450
22452
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
22451
|
-
\`)}function
|
|
22453
|
+
\`)}function Kz(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function u6(Z,X,z,W){if(!Kz(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function jz(Z){u6(Z,"memory_history","actor_type","TEXT"),u6(Z,"memory_history","session_id","TEXT"),u6(Z,"memory_history","request_id","TEXT"),Z.exec(\`
|
|
22452
22454
|
CREATE INDEX IF NOT EXISTS idx_memories_deleted_at
|
|
22453
22455
|
ON memories(deleted_at)
|
|
22454
22456
|
WHERE is_deleted = 1;
|
|
@@ -22463,9 +22465,9 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22463
22465
|
CREATE INDEX IF NOT EXISTS idx_memory_jobs_failed_at
|
|
22464
22466
|
ON memory_jobs(failed_at)
|
|
22465
22467
|
WHERE status = 'dead';
|
|
22466
|
-
\`)}function
|
|
22468
|
+
\`)}function Rz(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function YZ(Z,X,z,W){if(!Rz(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function Sz(Z){YZ(Z,"entities","canonical_name","TEXT"),YZ(Z,"entities","mentions","INTEGER DEFAULT 0"),YZ(Z,"entities","embedding","BLOB"),YZ(Z,"relations","mentions","INTEGER DEFAULT 1"),YZ(Z,"relations","confidence","REAL DEFAULT 0.5"),YZ(Z,"relations","updated_at","TEXT"),YZ(Z,"memory_entity_mentions","mention_text","TEXT"),YZ(Z,"memory_entity_mentions","confidence","REAL"),YZ(Z,"memory_entity_mentions","created_at","TEXT"),Z.exec("CREATE INDEX IF NOT EXISTS idx_entities_canonical_name ON entities(canonical_name)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_relations_composite ON relations(source_entity_id, relation_type)")}function u5(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function Cz(Z){if(!u5(Z,"memories","idempotency_key"))Z.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");if(Z.exec(\`CREATE UNIQUE INDEX IF NOT EXISTS idx_memories_idempotency_key
|
|
22467
22469
|
ON memories(idempotency_key)
|
|
22468
|
-
WHERE idempotency_key IS NOT NULL\`),!u5(Z,"memories","runtime_path"))Z.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT")}function
|
|
22470
|
+
WHERE idempotency_key IS NOT NULL\`),!u5(Z,"memories","runtime_path"))Z.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT")}function Ez(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function Iz(Z){if(Z.exec(\`
|
|
22469
22471
|
CREATE TABLE IF NOT EXISTS documents (
|
|
22470
22472
|
id TEXT PRIMARY KEY,
|
|
22471
22473
|
source_url TEXT,
|
|
@@ -22509,7 +22511,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22509
22511
|
updated_at TEXT NOT NULL
|
|
22510
22512
|
)
|
|
22511
22513
|
\`),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_connectors_provider
|
|
22512
|
-
ON connectors(provider)\`),!
|
|
22514
|
+
ON connectors(provider)\`),!Ez(Z,"memory_jobs","document_id"))Z.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT")}function Tz(Z){if(Z.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all().length===0)return;Z.exec(\`
|
|
22513
22515
|
DELETE FROM embeddings
|
|
22514
22516
|
WHERE rowid NOT IN (
|
|
22515
22517
|
SELECT MIN(rowid) FROM embeddings
|
|
@@ -22518,7 +22520,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22518
22520
|
\`),Z.exec("DROP INDEX IF EXISTS idx_embeddings_hash"),Z.exec(\`
|
|
22519
22521
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_embeddings_content_hash_unique
|
|
22520
22522
|
ON embeddings(content_hash)
|
|
22521
|
-
\`)}function
|
|
22523
|
+
\`)}function Pz(Z){Z.exec(\`
|
|
22522
22524
|
CREATE TABLE IF NOT EXISTS summary_jobs (
|
|
22523
22525
|
id TEXT PRIMARY KEY,
|
|
22524
22526
|
session_key TEXT,
|
|
@@ -22534,7 +22536,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22534
22536
|
error TEXT
|
|
22535
22537
|
)
|
|
22536
22538
|
\`),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
|
|
22537
|
-
ON summary_jobs(status)\`)}function
|
|
22539
|
+
ON summary_jobs(status)\`)}function wz(Z){Z.exec(\`
|
|
22538
22540
|
CREATE TABLE IF NOT EXISTS umap_cache (
|
|
22539
22541
|
id INTEGER PRIMARY KEY,
|
|
22540
22542
|
dimensions INTEGER NOT NULL,
|
|
@@ -22542,7 +22544,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22542
22544
|
payload TEXT NOT NULL,
|
|
22543
22545
|
created_at TEXT NOT NULL
|
|
22544
22546
|
)
|
|
22545
|
-
\`)}function
|
|
22547
|
+
\`)}function kz(Z){Z.exec(\`
|
|
22546
22548
|
CREATE TABLE IF NOT EXISTS session_scores (
|
|
22547
22549
|
id TEXT PRIMARY KEY,
|
|
22548
22550
|
session_key TEXT NOT NULL,
|
|
@@ -22559,7 +22561,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22559
22561
|
ON session_scores(project, created_at);
|
|
22560
22562
|
CREATE INDEX IF NOT EXISTS idx_session_scores_session
|
|
22561
22563
|
ON session_scores(session_key);
|
|
22562
|
-
\`)}function
|
|
22564
|
+
\`)}function fz(Z){Z.exec(\`
|
|
22563
22565
|
CREATE TABLE IF NOT EXISTS scheduled_tasks (
|
|
22564
22566
|
id TEXT PRIMARY KEY,
|
|
22565
22567
|
name TEXT NOT NULL,
|
|
@@ -22591,7 +22593,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22591
22593
|
ON task_runs(task_id);
|
|
22592
22594
|
CREATE INDEX IF NOT EXISTS idx_task_runs_status
|
|
22593
22595
|
ON task_runs(status);
|
|
22594
|
-
\`)}function c5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
22596
|
+
\`)}function c5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function bz(Z){Z.exec(\`
|
|
22595
22597
|
CREATE TABLE IF NOT EXISTS ingestion_jobs (
|
|
22596
22598
|
id TEXT PRIMARY KEY,
|
|
22597
22599
|
source_path TEXT NOT NULL,
|
|
@@ -22612,7 +22614,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22612
22614
|
ON ingestion_jobs(file_hash);
|
|
22613
22615
|
CREATE INDEX IF NOT EXISTS idx_ingestion_jobs_source_path
|
|
22614
22616
|
ON ingestion_jobs(source_path);
|
|
22615
|
-
\`),c5(Z,"memories","source_path","TEXT"),c5(Z,"memories","source_section","TEXT")}function
|
|
22617
|
+
\`),c5(Z,"memories","source_path","TEXT"),c5(Z,"memories","source_section","TEXT")}function xz(Z){Z.exec(\`
|
|
22616
22618
|
CREATE TABLE IF NOT EXISTS telemetry_events (
|
|
22617
22619
|
id TEXT PRIMARY KEY,
|
|
22618
22620
|
event TEXT NOT NULL,
|
|
@@ -22628,7 +22630,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22628
22630
|
ON telemetry_events(timestamp);
|
|
22629
22631
|
CREATE INDEX IF NOT EXISTS idx_telemetry_events_unsent
|
|
22630
22632
|
ON telemetry_events(sent_to_posthog) WHERE sent_to_posthog = 0;
|
|
22631
|
-
\`)}function d5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
22633
|
+
\`)}function d5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function gz(Z){Z.exec(\`
|
|
22632
22634
|
CREATE TABLE IF NOT EXISTS session_memories (
|
|
22633
22635
|
id TEXT PRIMARY KEY,
|
|
22634
22636
|
session_key TEXT NOT NULL,
|
|
@@ -22650,7 +22652,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22650
22652
|
ON session_memories(session_key);
|
|
22651
22653
|
CREATE INDEX IF NOT EXISTS idx_session_memories_memory
|
|
22652
22654
|
ON session_memories(memory_id);
|
|
22653
|
-
\`),d5(Z,"session_scores","confidence","REAL"),d5(Z,"session_scores","continuity_reasoning","TEXT")}function
|
|
22655
|
+
\`),d5(Z,"session_scores","confidence","REAL"),d5(Z,"session_scores","continuity_reasoning","TEXT")}function hz(Z){Z.exec(\`
|
|
22654
22656
|
CREATE TABLE IF NOT EXISTS session_checkpoints (
|
|
22655
22657
|
id TEXT PRIMARY KEY,
|
|
22656
22658
|
session_key TEXT NOT NULL,
|
|
@@ -22669,8 +22671,8 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22669
22671
|
ON session_checkpoints(session_key, created_at DESC);
|
|
22670
22672
|
CREATE INDEX IF NOT EXISTS idx_checkpoints_project
|
|
22671
22673
|
ON session_checkpoints(project_normalized, created_at DESC);
|
|
22672
|
-
\`)}function
|
|
22673
|
-
CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)\`)}function
|
|
22674
|
+
\`)}function vz(Z){let X=Z.prepare("PRAGMA table_info(scheduled_tasks)").all(),z=new Set(X.flatMap((W)=>typeof W.name==="string"?[W.name]:[]));if(!z.has("skill_name"))Z.exec("ALTER TABLE scheduled_tasks ADD COLUMN skill_name TEXT");if(!z.has("skill_mode"))Z.exec(\`ALTER TABLE scheduled_tasks ADD COLUMN skill_mode TEXT
|
|
22675
|
+
CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)\`)}function yz(Z){if(Z.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get())return;Z.exec(\`
|
|
22674
22676
|
CREATE TABLE skill_meta (
|
|
22675
22677
|
entity_id TEXT PRIMARY KEY REFERENCES entities(id),
|
|
22676
22678
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -22696,7 +22698,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22696
22698
|
|
|
22697
22699
|
CREATE INDEX idx_skill_meta_agent ON skill_meta(agent_id);
|
|
22698
22700
|
CREATE INDEX idx_skill_meta_source ON skill_meta(source);
|
|
22699
|
-
\`)}function
|
|
22701
|
+
\`)}function mz(Z){let X=Z.prepare("PRAGMA table_info(entities)").all();if(!new Set(X.flatMap((W)=>typeof W.name==="string"?[W.name]:[])).has("agent_id"))Z.exec("ALTER TABLE entities ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");Z.exec("CREATE INDEX IF NOT EXISTS idx_entities_agent ON entities(agent_id)"),Z.exec(\`
|
|
22700
22702
|
CREATE TABLE IF NOT EXISTS entity_aspects (
|
|
22701
22703
|
id TEXT PRIMARY KEY,
|
|
22702
22704
|
entity_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
@@ -22763,13 +22765,13 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22763
22765
|
CREATE INDEX IF NOT EXISTS idx_task_meta_agent ON task_meta(agent_id);
|
|
22764
22766
|
CREATE INDEX IF NOT EXISTS idx_task_meta_status ON task_meta(status);
|
|
22765
22767
|
CREATE INDEX IF NOT EXISTS idx_task_meta_retention ON task_meta(retention_until);
|
|
22766
|
-
\`)}function i8(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
22768
|
+
\`)}function i8(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function uz(Z){i8(Z,"session_memories","entity_slot","INTEGER"),i8(Z,"session_memories","aspect_slot","INTEGER"),i8(Z,"session_memories","is_constraint","INTEGER NOT NULL DEFAULT 0"),i8(Z,"session_memories","structural_density","INTEGER")}function cz(Z){let X=Z.prepare("PRAGMA table_info(session_checkpoints)").all(),z=new Set(X.flatMap((W)=>typeof W.name==="string"?[W.name]:[]));if(!z.has("focal_entity_ids"))Z.exec("ALTER TABLE session_checkpoints ADD COLUMN focal_entity_ids TEXT");if(!z.has("focal_entity_names"))Z.exec("ALTER TABLE session_checkpoints ADD COLUMN focal_entity_names TEXT");if(!z.has("active_aspect_ids"))Z.exec("ALTER TABLE session_checkpoints ADD COLUMN active_aspect_ids TEXT");if(!z.has("surfaced_constraint_count"))Z.exec("ALTER TABLE session_checkpoints ADD COLUMN surfaced_constraint_count INTEGER");if(!z.has("traversal_memory_count"))Z.exec("ALTER TABLE session_checkpoints ADD COLUMN traversal_memory_count INTEGER")}function p5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function dz(Z){p5(Z,"entities","pinned","INTEGER NOT NULL DEFAULT 0"),p5(Z,"entities","pinned_at","TEXT"),Z.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)")}function pz(Z){}function lz(Z){}function l5(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function nz(Z){l5(Z,"session_memories","agent_relevance_score","REAL"),l5(Z,"session_memories","agent_feedback_count","INTEGER DEFAULT 0")}function iz(Z){}function oz(Z){Z.exec(\`
|
|
22767
22769
|
UPDATE entities
|
|
22768
22770
|
SET canonical_name = REPLACE(REPLACE(REPLACE(
|
|
22769
22771
|
LOWER(TRIM(name)),
|
|
22770
22772
|
' ', ' '), ' ', ' '), ' ', ' ')
|
|
22771
22773
|
WHERE canonical_name IS NULL
|
|
22772
|
-
\`)}function
|
|
22774
|
+
\`)}function sz(Z){Z.exec(\`
|
|
22773
22775
|
CREATE TABLE IF NOT EXISTS memories_cold (
|
|
22774
22776
|
archive_id TEXT PRIMARY KEY,
|
|
22775
22777
|
memory_id TEXT NOT NULL,
|
|
@@ -22803,7 +22805,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22803
22805
|
CREATE INDEX IF NOT EXISTS idx_cold_project ON memories_cold(project);
|
|
22804
22806
|
CREATE INDEX IF NOT EXISTS idx_cold_archived_at ON memories_cold(archived_at);
|
|
22805
22807
|
CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
|
|
22806
|
-
\`)}function
|
|
22808
|
+
\`)}function az(Z){Z.exec(\`
|
|
22807
22809
|
CREATE TABLE IF NOT EXISTS session_summaries (
|
|
22808
22810
|
id TEXT PRIMARY KEY,
|
|
22809
22811
|
project TEXT,
|
|
@@ -22845,7 +22847,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22845
22847
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_summaries_session_depth
|
|
22846
22848
|
ON session_summaries(session_key, depth)
|
|
22847
22849
|
WHERE session_key IS NOT NULL;
|
|
22848
|
-
\`)}function
|
|
22850
|
+
\`)}function rz(Z){Z.exec(\`
|
|
22849
22851
|
CREATE TABLE IF NOT EXISTS memory_jobs_new (
|
|
22850
22852
|
id TEXT PRIMARY KEY,
|
|
22851
22853
|
memory_id TEXT,
|
|
@@ -22883,11 +22885,11 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22883
22885
|
ON memory_jobs(completed_at);
|
|
22884
22886
|
CREATE INDEX IF NOT EXISTS idx_memory_jobs_failed_at
|
|
22885
22887
|
ON memory_jobs(failed_at);
|
|
22886
|
-
\`)}function
|
|
22888
|
+
\`)}function tz(Z){if(!Z.prepare("PRAGMA table_info(entity_dependencies)").all().some((W)=>W.name==="reason"))Z.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");if(!Z.prepare("PRAGMA table_info(entities)").all().some((W)=>W.name==="last_synthesized_at"))Z.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT")}function ez(Z){let X=Z.prepare("PRAGMA table_info(embeddings)").all();if(X.length===0)return;if(!X.some((z)=>z.name==="vector"))Z.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB")}function Z$(Z){if(!Z.prepare("PRAGMA table_info(memories)").all().some((z)=>z.name==="scope"))Z.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");Z.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL")}function X$(Z){Z.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique"),Z.exec(\`
|
|
22887
22889
|
CREATE UNIQUE INDEX idx_memories_content_hash_unique
|
|
22888
22890
|
ON memories(content_hash, COALESCE(scope, '__NULL__'))
|
|
22889
22891
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
22890
|
-
\`)}function
|
|
22892
|
+
\`)}function z$(Z){Z.exec(\`
|
|
22891
22893
|
CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
22892
22894
|
name, canonical_name,
|
|
22893
22895
|
content='entities', content_rowid='rowid'
|
|
@@ -22912,7 +22914,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22912
22914
|
INSERT INTO entities_fts(rowid, name, canonical_name)
|
|
22913
22915
|
VALUES (new.rowid, new.name, new.canonical_name);
|
|
22914
22916
|
END
|
|
22915
|
-
\`)}function
|
|
22917
|
+
\`)}function $$(Z){if(!Z.prepare("PRAGMA table_info(entity_dependencies)").all().some((z)=>z.name==="confidence"))Z.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7")}function Q$(Z){if(Z.exec(\`
|
|
22916
22918
|
CREATE TABLE IF NOT EXISTS entity_communities (
|
|
22917
22919
|
id TEXT PRIMARY KEY,
|
|
22918
22920
|
agent_id TEXT NOT NULL,
|
|
@@ -22922,7 +22924,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22922
22924
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
22923
22925
|
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
22924
22926
|
)
|
|
22925
|
-
\`),Z.exec("CREATE INDEX IF NOT EXISTS idx_entity_communities_agent ON entity_communities(agent_id)"),!Z.prepare("PRAGMA table_info(entities)").all().some((z)=>z.name==="community_id"))Z.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)")}function
|
|
22927
|
+
\`),Z.exec("CREATE INDEX IF NOT EXISTS idx_entity_communities_agent ON entity_communities(agent_id)"),!Z.prepare("PRAGMA table_info(entities)").all().some((z)=>z.name==="community_id"))Z.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)")}function W$(Z){Z.exec(\`
|
|
22926
22928
|
CREATE TABLE IF NOT EXISTS memory_hints (
|
|
22927
22929
|
id TEXT PRIMARY KEY,
|
|
22928
22930
|
memory_id TEXT NOT NULL REFERENCES memories(id) ON DELETE CASCADE,
|
|
@@ -22953,7 +22955,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22953
22955
|
INSERT INTO memory_hints_fts(rowid, hint)
|
|
22954
22956
|
VALUES (new.rowid, new.hint);
|
|
22955
22957
|
END
|
|
22956
|
-
\`)}function
|
|
22958
|
+
\`)}function H$(Z){Z.exec(\`
|
|
22957
22959
|
DELETE FROM entity_dependencies
|
|
22958
22960
|
WHERE id NOT IN (
|
|
22959
22961
|
SELECT MIN(id) FROM entity_dependencies
|
|
@@ -22967,7 +22969,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22967
22969
|
source_entity_id, target_entity_id,
|
|
22968
22970
|
dependency_type, agent_id
|
|
22969
22971
|
)
|
|
22970
|
-
\`)}function
|
|
22972
|
+
\`)}function J$(Z){Z.exec(\`
|
|
22971
22973
|
CREATE TABLE IF NOT EXISTS session_transcripts (
|
|
22972
22974
|
session_key TEXT PRIMARY KEY,
|
|
22973
22975
|
content TEXT NOT NULL,
|
|
@@ -22981,7 +22983,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
22981
22983
|
ON session_transcripts(project);
|
|
22982
22984
|
CREATE INDEX IF NOT EXISTS idx_st_created
|
|
22983
22985
|
ON session_transcripts(created_at);
|
|
22984
|
-
\`)}function
|
|
22986
|
+
\`)}function Y$(Z,X,z,W){if(!Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function V$(Z){Y$(Z,"session_memories","path_json","TEXT"),Z.exec(\`
|
|
22985
22987
|
CREATE TABLE IF NOT EXISTS path_feedback_events (
|
|
22986
22988
|
id TEXT PRIMARY KEY,
|
|
22987
22989
|
agent_id TEXT NOT NULL,
|
|
@@ -23046,7 +23048,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23046
23048
|
created_at TEXT NOT NULL,
|
|
23047
23049
|
PRIMARY KEY (agent_id, session_key)
|
|
23048
23050
|
);
|
|
23049
|
-
\`)}function AZ(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
23051
|
+
\`)}function AZ(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function _$(Z){AZ(Z,"session_memories","entity_slot","INTEGER"),AZ(Z,"session_memories","aspect_slot","INTEGER"),AZ(Z,"session_memories","is_constraint","INTEGER NOT NULL DEFAULT 0"),AZ(Z,"session_memories","structural_density","INTEGER"),AZ(Z,"session_memories","predictor_rank","INTEGER"),AZ(Z,"session_memories","agent_relevance_score","REAL"),AZ(Z,"session_memories","agent_feedback_count","INTEGER DEFAULT 0"),AZ(Z,"session_memories","path_json","TEXT");let W=Z.prepare("PRAGMA table_info(session_memories)").all().some((Y)=>Y.name==="agent_id")?"COALESCE(NULLIF(agent_id, ''), 'default')":"'default'";Z.exec(\`
|
|
23050
23052
|
CREATE TABLE IF NOT EXISTS session_memories_new (
|
|
23051
23053
|
id TEXT PRIMARY KEY,
|
|
23052
23054
|
session_key TEXT NOT NULL,
|
|
@@ -23114,7 +23116,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23114
23116
|
ON session_memories(memory_id);
|
|
23115
23117
|
CREATE INDEX IF NOT EXISTS idx_session_memories_agent_session
|
|
23116
23118
|
ON session_memories(agent_id, session_key);
|
|
23117
|
-
\`)}function n5(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
23119
|
+
\`)}function n5(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function B$(Z){Z.exec(\`
|
|
23118
23120
|
CREATE TABLE IF NOT EXISTS agents (
|
|
23119
23121
|
id TEXT PRIMARY KEY,
|
|
23120
23122
|
name TEXT,
|
|
@@ -23129,7 +23131,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23129
23131
|
ON memories(agent_id);
|
|
23130
23132
|
CREATE INDEX IF NOT EXISTS idx_memories_agent_visibility
|
|
23131
23133
|
ON memories(agent_id, visibility);
|
|
23132
|
-
\`)}function c6(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
23134
|
+
\`)}function c6(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function U$(Z){c6(Z,"session_summaries","source_type","TEXT"),c6(Z,"session_summaries","source_ref","TEXT"),c6(Z,"session_summaries","meta_json","TEXT"),Z.exec(\`
|
|
23133
23135
|
UPDATE session_summaries
|
|
23134
23136
|
SET source_type = CASE
|
|
23135
23137
|
WHEN source_type IS NOT NULL THEN source_type
|
|
@@ -23143,7 +23145,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23143
23145
|
ON session_summaries(source_type);
|
|
23144
23146
|
CREATE INDEX IF NOT EXISTS idx_summaries_source_ref
|
|
23145
23147
|
ON session_summaries(source_ref);
|
|
23146
|
-
\`)}function d6(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
23148
|
+
\`)}function d6(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function G$(Z){d6(Z,"session_transcripts","updated_at","TEXT"),d6(Z,"summary_jobs","agent_id","TEXT NOT NULL DEFAULT 'default'"),d6(Z,"session_scores","agent_id","TEXT NOT NULL DEFAULT 'default'"),Z.exec(\`
|
|
23147
23149
|
UPDATE session_transcripts
|
|
23148
23150
|
SET updated_at = COALESCE(updated_at, created_at)
|
|
23149
23151
|
WHERE updated_at IS NULL;
|
|
@@ -23202,7 +23204,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23202
23204
|
|
|
23203
23205
|
CREATE INDEX IF NOT EXISTS idx_memory_md_heads_lease
|
|
23204
23206
|
ON memory_md_heads(lease_expires_at);
|
|
23205
|
-
\`)}function
|
|
23207
|
+
\`)}function q$(Z){Z.exec(\`
|
|
23206
23208
|
DROP INDEX IF EXISTS idx_summaries_session_depth;
|
|
23207
23209
|
|
|
23208
23210
|
CREATE TEMP TABLE IF NOT EXISTS session_summary_duplicate_map AS
|
|
@@ -23260,7 +23262,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23260
23262
|
ON session_summaries(agent_id, session_key, depth)
|
|
23261
23263
|
WHERE session_key IS NOT NULL
|
|
23262
23264
|
AND COALESCE(source_type, 'summary') = 'summary';
|
|
23263
|
-
\`)}function
|
|
23265
|
+
\`)}function M$(Z){Z.exec(\`
|
|
23264
23266
|
DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
|
|
23265
23267
|
DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
|
|
23266
23268
|
DROP TRIGGER IF EXISTS session_transcripts_fts_au;
|
|
@@ -23355,7 +23357,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23355
23357
|
ON session_summaries(agent_id, session_key, depth)
|
|
23356
23358
|
WHERE session_key IS NOT NULL
|
|
23357
23359
|
AND COALESCE(source_type, 'summary') = 'summary';
|
|
23358
|
-
\`)}function
|
|
23360
|
+
\`)}function A$(Z){Z.exec(\`
|
|
23359
23361
|
CREATE TABLE IF NOT EXISTS memory_thread_heads (
|
|
23360
23362
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
23361
23363
|
thread_key TEXT NOT NULL,
|
|
@@ -23470,7 +23472,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23470
23472
|
sample = excluded.sample,
|
|
23471
23473
|
updated_at = excluded.updated_at
|
|
23472
23474
|
WHERE excluded.latest_at >= memory_thread_heads.latest_at;
|
|
23473
|
-
\`)}function
|
|
23475
|
+
\`)}function L$(Z){Z.exec(\`
|
|
23474
23476
|
CREATE TABLE IF NOT EXISTS session_extract_cursors (
|
|
23475
23477
|
session_key TEXT NOT NULL,
|
|
23476
23478
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -23478,10 +23480,10 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23478
23480
|
last_extract_at TEXT NOT NULL,
|
|
23479
23481
|
PRIMARY KEY (session_key, agent_id)
|
|
23480
23482
|
);
|
|
23481
|
-
\`)}function
|
|
23483
|
+
\`)}function D$(Z,X){return Z.prepare(\`SELECT name
|
|
23482
23484
|
FROM sqlite_master
|
|
23483
23485
|
WHERE type = 'table' AND name = ?
|
|
23484
|
-
LIMIT 1\`).get(X)!==void 0}function
|
|
23486
|
+
LIMIT 1\`).get(X)!==void 0}function O$(Z){if(Z.exec(\`
|
|
23485
23487
|
CREATE TABLE IF NOT EXISTS entity_dependency_history (
|
|
23486
23488
|
id TEXT PRIMARY KEY,
|
|
23487
23489
|
dependency_id TEXT NOT NULL,
|
|
@@ -23503,7 +23505,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23503
23505
|
ON entity_dependency_history(agent_id);
|
|
23504
23506
|
CREATE INDEX IF NOT EXISTS idx_entity_dependency_history_created
|
|
23505
23507
|
ON entity_dependency_history(created_at DESC);
|
|
23506
|
-
\`),!
|
|
23508
|
+
\`),!D$(Z,"entity_dependencies"))return;Z.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_insert"),Z.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_update"),Z.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_audit_insert"),Z.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_audit_update"),Z.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_audit_delete"),Z.exec(\`
|
|
23507
23509
|
CREATE TRIGGER trg_entity_dependencies_related_to_reason_insert
|
|
23508
23510
|
BEFORE INSERT ON entity_dependencies
|
|
23509
23511
|
FOR EACH ROW
|
|
@@ -23628,7 +23630,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23628
23630
|
SET reason = 'legacy-unattributed related_to edge'
|
|
23629
23631
|
WHERE dependency_type = 'related_to'
|
|
23630
23632
|
AND (reason IS NULL OR length(trim(reason)) = 0)
|
|
23631
|
-
\`)}function M8(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
23633
|
+
\`)}function M8(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function F$(Z){M8(Z,"summary_jobs","session_id","TEXT"),M8(Z,"summary_jobs","trigger","TEXT NOT NULL DEFAULT 'session_end'"),M8(Z,"summary_jobs","captured_at","TEXT"),M8(Z,"summary_jobs","started_at","TEXT"),M8(Z,"summary_jobs","ended_at","TEXT"),Z.exec(\`
|
|
23632
23634
|
UPDATE summary_jobs
|
|
23633
23635
|
SET
|
|
23634
23636
|
session_id = COALESCE(session_id, session_key, id),
|
|
@@ -23706,7 +23708,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23706
23708
|
\`),Z.exec(\`
|
|
23707
23709
|
INSERT INTO memory_artifacts_fts(memory_artifacts_fts)
|
|
23708
23710
|
VALUES ('rebuild');
|
|
23709
|
-
\`)}function
|
|
23711
|
+
\`)}function N$(Z){Z.exec(\`
|
|
23710
23712
|
CREATE TABLE IF NOT EXISTS mcp_invocations (
|
|
23711
23713
|
id TEXT PRIMARY KEY,
|
|
23712
23714
|
server_id TEXT NOT NULL,
|
|
@@ -23720,7 +23722,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23720
23722
|
);
|
|
23721
23723
|
CREATE INDEX IF NOT EXISTS idx_mcp_inv_server ON mcp_invocations(server_id, created_at);
|
|
23722
23724
|
CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
|
|
23723
|
-
\`)}function
|
|
23725
|
+
\`)}function K$(Z){Z.exec(\`
|
|
23724
23726
|
CREATE TABLE IF NOT EXISTS skill_invocations (
|
|
23725
23727
|
id TEXT PRIMARY KEY,
|
|
23726
23728
|
skill_name TEXT NOT NULL,
|
|
@@ -23733,7 +23735,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23733
23735
|
);
|
|
23734
23736
|
CREATE INDEX IF NOT EXISTS idx_skill_inv_name ON skill_invocations(skill_name, created_at);
|
|
23735
23737
|
CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
|
|
23736
|
-
\`)}function
|
|
23738
|
+
\`)}function j$(Z){Z.exec(\`
|
|
23737
23739
|
CREATE TABLE IF NOT EXISTS task_scope_hints (
|
|
23738
23740
|
task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
|
|
23739
23741
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -23761,7 +23763,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23761
23763
|
|
|
23762
23764
|
CREATE INDEX IF NOT EXISTS idx_task_scope_hints_agent
|
|
23763
23765
|
ON task_scope_hints(agent_id, updated_at);
|
|
23764
|
-
\`)}function
|
|
23766
|
+
\`)}function R$(Z){Z.exec(\`
|
|
23765
23767
|
CREATE TABLE IF NOT EXISTS dreaming_state (
|
|
23766
23768
|
agent_id TEXT PRIMARY KEY NOT NULL,
|
|
23767
23769
|
tokens_since_last_pass INTEGER NOT NULL DEFAULT 0,
|
|
@@ -23791,7 +23793,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23791
23793
|
\`),Z.exec(\`
|
|
23792
23794
|
CREATE INDEX IF NOT EXISTS idx_dreaming_passes_agent
|
|
23793
23795
|
ON dreaming_passes (agent_id, created_at DESC);
|
|
23794
|
-
\`)}function
|
|
23796
|
+
\`)}function S$(Z){let X=Z.prepare("PRAGMA table_info(memories)").all(),z=new Set(X.map((W)=>W.name).filter((W)=>typeof W==="string"));if(!z.has("agent_id"))Z.exec("ALTER TABLE memories ADD COLUMN agent_id TEXT DEFAULT 'default'");if(!z.has("scope"))Z.exec("ALTER TABLE memories ADD COLUMN scope TEXT")}function C$(Z){S$(Z),Z.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique"),Z.exec(\`
|
|
23795
23797
|
CREATE UNIQUE INDEX idx_memories_content_hash_unique
|
|
23796
23798
|
ON memories(
|
|
23797
23799
|
content_hash,
|
|
@@ -23799,24 +23801,24 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23799
23801
|
COALESCE(scope, '__NULL__')
|
|
23800
23802
|
)
|
|
23801
23803
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
23802
|
-
\`)}function
|
|
23804
|
+
\`)}function E$(Z){let X=Az(Z);if(X!==null&&!Lz(X))return;Mz(Z)}function I$(Z){Z.exec(\`CREATE INDEX IF NOT EXISTS idx_entities_order
|
|
23803
23805
|
ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)\`),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
|
|
23804
23806
|
ON entities(entity_type, mentions)
|
|
23805
|
-
WHERE entity_type = 'extracted'\`)}function
|
|
23807
|
+
WHERE entity_type = 'extracted'\`)}function T$(Z){if(!Z.prepare("PRAGMA table_info(entity_attributes)").all().some((z)=>z.name==="claim_key"))Z.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");Z.exec(\`CREATE INDEX IF NOT EXISTS idx_entity_attributes_claim_key
|
|
23806
23808
|
ON entity_attributes(agent_id, aspect_id, claim_key, status)
|
|
23807
|
-
WHERE claim_key IS NOT NULL\`)}function
|
|
23809
|
+
WHERE claim_key IS NOT NULL\`)}function P$(Z){if(!Z.prepare("PRAGMA table_info(entity_attributes)").all().some((z)=>z.name==="group_key"))Z.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");Z.exec(\`CREATE INDEX IF NOT EXISTS idx_entity_attributes_group_key
|
|
23808
23810
|
ON entity_attributes(agent_id, aspect_id, group_key, status)
|
|
23809
23811
|
WHERE group_key IS NOT NULL\`),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_entity_attributes_group_claim
|
|
23810
23812
|
ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
|
|
23811
|
-
WHERE claim_key IS NOT NULL\`)}function
|
|
23813
|
+
WHERE claim_key IS NOT NULL\`)}function w$(Z){if(Z.prepare("PRAGMA table_info(memory_artifacts)").all().some((z)=>z.name==="source_mtime_ms"))return;Z.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL")}function k$(Z){let X=Z.prepare("PRAGMA table_info(memory_artifacts)").all(),z=new Set(X.map((W)=>W.name));if(!z.has("is_deleted"))Z.exec("ALTER TABLE memory_artifacts ADD COLUMN is_deleted INTEGER NOT NULL DEFAULT 0");if(!z.has("deleted_at"))Z.exec("ALTER TABLE memory_artifacts ADD COLUMN deleted_at TEXT");Z.exec(\`
|
|
23812
23814
|
CREATE INDEX IF NOT EXISTS idx_memory_artifacts_agent_deleted
|
|
23813
23815
|
ON memory_artifacts(agent_id, is_deleted, deleted_at)
|
|
23814
|
-
\`)}function
|
|
23816
|
+
\`)}function f$(Z){Z.exec("DROP TRIGGER IF EXISTS memories_au"),Z.exec(\`
|
|
23815
23817
|
CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
|
|
23816
23818
|
INSERT INTO memories_fts(memories_fts, rowid, content) VALUES('delete', old.rowid, old.content);
|
|
23817
23819
|
INSERT INTO memories_fts(rowid, content) VALUES (new.rowid, new.content);
|
|
23818
23820
|
END;
|
|
23819
|
-
\`)}function
|
|
23821
|
+
\`)}function b$(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function o8(Z,X,z,W){if(!b$(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function x$(Z){for(let X of["entities","entity_communities","entity_attributes","entity_dependencies"])o8(Z,X,"source_id","TEXT"),o8(Z,X,"source_kind","TEXT"),o8(Z,X,"source_path","TEXT"),o8(Z,X,"source_root","TEXT");Z.exec("CREATE INDEX IF NOT EXISTS idx_entities_source ON entities(agent_id, source_id, source_path)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_entity_communities_source ON entity_communities(agent_id, source_id, source_path)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_entity_attributes_source ON entity_attributes(agent_id, source_id, source_path)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_entity_dependencies_source_origin ON entity_dependencies(agent_id, source_id, source_path)")}function g$(Z,X){return Z.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = ?").get(X)?.name===X}function h$(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function v$(Z){if(!g$(Z,"embeddings"))return;if(!h$(Z,"embeddings","agent_id"))Z.exec("ALTER TABLE embeddings ADD COLUMN agent_id TEXT");Z.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)")}function y$(Z){Z.exec(\`
|
|
23820
23822
|
CREATE TABLE IF NOT EXISTS memory_search_telemetry (
|
|
23821
23823
|
id TEXT PRIMARY KEY,
|
|
23822
23824
|
created_at TEXT NOT NULL,
|
|
@@ -23845,7 +23847,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23845
23847
|
ON memory_search_telemetry(route, created_at DESC);
|
|
23846
23848
|
CREATE INDEX IF NOT EXISTS idx_memory_search_telemetry_no_hits
|
|
23847
23849
|
ON memory_search_telemetry(no_hits, created_at DESC);
|
|
23848
|
-
\`)}function
|
|
23850
|
+
\`)}function m$(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function i5(Z,X,z,W){if(!m$(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function u$(Z){Z.exec(\`
|
|
23849
23851
|
CREATE TABLE IF NOT EXISTS ontology_proposals (
|
|
23850
23852
|
id TEXT PRIMARY KEY,
|
|
23851
23853
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -23880,7 +23882,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23880
23882
|
|
|
23881
23883
|
CREATE INDEX IF NOT EXISTS idx_ontology_proposals_source
|
|
23882
23884
|
ON ontology_proposals(agent_id, source_kind, source_id);
|
|
23883
|
-
\`);for(let X of["entity_attributes","entity_dependencies"])i5(Z,X,"proposal_id","TEXT"),i5(Z,X,"proposal_evidence","TEXT NOT NULL DEFAULT '[]'"),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_\${X}_proposal ON \${X}(agent_id, proposal_id)\`)}function
|
|
23885
|
+
\`);for(let X of["entity_attributes","entity_dependencies"])i5(Z,X,"proposal_id","TEXT"),i5(Z,X,"proposal_evidence","TEXT NOT NULL DEFAULT '[]'"),Z.exec(\`CREATE INDEX IF NOT EXISTS idx_\${X}_proposal ON \${X}(agent_id, proposal_id)\`)}function c$(Z){Z.exec(\`
|
|
23884
23886
|
CREATE TABLE IF NOT EXISTS daily_reflections (
|
|
23885
23887
|
id TEXT PRIMARY KEY,
|
|
23886
23888
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -23904,7 +23906,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23904
23906
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_daily_reflections_agent_content_key
|
|
23905
23907
|
ON daily_reflections(agent_id, date, content_key)
|
|
23906
23908
|
WHERE content_key IS NOT NULL;
|
|
23907
|
-
\`)}function
|
|
23909
|
+
\`)}function d$(Z){let X=Z.prepare("PRAGMA table_info(daily_reflections)").all();if(!new Set(X.flatMap((W)=>typeof W.name==="string"?[W.name]:[])).has("content_key"))Z.exec("ALTER TABLE daily_reflections ADD COLUMN content_key TEXT");Z.exec(\`
|
|
23908
23910
|
DROP INDEX IF EXISTS idx_daily_reflections_agent_date;
|
|
23909
23911
|
DROP INDEX IF EXISTS idx_daily_reflections_agent_content_key;
|
|
23910
23912
|
|
|
@@ -23917,11 +23919,11 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23917
23919
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_daily_reflections_agent_content_key
|
|
23918
23920
|
ON daily_reflections(agent_id, date, content_key)
|
|
23919
23921
|
WHERE content_key IS NOT NULL;
|
|
23920
|
-
\`)}function
|
|
23922
|
+
\`)}function p$(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function h0(Z,X,z,W){if(!p$(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function l$(Z){Z.exec(\`
|
|
23921
23923
|
UPDATE entity_attributes
|
|
23922
23924
|
SET version_root_id = id
|
|
23923
23925
|
WHERE version_root_id IS NULL
|
|
23924
|
-
\`)}function
|
|
23926
|
+
\`)}function n$(Z){for(let X of["entities","entity_aspects","entity_dependencies"])h0(Z,X,"status","TEXT NOT NULL DEFAULT 'active'"),h0(Z,X,"archived_at","TEXT"),h0(Z,X,"archived_by","TEXT"),h0(Z,X,"archive_reason","TEXT");for(let X of["entities","entity_aspects"])h0(Z,X,"proposal_id","TEXT"),h0(Z,X,"proposal_evidence","TEXT NOT NULL DEFAULT '[]'");h0(Z,"entity_attributes","version","INTEGER NOT NULL DEFAULT 1"),h0(Z,"entity_attributes","version_root_id","TEXT"),h0(Z,"entity_attributes","previous_attribute_id","TEXT"),h0(Z,"entity_attributes","archived_at","TEXT"),h0(Z,"entity_attributes","archived_by","TEXT"),h0(Z,"entity_attributes","archive_reason","TEXT"),l$(Z),Z.exec(\`
|
|
23925
23927
|
CREATE INDEX IF NOT EXISTS idx_entities_status
|
|
23926
23928
|
ON entities(agent_id, status, updated_at DESC);
|
|
23927
23929
|
CREATE INDEX IF NOT EXISTS idx_entity_aspects_status
|
|
@@ -23936,7 +23938,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23936
23938
|
ON entities(agent_id, proposal_id);
|
|
23937
23939
|
CREATE INDEX IF NOT EXISTS idx_entity_aspects_proposal
|
|
23938
23940
|
ON entity_aspects(agent_id, proposal_id);
|
|
23939
|
-
\`)}function
|
|
23941
|
+
\`)}function i$(Z){Z.exec(\`
|
|
23940
23942
|
CREATE TABLE IF NOT EXISTS epistemic_assertions (
|
|
23941
23943
|
id TEXT PRIMARY KEY,
|
|
23942
23944
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -23975,7 +23977,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23975
23977
|
ON epistemic_assertions(agent_id, source_kind, source_id);
|
|
23976
23978
|
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_claim
|
|
23977
23979
|
ON epistemic_assertions(agent_id, claim_attribute_id);
|
|
23978
|
-
\`)}function
|
|
23980
|
+
\`)}function o$(Z){let X=Z.prepare("PRAGMA table_info(memories)").all(),z=new Set(X.map((W)=>W.name).filter((W)=>typeof W==="string"));if(!z.has("agent_id"))Z.exec("ALTER TABLE memories ADD COLUMN agent_id TEXT DEFAULT 'default'");if(!z.has("visibility"))Z.exec("ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'global'");if(!z.has("scope"))Z.exec("ALTER TABLE memories ADD COLUMN scope TEXT");if(!z.has("idempotency_key"))Z.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");if(!z.has("runtime_path"))Z.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT")}function s$(Z){o$(Z),Z.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key"),Z.exec(\`
|
|
23979
23981
|
CREATE UNIQUE INDEX idx_memories_idempotency_key
|
|
23980
23982
|
ON memories(
|
|
23981
23983
|
idempotency_key,
|
|
@@ -23984,7 +23986,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
23984
23986
|
COALESCE(scope, '__NULL__')
|
|
23985
23987
|
)
|
|
23986
23988
|
WHERE idempotency_key IS NOT NULL AND is_deleted = 0
|
|
23987
|
-
\`)}function
|
|
23989
|
+
\`)}function a$(Z){Z.exec(\`
|
|
23988
23990
|
CREATE TABLE IF NOT EXISTS session_context_epochs (
|
|
23989
23991
|
session_key TEXT NOT NULL,
|
|
23990
23992
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -24016,7 +24018,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24016
24018
|
ON session_recall_events(session_key, agent_id, context_epoch, created_at DESC);
|
|
24017
24019
|
CREATE INDEX IF NOT EXISTS idx_session_recall_events_item
|
|
24018
24020
|
ON session_recall_events(item_kind, item_id, created_at DESC);
|
|
24019
|
-
\`)}function
|
|
24021
|
+
\`)}function r$(Z){Z.exec(\`
|
|
24020
24022
|
CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
|
|
24021
24023
|
aggregate_memory_id TEXT NOT NULL,
|
|
24022
24024
|
source_memory_id TEXT NOT NULL,
|
|
@@ -24026,12 +24028,12 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24026
24028
|
);
|
|
24027
24029
|
CREATE INDEX IF NOT EXISTS idx_aggregate_memory_sources_agent
|
|
24028
24030
|
ON aggregate_memory_sources(agent_id, aggregate_memory_id);
|
|
24029
|
-
\`)}function A8(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function
|
|
24031
|
+
\`)}function A8(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function t$(Z){A8(Z,"memory_artifacts","source_id","TEXT"),A8(Z,"memory_artifacts","source_root","TEXT"),A8(Z,"memory_artifacts","source_external_id","TEXT"),A8(Z,"memory_artifacts","source_parent_path","TEXT"),A8(Z,"memory_artifacts","source_meta_json","TEXT"),Z.exec(\`
|
|
24030
24032
|
CREATE INDEX IF NOT EXISTS idx_memory_artifacts_agent_source
|
|
24031
24033
|
ON memory_artifacts(agent_id, source_id, source_external_id);
|
|
24032
24034
|
CREATE INDEX IF NOT EXISTS idx_memory_artifacts_agent_source_root
|
|
24033
24035
|
ON memory_artifacts(agent_id, source_id, source_root);
|
|
24034
|
-
\`)}function
|
|
24036
|
+
\`)}function e$(Z){Z.exec(\`
|
|
24035
24037
|
CREATE TABLE IF NOT EXISTS temporal_edges (
|
|
24036
24038
|
id TEXT PRIMARY KEY,
|
|
24037
24039
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -24051,7 +24053,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24051
24053
|
ON temporal_edges(agent_id, facet, start_at, end_at);
|
|
24052
24054
|
CREATE INDEX IF NOT EXISTS idx_temporal_edges_agent_subject
|
|
24053
24055
|
ON temporal_edges(agent_id, subject_type, subject_id);
|
|
24054
|
-
\`)}function
|
|
24056
|
+
\`)}function ZQ(Z){Z.exec(\`
|
|
24055
24057
|
CREATE TABLE IF NOT EXISTS entity_aliases (
|
|
24056
24058
|
id TEXT PRIMARY KEY,
|
|
24057
24059
|
entity_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
@@ -24072,7 +24074,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24072
24074
|
ON entity_aliases(agent_id, entity_id, status);
|
|
24073
24075
|
CREATE INDEX IF NOT EXISTS idx_entity_aliases_lookup
|
|
24074
24076
|
ON entity_aliases(agent_id, canonical_alias, status);
|
|
24075
|
-
\`)}function
|
|
24077
|
+
\`)}function XQ(Z){Z.exec(\`
|
|
24076
24078
|
CREATE TABLE IF NOT EXISTS api_keys (
|
|
24077
24079
|
id TEXT PRIMARY KEY,
|
|
24078
24080
|
prefix TEXT NOT NULL UNIQUE,
|
|
@@ -24097,7 +24099,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24097
24099
|
ON api_keys(revoked_at, expires_at);
|
|
24098
24100
|
CREATE INDEX IF NOT EXISTS idx_api_keys_connector
|
|
24099
24101
|
ON api_keys(connector, harness);
|
|
24100
|
-
\`)}function
|
|
24102
|
+
\`)}function R7(Z){Z.exec(\`
|
|
24101
24103
|
CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
|
|
24102
24104
|
id TEXT PRIMARY KEY,
|
|
24103
24105
|
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
@@ -24125,7 +24127,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24125
24127
|
|
|
24126
24128
|
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_session
|
|
24127
24129
|
ON transcript_capture_jobs(agent_id, session_key, created_at);
|
|
24128
|
-
\`)}function i0(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function
|
|
24130
|
+
\`)}function i0(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function S7(Z){if(!i0(Z,"documents","agent_id"))Z.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");if(!i0(Z,"documents","project"))Z.exec("ALTER TABLE documents ADD COLUMN project TEXT");if(Z.exec(\`
|
|
24129
24131
|
UPDATE documents
|
|
24130
24132
|
SET agent_id = NULLIF(TRIM(json_extract(metadata_json, '$.signet.agentId')), '')
|
|
24131
24133
|
WHERE metadata_json IS NOT NULL
|
|
@@ -24191,7 +24193,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24191
24193
|
COALESCE(visibility, 'global')
|
|
24192
24194
|
)
|
|
24193
24195
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
24194
|
-
\`);Z.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)")}function
|
|
24196
|
+
\`);Z.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)")}function C7(Z){Z.exec(\`
|
|
24195
24197
|
CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
|
|
24196
24198
|
aggregate_memory_id TEXT NOT NULL,
|
|
24197
24199
|
source_kind TEXT NOT NULL,
|
|
@@ -24205,11 +24207,11 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24205
24207
|
ON aggregate_evidence_sources(agent_id, aggregate_memory_id);
|
|
24206
24208
|
CREATE INDEX IF NOT EXISTS idx_aggregate_evidence_sources_source
|
|
24207
24209
|
ON aggregate_evidence_sources(source_kind, source_id);
|
|
24208
|
-
\`)}function
|
|
24210
|
+
\`)}function zQ(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}var $Q=["harness","session_id","tool_use_id","cwd","origin","args"];function QQ(Z){for(let X of $Q)if(!zQ(Z,"skill_invocations",X))Z.exec(\`ALTER TABLE skill_invocations ADD COLUMN \${X} TEXT\`);Z.exec("DROP INDEX IF EXISTS idx_skill_inv_dedupe"),Z.exec(\`
|
|
24209
24211
|
CREATE UNIQUE INDEX idx_skill_inv_dedupe
|
|
24210
24212
|
ON skill_invocations(agent_id, harness, session_id, tool_use_id)
|
|
24211
24213
|
WHERE harness IS NOT NULL AND session_id IS NOT NULL AND tool_use_id IS NOT NULL
|
|
24212
|
-
\`),Z.exec("CREATE INDEX IF NOT EXISTS idx_skill_inv_harness ON skill_invocations(harness, created_at)")}var
|
|
24214
|
+
\`),Z.exec("CREATE INDEX IF NOT EXISTS idx_skill_inv_harness ON skill_invocations(harness, created_at)")}var WQ=new Set(["uses","requires","owned_by","owns","blocks","informs","maintains","implements","built","depends_on","related_to","learned_from","teaches","knows","assumes","supports_claim","authored_by","links_to","contains","contains_note","contradicts","supersedes","part_of","produced_artifact","precedes","follows","triggers","may_execute","requires_approval_from","impacts","produces","consumes"]);function HQ(Z){return[...Z].map((X)=>\`'\${X}'\`).join(", ")}function p6(Z,X){return Boolean(Z.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(X))}function kZ(Z,X,z){return Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((Y)=>Y.name===z)}function VZ(Z,X,z,W){if(!kZ(Z,X,z))Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function JQ(Z){let X=kZ(Z,"documents","agent_id"),z=kZ(Z,"documents","project");if(X)Z.exec(\`
|
|
24213
24215
|
CREATE TEMP TABLE __signet_doc_agent_guard AS
|
|
24214
24216
|
SELECT id, agent_id FROM documents
|
|
24215
24217
|
WHERE NULLIF(TRIM(agent_id), '') IS NOT NULL
|
|
@@ -24218,7 +24220,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24218
24220
|
CREATE TEMP TABLE __signet_doc_project_guard AS
|
|
24219
24221
|
SELECT id, project FROM documents
|
|
24220
24222
|
WHERE NULLIF(TRIM(project), '') IS NOT NULL
|
|
24221
|
-
\`);try{if(
|
|
24223
|
+
\`);try{if(S7(Z),X)Z.exec(\`
|
|
24222
24224
|
UPDATE documents
|
|
24223
24225
|
SET agent_id = (SELECT agent_id FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
24224
24226
|
WHERE EXISTS (SELECT 1 FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
@@ -24226,7 +24228,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24226
24228
|
UPDATE documents
|
|
24227
24229
|
SET project = (SELECT project FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
24228
24230
|
WHERE EXISTS (SELECT 1 FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
24229
|
-
\`)}finally{Z.exec("DROP TABLE IF EXISTS temp.__signet_doc_agent_guard"),Z.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard")}}function
|
|
24231
|
+
\`)}finally{Z.exec("DROP TABLE IF EXISTS temp.__signet_doc_agent_guard"),Z.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard")}}function YQ(Z){if(R7(Z),p6(Z,"documents"))JQ(Z);if(C7(Z),VZ(Z,"memories","superseded_by","TEXT"),VZ(Z,"memories","superseded_at","TEXT"),VZ(Z,"memories","superseded_reason","TEXT"),Z.exec("CREATE INDEX IF NOT EXISTS idx_memories_superseded_by ON memories(superseded_by)"),Z.exec("CREATE INDEX IF NOT EXISTS idx_memories_active_supersession ON memories(is_deleted, superseded_by)"),!p6(Z,"relations")||!p6(Z,"entity_dependencies"))return;VZ(Z,"entity_dependencies","confidence","REAL"),VZ(Z,"entity_dependencies","reason","TEXT"),VZ(Z,"entity_dependencies","source_id","TEXT"),VZ(Z,"entity_dependencies","source_kind","TEXT"),VZ(Z,"entity_dependencies","proposal_evidence","TEXT NOT NULL DEFAULT '[]'"),VZ(Z,"entity_dependencies","status","TEXT NOT NULL DEFAULT 'active'");let X=kZ(Z,"relations","confidence")?"r.confidence":"NULL",z=kZ(Z,"relations","updated_at")?"r.updated_at":"r.created_at",W=kZ(Z,"entities","agent_id")?"COALESCE(NULLIF(TRIM(src.agent_id), ''), 'default')":"'default'",Y=kZ(Z,"entities","agent_id")?"COALESCE(NULLIF(TRIM(dst.agent_id), ''), 'default')":"'default'";Z.exec(\`
|
|
24230
24232
|
INSERT OR IGNORE INTO entity_dependencies (
|
|
24231
24233
|
id,
|
|
24232
24234
|
source_entity_id,
|
|
@@ -24248,7 +24250,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24248
24250
|
r.source_entity_id,
|
|
24249
24251
|
r.target_entity_id,
|
|
24250
24252
|
COALESCE(\${W}, \${Y}, 'default'),
|
|
24251
|
-
CASE WHEN r.relation_type IN (\${
|
|
24253
|
+
CASE WHEN r.relation_type IN (\${HQ(WQ)}) THEN r.relation_type ELSE 'related_to' END,
|
|
24252
24254
|
MAX(0.1, MIN(1.0, COALESCE(r.strength, 0.5))),
|
|
24253
24255
|
MAX(0.1, MIN(1.0, COALESCE(\${X}, 0.7))),
|
|
24254
24256
|
'legacy relation backfill: ' || r.relation_type,
|
|
@@ -24263,7 +24265,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24263
24265
|
JOIN entities dst ON dst.id = r.target_entity_id
|
|
24264
24266
|
WHERE r.source_entity_id <> r.target_entity_id
|
|
24265
24267
|
AND \${W} = \${Y}
|
|
24266
|
-
\`)}function
|
|
24268
|
+
\`)}function VQ(Z){Z.exec(\`
|
|
24267
24269
|
CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
|
|
24268
24270
|
path TEXT PRIMARY KEY,
|
|
24269
24271
|
mtime_ms INTEGER NOT NULL,
|
|
@@ -24290,20 +24292,18 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24290
24292
|
|
|
24291
24293
|
CREATE INDEX IF NOT EXISTS idx_legacy_markdown_chunks_memory_id
|
|
24292
24294
|
ON legacy_markdown_chunks(memory_id);
|
|
24293
|
-
\`)}function
|
|
24295
|
+
\`)}function _Q(Z){let X=Z.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all(),z=new Set(X.map((A)=>String(A.name)));if(!z.has("relations")||!z.has("entity_dependencies"))return;let W=Z.prepare("PRAGMA table_info(relations)").all(),Y=Z.prepare("PRAGMA table_info(entity_dependencies)").all(),q=new Set(W.map((A)=>String(A.name))),B=new Set(Y.map((A)=>String(A.name)));if(!q.has("source_entity_id")||!q.has("relation_type"))return;if(!B.has("source_entity_id")||!B.has("dependency_type")||!B.has("agent_id"))return;let U=q.has("confidence"),G=q.has("updated_at"),H=B.has("confidence"),_=B.has("reason"),$=B.has("status"),Q=["id","source_entity_id","target_entity_id"],J=["id","source_entity_id","target_entity_id"];if(Q.push("relation_type"),J.push("dependency_type"),Q.push("strength","created_at"),J.push("strength","created_at"),Q.push("'default'"),J.push("agent_id"),Q.push("NULL"),J.push("aspect_id"),U&&H)Q.push("confidence"),J.push("confidence");if(_)Q.push("'extracted'"),J.push("reason");if($)Q.push("'active'"),J.push("status");if(G&&B.has("updated_at"))Q.push("updated_at"),J.push("updated_at");let V=Q.join(", "),M=J.join(", ");Z.exec(\`INSERT OR IGNORE INTO entity_dependencies (\${M})
|
|
24294
24296
|
SELECT \${V}
|
|
24295
24297
|
FROM relations
|
|
24296
24298
|
WHERE source_entity_id IS NOT NULL
|
|
24297
24299
|
AND target_entity_id IS NOT NULL
|
|
24298
|
-
AND relation_type IS NOT NULL\`)}function
|
|
24300
|
+
AND relation_type IS NOT NULL\`)}function BQ(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function UQ(Z){BQ(Z,"summary_jobs","content_hash","TEXT"),Z.exec(\`
|
|
24299
24301
|
CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
|
|
24300
24302
|
ON summary_jobs(agent_id, session_key, content_hash)
|
|
24301
|
-
\`)}function
|
|
24303
|
+
\`)}function GQ(Z,X,z,W){if(Z.prepare(\`PRAGMA table_info(\${X})\`).all().some((q)=>q.name===z))return;Z.exec(\`ALTER TABLE \${X} ADD COLUMN \${z} \${W}\`)}function qQ(Z){GQ(Z,"summary_jobs","boundary_reason","TEXT"),Z.exec(\`
|
|
24302
24304
|
CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
|
|
24303
24305
|
ON summary_jobs(agent_id, session_key, boundary_reason)
|
|
24304
|
-
\`)}var o5=[{version:1,name:"baseline",up:Vz,artifacts:{tables:["memories","conversations","embeddings"]}},{version:2,name:"pipeline-v2",up:Bz,artifacts:{tables:["memory_history","memory_jobs","entities","relations","memory_entity_mentions"]}},{version:3,name:"unique-content-hash",up:Uz},{version:4,name:"history-actor-and-retention",up:qz,artifacts:{columns:[{table:"memory_history",column:"actor_type"}]}},{version:5,name:"graph-extended",up:Az,artifacts:{columns:[{table:"entities",column:"canonical_name"}]}},{version:6,name:"idempotency-key",up:Lz,artifacts:{columns:[{table:"memories",column:"idempotency_key"}]}},{version:7,name:"documents-and-connectors",up:Oz,artifacts:{tables:["documents","document_memories","connectors"]}},{version:8,name:"embeddings-unique-hash",up:Fz},{version:9,name:"summary-jobs",up:Nz,artifacts:{tables:["summary_jobs"]}},{version:10,name:"umap-cache",up:Kz,artifacts:{tables:["umap_cache"]}},{version:11,name:"session-scores",up:jz,artifacts:{tables:["session_scores"]}},{version:12,name:"scheduled-tasks",up:Rz,artifacts:{tables:["scheduled_tasks","task_runs"]}},{version:13,name:"ingestion-tracking",up:Sz,artifacts:{tables:["ingestion_jobs"],columns:[{table:"memories",column:"source_path"},{table:"memories",column:"source_section"}]}},{version:14,name:"telemetry",up:Cz,artifacts:{tables:["telemetry_events"]}},{version:15,name:"session-memories",up:Ez,artifacts:{tables:["session_memories"],columns:[{table:"session_scores",column:"confidence"},{table:"session_scores",column:"continuity_reasoning"}]}},{version:16,name:"session-checkpoints",up:Iz,artifacts:{tables:["session_checkpoints"]}},{version:17,name:"task-skills",up:Tz,artifacts:{columns:[{table:"scheduled_tasks",column:"skill_name"}]}},{version:18,name:"skill-meta",up:Pz,artifacts:{tables:["skill_meta"]}},{version:19,name:"knowledge-structure",up:wz,artifacts:{tables:["entity_aspects","entity_attributes","entity_dependencies","task_meta"],columns:[{table:"entities",column:"agent_id"}]}},{version:20,name:"session-structural-columns",up:kz,artifacts:{columns:[{table:"session_memories",column:"entity_slot"},{table:"session_memories",column:"aspect_slot"},{table:"session_memories",column:"is_constraint"},{table:"session_memories",column:"structural_density"}]}},{version:21,name:"checkpoint-structural",up:fz,artifacts:{columns:[{table:"session_checkpoints",column:"focal_entity_ids"}]}},{version:22,name:"entity-pinning",up:bz,artifacts:{columns:[{table:"entities",column:"pinned"},{table:"entities",column:"pinned_at"}]}},{version:23,name:"retired-scorer-gap",up:xz},{version:24,name:"retired-scorer-gap",up:gz},{version:25,name:"agent-feedback",up:hz,artifacts:{columns:[{table:"session_memories",column:"agent_relevance_score"}]}},{version:26,name:"retired-scorer-gap",up:vz},{version:27,name:"backfill-canonical-names",up:yz},{version:28,name:"lossless-retention",up:mz},{version:29,name:"session-summary-dag",up:uz},{version:30,name:"nullable-memory-job-memory-id",up:cz},{version:31,name:"dependency-reason",up:dz,artifacts:{columns:[{table:"entity_dependencies",column:"reason"},{table:"entities",column:"last_synthesized_at"}]}},{version:32,name:"embeddings-vector-column",up:pz,artifacts:{columns:[{table:"embeddings",column:"vector",optional:!0}]}},{version:33,name:"scope",up:lz,artifacts:{columns:[{table:"memories",column:"scope"}]}},{version:34,name:"scope-aware-dedup",up:nz},{version:35,name:"entity-fts",up:iz},{version:36,name:"dependency-confidence",up:oz,artifacts:{columns:[{table:"entity_dependencies",column:"confidence"}]}},{version:37,name:"entity-communities",up:sz,artifacts:{tables:["entity_communities"],columns:[{table:"entities",column:"community_id"}]}},{version:38,name:"memory-hints",up:az,artifacts:{tables:["memory_hints"]}},{version:39,name:"dedup-entity-dependencies",up:rz},{version:40,name:"session-transcripts",up:tz,artifacts:{tables:["session_transcripts"]}},{version:41,name:"path-feedback",up:Z$,artifacts:{tables:["path_feedback_events","path_feedback_stats","entity_retrieval_stats","entity_cooccurrence","path_feedback_sessions"],columns:[{table:"session_memories",column:"path_json"}]}},{version:42,name:"session-memories-agent-id",up:X$,artifacts:{columns:[{table:"session_memories",column:"agent_id"}]}},{version:43,name:"agents-table",up:z$,artifacts:{tables:["agents"],columns:[{table:"memories",column:"agent_id"},{table:"memories",column:"visibility"}]}},{version:44,name:"memory-md-temporal-head",up:$$,artifacts:{columns:[{table:"session_summaries",column:"source_type"},{table:"session_summaries",column:"source_ref"},{table:"session_summaries",column:"meta_json"}]}},{version:45,name:"lossless-working-memory-hardening",up:Q$,artifacts:{tables:["session_transcripts_fts","memory_md_heads"],columns:[{table:"session_transcripts",column:"updated_at"},{table:"summary_jobs",column:"agent_id"},{table:"session_scores",column:"agent_id"}]}},{version:46,name:"session-summary-uniqueness",up:W$},{version:47,name:"agent-scoped-temporal-uniqueness",up:H$},{version:48,name:"thread-heads",up:J$,artifacts:{tables:["memory_thread_heads"]}},{version:49,name:"session-extract-cursors",up:Y$,artifacts:{tables:["session_extract_cursors"]}},{version:50,name:"related-to-audit",up:_$,artifacts:{tables:["entity_dependency_history"]}},{version:51,name:"memory-md-rolling-window-lineage",up:B$,artifacts:{tables:["memory_artifacts","memory_artifact_tombstones","memory_artifacts_fts"],columns:[{table:"summary_jobs",column:"session_id"},{table:"summary_jobs",column:"trigger"},{table:"summary_jobs",column:"captured_at"},{table:"summary_jobs",column:"started_at"},{table:"summary_jobs",column:"ended_at"}]}},{version:52,name:"mcp-invocations",up:U$,artifacts:{tables:["mcp_invocations"]}},{version:53,name:"skill-invocations",up:G$,artifacts:{tables:["skill_invocations"]}},{version:54,name:"task-agent-scope",up:q$,artifacts:{tables:["task_scope_hints"]}},{version:55,name:"dreaming-state",up:M$,artifacts:{tables:["dreaming_state","dreaming_passes"]}},{version:56,name:"agent-scoped-content-hash",up:L$},{version:57,name:"memories-fts-tokenizer-repair",up:D$},{version:58,name:"knowledge-graph-indices",up:O$},{version:59,name:"entity-attribute-claim-key",up:F$,artifacts:{columns:[{table:"entity_attributes",column:"claim_key"}]}},{version:60,name:"entity-attribute-group-key",up:N$,artifacts:{columns:[{table:"entity_attributes",column:"group_key"}]}},{version:61,name:"memory-artifact-source-mtime",up:K$,artifacts:{columns:[{table:"memory_artifacts",column:"source_mtime_ms"}]}},{version:62,name:"memory-artifact-soft-delete",up:j$,artifacts:{columns:[{table:"memory_artifacts",column:"is_deleted"},{table:"memory_artifacts",column:"deleted_at"}]}},{version:63,name:"content-only-memories-fts-update",up:R$},{version:64,name:"source-graph-provenance",up:C$,artifacts:{columns:[{table:"entities",column:"source_path"},{table:"entity_communities",column:"source_path"},{table:"entity_attributes",column:"source_path"},{table:"entity_dependencies",column:"source_path"}]}},{version:65,name:"source-embedding-agent-scope",up:T$,artifacts:{columns:[{table:"embeddings",column:"agent_id",optional:!0}]}},{version:66,name:"memory-search-telemetry",up:P$,artifacts:{tables:["memory_search_telemetry"]}},{version:67,name:"ontology-proposals",up:k$,artifacts:{tables:["ontology_proposals"],columns:[{table:"entity_attributes",column:"proposal_id"},{table:"entity_attributes",column:"proposal_evidence"},{table:"entity_dependencies",column:"proposal_id"},{table:"entity_dependencies",column:"proposal_evidence"}]}},{version:68,name:"daily-reflections",up:f$,artifacts:{tables:["daily_reflections"]}},{version:69,name:"daily-reflections-multiple-insights",up:b$,artifacts:{tables:["daily_reflections"]}},{version:70,name:"ontology-control-plane-state",up:h$,artifacts:{columns:[{table:"entities",column:"status"},{table:"entity_aspects",column:"status"},{table:"entity_attributes",column:"version"},{table:"entity_attributes",column:"version_root_id"},{table:"entity_attributes",column:"previous_attribute_id"},{table:"entity_dependencies",column:"status"}]}},{version:71,name:"epistemic-assertions",up:v$,artifacts:{tables:["epistemic_assertions"]}},{version:72,name:"agent-scoped-idempotency-key",up:m$,artifacts:{columns:[{table:"memories",column:"idempotency_key"},{table:"memories",column:"runtime_path"}]}},{version:73,name:"recall-context-dedupe",up:u$,artifacts:{tables:["session_context_epochs","session_recall_events"]}},{version:74,name:"aggregate-memory-links",up:c$,artifacts:{tables:["aggregate_memory_sources"]}},{version:75,name:"memory-artifact-source-provenance",up:d$,artifacts:{columns:[{table:"memory_artifacts",column:"source_id"},{table:"memory_artifacts",column:"source_root"},{table:"memory_artifacts",column:"source_external_id"},{table:"memory_artifacts",column:"source_parent_path"},{table:"memory_artifacts",column:"source_meta_json"}]}},{version:76,name:"temporal-edges",up:p$,artifacts:{tables:["temporal_edges"]}},{version:77,name:"entity-aliases",up:l$,artifacts:{tables:["entity_aliases"]}},{version:78,name:"api-keys",up:n$,artifacts:{tables:["api_keys"]}},{version:79,name:"transcript-capture-jobs",up:j7,artifacts:{tables:["transcript_capture_jobs"]}},{version:80,name:"document-scope-columns",up:R7,artifacts:{columns:[{table:"documents",column:"agent_id"},{table:"documents",column:"project"}]}},{version:81,name:"aggregate-evidence-sources",up:S7,artifacts:{tables:["aggregate_evidence_sources"]}},{version:82,name:"skill-invocations-harness",up:s$,artifacts:{columns:[{table:"skill_invocations",column:"harness"},{table:"skill_invocations",column:"tool_use_id"}]}},{version:83,name:"memory-lifecycle-repair",up:e$,artifacts:{tables:["transcript_capture_jobs","aggregate_evidence_sources","entity_dependencies"],columns:[{table:"documents",column:"agent_id"},{table:"documents",column:"project"},{table:"memories",column:"superseded_by"},{table:"memories",column:"superseded_at"},{table:"memories",column:"superseded_reason"}]}},{version:84,name:"legacy-markdown-import-state",up:ZQ,artifacts:{tables:["legacy_markdown_imports","legacy_markdown_chunks"]}},{version:85,name:"backfill-relations-to-dependencies",up:XQ,artifacts:{tables:["entity_dependencies"]}},{version:86,name:"summary-jobs-content-hash",up:$Q,artifacts:{columns:[{table:"summary_jobs",column:"content_hash"}]}},{version:87,name:"summary-jobs-boundary-reason",up:WQ,artifacts:{columns:[{table:"summary_jobs",column:"boundary_reason"}]}}];var zY=o5[o5.length-1]?.version??0;var HQ=Qz(import.meta.url),$Y=$z(HQ);var QY=r5(O7(),1);var JQ=r5(O7(),1);function C7(Z){try{let X=JQ.default.parse(Z);return typeof X==="object"&&X!==null?X:{}}catch{return{}}}var VQ=null;try{VQ=YQ(import.meta.url)("@signet/native")}catch{}function bZ(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function z5(Z){return Object.fromEntries(Object.entries(Z).filter(([,X])=>X!==void 0))}function _Q(Z){if(typeof Z==="string"){let X=Z.split(",").map((z)=>z.trim()).filter((z)=>z.length>0).join(",");return X.length>0?X:void 0}if(Array.isArray(Z)){let X=Z.map((z)=>z.trim()).filter((z)=>z.length>0).join(",");return X.length>0?X:void 0}return}function BQ(Z){if(typeof Z!=="number"||!Number.isFinite(Z))return 10;return Math.min(100,Math.max(1,Math.trunc(Z)))}function UQ(Z){return{primary:Z.filter((X)=>X.supplementary!==!0),supporting:Z.filter((X)=>X.supplementary===!0)}}function GQ(Z,X){if(!bZ(Z))return{totalReturned:X,hasSupplementary:!1,noHits:X===0};let z=typeof Z.totalReturned==="number"?Z.totalReturned:X,W=Z.hasSupplementary===!0,Y="noHits"in Z?Z.noHits===!0:z===0,q=bZ(Z.dedupe)?{enabled:Z.dedupe.enabled===!0,contextEpoch:typeof Z.dedupe.contextEpoch==="number"?Z.dedupe.contextEpoch:void 0,suppressed:typeof Z.dedupe.suppressed==="number"?Z.dedupe.suppressed:0,repeatedReturned:typeof Z.dedupe.repeatedReturned==="number"?Z.dedupe.repeatedReturned:0}:void 0,B=bZ(Z.temporal)?Z.temporal:void 0;return{totalReturned:z,hasSupplementary:W,noHits:Y,...q?{dedupe:q}:{},...B?{temporal:B}:{}}}function R8(Z){let X=bZ(Z)?Z:{},W=(Array.isArray(X.results)?X.results:Array.isArray(X.memories)?X.memories:[]).filter(bZ);return{query:typeof X.query==="string"?X.query:void 0,method:typeof X.method==="string"?X.method:void 0,rows:W,meta:GQ(X.meta,W.length),message:typeof X.message==="string"?X.message:void 0}}function qQ(Z){return typeof Z==="string"&&Z.length>0?Z.slice(0,10):"unknown"}function n6(Z,X){let z=typeof Z.score==="number"?\`[\${(Z.score*100).toFixed(0)}%] \`:"",W=typeof Z.source==="string"?Z.source:"unknown",Y=typeof Z.type==="string"?Z.type:"memory",q=typeof Z.who==="string"&&Z.who.length>0?\`, by \${Z.who}\`:"",B=qQ(Z.created_at),U=typeof Z.id==="string"&&Z.id.length>0?\`id: \${Z.id}; \`:"";return\`\${X?.includeIndex?\`\${X.includeIndex}. \`:"- "}\${z}\${U}\${Z.content??""} (\${Y}, \${W}, \${B}\${q})\`}function MQ(Z){if(Z.temporal_facet==="session")return"Sessions";if(Z.temporal_facet==="source")return"Source Activity";if(Z.temporal_facet==="occurred"||Z.temporal_facet==="observed"||Z.temporal_facet==="valid")return"Events";return"Memories Captured"}function AQ(Z){let X=new Date(Z);if(Number.isNaN(X.getTime()))return Z.slice(0,10);return X.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric",timeZone:"UTC"})}function LQ(Z,X){let z=[AQ(X.start)],W=new Map;for(let Y of Z){let q=MQ(Y);W.set(q,[...W.get(q)??[],Y])}for(let Y of["Sessions","Source Activity","Events","Memories Captured"]){let q=W.get(Y);if(!q||q.length===0)continue;z.push("",Y,...q.map((B)=>n6(B)))}return z.join(\`
|
|
24305
|
-
\`)}function J6(Z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return typeof Z==="string"?Z:JSON.stringify(Z,null,2);let X=Z,z=R8(X);if(z.message&&z.rows.length===0)return z.message;if(z.meta.noHits||z.rows.length===0)return"No matching memories found.";let{primary:W,supporting:Y}=UQ(z.rows);if(z.meta.temporal?.mode==="timeline")return LQ(W,z.meta.temporal);let q=z.meta.totalReturned===1?"memory":"memories",B=X.aggregate?.partial===!0&&typeof X.aggregate.message==="string"?[X.aggregate.message,"",\`Found \${z.meta.totalReturned} \${q}\${z.method?\` (\${z.method})\`:""}.\`]:[\`Found \${z.meta.totalReturned} \${q}\${z.method?\` (\${z.method})\`:""}.\`];if(W.length>0)B.push("","Primary matches:",...W.map((U)=>n6(U)));if(Y.length>0)B.push("","Supporting context:",...Y.map((U)=>n6(U)));return B.join(\`
|
|
24306
|
-
\`)}function $5(Z,X={}){return z5({query:Z,keywordQuery:X.keywordQuery??X.keyword_query,limit:BQ(X.limit),project:X.project,type:X.type,tags:X.tags,who:X.who,pinned:X.pinned===!0?!0:void 0,importance_min:X.importance_min,since:X.since,until:X.until,time:X.time,expand:X.expand===!0?!0:void 0,agentId:X.agentId??X.agent_id??X.contextAgentId,sessionKey:X.sessionKey??X.session_key,includeRecalled:X.includeRecalled===!0||X.include_recalled===!0?!0:void 0,scope:X.scope,sourceOnly:X.sourceOnly===!0||X.source_only===!0?!0:void 0,aggregate:X.aggregate===!0?!0:void 0,aggregateBudget:X.aggregateBudget??X.aggregate_budget,saveAggregate:X.saveAggregate===!1||X.save_aggregate===!1?!1:X.saveAggregate===!0||X.save_aggregate===!0?!0:void 0})}function DQ(Z){if(!bZ(Z))return Z;let X=Z.aspects;if(!Array.isArray(X))return Z;return{...Z,aspects:X.map((z)=>{if(!bZ(z))return z;if(typeof z.entityName==="string"&&Array.isArray(z.attributes))return z;if(typeof z.entity==="string"&&typeof z.aspect==="string"&&typeof z.value==="string")return{entityName:z.entity,aspect:z.aspect,attributes:[z5({content:z.value,groupKey:typeof z.groupKey==="string"?z.groupKey:void 0,claimKey:typeof z.claimKey==="string"?z.claimKey:void 0,confidence:typeof z.confidence==="number"?z.confidence:void 0,importance:typeof z.importance==="number"?z.importance:void 0})]};return z})}}function E7(Z,X={}){return z5({content:Z,type:X.type,importance:X.importance,tags:_Q(X.tags),who:X.who,pinned:X.pinned===!0?!0:void 0,sourceType:X.sourceType,sourceId:X.sourceId,sourcePath:X.sourcePath,createdAt:X.createdAt,occurredAt:X.occurredAt,observedAt:X.observedAt,validFrom:X.validFrom,validUntil:X.validUntil,sourceCreatedAt:X.sourceCreatedAt,hints:X.hints,transcript:X.transcript,structured:DQ(X.structured),agentId:X.agentId,visibility:X.visibility,mode:X.mode,idempotencyKey:X.idempotencyKey,runtimePath:X.runtimePath,harness:X.harness,source:X.source})}var I7="signetai";var OQ=["skills","tools","dreaming"],HY=[".daemon",".shadow","node_modules",":(glob)**/node_modules/**",\`\${I7}\`,"memory/backups","memory/memories.db",":(glob)memory/memories.db*",":(glob)memory/**/*.db",":(glob)memory/**/*.db-*",":(glob)memory/**/*.db-journal",":(glob)memory/**/*.db-shm",":(glob)memory/**/*.db-wal",":(glob)memory/**/*.sqlite",":(glob)memory/**/*.sqlite3",":(glob)**/*.db",":(glob)**/*.db-*",":(glob)**/*.db-journal",":(glob)**/*.db-shm",":(glob)**/*.db-wal",":(glob)**/*.sqlite",":(glob)**/*.sqlite3"],JY=["*.md",":(glob)**/*.md","*.json",":(glob)**/*.json","*.jsonl",":(glob)**/*.jsonl","*.html",":(glob)**/*.html","*.yaml",":(glob)**/*.yaml","*.yml",":(glob)**/*.yml",...OQ];var YY=[".daemon/",".shadow/","node_modules/",\`\${I7}/\`,"memory/memories.db*","memory/**/*.db","memory/**/*.db-*","memory/**/*.db-journal","memory/**/*.db-shm","memory/**/*.db-wal","memory/**/*.sqlite","memory/**/*.sqlite3","memory/backups/","*.db","*.db-*","*.db-journal","*.db-shm","*.db-wal","*.sqlite","*.sqlite3"];var GY=KQ(),NQ=["issues","pulls","discussions","docs"];var qY=new Set(NQ);function KQ(){switch(FQ()){case"darwin":return L8(l6(),"Library","Application Support","discord");case"win32":return L8(process.env.APPDATA||L8(l6(),"AppData","Roaming"),"discord");default:return L8(process.env.XDG_CONFIG_HOME||L8(l6(),".config"),"discord")}}function T7(Z,X){let z=Z[X];if(typeof z!=="string")return null;let W=z.trim();return W.length>0?W:null}function CQ(Z){let X=Z.trim();if(X==="~")return D8();if(X.startsWith("~/"))return O8(D8(),X.slice(2));if(X.startsWith("~"))return O8(D8(),X.slice(1));return X}function H5(Z){return SQ(CQ(Z))}function EQ(Z){let X=T7(Z,"XDG_CONFIG_HOME");return X?H5(X):O8(D8(),".config")}function IQ(Z=process.env){return O8(EQ(Z),"signet","pi.json")}function TQ(Z=process.env){let X=IQ(Z);if(!jQ(X))return null;try{let z=JSON.parse(RQ(X,"utf-8"));if(typeof z!=="object"||z===null)return null;let W=Reflect.get(z,"agentDir");return typeof W==="string"&&W.trim().length>0?H5(W):null}catch{return null}}function P7(Z=process.env){let X=T7(Z,"PI_CODING_AGENT_DIR");if(X)return H5(X);return TQ(Z)??O8(D8(),".pi","agent")}var PQ=["managed","passthrough","off"],w7={agents:{path:"AGENTS.md",description:"Operational rules and behavioral settings",optional:!1},soul:{path:"SOUL.md",description:"Persona, character, and security settings",optional:!1},identity:{path:"IDENTITY.md",description:"Agent name, creature type, and vibe",optional:!1},user:{path:"USER.md",description:"User profile and preferences",optional:!1},heartbeat:{path:"HEARTBEAT.md",description:"Heartbeat prompt used only for heartbeat/background check sessions",optional:!0,context:"session",session:"heartbeat"},memory:{path:"MEMORY.md",description:"Memory index and summary",optional:!0},tools:{path:"TOOLS.md",description:"Tool preferences and notes",optional:!0},bootstrap:{path:"BOOTSTRAP.md",description:"Setup ritual (typically deleted after first run)",optional:!0,context:"session",session:"bootstrap"},dreaming:{path:"DREAMING.md",description:"Dreaming/reflection prompt used only for dreaming sessions",optional:!0,context:"session",session:"dreaming"}},wQ={minimal:{name:"minimal",description:"AGENTS.md only for normal startup, plus DREAMING.md for dreaming sessions.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]},hermes:{name:"hermes",description:"Hermes-style SOUL.md primary identity with project-context discovery handled by Hermes.",startup:[{path:"SOUL.md",role:"primary_identity",budget:4000},{path:"AGENTS.md",role:"project_context",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]},openclaw:{name:"openclaw",description:"OpenClaw-style rich identity stack for character-forward agents.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000},{path:"SOUL.md",role:"persona",budget:4000},{path:"IDENTITY.md",role:"agent_identity",budget:2000},{path:"USER.md",role:"user_profile",budget:6000},{path:"MEMORY.md",role:"working_memory",budget:1e4}],special:[{path:"HEARTBEAT.md",kind:"heartbeat",role:"heartbeat_prompt",budget:4000},{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000},{path:"BOOTSTRAP.md",kind:"bootstrap",role:"bootstrap_prompt",budget:4000}]},custom:{name:"custom",description:"User-selected startup files and explicit order.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]}},IY=Object.entries(w7).filter(([,Z])=>!Z.optional).map(([Z])=>Z),TY=Object.entries(w7).filter(([,Z])=>Z.optional).map(([Z])=>Z);var i6=[{file:"AGENTS.md",header:"Agent Instructions",budget:12000},{file:"SOUL.md",header:"Soul",budget:4000},{file:"IDENTITY.md",header:"Identity",budget:2000},{file:"USER.md",header:"About Your User",budget:6000},{file:"MEMORY.md",header:"Working Memory",budget:1e4}],kQ={"AGENTS.md":"Agent Instructions","SOUL.md":"Soul","IDENTITY.md":"Identity","USER.md":"About Your User","MEMORY.md":"Working Memory"};function s5(Z){let X=Z.trim();if(!X)return!1;if(X.startsWith("/")||X.startsWith("~"))return!1;return!X.split(/[\\\\/]/).includes("..")}function fZ(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)?Z:{}}function a5(Z){return typeof Z==="string"&&PQ.includes(Z)}function k7(Z){let X=fZ(Z),z=fZ(X.capabilities),W=fZ(z.identity);if(a5(W.mode))return W.mode;let Y=fZ(X.identity);if(a5(Y.mode))return Y.mode;if(Y.enabled===!1)return"off";return"managed"}function fQ(Z){let X=W5(Z,"agent.yaml");if(!s8(X))return"managed";try{return k7(C7(Q5(X,"utf-8")))}catch{return"managed"}}function f7(Z){return Z!=="off"}function bQ(Z){if(typeof Z==="string")return s5(Z)?{path:Z}:null;let X=fZ(Z),z=typeof X.path==="string"?X.path.trim():"";if(!s5(z))return null;if(X.enabled===!1)return null;let W=typeof X.role==="string"?X.role:void 0,Y=typeof X.budget==="number"?X.budget:Number.parseInt(String(X.budget??""),10),q=Number.isFinite(Y)&&Y>0?Math.floor(Y):void 0;return{path:z,role:W,budget:q}}function xQ(Z){if(!Array.isArray(Z))return[];return Z.map(bQ).filter((X)=>X!==null)}function gQ(Z,X){let z=Z.split(/[\\\\/]/).pop()??Z;return kQ[z]??X??z.replace(/\\.md$/i,"")}function hQ(Z){let X=W5(Z,"agent.yaml");if(!s8(X))return i6.map(({file:z,budget:W})=>({path:z,budget:W}));try{let z=C7(Q5(X,"utf-8"));if(!f7(k7(z)))return[];let W=fZ(z.identity),Y=fZ(W.startup),q=xQ(Y.load);if(q.length>0)return q;let B=typeof W.preset==="string"?W.preset:"",U=wQ[B];if(U)return U.startup}catch{}return i6.map(({file:z,budget:W})=>({path:z,budget:W}))}var vQ="[signet: daemon offline — running with static identity]";function b7(Z,X=vQ){if(!s8(Z))return null;if(!f7(fQ(Z)))return null;let z=[];for(let W of hQ(Z)){let Y=W5(Z,W.path);if(!s8(Y))continue;try{let q=Q5(Y,"utf-8").trim();if(!q)continue;let B=W.budget??i6.find((G)=>G.file===W.path)?.budget??4000,U=q.length<=B?q:\`\${q.slice(0,B)}
|
|
24306
|
+
\`)}var o5=[{version:1,name:"baseline",up:Dz,artifacts:{tables:["memories","conversations","embeddings"]}},{version:2,name:"pipeline-v2",up:Fz,artifacts:{tables:["memory_history","memory_jobs","entities","relations","memory_entity_mentions"]}},{version:3,name:"unique-content-hash",up:Nz},{version:4,name:"history-actor-and-retention",up:jz,artifacts:{columns:[{table:"memory_history",column:"actor_type"}]}},{version:5,name:"graph-extended",up:Sz,artifacts:{columns:[{table:"entities",column:"canonical_name"}]}},{version:6,name:"idempotency-key",up:Cz,artifacts:{columns:[{table:"memories",column:"idempotency_key"}]}},{version:7,name:"documents-and-connectors",up:Iz,artifacts:{tables:["documents","document_memories","connectors"]}},{version:8,name:"embeddings-unique-hash",up:Tz},{version:9,name:"summary-jobs",up:Pz,artifacts:{tables:["summary_jobs"]}},{version:10,name:"umap-cache",up:wz,artifacts:{tables:["umap_cache"]}},{version:11,name:"session-scores",up:kz,artifacts:{tables:["session_scores"]}},{version:12,name:"scheduled-tasks",up:fz,artifacts:{tables:["scheduled_tasks","task_runs"]}},{version:13,name:"ingestion-tracking",up:bz,artifacts:{tables:["ingestion_jobs"],columns:[{table:"memories",column:"source_path"},{table:"memories",column:"source_section"}]}},{version:14,name:"telemetry",up:xz,artifacts:{tables:["telemetry_events"]}},{version:15,name:"session-memories",up:gz,artifacts:{tables:["session_memories"],columns:[{table:"session_scores",column:"confidence"},{table:"session_scores",column:"continuity_reasoning"}]}},{version:16,name:"session-checkpoints",up:hz,artifacts:{tables:["session_checkpoints"]}},{version:17,name:"task-skills",up:vz,artifacts:{columns:[{table:"scheduled_tasks",column:"skill_name"}]}},{version:18,name:"skill-meta",up:yz,artifacts:{tables:["skill_meta"]}},{version:19,name:"knowledge-structure",up:mz,artifacts:{tables:["entity_aspects","entity_attributes","entity_dependencies","task_meta"],columns:[{table:"entities",column:"agent_id"}]}},{version:20,name:"session-structural-columns",up:uz,artifacts:{columns:[{table:"session_memories",column:"entity_slot"},{table:"session_memories",column:"aspect_slot"},{table:"session_memories",column:"is_constraint"},{table:"session_memories",column:"structural_density"}]}},{version:21,name:"checkpoint-structural",up:cz,artifacts:{columns:[{table:"session_checkpoints",column:"focal_entity_ids"}]}},{version:22,name:"entity-pinning",up:dz,artifacts:{columns:[{table:"entities",column:"pinned"},{table:"entities",column:"pinned_at"}]}},{version:23,name:"retired-scorer-gap",up:pz},{version:24,name:"retired-scorer-gap",up:lz},{version:25,name:"agent-feedback",up:nz,artifacts:{columns:[{table:"session_memories",column:"agent_relevance_score"}]}},{version:26,name:"retired-scorer-gap",up:iz},{version:27,name:"backfill-canonical-names",up:oz},{version:28,name:"lossless-retention",up:sz},{version:29,name:"session-summary-dag",up:az},{version:30,name:"nullable-memory-job-memory-id",up:rz},{version:31,name:"dependency-reason",up:tz,artifacts:{columns:[{table:"entity_dependencies",column:"reason"},{table:"entities",column:"last_synthesized_at"}]}},{version:32,name:"embeddings-vector-column",up:ez,artifacts:{columns:[{table:"embeddings",column:"vector",optional:!0}]}},{version:33,name:"scope",up:Z$,artifacts:{columns:[{table:"memories",column:"scope"}]}},{version:34,name:"scope-aware-dedup",up:X$},{version:35,name:"entity-fts",up:z$},{version:36,name:"dependency-confidence",up:$$,artifacts:{columns:[{table:"entity_dependencies",column:"confidence"}]}},{version:37,name:"entity-communities",up:Q$,artifacts:{tables:["entity_communities"],columns:[{table:"entities",column:"community_id"}]}},{version:38,name:"memory-hints",up:W$,artifacts:{tables:["memory_hints"]}},{version:39,name:"dedup-entity-dependencies",up:H$},{version:40,name:"session-transcripts",up:J$,artifacts:{tables:["session_transcripts"]}},{version:41,name:"path-feedback",up:V$,artifacts:{tables:["path_feedback_events","path_feedback_stats","entity_retrieval_stats","entity_cooccurrence","path_feedback_sessions"],columns:[{table:"session_memories",column:"path_json"}]}},{version:42,name:"session-memories-agent-id",up:_$,artifacts:{columns:[{table:"session_memories",column:"agent_id"}]}},{version:43,name:"agents-table",up:B$,artifacts:{tables:["agents"],columns:[{table:"memories",column:"agent_id"},{table:"memories",column:"visibility"}]}},{version:44,name:"memory-md-temporal-head",up:U$,artifacts:{columns:[{table:"session_summaries",column:"source_type"},{table:"session_summaries",column:"source_ref"},{table:"session_summaries",column:"meta_json"}]}},{version:45,name:"lossless-working-memory-hardening",up:G$,artifacts:{tables:["session_transcripts_fts","memory_md_heads"],columns:[{table:"session_transcripts",column:"updated_at"},{table:"summary_jobs",column:"agent_id"},{table:"session_scores",column:"agent_id"}]}},{version:46,name:"session-summary-uniqueness",up:q$},{version:47,name:"agent-scoped-temporal-uniqueness",up:M$},{version:48,name:"thread-heads",up:A$,artifacts:{tables:["memory_thread_heads"]}},{version:49,name:"session-extract-cursors",up:L$,artifacts:{tables:["session_extract_cursors"]}},{version:50,name:"related-to-audit",up:O$,artifacts:{tables:["entity_dependency_history"]}},{version:51,name:"memory-md-rolling-window-lineage",up:F$,artifacts:{tables:["memory_artifacts","memory_artifact_tombstones","memory_artifacts_fts"],columns:[{table:"summary_jobs",column:"session_id"},{table:"summary_jobs",column:"trigger"},{table:"summary_jobs",column:"captured_at"},{table:"summary_jobs",column:"started_at"},{table:"summary_jobs",column:"ended_at"}]}},{version:52,name:"mcp-invocations",up:N$,artifacts:{tables:["mcp_invocations"]}},{version:53,name:"skill-invocations",up:K$,artifacts:{tables:["skill_invocations"]}},{version:54,name:"task-agent-scope",up:j$,artifacts:{tables:["task_scope_hints"]}},{version:55,name:"dreaming-state",up:R$,artifacts:{tables:["dreaming_state","dreaming_passes"]}},{version:56,name:"agent-scoped-content-hash",up:C$},{version:57,name:"memories-fts-tokenizer-repair",up:E$},{version:58,name:"knowledge-graph-indices",up:I$},{version:59,name:"entity-attribute-claim-key",up:T$,artifacts:{columns:[{table:"entity_attributes",column:"claim_key"}]}},{version:60,name:"entity-attribute-group-key",up:P$,artifacts:{columns:[{table:"entity_attributes",column:"group_key"}]}},{version:61,name:"memory-artifact-source-mtime",up:w$,artifacts:{columns:[{table:"memory_artifacts",column:"source_mtime_ms"}]}},{version:62,name:"memory-artifact-soft-delete",up:k$,artifacts:{columns:[{table:"memory_artifacts",column:"is_deleted"},{table:"memory_artifacts",column:"deleted_at"}]}},{version:63,name:"content-only-memories-fts-update",up:f$},{version:64,name:"source-graph-provenance",up:x$,artifacts:{columns:[{table:"entities",column:"source_path"},{table:"entity_communities",column:"source_path"},{table:"entity_attributes",column:"source_path"},{table:"entity_dependencies",column:"source_path"}]}},{version:65,name:"source-embedding-agent-scope",up:v$,artifacts:{columns:[{table:"embeddings",column:"agent_id",optional:!0}]}},{version:66,name:"memory-search-telemetry",up:y$,artifacts:{tables:["memory_search_telemetry"]}},{version:67,name:"ontology-proposals",up:u$,artifacts:{tables:["ontology_proposals"],columns:[{table:"entity_attributes",column:"proposal_id"},{table:"entity_attributes",column:"proposal_evidence"},{table:"entity_dependencies",column:"proposal_id"},{table:"entity_dependencies",column:"proposal_evidence"}]}},{version:68,name:"daily-reflections",up:c$,artifacts:{tables:["daily_reflections"]}},{version:69,name:"daily-reflections-multiple-insights",up:d$,artifacts:{tables:["daily_reflections"]}},{version:70,name:"ontology-control-plane-state",up:n$,artifacts:{columns:[{table:"entities",column:"status"},{table:"entity_aspects",column:"status"},{table:"entity_attributes",column:"version"},{table:"entity_attributes",column:"version_root_id"},{table:"entity_attributes",column:"previous_attribute_id"},{table:"entity_dependencies",column:"status"}]}},{version:71,name:"epistemic-assertions",up:i$,artifacts:{tables:["epistemic_assertions"]}},{version:72,name:"agent-scoped-idempotency-key",up:s$,artifacts:{columns:[{table:"memories",column:"idempotency_key"},{table:"memories",column:"runtime_path"}]}},{version:73,name:"recall-context-dedupe",up:a$,artifacts:{tables:["session_context_epochs","session_recall_events"]}},{version:74,name:"aggregate-memory-links",up:r$,artifacts:{tables:["aggregate_memory_sources"]}},{version:75,name:"memory-artifact-source-provenance",up:t$,artifacts:{columns:[{table:"memory_artifacts",column:"source_id"},{table:"memory_artifacts",column:"source_root"},{table:"memory_artifacts",column:"source_external_id"},{table:"memory_artifacts",column:"source_parent_path"},{table:"memory_artifacts",column:"source_meta_json"}]}},{version:76,name:"temporal-edges",up:e$,artifacts:{tables:["temporal_edges"]}},{version:77,name:"entity-aliases",up:ZQ,artifacts:{tables:["entity_aliases"]}},{version:78,name:"api-keys",up:XQ,artifacts:{tables:["api_keys"]}},{version:79,name:"transcript-capture-jobs",up:R7,artifacts:{tables:["transcript_capture_jobs"]}},{version:80,name:"document-scope-columns",up:S7,artifacts:{columns:[{table:"documents",column:"agent_id"},{table:"documents",column:"project"}]}},{version:81,name:"aggregate-evidence-sources",up:C7,artifacts:{tables:["aggregate_evidence_sources"]}},{version:82,name:"skill-invocations-harness",up:QQ,artifacts:{columns:[{table:"skill_invocations",column:"harness"},{table:"skill_invocations",column:"tool_use_id"}]}},{version:83,name:"memory-lifecycle-repair",up:YQ,artifacts:{tables:["transcript_capture_jobs","aggregate_evidence_sources","entity_dependencies"],columns:[{table:"documents",column:"agent_id"},{table:"documents",column:"project"},{table:"memories",column:"superseded_by"},{table:"memories",column:"superseded_at"},{table:"memories",column:"superseded_reason"}]}},{version:84,name:"legacy-markdown-import-state",up:VQ,artifacts:{tables:["legacy_markdown_imports","legacy_markdown_chunks"]}},{version:85,name:"backfill-relations-to-dependencies",up:_Q,artifacts:{tables:["entity_dependencies"]}},{version:86,name:"summary-jobs-content-hash",up:UQ,artifacts:{columns:[{table:"summary_jobs",column:"content_hash"}]}},{version:87,name:"summary-jobs-boundary-reason",up:qQ,artifacts:{columns:[{table:"summary_jobs",column:"boundary_reason"}]}}];var zY=o5[o5.length-1]?.version??0;var MQ=Gz(import.meta.url),$Y=Uz(MQ);var QY=r5(O7(),1);var AQ=r5(O7(),1);function E7(Z){try{let X=AQ.default.parse(Z);return typeof X==="object"&&X!==null?X:{}}catch{return{}}}var DQ=null;try{DQ=LQ(import.meta.url)("@signet/native")}catch{}var I7="signetai";var OQ=["skills","tools","dreaming"],HY=[".daemon",".shadow","node_modules",":(glob)**/node_modules/**",\`\${I7}\`,"memory/backups","memory/memories.db",":(glob)memory/memories.db*",":(glob)memory/**/*.db",":(glob)memory/**/*.db-*",":(glob)memory/**/*.db-journal",":(glob)memory/**/*.db-shm",":(glob)memory/**/*.db-wal",":(glob)memory/**/*.sqlite",":(glob)memory/**/*.sqlite3",":(glob)**/*.db",":(glob)**/*.db-*",":(glob)**/*.db-journal",":(glob)**/*.db-shm",":(glob)**/*.db-wal",":(glob)**/*.sqlite",":(glob)**/*.sqlite3"],JY=["*.md",":(glob)**/*.md","*.json",":(glob)**/*.json","*.jsonl",":(glob)**/*.jsonl","*.html",":(glob)**/*.html","*.yaml",":(glob)**/*.yaml","*.yml",":(glob)**/*.yml",...OQ];var YY=[".daemon/",".shadow/","node_modules/",\`\${I7}/\`,"memory/memories.db*","memory/**/*.db","memory/**/*.db-*","memory/**/*.db-journal","memory/**/*.db-shm","memory/**/*.db-wal","memory/**/*.sqlite","memory/**/*.sqlite3","memory/backups/","*.db","*.db-*","*.db-journal","*.db-shm","*.db-wal","*.sqlite","*.sqlite3"];var GY=KQ(),NQ=["issues","pulls","discussions","docs"];var qY=new Set(NQ);function KQ(){switch(FQ()){case"darwin":return L8(l6(),"Library","Application Support","discord");case"win32":return L8(process.env.APPDATA||L8(l6(),"AppData","Roaming"),"discord");default:return L8(process.env.XDG_CONFIG_HOME||L8(l6(),".config"),"discord")}}function T7(Z,X){let z=Z[X];if(typeof z!=="string")return null;let W=z.trim();return W.length>0?W:null}function CQ(Z){let X=Z.trim();if(X==="~")return D8();if(X.startsWith("~/"))return O8(D8(),X.slice(2));if(X.startsWith("~"))return O8(D8(),X.slice(1));return X}function H5(Z){return SQ(CQ(Z))}function EQ(Z){let X=T7(Z,"XDG_CONFIG_HOME");return X?H5(X):O8(D8(),".config")}function IQ(Z=process.env){return O8(EQ(Z),"signet","pi.json")}function TQ(Z=process.env){let X=IQ(Z);if(!jQ(X))return null;try{let z=JSON.parse(RQ(X,"utf-8"));if(typeof z!=="object"||z===null)return null;let W=Reflect.get(z,"agentDir");return typeof W==="string"&&W.trim().length>0?H5(W):null}catch{return null}}function P7(Z=process.env){let X=T7(Z,"PI_CODING_AGENT_DIR");if(X)return H5(X);return TQ(Z)??O8(D8(),".pi","agent")}var PQ=["managed","passthrough","off"],w7={agents:{path:"AGENTS.md",description:"Operational rules and behavioral settings",optional:!1},soul:{path:"SOUL.md",description:"Persona, character, and security settings",optional:!1},identity:{path:"IDENTITY.md",description:"Agent name, creature type, and vibe",optional:!1},user:{path:"USER.md",description:"User profile and preferences",optional:!1},heartbeat:{path:"HEARTBEAT.md",description:"Heartbeat prompt used only for heartbeat/background check sessions",optional:!0,context:"session",session:"heartbeat"},memory:{path:"MEMORY.md",description:"Memory index and summary",optional:!0},tools:{path:"TOOLS.md",description:"Tool preferences and notes",optional:!0},bootstrap:{path:"BOOTSTRAP.md",description:"Setup ritual (typically deleted after first run)",optional:!0,context:"session",session:"bootstrap"},dreaming:{path:"DREAMING.md",description:"Dreaming/reflection prompt used only for dreaming sessions",optional:!0,context:"session",session:"dreaming"}},wQ={minimal:{name:"minimal",description:"AGENTS.md only for normal startup, plus DREAMING.md for dreaming sessions.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]},hermes:{name:"hermes",description:"Hermes-style SOUL.md primary identity with project-context discovery handled by Hermes.",startup:[{path:"SOUL.md",role:"primary_identity",budget:4000},{path:"AGENTS.md",role:"project_context",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]},openclaw:{name:"openclaw",description:"OpenClaw-style rich identity stack for character-forward agents.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000},{path:"SOUL.md",role:"persona",budget:4000},{path:"IDENTITY.md",role:"agent_identity",budget:2000},{path:"USER.md",role:"user_profile",budget:6000},{path:"MEMORY.md",role:"working_memory",budget:1e4}],special:[{path:"HEARTBEAT.md",kind:"heartbeat",role:"heartbeat_prompt",budget:4000},{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000},{path:"BOOTSTRAP.md",kind:"bootstrap",role:"bootstrap_prompt",budget:4000}]},custom:{name:"custom",description:"User-selected startup files and explicit order.",startup:[{path:"AGENTS.md",role:"operating_instructions",budget:12000}],special:[{path:"DREAMING.md",kind:"dreaming",role:"dreaming_prompt",budget:4000}]}},IY=Object.entries(w7).filter(([,Z])=>!Z.optional).map(([Z])=>Z),TY=Object.entries(w7).filter(([,Z])=>Z.optional).map(([Z])=>Z);var i6=[{file:"AGENTS.md",header:"Agent Instructions",budget:12000},{file:"SOUL.md",header:"Soul",budget:4000},{file:"IDENTITY.md",header:"Identity",budget:2000},{file:"USER.md",header:"About Your User",budget:6000},{file:"MEMORY.md",header:"Working Memory",budget:1e4}],kQ={"AGENTS.md":"Agent Instructions","SOUL.md":"Soul","IDENTITY.md":"Identity","USER.md":"About Your User","MEMORY.md":"Working Memory"};function s5(Z){let X=Z.trim();if(!X)return!1;if(X.startsWith("/")||X.startsWith("~"))return!1;return!X.split(/[\\\\/]/).includes("..")}function fZ(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)?Z:{}}function a5(Z){return typeof Z==="string"&&PQ.includes(Z)}function k7(Z){let X=fZ(Z),z=fZ(X.capabilities),W=fZ(z.identity);if(a5(W.mode))return W.mode;let Y=fZ(X.identity);if(a5(Y.mode))return Y.mode;if(Y.enabled===!1)return"off";return"managed"}function fQ(Z){let X=W5(Z,"agent.yaml");if(!s8(X))return"managed";try{return k7(E7(Q5(X,"utf-8")))}catch{return"managed"}}function f7(Z){return Z!=="off"}function bQ(Z){if(typeof Z==="string")return s5(Z)?{path:Z}:null;let X=fZ(Z),z=typeof X.path==="string"?X.path.trim():"";if(!s5(z))return null;if(X.enabled===!1)return null;let W=typeof X.role==="string"?X.role:void 0,Y=typeof X.budget==="number"?X.budget:Number.parseInt(String(X.budget??""),10),q=Number.isFinite(Y)&&Y>0?Math.floor(Y):void 0;return{path:z,role:W,budget:q}}function xQ(Z){if(!Array.isArray(Z))return[];return Z.map(bQ).filter((X)=>X!==null)}function gQ(Z,X){let z=Z.split(/[\\\\/]/).pop()??Z;return kQ[z]??X??z.replace(/\\.md$/i,"")}function hQ(Z){let X=W5(Z,"agent.yaml");if(!s8(X))return i6.map(({file:z,budget:W})=>({path:z,budget:W}));try{let z=E7(Q5(X,"utf-8"));if(!f7(k7(z)))return[];let W=fZ(z.identity),Y=fZ(W.startup),q=xQ(Y.load);if(q.length>0)return q;let B=typeof W.preset==="string"?W.preset:"",U=wQ[B];if(U)return U.startup}catch{}return i6.map(({file:z,budget:W})=>({path:z,budget:W}))}var vQ="[signet: daemon offline — running with static identity]";function b7(Z,X=vQ){if(!s8(Z))return null;if(!f7(fQ(Z)))return null;let z=[];for(let W of hQ(Z)){let Y=W5(Z,W.path);if(!s8(Y))continue;try{let q=Q5(Y,"utf-8").trim();if(!q)continue;let B=W.budget??i6.find((G)=>G.file===W.path)?.budget??4000,U=q.length<=B?q:\`\${q.slice(0,B)}
|
|
24307
24307
|
[truncated]\`;z.push(\`## \${gQ(W.path,W.role)}
|
|
24308
24308
|
|
|
24309
24309
|
\${U}\`)}catch{}}if(z.length===0)return null;return\`\${X}
|
|
@@ -24314,7 +24314,7 @@ $&\`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").re
|
|
|
24314
24314
|
\`)}function lQ(Z){try{return JSON.parse(Z)}catch{return}}function nQ(Z){let X,z=[];for(let W of Z){let Y=lQ(W);if(!LZ(Y)||typeof Y.type!=="string")continue;if(Y.type==="session"){X=Y;continue}z.push(Y)}return{header:X,entries:z}}function iQ(Z){return uQ(Z,"utf-8").split(\`
|
|
24315
24315
|
\`).map((X)=>X.trim()).filter((X)=>X.length>0)}function oQ(Z){return p(Z?.cwd)??p(Z?.project)??p(Z?.workspace)}function V6(Z,X=new Set){if(!Z||!mQ(Z))return{loaded:!1,sessionId:void 0,project:void 0,transcript:void 0};try{let{header:z,entries:W}=nQ(iQ(Z));return{loaded:!0,sessionId:p(z?.id),project:oQ(z),transcript:Y6(W,X)}}catch{return{loaded:!1,sessionId:void 0,project:void 0,transcript:void 0}}}function sQ(){return o0("SIGNET_API_KEY")??o0("SIGNET_TOKEN")}function aQ(Z){let X={"Content-Type":"application/json","x-signet-runtime-path":Z.runtimePath,"x-signet-actor":Z.actorName,"x-signet-actor-type":"harness"},z=sQ();if(z)X.Authorization=\`Bearer \${z}\`;return X}function y7(Z){if(typeof Z!=="object"||Z===null)return"";let X=Reflect.get(Z,"name");return typeof X==="string"?X:""}function h7(Z){let X=y7(Z);if(X==="AbortError"||X==="TimeoutError")return!0;return(typeof Z==="object"&&Z!==null?Reflect.get(Z,"code"):void 0)==="ABORT_ERR"}async function v7(Z,X,z,W={}){let{method:Y="POST",body:q,timeout:B=z.defaultTimeout}=W;try{let U={method:Y,headers:aQ(z),signal:AbortSignal.timeout(B)};if(q!==void 0)U.body=JSON.stringify(q);let G=await fetch(\`\${Z}\${X}\`,U);if(!G.ok)return console.warn(\`[\${z.logPrefix}] \${Y} \${X} failed: \${G.status}\`),{ok:!1,reason:"http",status:G.status};try{let H=await G.text();try{return{ok:!0,data:JSON.parse(H)}}catch{return console.warn(\`[\${z.logPrefix}] \${Y} \${X} returned invalid JSON (\${H.length} chars\${H.length===0?", empty body":""})\`),{ok:!1,reason:"invalid-json",status:G.status}}}catch(H){if(h7(H))return console.warn(\`[\${z.logPrefix}] \${Y} \${X} body read timed out after \${B}ms\`),{ok:!1,reason:"timeout"};return console.warn(\`[\${z.logPrefix}] \${Y} \${X} body read failed:\`,y7(H)||H),{ok:!1,reason:"body-read"}}}catch(U){if(h7(U))return console.warn(\`[\${z.logPrefix}] \${Y} \${X} timed out after \${B}ms\`),{ok:!1,reason:"timeout"};return console.warn(\`[\${z.logPrefix}] \${Y} \${X} error:\`,U),{ok:!1,reason:"offline"}}}function J5(Z,X){return{async post(z,W,Y=X.defaultTimeout){let q=await v7(Z,z,X,{method:"POST",body:W,timeout:Y});if(!q.ok)return null;return q.data},postResult(z,W,Y=X.defaultTimeout){return v7(Z,z,X,{method:"POST",body:W,timeout:Y})}}}import{homedir as rQ}from"node:os";import{join as tQ}from"node:path";function Y5(Z){let X=o0("SIGNET_PATH")??tQ(rQ(),".agents");return b7(X)??""}function eQ(Z){let X=Z.sessionManager.getBranch();if(Array.isArray(X)&&X.length>0)return X;let z=Z.sessionManager.getEntries();return Array.isArray(z)?z:[]}function T0(Z){let X=Z.sessionManager.getHeader(),z=p(Z.sessionManager.getSessionId())??p(X?.id),W=p(Z.sessionManager.getSessionFile()),Y=p(Z.cwd)??p(X?.cwd)??p(X?.project)??p(X?.workspace);return{sessionId:z,sessionFile:W,project:Y}}async function C8(Z,X){return await Z.client.post("/api/hooks/session-end",{harness:Z.config.harness,runtimePath:Z.config.runtimePath,reason:X.reason,sessionKey:X.sessionId,sessionId:X.sessionId,agentId:X.agentId,cwd:X.project,...X.transcript?{transcript:X.transcript}:{}},Z.config.writeTimeout)!==null}async function sZ(Z){for(let X of Z.state.getPendingSessionEnds()){if(Z.state.sessionAlreadyEnded(X.sessionId)){Z.state.clearPendingSessionEnd(X.sessionId);continue}let z=V6(X.sessionFile,Z.config.excludedCustomTypes);if(!z.loaded){await C8(Z,{sessionId:X.sessionId,agentId:X.agentId,transcript:void 0,reason:X.reason,project:void 0});continue}if(!await C8(Z,{sessionId:z.sessionId??X.sessionId,agentId:X.agentId,transcript:z.transcript,reason:X.reason,project:z.project}))continue;Z.state.markSessionEnded(X.sessionId),Z.state.clearPendingSessionData(X.sessionId),Z.state.clearPendingSessionEnd(X.sessionId)}}async function DZ(Z,X){await sZ(Z);let z=T0(X);Z.state.setActiveSession(z.sessionId,z.sessionFile),Z.state.clearSessionEnded(z.sessionId);let W=await Z.client.postResult("/api/hooks/session-start",{harness:Z.config.harness,project:z.project,agentId:Z.agentId,sessionKey:z.sessionId,runtimePath:Z.config.runtimePath},Z.config.sessionStartTimeout()),Y=W.ok?W.data.inject??W.data.recentContext??"":Z.config.staticFallback(W.reason==="timeout"?"timeout":"offline");Z.state.setSessionContext(Y),Z.state.setPendingSessionContext(z.sessionId,Y)}async function aZ(Z,X){await sZ(Z);let z=T0(X);if(!z.sessionId)return;if(z.sessionId===Z.state.getActiveSessionId()&&z.sessionFile===Z.state.getActiveSessionFile())return;await DZ(Z,X)}async function _6(Z,X,z){await sZ(Z);let W=T0(X);if(Z.state.sessionAlreadyEnded(W.sessionId))return;if(!await C8(Z,{sessionId:W.sessionId,agentId:Z.agentId,transcript:Y6(eQ(X),Z.config.excludedCustomTypes),reason:z,project:W.project}))return;Z.state.markSessionEnded(W.sessionId),Z.state.clearPendingSessionData(W.sessionId)}async function E8(Z,X,z){let W=p(X.previousSessionFile)??Z.state.getActiveSessionFile(),Y=V6(W,Z.config.excludedCustomTypes),q=Y.sessionId??Z.state.getActiveSessionId();if(Z.state.sessionAlreadyEnded(q))return;if(!Y.loaded){if(q)await C8(Z,{sessionId:q,agentId:Z.agentId,transcript:void 0,reason:z,project:void 0});if(q&&W)Z.state.queuePendingSessionEnd(q,W,Z.agentId,z);return}if(!await C8(Z,{sessionId:q,agentId:Z.agentId,transcript:Y.transcript,reason:z,project:Y.project})){if(q&&W)Z.state.queuePendingSessionEnd(q,W,Z.agentId,z);return}Z.state.markSessionEnded(q),Z.state.clearPendingSessionData(q)}async function I8(Z,X,z){await sZ(Z);let W=p(z);if(!W)return;await aZ(Z,X);let Y=T0(X);if(!Y.sessionId)return;let q=await Z.client.post("/api/hooks/user-prompt-submit",{harness:Z.config.harness,project:Y.project,agentId:Z.agentId,sessionKey:Y.sessionId,userMessage:W,runtimePath:Z.config.runtimePath},Z.config.promptSubmitTimeout);if(!q)return;if(q.sessionKnown===!1)await DZ(Z,X);let B=p(q.inject);if(B)Z.state.queuePendingRecall(Y.sessionId,B)}var V5=64,m7=4,u7=128;function _5(Z){return Z.replace(/<\\/signet-memory>/gi,"<\\\\/signet-memory>")}function B6(Z,X){if(Z.size<X)return;let z=Z.keys().next().value;if(z!==void 0)Z.delete(z)}class U6{pendingSessionContext=new Map;pendingRecall=new Map;pendingSessionEnds=new Map;endedSessions=new Map;activeSessionId;activeSessionFile;sessionContext="";setActiveSession(Z,X){this.activeSessionId=Z,this.activeSessionFile=X}getActiveSessionId(){return this.activeSessionId}getActiveSessionFile(){return this.activeSessionFile}setSessionContext(Z){this.sessionContext=Z}getSessionContext(){return this.sessionContext}markSessionEnded(Z){if(!Z)return;if(!this.endedSessions.has(Z))B6(this.endedSessions,u7);this.endedSessions.set(Z,Date.now())}clearSessionEnded(Z){if(!Z)return;this.endedSessions.delete(Z)}sessionAlreadyEnded(Z){if(!Z)return!1;return this.endedSessions.has(Z)}setPendingSessionContext(Z,X){if(!Z)return;let z=p(X);if(z){this.pendingSessionContext.set(Z,z);return}this.pendingSessionContext.delete(Z)}clearPendingSessionContext(Z){if(!Z)return;this.pendingSessionContext.delete(Z)}queuePendingRecall(Z,X){if(!this.pendingRecall.has(Z))B6(this.pendingRecall,V5);let z=this.pendingRecall.get(Z)??[];z.push(X);while(z.length>m7)z.shift();this.pendingRecall.set(Z,z)}clearPendingRecall(Z){if(!Z)return;this.pendingRecall.delete(Z)}clearPendingSessionData(Z){if(!Z)return;this.pendingSessionContext.delete(Z),this.pendingRecall.delete(Z),this.pendingSessionEnds.delete(Z)}hasPendingRecall(Z){if(!Z)return!1;let X=this.pendingRecall.get(Z);return Array.isArray(X)&&X.length>0}consumePendingRecall(Z){if(!Z)return;let X=this.pendingRecall.get(Z);if(!X||X.length===0)return;let z=X.shift();if(X.length===0)this.pendingRecall.delete(Z);return p(z)}queuePendingSessionEnd(Z,X,z,W){if(!this.pendingSessionEnds.has(Z))B6(this.pendingSessionEnds,V5);this.pendingSessionEnds.set(Z,{sessionId:Z,sessionFile:X,agentId:z,reason:W})}clearPendingSessionEnd(Z){if(!Z)return;this.pendingSessionEnds.delete(Z)}getPendingSessionEnds(){return Array.from(this.pendingSessionEnds.values())}}var D0={};m6(D0,{IsUndefined:()=>J0,IsUint8Array:()=>BZ,IsSymbol:()=>M5,IsString:()=>a,IsRegExp:()=>P8,IsObject:()=>n,IsNumber:()=>P0,IsNull:()=>q5,IsIterator:()=>G5,IsFunction:()=>U5,IsDate:()=>yZ,IsBoolean:()=>_Z,IsBigInt:()=>T8,IsAsyncIterator:()=>B5,IsArray:()=>H0,HasPropertyKey:()=>G6});function G6(Z,X){return X in Z}function B5(Z){return n(Z)&&!H0(Z)&&!BZ(Z)&&Symbol.asyncIterator in Z}function H0(Z){return Array.isArray(Z)}function T8(Z){return typeof Z==="bigint"}function _Z(Z){return typeof Z==="boolean"}function yZ(Z){return Z instanceof globalThis.Date}function U5(Z){return typeof Z==="function"}function G5(Z){return n(Z)&&!H0(Z)&&!BZ(Z)&&Symbol.iterator in Z}function q5(Z){return Z===null}function P0(Z){return typeof Z==="number"}function n(Z){return typeof Z==="object"&&Z!==null}function P8(Z){return Z instanceof globalThis.RegExp}function a(Z){return typeof Z==="string"}function M5(Z){return typeof Z==="symbol"}function BZ(Z){return Z instanceof globalThis.Uint8Array}function J0(Z){return Z===void 0}function Z1(Z){return Z.map((X)=>q6(X))}function X1(Z){return new Date(Z.getTime())}function z1(Z){return new Uint8Array(Z)}function $1(Z){return new RegExp(Z.source,Z.flags)}function Q1(Z){let X={};for(let z of Object.getOwnPropertyNames(Z))X[z]=q6(Z[z]);for(let z of Object.getOwnPropertySymbols(Z))X[z]=q6(Z[z]);return X}function q6(Z){return H0(Z)?Z1(Z):yZ(Z)?X1(Z):BZ(Z)?z1(Z):P8(Z)?$1(Z):n(Z)?Q1(Z):Z}function e(Z){return q6(Z)}function rZ(Z,X){return X===void 0?e(Z):e({...X,...Z})}function c7(Z){return Z!==null&&typeof Z==="object"}function d7(Z){return globalThis.Array.isArray(Z)&&!globalThis.ArrayBuffer.isView(Z)}function p7(Z){return Z===void 0}function l7(Z){return typeof Z==="number"}var M6;(function(Z){Z.InstanceMode="default",Z.ExactOptionalPropertyTypes=!1,Z.AllowArrayObject=!1,Z.AllowNaN=!1,Z.AllowNullVoid=!1;function X(B,U){return Z.ExactOptionalPropertyTypes?U in B:B[U]!==void 0}Z.IsExactOptionalProperty=X;function z(B){let U=c7(B);return Z.AllowArrayObject?U:U&&!d7(B)}Z.IsObjectLike=z;function W(B){return z(B)&&!(B instanceof Date)&&!(B instanceof Uint8Array)}Z.IsRecordLike=W;function Y(B){return Z.AllowNaN?l7(B):Number.isFinite(B)}Z.IsNumberLike=Y;function q(B){let U=p7(B);return Z.AllowNullVoid?U||B===null:U}Z.IsVoidLike=q})(M6||(M6={}));function W1(Z){return globalThis.Object.freeze(Z).map((X)=>w8(X))}function H1(Z){return Z}function J1(Z){return Z}function Y1(Z){return Z}function V1(Z){let X={};for(let z of Object.getOwnPropertyNames(Z))X[z]=w8(Z[z]);for(let z of Object.getOwnPropertySymbols(Z))X[z]=w8(Z[z]);return globalThis.Object.freeze(X)}function w8(Z){return H0(Z)?W1(Z):yZ(Z)?H1(Z):BZ(Z)?J1(Z):P8(Z)?Y1(Z):n(Z)?V1(Z):Z}function R(Z,X){let z=X!==void 0?{...X,...Z}:Z;switch(M6.InstanceMode){case"freeze":return w8(z);case"clone":return e(z);default:return z}}class A0 extends Error{constructor(Z){super(Z)}}var V0=Symbol.for("TypeBox.Transform"),s0=Symbol.for("TypeBox.Readonly"),L0=Symbol.for("TypeBox.Optional"),v0=Symbol.for("TypeBox.Hint"),I=Symbol.for("TypeBox.Kind");function tZ(Z){return n(Z)&&Z[s0]==="Readonly"}function S0(Z){return n(Z)&&Z[L0]==="Optional"}function A5(Z){return h(Z,"Any")}function L5(Z){return h(Z,"Argument")}function a0(Z){return h(Z,"Array")}function mZ(Z){return h(Z,"AsyncIterator")}function uZ(Z){return h(Z,"BigInt")}function UZ(Z){return h(Z,"Boolean")}function r0(Z){return h(Z,"Computed")}function t0(Z){return h(Z,"Constructor")}function _1(Z){return h(Z,"Date")}function e0(Z){return h(Z,"Function")}function ZZ(Z){return h(Z,"Integer")}function z0(Z){return h(Z,"Intersect")}function cZ(Z){return h(Z,"Iterator")}function h(Z,X){return n(Z)&&I in Z&&Z[I]===X}function A6(Z){return _Z(Z)||P0(Z)||a(Z)}function w0(Z){return h(Z,"Literal")}function k0(Z){return h(Z,"MappedKey")}function Z0(Z){return h(Z,"MappedResult")}function OZ(Z){return h(Z,"Never")}function B1(Z){return h(Z,"Not")}function k8(Z){return h(Z,"Null")}function XZ(Z){return h(Z,"Number")}function Y0(Z){return h(Z,"Object")}function dZ(Z){return h(Z,"Promise")}function pZ(Z){return h(Z,"Record")}function W0(Z){return h(Z,"Ref")}function D5(Z){return h(Z,"RegExp")}function GZ(Z){return h(Z,"String")}function f8(Z){return h(Z,"Symbol")}function f0(Z){return h(Z,"TemplateLiteral")}function U1(Z){return h(Z,"This")}function FZ(Z){return n(Z)&&V0 in Z}function b0(Z){return h(Z,"Tuple")}function b8(Z){return h(Z,"Undefined")}function v(Z){return h(Z,"Union")}function G1(Z){return h(Z,"Uint8Array")}function q1(Z){return h(Z,"Unknown")}function M1(Z){return h(Z,"Unsafe")}function A1(Z){return h(Z,"Void")}function L1(Z){return n(Z)&&I in Z&&a(Z[I])}function x0(Z){return A5(Z)||L5(Z)||a0(Z)||UZ(Z)||uZ(Z)||mZ(Z)||r0(Z)||t0(Z)||_1(Z)||e0(Z)||ZZ(Z)||z0(Z)||cZ(Z)||w0(Z)||k0(Z)||Z0(Z)||OZ(Z)||B1(Z)||k8(Z)||XZ(Z)||Y0(Z)||dZ(Z)||pZ(Z)||W0(Z)||D5(Z)||GZ(Z)||f8(Z)||f0(Z)||U1(Z)||b0(Z)||b8(Z)||v(Z)||G1(Z)||q1(Z)||M1(Z)||A1(Z)||L1(Z)}var O={};m6(O,{TypeGuardUnknownTypeError:()=>n7,IsVoid:()=>fX,IsUnsafe:()=>kX,IsUnknown:()=>wX,IsUnionLiteral:()=>C1,IsUnion:()=>N5,IsUndefined:()=>TX,IsUint8Array:()=>PX,IsTuple:()=>IX,IsTransform:()=>EX,IsThis:()=>CX,IsTemplateLiteral:()=>SX,IsSymbol:()=>RX,IsString:()=>jX,IsSchema:()=>M0,IsRegExp:()=>KX,IsRef:()=>NX,IsRecursive:()=>S1,IsRecord:()=>FX,IsReadonly:()=>N1,IsProperties:()=>L6,IsPromise:()=>OX,IsOptional:()=>K1,IsObject:()=>DX,IsNumber:()=>LX,IsNull:()=>AX,IsNot:()=>MX,IsNever:()=>qX,IsMappedResult:()=>GX,IsMappedKey:()=>UX,IsLiteralValue:()=>BX,IsLiteralString:()=>VX,IsLiteralNumber:()=>_X,IsLiteralBoolean:()=>R1,IsLiteral:()=>g8,IsKindOf:()=>g,IsKind:()=>bX,IsIterator:()=>YX,IsIntersect:()=>JX,IsInteger:()=>HX,IsImport:()=>j1,IsFunction:()=>WX,IsDate:()=>QX,IsConstructor:()=>$X,IsComputed:()=>zX,IsBoolean:()=>XX,IsBigInt:()=>ZX,IsAsyncIterator:()=>e7,IsArray:()=>t7,IsArgument:()=>r7,IsAny:()=>a7});class n7 extends A0{}var D1=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function i7(Z){try{return new RegExp(Z),!0}catch{return!1}}function O5(Z){if(!a(Z))return!1;for(let X=0;X<Z.length;X++){let z=Z.charCodeAt(X);if(z>=7&&z<=13||z===27||z===127)return!1}return!0}function o7(Z){return F5(Z)||M0(Z)}function x8(Z){return J0(Z)||T8(Z)}function r(Z){return J0(Z)||P0(Z)}function F5(Z){return J0(Z)||_Z(Z)}function i(Z){return J0(Z)||a(Z)}function O1(Z){return J0(Z)||a(Z)&&O5(Z)&&i7(Z)}function F1(Z){return J0(Z)||a(Z)&&O5(Z)}function s7(Z){return J0(Z)||M0(Z)}function N1(Z){return n(Z)&&Z[s0]==="Readonly"}function K1(Z){return n(Z)&&Z[L0]==="Optional"}function a7(Z){return g(Z,"Any")&&i(Z.$id)}function r7(Z){return g(Z,"Argument")&&P0(Z.index)}function t7(Z){return g(Z,"Array")&&Z.type==="array"&&i(Z.$id)&&M0(Z.items)&&r(Z.minItems)&&r(Z.maxItems)&&F5(Z.uniqueItems)&&s7(Z.contains)&&r(Z.minContains)&&r(Z.maxContains)}function e7(Z){return g(Z,"AsyncIterator")&&Z.type==="AsyncIterator"&&i(Z.$id)&&M0(Z.items)}function ZX(Z){return g(Z,"BigInt")&&Z.type==="bigint"&&i(Z.$id)&&x8(Z.exclusiveMaximum)&&x8(Z.exclusiveMinimum)&&x8(Z.maximum)&&x8(Z.minimum)&&x8(Z.multipleOf)}function XX(Z){return g(Z,"Boolean")&&Z.type==="boolean"&&i(Z.$id)}function zX(Z){return g(Z,"Computed")&&a(Z.target)&&H0(Z.parameters)&&Z.parameters.every((X)=>M0(X))}function $X(Z){return g(Z,"Constructor")&&Z.type==="Constructor"&&i(Z.$id)&&H0(Z.parameters)&&Z.parameters.every((X)=>M0(X))&&M0(Z.returns)}function QX(Z){return g(Z,"Date")&&Z.type==="Date"&&i(Z.$id)&&r(Z.exclusiveMaximumTimestamp)&&r(Z.exclusiveMinimumTimestamp)&&r(Z.maximumTimestamp)&&r(Z.minimumTimestamp)&&r(Z.multipleOfTimestamp)}function WX(Z){return g(Z,"Function")&&Z.type==="Function"&&i(Z.$id)&&H0(Z.parameters)&&Z.parameters.every((X)=>M0(X))&&M0(Z.returns)}function j1(Z){return g(Z,"Import")&&G6(Z,"$defs")&&n(Z.$defs)&&L6(Z.$defs)&&G6(Z,"$ref")&&a(Z.$ref)&&Z.$ref in Z.$defs}function HX(Z){return g(Z,"Integer")&&Z.type==="integer"&&i(Z.$id)&&r(Z.exclusiveMaximum)&&r(Z.exclusiveMinimum)&&r(Z.maximum)&&r(Z.minimum)&&r(Z.multipleOf)}function L6(Z){return n(Z)&&Object.entries(Z).every(([X,z])=>O5(X)&&M0(z))}function JX(Z){return g(Z,"Intersect")&&(a(Z.type)&&Z.type!=="object"?!1:!0)&&H0(Z.allOf)&&Z.allOf.every((X)=>M0(X)&&!EX(X))&&i(Z.type)&&(F5(Z.unevaluatedProperties)||s7(Z.unevaluatedProperties))&&i(Z.$id)}function YX(Z){return g(Z,"Iterator")&&Z.type==="Iterator"&&i(Z.$id)&&M0(Z.items)}function g(Z,X){return n(Z)&&I in Z&&Z[I]===X}function VX(Z){return g8(Z)&&a(Z.const)}function _X(Z){return g8(Z)&&P0(Z.const)}function R1(Z){return g8(Z)&&_Z(Z.const)}function g8(Z){return g(Z,"Literal")&&i(Z.$id)&&BX(Z.const)}function BX(Z){return _Z(Z)||P0(Z)||a(Z)}function UX(Z){return g(Z,"MappedKey")&&H0(Z.keys)&&Z.keys.every((X)=>P0(X)||a(X))}function GX(Z){return g(Z,"MappedResult")&&L6(Z.properties)}function qX(Z){return g(Z,"Never")&&n(Z.not)&&Object.getOwnPropertyNames(Z.not).length===0}function MX(Z){return g(Z,"Not")&&M0(Z.not)}function AX(Z){return g(Z,"Null")&&Z.type==="null"&&i(Z.$id)}function LX(Z){return g(Z,"Number")&&Z.type==="number"&&i(Z.$id)&&r(Z.exclusiveMaximum)&&r(Z.exclusiveMinimum)&&r(Z.maximum)&&r(Z.minimum)&&r(Z.multipleOf)}function DX(Z){return g(Z,"Object")&&Z.type==="object"&&i(Z.$id)&&L6(Z.properties)&&o7(Z.additionalProperties)&&r(Z.minProperties)&&r(Z.maxProperties)}function OX(Z){return g(Z,"Promise")&&Z.type==="Promise"&&i(Z.$id)&&M0(Z.item)}function FX(Z){return g(Z,"Record")&&Z.type==="object"&&i(Z.$id)&&o7(Z.additionalProperties)&&n(Z.patternProperties)&&((X)=>{let z=Object.getOwnPropertyNames(X.patternProperties);return z.length===1&&i7(z[0])&&n(X.patternProperties)&&M0(X.patternProperties[z[0]])})(Z)}function S1(Z){return n(Z)&&v0 in Z&&Z[v0]==="Recursive"}function NX(Z){return g(Z,"Ref")&&i(Z.$id)&&a(Z.$ref)}function KX(Z){return g(Z,"RegExp")&&i(Z.$id)&&a(Z.source)&&a(Z.flags)&&r(Z.maxLength)&&r(Z.minLength)}function jX(Z){return g(Z,"String")&&Z.type==="string"&&i(Z.$id)&&r(Z.minLength)&&r(Z.maxLength)&&O1(Z.pattern)&&F1(Z.format)}function RX(Z){return g(Z,"Symbol")&&Z.type==="symbol"&&i(Z.$id)}function SX(Z){return g(Z,"TemplateLiteral")&&Z.type==="string"&&a(Z.pattern)&&Z.pattern[0]==="^"&&Z.pattern[Z.pattern.length-1]==="$"}function CX(Z){return g(Z,"This")&&i(Z.$id)&&a(Z.$ref)}function EX(Z){return n(Z)&&V0 in Z}function IX(Z){return g(Z,"Tuple")&&Z.type==="array"&&i(Z.$id)&&P0(Z.minItems)&&P0(Z.maxItems)&&Z.minItems===Z.maxItems&&(J0(Z.items)&&J0(Z.additionalItems)&&Z.minItems===0||H0(Z.items)&&Z.items.every((X)=>M0(X)))}function TX(Z){return g(Z,"Undefined")&&Z.type==="undefined"&&i(Z.$id)}function C1(Z){return N5(Z)&&Z.anyOf.every((X)=>VX(X)||_X(X))}function N5(Z){return g(Z,"Union")&&i(Z.$id)&&n(Z)&&H0(Z.anyOf)&&Z.anyOf.every((X)=>M0(X))}function PX(Z){return g(Z,"Uint8Array")&&Z.type==="Uint8Array"&&i(Z.$id)&&r(Z.minByteLength)&&r(Z.maxByteLength)}function wX(Z){return g(Z,"Unknown")&&i(Z.$id)}function kX(Z){return g(Z,"Unsafe")}function fX(Z){return g(Z,"Void")&&Z.type==="void"&&i(Z.$id)}function bX(Z){return n(Z)&&I in Z&&a(Z[I])&&!D1.includes(Z[I])}function M0(Z){return n(Z)&&(a7(Z)||r7(Z)||t7(Z)||XX(Z)||ZX(Z)||e7(Z)||zX(Z)||$X(Z)||QX(Z)||WX(Z)||HX(Z)||JX(Z)||YX(Z)||g8(Z)||UX(Z)||GX(Z)||qX(Z)||MX(Z)||AX(Z)||LX(Z)||DX(Z)||OX(Z)||FX(Z)||NX(Z)||KX(Z)||jX(Z)||RX(Z)||SX(Z)||CX(Z)||IX(Z)||TX(Z)||N5(Z)||PX(Z)||wX(Z)||kX(Z)||fX(Z)||bX(Z))}var xX="(true|false)",D6="(0|[1-9][0-9]*)",gX="(.*)";var NZ="^(0|[1-9][0-9]*)$",KZ="^(.*)$",hX="^(?!.*)$";function vX(Z,X){return Z.includes(X)}function yX(Z){return[...new Set(Z)]}function E1(Z,X){return Z.filter((z)=>X.includes(z))}function I1(Z,X){return Z.reduce((z,W)=>{return E1(z,W)},X)}function mX(Z){return Z.length===1?Z[0]:Z.length>1?I1(Z.slice(1),Z[0]):[]}function uX(Z){let X=[];for(let z of Z)X.push(...z);return X}function jZ(Z){return R({[I]:"Any"},Z)}function eZ(Z,X){return R({[I]:"Array",type:"array",items:Z},X)}function cX(Z){return R({[I]:"Argument",index:Z})}function Z8(Z,X){return R({[I]:"AsyncIterator",type:"AsyncIterator",items:Z},X)}function t(Z,X,z){return R({[I]:"Computed",target:Z,parameters:X},z)}function T1(Z,X){let{[X]:z,...W}=Z;return W}function $0(Z,X){return X.reduce((z,W)=>T1(z,W),Z)}function y(Z){return R({[I]:"Never",not:{}},Z)}function m(Z){return R({[I]:"MappedResult",properties:Z})}function X8(Z,X,z){return R({[I]:"Constructor",type:"Constructor",parameters:Z,returns:X},z)}function WZ(Z,X,z){return R({[I]:"Function",type:"Function",parameters:Z,returns:X},z)}function h8(Z,X){return R({[I]:"Union",anyOf:Z},X)}function P1(Z){return Z.some((X)=>S0(X))}function dX(Z){return Z.map((X)=>S0(X)?w1(X):X)}function w1(Z){return $0(Z,[L0])}function k1(Z,X){return P1(Z)?O0(h8(dX(Z),X)):h8(dX(Z),X)}function HZ(Z,X){return Z.length===1?R(Z[0],X):Z.length===0?y(X):k1(Z,X)}function d(Z,X){return Z.length===0?y(X):Z.length===1?R(Z[0],X):h8(Z,X)}class K5 extends A0{}function f1(Z){return Z.replace(/\\\\\\$/g,"$").replace(/\\\\\\*/g,"*").replace(/\\\\\\^/g,"^").replace(/\\\\\\|/g,"|").replace(/\\\\\\(/g,"(").replace(/\\\\\\)/g,")")}function j5(Z,X,z){return Z[X]===z&&Z.charCodeAt(X-1)!==92}function MZ(Z,X){return j5(Z,X,"(")}function v8(Z,X){return j5(Z,X,")")}function pX(Z,X){return j5(Z,X,"|")}function b1(Z){if(!(MZ(Z,0)&&v8(Z,Z.length-1)))return!1;let X=0;for(let z=0;z<Z.length;z++){if(MZ(Z,z))X+=1;if(v8(Z,z))X-=1;if(X===0&&z!==Z.length-1)return!1}return!0}function x1(Z){return Z.slice(1,Z.length-1)}function g1(Z){let X=0;for(let z=0;z<Z.length;z++){if(MZ(Z,z))X+=1;if(v8(Z,z))X-=1;if(pX(Z,z)&&X===0)return!0}return!1}function h1(Z){for(let X=0;X<Z.length;X++)if(MZ(Z,X))return!0;return!1}function v1(Z){let[X,z]=[0,0],W=[];for(let q=0;q<Z.length;q++){if(MZ(Z,q))X+=1;if(v8(Z,q))X-=1;if(pX(Z,q)&&X===0){let B=Z.slice(z,q);if(B.length>0)W.push(z8(B));z=q+1}}let Y=Z.slice(z);if(Y.length>0)W.push(z8(Y));if(W.length===0)return{type:"const",const:""};if(W.length===1)return W[0];return{type:"or",expr:W}}function y1(Z){function X(Y,q){if(!MZ(Y,q))throw new K5("TemplateLiteralParser: Index must point to open parens");let B=0;for(let U=q;U<Y.length;U++){if(MZ(Y,U))B+=1;if(v8(Y,U))B-=1;if(B===0)return[q,U]}throw new K5("TemplateLiteralParser: Unclosed group parens in expression")}function z(Y,q){for(let B=q;B<Y.length;B++)if(MZ(Y,B))return[q,B];return[q,Y.length]}let W=[];for(let Y=0;Y<Z.length;Y++)if(MZ(Z,Y)){let[q,B]=X(Z,Y),U=Z.slice(q,B+1);W.push(z8(U)),Y=B}else{let[q,B]=z(Z,Y),U=Z.slice(q,B);if(U.length>0)W.push(z8(U));Y=B-1}return W.length===0?{type:"const",const:""}:W.length===1?W[0]:{type:"and",expr:W}}function z8(Z){return b1(Z)?z8(x1(Z)):g1(Z)?v1(Z):h1(Z)?y1(Z):{type:"const",const:f1(Z)}}function $8(Z){return z8(Z.slice(1,Z.length-1))}class lX extends A0{}function m1(Z){return Z.type==="or"&&Z.expr.length===2&&Z.expr[0].type==="const"&&Z.expr[0].const==="0"&&Z.expr[1].type==="const"&&Z.expr[1].const==="[1-9][0-9]*"}function u1(Z){return Z.type==="or"&&Z.expr.length===2&&Z.expr[0].type==="const"&&Z.expr[0].const==="true"&&Z.expr[1].type==="const"&&Z.expr[1].const==="false"}function c1(Z){return Z.type==="const"&&Z.const===".*"}function lZ(Z){return m1(Z)||c1(Z)?!1:u1(Z)?!0:Z.type==="and"?Z.expr.every((X)=>lZ(X)):Z.type==="or"?Z.expr.every((X)=>lZ(X)):Z.type==="const"?!0:(()=>{throw new lX("Unknown expression type")})()}function nX(Z){let X=$8(Z.pattern);return lZ(X)}class iX extends A0{}function*oX(Z){if(Z.length===1)return yield*Z[0];for(let X of Z[0])for(let z of oX(Z.slice(1)))yield\`\${X}\${z}\`}function*d1(Z){return yield*oX(Z.expr.map((X)=>[...y8(X)]))}function*p1(Z){for(let X of Z.expr)yield*y8(X)}function*l1(Z){return yield Z.const}function*y8(Z){return Z.type==="and"?yield*d1(Z):Z.type==="or"?yield*p1(Z):Z.type==="const"?yield*l1(Z):(()=>{throw new iX("Unknown expression")})()}function O6(Z){let X=$8(Z.pattern);return lZ(X)?[...y8(X)]:[]}function c(Z,X){return R({[I]:"Literal",const:Z,type:typeof Z},X)}function F6(Z){return R({[I]:"Boolean",type:"boolean"},Z)}function Q8(Z){return R({[I]:"BigInt",type:"bigint"},Z)}function y0(Z){return R({[I]:"Number",type:"number"},Z)}function zZ(Z){return R({[I]:"String",type:"string"},Z)}function*n1(Z){let X=Z.trim().replace(/"|'/g,"");return X==="boolean"?yield F6():X==="number"?yield y0():X==="bigint"?yield Q8():X==="string"?yield zZ():yield(()=>{let z=X.split("|").map((W)=>c(W.trim()));return z.length===0?y():z.length===1?z[0]:HZ(z)})()}function*i1(Z){if(Z[1]!=="{"){let X=c("$"),z=R5(Z.slice(1));return yield*[X,...z]}for(let X=2;X<Z.length;X++)if(Z[X]==="}"){let z=n1(Z.slice(2,X)),W=R5(Z.slice(X+1));return yield*[...z,...W]}yield c(Z)}function*R5(Z){for(let X=0;X<Z.length;X++)if(Z[X]==="$"){let z=c(Z.slice(0,X)),W=i1(Z.slice(X));return yield*[z,...W]}yield c(Z)}function sX(Z){return[...R5(Z)]}class aX extends A0{}function o1(Z){return Z.replace(/[.*+?^\${}()|[\\]\\\\]/g,"\\\\$&")}function rX(Z,X){return f0(Z)?Z.pattern.slice(1,Z.pattern.length-1):v(Z)?\`(\${Z.anyOf.map((z)=>rX(z,X)).join("|")})\`:XZ(Z)?\`\${X}\${D6}\`:ZZ(Z)?\`\${X}\${D6}\`:uZ(Z)?\`\${X}\${D6}\`:GZ(Z)?\`\${X}\${gX}\`:w0(Z)?\`\${X}\${o1(Z.const.toString())}\`:UZ(Z)?\`\${X}\${xX}\`:(()=>{throw new aX(\`Unexpected Kind '\${Z[I]}'\`)})()}function S5(Z){return\`^\${Z.map((X)=>rX(X,"")).join("")}$\`}function nZ(Z){let z=O6(Z).map((W)=>c(W));return HZ(z)}function N6(Z,X){let z=a(Z)?S5(sX(Z)):S5(Z);return R({[I]:"TemplateLiteral",type:"string",pattern:z},X)}function s1(Z){return O6(Z).map((z)=>z.toString())}function a1(Z){let X=[];for(let z of Z)X.push(...C0(z));return X}function r1(Z){return[Z.toString()]}function C0(Z){return[...new Set(f0(Z)?s1(Z):v(Z)?a1(Z.anyOf):w0(Z)?r1(Z.const):XZ(Z)?["[number]"]:ZZ(Z)?["[number]"]:[])]}function t1(Z,X,z){let W={};for(let Y of Object.getOwnPropertyNames(X))W[Y]=RZ(Z,C0(X[Y]),z);return W}function e1(Z,X,z){return t1(Z,X.properties,z)}function tX(Z,X,z){let W=e1(Z,X,z);return m(W)}function Z2(Z,X){return Z.map((z)=>X2(z,X))}function ZW(Z){return Z.filter((X)=>!OZ(X))}function XW(Z,X){return K6(ZW(Z2(Z,X)))}function zW(Z){return Z.some((X)=>OZ(X))?[]:Z}function $W(Z,X){return HZ(zW(Z2(Z,X)))}function QW(Z,X){return X in Z?Z[X]:X==="[number]"?HZ(Z):y()}function WW(Z,X){return X==="[number]"?Z:y()}function HW(Z,X){return X in Z?Z[X]:y()}function X2(Z,X){return z0(Z)?XW(Z.allOf,X):v(Z)?$W(Z.anyOf,X):b0(Z)?QW(Z.items??[],X):a0(Z)?WW(Z.items,X):Y0(Z)?HW(Z.properties,X):y()}function C5(Z,X){return X.map((z)=>X2(Z,z))}function eX(Z,X){return HZ(C5(Z,X))}function RZ(Z,X,z){if(W0(Z)||W0(X)){if(!x0(Z)||!x0(X))throw new A0("Index types using Ref parameters require both Type and Key to be of TSchema");return t("Index",[Z,X])}if(Z0(X))return tX(Z,X,z);if(k0(X))return z2(Z,X,z);return R(x0(X)?eX(Z,C0(X)):eX(Z,X),z)}function JW(Z,X,z){return{[X]:RZ(Z,[X],e(z))}}function YW(Z,X,z){return X.reduce((W,Y)=>{return{...W,...JW(Z,Y,z)}},{})}function VW(Z,X,z){return YW(Z,X.keys,z)}function z2(Z,X,z){let W=VW(Z,X,z);return m(W)}function W8(Z,X){return R({[I]:"Iterator",type:"Iterator",items:Z},X)}function _W(Z){return globalThis.Object.keys(Z).filter((X)=>!S0(Z[X]))}function BW(Z,X){let z=_W(Z),W=z.length>0?{[I]:"Object",type:"object",required:z,properties:Z}:{[I]:"Object",type:"object",properties:Z};return R(W,X)}var o=BW;function j6(Z,X){return R({[I]:"Promise",type:"Promise",item:Z},X)}function UW(Z){return R($0(Z,[s0]))}function GW(Z){return R({...Z,[s0]:"Readonly"})}function qW(Z,X){return X===!1?UW(Z):GW(Z)}function E0(Z,X){let z=X??!0;return Z0(Z)?$2(Z,z):qW(Z,z)}function MW(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=E0(Z[W],X);return z}function AW(Z,X){return MW(Z.properties,X)}function $2(Z,X){let z=AW(Z,X);return m(z)}function m0(Z,X){return R(Z.length>0?{[I]:"Tuple",type:"array",items:Z,additionalItems:!1,minItems:Z.length,maxItems:Z.length}:{[I]:"Tuple",type:"array",minItems:Z.length,maxItems:Z.length},X)}function Q2(Z,X){return Z in X?u0(Z,X[Z]):m(X)}function LW(Z){return{[Z]:c(Z)}}function DW(Z){let X={};for(let z of Z)X[z]=c(z);return X}function OW(Z,X){return vX(X,Z)?LW(Z):DW(X)}function FW(Z,X){let z=OW(Z,X);return Q2(Z,z)}function m8(Z,X){return X.map((z)=>u0(Z,z))}function NW(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(X))z[W]=u0(Z,X[W]);return z}function u0(Z,X){let z={...X};return S0(X)?O0(u0(Z,$0(X,[L0]))):tZ(X)?E0(u0(Z,$0(X,[s0]))):Z0(X)?Q2(Z,X.properties):k0(X)?FW(Z,X.keys):t0(X)?X8(m8(Z,X.parameters),u0(Z,X.returns),z):e0(X)?WZ(m8(Z,X.parameters),u0(Z,X.returns),z):mZ(X)?Z8(u0(Z,X.items),z):cZ(X)?W8(u0(Z,X.items),z):z0(X)?F0(m8(Z,X.allOf),z):v(X)?d(m8(Z,X.anyOf),z):b0(X)?m0(m8(Z,X.items??[]),z):Y0(X)?o(NW(Z,X.properties),z):a0(X)?eZ(u0(Z,X.items),z):dZ(X)?j6(u0(Z,X.item),z):X}function KW(Z,X){let z={};for(let W of Z)z[W]=u0(W,X);return z}function W2(Z,X,z){let W=x0(Z)?C0(Z):Z,Y=X({[I]:"MappedKey",keys:W}),q=KW(W,Y);return o(q,z)}function jW(Z){return R($0(Z,[L0]))}function RW(Z){return R({...Z,[L0]:"Optional"})}function SW(Z,X){return X===!1?jW(Z):RW(Z)}function O0(Z,X){let z=X??!0;return Z0(Z)?H2(Z,z):SW(Z,z)}function CW(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=O0(Z[W],X);return z}function EW(Z,X){return CW(Z.properties,X)}function H2(Z,X){let z=EW(Z,X);return m(z)}function u8(Z,X={}){let z=Z.every((Y)=>Y0(Y)),W=x0(X.unevaluatedProperties)?{unevaluatedProperties:X.unevaluatedProperties}:{};return R(X.unevaluatedProperties===!1||x0(X.unevaluatedProperties)||z?{...W,[I]:"Intersect",type:"object",allOf:Z}:{...W,[I]:"Intersect",allOf:Z},X)}function IW(Z){return Z.every((X)=>S0(X))}function TW(Z){return $0(Z,[L0])}function J2(Z){return Z.map((X)=>S0(X)?TW(X):X)}function PW(Z,X){return IW(Z)?O0(u8(J2(Z),X)):u8(J2(Z),X)}function K6(Z,X={}){if(Z.length===1)return R(Z[0],X);if(Z.length===0)return y(X);if(Z.some((z)=>FZ(z)))throw Error("Cannot intersect transform types");return PW(Z,X)}function F0(Z,X){if(Z.length===1)return R(Z[0],X);if(Z.length===0)return y(X);if(Z.some((z)=>FZ(z)))throw Error("Cannot intersect transform types");return u8(Z,X)}function JZ(...Z){let[X,z]=typeof Z[0]==="string"?[Z[0],Z[1]]:[Z[0].$id,Z[1]];if(typeof X!=="string")throw new A0("Ref: $ref must be a string");return R({[I]:"Ref",$ref:X},z)}function wW(Z,X){return t("Awaited",[t(Z,X)])}function kW(Z){return t("Awaited",[JZ(Z)])}function fW(Z){return F0(Y2(Z))}function bW(Z){return d(Y2(Z))}function xW(Z){return H8(Z)}function Y2(Z){return Z.map((X)=>H8(X))}function H8(Z,X){return R(r0(Z)?wW(Z.target,Z.parameters):z0(Z)?fW(Z.allOf):v(Z)?bW(Z.anyOf):dZ(Z)?xW(Z.item):W0(Z)?kW(Z.$ref):Z,X)}function V2(Z){let X=[];for(let z of Z)X.push(c8(z));return X}function gW(Z){let X=V2(Z);return uX(X)}function hW(Z){let X=V2(Z);return mX(X)}function vW(Z){return Z.map((X,z)=>z.toString())}function yW(Z){return["[number]"]}function mW(Z){return globalThis.Object.getOwnPropertyNames(Z)}function uW(Z){if(!cW)return[];return globalThis.Object.getOwnPropertyNames(Z).map((z)=>{return z[0]==="^"&&z[z.length-1]==="$"?z.slice(1,z.length-1):z})}function c8(Z){return z0(Z)?gW(Z.allOf):v(Z)?hW(Z.anyOf):b0(Z)?vW(Z.items??[]):a0(Z)?yW(Z.items):Y0(Z)?mW(Z.properties):pZ(Z)?uW(Z.patternProperties):[]}var cW=!1;function dW(Z,X){return t("KeyOf",[t(Z,X)])}function pW(Z){return t("KeyOf",[JZ(Z)])}function lW(Z,X){let z=c8(Z),W=nW(z),Y=HZ(W);return R(Y,X)}function nW(Z){return Z.map((X)=>X==="[number]"?y0():c(X))}function J8(Z,X){return r0(Z)?dW(Z.target,Z.parameters):W0(Z)?pW(Z.$ref):Z0(Z)?_2(Z,X):lW(Z,X)}function iW(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=J8(Z[W],e(X));return z}function oW(Z,X){return iW(Z.properties,X)}function _2(Z,X){let z=oW(Z,X);return m(z)}function sW(Z){let X=[];for(let z of Z)X.push(...c8(z));return yX(X)}function aW(Z){return Z.filter((X)=>!OZ(X))}function rW(Z,X){let z=[];for(let W of Z)z.push(...C5(W,[X]));return aW(z)}function tW(Z,X){let z={};for(let W of X)z[W]=K6(rW(Z,W));return z}function B2(Z,X){let z=sW(Z),W=tW(Z,z);return o(W,X)}function R6(Z){return R({[I]:"Date",type:"Date"},Z)}function S6(Z){return R({[I]:"Null",type:"null"},Z)}function C6(Z){return R({[I]:"Symbol",type:"symbol"},Z)}function E6(Z){return R({[I]:"Undefined",type:"undefined"},Z)}function I6(Z){return R({[I]:"Uint8Array",type:"Uint8Array"},Z)}function SZ(Z){return R({[I]:"Unknown"},Z)}function eW(Z){return Z.map((X)=>E5(X,!1))}function Z4(Z){let X={};for(let z of globalThis.Object.getOwnPropertyNames(Z))X[z]=E0(E5(Z[z],!1));return X}function T6(Z,X){return X===!0?Z:E0(Z)}function E5(Z,X){return B5(Z)?T6(jZ(),X):G5(Z)?T6(jZ(),X):H0(Z)?E0(m0(eW(Z))):BZ(Z)?I6():yZ(Z)?R6():n(Z)?T6(o(Z4(Z)),X):U5(Z)?T6(WZ([],SZ()),X):J0(Z)?E6():q5(Z)?S6():M5(Z)?C6():T8(Z)?Q8():P0(Z)?c(Z):_Z(Z)?c(Z):a(Z)?c(Z):o({})}function U2(Z,X){return R(E5(Z,!0),X)}function G2(Z,X){return t0(Z)?m0(Z.parameters,X):y(X)}function q2(Z,X){if(J0(Z))throw Error("Enum undefined or empty");let z=globalThis.Object.getOwnPropertyNames(Z).filter((q)=>isNaN(q)).map((q)=>Z[q]),Y=[...new Set(z)].map((q)=>c(q));return d(Y,{...X,[v0]:"Enum"})}class O2 extends A0{}var S;(function(Z){Z[Z.Union=0]="Union",Z[Z.True=1]="True",Z[Z.False=2]="False"})(S||(S={}));function c0(Z){return Z===S.False?Z:S.True}function Y8(Z){throw new O2(Z)}function _0(Z){return O.IsNever(Z)||O.IsIntersect(Z)||O.IsUnion(Z)||O.IsUnknown(Z)||O.IsAny(Z)}function B0(Z,X){return O.IsNever(X)?K2(Z,X):O.IsIntersect(X)?P6(Z,X):O.IsUnion(X)?k5(Z,X):O.IsUnknown(X)?C2(Z,X):O.IsAny(X)?w5(Z,X):Y8("StructuralRight")}function w5(Z,X){return S.True}function X4(Z,X){return O.IsIntersect(X)?P6(Z,X):O.IsUnion(X)&&X.anyOf.some((z)=>O.IsAny(z)||O.IsUnknown(z))?S.True:O.IsUnion(X)?S.Union:O.IsUnknown(X)?S.True:O.IsAny(X)?S.True:S.Union}function z4(Z,X){return O.IsUnknown(Z)?S.False:O.IsAny(Z)?S.Union:O.IsNever(Z)?S.True:S.False}function $4(Z,X){return O.IsObject(X)&&w6(X)?S.True:_0(X)?B0(Z,X):!O.IsArray(X)?S.False:c0(s(Z.items,X.items))}function Q4(Z,X){return _0(X)?B0(Z,X):!O.IsAsyncIterator(X)?S.False:c0(s(Z.items,X.items))}function W4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsBigInt(X)?S.True:S.False}function F2(Z,X){return O.IsLiteralBoolean(Z)?S.True:O.IsBoolean(Z)?S.True:S.False}function H4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsBoolean(X)?S.True:S.False}function J4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):!O.IsConstructor(X)?S.False:Z.parameters.length>X.parameters.length?S.False:!Z.parameters.every((z,W)=>c0(s(X.parameters[W],z))===S.True)?S.False:c0(s(Z.returns,X.returns))}function Y4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsDate(X)?S.True:S.False}function V4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):!O.IsFunction(X)?S.False:Z.parameters.length>X.parameters.length?S.False:!Z.parameters.every((z,W)=>c0(s(X.parameters[W],z))===S.True)?S.False:c0(s(Z.returns,X.returns))}function N2(Z,X){return O.IsLiteral(Z)&&D0.IsNumber(Z.const)?S.True:O.IsNumber(Z)||O.IsInteger(Z)?S.True:S.False}function _4(Z,X){return O.IsInteger(X)||O.IsNumber(X)?S.True:_0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):S.False}function P6(Z,X){return X.allOf.every((z)=>s(Z,z)===S.True)?S.True:S.False}function B4(Z,X){return Z.allOf.some((z)=>s(z,X)===S.True)?S.True:S.False}function U4(Z,X){return _0(X)?B0(Z,X):!O.IsIterator(X)?S.False:c0(s(Z.items,X.items))}function G4(Z,X){return O.IsLiteral(X)&&X.const===Z.const?S.True:_0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsString(X)?S2(Z,X):O.IsNumber(X)?j2(Z,X):O.IsInteger(X)?N2(Z,X):O.IsBoolean(X)?F2(Z,X):S.False}function K2(Z,X){return S.False}function q4(Z,X){return S.True}function M2(Z){let[X,z]=[Z,0];while(!0){if(!O.IsNot(X))break;X=X.not,z+=1}return z%2===0?X:SZ()}function M4(Z,X){return O.IsNot(Z)?s(M2(Z),X):O.IsNot(X)?s(Z,M2(X)):Y8("Invalid fallthrough for Not")}function A4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsNull(X)?S.True:S.False}function j2(Z,X){return O.IsLiteralNumber(Z)?S.True:O.IsNumber(Z)||O.IsInteger(Z)?S.True:S.False}function L4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsInteger(X)||O.IsNumber(X)?S.True:S.False}function I0(Z,X){return Object.getOwnPropertyNames(Z.properties).length===X}function A2(Z){return w6(Z)}function L2(Z){return I0(Z,0)||I0(Z,1)&&"description"in Z.properties&&O.IsUnion(Z.properties.description)&&Z.properties.description.anyOf.length===2&&(O.IsString(Z.properties.description.anyOf[0])&&O.IsUndefined(Z.properties.description.anyOf[1])||O.IsString(Z.properties.description.anyOf[1])&&O.IsUndefined(Z.properties.description.anyOf[0]))}function I5(Z){return I0(Z,0)}function D2(Z){return I0(Z,0)}function D4(Z){return I0(Z,0)}function O4(Z){return I0(Z,0)}function F4(Z){return w6(Z)}function N4(Z){let X=y0();return I0(Z,0)||I0(Z,1)&&"length"in Z.properties&&c0(s(Z.properties.length,X))===S.True}function K4(Z){return I0(Z,0)}function w6(Z){let X=y0();return I0(Z,0)||I0(Z,1)&&"length"in Z.properties&&c0(s(Z.properties.length,X))===S.True}function j4(Z){let X=WZ([jZ()],jZ());return I0(Z,0)||I0(Z,1)&&"then"in Z.properties&&c0(s(Z.properties.then,X))===S.True}function R2(Z,X){return s(Z,X)===S.False?S.False:O.IsOptional(Z)&&!O.IsOptional(X)?S.False:S.True}function N0(Z,X){return O.IsUnknown(Z)?S.False:O.IsAny(Z)?S.Union:O.IsNever(Z)||O.IsLiteralString(Z)&&A2(X)||O.IsLiteralNumber(Z)&&I5(X)||O.IsLiteralBoolean(Z)&&D2(X)||O.IsSymbol(Z)&&L2(X)||O.IsBigInt(Z)&&D4(X)||O.IsString(Z)&&A2(X)||O.IsSymbol(Z)&&L2(X)||O.IsNumber(Z)&&I5(X)||O.IsInteger(Z)&&I5(X)||O.IsBoolean(Z)&&D2(X)||O.IsUint8Array(Z)&&F4(X)||O.IsDate(Z)&&O4(X)||O.IsConstructor(Z)&&K4(X)||O.IsFunction(Z)&&N4(X)?S.True:O.IsRecord(Z)&&O.IsString(T5(Z))?(()=>{return X[v0]==="Record"?S.True:S.False})():O.IsRecord(Z)&&O.IsNumber(T5(Z))?(()=>{return I0(X,0)?S.True:S.False})():S.False}function R4(Z,X){return _0(X)?B0(Z,X):O.IsRecord(X)?d0(Z,X):!O.IsObject(X)?S.False:(()=>{for(let z of Object.getOwnPropertyNames(X.properties)){if(!(z in Z.properties)&&!O.IsOptional(X.properties[z]))return S.False;if(O.IsOptional(X.properties[z]))return S.True;if(R2(Z.properties[z],X.properties[z])===S.False)return S.False}return S.True})()}function S4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)&&j4(X)?S.True:!O.IsPromise(X)?S.False:c0(s(Z.item,X.item))}function T5(Z){return NZ in Z.patternProperties?y0():(KZ in Z.patternProperties)?zZ():Y8("Unknown record key pattern")}function P5(Z){return NZ in Z.patternProperties?Z.patternProperties[NZ]:(KZ in Z.patternProperties)?Z.patternProperties[KZ]:Y8("Unable to get record value schema")}function d0(Z,X){let[z,W]=[T5(X),P5(X)];return O.IsLiteralString(Z)&&O.IsNumber(z)&&c0(s(Z,W))===S.True?S.True:O.IsUint8Array(Z)&&O.IsNumber(z)?s(Z,W):O.IsString(Z)&&O.IsNumber(z)?s(Z,W):O.IsArray(Z)&&O.IsNumber(z)?s(Z,W):O.IsObject(Z)?(()=>{for(let Y of Object.getOwnPropertyNames(Z.properties))if(R2(W,Z.properties[Y])===S.False)return S.False;return S.True})():S.False}function C4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):!O.IsRecord(X)?S.False:s(P5(Z),P5(X))}function E4(Z,X){let z=O.IsRegExp(Z)?zZ():Z,W=O.IsRegExp(X)?zZ():X;return s(z,W)}function S2(Z,X){return O.IsLiteral(Z)&&D0.IsString(Z.const)?S.True:O.IsString(Z)?S.True:S.False}function I4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsString(X)?S.True:S.False}function T4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsSymbol(X)?S.True:S.False}function P4(Z,X){return O.IsTemplateLiteral(Z)?s(nZ(Z),X):O.IsTemplateLiteral(X)?s(Z,nZ(X)):Y8("Invalid fallthrough for TemplateLiteral")}function w4(Z,X){return O.IsArray(X)&&Z.items!==void 0&&Z.items.every((z)=>s(z,X.items)===S.True)}function k4(Z,X){return O.IsNever(Z)?S.True:O.IsUnknown(Z)?S.False:O.IsAny(Z)?S.Union:S.False}function f4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)&&w6(X)?S.True:O.IsArray(X)&&w4(Z,X)?S.True:!O.IsTuple(X)?S.False:D0.IsUndefined(Z.items)&&!D0.IsUndefined(X.items)||!D0.IsUndefined(Z.items)&&D0.IsUndefined(X.items)?S.False:D0.IsUndefined(Z.items)&&!D0.IsUndefined(X.items)?S.True:Z.items.every((z,W)=>s(z,X.items[W])===S.True)?S.True:S.False}function b4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsUint8Array(X)?S.True:S.False}function x4(Z,X){return _0(X)?B0(Z,X):O.IsObject(X)?N0(Z,X):O.IsRecord(X)?d0(Z,X):O.IsVoid(X)?v4(Z,X):O.IsUndefined(X)?S.True:S.False}function k5(Z,X){return X.anyOf.some((z)=>s(Z,z)===S.True)?S.True:S.False}function g4(Z,X){return Z.anyOf.every((z)=>s(z,X)===S.True)?S.True:S.False}function C2(Z,X){return S.True}function h4(Z,X){return O.IsNever(X)?K2(Z,X):O.IsIntersect(X)?P6(Z,X):O.IsUnion(X)?k5(Z,X):O.IsAny(X)?w5(Z,X):O.IsString(X)?S2(Z,X):O.IsNumber(X)?j2(Z,X):O.IsInteger(X)?N2(Z,X):O.IsBoolean(X)?F2(Z,X):O.IsArray(X)?z4(Z,X):O.IsTuple(X)?k4(Z,X):O.IsObject(X)?N0(Z,X):O.IsUnknown(X)?S.True:S.False}function v4(Z,X){return O.IsUndefined(Z)?S.True:O.IsUndefined(Z)?S.True:S.False}function y4(Z,X){return O.IsIntersect(X)?P6(Z,X):O.IsUnion(X)?k5(Z,X):O.IsUnknown(X)?C2(Z,X):O.IsAny(X)?w5(Z,X):O.IsObject(X)?N0(Z,X):O.IsVoid(X)?S.True:S.False}function s(Z,X){return O.IsTemplateLiteral(Z)||O.IsTemplateLiteral(X)?P4(Z,X):O.IsRegExp(Z)||O.IsRegExp(X)?E4(Z,X):O.IsNot(Z)||O.IsNot(X)?M4(Z,X):O.IsAny(Z)?X4(Z,X):O.IsArray(Z)?$4(Z,X):O.IsBigInt(Z)?W4(Z,X):O.IsBoolean(Z)?H4(Z,X):O.IsAsyncIterator(Z)?Q4(Z,X):O.IsConstructor(Z)?J4(Z,X):O.IsDate(Z)?Y4(Z,X):O.IsFunction(Z)?V4(Z,X):O.IsInteger(Z)?_4(Z,X):O.IsIntersect(Z)?B4(Z,X):O.IsIterator(Z)?U4(Z,X):O.IsLiteral(Z)?G4(Z,X):O.IsNever(Z)?q4(Z,X):O.IsNull(Z)?A4(Z,X):O.IsNumber(Z)?L4(Z,X):O.IsObject(Z)?R4(Z,X):O.IsRecord(Z)?C4(Z,X):O.IsString(Z)?I4(Z,X):O.IsSymbol(Z)?T4(Z,X):O.IsTuple(Z)?f4(Z,X):O.IsPromise(Z)?S4(Z,X):O.IsUint8Array(Z)?b4(Z,X):O.IsUndefined(Z)?x4(Z,X):O.IsUnion(Z)?g4(Z,X):O.IsUnknown(Z)?h4(Z,X):O.IsVoid(Z)?y4(Z,X):Y8(\`Unknown left type operand '\${Z[I]}'\`)}function CZ(Z,X){return s(Z,X)}function m4(Z,X,z,W,Y){let q={};for(let B of globalThis.Object.getOwnPropertyNames(Z))q[B]=V8(Z[B],X,z,W,e(Y));return q}function u4(Z,X,z,W,Y){return m4(Z.properties,X,z,W,Y)}function E2(Z,X,z,W,Y){let q=u4(Z,X,z,W,Y);return m(q)}function c4(Z,X,z,W){let Y=CZ(Z,X);return Y===S.Union?d([z,W]):Y===S.True?z:W}function V8(Z,X,z,W,Y){return Z0(Z)?E2(Z,X,z,W,Y):k0(Z)?R(I2(Z,X,z,W,Y)):R(c4(Z,X,z,W),Y)}function d4(Z,X,z,W,Y){return{[Z]:V8(c(Z),X,z,W,e(Y))}}function p4(Z,X,z,W,Y){return Z.reduce((q,B)=>{return{...q,...d4(B,X,z,W,Y)}},{})}function l4(Z,X,z,W,Y){return p4(Z.keys,X,z,W,Y)}function I2(Z,X,z,W,Y){let q=l4(Z,X,z,W,Y);return m(q)}function T2(Z,X){return _8(nZ(Z),X)}function n4(Z,X){let z=Z.filter((W)=>CZ(W,X)===S.False);return z.length===1?z[0]:d(z)}function _8(Z,X,z={}){if(f0(Z))return R(T2(Z,X),z);if(Z0(Z))return R(P2(Z,X),z);return R(v(Z)?n4(Z.anyOf,X):CZ(Z,X)!==S.False?y():Z,z)}function i4(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=_8(Z[W],X);return z}function o4(Z,X){return i4(Z.properties,X)}function P2(Z,X){let z=o4(Z,X);return m(z)}function w2(Z,X){return B8(nZ(Z),X)}function s4(Z,X){let z=Z.filter((W)=>CZ(W,X)!==S.False);return z.length===1?z[0]:d(z)}function B8(Z,X,z){if(f0(Z))return R(w2(Z,X),z);if(Z0(Z))return R(k2(Z,X),z);return R(v(Z)?s4(Z.anyOf,X):CZ(Z,X)!==S.False?Z:y(),z)}function a4(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=B8(Z[W],X);return z}function r4(Z,X){return a4(Z.properties,X)}function k2(Z,X){let z=r4(Z,X);return m(z)}function f2(Z,X){return t0(Z)?R(Z.returns,X):y(X)}function k6(Z){return E0(O0(Z))}function iZ(Z,X,z){return R({[I]:"Record",type:"object",patternProperties:{[Z]:X}},z)}function f5(Z,X,z){let W={};for(let Y of Z)W[Y]=X;return o(W,{...z,[v0]:"Record"})}function t4(Z,X,z){return nX(Z)?f5(C0(Z),X,z):iZ(Z.pattern,X,z)}function e4(Z,X,z){return f5(C0(d(Z)),X,z)}function ZH(Z,X,z){return f5([Z.toString()],X,z)}function XH(Z,X,z){return iZ(Z.source,X,z)}function zH(Z,X,z){let W=J0(Z.pattern)?KZ:Z.pattern;return iZ(W,X,z)}function $H(Z,X,z){return iZ(KZ,X,z)}function QH(Z,X,z){return iZ(hX,X,z)}function WH(Z,X,z){return o({true:X,false:X},z)}function HH(Z,X,z){return iZ(NZ,X,z)}function JH(Z,X,z){return iZ(NZ,X,z)}function f6(Z,X,z={}){return v(Z)?e4(Z.anyOf,X,z):f0(Z)?t4(Z,X,z):w0(Z)?ZH(Z.const,X,z):UZ(Z)?WH(Z,X,z):ZZ(Z)?HH(Z,X,z):XZ(Z)?JH(Z,X,z):D5(Z)?XH(Z,X,z):GZ(Z)?zH(Z,X,z):A5(Z)?$H(Z,X,z):OZ(Z)?QH(Z,X,z):y(z)}function b6(Z){return globalThis.Object.getOwnPropertyNames(Z.patternProperties)[0]}function b2(Z){let X=b6(Z);return X===KZ?zZ():X===NZ?y0():zZ({pattern:X})}function x6(Z){return Z.patternProperties[b6(Z)]}function YH(Z,X){return X.parameters=d8(Z,X.parameters),X.returns=$Z(Z,X.returns),X}function VH(Z,X){return X.parameters=d8(Z,X.parameters),X.returns=$Z(Z,X.returns),X}function _H(Z,X){return X.allOf=d8(Z,X.allOf),X}function BH(Z,X){return X.anyOf=d8(Z,X.anyOf),X}function UH(Z,X){if(J0(X.items))return X;return X.items=d8(Z,X.items),X}function GH(Z,X){return X.items=$Z(Z,X.items),X}function qH(Z,X){return X.items=$Z(Z,X.items),X}function MH(Z,X){return X.items=$Z(Z,X.items),X}function AH(Z,X){return X.item=$Z(Z,X.item),X}function LH(Z,X){let z=NH(Z,X.properties);return{...X,...o(z)}}function DH(Z,X){let z=$Z(Z,b2(X)),W=$Z(Z,x6(X)),Y=f6(z,W);return{...X,...Y}}function OH(Z,X){return X.index in Z?Z[X.index]:SZ()}function FH(Z,X){let z=tZ(X),W=S0(X),Y=$Z(Z,X);return z&&W?k6(Y):z&&!W?E0(Y):!z&&W?O0(Y):Y}function NH(Z,X){return globalThis.Object.getOwnPropertyNames(X).reduce((z,W)=>{return{...z,[W]:FH(Z,X[W])}},{})}function d8(Z,X){return X.map((z)=>$Z(Z,z))}function $Z(Z,X){return t0(X)?YH(Z,X):e0(X)?VH(Z,X):z0(X)?_H(Z,X):v(X)?BH(Z,X):b0(X)?UH(Z,X):a0(X)?GH(Z,X):mZ(X)?qH(Z,X):cZ(X)?MH(Z,X):dZ(X)?AH(Z,X):Y0(X)?LH(Z,X):pZ(X)?DH(Z,X):L5(X)?OH(Z,X):X}function x2(Z,X){return $Z(X,rZ(Z))}function g2(Z){return R({[I]:"Integer",type:"integer"},Z)}function KH(Z,X,z){return{[Z]:QZ(c(Z),X,e(z))}}function jH(Z,X,z){return Z.reduce((Y,q)=>{return{...Y,...KH(q,X,z)}},{})}function RH(Z,X,z){return jH(Z.keys,X,z)}function h2(Z,X,z){let W=RH(Z,X,z);return m(W)}function SH(Z){let[X,z]=[Z.slice(0,1),Z.slice(1)];return[X.toLowerCase(),z].join("")}function CH(Z){let[X,z]=[Z.slice(0,1),Z.slice(1)];return[X.toUpperCase(),z].join("")}function EH(Z){return Z.toUpperCase()}function IH(Z){return Z.toLowerCase()}function TH(Z,X,z){let W=$8(Z.pattern);if(!lZ(W))return{...Z,pattern:v2(Z.pattern,X)};let B=[...y8(W)].map((H)=>c(H)),U=y2(B,X),G=d(U);return N6([G],z)}function v2(Z,X){return typeof Z==="string"?X==="Uncapitalize"?SH(Z):X==="Capitalize"?CH(Z):X==="Uppercase"?EH(Z):X==="Lowercase"?IH(Z):Z:Z.toString()}function y2(Z,X){return Z.map((z)=>QZ(z,X))}function QZ(Z,X,z={}){return k0(Z)?h2(Z,X,z):f0(Z)?TH(Z,X,z):v(Z)?d(y2(Z.anyOf,X),z):w0(Z)?c(v2(Z.const,X),z):R(Z,z)}function m2(Z,X={}){return QZ(Z,"Capitalize",X)}function u2(Z,X={}){return QZ(Z,"Lowercase",X)}function c2(Z,X={}){return QZ(Z,"Uncapitalize",X)}function d2(Z,X={}){return QZ(Z,"Uppercase",X)}function PH(Z,X,z){let W={};for(let Y of globalThis.Object.getOwnPropertyNames(Z))W[Y]=EZ(Z[Y],X,e(z));return W}function wH(Z,X,z){return PH(Z.properties,X,z)}function p2(Z,X,z){let W=wH(Z,X,z);return m(W)}function kH(Z,X){return Z.map((z)=>b5(z,X))}function fH(Z,X){return Z.map((z)=>b5(z,X))}function bH(Z,X){let{[X]:z,...W}=Z;return W}function xH(Z,X){return X.reduce((z,W)=>bH(z,W),Z)}function gH(Z,X,z){let W=$0(Z,[V0,"$id","required","properties"]),Y=xH(z,X);return o(Y,W)}function hH(Z){let X=Z.reduce((z,W)=>A6(W)?[...z,c(W)]:z,[]);return d(X)}function b5(Z,X){return z0(Z)?F0(kH(Z.allOf,X)):v(Z)?d(fH(Z.anyOf,X)):Y0(Z)?gH(Z,X,Z.properties):o({})}function EZ(Z,X,z){let W=H0(X)?hH(X):X,Y=x0(X)?C0(X):X,q=W0(Z),B=W0(X);return Z0(Z)?p2(Z,Y,z):k0(X)?l2(Z,X,z):q&&B?t("Omit",[Z,W],z):!q&&B?t("Omit",[Z,W],z):q&&!B?t("Omit",[Z,W],z):R({...b5(Z,Y),...z})}function vH(Z,X,z){return{[X]:EZ(Z,[X],e(z))}}function yH(Z,X,z){return X.reduce((W,Y)=>{return{...W,...vH(Z,Y,z)}},{})}function mH(Z,X,z){return yH(Z,X.keys,z)}function l2(Z,X,z){let W=mH(Z,X,z);return m(W)}function uH(Z,X,z){let W={};for(let Y of globalThis.Object.getOwnPropertyNames(Z))W[Y]=IZ(Z[Y],X,e(z));return W}function cH(Z,X,z){return uH(Z.properties,X,z)}function n2(Z,X,z){let W=cH(Z,X,z);return m(W)}function dH(Z,X){return Z.map((z)=>x5(z,X))}function pH(Z,X){return Z.map((z)=>x5(z,X))}function lH(Z,X){let z={};for(let W of X)if(W in Z)z[W]=Z[W];return z}function nH(Z,X,z){let W=$0(Z,[V0,"$id","required","properties"]),Y=lH(z,X);return o(Y,W)}function iH(Z){let X=Z.reduce((z,W)=>A6(W)?[...z,c(W)]:z,[]);return d(X)}function x5(Z,X){return z0(Z)?F0(dH(Z.allOf,X)):v(Z)?d(pH(Z.anyOf,X)):Y0(Z)?nH(Z,X,Z.properties):o({})}function IZ(Z,X,z){let W=H0(X)?iH(X):X,Y=x0(X)?C0(X):X,q=W0(Z),B=W0(X);return Z0(Z)?n2(Z,Y,z):k0(X)?i2(Z,X,z):q&&B?t("Pick",[Z,W],z):!q&&B?t("Pick",[Z,W],z):q&&!B?t("Pick",[Z,W],z):R({...x5(Z,Y),...z})}function oH(Z,X,z){return{[X]:IZ(Z,[X],e(z))}}function sH(Z,X,z){return X.reduce((W,Y)=>{return{...W,...oH(Z,Y,z)}},{})}function aH(Z,X,z){return sH(Z,X.keys,z)}function i2(Z,X,z){let W=aH(Z,X,z);return m(W)}function rH(Z,X){return t("Partial",[t(Z,X)])}function tH(Z){return t("Partial",[JZ(Z)])}function eH(Z){let X={};for(let z of globalThis.Object.getOwnPropertyNames(Z))X[z]=O0(Z[z]);return X}function ZJ(Z,X){let z=$0(Z,[V0,"$id","required","properties"]),W=eH(X);return o(W,z)}function o2(Z){return Z.map((X)=>s2(X))}function s2(Z){return r0(Z)?rH(Z.target,Z.parameters):W0(Z)?tH(Z.$ref):z0(Z)?F0(o2(Z.allOf)):v(Z)?d(o2(Z.anyOf)):Y0(Z)?ZJ(Z,Z.properties):uZ(Z)?Z:UZ(Z)?Z:ZZ(Z)?Z:w0(Z)?Z:k8(Z)?Z:XZ(Z)?Z:GZ(Z)?Z:f8(Z)?Z:b8(Z)?Z:o({})}function U8(Z,X){if(Z0(Z))return a2(Z,X);else return R({...s2(Z),...X})}function XJ(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=U8(Z[W],e(X));return z}function zJ(Z,X){return XJ(Z.properties,X)}function a2(Z,X){let z=zJ(Z,X);return m(z)}function $J(Z,X){return t("Required",[t(Z,X)])}function QJ(Z){return t("Required",[JZ(Z)])}function WJ(Z){let X={};for(let z of globalThis.Object.getOwnPropertyNames(Z))X[z]=$0(Z[z],[L0]);return X}function HJ(Z,X){let z=$0(Z,[V0,"$id","required","properties"]),W=WJ(X);return o(W,z)}function r2(Z){return Z.map((X)=>t2(X))}function t2(Z){return r0(Z)?$J(Z.target,Z.parameters):W0(Z)?QJ(Z.$ref):z0(Z)?F0(r2(Z.allOf)):v(Z)?d(r2(Z.anyOf)):Y0(Z)?HJ(Z,Z.properties):uZ(Z)?Z:UZ(Z)?Z:ZZ(Z)?Z:w0(Z)?Z:k8(Z)?Z:XZ(Z)?Z:GZ(Z)?Z:f8(Z)?Z:b8(Z)?Z:o({})}function G8(Z,X){if(Z0(Z))return e2(Z,X);else return R({...t2(Z),...X})}function JJ(Z,X){let z={};for(let W of globalThis.Object.getOwnPropertyNames(Z))z[W]=G8(Z[W],X);return z}function YJ(Z,X){return JJ(Z.properties,X)}function e2(Z,X){let z=YJ(Z,X);return m(z)}function VJ(Z,X){return X.map((z)=>{return W0(z)?g5(Z,z.$ref):g0(Z,z)})}function g5(Z,X){return X in Z?W0(Z[X])?g5(Z,Z[X].$ref):g0(Z,Z[X]):y()}function _J(Z){return H8(Z[0])}function BJ(Z){return RZ(Z[0],Z[1])}function UJ(Z){return J8(Z[0])}function GJ(Z){return U8(Z[0])}function qJ(Z){return EZ(Z[0],Z[1])}function MJ(Z){return IZ(Z[0],Z[1])}function AJ(Z){return G8(Z[0])}function LJ(Z,X,z){let W=VJ(Z,z);return X==="Awaited"?_J(W):X==="Index"?BJ(W):X==="KeyOf"?UJ(W):X==="Partial"?GJ(W):X==="Omit"?qJ(W):X==="Pick"?MJ(W):X==="Required"?AJ(W):y()}function DJ(Z,X){return eZ(g0(Z,X))}function OJ(Z,X){return Z8(g0(Z,X))}function FJ(Z,X,z){return X8(p8(Z,X),g0(Z,z))}function NJ(Z,X,z){return WZ(p8(Z,X),g0(Z,z))}function KJ(Z,X){return F0(p8(Z,X))}function jJ(Z,X){return W8(g0(Z,X))}function RJ(Z,X){return o(globalThis.Object.keys(X).reduce((z,W)=>{return{...z,[W]:g0(Z,X[W])}},{}))}function SJ(Z,X){let[z,W]=[g0(Z,x6(X)),b6(X)],Y=rZ(X);return Y.patternProperties[W]=z,Y}function CJ(Z,X){return W0(X)?{...g5(Z,X.$ref),[V0]:X[V0]}:X}function EJ(Z,X){return m0(p8(Z,X))}function IJ(Z,X){return d(p8(Z,X))}function p8(Z,X){return X.map((z)=>g0(Z,z))}function g0(Z,X){return S0(X)?R(g0(Z,$0(X,[L0])),X):tZ(X)?R(g0(Z,$0(X,[s0])),X):FZ(X)?R(CJ(Z,X),X):a0(X)?R(DJ(Z,X.items),X):mZ(X)?R(OJ(Z,X.items),X):r0(X)?R(LJ(Z,X.target,X.parameters)):t0(X)?R(FJ(Z,X.parameters,X.returns),X):e0(X)?R(NJ(Z,X.parameters,X.returns),X):z0(X)?R(KJ(Z,X.allOf),X):cZ(X)?R(jJ(Z,X.items),X):Y0(X)?R(RJ(Z,X.properties),X):pZ(X)?R(SJ(Z,X)):b0(X)?R(EJ(Z,X.items||[]),X):v(X)?R(IJ(Z,X.anyOf),X):X}function TJ(Z,X){return X in Z?g0(Z,Z[X]):y()}function Z9(Z){return globalThis.Object.getOwnPropertyNames(Z).reduce((X,z)=>{return{...X,[z]:TJ(Z,z)}},{})}class X9{constructor(Z){let X=Z9(Z),z=this.WithIdentifiers(X);this.$defs=z}Import(Z,X){let z={...this.$defs,[Z]:R(this.$defs[Z],X)};return R({[I]:"Import",$defs:z,$ref:Z})}WithIdentifiers(Z){return globalThis.Object.getOwnPropertyNames(Z).reduce((X,z)=>{return{...X,[z]:{...Z[z],$id:z}}},{})}}function z9(Z){return new X9(Z)}function $9(Z,X){return R({[I]:"Not",not:Z},X)}function Q9(Z,X){return e0(Z)?m0(Z.parameters,X):y()}var PJ=0;function W9(Z,X={}){if(J0(X.$id))X.$id=\`T\${PJ++}\`;let z=rZ(Z({[I]:"This",$ref:\`\${X.$id}\`}));return z.$id=X.$id,R({[v0]:"Recursive",...z},X)}function H9(Z,X){let z=a(Z)?new globalThis.RegExp(Z):Z;return R({[I]:"RegExp",type:"RegExp",source:z.source,flags:z.flags},X)}function wJ(Z){return z0(Z)?Z.allOf:v(Z)?Z.anyOf:b0(Z)?Z.items??[]:[]}function J9(Z){return wJ(Z)}function Y9(Z,X){return e0(Z)?R(Z.returns,X):y(X)}class V9{constructor(Z){this.schema=Z}Decode(Z){return new _9(this.schema,Z)}}class _9{constructor(Z,X){this.schema=Z,this.decode=X}EncodeTransform(Z,X){let Y={Encode:(q)=>X[V0].Encode(Z(q)),Decode:(q)=>this.decode(X[V0].Decode(q))};return{...X,[V0]:Y}}EncodeSchema(Z,X){let z={Decode:this.decode,Encode:Z};return{...X,[V0]:z}}Encode(Z){return FZ(this.schema)?this.EncodeTransform(Z,this.schema):this.EncodeSchema(Z,this.schema)}}function B9(Z){return new V9(Z)}function U9(Z={}){return R({[I]:Z[I]??"Unsafe"},Z)}function G9(Z){return R({[I]:"Void",type:"void"},Z)}var h5={};m6(h5,{Void:()=>G9,Uppercase:()=>d2,Unsafe:()=>U9,Unknown:()=>SZ,Union:()=>d,Undefined:()=>E6,Uncapitalize:()=>c2,Uint8Array:()=>I6,Tuple:()=>m0,Transform:()=>B9,TemplateLiteral:()=>N6,Symbol:()=>C6,String:()=>zZ,ReturnType:()=>Y9,Rest:()=>J9,Required:()=>G8,RegExp:()=>H9,Ref:()=>JZ,Recursive:()=>W9,Record:()=>f6,ReadonlyOptional:()=>k6,Readonly:()=>E0,Promise:()=>j6,Pick:()=>IZ,Partial:()=>U8,Parameters:()=>Q9,Optional:()=>O0,Omit:()=>EZ,Object:()=>o,Number:()=>y0,Null:()=>S6,Not:()=>$9,Never:()=>y,Module:()=>z9,Mapped:()=>W2,Lowercase:()=>u2,Literal:()=>c,KeyOf:()=>J8,Iterator:()=>W8,Intersect:()=>F0,Integer:()=>g2,Instantiate:()=>x2,InstanceType:()=>f2,Index:()=>RZ,Function:()=>WZ,Extract:()=>B8,Extends:()=>V8,Exclude:()=>_8,Enum:()=>q2,Date:()=>R6,ConstructorParameters:()=>G2,Constructor:()=>X8,Const:()=>U2,Composite:()=>B2,Capitalize:()=>m2,Boolean:()=>F6,BigInt:()=>Q8,Awaited:()=>H8,AsyncIterator:()=>Z8,Array:()=>eZ,Argument:()=>cX,Any:()=>jZ});var b=h5;var q9="http://127.0.0.1:3850",q8="pi",TZ="plugin",p0=5000,l8=1e4,M9=5000,g6="signet-pi-hidden-recall",h6="signet-pi-session-context";function A9(Z){return J5(Z,{logPrefix:"signet-pi",actorName:"pi-extension",runtimePath:TZ,defaultTimeout:p0})}var kJ=new Set([g6,h6]),L9={harness:q8,runtimePath:TZ,writeTimeout:l8,promptSubmitTimeout:M9,excludedCustomTypes:kJ,sessionStartTimeout:()=>p0,staticFallback:Y5};function D9(Z,X){return{role:"custom",customType:Z,display:!1,content:\`<signet-memory source="auto-recall">
|
|
24316
24316
|
\${_5(X)}
|
|
24317
|
-
</signet-memory>\`,timestamp:Date.now()}}class O9 extends U6{consumeHiddenInjectMessages(Z){if(!Z)return[];let X=[],z=p(this.pendingSessionContext.get(Z));if(z)X.push(D9(h6,z));this.pendingSessionContext.delete(Z);let W=this.consumePendingRecall(Z);if(W)X.push(D9(g6,W));return X}}function F9(){return new O9}function gJ(){let Z=xJ(P7(),"extensions","signet.json");if(!fJ(Z))return null;try{let X=bJ(Z,"utf-8"),z=JSON.parse(X);if(typeof z!=="object"||z===null)return null;return z}catch{return null}}function hJ(){let Z=gJ(),X=S8("SIGNET_ENABLED"),z=Z?.enabled;return{enabled:X!==void 0?X!=="false":z!==void 0?z:!0}}var vJ=hJ(),wZ={lastRecall:null,memoryCount:0};function yJ(){return o0("SIGNET_API_KEY")??o0("SIGNET_TOKEN")}function n8(Z={}){let X=yJ();return X?{...Z,Authorization:\`Bearer \${X}\`}:Z}async function PZ(Z){try{return(await fetch(\`\${Z}/health\`,{method:"GET",headers:n8({Accept:"application/json"}),signal:AbortSignal.timeout(p0)})).ok}catch{return!1}}async function N9(Z,X,z={}){let W=await fetch(\`\${Z}/api/memory/recall\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify($5(X,{...z})),signal:AbortSignal.timeout(z.aggregate?Math.max(p0*6,30000):p0)});if(!W.ok){let Y=await W.text();throw Error(\`Recall failed: \${Y}\`)}return await W.json()}async function K9(Z,X,z={}){let{critical:W=!1,tags:Y=[],agentId:q}=z,B=await fetch(\`\${Z}/api/hooks/remember\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify(
|
|
24317
|
+
</signet-memory>\`,timestamp:Date.now()}}class O9 extends U6{consumeHiddenInjectMessages(Z){if(!Z)return[];let X=[],z=p(this.pendingSessionContext.get(Z));if(z)X.push(D9(h6,z));this.pendingSessionContext.delete(Z);let W=this.consumePendingRecall(Z);if(W)X.push(D9(g6,W));return X}}function F9(){return new O9}function gJ(){let Z=xJ(P7(),"extensions","signet.json");if(!fJ(Z))return null;try{let X=bJ(Z,"utf-8"),z=JSON.parse(X);if(typeof z!=="object"||z===null)return null;return z}catch{return null}}function hJ(){let Z=gJ(),X=S8("SIGNET_ENABLED"),z=Z?.enabled;return{enabled:X!==void 0?X!=="false":z!==void 0?z:!0}}var vJ=hJ(),wZ={lastRecall:null,memoryCount:0};function yJ(){return o0("SIGNET_API_KEY")??o0("SIGNET_TOKEN")}function n8(Z={}){let X=yJ();return X?{...Z,Authorization:\`Bearer \${X}\`}:Z}async function PZ(Z){try{return(await fetch(\`\${Z}/health\`,{method:"GET",headers:n8({Accept:"application/json"}),signal:AbortSignal.timeout(p0)})).ok}catch{return!1}}async function N9(Z,X,z={}){let W=await fetch(\`\${Z}/api/memory/recall\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify($5(X,{...z})),signal:AbortSignal.timeout(z.aggregate?Math.max(p0*6,30000):p0)});if(!W.ok){let Y=await W.text();throw Error(\`Recall failed: \${Y}\`)}return await W.json()}async function K9(Z,X,z={}){let{critical:W=!1,tags:Y=[],agentId:q}=z,B=await fetch(\`\${Z}/api/hooks/remember\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify(N7(X,{harness:q8,pinned:W,tags:Y,agentId:q,source:"pi-extension",runtimePath:TZ})),signal:AbortSignal.timeout(l8)});if(!B.ok){let U=await B.text();throw Error(\`Remember failed: \${U}\`)}}async function mJ(Z,X,z={}){let{limit:W,agentId:Y,sessionKey:q,includeRecalled:B,project:U}=z,G=await fetch(\`\${Z}/api/memory/recall\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify({...$5(X,{limit:W,agentId:Y,sessionKey:q,includeRecalled:B,project:U}),sourceOnly:!0}),signal:AbortSignal.timeout(p0)});if(!G.ok){let H=await G.text();throw Error(\`Source search failed: \${H}\`)}return await G.json()}async function uJ(Z,X,z={}){let W=await fetch(\`\${Z}/api/sessions/search\`,{method:"POST",headers:n8({"Content-Type":"application/json"}),body:JSON.stringify({query:X,sessionKey:z.sessionKey,currentSessionKey:z.currentSessionKey,agentId:z.agentId,project:z.project,limit:z.limit}),signal:AbortSignal.timeout(p0)});if(!W.ok){let Y=await W.text();throw Error(\`Session search failed: \${Y}\`)}return await W.json()}function v6(Z){let X=wZ.lastRecall?\`signet:\${wZ.memoryCount} memories\`:"signet:ready";Z.ui.setStatus("signet",Z.ui.theme.fg("accent",X))}function cJ(Z,X,z){Z.on("session_start",async(W,Y)=>{if(await PZ(z))Y.ui.notify("SignetAI memory connected","info"),v6(Y);else Y.ui.notify("SignetAI daemon not running. Memory features disabled.","warning"),Y.ui.notify("Install: curl -fsSL https://signetai.sh/install.sh | bash && signet setup","info");await DZ(X,Y)}),Z.on("session_before_switch",async()=>{await E8(X,{},"session_switch")}),Z.on("session_before_fork",async()=>{await E8(X,{},"session_fork")}),Z.on("session_switch",async(W,Y)=>{await DZ(X,Y)}),Z.on("session_fork",async(W,Y)=>{await DZ(X,Y)}),Z.on("session_shutdown",async(W,Y)=>{Y.ui.setStatus("signet",void 0),await _6(X,Y,"session_shutdown")})}function dJ(Z,X){Z.on("input",async(z,W)=>{let Y=T0(W);X.state.clearPendingRecall(Y.sessionId),await I8(X,W,z.text)}),Z.on("before_agent_start",async(z,W)=>{await aZ(X,W);let Y=T0(W);if(!Y.sessionId)return;if(X.state.hasPendingRecall(Y.sessionId))return;await I8(X,W,z.prompt)})}function pJ(Z,X){Z.on("context",async(z,W)=>{let Y=T0(W),q=X.state.consumeHiddenInjectMessages(Y.sessionId);if(q.length===0)return;return{messages:[...z.messages,...q]}})}function lJ(Z,X){Z.on("session_before_compact",async(z,W)=>{await aZ(X,W);let Y=T0(W);await X.client.post("/api/hooks/pre-compaction",{harness:q8,sessionKey:Y.sessionId,messageCount:Array.isArray(z.preparation?.messagesToSummarize)?z.preparation.messagesToSummarize.length:void 0,runtimePath:TZ},p0);return}),Z.on("session_compact",async(z,W)=>{let Y=p(z.compactionEntry?.summary);if(!Y)return;let q=T0(W);await X.client.post("/api/hooks/compaction-complete",{harness:q8,summary:Y,project:q.project,sessionKey:q.sessionId,agentId:X.agentId,runtimePath:TZ},l8)})}function nJ(Z){let X=Z.trim(),z=!1,W=[];if(X.startsWith("critical:"))z=!0,X=X.slice(9).trim();let Y=X.match(/^\\[([^\\]]+)\\]:\\s*/);if(Y)W.push(...Y[1].split(",").map((q)=>q.trim())),X=X.slice(Y[0].length);return{content:X,critical:z,tags:W}}function iJ(Z,X,z){Z.registerCommand("recall",{description:"Search SignetAI memories",handler:async(W,Y)=>{if(!W?.trim()){Y.ui.notify("Usage: /recall <query>","warning");return}if(!await PZ(X)){Y.ui.notify("Signet daemon not running. Run: signet daemon start","error");return}Y.ui.notify(\`Recalling: "\${W}"...\`,"info");try{let B=await N9(X,W,{agentId:z}),U=R8(B);if(U.rows.length===0){Y.ui.notify("No relevant memories found","info");return}wZ.lastRecall=new Date().toISOString(),wZ.memoryCount=U.rows.length,v6(Y),Y.ui.notify(J6(B),"success")}catch(B){let U=B instanceof Error?B.message:String(B);Y.ui.notify(\`Recall failed: \${U}\`,"error")}}}),Z.registerCommand("remember",{description:"Save a memory to SignetAI",handler:async(W,Y)=>{if(!W?.trim()){Y.ui.notify("Usage: /remember <content>","warning");return}if(!await PZ(X)){Y.ui.notify("Signet daemon not running. Run: signet daemon start","error");return}let{content:B,critical:U,tags:G}=nJ(W);try{await K9(X,B,{critical:U,tags:G,agentId:z});let H=U?" (pinned)":"";Y.ui.notify(\`Memory saved\${H}: "\${B.substring(0,50)}..."\`,"success")}catch(H){let _=H instanceof Error?H.message:String(H);Y.ui.notify(\`Remember failed: \${_}\`,"error")}}}),Z.registerCommand("signet-status",{description:"Check SignetAI daemon status",handler:async(W,Y)=>{let q=await PZ(X),B=Y.sessionManager.getSessionId();if(q){let U=[\`Signet daemon is running on \${X}\`];if(B)U.push(\`Session: \${B}\`);Y.ui.notify(U.join(\`
|
|
24318
24318
|
\`),"success");try{let G=await fetch(\`\${X}/api/memory/stats\`,{signal:AbortSignal.timeout(p0)});if(G.ok){let H=await G.json();Y.ui.notify(\`Memory stats: \${JSON.stringify(H)}\`,"info")}}catch{}}else Y.ui.notify(\`Signet daemon not responding.
|
|
24319
24319
|
Install: curl -fsSL https://signetai.sh/install.sh | bash && signet setup
|
|
24320
24320
|
Start: signet daemon start\`,"error")}}),Z.registerTool({name:"signet_recall",label:"Signet Recall",description:"Search SignetAI persistent memory for relevant context from previous sessions. Use aggregate=true for multi-query synthesis that consolidates scattered memories into a single summary.",promptSnippet:"Search past memories when user asks about previous decisions, preferences, or project context",promptGuidelines:["Use aggregate=true when the user asks a broad question that likely spans many memories (e.g. 'who is X', 'what happened with Y', 'summarize the history of Z')","Use aggregate=false (default) for targeted lookups of specific facts or single memories","Aggregate recall takes longer (3-5s) but produces higher-quality synthesized answers for complex queries"],parameters:b.Object({query:b.String({description:"Search query to find relevant memories"}),limit:b.Optional(b.Number({description:"Maximum number of memories to return (default: 10)",default:10})),sessionKey:b.Optional(b.String({description:"Session key for per-context recall dedupe"})),includeRecalled:b.Optional(b.Boolean({description:"Include rows already recalled in this context",default:!1})),scope:b.Optional(b.Union([b.Literal("global"),b.Literal("agent"),b.Literal("session")],{description:"Recall scope constraint"})),aggregate:b.Optional(b.Boolean({description:"Enable aggregate recall: runs multiple follow-up queries and synthesizes a consolidated answer. Use for broad questions spanning many memories. (default: false)",default:!1})),aggregateBudget:b.Optional(b.String({description:"Aggregate synthesis budget: 'small', 'medium', or 'large'. Controls depth of multi-query recall and synthesis. (default: medium)"}))}),async execute(W,Y,q,B,U){if(!await PZ(X))return{content:[{type:"text",text:"Signet daemon not running. Memories unavailable."}],details:{error:"daemon_offline"}};try{let H=String(Y.query||""),_=typeof Y.limit==="number"?Y.limit:void 0,$=typeof Y.sessionKey==="string"?Y.sessionKey:void 0,Q=typeof Y.scope==="string"&&["global","agent","session"].includes(Y.scope)?Y.scope:void 0,J=Y.aggregate===!0,V=typeof Y.aggregateBudget==="string"&&["small","medium","large"].includes(Y.aggregateBudget)?Y.aggregateBudget:void 0,M=await N9(X,H,{limit:_,agentId:z,sessionKey:$,includeRecalled:Y.includeRecalled===!0,scope:Q,aggregate:J,aggregateBudget:V}),A=R8(M);if(J&&M.aggregate){let L=M.results??A.rows;if(L.length===0)return{content:[{type:"text",text:"No relevant memories found for this query."}],details:{memoriesFound:0}};wZ.lastRecall=new Date().toISOString(),wZ.memoryCount=L.length,v6(U);let D=M.aggregate.partial===!0,F=[D?\`[Aggregate Recall degraded] Query: \${H}\`:\`[Aggregate Recall] Query: \${H}\`];if(D&&typeof M.aggregate.message==="string")F.push(M.aggregate.message);for(let j of L)if(typeof j.content==="string")F.push(j.content);return{content:[{type:"text",text:F.join(\`
|