@aventurevc/aventure-cli 0.8.196 → 0.8.199
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-CPuVdR-Q.js → aventure-cli-CjXfNdOa.js} +3 -3
- package/dist/chunks/{contract-BCoMISWF.js → contract-B1MvlYuT.js} +2 -2
- package/dist/chunks/dist-xrqtDyeI.js +96 -0
- package/dist/chunks/mcp-generation-contract-B38S8qQE.js +1 -0
- package/dist/chunks/mcp-generation-contract-D-p0mvSF.js +1 -0
- package/dist/chunks/oauth-bearer-credential-CutYWaSm.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-DW6zM32G.js → oauth-bearer-credential-DSX-Cwti.js} +2 -2
- package/dist/chunks/oauth-login-0LgCGJ0L.js +1 -0
- package/dist/chunks/{oauth-login-D_PpxlBP.js → oauth-login-C2ZmHALg.js} +1 -1
- package/dist/chunks/openapi-commands-BfxQPFq0.js +1 -0
- package/dist/chunks/openapi-commands-Cwb98Gke.js +1 -0
- package/dist/chunks/provider-catalog-ax6L3FGV.js +1 -0
- package/package.json +3 -3
- package/dist/chunks/dist-v1GAHosY.js +0 -96
- package/dist/chunks/mcp-generation-contract-Bmx49Hpp.js +0 -1
- package/dist/chunks/mcp-generation-contract-lxcx7gLX.js +0 -1
- package/dist/chunks/oauth-bearer-credential-CKfz8VPN.js +0 -1
- package/dist/chunks/oauth-login-CYf32t8v.js +0 -1
- package/dist/chunks/openapi-commands-BoRwNe7g.js +0 -1
- package/dist/chunks/openapi-commands-DIuQ8XlI.js +0 -1
- package/dist/chunks/provider-catalog-DurM1lDw.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-Cwy984IU.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-Cwy984IU.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-CutYWaSm.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-Dveg8-tD.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-LNDg1dMo.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CxrRvM47.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-CzJeKex3.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-Cwb98Gke.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-CjXfNdOa.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-16T16:12:33.237Z",
|
|
5
5
|
"totalOperations": 137,
|
|
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{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{i as a,o}from"./logging-DWmYww3b.js";import{i as s,o as c,r as l,s as u,t as d,u as f}from"./env-B9uL61wg.js";import{M as p,O as m,i as h,o as g,v as ee,w as _,y as v}from"./person-owner-BJgNYLKX.js";import{Ar as te,Br as ne,Mr as y,Or as re,Pr as ie,jr as ae,kr as oe,zr as se}from"./dist-v1GAHosY.js";import{c as b,d as ce,i as x,r as le}from"./result-envelope-BBFor6Nu.js";import{a as S,n as ue,r as de,t as fe}from"./package-DPDX5zmx.js";import{_ as pe,b as me,c as he,i as ge,s as _e,t as ve,v as ye,y as be}from"./tool-policy-Sqbr-k6c.js";import{i as xe,r as Se}from"./response-problem-Dj9cX_Hi.js";import{n as Ce,r as we}from"./output-spill-CoK0mCjN.js";import{S as Te,a as Ee,c as De,d as Oe,g as ke,i as Ae,l as je,n as C,o as Me,p as Ne,r as Pe,s as Fe,u as Ie,y as Le}from"./contract-BCoMISWF.js";import{a as Re,c as ze,i as Be,l as Ve,n as He,s as Ue,t as We}from"./cli-help-policy-C6yTxEcB.js";import{S as Ge,_ as Ke,a as qe,g as w,h as Je,i as Ye,m as Xe,n as Ze,p as Qe,r as $e,s as et,t as tt,v as nt,x as T,y as rt}from"./api-key-bearer-credential-Mec0ISD_.js";import{a as it,c as at,d as ot,g as st,l as ct,m as lt,o as ut,s as dt,t as ft,u as pt}from"./oauth-bearer-credential-DW6zM32G.js";import{n as mt,r as ht,t as gt}from"./oauth-login-D_PpxlBP.js";import{a as _t,c as vt,d as yt,i as bt,l as xt,n as St,o as Ct,s as wt,t as Tt,u as Et}from"./startup-auth-BSGrOwna.js";import{n as Dt,t as E}from"./openapi-commands-DIuQ8XlI.js";import{i as D,r as Ot,t as O}from"./output-mode-DMR_O_LS.js";import{spawnSync as kt}from"node:child_process";import{basename as k,dirname as A,relative as At,resolve as j,sep as jt}from"node:path";import{copyFileSync as Mt,existsSync as M,lstatSync as Nt,mkdirSync as Pt,mkdtempSync as Ft,readFileSync as It,readdirSync as Lt,readlinkSync as Rt,realpathSync as zt,renameSync as Bt,symlinkSync as Vt,writeFileSync as Ht}from"node:fs";import N,{stderr as P,stdin as Ut}from"node:process";import{TextDecoder as Wt,inspect as Gt}from"node:util";import{homedir as Kt,hostname as qt,platform as Jt}from"node:os";import{fileURLToPath as Yt}from"node:url";import{setTimeout as Xt}from"node:timers/promises";import{randomUUID as Zt,webcrypto as Qt}from"node:crypto";import{readFile as $t}from"node:fs/promises";import{createInterface as en}from"node:readline/promises";function tn(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{...x(`${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 b(`Environment-bound options applied`,r)}function nn(e,t,n){if(!I(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||!_n(n,r.name))continue;let a=gn(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 rn(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 an(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return xn(e,t,n);for(let[r,i]of n.entries()){let n=xn(e,t,i,r);if(!n.ok)return n}return b(`Body value assigned`,null)}function on(e,t,n,r){return xn(e,t,r,n)}function sn(e){let t=[];for(let n of e.split(`.`)){let e=Cn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function cn(e,t){let n=sn(t);if(n===null)return null;let r=hn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:mn(r)}:null}function ln(e,t){if(F(e.name)||e.schemaType===`array`)return b(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return b(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?b(`Scalar body option selected`,t[0]):x(`${n} was already given; pass it once.`)}var un=/^(?<row>\d+):(?<item>.*)$/su;function dn(e,t){let n=sn(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=un.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 fn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&sn(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function pn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=cn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return x(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||dn(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return x(`${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 mn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function hn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function gn(e,t){if(!F(t))return hn(e,t.split(`.`))}function _n(e,t){return yn(e,t.split(`.`))}function vn(e,t,n){if(!I(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)&&_n(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function yn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Cn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>yn(e,r)):yn(a,r)}function F(e){return e.split(`.`).some(e=>Cn(e).isArray)}function bn(e,t){return e.parameter.length===0||!I(t)?null:Tn(t,[],wn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Cn(o),c=e===i.length-1,l=Sn(a,s,t,c,n,r);if(!l.ok||l.data===null)return x(l.summary,l.warnings);if(c)return b(`Body value assigned`,null);a=l.data}return x(`${t} is not a valid body option path.`)}function Sn(e,t,n,r,i,a){let o=()=>x(`${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,b(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,b(`Body path created`,e)}return I(c)?b(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,b(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,b(`Body path created`,n)}return I(s)?b(`Body path stepped`,s):o()}function Cn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function wn(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 Tn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Tn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!En(a,n)){if(!Dn(e))continue;let t=On(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Tn(i,e,n);if(o!==null)return o}return null}function En(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Dn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function On(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:kn(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 kn(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}var An=e=>Array.isArray(e)&&!Object.isFrozen(e);function jn(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(ze(e)),t.description=ie(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!An(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);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?zn(r,i):r===void 0?i===void 0?0:1:-1})}function Mn(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 Nn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Pn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Ln(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 Fn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function In(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?Ve(n):`${Ve(n)} Required JSON paths: ${r.join(`, `)}.`}function Ln(e,t){let n=Re(t.description,void 0),r=e.kind!==`multipart`&&F(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}.`:``}${Rn(e,t)}`}function Rn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=sn(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 zn(e,t){return Ue(e)-Ue(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Bn(e){let t;try{t=e===`-`?await Vn():await $t(e,`utf8`)}catch(t){return x(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return b(`No input provided`,null);let e=JSON.parse(t);return b(`Input parsed`,e)}catch(e){return x(`Input is not valid JSON: ${e.message}`)}}async function Vn(){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 Hn=`--content-type`;function Un(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Hn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Hn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Gn(a)))}if(lr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,In(r,r.requiredPath)).argParser(qn(`--from-file`)))}let o=Mn(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>zn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Nn(n),a.length>1?Pn(n):Ln(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Fn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Wn):F(i.name)||i.schemaType===`array`?o.argParser(Kn):o.argParser(qn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}cr(e,n,o)}function Wn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Gn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Hn} was already given; pass it once.`);let i=pe(e,t);if(!i.ok)throw new n(i.summary);return t}}function Kn(e,t){return[...t??[],e]}function qn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function Jn(e,t){let n=Ct(e,t),r=pe(e.requestBody??[],n);if(!r.ok||r.data===null)return x(r.summary,r.warnings);let i=r.data;if(i===void 0)return b(`No body`,void 0);let a=Yn(e,i,t);if(a!==null)return x(a);let o=tn(e.operationId,i,t);if(!o.ok)return x(o.summary,o.warnings);t=o.data;let s=Xn(i,t);if(s!==null)return x(s);let c=await er(t);if(!c.ok)return x(c.summary,c.warnings);let l=vn(e.requestBody??[],i,c.data);if(l!==null)return x(l);let u=$n(e.operationId,i,c.data);if(!u.ok)return u;let d=nn(e.operationId,i,c.data);if(d!==null)return x(d);let f=tr(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?x(sr(e.operationId,i)):b(`No body`,void 0);let p=rr(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 x(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return x(`${e.operationId} requires a JSON object${t}.`)}let m=Qn(i,p.data);if(m.length>0)return x(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,g=I(h)?rn(i).filter(e=>!_n(h,e)):[];return g.length>0?x(Zn(e.operationId,i,g)):p}function Yn(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`${L(t)} requires ${Hn} ${i.join(` or `)}.`}return null}function Xn(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 Zn(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 Qn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!_n(t,e.name)).map(L):[]}function $n(e,t,n){let r=bn(t,n);if(r===null)return b(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return x(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function er(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return b(`No body file`,void 0);let n=await Bn(t);if(!n.ok)return x(n.summary,n.warnings);let r=ce.safeParse(n.data);return r.success?b(`Input parsed`,r.data):x(`Input is not valid JSON value: ${r.error.message}`)}function tr(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=ln(e,n[e.optionKey]);if(!a.ok||a.data===null)return x(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=nr(t,n,r,e,o);if(!s.ok)return x(s.summary,s.warnings);i=!0}if(!i)return b(`No direct body options`,void 0);let a=pn(e,t,n,r);return a===null?b(`Direct body options parsed`,r):a}function nr(e,t,n,r,i){let a=dn(r,i);if(a===null){let e=ar(r,i);return e.ok?an(n,r.name,e.data,r.schemaType===`array`):x(e.summary,e.warnings)}if(a.plain.length>0)return x(`${L(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=fn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return x(`${L(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=or(r.name,r.itemSchemaType,e);if(!t.ok)return x(t.summary,t.warnings);i.push(t.data)}let a=on(n,r.name,e,i);if(!a.ok)return a}return b(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function rr(e,t,n,r){if(n===void 0)return b(`Direct body parsed`,r);if(r===void 0)return b(`Input parsed`,n);if(I(n)&&I(r))try{return b(`Input parsed`,ir(t,n,r))}catch(t){return x(`${e} ${t instanceof Error?t.message:String(t)}`)}return x(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function ir(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(I(n)&&I(a))i[t]=ir(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`:Me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ar(e,t){if(typeof t==`boolean`)return b(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return or(e.name,e.schemaType,t??``);let n=[],r=F(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=or(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return b(`Body value parsed`,n)}function or(e,t,n){if(t===`boolean`)return n===`true`?b(`Body value parsed`,!0):n===`false`?b(`Body value parsed`,!1):x(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?x(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?x(`${e} must be an integer.`):b(`Body value parsed`,i)}return b(`Body value parsed`,n)}function sr(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(L).join(`, `)}`;let r=rn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function cr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Hn,location:`body`}),lr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),jn(e.options,r)}function lr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function ur(e){let t=le(e,Pe(e,E));return yr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function dr(e){let t=le(e,Pe(e,E));yr(t);let n=Ae(E,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=fr(t);r.push(n.endsWith(`
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{i as a,o}from"./logging-DWmYww3b.js";import{i as s,o as c,r as l,s as u,t as d,u as f}from"./env-B9uL61wg.js";import{M as p,O as m,i as h,o as g,v as ee,w as _,y as v}from"./person-owner-BJgNYLKX.js";import{Ar as te,Br as ne,Mr as y,Or as re,Pr as ie,jr as ae,kr as oe,zr as se}from"./dist-xrqtDyeI.js";import{c as b,d as ce,i as x,r as le}from"./result-envelope-BBFor6Nu.js";import{a as S,n as ue,r as de,t as fe}from"./package-DPDX5zmx.js";import{_ as pe,b as me,c as he,i as ge,s as _e,t as ve,v as ye,y as be}from"./tool-policy-Sqbr-k6c.js";import{i as xe,r as Se}from"./response-problem-Dj9cX_Hi.js";import{n as Ce,r as we}from"./output-spill-CoK0mCjN.js";import{S as Te,a as Ee,c as De,d as Oe,g as ke,i as Ae,l as je,n as C,o as Me,p as Ne,r as Pe,s as Fe,u as Ie,y as Le}from"./contract-B1MvlYuT.js";import{a as Re,c as ze,i as Be,l as Ve,n as He,s as Ue,t as We}from"./cli-help-policy-C6yTxEcB.js";import{S as Ge,_ as Ke,a as qe,g as w,h as Je,i as Ye,m as Xe,n as Ze,p as Qe,r as $e,s as et,t as tt,v as nt,x as T,y as rt}from"./api-key-bearer-credential-Mec0ISD_.js";import{a as it,c as at,d as ot,g as st,l as ct,m as lt,o as ut,s as dt,t as ft,u as pt}from"./oauth-bearer-credential-DSX-Cwti.js";import{n as mt,r as ht,t as gt}from"./oauth-login-C2ZmHALg.js";import{a as _t,c as vt,d as yt,i as bt,l as xt,n as St,o as Ct,s as wt,t as Tt,u as Et}from"./startup-auth-BSGrOwna.js";import{n as Dt,t as E}from"./openapi-commands-BfxQPFq0.js";import{i as D,r as Ot,t as O}from"./output-mode-DMR_O_LS.js";import{spawnSync as kt}from"node:child_process";import{basename as k,dirname as A,relative as At,resolve as j,sep as jt}from"node:path";import{copyFileSync as Mt,existsSync as M,lstatSync as Nt,mkdirSync as Pt,mkdtempSync as Ft,readFileSync as It,readdirSync as Lt,readlinkSync as Rt,realpathSync as zt,renameSync as Bt,symlinkSync as Vt,writeFileSync as Ht}from"node:fs";import N,{stderr as P,stdin as Ut}from"node:process";import{TextDecoder as Wt,inspect as Gt}from"node:util";import{homedir as Kt,hostname as qt,platform as Jt}from"node:os";import{fileURLToPath as Yt}from"node:url";import{setTimeout as Xt}from"node:timers/promises";import{randomUUID as Zt,webcrypto as Qt}from"node:crypto";import{readFile as $t}from"node:fs/promises";import{createInterface as en}from"node:readline/promises";function tn(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{...x(`${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 b(`Environment-bound options applied`,r)}function nn(e,t,n){if(!I(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||!_n(n,r.name))continue;let a=gn(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 rn(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 an(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return xn(e,t,n);for(let[r,i]of n.entries()){let n=xn(e,t,i,r);if(!n.ok)return n}return b(`Body value assigned`,null)}function on(e,t,n,r){return xn(e,t,r,n)}function sn(e){let t=[];for(let n of e.split(`.`)){let e=Cn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function cn(e,t){let n=sn(t);if(n===null)return null;let r=hn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:mn(r)}:null}function ln(e,t){if(F(e.name)||e.schemaType===`array`)return b(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return b(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?b(`Scalar body option selected`,t[0]):x(`${n} was already given; pass it once.`)}var un=/^(?<row>\d+):(?<item>.*)$/su;function dn(e,t){let n=sn(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=un.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 fn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&sn(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function pn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=cn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return x(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||dn(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return x(`${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 mn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function hn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function gn(e,t){if(!F(t))return hn(e,t.split(`.`))}function _n(e,t){return yn(e,t.split(`.`))}function vn(e,t,n){if(!I(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)&&_n(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function yn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Cn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>yn(e,r)):yn(a,r)}function F(e){return e.split(`.`).some(e=>Cn(e).isArray)}function bn(e,t){return e.parameter.length===0||!I(t)?null:Tn(t,[],wn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Cn(o),c=e===i.length-1,l=Sn(a,s,t,c,n,r);if(!l.ok||l.data===null)return x(l.summary,l.warnings);if(c)return b(`Body value assigned`,null);a=l.data}return x(`${t} is not a valid body option path.`)}function Sn(e,t,n,r,i,a){let o=()=>x(`${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,b(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,b(`Body path created`,e)}return I(c)?b(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,b(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,b(`Body path created`,n)}return I(s)?b(`Body path stepped`,s):o()}function Cn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function wn(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 Tn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Tn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!En(a,n)){if(!Dn(e))continue;let t=On(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Tn(i,e,n);if(o!==null)return o}return null}function En(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Dn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function On(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:kn(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 kn(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}var An=e=>Array.isArray(e)&&!Object.isFrozen(e);function jn(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(ze(e)),t.description=ie(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!An(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);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?zn(r,i):r===void 0?i===void 0?0:1:-1})}function Mn(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 Nn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Pn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Ln(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 Fn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function In(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?Ve(n):`${Ve(n)} Required JSON paths: ${r.join(`, `)}.`}function Ln(e,t){let n=Re(t.description,void 0),r=e.kind!==`multipart`&&F(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}.`:``}${Rn(e,t)}`}function Rn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=sn(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 zn(e,t){return Ue(e)-Ue(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Bn(e){let t;try{t=e===`-`?await Vn():await $t(e,`utf8`)}catch(t){return x(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return b(`No input provided`,null);let e=JSON.parse(t);return b(`Input parsed`,e)}catch(e){return x(`Input is not valid JSON: ${e.message}`)}}async function Vn(){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 Hn=`--content-type`;function Un(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Hn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Hn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Gn(a)))}if(lr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,In(r,r.requiredPath)).argParser(qn(`--from-file`)))}let o=Mn(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>zn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Nn(n),a.length>1?Pn(n):Ln(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Fn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Wn):F(i.name)||i.schemaType===`array`?o.argParser(Kn):o.argParser(qn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}cr(e,n,o)}function Wn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Gn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Hn} was already given; pass it once.`);let i=pe(e,t);if(!i.ok)throw new n(i.summary);return t}}function Kn(e,t){return[...t??[],e]}function qn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function Jn(e,t){let n=Ct(e,t),r=pe(e.requestBody??[],n);if(!r.ok||r.data===null)return x(r.summary,r.warnings);let i=r.data;if(i===void 0)return b(`No body`,void 0);let a=Yn(e,i,t);if(a!==null)return x(a);let o=tn(e.operationId,i,t);if(!o.ok)return x(o.summary,o.warnings);t=o.data;let s=Xn(i,t);if(s!==null)return x(s);let c=await er(t);if(!c.ok)return x(c.summary,c.warnings);let l=vn(e.requestBody??[],i,c.data);if(l!==null)return x(l);let u=$n(e.operationId,i,c.data);if(!u.ok)return u;let d=nn(e.operationId,i,c.data);if(d!==null)return x(d);let f=tr(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?x(sr(e.operationId,i)):b(`No body`,void 0);let p=rr(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 x(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return x(`${e.operationId} requires a JSON object${t}.`)}let m=Qn(i,p.data);if(m.length>0)return x(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,g=I(h)?rn(i).filter(e=>!_n(h,e)):[];return g.length>0?x(Zn(e.operationId,i,g)):p}function Yn(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`${L(t)} requires ${Hn} ${i.join(` or `)}.`}return null}function Xn(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 Zn(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 Qn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!_n(t,e.name)).map(L):[]}function $n(e,t,n){let r=bn(t,n);if(r===null)return b(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return x(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function er(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return b(`No body file`,void 0);let n=await Bn(t);if(!n.ok)return x(n.summary,n.warnings);let r=ce.safeParse(n.data);return r.success?b(`Input parsed`,r.data):x(`Input is not valid JSON value: ${r.error.message}`)}function tr(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=ln(e,n[e.optionKey]);if(!a.ok||a.data===null)return x(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=nr(t,n,r,e,o);if(!s.ok)return x(s.summary,s.warnings);i=!0}if(!i)return b(`No direct body options`,void 0);let a=pn(e,t,n,r);return a===null?b(`Direct body options parsed`,r):a}function nr(e,t,n,r,i){let a=dn(r,i);if(a===null){let e=ar(r,i);return e.ok?an(n,r.name,e.data,r.schemaType===`array`):x(e.summary,e.warnings)}if(a.plain.length>0)return x(`${L(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=fn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return x(`${L(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=or(r.name,r.itemSchemaType,e);if(!t.ok)return x(t.summary,t.warnings);i.push(t.data)}let a=on(n,r.name,e,i);if(!a.ok)return a}return b(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function rr(e,t,n,r){if(n===void 0)return b(`Direct body parsed`,r);if(r===void 0)return b(`Input parsed`,n);if(I(n)&&I(r))try{return b(`Input parsed`,ir(t,n,r))}catch(t){return x(`${e} ${t instanceof Error?t.message:String(t)}`)}return x(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function ir(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(I(n)&&I(a))i[t]=ir(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`:Me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ar(e,t){if(typeof t==`boolean`)return b(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return or(e.name,e.schemaType,t??``);let n=[],r=F(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=or(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return b(`Body value parsed`,n)}function or(e,t,n){if(t===`boolean`)return n===`true`?b(`Body value parsed`,!0):n===`false`?b(`Body value parsed`,!1):x(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?x(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?x(`${e} must be an integer.`):b(`Body value parsed`,i)}return b(`Body value parsed`,n)}function sr(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(L).join(`, `)}`;let r=rn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function cr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Hn,location:`body`}),lr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),jn(e.options,r)}function lr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function ur(e){let t=le(e,Pe(e,E));return yr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function dr(e){let t=le(e,Pe(e,E));yr(t);let n=Ae(E,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=fr(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(Te(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(...hr(t.problem)),r.push(...fr(t)),process.stdout.write(Te(r.join(`
|
|
4
4
|
`),!0))}function fr(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 R(e,t){let n=we(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?le(n,pr(n)):n;yr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?Ce(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?ur(n):n;e.mode===`text`&&dr(r),r.ok||(process.exitCode=1)}function pr(e){let t=Pe(e,E);if(t.write===!0||!e.ok)return t;let n=t.exactRecovery??`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`;return{...t,exactRecovery:`--data printed this truncated result envelope (truncated: true), not the bare payload, so payload paths read as null; rerun with --to-file <path> for the whole payload, or --data-full in a bounded program. ${n}`}}function mr(e,t){let n=Ee(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|
|
@@ -27,7 +27,7 @@ import{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{i as a
|
|
|
27
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=>R({mode:D(e)},io(void 0,`apply`,e.release)))}function io(e,t=`apply`,n){let r=e;try{r??=S(process.argv[1])}catch(e){return x(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=ao([`view`,o,`version`,`--silent`,`--global`],r,{timeout:to});if(!e.ok)return{...e,data:null};if(c=(e.data??``).trim(),c===``)return x(`npm view ${o} returned empty version`,[`empty_stdout`])}let l=n!==void 0||s||eo.compare(a,c)<0,u={targetPackage:o,runningPackage:i,currentVersion:a,latestVersion:c,upgradeAvailable:l,upgradeInstalled:!1};if(t===`check`)return b(`${i}@${a} → ${o}@${c} (${l?`available`:`up to date`})`,u);if(r.workingTreeRoot!==null)return x(`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=co(r),t=j(e,...no),i=k(o),s=j(t,`${i}-current`),l=o===``?[o,``]:[o,de],d=lo(e,r),f=n??[c,d?.version??a].reduce((e,t)=>eo.compare(e,t)<0?t:e,a);Pt(t,{recursive:!0});let p=[so(r),...M(s)?[zt(s)]:[],...Lt(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>j(t,e.name))],m,h=null,g=!1;for(let t of new Set(p.filter(t=>t!==e))){let e=oo(t,l,f,r.registry);if(e.ok&&e.data!==null){m=t,h=e.data;break}}if(m===void 0){m=Ft(j(t,`${i}-${encodeURIComponent(f)}-`));let e=ao([`install`,`-g`,`--prefix`,m,...l.map(e=>`${e}@${f}`)],r,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};g=!0;let n=oo(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 ee=uo(m,e,s,h,n),_=po();return b(`${o} active at ${ee}`,{...u,upgradeInstalled:g||n!==void 0||d?.version!==ee,installPrefix:e,verifiedVersion:ee,completionRefreshed:_.refreshed,completionRefreshMessage:_.message})}catch(e){return x(`${o} update failed: ${fo(e)}`,[`existing releases were preserved`])}}function ao(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=kt(`npm`,i,{env:r,encoding:`utf8`,...n});if(a.error)return a.signal===`SIGTERM`&&n.timeout!==void 0?x(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):x(`npm ${e[0]??``} failed to start: ${a.error.message}`,[`spawn_error`]);if(a.status!==0){let t=(a.stderr??``).trim().split(`
|
|
28
28
|
`).slice(-3).join(` | `);return x(`npm ${e.join(` `)} exited ${a.status}`,[t||`no stderr`])}return b(`npm ok`,a.stdout??``)}function oo(e,t,n,r){try{let i=t.map(t=>{let i=S(j(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(!zt(j(e,`bin`,t)).startsWith(`${i.packageRoot}${jt}`))throw Error(`${t} escapes ${i.packageRoot}`);return i});for(let t of i){let r=j(e,`bin`,t.bin[0]),i=kt(process.execPath,[r,`--version`],{encoding:`utf8`,timeout:to});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 b(`CLI and MCP release verified`,i)}catch(t){return x(`release verification failed: ${fo(t)}`,[`release prefix: ${e}`])}}function so(e){let t=A(e.packageRoot),n=A(t),r=A(n);if(k(t)!==e.name.split(`/`)[0]||k(n)!==`node_modules`||k(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}${jt}`))throw Error(`the running entry escapes its package root`);return A(r)}function co(e){let t=so(e),n=`${jt}${no.join(jt)}${jt}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function lo(e,t){let n=t.registry===``?k(``):fe,r=j(e,`bin`,n);if(!M(r))return null;let i=S(r);if(i.registry!==t.registry)throw Error(`${r} belongs to another product`);return i}function uo(e,t,n,r,i){let a=r[0];if(a===void 0)throw Error(`release contains no CLI`);let o=j(t,`bin`);Pt(o,{recursive:!0});let s=r.flatMap(e=>e.bin.filter((e,t)=>{let n=j(o,e);if(!M(n)||S(n).registry===a.registry)return!0;if(a.registry!==``&&t>0)return!1;throw Error(`${n} belongs to another product`)}));if(!M(n)){let t=Ft(j(A(n),`${k(n)}-seed-`));Pt(j(t,`bin`));for(let n of s){let r=j(o,n);Vt(zt(M(r)?r:j(e,`bin`,n)),j(t,`bin`,n))}try{Vt(At(A(n),t),n)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!Nt(n).isSymbolicLink())throw Error(`${n} is not a release symlink`);for(let e of s){let t=At(o,j(n,`bin`,e)),r=j(o,`.${e}-${Zt()}`);Vt(t,r),Bt(r,j(o,e))}for(let e of s){let t=j(o,e);if(!Nt(t).isSymbolicLink()||j(o,Rt(t))!==j(n,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let c=lo(t,a);if(i===void 0&&c!==null&&eo.compare(c.version,a.version)>0)return c.version;let l=`${n}-${Zt()}`;return Vt(At(A(n),e),l),Bt(l,n),a.version}function fo(e){return e instanceof Error?e.message:String(e)}function po(){try{return Ra()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}var mo=[{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`},{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`}];function ho(e,t=S().bin[0]){O(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: [...] }`:",...mo.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),R({mode:D(e)},await go(t))})}async function go(e){let t=vo(),n=yo(e),[r,i]=await Promise.all([bo(e),xo(t,e)]),a=[n.check,r,i.check,await Co(e),Ao(t,i.servedFingerprint,n.upgradeAvailable,e)],o={pass:_o(a,`pass`),warn:_o(a,`warn`),fail:_o(a,`fail`),skip:_o(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?b(l,c,{counts:o}):{...x(l,s,{counts:o}),data:c}}function _o(e,t){return e.filter(e=>e.status===t).length}function K(e,t,n){return{name:e,status:t,message:n}}function vo(){return E.find(e=>e.intent===`status`&&e.resource===`status`)}function yo(e){let t=S(),n=io(t,`check`);if(!n.ok||n.data===null)return{check:K(`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?K(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):K(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function bo(e){try{let{EntityDetailSchema:e}=await import(`./detail-D3FyUXbw.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return K(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return K(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${w(t)}.`)}}async function xo(e,t){let n=e??{method:`GET`,path:`/info`,auth:`none`},r;try{r=f().host}catch(e){return{check:K(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${w(e)}.`),servedFingerprint:null}}let i=await y({method:n.method,path:n.path,auth:n.auth,responseFormat:`json`}).catch(e=>x(w(e)));return i.ok?{check:K(`api-host`,`pass`,`${n.method} ${n.path} answered at ${r}.`),servedFingerprint:e===void 0?null:So(i.data)}:{check:K(`api-host`,`fail`,i.httpStatus===401?`Replace or unset the credential ${r} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} returned ${i.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} at ${r} returned ${i.summary}.`),servedFingerprint:null}}function So(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.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}async function Co(e){let t=Je(),[n,r]=await Promise.all([To(),Eo()]);if(r.state===`unavailable`&&r.cause===`environment`)return K(`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 K(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${n.summary}.`);if(!i&&n.state===`found`&&at(n.stored.credential)&&n.stored.credential.tokens.refresh_token===void 0)return K(`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 K(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${d.authToken} through the environment — ${n.summary}.`);if(i||n.state===`found`||a){let i=await wo(e,t);return K(`auth`,i.status,`Credential source available: ${Do(t,n,r)}; ${i.text}.`)}return r.state===`unavailable`?K(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${d.authToken} through the environment — ${r.summary}.`):K(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${d.authToken} in the environment.`)}async function wo(e,t){let n=T(f().host),r=await sa(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await oa(`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 ${w(t,[f().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function To(){let e;try{e=T(f().host)}catch(e){return{state:`unavailable`,summary:w(e)}}return await dt(e)}async function Eo(){let e;try{e=T(f().host)}catch(e){return{state:`unavailable`,summary:w(e),cause:`environment`}}try{return await $e(e)}catch(e){return{state:`unavailable`,summary:w(e),cause:`storage`}}}function Do(e,t,n){return[Aa(e),`oauth=${ko(t)}`,`api-key=${Oo(n)}`].join(` `)}function Oo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=T(f().host);return`${e.stored.activation}${ha(t,e)}`}function ko(e){switch(e.state){case`found`:return at(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 Ao(e,t,n,r){let i=E.length;if(e===void 0)return K(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${i} operations.`);if(t===null)return K(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${Dt}.`);if(t===`
|
|
30
|
+
`);return c.ok?b(l,c,{counts:o}):{...x(l,s,{counts:o}),data:c}}function _o(e,t){return e.filter(e=>e.status===t).length}function K(e,t,n){return{name:e,status:t,message:n}}function vo(){return E.find(e=>e.intent===`status`&&e.resource===`status`)}function yo(e){let t=S(),n=io(t,`check`);if(!n.ok||n.data===null)return{check:K(`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?K(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):K(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function bo(e){try{let{EntityDetailSchema:e}=await import(`./detail-D3FyUXbw.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return K(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return K(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${w(t)}.`)}}async function xo(e,t){let n=e??{method:`GET`,path:`/info`,auth:`none`},r;try{r=f().host}catch(e){return{check:K(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${w(e)}.`),servedFingerprint:null}}let i=await y({method:n.method,path:n.path,auth:n.auth,responseFormat:`json`}).catch(e=>x(w(e)));return i.ok?{check:K(`api-host`,`pass`,`${n.method} ${n.path} answered at ${r}.`),servedFingerprint:e===void 0?null:So(i.data)}:{check:K(`api-host`,`fail`,i.httpStatus===401?`Replace or unset the credential ${r} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} returned ${i.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${n.method} ${n.path} at ${r} returned ${i.summary}.`),servedFingerprint:null}}function So(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.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}async function Co(e){let t=Je(),[n,r]=await Promise.all([To(),Eo()]);if(r.state===`unavailable`&&r.cause===`environment`)return K(`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 K(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${n.summary}.`);if(!i&&n.state===`found`&&at(n.stored.credential)&&n.stored.credential.tokens.refresh_token===void 0)return K(`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 K(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${d.authToken} through the environment — ${n.summary}.`);if(i||n.state===`found`||a){let i=await wo(e,t);return K(`auth`,i.status,`Credential source available: ${Do(t,n,r)}; ${i.text}.`)}return r.state===`unavailable`?K(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${d.authToken} through the environment — ${r.summary}.`):K(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${d.authToken} in the environment.`)}async function wo(e,t){let n=T(f().host),r=await sa(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await oa(`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 ${w(t,[f().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function To(){let e;try{e=T(f().host)}catch(e){return{state:`unavailable`,summary:w(e)}}return await dt(e)}async function Eo(){let e;try{e=T(f().host)}catch(e){return{state:`unavailable`,summary:w(e),cause:`environment`}}try{return await $e(e)}catch(e){return{state:`unavailable`,summary:w(e),cause:`storage`}}}function Do(e,t,n){return[Aa(e),`oauth=${ko(t)}`,`api-key=${Oo(n)}`].join(` `)}function Oo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=T(f().host);return`${e.stored.activation}${ha(t,e)}`}function ko(e){switch(e.state){case`found`:return at(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 Ao(e,t,n,r){let i=E.length;if(e===void 0)return K(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${i} operations.`);if(t===null)return K(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${Dt}.`);if(t===`1a411ff24ca61b64`)return K(`catalog`,`pass`,`${i} generated operations match the set the API serves (${Dt}).`);let a=`This catalog describes a different operation set than the API serves (${Dt} vs ${t})`;return n===!0?K(`catalog`,`fail`,`${a}: run \`${r} update\`.`):K(`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 jo=C(B,`oauth`),Mo=[C(B,`start`),C(B,`poll`),C(B,`acknowledge`)],No=C(B,`revoke`);function Po(e,n=S().bin[0]){let r=Ro(e);ho(r,n);let i=[`${jo.description} Default method: OAuth in your browser.`,`With --key: ${Mo.map(({description:e})=>e).join(` `)}`].join(`
|
|
31
31
|
`);O(Lo(r,[jo,...Mo],i)).action(Fo),O(Lo(r,[No],No.description)).action(Io),O(r.command(`status`).summary(`Keep saved credentials current and report them`).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`,``,`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 t(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){zo(this),R({mode:D(e)},await Bo(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: ${d.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(){zo(this);let e=await sa(n),t=process.env[d.authToken]?.trim();if(e.failure===null&&t!==void 0&&t.length>0){process.stdout.write(`${t}\n`);return}R({mode:`text`},e.failure===null?Jo(`auth token: no credentials resolved`,null,n,{oauth:!0,apiKey:!0}):x(`auth token: ${e.failure}`))})}async function Fo(e){zo(this);let t=D(e);if(e.providers===!0){R({mode:t},await Ho());return}R({mode:t},e.key===!0?await Xi({noBrowser:!e.browser,clientLabel:e.clientLabel}):await ht({noBrowser:!e.browser}))}async function Io(e){zo(this),R({mode:D(e)},await zi({forgetLocal:e.forgetLocal===!0}))}function Lo(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 Ro(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${jo.command}\`: ${jo.summary}; \`--key\` ${Mo[0].summary.toLowerCase()}.`,`\`${No.command}\`: ${No.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build metadata.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth token` prints the bearer token the next command sends."].join(`
|
|
@@ -56,7 +56,7 @@ end
|
|
|
56
56
|
(Did you mean `))return;let r=zs(e),i=process.argv.slice(2+Y(e).length);if(r.length>0&&r.every((e,t)=>i[t]===e)){let t=Bs(e,r);if(t!==void 0)return t}let a=Y(e),o=[...a.slice(0,-1),`${a.at(-1)}-${n}`,...r.slice(1)],s=(Us(o)?o:void 0)??Ls(e,n)??Rs(e,n);if(s!==void 0)return Vs(e,s,r)??Ys(e,s.join(` `),!1);let c=r.join(` `)||n,l=Hs(e)??Ys(e,c),u=[...a,...r.slice(1)];return[l,r.length===a.length+a.length&&a.at(-1)===a.at(0)?Vs(e,u,r)?.replace(/^hint: Did you mean: /u,` `)+` · `:u.slice(1,-1).length>0?Vs(e,u,r):void 0].filter(e=>e!==void 0).join(`
|
|
57
57
|
`)||void 0}function Qs(e){return t=>{if(t.code===`commander.missingMandatoryOptionValue`){let n=e.options.filter(t=>t.mandatory&&e.getOptionValue(t.attributeName())===void 0);if(n.length>1){let e=n.map(e=>e.flags.split(`, `).at(-1)??e.flags);process.stderr.write(`error: missing required options: ${e.join(`, `)}\n`)}let r=ks(e);for(let e of r)process.stderr.write(`error: unknown option '${e}'\n`);for(let n of[As(e)??(r.length>0?Xs(e):void 0),Cs(e),Ds(e,t),...Gs(e)])n!==void 0&&process.stderr.write(`${n}\n`)}else if(t.code===`commander.excessArguments`){let t=Cs(e)??Ks(e);t!==void 0&&process.stderr.write(`${t}\n`)}else if(t.code===`commander.unknownOption`){let n=Es(t,`unknown option`),r=As(e)??Fs(e,t)??(n!==void 0&&!t.message.includes(`
|
|
58
58
|
(Did you mean `)?Js(e,n)??Bs(e,[n.replace(/^--/u,``)],process.argv.slice(process.argv.indexOf(n)+1))??Xs(e,n)??Ys(e,Y(e).slice(1).join(` `)||n.replace(/^--/u,``)):void 0);r!==void 0&&process.stderr.write(`${r}\n`)}else if(t.code===`commander.unknownCommand`){let n=Zs(e,t);n!==void 0&&process.stderr.write(`${n}\n`)}else if(t.code===`commander.helpDisplayed`){let[n]=e.args;if(n?.startsWith(`-`)===!1&&e.registeredArguments.length===0){let r=[X(e).name(),...Y(e)].join(` `);t.exitCode=1,process.stderr.write(`hint: ${r} takes no '${n}' subcommand; the help shown is for ${r}\n`)}}throw t}}var $s=class extends t{group;constructor(e){super(`-h, --help`,`display help for command`),this.group=e}is(e){if(e!==this.short&&e!==this.long)return!1;let t=this.group.args.at(0);return t===void 0||t.startsWith(`-`)?!0:this.group.commands.some(e=>e.name()===t||e.aliases().includes(t))}};function ec(e){e.showHelpAfterError(!1).exitOverride(Qs(e)),e.commands.length===0?e.hook(`preAction`,Ss):e.registeredArguments.length===0&&!Ws(Y(e))&&e.addHelpOption(new $s(e));for(let t of e.commands)ec(t)}function tc(e,t=new Date){let n=ic(e);return{schemaVersion:1,generatedFrom:`MCP_GENERATION_CONTRACT`,generatedAt:t.toISOString(),totalOperations:n.length,note:`Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.`,operations:n}}function nc(e){return`${JSON.stringify(e,null,2)}\n`}function rc(e,t){let n=j(e),r=nc(t);return Pt(A(n),{recursive:!0}),Ht(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function ic(e){return e.map(e=>({operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliCommand:e.projection.cliPath.join(` `),cliPath:e.projection.cliPath,mcpTool:he(e.intent),bodySchemaName:e.requestBody?.[0]?.schemaName??null,bodySchemaImport:e.requestBody?.[0]?.schemaImport??null,auth:e.projection.auth,scope:e.projection.scope,destructive:e.projection.destructive})).toSorted((e,t)=>e.path.localeCompare(t.path)||e.method.localeCompare(t.method)||e.operationId.localeCompare(t.operationId))}var ac=`Match only the first canonical or CLI-alias command segment`,oc=[`text`,`lines`,`compact`,`json`,`ndjson`];function sc(e,t,n=S().bin[0]){let r=e.command(`command-catalog`).summary(`LLM agent only: search generated CLI metadata`).description([`LLM agent only: search and dump generated ${n} command metadata.`,`This is read-only command metadata derived from the generated OpenAPI command specs.`,`Use --format lines for rg/grep/ag/ack and --format ndjson|json for ast-grep/sg/parsers.`,"Use --format compact for one `cli · summary · requiredFlags` row per operation."].join(`
|
|
59
|
-
`));r.addHelpText(`after`,()=>`\nShipped compact catalog of operations callable without an admin grant, greppable without\nrunning this CLI (dump --format compact lists every operation your credential reaches):\n ${Nr(n)}\n`),cc(r,t,n),lc(r,t,n),uc(r,t,n),dc(r)}function cc(e,n,r){let i=e.command(`search`).summary(`Search generated operations`).description(`Search generated operation metadata without calling the API.`).argument(`[query...]`,`Search query; same as --q.`).option(`--q <query>`,`Search generated command metadata`).option(`--root <root>`,ac).addOption(new t(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new t(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new t(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`,`20`).addOption(new t(`--format <format>`,`Text/file render format`).choices(oc)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(e){let t=this.optsWithGlobals(),i=D(t,`text`),a=Fr(t,e);Ir(a,(a.q?.trim()??``)===``?n.filter(({deprecated:e})=>e!==!0):n,i,r)})}function lc(e,n,r){let i=e.command(`show`).summary(`Show one generated operation`).description(`Show one generated operation by command path or operationId.`).option(`--command <command>`,`CLI command path, with or without ${r} prefix`).option(`--operation-id <operationId>`,`Generated OpenAPI operationId`).addOption(new t(`--format <format>`,`Text/file render format`).choices([`usage`,`lines`,`compact`,`json`,`ndjson`]).default(`usage`)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(){let e=this.optsWithGlobals();Lr(e,n,D(e,`text`),r)})}function uc(e,n,r){let i=e.command(`dump`).summary(`Dump generated operations`).description(`Dump generated operations for rg/grep/ag/ack or JSON/NDJSON tooling.`).option(`--root <root>`,ac).addOption(new t(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new t(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new t(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`).addOption(new t(`--format <format>`,`Text/file render format`).choices(oc)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(){let e=this.optsWithGlobals();Ir(e,n,D(e,`text`),r)})}function dc(e){let t=e.command(`unified`).summary(`Dump unified CLI/API/MCP operation JSON`).description(`Dump the flat unified operations JSON projected from MCP_GENERATION_CONTRACT.`).option(`--output <path>`,`Write unified operations JSON to a file`);O(t),t.action(async function(){let e=this.optsWithGlobals(),t=D(e,`text`),{MCP_GENERATION_CONTRACT:n}=await import(`./mcp-generation-contract-
|
|
59
|
+
`));r.addHelpText(`after`,()=>`\nShipped compact catalog of operations callable without an admin grant, greppable without\nrunning this CLI (dump --format compact lists every operation your credential reaches):\n ${Nr(n)}\n`),cc(r,t,n),lc(r,t,n),uc(r,t,n),dc(r)}function cc(e,n,r){let i=e.command(`search`).summary(`Search generated operations`).description(`Search generated operation metadata without calling the API.`).argument(`[query...]`,`Search query; same as --q.`).option(`--q <query>`,`Search generated command metadata`).option(`--root <root>`,ac).addOption(new t(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new t(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new t(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`,`20`).addOption(new t(`--format <format>`,`Text/file render format`).choices(oc)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(e){let t=this.optsWithGlobals(),i=D(t,`text`),a=Fr(t,e);Ir(a,(a.q?.trim()??``)===``?n.filter(({deprecated:e})=>e!==!0):n,i,r)})}function lc(e,n,r){let i=e.command(`show`).summary(`Show one generated operation`).description(`Show one generated operation by command path or operationId.`).option(`--command <command>`,`CLI command path, with or without ${r} prefix`).option(`--operation-id <operationId>`,`Generated OpenAPI operationId`).addOption(new t(`--format <format>`,`Text/file render format`).choices([`usage`,`lines`,`compact`,`json`,`ndjson`]).default(`usage`)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(){let e=this.optsWithGlobals();Lr(e,n,D(e,`text`),r)})}function uc(e,n,r){let i=e.command(`dump`).summary(`Dump generated operations`).description(`Dump generated operations for rg/grep/ag/ack or JSON/NDJSON tooling.`).option(`--root <root>`,ac).addOption(new t(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new t(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new t(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new t(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`).addOption(new t(`--format <format>`,`Text/file render format`).choices(oc)).option(`--output <path>`,`Write rendered output to a file`);O(i),i.action(function(){let e=this.optsWithGlobals();Ir(e,n,D(e,`text`),r)})}function dc(e){let t=e.command(`unified`).summary(`Dump unified CLI/API/MCP operation JSON`).description(`Dump the flat unified operations JSON projected from MCP_GENERATION_CONTRACT.`).option(`--output <path>`,`Write unified operations JSON to a file`);O(t),t.action(async function(){let e=this.optsWithGlobals(),t=D(e,`text`),{MCP_GENERATION_CONTRACT:n}=await import(`./mcp-generation-contract-B38S8qQE.js`);if(t===`text`&&e.output===void 0&&(e.text===!0||e.allFields===!0)){R({mode:t},b(`Unified operations JSON`,`Use --output <path> to write the unified operations JSON.`,{counts:{totalOperations:n.length}}));return}let r=tc(n);if(e.output!==void 0){let n=rc(e.output,r);R({mode:t},b(`Unified operations JSON written`,{outputPath:n.target,byteLength:n.byteLength,schemaVersion:r.schemaVersion},{counts:{totalOperations:n.totalOperations}}));return}if(t===`text`){zr(`Unified operations JSON`,nc(r));return}R({mode:t},b(`Unified operations JSON`,r,{counts:{totalOperations:r.totalOperations}}))})}var fc=S(Yt(import.meta.url)),Q=fc.bin[0];function pc(e,t){let n=e instanceof Error?e:Error(String(e));a({component:Q,event:`fatal`,message:n.message,error:n}),process.stderr.write(`${Q} fatal (${t}): ${n.stack??n.message}\n`);let r=n instanceof re?{httpStatus:n.problem.status,problem:n.problem}:{};ur({...x(`${Q} ${t}: ${n.message}`,[n.name||`Error`],r),counts:{exitCode:1}}),process.exit(1)}function mc(e){return We[Be(e,_t)??`cli`]}function hc(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:mc(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>Tt(e.cliPath[0])).map(e=>e.cliPath[0]??``)),i=new Set,a=new Set;for(let{cliPath:e,deprecated:t}of n)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);i.add(r),t!==!0&&a.add(r)}for(let t of n)gc(e,t,r,a,i.has(t.cliPath.join(` `)))}function gc(e,t,n,r,i){let a=t.cliPath,o=e,s=``,c=!n.has(a[0]??``);for(let e of a.slice(0,-1)){s=s===``?e:`${s} ${e}`;let t=c&&s===e||!r.has(s);o=_c(o,e,s,t)}let l=a.at(-1)??t.operationId,u=o.commands.find(e=>e.name()===l)??o.command(l,t.deprecated===!0?{hidden:!0}:{}),d=t.requestBody?.flatMap(({parameter:e})=>e)??[];u.summary(t.summary||t.operationId).description([`${t.method} ${t.path}.`,t.summary||t.description,`Full documentation: ${Q} help ${t.cliPath.join(` `)}`,t.requestBody?.[0]?.kind===`json`||[...t.parameters,...d].some(e=>ge(e.schemaType,e.itemSchemaType))?ve:``].filter(Boolean).join(`
|
|
60
60
|
`));let f=Et(t);for(let e of t.parameters)vc(u,e,i||e===f);if(Un(u,t),_e(t.intent)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),O(u),u.hook(`preAction`,e=>xt(e,t)),t.explain===!0&&u.option(`--explain`,`Print the search strategy and parsed constraints before the results`),f!==void 0){u.argument(`[text...]`,f.description||`Same as ${wt(f.flag)}.`),u.action(async function(e){let n=this.optsWithGlobals(),r=D(n),i=yt(f,e,n);if(!i.ok||i.data===null)return R({mode:r},i);let a=vt(t,i.data);if(a.length>0)return R({mode:r},x(`missing required options: ${a.join(`, `)}`));let o=await yc(t,i.data,r),s=si(t,i.data,o);if(s!==null)return R({mode:r},s);n.explain===!0&&o.ok&&mr(r,o.data),o.ok&&o.data instanceof Uint8Array?process.stdout.write(o.data):R({mode:r},o)});return}u.action(async function(){let e=this.optsWithGlobals(),n=D(e),r=vt(t,e);if(r.length>0)return R({mode:n},x(`missing required options: ${r.join(`, `)}`));let i=await yc(t,e,n),a=si(t,e,i);if(a!==null)return R({mode:n},a);e.explain===!0&&i.ok&&mr(n,i.data),i.ok&&i.data instanceof Uint8Array?process.stdout.write(i.data):R({mode:n},i)})}function _c(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=_t[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function vc(e,n,r=!1){let i=n.description||`${n.name} ${n.location} parameter`,a=n.defaultValue===void 0?void 0:typeof n.defaultValue==`string`||typeof n.defaultValue==`boolean`?n.defaultValue:[...n.defaultValue];if(n.legacyFlag!==void 0){let o=new t(n.flag,i);a!==void 0&&o.default(a);let s=new t(n.legacyFlag,i).conflicts(n.optionKey);e.addOption(o).addOption(s),e.hook(`preAction`,e=>{let t=e.opts(),i=t[n.optionKey],a=t[s.attributeName()];if(a!==void 0){(i===void 0||e.getOptionValueSource(n.optionKey)==="default")&&e.setOptionValueWithSource(n.optionKey,a,`cli`);return}!r&&n.required&&i===void 0&&e.error(`error: required option '${o.flags}' not specified`,{code:`commander.missingMandatoryOptionValue`})});return}if(a!==void 0){e.option(n.flag,i,a);return}if(n.required&&!r){e.requiredOption(n.flag,i);return}e.option(n.flag,i)}async function yc(e,t,n){if(t.environment!==void 0){let e=u(t.environment);if(e===null)return x(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${c().join(`, `)}`]);process.env.API_ENV=e}let r=await Jn(e,t);if(!r.ok)return r;let i=Object.fromEntries(e.parameters.filter(e=>e.location===`path`).map(e=>{let n=t[e.optionKey];if(Array.isArray(n))return[e.name,n.at(0)??``];if(n===void 0)throw Error(`Missing required option ${e.optionKey}`);return[e.name,String(n)]})),a=Object.fromEntries(e.parameters.filter(e=>e.location===`query`).flatMap(e=>{let n=t[e.optionKey];if(n===void 0||Array.isArray(n)&&n.length===0)return[];let r=Array.isArray(n)||typeof n==`boolean`?n:String(n);return[[e.name,r]]})),o=Object.fromEntries(e.parameters.filter(e=>e.location===`header`).flatMap(e=>{let n=t[e.optionKey];return n===void 0||Array.isArray(n)&&n.length===0?[]:[[e.name,Array.isArray(n)?n.join(`,`):String(n)]]}));return li(e,await y({method:e.method,path:oe(e.operationId,i),searchParams:a,headers:o,body:r.data,contentType:Ct(e,t),auth:e.auth,responseFormat:Ot(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0}))}process.on(`uncaughtException`,e=>pc(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>pc(e,`unhandledRejection`));var bc=St(process.argv.slice(2),E),xc=bc===`required`?E:bt(E),$=new i;$.name(Q).usage(`<command> [subcommand] [options]`).configureHelp(Qr).version(fc.version).summary(`CLI for the aVenture API: companies, people, and news, with the funding, publications, and classifications attached to them`).description([`The aVenture research API from your terminal. Three records — companies,`,`people, and news — carry everything else: funding, publications, and tags.
|
|
61
61
|
`,`Mutations execute directly; --execute is a deprecated no-op.
|
|
62
62
|
The aVenture MCP server tools execute through this same CLI.`].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./commander-BB7CDPLs.js";import{C as t,O as n,T as r,i,l as a,n as o,o as s,p as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Fr as m}from"./dist-
|
|
1
|
+
import{n as e}from"./commander-BB7CDPLs.js";import{C as t,O as n,T as r,i,l as a,n as o,o as s,p as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Fr as m}from"./dist-xrqtDyeI.js";import{a as ee,c as h,d as g,i as _}from"./result-envelope-BBFor6Nu.js";import{a as te}from"./package-DPDX5zmx.js";import{S as ne,a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as le,s as v}from"./tool-policy-Sqbr-k6c.js";import{a as ue,n as de,r as y,t as fe}from"./text-field-BoNdbrtA.js";import{C as b,D as pe,E as me,O as he,S as ge,T as _e,_ as ve,a as ye,b as be,c as xe,d as Se,f as Ce,g as we,h as Te,i as Ee,k as De,l as Oe,m as ke,n as Ae,o as je,p as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./detail-DIjiKrvq.js";import{a as Ve,o as He}from"./cli-help-policy-C6yTxEcB.js";import{Buffer as x}from"node:buffer";var S=s([`HIGH`,`MEDIUM`,`LOW`]),Ue=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),We=Object.assign(r([Ue,f()]),{enum:Ue.enum}),Ge=p({excerpt:f(),sourceId:f(),sourceType:We,sourceVersion:f().nullish()}),Ke=p({instruction:f(),operationId:f(),stepKey:f().optional()}),qe=p({body:f(),expectation:f(),method:a(f()),override:f(),reject:a(f()),typeCatalog:f()}),Je=p({cliCommand:f(),mcpTool:f().nullish(),step:Ke,writeGuidance:qe.nullish()}),Ye=s([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Xe=Object.assign(r([Ye,f()]),{enum:Ye.enum}),Ze=p({allowedValue:f().nullish(),description:f(),key:f(),required:u().default(!0).optional(),type:Xe}),Qe=p({catalogRevision:c().optional(),gateId:a(f()).optional(),input:a(Ze),step:a(Je),taskKey:f().optional()}),C=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),$e=p({candidate:a(Ge),operationId:f().nullish(),outcome:C,probability:d().nullish(),taskKey:f().nullish(),taskPlan:Qe.nullish()}),et=p({answer:f(),citation:a(Ge),confidence:S,resolution:$e.nullish()});function w(e,t,n=t.inputName){if(t.in===`body`)return n;let r=ft.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?dt(ct(n!==`id`&&n!==`slug`?n:`${it(e.path)}${st(n)}`),t):r.inputName}function tt(e,t,n=ot(e)){return nt(at(e,t),new Set(n))}function nt(e,t){if(!t.has(e))return e;let n=`body${st(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function rt(e,t,n){return`${e}[${t}].${n}`}function it(e){return pt.find(([,t])=>t.test(e))?.[0]??`record`}function at(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=lt(t);return dt(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?ct(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ot(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>w(e,t)))}function st(e){return e.replace(/^./u,e=>e.toUpperCase())}function ct(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 lt(e){let t=ct(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ut(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ut(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function dt(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var ft=[{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`}],pt=[[`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 mt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>ht(t,w(e,t))),r=(t?.parameter??[]).map(t=>ht(t,tt(e,t)));return{selector:n.filter(e=>e.location===`path`||gt(e)),pagination:n.filter(_t),filter:[...n.filter(vt),...r.filter(vt)],body:r.filter(e=>!vt(e))}}function ht(e,t){let{in:n,inputName:r,...i}=e;return{...i,name:e.in===`body`?t:e.name,flag:re(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function gt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function _t(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function vt(e){return e.location!==`path`&&!gt(e)&&!_t(e)}var T=16e3,yt=(e,t=T)=>e.length<=120&&x.byteLength(`${e.join(`
|
|
2
2
|
`)}\n`,`utf8`)<=t,E=(e,t=!1,n=!1,r=1)=>{let i=de(e),a=t||i.endsWith(`
|
|
3
3
|
`),o=i.endsWith(`
|
|
4
4
|
`)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
|
|
@@ -12,7 +12,7 @@ import{n as e}from"./commander-BB7CDPLs.js";import{C as t,O as n,T as r,i,l as a
|
|
|
12
12
|
`),e.endsWith(`
|
|
13
13
|
`)),xt=new Set([`core`,`nameFull`,`nameBrand`,`name`,`title`,`fundingDetail`,`round`,`dateAnnounced`,`amountRaised`,`person`,`fundraiseRound`]),St=5;function Ct(e,t,n=T){let r=e=>e.length<=t&&yt(e,n);if(r(e))return e;let i=wt(e),a=e=>[...Mt(i,e-1),`... output folded to fit 120 lines and ${T} UTF-8 bytes; "(+N lines)" and "N more" mark hidden content; read it whole with --data --to-file <path> or the section's sub-resource operation; MCP structuredContent carries the full envelope up to 50KB.`],o=2,s=t,c=a(o);for(;o<=s;){let e=Math.floor((o+s)/2),t=a(e);r(t)?(c=t,o=e+1):s=e-1}return c}function wt(e){let t={line:``,child:[]},n=[{node:t,indent:-1}];for(let t of e){let e=Et(t);for(;n.length>1&&(n.at(-1)?.indent??-1)>=e;)n.pop();let r={line:t,child:[]};n.at(-1)?.node.child.push(r),n.push({node:r,indent:e})}return t.child}var Tt=new WeakMap,D=e=>{let t=Tt.get(e);if(t!==void 0)return t;let n=e.child.reduce((e,t)=>e+D(t),1);return Tt.set(e,n),n},Et=e=>e.length-e.trimStart().length,Dt=/^(?:- ?|\d+\.(?: |$))/u,Ot=e=>(e.line.trimStart().replace(Dt,``).split(/[:= ]/u)[0]??``).split(`.`).at(-1)?.replace(/\[\d+\]$/u,``)??``,kt=e=>xt.has(Ot(e)),O=e=>kt(e)||!A(e)&&e.child.some(O),k=e=>kt(e)?D(e):O(e)?e.child.reduce((e,t)=>e+k(t),1):1,A=e=>Dt.test(e.line.trimStart()),At=e=>e.line.trimStart().startsWith(`... `),jt=e=>[e.line,...e.child.flatMap(jt)];function Mt(e,t){if(e.reduce((e,t)=>e+D(t),0)<=t)return e.flatMap(jt);if(!e.some(A)||!e.every(e=>A(e)||At(e)))return Ft(e,t);let n=e.filter(At).map(({line:e})=>e);return[...Pt(e.filter(A),t-n.length),...n]}function Nt(e,t){return t>=D(e)?jt(e):t<=1?[`${e.line} (+${D(e)-1} lines)`]:[e.line,...Mt(e.child,t-1)]}function Pt(e,t){let n=Math.max(1,Math.floor((t-1)/Math.min(e.length,St))),r=[],i=0;for(let a of e){let e=Math.min(n,D(a));if(r.length+e>t-1)break;r.push(...Nt(a,e)),i+=1}let a=` `.repeat(Et(e[0]?.line??``));return i===e.length?r:[...r,`${a}... ${e.length-i} more`]}function Ft(e,t){let n=e=>e.reduce((e,t)=>e+k(t),0);if(e.length>t||n(e)>t&&e.some(e=>k(e)===1)){let r=e.toSorted((e,t)=>Number(O(t))-Number(O(e))||D(e)-D(t)).slice(0,Math.max(0,t-1));for(;r.length>1&&k(r.at(-1)??e[0]??{line:``,child:[]})===1&&n(r)>t-1;)r.pop();let i=` `.repeat(Et(e[0]?.line??``)),a=Ft(e.filter(e=>r.includes(e)),t-1),o=e.filter(e=>!r.includes(e)).map(Ot),s=o.slice(0,10).join(`, `),c=o.length>10?`, ...`:``;return[...a,`${i}... ${o.length} more fields: ${s}${c}`]}let r=e.map(e=>({node:e,allotted:1})),i=t-e.length,a=(e,t)=>e.forEach((n,r)=>{let a=Math.min(t(n.node)-n.allotted,Math.floor(i/(e.length-r)));n.allotted+=a,i-=a});return a(r.filter(({node:e})=>k(e)>1).toSorted((e,t)=>k(e.node)-k(t.node)),k),a(r.toSorted((e,t)=>D(e.node)-e.allotted-(D(t.node)-t.allotted)),D),r.flatMap(({node:e,allotted:t})=>Nt(e,t))}function It(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:Rt(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]},i=Bt(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:mt(e)}:{...r,optionalInput:zt(e),arrayInput:Vt(e),...i===void 0?{}:{paidPlan:i}}}function Lt(e){let t=mt(e),n=e=>e.filter(e=>e.required);return{...It(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function Rt(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function zt(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)}}function Bt(e){return e.response.find(({status:e})=>e===`402`)?.description}function Vt(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var Ht=160,j=`Operation catalog matches`,Ut=[`whole`,`described`,`requiredDescribed`,`optionalNamed`],Wt=e=>`${[j,...e].join(`
|
|
14
14
|
`)}\n`,Gt=e=>yt([j,...e]);function Kt(e){if(!Array.isArray(e)||e.length===0||!e.every(Zt))return null;let t=e;for(let e of Ut){let n=[...t.flatMap(t=>Yt(t,e)),...Jt(t,e)];if(Gt(n))return Wt(n)}let n=e=>[...t.slice(0,e).flatMap(e=>Yt(e,`optionalNamed`)),...Jt(t.slice(0,e),`optionalNamed`),`... ${t.length-e} more operations omitted to fit ${T} UTF-8 bytes: ${t.slice(e).map(({operationId:e})=>e).join(`, `)}; call aventure_help with q=<operationId> and limit=1 to read one.`];return Wt(n([...t.keys()].findLast(e=>e>0&&Gt(n(e)))??1))}var qt="the CLI's `aventure help <operationId> --data` prints every input";function Jt(e,t){return e.some(e=>`optionalDetailOmitted`in e)?[`... optional argument details omitted: the full list exceeds the result cap; ${qt}.`]:t===`whole`||t===`described`||!e.some(e=>`argument`in e)?[]:[`... ${t===`requiredDescribed`?`optional argument descriptions`:`optional argument details`} omitted to fit ${T} UTF-8 bytes; structuredContent carries them, and ${qt}.`]}function Yt(e,t){let n=`argument`in e?Object.values(e.argument).flat():[],r=n.filter(({required:e})=>!e).map(({name:e})=>e);return[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,` responseContentType: ${e.responseContentType.length===0?`none`:e.responseContentType.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`arrayInput`in e&&e.arrayInput.length>0?[` JSON array inputs: ${e.arrayInput.join(`, `)}`]:[],...`paidPlan`in e&&e.paidPlan!==void 0?[` paid plan: ${e.paidPlan}`]:[],...n.filter(({required:e})=>e||t!==`optionalNamed`).map(e=>Xt(e,e.required||t!==`requiredDescribed`,t)),...t===`optionalNamed`&&r.length>0?[` optional inputs: ${r.join(`, `)}`]:[]]}function Xt(e,t,n){let r=[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.schemaEnum===void 0?void 0:`choices: ${e.schemaEnum.join(`, `)}`,e.itemSchemaEnum===void 0?void 0:`item choices: ${e.itemSchemaEnum.join(`, `)}`,e.schemaDefault===void 0?void 0:`default: ${JSON.stringify(e.schemaDefault)}`,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `),i=` ${e.name} (${r})`;return t?`${i}: ${n===`whole`||e.description.length<=Ht?e.description:`${e.description.slice(0,157)}...`}`:i}function Zt(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 Qt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map($t);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.replace(/[.[].*$/su,``)))];return{tool:ie(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 $t(e){return[e.name,`<${e.name}>`]}function en(e){let t=tn(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function tn(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 M=2,nn=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 N(e,t){let n=I(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&N(e,`person`),on(e,rn(n),n),on(e,an(n),n))}function rn(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=M&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>M&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function an(e){if(e===`person`)return`people`;if(e!==`new`)return e.length>=M&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function on(e,t,n){t!==void 0&&t!==n&&t.length>=M&&/^[a-z]+$/u.test(t)&&e.add(t)}function P(e){let t=new Set(F(e)),n=Array.from(t);for(let e of n)N(t,e);return t}function sn(e){return F(e).map(P)}function cn(e,t){if(e.length===0)return!1;let n=P(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function F(e){return I(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!nn.has(e))}function I(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 ln=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,un=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,dn=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,fn=250,pn=40,mn=100;function hn(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(un,()=>(n.add(`uuid`),` `)).replace(ln,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&dn.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=dn.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 gn(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function _n(e,t){let n=new Set;for(let r of e){let e=new Set;N(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 vn(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(F(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>gn(t,e,n.path))&&(i+=fn,r.has(t)&&(i+=pn));if(i===0)return 0;let a=new Set(F(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return N(t,e),[...t].some(e=>a.has(e))}))&&(i+=mn),i}var yn=40,bn=4,xn=3,Sn=1,Cn=new Map;function wn(e){let t=Cn.get(e);if(t!==void 0)return t;let n=m(),r=ne(n.paths,e),i=r===null?new Map:oe(n,r.operation.responses,xn);return Cn.set(e,i),i}function Tn(e,t,n){let r=0,i=new Map;for(let[e,a]of n){if(t.has(e.toLowerCase())&&(r+=yn*(4-a)/4),a>Sn)continue;let n=new Set;for(let t of F(e))N(n,t);for(let e of n)i.set(e,Math.min(i.get(e)??a,a))}for(let t of e){let e=Math.min(...[...t].map(e=>i.get(e)??1/0));e<=Sn&&(r+=bn*(2-e))}return r}var En=5,Dn=.5,On=15,kn=30,An=2,jn=100,Mn=.5;function Nn(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=hn(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=_n(i.urlPathWord,r.map(({fields:e})=>e)),o=I(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=P(o),c=sn(o),l=new Set(i.text.toLowerCase().split(/[^a-z0-9]+/u));return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Ln({normalizedQuery:o,tokens:s,termForm:c,queryWord:l},t))+vn(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 Pn(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),responseFieldLevel:wn(e.operationId)}}function Fn(e,t){let n=e.q?.trim()??``,r=Nn(n,t.filter(t=>In(e,t)&&(n.length>0||t.deprecated!==!0)),Pn),i=(r[0]?.score??0)*Dn,a=r.filter(({score:e})=>e>=i),o=e.limit===void 0||!Number.isFinite(e.limit)?En:e.limit,s=Math.min(a.length,Math.max(0,Math.trunc(o))),c=a.slice(0,s).map(({item:e})=>e),l={totalOperations:t.length,matched:a.length,returned:c.length},u=c.map(e=>It(e,c.length===1));return{summary:j,data:ee(h(j,u,{counts:l}))?u:c.map(Lt),counts:l}}function In(e,t){let{root:n}=e;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 Ln({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},i){let a=Un(i),o=Vn(i),s=0;a.some(t=>t===e)&&(s+=100),a.some(t=>t.includes(e))&&(s+=40),s+=Hn(e,a);let c=new Set(a.flatMap(F));for(let e of t)a.some(t=>t===e)?s+=20:c.has(e)&&(s+=8);for(let e of i.cliPath){let n=new Set;N(n,e),[...n].some(e=>t.has(e))&&(s+=On)}cn(n,o)&&(s+=200),n.length>1&&o.some(t=>t.includes(e))&&(s+=jn),i.parameterName.some(t=>I(t)===e)&&(s+=kn);let l=new Set(i.parameterDescription.flatMap(F));for(let e of t)l.has(e)&&(s+=An);return s+=Gn(t,i.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(i.operationId)&&(s+=30),s+=Tn(n,r,i.responseFieldLevel),s-=Wn(e,t,i.description),v(i.intent)&&!Bn(r)?s*Mn:s}var Rn=`edit change set fix rename link unlink mark publish correct`.split(` `),zn=new Set([...Object.entries(ce).filter(([,e])=>v(e)).map(([e])=>e),...Rn]);function Bn(e){return[...e].some(e=>zn.has(e))}function Vn(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(I).filter(e=>e.length>0)}function Hn(e,t){let n=F(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 Un(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,tn(e.description).useFor||e.description].map(I).filter(e=>e.length>0))]}function Wn(e,t,n){let r=I(tn(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(F(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Gn(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Kn(e,t))&&(n+=i?40:10);return n}function Kn(e,t){let n=F(t);return n.length>0&&n.every(t=>e.has(t))}function qn(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Jn(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return _(`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 _(`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`}}});if(!o.ok)return{...o,data:null};let s=et.safeParse(qn(o));if(!s.success||s.data.resolution==null)return _(`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)})),m=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...p.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return m.some(e=>!n.some(t=>t.operationId===e))?_(`No operation on this connection answers that request.`):h(m.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${m.join(`, `)}.`,{outcome:l.outcome,probability:l.probability,answer:c,candidate:l.candidate.map(({sourceId:e})=>e).filter(e=>n.some(({operationId:t})=>t===e)),...d===void 0?{}:{operation:{operationId:d.operationId,apiRoute:`${d.method} ${d.path}`,...en(d),mcpCall:Qt(d)}},...(l.taskKey,{}),...f===void 0?{}:{taskPlan:{input:f.input,step:p.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{instruction:n,operationId:r}:{instruction:n,mcpCall:Qt(e)})}}},{warnings:m.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 Yn=p({detail:f(),field:f().nullish(),scope:s([`entity`,`person`,`news`])}),Xn=s([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),Zn=Object.assign(r([Xn,f()]),{enum:Xn.enum}),L=p({modeRequested:Zn,modeUsed:Zn}),Qn=p({answerUnavailable:u(),entity:L,news:L,person:L,rejection:a(Yn),unavailable:a(s([`entity`,`person`,`news`]))}),$n=p({acceleratorParticipation:a(we),detail:a(Te)}),R=p({core:b,enrichment:Re,fundraiseRound:a(Le),research:$n,semanticMatch:je.nullish()}),er=s([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),tr=p({compositeScore:d().nullish(),cosineScore:d().nullish(),curatedAsOf:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),curatedRelationshipType:f().nullish(),curatedSource:f().nullish(),derivedFromEntityId:n().nullish(),matchedSectionWeight:d().nullish(),origin:er,rank:c(),sharedSectionCount:c().nullish()}),nr=p({entity:R,similarity:tr}),rr=p({fundraiseInvestorJoin:u(),fundraiseTransaction:u(),operatingStatus:u(),relationship:u()}),ir=s([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),ar=s([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),or=p({acquiredEntity:b,acquirerEntity:b,amount:d().int().nullish(),announcedAt:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),asOf:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),completedAt:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),createdAt:i({offset:!0}).nullish(),currency:f().nullish(),dataConfidence:ze.nullish(),evidence:rr,fundraiseTransactionId:n().nullish(),investorJoinId:n().nullish(),isCurrent:u().nullish(),publicSource:ge.nullish(),relationshipId:c(),status:ir,transactionStatus:ar.nullish(),updatedAt:i({offset:!0}).nullish()}),sr=s([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),cr=p({amountInvested:d().nullish(),createdAt:i({offset:!0}),financialInstrumentType:sr.nullish(),id:n(),investor:l,leadInvestor:u(),transactionId:n(),updatedAt:i({offset:!0})}),lr=p({entity:Fe,investorAttribution:a(Be),round:a(be),roundCount:c()}),ur=p({core:b,fundingDetail:pe.nullish(),similarity:tr,urlLink:a(_e)}),dr=p({compliance:ke.nullish(),createdAt:i({offset:!0}).nullish(),id:c(),isCurrent:u().nullish(),isPrimary:u().nullish(),language:f().nullish(),owner:l,text:f(),textName:f().nullish(),textType:f(),updatedAt:i({offset:!0}).nullish()}),fr=s([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),pr=s([`fundraiseRound`,`researchDetail`]),mr=s([`preMoney`,`postMoney`,`reported`]),hr=p({amountRaised:d().int().nullish(),asOfDate:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),confidence:Oe,currency:f(),declaredBasis:mr,derivation:fr,detailId:c().nullish(),label:f().nullish(),source:pr,sourceRef:f(),valuationPostMoney:d().int().nullish(),valuationPreMoney:d().int().nullish()}),gr=p({createdAt:i({offset:!0}).nullish(),description:f().nullish(),forkCount:c(),githubId:d().int(),homepageUrl:f().nullish(),id:d().int(),isArchived:u(),isFork:u(),language:f().nullish(),license:f().nullish(),name:f(),ownerLogin:f(),repoCreatedAt:i({offset:!0}).nullish(),repoPushedAt:i({offset:!0}).nullish(),stargazerCount:c(),topic:a(f()),updatedAt:i({offset:!0}).nullish(),url:f()}),z=p({empty:u().optional(),sorted:u().optional(),unsorted:u().optional()}),B=p({offset:d().int().optional(),paged:u().optional(),pageNumber:c().optional(),pageSize:c().optional(),sort:z.optional(),unpaged:u().optional()}),_r=p({investorAttribution:a(Be),person:Ne,round:a(be),roundCount:c()}),vr=s([`by`,`about`]),yr=s([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),br=p({canonicalUrl:f().nullish(),contentId:f(),contentType:yr,createdAt:i({offset:!0}).nullish(),publishedAt:i({offset:!0}).nullish(),relation:vr.nullish(),sourceDomain:f().nullish(),sourceName:f().nullish(),summary:f().nullish(),title:f(),topic:f().nullish(),updatedAt:i({offset:!0}).nullish(),url:f().nullish(),year:c().nullish()});p({content:a(Se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(r([De,he])).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(xe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(b).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(or).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Fe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(cr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Le).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(lr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(R).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Ie).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(ve).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Te).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Me).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(nr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(ur).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(dr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(_e).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(hr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(gr).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Ce).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(ye).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Ne).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Pe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(_r).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(Ee).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()}),p({content:a(br).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()});var xr=p({content:a(R),number:c(),size:c(),totalElements:d().int(),totalPages:c()}),Sr=p({content:a(Ce),number:c(),size:c(),totalElements:d().int(),totalPages:c()}),Cr=p({content:a(ye),number:c(),size:c(),totalElements:d().int(),totalPages:c()});p({content:a(Ae).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:c().optional(),numberOfElements:c().optional(),pageable:B.optional(),size:c().optional(),sort:z.optional(),totalElements:d().int().optional(),totalPages:c().optional()});var wr=s([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),Tr=Object.assign(r([wr,f()]),{enum:wr.enum}),Er=p({entityId:n(),source:Tr,sourceId:f()}),Dr=p({citation:a(Er),text:f(),topic:f().nullish()}),Or=p({citation:a(Er),confidence:S,description:f().nullish(),heading:f().nullish(),paragraph:a(Dr),relatedQuery:a(f()),shareable:u(),text:f(),title:f().nullish()}),kr=p({enrichmentRunId:n().nullish(),entityId:n()}),Ar=p({sortPriority:s([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),jr=p({max:i({offset:!0}).nullish(),min:i({offset:!0}).nullish()}),V=p({max:d().nullish(),min:d().nullish()}),H=p({max:c().nullish(),min:c().nullish()}),Mr=p({averageAmountInvestedUsdRange:a(V).optional(),largestAmountInvestedUsdRange:a(V).optional(),smallestAmountInvestedUsdRange:a(V).optional(),totalAmountInvestedUsdRange:a(V).optional(),totalInvestmentRange:a(H).optional()}),Nr=p({amountInvestedRange:a(V).optional(),amountRaisedRange:a(V).optional(),dateAnnouncedRange:jr.nullish(),investedCompanyName:a(f()).optional(),investedCountry:a(f()).optional(),investedIndustry:a(f()).optional(),investedRound:a(f()).optional(),investorActivity:Mr.optional(),investorName:a(f()).optional(),lastRoundYearRange:a(H).optional(),rankByInvestmentActivity:u().nullish(),round:a(f()).optional(),totalRaisedRange:a(V).optional(),valuationRange:a(V).optional()}),Pr=s([`NONE`,`COMPANY_LISTING_READY`]),Fr=s([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Ir=s([`hostPath`,`domain`]),Lr=t({acceleratorBrand:a(f()).optional(),acceleratorCohort:a(f()).optional(),acceleratorName:a(f()).optional(),acceleratorStatus:a(f()).optional(),affinity:a(f()).optional(),closedLast:u().optional(),employeeCountRange:a(H).optional(),entityId:a(n()).optional(),entityName:a(f()).optional(),featured:u().nullish(),fundraiseActivity:Nr.optional(),hasFundraising:u().nullish(),headquartersCity:a(f()).optional(),headquartersCountry:a(f()).optional(),headquartersState:a(f()).optional(),industry:a(f()).optional(),letter:f().nullish(),location:a(f()).optional(),logoOption:Ar.optional(),mainProduct:a(f()).optional(),operatingStatus:a(Fr).optional(),originCountry:a(f()).optional(),person:a(f()).optional(),portfolioHeadquartersCity:a(f()).optional(),portfolioHeadquartersCountry:a(f()).optional(),portfolioHeadquartersState:a(f()).optional(),qualityGate:Pr.optional(),rankByProminence:u().nullish(),semanticQuery:f().nullish(),slug:a(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:a(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:a(f()).optional(),textSearch:f().nullish(),typeCustomer:a(f()).optional(),typeModel:a(f()).optional(),typeOwnership:a(f()).optional(),typeRecord:a(o).optional(),typeRevenue:a(f()).optional(),typeTechnologyUsed:a(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:Ir.nullish(),urlType:me.nullish(),yearFoundedRange:a(H).optional()}),Rr=s([`discovery`,`profile`,`peer`,`comparison`]),zr=s([`keyword`,`semantic`]),Br=s([`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`]),Vr=Object.assign(r([Br,f()]),{enum:Br.enum}),Hr=p({descending:u(),field:Vr,sortKey:f().nullish()}),Ur=p({order:a(Hr),relevance:zr.nullish()}),Wr=p({confidence:S,execution:L,fallbackUsed:u(),filter:Lr,intent:Rr,interpretation:f(),sort:Ur,subjectEntityName:a(f()),unsupported:f().nullish()}),Gr=p({changedAt:i({offset:!0}).nullish(),dataSourceUpdatedAt:i({offset:!0}).nullish(),pendingApproval:c().nullish(),sourceId:f().nullish(),status:f().nullish()}),Kr=p({fundManagerRelationshipSource:Gr.nullish(),fundraiseTransaction:Le,fundraiseTransactionSource:Gr.nullish(),investorJoinSource:Gr.nullish()}),qr=p({evidence:Kr,investor:l,semanticMatch:je.nullish()}),Jr=p({entityId:n(),matchedOffering:b.nullish(),probability:d(),webUrl:a(f())}),Yr=p({entityId:n(),label:f(),publishedAt:i({offset:!0}).nullish(),score:d(),source:Tr,sourceId:f(),text:f(),url:f().nullish()}),Xr=p({answer:Or.nullish(),filing:a(kr).nullish(),interpretation:Wr,investment:a(qr),judgment:a(Jr),passage:a(Yr),peer:a(nr),pendingWebQuery:a(f()),result:xr,searchRequestId:n().nullish(),subject:a(R)}),Zr=s([`auto-match`,`needs-review`,`approved`,`rejected`]),Qr=p({createdAt:i({offset:!0}),entityId:n(),href:f().nullish(),internal:u(),matchStatus:Zr.nullish(),mention:f().nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:o.nullish(),updatedAt:i({offset:!0})}),$r=p({entity:a(Qr),newsId:c()}),ei=t({acceleratorBrand:a(f()).optional(),acceleratorCohort:a(f()).optional(),acceleratorName:a(f()).optional(),acceleratorStatus:a(f()).optional(),affinity:a(f()).optional(),closedLast:u().optional(),employeeCountRange:a(H).optional(),entityId:a(n()).optional(),entityName:a(f()).optional(),featured:u().nullish(),fundraiseActivity:Nr.optional(),hasFundraising:u().nullish(),headquartersCity:a(f()).optional(),headquartersCountry:a(f()).optional(),headquartersState:a(f()).optional(),industry:a(f()).optional(),letter:f().nullish(),location:a(f()).optional(),logoOption:Ar.optional(),mainProduct:a(f()).optional(),operatingStatus:a(Fr).optional(),originCountry:a(f()).optional(),person:a(f()).optional(),portfolioHeadquartersCity:a(f()).optional(),portfolioHeadquartersCountry:a(f()).optional(),portfolioHeadquartersState:a(f()).optional(),qualityGate:Pr.optional(),rankByProminence:u().nullish(),slug:a(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:a(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:a(f()).optional(),textSearch:f().nullish(),typeCustomer:a(f()).optional(),typeModel:a(f()).optional(),typeOwnership:a(f()).optional(),typeRecord:a(o).optional(),typeRevenue:a(f()).optional(),typeTechnologyUsed:a(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:Ir.nullish(),urlType:me.nullish(),yearFoundedRange:a(H).optional()}),ti=p({amountInvestedRange:a(V).nullish(),amountRaisedRange:a(V).nullish(),entityName:a(f()).nullish(),investedCompany:a(f()).nullish(),personTitle:a(f()).nullish(),round:a(f()).nullish(),totalInvestmentCount:a(H).nullish(),typeRecord:a(o).nullish()}),ni=p({arrayFilter:ti.optional(),entityFilter:ei.optional(),entityId:n().nullish(),entitySlug:f().nullish(),firstName:f().nullish(),includeAddress:u().nullish(),includeUrl:u().nullish(),investorActivity:Mr.optional(),isCurrent:u().nullish(),lastName:f().nullish(),letter:f().nullish(),personId:a(n()).max(200).optional(),personName:a(f()).optional(),role:f().nullish(),search:f().nullish(),semanticQuery:f().nullish(),status:f().nullish()}),ri=p({descending:u(),field:s([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:f().nullish()}),ii=p({order:a(ri),relevance:zr.nullish()}),ai=p({confidence:S,execution:L,fallbackUsed:u(),filter:ni,interpretation:f(),sort:ii,unsupported:f().nullish()}),oi=p({interpretation:ai,investment:a(qr),result:Cr,searchRequestId:n().nullish()}),si=p({label:f(),query:f()}),ci=p({key:f(),option:a(si),prompt:f()}),li=p({entity:Xr,entityDetail:a(Fe),news:Sr,newsEntityMention:a($r),person:oi,personDetail:a(Ne),provenance:Qn,qualifier:ci.nullish()});function ui(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>di(e)),...n.flatMap(e=>e.parameter.map(t=>di(t,n.length>1?e.contentType:void 0))),...fi(n)],i=[t,...e.cliPath].join(` `),a=v(e.intent),o=ae(e),s=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:le(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!se(e.path)||o===null?null:ie(o),body:{hasBody:s!==void 0,kind:s?.kind??null,...s!==void 0&&n.length>1?{contentType:s.contentType}:{},required:s?.required??!1,description:s?.description??``,requiredPath:s?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function di(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 fi(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 pi(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var mi=[`-id`,`-slug`,`-url`],hi=[`--id`,`--slug`,`--url`],gi=`/v1/lookup`,_i=`--from-file "<path>"`;function vi(e,t,n=te().bin[0]){let r=ui(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:Si(i,r)}function yi(e,t,n=te().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:ui([r],n);return i&&xi(i,Ti(i,!1))}function bi(e,t,n,r=te().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 yi(o.operationId,t,r)}function xi(e,t){return[e.cli.command,...t,`--data`].join(` `)}function Si(e,t){return[`example: ${xi(e,Ti(e))}`,...Ci(e,t)]}function Ci(e,t){return pi(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} ${Di(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===gi),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} ${Di(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var wi=/(?:^|\.)text$/u;function Ti(e,t=!0){let n=pi(e),r=n.filter(e=>e.required),i=e.body.kind===`json`&&n.some(e=>e.location===`body`&&wi.test(e.wireName)&&(e.required||!e.wireName.includes(`.`))),a=i?r.filter(e=>e.location!==`body`):r,o=(r.length>0||!t?a:Ei(e)).map(Di);return i||(e.body.required||e.body.requiredPath.length>0)&&!a.some(e=>e.location===`body`)?[...o,_i]:o}function Ei(e){let t=new Set;N(t,e.resource);for(let n of mi)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 hi){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function Di(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Oi=`aventure`;function ki(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Oi} ${n.join(` `)}`}function Ai(e,t,n=e){return yi(e,t,`aventure`)??n}function ji(e,t){let n=et.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return Mi(r,o,t);let s=r.trimEnd().split(`
|
|
15
|
-
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==We.options[0].enum.OPERATION)return[];let r=ki(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 Mi(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Pi(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:Fi(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Ai(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...Li(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...Li(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Ni(e,t){let n=Qe.safeParse(e);return n.success?[Pi(n.data),...Fi(n.data,t)]:null}var Pi=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function Fi(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===void 0?``:`${n.stepKey}: `}${Ai(n.operationId,t,r)}`,` ${n.instruction}`,...Ii(e,a,i)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function Ii(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 Li(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:ki(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 U=30,Ri=8,W=10,zi=2,Bi=[`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`],Vi=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Hi=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Ui(e,t,n){if(typeof t==`string`)return bt(t);let r=Kt(t);if(r!==null)return E(r);let i=ea(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=ue(a?.detailField,i.response),c={...i,response:o,parameters:a?.parameters??[]},l=ji(c.response,e)??Ni(c.response,e);if(l!==null)return E(l.join(`
|
|
15
|
+
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==We.options[0].enum.OPERATION)return[];let r=ki(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 Mi(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Pi(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:Fi(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Ai(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...Li(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...Li(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Ni(e,t){let n=Qe.safeParse(e);return n.success?[Pi(n.data),...Fi(n.data,t)]:null}var Pi=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function Fi(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,required:r})=>` ${e} (${t}, ${r===!1?`optional`:`required`}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey===void 0?``:`${n.stepKey}: `}${Ai(n.operationId,t,r)}`,` ${n.instruction}`,...Ii(e,a,i)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function Ii(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 Li(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:ki(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 U=30,Ri=8,W=10,zi=2,Bi=[`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`],Vi=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Hi=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Ui(e,t,n){if(typeof t==`string`)return bt(t);let r=Kt(t);if(r!==null)return E(r);let i=ea(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=ue(a?.detailField,i.response),c={...i,response:o,parameters:a?.parameters??[]},l=ji(c.response,e)??Ni(c.response,e);if(l!==null)return E(l.join(`
|
|
16
16
|
`),!0);let u=Wi(c);if(u!==null)return E([...u,...s].join(`
|
|
17
17
|
`),!0,s.length>0);let d=[c.summary??n??c.operationId??`OpenAPI call succeeded`,`${c.method} ${c.endpoint}`],f=Ct(Ji(c),117-s.length,T-x.byteLength(`${[...d,...s].join(`
|
|
18
18
|
`)}\n`,`utf8`));return E([...[...d,...f].filter(Boolean),...s].join(`
|