@manifesto-ai/sdk 3.15.0 → 3.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `@manifesto-ai/sdk` is the default package for applications that start with `createManifesto()`.
6
6
 
7
- > **Current Contract Note:** The current SDK contract is the activation-first model documented in [docs/sdk-SPEC.md](docs/sdk-SPEC.md). It includes typed `createIntent()` object binding, intent explanation reads, `@manifesto-ai/sdk/extensions`, and `createSimulationSession(instance)`.
7
+ > **Current Contract Note:** The current SDK contract is the activation-first model documented in [docs/sdk-SPEC.md](docs/sdk-SPEC.md). It includes typed `createIntent()` object binding, intent explanation reads, `simulate()` with optional debug-grade `diagnostics.trace`, `@manifesto-ai/sdk/extensions`, and `createSimulationSession(instance)`.
8
8
 
9
9
  ## When to Use It
10
10
 
@@ -13,7 +13,7 @@ Use the SDK when you want:
13
13
  - the shortest path to a running base runtime
14
14
  - typed intent creation through `MEL.actions.*`
15
15
  - optional typed effect authoring through `@manifesto-ai/sdk/effects`
16
- - `dispatchAsync`, subscriptions, legality queries, explanation reads, dry-run simulation, and snapshot reads in one package
16
+ - `dispatchAsync`, subscriptions, legality queries, explanation reads, dry-run simulation with optional trace diagnostics, and snapshot reads in one package
17
17
  - projected Snapshot reads by default, with canonical inspection available explicitly
18
18
  - safe post-activation arbitrary-snapshot tooling through `@manifesto-ai/sdk/extensions`
19
19
 
@@ -30,7 +30,7 @@ await instance.dispatchAsync(intent);
30
30
  console.log(instance.getSnapshot().data.count);
