@aventurevc/aventure-cli 0.8.160 → 0.8.163
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-BaFR1-Q7.js → aventure-cli-fE_r5knz.js} +3 -3
- package/dist/chunks/{cli-help-policy-eA1rRqwV.js → cli-help-policy-BI46WMpS.js} +1 -1
- package/dist/chunks/{contract-pjK8N0Ve.js → contract-DsJpmXt1.js} +1 -1
- package/dist/chunks/{dist-DsCSjiqX.js → dist-7yhs-ME2.js} +2 -2
- package/dist/chunks/mcp-generation-contract-BIVYgnFD.js +1 -0
- package/dist/chunks/mcp-generation-contract-C-V7y0TL.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-D2zU35Qa.js → oauth-bearer-credential-C8feByUz.js} +2 -2
- package/dist/chunks/oauth-bearer-credential-FF2FoIc6.js +1 -0
- package/dist/chunks/oauth-login-BM7QBg3R.js +1 -0
- package/dist/chunks/{oauth-login-Dsyw14Ch.js → oauth-login-Bc0MpiZz.js} +1 -1
- package/dist/chunks/openapi-commands-B5iVe_vp.js +1 -0
- package/dist/chunks/openapi-commands-BVnqVHja.js +1 -0
- package/dist/chunks/provider-catalog-B1WSHmeW.js +1 -0
- package/dist/chunks/startup-auth-CdgAbERQ.js +1 -0
- package/dist/chunks/{startup-auth-DKMsipha.js → startup-auth-WRD9Td-E.js} +1 -1
- package/dist/chunks/{tool-policy-DIjXzIow.js → tool-policy-Cv9t1JU0.js} +1 -1
- package/package.json +3 -3
- package/dist/chunks/mcp-generation-contract-Cbt-sm0o.js +0 -1
- package/dist/chunks/mcp-generation-contract-CzCMl43z.js +0 -1
- package/dist/chunks/oauth-bearer-credential-CopYk7In.js +0 -1
- package/dist/chunks/oauth-login-VusrmPf_.js +0 -1
- package/dist/chunks/openapi-commands-9O-TmFxP.js +0 -1
- package/dist/chunks/openapi-commands-DrCmBKMz.js +0 -1
- package/dist/chunks/provider-catalog-B_HzVETh.js +0 -1
- package/dist/chunks/startup-auth-PO1_QZJo.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-DB4o7SBd.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-DB4o7SBd.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-FF2FoIc6.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-CGaxH3C8.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-CdgAbERQ.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CxrRvM47.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-TWdpuIGe.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-BVnqVHja.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-fE_r5knz.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-12T04:48:18.342Z",
|
|
5
5
|
"totalOperations": 145,
|
|
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-BAomjpNJ.js";import{M as s,O as c,i as l,o as u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Ar as m,Dr as h,Er as ee,Lr as te,Mr as ne,Or as re,Rr as ie,kr as ae}from"./dist-DsCSjiqX.js";import{c as g,d as oe,i as _,r as se}from"./result-envelope-DVa9d3ew.js";import{i as ce,l as v,o as le,r as ue,s as de,t as y}from"./env-D4vniJEe.js";import{a as b,n as fe,r as pe,t as me}from"./package-DPDX5zmx.js";import{C as he,d as ge,f as _e,o as ve,p as ye,r as be,s as xe,t as Se}from"./tool-policy-DIjXzIow.js";import{i as Ce,r as we}from"./response-problem-VcN_MbaF.js";import{n as Te}from"./output-spill-BFBs6oZp.js";import{a as Ee,c as De,d as Oe,f as ke,i as Ae,l as je,m as Me,n as x,o as Ne,r as Pe,s as Fe,u as Ie,y as Le}from"./contract-pjK8N0Ve.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-eA1rRqwV.js";import{S as Ge,_ as Ke,a as qe,g as S,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 C,y as rt}from"./api-key-bearer-credential-DHlDPjOL.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-D2zU35Qa.js";import{n as mt,r as ht,t as gt}from"./oauth-login-Dsyw14Ch.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-DKMsipha.js";import{n as Dt,t as w}from"./openapi-commands-9O-TmFxP.js";import{i as T,r as Ot,t as E}from"./output-mode-BJvIObHp.js";import{spawnSync as kt}from"node:child_process";import{basename as D,dirname as O,relative as At,resolve as k,sep as A}from"node:path";import{copyFileSync as jt,existsSync as j,lstatSync as Mt,mkdirSync as M,mkdtempSync as Nt,readFileSync as Pt,readdirSync as Ft,readlinkSync as It,realpathSync as Lt,renameSync as Rt,symlinkSync as zt,writeFileSync as Bt}from"node:fs";import N,{stderr as P,stdin as Vt}from"node:process";import{TextDecoder as Ht,inspect as Ut}from"node:util";import{homedir as Wt,hostname as Gt,platform as Kt}from"node:os";import{fileURLToPath as qt}from"node:url";import{setTimeout as Jt}from"node:timers/promises";import{randomUUID as Yt,webcrypto as Xt}from"node:crypto";import{readFile as Zt}from"node:fs/promises";import{createInterface as Qt}from"node:readline/promises";function $t(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{..._(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return g(`Environment-bound options applied`,r)}function en(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||!hn(n,r.name))continue;let a=mn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function tn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function nn(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return yn(e,t,n);for(let[r,i]of n.entries()){let n=yn(e,t,i,r);if(!n.ok)return n}return g(`Body value assigned`,null)}function rn(e,t,n,r){return yn(e,t,r,n)}function an(e){let t=[];for(let n of e.split(`.`)){let e=xn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function on(e,t){let n=an(t);if(n===null)return null;let r=pn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:fn(r)}:null}function sn(e,t){if(F(e.name)||e.schemaType===`array`)return g(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return g(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?g(`Scalar body option selected`,t[0]):_(`${n} was already given; pass it once.`)}var cn=/^(?<row>\d+):(?<item>.*)$/su;function ln(e,t){let n=an(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=cn.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function un(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&an(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function dn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=on(r,i.name);if(a===null)continue;if(a.firstHole!==null)return _(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||ln(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return _(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function fn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function pn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function mn(e,t){if(!F(t))return pn(e,t.split(`.`))}function hn(e,t){return _n(e,t.split(`.`))}function gn(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)&&hn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function _n(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=xn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>_n(e,r)):_n(a,r)}function F(e){return e.split(`.`).some(e=>xn(e).isArray)}function vn(e,t){return e.parameter.length===0||!I(t)?null:Cn(t,[],Sn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=xn(o),c=e===i.length-1,l=bn(a,s,t,c,n,r);if(!l.ok||l.data===null)return _(l.summary,l.warnings);if(c)return g(`Body value assigned`,null);a=l.data}return _(`${t} is not a valid body option path.`)}function bn(e,t,n,r,i,a){let o=()=>_(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,g(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,g(`Body path created`,e)}return I(c)?g(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,g(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,g(`Body path created`,n)}return I(s)?g(`Body path stepped`,s):o()}function xn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Sn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function Cn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Cn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!wn(a,n)){if(!Tn(e))continue;let t=En(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Cn(i,e,n);if(o!==null)return o}return null}function wn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Tn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function En(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:Dn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function Dn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}var On=e=>Array.isArray(e)&&!Object.isFrozen(e);function kn(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=ne(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!On(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?Ln(r,i):r===void 0?i===void 0?0:1:-1})}function An(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 jn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Mn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Fn(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 Nn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Pn(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 Fn(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}.`:``}${In(e,t)}`}function In(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=an(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function Ln(e,t){return Ue(e)-Ue(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Rn(e){let t;try{t=e===`-`?await zn():await Zt(e,`utf8`)}catch(t){return _(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return g(`No input provided`,null);let e=JSON.parse(t);return g(`Input parsed`,e)}catch(e){return _(`Input is not valid JSON: ${e.message}`)}}async function zn(){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 Bn=`--content-type`;function Vn(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Bn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Bn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Un(a)))}if(sr(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>`,Pn(r,r.requiredPath)).argParser(Gn(`--from-file`)))}let o=An(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Ln(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(jn(n),a.length>1?Mn(n):Fn(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Nn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Hn):F(i.name)||i.schemaType===`array`?o.argParser(Wn):o.argParser(Gn(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`)})}or(e,n,o)}function Hn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Un(e){return(t,r)=>{if(r!==void 0)throw new n(`${Bn} was already given; pass it once.`);let i=he(e,t);if(!i.ok)throw new n(i.summary);return t}}function Wn(e,t){return[...t??[],e]}function Gn(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 Kn(e,t){let n=Ct(e,t),r=he(e.requestBody??[],n);if(!r.ok||r.data===null)return _(r.summary,r.warnings);let i=r.data;if(i===void 0)return g(`No body`,void 0);let a=qn(e,i,t);if(a!==null)return _(a);let o=$t(e.operationId,i,t);if(!o.ok)return _(o.summary,o.warnings);t=o.data;let s=Jn(i,t);if(s!==null)return _(s);let c=await Qn(t);if(!c.ok)return _(c.summary,c.warnings);let l=gn(e.requestBody??[],i,c.data);if(l!==null)return _(l);let u=Zn(e.operationId,i,c.data);if(!u.ok)return u;let d=en(e.operationId,i,c.data);if(d!==null)return _(d);let f=$n(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?_(ar(e.operationId,i)):g(`No body`,void 0);let p=tr(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return _(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return _(`${e.operationId} requires a JSON object${t}.`)}let m=Xn(i,p.data);if(m.length>0)return _(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=I(h)?tn(i).filter(e=>!hn(h,e)):[];return ee.length>0?_(Yn(e.operationId,i,ee)):p}function qn(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 ${Bn} ${i.join(` or `)}.`}return null}function Jn(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 Yn(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 Xn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!hn(t,e.name)).map(L):[]}function Zn(e,t,n){let r=vn(t,n);if(r===null)return g(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return _(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Qn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return g(`No body file`,void 0);let n=await Rn(t);if(!n.ok)return _(n.summary,n.warnings);let r=oe.safeParse(n.data);return r.success?g(`Input parsed`,r.data):_(`Input is not valid JSON value: ${r.error.message}`)}function $n(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=sn(e,n[e.optionKey]);if(!a.ok||a.data===null)return _(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=er(t,n,r,e,o);if(!s.ok)return _(s.summary,s.warnings);i=!0}if(!i)return g(`No direct body options`,void 0);let a=dn(e,t,n,r);return a===null?g(`Direct body options parsed`,r):a}function er(e,t,n,r,i){let a=ln(r,i);if(a===null){let e=rr(r,i);return e.ok?nn(n,r.name,e.data,r.schemaType===`array`):_(e.summary,e.warnings)}if(a.plain.length>0)return _(`${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=un(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return _(`${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=ir(r.name,r.itemSchemaType,e);if(!t.ok)return _(t.summary,t.warnings);i.push(t.data)}let a=rn(n,r.name,e,i);if(!a.ok)return a}return g(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function tr(e,t,n,r){if(n===void 0)return g(`Direct body parsed`,r);if(r===void 0)return g(`Input parsed`,n);if(I(n)&&I(r))try{return g(`Input parsed`,nr(t,n,r))}catch(t){return _(`${e} ${t instanceof Error?t.message:String(t)}`)}return _(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function nr(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]=nr(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`:Fe.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function rr(e,t){if(typeof t==`boolean`)return g(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return ir(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=ir(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return g(`Body value parsed`,n)}function ir(e,t,n){if(t===`boolean`)return n===`true`?g(`Body value parsed`,!0):n===`false`?g(`Body value parsed`,!1):_(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?_(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?_(`${e} must be an integer.`):g(`Body value parsed`,i)}return g(`Body value parsed`,n)}function ar(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=tn(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 or(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Bn,location:`body`}),sr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),kn(e.options,r)}function sr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function cr(e){let t=se(e,Pe(e,w));return vr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function lr(e){let t=se(e,Pe(e,w));vr(t);let n=Ae(w,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=ur(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-BAomjpNJ.js";import{M as s,O as c,i as l,o as u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Ar as m,Dr as h,Er as ee,Lr as te,Mr as ne,Or as re,Rr as ie,kr as ae}from"./dist-7yhs-ME2.js";import{c as g,d as oe,i as _,r as se}from"./result-envelope-DVa9d3ew.js";import{i as ce,l as v,o as le,r as ue,s as de,t as y}from"./env-D4vniJEe.js";import{a as b,n as fe,r as pe,t as me}from"./package-DPDX5zmx.js";import{C as he,d as ge,f as _e,o as ve,p as ye,r as be,s as xe,t as Se}from"./tool-policy-Cv9t1JU0.js";import{i as Ce,r as we}from"./response-problem-VcN_MbaF.js";import{n as Te}from"./output-spill-BFBs6oZp.js";import{a as Ee,c as De,d as Oe,f as ke,i as Ae,l as je,m as Me,n as x,o as Ne,r as Pe,s as Fe,u as Ie,y as Le}from"./contract-DsJpmXt1.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-BI46WMpS.js";import{S as Ge,_ as Ke,a as qe,g as S,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 C,y as rt}from"./api-key-bearer-credential-DHlDPjOL.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-C8feByUz.js";import{n as mt,r as ht,t as gt}from"./oauth-login-Bc0MpiZz.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-WRD9Td-E.js";import{n as Dt,t as w}from"./openapi-commands-B5iVe_vp.js";import{i as T,r as Ot,t as E}from"./output-mode-BJvIObHp.js";import{spawnSync as kt}from"node:child_process";import{basename as D,dirname as O,relative as At,resolve as k,sep as A}from"node:path";import{copyFileSync as jt,existsSync as j,lstatSync as Mt,mkdirSync as M,mkdtempSync as Nt,readFileSync as Pt,readdirSync as Ft,readlinkSync as It,realpathSync as Lt,renameSync as Rt,symlinkSync as zt,writeFileSync as Bt}from"node:fs";import N,{stderr as P,stdin as Vt}from"node:process";import{TextDecoder as Ht,inspect as Ut}from"node:util";import{homedir as Wt,hostname as Gt,platform as Kt}from"node:os";import{fileURLToPath as qt}from"node:url";import{setTimeout as Jt}from"node:timers/promises";import{randomUUID as Yt,webcrypto as Xt}from"node:crypto";import{readFile as Zt}from"node:fs/promises";import{createInterface as Qt}from"node:readline/promises";function $t(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{..._(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return g(`Environment-bound options applied`,r)}function en(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||!hn(n,r.name))continue;let a=mn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function tn(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function nn(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return yn(e,t,n);for(let[r,i]of n.entries()){let n=yn(e,t,i,r);if(!n.ok)return n}return g(`Body value assigned`,null)}function rn(e,t,n,r){return yn(e,t,r,n)}function an(e){let t=[];for(let n of e.split(`.`)){let e=xn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function on(e,t){let n=an(t);if(n===null)return null;let r=pn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:fn(r)}:null}function sn(e,t){if(F(e.name)||e.schemaType===`array`)return g(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return g(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?g(`Scalar body option selected`,t[0]):_(`${n} was already given; pass it once.`)}var cn=/^(?<row>\d+):(?<item>.*)$/su;function ln(e,t){let n=an(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=cn.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function un(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&an(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function dn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=on(r,i.name);if(a===null)continue;if(a.firstHole!==null)return _(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||ln(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return _(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function fn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function pn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function mn(e,t){if(!F(t))return pn(e,t.split(`.`))}function hn(e,t){return _n(e,t.split(`.`))}function gn(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)&&hn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function _n(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=xn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>_n(e,r)):_n(a,r)}function F(e){return e.split(`.`).some(e=>xn(e).isArray)}function vn(e,t){return e.parameter.length===0||!I(t)?null:Cn(t,[],Sn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=xn(o),c=e===i.length-1,l=bn(a,s,t,c,n,r);if(!l.ok||l.data===null)return _(l.summary,l.warnings);if(c)return g(`Body value assigned`,null);a=l.data}return _(`${t} is not a valid body option path.`)}function bn(e,t,n,r,i,a){let o=()=>_(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,g(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,g(`Body path created`,e)}return I(c)?g(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,g(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,g(`Body path created`,n)}return I(s)?g(`Body path stepped`,s):o()}function xn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Sn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function Cn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Cn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!wn(a,n)){if(!Tn(e))continue;let t=En(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Cn(i,e,n);if(o!==null)return o}return null}function wn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Tn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function En(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:Dn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function Dn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}var On=e=>Array.isArray(e)&&!Object.isFrozen(e);function kn(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=ne(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!On(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?Ln(r,i):r===void 0?i===void 0?0:1:-1})}function An(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 jn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Mn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Fn(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 Nn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Pn(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 Fn(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}.`:``}${In(e,t)}`}function In(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=an(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function Ln(e,t){return Ue(e)-Ue(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Rn(e){let t;try{t=e===`-`?await zn():await Zt(e,`utf8`)}catch(t){return _(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return g(`No input provided`,null);let e=JSON.parse(t);return g(`Input parsed`,e)}catch(e){return _(`Input is not valid JSON: ${e.message}`)}}async function zn(){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 Bn=`--content-type`;function Vn(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Bn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Bn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Un(a)))}if(sr(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>`,Pn(r,r.requiredPath)).argParser(Gn(`--from-file`)))}let o=An(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Ln(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(jn(n),a.length>1?Mn(n):Fn(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Nn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Hn):F(i.name)||i.schemaType===`array`?o.argParser(Wn):o.argParser(Gn(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`)})}or(e,n,o)}function Hn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Un(e){return(t,r)=>{if(r!==void 0)throw new n(`${Bn} was already given; pass it once.`);let i=he(e,t);if(!i.ok)throw new n(i.summary);return t}}function Wn(e,t){return[...t??[],e]}function Gn(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 Kn(e,t){let n=Ct(e,t),r=he(e.requestBody??[],n);if(!r.ok||r.data===null)return _(r.summary,r.warnings);let i=r.data;if(i===void 0)return g(`No body`,void 0);let a=qn(e,i,t);if(a!==null)return _(a);let o=$t(e.operationId,i,t);if(!o.ok)return _(o.summary,o.warnings);t=o.data;let s=Jn(i,t);if(s!==null)return _(s);let c=await Qn(t);if(!c.ok)return _(c.summary,c.warnings);let l=gn(e.requestBody??[],i,c.data);if(l!==null)return _(l);let u=Zn(e.operationId,i,c.data);if(!u.ok)return u;let d=en(e.operationId,i,c.data);if(d!==null)return _(d);let f=$n(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?_(ar(e.operationId,i)):g(`No body`,void 0);let p=tr(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return _(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return _(`${e.operationId} requires a JSON object${t}.`)}let m=Xn(i,p.data);if(m.length>0)return _(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=I(h)?tn(i).filter(e=>!hn(h,e)):[];return ee.length>0?_(Yn(e.operationId,i,ee)):p}function qn(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 ${Bn} ${i.join(` or `)}.`}return null}function Jn(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 Yn(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 Xn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!hn(t,e.name)).map(L):[]}function Zn(e,t,n){let r=vn(t,n);if(r===null)return g(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return _(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Qn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return g(`No body file`,void 0);let n=await Rn(t);if(!n.ok)return _(n.summary,n.warnings);let r=oe.safeParse(n.data);return r.success?g(`Input parsed`,r.data):_(`Input is not valid JSON value: ${r.error.message}`)}function $n(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=sn(e,n[e.optionKey]);if(!a.ok||a.data===null)return _(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=er(t,n,r,e,o);if(!s.ok)return _(s.summary,s.warnings);i=!0}if(!i)return g(`No direct body options`,void 0);let a=dn(e,t,n,r);return a===null?g(`Direct body options parsed`,r):a}function er(e,t,n,r,i){let a=ln(r,i);if(a===null){let e=rr(r,i);return e.ok?nn(n,r.name,e.data,r.schemaType===`array`):_(e.summary,e.warnings)}if(a.plain.length>0)return _(`${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=un(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return _(`${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=ir(r.name,r.itemSchemaType,e);if(!t.ok)return _(t.summary,t.warnings);i.push(t.data)}let a=rn(n,r.name,e,i);if(!a.ok)return a}return g(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function tr(e,t,n,r){if(n===void 0)return g(`Direct body parsed`,r);if(r===void 0)return g(`Input parsed`,n);if(I(n)&&I(r))try{return g(`Input parsed`,nr(t,n,r))}catch(t){return _(`${e} ${t instanceof Error?t.message:String(t)}`)}return _(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function nr(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]=nr(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`:Fe.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function rr(e,t){if(typeof t==`boolean`)return g(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return ir(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=ir(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return g(`Body value parsed`,n)}function ir(e,t,n){if(t===`boolean`)return n===`true`?g(`Body value parsed`,!0):n===`false`?g(`Body value parsed`,!1):_(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?_(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?_(`${e} must be an integer.`):g(`Body value parsed`,i)}return g(`Body value parsed`,n)}function ar(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=tn(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 or(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Bn,location:`body`}),sr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),kn(e.options,r)}function sr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function cr(e){let t=se(e,Pe(e,w));return vr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function lr(e){let t=se(e,Pe(e,w));vr(t);let n=Ae(w,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=ur(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(Ee(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(...mr(t.problem)),r.push(...ur(t)),process.stdout.write(Ee(r.join(`
|
|
4
4
|
`),!0))}function ur(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=Te(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?se(n,dr(n)):n;vr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?fr(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?cr(n):n;e.mode===`text`&&lr(r),r.ok||(process.exitCode=1)}function dr(e){let t=Pe(e,w);if(t.write===!0)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 fr(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function pr(e,t){let n=Ne(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:T(e)},ro(void 0,`apply`,e.release)))}function ro(e,t=`apply`,n){let r=e;try{r??=b(process.argv[1])}catch(e){return _(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let i=r.name,a=r.version,o=r.registry===``?``:fe,s=r.registry===``&&i===`@aventurevc/aventure-cli`,c=n;if(c===void 0){let e=io([`view`,o,`version`,`--silent`,`--global`],r,{timeout:eo});if(!e.ok)return{...e,data:null};if(c=(e.data??``).trim(),c===``)return _(`npm view ${o} returned empty version`,[`empty_stdout`])}let l=n!==void 0||s||$a.compare(a,c)<0,u={targetPackage:o,runningPackage:i,currentVersion:a,latestVersion:c,upgradeAvailable:l,upgradeInstalled:!1};if(t===`check`)return g(`${i}@${a} → ${o}@${c} (${l?`available`:`up to date`})`,u);if(r.workingTreeRoot!==null)return _(`Refusing to install over the working-tree build at ${r.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=so(r),t=k(e,...to),i=D(o),s=k(t,`${i}-current`),l=o===``?[o,``]:[o,pe],d=co(e,r),f=n??[c,d?.version??a].reduce((e,t)=>$a.compare(e,t)<0?t:e,a);M(t,{recursive:!0});let p=[oo(r),...j(s)?[Lt(s)]:[],...Ft(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>k(t,e.name))],m,h=null,ee=!1;for(let t of new Set(p.filter(t=>t!==e))){let e=ao(t,l,f,r.registry);if(e.ok&&e.data!==null){m=t,h=e.data;break}}if(m===void 0){m=Nt(k(t,`${i}-${encodeURIComponent(f)}-`));let e=io([`install`,`-g`,`--prefix`,m,...l.map(e=>`${e}@${f}`)],r,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};ee=!0;let n=ao(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 te=lo(m,e,s,h,n),ne=fo();return g(`${o} active at ${te}`,{...u,upgradeInstalled:ee||n!==void 0||d?.version!==te,installPrefix:e,verifiedVersion:te,completionRefreshed:ne.refreshed,completionRefreshMessage:ne.message})}catch(e){return _(`${o} update failed: ${uo(e)}`,[`existing releases were preserved`])}}function io(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?_(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):_(`npm ${e[0]??``} failed to start: ${a.error.message}`,[`spawn_error`]);if(a.status!==0){let t=(a.stderr??``).trim().split(`
|
|
28
28
|
`).slice(-3).join(` | `);return _(`npm ${e.join(` `)} exited ${a.status}`,[t||`no stderr`])}return g(`npm ok`,a.stdout??``)}function ao(e,t,n,r){try{let i=t.map(t=>{let i=b(k(e,`lib`,`node_modules`,...t.split(`/`),`package.json`));if(i.name!==t||i.version!==n||i.registry!==r)throw Error(`${t} does not match ${n} from ${r}`);for(let t of i.bin)if(!Lt(k(e,`bin`,t)).startsWith(`${i.packageRoot}${A}`))throw Error(`${t} escapes ${i.packageRoot}`);return i});for(let t of i){let r=k(e,`bin`,t.bin[0]),i=kt(process.execPath,[r,`--version`],{encoding:`utf8`,timeout:eo});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 g(`CLI and MCP release verified`,i)}catch(t){return _(`release verification failed: ${uo(t)}`,[`release prefix: ${e}`])}}function oo(e){let t=O(e.packageRoot),n=O(t),r=O(n);if(D(t)!==e.name.split(`/`)[0]||D(n)!==`node_modules`||D(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}${A}`))throw Error(`the running entry escapes its package root`);return O(r)}function so(e){let t=oo(e),n=`${A}${to.join(A)}${A}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function co(e,t){let n=t.registry===``?D(``):me,r=k(e,`bin`,n);if(!j(r))return null;let i=b(r);if(i.registry!==t.registry)throw Error(`${r} belongs to another product`);return i}function lo(e,t,n,r,i){let a=r[0];if(a===void 0)throw Error(`release contains no CLI`);let o=k(t,`bin`);M(o,{recursive:!0});let s=r.flatMap(e=>e.bin.filter((e,t)=>{let n=k(o,e);if(!j(n)||b(n).registry===a.registry)return!0;if(a.registry!==``&&t>0)return!1;throw Error(`${n} belongs to another product`)}));if(!j(n)){let t=Nt(k(O(n),`${D(n)}-seed-`));M(k(t,`bin`));for(let n of s){let r=k(o,n);zt(Lt(j(r)?r:k(e,`bin`,n)),k(t,`bin`,n))}try{zt(At(O(n),t),n)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!Mt(n).isSymbolicLink())throw Error(`${n} is not a release symlink`);for(let e of s){let t=At(o,k(n,`bin`,e)),r=k(o,`.${e}-${Yt()}`);zt(t,r),Rt(r,k(o,e))}for(let e of s){let t=k(o,e);if(!Mt(t).isSymbolicLink()||k(o,It(t))!==k(n,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let c=co(t,a);if(i===void 0&&c!==null&&$a.compare(c.version,a.version)>0)return c.version;let l=`${n}-${Yt()}`;return zt(At(O(n),e),l),Rt(l,n),a.version}function uo(e){return e instanceof Error?e.message:String(e)}function fo(){try{return La()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}var po=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers its generated status operation`},{name:`auth`,purpose:`which credential signs in, as which account and role, never secrets`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}],mo=`operationFingerprint`;function ho(e,t=b().bin[0]){E(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: [...] }`:",...po.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:T(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?g(l,c,{counts:o}):{..._(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 w.find(e=>e.intent===`status`&&e.resource===`status`)}function yo(e){let t=b(),n=ro(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-Dobtzmp5.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\` — ${S(t)}.`)}}async function xo(e,t){if(e===void 0)return{check:K(`api-host`,`skip`,`No status operation resolved from the generated catalog; fix the catalog check first.`),servedFingerprint:null};let n;try{n=v().host}catch(e){return{check:K(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${S(e)}.`),servedFingerprint:null}}let r=await m({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`}).catch(e=>_(S(e)));return r.ok?{check:K(`api-host`,`pass`,`${e.method} ${e.path} answered at ${n}.`),servedFingerprint:So(r.data)}:{check:K(`api-host`,`fail`,r.httpStatus===401?`Replace or unset the credential ${n} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} returned ${r.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} at ${n} returned ${r.summary}.`),servedFingerprint:null}}function 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[mo];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 ${y.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 ${y.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 ${y.authToken} in the environment.`)}async function wo(e,t){let n=C(v().host),r=await oa(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await aa(`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 ${S(t,[v().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function To(){let e;try{e=C(v().host)}catch(e){return{state:`unavailable`,summary:S(e)}}return await dt(e)}async function Eo(){let e;try{e=C(v().host)}catch(e){return{state:`unavailable`,summary:S(e),cause:`environment`}}try{return await $e(e)}catch(e){return{state:`unavailable`,summary:S(e),cause:`storage`}}}function Do(e,t,n){return[ka(e),`oauth=${ko(t)}`,`api-key=${Oo(n)}`].join(` `)}function Oo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=C(v().host);return`${e.stored.activation}${ma(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=w.length;if(e===void 0)return K(`catalog`,`fail`,`Regenerate the command catalog with \`make mcp-generate-contracts\` and reinstall: none of its ${i} operations is the status operation.`);if(t===null)return 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?g(l,c,{counts:o}):{..._(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 w.find(e=>e.intent===`status`&&e.resource===`status`)}function yo(e){let t=b(),n=ro(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-Dobtzmp5.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\` — ${S(t)}.`)}}async function xo(e,t){if(e===void 0)return{check:K(`api-host`,`skip`,`No status operation resolved from the generated catalog; fix the catalog check first.`),servedFingerprint:null};let n;try{n=v().host}catch(e){return{check:K(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${S(e)}.`),servedFingerprint:null}}let r=await m({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`}).catch(e=>_(S(e)));return r.ok?{check:K(`api-host`,`pass`,`${e.method} ${e.path} answered at ${n}.`),servedFingerprint:So(r.data)}:{check:K(`api-host`,`fail`,r.httpStatus===401?`Replace or unset the credential ${n} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} returned ${r.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} at ${n} returned ${r.summary}.`),servedFingerprint:null}}function 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[mo];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 ${y.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 ${y.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 ${y.authToken} in the environment.`)}async function wo(e,t){let n=C(v().host),r=await oa(e),i=`credential=${t.present?t.source??`env`:r.materialized??`none`}`;try{if(r.failure!==null)throw Error(r.failure);let e=await aa(`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 ${S(t,[v().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function To(){let e;try{e=C(v().host)}catch(e){return{state:`unavailable`,summary:S(e)}}return await dt(e)}async function Eo(){let e;try{e=C(v().host)}catch(e){return{state:`unavailable`,summary:S(e),cause:`environment`}}try{return await $e(e)}catch(e){return{state:`unavailable`,summary:S(e),cause:`storage`}}}function Do(e,t,n){return[ka(e),`oauth=${ko(t)}`,`api-key=${Oo(n)}`].join(` `)}function Oo(e){if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let t=C(v().host);return`${e.stored.activation}${ma(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=w.length;if(e===void 0)return K(`catalog`,`fail`,`Regenerate the command catalog with \`make mcp-generate-contracts\` and reinstall: none of its ${i} operations is the status operation.`);if(t===null)return K(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${Dt}.`);if(t===`f797adf55cef756b`)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=x(B,`oauth`),Mo=[x(B,`start`),x(B,`poll`),x(B,`acknowledge`)],No=x(B,`revoke`);function Po(e,n=b().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
|
`);E(Lo(r,[jo,...Mo],i)).action(Fo),E(Lo(r,[No],No.description)).action(Io),E(r.command(`status`).summary(`Keep saved credentials current and report them with API build and uptime`).description([`Runs the same credential materialization every command runs, then reports:`,` - auth: whether AUTH_TOKEN was already set in this shell's environment`,` - oauth: the saved OAuth identity and access-token expiry for the selected API host;`,` an expired token is renewed with its refresh token and a token the sign-in service rejects is retired`,` - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated`,` - selected: the credential the next command sends`,` - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)`,` - api: running CLI package version plus GET /info build metadata`,` - system: GET /v1/status response (uptime SLA)`,``,`Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.`,`--verify read|write additionally runs a live permission probe for that scope; it does not`,`execute or authorize an arbitrary API operation.`].join(`
|
|
32
32
|
`)).addOption(new t(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){zo(this),R({mode:T(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: ${y.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 oa(n),t=process.env[y.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}):_(`auth token: ${e.failure}`))})}async function Fo(e){zo(this);let t=T(e);if(e.providers===!0){R({mode:t},await Ho());return}R({mode:t},e.key===!0?await Yi({noBrowser:!e.browser,clientLabel:e.clientLabel}):await ht({noBrowser:!e.browser}))}async function Io(e){zo(this),R({mode:T(e)},await Ri({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 and uptime.","`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=Bs(e),i=Vs(e,r);if(i!==void 0)return i;let a=Y(e),o=[...a.slice(0,-1),`${a.at(-1)}-${n}`,...r.slice(1)],s=(Gs(o)?o:void 0)??Rs(e,n)??zs(e,n);if(s!==void 0)return Us(e,s,r)??Zs(e,s.join(` `),!1);let c=r.join(` `)||n,l=Ws(e)??Zs(e,c),u=[...a,...r.slice(1)];return[l,r.length===a.length+a.length&&a.at(-1)===a.at(0)?Us(e,u,r)?.replace(/^hint: Did you mean: /u,` `)+` · `:u.slice(1,-1).length>0?Us(e,u,r):void 0].filter(e=>e!==void 0).join(`
|
|
57
57
|
`)||void 0}function ec(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?Qs(e):void 0),Cs(e),Ds(e,t),...qs(e)])n!==void 0&&process.stderr.write(`${n}\n`)}else if(t.code===`commander.excessArguments`){let t=Cs(e)??Js(e);t!==void 0&&process.stderr.write(`${t}\n`)}else if(t.code===`commander.unknownOption`){let n=Es(t,`unknown option`),r=As(e)??Is(e,t)??(n!==void 0&&!t.message.includes(`
|
|
58
58
|
(Did you mean `)?Xs(e,n)??Hs(e,[n.replace(/^--/u,``)],process.argv.slice(process.argv.indexOf(n)+1))??Qs(e,n)??Zs(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=$s(e,t);n!==void 0&&process.stderr.write(`${n}\n`)}throw t}}var tc=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 nc(e){e.showHelpAfterError(!1).exitOverride(ec(e)),e.commands.length===0?e.hook(`preAction`,Ss):e.registeredArguments.length===0&&e.addHelpOption(new tc(e));for(let t of e.commands)nc(t)}function rc(e,t=new Date){let n=oc(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 ic(e){return`${JSON.stringify(e,null,2)}\n`}function ac(e,t){let n=k(e),r=ic(t);return M(O(n),{recursive:!0}),Bt(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function oc(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:xe(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 sc=`Match only the first canonical or CLI-alias command segment`,cc=[`text`,`lines`,`compact`,`json`,`ndjson`];function lc(e,t,n=b().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 ${Mr(n)}\n`),uc(r,t,n),dc(r,t,n),fc(r,t,n),pc(r)}function uc(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>`,sc).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(cc)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(e){let t=this.optsWithGlobals(),i=T(t,`text`);Fr(Pr(t,e),n,i,r)})}function dc(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`);E(i),i.action(function(){let e=this.optsWithGlobals();Ir(e,n,T(e,`text`),r)})}function fc(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>`,sc).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(cc)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(){let e=this.optsWithGlobals();Fr(e,n,T(e,`text`),r)})}function pc(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`);E(t),t.action(async function(){let e=this.optsWithGlobals(),t=T(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 ${Mr(n)}\n`),uc(r,t,n),dc(r,t,n),fc(r,t,n),pc(r)}function uc(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>`,sc).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(cc)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(e){let t=this.optsWithGlobals(),i=T(t,`text`);Fr(Pr(t,e),n,i,r)})}function dc(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`);E(i),i.action(function(){let e=this.optsWithGlobals();Ir(e,n,T(e,`text`),r)})}function fc(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>`,sc).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(cc)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(){let e=this.optsWithGlobals();Fr(e,n,T(e,`text`),r)})}function pc(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`);E(t),t.action(async function(){let e=this.optsWithGlobals(),t=T(e,`text`),{MCP_GENERATION_CONTRACT:n}=await import(`./mcp-generation-contract-C-V7y0TL.js`);if(t===`text`&&e.output===void 0&&(e.text===!0||e.allFields===!0)){R({mode:t},g(`Unified operations JSON`,`Use --output <path> to write the unified operations JSON.`,{counts:{totalOperations:n.length}}));return}let r=rc(n);if(e.output!==void 0){let n=ac(e.output,r);R({mode:t},g(`Unified operations JSON written`,{outputPath:n.target,byteLength:n.byteLength,schemaVersion:r.schemaVersion},{counts:{totalOperations:n.totalOperations}}));return}if(t===`text`){Rr(`Unified operations JSON`,ic(r));return}R({mode:t},g(`Unified operations JSON`,r,{counts:{totalOperations:r.totalOperations}}))})}var mc=b(qt(import.meta.url)),Q=mc.bin[0];function hc(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 ee?{httpStatus:n.problem.status,problem:n.problem}:{};cr({..._(`${Q} ${t}: ${n.message}`,[n.name||`Error`],r),counts:{exitCode:1}}),process.exit(1)}function gc(e){return We[Be(e,_t)??`cli`]}function _c(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:gc(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)vc(e,t,r,a,i.has(t.cliPath.join(` `)))}function vc(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=yc(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=>be(e.schemaType,e.itemSchemaType))?Se:``].filter(Boolean).join(`
|
|
60
60
|
`));let f=Et(t);for(let e of t.parameters)bc(u,e,i||e===f);if(Vn(u,t),ve(t.intent)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),E(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=T(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},_(`missing required options: ${a.join(`, `)}`));let o=await xc(t,i.data,r),s=oi(t,i.data,o);if(s!==null)return R({mode:r},s);n.explain===!0&&o.ok&&pr(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=T(e),r=vt(t,e);if(r.length>0)return R({mode:n},_(`missing required options: ${r.join(`, `)}`));let i=await xc(t,e,n),a=oi(t,e,i);if(a!==null)return R({mode:n},a);e.explain===!0&&i.ok&&pr(n,i.data),i.ok&&i.data instanceof Uint8Array?process.stdout.write(i.data):R({mode:n},i)})}function yc(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 bc(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 xc(e,t,n){if(t.environment!==void 0){let e=de(t.environment);if(e===null)return _(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${le().join(`, `)}`]);process.env.API_ENV=e}let r=await Kn(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 ci(e,await m({method:e.method,path:h(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=>hc(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>hc(e,`unhandledRejection`));var Sc=St(process.argv.slice(2),w),Cc=Sc===`required`?w:bt(w),$=new i;$.name(Q).usage(`<command> [subcommand] [options]`).configureHelp(Zr).version(mc.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 +1 @@
|
|
|
1
|
-
import{l as e}from"./tool-policy-
|
|
1
|
+
import{l as e}from"./tool-policy-Cv9t1JU0.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return d[e]??t?.[e]?.section}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{c as p,d as m,i as h,t as g}from"./result-envelope-DVa9d3ew.js";import{a as _}from"./package-DPDX5zmx.js";import{a as v,c as ee,i as te,o as ne,s as re}from"./tool-policy-
|
|
1
|
+
import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{c as p,d as m,i as h,t as g}from"./result-envelope-DVa9d3ew.js";import{a as _}from"./package-DPDX5zmx.js";import{a as v,c as ee,i as te,o as ne,s as re}from"./tool-policy-Cv9t1JU0.js";import{C as ie,S as ae,T as oe,_ as se,a as ce,b as y,c as le,d as ue,f as de,g as fe,h as pe,i as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De}from"./detail-D09DdW-w.js";import{a as Oe,n as b,r as x,t as ke}from"./text-field-BoNdbrtA.js";import{a as Ae,o as je}from"./cli-help-policy-BI46WMpS.js";import{Buffer as Me}from"node:buffer";var S=o([`HIGH`,`MEDIUM`,`LOW`]),Ne=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),d()]),Pe=f({excerpt:d(),sourceId:d(),sourceType:Ne,sourceVersion:d().nullish()}),Fe=f({instruction:d(),operationId:d(),stepKey:d()}),Ie=f({body:d(),expectation:d(),method:i(d()),override:d(),reject:i(d()),typeCatalog:d()}),Le=f({cliCommand:d(),mcpTool:d().nullish(),step:Fe,writeGuidance:Ie.nullish()}),Re=n([o([`ENTITY`,`TEXT`]),d()]),ze=f({description:d(),key:d(),type:Re}),Be=f({catalogRevision:s(),gateId:i(d()),input:i(ze),step:i(Le),taskKey:d()}),C=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Ve=f({candidate:i(Pe),operationId:d().nullish(),outcome:C,probability:u().nullish(),taskKey:d().nullish(),taskPlan:Be.nullish()}),He=f({answer:d(),citation:i(Pe),confidence:S,resolution:Ve.nullish()});function w(e,t,n=t.inputName){if(t.in===`body`)return n;let r=et.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?$e(Xe(n!==`id`&&n!==`slug`?n:`${Ke(e.path)}${Ye(n)}`),t):r.inputName}function Ue(e,t,n=Je(e)){return We(qe(e,t),new Set(n))}function We(e,t){if(!t.has(e))return e;let n=`body${Ye(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function Ge(e,t,n){return`${e}[${t}].${n}`}function Ke(e){return tt.find(([,t])=>t.test(e))?.[0]??`record`}function qe(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Ze(t);return $e(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?Xe(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function Je(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>w(e,t)))}function Ye(e){return e.replace(/^./u,e=>e.toUpperCase())}function Xe(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function Ze(e){let t=Xe(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Qe(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Qe(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function $e(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var et=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],tt=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function nt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>rt(t,w(e,t))),r=(t?.parameter??[]).map(t=>rt(t,Ue(e,t)));return{selector:n.filter(e=>e.location===`path`||it(e)),pagination:n.filter(at),filter:[...n.filter(ot),...r.filter(ot)],body:r.filter(e=>!ot(e))}}function rt(e,t){let{in:n,inputName:r,...i}=e;return{...i,name:e.in===`body`?t:e.name,flag:te(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function it(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function at(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function ot(e){return e.location!==`path`&&!it(e)&&!at(e)}function st(e,t){let n=e.requestBody?.[0],r={operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:ct(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:nt(e)}:{...r,optionalInput:lt(e)}}function ct(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function lt(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}var ut=160;function dt(e){return!Array.isArray(e)||e.length===0||!e.every(ft)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `)}): ${e.description.length<=ut?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
|
|
2
2
|
`)}\n`}function ft(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function pt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(mt);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.replace(/[.[].*$/su,``)))];return{tool:re(e.intent),operationId:e.operationId,...n===void 0?{}:{pathParams:n},...r===void 0?{}:{query:r},...e.requestBody===void 0?{}:{body:Object.fromEntries(i.map(e=>[e,`<${e}>`]))}}}function mt(e){return[e.name,`<${e.name}>`]}function ht(e){let t=T(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function T(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var E=2,gt=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function D(e,t){let n=A(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&D(e,`person`),yt(e,_t(n),n),yt(e,vt(n),n))}function _t(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=E&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>E&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function vt(e){if(e===`person`)return`people`;if(e!==`new`)return e.length>=E&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function yt(e,t,n){t!==void 0&&t!==n&&t.length>=E&&/^[a-z]+$/u.test(t)&&e.add(t)}function O(e){let t=new Set(k(e)),n=Array.from(t);for(let e of n)D(t,e);return t}function bt(e){return k(e).map(O)}function xt(e,t){if(e.length===0)return!1;let n=O(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function k(e){return A(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!gt.has(e))}function A(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}var St=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,Ct=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,wt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Tt=250,Et=40,Dt=100;function Ot(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(Ct,()=>(n.add(`uuid`),` `)).replace(St,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&wt.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=wt.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function kt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function At(e,t){let n=new Set;for(let r of e){let e=new Set;D(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function jt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(k(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>kt(t,e,n.path))&&(i+=Tt,r.has(t)&&(i+=Et));if(i===0)return 0;let a=new Set(k(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return D(t,e),[...t].some(e=>a.has(e))}))&&(i+=Dt),i}var Mt=5,Nt=.5,Pt=15,Ft=30,It=2;function Lt(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=Ot(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=At(i.urlPathWord,r.map(({fields:e})=>e)),o=A(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=O(o),c=bt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Vt(o,s,c,t))+jt(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function Rt(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function zt(e,t){let n=Lt(e.q?.trim()??``,t.filter(t=>Bt(e,t)),Rt),r=(n[0]?.score??0)*Nt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Mt:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>st(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function Bt(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function Vt(e,t,n,r){let i=Wt(r),a=Ht(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=Ut(e,i);let s=new Set(i.flatMap(k));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;D(n,e),[...n].some(e=>t.has(e))&&(o+=Pt)}xt(n,a)&&(o+=200),r.parameterName.some(t=>A(t)===e)&&(o+=Ft);let c=new Set(r.parameterDescription.flatMap(k));for(let e of t)c.has(e)&&(o+=It);return o+=Kt(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Gt(e,t,r.description),o}function Ht(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(A).filter(e=>e.length>0)}function Ut(e,t){let n=k(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Wt(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,T(e.description).useFor||e.description].map(A).filter(e=>e.length>0))]}function Gt(e,t,n){let r=A(T(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(k(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Kt(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>qt(e,t))&&(n+=i?40:10);return n}function qt(e,t){let n=k(t);return n.length>0&&n.every(t=>e.has(t))}function Jt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Yt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return h(`Provide q to resolve a request to one operation.`);let a=n.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(a===void 0)return h(`This build ships no help resolve operation.`);let o=await r(a,{body:{question:i,resolve:!0,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`},includePrivate:!1}});if(!o.ok)return{...o,data:null};let s=He.safeParse(Jt(o));if(!s.success||s.data.resolution==null)return h(`The help resolve operation returned no resolution.`);let{answer:c,resolution:l}=s.data,u=e=>t.find(t=>t.operationId===e),d=u(l.operationId),f=l.taskPlan??void 0,m=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),g=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...m.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return p(g.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${g.join(`, `)}.`,{outcome:l.outcome,probability:l.probability,answer:c,candidate:l.candidate.map(({sourceId:e})=>e),...d===void 0?{}:{operation:{operationId:d.operationId,apiRoute:`${d.method} ${d.path}`,...ht(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:pt(d)}},...l.taskKey==null?{}:{taskKey:l.taskKey},...f===void 0?{}:{taskPlan:{catalogRevision:f.catalogRevision,input:f.input,...f.gateId.length===0?{}:{gateId:f.gateId},step:m.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:pt(e)})}}},{warnings:g.map(e=>n.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}var Xt=f({detail:d(),field:d().nullish(),scope:o([`entity`,`person`,`news`])}),Zt=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),d()]),j=f({modeRequested:Zt,modeUsed:Zt}),Qt=f({answerUnavailable:l(),entity:j,news:j,person:j,rejection:i(Xt),unavailable:i(o([`entity`,`person`,`news`]))}),$t=f({acceleratorParticipation:i(ye),detail:i(ue)}),M=f({core:y,enrichment:Ee,fundraiseRound:i(fe),research:$t,semanticMatch:ce.nullish()}),en=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),tn=f({compositeScore:u().nullish(),cosineScore:u().nullish(),curatedAsOf:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),curatedRelationshipType:d().nullish(),curatedSource:d().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:u().nullish(),origin:en,rank:s(),sharedSectionCount:s().nullish()}),nn=f({entity:M,similarity:tn}),rn=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),an=f({author:d().nullish(),createdAt:r({offset:!0}),externalId:d().nullish(),id:t(),isCurrent:l(),lastFetchedAt:r({offset:!0}).nullish(),mentionedEntityId:i(t()),mentionedPersonId:i(t()),owner:c,publishedAt:r({offset:!0}).nullish(),summary:d().nullish(),summaryGeneratedAt:r({offset:!0}).nullish(),title:d().nullish(),topic:d().nullish(),type:rn,updatedAt:r({offset:!0}),url:d()}),on=o([`low`,`medium`,`high`]),sn=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:l().nullish(),dataConfidence:on.nullish(),dateValue:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),numericValue:u().nullish(),referenceValue:d().nullish(),source:d().nullish(),textValue:d().nullish(),updatedAt:r({offset:!0}).nullish(),valueType:de}),cn=f({asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fact:sn,id:d()}),ln=f({fundraiseInvestorJoin:l(),fundraiseTransaction:l(),operatingStatus:l(),relationship:l()}),un=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),dn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),fn=f({acquiredEntity:y,acquirerEntity:y,amount:u().int().nullish(),announcedAt:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),asOf:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),completedAt:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),createdAt:r({offset:!0}).nullish(),currency:d().nullish(),dataConfidence:De.nullish(),evidence:ln,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),isCurrent:l().nullish(),publicSource:pe.nullish(),relationshipId:s(),status:un,transactionStatus:dn.nullish(),updatedAt:r({offset:!0}).nullish()}),pn=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),mn=f({amountInvested:u().nullish(),createdAt:r({offset:!0}),financialInstrumentType:pn.nullish(),id:t(),investor:c,leadInvestor:l(),transactionId:t(),updatedAt:r({offset:!0})}),hn=f({entity:Se,investorAttribution:i(se),round:i(we),roundCount:s()}),gn=f({core:y,similarity:tn,urlLink:i(ae)}),_n=f({compliance:Ce.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:l().nullish(),isPrimary:l().nullish(),language:d().nullish(),owner:c,text:d(),textName:d().nullish(),textType:d(),updatedAt:r({offset:!0}).nullish()}),vn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),yn=o([`fundraiseRound`,`researchDetail`]),bn=o([`preMoney`,`postMoney`,`reported`]),xn=f({amountRaised:u().int().nullish(),asOfDate:d().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),confidence:on,currency:d(),declaredBasis:bn,derivation:vn,detailId:s().nullish(),label:d().nullish(),source:yn,sourceRef:d(),valuationPostMoney:u().int().nullish(),valuationPreMoney:u().int().nullish()}),Sn=f({createdAt:r({offset:!0}).nullish(),description:d().nullish(),forkCount:s(),githubId:u().int(),homepageUrl:d().nullish(),id:u().int(),isArchived:l(),isFork:l(),language:d().nullish(),license:d().nullish(),name:d(),ownerLogin:d(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(d()),updatedAt:r({offset:!0}).nullish(),url:d()}),N=f({empty:l().optional(),sorted:l().optional(),unsorted:l().optional()}),P=f({offset:u().int().optional(),paged:l().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:N.optional(),unpaged:l().optional()}),Cn=f({investorAttribution:i(se),person:be,round:i(we),roundCount:s()}),wn=o([`precomputed`,`live`]),Tn=f({compositeScore:u().nullish(),cosineScore:u().nullish(),matchedSectionWeight:u().nullish(),origin:wn,rank:s(),sharedSectionCount:s().nullish()}),En=f({currentRole:xe.nullish(),person:me,similarity:Tn}),Dn=o([`by`,`about`]),On=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),kn=f({canonicalUrl:d().nullish(),contentId:d(),contentType:On,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:Dn.nullish(),sourceDomain:d().nullish(),sourceName:d().nullish(),summary:d().nullish(),title:d(),topic:d().nullish(),updatedAt:r({offset:!0}).nullish(),url:d().nullish(),year:s().nullish()});f({content:i(an).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(n([oe,Te])).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(cn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(y).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(fn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Se).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(mn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(fe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(hn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(M).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(xe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ge).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ue).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(he).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(nn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(gn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(_n).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ae).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(xn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Sn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(le).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(me).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(be).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ve).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Cn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(En).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(kn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var An=f({content:i(M),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),jn=f({content:i(le),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),Mn=f({content:i(me),number:s(),size:s(),totalElements:u().int(),totalPages:s()});f({content:i(_e).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:P.optional(),size:s().optional(),sort:N.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var Nn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),d()]),Pn=f({entityId:t(),source:Nn,sourceId:d()}),Fn=f({citation:i(Pn),text:d(),topic:d().nullish()}),In=f({citation:i(Pn),confidence:S,description:d().nullish(),heading:d().nullish(),paragraph:i(Fn),relatedQuery:i(d()),shareable:l(),text:d(),title:d().nullish()}),Ln=f({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Rn=f({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),F=f({max:u().nullish(),min:u().nullish()}),I=f({max:s().nullish(),min:s().nullish()}),zn=f({averageAmountInvestedUsdRange:i(F).optional(),largestAmountInvestedUsdRange:i(F).optional(),smallestAmountInvestedUsdRange:i(F).optional(),totalAmountInvestedUsdRange:i(F).optional(),totalInvestmentRange:i(I).optional()}),Bn=f({amountInvestedRange:i(F).optional(),amountRaisedRange:i(F).optional(),dateAnnouncedRange:Rn.nullish(),investedCompanyName:i(d()).optional(),investedCountry:i(d()).optional(),investedIndustry:i(d()).optional(),investedRound:i(d()).optional(),investorActivity:zn.optional(),investorName:i(d()).optional(),lastRoundYearRange:i(I).optional(),rankByInvestmentActivity:l().nullish(),round:i(d()).optional(),totalRaisedRange:i(F).optional(),valuationRange:i(F).optional()}),Vn=o([`NONE`,`COMPANY_LISTING_READY`]),Hn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Un=o([`hostPath`,`domain`]),Wn=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(I).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Bn.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Ln.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Hn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Vn.optional(),rankByProminence:l().nullish(),semanticQuery:d().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Un.nullish(),urlType:ie.nullish(),yearFoundedRange:i(I).optional()}),Gn=o([`discovery`,`profile`,`peer`,`comparison`]),Kn=o([`keyword`,`semantic`]),qn=n([o([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),d()]),Jn=f({descending:l(),field:qn,sortKey:d().nullish()}),Yn=f({order:i(Jn),relevance:Kn.nullish()}),Xn=f({confidence:S,execution:j,fallbackUsed:l(),filter:Wn,intent:Gn,interpretation:d(),sort:Yn,subjectEntityName:i(d()),unsupported:d().nullish()}),L=f({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:d().nullish(),status:d().nullish()}),Zn=f({fundManagerRelationshipSource:L.nullish(),fundraiseTransaction:fe,fundraiseTransactionSource:L.nullish(),investorJoinSource:L.nullish()}),Qn=f({evidence:Zn,investor:c,semanticMatch:ce.nullish()}),$n=f({entityId:t(),matchedOffering:y.nullish(),probability:u(),webUrl:i(d())}),er=f({entityId:t(),label:d(),publishedAt:r({offset:!0}).nullish(),score:u(),source:Nn,sourceId:d(),text:d(),url:d().nullish()}),tr=f({answer:In.nullish(),interpretation:Xn,investment:i(Qn),judgment:i($n),passage:i(er),peer:i(nn),pendingWebQuery:i(d()),result:An,searchRequestId:t().nullish(),subject:i(M)}),nr=o([`auto-match`,`needs-review`,`approved`,`rejected`]),rr=f({createdAt:r({offset:!0}),entityId:t(),href:d().nullish(),internal:l(),matchStatus:nr.nullish(),mention:d().nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),ir=f({entity:i(rr),newsId:s()}),ar=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(I).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:Bn.optional(),hasFundraising:l().nullish(),headquartersCity:i(d()).optional(),headquartersCountry:i(d()).optional(),headquartersState:i(d()).optional(),industry:i(d()).optional(),letter:d().nullish(),location:i(d()).optional(),logoOption:Ln.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Hn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Vn.optional(),rankByProminence:l().nullish(),slug:i(d().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(d()).optional(),suppressLateStage:l().nullish(),suppressNonOperating:l().nullish(),suppressZeroTotalRaised:l().nullish(),tag:i(d()).optional(),textSearch:d().nullish(),typeCustomer:i(d()).optional(),typeModel:i(d()).optional(),typeOwnership:i(d()).optional(),typeRecord:i(a).optional(),typeRevenue:i(d()).optional(),typeTechnologyUsed:i(d()).optional(),url:d().nullish(),urlDomain:d().nullish(),urlMatchMode:Un.nullish(),urlType:ie.nullish(),yearFoundedRange:i(I).optional()}),or=f({amountInvestedRange:i(F).nullish(),amountRaisedRange:i(F).nullish(),entityName:i(d()).nullish(),investedCompany:i(d()).nullish(),personTitle:i(d()).nullish(),round:i(d()).nullish(),totalInvestmentCount:i(I).nullish(),typeRecord:i(a).nullish()}),sr=f({arrayFilter:or.optional(),entityFilter:ar.optional(),entityId:t().nullish(),entitySlug:d().nullish(),firstName:d().nullish(),includeAddress:l().nullish(),includeUrl:l().nullish(),investorActivity:zn.optional(),isCurrent:l().nullish(),lastName:d().nullish(),letter:d().nullish(),personId:i(t()).max(200).optional(),personName:i(d()).optional(),role:d().nullish(),search:d().nullish(),semanticQuery:d().nullish(),status:d().nullish()}),cr=f({descending:l(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:d().nullish()}),lr=f({order:i(cr),relevance:Kn.nullish()}),ur=f({confidence:S,execution:j,fallbackUsed:l(),filter:sr,interpretation:d(),sort:lr,unsupported:d().nullish()}),dr=f({interpretation:ur,investment:i(Qn),result:Mn,searchRequestId:t().nullish()}),fr=f({label:d(),query:d()}),pr=f({key:d(),option:i(fr),prompt:d()}),mr=f({entity:tr,entityDetail:i(Se),news:jn,newsEntityMention:i(ir),person:dr,personDetail:i(be),provenance:Qt,qualifier:pr.nullish()});function R(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>hr(e)),...n.flatMap(e=>e.parameter.map(t=>hr(t,n.length>1?e.contentType:void 0))),...gr(n)],i=[t,...e.cliPath].join(` `),a=ne(e.intent),o=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:v(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ee(e.path)?null:re(e.intent),body:{hasBody:o!==void 0,kind:o?.kind??null,...o!==void 0&&n.length>1?{contentType:o.contentType}:{},required:o?.required??!1,description:o?.description??``,requiredPath:o?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function hr(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function gr(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function z(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var _r=[`-id`,`-slug`,`-url`],vr=[`--id`,`--slug`,`--url`],yr=`/v1/lookup`,br=`--from-file "<path>"`;function xr(e,t,n=_().bin[0]){let r=R(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:Tr(i,r)}function Sr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:R([r],n);return i&&wr(i,Or(i,!1))}function Cr(e,t,n,r=_().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return Sr(o.operationId,t,r)}function wr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function Tr(e,t){return[`example: ${wr(e,Or(e))}`,...Er(e,t)]}function Er(e,t){return z(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${B(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===yr),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${B(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Dr=/(?:^|\.)text$/u;function Or(e,t=!0){let n=z(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Dr.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:kr(e)).map(B);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,br]:i}function kr(e){let t=new Set;D(t,e.resource);for(let n of _r)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of vr){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function B(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Ar=`aventure`;function jr(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Ar} ${n.join(` `)}`}function Mr(e,t,n=e){return Sr(e,t,`aventure`)??n}function Nr(e,t){let n=He.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return Pr(r,o,t);let s=r.trimEnd().split(`
|
|
3
3
|
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Ne.options[0].enum.OPERATION)return[];let r=jr(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function Pr(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Ir(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:Lr(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Mr(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...zr(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...zr(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Fr(e,t){let n=Be.safeParse(e);return n.success?[Ir(n.data),...Lr(n.data,t)]:null}var Ir=({taskKey:e,catalogRevision:t})=>`Run catalog task ${e} (catalog revision ${t}).`;function Lr(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey}: ${Mr(n.operationId,t,r)}`,` ${n.instruction}`,...Rr(e,a,i)]),...e.gateId.length===0?[]:[``,`Completion gates: ${e.gateId.join(`, `)}`]]}function Rr(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function zr(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:jr(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var V=120,H=30,Br=8,U=10,Vr=2,Hr=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Ur=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Wr=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Gr(e,t,n){if(typeof t==`string`)return Q(t);let r=dt(t);if(r!==null)return Q(r);let i=ni(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=Oe(a?.detailField,i.response),c={...i,response:o},l=Nr(c.response,e)??Fr(c.response,e);if(l!==null)return Q(l.join(`
|
|
4
4
|
`),!0);let u=Kr(c.endpoint,c.response);if(u!==null)return Q([...u,...s].join(`
|