@makaio/framework 1.0.0-dev-1791396836202 → 1.0.0-dev-1791471149180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.makaio-build.json +2 -2
- package/dist/{artifact-BbNQHNDL.mjs → artifact-D3VD0bDr.mjs} +1 -1
- package/dist/bus/index.mjs +1 -1
- package/dist/{bus-CtT6XeB_.mjs → bus-CzD5SUBY.mjs} +1 -1
- package/dist/contracts/adapter/index.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +2 -2
- package/dist/contracts/artifact/index.mjs +1 -1
- package/dist/contracts/capabilities/index.d.mts +1 -1
- package/dist/contracts/client/index.d.mts +1 -1
- package/dist/contracts/extension/index.d.mts +2 -2
- package/dist/contracts/index.d.mts +40 -40
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +2 -2
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/worker/index.mjs +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{index-DBkmFhrn.d.mts → index-5NiMVtgh.d.mts} +19 -5
- package/dist/{index-Rd9Teoza.d.mts → index-B4IxvgmZ.d.mts} +16 -16
- package/dist/{index-CgcMrxhm.d.mts → index-BKA5-NKn.d.mts} +24 -24
- package/dist/{index-HsD17NLG.d.mts → index-BYFxcF58.d.mts} +6 -6
- package/dist/{index-DnsMV2xK.d.mts → index-C3C0hYHu.d.mts} +5 -5
- package/dist/{index-Di2-G_3M.d.mts → index-CQQsIg1Z.d.mts} +1 -1
- package/dist/{index-D_fMdJbU.d.mts → index-CTScKg_6.d.mts} +8 -8
- package/dist/{index-y6zuCdvH.d.mts → index-D9rIwIZ_.d.mts} +30 -30
- package/dist/{index-D5eIy_qx.d.mts → index-DHKBs9sY.d.mts} +4 -4
- package/dist/{index-CjM6Fi-N.d.mts → index-DVorNME3.d.mts} +1 -1
- package/dist/{index-chwNKVMu2.d.mts → index-D_1N051p2.d.mts} +37 -37
- package/dist/{index-CP7iuxhd2.d.mts → index-DbTxrhan2.d.mts} +4 -4
- package/dist/{index-BBrLhtLK.d.mts → index-MzTQNTb8.d.mts} +1 -1
- package/dist/{index-BXaNt9GP.d.mts → index-bYrlVerZ.d.mts} +1 -1
- package/dist/kernel/extension/index.d.mts +2 -2
- package/dist/kernel/index.d.mts +2 -2
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/{materialization-C1qlFBV2.mjs → materialization-Cqx2hTZU.mjs} +1 -1
- package/dist/{namespace-BG35KNtw.d.mts → namespace-C1AVqxHR.d.mts} +4 -4
- package/dist/{namespace-D74MefGI.d.mts → namespace-D89Ih67f.d.mts} +2 -2
- package/dist/{namespace-DK5qZpST.d.mts → namespace-D_NJoYyN.d.mts} +6 -6
- package/dist/{namespace-DZooy1DW.d.mts → namespace-u4eoUCLp.d.mts} +18 -18
- package/dist/package.json +1 -1
- package/dist/{schemas-Y3EJu698.d.mts → schemas-C81JlArF.d.mts} +8 -8
- package/dist/{schemas-DnrIc9g7.d.mts → schemas-CY2niCMn.d.mts} +5 -1
- package/dist/{schemas-uNzmiLso.mjs → schemas-DmP_43fe.mjs} +1 -1
- package/dist/{schemas-DnwAE1ao.d.mts → schemas-DrTW-Clp.d.mts} +1 -1
- package/dist/{schemas-CtL2su-K.d.mts → schemas-yyNP39HU.d.mts} +4 -4
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +3 -3
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/index.d.mts +23 -23
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/session/index.d.mts +4 -4
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/settings/namespace.d.mts +8 -8
- package/dist/services/subagent-template/index.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/{transition-yohyGRmc.d.mts → transition-BEbgeCGa.d.mts} +1 -1
- package/dist/{types-CRKyrt5_.d.mts → types-C4-76ief.d.mts} +15 -15
- package/dist/{view-builder-BjVjGZAI.d.mts → view-builder-Cw9R3hvK.d.mts} +2 -2
- package/dist/{worker-DulBFC0P.mjs → worker-DAWXguML.mjs} +1 -1
- package/dist/{workflow-Dvv_8Xu6.mjs → workflow-CS_pwwXn.mjs} +1 -1
- package/dist/workflow-engine/index.d.mts +24 -24
- package/package.json +1 -1
package/dist/.makaio-build.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"fingerprint": "
|
|
4
|
-
"builtAt": "2026-10-
|
|
3
|
+
"fingerprint": "b2e587027c50f415b1845b464a8ad8a99b3062b4c9994c4e4579e4efa74a9709",
|
|
4
|
+
"builtAt": "2026-10-08T14:53:39.416Z",
|
|
5
5
|
"declarations": true,
|
|
6
6
|
"declarationBackend": "tsc"
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{n as t,o as n,s as r}from"./json-value-DM-EjTC1.mjs";import{S as i,T as a,_ as o,a as s,c,d as l,i as u,l as d,n as ee,p as te,r as ne,t as re,u as ie,w as f,x as ae,y as oe}from"./schemas-uNzmiLso.mjs";import{C as se,M as ce,a as le,d as p,h as ue,k as de,r as fe,s as m,t as h,x as pe}from"./kind-registration-CdjmVxY_.mjs";import{t as me}from"./zod-json-schema-ZUmGtQhT.mjs";import{t as he}from"./ajv-Cvnmw2yn.mjs";import{t as ge}from"./2020-CRfgqanb.mjs";import{t as _e}from"./dist-onY7e-pd.mjs";import{z as g}from"zod";import{createBusNamespace as ve}from"@makaio/framework/core";const ye=g.strictObject({evidence:f}),_=g.strictObject({kind:g.literal(`text`),text:g.string()}),[be,xe,Se]=f.options,Ce=g.union([be.pick({source:!0,location:!0}).extend({content:_}),xe.pick({source:!0,location:!0}).extend({content:_}),Se.pick({source:!0,location:!0}).extend({content:_})]);function v(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function y(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function we(e,t){if(t===`#`)return{node:e,pointer:``};if(!t.startsWith(`#/`))return;let n;try{n=decodeURIComponent(t.slice(1))}catch{return}let r=e;for(let e of n.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r)){if(!/^(0|[1-9]\d*)$/.test(t)||Number(t)>=r.length)return;r=r[Number(t)]}else{let e=v(r);if(!e||!Object.hasOwn(e,t))return;r=e[t]}}let i=typeof r==`boolean`?r:v(r);return i===void 0?void 0:{node:i,pointer:n}}function b(e,t){if(t===``)return!1;let n=e;for(let e of t.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(n=Array.isArray(n)?n[Number(t)]:v(n)?.[t],typeof v(n)?.$id==`string`)return!0}return!1}function Te(e,t,n){if(e[`x-makaio-value-type`]!==`evidence/v1`)return;let r=f.safeParse(t);if(!r.success)throw Error(`Invalid schema-declared evidence at ${n}`);return{evidence:r.data,dataPath:n}}function Ee(e,t,n,r){if(typeof t.$ref!=`string`)return!1;if(r)return!0;let i=we(e,t.$ref);return i===void 0?!0:typeof i.node!=`boolean`&&x(e,i.node,n,b(e,i.pointer))}function x(e,t,n=new WeakSet,r=!1){let i=v(t);if(!i||n.has(i))return!1;n.add(i);let a=r||i!==e&&typeof i.$id==`string`;if(i[`x-makaio-value-type`]===`evidence/v1`||typeof i.$dynamicRef==`string`||Ee(e,i,n,a)||[`additionalItems`,`additionalProperties`,`contains`,`else`,`if`,`items`,`then`,`unevaluatedItems`,`unevaluatedProperties`].some(t=>x(e,i[t],n,a))||[`allOf`,`anyOf`,`oneOf`,`prefixItems`].some(t=>Array.isArray(i[t])&&i[t].some(t=>x(e,t,n,a)))||Array.isArray(i.items)&&i.items.some(t=>x(e,t,n,a)))return!0;for(let t of[`dependentSchemas`,`dependencies`,`patternProperties`,`properties`]){let r=v(i[t]);if(r&&Object.values(r).some(t=>x(e,t,n,a)))return!0}return!1}var De=class{dataSchema;matchesSchema;occurrences=new Map;visited=new WeakMap;constructor(e,t){this.dataSchema=e,this.matchesSchema=t}extract(e){return this.visit(this.dataSchema,e,`/data`),[...this.occurrences.values()]}visit(e,t,n,r=``){let i=this.visited.get(e)??new Set;if(i.has(n))return;if(i.add(n),this.visited.set(e,i),typeof e.$dynamicRef==`string`)throw Error(`Evidence discovery does not support active $dynamicRef at ${n}`);if(typeof e.$ref==`string`){if(b(this.dataSchema,r))throw Error(`Evidence discovery does not support local $ref inside nested $id resource at ${n}`);let i=we(this.dataSchema,e.$ref);if(i===void 0)throw Error(`Cannot resolve local schema reference ${e.$ref} at ${n}`);if(typeof i.node!=`boolean`&&this.visit(i.node,t,n,i.pointer),this.dataSchema.$schema!==`https://json-schema.org/draft/2020-12/schema`)return}let a=Te(e,t,n);if(a){this.occurrences.set(n,a);return}this.visitCombiners(e,t,n,r),this.visitConditional(e,t,n,r),this.visitDependencies(e,t,n,r),this.assertSupportedApplicators(e,n,r),Array.isArray(t)?this.visitArray(e,t,n,r):typeof t==`object`&&t&&this.visitObject(e,t,n,r)}visitCombiners(e,t,n,r){for(let i of[`allOf`,`anyOf`,`oneOf`]){let a=e[i];if(Array.isArray(a))for(let[e,o]of a.entries()){let a=v(o),s=`${r}/${i}/${e}`;a&&(i===`allOf`||this.matchesSchema(this.dataSchema,s,t))&&this.visit(a,t,n,s)}}}visitConditional(e,t,n,r){let i=typeof e.if==`boolean`?e.if:v(e.if);if(i===void 0)return;let a=`${r}/if`,o=this.matchesSchema(this.dataSchema,a,t);o&&typeof i!=`boolean`&&this.visit(i,t,n,a);let s=o?`then`:`else`,c=v(e[s]);c&&this.visit(c,t,n,`${r}/${s}`)}visitDependencies(e,t,n,r){if(!(typeof t!=`object`||!t||Array.isArray(t)))for(let i of[`dependentSchemas`,`dependencies`]){let a=v(e[i]);if(a)for(let[e,o]of Object.entries(a)){let a=v(o);Object.hasOwn(t,e)&&a&&this.visit(a,t,n,`${r}/${i}/${y(e)}`)}}}assertSupportedApplicators(e,t,n){for(let r of[`unevaluatedProperties`,`unevaluatedItems`])if(x(this.dataSchema,e[r],void 0,b(this.dataSchema,n)))throw Error(`Evidence under unsupported ${r} applicator at ${t}`)}visitArray(e,t,n,r){let i=Array.isArray(e.prefixItems),a=i?e.prefixItems:Array.isArray(e.items)?e.items:[];a.forEach((e,a)=>{let o=v(e),s=i?`prefixItems`:`items`;o&&a<t.length&&this.visit(o,t[a],`${n}/${a}`,`${r}/${s}/${a}`)});let o=Array.isArray(e.items)?v(e.additionalItems):v(e.items);if(o){let i=Array.isArray(e.items)?`additionalItems`:`items`;t.slice(a.length).forEach((e,t)=>this.visit(o,e,`${n}/${a.length+t}`,`${r}/${i}`))}this.visitContains(e,t,n,r)}visitContains(e,t,n,r){let i=v(e.contains);if(!i)return;let a=`${r}/contains`;t.forEach((e,t)=>{this.matchesSchema(this.dataSchema,a,e)&&this.visit(i,e,`${n}/${t}`,a)})}visitObject(e,t,n,r){let i=v(e.properties),a=v(e.patternProperties);for(let[o,s]of Object.entries(t)){let t=y(o),c=i!==void 0&&Object.hasOwn(i,o),l=v(i?.[o]);l&&this.visit(l,s,`${n}/${t}`,`${r}/properties/${t}`);let u=this.visitPatterns(a,o,s,`${n}/${t}`,r),d=v(e.additionalProperties);!c&&!u&&d&&this.visit(d,s,`${n}/${t}`,`${r}/additionalProperties`)}}visitPatterns(e,t,n,r,i){let a=!1;for(let[o,s]of Object.entries(e??{})){if(!new RegExp(o,`u`).test(t))continue;a=!0;let e=v(s);e&&this.visit(e,n,r,`${i}/patternProperties/${y(o)}`)}return a}};function Oe(e,t,n){return new De(e,n.matchesSchema).extract(t)}function ke(e){let{dataSchema:t,hooks:n,...r}=e,i={$schema:`https://json-schema.org/draft/2020-12/schema`,...me(t)};de(i);let a=le.parse({...r,dataSchema:i});if(a.kind!==e.kind)throw Error(`Artifact kind identifiers must not contain surrounding whitespace`);let o=g.fromJSONSchema(a.dataSchema),s=g.unknown().superRefine((e,t)=>{let n=o.safeParse(e);if(!n.success)for(let e of n.error.issues)t.addIssue({code:`custom`,path:e.path,message:e.message})}).pipe(t).superRefine((e,t)=>{Object.hasOwn(e,`slug`)&&t.addIssue({code:`custom`,path:[pe],message:se});try{ce(e,a.titlePath)}catch(e){t.addIssue({code:`custom`,path:a.titlePath.split(`.`),message:e instanceof Error?e.message:`Artifact title must be a nonblank string`})}});return{...structuredClone(a),kind:e.kind,schemaVersion:e.schemaVersion,dataSchema:s,...n?{hooks:n}:{},toRegistration:()=>structuredClone(a)}}var Ae=e(he(),1),je=e(ge(),1),Me=e(_e(),1);function Ne(e){let t={allErrors:!0,strict:!1,strictSchema:!0},n=e.dataSchema.$schema===`https://json-schema.org/draft/2020-12/schema`?new je.default(t):new Ae.default(t);return(0,Me.default)(n),n.addKeyword({keyword:i,schemaType:`string`,valid:!0}),n.compile(e.dataSchema)}function Pe(e){return e.replace(/~1/gu,`/`).replace(/~0/gu,`~`)}function Fe(e){let t=e.instancePath.split(`/`).slice(1).map(Pe),n=e.keyword===`required`?e.params.missingProperty:e.params.additionalProperty;return typeof n==`string`&&(e.keyword===`required`||e.keyword===`additionalProperties`)&&t.push(n),t.join(`.`)}function Ie(e){if(e.keyword!==`type`)return;let t=e.params.type;if(typeof t==`string`)return t;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t.join(` | `)}const Le=n.array();function Re(e){if(e.keyword!==`enum`)return;let t=Le.safeParse(e.params.allowedValues);return t.success?t.data:void 0}function ze(e){return(e??[]).map(e=>{let t=Ie(e),n=Re(e);return{path:Fe(e),reason:e.message??`violates ${e.keyword}`,...t===void 0?{}:{expectedType:t},...n===void 0?{}:{allowedValues:n}}})}function Be(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`slug`)}const Ve={path:pe,reason:se};function He(e){let t=Ne(e);return e=>t(e)&&!Be(e)}function Ue(e){let t=Ne(e);return e=>{let n=t(e)?[]:ze(t.errors);return Be(e)&&n.push(Ve),n.length===0?{valid:!0}:{valid:!1,issues:n}}}function We(e){return{hooks:[...e.hooks]}}const Ge=[`inline`,`summary`,`link`,`omit`],Ke=[`outbound`,`inbound`],S=g.string().min(1),C=g.enum(Ke),qe=g.object({kinds:g.array(g.string().min(1)).optional(),hint:S.optional(),depth:g.number().int().min(1).max(20).optional(),nested:g.lazy(()=>w).optional(),direction:C.optional()}),w=g.record(g.string().min(1),qe);function T(e){return JSON.stringify([e.kind,e.id,e.revision])}const Je=g.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),Ye=g.object({target:d,sourceRef:a,relationType:g.string().min(1),sourceLocalId:c.shape.sourceLocalId,direction:C.optional(),hint:S,status:g.enum([`resolved`,`unresolved`]),reason:Je.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:g.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:g.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:g.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),E=g.object({rootRef:a,refs:g.array(Ye),resolved:g.array(l)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(T));n.has(T(e.rootRef))||t.addIssue({code:g.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(T(e.sourceRef))||t.addIssue({code:g.ZodIssueCode.custom,path:[`refs`,r,`sourceRef`],message:`artifact context ref sources must have a matching revision in resolved`}),!(e.status!==`resolved`||e.target.refClass!==`artifact`)&&(n.has(T(e.target))||t.addIssue({code:g.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function Xe(e){let t=E.parse(e),n=new Map(t.resolved.map(e=>[T(e),e])),r=new Map;for(let e of t.refs){let t=T(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(T(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${T(t.rootRef)}'`);let a=Ze(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return et(a,e),e}}}function Ze(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:$e(e,r,i,new Set([T(e)]))}}function Qe(e,t,n,r,i,a,o,s,c){let l=T(e),u=new Set(c);return u.add(l),{status:`resolved`,ref:e,artifact:t,relation:n,sourceLocalId:r,direction:i,hint:a,children:$e(e,o,s,u)}}function $e(e,t,n,r){return(t.get(T(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=T(e.target),a=n.get(i);if(!a)throw Error(`Resolved artifact context is missing target artifact '${i}'`);return r.has(i)?{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:`cycle-detected`}:Qe(e.target,a,e.relationType,e.sourceLocalId,e.direction,e.hint,t,n,r)})}function et(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)et(n,t)}}const D=[`$set`,`$unset`,`$push`,`$pull`],O=`[A-Za-z_$][A-Za-z0-9_$]*`,k=`[A-Za-z_$][A-Za-z0-9_$-]*`,tt=`(?:0|[1-9][0-9]*)`,nt=`(?:${`\\$\\[${O}\\]`}|${tt}|${k})`,rt=RegExp(`^${k}(?:\\.${nt})*$`),it=RegExp(`^${O}(?:\\.${k})*$`),at=RegExp(`^${tt}$`),ot=RegExp(`^\\$\\[(${O})\\]$`),A=g.string().regex(rt,`Expected a data-relative path of object properties, array positions, or $[filter] placeholders`);function st(e){let t=ot.exec(e);return t?.[1]===void 0?at.test(e)?{kind:`index`,index:Number(e)}:{kind:`property`,name:e}:{kind:`filter`,placeholder:t[1]}}function ct(e){return e.split(`.`).map(st)}function lt(e){return ct(e).flatMap(e=>e.kind===`filter`?[e.placeholder]:[])}const ut=r(g.record(g.string().regex(it,`Expected a filter key of the form name or name.field.path`),n),{prototypeKey:`an array filter cannot compare a __proto__ key, which JSON transport drops`,nonPlainObject:`an array filter must be a plain object of comparison keys`,symbolKey:`an array filter cannot carry symbol-keyed comparisons`,nonEnumerableKey:`an array filter cannot carry non-enumerable comparison keys`,extraArrayKey:`an array filter must be a plain object, not an array`});function dt(e){let t=new Set(Object.keys(e).map(e=>e.split(`.`)[0]));if(t.size!==1)return;let[n]=t;return n!==void 0&&n.length>0?n:void 0}function j(e,t){return r(g.record(A,t),{prototypeKey:`${e} cannot address __proto__, which JSON transport drops`,nonPlainObject:`${e} must be a plain object of path instructions`,symbolKey:`${e} cannot carry symbol-keyed instructions`,nonEnumerableKey:`${e} cannot carry non-enumerable instructions`,extraArrayKey:`${e} must be a plain object, not an array`})}const ft=g.literal(!0),pt=g.strictObject({$set:j(`$set`,n).optional(),$unset:j(`$unset`,ft).optional(),$push:j(`$push`,n).optional(),$pull:j(`$pull`,n).optional(),arrayFilters:g.array(ut).optional()});function M(e){return D.flatMap(t=>Object.entries(e[t]??{}).map(([e,n])=>({operator:t,path:e,value:n})))}function mt(e,t){let n=M(e),r=new Map;(e.arrayFilters??[]).forEach((e,n)=>{let i=dt(e);if(i===void 0){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`An array filter must bind exactly one placeholder name across all of its keys`});return}if(r.has(i)){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter placeholder ${i} is already bound by another filter`});return}r.set(i,n)});let i=new Set;for(let{operator:e,path:a}of n)for(let n of lt(a))i.add(n),r.has(n)||t.addIssue({code:`custom`,path:[e,a],message:`Path uses placeholder $[${n}] without a matching entry in arrayFilters`});for(let[e,n]of r)i.has(e)||t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter binds placeholder ${e}, which no path uses`})}const ht=pt.superRefine(mt).superRefine((e,t)=>{M(e).length===0&&t.addIssue({code:`custom`,message:`Declare at least one of ${D.join(`, `)}`})}),gt=pt.superRefine(mt),_t=g.strictObject({kind:a.shape.kind,id:a.shape.id}),vt=g.strictObject({ref:_t,baseRevision:a.shape.revision,patch:gt,dryRun:g.boolean().optional(),schemaVersion:p.optional().describe(`Target schema version for the patched revision; defaults to the base revision's. Use it to migrate an artifact left at an older version by a kind bump.`),statusPath:te.optional(),representations:ie.strict().nullable().optional().describe(`Rendering hints (markdown, summary, plaintext) for the new revision. Omit to keep the previous revision's hints. An object replaces all of them, it does not merge: send every hint you want to keep. null clears them.`)}).superRefine((e,t)=>{e.schemaVersion===void 0&&M(e.patch).length===0&&t.addIssue({code:`custom`,path:[`patch`],message:`Declare at least one of ${D.join(`, `)}, or name a schemaVersion to migrate a payload that already fits`})}),yt=[`ARTIFACT_NOT_FOUND`,`BASE_REVISION_CONFLICT`,`KIND_NOT_REGISTERED`,`SCHEMA_VERSION_MISMATCH`,`PATH_NOT_DECLARED`,`PATH_NOT_RESOLVABLE`,`TARGET_NOT_A_COLLECTION`,`UNSUPPORTED_TARGET`,`NO_MATCH`,`SCHEMA_VALIDATION_FAILED`,`PAYLOAD_INVARIANT_FAILED`,`NO_CHANGE`,`STORE_REJECTED`,`HOST_FAILED`],bt=g.strictObject({path:g.string(),reason:g.string().min(1),expectedType:g.string().min(1).optional(),allowedValues:g.array(n).optional()}),xt=g.strictObject({code:g.enum(yt),message:g.string().min(1),operator:g.enum(D).optional(),path:A.optional(),currentRevision:a.shape.revision.optional(),issues:g.array(bt).optional(),repair:g.string().min(1)}).superRefine((e,t)=>{e.code===`BASE_REVISION_CONFLICT`&&e.currentRevision===void 0&&t.addIssue({code:g.ZodIssueCode.custom,message:`A BASE_REVISION_CONFLICT must name the revision the artifact carries.`,path:[`currentRevision`]})}),St=g.strictObject({operator:g.enum(D),path:A,matched:g.number().int().positive()}),Ct=g.strictObject({from:p,to:p}).refine(e=>e.to>e.from,{path:[`to`],message:`A migration moves the artifact forward to a newer schema version`}),wt=g.strictObject({ok:g.literal(!0),base:a,operations:g.array(St),migration:Ct.optional()});function Tt(e,t){e.operations.length===0&&e.migration===void 0&&t.addIssue({code:`custom`,path:[`operations`],message:`A success without a migration must report at least one applied instruction`})}const Et=wt.extend({dryRun:g.literal(!0)}).superRefine(Tt),Dt=wt.extend({dryRun:g.literal(!1),artifact:a}).superRefine(Tt),Ot=g.discriminatedUnion(`dryRun`,[Et,Dt]),kt=g.strictObject({ok:g.literal(!1),error:xt}),At=g.union([Ot,kt]),jt=g.object({ref:oe}),Mt=g.union([g.strictObject({ok:g.literal(!0),ref:oe,areaPath:fe,part:t}),g.strictObject({ok:g.literal(!1),error:ue})]),N=a.pick({kind:!0,id:!0}),P=g.number().int().positive(),F=P,I={knowledge:`valid`,commitment:`proposed`,interaction:`open`},L=g.discriminatedUnion(`category`,[g.strictObject({category:g.literal(`knowledge`),state:g.enum(h.knowledge),version:F}),g.strictObject({category:g.literal(`commitment`),state:g.enum(h.commitment),version:F}),g.strictObject({category:g.literal(`interaction`),state:g.enum(h.interaction),version:F})]).superRefine((e,t)=>{e.version===1&&e.state!==I[e.category]&&t.addIssue({code:`custom`,path:[`state`],message:`Lifecycle version 1 is reserved for the category initial state`})}),R=g.union([L,g.strictObject({category:g.literal(`record`)})]),z=g.string().trim().min(1),Nt=g.strictObject({kind:z,ref:z}),B=g.discriminatedUnion(`kind`,[g.strictObject({kind:g.literal(`revision-assessment`),assessedRevision:a.shape.revision,source:Nt.optional()}),g.strictObject({kind:g.literal(`handover`),source:Nt})]),Pt={artifact:N,expectedVersion:F,state:m,situation:B,reason:z.optional()},V=g.strictObject(Pt),Ft=g.strictObject({...Pt,actor:re}),It={valid:[`retired`],retired:[`valid`],proposed:[`decided`],decided:[`fulfilled`,`revoked`],fulfilled:[],revoked:[],open:[`resolved`,`closed-without-resolution`],resolved:[],"closed-without-resolution":[]};function H(e,t){return It[e].includes(t)}const Lt={artifact:N,lifecycle:L,actor:re,timestamp:g.number().int().nonnegative(),observedRevision:a.shape.revision},Rt=g.strictObject({...Lt,operation:g.literal(`initialized`)}).superRefine((e,t)=>{(e.lifecycle.version!==1||e.lifecycle.state!==I[e.lifecycle.category])&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`Initialization requires the category initial state and version 1`})});function zt(e,t){return t===`retired`||e===`retired`&&t===`valid`}const Bt=`Retiring or reinstating knowledge requires a reason`,U=g.strictObject({...Lt,operation:g.literal(`transitioned`),previousState:m,situation:B,reason:V.shape.reason}).superRefine((e,t)=>{(!H(e.previousState,e.lifecycle.state)||e.lifecycle.version<=1)&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`History requires a category-compatible transition after initialization`}),zt(e.previousState,e.lifecycle.state)&&!e.reason&&t.addIssue({code:`custom`,path:[`reason`],message:Bt}),e.situation.kind===`revision-assessment`&&e.situation.assessedRevision!==e.observedRevision&&t.addIssue({code:`custom`,path:[`situation`],message:`An assessment cannot authorize a different observed content revision`})}),Vt=g.discriminatedUnion(`operation`,[Rt,U]),W=g.discriminatedUnion(`reason`,[g.strictObject({reason:g.literal(`lifecycle-version-conflict`),expectedVersion:F,current:L,requestedState:m}),g.strictObject({reason:g.literal(`content-basis-conflict`),assessedRevision:a.shape.revision,currentRevision:a.shape.revision}),g.strictObject({reason:g.literal(`invalid-transition`),current:R,requestedState:m}),g.strictObject({reason:g.literal(`precondition-failed`),current:L,requestedState:m})]),G=`artifact-lifecycle-rejected`;var K=class extends Error{code=G;data;constructor(e,t){super(e),this.name=`ArtifactLifecycleError`,this.data=W.parse(t)}};function Ht(e){return e===`record`?{category:`record`}:L.parse({category:e,state:I[e],version:1})}function Ut(e){let t=R.parse(e.current),n=a.shape.revision.parse(e.currentRevision),r=Ft.parse(e.command);if(t.category===`record`)throw new K(`Record artifacts do not have a lifecycle`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(r.expectedVersion!==t.version)throw new K(`Artifact lifecycle changed since the supplied baseline`,{reason:`lifecycle-version-conflict`,expectedVersion:r.expectedVersion,current:t,requestedState:r.state});if(r.situation.kind===`revision-assessment`&&r.situation.assessedRevision!==n)throw new K(`Assessed content revision is no longer current`,{reason:`content-basis-conflict`,assessedRevision:r.situation.assessedRevision,currentRevision:n});if(!H(t.state,r.state))throw new K(`Artifact lifecycle transition is not allowed`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(zt(t.state,r.state)&&!r.reason)throw new K(Bt,{reason:`precondition-failed`,current:t,requestedState:r.state});return L.parse({...t,state:r.state,version:t.version+1})}const Wt=g.strictObject({artifact:N}),Gt=g.strictObject({lifecycle:R}),Kt=g.strictObject({artifact:N,afterVersion:P.optional(),limit:g.number().int().min(1).max(100).default(50)}),qt=g.strictObject({entries:g.array(Vt).max(100),nextCursor:P.optional()}).superRefine(({entries:e,nextCursor:t},n)=>{let r=e[0],i;for(let[t,a]of e.entries()){let e=a.artifact.kind===r?.artifact.kind&&a.artifact.id===r?.artifact.id,o=i===void 0||a.lifecycle.version===i.lifecycle.version+1,s=i===void 0||a.operation===`transitioned`&&a.lifecycle.category===i.lifecycle.category&&a.previousState===i.lifecycle.state;if(!e||!o||!s){n.addIssue({code:`custom`,path:[`entries`,t],message:`History pages contain one artifact in contiguous ascending, state-linked order`});break}i=a}t!==void 0&&t!==i?.lifecycle.version&&n.addIssue({code:`custom`,path:[`nextCursor`],message:`nextCursor must equal the last returned lifecycle version`})}),q=g.strictObject({entry:U}),Jt=q,Yt=g.strictObject({code:g.literal(G),message:g.string().min(1),data:W});function Xt(e){return{code:e.code,message:e.message,data:e.data}}function Zt(e,t){switch(t.reason){case`content-basis-conflict`:return en(e,t);case`lifecycle-version-conflict`:return[...Qt(e,t),...$t(e,t)];case`invalid-transition`:case`precondition-failed`:return[...Qt(e,t),...tn(e,t)]}}function Qt(e,t){return t.requestedState===e.state?[]:[{path:[`requestedState`],message:`Rejection requestedState must match the rejected transition`}]}function $t(e,t){let n=[];return t.expectedVersion!==e.expectedVersion&&n.push({path:[`expectedVersion`],message:`Version conflict baseline must match the rejected transition`}),t.current.version===e.expectedVersion&&n.push({path:[`current`,`version`],message:`Version conflict requires a current version different from the supplied baseline`}),n}function en(e,t){let n=[];return(e.situation.kind!==`revision-assessment`||t.assessedRevision!==e.situation.assessedRevision)&&n.push({path:[`assessedRevision`],message:`Content conflict must identify the rejected revision assessment`}),t.currentRevision===t.assessedRevision&&n.push({path:[`currentRevision`],message:`Content conflict requires a current revision different from the assessed revision`}),n}function tn(e,t){if(t.current.category===`record`)return[];let n=[];t.current.version!==e.expectedVersion&&n.push({path:[`current`,`version`],message:`A rejection after the version check must report the supplied baseline version`});let r=H(t.current.state,t.requestedState);return t.reason===`invalid-transition`&&r&&n.push({path:[`reason`],message:`invalid-transition requires a transition the lifecycle matrix disallows`}),t.reason===`precondition-failed`&&!r&&n.push({path:[`reason`],message:`precondition-failed requires a transition the lifecycle matrix allows`}),n}const nn=g.strictObject({transition:V,error:Yt}).superRefine(({transition:e,error:t},n)=>{for(let r of Zt(e,t.data))n.addIssue({code:`custom`,path:[`error`,`data`,...r.path],message:r.message})}),rn={"lifecycle.get":{request:Wt,response:Gt},"lifecycle.history":{request:Kt,response:qt},"lifecycle.transition":{request:V,response:q},"lifecycle.committed":Jt,"lifecycle.rejected":nn},an=l.omit({id:!0,slug:!0,revision:!0,timestamp:!0}),on={...rn,"kind.register":{request:le,response:g.object({registered:g.boolean()})},"kind.list":{request:g.object({kind:g.string().min(1).optional()}),response:g.object({kinds:g.array(le)})},"relation-type.register":{request:ae,response:g.object({registered:g.boolean()})},"relation-type.list":{request:g.object({type:g.string().min(1).optional()}),response:g.object({relationTypes:g.array(ae)})},create:{request:an.extend({id:a.shape.id.optional(),slug:l.shape.slug.optional()}),response:g.object({artifact:l})},revise:{request:g.object({previous:a,statusPath:te.optional(),revision:an}),response:g.object({artifact:l})},patch:{request:vt,response:At},resolve:{request:g.object({ref:a}),response:g.object({artifact:l.nullable()})},resolvePart:{request:jt,response:Mt},query:{request:s,response:g.object({artifacts:g.array(l)})},compare:{request:ee,response:ne},"evidence.resolve":{request:ye,response:Ce},resolveContext:{request:g.object({ref:a,selectors:w.optional(),maxDepth:g.number().int().min(1).max(20).default(5)}),response:g.object({context:E})},created:g.object({artifact:l}),revised:g.object({previous:a,artifact:l}),"relation.added":g.object({artifact:a,relation:c}),"observation.added":g.object({artifact:a,observation:u}),"status.changed":g.object({artifact:a,path:g.string().min(1),previous:g.unknown().optional(),current:g.unknown().optional()}),"kind.changed":g.object({kind:g.string().min(1),schemaVersion:p})},sn=ve(`artifact`,on),cn=sn.subjects,ln=g.discriminatedUnion(`refClass`,[a.omit({revision:!0}),o]);function J(e){if(e.refClass===`artifact`)return{refClass:`artifact`,kind:e.kind,id:e.id};if(e.refClass===`entity`)return{refClass:`entity`,entityType:e.entityType,id:e.id}}function Y(e){return e.refClass===`artifact`?JSON.stringify([`artifact`,e.kind,e.id]):JSON.stringify([`entity`,e.entityType,e.id])}function un(e){return e.refClass===`artifact`?`artifact:${e.kind}/${e.id}`:`entity:${e.entityType}/${e.id}`}const dn=[`relation-target`,`data`];function fn(e,t){if(!e||e.length===0)return{ok:!0,rules:[]};let n=[];for(let[r,i]of e.entries()){for(let[e,a]of i.by.entries())(!dn.includes(a.kind)||!t.includes(a.kind))&&n.push({ruleIndex:r,selectorIndex:e,capability:a.kind,message:`rule #${r}, selector #${e}: '${a.kind}' selectors are not supported`});i.lifecycleStates!==void 0&&!t.includes(`lifecycle-states`)&&n.push({ruleIndex:r,capability:`lifecycle-states`,message:`rule #${r}: lifecycleStates is declared but 'lifecycle-states' is not a supported capability`})}return n.length>0?{ok:!1,issues:n}:{ok:!0,rules:e}}function pn(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return;n=Reflect.get(n,e)}return{value:n}}function mn(e,t,n,r){let{path:i}=e,a=pn(t,i);if(a===void 0||a.value===null||a.value===void 0)return{ruleIndex:n,selectorIndex:r,reason:`missing-value`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': no value found`};let{value:o}=a;return typeof o!=`string`&&typeof o!=`number`&&typeof o!=`boolean`?{ruleIndex:n,selectorIndex:r,reason:`unsupported-value-type`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': value must be a scalar (string, number, or boolean)`}:{path:i,value:o}}function hn(e,t,n,r,i){if(e.kind===`data`)return mn(e,n,r,i);let{relationType:a}=e,o=t.filter(e=>e.type===a&&e.sourceLocalId===void 0),s=new Set,c,l;for(let e of o){let t=J(e.target);if(t===void 0){l=e.target.refClass;break}s.add(Y(t)),c=t}return l===void 0?c===void 0?{ruleIndex:r,selectorIndex:i,reason:`missing-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': no relations of this type found`}:s.size>1?{ruleIndex:r,selectorIndex:i,reason:`ambiguous-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': ${s.size} distinct targets; expected exactly one`}:{type:a,target:c}:{ruleIndex:r,selectorIndex:i,reason:`unsupported-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': found a relation with refClass '${l}'; only artifact and entity targets are supported`}}function gn(e){return`target`in e?[`relation-target`,e.type,Y(e.target)]:[`data`,e.path,e.value]}function _n(e,t,n){let r=[],i=[];for(let[a,o]of e.entries()){let e=o.by.map((e,r)=>hn(e,t,n,a,r)),s=e.filter(e=>`reason`in e);if(s.length>0){i.push(...s);continue}let c=e.filter(e=>!(`reason`in e)),l=JSON.stringify(c.map(e=>gn(e)));r.push({rule:o,ruleIndex:a,parts:c,serialized:l})}return{keys:r,issues:i}}function vn(e){return e.parts.map(e=>`target`in e?`${e.type} → ${un(e.target)}`:`${e.path} → ${JSON.stringify(e.value)}`).join(`; `)}function yn(e,t,n){let r=[];for(let[i,a]of(e??[]).entries()){if(!bn(a,n))continue;let e=xn(a,t);e<a.minItems&&r.push({index:i,requirement:a,reason:`below-min-items`,count:e}),a.maxItems!==void 0&&e>a.maxItems&&r.push({index:i,requirement:a,reason:`above-max-items`,count:e})}return r}function bn(e,t){return e.when===void 0?!0:pn(t,e.when.path)?.value===e.when.equals}function xn(e,t){let n=new Set;for(let r of t){if(r.sourceLocalId!==void 0||r.type!==e.relationType)continue;let t=J(r.target);t?.refClass===`artifact`&&(e.targetKinds?.length&&!e.targetKinds.includes(t.kind)||n.add(Y(t)))}return n.size}var X=class extends Error{type;field;constructor(e,t,n,r){super(`Relation type '${e}' is already registered with different ${t} (existing: '${n}', new: '${r}')`),this.name=`RelationTypeConflictError`,this.type=e,this.field=t}};function Sn(e){return{...e.sourceKinds===void 0?{}:{sourceKinds:e.sourceKinds},...e.targetKinds===void 0?{}:{targetKinds:e.targetKinds},...e.targetRefClasses===void 0?{}:{targetRefClasses:e.targetRefClasses}}}function Z(e){return e.endpoints??[Sn(e)]}function Q(e,t){return e===void 0?!0:t!==void 0&&e.includes(t)}function Cn(e,t){return Q(e.sourceKinds,t.sourceKind)&&Q(e.targetKinds,t.targetKind)&&Q(e.targetRefClasses,t.targetRefClass)}function wn(e,t){let n=e.implication===void 0||e.implication===e.type;if(!(e.symmetry!==`symmetric`||!n||t.targetRefClass!==`artifact`||t.targetKind===void 0))return{sourceKind:t.targetKind,targetRefClass:`artifact`,targetKind:t.sourceKind}}function Tn(e,t){let n=wn(e,t);return Z(e).some(e=>Cn(e,t)||n!==void 0&&Cn(e,n))}function $(e){return e===void 0?void 0:[...new Set(e)].sort()}function En(e){return Sn({sourceKinds:$(e.sourceKinds),targetKinds:$(e.targetKinds),targetRefClasses:$(e.targetRefClasses)})}function Dn(e){return JSON.stringify([e.sourceKinds??null,e.targetKinds??null,e.targetRefClasses??null])}function On(e){return Object.keys(e).length===0}function kn(e){let t=new Map;for(let n of e){let e=En(n);if(On(e))return;t.set(Dn(e),e)}return[...t.entries()].sort(([e],[t])=>e<t?-1:+(e>t)).map(([,e])=>e)}function An(e,t){let n=kn(t);return{type:e.type,symmetry:e.symmetry,...e.implication===void 0?{}:{implication:e.implication},...n===void 0?{}:{endpoints:n}}}function jn(e){return An(e,Z(e))}function Mn(e,t){if(e.implication!==void 0&&t.implication!==void 0&&e.implication!==t.implication)throw new X(e.type,`implication`,e.implication,t.implication);return e.implication??t.implication}function Nn(e,t){if(e.type!==t.type)throw Error(`Cannot merge relation type '${t.type}' into relation type '${e.type}'`);if(e.symmetry!==t.symmetry)throw new X(e.type,`symmetry`,e.symmetry,t.symmetry);let n=Mn(e,t);return An({type:e.type,symmetry:e.symmetry,implication:n},[...Z(e),...Z(t)])}export{St as $,N as A,Ht as B,rn as C,Ue as Ct,R as D,ye as Dt,G as E,Oe as Et,Ft as F,D as G,jt as H,V as I,Et as J,ut as K,U as L,W as M,B as N,K as O,Ce as Ot,L as P,Ct as Q,P as R,nn as S,We as St,Xt as T,ke as Tt,Mt as U,H as V,yt as W,kt as X,xt as Y,bt as Z,Yt as _,Ge as _t,yn as a,_t as at,Kt as b,S as bt,vn as c,lt as ct,un as d,Xe as dt,A as et,Y as f,Ye as ft,Jt as g,Ke as gt,cn as h,T as ht,Tn as i,Ot as it,Rt as j,Vt as k,ln as l,st as lt,on as m,E as mt,Nn as n,vt as nt,fn as o,dt as ot,sn as p,Je as pt,ht as q,jn as r,At as rt,_n as s,M as st,X as t,Dt as tt,J as u,ct as ut,Wt as v,C as vt,q as w,He as wt,qt as x,w as xt,Gt as y,qe as yt,Ut as z};
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{n as t,o as n,s as r}from"./json-value-DM-EjTC1.mjs";import{S as i,T as a,_ as o,a as s,c,d as l,i as u,l as d,n as ee,p as te,r as ne,t as re,u as ie,w as f,x as ae,y as oe}from"./schemas-DmP_43fe.mjs";import{C as se,M as ce,a as le,d as p,h as ue,k as de,r as fe,s as m,t as h,x as pe}from"./kind-registration-CdjmVxY_.mjs";import{t as me}from"./zod-json-schema-ZUmGtQhT.mjs";import{t as he}from"./ajv-Cvnmw2yn.mjs";import{t as ge}from"./2020-CRfgqanb.mjs";import{t as _e}from"./dist-onY7e-pd.mjs";import{z as g}from"zod";import{createBusNamespace as ve}from"@makaio/framework/core";const ye=g.strictObject({evidence:f}),_=g.strictObject({kind:g.literal(`text`),text:g.string()}),[be,xe,Se]=f.options,Ce=g.union([be.pick({source:!0,location:!0}).extend({content:_}),xe.pick({source:!0,location:!0}).extend({content:_}),Se.pick({source:!0,location:!0}).extend({content:_})]);function v(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function y(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function we(e,t){if(t===`#`)return{node:e,pointer:``};if(!t.startsWith(`#/`))return;let n;try{n=decodeURIComponent(t.slice(1))}catch{return}let r=e;for(let e of n.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r)){if(!/^(0|[1-9]\d*)$/.test(t)||Number(t)>=r.length)return;r=r[Number(t)]}else{let e=v(r);if(!e||!Object.hasOwn(e,t))return;r=e[t]}}let i=typeof r==`boolean`?r:v(r);return i===void 0?void 0:{node:i,pointer:n}}function b(e,t){if(t===``)return!1;let n=e;for(let e of t.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(n=Array.isArray(n)?n[Number(t)]:v(n)?.[t],typeof v(n)?.$id==`string`)return!0}return!1}function Te(e,t,n){if(e[`x-makaio-value-type`]!==`evidence/v1`)return;let r=f.safeParse(t);if(!r.success)throw Error(`Invalid schema-declared evidence at ${n}`);return{evidence:r.data,dataPath:n}}function Ee(e,t,n,r){if(typeof t.$ref!=`string`)return!1;if(r)return!0;let i=we(e,t.$ref);return i===void 0?!0:typeof i.node!=`boolean`&&x(e,i.node,n,b(e,i.pointer))}function x(e,t,n=new WeakSet,r=!1){let i=v(t);if(!i||n.has(i))return!1;n.add(i);let a=r||i!==e&&typeof i.$id==`string`;if(i[`x-makaio-value-type`]===`evidence/v1`||typeof i.$dynamicRef==`string`||Ee(e,i,n,a)||[`additionalItems`,`additionalProperties`,`contains`,`else`,`if`,`items`,`then`,`unevaluatedItems`,`unevaluatedProperties`].some(t=>x(e,i[t],n,a))||[`allOf`,`anyOf`,`oneOf`,`prefixItems`].some(t=>Array.isArray(i[t])&&i[t].some(t=>x(e,t,n,a)))||Array.isArray(i.items)&&i.items.some(t=>x(e,t,n,a)))return!0;for(let t of[`dependentSchemas`,`dependencies`,`patternProperties`,`properties`]){let r=v(i[t]);if(r&&Object.values(r).some(t=>x(e,t,n,a)))return!0}return!1}var De=class{dataSchema;matchesSchema;occurrences=new Map;visited=new WeakMap;constructor(e,t){this.dataSchema=e,this.matchesSchema=t}extract(e){return this.visit(this.dataSchema,e,`/data`),[...this.occurrences.values()]}visit(e,t,n,r=``){let i=this.visited.get(e)??new Set;if(i.has(n))return;if(i.add(n),this.visited.set(e,i),typeof e.$dynamicRef==`string`)throw Error(`Evidence discovery does not support active $dynamicRef at ${n}`);if(typeof e.$ref==`string`){if(b(this.dataSchema,r))throw Error(`Evidence discovery does not support local $ref inside nested $id resource at ${n}`);let i=we(this.dataSchema,e.$ref);if(i===void 0)throw Error(`Cannot resolve local schema reference ${e.$ref} at ${n}`);if(typeof i.node!=`boolean`&&this.visit(i.node,t,n,i.pointer),this.dataSchema.$schema!==`https://json-schema.org/draft/2020-12/schema`)return}let a=Te(e,t,n);if(a){this.occurrences.set(n,a);return}this.visitCombiners(e,t,n,r),this.visitConditional(e,t,n,r),this.visitDependencies(e,t,n,r),this.assertSupportedApplicators(e,n,r),Array.isArray(t)?this.visitArray(e,t,n,r):typeof t==`object`&&t&&this.visitObject(e,t,n,r)}visitCombiners(e,t,n,r){for(let i of[`allOf`,`anyOf`,`oneOf`]){let a=e[i];if(Array.isArray(a))for(let[e,o]of a.entries()){let a=v(o),s=`${r}/${i}/${e}`;a&&(i===`allOf`||this.matchesSchema(this.dataSchema,s,t))&&this.visit(a,t,n,s)}}}visitConditional(e,t,n,r){let i=typeof e.if==`boolean`?e.if:v(e.if);if(i===void 0)return;let a=`${r}/if`,o=this.matchesSchema(this.dataSchema,a,t);o&&typeof i!=`boolean`&&this.visit(i,t,n,a);let s=o?`then`:`else`,c=v(e[s]);c&&this.visit(c,t,n,`${r}/${s}`)}visitDependencies(e,t,n,r){if(!(typeof t!=`object`||!t||Array.isArray(t)))for(let i of[`dependentSchemas`,`dependencies`]){let a=v(e[i]);if(a)for(let[e,o]of Object.entries(a)){let a=v(o);Object.hasOwn(t,e)&&a&&this.visit(a,t,n,`${r}/${i}/${y(e)}`)}}}assertSupportedApplicators(e,t,n){for(let r of[`unevaluatedProperties`,`unevaluatedItems`])if(x(this.dataSchema,e[r],void 0,b(this.dataSchema,n)))throw Error(`Evidence under unsupported ${r} applicator at ${t}`)}visitArray(e,t,n,r){let i=Array.isArray(e.prefixItems),a=i?e.prefixItems:Array.isArray(e.items)?e.items:[];a.forEach((e,a)=>{let o=v(e),s=i?`prefixItems`:`items`;o&&a<t.length&&this.visit(o,t[a],`${n}/${a}`,`${r}/${s}/${a}`)});let o=Array.isArray(e.items)?v(e.additionalItems):v(e.items);if(o){let i=Array.isArray(e.items)?`additionalItems`:`items`;t.slice(a.length).forEach((e,t)=>this.visit(o,e,`${n}/${a.length+t}`,`${r}/${i}`))}this.visitContains(e,t,n,r)}visitContains(e,t,n,r){let i=v(e.contains);if(!i)return;let a=`${r}/contains`;t.forEach((e,t)=>{this.matchesSchema(this.dataSchema,a,e)&&this.visit(i,e,`${n}/${t}`,a)})}visitObject(e,t,n,r){let i=v(e.properties),a=v(e.patternProperties);for(let[o,s]of Object.entries(t)){let t=y(o),c=i!==void 0&&Object.hasOwn(i,o),l=v(i?.[o]);l&&this.visit(l,s,`${n}/${t}`,`${r}/properties/${t}`);let u=this.visitPatterns(a,o,s,`${n}/${t}`,r),d=v(e.additionalProperties);!c&&!u&&d&&this.visit(d,s,`${n}/${t}`,`${r}/additionalProperties`)}}visitPatterns(e,t,n,r,i){let a=!1;for(let[o,s]of Object.entries(e??{})){if(!new RegExp(o,`u`).test(t))continue;a=!0;let e=v(s);e&&this.visit(e,n,r,`${i}/patternProperties/${y(o)}`)}return a}};function Oe(e,t,n){return new De(e,n.matchesSchema).extract(t)}function ke(e){let{dataSchema:t,hooks:n,...r}=e,i={$schema:`https://json-schema.org/draft/2020-12/schema`,...me(t)};de(i);let a=le.parse({...r,dataSchema:i});if(a.kind!==e.kind)throw Error(`Artifact kind identifiers must not contain surrounding whitespace`);let o=g.fromJSONSchema(a.dataSchema),s=g.unknown().superRefine((e,t)=>{let n=o.safeParse(e);if(!n.success)for(let e of n.error.issues)t.addIssue({code:`custom`,path:e.path,message:e.message})}).pipe(t).superRefine((e,t)=>{Object.hasOwn(e,`slug`)&&t.addIssue({code:`custom`,path:[pe],message:se});try{ce(e,a.titlePath)}catch(e){t.addIssue({code:`custom`,path:a.titlePath.split(`.`),message:e instanceof Error?e.message:`Artifact title must be a nonblank string`})}});return{...structuredClone(a),kind:e.kind,schemaVersion:e.schemaVersion,dataSchema:s,...n?{hooks:n}:{},toRegistration:()=>structuredClone(a)}}var Ae=e(he(),1),je=e(ge(),1),Me=e(_e(),1);function Ne(e){let t={allErrors:!0,strict:!1,strictSchema:!0},n=e.dataSchema.$schema===`https://json-schema.org/draft/2020-12/schema`?new je.default(t):new Ae.default(t);return(0,Me.default)(n),n.addKeyword({keyword:i,schemaType:`string`,valid:!0}),n.compile(e.dataSchema)}function Pe(e){return e.replace(/~1/gu,`/`).replace(/~0/gu,`~`)}function Fe(e){let t=e.instancePath.split(`/`).slice(1).map(Pe),n=e.keyword===`required`?e.params.missingProperty:e.params.additionalProperty;return typeof n==`string`&&(e.keyword===`required`||e.keyword===`additionalProperties`)&&t.push(n),t.join(`.`)}function Ie(e){if(e.keyword!==`type`)return;let t=e.params.type;if(typeof t==`string`)return t;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t.join(` | `)}const Le=n.array();function Re(e){if(e.keyword!==`enum`)return;let t=Le.safeParse(e.params.allowedValues);return t.success?t.data:void 0}function ze(e){return(e??[]).map(e=>{let t=Ie(e),n=Re(e);return{path:Fe(e),reason:e.message??`violates ${e.keyword}`,...t===void 0?{}:{expectedType:t},...n===void 0?{}:{allowedValues:n}}})}function Be(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`slug`)}const Ve={path:pe,reason:se};function He(e){let t=Ne(e);return e=>t(e)&&!Be(e)}function Ue(e){let t=Ne(e);return e=>{let n=t(e)?[]:ze(t.errors);return Be(e)&&n.push(Ve),n.length===0?{valid:!0}:{valid:!1,issues:n}}}function We(e){return{hooks:[...e.hooks]}}const Ge=[`inline`,`summary`,`link`,`omit`],Ke=[`outbound`,`inbound`],S=g.string().min(1),C=g.enum(Ke),qe=g.object({kinds:g.array(g.string().min(1)).optional(),hint:S.optional(),depth:g.number().int().min(1).max(20).optional(),nested:g.lazy(()=>w).optional(),direction:C.optional()}),w=g.record(g.string().min(1),qe);function T(e){return JSON.stringify([e.kind,e.id,e.revision])}const Je=g.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),Ye=g.object({target:d,sourceRef:a,relationType:g.string().min(1),sourceLocalId:c.shape.sourceLocalId,direction:C.optional(),hint:S,status:g.enum([`resolved`,`unresolved`]),reason:Je.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:g.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:g.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:g.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),E=g.object({rootRef:a,refs:g.array(Ye),resolved:g.array(l)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(T));n.has(T(e.rootRef))||t.addIssue({code:g.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(T(e.sourceRef))||t.addIssue({code:g.ZodIssueCode.custom,path:[`refs`,r,`sourceRef`],message:`artifact context ref sources must have a matching revision in resolved`}),!(e.status!==`resolved`||e.target.refClass!==`artifact`)&&(n.has(T(e.target))||t.addIssue({code:g.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function Xe(e){let t=E.parse(e),n=new Map(t.resolved.map(e=>[T(e),e])),r=new Map;for(let e of t.refs){let t=T(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(T(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${T(t.rootRef)}'`);let a=Ze(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return et(a,e),e}}}function Ze(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:$e(e,r,i,new Set([T(e)]))}}function Qe(e,t,n,r,i,a,o,s,c){let l=T(e),u=new Set(c);return u.add(l),{status:`resolved`,ref:e,artifact:t,relation:n,sourceLocalId:r,direction:i,hint:a,children:$e(e,o,s,u)}}function $e(e,t,n,r){return(t.get(T(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=T(e.target),a=n.get(i);if(!a)throw Error(`Resolved artifact context is missing target artifact '${i}'`);return r.has(i)?{status:`unresolved`,target:e.target,relation:e.relationType,sourceLocalId:e.sourceLocalId,direction:e.direction,hint:e.hint,reason:`cycle-detected`}:Qe(e.target,a,e.relationType,e.sourceLocalId,e.direction,e.hint,t,n,r)})}function et(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)et(n,t)}}const D=[`$set`,`$unset`,`$push`,`$pull`],O=`[A-Za-z_$][A-Za-z0-9_$]*`,k=`[A-Za-z_$][A-Za-z0-9_$-]*`,tt=`(?:0|[1-9][0-9]*)`,nt=`(?:${`\\$\\[${O}\\]`}|${tt}|${k})`,rt=RegExp(`^${k}(?:\\.${nt})*$`),it=RegExp(`^${O}(?:\\.${k})*$`),at=RegExp(`^${tt}$`),ot=RegExp(`^\\$\\[(${O})\\]$`),A=g.string().regex(rt,`Expected a data-relative path of object properties, array positions, or $[filter] placeholders`);function st(e){let t=ot.exec(e);return t?.[1]===void 0?at.test(e)?{kind:`index`,index:Number(e)}:{kind:`property`,name:e}:{kind:`filter`,placeholder:t[1]}}function ct(e){return e.split(`.`).map(st)}function lt(e){return ct(e).flatMap(e=>e.kind===`filter`?[e.placeholder]:[])}const ut=r(g.record(g.string().regex(it,`Expected a filter key of the form name or name.field.path`),n),{prototypeKey:`an array filter cannot compare a __proto__ key, which JSON transport drops`,nonPlainObject:`an array filter must be a plain object of comparison keys`,symbolKey:`an array filter cannot carry symbol-keyed comparisons`,nonEnumerableKey:`an array filter cannot carry non-enumerable comparison keys`,extraArrayKey:`an array filter must be a plain object, not an array`});function dt(e){let t=new Set(Object.keys(e).map(e=>e.split(`.`)[0]));if(t.size!==1)return;let[n]=t;return n!==void 0&&n.length>0?n:void 0}function j(e,t){return r(g.record(A,t),{prototypeKey:`${e} cannot address __proto__, which JSON transport drops`,nonPlainObject:`${e} must be a plain object of path instructions`,symbolKey:`${e} cannot carry symbol-keyed instructions`,nonEnumerableKey:`${e} cannot carry non-enumerable instructions`,extraArrayKey:`${e} must be a plain object, not an array`})}const ft=g.literal(!0),pt=g.strictObject({$set:j(`$set`,n).optional(),$unset:j(`$unset`,ft).optional(),$push:j(`$push`,n).optional(),$pull:j(`$pull`,n).optional(),arrayFilters:g.array(ut).optional()});function M(e){return D.flatMap(t=>Object.entries(e[t]??{}).map(([e,n])=>({operator:t,path:e,value:n})))}function mt(e,t){let n=M(e),r=new Map;(e.arrayFilters??[]).forEach((e,n)=>{let i=dt(e);if(i===void 0){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`An array filter must bind exactly one placeholder name across all of its keys`});return}if(r.has(i)){t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter placeholder ${i} is already bound by another filter`});return}r.set(i,n)});let i=new Set;for(let{operator:e,path:a}of n)for(let n of lt(a))i.add(n),r.has(n)||t.addIssue({code:`custom`,path:[e,a],message:`Path uses placeholder $[${n}] without a matching entry in arrayFilters`});for(let[e,n]of r)i.has(e)||t.addIssue({code:`custom`,path:[`arrayFilters`,n],message:`Array filter binds placeholder ${e}, which no path uses`})}const ht=pt.superRefine(mt).superRefine((e,t)=>{M(e).length===0&&t.addIssue({code:`custom`,message:`Declare at least one of ${D.join(`, `)}`})}),gt=pt.superRefine(mt),_t=g.strictObject({kind:a.shape.kind,id:a.shape.id}),vt=g.strictObject({ref:_t,baseRevision:a.shape.revision,patch:gt,dryRun:g.boolean().optional(),schemaVersion:p.optional().describe(`Target schema version for the patched revision; defaults to the base revision's. Use it to migrate an artifact left at an older version by a kind bump.`),statusPath:te.optional(),representations:ie.strict().nullable().optional().describe(`Rendering hints (markdown, summary, plaintext) for the new revision. Omit to keep the previous revision's hints. An object replaces all of them, it does not merge: send every hint you want to keep. null clears them.`)}).superRefine((e,t)=>{e.schemaVersion===void 0&&M(e.patch).length===0&&t.addIssue({code:`custom`,path:[`patch`],message:`Declare at least one of ${D.join(`, `)}, or name a schemaVersion to migrate a payload that already fits`})}),yt=[`ARTIFACT_NOT_FOUND`,`BASE_REVISION_CONFLICT`,`KIND_NOT_REGISTERED`,`SCHEMA_VERSION_MISMATCH`,`PATH_NOT_DECLARED`,`PATH_NOT_RESOLVABLE`,`TARGET_NOT_A_COLLECTION`,`UNSUPPORTED_TARGET`,`NO_MATCH`,`SCHEMA_VALIDATION_FAILED`,`PAYLOAD_INVARIANT_FAILED`,`NO_CHANGE`,`STORE_REJECTED`,`HOST_FAILED`],bt=g.strictObject({path:g.string(),reason:g.string().min(1),expectedType:g.string().min(1).optional(),allowedValues:g.array(n).optional()}),xt=g.strictObject({code:g.enum(yt),message:g.string().min(1),operator:g.enum(D).optional(),path:A.optional(),currentRevision:a.shape.revision.optional(),issues:g.array(bt).optional(),repair:g.string().min(1)}).superRefine((e,t)=>{e.code===`BASE_REVISION_CONFLICT`&&e.currentRevision===void 0&&t.addIssue({code:g.ZodIssueCode.custom,message:`A BASE_REVISION_CONFLICT must name the revision the artifact carries.`,path:[`currentRevision`]})}),St=g.strictObject({operator:g.enum(D),path:A,matched:g.number().int().positive()}),Ct=g.strictObject({from:p,to:p}).refine(e=>e.to>e.from,{path:[`to`],message:`A migration moves the artifact forward to a newer schema version`}),wt=g.strictObject({ok:g.literal(!0),base:a,operations:g.array(St),migration:Ct.optional()});function Tt(e,t){e.operations.length===0&&e.migration===void 0&&t.addIssue({code:`custom`,path:[`operations`],message:`A success without a migration must report at least one applied instruction`})}const Et=wt.extend({dryRun:g.literal(!0)}).superRefine(Tt),Dt=wt.extend({dryRun:g.literal(!1),artifact:a}).superRefine(Tt),Ot=g.discriminatedUnion(`dryRun`,[Et,Dt]),kt=g.strictObject({ok:g.literal(!1),error:xt}),At=g.union([Ot,kt]),jt=g.object({ref:oe}),Mt=g.union([g.strictObject({ok:g.literal(!0),ref:oe,areaPath:fe,part:t}),g.strictObject({ok:g.literal(!1),error:ue})]),N=a.pick({kind:!0,id:!0}),P=g.number().int().positive(),F=P,I={knowledge:`valid`,commitment:`proposed`,interaction:`open`},L=g.discriminatedUnion(`category`,[g.strictObject({category:g.literal(`knowledge`),state:g.enum(h.knowledge),version:F}),g.strictObject({category:g.literal(`commitment`),state:g.enum(h.commitment),version:F}),g.strictObject({category:g.literal(`interaction`),state:g.enum(h.interaction),version:F})]).superRefine((e,t)=>{e.version===1&&e.state!==I[e.category]&&t.addIssue({code:`custom`,path:[`state`],message:`Lifecycle version 1 is reserved for the category initial state`})}),R=g.union([L,g.strictObject({category:g.literal(`record`)})]),z=g.string().trim().min(1),Nt=g.strictObject({kind:z,ref:z}),B=g.discriminatedUnion(`kind`,[g.strictObject({kind:g.literal(`revision-assessment`),assessedRevision:a.shape.revision,source:Nt.optional()}),g.strictObject({kind:g.literal(`handover`),source:Nt})]),Pt={artifact:N,expectedVersion:F,state:m,situation:B,reason:z.optional()},V=g.strictObject(Pt),Ft=g.strictObject({...Pt,actor:re}),It={valid:[`retired`],retired:[`valid`],proposed:[`decided`],decided:[`fulfilled`,`revoked`],fulfilled:[],revoked:[],open:[`resolved`,`closed-without-resolution`],resolved:[],"closed-without-resolution":[]};function H(e,t){return It[e].includes(t)}const Lt={artifact:N,lifecycle:L,actor:re,timestamp:g.number().int().nonnegative(),observedRevision:a.shape.revision},Rt=g.strictObject({...Lt,operation:g.literal(`initialized`)}).superRefine((e,t)=>{(e.lifecycle.version!==1||e.lifecycle.state!==I[e.lifecycle.category])&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`Initialization requires the category initial state and version 1`})});function zt(e,t){return t===`retired`||e===`retired`&&t===`valid`}const Bt=`Retiring or reinstating knowledge requires a reason`,U=g.strictObject({...Lt,operation:g.literal(`transitioned`),previousState:m,situation:B,reason:V.shape.reason}).superRefine((e,t)=>{(!H(e.previousState,e.lifecycle.state)||e.lifecycle.version<=1)&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`History requires a category-compatible transition after initialization`}),zt(e.previousState,e.lifecycle.state)&&!e.reason&&t.addIssue({code:`custom`,path:[`reason`],message:Bt}),e.situation.kind===`revision-assessment`&&e.situation.assessedRevision!==e.observedRevision&&t.addIssue({code:`custom`,path:[`situation`],message:`An assessment cannot authorize a different observed content revision`})}),Vt=g.discriminatedUnion(`operation`,[Rt,U]),W=g.discriminatedUnion(`reason`,[g.strictObject({reason:g.literal(`lifecycle-version-conflict`),expectedVersion:F,current:L,requestedState:m}),g.strictObject({reason:g.literal(`content-basis-conflict`),assessedRevision:a.shape.revision,currentRevision:a.shape.revision}),g.strictObject({reason:g.literal(`invalid-transition`),current:R,requestedState:m}),g.strictObject({reason:g.literal(`precondition-failed`),current:L,requestedState:m})]),G=`artifact-lifecycle-rejected`;var K=class extends Error{code=G;data;constructor(e,t){super(e),this.name=`ArtifactLifecycleError`,this.data=W.parse(t)}};function Ht(e){return e===`record`?{category:`record`}:L.parse({category:e,state:I[e],version:1})}function Ut(e){let t=R.parse(e.current),n=a.shape.revision.parse(e.currentRevision),r=Ft.parse(e.command);if(t.category===`record`)throw new K(`Record artifacts do not have a lifecycle`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(r.expectedVersion!==t.version)throw new K(`Artifact lifecycle changed since the supplied baseline`,{reason:`lifecycle-version-conflict`,expectedVersion:r.expectedVersion,current:t,requestedState:r.state});if(r.situation.kind===`revision-assessment`&&r.situation.assessedRevision!==n)throw new K(`Assessed content revision is no longer current`,{reason:`content-basis-conflict`,assessedRevision:r.situation.assessedRevision,currentRevision:n});if(!H(t.state,r.state))throw new K(`Artifact lifecycle transition is not allowed`,{reason:`invalid-transition`,current:t,requestedState:r.state});if(zt(t.state,r.state)&&!r.reason)throw new K(Bt,{reason:`precondition-failed`,current:t,requestedState:r.state});return L.parse({...t,state:r.state,version:t.version+1})}const Wt=g.strictObject({artifact:N}),Gt=g.strictObject({lifecycle:R}),Kt=g.strictObject({artifact:N,afterVersion:P.optional(),limit:g.number().int().min(1).max(100).default(50)}),qt=g.strictObject({entries:g.array(Vt).max(100),nextCursor:P.optional()}).superRefine(({entries:e,nextCursor:t},n)=>{let r=e[0],i;for(let[t,a]of e.entries()){let e=a.artifact.kind===r?.artifact.kind&&a.artifact.id===r?.artifact.id,o=i===void 0||a.lifecycle.version===i.lifecycle.version+1,s=i===void 0||a.operation===`transitioned`&&a.lifecycle.category===i.lifecycle.category&&a.previousState===i.lifecycle.state;if(!e||!o||!s){n.addIssue({code:`custom`,path:[`entries`,t],message:`History pages contain one artifact in contiguous ascending, state-linked order`});break}i=a}t!==void 0&&t!==i?.lifecycle.version&&n.addIssue({code:`custom`,path:[`nextCursor`],message:`nextCursor must equal the last returned lifecycle version`})}),q=g.strictObject({entry:U}),Jt=q,Yt=g.strictObject({code:g.literal(G),message:g.string().min(1),data:W});function Xt(e){return{code:e.code,message:e.message,data:e.data}}function Zt(e,t){switch(t.reason){case`content-basis-conflict`:return en(e,t);case`lifecycle-version-conflict`:return[...Qt(e,t),...$t(e,t)];case`invalid-transition`:case`precondition-failed`:return[...Qt(e,t),...tn(e,t)]}}function Qt(e,t){return t.requestedState===e.state?[]:[{path:[`requestedState`],message:`Rejection requestedState must match the rejected transition`}]}function $t(e,t){let n=[];return t.expectedVersion!==e.expectedVersion&&n.push({path:[`expectedVersion`],message:`Version conflict baseline must match the rejected transition`}),t.current.version===e.expectedVersion&&n.push({path:[`current`,`version`],message:`Version conflict requires a current version different from the supplied baseline`}),n}function en(e,t){let n=[];return(e.situation.kind!==`revision-assessment`||t.assessedRevision!==e.situation.assessedRevision)&&n.push({path:[`assessedRevision`],message:`Content conflict must identify the rejected revision assessment`}),t.currentRevision===t.assessedRevision&&n.push({path:[`currentRevision`],message:`Content conflict requires a current revision different from the assessed revision`}),n}function tn(e,t){if(t.current.category===`record`)return[];let n=[];t.current.version!==e.expectedVersion&&n.push({path:[`current`,`version`],message:`A rejection after the version check must report the supplied baseline version`});let r=H(t.current.state,t.requestedState);return t.reason===`invalid-transition`&&r&&n.push({path:[`reason`],message:`invalid-transition requires a transition the lifecycle matrix disallows`}),t.reason===`precondition-failed`&&!r&&n.push({path:[`reason`],message:`precondition-failed requires a transition the lifecycle matrix allows`}),n}const nn=g.strictObject({transition:V,error:Yt}).superRefine(({transition:e,error:t},n)=>{for(let r of Zt(e,t.data))n.addIssue({code:`custom`,path:[`error`,`data`,...r.path],message:r.message})}),rn={"lifecycle.get":{request:Wt,response:Gt},"lifecycle.history":{request:Kt,response:qt},"lifecycle.transition":{request:V,response:q},"lifecycle.committed":Jt,"lifecycle.rejected":nn},an=l.omit({id:!0,slug:!0,revision:!0,timestamp:!0}),on={...rn,"kind.register":{request:le,response:g.object({registered:g.boolean()})},"kind.list":{request:g.object({kind:g.string().min(1).optional()}),response:g.object({kinds:g.array(le)})},"relation-type.register":{request:ae,response:g.object({registered:g.boolean()})},"relation-type.list":{request:g.object({type:g.string().min(1).optional()}),response:g.object({relationTypes:g.array(ae)})},create:{request:an.extend({id:a.shape.id.optional(),slug:l.shape.slug.optional()}),response:g.object({artifact:l})},revise:{request:g.object({previous:a,statusPath:te.optional(),revision:an}),response:g.object({artifact:l})},patch:{request:vt,response:At},resolve:{request:g.object({ref:a}),response:g.object({artifact:l.nullable()})},resolvePart:{request:jt,response:Mt},query:{request:s,response:g.object({artifacts:g.array(l)})},compare:{request:ee,response:ne},"evidence.resolve":{request:ye,response:Ce},resolveContext:{request:g.object({ref:a,selectors:w.optional(),maxDepth:g.number().int().min(1).max(20).default(5)}),response:g.object({context:E})},created:g.object({artifact:l}),revised:g.object({previous:a,artifact:l}),"relation.added":g.object({artifact:a,relation:c}),"observation.added":g.object({artifact:a,observation:u}),"status.changed":g.object({artifact:a,path:g.string().min(1),previous:g.unknown().optional(),current:g.unknown().optional()}),"kind.changed":g.object({kind:g.string().min(1),schemaVersion:p})},sn=ve(`artifact`,on),cn=sn.subjects,ln=g.discriminatedUnion(`refClass`,[a.omit({revision:!0}),o]);function J(e){if(e.refClass===`artifact`)return{refClass:`artifact`,kind:e.kind,id:e.id};if(e.refClass===`entity`)return{refClass:`entity`,entityType:e.entityType,id:e.id}}function Y(e){return e.refClass===`artifact`?JSON.stringify([`artifact`,e.kind,e.id]):JSON.stringify([`entity`,e.entityType,e.id])}function un(e){return e.refClass===`artifact`?`artifact:${e.kind}/${e.id}`:`entity:${e.entityType}/${e.id}`}const dn=[`relation-target`,`data`];function fn(e,t){if(!e||e.length===0)return{ok:!0,rules:[]};let n=[];for(let[r,i]of e.entries()){for(let[e,a]of i.by.entries())(!dn.includes(a.kind)||!t.includes(a.kind))&&n.push({ruleIndex:r,selectorIndex:e,capability:a.kind,message:`rule #${r}, selector #${e}: '${a.kind}' selectors are not supported`});i.lifecycleStates!==void 0&&!t.includes(`lifecycle-states`)&&n.push({ruleIndex:r,capability:`lifecycle-states`,message:`rule #${r}: lifecycleStates is declared but 'lifecycle-states' is not a supported capability`})}return n.length>0?{ok:!1,issues:n}:{ok:!0,rules:e}}function pn(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return;n=Reflect.get(n,e)}return{value:n}}function mn(e,t,n,r){let{path:i}=e,a=pn(t,i);if(a===void 0||a.value===null||a.value===void 0)return{ruleIndex:n,selectorIndex:r,reason:`missing-value`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': no value found`};let{value:o}=a;return typeof o!=`string`&&typeof o!=`number`&&typeof o!=`boolean`?{ruleIndex:n,selectorIndex:r,reason:`unsupported-value-type`,dataPath:i,message:`rule #${n}, selector #${r}, data path '${i}': value must be a scalar (string, number, or boolean)`}:{path:i,value:o}}function hn(e,t,n,r,i){if(e.kind===`data`)return mn(e,n,r,i);let{relationType:a}=e,o=t.filter(e=>e.type===a&&e.sourceLocalId===void 0),s=new Set,c,l;for(let e of o){let t=J(e.target);if(t===void 0){l=e.target.refClass;break}s.add(Y(t)),c=t}return l===void 0?c===void 0?{ruleIndex:r,selectorIndex:i,reason:`missing-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': no relations of this type found`}:s.size>1?{ruleIndex:r,selectorIndex:i,reason:`ambiguous-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': ${s.size} distinct targets; expected exactly one`}:{type:a,target:c}:{ruleIndex:r,selectorIndex:i,reason:`unsupported-target`,relationType:a,message:`rule #${r}, selector #${i}, relation '${a}': found a relation with refClass '${l}'; only artifact and entity targets are supported`}}function gn(e){return`target`in e?[`relation-target`,e.type,Y(e.target)]:[`data`,e.path,e.value]}function _n(e,t,n){let r=[],i=[];for(let[a,o]of e.entries()){let e=o.by.map((e,r)=>hn(e,t,n,a,r)),s=e.filter(e=>`reason`in e);if(s.length>0){i.push(...s);continue}let c=e.filter(e=>!(`reason`in e)),l=JSON.stringify(c.map(e=>gn(e)));r.push({rule:o,ruleIndex:a,parts:c,serialized:l})}return{keys:r,issues:i}}function vn(e){return e.parts.map(e=>`target`in e?`${e.type} → ${un(e.target)}`:`${e.path} → ${JSON.stringify(e.value)}`).join(`; `)}function yn(e,t,n){let r=[];for(let[i,a]of(e??[]).entries()){if(!bn(a,n))continue;let e=xn(a,t);e<a.minItems&&r.push({index:i,requirement:a,reason:`below-min-items`,count:e}),a.maxItems!==void 0&&e>a.maxItems&&r.push({index:i,requirement:a,reason:`above-max-items`,count:e})}return r}function bn(e,t){return e.when===void 0?!0:pn(t,e.when.path)?.value===e.when.equals}function xn(e,t){let n=new Set;for(let r of t){if(r.sourceLocalId!==void 0||r.type!==e.relationType)continue;let t=J(r.target);t?.refClass===`artifact`&&(e.targetKinds?.length&&!e.targetKinds.includes(t.kind)||n.add(Y(t)))}return n.size}var X=class extends Error{type;field;constructor(e,t,n,r){super(`Relation type '${e}' is already registered with different ${t} (existing: '${n}', new: '${r}')`),this.name=`RelationTypeConflictError`,this.type=e,this.field=t}};function Sn(e){return{...e.sourceKinds===void 0?{}:{sourceKinds:e.sourceKinds},...e.targetKinds===void 0?{}:{targetKinds:e.targetKinds},...e.targetRefClasses===void 0?{}:{targetRefClasses:e.targetRefClasses}}}function Z(e){return e.endpoints??[Sn(e)]}function Q(e,t){return e===void 0?!0:t!==void 0&&e.includes(t)}function Cn(e,t){return Q(e.sourceKinds,t.sourceKind)&&Q(e.targetKinds,t.targetKind)&&Q(e.targetRefClasses,t.targetRefClass)}function wn(e,t){let n=e.implication===void 0||e.implication===e.type;if(!(e.symmetry!==`symmetric`||!n||t.targetRefClass!==`artifact`||t.targetKind===void 0))return{sourceKind:t.targetKind,targetRefClass:`artifact`,targetKind:t.sourceKind}}function Tn(e,t){let n=wn(e,t);return Z(e).some(e=>Cn(e,t)||n!==void 0&&Cn(e,n))}function $(e){return e===void 0?void 0:[...new Set(e)].sort()}function En(e){let t=Sn({sourceKinds:$(e.sourceKinds),targetKinds:$(e.targetKinds),targetRefClasses:$(e.targetRefClasses)});return e.description===void 0?t:{...t,description:e.description}}function Dn(e){return JSON.stringify([e.sourceKinds??null,e.targetKinds??null,e.targetRefClasses??null,e.description??null])}function On(e){return e.sourceKinds===void 0&&e.targetKinds===void 0&&e.targetRefClasses===void 0}function kn(e){let t=new Map;for(let n of e){let e=En(n);if(On(e))return;t.set(Dn(e),e)}return[...t.entries()].sort(([e],[t])=>e<t?-1:+(e>t)).map(([,e])=>e)}function An(e,t){let n=kn(t);return{type:e.type,symmetry:e.symmetry,...e.implication===void 0?{}:{implication:e.implication},...e.description===void 0?{}:{description:e.description},...n===void 0?{}:{endpoints:n}}}function jn(e){return An(e,Z(e))}function Mn(e,t){if(e.implication!==void 0&&t.implication!==void 0&&e.implication!==t.implication)throw new X(e.type,`implication`,e.implication,t.implication);return e.implication??t.implication}function Nn(e,t){if(e.description!==void 0&&t.description!==void 0&&e.description!==t.description)throw new X(e.type,`description`,e.description,t.description);return e.description??t.description}function Pn(e,t){if(e.type!==t.type)throw Error(`Cannot merge relation type '${t.type}' into relation type '${e.type}'`);if(e.symmetry!==t.symmetry)throw new X(e.type,`symmetry`,e.symmetry,t.symmetry);let n=Mn(e,t),r=Nn(e,t);return An({type:e.type,symmetry:e.symmetry,implication:n,description:r},[...Z(e),...Z(t)])}export{St as $,N as A,Ht as B,rn as C,Ue as Ct,R as D,ye as Dt,G as E,Oe as Et,Ft as F,D as G,jt as H,V as I,Et as J,ut as K,U as L,W as M,B as N,K as O,Ce as Ot,L as P,Ct as Q,P as R,nn as S,We as St,Xt as T,ke as Tt,Mt as U,H as V,yt as W,kt as X,xt as Y,bt as Z,Yt as _,Ge as _t,yn as a,_t as at,Kt as b,S as bt,vn as c,lt as ct,un as d,Xe as dt,A as et,Y as f,Ye as ft,Jt as g,Ke as gt,cn as h,T as ht,Tn as i,Ot as it,Rt as j,Vt as k,ln as l,st as lt,on as m,E as mt,Pn as n,vt as nt,fn as o,dt as ot,sn as p,Je as pt,ht as q,jn as r,At as rt,_n as s,M as st,X as t,Dt as tt,J as u,ct as ut,Wt as v,C as vt,q as w,He as wt,qt as x,w as xt,Gt as y,qe as yt,Ut as z};
|
package/dist/bus/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as ee,O as te,P as m,Q as ne,R as re,S as h,T as ie,U as g,V as ae,W as oe,X as se,Y as ce,Z as le,_ as ue,a as de,at as fe,b as pe,d as _,et as me,f as he,g as v,h as y,i as ge,it as b,j as x,k as S,l as C,m as w,nt as T,o as E,ot as D,p as O,q as k,r as A,rt as j,s as M,t as N,tt as P,u as F,v as I,w as L,x as _e,y as ve,z as ye}from"../bus-CtT6XeB_.mjs";import{z as R}from"zod";const z={"channel.open":{request:R.object({endpoint:R.string(),token:R.string(),clientPubKey:R.string(),transports:R.array(R.string())}),response:R.object({channelId:R.string(),endpointPubKey:R.string()})}};function B(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return btoa(n.join(``))}function V(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}async function H(){return globalThis.crypto.subtle.generateKey({name:`ECDH`,namedCurve:`P-256`},!1,[`deriveKey`])}async function U(e){return B(await globalThis.crypto.subtle.exportKey(`raw`,e))}async function W(e){let t=V(e);return globalThis.crypto.subtle.importKey(`raw`,t,{name:`ECDH`,namedCurve:`P-256`},!1,[])}async function G(e,t){return globalThis.crypto.subtle.deriveKey({name:`ECDH`,public:t},e,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function K(e,t,n){let r=globalThis.crypto.getRandomValues(new Uint8Array(12)),i=new TextEncoder().encode(t),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.encrypt(a,e,i);return{iv:B(r),data:B(o)}}async function q(e,t,n){let r=V(t.iv),i=V(t.data),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.decrypt(a,e,i);return new TextDecoder().decode(o)}function J(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!1,payload:{},local:!1,channel:!1}}}function Y(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!0,payload:{},local:!1,channel:!1}}}var X=class{channelId;sharedKey;context;transportNames;cleanups=[];pendingRequests=new Set;closed=!1;constructor(e,t,n,r){this.channelId=e,this.sharedKey=t,this.context=n,this.transportNames=r;let i=J(e,`$close`);this.cleanups.push(this.registerEventHandler(i,t,e=>{this.handlePeerClose()}))}on(e,t,n){this.assertOpen();let r=this.requireKey(),i=e.$meta.isRequest?this.registerRequestHandler(e,r,t,n):this.registerEventHandler(e,r,t,n);return this.cleanups.push(i),()=>{i();let e=this.cleanups.indexOf(i);e!==-1&&this.cleanups.splice(e,1)}}once(e,t){this.assertOpen();let n=this.requireKey(),r=null,i=(e=>{let n=r;if(r=null,n){let e=this.cleanups.indexOf(n);e!==-1&&this.cleanups.splice(e,1)}return n?.(),t(e)});return r=e.$meta.isRequest?this.registerRequestHandler(e,n,i):this.registerEventHandler(e,n,i),this.cleanups.push(r),()=>{if(r){let e=r;r=null;let t=this.cleanups.indexOf(e);t!==-1&&this.cleanups.splice(t,1),e()}}}async emit(e,t){this.assertOpen();let n=this.requireKey(),r=J(this.channelId,e.subject),i=await K(n,JSON.stringify(t),`${this.channelId}:${e.subject}:evt`);await w(this.context,r,i,{...this.transportNames?{transports:[...this.transportNames]}:{}})}async request(e,t,n){this.assertOpen();let r=this.requireKey(),i=new AbortController;this.pendingRequests.add(i);try{let a=Y(this.channelId,e.subject),o=await K(r,JSON.stringify(t),`${this.channelId}:${e.subject}:req`),s=await q(r,await _(this.context,a,o,{signal:i.signal,...n?.timeout===void 0?{}:{timeout:n.timeout},...this.transportNames?{transports:[...this.transportNames]}:{}}),`${this.channelId}:${e.subject}:res`);return JSON.parse(s)}finally{this.pendingRequests.delete(i)}}async requestOptional(e,t,n){try{return{handled:!0,data:await this.request(e,t,n)}}catch(e){if(e instanceof f)return{handled:!1};throw e}}close(){if(this.closed)return;this.closed=!0;let e=this.sharedKey;if(e){let t=J(this.channelId,`$close`);K(e,JSON.stringify({}),`${this.channelId}:$close:evt`).then(e=>w(this.context,t,e,{...this.transportNames?{transports:[...this.transportNames]}:{}})).catch(()=>{})}this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null}assertOpen(){if(this.closed)throw new c(this.channelId)}requireKey(){return this.sharedKey}registerEventHandler(e,t,n,r){let i=J(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:evt`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r);return n({...e,payload:i})},r)}registerRequestHandler(e,t,n,r){let i=Y(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:req`,o=`${this.channelId}:${e.subject}:res`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r),s,c=e=>{s={value:e}},l=e=>{s={value:{...s?.value??{},...e}}},u=async()=>{let n=s;if(await e.next(),n!==void 0){s=n;return}let r=e.result;if(r!==void 0){let e=await q(t,r,o);s={value:JSON.parse(e)}}};if(await n({...e,payload:i,get result(){return s?.value},setResult:c,extendResult:l,next:u}),s!==void 0){let n=await K(t,JSON.stringify(s.value),o);e.setResult(n)}},r)}handlePeerClose(){this.closed||(this.closed=!0,this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null)}abortPendingRequests(){let e=new c(this.channelId);for(let t of this.pendingRequests)t.abort(e);this.pendingRequests.clear()}runCleanups(){for(let e of this.cleanups)try{e()}catch{}this.cleanups.length=0}};function Z(t){return t.namespaceRegistry.registerNamespace(e(`system`,z)).subjects.channel.open}function be(e,t,n,r){let i=v(e,Z(e),async i=>{if(i.payload.endpoint!==t){await i.next();return}if(i.payload.token!==r.token)throw new g(t);let{publicKey:a,privateKey:o}=await H(),s=await G(o,await W(i.payload.clientPubKey)),c=globalThis.crypto.randomUUID(),l=new Set(e.transportRegistry.names()),u=new X(c,s,e,(i.payload.transports??[]).filter(e=>l.has(e)));try{n(u),i.setResult({channelId:c,endpointPubKey:await U(a)})}catch(e){throw u.close(),e}});return{name:t,token:r.token,close:i}}async function xe(e,t,n){let r=Z(e),{publicKey:i,privateKey:a}=await H(),o=await U(i),s=n.transports!==void 0,c=s?[...n.transports]:[...e.transportRegistry.names()],l=s?{transports:c}:void 0,u=await _(e,r,{endpoint:t,token:n.token,clientPubKey:o,transports:c},l),d=await G(a,await W(u.endpointPubKey));return new X(u.channelId,d,e,c)}var Se=class{pending;constructor(){this.pending=new Map}track(e,t,n){return new Promise((r,i)=>{if(n?.aborted){i(d(n.reason));return}let a=t===0?void 0:setTimeout(()=>{let n=this.pending.get(e);n!==void 0&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(new m(e,t)))},t);if(this.pending.set(e,{resolve:r,reject:i,timeoutId:a,removeAbortListener:void 0}),n){let t=()=>{this.reject(e,d(n.reason))};n.addEventListener(`abort`,t,{once:!0});let r=()=>{n.removeEventListener(`abort`,t)},i=this.pending.get(e);i&&(i.removeAbortListener=r)}n?.aborted&&this.reject(e,d(n.reason))})}resolve(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.resolve(t))}reject(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(t))}cancel(e,t){this.reject(e,t??d(void 0))}rejectAll(e){for(let[t,n]of this.pending.entries())clearTimeout(n.timeoutId),n.removeAbortListener?.(),n.reject(e);this.pending.clear()}cleanup(){this.rejectAll(Error(`Transport disconnected`))}};const Ce=e(`bus:lifecycle`,de).subjects;function we(e,t){let n={},r={},i={};for(let[t,a]of e)n[t]=a.priorities,r[t]=a.deliveryClass??`relayable`,a.filter!==void 0&&(i[t]=a.filter);return{type:`subscribe`,...t===void 0?{}:{ackId:t},subjects:n,deliveryClasses:r,...Object.keys(i).length>0&&{filters:i}}}function Q(e,t){return{type:`unsubscribe`,...t===void 0?{}:{ackId:t},subjects:e}}function Te(t,n){let r=t.trim();if(r.length===0||r.startsWith(`extension:`))throw Error(`Invalid extensionName: expected a non-empty extension name without the "extension:" prefix.`);let i=r;return{...e(`extension:${i}`,n.schemas),domain:i,extensions:n.extensions??{}}}function $(e,t){return`${e}.${t}`}function Ee(){let e=new Map;return{register(t){let n=$(t.namespace,t.subject);return e.set(n,t),()=>{e.get(n)===t&&e.delete(n)}},get(t,n){return e.get($(t,n))}}}const De=p.fact.$meta.namespace,Oe=p.fact.subject;function ke(e){return e.type===`event`||e.type===`request`||e.type===`broadcast`}async function Ae(e,t,n,r,i,a){let o=y({message:t,direction:`outbound`,observedAt:a(),machineId:i,namespaceRegistry:n,projectorRegistry:r});for(let n of o)await e.send({type:`event`,namespace:De,subject:Oe,payload:n,messageId:`${t.messageId}:telemetry:${n.factId}`,correlationId:t.correlationId})}function je(e,t,n,r,i){return async function(a,o){if(!ke(a))return!0;if(await Ae(e,a,t,n,r,i),a.type===`request`)throw Error(`Projected telemetry transport cannot satisfy request responses; exclude it from request routing.`);return a.type===`broadcast`?[]:!0}}function Me(e){let{inner:t,namespaceRegistry:n,projectorRegistry:r,machineId:i,now:a=Date.now}=e,o={name:e.name,send:je(t,n,r,i,a),onReceive(e){return t.onReceive(async()=>{})},connect(){return t.connect()},disconnect(){return t.disconnect()},subscribe(){return Promise.resolve()},unsubscribe(){return Promise.resolve()},get ready(){return t.ready},get onNewReadySession(){return t.onNewReadySession},set onNewReadySession(e){t.onNewReadySession=e},get onConnected(){return t.onConnected},set onConnected(e){t.onConnected=e},get onDisconnected(){return t.onDisconnected},set onDisconnected(e){t.onDisconnected=e},isReady(){return t.isReady?.()??!0},cancelRequest(e,n){t.cancelRequest?.(e,n)},onBroadcastResults(e,n,r){t.onBroadcastResults?.(e,n,r)}};return t.reconnect&&(o.reconnect=()=>t.reconnect()),o}export{oe as BusAbortError,k as BusError,Ce as BusLifecycle,ye as CONNECTION_LOST_ERROR_CODE,g as ChannelAuthError,c as ChannelClosedError,ae as ChannelOnlyError,n as ConnectionLostError,Se as CorrelationTracker,he as DEFAULT_READINESS_TIMEOUT_MS,O as DEFAULT_REQUEST_TIMEOUT_MS,_e as LOCAL_ORIGIN,re as LocalSubjectError,N as MakaioBus,l as NO_HANDLER_ERROR_CODE,f as NoHandlerError,F as OnceAbortError,h as REMOTE_ORIGIN,o as RequestError,z as SystemChannelSchemas,m as TimeoutError,ee as ValidationError,I as __resetWarnedSubjects,we as buildSubscribeMessage,Q as buildUnsubscribeMessage,fe as channelSubject,P as collectorOnlySubject,A as createBusContext,ge as createBusInstance,be as createChannelEndpoint,Te as createExtensionNamespace,C as createFilteredBus,Me as createProjectedTelemetryTransport,Ee as createSubjectTelemetryProjectorRegistry,T as defaultTransports,E as defineSubjectExtension,i as deserializeTransportError,M as extendSubject,te as findInErrorChain,me as getFullSubjectForSubjectDefinition,u as getPath,S as getSubjectFromBusMessage,r as handleCorrelationResponse,j as hostLocalRequest,t as isNoHandlerErrorForSubject,s as isRequestCancellation,D as isRequestSchema,b as localSubject,le as matchesAnySubscription,ce as matchesFilter,ne as matchesSubscription,se as mergeFilters,xe as openChannel,pe as parseBusUrl,y as projectSubjectTelemetryFacts,L as serializeTransportError,ie as shouldReceiveMessage,ve as toSafeDebugLog,a as trackMessageCorrelation,x as transportErrorData,ue as waitForSubscriptionPropagation};
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as ee,O as te,P as m,Q as ne,R as re,S as h,T as ie,U as g,V as ae,W as oe,X as se,Y as ce,Z as le,_ as ue,a as de,at as fe,b as pe,d as _,et as me,f as he,g as v,h as y,i as ge,it as b,j as x,k as S,l as C,m as w,nt as T,o as E,ot as D,p as O,q as k,r as A,rt as j,s as M,t as N,tt as P,u as F,v as I,w as L,x as _e,y as ve,z as ye}from"../bus-CzD5SUBY.mjs";import{z as R}from"zod";const z={"channel.open":{request:R.object({endpoint:R.string(),token:R.string(),clientPubKey:R.string(),transports:R.array(R.string())}),response:R.object({channelId:R.string(),endpointPubKey:R.string()})}};function B(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return btoa(n.join(``))}function V(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}async function H(){return globalThis.crypto.subtle.generateKey({name:`ECDH`,namedCurve:`P-256`},!1,[`deriveKey`])}async function U(e){return B(await globalThis.crypto.subtle.exportKey(`raw`,e))}async function W(e){let t=V(e);return globalThis.crypto.subtle.importKey(`raw`,t,{name:`ECDH`,namedCurve:`P-256`},!1,[])}async function G(e,t){return globalThis.crypto.subtle.deriveKey({name:`ECDH`,public:t},e,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function K(e,t,n){let r=globalThis.crypto.getRandomValues(new Uint8Array(12)),i=new TextEncoder().encode(t),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.encrypt(a,e,i);return{iv:B(r),data:B(o)}}async function q(e,t,n){let r=V(t.iv),i=V(t.data),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.decrypt(a,e,i);return new TextDecoder().decode(o)}function J(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!1,payload:{},local:!1,channel:!1}}}function Y(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!0,payload:{},local:!1,channel:!1}}}var X=class{channelId;sharedKey;context;transportNames;cleanups=[];pendingRequests=new Set;closed=!1;constructor(e,t,n,r){this.channelId=e,this.sharedKey=t,this.context=n,this.transportNames=r;let i=J(e,`$close`);this.cleanups.push(this.registerEventHandler(i,t,e=>{this.handlePeerClose()}))}on(e,t,n){this.assertOpen();let r=this.requireKey(),i=e.$meta.isRequest?this.registerRequestHandler(e,r,t,n):this.registerEventHandler(e,r,t,n);return this.cleanups.push(i),()=>{i();let e=this.cleanups.indexOf(i);e!==-1&&this.cleanups.splice(e,1)}}once(e,t){this.assertOpen();let n=this.requireKey(),r=null,i=(e=>{let n=r;if(r=null,n){let e=this.cleanups.indexOf(n);e!==-1&&this.cleanups.splice(e,1)}return n?.(),t(e)});return r=e.$meta.isRequest?this.registerRequestHandler(e,n,i):this.registerEventHandler(e,n,i),this.cleanups.push(r),()=>{if(r){let e=r;r=null;let t=this.cleanups.indexOf(e);t!==-1&&this.cleanups.splice(t,1),e()}}}async emit(e,t){this.assertOpen();let n=this.requireKey(),r=J(this.channelId,e.subject),i=await K(n,JSON.stringify(t),`${this.channelId}:${e.subject}:evt`);await w(this.context,r,i,{...this.transportNames?{transports:[...this.transportNames]}:{}})}async request(e,t,n){this.assertOpen();let r=this.requireKey(),i=new AbortController;this.pendingRequests.add(i);try{let a=Y(this.channelId,e.subject),o=await K(r,JSON.stringify(t),`${this.channelId}:${e.subject}:req`),s=await q(r,await _(this.context,a,o,{signal:i.signal,...n?.timeout===void 0?{}:{timeout:n.timeout},...this.transportNames?{transports:[...this.transportNames]}:{}}),`${this.channelId}:${e.subject}:res`);return JSON.parse(s)}finally{this.pendingRequests.delete(i)}}async requestOptional(e,t,n){try{return{handled:!0,data:await this.request(e,t,n)}}catch(e){if(e instanceof f)return{handled:!1};throw e}}close(){if(this.closed)return;this.closed=!0;let e=this.sharedKey;if(e){let t=J(this.channelId,`$close`);K(e,JSON.stringify({}),`${this.channelId}:$close:evt`).then(e=>w(this.context,t,e,{...this.transportNames?{transports:[...this.transportNames]}:{}})).catch(()=>{})}this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null}assertOpen(){if(this.closed)throw new c(this.channelId)}requireKey(){return this.sharedKey}registerEventHandler(e,t,n,r){let i=J(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:evt`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r);return n({...e,payload:i})},r)}registerRequestHandler(e,t,n,r){let i=Y(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:req`,o=`${this.channelId}:${e.subject}:res`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r),s,c=e=>{s={value:e}},l=e=>{s={value:{...s?.value??{},...e}}},u=async()=>{let n=s;if(await e.next(),n!==void 0){s=n;return}let r=e.result;if(r!==void 0){let e=await q(t,r,o);s={value:JSON.parse(e)}}};if(await n({...e,payload:i,get result(){return s?.value},setResult:c,extendResult:l,next:u}),s!==void 0){let n=await K(t,JSON.stringify(s.value),o);e.setResult(n)}},r)}handlePeerClose(){this.closed||(this.closed=!0,this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null)}abortPendingRequests(){let e=new c(this.channelId);for(let t of this.pendingRequests)t.abort(e);this.pendingRequests.clear()}runCleanups(){for(let e of this.cleanups)try{e()}catch{}this.cleanups.length=0}};function Z(t){return t.namespaceRegistry.registerNamespace(e(`system`,z)).subjects.channel.open}function be(e,t,n,r){let i=v(e,Z(e),async i=>{if(i.payload.endpoint!==t){await i.next();return}if(i.payload.token!==r.token)throw new g(t);let{publicKey:a,privateKey:o}=await H(),s=await G(o,await W(i.payload.clientPubKey)),c=globalThis.crypto.randomUUID(),l=new Set(e.transportRegistry.names()),u=new X(c,s,e,(i.payload.transports??[]).filter(e=>l.has(e)));try{n(u),i.setResult({channelId:c,endpointPubKey:await U(a)})}catch(e){throw u.close(),e}});return{name:t,token:r.token,close:i}}async function xe(e,t,n){let r=Z(e),{publicKey:i,privateKey:a}=await H(),o=await U(i),s=n.transports!==void 0,c=s?[...n.transports]:[...e.transportRegistry.names()],l=s?{transports:c}:void 0,u=await _(e,r,{endpoint:t,token:n.token,clientPubKey:o,transports:c},l),d=await G(a,await W(u.endpointPubKey));return new X(u.channelId,d,e,c)}var Se=class{pending;constructor(){this.pending=new Map}track(e,t,n){return new Promise((r,i)=>{if(n?.aborted){i(d(n.reason));return}let a=t===0?void 0:setTimeout(()=>{let n=this.pending.get(e);n!==void 0&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(new m(e,t)))},t);if(this.pending.set(e,{resolve:r,reject:i,timeoutId:a,removeAbortListener:void 0}),n){let t=()=>{this.reject(e,d(n.reason))};n.addEventListener(`abort`,t,{once:!0});let r=()=>{n.removeEventListener(`abort`,t)},i=this.pending.get(e);i&&(i.removeAbortListener=r)}n?.aborted&&this.reject(e,d(n.reason))})}resolve(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.resolve(t))}reject(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(t))}cancel(e,t){this.reject(e,t??d(void 0))}rejectAll(e){for(let[t,n]of this.pending.entries())clearTimeout(n.timeoutId),n.removeAbortListener?.(),n.reject(e);this.pending.clear()}cleanup(){this.rejectAll(Error(`Transport disconnected`))}};const Ce=e(`bus:lifecycle`,de).subjects;function we(e,t){let n={},r={},i={};for(let[t,a]of e)n[t]=a.priorities,r[t]=a.deliveryClass??`relayable`,a.filter!==void 0&&(i[t]=a.filter);return{type:`subscribe`,...t===void 0?{}:{ackId:t},subjects:n,deliveryClasses:r,...Object.keys(i).length>0&&{filters:i}}}function Q(e,t){return{type:`unsubscribe`,...t===void 0?{}:{ackId:t},subjects:e}}function Te(t,n){let r=t.trim();if(r.length===0||r.startsWith(`extension:`))throw Error(`Invalid extensionName: expected a non-empty extension name without the "extension:" prefix.`);let i=r;return{...e(`extension:${i}`,n.schemas),domain:i,extensions:n.extensions??{}}}function $(e,t){return`${e}.${t}`}function Ee(){let e=new Map;return{register(t){let n=$(t.namespace,t.subject);return e.set(n,t),()=>{e.get(n)===t&&e.delete(n)}},get(t,n){return e.get($(t,n))}}}const De=p.fact.$meta.namespace,Oe=p.fact.subject;function ke(e){return e.type===`event`||e.type===`request`||e.type===`broadcast`}async function Ae(e,t,n,r,i,a){let o=y({message:t,direction:`outbound`,observedAt:a(),machineId:i,namespaceRegistry:n,projectorRegistry:r});for(let n of o)await e.send({type:`event`,namespace:De,subject:Oe,payload:n,messageId:`${t.messageId}:telemetry:${n.factId}`,correlationId:t.correlationId})}function je(e,t,n,r,i){return async function(a,o){if(!ke(a))return!0;if(await Ae(e,a,t,n,r,i),a.type===`request`)throw Error(`Projected telemetry transport cannot satisfy request responses; exclude it from request routing.`);return a.type===`broadcast`?[]:!0}}function Me(e){let{inner:t,namespaceRegistry:n,projectorRegistry:r,machineId:i,now:a=Date.now}=e,o={name:e.name,send:je(t,n,r,i,a),onReceive(e){return t.onReceive(async()=>{})},connect(){return t.connect()},disconnect(){return t.disconnect()},subscribe(){return Promise.resolve()},unsubscribe(){return Promise.resolve()},get ready(){return t.ready},get onNewReadySession(){return t.onNewReadySession},set onNewReadySession(e){t.onNewReadySession=e},get onConnected(){return t.onConnected},set onConnected(e){t.onConnected=e},get onDisconnected(){return t.onDisconnected},set onDisconnected(e){t.onDisconnected=e},isReady(){return t.isReady?.()??!0},cancelRequest(e,n){t.cancelRequest?.(e,n)},onBroadcastResults(e,n,r){t.onBroadcastResults?.(e,n,r)}};return t.reconnect&&(o.reconnect=()=>t.reconnect()),o}export{oe as BusAbortError,k as BusError,Ce as BusLifecycle,ye as CONNECTION_LOST_ERROR_CODE,g as ChannelAuthError,c as ChannelClosedError,ae as ChannelOnlyError,n as ConnectionLostError,Se as CorrelationTracker,he as DEFAULT_READINESS_TIMEOUT_MS,O as DEFAULT_REQUEST_TIMEOUT_MS,_e as LOCAL_ORIGIN,re as LocalSubjectError,N as MakaioBus,l as NO_HANDLER_ERROR_CODE,f as NoHandlerError,F as OnceAbortError,h as REMOTE_ORIGIN,o as RequestError,z as SystemChannelSchemas,m as TimeoutError,ee as ValidationError,I as __resetWarnedSubjects,we as buildSubscribeMessage,Q as buildUnsubscribeMessage,fe as channelSubject,P as collectorOnlySubject,A as createBusContext,ge as createBusInstance,be as createChannelEndpoint,Te as createExtensionNamespace,C as createFilteredBus,Me as createProjectedTelemetryTransport,Ee as createSubjectTelemetryProjectorRegistry,T as defaultTransports,E as defineSubjectExtension,i as deserializeTransportError,M as extendSubject,te as findInErrorChain,me as getFullSubjectForSubjectDefinition,u as getPath,S as getSubjectFromBusMessage,r as handleCorrelationResponse,j as hostLocalRequest,t as isNoHandlerErrorForSubject,s as isRequestCancellation,D as isRequestSchema,b as localSubject,le as matchesAnySubscription,ce as matchesFilter,ne as matchesSubscription,se as mergeFilters,xe as openChannel,pe as parseBusUrl,y as projectSubjectTelemetryFacts,L as serializeTransportError,ie as shouldReceiveMessage,ve as toSafeDebugLog,a as trackMessageCorrelation,x as transportErrorData,ue as waitForSubscriptionPropagation};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{z as e}from"zod";import*as t from"node:path";import{webcrypto as n}from"node:crypto";var r=Object.defineProperty,i=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),a=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n};function o(e){if(typeof e!=`object`||!e)return!1;let t=e;return`$in`in t||`$ne`in t||`$exists`in t||`$startsWith`in t||`$endsWith`in t}function s(e){return{subject:`*`,$meta:{namespace:e,isRequest:!1,payload:{},local:!1,channel:!1}}}function c(t){return typeof t==`object`&&!!t&&`request`in t&&`response`in t&&t.request instanceof e.ZodType&&t.response instanceof e.ZodType}function l(e){return typeof e==`object`&&!!e&&`__channel`in e&&e.__channel===!0&&`schema`in e}function u(e){return{__channel:!0,schema:e}}function d(e){return typeof e==`object`&&!!e&&`__local`in e&&e.__local===!0&&`schema`in e}function f(e){return{__local:!0,schema:e}}function p(e){return typeof e==`object`&&!!e&&`__hostLocalRequest`in e&&e.__hostLocalRequest===!0&&`schema`in e}function m(e){return{__hostLocalRequest:!0,schema:e}}function h(e){return typeof e==`object`&&!!e&&`__defaultTransports`in e&&(e.__defaultTransports===`all`||e.__defaultTransports===`local-only`)&&`schema`in e}function g(e,t){return{__defaultTransports:t,schema:e}}function _(e){return typeof e==`object`&&!!e&&`__collectorOnly`in e&&e.__collectorOnly===!0&&`schema`in e}function v(e){return{__collectorOnly:!0,schema:e}}function y(e){return d(e)||_(e)||l(e)||p(e)||h(e)?e.schema:e}function b(e,t,n){let r={};for(let[i,a]of Object.entries(t)){let t=i.split(`.`),o=r;for(let e=0;e<t.length-1;e++)o[t[e]]??={},o=o[t[e]];let s=d(a),u=l(a),f=p(a),m=h(a)?a.__defaultTransports:n,g={subject:i,$meta:{namespace:e,isRequest:c(y(a)),local:s,channel:u,...f&&{hostLocalRequest:f},...m!==void 0&&{defaultTransports:m}}};o[t[t.length-1]]=g}return r.$all=s(e),r}function x(e){return`${e.$meta.namespace}.${e.subject}`}function S(e,t,n){let r=n?.defaultTransports,i;if(n!==void 0){let{defaultTransports:e,...t}=n;i=Object.keys(t).length>0?t:void 0}return{name:e,subjects:b(e,t,r),schemas:t,...i===void 0?{}:{options:i},...r===void 0?{}:{defaultTransports:r}}}e.object({cwd:e.string(),env:e.record(e.string(),e.string()),platform:e.enum([`posix`,`windows`]),signal:e.custom().optional(),constraints:e.record(e.string(),e.unknown()).optional(),sessionId:e.string().optional(),subagentId:e.string().optional(),subagentDepth:e.number().optional()});var C=class extends Error{subject;constructor(e,t){super(e),this.subject=t,this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};const ee=`makaio.observability`;function w(e){let t=e.meta()?.[ee];if(typeof t!=`object`||!t)return;let n=t;return n.kind===`schema`||n.kind===`field`?n:void 0}function T(e,t){return e.meta({...e.meta(),[ee]:t})}function E(t){if(t instanceof e.ZodOptional||t instanceof e.ZodNullable||t instanceof e.ZodDefault||t instanceof e.ZodCatch||t instanceof e.ZodReadonly)return t.unwrap()}function te(e){let t=e;for(;t;){let e=w(t);if(e?.kind===`field`)return e;t=E(t)}}function ne(e){let t=w(e);if(t?.kind===`schema`)return{traceAll:t.traceAll}}function re(e){let t=te(e);if(t)return{visibility:t.visibility,attributeName:t.attributeName}}const D={schema(e,t){return T(e,{kind:`schema`,traceAll:t.traceAll})},field(e,t){return T(e,{kind:`field`,visibility:t.visibility,attributeName:t.attributeName})},hidden(e){return T(e,{kind:`field`,visibility:`hidden`})},count(e,t){return T(e,{kind:`field`,visibility:`count`,attributeName:t})},attribute(e,t){return T(e,{kind:`field`,visibility:`attribute`,attributeName:t})}};function O(e,t){if(t===`*`)return!0;if(!t.endsWith(`*`))return e===t;if(t.endsWith(`:*`)){let n=t.slice(0,-2);return e.startsWith(n+`:`)}if(t.endsWith(`.*`)){let n=t.slice(0,-2);return e.startsWith(n+`.`)}return!1}function ie(e,t){for(let n of t)if(O(e,n))return!0;return!1}function ae(e,t){if(e==null)return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return r}function oe(e,t){if(o(t)){if(`$in`in t)return t.$in.includes(e);if(`$ne`in t)return e!==t.$ne;if(`$exists`in t){let n=e!==void 0;return t.$exists?n:!n}return`$startsWith`in t?typeof e==`string`&&e.startsWith(t.$startsWith):`$endsWith`in t?typeof e==`string`&&e.endsWith(t.$endsWith):!1}return e===t}function se(e,t){for(let[n,r]of Object.entries(t))if(!oe(ae(e,n),r))return!1;return!0}function ce(e,t){if(!(!e&&!t))return e?t?{...e,...t}:e:t}var k=class extends C{subject;constructor(e,t){super(e),this.subject=t,this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},le=class extends DOMException{cause;constructor(e){super(typeof e==`string`?e:`Request aborted`,`AbortError`),this.cause=e}};function ue(e){try{return e instanceof Error||e instanceof DOMException||typeof e==`object`&&!!e&&!(Symbol.toStringTag in e)&&Object.prototype.toString.call(e)===`[object Error]`}catch{return!1}}function de(e){return ue(e)?e:new le(e)}function fe(e,t){return!!(t?.aborted&&ue(e)&&(Object.is(e,t.reason)||e instanceof le&&Object.is(e.cause,t.reason)))}var pe=class extends k{constructor(e){super(`Authentication failed for channel endpoint "${e}"`,e),this.name=`ChannelAuthError`}},me=class extends k{constructor(e){super(`Channel "${e}" is closed`,e),this.name=`ChannelClosedError`}},he=class extends k{constructor(e){super(`Subject "${e}" is channel-only and cannot be used on the public bus. Use a DirectChannel instead.`,e),this.name=`ChannelOnlyError`}};const ge=`CONNECTION_LOST`;var _e=class extends k{code=ge;retryable=!0;constructor(e){super(`Connection lost on transport "${e}" — pending requests were rejected. This is retryable after reconnection.`)}},ve=class extends k{constructor(e){super(`Subject "${e}" is local-only and cannot be invoked over a transport. Register a non-local handler on each node that needs to respond to this subject.`,e),this.name=`LocalSubjectError`}};const ye=`NO_HANDLER`;var be=class extends k{code=ye;constructor(e){super(`No handler registered for request subject "${e}"`,e)}},xe=class extends k{cause;constructor(e,t,n){super(`Request to "${e}" failed: ${t}`,e),this.cause=n,n&&(this.cause=n)}},Se=class extends k{timeoutMs;constructor(e,t){super(`Request to "${e}" timed out after ${t}ms`,e),this.timeoutMs=t}},Ce=class extends k{zodError;constructor(e,t){let n=t.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`);super(`Validation failed for subject "${e}":\n${n.join(`
|
|
2
|
-
`)}`,e),this.zodError=t}};const A=e.lazy(()=>e.union([e.string(),e.number().finite(),e.boolean(),e.null(),e.array(A),e.record(e.string(),A)])),we=2**32-2;function Te(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=we&&String(t)===e}function Ee(e){return`ok`in e&&!e.ok}var De=class{ancestors=new Set;completed=new Map;snapshot(e){return this.visit(e,[],0)}failure(e,t){return{ok:!1,violation:{kind:e,path:t}}}visit(e,t,n){if(typeof e==`number`&&Object.is(e,-0))return this.failure(`negative-zero`,t);if(typeof e!=`object`||!e)return{ok:!0,value:e};let r=n+1;if(r>128)return this.failure(`nesting-too-deep`,t);if(this.ancestors.has(e))return this.failure(`cyclic-reference`,t);if(this.completed.has(e))return this.copyCompletedTree(this.completed.get(e),t,r);let i=this.describe(e,t);return Ee(i)?i:this.visitObject(e,i,t,r)}describe(e,t){try{let n=Reflect.ownKeys(e);if(n.some(e=>typeof e==`symbol`))return this.failure(`symbol-key`,t);if(n.includes(`__proto__`))return this.failure(`prototype-key`,[...t,`__proto__`]);let r=Array.isArray(e);return!r&&!Oe(e)?this.failure(`non-plain-object`,t):this.describeProperties(e,n,r,t)}catch{return this.failure(`unreadable-value`,t)}}describeProperties(e,t,n,r){let i=new Map;for(let a of t){if(typeof a!=`string`)continue;let t=Object.getOwnPropertyDescriptor(e,a);if(t===void 0)return this.failure(`unreadable-value`,[...r,a]);if((!n||a!==`length`)&&!t.enumerable)return this.failure(`non-enumerable-key`,[...r,a]);if(n&&a!==`length`&&!Te(a))return this.failure(`extra-array-key`,[...r,a]);i.set(a,t)}return{isArray:n,descriptors:i}}visitObject(e,t,n,r){this.ancestors.add(e);try{let i=t.isArray?this.snapshotArray(e,t.descriptors,n,r):this.snapshotRecord(e,t.descriptors,n,r);return i.ok&&this.completed.set(e,i.value),i}finally{this.ancestors.delete(e)}}snapshotArray(e,t,n,r){let i=t.get(`length`)?.value;if(typeof i!=`number`)return this.failure(`unreadable-value`,[...n,`length`]);let a=[];for(let o=0;o<i;o+=1){let i=t.get(String(o));if(i===void 0)a.push(void 0);else{let t=this.snapshotProperty(e,i,[...n,o],r);if(!t.ok)return t;a.push(t.value)}}return{ok:!0,value:a}}snapshotRecord(e,t,n,r){let i={};for(let[a,o]of t){let t=this.snapshotProperty(e,o,[...n,a],r);if(!t.ok)return t;ke(i,a,t.value)}return{ok:!0,value:i}}snapshotProperty(e,t,n,r){let i=this.readDescriptor(e,t,n);return Ee(i)?i:this.visit(i.value,n,r)}readDescriptor(e,t,n){try{return{ok:!0,value:`value`in t?t.value:Reflect.apply(t.get??(()=>void 0),e,[])}}catch{return this.failure(`unreadable-value`,n)}}copyCompletedTree(e,t,n){if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i+=1){let a=this.copyCompletedValue(e[i],[...t,i],n);if(!a.ok)return a;r.push(a.value)}return{ok:!0,value:r}}if(typeof e!=`object`||!e)return{ok:!0,value:e};let r={};for(let[i,a]of Object.entries(e)){let e=this.copyCompletedValue(a,[...t,i],n);if(!e.ok)return e;ke(r,i,e.value)}return{ok:!0,value:r}}copyCompletedValue(e,t,n){if(typeof e==`number`&&Object.is(e,-0))return this.failure(`negative-zero`,t);if(typeof e!=`object`||!e)return{ok:!0,value:e};let r=n+1;return r>128?this.failure(`nesting-too-deep`,t):this.copyCompletedTree(e,t,r)}};function Oe(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ke(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0})}function Ae(e){return new De().snapshot(e)}function je(t,n){let r={"prototype-key":n.prototypeKey,"non-plain-object":n.nonPlainObject,"symbol-key":n.symbolKey,"non-enumerable-key":n.nonEnumerableKey,"extra-array-key":n.extraArrayKey,"cyclic-reference":`the value contains a cyclic reference and cannot be transported as JSON`,"nesting-too-deep":`the value exceeds the maximum JSON container nesting of 128`,"negative-zero":`the value contains -0, which cannot be transported as JSON without becoming 0`,"unreadable-value":`the value could not be read into a stable JSON boundary snapshot`};return e.preprocess((e,t)=>{let n=Ae(e);if(!n.ok){t.addIssue({code:`custom`,message:r[n.violation.kind],path:[...n.violation.path],input:e});return}return n.value},t)}const j=e.record(e.string(),A),Me=e.record(e.string(),A),M=Me,Ne=e.string().min(1).regex(/\S/),N=e.strictObject({refClass:e.literal(`artifact`),kind:Ne,id:Ne,revision:Ne});function P(e){return Pe(e)?e:void 0}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Fe(e,t){if(!Pe(e))return!1;let n=e.type;return n===t?!0:Array.isArray(n)&&n.length===1&&n[0]===t}function Ie(e,t){return Object.keys(t).length===0?e:e?t:!1}function Le(e,t){if(t===`#`)return e;if(!t.startsWith(`#/`))return;let n=e;for(let e of t.slice(2).split(`/`)){let t=P(n),r=e.replace(/~1/g,`/`).replace(/~0/g,`~`);if(!t||!Object.hasOwn(t,r))return;n=t[r]}return n}function Re(e,t){let n=t.$ref;if(typeof n!=`string`)return;let r=Le(e,n);if(typeof r==`boolean`){if(e.$schema!==`https://json-schema.org/draft/2020-12/schema`)return r;let{$ref:n,...i}=t;return Ie(r,i)}let i=P(r);if(!i||e.$schema!==`https://json-schema.org/draft/2020-12/schema`)return i;let{$ref:a,...o}=t;return Object.keys(o).length===0?i:{...i,allOf:[o,...Array.isArray(i.allOf)?i.allOf:[]]}}function ze(e,t){for(let[n,r]of Object.entries(t))e[n]=Object.hasOwn(e,n)?{allOf:[e[n],r]}:r}function Be(e){return Array.isArray(e.required)?e.required.filter(e=>typeof e==`string`):[]}function Ve(e,t){let n=P(e.properties);if(!n||!Object.hasOwn(n,t))return;let r=n[t];return typeof r==`boolean`?r:P(r)}function He(e,t,n){if(typeof t.$ref==`string`){if(n.has(t.$ref))return;let r=Re(e,t);return Pe(r)?He(e,r,new Set([...n,t.$ref])):void 0}if(!Array.isArray(t.allOf))return t;let{allOf:r,...i}=t,a={},o={},s=new Set;for(let t of[i,...r]){let r=P(t),i=r?He(e,r,n):void 0;if(!i||i.anyOf||i.oneOf)return;if(i.type!==void 0){if(a.type!==void 0&&a.type!==i.type)return;a.type=i.type}for(let e of[`items`,`prefixItems`])if(i[e]!==void 0){if(a[e]!==void 0)return;a[e]=i[e]}ze(o,P(i.properties)??{});for(let e of Be(i))s.add(e)}return{...a,properties:o,required:[...s]}}function Ue(e,t,n,r,i,a,o,s){if(a.has(n))return;let c=Re(e,t);return typeof c==`boolean`?r.length===0?[c]:void 0:c?Ke(e,c,r,i,new Set([...a,n]),o,s):void 0}function We(e,t,n,r){if(!Fe(t,`array`))return;let i=t.items;if(typeof i==`boolean`)return n.length===0?[i]:void 0;let a=P(i);return a?Ke(e,a,n,r):void 0}function Ge(e,t,n){if(typeof n.$ref!=`string`)return{node:{...n,allOf:[t,...Array.isArray(n.allOf)?n.allOf:[]]}};let r=Re(e,n);return Pe(r)?{node:{...r,allOf:[t,...Array.isArray(r.allOf)?r.allOf:[]]},ref:n.$ref}:{node:{allOf:[t,n]}}}function Ke(e,t,n,r,i=new Set,a=!1,o=!1){if(typeof t.$ref==`string`){let s=t.$ref;return Ue(e,t,s,n,r,i,a,o)}let s=Array.isArray(t.anyOf)?`anyOf`:`oneOf`,c=t[s];if(Array.isArray(c)){let{[s]:l,...u}=t,d=c.map(t=>{let s=P(t);if(!s)return;let{node:c,ref:l}=Ge(e,u,s);return Ke(e,c,n,r,l===void 0?i:new Set([...i,l]),a,o)});return d.every(e=>e!==void 0)?d.flatMap(e=>e??[]):void 0}if(Array.isArray(t.allOf)){let s=He(e,t,i);return s?Ke(e,s,n,r,i,a,o):void 0}if(n.length===0)return[t];let[l,...u]=n;if(l===`[]`)return We(e,t,u,r||o);if(!(!Fe(t,`object`)&&!(t.type===void 0&&a))&&!(!l||r&&!Be(t).includes(l)))return qe(e,Ve(t,l),u,r,o)}function qe(e,t,n,r,i){return typeof t==`boolean`?n.length===0?[t]:void 0:t?Ke(e,t,n,r,new Set,!1,i):void 0}function Je(e,t,n){return Ke(e,e,[...t],n?.required??!1,new Set,!0,n?.requiredAfterElement??!1)}function Ye(e,t){return Je(e,t.split(`.`))!==void 0}function Xe(e){let t=[],n=(e,n)=>{let r=P(e);r&&t.push({node:r,path:n})};for(let t of[`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`])for(let[r,i]of Object.entries(P(e[t])??{}))n(i,[t,r]);for(let t of[`allOf`,`anyOf`,`oneOf`,`prefixItems`,`items`]){let r=e[t];Array.isArray(r)&&r.forEach((e,r)=>n(e,[t,r]))}for(let t of[`items`,`additionalItems`,`additionalProperties`,`unevaluatedItems`,`unevaluatedProperties`,`propertyNames`,`contains`,`not`,`if`,`then`,`else`,`contentSchema`])n(e[t],[t]);return t}function Ze(e,t,n=new Set){if(t.additionalProperties===!1)return!0;if(typeof t.$ref==`string`&&!n.has(t.$ref)){let r=Re(e,t);if(r===void 0||Pe(r)&&Ze(e,r,new Set([...n,t.$ref])))return!0}return Xe(t).some(t=>Ze(e,t.node,n))}function Qe(e,t,n,r){if(Object.hasOwn(t,`$ref`)&&typeof t.$ref!=`string`&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Schema reference must be a string`}),typeof t.$ref==`string`&&!t.$ref.startsWith(`#`)&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Only fragment schema references are supported; absolute and document-relative references are outside the artifact registration profile`}),Object.hasOwn(t,`$anchor`)&&n.addIssue({code:`custom`,path:[...r,`$anchor`],message:`Named schema anchors are not supported; use local JSON Pointer references`}),typeof t.$ref==`string`&&t.$ref.startsWith(`#`)&&t.$ref.length>1&&!t.$ref.startsWith(`#/`)&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Named schema references are not supported; use local JSON Pointer references`}),typeof t.$ref==`string`&&(t.$ref===`#`||t.$ref.startsWith(`#/`))){let i=Le(e,t.$ref);!P(i)&&typeof i!=`boolean`&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Fragment schema reference must resolve to an existing object or boolean schema`})}}function $e(e,t,n,r=[`dataSchema`]){Object.hasOwn(t,`$async`)&&t.$async!==!1&&n.addIssue({code:`custom`,path:[...r,`$async`],message:`Asynchronous artifact schemas are not supported`}),Qe(e,t,n,r);for(let e of[`anyOf`,`oneOf`]){let i=t[e];Array.isArray(i)&&i.some(e=>typeof e==`boolean`)&&n.addIssue({code:`custom`,path:[...r,e],message:`Unsupported boolean union alternative: use object schema declarations`})}Array.isArray(t.allOf)&&(Ze(e,t)||!He(e,t,new Set))&&n.addIssue({code:`custom`,path:[...r,`allOf`],message:`Unsupported intersection: use open compatible conjuncts or a single closed object schema`});for(let i of Xe(t))$e(e,i.node,n,[...r,...i.path])}function et(e,t){$e(e.dataSchema,e.dataSchema,t);let n=Ke(e.dataSchema,e.dataSchema,e.titlePath.split(`.`),!0,new Set,!0);(!n?.length||n.some(e=>!Fe(e,`string`)))&&t.addIssue({code:`custom`,path:[`titlePath`],message:`titlePath must select a required string in every data schema variant`});let r=[...(e.indexedFields??[]).map((e,t)=>({path:e,location:[`indexedFields`,t]})),...(e.searchableFields??[]).map((e,t)=>({path:e,location:[`searchableFields`,t]})),...(e.uniqueness??[]).flatMap((e,t)=>e.by.flatMap((e,n)=>e.kind===`data`?[{path:e.path,location:[`uniqueness`,t,`by`,n,`path`]}]:[])),...Object.entries(e.views??{}).flatMap(([e,t])=>t.fields.map((t,n)=>({path:t,location:[`views`,e,`fields`,n]})))];for(let{path:n,location:i}of r)Ye(e.dataSchema,n)||t.addIssue({code:`custom`,path:i,message:`Data path ${n} must select a declared field`})}const tt=[`$dynamicRef`,`$dynamicAnchor`,`$recursiveRef`,`$recursiveAnchor`];function nt(e,t,n=[`dataSchema`]){for(let r of tt)Object.hasOwn(e,r)&&t.addIssue({code:`custom`,path:[...n,r],message:`Unsupported dynamic reference: use a plain local $ref`});for(let r of Xe(e))nt(r.node,t,[...n,...r.path])}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e,t){if(typeof t!=`string`)return;let n=Le(e,t);return rt(n)?n:void 0}function at(e,t){return rt(e)?Object.values(e).some(e=>Array.isArray(e)&&e.includes(t)):!1}function ot(e,t){let n=e.properties;if(rt(n)&&Object.hasOwn(n,t)||Array.isArray(e.required)&&e.required.includes(t)||at(e.dependentRequired,t)||at(e.dependencies,t))return!0;let r=e.patternProperties;return rt(r)?Object.keys(r).some(e=>{try{return new RegExp(e,`u`).test(t)}catch{return!1}}):!1}function st(e){let t=[];for(let n of[`allOf`,`anyOf`,`oneOf`]){let r=e[n];if(Array.isArray(r))for(let e of r)rt(e)&&t.push(e)}for(let n of[`if`,`then`,`else`]){let r=e[n];rt(r)&&t.push(r)}for(let n of[`dependentSchemas`,`dependencies`]){let r=e[n];if(rt(r))for(let e of Object.values(r))rt(e)&&t.push(e)}return t}function ct(e,t){let n=new Set,r=i=>{if(n.has(i))return!1;if(n.add(i),ot(i,t))return!0;let a=it(e,i.$ref);return a&&r(a)?!0:st(i).some(r)};return r(e)}const lt=e.string().regex(/^[a-z0-9]+(--?[a-z0-9]+)*$/,`Slug must be lowercase alphanumeric segments joined by hyphens.`),ut=`slug`;function dt(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0})}function ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pt(e,t){let n=e.addressableParts;if(!n||n.length===0)return;let r=new Set;for(let[i,a]of n.entries())r.has(a.path)&&t.addIssue({code:`custom`,path:[`addressableParts`,i,`path`],message:`addressableParts[${i}].path duplicates an earlier area; each declared area must have a distinct path`}),r.add(a.path),mt(e.dataSchema,a,i,t)}function mt(e,t,n,r){let i=Je(e,t.path.split(`.`));if(!i||i.length===0){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path must select a declared location in every data schema variant`});return}if(i.some(e=>!Fe(e,`array`))){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path must select an array schema in every data schema variant`});return}if(i.some(e=>typeof e==`object`&&(Array.isArray(e.prefixItems)||Array.isArray(e.items)))){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path selects a tuple schema; tuples are outside the addressable-parts profile (homogeneous arrays only)`});return}ht(e,t,n,r)}function ht(e,t,n,r){let i=()=>{r.addIssue({code:`custom`,path:[`addressableParts`,n,`idPath`],message:`addressableParts[${n}].idPath must select a required string in every element variant`})},a=t.idPath.split(`.`),o=Je(e,[...t.path.split(`.`),`[]`,...a],{requiredAfterElement:!0});if(!o||o.length===0){i();return}o.some(e=>!Fe(e,`string`))&&i()}const gt=e.strictObject({code:e.enum([`ARTIFACT_NOT_FOUND`,`KIND_NOT_REGISTERED`,`NO_PARTS_DECLARED`,`PART_NOT_FOUND`,`DUPLICATE_LOCAL_ID`]),message:e.string().min(1),repair:e.string().min(1)}),F=e.number().int().positive(),_t=e.enum([`knowledge`,`commitment`,`interaction`,`record`]),vt=e.string().regex(/^[A-Za-z_$][\w$-]*(?:\.[A-Za-z_$][\w$-]*)*$/),yt=e.strictObject({fields:e.array(vt).min(1)}),bt=new Set([`full`]),xt={knowledge:[`valid`,`retired`],commitment:[`proposed`,`decided`,`fulfilled`,`revoked`],interaction:[`open`,`resolved`,`closed-without-resolution`],record:[]},St=e.enum([...xt.knowledge,...xt.commitment,...xt.interaction]),Ct=e.strictObject({path:vt,equals:e.union([e.string(),e.number(),e.boolean()])}),wt=e.strictObject({relationType:e.string().trim().min(1),targetKinds:e.array(e.string().trim().min(1)).min(1).optional(),minItems:e.number().int().nonnegative(),maxItems:e.number().int().nonnegative().optional(),when:Ct.optional()}).refine(e=>e.maxItems===void 0||e.maxItems>=e.minItems,{path:[`maxItems`],message:`maxItems must be at least minItems`}),Tt=e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`data`),path:vt}),e.strictObject({kind:e.literal(`relation-target`),relationType:e.string().trim().min(1)})]),Et=e.strictObject({path:vt,idPath:vt}),Dt=e.strictObject({by:e.array(Tt).min(1),lifecycleStates:e.array(St).min(1).optional()}),Ot=e.strictObject({minItems:e.number().int().nonnegative()}),kt=e.enum([`http://json-schema.org/draft-07/schema#`,`https://json-schema.org/draft/2020-12/schema`]).optional(),At=e.strictObject({kind:e.string().trim().min(1),description:e.string().trim().min(1),schemaVersion:F,category:_t,dataSchema:j,titlePath:vt,relations:e.array(wt).optional(),uniqueness:e.array(Dt).optional(),evidenceRequirements:Ot.optional(),indexedFields:e.array(vt).optional(),searchableFields:e.array(vt).optional(),addressableParts:e.array(Et).min(1).optional(),views:e.record(e.string().trim().min(1),yt).optional()}).superRefine((e,t)=>{kt.safeParse(e.dataSchema.$schema).success||t.addIssue({code:`custom`,path:[`dataSchema`,`$schema`],message:`Unsupported data schema dialect: omit $schema for draft-7 or declare the supported draft-7 or 2020-12 URI`});let n=xt[e.category];e.uniqueness?.forEach((r,i)=>{r.lifecycleStates?.some(e=>!n.includes(e))&&t.addIssue({code:`custom`,path:[`uniqueness`,i,`lifecycleStates`],message:`Lifecycle conditions are incompatible with category ${e.category}`})}),e.relations?.forEach((n,r)=>{n.when&&!Ye(e.dataSchema,n.when.path)&&t.addIssue({code:`custom`,path:[`relations`,r,`when`,`path`],message:`Data path ${n.when.path} must select a declared field`})}),Object.keys(e.views??{}).forEach(e=>{bt.has(e)&&t.addIssue({code:`custom`,path:[`views`,e],message:`Artifact kind view ${e} is reserved for the generic complete-payload view`})}),ct(e.dataSchema,`slug`)&&t.addIssue({code:`custom`,path:[`dataSchema`,`properties`,ut],message:`Data field ${ut} is reserved: the artifact envelope owns the slug`}),nt(e.dataSchema,t),et(e,t),pt(e,t)}),jt=e.object({kind:e.string().trim().min(1).regex(/\S/),path:e.string().trim().min(1).regex(/\S/)}),Mt=e.string().min(1).regex(/\S/),Nt=e.strictObject({kind:e.literal(`whole-source`)}),Pt=e.strictObject({kind:e.literal(`lines`),startLine:e.number().int().positive(),lineCount:e.number().int().positive()}),Ft=e.strictObject({kind:e.literal(`data-path`),path:vt}),It=e.strictObject({kind:e.literal(`git-file`),repository:jt.strict(),path:Mt,commit:e.string().regex(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)}),Lt=e.strictObject({kind:e.literal(`confluence-page`),site:Mt,pageId:Mt,version:e.number().int().positive()}),Rt=e.strictObject({kind:e.literal(`artifact`),reference:N}),zt=e.union([e.strictObject({source:It,location:e.union([Nt,Pt]),excerpt:e.string().optional()}),e.strictObject({source:Lt,location:Nt,excerpt:e.string().optional()}),e.strictObject({source:Rt,location:e.union([Nt,Ft]),excerpt:e.string().optional()})]).meta({title:`EvidenceValue`,description:`An immutable, directly cited source and its source-specific location.`,"x-makaio-value-type":`evidence/v1`}),Bt=e.string().regex(/^(?:\/(?:[^~/]|~[01])*)+$/,`Expected a data-relative JSON Pointer`),Vt=e.object({kind:e.string().min(1),id:e.string().min(1),displayName:e.string().optional()}),Ht=e.object({level:e.string().min(1),ids:e.record(e.string().min(1),e.string().min(1)).optional()}).superRefine((t,n)=>{t.level!==`global`&&(!t.ids||Object.keys(t.ids).length===0)&&n.addIssue({code:e.ZodIssueCode.custom,path:[`ids`],message:`ids is required when scope level is not 'global'`})}),Ut=e.object({level:e.string().min(1),ids:e.record(e.string().min(1),e.string().min(1)).optional()}),Wt=e.object({refClass:e.literal(`local`).default(`local`),artifact:N,localId:e.string().min(1)}),Gt=e.object({refClass:e.literal(`evidence`).default(`evidence`),kind:e.string().min(1),id:e.string().min(1),revision:e.string().min(1).optional(),locator:e.string().min(1).optional()}),Kt=e.strictObject({refClass:e.literal(`entity`),entityType:e.string().min(1),id:e.string().min(1)}),qt=e.discriminatedUnion(`refClass`,[N,Wt,Gt,Kt]);function Jt(e){return!e||typeof e!=`object`||Array.isArray(e)||`refClass`in e?e:`artifact`in e&&`localId`in e?{...e,refClass:`local`}:`locator`in e||!(`revision`in e)?{...e,refClass:`evidence`}:{...e,refClass:`artifact`}}const Yt=e.preprocess(Jt,qt),Xt=e.discriminatedUnion(`refClass`,[N.extend({revision:N.shape.revision.optional()}),Wt,Gt,Kt]);function Zt(e){return!e||typeof e!=`object`||Array.isArray(e)||`refClass`in e?e:`artifact`in e&&`localId`in e?{...e,refClass:`local`}:`locator`in e?{...e,refClass:`evidence`}:{...e,refClass:`artifact`}}const Qt=e.preprocess(Zt,Xt),$t=e.object({type:e.string().min(1),sourceLocalId:e.string().min(1).regex(/\S/).optional(),target:Yt}),en=e.enum([`assumed`,`inferred`,`stated`,`confirmed`,`verified`]),tn=e.object({kind:e.string().min(1),actor:Vt,timestamp:e.number().int().nonnegative(),detail:e.string().optional(),evidenceRef:Yt.optional()}),nn=e.object({level:en,basis:e.array(tn)}),rn=e.object({id:e.string().min(1),kind:e.string().min(1),summary:e.string().min(1),detail:e.string().optional(),severity:e.enum([`info`,`warning`,`blocker`]).optional(),tags:e.array(e.string().min(1)).optional(),regarding:e.union([N,Wt]).optional(),evidence:e.union([N,Gt]).optional(),actor:Vt,timestamp:e.number().int().nonnegative()}),an=e.object({markdown:e.string().optional(),summary:e.string().optional(),plaintext:e.string().optional()}),I=e.object({kind:N.shape.kind,id:N.shape.id,slug:lt,revision:N.shape.revision,scope:Ht,schemaVersion:F,data:j,relations:e.array($t),evidence:e.array(zt).optional(),confidence:nn.optional(),representations:an.optional(),actor:Vt,timestamp:e.number().int().nonnegative(),createdAt:e.number().int().nonnegative().optional()}),on=e.enum([`artifact`,`local`,`evidence`,`entity`]),sn=e.object({sourceKinds:e.array(e.string().min(1)).optional(),targetKinds:e.array(e.string().min(1)).optional(),targetRefClasses:e.array(on).optional()}),cn=e.object({type:e.string().min(1),symmetry:e.enum([`asymmetric`,`symmetric`]),implication:e.string().min(1).optional(),...sn.shape,endpoints:e.array(sn).min(1).optional()}).superRefine((e,t)=>{e.endpoints!==void 0&&(e.sourceKinds!==void 0||e.targetKinds!==void 0||e.targetRefClasses!==void 0)&&t.addIssue({code:`custom`,path:[`endpoints`],message:`endpoints cannot be combined with the shorthand fields sourceKinds, targetKinds or targetRefClasses`})}),ln=e.object({kind:e.string().min(1).optional(),scope:Ut.optional(),ids:e.array(e.string().min(1)).optional(),slug:lt.optional(),currentOnly:e.boolean().optional(),search:e.string().optional(),relation:e.object({type:e.string().min(1).optional(),target:Qt.optional()}).optional(),confidence:e.object({maxLevel:en.optional(),minLevel:en.optional()}).optional(),indexed:e.record(e.string(),A).optional(),limit:e.number().int().min(1).optional()}),un=e.object({base:N,target:N}),dn=e.object({base:I,target:I,changedPaths:e.array(e.string())}),fn=e.strictObject({evidence:zt}),pn=e.strictObject({kind:e.literal(`text`),text:e.string()}),[mn,hn,gn]=zt.options,_n=e.union([mn.pick({source:!0,location:!0}).extend({content:pn}),hn.pick({source:!0,location:!0}).extend({content:pn}),gn.pick({source:!0,location:!0}).extend({content:pn})]);var vn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),yn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=vn();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),L=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=vn(),n=yn();var r=vn();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=yn();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ne(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ne(this.rhs,e,n),this}get names(){return te(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ne(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(re(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(D(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ne(this.condition,e,t),this}get names(){let e=super.names;return te(e,this.condition),this.else&&E(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ne(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return te(te(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ne(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var ee=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},w=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};w.kind=`catch`;var T=class extends m{render(e){return`finally`+super.render(e)}};T.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
2
|
+
`)}`,e),this.zodError=t}};const A=e.lazy(()=>e.union([e.string(),e.number().finite(),e.boolean(),e.null(),e.array(A),e.record(e.string(),A)])),we=2**32-2;function Te(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=we&&String(t)===e}function Ee(e){return`ok`in e&&!e.ok}var De=class{ancestors=new Set;completed=new Map;snapshot(e){return this.visit(e,[],0)}failure(e,t){return{ok:!1,violation:{kind:e,path:t}}}visit(e,t,n){if(typeof e==`number`&&Object.is(e,-0))return this.failure(`negative-zero`,t);if(typeof e!=`object`||!e)return{ok:!0,value:e};let r=n+1;if(r>128)return this.failure(`nesting-too-deep`,t);if(this.ancestors.has(e))return this.failure(`cyclic-reference`,t);if(this.completed.has(e))return this.copyCompletedTree(this.completed.get(e),t,r);let i=this.describe(e,t);return Ee(i)?i:this.visitObject(e,i,t,r)}describe(e,t){try{let n=Reflect.ownKeys(e);if(n.some(e=>typeof e==`symbol`))return this.failure(`symbol-key`,t);if(n.includes(`__proto__`))return this.failure(`prototype-key`,[...t,`__proto__`]);let r=Array.isArray(e);return!r&&!Oe(e)?this.failure(`non-plain-object`,t):this.describeProperties(e,n,r,t)}catch{return this.failure(`unreadable-value`,t)}}describeProperties(e,t,n,r){let i=new Map;for(let a of t){if(typeof a!=`string`)continue;let t=Object.getOwnPropertyDescriptor(e,a);if(t===void 0)return this.failure(`unreadable-value`,[...r,a]);if((!n||a!==`length`)&&!t.enumerable)return this.failure(`non-enumerable-key`,[...r,a]);if(n&&a!==`length`&&!Te(a))return this.failure(`extra-array-key`,[...r,a]);i.set(a,t)}return{isArray:n,descriptors:i}}visitObject(e,t,n,r){this.ancestors.add(e);try{let i=t.isArray?this.snapshotArray(e,t.descriptors,n,r):this.snapshotRecord(e,t.descriptors,n,r);return i.ok&&this.completed.set(e,i.value),i}finally{this.ancestors.delete(e)}}snapshotArray(e,t,n,r){let i=t.get(`length`)?.value;if(typeof i!=`number`)return this.failure(`unreadable-value`,[...n,`length`]);let a=[];for(let o=0;o<i;o+=1){let i=t.get(String(o));if(i===void 0)a.push(void 0);else{let t=this.snapshotProperty(e,i,[...n,o],r);if(!t.ok)return t;a.push(t.value)}}return{ok:!0,value:a}}snapshotRecord(e,t,n,r){let i={};for(let[a,o]of t){let t=this.snapshotProperty(e,o,[...n,a],r);if(!t.ok)return t;ke(i,a,t.value)}return{ok:!0,value:i}}snapshotProperty(e,t,n,r){let i=this.readDescriptor(e,t,n);return Ee(i)?i:this.visit(i.value,n,r)}readDescriptor(e,t,n){try{return{ok:!0,value:`value`in t?t.value:Reflect.apply(t.get??(()=>void 0),e,[])}}catch{return this.failure(`unreadable-value`,n)}}copyCompletedTree(e,t,n){if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i+=1){let a=this.copyCompletedValue(e[i],[...t,i],n);if(!a.ok)return a;r.push(a.value)}return{ok:!0,value:r}}if(typeof e!=`object`||!e)return{ok:!0,value:e};let r={};for(let[i,a]of Object.entries(e)){let e=this.copyCompletedValue(a,[...t,i],n);if(!e.ok)return e;ke(r,i,e.value)}return{ok:!0,value:r}}copyCompletedValue(e,t,n){if(typeof e==`number`&&Object.is(e,-0))return this.failure(`negative-zero`,t);if(typeof e!=`object`||!e)return{ok:!0,value:e};let r=n+1;return r>128?this.failure(`nesting-too-deep`,t):this.copyCompletedTree(e,t,r)}};function Oe(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ke(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0})}function Ae(e){return new De().snapshot(e)}function je(t,n){let r={"prototype-key":n.prototypeKey,"non-plain-object":n.nonPlainObject,"symbol-key":n.symbolKey,"non-enumerable-key":n.nonEnumerableKey,"extra-array-key":n.extraArrayKey,"cyclic-reference":`the value contains a cyclic reference and cannot be transported as JSON`,"nesting-too-deep":`the value exceeds the maximum JSON container nesting of 128`,"negative-zero":`the value contains -0, which cannot be transported as JSON without becoming 0`,"unreadable-value":`the value could not be read into a stable JSON boundary snapshot`};return e.preprocess((e,t)=>{let n=Ae(e);if(!n.ok){t.addIssue({code:`custom`,message:r[n.violation.kind],path:[...n.violation.path],input:e});return}return n.value},t)}const j=e.record(e.string(),A),Me=e.record(e.string(),A),M=Me,Ne=e.string().min(1).regex(/\S/),N=e.strictObject({refClass:e.literal(`artifact`),kind:Ne,id:Ne,revision:Ne});function P(e){return Pe(e)?e:void 0}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Fe(e,t){if(!Pe(e))return!1;let n=e.type;return n===t?!0:Array.isArray(n)&&n.length===1&&n[0]===t}function Ie(e,t){return Object.keys(t).length===0?e:e?t:!1}function Le(e,t){if(t===`#`)return e;if(!t.startsWith(`#/`))return;let n=e;for(let e of t.slice(2).split(`/`)){let t=P(n),r=e.replace(/~1/g,`/`).replace(/~0/g,`~`);if(!t||!Object.hasOwn(t,r))return;n=t[r]}return n}function Re(e,t){let n=t.$ref;if(typeof n!=`string`)return;let r=Le(e,n);if(typeof r==`boolean`){if(e.$schema!==`https://json-schema.org/draft/2020-12/schema`)return r;let{$ref:n,...i}=t;return Ie(r,i)}let i=P(r);if(!i||e.$schema!==`https://json-schema.org/draft/2020-12/schema`)return i;let{$ref:a,...o}=t;return Object.keys(o).length===0?i:{...i,allOf:[o,...Array.isArray(i.allOf)?i.allOf:[]]}}function ze(e,t){for(let[n,r]of Object.entries(t))e[n]=Object.hasOwn(e,n)?{allOf:[e[n],r]}:r}function Be(e){return Array.isArray(e.required)?e.required.filter(e=>typeof e==`string`):[]}function Ve(e,t){let n=P(e.properties);if(!n||!Object.hasOwn(n,t))return;let r=n[t];return typeof r==`boolean`?r:P(r)}function He(e,t,n){if(typeof t.$ref==`string`){if(n.has(t.$ref))return;let r=Re(e,t);return Pe(r)?He(e,r,new Set([...n,t.$ref])):void 0}if(!Array.isArray(t.allOf))return t;let{allOf:r,...i}=t,a={},o={},s=new Set;for(let t of[i,...r]){let r=P(t),i=r?He(e,r,n):void 0;if(!i||i.anyOf||i.oneOf)return;if(i.type!==void 0){if(a.type!==void 0&&a.type!==i.type)return;a.type=i.type}for(let e of[`items`,`prefixItems`])if(i[e]!==void 0){if(a[e]!==void 0)return;a[e]=i[e]}ze(o,P(i.properties)??{});for(let e of Be(i))s.add(e)}return{...a,properties:o,required:[...s]}}function Ue(e,t,n,r,i,a,o,s){if(a.has(n))return;let c=Re(e,t);return typeof c==`boolean`?r.length===0?[c]:void 0:c?Ke(e,c,r,i,new Set([...a,n]),o,s):void 0}function We(e,t,n,r){if(!Fe(t,`array`))return;let i=t.items;if(typeof i==`boolean`)return n.length===0?[i]:void 0;let a=P(i);return a?Ke(e,a,n,r):void 0}function Ge(e,t,n){if(typeof n.$ref!=`string`)return{node:{...n,allOf:[t,...Array.isArray(n.allOf)?n.allOf:[]]}};let r=Re(e,n);return Pe(r)?{node:{...r,allOf:[t,...Array.isArray(r.allOf)?r.allOf:[]]},ref:n.$ref}:{node:{allOf:[t,n]}}}function Ke(e,t,n,r,i=new Set,a=!1,o=!1){if(typeof t.$ref==`string`){let s=t.$ref;return Ue(e,t,s,n,r,i,a,o)}let s=Array.isArray(t.anyOf)?`anyOf`:`oneOf`,c=t[s];if(Array.isArray(c)){let{[s]:l,...u}=t,d=c.map(t=>{let s=P(t);if(!s)return;let{node:c,ref:l}=Ge(e,u,s);return Ke(e,c,n,r,l===void 0?i:new Set([...i,l]),a,o)});return d.every(e=>e!==void 0)?d.flatMap(e=>e??[]):void 0}if(Array.isArray(t.allOf)){let s=He(e,t,i);return s?Ke(e,s,n,r,i,a,o):void 0}if(n.length===0)return[t];let[l,...u]=n;if(l===`[]`)return We(e,t,u,r||o);if(!(!Fe(t,`object`)&&!(t.type===void 0&&a))&&!(!l||r&&!Be(t).includes(l)))return qe(e,Ve(t,l),u,r,o)}function qe(e,t,n,r,i){return typeof t==`boolean`?n.length===0?[t]:void 0:t?Ke(e,t,n,r,new Set,!1,i):void 0}function Je(e,t,n){return Ke(e,e,[...t],n?.required??!1,new Set,!0,n?.requiredAfterElement??!1)}function Ye(e,t){return Je(e,t.split(`.`))!==void 0}function Xe(e){let t=[],n=(e,n)=>{let r=P(e);r&&t.push({node:r,path:n})};for(let t of[`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`])for(let[r,i]of Object.entries(P(e[t])??{}))n(i,[t,r]);for(let t of[`allOf`,`anyOf`,`oneOf`,`prefixItems`,`items`]){let r=e[t];Array.isArray(r)&&r.forEach((e,r)=>n(e,[t,r]))}for(let t of[`items`,`additionalItems`,`additionalProperties`,`unevaluatedItems`,`unevaluatedProperties`,`propertyNames`,`contains`,`not`,`if`,`then`,`else`,`contentSchema`])n(e[t],[t]);return t}function Ze(e,t,n=new Set){if(t.additionalProperties===!1)return!0;if(typeof t.$ref==`string`&&!n.has(t.$ref)){let r=Re(e,t);if(r===void 0||Pe(r)&&Ze(e,r,new Set([...n,t.$ref])))return!0}return Xe(t).some(t=>Ze(e,t.node,n))}function Qe(e,t,n,r){if(Object.hasOwn(t,`$ref`)&&typeof t.$ref!=`string`&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Schema reference must be a string`}),typeof t.$ref==`string`&&!t.$ref.startsWith(`#`)&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Only fragment schema references are supported; absolute and document-relative references are outside the artifact registration profile`}),Object.hasOwn(t,`$anchor`)&&n.addIssue({code:`custom`,path:[...r,`$anchor`],message:`Named schema anchors are not supported; use local JSON Pointer references`}),typeof t.$ref==`string`&&t.$ref.startsWith(`#`)&&t.$ref.length>1&&!t.$ref.startsWith(`#/`)&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Named schema references are not supported; use local JSON Pointer references`}),typeof t.$ref==`string`&&(t.$ref===`#`||t.$ref.startsWith(`#/`))){let i=Le(e,t.$ref);!P(i)&&typeof i!=`boolean`&&n.addIssue({code:`custom`,path:[...r,`$ref`],message:`Fragment schema reference must resolve to an existing object or boolean schema`})}}function $e(e,t,n,r=[`dataSchema`]){Object.hasOwn(t,`$async`)&&t.$async!==!1&&n.addIssue({code:`custom`,path:[...r,`$async`],message:`Asynchronous artifact schemas are not supported`}),Qe(e,t,n,r);for(let e of[`anyOf`,`oneOf`]){let i=t[e];Array.isArray(i)&&i.some(e=>typeof e==`boolean`)&&n.addIssue({code:`custom`,path:[...r,e],message:`Unsupported boolean union alternative: use object schema declarations`})}Array.isArray(t.allOf)&&(Ze(e,t)||!He(e,t,new Set))&&n.addIssue({code:`custom`,path:[...r,`allOf`],message:`Unsupported intersection: use open compatible conjuncts or a single closed object schema`});for(let i of Xe(t))$e(e,i.node,n,[...r,...i.path])}function et(e,t){$e(e.dataSchema,e.dataSchema,t);let n=Ke(e.dataSchema,e.dataSchema,e.titlePath.split(`.`),!0,new Set,!0);(!n?.length||n.some(e=>!Fe(e,`string`)))&&t.addIssue({code:`custom`,path:[`titlePath`],message:`titlePath must select a required string in every data schema variant`});let r=[...(e.indexedFields??[]).map((e,t)=>({path:e,location:[`indexedFields`,t]})),...(e.searchableFields??[]).map((e,t)=>({path:e,location:[`searchableFields`,t]})),...(e.uniqueness??[]).flatMap((e,t)=>e.by.flatMap((e,n)=>e.kind===`data`?[{path:e.path,location:[`uniqueness`,t,`by`,n,`path`]}]:[])),...Object.entries(e.views??{}).flatMap(([e,t])=>t.fields.map((t,n)=>({path:t,location:[`views`,e,`fields`,n]})))];for(let{path:n,location:i}of r)Ye(e.dataSchema,n)||t.addIssue({code:`custom`,path:i,message:`Data path ${n} must select a declared field`})}const tt=[`$dynamicRef`,`$dynamicAnchor`,`$recursiveRef`,`$recursiveAnchor`];function nt(e,t,n=[`dataSchema`]){for(let r of tt)Object.hasOwn(e,r)&&t.addIssue({code:`custom`,path:[...n,r],message:`Unsupported dynamic reference: use a plain local $ref`});for(let r of Xe(e))nt(r.node,t,[...n,...r.path])}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e,t){if(typeof t!=`string`)return;let n=Le(e,t);return rt(n)?n:void 0}function at(e,t){return rt(e)?Object.values(e).some(e=>Array.isArray(e)&&e.includes(t)):!1}function ot(e,t){let n=e.properties;if(rt(n)&&Object.hasOwn(n,t)||Array.isArray(e.required)&&e.required.includes(t)||at(e.dependentRequired,t)||at(e.dependencies,t))return!0;let r=e.patternProperties;return rt(r)?Object.keys(r).some(e=>{try{return new RegExp(e,`u`).test(t)}catch{return!1}}):!1}function st(e){let t=[];for(let n of[`allOf`,`anyOf`,`oneOf`]){let r=e[n];if(Array.isArray(r))for(let e of r)rt(e)&&t.push(e)}for(let n of[`if`,`then`,`else`]){let r=e[n];rt(r)&&t.push(r)}for(let n of[`dependentSchemas`,`dependencies`]){let r=e[n];if(rt(r))for(let e of Object.values(r))rt(e)&&t.push(e)}return t}function ct(e,t){let n=new Set,r=i=>{if(n.has(i))return!1;if(n.add(i),ot(i,t))return!0;let a=it(e,i.$ref);return a&&r(a)?!0:st(i).some(r)};return r(e)}const lt=e.string().regex(/^[a-z0-9]+(--?[a-z0-9]+)*$/,`Slug must be lowercase alphanumeric segments joined by hyphens.`),ut=`slug`;function dt(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0})}function ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pt(e,t){let n=e.addressableParts;if(!n||n.length===0)return;let r=new Set;for(let[i,a]of n.entries())r.has(a.path)&&t.addIssue({code:`custom`,path:[`addressableParts`,i,`path`],message:`addressableParts[${i}].path duplicates an earlier area; each declared area must have a distinct path`}),r.add(a.path),mt(e.dataSchema,a,i,t)}function mt(e,t,n,r){let i=Je(e,t.path.split(`.`));if(!i||i.length===0){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path must select a declared location in every data schema variant`});return}if(i.some(e=>!Fe(e,`array`))){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path must select an array schema in every data schema variant`});return}if(i.some(e=>typeof e==`object`&&(Array.isArray(e.prefixItems)||Array.isArray(e.items)))){r.addIssue({code:`custom`,path:[`addressableParts`,n,`path`],message:`addressableParts[${n}].path selects a tuple schema; tuples are outside the addressable-parts profile (homogeneous arrays only)`});return}ht(e,t,n,r)}function ht(e,t,n,r){let i=()=>{r.addIssue({code:`custom`,path:[`addressableParts`,n,`idPath`],message:`addressableParts[${n}].idPath must select a required string in every element variant`})},a=t.idPath.split(`.`),o=Je(e,[...t.path.split(`.`),`[]`,...a],{requiredAfterElement:!0});if(!o||o.length===0){i();return}o.some(e=>!Fe(e,`string`))&&i()}const gt=e.strictObject({code:e.enum([`ARTIFACT_NOT_FOUND`,`KIND_NOT_REGISTERED`,`NO_PARTS_DECLARED`,`PART_NOT_FOUND`,`DUPLICATE_LOCAL_ID`]),message:e.string().min(1),repair:e.string().min(1)}),F=e.number().int().positive(),_t=e.enum([`knowledge`,`commitment`,`interaction`,`record`]),vt=e.string().regex(/^[A-Za-z_$][\w$-]*(?:\.[A-Za-z_$][\w$-]*)*$/),yt=e.strictObject({fields:e.array(vt).min(1)}),bt=new Set([`full`]),xt={knowledge:[`valid`,`retired`],commitment:[`proposed`,`decided`,`fulfilled`,`revoked`],interaction:[`open`,`resolved`,`closed-without-resolution`],record:[]},St=e.enum([...xt.knowledge,...xt.commitment,...xt.interaction]),Ct=e.strictObject({path:vt,equals:e.union([e.string(),e.number(),e.boolean()])}),wt=e.strictObject({relationType:e.string().trim().min(1),targetKinds:e.array(e.string().trim().min(1)).min(1).optional(),minItems:e.number().int().nonnegative(),maxItems:e.number().int().nonnegative().optional(),when:Ct.optional()}).refine(e=>e.maxItems===void 0||e.maxItems>=e.minItems,{path:[`maxItems`],message:`maxItems must be at least minItems`}),Tt=e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`data`),path:vt}),e.strictObject({kind:e.literal(`relation-target`),relationType:e.string().trim().min(1)})]),Et=e.strictObject({path:vt,idPath:vt}),Dt=e.strictObject({by:e.array(Tt).min(1),lifecycleStates:e.array(St).min(1).optional()}),Ot=e.strictObject({minItems:e.number().int().nonnegative()}),kt=e.enum([`http://json-schema.org/draft-07/schema#`,`https://json-schema.org/draft/2020-12/schema`]).optional(),At=e.strictObject({kind:e.string().trim().min(1),description:e.string().trim().min(1),schemaVersion:F,category:_t,dataSchema:j,titlePath:vt,relations:e.array(wt).optional(),uniqueness:e.array(Dt).optional(),evidenceRequirements:Ot.optional(),indexedFields:e.array(vt).optional(),searchableFields:e.array(vt).optional(),addressableParts:e.array(Et).min(1).optional(),views:e.record(e.string().trim().min(1),yt).optional()}).superRefine((e,t)=>{kt.safeParse(e.dataSchema.$schema).success||t.addIssue({code:`custom`,path:[`dataSchema`,`$schema`],message:`Unsupported data schema dialect: omit $schema for draft-7 or declare the supported draft-7 or 2020-12 URI`});let n=xt[e.category];e.uniqueness?.forEach((r,i)=>{r.lifecycleStates?.some(e=>!n.includes(e))&&t.addIssue({code:`custom`,path:[`uniqueness`,i,`lifecycleStates`],message:`Lifecycle conditions are incompatible with category ${e.category}`})}),e.relations?.forEach((n,r)=>{n.when&&!Ye(e.dataSchema,n.when.path)&&t.addIssue({code:`custom`,path:[`relations`,r,`when`,`path`],message:`Data path ${n.when.path} must select a declared field`})}),Object.keys(e.views??{}).forEach(e=>{bt.has(e)&&t.addIssue({code:`custom`,path:[`views`,e],message:`Artifact kind view ${e} is reserved for the generic complete-payload view`})}),ct(e.dataSchema,`slug`)&&t.addIssue({code:`custom`,path:[`dataSchema`,`properties`,ut],message:`Data field ${ut} is reserved: the artifact envelope owns the slug`}),nt(e.dataSchema,t),et(e,t),pt(e,t)}),jt=e.object({kind:e.string().trim().min(1).regex(/\S/),path:e.string().trim().min(1).regex(/\S/)}),Mt=e.string().min(1).regex(/\S/),Nt=e.strictObject({kind:e.literal(`whole-source`)}),Pt=e.strictObject({kind:e.literal(`lines`),startLine:e.number().int().positive(),lineCount:e.number().int().positive()}),Ft=e.strictObject({kind:e.literal(`data-path`),path:vt}),It=e.strictObject({kind:e.literal(`git-file`),repository:jt.strict(),path:Mt,commit:e.string().regex(/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/)}),Lt=e.strictObject({kind:e.literal(`confluence-page`),site:Mt,pageId:Mt,version:e.number().int().positive()}),Rt=e.strictObject({kind:e.literal(`artifact`),reference:N}),zt=e.union([e.strictObject({source:It,location:e.union([Nt,Pt]),excerpt:e.string().optional()}),e.strictObject({source:Lt,location:Nt,excerpt:e.string().optional()}),e.strictObject({source:Rt,location:e.union([Nt,Ft]),excerpt:e.string().optional()})]).meta({title:`EvidenceValue`,description:`An immutable, directly cited source and its source-specific location.`,"x-makaio-value-type":`evidence/v1`}),Bt=e.string().regex(/^(?:\/(?:[^~/]|~[01])*)+$/,`Expected a data-relative JSON Pointer`),Vt=e.object({kind:e.string().min(1),id:e.string().min(1),displayName:e.string().optional()}),Ht=e.object({level:e.string().min(1),ids:e.record(e.string().min(1),e.string().min(1)).optional()}).superRefine((t,n)=>{t.level!==`global`&&(!t.ids||Object.keys(t.ids).length===0)&&n.addIssue({code:e.ZodIssueCode.custom,path:[`ids`],message:`ids is required when scope level is not 'global'`})}),Ut=e.object({level:e.string().min(1),ids:e.record(e.string().min(1),e.string().min(1)).optional()}),Wt=e.object({refClass:e.literal(`local`).default(`local`),artifact:N,localId:e.string().min(1)}),Gt=e.object({refClass:e.literal(`evidence`).default(`evidence`),kind:e.string().min(1),id:e.string().min(1),revision:e.string().min(1).optional(),locator:e.string().min(1).optional()}),Kt=e.strictObject({refClass:e.literal(`entity`),entityType:e.string().min(1),id:e.string().min(1)}),qt=e.discriminatedUnion(`refClass`,[N,Wt,Gt,Kt]);function Jt(e){return!e||typeof e!=`object`||Array.isArray(e)||`refClass`in e?e:`artifact`in e&&`localId`in e?{...e,refClass:`local`}:`locator`in e||!(`revision`in e)?{...e,refClass:`evidence`}:{...e,refClass:`artifact`}}const Yt=e.preprocess(Jt,qt),Xt=e.discriminatedUnion(`refClass`,[N.extend({revision:N.shape.revision.optional()}),Wt,Gt,Kt]);function Zt(e){return!e||typeof e!=`object`||Array.isArray(e)||`refClass`in e?e:`artifact`in e&&`localId`in e?{...e,refClass:`local`}:`locator`in e?{...e,refClass:`evidence`}:{...e,refClass:`artifact`}}const Qt=e.preprocess(Zt,Xt),$t=e.object({type:e.string().min(1),sourceLocalId:e.string().min(1).regex(/\S/).optional(),target:Yt}),en=e.enum([`assumed`,`inferred`,`stated`,`confirmed`,`verified`]),tn=e.object({kind:e.string().min(1),actor:Vt,timestamp:e.number().int().nonnegative(),detail:e.string().optional(),evidenceRef:Yt.optional()}),nn=e.object({level:en,basis:e.array(tn)}),rn=e.object({id:e.string().min(1),kind:e.string().min(1),summary:e.string().min(1),detail:e.string().optional(),severity:e.enum([`info`,`warning`,`blocker`]).optional(),tags:e.array(e.string().min(1)).optional(),regarding:e.union([N,Wt]).optional(),evidence:e.union([N,Gt]).optional(),actor:Vt,timestamp:e.number().int().nonnegative()}),an=e.object({markdown:e.string().optional(),summary:e.string().optional(),plaintext:e.string().optional()}),I=e.object({kind:N.shape.kind,id:N.shape.id,slug:lt,revision:N.shape.revision,scope:Ht,schemaVersion:F,data:j,relations:e.array($t),evidence:e.array(zt).optional(),confidence:nn.optional(),representations:an.optional(),actor:Vt,timestamp:e.number().int().nonnegative(),createdAt:e.number().int().nonnegative().optional()}),on=e.enum([`artifact`,`local`,`evidence`,`entity`]),sn=e.object({sourceKinds:e.array(e.string().min(1)).optional(),targetKinds:e.array(e.string().min(1)).optional(),targetRefClasses:e.array(on).optional(),description:e.string().trim().min(1).optional()}),cn=e.object({type:e.string().min(1),symmetry:e.enum([`asymmetric`,`symmetric`]),implication:e.string().min(1).optional(),description:e.string().trim().min(1).optional(),...sn.omit({description:!0}).shape,endpoints:e.array(sn).min(1).optional()}).superRefine((e,t)=>{e.endpoints!==void 0&&(e.sourceKinds!==void 0||e.targetKinds!==void 0||e.targetRefClasses!==void 0)&&t.addIssue({code:`custom`,path:[`endpoints`],message:`endpoints cannot be combined with the shorthand fields sourceKinds, targetKinds or targetRefClasses`})}),ln=e.object({kind:e.string().min(1).optional(),scope:Ut.optional(),ids:e.array(e.string().min(1)).optional(),slug:lt.optional(),currentOnly:e.boolean().optional(),search:e.string().optional(),relation:e.object({type:e.string().min(1).optional(),target:Qt.optional()}).optional(),confidence:e.object({maxLevel:en.optional(),minLevel:en.optional()}).optional(),indexed:e.record(e.string(),A).optional(),limit:e.number().int().min(1).optional()}),un=e.object({base:N,target:N}),dn=e.object({base:I,target:I,changedPaths:e.array(e.string())}),fn=e.strictObject({evidence:zt}),pn=e.strictObject({kind:e.literal(`text`),text:e.string()}),[mn,hn,gn]=zt.options,_n=e.union([mn.pick({source:!0,location:!0}).extend({content:pn}),hn.pick({source:!0,location:!0}).extend({content:pn}),gn.pick({source:!0,location:!0}).extend({content:pn})]);var vn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),yn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=vn();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),L=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=vn(),n=yn();var r=vn();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=yn();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ne(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ne(this.rhs,e,n),this}get names(){return te(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ne(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(re(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(D(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ne(this.condition,e,t),this}get names(){let e=super.names;return te(e,this.condition),this.else&&E(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ne(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return te(te(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ne(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var ee=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},w=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};w.kind=`catch`;var T=class extends m{render(e){return`finally`+super.render(e)}};T.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
3
|
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new ee;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new w(e),t(e)}return n&&(this._currNode=r.finally=new T,this.code(n)),this._endBlockNode(w,T)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function E(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function te(e,n){return n instanceof t._CodeOrName?E(e,n.names):e}function ne(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function re(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${ce(e)}`}e.not=D;let O=se(e.operators.AND);function ie(...e){return e.reduce(O)}e.and=ie;let ae=se(e.operators.OR);function oe(...e){return e.reduce(ae)}e.or=oe;function se(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${ce(n)} ${e} ${ce(r)}`}function ce(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),R=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=L(),n=vn();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),bn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),xn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=L(),n=R(),r=bn();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),Sn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=xn(),n=L(),r=bn(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Cn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),wn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Tn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=Cn(),n=wn(),r=xn(),i=L(),a=R();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
4
4
|
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
5
5
|
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as RehydrateAgentRequest, B as AdapterSchemas, C as aggregateTeardownResults, D as AcknowledgeCallerSettlementSchema, E as AcknowledgeCallerSettlementResponse, F as StartAgentRequest, H as AdapterSubjects, I as StartAgentResponse, L as StartAgentSchema, M as RehydrateAgentSchema, N as AdapterStartDisposition, O as CallerSettlementAckRefusal, P as AdapterStartDispositionSchema, R as AdapterRuntimeOptions, S as aggregateTeardownEvidence, T as AcknowledgeCallerSettlementRequest, V as AdapterNamespace, _ as SessionUsageSchema, a as UnresolvedProviderContext, b as TeardownEvidence, c as AdapterSelectionSchema, d as AgentSelectionBaseSchema, f as AgentSelectionKindMap, g as SessionUsage, h as SessionDiscoveredSchema, i as ResolvedProviderContextSchema, j as RehydrateAgentResponse, k as CallerSettlementAckRefusalSchema, l as AgentSelection, m as SessionDiscovered, n as ProviderContextSchema, o as UnresolvedProviderContextSchema, p as AgentSelectionSchema, r as ResolvedProviderContext, s as AdapterSelection, t as ProviderContext, u as AgentSelectionBase, v as ConnectorTeardownResult, w as teardownWasObserved, x as TeardownEvidenceSchema, y as ConnectorTeardownResultSchema, z as AdapterRuntimeOptionsSchema } from "../../index-
|
|
1
|
+
import { A as RehydrateAgentRequest, B as AdapterSchemas, C as aggregateTeardownResults, D as AcknowledgeCallerSettlementSchema, E as AcknowledgeCallerSettlementResponse, F as StartAgentRequest, H as AdapterSubjects, I as StartAgentResponse, L as StartAgentSchema, M as RehydrateAgentSchema, N as AdapterStartDisposition, O as CallerSettlementAckRefusal, P as AdapterStartDispositionSchema, R as AdapterRuntimeOptions, S as aggregateTeardownEvidence, T as AcknowledgeCallerSettlementRequest, V as AdapterNamespace, _ as SessionUsageSchema, a as UnresolvedProviderContext, b as TeardownEvidence, c as AdapterSelectionSchema, d as AgentSelectionBaseSchema, f as AgentSelectionKindMap, g as SessionUsage, h as SessionDiscoveredSchema, i as ResolvedProviderContextSchema, j as RehydrateAgentResponse, k as CallerSettlementAckRefusalSchema, l as AgentSelection, m as SessionDiscovered, n as ProviderContextSchema, o as UnresolvedProviderContextSchema, p as AgentSelectionSchema, r as ResolvedProviderContext, s as AdapterSelection, t as ProviderContext, u as AgentSelectionBase, v as ConnectorTeardownResult, w as teardownWasObserved, x as TeardownEvidenceSchema, y as ConnectorTeardownResultSchema, z as AdapterRuntimeOptionsSchema } from "../../index-CTScKg_6.mjs";
|
|
2
2
|
import { a as ROOT_SESSION_LINEAGE_KIND, c as SUBAGENT_SESSION_LINEAGE_KIND, d as SessionLineageKindSchema, f as SessionLineageSchema, i as ForkSessionLineageSchema, l as SessionLineage, n as CompressSessionLineageSchema, o as RootSessionLineageSchema, p as SubagentSessionLineageSchema, r as FORK_SESSION_LINEAGE_KIND, s as SESSION_LINEAGE_KINDS, t as COMPRESS_SESSION_LINEAGE_KIND, u as SessionLineageKind } from "../../session-lineage-Bjh0Ccu7.mjs";
|
|
3
3
|
export { AcknowledgeCallerSettlementRequest, AcknowledgeCallerSettlementResponse, AcknowledgeCallerSettlementSchema, AdapterNamespace, AdapterRuntimeOptions, AdapterRuntimeOptionsSchema, AdapterSchemas, AdapterSelection, AdapterSelectionSchema, AdapterStartDisposition, AdapterStartDispositionSchema, AdapterSubjects, AgentSelection, AgentSelectionBase, AgentSelectionBaseSchema, AgentSelectionKindMap, AgentSelectionSchema, COMPRESS_SESSION_LINEAGE_KIND, CallerSettlementAckRefusal, CallerSettlementAckRefusalSchema, CompressSessionLineageSchema, ConnectorTeardownResult, ConnectorTeardownResultSchema, FORK_SESSION_LINEAGE_KIND, ForkSessionLineageSchema, ProviderContext, ProviderContextSchema, ROOT_SESSION_LINEAGE_KIND, RehydrateAgentRequest, RehydrateAgentResponse, RehydrateAgentSchema, ResolvedProviderContext, ResolvedProviderContextSchema, RootSessionLineageSchema, SESSION_LINEAGE_KINDS, SUBAGENT_SESSION_LINEAGE_KIND, SessionDiscovered, SessionDiscoveredSchema, SessionLineage, SessionLineageKind, SessionLineageKindSchema, SessionLineageSchema, SessionUsage, SessionUsageSchema, StartAgentRequest, StartAgentResponse, StartAgentSchema, SubagentSessionLineageSchema, TeardownEvidence, TeardownEvidenceSchema, UnresolvedProviderContext, UnresolvedProviderContextSchema, aggregateTeardownEvidence, aggregateTeardownResults, teardownWasObserved };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as ArtifactLifecycleState, A as ConfidenceMetadata, B as RelationTargetRefClass, C as ArtifactScope, D as ConfidenceBasisSchema, E as ConfidenceBasis, F as EvidenceRefSchema, G as ArtifactCategorySchema, H as RelationTypeRegistrationSchema, I as LocalRef, J as ArtifactEvidenceRequirementsSchema, K as ArtifactDataPathSchema, L as LocalRefSchema, M as EntityRef, N as EntityRefSchema, O as ConfidenceLevel, P as EvidenceRef, Q as ArtifactKindViewSchema, R as RelationEndpoint, S as ArtifactRevisionSchema, T as ArtifactStatusPathSchema, U as ARTIFACT_CATEGORY_LIFECYCLE_STATES, V as RelationTypeRegistration, W as ArtifactCategory, X as ArtifactKindRegistrationSchema, Y as ArtifactKindRegistration, Z as ArtifactKindView, _ as ArtifactRelationTarget, a as ArtifactCompareResponse, at as ArtifactRelationRequirementConditionSchema, b as ArtifactRepresentationsSchema, c as ArtifactObservationSchema, ct as ArtifactUniquenessRule, d as ArtifactQueryScope, dt as ArtifactRef, et as ArtifactLifecycleStateSchema, f as ArtifactQueryScopeSchema, ft as ArtifactRefSchema, g as ArtifactRelationSchema, h as ArtifactRelationQueryTargetSchema, i as ArtifactCompareRequestSchema, it as ArtifactRelationRequirementCondition, j as ConfidenceMetadataSchema, k as ConfidenceLevelSchema, l as ArtifactQueryRequest, lt as ArtifactUniquenessRuleSchema, m as ArtifactRelationQueryTarget, n as ArtifactActorSchema, nt as ArtifactPartAreaSchema, o as ArtifactCompareResponseSchema, ot as ArtifactRelationRequirementSchema, p as ArtifactRelation, q as ArtifactEvidenceRequirements, r as ArtifactCompareRequest, rt as ArtifactRelationRequirement, s as ArtifactObservation, st as ArtifactSchemaVersionSchema, t as ArtifactActor, tt as ArtifactPartArea, u as ArtifactQueryRequestSchema, ut as ArtifactUniquenessSelectorSchema, v as ArtifactRelationTargetSchema, w as ArtifactScopeSchema, x as ArtifactRevision, y as ArtifactRepresentations, z as RelationEndpointSchema } from "../../schemas-
|
|
2
|
-
import { $ as ArtifactLifecycleInitializedEntrySchema, $n as ArtifactContextRefEntrySchema, $r as slugify, $t as ArtifactRelationSourceIssue, A as ArtifactLifecycleFailureSchema, An as ArtifactRelationTypeRegisterRequest, Ar as ArtifactDraftPatch, At as ArtifactPatchMigration, B as ArtifactLifecycleRejectedPayloadSchema, Bn as ArtifactStatusChangedPayload, Br as EvidenceOccurrenceExtractionOptions, Bt as ArtifactPatchResponseSchema, C as ArtifactRelationTargetIdentitySchema, Cn as ArtifactObservationAddedPayload, Cr as ArtifactDataOf, Ct as ArtifactPatchError, D as ArtifactLifecycleCommittedPayload, Dn as ArtifactRelationAddedPayload, Dr as AfterArtifactHookContext, Dt as ArtifactPatchInstruction, E as serializeArtifactRelationTargetIdentity, En as ArtifactQueryResponse, Er as defineArtifactKind, Et as ArtifactPatchFailureSchema, F as ArtifactLifecycleHistoryRequest, Fn as ArtifactResolveResponse, Fr as ArtifactLifecycleSemanticEvent, Ft as ArtifactPatchPathSchema, G as ARTIFACT_LIFECYCLE_REJECTED_CODE, Gn as ArtifactResolvePartResponseSchema, Gr as EvidenceResolveResponseSchema, Gt as ArtifactPatchTargetSchema, H as ArtifactLifecycleTransitionResponse, Hn as ArtifactResolvePartRequest, Hr as EvidenceResolveRequest, Ht as ArtifactPatchSuccess, I as ArtifactLifecycleHistoryRequestSchema, In as ArtifactReviseRequest, Ir as BeforeArtifactHookContext, It as ArtifactPatchPersistedSchema, J as ArtifactLifecycleError, Jn as ArtifactContextRootNode, Jr as ARTIFACT_SLUG_FIELD, Jt as artifactPatchPathFilterNames, K as ArtifactLifecycleCurrent, Kn as hydrateArtifactContextTree, Kr as mayArtifactDataCarryProperty, Kt as artifactPatchFilterName, L as ArtifactLifecycleHistoryResponse, Ln as ArtifactReviseResponse, Lr as BeforeArtifactHookRegistration, Lt as ArtifactPatchRequest, M as ArtifactLifecycleGetRequestSchema, Mn as ArtifactResolveContextRequest, Mr as ArtifactLifecycleHookDefinition, Mt as ArtifactPatchOperationResult, N as ArtifactLifecycleGetResponse, Nn as ArtifactResolveContextResponse, Nr as ArtifactLifecycleHookEvent, Nt as ArtifactPatchOperationResultSchema, O as ArtifactLifecycleCommittedPayloadSchema, On as ArtifactRelationTypeListRequest, Or as AfterArtifactHookRegistration, Ot as ArtifactPatchIssue, P as ArtifactLifecycleGetResponseSchema, Pn as ArtifactResolveRequest, Pr as ArtifactLifecycleHookRegistration, Pt as ArtifactPatchOperator, Q as ArtifactLifecycleInitializedEntry, Qn as ArtifactContextRefEntry, Qr as deriveArtifactSlug, Qt as ArtifactPartResolution, R as ArtifactLifecycleHistoryResponseSchema, Rn as ArtifactRevisedPayload, Rr as defineArtifactLifecycleHooks, Rt as ArtifactPatchRequestSchema, S as ArtifactRelationTargetIdentity, Sn as ArtifactNamespace, Sr as AnyArtifactKindDefinition, St as ArtifactPatchDryRunSchema, T as describeArtifactRelationTargetIdentity, Tn as ArtifactPatchSubjectResponse, Tr as ArtifactOf, Tt as ArtifactPatchErrorSchema, U as ArtifactLifecycleTransitionResponseSchema, Un as ArtifactResolvePartRequestSchema, Ur as EvidenceResolveRequestSchema, Ut as ArtifactPatchSuccessSchema, V as ArtifactLifecycleSchemas, Vn as ArtifactSubjects, Vr as extractEvidenceOccurrences, Vt as ArtifactPatchSegment, W as toArtifactLifecycleFailure, Wn as ArtifactResolvePartResponse, Wr as EvidenceResolveResponse, Wt as ArtifactPatchTarget, X as ArtifactLifecycleHistoryEntrySchema, Xn as ResolvedArtifactContextNode, Xr as ArtifactSlug, Xt as artifactPatchSegments, Y as ArtifactLifecycleHistoryEntry, Yn as ArtifactContextTree, Yr as ARTIFACT_SLUG_PATTERN, Yt as artifactPatchSegment, Z as ArtifactLifecycleIdentitySchema, Zn as UnresolvedArtifactContextNode, Zr as ArtifactSlugSchema, Zt as ARTIFACT_RESOLVE_PART_ERROR_CODES, _ as UniquenessSelectorCapability, _n as ArtifactKindChangedPayload, _r as ArtifactDataChecker, _t as ARTIFACT_PATCH_OPERATORS, a as normalizeRelationTypeRegistration, an as resolveArtifactPart, ar as ARTIFACT_CONTEXT_RELATION_DIRECTIONS, at as ArtifactLifecycleSnapshotSchema, b as buildUniquenessKeys, bn as ArtifactKindRegisterRequest, br as compileArtifactDataChecker, bt as ArtifactPatchDocument, c as RelationRequirementIssueReason, cn as ArtifactSchemaFragment, cr as ArtifactContextRelationDirection, ct as ArtifactLifecycleTransitionIntent, d as UniquenessDataKeyPart, dn as readArtifactTitle, dr as ArtifactContextRelationSelectorSchema, dt as ArtifactLifecycleTransitionedEntrySchema, ei as ARTIFACT_VALUE_TYPE_KEYWORD, en as ArtifactResolvePartError, er as ArtifactContextUnresolvedReason, et as ArtifactLifecycleRejection, f as UniquenessKey, fn as ArtifactCreateRequest, fr as ArtifactContextRenderHint, ft as ArtifactLifecycleVersionSchema, g as UniquenessRelationTargetKeyPart, gn as ArtifactEvidenceResolveResponse, gr as ArtifactDataCheck, gt as ARTIFACT_PATCH_ERROR_CODES, h as UniquenessKeyPart, hn as ArtifactEvidenceResolveRequest, hr as ArtifactContextSelectorSchema, ht as isArtifactLifecycleTransitionAllowed, i as mergeRelationTypeRegistrations, in as checkArtifactRelationSourceParts, ir as artifactRevisionKey, it as ArtifactLifecycleSnapshot, j as ArtifactLifecycleGetRequest, jn as ArtifactRelationTypeRegisterResponse, jr as ArtifactHookFilter, jt as ArtifactPatchMigrationSchema, k as ArtifactLifecycleFailure, kn as ArtifactRelationTypeListResponse, kr as ArtifactDraft, kt as ArtifactPatchIssueSchema, l as evaluateRelationRequirements, ln as inspectArtifactDataLocation, lr as ArtifactContextRelationDirectionSchema, lt as ArtifactLifecycleTransitionIntentSchema, m as UniquenessKeyIssueReason, mn as ArtifactCreatedPayload, mr as ArtifactContextSelector, mt as initialArtifactLifecycle, n as RelationEndpointCandidate, ni as EvidenceValue, nn as ArtifactResolvePartErrorSchema, nr as ResolvedArtifactContextWire, nt as ArtifactLifecycleSituation, o as relationTypePermits, on as validateArtifactPartAreas, or as ARTIFACT_CONTEXT_RENDER_HINTS, ot as ArtifactLifecycleTransitionCommand, p as UniquenessKeyIssue, pn as ArtifactCreateResponse, pr as ArtifactContextRenderHintSchema, pt as advanceArtifactLifecycle, q as ArtifactLifecycleCurrentSchema, qn as ArtifactContextNode, qr as ARTIFACT_DERIVED_SLUG_MAX_LENGTH, qt as artifactPatchInstructions, r as RelationTypeConflictError, ri as EvidenceValueSchema, rn as checkArtifactPartIds, rr as ResolvedArtifactContextWireSchema, rt as ArtifactLifecycleSituationSchema, s as RelationRequirementIssue, sn as ARTIFACT_COLLECTION_ELEMENT_SEGMENT, sr as ArtifactContextKnownRenderHint, st as ArtifactLifecycleTransitionCommandSchema, t as NormalizedRelationTypeRegistration, ti as EVIDENCE_VALUE_TYPE, tn as ArtifactResolvePartErrorCode, tr as ArtifactContextUnresolvedReasonSchema, tt as ArtifactLifecycleRejectionSchema, u as BuildUniquenessKeysResult, un as isArtifactDataPathDeclared, ur as ArtifactContextRelationSelector, ut as ArtifactLifecycleTransitionedEntry, v as UniquenessSupportIssue, vn as ArtifactKindListRequest, vr as ArtifactDataIssue, vt as ArtifactPatchArrayFilter, w as artifactRelationTargetIdentity, wn as ArtifactPatchSubjectRequest, wr as ArtifactKindDefinition, wt as ArtifactPatchErrorCode, x as describeUniquenessKey, xn as ArtifactKindRegisterResponse, xr as compileArtifactDataSchema, xt as ArtifactPatchDocumentSchema, y as assessUniquenessSupport, yn as ArtifactKindListResponse, yr as ArtifactDataValidator, yt as ArtifactPatchArrayFilterSchema, z as ArtifactLifecycleRejectedPayload, zn as ArtifactSchemas, zr as EvidenceOccurrence, zt as ArtifactPatchResponse } from "../../index-
|
|
1
|
+
import { $ as ArtifactLifecycleState, A as ConfidenceMetadata, B as RelationTargetRefClass, C as ArtifactScope, D as ConfidenceBasisSchema, E as ConfidenceBasis, F as EvidenceRefSchema, G as ArtifactCategorySchema, H as RelationTypeRegistrationSchema, I as LocalRef, J as ArtifactEvidenceRequirementsSchema, K as ArtifactDataPathSchema, L as LocalRefSchema, M as EntityRef, N as EntityRefSchema, O as ConfidenceLevel, P as EvidenceRef, Q as ArtifactKindViewSchema, R as RelationEndpoint, S as ArtifactRevisionSchema, T as ArtifactStatusPathSchema, U as ARTIFACT_CATEGORY_LIFECYCLE_STATES, V as RelationTypeRegistration, W as ArtifactCategory, X as ArtifactKindRegistrationSchema, Y as ArtifactKindRegistration, Z as ArtifactKindView, _ as ArtifactRelationTarget, a as ArtifactCompareResponse, at as ArtifactRelationRequirementConditionSchema, b as ArtifactRepresentationsSchema, c as ArtifactObservationSchema, ct as ArtifactUniquenessRule, d as ArtifactQueryScope, dt as ArtifactRef, et as ArtifactLifecycleStateSchema, f as ArtifactQueryScopeSchema, ft as ArtifactRefSchema, g as ArtifactRelationSchema, h as ArtifactRelationQueryTargetSchema, i as ArtifactCompareRequestSchema, it as ArtifactRelationRequirementCondition, j as ConfidenceMetadataSchema, k as ConfidenceLevelSchema, l as ArtifactQueryRequest, lt as ArtifactUniquenessRuleSchema, m as ArtifactRelationQueryTarget, n as ArtifactActorSchema, nt as ArtifactPartAreaSchema, o as ArtifactCompareResponseSchema, ot as ArtifactRelationRequirementSchema, p as ArtifactRelation, q as ArtifactEvidenceRequirements, r as ArtifactCompareRequest, rt as ArtifactRelationRequirement, s as ArtifactObservation, st as ArtifactSchemaVersionSchema, t as ArtifactActor, tt as ArtifactPartArea, u as ArtifactQueryRequestSchema, ut as ArtifactUniquenessSelectorSchema, v as ArtifactRelationTargetSchema, w as ArtifactScopeSchema, x as ArtifactRevision, y as ArtifactRepresentations, z as RelationEndpointSchema } from "../../schemas-CY2niCMn.mjs";
|
|
2
|
+
import { $ as ArtifactLifecycleInitializedEntrySchema, $n as ArtifactContextRefEntrySchema, $r as slugify, $t as ArtifactRelationSourceIssue, A as ArtifactLifecycleFailureSchema, An as ArtifactRelationTypeRegisterRequest, Ar as ArtifactDraftPatch, At as ArtifactPatchMigration, B as ArtifactLifecycleRejectedPayloadSchema, Bn as ArtifactStatusChangedPayload, Br as EvidenceOccurrenceExtractionOptions, Bt as ArtifactPatchResponseSchema, C as ArtifactRelationTargetIdentitySchema, Cn as ArtifactObservationAddedPayload, Cr as ArtifactDataOf, Ct as ArtifactPatchError, D as ArtifactLifecycleCommittedPayload, Dn as ArtifactRelationAddedPayload, Dr as AfterArtifactHookContext, Dt as ArtifactPatchInstruction, E as serializeArtifactRelationTargetIdentity, En as ArtifactQueryResponse, Er as defineArtifactKind, Et as ArtifactPatchFailureSchema, F as ArtifactLifecycleHistoryRequest, Fn as ArtifactResolveResponse, Fr as ArtifactLifecycleSemanticEvent, Ft as ArtifactPatchPathSchema, G as ARTIFACT_LIFECYCLE_REJECTED_CODE, Gn as ArtifactResolvePartResponseSchema, Gr as EvidenceResolveResponseSchema, Gt as ArtifactPatchTargetSchema, H as ArtifactLifecycleTransitionResponse, Hn as ArtifactResolvePartRequest, Hr as EvidenceResolveRequest, Ht as ArtifactPatchSuccess, I as ArtifactLifecycleHistoryRequestSchema, In as ArtifactReviseRequest, Ir as BeforeArtifactHookContext, It as ArtifactPatchPersistedSchema, J as ArtifactLifecycleError, Jn as ArtifactContextRootNode, Jr as ARTIFACT_SLUG_FIELD, Jt as artifactPatchPathFilterNames, K as ArtifactLifecycleCurrent, Kn as hydrateArtifactContextTree, Kr as mayArtifactDataCarryProperty, Kt as artifactPatchFilterName, L as ArtifactLifecycleHistoryResponse, Ln as ArtifactReviseResponse, Lr as BeforeArtifactHookRegistration, Lt as ArtifactPatchRequest, M as ArtifactLifecycleGetRequestSchema, Mn as ArtifactResolveContextRequest, Mr as ArtifactLifecycleHookDefinition, Mt as ArtifactPatchOperationResult, N as ArtifactLifecycleGetResponse, Nn as ArtifactResolveContextResponse, Nr as ArtifactLifecycleHookEvent, Nt as ArtifactPatchOperationResultSchema, O as ArtifactLifecycleCommittedPayloadSchema, On as ArtifactRelationTypeListRequest, Or as AfterArtifactHookRegistration, Ot as ArtifactPatchIssue, P as ArtifactLifecycleGetResponseSchema, Pn as ArtifactResolveRequest, Pr as ArtifactLifecycleHookRegistration, Pt as ArtifactPatchOperator, Q as ArtifactLifecycleInitializedEntry, Qn as ArtifactContextRefEntry, Qr as deriveArtifactSlug, Qt as ArtifactPartResolution, R as ArtifactLifecycleHistoryResponseSchema, Rn as ArtifactRevisedPayload, Rr as defineArtifactLifecycleHooks, Rt as ArtifactPatchRequestSchema, S as ArtifactRelationTargetIdentity, Sn as ArtifactNamespace, Sr as AnyArtifactKindDefinition, St as ArtifactPatchDryRunSchema, T as describeArtifactRelationTargetIdentity, Tn as ArtifactPatchSubjectResponse, Tr as ArtifactOf, Tt as ArtifactPatchErrorSchema, U as ArtifactLifecycleTransitionResponseSchema, Un as ArtifactResolvePartRequestSchema, Ur as EvidenceResolveRequestSchema, Ut as ArtifactPatchSuccessSchema, V as ArtifactLifecycleSchemas, Vn as ArtifactSubjects, Vr as extractEvidenceOccurrences, Vt as ArtifactPatchSegment, W as toArtifactLifecycleFailure, Wn as ArtifactResolvePartResponse, Wr as EvidenceResolveResponse, Wt as ArtifactPatchTarget, X as ArtifactLifecycleHistoryEntrySchema, Xn as ResolvedArtifactContextNode, Xr as ArtifactSlug, Xt as artifactPatchSegments, Y as ArtifactLifecycleHistoryEntry, Yn as ArtifactContextTree, Yr as ARTIFACT_SLUG_PATTERN, Yt as artifactPatchSegment, Z as ArtifactLifecycleIdentitySchema, Zn as UnresolvedArtifactContextNode, Zr as ArtifactSlugSchema, Zt as ARTIFACT_RESOLVE_PART_ERROR_CODES, _ as UniquenessSelectorCapability, _n as ArtifactKindChangedPayload, _r as ArtifactDataChecker, _t as ARTIFACT_PATCH_OPERATORS, a as normalizeRelationTypeRegistration, an as resolveArtifactPart, ar as ARTIFACT_CONTEXT_RELATION_DIRECTIONS, at as ArtifactLifecycleSnapshotSchema, b as buildUniquenessKeys, bn as ArtifactKindRegisterRequest, br as compileArtifactDataChecker, bt as ArtifactPatchDocument, c as RelationRequirementIssueReason, cn as ArtifactSchemaFragment, cr as ArtifactContextRelationDirection, ct as ArtifactLifecycleTransitionIntent, d as UniquenessDataKeyPart, dn as readArtifactTitle, dr as ArtifactContextRelationSelectorSchema, dt as ArtifactLifecycleTransitionedEntrySchema, ei as ARTIFACT_VALUE_TYPE_KEYWORD, en as ArtifactResolvePartError, er as ArtifactContextUnresolvedReason, et as ArtifactLifecycleRejection, f as UniquenessKey, fn as ArtifactCreateRequest, fr as ArtifactContextRenderHint, ft as ArtifactLifecycleVersionSchema, g as UniquenessRelationTargetKeyPart, gn as ArtifactEvidenceResolveResponse, gr as ArtifactDataCheck, gt as ARTIFACT_PATCH_ERROR_CODES, h as UniquenessKeyPart, hn as ArtifactEvidenceResolveRequest, hr as ArtifactContextSelectorSchema, ht as isArtifactLifecycleTransitionAllowed, i as mergeRelationTypeRegistrations, in as checkArtifactRelationSourceParts, ir as artifactRevisionKey, it as ArtifactLifecycleSnapshot, j as ArtifactLifecycleGetRequest, jn as ArtifactRelationTypeRegisterResponse, jr as ArtifactHookFilter, jt as ArtifactPatchMigrationSchema, k as ArtifactLifecycleFailure, kn as ArtifactRelationTypeListResponse, kr as ArtifactDraft, kt as ArtifactPatchIssueSchema, l as evaluateRelationRequirements, ln as inspectArtifactDataLocation, lr as ArtifactContextRelationDirectionSchema, lt as ArtifactLifecycleTransitionIntentSchema, m as UniquenessKeyIssueReason, mn as ArtifactCreatedPayload, mr as ArtifactContextSelector, mt as initialArtifactLifecycle, n as RelationEndpointCandidate, ni as EvidenceValue, nn as ArtifactResolvePartErrorSchema, nr as ResolvedArtifactContextWire, nt as ArtifactLifecycleSituation, o as relationTypePermits, on as validateArtifactPartAreas, or as ARTIFACT_CONTEXT_RENDER_HINTS, ot as ArtifactLifecycleTransitionCommand, p as UniquenessKeyIssue, pn as ArtifactCreateResponse, pr as ArtifactContextRenderHintSchema, pt as advanceArtifactLifecycle, q as ArtifactLifecycleCurrentSchema, qn as ArtifactContextNode, qr as ARTIFACT_DERIVED_SLUG_MAX_LENGTH, qt as artifactPatchInstructions, r as RelationTypeConflictError, ri as EvidenceValueSchema, rn as checkArtifactPartIds, rr as ResolvedArtifactContextWireSchema, rt as ArtifactLifecycleSituationSchema, s as RelationRequirementIssue, sn as ARTIFACT_COLLECTION_ELEMENT_SEGMENT, sr as ArtifactContextKnownRenderHint, st as ArtifactLifecycleTransitionCommandSchema, t as NormalizedRelationTypeRegistration, ti as EVIDENCE_VALUE_TYPE, tn as ArtifactResolvePartErrorCode, tr as ArtifactContextUnresolvedReasonSchema, tt as ArtifactLifecycleRejectionSchema, u as BuildUniquenessKeysResult, un as isArtifactDataPathDeclared, ur as ArtifactContextRelationSelector, ut as ArtifactLifecycleTransitionedEntry, v as UniquenessSupportIssue, vn as ArtifactKindListRequest, vr as ArtifactDataIssue, vt as ArtifactPatchArrayFilter, w as artifactRelationTargetIdentity, wn as ArtifactPatchSubjectRequest, wr as ArtifactKindDefinition, wt as ArtifactPatchErrorCode, x as describeUniquenessKey, xn as ArtifactKindRegisterResponse, xr as compileArtifactDataSchema, xt as ArtifactPatchDocumentSchema, y as assessUniquenessSupport, yn as ArtifactKindListResponse, yr as ArtifactDataValidator, yt as ArtifactPatchArrayFilterSchema, z as ArtifactLifecycleRejectedPayload, zn as ArtifactSchemas, zr as EvidenceOccurrence, zt as ArtifactPatchResponse } from "../../index-5NiMVtgh.mjs";
|
|
3
3
|
export { ARTIFACT_CATEGORY_LIFECYCLE_STATES, ARTIFACT_COLLECTION_ELEMENT_SEGMENT, ARTIFACT_CONTEXT_RELATION_DIRECTIONS, ARTIFACT_CONTEXT_RENDER_HINTS, ARTIFACT_DERIVED_SLUG_MAX_LENGTH, ARTIFACT_LIFECYCLE_REJECTED_CODE, ARTIFACT_PATCH_ERROR_CODES, ARTIFACT_PATCH_OPERATORS, ARTIFACT_RESOLVE_PART_ERROR_CODES, ARTIFACT_SLUG_FIELD, ARTIFACT_SLUG_PATTERN, ARTIFACT_VALUE_TYPE_KEYWORD, AfterArtifactHookContext, AfterArtifactHookRegistration, AnyArtifactKindDefinition, ArtifactActor, ArtifactActorSchema, ArtifactCategory, ArtifactCategorySchema, ArtifactCompareRequest, ArtifactCompareRequestSchema, ArtifactCompareResponse, ArtifactCompareResponseSchema, ArtifactContextKnownRenderHint, ArtifactContextNode, ArtifactContextRefEntry, ArtifactContextRefEntrySchema, ArtifactContextRelationDirection, ArtifactContextRelationDirectionSchema, ArtifactContextRelationSelector, ArtifactContextRelationSelectorSchema, ArtifactContextRenderHint, ArtifactContextRenderHintSchema, ArtifactContextRootNode, ArtifactContextSelector, ArtifactContextSelectorSchema, ArtifactContextTree, ArtifactContextUnresolvedReason, ArtifactContextUnresolvedReasonSchema, ArtifactCreateRequest, ArtifactCreateResponse, ArtifactCreatedPayload, ArtifactDataCheck, ArtifactDataChecker, ArtifactDataIssue, ArtifactDataOf, ArtifactDataPathSchema, ArtifactDataValidator, ArtifactDraft, ArtifactDraftPatch, ArtifactEvidenceRequirements, ArtifactEvidenceRequirementsSchema, ArtifactEvidenceResolveRequest, ArtifactEvidenceResolveResponse, ArtifactHookFilter, ArtifactKindChangedPayload, ArtifactKindDefinition, ArtifactKindListRequest, ArtifactKindListResponse, ArtifactKindRegisterRequest, ArtifactKindRegisterResponse, ArtifactKindRegistration, ArtifactKindRegistrationSchema, ArtifactKindView, ArtifactKindViewSchema, ArtifactLifecycleCommittedPayload, ArtifactLifecycleCommittedPayloadSchema, ArtifactLifecycleCurrent, ArtifactLifecycleCurrentSchema, ArtifactLifecycleError, ArtifactLifecycleFailure, ArtifactLifecycleFailureSchema, ArtifactLifecycleGetRequest, ArtifactLifecycleGetRequestSchema, ArtifactLifecycleGetResponse, ArtifactLifecycleGetResponseSchema, ArtifactLifecycleHistoryEntry, ArtifactLifecycleHistoryEntrySchema, ArtifactLifecycleHistoryRequest, ArtifactLifecycleHistoryRequestSchema, ArtifactLifecycleHistoryResponse, ArtifactLifecycleHistoryResponseSchema, ArtifactLifecycleHookDefinition, ArtifactLifecycleHookEvent, ArtifactLifecycleHookRegistration, ArtifactLifecycleIdentitySchema, ArtifactLifecycleInitializedEntry, ArtifactLifecycleInitializedEntrySchema, ArtifactLifecycleRejectedPayload, ArtifactLifecycleRejectedPayloadSchema, ArtifactLifecycleRejection, ArtifactLifecycleRejectionSchema, ArtifactLifecycleSchemas, ArtifactLifecycleSemanticEvent, ArtifactLifecycleSituation, ArtifactLifecycleSituationSchema, ArtifactLifecycleSnapshot, ArtifactLifecycleSnapshotSchema, ArtifactLifecycleState, ArtifactLifecycleStateSchema, ArtifactLifecycleTransitionCommand, ArtifactLifecycleTransitionCommandSchema, ArtifactLifecycleTransitionIntent, ArtifactLifecycleTransitionIntentSchema, ArtifactLifecycleTransitionResponse, ArtifactLifecycleTransitionResponseSchema, ArtifactLifecycleTransitionedEntry, ArtifactLifecycleTransitionedEntrySchema, ArtifactLifecycleVersionSchema, ArtifactNamespace, ArtifactObservation, ArtifactObservationAddedPayload, ArtifactObservationSchema, ArtifactOf, ArtifactPartArea, ArtifactPartAreaSchema, ArtifactPartResolution, ArtifactPatchArrayFilter, ArtifactPatchArrayFilterSchema, ArtifactPatchDocument, ArtifactPatchDocumentSchema, ArtifactPatchDryRunSchema, ArtifactPatchError, ArtifactPatchErrorCode, ArtifactPatchErrorSchema, ArtifactPatchFailureSchema, ArtifactPatchInstruction, ArtifactPatchIssue, ArtifactPatchIssueSchema, ArtifactPatchMigration, ArtifactPatchMigrationSchema, ArtifactPatchOperationResult, ArtifactPatchOperationResultSchema, ArtifactPatchOperator, ArtifactPatchPathSchema, ArtifactPatchPersistedSchema, ArtifactPatchRequest, ArtifactPatchRequestSchema, ArtifactPatchResponse, ArtifactPatchResponseSchema, ArtifactPatchSegment, ArtifactPatchSubjectRequest, ArtifactPatchSubjectResponse, ArtifactPatchSuccess, ArtifactPatchSuccessSchema, ArtifactPatchTarget, ArtifactPatchTargetSchema, ArtifactQueryRequest, ArtifactQueryRequestSchema, ArtifactQueryResponse, ArtifactQueryScope, ArtifactQueryScopeSchema, ArtifactRef, ArtifactRefSchema, ArtifactRelation, ArtifactRelationAddedPayload, ArtifactRelationQueryTarget, ArtifactRelationQueryTargetSchema, ArtifactRelationRequirement, ArtifactRelationRequirementCondition, ArtifactRelationRequirementConditionSchema, ArtifactRelationRequirementSchema, ArtifactRelationSchema, ArtifactRelationSourceIssue, ArtifactRelationTarget, ArtifactRelationTargetIdentity, ArtifactRelationTargetIdentitySchema, ArtifactRelationTargetSchema, ArtifactRelationTypeListRequest, ArtifactRelationTypeListResponse, ArtifactRelationTypeRegisterRequest, ArtifactRelationTypeRegisterResponse, ArtifactRepresentations, ArtifactRepresentationsSchema, ArtifactResolveContextRequest, ArtifactResolveContextResponse, ArtifactResolvePartError, ArtifactResolvePartErrorCode, ArtifactResolvePartErrorSchema, ArtifactResolvePartRequest, ArtifactResolvePartRequestSchema, ArtifactResolvePartResponse, ArtifactResolvePartResponseSchema, ArtifactResolveRequest, ArtifactResolveResponse, ArtifactReviseRequest, ArtifactReviseResponse, ArtifactRevisedPayload, ArtifactRevision, ArtifactRevisionSchema, ArtifactSchemaFragment, ArtifactSchemaVersionSchema, ArtifactSchemas, ArtifactScope, ArtifactScopeSchema, ArtifactSlug, ArtifactSlugSchema, ArtifactStatusChangedPayload, ArtifactStatusPathSchema, ArtifactSubjects, ArtifactUniquenessRule, ArtifactUniquenessRuleSchema, ArtifactUniquenessSelectorSchema, BeforeArtifactHookContext, BeforeArtifactHookRegistration, BuildUniquenessKeysResult, ConfidenceBasis, ConfidenceBasisSchema, ConfidenceLevel, ConfidenceLevelSchema, ConfidenceMetadata, ConfidenceMetadataSchema, EVIDENCE_VALUE_TYPE, EntityRef, EntityRefSchema, EvidenceOccurrence, EvidenceOccurrenceExtractionOptions, EvidenceRef, EvidenceRefSchema, EvidenceResolveRequest, EvidenceResolveRequestSchema, EvidenceResolveResponse, EvidenceResolveResponseSchema, EvidenceValue, EvidenceValueSchema, LocalRef, LocalRefSchema, NormalizedRelationTypeRegistration, RelationEndpoint, RelationEndpointCandidate, RelationEndpointSchema, RelationRequirementIssue, RelationRequirementIssueReason, RelationTargetRefClass, RelationTypeConflictError, RelationTypeRegistration, RelationTypeRegistrationSchema, ResolvedArtifactContextNode, ResolvedArtifactContextWire, ResolvedArtifactContextWireSchema, UniquenessDataKeyPart, UniquenessKey, UniquenessKeyIssue, UniquenessKeyIssueReason, UniquenessKeyPart, UniquenessRelationTargetKeyPart, UniquenessSelectorCapability, UniquenessSupportIssue, UnresolvedArtifactContextNode, advanceArtifactLifecycle, artifactPatchFilterName, artifactPatchInstructions, artifactPatchPathFilterNames, artifactPatchSegment, artifactPatchSegments, artifactRelationTargetIdentity, artifactRevisionKey, assessUniquenessSupport, buildUniquenessKeys, checkArtifactPartIds, checkArtifactRelationSourceParts, compileArtifactDataChecker, compileArtifactDataSchema, defineArtifactKind, defineArtifactLifecycleHooks, deriveArtifactSlug, describeArtifactRelationTargetIdentity, describeUniquenessKey, evaluateRelationRequirements, extractEvidenceOccurrences, hydrateArtifactContextTree, initialArtifactLifecycle, inspectArtifactDataLocation, isArtifactDataPathDeclared, isArtifactLifecycleTransitionAllowed, mayArtifactDataCarryProperty, mergeRelationTypeRegistrations, normalizeRelationTypeRegistration, readArtifactTitle, relationTypePermits, resolveArtifactPart, serializeArtifactRelationTargetIdentity, slugify, toArtifactLifecycleFailure, validateArtifactPartAreas };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"../../schemas-
|
|
1
|
+
import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"../../schemas-DmP_43fe.mjs";import{A as T,D as E,E as D,M as O,O as k,S as A,T as j,_ as M,a as N,b as P,c as F,d as I,f as L,g as R,h as z,i as B,j as V,l as H,m as U,n as W,o as G,p as K,r as q,s as J,t as Y,u as X,v as Z,w as Q,x as $,y as ee}from"../../kind-registration-CdjmVxY_.mjs";import{$ as te,A as ne,B as re,C as ie,Ct as ae,D as oe,Dt as se,E as ce,Et as le,F as ue,G as de,H as fe,I as pe,J as me,K as he,L as ge,M as _e,N as ve,O as ye,Ot as be,P as xe,Q as Se,R as Ce,S as we,St as Te,T as Ee,Tt as De,U as Oe,V as ke,W as Ae,X as je,Y as Me,Z as Ne,_ as Pe,_t as Fe,a as Ie,at as Le,b as Re,bt as ze,c as Be,ct as Ve,d as He,dt as Ue,et as We,f as Ge,ft as Ke,g as qe,gt as Je,h as Ye,ht as Xe,i as Ze,it as Qe,j as $e,k as et,l as tt,lt as nt,m as rt,mt as it,n as at,nt as ot,o as st,ot as ct,p as lt,pt as ut,q as dt,r as ft,rt as pt,s as mt,st as ht,t as gt,tt as _t,u as vt,ut as yt,v as bt,vt as xt,w as St,wt as Ct,x as wt,xt as Tt,y as Et,yt as Dt,z as Ot}from"../../artifact-D3VD0bDr.mjs";export{Y as ARTIFACT_CATEGORY_LIFECYCLE_STATES,k as ARTIFACT_COLLECTION_ELEMENT_SEGMENT,Je as ARTIFACT_CONTEXT_RELATION_DIRECTIONS,Fe as ARTIFACT_CONTEXT_RENDER_HINTS,P as ARTIFACT_DERIVED_SLUG_MAX_LENGTH,ce as ARTIFACT_LIFECYCLE_REJECTED_CODE,Ae as ARTIFACT_PATCH_ERROR_CODES,de as ARTIFACT_PATCH_OPERATORS,U as ARTIFACT_RESOLVE_PART_ERROR_CODES,$ as ARTIFACT_SLUG_FIELD,A as ARTIFACT_SLUG_PATTERN,t as ARTIFACT_VALUE_TYPE_KEYWORD,y as ArtifactActorSchema,W as ArtifactCategorySchema,m as ArtifactCompareRequestSchema,_ as ArtifactCompareResponseSchema,Ke as ArtifactContextRefEntrySchema,xt as ArtifactContextRelationDirectionSchema,Dt as ArtifactContextRelationSelectorSchema,ze as ArtifactContextRenderHintSchema,Tt as ArtifactContextSelectorSchema,ut as ArtifactContextUnresolvedReasonSchema,q as ArtifactDataPathSchema,B as ArtifactEvidenceRequirementsSchema,N as ArtifactKindRegistrationSchema,G as ArtifactKindViewSchema,qe as ArtifactLifecycleCommittedPayloadSchema,oe as ArtifactLifecycleCurrentSchema,ye as ArtifactLifecycleError,Pe as ArtifactLifecycleFailureSchema,bt as ArtifactLifecycleGetRequestSchema,Et as ArtifactLifecycleGetResponseSchema,et as ArtifactLifecycleHistoryEntrySchema,Re as ArtifactLifecycleHistoryRequestSchema,wt as ArtifactLifecycleHistoryResponseSchema,ne as ArtifactLifecycleIdentitySchema,$e as ArtifactLifecycleInitializedEntrySchema,we as ArtifactLifecycleRejectedPayloadSchema,_e as ArtifactLifecycleRejectionSchema,ie as ArtifactLifecycleSchemas,ve as ArtifactLifecycleSituationSchema,xe as ArtifactLifecycleSnapshotSchema,J as ArtifactLifecycleStateSchema,ue as ArtifactLifecycleTransitionCommandSchema,pe as ArtifactLifecycleTransitionIntentSchema,St as ArtifactLifecycleTransitionResponseSchema,ge as ArtifactLifecycleTransitionedEntrySchema,Ce as ArtifactLifecycleVersionSchema,lt as ArtifactNamespace,d as ArtifactObservationSchema,F as ArtifactPartAreaSchema,he as ArtifactPatchArrayFilterSchema,dt as ArtifactPatchDocumentSchema,me as ArtifactPatchDryRunSchema,Me as ArtifactPatchErrorSchema,je as ArtifactPatchFailureSchema,Ne as ArtifactPatchIssueSchema,Se as ArtifactPatchMigrationSchema,te as ArtifactPatchOperationResultSchema,We as ArtifactPatchPathSchema,_t as ArtifactPatchPersistedSchema,ot as ArtifactPatchRequestSchema,pt as ArtifactPatchResponseSchema,Qe as ArtifactPatchSuccessSchema,Le as ArtifactPatchTargetSchema,i as ArtifactQueryRequestSchema,h as ArtifactQueryScopeSchema,n as ArtifactRefSchema,v as ArtifactRelationQueryTargetSchema,H as ArtifactRelationRequirementConditionSchema,X as ArtifactRelationRequirementSchema,o as ArtifactRelationSchema,tt as ArtifactRelationTargetIdentitySchema,f as ArtifactRelationTargetSchema,b as ArtifactRepresentationsSchema,z as ArtifactResolvePartErrorSchema,fe as ArtifactResolvePartRequestSchema,Oe as ArtifactResolvePartResponseSchema,s as ArtifactRevisionSchema,I as ArtifactSchemaVersionSchema,rt as ArtifactSchemas,c as ArtifactScopeSchema,Q as ArtifactSlugSchema,g as ArtifactStatusPathSchema,Ye as ArtifactSubjects,L as ArtifactUniquenessRuleSchema,K as ArtifactUniquenessSelectorSchema,p as ConfidenceBasisSchema,u as ConfidenceLevelSchema,l as ConfidenceMetadataSchema,e as EVIDENCE_VALUE_TYPE,r as EntityRefSchema,x as EvidenceRefSchema,se as EvidenceResolveRequestSchema,be as EvidenceResolveResponseSchema,S as EvidenceValueSchema,w as LocalRefSchema,a as RelationEndpointSchema,gt as RelationTypeConflictError,C as RelationTypeRegistrationSchema,it as ResolvedArtifactContextWireSchema,Ot as advanceArtifactLifecycle,ct as artifactPatchFilterName,ht as artifactPatchInstructions,Ve as artifactPatchPathFilterNames,nt as artifactPatchSegment,yt as artifactPatchSegments,vt as artifactRelationTargetIdentity,Xe as artifactRevisionKey,st as assessUniquenessSupport,mt as buildUniquenessKeys,R as checkArtifactPartIds,M as checkArtifactRelationSourceParts,ae as compileArtifactDataChecker,Ct as compileArtifactDataSchema,De as defineArtifactKind,Te as defineArtifactLifecycleHooks,j as deriveArtifactSlug,He as describeArtifactRelationTargetIdentity,Be as describeUniquenessKey,Ie as evaluateRelationRequirements,le as extractEvidenceOccurrences,Ue as hydrateArtifactContextTree,re as initialArtifactLifecycle,T as inspectArtifactDataLocation,V as isArtifactDataPathDeclared,ke as isArtifactLifecycleTransitionAllowed,E as mayArtifactDataCarryProperty,at as mergeRelationTypeRegistrations,ft as normalizeRelationTypeRegistration,O as readArtifactTitle,Ze as relationTypePermits,Z as resolveArtifactPart,Ge as serializeArtifactRelationTargetIdentity,D as slugify,Ee as toArtifactLifecycleFailure,ee as validateArtifactPartAreas};
|