31
31
  ```
32
32
 
33
- Base runtime reads cover availability, dispatchability, intent explanation, dry-run simulation, subscriptions, events, and both projected and canonical snapshot access.
33
+ Base runtime reads cover availability, dispatchability, intent explanation, dry-run simulation, optional debug-grade trace diagnostics, subscriptions, events, and both projected and canonical snapshot access.
34
34
 
35
35
  Effect authoring helpers live on the dedicated `@manifesto-ai/sdk/effects` subpath. The root package stays centered on `createManifesto()`.
36
36
 
@@ -0,0 +1 @@
1
+ import{a as R,e as H}from"./chunk-BDIXNUQ3.js";import{getAvailableActions as He,isActionAvailable as Ve,isIntentDispatchable as Ue}from"@manifesto-ai/core";import{extractSchemaGraph as qe}from"@manifesto-ai/compiler";var xe=new Set(["$item","$index","$array"]);function Xe(e){let t=e.computed.fields,n=new Map;function a(r,u){let i=n.get(r);if(i!==void 0)return i;if(u.has(r))return!1;u.add(r);let c=t[r];if(!c)return u.delete(r),n.set(r,!0),!0;for(let s of ke(c.expr)){if(je(s))return u.delete(r),n.set(r,!1),!1;let l=Me(s,t);if(l!==null&&!a(l,u))return u.delete(r),n.set(r,!1),!1}return u.delete(r),n.set(r,!0),!0}return{visibleComputedKeys:Object.keys(t).filter(r=>a(r,new Set))}}function V(e,t){return{data:Ae(e.data),computed:ge(e.computed,t),system:{status:e.system.status,lastError:e.system.lastError},meta:{schemaHash:e.meta.schemaHash}}}function Je(e,t){return V(e,t)}function x(e){return Z(structuredClone(e))}function Q(e,t){return Oe(e,t)}function Ae(e){if(e==null)return e;if(Array.isArray(e)||typeof e!="object")return structuredClone(e);let t={};for(let[n,a]of Object.entries(e))n.startsWith("$")||(t[n]=a);return structuredClone(t)}function ge(e,t){let n={};for(let a of t.visibleComputedKeys)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return structuredClone(n)}function Me(e,t){if(Object.prototype.hasOwnProperty.call(t,e))return e;if(!e.startsWith("computed."))return null;let n=e.slice(9);return Object.prototype.hasOwnProperty.call(t,n)?n:null}function Ce(e){return e.startsWith("/")?e.slice(1).replace(/\//g,"."):e}function je(e){let t=Ce(e),n=t.startsWith("data.")?t.slice(5):t,o=/^([^.[\]]+)/.exec(n)?.[1]??"";return o.startsWith("$")?!xe.has(o):!1}function ke(e){let t=[],n=new WeakSet,a=o=>{if(o==null)return;if(Array.isArray(o)){o.forEach(a);return}if(typeof o!="object")return;let r=o;if(!n.has(r)&&(n.add(r),r.kind!=="lit")){if(r.kind==="get"&&typeof r.path=="string"){t.push(r.path);return}for(let u of Object.values(r))a(u)}};return a(e),t}function Oe(e,t){return O(e,t,new WeakMap)}function O(e,t,n){if(Object.is(e,t))return!0;if(typeof e!=typeof t)return!1;if(e===null||t===null)return e===t;if(typeof e!="object"||typeof t!="object")return!1;let a=e,o=t,r=Object.prototype.toString.call(a),u=Object.prototype.toString.call(o);if(r!==u)return!1;let i=n.get(a);if(i?.has(o))return!0;if(i||(i=new WeakSet,n.set(a,i)),i.add(o),Array.isArray(a)&&Array.isArray(o)){if(a.length!==o.length)return!1;for(let l=0;l<a.length;l+=1){let h=Object.prototype.hasOwnProperty.call(a,l),f=Object.prototype.hasOwnProperty.call(o,l);if(h!==f||h&&!O(a[l],o[l],n))return!1}return!0}if(a instanceof Date&&o instanceof Date)return a.getTime()===o.getTime();if(a instanceof RegExp&&o instanceof RegExp)return a.source===o.source&&a.flags===o.flags;if(ArrayBuffer.isView(a)&&ArrayBuffer.isView(o)){if(a.constructor!==o.constructor||a.byteLength!==o.byteLength)return!1;let l=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),h=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);return l.every((f,T)=>f===h[T])}if(a instanceof ArrayBuffer&&o instanceof ArrayBuffer){if(a.byteLength!==o.byteLength)return!1;let l=new Uint8Array(a),h=new Uint8Array(o);return l.every((f,T)=>f===h[T])}if(a instanceof Map&&o instanceof Map){if(a.size!==o.size)return!1;let l=Array.from(a.entries()),h=Array.from(o.entries());return l.every(([f,T],b)=>{let v=h[b];if(!v)return!1;let[A,j]=v;return O(f,A,n)&&O(T,j,n)})}if(a instanceof Set&&o instanceof Set){if(a.size!==o.size)return!1;let l=Array.from(a.values()),h=Array.from(o.values());return l.every((f,T)=>O(f,h[T],n))}let c=J(a),s=J(o);if(c.length!==s.length)return!1;for(let l=0;l<c.length;l+=1){let h=c[l],f=s[l];if(h!==f)return!1;let T=a[h],b=o[f];if(!O(T,b,n))return!1}return!0}function J(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort()}function Z(e,t=new WeakSet){if(e==null||typeof e!="object")return e;if(Y(e))return ee(e);let n=e;if(t.has(n)||Object.isFrozen(e))return e;t.add(n);for(let a of Reflect.ownKeys(n)){let o=n[a];if(Y(o)){De(n,a,o);continue}Z(o,t)}return Object.freeze(e)}function Y(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function ee(e){return structuredClone(e)}function De(e,t,n){let a=Object.getOwnPropertyDescriptor(e,t);!a||!("value"in a)||Object.defineProperty(e,t,{enumerable:a.enumerable??!0,configurable:!1,get(){return ee(n)}})}var U=Symbol("manifesto-sdk.action-param-names"),we=Symbol("manifesto-sdk.action-single-param-object-value"),z=Symbol("manifesto-sdk.runtime-kernel-factory"),L=Symbol("manifesto-sdk.activation-state"),k=Symbol("manifesto-sdk.extension-kernel");var Ne=/^(state|computed|action):.+$/;function q(e){let t=new Set(e.nodes.map(i=>i.id)),n=new Map,a=new Map,o=(i,c,s)=>{let l=i.get(c);if(l){l.add(s);return}i.set(c,new Set([s]))};for(let i of e.edges)o(n,i.from,i.to),o(a,i.to,i.from);let r=i=>{let c=Object.freeze({nodes:Object.freeze(e.nodes.filter(s=>i.has(s.id))),edges:Object.freeze(e.edges.filter(s=>i.has(s.from)&&i.has(s.to)))});return q(c)},u=(i,c)=>{let s=Pe(i,t),l=[s],h=new Set([s]),f=c==="incoming"?a:n;for(;l.length>0;){let T=l.shift();if(T)for(let b of f.get(T)??[])h.has(b)||(h.add(b),l.push(b))}return r(h)};return Object.freeze({nodes:e.nodes,edges:e.edges,traceUp(i){return u(i,"incoming")},traceDown(i){return u(i,"outgoing")}})}function Pe(e,t){if(typeof e=="string"){if(!Ne.test(e))throw new R("SCHEMA_ERROR",'SchemaGraph node id must use "state:<name>", "computed:<name>", or "action:<name>"');if(!t.has(e))throw new R("SCHEMA_ERROR",`Unknown SchemaGraph node id "${e}"`);return e}let n;switch(e.__kind){case"ActionRef":n=`action:${String(e.name)}`;break;case"FieldRef":n=`state:${e.name}`;break;case"ComputedRef":n=`computed:${e.name}`;break;default:throw new R("SCHEMA_ERROR","Unsupported SchemaGraph ref lookup target")}if(!t.has(n))throw new R("SCHEMA_ERROR",`SchemaGraph node "${n}" is not part of the projected graph`);return n}import{validateIntentInput as Fe}from"@manifesto-ai/core";function te(e,t,n){let a={intentId:t.intentId??"",intent:t,code:n.code,reason:n.message};return e("dispatch:rejected",a),a}function ne(e,t,n,a){e("dispatch:failed",{intentId:t.intentId??"",intent:t,error:n,...a!==void 0?{snapshot:a}:{}})}function ae(e,t,n){e("dispatch:completed",{intentId:t.intentId??"",intent:t,snapshot:n})}function ie({getAvailableActionsFor:e,projectSnapshotFromCanonical:t}){function n(u,i){let c=e(u),s=e(i),l=Object.freeze(s.filter(f=>!c.includes(f))),h=Object.freeze(c.filter(f=>!s.includes(f)));return Object.freeze({before:c,after:s,unlocked:l,locked:h})}function a(u,i){let c=x(u),s=x(i),l=t(c),h=t(s);return Object.freeze({projected:Object.freeze({beforeSnapshot:l,afterSnapshot:h,changedPaths:F(l,h),availability:n(c,s)}),canonical:Object.freeze({beforeCanonicalSnapshot:c,afterCanonicalSnapshot:s,pendingRequirements:s.system.pendingRequirements,status:s.system.status})})}function o(u,i){let c=Le(u),s=c;return Object.freeze({message:c.message,...typeof s.code=="string"?{code:s.code}:{},...typeof c.name=="string"?{name:c.name}:{},stage:i})}function r(u){return Object.freeze({hostTraces:x(u.traces)})}return Object.freeze({deriveExecutionOutcome:a,classifyExecutionFailure:o,createExecutionDiagnostics:r})}function F(e,t){let n=new Set,a=new WeakMap,o=(r,u,i)=>{if(Object.is(r,u))return;if(r===null||u===null){n.add(i);return}if(typeof r!="object"||typeof u!="object"){n.add(i);return}let c=r,s=u,l=a.get(c);if(l?.has(s))return;if(l?l.add(s):a.set(c,new WeakSet([s])),Array.isArray(r)||Array.isArray(u)){if(!Array.isArray(r)||!Array.isArray(u)){n.add(i);return}let f=Math.max(r.length,u.length);for(let T=0;T<f;T+=1){let b=Object.prototype.hasOwnProperty.call(r,T),v=Object.prototype.hasOwnProperty.call(u,T),A=`${i}[${T}]`;if(b!==v){n.add(A);continue}!b&&!v||o(r[T],u[T],A)}return}if(!oe(r)||!oe(u)){n.add(i);return}let h=new Set([...Object.keys(r),...Object.keys(u)]);for(let f of[...h].sort()){let T=Object.prototype.hasOwnProperty.call(r,f),b=Object.prototype.hasOwnProperty.call(u,f),v=`${i}.${f}`;if(T!==b){n.add(v);continue}o(r[f],u[f],v)}};return o(e.data,t.data,"data"),o(e.computed,t.computed,"computed"),o(e.system,t.system,"system"),o(e.meta,t.meta,"meta"),Object.freeze([...n].sort())}function oe(e){return Object.prototype.toString.call(e)==="[object Object]"}function Le(e){return e instanceof Error?e:new Error(String(e))}function se({schema:e,ensureIntentId:t,getAvailableActionsFor:n,isActionAvailableFor:a,isIntentDispatchableFor:o,projectSnapshotFromCanonical:r,getSimulateSync:u,emitEvent:i}){function c(y,m,p){return Object.freeze({layer:y,expression:m,evaluatedResult:!1,...p!==void 0?{description:p}:{}})}function s(y,m){let p=m.type,d=e.actions[p];return d?a(y,p)?o(y,m)?Object.freeze([]):Object.freeze(d.dispatchable?[c("dispatchable",d.dispatchable,d.description)]:[]):Object.freeze(d.available?[c("available",d.available,d.description)]:[]):Object.freeze([])}function l(y){return new R("ACTION_UNAVAILABLE",`Action "${y.type}" is unavailable against the current visible snapshot`)}function h(y){return new R("INTENT_NOT_DISPATCHABLE",`Action "${y.type}" is available, but the bound intent is not dispatchable against the current visible snapshot`)}function f(y){return new R("INVALID_INPUT",y)}function T(y,m){let p=Fe(e,m);return p?f(p):null}function b(y,m){let p=t(m),d=p.type;if(!a(y,d))return{kind:"unavailable",intent:p,actionName:d};let I=T(y,p);if(I)return{kind:"invalid-input",intent:p,actionName:d,error:I};let C=s(y,p);return C.length>0?{kind:"not-dispatchable",intent:p,actionName:d,blockers:C}:{kind:"admitted",intent:p,actionName:d}}function v(y,m){return m.kind==="unavailable"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"unavailable",blockers:s(y,m.intent)}}):m.kind==="invalid-input"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"invalid_input",error:{code:"INVALID_INPUT",message:m.error.message}}}):m.kind==="not-dispatchable"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"not_dispatchable",blockers:m.blockers}}):Object.freeze({kind:"admitted",actionName:m.actionName})}function A(y,m){let p=b(y,m);if(p.kind==="unavailable")return Object.freeze({kind:"blocked",actionName:p.actionName,available:!1,dispatchable:!1,blockers:s(y,p.intent)});if(p.kind==="invalid-input")throw p.error;if(p.kind==="not-dispatchable")return Object.freeze({kind:"blocked",actionName:p.actionName,available:!0,dispatchable:!1,blockers:p.blockers});let d=u()(y,p.intent),I=r(y),C=r(d.snapshot);return Object.freeze({kind:"admitted",actionName:p.actionName,available:!0,dispatchable:!0,status:d.status,requirements:d.requirements,canonicalSnapshot:d.snapshot,snapshot:C,newAvailableActions:n(d.snapshot),changedPaths:F(I,C)})}function j(y,m){throw te(i,y,m),m}function D(y){return j(y,l(y))}function w(y,m){return j(y,f(m))}function N(y){return j(y,h(y))}return Object.freeze({getIntentBlockersFor:s,validateIntentInputFor:T,evaluateIntentLegalityFor:b,deriveIntentAdmission:v,explainIntentFor:A,createUnavailableError:l,createNotDispatchableError:h,rejectInvalidInput:w,rejectUnavailable:D,rejectNotDispatchable:N})}function re({setVisibleSnapshot:e,restoreVisibleSnapshot:t,getCanonicalSnapshot:n,emitEvent:a}){function o(i,c){return e(i,c)}function r(i,c){let s=o(c);return ae(a,i,s),Object.freeze({publishedSnapshot:s,publishedCanonicalSnapshot:n()})}function u(i,c,s){let l=o(s);return ne(a,i,c,l),Object.freeze({publishedSnapshot:l,publishedCanonicalSnapshot:n()})}return Object.freeze({replaceVisibleSnapshot:o,restoreVisibleSnapshot:t,publishCompletedHostResult:r,publishFailedHostResult:u})}import{apply as ce,applySystemDelta as Ke,computeSync as Ge}from"@manifesto-ai/core";import{getHostState as _e}from"@manifesto-ai/host";function le(e,t){return{...e,timestamp:t,children:e.children.map(n=>le(n,t))}}function ze(e){let t={};function n(a){t[a.id]=a,a.children.forEach(n)}return n(e),t}function Be(e,t){let n=le(e.root,t);return{...e,duration:0,root:n,nodes:ze(n)}}function pe({schema:e,hostContextProvider:t,evaluateIntentLegalityFor:n}){function a(i,c,s){let h=_e(i.data)?.intentSlots??{},f=c.input===void 0?{type:c.type}:{type:c.type,input:c.input};return ce(e,i,[{op:"merge",path:[{kind:"prop",name:"$host"}],value:{intentSlots:{...h,[c.intentId]:f}}}],s)}function o(i){return new R("ACTION_UNAVAILABLE",`Action "${i.type}" is unavailable against the provided canonical snapshot`)}function r(i){return new R("INTENT_NOT_DISPATCHABLE",`Action "${i.type}" is available, but the bound intent is not dispatchable against the provided canonical snapshot`)}return Object.freeze({withHostIntentSlot:a,createSimulationUnavailableError:o,createSimulationNotDispatchableError:r,simulateSync:(i,c)=>{let s=n(i,c);if(s.kind==="unavailable")throw o(s.intent);if(s.kind==="invalid-input")throw s.error;if(s.kind==="not-dispatchable")throw r(s.intent);let l=s.intent,h=t.createFrozenContext(l.intentId),f=a(structuredClone(i),l,h),T=Ge(e,f,l,h),b=ce(e,f,T.patches,h),v=Ke(b,T.systemDelta);return Object.freeze({snapshot:x(v),patches:x(T.patches),systemDelta:x(T.systemDelta),status:T.status,requirements:x(T.systemDelta.addRequirements),diagnostics:Object.freeze({trace:x(Be(T.trace,i.meta.timestamp))})})}})}function ue({host:e,initialCanonicalSnapshot:t,projectSnapshotFromCanonical:n}){let a=structuredClone(t),o=n(a),r=x(a),u=Promise.resolve(),i=!1,c=new Set,s=new Map;function l(m,p){if(i)return()=>{};let d,I=!1;try{d=m(o),I=!0}catch{d=void 0,I=!1}let C={selector:m,listener:p,lastValue:d,initialized:I};return c.add(C),()=>{c.delete(C)}}function h(m,p){if(i)return()=>{};let d=s.get(m);return d||(d=new Set,s.set(m,d)),d.add(p),()=>{d?.delete(p)}}function f(){return o}function T(){return r}function b(){return structuredClone(a)}function v(m,p){a=structuredClone(m),e.reset(structuredClone(a)),r=x(a);let d=n(a),I=!Q(d,o);return I&&(o=d),p?.notify!==!1&&I&&y(o),o}function A(){e.reset(structuredClone(a))}function j(m,p){let d=s.get(m);if(d)for(let I of d)try{I(p)}catch{}}function D(m){let p=u.catch(()=>{}).then(m);return u=p.then(()=>{},()=>{}),p}function w(){i||(i=!0,c.clear(),s.clear())}function N(){return i}function y(m){for(let p of c){let d;try{d=p.selector(m)}catch{continue}if(!(p.initialized&&Object.is(p.lastValue,d))){p.lastValue=d,p.initialized=!0;try{p.listener(d)}catch{}}}}return{subscribe:l,on:h,getSnapshot:f,getCanonicalSnapshot:T,getVisibleCoreSnapshot:b,setVisibleSnapshot:v,restoreVisibleSnapshot:A,emitEvent:j,enqueue:D,dispose:w,isDisposed:N}}function de(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function $e(e){if(e.params)return e.params;let t=e.input;return!t||t.type!=="object"||!t.fields?[]:Object.keys(t.fields)}function We({schema:e,projectionPlan:t,host:n,hostContextProvider:a,MEL:o,createIntent:r}){let u=n.getSnapshot();if(!u)throw new R("SCHEMA_ERROR","Host failed to initialize its genesis snapshot");function i(S){return x(V(S,t))}let c=ue({host:n,initialCanonicalSnapshot:u,projectSnapshotFromCanonical:i}),{subscribe:s,on:l,getSnapshot:h,getCanonicalSnapshot:f,getVisibleCoreSnapshot:T,setVisibleSnapshot:b,restoreVisibleSnapshot:v,emitEvent:A,enqueue:j,dispose:D,isDisposed:w}=c,N=q(qe(e)),y=Object.keys(e.actions),m=Object.freeze(Object.fromEntries(y.map(S=>{let E=e.actions[S],P=o.actions[S]?.[U],ve=Object.freeze(Array.isArray(P)?[...P]:$e(E));return[S,Object.freeze({name:S,params:ve,input:E.input,description:E.description,hasDispatchableGate:E.dispatchable!==void 0})]}))),p=Object.freeze(y.map(S=>m[S]));function d(S){return Object.freeze([...He(e,S)])}let I=ie({getAvailableActionsFor:d,projectSnapshotFromCanonical:i});function C(){return d(f())}let he=(S=>S!==void 0?m[String(S)]:p);function K(S,E){return Ve(e,S,String(E))}function ye(S){return K(f(),S)}function G(S,E){return Ue(e,S,E)}let Te=((S,...E)=>G(f(),r(S,...E)));function $(S){return S.intentId&&S.intentId.length>0?S:{...S,intentId:de()}}async function Se(S,E){return n.dispatch(S,E)}let B=null,M=se({schema:e,ensureIntentId:$,getAvailableActionsFor:d,isActionAvailableFor:K,isIntentDispatchableFor:G,projectSnapshotFromCanonical:i,getSimulateSync:()=>{if(!B)throw new R("SCHEMA_ERROR","Runtime simulation surface is not initialized");return B},emitEvent:A}),_=pe({schema:e,hostContextProvider:a,evaluateIntentLegalityFor:M.evaluateIntentLegalityFor});B=_.simulateSync;let W=re({setVisibleSnapshot:b,restoreVisibleSnapshot:v,getCanonicalSnapshot:f,emitEvent:A}),X=M.getIntentBlockersFor,be=((S,...E)=>X(f(),r(S,...E))),Re=_.simulateSync,Ee=((S,...E)=>{let g=_.simulateSync(f(),r(S,...E)),P=i(g.snapshot);return Object.freeze({snapshot:P,changedPaths:F(h(),P),newAvailableActions:d(g.snapshot),requirements:g.requirements,status:g.status,diagnostics:g.diagnostics})}),Ie=Object.freeze({MEL:o,schema:e,createIntent:r,getCanonicalSnapshot:f,projectSnapshot:S=>i(S),simulateSync:(S,E)=>{let g=_.simulateSync(S,E);return Object.freeze({snapshot:g.snapshot,patches:g.patches,requirements:g.requirements,status:g.status,diagnostics:g.diagnostics})},getAvailableActionsFor:d,isActionAvailableFor:K,isIntentDispatchableFor:G,explainIntentFor:M.explainIntentFor});return{schema:e,MEL:o,createIntent:r,subscribe:s,on:l,getSnapshot:h,getAvailableActionsFor:d,getAvailableActions:C,getIntentBlockersFor:X,getActionMetadata:he,isActionAvailableFor:K,isActionAvailable:ye,isIntentDispatchableFor:G,isIntentDispatchable:Te,getIntentBlockers:be,getSchemaGraph(){return N},simulateSync:Re,simulate:Ee,dispose:D,isDisposed:w,getCanonicalSnapshot:f,getVisibleCoreSnapshot:T,setVisibleSnapshot:W.replaceVisibleSnapshot,restoreVisibleSnapshot:W.restoreVisibleSnapshot,emitEvent:A,enqueue:j,ensureIntentId:$,executeHost:Se,validateIntentInputFor:M.validateIntentInputFor,evaluateIntentLegalityFor:M.evaluateIntentLegalityFor,deriveIntentAdmission:M.deriveIntentAdmission,deriveExecutionOutcome:I.deriveExecutionOutcome,classifyExecutionFailure:I.classifyExecutionFailure,createExecutionDiagnostics:I.createExecutionDiagnostics,createUnavailableError:M.createUnavailableError,createNotDispatchableError:M.createNotDispatchableError,rejectInvalidInput:M.rejectInvalidInput,rejectUnavailable:M.rejectUnavailable,rejectNotDispatchable:M.rejectNotDispatchable,[k]:Ie}}function Ft(e,t,n){Object.defineProperty(e,z,{enumerable:!1,configurable:!1,writable:!1,value:t});let a=n??fe(e)??{activated:!1};return fe(e)||Object.defineProperty(e,L,{enumerable:!1,configurable:!1,writable:!1,value:a}),e}function Kt(e){let n=e[z];if(typeof n!="function")throw new R("SCHEMA_ERROR","ComposableManifesto is missing its runtime kernel factory");return n}function Gt(e,t){return Object.defineProperty(e,k,{enumerable:!1,configurable:!1,writable:!1,value:t[k]}),e}function _t(e){let n=e[k];if(!n)throw new R("SCHEMA_ERROR","Activated runtime is missing its extension kernel");return n}function me(e){let n=e[L];if(!n)throw new R("SCHEMA_ERROR","ComposableManifesto is missing its activation state");return n}function zt(e){if(me(e).activated)throw new H}function Bt(e){let t=me(e);if(t.activated)throw new H;t.activated=!0}function fe(e){return e[L]??null}export{U as a,we as b,k as c,Xe as d,Je as e,x as f,te as g,ne as h,re as i,de as j,We as k,Ft as l,Kt as m,Gt as n,_t as o,me as p,zt as q,Bt as r};
@@ -0,0 +1 @@
1
+ import{c as y,g as S,h as b,i as E,n as R}from"./chunk-7TMADY2E.js";import{a as m,d as p}from"./chunk-BDIXNUQ3.js";async function f(t,i,d,h){let s=t.getCanonicalSnapshot(),a=i.projectSnapshot(s),e=t.evaluateIntentLegalityFor(s,h),u=t.deriveIntentAdmission(s,e);if(e.kind!=="admitted"){let r=u,c=j(t,e),l=S(t.emitEvent,e.intent,c);return{kind:"rejected",intent:e.intent,admission:r,beforeSnapshot:a,beforeCanonicalSnapshot:s,rejection:l,rejectionError:c}}let n=u,o;try{o=await t.executeHost(e.intent)}catch(r){let c=g(r);return b(t.emitEvent,e.intent,c),{kind:"failed",intent:e.intent,admission:n,beforeSnapshot:a,beforeCanonicalSnapshot:s,failure:c,errorInfo:t.classifyExecutionFailure(c,"host"),published:!1}}let T=t.createExecutionDiagnostics(o);if(o.status==="error"){let r=o.error??new m("HOST_ERROR","Host dispatch failed"),{publishedSnapshot:c,publishedCanonicalSnapshot:l}=d.publishFailedHostResult(e.intent,r,o.snapshot);return{kind:"failed",intent:e.intent,admission:n,beforeSnapshot:a,beforeCanonicalSnapshot:s,failure:r,errorInfo:t.classifyExecutionFailure(r,"host"),published:!0,diagnostics:T,outcome:t.deriveExecutionOutcome(s,l)}}let{publishedSnapshot:x,publishedCanonicalSnapshot:A}=d.publishCompletedHostResult(e.intent,o.snapshot);return{kind:"completed",intent:e.intent,admission:n,publishedSnapshot:x,outcome:t.deriveExecutionOutcome(s,A),diagnostics:T}}function I(t){if(t.kind==="completed")return t.publishedSnapshot;throw t.kind==="rejected"?t.rejectionError:t.failure}function D(t){return t.kind==="completed"?Object.freeze({kind:"completed",intent:t.intent,admission:t.admission,outcome:t.outcome,diagnostics:t.diagnostics}):t.kind==="rejected"?Object.freeze({kind:"rejected",intent:t.intent,admission:t.admission,beforeSnapshot:t.beforeSnapshot,beforeCanonicalSnapshot:t.beforeCanonicalSnapshot,rejection:t.rejection}):Object.freeze({kind:"failed",intent:t.intent,admission:t.admission,beforeSnapshot:t.beforeSnapshot,beforeCanonicalSnapshot:t.beforeCanonicalSnapshot,error:t.errorInfo,published:t.published,...t.diagnostics!==void 0?{diagnostics:t.diagnostics}:{},...t.outcome!==void 0?{outcome:t.outcome}:{}})}function j(t,i){if(i.kind==="unavailable")return t.createUnavailableError(i.intent);if(i.kind==="invalid-input")return i.error;if(i.kind==="not-dispatchable")return t.createNotDispatchableError(i.intent);throw new m("SDK_REPORT_ERROR","Cannot derive a rejected dispatch error for an admitted intent")}function g(t){return t instanceof Error?t:new Error(String(t))}function F(t){let i=t[y],d=E({setVisibleSnapshot:t.setVisibleSnapshot,restoreVisibleSnapshot:t.restoreVisibleSnapshot,getCanonicalSnapshot:t.getCanonicalSnapshot,emitEvent:t.emitEvent});function h(n){if(t.isDisposed())return Promise.reject(new p);let o=t.ensureIntentId(n);return t.enqueue(async()=>{if(t.isDisposed())throw new p;return I(await f(t,i,d,o))})}function s(n){if(t.isDisposed())return Promise.reject(new p);let o=t.ensureIntentId(n);return t.enqueue(async()=>{if(t.isDisposed())throw new p;return D(await f(t,i,d,o))})}function a(n){return i.explainIntentFor(t.getCanonicalSnapshot(),n)}function e(n){return a(n)}function u(n){let o=a(n);return o.kind==="blocked"?o.blockers:null}return R({createIntent:t.createIntent,dispatchAsync:h,dispatchAsyncWithReport:s,subscribe:t.subscribe,on:t.on,getSnapshot:t.getSnapshot,getCanonicalSnapshot:t.getCanonicalSnapshot,getAvailableActions:t.getAvailableActions,isIntentDispatchable:t.isIntentDispatchable,getIntentBlockers:t.getIntentBlockers,explainIntent:a,why:e,whyNot:u,getActionMetadata:t.getActionMetadata,isActionAvailable:t.isActionAvailable,getSchemaGraph:t.getSchemaGraph,simulate:t.simulate,MEL:t.MEL,schema:t.schema,dispose:t.dispose},t)}export{F as a};
@@ -1,7 +1,7 @@
1
1
  import { type ComputeStatus, type DomainSchema, type Patch, type Requirement, type Snapshot as CoreSnapshot, type SystemDelta } from "@manifesto-ai/core";
2
2
  import type { HostContextProvider, HostResult, ManifestoHost } from "@manifesto-ai/host";
3
3
  import { ManifestoError } from "../errors.js";
4
- import type { BaseLaws, CanonicalSnapshot, ComposableManifesto, DispatchBlocker, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, IntentAdmission, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, SchemaGraph, Snapshot, TypedCreateIntent, TypedGetActionMetadata, TypedGetIntentBlockers, TypedIntent, TypedIsIntentDispatchable, TypedMEL, TypedOn, TypedSimulate, TypedSubscribe } from "../types.js";
4
+ import type { BaseLaws, CanonicalSnapshot, ComposableManifesto, DispatchBlocker, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, IntentAdmission, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, SchemaGraph, SimulationDiagnostics, Snapshot, TypedCreateIntent, TypedGetActionMetadata, TypedGetIntentBlockers, TypedIntent, TypedIsIntentDispatchable, TypedMEL, TypedOn, TypedSimulate, TypedSubscribe } from "../types.js";
5
5
  import type { SnapshotProjectionPlan } from "../projection/snapshot-projection.js";
6
6
  import type { ExtensionKernel } from "../extensions-types.js";
7
7
  import type { IntentLegalityEvaluation } from "../runtime/facets.js";
@@ -14,6 +14,7 @@ export type SimulateResult<T extends ManifestoDomainShape = ManifestoDomainShape
14
14
  readonly systemDelta: Readonly<SystemDelta>;
15
15
  readonly status: ComputeStatus;
16
16
  readonly requirements: readonly Requirement[];
17
+ readonly diagnostics?: SimulationDiagnostics;
17
18
  };
18
19
  export interface RuntimeKernel<T extends ManifestoDomainShape> {
19
20
  readonly schema: DomainSchema;
@@ -1,10 +1,11 @@
1
1
  import type { ComputeStatus, DomainSchema, Patch, Requirement } from "@manifesto-ai/core";
2
- import type { CanonicalSnapshot, CreateIntentArgs, IntentExplanation, ManifestoDomainShape, Snapshot, TypedActionRef, TypedCreateIntent, TypedIntent, TypedMEL } from "./types.js";
2
+ import type { CanonicalSnapshot, CreateIntentArgs, IntentExplanation, ManifestoDomainShape, SimulationDiagnostics, Snapshot, TypedActionRef, TypedCreateIntent, TypedIntent, TypedMEL } from "./types.js";
3
3
  export type ExtensionSimulateResult<T extends ManifestoDomainShape = ManifestoDomainShape> = {
4
4
  readonly snapshot: CanonicalSnapshot<T["state"]>;
5
5
  readonly patches: readonly Patch[];
6
6
  readonly requirements: readonly Requirement[];
7
7
  readonly status: ComputeStatus;
8
+ readonly diagnostics?: SimulationDiagnostics;
8
9
  };
9
10
  export interface ExtensionKernel<T extends ManifestoDomainShape> {
10
11
  readonly MEL: TypedMEL<T>;
@@ -1 +1 @@
1
- import{f as m,o as c}from"./chunk-5BUS6Q4E.js";import{a as S}from"./chunk-BDIXNUQ3.js";function p(n){return n==="pending"||n==="halted"||n==="error"}function d(n){return n.__kind==="ActionRef"}function l(n){return Object.freeze([...n])}function u(n,e,t){return Object.freeze(t?[]:n.getAvailableActionsFor(e).map(i=>n.MEL.actions[i]))}function y(n,e,t,i,s){let a=p(s);return Object.freeze({intent:m(n),snapshot:e.projectSnapshot(t),canonicalSnapshot:t,availableActions:u(e,t,a),requirements:l(i),status:s,isTerminal:a})}function T(n,e){return Object.freeze({snapshot:e.snapshot,canonicalSnapshot:e.canonicalSnapshot,depth:e.depth,trajectory:e.trajectory,availableActions:e.availableActions,requirements:e.requirements,status:e.status,isTerminal:e.isTerminal,finish(){return e},next(i,...s){if(e.isTerminal)throw new S("SIMULATION_SESSION_TERMINAL","SimulationSession.next() cannot advance a terminal session");let a=d(i)?n.createIntent(i,...s):i,r=n.simulateSync(e.canonicalSnapshot,a),o=y(a,n,r.snapshot,r.requirements,r.status),f=Object.freeze({snapshot:o.snapshot,canonicalSnapshot:r.snapshot,depth:e.depth+1,trajectory:l([...e.trajectory,o]),availableActions:o.availableActions,requirements:o.requirements,status:o.status,isTerminal:o.isTerminal});return T(n,f)}})}function h(n){let e=c(n),t=e.getCanonicalSnapshot(),i=t.system.status,s=p(i);return T(e,Object.freeze({snapshot:e.projectSnapshot(t),canonicalSnapshot:t,depth:0,trajectory:Object.freeze([]),availableActions:u(e,t,s),requirements:l(t.system.pendingRequirements),status:i,isTerminal:s}))}function v(n){return c(n)}export{h as createSimulationSession,v as getExtensionKernel};
1
+ import{f as m,o as c}from"./chunk-7TMADY2E.js";import{a as S}from"./chunk-BDIXNUQ3.js";function p(n){return n==="pending"||n==="halted"||n==="error"}function d(n){return n.__kind==="ActionRef"}function l(n){return Object.freeze([...n])}function u(n,e,t){return Object.freeze(t?[]:n.getAvailableActionsFor(e).map(i=>n.MEL.actions[i]))}function y(n,e,t,i,s){let a=p(s);return Object.freeze({intent:m(n),snapshot:e.projectSnapshot(t),canonicalSnapshot:t,availableActions:u(e,t,a),requirements:l(i),status:s,isTerminal:a})}function T(n,e){return Object.freeze({snapshot:e.snapshot,canonicalSnapshot:e.canonicalSnapshot,depth:e.depth,trajectory:e.trajectory,availableActions:e.availableActions,requirements:e.requirements,status:e.status,isTerminal:e.isTerminal,finish(){return e},next(i,...s){if(e.isTerminal)throw new S("SIMULATION_SESSION_TERMINAL","SimulationSession.next() cannot advance a terminal session");let a=d(i)?n.createIntent(i,...s):i,r=n.simulateSync(e.canonicalSnapshot,a),o=y(a,n,r.snapshot,r.requirements,r.status),f=Object.freeze({snapshot:o.snapshot,canonicalSnapshot:r.snapshot,depth:e.depth+1,trajectory:l([...e.trajectory,o]),availableActions:o.availableActions,requirements:o.requirements,status:o.status,isTerminal:o.isTerminal});return T(n,f)}})}function h(n){let e=c(n),t=e.getCanonicalSnapshot(),i=t.system.status,s=p(i);return T(e,Object.freeze({snapshot:e.projectSnapshot(t),canonicalSnapshot:t,depth:0,trajectory:Object.freeze([]),availableActions:u(e,t,s),requirements:l(t.system.pendingRequirements),status:i,isTerminal:s}))}function v(n){return c(n)}export{h as createSimulationSession,v as getExtensionKernel};
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  export type { SdkManifest } from "./manifest.js";
11
11
  export { createManifesto } from "./create-manifesto.js";
12
- export type { ActivatedInstance, ActionArgs, CreateIntentArgs, DispatchReport, ActionObjectBindingArgs, DispatchBlocker, AvailableActionDelta, TypedActionMetadata, TypedGetActionMetadata, TypedGetIntentBlockers, TypedIsIntentDispatchable, BaseLaws, BaseComposableLaws, CanonicalPlatformNamespaces, CanonicalSnapshot, ComposableManifesto, ComputedRef, EffectContext, EffectHandler, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, FieldRef, GovernedComposableLaws, GovernanceLaws, IntentAdmission, IntentAdmissionFailure, IntentExplanation, InvalidInputInfo, LineageComposableLaws, LineageLaws, ManifestoBaseInstance, ManifestoDecoratedRuntimeByLaws, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, ManifestoEventPayload, ManifestoRuntimeByLaws, Selector, SimulateResult, ProjectedDiff, CanonicalOutcome, SchemaGraph, SchemaGraphEdge, SchemaGraphEdgeRelation, SchemaGraphNode, SchemaGraphNodeId, SchemaGraphNodeKind, SchemaGraphNodeRef, Snapshot, TypedActionRef, TypedCommitAsync, TypedCreateIntent, TypedDispatchAsync, TypedIntent, TypedMEL, TypedOn, TypedSimulate, TypedSubscribe, Unsubscribe, } from "./types.js";
12
+ export type { ActivatedInstance, ActionArgs, CreateIntentArgs, DispatchReport, ActionObjectBindingArgs, DispatchBlocker, AvailableActionDelta, TypedActionMetadata, TypedGetActionMetadata, TypedGetIntentBlockers, TypedIsIntentDispatchable, BaseLaws, BaseComposableLaws, CanonicalPlatformNamespaces, CanonicalSnapshot, ComposableManifesto, ComputedRef, EffectContext, EffectHandler, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, FieldRef, GovernedComposableLaws, GovernanceLaws, IntentAdmission, IntentAdmissionFailure, IntentExplanation, InvalidInputInfo, LineageComposableLaws, LineageLaws, ManifestoBaseInstance, ManifestoDecoratedRuntimeByLaws, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, ManifestoEventPayload, ManifestoRuntimeByLaws, Selector, SimulationDiagnostics, SimulateResult, ProjectedDiff, CanonicalOutcome, SchemaGraph, SchemaGraphEdge, SchemaGraphEdgeRelation, SchemaGraphNode, SchemaGraphNodeId, SchemaGraphNodeKind, SchemaGraphNodeRef, Snapshot, TypedActionRef, TypedCommitAsync, TypedCreateIntent, TypedDispatchAsync, TypedIntent, TypedMEL, TypedOn, TypedSimulate, TypedSubscribe, Unsubscribe, } from "./types.js";
13
13
  export { AlreadyActivatedError, CompileError, DisposedError, ManifestoError, ReservedEffectError, } from "./errors.js";
14
14
  export type { CompileDiagnostic } from "./errors.js";
15
15
  export type { DomainSchema, Intent, Patch, Snapshot as CoreSnapshot, } from "@manifesto-ai/core";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import{a as y,b,c as H,d as L,e as N,f as B,g as V,h as $,i as F,j as E,k as A,l as G,n as z,r as K}from"./chunk-5BUS6Q4E.js";import{a as l,b as R,c as j,d as h,e as ne}from"./chunk-BDIXNUQ3.js";async function M(e,t,n,a){let r=e.getCanonicalSnapshot(),i=t.projectSnapshot(r),o=e.evaluateIntentLegalityFor(r,a),d=e.deriveIntentAdmission(r,o);if(o.kind!=="admitted"){let u=d,f=oe(e,o),T=V(e.emitEvent,o.intent,f);return{kind:"rejected",intent:o.intent,admission:u,beforeSnapshot:i,beforeCanonicalSnapshot:r,rejection:T,rejectionError:f}}let c=d,s;try{s=await e.executeHost(o.intent)}catch(u){let f=ae(u);return $(e.emitEvent,o.intent,f),{kind:"failed",intent:o.intent,admission:c,beforeSnapshot:i,beforeCanonicalSnapshot:r,failure:f,errorInfo:e.classifyExecutionFailure(f,"host"),published:!1}}let p=e.createExecutionDiagnostics(s);if(s.status==="error"){let u=s.error??new l("HOST_ERROR","Host dispatch failed"),{publishedSnapshot:f,publishedCanonicalSnapshot:T}=n.publishFailedHostResult(o.intent,u,s.snapshot);return{kind:"failed",intent:o.intent,admission:c,beforeSnapshot:i,beforeCanonicalSnapshot:r,failure:u,errorInfo:e.classifyExecutionFailure(u,"host"),published:!0,diagnostics:p,outcome:e.deriveExecutionOutcome(r,T)}}let{publishedSnapshot:m,publishedCanonicalSnapshot:k}=n.publishCompletedHostResult(o.intent,s.snapshot);return{kind:"completed",intent:o.intent,admission:c,publishedSnapshot:m,outcome:e.deriveExecutionOutcome(r,k),diagnostics:p}}function q(e){if(e.kind==="completed")return e.publishedSnapshot;throw e.kind==="rejected"?e.rejectionError:e.failure}function U(e){return e.kind==="completed"?Object.freeze({kind:"completed",intent:e.intent,admission:e.admission,outcome:e.outcome,diagnostics:e.diagnostics}):e.kind==="rejected"?Object.freeze({kind:"rejected",intent:e.intent,admission:e.admission,beforeSnapshot:e.beforeSnapshot,beforeCanonicalSnapshot:e.beforeCanonicalSnapshot,rejection:e.rejection}):Object.freeze({kind:"failed",intent:e.intent,admission:e.admission,beforeSnapshot:e.beforeSnapshot,beforeCanonicalSnapshot:e.beforeCanonicalSnapshot,error:e.errorInfo,published:e.published,...e.diagnostics!==void 0?{diagnostics:e.diagnostics}:{},...e.outcome!==void 0?{outcome:e.outcome}:{}})}function oe(e,t){if(t.kind==="unavailable")return e.createUnavailableError(t.intent);if(t.kind==="invalid-input")return t.error;if(t.kind==="not-dispatchable")return e.createNotDispatchableError(t.intent);throw new l("SDK_REPORT_ERROR","Cannot derive a rejected dispatch error for an admitted intent")}function ae(e){return e instanceof Error?e:new Error(String(e))}function W(e){let t=e[H],n=F({setVisibleSnapshot:e.setVisibleSnapshot,restoreVisibleSnapshot:e.restoreVisibleSnapshot,getCanonicalSnapshot:e.getCanonicalSnapshot,emitEvent:e.emitEvent});function a(c){if(e.isDisposed())return Promise.reject(new h);let s=e.ensureIntentId(c);return e.enqueue(async()=>{if(e.isDisposed())throw new h;return q(await M(e,t,n,s))})}function r(c){if(e.isDisposed())return Promise.reject(new h);let s=e.ensureIntentId(c);return e.enqueue(async()=>{if(e.isDisposed())throw new h;return U(await M(e,t,n,s))})}function i(c){return t.explainIntentFor(e.getCanonicalSnapshot(),c)}function o(c){return i(c)}function d(c){let s=i(c);return s.kind==="blocked"?s.blockers:null}return z({createIntent:e.createIntent,dispatchAsync:a,dispatchAsyncWithReport:r,subscribe:e.subscribe,on:e.on,getSnapshot:e.getSnapshot,getCanonicalSnapshot:e.getCanonicalSnapshot,getAvailableActions:e.getAvailableActions,isIntentDispatchable:e.isIntentDispatchable,getIntentBlockers:e.getIntentBlockers,explainIntent:i,why:o,whyNot:d,getActionMetadata:e.getActionMetadata,isActionAvailable:e.isActionAvailable,getSchemaGraph:e.getSchemaGraph,simulate:e.simulate,MEL:e.MEL,schema:e.schema,dispose:e.dispose},e)}import{createHostContextProvider as de,createHost as le,defaultRuntime as pe}from"@manifesto-ai/host";import{extractDefaults as me}from"@manifesto-ai/core";import{semanticPathToPatchPath as re}from"@manifesto-ai/core";function ie(e){return typeof e=="object"&&e!==null&&"key"in e&&"into"in e}function X(e,t){if(ie(e))return{patches:[{op:"set",path:J(e.into),value:se(e.key)}]};let{path:n,target:a}=e,r=ce(n,t);return a?{patches:[{op:"set",path:J(a),value:r.value}]}:{patches:[]}}function se(e){switch(e){case"uuid":return E();case"timestamp":case"time.now":return Date.now();case"isoTimestamp":return new Date().toISOString();default:return null}}function J(e){let t=Y(e),n=t.startsWith("data.")?t.slice(5):t;return re(n)}function Y(e){return e.startsWith("/")?e.slice(1).replace(/\//g,"."):e}function ce(e,t){let a=Y(e).split(".");if(a.length===0)return{value:void 0,found:!1};let[r,...i]=a,o;switch(r){case"data":o=t.data;break;case"computed":o=t.computed;break;case"system":o=t.system;break;case"meta":o=t.meta;break;default:o=t.data,i.unshift(r);break}for(let d of i){if(o==null||typeof o!="object")return{value:void 0,found:!1};o=o[d]}return{value:o,found:o!==void 0}}var S="system.get",P="system.",Q=Object.freeze({__baseLaws:!0});function D(e,t,n){let a=pe,r=le(e,{initialData:me(e.state),runtime:a}),i=de(a);r.registerEffect(S,async(o,d,c)=>{let{patches:s}=X(d,c.snapshot);return s});for(let[o,d]of Object.entries(n)){let c=async(s,p,m)=>await d(p,{snapshot:B(N(m.snapshot,t))});r.registerEffect(o,c)}return{host:r,contextProvider:i}}import{createIntent as ue}from"@manifesto-ai/core";function I(){return(e,...t)=>{let n=e,a=E(),r=fe(n,t);return ue(String(e.name),r,a)}}function fe(e,t){let n=Object.hasOwn(e,y)?e[y]:[];if(t.length!==0){if(n===null){if(t.length===1&&g(t[0]))return t[0];throw new l("INVALID_INTENT_ARGS",`Action "${String(e.name)}" requires a single object argument because positional parameter metadata is unavailable`)}if(n.length===0){if(t.length===1)return t[0];throw new l("INVALID_INTENT_ARGS",`Action "${String(e.name)}" does not accept multiple positional arguments`)}return n.length===1&&t.length===1&&g(t[0])&&e[b]?{[n[0]??"arg0"]:t[0]}:n.length===1&&t.length===1&&he(t[0],n[0])||t.length===1&&g(t[0])&&n.length>1?t[0]:Object.fromEntries(t.map((a,r)=>[n[r]??`arg${r}`,a]))}}function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function he(e,t){if(!t||!g(e))return!1;let n=Object.keys(e);return n.length===1&&n[0]===t}import{hashSchemaSync as Re}from"@manifesto-ai/core";import{compileMelDomain as ye,parse as Se,tokenize as be}from"@manifesto-ai/compiler";function Z(e){let t=ye(e,{mode:"domain"});if(t.errors.length>0){let a=t.errors.map(r=>{let i=r.location;if(!i||i.start.line===0&&i.start.column===0)return`[${r.code}] ${r.message}`;let o=`[${r.code}] ${r.message} (${i.start.line}:${i.start.column})`,d=e.split(`
