@aventurevc/aventure-cli 0.8.235 → 0.8.237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/aventure-cli/index.js +1 -1
  2. package/dist/aventure-cli/unified-operations.json +1 -1
  3. package/dist/chunks/allowance-type-COW05L2h.js +1 -0
  4. package/dist/chunks/{api-key-bearer-credential-BDpScO9J.js → api-key-bearer-credential-118TVP67.js} +1 -1
  5. package/dist/chunks/api-key-bearer-credential-DDrDgtmD.js +1 -0
  6. package/dist/chunks/api-key-credential-CTYGmo4i.js +3 -0
  7. package/dist/chunks/api-key-credential-DqWZhM1S.js +1 -0
  8. package/dist/chunks/api-key-credential-verification-C-hPkWdf.js +1 -0
  9. package/dist/chunks/api-key-credential-verification-DmezO3gR.js +1 -0
  10. package/dist/chunks/api-key-login-C0CGjCDi.js +7 -0
  11. package/dist/chunks/auth-BNDyLTqp-GYAzJXBe.js +1 -0
  12. package/dist/chunks/auth-resolver-JikQ_vOz.js +1 -0
  13. package/dist/chunks/auth-resolver-p3AsKEaj.js +1 -0
  14. package/dist/chunks/auth-status-render-BkdU5KWp.js +2 -0
  15. package/dist/chunks/aventure-cli-Dmebgsw9.js +11 -0
  16. package/dist/chunks/batch-io-3UNbuV96.js +1 -0
  17. package/dist/chunks/builtin-auth-5ePYfzlb.js +17 -0
  18. package/dist/chunks/builtin-research-run-wait-DjOCdEOB.js +1 -0
  19. package/dist/chunks/builtin-update-mXZgyreW.js +3 -0
  20. package/dist/chunks/{cli-help-policy-CEyg0zEz.js → cli-help-policy-CEZPZEOQ.js} +1 -1
  21. package/dist/chunks/client-BwCSrdti.js +1 -0
  22. package/dist/chunks/{completion-CoE0a605.js → completion-Bs-t-EGB.js} +1 -1
  23. package/dist/chunks/contract-DuaB1_Ib.js +1 -0
  24. package/dist/chunks/contract-parameter-zkhCaKUz.js +1 -0
  25. package/dist/chunks/credential-redaction-Fd-q1M6s.js +1 -0
  26. package/dist/chunks/credential-store-DLz1bMPQ.js +2 -0
  27. package/dist/chunks/detail-Nzc6IsFj.js +1 -0
  28. package/dist/chunks/detail-xQRiBbkt.js +1 -0
  29. package/dist/chunks/dist-DL7QmxmX.js +8 -0
  30. package/dist/chunks/dist-DaW7WEqw.js +1 -0
  31. package/dist/chunks/dist-tIPA3BCL.js +1 -0
  32. package/dist/chunks/entity-Cg2n2mP0.js +1 -0
  33. package/dist/chunks/env-CpA6E7ay.js +1 -0
  34. package/dist/chunks/esm-lPyPa01D.js +1 -0
  35. package/dist/chunks/{generated-option-order-CZUJFgSS.js → generated-option-order-uCio4nh5.js} +1 -1
  36. package/dist/chunks/help-catalog-TLFLfBit.js +2 -0
  37. package/dist/chunks/help-intent-mWukB1eR.js +1 -0
  38. package/dist/chunks/http-credentials-BUPEQD7v.js +1 -0
  39. package/dist/chunks/internal-DaW7WEqw.js +1 -0
  40. package/dist/chunks/iso-l1vOidnb.js +56 -0
  41. package/dist/chunks/logging-BHp-5JwI.js +1 -0
  42. package/dist/chunks/logging-CgYAFXRk.js +1 -0
  43. package/dist/chunks/logout-BbrPf30h.js +1 -0
  44. package/dist/chunks/logout-Bdp97kEK.js +1 -0
  45. package/dist/chunks/mcp-generation-contract-BqIIjhgK.js +1 -0
  46. package/dist/chunks/{mcp-generation-contract-XdtSQ9XZ.js → mcp-generation-contract-DXSh-cPo.js} +1 -1
  47. package/dist/chunks/oauth-bearer-credential-CnBSeRRR.js +1 -0
  48. package/dist/chunks/oauth-bearer-credential-DUB8cIkw.js +1 -0
  49. package/dist/chunks/oauth-credential-CsMU443S.js +1 -0
  50. package/dist/chunks/oauth-credential-DgtNj00w.js +1 -0
  51. package/dist/chunks/oauth-login-Cy08UOVd.js +1 -0
  52. package/dist/chunks/oauth-login-DeqYDEv5.js +6 -0
  53. package/dist/chunks/openapi-call-B9zrl6Yl.js +96 -0
  54. package/dist/chunks/openapi-call-D20qhSmV.js +1 -0
  55. package/dist/chunks/openapi-commands-Bf1VrfFs.js +1 -0
  56. package/dist/chunks/{openapi-commands-BlMzQV8z.js → openapi-commands-H8nPBWJ_.js} +1 -1
  57. package/dist/chunks/openapi-composites-B9JPhVYN.js +1 -0
  58. package/dist/chunks/openapi-snapshot-BZ96PbpK.js +1 -0
  59. package/dist/chunks/{operations-uVpQkO2z.js → operations-bzE6xyA_.js} +2 -2
  60. package/dist/chunks/{operations-catalog-BiO8B33R.js → operations-catalog-DI6ryevT.js} +3 -3
  61. package/dist/chunks/operations-catalog-P7nOC15H.js +1 -0
  62. package/dist/chunks/operations-metadata-CsR2YIYJ.js +2 -0
  63. package/dist/chunks/{output-CtsN3oh3.js → output-BSANHETF.js} +1 -1
  64. package/dist/chunks/{output-BCOtzmsw.js → output-DmSQkWKL.js} +3 -3
  65. package/dist/chunks/{output-mode-DYvJUCAE.js → output-mode-COLMloqB.js} +1 -1
  66. package/dist/chunks/output-mode-Z-SqZGR4.js +1 -0
  67. package/dist/chunks/{output-spill-DBSmywMi.js → output-spill-CQ-IUOQG.js} +1 -1
  68. package/dist/chunks/parse-error-hint-C5ow4RG4.js +6 -0
  69. package/dist/chunks/payload-operand-guard-B5t_1_uQ.js +1 -0
  70. package/dist/chunks/person-owner-BRGa5Dee.js +1 -0
  71. package/dist/chunks/private-live-identity-AuYLZJvL.js +1 -0
  72. package/dist/chunks/private-live-identity-w8v84cKs.js +1 -0
  73. package/dist/chunks/private-telemetry-credential-FZxTymON.js +1 -0
  74. package/dist/chunks/provider-catalog-k5VPfOoO.js +1 -0
  75. package/dist/chunks/request-replay-B983xJ-7.js +1 -0
  76. package/dist/chunks/request-replay-BkF-apRY.js +1 -0
  77. package/dist/chunks/research-run-spend-D9aXcq6b.js +1 -0
  78. package/dist/chunks/response-problem-C1c4ogJm.js +1 -0
  79. package/dist/chunks/response-problem-D7yaxq6L.js +1 -0
  80. package/dist/chunks/result-envelope-DXFbrrkt.js +1 -0
  81. package/dist/chunks/rolldown-runtime-B09viugM.js +1 -0
  82. package/dist/chunks/run-detail-TzF_MGxB.js +1 -0
  83. package/dist/chunks/startup-auth-BU65BytV.js +1 -0
  84. package/dist/chunks/{startup-auth-DobaZEW6.js → startup-auth-BdSD5ehM.js} +1 -1
  85. package/dist/chunks/system-build-z_cn0X5C.js +1 -0
  86. package/dist/chunks/text-response-D44lxcy3.js +15 -0
  87. package/dist/chunks/tool-policy-C37kGt8n.js +1 -0
  88. package/dist/chunks/type-C0VR7LD-.js +1 -0
  89. package/dist/chunks/webapi-B2JTupyg.js +4 -0
  90. package/dist/chunks/webapi-WYeLOETY.js +1 -0
  91. package/package.json +3 -3
  92. package/dist/chunks/api-key-bearer-credential-CyFG5_Cm.js +0 -4
  93. package/dist/chunks/aventure-cli-uxhwf3qk.js +0 -11
  94. package/dist/chunks/builtin-auth-DzCjM2rV.js +0 -24
  95. package/dist/chunks/builtin-research-run-wait-BF06g2eh.js +0 -1
  96. package/dist/chunks/builtin-update-5IL6qRqK.js +0 -3
  97. package/dist/chunks/builtin-update-Dx_i2YGF.js +0 -1
  98. package/dist/chunks/contract-BztWeCTz.js +0 -1
  99. package/dist/chunks/detail-BTjlqGmV.js +0 -1
  100. package/dist/chunks/detail-D8sJIA5S.js +0 -1
  101. package/dist/chunks/dist-CGgP_Pxz.js +0 -1
  102. package/dist/chunks/esm-BVGNzX-8.js +0 -1
  103. package/dist/chunks/help-intent-kPjXtxOf.js +0 -1
  104. package/dist/chunks/logging-Bk8_GcPH.js +0 -1
  105. package/dist/chunks/logging-DchmkRaS.js +0 -1
  106. package/dist/chunks/mcp-generation-contract-D0mlhvEk.js +0 -1
  107. package/dist/chunks/oauth-bearer-credential-CMDf5sF6.js +0 -8
  108. package/dist/chunks/oauth-bearer-credential-flA02CPH.js +0 -1
  109. package/dist/chunks/oauth-login-Cj6xqtM3.js +0 -6
  110. package/dist/chunks/oauth-login-DHyn5cGQ.js +0 -1
  111. package/dist/chunks/openapi-call-CCpc56ir.js +0 -1
  112. package/dist/chunks/openapi-call-Cu_IqRxU.js +0 -96
  113. package/dist/chunks/openapi-commands-CKb-tN3f.js +0 -1
  114. package/dist/chunks/openapi-snapshot-C2TJ4vNL.js +0 -1
  115. package/dist/chunks/operation-invocation-C29yUZSq.js +0 -2
  116. package/dist/chunks/operations-catalog-CtACMf18.js +0 -1
  117. package/dist/chunks/operations-metadata-r3glpbEg.js +0 -2
  118. package/dist/chunks/output-mode-_ENfBi2N.js +0 -1
  119. package/dist/chunks/parse-error-hint-BNJ09L05.js +0 -6
  120. package/dist/chunks/payload-operand-guard-BVp_alVX.js +0 -1
  121. package/dist/chunks/person-owner-C0YuWKvY.js +0 -56
  122. package/dist/chunks/provider-catalog-Dy5L5Zvr.js +0 -1
  123. package/dist/chunks/reference-recovery-FRzF750i.js +0 -15
  124. package/dist/chunks/response-problem-BGEYFwd5.js +0 -1
  125. package/dist/chunks/result-envelope-5R2VEWAg.js +0 -1
  126. package/dist/chunks/startup-auth-CnOyg9R-.js +0 -1
  127. package/dist/chunks/tool-policy-BPefkvzQ.js +0 -1
@@ -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-DxrXjUBK.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-COBUpkxY.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-DchmkRaS.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-_ENfBi2N.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-DobaZEW6.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-BlMzQV8z.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let c=r(o,s);if(c===`stored`||c===`optional`)try{await a(c)}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-uxhwf3qk.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-DxrXjUBK.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-COBUpkxY.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-CgYAFXRk.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-Z-SqZGR4.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-BdSD5ehM.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-H8nPBWJ_.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let c=r(o,s);if(c===`stored`||c===`optional`)try{await a(c)}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-Dmebgsw9.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-10-23T17:24:08.015Z",
4
+ "generatedAt": "2026-10-23T23:26:32.078Z",
5
5
  "totalOperations": 137,
6
6
  "note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
