@aventurevc/aventure-cli 0.8.159 → 0.8.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +1 -1
- package/dist/chunks/{aventure-cli-Dmg6n8se.js → aventure-cli-CyU7hh0W.js} +2 -2
- package/dist/chunks/{cli-help-policy-eA1rRqwV.js → cli-help-policy-BI46WMpS.js} +1 -1
- package/dist/chunks/contract-DsJpmXt1.js +22 -0
- package/dist/chunks/{dist-BITld09_.js → dist-BvNaeC7y.js} +2 -2
- package/dist/chunks/{mcp-generation-contract-DBF4S7_k.js → mcp-generation-contract-Cbt-sm0o.js} +1 -1
- package/dist/chunks/mcp-generation-contract-CzCMl43z.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-DGr2j4lk.js → oauth-bearer-credential-C-o0yx1U.js} +2 -2
- package/dist/chunks/oauth-bearer-credential-DVK1Kifi.js +1 -0
- package/dist/chunks/{oauth-login-DwgRqY77.js → oauth-login-03TonSg_.js} +1 -1
- package/dist/chunks/oauth-login-x7EVXa0C.js +1 -0
- package/dist/chunks/openapi-commands-9O-TmFxP.js +1 -0
- package/dist/chunks/openapi-commands-DrCmBKMz.js +1 -0
- package/dist/chunks/provider-catalog-CWV2zHhk.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/contract-Csl322Se.js +0 -22
- package/dist/chunks/mcp-generation-contract-MAa4RzsK.js +0 -1
- package/dist/chunks/oauth-bearer-credential-CwSUblGG.js +0 -1
- package/dist/chunks/oauth-login-ZohILTSZ.js +0 -1
- package/dist/chunks/openapi-commands-PDTkkh8f.js +0 -1
- package/dist/chunks/openapi-commands-q_eVvFfS.js +0 -1
- package/dist/chunks/provider-catalog-GBt-7leL.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-DVK1Kifi.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-DrCmBKMz.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-CyU7hh0W.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-11T22:09:41.973Z",
|
|
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-BITld09_.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-Csl322Se.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-DGr2j4lk.js";import{n as mt,r as ht,t as gt}from"./oauth-login-DwgRqY77.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-q_eVvFfS.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-BvNaeC7y.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-C-o0yx1U.js";import{n as mt,r as ht,t as gt}from"./oauth-login-03TonSg_.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-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(`
|
|
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
|
|
@@ -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-CzCMl43z.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};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
`)}\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
|
+
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Ne.options[0].enum.OPERATION)return[];let r=jr(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function Pr(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Ir(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:Lr(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Mr(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...zr(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...zr(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Fr(e,t){let n=Be.safeParse(e);return n.success?[Ir(n.data),...Lr(n.data,t)]:null}var Ir=({taskKey:e,catalogRevision:t})=>`Run catalog task ${e} (catalog revision ${t}).`;function Lr(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey}: ${Mr(n.operationId,t,r)}`,` ${n.instruction}`,...Rr(e,a,i)]),...e.gateId.length===0?[]:[``,`Completion gates: ${e.gateId.join(`, `)}`]]}function Rr(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function zr(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:jr(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var V=120,H=30,Br=8,U=10,Vr=2,Hr=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Ur=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Wr=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Gr(e,t,n){if(typeof t==`string`)return Q(t);let r=dt(t);if(r!==null)return Q(r);let i=ni(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=Oe(a?.detailField,i.response),c={...i,response:o},l=Nr(c.response,e)??Fr(c.response,e);if(l!==null)return Q(l.join(`
|
|
4
|
+
`),!0);let u=Kr(c.endpoint,c.response);if(u!==null)return Q([...u,...s].join(`
|
|
5
|
+
`),!0,s.length>0);let d=c.summary??n??c.operationId??`OpenAPI call succeeded`,f=Xr(c);return Q([...[d,`${c.method} ${c.endpoint}`,...f].filter(Boolean),...s].join(`
|
|
6
|
+
`),!0,s.length>0)}function Kr(e,t){if(t===void 0||!Y(t)||!(`entity`in t&&`person`in t&&`news`in t))return null;let n=mr.safeParse(t);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?qr(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>x(`${e} rejected: ${t}`)),[`entities:`,...W(r.result,e)].join(`
|
|
7
|
+
`),[`people:`,...W(i.result,e)].join(`
|
|
8
|
+
`),[`news:`,...W(a,e)].join(`
|
|
9
|
+
`)]}function qr(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${x(e)}`).join(`
|
|
10
|
+
`)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>x(` - ${e}:${t} entity=${n}`)).join(`
|
|
11
|
+
`)}`;return[`answer:\n ${b(e.text).replaceAll(`
|
|
12
|
+
`,`
|
|
13
|
+
`)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function Jr(e){let t=ni(e)?.response,n=Y(t)?t.interpretation:void 0;if(!Y(n))return null;let r=j.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=K(n.filter),{unsupported:s,fallbackUsed:c}=n;return Q([`strategy: requested=${i} used=${a}`,...Y(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${Yr(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
|
|
14
|
+
`),!0)}var Yr=e=>X(e)?x(e):Array.isArray(e)&&e.every(X)?e.map(e=>x(e)).join(`, `):JSON.stringify(e);function Xr(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a,location:o}=e;if(t===void 0)return o!==void 0&&a!==void 0?[`status=${a} redirect=${o}`]:a===void 0?[]:[`status=${a} no response body`];let s=a===void 0||n===`GET`?``:`status=${a}`,c=Y(t)&&!J(t)?ii(t):null,l=c===null?void 0:Y(c.context.interpretation)?K(c.context):c.context,u=l!==void 0&&Y(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Y)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...J(t)?W(t,r,i):c===null?oi(t)?$r(t.filter,t.meta):si(t)?$r([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):li(t)?ei(t):G(t,``):[...W(c.page,r,i),...Object.keys(p).length===0?[]:G(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(Zr(t)))]].filter(Boolean)}function W(e,t,n){let r=ti(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${Z(n)}`,...Zr(e.content)].filter(Boolean)}function Zr(e){let t=e.filter(Y);if(t.length===0)return e.length===0?[`(empty)`]:ri(e,``);let n=Qr(t);if(n.length===0)return ri(e.slice(0,H),``);let r=t.slice(0,H).map(e=>{let t=q(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>di(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>H&&s.push(`... ${t.length-H} more rows`),s}function Qr(e){let t=new Set(e.flatMap(e=>Object.keys(q(e)))),n=Hr.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,Br-n.length);return[...n,...r].slice(0,Br)}function $r(e,t){let n=t!==void 0&&Y(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,U).forEach(e=>{i.push(` ${ui(t.filterKey)} ${Z(e.value)}`)}),e>U&&i.push(` ... ${e-U} more shown`)}return i}function ei(e){let t=ui(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,U).map(e=>`${t} ${Z(e)}`),e.result.length>U?`... ${e.result.length-U} more matches`:``].filter(Boolean)}function ti(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!Ur.has(e)&&t.length>0).map(([e,t])=>`${ui(e)} ${Z(t)}`)}function ni(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`method`),n=Reflect.get(e,`endpoint`);if(typeof t!=`string`||typeof n!=`string`)return null;let r=Reflect.get(e,`operationId`),i=Reflect.get(e,`summary`),a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`location`),s=Reflect.get(e,`nextCursor`),c=Reflect.get(e,`response`),l=c===void 0?void 0:m.safeParse(c);return l!==void 0&&!l.success?null:{method:t,endpoint:n,httpStatus:typeof a==`number`?a:void 0,location:typeof o==`string`?o:void 0,operationId:typeof r==`string`?r:void 0,summary:typeof i==`string`?i:void 0,nextCursor:typeof s==`string`&&s.length>0?s:void 0,response:l?.data}}function G(e,t,n){if(e===void 0)return[];if(X(e))return[`${t}${ke(e,n)}`];if(Array.isArray(e))return ri(e,t,n);let r=[];for(let[n,i]of Object.entries(e))if(i!==void 0){if(X(i)){r.push(`${t}${n}: ${ke(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of G(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function ri(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(X(i)){r.push(`${t}- ${ke(i,n)}`);continue}r.push(`${t}-`);for(let e of G(i,`${t} `))r.push(e)}return r}function K(e){if(e===void 0||X(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=K(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=K(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...Wr.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!Wr.includes(e))])}function q(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:x(e,t)}:n>Vr?{}:Array.isArray(e)?e[0]===void 0?{}:q(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return X(r)?[[i,x(r,i)]]:Object.entries(q(r,i,n+1))}))}var J=e=>Y(e)&&Array.isArray(e.content);function ii(e){let[t,...n]=Object.entries(e).filter(e=>J(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function ai(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var oi=e=>Y(e)&&ci(e.filter),si=e=>Y(e)&&ci(e.arrayFilterEntry)&&ci(e.rangeFilterEntry),ci=e=>Array.isArray(e)&&e.every(ai),li=e=>Y(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>typeof e!=`object`||!e,ui=e=>`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,Z=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,di=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,Q=(e,t=!1,n=!1,r=1)=>{let i=b(e),a=t||i.endsWith(`
|
|
15
|
+
`),o=i.endsWith(`
|
|
16
|
+
`)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
|
|
17
|
+
`),c=Me.byteLength(`${s.join(`
|
|
18
|
+
`)}\n`,`utf8`);if(s.length<=V&&c<=5e4)return`${s.join(`
|
|
19
|
+
`)}${a?`
|
|
20
|
+
`:``}`;let l=n?Math.min(Math.max(1,r),118):0,u=l>0?s.slice(-l):[],d=u.length===0?s:s.slice(0,-u.length),f=[s.length>V?`${V} physical lines`:``,c>5e4?`${g} UTF-8 bytes`:``].filter(Boolean).join(` and `),p=e=>b(`... output truncated: ${e} more lines omitted to stay within ${f}; recover omitted response content with narrower server-side filters, the relevant sub-resource operation (aventure_help names it), or responseFormat json.`),m=(e,t)=>[...e,...u,t].join(`
|
|
21
|
+
`),h=V-u.length-1,_=d.slice(0,h),v=p(s.length-_.length-u.length);for(;Me.byteLength(`${m(_,v)}\n`,`utf8`)>g;){if(_.length>0)_=_.slice(0,-1);else if(u.length>0)u=u.slice(1);else break;v=p(s.length-_.length-u.length)}return`${m(_,v)}${a?`
|
|
22
|
+
`:``}`},fi=/\{([^}]+)\}/gu;function pi(e,t){let n=t.filter(e=>e.method===`GET`),r=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),i=t.find(t=>t.operationId===e.operationId),a=e.ok&&i!==void 0&&ne(i.intent),o=[...a&&e.endpoint!==void 0?hi(e.endpoint.split(`?`)[0]??``,n,!1).map(e=>`${e} --data --to-file <path>`):[],...e.references.filter(e=>!r(e)).flatMap(mi).flatMap(e=>hi(e.pathname,n,!0)),...e.references.filter(r).flatMap(mi).flatMap(e=>gi(e,n))];return o.length===0?{write:a}:{exactRecovery:`Read the full result ${o.join(`; `)}.`,write:a}}function mi(e){return URL.canParse(e)?[new URL(e)]:[]}function hi(e,t,n){return t.flatMap(t=>{let r=[...t.path.matchAll(fi)].map(([,e])=>e),i=RegExp(`^${t.path.replace(fi,`([^/]+)`)}$`,`u`),a=n&&r.length===0?null:i.exec(e);if(a===null)return[];let o=r.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[$(r),a[n+1]??``]});return[`${_i(t)}, ${vi(t,o)}`]})}function gi(e,t){let n=t.find(t=>t.path===e.pathname);return n===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${n.path}/`))return[];let r=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),i=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(r===void 0||i===void 0)return[];let a=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[$(t),yi(n)]}),o=[$(r),`<n>`,$(i),`<n>`];return[`${_i(t)}, in windows: ${vi(t,[...a,...o])}, advancing ${$(r)} until a window returns fewer than ${$(i)} units`]})}function _i(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function vi(e,t){return[Ar,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function yi(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function bi(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=Ti(t,w(e,t),n);if(t.legacyName===void 0)return r;let i=Ti(t,w(e,t,t.legacyName),n).flag;return i===r.flag?r:Object.assign(r,{legacyFlag:i})})}),n=e.requestBody?.map(n=>{let r=Ci(e,t,n),i=Si(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`)),i=r?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,errorResponse:e.errorResponse,successResponse:i,detailField:r?.detailField,parameters:t}})}function xi(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function Si(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function Ci(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>wi(e.name)-wi(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=Ue(e,t,r);return r.add(n),[Ti(t,n,`body`)]})}function wi(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function Ti(e,t,n){let r=e.itemSchemaEnum??e.schemaEnum,i=je(e.schemaType,e.itemSchemaType,e.schemaFormat,t);return{name:e.name,optionKey:t,flag:`${te(t)} ${e.schemaType===`boolean`?`[${i}]`:`<${i}>`}`,required:e.required&&e.schemaDefault===void 0,description:Ae(e.description,r),schemaType:e.schemaType,schemaFormat:e.schemaFormat,itemSchemaType:e.itemSchemaType,defaultValue:Ei(e.schemaDefault),choices:r,...e.envName===void 0?{}:{envName:e.envName},...e.visibility&&{visibility:e.visibility},location:n}}var Ei=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{O as _,Q as a,st as b,z as c,Tr as d,R as f,Yt as g,zt as h,Gr as i,xr as l,Lt as m,xi as n,Jr as o,Rt as p,pi as r,Dr as s,bi as t,Cr as u,k as v,Ge as x,A as y};
|