2
- `)[i.start.line-1];if(!d)return o;let c=String(i.start.line).padStart(4," "),s=Math.max(1,i.end.line===i.start.line?Math.min(i.end.column-i.start.column,Math.max(1,d.length-i.start.column+1)):1),p=" ".repeat(c.length+3+i.start.column-1);return`${o}
3
- ${c} | ${d}
4
- ${p}${"^".repeat(s)}`}).join(`
1
+ import{a as v}from"./chunk-EPGBNDYU.js";import{a as d,b as h,d as w,e as x,f as I,j as y,k as E,l as k,r as _}from"./chunk-7TMADY2E.js";import{a as l,b,c as g,d as B,e as F}from"./chunk-BDIXNUQ3.js";import{createHostContextProvider as J,createHost as Y,defaultRuntime as X}from"@manifesto-ai/host";import{extractDefaults as Q}from"@manifesto-ai/core";import{semanticPathToPatchPath as K}from"@manifesto-ai/core";function U(e){return typeof e=="object"&&e!==null&&"key"in e&&"into"in e}function N(e,t){if(U(e))return{patches:[{op:"set",path:L(e.into),value:q(e.key)}]};let{path:n,target:a}=e,o=W(n,t);return a?{patches:[{op:"set",path:L(a),value:o.value}]}:{patches:[]}}function q(e){switch(e){case"uuid":return y();case"timestamp":case"time.now":return Date.now();case"isoTimestamp":return new Date().toISOString();default:return null}}function L(e){let t=H(e),n=t.startsWith("data.")?t.slice(5):t;return K(n)}function H(e){return e.startsWith("/")?e.slice(1).replace(/\//g,"."):e}function W(e,t){let a=H(e).split(".");if(a.length===0)return{value:void 0,found:!1};let[o,...i]=a,r;switch(o){case"data":r=t.data;break;case"computed":r=t.computed;break;case"system":r=t.system;break;case"meta":r=t.meta;break;default:r=t.data,i.unshift(o);break}for(let s of i){if(r==null||typeof r!="object")return{value:void 0,found:!1};r=r[s]}return{value:r,found:r!==void 0}}var u="system.get",j="system.",$=Object.freeze({__baseLaws:!0});function P(e,t,n){let a=X,o=Y(e,{initialData:Q(e.state),runtime:a}),i=J(a);o.registerEffect(u,async(r,s,m)=>{let{patches:c}=N(s,m.snapshot);return c});for(let[r,s]of Object.entries(n)){let m=async(c,f,p)=>await s(f,{snapshot:I(x(p.snapshot,t))});o.registerEffect(r,m)}return{host:o,contextProvider:i}}import{createIntent as Z}from"@manifesto-ai/core";function M(){return(e,...t)=>{let n=e,a=y(),o=ee(n,t);return Z(String(e.name),o,a)}}function ee(e,t){let n=Object.hasOwn(e,d)?e[d]:[];if(t.length!==0){if(n===null){if(t.length===1&&S(t[0]))return t[0];throw new l("INVALID_INTENT_ARGS",`Action "${String(e.name)}" requires a single object argument because positional parameter metadata is unavailable`)}if(n.length===0){if(t.length===1)return t[0];throw new l("INVALID_INTENT_ARGS",`Action "${String(e.name)}" does not accept multiple positional arguments`)}return n.length===1&&t.length===1&&S(t[0])&&e[h]?{[n[0]??"arg0"]:t[0]}:n.length===1&&t.length===1&&te(t[0],n[0])||t.length===1&&S(t[0])&&n.length>1?t[0]:Object.fromEntries(t.map((a,o)=>[n[o]??`arg${o}`,a]))}}function S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function te(e,t){if(!t||!S(e))return!1;let n=Object.keys(e);return n.length===1&&n[0]===t}import{hashSchemaSync as ce}from"@manifesto-ai/core";import{compileMelDomain as ne,parse as ae,tokenize as re}from"@manifesto-ai/compiler";function V(e){let t=ne(e,{mode:"domain"});if(t.errors.length>0){let a=t.errors.map(o=>{let i=o.location;if(!i||i.start.line===0&&i.start.column===0)return`[${o.code}] ${o.message}`;let r=`[${o.code}] ${o.message} (${i.start.line}:${i.start.column})`,s=e.split(`
2
+ `)[i.start.line-1];if(!s)return r;let m=String(i.start.line).padStart(4," "),c=Math.max(1,i.end.line===i.start.line?Math.min(i.end.column-i.start.column,Math.max(1,s.length-i.start.column+1)):1),f=" ".repeat(m.length+3+i.start.column-1);return`${r}
3
+ ${m} | ${s}
4
+ ${f}${"^".repeat(c)}`}).join(`
5
5
 
6
- `);throw new j(t.errors,`MEL compilation failed:
7
- ${a}`)}if(!t.schema)throw new l("COMPILE_ERROR","MEL compilation produced no schema");let n=t.schema;return{schema:n,actionParamMetadata:O(n,Te(e)),actionSingleParamObjectValueMetadata:w(n)}}function O(e,t){return Object.freeze(Object.fromEntries(Object.entries(e.actions).map(([n,a])=>{let r=t?.[n];if(r&&r.length>0)return[n,Object.freeze([...r])];if(a.params&&a.params.length>0){let o=Object.freeze([...a.params]);return[n,o]}if(!a.input||a.input.type!=="object"||!a.input.fields)return[n,[]];let i=Ee(a.input);return[n,i.length<=1?i:null]})))}function w(e){return Object.freeze(Object.fromEntries(Object.entries(e.actions).map(([t,n])=>[t,ge(e,n)])))}function Ee(e){return!e||e.type!=="object"||!e.fields?[]:Object.keys(e.fields)}function ge(e,t){if(t.params?.length===1&&t.inputType){let n=x(t.inputType,t.params[0]??"",e.types);return n?C(n,e.types):!1}if(t.input?.type==="object"&&t.input.fields&&Object.keys(t.input.fields).length===1){let[n]=Object.keys(t.input.fields);return(n?t.input.fields[n]:void 0)?.type==="object"}return!1}function x(e,t,n,a=[]){if(e.kind==="ref"){if(a.includes(e.name))return null;let r=n[e.name];return r?x(r.definition,t,n,[...a,e.name]):null}if(e.kind==="union"){let r=e.types.filter(i=>!v(i,n,a));return r.length===1?x(r[0],t,n,a):null}return e.kind!=="object"?null:e.fields[t]?.type??null}function C(e,t,n=[]){if(e.kind==="ref"){if(n.includes(e.name))return!1;let a=t[e.name];return a?C(a.definition,t,[...n,e.name]):!1}if(e.kind==="union"){let a=e.types.filter(r=>!v(r,t,n));return a.length===1?C(a[0],t,n):!1}return e.kind==="object"||e.kind==="record"||e.kind==="primitive"&&e.type==="object"}function v(e,t,n=[]){if(e.kind==="ref"){if(n.includes(e.name))return!1;let a=t[e.name];return a?v(a.definition,t,[...n,e.name]):!1}return e.kind==="primitive"&&e.type==="null"||e.kind==="literal"&&e.value===null}function Te(e){let t=be(e);if(t.diagnostics.some(a=>a.severity==="error"))return;let n=Se(t.tokens);if(n.program)return Object.freeze(Object.fromEntries(n.program.domain.members.filter(a=>a.kind==="action").map(a=>[a.name,Object.freeze(a.params.map(r=>r.name))])))}function ee(e){if(typeof e!="string"&&je(e))throw new l("SCHEMA_ERROR","DomainModule is a compiler tooling artifact. Pass module.schema or MEL source to createManifesto().");let t=typeof e=="string"?Z(e):{schema:e,actionParamMetadata:O(e),actionSingleParamObjectValueMetadata:w(e)},n=Ae(t.schema);return Me(n),{schema:n,actionParamMetadata:t.actionParamMetadata,actionSingleParamObjectValueMetadata:t.actionSingleParamObjectValueMetadata,projectionPlan:L(n)}}function je(e){return typeof e=="object"&&e!==null&&"schema"in e&&"graph"in e&&"annotations"in e}function Ae(e){let t={...e.state.fields},n=!1;if(!t.$host)t.$host={type:"object",required:!1,default:{}},n=!0;else{if(t.$host.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$host' must be an object field");t.$host.default===void 0&&(t.$host={...t.$host,default:{}},n=!0)}if(!t.$mel)t.$mel={type:"object",required:!1,default:{guards:{intent:{}}},fields:{guards:{type:"object",required:!1,default:{intent:{}},fields:{intent:{type:"object",required:!1,default:{}}}}}},n=!0;else{if(t.$mel.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel' must be an object field");{let o=t.$mel;o.default===void 0&&(o={...o,default:{guards:{intent:{}}}},n=!0);let d=o.fields??{},c=d.guards;if(!c)o={...o,fields:{...d,guards:{type:"object",required:!1,default:{intent:{}},fields:{intent:{type:"object",required:!1,default:{}}}}}},n=!0;else{if(c.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel.guards' must be an object field");{let s=c;s.default===void 0&&(s={...s,default:{intent:{}}},n=!0);let p=s.fields??{},m=p.intent;if(!m)s={...s,fields:{...p,intent:{type:"object",required:!1,default:{}}}},n=!0;else{if(m.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel.guards.intent' must be an object field");m.default===void 0&&(s={...s,fields:{...p,intent:{...m,default:{}}}},n=!0)}s!==c&&(o={...o,fields:{...d,guards:s}})}}o!==t.$mel&&(t.$mel=o)}}if(!n)return e;let a={...e,state:{...e.state,fields:t}},{hash:r,...i}=a;return{...a,hash:Re(i)}}function Me(e){for(let t of Object.keys(e.actions??{}))if(t.startsWith(P))throw new l("RESERVED_NAMESPACE",`Action type "${t}" uses reserved namespace prefix "${P}"`)}function _(e,t,n){let a=Object.fromEntries(Object.keys(e.actions).map(o=>{let d={__kind:"ActionRef",name:o};return Object.defineProperty(d,y,{enumerable:!1,configurable:!1,writable:!1,value:Object.hasOwn(t,o)?t[o]:[]}),Object.defineProperty(d,b,{enumerable:!1,configurable:!1,writable:!1,value:n[o]??!1}),[o,Object.freeze(d)]})),r=Object.fromEntries(Object.keys(e.state.fields).filter(o=>!o.startsWith("$")).map(o=>[o,Object.freeze({__kind:"FieldRef",name:o})])),i=Object.fromEntries(Object.keys(e.computed.fields).map(o=>[o,Object.freeze({__kind:"ComputedRef",name:o})]));return Object.freeze({actions:Object.freeze(a),state:Object.freeze(r),computed:Object.freeze(i)})}function te(e,t){if(S in t)throw new R(S);let n=ee(e),a={_laws:Q,schema:n.schema,activate(){K(a);let r=D(n.schema,n.projectionPlan,t);return W(A({schema:n.schema,projectionPlan:n.projectionPlan,host:r.host,hostContextProvider:r.contextProvider,MEL:_(n.schema,n.actionParamMetadata,n.actionSingleParamObjectValueMetadata),createIntent:I()}))}};return G(a,()=>{let r=D(n.schema,n.projectionPlan,t);return A({schema:n.schema,projectionPlan:n.projectionPlan,host:r.host,hostContextProvider:r.contextProvider,MEL:_(n.schema,n.actionParamMetadata,n.actionSingleParamObjectValueMetadata),createIntent:I()})})}import{createSnapshot as Tt}from"@manifesto-ai/core";export{ne as AlreadyActivatedError,j as CompileError,h as DisposedError,l as ManifestoError,R as ReservedEffectError,te as createManifesto,Tt as createSnapshot};
6
+ `);throw new g(t.errors,`MEL compilation failed:
7
+ ${a}`)}if(!t.schema)throw new l("COMPILE_ERROR","MEL compilation produced no schema");let n=t.schema;return{schema:n,actionParamMetadata:O(n,se(e)),actionSingleParamObjectValueMetadata:T(n)}}function O(e,t){return Object.freeze(Object.fromEntries(Object.entries(e.actions).map(([n,a])=>{let o=t?.[n];if(o&&o.length>0)return[n,Object.freeze([...o])];if(a.params&&a.params.length>0){let r=Object.freeze([...a.params]);return[n,r]}if(!a.input||a.input.type!=="object"||!a.input.fields)return[n,[]];let i=oe(a.input);return[n,i.length<=1?i:null]})))}function T(e){return Object.freeze(Object.fromEntries(Object.entries(e.actions).map(([t,n])=>[t,ie(e,n)])))}function oe(e){return!e||e.type!=="object"||!e.fields?[]:Object.keys(e.fields)}function ie(e,t){if(t.params?.length===1&&t.inputType){let n=A(t.inputType,t.params[0]??"",e.types);return n?R(n,e.types):!1}if(t.input?.type==="object"&&t.input.fields&&Object.keys(t.input.fields).length===1){let[n]=Object.keys(t.input.fields);return(n?t.input.fields[n]:void 0)?.type==="object"}return!1}function A(e,t,n,a=[]){if(e.kind==="ref"){if(a.includes(e.name))return null;let o=n[e.name];return o?A(o.definition,t,n,[...a,e.name]):null}if(e.kind==="union"){let o=e.types.filter(i=>!C(i,n,a));return o.length===1?A(o[0],t,n,a):null}return e.kind!=="object"?null:e.fields[t]?.type??null}function R(e,t,n=[]){if(e.kind==="ref"){if(n.includes(e.name))return!1;let a=t[e.name];return a?R(a.definition,t,[...n,e.name]):!1}if(e.kind==="union"){let a=e.types.filter(o=>!C(o,t,n));return a.length===1?R(a[0],t,n):!1}return e.kind==="object"||e.kind==="record"||e.kind==="primitive"&&e.type==="object"}function C(e,t,n=[]){if(e.kind==="ref"){if(n.includes(e.name))return!1;let a=t[e.name];return a?C(a.definition,t,[...n,e.name]):!1}return e.kind==="primitive"&&e.type==="null"||e.kind==="literal"&&e.value===null}function se(e){let t=re(e);if(t.diagnostics.some(a=>a.severity==="error"))return;let n=ae(t.tokens);if(n.program)return Object.freeze(Object.fromEntries(n.program.domain.members.filter(a=>a.kind==="action").map(a=>[a.name,Object.freeze(a.params.map(o=>o.name))])))}function G(e){if(typeof e!="string"&&le(e))throw new l("SCHEMA_ERROR","DomainModule is a compiler tooling artifact. Pass module.schema or MEL source to createManifesto().");let t=typeof e=="string"?V(e):{schema:e,actionParamMetadata:O(e),actionSingleParamObjectValueMetadata:T(e)},n=me(t.schema);return fe(n),{schema:n,actionParamMetadata:t.actionParamMetadata,actionSingleParamObjectValueMetadata:t.actionSingleParamObjectValueMetadata,projectionPlan:w(n)}}function le(e){return typeof e=="object"&&e!==null&&"schema"in e&&"graph"in e&&"annotations"in e}function me(e){let t={...e.state.fields},n=!1;if(!t.$host)t.$host={type:"object",required:!1,default:{}},n=!0;else{if(t.$host.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$host' must be an object field");t.$host.default===void 0&&(t.$host={...t.$host,default:{}},n=!0)}if(!t.$mel)t.$mel={type:"object",required:!1,default:{guards:{intent:{}}},fields:{guards:{type:"object",required:!1,default:{intent:{}},fields:{intent:{type:"object",required:!1,default:{}}}}}},n=!0;else{if(t.$mel.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel' must be an object field");{let r=t.$mel;r.default===void 0&&(r={...r,default:{guards:{intent:{}}}},n=!0);let s=r.fields??{},m=s.guards;if(!m)r={...r,fields:{...s,guards:{type:"object",required:!1,default:{intent:{}},fields:{intent:{type:"object",required:!1,default:{}}}}}},n=!0;else{if(m.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel.guards' must be an object field");{let c=m;c.default===void 0&&(c={...c,default:{intent:{}}},n=!0);let f=c.fields??{},p=f.intent;if(!p)c={...c,fields:{...f,intent:{type:"object",required:!1,default:{}}}},n=!0;else{if(p.type!=="object")throw new l("SCHEMA_ERROR","Reserved namespace '$mel.guards.intent' must be an object field");p.default===void 0&&(c={...c,fields:{...f,intent:{...p,default:{}}}},n=!0)}c!==m&&(r={...r,fields:{...s,guards:c}})}}r!==t.$mel&&(t.$mel=r)}}if(!n)return e;let a={...e,state:{...e.state,fields:t}},{hash:o,...i}=a;return{...a,hash:ce(i)}}function fe(e){for(let t of Object.keys(e.actions??{}))if(t.startsWith(j))throw new l("RESERVED_NAMESPACE",`Action type "${t}" uses reserved namespace prefix "${j}"`)}function D(e,t,n){let a=Object.fromEntries(Object.keys(e.actions).map(r=>{let s={__kind:"ActionRef",name:r};return Object.defineProperty(s,d,{enumerable:!1,configurable:!1,writable:!1,value:Object.hasOwn(t,r)?t[r]:[]}),Object.defineProperty(s,h,{enumerable:!1,configurable:!1,writable:!1,value:n[r]??!1}),[r,Object.freeze(s)]})),o=Object.fromEntries(Object.keys(e.state.fields).filter(r=>!r.startsWith("$")).map(r=>[r,Object.freeze({__kind:"FieldRef",name:r})])),i=Object.fromEntries(Object.keys(e.computed.fields).map(r=>[r,Object.freeze({__kind:"ComputedRef",name:r})]));return Object.freeze({actions:Object.freeze(a),state:Object.freeze(o),computed:Object.freeze(i)})}function z(e,t){if(u in t)throw new b(u);let n=G(e),a={_laws:$,schema:n.schema,activate(){_(a);let o=P(n.schema,n.projectionPlan,t);return v(E({schema:n.schema,projectionPlan:n.projectionPlan,host:o.host,hostContextProvider:o.contextProvider,MEL:D(n.schema,n.actionParamMetadata,n.actionSingleParamObjectValueMetadata),createIntent:M()}))}};return k(a,()=>{let o=P(n.schema,n.projectionPlan,t);return E({schema:n.schema,projectionPlan:n.projectionPlan,host:o.host,hostContextProvider:o.contextProvider,MEL:D(n.schema,n.actionParamMetadata,n.actionSingleParamObjectValueMetadata),createIntent:M()})})}import{createSnapshot as et}from"@manifesto-ai/core";export{F as AlreadyActivatedError,g as CompileError,B as DisposedError,l as ManifestoError,b as ReservedEffectError,z as createManifesto,et as createSnapshot};
@@ -5,3 +5,4 @@
5
5
  */
