@aventurevc/mcp-server 0.8.176 → 0.8.178

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.
@@ -1 +0,0 @@
1
- import{i as e}from"./result-envelope-CBM70LIR.js";import{writeFileSync as t}from"node:fs";import{Buffer as n}from"node:buffer";var r;function i(e){r=e}function a(i){let a=r;if(a===void 0)return i;r=void 0;let s=i.data,c=i.ok?s instanceof Uint8Array?s:typeof s==`string`?n.from(s,`utf8`):o(s):o(i);try{t(a,c)}catch(t){return e(`could not spill output to '${a}'`,[String(t)])}return!i.ok||c.byteLength<=5e4?i:typeof s!=`object`||!s||s instanceof Uint8Array?{...i,data:`spilled ${c.byteLength} bytes to '${a}'`}:{...i,data:{...s,response:{spilledTo:a,byteLength:c.byteLength}}}}function o(e){return n.from(JSON.stringify(e,null,2),`utf8`)}export{a as n,i as t};
@@ -1 +0,0 @@
1
- import{w as e,y as t}from"./person-owner-BJgNYLKX.js";import{zr as n}from"./dist--XnoGdAp.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};
@@ -1 +0,0 @@
1
- import{E as e,O as t,S as n,T as r,h as i,i as a,l as o,n as s,o as c,p as l,s as u,t as d,u as f,v as p,w as m,y as h}from"./person-owner-BJgNYLKX.js";import{Buffer as g}from"node:buffer";var _=i(()=>r([m(),p(),f(),u(),o(_),n(m(),_)])),v=r([c([`URL_DUPLICATE`,`STRICT_URL_LOOKUP`,`DUPLICATE_CREATE_REVIEW`,`CLASSIFICATION_INACTIVE_TAG`,`NEWS_SOURCE_URL`]),m()]),y=c([`REACTIVATE`,`ATTACH_INACTIVE`]),ee=h({availableOverrides:o(y),conflictType:v.optional(),slug:m(),tagId:l()}),te=h({externalId:m().nullish(),id:l(),reason:o(m()),score:l(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish()}),ne=h({externalId:m().nullish(),id:t(),name:m().nullish(),operatingStatus:m().nullish(),publicPath:m().nullish(),reason:o(m()),score:l(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:s.nullish()}),b=h({candidate:o(ne).nullish(),conflictType:v.optional(),newsCandidate:o(te).nullish(),overridePath:m().nullish(),threshold:l()}),x=h({conflictingArticleId:l(),conflictingArticleSlug:m(),conflictingArticleTitle:m(),conflictType:v.optional()}),re=h({candidateEntityId:o(t()),candidatePersonId:o(t()),conflictType:v.optional(),hint:m(),normalizedUrl:m().nullish(),url:m(),urlType:m().nullish()}),ie=h({owner:d,urlId:l()}),ae=h({conflictType:v.optional(),existingJoin:o(ie),fragmentIgnored:f(),guidance:m(),normalizedUrl:m().nullish(),requestedOwner:d,url:m(),urlType:m()}),S=r([ae,re,b,ee,x]),C=h({acceptedValue:o(m()).nullish(),action:c([`setField`,`setParameter`,`removeParameter`,`useEndpoint`,`reviewCandidates`,`authenticate`]),endpoint:m().nullish(),fieldPath:m().nullish(),parameter:m().nullish(),retryable:f().nullish()}),w=r([c([`source`,`record`,`disclaimer`,`voice`,`structured`,`temporal`,`factList`,`mojibake`,`unsupported`,`legalSource`,`textContract`]),m()]),T=h({overridable:f(),passage:m(),problem:w,reason:m()}),E=c([`entity`,`person`,`news`,`blog`,`content`]),oe=h({deletedAt:a({offset:!0}).nullish(),id:m(),isHidden:f(),nameBrand:m().nullish(),resourceType:E,showOnSitemap:f(),slug:m()}),se=h({newUrl:m().nullish(),oldUrl:m(),targetCurrentSlug:m().nullish(),targetId:m().nullish(),targetResourceType:E.nullish()}),D=h({allowanceType:c([`COMPANY`,`PERSON`,`ENTITY_VIEW`,`ENTITY_BRAND`,`PERSON_VIEW`,`WEB_SEARCH`]).nullish(),circuitBreaker:m().nullish(),code:r([c(`not_authorized.rateLimited.rate_limited.subscription_required.subscription_canceled.subscription_past_due.subscription_paused.billing_allowance_exhausted.billing_additional_usage_cap_reached.billing_credit_checkout_closed.account_exists.origin_detail_capacity.origin_detail_shutdown.suspectedShellStrip.suspected_shell_strip.prose_rejected.url_surface_misclassification.JOBRUNR_DISABLED.jobrunr_disabled.task_plan_operation_unserved.JOBRUNR_STORAGE_UNAVAILABLE.jobrunr_storage_unavailable.rbac_lookup_unavailable.GEOCODE_PROVIDER_ERROR.geocode_provider_error.sentry_api_error.frontend_cache_epoch_mode_not_targeted.image_blocklist_match.image_monochrome.image_too_small.image_wrong_aspect.image_monogram.image_unreadable.image_processing_error.image_brand_mismatch.image_photographic.web_crawl_fetch_failed.source_document_fetch_busy.primary_website_missing.news_rss_feed_fetch_failed.news_rss_article_fetch_failed.callback_connection_refused.callback_timeout.callback_tls_error.callback_http_4xx.callback_http_5xx.callback_challenge_failed.news_subscription_limit.r2_fetch_failed.r2_delete_failed.r2_upload_failed.source_document_body_unavailable.source_document_capture_limit_exceeded.news_similarity_embedding_unavailable.search_provider_not_configured.search_provider_error.search_still_running.lookup_still_running.sec_edgar_fetch_failed.github_fetch_failed.INFERENCE_PROVIDER_ERROR.inference_provider_error.INFERENCE_PROVIDER_RESPONSE_EMPTY.inference_provider_response_empty.INFERENCE_PROVIDER_INVALID_JSON.inference_provider_invalid_json.INFERENCE_PROFILES_MISSING.inference_profiles_missing.INFERENCE_PROFILE_API_KEY_MISSING.inference_profile_api_key_missing`.split(`.`)),m().max(128)]).nullish(),conflictingRecord:oe.nullish(),detail:m().optional(),details:S.nullish(),error:n(m(),m()).nullish(),existingRecordId:m().nullish(),existingRedirect:se.nullish(),feId:m().nullish(),field:m().nullish(),filedRunId:o(t()).nullish(),hammingDistance:p().int().nullish(),hint:m().nullish(),instance:m().optional(),limit:p().int().nullish(),limitType:c([`FORM`,`GLOBAL`,`SUBNET`,`IP`,`UNKNOWN`,`RESILIENCE4J`,`WEB_SEARCH`,`AGENT_HELP`,`NATURAL_SEARCH`,`BILLING_ALLOWANCE`,`BILLING_ADDITIONAL_USAGE`,`CLERK_PUBLIC_ADMISSION`,`CLERK_SCRIPT_LOAD`,`ORIGIN_DETAIL`,`INFERENCE_PROVIDER`]).nullish(),matchedBlocklistKey:m().nullish(),mediaType:m().nullish(),moderationReason:m().nullish(),parseError:m().nullish(),path:m().nullish(),properties:n(m(),_).optional(),proseViolation:o(T).nullish(),remaining:p().int().nullish(),requiredRole:m().nullish(),resetAt:a({offset:!0}).nullish(),resolution:C.nullish(),retryAfterSeconds:p().int().nullish(),spanId:m().nullish(),status:l().optional(),suggestion:m().nullish(),suggestions:n(m(),m()).nullish(),suspectedFragment:m().nullish(),title:m().optional(),traceId:m().nullish(),type:m().optional(),unknownParameters:o(m()).nullish(),used:p().int().nullish(),validParameters:o(m()).nullish(),value:m().nullish(),windowSeconds:p().int().nullish()}),ce=e=>e>=500&&e<600,O=r([m(),p(),f()]),le=h({number:p().optional(),size:p().optional(),numberOfElements:p().optional(),totalElements:p().optional(),totalPages:p().optional(),first:f().optional(),last:f().optional(),empty:f().optional()}),ue=h({byteLength:p(),maxBytes:p(),omitted:o(m()),recovery:m()}),k=h({status:p(),title:m(),type:m()}).catchall(_.optional()).and(D);h({ok:f(),summary:m(),httpStatus:p().optional(),operationId:m().optional(),method:m().optional(),endpoint:m().optional(),format:c([`json`,`text`]).optional(),count:p().optional(),page:le.optional(),filters:n(m(),r([O,o(O)])).optional(),truncated:f().optional(),truncation:ue.optional(),omitted:o(m()).default([]),ids:o(m()).default([]),counts:n(m(),p()).default({}),references:o(m()).default([]),warnings:o(m()).default([]),problem:k.optional(),data:e()});var A=5e4,j=[50,25,10,5,1],M=[...j.map(e=>({arrayLimit:e,rowLimit:1/0})),...j.map(e=>({arrayLimit:1,rowLimit:e}))],N=320,P=1e3,F=/^(?:bio|biography|body|content|description|evidence|fulltext|notes|snippet|summary|text)$/u,I=/(?:description|snippet|summary|text)$/u;function L(e){let t=Z(e)?e:null;if(t===null)return;let n={number:Q(t,`number`),size:Q(t,`size`),numberOfElements:Q(t,`numberOfElements`),totalElements:Q(t,`totalElements`),totalPages:Q(t,`totalPages`),first:$(t,`first`),last:$(t,`last`),empty:$(t,`empty`)};return Object.values(n).some(e=>e!==void 0)?n:void 0}function R(e,t){if(t?.numberOfElements!==void 0)return t.numberOfElements;if(Array.isArray(e))return e.length;let n=Z(e)?e.content:void 0;return Array.isArray(n)?n.length:void 0}function z(e,t,n={}){return{ok:!0,summary:e,...n,omitted:n.omitted??[],ids:n.ids??[],counts:n.counts??{},references:n.references??[],warnings:n.warnings??[],data:t}}function B(e,t=[],n={}){return{...z(e,null,{...n,warnings:t}),ok:!1}}function V(e,t={}){let n=g.byteLength(JSON.stringify(e),`utf8`);if(n<=5e4)return e;let r=e.httpStatus??0;if(t.write===!0&&e.ok&&r>=200&&r<300)return H(e,n,t.exactRecovery);let i=t.exactRecovery??`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`,a=e;for(let t of M){let r=de(e.data,n,t);if(a={...e,truncated:!0,truncation:J(n,r.omitted,i),warnings:[...e.warnings,`response truncated (>50KB); read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`],data:r.value},G(a))return a}return U({...a,truncation:J(n,[`data`],i),data:Y(n)},n,i,`response truncated (>50KB); metadata named in truncation.omitted was removed; read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`)}function H(e,t,n=`Read the full result through the GET operation on ${e.endpoint??`this route`}.`){let r={...e.counts},i=(e,n)=>{let a={};for(let[o,s]of Object.entries(Z(e)?e:{}))Array.isArray(s)?r[`${n}${o}`]=s.length:typeof s==`string`?a[o]=K(s,t,N):typeof s!=`object`||!s?a[o]=s:n===``&&o===`response`&&(a[o]=i(s,`response.`));return a},a={...e,summary:`${e.method} succeeded (HTTP ${e.httpStatus}); response body omitted (${t} bytes, over the 50KB cap); do not retry the write`,truncated:!0,truncation:J(t,[`data`],n),counts:r,data:i(e.data,``)},o=a,s=[`data`],c={};for(let r of[`references`,`ids`,`warnings`]){if(G(o))return o;s.push(r),c[r]=[],o={...a,...c,omitted:[...e.omitted,...s.slice(1)],truncation:J(t,s,n)}}return G(o)?o:U({...o,data:Y(t),warnings:[`response truncated (>50KB); do not retry the write`]},t,n,`response truncated (>50KB); metadata named in truncation.omitted was removed; do not retry the write`)}function U(e,t,n,r){if(G(e))return e;let i=e.warnings.slice(0,-1),a=[`data`],o=e;if(o.problem!==void 0){let e=W(o.problem);if(JSON.stringify(e).length<JSON.stringify(o.problem).length&&(a.push(`problem`),o={...o,problem:e,truncation:J(t,a,n)},G(o)))return o}let s=[];if(e.filters!==void 0&&s.push(`filters`),e.omitted.length>0&&s.push(`omitted`),e.ids.length>0&&s.push(`ids`),Object.keys(e.counts).length>0&&s.push(`counts`),e.references.length>0&&s.push(`references`),a.push(...s),o={...o,filters:void 0,truncation:J(t,a,n),omitted:[],ids:[],counts:{},references:[],warnings:s.length===0?e.warnings:[...i,r]},G(o))return o;let c=e=>e===void 0?void 0:K(e,t),l=K(o.summary,t),u=c(o.operationId),d=c(o.method),f=c(o.endpoint),p=o.warnings.map(e=>K(e,t)),m=o.problem===void 0?void 0:W(o.problem,t);if(l!==o.summary&&a.push(`summary`),u!==o.operationId&&a.push(`operationId`),d!==o.method&&a.push(`method`),f!==o.endpoint&&a.push(`endpoint`),p.some((e,t)=>e!==o.warnings[t])&&a.push(`warnings`),o.problem!==void 0&&m!==void 0&&JSON.stringify(m)!==JSON.stringify(o.problem)&&a.push(`problem`),o={...o,summary:l,operationId:u,method:d,endpoint:f,truncation:J(t,a,n),warnings:p,problem:m},G(o))return o;a.push(`warnings`),o.page!==void 0&&a.push(`page`);let h=K(o.summary,t,N);return h!==o.summary&&a.push(`summary`),{...o,summary:h,page:void 0,truncation:J(t,a,n),warnings:[r]}}function W(e,t){let n=e=>t===void 0?e:K(e,t);return{status:e.status,title:n(e.title),type:n(e.type),...e.detail===void 0?{}:{detail:n(e.detail)},...e.instance===void 0?{}:{instance:n(e.instance)},...e.code===void 0?{}:{code:typeof e.code==`string`?n(e.code):e.code},...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds}}}function G(e){return g.byteLength(JSON.stringify(e),`utf8`)<=A}function K(e,t,n=P){if(g.byteLength(JSON.stringify(e),`utf8`)<=n)return e;let r=X(t),i=``,a=g.byteLength(JSON.stringify(r),`utf8`);for(let t of e){let e=g.byteLength(JSON.stringify(t),`utf8`)-2;if(a+e>n)break;i+=t,a+=e}return`${i.trimEnd()}${r}`}function de(e,t,n){let r=_.safeParse(JSON.parse(JSON.stringify(e)));return r.success?q(r.data,`data`,t,n):{value:Y(t),omitted:[`data`]}}function q(e,t,n,r){if(typeof e==`string`)return!(pe(he(t))||e.length>P)||e.length<=N?{value:e,omitted:[]}:{value:`${e.slice(0,N).trimEnd()}${X(n)}`,omitted:[t]};if(typeof e!=`object`||!e)return{value:e,omitted:[]};if(Array.isArray(e))return fe(e,t,n,r);if(t===`data.response.entity.answer`||t===`data.response.answer`)return{value:e,omitted:[]};let i={},a=[];for(let[o,s]of Object.entries(e)){if(s===void 0)continue;let e=q(s,`${t}.${o}`,n,r);i[o]=e.value,a.push(...e.omitted)}return{value:i,omitted:a}}function fe(e,t,n,r){let i=e.slice(0,r.rowLimit),a={...r,rowLimit:r.arrayLimit},o=i.map((e,r)=>q(e,`${t}[${r}]`,n,a)),s=o.flatMap(e=>e.omitted),c=`${t}[${i.length}..] (kept ${i.length} of ${e.length})`;return{value:o.map(e=>e.value),omitted:e.length>i.length?[...s,c]:s}}function pe(e){let t=e.toLowerCase();return F.test(t)||I.test(t)}var me=`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`;function J(e,t,n){return{byteLength:e,maxBytes:A,omitted:t.length===0?[`data`]:[...new Set(t)],recovery:K(n,e)}}function Y(e){return{truncated:!0,byteLength:e,maxBytes:A}}function X(e){return`\n[truncated byteLength=${e} maxBytes=${A}]`}function he(e){return(e.split(`.`).at(-1)??e).replace(/\[\d+\]$/,``)}var Z=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Q(e,t){return typeof e[t]==`number`?e[t]:void 0}function $(e,t){return typeof e[t]==`boolean`?e[t]:void 0}export{G as a,z as c,_ as d,B as i,ce as l,me as n,L as o,V as r,R as s,A as t,D as u};
@@ -1 +0,0 @@
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-CBM70LIR.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};