@aventurevc/aventure-cli 0.8.149 → 0.8.154

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.
Files changed (28) hide show
  1. package/dist/aventure-cli/command-catalog.compact.txt +1 -1
  2. package/dist/aventure-cli/index.js +1 -1
  3. package/dist/aventure-cli/unified-operations.json +1 -1
  4. package/dist/chunks/{aventure-cli-B8pQkzqf.js → aventure-cli-MEA66dmm.js} +3 -3
  5. package/dist/chunks/{cli-help-policy-DeeUkwZr.js → cli-help-policy-BbLTU6HE.js} +1 -1
  6. package/dist/chunks/{contract-7P1f8pdV.js → contract-BjZg8t8U.js} +1 -1
  7. package/dist/chunks/{dist-D74TfWLy.js → dist-qYT7b7rJ.js} +2 -2
  8. package/dist/chunks/mcp-generation-contract-C9hxM3KU.js +1 -0
  9. package/dist/chunks/{mcp-generation-contract-29I-ib_Q.js → mcp-generation-contract-w-3v3hhH.js} +1 -1
  10. package/dist/chunks/oauth-bearer-credential-BeLpql1L.js +1 -0
  11. package/dist/chunks/{oauth-bearer-credential-u1tbZWNH.js → oauth-bearer-credential-_hReIflB.js} +2 -2
  12. package/dist/chunks/oauth-login-BTK7bnlR.js +6 -0
  13. package/dist/chunks/oauth-login-ChJumDeg.js +1 -0
  14. package/dist/chunks/openapi-commands--bnPRBsW.js +1 -0
  15. package/dist/chunks/openapi-commands-CuOsKOYe.js +1 -0
  16. package/dist/chunks/provider-catalog-DuLSGg1k.js +1 -0
  17. package/dist/chunks/startup-auth-AXrwl1fP.js +1 -0
  18. package/dist/chunks/{startup-auth-CV6hp2Sq.js → startup-auth-GYDuOgMb.js} +1 -1
  19. package/dist/chunks/{tool-policy-XDNFtgnS.js → tool-policy-Cg0XvZMq.js} +1 -1
  20. package/package.json +3 -3
  21. package/dist/chunks/mcp-generation-contract-BwXUVyVD.js +0 -1
  22. package/dist/chunks/oauth-bearer-credential-DKvgo0ma.js +0 -1
  23. package/dist/chunks/oauth-login-BbqJue_g.js +0 -6
  24. package/dist/chunks/oauth-login-DKSkhC8s.js +0 -1
  25. package/dist/chunks/openapi-commands-BR_MrBCh.js +0 -1
  26. package/dist/chunks/openapi-commands-CLTmUadE.js +0 -1
  27. package/dist/chunks/provider-catalog-8lPCYtez.js +0 -1
  28. package/dist/chunks/startup-auth-BAxM8H3Q.js +0 -1
@@ -22,7 +22,7 @@ aventure people list · List People · -
22
22
  aventure people lookup · Deprecated: Find Which Person a Name Refers to, or Confirm They Are New · -
23
23
  aventure people lookup-batch · Look Up People in Bulk by ID or Slug · -
24
24
  aventure people search · Search People · -
25
- aventure resolve get · Deprecated: Find the Record Behind an ID, Slug, or URL · --token
25
+ aventure resolve get · Deprecated: Resolve an Entity or Person by Identifier Token · --token
26
26
  aventure search link · Search From a Page URL · --url
27
27
  aventure unique-ids lookup · Look Up an Identifier Owner · --id-type --identifier