6
6
  export type { ActivationState, GovernanceRuntimeKernel, GovernanceRuntimeKernelFactory, HostDispatchOptions, LineageRuntimeKernel, LineageRuntimeKernelFactory, RuntimeKernel, RuntimeKernelFactory, SimulateResult, WaitForProposalRuntimeKernel, } from "./compat/internal.js";
7
7
  export { activateComposable, assertComposableNotActivated, attachExtensionKernel, attachRuntimeKernelFactory, createRuntimeKernel, getActivationState, getRuntimeKernelFactory, } from "./compat/internal.js";
8
+ export { createBaseRuntimeInstance } from "./runtime/base-runtime.js";
package/dist/provider.js CHANGED
@@ -1 +1 @@
1
- import{k as e,l as t,m as n,n as a,p as r,q as o,r as i}from"./chunk-5BUS6Q4E.js";import"./chunk-BDIXNUQ3.js";export{i as activateComposable,o as assertComposableNotActivated,a as attachExtensionKernel,t as attachRuntimeKernelFactory,e as createRuntimeKernel,r as getActivationState,n as getRuntimeKernelFactory};
1
+ import{a as c}from"./chunk-EPGBNDYU.js";import{k as e,l as t,m as n,n as a,p as r,q as o,r as i}from"./chunk-7TMADY2E.js";import"./chunk-BDIXNUQ3.js";export{i as activateComposable,o as assertComposableNotActivated,a as attachExtensionKernel,t as attachRuntimeKernelFactory,c as createBaseRuntimeInstance,e as createRuntimeKernel,r as getActivationState,n as getRuntimeKernelFactory};
@@ -1,6 +1,6 @@
1
1
  import type { ComputeStatus, Patch, Requirement, Snapshot as CoreSnapshot, SystemDelta } from "@manifesto-ai/core";
