@aventurevc/aventure-cli 0.8.508 → 0.8.509

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.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{enableCompileCache as e}from"node:module";import{fileURLToPath as t}from"node:url";e();var{Command:n,CommanderError:r}=await import(`../chunks/commander-D8IVfzyC.js`),{readRuntimePackage:i}=await import(`../chunks/package-DcUsOdSE.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-BXcpCMqz.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-BVLEQs5M.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-D7u2wpH_.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-CSrJz2OG.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-C347qf0b.js`),{withRenamedCommandAliases:c}=await import(`../chunks/deprecated-command-BBCr1BHb.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let l=r(o,c(s));if(l===`stored`||l===`optional`)try{await a(l)}catch(t){e({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-CzF0wnSt.js`)}}catch(e){if(!(e instanceof r))throw e;e.code!==`commander.version`&&process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
2
+ import{enableCompileCache as e}from"node:module";import{fileURLToPath as t}from"node:url";e();var{Command:n,CommanderError:r}=await import(`../chunks/commander-D8IVfzyC.js`),{readRuntimePackage:i}=await import(`../chunks/package-DcUsOdSE.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-BXcpCMqz.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-BVLEQs5M.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-D7u2wpH_.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-CSrJz2OG.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-C347qf0b.js`),{withRenamedCommandAliases:c}=await import(`../chunks/deprecated-command-BBCr1BHb.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let l=r(o,c(s));if(l===`stored`||l===`optional`)try{await a(l)}catch(t){e({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-cvGYyj7-.js`)}}catch(e){if(!(e instanceof r))throw e;e.code!==`commander.version`&&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-11-26T05:40:11.444Z",
4
+ "generatedAt": "2026-11-26T10:20:06.364Z",
5
5
  "totalOperations": 138,
6
6
  "note": "1:1 projection of MCP_GENERATION_CONTRACT written by the CLI build ([MCP1b.1-EXC1]).",
7
7
  "operations": [
@@ -1 +1 @@
1
- import{a as e}from"./package-DEeHDoOT.js";import{t}from"./credential-redaction-DOhPUDmS.js";import{n,t as r}from"./openapi-commands-BEyhfc6I.js";var i=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers GET /info`},{name:`auth`,purpose:`a credential materialized for the next command, never its secret`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function a(e,t,n){return{name:e,status:t,message:n}}async function o(e){let t=l(),n=await u(e),[r,i]=await Promise.all([d(e),t===void 0?null:f(t)]);return{cliVersion:n.check,apiSchemas:r,catalog:m(i,n.upgradeAvailable,e)}}function s(e,t,n){return e.ok?a(`api-host`,`pass`,`GET /info answered at ${t}.`):a(`api-host`,`fail`,e.httpStatus===401?`Replace or unset the credential ${t} rejected, or run \`${n} auth login\`, then rerun \`${n} auth status\` — GET /info returned ${e.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${n} auth status\` — GET /info at ${t} returned ${e.summary}.`)}function c(e,t,n){let r=[e.cliVersion,e.apiSchemas,t,n,e.catalog];return{ok:r.every(e=>e.status!==`fail`),check:r}}function l(){return r.find(e=>e.intent===`status`&&e.resource===`status`)}async function u(t){let{runUpdate:n}=await import(`./builtin-update-54vcZ4g_.js`),r=e(),i=n(r,`check`);if(!i.ok||i.data===null)return{check:a(`cli-version`,`skip`,`Could not compare ${r.version} against the registry (${i.summary}); rerun \`${t} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:o,currentVersion:s,latestVersion:c,upgradeAvailable:l}=i.data;return{check:l?a(`cli-version`,`fail`,`Upgrade ${o} from ${s} to ${c}: run \`${t} update\`.`):a(`cli-version`,`pass`,`${o} ${s} matches the latest published release.`),upgradeAvailable:l}}async function d(e){try{let{EntityDetailSchema:e}=await import(`./detail-DrwXI5of.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return a(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(n){return a(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${t(n)}.`)}}async function f(e){let{runOpenApiCall:n}=await import(`./openapi-call-DZE6bLbj.js`),r=`${e.method} ${e.path}`;try{let t=await n({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`});if(!t.ok)return{unread:`${r} returned ${t.summary}`};let i=p(t.data);return i===null?{unread:`${r} carried no operationFingerprint`}:{fingerprint:i}}catch(e){return{unread:`${r} failed: ${t(e)}`}}}function p(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}function m(e,t,i){let o=r.length;if(e===null)return a(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${o} operations.`);if(`unread`in e)return a(`catalog`,`skip`,`Could not read the served operation fingerprint (${e.unread}), so drift is unproven; this catalog holds ${o} operations at ${n}.`);let s=e.fingerprint;if(s===`7765970ce7ba75b3`)return a(`catalog`,`pass`,`${o} generated operations match the set the API serves (${n}).`);let c=`This catalog describes a different operation set than the API serves (${n} vs ${s})`;return t===!0?a(`catalog`,`fail`,`${c}: run \`${i} update\`.`):a(`catalog`,`skip`,t===!1?`${c}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${c}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${i} update\` with registry access.`)}export{o as a,a as i,s as n,c as r,i as t};
1
+ import{a as e}from"./package-DEeHDoOT.js";import{t}from"./credential-redaction-DOhPUDmS.js";import{n,t as r}from"./openapi-commands-BEyhfc6I.js";var i=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers GET /info`},{name:`auth`,purpose:`a credential materialized for the next command, never its secret`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function a(e,t,n){return{name:e,status:t,message:n}}async function o(e){let t=l(),n=await u(e),[r,i]=await Promise.all([d(e),t===void 0?null:f(t)]);return{cliVersion:n.check,apiSchemas:r,catalog:m(i,n.upgradeAvailable,e)}}function s(e,t,n){return e.ok?a(`api-host`,`pass`,`GET /info answered at ${t}.`):a(`api-host`,`fail`,e.httpStatus===401?`Replace or unset the credential ${t} rejected, or run \`${n} auth login\`, then rerun \`${n} auth status\` — GET /info returned ${e.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${n} auth status\` — GET /info at ${t} returned ${e.summary}.`)}function c(e,t,n){let r=[e.cliVersion,e.apiSchemas,t,n,e.catalog];return{ok:r.every(e=>e.status!==`fail`),check:r}}function l(){return r.find(e=>e.intent===`status`&&e.resource===`status`)}async function u(t){let{runUpdate:n}=await import(`./builtin-update-DmyUY7cK.js`),r=e(),i=n(r,`check`);if(!i.ok||i.data===null)return{check:a(`cli-version`,`skip`,`Could not compare ${r.version} against the registry (${i.summary}); rerun \`${t} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:o,currentVersion:s,latestVersion:c,upgradeAvailable:l}=i.data;return{check:l?a(`cli-version`,`fail`,`Upgrade ${o} from ${s} to ${c}: run \`${t} update\`.`):a(`cli-version`,`pass`,`${o} ${s} matches the latest published release.`),upgradeAvailable:l}}async function d(e){try{let{EntityDetailSchema:e}=await import(`./detail-DrwXI5of.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return a(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(n){return a(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${t(n)}.`)}}async function f(e){let{runOpenApiCall:n}=await import(`./openapi-call-DZE6bLbj.js`),r=`${e.method} ${e.path}`;try{let t=await n({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`});if(!t.ok)return{unread:`${r} returned ${t.summary}`};let i=p(t.data);return i===null?{unread:`${r} carried no operationFingerprint`}:{fingerprint:i}}catch(e){return{unread:`${r} failed: ${t(e)}`}}}function p(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}function m(e,t,i){let o=r.length;if(e===null)return a(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${o} operations.`);if(`unread`in e)return a(`catalog`,`skip`,`Could not read the served operation fingerprint (${e.unread}), so drift is unproven; this catalog holds ${o} operations at ${n}.`);let s=e.fingerprint;if(s===`7765970ce7ba75b3`)return a(`catalog`,`pass`,`${o} generated operations match the set the API serves (${n}).`);let c=`This catalog describes a different operation set than the API serves (${n} vs ${s})`;return t===!0?a(`catalog`,`fail`,`${c}: run \`${i} update\`.`):a(`catalog`,`skip`,t===!1?`${c}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${c}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${i} update\` with registry access.`)}export{o as a,a as i,s as n,c as r,i as t};
@@ -1 +1 @@
1
- export{n as apiHostCheck,r as authStatusReport,i as checkResult,a as environmentChecks}from"./auth-status-check-BCXBeKK9.js";
1
+ export{n as apiHostCheck,r as authStatusReport,i as checkResult,a as environmentChecks}from"./auth-status-check-Csx3C7Sh.js";
@@ -1,11 +1,11 @@
1
- import{a as e,n as t,r as n,t as r}from"./commander-DEj7N1b9.js";import{a as i}from"./package-DEeHDoOT.js";import{l as a,o,r as s}from"./env-CMJ0DtbB.js";import{c,r as l}from"./result-envelope-DhuT_8lW.js";import{B as u,o as d,t as f,u as p,z as m}from"./tool-policy-DYjF2wFZ.js";import{i as h}from"./logging-DqesyM4A.js";import{h as g}from"./help-catalog-ByQFO96d.js";import{r as _,t as v}from"./cli-help-policy-BCuXaWdv.js";import{a as ee,i as te,n as y,o as b,r as ne,t as x}from"./generated-dispatch-C79846kK.js";import{a as S,c as C,i as w,n as T,r as E,s as re,t as ie}from"./startup-auth-B0hdVmRP.js";import{t as D}from"./openapi-commands-BEyhfc6I.js";import{n as ae,t as oe}from"./operations-metadata-DnrouEku.js";import{a as O,i as se,t as k}from"./output-mode-CE87SvLV.js";import{n as ce,t as le}from"./deprecated-command-bF9Q8_F6.js";import{a as ue,i as de,n as A,r as j}from"./payload-operand-guard-C8eAl3-g.js";import{n as M,t as N}from"./generated-body-BaGjgMKp.js";import{fileURLToPath as P}from"node:url";function F(e,t,n=i().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, search the catalog, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help catalog [query...]` searches or lists every operation;\n`help ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new I(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()}),k(r),r.action(async function(r){let i=r.flatMap(e=>e.split(/\s+/u).filter(Boolean)),{emit:a}=await import(`./output-Buc7lmVl.js`),o=this.optsWithGlobals();if(o.help&&i.length===0){this.outputHelp();return}let s=W(e,i),l=t.find(t=>s!==void 0&&W(e,t.cliPath)===s);if(o.help||s!==void 0&&l===void 0){s===void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let u=l===void 0?await fe(i,t):c(`Resolved by command path`,{operationId:l.operationId});if(u.ok&&u.data?.command!==void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),!u.ok||u.data===null){a({mode:O(o)},u);return}let{writeShowResult:d}=await import(`./operations-catalog-BGDigZkI.js`);d({...o,...u.data},t,O(o,`text`),n)}),V(e,t,n)}var I=class extends t{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))}},L=2,R=6,z={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=>C[e.name()]?.listed!==!1):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(L)}${e}\n${B(r,a,i)}`}};function B(e,t,n){return n.boxWrap(e,t-R).replace(/^/gmu,` `.repeat(R))}function V(e,t,n){for(let r of t){let i=W(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp(),a=i.configureOutput().getOutHelpWidth?.();e.prepareContext(a===void 0?{}:{helpWidth:a});let o=e.helpWidth??80,s=g(r.operationId,t,n),c=H(ae(r.header),o,e),l=H(oe(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
2
- `)}\n`})}}function H(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>B(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(L)))]}var U='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function fe(e,t){let[n=``,...r]=e.join(` `).trim().split(/\s+/u),[i,...a]=t.filter(e=>e.path===n);if(r.length===0&&i!==void 0)return a.length===0?c(`Resolved by route`,{operationId:i.operationId}):l(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[U]);let o=m.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return c(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=u(o),d=r.join(``),f=t.find(e=>e.method===s&&e.path===d);if(f!==void 0)return c(`Resolved by route template`,{operationId:f.operationId});let{resolveOpenApiOperationSelector:p}=await import(`./openapi-call-DZE6bLbj.js`),h=p({method:s,path:d});return!h.ok||h.data===null?l(h.summary,[...h.warnings,U]):c(`Resolved by method and path`,{operationId:h.data.operation.operationId})}function W(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}function pe(e,t,n){if(e.cliPath[0]!==`lookup`||!me(n))return null;let r=[...(e.requestBody??[]).flatMap(e=>e.parameter),...e.parameters,{name:`fromFile`,optionKey:`fromFile`}],i=r.filter(({optionKey:e},t)=>r.findIndex(t=>t.optionKey===e)===t).filter(({optionKey:e})=>t[e]!==void 0).map(({name:e,optionKey:n})=>`${e}=${String(t[n])}`),a=`no record for ${i.length===0?`the given input`:i.join(`, `)}`;return n.ok?l(a):l(a,[],{httpStatus:n.httpStatus,problem:n.problem})}function me(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function he(t,n,r,i){let a=ge(t,r),o=a instanceof e?[]:a,s=o[0],c=i.bin[0],l=[{selected:s===`auth`,register:async()=>{let{registerBuiltinAuthCommands:e}=await import(`./builtin-auth-DUbDTfAK.js`);e(n,c)}},{selected:s===`agents`,register:async()=>{let{registerBuiltinAgentSetupCommand:e}=await import(`./builtin-agent-setup-B2Xvqera.js`);e(n,c)}},{selected:s===`update`,register:async()=>{let{registerBuiltinUpdateCommand:e}=await import(`./builtin-update-54vcZ4g_.js`);e(n,i)}},{selected:s===`batch`,register:async()=>{let{registerBuiltinBatchCommand:e}=await import(`./builtin-batch-DdGyCjlR.js`);e(n,r,c)}},{selected:s===`research`||s===`research-runs`||s===`data-engineering`,register:async()=>{let{registerBuiltinRunWaitCommand:e}=await import(`./builtin-run-wait-D0Zga7PG.js`);await e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-BoOb1L3E.js`);e(n,r,c)}},{selected:s===`help`,register:async()=>{let{registerHelpCatalogCommand:e}=await import(`./operations-CcC-MsAS.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerRetiredCommandCatalog:e}=await import(`./operations-CcC-MsAS.js`);e(n,r,c)}}],u=s===void 0||s===`help`||s===`completion`||s===`command-catalog`||!l.some(e=>e.selected)&&!r.some(e=>e.cliPath[0]===s),d=1;for(;d<o.length&&r.some(e=>o.slice(0,d+1).every((t,n)=>e.cliPath[n]===t));)d++;let f=o.slice(0,d),p=u?r:r.filter(e=>f.slice(0,e.cliPath.length).every((t,n)=>e.cliPath[n]===t)),m=new Set,h=async(e=!1)=>{for(let t of l)(e||u||t.selected)&&!m.has(t)&&(await t.register(),m.add(t))};return{generated:p,fullTree:u,rootHelp:t.length>0&&t.every(e=>e===`--help`||e===`-h`),registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function ge(t,n){try{return new r().parseOptions([...w(t,n).commandArgv]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var _e=new Set(D.map(e=>e.cliPath.join(` `)));function G(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,A):e.registeredArguments.length===0&&!_e.has(ue(e).join(` `))&&e.addHelpOption(new de(e));for(let n of e.commands)G(n,t)}function K(e){return v[_(e,C)??`cli`]}function q(e,t,n,{rootHelp:r=!1}={}){let i=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:K(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),a=new Set(i.filter(e=>ie(e.cliPath[0])).map(e=>e.cliPath[0]??``)),o=new Set,s=new Set;for(let{cliPath:e,deprecated:t}of i)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);o.add(r),t!==!0&&s.add(r)}let c=new Set(i.map(({cliPath:e})=>e.join(` `)));for(let t of i){let i=!1;for(let e=1;e<t.cliPath.length;e++)i||=c.has(t.cliPath.slice(0,e).join(` `));ve(e,t,a,s,o.has(t.cliPath.join(` `))||i,n,!r||t.cliPath.length===1)}}function ve(e,n,r,i,a,o,s){let c=n.cliPath,u=e,m=``,h=!r.has(c[0]??``);for(let e of c.slice(0,-1)){m=m===``?e:`${m} ${e}`;let t=h&&m===e||!i.has(m);u=ye(u,e,m,t)}let g=c.at(-1)??n.operationId,_=n.deprecated===!0&&i.has(c.join(` `)),v=u.commands.find(e=>e.name()===g)??u.command(g,n.deprecated===!0&&!_?{hidden:!0}:{}),x=n.requestBody?.flatMap(({parameter:e})=>e)??[];if(v.summary((_?C[c.join(` `)]?.summary:void 0)??(n.summary||n.operationId)).description([`${n.method} ${n.path}.`,n.summary||n.description,`Full documentation: ${o} help ${n.cliPath.join(` `)}`,n.requestBody?.[0]?.kind===`json`||[...n.parameters,...x].some(e=>d(e.schemaType,e.itemSchemaType))?f:``].filter(Boolean).join(`
3
- `)),!s)return;let S=ee(n);for(let e of n.parameters)be(v,e,a||e===S);N(v,n),p(n.intent)&&!v.options.some(e=>e.long===`--execute`)&&v.addOption(new t(`--execute`).hideHelp()),k(v),v.hook(`preAction`,e=>te(e,n)),n.explain===!0&&v.option(`--explain`,`Print the search strategy and parsed constraints before the results`),S!==void 0&&v.argument(`[text...]`,S.description||`Same as ${y(S.flag)}.`),v.action(async function(){let{emit:e,emitSearchExplanation:t}=await import(`./output-Buc7lmVl.js`),r=Object.assign(this.optsWithGlobals(),{environment:this.opts().environment}),i=O(r),a=r;if(S!==void 0){let t=b(S,this.args,r);if(!t.ok)return e({mode:i},{...t,notDispatched:!0});if(t.data===null)return e({mode:i},t);a=t.data}let o=ne(n,a);if(o.length>0){let t=`missing required options: ${o.join(`, `)}`;return e({mode:i},l(t,[],{notDispatched:!0}))}let s=await J(n,a,i),c=pe(n,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&t(i,s.data),s.ok&&s.data instanceof Uint8Array&&i!==`csv`&&i!==`xlsx`?process.stdout.write(s.data):e({mode:i},s),s.ok&&await(await import(`./search-narrowing-BiqSnCGJ.js`)).promptSearchNarrowing({spec:n,opts:a,mode:i,payload:s.data,run:e=>J(n,e,i),emit:t=>e({mode:i},t)})})}function ye(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=C[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function be(e,n,r=!1){let i=n.description||`${n.name} ${n.location} parameter`,a=n.defaultValue===void 0?void 0:typeof n.defaultValue==`string`||typeof n.defaultValue==`boolean`?n.defaultValue:[...n.defaultValue];if(n.legacyFlag!==void 0){let o=new t(n.flag,i);a!==void 0&&o.default(a);let s=new t(n.legacyFlag,i).conflicts(n.optionKey);e.addOption(o).addOption(s),e.hook(`preAction`,e=>{let t=e.opts(),i=t[n.optionKey],a=t[s.attributeName()];a===void 0?!r&&n.required&&i===void 0&&e.error(`error: required option '${o.flags}' not specified`,{code:`commander.missingMandatoryOptionValue`}):(i===void 0||e.getOptionValueSource(n.optionKey)==="default")&&e.setOptionValueWithSource(n.optionKey,a,`cli`)})}else a===void 0?n.required&&!r?e.requiredOption(n.flag,i):e.option(n.flag,i):e.option(n.flag,i,a)}async function J(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-DZE6bLbj.js`),{pendingResult:a}=await import(`./output-Buc7lmVl.js`),o=await M(e,t);if(!o.ok)return{...o,notDispatched:!0};let s=!1,c=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)]})),l=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]]})),u=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)]]})),d=await i({method:e.method,path:r(e.operationId,c),searchParams:l,headers:u,body:o.data,contentType:x(e,t),auth:e.auth,responseFormat:se(n),responseBytes:e.binaryResponse===!0,pendingResult:a,onDispatch:()=>{s=!0}});return le(e,d.ok||s?d:{...d,notDispatched:!0})}async function Y(e,n){let r=n.bin[0],i=ce(D),c=T(e,i),l=c===`required`?i:re(i),u=new j;u.enablePositionalOptions(!S(e)&&w(e,i).positionalOptions).name(r).usage(`[--environment <environment>] <command> [subcommand] [options]`).configureHelp(z).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,
1
+ import{a as e,n as t,r as n,t as r}from"./commander-DEj7N1b9.js";import{a as i}from"./package-DEeHDoOT.js";import{l as a,o,r as s}from"./env-CMJ0DtbB.js";import{c,r as l}from"./result-envelope-DhuT_8lW.js";import{B as u,o as d,t as f,u as p,z as m}from"./tool-policy-DYjF2wFZ.js";import{i as h}from"./logging-DqesyM4A.js";import{h as g}from"./help-catalog-ByQFO96d.js";import{r as _,t as v}from"./cli-help-policy-BCuXaWdv.js";import{a as ee,i as te,n as y,o as b,r as ne,t as x}from"./generated-dispatch-C79846kK.js";import{a as S,c as C,i as w,n as T,r as E,s as re,t as ie}from"./startup-auth-B0hdVmRP.js";import{t as D}from"./openapi-commands-BEyhfc6I.js";import{n as ae,t as oe}from"./operations-metadata-DnrouEku.js";import{a as O,i as se,t as k}from"./output-mode-CE87SvLV.js";import{n as ce,t as le}from"./deprecated-command-bF9Q8_F6.js";import{a as ue,i as de,n as A,r as j}from"./payload-operand-guard-C8eAl3-g.js";import{n as M,t as N}from"./generated-body-BaGjgMKp.js";import{fileURLToPath as P}from"node:url";function F(e,t,n=i().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, search the catalog, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help catalog [query...]` searches or lists every operation;\n`help ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new I(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()}),k(r),r.action(async function(r){let i=r.flatMap(e=>e.split(/\s+/u).filter(Boolean)),{emit:a}=await import(`./output-B1si3d0c.js`),o=this.optsWithGlobals();if(o.help&&i.length===0){this.outputHelp();return}let s=W(e,i),l=t.find(t=>s!==void 0&&W(e,t.cliPath)===s);if(o.help||s!==void 0&&l===void 0){s===void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let u=l===void 0?await fe(i,t):c(`Resolved by command path`,{operationId:l.operationId});if(u.ok&&u.data?.command!==void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),!u.ok||u.data===null){a({mode:O(o)},u);return}let{writeShowResult:d}=await import(`./operations-catalog-EwBZDr8Z.js`);d({...o,...u.data},t,O(o,`text`),n)}),V(e,t,n)}var I=class extends t{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))}},L=2,R=6,z={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=>C[e.name()]?.listed!==!1):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(L)}${e}\n${B(r,a,i)}`}};function B(e,t,n){return n.boxWrap(e,t-R).replace(/^/gmu,` `.repeat(R))}function V(e,t,n){for(let r of t){let i=W(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp(),a=i.configureOutput().getOutHelpWidth?.();e.prepareContext(a===void 0?{}:{helpWidth:a});let o=e.helpWidth??80,s=g(r.operationId,t,n),c=H(ae(r.header),o,e),l=H(oe(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
2
+ `)}\n`})}}function H(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>B(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(L)))]}var U='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function fe(e,t){let[n=``,...r]=e.join(` `).trim().split(/\s+/u),[i,...a]=t.filter(e=>e.path===n);if(r.length===0&&i!==void 0)return a.length===0?c(`Resolved by route`,{operationId:i.operationId}):l(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[U]);let o=m.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return c(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=u(o),d=r.join(``),f=t.find(e=>e.method===s&&e.path===d);if(f!==void 0)return c(`Resolved by route template`,{operationId:f.operationId});let{resolveOpenApiOperationSelector:p}=await import(`./openapi-call-DZE6bLbj.js`),h=p({method:s,path:d});return!h.ok||h.data===null?l(h.summary,[...h.warnings,U]):c(`Resolved by method and path`,{operationId:h.data.operation.operationId})}function W(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}function pe(e,t,n){if(e.cliPath[0]!==`lookup`||!me(n))return null;let r=[...(e.requestBody??[]).flatMap(e=>e.parameter),...e.parameters,{name:`fromFile`,optionKey:`fromFile`}],i=r.filter(({optionKey:e},t)=>r.findIndex(t=>t.optionKey===e)===t).filter(({optionKey:e})=>t[e]!==void 0).map(({name:e,optionKey:n})=>`${e}=${String(t[n])}`),a=`no record for ${i.length===0?`the given input`:i.join(`, `)}`;return n.ok?l(a):l(a,[],{httpStatus:n.httpStatus,problem:n.problem})}function me(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function he(t,n,r,i){let a=ge(t,r),o=a instanceof e?[]:a,s=o[0],c=i.bin[0],l=[{selected:s===`auth`,register:async()=>{let{registerBuiltinAuthCommands:e}=await import(`./builtin-auth-OPVpJ_Jh.js`);e(n,c)}},{selected:s===`agents`,register:async()=>{let{registerBuiltinAgentSetupCommand:e}=await import(`./builtin-agent-setup-B2Xvqera.js`);e(n,c)}},{selected:s===`update`,register:async()=>{let{registerBuiltinUpdateCommand:e}=await import(`./builtin-update-DmyUY7cK.js`);e(n,i)}},{selected:s===`batch`,register:async()=>{let{registerBuiltinBatchCommand:e}=await import(`./builtin-batch-DdGyCjlR.js`);e(n,r,c)}},{selected:s===`research`||s===`research-runs`||s===`data-engineering`,register:async()=>{let{registerBuiltinRunWaitCommand:e}=await import(`./builtin-run-wait-D5hP41JN.js`);await e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-BoOb1L3E.js`);e(n,r,c)}},{selected:s===`help`,register:async()=>{let{registerHelpCatalogCommand:e}=await import(`./operations-CCPlcB5L.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerRetiredCommandCatalog:e}=await import(`./operations-CCPlcB5L.js`);e(n,r,c)}}],u=s===void 0||s===`help`||s===`completion`||s===`command-catalog`||!l.some(e=>e.selected)&&!r.some(e=>e.cliPath[0]===s),d=1;for(;d<o.length&&r.some(e=>o.slice(0,d+1).every((t,n)=>e.cliPath[n]===t));)d++;let f=o.slice(0,d),p=u?r:r.filter(e=>f.slice(0,e.cliPath.length).every((t,n)=>e.cliPath[n]===t)),m=new Set,h=async(e=!1)=>{for(let t of l)(e||u||t.selected)&&!m.has(t)&&(await t.register(),m.add(t))};return{generated:p,fullTree:u,rootHelp:t.length>0&&t.every(e=>e===`--help`||e===`-h`),registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function ge(t,n){try{return new r().parseOptions([...w(t,n).commandArgv]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var _e=new Set(D.map(e=>e.cliPath.join(` `)));function G(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,A):e.registeredArguments.length===0&&!_e.has(ue(e).join(` `))&&e.addHelpOption(new de(e));for(let n of e.commands)G(n,t)}function K(e){return v[_(e,C)??`cli`]}function q(e,t,n,{rootHelp:r=!1}={}){let i=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:K(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),a=new Set(i.map(e=>e.cliPath[0]??``).filter(e=>ie(e))),o=new Set,s=new Set;for(let{cliPath:e,deprecated:t}of i)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);o.add(r),t!==!0&&s.add(r)}let c=new Set(i.map(({cliPath:e})=>e.join(` `)));for(let t of i){let i=!1;for(let e=1;e<t.cliPath.length;e++)i||=c.has(t.cliPath.slice(0,e).join(` `));ve(e,t,a,s,o.has(t.cliPath.join(` `))||i,n,!r||t.cliPath.length===1)}}function ve(e,n,r,i,a,o,s){let c=n.cliPath,u=e,m=``,h=!r.has(c[0]??``);for(let e of c.slice(0,-1)){m=m===``?e:`${m} ${e}`;let t=h&&m===e||!i.has(m);u=ye(u,e,m,t)}let g=c.at(-1)??n.operationId,_=n.deprecated===!0&&i.has(c.join(` `)),v=u.commands.find(e=>e.name()===g)??u.command(g,n.deprecated===!0&&!_?{hidden:!0}:{}),x=n.requestBody?.flatMap(({parameter:e})=>e)??[];if(v.summary((_?C[c.join(` `)]?.summary:void 0)??(n.summary||n.operationId)).description([`${n.method} ${n.path}.`,n.summary||n.description,`Full documentation: ${o} help ${n.cliPath.join(` `)}`,n.requestBody?.[0]?.kind===`json`||[...n.parameters,...x].some(e=>d(e.schemaType,e.itemSchemaType))?f:``].filter(Boolean).join(`
3
+ `)),!s)return;let S=ee(n);for(let e of n.parameters)be(v,e,a||e===S);N(v,n),p(n.intent)&&!v.options.some(e=>e.long===`--execute`)&&v.addOption(new t(`--execute`).hideHelp()),k(v),v.hook(`preAction`,e=>te(e,n)),n.explain===!0&&v.option(`--explain`,`Print the search strategy and parsed constraints before the results`),S!==void 0&&v.argument(`[text...]`,S.description||`Same as ${y(S.flag)}.`),v.action(async function(){let{emit:e,emitSearchExplanation:t}=await import(`./output-B1si3d0c.js`),r=Object.assign(this.optsWithGlobals(),{environment:this.opts().environment}),i=O(r),a=r;if(S!==void 0){let t=b(S,this.args,r);if(!t.ok)return e({mode:i},{...t,notDispatched:!0});if(t.data===null)return e({mode:i},t);a=t.data}let o=ne(n,a);if(o.length>0){let t=`missing required options: ${o.join(`, `)}`;return e({mode:i},l(t,[],{notDispatched:!0}))}let s=await J(n,a,i),c=pe(n,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&t(i,s.data),s.ok&&s.data instanceof Uint8Array&&i!==`csv`&&i!==`xlsx`?process.stdout.write(s.data):e({mode:i},s),s.ok&&await(await import(`./search-narrowing-DQTfXVdT.js`)).promptAfterResult(n,a,i,s.data,e=>J(n,e,i))})}function ye(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=C[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function be(e,n,r=!1){let i=n.description||`${n.name} ${n.location} parameter`,a=n.defaultValue,o=a===void 0||typeof a==`string`||typeof a==`boolean`?a:[...a];if(n.legacyFlag!==void 0){let a=new t(n.flag,i);o!==void 0&&a.default(o);let s=new t(n.legacyFlag,i).conflicts(n.optionKey);e.addOption(a).addOption(s),e.hook(`preAction`,e=>{let t=e.opts(),i=t[n.optionKey],o=t[s.attributeName()];o===void 0?!r&&n.required&&i===void 0&&e.error(`error: required option '${a.flags}' not specified`,{code:`commander.missingMandatoryOptionValue`}):(i===void 0||e.getOptionValueSource(n.optionKey)==="default")&&e.setOptionValueWithSource(n.optionKey,o,`cli`)})}else o===void 0?n.required&&!r?e.requiredOption(n.flag,i):e.option(n.flag,i):e.option(n.flag,i,o)}async function J(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-DZE6bLbj.js`),{pendingResult:a}=await import(`./output-B1si3d0c.js`),o=await M(e,t);if(!o.ok)return{...o,notDispatched:!0};let s=!1,c=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)]})),l=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]]})),u=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)]]})),d=await i({method:e.method,path:r(e.operationId,c),searchParams:l,headers:u,body:o.data,contentType:x(e,t),auth:e.auth,responseFormat:se(n),responseBytes:e.binaryResponse===!0,pendingResult:a,onDispatch:()=>{s=!0}});return le(e,d.ok||s?d:{...d,notDispatched:!0})}async function Y(e,n){let r=n.bin[0],i=ce(D),c=T(e,i),l=c===`required`?i:re(i),u=new j;u.enablePositionalOptions(!S(e)&&w(e,i).positionalOptions).name(r).usage(`[--environment <environment>] <command> [subcommand] [options]`).configureHelp(z).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,
4
4
  people, and news — carry everything else: funding, publications, and tags.
5
5
 
6
6
  Mutations execute directly; --execute is a deprecated no-op.
7
- The aVenture MCP server runs these same operations through the same API client.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${s})`).choices([...a()])).showHelpAfterError(`(run \`${r} --help\` for usage)`),(S(e)||e.every(e=>e.startsWith(`-`)))&&u.version(n.version);let d=he(e,u,l,n);q(u,d.generated,r,{rootHelp:d.rootHelp}),await d.registerBuiltin(),F(u,l,r);for(let e of u.commands)e.helpGroup()||e.helpGroup(K(e.name()).heading);let f;if(G(u,e=>t=>{throw f=(async()=>{!d.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await d.completeTree((e,t)=>q(e,t,r));let{commandExitHandler:n}=await import(`./parse-error-hint-CVooJYmq.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),c===`required`){let e=[u];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await E(`required`)}))}}let p=new Set(u.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));return u.addHelpText(`after`,[``,`Record subcommands under entities, people, and news:`,...[[`search`,` search Find many of that record from a plain-English query or a filter`],[`lookup`,` lookup Find one news article; companies and people use the root lookup`],[`get`,` get Read one record`],[`list`,` list Read many records`],[`create`,` create, update, delete Write; each needs a credential that permits it`]].flatMap(([e,t])=>p.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${o}/sign-up, then run: ${r} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${r} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --csv Print CSV rows or preserve server CSV bytes.`,` --xlsx Write server XLSX bytes with --to-file; use --csv otherwise.`,` --data response data as JSON, the default when piped or non-TTY`,` --data-full uncapped, for bounded programs, never LLM agents`,` --all-fields --text plus the detail fields it hides by default
7
+ The aVenture MCP server runs these same operations through the same API client.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${s})`).choices([...a()])).showHelpAfterError(`(run \`${r} --help\` for usage)`),(S(e)||e.every(e=>e.startsWith(`-`)))&&u.version(n.version);let d=he(e,u,l,n);q(u,d.generated,r,{rootHelp:d.rootHelp}),await d.registerBuiltin(),F(u,l,r);for(let e of u.commands)e.helpGroup()||e.helpGroup(K(e.name()).heading);let f;if(G(u,e=>t=>{throw f=(async()=>{!d.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await d.completeTree((e,t)=>q(e,t,r));let{commandExitHandler:n}=await import(`./parse-error-hint-DTJsWd-D.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),c===`required`){let e=[u];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await E(`required`)}))}}let p=new Set(u.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));return u.addHelpText(`after`,[``,`Record subcommands under entities, people, and news:`,...[[`search`,` search Find many of that record from a plain-English query or a filter`],[`lookup`,` lookup Find one news article; companies and people use the root lookup`],[`get`,` get Read one record`],[`list`,` list Read many records`],[`create`,` create, update, delete Write; each needs a credential that permits it`]].flatMap(([e,t])=>p.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${o}/sign-up, then run: ${r} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${r} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --csv Print CSV rows or preserve server CSV bytes.`,` --xlsx Write server XLSX bytes with --to-file; use --csv otherwise.`,` --data response data as JSON, the default when piped or non-TTY`,` --data-full uncapped, for bounded programs, never LLM agents`,` --all-fields --text plus the detail fields it hides by default
8
8
  `,`Exit codes:`,` 0 envelope.ok === true
9
9
  1 envelope.ok === false
10
10
  `,`Examples:`,` $ ${r} auth login`,` $ ${r} lookup --name Stripe --url https://stripe.com`,` $ ${r} search "fintech companies in Austin"\n`,`Run \`${r} <command> --help\` for its subcommands and options,`,`or \`${r} help <command>\` for its full documentation.`].join(`
11
- `)),{program:u,exitPreparation:()=>f}}var X=i(P(import.meta.url)),Z=X.bin[0];async function Q(e,t){process.exitCode=1;let n=e instanceof Error?e:Error(String(e)),r={...l(`${Z} ${t}: ${n.message}`,[n.name||`Error`]),counts:{exitCode:1}};h({component:Z,event:`fatal`,message:n.message,error:n}),process.stderr.write(`${Z} fatal (${t}): ${n.stack??n.message}\n`);try{let{BearerVerificationUnavailableError:e}=await import(`./openapi-call-DZE6bLbj.js`),{emitJson:t}=await import(`./output-Buc7lmVl.js`),i=n instanceof e?{httpStatus:n.problem.status,problem:n.problem}:{};r={...r,...i},t(r)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`${Z} fatal reporting failed: ${t}\n`),process.stdout.write(`${JSON.stringify(r)}\n`)}}var xe=e=>{if(e.code!==`EPIPE`)throw e;process.exit(0)};for(let e of[process.stdout,process.stderr])e.on(`error`,xe);process.on(`uncaughtException`,e=>Q(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>Q(e,`unhandledRejection`));var $=await Y(process.argv.slice(2),X);try{await $.program.parseAsync()}catch(t){await $.exitPreparation(),t instanceof e?process.exitCode=t.exitCode:await Q(t,`parseAsync`)}export{};
11
+ `)),{program:u,exitPreparation:()=>f}}var X=i(P(import.meta.url)),Z=X.bin[0];async function Q(e,t){process.exitCode=1;let n=e instanceof Error?e:Error(String(e)),r={...l(`${Z} ${t}: ${n.message}`,[n.name||`Error`]),counts:{exitCode:1}};h({component:Z,event:`fatal`,message:n.message,error:n}),process.stderr.write(`${Z} fatal (${t}): ${n.stack??n.message}\n`);try{let{BearerVerificationUnavailableError:e}=await import(`./openapi-call-DZE6bLbj.js`),{emitJson:t}=await import(`./output-B1si3d0c.js`),i=n instanceof e?{httpStatus:n.problem.status,problem:n.problem}:{};r={...r,...i},t(r)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`${Z} fatal reporting failed: ${t}\n`),process.stdout.write(`${JSON.stringify(r)}\n`)}}var xe=e=>{if(e.code!==`EPIPE`)throw e;process.exit(0)};for(let e of[process.stdout,process.stderr])e.on(`error`,xe);process.on(`uncaughtException`,e=>Q(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>Q(e,`unhandledRejection`));var $=await Y(process.argv.slice(2),X);try{await $.program.parseAsync()}catch(t){await $.exitPreparation(),t instanceof e?process.exitCode=t.exitCode:await Q(t,`parseAsync`)}export{};
@@ -1,6 +1,6 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{o as n,p as r,t as i}from"./env-CMJ0DtbB.js";import{c as a,r as o}from"./result-envelope-DhuT_8lW.js";import{r as s}from"./api-target-vxev2RKl.js";import{t as c}from"./credential-redaction-DOhPUDmS.js";import{n as l}from"./contract-D3z_p0tr.js";import{t as u}from"./openapi-composites-IdxI7cAF.js";import{t as d}from"./auth-status-check-BCXBeKK9.js";import{n as f}from"./output-OV1lH-WC.js";import{a as p,t as m}from"./output-mode-CE87SvLV.js";var h=l(u,`oauth`),g=[l(u,`start`),l(u,`poll`),l(u,`acknowledge`)],_=l(u,`revoke`);function v(n,r=t().bin[0]){let a=S(n),s=[`${h.description} Default method: OAuth in your browser.`,`With --key: ${g.map(({description:e})=>e).join(` `)}`].join(`
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{o as n,p as r,t as i}from"./env-CMJ0DtbB.js";import{c as a,r as o}from"./result-envelope-DhuT_8lW.js";import{r as s}from"./api-target-vxev2RKl.js";import{t as c}from"./credential-redaction-DOhPUDmS.js";import{n as l}from"./contract-D3z_p0tr.js";import{t as u}from"./openapi-composites-IdxI7cAF.js";import{t as d}from"./auth-status-check-Csx3C7Sh.js";import{n as f}from"./output-BL3uMwJp.js";import{a as p,t as m}from"./output-mode-CE87SvLV.js";var h=l(u,`oauth`),g=[l(u,`start`),l(u,`poll`),l(u,`acknowledge`)],_=l(u,`revoke`);function v(n,r=t().bin[0]){let a=S(n),s=[`${h.description} Default method: OAuth in your browser.`,`With --key: ${g.map(({description:e})=>e).join(` `)}`].join(`
2
2
  `);m(x(a,[h,...g],s)).action(y),m(x(a,[_],_.description)).action(b),m(a.command(`status`).summary(`Keep saved credentials current and report them`).description([`Runs the same credential materialization every command runs, then reports:`,` - auth: whether AUTH_TOKEN was already set in this shell's environment`,` - oauth: the saved OAuth identity and access-token expiry for the selected API host;`,` an expired token is renewed with its refresh token and a token the sign-in service rejects is retired`,` - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated`,` - selected: the credential the next command sends`,` - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)`,` - api: running CLI package version plus GET /info build metadata`," - check: `{ name, status, message }` for each environment check:",...d.map(e=>` ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) does not`,`fail the run. Each failing message names the command that fixes it.`,`Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.`,`--verify read|write additionally runs a live permission probe for that scope; it does not`,`execute or authorize an arbitrary API operation.`].join(`
3
3
  `)).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){C(this),f({mode:p(e)},await w(r,e.verify))}),a.command(`token`).summary(`Print the bearer token the next command sends`).description([`Runs the same credential materialization every command runs, then prints the selected`,`bearer token alone on stdout: ${i.authToken} when set, otherwise the saved OAuth`,`access token (renewed when expired) or the saved aVenture API key.`,`Use it where another client needs this CLI's sign-in, such as an MCP client's header helper.`].join(`
4
4
  `)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-DPFpwyry.js`);C(this);let t=await e(r),n=process.env[i.authToken]?.trim();t.failure===null&&n!==void 0&&n.length>0?process.stdout.write(`${n}\n`):f({mode:`text`},t.failure===null?M(`auth token: no credentials resolved`,null,r,{oauth:!0,apiKey:!0}):o(`auth token: ${t.failure}`))})}async function y(e){C(this);let t=p(e),n=e.key===!0?await(await import(`./api-key-login-DfO9m2mn.js`)).loginApiKeyCredential({noBrowser:!e.browser,clientLabel:e.clientLabel}):await(await import(`./oauth-login-CD0FydTx.js`)).loginOAuthCredential({noBrowser:!e.browser});f({mode:t},n)}async function b(e){let{logoutCliCredentials:t}=await import(`./logout-yqWxz0ln.js`);C(this),f({mode:p(e)},await t({forgetLocal:e.forgetLocal===!0}))}function x(e,t,n){let[r]=t,i=e.command(r.command.slice(r.command.indexOf(` `)+1)).summary(r.summary).description(n),a=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])a.has(t.flag)||(a.add(t.flag),`required`in t&&t.required?i.requiredOption(t.flag,t.description):i.option(t.flag,t.description));return i}function S(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${h.command}\`: ${h.summary}; \`--key\` ${g[0].summary.toLowerCase()}.`,`\`${_.command}\`: ${_.summary}.`,"`auth status` reports credential provenance, sign-in providers, CLI/API build metadata, and environment checks.","`auth token` prints the bearer token the next command sends."].join(`
5
- `))}function C(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function w(e,n){let{resolveAuthStatus:l}=await import(`./auth-resolver-DECOzKuu.js`),{apiHostCheck:u,authStatusReport:d,checkResult:f,environmentChecks:p}=await import(`./auth-status-check-DodYuOTF.js`),{inspectOAuthCredentialStorage:m}=await import(`./oauth-credential-Dy0-zxMx.js`),{apiKeyCredentialDiagnostics:h,inspectLiveAuth:g,oauthCredentialDiagnostics:_,refreshCliCredentials:v,renderAuthStatus:y}=await import(`./auth-status-render-DPFpwyry.js`),b;try{b=s(r().host)}catch(e){return o(`auth status: invalid API host — ${c(e)}`)}let x=l(),S=v(e),[C,w,O]=await Promise.all([j(`/info`,`GET /info`),D(),p(e)]),A=await S,[N,P]=await Promise.all([m(b),E(b)]),F=n===void 0?null:await g(n,N,P.inspection,A),I=t().version,L=h(b,P.inspection,P.verification),R=F!==null||x.present||N.state===`found`||P.inspection.state===`found`&&P.inspection.stored.activation===`active`,z=A.failure??F?.error??(R?null:`no credentials resolved`),B=d(O,u(C,b,e),z===null?f(`auth`,`pass`,`credential=${A.materialized??x.source??`none`}`):f(`auth`,`fail`,z)),V=`${y({cliName:e,cliVersion:I,apiVersion:C.ok?await k(C.data):null,oauth:N,apiKey:L,apiKeyPhase:P.inspection.state===`found`?P.inspection.stored.activation:null,providers:w,resolved:x,refresh:A,live:F})}\n${T(B.check)}`,H={cli:{version:I},api:C.ok?C.data??null:null,auth:{[i.authToken]:x},selected:A.materialized,oauth:_(b,N),apiKey:L,providers:w,live:F,check:B.check,...C.ok?{}:{apiError:C.summary}};if(A.failure!==null)return{...o(`auth status: ${A.failure} | ${V}`,[A.failure]),data:H};if(!C.ok&&C.httpStatus===401)return{...o(`auth status: the API rejected the selected credential (401) | ${V}`,[`Replace or unset ${i.authToken}, or run \`${e} auth login\`.`]),data:H};if(F!==null&&F.error!==null)return{...o(`auth status: ${F.scope} permission probe failed — ${F.error}`,[F.error]),data:H};if(!R)return M(`auth status: no credentials resolved | ${V}`,H,e,{oauth:N.state===`missing`,apiKey:P.inspection.state===`missing`});let U=B.check.filter(e=>e.status===`fail`);return U.length===0?a(V,H):{...o(`auth status: ${U.map(e=>e.name).join(`, `)} failed | ${V}`,U.map(e=>e.message)),data:H}}function T(e){return[`Checks`,...e.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
5
+ `))}function C(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function w(e,n){let{resolveAuthStatus:l}=await import(`./auth-resolver-DECOzKuu.js`),{apiHostCheck:u,authStatusReport:d,checkResult:f,environmentChecks:p}=await import(`./auth-status-check-Dj4KXVZ7.js`),{inspectOAuthCredentialStorage:m}=await import(`./oauth-credential-Dy0-zxMx.js`),{apiKeyCredentialDiagnostics:h,inspectLiveAuth:g,oauthCredentialDiagnostics:_,refreshCliCredentials:v,renderAuthStatus:y}=await import(`./auth-status-render-DPFpwyry.js`),b;try{b=s(r().host)}catch(e){return o(`auth status: invalid API host — ${c(e)}`)}let x=l(),S=v(e),[C,w,O]=await Promise.all([j(`/info`,`GET /info`),D(),p(e)]),A=await S,[N,P]=await Promise.all([m(b),E(b)]),F=n===void 0?null:await g(n,N,P.inspection,A),I=t().version,L=h(b,P.inspection,P.verification),R=F!==null||x.present||N.state===`found`||P.inspection.state===`found`&&P.inspection.stored.activation===`active`,z=A.failure??F?.error??(R?null:`no credentials resolved`),B=d(O,u(C,b,e),z===null?f(`auth`,`pass`,`credential=${A.materialized??x.source??`none`}`):f(`auth`,`fail`,z)),V=`${y({cliName:e,cliVersion:I,apiVersion:C.ok?await k(C.data):null,oauth:N,apiKey:L,apiKeyPhase:P.inspection.state===`found`?P.inspection.stored.activation:null,providers:w,resolved:x,refresh:A,live:F})}\n${T(B.check)}`,H={cli:{version:I},api:C.ok?C.data??null:null,auth:{[i.authToken]:x},selected:A.materialized,oauth:_(b,N),apiKey:L,providers:w,live:F,check:B.check,...C.ok?{}:{apiError:C.summary}};if(A.failure!==null)return{...o(`auth status: ${A.failure} | ${V}`,[A.failure]),data:H};if(!C.ok&&C.httpStatus===401)return{...o(`auth status: the API rejected the selected credential (401) | ${V}`,[`Replace or unset ${i.authToken}, or run \`${e} auth login\`.`]),data:H};if(F!==null&&F.error!==null)return{...o(`auth status: ${F.scope} permission probe failed — ${F.error}`,[F.error]),data:H};if(!R)return M(`auth status: no credentials resolved | ${V}`,H,e,{oauth:N.state===`missing`,apiKey:P.inspection.state===`missing`});let U=B.check.filter(e=>e.status===`fail`);return U.length===0?a(V,H):{...o(`auth status: ${U.map(e=>e.name).join(`, `)} failed | ${V}`,U.map(e=>e.message)),data:H}}function T(e){return[`Checks`,...e.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
6
6
  `)}async function E(e){let{refreshStoredApiKeyCredential:t}=await import(`./api-key-credential-verification-BnSET9Z_.js`),n=await O(e);if(n.state!==`found`)return{inspection:n,verification:null};let{lookup:r,verification:i}=await t(n.stored);return{inspection:r,verification:i}}async function D(){try{let{fetchAuthProviderCatalog:e}=await import(`./oauth-login-CD0FydTx.js`);return{state:`found`,catalog:await e()}}catch(e){return{state:`unavailable`,summary:c(e)}}}async function O(e){try{let{inspectApiKeyCredentialStorage:t}=await import(`./api-key-credential-DRQCGyVV.js`);return await t(e)}catch(e){return{state:`invalid`,summary:c(e)}}}async function k(e){let{SystemBuildSchema:t}=await import(`./system-build-DFy8edPI.js`);if(!A(e))return null;let n=t.safeParse(Reflect.get(e,`response`));if(!n.success)return null;let r=n.data.build.version?.trim();return r&&r.length>0?r:null}function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function j(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-DZE6bLbj.js`);return await n({method:`GET`,path:e,auth:`none`,responseFormat:`json`}).catch(e=>o(`${t} failed: ${e instanceof Error?e.message:String(e)}`))}function M(e,t,r,a){return{...o(e,[...a.apiKey?[`For an API key (works over SSH), run \`${r} auth login --key\`.`]:[],...a.oauth?[`For OAuth, run \`${r} auth login\`; without a browser it prints a device code.`]:[],`For non-interactive use, set ${i.authToken} to an aVenture API key (create one at ${n}/settings/api-keys).`]),data:t}}export{v as registerBuiltinAuthCommands};
@@ -1 +1 @@
1
- import{c as e,r as t}from"./result-envelope-DhuT_8lW.js";import{n}from"./output-OV1lH-WC.js";import{a as r,t as i}from"./output-mode-CE87SvLV.js";var a=5e3,o=6e4,s=3e4,c=86400,l={noun:`research runs`,summary:`Wait for research runs to finish, then report each outcome`,description:"Polls `research runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, and last event time, plus spend when available in this distribution; a timeout reports the last event time so a stalled run shows. Exits nonzero when the run failed or stopped, or when --timeout passes first.",getOperationId:`getResearchRun`,defaultTimeoutSeconds:1800,schema:async()=>(await import(`./run-detail-DNnLjXUg.js`)).HarnessRunDetailSchema,progress:({run:e,lastEventAt:t})=>e.status===`completed`||e.status===`failed`||e.status===`stopped`?void 0:`${e.status}, last event ${t??`none`}`,isQueued:({run:e})=>e.status===`queued`,outcome:m};async function u(e){let t=t=>e.commands.find(e=>e.name()===t),n=e=>t(e)?.commands.find(e=>e.name()===`runs`),r=n(`research`);r!==void 0&&d(r,l);let i=n(`data-engineering`);if(i!==void 0){let{dataEngineeringRuns:e}=await import(`./private-run-read-DM_02z6l.js`);e!==void 0&&d(i,e)}}function d(e,t){let a=e.command(`wait`).summary(t.summary).description(`${t.description} Several --run-id values wait for every run in one process; data then lists each outcome in order, and the exit is nonzero unless every run succeeded.`).requiredOption(`--run-id <uuid...>`,`Run id; repeat or list several to wait for all`).option(`--timeout <seconds>`,`Total seconds to wait; a run still in flight then exits nonzero as still running`,String(t.defaultTimeoutSeconds));i(a),a.action(async function(){let e=this.optsWithGlobals(),i=await Promise.all(e.runId.map(n=>p(t,{runId:n,timeout:e.timeout}))),a=i.length===1&&i[0]!==void 0?i[0]:f(i);n({mode:r(e)},a)})}function f(t){let n=t.filter(e=>e.ok).length;return{...e(`${n} of ${t.length} runs succeeded: ${t.map(e=>e.summary).join(`; `)}`,t.map(e=>e.data),{warnings:t.flatMap(e=>e.warnings)}),ok:n===t.length}}async function p(e,n){let{setTimeout:r}=await import(`node:timers/promises`),{buildOpenApiPath:i}=await import(`./openapi-call-DZE6bLbj.js`),{parseBoundedInt:s}=await import(`./batch-io-C7ON6tOS.js`),l=s(`--timeout`,n.timeout,1,c);if(!l.ok||l.data===null)return t(l.summary);let u=Date.now()+l.data*1e3,d=i(e.getOperationId,{runId:n.runId}),f=a,p=`not read yet`,m=!1,g=(r=`after ${l.data}s`)=>t(`Run ${n.runId} is still ${p} ${r}`,[m?`Read current run details with \`${e.noun} get --run-id ${n.runId}\` before another wait; the run is queued, not executing.`:`Wait longer with --timeout, or read it with \`${e.noun} get --run-id ${n.runId}\`.`]);for(;;){if(u-Date.now()<=0)return g();let t=0,n=await h(d,u,await e.schema());if(n.kind===`deadline`)return g();if(n.kind===`refused`)return n.envelope;if(n.kind===`detail`){let t=e.progress(n.detail);if(t===void 0)return await e.outcome(n.detail,u);p=t,m=e.isQueued?.(n.detail)??!1}else p=`unread (${n.reason})`,m=!1,t=(n.retryAfterSeconds??0)*1e3;let i=u-Date.now();if(i<=0||t>=i)return g(i<=0?`after ${l.data}s`:`and the API asks for ${t/1e3}s, past the ${l.data}s --timeout`);let s=Math.max(t,a+Math.random()*(f-a)),c=Math.min(u,Date.now()+s),_=c-Date.now();for(;_>0;)await r(_),_=c-Date.now();f=Math.min(f*2,o)}}async function m(t,n){let{readResearchRunSpend:r}=await import(`./private-run-read-DM_02z6l.js`),{run:i}=t,a=await r?.({runId:i.id,deadline:n})??{costUsd:null},o={runId:i.id,status:i.status,error:i.error??null,failureClass:i.failureClass??null,publicUrl:t.publicUrl??null,finishedAt:i.finishedAt??null,lastEventAt:t.lastEventAt??null,...a.costUsd===null?{}:{costUsd:a.costUsd}},s={warnings:a.warning===void 0?[]:[a.warning]},c=a.costUsd===null?``:`; spend $${a.costUsd.toFixed(4)}`;if(i.status===`completed`)return e(`Run ${i.id} completed${c}`,o,s);let l=i.failureClass?` (${i.failureClass})`:``,u=i.error?`: ${i.error}`:``;return{...e(`Run ${i.id} ${i.status}${l}${c}${u}`,o,s),ok:!1}}async function h(e,n,r){let{runOpenApiCall:i}=await import(`./openapi-call-DZE6bLbj.js`),{isTransientRefusal:a,isTransportFailure:o}=await import(`./request-replay-DYW0dljL.js`),{retrySeconds:c}=await import(`./response-problem-C3yfskNU.js`),l=n-Date.now();if(l<=0)return{kind:`deadline`};let u=AbortSignal.timeout(Math.min(s,l)),d;try{d=await i({method:`GET`,path:e,auth:`auto`,responseFormat:`json`,signal:u})}catch(e){if(o(e)||u.aborted&&e instanceof Error&&e.cause instanceof Error&&e.cause.name===`AbortError`&&e.cause.cause===u.reason)return{kind:`transient`,reason:String(e)};throw e}if(!d.ok){let{problem:n}=d;if(n!==void 0&&a(n.status,n)){let e=c(n.retryAfterSeconds);return{kind:`transient`,reason:d.summary,...e===void 0?{}:{retryAfterSeconds:e}}}return{kind:`refused`,envelope:t(`GET ${e} failed: ${d.summary}`,d.warnings,{problem:n})}}let f=d.data,p=r.safeParse(typeof f==`object`&&f&&`response`in f?f.response:void 0);return p.success?{kind:`detail`,detail:p.data}:{kind:`refused`,envelope:t(`${e} returned an unexpected body: ${p.error.message}`)}}export{u as registerBuiltinRunWaitCommand};
1
+ import{c as e,r as t}from"./result-envelope-DhuT_8lW.js";import{n}from"./output-BL3uMwJp.js";import{a as r,t as i}from"./output-mode-CE87SvLV.js";var a=5e3,o=6e4,s=3e4,c=86400,l={noun:`research runs`,summary:`Wait for research runs to finish, then report each outcome`,description:"Polls `research runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, and last event time, plus spend when available in this distribution; a timeout reports the last event time so a stalled run shows. Exits nonzero when the run failed or stopped, or when --timeout passes first.",getOperationId:`getResearchRun`,defaultTimeoutSeconds:1800,schema:async()=>(await import(`./run-detail-DNnLjXUg.js`)).HarnessRunDetailSchema,progress:({run:e,lastEventAt:t})=>e.status===`completed`||e.status===`failed`||e.status===`stopped`?void 0:`${e.status}, last event ${t??`none`}`,isQueued:({run:e})=>e.status===`queued`,outcome:m};async function u(e){let t=t=>e.commands.find(e=>e.name()===t),n=e=>t(e)?.commands.find(e=>e.name()===`runs`),r=n(`research`);r!==void 0&&d(r,l);let i=n(`data-engineering`);if(i!==void 0){let{dataEngineeringRuns:e}=await import(`./private-run-read-DM_02z6l.js`);e!==void 0&&d(i,e)}}function d(e,t){let a=e.command(`wait`).summary(t.summary).description(`${t.description} Several --run-id values wait for every run in one process; data then lists each outcome in order, and the exit is nonzero unless every run succeeded.`).requiredOption(`--run-id <uuid...>`,`Run id; repeat or list several to wait for all`).option(`--timeout <seconds>`,`Total seconds to wait; a run still in flight then exits nonzero as still running`,String(t.defaultTimeoutSeconds));i(a),a.action(async function(){let e=this.optsWithGlobals(),i=await Promise.all(e.runId.map(n=>p(t,{runId:n,timeout:e.timeout}))),a=i.length===1&&i[0]!==void 0?i[0]:f(i);n({mode:r(e)},a)})}function f(t){let n=t.filter(e=>e.ok).length;return{...e(`${n} of ${t.length} runs succeeded: ${t.map(e=>e.summary).join(`; `)}`,t.map(e=>e.data),{warnings:t.flatMap(e=>e.warnings)}),ok:n===t.length}}async function p(e,n){let{setTimeout:r}=await import(`node:timers/promises`),{buildOpenApiPath:i}=await import(`./openapi-call-DZE6bLbj.js`),{parseBoundedInt:s}=await import(`./batch-io-C7ON6tOS.js`),l=s(`--timeout`,n.timeout,1,c);if(!l.ok||l.data===null)return t(l.summary);let u=Date.now()+l.data*1e3,d=i(e.getOperationId,{runId:n.runId}),f=a,p=`not read yet`,m=!1,g=(r=`after ${l.data}s`)=>t(`Run ${n.runId} is still ${p} ${r}`,[m?`Read current run details with \`${e.noun} get --run-id ${n.runId}\` before another wait; the run is queued, not executing.`:`Wait longer with --timeout, or read it with \`${e.noun} get --run-id ${n.runId}\`.`]);for(;;){if(u-Date.now()<=0)return g();let t=0,n=await h(d,u,await e.schema());if(n.kind===`deadline`)return g();if(n.kind===`refused`)return n.envelope;if(n.kind===`detail`){let t=e.progress(n.detail);if(t===void 0)return await e.outcome(n.detail,u);p=t,m=e.isQueued?.(n.detail)??!1}else p=`unread (${n.reason})`,m=!1,t=(n.retryAfterSeconds??0)*1e3;let i=u-Date.now();if(i<=0||t>=i)return g(i<=0?`after ${l.data}s`:`and the API asks for ${t/1e3}s, past the ${l.data}s --timeout`);let s=Math.max(t,a+Math.random()*(f-a)),c=Math.min(u,Date.now()+s),_=c-Date.now();for(;_>0;)await r(_),_=c-Date.now();f=Math.min(f*2,o)}}async function m(t,n){let{readResearchRunSpend:r}=await import(`./private-run-read-DM_02z6l.js`),{run:i}=t,a=await r?.({runId:i.id,deadline:n})??{costUsd:null},o={runId:i.id,status:i.status,error:i.error??null,failureClass:i.failureClass??null,publicUrl:t.publicUrl??null,finishedAt:i.finishedAt??null,lastEventAt:t.lastEventAt??null,...a.costUsd===null?{}:{costUsd:a.costUsd}},s={warnings:a.warning===void 0?[]:[a.warning]},c=a.costUsd===null?``:`; spend $${a.costUsd.toFixed(4)}`;if(i.status===`completed`)return e(`Run ${i.id} completed${c}`,o,s);let l=i.failureClass?` (${i.failureClass})`:``,u=i.error?`: ${i.error}`:``;return{...e(`Run ${i.id} ${i.status}${l}${c}${u}`,o,s),ok:!1}}async function h(e,n,r){let{runOpenApiCall:i}=await import(`./openapi-call-DZE6bLbj.js`),{isTransientRefusal:a,isTransportFailure:o}=await import(`./request-replay-DYW0dljL.js`),{retrySeconds:c}=await import(`./response-problem-C3yfskNU.js`),l=n-Date.now();if(l<=0)return{kind:`deadline`};let u=AbortSignal.timeout(Math.min(s,l)),d;try{d=await i({method:`GET`,path:e,auth:`auto`,responseFormat:`json`,signal:u})}catch(e){if(o(e)||u.aborted&&e instanceof Error&&e.cause instanceof Error&&e.cause.name===`AbortError`&&e.cause.cause===u.reason)return{kind:`transient`,reason:String(e)};throw e}if(!d.ok){let{problem:n}=d;if(n!==void 0&&a(n.status,n)){let e=c(n.retryAfterSeconds);return{kind:`transient`,reason:d.summary,...e===void 0?{}:{retryAfterSeconds:e}}}return{kind:`refused`,envelope:t(`GET ${e} failed: ${d.summary}`,d.warnings,{problem:n})}}let f=d.data,p=r.safeParse(typeof f==`object`&&f&&`response`in f?f.response:void 0);return p.success?{kind:`detail`,detail:p.data}:{kind:`refused`,envelope:t(`${e} returned an unexpected body: ${p.error.message}`)}}export{u as registerBuiltinRunWaitCommand};
@@ -1,3 +1,3 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{a as t,n,r,t as i}from"./package-DEeHDoOT.js";import{c as a,r as o}from"./result-envelope-DhuT_8lW.js";import{n as s}from"./output-OV1lH-WC.js";import{a as c,t as l}from"./output-mode-CE87SvLV.js";import{t as u}from"./completion-setup-CwJt88xW.js";import{spawnSync as d}from"node:child_process";import{basename as f,dirname as p,relative as m,resolve as h,sep as g}from"node:path";import{existsSync as _,lstatSync as v,mkdirSync as y,mkdtempSync as b,readdirSync as x,readlinkSync as S,realpathSync as C,renameSync as w,symlinkSync as T}from"node:fs";import{randomUUID as E}from"node:crypto";var D=new Intl.Collator(void 0,{numeric:!0}),O=2e4,k=[`lib`,`aventurevc-releases`];function A(n,r=t()){let i=r.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;l(n.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${i}`].join(`
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{a as t,n,r,t as i}from"./package-DEeHDoOT.js";import{c as a,r as o}from"./result-envelope-DhuT_8lW.js";import{n as s}from"./output-BL3uMwJp.js";import{a as c,t as l}from"./output-mode-CE87SvLV.js";import{t as u}from"./completion-setup-CwJt88xW.js";import{spawnSync as d}from"node:child_process";import{basename as f,dirname as p,relative as m,resolve as h,sep as g}from"node:path";import{existsSync as _,lstatSync as v,mkdirSync as y,mkdtempSync as b,readdirSync as x,readlinkSync as S,realpathSync as C,renameSync as w,symlinkSync as T}from"node:fs";import{randomUUID as E}from"node:crypto";var D=new Intl.Collator(void 0,{numeric:!0}),O=2e4,k=[`lib`,`aventurevc-releases`];function A(n,r=t()){let i=r.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;l(n.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${i}`].join(`
2
2
  `)).addOption(new e(`--execute`).hideHelp()).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>s({mode:c(e)},j(void 0,`apply`,e.release)))}function j(e,i=`apply`,s){let c=e;try{c??=t(process.argv[1])}catch(e){return o(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let l=c.name,u=c.version,d=c.registry===``?``:n,p=c.registry===``&&l===`@aventurevc/aventure-cli`,m=s;if(m===void 0){let e=M([`view`,d,`version`,`--silent`,`--global`],c,{timeout:O});if(!e.ok)return{...e,data:null};if(m=(e.data??``).trim(),m===``)return o(`npm view ${d} returned empty version`,[`empty_stdout`])}let g=s!==void 0||p||D.compare(u,m)<0,v={targetPackage:d,runningPackage:l,currentVersion:u,latestVersion:m,upgradeAvailable:g,upgradeInstalled:!1};if(i===`check`)return a(`${l}@${u} → ${d}@${m} (${g?`available`:`up to date`})`,v);if(c.workingTreeRoot!==null)return o(`Refusing to install over the working-tree build at ${c.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=F(c),t=h(e,...k),n=f(d),i=h(t,`${n}-current`),o=d===``?[d,``]:[d,r],l=I(e,c),p=s??[m,l?.version??u].reduce((e,t)=>D.compare(e,t)<0?t:e,u);y(t,{recursive:!0});let g=[P(c),..._(i)?[C(i)]:[],...x(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>h(t,e.name))],S,w=null,T=!1;for(let t of new Set(g.filter(t=>t!==e))){let e=N(t,o,p,c.registry);if(e.ok&&e.data!==null){S=t,w=e.data;break}}if(S===void 0){S=b(h(t,`${n}-${encodeURIComponent(p)}-`));let e=M([`install`,`-g`,`--prefix`,S,...o.map(e=>`${e}@${p}`)],c,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};T=!0;let r=N(S,o,p,c.registry);if(!r.ok)return{...r,data:null};w=r.data}if(w===null)throw Error(`release verification produced no package`);let E=L(S,e,i,w,s),O=z();return a(`${d} active at ${E}`,{...v,upgradeInstalled:T||s!==void 0||l?.version!==E,installPrefix:e,verifiedVersion:E,completionRefreshed:O.refreshed,completionRefreshMessage:O.message})}catch(e){return o(`${d} update failed: ${R(e)}`,[`existing releases were preserved`])}}function M(e,t,n={}){let r={...process.env};t.registry===``?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let i=t.registry;if(t.registry===``){let e=d(`npm`,[`config`,`get`,`@aventurevc:registry`,`--global`],{env:r,encoding:`utf8`});if(e.error||e.status!==0){let t=e.error?.message??(e.stderr??``).trim();return o(`npm config get @aventurevc:registry exited ${e.status}`,[t||`no stderr`])}let t=e.stdout.trim().replace(/\/?$/,`/`);t.startsWith(`https://`)&&t!==`https://registry.npmjs.org/`&&(i=t)}let s=[...e,`--@aventurevc:registry=${i}`],c=d(`npm`,s,{env:r,encoding:`utf8`,...n});if(c.error)return c.signal===`SIGTERM`&&n.timeout!==void 0?o(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):o(`npm ${e[0]??``} failed to start: ${c.error.message}`,[`spawn_error`]);if(c.status!==0){let t=(c.stderr??``).trim().split(`
3
3
  `).slice(-3).join(` | `);return o(`npm ${e.join(` `)} exited ${c.status}`,[t||`no stderr`])}return a(`npm ok`,c.stdout??``)}function N(e,n,r,i){try{let o=n.map(n=>{let a=t(h(e,`lib`,`node_modules`,...n.split(`/`),`package.json`));if(a.name!==n||a.version!==r||a.registry!==i)throw Error(`${n} does not match ${r} from ${i}`);for(let t of a.bin)if(!C(h(e,`bin`,t)).startsWith(`${a.packageRoot}${g}`))throw Error(`${t} escapes ${a.packageRoot}`);return a});for(let t of o){let n=h(e,`bin`,t.bin[0]),i=d(process.execPath,[n,`--version`],{encoding:`utf8`,timeout:O});if(i.error)throw Error(`${t.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==r)throw Error(`${t.name} expected ${r} but reported ${a||`empty output`}`)}return a(`CLI and MCP release verified`,o)}catch(t){return o(`release verification failed: ${R(t)}`,[`release prefix: ${e}`])}}function P(e){let t=p(e.packageRoot),n=p(t),r=p(n);if(f(t)!==e.name.split(`/`)[0]||f(n)!==`node_modules`||f(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${g}`))throw Error(`the running entry escapes its package root`);return p(r)}function F(e){let t=P(e),n=`${g}${k.join(g)}${g}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function I(e,n){let r=n.registry===``?f(``):i,a=h(e,`bin`,r);if(!_(a))return null;let o=t(a);if(o.registry!==n.registry)throw Error(`${a} belongs to another product`);return o}function L(e,n,r,i,a){let o=i[0];if(o===void 0)throw Error(`release contains no CLI`);let s=h(n,`bin`);y(s,{recursive:!0});let c=i.flatMap(e=>e.bin.filter((e,n)=>{let r=h(s,e);if(!_(r)||t(r).registry===o.registry)return!0;if(o.registry!==``&&n>0)return!1;throw Error(`${r} belongs to another product`)}));if(!_(r)){let t=b(h(p(r),`${f(r)}-seed-`));y(h(t,`bin`));for(let n of c){let r=h(s,n);T(C(_(r)?r:h(e,`bin`,n)),h(t,`bin`,n))}try{T(m(p(r),t),r)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!v(r).isSymbolicLink())throw Error(`${r} is not a release symlink`);for(let e of c){let t=m(s,h(r,`bin`,e)),n=h(s,`.${e}-${E()}`);T(t,n),w(n,h(s,e))}for(let e of c){let t=h(s,e);if(!v(t).isSymbolicLink()||h(s,S(t))!==h(r,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let l=I(n,o);if(a===void 0&&l!==null&&D.compare(l.version,o.version)>0)return l.version;let u=`${r}-${E()}`;return T(m(p(r),e),u),w(u,r),o.version}function R(e){return e instanceof Error?e.message:String(e)}function z(){try{return u()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}export{A as registerBuiltinUpdateCommand,j as runUpdate};
@@ -1,3 +1,3 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{c as n}from"./result-envelope-DhuT_8lW.js";import{n as r}from"./output-OV1lH-WC.js";import{a as i,t as a}from"./output-mode-CE87SvLV.js";import{a as o,c as s,i as c,l,o as u,r as d,s as f,t as p,u as m}from"./operations-catalog-D9t_yMWi.js";var h=`Match only the first canonical or CLI-alias command segment`,g=[`text`,`lines`,`compact`,`json`,`ndjson`],_=`20`;function v(e,n,r=t().bin[0]){let a=y((e.commands.find(e=>e.name()===`help`)??e.command(`help`)).command(`catalog`).summary(`Search or list generated command metadata offline`).description([`Search or list generated ${r} command metadata without calling the API.`,`A query ranks the closest ${_} operations; no query lists every operation.`,`Run \`${r} help <command>\` for one operation's full documentation.`,`Use --format lines for rg/grep/ag/ack, ndjson|json for ast-grep/sg/parsers,`,"and compact for one `cli · summary · requiredFlags` row per operation."].join(`
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{c as n}from"./result-envelope-DhuT_8lW.js";import{n as r}from"./output-BL3uMwJp.js";import{a as i,t as a}from"./output-mode-CE87SvLV.js";import{a as o,c as s,i as c,l,o as u,r as d,s as f,t as p,u as m}from"./operations-catalog-fUC6msyN.js";var h=`Match only the first canonical or CLI-alias command segment`,g=[`text`,`lines`,`compact`,`json`,`ndjson`],_=`20`;function v(e,n,r=t().bin[0]){let a=y((e.commands.find(e=>e.name()===`help`)??e.command(`help`)).command(`catalog`).summary(`Search or list generated command metadata offline`).description([`Search or list generated ${r} command metadata without calling the API.`,`A query ranks the closest ${_} operations; no query lists every operation.`,`Run \`${r} help <command>\` for one operation's full documentation.`,`Use --format lines for rg/grep/ag/ack, ndjson|json for ast-grep/sg/parsers,`,"and compact for one `cli · summary · requiredFlags` row per operation."].join(`
2
2
  `)).argument(`[query...]`,`Words to rank operations by; omit to list every operation`));a.addHelpText(`after`,()=>b(r)),a.action(function(e){let t=this.optsWithGlobals(),a=c(t,e),o=(a.q?.trim()??``)!==``;u(o&&t.limit===void 0?{...a,limit:_}:a,n,i(t,`text`),r)})}function y(t){return t.option(`--root <root>`,h).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(g)).option(`--output <path>`,`Write rendered output to a file`),a(t),t}function b(e){return[``,`Shipped with this install, greppable without running this CLI:`,` ${p(e)} (operations callable without an admin grant)`,` ${d(e)} (every operation's CLI, API, and MCP forms as JSON)`,``].join(`
3
3
  `)}function x(e,n,r=t().bin[0]){let i=e.command(`command-catalog`,{hidden:!0}).summary(`Deprecated: run \`${r} help catalog\``).description(`Deprecated: run \`${r} help catalog\` to search or list operations, and \`${r} help <command>\` for one operation.`);C(i,n,r),w(i,n,r),T(i,n,r),E(i,r)}function S(e,t,n){return e.hook(`preAction`,()=>{process.stderr.write(`warning: Deprecated: \`${t} command-catalog ${e.name()}\` is replaced by \`${t} ${n}\`.\n`)})}function C(e,t,n){let r=y(e.command(`search`).summary("Deprecated: run `help catalog <query...>`").argument(`[query...]`,`Search query; same as --q.`).option(`--q <query>`,`Search generated command metadata`));S(r,n,`help catalog <query...>`),r.action(function(e){let r=this.optsWithGlobals(),a=c(r,e),o=(a.q?.trim()??``)===``?t.filter(({deprecated:e})=>e!==!0):t;u({...a,limit:r.limit??_},o,i(r,`text`),n)})}function w(t,n,r){let o=t.command(`show`).summary("Deprecated: run `help <command>`").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`);a(S(o,r,`help <command>`)),o.action(function(){let e=this.optsWithGlobals();f(e,n,i(e,`text`),r)})}function T(e,t,n){let r=y(e.command(`dump`).summary("Deprecated: run `help catalog`"));S(r,n,`help catalog`),r.action(function(){let e=this.optsWithGlobals();u(e,t,i(e,`text`),n)})}function E(e,t){let c=e.command(`unified`).summary(`Deprecated: read the shipped unified-operations.json`).option(`--output <path>`,`Write unified operations JSON to a file`);a(S(c,t,`help catalog --help`)),c.action(async function(){let e=this.optsWithGlobals(),t=i(e,`text`),{MCP_GENERATION_CONTRACT:a}=await import(`./mcp-generation-contract-Cn0k8qOJ.js`);if(t===`text`&&e.output===void 0&&(e.text===!0||e.allFields===!0)){r({mode:t},n(`Unified operations JSON`,`Use --output <path> to write the unified operations JSON.`,{counts:{totalOperations:a.length}}));return}let c=s(a);if(e.output!==void 0){let i=m(e.output,c);r({mode:t},n(`Unified operations JSON written`,{outputPath:i.target,byteLength:i.byteLength,schemaVersion:c.schemaVersion},{counts:{totalOperations:i.totalOperations}}))}else t===`text`?o(`Unified operations JSON`,l(c)):r({mode:t},n(`Unified operations JSON`,c,{counts:{totalOperations:c.totalOperations}}))})}export{v as registerHelpCatalogCommand,x as registerRetiredCommandCatalog};
@@ -0,0 +1 @@
1
+ export{s as writeShowResult}from"./operations-catalog-fUC6msyN.js";
@@ -1,4 +1,4 @@
1
- import{a as e}from"./package-DEeHDoOT.js";import{c as t,r as n}from"./result-envelope-DhuT_8lW.js";import{s as r}from"./tool-policy-DYjF2wFZ.js";import{a as i}from"./output-spill-Cdl7NULe.js";import"./startup-auth-B0hdVmRP.js";import{i as a,r as o}from"./operations-metadata-DnrouEku.js";import{n as s}from"./output-OV1lH-WC.js";import{fileURLToPath as c}from"node:url";import{dirname as l,resolve as u}from"node:path";import{existsSync as d,mkdirSync as f,writeFileSync as p}from"node:fs";var m=`unified-operations.json`;function h(e,t=new Date){let n=v(e);return{schemaVersion:1,generatedFrom:`MCP_GENERATION_CONTRACT`,generatedAt:t.toISOString(),totalOperations:n.length,note:`1:1 projection of MCP_GENERATION_CONTRACT written by the CLI build ([MCP1b.1-EXC1]).`,operations:n}}function g(e){return`${JSON.stringify(e,null,2)}\n`}function _(e,t){let n=u(e),r=g(t);return f(l(n),{recursive:!0}),p(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function v(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:r(e),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 y=`command-catalog.compact.txt`,b=`dist/aventure-cli`,x=` · `,S=`-`;function C(t=e().bin[0]){return T(y,t)}function w(t=e().bin[0]){return T(m,t)}function T(e,t){return u(E(l(c(import.meta.url)),t),b,e)}function E(e,t){let n=e;for(;;){if(d(u(n,`package.json`)))return n;let r=l(n);if(r===n)throw Error(`No package.json above ${e}; ${t} is not in a package layout.`);n=r}}function D(e,t){let n=t.join(` `).trim();return n.length===0?e:{...e,q:e.q===void 0?n:`${e.q} ${n}`}}function O(t,n,r,i=e().bin[0]){let a=o(t,n,i);!a.ok||a.data===null?s({mode:r},a):A({opts:t,mode:r,data:a.data,defaultFormat:`lines`,rendered:N(a.data,M(t.format,`lines`)),summary:`Generated operation matches`})}function k(t,n,r,i=e().bin[0]){let o=a(t,n,i);!o.ok||o.data===null?s({mode:r},o):A({opts:t,mode:r,data:o.data,defaultFormat:`usage`,rendered:P(o.data,M(t.format,`usage`)),summary:`Generated operation detail`})}function A(e){let r=e.mode,i=M(e.opts.format,e.defaultFormat),a=e.opts.text===!0||e.opts.allFields===!0;if(e.opts.output===void 0&&a&&(i===`json`||i===`ndjson`)){s({mode:r},n(`--text or --all-fields cannot be combined with --format json or ndjson`,[`Omit the text flag for machine output, or use --format lines, compact, or text.`]));return}let o=e.opts.output===void 0&&r===`text`&&`count`in e.data&&e.data.count.matched===0&&(a||e.opts.format===void 0||i===`text`)?`No generated operations matched.`:e.rendered,c=o.endsWith(`
1
+ import{a as e}from"./package-DEeHDoOT.js";import{c as t,r as n}from"./result-envelope-DhuT_8lW.js";import{s as r}from"./tool-policy-DYjF2wFZ.js";import{a as i}from"./output-spill-Cdl7NULe.js";import"./startup-auth-B0hdVmRP.js";import{i as a,r as o}from"./operations-metadata-DnrouEku.js";import{n as s}from"./output-BL3uMwJp.js";import{fileURLToPath as c}from"node:url";import{dirname as l,resolve as u}from"node:path";import{existsSync as d,mkdirSync as f,writeFileSync as p}from"node:fs";var m=`unified-operations.json`;function h(e,t=new Date){let n=v(e);return{schemaVersion:1,generatedFrom:`MCP_GENERATION_CONTRACT`,generatedAt:t.toISOString(),totalOperations:n.length,note:`1:1 projection of MCP_GENERATION_CONTRACT written by the CLI build ([MCP1b.1-EXC1]).`,operations:n}}function g(e){return`${JSON.stringify(e,null,2)}\n`}function _(e,t){let n=u(e),r=g(t);return f(l(n),{recursive:!0}),p(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function v(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:r(e),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 y=`command-catalog.compact.txt`,b=`dist/aventure-cli`,x=` · `,S=`-`;function C(t=e().bin[0]){return T(y,t)}function w(t=e().bin[0]){return T(m,t)}function T(e,t){return u(E(l(c(import.meta.url)),t),b,e)}function E(e,t){let n=e;for(;;){if(d(u(n,`package.json`)))return n;let r=l(n);if(r===n)throw Error(`No package.json above ${e}; ${t} is not in a package layout.`);n=r}}function D(e,t){let n=t.join(` `).trim();return n.length===0?e:{...e,q:e.q===void 0?n:`${e.q} ${n}`}}function O(t,n,r,i=e().bin[0]){let a=o(t,n,i);!a.ok||a.data===null?s({mode:r},a):A({opts:t,mode:r,data:a.data,defaultFormat:`lines`,rendered:N(a.data,M(t.format,`lines`)),summary:`Generated operation matches`})}function k(t,n,r,i=e().bin[0]){let o=a(t,n,i);!o.ok||o.data===null?s({mode:r},o):A({opts:t,mode:r,data:o.data,defaultFormat:`usage`,rendered:P(o.data,M(t.format,`usage`)),summary:`Generated operation detail`})}function A(e){let r=e.mode,i=M(e.opts.format,e.defaultFormat),a=e.opts.text===!0||e.opts.allFields===!0;if(e.opts.output===void 0&&a&&(i===`json`||i===`ndjson`)){s({mode:r},n(`--text or --all-fields cannot be combined with --format json or ndjson`,[`Omit the text flag for machine output, or use --format lines, compact, or text.`]));return}let o=e.opts.output===void 0&&r===`text`&&`count`in e.data&&e.data.count.matched===0&&(a||e.opts.format===void 0||i===`text`)?`No generated operations matched.`:e.rendered,c=o.endsWith(`
2
2
  `)?o:`${o}\n`;e.opts.output===void 0?r===`text`?j(e.summary,c):s({mode:r},t(e.summary,e.data,{counts:B(e.data)})):(p(e.opts.output,c),s({mode:r},t(e.summary,{outputPath:e.opts.output,byteLength:Buffer.byteLength(c,`utf8`),format:i},{counts:B(e.data)})))}function j(e,n){let r=i(t(e,n));!r.ok||r.data===null?s({mode:`text`},r):process.stdout.write(r.data.endsWith(`
3
3
  `)?r.data:`${r.data}\n`)}function M(e,t){return e??t}function N(e,t){return t===`json`?JSON.stringify(e,null,2):t===`ndjson`?e.operation.map(e=>JSON.stringify(e)).join(`
4
4
  `):t===`text`?L(e.operation):t===`compact`?e.operation.map(F).join(`
@@ -1 +1 @@
1
- export{n as emit,i as emitJson,a as emitSearchExplanation,o as pendingResult}from"./output-OV1lH-WC.js";
1
+ export{n as emit,i as emitJson,a as emitSearchExplanation,o as pendingResult}from"./output-BL3uMwJp.js";
@@ -1,4 +1,4 @@
1
- import{a as e}from"./package-DEeHDoOT.js";import{n as t,r as n}from"./result-envelope-DhuT_8lW.js";import{o as r}from"./logging-DqesyM4A.js";import{a as i,n as a,r as o,t as s}from"./output-spill-Cdl7NULe.js";import{j as c}from"./help-catalog-ByQFO96d.js";import{r as l}from"./response-problem-DaJm66IX.js";import{t as u}from"./openapi-commands-BEyhfc6I.js";import{a as d,i as f,n as p,o as m,r as h,t as g}from"./text-response-Ed52ZoIC.js";import{resolve as _}from"node:path";import{tmpdir as v}from"node:os";import{randomUUID as y}from"node:crypto";var b=1e4;function x(e,t){let n=t.data,r=`jobId`,i=`statusUrl`,a=t.rolloverJob?.jobId??(typeof n==`object`&&n&&r in n&&typeof n[r]==`string`?n[r]:void 0),o=t.rolloverJob?.statusUrl??t.headers.location??(typeof n==`object`&&n&&i in n&&typeof n[i]==`string`?n[i]:void 0),s=t.headers[`retry-after`],c=o===void 0?void 0:d(o,u),l=`Pending, not a failure: ${e.operationId??`request`}${a===void 0?``:` job ${a}`} is still running, and its result is stored when it finishes.`+(s===void 0?``:` Retry-After: ${s}.`)+(c===void 0?o===void 0?``:` Poll GET ${o} for the result.`:` Read the result in a few minutes ${c}; do not resend the request.`);return{...e,summary:l,warnings:[...e.warnings,l],ids:a===void 0?e.ids:[...new Set([...e.ids,a])],references:o===void 0?e.references:[...new Set([...e.references,o])]}}function S(e){let t=E(e);return O(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function C(e){let t,n=E(e,{foldRows:!1,humanText:!0,onSpill:e=>{t=h(e)}});O(n);let r=g(u,n.data,n.summary,{heading:n.ok?void 0:`[FAIL] ${n.summary}`,trailer:[...n.ok||n.problem===void 0?[]:l(n.problem),...w(n)],exactRecovery:t}),i=[];if(r!==null)return process.stdout.write(r.endsWith(`
1
+ import{a as e}from"./package-DEeHDoOT.js";import{n as t,r as n}from"./result-envelope-DhuT_8lW.js";import{o as r}from"./logging-DqesyM4A.js";import{a as i,n as a,r as o,t as s}from"./output-spill-Cdl7NULe.js";import{j as c}from"./help-catalog-ByQFO96d.js";import{r as l}from"./response-problem-DaJm66IX.js";import{t as u}from"./openapi-commands-BEyhfc6I.js";import{d,f,m as p,n as m,p as h,t as g}from"./text-response-BvrwYvKW.js";import{resolve as _}from"node:path";import{tmpdir as v}from"node:os";import{randomUUID as y}from"node:crypto";var b=1e4;function x(e,t){let n=t.data,r=`jobId`,i=`statusUrl`,a=t.rolloverJob?.jobId??(typeof n==`object`&&n&&r in n&&typeof n[r]==`string`?n[r]:void 0),o=t.rolloverJob?.statusUrl??t.headers.location??(typeof n==`object`&&n&&i in n&&typeof n[i]==`string`?n[i]:void 0),s=t.headers[`retry-after`],c=o===void 0?void 0:h(o,u),l=`Pending, not a failure: ${e.operationId??`request`}${a===void 0?``:` job ${a}`} is still running, and its result is stored when it finishes.`+(s===void 0?``:` Retry-After: ${s}.`)+(c===void 0?o===void 0?``:` Poll GET ${o} for the result.`:` Read the result in a few minutes ${c}; do not resend the request.`);return{...e,summary:l,warnings:[...e.warnings,l],ids:a===void 0?e.ids:[...new Set([...e.ids,a])],references:o===void 0?e.references:[...new Set([...e.references,o])]}}function S(e){let t=E(e);return O(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function C(e){let t,n=E(e,{foldRows:!1,humanText:!0,onSpill:e=>{t=d(e)}});O(n);let r=g(u,n.data,n.summary,{heading:n.ok?void 0:`[FAIL] ${n.summary}`,trailer:[...n.ok||n.problem===void 0?[]:l(n.problem),...w(n)],exactRecovery:t}),i=[];if(r!==null)return process.stdout.write(r.endsWith(`
2
2
  `)?r:`${r}\n`),n;let a=n.ok?`OK`:`FAIL`;return i.push(`[${a}] ${n.summary}`),!n.ok&&n.problem!==void 0&&i.push(...l(n.problem)),i.push(...w(n)),process.stdout.write(c(i.join(`
3
- `),{appendNewline:!0})),n}function w(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 T(e,t){if(e.mode===`csv`||e.mode===`xlsx`){if(!t.ok){T({mode:`json`},t);return}if(e.mode===`xlsx`&&!(t.data instanceof Uint8Array)){T({mode:`json`},n(`This operation does not offer XLSX; use --csv.`));return}let r=t.data instanceof Uint8Array?t.data:m(o(t.data));a()===void 0?(O(t),process.stdout.write(r)):T({mode:`data`},i({...t,data:r}));return}let r=a(),s=i(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?E(s,{allowSpill:r===void 0}):s;O(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?o(t.data):t)}\n`),t.ok||(process.exitCode=1)}else(e.mode===`json`?S(s):C(s)).ok||(process.exitCode=1)}function E(e,n={}){let r=Number(process.env.BASH_MAX_OUTPUT_LENGTH),a=Math.min(Number.isSafeInteger(r)&&r>0?r:1/0,e.ok?1/0:b),o={...f(e,u),...n,...Number.isSafeInteger(a)&&a>0?{maxBytes:Math.min(n.maxBytes??5e4,Math.floor(a/2))}:{}},c=t(e,o),l=!1;if(n.humanText===!0&&e.ok&&g(u,c.data,c.summary,{trailer:w(c),onOmission:()=>{l=!0}}),n.allowSpill===!1||o.write===!0&&n.humanText===!0||!l&&(c===e||c.truncated!==!0))return c;let d=process.env.AVENTURE_HARNESS_RUN_DATA_ROOT,p=_(d?_(d,`scratchpad`):v(),`aventure-output-${y()}.json`);s(p);let m,x=i(e,e=>{m=e});return m===void 0?x:(n.onSpill?.(p),t(e,{...o,exactRecovery:h(p),spill:m}))}function D(e,t){if(typeof t==`object`&&t&&`httpStatus`in t&&t.httpStatus===202)return;let n=p(t);n===null?(process.stderr.write(`explain: the response carried no search interpretation
3
+ `),{appendNewline:!0})),n}function w(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 T(e,t){if(e.mode===`csv`||e.mode===`xlsx`){if(!t.ok){T({mode:`json`},t);return}if(e.mode===`xlsx`&&!(t.data instanceof Uint8Array)){T({mode:`json`},n(`This operation does not offer XLSX; use --csv.`));return}let r=t.data instanceof Uint8Array?t.data:p(o(t.data));a()===void 0?(O(t),process.stdout.write(r)):T({mode:`data`},i({...t,data:r}));return}let r=a(),s=i(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?E(s,{allowSpill:r===void 0}):s;O(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?o(t.data):t)}\n`),t.ok||(process.exitCode=1)}else(e.mode===`json`?S(s):C(s)).ok||(process.exitCode=1)}function E(e,n={}){let r=Number(process.env.BASH_MAX_OUTPUT_LENGTH),a=Math.min(Number.isSafeInteger(r)&&r>0?r:1/0,e.ok?1/0:b),o={...f(e,u),...n,...Number.isSafeInteger(a)&&a>0?{maxBytes:Math.min(n.maxBytes??5e4,Math.floor(a/2))}:{}},c=t(e,o),l=!1;if(n.humanText===!0&&e.ok&&g(u,c.data,c.summary,{trailer:w(c),onOmission:()=>{l=!0}}),n.allowSpill===!1||o.write===!0&&n.humanText===!0||!l&&(c===e||c.truncated!==!0))return c;let p=process.env.AVENTURE_HARNESS_RUN_DATA_ROOT,m=_(p?_(p,`scratchpad`):v(),`aventure-output-${y()}.json`);s(m);let h,x=i(e,e=>{h=e});return h===void 0?x:(n.onSpill?.(m),t(e,{...o,exactRecovery:d(m),spill:h}))}function D(e,t){if(typeof t==`object`&&t&&`httpStatus`in t&&t.httpStatus===202)return;let n=m(t);n===null?(process.stderr.write(`explain: the response carried no search interpretation
4
4
  `),process.exitCode=1):(e===`text`?process.stdout:process.stderr).write(n)}function O(t){if(t.ok&&t.warnings.length===0)return;let n=t.truncation===void 0?t.warnings:[...t.warnings,`omitted: ${t.truncation.omitted.join(`, `)}`,`recovery: ${t.truncation.recovery}`];r({component:e().bin[0],event:t.ok?`command_warning`:`command_failed`,message:n.length>0?n.join(` | `):t.summary,fields:{warningCount:t.warnings.length,summary:t.summary}})}export{D as a,S as i,T as n,x as o,C as r,b as t};
@@ -1,4 +1,4 @@
1
- import{u as e}from"./tool-policy-DYjF2wFZ.js";import{g as t,h as n}from"./help-catalog-ByQFO96d.js";import{c as r,s as i}from"./startup-auth-B0hdVmRP.js";import{t as a}from"./openapi-commands-BEyhfc6I.js";import{r as o}from"./operations-metadata-DnrouEku.js";import{n as s}from"./operations-catalog-D9t_yMWi.js";import{a as c,t as l}from"./payload-operand-guard-C8eAl3-g.js";function u(e,t){return e.message.match(RegExp(`${t} '([^']+)'`,`iu`))?.[1]?.split(/\s+/u)[0]}function d(e){return e.flags.split(` `)[0]??e.flags}function f(e,t){let n=u(t,`required option`),r=e.options.findIndex(e=>d(e)===n);if(r<0)return;let i=new Set((M(c(e))?.parameters??[]).flatMap(e=>e.location===`path`?[e.optionKey]:[])),a=e.options.slice(r+1).find(t=>{let n=e.getOptionValue(t.attributeName());return i.has(t.attributeName())&&typeof n==`string`&&n!==``});if(a!==void 0)return`hint: ${n} is still required for this nested command; supplied child selector ${d(a)} does not replace the parent selector.`}var p=[[`--search`,`--query`,`--q`,`--term`,`--keyword`],[`--size`,`--limit`,`--page-size`,`--per-page`],[`--transaction-id`,`--fundraise-round-id`]];function m(e){let t=new Set(e.options.map(d)),n=process.argv.indexOf(`--`),r=new Set(n<0?process.argv:process.argv.slice(0,n));return e.args.filter(e=>r.has(e)&&/^--[^-=]/u.test(e)).map(e=>e.split(`=`)[0]??e).filter(e=>!t.has(e))}function h(e){let t=M(c(e))?.parameters??[],n=m(e).flatMap(n=>{let r=p.find(e=>e.includes(n))?.find(t=>e.options.some(e=>d(e)===t))??t.filter(({name:e})=>`--${e.replace(/[A-Z]/gu,`-$&`).toLowerCase()}`===n).map(e=>e.flag.split(` `)[0])[0];return r===void 0?[]:[`use ${r}, not ${n}`]});return n.length===0?void 0:`hint: ${n.join(`; `)}`}function g(e){return e.commands.length===0?[e]:e.commands.flatMap(g)}function _(e){return e.parent===null?e:_(e.parent)}function v(e,t){let n=t=>{let n=c(t).slice(c(e).length);return n.length*2+ +![`get`,`list`].includes(n.at(-1)??``)};return t.toSorted((e,t)=>n(e)-n(t))[0]}function y(e){return/^[A-Za-z0-9_./:=@+-]+$/u.test(e)?e:`'${e.replaceAll(`'`,`'"'"'`)}'`}function b(e,t){let n=[...e.options,...e.createHelp().visibleOptions(e)];for(let t=e.parent;t!==null;t=t.parent)n.push(...t.options);let r=t,i;for(let e=0;e<t.length;e++){let a=t[e];if(a===void 0||a===`--`)break;if(!a.startsWith(`-`)||a===`-`||i?.variadic&&Number.isFinite(Number(a)))continue;let o=a.indexOf(`=`),s=o<0?a:a.slice(0,o);if(i=n.find(e=>e.short===s||e.long===s),i===void 0||o>=0&&!i.required&&!i.optional){r=[`--help`];break}o<0&&(i.required||i.optional&&!t[e+1]?.startsWith(`-`))&&e++}return[_(e).name(),...c(e),...r].map(y).join(` `)}function x(e,t){let n=u(t,`unknown option`);if(n===void 0||e.commands.length===0)return;let r=v(e,g(e).filter(e=>e.options.some(e=>d(e)===n)));return r===void 0?void 0:`hint: run: ${b(r,process.argv.slice(2+c(e).length))}`}function S(e){return e!==void 0&&Object.hasOwn(r,e)}function C(e,t){return t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e)}function w(e,t){let n=c(e),r=[...n.slice(1),t];if(!S(n.at(0))||!S(r.at(0)))return;let i=C(_(e),r);if(i===void 0)return;let a=i;for(let e of process.argv.slice(2+n.length+1)){if(e.startsWith(`-`))break;let t=a.commands.find(t=>t.name()===e);if(t===void 0)break;r.push(e),a=t}return r}function T(e,t){let[n]=c(e);if(n===void 0||!S(n))return;let r=[n,t];return C(_(e),r)?.commands.length===0?r:void 0}function E(e){let[t,...n]=e.args;if(t===void 0)return[];let r=g(_(e)).map(c),i=n.findIndex((e,t)=>{let i=[...n.slice(0,t),e];return!r.some(e=>e.some((t,n)=>t===i[0]&&i.every((t,r)=>e[n+r]===t)))});return[t,...i<0?n:n.slice(0,i)]}function D(e,t,n=[]){let r=c(e),o=i(a).map(e=>e.cliPath).filter(e=>e[0]!==r[0]&&e.length>=t.length&&t.every((n,r)=>e[e.length-t.length+r]===n)),s=o.find(e=>e.length===t.length&&e.every((e,n)=>e===t[n]))??(o.length===1?o[0]:void 0);if(s===void 0)return;let l=C(_(e),s);return l===void 0?void 0:`hint: run: ${b(l,n)}`}function O(e,t,n){if(!A(t))return;let r=C(_(e),t);if(r===void 0)return;let i=e.args.slice(n.length),a=i.findIndex(e=>e.startsWith(`-`));return`hint: Did you mean: ${b(r,a<0?[]:i.slice(a))}`}function k(e){let t=c(e);if(t.at(1)!==void 0&&S(t.at(0)))return`hint: inspect generated command group: ${[_(e).name(),...t,`--help`].map(y).join(` `)}`}function A(t,n){let r=M(t)?.intent;return r!==void 0&&(n===void 0||e(r)===n)}var j=new Map(a.toReversed().map(e=>[e.cliPath.join(` `),e])),M=e=>j.get(e.join(` `));function N(e){let t=c(e).join(` `),r=i(a),o=r.find(e=>e.cliPath.join(` `)===t);return o===void 0?[]:n(o.operationId,r,_(e).name()).map(e=>`hint: ${e}`)}function P(e){let t=c(e);if(S(t.at(0))&&A(t))return`hint: inspect generated command: ${[_(e).name(),...t,`--help`].map(y).join(` `)}`}function F(t){let n=new Set,r=[];for(let i of a){let a=C(t,i.cliPath);if(a===void 0)continue;let o=a.options.map(d);if(e(i.intent))r.push(o);else for(let e of o)n.add(e)}let[i=[],...o]=r;return new Set(i.filter(e=>!n.has(e)&&o.every(t=>t.includes(e))))}function I(e,t){let n=c(e);if(A(n,!1)&&F(_(e)).has(t))return`hint: ${n.join(` `)} is a read operation; ${t} is a deprecated compatibility option only on mutation commands`}function L(e,t,n=!0){let r=_(e),l=r.commands.find(e=>e.name()===`help`),u=l?.commands.find(e=>e.name()===`catalog`);if(l===void 0||u===void 0)return;let f=[r.name(),l.name(),u.name(),t],p=c(e).at(0),m=u.options.find(e=>d(e)===`--root`),h=n&&m!==void 0&&S(p)?p:void 0;m!==void 0&&h!==void 0&&f.push(d(m),h);let g=i(a),v=o({q:t,root:h,limit:`3`},g,r.name()),b=v.ok&&v.data!==null?s(v.data,`compact`):``;return[`hint: search generated commands: ${f.map(y).join(` `)}`,...b===``?[]:[`hint: closest commands (command · summary · required flags):`],...b.split(`
1
+ import{u as e}from"./tool-policy-DYjF2wFZ.js";import{g as t,h as n}from"./help-catalog-ByQFO96d.js";import{c as r,s as i}from"./startup-auth-B0hdVmRP.js";import{t as a}from"./openapi-commands-BEyhfc6I.js";import{r as o}from"./operations-metadata-DnrouEku.js";import{n as s}from"./operations-catalog-fUC6msyN.js";import{a as c,t as l}from"./payload-operand-guard-C8eAl3-g.js";function u(e,t){return e.message.match(RegExp(`${t} '([^']+)'`,`iu`))?.[1]?.split(/\s+/u)[0]}function d(e){return e.flags.split(` `)[0]??e.flags}function f(e,t){let n=u(t,`required option`),r=e.options.findIndex(e=>d(e)===n);if(r<0)return;let i=new Set((M(c(e))?.parameters??[]).flatMap(e=>e.location===`path`?[e.optionKey]:[])),a=e.options.slice(r+1).find(t=>{let n=e.getOptionValue(t.attributeName());return i.has(t.attributeName())&&typeof n==`string`&&n!==``});if(a!==void 0)return`hint: ${n} is still required for this nested command; supplied child selector ${d(a)} does not replace the parent selector.`}var p=[[`--search`,`--query`,`--q`,`--term`,`--keyword`],[`--size`,`--limit`,`--page-size`,`--per-page`],[`--transaction-id`,`--fundraise-round-id`]];function m(e){let t=new Set(e.options.map(d)),n=process.argv.indexOf(`--`),r=new Set(n<0?process.argv:process.argv.slice(0,n));return e.args.filter(e=>r.has(e)&&/^--[^-=]/u.test(e)).map(e=>e.split(`=`)[0]??e).filter(e=>!t.has(e))}function h(e){let t=M(c(e))?.parameters??[],n=m(e).flatMap(n=>{let r=p.find(e=>e.includes(n))?.find(t=>e.options.some(e=>d(e)===t))??t.filter(({name:e})=>`--${e.replace(/[A-Z]/gu,`-$&`).toLowerCase()}`===n).map(e=>e.flag.split(` `)[0])[0];return r===void 0?[]:[`use ${r}, not ${n}`]});return n.length===0?void 0:`hint: ${n.join(`; `)}`}function g(e){return e.commands.length===0?[e]:e.commands.flatMap(g)}function _(e){return e.parent===null?e:_(e.parent)}function v(e,t){let n=t=>{let n=c(t).slice(c(e).length);return n.length*2+ +![`get`,`list`].includes(n.at(-1)??``)};return t.toSorted((e,t)=>n(e)-n(t))[0]}function y(e){return/^[A-Za-z0-9_./:=@+-]+$/u.test(e)?e:`'${e.replaceAll(`'`,`'"'"'`)}'`}function b(e,t){let n=[...e.options,...e.createHelp().visibleOptions(e)];for(let t=e.parent;t!==null;t=t.parent)n.push(...t.options);let r=t,i;for(let e=0;e<t.length;e++){let a=t[e];if(a===void 0||a===`--`)break;if(!a.startsWith(`-`)||a===`-`||i?.variadic&&Number.isFinite(Number(a)))continue;let o=a.indexOf(`=`),s=o<0?a:a.slice(0,o);if(i=n.find(e=>e.short===s||e.long===s),i===void 0||o>=0&&!i.required&&!i.optional){r=[`--help`];break}o<0&&(i.required||i.optional&&!t[e+1]?.startsWith(`-`))&&e++}return[_(e).name(),...c(e),...r].map(y).join(` `)}function x(e,t){let n=u(t,`unknown option`);if(n===void 0||e.commands.length===0)return;let r=v(e,g(e).filter(e=>e.options.some(e=>d(e)===n)));return r===void 0?void 0:`hint: run: ${b(r,process.argv.slice(2+c(e).length))}`}function S(e){return e!==void 0&&Object.hasOwn(r,e)}function C(e,t){return t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e)}function w(e,t){let n=c(e),r=[...n.slice(1),t];if(!S(n.at(0))||!S(r.at(0)))return;let i=C(_(e),r);if(i===void 0)return;let a=i;for(let e of process.argv.slice(2+n.length+1)){if(e.startsWith(`-`))break;let t=a.commands.find(t=>t.name()===e);if(t===void 0)break;r.push(e),a=t}return r}function T(e,t){let[n]=c(e);if(n===void 0||!S(n))return;let r=[n,t];return C(_(e),r)?.commands.length===0?r:void 0}function E(e){let[t,...n]=e.args;if(t===void 0)return[];let r=g(_(e)).map(c),i=n.findIndex((e,t)=>{let i=[...n.slice(0,t),e];return!r.some(e=>e.some((t,n)=>t===i[0]&&i.every((t,r)=>e[n+r]===t)))});return[t,...i<0?n:n.slice(0,i)]}function D(e,t,n=[]){let r=c(e),o=i(a).map(e=>e.cliPath).filter(e=>e[0]!==r[0]&&e.length>=t.length&&t.every((n,r)=>e[e.length-t.length+r]===n)),s=o.find(e=>e.length===t.length&&e.every((e,n)=>e===t[n]))??(o.length===1?o[0]:void 0);if(s===void 0)return;let l=C(_(e),s);return l===void 0?void 0:`hint: run: ${b(l,n)}`}function O(e,t,n){if(!A(t))return;let r=C(_(e),t);if(r===void 0)return;let i=e.args.slice(n.length),a=i.findIndex(e=>e.startsWith(`-`));return`hint: Did you mean: ${b(r,a<0?[]:i.slice(a))}`}function k(e){let t=c(e);if(t.at(1)!==void 0&&S(t.at(0)))return`hint: inspect generated command group: ${[_(e).name(),...t,`--help`].map(y).join(` `)}`}function A(t,n){let r=M(t)?.intent;return r!==void 0&&(n===void 0||e(r)===n)}var j=new Map(a.toReversed().map(e=>[e.cliPath.join(` `),e])),M=e=>j.get(e.join(` `));function N(e){let t=c(e).join(` `),r=i(a),o=r.find(e=>e.cliPath.join(` `)===t);return o===void 0?[]:n(o.operationId,r,_(e).name()).map(e=>`hint: ${e}`)}function P(e){let t=c(e);if(S(t.at(0))&&A(t))return`hint: inspect generated command: ${[_(e).name(),...t,`--help`].map(y).join(` `)}`}function F(t){let n=new Set,r=[];for(let i of a){let a=C(t,i.cliPath);if(a===void 0)continue;let o=a.options.map(d);if(e(i.intent))r.push(o);else for(let e of o)n.add(e)}let[i=[],...o]=r;return new Set(i.filter(e=>!n.has(e)&&o.every(t=>t.includes(e))))}function I(e,t){let n=c(e);if(A(n,!1)&&F(_(e)).has(t))return`hint: ${n.join(` `)} is a read operation; ${t} is a deprecated compatibility option only on mutation commands`}function L(e,t,n=!0){let r=_(e),l=r.commands.find(e=>e.name()===`help`),u=l?.commands.find(e=>e.name()===`catalog`);if(l===void 0||u===void 0)return;let f=[r.name(),l.name(),u.name(),t],p=c(e).at(0),m=u.options.find(e=>d(e)===`--root`),h=n&&m!==void 0&&S(p)?p:void 0;m!==void 0&&h!==void 0&&f.push(d(m),h);let g=i(a),v=o({q:t,root:h,limit:`3`},g,r.name()),b=v.ok&&v.data!==null?s(v.data,`compact`):``;return[`hint: search generated commands: ${f.map(y).join(` `)}`,...b===``?[]:[`hint: closest commands (command · summary · required flags):`],...b.split(`
2
2
  `).filter(Boolean).map(e=>` ${e}`)].join(`
3
3
  `)}function R(e,n=``){if(e.commands.length>0&&!A(c(e)))return;let r=e.options.flatMap(e=>e.hidden?[]:[d(e)]),o=i(a),s=t(n,o,c(e),_(e).name());return`${s===void 0?``:`hint: an id you already hold is read with: ${s}\n`}hint: ${c(e).join(` `)} accepts: ${r.join(` `)}`}function z(e,t){let n=u(t,`unknown command`);if(n===void 0||t.message.includes(`
4
4
  (Did you mean `))return;let r=E(e),i=process.argv.slice(2+c(e).length);if(r.length>0&&r.every((e,t)=>i[t]===e)){let t=D(e,r);if(t!==void 0)return t}let a=c(e),o=[...a.slice(0,-1),`${a.at(-1)}-${n}`,...r.slice(1)],s=(A(o)?o:void 0)??w(e,n)??T(e,n);if(s!==void 0)return O(e,s,r)??L(e,s.join(` `),!1);let l=r.join(` `)||n,d=k(e)??L(e,l),f=[...a,...r.slice(1)];return[d,r.length===a.length+a.length&&a.at(-1)===a.at(0)?O(e,f,r)?.replace(/^hint: Did you mean: /u,` `).concat(` · `):f.slice(1,-1).length>0?O(e,f,r):void 0].filter(e=>e!==void 0).join(`
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./package-DEeHDoOT.js";import{S as t,_ as n,s as r}from"./iso-DzqMxtky.js";import{r as i}from"./result-envelope-DhuT_8lW.js";import{i as a,n as o}from"./openapi-call-CUs1Yi5y.js";import{t as s}from"./openapi-commands-BEyhfc6I.js";import{a as c,c as l,i as u,l as d,o as f,r as p,s as m,u as h}from"./text-response-BvrwYvKW.js";import{n as g}from"./output-BL3uMwJp.js";import{n as _}from"./generated-body-BaGjgMKp.js";import{createInterface as v}from"node:readline/promises";var y=n({filterKey:t(),result:r(t())}),b=h.enum.size,x=`searchEntityFilters`,S=/^\s*(?<min>\d+)\s*[-–]\s*(?<max>\d+)\s*$/u,C=/^\s*\d+(?:[\s,]+\d+)*\s*$/u;async function w(e,t,n,r,i){await T({spec:e,opts:t,mode:n,payload:r,run:i,emit:e=>g({mode:n},e)})}async function T({spec:e,opts:t,mode:n,payload:r,run:i,emit:a,input:o=process.stdin,output:s=process.stdout,argv:c=process.argv.slice(2)}){if(n!==`text`||o.isTTY!==!0||s.isTTY!==!0||(N(r)?.narrowing?.question.length??0)===0)return;let l=v({input:o,output:s,terminal:!1}),u=new Promise(e=>l.once(`close`,()=>e(null))),d=e=>Promise.race([l.question(e).catch(()=>null),u]);try{await E({spec:e,opts:t,payload:r,run:i,emit:a,output:s,argv:c,ask:d})}finally{l.close()}}async function E(t){let{spec:n,output:r}=t,i=N(t.payload),a=i?.narrowing?.question[0];if(i===null||a===void 0)return;r.write(O(a));let o=await k(n,t.opts,i,a,t.ask,r);if(o===null)return;let s=D(n,t.opts,o),c=[...t.argv,...f(o)];r.write(`\n$ ${l([e().bin[0]??``,...c])}\n`);let u=await t.run(s);t.emit(u),u.ok&&await E({...t,opts:s,argv:c,payload:u.data})}function D(e,t,n){return{...t,...Object.fromEntries(u(e,n.field).map(({optionKey:e})=>[e,void 0])),...Object.fromEntries(n.option.map(({parameter:e,value:t})=>[e.optionKey,t]))}}function O({prompt:e,option:t}){let n=Math.max(...t.map(e=>m(e).length)),r=Math.max(...t.map(({count:e})=>String(e).length)),i=String(t.length).length;return[``,`${e}?`,...t.map((e,t)=>` ${String(t+1).padStart(i)} ${m(e).padEnd(n)} ${String(e.count).padStart(r)}`),``].join(`
2
+ `)}async function k(e,t,n,r,a,o){let s=(await a(`› `))?.trim()??``;if(s===``)return null;let l=C.test(s)?A(r,s):await M(e,t,n,r,s),u=typeof l==`string`?i(l):c(e,l);return u.ok&&u.data!==null?u.data:(o.write(`${u.summary}\n`),k(e,t,n,r,a,o))}function A(e,t){let n=t.split(/[\s,]+/u).map(Number);return n.filter(t=>t<1||t>e.option.length).length>0?`Pick 1 to ${e.option.length}, or type an answer.`:n.flatMap(t=>e.option[t-1]?.entityFilter??[])}function j({option:e}){return[...new Set(e.flatMap(({entityFilter:e})=>Object.keys(e)))]}async function M(e,t,n,r,i){let c=j(r),[l]=c;if(r.dimension===b&&l!==void 0){let e=S.exec(i)?.groups;return e?.min===void 0||e.max===void 0?`Type an employee range such as 10-50, or pick a number.`:[{[l]:[{min:Number(e.min),max:Number(e.max)}]}]}let u=s.find(({operationId:e})=>e===x);if(u===void 0||c.length===0)return`Pick one of the numbers.`;let d=await _(e,t),f=d.ok&&P(d.data)&&P(d.data.entityFilter)?d.data[p]:{},m=n.entity.interpretation.filter.typeRecord,h={...m===void 0?{}:{typeRecord:m},...f},g=await Promise.all(c.map(async e=>{let t={filterKey:e,query:i,scopeFilter:h},n=await a({method:u.method,path:o(u.operationId,{}),body:t,auth:u.auth,responseFormat:`json`}),r=y.safeParse(n.ok&&P(n.data)?n.data.response:void 0);return r.success?r.data.result.map(t=>({field:e,value:t})):`Could not look up “${i}”: ${n.summary}`})),v=g.find(e=>typeof e==`string`);if(v!==void 0)return v;let C=g.flatMap(e=>typeof e==`string`?[]:e),w=C.find(({value:e})=>e.toLowerCase()===i.toLowerCase())??(C.length===1?C[0]:void 0);return w===void 0?C.length===0?`Nothing matches “${i}”; pick a number or try another spelling.`:`Did you mean ${[...new Set(C.map(({value:e})=>e))].slice(0,8).join(`, `)}?`:[{[w.field]:[w.value]}]}function N(e){if(typeof e!=`object`||!e||!(`response`in e))return null;let t=d.safeParse(e.response);return t.success?t.data:null}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{w as promptAfterResult};
@@ -0,0 +1,17 @@
1
+ import{A as e,C as t,E as n,S as r,_ as i,c as a,d as o,g as s,i as c,n as l,s as u,x as d}from"./iso-DzqMxtky.js";import{a as f,c as p,d as m,f as h,i as g,l as _,n as ee,o as v,p as y,r as te,s as ne,t as re,u as ie}from"./detail-BdF_5EBq.js";import{t as ae}from"./person-owner-BW4xz8uH.js";import{r as oe}from"./run-CSLAPf8G.js";import{n as b}from"./allowance-type-BVr12WiL.js";import{t as se}from"./confidence-CjeYTBnf.js";import{c as x,p as ce,r as S}from"./result-envelope-DhuT_8lW.js";import{a as le,s as ue}from"./tool-policy-DYjF2wFZ.js";import{i as de}from"./output-spill-Cdl7NULe.js";import{a as C,c as fe,i as pe,l as me,n as w,r as T,s as E,t as he}from"./text-field-jFKOGMzr.js";import{A as ge,F as D,M as _e,N as ve,P as ye,a as be,j as xe}from"./help-catalog-ByQFO96d.js";import{n as Se,r as Ce,t as we}from"./agent-help-text-ColO_FNC.js";import{existsSync as Te}from"node:fs";import{Buffer as Ee}from"node:buffer";function De(e){if(typeof e==`object`&&e&&!Array.isArray(e)&&Array.isArray(e.column)&&e.column.every(e=>typeof e==`string`)&&Array.isArray(e.row)&&e.row.every(e=>Array.isArray(e))){let t=e.column;return{column:t,record:e.row.map(e=>new Map(t.map((t,n)=>[t,O(e[n]??null)])))}}let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:typeof e==`object`&&e&&Array.isArray(e.row)?e.row:[e],n=new Set,r=t.map(e=>{let t=new Map,r=(e,n)=>{if(Array.isArray(e))t.set(n,e.some(e=>typeof e==`object`&&!!e)?JSON.stringify(e):e.map(O).join(`; `));else if(typeof e==`object`&&e)for(let[t,i]of Object.entries(e))i!==void 0&&r(i,n===``?t:`${n}.${t}`);else t.set(n||`value`,e===null?``:String(e))};r(e,``);for(let e of t.keys())n.add(e);return t});return{column:[...n],record:r}}function O(e){return e===null?``:typeof e==`string`?e:JSON.stringify(e)}function k(e){return e.map(e=>{let t=/^[=+\-@\t\r]/u.test(e)?`'${e}`:e;return/[",\r\n]/u.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}).join(`,`)+`\r
2
+ `}function Oe(e){let{column:t,record:n}=De(e);return t.length===0?``:k(t)+n.map(e=>k(t.map(t=>e.get(t)??``))).join(``)}function ke(t){let n=ce.safeParse(JSON.parse(JSON.stringify(t??null)));if(!n.success)throw Error(`Response is not JSON, so it cannot be written as CSV: ${e(n.error)}`);return Oe(n.data)}var A=/\{([^}]+)\}/gu,Ae=/(?:^r|R)evision$/u;function je(e,t,n=`cli`){let r=t.filter(e=>e.method===`GET`&&(n===`cli`||e.binaryResponse!==!0)),i=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),a=t.find(t=>t.operationId===e.operationId),o=e.ok&&a!==void 0&&le(a.intent),s=[...o&&e.endpoint!==void 0?M(e.endpoint.split(`?`)[0]??``,r,!1,n,Pe(e.data)).map(e=>n===`mcp`?e:`${e} --data --to-file <path>`):[],...e.references.filter(e=>!i(e)).flatMap(j).flatMap(e=>M(e.pathname,r,!0,n)),...e.references.filter(i).flatMap(j).flatMap(e=>Ie(e,r,n))],c=n===`mcp`?Me:void 0,l=n===`cli`;return s.length===0?{write:o,narrowerRead:c,savesCappedPayload:l}:{exactRecovery:`Read the full result ${s.join(`; `)}.`,write:o,narrowerRead:c,savesCappedPayload:l}}var Me=`Refetch a narrower result: call aventure_help with q set to the read intent, then call aventure_read with its operationId and declared query or pathParams, using ids/references, filters, or smaller query.page/query.size windows.`;function Ne(e){let t=de(e);return`Inline output is truncated; full payload written to ${e}; read it with your file tool.`+(Te(t)?` For its long text fields, Grep ${t} or Read it with offset and limit: it holds them as short lines labeled with each field's JSON pointer and character range.`:``)}function Pe(e){let t=typeof e==`object`&&e&&`response`in e?e.response:null;return typeof t==`object`&&t?new Map(Object.entries(t).flatMap(([e,t])=>Number.isInteger(t)&&Ae.test(e)?[[e,String(t)]]:[])):new Map}function Fe(e,t){let n=t.filter(e=>e.method===`GET`);return M(new URL(e,`https://status.invalid`).pathname,n,!0,`cli`)[0]}function j(e){return URL.canParse(e)?[new URL(e)]:[]}function M(e,t,n,r,i=new Map){let a=t.filter(t=>t.path===e);return(a.length>0?a:t).flatMap(t=>{let a=[...t.path.matchAll(A)].map(([,e])=>e),o=RegExp(`^${t.path.replace(A,`([^/]+)`)}$`,`u`),s=n&&a.length===0?null:o.exec(e);if(s===null)return[];let c=t.parameters.flatMap(e=>{let t=e.location===`query`?i.get(e.name):void 0;return t===void 0?[]:[{parameter:e,pin:t}]});if(r===`mcp`)return[Le(t,{pathParams:Object.fromEntries(a.map((e,t)=>[e??``,decodeURIComponent(s[t+1]??``)])),...c.length===0?{}:{query:Object.fromEntries(c.map(({parameter:e,pin:t})=>[e.name,t]))}})];let l=a.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[N(r),s[n+1]??``]}),u=c.flatMap(({parameter:e,pin:t})=>[N(e),t]);return[`${Re(t)}, ${ze(t,[...l,...u])}`]})}function Ie(e,t,n){let r=t.find(t=>t.path===e.pathname);return r===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${r.path}/`))return[];let i=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),a=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(i===void 0||a===void 0)return[];if(n===`mcp`)return[`in windows: ${Le(t,{query:{...Object.fromEntries([...e.searchParams].filter(([e])=>t.parameters.some(t=>t.location===`query`&&t.name===e))),[i.name]:`<offset>`,[a.name]:`<limit>`}})}, advancing query.${i.name} until a window returns fewer than query.${a.name} units`];let o=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[N(t),Be(n)]}),s=[N(i),`<n>`,N(a),`<n>`];return[`${Re(t)}, in windows: ${ze(t,[...o,...s])}, advancing ${N(i)} until a window returns fewer than ${N(a)} units`]})}function Le(e,t){return`${ue(e)} ${JSON.stringify({operationId:e.operationId,...t})}`}function Re(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function ze(e,t){return[we,...e.cliPath,...t].join(` `)}function N(e){return e.flag.split(/\s+/u)[0]??e.flag}function Be(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}var Ve=i({detail:r(),field:r().nullish(),scope:c([`entity`,`person`,`news`])}),He=c([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),Ue=Object.assign(t([He,r()]),{enum:He.enum}),P=i({modeRequested:Ue,modeUsed:Ue}),We=i({answerUnavailable:a(),entity:P,incompleteScope:u(c([`entity`,`person`,`news`])).optional(),narrowingUnavailable:a().optional(),news:P,person:P,rejection:u(Ve),unavailable:u(c([`entity`,`person`,`news`]))}),Ge=c([`person`,`company`,`productService`,`investor`,`operatingCompany`,`otherOrganization`,`investmentFirm`,`fund`]),Ke=Object.assign(t([Ge,r()]),{enum:Ge.enum}),qe=i({enrichmentRunId:n().nullish(),entityId:n()}),Je=i({batch:r().min(1),program:r().regex(/.*\S.*/).nullish()}),Ye=i({acceleratorEntityId:n(),detail:Je}),Xe=c([`numeric`,`overlap`,`containment`]),Ze=Object.assign(t([Xe,r()]),{enum:Xe.enum}),Qe=i({matchMode:Ze.nullish(),max:o().nullish(),min:o().nullish()}),F=i({sortPriority:c([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),$e=i({max:l({offset:!0}).nullish(),min:l({offset:!0}).nullish()}),I=i({max:s().nullish(),min:s().nullish()}),L=i({max:o().nullish(),min:o().nullish()}),et=i({averageAmountInvestedUsdRange:u(I).optional(),largestAmountInvestedUsdRange:u(I).optional(),smallestAmountInvestedUsdRange:u(I).optional(),totalAmountInvestedUsdRange:u(I).optional(),totalInvestmentRange:u(L).optional()}),tt=c([`any`,`every`]),nt=i({amountInvestedRange:u(I).optional(),amountRaisedRange:u(I).optional(),dateAnnouncedRange:$e.nullish(),dateFundingCompleteRange:$e.nullish(),investedAmountRaisedRange:u(I).optional(),investedCompanyName:u(r()).optional(),investedCountry:u(r()).optional(),investedIndustry:u(r()).optional(),investedRound:u(r()).optional(),investorActivity:et.optional(),investorEntityId:u(n()).optional(),investorFamilyEntityId:u(n()).optional(),investorName:u(r()).optional(),investorNameMatch:tt.nullish(),lastRoundYearRange:u(L).optional(),rankByInvestmentActivity:a().nullish(),round:u(r()).optional(),totalRaisedRange:u(I).optional(),valuationRange:u(I).optional()}),rt=c([`NONE`,`COMPANY_LISTING_READY`]),it=c([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),at=i({identifier:r().max(255).nullish(),idType:r()}),ot=i({category:r(),code:o().nullish(),codeText:r().max(255).nullish(),edition:r().max(128).nullish(),hasEdition:a().nullish()}),st=c([`hostPath`,`domain`]),ct=d({acceleratorBrand:u(r()).optional(),acceleratorCohort:u(r()).optional(),acceleratorName:u(r()).optional(),acceleratorParticipation:u(Ye).optional(),acceleratorStatus:u(r()).optional(),affinity:u(r()).optional(),closedLast:a().optional(),employeeCountRange:u(Qe).optional(),entityId:u(n()).optional(),entityName:u(r()).optional(),featured:a().nullish(),fundraiseActivity:nt.optional(),hasFundraising:a().nullish(),headquartersCity:u(r()).optional(),headquartersCountry:u(r()).optional(),headquartersState:u(r()).optional(),industry:u(r()).optional(),investorPopulation:a().nullish(),letter:r().nullish(),location:u(r()).optional(),logoOption:F.optional(),mainProduct:u(r()).optional(),noteworthyOnly:a().optional(),operatingStatus:u(it).optional(),originCountry:u(r()).optional(),person:u(r()).optional(),portfolioHeadquartersCity:u(r()).optional(),portfolioHeadquartersCountry:u(r()).optional(),portfolioHeadquartersState:u(r()).optional(),qualityGate:rt.optional(),rankByProminence:a().nullish(),semanticQuery:r().nullish(),slug:u(r().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:u(r()).optional(),standardizedClassification:u(ot).max(20).optional(),suppressLateStage:a().nullish(),suppressNonOperating:a().nullish(),suppressZeroTotalRaised:a().nullish(),tag:u(r()).optional(),textSearch:r().nullish(),typeCustomer:u(r()).optional(),typeInvestor:u(r()).optional(),typeModel:u(r()).optional(),typeOwnership:u(r()).optional(),typeRecord:u(b).optional(),typeRegulatory:u(r()).optional(),typeRevenue:u(r()).optional(),typeTechnologyUsed:u(r()).optional(),uniqueId:u(at).max(20).optional(),url:r().nullish(),urlDomain:r().nullish(),urlMatchMode:st.nullish(),urlType:y.nullish(),yearFoundedRange:u(L).optional()}),R=d({acceleratorBrand:u(r()).optional(),acceleratorCohort:u(r()).optional(),acceleratorName:u(r()).optional(),acceleratorParticipation:u(Ye).optional(),acceleratorStatus:u(r()).optional(),affinity:u(r()).optional(),closedLast:a().optional(),employeeCountRange:u(Qe).optional(),entityId:u(n()).optional(),entityName:u(r()).optional(),featured:a().nullish(),fundraiseActivity:nt.optional(),hasFundraising:a().nullish(),headquartersCity:u(r()).optional(),headquartersCountry:u(r()).optional(),headquartersState:u(r()).optional(),industry:u(r()).optional(),investorPopulation:a().nullish(),letter:r().nullish(),location:u(r()).optional(),logoOption:F.optional(),mainProduct:u(r()).optional(),noteworthyOnly:a().optional(),operatingStatus:u(it).optional(),originCountry:u(r()).optional(),person:u(r()).optional(),portfolioHeadquartersCity:u(r()).optional(),portfolioHeadquartersCountry:u(r()).optional(),portfolioHeadquartersState:u(r()).optional(),qualityGate:rt.optional(),rankByProminence:a().nullish(),slug:u(r().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:u(r()).optional(),standardizedClassification:u(ot).max(20).optional(),suppressLateStage:a().nullish(),suppressNonOperating:a().nullish(),suppressZeroTotalRaised:a().nullish(),tag:u(r()).optional(),textSearch:r().nullish(),typeCustomer:u(r()).optional(),typeInvestor:u(r()).optional(),typeModel:u(r()).optional(),typeOwnership:u(r()).optional(),typeRecord:u(b).optional(),typeRegulatory:u(r()).optional(),typeRevenue:u(r()).optional(),typeTechnologyUsed:u(r()).optional(),uniqueId:u(at).max(20).optional(),url:r().nullish(),urlDomain:r().nullish(),urlMatchMode:st.nullish(),urlType:y.nullish(),yearFoundedRange:u(L).optional()}),lt=i({entityFilter:R.nullish(),isCurrent:a().nullish(),personTitle:u(r()).optional()}),ut=c([`CURRENT`,`PAST`,`ANY`]),dt=i({amountInvestedRange:u(I).nullish(),amountRaisedRange:u(I).nullish(),entityName:u(r()).nullish(),investedCompany:u(r()).nullish(),personTitle:u(r()).nullish(),round:u(r()).nullish(),totalInvestmentCount:u(L).nullish(),typeRecord:u(b).nullish()}),ft=i({additionalAssociation:lt.nullish(),arrayFilter:dt.optional(),entityFilter:R.optional(),entityId:n().nullish(),entitySlug:r().nullish(),firstName:r().nullish(),hasRealPhoto:a().nullish(),includeAddress:a().nullish(),includeUrl:a().nullish(),investorActivity:et.optional(),isCurrent:a().nullish(),lastName:r().nullish(),letter:r().nullish(),nameQuery:r().nullish(),personId:u(n()).max(200).optional(),personName:u(r()).optional(),rankByEmployer:a().nullish(),role:r().nullish(),search:r().nullish(),semanticQuery:r().nullish(),status:r().nullish(),tenure:ut.nullish()}),pt=c([`discovery`,`profile`,`peer`,`comparison`]),mt=c([`keyword`,`semantic`]),ht=c([`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`,`NOTABLE_ACTIVITY_AT`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),gt=Object.assign(t([ht,r()]),{enum:ht.enum}),_t=i({descending:a(),field:gt,sortKey:r().nullish()}),vt=i({order:u(_t),relevance:mt.nullish()}),yt=i({confidence:se,execution:P,fallbackUsed:a(),filter:ct,intent:pt,interpretation:r(),personAssociation:ft.nullish(),profileUnresolved:a().optional(),sort:vt,subjectEntityName:u(r()),unsupported:r().nullish()}),z=i({changedAt:l({offset:!0}).nullish(),dataSourceUpdatedAt:l({offset:!0}).nullish(),pendingApproval:o().nullish(),sourceId:r().nullish(),status:r().nullish()}),bt=i({fundManagerRelationshipSource:z.nullish(),fundraiseTransaction:h,fundraiseTransactionSource:z.nullish(),investorJoinSource:z.nullish()}),xt=i({evidence:bt,investor:ae,semanticMatch:ie.nullish()}),St=i({entityId:n(),matchedOffering:oe.nullish(),probability:s(),webUrl:u(r())}),Ct=i({entityId:n(),label:r(),publishedAt:l({offset:!0}).nullish(),score:s(),source:te,sourceId:r(),text:r(),url:r().nullish()}),wt=i({answer:ee.nullish(),filing:u(qe).nullish(),hiddenNonOperatingCount:s().int().nullish(),interpretation:yt,investment:u(xt),joinedEntityId:u(n()).nullish(),judgment:u(St),passage:u(Ct),peer:u(p),pendingWebQuery:u(r()),personLead:a(),result:f,searchRequestId:n().nullish(),subject:u(_)}),Tt=i({entity:u(m),newsId:o()}),Et=i({descending:a(),field:c([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:r().nullish()}),Dt=i({order:u(Et),relevance:mt.nullish()}),Ot=i({confidence:se,employerSemanticQuery:r().nullish(),execution:P,fallbackUsed:a(),filter:ft,interpretation:r(),sort:Dt,unsupported:r().nullish()}),kt=i({currentCompany:r().nullish(),headline:r().nullish(),id:n(),location:r().nullish(),name:r(),named:r(),organizationEvidence:c([`headline`,`profile`,`none`]).nullish(),photoUrl:r().nullish(),profileUrl:r(),slug:r().regex(/^[a-z0-9_-]+$/).max(255)}),At=i({interpretation:Ot,investment:u(xt),personLead:a(),profile:u(kt),result:ne,searchRequestId:n().nullish()}),jt=c([`place`,`size`,`type`]),Mt=Object.assign(t([jt,r()]),{enum:jt.enum}),Nt=c([`country`,`state`,`city`]),Pt=Object.assign(t([Nt,r()]),{enum:Nt.enum}),Ft=i({count:o().min(1),entityFilter:R,label:r(),level:Pt.nullish()}),It=i({dimension:Mt,key:r(),option:u(Ft),prompt:r()}),Lt=i({candidateCount:s().int(),question:u(It),sampleCount:o()}),Rt=i({label:r(),query:r()}),zt=i({key:r(),option:u(Rt),prompt:r()}),Bt=i({entity:wt,entityDetail:u(re),narrowing:Lt.nullish(),news:v,newsEntityMention:u(Tt),person:At,personDetail:u(g),personLead:a(),provenance:We,qualifier:zt.nullish(),section:u(Ke).optional()}),B=`entityFilter`;function Vt(e,t){let n=`${B}.${t}`;return(e.requestBody??[]).flatMap(({parameter:e})=>e).filter(({name:e})=>e===n||e.startsWith(`${n}[].`))}function Ht(e,t){let n,r=[];for(let e of t){let t=Object.entries(e).filter(e=>e[1]!==void 0&&e[1]!==null),[i]=t;if(i===void 0||t.length>1)return S(`A narrowing option must set exactly one ${B} field; this one sets ${t.length}.`);let[a,o]=i;a===n&&Array.isArray(o)||(r=[]),n=a;for(let e of Array.isArray(o)?o:[o])r.some(t=>JSON.stringify(t)===JSON.stringify(e))||r.push(e)}if(n===void 0)return x(`No narrowing picked`,null);let i=Kt(e,n,r);return i.ok&&i.data!==null?x(`Narrowing answer resolved`,{field:n,option:i.data}):S(i.summary)}function V({label:e,level:t}){return t==null?e:`${e} · ${t}`}function Ut(e){return e.option.flatMap(({parameter:e,value:t})=>t.flatMap(t=>[e.flag.split(` `)[0]??e.name,t]))}function Wt(e){return e.map(E).join(` `)}function Gt({question:e,candidateCount:t,sampleCount:n},r){let i=Math.max(...e.flatMap(({option:e})=>e.map(e=>V(e).length))),a=Math.max(...e.flatMap(({option:e})=>e.map(({count:e})=>String(e).length)));return[n<t?`narrow (top ${n} of ${t}):`:`narrow:`,...e.flatMap(({prompt:e,option:t})=>[` ${C(e)}`,...t.map(e=>{let t=r===void 0?null:Ht(r,[e.entityFilter]),n=t?.ok===!0&&t.data!==null?Wt(Ut(t.data)):`entityFilter=${JSON.stringify(e.entityFilter)}`;return` ${C(V(e)).padEnd(i)} ${String(e.count).padStart(a)} ${n}`})])]}function Kt(e,t,n){let r=`${B}.${t}`,i=Vt(e,t),a=S(`This CLI has no option for ${r}; update it to answer this question.`),o=n.filter(qt);if(o.length===0){let e=i.find(({name:e})=>e===r);return e===void 0||!n.every(Jt)?a:x(`Field values`,[{parameter:e,value:n.map(String)}])}if(o.length!==n.length)return a;let s=new Set(o.flatMap(e=>Object.keys(e).filter(t=>H(e[t])))),c=[...i.map(({name:e})=>e.slice(`${r}[].`.length)).filter(e=>s.has(e)),...[...s].filter(e=>!i.some(({name:t})=>t===`${r}[].${e}`))],l=o.every(e=>c.every(t=>H(e[t]))),u=[];for(let e of c){let t=i.find(({name:t})=>t===`${r}[].${e}`);if(t===void 0)return a;let n=[];for(let[t,r]of o.entries()){let i=r[e];if(H(i)){if(!Jt(i))return a;n.push(l?String(i):`${t}:${String(i)}`)}}u.push({parameter:t,value:n})}return x(`Row values`,u)}function qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function H(e){return e!=null}var U=30,Yt=8,W=10,Xt=2,Zt=[`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`],Qt=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]);function $t(e,t,n,{trailer:r=[],heading:i,...a}={}){let o=a.transport??`cli`,s=i===void 0?[]:[i];if(typeof t==`string`)return ye([...s,t].join(`
3
+ `),a,r);let c=be(t,r,o);if(c!==null)return _e([...s,c].join(`
4
+ `),r,a);let l=dn(t);if(l===null)return null;let u=e.find(({operationId:e})=>e===l.operationId),d=me(u?.detailField,l.response),f=[...d.hiddenNote,...r],p=(e,t)=>_e(`${e.trimEnd()}\n`,t,a),m=u?.parameters??[],h={...l,response:d.response,parameters:m,transport:o},g=Se(h.response,e,o)??Ce(h.response,e,o);if(g!==null)return p([...s,...g].join(`
5
+ `),r);let _=en(h);if(_!==null){let e=_.narrowing===null?[]:Gt(_.narrowing,u);return p([...s,..._.lines].join(`
6
+ `),[...e,...f])}let ee=h.summary??n??h.operationId??`OpenAPI call succeeded`,v=[...s,ee,`${h.method} ${h.endpoint}`],y=ve(an(h),120-v.length-1-f.length,ge-Ee.byteLength(`${[...v,...f].join(`
7
+ `)}\n`,`utf8`),a);return p([...v,...y].filter(Boolean).join(`
8
+ `),f)}function en({response:e,...t}){let n=Bt.safeParse(e);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o,narrowing:s}=n.data;return{lines:[...(o.incompleteScope??[]).map(e=>`${e} incomplete: partial results`),...r.answer?tn(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>C(`${e} rejected: ${t}`)),[`entities:`,...G(r.result,t)].join(`
9
+ `),[`people:`,...G(i.result,t)].join(`
10
+ `),[`news:`,...G(a,t)].join(`
11
+ `)],narrowing:s?.question.length?s:null}}function tn(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${C(e)}`).join(`
12
+ `)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>C(` - ${e}:${t} entity=${n}`)).join(`
13
+ `)}`;return[`answer:\n ${pe(e.text).replaceAll(`
14
+ `,`
15
+ `)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function nn(e){let t=dn(e)?.response,n=Q(t)?t.interpretation:void 0;if(!Q(n))return null;let r=P.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=he(n.filter),{unsupported:s,fallbackUsed:c}=n,l=[`strategy: requested=${i} used=${a}`,...Q(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${rn(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``];return xe(l.filter(Boolean).join(`
16
+ `),{appendNewline:!0})}var rn=e=>$(e)?C(e):Array.isArray(e)&&e.every($)?e.map(e=>C(e)).join(`, `):JSON.stringify(e);function an(e){let{response:t,method:n,nextCursor:r,httpStatus:i,location:a,transport:o}=e;if(t===void 0)return a!==void 0&&i!==void 0?[`status=${i} redirect=${a}`]:i===void 0?[]:[`status=${i} no response body`];let s=i===void 0||n===`GET`?``:`status=${i}`,c=Q(t)&&!X(t)?fn(t):null,l=c===null?void 0:Q(c.context.interpretation)?he(c.context):c.context,u=l!==void 0&&Q(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Q)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...X(t)?G(t,e,r):c===null?mn(t)?cn(t,[`filter`],t.meta,o):hn(t)?cn(t,[`arrayFilterEntry`,`rangeFilterEntry`],t.filtersMeta,o):gn(t)?ln(t,o):typeof t==`string`?t.split(`
17
+ `):K(t,``):[...G(c.page,e,r),...Object.keys(p).length===0?[]:K(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(on(t,o)))]].filter(Boolean)}function G(e,t,n){let r=un(t),i=e.numberOfElements??e.content.length,a=Math.min(e.content.length,U),o=Math.max(1,a),s=(e.number??0)*(e.size??i),c=(e.totalElements??0)-s-i,l=e.number===void 0?``:` page=${e.number}`,u=e.size===void 0?``:` size=${e.size}`,d=e.totalElements===void 0?``:` total=${e.totalElements}`,f=e.totalPages===void 0?``:` totalPages=${e.totalPages}`,p=(e.number??0)+1,m=e.totalPages===void 0||p<e.totalPages,h=w(`page`,t.parameters);return[`rows=${i}${l}${u}${d}${f}`,a>=i?``:`page rows omitted: ${i-a} (${a}/${i} shown); ${e.content.length>a?D(t.transport,`.content`):`reread with ${w(`size`,t.parameters)} ${o} and ${h} ${Math.floor((s+a)/o)} through ${Math.floor((s+i-1)/o)} (MCP: size, page); pages start at 0`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${E(n)}`,c<=0||n!==void 0?``:m&&i===e.size?`more: ${c} rows not shown; use ${h} or ${w(`size`,t.parameters)} to see them`:`more: ${c} more matched but this response returns only these ${i}; narrow the query to reach them${m?` (${h} ${p} starts after this page)`:``}`,...on(e.content.slice(0,a),t.transport)].filter(Boolean)}function on(e,t){if(e.length===0)return[`(empty)`];if(!e.every(Q))return q(e,``);let n=sn(e);if(n.length===0)return q(e,``);let r=e.slice(0,U).map(e=>{let t=J(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>fe(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),e.length>U&&s.push(`... ${e.length-U} more rows omitted; ${D(t)}`),s}function sn(e){let t=e.map(e=>J(e)),n=new Set(t.flatMap(e=>Object.keys(e))),r=Zt.filter(e=>n.has(e)),i=new Set(r.map(Y)),a=[...n].filter(e=>{let n=t.every(t=>/^-?\d+(?:\.\d+)?$/u.test(t[e]??`0`));return!e.includes(`.`)||/id$/iu.test(e)||i.has(Y(e))?!1:(n&&i.add(Y(e)),n)}),o=[...n].filter(e=>/(?:^|\.)id$/u.test(e)).slice(0,1),s=[...new Set([...r,...o,...a])],c=[...n].filter(e=>!s.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,Yt-s.length);return[...s,...c].slice(0,Yt)}function cn(e,t,n,r){let i=t.flatMap(t=>e[t].map((e,n)=>({...e,path:`.${t}[${n}].choiceOption`}))),a=n!==void 0&&Q(n)?n:{},o=[`total`,`limit`].flatMap(e=>typeof a[e]==`number`?[` ${e}=${a[e]}`]:[]).join(``),s=[`filters=${i.length}${o}`];for(let e of i){let t=e.choiceOption.length,n=e.choiceOptionTotal===null?`unknown (degraded)`:e.choiceOptionTotal??t,i=e.choiceOptionTruncated===!0?` truncated`:``;s.push(`- ${e.filterKey} (${e.label}): choices ${t}/${n}${i}`);for(let t of e.choiceOption.slice(0,W))s.push(` ${w(e.filterKey)} ${E(t.value)}`);t>W&&s.push(` ... ${t-W} choices omitted for ${e.filterKey}; ${D(r,e.path)}`)}return s}function ln(e,t){let n=w(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,W).map(e=>`${n} ${E(e)}`),e.result.length>W?`... ${e.result.length-W} matches omitted; ${D(t,`.result`)}`:``].filter(Boolean)}function un({endpoint:e,parameters:t}){let n=e.indexOf(`?`);return n<0?[]:[...new URLSearchParams(e.slice(n+1)).entries()].filter(([e,t])=>!Qt.has(e)&&t.length>0).map(([e,n])=>`${w(e,t)} ${E(n)}`)}function dn(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=t=>{let n=Reflect.get(e,t);return typeof n==`string`?n:void 0},[n,r,i]=[t(`method`),t(`endpoint`),t(`nextCursor`)];if(n===void 0||r===void 0)return null;let a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`response`),s=o===void 0?void 0:ce.safeParse(o);return s!==void 0&&!s.success?null:{method:n,endpoint:r,httpStatus:typeof a==`number`?a:void 0,location:t(`location`),operationId:t(`operationId`),summary:t(`statusDescription`)??t(`summary`),nextCursor:i===``?void 0:i,response:s?.data}}function K(e,t,n){if(e===void 0)return[];if($(e))return[`${t}${T(e,n)}`];if(Array.isArray(e))return q(e,t,n);let r=[];for(let[n,i]of Object.entries(e)){if(i===void 0)continue;let e=$(i)?`${t}${n}: ${T(i,n)}`:null;if(r.push(e??`${t}${n}:`),e===null)for(let e of K(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function q(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){let e=$(i)?`${t}- ${T(i,n)}`:null;if(r.push(e??`${t}-`),e===null)for(let e of K(i,`${t} `))r.push(e)}return r}function J(e,t=``,n=0){return $(e)?t.length===0?{}:{[t]:C(e,t)}:n>Xt?{}:Array.isArray(e)?e[0]===void 0?{}:J(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return $(r)?[[i,C(r,i)]]:Object.entries(J(r,i,n+1))}))}var Y=e=>e.split(`.`,1)[0],X=e=>Q(e)&&Array.isArray(e.content);function fn(e){let[t,...n]=Object.entries(e).filter(e=>X(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function pn(e){return Q(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var mn=e=>Q(e)&&Z(e.filter),hn=e=>Q(e)&&Z(e.arrayFilterEntry)&&Z(e.rangeFilterEntry),Z=e=>Array.isArray(e)&&e.every(pn),gn=e=>Q(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),$=e=>typeof e!=`object`||!e;export{Ht as a,Wt as c,Ne as d,je as f,Vt as i,Bt as l,ke as m,nn as n,Ut as o,Fe as p,B as r,V as s,$t as t,Mt as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventurevc/aventure-cli",
3
- "version": "0.8.508",
3
+ "version": "0.8.509",
4
4
  "private": false,
5
5
  "description": "Command-line access to aVenture research data on companies, people, funding, and news.",
6
6
  "homepage": "https://docs.aventure.vc/cli",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "aventurePublicApi": {
35
35
  "repository": "aventurevc/aventure-docs",
36
- "commit": "17862cadc374a5b0bfeec77c76a416a2062cc926",
36
+ "commit": "62e6b33097e60a15238c1b7b4ee471db5f99ae5f",
37
37
  "openapiPath": "openapi/openapi.json",
38
- "openapiSha256": "a3abe3ee29046f511409ab6b18b7385e1a2ee59b1cc039f97b27f3fc4384825f"
38
+ "openapiSha256": "83f4b3bcaf279d82bb2cb72ef8c0650d0e25725614fce6ef2912513adc8f8e66"
39
39
  },
40
40
  "scripts": {}
41
41
  }
@@ -1 +0,0 @@
1
- export{s as writeShowResult}from"./operations-catalog-D9t_yMWi.js";
@@ -1,2 +0,0 @@
1
- import{a as e}from"./package-DEeHDoOT.js";import{S as t,_ as n,s as r}from"./iso-DzqMxtky.js";import{r as i}from"./result-envelope-DhuT_8lW.js";import{i as a,n as o}from"./openapi-call-CUs1Yi5y.js";import{t as s}from"./openapi-commands-BEyhfc6I.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./search-narrowing-DYF40kQU.js";import{n as h}from"./generated-body-BaGjgMKp.js";import{createInterface as g}from"node:readline/promises";var _=n({filterKey:t(),result:r(t())}),v=p.enum.size,y=`entityFilter`,b=`searchEntityFilters`,x=/^\s*(?<min>\d+)\s*[-–]\s*(?<max>\d+)\s*$/u,S=/^\s*\d+(?:[\s,]+\d+)*\s*$/u;async function C({spec:e,opts:t,mode:n,payload:r,run:i,emit:a,input:o=process.stdin,output:s=process.stdout,argv:c=process.argv.slice(2)}){if(n!==`text`||o.isTTY!==!0||s.isTTY!==!0||(j(r)?.narrowing?.question.length??0)===0)return;let l=g({input:o,output:s,terminal:!1}),u=new Promise(e=>l.once(`close`,()=>e(null))),d=e=>Promise.race([l.question(e).catch(()=>null),u]);try{await w({spec:e,opts:t,payload:r,run:i,emit:a,output:s,argv:c,ask:d})}finally{l.close()}}async function w(t){let{spec:n,output:r}=t,i=j(t.payload),a=i?.narrowing?.question[0];if(i===null||a===void 0)return;r.write(E(a));let o=await D(n,t.opts,i,a,t.ask,r);if(o===null)return;let s=T(n,t.opts,o),l=[...t.argv,...f(o)];r.write(`\n$ ${c([e().bin[0]??``,...l])}\n`);let u=await t.run(s);t.emit(u),u.ok&&await w({...t,opts:s,argv:l,payload:u.data})}function T(e,t,n){return{...t,...Object.fromEntries(m(e,n.field).map(({optionKey:e})=>[e,void 0])),...Object.fromEntries(n.option.map(({parameter:e,value:t})=>[e.optionKey,t]))}}function E({prompt:e,option:t}){let n=Math.max(...t.map(e=>l(e).length)),r=Math.max(...t.map(({count:e})=>String(e).length)),i=String(t.length).length;return[``,`${e}?`,...t.map((e,t)=>` ${String(t+1).padStart(i)} ${l(e).padEnd(n)} ${String(e.count).padStart(r)}`),``].join(`
2
- `)}async function D(e,t,n,r,a,o){let s=(await a(`› `))?.trim()??``;if(s===``)return null;let c=S.test(s)?O(r,s):await A(e,t,n,r,s),l=typeof c==`string`?i(c):u(e,c);return l.ok&&l.data!==null?l.data:(o.write(`${l.summary}\n`),D(e,t,n,r,a,o))}function O(e,t){let n=t.split(/[\s,]+/u).map(Number);return n.filter(t=>t<1||t>e.option.length).length>0?`Pick 1 to ${e.option.length}, or type an answer.`:n.flatMap(t=>e.option[t-1]?.entityFilter??[])}function k({option:e}){return[...new Set(e.flatMap(({entityFilter:e})=>Object.keys(e)))]}async function A(e,t,n,r,i){let c=k(r),[l]=c;if(r.dimension===v&&l!==void 0){let e=x.exec(i)?.groups;return e?.min===void 0||e.max===void 0?`Type an employee range such as 10-50, or pick a number.`:[{[l]:[{min:Number(e.min),max:Number(e.max)}]}]}let u=s.find(({operationId:e})=>e===b);if(u===void 0||c.length===0)return`Pick one of the numbers.`;let d=await h(e,t),f=d.ok&&M(d.data)&&M(d.data[y])?d.data[y]:{},p=n.entity.interpretation.filter.typeRecord,m={...p===void 0?{}:{typeRecord:p},...f},g=await Promise.all(c.map(async e=>{let t={filterKey:e,query:i,scopeFilter:m},n=await a({method:u.method,path:o(u.operationId,{}),body:t,auth:u.auth,responseFormat:`json`}),r=_.safeParse(n.ok&&M(n.data)?n.data.response:void 0);return r.success?r.data.result.map(t=>({field:e,value:t})):`Could not look up “${i}”: ${n.summary}`})),S=g.find(e=>typeof e==`string`);if(S!==void 0)return S;let C=g.flatMap(e=>typeof e==`string`?[]:e),w=C.find(({value:e})=>e.toLowerCase()===i.toLowerCase())??(C.length===1?C[0]:void 0);return w===void 0?C.length===0?`Nothing matches “${i}”; pick a number or try another spelling.`:`Did you mean ${[...new Set(C.map(({value:e})=>e))].slice(0,8).join(`, `)}?`:[{[w.field]:[w.value]}]}function j(e){if(typeof e!=`object`||!e||!(`response`in e))return null;let t=d.safeParse(e.response);return t.success?t.data:null}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{C as promptSearchNarrowing};
@@ -1 +0,0 @@
1
- import{C as e,E as t,S as n,_ as r,c as i,d as a,g as o,i as s,n as c,s as l,x as u}from"./iso-DzqMxtky.js";import{a as ee,c as te,d as ne,f as d,i as re,l as ie,n as f,o as ae,p,r as oe,s as se,t as ce,u as le}from"./detail-BdF_5EBq.js";import{t as m}from"./person-owner-BW4xz8uH.js";import{r as ue}from"./run-CSLAPf8G.js";import{n as h}from"./allowance-type-BVr12WiL.js";import{t as g}from"./confidence-CjeYTBnf.js";import{c as _,r as v}from"./result-envelope-DhuT_8lW.js";import{s as de}from"./text-field-jFKOGMzr.js";var fe=r({detail:n(),field:n().nullish(),scope:s([`entity`,`person`,`news`])}),y=s([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),b=Object.assign(e([y,n()]),{enum:y.enum}),x=r({modeRequested:b,modeUsed:b}),S=r({answerUnavailable:i(),entity:x,incompleteScope:l(s([`entity`,`person`,`news`])).optional(),narrowingUnavailable:i().optional(),news:x,person:x,rejection:l(fe),unavailable:l(s([`entity`,`person`,`news`]))}),C=s([`person`,`company`,`productService`,`investor`,`operatingCompany`,`otherOrganization`,`investmentFirm`,`fund`]),w=Object.assign(e([C,n()]),{enum:C.enum}),pe=r({enrichmentRunId:t().nullish(),entityId:t()}),me=r({batch:n().min(1),program:n().regex(/.*\S.*/).nullish()}),T=r({acceleratorEntityId:t(),detail:me}),E=s([`numeric`,`overlap`,`containment`]),he=Object.assign(e([E,n()]),{enum:E.enum}),D=r({matchMode:he.nullish(),max:a().nullish(),min:a().nullish()}),O=r({sortPriority:s([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),k=r({max:c({offset:!0}).nullish(),min:c({offset:!0}).nullish()}),A=r({max:o().nullish(),min:o().nullish()}),j=r({max:a().nullish(),min:a().nullish()}),M=r({averageAmountInvestedUsdRange:l(A).optional(),largestAmountInvestedUsdRange:l(A).optional(),smallestAmountInvestedUsdRange:l(A).optional(),totalAmountInvestedUsdRange:l(A).optional(),totalInvestmentRange:l(j).optional()}),N=s([`any`,`every`]),P=r({amountInvestedRange:l(A).optional(),amountRaisedRange:l(A).optional(),dateAnnouncedRange:k.nullish(),dateFundingCompleteRange:k.nullish(),investedAmountRaisedRange:l(A).optional(),investedCompanyName:l(n()).optional(),investedCountry:l(n()).optional(),investedIndustry:l(n()).optional(),investedRound:l(n()).optional(),investorActivity:M.optional(),investorEntityId:l(t()).optional(),investorFamilyEntityId:l(t()).optional(),investorName:l(n()).optional(),investorNameMatch:N.nullish(),lastRoundYearRange:l(j).optional(),rankByInvestmentActivity:i().nullish(),round:l(n()).optional(),totalRaisedRange:l(A).optional(),valuationRange:l(A).optional()}),F=s([`NONE`,`COMPANY_LISTING_READY`]),I=s([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),L=r({identifier:n().max(255).nullish(),idType:n()}),R=r({category:n(),code:a().nullish(),codeText:n().max(255).nullish(),edition:n().max(128).nullish(),hasEdition:i().nullish()}),z=s([`hostPath`,`domain`]),ge=u({acceleratorBrand:l(n()).optional(),acceleratorCohort:l(n()).optional(),acceleratorName:l(n()).optional(),acceleratorParticipation:l(T).optional(),acceleratorStatus:l(n()).optional(),affinity:l(n()).optional(),closedLast:i().optional(),employeeCountRange:l(D).optional(),entityId:l(t()).optional(),entityName:l(n()).optional(),featured:i().nullish(),fundraiseActivity:P.optional(),hasFundraising:i().nullish(),headquartersCity:l(n()).optional(),headquartersCountry:l(n()).optional(),headquartersState:l(n()).optional(),industry:l(n()).optional(),investorPopulation:i().nullish(),letter:n().nullish(),location:l(n()).optional(),logoOption:O.optional(),mainProduct:l(n()).optional(),noteworthyOnly:i().optional(),operatingStatus:l(I).optional(),originCountry:l(n()).optional(),person:l(n()).optional(),portfolioHeadquartersCity:l(n()).optional(),portfolioHeadquartersCountry:l(n()).optional(),portfolioHeadquartersState:l(n()).optional(),qualityGate:F.optional(),rankByProminence:i().nullish(),semanticQuery:n().nullish(),slug:l(n().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:l(n()).optional(),standardizedClassification:l(R).max(20).optional(),suppressLateStage:i().nullish(),suppressNonOperating:i().nullish(),suppressZeroTotalRaised:i().nullish(),tag:l(n()).optional(),textSearch:n().nullish(),typeCustomer:l(n()).optional(),typeInvestor:l(n()).optional(),typeModel:l(n()).optional(),typeOwnership:l(n()).optional(),typeRecord:l(h).optional(),typeRegulatory:l(n()).optional(),typeRevenue:l(n()).optional(),typeTechnologyUsed:l(n()).optional(),uniqueId:l(L).max(20).optional(),url:n().nullish(),urlDomain:n().nullish(),urlMatchMode:z.nullish(),urlType:p.nullish(),yearFoundedRange:l(j).optional()}),B=u({acceleratorBrand:l(n()).optional(),acceleratorCohort:l(n()).optional(),acceleratorName:l(n()).optional(),acceleratorParticipation:l(T).optional(),acceleratorStatus:l(n()).optional(),affinity:l(n()).optional(),closedLast:i().optional(),employeeCountRange:l(D).optional(),entityId:l(t()).optional(),entityName:l(n()).optional(),featured:i().nullish(),fundraiseActivity:P.optional(),hasFundraising:i().nullish(),headquartersCity:l(n()).optional(),headquartersCountry:l(n()).optional(),headquartersState:l(n()).optional(),industry:l(n()).optional(),investorPopulation:i().nullish(),letter:n().nullish(),location:l(n()).optional(),logoOption:O.optional(),mainProduct:l(n()).optional(),noteworthyOnly:i().optional(),operatingStatus:l(I).optional(),originCountry:l(n()).optional(),person:l(n()).optional(),portfolioHeadquartersCity:l(n()).optional(),portfolioHeadquartersCountry:l(n()).optional(),portfolioHeadquartersState:l(n()).optional(),qualityGate:F.optional(),rankByProminence:i().nullish(),slug:l(n().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:l(n()).optional(),standardizedClassification:l(R).max(20).optional(),suppressLateStage:i().nullish(),suppressNonOperating:i().nullish(),suppressZeroTotalRaised:i().nullish(),tag:l(n()).optional(),textSearch:n().nullish(),typeCustomer:l(n()).optional(),typeInvestor:l(n()).optional(),typeModel:l(n()).optional(),typeOwnership:l(n()).optional(),typeRecord:l(h).optional(),typeRegulatory:l(n()).optional(),typeRevenue:l(n()).optional(),typeTechnologyUsed:l(n()).optional(),uniqueId:l(L).max(20).optional(),url:n().nullish(),urlDomain:n().nullish(),urlMatchMode:z.nullish(),urlType:p.nullish(),yearFoundedRange:l(j).optional()}),_e=r({entityFilter:B.nullish(),isCurrent:i().nullish(),personTitle:l(n()).optional()}),ve=s([`CURRENT`,`PAST`,`ANY`]),ye=r({amountInvestedRange:l(A).nullish(),amountRaisedRange:l(A).nullish(),entityName:l(n()).nullish(),investedCompany:l(n()).nullish(),personTitle:l(n()).nullish(),round:l(n()).nullish(),totalInvestmentCount:l(j).nullish(),typeRecord:l(h).nullish()}),V=r({additionalAssociation:_e.nullish(),arrayFilter:ye.optional(),entityFilter:B.optional(),entityId:t().nullish(),entitySlug:n().nullish(),firstName:n().nullish(),hasRealPhoto:i().nullish(),includeAddress:i().nullish(),includeUrl:i().nullish(),investorActivity:M.optional(),isCurrent:i().nullish(),lastName:n().nullish(),letter:n().nullish(),nameQuery:n().nullish(),personId:l(t()).max(200).optional(),personName:l(n()).optional(),rankByEmployer:i().nullish(),role:n().nullish(),search:n().nullish(),semanticQuery:n().nullish(),status:n().nullish(),tenure:ve.nullish()}),H=s([`discovery`,`profile`,`peer`,`comparison`]),U=s([`keyword`,`semantic`]),W=s([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`NOTABLE_ACTIVITY_AT`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),be=Object.assign(e([W,n()]),{enum:W.enum}),xe=r({descending:i(),field:be,sortKey:n().nullish()}),Se=r({order:l(xe),relevance:U.nullish()}),Ce=r({confidence:g,execution:x,fallbackUsed:i(),filter:ge,intent:H,interpretation:n(),personAssociation:V.nullish(),profileUnresolved:i().optional(),sort:Se,subjectEntityName:l(n()),unsupported:n().nullish()}),G=r({changedAt:c({offset:!0}).nullish(),dataSourceUpdatedAt:c({offset:!0}).nullish(),pendingApproval:a().nullish(),sourceId:n().nullish(),status:n().nullish()}),we=r({fundManagerRelationshipSource:G.nullish(),fundraiseTransaction:d,fundraiseTransactionSource:G.nullish(),investorJoinSource:G.nullish()}),K=r({evidence:we,investor:m,semanticMatch:le.nullish()}),Te=r({entityId:t(),matchedOffering:ue.nullish(),probability:o(),webUrl:l(n())}),Ee=r({entityId:t(),label:n(),publishedAt:c({offset:!0}).nullish(),score:o(),source:oe,sourceId:n(),text:n(),url:n().nullish()}),De=r({answer:f.nullish(),filing:l(pe).nullish(),hiddenNonOperatingCount:o().int().nullish(),interpretation:Ce,investment:l(K),joinedEntityId:l(t()).nullish(),judgment:l(Te),passage:l(Ee),peer:l(te),pendingWebQuery:l(n()),personLead:i(),result:ee,searchRequestId:t().nullish(),subject:l(ie)}),Oe=r({entity:l(ne),newsId:a()}),ke=r({descending:i(),field:s([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:n().nullish()}),Ae=r({order:l(ke),relevance:U.nullish()}),je=r({confidence:g,employerSemanticQuery:n().nullish(),execution:x,fallbackUsed:i(),filter:V,interpretation:n(),sort:Ae,unsupported:n().nullish()}),Me=r({currentCompany:n().nullish(),headline:n().nullish(),id:t(),location:n().nullish(),name:n(),named:n(),organizationEvidence:s([`headline`,`profile`,`none`]).nullish(),photoUrl:n().nullish(),profileUrl:n(),slug:n().regex(/^[a-z0-9_-]+$/).max(255)}),Ne=r({interpretation:je,investment:l(K),personLead:i(),profile:l(Me),result:se,searchRequestId:t().nullish()}),q=s([`place`,`size`,`type`]),J=Object.assign(e([q,n()]),{enum:q.enum}),Y=s([`country`,`state`,`city`]),Pe=Object.assign(e([Y,n()]),{enum:Y.enum}),Fe=r({count:a().min(1),entityFilter:B,label:n(),level:Pe.nullish()}),Ie=r({dimension:J,key:n(),option:l(Fe),prompt:n()}),Le=r({candidateCount:o().int(),question:l(Ie),sampleCount:a()}),Re=r({label:n(),query:n()}),ze=r({key:n(),option:l(Re),prompt:n()}),Be=r({entity:De,entityDetail:l(ce),narrowing:Le.nullish(),news:ae,newsEntityMention:l(Oe),person:Ne,personDetail:l(re),personLead:i(),provenance:S,qualifier:ze.nullish(),section:l(w).optional()}),X=`entityFilter`;function Z(e,t){let n=`${X}.${t}`;return(e.requestBody??[]).flatMap(({parameter:e})=>e).filter(({name:e})=>e===n||e.startsWith(`${n}[].`))}function Ve(e,t){let n,r=[];for(let e of t){let t=Object.entries(e).filter(e=>e[1]!==void 0&&e[1]!==null),[i]=t;if(i===void 0||t.length>1)return v(`A narrowing option must set exactly one ${X} field; this one sets ${t.length}.`);let[a,o]=i;a===n&&Array.isArray(o)||(r=[]),n=a;for(let e of Array.isArray(o)?o:[o])r.some(t=>JSON.stringify(t)===JSON.stringify(e))||r.push(e)}if(n===void 0)return _(`No narrowing picked`,null);let i=Ge(e,n,r);return i.ok&&i.data!==null?_(`Narrowing answer resolved`,{field:n,option:i.data}):v(i.summary)}function He({label:e,level:t}){return t==null?e:`${e} · ${t}`}function Ue(e){return e.option.flatMap(({parameter:e,value:t})=>t.flatMap(t=>[e.flag.split(` `)[0]??e.name,t]))}function We(e){return e.map(de).join(` `)}function Ge(e,t,n){let r=`${X}.${t}`,i=Z(e,t),a=v(`This CLI has no option for ${r}; update it to answer this question.`),o=n.filter(Ke);if(o.length===0){let e=i.find(({name:e})=>e===r);return e===void 0||!n.every(Q)?a:_(`Field values`,[{parameter:e,value:n.map(String)}])}if(o.length!==n.length)return a;let s=new Set(o.flatMap(e=>Object.keys(e).filter(t=>$(e[t])))),c=[...i.map(({name:e})=>e.slice(`${r}[].`.length)).filter(e=>s.has(e)),...[...s].filter(e=>!i.some(({name:t})=>t===`${r}[].${e}`))],l=o.every(e=>c.every(t=>$(e[t]))),u=[];for(let e of c){let t=i.find(({name:t})=>t===`${r}[].${e}`);if(t===void 0)return a;let n=[];for(let[t,r]of o.entries()){let i=r[e];if($(i)){if(!Q(i))return a;n.push(l?String(i):`${t}:${String(i)}`)}}u.push({parameter:t,value:n})}return _(`Row values`,u)}function Ke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function $(e){return e!=null}export{We as a,x as c,He as i,Ve as n,Be as o,Ue as r,J as s,Z as t};
@@ -1,17 +0,0 @@
1
- import{A as e}from"./iso-DzqMxtky.js";import{p as t}from"./result-envelope-DhuT_8lW.js";import{a as n,s as r}from"./tool-policy-DYjF2wFZ.js";import{i}from"./output-spill-Cdl7NULe.js";import{a,c as o,i as s,l as c,n as l,r as u,s as d,t as f}from"./text-field-jFKOGMzr.js";import{A as p,F as m,M as h,N as g,P as _,a as v,j as y}from"./help-catalog-ByQFO96d.js";import{n as b,r as ee,t as x}from"./agent-help-text-ColO_FNC.js";import{a as S,c as C,i as w,n as T,o as E,r as D}from"./search-narrowing-DYF40kQU.js";import{existsSync as te}from"node:fs";import{Buffer as ne}from"node:buffer";function re(e){if(typeof e==`object`&&e&&!Array.isArray(e)&&Array.isArray(e.column)&&e.column.every(e=>typeof e==`string`)&&Array.isArray(e.row)&&e.row.every(e=>Array.isArray(e))){let t=e.column;return{column:t,record:e.row.map(e=>new Map(t.map((t,n)=>[t,O(e[n]??null)])))}}let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:typeof e==`object`&&e&&Array.isArray(e.row)?e.row:[e],n=new Set,r=t.map(e=>{let t=new Map,r=(e,n)=>{if(Array.isArray(e))t.set(n,e.some(e=>typeof e==`object`&&!!e)?JSON.stringify(e):e.map(O).join(`; `));else if(typeof e==`object`&&e)for(let[t,i]of Object.entries(e))i!==void 0&&r(i,n===``?t:`${n}.${t}`);else t.set(n||`value`,e===null?``:String(e))};r(e,``);for(let e of t.keys())n.add(e);return t});return{column:[...n],record:r}}function O(e){return e===null?``:typeof e==`string`?e:JSON.stringify(e)}function k(e){return e.map(e=>{let t=/^[=+\-@\t\r]/u.test(e)?`'${e}`:e;return/[",\r\n]/u.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}).join(`,`)+`\r
2
- `}function ie(e){let{column:t,record:n}=re(e);return t.length===0?``:k(t)+n.map(e=>k(t.map(t=>e.get(t)??``))).join(``)}function ae(n){let r=t.safeParse(JSON.parse(JSON.stringify(n??null)));if(!r.success)throw Error(`Response is not JSON, so it cannot be written as CSV: ${e(r.error)}`);return ie(r.data)}var A=/\{([^}]+)\}/gu,oe=/(?:^r|R)evision$/u;function se(e,t,r=`cli`){let i=t.filter(e=>e.method===`GET`&&(r===`cli`||e.binaryResponse!==!0)),a=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),o=t.find(t=>t.operationId===e.operationId),s=e.ok&&o!==void 0&&n(o.intent),c=[...s&&e.endpoint!==void 0?N(e.endpoint.split(`?`)[0]??``,i,!1,r,le(e.data)).map(e=>r===`mcp`?e:`${e} --data --to-file <path>`):[],...e.references.filter(e=>!a(e)).flatMap(M).flatMap(e=>N(e.pathname,i,!0,r)),...e.references.filter(a).flatMap(M).flatMap(e=>de(e,i,r))],l=r===`mcp`?j:void 0,u=r===`cli`;return c.length===0?{write:s,narrowerRead:l,savesCappedPayload:u}:{exactRecovery:`Read the full result ${c.join(`; `)}.`,write:s,narrowerRead:l,savesCappedPayload:u}}var j=`Refetch a narrower result: call aventure_help with q set to the read intent, then call aventure_read with its operationId and declared query or pathParams, using ids/references, filters, or smaller query.page/query.size windows.`;function ce(e){let t=i(e);return`Inline output is truncated; full payload written to ${e}; read it with your file tool.`+(te(t)?` For its long text fields, Grep ${t} or Read it with offset and limit: it holds them as short lines labeled with each field's JSON pointer and character range.`:``)}function le(e){let t=typeof e==`object`&&e&&`response`in e?e.response:null;return typeof t==`object`&&t?new Map(Object.entries(t).flatMap(([e,t])=>Number.isInteger(t)&&oe.test(e)?[[e,String(t)]]:[])):new Map}function ue(e,t){let n=t.filter(e=>e.method===`GET`);return N(new URL(e,`https://status.invalid`).pathname,n,!0,`cli`)[0]}function M(e){return URL.canParse(e)?[new URL(e)]:[]}function N(e,t,n,r,i=new Map){let a=t.filter(t=>t.path===e);return(a.length>0?a:t).flatMap(t=>{let a=[...t.path.matchAll(A)].map(([,e])=>e),o=RegExp(`^${t.path.replace(A,`([^/]+)`)}$`,`u`),s=n&&a.length===0?null:o.exec(e);if(s===null)return[];let c=t.parameters.flatMap(e=>{let t=e.location===`query`?i.get(e.name):void 0;return t===void 0?[]:[{parameter:e,pin:t}]});if(r===`mcp`)return[P(t,{pathParams:Object.fromEntries(a.map((e,t)=>[e??``,decodeURIComponent(s[t+1]??``)])),...c.length===0?{}:{query:Object.fromEntries(c.map(({parameter:e,pin:t})=>[e.name,t]))}})];let l=a.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[L(r),s[n+1]??``]}),u=c.flatMap(({parameter:e,pin:t})=>[L(e),t]);return[`${F(t)}, ${I(t,[...l,...u])}`]})}function de(e,t,n){let r=t.find(t=>t.path===e.pathname);return r===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${r.path}/`))return[];let i=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),a=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(i===void 0||a===void 0)return[];if(n===`mcp`)return[`in windows: ${P(t,{query:{...Object.fromEntries([...e.searchParams].filter(([e])=>t.parameters.some(t=>t.location===`query`&&t.name===e))),[i.name]:`<offset>`,[a.name]:`<limit>`}})}, advancing query.${i.name} until a window returns fewer than query.${a.name} units`];let o=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[L(t),fe(n)]}),s=[L(i),`<n>`,L(a),`<n>`];return[`${F(t)}, in windows: ${I(t,[...o,...s])}, advancing ${L(i)} until a window returns fewer than ${L(a)} units`]})}function P(e,t){return`${r(e)} ${JSON.stringify({operationId:e.operationId,...t})}`}function F(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function I(e,t){return[x,...e.cliPath,...t].join(` `)}function L(e){return e.flag.split(/\s+/u)[0]??e.flag}function fe(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}var R=30,z=8,B=10,pe=2,me=[`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`],he=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]);function ge(e,t,n,{trailer:r=[],heading:i,...a}={}){let o=a.transport??`cli`,s=i===void 0?[]:[i];if(typeof t==`string`)return _([...s,t].join(`
3
- `),a,r);let l=v(t,r,o);if(l!==null)return h([...s,l].join(`
4
- `),r,a);let u=G(t);if(u===null)return null;let d=e.find(({operationId:e})=>e===u.operationId),f=c(d?.detailField,u.response),m=[...f.hiddenNote,...r],y=(e,t)=>h(`${e.trimEnd()}\n`,t,a),x=d?.parameters??[],S={...u,response:f.response,parameters:x,transport:o},C=b(S.response,e,o)??ee(S.response,e,o);if(C!==null)return y([...s,...C].join(`
5
- `),r);let w=V(S);if(w!==null){let e=w.narrowing===null?[]:_e(w.narrowing,d);return y([...s,...w.lines].join(`
6
- `),[...e,...m])}let T=S.summary??n??S.operationId??`OpenAPI call succeeded`,E=[...s,T,`${S.method} ${S.endpoint}`],D=g(xe(S),120-E.length-1-m.length,p-ne.byteLength(`${[...E,...m].join(`
7
- `)}\n`,`utf8`),a);return y([...E,...D].filter(Boolean).join(`
8
- `),m)}function V({response:e,...t}){let n=E.safeParse(e);if(!n.success)return null;let{entity:r,person:i,news:o,provenance:s,narrowing:c}=n.data;return{lines:[...(s.incompleteScope??[]).map(e=>`${e} incomplete: partial results`),...r.answer?ve(r.answer):[],...s.unavailable.map(e=>`${e} unavailable: retry this scope later`),...s.answerUnavailable?[`answer unavailable: retry this search later`]:[],...s.rejection.map(({scope:e,detail:t})=>a(`${e} rejected: ${t}`)),[`entities:`,...H(r.result,t)].join(`
9
- `),[`people:`,...H(i.result,t)].join(`
10
- `),[`news:`,...H(o,t)].join(`
11
- `)],narrowing:c?.question.length?c:null}}function _e({question:e,candidateCount:t,sampleCount:n},r){let i=Math.max(...e.flatMap(({option:e})=>e.map(e=>w(e).length))),o=Math.max(...e.flatMap(({option:e})=>e.map(({count:e})=>String(e).length)));return[n<t?`narrow (top ${n} of ${t}):`:`narrow:`,...e.flatMap(({prompt:e,option:t})=>[` ${a(e)}`,...t.map(e=>{let t=r===void 0?null:T(r,[e.entityFilter]),n=t?.ok===!0&&t.data!==null?S(D(t.data)):`entityFilter=${JSON.stringify(e.entityFilter)}`;return` ${a(w(e)).padEnd(i)} ${String(e.count).padStart(o)} ${n}`})])]}function ve(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${a(e)}`).join(`
12
- `)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>a(` - ${e}:${t} entity=${n}`)).join(`
13
- `)}`;return[`answer:\n ${s(e.text).replaceAll(`
14
- `,`
15
- `)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function ye(e){let t=G(e)?.response,n=Q(t)?t.interpretation:void 0;if(!Q(n))return null;let r=C.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=f(n.filter),{unsupported:s,fallbackUsed:c}=n,l=[`strategy: requested=${i} used=${a}`,...Q(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${be(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``];return y(l.filter(Boolean).join(`
16
- `),{appendNewline:!0})}var be=e=>$(e)?a(e):Array.isArray(e)&&e.every($)?e.map(e=>a(e)).join(`, `):JSON.stringify(e);function xe(e){let{response:t,method:n,nextCursor:r,httpStatus:i,location:a,transport:o}=e;if(t===void 0)return a!==void 0&&i!==void 0?[`status=${i} redirect=${a}`]:i===void 0?[]:[`status=${i} no response body`];let s=i===void 0||n===`GET`?``:`status=${i}`,c=Q(t)&&!X(t)?Te(t):null,l=c===null?void 0:Q(c.context.interpretation)?f(c.context):c.context,u=l!==void 0&&Q(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Q)),p=new Set(d.map(([e])=>e)),m=Object.fromEntries(u.filter(([e])=>!p.has(e)));return[s,...X(t)?H(t,e,r):c===null?De(t)?W(t,[`filter`],t.meta,o):Oe(t)?W(t,[`arrayFilterEntry`,`rangeFilterEntry`],t.filtersMeta,o):ke(t)?Ce(t,o):typeof t==`string`?t.split(`
17
- `):K(t,``):[...H(c.page,e,r),...Object.keys(m).length===0?[]:K(m,``),...d.flatMap(([e,t])=>[`${e}:`].concat(U(t,o)))]].filter(Boolean)}function H(e,t,n){let r=we(t),i=e.numberOfElements??e.content.length,a=Math.min(e.content.length,R),o=Math.max(1,a),s=(e.number??0)*(e.size??i),c=(e.totalElements??0)-s-i,u=e.number===void 0?``:` page=${e.number}`,f=e.size===void 0?``:` size=${e.size}`,p=e.totalElements===void 0?``:` total=${e.totalElements}`,h=e.totalPages===void 0?``:` totalPages=${e.totalPages}`,g=(e.number??0)+1,_=e.totalPages===void 0||g<e.totalPages,v=l(`page`,t.parameters);return[`rows=${i}${u}${f}${p}${h}`,a>=i?``:`page rows omitted: ${i-a} (${a}/${i} shown); ${e.content.length>a?m(t.transport,`.content`):`reread with ${l(`size`,t.parameters)} ${o} and ${v} ${Math.floor((s+a)/o)} through ${Math.floor((s+i-1)/o)} (MCP: size, page); pages start at 0`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${d(n)}`,c<=0||n!==void 0?``:_&&i===e.size?`more: ${c} rows not shown; use ${v} or ${l(`size`,t.parameters)} to see them`:`more: ${c} more matched but this response returns only these ${i}; narrow the query to reach them${_?` (${v} ${g} starts after this page)`:``}`,...U(e.content.slice(0,a),t.transport)].filter(Boolean)}function U(e,t){if(e.length===0)return[`(empty)`];if(!e.every(Q))return q(e,``);let n=Se(e);if(n.length===0)return q(e,``);let r=e.slice(0,R).map(e=>{let t=J(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),s=e=>e.map((e,t)=>o(e,a[t]??12).padEnd(a[t]??12)).join(` `),c=[s(i),s(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>c.push(s(e))),e.length>R&&c.push(`... ${e.length-R} more rows omitted; ${m(t)}`),c}function Se(e){let t=e.map(e=>J(e)),n=new Set(t.flatMap(e=>Object.keys(e))),r=me.filter(e=>n.has(e)),i=new Set(r.map(Y)),a=[...n].filter(e=>{let n=t.every(t=>/^-?\d+(?:\.\d+)?$/u.test(t[e]??`0`));return!e.includes(`.`)||/id$/iu.test(e)||i.has(Y(e))?!1:(n&&i.add(Y(e)),n)}),o=[...n].filter(e=>/(?:^|\.)id$/u.test(e)).slice(0,1),s=[...new Set([...r,...o,...a])],c=[...n].filter(e=>!s.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,z-s.length);return[...s,...c].slice(0,z)}function W(e,t,n,r){let i=t.flatMap(t=>e[t].map((e,n)=>({...e,path:`.${t}[${n}].choiceOption`}))),a=n!==void 0&&Q(n)?n:{},o=[`total`,`limit`].flatMap(e=>typeof a[e]==`number`?[` ${e}=${a[e]}`]:[]).join(``),s=[`filters=${i.length}${o}`];for(let e of i){let t=e.choiceOption.length,n=e.choiceOptionTotal===null?`unknown (degraded)`:e.choiceOptionTotal??t,i=e.choiceOptionTruncated===!0?` truncated`:``;s.push(`- ${e.filterKey} (${e.label}): choices ${t}/${n}${i}`),e.choiceOption.slice(0,B).forEach(t=>{s.push(` ${l(e.filterKey)} ${d(t.value)}`)}),t>B&&s.push(` ... ${t-B} choices omitted for ${e.filterKey}; ${m(r,e.path)}`)}return s}function Ce(e,t){let n=l(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,B).map(e=>`${n} ${d(e)}`),e.result.length>B?`... ${e.result.length-B} matches omitted; ${m(t,`.result`)}`:``].filter(Boolean)}function we({endpoint:e,parameters:t}){let n=e.indexOf(`?`);return n<0?[]:[...new URLSearchParams(e.slice(n+1)).entries()].filter(([e,t])=>!he.has(e)&&t.length>0).map(([e,n])=>`${l(e,t)} ${d(n)}`)}function G(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=t=>{let n=Reflect.get(e,t);return typeof n==`string`?n:void 0},[r,i,a]=[n(`method`),n(`endpoint`),n(`nextCursor`)];if(r===void 0||i===void 0)return null;let o=Reflect.get(e,`httpStatus`),s=Reflect.get(e,`response`),c=s===void 0?void 0:t.safeParse(s);return c!==void 0&&!c.success?null:{method:r,endpoint:i,httpStatus:typeof o==`number`?o:void 0,location:n(`location`),operationId:n(`operationId`),summary:n(`statusDescription`)??n(`summary`),nextCursor:a===``?void 0:a,response:c?.data}}function K(e,t,n){if(e===void 0)return[];if($(e))return[`${t}${u(e,n)}`];if(Array.isArray(e))return q(e,t,n);let r=[];for(let[n,i]of Object.entries(e))if(i!==void 0){if($(i))r.push(`${t}${n}: ${u(i,n)}`);else{r.push(`${t}${n}:`);for(let e of K(i,`${t} `,n))r.push(e)}}return r.length===0?[`${t}(empty)`]:r}function q(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e)if($(i))r.push(`${t}- ${u(i,n)}`);else{r.push(`${t}-`);for(let e of K(i,`${t} `))r.push(e)}return r}function J(e,t=``,n=0){return $(e)?t.length===0?{}:{[t]:a(e,t)}:n>pe?{}:Array.isArray(e)?e[0]===void 0?{}:J(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return $(r)?[[i,a(r,i)]]:Object.entries(J(r,i,n+1))}))}var Y=e=>e.split(`.`,1)[0],X=e=>Q(e)&&Array.isArray(e.content);function Te(e){let[t,...n]=Object.entries(e).filter(e=>X(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function Ee(e){return Q(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var De=e=>Q(e)&&Z(e.filter),Oe=e=>Q(e)&&Z(e.arrayFilterEntry)&&Z(e.rangeFilterEntry),Z=e=>Array.isArray(e)&&e.every(Ee),ke=e=>Q(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),$=e=>typeof e!=`object`||!e;export{ue as a,se as i,ye as n,ae as o,ce as r,ge as t};