@aventurevc/aventure-cli 0.8.141 → 0.8.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +1 -1
- package/dist/chunks/{aventure-cli-Dou1m0N2.js → aventure-cli-DfNuWwp_.js} +4 -4
- package/dist/chunks/{contract-6WQnRzD-.js → contract-DGrTjqGU.js} +1 -1
- package/dist/chunks/{dist-TAStxmQX.js → dist-Bl6rEa6-.js} +1 -1
- package/dist/chunks/oauth-bearer-credential-BT4kdkRW.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-DVpTqxPU.js → oauth-bearer-credential-ufsXeDeO.js} +2 -2
- package/dist/chunks/{oauth-login-CvAR2DDv.js → oauth-login-Cx47jDN2.js} +1 -1
- package/dist/chunks/oauth-login-YiP5qWSy.js +1 -0
- package/dist/chunks/{openapi-commands-B7YAX6ff.js → openapi-commands-CWAW3KSJ.js} +1 -1
- package/dist/chunks/openapi-commands-D7Tq_nT4.js +1 -0
- package/dist/chunks/provider-catalog-B57DaZLa.js +1 -0
- package/package.json +3 -3
- package/dist/chunks/oauth-bearer-credential-82-AGFSw.js +0 -1
- package/dist/chunks/oauth-login-CSxDu1By.js +0 -1
- package/dist/chunks/openapi-commands-ncTUuEvi.js +0 -1
- package/dist/chunks/provider-catalog-B3EP9qgK.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-B3nxJH8H.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-
|
|
2
|
+
import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-B3nxJH8H.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-BT4kdkRW.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-DNxYcBcd.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-C9lVAt5_.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CJvckkTy.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-Bispjv2H.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-D7Tq_nT4.js`),p=process.argv.slice(2);d(p)&&r(!1),p.includes(`--all-fields`)&&u(!0);try{a();let e=l(p,f);if(e===`stored`||e===`optional`)try{await(e===`stored`?s():o()),await c()}catch(e){n({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-DfNuWwp_.js`)}catch(e){if(!(e instanceof t))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"generatedAt": "2026-10-10T15:31:52.647Z",
|
|
5
5
|
"totalOperations": 141,
|
|
6
6
|
"note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
|
|
7
7
|
"operations": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a}from"./logging-sKoOD-tO.js";import{M as o,O as s,i as c,o as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{Ar as p,Dr as m,Er as h,Ir as ee,Lr as g,Mr as te,Or as ne,kr as re}from"./dist-TAStxmQX.js";import{n as ie,r as _,s as v,u as ae}from"./result-envelope-DTzTOcab.js";import{i as oe,l as y,o as se,r as ce,s as le,t as b}from"./env-ClsLmXWa.js";import{a as x,n as ue,r as de,t as fe}from"./package-DPDX5zmx.js";import{S as pe,d as me,f as he,o as ge,p as _e,r as ve,s as ye,t as be}from"./tool-policy-Dg1Wd9Z7.js";import{i as xe,r as Se}from"./response-problem-DCBMY8Lr.js";import{n as Ce}from"./output-spill-D0GZ7YT_.js";import{a as we,c as Te,d as Ee,f as De,i as Oe,l as ke,m as Ae,n as S,o as je,r as Me,s as Ne,u as Pe,y as Fe}from"./contract-6WQnRzD-.js";import{a as Ie,c as Le,i as Re,l as ze,n as Be,s as Ve,t as He}from"./cli-help-policy-J-foY8Og.js";import{S as Ue,_ as We,a as Ge,g as C,h as Ke,i as qe,m as Je,n as Ye,p as Xe,r as Ze,s as Qe,t as $e,v as et,x as w,y as tt}from"./api-key-bearer-credential-CW5W3VVg.js";import{a as nt,c as rt,d as it,g as at,l as ot,m as st,o as ct,s as lt,t as ut,u as dt}from"./oauth-bearer-credential-DVpTqxPU.js";import{n as ft,r as pt,t as mt}from"./oauth-login-CvAR2DDv.js";import{a as ht,c as gt,d as _t,i as vt,l as yt,n as bt,o as xt,s as St,t as Ct,u as wt}from"./startup-auth-X3GxJOiR.js";import{n as Tt,t as T}from"./openapi-commands-B7YAX6ff.js";import{i as E,r as Et,t as D}from"./output-mode-sM_EbDW_.js";import{spawnSync as Dt}from"node:child_process";import{basename as O,dirname as k,relative as Ot,resolve as A,sep as kt}from"node:path";import{copyFileSync as At,existsSync as j,lstatSync as jt,mkdirSync as Mt,mkdtempSync as Nt,readFileSync as Pt,readdirSync as Ft,readlinkSync as It,realpathSync as Lt,renameSync as Rt,symlinkSync as zt,writeFileSync as Bt}from"node:fs";import M,{stderr as N,stdin as Vt}from"node:process";import{TextDecoder as Ht,inspect as Ut}from"node:util";import{homedir as Wt,hostname as Gt,platform as Kt}from"node:os";import{fileURLToPath as qt}from"node:url";import{setTimeout as Jt}from"node:timers/promises";import{randomUUID as Yt,webcrypto as Xt}from"node:crypto";import{readFile as Zt}from"node:fs/promises";import{createInterface as Qt}from"node:readline/promises";function $t(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{..._(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function en(e,t,n){if(!F(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!hn(n,r.name))continue;let a=mn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function tn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function nn(e,t,n,r=!1){if(r||!P(t)||!Array.isArray(n))return yn(e,t,n);for(let[r,i]of n.entries()){let n=yn(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function rn(e,t,n,r){return yn(e,t,r,n)}function an(e){let t=[];for(let n of e.split(`.`)){let e=xn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function on(e,t){let n=an(t);if(n===null)return null;let r=pn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:fn(r)}:null}function sn(e,t){if(P(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):_(`${n} was already given; pass it once.`)}var cn=/^(?<row>\d+):(?<item>.*)$/su;function ln(e,t){let n=an(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=cn.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function un(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&an(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function dn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=on(r,i.name);if(a===null)continue;if(a.firstHole!==null)return _(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||ln(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return _(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function fn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function pn(e,t){let n=e;for(let e of t){if(!F(n))return;n=n[e]??null}return n}function mn(e,t){if(!P(t))return pn(e,t.split(`.`))}function hn(e,t){return _n(e,t.split(`.`))}function gn(e,t,n){if(!F(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&hn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function _n(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=xn(n);if(!F(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>_n(e,r)):_n(a,r)}function P(e){return e.split(`.`).some(e=>xn(e).isArray)}function vn(e,t){return e.parameter.length===0||!F(t)?null:Cn(t,[],Sn(e.parameter))}function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=xn(o),c=e===i.length-1,l=bn(a,s,t,c,n,r);if(!l.ok||l.data===null)return _(l.summary,l.warnings);if(c)return v(`Body value assigned`,null);a=l.data}return _(`${t} is not a valid body option path.`)}function bn(e,t,n,r,i,a){let o=()=>_(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,v(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,v(`Body path created`,e)}return F(c)?v(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,v(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return F(s)?v(`Body path stepped`,s):o()}function xn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Sn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function Cn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Cn(r,t,n);if(e!==null)return e}return null}if(!F(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!wn(a,n)){if(!Tn(e))continue;return{path:a,suggestion:En(e,n)}}let o=Cn(i,e,n);if(o!==null)return o}return null}function wn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Tn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function En(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:Dn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function Dn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function On(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Le(e)),t.description=te(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?In(r,i):r===void 0?i===void 0?0:1:-1})}function kn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function An(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function jn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Pn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Mn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Nn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?ze(n):`${ze(n)} Required JSON paths: ${r.join(`, `)}.`}function Pn(e,t){let n=Ie(t.description,void 0),r=e.kind!==`multipart`&&P(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Fn(e,t)}`}function Fn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=an(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function In(e,t){return Ve(e)-Ve(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Ln(e){let t;try{t=e===`-`?await Rn():await Zt(e,`utf8`)}catch(t){return _(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return _(`Input is not valid JSON: ${e.message}`)}}async function Rn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var zn=`--content-type`;function Bn(t,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(zn)){let n=a.map(({contentType:e})=>e);t.addOption(new e(`${zn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Hn(a)))}if(or(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);t.addOption(new e(`--from-file <path>`,Nn(r,r.requiredPath)).argParser(Wn(`--from-file`)))}let o=kn(a).filter(e=>i(I(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>In(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new e(An(n),a.length>1?jn(n):Pn(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Mn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Vn):P(i.name)||i.schemaType===`array`?o.argParser(Un):o.argParser(Wn(i.flag)),t.addOption(o),o.envVar!==void 0&&t.on(`optionEnv:${o.name()}`,()=>{let e=t.opts()[i.optionKey];typeof e==`string`&&e.trim()&&t.setOptionValueWithSource(i.optionKey,e.trim(),`env`)})}ar(t,n,o)}function Vn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Hn(e){return(n,r)=>{if(r!==void 0)throw new t(`${zn} was already given; pass it once.`);let i=pe(e,n);if(!i.ok)throw new t(i.summary);return n}}function Un(e,t){return[...t??[],e]}function Wn(e){let n=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new t(`${n} was already given; pass it once.`);return e}}async function Gn(e,t){let n=xt(e,t),r=pe(e.requestBody??[],n);if(!r.ok||r.data===null)return _(r.summary,r.warnings);let i=r.data;if(i===void 0)return v(`No body`,void 0);let a=Kn(e,i,t);if(a!==null)return _(a);let o=$t(e.operationId,i,t);if(!o.ok)return _(o.summary,o.warnings);t=o.data;let s=qn(i,t);if(s!==null)return _(s);let c=await Zn(t);if(!c.ok)return _(c.summary,c.warnings);let l=gn(e.requestBody??[],i,c.data);if(l!==null)return _(l);let u=Xn(e.operationId,i,c.data);if(!u.ok)return u;let d=en(e.operationId,i,c.data);if(d!==null)return _(d);let f=Qn(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?_(ir(e.operationId,i)):v(`No body`,void 0);let p=er(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return _(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!F(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return _(`${e.operationId} requires a JSON object${t}.`)}let m=Yn(i,p.data);if(m.length>0)return _(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=F(h)?tn(i).filter(e=>!hn(h,e)):[];return ee.length>0?_(Jn(e.operationId,i,ee)):p}function Kn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${I(t)} requires ${zn} ${i.join(` or `)}.`}return null}function qn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Jn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Yn(e,t){return F(t)?e.parameter.filter(e=>e.required&&!hn(t,e.name)).map(I):[]}function Xn(e,t,n){let r=vn(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return _(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Zn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return v(`No body file`,void 0);let n=await Ln(t);if(!n.ok)return _(n.summary,n.warnings);let r=ae.safeParse(n.data);return r.success?v(`Input parsed`,r.data):_(`Input is not valid JSON value: ${r.error.message}`)}function Qn(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=sn(e,n[e.optionKey]);if(!a.ok||a.data===null)return _(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=$n(t,n,r,e,o);if(!s.ok)return _(s.summary,s.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let a=dn(e,t,n,r);return a===null?v(`Direct body options parsed`,r):a}function $n(e,t,n,r,i){let a=ln(r,i);if(a===null){let e=nr(r,i);return e.ok?nn(n,r.name,e.data,r.schemaType===`array`):_(e.summary,e.warnings)}if(a.plain.length>0)return _(`${I(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=un(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return _(`${I(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=rr(r.name,r.itemSchemaType,e);if(!t.ok)return _(t.summary,t.warnings);i.push(t.data)}let a=rn(n,r.name,e,i);if(!a.ok)return a}return v(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function er(e,t,n,r){if(n===void 0)return v(`Direct body parsed`,r);if(r===void 0)return v(`Input parsed`,n);if(F(n)&&F(r))try{return v(`Input parsed`,tr(t,n,r))}catch(t){return _(`${e} ${t.message}`)}return _(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function tr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(F(n)&&F(a))i[t]=tr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:Ne.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nr(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return rr(e.name,e.schemaType,t??``);let n=[],r=P(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=rr(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function rr(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):_(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?_(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?_(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function ir(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(I).join(`, `)}`;let r=tn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function ar(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:zn,location:`body`}),or(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),On(e.options,r)}function or(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function sr(e){let t=ie(e,Me(e,T));return gr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function cr(e){let t=ie(e,Me(e,T));gr(t);let n=Oe(T,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=lr(t);r.push(n.endsWith(`
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a}from"./logging-sKoOD-tO.js";import{M as o,O as s,i as c,o as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{Ar as p,Dr as m,Er as h,Ir as ee,Lr as g,Mr as te,Or as ne,kr as re}from"./dist-Bl6rEa6-.js";import{n as ie,r as _,s as v,u as ae}from"./result-envelope-DTzTOcab.js";import{i as oe,l as y,o as se,r as ce,s as le,t as b}from"./env-ClsLmXWa.js";import{a as x,n as ue,r as de,t as fe}from"./package-DPDX5zmx.js";import{S as pe,d as me,f as he,o as ge,p as _e,r as ve,s as ye,t as be}from"./tool-policy-Dg1Wd9Z7.js";import{i as xe,r as Se}from"./response-problem-DCBMY8Lr.js";import{n as Ce}from"./output-spill-D0GZ7YT_.js";import{a as we,c as Te,d as Ee,f as De,i as Oe,l as ke,m as Ae,n as S,o as je,r as Me,s as Ne,u as Pe,y as Fe}from"./contract-DGrTjqGU.js";import{a as Ie,c as Le,i as Re,l as ze,n as Be,s as Ve,t as He}from"./cli-help-policy-J-foY8Og.js";import{S as Ue,_ as We,a as Ge,g as C,h as Ke,i as qe,m as Je,n as Ye,p as Xe,r as Ze,s as Qe,t as $e,v as et,x as w,y as tt}from"./api-key-bearer-credential-CW5W3VVg.js";import{a as nt,c as rt,d as it,g as at,l as ot,m as st,o as ct,s as lt,t as ut,u as dt}from"./oauth-bearer-credential-ufsXeDeO.js";import{n as ft,r as pt,t as mt}from"./oauth-login-Cx47jDN2.js";import{a as ht,c as gt,d as _t,i as vt,l as yt,n as bt,o as xt,s as St,t as Ct,u as wt}from"./startup-auth-X3GxJOiR.js";import{n as Tt,t as T}from"./openapi-commands-CWAW3KSJ.js";import{i as E,r as Et,t as D}from"./output-mode-sM_EbDW_.js";import{spawnSync as Dt}from"node:child_process";import{basename as O,dirname as k,relative as Ot,resolve as A,sep as kt}from"node:path";import{copyFileSync as At,existsSync as j,lstatSync as jt,mkdirSync as Mt,mkdtempSync as Nt,readFileSync as Pt,readdirSync as Ft,readlinkSync as It,realpathSync as Lt,renameSync as Rt,symlinkSync as zt,writeFileSync as Bt}from"node:fs";import M,{stderr as N,stdin as Vt}from"node:process";import{TextDecoder as Ht,inspect as Ut}from"node:util";import{homedir as Wt,hostname as Gt,platform as Kt}from"node:os";import{fileURLToPath as qt}from"node:url";import{setTimeout as Jt}from"node:timers/promises";import{randomUUID as Yt,webcrypto as Xt}from"node:crypto";import{readFile as Zt}from"node:fs/promises";import{createInterface as Qt}from"node:readline/promises";function $t(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{..._(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function en(e,t,n){if(!F(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!hn(n,r.name))continue;let a=mn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function tn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function nn(e,t,n,r=!1){if(r||!P(t)||!Array.isArray(n))return yn(e,t,n);for(let[r,i]of n.entries()){let n=yn(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function rn(e,t,n,r){return yn(e,t,r,n)}function an(e){let t=[];for(let n of e.split(`.`)){let e=xn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function on(e,t){let n=an(t);if(n===null)return null;let r=pn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:fn(r)}:null}function sn(e,t){if(P(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):_(`${n} was already given; pass it once.`)}var cn=/^(?<row>\d+):(?<item>.*)$/su;function ln(e,t){let n=an(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=cn.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function un(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&an(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function dn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=on(r,i.name);if(a===null)continue;if(a.firstHole!==null)return _(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||ln(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return _(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function fn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function pn(e,t){let n=e;for(let e of t){if(!F(n))return;n=n[e]??null}return n}function mn(e,t){if(!P(t))return pn(e,t.split(`.`))}function hn(e,t){return _n(e,t.split(`.`))}function gn(e,t,n){if(!F(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&hn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function _n(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=xn(n);if(!F(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>_n(e,r)):_n(a,r)}function P(e){return e.split(`.`).some(e=>xn(e).isArray)}function vn(e,t){return e.parameter.length===0||!F(t)?null:Cn(t,[],Sn(e.parameter))}function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=xn(o),c=e===i.length-1,l=bn(a,s,t,c,n,r);if(!l.ok||l.data===null)return _(l.summary,l.warnings);if(c)return v(`Body value assigned`,null);a=l.data}return _(`${t} is not a valid body option path.`)}function bn(e,t,n,r,i,a){let o=()=>_(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,v(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,v(`Body path created`,e)}return F(c)?v(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,v(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return F(s)?v(`Body path stepped`,s):o()}function xn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Sn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function Cn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Cn(r,t,n);if(e!==null)return e}return null}if(!F(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!wn(a,n)){if(!Tn(e))continue;return{path:a,suggestion:En(e,n)}}let o=Cn(i,e,n);if(o!==null)return o}return null}function wn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Tn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function En(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:Dn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function Dn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function On(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Le(e)),t.description=te(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?In(r,i):r===void 0?i===void 0?0:1:-1})}function kn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function An(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function jn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Pn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Mn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Nn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?ze(n):`${ze(n)} Required JSON paths: ${r.join(`, `)}.`}function Pn(e,t){let n=Ie(t.description,void 0),r=e.kind!==`multipart`&&P(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Fn(e,t)}`}function Fn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=an(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function In(e,t){return Ve(e)-Ve(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Ln(e){let t;try{t=e===`-`?await Rn():await Zt(e,`utf8`)}catch(t){return _(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return _(`Input is not valid JSON: ${e.message}`)}}async function Rn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var zn=`--content-type`;function Bn(t,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(zn)){let n=a.map(({contentType:e})=>e);t.addOption(new e(`${zn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Hn(a)))}if(or(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);t.addOption(new e(`--from-file <path>`,Nn(r,r.requiredPath)).argParser(Wn(`--from-file`)))}let o=kn(a).filter(e=>i(I(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>In(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new e(An(n),a.length>1?jn(n):Pn(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Mn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Vn):P(i.name)||i.schemaType===`array`?o.argParser(Un):o.argParser(Wn(i.flag)),t.addOption(o),o.envVar!==void 0&&t.on(`optionEnv:${o.name()}`,()=>{let e=t.opts()[i.optionKey];typeof e==`string`&&e.trim()&&t.setOptionValueWithSource(i.optionKey,e.trim(),`env`)})}ar(t,n,o)}function Vn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Hn(e){return(n,r)=>{if(r!==void 0)throw new t(`${zn} was already given; pass it once.`);let i=pe(e,n);if(!i.ok)throw new t(i.summary);return n}}function Un(e,t){return[...t??[],e]}function Wn(e){let n=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new t(`${n} was already given; pass it once.`);return e}}async function Gn(e,t){let n=xt(e,t),r=pe(e.requestBody??[],n);if(!r.ok||r.data===null)return _(r.summary,r.warnings);let i=r.data;if(i===void 0)return v(`No body`,void 0);let a=Kn(e,i,t);if(a!==null)return _(a);let o=$t(e.operationId,i,t);if(!o.ok)return _(o.summary,o.warnings);t=o.data;let s=qn(i,t);if(s!==null)return _(s);let c=await Zn(t);if(!c.ok)return _(c.summary,c.warnings);let l=gn(e.requestBody??[],i,c.data);if(l!==null)return _(l);let u=Xn(e.operationId,i,c.data);if(!u.ok)return u;let d=en(e.operationId,i,c.data);if(d!==null)return _(d);let f=Qn(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?_(ir(e.operationId,i)):v(`No body`,void 0);let p=er(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return _(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!F(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return _(`${e.operationId} requires a JSON object${t}.`)}let m=Yn(i,p.data);if(m.length>0)return _(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=F(h)?tn(i).filter(e=>!hn(h,e)):[];return ee.length>0?_(Jn(e.operationId,i,ee)):p}function Kn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${I(t)} requires ${zn} ${i.join(` or `)}.`}return null}function qn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Jn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Yn(e,t){return F(t)?e.parameter.filter(e=>e.required&&!hn(t,e.name)).map(I):[]}function Xn(e,t,n){let r=vn(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return _(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Zn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return v(`No body file`,void 0);let n=await Ln(t);if(!n.ok)return _(n.summary,n.warnings);let r=ae.safeParse(n.data);return r.success?v(`Input parsed`,r.data):_(`Input is not valid JSON value: ${r.error.message}`)}function Qn(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=sn(e,n[e.optionKey]);if(!a.ok||a.data===null)return _(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=$n(t,n,r,e,o);if(!s.ok)return _(s.summary,s.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let a=dn(e,t,n,r);return a===null?v(`Direct body options parsed`,r):a}function $n(e,t,n,r,i){let a=ln(r,i);if(a===null){let e=nr(r,i);return e.ok?nn(n,r.name,e.data,r.schemaType===`array`):_(e.summary,e.warnings)}if(a.plain.length>0)return _(`${I(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=un(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return _(`${I(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=rr(r.name,r.itemSchemaType,e);if(!t.ok)return _(t.summary,t.warnings);i.push(t.data)}let a=rn(n,r.name,e,i);if(!a.ok)return a}return v(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function er(e,t,n,r){if(n===void 0)return v(`Direct body parsed`,r);if(r===void 0)return v(`Input parsed`,n);if(F(n)&&F(r))try{return v(`Input parsed`,tr(t,n,r))}catch(t){return _(`${e} ${t.message}`)}return _(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function tr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(F(n)&&F(a))i[t]=tr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:Ne.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nr(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return rr(e.name,e.schemaType,t??``);let n=[],r=P(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=rr(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function rr(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):_(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?_(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?_(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function ir(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(I).join(`, `)}`;let r=tn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function ar(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:zn,location:`body`}),or(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),On(e.options,r)}function or(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function sr(e){let t=ie(e,Me(e,T));return gr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function cr(e){let t=ie(e,Me(e,T));gr(t);let n=Oe(T,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=lr(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(we(r.join(`
|
|
3
3
|
`),!0,!0,e.length));return}let i=t.ok?`OK`:`FAIL`;r.push(`[${i}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...fr(t.problem)),r.push(...lr(t)),process.stdout.write(we(r.join(`
|
|
4
4
|
`),!0))}function lr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function L(e,t){let n=Ce(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?ie(n,Me(n,T)):n;gr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?ur(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?sr(n):n;e.mode===`text`&&cr(r),r.ok||(process.exitCode=1)}function ur(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function dr(e,t){let n=je(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|
|
@@ -24,10 +24,10 @@ import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a
|
|
|
24
24
|
`),s=t===null?a:t[0],c=s===-1?i.length:s;if(t!==null&&a!==-1&&a<c)throw Error(`${r} runs compinit before the managed block; move the block above compinit manually.`);return Ya([...i.slice(0,c),...o,...i.slice(c)])}function Wa(e,t){return Ya(t===null?e:[...e.slice(0,t[0]),...e.slice(t[1]+1)])}function Ga(e,t){return e.flatMap((e,n)=>e===t?[n]:[])}function Ka(e){return e.findIndex(e=>/^\s*(autoload\s+.*\bcompinit\b|compinit(?:\s|$))/.test(e))}function qa(e,t){Mt(k(e),{recursive:!0}),j(e)&&(Ja(e),Ja(`${e}${ja}`),At(e,`${e}${ja}`));let n=A(k(e),`.${O(e)}.${M.pid}.tmp`);Ja(n),Bt(n,t,{mode:420}),Rt(n,e)}function Ja(e){if(j(e)&&jt(e).isSymbolicLink())throw Error(`refusing to write symlink: ${e}`)}function Ya(e){let t=e.join(`
|
|
25
25
|
`);return t.length===0||t.endsWith(`
|
|
26
26
|
`)?t:`${t}\n`}async function Xa(e){if(!M.stdin.isTTY)return!1;let t=Qt({input:M.stdin,output:M.stdout});try{let n=await t.question(`${e} [y/N] `);return/^(y|yes)$/i.test(n.trim())}finally{t.close()}}var Za=new Intl.Collator(void 0,{numeric:!0}),Qa=2e4,$a=[`lib`,`aventurevc-releases`];function eo(e,t=x()){let n=t.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;D(e.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${n}`,`--execute is deprecated, accepted, and ignored; update executes by its verb.`].join(`
|
|
27
|
-
`)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>L({mode:E(e)},to(void 0,`apply`,e.release)))}function to(e,t=`apply`,n){let r=e;try{r??=x(process.argv[1])}catch(e){return _(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let i=r.name,a=r.version,o=r.registry===``?``:ue,s=r.registry===``&&i===`@aventurevc/aventure-cli`,c=n;if(c===void 0){let e=no([`view`,o,`version`,`--silent`,`--global`],r,{timeout:Qa});if(!e.ok)return{...e,data:null};if(c=(e.data??``).trim(),c===``)return _(`npm view ${o} returned empty version`,[`empty_stdout`])}let l=n!==void 0||s||Za.compare(a,c)<0,u={targetPackage:o,runningPackage:i,currentVersion:a,latestVersion:c,upgradeAvailable:l,upgradeInstalled:!1};if(t===`check`)return v(`${i}@${a} → ${o}@${c} (${l?`available`:`up to date`})`,u);if(r.workingTreeRoot!==null)return _(`Refusing to install over the working-tree build at ${r.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=ao(r),t=A(e,...$a),i=O(o),s=A(t,`${i}-current`),l=o===``?[o,``]:[o,de],d=oo(e,r),f=n??[c,d?.version??a].reduce((e,t)=>Za.compare(e,t)<0?t:e,a);Mt(t,{recursive:!0});let p=[io(r),...j(s)?[Lt(s)]:[]
|
|
28
|
-
`).slice(-3).join(` | `);return _(`npm ${e.join(` `)} exited ${a.status}`,[t||`no stderr`])}return v(`npm ok`,a.stdout??``)}function ro(e,t,n,r){try{let i=t.map(t=>{let i=x(A(e,`lib`,`node_modules`,...t.split(`/`),`package.json`));if(i.name!==t||i.version!==n||i.registry!==r)throw Error(`${t} does not match ${n} from ${r}`);for(let t of i.bin)if(!Lt(A(e,`bin`,t)).startsWith(`${i.packageRoot}${kt}`))throw Error(`${t} escapes ${i.packageRoot}`);return i});for(let t of i){let r=A(e,`bin`,t.bin[0]),i=Dt(process.execPath,[r,`--version`],{encoding:`utf8`,timeout:Qa});if(i.error)throw Error(`${t.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==n)throw Error(`${t.name} expected ${n} but reported ${a||`empty output`}`)}return v(`CLI and MCP release verified`,i)}catch(t){return _(`release verification failed: ${co(t)}`,[`release prefix: ${e}`])}}function io(e){let t=k(e.packageRoot),n=k(t),r=k(n);if(O(t)!==e.name.split(`/`)[0]||O(n)!==`node_modules`||O(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${kt}`))throw Error(`the running entry escapes its package root`);return k(r)}function ao(e){let t=io(e),n=`${kt}${$a.join(kt)}${kt}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function oo(e,t){let n=t.registry===``?O(``):fe,r=A(e,`bin`,n);if(!j(r))return null;let i=x(r);if(i.registry!==t.registry)throw Error(`${r} belongs to another product`);return i}function so(e,t,n,r,i){let a=r[0];if(a===void 0)throw Error(`release contains no CLI`);let o=A(t,`bin`);Mt(o,{recursive:!0});let s=r.flatMap(e=>e.bin.filter((e,t)=>{let n=A(o,e);if(!j(n)||x(n).registry===a.registry)return!0;if(a.registry!==``&&t>0)return!1;throw Error(`${n} belongs to another product`)}));if(!j(n)){let t=Nt(A(k(n),`${O(n)}-seed-`));Mt(A(t,`bin`));for(let n of s){let r=A(o,n);zt(Lt(j(r)?r:A(e,`bin`,n)),A(t,`bin`,n))}try{zt(Ot(k(n),t),n)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!jt(n).isSymbolicLink())throw Error(`${n} is not a release symlink`);for(let e of s){let t=Ot(o,A(n,`bin`,e)),r=A(o,`.${e}-${Yt()}`);zt(t,r),Rt(r,A(o,e))}for(let e of s){let t=A(o,e);if(!jt(t).isSymbolicLink()||A(o,It(t))!==A(n,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let c=oo(t,a);if(i===void 0&&c!==null&&Za.compare(c.version,a.version)>0)return c.version;
|
|
27
|
+
`)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>L({mode:E(e)},to(void 0,`apply`,e.release)))}function to(e,t=`apply`,n){let r=e;try{r??=x(process.argv[1])}catch(e){return _(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let i=r.name,a=r.version,o=r.registry===``?``:ue,s=r.registry===``&&i===`@aventurevc/aventure-cli`,c=n;if(c===void 0){let e=no([`view`,o,`version`,`--silent`,`--global`],r,{timeout:Qa});if(!e.ok)return{...e,data:null};if(c=(e.data??``).trim(),c===``)return _(`npm view ${o} returned empty version`,[`empty_stdout`])}let l=n!==void 0||s||Za.compare(a,c)<0,u={targetPackage:o,runningPackage:i,currentVersion:a,latestVersion:c,upgradeAvailable:l,upgradeInstalled:!1};if(t===`check`)return v(`${i}@${a} → ${o}@${c} (${l?`available`:`up to date`})`,u);if(r.workingTreeRoot!==null)return _(`Refusing to install over the working-tree build at ${r.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=ao(r),t=A(e,...$a),i=O(o),s=A(t,`${i}-current`),l=o===``?[o,``]:[o,de],d=oo(e,r),f=n??[c,d?.version??a].reduce((e,t)=>Za.compare(e,t)<0?t:e,a);Mt(t,{recursive:!0});let p=[io(r),...j(s)?[Lt(s)]:[],...Ft(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>A(t,e.name))],m,h=null,ee=!1;for(let t of new Set(p.filter(t=>t!==e))){let e=ro(t,l,f,r.registry);if(e.ok&&e.data!==null){m=t,h=e.data;break}}if(m===void 0){m=Nt(A(t,`${i}-${encodeURIComponent(f)}-`));let e=no([`install`,`-g`,`--prefix`,m,...l.map(e=>`${e}@${f}`)],r,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};ee=!0;let n=ro(m,l,f,r.registry);if(!n.ok)return{...n,data:null};h=n.data}if(h===null)throw Error(`release verification produced no package`);let g=so(m,e,s,h,n),te=lo();return v(`${o} active at ${g}`,{...u,upgradeInstalled:ee||n!==void 0||d?.version!==g,installPrefix:e,verifiedVersion:g,completionRefreshed:te.refreshed,completionRefreshMessage:te.message})}catch(e){return _(`${o} update failed: ${co(e)}`,[`existing releases were preserved`])}}function no(e,t,n={}){let r={...process.env};t.registry===``?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let i=[...e,`--@aventurevc:registry=${t.registry}`],a=Dt(`npm`,i,{env:r,encoding:`utf8`,...n});if(a.error)return a.signal===`SIGTERM`&&n.timeout!==void 0?_(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):_(`npm ${e[0]??``} failed to start: ${a.error.message}`,[`spawn_error`]);if(a.status!==0){let t=(a.stderr??``).trim().split(`
|
|
28
|
+
`).slice(-3).join(` | `);return _(`npm ${e.join(` `)} exited ${a.status}`,[t||`no stderr`])}return v(`npm ok`,a.stdout??``)}function ro(e,t,n,r){try{let i=t.map(t=>{let i=x(A(e,`lib`,`node_modules`,...t.split(`/`),`package.json`));if(i.name!==t||i.version!==n||i.registry!==r)throw Error(`${t} does not match ${n} from ${r}`);for(let t of i.bin)if(!Lt(A(e,`bin`,t)).startsWith(`${i.packageRoot}${kt}`))throw Error(`${t} escapes ${i.packageRoot}`);return i});for(let t of i){let r=A(e,`bin`,t.bin[0]),i=Dt(process.execPath,[r,`--version`],{encoding:`utf8`,timeout:Qa});if(i.error)throw Error(`${t.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==n)throw Error(`${t.name} expected ${n} but reported ${a||`empty output`}`)}return v(`CLI and MCP release verified`,i)}catch(t){return _(`release verification failed: ${co(t)}`,[`release prefix: ${e}`])}}function io(e){let t=k(e.packageRoot),n=k(t),r=k(n);if(O(t)!==e.name.split(`/`)[0]||O(n)!==`node_modules`||O(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${kt}`))throw Error(`the running entry escapes its package root`);return k(r)}function ao(e){let t=io(e),n=`${kt}${$a.join(kt)}${kt}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function oo(e,t){let n=t.registry===``?O(``):fe,r=A(e,`bin`,n);if(!j(r))return null;let i=x(r);if(i.registry!==t.registry)throw Error(`${r} belongs to another product`);return i}function so(e,t,n,r,i){let a=r[0];if(a===void 0)throw Error(`release contains no CLI`);let o=A(t,`bin`);Mt(o,{recursive:!0});let s=r.flatMap(e=>e.bin.filter((e,t)=>{let n=A(o,e);if(!j(n)||x(n).registry===a.registry)return!0;if(a.registry!==``&&t>0)return!1;throw Error(`${n} belongs to another product`)}));if(!j(n)){let t=Nt(A(k(n),`${O(n)}-seed-`));Mt(A(t,`bin`));for(let n of s){let r=A(o,n);zt(Lt(j(r)?r:A(e,`bin`,n)),A(t,`bin`,n))}try{zt(Ot(k(n),t),n)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!jt(n).isSymbolicLink())throw Error(`${n} is not a release symlink`);for(let e of s){let t=Ot(o,A(n,`bin`,e)),r=A(o,`.${e}-${Yt()}`);zt(t,r),Rt(r,A(o,e))}for(let e of s){let t=A(o,e);if(!jt(t).isSymbolicLink()||A(o,It(t))!==A(n,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let c=oo(t,a);if(i===void 0&&c!==null&&Za.compare(c.version,a.version)>0)return c.version;let l=`${n}-${Yt()}`;return zt(Ot(k(n),e),l),Rt(l,n),a.version}function co(e){return e instanceof Error?e.message:String(e)}function lo(){try{return Fa()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}var uo=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers its generated status operation`},{name:`auth`,purpose:`which credential signs in, as which account and role, never secrets`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}],fo=`operationFingerprint`;function po(e,t=x().bin[0]){D(e.command(`doctor`).summary(`One-call selftest: CLI version, schemas, API host, auth scope, command catalog`).description(["Run every environment check in one call and report `{ ok, check: [...] }`:",...uo.map(e=>` - ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) or a`,`warned one (the account read failed) does not fail the run. Each failing message names the command that fixes it.`,"--json always carries the report at `.data`; --data prints the report directly when",`every check passes and the result envelope when one fails, like every other command.`].join(`
|
|
29
29
|
`))).action(async function(e){let n=this.optsWithGlobals();n.environment!==void 0&&(process.env.API_ENV=n.environment),L({mode:E(e)},await mo(t))})}async function mo(e){let t=go(),n=_o(e),[r,i]=await Promise.all([vo(e),yo(t,e)]),a=[n.check,r,i.check,await xo(e),Oo(t,i.servedFingerprint,n.upgradeAvailable,e)],o={pass:ho(a,`pass`),warn:ho(a,`warn`),fail:ho(a,`fail`),skip:ho(a,`skip`)},s=a.filter(e=>e.status===`fail`).map(e=>e.message),c={ok:s.length===0,check:a},l=[`doctor: ${o.pass} pass, ${o.warn} warn, ${o.fail} fail, ${o.skip} skip`,...a.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
|
|
30
|
-
`);return c.ok?v(l,c,{counts:o}):{..._(l,s,{counts:o}),data:c}}function ho(e,t){return e.filter(e=>e.status===t).length}function G(e,t,n){return{name:e,status:t,message:n}}function go(){return T.find(e=>e.intent===`status`&&e.resource===`status`)}function _o(e){let t=x(),n=to(t,`check`);if(!n.ok||n.data===null)return{check:G(`cli-version`,`skip`,`Could not compare ${t.version} against the registry (${n.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:r,currentVersion:i,latestVersion:a,upgradeAvailable:o}=n.data;return{check:o?G(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):G(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function vo(e){try{let{EntityDetailSchema:e}=await import(`./detail-CFSXWI3r.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return G(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return G(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${C(t)}.`)}}async function yo(e,t){if(e===void 0)return{check:G(`api-host`,`skip`,`No status operation resolved from the generated catalog; fix the catalog check first.`),servedFingerprint:null};let n;try{n=y().host}catch(e){return{check:G(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${C(e)}.`),servedFingerprint:null}}let r=await p({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`}).catch(e=>_(C(e)));return r.ok?{check:G(`api-host`,`pass`,`${e.method} ${e.path} answered at ${n}.`),servedFingerprint:bo(r.data)}:{check:G(`api-host`,`fail`,r.httpStatus===401?`Replace or unset the credential ${n} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} returned ${r.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} at ${n} returned ${r.summary}.`),servedFingerprint:null}}function bo(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t[fo];return typeof n==`string`&&n.length>0?n:null}async function xo(e){let t=Ke(),[n,r]=await Promise.all([Co(),wo()]);if(r.state===`unavailable`&&r.cause===`environment`)return G(`auth`,`fail`,`Fix the environment configuration first — ${r.summary}.`);let i=t.present,a=r.state===`found`&&r.stored.activation===`active`;if(!i&&n.state===`invalid`)return G(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${n.summary}.`);if(!i&&n.state===`found`&&rt(n.stored.credential)&&n.stored.credential.tokens.refresh_token===void 0)return G(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`);if(!i&&!a&&n.state===`unavailable`)return G(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${b.authToken} through the environment — ${n.summary}.`);if(i||n.state===`found`||a){let i=await So(e,t);return G(`auth`,i.status,`Credential source available: ${To(t,n,r)}; ${i.text}.`)}return r.state===`unavailable`?G(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${b.authToken} through the environment — ${r.summary}.`):G(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${b.authToken} in the environment.`)}async function So(e,t){let n=w(y().host),r=await ia(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await ra(`write`);if(e===null)return{status:`pass`,text:`${i} host=${n}`};let t=e.rbacRole.length===0?`none`:e.rbacRole.join(`,`);return{status:`pass`,text:`${i} account=${e.email??e.id} role=${t} host=${n}`}}catch(t){return{status:`warn`,text:`${i} account=unread host=${n} — GET /v1/auth/me returned ${C(t,[y().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function Co(){let e;try{e=w(y().host)}catch(e){return{state:`unavailable`,summary:C(e)}}return await lt(e)}async function wo(){let e;try{e=w(y().host)}catch(e){return{state:`unavailable`,summary:C(e),cause:`environment`}}try{return await Ze(e)}catch(e){return{state:`unavailable`,summary:C(e),cause:`storage`}}}function To(e,t,n){return[Da(e),`oauth=${Do(t)}`,`api-key=${Eo(n)}`].join(` `)}function Eo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=w(y().host);return`${e.stored.activation}${fa(t,e)}`}function Do(e){switch(e.state){case`found`:return rt(e.stored.credential)?`expired`:`stored`;case`missing`:return`unset`;case`invalid`:return`invalid`;case`unavailable`:return`unavailable`;default:throw Error(`Unsupported OAuth credential state`)}}function Oo(e,t,n,r){let i=T.length;if(e===void 0)return G(`catalog`,`fail`,`Regenerate the command catalog with \`make mcp-generate-contracts\` and reinstall: none of its ${i} operations is the status operation.`);if(t===null)return G(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${Tt}.`);if(t===`
|
|
30
|
+
`);return c.ok?v(l,c,{counts:o}):{..._(l,s,{counts:o}),data:c}}function ho(e,t){return e.filter(e=>e.status===t).length}function G(e,t,n){return{name:e,status:t,message:n}}function go(){return T.find(e=>e.intent===`status`&&e.resource===`status`)}function _o(e){let t=x(),n=to(t,`check`);if(!n.ok||n.data===null)return{check:G(`cli-version`,`skip`,`Could not compare ${t.version} against the registry (${n.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:r,currentVersion:i,latestVersion:a,upgradeAvailable:o}=n.data;return{check:o?G(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):G(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function vo(e){try{let{EntityDetailSchema:e}=await import(`./detail-CFSXWI3r.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return G(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return G(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${C(t)}.`)}}async function yo(e,t){if(e===void 0)return{check:G(`api-host`,`skip`,`No status operation resolved from the generated catalog; fix the catalog check first.`),servedFingerprint:null};let n;try{n=y().host}catch(e){return{check:G(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${C(e)}.`),servedFingerprint:null}}let r=await p({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`}).catch(e=>_(C(e)));return r.ok?{check:G(`api-host`,`pass`,`${e.method} ${e.path} answered at ${n}.`),servedFingerprint:bo(r.data)}:{check:G(`api-host`,`fail`,r.httpStatus===401?`Replace or unset the credential ${n} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} returned ${r.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} at ${n} returned ${r.summary}.`),servedFingerprint:null}}function bo(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t[fo];return typeof n==`string`&&n.length>0?n:null}async function xo(e){let t=Ke(),[n,r]=await Promise.all([Co(),wo()]);if(r.state===`unavailable`&&r.cause===`environment`)return G(`auth`,`fail`,`Fix the environment configuration first — ${r.summary}.`);let i=t.present,a=r.state===`found`&&r.stored.activation===`active`;if(!i&&n.state===`invalid`)return G(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${n.summary}.`);if(!i&&n.state===`found`&&rt(n.stored.credential)&&n.stored.credential.tokens.refresh_token===void 0)return G(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`);if(!i&&!a&&n.state===`unavailable`)return G(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${b.authToken} through the environment — ${n.summary}.`);if(i||n.state===`found`||a){let i=await So(e,t);return G(`auth`,i.status,`Credential source available: ${To(t,n,r)}; ${i.text}.`)}return r.state===`unavailable`?G(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${b.authToken} through the environment — ${r.summary}.`):G(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${b.authToken} in the environment.`)}async function So(e,t){let n=w(y().host),r=await ia(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await ra(`write`);if(e===null)return{status:`pass`,text:`${i} host=${n}`};let t=e.rbacRole.length===0?`none`:e.rbacRole.join(`,`);return{status:`pass`,text:`${i} account=${e.email??e.id} role=${t} host=${n}`}}catch(t){return{status:`warn`,text:`${i} account=unread host=${n} — GET /v1/auth/me returned ${C(t,[y().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function Co(){let e;try{e=w(y().host)}catch(e){return{state:`unavailable`,summary:C(e)}}return await lt(e)}async function wo(){let e;try{e=w(y().host)}catch(e){return{state:`unavailable`,summary:C(e),cause:`environment`}}try{return await Ze(e)}catch(e){return{state:`unavailable`,summary:C(e),cause:`storage`}}}function To(e,t,n){return[Da(e),`oauth=${Do(t)}`,`api-key=${Eo(n)}`].join(` `)}function Eo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=w(y().host);return`${e.stored.activation}${fa(t,e)}`}function Do(e){switch(e.state){case`found`:return rt(e.stored.credential)?`expired`:`stored`;case`missing`:return`unset`;case`invalid`:return`invalid`;case`unavailable`:return`unavailable`;default:throw Error(`Unsupported OAuth credential state`)}}function Oo(e,t,n,r){let i=T.length;if(e===void 0)return G(`catalog`,`fail`,`Regenerate the command catalog with \`make mcp-generate-contracts\` and reinstall: none of its ${i} operations is the status operation.`);if(t===null)return G(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${Tt}.`);if(t===`6a519761cf496271`)return G(`catalog`,`pass`,`${i} generated operations match the set the API serves (${Tt}).`);let a=`This catalog describes a different operation set than the API serves (${Tt} vs ${t})`;return n===!0?G(`catalog`,`fail`,`${a}: run \`${r} update\`.`):G(`catalog`,`skip`,n===!1?`${a}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${a}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${r} update\` with registry access.`)}var ko=S(z,`oauth`),Ao=[S(z,`start`),S(z,`poll`),S(z,`acknowledge`)],jo=S(z,`revoke`);function Mo(t,n=x().bin[0]){let r=Io(t);po(r,n);let i=[`${ko.description} Default method: OAuth in your browser.`,`With --key: ${Ao.map(({description:e})=>e).join(` `)}`].join(`
|
|
31
31
|
`);D(Fo(r,[ko,...Ao],i)).action(No),D(Fo(r,[jo],jo.description)).action(Po),D(r.command(`status`).summary(`Keep saved credentials current and report them with API build and uptime`).description([`Runs the same credential materialization every command runs, then reports:`,` - auth: whether AUTH_TOKEN was already set in this shell's environment`,` - oauth: the saved OAuth identity and access-token expiry for the selected API host;`,` an expired token is renewed with its refresh token and a token the sign-in service rejects is retired`,` - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated`,` - selected: the credential the next command sends`,` - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)`,` - api: running CLI package version plus GET /info build metadata`,` - system: GET /v1/status response (uptime SLA)`,``,`Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.`,`--verify read|write additionally runs a live permission probe for that scope; it does not`,`execute or authorize an arbitrary API operation.`].join(`
|
|
32
32
|
`)).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){Lo(this),L({mode:E(e)},await Ro(n,e.verify))}),r.command(`token`).summary(`Print the bearer token the next command sends`).description([`Runs the same credential materialization every command runs, then prints the selected`,`bearer token alone on stdout: ${b.authToken} when set, otherwise the saved OAuth`,`access token (renewed when expired) or the saved aVenture API key.`,`Use it where another client needs this CLI's sign-in, such as an MCP client's header helper.`].join(`
|
|
33
33
|
`)).action(async function(){Lo(this);let e=await ia(n),t=process.env[b.authToken]?.trim();if(e.failure===null&&t!==void 0&&t.length>0){process.stdout.write(`${t}\n`);return}L({mode:`text`},e.failure===null?Ko(`auth token: no credentials resolved`,null,n,{oauth:!0,apiKey:!0}):_(`auth token: ${e.failure}`))})}async function No(e){Lo(this);let t=E(e);if(e.providers===!0){L({mode:t},await Bo());return}L({mode:t},e.key===!0?await qi({noBrowser:!e.browser,clientLabel:e.clientLabel}):await pt({noBrowser:!e.browser}))}async function Po(e){Lo(this),L({mode:E(e)},await Ii({forgetLocal:e.forgetLocal===!0}))}function Fo(e,t,n){let[r]=t,i=e.command(r.command.slice(r.command.indexOf(` `)+1)).summary(r.summary).description(n),a=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])a.has(t.flag)||(a.add(t.flag),`required`in t&&t.required?i.requiredOption(t.flag,t.description):i.option(t.flag,t.description));return i}function Io(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${ko.command}\`: ${ko.summary}; \`--key\` ${Ao[0].summary.toLowerCase()}.`,`\`${jo.command}\`: ${jo.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build and uptime.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth token` prints the bearer token the next command sends."].join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,r as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{r as m,s as ee,t as h,u as g}from"./result-envelope-DTzTOcab.js";import{a as _}from"./package-DPDX5zmx.js";import{a as te,c as ne,i as re,o as ie,s as ae}from"./tool-policy-Dg1Wd9Z7.js";import{C as oe,S as se,T as ce,_ as le,a as ue,b as v,c as de,d as fe,f as pe,g as me,h as he,i as ge,l as _e,m as ve,n as ye,o as be,p as xe,r as y,s as Se,t as b,u as Ce,v as we,w as Te,x as Ee,y as De}from"./detail-D07FzRkx.js";import{a as Oe,n as x,r as S,t as C}from"./text-field-r9akQrZl.js";import{a as ke,o as Ae}from"./cli-help-policy-J-foY8Og.js";import{Buffer as je}from"node:buffer";var w=o([`HIGH`,`MEDIUM`,`LOW`]),Me=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),f()]),Ne=p({excerpt:f(),sourceId:f(),sourceType:Me,sourceVersion:f().nullish()}),Pe=p({instruction:f(),operationId:f(),stepKey:f()}),Fe=p({body:f(),expectation:f(),method:i(f()),override:f(),reject:i(f()),typeCatalog:f()}),Ie=p({cliCommand:f(),mcpTool:f().nullish(),step:Pe,writeGuidance:Fe.nullish()}),Le=n([o([`ENTITY`,`TEXT`]),f()]),Re=p({description:f(),key:f(),type:Le}),ze=p({catalogRevision:s(),gateId:i(f()),input:i(Re),step:i(Ie),taskKey:f()}),T=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Be=p({candidate:i(Ne),operationId:f().nullish(),outcome:T,probability:d().nullish(),taskKey:f().nullish(),taskPlan:ze.nullish()}),Ve=p({answer:f(),citation:i(Ne),confidence:w,resolution:Be.nullish()});function E(e,t,n=t.inputName){if(t.in===`body`)return n;let r=Ze.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?Xe(D(n!==`id`&&n!==`slug`?n:`${We(e.path)}${qe(n)}`),t):r.inputName}function He(e,t,n=Ke(e)){return Ue(Ge(e,t),new Set(n))}function Ue(e,t){if(!t.has(e))return e;let n=`body${qe(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function We(e){return Qe.find(([,t])=>t.test(e))?.[0]??`record`}function Ge(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Je(t);return Xe(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?D(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function Ke(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>E(e,t)))}function qe(e){return e.replace(/^./u,e=>e.toUpperCase())}function D(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 Je(e){let t=D(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Ye(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Ye(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function Xe(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var Ze=[{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`}],Qe=[[`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 $e(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>et(t,E(e,t))),r=(t?.parameter??[]).map(t=>et(t,He(e,t)));return{selector:n.filter(e=>e.location===`path`||tt(e)),pagination:n.filter(nt),filter:[...n.filter(O),...r.filter(O)],body:r.filter(e=>!O(e))}}function et(e,t){return{name:e.in===`body`?t:e.name,flag:re(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function tt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function nt(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function O(e){return e.location!==`path`&&!tt(e)&&!nt(e)}function rt(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:it(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:$e(e)}:{...r,optionalInput:at(e)}}function it(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function at(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 ot=160;function st(e){return!Array.isArray(e)||e.length===0||!e.every(ct)?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`:``}): ${e.description.length<=ot?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
|
|
2
|
-
`)}\n`}function ct(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 lt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(ut);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.split(/[.[]/u)[0]))];return{tool:ae(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 ut(e){return[e.name,`<${e.name}>`]}function dt(e){let t=k(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function k(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 A=2,ft=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 j(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&j(e,`person`),ht(e,pt(n),n),ht(e,mt(n),n))}function pt(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=A&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>A&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function mt(e){return e===`person`?`people`:e.length>=A&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function ht(e,t,n){t!==void 0&&t!==n&&t.length>=A&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)j(t,e);return t}function gt(e){return N(e).map(M)}function _t(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!ft.has(e))}function P(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 vt=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,yt=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,bt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,xt=250,St=40,Ct=100;function wt(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(yt,()=>(n.add(`uuid`),` `)).replace(vt,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&bt.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=bt.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 Tt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function Et(e,t){let n=new Set;for(let r of e){let e=new Set;j(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 Dt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Tt(t,e,n.path))&&(i+=xt,r.has(t)&&(i+=St));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return j(t,e),[...t].some(e=>a.has(e))}))&&(i+=Ct),i}var Ot=5,kt=.5,At=15,jt=30,Mt=2;function Nt(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=wt(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=Et(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=gt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Lt(o,s,c,t))+Dt(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 Pt(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 Ft(e,t){let n=Nt(e.q?.trim()??``,t.filter(t=>It(e,t)),Pt),r=(n[0]?.score??0)*kt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Ot: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=>rt(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function It(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 Lt(e,t,n,r){let i=Bt(r),a=Rt(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=zt(e,i);let s=new Set(i.flatMap(N));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;j(n,e),[...n].some(e=>t.has(e))&&(o+=At)}_t(n,a)&&(o+=200),r.parameterName.some(t=>P(t)===e)&&(o+=jt);let c=new Set(r.parameterDescription.flatMap(N));for(let e of t)c.has(e)&&(o+=Mt);return o+=Ht(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Vt(e,t,r.description),o}function Rt(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function zt(e,t){let n=N(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 Bt(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,k(e.description).useFor||e.description].map(P).filter(e=>e.length>0))]}function Vt(e,t,n){let r=P(k(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ht(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Ut(e,t))&&(n+=i?40:10);return n}function Ut(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}function Wt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Gt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return m(`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 m(`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=Ve.safeParse(Wt(o));if(!s.success||s.data.resolution==null)return m(`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,p=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),h=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...p.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return ee(h.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${h.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}`,...dt(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:lt(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:p.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:lt(e)})}}},{warnings:h.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 Kt=p({detail:f(),field:f().nullish(),scope:o([`entity`,`person`,`news`])}),qt=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),f()]),F=p({modeRequested:qt,modeUsed:qt}),Jt=p({answerUnavailable:u(),entity:F,news:F,person:F,rejection:i(Kt),unavailable:i(o([`entity`,`person`,`news`]))}),Yt=p({acceleratorParticipation:i(xe),detail:i(fe)}),I=p({core:v,enrichment:Ee,fundraiseRound:i(me),research:Yt,semanticMatch:ue.nullish()}),Xt=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),Zt=p({compositeScore:d().nullish(),cosineScore:d().nullish(),curatedAsOf:c().nullish(),curatedRelationshipType:f().nullish(),curatedSource:f().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:d().nullish(),origin:Xt,rank:s(),sharedSectionCount:s().nullish()}),Qt=p({entity:I,similarity:Zt}),$t=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),en=p({author:f().nullish(),createdAt:r({offset:!0}),externalId:f().nullish(),id:t(),isCurrent:u(),lastFetchedAt:r({offset:!0}).nullish(),mentionedEntityId:i(t()),mentionedPersonId:i(t()),owner:l,publishedAt:r({offset:!0}).nullish(),summary:f().nullish(),summaryGeneratedAt:r({offset:!0}).nullish(),title:f().nullish(),topic:f().nullish(),type:$t,updatedAt:r({offset:!0}),url:f()}),tn=o([`low`,`medium`,`high`]),nn=p({asOfDate:r({offset:!0}).nullish(),dataConfidence:tn.nullish(),dateValue:r({offset:!0}).nullish(),numericValue:d().nullish(),referenceValue:f().nullish(),source:f().nullish(),textValue:f().nullish(),updatedAt:r({offset:!0}).nullish(),valueType:pe}),rn=p({asOfDate:r({offset:!0}),fact:nn,id:f()}),an=p({fundraiseInvestorJoin:u(),fundraiseTransaction:u(),operatingStatus:u(),relationship:u()}),on=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),sn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),cn=p({acquiredEntity:v,acquirerEntity:v,amount:d().int().nullish(),announcedAt:r({offset:!0}).nullish(),asOf:c().nullish(),completedAt:r({offset:!0}).nullish(),createdAt:r({offset:!0}).nullish(),currency:f().nullish(),dataConfidence:De.nullish(),evidence:an,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),publicSource:he.nullish(),relationshipId:s(),status:on,transactionStatus:sn.nullish(),updatedAt:r({offset:!0}).nullish()}),ln=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),un=p({amountInvested:d().nullish(),createdAt:r({offset:!0}),financialInstrumentType:ln.nullish(),id:t(),investor:l,leadInvestor:u(),transactionId:t(),updatedAt:r({offset:!0})}),dn=p({entity:b,investorAttribution:i(le),round:i(we),roundCount:s()}),fn=p({core:v,similarity:Zt,urlLink:i(se)}),pn=p({compliance:Ce.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:u().nullish(),isPrimary:u().nullish(),language:f().nullish(),owner:l,text:f(),textName:f().nullish(),textType:f(),updatedAt:r({offset:!0}).nullish()}),mn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),hn=o([`fundraiseRound`,`researchDetail`]),gn=o([`preMoney`,`postMoney`,`reported`]),_n=p({amountRaised:d().int().nullish(),asOfDate:r({offset:!0}),confidence:tn,currency:f(),declaredBasis:gn,derivation:mn,detailId:s().nullish(),label:f().nullish(),source:hn,sourceRef:f(),valuationPostMoney:d().int().nullish(),valuationPreMoney:d().int().nullish()}),vn=p({createdAt:r({offset:!0}).nullish(),description:f().nullish(),forkCount:s(),githubId:d().int(),homepageUrl:f().nullish(),id:d().int(),isArchived:u(),isFork:u(),language:f().nullish(),license:f().nullish(),name:f(),ownerLogin:f(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(f()),updatedAt:r({offset:!0}).nullish(),url:f()}),L=p({empty:u().optional(),sorted:u().optional(),unsorted:u().optional()}),R=p({offset:d().int().optional(),paged:u().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:L.optional(),unpaged:u().optional()}),yn=p({investorAttribution:i(le),person:y,round:i(we),roundCount:s()}),bn=o([`precomputed`,`live`]),xn=p({compositeScore:d().nullish(),cosineScore:d().nullish(),matchedSectionWeight:d().nullish(),origin:bn,rank:s(),sharedSectionCount:s().nullish()}),Sn=p({currentRole:Se.nullish(),person:ge,similarity:xn}),Cn=o([`by`,`about`]),wn=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),Tn=p({canonicalUrl:f().nullish(),contentId:f(),contentType:wn,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:Cn.nullish(),sourceDomain:f().nullish(),sourceName:f().nullish(),summary:f().nullish(),title:f(),topic:f().nullish(),updatedAt:r({offset:!0}).nullish(),url:f().nullish(),year:s().nullish()});p({content:i(en).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(n([ce,Te])).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(rn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(v).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(cn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(b).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(un).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(me).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(dn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(I).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ve).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(fe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(_e).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Qt).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(fn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(pn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(_n).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(vn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(de).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ge).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(y).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(be).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(yn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Sn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Tn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var En=p({content:i(I),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),Dn=p({content:i(de),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),On=p({content:i(ge),number:s(),size:s(),totalElements:d().int(),totalPages:s()});p({content:i(ye).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var kn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),f()]),An=p({entityId:t(),source:kn,sourceId:f()}),jn=p({citation:i(An),text:f(),topic:f().nullish()}),Mn=p({citation:i(An),confidence:w,description:f().nullish(),heading:f().nullish(),paragraph:i(jn),relatedQuery:i(f()),shareable:u(),text:f(),title:f().nullish()}),Nn=p({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Pn=p({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),z=p({max:d().nullish(),min:d().nullish()}),B=p({max:s().nullish(),min:s().nullish()}),Fn=p({averageAmountInvestedUsdRange:i(z).optional(),largestAmountInvestedUsdRange:i(z).optional(),smallestAmountInvestedUsdRange:i(z).optional(),totalAmountInvestedUsdRange:i(z).optional(),totalInvestmentRange:i(B).optional()}),In=p({amountInvestedRange:i(z).optional(),amountRaisedRange:i(z).optional(),dateAnnouncedRange:Pn.nullish(),investedCompanyName:i(f()).optional(),investedCountry:i(f()).optional(),investedIndustry:i(f()).optional(),investedRound:i(f()).optional(),investorActivity:Fn.optional(),investorName:i(f()).optional(),lastRoundYearRange:i(B).optional(),rankByInvestmentActivity:u().nullish(),round:i(f()).optional(),totalRaisedRange:i(z).optional(),valuationRange:i(z).optional()}),Ln=o([`NONE`,`COMPANY_LISTING_READY`]),Rn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),zn=o([`hostPath`,`domain`]),Bn=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(B).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:In.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:Nn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Ln.optional(),rankByProminence:u().nullish(),semanticQuery:f().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:zn.nullish(),urlType:oe.nullish(),yearFoundedRange:i(B).optional()}),Vn=o([`discovery`,`profile`,`peer`,`comparison`]),Hn=o([`keyword`,`semantic`]),Un=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`]),f()]),Wn=p({descending:u(),field:Un,sortKey:f().nullish()}),Gn=p({order:i(Wn),relevance:Hn.nullish()}),Kn=p({confidence:w,execution:F,fallbackUsed:u(),filter:Bn,intent:Vn,interpretation:f(),sort:Gn,subjectEntityName:i(f()),unsupported:f().nullish()}),qn=p({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:f().nullish(),status:f().nullish()}),Jn=p({fundManagerRelationshipSource:qn.nullish(),fundraiseTransaction:me,fundraiseTransactionSource:qn.nullish(),investorJoinSource:qn.nullish()}),Yn=p({evidence:Jn,investor:l,semanticMatch:ue.nullish()}),Xn=p({entityId:t(),matchedOffering:v.nullish(),probability:d(),webUrl:i(f())}),Zn=p({entityId:t(),label:f(),publishedAt:r({offset:!0}).nullish(),score:d(),source:kn,sourceId:f(),text:f(),url:f().nullish()}),Qn=p({answer:Mn.nullish(),interpretation:Kn,investment:i(Yn),judgment:i(Xn),passage:i(Zn),peer:i(Qt),pendingWebQuery:i(f()),result:En,searchRequestId:t().nullish(),subject:i(I)}),$n=o([`auto-match`,`needs-review`,`approved`,`rejected`]),er=p({createdAt:r({offset:!0}),entityId:t(),href:f().nullish(),internal:u(),matchStatus:$n.nullish(),mention:f().nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),tr=p({entity:i(er),newsId:s()}),nr=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(B).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:In.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:Nn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Ln.optional(),rankByProminence:u().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:zn.nullish(),urlType:oe.nullish(),yearFoundedRange:i(B).optional()}),rr=p({amountInvestedRange:i(z).nullish(),amountRaisedRange:i(z).nullish(),entityName:i(f()).nullish(),investedCompany:i(f()).nullish(),personTitle:i(f()).nullish(),round:i(f()).nullish(),totalInvestmentCount:i(B).nullish(),typeRecord:i(a).nullish()}),ir=p({arrayFilter:rr.optional(),entityFilter:nr.optional(),entityId:t().nullish(),entitySlug:f().nullish(),firstName:f().nullish(),includeAddress:u().nullish(),includeUrl:u().nullish(),investorActivity:Fn.optional(),isCurrent:u().nullish(),lastName:f().nullish(),letter:f().nullish(),personId:i(t()).max(200).optional(),personName:i(f()).optional(),role:f().nullish(),search:f().nullish(),semanticQuery:f().nullish(),status:f().nullish()}),ar=p({descending:u(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:f().nullish()}),or=p({order:i(ar),relevance:Hn.nullish()}),sr=p({confidence:w,execution:F,fallbackUsed:u(),filter:ir,interpretation:f(),sort:or,unsupported:f().nullish()}),cr=p({interpretation:sr,investment:i(Yn),result:On,searchRequestId:t().nullish()}),lr=p({label:f(),query:f()}),ur=p({key:f(),option:i(lr),prompt:f()}),dr=p({entity:Qn,entityDetail:i(b),news:Dn,newsEntityMention:i(tr),person:cr,personDetail:i(y),provenance:Jt,qualifier:ur.nullish()});function fr(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>pr(e)),...n.flatMap(e=>e.parameter.map(t=>pr(t,n.length>1?e.contentType:void 0))),...mr(n)],i=[t,...e.cliPath].join(` `),a=ie(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:te(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ne(e.path)?null:ae(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,successResponse:e.successResponse,summary:e.summary,description:e.description,deprecated:e.deprecated}})}function pr(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 mr(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 hr(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var gr=[`-id`,`-slug`,`-url`],_r=[`--id`,`--slug`,`--url`],vr=`/v1/lookup`,yr=`--from-file "<path>"`;function br(e,t,n=_().bin[0]){let r=fr(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:wr(i,r)}function xr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:fr([r],n);return i&&Cr(i,Dr(i,!1))}function Sr(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 xr(o.operationId,t,r)}function Cr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function wr(e,t){return[`example: ${Cr(e,Dr(e))}`,...Tr(e,t)]}function Tr(e,t){return hr(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} ${kr(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===vr),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} ${kr(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Er=/(?:^|\.)text$/u;function Dr(e,t=!0){let n=hr(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Er.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:Or(e)).map(kr);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,yr]:i}function Or(e){let t=new Set;j(t,e.resource);for(let n of gr)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 _r){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function kr(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 xr(e,t,`aventure`)??n}function Nr(e,t){let n=Ve.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(`
|
|
2
|
+
`)}\n`}function ct(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 lt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(ut);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.split(/[.[]/u)[0]))];return{tool:ae(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 ut(e){return[e.name,`<${e.name}>`]}function dt(e){let t=k(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function k(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 A=2,ft=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 j(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&j(e,`person`),ht(e,pt(n),n),ht(e,mt(n),n))}function pt(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=A&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>A&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function mt(e){return e===`person`?`people`:e.length>=A&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function ht(e,t,n){t!==void 0&&t!==n&&t.length>=A&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)j(t,e);return t}function gt(e){return N(e).map(M)}function _t(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!ft.has(e))}function P(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 vt=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,yt=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,bt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,xt=250,St=40,Ct=100;function wt(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(yt,()=>(n.add(`uuid`),` `)).replace(vt,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&bt.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=bt.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 Tt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function Et(e,t){let n=new Set;for(let r of e){let e=new Set;j(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 Dt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Tt(t,e,n.path))&&(i+=xt,r.has(t)&&(i+=St));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return j(t,e),[...t].some(e=>a.has(e))}))&&(i+=Ct),i}var Ot=5,kt=.5,At=15,jt=30,Mt=2;function Nt(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=wt(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=Et(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=gt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Lt(o,s,c,t))+Dt(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 Pt(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 Ft(e,t){let n=Nt(e.q?.trim()??``,t.filter(t=>It(e,t)),Pt),r=(n[0]?.score??0)*kt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Ot: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=>rt(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function It(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 Lt(e,t,n,r){let i=Bt(r),a=Rt(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=zt(e,i);let s=new Set(i.flatMap(N));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;j(n,e),[...n].some(e=>t.has(e))&&(o+=At)}_t(n,a)&&(o+=200),r.parameterName.some(t=>P(t)===e)&&(o+=jt);let c=new Set(r.parameterDescription.flatMap(N));for(let e of t)c.has(e)&&(o+=Mt);return o+=Ht(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Vt(e,t,r.description),o}function Rt(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function zt(e,t){let n=N(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 Bt(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,k(e.description).useFor||e.description].map(P).filter(e=>e.length>0))]}function Vt(e,t,n){let r=P(k(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ht(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Ut(e,t))&&(n+=i?40:10);return n}function Ut(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}function Wt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Gt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return m(`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 m(`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=Ve.safeParse(Wt(o));if(!s.success||s.data.resolution==null)return m(`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,p=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),h=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...p.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return ee(h.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${h.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}`,...dt(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:lt(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:p.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:lt(e)})}}},{warnings:h.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 Kt=p({detail:f(),field:f().nullish(),scope:o([`entity`,`person`,`news`])}),qt=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),f()]),F=p({modeRequested:qt,modeUsed:qt}),Jt=p({answerUnavailable:u(),entity:F,news:F,person:F,rejection:i(Kt),unavailable:i(o([`entity`,`person`,`news`]))}),Yt=p({acceleratorParticipation:i(xe),detail:i(fe)}),I=p({core:v,enrichment:Ee,fundraiseRound:i(me),research:Yt,semanticMatch:ue.nullish()}),Xt=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),Zt=p({compositeScore:d().nullish(),cosineScore:d().nullish(),curatedAsOf:c().nullish(),curatedRelationshipType:f().nullish(),curatedSource:f().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:d().nullish(),origin:Xt,rank:s(),sharedSectionCount:s().nullish()}),Qt=p({entity:I,similarity:Zt}),$t=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),en=p({author:f().nullish(),createdAt:r({offset:!0}),externalId:f().nullish(),id:t(),isCurrent:u(),lastFetchedAt:r({offset:!0}).nullish(),mentionedEntityId:i(t()),mentionedPersonId:i(t()),owner:l,publishedAt:r({offset:!0}).nullish(),summary:f().nullish(),summaryGeneratedAt:r({offset:!0}).nullish(),title:f().nullish(),topic:f().nullish(),type:$t,updatedAt:r({offset:!0}),url:f()}),tn=o([`low`,`medium`,`high`]),nn=p({asOfDate:r({offset:!0}).nullish(),dataConfidence:tn.nullish(),dateValue:r({offset:!0}).nullish(),numericValue:d().nullish(),referenceValue:f().nullish(),source:f().nullish(),textValue:f().nullish(),updatedAt:r({offset:!0}).nullish(),valueType:pe}),rn=p({asOfDate:r({offset:!0}),fact:nn,id:f()}),an=p({fundraiseInvestorJoin:u(),fundraiseTransaction:u(),operatingStatus:u(),relationship:u()}),on=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),sn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),cn=p({acquiredEntity:v,acquirerEntity:v,amount:d().int().nullish(),announcedAt:r({offset:!0}).nullish(),asOf:c().nullish(),completedAt:r({offset:!0}).nullish(),createdAt:r({offset:!0}).nullish(),currency:f().nullish(),dataConfidence:De.nullish(),evidence:an,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),isCurrent:u().nullish(),publicSource:he.nullish(),relationshipId:s(),status:on,transactionStatus:sn.nullish(),updatedAt:r({offset:!0}).nullish()}),ln=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),un=p({amountInvested:d().nullish(),createdAt:r({offset:!0}),financialInstrumentType:ln.nullish(),id:t(),investor:l,leadInvestor:u(),transactionId:t(),updatedAt:r({offset:!0})}),dn=p({entity:b,investorAttribution:i(le),round:i(we),roundCount:s()}),fn=p({core:v,similarity:Zt,urlLink:i(se)}),pn=p({compliance:Ce.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:u().nullish(),isPrimary:u().nullish(),language:f().nullish(),owner:l,text:f(),textName:f().nullish(),textType:f(),updatedAt:r({offset:!0}).nullish()}),mn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),hn=o([`fundraiseRound`,`researchDetail`]),gn=o([`preMoney`,`postMoney`,`reported`]),_n=p({amountRaised:d().int().nullish(),asOfDate:r({offset:!0}),confidence:tn,currency:f(),declaredBasis:gn,derivation:mn,detailId:s().nullish(),label:f().nullish(),source:hn,sourceRef:f(),valuationPostMoney:d().int().nullish(),valuationPreMoney:d().int().nullish()}),vn=p({createdAt:r({offset:!0}).nullish(),description:f().nullish(),forkCount:s(),githubId:d().int(),homepageUrl:f().nullish(),id:d().int(),isArchived:u(),isFork:u(),language:f().nullish(),license:f().nullish(),name:f(),ownerLogin:f(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(f()),updatedAt:r({offset:!0}).nullish(),url:f()}),L=p({empty:u().optional(),sorted:u().optional(),unsorted:u().optional()}),R=p({offset:d().int().optional(),paged:u().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:L.optional(),unpaged:u().optional()}),yn=p({investorAttribution:i(le),person:y,round:i(we),roundCount:s()}),bn=o([`precomputed`,`live`]),xn=p({compositeScore:d().nullish(),cosineScore:d().nullish(),matchedSectionWeight:d().nullish(),origin:bn,rank:s(),sharedSectionCount:s().nullish()}),Sn=p({currentRole:Se.nullish(),person:ge,similarity:xn}),Cn=o([`by`,`about`]),wn=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),Tn=p({canonicalUrl:f().nullish(),contentId:f(),contentType:wn,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:Cn.nullish(),sourceDomain:f().nullish(),sourceName:f().nullish(),summary:f().nullish(),title:f(),topic:f().nullish(),updatedAt:r({offset:!0}).nullish(),url:f().nullish(),year:s().nullish()});p({content:i(en).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(n([ce,Te])).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(rn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(v).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(cn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(b).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(un).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(me).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(dn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(I).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ve).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(fe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(_e).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Qt).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(fn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(pn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(_n).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(vn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(de).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ge).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(y).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(be).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(yn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Sn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Tn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var En=p({content:i(I),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),Dn=p({content:i(de),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),On=p({content:i(ge),number:s(),size:s(),totalElements:d().int(),totalPages:s()});p({content:i(ye).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var kn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),f()]),An=p({entityId:t(),source:kn,sourceId:f()}),jn=p({citation:i(An),text:f(),topic:f().nullish()}),Mn=p({citation:i(An),confidence:w,description:f().nullish(),heading:f().nullish(),paragraph:i(jn),relatedQuery:i(f()),shareable:u(),text:f(),title:f().nullish()}),Nn=p({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Pn=p({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),z=p({max:d().nullish(),min:d().nullish()}),B=p({max:s().nullish(),min:s().nullish()}),Fn=p({averageAmountInvestedUsdRange:i(z).optional(),largestAmountInvestedUsdRange:i(z).optional(),smallestAmountInvestedUsdRange:i(z).optional(),totalAmountInvestedUsdRange:i(z).optional(),totalInvestmentRange:i(B).optional()}),In=p({amountInvestedRange:i(z).optional(),amountRaisedRange:i(z).optional(),dateAnnouncedRange:Pn.nullish(),investedCompanyName:i(f()).optional(),investedCountry:i(f()).optional(),investedIndustry:i(f()).optional(),investedRound:i(f()).optional(),investorActivity:Fn.optional(),investorName:i(f()).optional(),lastRoundYearRange:i(B).optional(),rankByInvestmentActivity:u().nullish(),round:i(f()).optional(),totalRaisedRange:i(z).optional(),valuationRange:i(z).optional()}),Ln=o([`NONE`,`COMPANY_LISTING_READY`]),Rn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),zn=o([`hostPath`,`domain`]),Bn=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(B).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:In.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:Nn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Ln.optional(),rankByProminence:u().nullish(),semanticQuery:f().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:zn.nullish(),urlType:oe.nullish(),yearFoundedRange:i(B).optional()}),Vn=o([`discovery`,`profile`,`peer`,`comparison`]),Hn=o([`keyword`,`semantic`]),Un=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`]),f()]),Wn=p({descending:u(),field:Un,sortKey:f().nullish()}),Gn=p({order:i(Wn),relevance:Hn.nullish()}),Kn=p({confidence:w,execution:F,fallbackUsed:u(),filter:Bn,intent:Vn,interpretation:f(),sort:Gn,subjectEntityName:i(f()),unsupported:f().nullish()}),qn=p({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:f().nullish(),status:f().nullish()}),Jn=p({fundManagerRelationshipSource:qn.nullish(),fundraiseTransaction:me,fundraiseTransactionSource:qn.nullish(),investorJoinSource:qn.nullish()}),Yn=p({evidence:Jn,investor:l,semanticMatch:ue.nullish()}),Xn=p({entityId:t(),matchedOffering:v.nullish(),probability:d(),webUrl:i(f())}),Zn=p({entityId:t(),label:f(),publishedAt:r({offset:!0}).nullish(),score:d(),source:kn,sourceId:f(),text:f(),url:f().nullish()}),Qn=p({answer:Mn.nullish(),interpretation:Kn,investment:i(Yn),judgment:i(Xn),passage:i(Zn),peer:i(Qt),pendingWebQuery:i(f()),result:En,searchRequestId:t().nullish(),subject:i(I)}),$n=o([`auto-match`,`needs-review`,`approved`,`rejected`]),er=p({createdAt:r({offset:!0}),entityId:t(),href:f().nullish(),internal:u(),matchStatus:$n.nullish(),mention:f().nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),tr=p({entity:i(er),newsId:s()}),nr=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(B).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:In.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:Nn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Ln.optional(),rankByProminence:u().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:zn.nullish(),urlType:oe.nullish(),yearFoundedRange:i(B).optional()}),rr=p({amountInvestedRange:i(z).nullish(),amountRaisedRange:i(z).nullish(),entityName:i(f()).nullish(),investedCompany:i(f()).nullish(),personTitle:i(f()).nullish(),round:i(f()).nullish(),totalInvestmentCount:i(B).nullish(),typeRecord:i(a).nullish()}),ir=p({arrayFilter:rr.optional(),entityFilter:nr.optional(),entityId:t().nullish(),entitySlug:f().nullish(),firstName:f().nullish(),includeAddress:u().nullish(),includeUrl:u().nullish(),investorActivity:Fn.optional(),isCurrent:u().nullish(),lastName:f().nullish(),letter:f().nullish(),personId:i(t()).max(200).optional(),personName:i(f()).optional(),role:f().nullish(),search:f().nullish(),semanticQuery:f().nullish(),status:f().nullish()}),ar=p({descending:u(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:f().nullish()}),or=p({order:i(ar),relevance:Hn.nullish()}),sr=p({confidence:w,execution:F,fallbackUsed:u(),filter:ir,interpretation:f(),sort:or,unsupported:f().nullish()}),cr=p({interpretation:sr,investment:i(Yn),result:On,searchRequestId:t().nullish()}),lr=p({label:f(),query:f()}),ur=p({key:f(),option:i(lr),prompt:f()}),dr=p({entity:Qn,entityDetail:i(b),news:Dn,newsEntityMention:i(tr),person:cr,personDetail:i(y),provenance:Jt,qualifier:ur.nullish()});function fr(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>pr(e)),...n.flatMap(e=>e.parameter.map(t=>pr(t,n.length>1?e.contentType:void 0))),...mr(n)],i=[t,...e.cliPath].join(` `),a=ie(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:te(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ne(e.path)?null:ae(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,successResponse:e.successResponse,summary:e.summary,description:e.description,deprecated:e.deprecated}})}function pr(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 mr(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 hr(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var gr=[`-id`,`-slug`,`-url`],_r=[`--id`,`--slug`,`--url`],vr=`/v1/lookup`,yr=`--from-file "<path>"`;function br(e,t,n=_().bin[0]){let r=fr(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:wr(i,r)}function xr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:fr([r],n);return i&&Cr(i,Dr(i,!1))}function Sr(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 xr(o.operationId,t,r)}function Cr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function wr(e,t){return[`example: ${Cr(e,Dr(e))}`,...Tr(e,t)]}function Tr(e,t){return hr(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} ${kr(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===vr),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} ${kr(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Er=/(?:^|\.)text$/u;function Dr(e,t=!0){let n=hr(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Er.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:Or(e)).map(kr);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,yr]:i}function Or(e){let t=new Set;j(t,e.resource);for(let n of gr)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 _r){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function kr(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 xr(e,t,`aventure`)??n}function Nr(e,t){let n=Ve.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
3
|
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Me.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 T.enum.TASK_PLAN:return[...l,...c==null?[]:Lr(c,n),...u];case T.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 T.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...zr(`Candidates:`,o,n),...u];case T.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=ze.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 Z(t);let r=st(t);if(r!==null)return Z(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 Z(l.join(`
|
|
4
4
|
`),!0);let u=Kr(c.endpoint,c.response);if(u!==null)return Z([...u,...s].join(`
|
|
5
5
|
`),!0,s.length>0);let d=c.summary??n??c.operationId??`OpenAPI call succeeded`,f=Xr(c);return Z([...[d,`${c.method} ${c.endpoint}`,...f].filter(e=>e.length>0),...s].join(`
|