@onereach/state-machine-contracts 0.0.0-stage → 1.0.0-framework.12

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/contracts/types.ts","../src/contracts/contract.ts","../src/contracts/projection.ts","../generated/CreateStateMachineInstanceRequestSchema.d.mts","../generated/CreateStateMachineTemplateSchema.d.mts","../generated/ExecuteStateMachineFunctionRequestSchema.d.mts","../generated/FunctionImplementationSchema.d.mts","../generated/FunctionKindSchema.d.mts","../generated/JsonSchemaSchema.d.mts","../generated/ObjectJsonSchemaSchema.d.mts","../generated/StateMachineFunctionDefinitionSchema.d.mts","../generated/StateMachineInstanceSchema.d.mts","../generated/StateMachineTemplateBindingSchema.d.mts","../generated/StateMachineTemplateSchema.d.mts","../src/types.ts","../src/contracts/templates.ts","../src/contracts/instances.ts","../src/contracts/requests.ts","../src/contracts/functions.ts","../src/contracts/json-schema.ts"],"mappings":";;UAEiB;;;;EAIf;EAEA;;;;;;UAOe,8BAA8B,iBAAiB;WACrD;;;;;KAMC,uBAAuB,KACjC,iBAAiB,cAAc;WAAgB,iBAAiB;;;;cCfrD,gCAAgC;WAClC,iBAAiB;EAEd,YAAA,iBAAiB;;KAOnB,yBAAyB;EACjC;EAAe,MAAM;;EAAQ;EAAgB,OAAO;;UAMvC,kBAAkB,OAAO,gBAAgB,iBAAiB,OAAO;WACvE,aAAa,KAAK,iBAAiB,MAAM,OAAO;aAC9C,WAAW,mBAAmB,uBAAuB;;;;;;EAMhE,MAAM,iBAAiB;;;;EAIvB,UAAU,iBAAiB,yBAAyB;;;;KC9B1C,SAAS,OAAO,SAAS,SAAS,qBAAqB,OAAO,UAAU,kBAAkB,OAAO;;;;;;;UCF5F;;;;EAIf;;;;EAIA;;;;IAIE;;;;IAIA;;;;;EAKF;KACG;;;;;EAKH;KACG;;;;;EAKH;;;;IAIE;;;;;;;;;UCrCa;;;;EAIf;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;IAIE;KACC;;;;;EAKH;KACG;;;;;;;EAOH;;;;IAIE;;;;IAIA;;;;IAIA;;;;IAIA;;;;MAIE;OACC;;;;;IAKH;OACG;;;;;IAKH;;;;MAIE;;;;MAIA;;;;MAIA;;;;MAIA;;;;;;MAMA;;;;MAIA;;;;;IAKF;;;;MAIE;;;;MAIA;;;;MAIA;;;;MAIA;;;;MAIA;;;;;IAKF;OACG;;;;;;EAML;KACG;;;;;;;;;UCtIY;;;;EAIf;;;;IAIE;;;;;EAKF;;;;EAIA;;;;;;;;UCjBe;;;;EAIf;;;;EAIA;;;;EAIA;;;;EAIA;;;;;;EAMA;;;;EAIA;;;;;;;;KC1BU;;;;;;;UCAK;GACd;;;;;;;;UCDc;;;;EAIf;GACC;;;;;;;;UCLc;;;;EAIf;;;;EAIA;;;;EAIA;;;;EAIA;;;;IAIE;KACC;;;;;EAKH;KACG;;;;;EAKH;;;;IAIE;;;;IAIA;;;;IAIA;;;;IAIA;;;;;;IAMA;;;;IAIA;;;;;EAKF;;;;IAIE;;;;IAIA;;;;IAIA;;;;IAIA;;;;IAIA;;;;;EAKF;KACG;;;;;;;;;UCzFY;;;;EAIf;;;;EAIA;;;;EAIA;;;;IAIE;;;;IAIA;;;;IAIA;;;;;EAKF;;;;IAIE;;;;;EAKF;KACG;;;;;EAKH;;;;EAIA;;;;EAIA;;;;EAIA;KACG;;;;;;;;;UCzDY;;;;EAIf;;;;EAIA;;;;EAIA;;;;;;;;UCZe;;;;EAIf;;;;EAIA;;;;EAIA;;;;EAIA;;;;EAIA;;;;IAIE;KACC;;;;;EAKH;KACG;;;;;;;EAOH;;;;IAIE;;;;IAIA;;;;IAIA;;;;IAIA;;;;MAIE;OACC;;;;;IAKH;OACG;;;;;IAKH;;;;MAIE;;;;MAIA;;;;MAIA;;;;MAIA;;;;;;MAMA;;;;MAIA;;;;;IAKF;;;;MAIE;;;;MAIA;;;;MAIA;;;;MAIA;;;;MAIA;;;;;IAKF;OACG;;;;;;EAML;KACG;;;;;KC9HO,eAAe;;;;UAIV,+BAA+B;;;;UAI/B,uCAAuC;UACvC,mBAAmB;UACnB,yBAAyB;UACzB,oCAAoC;UACpC,6BAA6B;;;;UAI7B,kCAAkC;;;;UAIlC,6BAA6B;;;;;KAKlC,+BAA+B,aAAa;;;;KAI5C,yCAAyC,aAAa;KAE7D,aAAa,KAAK,+BAA+B,aAAa,IAAI,aAAa,EAAE,WAAU;;;;;UAM/E,0CAA0C;;;;;UAK1C,2CAA2C;;;;;;cCzC/C,8BAA8B,SAAS,sBAAsB;;;;cAe7D,oCAAoC,SAAS,2BAA2B;;;;;;cCnBxE,8BAA4B,SAAA,sBAAA;cAI5B,qCAAmC,SAAA,6BAAA;;;;;;cCJnC,2CAAyC,SAAA,mCAAA;;;;cAQzC,4CAA0C,SAAA,oCAAA;;;cCV1C,sBAAoB,SAAA,oBAAA;cACpB,gCAA8B,SAAA,wBAAA;cAI9B,wCAAsC,SAAA,gCAAA;;;;;;cCHtC,oBAAkB,SAAA,YAAA;cAClB,0BAAwB,SAAA,kBAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ import{CreateStateMachineInstanceRequestSchema as e,CreateStateMachineTemplateSchema as t,ExecuteStateMachineFunctionRequestSchema as n,FunctionImplementationSchema as r,FunctionKindSchema as i,JsonSchemaSchema as a,ObjectJsonSchemaSchema as o,StateMachineFunctionDefinitionSchema as s,StateMachineInstanceSchema as c,StateMachineTemplateBindingSchema as l,StateMachineTemplateSchema as u}from"./schemas/index.mjs";var d=Object.defineProperty,f=(e,t)=>{let n={};for(var r in e)d(n,r,{get:e[r],enumerable:!0});return t||d(n,Symbol.toStringTag,{value:`Module`}),n};function p(e,t){return`${e}/${String(t).replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}function m(e){let t=e.instancePath??e.path??``,n=e.params;return typeof n==`object`&&n&&e.keyword===`required`&&`missingProperty`in n&&typeof n.missingProperty==`string`&&(t=p(t,n.missingProperty)),{path:t,message:e.message??`Invalid value`}}function h(e){return{message:e.message,path:e.path===``?[]:e.path.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}}function ee(e){let t=``;for(let n of e.path)t=p(t,n);return{path:t,message:e.message}}function te(e,t){let n=[];return{data:_(e,t,``,n),issues:n}}function g(e){let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;if(typeof t!=`object`||Object.getPrototypeOf(t)!==null)return!1;let n=Object.getOwnPropertyDescriptor(t,`constructor`)?.value;return typeof n==`function`&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)}function _(e,t,n,r){if(e.type===`array`&&Array.isArray(t)&&e.items){let i=e.items,a=[];for(let e=0;e<t.length;e++){let o=t[e];a.push(_(i,o,p(n,e),r))}return a}if(e.type!==`object`||typeof t!=`object`||!t||Array.isArray(t))return t;if(!g(t))return r.push({path:n,message:`Expected a plain object`}),t;if(e.additionalProperties===!1)for(let i of Object.keys(t))Object.hasOwn(e.properties??{},i)||r.push({path:p(n,i),message:`Unknown contract property: ${i}`});let i=e.additionalProperties===!1?{}:Object.fromEntries(Object.entries(t)),a=Object.entries(e.properties??{});for(let[e,o]of a){let a=Object.hasOwn(t,e),s=a?t[e]:void 0;a&&s===void 0&&Object.hasOwn(o,`default`)&&r.push({path:p(n,e),message:`A supplied defaulted field must not be undefined`});let c=_(o,s,p(n,e),r);c!==void 0&&Object.defineProperty(i,e,{value:c,enumerable:!0,writable:!0,configurable:!0})}return i}var v=class extends Error{issues;constructor(e){super(`Invalid state-machine contract`),this.name=`ContractValidationError`,this.issues=e}};function y(e,t,n){return b(r=>{let i=te(e,r);if(i.issues.length>0)return{issues:i.issues.map(e=>h(e))};let{data:a}=i,o=t.validate(a),s=o.valid?n?.(a)??[]:o.errors.map(e=>m(e));return o.valid&&s.length===0?{value:a}:{issues:s.map(e=>h(e))}})}function b(e){let t={version:1,vendor:`@onereach/state-machine-contracts`,validate:e},n=e=>{let n=t.validate(e);return n.issues?{success:!1,error:new v(n.issues.map(e=>ee(e)))}:{success:!0,data:n.value}};return{"~standard":t,safeParse:n,parse(e){let t=n(e);if(!t.success)throw t.error;return t.data}}}var x=f({fields:()=>re,isValid:()=>C,validate:()=>ie,validator:()=>ae}),S=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const C=E,w={description:`Persisted state-machine template defining shared state, initial state, and available functions.`,additionalProperties:!1,type:`object`,required:[`schemaVersion`,`id`,`stateSchema`,`initialState`,`functions`],properties:{schemaVersion:{description:`Version of the persisted template format, not the logical application version.`,const:1,type:`number`},id:{description:`Unique identifier of the template.`,minLength:1,type:`string`},version:{description:`Optional logical application version. This is different from a storage-driver revision.`,type:`string`},description:{description:`Optional human-readable explanation of the state machine.`,type:`string`},stateSchema:{description:`Object-form JSON Schema shared by every function to validate instance state. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,required:[`type`],properties:{type:{description:`Explicit root instance type required for state and function-input schemas.`,const:`object`,type:`string`}}},initialState:{description:`Default state used when creating an instance without an explicit state override. Must satisfy stateSchema when the template is prepared.`,additionalProperties:!0,type:`object`,properties:{}},functions:{description:`Functions available on instances of this template. Names must be unique; the template parser enforces this semantic rule.`,type:`array`,items:{description:`Named state-machine function, including its input/output contracts and executable implementation.`,additionalProperties:!1,type:`object`,required:[`name`,`kind`,`inputSchema`,`implementation`],properties:{name:{description:`Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.`,minLength:1,maxLength:64,pattern:`^[a-zA-Z0-9_-]{1,64}$`,type:`string`},description:{description:`Optional human-readable explanation of the function.`,type:`string`},kind:{description:`Function classification: queries read state; mutations may update state.`,enum:[`query`,`mutation`]},inputSchema:{description:`Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,required:[`type`],properties:{type:{description:`Explicit root instance type required for state and function-input schemas.`,const:`object`,type:`string`}}},outputSchema:{description:`Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,properties:{}},implementation:{description:`Executable JavaScript implementation and its execution requirements.`,additionalProperties:!1,type:`object`,required:[`runtime`,`abi`,`format`,`code`],properties:{runtime:{description:`Runtime used to execute the implementation.`,const:`javascript`,type:`string`},abi:{description:`Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.`,examples:[`async function(input, state, ctx) {
2
+ // implementation.code
3
+ }`],const:`state-machine-function-v1`,type:`string`},format:{description:`Source format: the body of an async function, not a complete function declaration.`,const:`async-function-body`,type:`string`},code:{description:`JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.`,examples:[`const x = await ctx.foo(input);
4
+ state.foo = x;
5
+ return x;`],minLength:1,type:`string`},capabilities:{description:`Capability names requested by the implementation. Creation defaults an omitted list to [].`,type:`array`,items:{description:`Name of a capability requested by the implementation.`,type:`string`},default:[]},timeoutMs:{description:`Optional execution timeout in milliseconds, expressed as a positive safe integer.`,minimum:1,maximum:9007199254740991,type:`integer`}}},annotations:{description:`Optional descriptive hints about the function, not additional schema validation rules.`,additionalProperties:!1,type:`object`,properties:{exposeAsTool:{description:`Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.`,type:`boolean`},pure:{description:`Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.`,type:`boolean`},idempotent:{description:`Whether the function is declared to be idempotent.`,type:`boolean`},destructive:{description:`Whether the function is declared to perform destructive operations.`,type:`boolean`},deprecated:{description:`Whether use of this function is deprecated.`,type:`boolean`}}},metadata:{description:`Optional application-defined metadata about the function. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}}},metadata:{description:`Optional application-defined metadata about the template. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}},T=S().default,ne=RegExp(`^[a-zA-Z0-9_-]{1,64}$`,`u`);function E(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=E.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.schemaVersion===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`schemaVersion`},message:`must have required property 'schemaVersion'`};o===null?o=[e]:o.push(e),s++}if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(e.stateSchema===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`stateSchema`},message:`must have required property 'stateSchema'`};o===null?o=[e]:o.push(e),s++}if(e.initialState===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`initialState`},message:`must have required property 'initialState'`};o===null?o=[e]:o.push(e),s++}if(e.functions===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`functions`},message:`must have required property 'functions'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`schemaVersion`&&n!==`id`&&n!==`version`&&n!==`description`&&n!==`stateSchema`&&n!==`initialState`&&n!==`functions`&&n!==`metadata`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.schemaVersion!==void 0){let n=e.schemaVersion;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/type`,keyword:`type`,params:{type:`number`},message:`must be number`};o===null?o=[e]:o.push(e),s++}if(n!==1){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/const`,keyword:`const`,params:{allowedValue:1},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(T(n)<1){let e={instancePath:t+`/id`,schemaPath:`#/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/id`,schemaPath:`#/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.version!==void 0&&typeof e.version!=`string`){let e={instancePath:t+`/version`,schemaPath:`#/properties/version/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.description!==void 0&&typeof e.description!=`string`){let e={instancePath:t+`/description`,schemaPath:`#/properties/description/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.stateSchema!==void 0){let n=e.stateSchema;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.type===void 0){let e={instancePath:t+`/stateSchema`,schemaPath:`#/properties/stateSchema/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(n.type!==void 0){let e=n.type;if(typeof e!=`string`){let e={instancePath:t+`/stateSchema/type`,schemaPath:`#/properties/stateSchema/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`object`){let e={instancePath:t+`/stateSchema/type`,schemaPath:`#/properties/stateSchema/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/stateSchema`,schemaPath:`#/properties/stateSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.initialState!==void 0){let n=e.initialState;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/initialState`,schemaPath:`#/properties/initialState/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.functions!==void 0){let n=e.functions;if(Array.isArray(n)){let e=n.length;for(let r=0;r<e;r++){let e=n[r];if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.name===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`name`},message:`must have required property 'name'`};o===null?o=[e]:o.push(e),s++}if(e.kind===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`kind`},message:`must have required property 'kind'`};o===null?o=[e]:o.push(e),s++}if(e.inputSchema===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`inputSchema`},message:`must have required property 'inputSchema'`};o===null?o=[e]:o.push(e),s++}if(e.implementation===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`implementation`},message:`must have required property 'implementation'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`name`&&n!==`description`&&n!==`kind`&&n!==`inputSchema`&&n!==`outputSchema`&&n!==`implementation`&&n!==`annotations`&&n!==`metadata`){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.name!==void 0){let n=e.name;if(typeof n==`string`){if(T(n)>64){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};o===null?o=[e]:o.push(e),s++}if(T(n)<1){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}if(!ne.test(n)){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z0-9_-]{1,64}$`},message:`must match pattern "^[a-zA-Z0-9_-]{1,64}$"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.description!==void 0&&typeof e.description!=`string`){let e={instancePath:t+`/functions/`+r+`/description`,schemaPath:`#/properties/functions/items/properties/description/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.kind!==void 0){let n=e.kind;if(n!==`query`&&n!==`mutation`){let e={instancePath:t+`/functions/`+r+`/kind`,schemaPath:`#/properties/functions/items/properties/kind/enum`,keyword:`enum`,params:{allowedValues:w.properties.functions.items.properties.kind.enum},message:`must be equal to one of the allowed values`};o===null?o=[e]:o.push(e),s++}}if(e.inputSchema!==void 0){let n=e.inputSchema;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.type===void 0){let e={instancePath:t+`/functions/`+r+`/inputSchema`,schemaPath:`#/properties/functions/items/properties/inputSchema/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(n.type!==void 0){let e=n.type;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/inputSchema/type`,schemaPath:`#/properties/functions/items/properties/inputSchema/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`object`){let e={instancePath:t+`/functions/`+r+`/inputSchema/type`,schemaPath:`#/properties/functions/items/properties/inputSchema/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions/`+r+`/inputSchema`,schemaPath:`#/properties/functions/items/properties/inputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.outputSchema!==void 0){let n=e.outputSchema;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/functions/`+r+`/outputSchema`,schemaPath:`#/properties/functions/items/properties/outputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.implementation!==void 0){let n=e.implementation;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.runtime===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`runtime`},message:`must have required property 'runtime'`};o===null?o=[e]:o.push(e),s++}if(n.abi===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`abi`},message:`must have required property 'abi'`};o===null?o=[e]:o.push(e),s++}if(n.format===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`format`},message:`must have required property 'format'`};o===null?o=[e]:o.push(e),s++}if(n.code===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`code`},message:`must have required property 'code'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`runtime`&&e!==`abi`&&e!==`format`&&e!==`code`&&e!==`capabilities`&&e!==`timeoutMs`){let n={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.runtime!==void 0){let e=n.runtime;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/runtime`,schemaPath:`#/properties/functions/items/properties/implementation/properties/runtime/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`javascript`){let e={instancePath:t+`/functions/`+r+`/implementation/runtime`,schemaPath:`#/properties/functions/items/properties/implementation/properties/runtime/const`,keyword:`const`,params:{allowedValue:`javascript`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.abi!==void 0){let e=n.abi;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/abi`,schemaPath:`#/properties/functions/items/properties/implementation/properties/abi/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`state-machine-function-v1`){let e={instancePath:t+`/functions/`+r+`/implementation/abi`,schemaPath:`#/properties/functions/items/properties/implementation/properties/abi/const`,keyword:`const`,params:{allowedValue:`state-machine-function-v1`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.format!==void 0){let e=n.format;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/format`,schemaPath:`#/properties/functions/items/properties/implementation/properties/format/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`async-function-body`){let e={instancePath:t+`/functions/`+r+`/implementation/format`,schemaPath:`#/properties/functions/items/properties/implementation/properties/format/const`,keyword:`const`,params:{allowedValue:`async-function-body`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.code!==void 0){let e=n.code;if(typeof e==`string`){if(T(e)<1){let e={instancePath:t+`/functions/`+r+`/implementation/code`,schemaPath:`#/properties/functions/items/properties/implementation/properties/code/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/implementation/code`,schemaPath:`#/properties/functions/items/properties/implementation/properties/code/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(n.capabilities!==void 0){let e=n.capabilities;if(Array.isArray(e)){let n=e.length;for(let i=0;i<n;i++)if(typeof e[i]!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/capabilities/`+i,schemaPath:`#/properties/functions/items/properties/implementation/properties/capabilities/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/implementation/capabilities`,schemaPath:`#/properties/functions/items/properties/implementation/properties/capabilities/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(n.timeoutMs!==void 0){let e=n.timeoutMs;if(!(typeof e==`number`&&!(e%1)&&!isNaN(e)&&isFinite(e))){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof e==`number`&&isFinite(e)){if(e>9007199254740991||isNaN(e)){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(e<1||isNaN(e)){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:1},message:`must be >= 1`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.annotations!==void 0){let n=e.annotations;if(n&&typeof n==`object`&&!Array.isArray(n)){for(let e in n)if(e!==`exposeAsTool`&&e!==`pure`&&e!==`idempotent`&&e!==`destructive`&&e!==`deprecated`){let n={instancePath:t+`/functions/`+r+`/annotations`,schemaPath:`#/properties/functions/items/properties/annotations/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.exposeAsTool!==void 0&&typeof n.exposeAsTool!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/exposeAsTool`,schemaPath:`#/properties/functions/items/properties/annotations/properties/exposeAsTool/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.pure!==void 0&&typeof n.pure!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/pure`,schemaPath:`#/properties/functions/items/properties/annotations/properties/pure/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.idempotent!==void 0&&typeof n.idempotent!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/idempotent`,schemaPath:`#/properties/functions/items/properties/annotations/properties/idempotent/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.destructive!==void 0&&typeof n.destructive!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/destructive`,schemaPath:`#/properties/functions/items/properties/annotations/properties/destructive/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.deprecated!==void 0&&typeof n.deprecated!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/deprecated`,schemaPath:`#/properties/functions/items/properties/annotations/properties/deprecated/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/annotations`,schemaPath:`#/properties/functions/items/properties/annotations/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/functions/`+r+`/metadata`,schemaPath:`#/properties/functions/items/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions`,schemaPath:`#/properties/functions/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/metadata`,schemaPath:`#/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return E.errors=o,s===0}E.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const re=[`schemaVersion`,`id`,`version`,`description`,`stateSchema`,`initialState`,`functions`,`metadata`];function ie(e){let t=C(e);return{valid:t,errors:t?[]:C.errors}}const ae={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return C(e)?{value:e}:{issues:C.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var oe=f({fields:()=>ue,isValid:()=>D,validate:()=>de,validator:()=>fe}),se=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const D=k,ce={description:`Persisted state-machine template defining shared state, initial state, and available functions.`,additionalProperties:!1,type:`object`,required:[`schemaVersion`,`id`,`stateSchema`,`initialState`,`functions`],properties:{schemaVersion:{description:`Version of the persisted template format, not the logical application version.`,const:1,type:`number`},id:{description:`Unique identifier of the template.`,minLength:1,type:`string`},version:{description:`Optional logical application version. This is different from a storage-driver revision.`,type:`string`},description:{description:`Optional human-readable explanation of the state machine.`,type:`string`},stateSchema:{description:`Object-form JSON Schema shared by every function to validate instance state. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,required:[`type`],properties:{type:{description:`Explicit root instance type required for state and function-input schemas.`,const:`object`,type:`string`}}},initialState:{description:`Default state used when creating an instance without an explicit state override. Must satisfy stateSchema when the template is prepared.`,additionalProperties:!0,type:`object`,properties:{}},functions:{description:`Functions available on instances of this template. Names must be unique; the template parser enforces this semantic rule.`,type:`array`,items:{description:`Named state-machine function, including its input/output contracts and executable implementation.`,additionalProperties:!1,type:`object`,required:[`name`,`kind`,`inputSchema`,`implementation`],properties:{name:{description:`Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.`,minLength:1,maxLength:64,pattern:`^[a-zA-Z0-9_-]{1,64}$`,type:`string`},description:{description:`Optional human-readable explanation of the function.`,type:`string`},kind:{description:`Function classification: queries read state; mutations may update state.`,enum:[`query`,`mutation`]},inputSchema:{description:`Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,required:[`type`],properties:{type:{description:`Explicit root instance type required for state and function-input schemas.`,const:`object`,type:`string`}}},outputSchema:{description:`Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,properties:{}},implementation:{description:`Executable JavaScript implementation and its execution requirements.`,additionalProperties:!1,type:`object`,required:[`runtime`,`abi`,`format`,`code`,`capabilities`],properties:{runtime:{description:`Runtime used to execute the implementation.`,const:`javascript`,type:`string`},abi:{description:`Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.`,examples:[`async function(input, state, ctx) {
6
+ // implementation.code
7
+ }`],const:`state-machine-function-v1`,type:`string`},format:{description:`Source format: the body of an async function, not a complete function declaration.`,const:`async-function-body`,type:`string`},code:{description:`JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.`,examples:[`const x = await ctx.foo(input);
8
+ state.foo = x;
9
+ return x;`],minLength:1,type:`string`},capabilities:{description:`Capability names requested by the implementation. Required in canonical definitions.`,type:`array`,items:{description:`Name of a capability requested by the implementation.`,type:`string`}},timeoutMs:{description:`Optional execution timeout in milliseconds, expressed as a positive safe integer.`,minimum:1,maximum:9007199254740991,type:`integer`}}},annotations:{description:`Optional descriptive hints about the function, not additional schema validation rules.`,additionalProperties:!1,type:`object`,properties:{exposeAsTool:{description:`Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.`,type:`boolean`},pure:{description:`Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.`,type:`boolean`},idempotent:{description:`Whether the function is declared to be idempotent.`,type:`boolean`},destructive:{description:`Whether the function is declared to perform destructive operations.`,type:`boolean`},deprecated:{description:`Whether use of this function is deprecated.`,type:`boolean`}}},metadata:{description:`Optional application-defined metadata about the function. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}}},metadata:{description:`Optional application-defined metadata about the template. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}},O=se().default,le=RegExp(`^[a-zA-Z0-9_-]{1,64}$`,`u`);function k(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=k.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.schemaVersion===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`schemaVersion`},message:`must have required property 'schemaVersion'`};o===null?o=[e]:o.push(e),s++}if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(e.stateSchema===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`stateSchema`},message:`must have required property 'stateSchema'`};o===null?o=[e]:o.push(e),s++}if(e.initialState===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`initialState`},message:`must have required property 'initialState'`};o===null?o=[e]:o.push(e),s++}if(e.functions===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`functions`},message:`must have required property 'functions'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`schemaVersion`&&n!==`id`&&n!==`version`&&n!==`description`&&n!==`stateSchema`&&n!==`initialState`&&n!==`functions`&&n!==`metadata`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.schemaVersion!==void 0){let n=e.schemaVersion;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/type`,keyword:`type`,params:{type:`number`},message:`must be number`};o===null?o=[e]:o.push(e),s++}if(n!==1){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/const`,keyword:`const`,params:{allowedValue:1},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(O(n)<1){let e={instancePath:t+`/id`,schemaPath:`#/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/id`,schemaPath:`#/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.version!==void 0&&typeof e.version!=`string`){let e={instancePath:t+`/version`,schemaPath:`#/properties/version/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.description!==void 0&&typeof e.description!=`string`){let e={instancePath:t+`/description`,schemaPath:`#/properties/description/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.stateSchema!==void 0){let n=e.stateSchema;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.type===void 0){let e={instancePath:t+`/stateSchema`,schemaPath:`#/properties/stateSchema/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(n.type!==void 0){let e=n.type;if(typeof e!=`string`){let e={instancePath:t+`/stateSchema/type`,schemaPath:`#/properties/stateSchema/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`object`){let e={instancePath:t+`/stateSchema/type`,schemaPath:`#/properties/stateSchema/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/stateSchema`,schemaPath:`#/properties/stateSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.initialState!==void 0){let n=e.initialState;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/initialState`,schemaPath:`#/properties/initialState/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.functions!==void 0){let n=e.functions;if(Array.isArray(n)){let e=n.length;for(let r=0;r<e;r++){let e=n[r];if(e&&typeof e==`object`&&!Array.isArray(e)){if(e.name===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`name`},message:`must have required property 'name'`};o===null?o=[e]:o.push(e),s++}if(e.kind===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`kind`},message:`must have required property 'kind'`};o===null?o=[e]:o.push(e),s++}if(e.inputSchema===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`inputSchema`},message:`must have required property 'inputSchema'`};o===null?o=[e]:o.push(e),s++}if(e.implementation===void 0){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/required`,keyword:`required`,params:{missingProperty:`implementation`},message:`must have required property 'implementation'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`name`&&n!==`description`&&n!==`kind`&&n!==`inputSchema`&&n!==`outputSchema`&&n!==`implementation`&&n!==`annotations`&&n!==`metadata`){let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.name!==void 0){let n=e.name;if(typeof n==`string`){if(O(n)>64){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};o===null?o=[e]:o.push(e),s++}if(O(n)<1){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}if(!le.test(n)){let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z0-9_-]{1,64}$`},message:`must match pattern "^[a-zA-Z0-9_-]{1,64}$"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/name`,schemaPath:`#/properties/functions/items/properties/name/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.description!==void 0&&typeof e.description!=`string`){let e={instancePath:t+`/functions/`+r+`/description`,schemaPath:`#/properties/functions/items/properties/description/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.kind!==void 0){let n=e.kind;if(n!==`query`&&n!==`mutation`){let e={instancePath:t+`/functions/`+r+`/kind`,schemaPath:`#/properties/functions/items/properties/kind/enum`,keyword:`enum`,params:{allowedValues:ce.properties.functions.items.properties.kind.enum},message:`must be equal to one of the allowed values`};o===null?o=[e]:o.push(e),s++}}if(e.inputSchema!==void 0){let n=e.inputSchema;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.type===void 0){let e={instancePath:t+`/functions/`+r+`/inputSchema`,schemaPath:`#/properties/functions/items/properties/inputSchema/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(n.type!==void 0){let e=n.type;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/inputSchema/type`,schemaPath:`#/properties/functions/items/properties/inputSchema/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`object`){let e={instancePath:t+`/functions/`+r+`/inputSchema/type`,schemaPath:`#/properties/functions/items/properties/inputSchema/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions/`+r+`/inputSchema`,schemaPath:`#/properties/functions/items/properties/inputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.outputSchema!==void 0){let n=e.outputSchema;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/functions/`+r+`/outputSchema`,schemaPath:`#/properties/functions/items/properties/outputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.implementation!==void 0){let n=e.implementation;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.runtime===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`runtime`},message:`must have required property 'runtime'`};o===null?o=[e]:o.push(e),s++}if(n.abi===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`abi`},message:`must have required property 'abi'`};o===null?o=[e]:o.push(e),s++}if(n.format===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`format`},message:`must have required property 'format'`};o===null?o=[e]:o.push(e),s++}if(n.code===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`code`},message:`must have required property 'code'`};o===null?o=[e]:o.push(e),s++}if(n.capabilities===void 0){let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/required`,keyword:`required`,params:{missingProperty:`capabilities`},message:`must have required property 'capabilities'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`runtime`&&e!==`abi`&&e!==`format`&&e!==`code`&&e!==`capabilities`&&e!==`timeoutMs`){let n={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.runtime!==void 0){let e=n.runtime;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/runtime`,schemaPath:`#/properties/functions/items/properties/implementation/properties/runtime/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`javascript`){let e={instancePath:t+`/functions/`+r+`/implementation/runtime`,schemaPath:`#/properties/functions/items/properties/implementation/properties/runtime/const`,keyword:`const`,params:{allowedValue:`javascript`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.abi!==void 0){let e=n.abi;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/abi`,schemaPath:`#/properties/functions/items/properties/implementation/properties/abi/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`state-machine-function-v1`){let e={instancePath:t+`/functions/`+r+`/implementation/abi`,schemaPath:`#/properties/functions/items/properties/implementation/properties/abi/const`,keyword:`const`,params:{allowedValue:`state-machine-function-v1`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.format!==void 0){let e=n.format;if(typeof e!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/format`,schemaPath:`#/properties/functions/items/properties/implementation/properties/format/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`async-function-body`){let e={instancePath:t+`/functions/`+r+`/implementation/format`,schemaPath:`#/properties/functions/items/properties/implementation/properties/format/const`,keyword:`const`,params:{allowedValue:`async-function-body`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.code!==void 0){let e=n.code;if(typeof e==`string`){if(O(e)<1){let e={instancePath:t+`/functions/`+r+`/implementation/code`,schemaPath:`#/properties/functions/items/properties/implementation/properties/code/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/implementation/code`,schemaPath:`#/properties/functions/items/properties/implementation/properties/code/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(n.capabilities!==void 0){let e=n.capabilities;if(Array.isArray(e)){let n=e.length;for(let i=0;i<n;i++)if(typeof e[i]!=`string`){let e={instancePath:t+`/functions/`+r+`/implementation/capabilities/`+i,schemaPath:`#/properties/functions/items/properties/implementation/properties/capabilities/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/implementation/capabilities`,schemaPath:`#/properties/functions/items/properties/implementation/properties/capabilities/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(n.timeoutMs!==void 0){let e=n.timeoutMs;if(!(typeof e==`number`&&!(e%1)&&!isNaN(e)&&isFinite(e))){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof e==`number`&&isFinite(e)){if(e>9007199254740991||isNaN(e)){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(e<1||isNaN(e)){let e={instancePath:t+`/functions/`+r+`/implementation/timeoutMs`,schemaPath:`#/properties/functions/items/properties/implementation/properties/timeoutMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:1},message:`must be >= 1`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t+`/functions/`+r+`/implementation`,schemaPath:`#/properties/functions/items/properties/implementation/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.annotations!==void 0){let n=e.annotations;if(n&&typeof n==`object`&&!Array.isArray(n)){for(let e in n)if(e!==`exposeAsTool`&&e!==`pure`&&e!==`idempotent`&&e!==`destructive`&&e!==`deprecated`){let n={instancePath:t+`/functions/`+r+`/annotations`,schemaPath:`#/properties/functions/items/properties/annotations/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.exposeAsTool!==void 0&&typeof n.exposeAsTool!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/exposeAsTool`,schemaPath:`#/properties/functions/items/properties/annotations/properties/exposeAsTool/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.pure!==void 0&&typeof n.pure!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/pure`,schemaPath:`#/properties/functions/items/properties/annotations/properties/pure/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.idempotent!==void 0&&typeof n.idempotent!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/idempotent`,schemaPath:`#/properties/functions/items/properties/annotations/properties/idempotent/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.destructive!==void 0&&typeof n.destructive!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/destructive`,schemaPath:`#/properties/functions/items/properties/annotations/properties/destructive/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.deprecated!==void 0&&typeof n.deprecated!=`boolean`){let e={instancePath:t+`/functions/`+r+`/annotations/deprecated`,schemaPath:`#/properties/functions/items/properties/annotations/properties/deprecated/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functions/`+r+`/annotations`,schemaPath:`#/properties/functions/items/properties/annotations/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/functions/`+r+`/metadata`,schemaPath:`#/properties/functions/items/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions/`+r,schemaPath:`#/properties/functions/items/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/functions`,schemaPath:`#/properties/functions/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/metadata`,schemaPath:`#/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return k.errors=o,s===0}k.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const ue=[`schemaVersion`,`id`,`version`,`description`,`stateSchema`,`initialState`,`functions`,`metadata`];function de(e){let t=D(e);return{valid:t,errors:t?[]:D.errors}}const fe={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return D(e)?{value:e}:{issues:D.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};function pe(e,t){if(t.target!==`draft-2020-12`)throw Error(`Unsupported JSON Schema target: ${t.target}`);if(t.libraryOptions&&Object.keys(t.libraryOptions).length>0)throw Error(`JSON Schema library options are unsupported; only structural projection is available`);return structuredClone({$schema:`https://json-schema.org/draft/2020-12/schema`,...e})}function me(e,t,n=t){return{...e,"~standard":{...e[`~standard`],jsonSchema:{input:e=>pe(t,e),output:e=>pe(n,e)}}}}function A(e,t,n){return me(y(e,t,n),e)}function he(e){let n=t.properties.functions.items.properties.implementation.properties.capabilities.default;return{...e,functions:e.functions.map(e=>({...e,implementation:{...e.implementation,capabilities:e.implementation.capabilities??[...n]}}))}}function ge(e){let t=new Set,n=[];for(let[r,i]of e.functions.entries())t.has(i.name)&&n.push({path:`/functions/${r}/name`,message:`Duplicate function name: ${i.name}`}),t.add(i.name);return n}const _e=A(u,oe,ge),ve=y(t,x),ye=me(b(e=>{let t=ve[`~standard`].validate(e);return t.issues?t:_e[`~standard`].validate(he(t.value))}),t,u);var be=f({fields:()=>Oe,isValid:()=>j,validate:()=>ke,validator:()=>Ae}),xe=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Se=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Ce=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:te,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:w,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:_,int32:{type:`number`,validate:b},int64:{type:`number`,validate:x},float:{type:`number`,validate:S},double:{type:`number`,validate:S},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,ee=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function te(e){return h.test(e)&&ee.test(e)}let g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _(e){return g.lastIndex=0,g.test(e)}let v=-(2**31),y=2**31-1;function b(e){return Number.isInteger(e)&&e<=y&&e>=v}function x(e){return Number.isInteger(e)}function S(){return!0}let C=/[^\\]\\Z/;function w(e){if(C.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}}));const j=N,we={description:`Persisted state-machine instance, pinned to a template revision and tracking its current state.`,additionalProperties:!1,type:`object`,required:[`schemaVersion`,`id`,`template`,`retention`,`state`,`sequence`,`createdAt`,`updatedAt`],properties:{schemaVersion:{description:`Version of the persisted instance format, not the logical instance sequence.`,const:2,type:`number`},id:{description:`Unique identifier of the instance.`,minLength:1,type:`string`},template:{description:`Template identity and storage revision bound to a state-machine instance.`,additionalProperties:!1,type:`object`,required:[`id`,`revision`],properties:{id:{description:`Unique identifier of the template.`,minLength:1,type:`string`},version:{description:`Logical application version of the template. Optional because the template may have no version.`,type:`string`},revision:{description:`Storage-driver revision of the template used to create this instance. Pins execution to that revision so changing a stored template cannot silently change instance behavior.`,minLength:1,type:`string`}}},retention:{description:`Instance-owned retention policy, independent of execution callers and application state.`,additionalProperties:!1,type:`object`,required:[`ttlMs`],properties:{ttlMs:{description:`Sliding expiration duration in milliseconds, renewed on successful persisted updates. Zero means no expiration.`,minimum:0,maximum:9007199254740991,type:`integer`}}},state:{description:`Current instance state, validated against the bound template's stateSchema during execution and storage operations.`,additionalProperties:!0,type:`object`,properties:{}},sequence:{description:`Logical instance version. Increased for every successful persisted update; independent of the storage-driver revision.`,minimum:0,maximum:9007199254740991,type:`integer`},createdAt:{format:`date-time`,pattern:`^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$`,type:`string`,description:`Date and time the instance was created, as an ISO 8601 UTC datetime ending in Z.`},updatedAt:{format:`date-time`,pattern:`^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$`,type:`string`,description:`Date and time the instance was last updated, as an ISO 8601 UTC datetime ending in Z.`},metadata:{description:`Optional application-defined metadata about the instance. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}},Te=Object.prototype.hasOwnProperty,M=Se().default,Ee=Ce().fullFormats[`date-time`],De=RegExp(`^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$`,`u`);function N(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=N.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.schemaVersion===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`schemaVersion`},message:`must have required property 'schemaVersion'`};o===null?o=[e]:o.push(e),s++}if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(e.template===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`template`},message:`must have required property 'template'`};o===null?o=[e]:o.push(e),s++}if(e.retention===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`retention`},message:`must have required property 'retention'`};o===null?o=[e]:o.push(e),s++}if(e.state===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`state`},message:`must have required property 'state'`};o===null?o=[e]:o.push(e),s++}if(e.sequence===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`sequence`},message:`must have required property 'sequence'`};o===null?o=[e]:o.push(e),s++}if(e.createdAt===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`createdAt`},message:`must have required property 'createdAt'`};o===null?o=[e]:o.push(e),s++}if(e.updatedAt===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`updatedAt`},message:`must have required property 'updatedAt'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(!Te.call(we.properties,n)){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.schemaVersion!==void 0){let n=e.schemaVersion;if(!(typeof n==`number`&&isFinite(n))){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/type`,keyword:`type`,params:{type:`number`},message:`must be number`};o===null?o=[e]:o.push(e),s++}if(n!==2){let e={instancePath:t+`/schemaVersion`,schemaPath:`#/properties/schemaVersion/const`,keyword:`const`,params:{allowedValue:2},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(M(n)<1){let e={instancePath:t+`/id`,schemaPath:`#/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/id`,schemaPath:`#/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.template!==void 0){let n=e.template;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.id===void 0){let e={instancePath:t+`/template`,schemaPath:`#/properties/template/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(n.revision===void 0){let e={instancePath:t+`/template`,schemaPath:`#/properties/template/required`,keyword:`required`,params:{missingProperty:`revision`},message:`must have required property 'revision'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`id`&&e!==`version`&&e!==`revision`){let n={instancePath:t+`/template`,schemaPath:`#/properties/template/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.id!==void 0){let e=n.id;if(typeof e==`string`){if(M(e)<1){let e={instancePath:t+`/template/id`,schemaPath:`#/properties/template/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/template/id`,schemaPath:`#/properties/template/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(n.version!==void 0&&typeof n.version!=`string`){let e={instancePath:t+`/template/version`,schemaPath:`#/properties/template/properties/version/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(n.revision!==void 0){let e=n.revision;if(typeof e==`string`){if(M(e)<1){let e={instancePath:t+`/template/revision`,schemaPath:`#/properties/template/properties/revision/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/template/revision`,schemaPath:`#/properties/template/properties/revision/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/template`,schemaPath:`#/properties/template/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.retention!==void 0){let n=e.retention;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.ttlMs===void 0){let e={instancePath:t+`/retention`,schemaPath:`#/properties/retention/required`,keyword:`required`,params:{missingProperty:`ttlMs`},message:`must have required property 'ttlMs'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`ttlMs`){let n={instancePath:t+`/retention`,schemaPath:`#/properties/retention/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.ttlMs!==void 0){let e=n.ttlMs;if(!(typeof e==`number`&&!(e%1)&&!isNaN(e)&&isFinite(e))){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof e==`number`&&isFinite(e)){if(e>9007199254740991||isNaN(e)){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(e<0||isNaN(e)){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t+`/retention`,schemaPath:`#/properties/retention/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.state!==void 0){let n=e.state;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/state`,schemaPath:`#/properties/state/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.sequence!==void 0){let n=e.sequence;if(!(typeof n==`number`&&!(n%1)&&!isNaN(n)&&isFinite(n))){let e={instancePath:t+`/sequence`,schemaPath:`#/properties/sequence/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof n==`number`&&isFinite(n)){if(n>9007199254740991||isNaN(n)){let e={instancePath:t+`/sequence`,schemaPath:`#/properties/sequence/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(n<0||isNaN(n)){let e={instancePath:t+`/sequence`,schemaPath:`#/properties/sequence/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};o===null?o=[e]:o.push(e),s++}}}if(e.createdAt!==void 0){let n=e.createdAt;if(typeof n==`string`){if(!De.test(n)){let e={instancePath:t+`/createdAt`,schemaPath:`#/properties/createdAt/pattern`,keyword:`pattern`,params:{pattern:`^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$`},message:`must match pattern "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$"`};o===null?o=[e]:o.push(e),s++}if(!Ee.validate(n)){let e={instancePath:t+`/createdAt`,schemaPath:`#/properties/createdAt/format`,keyword:`format`,params:{format:`date-time`},message:`must match format "date-time"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/createdAt`,schemaPath:`#/properties/createdAt/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.updatedAt!==void 0){let n=e.updatedAt;if(typeof n==`string`){if(!De.test(n)){let e={instancePath:t+`/updatedAt`,schemaPath:`#/properties/updatedAt/pattern`,keyword:`pattern`,params:{pattern:`^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$`},message:`must match pattern "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$"`};o===null?o=[e]:o.push(e),s++}if(!Ee.validate(n)){let e={instancePath:t+`/updatedAt`,schemaPath:`#/properties/updatedAt/format`,keyword:`format`,params:{format:`date-time`},message:`must match format "date-time"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/updatedAt`,schemaPath:`#/properties/updatedAt/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/metadata`,schemaPath:`#/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return N.errors=o,s===0}N.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Oe=[`schemaVersion`,`id`,`template`,`retention`,`state`,`sequence`,`createdAt`,`updatedAt`,`metadata`];function ke(e){let t=j(e);return{valid:t,errors:t?[]:j.errors}}const Ae={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return j(e)?{value:e}:{issues:j.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var je=f({fields:()=>Ne,isValid:()=>P,validate:()=>Pe,validator:()=>Fe}),Me=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const P=I,F=Me().default;function I(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=I.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(e.revision===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`revision`},message:`must have required property 'revision'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`id`&&n!==`version`&&n!==`revision`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(F(n)<1){let e={instancePath:t+`/id`,schemaPath:`#/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/id`,schemaPath:`#/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.version!==void 0&&typeof e.version!=`string`){let e={instancePath:t+`/version`,schemaPath:`#/properties/version/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.revision!==void 0){let n=e.revision;if(typeof n==`string`){if(F(n)<1){let e={instancePath:t+`/revision`,schemaPath:`#/properties/revision/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/revision`,schemaPath:`#/properties/revision/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return I.errors=o,s===0}I.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Ne=[`id`,`version`,`revision`];function Pe(e){let t=P(e);return{valid:t,errors:t?[]:P.errors}}const Fe={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return P(e)?{value:e}:{issues:P.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}},Ie=A(c,be),Le=A(l,je);var Re=f({fields:()=>Be,isValid:()=>L,validate:()=>Ve,validator:()=>He}),ze=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const L=z,R=ze().default;function z(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=z.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.id===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}if(e.template===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`template`},message:`must have required property 'template'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`id`&&n!==`template`&&n!==`state`&&n!==`metadata`&&n!==`retention`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.id!==void 0){let n=e.id;if(typeof n==`string`){if(R(n)<1){let e={instancePath:t+`/id`,schemaPath:`#/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/id`,schemaPath:`#/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.template!==void 0){let n=e.template;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.id===void 0){let e={instancePath:t+`/template`,schemaPath:`#/properties/template/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`id`&&e!==`version`){let n={instancePath:t+`/template`,schemaPath:`#/properties/template/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.id!==void 0){let e=n.id;if(typeof e==`string`){if(R(e)<1){let e={instancePath:t+`/template/id`,schemaPath:`#/properties/template/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/template/id`,schemaPath:`#/properties/template/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(n.version!==void 0&&typeof n.version!=`string`){let e={instancePath:t+`/template/version`,schemaPath:`#/properties/template/properties/version/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/template`,schemaPath:`#/properties/template/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.state!==void 0){let n=e.state;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/state`,schemaPath:`#/properties/state/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/metadata`,schemaPath:`#/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.retention!==void 0){let n=e.retention;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.ttlMs===void 0){let e={instancePath:t+`/retention`,schemaPath:`#/properties/retention/required`,keyword:`required`,params:{missingProperty:`ttlMs`},message:`must have required property 'ttlMs'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`ttlMs`){let n={instancePath:t+`/retention`,schemaPath:`#/properties/retention/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.ttlMs!==void 0){let e=n.ttlMs;if(!(typeof e==`number`&&!(e%1)&&!isNaN(e)&&isFinite(e))){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof e==`number`&&isFinite(e)){if(e>9007199254740991||isNaN(e)){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(e<0||isNaN(e)){let e={instancePath:t+`/retention/ttlMs`,schemaPath:`#/properties/retention/properties/ttlMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:0},message:`must be >= 0`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t+`/retention`,schemaPath:`#/properties/retention/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return z.errors=o,s===0}z.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Be=[`id`,`template`,`state`,`metadata`,`retention`];function Ve(e){let t=L(e);return{valid:t,errors:t?[]:L.errors}}const He={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return L(e)?{value:e}:{issues:L.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var Ue=f({fields:()=>Ke,isValid:()=>B,validate:()=>qe,validator:()=>Je}),We=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const B=H,V=We().default,Ge=RegExp(`^[a-zA-Z0-9_-]{1,64}$`,`u`);function H(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=H.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.instance===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`instance`},message:`must have required property 'instance'`};o===null?o=[e]:o.push(e),s++}if(e.functionName===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`functionName`},message:`must have required property 'functionName'`};o===null?o=[e]:o.push(e),s++}if(e.input===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`input`},message:`must have required property 'input'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`instance`&&n!==`functionName`&&n!==`input`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.instance!==void 0){let n=e.instance;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.id===void 0){let e={instancePath:t+`/instance`,schemaPath:`#/properties/instance/required`,keyword:`required`,params:{missingProperty:`id`},message:`must have required property 'id'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`id`){let n={instancePath:t+`/instance`,schemaPath:`#/properties/instance/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.id!==void 0){let e=n.id;if(typeof e==`string`){if(V(e)<1){let e={instancePath:t+`/instance/id`,schemaPath:`#/properties/instance/properties/id/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/instance/id`,schemaPath:`#/properties/instance/properties/id/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/instance`,schemaPath:`#/properties/instance/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.functionName!==void 0){let n=e.functionName;if(typeof n==`string`){if(V(n)>64){let e={instancePath:t+`/functionName`,schemaPath:`#/properties/functionName/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};o===null?o=[e]:o.push(e),s++}if(V(n)<1){let e={instancePath:t+`/functionName`,schemaPath:`#/properties/functionName/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}if(!Ge.test(n)){let e={instancePath:t+`/functionName`,schemaPath:`#/properties/functionName/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z0-9_-]{1,64}$`},message:`must match pattern "^[a-zA-Z0-9_-]{1,64}$"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/functionName`,schemaPath:`#/properties/functionName/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return H.errors=o,s===0}H.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Ke=[`instance`,`functionName`,`input`];function qe(e){let t=B(e);return{valid:t,errors:t?[]:B.errors}}const Je={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return B(e)?{value:e}:{issues:B.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}},Ye=A(e,Re),Xe=A(n,Ue);var Ze=f({fields:()=>et,isValid:()=>U,validate:()=>tt,validator:()=>nt}),Qe=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const U=W,$e=Qe().default;function W(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=W.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.runtime===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`runtime`},message:`must have required property 'runtime'`};o===null?o=[e]:o.push(e),s++}if(e.abi===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`abi`},message:`must have required property 'abi'`};o===null?o=[e]:o.push(e),s++}if(e.format===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`format`},message:`must have required property 'format'`};o===null?o=[e]:o.push(e),s++}if(e.code===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`code`},message:`must have required property 'code'`};o===null?o=[e]:o.push(e),s++}if(e.capabilities===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`capabilities`},message:`must have required property 'capabilities'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`runtime`&&n!==`abi`&&n!==`format`&&n!==`code`&&n!==`capabilities`&&n!==`timeoutMs`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.runtime!==void 0){let n=e.runtime;if(typeof n!=`string`){let e={instancePath:t+`/runtime`,schemaPath:`#/properties/runtime/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(n!==`javascript`){let e={instancePath:t+`/runtime`,schemaPath:`#/properties/runtime/const`,keyword:`const`,params:{allowedValue:`javascript`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.abi!==void 0){let n=e.abi;if(typeof n!=`string`){let e={instancePath:t+`/abi`,schemaPath:`#/properties/abi/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(n!==`state-machine-function-v1`){let e={instancePath:t+`/abi`,schemaPath:`#/properties/abi/const`,keyword:`const`,params:{allowedValue:`state-machine-function-v1`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.format!==void 0){let n=e.format;if(typeof n!=`string`){let e={instancePath:t+`/format`,schemaPath:`#/properties/format/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(n!==`async-function-body`){let e={instancePath:t+`/format`,schemaPath:`#/properties/format/const`,keyword:`const`,params:{allowedValue:`async-function-body`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(e.code!==void 0){let n=e.code;if(typeof n==`string`){if($e(n)<1){let e={instancePath:t+`/code`,schemaPath:`#/properties/code/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/code`,schemaPath:`#/properties/code/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.capabilities!==void 0){let n=e.capabilities;if(Array.isArray(n)){let e=n.length;for(let r=0;r<e;r++)if(typeof n[r]!=`string`){let e={instancePath:t+`/capabilities/`+r,schemaPath:`#/properties/capabilities/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/capabilities`,schemaPath:`#/properties/capabilities/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(e.timeoutMs!==void 0){let n=e.timeoutMs;if(!(typeof n==`number`&&!(n%1)&&!isNaN(n)&&isFinite(n))){let e={instancePath:t+`/timeoutMs`,schemaPath:`#/properties/timeoutMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof n==`number`&&isFinite(n)){if(n>9007199254740991||isNaN(n)){let e={instancePath:t+`/timeoutMs`,schemaPath:`#/properties/timeoutMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(n<1||isNaN(n)){let e={instancePath:t+`/timeoutMs`,schemaPath:`#/properties/timeoutMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:1},message:`must be >= 1`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return W.errors=o,s===0}W.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const et=[`runtime`,`abi`,`format`,`code`,`capabilities`,`timeoutMs`];function tt(e){let t=U(e);return{valid:t,errors:t?[]:U.errors}}const nt={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return U(e)?{value:e}:{issues:U.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var rt=f({fields:()=>at,isValid:()=>G,validate:()=>ot,validator:()=>st});const G=K,it={description:`Function classification: queries read state; mutations may update state.`,enum:[`query`,`mutation`]};function K(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=K.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e!==`query`&&e!==`mutation`){let e={instancePath:t,schemaPath:`#/enum`,keyword:`enum`,params:{allowedValues:it.enum},message:`must be equal to one of the allowed values`};o===null?o=[e]:o.push(e),s++}return K.errors=o,s===0}K.evaluated={dynamicProps:!1,dynamicItems:!1};const at=[];function ot(e){let t=G(e);return{valid:t,errors:t?[]:G.errors}}const st={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return G(e)?{value:e}:{issues:G.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var ct=f({fields:()=>ft,isValid:()=>q,validate:()=>pt,validator:()=>mt}),lt=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`}));const q=Y,ut={description:`Named state-machine function, including its input/output contracts and executable implementation.`,additionalProperties:!1,type:`object`,required:[`name`,`kind`,`inputSchema`,`implementation`],properties:{name:{description:`Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.`,minLength:1,maxLength:64,pattern:`^[a-zA-Z0-9_-]{1,64}$`,type:`string`},description:{description:`Optional human-readable explanation of the function.`,type:`string`},kind:{description:`Function classification: queries read state; mutations may update state.`,enum:[`query`,`mutation`]},inputSchema:{description:`Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,required:[`type`],properties:{type:{description:`Explicit root instance type required for state and function-input schemas.`,const:`object`,type:`string`}}},outputSchema:{description:`Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.`,additionalProperties:!0,type:`object`,properties:{}},implementation:{description:`Executable JavaScript implementation and its execution requirements.`,additionalProperties:!1,type:`object`,required:[`runtime`,`abi`,`format`,`code`,`capabilities`],properties:{runtime:{description:`Runtime used to execute the implementation.`,const:`javascript`,type:`string`},abi:{description:`Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.`,examples:[`async function(input, state, ctx) {
10
+ // implementation.code
11
+ }`],const:`state-machine-function-v1`,type:`string`},format:{description:`Source format: the body of an async function, not a complete function declaration.`,const:`async-function-body`,type:`string`},code:{description:`JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.`,examples:[`const x = await ctx.foo(input);
12
+ state.foo = x;
13
+ return x;`],minLength:1,type:`string`},capabilities:{description:`Capability names requested by the implementation. Required in canonical definitions.`,type:`array`,items:{description:`Name of a capability requested by the implementation.`,type:`string`}},timeoutMs:{description:`Optional execution timeout in milliseconds, expressed as a positive safe integer.`,minimum:1,maximum:9007199254740991,type:`integer`}}},annotations:{description:`Optional descriptive hints about the function, not additional schema validation rules.`,additionalProperties:!1,type:`object`,properties:{exposeAsTool:{description:`Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.`,type:`boolean`},pure:{description:`Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.`,type:`boolean`},idempotent:{description:`Whether the function is declared to be idempotent.`,type:`boolean`},destructive:{description:`Whether the function is declared to perform destructive operations.`,type:`boolean`},deprecated:{description:`Whether use of this function is deprecated.`,type:`boolean`}}},metadata:{description:`Optional application-defined metadata about the function. Arbitrary keys are preserved.`,additionalProperties:!0,type:`object`,properties:{}}}},J=lt().default,dt=RegExp(`^[a-zA-Z0-9_-]{1,64}$`,`u`);function Y(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=Y.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.name===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`name`},message:`must have required property 'name'`};o===null?o=[e]:o.push(e),s++}if(e.kind===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`kind`},message:`must have required property 'kind'`};o===null?o=[e]:o.push(e),s++}if(e.inputSchema===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`inputSchema`},message:`must have required property 'inputSchema'`};o===null?o=[e]:o.push(e),s++}if(e.implementation===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`implementation`},message:`must have required property 'implementation'`};o===null?o=[e]:o.push(e),s++}for(let n in e)if(n!==`name`&&n!==`description`&&n!==`kind`&&n!==`inputSchema`&&n!==`outputSchema`&&n!==`implementation`&&n!==`annotations`&&n!==`metadata`){let e={instancePath:t,schemaPath:`#/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:n},message:`must NOT have additional properties`};o===null?o=[e]:o.push(e),s++}if(e.name!==void 0){let n=e.name;if(typeof n==`string`){if(J(n)>64){let e={instancePath:t+`/name`,schemaPath:`#/properties/name/maxLength`,keyword:`maxLength`,params:{limit:64},message:`must NOT have more than 64 characters`};o===null?o=[e]:o.push(e),s++}if(J(n)<1){let e={instancePath:t+`/name`,schemaPath:`#/properties/name/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}if(!dt.test(n)){let e={instancePath:t+`/name`,schemaPath:`#/properties/name/pattern`,keyword:`pattern`,params:{pattern:`^[a-zA-Z0-9_-]{1,64}$`},message:`must match pattern "^[a-zA-Z0-9_-]{1,64}$"`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/name`,schemaPath:`#/properties/name/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(e.description!==void 0&&typeof e.description!=`string`){let e={instancePath:t+`/description`,schemaPath:`#/properties/description/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e.kind!==void 0){let n=e.kind;if(n!==`query`&&n!==`mutation`){let e={instancePath:t+`/kind`,schemaPath:`#/properties/kind/enum`,keyword:`enum`,params:{allowedValues:ut.properties.kind.enum},message:`must be equal to one of the allowed values`};o===null?o=[e]:o.push(e),s++}}if(e.inputSchema!==void 0){let n=e.inputSchema;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.type===void 0){let e={instancePath:t+`/inputSchema`,schemaPath:`#/properties/inputSchema/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(n.type!==void 0){let e=n.type;if(typeof e!=`string`){let e={instancePath:t+`/inputSchema/type`,schemaPath:`#/properties/inputSchema/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`object`){let e={instancePath:t+`/inputSchema/type`,schemaPath:`#/properties/inputSchema/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t+`/inputSchema`,schemaPath:`#/properties/inputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.outputSchema!==void 0){let n=e.outputSchema;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/outputSchema`,schemaPath:`#/properties/outputSchema/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.implementation!==void 0){let n=e.implementation;if(n&&typeof n==`object`&&!Array.isArray(n)){if(n.runtime===void 0){let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/required`,keyword:`required`,params:{missingProperty:`runtime`},message:`must have required property 'runtime'`};o===null?o=[e]:o.push(e),s++}if(n.abi===void 0){let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/required`,keyword:`required`,params:{missingProperty:`abi`},message:`must have required property 'abi'`};o===null?o=[e]:o.push(e),s++}if(n.format===void 0){let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/required`,keyword:`required`,params:{missingProperty:`format`},message:`must have required property 'format'`};o===null?o=[e]:o.push(e),s++}if(n.code===void 0){let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/required`,keyword:`required`,params:{missingProperty:`code`},message:`must have required property 'code'`};o===null?o=[e]:o.push(e),s++}if(n.capabilities===void 0){let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/required`,keyword:`required`,params:{missingProperty:`capabilities`},message:`must have required property 'capabilities'`};o===null?o=[e]:o.push(e),s++}for(let e in n)if(e!==`runtime`&&e!==`abi`&&e!==`format`&&e!==`code`&&e!==`capabilities`&&e!==`timeoutMs`){let n={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.runtime!==void 0){let e=n.runtime;if(typeof e!=`string`){let e={instancePath:t+`/implementation/runtime`,schemaPath:`#/properties/implementation/properties/runtime/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`javascript`){let e={instancePath:t+`/implementation/runtime`,schemaPath:`#/properties/implementation/properties/runtime/const`,keyword:`const`,params:{allowedValue:`javascript`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.abi!==void 0){let e=n.abi;if(typeof e!=`string`){let e={instancePath:t+`/implementation/abi`,schemaPath:`#/properties/implementation/properties/abi/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`state-machine-function-v1`){let e={instancePath:t+`/implementation/abi`,schemaPath:`#/properties/implementation/properties/abi/const`,keyword:`const`,params:{allowedValue:`state-machine-function-v1`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.format!==void 0){let e=n.format;if(typeof e!=`string`){let e={instancePath:t+`/implementation/format`,schemaPath:`#/properties/implementation/properties/format/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(e!==`async-function-body`){let e={instancePath:t+`/implementation/format`,schemaPath:`#/properties/implementation/properties/format/const`,keyword:`const`,params:{allowedValue:`async-function-body`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}if(n.code!==void 0){let e=n.code;if(typeof e==`string`){if(J(e)<1){let e={instancePath:t+`/implementation/code`,schemaPath:`#/properties/implementation/properties/code/minLength`,keyword:`minLength`,params:{limit:1},message:`must NOT have fewer than 1 characters`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/implementation/code`,schemaPath:`#/properties/implementation/properties/code/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}if(n.capabilities!==void 0){let e=n.capabilities;if(Array.isArray(e)){let n=e.length;for(let r=0;r<n;r++)if(typeof e[r]!=`string`){let e={instancePath:t+`/implementation/capabilities/`+r,schemaPath:`#/properties/implementation/properties/capabilities/items/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/implementation/capabilities`,schemaPath:`#/properties/implementation/properties/capabilities/type`,keyword:`type`,params:{type:`array`},message:`must be array`};o===null?o=[e]:o.push(e),s++}}if(n.timeoutMs!==void 0){let e=n.timeoutMs;if(!(typeof e==`number`&&!(e%1)&&!isNaN(e)&&isFinite(e))){let e={instancePath:t+`/implementation/timeoutMs`,schemaPath:`#/properties/implementation/properties/timeoutMs/type`,keyword:`type`,params:{type:`integer`},message:`must be integer`};o===null?o=[e]:o.push(e),s++}if(typeof e==`number`&&isFinite(e)){if(e>9007199254740991||isNaN(e)){let e={instancePath:t+`/implementation/timeoutMs`,schemaPath:`#/properties/implementation/properties/timeoutMs/maximum`,keyword:`maximum`,params:{comparison:`<=`,limit:9007199254740991},message:`must be <= 9007199254740991`};o===null?o=[e]:o.push(e),s++}if(e<1||isNaN(e)){let e={instancePath:t+`/implementation/timeoutMs`,schemaPath:`#/properties/implementation/properties/timeoutMs/minimum`,keyword:`minimum`,params:{comparison:`>=`,limit:1},message:`must be >= 1`};o===null?o=[e]:o.push(e),s++}}}}else{let e={instancePath:t+`/implementation`,schemaPath:`#/properties/implementation/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.annotations!==void 0){let n=e.annotations;if(n&&typeof n==`object`&&!Array.isArray(n)){for(let e in n)if(e!==`exposeAsTool`&&e!==`pure`&&e!==`idempotent`&&e!==`destructive`&&e!==`deprecated`){let n={instancePath:t+`/annotations`,schemaPath:`#/properties/annotations/additionalProperties`,keyword:`additionalProperties`,params:{additionalProperty:e},message:`must NOT have additional properties`};o===null?o=[n]:o.push(n),s++}if(n.exposeAsTool!==void 0&&typeof n.exposeAsTool!=`boolean`){let e={instancePath:t+`/annotations/exposeAsTool`,schemaPath:`#/properties/annotations/properties/exposeAsTool/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.pure!==void 0&&typeof n.pure!=`boolean`){let e={instancePath:t+`/annotations/pure`,schemaPath:`#/properties/annotations/properties/pure/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.idempotent!==void 0&&typeof n.idempotent!=`boolean`){let e={instancePath:t+`/annotations/idempotent`,schemaPath:`#/properties/annotations/properties/idempotent/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.destructive!==void 0&&typeof n.destructive!=`boolean`){let e={instancePath:t+`/annotations/destructive`,schemaPath:`#/properties/annotations/properties/destructive/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}if(n.deprecated!==void 0&&typeof n.deprecated!=`boolean`){let e={instancePath:t+`/annotations/deprecated`,schemaPath:`#/properties/annotations/properties/deprecated/type`,keyword:`type`,params:{type:`boolean`},message:`must be boolean`};o===null?o=[e]:o.push(e),s++}}else{let e={instancePath:t+`/annotations`,schemaPath:`#/properties/annotations/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}if(e.metadata!==void 0){let n=e.metadata;if(!(n&&typeof n==`object`&&!Array.isArray(n))){let e={instancePath:t+`/metadata`,schemaPath:`#/properties/metadata/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return Y.errors=o,s===0}Y.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const ft=[`name`,`description`,`kind`,`inputSchema`,`outputSchema`,`implementation`,`annotations`,`metadata`];function pt(e){let t=q(e);return{valid:t,errors:t?[]:q.errors}}const mt={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return q(e)?{value:e}:{issues:q.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}},ht=A(i,rt),gt=A(r,Ze),_t=A(s,ct);var vt=f({fields:()=>yt,isValid:()=>X,validate:()=>bt,validator:()=>xt});const X=Z;function Z(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=Z.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),!(e&&typeof e==`object`&&!Array.isArray(e))){let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return Z.errors=o,s===0}Z.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const yt=[];function bt(e){let t=X(e);return{valid:t,errors:t?[]:X.errors}}const xt={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return X(e)?{value:e}:{issues:X.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}};var St=f({fields:()=>Ct,isValid:()=>Q,validate:()=>wt,validator:()=>Tt});const Q=$;function $(e,{instancePath:t=``,parentData:n,parentDataProperty:r,rootData:i=e,dynamicAnchors:a={}}={}){let o=null,s=0,c=$.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),e&&typeof e==`object`&&!Array.isArray(e)){if(e.type===void 0){let e={instancePath:t,schemaPath:`#/required`,keyword:`required`,params:{missingProperty:`type`},message:`must have required property 'type'`};o===null?o=[e]:o.push(e),s++}if(e.type!==void 0){let n=e.type;if(typeof n!=`string`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/type`,keyword:`type`,params:{type:`string`},message:`must be string`};o===null?o=[e]:o.push(e),s++}if(n!==`object`){let e={instancePath:t+`/type`,schemaPath:`#/properties/type/const`,keyword:`const`,params:{allowedValue:`object`},message:`must be equal to constant`};o===null?o=[e]:o.push(e),s++}}}else{let e={instancePath:t,schemaPath:`#/type`,keyword:`type`,params:{type:`object`},message:`must be object`};o===null?o=[e]:o.push(e),s++}return $.errors=o,s===0}$.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Ct=[`type`];function wt(e){let t=Q(e);return{valid:t,errors:t?[]:Q.errors}}const Tt={"~standard":{version:1,vendor:`@onereach/json-schema-aot`,validate(e){return Q(e)?{value:e}:{issues:Q.errors.map(e=>{let t=e.instancePath;return e.keyword===`required`&&(t+=`/`+e.params.missingProperty.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)),{message:e.message??`Invalid value`,path:t===``?[]:t.slice(1).split(`/`).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`))}})}}}},Et=A(a,vt),Dt=A(o,St);export{v as ContractValidationError,Ye as CreateStateMachineInstanceRequestContract,ye as CreateStateMachineTemplateContract,Xe as ExecuteStateMachineFunctionRequestContract,gt as FunctionImplementationContract,ht as FunctionKindContract,Et as JsonSchemaContract,Dt as ObjectJsonSchemaContract,_t as StateMachineFunctionDefinitionContract,Ie as StateMachineInstanceContract,Le as StateMachineTemplateBindingContract,_e as StateMachineTemplateContract};
14
+ //# sourceMappingURL=index.mjs.map