@aventurevc/aventure-cli 0.8.418 → 0.8.419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +1 -1
- package/dist/chunks/{api-key-bearer-credential-CvosKpYR.js → api-key-bearer-credential-D5Hbqfm3.js} +1 -1
- package/dist/chunks/{api-key-bearer-credential-BLyU60pX.js → api-key-bearer-credential-YJPeAheU.js} +1 -1
- package/dist/chunks/{api-key-credential-DE3-BIyE.js → api-key-credential-BzzmM-P-.js} +1 -1
- package/dist/chunks/{api-key-credential--8Qb-Iop.js → api-key-credential-Cr1aPyGV.js} +1 -1
- package/dist/chunks/{api-key-credential-verification-De3fRVwG.js → api-key-credential-verification-DmEkfVgj.js} +1 -1
- package/dist/chunks/{api-key-credential-verification-BpKqBkTM.js → api-key-credential-verification-g1VutBly.js} +1 -1
- package/dist/chunks/{api-key-login-RxgCv_D4.js → api-key-login-HZafralu.js} +1 -1
- package/dist/chunks/{auth-resolver-D3QFIxSW.js → auth-resolver-BnK4x1vt.js} +1 -1
- package/dist/chunks/auth-resolver-Csx2wedp.js +1 -0
- package/dist/chunks/{auth-status-check-BwNe9s5w.js → auth-status-check-Ba_7IER7.js} +1 -1
- package/dist/chunks/{auth-status-check-DDm_5wC2.js → auth-status-check-DRSwi9--.js} +1 -1
- package/dist/chunks/{auth-status-render-Dsvm7cou.js → auth-status-render-CWL-L_9x.js} +1 -1
- package/dist/chunks/{aventure-cli-CHDG04NJ.js → aventure-cli-BRx20tbl.js} +5 -5
- package/dist/chunks/{batch-io-Cvo7FfIs.js → batch-io-DgwZwRpQ.js} +1 -1
- package/dist/chunks/{builtin-auth-Q3OA4QDu.js → builtin-auth-QiC-7MKe.js} +4 -4
- package/dist/chunks/{builtin-run-wait-CZusd_gq.js → builtin-run-wait-B4fwnFYI.js} +1 -1
- package/dist/chunks/{builtin-update-BcierYdb.js → builtin-update-qeIeNPzz.js} +1 -1
- package/dist/chunks/{cli-help-policy-DIcX8OWu.js → cli-help-policy-BX-whN-w.js} +1 -1
- package/dist/chunks/{completion-5xuOtoKf.js → completion-DLIhx1yG.js} +1 -1
- package/dist/chunks/{contract-DLzXMUjF.js → contract-B2oibXOn.js} +1 -1
- package/dist/chunks/{contract-parameter-BUraclSS.js → contract-parameter-BsYdHniz.js} +1 -1
- package/dist/chunks/{credential-store-Cc301MYX.js → credential-store-C_2xvL4d.js} +1 -1
- package/dist/chunks/env-CC1-vnc-.js +1 -0
- package/dist/chunks/{generated-option-order-B7LYhMhj.js → generated-option-order-BNFSLEDZ.js} +1 -1
- package/dist/chunks/help-catalog-CvpHuIkW.js +2 -0
- package/dist/chunks/{help-intent-k07ioxjq.js → help-intent-CJL4NGOD.js} +1 -1
- package/dist/chunks/{logging-B8Ld27N8.js → logging-D7Z7a3sv.js} +1 -1
- package/dist/chunks/{logging-CsxFMnjR.js → logging-DqIIwQLm.js} +1 -1
- package/dist/chunks/{logout-Desb3ggn.js → logout-D9e2tc3f.js} +1 -1
- package/dist/chunks/logout-aSSPrw35.js +1 -0
- package/dist/chunks/{mcp-generation-contract-DEkLNl1V.js → mcp-generation-contract-Euuk5_0h.js} +1 -1
- package/dist/chunks/mcp-generation-contract-WwcIl8lu.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-cVmD0MtO.js → oauth-bearer-credential-D0hek5Sr.js} +1 -1
- package/dist/chunks/oauth-bearer-credential-Df6NPV5V.js +1 -0
- package/dist/chunks/{oauth-credential-cg5twgQv.js → oauth-credential-D3dnMZRE.js} +1 -1
- package/dist/chunks/{oauth-credential-CfLdSioQ.js → oauth-credential-DADCv54U.js} +1 -1
- package/dist/chunks/{oauth-login-C_MkUv0M.js → oauth-login-BCU7sziS.js} +1 -1
- package/dist/chunks/{oauth-login-BTFb9GBz.js → oauth-login-BZl9R9lD.js} +1 -1
- package/dist/chunks/{openapi-call-BYFpOz0o.js → openapi-call-Bd2wUhXk.js} +1 -1
- package/dist/chunks/{openapi-call-DxJMoulQ.js → openapi-call-BiKamLmB.js} +1 -1
- package/dist/chunks/{openapi-commands-D1jAgAjr.js → openapi-commands-Cr4BN7jf.js} +1 -1
- package/dist/chunks/openapi-commands-LRER_hsQ.js +1 -0
- package/dist/chunks/openapi-snapshot.json +1 -1
- package/dist/chunks/{operations-CvCUVMg7.js → operations-Do8gJz5Y.js} +2 -2
- package/dist/chunks/{operations-catalog-Clf1COPT.js → operations-catalog-BP-bJlI2.js} +1 -1
- package/dist/chunks/operations-catalog-CtnrukD6.js +1 -0
- package/dist/chunks/{operations-metadata-B2wBuzO-.js → operations-metadata-DVXRDkYa.js} +1 -1
- package/dist/chunks/{output-Cage0cak.js → output-B8HawMKY.js} +1 -1
- package/dist/chunks/{output-CW4MMcMX.js → output-GMp6qpse.js} +1 -1
- package/dist/chunks/{parse-error-hint-gfByaVez.js → parse-error-hint-v1E3Qm0v.js} +1 -1
- package/dist/chunks/{payload-operand-guard-CsaTfY9Q.js → payload-operand-guard-BAEsdwL6.js} +1 -1
- package/dist/chunks/{private-readback-et6dKd1Z.js → private-readback-O02uf2R4.js} +1 -1
- package/dist/chunks/{startup-auth-T1fCSqHx.js → startup-auth-B_NvVcRd.js} +1 -1
- package/dist/chunks/{startup-auth-C9mdYUSd.js → startup-auth-DyRGV3vF.js} +1 -1
- package/dist/chunks/{text-response-CCGjoGEl.js → text-response-CgPFdlkn.js} +1 -1
- package/dist/chunks/{tool-policy-B-ydHkhx.js → tool-policy-BmDEaARa.js} +1 -1
- package/package.json +3 -3
- package/dist/chunks/auth-resolver-J4llJftd.js +0 -1
- package/dist/chunks/env-DtsCE2J8.js +0 -1
- package/dist/chunks/help-catalog-CKhHZ7VD.js +0 -2
- package/dist/chunks/logout-CK6Ok_if.js +0 -1
- package/dist/chunks/mcp-generation-contract-BpJGXyll.js +0 -1
- package/dist/chunks/oauth-bearer-credential-B0BWV1b5.js +0 -1
- package/dist/chunks/openapi-commands-Bfl6_8wk.js +0 -1
- package/dist/chunks/operations-catalog-DsLdU5it.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-DcUsOdSE.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-BXcpCMqz.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-
|
|
2
|
+
import{enableCompileCache as e}from"node:module";import{fileURLToPath as t}from"node:url";e();var{Command:n,CommanderError:r}=await import(`../chunks/commander-D8IVfzyC.js`),{readRuntimePackage:i}=await import(`../chunks/package-DcUsOdSE.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-BXcpCMqz.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-DqIIwQLm.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-CGpiW-Q_.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-DyRGV3vF.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-Cr4BN7jf.js`),{withRenamedCommandAliases:c}=await import(`../chunks/deprecated-command-BBCr1BHb.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let l=r(o,c(s));if(l===`stored`||l===`optional`)try{await a(l)}catch(t){e({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-BRx20tbl.js`)}}catch(e){if(!(e instanceof r))throw e;e.code!==`commander.version`&&process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-11-
|
|
4
|
+
"generatedAt": "2026-11-10T22:29:03.426Z",
|
|
5
5
|
"totalOperations": 133,
|
|
6
6
|
"note": "1:1 projection of MCP_GENERATION_CONTRACT written by the CLI build ([MCP1b.1-EXC1]).",
|
|
7
7
|
"operations": [
|
package/dist/chunks/{api-key-bearer-credential-CvosKpYR.js → api-key-bearer-credential-D5Hbqfm3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./package-DEeHDoOT.js";import{p as t,t as n}from"./env-
|
|
1
|
+
import{a as e}from"./package-DEeHDoOT.js";import{p as t,t as n}from"./env-CC1-vnc-.js";import{o as r,r as i}from"./logging-D7Z7a3sv.js";import{r as a}from"./api-target-vxev2RKl.js";import{i as o}from"./api-key-credential-BzzmM-P-.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};
|
package/dist/chunks/{api-key-bearer-credential-BLyU60pX.js → api-key-bearer-credential-YJPeAheU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-
|
|
1
|
+
export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-D5Hbqfm3.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{S as e,_ as t,i as n,n as r,s as i}from"./iso-DzqMxtky.js";import{r as a}from"./api-target-vxev2RKl.js";import{t as o}from"./credential-redaction-_zj2uH10.js";import{a as s,i as c,o as l,r as u,t as d}from"./credential-store-
|
|
1
|
+
import{S as e,_ as t,i as n,n as r,s as i}from"./iso-DzqMxtky.js";import{r as a}from"./api-target-vxev2RKl.js";import{t as o}from"./credential-redaction-_zj2uH10.js";import{a as s,i as c,o as l,r as u,t as d}from"./credential-store-C_2xvL4d.js";import{isDeepStrictEqual as f}from"node:util";var p=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})}),m=`vc.aventure.aventure-cli`,h=`aventure-cli-personal-v1`;async function g(e,t,n,r){return await s(async()=>{let i=a(e),s=await _(i);if((r.state===`missing`?s.state!==`missing`:s.state!==`found`||!b(s.stored,r.stored))||s.state===`found`&&s.stored.activation===`revoking`&&n!==`revoking`)return{state:`changed`,current:s};let c=S(t,n),u;try{u=await l(m,i,c)}catch(e){throw Error(`${o(e,[c,t.secret])}; broker acknowledgment was withheld. Re-run auth status before retrying.`,{cause:e})}let d={host:i,provider:u,activation:n,credential:t},f=await _(i);if(f.state!==`found`||!b(f.stored,d))throw Error(`Credential storage did not confirm the saved API-key snapshot`);return{state:`saved`,stored:f.stored}})}async function _(e){return await s(async()=>{let t=a(e),n;try{n=await c(m,t)}catch(e){return x(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,...w(r.value)}}})}async function v(e){return await s(async()=>{let t=await _(e);if(t.state!==`missing`)return t;try{let{keyringFailure:t}=await u(m,a(e));return t===void 0?{state:`missing`}:{state:`missing`,keyringFailure:t}}catch(e){return x(o(e))}})}async function y(e){return await s(async()=>{let t=await _(e.host);if(t.state===`missing`&&t.keyringFailure===void 0)return{state:`absent`};if(t.state!==`found`||!b(t.stored,e))return{state:`changed`,current:t};await d(m,a(e.host));let n=await _(e.host);if(n.state!==`missing`||n.keyringFailure!==void 0)throw Error(`Credential storage did not confirm API-key removal`);return{state:`removed`}})}function b(e,t){return a(e.host)===a(t.host)&&e.provider===t.provider&&e.activation===t.activation&&e.credential.secret===t.credential.secret&&f(e.credential.apiKey,t.credential.apiKey)}function x(e){return{state:`unavailable`,summary:e,cause:`storage`}}function S(e,t){let n=t===`revoking`?{...e.apiKey,cliRevocationPending:!0}:e.apiKey;return`${h}:${C(t)}\n${JSON.stringify(n)}\n${e.secret}`}function C(e){return e===`active`?`active`:`pending`}function w(e){let t=e.indexOf(`
|
|
2
2
|
`),n=t<0?-1:e.indexOf(`
|
|
3
3
|
`,t+1),r=t<0?e:e.slice(0,t),i=r===`${h}:active`?`active`:`pending`;if(t<0||n<0||r!==`${h}:pending`&&r!==`${h}: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})}if(typeof o==`object`&&o&&`cliRevocationPending`in o){if(o.cliRevocationPending!==!0||i===`active`)throw Error(`OS credential entry has an invalid revocation phase`);i=`revoking`}let s=p.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{b as a,_ as i,y as n,g as o,v as r,p as s,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{r as inspectApiKeyCredentialStorage}from"./api-key-credential-
|
|
1
|
+
export{r as inspectApiKeyCredentialStorage}from"./api-key-credential-BzzmM-P-.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./env-
|
|
1
|
+
import{p as e}from"./env-CC1-vnc-.js";import{n as t,s as n}from"./openapi-call-BiKamLmB.js";import{a as r}from"./api-target-vxev2RKl.js";import{a as i,i as a,o,s}from"./api-key-credential-BzzmM-P-.js";import{n as c,t as l}from"./credential-redaction-_zj2uH10.js";async function u(e){if(e.activation===`revoking`)return{lookup:await a(e.host),verification:null};let t=await d(e.credential.secret);try{if(t.state===`verified`&&e.activation===`active`){let n=await o(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`,{state:`found`,stored:e});return n.state===`saved`?{lookup:{state:`found`,stored:n.stored},verification:t}:{lookup:n.current,verification:null}}}catch(n){t={state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${l(n,[e.credential.secret])}`}}let n;try{n=await a(e.host)}catch(t){return{lookup:{state:`unavailable`,cause:`storage`,summary:l(t,[e.credential.secret])},verification:null}}return{lookup:n,verification:n.state===`found`&&i(n.stored,e)?t:null}}async function d(i){let a=r(e()),o;try{o=await n(a,{method:`GET`,path:t(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${i}`}},s)}catch(e){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${l(e,[i])}`}}return o.ok&&o.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${o.status}`}:o.ok?o.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:o.data}:{state:`invalid`,summary:`API key is not active`}:{state:o.problem.type!==`about:blank`&&o.problem.status===401?`invalid`:`unavailable`,summary:`identity verification: ${c(o.problem,[i])}`}}export{d as n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as refreshStoredApiKeyCredential}from"./api-key-credential-verification-
|
|
1
|
+
export{t as refreshStoredApiKeyCredential}from"./api-key-credential-verification-DmEkfVgj.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./package-DEeHDoOT.js";import{A as t,E as n,S as r,_ as i,g as a,i as o,n as s}from"./iso-DzqMxtky.js";import{p as c}from"./env-DtsCE2J8.js";import{c as l,r as u}from"./result-envelope-Cqvvr4zX.js";import{V as d}from"./tool-policy-B-ydHkhx.js";import{s as f,u as p}from"./openapi-call-DxJMoulQ.js";import{a as m}from"./response-problem-BKDrFcVc.js";import{a as h,r as g,t as ee}from"./api-target-vxev2RKl.js";import{n as _,o as v,r as te,t as ne}from"./api-key-credential-DE3-BIyE.js";import{n as re,t as y}from"./credential-redaction-_zj2uH10.js";import{c as b,l as x,n as S,u as C}from"./credential-store-Cc301MYX.js";import{n as w}from"./api-key-credential-verification-De3fRVwG.js";import{n as T}from"./contract-DLzXMUjF.js";import{t as E}from"./openapi-composites-IdxI7cAF.js";import{n as ie}from"./logout-Desb3ggn.js";import{stderr as D,stdin as ae}from"node:process";import{TextDecoder as oe,inspect as se}from"node:util";import{hostname as ce,platform as le}from"node:os";import{setTimeout as ue}from"node:timers/promises";import{webcrypto as O}from"node:crypto";var k=o([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),A=o([`RSA_OAEP_256_A256_GCM_V1`]),de=i({clientLabel:r().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:k.nullish(),encryptionAlgorithm:A.nullish(),encryptionPublicKey:r().min(344).max(12e3).nullish()}),fe=32;async function pe(){let e=await O.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await O.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function me(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=j(n,`wrapped key`,128,1024),s=j(r,`nonce`,12,12),c=j(i,`ciphertext`,1,65536),l=j(a,`authentication tag`,16,16),u;try{u=await O.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!==fe)throw Error(`broker credential used an invalid AES-256 key`);let e=await O.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 O.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new oe(`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 j(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 M=o([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),N=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`]),P=i({approvedAt:s({offset:!0}).nullish(),clientLabel:r(),clientPlatform:k,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:M,terminalAt:s({offset:!0}).nullish(),terminalReason:N.nullish(),updatedAt:s({offset:!0})}),F=i({algorithm:A,authenticationTag:r(),ciphertext:r(),nonce:r(),wrappedKey:r()}),I=i({delivery:F.nullish(),expiresAt:s({offset:!0}),status:M,terminalReason:N.nullish()}),L=i({comparisonCode:r(),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),pollSecret:r(),verificationUrl:r()}),R=T(E,`start`),z=T(E,`poll`),B=T(E,`acknowledge`),V=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${re(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=ve(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},H=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${y(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function he(e){let t=await f(h(c()),{method:R.method,path:d(R.path,{},R.operationId),headers:{},contentType:`application/json`,body:e},L);if(t.ok&&t.redirect)throw new V(`start`,W(t.status));if(!t.ok)throw new V(`start`,t.problem);return ye(t.data)}async function ge(e,t){let n=p(z.operationId),r=await f(h(c()),{method:z.method,path:d(z.path,{cliAuthorizationId:e},z.operationId),headers:{[n]:t}},I);if(r.ok&&r.redirect)throw new V(`poll`,W(r.status),[t]);if(!r.ok)throw new V(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:_e(r.headers[`retry-after`])}}async function U(e,t){let n=p(B.operationId),r;try{r=await f(h(c()),{method:B.method,path:d(B.path,{cliAuthorizationId:e},B.operationId),headers:{[n]:t}},P)}catch(e){throw new H(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new V(`acknowledge`,W(r.status),[t]);if(!r.ok)throw new V(`acknowledge`,r.problem,[t]);return r.data}function _e(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function ve(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function W(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ye(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())})`},[se.custom]:{enumerable:!1,value:a}})}var G=`RSA_OAEP_256_A256_GCM_V1`,be=1,xe=30,K=e().bin[0],q=`The local record remains pending and unavailable to ordinary commands. Re-run \`${K} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function Se(e){if(!ae.isTTY)return u(`${K} 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=g(e),r=ee(e)}catch(e){return u(`auth login --key: invalid environment configuration — ${y(e)}`)}for(;;){let e;try{e=await te(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`){let t=S(e.keyringFailure);t!==null&&D.write(t);break}let t=await Ce(e.stored);if(t!==null)return t}let i;try{i=await pe()}catch(e){return u(`auth login --key: ephemeral encryption key could not be created — ${y(e)}`)}let a=de.safeParse({clientLabel:e.clientLabel?.trim()||(ce().trim()||K).slice(0,120),clientPlatform:Ee(),encryptionAlgorithm:G,encryptionPublicKey:i.publicKey});if(!a.success)return u(`auth login --key: ${t(a.error)}`);let o;try{o=await he(a.data)}catch(e){return u(`auth login --key: could not start browser authorization — ${y(e)}`)}let s;try{s=C(o,r)}catch(e){return u(`auth login --key: unsafe browser authorization URL rejected — ${y(e)}`)}let l=await b(o,r,{noBrowser:e.noBrowser});if(!x(l,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 Te(o)}catch(e){return u(`auth login --key: authorization did not complete — ${y(e)}`,[],{references:[s]})}if(d.algorithm!==G)return u(`auth login --key: broker selected an unsupported encryption algorithm`);let f;try{f=await me(i.privateKey,d)}catch(e){return u(`auth login --key: encrypted credential could not be opened — ${y(e)}`)}let p=await w(f);if(p.state!==`verified`)return u(`auth login --key: decrypted credential was neither stored nor acknowledged — ${p.summary}`);let m;try{let e=await v(n,{apiKey:p.apiKey,secret:f},`pending`,{state:`missing`});if(e.state===`changed`)return u(`auth login --key: local credential changed; delivery was not stored or acknowledged. Re-run auth status.`);m=e.stored}catch(e){return u(`auth login --key: credential could not be durably stored — ${y(e)}`)}let h;try{h=await we(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])}`,q)}if(h.status!==`CONSUMED`)return Q(m,!0,`auth login --key: broker returned ${h.status} after acknowledgment`,q);let _=await w(f);return _.state!==`verified`||!$(_.apiKey,m.credential.apiKey)?Q(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${_.summary}`,q):await J(m,_.apiKey,`acknowledgment`)}async function Ce(e){let t=e.activation===`revoking`?{state:`invalid`,summary:`Local revocation is pending`}:await w(e.credential.secret);if(e.activation===`active`)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 \`${K} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&$(t.apiKey,e.credential.apiKey))return await J(e,t.apiKey,`recovery`);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 \`${K} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);try{if(e.activation===`pending`){let t=await v(e.host,e.credential,`revoking`,{state:`found`,stored:e});if(t.state===`changed`)return null;e=t.stored}let t=await ie(e);if(t.outcome===`unconfirmed`)return Q(e,!1,`auth login --key: credential revocation remains pending`,`Remote revocation was not confirmed — ${t.summary}. Retry auth login --key when the API is reachable.`);if((await _(e)).state===`changed`)return null;D.write(t.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
|
|
1
|
+
import{a as e}from"./package-DEeHDoOT.js";import{A as t,E as n,S as r,_ as i,g as a,i as o,n as s}from"./iso-DzqMxtky.js";import{p as c}from"./env-CC1-vnc-.js";import{c as l,r as u}from"./result-envelope-Cqvvr4zX.js";import{V as d}from"./tool-policy-BmDEaARa.js";import{s as f,u as p}from"./openapi-call-BiKamLmB.js";import{a as m}from"./response-problem-BKDrFcVc.js";import{a as h,r as g,t as ee}from"./api-target-vxev2RKl.js";import{n as _,o as v,r as te,t as ne}from"./api-key-credential-BzzmM-P-.js";import{n as re,t as y}from"./credential-redaction-_zj2uH10.js";import{c as b,l as x,n as S,u as C}from"./credential-store-C_2xvL4d.js";import{n as w}from"./api-key-credential-verification-DmEkfVgj.js";import{n as T}from"./contract-B2oibXOn.js";import{t as E}from"./openapi-composites-IdxI7cAF.js";import{n as ie}from"./logout-D9e2tc3f.js";import{stderr as D,stdin as ae}from"node:process";import{TextDecoder as oe,inspect as se}from"node:util";import{hostname as ce,platform as le}from"node:os";import{setTimeout as ue}from"node:timers/promises";import{webcrypto as O}from"node:crypto";var k=o([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),A=o([`RSA_OAEP_256_A256_GCM_V1`]),de=i({clientLabel:r().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:k.nullish(),encryptionAlgorithm:A.nullish(),encryptionPublicKey:r().min(344).max(12e3).nullish()}),fe=32;async function pe(){let e=await O.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await O.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function me(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=j(n,`wrapped key`,128,1024),s=j(r,`nonce`,12,12),c=j(i,`ciphertext`,1,65536),l=j(a,`authentication tag`,16,16),u;try{u=await O.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!==fe)throw Error(`broker credential used an invalid AES-256 key`);let e=await O.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 O.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new oe(`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 j(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 M=o([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),N=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`]),P=i({approvedAt:s({offset:!0}).nullish(),clientLabel:r(),clientPlatform:k,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:M,terminalAt:s({offset:!0}).nullish(),terminalReason:N.nullish(),updatedAt:s({offset:!0})}),F=i({algorithm:A,authenticationTag:r(),ciphertext:r(),nonce:r(),wrappedKey:r()}),I=i({delivery:F.nullish(),expiresAt:s({offset:!0}),status:M,terminalReason:N.nullish()}),L=i({comparisonCode:r(),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),pollSecret:r(),verificationUrl:r()}),R=T(E,`start`),z=T(E,`poll`),B=T(E,`acknowledge`),V=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${re(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=ve(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},H=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${y(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function he(e){let t=await f(h(c()),{method:R.method,path:d(R.path,{},R.operationId),headers:{},contentType:`application/json`,body:e},L);if(t.ok&&t.redirect)throw new V(`start`,W(t.status));if(!t.ok)throw new V(`start`,t.problem);return ye(t.data)}async function ge(e,t){let n=p(z.operationId),r=await f(h(c()),{method:z.method,path:d(z.path,{cliAuthorizationId:e},z.operationId),headers:{[n]:t}},I);if(r.ok&&r.redirect)throw new V(`poll`,W(r.status),[t]);if(!r.ok)throw new V(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:_e(r.headers[`retry-after`])}}async function U(e,t){let n=p(B.operationId),r;try{r=await f(h(c()),{method:B.method,path:d(B.path,{cliAuthorizationId:e},B.operationId),headers:{[n]:t}},P)}catch(e){throw new H(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new V(`acknowledge`,W(r.status),[t]);if(!r.ok)throw new V(`acknowledge`,r.problem,[t]);return r.data}function _e(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function ve(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function W(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ye(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())})`},[se.custom]:{enumerable:!1,value:a}})}var G=`RSA_OAEP_256_A256_GCM_V1`,be=1,xe=30,K=e().bin[0],q=`The local record remains pending and unavailable to ordinary commands. Re-run \`${K} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function Se(e){if(!ae.isTTY)return u(`${K} 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=g(e),r=ee(e)}catch(e){return u(`auth login --key: invalid environment configuration — ${y(e)}`)}for(;;){let e;try{e=await te(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`){let t=S(e.keyringFailure);t!==null&&D.write(t);break}let t=await Ce(e.stored);if(t!==null)return t}let i;try{i=await pe()}catch(e){return u(`auth login --key: ephemeral encryption key could not be created — ${y(e)}`)}let a=de.safeParse({clientLabel:e.clientLabel?.trim()||(ce().trim()||K).slice(0,120),clientPlatform:Ee(),encryptionAlgorithm:G,encryptionPublicKey:i.publicKey});if(!a.success)return u(`auth login --key: ${t(a.error)}`);let o;try{o=await he(a.data)}catch(e){return u(`auth login --key: could not start browser authorization — ${y(e)}`)}let s;try{s=C(o,r)}catch(e){return u(`auth login --key: unsafe browser authorization URL rejected — ${y(e)}`)}let l=await b(o,r,{noBrowser:e.noBrowser});if(!x(l,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 Te(o)}catch(e){return u(`auth login --key: authorization did not complete — ${y(e)}`,[],{references:[s]})}if(d.algorithm!==G)return u(`auth login --key: broker selected an unsupported encryption algorithm`);let f;try{f=await me(i.privateKey,d)}catch(e){return u(`auth login --key: encrypted credential could not be opened — ${y(e)}`)}let p=await w(f);if(p.state!==`verified`)return u(`auth login --key: decrypted credential was neither stored nor acknowledged — ${p.summary}`);let m;try{let e=await v(n,{apiKey:p.apiKey,secret:f},`pending`,{state:`missing`});if(e.state===`changed`)return u(`auth login --key: local credential changed; delivery was not stored or acknowledged. Re-run auth status.`);m=e.stored}catch(e){return u(`auth login --key: credential could not be durably stored — ${y(e)}`)}let h;try{h=await we(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])}`,q)}if(h.status!==`CONSUMED`)return Q(m,!0,`auth login --key: broker returned ${h.status} after acknowledgment`,q);let _=await w(f);return _.state!==`verified`||!$(_.apiKey,m.credential.apiKey)?Q(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${_.summary}`,q):await J(m,_.apiKey,`acknowledgment`)}async function Ce(e){let t=e.activation===`revoking`?{state:`invalid`,summary:`Local revocation is pending`}:await w(e.credential.secret);if(e.activation===`active`)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 \`${K} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&$(t.apiKey,e.credential.apiKey))return await J(e,t.apiKey,`recovery`);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 \`${K} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);try{if(e.activation===`pending`){let t=await v(e.host,e.credential,`revoking`,{state:`found`,stored:e});if(t.state===`changed`)return null;e=t.stored}let t=await ie(e);if(t.outcome===`unconfirmed`)return Q(e,!1,`auth login --key: credential revocation remains pending`,`Remote revocation was not confirmed — ${t.summary}. Retry auth login --key when the API is reachable.`);if((await _(e)).state===`changed`)return null;D.write(t.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
|
|
2
2
|
`:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
|
|
3
3
|
`)}catch(t){return Q(e,!1,`auth login --key: stale pending credential could not be removed — ${y(t,[e.credential.secret])}`)}return null}async function J(e,t,n){try{let r=await v(e.host,{apiKey:t,secret:e.credential.secret},`active`,{state:`found`,stored:e});return r.state===`changed`?u(`auth login --key: local credential changed ${n===`recovery`?`during recovery`:`after acknowledgment`}; current state preserved. Re-run auth status.`):l(n===`recovery`?`Recovered pending CLI credential: broker acknowledgment had succeeded.`:`API key stored; authenticated identity and broker acknowledgment verified.`,Z(r.stored,!0),{ids:[r.stored.credential.apiKey.id]})}catch(t){return Q(e,!0,`auth login --key: ${n===`recovery`?`credential is valid but could not be promoted locally`:`remote acknowledgment succeeded, but local activation could not be confirmed`} — ${y(t,[e.credential.secret])}`,q)}}async function we(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds);for(;;)try{return await U(e.id,e.pollSecret)}catch(e){if(e instanceof V){if(!e.retryable)throw e;n=Y(e.retryAfterSeconds??n)}else if(!(e instanceof H))throw e;if(Date.now()>=t)throw e;D.write(`Broker acknowledgment was interrupted; retrying.
|
|
4
4
|
`),await X(n,t)}}async function Te(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds),r;for(D.write(`Waiting for browser approval...
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./env-
|
|
1
|
+
import{t as e}from"./env-CC1-vnc-.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}}var o;function s(t,n){process.env[e.authToken]=t,o=n}async function c(){return await o?.()}function l(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}export{a,c as i,l as n,s as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as resolveAuthStatus}from"./auth-resolver-BnK4x1vt.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./package-DEeHDoOT.js";import{t}from"./credential-redaction-_zj2uH10.js";import{n,t as r}from"./openapi-commands-
|
|
1
|
+
import{a as e}from"./package-DEeHDoOT.js";import{t}from"./credential-redaction-_zj2uH10.js";import{n,t as r}from"./openapi-commands-LRER_hsQ.js";var i=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers GET /info`},{name:`auth`,purpose:`a credential materialized for the next command, never its secret`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function a(e,t,n){return{name:e,status:t,message:n}}async function o(e){let t=l(),n=await u(e),[r,i]=await Promise.all([d(e),t===void 0?null:f(t)]);return{cliVersion:n.check,apiSchemas:r,catalog:m(i,n.upgradeAvailable,e)}}function s(e,t,n){return e.ok?a(`api-host`,`pass`,`GET /info answered at ${t}.`):a(`api-host`,`fail`,e.httpStatus===401?`Replace or unset the credential ${t} rejected, or run \`${n} auth login\`, then rerun \`${n} auth status\` — GET /info returned ${e.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${n} auth status\` — GET /info at ${t} returned ${e.summary}.`)}function c(e,t,n){let r=[e.cliVersion,e.apiSchemas,t,n,e.catalog];return{ok:r.every(e=>e.status!==`fail`),check:r}}function l(){return r.find(e=>e.intent===`status`&&e.resource===`status`)}async function u(t){let{runUpdate:n}=await import(`./builtin-update-qeIeNPzz.js`),r=e(),i=n(r,`check`);if(!i.ok||i.data===null)return{check:a(`cli-version`,`skip`,`Could not compare ${r.version} against the registry (${i.summary}); rerun \`${t} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:o,currentVersion:s,latestVersion:c,upgradeAvailable:l}=i.data;return{check:l?a(`cli-version`,`fail`,`Upgrade ${o} from ${s} to ${c}: run \`${t} update\`.`):a(`cli-version`,`pass`,`${o} ${s} matches the latest published release.`),upgradeAvailable:l}}async function d(e){try{let{EntityDetailSchema:e}=await import(`./detail-CiJNXx89.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return a(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(n){return a(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${t(n)}.`)}}async function f(e){let{runOpenApiCall:n}=await import(`./openapi-call-Bd2wUhXk.js`),r=`${e.method} ${e.path}`;try{let t=await n({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`});if(!t.ok)return{unread:`${r} returned ${t.summary}`};let i=p(t.data);return i===null?{unread:`${r} carried no operationFingerprint`}:{fingerprint:i}}catch(e){return{unread:`${r} failed: ${t(e)}`}}}function p(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}function m(e,t,i){let o=r.length;if(e===null)return a(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${o} operations.`);if(`unread`in e)return a(`catalog`,`skip`,`Could not read the served operation fingerprint (${e.unread}), so drift is unproven; this catalog holds ${o} operations at ${n}.`);let s=e.fingerprint;if(s===`36dae7cbf9565070`)return a(`catalog`,`pass`,`${o} generated operations match the set the API serves (${n}).`);let c=`This catalog describes a different operation set than the API serves (${n} vs ${s})`;return t===!0?a(`catalog`,`fail`,`${c}: run \`${i} update\`.`):a(`catalog`,`skip`,t===!1?`${c}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${c}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${i} update\` with registry access.`)}export{o as a,a as i,s as n,c as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{n as apiHostCheck,r as authStatusReport,i as checkResult,a as environmentChecks}from"./auth-status-check-
|
|
1
|
+
export{n as apiHostCheck,r as authStatusReport,i as checkResult,a as environmentChecks}from"./auth-status-check-Ba_7IER7.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,t}from"./env-
|
|
1
|
+
import{p as e,t}from"./env-CC1-vnc-.js";import{a as n}from"./auth-resolver-BnK4x1vt.js";import{i as r,l as i}from"./openapi-call-BiKamLmB.js";import{a,o}from"./response-problem-BKDrFcVc.js";import{t as s}from"./api-key-credential-BzzmM-P-.js";import{t as c}from"./credential-redaction-_zj2uH10.js";import{t as l}from"./api-key-bearer-credential-D5Hbqfm3.js";import{a as u,f as d,l as f,s as p}from"./oauth-credential-D3dnMZRE.js";import{n as m,t as h}from"./oauth-bearer-credential-D0hek5Sr.js";async function g(){return null}async function _(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 v(e,t,n,i){if(i.failure!==null)return{scope:e,selected:null,identity:null,authorization:null,error:i.failure};let a=null,o=null,s,l=e=>{s=e,o=y(e.credential,i.materialized)};try{let t=await r({method:`POST`,path:`/v1/auth/me/permissions`,body:{operation:[]},auth:e,requesterScope:e,responseFormat:`json`,onAuthPrepared:l});if(!t.ok)throw Error([t.summary,...t.warnings].join(` — `));if(o===null)throw Error(`Live permission probe did not prepare a credential`);if(a=C(t.data),e===`read`)return{scope:e,selected:o,identity:null,authorization:a,error:null};if(s===void 0)throw Error(`Live permission probe did not retain its prepared credential`);let n=await g(e,s);return{scope:e,selected:o,identity:n,authorization:a,error:null}}catch(r){return{scope:e,selected:o,identity:null,authorization:a,error:c(r,b(t,n,s))}}}function y(e,t){if(e===null)return null;let r=t??n().source;if(r===null)throw Error(`Prepared credential has no local provenance`);return{credential:e,source:r}}function b(t,n,r){return[e().userBearerToken,...o(r?.headers??{}),...t.state===`found`?d(t.stored.credential.tokens):[],n.state===`found`?n.stored.credential.secret:void 0]}function x(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===void 0?null:s(r.activation),apiKeyId:r?.credential.apiKey.id??null,subject:r?.credential.apiKey.subject??null,scope:r?.credential.apiKey.scopes??[],name:r===void 0?null:a(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 S(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 C(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)throw Error(`permission probe returned no JSON response`);let t=i.safeParse(e.response);if(!t.success)throw t.error;return t.data}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,e.apiKeyPhase),``,M(`Providers`,z(e.providers)),M(`Environment`,B(e.resolved)),M(`Selected`,V(e.resolved,e.refresh,e.cliName)),...j(e.live)].join(`
|
|
2
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`:h()?`access token renewed for this command but could not be saved — the next command falls back to a saved API key or \`${t} auth login\``:n.materialized===`oauth`?`access token expired after this command read it`:`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,r){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`,r===`revoking`?`no — API-key revocation pending`:e.subject??`unknown subject`),N(`via ${e.provider??`unknown store`}`),M(`Key`,`${e.name??`unnamed`} ${D(e.apiKeyId)}`),...L(e,n,r),M(`Scopes`,e.scope.length===0?`none`:e.scope.join(`, `))]}function L(e,t,n){if(n===`revoking`)return[M(`Key state`,`revocation pending; unavailable to ordinary commands`),N(`run \`${t} auth login --key\` to resume cleanup; it cannot reactivate this key`)];let r=e.live,i=e.expiresInDay,a=e.expiresAt;if(r?.state===`invalid`)return[M(`Key state`,`rejected by aVenture sign-in \u2014 ${r.summary}`),N(`run \`${t} auth logout\`, then \`${t} auth login --key\``)];let o=r?.state===`verified`;return[M(`Key state`,o?`${e.status??`unknown`}, verified by aVenture sign-in now`:`${e.status??`unknown`} when stored`),...a===null||i===null?[N(`no expiry recorded`)]:[N(R(a,i,o?`expires`:`cached expiry`))],...o?[]:[N(r===null?"aVenture sign-in owns the live verdict — `auth status` re-checks it":`aVenture sign-in could not be reached \u2014 ${r.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`${t.authToken}=${e.present?e.source??`resolved`:`unset`}`}function V(e,n,r){return e.present||n.materialized===`env`?`${t.authToken} from the environment`:n.materialized===`oauth`?`saved OAuth access token`:n.materialized===`api-key`?`saved API key`:`none \u2014 sign in with \`${r} auth login\``}export{x as apiKeyCredentialDiagnostics,v as inspectLiveAuth,S as oauthCredentialDiagnostics,_ as refreshCliCredentials,A as renderAuthStatus};
|
|
@@ -1,11 +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-DEeHDoOT.js";import{l as o,o as s,r as c}from"./env-DtsCE2J8.js";import{c as l,p as u,r as d}from"./result-envelope-Cqvvr4zX.js";import{B as f,o as p,t as m,u as h,y as g,z as _}from"./tool-policy-B-ydHkhx.js";import{i as v}from"./logging-B8Ld27N8.js";import{r as y,t as b}from"./cli-help-policy-DIcX8OWu.js";import{a as x,c as S,d as ee,f as te,i as C,l as w,m as ne,n as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./startup-auth-T1fCSqHx.js";import{t as T}from"./openapi-commands-Bfl6_8wk.js";import{g as le,m as ue}from"./help-catalog-CKhHZ7VD.js";import{n as de,t as fe}from"./operations-metadata-B2wBuzO-.js";import{a as E,i as pe,t as D}from"./output-mode-CcdLzXLi.js";import{S as me,_ as O,a as he,b as k,c as ge,d as _e,f as ve,g as ye,h as be,i as xe,l as Se,m as A,n as j,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe,v as M,x as ke,y as N}from"./generated-option-order-B7LYhMhj.js";import{n as Ae,t as je}from"./deprecated-command-bF9Q8_F6.js";import{a as Me,i as Ne,n as Pe,r as Fe}from"./payload-operand-guard-CsaTfY9Q.js";import{fileURLToPath as Ie}from"node:url";import{readFile as Le}from"node:fs/promises";async function Re(e){let t;try{t=e===`-`?await ze():await Le(e,`utf8`)}catch(t){return d(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return l(`No input provided`,null);let e=JSON.parse(t);return l(`Input parsed`,e)}catch(e){return d(`Input is not valid JSON: ${e.message}`)}}async function ze(){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 P=`--content-type`;function Be(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(P)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${P} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(He(a)))}if(z(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>`,he(r,r.requiredPath)).argParser(F(`--from-file`)))}let o=Ce(a).filter(e=>i(I(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>j(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(xe(n),a.length>1?Te(n):ge(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Ee(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Ve):M(i.name)||i.schemaType===`array`?o.argParser(Ue):o.argParser(F(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 Ve(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function He(e){return(t,r)=>{if(r!==void 0)throw new n(`${P} was already given; pass it once.`);let i=g(e,t);if(!i.ok)throw new n(i.summary);return t}}function Ue(e,t){return[...t??[],e]}function F(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 We(e,t){let n=w(e,t),r=g(e.requestBody??[],n);if(!r.ok||r.data===null)return d(r.summary,r.warnings);let i=r.data;if(i===void 0)return l(`No body`,void 0);let a=Ge(e,i,t);if(a!==null)return d(a);let o=A(e.operationId,i,t);if(!o.ok)return d(o.summary,o.warnings);t=o.data;let s=Ke(i,t);if(s!==null)return d(s);let c=await Xe(t);if(!c.ok)return d(c.summary,c.warnings);let u=be(e.requestBody??[],i,c.data);if(u!==null)return d(u);let f=Ye(e.operationId,i,c.data);if(!f.ok)return f;let p=ye(e.operationId,i,c.data);if(p!==null)return d(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?d(tt(e.operationId,i)):l(`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 d(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!N(h.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return d(`${e.operationId} requires a JSON object${t}.`)}let _=Je(i,h.data);if(_.length>0)return d(`${e.operationId} requires body option(s): ${_.join(`, `)}`);let v=h.data,y=N(v)?k(i).filter(e=>!O(v,e)):[];return y.length>0?d(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`${I(t)} requires ${P} ${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 N(t)?e.parameter.filter(e=>e.required&&!O(t,e.name)).map(I):[]}function Ye(e,t,n){let r=me(t,n);return r===null?l(`Body file paths validated`,null):d(`${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 l(`No body file`,void 0);let n=await Re(t);if(!n.ok)return d(n.summary,n.warnings);let r=u.safeParse(n.data);return r.success?l(`Input parsed`,r.data):d(`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=ke(e,n[e.optionKey]);if(!a.ok||a.data===null)return d(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 d(s.summary,s.warnings);i=!0}if(!i)return l(`No direct body options`,void 0);let a=_e(e,t,n,r);return a===null?l(`Direct body options parsed`,r):a}function Qe(e,t,n,r,i){let a=Se(e,t,r);if(a===null){let e=et(r,i);return e.ok?ve(n,r.name,e.data,r.schemaType===`array`):d(e.summary,e.warnings)}let o=Oe(e,t,r,a);if(o!==null)return d(o);let s=r.schemaType===`array`,c=s?r.itemSchemaType:r.schemaType;for(let[e,t]of a.rows){let i=[];for(let e of t){let t=R(r,c,e);if(!t.ok)return d(t.summary,t.warnings);i.push(t.data)}for(let t of s?[i]:i){let i=we(n,r.name,e,t);if(!i.ok)return i}}return l(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function $e(e,t,n,r){if(n===void 0)return l(`Direct body parsed`,r);if(r===void 0)return l(`Input parsed`,n);if(N(n)&&N(r))try{return l(`Input parsed`,L(t,n,r))}catch(t){return d(`${e} ${t instanceof Error?t.message:String(t)}`)}return d(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function L(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(N(n)&&N(a))i[t]=L(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`:ue.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function et(e,t){if(typeof t==`boolean`)return l(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return R(e,e.schemaType,t??``);let n=[],r=M(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=R(e,r,i);if(!t.ok)return t;n.push(t.data)}return l(`Body value parsed`,n)}function R(e,t,n){if(n===`null`&&e.nullable&&t===e.schemaType)return l(`Body value parsed`,null);let r=e.name;if(t===`boolean`)return n===`true`?l(`Body value parsed`,!0):n===`false`?l(`Body value parsed`,!1):d(`${r} must be true or false.`);if(t===`number`||t===`integer`){let e=n.trim(),i=Number(e);return e===``||!Number.isFinite(i)?d(`${r} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?d(`${r} must be an integer.`):l(`Body value parsed`,i)}return l(`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(I).join(`, `)}`;let r=k(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function 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:P,location:`body`}),z(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),De(e.options,r)}function z(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, search the catalog, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help catalog [query...]` searches or lists every operation;\n`help ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new it(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()}),D(r),r.action(async function(r){let i=r.flatMap(e=>e.split(/\s+/u).filter(Boolean)),{emit:a}=await import(`./output-CW4MMcMX.js`),o=this.optsWithGlobals();if(o.help&&i.length===0){this.outputHelp();return}let s=G(e,i),c=t.find(t=>s!==void 0&&G(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let u=c===void 0?await st(i,t):l(`Resolved by command path`,{operationId:c.operationId});if(u.ok&&u.data?.command!==void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),!u.ok||u.data===null){a({mode:E(o)},u);return}let{writeShowResult:d}=await import(`./operations-catalog-DsLdU5it.js`);d({...o,...u.data},t,E(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))}},B=2,V=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=>S[e.name()]?.listed!==!1):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(B)}${e}\n${H(n,a,i)}`}};function H(e,t,n){return n.boxWrap(e,t-V).replace(/^/gmu,` `.repeat(V))}function ot(e,t,n){for(let r of t){let i=G(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=le(r.operationId,t,n),c=U(de(r.header),o,e),l=U(fe(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
|
|
2
|
-
`)}\n`})}}function U(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>H(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(B)))]}var W='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function st(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?l(`Resolved by route`,{operationId:i.operationId}):d(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[W]);let o=_.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return l(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=f(o),c=r.join(``),u=t.find(e=>e.method===s&&e.path===c);if(u!==void 0)return l(`Resolved by route template`,{operationId:u.operationId});let{resolveOpenApiOperationSelector:p}=await import(`./openapi-call-
|
|
3
|
-
`)),!s)return;let b=ie(n);for(let e of n.parameters)mt(v,e,a||e===b);Be(v,n),h(n.intent)&&!v.options.some(e=>e.long===`--execute`)&&v.addOption(new t(`--execute`).hideHelp()),D(v),v.hook(`preAction`,e=>te(e,n)),n.explain===!0&&v.option(`--explain`,`Print the search strategy and parsed constraints before the results`),b!==void 0&&v.argument(`[text...]`,b.description||`Same as ${ce(b.flag)}.`),v.action(async function(){let{emit:e,emitSearchExplanation:t}=await import(`./output-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./commander-DEj7N1b9.js";import{a}from"./package-DEeHDoOT.js";import{l as o,o as s,r as c}from"./env-CC1-vnc-.js";import{c as l,p as u,r as d}from"./result-envelope-Cqvvr4zX.js";import{B as f,o as p,t as m,u as h,y as g,z as _}from"./tool-policy-BmDEaARa.js";import{i as v}from"./logging-D7Z7a3sv.js";import{r as y,t as b}from"./cli-help-policy-BX-whN-w.js";import{a as x,c as S,d as ee,f as te,i as C,l as w,m as ne,n as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./startup-auth-B_NvVcRd.js";import{t as T}from"./openapi-commands-LRER_hsQ.js";import{g as le,m as ue}from"./help-catalog-CvpHuIkW.js";import{n as de,t as fe}from"./operations-metadata-DVXRDkYa.js";import{a as E,i as pe,t as D}from"./output-mode-CcdLzXLi.js";import{S as me,_ as O,a as he,b as k,c as ge,d as _e,f as ve,g as ye,h as be,i as xe,l as Se,m as A,n as j,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe,v as M,x as ke,y as N}from"./generated-option-order-BNFSLEDZ.js";import{n as Ae,t as je}from"./deprecated-command-bF9Q8_F6.js";import{a as Me,i as Ne,n as Pe,r as Fe}from"./payload-operand-guard-BAEsdwL6.js";import{fileURLToPath as Ie}from"node:url";import{readFile as Le}from"node:fs/promises";async function Re(e){let t;try{t=e===`-`?await ze():await Le(e,`utf8`)}catch(t){return d(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return l(`No input provided`,null);let e=JSON.parse(t);return l(`Input parsed`,e)}catch(e){return d(`Input is not valid JSON: ${e.message}`)}}async function ze(){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 P=`--content-type`;function Be(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(P)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${P} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(He(a)))}if(z(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>`,he(r,r.requiredPath)).argParser(F(`--from-file`)))}let o=Ce(a).filter(e=>i(I(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>j(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(xe(n),a.length>1?Te(n):ge(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Ee(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Ve):M(i.name)||i.schemaType===`array`?o.argParser(Ue):o.argParser(F(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 Ve(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function He(e){return(t,r)=>{if(r!==void 0)throw new n(`${P} was already given; pass it once.`);let i=g(e,t);if(!i.ok)throw new n(i.summary);return t}}function Ue(e,t){return[...t??[],e]}function F(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 We(e,t){let n=w(e,t),r=g(e.requestBody??[],n);if(!r.ok||r.data===null)return d(r.summary,r.warnings);let i=r.data;if(i===void 0)return l(`No body`,void 0);let a=Ge(e,i,t);if(a!==null)return d(a);let o=A(e.operationId,i,t);if(!o.ok)return d(o.summary,o.warnings);t=o.data;let s=Ke(i,t);if(s!==null)return d(s);let c=await Xe(t);if(!c.ok)return d(c.summary,c.warnings);let u=be(e.requestBody??[],i,c.data);if(u!==null)return d(u);let f=Ye(e.operationId,i,c.data);if(!f.ok)return f;let p=ye(e.operationId,i,c.data);if(p!==null)return d(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?d(tt(e.operationId,i)):l(`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 d(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!N(h.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return d(`${e.operationId} requires a JSON object${t}.`)}let _=Je(i,h.data);if(_.length>0)return d(`${e.operationId} requires body option(s): ${_.join(`, `)}`);let v=h.data,y=N(v)?k(i).filter(e=>!O(v,e)):[];return y.length>0?d(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`${I(t)} requires ${P} ${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 N(t)?e.parameter.filter(e=>e.required&&!O(t,e.name)).map(I):[]}function Ye(e,t,n){let r=me(t,n);return r===null?l(`Body file paths validated`,null):d(`${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 l(`No body file`,void 0);let n=await Re(t);if(!n.ok)return d(n.summary,n.warnings);let r=u.safeParse(n.data);return r.success?l(`Input parsed`,r.data):d(`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=ke(e,n[e.optionKey]);if(!a.ok||a.data===null)return d(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 d(s.summary,s.warnings);i=!0}if(!i)return l(`No direct body options`,void 0);let a=_e(e,t,n,r);return a===null?l(`Direct body options parsed`,r):a}function Qe(e,t,n,r,i){let a=Se(e,t,r);if(a===null){let e=et(r,i);return e.ok?ve(n,r.name,e.data,r.schemaType===`array`):d(e.summary,e.warnings)}let o=Oe(e,t,r,a);if(o!==null)return d(o);let s=r.schemaType===`array`,c=s?r.itemSchemaType:r.schemaType;for(let[e,t]of a.rows){let i=[];for(let e of t){let t=R(r,c,e);if(!t.ok)return d(t.summary,t.warnings);i.push(t.data)}for(let t of s?[i]:i){let i=we(n,r.name,e,t);if(!i.ok)return i}}return l(`Body value assigned`,null)}var I=e=>e.flag.split(` `)[0]??e.name;function $e(e,t,n,r){if(n===void 0)return l(`Direct body parsed`,r);if(r===void 0)return l(`Input parsed`,n);if(N(n)&&N(r))try{return l(`Input parsed`,L(t,n,r))}catch(t){return d(`${e} ${t instanceof Error?t.message:String(t)}`)}return d(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function L(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(N(n)&&N(a))i[t]=L(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`:ue.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function et(e,t){if(typeof t==`boolean`)return l(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return R(e,e.schemaType,t??``);let n=[],r=M(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=R(e,r,i);if(!t.ok)return t;n.push(t.data)}return l(`Body value parsed`,n)}function R(e,t,n){if(n===`null`&&e.nullable&&t===e.schemaType)return l(`Body value parsed`,null);let r=e.name;if(t===`boolean`)return n===`true`?l(`Body value parsed`,!0):n===`false`?l(`Body value parsed`,!1):d(`${r} must be true or false.`);if(t===`number`||t===`integer`){let e=n.trim(),i=Number(e);return e===``||!Number.isFinite(i)?d(`${r} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?d(`${r} must be an integer.`):l(`Body value parsed`,i)}return l(`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(I).join(`, `)}`;let r=k(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(I).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function 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:P,location:`body`}),z(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),De(e.options,r)}function z(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, search the catalog, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help catalog [query...]` searches or lists every operation;\n`help ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new it(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()}),D(r),r.action(async function(r){let i=r.flatMap(e=>e.split(/\s+/u).filter(Boolean)),{emit:a}=await import(`./output-GMp6qpse.js`),o=this.optsWithGlobals();if(o.help&&i.length===0){this.outputHelp();return}let s=G(e,i),c=t.find(t=>s!==void 0&&G(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let u=c===void 0?await st(i,t):l(`Resolved by command path`,{operationId:c.operationId});if(u.ok&&u.data?.command!==void 0&&this.error(`unknown command '${i.join(` `)}' (run \`${n} --help\` for the command tree)`),!u.ok||u.data===null){a({mode:E(o)},u);return}let{writeShowResult:d}=await import(`./operations-catalog-CtnrukD6.js`);d({...o,...u.data},t,E(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))}},B=2,V=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=>S[e.name()]?.listed!==!1):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(B)}${e}\n${H(n,a,i)}`}};function H(e,t,n){return n.boxWrap(e,t-V).replace(/^/gmu,` `.repeat(V))}function ot(e,t,n){for(let r of t){let i=G(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=le(r.operationId,t,n),c=U(de(r.header),o,e),l=U(fe(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
|
|
2
|
+
`)}\n`})}}function U(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>H(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(B)))]}var W='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function st(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?l(`Resolved by route`,{operationId:i.operationId}):d(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[W]);let o=_.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return l(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=f(o),c=r.join(``),u=t.find(e=>e.method===s&&e.path===c);if(u!==void 0)return l(`Resolved by route template`,{operationId:u.operationId});let{resolveOpenApiOperationSelector:p}=await import(`./openapi-call-Bd2wUhXk.js`),m=p({method:s,path:c});return!m.ok||m.data===null?d(m.summary,[...m.warnings,W]):l(`Resolved by method and path`,{operationId:m.data.operation.operationId})}function G(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}function ct(e,t,n){if(e.cliPath[0]!==`lookup`||!lt(n))return null;let r=[...(e.requestBody??[]).flatMap(e=>e.parameter),...e.parameters,{name:`fromFile`,optionKey:`fromFile`}],i=r.filter(({optionKey:e},t)=>r.findIndex(t=>t.optionKey===e)===t).filter(({optionKey:e})=>t[e]!==void 0).map(({name:e,optionKey:n})=>`${e}=${String(t[n])}`),a=`no record for ${i.length===0?`the given input`:i.join(`, `)}`;return n.ok?d(a):d(a,[],{httpStatus:n.httpStatus,problem:n.problem})}function lt(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function ut(t,n,r,i){let a=dt(t,r),o=a instanceof e?[]:a,s=o[0],c=i.bin[0],l=[{selected:s===`auth`,register:async()=>{let{registerBuiltinAuthCommands:e}=await import(`./builtin-auth-QiC-7MKe.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-qeIeNPzz.js`);e(n,i)}},{selected:s===`batch`,register:async()=>{let{registerBuiltinBatchCommand:e}=await import(`./builtin-batch-DdGyCjlR.js`);e(n,r,c)}},{selected:s===`research`||s===`research-runs`||s===`data-engineering`,register:async()=>{let{registerBuiltinRunWaitCommand:e}=await import(`./builtin-run-wait-B4fwnFYI.js`);await e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-DLIhx1yG.js`);e(n,r,c)}},{selected:s===`help`,register:async()=>{let{registerHelpCatalogCommand:e}=await import(`./operations-Do8gJz5Y.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerRetiredCommandCatalog:e}=await import(`./operations-Do8gJz5Y.js`);e(n,r,c)}}],u=s===void 0||s===`help`||s===`completion`||s===`command-catalog`||!l.some(e=>e.selected)&&!r.some(e=>e.cliPath[0]===s),d=1;for(;d<o.length&&r.some(e=>o.slice(0,d+1).every((t,n)=>e.cliPath[n]===t));)d++;let f=o.slice(0,d),p=u?r:r.filter(e=>f.slice(0,e.cliPath.length).every((t,n)=>e.cliPath[n]===t)),m=new Set,h=async(e=!1)=>{for(let t of l)(e||u||t.selected)&&!m.has(t)&&(await t.register(),m.add(t))};return{generated:p,fullTree:u,rootHelp:t.length>0&&t.every(e=>e===`--help`||e===`-h`),registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function dt(t,n){try{return new i().parseOptions([...C(t,n).commandArgv]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var K=new Set(T.map(e=>e.cliPath.join(` `)));function q(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,Pe):e.registeredArguments.length===0&&!K.has(Me(e).join(` `))&&e.addHelpOption(new Ne(e));for(let n of e.commands)q(n,t)}function J(e){return b[y(e,S)??`cli`]}function Y(e,t,n,{rootHelp:r=!1}={}){let i=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:J(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),a=new Set(i.filter(e=>se(e.cliPath[0])).map(e=>e.cliPath[0]??``)),o=new Set,s=new Set;for(let{cliPath:e,deprecated:t}of i)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);o.add(r),t!==!0&&s.add(r)}for(let t of i)ft(e,t,a,s,o.has(t.cliPath.join(` `)),n,!r||t.cliPath.length===1)}function ft(e,n,r,i,a,o,s){let c=n.cliPath,l=e,u=``,f=!r.has(c[0]??``);for(let e of c.slice(0,-1)){u=u===``?e:`${u} ${e}`;let t=f&&u===e||!i.has(u);l=pt(l,e,u,t)}let g=c.at(-1)??n.operationId,_=n.deprecated===!0&&i.has(c.join(` `)),v=l.commands.find(e=>e.name()===g)??l.command(g,n.deprecated===!0&&!_?{hidden:!0}:{}),y=n.requestBody?.flatMap(({parameter:e})=>e)??[];if(v.summary((_?S[c.join(` `)]?.summary:void 0)??(n.summary||n.operationId)).description([`${n.method} ${n.path}.`,n.summary||n.description,`Full documentation: ${o} help ${n.cliPath.join(` `)}`,n.requestBody?.[0]?.kind===`json`||[...n.parameters,...y].some(e=>p(e.schemaType,e.itemSchemaType))?m:``].filter(Boolean).join(`
|
|
3
|
+
`)),!s)return;let b=ie(n);for(let e of n.parameters)mt(v,e,a||e===b);Be(v,n),h(n.intent)&&!v.options.some(e=>e.long===`--execute`)&&v.addOption(new t(`--execute`).hideHelp()),D(v),v.hook(`preAction`,e=>te(e,n)),n.explain===!0&&v.option(`--explain`,`Print the search strategy and parsed constraints before the results`),b!==void 0&&v.argument(`[text...]`,b.description||`Same as ${ce(b.flag)}.`),v.action(async function(){let{emit:e,emitSearchExplanation:t}=await import(`./output-GMp6qpse.js`),r=Object.assign(this.optsWithGlobals(),{environment:this.opts().environment}),i=E(r),a=r;if(b!==void 0){let t=ne(b,this.args,r);if(!t.ok)return e({mode:i},{...t,notDispatched:!0});if(t.data===null)return e({mode:i},t);a=t.data}let o=ee(n,a);if(o.length>0){let t=`missing required options: ${o.join(`, `)}`;return e({mode:i},d(t,[],{notDispatched:!0}))}let s=await ht(n,a,i),c=ct(n,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&t(i,s.data),s.ok&&s.data instanceof Uint8Array&&i!==`csv`&&i!==`xlsx`?process.stdout.write(s.data):e({mode:i},s)})}function pt(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=S[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function mt(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 ht(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-Bd2wUhXk.js`),{pendingResult:a}=await import(`./output-GMp6qpse.js`),o=await We(e,t);if(!o.ok)return{...o,notDispatched:!0};let s=!1,c=Object.fromEntries(e.parameters.filter(e=>e.location===`path`).map(e=>{let n=t[e.optionKey];if(Array.isArray(n))return[e.name,n.at(0)??``];if(n===void 0)throw Error(`Missing required option ${e.optionKey}`);return[e.name,String(n)]})),l=Object.fromEntries(e.parameters.filter(e=>e.location===`query`).flatMap(e=>{let n=t[e.optionKey];if(n===void 0||Array.isArray(n)&&n.length===0)return[];let r=Array.isArray(n)||typeof n==`boolean`?n:String(n);return[[e.name,r]]})),u=Object.fromEntries(e.parameters.filter(e=>e.location===`header`).flatMap(e=>{let n=t[e.optionKey];return n===void 0||Array.isArray(n)&&n.length===0?[]:[[e.name,Array.isArray(n)?n.join(`,`):String(n)]]})),d=await i({method:e.method,path:r(e.operationId,c),searchParams:l,headers:u,body:o.data,contentType:w(e,t),auth:e.auth,responseFormat:pe(n),responseBytes:e.binaryResponse===!0,pendingResult:a,onDispatch:()=>{s=!0}});return je(e,d.ok||s?d:{...d,notDispatched:!0})}async function gt(e,n){let r=n.bin[0],i=Ae(T),a=re(e,i),l=a===`required`?i:oe(i),u=new Fe;u.enablePositionalOptions(!x(e)&&C(e,i).positionalOptions).name(r).usage(`[--environment <environment>] <command> [subcommand] [options]`).configureHelp(at).summary(`CLI for the aVenture API: companies, people, and news, with the funding, publications, and classifications attached to them`).description(`The aVenture research API from your terminal. Three records — companies,
|
|
4
4
|
people, and news — carry everything else: funding, publications, and tags.
|
|
5
5
|
|
|
6
6
|
Mutations execute directly; --execute is a deprecated no-op.
|
|
7
|
-
The aVenture MCP server runs these same operations through the same API client.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${c})`).choices([...o()])).showHelpAfterError(`(run \`${r} --help\` for usage)`),(x(e)||e.every(e=>e.startsWith(`-`)))&&u.version(n.version);let d=ut(e,u,l,n);Y(u,d.generated,r,{rootHelp:d.rootHelp}),await d.registerBuiltin(),rt(u,l,r);for(let e of u.commands)e.helpGroup()||e.helpGroup(J(e.name()).heading);let f;if(q(u,e=>t=>{throw f=(async()=>{!d.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await d.completeTree((e,t)=>Y(e,t,r));let{commandExitHandler:n}=await import(`./parse-error-hint-
|
|
7
|
+
The aVenture MCP server runs these same operations through the same API client.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${c})`).choices([...o()])).showHelpAfterError(`(run \`${r} --help\` for usage)`),(x(e)||e.every(e=>e.startsWith(`-`)))&&u.version(n.version);let d=ut(e,u,l,n);Y(u,d.generated,r,{rootHelp:d.rootHelp}),await d.registerBuiltin(),rt(u,l,r);for(let e of u.commands)e.helpGroup()||e.helpGroup(J(e.name()).heading);let f;if(q(u,e=>t=>{throw f=(async()=>{!d.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await d.completeTree((e,t)=>Y(e,t,r));let{commandExitHandler:n}=await import(`./parse-error-hint-v1E3Qm0v.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),a===`required`){let e=[u];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await ae(`required`)}))}}let p=new Set(u.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));return u.addHelpText(`after`,[``,`Record subcommands under entities, people, and news:`,...[[`search`,` search Find many of that record from a plain-English query or a filter`],[`lookup`,` lookup Find one news article; companies and people use the root lookup`],[`get`,` get Read one record`],[`list`,` list Read many records`],[`create`,` create, update, delete Write; each needs a credential that permits it`]].flatMap(([e,t])=>p.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${s}/sign-up, then run: ${r} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${r} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --csv Print CSV rows or preserve server CSV bytes.`,` --xlsx Write server XLSX bytes with --to-file; use --csv otherwise.`,` --data response data as JSON, the default when piped or non-TTY`,` --data-full uncapped, for bounded programs, never LLM agents`,` --all-fields --text plus the detail fields it hides by default
|
|
8
8
|
`,`Exit codes:`,` 0 envelope.ok === true
|
|
9
9
|
1 envelope.ok === false
|
|
10
10
|
`,`Examples:`,` $ ${r} auth login`,` $ ${r} lookup --name Stripe --url https://stripe.com`,` $ ${r} search "fintech companies in Austin"\n`,`Run \`${r} <command> --help\` for its subcommands and options,`,`or \`${r} help <command>\` for its full documentation.`].join(`
|
|
11
|
-
`)),{program:u,exitPreparation:()=>f}}var X=a(Ie(import.meta.url)),Z=X.bin[0];async function Q(e,t){process.exitCode=1;let n=e instanceof Error?e:Error(String(e)),r={...d(`${Z} ${t}: ${n.message}`,[n.name||`Error`]),counts:{exitCode:1}};v({component:Z,event:`fatal`,message:n.message,error:n}),process.stderr.write(`${Z} fatal (${t}): ${n.stack??n.message}\n`);try{let{BearerVerificationUnavailableError:e}=await import(`./openapi-call-
|
|
11
|
+
`)),{program:u,exitPreparation:()=>f}}var X=a(Ie(import.meta.url)),Z=X.bin[0];async function Q(e,t){process.exitCode=1;let n=e instanceof Error?e:Error(String(e)),r={...d(`${Z} ${t}: ${n.message}`,[n.name||`Error`]),counts:{exitCode:1}};v({component:Z,event:`fatal`,message:n.message,error:n}),process.stderr.write(`${Z} fatal (${t}): ${n.stack??n.message}\n`);try{let{BearerVerificationUnavailableError:e}=await import(`./openapi-call-Bd2wUhXk.js`),{emitJson:t}=await import(`./output-GMp6qpse.js`),i=n instanceof e?{httpStatus:n.problem.status,problem:n.problem}:{};r={...r,...i},t(r)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`${Z} fatal reporting failed: ${t}\n`),process.stdout.write(`${JSON.stringify(r)}\n`)}}var _t=e=>{if(e.code!==`EPIPE`)throw e;process.exit(0)};for(let e of[process.stdout,process.stderr])e.on(`error`,_t);process.on(`uncaughtException`,e=>Q(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>Q(e,`unhandledRejection`));var $=await gt(process.argv.slice(2),X);try{await $.program.parseAsync()}catch(t){await $.exitPreparation(),t instanceof e?process.exitCode=t.exitCode:await Q(t,`parseAsync`)}export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./package-DEeHDoOT.js";import{c as e,r as t}from"./result-envelope-Cqvvr4zX.js";import"./operations-metadata-
|
|
1
|
+
import"./package-DEeHDoOT.js";import{c as e,r as t}from"./result-envelope-Cqvvr4zX.js";import"./operations-metadata-DVXRDkYa.js";import"node:path";import"node:fs";import"node:os";import"node:fs/promises";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};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{o as n,p as r,t as i}from"./env-
|
|
1
|
+
import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{o as n,p as r,t as i}from"./env-CC1-vnc-.js";import{c as a,r as o}from"./result-envelope-Cqvvr4zX.js";import{r as s}from"./api-target-vxev2RKl.js";import{t as c}from"./credential-redaction-_zj2uH10.js";import{n as l}from"./contract-B2oibXOn.js";import{t as u}from"./openapi-composites-IdxI7cAF.js";import{t as d}from"./auth-status-check-Ba_7IER7.js";import{n as f}from"./output-B8HawMKY.js";import{a as p,t as m}from"./output-mode-CcdLzXLi.js";var h=l(u,`oauth`),g=[l(u,`start`),l(u,`poll`),l(u,`acknowledge`)],_=l(u,`revoke`);function v(n,r=t().bin[0]){let a=S(n),s=[`${h.description} Default method: OAuth in your browser.`,`With --key: ${g.map(({description:e})=>e).join(` `)}`].join(`
|
|
2
2
|
`);m(x(a,[h,...g],s)).action(y),m(x(a,[_],_.description)).action(b),m(a.command(`status`).summary(`Keep saved credentials current and report them`).description([`Runs the same credential materialization every command runs, then reports:`,` - auth: whether AUTH_TOKEN was already set in this shell's environment`,` - oauth: the saved OAuth identity and access-token expiry for the selected API host;`,` an expired token is renewed with its refresh token and a token the sign-in service rejects is retired`,` - api-key: the saved aVenture API key, re-verified with aVenture sign-in and its cached metadata updated`,` - selected: the credential the next command sends`,` - providers: GET /v1/auth/providers (browser sign-in and the CLI OAuth client)`,` - api: running CLI package version plus GET /info build metadata`," - check: `{ name, status, message }` for each environment check:",...d.map(e=>` ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) does not`,`fail the run. Each failing message names the command that fixes it.`,`Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.`,`--verify read|write additionally runs a live permission probe for that scope; it does not`,`execute or authorize an arbitrary API operation.`].join(`
|
|
3
3
|
`)).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){C(this),f({mode:p(e)},await w(r,e.verify))}),a.command(`token`).summary(`Print the bearer token the next command sends`).description([`Runs the same credential materialization every command runs, then prints the selected`,`bearer token alone on stdout: ${i.authToken} when set, otherwise the saved OAuth`,`access token (renewed when expired) or the saved aVenture API key.`,`Use it where another client needs this CLI's sign-in, such as an MCP client's header helper.`].join(`
|
|
4
|
-
`)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-
|
|
5
|
-
`))}function C(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function w(e,n){let{resolveAuthStatus:l}=await import(`./auth-resolver-
|
|
6
|
-
`)}async function E(e){let{refreshStoredApiKeyCredential:t}=await import(`./api-key-credential-verification-
|
|
4
|
+
`)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-CWL-L_9x.js`);C(this);let t=await e(r),n=process.env[i.authToken]?.trim();t.failure===null&&n!==void 0&&n.length>0?process.stdout.write(`${n}\n`):f({mode:`text`},t.failure===null?M(`auth token: no credentials resolved`,null,r,{oauth:!0,apiKey:!0}):o(`auth token: ${t.failure}`))})}async function y(e){C(this);let t=p(e),n=e.key===!0?await(await import(`./api-key-login-HZafralu.js`)).loginApiKeyCredential({noBrowser:!e.browser,clientLabel:e.clientLabel}):await(await import(`./oauth-login-BZl9R9lD.js`)).loginOAuthCredential({noBrowser:!e.browser});f({mode:t},n)}async function b(e){let{logoutCliCredentials:t}=await import(`./logout-aSSPrw35.js`);C(this),f({mode:p(e)},await t({forgetLocal:e.forgetLocal===!0}))}function x(e,t,n){let[r]=t,i=e.command(r.command.slice(r.command.indexOf(` `)+1)).summary(r.summary).description(n),a=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])a.has(t.flag)||(a.add(t.flag),`required`in t&&t.required?i.requiredOption(t.flag,t.description):i.option(t.flag,t.description));return i}function S(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${h.command}\`: ${h.summary}; \`--key\` ${g[0].summary.toLowerCase()}.`,`\`${_.command}\`: ${_.summary}.`,"`auth status` reports credential provenance, sign-in providers, CLI/API build metadata, and environment checks.","`auth token` prints the bearer token the next command sends."].join(`
|
|
5
|
+
`))}function C(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function w(e,n){let{resolveAuthStatus:l}=await import(`./auth-resolver-Csx2wedp.js`),{apiHostCheck:u,authStatusReport:d,checkResult:f,environmentChecks:p}=await import(`./auth-status-check-DRSwi9--.js`),{inspectOAuthCredentialStorage:m}=await import(`./oauth-credential-DADCv54U.js`),{apiKeyCredentialDiagnostics:h,inspectLiveAuth:g,oauthCredentialDiagnostics:_,refreshCliCredentials:v,renderAuthStatus:y}=await import(`./auth-status-render-CWL-L_9x.js`),b;try{b=s(r().host)}catch(e){return o(`auth status: invalid API host — ${c(e)}`)}let x=l(),S=v(e),[C,w,O]=await Promise.all([j(`/info`,`GET /info`),D(),p(e)]),A=await S,[N,P]=await Promise.all([m(b),E(b)]),F=n===void 0?null:await g(n,N,P.inspection,A),I=t().version,L=h(b,P.inspection,P.verification),R=F!==null||x.present||N.state===`found`||P.inspection.state===`found`&&P.inspection.stored.activation===`active`,z=A.failure??F?.error??(R?null:`no credentials resolved`),B=d(O,u(C,b,e),z===null?f(`auth`,`pass`,`credential=${A.materialized??x.source??`none`}`):f(`auth`,`fail`,z)),V=`${y({cliName:e,cliVersion:I,apiVersion:C.ok?await k(C.data):null,oauth:N,apiKey:L,apiKeyPhase:P.inspection.state===`found`?P.inspection.stored.activation:null,providers:w,resolved:x,refresh:A,live:F})}\n${T(B.check)}`,H={cli:{version:I},api:C.ok?C.data??null:null,auth:{[i.authToken]:x},selected:A.materialized,oauth:_(b,N),apiKey:L,providers:w,live:F,check:B.check,...C.ok?{}:{apiError:C.summary}};if(A.failure!==null)return{...o(`auth status: ${A.failure} | ${V}`,[A.failure]),data:H};if(!C.ok&&C.httpStatus===401)return{...o(`auth status: the API rejected the selected credential (401) | ${V}`,[`Replace or unset ${i.authToken}, or run \`${e} auth login\`.`]),data:H};if(F!==null&&F.error!==null)return{...o(`auth status: ${F.scope} permission probe failed — ${F.error}`,[F.error]),data:H};if(!R)return M(`auth status: no credentials resolved | ${V}`,H,e,{oauth:N.state===`missing`,apiKey:P.inspection.state===`missing`});let U=B.check.filter(e=>e.status===`fail`);return U.length===0?a(V,H):{...o(`auth status: ${U.map(e=>e.name).join(`, `)} failed | ${V}`,U.map(e=>e.message)),data:H}}function T(e){return[`Checks`,...e.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
|
|
6
|
+
`)}async function E(e){let{refreshStoredApiKeyCredential:t}=await import(`./api-key-credential-verification-g1VutBly.js`),n=await O(e);if(n.state!==`found`)return{inspection:n,verification:null};let{lookup:r,verification:i}=await t(n.stored);return{inspection:r,verification:i}}async function D(){try{let{fetchAuthProviderCatalog:e}=await import(`./oauth-login-BZl9R9lD.js`);return{state:`found`,catalog:await e()}}catch(e){return{state:`unavailable`,summary:c(e)}}}async function O(e){try{let{inspectApiKeyCredentialStorage:t}=await import(`./api-key-credential-Cr1aPyGV.js`);return await t(e)}catch(e){return{state:`invalid`,summary:c(e)}}}async function k(e){let{SystemBuildSchema:t}=await import(`./system-build-DFy8edPI.js`);if(!A(e))return null;let n=t.safeParse(Reflect.get(e,`response`));if(!n.success)return null;let r=n.data.build.version?.trim();return r&&r.length>0?r:null}function A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function j(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-Bd2wUhXk.js`);return await n({method:`GET`,path:e,auth:`none`,responseFormat:`json`}).catch(e=>o(`${t} failed: ${e instanceof Error?e.message:String(e)}`))}function M(e,t,r,a){return{...o(e,[...a.apiKey?[`For an API key (works over SSH), run \`${r} auth login --key\`.`]:[],...a.oauth?[`For OAuth, run \`${r} auth login\`; without a browser it prints a device code.`]:[],`For non-interactive use, set ${i.authToken} to an aVenture API key (create one at ${n}/settings/api-keys).`]),data:t}}export{v as registerBuiltinAuthCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,r as t}from"./result-envelope-Cqvvr4zX.js";import{n}from"./output-
|
|
1
|
+
import{c as e,r as t}from"./result-envelope-Cqvvr4zX.js";import{n}from"./output-B8HawMKY.js";import{a as r,t as i}from"./output-mode-CcdLzXLi.js";var a=5e3,o=6e4,s=3e4,c=86400,l={noun:`research runs`,summary:`Wait for research runs to finish, then report each outcome`,description:"Polls `research runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, and last event time, plus spend when available in this distribution; a timeout reports the last event time so a stalled run shows. Exits nonzero when the run failed or stopped, or when --timeout passes first.",getOperationId:`getResearchRun`,defaultTimeoutSeconds:1800,schema:async()=>(await import(`./run-detail-DVNjHyAi.js`)).HarnessRunDetailSchema,progress:({run:e,lastEventAt:t})=>e.status===`completed`||e.status===`failed`||e.status===`stopped`?void 0:`${e.status}, last event ${t??`none`}`,outcome:m};async function u(e){let t=t=>e.commands.find(e=>e.name()===t),n=e=>t(e)?.commands.find(e=>e.name()===`runs`),r=n(`research`);r!==void 0&&d(r,l);let i=n(`data-engineering`);if(i!==void 0){let{dataEngineeringRuns:e}=await import(`./private-run-read-DM_02z6l.js`);e!==void 0&&d(i,e)}}function d(e,t){let a=e.command(`wait`).summary(t.summary).description(`${t.description} Several --run-id values wait for every run in one process; data then lists each outcome in order, and the exit is nonzero unless every run succeeded.`).requiredOption(`--run-id <uuid...>`,`Run id; repeat or list several to wait for all`).option(`--timeout <seconds>`,`Total seconds to wait; a run still in flight then exits nonzero as still running`,String(t.defaultTimeoutSeconds));i(a),a.action(async function(){let e=this.optsWithGlobals(),i=await Promise.all(e.runId.map(n=>p(t,{runId:n,timeout:e.timeout}))),a=i.length===1&&i[0]!==void 0?i[0]:f(i);n({mode:r(e)},a)})}function f(t){let n=t.filter(e=>e.ok).length;return{...e(`${n} of ${t.length} runs succeeded: ${t.map(e=>e.summary).join(`; `)}`,t.map(e=>e.data),{warnings:t.flatMap(e=>e.warnings)}),ok:n===t.length}}async function p(e,n){let{setTimeout:r}=await import(`node:timers/promises`),{buildOpenApiPath:i}=await import(`./openapi-call-Bd2wUhXk.js`),{parseBoundedInt:s}=await import(`./batch-io-DgwZwRpQ.js`),l=s(`--timeout`,n.timeout,1,c);if(!l.ok||l.data===null)return t(l.summary);let u=Date.now()+l.data*1e3,d=i(e.getOperationId,{runId:n.runId}),f=a,p=`not read yet`,m=(r=`after ${l.data}s`)=>t(`Run ${n.runId} is still ${p} ${r}`,[`Wait longer with --timeout, or read it with \`${e.noun} get --run-id ${n.runId}\`.`]);for(;;){if(u-Date.now()<=0)return m();let t=0,n=await h(d,u,await e.schema());if(n.kind===`deadline`)return m();if(n.kind===`refused`)return n.envelope;if(n.kind===`detail`){let t=e.progress(n.detail);if(t===void 0)return await e.outcome(n.detail,u);p=t}else p=`unread (${n.reason})`,t=(n.retryAfterSeconds??0)*1e3;let i=u-Date.now();if(i<=0||t>=i)return m(i<=0?`after ${l.data}s`:`and the API asks for ${t/1e3}s, past the ${l.data}s --timeout`);let s=Math.max(t,a+Math.random()*(f-a)),c=Math.min(u,Date.now()+s),g=c-Date.now();for(;g>0;)await r(g),g=c-Date.now();f=Math.min(f*2,o)}}async function m(t,n){let{readResearchRunSpend:r}=await import(`./private-run-read-DM_02z6l.js`),{run:i}=t,a=await r?.({runId:i.id,deadline:n})??{costUsd:null},o={runId:i.id,status:i.status,error:i.error??null,failureClass:i.failureClass??null,publicUrl:t.publicUrl??null,finishedAt:i.finishedAt??null,lastEventAt:t.lastEventAt??null,...a.costUsd===null?{}:{costUsd:a.costUsd}},s={warnings:a.warning===void 0?[]:[a.warning]},c=a.costUsd===null?``:`; spend $${a.costUsd.toFixed(4)}`;if(i.status===`completed`)return e(`Run ${i.id} completed${c}`,o,s);let l=i.failureClass?` (${i.failureClass})`:``,u=i.error?`: ${i.error}`:``;return{...e(`Run ${i.id} ${i.status}${l}${c}${u}`,o,s),ok:!1}}async function h(e,n,r){let{runOpenApiCall:i}=await import(`./openapi-call-Bd2wUhXk.js`),{isTransientRefusal:a,isTransportFailure:o}=await import(`./request-replay-YRTbFgOM.js`),{retrySeconds:c}=await import(`./response-problem-AEFJPORJ.js`),l=n-Date.now();if(l<=0)return{kind:`deadline`};let u=AbortSignal.timeout(Math.min(s,l)),d;try{d=await i({method:`GET`,path:e,auth:`auto`,responseFormat:`json`,signal:u})}catch(e){if(o(e)||u.aborted&&e instanceof Error&&e.cause instanceof Error&&e.cause.name===`AbortError`&&e.cause.cause===u.reason)return{kind:`transient`,reason:String(e)};throw e}if(!d.ok){let{problem:n}=d;if(n!==void 0&&a(n.status,n)){let e=c(n.retryAfterSeconds);return{kind:`transient`,reason:d.summary,...e===void 0?{}:{retryAfterSeconds:e}}}return{kind:`refused`,envelope:t(`GET ${e} failed: ${d.summary}`,d.warnings,{problem:n})}}let f=d.data,p=r.safeParse(typeof f==`object`&&f&&`response`in f?f.response:void 0);return p.success?{kind:`detail`,detail:p.data}:{kind:`refused`,envelope:t(`${e} returned an unexpected body: ${p.error.message}`)}}export{u as registerBuiltinRunWaitCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./commander-DEj7N1b9.js";import{a as t,n,r,t as i}from"./package-DEeHDoOT.js";import{c as a,r as o}from"./result-envelope-Cqvvr4zX.js";import{n as s}from"./output-
|
|
1
|
+
import{n as e}from"./commander-DEj7N1b9.js";import{a as t,n,r,t as i}from"./package-DEeHDoOT.js";import{c as a,r as o}from"./result-envelope-Cqvvr4zX.js";import{n as s}from"./output-B8HawMKY.js";import{a as c,t as l}from"./output-mode-CcdLzXLi.js";import{t as u}from"./completion-setup-CwJt88xW.js";import{spawnSync as d}from"node:child_process";import{basename as f,dirname as p,relative as m,resolve as h,sep as g}from"node:path";import{existsSync as _,lstatSync as v,mkdirSync as y,mkdtempSync as b,readdirSync as x,readlinkSync as S,realpathSync as C,renameSync as w,symlinkSync as T}from"node:fs";import{randomUUID as E}from"node:crypto";var D=new Intl.Collator(void 0,{numeric:!0}),O=2e4,k=[`lib`,`aventurevc-releases`];function A(n,r=t()){let i=r.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;l(n.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${i}`].join(`
|
|
2
2
|
`)).addOption(new e(`--execute`).hideHelp()).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>s({mode:c(e)},j(void 0,`apply`,e.release)))}function j(e,i=`apply`,s){let c=e;try{c??=t(process.argv[1])}catch(e){return o(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let l=c.name,u=c.version,d=c.registry===``?``:n,p=c.registry===``&&l===`@aventurevc/aventure-cli`,m=s;if(m===void 0){let e=M([`view`,d,`version`,`--silent`,`--global`],c,{timeout:O});if(!e.ok)return{...e,data:null};if(m=(e.data??``).trim(),m===``)return o(`npm view ${d} returned empty version`,[`empty_stdout`])}let g=s!==void 0||p||D.compare(u,m)<0,v={targetPackage:d,runningPackage:l,currentVersion:u,latestVersion:m,upgradeAvailable:g,upgradeInstalled:!1};if(i===`check`)return a(`${l}@${u} → ${d}@${m} (${g?`available`:`up to date`})`,v);if(c.workingTreeRoot!==null)return o(`Refusing to install over the working-tree build at ${c.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=F(c),t=h(e,...k),n=f(d),i=h(t,`${n}-current`),o=d===``?[d,``]:[d,r],l=I(e,c),p=s??[m,l?.version??u].reduce((e,t)=>D.compare(e,t)<0?t:e,u);y(t,{recursive:!0});let g=[P(c),..._(i)?[C(i)]:[],...x(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>h(t,e.name))],S,w=null,T=!1;for(let t of new Set(g.filter(t=>t!==e))){let e=N(t,o,p,c.registry);if(e.ok&&e.data!==null){S=t,w=e.data;break}}if(S===void 0){S=b(h(t,`${n}-${encodeURIComponent(p)}-`));let e=M([`install`,`-g`,`--prefix`,S,...o.map(e=>`${e}@${p}`)],c,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};T=!0;let r=N(S,o,p,c.registry);if(!r.ok)return{...r,data:null};w=r.data}if(w===null)throw Error(`release verification produced no package`);let E=L(S,e,i,w,s),O=z();return a(`${d} active at ${E}`,{...v,upgradeInstalled:T||s!==void 0||l?.version!==E,installPrefix:e,verifiedVersion:E,completionRefreshed:O.refreshed,completionRefreshMessage:O.message})}catch(e){return o(`${d} update failed: ${R(e)}`,[`existing releases were preserved`])}}function M(e,t,n={}){let r={...process.env};t.registry===``?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let i=t.registry;if(t.registry===``){let e=d(`npm`,[`config`,`get`,`@aventurevc:registry`,`--global`],{env:r,encoding:`utf8`});if(e.error||e.status!==0){let t=e.error?.message??(e.stderr??``).trim();return o(`npm config get @aventurevc:registry exited ${e.status}`,[t||`no stderr`])}let t=e.stdout.trim().replace(/\/?$/,`/`);t.startsWith(`https://`)&&t!==`https://registry.npmjs.org/`&&(i=t)}let s=[...e,`--@aventurevc:registry=${i}`],c=d(`npm`,s,{env:r,encoding:`utf8`,...n});if(c.error)return c.signal===`SIGTERM`&&n.timeout!==void 0?o(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):o(`npm ${e[0]??``} failed to start: ${c.error.message}`,[`spawn_error`]);if(c.status!==0){let t=(c.stderr??``).trim().split(`
|
|
3
3
|
`).slice(-3).join(` | `);return o(`npm ${e.join(` `)} exited ${c.status}`,[t||`no stderr`])}return a(`npm ok`,c.stdout??``)}function N(e,n,r,i){try{let o=n.map(n=>{let a=t(h(e,`lib`,`node_modules`,...n.split(`/`),`package.json`));if(a.name!==n||a.version!==r||a.registry!==i)throw Error(`${n} does not match ${r} from ${i}`);for(let t of a.bin)if(!C(h(e,`bin`,t)).startsWith(`${a.packageRoot}${g}`))throw Error(`${t} escapes ${a.packageRoot}`);return a});for(let t of o){let n=h(e,`bin`,t.bin[0]),i=d(process.execPath,[n,`--version`],{encoding:`utf8`,timeout:O});if(i.error)throw Error(`${t.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==r)throw Error(`${t.name} expected ${r} but reported ${a||`empty output`}`)}return a(`CLI and MCP release verified`,o)}catch(t){return o(`release verification failed: ${R(t)}`,[`release prefix: ${e}`])}}function P(e){let t=p(e.packageRoot),n=p(t),r=p(n);if(f(t)!==e.name.split(`/`)[0]||f(n)!==`node_modules`||f(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${g}`))throw Error(`the running entry escapes its package root`);return p(r)}function F(e){let t=P(e),n=`${g}${k.join(g)}${g}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function I(e,n){let r=n.registry===``?f(``):i,a=h(e,`bin`,r);if(!_(a))return null;let o=t(a);if(o.registry!==n.registry)throw Error(`${a} belongs to another product`);return o}function L(e,n,r,i,a){let o=i[0];if(o===void 0)throw Error(`release contains no CLI`);let s=h(n,`bin`);y(s,{recursive:!0});let c=i.flatMap(e=>e.bin.filter((e,n)=>{let r=h(s,e);if(!_(r)||t(r).registry===o.registry)return!0;if(o.registry!==``&&n>0)return!1;throw Error(`${r} belongs to another product`)}));if(!_(r)){let t=b(h(p(r),`${f(r)}-seed-`));y(h(t,`bin`));for(let n of c){let r=h(s,n);T(C(_(r)?r:h(e,`bin`,n)),h(t,`bin`,n))}try{T(m(p(r),t),r)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!v(r).isSymbolicLink())throw Error(`${r} is not a release symlink`);for(let e of c){let t=m(s,h(r,`bin`,e)),n=h(s,`.${e}-${E()}`);T(t,n),w(n,h(s,e))}for(let e of c){let t=h(s,e);if(!v(t).isSymbolicLink()||h(s,S(t))!==h(r,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let l=I(n,o);if(a===void 0&&l!==null&&D.compare(l.version,o.version)>0)return l.version;let u=`${r}-${E()}`;return T(m(p(r),e),u),w(u,r),o.version}function R(e){return e instanceof Error?e.message:String(e)}function z(){try{return u()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}export{A as registerBuiltinUpdateCommand,j as runUpdate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./tool-policy-
|
|
1
|
+
import{f as e}from"./tool-policy-BmDEaARa.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}export{t as a,s as c,n as i,l as n,i as o,u as r,a as s,c as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./package-DEeHDoOT.js";import{t}from"./openapi-commands-
|
|
1
|
+
import{a as e}from"./package-DEeHDoOT.js";import{t}from"./openapi-commands-LRER_hsQ.js";import{n,r}from"./completion-setup-CwJt88xW.js";import{o as i}from"./generated-option-order-BNFSLEDZ.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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./commander-DEj7N1b9.js";import{c as t}from"./tool-policy-
|
|
1
|
+
import{n as e}from"./commander-DEj7N1b9.js";import{c as t}from"./tool-policy-BmDEaARa.js";import{a as n,i as r}from"./cli-help-policy-BX-whN-w.js";import{n as i,t as a}from"./contract-parameter-BsYdHniz.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{security:t,parameter:n,projection:r,response:a,...o}=e,s=n.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})})}),u=e.requestBody?.map(t=>{let n=l(e,s,t),r=c(t.cliConflicts,n),i=r.length===0?{}:{cliConflicts:r};return Object.assign({},t,{parameter:n},i)}),f=a.find(({status:e})=>e.startsWith(`2`)),p=f?.schemaName?.replace(/Schema$/,``);return Object.assign(o,{cliPath:r.cliPath,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:u,scope:r.scope,auth:r.auth,visibility:r.visibility,mutates:r.mutates,selfCredential:r.selfCredential,successResponse:p,detailField:f?.detailField,header:f?.header,parameters:s})})}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=n(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:r(i.description,s),schemaType:i.schemaType,schemaFormat:i.schemaFormat,itemSchemaType:i.itemSchemaType,nullable:i.nullable,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./tool-policy-
|
|
1
|
+
import"./tool-policy-BmDEaARa.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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e}from"./package-DEeHDoOT.js";import{n as t,t as n}from"./auth-resolver-
|
|
1
|
+
import{a as e}from"./package-DEeHDoOT.js";import{n as t,t as n}from"./auth-resolver-BnK4x1vt.js";import{o as r}from"./logging-D7Z7a3sv.js";import{i}from"./api-target-vxev2RKl.js";import{t as a}from"./credential-redaction-_zj2uH10.js";import{execFile as o}from"node:child_process";import{dirname as s,join as c}from"node:path";import{stderr as l}from"node:process";import{platform as u}from"node:os";import{chmod as d,mkdir as f,readFile as p,rename as m,rm as h,stat as g,writeFile as _}from"node:fs/promises";import{AsyncLocalStorage as v}from"node:async_hooks";import{setTimeout as y}from"node:timers/promises";import{randomUUID as b}from"node:crypto";var x=2;function S(e,t,n){let r=e.state===`opened`;return!r&&!l.isTTY?!1:(l.write([r?`Browser approval opened for this request.`:`Browser not opened automatically (${e.reason}).`,...l.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(`
|
|
2
2
|
`)),!0)}function C(e,t){return E(e,t).redactedUrl}async function w(e,t,n){let r=E(e,t);return await T(new URL(r.openerUrl),n)}async function T(e,t){let n=t.environment??process.env,r=t.operatingSystem??u(),i=D(t.noBrowser,n,r);if(i!==null)return{state:`skipped`,reason:i};let a=O(r,e.toString());if(a===null)return{state:`failed`,reason:`unsupported browser-opening platform: ${r}`};try{return await k(a.command,a.arguments),{state:`opened`,reason:null}}catch{return{state:`failed`,reason:`browser opener failed`}}}function E(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!==x||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 D(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 O(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 k(e,t){return new Promise((n,r)=>{o(e,[...t],{timeout:5e3,windowsHide:!0},e=>e?r(e):n())})}var A=100,j=3e4,M=6e4,N=new v;function P(){return c(s(n()),`credentials.json`)}function F(){let e=u();return e===`linux`||e===`freebsd`?D(!1,process.env,e):null}function I(e){let t=`${P()} (mode 0600)`;if(e!==void 0)return`OS keyring is unusable (${e}); the credential will be stored in ${t}.\n`;let n=F();return n===null?null:`${n}: the credential will be stored in ${t}; no OS keyring is needed.\n`}async function L(e,t){let n=(await G())[e]?.[t];if(n!==void 0)return{record:{provider:`file`,value:n}};if(F()!==null)return{};try{let n=await(await W(e,t)).getPassword()??void 0;return n===void 0?{}:{record:{provider:`keyring`,value:n}}}catch(e){return{keyringFailure:U(e)}}}async function R(e,t,n){if((await G())[e]?.[t]!==void 0)return await z(e,t,n,`file store holds this account`);let r=F();if(r!==null)return await z(e,t,n,`not used (${r})`);let i;try{let r=await W(e,t);if(await r.setPassword(n),await r.getPassword()===n)return await J(e,t,void 0),`keyring`;i=`Error: keyring readback did not match`}catch(e){i=U(e,[n])}return await z(e,t,n,i)}async function z(e,t,n,r){if(await J(e,t,n),(await G())[e]?.[t]!==n)throw Error(`credential storage did not confirm a durable write (keyring: ${r}; file: readback did not match)`);return`file`}async function B(e,t){if(F()!==null)await J(e,t,void 0);else try{let n=await W(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 (${U(r??e)})`,{cause:e})}if(i!==void 0)throw Error(`OS keyring did not confirm removal (${U(r)})`,r===void 0?void 0:{cause:r})}finally{await J(e,t,void 0)}}async function V(e,t){let n=`${t}:probe:${b()}`,r=`aventure-cli-credential-probe:${b()}`,i=F();if(i!==null)return await H(e,n,r,`not used (${i})`),{provider:`file`};let a;try{let t=await W(e,n);await t.setPassword(r);let i=await(await W(e,n)).getPassword(),o=await t.deleteCredential(),s=await(await W(e,n)).getPassword()??void 0;if(i!==r)a=`Error: probe readback did not match`;else if(!o||s!==void 0)a=`Error: probe cleanup was not confirmed`;else return{provider:`keyring`}}catch(e){a=U(e,[r])}return await H(e,n,r,a),{provider:`file`,keyringFailure:a}}async function H(e,t,n,r){try{await q(async()=>{await J(e,t,n);let r=(await G())[e]?.[t];if(await J(e,t,void 0),r!==n)throw Error(`probe readback did not match`)})}catch(e){throw Error(`credential storage is unavailable (keyring: ${r}; file ${P()}: ${U(e,[n])})`,{cause:e})}}function U(e,t=[]){if(!(e instanceof Error))return`Error`;let n=e.name||`Error`,[r=``]=a(e,t).trim().split(`
|
|
3
3
|
`,1);return r&&r!==n?`${n}: ${r}`:n}async function W(e,t){let{AsyncEntry:n}=await import(`@napi-rs/keyring`);return new n(e,t)}async function G(){let e=P(),n;try{n=await p(e,`utf8`)}catch(e){if(t(e,`ENOENT`))return{};throw e}let r;try{r=JSON.parse(n)}catch(t){return await K(e,t)}return X(r)?r:await K(e,void 0)}async function K(n,i){let a=`${n}.corrupt-${new Date().toISOString().replace(/[:.]/gu,`-`)}`;try{await m(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 q(e){if(N.getStore()===!0)return await e();let n=`${P()}.lock`;await f(s(n),{recursive:!0,mode:448});let r=Date.now()+j,i=b();for(;;){try{await _(n,i,{flag:`wx`,mode:384});break}catch(e){if(!t(e,`EEXIST`))throw e}if(await g(n).then(e=>Date.now()-e.mtimeMs,()=>0)>M)await h(n,{force:!0});else if(Date.now()>r)throw Error(`credential store is locked by another CLI process (${n})`);else await y(A)}try{return await N.run(!0,e)}finally{await p(n,`utf8`).catch(()=>``)===i&&await h(n,{force:!0})}}async function J(e,t,n){await q(async()=>await Y(e,t,n))}async function Y(e,t,n){let r=P(),i=await G(),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 h(r,{force:!0});return}await f(s(r),{recursive:!0,mode:448});let o=`${r}.${b()}.tmp`;await _(o,`${JSON.stringify(i,null,2)}\n`,{mode:384}),await d(o,384),await m(o,r)}function X(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{q as a,w as c,L as i,S as l,I as n,R as o,V as r,T as s,B as t,C as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,r as t}from"./result-envelope-Cqvvr4zX.js";var n=[`localhost`,`127.0.0.1`,`0.0.0.0`,`[::1]`];function r(e){let t=e.trim().toLowerCase().replace(/^https?:\/\//,``).split(`/`)[0]??``;return n.some(e=>t===e||t.startsWith(`${e}:`))}function i(e){let t=e.host.trim();return/^https?:\/\//i.test(t)?t===e.host?e:{...e,host:t}:{...e,host:`${r(t)?`http`:`https`}://${t}`}}var a={authToken:`AUTH_TOKEN`},o=[a.authToken],s=`production`,c={production:{host:`api.aventure.vc`},local:{host:`localhost:8080`}},l=`https://${c.production.host}`,u=`https://aventure.vc`,d=11e4;function f(){let e=Number(process.env.AVENTURE_API_REQUEST_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:d}function p(){return{host:x(process.env.API_URL)??y(process.env.API_ENV)?.host??h(),userBearerToken:process.env[a.authToken]}}function m(){let e=p().host,t=r(e)?null:v(process.env.API_ENV);return(t===null?void 0:c[t]?.host)??e}function h(){let e=c[s]?.host;if(e===void 0)throw Error(`Default API environment is unavailable`);return e}function g(e){if(!e.userBearerToken)throw Error(r(e.host)?`For a loopback API, set ${a.authToken} to a user API key issued by the Clerk instance serving that API`:`Sign in with \`auth login\`, or set ${a.authToken} to an aVenture API key from ${u}/settings/api-keys`);return{Authorization:`Bearer ${e.userBearerToken}`}}function _(){return Object.keys(c)}function v(e){let t=e?.trim().toLowerCase();if(!t)return null;switch(t){case`stage`:case`staging`:return`staging`;case`prod`:case`production`:return`production`;case`dev`:case`development`:case`localhost`:case`local`:return`local`;default:return null}}function y(e){let t=v(e);if(t===null){if(!e?.trim())return null;throw Error(`Unknown aVenture environment '${e}'. Use one of: ${_().join(`, `)}`)}let n=c[t];if(n===void 0)throw Error(`Environment '${t}' is unavailable in this distribution`);return n}function b(n){try{let t=p();return e(`env ready`,n===`none`?{env:t,headers:{},credential:null}:{env:t,headers:g(t),credential:a.authToken})}catch(e){return t(e.message)}}function x(...e){return e.find(e=>e!==void 0&&e.trim().length>0)}export{l as a,h as c,b as d,m as f,i as h,d as i,_ as l,f as m,o as n,u as o,p,s as r,g as s,a as t,v as u};
|