2
2
  import type { HostResult } from "@manifesto-ai/host";
3
- import type { DispatchBlocker, CanonicalSnapshot, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, IntentAdmission, IntentExplanation, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, Snapshot, TypedIntent, TypedOn, TypedSubscribe } from "../types.js";
3
+ import type { DispatchBlocker, CanonicalSnapshot, ExecutionDiagnostics, ExecutionFailureInfo, ExecutionOutcome, IntentAdmission, IntentExplanation, ManifestoDomainShape, ManifestoEvent, ManifestoEventMap, SimulationDiagnostics, Snapshot, TypedIntent, TypedOn, TypedSubscribe } from "../types.js";
4
4
  import type { ManifestoError } from "../errors.js";
5
5
  export interface RuntimeStateStore<T extends ManifestoDomainShape> {
6
6
  readonly subscribe: TypedSubscribe<T>;
@@ -47,6 +47,7 @@ export type RuntimeSimulationResult<T extends ManifestoDomainShape = ManifestoDo
47
47
  readonly systemDelta: Readonly<SystemDelta>;
48
48
  readonly status: ComputeStatus;
49
49
  readonly requirements: readonly Requirement[];
50
+ readonly diagnostics?: SimulationDiagnostics;
50
51
  };
51
52
  export type RuntimeSimulateSync<T extends ManifestoDomainShape = ManifestoDomainShape> = (snapshot: CanonicalSnapshot<T["state"]>, intent: TypedIntent<T>) => RuntimeSimulationResult<T>;
