@manifesto-ai/sdk 3.18.1 → 5.1.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.
Files changed (40) hide show
  1. package/README.md +30 -14
  2. package/dist/chunk-DPFMD6LR.js +1 -0
  3. package/dist/chunk-OW22XF26.js +1 -0
  4. package/dist/chunk-TG2UPPZN.js +1 -0
  5. package/dist/compat/internal.d.ts +5 -84
  6. package/dist/effects.d.ts +2 -2
  7. package/dist/effects.js +1 -1
  8. package/dist/errors.d.ts +4 -0
  9. package/dist/extensions-types.d.ts +7 -5
  10. package/dist/extensions.js +1 -1
  11. package/dist/index.d.ts +13 -2
  12. package/dist/index.js +6 -6
  13. package/dist/manifest/compile-schema.d.ts +3 -1
  14. package/dist/manifest/create-manifesto.d.ts +2 -2
  15. package/dist/manifest/resolve-schema.d.ts +2 -2
  16. package/dist/manifest/shared.d.ts +3 -1
  17. package/dist/manifest.d.ts +1 -1
  18. package/dist/projection/snapshot-projection.d.ts +11 -13
  19. package/dist/provider.d.ts +12 -1
  20. package/dist/provider.js +1 -1
  21. package/dist/runtime/action-payload.d.ts +9 -0
  22. package/dist/runtime/admission-failure.d.ts +16 -0
  23. package/dist/runtime/admission.d.ts +6 -5
  24. package/dist/runtime/base-dispatch.d.ts +12 -10
  25. package/dist/runtime/base-runtime.d.ts +9 -2
  26. package/dist/runtime/context.d.ts +4 -0
  27. package/dist/runtime/facets.d.ts +13 -10
  28. package/dist/runtime/kernel-contract.d.ts +111 -0
  29. package/dist/runtime/kernel.d.ts +1 -1
  30. package/dist/runtime/publication.d.ts +3 -4
  31. package/dist/runtime/reports.d.ts +3 -3
  32. package/dist/runtime/simulation.d.ts +1 -1
  33. package/dist/runtime/state-store.d.ts +1 -1
  34. package/dist/types.d.ts +425 -45
  35. package/package.json +8 -8
  36. package/dist/chunk-BDIXNUQ3.js +0 -1
  37. package/dist/chunk-BSGOCNTO.js +0 -1
  38. package/dist/chunk-JM42OG2H.js +0 -1
  39. package/dist/manifest/system-get.d.ts +0 -4
  40. package/dist/runtime/events.d.ts +0 -7