7
7
  "operations": [
@@ -0,0 +1 @@
1
+ import{C as e,S as t,i as n}from"./iso-l1vOidnb.js";var r=n([`COMPANY`,`PERSON`,`ENTITY_VIEW`,`ENTITY_BRAND`,`PERSON_VIEW`,`WEB_SEARCH`]),i=Object.assign(e([r,t()]),{enum:r.enum});export{i as t};
@@ -1 +1 @@
1
- export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-CyFG5_Cm.js";
1
+ export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-DDrDgtmD.js";
@@ -0,0 +1 @@
1
+ import{a as e}from"./package-CZBWjlYb.js";import{f as t,t as n}from"./env-CpA6E7ay.js";import{o as r,r as i}from"./logging-BHp-5JwI.js";import{a}from"./credential-redaction-Fd-q1M6s.js";import{r as o}from"./api-key-credential-CTYGmo4i.js";async function s(e){if(c())return;let s=a(t().host);try{let t=await o(s);if(t.state===`unavailable`){i(l(`keyring`,Error(t.summary)));return}t.state===`found`&&t.stored.activation===`active`&&!c()&&(process.env[n.authToken]=t.stored.credential.secret,e?.(`api-key`))}catch(e){r(l(`parse`,e))}}function c(){return(process.env[n.authToken]?.trim().length??0)>0}function l(t,n){return{component:e().bin[0],event:`api_key_materialization_unavailable`,message:`saved API key could not be loaded; continuing with environment auth`,fields:{source:t},error:n}}export{s as t};
@@ -0,0 +1,3 @@
1
+ import{S as e,_ as t,i as n,n as r,s as i}from"./iso-l1vOidnb.js";import{a,t as o}from"./credential-redaction-Fd-q1M6s.js";import{i as s,o as c,r as l,t as u}from"./credential-store-DLz1bMPQ.js";var d=t({createdAt:r({offset:!0}),description:e().nullish(),expiresAt:r({offset:!0}).nullish(),id:e().regex(/^ak_[0-9A-Fa-f]{32}$/),lastUsedAt:r({offset:!0}).nullish(),name:e(),revocationReason:e().nullish(),scopes:i(e()),status:n([`ACTIVE`,`REVOKED`,`EXPIRED`]),subject:e(),updatedAt:r({offset:!0})}),f=`vc.aventure.aventure-cli`,p=`aventure-cli-personal-v1`;async function m(e,t,n){let r=a(e),i=y(t,n),s;try{s=await c(f,r,i)}catch(e){throw Error(`${o(e,[i,t.secret])}; broker acknowledgment was withheld. Re-run auth status before retrying.`,{cause:e})}return{host:r,provider:s,activation:n,credential:t}}async function h(e){let t=a(e),n;try{n=await s(f,t)}catch(e){return v(o(e))}let{record:r,keyringFailure:i}=n;return r===void 0?i===void 0?{state:`missing`}:{state:`missing`,keyringFailure:i}:{state:`found`,stored:{host:t,provider:r.provider,...b(r.value)}}}async function g(e){let t=await h(e);if(t.state!==`missing`)return t;try{let{keyringFailure:t}=await l(f,a(e));return t===void 0?{state:`missing`}:{state:`missing`,keyringFailure:t}}catch(e){return v(o(e))}}async function _(e){await u(f,a(e))}function v(e){return{state:`unavailable`,summary:e,cause:`storage`}}function y(e,t){return`${p}:${t}\n${JSON.stringify(e.apiKey)}\n${e.secret}`}function b(e){let t=e.indexOf(`
2
+ `),n=t<0?-1:e.indexOf(`
3
+ `,t+1),r=t<0?e:e.slice(0,t),i=r===`${p}:active`?`active`:`pending`;if(t<0||n<0||r!==`${p}:pending`&&r!==`${p}:active`)throw Error(`OS credential entry has an unsupported format`);let a=e.slice(n+1);if(a.length===0)throw Error(`OS credential entry has an empty secret`);let o;try{o=JSON.parse(e.slice(t+1,n))}catch(e){throw Error(`OS credential entry failed canonical schema validation`,{cause:e})}let s=d.safeParse(o);if(!s.success)throw Error(`OS credential entry failed canonical schema validation`,{cause:s.error});return{activation:i,credential:{apiKey:s.data,secret:a}}}export{d as a,m as i,g as n,h as r,_ as t};
@@ -0,0 +1 @@
1
+ export{n as inspectApiKeyCredentialStorage}from"./api-key-credential-CTYGmo4i.js";
@@ -0,0 +1 @@
1
+ export{t as refreshStoredApiKeyCredential}from"./api-key-credential-verification-DmezO3gR.js";
@@ -0,0 +1 @@
1
+ import{f as e}from"./env-CpA6E7ay.js";import{c as t,r as n}from"./openapi-call-B9zrl6Yl.js";import{n as r,s as i,t as a}from"./credential-redaction-Fd-q1M6s.js";import{a as o,i as s}from"./api-key-credential-CTYGmo4i.js";async function c(e){let t=await l(e.credential.secret);if(t.state!==`verified`||e.activation!==`active`)return{stored:e,verification:t};try{return{stored:await s(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`),verification:t}}catch(n){return{stored:e,verification:{state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${a(n,[e.credential.secret])}`}}}}async function l(s){let c=i(e()),l;try{l=await t(c,{method:`GET`,path:n(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${s}`}},o)}catch(e){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${a(e,[s])}`}}return l.ok&&l.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${l.status}`}:l.ok?l.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:l.data}:{state:`invalid`,summary:`API key is not active`}:{state:l.problem.status===401||l.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${r(l.problem,[s])}`}}export{l as n,c as t};
@@ -0,0 +1,7 @@
1
+ import{a as e}from"./package-CZBWjlYb.js";import{A as t,E as n,S as r,_ as i,g as a,i as o,n as s}from"./iso-l1vOidnb.js";import{f as c}from"./env-CpA6E7ay.js";import{c as l,r as u}from"./result-envelope-DXFbrrkt.js";import{z as d}from"./tool-policy-C37kGt8n.js";import{c as f,u as p}from"./openapi-call-B9zrl6Yl.js";import{i as m}from"./response-problem-D7yaxq6L.js";import{a as h,n as g,r as _,s as v,t as y}from"./credential-redaction-Fd-q1M6s.js";import{i as b,n as x,t as ee}from"./api-key-credential-CTYGmo4i.js";import{c as te,l as ne,n as S}from"./credential-store-DLz1bMPQ.js";import{n as C}from"./api-key-credential-verification-DmezO3gR.js";import{n as w}from"./contract-DuaB1_Ib.js";import{t as T}from"./openapi-composites-B9JPhVYN.js";import{n as re}from"./logout-BbrPf30h.js";import{stderr as E,stdin as ie}from"node:process";import{TextDecoder as ae,inspect as oe}from"node:util";import{hostname as se,platform as ce}from"node:os";import{setTimeout as le}from"node:timers/promises";import{webcrypto as D}from"node:crypto";var O=o([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),k=o([`RSA_OAEP_256_A256_GCM_V1`]),A=i({clientLabel:r().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:O.nullish(),encryptionAlgorithm:k.nullish(),encryptionPublicKey:r().min(344).max(12e3).nullish()}),j=32;async function ue(){let e=await D.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await D.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function de(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=M(n,`wrapped key`,128,1024),s=M(r,`nonce`,12,12),c=M(i,`ciphertext`,1,65536),l=M(a,`authentication tag`,16,16),u;try{u=await D.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==j)throw Error(`broker credential used an invalid AES-256 key`);let e=await D.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await D.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new ae(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function M(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var N=o([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),P=o([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),F=i({approvedAt:s({offset:!0}).nullish(),clientLabel:r(),clientPlatform:O,comparisonCode:r(),consumedAt:s({offset:!0}).nullish(),createdAt:s({offset:!0}),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),keyReadyAt:s({offset:!0}).nullish(),status:N,terminalAt:s({offset:!0}).nullish(),terminalReason:P.nullish(),updatedAt:s({offset:!0})}),I=i({algorithm:k,authenticationTag:r(),ciphertext:r(),nonce:r(),wrappedKey:r()}),L=i({delivery:I.nullish(),expiresAt:s({offset:!0}),status:N,terminalReason:P.nullish()}),R=i({comparisonCode:r(),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),pollSecret:r(),verificationUrl:r()}),z=w(T,`start`),B=w(T,`poll`),V=w(T,`acknowledge`),H=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${g(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=he(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},U=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${y(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function fe(e){let t=await f(v(c()),{method:z.method,path:d(z.path,{},z.operationId),headers:{},contentType:`application/json`,body:e},R);if(t.ok&&t.redirect)throw new H(`start`,G(t.status));if(!t.ok)throw new H(`start`,t.problem);return ge(t.data)}async function W(e,t){let n=p(B.operationId),r=await f(v(c()),{method:B.method,path:d(B.path,{cliAuthorizationId:e},B.operationId),headers:{[n]:t}},L);if(r.ok&&r.redirect)throw new H(`poll`,G(r.status),[t]);if(!r.ok)throw new H(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:me(r.headers[`retry-after`])}}async function pe(e,t){let n=p(V.operationId),r;try{r=await f(v(c()),{method:V.method,path:d(V.path,{cliAuthorizationId:e},V.operationId),headers:{[n]:t}},F)}catch(e){throw new U(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new H(`acknowledge`,G(r.status),[t]);if(!r.ok)throw new H(`acknowledge`,r.problem,[t]);return r.data}function me(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function he(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function G(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ge(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[oe.custom]:{enumerable:!1,value:a}})}var K=`RSA_OAEP_256_A256_GCM_V1`,_e=1,ve=30,q=e().bin[0],J=`The local record remains pending and unavailable to ordinary commands. Re-run \`${q} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function ye(e){if(!ie.isTTY)return u(`${q} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let n,r;try{let e=c().host;n=h(e),r=_(e)}catch(e){return u(`auth login --key: invalid environment configuration — ${y(e)}`)}for(;;){let e;try{e=await x(n)}catch(e){return u(`auth login --key: credential storage could not be inspected — ${y(e)}`)}if(e.state===`unavailable`)return u(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&E.write(S(e.keyringFailure));break}let t=await be(e.stored);if(t!==null)return t}let i;try{i=await ue()}catch(e){return u(`auth login --key: ephemeral encryption key could not be created — ${y(e)}`)}let a=A.safeParse({clientLabel:e.clientLabel?.trim()||(se().trim()||q).slice(0,120),clientPlatform:we(),encryptionAlgorithm:K,encryptionPublicKey:i.publicKey});if(!a.success)return u(`auth login --key: ${t(a.error)}`);let o;try{o=await fe(a.data)}catch(e){return u(`auth login --key: could not start browser authorization — ${y(e)}`)}let s;try{s=ne(o,r)}catch(e){return u(`auth login --key: unsafe browser authorization URL rejected — ${y(e)}`)}if(!Ce(await te(o,r,{noBrowser:e.noBrowser}),o,s))return u(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[s]});let d;try{d=await Se(o)}catch(e){return u(`auth login --key: authorization did not complete — ${y(e)}`,[],{references:[s]})}if(d.algorithm!==K)return u(`auth login --key: broker selected an unsupported encryption algorithm`);let f;try{f=await de(i.privateKey,d)}catch(e){return u(`auth login --key: encrypted credential could not be opened — ${y(e)}`)}let p=await C(f);if(p.state!==`verified`)return u(`auth login --key: decrypted credential was neither stored nor acknowledged — ${p.summary}`);let m;try{m=await b(n,{apiKey:p.apiKey,secret:f},`pending`)}catch(e){return u(`auth login --key: credential could not be durably stored — ${y(e)}`)}let g;try{g=await xe(o)}catch(e){return Q(m,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${y(e,[o.pollSecret])}`,J)}if(g.status!==`CONSUMED`)return Q(m,!0,`auth login --key: broker returned ${g.status} after acknowledgment`,J);let v=await C(f);if(v.state!==`verified`||!$(v.apiKey,m.credential.apiKey))return Q(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${v.summary}`,J);try{let e=await b(n,{apiKey:v.apiKey,secret:f},`active`);return l(`API key stored; authenticated identity and broker acknowledgment verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return Q(m,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${y(e)}`,J)}}async function be(e){let t=await C(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?l(`API key is already stored and its authenticated identity was verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]}):Q(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${q} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&$(t.apiKey,e.credential.apiKey))try{let n=await b(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return l(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,Z(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return Q(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${y(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${q} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return Q(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${q} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await re(e);if(n.outcome===`unconfirmed`)return Q(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await ee(e.host)}catch(t){return Q(e,!1,`auth login --key: stale pending credential could not be removed — ${y(t,[e.credential.secret])}`)}return E.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
2
+ `:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
3
+ `),null}async function xe(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds);for(;;)try{return await pe(e.id,e.pollSecret)}catch(e){if(e instanceof H){if(!e.retryable)throw e;n=Y(e.retryAfterSeconds??n)}else if(!(e instanceof U))throw e;if(Date.now()>=t)throw e;E.write(`Broker acknowledgment was interrupted; retrying.
4
+ `),await X(n,t)}}async function Se(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds),r;for(E.write(`Waiting for browser approval...
5
+ `);Date.now()<t;){let i;try{i=await W(e.id,e.pollSecret)}catch(e){if(e instanceof H){if(!e.retryable)throw e;n=Y(e.retryAfterSeconds??n)}r=e,E.write(`Authorization poll was interrupted; retrying.
6
+ `),await X(n,t);continue}r=void 0;let a=i.authorization;switch(a.status){case`PENDING`:case`ISSUING`:case`REVOKING`:n=Y(i.retryAfterSeconds??n),await X(n,t);break;case`KEY_READY`:if(a.delivery===null||a.delivery===void 0)throw Error(`broker returned KEY_READY without an encrypted delivery`);return a.delivery;case`DENIED`:case`EXPIRED`:case`FAILED`:case`REVOKED`:throw Error(m(a.terminalReason?.trim()??``,[e.pollSecret])||`broker entered terminal state ${a.status}`);case`CONSUMED`:throw Error(`broker credential was already consumed; restart login`)}}throw Error(r===void 0?`browser authorization expired before approval completed`:`browser authorization expired after a retryable broker failure: ${y(r,[e.pollSecret])}`)}function Ce(e,t,n){let r=e.state===`opened`;return!r&&!E.isTTY?!1:(E.write([r?`Browser approval opened for this request.`:`Browser not opened automatically (${e.reason}).`,...E.isTTY?[`Open this one-time approval URL in your browser:`,t.verificationUrl]:[`Approval reference: ${n}`],`Comparison code: ${t.comparisonCode}`,`Confirm that the browser shows the same code before approving.`,``].join(`
7
+ `)),!0)}function we(){switch(ce()){case`darwin`:return`MACOS`;case`linux`:return`LINUX`;case`win32`:return`WINDOWS`;default:return`OTHER`}}function Y(e){return Math.min(ve,Math.max(_e,e))}async function X(e,t){let n=t-Date.now();n>0&&await le(Math.min(e*1e3,n))}function Z(e,t){return{host:e.host,provider:e.provider,apiKeyId:e.credential.apiKey.id,name:m(e.credential.apiKey.name,[e.credential.secret]),activation:e.activation,verified:t}}function Q(e,t,n,r){return{...u(n,r===void 0?[]:[r]),data:Z(e,t)}}function $(e,t){return e.expiresAt===null||e.expiresAt===void 0||t.expiresAt===null||t.expiresAt===void 0?!1:new Date(e.expiresAt)>new Date(t.expiresAt)}export{ye as loginApiKeyCredential};
@@ -0,0 +1 @@
1
+ import{C as e,S as t,T as ee,_ as n,a as te,b as r,c as i,f as ne,g as a,h as o,i as s,j as re,k as ie,l as ae,m as c,n as oe,o as se,p as ce,r as le,s as l,v as u,w as d,y as ue}from"./iso-l1vOidnb.js";var de={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},fe;fe||={};function pe(e){return ie(le,e)}var me=`2025-11-25`,he=`2025-03-26`,ge=[me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],_e=`io.modelcontextprotocol/related-task`,ve=`io.modelcontextprotocol/protocolVersion`,ye=`io.modelcontextprotocol/clientInfo`,be=`io.modelcontextprotocol/serverInfo`,xe=`io.modelcontextprotocol/clientCapabilities`,Se=`io.modelcontextprotocol/subscriptionId`,Ce=`io.modelcontextprotocol/logLevel`,we=`traceparent`,f=ce(()=>e([t(),a(),i(),te(),r(t(),f),l(f)])),p=r(t(),f),Te=l(f),m=e([t(),a().int()]),h=t(),Ee=n({ttl:a().optional()}),De=n({taskId:t()}),g=o({progressToken:m.optional(),[_e]:De.optional()}),_=n({_meta:g.optional()}),v=_.extend({task:Ee.optional()}),y=n({method:t(),params:_.loose().optional()}),b=n({_meta:g.optional()}),x=n({method:t(),params:b.loose().optional()}),Oe=o({get[be](){return A.optional().catch(void 0)}}),S=o({_meta:Oe.optional()}),C=e([t(),a().int()]),ke=n({jsonrpc:c(`2.0`),id:C,...y.shape}).strict(),Ae=n({jsonrpc:c(`2.0`),...x.shape}).strict(),w=n({jsonrpc:c(`2.0`),id:C,result:S}).strict(),T=n({jsonrpc:c(`2.0`),id:C.optional(),error:n({code:a().int(),message:t(),data:d().optional()})}).strict(),je=e([ke,Ae,w,T]),Me=e([w,T]),E=S.strict(),Ne=b.extend({requestId:C.optional(),reason:t().optional()}),D=x.extend({method:c(`notifications/cancelled`),params:Ne}),Pe=n({src:t(),mimeType:t().optional(),sizes:l(t()).optional(),theme:s([`light`,`dark`]).optional()}),O=n({icons:l(Pe).optional()}),k=n({name:t(),title:t().optional()}),A=k.extend({...k.shape,...O.shape,version:t(),websiteUrl:t().optional(),description:t().optional()}),Fe=ne(n({applyDefaults:i().optional()}),p),Ie=ue(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ne(n({form:Fe.optional(),url:p.optional()}),p.optional())),Le=o({list:p.optional(),cancel:p.optional(),requests:o({sampling:o({createMessage:p.optional()}).optional(),elicitation:o({create:p.optional()}).optional()}).optional()}),Re=o({list:p.optional(),cancel:p.optional(),requests:o({tools:o({call:p.optional()}).optional()}).optional()}),ze=n({experimental:r(t(),p).optional(),sampling:n({context:p.optional(),tools:p.optional()}).optional(),elicitation:Ie.optional(),roots:n({listChanged:i().optional()}).optional(),tasks:Le.optional(),extensions:r(t(),p).optional()}),Be=_.extend({protocolVersion:t(),capabilities:ze,clientInfo:A}),Ve=y.extend({method:c(`initialize`),params:Be}),j=n({experimental:r(t(),p).optional(),logging:p.optional(),completions:p.optional(),prompts:n({listChanged:i().optional()}).optional(),resources:n({subscribe:i().optional(),listChanged:i().optional()}).optional(),tools:n({listChanged:i().optional()}).optional(),tasks:Re.optional(),extensions:r(t(),p).optional()}),He=S.extend({protocolVersion:t(),capabilities:j,serverInfo:A,instructions:t().optional()}),Ue=x.extend({method:c(`notifications/initialized`),params:b.optional()}),We=y.extend({method:c(`server/discover`),params:_.optional()}),Ge=S.extend({supportedVersions:l(t()),capabilities:j,instructions:t().optional()}),M=y.extend({method:c(`ping`),params:_.optional()}),Ke=n({progress:a(),total:u(a()),message:u(t())}),qe=n({...b.shape,...Ke.shape,progressToken:m}),N=x.extend({method:c(`notifications/progress`),params:qe}),Je=_.extend({cursor:h.optional()}),P=y.extend({params:Je.optional()}),F=S.extend({nextCursor:h.optional()}),Ye=n({uri:t(),mimeType:u(t()),_meta:r(t(),d()).optional()}),I=Ye.extend({text:t()}),L=t().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),R=Ye.extend({blob:L}),z=s([`user`,`assistant`]),B=n({audience:l(z).optional(),priority:a().min(0).max(1).optional(),lastModified:oe({offset:!0}).optional()}),V=n({...k.shape,...O.shape,uri:t(),description:u(t()),mimeType:u(t()),size:u(a()),annotations:B.optional(),_meta:u(o({}))}),Xe=n({...k.shape,...O.shape,uriTemplate:t(),description:u(t()),mimeType:u(t()),annotations:B.optional(),_meta:u(o({}))}),Ze=P.extend({method:c(`resources/list`)}),Qe=F.extend({resources:l(V)}),$e=P.extend({method:c(`resources/templates/list`)}),et=F.extend({resourceTemplates:l(Xe)}),H=_.extend({uri:t()}),tt=H,nt=y.extend({method:c(`resources/read`),params:tt}),rt=S.extend({contents:l(e([I,R]))}),it=x.extend({method:c(`notifications/resources/list_changed`),params:b.optional()}),at=H,ot=y.extend({method:c(`resources/subscribe`),params:at}),st=H,ct=y.extend({method:c(`resources/unsubscribe`),params:st}),U=n({toolsListChanged:i().optional(),promptsListChanged:i().optional(),resourcesListChanged:i().optional(),resourceSubscriptions:l(t()).optional()}),lt=_.extend({notifications:U}),ut=y.extend({method:c(`subscriptions/listen`),params:lt}),dt=b.extend({notifications:U}),ft=x.extend({method:c(`notifications/subscriptions/acknowledged`),params:dt}),pt=Oe.extend({[Se]:C}),mt=S.extend({_meta:pt}),ht=b.extend({uri:t()}),gt=x.extend({method:c(`notifications/resources/updated`),params:ht}),_t=n({name:t(),description:u(t()),required:u(i())}),vt=n({...k.shape,...O.shape,description:u(t()),arguments:u(l(_t)),_meta:u(o({}))}),yt=P.extend({method:c(`prompts/list`)}),bt=F.extend({prompts:l(vt)}),xt=_.extend({name:t(),arguments:r(t(),t()).optional()}),St=y.extend({method:c(`prompts/get`),params:xt}),W=n({type:c(`text`),text:t(),annotations:B.optional(),_meta:r(t(),d()).optional()}),G=n({type:c(`image`),data:L,mimeType:t(),annotations:B.optional(),_meta:r(t(),d()).optional()}),K=n({type:c(`audio`),data:L,mimeType:t(),annotations:B.optional(),_meta:r(t(),d()).optional()}),Ct=n({type:c(`tool_use`),name:t(),id:t(),input:r(t(),d()),_meta:r(t(),d()).optional()}),wt=n({type:c(`resource`),resource:e([I,R]),annotations:B.optional(),_meta:r(t(),d()).optional()}),Tt=V.extend({type:c(`resource_link`)}),q=e([W,G,K,Tt,wt]),Et=n({role:z,content:q}),Dt=S.extend({description:t().optional(),messages:l(Et)}),Ot=x.extend({method:c(`notifications/prompts/list_changed`),params:b.optional()}),kt=n({title:t().optional(),readOnlyHint:i().optional(),destructiveHint:i().optional(),idempotentHint:i().optional(),openWorldHint:i().optional()}),At=n({taskSupport:s([`required`,`optional`,`forbidden`]).optional()}),J=n({...k.shape,...O.shape,description:t().optional(),inputSchema:n({type:c(`object`),properties:r(t(),f).optional(),required:l(t()).optional()}).catchall(d()),outputSchema:o({$schema:t().optional()}).optional(),annotations:kt.optional(),execution:At.optional(),_meta:r(t(),d()).optional()}),jt=P.extend({method:c(`tools/list`)}),Mt=F.extend({tools:l(J)}),Y=S.extend({content:l(q).default([]),structuredContent:d().optional(),isError:i().optional()}),Nt=Y.or(S.extend({toolResult:d()})),Pt=v.extend({name:t(),arguments:r(t(),d()).optional()}),Ft=y.extend({method:c(`tools/call`),params:Pt}),It=x.extend({method:c(`notifications/tools/list_changed`),params:b.optional()}),Lt=n({autoRefresh:i().default(!0),debounceMs:a().int().nonnegative().default(300)}),X=s([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Rt=_.extend({level:X}),zt=y.extend({method:c(`logging/setLevel`),params:Rt}),Bt=b.extend({level:X,logger:t().optional(),data:d()}),Vt=x.extend({method:c(`notifications/message`),params:Bt}),Ht=n({name:t().optional()}),Ut=n({hints:l(Ht).optional(),costPriority:a().min(0).max(1).optional(),speedPriority:a().min(0).max(1).optional(),intelligencePriority:a().min(0).max(1).optional()}),Wt=n({mode:s([`auto`,`required`,`none`]).optional()}),Gt=n({type:c(`tool_result`),toolUseId:t().describe(`The unique identifier for the corresponding tool call.`),content:l(q),structuredContent:d().optional(),isError:i().optional(),_meta:r(t(),d()).optional()}),Kt=ae(`type`,[W,G,K]),Z=ae(`type`,[W,G,K,Ct,Gt]),qt=n({role:z,content:e([Z,l(Z)]),_meta:r(t(),d()).optional()}),Jt=v.extend({messages:l(qt),modelPreferences:Ut.optional(),systemPrompt:t().optional(),includeContext:s([`none`,`thisServer`,`allServers`]).optional(),temperature:a().optional(),maxTokens:a().int(),stopSequences:l(t()).optional(),metadata:p.optional(),tools:l(J).optional(),toolChoice:Wt.optional()}),Yt=y.extend({method:c(`sampling/createMessage`),params:Jt}),Xt=S.extend({model:t(),stopReason:u(s([`endTurn`,`stopSequence`,`maxTokens`]).or(t())),role:z,content:Kt}),Zt=S.extend({model:t(),stopReason:u(s([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(t())),role:z,content:e([Z,l(Z)])}),Qt=n({type:c(`boolean`),title:t().optional(),description:t().optional(),default:i().optional()}),$t=n({type:c(`string`),title:t().optional(),description:t().optional(),minLength:a().optional(),maxLength:a().optional(),format:s([`email`,`uri`,`date`,`date-time`]).optional(),default:t().optional()}),en=n({type:s([`number`,`integer`]),title:t().optional(),description:t().optional(),minimum:a().optional(),maximum:a().optional(),default:a().optional()}),tn=n({type:c(`string`),title:t().optional(),description:t().optional(),enum:l(t()),default:t().optional()}),nn=n({type:c(`string`),title:t().optional(),description:t().optional(),oneOf:l(n({const:t(),title:t()})),default:t().optional()}),rn=n({type:c(`string`),title:t().optional(),description:t().optional(),enum:l(t()),enumNames:l(t()).optional(),default:t().optional()}),an=e([tn,nn]),on=n({type:c(`array`),title:t().optional(),description:t().optional(),minItems:a().optional(),maxItems:a().optional(),items:n({type:c(`string`),enum:l(t())}),default:l(t()).optional()}),sn=n({type:c(`array`),title:t().optional(),description:t().optional(),minItems:a().optional(),maxItems:a().optional(),items:n({anyOf:l(n({const:t(),title:t()}))}),default:l(t()).optional()}),cn=e([on,sn]),ln=e([rn,an,cn]),un=e([ln,Qt,$t,en]),dn=v.extend({mode:c(`form`).optional(),message:t(),requestedSchema:n({type:c(`object`),properties:r(t(),un),required:l(t()).optional()}).catchall(d())}),fn=v.extend({mode:c(`url`),message:t(),elicitationId:t(),url:t().url()}),pn=e([dn,fn]),mn=y.extend({method:c(`elicitation/create`),params:pn}),hn=b.extend({elicitationId:t()}),gn=x.extend({method:c(`notifications/elicitation/complete`),params:hn}),_n=S.extend({action:s([`accept`,`decline`,`cancel`]),content:ue(e=>e===null?void 0:e,r(t(),e([t(),a(),i(),l(t())])).optional())}),vn=n({type:c(`ref/resource`),uri:t()}),yn=n({type:c(`ref/prompt`),name:t()}),bn=_.extend({ref:e([yn,vn]),argument:n({name:t(),value:t()}),context:n({arguments:r(t(),t()).optional()}).optional()}),xn=y.extend({method:c(`completion/complete`),params:bn}),Sn=S.extend({completion:o({values:l(t()).max(100),total:u(a().int()),hasMore:u(i())})}),Cn=n({uri:t().startsWith(`file://`),name:t().optional(),_meta:r(t(),d()).optional()}),wn=y.extend({method:c(`roots/list`),params:_.optional()}),Tn=S.extend({roots:l(Cn)}),En=x.extend({method:c(`notifications/roots/list_changed`),params:b.optional()}),Dn=o({ttl:a().optional(),pollInterval:a().optional()}),On=s([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Q=n({taskId:t(),status:On,ttl:e([a(),te()]),createdAt:t(),lastUpdatedAt:t(),pollInterval:u(a()),statusMessage:u(t())}),kn=S.extend({task:Q}),An=b.merge(Q),jn=x.extend({method:c(`notifications/tasks/status`),params:An}),Mn=y.extend({method:c(`tasks/get`),params:_.extend({taskId:t()})}),Nn=S.merge(Q),Pn=y.extend({method:c(`tasks/result`),params:_.extend({taskId:t()})}),Fn=S.loose(),In=P.extend({method:c(`tasks/list`)}),Ln=F.extend({tasks:l(Q)}),Rn=y.extend({method:c(`tasks/cancel`),params:_.extend({taskId:t()})}),zn=S.merge(Q),Bn=e([M,Ve,We,xn,zt,St,yt,Ze,$e,nt,ot,ct,ut,Ft,jt]),Vn=e([D,N,Ue,En]),Hn=e([E,Xt,Zt,_n,Tn]),Un=e([M,Yt,mn,wn]),Wn=e([D,N,Vt,gt,it,It,Ot,ft,gn]),Gn=e([E,He,Ge,Sn,Dt,bt,Qe,et,rt,Y,Mt,mt]),$=ee().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),re}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Kn=o({resource:t().url(),authorization_servers:l($).optional(),jwks_uri:t().url().optional(),scopes_supported:l(t()).optional(),bearer_methods_supported:l(t()).optional(),resource_signing_alg_values_supported:l(t()).optional(),resource_name:t().optional(),resource_documentation:t().optional(),resource_policy_uri:t().url().optional(),resource_tos_uri:t().url().optional(),tls_client_certificate_bound_access_tokens:i().optional(),authorization_details_types_supported:l(t()).optional(),dpop_signing_alg_values_supported:l(t()).optional(),dpop_bound_access_tokens_required:i().optional()}),qn=o({issuer:t(),authorization_endpoint:$,token_endpoint:$,registration_endpoint:$.optional(),scopes_supported:l(t()).optional(),response_types_supported:l(t()),response_modes_supported:l(t()).optional(),grant_types_supported:l(t()).optional(),token_endpoint_auth_methods_supported:l(t()).optional(),token_endpoint_auth_signing_alg_values_supported:l(t()).optional(),service_documentation:$.optional(),revocation_endpoint:$.optional(),revocation_endpoint_auth_methods_supported:l(t()).optional(),revocation_endpoint_auth_signing_alg_values_supported:l(t()).optional(),introspection_endpoint:t().optional(),introspection_endpoint_auth_methods_supported:l(t()).optional(),introspection_endpoint_auth_signing_alg_values_supported:l(t()).optional(),code_challenge_methods_supported:l(t()).optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0),dpop_signing_alg_values_supported:l(t()).optional()}),Jn=o({issuer:t(),authorization_endpoint:$,token_endpoint:$,userinfo_endpoint:$.optional(),jwks_uri:$,registration_endpoint:$.optional(),scopes_supported:l(t()).optional(),response_types_supported:l(t()),response_modes_supported:l(t()).optional(),grant_types_supported:l(t()).optional(),acr_values_supported:l(t()).optional(),subject_types_supported:l(t()),id_token_signing_alg_values_supported:l(t()),id_token_encryption_alg_values_supported:l(t()).optional(),id_token_encryption_enc_values_supported:l(t()).optional(),userinfo_signing_alg_values_supported:l(t()).optional(),userinfo_encryption_alg_values_supported:l(t()).optional(),userinfo_encryption_enc_values_supported:l(t()).optional(),request_object_signing_alg_values_supported:l(t()).optional(),request_object_encryption_alg_values_supported:l(t()).optional(),request_object_encryption_enc_values_supported:l(t()).optional(),token_endpoint_auth_methods_supported:l(t()).optional(),token_endpoint_auth_signing_alg_values_supported:l(t()).optional(),display_values_supported:l(t()).optional(),claim_types_supported:l(t()).optional(),claims_supported:l(t()).optional(),service_documentation:t().optional(),claims_locales_supported:l(t()).optional(),ui_locales_supported:l(t()).optional(),claims_parameter_supported:i().optional(),request_parameter_supported:i().optional(),request_uri_parameter_supported:i().optional(),require_request_uri_registration:i().optional(),op_policy_uri:$.optional(),op_tos_uri:$.optional(),client_id_metadata_document_supported:i().optional(),authorization_response_iss_parameter_supported:i().optional().catch(void 0)}),Yn=n({...Jn.shape,...qn.pick({code_challenge_methods_supported:!0}).shape}),Xn=n({access_token:t(),id_token:t().optional(),token_type:t(),expires_in:pe().optional(),scope:t().optional(),refresh_token:t().optional(),issuer:t().optional().catch(void 0)}).strip(),Zn=n({issued_token_type:c(`urn:ietf:params:oauth:token-type:id-jag`),access_token:t(),token_type:t().optional(),expires_in:a().optional(),scope:t().optional()}).strip(),Qn=n({error:t(),error_description:t().optional(),error_uri:t().optional()}),$n=$.optional().or(c(``).transform(()=>void 0)),er=n({redirect_uris:l($),token_endpoint_auth_method:t().optional(),grant_types:l(t()).optional(),response_types:l(t()).optional(),application_type:t().optional(),client_name:t().optional(),client_uri:$.optional(),logo_uri:$n,scope:t().optional(),contacts:l(t()).optional(),tos_uri:$n,policy_uri:t().optional(),jwks_uri:$.optional(),jwks:se().optional(),software_id:t().optional(),software_version:t().optional(),software_statement:t().optional()}).strip(),tr=n({client_id:t(),client_secret:t().optional(),client_id_issued_at:a().optional(),client_secret_expires_at:a().optional(),issuer:t().optional().catch(void 0)}).strip(),nr=er.merge(tr),rr=n({error:t(),error_description:t().optional()}).strip(),ir=n({token:t(),token_type_hint:t().optional()}).strip();export{O as $,dt as $n,Je as $t,kn as A,Oe as An,jt as At,hn as B,qt as Bn,en as Bt,xn as C,it as Cn,Ct as Cr,et as Ct,Yt as D,Xe as Dn,tn as Dr,Tn as Dt,Jt as E,vn as En,on as Er,wn as Et,dn as F,be as Fn,Ht as Ft,xt as G,Re as Gn,Qn as Gt,wt as H,Wn as Hn,tr as Ht,pn as I,Se as In,Ut as It,Pn as J,an as Jn,ir as Jt,St as K,Rt as Kn,qn as Kt,mn as L,ge as Ln,cn as Lt,he as M,z as Mn,X as Mt,We as N,Cn as Nn,Bt as Nt,Xt as O,ht as On,In as Ot,Ge as P,En as Pn,Vt as Pt,Pe as Q,U as Qn,ve as Qt,fn as R,Kt as Rn,x as Rt,bn as S,Tt as Sn,J as Sr,$e as St,q as T,V as Tn,ct as Tr,Qe as Tt,E as U,Un,er as Ut,gn as V,j as Vn,nr as Vt,ln as W,Gn as Wn,rr as Wt,Mn as X,at as Xn,Yn as Xt,Fn as Y,$t as Yn,Xn as Yt,Nn as Z,ot as Zn,Jn as Zt,Vn as _,De as _n,kt as _r,Ce as _t,R as a,N as an,we as ar,He as at,Le as b,y as bn,It as br,yt as bt,ye as c,_t as cn,Ee as cr,p as ct,Y as d,yn as dn,jn as dr,Ae as dt,P as en,ft as er,Zn as et,Rn as f,vt as fn,On as fr,ke as ft,ze as g,rt as gn,nn as gr,me as gt,D as h,nt as hn,sn as hr,f as ht,_ as i,qe as in,mt as ir,Ve as it,h as j,S as jn,Mt as jt,Zt as k,gt as kn,Ln as kt,Pt as l,Ot as ln,Q as lr,T as lt,Ne as m,tt as mn,I as mr,w as mt,K as n,M as nn,ut as nr,A as nt,Qt as o,Ke as on,v as or,Ue as ot,zn as p,_e as pn,W as pr,Me as pt,Dt as q,zt as qn,Kn as qt,k as r,un as rn,pt as rr,Be as rt,xe as s,m as sn,Dn as sr,Te as st,B as t,F as tn,lt as tr,G as tt,Ft as u,Et as un,An as ur,je as ut,Bn as v,C as vn,Wt as vr,rn as vt,Sn as w,H as wn,st as wr,Ze as wt,Nt as x,Ye as xn,Gt as xr,bt as xt,Hn as y,g as yn,At as yr,Lt as yt,_n as z,Z as zn,b as zt};
@@ -0,0 +1 @@
1
+ import{t as e}from"./env-CpA6E7ay.js";import{join as t}from"node:path";import{homedir as n,platform as r}from"node:os";function i(){if(r()===`win32`){let e=process.env.APPDATA??t(n(),`AppData`,`Roaming`);return t(e,`aventure`,`config.json`)}let e=process.env.XDG_CONFIG_HOME??t(n(),`.config`);return t(e,`aventure`,`config.json`)}function a(){let t=process.env[e.authToken];return typeof t==`string`&&t.length>0?{present:!0,source:`env`}:{present:!1,source:null}}function o(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}export{o as n,a as r,i as t};
@@ -0,0 +1 @@
1
+ export{r as resolveAuthStatus}from"./auth-resolver-JikQ_vOz.js";
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./private-live-identity-AuYLZJvL.js";import{f as t,t as n}from"./env-CpA6E7ay.js";import{r}from"./auth-resolver-JikQ_vOz.js";import{a as i,l as a}from"./openapi-call-B9zrl6Yl.js";import{a as o,i as s}from"./response-problem-D7yaxq6L.js";import{t as c}from"./credential-redaction-Fd-q1M6s.js";import{t as l}from"./api-key-bearer-credential-DDrDgtmD.js";import{a as u,f as d,l as f,s as p}from"./oauth-credential-CsMU443S.js";import{t as m}from"./oauth-bearer-credential-CnBSeRRR.js";async function h(e){let t=null,n=e=>{t=e};try{await m(e,n),await l(n)}catch(e){return{materialized:t,failure:c(e)}}return{materialized:t,failure:null}}async function g(t,n,r,a){if(a.failure!==null)return{scope:t,selected:null,identity:null,authorization:null,error:a.failure};let o=null,s=null,l,u=e=>{l=e,s=_(e.credential,a.materialized)};try{let n=await i({method:`POST`,path:`/v1/auth/me/permissions`,body:{operation:[]},auth:t,requesterScope:t,responseFormat:`json`,onAuthPrepared:u});if(!n.ok)throw Error(v(n));if(s===null)throw Error(`Live permission probe did not prepare a credential`);if(o=S(n.data),t===`read`)return{scope:t,selected:s,identity:null,authorization:o,error:null};if(l===void 0)throw Error(`Live permission probe did not retain its prepared credential`);let r=await e(t,l);return{scope:t,selected:s,identity:r,authorization:o,error:null}}catch(e){return{scope:t,selected:s,identity:null,authorization:o,error:c(e,y(n,r,l))}}}function _(e,t){if(e===null)return null;let n=t??r().source;if(n===null)throw Error(`Prepared credential has no local provenance`);return{credential:e,source:n}}function v(e){return[e.summary,...e.warnings].join(` — `)}function y(e,n,r){return[t().userBearerToken,...o(r?.headers??{}),...e.state===`found`?d(e.stored.credential.tokens):[],n.state===`found`?n.stored.credential.secret:void 0]}function b(e,t,n=null){let r=t.state===`found`?t.stored:void 0,i=r?.credential.apiKey.expiresAt??null;return{host:e,present:r!==void 0,provider:r?.provider??null,activation:r?.activation??null,apiKeyId:r?.credential.apiKey.id??null,subject:r?.credential.apiKey.subject??null,scope:r?.credential.apiKey.scopes??[],name:r===void 0?null:s(r.credential.apiKey.name,[r.credential.secret]),status:r?.credential.apiKey.status??null,expiresAt:i,metadataSource:r===void 0?null:n?.state===`verified`?`clerk`:`store-cache`,live:n===null?null:{state:n.state,summary:n.summary},expiresInDay:T(i),storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function x(e,t){let n=t.state===`found`?t.stored:void 0;return{host:e,present:n!==void 0,provider:n?.provider??null,expiresAt:n?.credential.expiresAt??null,expired:n===void 0?null:u(n.credential),renewable:n===void 0?null:n.credential.tokens.refresh_token!==void 0,identity:n===void 0?null:f(n.credential),client:n?.credential.client??null,storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function S(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)throw Error(`permission probe returned no JSON response`);let t=a.safeParse(e.response);if(!t.success)throw t.error;return t.data}function C(e,t){let{expiresAt:n,expiresInDay:r}=b(e,t);return n!==null&&r!==null&&new Date(n).getTime()<=Date.now()?` (cached expiry passed ${Math.abs(r)}d ago; \`auth status\` re-checks it with aVenture sign-in)`:``}var w=864e5;function T(e){if(e===null)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:Math.round((t-Date.now())/w)}var E=7;function D(e){return e===null?`none`:e.length<=11?e:`${e.slice(0,E)}\u2026${e.slice(-4)}`}var O=13,k=14;function A(e){return[``,`${e.cliName} ${e.cliVersion} \u2192 ${e.apiKey.host}`+(e.apiVersion===null?` (api build unavailable)`:` (api ${e.apiVersion})`),``,...P(e.oauth,e.cliName,e.refresh),...I(e.apiKey,e.oauth,e.cliName),``,M(`Providers`,z(e.providers)),M(`Environment`,B(e.resolved)),M(`Selected`,V(e.resolved,e.refresh,e.cliName)),...j(e.live)].join(`
2
+ `)}function j(e){if(e===null)return[];let t=N(`local credential provenance was captured before verification`);if(e.error!==null)return[``,M(`Live probe`,`${e.scope} permission probe failed`),t,N(e.error)];if(e.authorization===null)return[];let n=e.authorization.permissionGrant,r=e.identity;return[``,M(`Live probe`,`${e.scope} permission probe succeeded`),t,N(`operation access ${e.authorization.operationAccess}; ${n.role.length} role; ${n.permission.length} permission`),...r===null?[N(e.scope===`read`?`identity not requested for a read-scope credential`:`identity unavailable in this build`)]:[M(`Live account`,r.nameFull??r.email??r.clerkUserId??r.id)],N(`no API operation was executed or individually authorized`)]}function M(e,t){return` ${e.padEnd(O)}${t}`}function N(e){return` ${``.padEnd(O)}${e}`}function P(e,t,n){switch(e.state){case`found`:{let{credential:r,provider:i}=e.stored,a=f(r);return[M(`OAuth`,`${a.email??a.subject??`unknown identity`} via ${i}`),N(F(r,t,n))]}case`missing`:return[M(`OAuth`,`none stored`),...e.keyringFailure===void 0?[]:[N(`OS keyring unusable — login stores to file: ${e.keyringFailure}`)]];case`unavailable`:return[M(`OAuth`,`storage unavailable: ${e.summary}`)];case`invalid`:return[M(`OAuth`,`stored credential invalid: ${e.summary}`)];default:throw Error(`Unsupported OAuth credential state`)}}function F(e,t,n){return u(e)?e.tokens.refresh_token===void 0?`access token expired — run \`${t} auth login\``:n.failure===null?n.materialized===`api-key`?`access token expired and renewal failed; the API key is in use — \`${t} auth login\` renews OAuth`:`access token expired — not renewed while AUTH_TOKEN is set in the environment`:`access token expired — ${n.failure}`:`access token valid until ${e.expiresAt}`}function I(e,t,n){if(!e.present){if(t.state===`found`)return[];let r=e.storageFailure??(t.state===`unavailable`?t.summary:null);return r===null?[M(`Signed in`,`no \u2014 run \`${n} auth login\``),...e.error===null?[]:[N(`stored credential invalid: ${e.error}`)]]:[M(`Signed in`,`credential storage unavailable`),N(r)]}return[M(t.state===`found`?`API key`:`Signed in`,e.subject??`unknown subject`),N(`via ${e.provider??`unknown store`}`),M(`Key`,`${e.name??`unnamed`} ${D(e.apiKeyId)}`),...L(e,n),M(`Scopes`,e.scope.length===0?`none`:e.scope.join(`, `))]}function L(e,t){let n=e.live,r=e.expiresInDay,i=e.expiresAt;if(n?.state===`invalid`)return[M(`Key state`,`rejected by aVenture sign-in \u2014 ${n.summary}`),N(`run \`${t} auth logout\`, then \`${t} auth login --key\``)];let a=n?.state===`verified`;return[M(`Key state`,a?`${e.status??`unknown`}, verified by aVenture sign-in now`:`${e.status??`unknown`} when stored`),...i===null||r===null?[N(`no expiry recorded`)]:[N(R(i,r,a?`expires`:`cached expiry`))],...a?[]:[N(n===null?"aVenture sign-in owns the live verdict — `auth status` re-checks it":`aVenture sign-in could not be reached \u2014 ${n.summary}`)]]}function R(e,t,n){let r=e.slice(0,10);return new Date(e).getTime()<=Date.now()?`${n} ${r} passed ${Math.abs(t)}d ago`:t<=k?`${n} ${r}, ${t}d away`:`${n} ${r}`}function z(e){if(e.state===`unavailable`)return`unavailable: ${e.summary}`;let t=e.catalog.oauthClient;return[e.catalog.clerkPublishableKey?`browser sign-in`:`no browser sign-in`,t?`oauth ${p(t).host} client ${t.clientId}`:`no OAuth CLI client`].join(`; `)}function B(e){return`${n.authToken}=${e.present?e.source??`resolved`:`unset`}`}function V(e,t,r){return e.present||t.materialized===`env`?`${n.authToken} from the environment`:t.materialized===`oauth`?`saved OAuth access token`:t.materialized===`api-key`?`saved API key`:`none \u2014 sign in with \`${r} auth login\``}export{b as apiKeyCredentialDiagnostics,C as apiKeyExpiryQualifier,g as inspectLiveAuth,x as oauthCredentialDiagnostics,h as refreshCliCredentials,A as renderAuthStatus,B as summarizeCredential};
@@ -0,0 +1,11 @@
1
+ import{a as e,n as t,o as n,r,t as i}from"./commander-DEj7N1b9.js";import{a}from"./package-CZBWjlYb.js";import{a as o,c as s,l as c,r as l}from"./env-CpA6E7ay.js";import{c as u,f as d,r as f}from"./result-envelope-DXFbrrkt.js";import{L as p,R as m,a as h,c as g,t as _,y as v}from"./tool-policy-C37kGt8n.js";import{i as y}from"./logging-BHp-5JwI.js";import{i as ee,n as te,t as ne}from"./cli-help-policy-CEZPZEOQ.js";import{a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as b,r as le,s as x,t as ue,u as de}from"./startup-auth-BU65BytV.js";import{_ as fe,h as pe}from"./help-catalog-TLFLfBit.js";import{t as me}from"./operations-metadata-CsR2YIYJ.js";import{t as S}from"./openapi-commands-Bf1VrfFs.js";import{i as C,r as w,t as T}from"./output-mode-COLMloqB.js";import{S as he,_ as E,a as ge,b as D,c as _e,d as ve,f as ye,g as O,h as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae,v as k,x as je,y as Me}from"./generated-option-order-uCio4nh5.js";import{a as Ne,i as Pe,n as Fe,r as Ie}from"./payload-operand-guard-B5t_1_uQ.js";import{fileURLToPath as Le}from"node:url";import{readFile as Re}from"node:fs/promises";async function ze(e){let t;try{t=e===`-`?await Be():await Re(e,`utf8`)}catch(t){return f(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return u(`No input provided`,null);let e=JSON.parse(t);return u(`Input parsed`,e)}catch(e){return f(`Input is not valid JSON: ${e.message}`)}}async function Be(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var A=`--content-type`;function Ve(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(A)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${A} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Ue(a)))}if(I(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,ge(r,r.requiredPath)).argParser(j(`--from-file`)))}let o=Te(a).filter(e=>i(N(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>we(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(xe(n),a.length>1?De(n):_e(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Oe(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(He):E(i.name)||i.schemaType===`array`?o.argParser(We):o.argParser(j(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}nt(e,n,o)}function He(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Ue(e){return(t,r)=>{if(r!==void 0)throw new n(`${A} was already given; pass it once.`);let i=v(e,t);if(!i.ok)throw new n(i.summary);return t}}function We(e,t){return[...t??[],e]}function j(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function M(e,t){let n=x(e,t),r=v(e.requestBody??[],n);if(!r.ok||r.data===null)return f(r.summary,r.warnings);let i=r.data;if(i===void 0)return u(`No body`,void 0);let a=Ge(e,i,t);if(a!==null)return f(a);let o=ye(e.operationId,i,t);if(!o.ok)return f(o.summary,o.warnings);t=o.data;let s=Ke(i,t);if(s!==null)return f(s);let c=await Xe(t);if(!c.ok)return f(c.summary,c.warnings);let l=Ce(e.requestBody??[],i,c.data);if(l!==null)return f(l);let d=Ye(e.operationId,i,c.data);if(!d.ok)return d;let p=be(e.operationId,i,c.data);if(p!==null)return f(p);let m=Ze(e.operationId,i,t);if(!m.ok)return m;if(c.data===void 0&&m.data===void 0)return i.required?f(tt(e.operationId,i)):u(`No body`,void 0);let h=$e(e.operationId,i,c.data,m.data);if(!h.ok||h.data===void 0)return h;if(i.schemaType===`array`&&!Array.isArray(h.data))return f(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!k(h.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return f(`${e.operationId} requires a JSON object${t}.`)}let g=Je(i,h.data);if(g.length>0)return f(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=k(_)?D(i).filter(e=>!O(_,e)):[];return y.length>0?f(qe(e.operationId,i,y)):h}function Ge(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${N(t)} requires ${A} ${i.join(` or `)}.`}return null}function Ke(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function qe(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Je(e,t){return k(t)?e.parameter.filter(e=>e.required&&!O(t,e.name)).map(N):[]}function Ye(e,t,n){let r=he(t,n);return r===null?u(`Body file paths validated`,null):f(`${e} --from-file contains ${r.message}`)}async function Xe(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return u(`No body file`,void 0);let n=await ze(t);if(!n.ok)return f(n.summary,n.warnings);let r=d.safeParse(n.data);return r.success?u(`Input parsed`,r.data):f(`Input is not valid JSON value: ${r.error.message}`)}function Ze(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=je(e,n[e.optionKey]);if(!a.ok||a.data===null)return f(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=Qe(t,n,r,e,o);if(!s.ok)return f(s.summary,s.warnings);i=!0}if(!i)return u(`No direct body options`,void 0);let a=Se(e,t,n,r);return a===null?u(`Direct body options parsed`,r):a}function Qe(e,t,n,r,i){let a=Me(r,i);if(a===null){let e=et(r,i);return e.ok?Ae(n,r.name,e.data,r.schemaType===`array`):f(e.summary,e.warnings)}if(a.plain.length>0)return f(`${N(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=Ee(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return f(`${N(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=F(r.name,r.itemSchemaType,e);if(!t.ok)return f(t.summary,t.warnings);i.push(t.data)}let a=ve(n,r.name,e,i);if(!a.ok)return a}return u(`Body value assigned`,null)}var N=e=>e.flag.split(` `)[0]??e.name;function $e(e,t,n,r){if(n===void 0)return u(`Direct body parsed`,r);if(r===void 0)return u(`Input parsed`,n);if(k(n)&&k(r))try{return u(`Input parsed`,P(t,n,r))}catch(t){return f(`${e} ${t instanceof Error?t.message:String(t)}`)}return f(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function P(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(k(n)&&k(a))i[t]=P(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:pe.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function et(e,t){if(typeof t==`boolean`)return u(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return F(e.name,e.schemaType,t??``);let n=[],r=E(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=F(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return u(`Body value parsed`,n)}function F(e,t,n){if(t===`boolean`)return n===`true`?u(`Body value parsed`,!0):n===`false`?u(`Body value parsed`,!1):f(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?f(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?f(`${e} must be an integer.`):u(`Body value parsed`,i)}return u(`Body value parsed`,n)}function tt(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(N).join(`, `)}`;let r=D(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(N).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function nt(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:A,location:`body`}),I(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),ke(e.options,r)}function I(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function rt(e,t,n=a().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show full documentation for a command, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help ask <question>` or `help --ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new it(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()});let i=st(t);i!==void 0&&r.option(`--ask <question>`,i.summary),T(r),r.action(async function(r){let{emit:a}=await import(`./output-BSANHETF.js`),o=this.optsWithGlobals();if(o.help&&r.length===0){this.outputHelp();return}if(!o.help&&i!==void 0&&o.ask!==void 0){let e=C(o);if(r.length>0){a({mode:e},f(`Use either a command path or --ask, not both.`));return}a({mode:e},await lt(i,o.ask,o.environment,e));return}let s=V(e,r),c=t.find(t=>s!==void 0&&V(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let l=c===void 0?await ct(r,t):u(`Resolved by command path`,{operationId:c.operationId});if(l.ok&&l.data?.command!==void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),!l.ok||l.data===null){a({mode:C(o)},l);return}let{writeShowResult:d}=await import(`./operations-catalog-P7nOC15H.js`);d({...o,...l.data},t,C(o,`text`),n)}),ot(e,t,n)}var it=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,at={formatHelp(e,t){let n=n=>r.prototype.formatHelp.call(this,e,Object.assign(Object.create(t),n));if(t.visibleCommands(e).length===0)return n({});let i=t.padWidth(e,t),a={padWidth:()=>i,visibleOptions:()=>[],showGlobalOptions:!1},o=n({...a,visibleCommands:()=>[]}),s=n({padWidth:()=>i,visibleCommands:()=>[]}).slice(o.length);return n(a)+s},visibleCommands(e){let t=r.prototype.visibleCommands.call(this,e);return e.parent===null?t.filter(e=>!te.has(e.name())):t},subcommandTerm(e){let t=r.prototype.subcommandTerm.call(this,e);return e.commands.length>0&&e.registeredArguments.length===0?`${t} <command>`:t},formatItem(e,t,n,i){let a=i.helpWidth??80,o=a-t-4;return n===``||o>=i.minWidthToWrap?r.prototype.formatItem.call(i,e,t,n,i):`${` `.repeat(L)}${e}\n${z(n,a,i)}`}};function z(e,t,n){return n.boxWrap(e,t-R).replace(/^/gmu,` `.repeat(R))}function ot(e,t,n){for(let r of t){let i=V(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=fe(r.operationId,t,n),[c,...l]=me(r.errorResponse),u=l.map(t=>z(t.trimStart(),o,e).replace(/^ +/u,` `.repeat(L))),d=c===void 0?[]:[``,c,...u];return`\n${[...s,...d].join(`
2
+ `)}\n`})}}function st(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&H(e)!==void 0});return n.length===0?t:void 0}var B='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function ct(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?u(`Resolved by route`,{operationId:i.operationId}):f(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[B]);let o=p.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return u(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=m(o),c=r.join(``),l=t.find(e=>e.method===s&&e.path===c);if(l!==void 0)return u(`Resolved by route template`,{operationId:l.operationId});let{resolveOpenApiOperationSelector:d}=await import(`./openapi-call-D20qhSmV.js`),h=d({method:s,path:c});return!h.ok||h.data===null?f(h.summary,[...h.warnings,B]):u(`Resolved by method and path`,{operationId:h.data.operation.operationId})}function V(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}async function lt(e,t,n,r){let{buildOpenApiPath:i,runOpenApiCall:a}=await import(`./openapi-call-D20qhSmV.js`),o=H(e);if(o===void 0)return f(`The \`${e.cliPath.join(` `)}\` operation no longer takes a single required text body; run it directly instead of \`help --ask\`.`);n!==void 0&&(process.env.API_ENV=n);let s=await M(e,{[o.optionKey]:t});return s.ok?await a({method:e.method,path:i(e.operationId,{}),searchParams:{},body:s.data,auth:e.auth,responseFormat:w(r)?`json`:`auto`}):s}function H(e){if(e.requestBody?.length!==1||e.parameters.some(e=>e.required))return;let t=(e.requestBody[0]?.parameter??[]).filter(e=>e.required);return t.length===1&&t[0]?.schemaType===`string`?t[0]:void 0}function ut(e,t,n){if(e.cliPath[0]!==`lookup`||!dt(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`),i=`no record for ${r.length===0?`the given input`:r.join(`, `)}`;return n.ok?f(i):f(i,[],{httpStatus:n.httpStatus,problem:n.problem})}function dt(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function ft(e,t){if(e.deprecated!==!0)return t;let n=e.description.match(/^Deprecated:[^.]*\./u)?.[0]??`Deprecated; run \`help ${e.cliPath.join(` `)}\` for its replacement.`;return{...t,warnings:[n,...t.warnings]}}function pt(t,n,r,i){let a=mt(t),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-5ePYfzlb.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-mXZgyreW.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-runs`,register:async()=>{let{registerBuiltinResearchRunWaitCommand:e}=await import(`./builtin-research-run-wait-DjOCdEOB.js`);e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-Bs-t-EGB.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerOperationsCommand:e}=await import(`./operations-bzE6xyA_.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,registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function mt(n){try{return new i().exitOverride().configureOutput({writeErr:()=>void 0}).addOption(new t(`--environment <environment>`)).parseOptions([...n]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var ht=new Set(S.map(e=>e.cliPath.join(` `)));function U(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,Fe):e.registeredArguments.length===0&&!ht.has(Ne(e).join(` `))&&e.addHelpOption(new Pe(e));for(let n of e.commands)U(n,t)}var W=a(Le(import.meta.url)),G=W.bin[0];async function K(e,t){let{BearerVerificationUnavailableError:n}=await import(`./openapi-call-D20qhSmV.js`),{emitJson:r}=await import(`./output-BSANHETF.js`),i=e instanceof Error?e:Error(String(e));y({component:G,event:`fatal`,message:i.message,error:i}),process.stderr.write(`${G} fatal (${t}): ${i.stack??i.message}\n`);let a=i instanceof n?{httpStatus:i.problem.status,problem:i.problem}:{};r({...f(`${G} ${t}: ${i.message}`,[i.name||`Error`],a),counts:{exitCode:1}}),process.exit(1)}function q(e){return ne[ee(e,b)??`cli`]}function J(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:q(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>ue(e.cliPath[0])).map(e=>e.cliPath[0]??``)),i=new Set,a=new Set;for(let{cliPath:e,deprecated:t}of n)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);i.add(r),t!==!0&&a.add(r)}for(let t of n)gt(e,t,r,a,i.has(t.cliPath.join(` `)))}function gt(e,t,n,r,i){let a=t.cliPath,o=e,s=``,c=!n.has(a[0]??``);for(let e of a.slice(0,-1)){s=s===``?e:`${s} ${e}`;let t=c&&s===e||!r.has(s);o=_t(o,e,s,t)}let l=a.at(-1)??t.operationId,u=o.commands.find(e=>e.name()===l)??o.command(l,t.deprecated===!0?{hidden:!0}:{}),d=t.requestBody?.flatMap(({parameter:e})=>e)??[];u.summary(t.summary||t.operationId).description([`${t.method} ${t.path}.`,t.summary||t.description,`Full documentation: ${G} help ${t.cliPath.join(` `)}`,t.requestBody?.[0]?.kind===`json`||[...t.parameters,...d].some(e=>h(e.schemaType,e.itemSchemaType))?_:``].filter(Boolean).join(`
3
+ `));let p=ae(t);for(let e of t.parameters)vt(u,e,i||e===p);Ve(u,t),g(t.intent)&&!u.options.some(e=>e.long===`--execute`)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),T(u),u.hook(`preAction`,e=>de(e,t)),t.explain===!0&&u.option(`--explain`,`Print the search strategy and parsed constraints before the results`),p!==void 0&&u.argument(`[text...]`,p.description||`Same as ${ie(p.flag)}.`),u.action(async function(){let{emit:e,emitSearchExplanation:n}=await import(`./output-BSANHETF.js`),r=this.optsWithGlobals(),i=C(r),a=r;if(p!==void 0){let t=oe(p,this.args,r);if(!t.ok||t.data===null)return e({mode:i},t);a=t.data}let o=se(t,a);if(o.length>0)return e({mode:i},f(`missing required options: ${o.join(`, `)}`));let s=await yt(t,a,i),c=ut(t,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&n(i,s.data),s.ok&&s.data instanceof Uint8Array?process.stdout.write(s.data):e({mode:i},s)})}function _t(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=b[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function vt(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 yt(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-D20qhSmV.js`),{pendingResult:a}=await import(`./output-BSANHETF.js`);if(t.environment!==void 0){let e=c(t.environment);if(e===null)return f(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${s().join(`, `)}`]);process.env.API_ENV=e}let o=await M(e,t);if(!o.ok)return o;let l=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)]})),u=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]]})),d=Object.fromEntries(e.parameters.filter(e=>e.location===`header`).flatMap(e=>{let n=t[e.optionKey];return n===void 0||Array.isArray(n)&&n.length===0?[]:[[e.name,Array.isArray(n)?n.join(`,`):String(n)]]}));return ft(e,await i({method:e.method,path:r(e.operationId,l),searchParams:u,headers:d,body:o.data,contentType:x(e,t),auth:e.auth,responseFormat:w(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0,pendingResult:a}))}process.on(`uncaughtException`,e=>K(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>K(e,`unhandledRejection`));var Y=ce(process.argv.slice(2),S),X=Y===`required`?S:re(S),Z=new Ie;Z.name(G).usage(`<command> [subcommand] [options]`).configureHelp(at).version(W.version).summary(`CLI for the aVenture API: companies, people, and news, with the funding, publications, and classifications attached to them`).description(`The aVenture research API from your terminal. Three records — companies,
4
+ people, and news — carry everything else: funding, publications, and tags.
5
+
6
+ Mutations execute directly; --execute is a deprecated no-op.
7
+ The aVenture MCP server tools execute through this same CLI.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${l})`).choices([...s()])).showHelpAfterError(`(run \`${G} --help\` for usage)`);var Q=pt(process.argv.slice(2),Z,X,W);J(Z,Q.generated),await Q.registerBuiltin(),rt(Z,X,G);for(let e of Z.commands)e.helpGroup()||e.helpGroup(q(e.name()).heading);var $;if(U(Z,e=>t=>{throw $=(async()=>{!Q.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await Q.completeTree(J);let{commandExitHandler:n}=await import(`./parse-error-hint-C5ow4RG4.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),Y===`required`){let e=[Z];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await le(`required`)}))}}var bt=new Set(Z.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));Z.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])=>bt.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${o}/sign-up, then run: ${G} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${G} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --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
+ `,`Exit codes:`,` 0 envelope.ok === true
9
+ 1 envelope.ok === false
10
+ `,`Examples:`,` $ ${G} auth login`,` $ ${G} lookup --name Stripe --url https://stripe.com`,` $ ${G} search "fintech companies in Austin"\n`,`Run \`${G} <command> --help\` for its subcommands and options,`,`or \`${G} help <command>\` for its full documentation.`].join(`
11
+ `));try{await Z.parseAsync()}catch(t){await $,t instanceof e?process.exitCode=t.exitCode:await K(t,`parseAsync`)}export{};
@@ -0,0 +1 @@
1
+ import"./package-CZBWjlYb.js";import{c as e,r as t}from"./result-envelope-DXFbrrkt.js";import"./operations-metadata-CsR2YIYJ.js";import"node:fs";import"node:crypto";function n(n,r,i,a){let o=Number(r);return!Number.isInteger(o)||o<i||o>a?t(`${n} must be an integer between ${i} and ${a}, got "${r}"`):e(`${n} parsed`,o)}export{n as parseBoundedInt};
@@ -0,0 +1,17 @@
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-CZBWjlYb.js";import{a as n,f as r,t as i}from"./env-CpA6E7ay.js";import{c as a,r as o}from"./result-envelope-DXFbrrkt.js";import{r as s}from"./auth-resolver-JikQ_vOz.js";import{a as c,t as l}from"./credential-redaction-Fd-q1M6s.js";import{n as u}from"./contract-DuaB1_Ib.js";import{t as d}from"./openapi-composites-B9JPhVYN.js";import{n as f,t as p}from"./openapi-commands-Bf1VrfFs.js";import{t as m}from"./output-DmSQkWKL.js";import{i as h,t as g}from"./output-mode-COLMloqB.js";var _=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers`},{name:`auth`,purpose:`which credential signs in, as which account and role, never secrets`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function v(e,n=t().bin[0]){g(e.command(`doctor`).summary(`One-call selftest: CLI version, schemas, API host, auth scope, command catalog`).description(["Run every environment check in one call and report `{ ok, check: [...] }`:",..._.map(e=>` - ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) or a`,`warned one (the account read failed) does not fail the run. Each failing message names the command that fixes it.`,"--json always carries the report at `.data`; --data prints the report directly when",`every check passes and the result envelope when one fails, like every other command.`].join(`
2
+ `))).action(async function(e){let{emit:t}=await import(`./output-BSANHETF.js`),r=this.optsWithGlobals();r.environment!==void 0&&(process.env.API_ENV=r.environment),t({mode:h(e)},await y(n))})}async function y(e){let t=S(),n=await C(e),[r,i]=await Promise.all([w(e),T(t,e)]),s=[n.check,r,i.check,await D(e),P(t,i.servedFingerprint,n.upgradeAvailable,e)],c={pass:b(s,`pass`),warn:b(s,`warn`),fail:b(s,`fail`),skip:b(s,`skip`)},l=s.filter(e=>e.status===`fail`).map(e=>e.message),u={ok:l.length===0,check:s},d=[`doctor: ${c.pass} pass, ${c.warn} warn, ${c.fail} fail, ${c.skip} skip`,...s.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
3
+ `);return u.ok?a(d,u,{counts:c}):{...o(d,l,{counts:c}),data:u}}function b(e,t){return e.filter(e=>e.status===t).length}function x(e,t,n){return{name:e,status:t,message:n}}function S(){return p.find(e=>e.intent===`status`&&e.resource===`status`)}async function C(e){let{runUpdate:n}=await import(`./builtin-update-mXZgyreW.js`),r=t(),i=n(r,`check`);if(!i.ok||i.data===null)return{check:x(`cli-version`,`skip`,`Could not compare ${r.version} against the registry (${i.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:a,currentVersion:o,latestVersion:s,upgradeAvailable:c}=i.data;return{check:c?x(`cli-version`,`fail`,`Upgrade ${a} from ${o} to ${s}: run \`${e} update\`.`):x(`cli-version`,`pass`,`${a} ${o} matches the latest published release.`),upgradeAvailable:c}}async function w(e){try{let{EntityDetailSchema:e}=await import(`./detail-xQRiBbkt.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return x(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return x(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${l(t)}.`)}}async function T(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-D20qhSmV.js`),i=e??{method:`GET`,path:`/info`,auth:`none`},a;try{a=r().host}catch(e){return{check:x(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${l(e)}.`),servedFingerprint:null}}let s=await n({method:i.method,path:i.path,auth:i.auth,responseFormat:`json`}).catch(e=>o(l(e)));return s.ok?{check:x(`api-host`,`pass`,`${i.method} ${i.path} answered at ${a}.`),servedFingerprint:e===void 0?null:E(s.data)}:{check:x(`api-host`,`fail`,s.httpStatus===401?`Replace or unset the credential ${a} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${i.method} ${i.path} returned ${s.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${i.method} ${i.path} at ${a} returned ${s.summary}.`),servedFingerprint:null}}function E(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}async function D(e){let{isOAuthCredentialExpired:t}=await import(`./oauth-credential-DgtNj00w.js`),n=s(),[r,a]=await Promise.all([k(),A()]);if(a.state===`unavailable`&&a.cause===`environment`)return x(`auth`,`fail`,`Fix the environment configuration first — ${a.summary}.`);let o=n.present,c=a.state===`found`&&a.stored.activation===`active`;if(!o&&r.state===`invalid`)return x(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${r.summary}.`);if(!o&&r.state===`found`&&t(r.stored.credential)&&r.stored.credential.tokens.refresh_token===void 0)return x(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`);if(!o&&!c&&r.state===`unavailable`)return x(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${i.authToken} through the environment — ${r.summary}.`);if(o||r.state===`found`||c){let t=await O(e,n);return x(`auth`,t.status,`Credential source available: ${await j(n,r,a)}; ${t.text}.`)}return a.state===`unavailable`?x(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${i.authToken} through the environment — ${a.summary}.`):x(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${i.authToken} in the environment.`)}async function O(e,t){let{refreshCliCredentials:n}=await import(`./auth-status-render-BkdU5KWp.js`),{inspectPrivateLiveIdentity:i}=await import(`./private-live-identity-w8v84cKs.js`),a=c(r().host),o=await n(e),s=`credential=${t.present?t.source??`env`:o.materialized??`none`}`;try{if(o.failure!==null)throw Error(o.failure);let e=await i(`write`);if(e===null)return{status:`pass`,text:`${s} host=${a}`};let t=e.rbacRole.length===0?`none`:e.rbacRole.join(`,`);return{status:`pass`,text:`${s} account=${e.email??e.id} role=${t} host=${a}`}}catch(t){return{status:`warn`,text:`${s} account=unread host=${a} — GET /v1/auth/me returned ${l(t,[r().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function k(){let{inspectOAuthCredentialStorage:e}=await import(`./oauth-credential-DgtNj00w.js`),t;try{t=c(r().host)}catch(e){return{state:`unavailable`,summary:l(e)}}return await e(t)}async function A(){let{inspectApiKeyCredentialStorage:e}=await import(`./api-key-credential-DqWZhM1S.js`),t;try{t=c(r().host)}catch(e){return{state:`unavailable`,summary:l(e),cause:`environment`}}try{return await e(t)}catch(e){return{state:`unavailable`,summary:l(e),cause:`storage`}}}async function j(e,t,n){let{summarizeCredential:r}=await import(`./auth-status-render-BkdU5KWp.js`);return[r(e),`oauth=${await N(t)}`,`api-key=${await M(n)}`].join(` `)}async function M(e){let{apiKeyExpiryQualifier:t}=await import(`./auth-status-render-BkdU5KWp.js`);if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let n=c(r().host);return`${e.stored.activation}${t(n,e)}`}async function N(e){let{isOAuthCredentialExpired:t}=await import(`./oauth-credential-DgtNj00w.js`);switch(e.state){case`found`:return t(e.stored.credential)?`expired`:`stored`;case`missing`:return`unset`;case`invalid`:return`invalid`;case`unavailable`:return`unavailable`;default:throw Error(`Unsupported OAuth credential state`)}}function P(e,t,n,r){let i=p.length;if(e===void 0)return x(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${i} operations.`);if(t===null)return x(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${f}.`);if(t===`1189d761ed8b026e`)return x(`catalog`,`pass`,`${i} generated operations match the set the API serves (${f}).`);let a=`This catalog describes a different operation set than the API serves (${f} vs ${t})`;return n===!0?x(`catalog`,`fail`,`${a}: run \`${r} update\`.`):x(`catalog`,`skip`,n===!1?`${a}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${a}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${r} update\` with registry access.`)}var F=u(d,`oauth`),I=[u(d,`start`),u(d,`poll`),u(d,`acknowledge`)],L=u(d,`revoke`);function R(n,r=t().bin[0]){let a=H(n);v(a,r);let s=[`${F.description} Default method: OAuth in your browser.`,`With --key: ${I.map(({description:e})=>e).join(` `)}`].join(`
4
+ `);g(V(a,[F,...I],s)).action(z),g(V(a,[L],L.description)).action(B),g(a.command(`status`).summary(`Keep saved credentials current and report them`).description(`Runs the same credential materialization every command runs, then reports:
5
+ - auth: whether AUTH_TOKEN was already set in this shell's environment
6
+ - oauth: the saved OAuth identity and access-token expiry for the selected API host;
7
+ an expired token is renewed with its refresh token and a token the sign-in service rejects is retired
8
+ - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated
9
+ - selected: the credential the next command sends
10
+ - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)
11
+ - api: running CLI package version plus GET /info build metadata
12
+
13
+ Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.
14
+ --verify read|write additionally runs a live permission probe for that scope; it does not
15
+ execute or authorize an arbitrary API operation.`).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){U(this),m({mode:h(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(`
16
+ `)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-BkdU5KWp.js`);U(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`):m({mode:`text`},t.failure===null?Q(`auth token: no credentials resolved`,null,r,{oauth:!0,apiKey:!0}):o(`auth token: ${t.failure}`))})}async function z(e){U(this);let t=h(e);if(e.providers===!0){m({mode:t},await K());return}let n=e.key===!0?await(await import(`./api-key-login-C0CGjCDi.js`)).loginApiKeyCredential({noBrowser:!e.browser,clientLabel:e.clientLabel}):await(await import(`./oauth-login-Cy08UOVd.js`)).loginOAuthCredential({noBrowser:!e.browser});m({mode:t},n)}async function B(e){let{logoutCliCredentials:t}=await import(`./logout-Bdp97kEK.js`);U(this),m({mode:h(e)},await t({forgetLocal:e.forgetLocal===!0}))}function V(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 H(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${F.command}\`: ${F.summary}; \`--key\` ${I[0].summary.toLowerCase()}.`,`\`${L.command}\`: ${L.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build metadata.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth token` prints the bearer token the next command sends."].join(`
17
+ `))}function U(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function W(e,n){let{resolveAuthStatus:s}=await import(`./auth-resolver-p3AsKEaj.js`),{inspectOAuthCredentialStorage:u}=await import(`./oauth-credential-DgtNj00w.js`),{apiKeyCredentialDiagnostics:d,inspectLiveAuth:f,oauthCredentialDiagnostics:p,refreshCliCredentials:m,renderAuthStatus:h}=await import(`./auth-status-render-BkdU5KWp.js`),g;try{g=c(r().host)}catch(e){return o(`auth status: invalid API host — ${l(e)}`)}let _=s(),v=m(e),[y,b]=await Promise.all([Z(`/info`,`GET /info`),q()]),x=await v,[S,C]=await Promise.all([u(g),G(g)]),w=n===void 0?null:await f(n,S,C.inspection,x),T=t().version,E=d(g,C.inspection,C.verification),D=h({cliName:e,cliVersion:T,apiVersion:y.ok?await Y(y.data):null,oauth:S,apiKey:E,providers:b,resolved:_,refresh:x,live:w}),O={cli:{version:T},api:y.ok?y.data??null:null,auth:{[i.authToken]:_},selected:x.materialized,oauth:p(g,S),apiKey:E,providers:b,live:w,...y.ok?{}:{apiError:y.summary}};return x.failure===null?!y.ok&&y.httpStatus===401?{...o(`auth status: the API rejected the selected credential (401) | ${D}`,[`Replace or unset ${i.authToken}, or run \`${e} auth login\`.`]),data:O}:w!==null&&w.error!==null?{...o(`auth status: ${w.scope} permission probe failed — ${w.error}`,[w.error]),data:O}:w!==null||_.present||S.state===`found`||C.inspection.state===`found`?a(D,O):Q(`auth status: no credentials resolved | ${D}`,O,e,{oauth:S.state===`missing`,apiKey:C.inspection.state===`missing`}):{...o(`auth status: ${x.failure} | ${D}`,[x.failure]),data:O}}async function G(e){let{refreshStoredApiKeyCredential:t}=await import(`./api-key-credential-verification-C-hPkWdf.js`),n=await J(e);if(n.state!==`found`)return{inspection:n,verification:null};let{stored:r,verification:i}=await t(n.stored);return{inspection:{state:`found`,stored:r},verification:i}}async function K(){let e=await q();return e.state===`found`?a(`Sign-in providers for the selected API host`,e.catalog):o(`auth login --providers: ${e.summary}`)}async function q(){try{let{fetchAuthProviderCatalog:e}=await import(`./oauth-login-Cy08UOVd.js`);return{state:`found`,catalog:await e()}}catch(e){return{state:`unavailable`,summary:l(e)}}}async function J(e){try{let{inspectApiKeyCredentialStorage:t}=await import(`./api-key-credential-DqWZhM1S.js`);return await t(e)}catch(e){return{state:`invalid`,summary:l(e)}}}async function Y(e){let{SystemBuildSchema:t}=await import(`./system-build-z_cn0X5C.js`);if(!X(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 X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Z(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-D20qhSmV.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 Q(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{R as registerBuiltinAuthCommands};
@@ -0,0 +1 @@
1
+ import{c as e,r as t}from"./result-envelope-DXFbrrkt.js";import{t as n}from"./output-DmSQkWKL.js";import{i as r,t as i}from"./output-mode-COLMloqB.js";var a=5e3,o=6e4,s=3e4,c=86400;function l(e){let t=e.commands.find(e=>e.name()===`research-runs`);if(t===void 0)return;let a=t.command(`wait`).summary(`Wait for one research run to finish, then report its outcome`).description("Polls `research-runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, spend, and last event time; 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.").requiredOption(`--run-id <uuid>`,`Research run id`).option(`--timeout <seconds>`,`Total seconds to wait`,`1800`);i(a),a.action(async function(){let e=this.optsWithGlobals();n({mode:r(e)},await u(e))})}async function u(e){let{setTimeout:n}=await import(`node:timers/promises`),{buildOpenApiPath:r}=await import(`./openapi-call-D20qhSmV.js`),{parseBoundedInt:i}=await import(`./batch-io-3UNbuV96.js`),s=i(`--timeout`,e.timeout,1,c);if(!s.ok||s.data===null)return t(s.summary);let l=Date.now()+s.data*1e3,u=r(`getResearchRun`,{runId:e.runId}),p=a,m=`not read yet`,h=(n=`after ${s.data}s`)=>t(`Run ${e.runId} is still ${m} ${n}`,[`Wait longer with --timeout, or read it with \`research-runs get --run-id ${e.runId}\`.`]);for(;;){if(l-Date.now()<=0)return h();let e=0,t=await f(u,l);if(t.kind===`deadline`)return h();if(t.kind===`refused`)return t.envelope;if(t.kind===`detail`){let{run:e}=t.detail;if(e.status===`completed`||e.status===`failed`||e.status===`stopped`)return await d(t.detail,l);m=`${e.status}, last event ${t.detail.lastEventAt??`none`}`}else m=`unread (${t.reason})`,e=(t.retryAfterSeconds??0)*1e3;let r=l-Date.now();if(r<=0||e>=r)return h(r<=0?`after ${s.data}s`:`and the API asks for ${e/1e3}s, past the ${s.data}s --timeout`);let i=Math.max(e,a+Math.random()*(p-a));await n(Math.min(i,r)),p=Math.min(p*2,o)}}async function d(t,n){let{readResearchRunSpend:r}=await import(`./research-run-spend-D9aXcq6b.js`),{run:i}=t,a=await r({runId:i.id,deadline:n}),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 f(e,n){let{HarnessRunDetailSchema:r}=await import(`./run-detail-TzF_MGxB.js`),{runOpenApiCall:i}=await import(`./openapi-call-D20qhSmV.js`),{isTransientRefusal:a,isTransportFailure:o}=await import(`./request-replay-BkF-apRY.js`),{retrySeconds:c}=await import(`./response-problem-C1c4ogJm.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{l as registerBuiltinResearchRunWaitCommand};
@@ -0,0 +1,3 @@
1
+ import{a as e,n as t,r as n,t as r}from"./package-CZBWjlYb.js";import{c as i,r as a}from"./result-envelope-DXFbrrkt.js";import{t as o}from"./output-DmSQkWKL.js";import{i as s,t as c}from"./output-mode-COLMloqB.js";import{t as l}from"./completion-setup-CwJt88xW.js";import{spawnSync as u}from"node:child_process";import{basename as d,dirname as f,relative as p,resolve as m,sep as h}from"node:path";import{existsSync as g,lstatSync as _,mkdirSync as v,mkdtempSync as y,readdirSync as b,readlinkSync as x,realpathSync as S,renameSync as C,symlinkSync as w}from"node:fs";import{randomUUID as T}from"node:crypto";var E=new Intl.Collator(void 0,{numeric:!0}),D=2e4,O=[`lib`,`aventurevc-releases`];function k(t,n=e()){let r=n.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;c(t.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). ${r}`,`--execute is deprecated, accepted, and ignored; update executes by its verb.`].join(`
2
+ `)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>o({mode:s(e)},A(void 0,`apply`,e.release)))}function A(r,o=`apply`,s){let c=r;try{c??=e(process.argv[1])}catch(e){return a(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let l=c.name,u=c.version,f=c.registry===``?``:t,p=c.registry===``&&l===`@aventurevc/aventure-cli`,h=s;if(h===void 0){let e=j([`view`,f,`version`,`--silent`,`--global`],c,{timeout:D});if(!e.ok)return{...e,data:null};if(h=(e.data??``).trim(),h===``)return a(`npm view ${f} returned empty version`,[`empty_stdout`])}let _=s!==void 0||p||E.compare(u,h)<0,x={targetPackage:f,runningPackage:l,currentVersion:u,latestVersion:h,upgradeAvailable:_,upgradeInstalled:!1};if(o===`check`)return i(`${l}@${u} → ${f}@${h} (${_?`available`:`up to date`})`,x);if(c.workingTreeRoot!==null)return a(`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=P(c),t=m(e,...O),r=d(f),a=m(t,`${r}-current`),o=f===``?[f,``]:[f,n],l=F(e,c),p=s??[h,l?.version??u].reduce((e,t)=>E.compare(e,t)<0?t:e,u);v(t,{recursive:!0});let _=[N(c),...g(a)?[S(a)]:[],...b(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>m(t,e.name))],C,w=null,T=!1;for(let t of new Set(_.filter(t=>t!==e))){let e=M(t,o,p,c.registry);if(e.ok&&e.data!==null){C=t,w=e.data;break}}if(C===void 0){C=y(m(t,`${r}-${encodeURIComponent(p)}-`));let e=j([`install`,`-g`,`--prefix`,C,...o.map(e=>`${e}@${p}`)],c,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};T=!0;let n=M(C,o,p,c.registry);if(!n.ok)return{...n,data:null};w=n.data}if(w===null)throw Error(`release verification produced no package`);let D=I(C,e,a,w,s),k=R();return i(`${f} active at ${D}`,{...x,upgradeInstalled:T||s!==void 0||l?.version!==D,installPrefix:e,verifiedVersion:D,completionRefreshed:k.refreshed,completionRefreshMessage:k.message})}catch(e){return a(`${f} update failed: ${L(e)}`,[`existing releases were preserved`])}}function j(e,t,n={}){let r={...process.env};t.registry===``?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let o=[...e,`--@aventurevc:registry=${t.registry}`],s=u(`npm`,o,{env:r,encoding:`utf8`,...n});if(s.error)return s.signal===`SIGTERM`&&n.timeout!==void 0?a(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):a(`npm ${e[0]??``} failed to start: ${s.error.message}`,[`spawn_error`]);if(s.status!==0){let t=(s.stderr??``).trim().split(`
3
+ `).slice(-3).join(` | `);return a(`npm ${e.join(` `)} exited ${s.status}`,[t||`no stderr`])}return i(`npm ok`,s.stdout??``)}function M(t,n,r,o){try{let a=n.map(n=>{let i=e(m(t,`lib`,`node_modules`,...n.split(`/`),`package.json`));if(i.name!==n||i.version!==r||i.registry!==o)throw Error(`${n} does not match ${r} from ${o}`);for(let e of i.bin)if(!S(m(t,`bin`,e)).startsWith(`${i.packageRoot}${h}`))throw Error(`${e} escapes ${i.packageRoot}`);return i});for(let e of a){let n=m(t,`bin`,e.bin[0]),i=u(process.execPath,[n,`--version`],{encoding:`utf8`,timeout:D});if(i.error)throw Error(`${e.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==r)throw Error(`${e.name} expected ${r} but reported ${a||`empty output`}`)}return i(`CLI and MCP release verified`,a)}catch(e){return a(`release verification failed: ${L(e)}`,[`release prefix: ${t}`])}}function N(e){let t=f(e.packageRoot),n=f(t),r=f(n);if(d(t)!==e.name.split(`/`)[0]||d(n)!==`node_modules`||d(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${h}`))throw Error(`the running entry escapes its package root`);return f(r)}function P(e){let t=N(e),n=`${h}${O.join(h)}${h}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function F(t,n){let i=n.registry===``?d(``):r,a=m(t,`bin`,i);if(!g(a))return null;let o=e(a);if(o.registry!==n.registry)throw Error(`${a} belongs to another product`);return o}function I(t,n,r,i,a){let o=i[0];if(o===void 0)throw Error(`release contains no CLI`);let s=m(n,`bin`);v(s,{recursive:!0});let c=i.flatMap(t=>t.bin.filter((t,n)=>{let r=m(s,t);if(!g(r)||e(r).registry===o.registry)return!0;if(o.registry!==``&&n>0)return!1;throw Error(`${r} belongs to another product`)}));if(!g(r)){let e=y(m(f(r),`${d(r)}-seed-`));v(m(e,`bin`));for(let n of c){let r=m(s,n);w(S(g(r)?r:m(t,`bin`,n)),m(e,`bin`,n))}try{w(p(f(r),e),r)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!_(r).isSymbolicLink())throw Error(`${r} is not a release symlink`);for(let e of c){let t=p(s,m(r,`bin`,e)),n=m(s,`.${e}-${T()}`);w(t,n),C(n,m(s,e))}for(let e of c){let t=m(s,e);if(!_(t).isSymbolicLink()||m(s,x(t))!==m(r,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let l=F(n,o);if(a===void 0&&l!==null&&E.compare(l.version,o.version)>0)return l.version;let u=`${r}-${T()}`;return w(p(f(r),t),u),C(u,r),o.version}function L(e){return e instanceof Error?e.message:String(e)}function R(){try{return l()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}export{k as registerBuiltinUpdateCommand,A as runUpdate};
@@ -1 +1 @@
1
- import{d as e}from"./tool-policy-BPefkvzQ.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return t?.[e]?.section??d[e]}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,directory:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,"research-runs":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
1
+ import{d as e}from"./tool-policy-C37kGt8n.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return t?.[e]?.section??d[e]}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,directory:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,"research-runs":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
@@ -0,0 +1 @@
1
+ import{S as e,_ as t,s as n}from"./iso-l1vOidnb.js";var r=t({authorizationServer:e(),clientId:e(),mcpResource:e().nullish(),redirectUri:e(),resource:e(),scope:n(e())});export{r as t};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./package-CZBWjlYb.js";import{t}from"./openapi-commands-CKb-tN3f.js";import{n,r}from"./completion-setup-CwJt88xW.js";import{o as i}from"./generated-option-order-CZUJFgSS.js";import a from"node:process";function o(i,o=t,s=e().bin[0]){let l=i.command(`completion`).summary(`Generate shell completion scripts`).description(`Generate shell completion scripts for the aVenture CLI.`);for(let e of[`bash`,`fish`,`zsh`])l.command(e).summary(`Print ${e} shell completions`).description(`Print ${e} completion definitions for ${s}.`).action(()=>{a.stdout.write(c(i,e,o))});n(l,s),r(l,s)}function s(){return e().bin}function c(e,n,r=t,i=s()){let a=_(r);return n===`fish`?[`# fish completions for ${i.join(`, `)}`,...u(e),...i.map(e=>`complete -c ${N(e)} -e`),`${A(i)} -f`,...d(e,i),...f(e,a,i),``].join(`
1
+ import{a as e}from"./package-CZBWjlYb.js";import{t}from"./openapi-commands-Bf1VrfFs.js";import{n,r}from"./completion-setup-CwJt88xW.js";import{o as i}from"./generated-option-order-uCio4nh5.js";import a from"node:process";function o(i,o=t,s=e().bin[0]){let l=i.command(`completion`).summary(`Generate shell completion scripts`).description(`Generate shell completion scripts for the aVenture CLI.`);for(let e of[`bash`,`fish`,`zsh`])l.command(e).summary(`Print ${e} shell completions`).description(`Print ${e} completion definitions for ${s}.`).action(()=>{a.stdout.write(c(i,e,o))});n(l,s),r(l,s)}function s(){return e().bin}function c(e,n,r=t,i=s()){let a=_(r);return n===`fish`?[`# fish completions for ${i.join(`, `)}`,...u(e),...i.map(e=>`complete -c ${N(e)} -e`),`${A(i)} -f`,...d(e,i),...f(e,a,i),``].join(`
2
2
  `):l(e,n,a,i)}function l(e,t,n,r){let i=t===`zsh`?`typeset -ga `:``,a=`complete -F _aventure_cli ${r.map(e=>e.replaceAll(`'`,`'\\''`)).join(` `)}`,[o,s,c]=b(e,n);return[...t===`zsh`?[`#compdef ${r.join(` `)}`]:[],`# ${t} completions for ${r.join(`, `)}`,`${i}_aventure_cli_commands=(`,...o.map(e=>` ${e}`),`)`,`${i}_aventure_cli_options=(`,...s.map(e=>` ${e}`),`)`,`${i}_aventure_cli_values=(`,...c.map(e=>` ${e}`),`)`,``,...C(t),...t===`bash`?[a,``]:[``]].join(`
3
3
  `)}function u(e){return[`function __aventure_cli_command_path\n set -l global_value_options ${p(e).filter(e=>e.required||e.optional).flatMap(e=>E(e)??[]).map(N).join(` `)}\n set -l tokens (commandline -xpc)\n if test (count $tokens) -gt 0\n set -e tokens[1]\n end\n set -l path\n set -l skip_next 0\n for token in $tokens\n if test $skip_next -eq 1\n set skip_next 0\n continue\n end\n if string match -q -- '--*=*' $token\n set -l name (string replace -r '^--([^=]+)=.*$' '$1' -- $token)\n contains -- $name $global_value_options; and continue\n end\n if string match -q -- '--*' $token\n set -l name (string replace -r '^--' '' -- $token)\n if contains -- $name $global_value_options\n set skip_next 1\n continue\n end\n break\n end\n if string match -q -- '-*' $token\n break\n end\n set -a path $token\n end\n printf '%s\\n' $path\nend\n`,`function __aventure_cli_path_is
4
4
  set -l expected $argv
@@ -0,0 +1 @@
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{o as t}from"./tool-policy-C37kGt8n.js";import{a as n,o as r}from"./cli-help-policy-CEZPZEOQ.js";import{n as i,t as a}from"./contract-parameter-zkhCaKUz.js";function o(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=d(t,i(e,t),n);if(t.legacyName===void 0)return r;let a=d(t,i(e,t,t.legacyName),n).flag;return a===r.flag?r:Object.assign(r,{legacyFlag:a})})}),n=e.requestBody?.map(n=>{let r=l(e,t,n),i=c(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`)),a=r?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,mutates:e.projection.mutates,errorResponse:e.errorResponse,successResponse:a,detailField:r?.detailField,parameters:t}})}function s(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function c(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function l(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>u(e.name)-u(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=a(e,t,r);return r.add(n),[d(t,n,`body`)]})}function u(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function d(i,a,o){let s=i.itemSchemaEnum??i.schemaEnum,c=r(i.schemaType,i.itemSchemaType,i.schemaFormat,a),l=`${t(a)} ${i.schemaType===`boolean`?`[${c}]`:`<${c}>`}`;return{name:i.name,optionKey:new e(l).attributeName(),flag:l,required:i.required&&i.schemaDefault===void 0,description:n(i.description,s),schemaType:i.schemaType,schemaFormat:i.schemaFormat,itemSchemaType:i.itemSchemaType,defaultValue:f(i.schemaDefault),choices:s,...i.envName===void 0?{}:{envName:i.envName},...i.visibility&&{visibility:i.visibility},location:o}}var f=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{s as n,o as t};
@@ -0,0 +1 @@
1
+ import"./tool-policy-C37kGt8n.js";function e(e,t,n=t.inputName){if(t.in===`body`)return n;let r=f.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?d(c(n!==`id`&&n!==`slug`?n:`${i(e.path)}${s(n)}`),t):r.inputName}function t(e,t,r=o(e)){return n(a(e,t),new Set(r))}function n(e,t){if(!t.has(e))return e;let n=`body${s(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function r(e,t,n){return`${e}[${t}].${n}`}function i(e){return p.find(([,t])=>t.test(e))?.[0]??`record`}function a(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=l(t);return d(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?c(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function o(t){return new Set(t.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(n=>e(t,n)))}function s(e){return e.replace(/^./u,e=>e.toUpperCase())}function c(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function l(e){let t=c(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?u(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function u(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function d(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var f=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],p=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];export{e as n,r,t};
@@ -0,0 +1 @@
1
+ import{s as e}from"./env-CpA6E7ay.js";import{i as t}from"./response-problem-D7yaxq6L.js";function n(e){let t=e.trim();if(t.length===0)throw Error(`API host must not be blank`);let n=new URL(o(t)?t:`${s(t)}://${t}`),r=c(n.hostname);if(n.protocol!==`https:`&&n.protocol!==`http:`||n.username.length>0||n.password.length>0||n.pathname!==`/`&&n.pathname!==``||n.search.length>0||n.hash.length>0)throw Error(`API host must contain only an HTTP(S) host and optional port`);if(n.protocol===`http:`&&!r)throw Error(`stored credentials require HTTPS except for loopback API hosts`);return{host:n.host.toLowerCase(),origin:n.origin,isLoopback:r}}function r(t){let r=n(t);return r.isLoopback?n(e()).host:r.host}function i(e){return{...e,host:n(e.host).origin}}function a(e){let t=n(e);if(t.isLoopback)return`http://localhost:3000`;if(t.host===`api.aventure.vc`)return`https://aventure.vc`;throw Error(`no first-party browser origin is configured for API host ${t.host}`)}function o(e){return/^[a-z][a-z\d+.-]*:\/\//iu.test(e)}function s(e){let t=e.split(`/`,1)[0]?.toLowerCase()??``;try{return c(new URL(`http://${t}`).hostname)?`http`:`https`}catch{return`https`}}function c(e){let t=e.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`0.0.0.0`||t===`[::1]`}function l(e,n=[]){let r=e instanceof Error?e.message:String(e);return t(r,n)}function u(e,n=[]){let r=t(e.title,n),i=t(e.detail?.trim()??``,n);return`${e.status} ${r}${i?` — ${i}`:``}`}export{r as a,n as i,u as n,c as o,a as r,i as s,l as t};
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./package-CZBWjlYb.js";import{n as t,t as n}from"./auth-resolver-JikQ_vOz.js";import{o as r}from"./logging-BHp-5JwI.js";import{o as i,t as a}from"./credential-redaction-Fd-q1M6s.js";import{execFile as o}from"node:child_process";import{dirname as s,join as c}from"node:path";import{platform as l}from"node:os";import{chmod as u,mkdir as d,readFile as f,rename as p,rm as m,stat as h,writeFile as g}from"node:fs/promises";import{AsyncLocalStorage as _}from"node:async_hooks";import{setTimeout as v}from"node:timers/promises";import{randomUUID as y}from"node:crypto";var b=2;function x(e,t){return w(e,t).redactedUrl}async function S(e,t,n){let r=w(e,t);return await C(new URL(r.openerUrl),n)}async function C(e,t){let n=t.environment??process.env,r=t.operatingSystem??l(),i=T(t.noBrowser,n,r);if(i!==null)return{state:`skipped`,reason:i};let a=E(r,e.toString());if(a===null)return{state:`failed`,reason:`unsupported browser-opening platform: ${r}`};try{return await D(a.command,a.arguments),{state:`opened`,reason:null}}catch{return{state:`failed`,reason:`browser opener failed`}}}function w(e,t){let{id:n,verificationUrl:r,pollSecret:a}=e,o,s;try{o=new URL(r),s=new URL(t)}catch{throw Error(`broker returned an invalid browser verification URL`)}if(s.username.length>0||s.password.length>0||s.pathname!==`/`||s.search.length>0||s.hash.length>0)throw Error(`configured browser origin must contain only an origin`);let c=i(s.hostname);if(s.protocol!==`https:`&&!(s.protocol===`http:`&&c))throw Error(`configured browser origin must use HTTPS except for loopback development`);let l=new URLSearchParams(o.hash.slice(1)),u=[...l.keys()],d=l.getAll(`cliAuthorizationId`),f=l.getAll(`browserSecret`),p=f[0]??``;if(o.origin!==s.origin||o.protocol!==s.protocol||o.username.length>0||o.password.length>0||o.pathname!==`/settings/developer`||o.search.length>0||u.length!==b||d.length!==1||d[0]!==n||f.length!==1||p.length===0||a.length===0||p===a)throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let m;try{m=decodeURIComponent(r)}catch{throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`)}if(r.includes(a)||m.includes(a))throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let h=new URL(o);return h.hash=new URLSearchParams({cliAuthorizationId:n,browserSecret:`<redacted>`}).toString(),{openerUrl:r,redactedUrl:h.toString()}}function T(e,t,n){return e?`--no-browser was set`:n===`darwin`&&t.CODEX_SESSION_ID?`macOS Codex browser process boundary`:t.SSH_CONNECTION||t.SSH_CLIENT||t.SSH_TTY?`SSH/headless session detected`:(n===`linux`||n===`freebsd`)&&!t.DISPLAY&&!t.WAYLAND_DISPLAY?`no graphical display detected`:null}function E(e,t){return e===`darwin`?{command:`open`,arguments:[t]}:e===`win32`?{command:`rundll32.exe`,arguments:[`url.dll,FileProtocolHandler`,t]}:e===`linux`||e===`freebsd`?{command:`xdg-open`,arguments:[t]}:null}function D(e,t){return new Promise((n,r)=>{o(e,[...t],{timeout:5e3,windowsHide:!0},e=>e?r(e):n())})}var O=100,k=3e4,A=6e4,j=new _;function M(){return c(s(n()),`credentials.json`)}function N(e){return`OS keyring is unusable (${e}); the credential will be stored in ${M()} (mode 0600).\n`}async function P(e,t){let n=(await V())[e]?.[t];if(n!==void 0)return{record:{provider:`file`,value:n}};try{let n=await(await B(e,t)).getPassword()??void 0;return n===void 0?{}:{record:{provider:`keyring`,value:n}}}catch(e){return{keyringFailure:z(e)}}}async function F(e,t,n){if((await V())[e]?.[t]!==void 0)return await I(e,t,n,`file store holds this account`);let r;try{let i=await B(e,t);if(await i.setPassword(n),await i.getPassword()===n)return await W(e,t,void 0),`keyring`;r=`Error: keyring readback did not match`}catch(e){r=z(e,[n])}return await I(e,t,n,r)}async function I(e,t,n,r){if(await W(e,t,n),(await V())[e]?.[t]!==n)throw Error(`credential storage did not confirm a durable write (keyring: ${r}; file: readback did not match)`);return`file`}async function L(e,t){try{let n=await B(e,t),r;try{await n.deleteCredential()}catch(e){r=e}let i;try{i=await n.getPassword()??void 0}catch(e){throw Error(`OS keyring removal outcome is unknown (${z(r??e)})`,{cause:e})}if(i!==void 0)throw Error(`OS keyring did not confirm removal (${z(r)})`,r===void 0?void 0:{cause:r})}finally{await W(e,t,void 0)}}async function R(e,t){let n=`${t}:probe:${y()}`,r=`aventure-cli-credential-probe:${y()}`,i;try{let t=await B(e,n);await t.setPassword(r);let a=await(await B(e,n)).getPassword(),o=await t.deleteCredential(),s=await(await B(e,n)).getPassword()??void 0;if(a!==r)i=`Error: probe readback did not match`;else if(!o||s!==void 0)i=`Error: probe cleanup was not confirmed`;else return{provider:`keyring`}}catch(e){i=z(e,[r])}try{await U(async()=>{await W(e,n,r);let t=(await V())[e]?.[n];if(await W(e,n,void 0),t!==r)throw Error(`probe readback did not match`)})}catch(e){throw Error(`credential storage is unavailable (keyring: ${i}; file ${M()}: ${z(e,[r])})`,{cause:e})}return{provider:`file`,keyringFailure:i}}function z(e,t=[]){if(!(e instanceof Error))return`Error`;let n=e.name||`Error`,[r=``]=a(e,t).trim().split(`
2
+ `,1);return r&&r!==n?`${n}: ${r}`:n}async function B(e,t){let n=l(),r=n===`linux`||n===`freebsd`?T(!1,process.env,n):null;if(r!==null)throw Error(`OS keyring unlock prompt is unreachable (${r})`);let{AsyncEntry:i}=await import(`@napi-rs/keyring`);return new i(e,t)}async function V(){let e=M(),n;try{n=await f(e,`utf8`)}catch(e){if(t(e,`ENOENT`))return{};throw e}let r;try{r=JSON.parse(n)}catch(t){return await H(e,t)}return K(r)?r:await H(e,void 0)}async function H(n,i){let a=`${n}.corrupt-${new Date().toISOString().replace(/[:.]/gu,`-`)}`;try{await p(n,a)}catch(e){if(t(e,`ENOENT`))return{};throw Error(`${n} is not a valid credential file and could not be moved aside`,{cause:e})}return r({component:e().bin[0],event:`credential_file_quarantined`,message:`${n} is not a valid credential file; moved it to ${a} and continuing with an empty file store`,...i===void 0?{}:{error:i}}),{}}async function U(e){if(j.getStore()===!0)return await e();let n=`${M()}.lock`;await d(s(n),{recursive:!0,mode:448});let r=Date.now()+k,i=y();for(;;){try{await g(n,i,{flag:`wx`,mode:384});break}catch(e){if(!t(e,`EEXIST`))throw e}if(await h(n).then(e=>Date.now()-e.mtimeMs,()=>0)>A)await m(n,{force:!0});else if(Date.now()>r)throw Error(`credential store is locked by another CLI process (${n})`);else await v(O)}try{return await j.run(!0,e)}finally{await f(n,`utf8`).catch(()=>``)===i&&await m(n,{force:!0})}}async function W(e,t,n){await U(async()=>await G(e,t,n))}async function G(e,t,n){let r=M(),i=await V(),a={...i[e]};if(n===void 0?delete a[t]:a[t]=n,Object.keys(a).length===0?delete i[e]:i[e]=a,Object.keys(i).length===0){await m(r,{force:!0});return}await d(s(r),{recursive:!0,mode:448});let o=`${r}.${y()}.tmp`;await g(o,`${JSON.stringify(i,null,2)}\n`,{mode:384}),await u(o,384),await p(o,r)}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`string`))}export{U as a,S as c,P as i,x as l,N as n,F as o,R as r,C as s,L as t};
@@ -0,0 +1 @@
1
+ import{C as e,E as t,S as n,_ as r,c as i,d as a,f as ee,g as o,i as s,n as c,s as l,t as u}from"./iso-l1vOidnb.js";import{t as d}from"./person-owner-BRGa5Dee.js";import{n as te,r as ne,t as f}from"./entity-Cg2n2mP0.js";import{t as re}from"./type-C0VR7LD-.js";var ie=s([`domicile`,`dominant`,`origin`]),ae=r({endDate:u().nullish(),id:a(),isCurrent:i(),role:ie.nullish(),startDate:u().nullish()}),oe=r({id:a().nullish(),name:n()}),se=r({countryCodeChar2:n().nullish(),countryCodeChar3:n().nullish(),id:a().nullish(),name:n(),unRegion:n().nullish(),unSubregion:n().nullish()}),ce=r({id:a().nullish(),name:n(),stateAbbrev:n().nullish()}),p=r({address:a().nullish(),addressLine1:n().nullish(),addressLine2:n().nullish(),association:l(ae).optional(),city:oe.nullish(),country:se.nullish(),countryAbbrev:n().nullish(),createdAt:c({offset:!0}).nullish(),fullAddress:n().nullish(),id:a().nullish(),isCurrent:i().nullish(),isHq:i().nullish(),isPrimary:i().nullish(),latitude:o().nullish(),longitude:o().nullish(),postalCode:n().nullish(),state:ce.nullish(),stateAbbrev:n().nullish(),street:n().nullish(),updatedAt:c({offset:!0}).nullish()}),m=s([`editorial`,`standardized`]),h=Object.assign(e([m,n()]),{enum:m.enum}),le=r({isCurrent:i().nullish(),isPrimary:i().nullish(),name:n().max(255),registry:h}),g=ee(le,r({bucket:n().nullish(),classificationId:a().nullish(),createdAt:c({offset:!0}).nullish(),id:a(),isCurrent:i().nullish(),isPrimary:i().nullish(),name:n().max(255),slug:n().regex(/^[a-z0-9_-]+$/).max(255).nullish(),type:n(),updatedAt:c({offset:!0}).nullish()})),_=r({category:n(),classificationId:a().nullish(),code:a().nullish(),createdAt:c({offset:!0}).nullish(),id:a(),isCurrent:i().nullish(),isPrimary:i().nullish(),level:a().nullish(),name:n().max(255),registry:h,updatedAt:c({offset:!0}).nullish()}),ue=r({geoLocationExposure:l(g).default([]).optional(),industry:l(g).default([]).optional(),mainProduct:l(g).default([]).optional(),standardizedClassification:l(_).default([]).optional(),tag:l(g).default([]).optional(),typeCustomer:l(g).default([]).optional(),typeModel:l(g).default([]).optional(),typeOwnership:l(g).default([]).optional(),typeRevenue:l(g).default([]).optional(),typeTechnologyUsed:l(g).default([]).optional()}),v=s(`Angel.Pre-Seed.Seed.Series A.Series B.Series C.Series D.Series E.Series F.Series G.Series H.Series I.Series J.Series K.Series L.Series M.Series N.Series O.Series P.Series Q.Series R.Series S.Series T.Series U.Series V.Series W.Series X.Series Y.Series Z.Late Stage Private.Investment Firm.Fund.Nonprofit.Government.Public.Acquired.Acquired Subsidiary.Bankrupt`.split(`.`)),y=Object.assign(e([v,n()]),{enum:v.enum}),b=r({currency:n().nullish(),fundingRoundCount:a(),investorCount:a(),latestValuation:o().nullish(),mostRecentAmount:o().nullish(),mostRecentDate:u().nullish(),stage:y.nullish(),totalRaised:o(),totalRaisedUsd:o().nullish(),unconvertedRoundCount:a()}),x=r({expanded:n().nullish(),generatedDescription:n().nullish(),short:n().nullish()}),de=s([`cloudflare`,`akamai`,`fastly`,`awsCloudfront`,`vercel`,`netlify`,`sucuri`,`incapsula`,`bunny`,`keycdn`,`cdn77`,`gcore`,`cdnetworks`,`azureCdn`,`leaseweb`,`digitalocean`,`stackpath`,`googlecloudCdn`,`none`,`unknown`]),fe=s([`static`,`jsRequired`,`jsEnhanced`]),S=n(),C=r({crawlCdnProvider:de.nullish(),crawlRenderMode:fe.nullish(),createdAt:c({offset:!0}).nullish(),id:a().nullish(),isCurrent:i().nullish(),isPrimary:i().nullish(),owner:d.nullish(),sourceId:n().nullish(),status:n().nullish(),statusChecked:c({offset:!0}).nullish(),updatedAt:c({offset:!0}).nullish(),url:n(),urlType:S}),w=r({address:l(p),classification:ue,fundingDetail:b.nullish(),headquartersAddressId:a().nullish(),headquartersRemoteAsOf:c({offset:!0}).nullish(),text:x,urlLink:l(C)}),T=s([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),E=r({amountInvested:o().nullish(),createdAt:c({offset:!0}),financialInstrumentType:T.nullish(),id:t(),investor:d,investorName:n().nullish(),investorSlug:n().regex(/^[a-z0-9_-]+$/).max(255).nullish(),leadInvestor:i(),transactionId:t(),updatedAt:c({offset:!0})}),D=r({core:f,fundingDetail:b.nullish()}),O=r({lastFetchedAt:c({offset:!0}).nullish(),publishedAt:c({offset:!0}).nullish(),recordedAt:c({offset:!0}),sourceDetail:n()}),k=s([`High`,`Medium`,`Low`,`Verified`]),pe=s([`direct`,`managedFund`]),A=r({round:n()}),j=r({amountInvested:o().nullish(),attributionType:pe,beneficialEntityId:t().nullish(),fundManagerRelationshipId:a().nullish(),joinId:t(),leadInvestor:i(),recordedEntityId:t().nullish(),round:A.nullish(),transactionId:t()}),M=r({amountRaised:o().int().nullish(),createdAt:c({offset:!0}).nullish(),currency:n().nullish(),dataConfidence:k.nullish(),dateAnnounced:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),dateFundingComplete:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),dateInvestorExit:c({offset:!0}).nullish(),entity:D.nullish(),financialInstrumentType:T.nullish(),id:t(),investor:l(E).nullish(),investorAttribution:j.nullish(),investorCount:a().nullish(),publicSource:O.nullish(),round:n().nullish(),roundType:n().nullish(),sourceAttribution:l(j),updatedAt:c({offset:!0}).nullish(),valuationPostMoney:o().int().nullish(),valuationPreMoney:o().int().nullish()}),N=r({entity:f,headquarters:p.nullish(),relationshipType:s([`fundManagerFirm`,`productService`])}),me=r({fundingStage:y.nullish(),ownership:l(n()),pricingModel:l(n()),sellsTo:l(n()),totalRaised:o().nullish(),website:n().nullish()}),P=r({asOf:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),comparisonSignals:me.nullish(),createdAt:c({offset:!0}).nullish(),detail:n().nullish(),entity:f,id:a().nullish(),isCurrent:i().nullish(),isPrimary:i().nullish(),publicSource:O.nullish(),get relationship(){return l(P)},relationshipType:n(),sourceEntityId:t().nullish(),targetEntityId:t().nullish(),updatedAt:c({offset:!0}).nullish()}),F=P,I=r({accelerator:f,acceleratorName:n(),asOfDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),batch:n().nullish(),id:n(),program:n().nullish(),status:n().nullish()}),L=s([`text`,`numeric`,`monetary`,`percentage`,`date`]),he=s([`pastDue`,`withinThreeMonths`,`threeToSixMonths`,`sixToTwelveMonths`,`twelveToTwentyFourMonths`,`beyondTwoYears`]),ge=r({asOfDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),bucket:he,monthsFromNow:a(),targetDate:c({offset:!0})}),R=r({asOfDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:i().nullish(),derivedRange:ge.nullish(),discreteValue:o().nullish(),entityId:t(),id:a(),publicSource:O.nullish(),textValue:n().nullish(),typeResearchDetail:n(),updatedAt:c({offset:!0}).nullish(),valueResearchDetail:n().nullish(),valueType:L}),z=r({characterCount:a(),meetsRequirements:i(),violation:l(n()),wordCount:a()}),B=r({compliance:z.nullish(),entityId:t(),id:a(),publicSource:O.nullish(),text:n(),textType:n(),updatedAt:c({offset:!0}).nullish()}),_e=r({acceleratorParticipation:l(I),detail:l(R),snippet:l(B)}),V=r({author:n().nullish(),category:n().nullish(),createdAt:c({offset:!0}).nullish(),excerpt:n().nullish(),externalNewsArticle:i().nullish(),id:a(),newsImageThumbnail:n().nullish(),newsUrlOriginal:n().nullish(),publication:n().nullish(),publishedAt:c({offset:!0}).nullish(),slug:n().regex(/^[a-z0-9_-]+$/).max(255).nullish(),title:n(),updatedAt:c({offset:!0}).nullish()}),ve=s([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),H=r({author:n().nullish(),createdAt:c({offset:!0}),externalId:n().nullish(),id:t(),isCurrent:i(),lastFetchedAt:c({offset:!0}).nullish(),mentionedEntityId:l(t()),mentionedPersonId:l(t()),owner:d,publishedAt:c({offset:!0}).nullish(),summary:n().nullish(),summaryGeneratedAt:c({offset:!0}).nullish(),title:n().nullish(),topic:n().nullish(),type:ve,updatedAt:c({offset:!0}),url:n()}),ye=r({count:a(),stage:n()}),be=r({attributedInvestmentCount:a(),averageAmountInvestedUsd:o().nullish(),currentPortfolioCount:a(),largestAmountInvestedUsd:o().nullish(),portfolioCompanyCount:a(),smallestAmountInvestedUsd:o().nullish(),topInvestmentStage:l(ye),totalAmountInvestedUsd:o().nullish(),totalInvestment:a(),totalPortfolioExit:a(),totalWriteOff:a()}),xe=s([`nickname`,`maidenName`,`formerName`,`stageName`]),U=r({displayable:i().nullish(),name:n(),type:xe.nullish()}),W=r({isMonogram:i(),picture:n().nullish()}),G=r({associationId:a(),endDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),entityAddress:l(p),entityId:t(),entityLogo:ne,entityName:n().nullish(),entityOperatingStatus:n().nullish(),entitySlug:n().regex(/^[a-z0-9_-]+$/).max(255),entityType:re.nullish(),entityUrlLink:l(C),isCurrent:i().nullish(),personAddress:l(p),personId:t(),personImage:W,personName:n(),personSlug:n().regex(/^[a-z0-9_-]+$/).max(255),personUrlLink:l(C),score:a().nullish(),startDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),titleFunction:n().nullish(),titleId:a().nullish(),titleLevel:n().nullish(),titleName:n().nullish()}),Se=r({address:l(p),urlLink:l(C)}),K=s([`low`,`medium`,`high`]),Ce=r({asOfDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),currentEligible:i().nullish(),dataConfidence:K.nullish(),dateValue:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),numericValue:o().nullish(),referenceValue:n().nullish(),source:n().nullish(),textValue:n().nullish(),updatedAt:c({offset:!0}).nullish(),valueType:L}),q=r({asOfDate:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fact:Ce,id:n()}),J=r({isCurrent:i().nullish(),personId:t(),personImage:W,personName:n(),personSlug:n().regex(/^[a-z0-9_-]+$/).max(255),titleName:n().nullish()}),we=r({entity:D,keyPerson:l(J)}),Te=r({colleague:l(J),employeeCount:q.nullish(),entity:D,primaryAddress:p.nullish(),recentNews:l(V),similarEntity:l(we)}),Ee=r({overlapCount:a(),person:J,round:n().nullish(),sharedEntity:f.nullish(),transactionId:t().nullish()}),De=r({careerContext:l(Te),coInvestor:l(Ee),computedAt:c({offset:!0}).nullish()}),Oe=r({amountRaised:o().nullish(),dateAnnounced:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),id:t(),image:ne,investorCount:a().nullish(),nameBrand:n(),round:n().nullish(),status:n().nullish(),valuationPostMoney:o().nullish()}),ke=r({entity:f,headquartersCity:n().nullish(),headquartersCountry:n().nullish(),headquartersRegion:n().nullish(),industry:n().nullish()}),Y=r({amount:o().nullish(),company:ke,date:n().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),fundraiseTransaction:Oe.nullish(),fundraiseTransactionId:t(),id:n(),investmentDate:c({offset:!0}),investorAttribution:j.nullish(),round:n().nullish()}),X=s([`entity`,`person`,`newsArticle`,`blogPost`,`text`,`classificationTag`,`classificationCode`,`product`,`service`,`agentHelpDoc`,`researchSnippet`,`sourceDocument`]),Ae=Object.assign(e([X,n()]),{enum:X.enum}),Z=r({computedAt:c({offset:!0}),cosineDistance:o(),cosineScore:o(),modelVersion:n(),rank:a(),sourceHash:n(),sourceId:n(),sourceType:Ae}),Q=r({bioUpdatedAt:c({offset:!0}).nullish(),createdAt:c({offset:!0}).nullish(),gender:n().nullish(),id:t(),image:W,lastModifiedAt:c({offset:!0}).nullish(),nameAlias:l(U),nameFirst:n().nullish(),nameFull:n(),nameLast:n().nullish(),nameMiddle:n().nullish(),nickname:n().nullish(),publicId:n().regex(/^p[0-9A-Za-z]{12}$/).nullish(),semanticMatch:Z.nullish(),slug:n().regex(/^[a-z0-9_-]+$/).max(255),suffix:n().nullish(),text:x,updatedAt:c({offset:!0}).nullish()}),je=s([`precomputed`,`live`]),Me=r({compositeScore:o().nullish(),cosineScore:o().nullish(),matchedSectionWeight:o().nullish(),origin:je,rank:a(),sharedSectionCount:a().nullish()}),$=r({currentRole:G.nullish(),person:Q,similarity:Me}),Ne=r({articleCount:a().nullish(),association:l(G),blogPost:l(H).nullish(),core:Q,enrichment:Se,graph:De.nullish(),investment:l(Y),investorActivity:be.nullish(),nameAlias:l(U),similar:l($).nullish()}),Pe=s([`ein`,`secCik`,`ticker`,`lei`,`duns`,`isin`,`cusip`,`crd`,`orcid`,`fdicCert`,`rssd`,`folk`]),Fe=Object.assign(e([Pe,n()]),{enum:Pe.enum}),Ie=r({createdAt:c({offset:!0}),id:a(),identifier:n(),idType:Fe,owner:d,source:n().nullish(),updatedAt:c({offset:!0})}),Le=r({core:f,enrichment:w,fundraiseRound:l(M),newsArticle:l(V),person:l(Ne),provider:N.nullish(),publicUrl:n().nullish(),relationship:l(F),research:_e,sitemap:te,uniqueId:l(Ie)});export{g as A,O as C,S as D,C as E,b as O,k as S,w as T,F as _,Q as a,j as b,q as c,H as d,V as f,I as g,R as h,$ as i,_ as k,K as l,z as m,Ie as n,Z as o,B as p,Ne as r,Y as s,Le as t,G as u,N as v,E as w,A as x,M as y};
@@ -0,0 +1 @@
1
+ export{t as EntityDetailSchema}from"./detail-Nzc6IsFj.js";