@aventurevc/mcp-server 0.8.159 → 0.8.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{w as e,y as t}from"./person-owner-BJgNYLKX.js";import{zr as n}from"./dist-BvNaeC7y.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};
@@ -1 +1 @@
1
- import{n as e}from"./commander-BB7CDPLs.js";import{C as t,S as n,T as r,g as i,h as a,l as o,o as s,u as c,v as l,w as u,y as d}from"./person-owner-BJgNYLKX.js";import{c as f,d as p,i as m}from"./result-envelope-DVa9d3ew.js";import{basename as h,extname as ee}from"node:path";import{AsyncLocalStorage as te}from"node:async_hooks";import{readFile as ne}from"node:fs/promises";function g(e){return new URL(e,`https://placeholder.invalid`).pathname}function _(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(re)?!1:n.every((e,t)=>v(e)||e===r[t])}function v(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function re(e){if(v(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var y=new te,b=()=>y.getStore()?.requestId,ie=()=>y.getStore()?.userBearerToken;function x(e,t){return y.run({...y.getStore(),requestId:e},t)}function S(e,t){return y.run({...y.getStore(),userBearerToken:e},t)}var C=3e4;async function w(e,t,n,r){let i=E(T(e.requestBody?.content),n);if(!i.ok||i.data===null)return m(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return m(`Request body is required.`);if(a?.kind===`multipart`)return await se(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return f(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function ae(e){if(typeof e!=`string`)return f(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return f(`Request body unchanged`,e);try{let t=p.safeParse(JSON.parse(e));if(!t.success)throw t.error;return f(`Request body parsed`,t.data)}catch(e){return m(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function oe(e,t){let n=e?.schema;if(n===void 0)return!1;let r=n.$ref?.startsWith(`#/components/schemas/`)===!0?n.$ref.slice(21):void 0,i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function T(e){let t=Object.entries(e??{});return[...t.flatMap(e=>I(e[0])?[D(e,`json`)]:[]),...t.flatMap(e=>L(e[0])?[D(e,`multipart`)]:[])]}function E(e,t){if(t===void 0)return f(`Default request content selected`,e[0]);let n=R(t),r=e.find(e=>R(e.contentType)===n);return r===void 0?m(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):f(`Explicit request content selected`,r)}function D(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function se(e,t,n){if(!e&&n==null)return f(`Optional multipart body omitted`,{});let r=ce(n);if(!r.ok||r.data===null)return m(r.summary,r.warnings);let i=new FormData;for(let e of le(t)){let t=r.data[e.name];if(t==null){if(e.required)return m(`Multipart body requires '${e.name}'.`);continue}if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return m(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return m(`Multipart part '${e.name}' has too many entries.`);if(O(e.schema)||k(e.schema)){let n=k(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return m(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await j(t);if(!n.ok||n.data===null)return m(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(ue(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=A(i,e.name,t);if(!n.ok)return n}}return f(`Multipart body prepared`,{body:i})}function ce(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return f(`Multipart input parsed`,t)}return m(`Multipart request body must be a JSON object keyed by form part name.`)}function le(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function O(e){return e.type===`string`&&e.format===`binary`}function k(e){return e.type===`array`&&e.items!==void 0&&O(e.items)}function ue(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function A(e,t,n){if(Array.isArray(n)){for(let r of n){let n=A(e,t,r);if(!n.ok)return n}return f(`Multipart scalar array appended`,null)}return typeof n==`object`?m(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),f(`Multipart scalar appended`,null))}async function j(e){return P(e)?await M(e):b()===void 0?await N(e):m(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function M(e){let t=new AbortController,n=setTimeout(()=>t.abort(),C);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return m(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??F(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return f(`URL media fetched`,{blob:a,filename:h(n.pathname)||`upload`})}catch(e){return t.signal.aborted?m(`Failed to fetch media URL: timed out after ${C}ms.`):m(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function N(e){try{let t=F(e)??``,n=await ne(e);return f(`File media read`,{blob:new Blob([n],{type:t}),filename:h(e)})}catch(t){return m(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function P(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function F(e){return z[ee(e).toLowerCase()]}function I(e){let t=R(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function L(e){return R(e)===`multipart/form-data`}var R=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,z={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`},B=[`get`,`post`,`put`,`patch`,`delete`],V={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},H=e=>V[e];function U(e){let t=e.toLowerCase(),n=B.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var de=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],W=t({name:u().regex(/^[A-Z][A-Z0-9_]*$/u)}),G=r([i(`private`),d({scope:u().optional(),value:u().optional()})]),K=a(()=>d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),readOnly:c().optional(),items:K.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),properties:n(u(),K).optional(),required:o(u()).optional(),oneOf:o(K).optional(),anyOf:o(K).optional(),allOf:o(K).optional(),"x-aventure-visibility":G.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":W.optional(),"x-aventure-detail":i(!0).optional()})),fe=d({in:u(),name:u(),required:c().optional(),description:u().optional(),schema:K.optional(),"x-aventure-visibility":G.optional(),"x-aventure-legacy-name":t({name:u().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),q=n(u(),d({schema:K.optional()})),pe=d({description:u().optional(),content:q.optional(),"x-aventure-standard-response":c().optional()}),J=d({description:u().optional(),required:c().optional(),content:q.optional()}),me=t({auth:s([`none`,`read`]).optional()}).optional(),Y=r([i(``),u().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),he=t({readOperationId:u().min(1),writePointer:Y,readPointer:Y}),ge=u().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),X=u().regex(/^[a-z][A-Za-z0-9]*$/u),_e=u().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),ve=t({command:ge,role:s(de),summary:u().trim().min(1).optional(),description:u().trim().min(1).optional(),bodyOption:o(X).min(1).optional(),localOption:o(t({optionKey:X,flag:_e,description:u().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),ye=d({operationId:u(),summary:u().optional(),description:u().optional(),tags:o(u()).optional(),deprecated:c().optional(),hidden:c().optional(),security:o(n(u(),o(u()))).optional(),parameters:o(fe).optional(),requestBody:J.optional(),responses:n(u(),pe),"x-aventure-visibility":G.optional(),"x-aventure-tool":me,"x-aventure-mutation-readback":he.optional(),"x-aventure-cli-composite":ve}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),be=d(Object.fromEntries(B.map(e=>[e,ye.optional()]))),xe=d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),readOnly:c().optional(),items:K.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),oneOf:o(K).optional(),anyOf:o(K).optional(),allOf:o(K).optional(),properties:n(u(),K).optional(),required:o(u()).optional(),"x-aventure-visibility":G.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":W.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-noun":t({one:u().trim().min(1),other:u().trim().min(1)}).optional()});d({info:d({description:u().optional()}).optional(),tags:o(d({name:u(),description:u().optional()})).optional(),paths:n(u(),be),webhooks:n(u(),d({post:d({description:u(),requestBody:J})})).optional(),components:d({schemas:n(u(),xe)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of B){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&Z(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var Se=new Set([`page`,`size`,`sort`]);function Z(e,t){for(let[n,r]of Object.entries(e))for(let e of B){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function Ce(e,t,n){let r=g(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&_(n,r))return{method:t,template:n,operation:e}}return null}function we(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function Te(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function Ee(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||Se.has(r.name))continue;let e=t?.[r.name]??De(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function De(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}function Oe(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function Q(e){return e===`write`||e===`delete`}function ke(e,t){return e===`DELETE`||t===`delete`}var Ae=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function je(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function Me(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}function Ne(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>Pe(e.schema)))}function Pe(e){return e?.format===`byte`||e?.format===`binary`}function Fe(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Ie=e=>`--${$(e)}`;export{E as C,S as D,x as E,g as O,oe as S,ie as T,Ee as _,ke as a,w as b,Me as c,B as d,H as f,U as g,Z as h,Ie as i,$ as l,Te as m,Ne as n,Q as o,we as p,je as r,Fe as s,Ae as t,Oe as u,Ce as v,b as w,T as x,ae as y};
1
+ import{n as e}from"./commander-BB7CDPLs.js";import{C as t,S as n,T as r,g as i,h as a,l as o,o as s,u as c,v as l,w as u,y as d}from"./person-owner-BJgNYLKX.js";import{c as f,d as p,i as m}from"./result-envelope-DVa9d3ew.js";import{basename as h,extname as ee}from"node:path";import{AsyncLocalStorage as te}from"node:async_hooks";import{readFile as ne}from"node:fs/promises";function g(e){return new URL(e,`https://placeholder.invalid`).pathname}function _(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(re)?!1:n.every((e,t)=>v(e)||e===r[t])}function v(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function re(e){if(v(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var y=new te,b=()=>y.getStore()?.requestId,ie=()=>y.getStore()?.userBearerToken;function x(e,t){return y.run({...y.getStore(),requestId:e},t)}function S(e,t){return y.run({...y.getStore(),userBearerToken:e},t)}var C=3e4;async function w(e,t,n,r){let i=E(T(e.requestBody?.content),n);if(!i.ok||i.data===null)return m(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return m(`Request body is required.`);if(a?.kind===`multipart`)return await se(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return f(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function ae(e){if(typeof e!=`string`)return f(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return f(`Request body unchanged`,e);try{let t=p.safeParse(JSON.parse(e));if(!t.success)throw t.error;return f(`Request body parsed`,t.data)}catch(e){return m(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function oe(e,t){let n=e?.schema;if(n===void 0)return!1;let r=n.$ref?.startsWith(`#/components/schemas/`)===!0?n.$ref.slice(21):void 0,i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function T(e){let t=Object.entries(e??{});return[...t.flatMap(e=>I(e[0])?[D(e,`json`)]:[]),...t.flatMap(e=>L(e[0])?[D(e,`multipart`)]:[])]}function E(e,t){if(t===void 0)return f(`Default request content selected`,e[0]);let n=R(t),r=e.find(e=>R(e.contentType)===n);return r===void 0?m(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):f(`Explicit request content selected`,r)}function D(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function se(e,t,n){if(!e&&n==null)return f(`Optional multipart body omitted`,{});let r=ce(n);if(!r.ok||r.data===null)return m(r.summary,r.warnings);let i=new FormData;for(let e of le(t)){let t=r.data[e.name];if(t==null){if(e.required)return m(`Multipart body requires '${e.name}'.`);continue}if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return m(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return m(`Multipart part '${e.name}' has too many entries.`);if(O(e.schema)||k(e.schema)){let n=k(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return m(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await j(t);if(!n.ok||n.data===null)return m(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(ue(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=A(i,e.name,t);if(!n.ok)return n}}return f(`Multipart body prepared`,{body:i})}function ce(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return f(`Multipart input parsed`,t)}return m(`Multipart request body must be a JSON object keyed by form part name.`)}function le(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function O(e){return e.type===`string`&&e.format===`binary`}function k(e){return e.type===`array`&&e.items!==void 0&&O(e.items)}function ue(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function A(e,t,n){if(Array.isArray(n)){for(let r of n){let n=A(e,t,r);if(!n.ok)return n}return f(`Multipart scalar array appended`,null)}return typeof n==`object`?m(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),f(`Multipart scalar appended`,null))}async function j(e){return P(e)?await M(e):b()===void 0?await N(e):m(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function M(e){let t=new AbortController,n=setTimeout(()=>t.abort(),C);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return m(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??F(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return f(`URL media fetched`,{blob:a,filename:h(n.pathname)||`upload`})}catch(e){return t.signal.aborted?m(`Failed to fetch media URL: timed out after ${C}ms.`):m(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function N(e){try{let t=F(e)??``,n=await ne(e);return f(`File media read`,{blob:new Blob([n],{type:t}),filename:h(e)})}catch(t){return m(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function P(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function F(e){return z[ee(e).toLowerCase()]}function I(e){let t=R(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function L(e){return R(e)===`multipart/form-data`}var R=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,z={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`},B=[`get`,`post`,`put`,`patch`,`delete`],V={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},H=e=>V[e];function U(e){let t=e.toLowerCase(),n=B.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var de=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],W=t({name:u().regex(/^[A-Z][A-Z0-9_]*$/u)}),G=r([i(`private`),d({scope:u().optional(),value:u().optional()})]),K=a(()=>d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),readOnly:c().optional(),items:K.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),properties:n(u(),K).optional(),required:o(u()).optional(),oneOf:o(K).optional(),anyOf:o(K).optional(),allOf:o(K).optional(),propertyNames:K.optional(),additionalProperties:r([K,c()]).optional(),"x-aventure-visibility":G.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":W.optional(),"x-aventure-detail":i(!0).optional()})),fe=d({in:u(),name:u(),required:c().optional(),description:u().optional(),schema:K.optional(),"x-aventure-visibility":G.optional(),"x-aventure-legacy-name":t({name:u().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),q=n(u(),d({schema:K.optional()})),pe=d({description:u().optional(),content:q.optional(),"x-aventure-standard-response":c().optional()}),J=d({description:u().optional(),required:c().optional(),content:q.optional()}),me=t({auth:s([`none`,`read`]).optional()}).optional(),Y=r([i(``),u().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),he=t({readOperationId:u().min(1),writePointer:Y,readPointer:Y}),ge=u().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),X=u().regex(/^[a-z][A-Za-z0-9]*$/u),_e=u().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),ve=t({command:ge,role:s(de),summary:u().trim().min(1).optional(),description:u().trim().min(1).optional(),bodyOption:o(X).min(1).optional(),localOption:o(t({optionKey:X,flag:_e,description:u().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),ye=d({operationId:u(),summary:u().optional(),description:u().optional(),tags:o(u()).optional(),deprecated:c().optional(),hidden:c().optional(),security:o(n(u(),o(u()))).optional(),parameters:o(fe).optional(),requestBody:J.optional(),responses:n(u(),pe),"x-aventure-visibility":G.optional(),"x-aventure-tool":me,"x-aventure-mutation-readback":he.optional(),"x-aventure-cli-composite":ve}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),be=d(Object.fromEntries(B.map(e=>[e,ye.optional()]))),xe=d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),readOnly:c().optional(),items:K.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),oneOf:o(K).optional(),anyOf:o(K).optional(),allOf:o(K).optional(),propertyNames:K.optional(),additionalProperties:r([K,c()]).optional(),properties:n(u(),K).optional(),required:o(u()).optional(),"x-aventure-visibility":G.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":W.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-noun":t({one:u().trim().min(1),other:u().trim().min(1)}).optional()});d({info:d({description:u().optional()}).optional(),tags:o(d({name:u(),description:u().optional()})).optional(),paths:n(u(),be),webhooks:n(u(),d({post:d({description:u(),requestBody:J})})).optional(),components:d({schemas:n(u(),xe)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of B){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&Z(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var Se=new Set([`page`,`size`,`sort`]);function Z(e,t){for(let[n,r]of Object.entries(e))for(let e of B){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function Ce(e,t,n){let r=g(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&_(n,r))return{method:t,template:n,operation:e}}return null}function we(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function Te(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function Ee(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||Se.has(r.name))continue;let e=t?.[r.name]??De(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function De(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}function Oe(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function Q(e){return e===`write`||e===`delete`}function ke(e,t){return e===`DELETE`||t===`delete`}var Ae=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function je(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function Me(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}function Ne(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>Pe(e.schema)))}function Pe(e){return e?.format===`byte`||e?.format===`binary`}function Fe(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Ie=e=>`--${$(e)}`;export{E as C,S as D,x as E,g as O,oe as S,ie as T,Ee as _,ke as a,w as b,Me as c,B as d,H as f,U as g,Z as h,Ie as i,$ as l,Te as m,Ne as n,Q as o,we as p,je as r,Fe as s,Ae as t,Oe as u,Ce as v,b as w,T as x,ae as y};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as e,M as t,N as n,O as r,_ as i,c as a,d as o,j as s,k as c,l,n as u,t as d,y as f}from"../chunks/esm-kgyHmk-Q.js";import{t as p}from"../chunks/commander-BB7CDPLs.js";import{A as m,B as h,C as g,E as _,F as v,I as y,N as b,O as x,P as S,R as C,S as w,T,_ as ee,a as E,b as D,d as O,f as k,g as A,h as te,i as j,j as M,k as ne,l as re,m as ie,o as N,p as ae,s as oe,t as se,u as ce,v as le,w as ue,y as de}from"../chunks/logging-BAomjpNJ.js";import{A as fe,D as pe,E as P,S as F,T as I,_ as L,b as R,c as me,d as he,f as ge,g as z,h as _e,i as ve,k as ye,l as B,m as be,o as V,p as xe,r as Se,s as Ce,u as H,v as U,w as W,x as we,y as G}from"../chunks/person-owner-BJgNYLKX.js";import{$ as Te,$n as Ee,$t as De,A as Oe,An as ke,Ar as Ae,At as je,B as Me,Bn as Ne,Bt as Pe,C as Fe,Cn as Ie,Cr as Le,Ct as Re,D as ze,Dn as Be,Dr as Ve,Dt as He,E as Ue,En as We,Er as Ge,Et as Ke,F as qe,Fn as Je,Fr as Ye,Ft as Xe,G as Ze,Gn as Qe,Gt as $e,H as et,Hn as tt,Ht as nt,I as rt,In as it,Ir as at,It as ot,J as st,Jn as ct,Jt as lt,K as ut,Kn as dt,Kt as ft,L as pt,Ln as mt,Lt as ht,Mn as gt,Mt as _t,N as vt,Nn as yt,Nr as bt,Nt as xt,O as St,On as Ct,Ot as wt,P as Tt,Pn as Et,Pr as Dt,Pt as Ot,Q as kt,Qn as At,Qt as jt,R as Mt,Rn as Nt,Rr as Pt,Rt as Ft,S as It,Sn as Lt,Sr as Rt,St as zt,T as Bt,Tn as Vt,Tr as Ht,Tt as Ut,U as Wt,Un as Gt,Ut as Kt,V as qt,Vn as Jt,Vt as Yt,W as Xt,Wn as Zt,Wt as Qt,X as $t,Xn as en,Xt as tn,Y as nn,Yn as rn,Yt as an,Z as on,Zn as sn,Zt as cn,_ as ln,_n as un,_r as dn,_t as fn,a as pn,an as mn,ar as hn,at as gn,b as _n,bn as vn,br as yn,bt as bn,c as xn,cn as Sn,cr as Cn,ct as wn,d as Tn,dn as En,dr as Dn,dt as On,en as kn,er as An,et as jn,f as Mn,fn as Nn,fr as Pn,ft as Fn,g as In,gn as Ln,gr as Rn,h as zn,hn as Bn,hr as Vn,ht as Hn,i as Un,in as Wn,ir as Gn,it as Kn,j as qn,jn as Jn,jr as Yn,jt as Xn,k as Zn,kn as Qn,kr as $n,kt as er,l as tr,ln as nr,lr as rr,lt as ir,m as ar,mn as or,mr as sr,mt as cr,n as lr,nn as ur,nr as dr,nt as fr,o as pr,on as mr,or as hr,ot as gr,p as _r,pn as vr,pr as yr,pt as br,q as xr,qn as Sr,qt as Cr,r as wr,rn as Tr,rr as Er,rt as Dr,s as Or,sn as kr,sr as Ar,st as jr,t as Mr,tn as Nr,tr as Pr,tt as Fr,u as Ir,un as Lr,ur as Rr,ut as zr,v as Br,vn as Vr,vr as Hr,vt as Ur,w as Wr,wn as Gr,wr as Kr,wt as qr,x as Jr,xn as Yr,xr as Xr,xt as Zr,y as Qr,yn as $r,yr as ei,yt as ti,z as ni,zn as ri,zt as ii}from"../chunks/dist-BITld09_.js";import{c as ai,d as oi,i as si,l as ci,r as li}from"../chunks/result-envelope-DVa9d3ew.js";import{l as ui,n as di,t as fi}from"../chunks/env-D4vniJEe.js";import{a as pi}from"../chunks/package-DPDX5zmx.js";import{t as mi}from"../chunks/provider-catalog-GBt-7leL.js";import{C as hi,D as gi,E as _i,h as vi,p as yi,u as bi,w as xi}from"../chunks/tool-policy-DIjXzIow.js";import{_ as Si,b as Ci,g as wi,h as Ti,i as Ei,m as Di,p as Oi,r as ki,t as Ai,v as ji,x as Mi,y as Ni}from"../chunks/contract-Csl322Se.js";import{n as Pi,t as Fi}from"../chunks/mcp-generation-contract-DBF4S7_k.js";import Ii from"crypto";import{Readable as Li}from"stream";import{Buffer as Ri}from"node:buffer";import{fileURLToPath as zi}from"node:url";import{isIP as Bi,isIPv4 as Vi,isIPv6 as Hi}from"node:net";import{createHash as Ui,randomUUID as Wi,timingSafeEqual as Gi}from"node:crypto";var Ki={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},qi,Ji=c((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(qi||={})})),K,Yi,Xi=c((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(K||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Yi||={})}));function Zi(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Qi(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function $i(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new ra(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function ea(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ta(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function na(e,t){return e.toLowerCase()===t.toLowerCase()}var ra,ia=c((()=>{ra=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),aa,oa=c((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(aa||={})})),sa,ca=c((()=>{oa(),sa=class{kind=aa.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function la(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ua,da,fa=c((()=>{oa(),Xi(),ia(),ua=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=la(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=ta(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},da=class{kind=aa.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ua(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ua(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ua(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Yi.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),pa,ma,ha=c((()=>{pa=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new ma,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},ma=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function ga(e){return Ta.setFloat64(0,e),{hi:Ta.getUint32(0),lo:Ta.getUint32(4)}}function _a(e){let{hi:t}=ga(e);return((t&ya)>>20)-xa}function va(e){let{hi:t,lo:n}=ga(e);return(t&ba)===0&&n===0}var ya,ba,xa,Sa,Ca,wa,Ta,Ea=c((()=>{ya=2146435072,ba=1048575,xa=1023,Sa=-1022,Ca=xa,wa=2**-1022,Ta=new DataView(new ArrayBuffer(8))}));function Da(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function Oa(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var ka=c((()=>{})),Aa,ja=c((()=>{Aa=class extends Error{}})),Ma,Na=c((()=>{Ea(),ka(),ja(),Ma=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<wa?this._minNormalLowerBoundaryIndex():_a(e)+(va(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Aa(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Aa(`overflow: ${e} is > maximum lower boundary: ${n}`);return Da(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Sa>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ca>>this._shift}}})),Pa,Fa=c((()=>{Ea(),ka(),ja(),Pa=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=Da(Math.LOG2E,e),this._inverseFactor=Da(Math.LN2,-e)}mapToIndex(e){if(e<=wa)return this._minNormalLowerBoundaryIndex()-1;if(va(e))return(_a(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Aa(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return wa;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Aa(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Sa<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ca+1<<this._scale)-1}}}));function Ia(e){if(e>Ra||e<La)throw new Aa(`expected scale >= ${La} && <= ${Ra}, got: ${e}`);return za[e+10]}var La,Ra,za,Ba=c((()=>{Na(),Fa(),ja(),La=-10,Ra=20,za=Array.from({length:31},(e,t)=>t>10?new Pa(t-10):new Ma(t-10))})),Va,Ha,Ua,Wa,Ga,Ka,qa=c((()=>{oa(),Xi(),u(),ha(),Ba(),ka(),Va=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},Ha=20,Ua=160,Wa=2,Ga=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=Ua,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new pa,u=new pa,d=Ia(Ha)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=u,this._mapping=d,this._maxSize<Wa&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
+ import{A as e,M as t,N as n,O as r,_ as i,c as a,d as o,j as s,k as c,l,n as u,t as d,y as f}from"../chunks/esm-kgyHmk-Q.js";import{t as p}from"../chunks/commander-BB7CDPLs.js";import{A as m,B as h,C as g,E as _,F as v,I as y,N as b,O as x,P as S,R as C,S as w,T,_ as ee,a as E,b as D,d as O,f as k,g as A,h as te,i as j,j as M,k as ne,l as re,m as ie,o as N,p as ae,s as oe,t as se,u as ce,v as le,w as ue,y as de}from"../chunks/logging-BAomjpNJ.js";import{A as fe,D as pe,E as P,S as F,T as I,_ as L,b as R,c as me,d as he,f as ge,g as z,h as _e,i as ve,k as ye,l as B,m as be,o as V,p as xe,r as Se,s as Ce,u as H,v as U,w as W,x as we,y as G}from"../chunks/person-owner-BJgNYLKX.js";import{$ as Te,$n as Ee,$t as De,A as Oe,An as ke,Ar as Ae,At as je,B as Me,Bn as Ne,Bt as Pe,C as Fe,Cn as Ie,Cr as Le,Ct as Re,D as ze,Dn as Be,Dr as Ve,Dt as He,E as Ue,En as We,Er as Ge,Et as Ke,F as qe,Fn as Je,Fr as Ye,Ft as Xe,G as Ze,Gn as Qe,Gt as $e,H as et,Hn as tt,Ht as nt,I as rt,In as it,Ir as at,It as ot,J as st,Jn as ct,Jt as lt,K as ut,Kn as dt,Kt as ft,L as pt,Ln as mt,Lt as ht,Mn as gt,Mt as _t,N as vt,Nn as yt,Nr as bt,Nt as xt,O as St,On as Ct,Ot as wt,P as Tt,Pn as Et,Pr as Dt,Pt as Ot,Q as kt,Qn as At,Qt as jt,R as Mt,Rn as Nt,Rr as Pt,Rt as Ft,S as It,Sn as Lt,Sr as Rt,St as zt,T as Bt,Tn as Vt,Tr as Ht,Tt as Ut,U as Wt,Un as Gt,Ut as Kt,V as qt,Vn as Jt,Vt as Yt,W as Xt,Wn as Zt,Wt as Qt,X as $t,Xn as en,Xt as tn,Y as nn,Yn as rn,Yt as an,Z as on,Zn as sn,Zt as cn,_ as ln,_n as un,_r as dn,_t as fn,a as pn,an as mn,ar as hn,at as gn,b as _n,bn as vn,br as yn,bt as bn,c as xn,cn as Sn,cr as Cn,ct as wn,d as Tn,dn as En,dr as Dn,dt as On,en as kn,er as An,et as jn,f as Mn,fn as Nn,fr as Pn,ft as Fn,g as In,gn as Ln,gr as Rn,h as zn,hn as Bn,hr as Vn,ht as Hn,i as Un,in as Wn,ir as Gn,it as Kn,j as qn,jn as Jn,jr as Yn,jt as Xn,k as Zn,kn as Qn,kr as $n,kt as er,l as tr,ln as nr,lr as rr,lt as ir,m as ar,mn as or,mr as sr,mt as cr,n as lr,nn as ur,nr as dr,nt as fr,o as pr,on as mr,or as hr,ot as gr,p as _r,pn as vr,pr as yr,pt as br,q as xr,qn as Sr,qt as Cr,r as wr,rn as Tr,rr as Er,rt as Dr,s as Or,sn as kr,sr as Ar,st as jr,t as Mr,tn as Nr,tr as Pr,tt as Fr,u as Ir,un as Lr,ur as Rr,ut as zr,v as Br,vn as Vr,vr as Hr,vt as Ur,w as Wr,wn as Gr,wr as Kr,wt as qr,x as Jr,xn as Yr,xr as Xr,xt as Zr,y as Qr,yn as $r,yr as ei,yt as ti,z as ni,zn as ri,zt as ii}from"../chunks/dist-BvNaeC7y.js";import{c as ai,d as oi,i as si,l as ci,r as li}from"../chunks/result-envelope-DVa9d3ew.js";import{l as ui,n as di,t as fi}from"../chunks/env-D4vniJEe.js";import{a as pi}from"../chunks/package-DPDX5zmx.js";import{t as mi}from"../chunks/provider-catalog-CWV2zHhk.js";import{C as hi,D as gi,E as _i,h as vi,p as yi,u as bi,w as xi}from"../chunks/tool-policy-Cv9t1JU0.js";import{_ as Si,b as Ci,g as wi,h as Ti,i as Ei,m as Di,p as Oi,r as ki,t as Ai,v as ji,x as Mi,y as Ni}from"../chunks/contract-DsJpmXt1.js";import{n as Pi,t as Fi}from"../chunks/mcp-generation-contract-Cbt-sm0o.js";import Ii from"crypto";import{Readable as Li}from"stream";import{Buffer as Ri}from"node:buffer";import{fileURLToPath as zi}from"node:url";import{isIP as Bi,isIPv4 as Vi,isIPv6 as Hi}from"node:net";import{createHash as Ui,randomUUID as Wi,timingSafeEqual as Gi}from"node:crypto";var Ki={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},qi,Ji=c((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(qi||={})})),K,Yi,Xi=c((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(K||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Yi||={})}));function Zi(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Qi(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function $i(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new ra(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function ea(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ta(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function na(e,t){return e.toLowerCase()===t.toLowerCase()}var ra,ia=c((()=>{ra=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),aa,oa=c((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(aa||={})})),sa,ca=c((()=>{oa(),sa=class{kind=aa.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function la(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ua,da,fa=c((()=>{oa(),Xi(),ia(),ua=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=la(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=ta(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},da=class{kind=aa.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ua(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ua(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ua(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Yi.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),pa,ma,ha=c((()=>{pa=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new ma,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},ma=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function ga(e){return Ta.setFloat64(0,e),{hi:Ta.getUint32(0),lo:Ta.getUint32(4)}}function _a(e){let{hi:t}=ga(e);return((t&ya)>>20)-xa}function va(e){let{hi:t,lo:n}=ga(e);return(t&ba)===0&&n===0}var ya,ba,xa,Sa,Ca,wa,Ta,Ea=c((()=>{ya=2146435072,ba=1048575,xa=1023,Sa=-1022,Ca=xa,wa=2**-1022,Ta=new DataView(new ArrayBuffer(8))}));function Da(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function Oa(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var ka=c((()=>{})),Aa,ja=c((()=>{Aa=class extends Error{}})),Ma,Na=c((()=>{Ea(),ka(),ja(),Ma=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<wa?this._minNormalLowerBoundaryIndex():_a(e)+(va(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new Aa(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new Aa(`overflow: ${e} is > maximum lower boundary: ${n}`);return Da(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Sa>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ca>>this._shift}}})),Pa,Fa=c((()=>{Ea(),ka(),ja(),Pa=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=Da(Math.LOG2E,e),this._inverseFactor=Da(Math.LN2,-e)}mapToIndex(e){if(e<=wa)return this._minNormalLowerBoundaryIndex()-1;if(va(e))return(_a(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new Aa(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return wa;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new Aa(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Sa<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ca+1<<this._scale)-1}}}));function Ia(e){if(e>Ra||e<La)throw new Aa(`expected scale >= ${La} && <= ${Ra}, got: ${e}`);return za[e+10]}var La,Ra,za,Ba=c((()=>{Na(),Fa(),ja(),La=-10,Ra=20,za=Array.from({length:31},(e,t)=>t>10?new Pa(t-10):new Ma(t-10))})),Va,Ha,Ua,Wa,Ga,Ka,qa=c((()=>{oa(),Xi(),u(),ha(),Ba(),ka(),Va=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},Ha=20,Ua=160,Wa=2,Ga=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=Ua,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new pa,u=new pa,d=Ia(Ha)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=u,this._mapping=d,this._maxSize<Wa&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
3
3
  changing to the minimum size of: ${Wa}`),this._maxSize=Wa)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=Oa(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=Ia(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Va.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Va.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Va(0,-1);let r=t-n;return new Va(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ka=class{kind=aa.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Ga(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Yi.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===K.GAUGE||e.type===K.UP_DOWN_COUNTER||e.type===K.OBSERVABLE_GAUGE||e.type===K.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}}})),Ja,Ya,Xa=c((()=>{oa(),ue(),Xi(),Ja=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=b(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Ya=class{kind=aa.LAST_VALUE;createAccumulation(e){return new Ja(e)}merge(e,t){let n=m(t.sampleTime)>=m(e.sampleTime)?t:e;return new Ja(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=m(t.sampleTime)>=m(e.sampleTime)?t:e;return new Ja(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Yi.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}}})),Za,Qa,$a=c((()=>{oa(),Xi(),Za=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Qa=class{kind=aa.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new Za(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new Za(t.startTime,this.monotonic,r,t.reset):new Za(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new Za(t.startTime,this.monotonic,r,!0):new Za(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Yi.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),eo=c((()=>{ca(),fa(),qa(),Xa(),$a()})),to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo=c((()=>{u(),eo(),Xi(),to=class e{static DEFAULT_INSTANCE=new sa;createAggregator(t){return e.DEFAULT_INSTANCE}},no=class e{static MONOTONIC_INSTANCE=new Qa(!0);static NON_MONOTONIC_INSTANCE=new Qa(!1);createAggregator(t){switch(t.type){case K.COUNTER:case K.OBSERVABLE_COUNTER:case K.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},ro=class e{static DEFAULT_INSTANCE=new Ya;createAggregator(t){return e.DEFAULT_INSTANCE}},io=class e{static DEFAULT_INSTANCE=new da([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}},ao=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new da(this._boundaries,this._recordMinMax)}},oo=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ka(this._maxSize,this._recordMinMax)}},so=class{_resolve(e){switch(e.type){case K.COUNTER:case K.UP_DOWN_COUNTER:case K.OBSERVABLE_COUNTER:case K.OBSERVABLE_UP_DOWN_COUNTER:return lo;case K.GAUGE:case K.OBSERVABLE_GAUGE:return uo;case K.HISTOGRAM:return e.advice.explicitBucketBoundaries?new ao(e.advice.explicitBucketBoundaries):fo}return l.warn(`Unable to recognize instrument type: ${e.type}`),co}createAggregator(e){return this._resolve(e).createAggregator(e)}},co=new to,lo=new no,uo=new ro,fo=new io,new oo,po=new so}));function ho(e){switch(e.type){case go.DEFAULT:return po;case go.DROP:return co;case go.SUM:return lo;case go.LAST_VALUE:return uo;case go.EXPONENTIAL_HISTOGRAM:{let t=e;return new oo(t.options?.maxSize,t.options?.recordMinMax)}case go.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?fo:new ao(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var go,_o=c((()=>{mo(),(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(go||={})})),vo,yo,bo=c((()=>{Ji(),_o(),vo=e=>({type:go.DEFAULT}),yo=e=>qi.CUMULATIVE})),xo,So,Co,wo,To,Eo=c((()=>{xo=`otel.component.name`,So=`otel.component.type`,Co=`periodic_metric_reader`,wo=`otel.sdk.metric_reader.collection.duration`,To=`error.type`})),Do,Oo,ko=c((()=>{Eo(),Do=new Map,Oo=class{collectionDuration;standardAttrs;constructor(e,t){let n=Do.get(e)??0;Do.set(e,n+1),this.standardAttrs={[So]:e,[xo]:`${e}/${n}`},this.collectionDuration=t.createHistogram(wo,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[To]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}}})),Ao,jo=c((()=>{Ao=`2.11.0`})),Mo,No=c((()=>{u(),ia(),bo(),ko(),jo(),ue(),Mo=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??vo,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??yo,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Oo(this._otelComponentType,f())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,Ao);this._selfObsMetrics=new Oo(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=x(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=x(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=M(ne(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){l.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await $i(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){l.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await $i(this.onForceFlush(),e.timeoutMillis)}}}));function Po(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}var Fo=c((()=>{})),Io,Lo=c((()=>{u(),ue(),No(),ia(),Xi(),Fo(),Eo(),Io=class extends Mo{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:i,maxExportBatchSize:a}=e,{exportTimeoutMillis:o=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:Co,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...i};switch(e){case K.COUNTER:return t.counter??t.default;case K.GAUGE:return t.gauge??t.default;case K.HISTOGRAM:return t.histogram??t.default;case K.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case K.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case K.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case K.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(o<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<o){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);l.info(`Timeout of ${o} exceeds the interval of ${n}. Clamping timeout to interval duration.`),o=n}this._exportInterval=n,this._exportTimeout=o,this._exporter=t,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(e){C(e)}}async _doRun(){if(this._ongoingExportPromise){l.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&l.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){l.debug(`Error while resolving async portion of resource: `,e),C(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Po(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await $i(T._export(this._exporter,e),this._exportTimeout);t.code!==_.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof ra){l.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}l.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){l.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}})),Ro,zo=c((()=>{ue(),Ro=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(e){this._aggregationTemporality=e}export(e,t){if(this._shutdown){setTimeout(()=>t({code:_.FAILED}),0);return}this._metrics.push(e),setTimeout(()=>t({code:_.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(e){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}})),Bo,Vo=c((()=>{ue(),bo(),Bo=class e{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??yo}export(t,n){if(this._shutdown){n({code:_.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:_.SUCCESS})}}})),Ho,Uo=c((()=>{Ho=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}}));function Wo(e,t,n){return qo(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??i.DOUBLE,advice:n?.advice??{}}}function Go(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Ko(e,t){return na(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}function qo(e){return Jo.test(e)}var Jo,Yo=c((()=>{u(),ia(),Jo=/^[a-z][a-z0-9_.\-/]{0,254}$/i}));function Xo(e){return e instanceof ns}var Zo,Qo,$o,es,ts,ns,rs,is,as,os=c((()=>{u(),Zo=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===i.INT&&!Number.isInteger(e)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},Qo=class extends Zo{add(e,t,n){this._record(e,t,n)}},$o=class extends Zo{add(e,t,n){if(e<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},es=class extends Zo{record(e,t,n){this._record(e,t,n)}},ts=class extends Zo{record(e,t,n){if(e<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},ns=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},rs=class extends ns{},is=class extends ns{},as=class extends ns{}})),ss,cs=c((()=>{Yo(),os(),Xi(),ss=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let n=Wo(e,K.GAUGE,t),r=this._meterSharedState.registerMetricStorage(n);return new es(r,n)}createHistogram(e,t){let n=Wo(e,K.HISTOGRAM,t),r=this._meterSharedState.registerMetricStorage(n);return new ts(r,n)}createCounter(e,t){let n=Wo(e,K.COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new $o(r,n)}createUpDownCounter(e,t){let n=Wo(e,K.UP_DOWN_COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new Qo(r,n)}createObservableGauge(e,t){let n=Wo(e,K.OBSERVABLE_GAUGE,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new is(n,r,this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=Wo(e,K.OBSERVABLE_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new rs(n,r,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=Wo(e,K.OBSERVABLE_UP_DOWN_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new as(n,r,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),ls,us=c((()=>{Yo(),ls=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=Wo(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),ds,fs,ps=c((()=>{ia(),ds=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},fs=class extends ds{constructor(){super(Zi)}}})),ms,hs=c((()=>{ue(),ia(),ps(),ms=class{_activeCollectionStorage=new fs;_cumulativeMemoStorage=new fs;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Zi(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=b(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new fs,e}}}));function gs(e){return Array.from(e.entries())}var _s,vs=c((()=>{Ji(),ps(),_s=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===qi.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=gs(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new fs,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}}})),ys,bs=c((()=>{us(),hs(),vs(),ps(),ys=class extends ls{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,i){super(e),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new ms(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new _s(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new fs;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}}));function xs(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Ss(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Cs(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function ws(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Ts(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
4
4
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
5
5
  \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function Es(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Ts(e,t):ws(e,t):Cs(e,t):Ss(e,t)}var Ds=c((()=>{})),Os,ks=c((()=>{Yo(),u(),Ds(),Os=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();Ko(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),l.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventurevc/mcp-server",
3
- "version": "0.8.159",
3
+ "version": "0.8.161",
4
4
  "private": false,
5
5
  "description": "MCP server that gives AI assistants access to aVenture research data on companies, people, funding, and news.",
6
6
  "homepage": "https://docs.aventure.vc/mcp",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "aventurePublicApi": {
30
30
  "repository": "aventurevc/aventure-docs",
31
- "commit": "3d2861c2db92b9609079b6a45915a58a659b52e4",
31
+ "commit": "fb6a8c157ad0c7293aaf51e3cb70dedcec4b4e88",
32
32
  "openapiPath": "openapi/openapi.json",
33
- "openapiSha256": "f4ed6ca63b1f63209dcc76aeb5136d33b4a97b82b2af770285865114f1469b5f"
33
+ "openapiSha256": "b2eb6eb008ae7d96f12f4992aff0f457ef7986b8ddac3a696dd98148d9453c45"
34
34
  },
35
35
  "scripts": {}
36
36
  }
@@ -1,22 +0,0 @@
1
- import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{c as p,d as m,i as h,t as g}from"./result-envelope-DVa9d3ew.js";import{a as _}from"./package-DPDX5zmx.js";import{a as v,c as ee,i as te,o as ne,s as re}from"./tool-policy-DIjXzIow.js";import{C as ie,S as ae,T as oe,_ as se,a as ce,b as y,c as le,d as ue,f as de,g as fe,h as pe,i as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De}from"./detail-D09DdW-w.js";import{a as Oe,n as b,r as x,t as ke}from"./text-field-BoNdbrtA.js";import{a as Ae,o as je}from"./cli-help-policy-eA1rRqwV.js";import{Buffer as Me}from"node:buffer";var S=o([`HIGH`,`MEDIUM`,`LOW`]),Ne=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),d()]),Pe=f({excerpt:d(),sourceId:d(),sourceType:Ne,sourceVersion:d().nullish()}),Fe=f({instruction:d(),operationId:d(),stepKey:d()}),Ie=f({body:d(),expectation:d(),method:i(d()),override:d(),reject:i(d()),typeCatalog:d()}),Le=f({cliCommand:d(),mcpTool:d().nullish(),step:Fe,writeGuidance:Ie.nullish()}),Re=n([o([`ENTITY`,`TEXT`]),d()]),ze=f({description:d(),key:d(),type:Re}),Be=f({catalogRevision:s(),gateId:i(d()),input:i(ze),step:i(Le),taskKey:d()}),C=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Ve=f({candidate:i(Pe),operationId:d().nullish(),outcome:C,probability:u().nullish(),taskKey:d().nullish(),taskPlan:Be.nullish()}),He=f({answer:d(),citation:i(Pe),confidence:S,resolution:Ve.nullish()});function w(e,t,n=t.inputName){if(t.in===`body`)return n;let r=et.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?$e(Xe(n!==`id`&&n!==`slug`?n:`${Ke(e.path)}${Ye(n)}`),t):r.inputName}function Ue(e,t,n=Je(e)){return We(qe(e,t),new Set(n))}function We(e,t){if(!t.has(e))return e;let n=`body${Ye(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function Ge(e,t,n){return`${e}[${t}].${n}`}function Ke(e){return tt.find(([,t])=>t.test(e))?.[0]??`record`}function qe(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Ze(t);return $e(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?Xe(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function Je(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>w(e,t)))}function Ye(e){return e.replace(/^./u,e=>e.toUpperCase())}function Xe(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function Ze(e){let t=Xe(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Qe(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Qe(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function $e(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var et=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],tt=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function nt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>rt(t,w(e,t))),r=(t?.parameter??[]).map(t=>rt(t,Ue(e,t)));return{selector:n.filter(e=>e.location===`path`||it(e)),pagination:n.filter(at),filter:[...n.filter(ot),...r.filter(ot)],body:r.filter(e=>!ot(e))}}function rt(e,t){let{in:n,inputName:r,...i}=e;return{...i,name:e.in===`body`?t:e.name,flag:te(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function it(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function at(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function ot(e){return e.location!==`path`&&!it(e)&&!at(e)}function st(e,t){let n=e.requestBody?.[0],r={operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:ct(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:nt(e)}:{...r,optionalInput:lt(e)}}function ct(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function lt(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}var ut=160;function dt(e){return!Array.isArray(e)||e.length===0||!e.every(ft)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `)}): ${e.description.length<=ut?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
2
- `)}\n`}function ft(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function pt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(mt);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.replace(/[.[].*$/su,``)))];return{tool:re(e.intent),operationId:e.operationId,...n===void 0?{}:{pathParams:n},...r===void 0?{}:{query:r},...e.requestBody===void 0?{}:{body:Object.fromEntries(i.map(e=>[e,`<${e}>`]))}}}function mt(e){return[e.name,`<${e.name}>`]}function ht(e){let t=T(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function T(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var E=2,gt=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function D(e,t){let n=A(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&D(e,`person`),yt(e,_t(n),n),yt(e,vt(n),n))}function _t(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=E&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>E&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function vt(e){return e===`person`?`people`:e.length>=E&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function yt(e,t,n){t!==void 0&&t!==n&&t.length>=E&&/^[a-z]+$/u.test(t)&&e.add(t)}function O(e){let t=new Set(k(e)),n=Array.from(t);for(let e of n)D(t,e);return t}function bt(e){return k(e).map(O)}function xt(e,t){if(e.length===0)return!1;let n=O(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function k(e){return A(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!gt.has(e))}function A(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}var St=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,Ct=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,wt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Tt=250,Et=40,Dt=100;function Ot(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(Ct,()=>(n.add(`uuid`),` `)).replace(St,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&wt.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=wt.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function kt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function At(e,t){let n=new Set;for(let r of e){let e=new Set;D(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function jt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(k(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>kt(t,e,n.path))&&(i+=Tt,r.has(t)&&(i+=Et));if(i===0)return 0;let a=new Set(k(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return D(t,e),[...t].some(e=>a.has(e))}))&&(i+=Dt),i}var Mt=5,Nt=.5,Pt=15,Ft=30,It=2;function Lt(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=Ot(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=At(i.urlPathWord,r.map(({fields:e})=>e)),o=A(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=O(o),c=bt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Vt(o,s,c,t))+jt(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function Rt(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function zt(e,t){let n=Lt(e.q?.trim()??``,t.filter(t=>Bt(e,t)),Rt),r=(n[0]?.score??0)*Nt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Mt:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>st(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function Bt(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function Vt(e,t,n,r){let i=Wt(r),a=Ht(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=Ut(e,i);let s=new Set(i.flatMap(k));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;D(n,e),[...n].some(e=>t.has(e))&&(o+=Pt)}xt(n,a)&&(o+=200),r.parameterName.some(t=>A(t)===e)&&(o+=Ft);let c=new Set(r.parameterDescription.flatMap(k));for(let e of t)c.has(e)&&(o+=It);return o+=Kt(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Gt(e,t,r.description),o}function Ht(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(A).filter(e=>e.length>0)}function Ut(e,t){let n=k(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Wt(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,T(e.description).useFor||e.description].map(A).filter(e=>e.length>0))]}function Gt(e,t,n){let r=A(T(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(k(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Kt(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>qt(e,t))&&(n+=i?40:10);return n}function qt(e,t){let n=k(t);return n.length>0&&n.every(t=>e.has(t))}function Jt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Yt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return h(`Provide q to resolve a request to one operation.`);let a=n.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(a===void 0)return h(`This build ships no help resolve operation.`);let o=await r(a,{body:{question:i,resolve:!0,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`},includePrivate:!1}});if(!o.ok)return{...o,data:null};let s=He.safeParse(Jt(o));if(!s.success||s.data.resolution==null)return h(`The help resolve operation returned no resolution.`);let{answer:c,resolution:l}=s.data,u=e=>t.find(t=>t.operationId===e),d=u(l.operationId),f=l.taskPlan??void 0,m=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),g=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...m.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return p(g.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${g.join(`, `)}.`,{outcome:l.outcome,probability:l.probability,answer:c,candidate:l.candidate.map(({sourceId:e})=>e),...d===void 0?{}:{operation:{operationId:d.operationId,apiRoute:`${d.method} ${d.path}`,...ht(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:pt(d)}},...l.taskKey==null?{}:{taskKey:l.taskKey},...f===void 0?{}:{taskPlan:{catalogRevision:f.catalogRevision,input:f.input,...f.gateId.length===0?{}:{gateId:f.gateId},step:m.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:pt(e)})}}},{warnings:g.map(e=>n.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}var Xt=f({detail:d(),field:d().nullish(),scope:o([`entity`,`person`,`news`])}),Zt=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),d()]),j=f({modeRequested:Zt,modeUsed:Zt}),Qt=f({answerUnavailable:l(),entity:j,news:j,person:j,rejection:i(Xt),unavailable:i(o([`entity`,`person`,`news`]))}),$t=f({acceleratorParticipation:i(ye),detail:i(ue)}),M=f({core:y,enrichment:Ee,fundraiseRound:i(fe),research:$t,semanticMatch:ce.nullish()}),en=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),tn=f({compositeScore:u().nullish(),cosineScore:u().nullish(),curatedAsOf:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),curatedRelationshipType:d().nullish(),curatedSource:d().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:u().nullish(),origin:en,rank:s(),sharedSectionCount:s().nullish()}),nn=f({entity:M,similarity:tn}),rn=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),an=f({author:d().nullish(),createdAt:r({offset:!0}),externalId:d().nullish(),id:t(),isCurrent:l(),lastFetchedAt:r({offset:!0}).nullish(),mentionedEntityId:i(t()),mentionedPersonId:i(t()),owner:c,publishedAt:r({offset:!0}).nullish(),summary:d().nullish(),summaryGeneratedAt:r({offset:!0}).nullish(),title:d().nullish(),topic:d().nullish(),type:rn,updatedAt:r({offset:!0}),url:d()}),on=o([`low`,`medium`,`high`]),sn=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:l().nullish(),dataConfidence:on.nullish(),dateValue:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),numericValue:u().nullish(),referenceValue:d().nullish(),source:d().nullish(),textValue:d().nullish(),updatedAt:r({offset:!0}).nullish(),valueType:de}),cn=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fact:sn,id:d()}),ln=f({fundraiseInvestorJoin:l(),fundraiseTransaction:l(),operatingStatus:l(),relationship:l()}),un=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),dn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),fn=f({acquiredEntity:y,acquirerEntity:y,amount:u().int().nullish(),announcedAt:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),asOf:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),completedAt:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),createdAt:r({offset:!0}).nullish(),currency:d().nullish(),dataConfidence:De.nullish(),evidence:ln,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),isCurrent:l().nullish(),publicSource:pe.nullish(),relationshipId:s(),status:un,transactionStatus:dn.nullish(),updatedAt:r({offset:!0}).nullish()}),pn=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),mn=f({amountInvested:u().nullish(),createdAt:r({offset:!0}),financialInstrumentType:pn.nullish(),id:t(),investor:c,leadInvestor:l(),transactionId:t(),updatedAt:r({offset:!0})}),hn=f({entity:Se,investorAttribution:i(se),round:i(we),roundCount:s()}),gn=f({core:y,similarity:tn,urlLink:i(ae)}),_n=f({compliance:Ce.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:l().nullish(),isPrimary:l().nullish(),language:d().nullish(),owner:c,text:d(),textName:d().nullish(),textType:d(),updatedAt:r({offset:!0}).nullish()}),vn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),yn=o([`fundraiseRound`,`researchDetail`]),bn=o([`preMoney`,`postMoney`,`reported`]),xn=f({amountRaised:u().int().nullish(),asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),confidence:on,currency:d(),declaredBasis:bn,derivation:vn,detailId:s().nullish(),label:d().nullish(),source:yn,sourceRef:d(),valuationPostMoney:u().int().nullish(),valuationPreMoney:u().int().nullish()}),Sn=f({createdAt:r({offset:!0}).nullish(),description:d().nullish(),forkCount:s(),githubId:u().int(),homepageUrl:d().nullish(),id:u().int(),isArchived:l(),isFork:l(),language:d().nullish(),license:d().nullish(),name:d(),ownerLogin:d(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(d()),updatedAt:r({offset:!0}).nullish(),url:d()}),N=f({empty:l().optional(),sorted:l().optional(),unsorted:l().optional()}),P=f({offset:u().int().optional(),paged:l().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:N.optional(),unpaged:l().optional()}),Cn=f({investorAttribution:i(se),person:be,round:i(we),roundCount:s()}),wn=o([`precomputed`,`live`]),Tn=f({compositeScore:u().nullish(),cosineScore:u().nullish(),matchedSectionWeight:u().nullish(),origin:wn,rank:s(),sharedSectionCount:s().nullish()}),En=f({currentRole:xe.nullish(),person:me,similarity:Tn}),Dn=o([`by`,`about`]),On=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),kn=f({canonicalUrl:d().nullish(),contentId:d(),contentType:On,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:Dn.nullish(),sourceDomain:d().nullish(),sourceName:d().nullish(),summary:d().nullish(),title:d(),topic:d().nullish(),updatedAt:r({offset:!0}).nullish(),url:d().nullish(),year:s().nullish()});f({content:i(an).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(n([oe,Te])).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(cn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(y).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(fn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Se).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(mn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(fe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(hn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(M).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(xe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ge).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ue).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(he).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(nn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(gn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(_n).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ae).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(xn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Sn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(le).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(me).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(be).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ve).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Cn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(En).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(kn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var An=f({content:i(M),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),jn=f({content:i(le),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),Mn=f({content:i(me),number:s(),size:s(),totalElements:u().int(),totalPages:s()});f({content:i(_e).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var Nn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),d()]),Pn=f({entityId:t(),source:Nn,sourceId:d()}),Fn=f({citation:i(Pn),text:d(),topic:d().nullish()}),In=f({citation:i(Pn),confidence:S,description:d().nullish(),heading:d().nullish(),paragraph:i(Fn),relatedQuery:i(d()),shareable:l(),text:d(),title:d().nullish()}),Ln=f({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Rn=f({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),F=f({max:u().nullish(),min:u().nullish()}),I=f({max:s().nullish(),min:s().nullish()}),zn=f({averageAmountInvestedUsdRange:i(F).optional(),largestAmountInvestedUsdRange:i(F).optional(),smallestAmountInvestedUsdRange:i(F).optional(),totalAmountInvestedUsdRange:i(F).optional(),totalInvestmentRange:i(I).optional()}),Bn=f({amountInvestedRange:i(F).optional(),amountRaisedRange:i(F).optional(),dateAnnouncedRange:Rn.nullish(),investedCompanyName:i(d()).optional(),investedCountry:i(d()).optional(),investedIndustry:i(d()).optional(),investedRound:i(d()).optional(),investorActivity:zn.optional(),investorName:i(d()).optional(),lastRoundYearRange:i(I).optional(),rankByInvestmentActivity:l().nullish(),round:i(d()).optional(),totalRaisedRange:i(F).optional(),valuationRange:i(F).optional()}),Vn=o([`NONE`,`COMPANY_LISTING_READY`]),Hn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Un=o([`hostPath`,`domain`]),Wn=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(I).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Bn.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Ln.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Hn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Vn.optional(),rankByProminence:l().nullish(),semanticQuery:d().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Un.nullish(),urlType:ie.nullish(),yearFoundedRange:i(I).optional()}),Gn=o([`discovery`,`profile`,`peer`,`comparison`]),Kn=o([`keyword`,`semantic`]),qn=n([o([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),d()]),Jn=f({descending:l(),field:qn,sortKey:d().nullish()}),Yn=f({order:i(Jn),relevance:Kn.nullish()}),Xn=f({confidence:S,execution:j,fallbackUsed:l(),filter:Wn,intent:Gn,interpretation:d(),sort:Yn,subjectEntityName:i(d()),unsupported:d().nullish()}),L=f({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:d().nullish(),status:d().nullish()}),Zn=f({fundManagerRelationshipSource:L.nullish(),fundraiseTransaction:fe,fundraiseTransactionSource:L.nullish(),investorJoinSource:L.nullish()}),Qn=f({evidence:Zn,investor:c,semanticMatch:ce.nullish()}),$n=f({entityId:t(),matchedOffering:y.nullish(),probability:u(),webUrl:i(d())}),er=f({entityId:t(),label:d(),publishedAt:r({offset:!0}).nullish(),score:u(),source:Nn,sourceId:d(),text:d(),url:d().nullish()}),tr=f({answer:In.nullish(),interpretation:Xn,investment:i(Qn),judgment:i($n),passage:i(er),peer:i(nn),pendingWebQuery:i(d()),result:An,searchRequestId:t().nullish(),subject:i(M)}),nr=o([`auto-match`,`needs-review`,`approved`,`rejected`]),rr=f({createdAt:r({offset:!0}),entityId:t(),href:d().nullish(),internal:l(),matchStatus:nr.nullish(),mention:d().nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),ir=f({entity:i(rr),newsId:s()}),ar=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(I).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Bn.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Ln.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Hn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Vn.optional(),rankByProminence:l().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Un.nullish(),urlType:ie.nullish(),yearFoundedRange:i(I).optional()}),or=f({amountInvestedRange:i(F).nullish(),amountRaisedRange:i(F).nullish(),entityName:i(d()).nullish(),investedCompany:i(d()).nullish(),personTitle:i(d()).nullish(),round:i(d()).nullish(),totalInvestmentCount:i(I).nullish(),typeRecord:i(a).nullish()}),sr=f({arrayFilter:or.optional(),entityFilter:ar.optional(),entityId:t().nullish(),entitySlug:d().nullish(),firstName:d().nullish(),includeAddress:l().nullish(),includeUrl:l().nullish(),investorActivity:zn.optional(),isCurrent:l().nullish(),lastName:d().nullish(),letter:d().nullish(),personId:i(t()).max(200).optional(),personName:i(d()).optional(),role:d().nullish(),search:d().nullish(),semanticQuery:d().nullish(),status:d().nullish()}),cr=f({descending:l(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:d().nullish()}),lr=f({order:i(cr),relevance:Kn.nullish()}),ur=f({confidence:S,execution:j,fallbackUsed:l(),filter:sr,interpretation:d(),sort:lr,unsupported:d().nullish()}),dr=f({interpretation:ur,investment:i(Qn),result:Mn,searchRequestId:t().nullish()}),fr=f({label:d(),query:d()}),pr=f({key:d(),option:i(fr),prompt:d()}),mr=f({entity:tr,entityDetail:i(Se),news:jn,newsEntityMention:i(ir),person:dr,personDetail:i(be),provenance:Qt,qualifier:pr.nullish()});function R(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>hr(e)),...n.flatMap(e=>e.parameter.map(t=>hr(t,n.length>1?e.contentType:void 0))),...gr(n)],i=[t,...e.cliPath].join(` `),a=ne(e.intent),o=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:v(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ee(e.path)?null:re(e.intent),body:{hasBody:o!==void 0,kind:o?.kind??null,...o!==void 0&&n.length>1?{contentType:o.contentType}:{},required:o?.required??!1,description:o?.description??``,requiredPath:o?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function hr(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function gr(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function z(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var _r=[`-id`,`-slug`,`-url`],vr=[`--id`,`--slug`,`--url`],yr=`/v1/lookup`,br=`--from-file "<path>"`;function xr(e,t,n=_().bin[0]){let r=R(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:Tr(i,r)}function Sr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:R([r],n);return i&&wr(i,Or(i,!1))}function Cr(e,t,n,r=_().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return Sr(o.operationId,t,r)}function wr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function Tr(e,t){return[`example: ${wr(e,Or(e))}`,...Er(e,t)]}function Er(e,t){return z(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${B(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===yr),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${B(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Dr=/(?:^|\.)text$/u;function Or(e,t=!0){let n=z(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Dr.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:kr(e)).map(B);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,br]:i}function kr(e){let t=new Set;D(t,e.resource);for(let n of _r)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of vr){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function B(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Ar=`aventure`;function jr(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Ar} ${n.join(` `)}`}function Mr(e,t,n=e){return Sr(e,t,`aventure`)??n}function Nr(e,t){let n=He.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return Pr(r,o,t);let s=r.trimEnd().split(`
3
- `),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Ne.options[0].enum.OPERATION)return[];let r=jr(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function Pr(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Ir(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:Lr(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Mr(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...zr(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...zr(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Fr(e,t){let n=Be.safeParse(e);return n.success?[Ir(n.data),...Lr(n.data,t)]:null}var Ir=({taskKey:e,catalogRevision:t})=>`Run catalog task ${e} (catalog revision ${t}).`;function Lr(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey}: ${Mr(n.operationId,t,r)}`,` ${n.instruction}`,...Rr(e,a,i)]),...e.gateId.length===0?[]:[``,`Completion gates: ${e.gateId.join(`, `)}`]]}function Rr(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function zr(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:jr(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var V=120,H=30,Br=8,U=10,Vr=2,Hr=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Ur=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Wr=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Gr(e,t,n){if(typeof t==`string`)return Q(t);let r=dt(t);if(r!==null)return Q(r);let i=ni(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=Oe(a?.detailField,i.response),c={...i,response:o},l=Nr(c.response,e)??Fr(c.response,e);if(l!==null)return Q(l.join(`
4
- `),!0);let u=Kr(c.endpoint,c.response);if(u!==null)return Q([...u,...s].join(`
5
- `),!0,s.length>0);let d=c.summary??n??c.operationId??`OpenAPI call succeeded`,f=Xr(c);return Q([...[d,`${c.method} ${c.endpoint}`,...f].filter(Boolean),...s].join(`
6
- `),!0,s.length>0)}function Kr(e,t){if(t===void 0||!Y(t)||!(`entity`in t&&`person`in t&&`news`in t))return null;let n=mr.safeParse(t);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?qr(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>x(`${e} rejected: ${t}`)),[`entities:`,...W(r.result,e)].join(`
7
- `),[`people:`,...W(i.result,e)].join(`
8
- `),[`news:`,...W(a,e)].join(`
9
- `)]}function qr(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${x(e)}`).join(`
10
- `)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>x(` - ${e}:${t} entity=${n}`)).join(`
11
- `)}`;return[`answer:\n ${b(e.text).replaceAll(`
12
- `,`
13
- `)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function Jr(e){let t=ni(e)?.response,n=Y(t)?t.interpretation:void 0;if(!Y(n))return null;let r=j.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=K(n.filter),{unsupported:s,fallbackUsed:c}=n;return Q([`strategy: requested=${i} used=${a}`,...Y(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${Yr(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
14
- `),!0)}var Yr=e=>X(e)?x(e):Array.isArray(e)&&e.every(X)?e.map(e=>x(e)).join(`, `):JSON.stringify(e);function Xr(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a,location:o}=e;if(t===void 0)return o!==void 0&&a!==void 0?[`status=${a} redirect=${o}`]:a===void 0?[]:[`status=${a} no response body`];let s=a===void 0||n===`GET`?``:`status=${a}`,c=Y(t)&&!J(t)?ii(t):null,l=c===null?void 0:Y(c.context.interpretation)?K(c.context):c.context,u=l!==void 0&&Y(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Y)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...J(t)?W(t,r,i):c===null?oi(t)?$r(t.filter,t.meta):si(t)?$r([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):li(t)?ei(t):G(t,``):[...W(c.page,r,i),...Object.keys(p).length===0?[]:G(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(Zr(t)))]].filter(Boolean)}function W(e,t,n){let r=ti(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${Z(n)}`,...Zr(e.content)].filter(Boolean)}function Zr(e){let t=e.filter(Y);if(t.length===0)return e.length===0?[`(empty)`]:ri(e,``);let n=Qr(t);if(n.length===0)return ri(e.slice(0,H),``);let r=t.slice(0,H).map(e=>{let t=q(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>di(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>H&&s.push(`... ${t.length-H} more rows`),s}function Qr(e){let t=new Set(e.flatMap(e=>Object.keys(q(e)))),n=Hr.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,Br-n.length);return[...n,...r].slice(0,Br)}function $r(e,t){let n=t!==void 0&&Y(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,U).forEach(e=>{i.push(` ${ui(t.filterKey)} ${Z(e.value)}`)}),e>U&&i.push(` ... ${e-U} more shown`)}return i}function ei(e){let t=ui(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,U).map(e=>`${t} ${Z(e)}`),e.result.length>U?`... ${e.result.length-U} more matches`:``].filter(Boolean)}function ti(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!Ur.has(e)&&t.length>0).map(([e,t])=>`${ui(e)} ${Z(t)}`)}function ni(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`method`),n=Reflect.get(e,`endpoint`);if(typeof t!=`string`||typeof n!=`string`)return null;let r=Reflect.get(e,`operationId`),i=Reflect.get(e,`summary`),a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`location`),s=Reflect.get(e,`nextCursor`),c=Reflect.get(e,`response`),l=c===void 0?void 0:m.safeParse(c);return l!==void 0&&!l.success?null:{method:t,endpoint:n,httpStatus:typeof a==`number`?a:void 0,location:typeof o==`string`?o:void 0,operationId:typeof r==`string`?r:void 0,summary:typeof i==`string`?i:void 0,nextCursor:typeof s==`string`&&s.length>0?s:void 0,response:l?.data}}function G(e,t,n){if(e===void 0)return[];if(X(e))return[`${t}${ke(e,n)}`];if(Array.isArray(e))return ri(e,t,n);let r=[];for(let[n,i]of Object.entries(e))if(i!==void 0){if(X(i)){r.push(`${t}${n}: ${ke(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of G(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function ri(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(X(i)){r.push(`${t}- ${ke(i,n)}`);continue}r.push(`${t}-`);for(let e of G(i,`${t} `))r.push(e)}return r}function K(e){if(e===void 0||X(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=K(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=K(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...Wr.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!Wr.includes(e))])}function q(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:x(e,t)}:n>Vr?{}:Array.isArray(e)?e[0]===void 0?{}:q(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return X(r)?[[i,x(r,i)]]:Object.entries(q(r,i,n+1))}))}var J=e=>Y(e)&&Array.isArray(e.content);function ii(e){let[t,...n]=Object.entries(e).filter(e=>J(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function ai(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var oi=e=>Y(e)&&ci(e.filter),si=e=>Y(e)&&ci(e.arrayFilterEntry)&&ci(e.rangeFilterEntry),ci=e=>Array.isArray(e)&&e.every(ai),li=e=>Y(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>typeof e!=`object`||!e,ui=e=>`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,Z=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,di=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,Q=(e,t=!1,n=!1,r=1)=>{let i=b(e),a=t||i.endsWith(`
15
- `),o=i.endsWith(`
16
- `)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
17
- `),c=Me.byteLength(`${s.join(`
18
- `)}\n`,`utf8`);if(s.length<=V&&c<=5e4)return`${s.join(`
19
- `)}${a?`
20
- `:``}`;let l=n?Math.min(Math.max(1,r),118):0,u=l>0?s.slice(-l):[],d=u.length===0?s:s.slice(0,-u.length),f=[s.length>V?`${V} physical lines`:``,c>5e4?`${g} UTF-8 bytes`:``].filter(Boolean).join(` and `),p=e=>b(`... output truncated: ${e} more lines omitted to stay within ${f}; recover omitted response content with narrower server-side filters, the relevant sub-resource operation (aventure_help names it), or responseFormat json.`),m=(e,t)=>[...e,...u,t].join(`
21
- `),h=V-u.length-1,_=d.slice(0,h),v=p(s.length-_.length-u.length);for(;Me.byteLength(`${m(_,v)}\n`,`utf8`)>g;){if(_.length>0)_=_.slice(0,-1);else if(u.length>0)u=u.slice(1);else break;v=p(s.length-_.length-u.length)}return`${m(_,v)}${a?`
22
- `:``}`},fi=/\{([^}]+)\}/gu;function pi(e,t){let n=t.filter(e=>e.method===`GET`),r=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),i=t.find(t=>t.operationId===e.operationId),a=e.ok&&i!==void 0&&ne(i.intent),o=[...a&&e.endpoint!==void 0?hi(e.endpoint.split(`?`)[0]??``,n,!1).map(e=>`${e} --data --to-file <path>`):[],...e.references.filter(e=>!r(e)).flatMap(mi).flatMap(e=>hi(e.pathname,n,!0)),...e.references.filter(r).flatMap(mi).flatMap(e=>gi(e,n))];return o.length===0?{write:a}:{exactRecovery:`Read the full result ${o.join(`; `)}.`,write:a}}function mi(e){return URL.canParse(e)?[new URL(e)]:[]}function hi(e,t,n){return t.flatMap(t=>{let r=[...t.path.matchAll(fi)].map(([,e])=>e),i=RegExp(`^${t.path.replace(fi,`([^/]+)`)}$`,`u`),a=n&&r.length===0?null:i.exec(e);if(a===null)return[];let o=r.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[$(r),a[n+1]??``]});return[`${_i(t)}, ${vi(t,o)}`]})}function gi(e,t){let n=t.find(t=>t.path===e.pathname);return n===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${n.path}/`))return[];let r=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),i=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(r===void 0||i===void 0)return[];let a=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[$(t),yi(n)]}),o=[$(r),`<n>`,$(i),`<n>`];return[`${_i(t)}, in windows: ${vi(t,[...a,...o])}, advancing ${$(r)} until a window returns fewer than ${$(i)} units`]})}function _i(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function vi(e,t){return[Ar,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function yi(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function bi(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=Ti(t,w(e,t),n);if(t.legacyName===void 0)return r;let i=Ti(t,w(e,t,t.legacyName),n).flag;return i===r.flag?r:Object.assign(r,{legacyFlag:i})})}),n=e.requestBody?.map(n=>{let r=Ci(e,t,n),i=Si(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`))?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,errorResponse:e.errorResponse,successResponse:r,detailField:e.response.find(e=>e.detailField!==void 0)?.detailField,parameters:t}})}function xi(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function Si(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function Ci(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>wi(e.name)-wi(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=Ue(e,t,r);return r.add(n),[Ti(t,n,`body`)]})}function wi(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function Ti(e,t,n){let r=e.itemSchemaEnum??e.schemaEnum,i=je(e.schemaType,e.itemSchemaType,e.schemaFormat,t);return{name:e.name,optionKey:t,flag:`${te(t)} ${e.schemaType===`boolean`?`[${i}]`:`<${i}>`}`,required:e.required&&e.schemaDefault===void 0,description:Ae(e.description,r),schemaType:e.schemaType,schemaFormat:e.schemaFormat,itemSchemaType:e.itemSchemaType,defaultValue:Ei(e.schemaDefault),choices:r,...e.envName===void 0?{}:{envName:e.envName},...e.visibility&&{visibility:e.visibility},location:n}}var Ei=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{O as _,Q as a,st as b,z as c,Tr as d,R as f,Yt as g,zt as h,Gr as i,xr as l,Lt as m,xi as n,Jr as o,Rt as p,pi as r,Dr as s,bi as t,Cr as u,k as v,Ge as x,A as y};
@@ -1 +0,0 @@
1
- import{w as e,y as t}from"./person-owner-BJgNYLKX.js";import{zr as n}from"./dist-BITld09_.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};