agent-comms 5.0.6 → 5.2.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/README.md +48 -29
- package/dist/bridges/cc-peer/run.d.ts.map +1 -1
- package/dist/bridges/cc-peer/run.js +11 -13
- package/dist/bridges/cc-peer/run.js.map +1 -1
- package/dist/bridges/claude-code/channel.d.ts.map +1 -1
- package/dist/bridges/claude-code/channel.js +2 -6
- package/dist/bridges/claude-code/channel.js.map +1 -1
- package/dist/bridges/codex/tool.d.ts.map +1 -1
- package/dist/bridges/codex/tool.js +12 -2
- package/dist/bridges/codex/tool.js.map +1 -1
- package/dist/bridges/mcp/server.d.ts.map +1 -1
- package/dist/bridges/mcp/server.js +12 -2
- package/dist/bridges/mcp/server.js.map +1 -1
- package/dist/bridges/opencode/plugin.d.ts.map +1 -1
- package/dist/bridges/opencode/plugin.js +13 -2
- package/dist/bridges/opencode/plugin.js.map +1 -1
- package/dist/bridges/user/tui.d.ts.map +1 -1
- package/dist/bridges/user/tui.js +2 -1
- package/dist/bridges/user/tui.js.map +1 -1
- package/dist/bridges/user/web/contract.d.ts +201 -13
- package/dist/bridges/user/web/contract.d.ts.map +1 -1
- package/dist/bridges/user/web/dist/bundle.js +1 -1
- package/dist/bridges/user/web/dist/mesh-worker.js +1 -1
- package/dist/bridges/user/web/dist/sw.js +1 -1
- package/dist/bridges/user/web/frontend/messages.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/messages.js +2 -1
- package/dist/bridges/user/web/frontend/messages.js.map +1 -1
- package/dist/bridges/user/web/frontend/tab-contract.d.ts +60 -4
- package/dist/bridges/user/web/frontend/tab-contract.d.ts.map +1 -1
- package/dist/bridges/user/web/frontend/types.d.ts +2 -2
- package/dist/bridges/user/web/frontend/types.d.ts.map +1 -1
- package/dist/bridges/user/web/router.d.ts +60 -4
- package/dist/bridges/user/web/router.d.ts.map +1 -1
- package/dist/core/bind-retry.d.ts +4 -0
- package/dist/core/bind-retry.d.ts.map +1 -1
- package/dist/core/bind-retry.js +11 -2
- package/dist/core/bind-retry.js.map +1 -1
- package/dist/core/bridge.d.ts.map +1 -1
- package/dist/core/bridge.js +2 -1
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/comms-store.d.ts +18 -3
- package/dist/core/comms-store.d.ts.map +1 -1
- package/dist/core/delivery-engine.d.ts +3 -2
- package/dist/core/delivery-engine.d.ts.map +1 -1
- package/dist/core/delivery-engine.js +6 -4
- package/dist/core/delivery-engine.js.map +1 -1
- package/dist/core/gossip-directory.d.ts +3 -0
- package/dist/core/gossip-directory.d.ts.map +1 -1
- package/dist/core/gossip-directory.js +7 -0
- package/dist/core/gossip-directory.js.map +1 -1
- package/dist/core/hub-session.d.ts +8 -1
- package/dist/core/hub-session.d.ts.map +1 -1
- package/dist/core/hub-session.js +23 -22
- package/dist/core/hub-session.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/listener-registry.d.ts +8 -0
- package/dist/core/listener-registry.d.ts.map +1 -1
- package/dist/core/listener-registry.js +15 -0
- package/dist/core/listener-registry.js.map +1 -1
- package/dist/core/mesh-store-shared.d.ts +3 -0
- package/dist/core/mesh-store-shared.d.ts.map +1 -1
- package/dist/core/mesh-store-shared.js +8 -0
- package/dist/core/mesh-store-shared.js.map +1 -1
- package/dist/core/mesh-store.d.ts +7 -5
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +25 -50
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/peer-lifecycle.d.ts +15 -1
- package/dist/core/peer-lifecycle.d.ts.map +1 -1
- package/dist/core/peer-lifecycle.js +84 -2
- package/dist/core/peer-lifecycle.js.map +1 -1
- package/dist/core/room-messaging.d.ts +8 -4
- package/dist/core/room-messaging.d.ts.map +1 -1
- package/dist/core/room-messaging.js +41 -18
- package/dist/core/room-messaging.js.map +1 -1
- package/dist/core/room-protocol.d.ts +17 -6
- package/dist/core/room-protocol.d.ts.map +1 -1
- package/dist/core/room-protocol.js +100 -18
- package/dist/core/room-protocol.js.map +1 -1
- package/dist/core/send-outcome.d.ts +28 -0
- package/dist/core/send-outcome.d.ts.map +1 -0
- package/dist/core/send-outcome.js +49 -0
- package/dist/core/send-outcome.js.map +1 -0
- package/dist/core/shutdown-signals.d.ts +22 -0
- package/dist/core/shutdown-signals.d.ts.map +1 -0
- package/dist/core/shutdown-signals.js +40 -0
- package/dist/core/shutdown-signals.js.map +1 -0
- package/dist/core/store.d.ts +4 -4
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +11 -2
- package/dist/core/store.js.map +1 -1
- package/dist/core/test/bridge.unit.test.js +1 -1
- package/dist/core/test/bridge.unit.test.js.map +1 -1
- package/dist/core/tool.d.ts.map +1 -1
- package/dist/core/tool.js +19 -5
- package/dist/core/tool.js.map +1 -1
- package/dist/core/transport-events.d.ts +19 -0
- package/dist/core/transport-events.d.ts.map +1 -0
- package/dist/core/transport-events.js +46 -0
- package/dist/core/transport-events.js.map +1 -0
- package/dist/core/transport.d.ts +6 -0
- package/dist/core/transport.d.ts.map +1 -1
- package/dist/core/types.d.ts +90 -7
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +23 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/wire-mesh-transport.d.ts +5 -0
- package/dist/core/wire-mesh-transport.d.ts.map +1 -1
- package/dist/core/wire-mesh-transport.js +49 -58
- package/dist/core/wire-mesh-transport.js.map +1 -1
- package/dist/test/agent-comms-version-gossip.integration.test.js +1 -0
- package/dist/test/agent-comms-version-gossip.integration.test.js.map +1 -1
- package/dist/test/agent-self-gossip.integration.test.js +1 -0
- package/dist/test/agent-self-gossip.integration.test.js.map +1 -1
- package/dist/test/become-coordinator-actual-port.integration.test.js +1 -0
- package/dist/test/become-coordinator-actual-port.integration.test.js.map +1 -1
- package/dist/test/cc-peer-fronted-approval.integration.test.js +1 -1
- package/dist/test/cc-peer-fronted-approval.integration.test.js.map +1 -1
- package/dist/test/coordinator-failover.integration.test.d.ts +5 -0
- package/dist/test/coordinator-failover.integration.test.d.ts.map +1 -0
- package/dist/test/coordinator-failover.integration.test.js +127 -0
- package/dist/test/coordinator-failover.integration.test.js.map +1 -0
- package/dist/test/coordinator-failover.unit.test.d.ts +5 -0
- package/dist/test/coordinator-failover.unit.test.d.ts.map +1 -0
- package/dist/test/coordinator-failover.unit.test.js +231 -0
- package/dist/test/coordinator-failover.unit.test.js.map +1 -0
- package/dist/test/data-sync-frame-handling.integration.test.js +1 -0
- package/dist/test/data-sync-frame-handling.integration.test.js.map +1 -1
- package/dist/test/delivery-engine-delivery.unit.test.js +3 -2
- package/dist/test/delivery-engine-delivery.unit.test.js.map +1 -1
- package/dist/test/delivery-engine-directed-notify.unit.test.js +3 -2
- package/dist/test/delivery-engine-directed-notify.unit.test.js.map +1 -1
- package/dist/test/delivery-engine.unit.test.js +1 -0
- package/dist/test/delivery-engine.unit.test.js.map +1 -1
- package/dist/test/delivery-receipt.helper.js +3 -3
- package/dist/test/delivery-receipt.helper.js.map +1 -1
- package/dist/test/dm-delivery-status.integration.test.d.ts +5 -0
- package/dist/test/dm-delivery-status.integration.test.d.ts.map +1 -0
- package/dist/test/dm-delivery-status.integration.test.js +77 -0
- package/dist/test/dm-delivery-status.integration.test.js.map +1 -0
- package/dist/test/dm-first-contact.integration.test.js +3 -3
- package/dist/test/dm-first-contact.integration.test.js.map +1 -1
- package/dist/test/gateway-forwarding.integration.test.js +2 -2
- package/dist/test/gateway-forwarding.integration.test.js.map +1 -1
- package/dist/test/gateway-trust.integration.test.js +1 -1
- package/dist/test/gateway-trust.integration.test.js.map +1 -1
- package/dist/test/gossip-directory-aggregation.integration.test.js +1 -0
- package/dist/test/gossip-directory-aggregation.integration.test.js.map +1 -1
- package/dist/test/gossip-listener-addresses.integration.test.js +1 -0
- package/dist/test/gossip-listener-addresses.integration.test.js.map +1 -1
- package/dist/test/hosted-rooms-gossip.integration.test.js +1 -0
- package/dist/test/hosted-rooms-gossip.integration.test.js.map +1 -1
- package/dist/test/hub-mode-session.integration.test.js +1 -0
- package/dist/test/hub-mode-session.integration.test.js.map +1 -1
- package/dist/test/hub-session-close.integration.test.d.ts +5 -0
- package/dist/test/hub-session-close.integration.test.d.ts.map +1 -0
- package/dist/test/hub-session-close.integration.test.js +38 -0
- package/dist/test/hub-session-close.integration.test.js.map +1 -0
- package/dist/test/hub-session-dispatch.unit.test.js +1 -0
- package/dist/test/hub-session-dispatch.unit.test.js.map +1 -1
- package/dist/test/hub-todevice-routing.integration.test.js +2 -2
- package/dist/test/hub-todevice-routing.integration.test.js.map +1 -1
- package/dist/test/listener-policy.integration.test.js +1 -0
- package/dist/test/listener-policy.integration.test.js.map +1 -1
- package/dist/test/mesh-graph-trace.integration.test.js +1 -0
- package/dist/test/mesh-graph-trace.integration.test.js.map +1 -1
- package/dist/test/mesh-store-orchestration.unit.test.js +1 -0
- package/dist/test/mesh-store-orchestration.unit.test.js.map +1 -1
- package/dist/test/peer-lifecycle.unit.test.js +9 -1
- package/dist/test/peer-lifecycle.unit.test.js.map +1 -1
- package/dist/test/presence-readvertise.integration.test.js +1 -0
- package/dist/test/presence-readvertise.integration.test.js.map +1 -1
- package/dist/test/query-version.integration.test.js +4 -2
- package/dist/test/query-version.integration.test.js.map +1 -1
- package/dist/test/room-join-admission.integration.test.js +1 -0
- package/dist/test/room-join-admission.integration.test.js.map +1 -1
- package/dist/test/room-join-approval-timeout.integration.test.js +1 -1
- package/dist/test/room-join-approval-timeout.integration.test.js.map +1 -1
- package/dist/test/room-messaging-durable-send.unit.test.js +3 -1
- package/dist/test/room-messaging-durable-send.unit.test.js.map +1 -1
- package/dist/test/room-messaging.unit.test.js +106 -15
- package/dist/test/room-messaging.unit.test.js.map +1 -1
- package/dist/test/room-protocol-admission.unit.test.js +9 -161
- package/dist/test/room-protocol-admission.unit.test.js.map +1 -1
- package/dist/test/room-protocol-retry-queue.unit.test.d.ts +2 -0
- package/dist/test/room-protocol-retry-queue.unit.test.d.ts.map +1 -0
- package/dist/test/room-protocol-retry-queue.unit.test.js +275 -0
- package/dist/test/room-protocol-retry-queue.unit.test.js.map +1 -0
- package/dist/test/room-protocol.helper.d.ts +60 -0
- package/dist/test/room-protocol.helper.d.ts.map +1 -0
- package/dist/test/room-protocol.helper.js +168 -0
- package/dist/test/room-protocol.helper.js.map +1 -0
- package/dist/test/room-protocol.unit.test.js +4 -159
- package/dist/test/room-protocol.unit.test.js.map +1 -1
- package/dist/test/room-read-directed.integration.test.js +3 -2
- package/dist/test/room-read-directed.integration.test.js.map +1 -1
- package/dist/test/room-router.unit.test.js +1 -0
- package/dist/test/room-router.unit.test.js.map +1 -1
- package/dist/test/room-send-retry-queue.integration.test.js +1 -0
- package/dist/test/room-send-retry-queue.integration.test.js.map +1 -1
- package/dist/test/send-outcome.unit.test.d.ts +2 -0
- package/dist/test/send-outcome.unit.test.d.ts.map +1 -0
- package/dist/test/send-outcome.unit.test.js +52 -0
- package/dist/test/send-outcome.unit.test.js.map +1 -0
- package/dist/test/shutdown-signals.unit.test.d.ts +5 -0
- package/dist/test/shutdown-signals.unit.test.d.ts.map +1 -0
- package/dist/test/shutdown-signals.unit.test.js +110 -0
- package/dist/test/shutdown-signals.unit.test.js.map +1 -0
- package/dist/test/test-transport.d.ts +2 -2
- package/dist/test/test-transport.d.ts.map +1 -1
- package/dist/test/test-transport.js +2 -2
- package/dist/test/test-transport.js.map +1 -1
- package/dist/test/wire-mesh-transport-gateway-trust.integration.test.js +4 -2
- package/dist/test/wire-mesh-transport-gateway-trust.integration.test.js.map +1 -1
- package/dist/test/wire-mesh-transport-hub.integration.test.js +1 -0
- package/dist/test/wire-mesh-transport-hub.integration.test.js.map +1 -1
- package/dist/test/wire-mesh-transport-shutdown-unref.integration.test.js +1 -0
- package/dist/test/wire-mesh-transport-shutdown-unref.integration.test.js.map +1 -1
- package/dist/test/wire-mesh-transport.integration.test.js +1 -0
- package/dist/test/wire-mesh-transport.integration.test.js.map +1 -1
- package/dist/test/wss-remote-connect.integration.test.js +1 -0
- package/dist/test/wss-remote-connect.integration.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -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(`delivered`),Y(`read`)])),Dl=X(K({id:H(),name:H(),status:yl})),Ol=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(Dl)}),K({type:Y(`member_status`),room:H(),agent:H(),status:yl}),K({type:Y(`delivery_status`),messageId:H(),agent:H(),status:El,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()}),K({action:Y(`gateway_untrust`),device:H(),principal:jc().optional()}),K({action:Y(`gateway_list_trusted`)}),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()}),kl=q([Y(`public`),Y(`private`),Y(`secret`)]),Al=K({kind:q([Y(`direct`),Y(`relay`)]),from:H(),to:H(),via:H().optional()}),jl=K({nodes:G(H()),edges:G(Al)}),Ml=K({relayed:jc(),hubAddress:H().optional()}),Nl=K({rttMs:W(),local:Ml,remote:Ml.optional(),outcome:K({result:H(),code:H().optional()}).loose()}),Pl=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:Ol})]),Fl=K({agents:J(H(),Sl),rooms:J(H(),Cl),messages:J(H(),G(wl)),dms:J(H(),G(Tl))}),Il=Bc(`kind`,[K({kind:Y(`state_sync`),state:Fl}),K({kind:Y(`state_patch`),patch:Pl}),K({kind:Y(`delivery`),event:Ol})]),Ll=K({endpoint:H(),keys:K({p256dh:H(),auth:H()})}),Rl={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:kl,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:Ll,agentId:H().optional()})).output(Z),pushUnsubscribe:w.input(K({agentId:H().optional()})).output(Z),subscribeEvents:w.input(K({lastEventId:H().optional()})).output(pn(Il)),getRoomMessages:w.input(K({room:H(),since:H().optional()})).output(G(wl)),getMeshGraph:w.input(K({})).output(jl),getMeshTrace:w.input(K({target:H(),timeoutMs:W().optional()})).output(Nl),disconnect:w.input(K({})).output(K({}))};function zl(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 Bl(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 zl(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 Vl=new Map,Hl=new Map,Ul=new Map,Wl=new Map;function Gl(e){for(let[t,n]of Object.entries(e.agents))Vl.set(t,n);for(let[t,n]of Object.entries(e.rooms))Hl.set(t,n);for(let[t,n]of Object.entries(e.messages))Ul.set(t,n);for(let[t,n]of Object.entries(e.dms))Wl.set(t,n)}function Kl(e){switch(e.type){case`agent_upsert`:Vl.set(e.agent.id,e.agent);break;case`agent_offline`:{let t=Vl.get(e.agentId);t&&(t.status=`offline`,Vl.set(e.agentId,t));break}case`room_upsert`:Hl.set(e.room.id,e.room);break;case`room_delete`:Hl.delete(e.roomId);break;case`message_add`:{let t=Ul.get(e.roomId)??[];t.push(e.message),Ul.set(e.roomId,t);break}case`dm_add`:{let t=Wl.get(e.key)??[];t.push(e.message),Wl.set(e.key,t);break}case`delivery`:break;case`message_read`:if(e.room!==void 0){let t=Ul.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 Wl){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}}function ql(){return{agents:[...Vl.values()],rooms:[...Hl.values()]}}var Jl,Yl=0,Xl,Zl=new Xn,Ql=1e3,$l=3e4;function eu(e){let t=Ct(new nn({connect:async()=>{let t=new WebSocket(e);return Xl=t,t.addEventListener(`open`,()=>{iu({type:`connected`})}),t.addEventListener(`close`,()=>{iu({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(Ql*2**e.attempt,$l)},plugins:[new rn]}));Jl=t,nu(t,++Yl)}function tu(){++Yl,Jl=void 0,Xl?.close(),Xl=void 0}async function nu(e,t){let n;for(;t===Yl;)try{let r=await e.subscribeEvents(n===void 0?{}:{lastEventId:n});for await(let e of r){if(t!==Yl)return;let r=qe(e);switch(r?.id!==void 0&&(n=r.id),Zl.publish(e),e.kind){case`state_sync`:Gl(e.state),iu({type:`state`,state:ql()});break;case`state_patch`:Kl(e.patch),iu({type:`patch`,patch:e.patch})}}return}catch{}}var ru=new Set;function iu(e){let t=JSON.stringify(e);for(let e of ru)try{e.postMessage(t)}catch{}}function au(e){switch(e.type){case`init`:eu(e.url);break;case`action`:{let t=Jl;if(!t)break;let n=e.id;Bl(t,e.action).then(e=>{iu({type:`actionResult`,id:n,result:e})}).catch(e=>{iu({type:`actionError`,id:n,message:e instanceof Error?e.message:String(e)})});break}case`getState`:iu({type:`state`,state:ql()})}}function ou(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 su(){return{agents:Object.fromEntries(Vl),rooms:Object.fromEntries(Hl),messages:Object.fromEntries(Ul),dms:Object.fromEntries(Wl)}}async function Q(e){return Jl?Bl(Jl,e):{content:`Not connected to mesh yet`,isError:!0}}function cu(){if(!Jl)throw Error(`Not connected to mesh yet`);return Jl}var $=Fn(Rl).$context(),lu={};lu.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})=>cu().getRoomMessages(e)),getMeshGraph:$.getMeshGraph.handler(async()=>cu().getMeshGraph({})),getMeshTrace:$.getMeshTrace.handler(async({input:e})=>cu().getMeshTrace(e)),subscribeEvents:$.subscribeEvents.handler(async function*({input:e,signal:t}){e.lastEventId===void 0&&(yield{kind:`state_sync`,state:su()}),yield*Zl.subscribe({...t?{signal:t}:{},...e.lastEventId===void 0?{}:{lastEventId:e.lastEventId}})}),disconnect:$.disconnect.handler(({context:e})=>(setTimeout(()=>{lu.current?.close(e.port)},0),{}))});function uu(e){lu.current?.upgrade(e,{context:{port:e}})}return typeof self<`u`&&self.addEventListener(`connect`,e=>{let t=e.ports[0];if(t!==void 0){ru.add(t);try{t.postMessage(JSON.stringify({type:`state`,state:ql()}))}catch{}t.onmessage=e=>{let t=JSON.parse(typeof e.data==`string`?e.data:String(e.data));ou(t)&&au(t)},uu(t)}}),e.agents=Vl,e.applyPatch=Kl,e.applyStateSync=Gl,e.connect=eu,e.disconnect=tu,e.dms=Wl,e.getStateSnapshot=ql,e.localPublisher=Zl,e.messages=Ul,e.ports=ru,e.rooms=Hl,e.upgradeTabRpcPort=uu,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(`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()}),K({action:Y(`gateway_untrust`),device:H(),principal:jc().optional()}),K({action:Y(`gateway_list_trusted`)}),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({relayed:jc(),hubAddress:H().optional()}),Pl=K({rttMs:W(),local:Nl,remote:Nl.optional(),outcome:K({result:H(),code:H().optional()}).loose()}),Fl=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})]),Il=K({agents:J(H(),Sl),rooms:J(H(),Cl),messages:J(H(),G(wl)),dms:J(H(),G(Tl))}),Ll=Bc(`kind`,[K({kind:Y(`state_sync`),state:Il}),K({kind:Y(`state_patch`),patch:Fl}),K({kind:Y(`delivery`),event:kl})]),Rl=K({endpoint:H(),keys:K({p256dh:H(),auth:H()})}),zl={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:Rl,agentId:H().optional()})).output(Z),pushUnsubscribe:w.input(K({agentId:H().optional()})).output(Z),subscribeEvents:w.input(K({lastEventId:H().optional()})).output(pn(Ll)),getRoomMessages:w.input(K({room:H(),since:H().optional()})).output(G(wl)),getMeshGraph:w.input(K({})).output(Ml),getMeshTrace:w.input(K({target:H(),timeoutMs:W().optional()})).output(Pl),disconnect:w.input(K({})).output(K({}))};function Bl(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 Vl(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 Bl(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 Hl=new Map,Ul=new Map,Wl=new Map,Gl=new Map;function Kl(e){for(let[t,n]of Object.entries(e.agents))Hl.set(t,n);for(let[t,n]of Object.entries(e.rooms))Ul.set(t,n);for(let[t,n]of Object.entries(e.messages))Wl.set(t,n);for(let[t,n]of Object.entries(e.dms))Gl.set(t,n)}function ql(e){switch(e.type){case`agent_upsert`:Hl.set(e.agent.id,e.agent);break;case`agent_offline`:{let t=Hl.get(e.agentId);t&&(t.status=`offline`,Hl.set(e.agentId,t));break}case`room_upsert`:Ul.set(e.room.id,e.room);break;case`room_delete`:Ul.delete(e.roomId);break;case`message_add`:{let t=Wl.get(e.roomId)??[];t.push(e.message),Wl.set(e.roomId,t);break}case`dm_add`:{let t=Gl.get(e.key)??[];t.push(e.message),Gl.set(e.key,t);break}case`delivery`:break;case`message_read`:if(e.room!==void 0){let t=Wl.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 Gl){let n=t.find(t=>t.id===e.messageId);n&&!n.readBy.includes(e.readBy)&&n.readBy.push(e.readBy)}}}function Jl(){return{agents:[...Hl.values()],rooms:[...Ul.values()]}}var Yl,Xl=0,Zl,Ql=new Xn,$l=1e3,eu=3e4;function tu(e){let t=Ct(new nn({connect:async()=>{let t=new WebSocket(e);return Zl=t,t.addEventListener(`open`,()=>{au({type:`connected`})}),t.addEventListener(`close`,()=>{au({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($l*2**e.attempt,eu)},plugins:[new rn]}));Yl=t,ru(t,++Xl)}function nu(){++Xl,Yl=void 0,Zl?.close(),Zl=void 0}async function ru(e,t){let n;for(;t===Xl;)try{let r=await e.subscribeEvents(n===void 0?{}:{lastEventId:n});for await(let e of r){if(t!==Xl)return;let r=qe(e);switch(r?.id!==void 0&&(n=r.id),Ql.publish(e),e.kind){case`state_sync`:Kl(e.state),au({type:`state`,state:Jl()});break;case`state_patch`:ql(e.patch),au({type:`patch`,patch:e.patch})}}return}catch{}}var iu=new Set;function au(e){let t=JSON.stringify(e);for(let e of iu)try{e.postMessage(t)}catch{}}function ou(e){switch(e.type){case`init`:tu(e.url);break;case`action`:{let t=Yl;if(!t)break;let n=e.id;Vl(t,e.action).then(e=>{au({type:`actionResult`,id:n,result:e})}).catch(e=>{au({type:`actionError`,id:n,message:e instanceof Error?e.message:String(e)})});break}case`getState`:au({type:`state`,state:Jl()})}}function su(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 cu(){return{agents:Object.fromEntries(Hl),rooms:Object.fromEntries(Ul),messages:Object.fromEntries(Wl),dms:Object.fromEntries(Gl)}}async function Q(e){return Yl?Vl(Yl,e):{content:`Not connected to mesh yet`,isError:!0}}function lu(){if(!Yl)throw Error(`Not connected to mesh yet`);return Yl}var $=Fn(zl).$context(),uu={};uu.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})=>lu().getRoomMessages(e)),getMeshGraph:$.getMeshGraph.handler(async()=>lu().getMeshGraph({})),getMeshTrace:$.getMeshTrace.handler(async({input:e})=>lu().getMeshTrace(e)),subscribeEvents:$.subscribeEvents.handler(async function*({input:e,signal:t}){e.lastEventId===void 0&&(yield{kind:`state_sync`,state:cu()}),yield*Ql.subscribe({...t?{signal:t}:{},...e.lastEventId===void 0?{}:{lastEventId:e.lastEventId}})}),disconnect:$.disconnect.handler(({context:e})=>(setTimeout(()=>{uu.current?.close(e.port)},0),{}))});function du(e){uu.current?.upgrade(e,{context:{port:e}})}return typeof self<`u`&&self.addEventListener(`connect`,e=>{let t=e.ports[0];if(t!==void 0){iu.add(t);try{t.postMessage(JSON.stringify({type:`state`,state:Jl()}))}catch{}t.onmessage=e=>{let t=JSON.parse(typeof e.data==`string`?e.data:String(e.data));su(t)&&ou(t)},du(t)}}),e.agents=Hl,e.applyPatch=ql,e.applyStateSync=Kl,e.connect=tu,e.disconnect=nu,e.dms=Gl,e.getStateSnapshot=Jl,e.localPublisher=Ql,e.messages=Wl,e.ports=iu,e.rooms=Ul,e.upgradeTabRpcPort=du,e})({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e=`agent-comms-v1`,t=[{"revision":"
|
|
1
|
+
(function(){var e=`agent-comms-v1`,t=[{"revision":"849085a83ee9bfc8cb7b211a56749754","url":"mesh-worker.js"},{"revision":"f1ee3afb8c9e8f0d7315fd93d6457316","url":"index.html"},{"revision":"d90ddb48cb622b6090597ea3002b4d00","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)}))})})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO7E,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,cAAc,GAAG,SAAS,CAuE5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,WAAW,GAAG,cAAc,CAOnE"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pure functions, no DOM or state dependency. Testable in isolation.
|
|
5
5
|
*/
|
|
6
|
+
import { describeDeliveryFor } from "../../../../core/send-outcome.js";
|
|
6
7
|
/** Format an ISO timestamp to HH:MM:SS for display. */
|
|
7
8
|
const ISO_TIME_OF_DAY_START = 11;
|
|
8
9
|
const ISO_TIME_OF_DAY_END = 19;
|
|
@@ -45,7 +46,7 @@ export function deliveryEventToMessage(event, currentRoom) {
|
|
|
45
46
|
case "delivery_status":
|
|
46
47
|
return {
|
|
47
48
|
type: "status",
|
|
48
|
-
text: `Message ${event.messageId} ${event.
|
|
49
|
+
text: `Message ${event.messageId} ${describeDeliveryFor(event.delivery, event.agent)}`,
|
|
49
50
|
};
|
|
50
51
|
case "room_members":
|
|
51
52
|
if (currentRoom === event.room) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -283,7 +283,21 @@ export declare const tabContract: {
|
|
|
283
283
|
type: "delivery_status";
|
|
284
284
|
messageId: string;
|
|
285
285
|
agent: string;
|
|
286
|
-
|
|
286
|
+
delivery: {
|
|
287
|
+
status: "delivered";
|
|
288
|
+
} | {
|
|
289
|
+
status: "read";
|
|
290
|
+
} | {
|
|
291
|
+
status: "queued";
|
|
292
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
293
|
+
} | {
|
|
294
|
+
status: "refused";
|
|
295
|
+
code: string;
|
|
296
|
+
} | {
|
|
297
|
+
status: "dropped";
|
|
298
|
+
} | {
|
|
299
|
+
status: "expired";
|
|
300
|
+
};
|
|
287
301
|
room?: string | undefined;
|
|
288
302
|
} | {
|
|
289
303
|
type: "invite_declined";
|
|
@@ -373,7 +387,21 @@ export declare const tabContract: {
|
|
|
373
387
|
type: "delivery_status";
|
|
374
388
|
messageId: string;
|
|
375
389
|
agent: string;
|
|
376
|
-
|
|
390
|
+
delivery: {
|
|
391
|
+
status: "delivered";
|
|
392
|
+
} | {
|
|
393
|
+
status: "read";
|
|
394
|
+
} | {
|
|
395
|
+
status: "queued";
|
|
396
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
397
|
+
} | {
|
|
398
|
+
status: "refused";
|
|
399
|
+
code: string;
|
|
400
|
+
} | {
|
|
401
|
+
status: "dropped";
|
|
402
|
+
} | {
|
|
403
|
+
status: "expired";
|
|
404
|
+
};
|
|
377
405
|
room?: string | undefined;
|
|
378
406
|
} | {
|
|
379
407
|
type: "invite_declined";
|
|
@@ -579,7 +607,21 @@ export declare const tabContract: {
|
|
|
579
607
|
type: "delivery_status";
|
|
580
608
|
messageId: string;
|
|
581
609
|
agent: string;
|
|
582
|
-
|
|
610
|
+
delivery: {
|
|
611
|
+
status: "delivered";
|
|
612
|
+
} | {
|
|
613
|
+
status: "read";
|
|
614
|
+
} | {
|
|
615
|
+
status: "queued";
|
|
616
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
617
|
+
} | {
|
|
618
|
+
status: "refused";
|
|
619
|
+
code: string;
|
|
620
|
+
} | {
|
|
621
|
+
status: "dropped";
|
|
622
|
+
} | {
|
|
623
|
+
status: "expired";
|
|
624
|
+
};
|
|
583
625
|
room?: string | undefined;
|
|
584
626
|
} | {
|
|
585
627
|
type: "invite_declined";
|
|
@@ -669,7 +711,21 @@ export declare const tabContract: {
|
|
|
669
711
|
type: "delivery_status";
|
|
670
712
|
messageId: string;
|
|
671
713
|
agent: string;
|
|
672
|
-
|
|
714
|
+
delivery: {
|
|
715
|
+
status: "delivered";
|
|
716
|
+
} | {
|
|
717
|
+
status: "read";
|
|
718
|
+
} | {
|
|
719
|
+
status: "queued";
|
|
720
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
721
|
+
} | {
|
|
722
|
+
status: "refused";
|
|
723
|
+
code: string;
|
|
724
|
+
} | {
|
|
725
|
+
status: "dropped";
|
|
726
|
+
} | {
|
|
727
|
+
status: "expired";
|
|
728
|
+
};
|
|
673
729
|
room?: string | undefined;
|
|
674
730
|
} | {
|
|
675
731
|
type: "invite_declined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-contract.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/tab-contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"tab-contract.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/tab-contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGvB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These mirror the wire format from server.ts and core/types.ts. No Zod — just interfaces for the browser bundle.
|
|
5
5
|
*/
|
|
6
|
-
import type { RoomMessage as CoreRoomMessage } from "../../../../core/types.js";
|
|
6
|
+
import type { MessageDelivery, RoomMessage as CoreRoomMessage } from "../../../../core/types.js";
|
|
7
7
|
import type { MeshGraph as ContractMeshGraph, MeshTraceResult as ContractMeshTraceResult } from "../contract.js";
|
|
8
8
|
export interface Agent {
|
|
9
9
|
id: string;
|
|
@@ -76,7 +76,7 @@ export type DeliveryEvent = {
|
|
|
76
76
|
type: "delivery_status";
|
|
77
77
|
messageId: string;
|
|
78
78
|
agent: string;
|
|
79
|
-
|
|
79
|
+
delivery: MessageDelivery;
|
|
80
80
|
room?: string;
|
|
81
81
|
} | {
|
|
82
82
|
type: "invite_declined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/bridges/user/web/frontend/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -342,7 +342,21 @@ export declare const meshRouter: {
|
|
|
342
342
|
type: "delivery_status";
|
|
343
343
|
messageId: string;
|
|
344
344
|
agent: string;
|
|
345
|
-
|
|
345
|
+
delivery: {
|
|
346
|
+
status: "delivered";
|
|
347
|
+
} | {
|
|
348
|
+
status: "read";
|
|
349
|
+
} | {
|
|
350
|
+
status: "queued";
|
|
351
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
352
|
+
} | {
|
|
353
|
+
status: "refused";
|
|
354
|
+
code: string;
|
|
355
|
+
} | {
|
|
356
|
+
status: "dropped";
|
|
357
|
+
} | {
|
|
358
|
+
status: "expired";
|
|
359
|
+
};
|
|
346
360
|
room?: string | undefined;
|
|
347
361
|
} | {
|
|
348
362
|
type: "invite_declined";
|
|
@@ -432,7 +446,21 @@ export declare const meshRouter: {
|
|
|
432
446
|
type: "delivery_status";
|
|
433
447
|
messageId: string;
|
|
434
448
|
agent: string;
|
|
435
|
-
|
|
449
|
+
delivery: {
|
|
450
|
+
status: "delivered";
|
|
451
|
+
} | {
|
|
452
|
+
status: "read";
|
|
453
|
+
} | {
|
|
454
|
+
status: "queued";
|
|
455
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
456
|
+
} | {
|
|
457
|
+
status: "refused";
|
|
458
|
+
code: string;
|
|
459
|
+
} | {
|
|
460
|
+
status: "dropped";
|
|
461
|
+
} | {
|
|
462
|
+
status: "expired";
|
|
463
|
+
};
|
|
436
464
|
room?: string | undefined;
|
|
437
465
|
} | {
|
|
438
466
|
type: "invite_declined";
|
|
@@ -638,7 +666,21 @@ export declare const meshRouter: {
|
|
|
638
666
|
type: "delivery_status";
|
|
639
667
|
messageId: string;
|
|
640
668
|
agent: string;
|
|
641
|
-
|
|
669
|
+
delivery: {
|
|
670
|
+
status: "delivered";
|
|
671
|
+
} | {
|
|
672
|
+
status: "read";
|
|
673
|
+
} | {
|
|
674
|
+
status: "queued";
|
|
675
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
676
|
+
} | {
|
|
677
|
+
status: "refused";
|
|
678
|
+
code: string;
|
|
679
|
+
} | {
|
|
680
|
+
status: "dropped";
|
|
681
|
+
} | {
|
|
682
|
+
status: "expired";
|
|
683
|
+
};
|
|
642
684
|
room?: string | undefined;
|
|
643
685
|
} | {
|
|
644
686
|
type: "invite_declined";
|
|
@@ -728,7 +770,21 @@ export declare const meshRouter: {
|
|
|
728
770
|
type: "delivery_status";
|
|
729
771
|
messageId: string;
|
|
730
772
|
agent: string;
|
|
731
|
-
|
|
773
|
+
delivery: {
|
|
774
|
+
status: "delivered";
|
|
775
|
+
} | {
|
|
776
|
+
status: "read";
|
|
777
|
+
} | {
|
|
778
|
+
status: "queued";
|
|
779
|
+
reason: "timeout" | "not_connected" | "connection_lost";
|
|
780
|
+
} | {
|
|
781
|
+
status: "refused";
|
|
782
|
+
code: string;
|
|
783
|
+
} | {
|
|
784
|
+
status: "dropped";
|
|
785
|
+
} | {
|
|
786
|
+
status: "expired";
|
|
787
|
+
};
|
|
732
788
|
room?: string | undefined;
|
|
733
789
|
} | {
|
|
734
790
|
type: "invite_declined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../src/bridges/user/web/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO/D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,cAAc,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;CACtC;AAmBD,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../src/bridges/user/web/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO/D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,cAAc,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;CACtC;AAmBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FtB,CAAC"}
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
export declare const BECOME_COORDINATOR_BIND_RETRIES = 5;
|
|
6
6
|
/** Delay between each becomeCoordinator bind retry -- five retries at this interval gives ~150ms of tolerance, comparable to the crash-race path's own documented "~100ms recovery". */
|
|
7
7
|
export declare const BECOME_COORDINATOR_BIND_RETRY_DELAY_MS = 30;
|
|
8
|
+
/** Whether an error is a port-already-bound failure, the one condition a bind is worth retrying (and, for PeerLifecycle's crash-race takeover, the one that means another survivor won the race rather than that binding is impossible). Matched on the message because Node surfaces the code there for every listen-path failure this codebase sees, including the ones wrapped by wire-mesh-core's own transport adapters, which carry no `code` property of their own. */
|
|
9
|
+
export declare function isAddrInUse(error: unknown): boolean;
|
|
10
|
+
/** Whether an error is a nothing-is-listening dial failure. Distinguished from every other dial failure because it alone means the port is genuinely free, which is what tells PeerLifecycle's takeover that re-entering the bind race is worth it rather than that the coordinator is there but unreachable. Matched on the message for the same reason isAddrInUse is. */
|
|
11
|
+
export declare function isConnectionRefused(error: unknown): boolean;
|
|
8
12
|
/** Retries `attempt` while it keeps rejecting with an EADDRINUSE-shaped error, up to `retries` further attempts, waiting `delayMs` between each. Any other error, or exhausting the retry budget, rethrows immediately -- never silently swallowed. A pure, transport-agnostic helper (no socket knowledge of its own) so becomeCoordinator's bind-retry race is fast and deterministic to test directly. */
|
|
9
13
|
export declare function retryOnAddrInUse<T>(attempt: () => Promise<T>, retries: number, delayMs: number): Promise<T>;
|
|
10
14
|
//# sourceMappingURL=bind-retry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind-retry.d.ts","sourceRoot":"","sources":["../../src/core/bind-retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4qBAA4qB;AAC5qB,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,wLAAwL;AACxL,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD,6YAA6Y;AAC7Y,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"bind-retry.d.ts","sourceRoot":"","sources":["../../src/core/bind-retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4qBAA4qB;AAC5qB,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,wLAAwL;AACxL,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD,8cAA8c;AAC9c,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGnD;AAED,4WAA4W;AAC5W,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED,6YAA6Y;AAC7Y,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAWZ"}
|
package/dist/core/bind-retry.js
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
export const BECOME_COORDINATOR_BIND_RETRIES = 5;
|
|
6
6
|
/** Delay between each becomeCoordinator bind retry -- five retries at this interval gives ~150ms of tolerance, comparable to the crash-race path's own documented "~100ms recovery". */
|
|
7
7
|
export const BECOME_COORDINATOR_BIND_RETRY_DELAY_MS = 30;
|
|
8
|
+
/** Whether an error is a port-already-bound failure, the one condition a bind is worth retrying (and, for PeerLifecycle's crash-race takeover, the one that means another survivor won the race rather than that binding is impossible). Matched on the message because Node surfaces the code there for every listen-path failure this codebase sees, including the ones wrapped by wire-mesh-core's own transport adapters, which carry no `code` property of their own. */
|
|
9
|
+
export function isAddrInUse(error) {
|
|
10
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11
|
+
return message.includes("EADDRINUSE");
|
|
12
|
+
}
|
|
13
|
+
/** Whether an error is a nothing-is-listening dial failure. Distinguished from every other dial failure because it alone means the port is genuinely free, which is what tells PeerLifecycle's takeover that re-entering the bind race is worth it rather than that the coordinator is there but unreachable. Matched on the message for the same reason isAddrInUse is. */
|
|
14
|
+
export function isConnectionRefused(error) {
|
|
15
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
16
|
+
return message.includes("ECONNREFUSED");
|
|
17
|
+
}
|
|
8
18
|
/** Retries `attempt` while it keeps rejecting with an EADDRINUSE-shaped error, up to `retries` further attempts, waiting `delayMs` between each. Any other error, or exhausting the retry budget, rethrows immediately -- never silently swallowed. A pure, transport-agnostic helper (no socket knowledge of its own) so becomeCoordinator's bind-retry race is fast and deterministic to test directly. */
|
|
9
19
|
export async function retryOnAddrInUse(attempt, retries, delayMs) {
|
|
10
20
|
for (let tryNumber = 0;; tryNumber++) {
|
|
@@ -12,8 +22,7 @@ export async function retryOnAddrInUse(attempt, retries, delayMs) {
|
|
|
12
22
|
return await attempt();
|
|
13
23
|
}
|
|
14
24
|
catch (error) {
|
|
15
|
-
|
|
16
|
-
if (!message.includes("EADDRINUSE") || tryNumber >= retries)
|
|
25
|
+
if (!isAddrInUse(error) || tryNumber >= retries)
|
|
17
26
|
throw error;
|
|
18
27
|
await new Promise((resolve) => {
|
|
19
28
|
setTimeout(resolve, delayMs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind-retry.js","sourceRoot":"","sources":["../../src/core/bind-retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4qBAA4qB;AAC5qB,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AACjD,wLAAwL;AACxL,MAAM,CAAC,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"bind-retry.js","sourceRoot":"","sources":["../../src/core/bind-retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4qBAA4qB;AAC5qB,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AACjD,wLAAwL;AACxL,MAAM,CAAC,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAEzD,8cAA8c;AAC9c,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC;AAED,4WAA4W;AAC5W,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC1C,CAAC;AAED,6YAA6Y;AAC7Y,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAyB,EACzB,OAAe,EACf,OAAe;IAEf,KAAK,IAAI,SAAS,GAAG,CAAC,GAAI,SAAS,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,OAAO;gBAAE,MAAM,KAAK,CAAC;YAC7D,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAClC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/core/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/core/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkG1B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAsBzD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAkVxE;AAMD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,aAAa,GACnB,iBAAiB,GAAG,SAAS,CAK/B;AAMD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CA2ChE;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAoB/D;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuB9B;AAMD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAMD,wBAAsB,cAAc,CAClC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAGnB"}
|
package/dist/core/bridge.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
import { ownerNamedRoomPath, slugRoomName } from "./room-path.js";
|
|
14
|
+
import { describeDeliveryFor } from "./send-outcome.js";
|
|
14
15
|
import { z } from "zod";
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
16
17
|
// Tool parameter schema — single source of truth for MCP input
|
|
@@ -527,7 +528,7 @@ export function formatDeliveryEvent(event) {
|
|
|
527
528
|
case "member_status":
|
|
528
529
|
return `${event.agent} is now ${event.status} in ${event.room}`;
|
|
529
530
|
case "delivery_status":
|
|
530
|
-
return `Message ${event.messageId} ${event.
|
|
531
|
+
return `Message ${event.messageId} ${describeDeliveryFor(event.delivery, event.agent)}${event.room !== undefined ? ` in ${event.room}` : ""}`;
|
|
531
532
|
case "invite_declined":
|
|
532
533
|
return `${event.agentName} declined invite to ${event.room}: "${event.reason}"`;
|
|
533
534
|
case "name_changed":
|