52
53
  export interface RuntimeAdmission<T extends ManifestoDomainShape> {
package/dist/types.d.ts CHANGED
@@ -83,6 +83,10 @@ export type SimulateResult<T extends ManifestoDomainShape = ManifestoDomainShape
83
83
  readonly newAvailableActions: readonly (keyof T["actions"])[];
84
84
  readonly requirements: readonly Requirement[];
85
85
  readonly status: ComputeStatus;
86
+ readonly diagnostics?: SimulationDiagnostics;
87
+ };
88
+ export type SimulationDiagnostics = {
89
+ readonly trace: TraceGraph;
86
90
  };
87
91
  export type InvalidInputInfo = {
88
92
  readonly code: "INVALID_INPUT";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifesto-ai/sdk",
3
- "version": "3.15.0",
3
+ "version": "3.17.0",
4
4
  "description": "Manifesto SDK - Activation-first public API for the base runtime",
5
5
  "author": "eggplantiny <eggplantiny@gmail.com>",
6
6
  "license": "MIT",
@@ -47,8 +47,8 @@
47
47
  "dist"
48
48
  ],
49
49
  "dependencies": {
50
- "@manifesto-ai/core": "2.12.0",
51
50
  "@manifesto-ai/compiler": "3.7.0",
51
+ "@manifesto-ai/core": "2.12.0",
52
52
  "@manifesto-ai/host": "2.9.0"
53
53
  },