@@ -1 +0,0 @@
1
- import{a as E,e as B}from"./chunk-BDIXNUQ3.js";import{getAvailableActions as Ue,isActionAvailable as qe,isIntentDispatchable as $e}from"@manifesto-ai/core";import{extractSchemaGraph as We}from"@manifesto-ai/compiler";var ge=new Set(["$item","$index","$array"]);function Ye(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 De(c.expr)){if(Oe(s))return u.delete(r),n.set(r,!1),!1;let l=je(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 H(e,t){return{data:Ce(e.data),computed:Me(e.computed,t),system:{status:e.system.status,lastError:e.system.lastError},meta:{schemaHash:e.meta.schemaHash}}}function Qe(e,t){return H(e,t)}function x(e){return ee(structuredClone(e))}function Z(e,t){return we(e,t)}function Ce(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 Me(e,t){let n={};for(let a of t.visibleComputedKeys)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return structuredClone(n)}function je(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 ke(e){return e.startsWith("/")?e.slice(1).replace(/\//g,"."):e}function Oe(e){let t=ke(e),n=t.startsWith("data.")?t.slice(5):t,o=/^([^.[\]]+)/.exec(n)?.[1]??"";return o.startsWith("$")?!ge.has(o):!1}function De(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 we(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 y=Object.prototype.hasOwnProperty.call(a,l),f=Object.prototype.hasOwnProperty.call(o,l);if(y!==f||y&&!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),y=new Uint8Array(o.buffer,o.byteOffset,o.byteLength);return l.every((f,S)=>f===y[S])}if(a instanceof ArrayBuffer&&o instanceof ArrayBuffer){if(a.byteLength!==o.byteLength)return!1;let l=new Uint8Array(a),y=new Uint8Array(o);return l.every((f,S)=>f===y[S])}if(a instanceof Map&&o instanceof Map){if(a.size!==o.size)return!1;let l=Array.from(a.entries()),y=Array.from(o.entries());return l.every(([f,S],b)=>{let v=y[b];if(!v)return!1;let[A,M]=v;return O(f,A,n)&&O(S,M,n)})}if(a instanceof Set&&o instanceof Set){if(a.size!==o.size)return!1;let l=Array.from(a.values()),y=Array.from(o.values());return l.every((f,S)=>O(f,y[S],n))}let c=Y(a),s=Y(o);if(c.length!==s.length)return!1;for(let l=0;l<c.length;l+=1){let y=c[l],f=s[l];if(y!==f)return!1;let S=a[y],b=o[f];if(!O(S,b,n))return!1}return!0}function Y(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort()}function ee(e,t=new WeakSet){if(e==null||typeof e!="object")return e;if(Q(e))return te(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(Q(o)){Ne(n,a,o);continue}ee(o,t)}return Object.freeze(e)}function Q(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function te(e){return structuredClone(e)}function Ne(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 te(n)}})}var V=Symbol("manifesto-sdk.action-param-names"),Pe=Symbol("manifesto-sdk.action-single-param-object-value"),_=Symbol("manifesto-sdk.runtime-kernel-factory"),P=Symbol("manifesto-sdk.activation-state"),j=Symbol("manifesto-sdk.extension-kernel");var Ke=/^(state|computed|action):.+$/;function U(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 U(c)},u=(i,c)=>{let s=Le(i,t),l=[s],y=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)??[])y.has(b)||(y.add(b),l.push(b))}return r(y)};return Object.freeze({nodes:e.nodes,edges:e.edges,traceUp(i){return u(i,"incoming")},traceDown(i){return u(i,"outgoing")}})}function Le(e,t){if(typeof e=="string"){if(!Ke.test(e))throw new E("SCHEMA_ERROR",'SchemaGraph node id must use "state:<name>", "computed:<name>", or "action:<name>"');if(!t.has(e))throw new E("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 E("SCHEMA_ERROR","Unsupported SchemaGraph ref lookup target")}if(!t.has(n))throw new E("SCHEMA_ERROR",`SchemaGraph node "${n}" is not part of the projected graph`);return n}import{validateIntentInput as Ge}from"@manifesto-ai/core";function ne(e,t,n){let a={intentId:t.intentId??"",intent:t,code:n.code,reason:n.message};return e("dispatch:rejected",a),a}function ae(e,t,n,a){e("dispatch:failed",{intentId:t.intentId??"",intent:t,error:n,...a!==void 0?{snapshot:a}:{}})}function oe(e,t,n){e("dispatch:completed",{intentId:t.intentId??"",intent:t,snapshot:n})}function se({getAvailableActionsFor:e,projectSnapshotFromCanonical:t}){function n(u,i){let c=e(u),s=e(i),l=Object.freeze(s.filter(f=>!c.includes(f))),y=Object.freeze(c.filter(f=>!s.includes(f)));return Object.freeze({before:c,after:s,unlocked:l,locked:y})}function a(u,i){let c=x(u),s=x(i),l=t(c),y=t(s);return Object.freeze({projected:Object.freeze({beforeSnapshot:l,afterSnapshot:y,changedPaths:K(l,y),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=Fe(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 K(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(!ie(r)||!ie(u)){n.add(i);return}let y=new Set([...Object.keys(r),...Object.keys(u)]);for(let f of[...y].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 ie(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fe(e){return e instanceof Error?e:new Error(String(e))}function re({schema:e,ensureIntentId:t,getAvailableActionsFor:n,isActionAvailableFor:a,isIntentDispatchableFor:o,projectSnapshotFromCanonical:r,getSimulateSync:u,emitEvent:i}){function c(T,h,p){return Object.freeze({layer:T,expression:h,evaluatedResult:!1,...p!==void 0?{description:p}:{}})}function s(T,h){let p=h.type,d=e.actions[p];return d?a(T,p)?o(T,h)?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(T){return new E("ACTION_UNAVAILABLE",`Action "${T.type}" is unavailable against the current visible snapshot`)}function y(T){return new E("INTENT_NOT_DISPATCHABLE",`Action "${T.type}" is available, but the bound intent is not dispatchable against the current visible snapshot`)}function f(T){return new E("INVALID_INPUT",T)}function S(T,h){let p=Ge(e,h);return p?f(p):null}function b(T,h){let p=t(h),d=p.type;if(!a(T,d))return{kind:"unavailable",intent:p,actionName:d};let I=S(T,p);if(I)return{kind:"invalid-input",intent:p,actionName:d,error:I};let C=s(T,p);return C.length>0?{kind:"not-dispatchable",intent:p,actionName:d,blockers:C}:{kind:"admitted",intent:p,actionName:d}}function v(T,h){return h.kind==="unavailable"?Object.freeze({kind:"blocked",actionName:h.actionName,failure:{kind:"unavailable",blockers:s(T,h.intent)}}):h.kind==="invalid-input"?Object.freeze({kind:"blocked",actionName:h.actionName,failure:{kind:"invalid_input",error:{code:"INVALID_INPUT",message:h.error.message}}}):h.kind==="not-dispatchable"?Object.freeze({kind:"blocked",actionName:h.actionName,failure:{kind:"not_dispatchable",blockers:h.blockers}}):Object.freeze({kind:"admitted",actionName:h.actionName})}function A(T,h){let p=b(T,h);if(p.kind==="unavailable")return Object.freeze({kind:"blocked",actionName:p.actionName,available:!1,dispatchable:!1,blockers:s(T,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()(T,p.intent),I=r(T),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:K(I,C)})}function M(T,h){throw ne(i,T,h),h}function D(T){return M(T,l(T))}function w(T,h){return M(T,f(h))}function N(T){return M(T,y(T))}return Object.freeze({getIntentBlockersFor:s,validateIntentInputFor:S,evaluateIntentLegalityFor:b,deriveIntentAdmission:v,explainIntentFor:A,createUnavailableError:l,createNotDispatchableError:y,rejectInvalidInput:w,rejectUnavailable:D,rejectNotDispatchable:N})}function ce({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 oe(a,i,s),Object.freeze({publishedSnapshot:s,publishedCanonicalSnapshot:n()})}function u(i,c,s){let l=o(s);return ae(a,i,c,l),Object.freeze({publishedSnapshot:l,publishedCanonicalSnapshot:n()})}return Object.freeze({replaceVisibleSnapshot:o,restoreVisibleSnapshot:t,publishCompletedHostResult:r,publishFailedHostResult:u})}import{apply as le,applySystemDelta as _e,computeSync as ze}from"@manifesto-ai/core";import{getHostState as Be}from"@manifesto-ai/host";function pe(e,t){return{...e,timestamp:t,children:e.children.map(n=>pe(n,t))}}function He(e){let t={};function n(a){t[a.id]=a,a.children.forEach(n)}return n(e),t}function Ve(e,t){let n=pe(e.root,t);return{...e,duration:0,root:n,nodes:He(n)}}function ue({schema:e,hostContextProvider:t,evaluateIntentLegalityFor:n}){function a(i,c,s){let y=Be(i.data)?.intentSlots??{},f=c.input===void 0?{type:c.type}:{type:c.type,input:c.input};return le(e,i,[{op:"merge",path:[{kind:"prop",name:"$host"}],value:{intentSlots:{...y,[c.intentId]:f}}}],s)}function o(i){return new E("ACTION_UNAVAILABLE",`Action "${i.type}" is unavailable against the provided canonical snapshot`)}function r(i){return new E("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,y=t.createFrozenContext(l.intentId),f=a(structuredClone(i),l,y),S=ze(e,f,l,y),b=le(e,f,S.patches,y),v=_e(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),diagnostics:Object.freeze({trace:x(Ve(S.trace,i.meta.timestamp))})})}})}function de({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(h,p){if(i)return()=>{};let d,I=!1;try{d=h(o),I=!0}catch{d=void 0,I=!1}let C={selector:h,listener:p,lastValue:d,initialized:I};return c.add(C),()=>{c.delete(C)}}function y(h,p){if(i)return()=>{};let d=s.get(h);return d||(d=new Set,s.set(h,d)),d.add(p),()=>{d?.delete(p)}}function f(){return o}function S(){return r}function b(){return structuredClone(a)}function v(h,p){a=structuredClone(h),e.reset(structuredClone(a)),r=x(a);let d=n(a),I=!Z(d,o);return I&&(o=d),p?.notify!==!1&&I&&T(o),o}function A(){e.reset(structuredClone(a))}function M(h,p){let d=s.get(h);if(d)for(let I of d)try{I(p)}catch{}}function D(h){let p=u.catch(()=>{}).then(h);return u=p.then(()=>{},()=>{}),p}function w(){i||(i=!0,c.clear(),s.clear())}function N(){return i}function T(h){for(let p of c){let d;try{d=p.selector(h)}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:y,getSnapshot:f,getCanonicalSnapshot:S,getVisibleCoreSnapshot:b,setVisibleSnapshot:v,restoreVisibleSnapshot:A,emitEvent:M,enqueue:D,dispose:w,isDisposed:N}}function fe(){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 Xe(e){if(e.params)return e.params;let t=e.input;return!t||t.type!=="object"||!t.fields?[]:Object.keys(t.fields)}function Je({schema:e,projectionPlan:t,host:n,hostContextProvider:a,MEL:o,createIntent:r}){let u=n.getSnapshot();if(!u)throw new E("SCHEMA_ERROR","Host failed to initialize its genesis snapshot");function i(m){return x(H(m,t))}let c=de({host:n,initialCanonicalSnapshot:u,projectSnapshotFromCanonical:i}),{subscribe:s,on:l,getSnapshot:y,getCanonicalSnapshot:f,getVisibleCoreSnapshot:S,setVisibleSnapshot:b,restoreVisibleSnapshot:v,emitEvent:A,enqueue:M,dispose:D,isDisposed:w}=c,N=U(We(e)),T=Object.keys(e.actions),h=Object.freeze(Object.fromEntries(T.map(m=>{let R=e.actions[m],J=o.actions[m]?.[V],Ae=Object.freeze(Array.isArray(J)?[...J]:Xe(R));return[m,Object.freeze({name:m,params:Ae,input:R.input,description:R.description,hasDispatchableGate:R.dispatchable!==void 0})]}))),p=Object.freeze(T.map(m=>h[m]));function d(m){return Object.freeze([...Ue(e,m)])}let I=se({getAvailableActionsFor:d,projectSnapshotFromCanonical:i});function C(){return d(f())}let ye=(m=>m!==void 0?h[String(m)]:p);function L(m,R){return qe(e,m,String(R))}function Te(m){return L(f(),m)}function F(m,R){return $e(e,m,R)}let Se=((m,...R)=>F(f(),r(m,...R)));function q(m){return m.intentId&&m.intentId.length>0?m:{...m,intentId:fe()}}async function be(m,R){return n.dispatch(m,R)}let z=null,g=re({schema:e,ensureIntentId:q,getAvailableActionsFor:d,isActionAvailableFor:L,isIntentDispatchableFor:F,projectSnapshotFromCanonical:i,getSimulateSync:()=>{if(!z)throw new E("SCHEMA_ERROR","Runtime simulation surface is not initialized");return z},emitEvent:A}),G=ue({schema:e,hostContextProvider:a,evaluateIntentLegalityFor:g.evaluateIntentLegalityFor});z=G.simulateSync;let $=ce({setVisibleSnapshot:b,restoreVisibleSnapshot:v,getCanonicalSnapshot:f,emitEvent:A}),W=g.getIntentBlockersFor,Re=((m,...R)=>W(f(),r(m,...R))),Ee=G.simulateSync;function Ie(m){let R=i(m.snapshot);return Object.freeze({snapshot:R,changedPaths:K(y(),R),newAvailableActions:d(m.snapshot),requirements:m.requirements,status:m.status,diagnostics:m.diagnostics})}let X=(m=>Ie(G.simulateSync(f(),m))),ve=((m,...R)=>X(r(m,...R))),xe=Object.freeze({MEL:o,schema:e,createIntent:r,getCanonicalSnapshot:f,projectSnapshot:m=>i(m),simulateSync:(m,R)=>{let k=G.simulateSync(m,R);return Object.freeze({snapshot:k.snapshot,patches:k.patches,requirements:k.requirements,status:k.status,diagnostics:k.diagnostics})},getAvailableActionsFor:d,isActionAvailableFor:L,isIntentDispatchableFor:F,explainIntentFor:g.explainIntentFor});return{schema:e,MEL:o,createIntent:r,subscribe:s,on:l,getSnapshot:y,getAvailableActionsFor:d,getAvailableActions:C,getIntentBlockersFor:W,getActionMetadata:ye,isActionAvailableFor:L,isActionAvailable:Te,isIntentDispatchableFor:F,isIntentDispatchable:Se,getIntentBlockers:Re,getSchemaGraph(){return N},simulateSync:Ee,simulate:ve,simulateIntent:X,dispose:D,isDisposed:w,getCanonicalSnapshot:f,getVisibleCoreSnapshot:S,setVisibleSnapshot:$.replaceVisibleSnapshot,restoreVisibleSnapshot:$.restoreVisibleSnapshot,emitEvent:A,enqueue:M,ensureIntentId:q,executeHost:be,validateIntentInputFor:g.validateIntentInputFor,evaluateIntentLegalityFor:g.evaluateIntentLegalityFor,deriveIntentAdmission:g.deriveIntentAdmission,deriveExecutionOutcome:I.deriveExecutionOutcome,classifyExecutionFailure:I.classifyExecutionFailure,createExecutionDiagnostics:I.createExecutionDiagnostics,createUnavailableError:g.createUnavailableError,createNotDispatchableError:g.createNotDispatchableError,rejectInvalidInput:g.rejectInvalidInput,rejectUnavailable:g.rejectUnavailable,rejectNotDispatchable:g.rejectNotDispatchable,[j]:xe}}function Gt(e,t,n){Object.defineProperty(e,_,{enumerable:!1,configurable:!1,writable:!1,value:t});let a=n??me(e)??{activated:!1};return me(e)||Object.defineProperty(e,P,{enumerable:!1,configurable:!1,writable:!1,value:a}),e}function _t(e){let n=e[_];if(typeof n!="function")throw new E("SCHEMA_ERROR","ComposableManifesto is missing its runtime kernel factory");return n}function zt(e,t){return Object.defineProperty(e,j,{enumerable:!1,configurable:!1,writable:!1,value:t[j]}),e}function Bt(e){let n=e[j];if(!n)throw new E("SCHEMA_ERROR","Activated runtime is missing its extension kernel");return n}function he(e){let n=e[P];if(!n)throw new E("SCHEMA_ERROR","ComposableManifesto is missing its activation state");return n}function Ht(e){if(he(e).activated)throw new B}function Vt(e){let t=he(e);if(t.activated)throw new B;t.activated=!0}function me(e){return e[P]??null}export{V as a,Pe as b,j as c,Ye as d,Qe as e,x as f,ne as g,ae as h,ce as i,fe as j,Je as k,Gt as l,_t as m,zt as n,Bt as o,he as p,Ht as q,Vt as r};
@@ -1 +0,0 @@
1
- import{c as y,g as S,h as b,i as E,n as I}from"./chunk-BSGOCNTO.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 R(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 R(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 I({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,simulateIntent:t.simulateIntent,MEL:t.MEL,schema:t.schema,dispose:t.dispose},t)}export{F as a};
@@ -1,4 +0,0 @@
1
- import { type Patch, type Snapshot as CoreSnapshot } from "@manifesto-ai/core";
2
- export declare function executeSystemGet(params: unknown, snapshot: CoreSnapshot): {
3
- patches: Patch[];
4
- };
@@ -1,7 +0,0 @@
1
- import { type ManifestoDomainShape, type ManifestoEventMap, type Snapshot, type TypedIntent } from "../types.js";
2
- import { ManifestoError } from "../errors.js";
3
- type RuntimeEmitEvent<T extends ManifestoDomainShape> = <K extends keyof ManifestoEventMap<T>>(event: K, payload: ManifestoEventMap<T>[K]) => void;
4
- export declare function emitDispatchRejectedEvent<T extends ManifestoDomainShape>(emitEvent: RuntimeEmitEvent<T>, intent: TypedIntent<T>, error: ManifestoError): ManifestoEventMap<T>["dispatch:rejected"];
5
- export declare function emitDispatchFailedEvent<T extends ManifestoDomainShape>(emitEvent: RuntimeEmitEvent<T>, intent: TypedIntent<T>, error: Error, snapshot?: Snapshot<T["state"]>): void;
6
- export declare function emitDispatchCompletedEvent<T extends ManifestoDomainShape>(emitEvent: RuntimeEmitEvent<T>, intent: TypedIntent<T>, snapshot: Snapshot<T["state"]>): void;
7
- export {};