@manifesto-ai/sdk 3.15.0 → 3.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-KA34LZLZ.js +1 -0
- package/dist/index.js +6 -6
- package/dist/provider.d.ts +1 -0
- package/dist/provider.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as y,g as S,h as b,i as E,n as R}from"./chunk-5BUS6Q4E.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};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`)[i.start.line-1];if(!
|
|
3
|
-
${
|
|
4
|
-
${
|
|
1
|
+
import{a as v}from"./chunk-KA34LZLZ.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-5BUS6Q4E.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
|
|
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,
|
|
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};
|
package/dist/provider.d.ts
CHANGED
|
@@ -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-KA34LZLZ.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-5BUS6Q4E.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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifesto-ai/sdk",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.1",
|
|
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": {
|