54
54
  "devDependencies": {
@@ -1 +0,0 @@
1
- import{a as R,e as H}from"./chunk-BDIXNUQ3.js";import{getAvailableActions as Ge,isActionAvailable as ze,isIntentDispatchable as Be}from"@manifesto-ai/core";import{extractSchemaGraph as He}from"@manifesto-ai/compiler";var ve=new Set(["$item","$index","$array"]);function qe(e){let t=e.computed.fields,n=new Map;function a(r,u){let i=n.get(r);if(i!==void 0)return i;if(u.has(r))return!1;u.add(r);let c=t[r];if(!c)return u.delete(r),n.set(r,!0),!0;for(let s of je(c.expr)){if(ge(s))return u.delete(r),n.set(r,!1),!1;let l=Me(s,t);if(l!==null&&!a(l,u))return u.delete(r),n.set(r,!1),!1}return u.delete(r),n.set(r,!0),!0}return{visibleComputedKeys:Object.keys(t).filter(r=>a(r,new Set))}}function V(e,t){return{data:xe(e.data),computed:Ae(e.computed,t),system:{status:e.system.status,lastError:e.system.lastError},meta:{schemaHash:e.meta.schemaHash}}}function $e(e,t){return V(e,t)}function x(e){return Z(structuredClone(e))}function Q(e,t){return ke(e,t)}function xe(e){if(e==null)return e;if(Array.isArray(e)||typeof e!="object")return structuredClone(e);let t={};for(let[n,a]of Object.entries(e))n.startsWith("$")||(t[n]=a);return structuredClone(t)}function Ae(e,t){let n={};for(let a of t.visibleComputedKeys)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return structuredClone(n)}function Me(e,t){if(Object.prototype.hasOwnProperty.call(t,e))return e;if(!e.startsWith("computed."))return null;let n=e.slice(9);return Object.prototype.hasOwnProperty.call(t,n)?n:null}function Ce(e){return e.startsWith("/")?e.slice(1).replace(/\//g,"."):e}function ge(e){let t=Ce(e),n=t.startsWith("data.")?t.slice(5):t,o=/^([^.[\]]+)/.exec(n)?.[1]??"";return o.startsWith("$")?!ve.has(o):!1}function je(e){let t=[],n=new WeakSet,a=o=>{if(o==null)return;if(Array.isArray(o)){o.forEach(a);return}if(typeof o!="object")return;let r=o;if(!n.has(r)&&(n.add(r),r.kind!=="lit")){if(r.kind==="get"&&typeof r.path=="string"){t.push(r.path);return}for(let u of Object.values(r))a(u)}};return a(e),t}function ke(e,t){return O(e,t,new WeakMap)}function O(e,t,n){if(Object.is(e,t))return!0;if(typeof e!=typeof t)return!1;if(e===null||t===null)return e===t;if(typeof e!="object"||typeof t!="object")return!1;let a=e,o=t,r=Object.prototype.toString.call(a),u=Object.prototype.toString.call(o);if(r!==u)return!1;let i=n.get(a);if(i?.has(o))return!0;if(i||(i=new WeakSet,n.set(a,i)),i.add(o),Array.isArray(a)&&Array.isArray(o)){if(a.length!==o.length)return!1;for(let l=0;l<a.length;l+=1){let h=Object.prototype.hasOwnProperty.call(a,l),f=Object.prototype.hasOwnProperty.call(o,l);if(h!==f||h&&!O(a[l],o[l],n))return!1}return!0}if(a instanceof Date&&o instanceof Date)return a.getTime()===o.getTime();if(a instanceof RegExp&&o instanceof RegExp)return a.source===o.source&&a.flags===o.flags;if(ArrayBuffer.isView(a)&&ArrayBuffer.isView(o)){if(a.constructor!==o.constructor||a.byteLength!==o.byteLength)return!1;let l=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),h=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);return l.every((f,S)=>f===h[S])}if(a instanceof ArrayBuffer&&o instanceof ArrayBuffer){if(a.byteLength!==o.byteLength)return!1;let l=new Uint8Array(a),h=new Uint8Array(o);return l.every((f,S)=>f===h[S])}if(a instanceof Map&&o instanceof Map){if(a.size!==o.size)return!1;let l=Array.from(a.entries()),h=Array.from(o.entries());return l.every(([f,S],b)=>{let v=h[b];if(!v)return!1;let[A,j]=v;return O(f,A,n)&&O(S,j,n)})}if(a instanceof Set&&o instanceof Set){if(a.size!==o.size)return!1;let l=Array.from(a.values()),h=Array.from(o.values());return l.every((f,S)=>O(f,h[S],n))}let c=J(a),s=J(o);if(c.length!==s.length)return!1;for(let l=0;l<c.length;l+=1){let h=c[l],f=s[l];if(h!==f)return!1;let S=a[h],b=o[f];if(!O(S,b,n))return!1}return!0}function J(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort()}function Z(e,t=new WeakSet){if(e==null||typeof e!="object")return e;if(Y(e))return ee(e);let n=e;if(t.has(n)||Object.isFrozen(e))return e;t.add(n);for(let a of Reflect.ownKeys(n)){let o=n[a];if(Y(o)){Oe(n,a,o);continue}Z(o,t)}return Object.freeze(e)}function Y(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function ee(e){return structuredClone(e)}function Oe(e,t,n){let a=Object.getOwnPropertyDescriptor(e,t);!a||!("value"in a)||Object.defineProperty(e,t,{enumerable:a.enumerable??!0,configurable:!1,get(){return ee(n)}})}var U=Symbol("manifesto-sdk.action-param-names"),De=Symbol("manifesto-sdk.action-single-param-object-value"),z=Symbol("manifesto-sdk.runtime-kernel-factory"),L=Symbol("manifesto-sdk.activation-state"),k=Symbol("manifesto-sdk.extension-kernel");var we=/^(state|computed|action):.+$/;function q(e){let t=new Set(e.nodes.map(i=>i.id)),n=new Map,a=new Map,o=(i,c,s)=>{let l=i.get(c);if(l){l.add(s);return}i.set(c,new Set([s]))};for(let i of e.edges)o(n,i.from,i.to),o(a,i.to,i.from);let r=i=>{let c=Object.freeze({nodes:Object.freeze(e.nodes.filter(s=>i.has(s.id))),edges:Object.freeze(e.edges.filter(s=>i.has(s.from)&&i.has(s.to)))});return q(c)},u=(i,c)=>{let s=Ne(i,t),l=[s],h=new Set([s]),f=c==="incoming"?a:n;for(;l.length>0;){let S=l.shift();if(S)for(let b of f.get(S)??[])h.has(b)||(h.add(b),l.push(b))}return r(h)};return Object.freeze({nodes:e.nodes,edges:e.edges,traceUp(i){return u(i,"incoming")},traceDown(i){return u(i,"outgoing")}})}function Ne(e,t){if(typeof e=="string"){if(!we.test(e))throw new R("SCHEMA_ERROR",'SchemaGraph node id must use "state:<name>", "computed:<name>", or "action:<name>"');if(!t.has(e))throw new R("SCHEMA_ERROR",`Unknown SchemaGraph node id "${e}"`);return e}let n;switch(e.__kind){case"ActionRef":n=`action:${String(e.name)}`;break;case"FieldRef":n=`state:${e.name}`;break;case"ComputedRef":n=`computed:${e.name}`;break;default:throw new R("SCHEMA_ERROR","Unsupported SchemaGraph ref lookup target")}if(!t.has(n))throw new R("SCHEMA_ERROR",`SchemaGraph node "${n}" is not part of the projected graph`);return n}import{validateIntentInput as Le}from"@manifesto-ai/core";function te(e,t,n){let a={intentId:t.intentId??"",intent:t,code:n.code,reason:n.message};return e("dispatch:rejected",a),a}function ne(e,t,n,a){e("dispatch:failed",{intentId:t.intentId??"",intent:t,error:n,...a!==void 0?{snapshot:a}:{}})}function ae(e,t,n){e("dispatch:completed",{intentId:t.intentId??"",intent:t,snapshot:n})}function ie({getAvailableActionsFor:e,projectSnapshotFromCanonical:t}){function n(u,i){let c=e(u),s=e(i),l=Object.freeze(s.filter(f=>!c.includes(f))),h=Object.freeze(c.filter(f=>!s.includes(f)));return Object.freeze({before:c,after:s,unlocked:l,locked:h})}function a(u,i){let c=x(u),s=x(i),l=t(c),h=t(s);return Object.freeze({projected:Object.freeze({beforeSnapshot:l,afterSnapshot:h,changedPaths:F(l,h),availability:n(c,s)}),canonical:Object.freeze({beforeCanonicalSnapshot:c,afterCanonicalSnapshot:s,pendingRequirements:s.system.pendingRequirements,status:s.system.status})})}function o(u,i){let c=Pe(u),s=c;return Object.freeze({message:c.message,...typeof s.code=="string"?{code:s.code}:{},...typeof c.name=="string"?{name:c.name}:{},stage:i})}function r(u){return Object.freeze({hostTraces:x(u.traces)})}return Object.freeze({deriveExecutionOutcome:a,classifyExecutionFailure:o,createExecutionDiagnostics:r})}function F(e,t){let n=new Set,a=new WeakMap,o=(r,u,i)=>{if(Object.is(r,u))return;if(r===null||u===null){n.add(i);return}if(typeof r!="object"||typeof u!="object"){n.add(i);return}let c=r,s=u,l=a.get(c);if(l?.has(s))return;if(l?l.add(s):a.set(c,new WeakSet([s])),Array.isArray(r)||Array.isArray(u)){if(!Array.isArray(r)||!Array.isArray(u)){n.add(i);return}let f=Math.max(r.length,u.length);for(let S=0;S<f;S+=1){let b=Object.prototype.hasOwnProperty.call(r,S),v=Object.prototype.hasOwnProperty.call(u,S),A=`${i}[${S}]`;if(b!==v){n.add(A);continue}!b&&!v||o(r[S],u[S],A)}return}if(!oe(r)||!oe(u)){n.add(i);return}let h=new Set([...Object.keys(r),...Object.keys(u)]);for(let f of[...h].sort()){let S=Object.prototype.hasOwnProperty.call(r,f),b=Object.prototype.hasOwnProperty.call(u,f),v=`${i}.${f}`;if(S!==b){n.add(v);continue}o(r[f],u[f],v)}};return o(e.data,t.data,"data"),o(e.computed,t.computed,"computed"),o(e.system,t.system,"system"),o(e.meta,t.meta,"meta"),Object.freeze([...n].sort())}function oe(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pe(e){return e instanceof Error?e:new Error(String(e))}function se({schema:e,ensureIntentId:t,getAvailableActionsFor:n,isActionAvailableFor:a,isIntentDispatchableFor:o,projectSnapshotFromCanonical:r,getSimulateSync:u,emitEvent:i}){function c(y,m,p){return Object.freeze({layer:y,expression:m,evaluatedResult:!1,...p!==void 0?{description:p}:{}})}function s(y,m){let p=m.type,d=e.actions[p];return d?a(y,p)?o(y,m)?Object.freeze([]):Object.freeze(d.dispatchable?[c("dispatchable",d.dispatchable,d.description)]:[]):Object.freeze(d.available?[c("available",d.available,d.description)]:[]):Object.freeze([])}function l(y){return new R("ACTION_UNAVAILABLE",`Action "${y.type}" is unavailable against the current visible snapshot`)}function h(y){return new R("INTENT_NOT_DISPATCHABLE",`Action "${y.type}" is available, but the bound intent is not dispatchable against the current visible snapshot`)}function f(y){return new R("INVALID_INPUT",y)}function S(y,m){let p=Le(e,m);return p?f(p):null}function b(y,m){let p=t(m),d=p.type;if(!a(y,d))return{kind:"unavailable",intent:p,actionName:d};let I=S(y,p);if(I)return{kind:"invalid-input",intent:p,actionName:d,error:I};let C=s(y,p);return C.length>0?{kind:"not-dispatchable",intent:p,actionName:d,blockers:C}:{kind:"admitted",intent:p,actionName:d}}function v(y,m){return m.kind==="unavailable"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"unavailable",blockers:s(y,m.intent)}}):m.kind==="invalid-input"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"invalid_input",error:{code:"INVALID_INPUT",message:m.error.message}}}):m.kind==="not-dispatchable"?Object.freeze({kind:"blocked",actionName:m.actionName,failure:{kind:"not_dispatchable",blockers:m.blockers}}):Object.freeze({kind:"admitted",actionName:m.actionName})}function A(y,m){let p=b(y,m);if(p.kind==="unavailable")return Object.freeze({kind:"blocked",actionName:p.actionName,available:!1,dispatchable:!1,blockers:s(y,p.intent)});if(p.kind==="invalid-input")throw p.error;if(p.kind==="not-dispatchable")return Object.freeze({kind:"blocked",actionName:p.actionName,available:!0,dispatchable:!1,blockers:p.blockers});let d=u()(y,p.intent),I=r(y),C=r(d.snapshot);return Object.freeze({kind:"admitted",actionName:p.actionName,available:!0,dispatchable:!0,status:d.status,requirements:d.requirements,canonicalSnapshot:d.snapshot,snapshot:C,newAvailableActions:n(d.snapshot),changedPaths:F(I,C)})}function j(y,m){throw te(i,y,m),m}function D(y){return j(y,l(y))}function w(y,m){return j(y,f(m))}function N(y){return j(y,h(y))}return Object.freeze({getIntentBlockersFor:s,validateIntentInputFor:S,evaluateIntentLegalityFor:b,deriveIntentAdmission:v,explainIntentFor:A,createUnavailableError:l,createNotDispatchableError:h,rejectInvalidInput:w,rejectUnavailable:D,rejectNotDispatchable:N})}function re({setVisibleSnapshot:e,restoreVisibleSnapshot:t,getCanonicalSnapshot:n,emitEvent:a}){function o(i,c){return e(i,c)}function r(i,c){let s=o(c);return ae(a,i,s),Object.freeze({publishedSnapshot:s,publishedCanonicalSnapshot:n()})}function u(i,c,s){let l=o(s);return ne(a,i,c,l),Object.freeze({publishedSnapshot:l,publishedCanonicalSnapshot:n()})}return Object.freeze({replaceVisibleSnapshot:o,restoreVisibleSnapshot:t,publishCompletedHostResult:r,publishFailedHostResult:u})}import{apply as ce,applySystemDelta as Fe,computeSync as Ke}from"@manifesto-ai/core";import{getHostState as _e}from"@manifesto-ai/host";function le({schema:e,hostContextProvider:t,evaluateIntentLegalityFor:n}){function a(i,c,s){let h=_e(i.data)?.intentSlots??{},f=c.input===void 0?{type:c.type}:{type:c.type,input:c.input};return ce(e,i,[{op:"merge",path:[{kind:"prop",name:"$host"}],value:{intentSlots:{...h,[c.intentId]:f}}}],s)}function o(i){return new R("ACTION_UNAVAILABLE",`Action "${i.type}" is unavailable against the provided canonical snapshot`)}function r(i){return new R("INTENT_NOT_DISPATCHABLE",`Action "${i.type}" is available, but the bound intent is not dispatchable against the provided canonical snapshot`)}return Object.freeze({withHostIntentSlot:a,createSimulationUnavailableError:o,createSimulationNotDispatchableError:r,simulateSync:(i,c)=>{let s=n(i,c);if(s.kind==="unavailable")throw o(s.intent);if(s.kind==="invalid-input")throw s.error;if(s.kind==="not-dispatchable")throw r(s.intent);let l=s.intent,h=t.createFrozenContext(l.intentId),f=a(structuredClone(i),l,h),S=Ke(e,f,l,h),b=ce(e,f,S.patches,h),v=Fe(b,S.systemDelta);return Object.freeze({snapshot:x(v),patches:x(S.patches),systemDelta:x(S.systemDelta),status:S.status,requirements:x(S.systemDelta.addRequirements)})}})}function pe({host:e,initialCanonicalSnapshot:t,projectSnapshotFromCanonical:n}){let a=structuredClone(t),o=n(a),r=x(a),u=Promise.resolve(),i=!1,c=new Set,s=new Map;function l(m,p){if(i)return()=>{};let d,I=!1;try{d=m(o),I=!0}catch{d=void 0,I=!1}let C={selector:m,listener:p,lastValue:d,initialized:I};return c.add(C),()=>{c.delete(C)}}function h(m,p){if(i)return()=>{};let d=s.get(m);return d||(d=new Set,s.set(m,d)),d.add(p),()=>{d?.delete(p)}}function f(){return o}function S(){return r}function b(){return structuredClone(a)}function v(m,p){a=structuredClone(m),e.reset(structuredClone(a)),r=x(a);let d=n(a),I=!Q(d,o);return I&&(o=d),p?.notify!==!1&&I&&y(o),o}function A(){e.reset(structuredClone(a))}function j(m,p){let d=s.get(m);if(d)for(let I of d)try{I(p)}catch{}}function D(m){let p=u.catch(()=>{}).then(m);return u=p.then(()=>{},()=>{}),p}function w(){i||(i=!0,c.clear(),s.clear())}function N(){return i}function y(m){for(let p of c){let d;try{d=p.selector(m)}catch{continue}if(!(p.initialized&&Object.is(p.lastValue,d))){p.lastValue=d,p.initialized=!0;try{p.listener(d)}catch{}}}}return{subscribe:l,on:h,getSnapshot:f,getCanonicalSnapshot:S,getVisibleCoreSnapshot:b,setVisibleSnapshot:v,restoreVisibleSnapshot:A,emitEvent:j,enqueue:D,dispose:w,isDisposed:N}}function ue(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Ve(e){if(e.params)return e.params;let t=e.input;return!t||t.type!=="object"||!t.fields?[]:Object.keys(t.fields)}function Ue({schema:e,projectionPlan:t,host:n,hostContextProvider:a,MEL:o,createIntent:r}){let u=n.getSnapshot();if(!u)throw new R("SCHEMA_ERROR","Host failed to initialize its genesis snapshot");function i(T){return x(V(T,t))}let c=pe({host:n,initialCanonicalSnapshot:u,projectSnapshotFromCanonical:i}),{subscribe:s,on:l,getSnapshot:h,getCanonicalSnapshot:f,getVisibleCoreSnapshot:S,setVisibleSnapshot:b,restoreVisibleSnapshot:v,emitEvent:A,enqueue:j,dispose:D,isDisposed:w}=c,N=q(He(e)),y=Object.keys(e.actions),m=Object.freeze(Object.fromEntries(y.map(T=>{let E=e.actions[T],P=o.actions[T]?.[U],Ie=Object.freeze(Array.isArray(P)?[...P]:Ve(E));return[T,Object.freeze({name:T,params:Ie,input:E.input,description:E.description,hasDispatchableGate:E.dispatchable!==void 0})]}))),p=Object.freeze(y.map(T=>m[T]));function d(T){return Object.freeze([...Ge(e,T)])}let I=ie({getAvailableActionsFor:d,projectSnapshotFromCanonical:i});function C(){return d(f())}let me=(T=>T!==void 0?m[String(T)]:p);function K(T,E){return ze(e,T,String(E))}function he(T){return K(f(),T)}function _(T,E){return Be(e,T,E)}let ye=((T,...E)=>_(f(),r(T,...E)));function $(T){return T.intentId&&T.intentId.length>0?T:{...T,intentId:ue()}}async function Se(T,E){return n.dispatch(T,E)}let B=null,M=se({schema:e,ensureIntentId:$,getAvailableActionsFor:d,isActionAvailableFor:K,isIntentDispatchableFor:_,projectSnapshotFromCanonical:i,getSimulateSync:()=>{if(!B)throw new R("SCHEMA_ERROR","Runtime simulation surface is not initialized");return B},emitEvent:A}),G=le({schema:e,hostContextProvider:a,evaluateIntentLegalityFor:M.evaluateIntentLegalityFor});B=G.simulateSync;let W=re({setVisibleSnapshot:b,restoreVisibleSnapshot:v,getCanonicalSnapshot:f,emitEvent:A}),X=M.getIntentBlockersFor,Te=((T,...E)=>X(f(),r(T,...E))),be=G.simulateSync,Re=((T,...E)=>{let g=G.simulateSync(f(),r(T,...E)),P=i(g.snapshot);return Object.freeze({snapshot:P,changedPaths:F(h(),P),newAvailableActions:d(g.snapshot),requirements:g.requirements,status:g.status})}),Ee=Object.freeze({MEL:o,schema:e,createIntent:r,getCanonicalSnapshot:f,projectSnapshot:T=>i(T),simulateSync:(T,E)=>{let g=G.simulateSync(T,E);return Object.freeze({snapshot:g.snapshot,patches:g.patches,requirements:g.requirements,status:g.status})},getAvailableActionsFor:d,isActionAvailableFor:K,isIntentDispatchableFor:_,explainIntentFor:M.explainIntentFor});return{schema:e,MEL:o,createIntent:r,subscribe:s,on:l,getSnapshot:h,getAvailableActionsFor:d,getAvailableActions:C,getIntentBlockersFor:X,getActionMetadata:me,isActionAvailableFor:K,isActionAvailable:he,isIntentDispatchableFor:_,isIntentDispatchable:ye,getIntentBlockers:Te,getSchemaGraph(){return N},simulateSync:be,simulate:Re,dispose:D,isDisposed:w,getCanonicalSnapshot:f,getVisibleCoreSnapshot:S,setVisibleSnapshot:W.replaceVisibleSnapshot,restoreVisibleSnapshot:W.restoreVisibleSnapshot,emitEvent:A,enqueue:j,ensureIntentId:$,executeHost:Se,validateIntentInputFor:M.validateIntentInputFor,evaluateIntentLegalityFor:M.evaluateIntentLegalityFor,deriveIntentAdmission:M.deriveIntentAdmission,deriveExecutionOutcome:I.deriveExecutionOutcome,classifyExecutionFailure:I.classifyExecutionFailure,createExecutionDiagnostics:I.createExecutionDiagnostics,createUnavailableError:M.createUnavailableError,createNotDispatchableError:M.createNotDispatchableError,rejectInvalidInput:M.rejectInvalidInput,rejectUnavailable:M.rejectUnavailable,rejectNotDispatchable:M.rejectNotDispatchable,[k]:Ee}}function Nt(e,t,n){Object.defineProperty(e,z,{enumerable:!1,configurable:!1,writable:!1,value:t});let a=n??de(e)??{activated:!1};return de(e)||Object.defineProperty(e,L,{enumerable:!1,configurable:!1,writable:!1,value:a}),e}function Pt(e){let n=e[z];if(typeof n!="function")throw new R("SCHEMA_ERROR","ComposableManifesto is missing its runtime kernel factory");return n}function Lt(e,t){return Object.defineProperty(e,k,{enumerable:!1,configurable:!1,writable:!1,value:t[k]}),e}function Ft(e){let n=e[k];if(!n)throw new R("SCHEMA_ERROR","Activated runtime is missing its extension kernel");return n}function fe(e){let n=e[L];if(!n)throw new R("SCHEMA_ERROR","ComposableManifesto is missing its activation state");return n}function Kt(e){if(fe(e).activated)throw new H}function _t(e){let t=fe(e);if(t.activated)throw new H;t.activated=!0}function de(e){return e[L]??null}export{U as a,De as b,k as c,qe as d,$e as e,x as f,te as g,ne as h,re as i,ue as j,Ue as k,Nt as l,Pt as m,Lt as n,Ft as o,fe as p,Kt as q,_t as r};