agent-comms 8.10.2 → 8.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/bridges/user/web/dist/mesh-worker.js +1 -1
- package/dist/bridges/user/web/dist/sw.js +1 -1
- package/dist/core/account-join.d.ts +5 -0
- package/dist/core/account-join.d.ts.map +1 -1
- package/dist/core/account-join.js +3 -3
- package/dist/core/account-join.js.map +1 -1
- package/dist/core/agent-details.d.ts +67 -0
- package/dist/core/agent-details.d.ts.map +1 -0
- package/dist/core/agent-details.js +163 -0
- package/dist/core/agent-details.js.map +1 -0
- package/dist/core/agent-list-format.d.ts +22 -0
- package/dist/core/agent-list-format.d.ts.map +1 -0
- package/dist/core/agent-list-format.js +54 -0
- package/dist/core/agent-list-format.js.map +1 -0
- package/dist/core/first-contact.d.ts +7 -0
- package/dist/core/first-contact.d.ts.map +1 -1
- package/dist/core/first-contact.js +14 -0
- package/dist/core/first-contact.js.map +1 -1
- package/dist/core/lan-web-actions.d.ts +8 -0
- package/dist/core/lan-web-actions.d.ts.map +1 -0
- package/dist/core/lan-web-actions.js +23 -0
- package/dist/core/lan-web-actions.js.map +1 -0
- package/dist/core/lan-web-uis.d.ts +27 -0
- package/dist/core/lan-web-uis.d.ts.map +1 -0
- package/dist/core/lan-web-uis.js +40 -0
- package/dist/core/lan-web-uis.js.map +1 -0
- package/dist/core/mesh-store.d.ts +14 -10
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +24 -25
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/peer-lifecycle.d.ts +6 -0
- package/dist/core/peer-lifecycle.d.ts.map +1 -1
- package/dist/core/peer-lifecycle.js +1 -0
- package/dist/core/peer-lifecycle.js.map +1 -1
- package/dist/core/tool.d.ts +8 -0
- package/dist/core/tool.d.ts.map +1 -1
- package/dist/core/tool.js +10 -42
- package/dist/core/tool.js.map +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +1 -1
- package/dist/core/web-beacon.d.ts +14 -0
- package/dist/core/web-beacon.d.ts.map +1 -0
- package/dist/core/web-beacon.js +22 -0
- package/dist/core/web-beacon.js.map +1 -0
- package/dist/test/agent-details-refresh.unit.test.d.ts +5 -0
- package/dist/test/agent-details-refresh.unit.test.d.ts.map +1 -0
- package/dist/test/agent-details-refresh.unit.test.js +108 -0
- package/dist/test/agent-details-refresh.unit.test.js.map +1 -0
- package/dist/test/agent-details.unit.test.d.ts +5 -0
- package/dist/test/agent-details.unit.test.d.ts.map +1 -0
- package/dist/test/agent-details.unit.test.js +86 -0
- package/dist/test/agent-details.unit.test.js.map +1 -0
- package/dist/test/first-contact.unit.test.js +39 -0
- package/dist/test/first-contact.unit.test.js.map +1 -1
- package/dist/test/lan-web-uis.unit.test.d.ts +5 -0
- package/dist/test/lan-web-uis.unit.test.d.ts.map +1 -0
- package/dist/test/lan-web-uis.unit.test.js +72 -0
- package/dist/test/lan-web-uis.unit.test.js.map +1 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ExaDev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/ExaDev/agent-comms)
|
|
4
4
|
[](https://www.npmjs.com/package/agent-comms)
|
|
5
|
-
[](https://github.com/ExaDev/agent-comms/releases/tag/v8.12.0)
|
|
6
6
|
[](https://github.com/ExaDev/agent-comms/actions)
|
|
7
7
|
|
|
8
8
|
Cross-harness communication mesh for LLM agents: rooms, DMs, presence, and visibility over TCP with zero filesystem dependencies.
|
|
@@ -321,6 +321,8 @@ Plain `http` also means the token, and everything the dashboard shows or sends,
|
|
|
321
321
|
|
|
322
322
|
Plain `http` and `ws` are what the LAN path uses, so a page served over `https` (the hosted mesh.exadev.io instance) cannot dial it; open the bridge's own address instead. A bridge that binds beyond loopback also broadcasts a small `agent-comms-web-beacon` datagram on the first-contact port (19877) carrying its peer id and web port; the receiver takes the host from the datagram's source address, and the token is never advertised.
|
|
323
323
|
|
|
324
|
+
The other bridges on the network hear those beacons. `lan_web_uis` lists every neighbouring web UI heard this way, each as a ready-to-open `http://<address>:<port>` URL beside the full peer id and its names. An entry drops out again once its bridge has missed a few beacon intervals, so a dashboard that has gone away leaves the list rather than lingering.
|
|
325
|
+
|
|
324
326
|
## Alternate UI: wire-mesh's web-console
|
|
325
327
|
|
|
326
328
|
An agent-comms node is, underneath, already a [wire-mesh](https://github.com/ExaDev/wire-mesh) node, so it can optionally also serve wire-mesh's own generic, protocol-level `web-console` alongside its own richer dashboard — useful for anyone who wants the reference-client view of their mesh rather than agent-comms' own product UI.
|
|
@@ -459,7 +461,7 @@ The store holding its machine's elected coordinator role serves the relay role w
|
|
|
459
461
|
|
|
460
462
|
The relay takes the connection of its own hub session as its uplink and fronts its clients over it, so a store behind its machine's relay stays reachable by devices that reach it only through the configured hub, and can reach them, each end seen under its own device-id rather than the relay's. An advert for one of the relay's own clients that comes back round through the hub never displaces the client's registration, and a device that has only just moved onto the relay is routable once its first advert has been accepted, which can take until its next gossip.
|
|
461
463
|
|
|
462
|
-
A device known only through the hub, not directly connected to this mesh, is reported at whatever presence its last gossiped advert carried. Nothing tells the rest of the mesh when such a device disconnects, so `list_agents` stops trusting a stale advert and reports the device offline once it has gone unrefreshed for a few re-advertise intervals, rather than showing it active indefinitely.
|
|
464
|
+
A device known only through the hub, not directly connected to this mesh, is reported at whatever presence its last gossiped advert carried. Its working directory, rooms and tags list as not shared, since the hub session carries only the summary; a bridge this machine has chosen to trust is asked for them directly, over the end-to-end session the two already have, and `list_agents` shows what came back from the next listing on. The ask is refused unless the answering bridge also trusts the asker, so the details never travel to a device the operator has not pinned. Nothing tells the rest of the mesh when such a device disconnects, so `list_agents` stops trusting a stale advert and reports the device offline once it has gone unrefreshed for a few re-advertise intervals, rather than showing it active indefinitely.
|
|
463
465
|
|
|
464
466
|
Two devices on different machines can only relay traffic through each other's hub once each side explicitly trusts the other's device-id — a deny-by-default, pin-the-key model with no directory lookup, deliberately mirroring how an ordinary peer connection is already pinned.
|
|
465
467
|
|
|
@@ -61,4 +61,4 @@ var AgentCommsMeshWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag
|
|
|
61
61
|
|
|
62
62
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=fr,s=!er.jitless,c=s&&pr.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ka([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Ma(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Dr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>P(e,r,k())))}),t)}var Na=O(`$ZodUnion`,(e,t)=>{I.init(e,t),A(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),A(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),A(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),A(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ar(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ma(t,r,e,i)):Ma(o,r,e,i)}}),Pa=O(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Na.init(e,t);let n=e._zod.parse;A(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=rr(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!fr(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Fa=O(`$ZodIntersection`,(e,t)=>{I.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>La(e,t,n)):La(e,i,a)}});function Ia(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(mr(e)&&mr(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ia(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ia(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function La(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Dr(e))return e;let o=Ia(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ra=O(`$ZodRecord`,(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!mr(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>P(e,r,k())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...kr(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...kr(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ti.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>P(e,r,k())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...kr(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...kr(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),za=O(`$ZodEnum`,(e,t)=>{I.init(e,t);let n=tr(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>gr.has(typeof e)).map(e=>typeof e==`string`?_r(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ba=O(`$ZodLiteral`,(e,t)=>{if(I.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?_r(e):e?_r(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Va=O(`$ZodTransform`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $n(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Qn;return n.value=i,n.fallback=!0,n}});function Ha(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ua=O(`$ZodOptional`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),A(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ar(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ha(e,r)):Ha(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Wa=O(`$ZodExactOptional`,(e,t)=>{Ua.init(e,t),A(e._zod,`values`,()=>t.innerType._zod.values),A(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ga=O(`$ZodNullable`,(e,t)=>{I.init(e,t),A(e._zod,`optin`,()=>t.innerType._zod.optin),A(e._zod,`optout`,()=>t.innerType._zod.optout),A(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ar(e.source)}|null)$`):void 0}),A(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ka=O(`$ZodDefault`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>qa(e,t)):qa(r,t)}});function qa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ja=O(`$ZodPrefault`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ya=O(`$ZodNonOptional`,(e,t)=>{I.init(e,t),A(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Xa(t,e)):Xa(i,e)}});function Xa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Za=O(`$ZodCatch`,(e,t)=>{I.init(e,t),e._zod.optin=`optional`,A(e._zod,`optout`,()=>t.innerType._zod.optout),A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,k()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>P(e,n,k()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Qa=O(`$ZodPipe`,(e,t)=>{I.init(e,t),A(e._zod,`values`,()=>t.in._zod.values),A(e._zod,`optin`,()=>t.in._zod.optin),A(e._zod,`optout`,()=>t.out._zod.optout),A(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>$a(e,t.in,n)):$a(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$a(e,t.out,n)):$a(r,t.out,n)}});function $a(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var eo=O(`$ZodReadonly`,(e,t)=>{I.init(e,t),A(e._zod,`propValues`,()=>t.innerType._zod.propValues),A(e._zod,`values`,()=>t.innerType._zod.values),A(e._zod,`optin`,()=>t.innerType?._zod?.optin),A(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(to):to(r)}});function to(e){return e.value=Object.freeze(e.value),e}var no=O(`$ZodCustom`,(e,t)=>{F.init(e,t),I.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ro(t,n,r,e));ro(i,n,r,e)}});function ro(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Mr(e))}}var io,ao=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function oo(){return new ao}(io=globalThis).__zod_globalRegistry??(io.__zod_globalRegistry=oo());var so=globalThis.__zod_globalRegistry;function co(e,t){return new e({type:`string`,...N(t)})}function lo(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function uo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function fo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function po(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function mo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function ho(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function go(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function _o(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function vo(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function yo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function bo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function xo(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function So(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function Co(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function wo(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function To(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function Eo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function Do(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function Oo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function ko(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function Ao(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function jo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function Mo(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function No(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function Po(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function Fo(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function Io(e,t){return new e({type:`number`,checks:[],...N(t)})}function Lo(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N(t)})}function Ro(e,t){return new e({type:`boolean`,...N(t)})}function zo(e){return new e({type:`unknown`})}function Bo(e,t){return new e({type:`never`,...N(t)})}function Vo(e,t){return new Ai({check:`less_than`,...N(t),value:e,inclusive:!1})}function Ho(e,t){return new Ai({check:`less_than`,...N(t),value:e,inclusive:!0})}function Uo(e,t){return new ji({check:`greater_than`,...N(t),value:e,inclusive:!1})}function Wo(e,t){return new ji({check:`greater_than`,...N(t),value:e,inclusive:!0})}function Go(e,t){return new Mi({check:`multiple_of`,...N(t),value:e})}function Ko(e,t){return new Pi({check:`max_length`,...N(t),maximum:e})}function qo(e,t){return new Fi({check:`min_length`,...N(t),minimum:e})}function Jo(e,t){return new Ii({check:`length_equals`,...N(t),length:e})}function Yo(e,t){return new Ri({check:`string_format`,format:`regex`,...N(t),pattern:e})}function Xo(e){return new zi({check:`string_format`,format:`lowercase`,...N(e)})}function Zo(e){return new Bi({check:`string_format`,format:`uppercase`,...N(e)})}function Qo(e,t){return new Vi({check:`string_format`,format:`includes`,...N(t),includes:e})}function $o(e,t){return new Hi({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function es(e,t){return new Ui({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function ts(e){return new Wi({check:`overwrite`,tx:e})}function ns(e){return ts(t=>t.normalize(e))}function rs(){return ts(e=>e.trim())}function is(){return ts(e=>e.toLowerCase())}function as(){return ts(e=>e.toUpperCase())}function os(){return ts(e=>ur(e))}function ss(e,t,n){return new e({type:`array`,element:t,...N(n)})}function cs(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function ls(e,t){let n=us(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Mr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Mr(r))}},e(t.value,t)),t);return n}function us(e,t){let n=new F({check:`custom`,...N(t)});return n._zod.check=e,n}function ds(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??so,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function R(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,R(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&z(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ps(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:hs(t,`input`,e.processors),output:hs(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function z(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return z(r.element,n);if(r.type===`set`)return z(r.valueType,n);if(r.type===`lazy`)return z(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return z(r.innerType,n);if(r.type===`intersection`)return z(r.left,n)||z(r.right,n);if(r.type===`record`||r.type===`map`)return z(r.keyType,n)||z(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:z(r.in,n)||z(r.out,n);if(r.type===`object`){for(let e in r.shape)if(z(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(z(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(z(e,n))return!0;return!!(r.rest&&z(r.rest,n))}return!1}var ms=(e,t={})=>n=>{let r=ds({...n,processors:t});return R(e,r),fs(r,e),ps(r,e)},hs=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ds({...i??{},target:a,io:t,processors:n});return R(e,o),fs(o,e),ps(o,e)},gs={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_s=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=gs[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},vs=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ys=(e,t,n,r)=>{n.type=`boolean`},bs=(e,t,n,r)=>{n.not={}},xs=(e,t,n,r)=>{let i=e._zod.def,a=tr(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ss=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Cs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ws=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ts=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=R(a.element,t,{...r,path:[...r.path,`items`]})},Es=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=R(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=R(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ds=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>R(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Os=(e,t,n,r)=>{let i=e._zod.def,a=R(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=R(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ks=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=R(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=R(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=R(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},As=(e,t,n,r)=>{let i=e._zod.def,a=R(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},js=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ms=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ns=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ps=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Fs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;R(o,t,r);let s=t.seen.get(e);s.ref=o},Is=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ls=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rs=O(`ZodISODateTime`,(e,t)=>{aa.init(e,t),U.init(e,t)});function zs(e){return Mo(Rs,e)}var Bs=O(`ZodISODate`,(e,t)=>{oa.init(e,t),U.init(e,t)});function Vs(e){return No(Bs,e)}var Hs=O(`ZodISOTime`,(e,t)=>{sa.init(e,t),U.init(e,t)});function Us(e){return Po(Hs,e)}var Ws=O(`ZodISODuration`,(e,t)=>{ca.init(e,t),U.init(e,t)});function Gs(e){return Fo(Ws,e)}var B=O(`ZodError`,(e,t)=>{Pr.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Lr(e,t)},flatten:{value:t=>Ir(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,nr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,nr,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ks=Rr(B),qs=zr(B),Js=Br(B),Ys=Hr(B),Xs=Wr(B),Zs=Gr(B),Qs=Kr(B),$s=qr(B),ec=Jr(B),tc=Yr(B),nc=Xr(B),rc=Zr(B),ic=new WeakMap;function ac(e,t,n){let r=Object.getPrototypeOf(e),i=ic.get(r);if(i||(i=new Set,ic.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var V=O(`ZodType`,(e,t)=>(I.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:hs(e,`input`),output:hs(e,`output`)}}),e.toJSONSchema=ms(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ks(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Js(e,t,n),e.parseAsync=async(t,n)=>qs(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ys(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Xs(e,t,n),e.decode=(t,n)=>Zs(e,t,n),e.encodeAsync=async(t,n)=>Qs(e,t,n),e.decodeAsync=async(t,n)=>$s(e,t,n),e.safeEncode=(t,n)=>ec(e,t,n),e.safeDecode=(t,n)=>tc(e,t,n),e.safeEncodeAsync=async(t,n)=>nc(e,t,n),e.safeDecodeAsync=async(t,n)=>rc(e,t,n),ac(e,`ZodType`,{check(...e){let t=this.def;return this.clone(j(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return M(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ml(e,t))},superRefine(e,t){return this.check(hl(e,t))},overwrite(e){return this.check(ts(e))},optional(){return Xc(this)},exactOptional(){return Qc(this)},nullable(){return el(this)},nullish(){return Xc(el(this))},nonoptional(e){return ol(this,e)},array(){return G(this)},or(e){return q([this,e])},and(e){return Hc(this,e)},transform(e){return ul(this,Jc(e))},default(e){return nl(this,e)},prefault(e){return il(this,e)},catch(e){return cl(this,e)},pipe(e){return ul(this,e)},readonly(){return fl(this)},describe(e){let t=this.clone();return so.add(t,{description:e}),t},meta(...e){if(e.length===0)return so.get(this);let t=this.clone();return so.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return so.get(e)?.description},configurable:!0}),e)),oc=O(`_ZodString`,(e,t)=>{qi.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ac(e,`_ZodString`,{regex(...e){return this.check(Yo(...e))},includes(...e){return this.check(Qo(...e))},startsWith(...e){return this.check($o(...e))},endsWith(...e){return this.check(es(...e))},min(...e){return this.check(qo(...e))},max(...e){return this.check(Ko(...e))},length(...e){return this.check(Jo(...e))},nonempty(...e){return this.check(qo(1,...e))},lowercase(e){return this.check(Xo(e))},uppercase(e){return this.check(Zo(e))},trim(){return this.check(rs())},normalize(...e){return this.check(ns(...e))},toLowerCase(){return this.check(is())},toUpperCase(){return this.check(as())},slugify(){return this.check(os())}})}),sc=O(`ZodString`,(e,t)=>{qi.init(e,t),oc.init(e,t),e.email=t=>e.check(lo(cc,t)),e.url=t=>e.check(go(dc,t)),e.jwt=t=>e.check(jo(Ec,t)),e.emoji=t=>e.check(_o(fc,t)),e.guid=t=>e.check(uo(lc,t)),e.uuid=t=>e.check(fo(uc,t)),e.uuidv4=t=>e.check(po(uc,t)),e.uuidv6=t=>e.check(mo(uc,t)),e.uuidv7=t=>e.check(ho(uc,t)),e.nanoid=t=>e.check(vo(pc,t)),e.guid=t=>e.check(uo(lc,t)),e.cuid=t=>e.check(yo(mc,t)),e.cuid2=t=>e.check(bo(hc,t)),e.ulid=t=>e.check(xo(gc,t)),e.base64=t=>e.check(Oo(Cc,t)),e.base64url=t=>e.check(ko(wc,t)),e.xid=t=>e.check(So(_c,t)),e.ksuid=t=>e.check(Co(vc,t)),e.ipv4=t=>e.check(wo(yc,t)),e.ipv6=t=>e.check(To(bc,t)),e.cidrv4=t=>e.check(Eo(xc,t)),e.cidrv6=t=>e.check(Do(Sc,t)),e.e164=t=>e.check(Ao(Tc,t)),e.datetime=t=>e.check(zs(t)),e.date=t=>e.check(Vs(t)),e.time=t=>e.check(Us(t)),e.duration=t=>e.check(Gs(t))});function H(e){return co(sc,e)}var U=O(`ZodStringFormat`,(e,t)=>{L.init(e,t),oc.init(e,t)}),cc=O(`ZodEmail`,(e,t)=>{Xi.init(e,t),U.init(e,t)}),lc=O(`ZodGUID`,(e,t)=>{Ji.init(e,t),U.init(e,t)}),uc=O(`ZodUUID`,(e,t)=>{Yi.init(e,t),U.init(e,t)}),dc=O(`ZodURL`,(e,t)=>{Zi.init(e,t),U.init(e,t)}),fc=O(`ZodEmoji`,(e,t)=>{Qi.init(e,t),U.init(e,t)}),pc=O(`ZodNanoID`,(e,t)=>{$i.init(e,t),U.init(e,t)}),mc=O(`ZodCUID`,(e,t)=>{ea.init(e,t),U.init(e,t)}),hc=O(`ZodCUID2`,(e,t)=>{ta.init(e,t),U.init(e,t)}),gc=O(`ZodULID`,(e,t)=>{na.init(e,t),U.init(e,t)}),_c=O(`ZodXID`,(e,t)=>{ra.init(e,t),U.init(e,t)}),vc=O(`ZodKSUID`,(e,t)=>{ia.init(e,t),U.init(e,t)}),yc=O(`ZodIPv4`,(e,t)=>{la.init(e,t),U.init(e,t)}),bc=O(`ZodIPv6`,(e,t)=>{ua.init(e,t),U.init(e,t)}),xc=O(`ZodCIDRv4`,(e,t)=>{da.init(e,t),U.init(e,t)}),Sc=O(`ZodCIDRv6`,(e,t)=>{fa.init(e,t),U.init(e,t)}),Cc=O(`ZodBase64`,(e,t)=>{ma.init(e,t),U.init(e,t)}),wc=O(`ZodBase64URL`,(e,t)=>{ga.init(e,t),U.init(e,t)}),Tc=O(`ZodE164`,(e,t)=>{_a.init(e,t),U.init(e,t)}),Ec=O(`ZodJWT`,(e,t)=>{ya.init(e,t),U.init(e,t)}),Dc=O(`ZodNumber`,(e,t)=>{ba.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r),ac(e,`ZodNumber`,{gt(e,t){return this.check(Uo(e,t))},gte(e,t){return this.check(Wo(e,t))},min(e,t){return this.check(Wo(e,t))},lt(e,t){return this.check(Vo(e,t))},lte(e,t){return this.check(Ho(e,t))},max(e,t){return this.check(Ho(e,t))},int(e){return this.check(kc(e))},safe(e){return this.check(kc(e))},positive(e){return this.check(Uo(0,e))},nonnegative(e){return this.check(Wo(0,e))},negative(e){return this.check(Vo(0,e))},nonpositive(e){return this.check(Ho(0,e))},multipleOf(e,t){return this.check(Go(e,t))},step(e,t){return this.check(Go(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return Io(Dc,e)}var Oc=O(`ZodNumberFormat`,(e,t)=>{xa.init(e,t),Dc.init(e,t)});function kc(e){return Lo(Oc,e)}var Ac=O(`ZodBoolean`,(e,t)=>{Sa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r)});function jc(e){return Ro(Ac,e)}var Mc=O(`ZodUnknown`,(e,t)=>{Ca.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Nc(){return zo(Mc)}var Pc=O(`ZodNever`,(e,t)=>{wa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r)});function Fc(e){return Bo(Pc,e)}var Ic=O(`ZodArray`,(e,t)=>{Ea.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.element=t.element,ac(e,`ZodArray`,{min(e,t){return this.check(qo(e,t))},nonempty(e){return this.check(qo(1,e))},max(e,t){return this.check(Ko(e,t))},length(e,t){return this.check(Jo(e,t))},unwrap(){return this.element}})});function G(e,t){return ss(Ic,e,t)}var Lc=O(`ZodObject`,(e,t)=>{ja.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),A(e,`shape`,()=>t.shape),ac(e,`ZodObject`,{keyof(){return Gc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Nc()})},loose(){return this.clone({...this._zod.def,catchall:Nc()})},strict(){return this.clone({...this._zod.def,catchall:Fc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Sr(this,e)},safeExtend(e){return Cr(this,e)},merge(e){return wr(this,e)},pick(e){return br(this,e)},omit(e){return xr(this,e)},partial(...e){return Tr(Yc,this,e[0])},required(...e){return Er(al,this,e[0])}})});function K(e,t){return new Lc({type:`object`,shape:e??{},...N(t)})}var Rc=O(`ZodUnion`,(e,t)=>{Na.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.options=t.options});function q(e,t){return new Rc({type:`union`,options:e,...N(t)})}var zc=O(`ZodDiscriminatedUnion`,(e,t)=>{Rc.init(e,t),Pa.init(e,t)});function Bc(e,t,n){return new zc({type:`union`,options:t,discriminator:e,...N(n)})}var Vc=O(`ZodIntersection`,(e,t)=>{Fa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r)});function Hc(e,t){return new Vc({type:`intersection`,left:e,right:t})}var Uc=O(`ZodRecord`,(e,t)=>{Ra.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new Uc({type:`record`,keyType:H(),valueType:e,...N(t)}):new Uc({type:`record`,keyType:e,valueType:t,...N(n)})}var Wc=O(`ZodEnum`,(e,t)=>{za.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Wc({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Wc({...t,checks:[],...N(r),entries:i})}});function Gc(e,t){return new Wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}var Kc=O(`ZodLiteral`,(e,t)=>{Ba.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ss(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Kc({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}var qc=O(`ZodTransform`,(e,t)=>{Va.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $n(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Mr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Jc(e){return new qc({type:`transform`,transform:e})}var Yc=O(`ZodOptional`,(e,t)=>{Ua.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xc(e){return new Yc({type:`optional`,innerType:e})}var Zc=O(`ZodExactOptional`,(e,t)=>{Wa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qc(e){return new Zc({type:`optional`,innerType:e})}var $c=O(`ZodNullable`,(e,t)=>{Ga.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function el(e){return new $c({type:`nullable`,innerType:e})}var tl=O(`ZodDefault`,(e,t)=>{Ka.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nl(e,t){return new tl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():hr(t)}})}var rl=O(`ZodPrefault`,(e,t)=>{Ja.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function il(e,t){return new rl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():hr(t)}})}var al=O(`ZodNonOptional`,(e,t)=>{Ya.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ol(e,t){return new al({type:`nonoptional`,innerType:e,...N(t)})}var sl=O(`ZodCatch`,(e,t)=>{Za.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cl(e,t){return new sl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ll=O(`ZodPipe`,(e,t)=>{Qa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r),e.in=t.in,e.out=t.out});function ul(e,t){return new ll({type:`pipe`,in:e,out:t})}var dl=O(`ZodReadonly`,(e,t)=>{eo.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fl(e){return new dl({type:`readonly`,innerType:e})}var pl=O(`ZodCustom`,(e,t)=>{no.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,t,n,r)});function ml(e,t={}){return cs(pl,e,t)}function hl(e,t){return ls(e,t)}function gl(e){return`is`in e&&typeof e.is==`function`}function X(e){if(Object.defineProperty(e,"is",{value:t=>e.safeParse(t).success,enumerable:!0}),!gl(e))throw Error(`unreachable: is was just defined above`);return e}var _l=X(q([Y(`discoverable`),Y(`quiet`),Y(`dark`)])),vl=X(q([Y(`visible`),Y(`hidden`),Y(`ghost`)])),yl=X(q([Y(`active`),Y(`idle`),Y(`busy`),Y(`offline`)])),bl=X(q([Y(`public`),Y(`private`),Y(`secret`)])),xl=X(q([Y(`steer`),Y(`followUp`),Y(`info`)])),Sl=X(K({id:H(),version:W(),name:H(),harness:H(),cwd:H(),pid:W(),startedAt:H(),visibility:vl,status:yl,tags:G(H()),subscribedRooms:G(H())})),Cl=X(K({id:H(),version:W(),name:H(),type:bl,owner:H(),createdAt:H(),description:H(),members:G(H()),invited:G(H()),memberJoins:J(H(),W()),memberLeaves:J(H(),W()),invitedJoins:J(H(),W()),invitedLeaves:J(H(),W())})),wl=X(K({id:H(),from:H(),room:H(),content:H(),timestamp:H(),replyTo:H().optional(),readBy:G(H()),streamingBehavior:xl.optional()})),Tl=X(K({id:H(),from:H(),to:H(),content:H(),timestamp:H(),readBy:G(H()),streamingBehavior:xl.optional()})),El=X(q([Y(`timeout`),Y(`not_connected`),Y(`connection_lost`)])),Dl=X(Bc(`status`,[K({status:Y(`delivered`)}),K({status:Y(`read`)}),K({status:Y(`queued`),reason:El}),K({status:Y(`refused`),code:H()}),K({status:Y(`dropped`)}),K({status:Y(`expired`)})])),Ol=X(K({id:H(),name:H(),status:yl})),kl=X(Bc(`type`,[K({type:Y(`room_message`),message:wl}),K({type:Y(`dm`),message:Tl}),K({type:Y(`room_invite`),room:H(),roomDescription:H(),from:H(),fromName:H(),fromCwd:H()}),K({type:Y(`member_joined`),room:H(),agent:H()}),K({type:Y(`member_left`),room:H(),agent:H()}),K({type:Y(`room_members`),room:H(),members:G(Ol)}),K({type:Y(`member_status`),room:H(),agent:H(),status:yl}),K({type:Y(`delivery_status`),messageId:H(),agent:H(),delivery:Dl,room:H().optional()}),K({type:Y(`invite_declined`),room:H(),agent:H(),agentName:H(),reason:H()}),K({type:Y(`name_changed`),agent:H(),oldName:H(),newName:H()}),K({type:Y(`connection_request`),connectionId:H(),peerId:H(),dataPort:W(),name:H(),fingerprint:H()}),K({type:Y(`room_join_request`),room:H(),requesterId:H()}),K({type:Y(`capability_request`),requestId:H(),capability:H(),scopeKind:H(),scopePath:H().optional(),requesterDevice:H()})]));X(K({code:H(),expiresAt:H(),deviceId:H(),signature:H().optional()})),X(Bc(`action`,[K({action:Y(`register`),name:H(),visibility:vl,tags:G(H())}),K({action:Y(`update`),visibility:vl.optional(),status:yl.optional(),name:H().optional(),tags:G(H()).optional()}),K({action:Y(`whoami`)}),K({action:Y(`web_url`)}),K({action:Y(`create_room`),name:H(),type:bl,description:H()}),K({action:Y(`list_rooms`)}),K({action:Y(`join_room`),room:H()}),K({action:Y(`leave_room`),room:H()}),K({action:Y(`send`),target:H(),content:H(),replyTo:H().optional(),streamingBehavior:xl.optional()}),K({action:Y(`dm`),target:H(),content:H(),streamingBehavior:xl.optional()}),K({action:Y(`list_agents`)}),K({action:Y(`read_room`),room:H(),since:H().optional()}),K({action:Y(`invite`),room:H(),agent:H()}),K({action:Y(`kick`),room:H(),agent:H()}),K({action:Y(`decline_invite`),room:H(),reason:H()}),K({action:Y(`destroy_room`),room:H()}),K({action:Y(`mesh_connect`),host:H(),port:W(),policy:H().optional()}),K({action:Y(`mesh_accept`),connectionId:H()}),K({action:Y(`mesh_reject`),connectionId:H(),reason:H()}),K({action:Y(`mesh_pending`)}),K({action:Y(`room_accept`),room:H(),requesterId:H()}),K({action:Y(`room_reject`),room:H(),requesterId:H(),reason:H().optional()}),K({action:Y(`room_pending`)}),K({action:Y(`capability_accept`),requestId:H(),expires:W(),delegationsRemaining:W().optional(),capability:H().optional()}),K({action:Y(`capability_reject`),requestId:H(),reason:H().optional()}),K({action:Y(`capability_pending`)}),K({action:Y(`mesh_discover`),method:H().optional()}),K({action:Y(`mesh_advertise`),method:H(),name:H(),port:W().optional(),adapter:H().optional()}),K({action:Y(`mesh_unadvertise`),id:H()}),K({action:Y(`mesh_interfaces`)}),K({action:Y(`mesh_listen`),host:H(),port:W().optional(),policy:H().optional()}),K({action:Y(`mesh_unlisten`),id:H()}),K({action:Y(`mesh_listeners`)}),K({action:Y(`mesh_set_visibility`),visibility:_l,adapter:H().optional()}),K({action:Y(`mesh_get_visibility`)}),K({action:Y(`gateway_trust`),device:H(),principal:jc().optional(),machine:jc().optional()}),K({action:Y(`gateway_untrust`),device:H(),principal:jc().optional(),machine:jc().optional()}),K({action:Y(`gateway_list_trusted`)}),K({action:Y(`petname_set`),device:H(),name:H()}),K({action:Y(`petname_clear`),device:H()}),K({action:Y(`petname_list`)}),K({action:Y(`machine_name`),name:H().optional()}),K({action:Y(`principal_name`),name:H().optional()}),K({action:Y(`dm_admit`),target:H(),principal:jc().optional()}),K({action:Y(`dm_use_grant`),target:H(),grant:H()}),K({action:Y(`dm_revoke`),target:H()}),K({action:Y(`gateway_generate_connection_code`),ttlMs:W().optional(),privateKey:H().optional(),passphrase:H().optional()}),K({action:Y(`gateway_redeem_connection_code`),code:H(),expiresAt:H(),device:H(),signature:H().optional(),publicKey:H().optional(),fingerprint:H().optional()}),K({action:Y(`query_version`),device:H()}),K({action:Y(`mesh_graph`)}),K({action:Y(`mesh_trace`),target:H(),timeoutMs:W().optional()})]));var Z=K({content:H(),isError:jc()}),Al=q([Y(`public`),Y(`private`),Y(`secret`)]),jl=K({kind:q([Y(`direct`),Y(`relay`)]),from:H(),to:H(),via:H().optional()}),Ml=K({nodes:G(H()),edges:G(jl)}),Nl=K({id:H(),petname:H().optional(),selfName:H().optional()}),Pl=K({relayed:jc(),hubAddress:H().optional()}),Fl=K({rttMs:W(),local:Pl,remote:Pl.optional(),outcome:K({result:H(),code:H().optional()}).loose()}),Il=Bc(`type`,[K({type:Y(`agent_upsert`),agent:Sl}),K({type:Y(`agent_offline`),agentId:H()}),K({type:Y(`room_upsert`),room:Cl}),K({type:Y(`room_delete`),roomId:H()}),K({type:Y(`message_add`),roomId:H(),message:wl}),K({type:Y(`dm_add`),key:H(),message:Tl}),K({type:Y(`delivery`),agentId:H(),event:kl})]),Ll=K({agents:J(H(),Sl),rooms:J(H(),Cl),messages:J(H(),G(wl)),dms:J(H(),G(Tl))}),Rl=Bc(`kind`,[K({kind:Y(`state_sync`),state:Ll}),K({kind:Y(`state_patch`),patch:Il}),K({kind:Y(`delivery`),event:kl})]),zl=K({endpoint:H(),keys:K({p256dh:H(),auth:H()})}),Bl={send:w.input(K({target:H(),content:H()})).output(Z),dm:w.input(K({target:H(),content:H()})).output(Z),joinRoom:w.input(K({room:H()})).output(Z),leaveRoom:w.input(K({room:H().optional()})).output(Z),createRoom:w.input(K({name:H(),type:Al,description:H().optional()})).output(Z),listRooms:w.input(K({})).output(Z),listAgents:w.input(K({})).output(Z),readRoom:w.input(K({room:H().optional()})).output(Z),destroyRoom:w.input(K({room:H()})).output(Z),invite:w.input(K({room:H(),agent:H()})).output(Z),declineInvite:w.input(K({room:H(),reason:H()})).output(Z),kick:w.input(K({room:H(),agent:H()})).output(Z),renameAgent:w.input(K({agent:H(),name:H()})).output(Z),pushSubscribe:w.input(K({subscription:zl,agentId:H().optional()})).output(Z),pushUnsubscribe:w.input(K({agentId:H().optional()})).output(Z),subscribeEvents:w.input(K({lastEventId:H().optional()})).output(pn(Rl)),getRoomMessages:w.input(K({room:H(),since:H().optional()})).output(G(wl)),getMeshGraph:w.input(K({})).output(Ml),getDisplayNames:w.input(K({})).output(G(Nl)),getMeshTrace:w.input(K({target:H(),timeoutMs:W().optional()})).output(Fl),disconnect:w.input(K({})).output(K({}))};function Vl(e){if(typeof e!=`object`||!e||!(`endpoint`in e)||typeof e.endpoint!=`string`||!(`keys`in e))return!1;let t=e.keys;return!(typeof t!=`object`||!t||!(`p256dh`in t)||typeof t.p256dh!=`string`||!(`auth`in t)||typeof t.auth!=`string`)}async function Hl(e,t){let n=e=>{let n=t[e];return typeof n==`string`?n:``},r=e=>{let n=t[e];return typeof n==`string`?n:void 0},i=()=>{let e=t.type;return e===`public`||e===`private`||e===`secret`?e:`public`};switch(t.action){case`send`:return e.send({target:n(`target`),content:n(`content`)});case`dm`:return e.dm({target:n(`target`),content:n(`content`)});case`join_room`:return e.joinRoom({room:n(`room`)});case`leave_room`:return e.leaveRoom({room:r(`room`)});case`create_room`:return e.createRoom({name:n(`name`),type:i(),description:r(`description`)});case`list_rooms`:return e.listRooms({});case`list_agents`:return e.listAgents({});case`read_room`:return e.readRoom({room:r(`room`)});case`destroy_room`:return e.destroyRoom({room:n(`room`)});case`invite`:return e.invite({room:n(`room`),agent:n(`agent`)});case`decline_invite`:return e.declineInvite({room:n(`room`),reason:n(`reason`)});case`kick`:return e.kick({room:n(`room`),agent:n(`agent`)});case`rename_agent`:return e.renameAgent({agent:n(`agent`),name:n(`name`)});case`push_subscribe`:{let n=t.subscription;return Vl(n)?e.pushSubscribe({subscription:n,agentId:r(`agentId`)}):{content:`Invalid push subscription`,isError:!0}}case`push_unsubscribe`:return e.pushUnsubscribe({agentId:r(`agentId`)});default:return{content:`Unknown action: ${String(t.action)}`,isError:!0}}}var Ul=new Map,Wl=new Map,Gl=new Map,Kl=new Map;function ql(e){for(let[t,n]of Object.entries(e.agents))Ul.set(t,n);for(let[t,n]of Object.entries(e.rooms))Wl.set(t,n);for(let[t,n]of Object.entries(e.messages))Gl.set(t,n);for(let[t,n]of Object.entries(e.dms))Kl.set(t,n)}function Jl(e){switch(e.type){case`agent_upsert`:Ul.set(e.agent.id,e.agent);break;case`agent_offline`:{let t=Ul.get(e.agentId);t&&(t.status=`offline`,Ul.set(e.agentId,t));break}case`room_upsert`:Wl.set(e.room.id,e.room);break;case`room_delete`:Wl.delete(e.roomId);break;case`message_add`:{let t=Gl.get(e.roomId)??[];t.push(e.message),Gl.set(e.roomId,t);break}case`dm_add`:{let t=Kl.get(e.key)??[];t.push(e.message),Kl.set(e.key,t);break}case`delivery`:break;case`message_read`:if(e.room!==void 0){let t=Gl.get(e.room);if(t){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}else for(let[,t]of Kl){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}}function Yl(){return{agents:[...Ul.values()],rooms:[...Wl.values()]}}var Xl,Zl=0,Ql,$l=new Xn,eu=1e3,tu=3e4;function nu(e){let t=Ct(new nn({connect:async()=>{let t=new WebSocket(e);return Ql=t,t.addEventListener(`open`,()=>{ou({type:`connected`})}),t.addEventListener(`close`,()=>{ou({type:`disconnected`})}),new Promise((e,n)=>{t.addEventListener(`open`,()=>{e(t)},{once:!0}),t.addEventListener(`error`,n,{once:!0})})},reconnect:{enabled:!0,delay:e=>e.attempt===1?0:Math.min(eu*2**e.attempt,tu)},plugins:[new rn]}));Xl=t,iu(t,++Zl)}function ru(){++Zl,Xl=void 0,Ql?.close(),Ql=void 0}async function iu(e,t){let n;for(;t===Zl;)try{let r=await e.subscribeEvents(n===void 0?{}:{lastEventId:n});for await(let e of r){if(t!==Zl)return;let r=qe(e);switch(r?.id!==void 0&&(n=r.id),$l.publish(e),e.kind){case`state_sync`:ql(e.state),ou({type:`state`,state:Yl()});break;case`state_patch`:Jl(e.patch),ou({type:`patch`,patch:e.patch})}}return}catch{}}var au=new Set;function ou(e){let t=JSON.stringify(e);for(let e of au)try{e.postMessage(t)}catch{}}function su(e){switch(e.type){case`init`:nu(e.url);break;case`action`:{let t=Xl;if(!t)break;let n=e.id;Hl(t,e.action).then(e=>{ou({type:`actionResult`,id:n,result:e})}).catch(e=>{ou({type:`actionError`,id:n,message:e instanceof Error?e.message:String(e)})});break}case`getState`:ou({type:`state`,state:Yl()})}}function cu(e){if(typeof e!=`object`||!e||!(`type`in e))return!1;let t=e.type;return typeof t==`string`&&(t===`init`||t===`action`||t===`getState`)}function lu(){return{agents:Object.fromEntries(Ul),rooms:Object.fromEntries(Wl),messages:Object.fromEntries(Gl),dms:Object.fromEntries(Kl)}}async function Q(e){return Xl?Hl(Xl,e):{content:`Not connected to mesh yet`,isError:!0}}function uu(){if(!Xl)throw Error(`Not connected to mesh yet`);return Xl}var $=Fn(Bl).$context(),du={};du.current=new qn({send:$.send.handler(async({input:e})=>Q({action:`send`,...e})),dm:$.dm.handler(async({input:e})=>Q({action:`dm`,...e})),joinRoom:$.joinRoom.handler(async({input:e})=>Q({action:`join_room`,room:e.room})),leaveRoom:$.leaveRoom.handler(async({input:e})=>Q({action:`leave_room`,room:e.room})),createRoom:$.createRoom.handler(async({input:e})=>Q({action:`create_room`,name:e.name,type:e.type,description:e.description})),listRooms:$.listRooms.handler(async()=>Q({action:`list_rooms`})),listAgents:$.listAgents.handler(async()=>Q({action:`list_agents`})),readRoom:$.readRoom.handler(async({input:e})=>Q({action:`read_room`,room:e.room})),destroyRoom:$.destroyRoom.handler(async({input:e})=>Q({action:`destroy_room`,room:e.room})),invite:$.invite.handler(async({input:e})=>Q({action:`invite`,room:e.room,agent:e.agent})),declineInvite:$.declineInvite.handler(async({input:e})=>Q({action:`decline_invite`,room:e.room,reason:e.reason})),kick:$.kick.handler(async({input:e})=>Q({action:`kick`,room:e.room,agent:e.agent})),renameAgent:$.renameAgent.handler(async({input:e})=>Q({action:`rename_agent`,agent:e.agent,name:e.name})),pushSubscribe:$.pushSubscribe.handler(async({input:e})=>Q({action:`push_subscribe`,subscription:e.subscription,agentId:e.agentId})),pushUnsubscribe:$.pushUnsubscribe.handler(async({input:e})=>Q({action:`push_unsubscribe`,agentId:e.agentId})),getRoomMessages:$.getRoomMessages.handler(async({input:e})=>uu().getRoomMessages(e)),getMeshGraph:$.getMeshGraph.handler(async()=>uu().getMeshGraph({})),getDisplayNames:$.getDisplayNames.handler(async()=>uu().getDisplayNames({})),getMeshTrace:$.getMeshTrace.handler(async({input:e})=>uu().getMeshTrace(e)),subscribeEvents:$.subscribeEvents.handler(async function*({input:e,signal:t}){e.lastEventId===void 0&&(yield{kind:`state_sync`,state:lu()}),yield*$l.subscribe({...t?{signal:t}:{},...e.lastEventId===void 0?{}:{lastEventId:e.lastEventId}})}),disconnect:$.disconnect.handler(({context:e})=>(setTimeout(()=>{du.current?.close(e.port)},0),{}))});function fu(e){du.current?.upgrade(e,{context:{port:e}})}return typeof self<`u`&&self.addEventListener(`connect`,e=>{let t=e.ports[0];if(t!==void 0){au.add(t);try{t.postMessage(JSON.stringify({type:`state`,state:Yl()}))}catch{}t.onmessage=e=>{let t=JSON.parse(typeof e.data==`string`?e.data:String(e.data));cu(t)&&su(t)},fu(t)}}),e.agents=Ul,e.applyPatch=Jl,e.applyStateSync=ql,e.connect=nu,e.disconnect=ru,e.dms=Kl,e.getStateSnapshot=Yl,e.localPublisher=$l,e.messages=Gl,e.ports=au,e.rooms=Wl,e.upgradeTabRpcPort=fu,e})({});
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ps(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:hs(t,`input`,e.processors),output:hs(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function z(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return z(r.element,n);if(r.type===`set`)return z(r.valueType,n);if(r.type===`lazy`)return z(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return z(r.innerType,n);if(r.type===`intersection`)return z(r.left,n)||z(r.right,n);if(r.type===`record`||r.type===`map`)return z(r.keyType,n)||z(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:z(r.in,n)||z(r.out,n);if(r.type===`object`){for(let e in r.shape)if(z(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(z(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(z(e,n))return!0;return!!(r.rest&&z(r.rest,n))}return!1}var ms=(e,t={})=>n=>{let r=ds({...n,processors:t});return R(e,r),fs(r,e),ps(r,e)},hs=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ds({...i??{},target:a,io:t,processors:n});return R(e,o),fs(o,e),ps(o,e)},gs={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_s=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=gs[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},vs=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ys=(e,t,n,r)=>{n.type=`boolean`},bs=(e,t,n,r)=>{n.not={}},xs=(e,t,n,r)=>{let i=e._zod.def,a=tr(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ss=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Cs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ws=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ts=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=R(a.element,t,{...r,path:[...r.path,`items`]})},Es=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=R(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=R(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ds=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>R(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Os=(e,t,n,r)=>{let i=e._zod.def,a=R(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=R(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ks=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=R(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=R(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=R(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},As=(e,t,n,r)=>{let i=e._zod.def,a=R(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},js=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ms=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ns=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ps=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Fs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;R(o,t,r);let s=t.seen.get(e);s.ref=o},Is=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ls=(e,t,n,r)=>{let i=e._zod.def;R(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rs=O(`ZodISODateTime`,(e,t)=>{aa.init(e,t),U.init(e,t)});function zs(e){return Mo(Rs,e)}var Bs=O(`ZodISODate`,(e,t)=>{oa.init(e,t),U.init(e,t)});function Vs(e){return No(Bs,e)}var Hs=O(`ZodISOTime`,(e,t)=>{sa.init(e,t),U.init(e,t)});function Us(e){return Po(Hs,e)}var Ws=O(`ZodISODuration`,(e,t)=>{ca.init(e,t),U.init(e,t)});function Gs(e){return Fo(Ws,e)}var B=O(`ZodError`,(e,t)=>{Pr.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Lr(e,t)},flatten:{value:t=>Ir(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,nr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,nr,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ks=Rr(B),qs=zr(B),Js=Br(B),Ys=Hr(B),Xs=Wr(B),Zs=Gr(B),Qs=Kr(B),$s=qr(B),ec=Jr(B),tc=Yr(B),nc=Xr(B),rc=Zr(B),ic=new WeakMap;function ac(e,t,n){let r=Object.getPrototypeOf(e),i=ic.get(r);if(i||(i=new Set,ic.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var V=O(`ZodType`,(e,t)=>(I.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:hs(e,`input`),output:hs(e,`output`)}}),e.toJSONSchema=ms(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ks(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Js(e,t,n),e.parseAsync=async(t,n)=>qs(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ys(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Xs(e,t,n),e.decode=(t,n)=>Zs(e,t,n),e.encodeAsync=async(t,n)=>Qs(e,t,n),e.decodeAsync=async(t,n)=>$s(e,t,n),e.safeEncode=(t,n)=>ec(e,t,n),e.safeDecode=(t,n)=>tc(e,t,n),e.safeEncodeAsync=async(t,n)=>nc(e,t,n),e.safeDecodeAsync=async(t,n)=>rc(e,t,n),ac(e,`ZodType`,{check(...e){let t=this.def;return this.clone(j(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return M(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ml(e,t))},superRefine(e,t){return this.check(hl(e,t))},overwrite(e){return this.check(ts(e))},optional(){return Xc(this)},exactOptional(){return Qc(this)},nullable(){return el(this)},nullish(){return Xc(el(this))},nonoptional(e){return ol(this,e)},array(){return G(this)},or(e){return q([this,e])},and(e){return Hc(this,e)},transform(e){return ul(this,Jc(e))},default(e){return nl(this,e)},prefault(e){return il(this,e)},catch(e){return cl(this,e)},pipe(e){return ul(this,e)},readonly(){return fl(this)},describe(e){let t=this.clone();return so.add(t,{description:e}),t},meta(...e){if(e.length===0)return so.get(this);let t=this.clone();return so.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return so.get(e)?.description},configurable:!0}),e)),oc=O(`_ZodString`,(e,t)=>{qi.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ac(e,`_ZodString`,{regex(...e){return this.check(Yo(...e))},includes(...e){return this.check(Qo(...e))},startsWith(...e){return this.check($o(...e))},endsWith(...e){return this.check(es(...e))},min(...e){return this.check(qo(...e))},max(...e){return this.check(Ko(...e))},length(...e){return this.check(Jo(...e))},nonempty(...e){return this.check(qo(1,...e))},lowercase(e){return this.check(Xo(e))},uppercase(e){return this.check(Zo(e))},trim(){return this.check(rs())},normalize(...e){return this.check(ns(...e))},toLowerCase(){return this.check(is())},toUpperCase(){return this.check(as())},slugify(){return this.check(os())}})}),sc=O(`ZodString`,(e,t)=>{qi.init(e,t),oc.init(e,t),e.email=t=>e.check(lo(cc,t)),e.url=t=>e.check(go(dc,t)),e.jwt=t=>e.check(jo(Ec,t)),e.emoji=t=>e.check(_o(fc,t)),e.guid=t=>e.check(uo(lc,t)),e.uuid=t=>e.check(fo(uc,t)),e.uuidv4=t=>e.check(po(uc,t)),e.uuidv6=t=>e.check(mo(uc,t)),e.uuidv7=t=>e.check(ho(uc,t)),e.nanoid=t=>e.check(vo(pc,t)),e.guid=t=>e.check(uo(lc,t)),e.cuid=t=>e.check(yo(mc,t)),e.cuid2=t=>e.check(bo(hc,t)),e.ulid=t=>e.check(xo(gc,t)),e.base64=t=>e.check(Oo(Cc,t)),e.base64url=t=>e.check(ko(wc,t)),e.xid=t=>e.check(So(_c,t)),e.ksuid=t=>e.check(Co(vc,t)),e.ipv4=t=>e.check(wo(yc,t)),e.ipv6=t=>e.check(To(bc,t)),e.cidrv4=t=>e.check(Eo(xc,t)),e.cidrv6=t=>e.check(Do(Sc,t)),e.e164=t=>e.check(Ao(Tc,t)),e.datetime=t=>e.check(zs(t)),e.date=t=>e.check(Vs(t)),e.time=t=>e.check(Us(t)),e.duration=t=>e.check(Gs(t))});function H(e){return co(sc,e)}var U=O(`ZodStringFormat`,(e,t)=>{L.init(e,t),oc.init(e,t)}),cc=O(`ZodEmail`,(e,t)=>{Xi.init(e,t),U.init(e,t)}),lc=O(`ZodGUID`,(e,t)=>{Ji.init(e,t),U.init(e,t)}),uc=O(`ZodUUID`,(e,t)=>{Yi.init(e,t),U.init(e,t)}),dc=O(`ZodURL`,(e,t)=>{Zi.init(e,t),U.init(e,t)}),fc=O(`ZodEmoji`,(e,t)=>{Qi.init(e,t),U.init(e,t)}),pc=O(`ZodNanoID`,(e,t)=>{$i.init(e,t),U.init(e,t)}),mc=O(`ZodCUID`,(e,t)=>{ea.init(e,t),U.init(e,t)}),hc=O(`ZodCUID2`,(e,t)=>{ta.init(e,t),U.init(e,t)}),gc=O(`ZodULID`,(e,t)=>{na.init(e,t),U.init(e,t)}),_c=O(`ZodXID`,(e,t)=>{ra.init(e,t),U.init(e,t)}),vc=O(`ZodKSUID`,(e,t)=>{ia.init(e,t),U.init(e,t)}),yc=O(`ZodIPv4`,(e,t)=>{la.init(e,t),U.init(e,t)}),bc=O(`ZodIPv6`,(e,t)=>{ua.init(e,t),U.init(e,t)}),xc=O(`ZodCIDRv4`,(e,t)=>{da.init(e,t),U.init(e,t)}),Sc=O(`ZodCIDRv6`,(e,t)=>{fa.init(e,t),U.init(e,t)}),Cc=O(`ZodBase64`,(e,t)=>{ma.init(e,t),U.init(e,t)}),wc=O(`ZodBase64URL`,(e,t)=>{ga.init(e,t),U.init(e,t)}),Tc=O(`ZodE164`,(e,t)=>{_a.init(e,t),U.init(e,t)}),Ec=O(`ZodJWT`,(e,t)=>{ya.init(e,t),U.init(e,t)}),Dc=O(`ZodNumber`,(e,t)=>{ba.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r),ac(e,`ZodNumber`,{gt(e,t){return this.check(Uo(e,t))},gte(e,t){return this.check(Wo(e,t))},min(e,t){return this.check(Wo(e,t))},lt(e,t){return this.check(Vo(e,t))},lte(e,t){return this.check(Ho(e,t))},max(e,t){return this.check(Ho(e,t))},int(e){return this.check(kc(e))},safe(e){return this.check(kc(e))},positive(e){return this.check(Uo(0,e))},nonnegative(e){return this.check(Wo(0,e))},negative(e){return this.check(Vo(0,e))},nonpositive(e){return this.check(Ho(0,e))},multipleOf(e,t){return this.check(Go(e,t))},step(e,t){return this.check(Go(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return Io(Dc,e)}var Oc=O(`ZodNumberFormat`,(e,t)=>{xa.init(e,t),Dc.init(e,t)});function kc(e){return Lo(Oc,e)}var Ac=O(`ZodBoolean`,(e,t)=>{Sa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r)});function jc(e){return Ro(Ac,e)}var Mc=O(`ZodUnknown`,(e,t)=>{Ca.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Nc(){return zo(Mc)}var Pc=O(`ZodNever`,(e,t)=>{wa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r)});function Fc(e){return Bo(Pc,e)}var Ic=O(`ZodArray`,(e,t)=>{Ea.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.element=t.element,ac(e,`ZodArray`,{min(e,t){return this.check(qo(e,t))},nonempty(e){return this.check(qo(1,e))},max(e,t){return this.check(Ko(e,t))},length(e,t){return this.check(Jo(e,t))},unwrap(){return this.element}})});function G(e,t){return ss(Ic,e,t)}var Lc=O(`ZodObject`,(e,t)=>{ja.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),A(e,`shape`,()=>t.shape),ac(e,`ZodObject`,{keyof(){return Gc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Nc()})},loose(){return this.clone({...this._zod.def,catchall:Nc()})},strict(){return this.clone({...this._zod.def,catchall:Fc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Sr(this,e)},safeExtend(e){return Cr(this,e)},merge(e){return wr(this,e)},pick(e){return br(this,e)},omit(e){return xr(this,e)},partial(...e){return Tr(Yc,this,e[0])},required(...e){return Er(al,this,e[0])}})});function K(e,t){return new Lc({type:`object`,shape:e??{},...N(t)})}var Rc=O(`ZodUnion`,(e,t)=>{Na.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.options=t.options});function q(e,t){return new Rc({type:`union`,options:e,...N(t)})}var zc=O(`ZodDiscriminatedUnion`,(e,t)=>{Rc.init(e,t),Pa.init(e,t)});function Bc(e,t,n){return new zc({type:`union`,options:t,discriminator:e,...N(n)})}var Vc=O(`ZodIntersection`,(e,t)=>{Fa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r)});function Hc(e,t){return new Vc({type:`intersection`,left:e,right:t})}var Uc=O(`ZodRecord`,(e,t)=>{Ra.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new Uc({type:`record`,keyType:H(),valueType:e,...N(t)}):new Uc({type:`record`,keyType:e,valueType:t,...N(n)})}var Wc=O(`ZodEnum`,(e,t)=>{za.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Wc({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Wc({...t,checks:[],...N(r),entries:i})}});function Gc(e,t){return new Wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}var Kc=O(`ZodLiteral`,(e,t)=>{Ba.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ss(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Kc({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}var qc=O(`ZodTransform`,(e,t)=>{Va.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $n(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Mr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Jc(e){return new qc({type:`transform`,transform:e})}var Yc=O(`ZodOptional`,(e,t)=>{Ua.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xc(e){return new Yc({type:`optional`,innerType:e})}var Zc=O(`ZodExactOptional`,(e,t)=>{Wa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qc(e){return new Zc({type:`optional`,innerType:e})}var $c=O(`ZodNullable`,(e,t)=>{Ga.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function el(e){return new $c({type:`nullable`,innerType:e})}var tl=O(`ZodDefault`,(e,t)=>{Ka.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nl(e,t){return new tl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():hr(t)}})}var rl=O(`ZodPrefault`,(e,t)=>{Ja.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function il(e,t){return new rl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():hr(t)}})}var al=O(`ZodNonOptional`,(e,t)=>{Ya.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ol(e,t){return new al({type:`nonoptional`,innerType:e,...N(t)})}var sl=O(`ZodCatch`,(e,t)=>{Za.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cl(e,t){return new sl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var ll=O(`ZodPipe`,(e,t)=>{Qa.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r),e.in=t.in,e.out=t.out});function ul(e,t){return new ll({type:`pipe`,in:e,out:t})}var dl=O(`ZodReadonly`,(e,t)=>{eo.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fl(e){return new dl({type:`readonly`,innerType:e})}var pl=O(`ZodCustom`,(e,t)=>{no.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,t,n,r)});function ml(e,t={}){return cs(pl,e,t)}function hl(e,t){return ls(e,t)}function gl(e){return`is`in e&&typeof e.is==`function`}function X(e){if(Object.defineProperty(e,"is",{value:t=>e.safeParse(t).success,enumerable:!0}),!gl(e))throw Error(`unreachable: is was just defined above`);return e}var _l=X(q([Y(`discoverable`),Y(`quiet`),Y(`dark`)])),vl=X(q([Y(`visible`),Y(`hidden`),Y(`ghost`)])),yl=X(q([Y(`active`),Y(`idle`),Y(`busy`),Y(`offline`)])),bl=X(q([Y(`public`),Y(`private`),Y(`secret`)])),xl=X(q([Y(`steer`),Y(`followUp`),Y(`info`)])),Sl=X(K({id:H(),version:W(),name:H(),harness:H(),cwd:H(),pid:W(),startedAt:H(),visibility:vl,status:yl,tags:G(H()),subscribedRooms:G(H())})),Cl=X(K({id:H(),version:W(),name:H(),type:bl,owner:H(),createdAt:H(),description:H(),members:G(H()),invited:G(H()),memberJoins:J(H(),W()),memberLeaves:J(H(),W()),invitedJoins:J(H(),W()),invitedLeaves:J(H(),W())})),wl=X(K({id:H(),from:H(),room:H(),content:H(),timestamp:H(),replyTo:H().optional(),readBy:G(H()),streamingBehavior:xl.optional()})),Tl=X(K({id:H(),from:H(),to:H(),content:H(),timestamp:H(),readBy:G(H()),streamingBehavior:xl.optional()})),El=X(q([Y(`timeout`),Y(`not_connected`),Y(`connection_lost`)])),Dl=X(Bc(`status`,[K({status:Y(`delivered`)}),K({status:Y(`read`)}),K({status:Y(`queued`),reason:El}),K({status:Y(`refused`),code:H()}),K({status:Y(`dropped`)}),K({status:Y(`expired`)})])),Ol=X(K({id:H(),name:H(),status:yl})),kl=X(Bc(`type`,[K({type:Y(`room_message`),message:wl}),K({type:Y(`dm`),message:Tl}),K({type:Y(`room_invite`),room:H(),roomDescription:H(),from:H(),fromName:H(),fromCwd:H()}),K({type:Y(`member_joined`),room:H(),agent:H()}),K({type:Y(`member_left`),room:H(),agent:H()}),K({type:Y(`room_members`),room:H(),members:G(Ol)}),K({type:Y(`member_status`),room:H(),agent:H(),status:yl}),K({type:Y(`delivery_status`),messageId:H(),agent:H(),delivery:Dl,room:H().optional()}),K({type:Y(`invite_declined`),room:H(),agent:H(),agentName:H(),reason:H()}),K({type:Y(`name_changed`),agent:H(),oldName:H(),newName:H()}),K({type:Y(`connection_request`),connectionId:H(),peerId:H(),dataPort:W(),name:H(),fingerprint:H()}),K({type:Y(`room_join_request`),room:H(),requesterId:H()}),K({type:Y(`capability_request`),requestId:H(),capability:H(),scopeKind:H(),scopePath:H().optional(),requesterDevice:H()})]));X(K({code:H(),expiresAt:H(),deviceId:H(),signature:H().optional()})),X(Bc(`action`,[K({action:Y(`register`),name:H(),visibility:vl,tags:G(H())}),K({action:Y(`update`),visibility:vl.optional(),status:yl.optional(),name:H().optional(),tags:G(H()).optional()}),K({action:Y(`whoami`)}),K({action:Y(`web_url`)}),K({action:Y(`create_room`),name:H(),type:bl,description:H()}),K({action:Y(`list_rooms`)}),K({action:Y(`join_room`),room:H()}),K({action:Y(`leave_room`),room:H()}),K({action:Y(`send`),target:H(),content:H(),replyTo:H().optional(),streamingBehavior:xl.optional()}),K({action:Y(`dm`),target:H(),content:H(),streamingBehavior:xl.optional()}),K({action:Y(`list_agents`)}),K({action:Y(`read_room`),room:H(),since:H().optional()}),K({action:Y(`invite`),room:H(),agent:H()}),K({action:Y(`kick`),room:H(),agent:H()}),K({action:Y(`decline_invite`),room:H(),reason:H()}),K({action:Y(`destroy_room`),room:H()}),K({action:Y(`mesh_connect`),host:H(),port:W(),policy:H().optional()}),K({action:Y(`mesh_accept`),connectionId:H()}),K({action:Y(`mesh_reject`),connectionId:H(),reason:H()}),K({action:Y(`mesh_pending`)}),K({action:Y(`room_accept`),room:H(),requesterId:H()}),K({action:Y(`room_reject`),room:H(),requesterId:H(),reason:H().optional()}),K({action:Y(`room_pending`)}),K({action:Y(`capability_accept`),requestId:H(),expires:W(),delegationsRemaining:W().optional(),capability:H().optional()}),K({action:Y(`capability_reject`),requestId:H(),reason:H().optional()}),K({action:Y(`capability_pending`)}),K({action:Y(`mesh_discover`),method:H().optional()}),K({action:Y(`mesh_advertise`),method:H(),name:H(),port:W().optional(),adapter:H().optional()}),K({action:Y(`mesh_unadvertise`),id:H()}),K({action:Y(`mesh_interfaces`)}),K({action:Y(`lan_web_uis`)}),K({action:Y(`mesh_listen`),host:H(),port:W().optional(),policy:H().optional()}),K({action:Y(`mesh_unlisten`),id:H()}),K({action:Y(`mesh_listeners`)}),K({action:Y(`mesh_set_visibility`),visibility:_l,adapter:H().optional()}),K({action:Y(`mesh_get_visibility`)}),K({action:Y(`gateway_trust`),device:H(),principal:jc().optional(),machine:jc().optional()}),K({action:Y(`gateway_untrust`),device:H(),principal:jc().optional(),machine:jc().optional()}),K({action:Y(`gateway_list_trusted`)}),K({action:Y(`petname_set`),device:H(),name:H()}),K({action:Y(`petname_clear`),device:H()}),K({action:Y(`petname_list`)}),K({action:Y(`machine_name`),name:H().optional()}),K({action:Y(`principal_name`),name:H().optional()}),K({action:Y(`dm_admit`),target:H(),principal:jc().optional()}),K({action:Y(`dm_use_grant`),target:H(),grant:H()}),K({action:Y(`dm_revoke`),target:H()}),K({action:Y(`gateway_generate_connection_code`),ttlMs:W().optional(),privateKey:H().optional(),passphrase:H().optional()}),K({action:Y(`gateway_redeem_connection_code`),code:H(),expiresAt:H(),device:H(),signature:H().optional(),publicKey:H().optional(),fingerprint:H().optional()}),K({action:Y(`query_version`),device:H()}),K({action:Y(`mesh_graph`)}),K({action:Y(`mesh_trace`),target:H(),timeoutMs:W().optional()})]));var Z=K({content:H(),isError:jc()}),Al=q([Y(`public`),Y(`private`),Y(`secret`)]),jl=K({kind:q([Y(`direct`),Y(`relay`)]),from:H(),to:H(),via:H().optional()}),Ml=K({nodes:G(H()),edges:G(jl)}),Nl=K({id:H(),petname:H().optional(),selfName:H().optional()}),Pl=K({relayed:jc(),hubAddress:H().optional()}),Fl=K({rttMs:W(),local:Pl,remote:Pl.optional(),outcome:K({result:H(),code:H().optional()}).loose()}),Il=Bc(`type`,[K({type:Y(`agent_upsert`),agent:Sl}),K({type:Y(`agent_offline`),agentId:H()}),K({type:Y(`room_upsert`),room:Cl}),K({type:Y(`room_delete`),roomId:H()}),K({type:Y(`message_add`),roomId:H(),message:wl}),K({type:Y(`dm_add`),key:H(),message:Tl}),K({type:Y(`delivery`),agentId:H(),event:kl})]),Ll=K({agents:J(H(),Sl),rooms:J(H(),Cl),messages:J(H(),G(wl)),dms:J(H(),G(Tl))}),Rl=Bc(`kind`,[K({kind:Y(`state_sync`),state:Ll}),K({kind:Y(`state_patch`),patch:Il}),K({kind:Y(`delivery`),event:kl})]),zl=K({endpoint:H(),keys:K({p256dh:H(),auth:H()})}),Bl={send:w.input(K({target:H(),content:H()})).output(Z),dm:w.input(K({target:H(),content:H()})).output(Z),joinRoom:w.input(K({room:H()})).output(Z),leaveRoom:w.input(K({room:H().optional()})).output(Z),createRoom:w.input(K({name:H(),type:Al,description:H().optional()})).output(Z),listRooms:w.input(K({})).output(Z),listAgents:w.input(K({})).output(Z),readRoom:w.input(K({room:H().optional()})).output(Z),destroyRoom:w.input(K({room:H()})).output(Z),invite:w.input(K({room:H(),agent:H()})).output(Z),declineInvite:w.input(K({room:H(),reason:H()})).output(Z),kick:w.input(K({room:H(),agent:H()})).output(Z),renameAgent:w.input(K({agent:H(),name:H()})).output(Z),pushSubscribe:w.input(K({subscription:zl,agentId:H().optional()})).output(Z),pushUnsubscribe:w.input(K({agentId:H().optional()})).output(Z),subscribeEvents:w.input(K({lastEventId:H().optional()})).output(pn(Rl)),getRoomMessages:w.input(K({room:H(),since:H().optional()})).output(G(wl)),getMeshGraph:w.input(K({})).output(Ml),getDisplayNames:w.input(K({})).output(G(Nl)),getMeshTrace:w.input(K({target:H(),timeoutMs:W().optional()})).output(Fl),disconnect:w.input(K({})).output(K({}))};function Vl(e){if(typeof e!=`object`||!e||!(`endpoint`in e)||typeof e.endpoint!=`string`||!(`keys`in e))return!1;let t=e.keys;return!(typeof t!=`object`||!t||!(`p256dh`in t)||typeof t.p256dh!=`string`||!(`auth`in t)||typeof t.auth!=`string`)}async function Hl(e,t){let n=e=>{let n=t[e];return typeof n==`string`?n:``},r=e=>{let n=t[e];return typeof n==`string`?n:void 0},i=()=>{let e=t.type;return e===`public`||e===`private`||e===`secret`?e:`public`};switch(t.action){case`send`:return e.send({target:n(`target`),content:n(`content`)});case`dm`:return e.dm({target:n(`target`),content:n(`content`)});case`join_room`:return e.joinRoom({room:n(`room`)});case`leave_room`:return e.leaveRoom({room:r(`room`)});case`create_room`:return e.createRoom({name:n(`name`),type:i(),description:r(`description`)});case`list_rooms`:return e.listRooms({});case`list_agents`:return e.listAgents({});case`read_room`:return e.readRoom({room:r(`room`)});case`destroy_room`:return e.destroyRoom({room:n(`room`)});case`invite`:return e.invite({room:n(`room`),agent:n(`agent`)});case`decline_invite`:return e.declineInvite({room:n(`room`),reason:n(`reason`)});case`kick`:return e.kick({room:n(`room`),agent:n(`agent`)});case`rename_agent`:return e.renameAgent({agent:n(`agent`),name:n(`name`)});case`push_subscribe`:{let n=t.subscription;return Vl(n)?e.pushSubscribe({subscription:n,agentId:r(`agentId`)}):{content:`Invalid push subscription`,isError:!0}}case`push_unsubscribe`:return e.pushUnsubscribe({agentId:r(`agentId`)});default:return{content:`Unknown action: ${String(t.action)}`,isError:!0}}}var Ul=new Map,Wl=new Map,Gl=new Map,Kl=new Map;function ql(e){for(let[t,n]of Object.entries(e.agents))Ul.set(t,n);for(let[t,n]of Object.entries(e.rooms))Wl.set(t,n);for(let[t,n]of Object.entries(e.messages))Gl.set(t,n);for(let[t,n]of Object.entries(e.dms))Kl.set(t,n)}function Jl(e){switch(e.type){case`agent_upsert`:Ul.set(e.agent.id,e.agent);break;case`agent_offline`:{let t=Ul.get(e.agentId);t&&(t.status=`offline`,Ul.set(e.agentId,t));break}case`room_upsert`:Wl.set(e.room.id,e.room);break;case`room_delete`:Wl.delete(e.roomId);break;case`message_add`:{let t=Gl.get(e.roomId)??[];t.push(e.message),Gl.set(e.roomId,t);break}case`dm_add`:{let t=Kl.get(e.key)??[];t.push(e.message),Kl.set(e.key,t);break}case`delivery`:break;case`message_read`:if(e.room!==void 0){let t=Gl.get(e.room);if(t){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}else for(let[,t]of Kl){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}}function Yl(){return{agents:[...Ul.values()],rooms:[...Wl.values()]}}var Xl,Zl=0,Ql,$l=new Xn,eu=1e3,tu=3e4;function nu(e){let t=Ct(new nn({connect:async()=>{let t=new WebSocket(e);return Ql=t,t.addEventListener(`open`,()=>{ou({type:`connected`})}),t.addEventListener(`close`,()=>{ou({type:`disconnected`})}),new Promise((e,n)=>{t.addEventListener(`open`,()=>{e(t)},{once:!0}),t.addEventListener(`error`,n,{once:!0})})},reconnect:{enabled:!0,delay:e=>e.attempt===1?0:Math.min(eu*2**e.attempt,tu)},plugins:[new rn]}));Xl=t,iu(t,++Zl)}function ru(){++Zl,Xl=void 0,Ql?.close(),Ql=void 0}async function iu(e,t){let n;for(;t===Zl;)try{let r=await e.subscribeEvents(n===void 0?{}:{lastEventId:n});for await(let e of r){if(t!==Zl)return;let r=qe(e);switch(r?.id!==void 0&&(n=r.id),$l.publish(e),e.kind){case`state_sync`:ql(e.state),ou({type:`state`,state:Yl()});break;case`state_patch`:Jl(e.patch),ou({type:`patch`,patch:e.patch})}}return}catch{}}var au=new Set;function ou(e){let t=JSON.stringify(e);for(let e of au)try{e.postMessage(t)}catch{}}function su(e){switch(e.type){case`init`:nu(e.url);break;case`action`:{let t=Xl;if(!t)break;let n=e.id;Hl(t,e.action).then(e=>{ou({type:`actionResult`,id:n,result:e})}).catch(e=>{ou({type:`actionError`,id:n,message:e instanceof Error?e.message:String(e)})});break}case`getState`:ou({type:`state`,state:Yl()})}}function cu(e){if(typeof e!=`object`||!e||!(`type`in e))return!1;let t=e.type;return typeof t==`string`&&(t===`init`||t===`action`||t===`getState`)}function lu(){return{agents:Object.fromEntries(Ul),rooms:Object.fromEntries(Wl),messages:Object.fromEntries(Gl),dms:Object.fromEntries(Kl)}}async function Q(e){return Xl?Hl(Xl,e):{content:`Not connected to mesh yet`,isError:!0}}function uu(){if(!Xl)throw Error(`Not connected to mesh yet`);return Xl}var $=Fn(Bl).$context(),du={};du.current=new qn({send:$.send.handler(async({input:e})=>Q({action:`send`,...e})),dm:$.dm.handler(async({input:e})=>Q({action:`dm`,...e})),joinRoom:$.joinRoom.handler(async({input:e})=>Q({action:`join_room`,room:e.room})),leaveRoom:$.leaveRoom.handler(async({input:e})=>Q({action:`leave_room`,room:e.room})),createRoom:$.createRoom.handler(async({input:e})=>Q({action:`create_room`,name:e.name,type:e.type,description:e.description})),listRooms:$.listRooms.handler(async()=>Q({action:`list_rooms`})),listAgents:$.listAgents.handler(async()=>Q({action:`list_agents`})),readRoom:$.readRoom.handler(async({input:e})=>Q({action:`read_room`,room:e.room})),destroyRoom:$.destroyRoom.handler(async({input:e})=>Q({action:`destroy_room`,room:e.room})),invite:$.invite.handler(async({input:e})=>Q({action:`invite`,room:e.room,agent:e.agent})),declineInvite:$.declineInvite.handler(async({input:e})=>Q({action:`decline_invite`,room:e.room,reason:e.reason})),kick:$.kick.handler(async({input:e})=>Q({action:`kick`,room:e.room,agent:e.agent})),renameAgent:$.renameAgent.handler(async({input:e})=>Q({action:`rename_agent`,agent:e.agent,name:e.name})),pushSubscribe:$.pushSubscribe.handler(async({input:e})=>Q({action:`push_subscribe`,subscription:e.subscription,agentId:e.agentId})),pushUnsubscribe:$.pushUnsubscribe.handler(async({input:e})=>Q({action:`push_unsubscribe`,agentId:e.agentId})),getRoomMessages:$.getRoomMessages.handler(async({input:e})=>uu().getRoomMessages(e)),getMeshGraph:$.getMeshGraph.handler(async()=>uu().getMeshGraph({})),getDisplayNames:$.getDisplayNames.handler(async()=>uu().getDisplayNames({})),getMeshTrace:$.getMeshTrace.handler(async({input:e})=>uu().getMeshTrace(e)),subscribeEvents:$.subscribeEvents.handler(async function*({input:e,signal:t}){e.lastEventId===void 0&&(yield{kind:`state_sync`,state:lu()}),yield*$l.subscribe({...t?{signal:t}:{},...e.lastEventId===void 0?{}:{lastEventId:e.lastEventId}})}),disconnect:$.disconnect.handler(({context:e})=>(setTimeout(()=>{du.current?.close(e.port)},0),{}))});function fu(e){du.current?.upgrade(e,{context:{port:e}})}return typeof self<`u`&&self.addEventListener(`connect`,e=>{let t=e.ports[0];if(t!==void 0){au.add(t);try{t.postMessage(JSON.stringify({type:`state`,state:Yl()}))}catch{}t.onmessage=e=>{let t=JSON.parse(typeof e.data==`string`?e.data:String(e.data));cu(t)&&su(t)},fu(t)}}),e.agents=Ul,e.applyPatch=Jl,e.applyStateSync=ql,e.connect=nu,e.disconnect=ru,e.dms=Kl,e.getStateSnapshot=Yl,e.localPublisher=$l,e.messages=Gl,e.ports=au,e.rooms=Wl,e.upgradeTabRpcPort=fu,e})({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e=`agent-comms-v1`,t=[{"revision":"
|
|
1
|
+
(function(){var e=`agent-comms-v1`,t=[{"revision":"568dae9d37c0bff86ea84bcf50ead3ea","url":"mesh-worker.js"},{"revision":"f1ee3afb8c9e8f0d7315fd93d6457316","url":"index.html"},{"revision":"c4980321fd64db69691943e01338b717","url":"bundle.js"}].map(e=>e.url);self.addEventListener(`install`,n=>{n.waitUntil(self.caches.open(e).then(async e=>e.addAll(t)).then(async()=>self.skipWaiting()))}),self.addEventListener(`activate`,t=>{t.waitUntil(self.caches.keys().then(async t=>Promise.all(t.filter(t=>t!==e).map(async e=>self.caches.delete(e)))))});var n=200,r=300;function i(e,t){return e.method===`GET`&&t.status>=n&&t.status<r}self.addEventListener(`fetch`,t=>{if(new URL(t.request.url).pathname.startsWith(`/api/`)){t.respondWith(fetch(t.request).then(n=>{if(i(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n}).catch(async()=>self.caches.open(e).then(async e=>e.match(t.request)).then(e=>e??new Response(`Offline`,{status:503}))));return}t.respondWith(self.caches.open(e).then(async e=>e.match(t.request)).then(async n=>n||fetch(t.request).then(n=>{if(i(t.request,n)){let r=n.clone();self.caches.open(e).then(async e=>e.put(t.request,r))}return n})))}),self.addEventListener(`push`,e=>{let t=`Agent Comms`,n=`New message`;if(e.data)try{let r=e.data.json();typeof r.title==`string`&&(t=r.title),typeof r.body==`string`&&(n=r.body)}catch{let t=e.data.text();t&&(n=t)}e.waitUntil(self.registration.showNotification(t,{body:n,data:{url:self.location.origin}}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=e.notification.data,n=typeof t==`object`&&t&&`url`in t&&typeof t.url==`string`?t.url:self.location.origin;e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(async e=>{for(let t of e)if(t.url===n&&`focus`in t)return t.focus();return self.clients.openWindow(n)}))})})();
|
|
@@ -16,6 +16,11 @@ import type { MeshTransport } from "./transport.js";
|
|
|
16
16
|
import type { ConnectionCode } from "./types.js";
|
|
17
17
|
/** The request verb an invite's redeemer sends its issuer (params.verb), and the capability verb the manage-command carries only to satisfy manage-command.verb's grammar: the handler checks the invite itself, never a token. */
|
|
18
18
|
export declare const ACCOUNT_JOIN_VERB = "account.join";
|
|
19
|
+
/** The outcomes sendRoomRequest gives when this side has no route to the device yet, as opposed to an answer from the device. */
|
|
20
|
+
export declare const NO_ROUTE_CODES: ReadonlySet<string>;
|
|
21
|
+
export declare const JOIN_ROUTE_WAIT_MS: number;
|
|
22
|
+
/** Between attempts to reach the issuing device: short against the wait, long enough not to spin. */
|
|
23
|
+
export declare const JOIN_ROUTE_RETRY_MS = 250;
|
|
19
24
|
/** What became of an invite: answered with the account key, or expired unanswered. */
|
|
20
25
|
export type AccountInviteOutcome = "redeemed" | "expired";
|
|
21
26
|
export interface AccountInvite {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-join.d.ts","sourceRoot":"","sources":["../../src/core/account-join.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAOxE,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,mOAAmO;AACnO,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"account-join.d.ts","sourceRoot":"","sources":["../../src/core/account-join.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,qB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IN_VERB = "account.join";
|
|
21
21
|
const ACCOUNT_JOIN_CAPABILITY_VERB = "account:join";
|
|
22
22
|
/** The outcomes sendRoomRequest gives when this side has no route to the device yet, as opposed to an answer from the device. */
|
|
23
|
-
const NO_ROUTE_CODES = new Set([
|
|
23
|
+
export const NO_ROUTE_CODES = new Set([
|
|
24
24
|
"no_route",
|
|
25
25
|
"not_connected",
|
|
26
26
|
]);
|
|
27
27
|
const MS_PER_SECOND = 1000;
|
|
28
28
|
/** How long a join waits for a route to the issuing device to come up: a hub dial and its first directory exchange take seconds, so this is generous without leaving a person waiting on an unreachable issuer for long. */
|
|
29
29
|
const JOIN_ROUTE_WAIT_SECONDS = 30;
|
|
30
|
-
const JOIN_ROUTE_WAIT_MS = JOIN_ROUTE_WAIT_SECONDS * MS_PER_SECOND;
|
|
30
|
+
export const JOIN_ROUTE_WAIT_MS = JOIN_ROUTE_WAIT_SECONDS * MS_PER_SECOND;
|
|
31
31
|
/** Between attempts to reach the issuing device: short against the wait, long enough not to spin. */
|
|
32
|
-
const JOIN_ROUTE_RETRY_MS = 250;
|
|
32
|
+
export const JOIN_ROUTE_RETRY_MS = 250;
|
|
33
33
|
/** The label a join request asks the issuer to keep for the joiner's machine: undefined when it asks for none, "invalid" when it asks for one that is not a usable label for a full machine id (a label with no machine id included). */
|
|
34
34
|
function joinerPetname(params) {
|
|
35
35
|
const label = "label" in params ? params.label : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-join.js","sourceRoot":"","sources":["../../src/core/account-join.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,8BAA8B,GAI/B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,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,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The details a trusted remote peer asks for over a session of its own (agent-comms#323): a hub session publishes only an agent's summary, so its working directory, rooms and tags list elsewhere as not shared. A bridge this machine has chosen to trust may ask for them with the agent-comms/agent-details verb, carried over the relay pairing the two already have so the hub relays bytes it cannot read; the answer is the same summary a direct peer reads from the advert.
|
|
3
|
+
*/
|
|
4
|
+
import type { ManageOutcome } from "wire-mesh-core/domain/mesh-session";
|
|
5
|
+
import type { RoomVerbHandler } from "./room-router.js";
|
|
6
|
+
import type { MeshTransport } from "./transport.js";
|
|
7
|
+
import type { AgentIdentity } from "./types.js";
|
|
8
|
+
import type { HostedRoomAdvert } from "./gossip-extensions.js";
|
|
9
|
+
/** The params.verb a trusted peer's request is dispatched by, keyed per room-router's own convention like account-join's "account.join". */
|
|
10
|
+
export declare const AGENT_DETAILS_VERB = "agent.details";
|
|
11
|
+
/** The outer manage-command verb the request rides, which only satisfies manage-command.verb's own capability-verb grammar; the receiving side dispatches on AGENT_DETAILS_VERB, never this. */
|
|
12
|
+
export declare const AGENT_DETAILS_CAPABILITY_VERB = "agent:details";
|
|
13
|
+
/** One room as the details answer carries it: the hosted-room facts a direct peer's advert includes, description included. */
|
|
14
|
+
export interface AgentDetailsRoom {
|
|
15
|
+
path: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
}
|
|
19
|
+
/** The details a trusted peer gets that a hub session withholds: everything but the summary. */
|
|
20
|
+
export interface AgentDetails {
|
|
21
|
+
cwd: string;
|
|
22
|
+
tags: readonly string[];
|
|
23
|
+
rooms: readonly AgentDetailsRoom[];
|
|
24
|
+
}
|
|
25
|
+
/** What the verb handler needs: this side's own current details (undefined while no agent is registered), and the trust boundary the requester is gated on. */
|
|
26
|
+
export interface AgentDetailsDeps {
|
|
27
|
+
details: () => AgentDetails | undefined;
|
|
28
|
+
isTrusted: (deviceHex: string) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Answers the agent.details verb: the full details for a requester this machine trusts by device id, an explicit refusal for anyone else, and no agent yet for a bridge that has not registered. The requester is whoever the transport actually authenticated: the device the end-to-end secure channel named for a relayed request (fromDevice, never an address a hub asserts), or the connection's own authenticated peer for a direct session (the handle's id, which every dispatch path builds from exactly that). */
|
|
31
|
+
export declare function agentDetailsVerbHandler(deps: Readonly<AgentDetailsDeps>): RoomVerbHandler;
|
|
32
|
+
/** Narrows a manage outcome into the AgentDetails it carries: an ok outcome whose every field has the expected shape, and nothing else (a refusal, or an answer from a peer running something else). */
|
|
33
|
+
export declare function parseAgentDetails(outcome: Readonly<ManageOutcome>): AgentDetails | undefined;
|
|
34
|
+
/** The cache of details this side has asked trusted peers for: refreshed whenever a listing triggers a new fetch, and trimmed to the agents the last listing actually showed so a departed agent's entry does not linger. */
|
|
35
|
+
export declare class AgentDetailsCache {
|
|
36
|
+
private readonly entries;
|
|
37
|
+
/** Records (or replaces) the details fetched for one agent. */
|
|
38
|
+
set(agentId: string, details: Readonly<AgentDetails>): void;
|
|
39
|
+
/** The cached details for one agent, if a fetch has completed. */
|
|
40
|
+
get(agentId: string): Readonly<AgentDetails> | undefined;
|
|
41
|
+
/** Drops every entry whose agent the last listing did not include. */
|
|
42
|
+
retain(agentIds: ReadonlySet<string>): void;
|
|
43
|
+
}
|
|
44
|
+
/** This side's own details for a registered agent and its hosted rooms, the verb's answer body. */
|
|
45
|
+
export declare function ownAgentDetailsOf(agent: Readonly<Pick<AgentIdentity, "cwd" | "tags">>, hostedRooms: readonly Readonly<HostedRoomAdvert>[]): AgentDetails;
|
|
46
|
+
/** What the exchange needs from the store: this side's own agent and hosted rooms for answers, the trust boundary both directions gate on, a way to send a request to a peer, and this side's own peer id. */
|
|
47
|
+
export interface AgentDetailsExchangeDeps {
|
|
48
|
+
selfAgent: () => Readonly<Pick<AgentIdentity, "cwd" | "tags">> | undefined;
|
|
49
|
+
hostedRooms: () => readonly Readonly<HostedRoomAdvert>[];
|
|
50
|
+
isTrusted: (deviceHex: string) => boolean;
|
|
51
|
+
requireTransport: () => Readonly<Pick<MeshTransport, "sendRoomRequest">>;
|
|
52
|
+
}
|
|
53
|
+
/** Both halves of agent-comms#323 in one place: the verb a trusted peer's request is answered by, and the background fetch that fills this side's cache from peers this machine trusts. */
|
|
54
|
+
export declare class AgentDetailsExchange {
|
|
55
|
+
private readonly deps;
|
|
56
|
+
private readonly cache;
|
|
57
|
+
/** The registered verb handler, answering from this side's own agent and hosted rooms. */
|
|
58
|
+
readonly handler: RoomVerbHandler;
|
|
59
|
+
constructor(deps: Readonly<AgentDetailsExchangeDeps>);
|
|
60
|
+
/** Asks every trusted remote agent whose details a hub session withholds for them, without waiting: answers land in the cache and show on the next listing, and an unreachable peer simply keeps its not-shared listing. selfPeerId is the asking side's own agent, excluded from the fetches. */
|
|
61
|
+
refresh(agents: readonly Readonly<AgentIdentity>[], selfPeerId: string): void;
|
|
62
|
+
/** The cached details for one remote agent, once its trusted peer has answered. */
|
|
63
|
+
cached(agentId: string): Readonly<AgentDetails> | undefined;
|
|
64
|
+
/** One agent's fetch, retried while no route to it exists yet (a relay pairing takes a moment to come up) and settled by the first real answer either way. */
|
|
65
|
+
private fetch;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=agent-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-details.d.ts","sourceRoot":"","sources":["../../src/core/agent-details.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQpD,OAAO,KAAK,EAAE,aAAa,EAAE,MA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