28
28
  aventure url-types list · List URL Types · -
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-B3nxJH8H.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-DKvgo0ma.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-DNxYcBcd.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-BAxM8H3Q.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CJvckkTy.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-Bispjv2H.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-CLTmUadE.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-B8pQkzqf.js`)}catch(e){if(!(e instanceof t))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
2
+ import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-B3nxJH8H.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-BeLpql1L.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-DNxYcBcd.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-AXrwl1fP.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CJvckkTy.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-Bispjv2H.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands--bnPRBsW.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-MEA66dmm.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-10T23:04:28.488Z",
4
+ "generatedAt": "2026-10-11T03:38:47.329Z",
5
5
  "totalOperations": 141,
6
6
  "note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
7
7
  "operations": [
@@ -1,4 +1,4 @@
1
- import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a}from"./logging-sKoOD-tO.js";import{M as o,O as s,i as c,o as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{Ar as p,Dr as m,Er as h,Lr as ee,Mr as te,Or as ne,Rr as re,kr as ie}from"./dist-D74TfWLy.js";import{n as ae,r as g,s as _,u as oe}from"./result-envelope-DTzTOcab.js";import{i as se,l as v,o as ce,r as le,s as ue,t as y}from"./env-ClsLmXWa.js";import{a as b,n as de,r as fe,t as pe}from"./package-DPDX5zmx.js";import{S as me,d as he,f as ge,o as _e,p as ve,r as ye,s as be,t as xe}from"./tool-policy-XDNFtgnS.js";import{i as Se,r as Ce}from"./response-problem-DCBMY8Lr.js";import{n as we}from"./output-spill-D0GZ7YT_.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as je,n as x,o as Me,r as Ne,s as Pe,u as Fe,y as Ie}from"./contract-7P1f8pdV.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,s as He,t as Ue}from"./cli-help-policy-DeeUkwZr.js";import{S as We,_ as Ge,a as Ke,g as S,h as qe,i as Je,m as Ye,n as Xe,p as Ze,r as Qe,s as $e,t as et,v as tt,x as C,y as nt}from"./api-key-bearer-credential-CW5W3VVg.js";import{a as rt,c as it,d as at,g as ot,l as st,m as ct,o as lt,s as ut,t as dt,u as ft}from"./oauth-bearer-credential-u1tbZWNH.js";import{n as pt,r as mt,t as ht}from"./oauth-login-BbqJue_g.js";import{a as gt,c as _t,d as vt,i as yt,l as bt,n as xt,o as St,s as Ct,t as wt,u as Tt}from"./startup-auth-CV6hp2Sq.js";import{n as Et,t as w}from"./openapi-commands-BR_MrBCh.js";import{i as T,r as Dt,t as E}from"./output-mode-sM_EbDW_.js";import{spawnSync as Ot}from"node:child_process";import{basename as D,dirname as O,relative as kt,resolve as k,sep as At}from"node:path";import{copyFileSync as jt,existsSync as A,lstatSync as Mt,mkdirSync as Nt,mkdtempSync as Pt,readFileSync as Ft,readdirSync as It,readlinkSync as Lt,realpathSync as Rt,renameSync as zt,symlinkSync as Bt,writeFileSync as Vt}from"node:fs";import j,{stderr as M,stdin as Ht}from"node:process";import{TextDecoder as Ut,inspect as Wt}from"node:util";import{homedir as Gt,hostname as Kt,platform as qt}from"node:os";import{fileURLToPath as Jt}from"node:url";import{setTimeout as Yt}from"node:timers/promises";import{randomUUID as Xt,webcrypto as Zt}from"node:crypto";import{readFile as Qt}from"node:fs/promises";import{createInterface as $t}from"node:readline/promises";function en(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{...g(`${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 _(`Environment-bound options applied`,r)}function tn(e,t,n){if(!P(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||!gn(n,r.name))continue;let a=hn(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 nn(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 rn(e,t,n,r=!1){if(r||!N(t)||!Array.isArray(n))return bn(e,t,n);for(let[r,i]of n.entries()){let n=bn(e,t,i,r);if(!n.ok)return n}return _(`Body value assigned`,null)}function an(e,t,n,r){return bn(e,t,r,n)}function on(e){let t=[];for(let n of e.split(`.`)){let e=Sn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function sn(e,t){let n=on(t);if(n===null)return null;let r=mn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:pn(r)}:null}function cn(e,t){if(N(e.name)||e.schemaType===`array`)return _(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return _(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?_(`Scalar body option selected`,t[0]):g(`${n} was already given; pass it once.`)}var ln=/^(?<row>\d+):(?<item>.*)$/su;function un(e,t){let n=on(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=ln.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 dn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&on(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function fn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=sn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return g(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||un(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return g(`${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 pn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function mn(e,t){let n=e;for(let e of t){if(!P(n))return;n=n[e]??null}return n}function hn(e,t){if(!N(t))return mn(e,t.split(`.`))}function gn(e,t){return vn(e,t.split(`.`))}function _n(e,t,n){if(!P(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)&&gn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function vn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Sn(n);if(!P(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>vn(e,r)):vn(a,r)}function N(e){return e.split(`.`).some(e=>Sn(e).isArray)}function yn(e,t){return e.parameter.length===0||!P(t)?null:wn(t,[],Cn(e.parameter))}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Sn(o),c=e===i.length-1,l=xn(a,s,t,c,n,r);if(!l.ok||l.data===null)return g(l.summary,l.warnings);if(c)return _(`Body value assigned`,null);a=l.data}return g(`${t} is not a valid body option path.`)}function xn(e,t,n,r,i,a){let o=()=>g(`${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,_(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,_(`Body path created`,e)}return P(c)?_(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,_(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,_(`Body path created`,n)}return P(s)?_(`Body path stepped`,s):o()}function Sn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Cn(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 wn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=wn(r,t,n);if(e!==null)return e}return null}if(!P(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!Tn(a,n)){if(!En(e))continue;return{path:a,suggestion:Dn(e,n)}}let o=wn(i,e,n);if(o!==null)return o}return null}function Tn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function En(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function Dn(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:On(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 On(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function 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(Re(e)),t.description=te(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?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?Be(n):`${Be(n)} Required JSON paths: ${r.join(`, `)}.`}function Fn(e,t){let n=Le(t.description,void 0),r=e.kind!==`multipart`&&N(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=on(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 He(e)-He(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Rn(e){let t;try{t=e===`-`?await zn():await Qt(e,`utf8`)}catch(t){return g(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return _(`No input provided`,null);let e=JSON.parse(t);return _(`Input parsed`,e)}catch(e){return g(`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 F=`--content-type`;function Bn(t,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(F)){let n=a.map(({contentType:e})=>e);t.addOption(new e(`${F} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Hn(a)))}if(or(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);t.addOption(new e(`--from-file <path>`,Pn(r,r.requiredPath)).argParser(Wn(`--from-file`)))}let o=An(a).filter(e=>i(I(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 e(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(Vn):N(i.name)||i.schemaType===`array`?o.argParser(Un):o.argParser(Wn(i.flag)),t.addOption(o),o.envVar!==void 0&&t.on(`optionEnv:${o.name()}`,()=>{let e=t.opts()[i.optionKey];typeof e==`string`&&e.trim()&&t.setOptionValueWithSource(i.optionKey,e.trim(),`env`)})}ar(t,n,o)}function Vn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Hn(e){return(n,r)=>{if(r!==void 0)throw new t(`${F} was already given; pass it once.`);let i=me(e,n);if(!i.ok)throw new t(i.summary);return n}}function Un(e,t){return[...t??[],e]}function Wn(e){let n=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new t(`${n} was already given; pass it once.`);return e}}async function Gn(e,t){let n=St(e,t),r=me(e.requestBody??[],n);if(!r.ok||r.data===null)return g(r.summary,r.warnings);let i=r.data;if(i===void 0)return _(`No body`,void 0);let a=Kn(e,i,t);if(a!==null)return g(a);let o=en(e.operationId,i,t);if(!o.ok)return g(o.summary,o.warnings);t=o.data;let s=qn(i,t);if(s!==null)return g(s);let c=await Zn(t);if(!c.ok)return g(c.summary,c.warnings);let l=_n(e.requestBody??[],i,c.data);if(l!==null)return g(l);let u=Xn(e.operationId,i,c.data);if(!u.ok)return u;let d=tn(e.operationId,i,c.data);if(d!==null)return g(d);let f=Qn(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?g(ir(e.operationId,i)):_(`No body`,void 0);let p=er(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return g(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!P(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return g(`${e.operationId} requires a JSON object${t}.`)}let m=Yn(i,p.data);if(m.length>0)return g(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=P(h)?nn(i).filter(e=>!gn(h,e)):[];return ee.length>0?g(Jn(e.operationId,i,ee)):p}function Kn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${I(t)} requires ${F} ${i.join(` or `)}.`}return null}function qn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Jn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Yn(e,t){return P(t)?e.parameter.filter(e=>e.required&&!gn(t,e.name)).map(I):[]}function Xn(e,t,n){let r=yn(t,n);if(r===null)return _(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return g(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Zn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return _(`No body file`,void 0);let n=await Rn(t);if(!n.ok)return g(n.summary,n.warnings);let r=oe.safeParse(n.data);return r.success?_(`Input parsed`,r.data):g(`Input is not valid JSON value: ${r.error.message}`)}function Qn(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=cn(e,n[e.optionKey]);if(!a.ok||a.data===null)return g(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=$n(t,n,r,e,o);if(!s.ok)return g(s.summary,s.warnings);i=!0}if(!i)return _(`No direct body options`,void 0);let a=fn(e,t,n,r);return a===null?_(`Direct body options parsed`,r):a}function $n(e,t,n,r,i){let a=un(r,i);if(a===null){let e=nr(r,i);return e.ok?rn(n,r.name,e.data,r.schemaType===`array`):g(e.summary,e.warnings)}if(a.plain.length>0)return g(`${I(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=dn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return g(`${I(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=rr(r.name,r.itemSchemaType,e);if(!t.ok)return g(t.summary,t.warnings);i.push(t.data)}let a=an(n,r.name,e,i);if(!a.ok)return a}return _(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function er(e,t,n,r){if(n===void 0)return _(`Direct body parsed`,r);if(r===void 0)return _(`Input parsed`,n);if(P(n)&&P(r))try{return _(`Input parsed`,tr(t,n,r))}catch(t){return g(`${e} ${t.message}`)}return g(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function tr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(P(n)&&P(a))i[t]=tr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:Pe.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nr(e,t){if(typeof t==`boolean`)return _(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return rr(e.name,e.schemaType,t??``);let n=[],r=N(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=rr(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return _(`Body value parsed`,n)}function rr(e,t,n){if(t===`boolean`)return n===`true`?_(`Body value parsed`,!0):n===`false`?_(`Body value parsed`,!1):g(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?g(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?g(`${e} must be an integer.`):_(`Body value parsed`,i)}return _(`Body value parsed`,n)}function ir(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(I).join(`, `)}`;let r=nn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function ar(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:F,location:`body`}),or(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),kn(e.options,r)}function or(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function sr(e){let t=ae(e,Ne(e,w));return gr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function cr(e){let t=ae(e,Ne(e,w));gr(t);let n=ke(w,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=lr(t);r.push(n.endsWith(`
1
+ import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a}from"./logging-sKoOD-tO.js";import{M as o,O as s,i as c,o as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{Ar as p,Dr as m,Er as h,Lr as ee,Mr as te,Or as ne,Rr as re,kr as ie}from"./dist-qYT7b7rJ.js";import{n as ae,r as g,s as _,u as oe}from"./result-envelope-DTzTOcab.js";import{i as se,l as v,o as ce,r as le,s as ue,t as y}from"./env-ClsLmXWa.js";import{a as b,n as de,r as fe,t as pe}from"./package-DPDX5zmx.js";import{S as me,d as he,f as ge,o as _e,p as ve,r as ye,s as be,t as xe}from"./tool-policy-Cg0XvZMq.js";import{i as Se,r as Ce}from"./response-problem-DCBMY8Lr.js";import{n as we}from"./output-spill-D0GZ7YT_.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as je,n as x,o as Me,r as Ne,s as Pe,u as Fe,y as Ie}from"./contract-BjZg8t8U.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,s as He,t as Ue}from"./cli-help-policy-BbLTU6HE.js";import{S as We,_ as Ge,a as Ke,g as S,h as qe,i as Je,m as Ye,n as Xe,p as Ze,r as Qe,s as $e,t as et,v as tt,x as C,y as nt}from"./api-key-bearer-credential-CW5W3VVg.js";import{a as rt,c as it,d as at,g as ot,l as st,m as ct,o as lt,s as ut,t as dt,u as ft}from"./oauth-bearer-credential-_hReIflB.js";import{n as pt,r as mt,t as ht}from"./oauth-login-BTK7bnlR.js";import{a as gt,c as _t,d as vt,i as yt,l as bt,n as xt,o as St,s as Ct,t as wt,u as Tt}from"./startup-auth-GYDuOgMb.js";import{n as Et,t as w}from"./openapi-commands-CuOsKOYe.js";import{i as T,r as Dt,t as E}from"./output-mode-sM_EbDW_.js";import{spawnSync as Ot}from"node:child_process";import{basename as D,dirname as O,relative as kt,resolve as k,sep as At}from"node:path";import{copyFileSync as jt,existsSync as A,lstatSync as Mt,mkdirSync as Nt,mkdtempSync as Pt,readFileSync as Ft,readdirSync as It,readlinkSync as Lt,realpathSync as Rt,renameSync as zt,symlinkSync as Bt,writeFileSync as Vt}from"node:fs";import j,{stderr as M,stdin as Ht}from"node:process";import{TextDecoder as Ut,inspect as Wt}from"node:util";import{homedir as Gt,hostname as Kt,platform as qt}from"node:os";import{fileURLToPath as Jt}from"node:url";import{setTimeout as Yt}from"node:timers/promises";import{randomUUID as Xt,webcrypto as Zt}from"node:crypto";import{readFile as Qt}from"node:fs/promises";import{createInterface as $t}from"node:readline/promises";function en(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{...g(`${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 _(`Environment-bound options applied`,r)}function tn(e,t,n){if(!P(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||!gn(n,r.name))continue;let a=hn(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 nn(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 rn(e,t,n,r=!1){if(r||!N(t)||!Array.isArray(n))return bn(e,t,n);for(let[r,i]of n.entries()){let n=bn(e,t,i,r);if(!n.ok)return n}return _(`Body value assigned`,null)}function an(e,t,n,r){return bn(e,t,r,n)}function on(e){let t=[];for(let n of e.split(`.`)){let e=Sn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function sn(e,t){let n=on(t);if(n===null)return null;let r=mn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:pn(r)}:null}function cn(e,t){if(N(e.name)||e.schemaType===`array`)return _(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return _(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?_(`Scalar body option selected`,t[0]):g(`${n} was already given; pass it once.`)}var ln=/^(?<row>\d+):(?<item>.*)$/su;function un(e,t){let n=on(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=ln.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 dn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&on(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function fn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=sn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return g(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||un(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return g(`${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 pn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function mn(e,t){let n=e;for(let e of t){if(!P(n))return;n=n[e]??null}return n}function hn(e,t){if(!N(t))return mn(e,t.split(`.`))}function gn(e,t){return vn(e,t.split(`.`))}function _n(e,t,n){if(!P(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)&&gn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function vn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Sn(n);if(!P(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>vn(e,r)):vn(a,r)}function N(e){return e.split(`.`).some(e=>Sn(e).isArray)}function yn(e,t){return e.parameter.length===0||!P(t)?null:wn(t,[],Cn(e.parameter))}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Sn(o),c=e===i.length-1,l=xn(a,s,t,c,n,r);if(!l.ok||l.data===null)return g(l.summary,l.warnings);if(c)return _(`Body value assigned`,null);a=l.data}return g(`${t} is not a valid body option path.`)}function xn(e,t,n,r,i,a){let o=()=>g(`${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,_(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,_(`Body path created`,e)}return P(c)?_(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,_(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,_(`Body path created`,n)}return P(s)?_(`Body path stepped`,s):o()}function Sn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function Cn(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 wn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=wn(r,t,n);if(e!==null)return e}return null}if(!P(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!Tn(a,n)){if(!En(e))continue;return{path:a,suggestion:Dn(e,n)}}let o=wn(i,e,n);if(o!==null)return o}return null}function Tn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function En(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function Dn(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:On(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 On(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function 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(Re(e)),t.description=te(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?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?Be(n):`${Be(n)} Required JSON paths: ${r.join(`, `)}.`}function Fn(e,t){let n=Le(t.description,void 0),r=e.kind!==`multipart`&&N(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=on(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 He(e)-He(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Rn(e){let t;try{t=e===`-`?await zn():await Qt(e,`utf8`)}catch(t){return g(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return _(`No input provided`,null);let e=JSON.parse(t);return _(`Input parsed`,e)}catch(e){return g(`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 F=`--content-type`;function Bn(t,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(F)){let n=a.map(({contentType:e})=>e);t.addOption(new e(`${F} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Hn(a)))}if(or(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);t.addOption(new e(`--from-file <path>`,Pn(r,r.requiredPath)).argParser(Wn(`--from-file`)))}let o=An(a).filter(e=>i(I(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 e(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(Vn):N(i.name)||i.schemaType===`array`?o.argParser(Un):o.argParser(Wn(i.flag)),t.addOption(o),o.envVar!==void 0&&t.on(`optionEnv:${o.name()}`,()=>{let e=t.opts()[i.optionKey];typeof e==`string`&&e.trim()&&t.setOptionValueWithSource(i.optionKey,e.trim(),`env`)})}ar(t,n,o)}function Vn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Hn(e){return(n,r)=>{if(r!==void 0)throw new t(`${F} was already given; pass it once.`);let i=me(e,n);if(!i.ok)throw new t(i.summary);return n}}function Un(e,t){return[...t??[],e]}function Wn(e){let n=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new t(`${n} was already given; pass it once.`);return e}}async function Gn(e,t){let n=St(e,t),r=me(e.requestBody??[],n);if(!r.ok||r.data===null)return g(r.summary,r.warnings);let i=r.data;if(i===void 0)return _(`No body`,void 0);let a=Kn(e,i,t);if(a!==null)return g(a);let o=en(e.operationId,i,t);if(!o.ok)return g(o.summary,o.warnings);t=o.data;let s=qn(i,t);if(s!==null)return g(s);let c=await Zn(t);if(!c.ok)return g(c.summary,c.warnings);let l=_n(e.requestBody??[],i,c.data);if(l!==null)return g(l);let u=Xn(e.operationId,i,c.data);if(!u.ok)return u;let d=tn(e.operationId,i,c.data);if(d!==null)return g(d);let f=Qn(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?g(ir(e.operationId,i)):_(`No body`,void 0);let p=er(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return g(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!P(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return g(`${e.operationId} requires a JSON object${t}.`)}let m=Yn(i,p.data);if(m.length>0)return g(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,ee=P(h)?nn(i).filter(e=>!gn(h,e)):[];return ee.length>0?g(Jn(e.operationId,i,ee)):p}function Kn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${I(t)} requires ${F} ${i.join(` or `)}.`}return null}function qn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Jn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Yn(e,t){return P(t)?e.parameter.filter(e=>e.required&&!gn(t,e.name)).map(I):[]}function Xn(e,t,n){let r=yn(t,n);if(r===null)return _(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return g(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Zn(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return _(`No body file`,void 0);let n=await Rn(t);if(!n.ok)return g(n.summary,n.warnings);let r=oe.safeParse(n.data);return r.success?_(`Input parsed`,r.data):g(`Input is not valid JSON value: ${r.error.message}`)}function Qn(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=cn(e,n[e.optionKey]);if(!a.ok||a.data===null)return g(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=$n(t,n,r,e,o);if(!s.ok)return g(s.summary,s.warnings);i=!0}if(!i)return _(`No direct body options`,void 0);let a=fn(e,t,n,r);return a===null?_(`Direct body options parsed`,r):a}function $n(e,t,n,r,i){let a=un(r,i);if(a===null){let e=nr(r,i);return e.ok?rn(n,r.name,e.data,r.schemaType===`array`):g(e.summary,e.warnings)}if(a.plain.length>0)return g(`${I(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=dn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return g(`${I(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=rr(r.name,r.itemSchemaType,e);if(!t.ok)return g(t.summary,t.warnings);i.push(t.data)}let a=an(n,r.name,e,i);if(!a.ok)return a}return _(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function er(e,t,n,r){if(n===void 0)return _(`Direct body parsed`,r);if(r===void 0)return _(`Input parsed`,n);if(P(n)&&P(r))try{return _(`Input parsed`,tr(t,n,r))}catch(t){return g(`${e} ${t.message}`)}return g(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function tr(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(P(n)&&P(a))i[t]=tr(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:Pe.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nr(e,t){if(typeof t==`boolean`)return _(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return rr(e.name,e.schemaType,t??``);let n=[],r=N(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=rr(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return _(`Body value parsed`,n)}function rr(e,t,n){if(t===`boolean`)return n===`true`?_(`Body value parsed`,!0):n===`false`?_(`Body value parsed`,!1):g(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?g(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?g(`${e} must be an integer.`):_(`Body value parsed`,i)}return _(`Body value parsed`,n)}function ir(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(I).join(`, `)}`;let r=nn(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function ar(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:F,location:`body`}),or(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),kn(e.options,r)}function or(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function sr(e){let t=ae(e,Ne(e,w));return gr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function cr(e){let t=ae(e,Ne(e,w));gr(t);let n=ke(w,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=lr(t);r.push(n.endsWith(`
2
2
  `)?n.slice(0,-1):n),r.push(...e),process.stdout.write(Te(r.join(`
3
3
  `),!0,!0,e.length));return}let i=t.ok?`OK`:`FAIL`;r.push(`[${i}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...fr(t.problem)),r.push(...lr(t)),process.stdout.write(Te(r.join(`
4
4
  `),!0))}function lr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function L(e,t){let n=we(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?ae(n,Ne(n,w)):n;gr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?ur(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?sr(n):n;e.mode===`text`&&cr(r),r.ok||(process.exitCode=1)}function ur(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function dr(e,t){let n=Me(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
@@ -11,7 +11,7 @@ import{n as e,o as t,r as n,t as r}from"./commander-BB7CDPLs.js";import{i,o as a
11
11
  `)}function Rr(e,t){return t===`json`?JSON.stringify(e,null,2):t===`ndjson`?JSON.stringify(e.operation):t===`lines`?Hr(e.operation):t===`compact`?zr(e.operation):e.usage}function zr(e){let t=Br(e);return[e.cli.command,e.summary,t.length===0?Or:t.join(` `)].join(Dr)}function Br(e){return e.flags.filter(t=>t.required&&(t.contentType===void 0||t.contentType===e.body.contentType)).map(e=>e.name)}function Vr(e){return e.map(e=>`${e.cli.command}\n ${Hr(e)}`).join(`
12
12
  `)}function Hr(e){let t=Br(e);return[z(`operationId`,e.operationId),z(`scope`,e.scope),z(`mutates`,String(e.mutates)),z(`destructive`,String(e.destructive)),z(`intent`,e.intent),z(`resource`,e.resource),z(`cli`,e.cli.command),e.mcpTool===null?``:z(`mcpTool`,e.mcpTool),z(`method`,e.method),z(`path`,e.path),z(`auth`,e.auth),z(`flags`,[...new Set(e.flags.map(e=>e.name))].join(` `)),z(`requiredFlags`,t.join(` `)),z(`bodyKind`,e.body.kind??``),z(`bodyRequired`,String(e.body.required)),z(`summary`,e.summary)].filter(e=>e.length>0).join(` `)}function z(e,t){return t.length===0?``:`${e}=${JSON.stringify(t)}`}function Ur(e){return`count`in e?e.count:{returned:1}}function Wr(e,t,n=b().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show full documentation for a command, or ask a question`).description([`Show a command's full documentation offline. Select it by command path,`,"operationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.","`help ask <question>` or `help --ask <question>` answers a platform question."].join(`
13
13
  `)).argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new Gr(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()});let i=Zr(t);i!==void 0&&r.option(`--ask <question>`,i.summary),E(r),r.action(async function(r){let a=this.optsWithGlobals();if(a.help&&r.length===0){this.outputHelp();return}if(!a.help&&i!==void 0&&a.ask!==void 0){let e=T(a);if(r.length>0){L({mode:e},g(`Use either a command path or --ask, not both.`));return}L({mode:e},await ti(i,a.ask,a.environment,e));return}let o=ei(e,r),s=t.find(t=>o!==void 0&&ei(e,t.cliPath)===o);if(a.help||o!==void 0&&s===void 0){o===void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),o.outputHelp();return}let c=s===void 0?$r(r,t):_(`Resolved by command path`,{operationId:s.operationId});if(c.ok&&c.data?.command!==void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),!c.ok||c.data===null){L({mode:T(a)},c);return}Nr({...a,...c.data},t,T(a,`text`),n)}),Xr(e,t,n)}var Gr=class extends e{helpCommand;constructor(e){super(`-h, --help`,`display help for command`),this.helpCommand=e}is(e){if(e!==this.short&&e!==this.long)return!1;let t=this.helpCommand.parent?.args??[],n=t.findIndex(e=>e===this.helpCommand.name()||this.helpCommand.aliases().includes(e)),r=n<0?void 0:t[n+1];return r===void 0||r.startsWith(`-`)?!0:!this.helpCommand.commands.some(e=>e.name()===r||e.aliases().includes(r))}},Kr=2,qr=6,Jr={formatHelp(e,t){let r=r=>n.prototype.formatHelp.call(this,e,Object.assign(Object.create(t),r));if(t.visibleCommands(e).length===0)return r({});let i=t.padWidth(e,t),a={padWidth:()=>i,visibleOptions:()=>[],showGlobalOptions:!1},o=r({...a,visibleCommands:()=>[]}),s=r({padWidth:()=>i,visibleCommands:()=>[]}).slice(o.length);return r(a)+s},visibleCommands(e){let t=n.prototype.visibleCommands.call(this,e);return e.parent===null?t.filter(e=>!Ve.has(e.name())):t},subcommandTerm(e){let t=n.prototype.subcommandTerm.call(this,e);return e.commands.length>0&&e.registeredArguments.length===0?`${t} <command>`:t},formatItem(e,t,r,i){let a=i.helpWidth??80,o=a-t-4;return r===``||o>=i.minWidthToWrap?n.prototype.formatItem.call(i,e,t,r,i):`${` `.repeat(Kr)}${e}\n${Yr(r,a,i)}`}};function Yr(e,t,n){return n.boxWrap(e,t-qr).replace(/^/gmu,` `.repeat(qr))}function Xr(e,t,n){for(let r of t){let i=ei(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp();e.prepareContext({helpWidth:i.configureOutput().getOutHelpWidth?.()});let a=e.helpWidth??80,o=Ae(r.operationId,t,n),[s,...c]=Cr(r.errorResponse),l=c.map(t=>Yr(t.trimStart(),a,e).replace(/^ +/u,` `.repeat(Kr))),u=s===void 0?[]:[``,s,...l];return`\n${[...o,...u].join(`
14
- `)}\n`})}}function Zr(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&ni(e)!==void 0});return n.length===0?t:void 0}var Qr='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';function $r(e,t){let[n,...r]=e,i=he.find(e=>e===n?.toLowerCase());if(i===void 0||r.length===0){let n=e.join(` `).trim();return _(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let a=ge(i),o=r.join(``),s=t.find(e=>e.method===a&&e.path===o);if(s!==void 0)return _(`Resolved by route template`,{operationId:s.operationId});let c=ie({method:a,path:o});return!c.ok||c.data===null?g(c.summary,[...c.warnings,Qr]):_(`Resolved by method and path`,{operationId:c.data.operation.operationId})}function ei(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}async function ti(e,t,n,r){let i=ni(e);if(i===void 0)return g(`The \`${e.cliPath.join(` `)}\` operation no longer takes a single required text body; run it directly instead of \`help --ask\`.`);n!==void 0&&(process.env.API_ENV=n);let a=await Gn(e,{[i.optionKey]:t});return a.ok?await p({method:e.method,path:m(e.operationId,{}),searchParams:{},body:a.data,auth:e.auth,responseFormat:Dt(r)?`json`:`auto`}):a}function ni(e){if(e.requestBody?.length!==1||e.parameters.some(e=>e.required))return;let t=(e.requestBody[0]?.parameter??[]).filter(e=>e.required);return t.length===1&&t[0]?.schemaType===`string`?t[0]:void 0}function ri(e,t,n){if(e.cliPath[0]!==`lookup`||!ii(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`),i=`no record for ${r.length===0?`the given input`:r.join(`, `)}`;return n.ok?g(i):g(i,[],{httpStatus:n.httpStatus,problem:n.problem})}function ii(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function ai(e,t){if(e.deprecated!==!0)return t;let n=e.description.match(/^Deprecated:[^.]*\./u)?.[0]??`Deprecated; run \`help ${e.cliPath.join(` `)}\` for its replacement.`;return{...t,warnings:[n,...t.warnings]}}var oi=f({artifact:d().nullish(),group:d().nullish(),name:d().nullish(),revision:d().nullish(),time:c({offset:!0}).nullish(),version:d().nullish()}),si=f({build:oi}),ci=l([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),li=l([`RSA_OAEP_256_A256_GCM_V1`]),ui=f({clientLabel:d().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:ci.nullish(),encryptionAlgorithm:li.nullish(),encryptionPublicKey:d().min(344).max(12e3).nullish()}),di=32;async function fi(){let e=await Zt.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await Zt.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function pi(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=mi(n,`wrapped key`,128,1024),s=mi(r,`nonce`,12,12),c=mi(i,`ciphertext`,1,65536),l=mi(a,`authentication tag`,16,16),u;try{u=await Zt.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==di)throw Error(`broker credential used an invalid AES-256 key`);let e=await Zt.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await Zt.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new Ut(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function mi(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var hi=l([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),gi=l([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),_i=f({approvedAt:c({offset:!0}).nullish(),clientLabel:d(),clientPlatform:ci,comparisonCode:d(),consumedAt:c({offset:!0}).nullish(),createdAt:c({offset:!0}),expiresAt:c({offset:!0}),id:s(),intervalSeconds:u().int().min(1),keyReadyAt:c({offset:!0}).nullish(),status:hi,terminalAt:c({offset:!0}).nullish(),terminalReason:gi.nullish(),updatedAt:c({offset:!0})}),vi=f({algorithm:li,authenticationTag:d(),ciphertext:d(),nonce:d(),wrappedKey:d()}),yi=f({delivery:vi.nullish(),expiresAt:c({offset:!0}),status:hi,terminalReason:gi.nullish()}),bi=f({comparisonCode:d(),expiresAt:c({offset:!0}),id:s(),intervalSeconds:u().int().min(1),pollSecret:d(),verificationUrl:d()}),B=[{command:`auth login`,role:`oauth`,summary:`Sign In Through Your Browser`,description:`Sign in through your browser, or use --no-browser for OAuth device authorization, and save verified CLI access in the credential store.`,operationId:`getAuthProviderCatalog`,method:`GET`,path:`/v1/auth/providers`,bodyOption:[],localOption:[{optionKey:`browser`,flag:`--no-browser`,description:`Use OAuth device authorization: print a sign-in URL and code, then wait for approval. With --key, print the API-key approval URL.`},{optionKey:`providers`,flag:`--providers`,description:`Print the sign-in providers and CLI OAuth client, then exit without signing in.`}]},{command:`auth login`,role:`start`,summary:`Sign In With a Browser-Approved aVenture API Key`,description:`Creates a short-lived browser approval request and returns its poll credential once.`,operationId:`createCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations`,bodyOption:[{name:`clientLabel`,optionKey:`clientLabel`,flag:`--client-label <client-label>`,required:!1,description:`Label for this CLI installation.`}],localOption:[{optionKey:`key`,flag:`--key`,description:`Sign in with a browser-approved aVenture API key instead of OAuth; the approval URL opens on any device.`},{optionKey:`browser`,flag:`--no-browser`,description:`Print the API-key approval URL and wait for approval without opening a browser.`}]},{command:`auth login`,role:`poll`,summary:`Poll CLI Authorization`,description:`Returns pending state, a terminal state, or an encrypted one-time credential delivery.`,operationId:`pollCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/poll`,bodyOption:[],localOption:[]},{command:`auth login`,role:`acknowledge`,summary:`Acknowledge CLI Credential Delivery`,description:`Confirms the CLI stored the delivered API key in its credential store and clears transient delivery material.`,operationId:`acknowledgeCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/acknowledge`,bodyOption:[],localOption:[]},{command:`auth logout`,role:`revoke`,summary:`Sign Out: Revoke the API Key and Forget Stored OAuth`,description:`Revokes the aVenture API key authenticating this request and returns its metadata so the CLI can confirm revocation before deleting its saved copy.`,operationId:`revokeCurrentApiKey`,method:`DELETE`,path:`/v1/auth/api-key`,bodyOption:[],localOption:[{optionKey:`forgetLocal`,flag:`--forget-local`,description:`Delete the saved key even when revocation cannot be confirmed.`}]}],xi=x(B,`start`),Si=x(B,`poll`),Ci=x(B,`acknowledge`),V=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${Ge(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=ki(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},wi=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${S(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function Ti(e){let t=await re(We(v()),{method:xi.method,path:ve(xi.path,{},xi.operationId),headers:{},contentType:`application/json`,body:e},bi);if(t.ok&&t.redirect)throw new V(`start`,Ai(t.status));if(!t.ok)throw new V(`start`,t.problem);return ji(t.data)}async function Ei(e,t){let n=ne(Si.operationId),r=await re(We(v()),{method:Si.method,path:ve(Si.path,{cliAuthorizationId:e},Si.operationId),headers:{[n]:t}},yi);if(r.ok&&r.redirect)throw new V(`poll`,Ai(r.status),[t]);if(!r.ok)throw new V(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:Oi(r.headers[`retry-after`])}}async function Di(e,t){let n=ne(Ci.operationId),r;try{r=await re(We(v()),{method:Ci.method,path:ve(Ci.path,{cliAuthorizationId:e},Ci.operationId),headers:{[n]:t}},_i)}catch(e){throw new wi(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new V(`acknowledge`,Ai(r.status),[t]);if(!r.ok)throw new V(`acknowledge`,r.problem,[t]);return r.data}function Oi(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function ki(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function Ai(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ji(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[Wt.custom]:{enumerable:!1,value:a}})}async function Mi(e){let t=await Ni(e.credential.secret);if(t.state!==`verified`||e.activation!==`active`)return{stored:e,verification:t};try{return{stored:await Ke(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`),verification:t}}catch(n){return{stored:e,verification:{state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${S(n,[e.credential.secret])}`}}}}async function Ni(e){let t=We(v()),n;try{n=await re(t,{method:`GET`,path:m(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${e}`}},tt)}catch(t){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${S(t,[e])}`}}return n.ok&&n.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${n.status}`}:n.ok?n.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:n.data}:{state:`invalid`,summary:`API key is not active`}:{state:n.problem.status===401||n.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${Ge(n.problem,[e])}`}}var Pi=x(B,`revoke`);async function Fi(e){let t;try{t=C(v().host)}catch(e){return g(`auth logout: invalid API host — ${S(e)}`)}let n=await Ii(t),r=await zi(t,e),i=n.state===`failed`?[`OAuth credential could not be removed — ${n.summary}`]:n.state===`forgotten`&&!n.revoked?[`OAuth refresh token was not revoked remotely — ${n.summary??`no revocation endpoint`}`]:[],a={host:t,revoked:!1,forgotten:!1,oauth:n};return r===null?n.state===`missing`?_(`No CLI credential is stored for this API host.`,a):n.state===`failed`?{...g(`auth logout: ${i[0]}`),data:a}:_(n.revoked?`OAuth credential revoked remotely and removed locally.`:`OAuth credential removed locally.`,a,{warnings:i}):{...r,data:{...r.data??a,oauth:n},warnings:[...r.warnings,...i]}}async function Ii(e){let t=await lt(e);if(t.state===`missing`)return{state:`missing`};let n=t.state===`found`?await Ri(t.stored):{revoked:!1};try{await rt(e)}catch(e){return{state:`failed`,summary:S(e)}}return{state:`forgotten`,...n}}async function Li(e){let t=Reflect.get(await ht(e),`revocation_endpoint`);return typeof t==`string`?ot(t,`revocation endpoint`,!0):void 0}async function Ri(e){let{client:t,tokens:n}=e.credential,r=n.refresh_token??n.access_token;try{let e=await Li(t);if(e===void 0)return{revoked:!1};let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:r,client_id:ft(t)})});return n.ok?{revoked:!0}:{revoked:!1,summary:`revocation endpoint answered ${n.status}`}}catch(e){return{revoked:!1,summary:S(e,ct(n))}}}async function zi(e,t){let n;try{n=await Je(e)}catch(e){return g(`auth logout: stored credential could not be read — ${S(e)}`)}if(n.state===`unavailable`)return{...g(`auth logout: ${n.summary}`),data:{host:e,revoked:!1,forgotten:!1}};if(n.state===`missing`)return null;let r=n.stored,i=await Bi(r),a=i.outcome===`revoked`,o=r.activation===`pending`&&i.outcome===`rejected`;if(!a&&!o&&!t.forgetLocal)return{...g(`auth logout: remote revocation was not confirmed; local credential preserved — ${i.summary}`,[`Retry when the API is available. If an earlier response was lost after revocation, the retry can be unauthorized because revoked keys cannot authenticate.`,"Use `--forget-local` only to remove local bytes while accepting that the remote key may remain active."]),data:Vi(r,!1,!1)};try{await Xe(r.host)}catch(e){return{...g(`auth logout: local credential removal failed — ${S(e,[r.credential.secret])}`,[a?"The remote key is revoked. Re-run with `--forget-local` to retry local cleanup.":`Remote revocation was not confirmed; inspect auth status before retrying.`]),data:Vi(r,a,!1)}}return _(a?`API key revoked remotely and removed locally.`:o?`Stale pending CLI credential removed; its remote key can no longer authenticate and unacknowledged keys expire at the authorization deadline.`:`API key removed locally without confirmed remote revocation.`,Vi(r,a,!0),{ids:[r.credential.apiKey.id],warnings:a||o?[]:[`Remote revocation was not confirmed; the API key may remain active.`]})}async function Bi(e){let t=We(v());try{let n=await re(t,{method:Pi.method,path:ve(Pi.path,{},Pi.operationId),headers:{Authorization:`Bearer ${e.credential.secret}`}},tt);return n.ok&&n.redirect?{outcome:`unconfirmed`,summary:`remote key revocation returned unexpected redirect ${n.status}`}:n.ok?n.data.id!==e.credential.apiKey.id||n.data.subject!==e.credential.apiKey.subject?{outcome:`unconfirmed`,summary:`remote response did not match the stored API key identity`}:n.data.status===`REVOKED`?{outcome:`revoked`,summary:`remote key revocation confirmed`}:{outcome:`unconfirmed`,summary:`remote response did not confirm REVOKED status`}:{outcome:n.problem.status===401&&n.problem.type!==`about:blank`?`rejected`:`unconfirmed`,summary:Ge(n.problem,[e.credential.secret])}}catch(t){return{outcome:`unconfirmed`,summary:S(t,[e.credential.secret])}}}function Vi(e,t,n){return{host:e.host,apiKeyId:e.credential.apiKey.id,activation:e.activation,revoked:t,forgotten:n}}var Hi=`RSA_OAEP_256_A256_GCM_V1`,Ui=1,Wi=30,H=b().bin[0],Gi=`The local record remains pending and unavailable to ordinary commands. Re-run \`${H} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function Ki(e){if(!Ht.isTTY)return g(`${H} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let t,n;try{let e=v().host;t=C(e),n=nt(e)}catch(e){return g(`auth login --key: invalid environment configuration — ${S(e)}`)}for(;;){let e;try{e=await Qe(t)}catch(e){return g(`auth login --key: credential storage could not be inspected — ${S(e)}`)}if(e.state===`unavailable`)return g(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&M.write($e(e.keyringFailure));break}let n=await qi(e.stored);if(n!==null)return n}let r;try{r=await fi()}catch(e){return g(`auth login --key: ephemeral encryption key could not be created — ${S(e)}`)}let i=ui.safeParse({clientLabel:e.clientLabel?.trim()||(Kt().trim()||H).slice(0,120),clientPlatform:Zi(),encryptionAlgorithm:Hi,encryptionPublicKey:r.publicKey});if(!i.success)return g(`auth login --key: ${o(i.error)}`);let a;try{a=await Ti(i.data)}catch(e){return g(`auth login --key: could not start browser authorization — ${S(e)}`)}let s;try{s=Ye(a,n)}catch(e){return g(`auth login --key: unsafe browser authorization URL rejected — ${S(e)}`)}if(!Xi(await Ze(a,n,{noBrowser:e.noBrowser}),a,s))return g(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[s]});let c;try{c=await Yi(a)}catch(e){return g(`auth login --key: authorization did not complete — ${S(e)}`,[],{references:[s]})}if(c.algorithm!==Hi)return g(`auth login --key: broker selected an unsupported encryption algorithm`);let l;try{l=await pi(r.privateKey,c)}catch(e){return g(`auth login --key: encrypted credential could not be opened — ${S(e)}`)}let u=await Ni(l);if(u.state!==`verified`)return g(`auth login --key: decrypted credential was neither stored nor acknowledged — ${u.summary}`);let d;try{d=await Ke(t,{apiKey:u.apiKey,secret:l},`pending`)}catch(e){return g(`auth login --key: credential could not be durably stored — ${S(e)}`)}let f;try{f=await Ji(a)}catch(e){return U(d,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${S(e,[a.pollSecret])}`,Gi)}if(f.status!==`CONSUMED`)return U(d,!0,`auth login --key: broker returned ${f.status} after acknowledgment`,Gi);let p=await Ni(l);if(p.state!==`verified`||!ta(p.apiKey,d.credential.apiKey))return U(d,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${p.summary}`,Gi);try{let e=await Ke(t,{apiKey:p.apiKey,secret:l},`active`);return _(`API key stored; authenticated identity and broker acknowledgment verified.`,ea(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return U(d,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${S(e)}`,Gi)}}async function qi(e){let t=await Ni(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?_(`API key is already stored and its authenticated identity was verified.`,ea(e,!0),{ids:[e.credential.apiKey.id]}):U(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${H} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&ta(t.apiKey,e.credential.apiKey))try{let n=await Ke(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return _(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,ea(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return U(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${S(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${H} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return U(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${H} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await Bi(e);if(n.outcome===`unconfirmed`)return U(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await Xe(e.host)}catch(t){return U(e,!1,`auth login --key: stale pending credential could not be removed — ${S(t,[e.credential.secret])}`)}return M.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
14
+ `)}\n`})}}function Zr(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&ni(e)!==void 0});return n.length===0?t:void 0}var Qr='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';function $r(e,t){let[n,...r]=e,i=he.find(e=>e===n?.toLowerCase());if(i===void 0||r.length===0){let n=e.join(` `).trim();return _(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let a=ge(i),o=r.join(``),s=t.find(e=>e.method===a&&e.path===o);if(s!==void 0)return _(`Resolved by route template`,{operationId:s.operationId});let c=ie({method:a,path:o});return!c.ok||c.data===null?g(c.summary,[...c.warnings,Qr]):_(`Resolved by method and path`,{operationId:c.data.operation.operationId})}function ei(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}async function ti(e,t,n,r){let i=ni(e);if(i===void 0)return g(`The \`${e.cliPath.join(` `)}\` operation no longer takes a single required text body; run it directly instead of \`help --ask\`.`);n!==void 0&&(process.env.API_ENV=n);let a=await Gn(e,{[i.optionKey]:t});return a.ok?await p({method:e.method,path:m(e.operationId,{}),searchParams:{},body:a.data,auth:e.auth,responseFormat:Dt(r)?`json`:`auto`}):a}function ni(e){if(e.requestBody?.length!==1||e.parameters.some(e=>e.required))return;let t=(e.requestBody[0]?.parameter??[]).filter(e=>e.required);return t.length===1&&t[0]?.schemaType===`string`?t[0]:void 0}function ri(e,t,n){if(e.cliPath[0]!==`lookup`||!ii(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`),i=`no record for ${r.length===0?`the given input`:r.join(`, `)}`;return n.ok?g(i):g(i,[],{httpStatus:n.httpStatus,problem:n.problem})}function ii(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function ai(e,t){if(e.deprecated!==!0)return t;let n=e.description.match(/^Deprecated:[^.]*\./u)?.[0]??`Deprecated; run \`help ${e.cliPath.join(` `)}\` for its replacement.`;return{...t,warnings:[n,...t.warnings]}}var oi=f({artifact:d().nullish(),group:d().nullish(),name:d().nullish(),revision:d().nullish(),time:c({offset:!0}).nullish(),version:d().nullish()}),si=f({build:oi}),ci=l([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),li=l([`RSA_OAEP_256_A256_GCM_V1`]),ui=f({clientLabel:d().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:ci.nullish(),encryptionAlgorithm:li.nullish(),encryptionPublicKey:d().min(344).max(12e3).nullish()}),di=32;async function fi(){let e=await Zt.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await Zt.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function pi(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=mi(n,`wrapped key`,128,1024),s=mi(r,`nonce`,12,12),c=mi(i,`ciphertext`,1,65536),l=mi(a,`authentication tag`,16,16),u;try{u=await Zt.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==di)throw Error(`broker credential used an invalid AES-256 key`);let e=await Zt.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await Zt.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new Ut(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function mi(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var hi=l([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),gi=l([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),_i=f({approvedAt:c({offset:!0}).nullish(),clientLabel:d(),clientPlatform:ci,comparisonCode:d(),consumedAt:c({offset:!0}).nullish(),createdAt:c({offset:!0}),expiresAt:c({offset:!0}),id:s(),intervalSeconds:u().int().min(1),keyReadyAt:c({offset:!0}).nullish(),status:hi,terminalAt:c({offset:!0}).nullish(),terminalReason:gi.nullish(),updatedAt:c({offset:!0})}),vi=f({algorithm:li,authenticationTag:d(),ciphertext:d(),nonce:d(),wrappedKey:d()}),yi=f({delivery:vi.nullish(),expiresAt:c({offset:!0}),status:hi,terminalReason:gi.nullish()}),bi=f({comparisonCode:d(),expiresAt:c({offset:!0}),id:s(),intervalSeconds:u().int().min(1),pollSecret:d(),verificationUrl:d()}),B=[{command:`auth login`,role:`oauth`,summary:`Sign In Through Your Browser`,description:`Sign in through your browser and save verified CLI access in the credential store. Use --no-browser for OAuth device authorization only when the issuer advertises device-grant support; otherwise use --key --no-browser for API-key approval.`,operationId:`getAuthProviderCatalog`,method:`GET`,path:`/v1/auth/providers`,bodyOption:[],localOption:[{optionKey:`browser`,flag:`--no-browser`,description:`Use OAuth device authorization only when the issuer advertises device-grant support: print a sign-in URL and code, then wait for approval. Otherwise use --key --no-browser for API-key approval.`},{optionKey:`providers`,flag:`--providers`,description:`Print the sign-in providers and CLI OAuth client, then exit without signing in.`}]},{command:`auth login`,role:`start`,summary:`Sign In With a Browser-Approved aVenture API Key`,description:`Creates a short-lived browser approval request and returns its poll credential once.`,operationId:`createCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations`,bodyOption:[{name:`clientLabel`,optionKey:`clientLabel`,flag:`--client-label <client-label>`,required:!1,description:`Label for this CLI installation.`}],localOption:[{optionKey:`key`,flag:`--key`,description:`Sign in with a browser-approved aVenture API key instead of OAuth; the approval URL opens on any device.`},{optionKey:`browser`,flag:`--no-browser`,description:`Print the API-key approval URL and wait for approval without opening a browser.`}]},{command:`auth login`,role:`poll`,summary:`Poll CLI Authorization`,description:`Returns pending state, a terminal state, or an encrypted one-time credential delivery.`,operationId:`pollCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/poll`,bodyOption:[],localOption:[]},{command:`auth login`,role:`acknowledge`,summary:`Acknowledge CLI Credential Delivery`,description:`Confirms the CLI stored the delivered API key in its credential store and clears transient delivery material.`,operationId:`acknowledgeCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/acknowledge`,bodyOption:[],localOption:[]},{command:`auth logout`,role:`revoke`,summary:`Sign Out: Revoke the API Key and Forget Stored OAuth`,description:`Revokes the aVenture API key authenticating this request and returns its metadata so the CLI can confirm revocation before deleting its saved copy.`,operationId:`revokeCurrentApiKey`,method:`DELETE`,path:`/v1/auth/api-key`,bodyOption:[],localOption:[{optionKey:`forgetLocal`,flag:`--forget-local`,description:`Delete the saved key even when revocation cannot be confirmed.`}]}],xi=x(B,`start`),Si=x(B,`poll`),Ci=x(B,`acknowledge`),V=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${Ge(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=ki(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},wi=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${S(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function Ti(e){let t=await re(We(v()),{method:xi.method,path:ve(xi.path,{},xi.operationId),headers:{},contentType:`application/json`,body:e},bi);if(t.ok&&t.redirect)throw new V(`start`,Ai(t.status));if(!t.ok)throw new V(`start`,t.problem);return ji(t.data)}async function Ei(e,t){let n=ne(Si.operationId),r=await re(We(v()),{method:Si.method,path:ve(Si.path,{cliAuthorizationId:e},Si.operationId),headers:{[n]:t}},yi);if(r.ok&&r.redirect)throw new V(`poll`,Ai(r.status),[t]);if(!r.ok)throw new V(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:Oi(r.headers[`retry-after`])}}async function Di(e,t){let n=ne(Ci.operationId),r;try{r=await re(We(v()),{method:Ci.method,path:ve(Ci.path,{cliAuthorizationId:e},Ci.operationId),headers:{[n]:t}},_i)}catch(e){throw new wi(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new V(`acknowledge`,Ai(r.status),[t]);if(!r.ok)throw new V(`acknowledge`,r.problem,[t]);return r.data}function Oi(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function ki(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function Ai(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ji(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[Wt.custom]:{enumerable:!1,value:a}})}async function Mi(e){let t=await Ni(e.credential.secret);if(t.state!==`verified`||e.activation!==`active`)return{stored:e,verification:t};try{return{stored:await Ke(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`),verification:t}}catch(n){return{stored:e,verification:{state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${S(n,[e.credential.secret])}`}}}}async function Ni(e){let t=We(v()),n;try{n=await re(t,{method:`GET`,path:m(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${e}`}},tt)}catch(t){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${S(t,[e])}`}}return n.ok&&n.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${n.status}`}:n.ok?n.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:n.data}:{state:`invalid`,summary:`API key is not active`}:{state:n.problem.status===401||n.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${Ge(n.problem,[e])}`}}var Pi=x(B,`revoke`);async function Fi(e){let t;try{t=C(v().host)}catch(e){return g(`auth logout: invalid API host — ${S(e)}`)}let n=await Ii(t),r=await zi(t,e),i=n.state===`failed`?[`OAuth credential could not be removed — ${n.summary}`]:n.state===`forgotten`&&!n.revoked?[`OAuth refresh token was not revoked remotely — ${n.summary??`no revocation endpoint`}`]:[],a={host:t,revoked:!1,forgotten:!1,oauth:n};return r===null?n.state===`missing`?_(`No CLI credential is stored for this API host.`,a):n.state===`failed`?{...g(`auth logout: ${i[0]}`),data:a}:_(n.revoked?`OAuth credential revoked remotely and removed locally.`:`OAuth credential removed locally.`,a,{warnings:i}):{...r,data:{...r.data??a,oauth:n},warnings:[...r.warnings,...i]}}async function Ii(e){let t=await lt(e);if(t.state===`missing`)return{state:`missing`};let n=t.state===`found`?await Ri(t.stored):{revoked:!1};try{await rt(e)}catch(e){return{state:`failed`,summary:S(e)}}return{state:`forgotten`,...n}}async function Li(e){let t=Reflect.get(await ht(e),`revocation_endpoint`);return typeof t==`string`?ot(t,`revocation endpoint`,!0):void 0}async function Ri(e){let{client:t,tokens:n}=e.credential,r=n.refresh_token??n.access_token;try{let e=await Li(t);if(e===void 0)return{revoked:!1};let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:r,client_id:ft(t)})});return n.ok?{revoked:!0}:{revoked:!1,summary:`revocation endpoint answered ${n.status}`}}catch(e){return{revoked:!1,summary:S(e,ct(n))}}}async function zi(e,t){let n;try{n=await Je(e)}catch(e){return g(`auth logout: stored credential could not be read — ${S(e)}`)}if(n.state===`unavailable`)return{...g(`auth logout: ${n.summary}`),data:{host:e,revoked:!1,forgotten:!1}};if(n.state===`missing`)return null;let r=n.stored,i=await Bi(r),a=i.outcome===`revoked`,o=r.activation===`pending`&&i.outcome===`rejected`;if(!a&&!o&&!t.forgetLocal)return{...g(`auth logout: remote revocation was not confirmed; local credential preserved — ${i.summary}`,[`Retry when the API is available. If an earlier response was lost after revocation, the retry can be unauthorized because revoked keys cannot authenticate.`,"Use `--forget-local` only to remove local bytes while accepting that the remote key may remain active."]),data:Vi(r,!1,!1)};try{await Xe(r.host)}catch(e){return{...g(`auth logout: local credential removal failed — ${S(e,[r.credential.secret])}`,[a?"The remote key is revoked. Re-run with `--forget-local` to retry local cleanup.":`Remote revocation was not confirmed; inspect auth status before retrying.`]),data:Vi(r,a,!1)}}return _(a?`API key revoked remotely and removed locally.`:o?`Stale pending CLI credential removed; its remote key can no longer authenticate and unacknowledged keys expire at the authorization deadline.`:`API key removed locally without confirmed remote revocation.`,Vi(r,a,!0),{ids:[r.credential.apiKey.id],warnings:a||o?[]:[`Remote revocation was not confirmed; the API key may remain active.`]})}async function Bi(e){let t=We(v());try{let n=await re(t,{method:Pi.method,path:ve(Pi.path,{},Pi.operationId),headers:{Authorization:`Bearer ${e.credential.secret}`}},tt);return n.ok&&n.redirect?{outcome:`unconfirmed`,summary:`remote key revocation returned unexpected redirect ${n.status}`}:n.ok?n.data.id!==e.credential.apiKey.id||n.data.subject!==e.credential.apiKey.subject?{outcome:`unconfirmed`,summary:`remote response did not match the stored API key identity`}:n.data.status===`REVOKED`?{outcome:`revoked`,summary:`remote key revocation confirmed`}:{outcome:`unconfirmed`,summary:`remote response did not confirm REVOKED status`}:{outcome:n.problem.status===401&&n.problem.type!==`about:blank`?`rejected`:`unconfirmed`,summary:Ge(n.problem,[e.credential.secret])}}catch(t){return{outcome:`unconfirmed`,summary:S(t,[e.credential.secret])}}}function Vi(e,t,n){return{host:e.host,apiKeyId:e.credential.apiKey.id,activation:e.activation,revoked:t,forgotten:n}}var Hi=`RSA_OAEP_256_A256_GCM_V1`,Ui=1,Wi=30,H=b().bin[0],Gi=`The local record remains pending and unavailable to ordinary commands. Re-run \`${H} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function Ki(e){if(!Ht.isTTY)return g(`${H} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let t,n;try{let e=v().host;t=C(e),n=nt(e)}catch(e){return g(`auth login --key: invalid environment configuration — ${S(e)}`)}for(;;){let e;try{e=await Qe(t)}catch(e){return g(`auth login --key: credential storage could not be inspected — ${S(e)}`)}if(e.state===`unavailable`)return g(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&M.write($e(e.keyringFailure));break}let n=await qi(e.stored);if(n!==null)return n}let r;try{r=await fi()}catch(e){return g(`auth login --key: ephemeral encryption key could not be created — ${S(e)}`)}let i=ui.safeParse({clientLabel:e.clientLabel?.trim()||(Kt().trim()||H).slice(0,120),clientPlatform:Zi(),encryptionAlgorithm:Hi,encryptionPublicKey:r.publicKey});if(!i.success)return g(`auth login --key: ${o(i.error)}`);let a;try{a=await Ti(i.data)}catch(e){return g(`auth login --key: could not start browser authorization — ${S(e)}`)}let s;try{s=Ye(a,n)}catch(e){return g(`auth login --key: unsafe browser authorization URL rejected — ${S(e)}`)}if(!Xi(await Ze(a,n,{noBrowser:e.noBrowser}),a,s))return g(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[s]});let c;try{c=await Yi(a)}catch(e){return g(`auth login --key: authorization did not complete — ${S(e)}`,[],{references:[s]})}if(c.algorithm!==Hi)return g(`auth login --key: broker selected an unsupported encryption algorithm`);let l;try{l=await pi(r.privateKey,c)}catch(e){return g(`auth login --key: encrypted credential could not be opened — ${S(e)}`)}let u=await Ni(l);if(u.state!==`verified`)return g(`auth login --key: decrypted credential was neither stored nor acknowledged — ${u.summary}`);let d;try{d=await Ke(t,{apiKey:u.apiKey,secret:l},`pending`)}catch(e){return g(`auth login --key: credential could not be durably stored — ${S(e)}`)}let f;try{f=await Ji(a)}catch(e){return U(d,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${S(e,[a.pollSecret])}`,Gi)}if(f.status!==`CONSUMED`)return U(d,!0,`auth login --key: broker returned ${f.status} after acknowledgment`,Gi);let p=await Ni(l);if(p.state!==`verified`||!ta(p.apiKey,d.credential.apiKey))return U(d,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${p.summary}`,Gi);try{let e=await Ke(t,{apiKey:p.apiKey,secret:l},`active`);return _(`API key stored; authenticated identity and broker acknowledgment verified.`,ea(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return U(d,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${S(e)}`,Gi)}}async function qi(e){let t=await Ni(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?_(`API key is already stored and its authenticated identity was verified.`,ea(e,!0),{ids:[e.credential.apiKey.id]}):U(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${H} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&ta(t.apiKey,e.credential.apiKey))try{let n=await Ke(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return _(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,ea(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return U(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${S(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${H} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return U(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${H} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await Bi(e);if(n.outcome===`unconfirmed`)return U(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await Xe(e.host)}catch(t){return U(e,!1,`auth login --key: stale pending credential could not be removed — ${S(t,[e.credential.secret])}`)}return M.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
15
15
  `:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
16
16
  `),null}async function Ji(e){let t=new Date(e.expiresAt).getTime(),n=Qi(e.intervalSeconds);for(;;)try{return await Di(e.id,e.pollSecret)}catch(e){if(e instanceof V){if(!e.retryable)throw e;n=Qi(e.retryAfterSeconds??n)}else if(!(e instanceof wi))throw e;if(Date.now()>=t)throw e;M.write(`Broker acknowledgment was interrupted; retrying.
17
17
  `),await $i(n,t)}}async function Yi(e){let t=new Date(e.expiresAt).getTime(),n=Qi(e.intervalSeconds),r;for(M.write(`Waiting for browser approval...
@@ -56,7 +56,7 @@ end
56
56
  (Did you mean `))return;let r=Ls(e),i=Rs(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=(Hs(o)?o:void 0)??Fs(e,n)??Is(e,n);if(s!==void 0)return Bs(e,s,r)??Js(e,s.join(` `),!1);let c=r.join(` `)||n,l=Vs(e)??Js(e,c),u=[...a,...r.slice(1)];return[l,r.length===a.length+a.length&&a.at(-1)===a.at(0)?Bs(e,u,r)?.replace(/^hint: Did you mean: /u,` `)+` · `:u.slice(1,-1).length>0?Bs(e,u,r):void 0].filter(e=>e!==void 0).join(`
57
57
  `)||void 0}function Zs(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=Es(e);for(let e of r)process.stderr.write(`error: unknown option '${e}'\n`);for(let n of[Ds(e)??(r.length>0?Ys(e):void 0),bs(e),ws(e,t),...Ws(e)])n!==void 0&&process.stderr.write(`${n}\n`)}else if(t.code===`commander.excessArguments`){let t=bs(e)??Gs(e);t!==void 0&&process.stderr.write(`${t}\n`)}else if(t.code===`commander.unknownOption`){let n=Cs(t,`unknown option`),r=Ds(e)??Ns(e,t)??(n!==void 0&&!t.message.includes(`
58
58
  (Did you mean `)?qs(e,n)??zs(e,[n.replace(/^--/u,``)],process.argv.slice(process.argv.indexOf(n)+1))??Ys(e,n)??Js(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=Xs(e,t);n!==void 0&&process.stderr.write(`${n}\n`)}process.exit(t.exitCode)}}var Qs=class extends e{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 $s(e){e.showHelpAfterError(!1).exitOverride(Zs(e)),e.commands.length===0?e.hook(`preAction`,ys):e.registeredArguments.length===0&&e.addHelpOption(new Qs(e));for(let t of e.commands)$s(t)}function ec(e,t=new Date){let n=rc(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 tc(e){return`${JSON.stringify(e,null,2)}\n`}function nc(e,t){let n=k(e),r=tc(t);return Nt(O(n),{recursive:!0}),Vt(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function rc(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:be(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 ic=`Match only the first canonical or CLI-alias command segment`,ac=[`text`,`lines`,`compact`,`json`,`ndjson`];function oc(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 ${kr(n)}\n`),sc(r,t,n),cc(r,t,n),lc(r,t,n),uc(r)}function sc(t,n,r){let i=t.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>`,ic).addOption(new e(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new e(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new e(`--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 e(`--format <format>`,`Text/file render format`).choices(ac)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(e){let t=this.optsWithGlobals(),i=T(t,`text`);Mr(jr(t,e),n,i,r)})}function cc(t,n,r){let i=t.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 e(`--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();Nr(e,n,T(e,`text`),r)})}function lc(t,n,r){let i=t.command(`dump`).summary(`Dump generated operations`).description(`Dump generated operations for rg/grep/ag/ack or JSON/NDJSON tooling.`).option(`--root <root>`,ic).addOption(new e(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new e(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new e(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`).addOption(new e(`--format <format>`,`Text/file render format`).choices(ac)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(){let e=this.optsWithGlobals();Mr(e,n,T(e,`text`),r)})}function uc(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-BwXUVyVD.js`);if(t===`text`&&e.output===void 0&&(e.text===!0||e.allFields===!0)){L({mode:t},_(`Unified operations JSON`,`Use --output <path> to write the unified operations JSON.`,{counts:{totalOperations:n.length}}));return}let r=ec(n);if(e.output!==void 0){let n=nc(e.output,r);L({mode:t},_(`Unified operations JSON written`,{outputPath:n.target,byteLength:n.byteLength,schemaVersion:r.schemaVersion},{counts:{totalOperations:n.totalOperations}}));return}if(t===`text`){Fr(`Unified operations JSON`,tc(r));return}L({mode:t},_(`Unified operations JSON`,r,{counts:{totalOperations:r.totalOperations}}))})}var dc=b(Jt(import.meta.url)),Q=dc.bin[0];function fc(e,t){i({component:Q,event:`fatal`,message:e.message,error:e}),process.stderr.write(`${Q} fatal (${t}): ${e.stack??e.message}\n`);let n=e instanceof h?{httpStatus:e.problem.status,problem:e.problem}:{};sr({...g(`${Q} ${t}: ${e.message}`,[e.name||`Error`],n),counts:{exitCode:1}}),process.exit(1)}function pc(e){return Ue[ze(e,gt)??`cli`]}function mc(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:pc(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>wt(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)hc(e,t,r,a,i.has(t.cliPath.join(` `)))}function hc(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=gc(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=>ye(e.schemaType,e.itemSchemaType))?xe:``].filter(Boolean).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 ${kr(n)}\n`),sc(r,t,n),cc(r,t,n),lc(r,t,n),uc(r)}function sc(t,n,r){let i=t.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>`,ic).addOption(new e(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new e(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new e(`--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 e(`--format <format>`,`Text/file render format`).choices(ac)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(e){let t=this.optsWithGlobals(),i=T(t,`text`);Mr(jr(t,e),n,i,r)})}function cc(t,n,r){let i=t.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 e(`--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();Nr(e,n,T(e,`text`),r)})}function lc(t,n,r){let i=t.command(`dump`).summary(`Dump generated operations`).description(`Dump generated operations for rg/grep/ag/ack or JSON/NDJSON tooling.`).option(`--root <root>`,ic).addOption(new e(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new e(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new e(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new e(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`).addOption(new e(`--format <format>`,`Text/file render format`).choices(ac)).option(`--output <path>`,`Write rendered output to a file`);E(i),i.action(function(){let e=this.optsWithGlobals();Mr(e,n,T(e,`text`),r)})}function uc(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-C9hxM3KU.js`);if(t===`text`&&e.output===void 0&&(e.text===!0||e.allFields===!0)){L({mode:t},_(`Unified operations JSON`,`Use --output <path> to write the unified operations JSON.`,{counts:{totalOperations:n.length}}));return}let r=ec(n);if(e.output!==void 0){let n=nc(e.output,r);L({mode:t},_(`Unified operations JSON written`,{outputPath:n.target,byteLength:n.byteLength,schemaVersion:r.schemaVersion},{counts:{totalOperations:n.totalOperations}}));return}if(t===`text`){Fr(`Unified operations JSON`,tc(r));return}L({mode:t},_(`Unified operations JSON`,r,{counts:{totalOperations:r.totalOperations}}))})}var dc=b(Jt(import.meta.url)),Q=dc.bin[0];function fc(e,t){i({component:Q,event:`fatal`,message:e.message,error:e}),process.stderr.write(`${Q} fatal (${t}): ${e.stack??e.message}\n`);let n=e instanceof h?{httpStatus:e.problem.status,problem:e.problem}:{};sr({...g(`${Q} ${t}: ${e.message}`,[e.name||`Error`],n),counts:{exitCode:1}}),process.exit(1)}function pc(e){return Ue[ze(e,gt)??`cli`]}function mc(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:pc(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>wt(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)hc(e,t,r,a,i.has(t.cliPath.join(` `)))}function hc(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=gc(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=>ye(e.schemaType,e.itemSchemaType))?xe:``].filter(Boolean).join(`
60
60
  `));let f=Tt(t);for(let e of t.parameters)_c(u,e,i||e===f);if(Bn(u,t),_e(t.intent)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),E(u),u.hook(`preAction`,e=>bt(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 ${Ct(f.flag)}.`),u.action(async function(e){let n=this.optsWithGlobals(),r=T(n),i=vt(f,e,n);if(!i.ok||i.data===null)return L({mode:r},i);let a=_t(t,i.data);if(a.length>0)return L({mode:r},g(`missing required options: ${a.join(`, `)}`));let o=await vc(t,i.data,r),s=ri(t,i.data,o);if(s!==null)return L({mode:r},s);n.explain===!0&&o.ok&&dr(r,o.data),o.ok&&o.data instanceof Uint8Array?process.stdout.write(o.data):L({mode:r},o)});return}u.action(async function(){let e=this.optsWithGlobals(),n=T(e),r=_t(t,e);if(r.length>0)return L({mode:n},g(`missing required options: ${r.join(`, `)}`));let i=await vc(t,e,n),a=ri(t,e,i);if(a!==null)return L({mode:n},a);e.explain===!0&&i.ok&&dr(n,i.data),i.ok&&i.data instanceof Uint8Array?process.stdout.write(i.data):L({mode:n},i)})}function gc(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=gt[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function _c(t,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 e(n.flag,i);a!==void 0&&o.default(a);let s=new e(n.legacyFlag,i).conflicts(n.optionKey);t.addOption(o).addOption(s),t.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){t.option(n.flag,i,a);return}if(n.required&&!r){t.requiredOption(n.flag,i);return}t.option(n.flag,i)}async function vc(e,t,n){if(t.environment!==void 0){let e=ue(t.environment);if(e===null)return g(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${ce().join(`, `)}`]);process.env.API_ENV=e}let r=await Gn(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 ai(e,await p({method:e.method,path:m(e.operationId,i),searchParams:a,headers:o,body:r.data,contentType:St(e,t),auth:e.auth,responseFormat:Dt(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0}))}process.on(`uncaughtException`,e=>fc(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>fc(e instanceof Error?e:Error(String(e)),`unhandledRejection`));var yc=xt(process.argv.slice(2),w),bc=yc===`required`?w:yt(w),$=new r;$.name(Q).usage(`<command> [subcommand] [options]`).configureHelp(Jr).version(dc.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-XDNFtgnS.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return d[e]??t?.[e]?.section}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
1
+ import{l as e}from"./tool-policy-Cg0XvZMq.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return d[e]??t?.[e]?.section}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
@@ -1,4 +1,4 @@
1
- import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,t as c,u as l,v as u,w as d,y as f}from"./person-owner-BJgNYLKX.js";import{r as p,s as m,t as h,u as g}from"./result-envelope-DTzTOcab.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-XDNFtgnS.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 b,h as fe,i as pe,l as me,m as he,n as ge,o as _e,p as ve,r as ye,s as be,t as x,u as xe,v as Se,w as Ce,x as we,y as Te}from"./detail-BAUbCLgG.js";import{a as Ee,n as S,r as C,t as De}from"./text-field-r9akQrZl.js";import{a as Oe,o as ke}from"./cli-help-policy-DeeUkwZr.js";import{Buffer as Ae}from"node:buffer";var w=o([`HIGH`,`MEDIUM`,`LOW`]),je=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),d()]),Me=f({excerpt:d(),sourceId:d(),sourceType:je,sourceVersion:d().nullish()}),Ne=f({instruction:d(),operationId:d(),stepKey:d()}),Pe=f({body:d(),expectation:d(),method:i(d()),override:d(),reject:i(d()),typeCatalog:d()}),Fe=f({cliCommand:d(),mcpTool:d().nullish(),step:Ne,writeGuidance:Pe.nullish()}),Ie=n([o([`ENTITY`,`TEXT`]),d()]),Le=f({description:d(),key:d(),type:Ie}),Re=f({catalogRevision:s(),gateId:i(d()),input:i(Le),step:i(Fe),taskKey:d()}),T=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),ze=f({candidate:i(Me),operationId:d().nullish(),outcome:T,probability:u().nullish(),taskKey:d().nullish(),taskPlan:Re.nullish()}),Be=f({answer:d(),citation:i(Me),confidence:w,resolution:ze.nullish()});function E(e,t,n=t.inputName){if(t.in===`body`)return n;let r=Ze.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?Xe(D(n!==`id`&&n!==`slug`?n:`${We(e.path)}${qe(n)}`),t):r.inputName}function Ve(e,t,n=Ke(e)){return He(Ge(e,t),new Set(n))}function He(e,t){if(!t.has(e))return e;let n=`body${qe(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function Ue(e,t,n){return`${e}[${t}].${n}`}function We(e){return Qe.find(([,t])=>t.test(e))?.[0]??`record`}function Ge(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Je(t);return Xe(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?D(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function Ke(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>E(e,t)))}function qe(e){return e.replace(/^./u,e=>e.toUpperCase())}function D(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function Je(e){let t=D(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Ye(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Ye(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function Xe(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var Ze=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],Qe=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function $e(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>et(t,E(e,t))),r=(t?.parameter??[]).map(t=>et(t,Ve(e,t)));return{selector:n.filter(e=>e.location===`path`||tt(e)),pagination:n.filter(nt),filter:[...n.filter(O),...r.filter(O)],body:r.filter(e=>!O(e))}}function et(e,t){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 tt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function nt(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function O(e){return e.location!==`path`&&!tt(e)&&!nt(e)}function rt(e,t){let n=e.requestBody?.[0],r={operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:it(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:$e(e)}:{...r,optionalInput:at(e)}}function it(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function at(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}var ot=160;function st(e){return!Array.isArray(e)||e.length===0||!e.every(ct)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${[e.location,e.required?`required`: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<=ot?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
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{r as p,s as m,t as h,u as g}from"./result-envelope-DTzTOcab.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-Cg0XvZMq.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 b,h as fe,i as pe,l as me,m as he,n as ge,o as _e,p as ve,r as ye,s as be,t as x,u as xe,v as Se,w as Ce,x as we,y as Te}from"./detail-BAUbCLgG.js";import{a as Ee,n as S,r as C,t as De}from"./text-field-r9akQrZl.js";import{a as Oe,o as ke}from"./cli-help-policy-BbLTU6HE.js";import{Buffer as Ae}from"node:buffer";var w=o([`HIGH`,`MEDIUM`,`LOW`]),je=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),d()]),Me=f({excerpt:d(),sourceId:d(),sourceType:je,sourceVersion:d().nullish()}),Ne=f({instruction:d(),operationId:d(),stepKey:d()}),Pe=f({body:d(),expectation:d(),method:i(d()),override:d(),reject:i(d()),typeCatalog:d()}),Fe=f({cliCommand:d(),mcpTool:d().nullish(),step:Ne,writeGuidance:Pe.nullish()}),Ie=n([o([`ENTITY`,`TEXT`]),d()]),Le=f({description:d(),key:d(),type:Ie}),Re=f({catalogRevision:s(),gateId:i(d()),input:i(Le),step:i(Fe),taskKey:d()}),T=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),ze=f({candidate:i(Me),operationId:d().nullish(),outcome:T,probability:u().nullish(),taskKey:d().nullish(),taskPlan:Re.nullish()}),Be=f({answer:d(),citation:i(Me),confidence:w,resolution:ze.nullish()});function E(e,t,n=t.inputName){if(t.in===`body`)return n;let r=Ze.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?Xe(D(n!==`id`&&n!==`slug`?n:`${We(e.path)}${qe(n)}`),t):r.inputName}function Ve(e,t,n=Ke(e)){return He(Ge(e,t),new Set(n))}function He(e,t){if(!t.has(e))return e;let n=`body${qe(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function Ue(e,t,n){return`${e}[${t}].${n}`}function We(e){return Qe.find(([,t])=>t.test(e))?.[0]??`record`}function Ge(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Je(t);return Xe(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?D(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function Ke(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>E(e,t)))}function qe(e){return e.replace(/^./u,e=>e.toUpperCase())}function D(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function Je(e){let t=D(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Ye(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Ye(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function Xe(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var Ze=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],Qe=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function $e(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>et(t,E(e,t))),r=(t?.parameter??[]).map(t=>et(t,Ve(e,t)));return{selector:n.filter(e=>e.location===`path`||tt(e)),pagination:n.filter(nt),filter:[...n.filter(O),...r.filter(O)],body:r.filter(e=>!O(e))}}function et(e,t){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 tt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function nt(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function O(e){return e.location!==`path`&&!tt(e)&&!nt(e)}function rt(e,t){let n=e.requestBody?.[0],r={operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:it(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:$e(e)}:{...r,optionalInput:at(e)}}function it(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function at(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}var ot=160;function st(e){return!Array.isArray(e)||e.length===0||!e.every(ct)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${[e.location,e.required?`required`: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<=ot?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
2
2
  `)}\n`}function ct(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function lt(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(ut);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.split(/[.[]/u)[0]))];return{tool: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 ut(e){return[e.name,`<${e.name}>`]}function dt(e){let t=k(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function k(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var A=2,ft=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function j(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&j(e,`person`),ht(e,pt(n),n),ht(e,mt(n),n))}function pt(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=A&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>A&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function mt(e){return e===`person`?`people`:e.length>=A&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function ht(e,t,n){t!==void 0&&t!==n&&t.length>=A&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)j(t,e);return t}function gt(e){return N(e).map(M)}function _t(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!ft.has(e))}function P(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}var vt=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,yt=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,bt=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,xt=250,St=40,Ct=100;function wt(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(yt,()=>(n.add(`uuid`),` `)).replace(vt,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&bt.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=bt.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function Tt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function Et(e,t){let n=new Set;for(let r of e){let e=new Set;j(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function Dt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Tt(t,e,n.path))&&(i+=xt,r.has(t)&&(i+=St));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return j(t,e),[...t].some(e=>a.has(e))}))&&(i+=Ct),i}var Ot=5,kt=.5,At=15,jt=30,Mt=2;function Nt(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=wt(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=Et(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=gt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Lt(o,s,c,t))+Dt(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function Pt(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function Ft(e,t){let n=Nt(e.q?.trim()??``,t.filter(t=>It(e,t)),Pt),r=(n[0]?.score??0)*kt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Ot:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>rt(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function It(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function Lt(e,t,n,r){let i=Bt(r),a=Rt(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=zt(e,i);let s=new Set(i.flatMap(N));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;j(n,e),[...n].some(e=>t.has(e))&&(o+=At)}_t(n,a)&&(o+=200),r.parameterName.some(t=>P(t)===e)&&(o+=jt);let c=new Set(r.parameterDescription.flatMap(N));for(let e of t)c.has(e)&&(o+=Mt);return o+=Ht(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Vt(e,t,r.description),o}function Rt(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function zt(e,t){let n=N(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Bt(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,k(e.description).useFor||e.description].map(P).filter(e=>e.length>0))]}function Vt(e,t,n){let r=P(k(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ht(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Ut(e,t))&&(n+=i?40:10);return n}function Ut(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}function Wt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Gt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return p(`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 p(`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=Be.safeParse(Wt(o));if(!s.success||s.data.resolution==null)return p(`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,h=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),g=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...h.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return m(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}`,...dt(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:lt(d)}},...l.taskKey==null?{}:{taskKey:l.taskKey},...f===void 0?{}:{taskPlan:{catalogRevision:f.catalogRevision,input:f.input,...f.gateId.length===0?{}:{gateId:f.gateId},step:h.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:lt(e)})}}},{warnings: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 Kt=f({detail:d(),field:d().nullish(),scope:o([`entity`,`person`,`news`])}),qt=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),d()]),F=f({modeRequested:qt,modeUsed:qt}),Jt=f({answerUnavailable:l(),entity:F,news:F,person:F,rejection:i(Kt),unavailable:i(o([`entity`,`person`,`news`]))}),Yt=f({acceleratorParticipation:i(ve),detail:i(ue)}),I=f({core:y,enrichment:we,fundraiseRound:i(b),research:Yt,semanticMatch:ce.nullish()}),Xt=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),Zt=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:Xt,rank:s(),sharedSectionCount:s().nullish()}),Qt=f({entity:I,similarity:Zt}),$t=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),en=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:$t,updatedAt:r({offset:!0}),url:d()}),tn=o([`low`,`medium`,`high`]),nn=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:tn.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}),rn=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:nn,id:d()}),an=f({fundraiseInvestorJoin:l(),fundraiseTransaction:l(),operatingStatus:l(),relationship:l()}),on=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),sn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),cn=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:Te.nullish(),evidence:an,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),isCurrent:l().nullish(),publicSource:fe.nullish(),relationshipId:s(),status:on,transactionStatus:sn.nullish(),updatedAt:r({offset:!0}).nullish()}),ln=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),un=f({amountInvested:u().nullish(),createdAt:r({offset:!0}),financialInstrumentType:ln.nullish(),id:t(),investor:c,leadInvestor:l(),transactionId:t(),updatedAt:r({offset:!0})}),dn=f({entity:x,investorAttribution:i(se),round:i(Se),roundCount:s()}),fn=f({core:y,similarity:Zt,urlLink:i(ae)}),pn=f({compliance:xe.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()}),mn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),hn=o([`fundraiseRound`,`researchDetail`]),gn=o([`preMoney`,`postMoney`,`reported`]),_n=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:tn,currency:d(),declaredBasis:gn,derivation:mn,detailId:s().nullish(),label:d().nullish(),source:hn,sourceRef:d(),valuationPostMoney:u().int().nullish(),valuationPreMoney:u().int().nullish()}),vn=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()}),L=f({empty:l().optional(),sorted:l().optional(),unsorted:l().optional()}),R=f({offset:u().int().optional(),paged:l().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:L.optional(),unpaged:l().optional()}),yn=f({investorAttribution:i(se),person:ye,round:i(Se),roundCount:s()}),bn=o([`precomputed`,`live`]),xn=f({compositeScore:u().nullish(),cosineScore:u().nullish(),matchedSectionWeight:u().nullish(),origin:bn,rank:s(),sharedSectionCount:s().nullish()}),Sn=f({currentRole:be.nullish(),person:pe,similarity:xn}),Cn=o([`by`,`about`]),wn=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),Tn=f({canonicalUrl:d().nullish(),contentId:d(),contentType:wn,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:Cn.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(en).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(n([oe,Ce])).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(rn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(x).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(un).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(b).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(dn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(I).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Qt).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(pn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(vn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(pe).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(ye).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(_e).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(yn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.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:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()}),f({content:i(Tn).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var En=f({content:i(I),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),Dn=f({content:i(le),number:s(),size:s(),totalElements:u().int(),totalPages:s()}),On=f({content:i(pe),number:s(),size:s(),totalElements:u().int(),totalPages:s()});f({content:i(ge).optional(),empty:l().optional(),first:l().optional(),last:l().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:R.optional(),size:s().optional(),sort:L.optional(),totalElements:u().int().optional(),totalPages:s().optional()});var kn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),d()]),An=f({entityId:t(),source:kn,sourceId:d()}),jn=f({citation:i(An),text:d(),topic:d().nullish()}),Mn=f({citation:i(An),confidence:w,description:d().nullish(),heading:d().nullish(),paragraph:i(jn),relatedQuery:i(d()),shareable:l(),text:d(),title:d().nullish()}),Nn=f({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Pn=f({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),z=f({max:u().nullish(),min:u().nullish()}),B=f({max:s().nullish(),min:s().nullish()}),Fn=f({averageAmountInvestedUsdRange:i(z).optional(),largestAmountInvestedUsdRange:i(z).optional(),smallestAmountInvestedUsdRange:i(z).optional(),totalAmountInvestedUsdRange:i(z).optional(),totalInvestmentRange:i(B).optional()}),In=f({amountInvestedRange:i(z).optional(),amountRaisedRange:i(z).optional(),dateAnnouncedRange:Pn.nullish(),investedCompanyName:i(d()).optional(),investedCountry:i(d()).optional(),investedIndustry:i(d()).optional(),investedRound:i(d()).optional(),investorActivity:Fn.optional(),investorName:i(d()).optional(),lastRoundYearRange:i(B).optional(),rankByInvestmentActivity:l().nullish(),round:i(d()).optional(),totalRaisedRange:i(z).optional(),valuationRange:i(z).optional()}),Ln=o([`NONE`,`COMPANY_LISTING_READY`]),Rn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),zn=o([`hostPath`,`domain`]),Bn=e({acceleratorBrand:i(d()).optional(),acceleratorCohort:i(d()).optional(),acceleratorName:i(d()).optional(),acceleratorStatus:i(d()).optional(),affinity:i(d()).optional(),closedLast:l().optional(),employeeCountRange:i(B).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:In.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:Nn.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Ln.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:zn.nullish(),urlType:ie.nullish(),yearFoundedRange:i(B).optional()}),Vn=o([`discovery`,`profile`,`peer`,`comparison`]),Hn=o([`keyword`,`semantic`]),Un=n([o([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),d()]),Wn=f({descending:l(),field:Un,sortKey:d().nullish()}),Gn=f({order:i(Wn),relevance:Hn.nullish()}),Kn=f({confidence:w,execution:F,fallbackUsed:l(),filter:Bn,intent:Vn,interpretation:d(),sort:Gn,subjectEntityName:i(d()),unsupported:d().nullish()}),qn=f({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:d().nullish(),status:d().nullish()}),Jn=f({fundManagerRelationshipSource:qn.nullish(),fundraiseTransaction:b,fundraiseTransactionSource:qn.nullish(),investorJoinSource:qn.nullish()}),Yn=f({evidence:Jn,investor:c,semanticMatch:ce.nullish()}),Xn=f({entityId:t(),matchedOffering:y.nullish(),probability:u(),webUrl:i(d())}),Zn=f({entityId:t(),label:d(),publishedAt:r({offset:!0}).nullish(),score:u(),source:kn,sourceId:d(),text:d(),url:d().nullish()}),Qn=f({answer:Mn.nullish(),interpretation:Kn,investment:i(Yn),judgment:i(Xn),passage:i(Zn),peer:i(Qt),pendingWebQuery:i(d()),result:En,searchRequestId:t().nullish(),subject:i(I)}),$n=o([`auto-match`,`needs-review`,`approved`,`rejected`]),er=f({createdAt:r({offset:!0}),entityId:t(),href:d().nullish(),internal:l(),matchStatus:$n.nullish(),mention:d().nullish(),slug:d().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),tr=f({entity:i(er),newsId:s()}),nr=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(B).optional(),entityId:i(t()).optional(),entityName:i(d()).optional(),featured:l().nullish(),fundraiseActivity:In.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:Nn.optional(),mainProduct:i(d()).optional(),operatingStatus:i(Rn).optional(),originCountry:i(d()).optional(),person:i(d()).optional(),portfolioHeadquartersCity:i(d()).optional(),portfolioHeadquartersCountry:i(d()).optional(),portfolioHeadquartersState:i(d()).optional(),qualityGate:Ln.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:zn.nullish(),urlType:ie.nullish(),yearFoundedRange:i(B).optional()}),rr=f({amountInvestedRange:i(z).nullish(),amountRaisedRange:i(z).nullish(),entityName:i(d()).nullish(),investedCompany:i(d()).nullish(),personTitle:i(d()).nullish(),round:i(d()).nullish(),totalInvestmentCount:i(B).nullish(),typeRecord:i(a).nullish()}),ir=f({arrayFilter:rr.optional(),entityFilter:nr.optional(),entityId:t().nullish(),entitySlug:d().nullish(),firstName:d().nullish(),includeAddress:l().nullish(),includeUrl:l().nullish(),investorActivity:Fn.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()}),ar=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()}),or=f({order:i(ar),relevance:Hn.nullish()}),sr=f({confidence:w,execution:F,fallbackUsed:l(),filter:ir,interpretation:d(),sort:or,unsupported:d().nullish()}),cr=f({interpretation:sr,investment:i(Yn),result:On,searchRequestId:t().nullish()}),lr=f({label:d(),query:d()}),ur=f({key:d(),option:i(lr),prompt:d()}),dr=f({entity:Qn,entityDetail:i(x),news:Dn,newsEntityMention:i(tr),person:cr,personDetail:i(ye),provenance:Jt,qualifier:ur.nullish()});function fr(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>pr(e)),...n.flatMap(e=>e.parameter.map(t=>pr(t,n.length>1?e.contentType:void 0))),...mr(n)],i=[t,...e.cliPath].join(` `),a=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,successResponse:e.successResponse,summary:e.summary,description:e.description,deprecated:e.deprecated}})}function pr(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function mr(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function hr(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var gr=[`-id`,`-slug`,`-url`],_r=[`--id`,`--slug`,`--url`],vr=`/v1/lookup`,yr=`--from-file "<path>"`;function br(e,t,n=_().bin[0]){let r=fr(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:wr(i,r)}function xr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:fr([r],n);return i&&Cr(i,Dr(i,!1))}function Sr(e,t,n,r=_().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return xr(o.operationId,t,r)}function Cr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function wr(e,t){return[`example: ${Cr(e,Dr(e))}`,...Tr(e,t)]}function Tr(e,t){return hr(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${kr(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===vr),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${kr(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Er=/(?:^|\.)text$/u;function Dr(e,t=!0){let n=hr(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Er.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:Or(e)).map(kr);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,yr]:i}function Or(e){let t=new Set;j(t,e.resource);for(let n of gr)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of _r){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function kr(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Ar=`aventure`;function jr(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Ar} ${n.join(` `)}`}function Mr(e,t,n=e){return xr(e,t,`aventure`)??n}function Nr(e,t){let n=Be.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return Pr(r,o,t);let s=r.trimEnd().split(`
3
3
  `),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==je.options[0].enum.OPERATION)return[];let r=jr(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function Pr(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Ir(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case T.enum.TASK_PLAN:return[...l,...c==null?[]:Lr(c,n),...u];case T.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Mr(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case T.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...zr(`Candidates:`,o,n),...u];case T.enum.ABSTAIN:return[...l,...zr(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Fr(e,t){let n=Re.safeParse(e);return n.success?[Ir(n.data),...Lr(n.data,t)]:null}var Ir=({taskKey:e,catalogRevision:t})=>`Run catalog task ${e} (catalog revision ${t}).`;function Lr(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey}: ${Mr(n.operationId,t,r)}`,` ${n.instruction}`,...Rr(e,a,i)]),...e.gateId.length===0?[]:[``,`Completion gates: ${e.gateId.join(`, `)}`]]}function Rr(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function zr(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:jr(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var V=120,H=30,Br=8,U=10,Vr=2,Hr=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Ur=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Wr=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function Gr(e,t,n){if(typeof t==`string`)return Z(t);let r=st(t);if(r!==null)return Z(r);let i=ni(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=Ee(a?.detailField,i.response),c={...i,response:o},l=Nr(c.response,e)??Fr(c.response,e);if(l!==null)return Z(l.join(`
4
4
  `),!0);let u=Kr(c.endpoint,c.response);if(u!==null)return Z([...u,...s].join(`