@rizom/brain 0.2.0-alpha.452 → 0.2.0-alpha.453
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/brain.js +42 -42
- package/dist/chunks/{app-915n1gg7.js → app-bg53pvhx.js} +2 -2
- package/dist/chunks/{blog-post-adapter-5avah6v2.js → blog-post-adapter-hw4caebb.js} +2 -2
- package/dist/chunks/{index-sycvw55k.js → index-7exeb57a.js} +2 -2
- package/dist/chunks/{index-41yt4dm7.js → index-b3dbc07e.js} +3 -3
- package/dist/chunks/{index-41yt4dm7.js.map → index-b3dbc07e.js.map} +1 -1
- package/dist/chunks/{index-9xmz7sjy.js → index-jv41j8zg.js} +4 -4
- package/dist/chunks/{index-9xmz7sjy.js.map → index-jv41j8zg.js.map} +5 -5
- package/dist/chunks/{index-mrq4qv61.js → index-pm6wtjx7.js} +2 -2
- package/dist/chunks/{index-15rn9szm.js → index-tf2k5d73.js} +3 -3
- package/dist/chunks/{index-z43k2rmc.js → index-vasegzfn.js} +2 -2
- package/dist/chunks/linkedin-template-pg5cwy3q.js +5 -0
- package/dist/chunks/{rss-datasource-sgznwzkm.js → rss-datasource-g6sg1kbk.js} +2 -2
- package/dist/entities.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/interfaces.js +1 -1
- package/dist/model.d.ts +4 -2
- package/dist/model.js +40 -40
- package/dist/model.js.map +1 -1
- package/dist/plugins.js +1 -1
- package/dist/services.js +1 -1
- package/dist/ui/studio-chunks/main-gg87r17k.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunks/linkedin-template-js7cztmp.js +0 -5
- /package/dist/chunks/{app-915n1gg7.js.map → app-bg53pvhx.js.map} +0 -0
- /package/dist/chunks/{blog-post-adapter-5avah6v2.js.map → blog-post-adapter-hw4caebb.js.map} +0 -0
- /package/dist/chunks/{index-sycvw55k.js.map → index-7exeb57a.js.map} +0 -0
- /package/dist/chunks/{index-mrq4qv61.js.map → index-pm6wtjx7.js.map} +0 -0
- /package/dist/chunks/{index-15rn9szm.js.map → index-tf2k5d73.js.map} +0 -0
- /package/dist/chunks/{index-z43k2rmc.js.map → index-vasegzfn.js.map} +0 -0
- /package/dist/chunks/{linkedin-template-js7cztmp.js.map → linkedin-template-pg5cwy3q.js.map} +0 -0
- /package/dist/chunks/{rss-datasource-sgznwzkm.js.map → rss-datasource-g6sg1kbk.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pb as o}from"./index-
|
|
2
|
+
import{pb as o}from"./index-jv41j8zg.js";import{Zh as t}from"./index-pcfbw7x6.js";var a=t.enum(["generating","draft","queued","published","failed"]),e=t.object({title:t.string(),slug:t.string().optional(),status:a,publishedAt:t.string().datetime().optional(),excerpt:t.string(),author:t.string(),coverImageId:t.string().optional(),ogImageId:t.string().optional(),seriesName:t.string().optional(),seriesIndex:t.number().optional(),ogImage:t.string().url().optional(),ogDescription:t.string().optional(),twitterCard:t.enum(["summary","summary_large_image"]).optional(),canonicalUrl:t.string().url().optional(),atprotoUri:t.string().optional()}),i=e.pick({title:!0,status:!0,publishedAt:!0,seriesName:!0,seriesIndex:!0}).extend({slug:t.string(),error:t.string().optional()}),n=o.extend({entityType:t.literal("post"),metadata:i}),r=n.extend({frontmatter:e,body:t.string(),coverImageUrl:t.string().optional()}),s=r.extend({url:t.string().optional(),typeLabel:t.string().optional(),listUrl:t.string().optional(),listLabel:t.string().optional(),seriesUrl:t.string().optional(),coverImageUrl:t.string().optional(),ogImageUrl:t.string().optional(),coverImageWidth:t.number().optional(),coverImageHeight:t.number().optional(),coverImageSrcset:t.string().optional(),coverImageSizes:t.string().optional()}),d=r.extend({url:t.string(),typeLabel:t.string(),listUrl:t.string(),listLabel:t.string(),seriesUrl:t.string().optional(),coverImageUrl:t.string().optional(),ogImageUrl:t.string().optional(),coverImageWidth:t.number().optional(),coverImageHeight:t.number().optional(),coverImageSrcset:t.string().optional(),coverImageSizes:t.string().optional()});
|
|
3
3
|
export{a as E,e as F,n as G,r as H};
|
|
4
4
|
|
|
5
5
|
//# debugId=530DE460CE19880064756E2164756E21
|
|
6
|
-
//# sourceMappingURL=index-
|
|
6
|
+
//# sourceMappingURL=index-pm6wtjx7.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{pa as CR,qa as DR,ra as zR}from"./index-taenf405.js";import{sa as pp}from"./index-48ksf4j5.js";import{$a as xn,$b as Xr,$f as dI,Aa as Do,Ad as VI,Af as zs,Be as $s,Ca as Gx,Ce as AI,Cg as jT,Ch as DT,De as Ax,Df as Ys,Ed as Qo,Ef as RT,Eg as OT,Gf as PC,He as jC,Hf as ET,Hg as vx,Ib as tI,Id as JC,If as AT,Jd as HC,Jf as PT,Ka as Jx,Kc as XI,Kd as Os,Lb as RC,Ld as iT,Mb as KT,Md as aT,Nb as Nx,Nd as sT,Oa as Pd,Oc as eC,Od as lT,Pa as Ts,Qa as zx,Qb as Yx,Qc as UT,Qd as xC,Ra as Ux,Rb as qw,Rd as TC,Re as xp,Sb as rt,Sc as $T,Sd as IC,Se as ma,Ta as $x,Tb as ir,Tc as MI,Te as rI,Ua as NC,Ub as vT,Uc as nI,Ud as mt,Ue as EC,Va as yr,Vb as tt,Ve as Rx,Wb as Xe,Wc as rC,We as xT,Xa as qx,Xb as Ki,Xc as _T,Ya as Wx,Yb as de,Ye as ZT,Zb as hs,Zc as Qr,Ze as Ld,_a as wn,_b as vd,_d as hx,ab as DC,bb as zC,bc as vn,bf as YT,cb as UC,cc as Mx,db as $C,eb as qC,fb as LC,gb as FC,hb as BC,hf as AC,ib as ua,jb as fI,jf as TT,kb as tC,kd as Nr,kf as IT,lc as bT,mb as Wt,nb as Fs,ob as Fd,pb as UI,qb as BI,rg as sI,rh as qT,sg as lI,sh as tT,tg as da,ub as Bs,va as Md,vh as LT,we as VC,wh as rT,xa as Bx,xe as ZC,xf as CT,xh as NT,ya as ar,ye as KC,yh as nT,zd as WI,zf as kT}from"./index-
|
|
2
|
+
import{pa as CR,qa as DR,ra as zR}from"./index-taenf405.js";import{sa as pp}from"./index-48ksf4j5.js";import{$a as xn,$b as Xr,$f as dI,Aa as Do,Ad as VI,Af as zs,Be as $s,Ca as Gx,Ce as AI,Cg as jT,Ch as DT,De as Ax,Df as Ys,Ed as Qo,Ef as RT,Eg as OT,Gf as PC,He as jC,Hf as ET,Hg as vx,Ib as tI,Id as JC,If as AT,Jd as HC,Jf as PT,Ka as Jx,Kc as XI,Kd as Os,Lb as RC,Ld as iT,Mb as KT,Md as aT,Nb as Nx,Nd as sT,Oa as Pd,Oc as eC,Od as lT,Pa as Ts,Qa as zx,Qb as Yx,Qc as UT,Qd as xC,Ra as Ux,Rb as qw,Rd as TC,Re as xp,Sb as rt,Sc as $T,Sd as IC,Se as ma,Ta as $x,Tb as ir,Tc as MI,Te as rI,Ua as NC,Ub as vT,Uc as nI,Ud as mt,Ue as EC,Va as yr,Vb as tt,Ve as Rx,Wb as Xe,Wc as rC,We as xT,Xa as qx,Xb as Ki,Xc as _T,Ya as Wx,Yb as de,Ye as ZT,Zb as hs,Zc as Qr,Ze as Ld,_a as wn,_b as vd,_d as hx,ab as DC,bb as zC,bc as vn,bf as YT,cb as UC,cc as Mx,db as $C,eb as qC,fb as LC,gb as FC,hb as BC,hf as AC,ib as ua,jb as fI,jf as TT,kb as tC,kd as Nr,kf as IT,lc as bT,mb as Wt,nb as Fs,ob as Fd,pb as UI,qb as BI,rg as sI,rh as qT,sg as lI,sh as tT,tg as da,ub as Bs,va as Md,vh as LT,we as VC,wh as rT,xa as Bx,xe as ZC,xf as CT,xh as NT,ya as ar,ye as KC,yh as nT,zd as WI,zf as kT}from"./index-jv41j8zg.js";import{Eh as _s,Gh as SC,Hh as vs,Ih as Kw,Jh as bs,Kh as Yw,Lh as MT,Ph as Sn,Th as en}from"./index-h2nhrbcx.js";import{Uh as Ut,Vh as vr}from"./index-cdqw3f7b.js";import{Di as Zw,Hi as Xx,Ij as uI,Ji as eT,Ki as Sx,Lj as kC,Mj as qd,Ni as fs,Pi as Cx,Ri as kx,Rj as pT,Xh as Bm,Yh as Gm,Yj as ST,Zh as r,Zi as bn,aj as Yn,bi as ip,bk as TI,cj as ke,ck as ys,di as oa,dj as ea,dk as wT,fj as Ix,mj as Es,sj as Hd,tj as VT,uj as _C,vi as gt,xi as os}from"./index-pcfbw7x6.js";import{ik as On,jk as ye,lk as Al}from"./index-wfnbc5ve.js";var El=ye(function(ZH,mg){var{defineProperty:Rl,getOwnPropertyDescriptor:bR,getOwnPropertyNames:_R}=Object,SR=Object.prototype.hasOwnProperty,wR=(e,t)=>{for(var n in t)Rl(e,n,{get:t[n],enumerable:!0})},xR=(e,t,n,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let i of _R(t))if(!SR.call(e,i)&&i!==n)Rl(e,i,{get:()=>t[i],enumerable:!(o=bR(t,i))||o.enumerable})}return e},TR=(e)=>xR(Rl({},"__esModule",{value:!0}),e),dg={};wR(dg,{SYMBOL_FOR_REQ_CONTEXT:()=>pg,getContext:()=>IR});mg.exports=TR(dg);var pg=Symbol.for("@vercel/request-context");function IR(){return globalThis[pg]?.get?.()??{}}});var hg=ye(function(KH,fg){var{defineProperty:Ml,getOwnPropertyDescriptor:kR,getOwnPropertyNames:RR}=Object,ER=Object.prototype.hasOwnProperty,AR=(e,t)=>{for(var n in t)Ml(e,n,{get:t[n],enumerable:!0})},PR=(e,t,n,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let i of RR(t))if(!ER.call(e,i)&&i!==n)Ml(e,i,{get:()=>t[i],enumerable:!(o=kR(t,i))||o.enumerable})}return e},MR=(e)=>PR(Ml({},"__esModule",{value:!0}),e),gg={};AR(gg,{getVercelOidcToken:()=>NR,getVercelOidcTokenSync:()=>Pl});fg.exports=MR(gg);var jR=El(),OR=CR();async function NR(e){let t="",n;try{t=Pl()}catch(o){n=o}try{let[{getTokenPayload:o,isExpired:i},{refreshToken:a}]=await Promise.all([await import("./token-util-02ysfx84.js").then((m)=>On(m.default)),await import("./token-6vf3j81t.js").then((m)=>On(m.default))]);if(!t||i(o(t),e?.expirationBufferMs))await a(e),t=Pl()}catch(o){let i=n instanceof Error?n.message:"";if(o instanceof Error)i=`${i}
|
|
3
3
|
${o.message}`;if(i)throw new OR.VercelOidcTokenError(i);throw o}return t}function Pl(){let e=(0,jR.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return e}});var Ol=ye(function(YH,_g){var{defineProperty:jl,getOwnPropertyDescriptor:UR,getOwnPropertyNames:$R}=Object,qR=Object.prototype.hasOwnProperty,LR=(e,t)=>{for(var n in t)jl(e,n,{get:t[n],enumerable:!0})},FR=(e,t,n,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let i of $R(t))if(!qR.call(e,i)&&i!==n)jl(e,i,{get:()=>t[i],enumerable:!(o=UR(t,i))||o.enumerable})}return e},BR=(e)=>FR(jl({},"__esModule",{value:!0}),e),bg={};LR(bg,{AccessTokenMissingError:()=>vg.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>vg.RefreshAccessTokenFailedError,getContext:()=>GR.getContext,getVercelOidcToken:()=>yg.getVercelOidcToken,getVercelOidcTokenSync:()=>yg.getVercelOidcTokenSync,getVercelToken:()=>JR.getVercelToken});_g.exports=BR(bg);var yg=hg(),GR=El(),vg=DR(),JR=zR()});var zl=ye(function(hf){Object.defineProperty(hf,"__esModule",{value:!0});hf.VERSION=void 0;hf.VERSION="1.9.1"});var wf=ye(function(_f){Object.defineProperty(_f,"__esModule",{value:!0});_f.isCompatible=_f._makeCompatibilityCheck=void 0;var lA=zl(),vf=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function bf(e){let t=new Set([e]),n=new Set,o=e.match(vf);if(!o)return()=>!1;let i={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(i.prerelease!=null)return function(c){return c===e};function a(l){return n.add(l),!1}function s(l){return t.add(l),!0}return function(c){if(t.has(c))return!0;if(n.has(c))return!1;let u=c.match(vf);if(!u)return a(c);let d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};if(d.prerelease!=null)return a(c);if(i.major!==d.major)return a(c);if(i.major===0){if(i.minor===d.minor&&i.patch<=d.patch)return s(c);return a(c)}if(i.minor<=d.minor)return s(c);return a(c)}}_f._makeCompatibilityCheck=bf;_f.isCompatible=bf(lA.VERSION)});var Nn=ye(function(xf){Object.defineProperty(xf,"__esModule",{value:!0});xf.unregisterGlobal=xf.getGlobal=xf.registerGlobal=void 0;var uo=zl(),uA=wf(),dA=uo.VERSION.split(".")[0],bi=Symbol.for(`opentelemetry.js.api.${dA}`),_i=typeof globalThis==="object"?globalThis:typeof self==="object"?self:typeof window==="object"?window:typeof global==="object"?global:{};function pA(e,t,n,o=!1){var i;let a=_i[bi]=(i=_i[bi])!==null&&i!==void 0?i:{version:uo.VERSION};if(!o&&a[e]){let s=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(s.stack||s.message),!1}if(a.version!==uo.VERSION){let s=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${uo.VERSION}`);return n.error(s.stack||s.message),!1}return a[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${uo.VERSION}.`),!0}xf.registerGlobal=pA;function mA(e){var t,n;let o=(t=_i[bi])===null||t===void 0?void 0:t.version;if(!o||!(0,uA.isCompatible)(o))return;return(n=_i[bi])===null||n===void 0?void 0:n[e]}xf.getGlobal=mA;function gA(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${uo.VERSION}.`);let n=_i[bi];if(n)delete n[e]}xf.unregisterGlobal=gA});var Rf=ye(function(Cf){Object.defineProperty(Cf,"__esModule",{value:!0});Cf.DiagComponentLogger=void 0;var yA=Nn();class If{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Si("debug",this._namespace,e)}error(...e){return Si("error",this._namespace,e)}info(...e){return Si("info",this._namespace,e)}warn(...e){return Si("warn",this._namespace,e)}verbose(...e){return Si("verbose",this._namespace,e)}}Cf.DiagComponentLogger=If;function Si(e,t,n){let o=(0,yA.getGlobal)("diag");if(!o)return;return o[e](t,...n)}});var Da=ye(function(Ef){Object.defineProperty(Ef,"__esModule",{value:!0});Ef.DiagLogLevel=void 0;var vA;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(vA=Ef.DiagLogLevel||(Ef.DiagLogLevel={}))});var Mf=ye(function(Af){Object.defineProperty(Af,"__esModule",{value:!0});Af.createLogLevelDiagLogger=void 0;var Hr=Da();function bA(e,t){if(e<Hr.DiagLogLevel.NONE)e=Hr.DiagLogLevel.NONE;else if(e>Hr.DiagLogLevel.ALL)e=Hr.DiagLogLevel.ALL;t=t||{};function n(o,i){let a=t[o];if(typeof a==="function"&&e>=i)return a.bind(t);return function(){}}return{error:n("error",Hr.DiagLogLevel.ERROR),warn:n("warn",Hr.DiagLogLevel.WARN),info:n("info",Hr.DiagLogLevel.INFO),debug:n("debug",Hr.DiagLogLevel.DEBUG),verbose:n("verbose",Hr.DiagLogLevel.VERBOSE)}}Af.createLogLevelDiagLogger=bA});var Dn=ye(function(Of){Object.defineProperty(Of,"__esModule",{value:!0});Of.DiagAPI=void 0;var _A=Rf(),SA=Mf(),jf=Da(),za=Nn(),wA="diag";class $l{static instance(){if(!this._instance)this._instance=new $l;return this._instance}constructor(){function e(o){return function(...i){let a=(0,za.getGlobal)("diag");if(!a)return;return a[o](...i)}}let t=this,n=(o,i={logLevel:jf.DiagLogLevel.INFO})=>{var a,s,l;if(o===t){let d=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((a=d.stack)!==null&&a!==void 0?a:d.message),!1}if(typeof i==="number")i={logLevel:i};let c=(0,za.getGlobal)("diag"),u=(0,SA.createLogLevelDiagLogger)((s=i.logLevel)!==null&&s!==void 0?s:jf.DiagLogLevel.INFO,o);if(c&&!i.suppressOverrideMessage){let d=(l=Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${d}`),u.warn(`Current logger will overwrite one already registered from ${d}`)}return(0,za.registerGlobal)("diag",u,t,!0)};t.setLogger=n,t.disable=()=>{(0,za.unregisterGlobal)(wA,t)},t.createComponentLogger=(o)=>new _A.DiagComponentLogger(o),t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}}Of.DiagAPI=$l});var Uf=ye(function(Df){Object.defineProperty(Df,"__esModule",{value:!0});Df.BaggageImpl=void 0;class po{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(!t)return;return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,t){let n=new po(this._entries);return n._entries.set(e,t),n}removeEntry(e){let t=new po(this._entries);return t._entries.delete(e),t}removeEntries(...e){let t=new po(this._entries);for(let n of e)t._entries.delete(n);return t}clear(){return new po}}Df.BaggageImpl=po});var Lf=ye(function($f){Object.defineProperty($f,"__esModule",{value:!0});$f.baggageEntryMetadataSymbol=void 0;$f.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var ql=ye(function(Ff){Object.defineProperty(Ff,"__esModule",{value:!0});Ff.baggageEntryMetadataFromString=Ff.createBaggage=void 0;var xA=Dn(),TA=Uf(),IA=Lf(),CA=xA.DiagAPI.instance();function kA(e={}){return new TA.BaggageImpl(new Map(Object.entries(e)))}Ff.createBaggage=kA;function RA(e){if(typeof e!=="string")CA.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:IA.baggageEntryMetadataSymbol,toString(){return e}}}Ff.baggageEntryMetadataFromString=RA});var wi=ye(function(Gf){Object.defineProperty(Gf,"__esModule",{value:!0});Gf.ROOT_CONTEXT=Gf.createContextKey=void 0;function AA(e){return Symbol.for(e)}Gf.createContextKey=AA;class Ua{constructor(e){let t=this;t._currentContext=e?new Map(e):new Map,t.getValue=(n)=>t._currentContext.get(n),t.setValue=(n,o)=>{let i=new Ua(t._currentContext);return i._currentContext.set(n,o),i},t.deleteValue=(n)=>{let o=new Ua(t._currentContext);return o._currentContext.delete(n),o}}}Gf.ROOT_CONTEXT=new Ua});var Zf=ye(function(Wf){Object.defineProperty(Wf,"__esModule",{value:!0});Wf.DiagConsoleLogger=Wf._originalConsoleMethods=void 0;var Ll=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];Wf._originalConsoleMethods={};if(typeof console<"u"){let e=["error","warn","info","debug","trace","log"];for(let t of e)if(typeof console[t]==="function")Wf._originalConsoleMethods[t]=console[t]}class Hf{constructor(){function e(t){return function(...n){let o=Wf._originalConsoleMethods[t];if(typeof o!=="function")o=Wf._originalConsoleMethods.log;if(typeof o!=="function"&&console){if(o=console[t],typeof o!=="function")o=console.log}if(typeof o==="function")return o.apply(console,n)}}for(let t=0;t<Ll.length;t++)this[Ll[t].n]=e(Ll[t].c)}}Wf.DiagConsoleLogger=Hf});var Kl=ye(function(Kf){Object.defineProperty(Kf,"__esModule",{value:!0});Kf.createNoopMeter=Kf.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Kf.NOOP_OBSERVABLE_GAUGE_METRIC=Kf.NOOP_OBSERVABLE_COUNTER_METRIC=Kf.NOOP_UP_DOWN_COUNTER_METRIC=Kf.NOOP_HISTOGRAM_METRIC=Kf.NOOP_GAUGE_METRIC=Kf.NOOP_COUNTER_METRIC=Kf.NOOP_METER=Kf.NoopObservableUpDownCounterMetric=Kf.NoopObservableGaugeMetric=Kf.NoopObservableCounterMetric=Kf.NoopObservableMetric=Kf.NoopHistogramMetric=Kf.NoopGaugeMetric=Kf.NoopUpDownCounterMetric=Kf.NoopCounterMetric=Kf.NoopMetric=Kf.NoopMeter=void 0;class Fl{constructor(){}createGauge(e,t){return Kf.NOOP_GAUGE_METRIC}createHistogram(e,t){return Kf.NOOP_HISTOGRAM_METRIC}createCounter(e,t){return Kf.NOOP_COUNTER_METRIC}createUpDownCounter(e,t){return Kf.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(e,t){return Kf.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(e,t){return Kf.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(e,t){return Kf.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}}Kf.NoopMeter=Fl;class mo{}Kf.NoopMetric=mo;class Bl extends mo{add(e,t){}}Kf.NoopCounterMetric=Bl;class Gl extends mo{add(e,t){}}Kf.NoopUpDownCounterMetric=Gl;class Jl extends mo{record(e,t){}}Kf.NoopGaugeMetric=Jl;class Hl extends mo{record(e,t){}}Kf.NoopHistogramMetric=Hl;class xi{addCallback(e){}removeCallback(e){}}Kf.NoopObservableMetric=xi;class Wl extends xi{}Kf.NoopObservableCounterMetric=Wl;class Vl extends xi{}Kf.NoopObservableGaugeMetric=Vl;class Zl extends xi{}Kf.NoopObservableUpDownCounterMetric=Zl;Kf.NOOP_METER=new Fl;Kf.NOOP_COUNTER_METRIC=new Bl;Kf.NOOP_GAUGE_METRIC=new Jl;Kf.NOOP_HISTOGRAM_METRIC=new Hl;Kf.NOOP_UP_DOWN_COUNTER_METRIC=new Gl;Kf.NOOP_OBSERVABLE_COUNTER_METRIC=new Wl;Kf.NOOP_OBSERVABLE_GAUGE_METRIC=new Vl;Kf.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new Zl;function MA(){return Kf.NOOP_METER}Kf.createNoopMeter=MA});var sh=ye(function(ah){Object.defineProperty(ah,"__esModule",{value:!0});ah.ValueType=void 0;var BA;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(BA=ah.ValueType||(ah.ValueType={}))});var Ql=ye(function(lh){Object.defineProperty(lh,"__esModule",{value:!0});lh.defaultTextMapSetter=lh.defaultTextMapGetter=void 0;lh.defaultTextMapGetter={get(e,t){if(e==null)return;return e[t]},keys(e){if(e==null)return[];return Object.keys(e)}};lh.defaultTextMapSetter={set(e,t,n){if(e==null)return;e[t]=n}}});var mh=ye(function(dh){Object.defineProperty(dh,"__esModule",{value:!0});dh.NoopContextManager=void 0;var JA=wi();class uh{active(){return JA.ROOT_CONTEXT}with(e,t,n,...o){return t.call(n,...o)}bind(e,t){return t}enable(){return this}disable(){return this}}dh.NoopContextManager=uh});var Ti=ye(function(fh){Object.defineProperty(fh,"__esModule",{value:!0});fh.ContextAPI=void 0;var HA=mh(),Xl=Nn(),gh=Dn(),ec="context",WA=new HA.NoopContextManager;class tc{constructor(){}static getInstance(){if(!this._instance)this._instance=new tc;return this._instance}setGlobalContextManager(e){return(0,Xl.registerGlobal)(ec,e,gh.DiagAPI.instance())}active(){return this._getContextManager().active()}with(e,t,n,...o){return this._getContextManager().with(e,t,n,...o)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return(0,Xl.getGlobal)(ec)||WA}disable(){this._getContextManager().disable(),(0,Xl.unregisterGlobal)(ec,gh.DiagAPI.instance())}}fh.ContextAPI=tc});var nc=ye(function(yh){Object.defineProperty(yh,"__esModule",{value:!0});yh.TraceFlags=void 0;var VA;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(VA=yh.TraceFlags||(yh.TraceFlags={}))});var qa=ye(function(vh){Object.defineProperty(vh,"__esModule",{value:!0});vh.INVALID_SPAN_CONTEXT=vh.INVALID_TRACEID=vh.INVALID_SPANID=void 0;var ZA=nc();vh.INVALID_SPANID="0000000000000000";vh.INVALID_TRACEID="00000000000000000000000000000000";vh.INVALID_SPAN_CONTEXT={traceId:vh.INVALID_TRACEID,spanId:vh.INVALID_SPANID,traceFlags:ZA.TraceFlags.NONE}});var La=ye(function(xh){Object.defineProperty(xh,"__esModule",{value:!0});xh.NonRecordingSpan=void 0;var KA=qa();class wh{constructor(e=KA.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}xh.NonRecordingSpan=wh});var ac=ye(function(Ch){Object.defineProperty(Ch,"__esModule",{value:!0});Ch.getSpanContext=Ch.setSpanContext=Ch.deleteSpan=Ch.setSpan=Ch.getActiveSpan=Ch.getSpan=void 0;var YA=wi(),QA=La(),XA=Ti(),oc=(0,YA.createContextKey)("OpenTelemetry Context Key SPAN");function ic(e){return e.getValue(oc)||void 0}Ch.getSpan=ic;function eP(){return ic(XA.ContextAPI.getInstance().active())}Ch.getActiveSpan=eP;function Ih(e,t){return e.setValue(oc,t)}Ch.setSpan=Ih;function tP(e){return e.deleteValue(oc)}Ch.deleteSpan=tP;function rP(e,t){return Ih(e,new QA.NonRecordingSpan(t))}Ch.setSpanContext=rP;function nP(e){var t;return(t=ic(e))===null||t===void 0?void 0:t.spanContext()}Ch.getSpanContext=nP});var Ba=ye(function(Mh){Object.defineProperty(Mh,"__esModule",{value:!0});Mh.wrapSpanContext=Mh.isSpanContextValid=Mh.isValidSpanId=Mh.isValidTraceId=void 0;var Rh=qa(),cP=La(),Fa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Eh(e,t){if(typeof e!=="string"||e.length!==t)return!1;let n=0;for(let o=0;o<e.length;o+=4)n+=(Fa[e.charCodeAt(o)]|0)+(Fa[e.charCodeAt(o+1)]|0)+(Fa[e.charCodeAt(o+2)]|0)+(Fa[e.charCodeAt(o+3)]|0);return n===t}function Ah(e){return Eh(e,32)&&e!==Rh.INVALID_TRACEID}Mh.isValidTraceId=Ah;function Ph(e){return Eh(e,16)&&e!==Rh.INVALID_SPANID}Mh.isValidSpanId=Ph;function uP(e){return Ah(e.traceId)&&Ph(e.spanId)}Mh.isSpanContextValid=uP;function dP(e){return new cP.NonRecordingSpan(e)}Mh.wrapSpanContext=dP});var cc=ye(function(Dh){Object.defineProperty(Dh,"__esModule",{value:!0});Dh.NoopTracer=void 0;var fP=Ti(),Oh=ac(),sc=La(),hP=Ba(),lc=fP.ContextAPI.getInstance();class Nh{startSpan(e,t,n=lc.active()){if(Boolean(t===null||t===void 0?void 0:t.root))return new sc.NonRecordingSpan;let i=n&&(0,Oh.getSpanContext)(n);if(yP(i)&&(0,hP.isSpanContextValid)(i))return new sc.NonRecordingSpan(i);else return new sc.NonRecordingSpan}startActiveSpan(e,t,n,o){let i,a,s;if(arguments.length<2)return;else if(arguments.length===2)s=t;else if(arguments.length===3)i=t,s=n;else i=t,a=n,s=o;let l=a!==null&&a!==void 0?a:lc.active(),c=this.startSpan(e,i,l),u=(0,Oh.setSpan)(l,c);return lc.with(u,s,void 0,c)}}Dh.NoopTracer=Nh;function yP(e){return e!==null&&typeof e==="object"&&"spanId"in e&&typeof e.spanId==="string"&&"traceId"in e&&typeof e.traceId==="string"&&"traceFlags"in e&&typeof e.traceFlags==="number"}});var uc=ye(function($h){Object.defineProperty($h,"__esModule",{value:!0});$h.ProxyTracer=void 0;var vP=cc(),bP=new vP.NoopTracer;class Uh{constructor(e,t,n,o){this._provider=e,this.name=t,this.version=n,this.options=o}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return bP;return this._delegate=e,this._delegate}}$h.ProxyTracer=Uh});var Gh=ye(function(Fh){Object.defineProperty(Fh,"__esModule",{value:!0});Fh.NoopTracerProvider=void 0;var _P=cc();class Lh{getTracer(e,t,n){return new _P.NoopTracer}}Fh.NoopTracerProvider=Lh});var dc=ye(function(Hh){Object.defineProperty(Hh,"__esModule",{value:!0});Hh.ProxyTracerProvider=void 0;var SP=uc(),wP=Gh(),xP=new wP.NoopTracerProvider;class Jh{getTracer(e,t,n){var o;return(o=this.getDelegateTracer(e,t,n))!==null&&o!==void 0?o:new SP.ProxyTracer(this,e,t,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:xP}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,t,n)}}Hh.ProxyTracerProvider=Jh});var Zh=ye(function(Vh){Object.defineProperty(Vh,"__esModule",{value:!0});Vh.SamplingDecision=void 0;var TP;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(TP=Vh.SamplingDecision||(Vh.SamplingDecision={}))});var Yh=ye(function(Kh){Object.defineProperty(Kh,"__esModule",{value:!0});Kh.SpanKind=void 0;var IP;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(IP=Kh.SpanKind||(Kh.SpanKind={}))});var Xh=ye(function(Qh){Object.defineProperty(Qh,"__esModule",{value:!0});Qh.SpanStatusCode=void 0;var CP;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(CP=Qh.SpanStatusCode||(Qh.SpanStatusCode={}))});var ry=ye(function(ey){Object.defineProperty(ey,"__esModule",{value:!0});ey.validateValue=ey.validateKey=void 0;var fc="[_0-9a-z-*/]",kP=`[a-z]${fc}{0,255}`,RP=`[a-z0-9]${fc}{0,240}@[a-z]${fc}{0,13}`,EP=new RegExp(`^(?:${kP}|${RP})$`),AP=/^[ -~]{0,255}[!-~]$/,PP=/,|=/;function MP(e){return EP.test(e)}ey.validateKey=MP;function jP(e){return AP.test(e)&&!PP.test(e)}ey.validateValue=jP});var cy=ye(function(sy){Object.defineProperty(sy,"__esModule",{value:!0});sy.TraceStateImpl=void 0;var ny=ry(),oy=32,NP=512,iy=",",ay="=";class hc{constructor(e){if(this._internalState=new Map,e)this._parse(e)}set(e,t){let n=this._clone();if(n._internalState.has(e))n._internalState.delete(e);return n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,t)=>(e.push(t+ay+this.get(t)),e),[]).join(iy)}_parse(e){if(e.length>NP)return;if(this._internalState=e.split(iy).reduceRight((t,n)=>{let o=n.trim(),i=o.indexOf(ay);if(i!==-1){let a=o.slice(0,i),s=o.slice(i+1,n.length);if((0,ny.validateKey)(a)&&(0,ny.validateValue)(s))t.set(a,s)}return t},new Map),this._internalState.size>oy)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,oy))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new hc;return e._internalState=new Map(this._internalState),e}}sy.TraceStateImpl=hc});var py=ye(function(uy){Object.defineProperty(uy,"__esModule",{value:!0});uy.createTraceState=void 0;var DP=cy();function zP(e){return new DP.TraceStateImpl(e)}uy.createTraceState=zP});var fy=ye(function(my){Object.defineProperty(my,"__esModule",{value:!0});my.context=void 0;var UP=Ti();my.context=UP.ContextAPI.getInstance()});var vy=ye(function(hy){Object.defineProperty(hy,"__esModule",{value:!0});hy.diag=void 0;var $P=Dn();hy.diag=$P.DiagAPI.instance()});var Sy=ye(function(by){Object.defineProperty(by,"__esModule",{value:!0});by.NOOP_METER_PROVIDER=by.NoopMeterProvider=void 0;var qP=Kl();class yc{getMeter(e,t,n){return qP.NOOP_METER}}by.NoopMeterProvider=yc;by.NOOP_METER_PROVIDER=new yc});var Iy=ye(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});xy.MetricsAPI=void 0;var FP=Sy(),vc=Nn(),wy=Dn(),bc="metrics";class _c{constructor(){}static getInstance(){if(!this._instance)this._instance=new _c;return this._instance}setGlobalMeterProvider(e){return(0,vc.registerGlobal)(bc,e,wy.DiagAPI.instance())}getMeterProvider(){return(0,vc.getGlobal)(bc)||FP.NOOP_METER_PROVIDER}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){(0,vc.unregisterGlobal)(bc,wy.DiagAPI.instance())}}xy.MetricsAPI=_c});var Ry=ye(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});Cy.metrics=void 0;var BP=Iy();Cy.metrics=BP.MetricsAPI.getInstance()});var My=ye(function(Ay){Object.defineProperty(Ay,"__esModule",{value:!0});Ay.NoopTextMapPropagator=void 0;class Ey{inject(e,t){}extract(e,t){return e}fields(){return[]}}Ay.NoopTextMapPropagator=Ey});var Dy=ye(function(Oy){Object.defineProperty(Oy,"__esModule",{value:!0});Oy.deleteBaggage=Oy.setBaggage=Oy.getActiveBaggage=Oy.getBaggage=void 0;var GP=Ti(),JP=wi(),Sc=(0,JP.createContextKey)("OpenTelemetry Baggage Key");function jy(e){return e.getValue(Sc)||void 0}Oy.getBaggage=jy;function HP(){return jy(GP.ContextAPI.getInstance().active())}Oy.getActiveBaggage=HP;function WP(e,t){return e.setValue(Sc,t)}Oy.setBaggage=WP;function VP(e){return e.deleteValue(Sc)}Oy.deleteBaggage=VP});var Ly=ye(function($y){Object.defineProperty($y,"__esModule",{value:!0});$y.PropagationAPI=void 0;var wc=Nn(),QP=My(),zy=Ql(),Ga=Dy(),XP=ql(),Uy=Dn(),xc="propagation",eM=new QP.NoopTextMapPropagator;class Tc{constructor(){this.createBaggage=XP.createBaggage,this.getBaggage=Ga.getBaggage,this.getActiveBaggage=Ga.getActiveBaggage,this.setBaggage=Ga.setBaggage,this.deleteBaggage=Ga.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new Tc;return this._instance}setGlobalPropagator(e){return(0,wc.registerGlobal)(xc,e,Uy.DiagAPI.instance())}inject(e,t,n=zy.defaultTextMapSetter){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=zy.defaultTextMapGetter){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,wc.unregisterGlobal)(xc,Uy.DiagAPI.instance())}_getGlobalPropagator(){return(0,wc.getGlobal)(xc)||eM}}$y.PropagationAPI=Tc});var Gy=ye(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});Fy.propagation=void 0;var tM=Ly();Fy.propagation=tM.PropagationAPI.getInstance()});var Ky=ye(function(Vy){Object.defineProperty(Vy,"__esModule",{value:!0});Vy.TraceAPI=void 0;var Ic=Nn(),Jy=dc(),Hy=Ba(),go=ac(),Wy=Dn(),Cc="trace";class kc{constructor(){this._proxyTracerProvider=new Jy.ProxyTracerProvider,this.wrapSpanContext=Hy.wrapSpanContext,this.isSpanContextValid=Hy.isSpanContextValid,this.deleteSpan=go.deleteSpan,this.getSpan=go.getSpan,this.getActiveSpan=go.getActiveSpan,this.getSpanContext=go.getSpanContext,this.setSpan=go.setSpan,this.setSpanContext=go.setSpanContext}static getInstance(){if(!this._instance)this._instance=new kc;return this._instance}setGlobalTracerProvider(e){let t=(0,Ic.registerGlobal)(Cc,this._proxyTracerProvider,Wy.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(e);return t}getTracerProvider(){return(0,Ic.getGlobal)(Cc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){(0,Ic.unregisterGlobal)(Cc,Wy.DiagAPI.instance()),this._proxyTracerProvider=new Jy.ProxyTracerProvider}}Vy.TraceAPI=kc});var Xy=ye(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});Yy.trace=void 0;var rM=Ky();Yy.trace=rM.TraceAPI.getInstance()});var Ac=ye(function(Ze){Object.defineProperty(Ze,"__esModule",{value:!0});Ze.trace=Ze.propagation=Ze.metrics=Ze.diag=Ze.context=Ze.INVALID_SPAN_CONTEXT=Ze.INVALID_TRACEID=Ze.INVALID_SPANID=Ze.isValidSpanId=Ze.isValidTraceId=Ze.isSpanContextValid=Ze.createTraceState=Ze.TraceFlags=Ze.SpanStatusCode=Ze.SpanKind=Ze.SamplingDecision=Ze.ProxyTracerProvider=Ze.ProxyTracer=Ze.defaultTextMapSetter=Ze.defaultTextMapGetter=Ze.ValueType=Ze.createNoopMeter=Ze.DiagLogLevel=Ze.DiagConsoleLogger=Ze.ROOT_CONTEXT=Ze.createContextKey=Ze.baggageEntryMetadataFromString=void 0;var nM=ql();Object.defineProperty(Ze,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return nM.baggageEntryMetadataFromString}});var ev=wi();Object.defineProperty(Ze,"createContextKey",{enumerable:!0,get:function(){return ev.createContextKey}});Object.defineProperty(Ze,"ROOT_CONTEXT",{enumerable:!0,get:function(){return ev.ROOT_CONTEXT}});var oM=Zf();Object.defineProperty(Ze,"DiagConsoleLogger",{enumerable:!0,get:function(){return oM.DiagConsoleLogger}});var iM=Da();Object.defineProperty(Ze,"DiagLogLevel",{enumerable:!0,get:function(){return iM.DiagLogLevel}});var aM=Kl();Object.defineProperty(Ze,"createNoopMeter",{enumerable:!0,get:function(){return aM.createNoopMeter}});var sM=sh();Object.defineProperty(Ze,"ValueType",{enumerable:!0,get:function(){return sM.ValueType}});var tv=Ql();Object.defineProperty(Ze,"defaultTextMapGetter",{enumerable:!0,get:function(){return tv.defaultTextMapGetter}});Object.defineProperty(Ze,"defaultTextMapSetter",{enumerable:!0,get:function(){return tv.defaultTextMapSetter}});var lM=uc();Object.defineProperty(Ze,"ProxyTracer",{enumerable:!0,get:function(){return lM.ProxyTracer}});var cM=dc();Object.defineProperty(Ze,"ProxyTracerProvider",{enumerable:!0,get:function(){return cM.ProxyTracerProvider}});var uM=Zh();Object.defineProperty(Ze,"SamplingDecision",{enumerable:!0,get:function(){return uM.SamplingDecision}});var dM=Yh();Object.defineProperty(Ze,"SpanKind",{enumerable:!0,get:function(){return dM.SpanKind}});var pM=Xh();Object.defineProperty(Ze,"SpanStatusCode",{enumerable:!0,get:function(){return pM.SpanStatusCode}});var mM=nc();Object.defineProperty(Ze,"TraceFlags",{enumerable:!0,get:function(){return mM.TraceFlags}});var gM=py();Object.defineProperty(Ze,"createTraceState",{enumerable:!0,get:function(){return gM.createTraceState}});var Rc=Ba();Object.defineProperty(Ze,"isSpanContextValid",{enumerable:!0,get:function(){return Rc.isSpanContextValid}});Object.defineProperty(Ze,"isValidTraceId",{enumerable:!0,get:function(){return Rc.isValidTraceId}});Object.defineProperty(Ze,"isValidSpanId",{enumerable:!0,get:function(){return Rc.isValidSpanId}});var Ec=qa();Object.defineProperty(Ze,"INVALID_SPANID",{enumerable:!0,get:function(){return Ec.INVALID_SPANID}});Object.defineProperty(Ze,"INVALID_TRACEID",{enumerable:!0,get:function(){return Ec.INVALID_TRACEID}});Object.defineProperty(Ze,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return Ec.INVALID_SPAN_CONTEXT}});var rv=fy();Object.defineProperty(Ze,"context",{enumerable:!0,get:function(){return rv.context}});var nv=vy();Object.defineProperty(Ze,"diag",{enumerable:!0,get:function(){return nv.diag}});var ov=Ry();Object.defineProperty(Ze,"metrics",{enumerable:!0,get:function(){return ov.metrics}});var iv=Gy();Object.defineProperty(Ze,"propagation",{enumerable:!0,get:function(){return iv.propagation}});var av=Xy();Object.defineProperty(Ze,"trace",{enumerable:!0,get:function(){return av.trace}});Ze.default={context:rv.context,diag:nv.diag,metrics:ov.metrics,propagation:iv.propagation,trace:av.trace}});var is=ye(function($S){Object.defineProperty($S,"__esModule",{value:!0});function zS(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function US(){let e=zS();if(e.__xstate__)return e.__xstate__;return}function Mz(e){if(typeof window>"u")return;let t=US();if(t)t.register(e)}var jz=(e)=>{if(typeof window>"u")return;let t=US();if(t)t.register(e)};$S.devToolsAdapter=jz;$S.getGlobal=zS;$S.registerService=Mz});var Ao=ye(function(FU){var zz=is();class Pu{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){if(this._current)this._current.next=null,this._last=this._current}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}if(this._current=t,this._last=t,this._active)this.flush()}flush(){while(this._current){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}}var JS=".",Uz="",HS="",$z="#",Mu="*",WS="xstate.init",qz="xstate.error",as="xstate.stop";function Lz(e,t){return{type:`xstate.after.${e}.${t}`}}function ju(e,t){return{type:`xstate.done.state.${e}`,output:t}}function Fz(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function VS(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function ZS(e){return{type:WS,input:e}}function Pr(e){setTimeout(()=>{throw e})}var Bz=(()=>typeof Symbol==="function"&&Symbol.observable||"@@observable")();function zu(e,t){let n=qS(e),o=qS(t);if(typeof o==="string"){if(typeof n==="string")return o===n;return!1}if(typeof n==="string")return n in o;return Object.keys(n).every((i)=>{if(!(i in o))return!1;return zu(n[i],o[i])})}function Uu(e){if(QS(e))return e;let t=[],n="";for(let o=0;o<e.length;o++){switch(e.charCodeAt(o)){case 92:n+=e[o+1],o++;continue;case 46:t.push(n),n="";continue}n+=e[o]}return t.push(n),t}function qS(e){if(hw(e))return e.value;if(typeof e!=="string")return e;let t=Uu(e);return KS(t)}function KS(e){if(e.length===1)return e[0];let t={},n=t;for(let o=0;o<e.length-1;o++)if(o===e.length-2)n[e[o]]=e[o+1];else{let i=n;n={},i[e[o]]=n}return t}function Gz(e,t){let n={},o=Object.keys(e);for(let i=0;i<o.length;i++){let a=o[i];n[a]=t(e[a],a,e,i)}return n}function YS(e){if(QS(e))return e;return[e]}function Gi(e){if(e===void 0)return[];return YS(e)}function Ou(e,t,n,o){if(typeof e==="function")return e({context:t,event:n,self:o});if(!!e&&typeof e==="object"&&Object.values(e).some((i)=>typeof i==="function"))console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.
|
|
4
4
|
Found object containing properties whose values are possibly mapping functions: ${Object.entries(e).filter(([,i])=>typeof i==="function").map(([i,a])=>`
|
|
5
5
|
- ${i}: ${a.toString().replace(/\n\s*/g,"")}`).join("")}`);return e}function QS(e){return Array.isArray(e)}function Jz(e){return e.type.startsWith("xstate.error.actor")}function xo(e){return YS(e).map((t)=>{if(typeof t>"u"||typeof t==="string")return{target:t};return t})}function XS(e){if(e===void 0||e===Uz)return;return Gi(e)}function Fi(e,t,n){let o=typeof e==="object",i=o?e:void 0;return{next:(o?e.next:e)?.bind(i),error:(o?e.error:t)?.bind(i),complete:(o?e.complete:n)?.bind(i)}}function Hz(e,t){return`${t}.${e}`}function ew(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,o,i]=n,s=e.getStateNodeById(i).config.invoke;return(Array.isArray(s)?s[o]:s).src}function Wz(e){return[...new Set([...e._nodes.flatMap((t)=>t.ownEvents)])]}function tw(e,t){if(t===e)return!0;if(t===Mu)return!0;if(!t.endsWith(".*"))return!1;if(/.*\*.+/.test(t))console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${t}" event.`);let n=t.split("."),o=e.split(".");for(let i=0;i<n.length;i++){let a=n[i],s=o[i];if(a==="*"){let l=i===n.length-1;if(!l)console.warn(`Infix wildcards in transition events are not allowed. Check the "${t}" transition.`);return l}if(a!==s)return!1}return!0}function LS(e,t){return`${e.sessionId}.${t}`}var Vz=0;function rw(e,t){let n=new Map,o=new Map,i=new WeakMap,a=new Set,s={},{clock:l,logger:c}=t,u={schedule:(p,f,g,h,v=Math.random().toString(36).slice(2))=>{let w={source:p,target:f,event:g,delay:h,id:v,startedAt:Date.now()},S=LS(p,v);m._snapshot._scheduledEvents[S]=w;let y=l.setTimeout(()=>{delete s[S],delete m._snapshot._scheduledEvents[S],m._relay(p,f,g)},h);s[S]=y},cancel:(p,f)=>{let g=LS(p,f),h=s[g];if(delete s[g],delete m._snapshot._scheduledEvents[g],h!==void 0)l.clearTimeout(h)},cancelAll:(p)=>{for(let f in m._snapshot._scheduledEvents){let g=m._snapshot._scheduledEvents[f];if(g.source===p)u.cancel(p,g.id)}}},d=(p)=>{if(!a.size)return;let f={...p,rootId:e.sessionId};a.forEach((g)=>g.next?.(f))},m={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${Vz++}`,_register:(p,f)=>(n.set(p,f),p),_unregister:(p)=>{n.delete(p.sessionId);let f=i.get(p);if(f!==void 0)o.delete(f),i.delete(p)},get:(p)=>o.get(p),getAll:()=>Object.fromEntries(o.entries()),_set:(p,f)=>{let g=o.get(p);if(g&&g!==f)throw Error(`Actor with system ID '${p}' already exists.`);o.set(p,f),i.set(f,p)},inspect:(p)=>{let f=Fi(p);return a.add(f),{unsubscribe(){a.delete(f)}}},_sendInspectionEvent:d,_relay:(p,f,g)=>{m._sendInspectionEvent({type:"@xstate.event",sourceRef:p,actorRef:f,event:g}),f._send(g)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...m._snapshot._scheduledEvents}}),start:()=>{let p=m._snapshot._scheduledEvents;m._snapshot._scheduledEvents={};for(let f in p){let{source:g,target:h,event:v,delay:w,id:S}=p[f];u.schedule(g,h,v,w,S)}},_clock:l,_logger:c};return m}FU.executingCustomAction=!1;var $u=1,Ht=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),Zz={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class qu{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new Pu(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Ht.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...Zz,...t},{clock:o,logger:i,parent:a,syncSnapshot:s,id:l,systemId:c,inspect:u}=n;if(this.system=a?a.system:rw(this,{clock:o,logger:i}),u&&!a)this.system.inspect(Fi(u));if(this.sessionId=this.system._bookId(),this.id=l??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=a,this._syncSnapshot=s,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:(d)=>{this._deferred.push(d)},system:this.system,stopChild:(d)=>{if(d._parent!==this)throw Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);d._stop()},emit:(d)=>{let m=this.eventListeners.get(d.type),p=this.eventListeners.get("*");if(!m&&!p)return;let f=[...m?m.values():[],...p?p.values():[]];for(let g of f)try{g(d)}catch(h){Pr(h)}},actionExecutor:(d)=>{let m=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:d.type,params:d.params}}),!d.exec)return;let p=FU.executingCustomAction;try{FU.executingCustomAction=!0,d.exec(d.info,d.params)}finally{FU.executingCustomAction=p}};if(this._processingStatus===Ht.Running)m();else this._deferred.push(m)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c)this.systemId=c,this.system._set(c,this);if(this._initState(t?.snapshot??t?.state),c&&this._snapshot.status!=="active")this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(t){this._snapshot={status:"error",output:void 0,error:t}}}update(e,t){this._snapshot=e;let n;while(n=this._deferred.shift())try{n()}catch(o){this._deferred.length=0,this._snapshot={...e,status:"error",error:o}}switch(this._snapshot.status){case"active":for(let o of this.observers)try{o.next?.(e)}catch(i){Pr(i)}break;case"done":for(let o of this.observers)try{o.next?.(e)}catch(i){Pr(i)}if(this._stopProcedure(),this._complete(),this._doneEvent=Fz(this.id,this._snapshot.output),this._parent)this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:t,snapshot:e})}subscribe(e,t,n){let o=Fi(e,t,n);if(this._processingStatus!==Ht.Stopped)this.observers.add(o);else switch(this._snapshot.status){case"done":try{o.complete?.()}catch(i){Pr(i)}break;case"error":{let i=this._snapshot.error;if(!o.error)Pr(i);else try{o.error(i)}catch(a){Pr(a)}break}}return{unsubscribe:()=>{this.observers.delete(o)}}}on(e,t){let n=this.eventListeners.get(e);if(!n)n=new Set,this.eventListeners.set(e,n);let o=t.bind(void 0);return n.add(o),{unsubscribe:()=>{n.delete(o)}}}select(e,t=Object.is){return{subscribe:(n)=>{let o=Fi(n),i=this.getSnapshot(),a=e(i);return this.subscribe((s)=>{let l=e(s);if(!t(a,l))a=l,o.next?.(l)})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===Ht.Running)return this;if(this._syncSnapshot)this.subscribe({next:(n)=>{if(n.status==="active")this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:n})},error:()=>{}});if(this.system._register(this.sessionId,this),this.systemId)this.system._set(this.systemId,this);this._processingStatus=Ht.Running;let e=ZS(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(!this._parent)this.system.start();if(this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(n){return this._snapshot={...this._snapshot,status:"error",error:n},this._error(n),this}if(this.update(this._snapshot,e),this.options.devTools)this.attachDevTools();return this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(o){n={err:o}}if(n){let{err:o}=n;this._snapshot={...this._snapshot,status:"error",error:o},this._error(o);return}if(this.update(t,e),e.type===as)this._stopProcedure(),this._complete()}_stop(){if(this._processingStatus===Ht.Stopped)return this;if(this.mailbox.clear(),this._processingStatus===Ht.NotStarted)return this._processingStatus=Ht.Stopped,this;return this.mailbox.enqueue({type:as}),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(t){Pr(t)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){if(!this._parent)Pr(e);this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let o=n.error;t||=!o;try{o?.(e)}catch(i){Pr(i)}}if(this.observers.clear(),this.eventListeners.clear(),t)Pr(e)}_error(e){if(this._stopProcedure(),this._reportError(e),this._parent)this.system._relay(this,this._parent,VS(this.id,e))}_stopProcedure(){if(this._processingStatus!==Ht.Running)return this;return this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new Pu(this._process.bind(this)),this._processingStatus=Ht.Stopped,this.system._unregister(this),this}_send(e){if(this._processingStatus===Ht.Stopped){{let t=JSON.stringify(e);console.warn(`Event "${e.type}" was sent to stopped actor "${this.id} (${this.sessionId})". This actor has already reached its final state, and will not transition.
|
|
@@ -174,9 +174,9 @@ ${DS}`:""),tools:x,activeTools:y,...i!==void 0&&c.supportsTemperature&&{temperat
|
|
|
174
174
|
`),s=ep(i,a,{timeout:100});if(!s)return"Full content replacement (line diff omitted: comparison exceeded its time limit).";return s.filter((l)=>l.added||l.removed).flatMap((l)=>l.value.map((c)=>`${l.added?"+":"-"} ${c}`)).join(`
|
|
175
175
|
`)}function aC(e,t,n,o){return iJ(e,t,n,o)??aJ(e.entityType,t,n)??sJ(e.entityType,t,n)}function sC(e,t,n){return rC(e.entityType,e.metadata.status,lJ(e,t,n),n)==="non-publish"?"update":"publish"}function lC(e,t,n){return t.content!==void 0?rJ(e,t.content,n):oC(e,t.fields??{},n)}function tn(e){return{success:!1,error:e}}function cJ(e,t){if(e.edits!==void 0&&(e.content!==void 0||e.fields!==void 0))return tn("Provide only one of 'edits', 'content', or 'fields'.");if(e.confirmed&&e.contentHash&&t.contentHash!==e.contentHash)return tn("Entity was modified since you reviewed the changes. Please try again.");let n=e.edits!==void 0?{content:NI(t.content,e.edits)}:CI({...e.fields!==void 0?{fields:e.fields}:{},...e.content!==void 0?{content:e.content}:{}});if(n.content!==void 0&&n.fields!==void 0)return tn("Provide either 'content' or 'fields', not both");if(!n.content&&!n.fields)return tn("Provide 'content' (full replacement) or 'fields' (partial update)");return n}function cC(e){let{entityService:t,logger:n,entityRegistry:o}=e,i=en({label:"update",requestNoun:"the update"}),a=(c,u)=>{if(!c.confirmed||!c.confirmationToken||c.edits!==void 0||c.fields!==void 0||c.content?.trim())return{input:c,replayed:!1};let d=Qd.safeParse(i.takePending(c.confirmationToken));if(!d.success||d.data.entityType!==u.entityType||d.data.id!==u.id)return tn("No pending update confirmation found for this entity. Please request the update again.");return{input:d.data,replayed:!0}},s=async(c,u,d,m,p)=>{if(!m){let g=i.validateConfirmed(c.confirmationToken,c);if(g)return g}let f=lC(u,d,o);if(f.visibility!==u.visibility&&!Fs(p.userPermissionLevel,f.visibility))return tn(`Cannot set entity visibility to "${f.visibility}" \u2014 caller permission "${p.userPermissionLevel??"public"}" is not allowed to write at that level.`);try{let g=$o(p);if((await t.updateEntity({entity:f,options:{expectedContentHash:u.contentHash,...g?{eventContext:g}:{}}})).skipReason==="content-conflict")return tn("Entity was modified before the update could be saved. Please request and confirm the update again.")}catch(g){return tn(ke(g,"Failed to update entity"))}return{success:!0,data:{updated:u.id}}},l=(c,u,d)=>{let{fields:m,content:p,...f}=c;return{needsConfirmation:!0,toolName:"system_update",summary:`Update "${Ls(u)}"?`,completionSummary:`Updated ${kI(u.entityType)}.`,preview:iC(u,d,o),args:i.buildArgs((g)=>({...f,...c.edits!==void 0?{edits:c.edits}:d,id:u.id,confirmed:!0,confirmationToken:g,contentHash:u.contentHash}))}};return Or("update","Update an entity's fields or content. For small content changes, fetch the entity and use edits with exact oldText/newText pairs instead of regenerating the whole document. Use only one of fields, content, or edits. Requires confirmation; call this tool without confirmed to request that confirmation instead of asking for plain-text approval. For direct requests that provide exact IDs to set an existing image as an entity cover, call this tool on the target entity with fields.coverImageId set to the image ID; do not stop after lookup.",Qd,async(c,u)=>{let d=await Nr(t,c.entityType,c.id,n,void 0,Wt(u.userPermissionLevel));if(!d.ok)return tn(d.error);let{entity:m}=d,p=a(c,m);if("success"in p)return p;let{input:f,replayed:g}=p,h=cJ(f,m);if("success"in h)return h;let v=aC(m,h,o,t);if(v)return v;let w=jr(e,f.entityType,sC(m,h,o),u);if(w)return w;return f.confirmed?s(f,m,h,g,u):l(f,m,h)},{visibility:"trusted",sideEffects:"writes"})}function uC(e){return[PI(e),jI(e),OI(e),cC(e)]}function Zs(e){if(e.interfaceType!==mt)return;if(e.userPermissionLevel!=="public"||e.isAnchor)throw Error("Guest execution denied")}var uJ=0.5,sp=(e)=>e==="public"?{publishedOnly:!0}:{};function dC(e){let{entityService:t,logger:n}=e;return[Sn("system","search","Search entities using semantic search. For broad search, make one system_search call with scope.kind all. Use scope.kind type only when the user asks for a specific entity type. Applies a default minScore of 0.5 to reduce weak matches; lower minScore only for exploratory or loose recall. Search results include each matched entity's content. When relevant results already contain the complete evidence needed, answer from those results instead of redundantly listing or getting the same entities. Search results are candidates; do not present weak or unrelated candidates as exact matches.",hI,async(o,i)=>{Zs(i);let a=Wt(i.userPermissionLevel);return{success:!0,data:{results:(await t.search({query:o.query,options:{limit:o.limit??e.searchLimit,...o.scope.kind==="type"&&{types:[o.scope.entityType]},minScore:o.minScore??uJ,...o.includeUngenerated!==void 0&&{includeUngenerated:o.includeUngenerated},visibilityScope:a,...sp(a)}})).map((s)=>{let l=Xd(s.entity,e.entityRegistry);return{...s,entity:l,...l!==s.entity?{excerpt:l.content}:{}}})}}},{visibility:"public",sideEffects:"none",cli:{name:"search"}}),Sn("system","get","Retrieve a specific entity by type and identifier (ID, slug, or title). If retrieval fails, report the entity as not found rather than describing related generation work as pending.",yI,async(o,i)=>{if(Zs(i),!t.getEntityTypes().includes(o.entityType))return{success:!1,error:`Unknown entity type: ${o.entityType}. Available: ${t.getEntityTypes().join(", ")}`};let a=Wt(i.userPermissionLevel),s=await Nr(t,o.entityType,o.id,n,void 0,a,sp(a));if(!s.ok)return{success:!1,error:s.error};return{success:!0,data:{entity:Xd(s.entity,e.entityRegistry)}}},{visibility:"public",sideEffects:"none",cli:{name:"get"}}),Sn("system","list","List entities by a known entity type. Returns metadata only \u2014 use system_get for full content. Use system_search, not system_list, for broad or vague lookup requests. Use system_list to inspect metadata dates such as publishedAt when the user asks for the latest item of a known type, such as latest blog post.",vI,async(o,i)=>{if(Zs(i),!t.getEntityTypes().includes(o.entityType))return{success:!1,error:`Unknown entity type: ${o.entityType}. Available: ${t.getEntityTypes().join(", ")}`};let a=Wt(i.userPermissionLevel),s={visibilityScope:a};if(o.status&&o.status!=="any")s.metadata={status:o.status};let{defaultSort:l}=e.entityRegistry.getEntityTypeConfig(o.entityType),u=(await t.listEntities({entityType:o.entityType,options:{limit:o.limit??20,filter:s,...sp(a),...l?{sortFields:l}:{}}})).map(({content:d,contentHash:m,...p})=>p);return{success:!0,data:{entities:u,count:u.length}}},{visibility:"public",sideEffects:"none",cli:{name:"list"}})]}function pC(e){let{entityService:t}=e;return[Sn("system","insights",`Get aggregate content insights and analytics only. For a general overview of actual content, use system_list instead. Available types: ${e.insights.getTypes().join(", ")}.`,xI,async(n,o)=>{let i=Wt(o.userPermissionLevel);return{success:!0,data:await e.insights.get(n.type,t,i)}},{visibility:"public",sideEffects:"none"})]}function mC(e){let{jobs:t}=e;return[Or("job_status","Inspect runtime job status for ready checks only when the prior operation created a job, or for status disputes. With a known batch ID, pass batchId. Without an ID, call this tool with no arguments to list active jobs and batches; do not ask the user for an ID first. Do not argue from the transcript alone.",wI,async(n)=>{if(n.batchId){let a=await t.getBatchStatus(n.batchId);if(!a)return{success:!1,error:`No batch found with ID: ${n.batchId}`};let s=a.totalOperations>0?Math.round(a.completedOperations/a.totalOperations*100):0;return{success:!0,data:{batchId:n.batchId,status:a.status,progress:{total:a.totalOperations,completed:a.completedOperations,failed:a.failedOperations,percentComplete:s},currentOperation:a.currentOperation,errors:a.errors}}}let o=await t.getActiveJobs(n.jobTypes),i=await t.getActiveBatches();return{success:!0,data:{summary:{activeJobs:o.length,activeBatches:i.length},jobs:o.map((a)=>({id:a.id,type:a.type,status:a.status,priority:a.priority,retryCount:a.retryCount,createdAt:new Date(a.createdAt).toISOString(),startedAt:a.startedAt?new Date(a.startedAt).toISOString():null})),batches:i.map((a)=>({batchId:a.batchId,status:a.status.status,totalOperations:a.status.totalOperations,completedOperations:a.status.completedOperations,failedOperations:a.status.failedOperations,currentOperation:a.status.currentOperation,pluginId:a.metadata.metadata.pluginId,errors:a.status.errors}))}}},{visibility:"public",sideEffects:"none"})]}function dJ(e){let{entityCounts:t,daemons:n,endpoints:o,interactions:i,...a}=e;return a}function gC(e){return[Sn("system","status","Get system status including model, version, interfaces, and tools",r.object({}),async()=>({success:!0,data:dJ(await e.getAppInfo())}),{visibility:"public",sideEffects:"none",cli:{name:"status"}})]}function fC(e){return[...dC(e),...mC(e),...gC(e),...uC(e),...pC(e)]}function hC(e){return[{uri:"entity://types",name:"Entity Types",description:"List of registered entity types",mimeType:"text/plain",handler:async()=>({contents:[{uri:"entity://types",mimeType:"text/plain",text:e.entityService.getEntityTypes().join(`
|
|
176
176
|
`)}]})},{uri:"brain://identity",name:"Brain Identity",description:"Brain character \u2014 name, role, purpose, values",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://identity",mimeType:"application/json",text:JSON.stringify(e.getIdentity(),null,2)}]})},{uri:"brain://profile",name:"Anchor Profile",description:"Brain owner profile \u2014 name, bio, expertise",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://profile",mimeType:"application/json",text:JSON.stringify(e.getProfile(),null,2)}]})},{uri:"brain://status",name:"Brain Status",description:"System status \u2014 version, model, interfaces, tools",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://status",mimeType:"application/json",text:JSON.stringify(await e.getAppInfo(),null,2)}]})}]}function yC(e){let{entityService:t}=e;return[{name:"entity-list",uriTemplate:"entity://{type}",description:"List entities of a given type",mimeType:"application/json",list:async()=>t.getEntityTypes().map((o)=>({uri:`entity://${o}`,name:`${o} entities`})),complete:{type:async()=>t.getEntityTypes()},handler:async({type:n})=>{let o=t.getEntityTypes();if(!o.includes(n))throw Error(`Unknown entity type: ${n}. Available: ${o.join(", ")}`);let a=(await t.listEntities({entityType:n})).map((s)=>({id:s.id,entityType:s.entityType,...s.metadata,updated:s.updated}));return{contents:[{uri:`entity://${n}`,mimeType:"application/json",text:JSON.stringify(a,null,2)}]}}},{name:"entity-detail",uriTemplate:"entity://{type}/{id}",description:"Read a single entity by type and ID",mimeType:"text/markdown",complete:{type:async(n)=>{let o=t.getEntityTypes();return n?o.filter((i)=>i.startsWith(n)):o},id:async()=>[]},handler:async({type:n,id:o})=>{let i=await t.getEntity({entityType:n,id:o});if(!i)throw Error(`Entity not found: ${n}/${o}`);return{contents:[{uri:`entity://${n}/${o}`,mimeType:"text/markdown",text:i.content}]}}}]}function vC(e){return[{name:"create",description:"Create new content of any type",args:{type:{description:"Entity type (e.g. post, deck, note)",required:!0},topic:{description:"Topic or title for the content"}},handler:async({topic:n,type:o})=>({messages:[{role:"user",content:{type:"text",text:n?`Create a new ${o} about: ${n}`:`Create a new ${o}. Ask me what it should be about.`}}]})},{name:"generate",description:"AI-generate content with a prompt",args:{type:{description:`Entity type (${(()=>e.entityService.getEntityTypes().join(", "))()})`,required:!0},topic:{description:"What to generate",required:!0}},handler:async({type:n,topic:o})=>({messages:[{role:"user",content:{type:"text",text:`Generate a ${n} about: ${o}`}}]})},{name:"review",description:"Review and improve existing content",args:{type:{description:"Entity type",required:!0},id:{description:"Entity ID or slug",required:!0}},handler:async({type:n,id:o})=>({messages:[{role:"user",content:{type:"text",text:`Review my ${n} "${o}". Read it first, then give me specific feedback on structure, clarity, and impact. Suggest concrete improvements.`}}]})},{name:"publish",description:"Publish content \u2014 preview, confirm, and publish",args:{type:{description:"Entity type",required:!0},id:{description:"Entity ID or slug",required:!0}},handler:async({type:n,id:o})=>({messages:[{role:"user",content:{type:"text",text:`I want to publish my ${n} "${o}". Show me a preview first, then publish it.`}}]})},{name:"brainstorm",description:"Brainstorm ideas using brain context and expertise",args:{topic:{description:"Topic to brainstorm about",required:!0}},handler:async({topic:n})=>({messages:[{role:"user",content:{type:"text",text:`Let's brainstorm about: ${n}. Use my existing content and expertise as context. Give me fresh angles and concrete ideas.`}}]})}]}function bC(e){let t=e.entityService.getEntityTypes(),n=t.map((o)=>`- ${o}: ${e.entityRegistry.getAdapter(o).purpose}`);return["## Entity CRUD","","Use these system tools for ALL entity operations:","","Treat explicit verbs such as save, create, capture, remember, import, add/connect an agent, approve/archive an agent, update, delete, generate, publish, or sync as mutation requests. Entity-specific instructions may require proactively recording the user's request itself for demand or workflow tracking; follow those instructions even when the user did not use a separate save/create verb. Ordinary status questions like 'what is the status', 'is it ready', 'did that finish', or 'what happened' are not capture requests; answer them by using the relevant status/read tool for the prior operation. Never call system_create for a status follow-up.","",`- **system_create**: Create an entity from existing/concrete material. Requires confirmation before persisting; call system_create without \`confirmed\` to request that confirmation, and never pass \`confirmed: true\` on the initial user request. Use the typed \`visibility\` field instead of rewriting exact source text: omit it for public content, use \`shared\` for team/collaborator content, and use \`restricted\` for private/admin-only content. Public callers may write only public content, Trusted callers public or shared, and Admin callers all three levels. If the user only says 'not public' without clarifying team/shared versus private/admin-only, ask which scope they mean. Required \`source\` union: \`{ kind: "text", content }\` stores exact/direct content; \`{ kind: "url", url }\` creates URL/domain-backed records such as links (preserve bare domains as bare domains); \`{ kind: "upload", upload, transform: "extract-markdown" }\` imports extractable upload bytes as a markdown note; \`{ kind: "upload", upload, transform: "preserve" }\` preserves raw uploaded bytes as their durable file entity; \`{ kind: "prior-response", messageId? }\` saves a previous assistant answer/summary by reference without copying or paraphrasing it. If a direct save request includes the content in the same message, that content is sufficient, even if it is a short sentence or fragment after a colon or embedded in the request phrase (for example, "Save this memo about the launch timeline"); call system_create instead of asking the user to paste it again. If the immediate context is an assistant summary/answer about an upload and the user asks to save it/that/this/summary, create a note with \`source.kind: "prior-response"\`; do this even when the prior answer says there was limited readable content. Do not ask whether they meant the summary or the file after you just summarized/answered about the upload: save the visible prior response as a note. Do not treat a bare upload receipt like "I got filename. What would you like me to do?" as a summary/answer; if the user then says "save it", preserve the latest uploaded file itself with upload \`preserve\` (image uploads as entityType image, PDFs/documents as their file entity type). Only use \`source.kind: "upload"\` when the runtime supplies an actual upload reference/attachment; if the message contains a pasted uploaded-file transcript with readable content (for example, \`User uploaded a file "name.md": ...\`), save the visible transcript content as \`source.kind: "text"\`. Only use upload \`preserve\` otherwise when they explicitly want to save the uploaded file/document itself. Use system_generate, not system_create, for AI generation, generated images, cover images, and source-derived artifacts. Available entity types: ${t.join(", ")}.`,'- **system_generate**: Generate a new durable entity or deterministic artifact. Requires confirmation before queueing generation; call system_generate without `confirmed` to request that confirmation, and never pass `confirmed: true` on the initial user request. When the user asks you to create, write, draft, or generate new durable content and has not supplied final exact content to store, call system_generate instead of drafting the content in chat or asking for separate prose approval first. An underspecified generation request still supplies a usable prompt: preserve the user\'s wording and call system_generate rather than stopping to ask what details to highlight. If generation depends on an existing source entity (for example, a newsletter from a blog post), resolve the source with read/search/list tools first unless the user gives an exact entity id in quotes, then call system_generate with `operation.kind: "prompt-from-source"` in the same turn when a clear source is found. If you identify the latest source entity, do not stop after saying you found it or can generate from it; call system_generate immediately. If no existing durable source entity is resolved, use `operation.kind: "prompt"` in the same turn, including after an optional search returns no source; never invent source IDs, use upload IDs/filenames as entity refs, use profile/brain-character as a generic source, or create placeholder source refs. For broad topical prompts like \'about AI\' or \'about continuous learning\', use `operation.kind: "prompt"`. If the user asks for the latest published/blog source, use system_list for that entity type (for blog posts, entityType post) to inspect publishedAt dates; do not rely on semantic search result order. Choose the newest matching candidate by publishedAt (not updated/created order) and proceed with system_generate rather than asking for separate prose approval; do not say \'if that is the one you mean\' when a newest dated candidate is visible. Do not say \'I can generate it if you want\' or \'I need to queue it first\'; calling system_generate without `confirmed` is the confirmation request. Required `operation` union: `{ kind: "prompt", entityType, prompt }` generates a new non-image durable entity from a broad prompt with no source; `{ kind: "prompt-from-source", entityType, source: { entityType, entityId }, prompt }` generates from an existing resolved entity, such as a newsletter from a blog post. `{ kind: "standalone-image", prompt }` generates an unattached image; `{ kind: "cover-image", target: { entityType, entityId }, prompt }` generates an image and attaches it to an existing canonical entity as `coverImageId`; `{ kind: "attachment", source: { entityType, entityId }, attachmentType }` renders a deterministic artifact from an existing entity attachment provider. For save/render/regenerate/replace requests for source-derived artifacts, call `system_generate` with `operation.kind: "attachment"` immediately; do not say you can queue it later. Use `replace: true` when the user says regenerate, replace, refresh, or update an existing artifact. For OG/social preview renders, use `attachmentType: "og-image"`; the provider derives the output image and updates `ogImageId`. For deck carousel PDFs use `attachmentType: "carousel"`; for printable post/project PDFs use `attachmentType: "printable"`. If the user asks to attach a generated artifact to another entity, generate the artifact first in the same turn; do not ask whether they mean an existing artifact when the source entity is explicit or given as a quoted id such as deck `distributed-systems-primer`. Update the target only after the real artifact ID exists. To create an entity and a cover image, first create/generate only the entity, then after confirmation and after the real canonical entity ID is known call system_generate with operation.kind cover-image. When the user asks to create/regenerate a cover for an existing entity and search/get resolves a clear target, call system_generate with operation.kind cover-image in the same turn; do not stop after saying you found it. In a single initial request for \'a post with a cover image\', do not also call standalone-image; never guess a future target ID, and do not generate a standalone image as a substitute for a requested cover image.',"- **system_update**: Modify an entity's fields or content. Use `edits` for small content changes: fetch the entity, then send exact oldText/newText pairs, with each oldText matching once in the original Markdown. Put multiple non-overlapping edits in one call. Do not regenerate the whole note for a small change; omit `content` and `fields` when using `edits`. Never replace unchanged content with placeholders or ellipses. Use full `content` only for intentional whole-document replacements. Use `fields` for title, status, coverImageId, ogImageId, and other frontmatter/metadata changes. To remove or clear a cover image, set `fields.coverImageId` to null, not an empty string. Use system_update for coverImageId when an existing image entity id is known; if the user says to set an existing image as a cover, update `coverImageId` even when `ogImageId` already points at that image. To generate a new cover image for an existing entity, use system_generate with operation.kind cover-image. Cover images use `coverImageId`; OG/social previews use `ogImageId`; do not treat them as interchangeable. Requires confirmation before applying changes; call system_update without `confirmed` to request that confirmation, rather than asking for prose approval. For explicit publish requests, use the publishing tool if available instead of changing status with system_update; follow-up pronouns like 'publish it' should target the entity just read or updated in the conversation.","- **system_delete**: Admin-only entity removal. Requires confirmation before deleting. Never pass `confirmed: true` on the initial user request; call without `confirmed` so the confirmation flow can ask an administrator first. If system_delete is not available in the current tool surface, say deletion requires Admin access; do not imply a confirmation flow is available. Protected identity/profile records such as brain-character and anchor-profile cannot be deleted; update them instead.","- **system_get**: Retrieve a specific entity by type and ID/slug/title.","- **system_list**: List entities by type with optional filters. For simple list/show-all/summary requests that name or browse a known type or synonym (for example essays/articles/blog posts => post), use system_list with that entity type instead of semantic search. For 'summarize my blog posts' or similar whole-type summaries, first call system_list for entityType post, then summarize those returned entities. For 'latest' requests, use system_list metadata dates such as publishedAt to choose the newest candidate.","- **system_search**: Semantic search across all entities. Search results include matched entity content; when relevant results already provide the complete evidence needed, answer from them instead of redundantly calling system_list or system_get for those same entities. For each new user question about what they have written, mentioned, discussed, or saved, run a fresh search for that turn instead of answering from prior-turn search results or memory; this includes analysis phrasing such as 'How do I discuss X in my writing?' even if prior turns searched related topics.","","Do not ask for prose confirmation instead of calling the applicable mutating tool; for create, update, delete, generate, publish, sync, and similar state-changing requests, the initial tool call without `confirmed` is how you create the pending confirmation. Never claim a durable create/update/delete change was saved, created, done, or completed unless the relevant tool call succeeded or returned a pending confirmation. If a create/update/delete tool is unavailable, unauthorized, or intentionally not called, say you can't make that durable change from the current context; never say saved/created/done. For an explicit write request from an unauthorized/currently unwritable context, refuse directly; do not call system_status or system_search to check permission or look up related content. Entity type descriptions may mark projection-owned or system-maintained types read-only; refuse mutation requests for those types directly without calling read or write tools, searching for a target, or asking which record to mutate.","","Entity types \u2014 select `entityType` by what the type is for:",...n].join(`
|
|
177
|
-
`)}var qo="system",pJ=r.object({toolName:r.string(),args:r.unknown(),...SC.partial().shape});function Ks(e,t,n,o,i){for(let a of e)try{t(a)}catch{i.debug(`System ${o} ${n(a)} already registered, skipping`)}}function wC(e,t,n,o){let i=fC(e);Ks(i,(d)=>t.registerTool(qo,d),(d)=>d.name,"tool",o);let a=n.subscribe(_C.toolExecute(qo),async(d)=>{let m=pJ.safeParse(d.payload);if(!m.success)return{success:!1,error:"Invalid system tool execute payload"};let{toolName:p,args:f,interfaceType:g,actor:h,conversationId:v,channelId:w,userPermissionLevel:S}=m.data,y=i.find((C)=>C.name===p);if(!y)return{success:!1,error:`System tool not found: ${p}`};let x={interfaceType:g??"system",actor:h??{kind:"service",serviceId:"system"}};if(v)x.conversationId=v;if(w)x.channelId=w;if(S)x.userPermissionLevel=S;return{success:!0,data:await y.handler(f,x)}});o.debug(`Registered ${i.length} system tools`);let s=hC(e);Ks(s,(d)=>t.registerResource(qo,d),(d)=>d.uri,"resource",o),o.debug(`Registered ${s.length} system resources`);let l=yC(e);Ks(l,(d)=>t.registerResourceTemplate(qo,d),(d)=>d.uriTemplate,"resource template",o),o.debug(`Registered ${l.length} system resource templates`);let c=vC(e);Ks(c,(d)=>t.registerPrompt(qo,d),(d)=>d.name,"prompt",o),o.debug(`Registered ${c.length} system prompts`);let u=bC(e);try{t.registerInstructions(qo,u)}catch{o.debug("System instructions already registered, skipping")}return o.debug("Registered system instructions"),a}function CC(e){let{services:t,jobs:n,insights:o,query:i,getAppInfo:a}=e,s=t.jobQueueService,l=t.logger.child("system"),c=wC({entityService:t.entityService,entityRegistry:t.entityRegistry,jobs:{...n,enqueue:xC(s,"system",!1),enqueueBatch:TC(n,"system"),registerHandler:IC(s,"system")},conversationService:t.conversationService,runtimeUploads:t.runtimeUploadRegistry,attachments:Ys(t.attachmentRegistry),logger:l,query:i,getIdentity:()=>t.identityService.getCharacter(),getProfile:()=>t.profileService.getProfile(),getAppInfo:a,searchLimit:10,insights:o,permissionService:t.permissionService},t.mcpService,t.messageBus,l);t.disposables.push(c)}class lp{scope;closePromise=null;closed=!1;constructor(){this.scope=de.runSync(Xe.make())}buildLayer(e){this.assertOpen();let t=de.runSyncExit(Xr.buildWithScope(e,this.scope));if(tt.isFailure(t))throw ir.squash(t.cause);return t.value}addFinalizer(e){this.assertOpen(),de.runSync(Xe.addFinalizer(this.scope,de.promise(async()=>{await e()})))}addSyncFinalizer(e){this.assertOpen(),de.runSync(Xe.addFinalizer(this.scope,de.sync(()=>{e()})))}async fork(e){if(this.closed)throw Error("Cannot start background work after shell shutdown");await Mr(de.forkIn(e,this.scope))}close(e=tt.void){if(this.closePromise)return this.closePromise;if(this.closed)return Promise.resolve();return this.closed=!0,this.closePromise=Mr(Xe.close(this.scope,e)),this.closePromise}closeSync(e){if(this.closed)return;this.closed=!0,de.runSync(Xe.close(this.scope,e))}assertOpen(){if(this.closed)throw Error("Cannot register cleanup after shell shutdown")}}class ia{config;services;lifecycle;bootloader;initialized=!1;lifecycleState="constructed";bootMode;bootPromise=null;shutdownPromise=null;insightsRegistry;bootTime=Date.now();endpointRegistry=new Zd;interactionRegistry=new Kd;httpRouteRegistry=Us.createFresh();jobs;static createFresh(e,t,n){return new ia(pa(e),t,n)}constructor(e,t,n){this.config=e,this.lifecycle=new lp,AC(this,()=>this.httpRouteRegistry.getSnapshot());let o=t?.logger??vr.getInstance(),i=Ns.createFresh(o,this.config,n?.processRole);try{this.services=i.initializeServices(this.lifecycle,t),this.jobs=cI(this.services.batchJobManager,this.services.jobQueueService),this.insightsRegistry=iI(this.services.entityRegistry),this.bootloader=new Wd(this.config,this.services,this.lifecycle,i,n?.processRole,{registerCoreDataSources:()=>Tp(this.services,this.config),finalizeHttpRoutes:()=>{this.httpRouteRegistry.finalize(pI(this.services.pluginManager))},registerSystemCapabilities:()=>CC({services:this.services,jobs:this.jobs,insights:this.insightsRegistry,query:(a,s)=>this.query(a,s),getAppInfo:()=>this.getAppInfo()}),createProjectionInputContext:()=>({entities:this.services.entityService,resolvePrompt:(a,s)=>ma(this.services.entityService,a,s),appInfo:()=>this.getAppInfo(),identityInput:()=>{let a=this.getIdentity(),s=this.getProfile();return RC.parse({brainName:a.name,role:a.role,purpose:a.purpose,values:a.values,profileName:s.name,...s.description!==void 0?{profileDescription:s.description}:{},...s.organization!==void 0?{profileOrganization:s.organization}:{}})}}),createProjectionExecutionContext:()=>({ai:EC(this),logger:this.services.logger.child("ProjectionRuntime")}),...t?.projectionRuntime&&{projectionRuntime:t.projectionRuntime}}),i.wireShell(this.services,this),gI(this.lifecycle,this.services)}catch(a){try{this.lifecycle.closeSync(tt.fail(a))}catch(s){o.error("Failed to roll back Shell service construction",s)}throw a}}getInsightsRegistry(){return this.insightsRegistry}async initialize(e){this.services.logger.debug("Shell.initialize() called");let t=e?.mode;if(this.lifecycleState==="running")return this.services.logger.warn("Shell already initialized"),Promise.resolve();if(this.lifecycleState==="booting"){if(this.bootMode!==t)return Promise.reject(Error(`Shell is already initializing in ${this.bootMode??"normal"} mode; cannot join ${t??"normal"} mode`));return this.bootPromise??Promise.resolve()}if(this.lifecycleState==="closing"||this.lifecycleState==="closed")return Promise.reject(Error("Cannot initialize a closing shell"));if(this.lifecycleState==="failed")return Promise.reject(Error("Cannot initialize a shell after boot failure"));return this.lifecycleState="booting",this.bootMode=t,this.bootPromise=this.boot(e),this.bootPromise}async boot(e){try{if(await this.bootloader.boot(e),this.lifecycleState==="booting"){if(this.lifecycleState="running",this.initialized=!0,e?.mode===void 0)await this.services.messageBus.send({type:zs.shellReady,payload:{timestamp:new Date().toISOString()},sender:"shell",broadcast:!0}),this.services.logger.debug("Emitted shell ready event")}}catch(t){if(this.initialized=!1,this.services.logger.error("Failed to initialize Shell",t),this.lifecycleState!=="closing")this.lifecycleState="failed";try{await this.lifecycle.close(tt.fail(t))}catch(n){this.services.logger.error("Failed to clean up Shell after initialization failure",n)}throw t}}registerTemplates(e,t){this.services.logger.debug("Registering templates",{pluginId:t,count:Object.keys(e).length});for(let[n,o]of Object.entries(e))this.registerTemplate(n,o,t)}shutdown(){return this.shutdownPromise??=this.shutdownShell(),this.shutdownPromise}async shutdownShell(){if(this.services.logger.debug("Shutting down Shell"),this.lifecycleState==="closed")return;let e=this.bootPromise;if(this.lifecycleState="closing",this.initialized=!1,e)try{await e}catch{}await this.lifecycle.close(),this.lifecycleState="closed",this.services.logger.debug("Shell shutdown complete")}async generateContent(e){return this.requireInitialized("Shell content generation"),Ip(this.services,e)}async query(e,t){this.requireInitialized("Shell query");let n=await this.getAppInfo(),o={...t,appInfo:n,timestamp:new Date().toISOString()},{conversationHistory:i,...a}=o;return kC.parse(await this.generateContent({prompt:e,templateName:Yo.KNOWLEDGE_QUERY,...i&&{conversationHistory:i},data:a,interfacePermissionGrant:"public"}))}registerPlugin(e){this.requireInitialized("Plugin registration"),this.services.pluginManager.registerPlugin(e)}isInitialized(){return this.initialized}requireInitialized(e){if(!this.initialized)throw Error(`${e} attempted before initialization`)}getEntityService(){return this.services.entityService}getConversationService(){return this.services.conversationService}getEntityRegistry(){return this.services.entityRegistry}async generateObject(e,t,n){this.requireInitialized("Shell generateObject");let{object:o}=await this.services.aiService.generateObject("You are a helpful assistant. Respond with the requested structured data.",e,t,n);return{object:o}}async judge(e){return this.requireInitialized("Shell judge"),this.services.aiService.judge(e)}getAIService(){return this.services.aiService}generateImage(e,t){return this.services.aiService.generateImage(e,t)}canGenerateImages(){return this.services.aiService.canGenerateImages()}getPluginManager(){return this.services.pluginManager}getContentService(){return this.services.contentService}getRenderService(){return this.services.renderService}getAttachmentRegistry(){return Ys(this.services.attachmentRegistry)}getRuntimeUploadRegistry(){return PC(this.services.runtimeUploadRegistry)}getRuntimeState(){return this.services.runtimeStateService}getRecurringChecks(e){return this.services.recurringCheckService.namespace(e)}isJobQueueWorkerRunning(){return this.services.jobQueueWorker.isWorkerRunning()}getMessageBus(){return this.services.messageBus}getLogger(){return this.services.logger}getJobQueueService(){return this.services.jobQueueService}getMCPService(){return this.services.mcpService}listToolsForPermissionLevel(e){return this.services.mcpService.listToolsForPermissionLevel(e).map(({pluginId:t,tool:n})=>({name:n.name,description:n.description,pluginId:t}))}getPermissionService(){return this.services.permissionService}getAgentService(){return this.services.agentService}registerTools(e,t){for(let n of t)try{this.services.mcpService.registerTool(e,n)}catch(o){this.services.logger.error(`Failed to register tool ${n.name} from ${e}:`,o)}}registerResources(e,t){for(let n of t)try{this.services.mcpService.registerResource(e,n)}catch(o){this.services.logger.error(`Failed to register resource ${n.name} from ${e}:`,o)}}registerResourceTemplate(e,t){this.services.mcpService.registerResourceTemplate(e,t)}registerPrompt(e,t){this.services.mcpService.registerPrompt(e,t)}registerInstructions(e,t){if(this.services.mcpService.registerInstructions(e,t),this.initialized)this.services.agentService.invalidateAgent()}async unregisterPluginCapabilities(e){this.services.mcpService.unregisterPlugin?.(e),this.services.jobQueueService.unregisterPluginHandlers(e),this.endpointRegistry.unregister(e),this.interactionRegistry.unregister(e);for(let n of this.services.templateRegistry.getNames())if(n.startsWith(`${e}:`))this.services.templateRegistry.unregister(n);let t=this.config.evalHandlerRegistry;if(t){for(let n of t.list())if(n.pluginId===e)t.unregister(e,n.handlerId)}this.services.agentService.invalidateAgent(),await this.services.recurringCheckService.unregisterPlugin(e)}getPluginPackageName(e){return this.services.pluginManager.getPluginPackageName(e)}hasPlugin(e){return this.services.pluginManager.hasPlugin(e)}getPluginHttpRouteManifest(){return this.httpRouteRegistry.getManifest()}getPluginApiRoutes(){return this.httpRouteRegistry.getApiRoutes()}getPluginWebRoutes(){return this.httpRouteRegistry.getWebRoutes()}registerDaemon(e,t,n){this.services.daemonRegistry.register(e,t,n)}registerEndpoint(e){this.endpointRegistry.register(e)}listEndpoints(){return this.endpointRegistry.list()}registerInteraction(e){this.interactionRegistry.register(e)}listInteractions(){return this.interactionRegistry.list()}registerTemplate(e,t,n){let o=n?`${n}:${e}`:`shell:${e}`;this.services.templateRegistry.register(o,t),this.services.logger.debug(`Registered template: ${o}`)}getTemplate(e){return this.services.templateRegistry.get(e)}getDataSourceRegistry(){return this.services.dataSourceRegistry}getIdentity(){return this.services.identityService.getCharacter()}getProfile(){return this.services.profileService.getProfile()}getProfileKindRegistry(){return this.services.profileKindRegistry}getChannelRegistry(){return this.services.channelRegistry}getInboxRegistry(){return this.services.inboxRegistry}getInboxFollowUpRegistry(){return this.services.inboxFollowUpRegistry}getOperationalHealthRegistry(){return this.services.operationalHealthRegistry}getAccountSettingsRegistry(){return this.services.accountSettingsRegistry}getDomain(){return this.config.siteBaseUrl}getLocalSiteUrl(){return this.config.localSiteUrl}shouldPreferLocalUrls(){return this.config.preferLocalUrls}getThemeCSS(){return this.config.themeCSS}getSpaces(){return this.config.spaces}getDataDir(){return this.config.dataDir}getGitBrokerSocket(){return this.config.gitBrokerSocket}getGitBrokerCheckout(){return this.config.gitBrokerCheckout}registerEvalHandler(e,t,n){this.config.evalHandlerRegistry?.register(e,t,n)}async getAppInfo(){return vp({config:this.config,services:this.services,bootTime:this.bootTime,endpoints:()=>this.listEndpoints(),interactions:()=>this.listInteractions()})}getRuntimeReadiness(){return Sp(this.services)}}var MC={kind:"service",serviceId:"brain-cli"},cp=`${MC.kind}:${MC.serviceId}`;var mJ=r.object({provider:r.enum(["hetzner","docker"]).default("hetzner"),serverSize:r.string().default("cx33"),location:r.string().default("fsn1"),domain:r.string().optional(),docker:r.object({enabled:r.boolean().default(!0),image:r.string().optional()}).prefault({}),ports:r.object({default:r.number().default(3333),preview:r.number().default(4321),production:r.number().default(8080)}).prefault({}),cdn:r.object({enabled:r.boolean().default(!1),provider:r.enum(["bunny","none"]).default("none")}).prefault({}),dns:r.object({enabled:r.boolean().default(!1),provider:r.enum(["bunny","none"]).default("none")}).prefault({}),paths:r.object({install:r.string().optional(),data:r.string().optional()}).prefault({})}),OC=r.object({name:r.string().default("brain-app"),version:r.string().default("1.0.0"),database:r.string().optional(),aiApiKey:r.string().optional(),aiImageKey:r.string().optional(),aiModel:r.string().optional(),aiReasoningEffort:Xn.optional(),logLevel:Qn.optional(),logFile:r.string().optional(),profileKind:r.string().trim().min(1).optional(),plugins:r.array(da).default([]),spaces:r.array(r.string()).default([]),identity:jC.optional(),agentInstructions:r.array(r.string()).optional(),deployment:mJ.prefault({})});async function GC(e,t){await wn({label:"entity",config:e,schema:{assets:DC,entities:NC,projectionDirtyInputs:zC,projectionWaves:UC,projectionIncidents:$C,projectionWaveInputs:qC,projectionWaveRules:LC,projectionRuleMemos:FC},migrationsFolder:xn(import.meta.url,"entity-service"),authTokenEnv:"DATABASE_AUTH_TOKEN",logger:t,afterMigrate:BC})}async function WC(e,t){await wn({label:"job-queue",config:e,schema:{jobQueue:JC,jobWorkerSessions:HC},migrationsFolder:xn(import.meta.url,"job-queue"),authTokenEnv:"JOB_QUEUE_DATABASE_AUTH_TOKEN",logger:t})}async function YC(e,t){await wn({label:"conversation",config:e,schema:{conversations:VC,messages:ZC,summaryTracking:KC},migrationsFolder:xn(import.meta.url,"conversation-service"),authTokenEnv:"CONVERSATION_DATABASE_AUTH_TOKEN",logger:t})}async function QC(e,t){await wn({label:"runtime-state",config:e,schema:{runtimeStateRecords:Le},migrationsFolder:xn(import.meta.url,"runtime-state"),authTokenEnv:"RUNTIME_STATE_DATABASE_AUTH_TOKEN",logger:t})}import{mkdir as up}from"fs/promises";import{isAbsolute as gJ}from"path";function XC(e=process.env){return{dataDir:e.XDG_DATA_HOME??"./data",cacheDir:e.XDG_CACHE_HOME??"./cache",distDir:"./dist"}}function e0(e=process.env){let t=e.BRAIN_GIT_BROKER_CHECKOUT;if(!t)return;if(!gJ(t))throw Error(`Git broker checkout path must be absolute: ${t}`);return t}function t0(e=process.env){let t=e.BRAIN_GIT_BROKER_SOCKET;if(!t)return;let n=107;if(Buffer.byteLength(t)>n)throw Error(`Git broker socket path is too long for a unix socket (${Buffer.byteLength(t)} > ${n} bytes): ${t}`);return t}function r0(e=process.env){return Cn(XC(e))}async function n0(e=process.env){let t=XC(e);try{await up(t.dataDir,{recursive:!0}),await up(t.cacheDir,{recursive:!0}),await up(t.distDir,{recursive:!0})}catch(n){let o=n instanceof Error&&n.message.includes("EACCES")?`Cannot create data directories \u2014 permission denied. Run from a writable directory or check permissions on ${t.dataDir}`:`Cannot create data directories: ${ke(n)}`;throw Error(o,{cause:n})}return Cn(t)}class dp{logger;migrations;constructor(e,t){this.logger=e,this.migrations=t??{getStandardConfigWithDirectories:()=>n0(),migrateEntities:GC,migrateJobQueue:WC,migrateConversations:YC,migrateRuntimeState:QC}}async runAllMigrations(e){this.logger.debug("Running database migrations...");let t=await this.migrations.getStandardConfigWithDirectories();if(e?.database)t.database.url=e.database;if(e?.jobQueueDatabase)t.jobQueueDatabase.url=e.jobQueueDatabase;if(e?.conversationDatabase)t.conversationDatabase.url=e.conversationDatabase;if(e?.runtimeStateDatabase)t.runtimeStateDatabase.url=e.runtimeStateDatabase;await this.migrateEntityDatabase(t),await this.migrateJobQueueDatabase(t),await this.migrateConversationDatabase(t),await this.migrateRuntimeStateDatabase(t),this.logger.debug("All database migrations completed successfully")}async migrateEntityDatabase(e){this.logger.debug("Running entity database migrations..."),await this.migrations.migrateEntities({url:e.database.url,...e.database.authToken&&{authToken:e.database.authToken}},this.logger)}async migrateJobQueueDatabase(e){this.logger.debug("Running job queue database migrations..."),await this.migrations.migrateJobQueue({url:e.jobQueueDatabase.url,...e.jobQueueDatabase.authToken&&{authToken:e.jobQueueDatabase.authToken}},this.logger)}async migrateConversationDatabase(e){this.logger.debug("Running conversation database migrations..."),await this.migrations.migrateConversations({url:e.conversationDatabase.url,...e.conversationDatabase.authToken&&{authToken:e.conversationDatabase.authToken}},this.logger)}async migrateRuntimeStateDatabase(e){this.logger.debug("Running runtime state database migrations..."),await this.migrations.migrateRuntimeState({url:e.runtimeStateDatabase.url,...e.runtimeStateDatabase.authToken&&{authToken:e.runtimeStateDatabase.authToken}},this.logger)}}var fJ="NODE_ENV";function hJ(){return process.env[fJ]}function o0(){return hJ()!=="production"}var yJ="startup-check";function vJ(e){let n={...OC.parse(e??{}),plugins:e?.plugins??[]};if(e?.permissions)n.permissions=e.permissions;if(e?.spaces)n.spaces=e.spaces;if(e?.cliConfig)n.cliConfig=e.cliConfig;if(e?.shellConfig)n.shellConfig=e.shellConfig;return n}function bJ(e,t){let n={plugins:e.plugins??[],...e.shellConfig};return _J(n),SJ(e,n),wJ(e,n,t),xJ(e,n),TJ(e,n),IJ(e,n),CJ(e,n),kJ(e,n),RJ(e,n),n}function _J(e){let t=r0();e.database??=t.database,e.jobQueueDatabase??=t.jobQueueDatabase,e.conversationDatabase??=t.conversationDatabase,e.runtimeStateDatabase??=t.runtimeStateDatabase,e.embeddingDatabase??=t.embeddingDatabase,e.embedding??=t.embedding,e.gitBrokerSocket??=t0(),e.gitBrokerCheckout??=e0()}function SJ(e,t){if(e.database)t.database={url:e.database};if(e.profileKind)t.profileKind=e.profileKind;t.features={}}function wJ(e,t,n){let o=n?.mode==="startup-check";if(!e.aiApiKey&&!e.aiImageKey&&!e.aiModel&&!e.aiReasoningEffort&&!o)return;t.ai={...t.ai,...o&&!t.ai?.apiKey&&{apiKey:yJ},...e.aiApiKey&&{apiKey:e.aiApiKey},...e.aiImageKey&&{imageApiKey:e.aiImageKey},...e.aiModel&&{model:e.aiModel},...e.aiReasoningEffort&&{reasoningEffort:e.aiReasoningEffort}}}function xJ(e,t){if(!e.logLevel&&!e.logFile)return;t.logging={level:e.logLevel??"info",format:"text",context:e.name,...e.logFile&&{file:e.logFile}}}function TJ(e,t){let n=e.permissions?.rules??[];t.permissions={...e.permissions,rules:n.some((o)=>o.pattern===cp)?n:[{pattern:cp,level:"admin"},...n]}}function IJ(e,t){if(e.spaces)t.spaces=e.spaces}function CJ(e,t){if(e.identity)t.identity=e.identity}function kJ(e,t){if(e.agentInstructions)t.agentInstructions=e.agentInstructions}function RJ(e,t){if(t.name=e.name,t.version=e.version,e.deployment.domain)t.siteBaseUrl=e.deployment.domain;t.localSiteUrl=`http://localhost:${e.deployment.ports.production}`,t.preferLocalUrls=o0()}class mp{shell=null;config;signalScope=null;signalShutdownFiber=null;stopPromise=null;hasCLI=!1;static create(e,t){return new mp(vJ(e),t)}constructor(e,t){if(this.config=e,this.hasCLI=process.argv.slice(2).includes("--cli"),t)this.shell=t}async migrate(){let e=vr.getInstance();await new dp(e).runAllMigrations({database:this.config.shellConfig?.database?.url??this.config.database,jobQueueDatabase:this.config.shellConfig?.jobQueueDatabase?.url,conversationDatabase:this.config.shellConfig?.conversationDatabase?.url,runtimeStateDatabase:this.config.shellConfig?.runtimeStateDatabase?.url})}createShell(e,t){this.shell=ia.createFresh(bJ(this.config,e),void 0,{...t&&{processRole:t}})}async registerCLIInterface(){if(!this.hasCLI)return;let e=this.getShell().getPluginManager(),{CLIInterface:t}=await import("./index-41yt4dm7.js"),n=new t(this.config.cliConfig);e.registerPlugin(n)}async initialize(e,t){if(!this.shell){if(!t?.migrationsCompleted)await this.migrate();this.createShell(e,t?.processRole)}await this.registerCLIInterface(),await this.getShell().initialize(e)}async start(){if(this.stopPromise)return;this.setupSignalHandlers()}stop(){return this.stopPromise??=this.stopApp(),this.stopPromise}async stopApp(){await this.closeSignalScope(),await this.shell?.shutdown()}async run(e){let n={debug:Ut.DEBUG,info:Ut.INFO,warn:Ut.WARN,error:Ut.ERROR}[this.config.logLevel??"info"]??Ut.INFO,o=vr.createFresh({level:n,context:this.config.name,useStderr:this.hasCLI});if(this.hasCLI)vr.getInstance().setUseStderr(!0);try{await this.initialize(void 0,e),await this.start(),e?.onRuntimeReady?.(),o.info(`\u2705 ${this.config.name} v${this.config.version} ready`),process.stdin.resume()}catch(i){o.error(`\u274C Failed to start ${this.config.name}:`,i),process.exit(1)}}static async run(e,t,n){await mp.create(e,t).run(n)}setupSignalHandlers(){if(this.signalScope)return;let e=de.runSync(Xe.make()),t=()=>{this.requestGracefulShutdown("SIGINT")},n=()=>{this.requestGracefulShutdown("SIGTERM")},o=pp(["SIGINT"],t),i=pp(["SIGTERM"],n);de.runSync(Xe.addFinalizer(e,de.sync(()=>{i(),o()}))),this.signalScope=e}requestGracefulShutdown(e){if(this.signalShutdownFiber)return;let t=vr.getInstance();t.info(`
|
|
177
|
+
`)}var qo="system",pJ=r.object({toolName:r.string(),args:r.unknown(),...SC.partial().shape});function Ks(e,t,n,o,i){for(let a of e)try{t(a)}catch{i.debug(`System ${o} ${n(a)} already registered, skipping`)}}function wC(e,t,n,o){let i=fC(e);Ks(i,(d)=>t.registerTool(qo,d),(d)=>d.name,"tool",o);let a=n.subscribe(_C.toolExecute(qo),async(d)=>{let m=pJ.safeParse(d.payload);if(!m.success)return{success:!1,error:"Invalid system tool execute payload"};let{toolName:p,args:f,interfaceType:g,actor:h,conversationId:v,channelId:w,userPermissionLevel:S}=m.data,y=i.find((C)=>C.name===p);if(!y)return{success:!1,error:`System tool not found: ${p}`};let x={interfaceType:g??"system",actor:h??{kind:"service",serviceId:"system"}};if(v)x.conversationId=v;if(w)x.channelId=w;if(S)x.userPermissionLevel=S;return{success:!0,data:await y.handler(f,x)}});o.debug(`Registered ${i.length} system tools`);let s=hC(e);Ks(s,(d)=>t.registerResource(qo,d),(d)=>d.uri,"resource",o),o.debug(`Registered ${s.length} system resources`);let l=yC(e);Ks(l,(d)=>t.registerResourceTemplate(qo,d),(d)=>d.uriTemplate,"resource template",o),o.debug(`Registered ${l.length} system resource templates`);let c=vC(e);Ks(c,(d)=>t.registerPrompt(qo,d),(d)=>d.name,"prompt",o),o.debug(`Registered ${c.length} system prompts`);let u=bC(e);try{t.registerInstructions(qo,u)}catch{o.debug("System instructions already registered, skipping")}return o.debug("Registered system instructions"),a}function CC(e){let{services:t,jobs:n,insights:o,query:i,getAppInfo:a}=e,s=t.jobQueueService,l=t.logger.child("system"),c=wC({entityService:t.entityService,entityRegistry:t.entityRegistry,jobs:{...n,enqueue:xC(s,"system",!1),enqueueBatch:TC(n,"system"),registerHandler:IC(s,"system")},conversationService:t.conversationService,runtimeUploads:t.runtimeUploadRegistry,attachments:Ys(t.attachmentRegistry),logger:l,query:i,getIdentity:()=>t.identityService.getCharacter(),getProfile:()=>t.profileService.getProfile(),getAppInfo:a,searchLimit:10,insights:o,permissionService:t.permissionService},t.mcpService,t.messageBus,l);t.disposables.push(c)}class lp{scope;closePromise=null;closed=!1;constructor(){this.scope=de.runSync(Xe.make())}buildLayer(e){this.assertOpen();let t=de.runSyncExit(Xr.buildWithScope(e,this.scope));if(tt.isFailure(t))throw ir.squash(t.cause);return t.value}addFinalizer(e){this.assertOpen(),de.runSync(Xe.addFinalizer(this.scope,de.promise(async()=>{await e()})))}addSyncFinalizer(e){this.assertOpen(),de.runSync(Xe.addFinalizer(this.scope,de.sync(()=>{e()})))}async fork(e){if(this.closed)throw Error("Cannot start background work after shell shutdown");await Mr(de.forkIn(e,this.scope))}close(e=tt.void){if(this.closePromise)return this.closePromise;if(this.closed)return Promise.resolve();return this.closed=!0,this.closePromise=Mr(Xe.close(this.scope,e)),this.closePromise}closeSync(e){if(this.closed)return;this.closed=!0,de.runSync(Xe.close(this.scope,e))}assertOpen(){if(this.closed)throw Error("Cannot register cleanup after shell shutdown")}}class ia{config;services;lifecycle;bootloader;initialized=!1;lifecycleState="constructed";bootMode;bootPromise=null;shutdownPromise=null;insightsRegistry;bootTime=Date.now();endpointRegistry=new Zd;interactionRegistry=new Kd;httpRouteRegistry=Us.createFresh();jobs;static createFresh(e,t,n){return new ia(pa(e),t,n)}constructor(e,t,n){this.config=e,this.lifecycle=new lp,AC(this,()=>this.httpRouteRegistry.getSnapshot());let o=t?.logger??vr.getInstance(),i=Ns.createFresh(o,this.config,n?.processRole);try{this.services=i.initializeServices(this.lifecycle,t),this.jobs=cI(this.services.batchJobManager,this.services.jobQueueService),this.insightsRegistry=iI(this.services.entityRegistry),this.bootloader=new Wd(this.config,this.services,this.lifecycle,i,n?.processRole,{registerCoreDataSources:()=>Tp(this.services,this.config),finalizeHttpRoutes:()=>{this.httpRouteRegistry.finalize(pI(this.services.pluginManager))},registerSystemCapabilities:()=>CC({services:this.services,jobs:this.jobs,insights:this.insightsRegistry,query:(a,s)=>this.query(a,s),getAppInfo:()=>this.getAppInfo()}),createProjectionInputContext:()=>({entities:this.services.entityService,resolvePrompt:(a,s)=>ma(this.services.entityService,a,s),appInfo:()=>this.getAppInfo(),identityInput:()=>{let a=this.getIdentity(),s=this.getProfile();return RC.parse({brainName:a.name,role:a.role,purpose:a.purpose,values:a.values,profileName:s.name,...s.description!==void 0?{profileDescription:s.description}:{},...s.organization!==void 0?{profileOrganization:s.organization}:{}})}}),createProjectionExecutionContext:()=>({ai:EC(this),logger:this.services.logger.child("ProjectionRuntime")}),...t?.projectionRuntime&&{projectionRuntime:t.projectionRuntime}}),i.wireShell(this.services,this),gI(this.lifecycle,this.services)}catch(a){try{this.lifecycle.closeSync(tt.fail(a))}catch(s){o.error("Failed to roll back Shell service construction",s)}throw a}}getInsightsRegistry(){return this.insightsRegistry}async initialize(e){this.services.logger.debug("Shell.initialize() called");let t=e?.mode;if(this.lifecycleState==="running")return this.services.logger.warn("Shell already initialized"),Promise.resolve();if(this.lifecycleState==="booting"){if(this.bootMode!==t)return Promise.reject(Error(`Shell is already initializing in ${this.bootMode??"normal"} mode; cannot join ${t??"normal"} mode`));return this.bootPromise??Promise.resolve()}if(this.lifecycleState==="closing"||this.lifecycleState==="closed")return Promise.reject(Error("Cannot initialize a closing shell"));if(this.lifecycleState==="failed")return Promise.reject(Error("Cannot initialize a shell after boot failure"));return this.lifecycleState="booting",this.bootMode=t,this.bootPromise=this.boot(e),this.bootPromise}async boot(e){try{if(await this.bootloader.boot(e),this.lifecycleState==="booting"){if(this.lifecycleState="running",this.initialized=!0,e?.mode===void 0)await this.services.messageBus.send({type:zs.shellReady,payload:{timestamp:new Date().toISOString()},sender:"shell",broadcast:!0}),this.services.logger.debug("Emitted shell ready event")}}catch(t){if(this.initialized=!1,this.services.logger.error("Failed to initialize Shell",t),this.lifecycleState!=="closing")this.lifecycleState="failed";try{await this.lifecycle.close(tt.fail(t))}catch(n){this.services.logger.error("Failed to clean up Shell after initialization failure",n)}throw t}}registerTemplates(e,t){this.services.logger.debug("Registering templates",{pluginId:t,count:Object.keys(e).length});for(let[n,o]of Object.entries(e))this.registerTemplate(n,o,t)}shutdown(){return this.shutdownPromise??=this.shutdownShell(),this.shutdownPromise}async shutdownShell(){if(this.services.logger.debug("Shutting down Shell"),this.lifecycleState==="closed")return;let e=this.bootPromise;if(this.lifecycleState="closing",this.initialized=!1,e)try{await e}catch{}await this.lifecycle.close(),this.lifecycleState="closed",this.services.logger.debug("Shell shutdown complete")}async generateContent(e){return this.requireInitialized("Shell content generation"),Ip(this.services,e)}async query(e,t){this.requireInitialized("Shell query");let n=await this.getAppInfo(),o={...t,appInfo:n,timestamp:new Date().toISOString()},{conversationHistory:i,...a}=o;return kC.parse(await this.generateContent({prompt:e,templateName:Yo.KNOWLEDGE_QUERY,...i&&{conversationHistory:i},data:a,interfacePermissionGrant:"public"}))}registerPlugin(e){this.requireInitialized("Plugin registration"),this.services.pluginManager.registerPlugin(e)}isInitialized(){return this.initialized}requireInitialized(e){if(!this.initialized)throw Error(`${e} attempted before initialization`)}getEntityService(){return this.services.entityService}getConversationService(){return this.services.conversationService}getEntityRegistry(){return this.services.entityRegistry}async generateObject(e,t,n){this.requireInitialized("Shell generateObject");let{object:o}=await this.services.aiService.generateObject("You are a helpful assistant. Respond with the requested structured data.",e,t,n);return{object:o}}async judge(e){return this.requireInitialized("Shell judge"),this.services.aiService.judge(e)}getAIService(){return this.services.aiService}generateImage(e,t){return this.services.aiService.generateImage(e,t)}canGenerateImages(){return this.services.aiService.canGenerateImages()}getPluginManager(){return this.services.pluginManager}getContentService(){return this.services.contentService}getRenderService(){return this.services.renderService}getAttachmentRegistry(){return Ys(this.services.attachmentRegistry)}getRuntimeUploadRegistry(){return PC(this.services.runtimeUploadRegistry)}getRuntimeState(){return this.services.runtimeStateService}getRecurringChecks(e){return this.services.recurringCheckService.namespace(e)}isJobQueueWorkerRunning(){return this.services.jobQueueWorker.isWorkerRunning()}getMessageBus(){return this.services.messageBus}getLogger(){return this.services.logger}getJobQueueService(){return this.services.jobQueueService}getMCPService(){return this.services.mcpService}listToolsForPermissionLevel(e){return this.services.mcpService.listToolsForPermissionLevel(e).map(({pluginId:t,tool:n})=>({name:n.name,description:n.description,pluginId:t}))}getPermissionService(){return this.services.permissionService}getAgentService(){return this.services.agentService}registerTools(e,t){for(let n of t)try{this.services.mcpService.registerTool(e,n)}catch(o){this.services.logger.error(`Failed to register tool ${n.name} from ${e}:`,o)}}registerResources(e,t){for(let n of t)try{this.services.mcpService.registerResource(e,n)}catch(o){this.services.logger.error(`Failed to register resource ${n.name} from ${e}:`,o)}}registerResourceTemplate(e,t){this.services.mcpService.registerResourceTemplate(e,t)}registerPrompt(e,t){this.services.mcpService.registerPrompt(e,t)}registerInstructions(e,t){if(this.services.mcpService.registerInstructions(e,t),this.initialized)this.services.agentService.invalidateAgent()}async unregisterPluginCapabilities(e){this.services.mcpService.unregisterPlugin?.(e),this.services.jobQueueService.unregisterPluginHandlers(e),this.endpointRegistry.unregister(e),this.interactionRegistry.unregister(e);for(let n of this.services.templateRegistry.getNames())if(n.startsWith(`${e}:`))this.services.templateRegistry.unregister(n);let t=this.config.evalHandlerRegistry;if(t){for(let n of t.list())if(n.pluginId===e)t.unregister(e,n.handlerId)}this.services.agentService.invalidateAgent(),await this.services.recurringCheckService.unregisterPlugin(e)}getPluginPackageName(e){return this.services.pluginManager.getPluginPackageName(e)}hasPlugin(e){return this.services.pluginManager.hasPlugin(e)}getPluginHttpRouteManifest(){return this.httpRouteRegistry.getManifest()}getPluginApiRoutes(){return this.httpRouteRegistry.getApiRoutes()}getPluginWebRoutes(){return this.httpRouteRegistry.getWebRoutes()}registerDaemon(e,t,n){this.services.daemonRegistry.register(e,t,n)}registerEndpoint(e){this.endpointRegistry.register(e)}listEndpoints(){return this.endpointRegistry.list()}registerInteraction(e){this.interactionRegistry.register(e)}listInteractions(){return this.interactionRegistry.list()}registerTemplate(e,t,n){let o=n?`${n}:${e}`:`shell:${e}`;this.services.templateRegistry.register(o,t),this.services.logger.debug(`Registered template: ${o}`)}getTemplate(e){return this.services.templateRegistry.get(e)}getDataSourceRegistry(){return this.services.dataSourceRegistry}getIdentity(){return this.services.identityService.getCharacter()}getProfile(){return this.services.profileService.getProfile()}getProfileKindRegistry(){return this.services.profileKindRegistry}getChannelRegistry(){return this.services.channelRegistry}getInboxRegistry(){return this.services.inboxRegistry}getInboxFollowUpRegistry(){return this.services.inboxFollowUpRegistry}getOperationalHealthRegistry(){return this.services.operationalHealthRegistry}getAccountSettingsRegistry(){return this.services.accountSettingsRegistry}getDomain(){return this.config.siteBaseUrl}getLocalSiteUrl(){return this.config.localSiteUrl}shouldPreferLocalUrls(){return this.config.preferLocalUrls}getThemeCSS(){return this.config.themeCSS}getSpaces(){return this.config.spaces}getDataDir(){return this.config.dataDir}getGitBrokerSocket(){return this.config.gitBrokerSocket}getGitBrokerCheckout(){return this.config.gitBrokerCheckout}registerEvalHandler(e,t,n){this.config.evalHandlerRegistry?.register(e,t,n)}async getAppInfo(){return vp({config:this.config,services:this.services,bootTime:this.bootTime,endpoints:()=>this.listEndpoints(),interactions:()=>this.listInteractions()})}getRuntimeReadiness(){return Sp(this.services)}}var MC={kind:"service",serviceId:"brain-cli"},cp=`${MC.kind}:${MC.serviceId}`;var mJ=r.object({provider:r.enum(["hetzner","docker"]).default("hetzner"),serverSize:r.string().default("cx33"),location:r.string().default("fsn1"),domain:r.string().optional(),docker:r.object({enabled:r.boolean().default(!0),image:r.string().optional()}).prefault({}),ports:r.object({default:r.number().default(3333),preview:r.number().default(4321),production:r.number().default(8080)}).prefault({}),cdn:r.object({enabled:r.boolean().default(!1),provider:r.enum(["bunny","none"]).default("none")}).prefault({}),dns:r.object({enabled:r.boolean().default(!1),provider:r.enum(["bunny","none"]).default("none")}).prefault({}),paths:r.object({install:r.string().optional(),data:r.string().optional()}).prefault({})}),OC=r.object({name:r.string().default("brain-app"),version:r.string().default("1.0.0"),database:r.string().optional(),aiApiKey:r.string().optional(),aiImageKey:r.string().optional(),aiModel:r.string().optional(),aiReasoningEffort:Xn.optional(),logLevel:Qn.optional(),logFile:r.string().optional(),profileKind:r.string().trim().min(1).optional(),plugins:r.array(da).default([]),spaces:r.array(r.string()).default([]),identity:jC.optional(),agentInstructions:r.array(r.string()).optional(),deployment:mJ.prefault({})});async function GC(e,t){await wn({label:"entity",config:e,schema:{assets:DC,entities:NC,projectionDirtyInputs:zC,projectionWaves:UC,projectionIncidents:$C,projectionWaveInputs:qC,projectionWaveRules:LC,projectionRuleMemos:FC},migrationsFolder:xn(import.meta.url,"entity-service"),authTokenEnv:"DATABASE_AUTH_TOKEN",logger:t,afterMigrate:BC})}async function WC(e,t){await wn({label:"job-queue",config:e,schema:{jobQueue:JC,jobWorkerSessions:HC},migrationsFolder:xn(import.meta.url,"job-queue"),authTokenEnv:"JOB_QUEUE_DATABASE_AUTH_TOKEN",logger:t})}async function YC(e,t){await wn({label:"conversation",config:e,schema:{conversations:VC,messages:ZC,summaryTracking:KC},migrationsFolder:xn(import.meta.url,"conversation-service"),authTokenEnv:"CONVERSATION_DATABASE_AUTH_TOKEN",logger:t})}async function QC(e,t){await wn({label:"runtime-state",config:e,schema:{runtimeStateRecords:Le},migrationsFolder:xn(import.meta.url,"runtime-state"),authTokenEnv:"RUNTIME_STATE_DATABASE_AUTH_TOKEN",logger:t})}import{mkdir as up}from"fs/promises";import{isAbsolute as gJ}from"path";function XC(e=process.env){return{dataDir:e.XDG_DATA_HOME??"./data",cacheDir:e.XDG_CACHE_HOME??"./cache",distDir:"./dist"}}function e0(e=process.env){let t=e.BRAIN_GIT_BROKER_CHECKOUT;if(!t)return;if(!gJ(t))throw Error(`Git broker checkout path must be absolute: ${t}`);return t}function t0(e=process.env){let t=e.BRAIN_GIT_BROKER_SOCKET;if(!t)return;let n=107;if(Buffer.byteLength(t)>n)throw Error(`Git broker socket path is too long for a unix socket (${Buffer.byteLength(t)} > ${n} bytes): ${t}`);return t}function r0(e=process.env){return Cn(XC(e))}async function n0(e=process.env){let t=XC(e);try{await up(t.dataDir,{recursive:!0}),await up(t.cacheDir,{recursive:!0}),await up(t.distDir,{recursive:!0})}catch(n){let o=n instanceof Error&&n.message.includes("EACCES")?`Cannot create data directories \u2014 permission denied. Run from a writable directory or check permissions on ${t.dataDir}`:`Cannot create data directories: ${ke(n)}`;throw Error(o,{cause:n})}return Cn(t)}class dp{logger;migrations;constructor(e,t){this.logger=e,this.migrations=t??{getStandardConfigWithDirectories:()=>n0(),migrateEntities:GC,migrateJobQueue:WC,migrateConversations:YC,migrateRuntimeState:QC}}async runAllMigrations(e){this.logger.debug("Running database migrations...");let t=await this.migrations.getStandardConfigWithDirectories();if(e?.database)t.database.url=e.database;if(e?.jobQueueDatabase)t.jobQueueDatabase.url=e.jobQueueDatabase;if(e?.conversationDatabase)t.conversationDatabase.url=e.conversationDatabase;if(e?.runtimeStateDatabase)t.runtimeStateDatabase.url=e.runtimeStateDatabase;await this.migrateEntityDatabase(t),await this.migrateJobQueueDatabase(t),await this.migrateConversationDatabase(t),await this.migrateRuntimeStateDatabase(t),this.logger.debug("All database migrations completed successfully")}async migrateEntityDatabase(e){this.logger.debug("Running entity database migrations..."),await this.migrations.migrateEntities({url:e.database.url,...e.database.authToken&&{authToken:e.database.authToken}},this.logger)}async migrateJobQueueDatabase(e){this.logger.debug("Running job queue database migrations..."),await this.migrations.migrateJobQueue({url:e.jobQueueDatabase.url,...e.jobQueueDatabase.authToken&&{authToken:e.jobQueueDatabase.authToken}},this.logger)}async migrateConversationDatabase(e){this.logger.debug("Running conversation database migrations..."),await this.migrations.migrateConversations({url:e.conversationDatabase.url,...e.conversationDatabase.authToken&&{authToken:e.conversationDatabase.authToken}},this.logger)}async migrateRuntimeStateDatabase(e){this.logger.debug("Running runtime state database migrations..."),await this.migrations.migrateRuntimeState({url:e.runtimeStateDatabase.url,...e.runtimeStateDatabase.authToken&&{authToken:e.runtimeStateDatabase.authToken}},this.logger)}}var fJ="NODE_ENV";function hJ(){return process.env[fJ]}function o0(){return hJ()!=="production"}var yJ="startup-check";function vJ(e){let n={...OC.parse(e??{}),plugins:e?.plugins??[]};if(e?.permissions)n.permissions=e.permissions;if(e?.spaces)n.spaces=e.spaces;if(e?.cliConfig)n.cliConfig=e.cliConfig;if(e?.shellConfig)n.shellConfig=e.shellConfig;return n}function bJ(e,t){let n={plugins:e.plugins??[],...e.shellConfig};return _J(n),SJ(e,n),wJ(e,n,t),xJ(e,n),TJ(e,n),IJ(e,n),CJ(e,n),kJ(e,n),RJ(e,n),n}function _J(e){let t=r0();e.database??=t.database,e.jobQueueDatabase??=t.jobQueueDatabase,e.conversationDatabase??=t.conversationDatabase,e.runtimeStateDatabase??=t.runtimeStateDatabase,e.embeddingDatabase??=t.embeddingDatabase,e.embedding??=t.embedding,e.gitBrokerSocket??=t0(),e.gitBrokerCheckout??=e0()}function SJ(e,t){if(e.database)t.database={url:e.database};if(e.profileKind)t.profileKind=e.profileKind;t.features={}}function wJ(e,t,n){let o=n?.mode==="startup-check";if(!e.aiApiKey&&!e.aiImageKey&&!e.aiModel&&!e.aiReasoningEffort&&!o)return;t.ai={...t.ai,...o&&!t.ai?.apiKey&&{apiKey:yJ},...e.aiApiKey&&{apiKey:e.aiApiKey},...e.aiImageKey&&{imageApiKey:e.aiImageKey},...e.aiModel&&{model:e.aiModel},...e.aiReasoningEffort&&{reasoningEffort:e.aiReasoningEffort}}}function xJ(e,t){if(!e.logLevel&&!e.logFile)return;t.logging={level:e.logLevel??"info",format:"text",context:e.name,...e.logFile&&{file:e.logFile}}}function TJ(e,t){let n=e.permissions?.rules??[];t.permissions={...e.permissions,rules:n.some((o)=>o.pattern===cp)?n:[{pattern:cp,level:"admin"},...n]}}function IJ(e,t){if(e.spaces)t.spaces=e.spaces}function CJ(e,t){if(e.identity)t.identity=e.identity}function kJ(e,t){if(e.agentInstructions)t.agentInstructions=e.agentInstructions}function RJ(e,t){if(t.name=e.name,t.version=e.version,e.deployment.domain)t.siteBaseUrl=e.deployment.domain;t.localSiteUrl=`http://localhost:${e.deployment.ports.production}`,t.preferLocalUrls=o0()}class mp{shell=null;config;signalScope=null;signalShutdownFiber=null;stopPromise=null;hasCLI=!1;static create(e,t){return new mp(vJ(e),t)}constructor(e,t){if(this.config=e,this.hasCLI=process.argv.slice(2).includes("--cli"),t)this.shell=t}async migrate(){let e=vr.getInstance();await new dp(e).runAllMigrations({database:this.config.shellConfig?.database?.url??this.config.database,jobQueueDatabase:this.config.shellConfig?.jobQueueDatabase?.url,conversationDatabase:this.config.shellConfig?.conversationDatabase?.url,runtimeStateDatabase:this.config.shellConfig?.runtimeStateDatabase?.url})}createShell(e,t){this.shell=ia.createFresh(bJ(this.config,e),void 0,{...t&&{processRole:t}})}async registerCLIInterface(){if(!this.hasCLI)return;let e=this.getShell().getPluginManager(),{CLIInterface:t}=await import("./index-b3dbc07e.js"),n=new t(this.config.cliConfig);e.registerPlugin(n)}async initialize(e,t){if(!this.shell){if(!t?.migrationsCompleted)await this.migrate();this.createShell(e,t?.processRole)}await this.registerCLIInterface(),await this.getShell().initialize(e)}async start(){if(this.stopPromise)return;this.setupSignalHandlers()}stop(){return this.stopPromise??=this.stopApp(),this.stopPromise}async stopApp(){await this.closeSignalScope(),await this.shell?.shutdown()}async run(e){let n={debug:Ut.DEBUG,info:Ut.INFO,warn:Ut.WARN,error:Ut.ERROR}[this.config.logLevel??"info"]??Ut.INFO,o=vr.createFresh({level:n,context:this.config.name,useStderr:this.hasCLI});if(this.hasCLI)vr.getInstance().setUseStderr(!0);try{await this.initialize(void 0,e),await this.start(),e?.onRuntimeReady?.(),o.info(`\u2705 ${this.config.name} v${this.config.version} ready`),process.stdin.resume()}catch(i){o.error(`\u274C Failed to start ${this.config.name}:`,i),process.exit(1)}}static async run(e,t,n){await mp.create(e,t).run(n)}setupSignalHandlers(){if(this.signalScope)return;let e=de.runSync(Xe.make()),t=()=>{this.requestGracefulShutdown("SIGINT")},n=()=>{this.requestGracefulShutdown("SIGTERM")},o=pp(["SIGINT"],t),i=pp(["SIGTERM"],n);de.runSync(Xe.addFinalizer(e,de.sync(()=>{i(),o()}))),this.signalScope=e}requestGracefulShutdown(e){if(this.signalShutdownFiber)return;let t=vr.getInstance();t.info(`
|
|
178
178
|
Received ${e}, shutting down gracefully...`);let n=de.tryPromise({try:()=>this.stop(),catch:(o)=>o}).pipe(de.match({onFailure:(o)=>{t.error("Error during shutdown:",o),process.exit(1)},onSuccess:()=>{process.exit(0)}}));this.signalShutdownFiber=de.runFork(n)}async closeSignalScope(){let e=this.signalScope;if(this.signalScope=null,e)await de.runPromise(Xe.close(e,tt.void))}getShell(){if(!this.shell)throw Error("Shell not initialized. Call initialize() first.");return this.shell}}
|
|
179
179
|
export{Qn as S,Xn as T,tO as U,h6 as V,ce as W,na as X,LI as Y,GI as Z,Hs as _,JG as $,tp as aa,WG as ba,Ws as ca,VG as da,kte as ea,QI as fa,YG as ga,np as ha,op as ia,QG as ja,eJ as ka,yJ as la,vJ as ma,bJ as na,mp as oa};
|
|
180
180
|
|
|
181
181
|
//# debugId=515DF0108F32B0D064756E2164756E21
|
|
182
|
-
//# sourceMappingURL=index-
|
|
182
|
+
//# sourceMappingURL=index-tf2k5d73.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{S as c,T as y}from"./index-
|
|
2
|
+
import{S as c,T as y}from"./index-tf2k5d73.js";import{Fd as R,Gd as z,Lf as a}from"./index-jv41j8zg.js";import{Eh as i}from"./index-h2nhrbcx.js";import{$j as h,Zh as e,_j as l,ak as C}from"./index-pcfbw7x6.js";function _(t,n={}){if(!a(t))throw Error("use() expects a package definition returned by a @rizom/brain define helper");return Object.freeze({kind:"rizom-configured-plugin",definition:t,config:Object.freeze({...n})})}function O(t){if(t===null||typeof t!=="object")return!1;return Reflect.get(t,"kind")==="rizom-configured-plugin"&&a(Reflect.get(t,"definition"))&&typeof Reflect.get(t,"config")==="object"}var Ee=e.array(e.string()),Ie=e.record(e.string(),e.unknown()),Ae=e.unknown();var Be=e.enum(["eval"]),p=e.enum(["person","team","organization"]);function K(t){if(t.bundleContract?.trim().length===0)throw Error("Brain bundleContract must not be empty");return t}function f(t){if(Array.isArray(t))return t.map((n)=>f(n));if(i(t))return Object.fromEntries(Object.entries(t).map(([n,o])=>[n,f(o)]));return t}function u(t){return f(t)}var r=e.string().min(1),V=e.strictObject({member:r,value:e.record(e.string(),e.unknown()),overrides:r.optional()}),G=e.custom(i,{message:"Expected an opaque permission config object"}),q=e.strictObject({member:r,config:G,overrides:r.optional()}),U=e.strictObject({id:r,members:e.array(r),config:e.array(V).optional(),permissions:e.array(q).optional(),agentInstructions:e.array(e.string().min(1)).optional(),evalDisable:e.array(r).optional()});function E(t,n,o,Z){let w=new Set;for(let[j,g]of t.entries()){if(w.has(g))Z.addIssue({code:e.ZodIssueCode.custom,message:`Duplicate ${n} "${g}"`,path:[o,j]});w.add(g)}}var H=U.superRefine((t,n)=>{E(t.members,"member","members",n),E(t.evalDisable??[],"eval exclusion","evalDisable",n)});function I(t){return u(H.parse(t))}function J(t){if(t===void 0)return[];return Array.isArray(t)?t:[t]}var W=e.record(e.string(),e.unknown()),ut=e.record(e.string(),e.unknown()),Y=e.enum(["eval"]),Q=l,s=h,X=e.strictObject({create:s.optional(),update:s.optional(),delete:s.optional(),extract:s.optional(),publish:s.optional()}),ee=e.record(e.string(),X),A=W.superRefine((t,n)=>{if(typeof t.package!=="string")return;n.addIssue({code:"custom",message:'"package" uses the removed alpha external-plugin contract. Default-export a declarative package definition from a @rizom/brain define helper and compose it with use() in defineBrain().'})}),mt=e.strictObject({brain:e.string().optional(),bundleContract:e.string().trim().min(1).optional(),anchor:p.optional(),site:e.object({package:e.string().optional(),variant:e.string().optional(),theme:e.string().optional(),themeOverride:e.string().optional()}).optional(),name:e.string().optional(),kind:e.string().trim().min(1).optional(),logLevel:c.optional(),logFile:e.string().optional(),port:e.number().optional(),domain:e.string().optional(),database:e.string().optional(),embedding:e.strictObject({enabled:e.boolean().optional()}).optional(),model:e.string().optional(),reasoningEffort:y.optional(),bundles:e.array(e.string().min(1)).optional(),mode:Y.optional(),add:e.array(e.string()).optional(),remove:e.array(e.string()).optional(),admins:e.array(e.string()).optional(),anchors:e.array(e.string()).optional(),trusted:e.array(e.string()).optional(),spaces:e.array(e.string()).optional(),plugins:e.record(e.string(),A).optional(),permissions:e.object({admins:e.array(e.string()).optional(),anchors:e.array(e.string()).optional(),trusted:e.array(e.string()).optional(),rules:e.array(e.object({pattern:e.string(),level:Q})).optional(),entityActions:ee.optional()}).optional()});var Pt=e.record(e.string(),e.unknown());var ne=e.strictObject({pattern:e.string(),level:l}),Et=e.strictObject({admins:e.array(e.string()).optional(),anchors:e.array(e.string()).optional(),trusted:e.array(e.string()).optional(),rules:e.array(ne).optional(),entityActions:C.optional()});var D=`/* ============================================
|
|
3
3
|
THEME BASE - Shared utilities for all themes
|
|
4
4
|
============================================
|
|
5
5
|
This file contains CSS that is IDENTICAL across all themes.
|
|
@@ -528,4 +528,4 @@ import{S as c,T as y}from"./index-15rn9szm.js";import{Fd as R,Gd as z,Lf as a}fr
|
|
|
528
528
|
`+t}var B=e.custom((t)=>z.safeParse(t).success),se=e.custom((t)=>{if(!i(t))return!1;let{plugin:n,...o}=t;if(n!==void 0&&typeof n!=="function")return!1;return R.safeParse(o).success});var ce=e.looseObject({id:e.string().min(1)}),de=e.looseObject({label:e.string().min(1)}),ge=e.custom((t)=>typeof t==="function"),pe=e.looseObject({layouts:e.record(e.string(),e.unknown()).optional(),plugin:ge.optional(),pluginConfig:e.record(e.string(),e.unknown()).optional(),routes:e.array(ce).optional(),entityDisplay:e.record(e.string(),de).optional(),content:e.unknown().optional(),themeOverride:e.string().optional(),headScripts:e.array(e.string()).optional(),staticAssets:e.record(e.string(),e.string()).optional()}),Ut=e.custom((t)=>pe.safeParse(t).success);var In=e.looseObject({name:e.string().min(1),version:e.string().min(1),dependencies:e.record(e.string(),e.string()).optional(),peerDependencies:e.record(e.string(),e.string()).optional()});export{_ as M,O as N,K as O,I as P,J as Q,re as R};
|
|
529
529
|
|
|
530
530
|
//# debugId=615B721C5FB44D1E64756E2164756E21
|
|
531
|
-
//# sourceMappingURL=index-
|
|
531
|
+
//# sourceMappingURL=index-vasegzfn.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{I as a,J as b}from"./index-wfqrs1rn.js";import"./index-jv41j8zg.js";import"./index-h2nhrbcx.js";import"./index-cdqw3f7b.js";import"./index-pcfbw7x6.js";import"./index-wfnbc5ve.js";export{a as linkedinPostSchema,b as linkedinTemplate};
|
|
3
|
+
|
|
4
|
+
//# debugId=4DB900F63898B70564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=linkedin-template-pg5cwy3q.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{D as g}from"./index-058stchf.js";import{F as n,G as l}from"./index-
|
|
2
|
+
import{D as g}from"./index-058stchf.js";import{F as n,G as l}from"./index-pm6wtjx7.js";import{tb as i}from"./index-jv41j8zg.js";import"./index-h2nhrbcx.js";import"./index-cdqw3f7b.js";import{Zh as t}from"./index-pcfbw7x6.js";import"./index-wfnbc5ve.js";var S=t.object({siteUrl:t.url(),title:t.string(),description:t.string(),language:t.string().optional(),copyright:t.string().optional()});class d{logger;id="blog:rss";name="Blog RSS Feed DataSource";description="Generates RSS 2.0 feed XML from published blog posts";constructor(r){this.logger=r,this.logger.debug("RSSDataSource initialized")}async fetch(r,c,p){let e=S.parse(r),a=(await p.entityService.listEntities({entityType:"post",options:{limit:1000}},l)).filter((o)=>o.metadata.status==="published"&&o.metadata.publishedAt).map((o)=>{let s=i(o.content,n);return{...o,frontmatter:s.metadata,body:s.content}});this.logger.debug(`Generating RSS feed with ${a.length} posts`);let m={title:e.title,description:e.description,link:e.siteUrl,language:e.language??"en-us",...e.copyright&&{copyright:e.copyright}},u={xml:g(a,m)};return c.parse(u)}}export{d as RSSDataSource};
|
|
3
3
|
|
|
4
4
|
//# debugId=BA88B07467CD21EB64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=rss-datasource-
|
|
5
|
+
//# sourceMappingURL=rss-datasource-g6sg1kbk.js.map
|
package/dist/entities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mf as n,Nf as i,Of as e}from"./chunks/index-
|
|
2
|
+
import{Mf as n,Nf as i,Of as e}from"./chunks/index-jv41j8zg.js";import"./chunks/index-h2nhrbcx.js";import"./chunks/index-cdqw3f7b.js";import{Zh as t}from"./chunks/index-pcfbw7x6.js";import"./chunks/index-wfnbc5ve.js";export{n as defineEntity,e as defineEntityPackage,i as defineProjection,t as z};
|
|
3
3
|
|
|
4
4
|
//# debugId=BE071628369537C664756E2164756E21
|
|
5
5
|
//# sourceMappingURL=entities.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,10 @@ interface EntityDisplayEntry {
|
|
|
74
74
|
/** Items per page (default: 10). */
|
|
75
75
|
pageSize?: number | undefined;
|
|
76
76
|
/**
|
|
77
|
-
* A piece of work a visitor's answer may cite as a source.
|
|
78
|
-
*
|
|
77
|
+
* A piece of work a visitor's answer may cite as a source. False always
|
|
78
|
+
* excludes a type. If any type is true, only true entries are candidates;
|
|
79
|
+
* otherwise entries with pages are candidates unless explicitly false.
|
|
80
|
+
* This selects citations, not access permissions.
|
|
79
81
|
*/
|
|
80
82
|
citable?: boolean | undefined;
|
|
81
83
|
navigation?: {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M as d,N as t}from"./chunks/index-
|
|
2
|
+
import{M as d,N as t}from"./chunks/index-vasegzfn.js";import"./chunks/index-tf2k5d73.js";import"./chunks/index-taenf405.js";import"./chunks/index-48ksf4j5.js";import{Kf as a}from"./chunks/index-jv41j8zg.js";import"./chunks/index-h2nhrbcx.js";import"./chunks/index-cdqw3f7b.js";import"./chunks/index-pcfbw7x6.js";import"./chunks/index-wfnbc5ve.js";function s(e,i){let o=new Set,n=new Set;for(let r of e){if(!t(r))throw Error(`${i} contains a value that was not returned by use()`);if(o.has(r.definition))throw Error(`${i} contains duplicate plugin definition "${r.definition.id}"; include each configured definition only once`);if(n.has(r.definition.id))throw Error(`${i} contains duplicate local plugin id "${r.definition.id}"; give each package definition a unique local id before composing it`);o.add(r.definition),n.add(r.definition.id)}}function l(e){a(e.id,"Bundle id"),s(e.members,`Bundle "${e.id}"`);for(let i of e.config??[])if(!t(i.member))throw Error(`Bundle "${e.id}" config contains a value that was not returned by use()`);for(let i of e.permissions??[])if(!t(i.member))throw Error(`Bundle "${e.id}" permissions contains a value that was not returned by use()`);for(let i of e.evalDisable??[])if(!t(i))throw Error(`Bundle "${e.id}" evalDisable contains a value that was not returned by use()`);return Object.freeze({...e,members:Object.freeze([...e.members]),...e.config?{config:Object.freeze([...e.config])}:{},...e.permissions?{permissions:Object.freeze([...e.permissions])}:{},...e.agentInstructions?{agentInstructions:Object.freeze([...e.agentInstructions])}:{},...e.evalDisable?{evalDisable:Object.freeze([...e.evalDisable])}:{}})}function u(e){if(!e.name.trim())throw Error("Brain name must not be empty");if(e.bundleContract?.trim().length===0)throw Error("Brain bundleContract must not be empty");s(e.plugins,`Brain "${e.name}"`);let i=new Set(e.plugins),o=new Set;for(let n of e.bundles??[]){if(o.has(n.id))throw Error(`Brain "${e.name}" has duplicate bundle "${n.id}"`);o.add(n.id);for(let r of n.members)if(!i.has(r))throw Error(`Brain "${e.name}" bundle "${n.id}" references a plugin outside its catalog`);for(let r of n.config??[])if(!i.has(r.member))throw Error(`Brain "${e.name}" bundle "${n.id}" config references a plugin outside its catalog`);for(let r of n.permissions??[])if(!i.has(r.member))throw Error(`Brain "${e.name}" bundle "${n.id}" permissions reference a plugin outside its catalog`);for(let r of n.evalDisable??[])if(!i.has(r))throw Error(`Brain "${e.name}" bundle "${n.id}" evalDisable references a plugin outside its catalog`)}for(let n of e.evalDisable??[])if(!i.has(n))throw Error(`Brain "${e.name}" evalDisable references a plugin outside its catalog`);return Object.freeze({...e,plugins:Object.freeze([...e.plugins]),...e.bundles?{bundles:Object.freeze([...e.bundles])}:{},...e.agentInstructions?{agentInstructions:Object.freeze([...e.agentInstructions])}:{},...e.evalDisable?{evalDisable:Object.freeze([...e.evalDisable])}:{}})}export{u as defineBrain,l as defineBundle,d as use};
|
|
3
3
|
|
|
4
4
|
//# debugId=2E9085B08E877F9B64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/interfaces.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zf as n,mg as i,ng as o,og as r,pg as s,qg as f}from"./chunks/index-
|
|
2
|
+
import{Zf as n,mg as i,ng as o,og as r,pg as s,qg as f}from"./chunks/index-jv41j8zg.js";import"./chunks/index-h2nhrbcx.js";import"./chunks/index-cdqw3f7b.js";import{Zh as e,_j as t}from"./chunks/index-pcfbw7x6.js";import"./chunks/index-wfnbc5ve.js";export{t as UserPermissionLevelSchema,n as defineAccountSettings,r as defineDaemon,s as defineInterface,f as defineMessageInterface,o as defineRoute,i as protocol,e as z};
|
|
3
3
|
|
|
4
4
|
//# debugId=A30607B3592A906D64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=interfaces.js.map
|
package/dist/model.d.ts
CHANGED
|
@@ -4200,8 +4200,10 @@ interface EntityDisplayEntry {
|
|
|
4200
4200
|
/** Items per page (default: 10). */
|
|
4201
4201
|
pageSize?: number | undefined;
|
|
4202
4202
|
/**
|
|
4203
|
-
* A piece of work a visitor's answer may cite as a source.
|
|
4204
|
-
*
|
|
4203
|
+
* A piece of work a visitor's answer may cite as a source. False always
|
|
4204
|
+
* excludes a type. If any type is true, only true entries are candidates;
|
|
4205
|
+
* otherwise entries with pages are candidates unless explicitly false.
|
|
4206
|
+
* This selects citations, not access permissions.
|
|
4205
4207
|
*/
|
|
4206
4208
|
citable?: boolean | undefined;
|
|
4207
4209
|
navigation?: {
|