@aventurevc/aventure-cli 0.8.254 → 0.8.255
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/command-catalog.compact.txt +6 -0
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +97 -2
- package/dist/chunks/{api-key-bearer-credential-DitK9J4l.js → api-key-bearer-credential-AL5N9Phe.js} +1 -1
- package/dist/chunks/{api-key-bearer-credential-CeqGMGUj.js → api-key-bearer-credential-BhmPAVXA.js} +1 -1
- package/dist/chunks/{api-key-credential-siUm8MbG.js → api-key-credential-DEvmxVwz.js} +1 -1
- package/dist/chunks/{api-key-credential-vvWy77PP.js → api-key-credential-Dw0P1YbH.js} +1 -1
- package/dist/chunks/{api-key-credential-verification-H62JgQzf.js → api-key-credential-verification-DokhiwbQ.js} +1 -1
- package/dist/chunks/{api-key-credential-verification-DsYOxZzl.js → api-key-credential-verification-RQS313I_.js} +1 -1
- package/dist/chunks/{api-key-login-BNbv8lvs.js → api-key-login-DM_dS-Qm.js} +1 -1
- package/dist/chunks/auth-resolver-BtCY4bS9.js +1 -0
- package/dist/chunks/{auth-resolver-BZnvwRYV.js → auth-resolver-DaWOD1kY.js} +1 -1
- package/dist/chunks/{auth-status-render-CRpIm2k_.js → auth-status-render-D0Cn0OCZ.js} +1 -1
- package/dist/chunks/{aventure-cli-CkAP6Lq1.js → aventure-cli-BfVU9goq.js} +4 -4
- package/dist/chunks/{batch-io-DwCs11Cs.js → batch-io-DtNypwHh.js} +1 -1
- package/dist/chunks/{builtin-auth-Bk5-6knW.js → builtin-auth-Bw2VWw8a.js} +5 -5
- package/dist/chunks/{builtin-research-run-wait-B873mDeZ.js → builtin-research-run-wait-DobIPz5h.js} +1 -1
- package/dist/chunks/{builtin-update-CibUspFi.js → builtin-update-BXnny7XB.js} +1 -1
- package/dist/chunks/{cli-help-policy-DqhqmGy6.js → cli-help-policy-D75ZUdf2.js} +1 -1
- package/dist/chunks/{completion-BRNoLxCY.js → completion-BX0pcAoH.js} +1 -1
- package/dist/chunks/{contract-hr8hYSYY.js → contract-CfjULX4P.js} +1 -1
- package/dist/chunks/{contract-parameter-BpXUlkAc.js → contract-parameter-C5WL9JLH.js} +1 -1
- package/dist/chunks/credential-redaction-Dr4XN0Sl.js +1 -0
- package/dist/chunks/{credential-store-oDS6Ljg6.js → credential-store-0wT6wFF7.js} +1 -1
- package/dist/chunks/{env-DkY3Y9un.js → env-nHz2oAQs.js} +1 -1
- package/dist/chunks/{generated-option-order-PkK7Nqf9.js → generated-option-order-BaSooj4F.js} +1 -1
- package/dist/chunks/{help-catalog-B0YjaI4l.js → help-catalog-DZtXa25V.js} +1 -1
- package/dist/chunks/{help-intent-BvE6-dhF.js → help-intent-CSl8KDQi.js} +1 -1
- package/dist/chunks/{logging-xHHDq7oy.js → logging-CIPYkDwy.js} +1 -1
- package/dist/chunks/{logging-BHStBlRY.js → logging-CUuXaGTb.js} +1 -1
- package/dist/chunks/logout-BF--2rxf.js +1 -0
- package/dist/chunks/{logout-CY4XycA_.js → logout-D6SXc26H.js} +1 -1
- package/dist/chunks/{mcp-generation-contract-CDj4KVSh.js → mcp-generation-contract-CmvJXks6.js} +1 -1
- package/dist/chunks/mcp-generation-contract-CoAJ2HRe.js +1 -0
- package/dist/chunks/oauth-bearer-credential-1zRarbEI.js +1 -0
- package/dist/chunks/oauth-bearer-credential-QuJrc72M.js +1 -0
- package/dist/chunks/{oauth-credential-DDL6IoxT.js → oauth-credential-BeDAE5CS.js} +1 -1
- package/dist/chunks/{oauth-credential-Csq3k6n-.js → oauth-credential-DD0ptlS9.js} +1 -1
- package/dist/chunks/oauth-login-BWOz4fIm.js +6 -0
- package/dist/chunks/{oauth-login-BVJ1jlB7.js → oauth-login-DU5UWOIH.js} +1 -1
- package/dist/chunks/{openapi-call-vXMYJ4rp.js → openapi-call-BDiEG9bL.js} +1 -1
- package/dist/chunks/{openapi-call-onUa4_XP.js → openapi-call-DEoVB4wk.js} +2 -2
- package/dist/chunks/{openapi-commands-Cu4LaS5t.js → openapi-commands-CifJQoI2.js} +1 -1
- package/dist/chunks/openapi-commands-gRHbvPjQ.js +1 -0
- package/dist/chunks/openapi-snapshot-BUZVvD_j.js +1 -0
- package/dist/chunks/{operations-gCxnw0fR.js → operations-C5DL5JhU.js} +2 -2
- package/dist/chunks/operations-catalog-B-MYPCxX.js +1 -0
- package/dist/chunks/{operations-catalog-BBvMvyip.js → operations-catalog-mQswNltE.js} +1 -1
- package/dist/chunks/{operations-metadata-Cl4ljvMh.js → operations-metadata-DdYd95yO.js} +1 -1
- package/dist/chunks/{output-BNsJwKjV.js → output-Dcm50Eug.js} +1 -1
- package/dist/chunks/output-mode-A_gbLqqo.js +1 -0
- package/dist/chunks/{output-mode-4Zx7vQdo.js → output-mode-DsofUHIa.js} +1 -1
- package/dist/chunks/{output-spill-47fJeaYF.js → output-spill-BECjt_Ll.js} +1 -1
- package/dist/chunks/{output-ChmKGsi2.js → output-vOa56eh-.js} +1 -1
- package/dist/chunks/{parse-error-hint-kBF6tV9n.js → parse-error-hint-CiFoBmYs.js} +1 -1
- package/dist/chunks/{payload-operand-guard-CyTIRlHI.js → payload-operand-guard-BwggGDk0.js} +1 -1
- package/dist/chunks/{request-replay-DuIkS7e0.js → request-replay-C-Fy5fd4.js} +1 -1
- package/dist/chunks/{request-replay-kffKzn4K.js → request-replay-D_z6rn-x.js} +1 -1
- package/dist/chunks/response-problem-CKX7pkpN.js +1 -0
- package/dist/chunks/{response-problem-OS9qUie6.js → response-problem-DnkS9_OS.js} +1 -1
- package/dist/chunks/result-envelope-Z0CGA1XZ.js +1 -0
- package/dist/chunks/run-Db_Ap1DI.js +1 -0
- package/dist/chunks/run-detail-CIBpS8hz.js +1 -0
- package/dist/chunks/{startup-auth-TNv7amTB.js → startup-auth-BgiL9byp.js} +1 -1
- package/dist/chunks/{startup-auth-BSB1_DOA.js → startup-auth-DHpDI6aM.js} +1 -1
- package/dist/chunks/{text-response-DNxHSgev.js → text-response-2T5C2aIF.js} +10 -10
- package/dist/chunks/{tool-policy-N1GnmPTD.js → tool-policy-k1J17TTM.js} +1 -1
- package/package.json +3 -3
- package/dist/chunks/auth-resolver-DwREvsD3.js +0 -1
- package/dist/chunks/credential-redaction-NdF6Jh5X.js +0 -1
- package/dist/chunks/logout-D1RUOp1j.js +0 -1
- package/dist/chunks/mcp-generation-contract-HxxeiFNq.js +0 -1
- package/dist/chunks/oauth-bearer-credential-Cvma35gS.js +0 -1
- package/dist/chunks/oauth-bearer-credential-Cw2K2FR0.js +0 -1
- package/dist/chunks/oauth-login-Drr0EGnf.js +0 -6
- package/dist/chunks/openapi-commands-Dh1HN24o.js +0 -1
- package/dist/chunks/openapi-snapshot-CeQBqRo6.js +0 -1
- package/dist/chunks/operations-catalog-CZENTccq.js +0 -1
- package/dist/chunks/output-mode-LQvvksb2.js +0 -1
- package/dist/chunks/response-problem-BWfKIfzo.js +0 -1
- package/dist/chunks/result-envelope-CQD_hylH.js +0 -1
- package/dist/chunks/run-detail-TzF_MGxB.js +0 -1
|
@@ -24,6 +24,7 @@ aventure people lookup-batch · Look Up People in Bulk by ID or Slug · -
|
|
|
24
24
|
aventure people search · Search People · -
|
|
25
25
|
aventure research-runs create · Research a Company or Person by URL · --url
|
|
26
26
|
aventure research-runs get · Get One Research Run · --run-id
|
|
27
|
+
aventure research-runs list · List Your Research Runs · -
|
|
27
28
|
aventure resolve get · Deprecated: Resolve an Entity or Person by Identifier Token · --token
|
|
28
29
|
aventure search link · Search From a Page URL · --url
|
|
29
30
|
aventure unique-ids lookup · Look Up an Identifier Owner · --id-type --identifier
|
|
@@ -125,7 +126,10 @@ aventure people unique-ids get · Get One Person Identifier · --person-id --uni
|
|
|
125
126
|
aventure people unique-ids list · List a Person's Identifiers · --person-id
|
|
126
127
|
aventure people urls get · Get One Person URL · --person-id --url-id
|
|
127
128
|
aventure people urls list · List Person URLs · --person-id
|
|
129
|
+
aventure research-runs draft get · Get a Research Run Draft · --run-id
|
|
130
|
+
aventure research-runs events list · Read a Research Run's Events · --run-id
|
|
128
131
|
aventure research-runs presets list · List Research Presets · -
|
|
132
|
+
aventure research-runs turns create · Continue a Research Session · --run-id
|
|
129
133
|
aventure search natural entities · Find Companies, Startups, and Investors in Natural Language · --query
|
|
130
134
|
aventure search natural people · Find People With Natural Language · --query
|
|
131
135
|
aventure search shared create · Share a Search Answer · -
|
|
@@ -150,6 +154,8 @@ aventure entities texts types list · List the Accepted Company Text Types · -
|
|
|
150
154
|
aventure news subscriptions test-events send · Send a Test News Event · --subscription-id
|
|
151
155
|
aventure people content facets list · Count a Person's Publications · --person-id
|
|
152
156
|
aventure people texts types list · List the Accepted Person Text Types · -
|
|
157
|
+
aventure research-runs draft sections put · Edit a Research Draft Section · --run-id --section-key --expected-version --key --origin --title
|
|
158
|
+
aventure research-runs draft sources get · Get a Research Draft's Sources · --run-id
|
|
153
159
|
aventure search link jobs get · Get a Link Search Job · --job-id
|
|
154
160
|
aventure search shared slug get · Read a Shared Search by Slug · --record-slug
|
|
155
161
|
aventure web searches jobs get · Get an Async Web Search Job · --job-id
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{enableCompileCache as e}from"node:module";import{fileURLToPath as t}from"node:url";e();var{Command:n,CommanderError:r}=await import(`../chunks/commander-D8IVfzyC.js`),{readRuntimePackage:i}=await import(`../chunks/package-DxrXjUBK.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-COBUpkxY.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-
|
|
2
|
+
import{enableCompileCache as e}from"node:module";import{fileURLToPath as t}from"node:url";e();var{Command:n,CommanderError:r}=await import(`../chunks/commander-D8IVfzyC.js`),{readRuntimePackage:i}=await import(`../chunks/package-DxrXjUBK.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-COBUpkxY.js`),o=process.argv.slice(2);try{if(a(),o.length===1&&(o[0]===`--version`||o[0]===`-V`))await new n().exitOverride().version(i(t(import.meta.url)).version).parseAsync();else{let{logWarn:e,setStderrLogging:t}=await import(`../chunks/logging-CUuXaGTb.js`),{cliMachineOutputSelected:n}=await import(`../chunks/output-mode-A_gbLqqo.js`),{commandAuthMaterializationMode:r,materializeCommandCredential:a}=await import(`../chunks/startup-auth-BgiL9byp.js`),{GENERATED_OPENAPI_COMMAND_SPECS:s}=await import(`../chunks/openapi-commands-CifJQoI2.js`);if(n(o)&&t(!1),o.includes(`--all-fields`)){let{setTextAllFields:e}=await import(`../chunks/text-field-BDYE-wQt.js`);e(!0)}let c=r(o,s);if(c===`stored`||c===`optional`)try{await a(c)}catch(t){e({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-BfVU9goq.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,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-10-
|
|
5
|
-
"totalOperations":
|
|
4
|
+
"generatedAt": "2026-10-26T07:17:27.544Z",
|
|
5
|
+
"totalOperations": 143,
|
|
6
6
|
"note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
|
|
7
7
|
"operations": [
|
|
8
8
|
{
|
|
@@ -2294,6 +2294,24 @@
|
|
|
2294
2294
|
"scope": "read",
|
|
2295
2295
|
"destructive": false
|
|
2296
2296
|
},
|
|
2297
|
+
{
|
|
2298
|
+
"operationId": "listResearchRuns",
|
|
2299
|
+
"method": "GET",
|
|
2300
|
+
"path": "/v1/research-runs",
|
|
2301
|
+
"resource": "research-runs",
|
|
2302
|
+
"intent": "read",
|
|
2303
|
+
"cliCommand": "research-runs list",
|
|
2304
|
+
"cliPath": [
|
|
2305
|
+
"research-runs",
|
|
2306
|
+
"list"
|
|
2307
|
+
],
|
|
2308
|
+
"mcpTool": "aventure_read",
|
|
2309
|
+
"bodySchemaName": null,
|
|
2310
|
+
"bodySchemaImport": null,
|
|
2311
|
+
"auth": "bearer",
|
|
2312
|
+
"scope": "read",
|
|
2313
|
+
"destructive": false
|
|
2314
|
+
},
|
|
2297
2315
|
{
|
|
2298
2316
|
"operationId": "createResearchRun",
|
|
2299
2317
|
"method": "POST",
|
|
@@ -2330,6 +2348,83 @@
|
|
|
2330
2348
|
"scope": "read",
|
|
2331
2349
|
"destructive": false
|
|
2332
2350
|
},
|
|
2351
|
+
{
|
|
2352
|
+
"operationId": "getResearchRunDraft",
|
|
2353
|
+
"method": "GET",
|
|
2354
|
+
"path": "/v1/research-runs/{runId}/draft",
|
|
2355
|
+
"resource": "research-runs",
|
|
2356
|
+
"intent": "read",
|
|
2357
|
+
"cliCommand": "research-runs draft get",
|
|
2358
|
+
"cliPath": [
|
|
2359
|
+
"research-runs",
|
|
2360
|
+
"draft",
|
|
2361
|
+
"get"
|
|
2362
|
+
],
|
|
2363
|
+
"mcpTool": "aventure_read",
|
|
2364
|
+
"bodySchemaName": null,
|
|
2365
|
+
"bodySchemaImport": null,
|
|
2366
|
+
"auth": "bearer",
|
|
2367
|
+
"scope": "read",
|
|
2368
|
+
"destructive": false
|
|
2369
|
+
},
|
|
2370
|
+
{
|
|
2371
|
+
"operationId": "getResearchRunDraftSources",
|
|
2372
|
+
"method": "GET",
|
|
2373
|
+
"path": "/v1/research-runs/{runId}/draft/sources",
|
|
2374
|
+
"resource": "research-runs",
|
|
2375
|
+
"intent": "read",
|
|
2376
|
+
"cliCommand": "research-runs draft sources get",
|
|
2377
|
+
"cliPath": [
|
|
2378
|
+
"research-runs",
|
|
2379
|
+
"draft",
|
|
2380
|
+
"sources",
|
|
2381
|
+
"get"
|
|
2382
|
+
],
|
|
2383
|
+
"mcpTool": "aventure_read",
|
|
2384
|
+
"bodySchemaName": null,
|
|
2385
|
+
"bodySchemaImport": null,
|
|
2386
|
+
"auth": "bearer",
|
|
2387
|
+
"scope": "read",
|
|
2388
|
+
"destructive": false
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
"operationId": "listResearchRunEvents",
|
|
2392
|
+
"method": "GET",
|
|
2393
|
+
"path": "/v1/research-runs/{runId}/events",
|
|
2394
|
+
"resource": "research-runs",
|
|
2395
|
+
"intent": "read",
|
|
2396
|
+
"cliCommand": "research-runs events list",
|
|
2397
|
+
"cliPath": [
|
|
2398
|
+
"research-runs",
|
|
2399
|
+
"events",
|
|
2400
|
+
"list"
|
|
2401
|
+
],
|
|
2402
|
+
"mcpTool": "aventure_read",
|
|
2403
|
+
"bodySchemaName": null,
|
|
2404
|
+
"bodySchemaImport": null,
|
|
2405
|
+
"auth": "bearer",
|
|
2406
|
+
"scope": "read",
|
|
2407
|
+
"destructive": false
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
"operationId": "createResearchRunTurn",
|
|
2411
|
+
"method": "POST",
|
|
2412
|
+
"path": "/v1/research-runs/{runId}/turns",
|
|
2413
|
+
"resource": "research-runs",
|
|
2414
|
+
"intent": "job",
|
|
2415
|
+
"cliCommand": "research-runs turns create",
|
|
2416
|
+
"cliPath": [
|
|
2417
|
+
"research-runs",
|
|
2418
|
+
"turns",
|
|
2419
|
+
"create"
|
|
2420
|
+
],
|
|
2421
|
+
"mcpTool": "aventure_job",
|
|
2422
|
+
"bodySchemaName": "HarnessRunTurnSchema",
|
|
2423
|
+
"bodySchemaImport": "@aventurevc/api-schemas/harness/run-turn",
|
|
2424
|
+
"auth": "bearer",
|
|
2425
|
+
"scope": "read",
|
|
2426
|
+
"destructive": false
|
|
2427
|
+
},
|
|
2333
2428
|
{
|
|
2334
2429
|
"operationId": "listResearchRunPresets",
|
|
2335
2430
|
"method": "GET",
|
package/dist/chunks/{api-key-bearer-credential-DitK9J4l.js → api-key-bearer-credential-AL5N9Phe.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-
|
|
1
|
+
export{t as materializeCliApiKeyBearerCredential}from"./api-key-bearer-credential-BhmPAVXA.js";
|
package/dist/chunks/{api-key-bearer-credential-CeqGMGUj.js → api-key-bearer-credential-BhmPAVXA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./package-CZBWjlYb.js";import{f as t,t as n}from"./env-
|
|
1
|
+
import{a as e}from"./package-CZBWjlYb.js";import{f as t,t as n}from"./env-nHz2oAQs.js";import{o as r,r as i}from"./logging-CIPYkDwy.js";import{a}from"./credential-redaction-Dr4XN0Sl.js";import{r as o}from"./api-key-credential-DEvmxVwz.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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{S as e,_ as t,i as n,n as r,s as i}from"./iso-l1vOidnb.js";import{a,t as o}from"./credential-redaction-
|
|
1
|
+
import{S as e,_ as t,i as n,n as r,s as i}from"./iso-l1vOidnb.js";import{a,t as o}from"./credential-redaction-Dr4XN0Sl.js";import{i as s,o as c,r as l,t as u}from"./credential-store-0wT6wFF7.js";var d=t({createdAt:r({offset:!0}),description:e().nullish(),expiresAt:r({offset:!0}).nullish(),id:e().regex(/^ak_[0-9A-Fa-f]{32}$/),lastUsedAt:r({offset:!0}).nullish(),name:e(),revocationReason:e().nullish(),scopes:i(e()),status:n([`ACTIVE`,`REVOKED`,`EXPIRED`]),subject:e(),updatedAt:r({offset:!0})}),f=`vc.aventure.aventure-cli`,p=`aventure-cli-personal-v1`;async function m(e,t,n){let r=a(e),i=y(t,n),s;try{s=await c(f,r,i)}catch(e){throw Error(`${o(e,[i,t.secret])}; broker acknowledgment was withheld. Re-run auth status before retrying.`,{cause:e})}return{host:r,provider:s,activation:n,credential:t}}async function h(e){let t=a(e),n;try{n=await s(f,t)}catch(e){return v(o(e))}let{record:r,keyringFailure:i}=n;return r===void 0?i===void 0?{state:`missing`}:{state:`missing`,keyringFailure:i}:{state:`found`,stored:{host:t,provider:r.provider,...b(r.value)}}}async function g(e){let t=await h(e);if(t.state!==`missing`)return t;try{let{keyringFailure:t}=await l(f,a(e));return t===void 0?{state:`missing`}:{state:`missing`,keyringFailure:t}}catch(e){return v(o(e))}}async function _(e){await u(f,a(e))}function v(e){return{state:`unavailable`,summary:e,cause:`storage`}}function y(e,t){return`${p}:${t}\n${JSON.stringify(e.apiKey)}\n${e.secret}`}function b(e){let t=e.indexOf(`
|
|
2
2
|
`),n=t<0?-1:e.indexOf(`
|
|
3
3
|
`,t+1),r=t<0?e:e.slice(0,t),i=r===`${p}:active`?`active`:`pending`;if(t<0||n<0||r!==`${p}:pending`&&r!==`${p}:active`)throw Error(`OS credential entry has an unsupported format`);let a=e.slice(n+1);if(a.length===0)throw Error(`OS credential entry has an empty secret`);let o;try{o=JSON.parse(e.slice(t+1,n))}catch(e){throw Error(`OS credential entry failed canonical schema validation`,{cause:e})}let s=d.safeParse(o);if(!s.success)throw Error(`OS credential entry failed canonical schema validation`,{cause:s.error});return{activation:i,credential:{apiKey:s.data,secret:a}}}export{d as a,m as i,g as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{n as inspectApiKeyCredentialStorage}from"./api-key-credential-
|
|
1
|
+
export{n as inspectApiKeyCredentialStorage}from"./api-key-credential-DEvmxVwz.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as refreshStoredApiKeyCredential}from"./api-key-credential-verification-
|
|
1
|
+
export{t as refreshStoredApiKeyCredential}from"./api-key-credential-verification-RQS313I_.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./env-
|
|
1
|
+
import{f as e}from"./env-nHz2oAQs.js";import{c as t,r as n}from"./openapi-call-DEoVB4wk.js";import{n as r,s as i,t as a}from"./credential-redaction-Dr4XN0Sl.js";import{a as o,i as s}from"./api-key-credential-DEvmxVwz.js";async function c(e){let t=await l(e.credential.secret);if(t.state!==`verified`||e.activation!==`active`)return{stored:e,verification:t};try{return{stored:await s(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`),verification:t}}catch(n){return{stored:e,verification:{state:`unavailable`,summary:`${t.summary}, but the cached metadata could not be updated — ${a(n,[e.credential.secret])}`}}}}async function l(s){let c=i(e()),l;try{l=await t(c,{method:`GET`,path:n(`getCurrentApiKey`,{}),headers:{Authorization:`Bearer ${s}`}},o)}catch(e){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${a(e,[s])}`}}return l.ok&&l.redirect?{state:`unavailable`,summary:`identity verification returned unexpected redirect ${l.status}`}:l.ok?l.data.status===`ACTIVE`?{state:`verified`,summary:`API key verified by aVenture sign-in`,apiKey:l.data}:{state:`invalid`,summary:`API key is not active`}:{state:l.problem.status===401||l.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${r(l.problem,[s])}`}}export{l as n,c as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./package-CZBWjlYb.js";import{A as t,E as n,S as r,_ as i,g as a,i as o,n as s}from"./iso-l1vOidnb.js";import{f as c}from"./env-DkY3Y9un.js";import{c as l,r as u}from"./result-envelope-CQD_hylH.js";import{z as d}from"./tool-policy-N1GnmPTD.js";import{c as f,u as p}from"./openapi-call-onUa4_XP.js";import{i as m}from"./response-problem-OS9qUie6.js";import{a as h,n as g,r as _,s as v,t as y}from"./credential-redaction-NdF6Jh5X.js";import{i as b,n as x,t as ee}from"./api-key-credential-siUm8MbG.js";import{c as te,l as ne,n as S}from"./credential-store-oDS6Ljg6.js";import{n as C}from"./api-key-credential-verification-DsYOxZzl.js";import{n as w}from"./contract-hr8hYSYY.js";import{t as T}from"./openapi-composites-B9JPhVYN.js";import{n as re}from"./logout-CY4XycA_.js";import{stderr as E,stdin as ie}from"node:process";import{TextDecoder as ae,inspect as oe}from"node:util";import{hostname as se,platform as ce}from"node:os";import{setTimeout as le}from"node:timers/promises";import{webcrypto as D}from"node:crypto";var O=o([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),k=o([`RSA_OAEP_256_A256_GCM_V1`]),A=i({clientLabel:r().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:O.nullish(),encryptionAlgorithm:k.nullish(),encryptionPublicKey:r().min(344).max(12e3).nullish()}),j=32;async function ue(){let e=await D.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await D.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function de(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=M(n,`wrapped key`,128,1024),s=M(r,`nonce`,12,12),c=M(i,`ciphertext`,1,65536),l=M(a,`authentication tag`,16,16),u;try{u=await D.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==j)throw Error(`broker credential used an invalid AES-256 key`);let e=await D.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await D.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new ae(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function M(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var N=o([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),P=o([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),F=i({approvedAt:s({offset:!0}).nullish(),clientLabel:r(),clientPlatform:O,comparisonCode:r(),consumedAt:s({offset:!0}).nullish(),createdAt:s({offset:!0}),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),keyReadyAt:s({offset:!0}).nullish(),status:N,terminalAt:s({offset:!0}).nullish(),terminalReason:P.nullish(),updatedAt:s({offset:!0})}),I=i({algorithm:k,authenticationTag:r(),ciphertext:r(),nonce:r(),wrappedKey:r()}),L=i({delivery:I.nullish(),expiresAt:s({offset:!0}),status:N,terminalReason:P.nullish()}),R=i({comparisonCode:r(),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),pollSecret:r(),verificationUrl:r()}),z=w(T,`start`),B=w(T,`poll`),V=w(T,`acknowledge`),H=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${g(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=he(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},U=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${y(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function fe(e){let t=await f(v(c()),{method:z.method,path:d(z.path,{},z.operationId),headers:{},contentType:`application/json`,body:e},R);if(t.ok&&t.redirect)throw new H(`start`,G(t.status));if(!t.ok)throw new H(`start`,t.problem);return ge(t.data)}async function W(e,t){let n=p(B.operationId),r=await f(v(c()),{method:B.method,path:d(B.path,{cliAuthorizationId:e},B.operationId),headers:{[n]:t}},L);if(r.ok&&r.redirect)throw new H(`poll`,G(r.status),[t]);if(!r.ok)throw new H(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:me(r.headers[`retry-after`])}}async function pe(e,t){let n=p(V.operationId),r;try{r=await f(v(c()),{method:V.method,path:d(V.path,{cliAuthorizationId:e},V.operationId),headers:{[n]:t}},F)}catch(e){throw new U(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new H(`acknowledge`,G(r.status),[t]);if(!r.ok)throw new H(`acknowledge`,r.problem,[t]);return r.data}function me(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function he(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function G(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ge(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[oe.custom]:{enumerable:!1,value:a}})}var K=`RSA_OAEP_256_A256_GCM_V1`,_e=1,ve=30,q=e().bin[0],J=`The local record remains pending and unavailable to ordinary commands. Re-run \`${q} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function ye(e){if(!ie.isTTY)return u(`${q} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let n,r;try{let e=c().host;n=h(e),r=_(e)}catch(e){return u(`auth login --key: invalid environment configuration — ${y(e)}`)}for(;;){let e;try{e=await x(n)}catch(e){return u(`auth login --key: credential storage could not be inspected — ${y(e)}`)}if(e.state===`unavailable`)return u(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&E.write(S(e.keyringFailure));break}let t=await be(e.stored);if(t!==null)return t}let i;try{i=await ue()}catch(e){return u(`auth login --key: ephemeral encryption key could not be created — ${y(e)}`)}let a=A.safeParse({clientLabel:e.clientLabel?.trim()||(se().trim()||q).slice(0,120),clientPlatform:we(),encryptionAlgorithm:K,encryptionPublicKey:i.publicKey});if(!a.success)return u(`auth login --key: ${t(a.error)}`);let o;try{o=await fe(a.data)}catch(e){return u(`auth login --key: could not start browser authorization — ${y(e)}`)}let s;try{s=ne(o,r)}catch(e){return u(`auth login --key: unsafe browser authorization URL rejected — ${y(e)}`)}if(!Ce(await te(o,r,{noBrowser:e.noBrowser}),o,s))return u(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[s]});let d;try{d=await Se(o)}catch(e){return u(`auth login --key: authorization did not complete — ${y(e)}`,[],{references:[s]})}if(d.algorithm!==K)return u(`auth login --key: broker selected an unsupported encryption algorithm`);let f;try{f=await de(i.privateKey,d)}catch(e){return u(`auth login --key: encrypted credential could not be opened — ${y(e)}`)}let p=await C(f);if(p.state!==`verified`)return u(`auth login --key: decrypted credential was neither stored nor acknowledged — ${p.summary}`);let m;try{m=await b(n,{apiKey:p.apiKey,secret:f},`pending`)}catch(e){return u(`auth login --key: credential could not be durably stored — ${y(e)}`)}let g;try{g=await xe(o)}catch(e){return Q(m,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${y(e,[o.pollSecret])}`,J)}if(g.status!==`CONSUMED`)return Q(m,!0,`auth login --key: broker returned ${g.status} after acknowledgment`,J);let v=await C(f);if(v.state!==`verified`||!$(v.apiKey,m.credential.apiKey))return Q(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${v.summary}`,J);try{let e=await b(n,{apiKey:v.apiKey,secret:f},`active`);return l(`API key stored; authenticated identity and broker acknowledgment verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return Q(m,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${y(e)}`,J)}}async function be(e){let t=await C(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?l(`API key is already stored and its authenticated identity was verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]}):Q(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${q} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&$(t.apiKey,e.credential.apiKey))try{let n=await b(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return l(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,Z(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return Q(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${y(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${q} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return Q(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${q} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await re(e);if(n.outcome===`unconfirmed`)return Q(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await ee(e.host)}catch(t){return Q(e,!1,`auth login --key: stale pending credential could not be removed — ${y(t,[e.credential.secret])}`)}return E.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
|
|
1
|
+
import{a as e}from"./package-CZBWjlYb.js";import{A as t,E as n,S as r,_ as i,g as a,i as o,n as s}from"./iso-l1vOidnb.js";import{f as c}from"./env-nHz2oAQs.js";import{c as l,r as u}from"./result-envelope-Z0CGA1XZ.js";import{z as d}from"./tool-policy-k1J17TTM.js";import{c as f,u as p}from"./openapi-call-DEoVB4wk.js";import{i as m}from"./response-problem-DnkS9_OS.js";import{a as h,n as g,r as _,s as v,t as y}from"./credential-redaction-Dr4XN0Sl.js";import{i as b,n as x,t as ee}from"./api-key-credential-DEvmxVwz.js";import{c as te,l as ne,n as S}from"./credential-store-0wT6wFF7.js";import{n as C}from"./api-key-credential-verification-RQS313I_.js";import{n as w}from"./contract-CfjULX4P.js";import{t as T}from"./openapi-composites-B9JPhVYN.js";import{n as re}from"./logout-D6SXc26H.js";import{stderr as E,stdin as ie}from"node:process";import{TextDecoder as ae,inspect as oe}from"node:util";import{hostname as se,platform as ce}from"node:os";import{setTimeout as le}from"node:timers/promises";import{webcrypto as D}from"node:crypto";var O=o([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),k=o([`RSA_OAEP_256_A256_GCM_V1`]),A=i({clientLabel:r().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:O.nullish(),encryptionAlgorithm:k.nullish(),encryptionPublicKey:r().min(344).max(12e3).nullish()}),j=32;async function ue(){let e=await D.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await D.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function de(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=M(n,`wrapped key`,128,1024),s=M(r,`nonce`,12,12),c=M(i,`ciphertext`,1,65536),l=M(a,`authentication tag`,16,16),u;try{u=await D.subtle.decrypt({name:`RSA-OAEP`},e,o)}catch{throw Error(`broker credential key could not be decrypted`)}let d=new Uint8Array(u);try{if(d.byteLength!==j)throw Error(`broker credential used an invalid AES-256 key`);let e=await D.subtle.importKey(`raw`,d,{name:`AES-GCM`},!1,[`decrypt`]),t=new Uint8Array(c.byteLength+l.byteLength);t.set(c),t.set(l,c.byteLength);let n;try{n=await D.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new ae(`utf-8`,{fatal:!0}).decode(n);if(r.trim().length===0)throw Error(`broker returned a blank credential`);return r}finally{d.fill(0)}}function M(e,t,n,r){let i=e.replace(/=+$/u,``),a=Uint8Array.from(Buffer.from(e,`base64`)),o=Buffer.from(a).toString(`base64`).replace(/=+$/u,``);if(i.length===0||o!==i||a.byteLength<n||a.byteLength>r)throw Error(`broker returned an invalid ${t}`);return a}var N=o([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),P=o([`Denied by user`,`Authorization request expired`,`CLI authorization expired before acknowledgement`,`Credential issuance recovery revoked an unrecoverable key`,`Revoked by user`,`Clerk create response validation failed`,`Credential issuance failed`,`Credential issuance could not be recovered`,`API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),F=i({approvedAt:s({offset:!0}).nullish(),clientLabel:r(),clientPlatform:O,comparisonCode:r(),consumedAt:s({offset:!0}).nullish(),createdAt:s({offset:!0}),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),keyReadyAt:s({offset:!0}).nullish(),status:N,terminalAt:s({offset:!0}).nullish(),terminalReason:P.nullish(),updatedAt:s({offset:!0})}),I=i({algorithm:k,authenticationTag:r(),ciphertext:r(),nonce:r(),wrappedKey:r()}),L=i({delivery:I.nullish(),expiresAt:s({offset:!0}),status:N,terminalReason:P.nullish()}),R=i({comparisonCode:r(),expiresAt:s({offset:!0}),id:n(),intervalSeconds:a().int().min(1),pollSecret:r(),verificationUrl:r()}),z=w(T,`start`),B=w(T,`poll`),V=w(T,`acknowledge`),H=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${g(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=he(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},U=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${y(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function fe(e){let t=await f(v(c()),{method:z.method,path:d(z.path,{},z.operationId),headers:{},contentType:`application/json`,body:e},R);if(t.ok&&t.redirect)throw new H(`start`,G(t.status));if(!t.ok)throw new H(`start`,t.problem);return ge(t.data)}async function W(e,t){let n=p(B.operationId),r=await f(v(c()),{method:B.method,path:d(B.path,{cliAuthorizationId:e},B.operationId),headers:{[n]:t}},L);if(r.ok&&r.redirect)throw new H(`poll`,G(r.status),[t]);if(!r.ok)throw new H(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:me(r.headers[`retry-after`])}}async function pe(e,t){let n=p(V.operationId),r;try{r=await f(v(c()),{method:V.method,path:d(V.path,{cliAuthorizationId:e},V.operationId),headers:{[n]:t}},F)}catch(e){throw new U(`acknowledge`,e,[t])}if(r.ok&&r.redirect)throw new H(`acknowledge`,G(r.status),[t]);if(!r.ok)throw new H(`acknowledge`,r.problem,[t]);return r.data}function me(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function he(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function G(e){return{status:e,title:`Unexpected redirect`,type:`about:blank`,code:void 0,detail:`CLI authorization endpoint returned an unexpected redirect`}}function ge(e){let{verificationUrl:t,pollSecret:n,...r}=e,i={...e},a=()=>({...r,verificationUrl:`<redacted>`,pollSecret:`<redacted>`});return Object.defineProperties(i,{verificationUrl:{enumerable:!1,get:()=>t},pollSecret:{enumerable:!1,get:()=>n},toJSON:{enumerable:!1,value:a},toString:{enumerable:!1,value:()=>`CliAuthorizationStart(${JSON.stringify(a())})`},[oe.custom]:{enumerable:!1,value:a}})}var K=`RSA_OAEP_256_A256_GCM_V1`,_e=1,ve=30,q=e().bin[0],J=`The local record remains pending and unavailable to ordinary commands. Re-run \`${q} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function ye(e){if(!ie.isTTY)return u(`${q} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject AUTH_TOKEN through the environment.`]);let n,r;try{let e=c().host;n=h(e),r=_(e)}catch(e){return u(`auth login --key: invalid environment configuration — ${y(e)}`)}for(;;){let e;try{e=await x(n)}catch(e){return u(`auth login --key: credential storage could not be inspected — ${y(e)}`)}if(e.state===`unavailable`)return u(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&E.write(S(e.keyringFailure));break}let t=await be(e.stored);if(t!==null)return t}let i;try{i=await ue()}catch(e){return u(`auth login --key: ephemeral encryption key could not be created — ${y(e)}`)}let a=A.safeParse({clientLabel:e.clientLabel?.trim()||(se().trim()||q).slice(0,120),clientPlatform:we(),encryptionAlgorithm:K,encryptionPublicKey:i.publicKey});if(!a.success)return u(`auth login --key: ${t(a.error)}`);let o;try{o=await fe(a.data)}catch(e){return u(`auth login --key: could not start browser authorization — ${y(e)}`)}let s;try{s=ne(o,r)}catch(e){return u(`auth login --key: unsafe browser authorization URL rejected — ${y(e)}`)}if(!Ce(await te(o,r,{noBrowser:e.noBrowser}),o,s))return u(`auth login --key: browser authorization requires an interactive terminal for manual handoff`,[`Automatic browser opening did not complete, and the approval URL was withheld because stderr is not an interactive terminal. Retry from an interactive terminal.`],{references:[s]});let d;try{d=await Se(o)}catch(e){return u(`auth login --key: authorization did not complete — ${y(e)}`,[],{references:[s]})}if(d.algorithm!==K)return u(`auth login --key: broker selected an unsupported encryption algorithm`);let f;try{f=await de(i.privateKey,d)}catch(e){return u(`auth login --key: encrypted credential could not be opened — ${y(e)}`)}let p=await C(f);if(p.state!==`verified`)return u(`auth login --key: decrypted credential was neither stored nor acknowledged — ${p.summary}`);let m;try{m=await b(n,{apiKey:p.apiKey,secret:f},`pending`)}catch(e){return u(`auth login --key: credential could not be durably stored — ${y(e)}`)}let g;try{g=await xe(o)}catch(e){return Q(m,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${y(e,[o.pollSecret])}`,J)}if(g.status!==`CONSUMED`)return Q(m,!0,`auth login --key: broker returned ${g.status} after acknowledgment`,J);let v=await C(f);if(v.state!==`verified`||!$(v.apiKey,m.credential.apiKey))return Q(m,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${v.summary}`,J);try{let e=await b(n,{apiKey:v.apiKey,secret:f},`active`);return l(`API key stored; authenticated identity and broker acknowledgment verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return Q(m,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${y(e)}`,J)}}async function be(e){let t=await C(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?l(`API key is already stored and its authenticated identity was verified.`,Z(e,!0),{ids:[e.credential.apiKey.id]}):Q(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${q} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&$(t.apiKey,e.credential.apiKey))try{let n=await b(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return l(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,Z(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return Q(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${y(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${q} auth login --key\` to retry local activation; it will recover the pending credential automatically.`)}if(t.state===`unavailable`||t.state===`verified`&&!e.credential.apiKey.expiresAt)return Q(e,t.state===`verified`,`auth login --key: the stored pending credential acknowledgment could not be verified — ${t.summary}`,t.state===`verified`?`The stored expiry is missing. Both records were preserved; inspect the existing key in your account before deciding how to recover it.`:`The stored record and the remote key were both preserved. Re-run \`${q} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await re(e);if(n.outcome===`unconfirmed`)return Q(e,!1,`auth login --key: a prior credential is durably stored but broker acknowledgment was not confirmed`,`Remote revocation of the stale pending key was not confirmed — ${n.summary}. Retry when the API is reachable.`);try{await ee(e.host)}catch(t){return Q(e,!1,`auth login --key: stale pending credential could not be removed — ${y(t,[e.credential.secret])}`)}return E.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
|
|
2
2
|
`:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
|
|
3
3
|
`),null}async function xe(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds);for(;;)try{return await pe(e.id,e.pollSecret)}catch(e){if(e instanceof H){if(!e.retryable)throw e;n=Y(e.retryAfterSeconds??n)}else if(!(e instanceof U))throw e;if(Date.now()>=t)throw e;E.write(`Broker acknowledgment was interrupted; retrying.
|
|
4
4
|
`),await X(n,t)}}async function Se(e){let t=new Date(e.expiresAt).getTime(),n=Y(e.intervalSeconds),r;for(E.write(`Waiting for browser approval...
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{r as resolveAuthStatus}from"./auth-resolver-DaWOD1kY.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./env-
|
|
1
|
+
import{t as e}from"./env-nHz2oAQs.js";import{join as t}from"node:path";import{homedir as n,platform as r}from"node:os";function i(){if(r()===`win32`){let e=process.env.APPDATA??t(n(),`AppData`,`Roaming`);return t(e,`aventure`,`config.json`)}let e=process.env.XDG_CONFIG_HOME??t(n(),`.config`);return t(e,`aventure`,`config.json`)}function a(){let t=process.env[e.authToken];return typeof t==`string`&&t.length>0?{present:!0,source:`env`}:{present:!1,source:null}}function o(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}export{o as n,a as r,i as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./private-live-identity-AuYLZJvL.js";import{f as t,t as n}from"./env-
|
|
1
|
+
import{t as e}from"./private-live-identity-AuYLZJvL.js";import{f as t,t as n}from"./env-nHz2oAQs.js";import{r}from"./auth-resolver-DaWOD1kY.js";import{a as i,l as a}from"./openapi-call-DEoVB4wk.js";import{a as o,i as s}from"./response-problem-DnkS9_OS.js";import{t as c}from"./credential-redaction-Dr4XN0Sl.js";import{t as l}from"./api-key-bearer-credential-BhmPAVXA.js";import{a as u,f as d,l as f,s as p}from"./oauth-credential-BeDAE5CS.js";import{t as m}from"./oauth-bearer-credential-1zRarbEI.js";async function h(e){let t=null,n=e=>{t=e};try{await m(e,n),await l(n)}catch(e){return{materialized:t,failure:c(e)}}return{materialized:t,failure:null}}async function g(t,n,r,a){if(a.failure!==null)return{scope:t,selected:null,identity:null,authorization:null,error:a.failure};let o=null,s=null,l,u=e=>{l=e,s=_(e.credential,a.materialized)};try{let n=await i({method:`POST`,path:`/v1/auth/me/permissions`,body:{operation:[]},auth:t,requesterScope:t,responseFormat:`json`,onAuthPrepared:u});if(!n.ok)throw Error(v(n));if(s===null)throw Error(`Live permission probe did not prepare a credential`);if(o=S(n.data),t===`read`)return{scope:t,selected:s,identity:null,authorization:o,error:null};if(l===void 0)throw Error(`Live permission probe did not retain its prepared credential`);let r=await e(t,l);return{scope:t,selected:s,identity:r,authorization:o,error:null}}catch(e){return{scope:t,selected:s,identity:null,authorization:o,error:c(e,y(n,r,l))}}}function _(e,t){if(e===null)return null;let n=t??r().source;if(n===null)throw Error(`Prepared credential has no local provenance`);return{credential:e,source:n}}function v(e){return[e.summary,...e.warnings].join(` — `)}function y(e,n,r){return[t().userBearerToken,...o(r?.headers??{}),...e.state===`found`?d(e.stored.credential.tokens):[],n.state===`found`?n.stored.credential.secret:void 0]}function b(e,t,n=null){let r=t.state===`found`?t.stored:void 0,i=r?.credential.apiKey.expiresAt??null;return{host:e,present:r!==void 0,provider:r?.provider??null,activation:r?.activation??null,apiKeyId:r?.credential.apiKey.id??null,subject:r?.credential.apiKey.subject??null,scope:r?.credential.apiKey.scopes??[],name:r===void 0?null:s(r.credential.apiKey.name,[r.credential.secret]),status:r?.credential.apiKey.status??null,expiresAt:i,metadataSource:r===void 0?null:n?.state===`verified`?`clerk`:`store-cache`,live:n===null?null:{state:n.state,summary:n.summary},expiresInDay:T(i),storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function x(e,t){let n=t.state===`found`?t.stored:void 0;return{host:e,present:n!==void 0,provider:n?.provider??null,expiresAt:n?.credential.expiresAt??null,expired:n===void 0?null:u(n.credential),renewable:n===void 0?null:n.credential.tokens.refresh_token!==void 0,identity:n===void 0?null:f(n.credential),client:n?.credential.client??null,storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}function S(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)throw Error(`permission probe returned no JSON response`);let t=a.safeParse(e.response);if(!t.success)throw t.error;return t.data}function C(e,t){let{expiresAt:n,expiresInDay:r}=b(e,t);return n!==null&&r!==null&&new Date(n).getTime()<=Date.now()?` (cached expiry passed ${Math.abs(r)}d ago; \`auth status\` re-checks it with aVenture sign-in)`:``}var w=864e5;function T(e){if(e===null)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:Math.round((t-Date.now())/w)}var E=7;function D(e){return e===null?`none`:e.length<=11?e:`${e.slice(0,E)}\u2026${e.slice(-4)}`}var O=13,k=14;function A(e){return[``,`${e.cliName} ${e.cliVersion} \u2192 ${e.apiKey.host}`+(e.apiVersion===null?` (api build unavailable)`:` (api ${e.apiVersion})`),``,...P(e.oauth,e.cliName,e.refresh),...I(e.apiKey,e.oauth,e.cliName),``,M(`Providers`,z(e.providers)),M(`Environment`,B(e.resolved)),M(`Selected`,V(e.resolved,e.refresh,e.cliName)),...j(e.live)].join(`
|
|
2
2
|
`)}function j(e){if(e===null)return[];let t=N(`local credential provenance was captured before verification`);if(e.error!==null)return[``,M(`Live probe`,`${e.scope} permission probe failed`),t,N(e.error)];if(e.authorization===null)return[];let n=e.authorization.permissionGrant,r=e.identity;return[``,M(`Live probe`,`${e.scope} permission probe succeeded`),t,N(`operation access ${e.authorization.operationAccess}; ${n.role.length} role; ${n.permission.length} permission`),...r===null?[N(e.scope===`read`?`identity not requested for a read-scope credential`:`identity unavailable in this build`)]:[M(`Live account`,r.nameFull??r.email??r.clerkUserId??r.id)],N(`no API operation was executed or individually authorized`)]}function M(e,t){return` ${e.padEnd(O)}${t}`}function N(e){return` ${``.padEnd(O)}${e}`}function P(e,t,n){switch(e.state){case`found`:{let{credential:r,provider:i}=e.stored,a=f(r);return[M(`OAuth`,`${a.email??a.subject??`unknown identity`} via ${i}`),N(F(r,t,n))]}case`missing`:return[M(`OAuth`,`none stored`),...e.keyringFailure===void 0?[]:[N(`OS keyring unusable — login stores to file: ${e.keyringFailure}`)]];case`unavailable`:return[M(`OAuth`,`storage unavailable: ${e.summary}`)];case`invalid`:return[M(`OAuth`,`stored credential invalid: ${e.summary}`)];default:throw Error(`Unsupported OAuth credential state`)}}function F(e,t,n){return u(e)?e.tokens.refresh_token===void 0?`access token expired — run \`${t} auth login\``:n.failure===null?n.materialized===`api-key`?`access token expired and renewal failed; the API key is in use — \`${t} auth login\` renews OAuth`:`access token expired — not renewed while AUTH_TOKEN is set in the environment`:`access token expired — ${n.failure}`:`access token valid until ${e.expiresAt}`}function I(e,t,n){if(!e.present){if(t.state===`found`)return[];let r=e.storageFailure??(t.state===`unavailable`?t.summary:null);return r===null?[M(`Signed in`,`no \u2014 run \`${n} auth login\``),...e.error===null?[]:[N(`stored credential invalid: ${e.error}`)]]:[M(`Signed in`,`credential storage unavailable`),N(r)]}return[M(t.state===`found`?`API key`:`Signed in`,e.subject??`unknown subject`),N(`via ${e.provider??`unknown store`}`),M(`Key`,`${e.name??`unnamed`} ${D(e.apiKeyId)}`),...L(e,n),M(`Scopes`,e.scope.length===0?`none`:e.scope.join(`, `))]}function L(e,t){let n=e.live,r=e.expiresInDay,i=e.expiresAt;if(n?.state===`invalid`)return[M(`Key state`,`rejected by aVenture sign-in \u2014 ${n.summary}`),N(`run \`${t} auth logout\`, then \`${t} auth login --key\``)];let a=n?.state===`verified`;return[M(`Key state`,a?`${e.status??`unknown`}, verified by aVenture sign-in now`:`${e.status??`unknown`} when stored`),...i===null||r===null?[N(`no expiry recorded`)]:[N(R(i,r,a?`expires`:`cached expiry`))],...a?[]:[N(n===null?"aVenture sign-in owns the live verdict — `auth status` re-checks it":`aVenture sign-in could not be reached \u2014 ${n.summary}`)]]}function R(e,t,n){let r=e.slice(0,10);return new Date(e).getTime()<=Date.now()?`${n} ${r} passed ${Math.abs(t)}d ago`:t<=k?`${n} ${r}, ${t}d away`:`${n} ${r}`}function z(e){if(e.state===`unavailable`)return`unavailable: ${e.summary}`;let t=e.catalog.oauthClient;return[e.catalog.clerkPublishableKey?`browser sign-in`:`no browser sign-in`,t?`oauth ${p(t).host} client ${t.clientId}`:`no OAuth CLI client`].join(`; `)}function B(e){return`${n.authToken}=${e.present?e.source??`resolved`:`unset`}`}function V(e,t,r){return e.present||t.materialized===`env`?`${n.authToken} from the environment`:t.materialized===`oauth`?`saved OAuth access token`:t.materialized===`api-key`?`saved API key`:`none \u2014 sign in with \`${r} auth login\``}export{b as apiKeyCredentialDiagnostics,C as apiKeyExpiryQualifier,g as inspectLiveAuth,x as oauthCredentialDiagnostics,h as refreshCliCredentials,A as renderAuthStatus,B as summarizeCredential};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./commander-DEj7N1b9.js";import{a}from"./package-CZBWjlYb.js";import{a as o,c as s,l as c,r as l}from"./env-DkY3Y9un.js";import{c as u,f as d,r as f}from"./result-envelope-CQD_hylH.js";import{L as p,R as m,a as h,c as g,t as _,y as v}from"./tool-policy-N1GnmPTD.js";import{i as y}from"./logging-xHHDq7oy.js";import{i as ee,n as te,t as ne}from"./cli-help-policy-DqhqmGy6.js";import{a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as b,r as le,s as ue,t as de,u as fe}from"./startup-auth-BSB1_DOA.js";import{_ as pe,h as me}from"./help-catalog-B0YjaI4l.js";import{n as he,t as ge}from"./operations-metadata-Cl4ljvMh.js";import{t as x}from"./openapi-commands-Dh1HN24o.js";import{i as S,r as C,t as w}from"./output-mode-4Zx7vQdo.js";import{S as _e,_ as T,a as ve,b as E,c as ye,d as be,f as xe,g as D,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as O,x as Ne,y as Pe}from"./generated-option-order-PkK7Nqf9.js";import{a as Fe,i as Ie,n as Le,r as Re}from"./payload-operand-guard-CyTIRlHI.js";import{fileURLToPath as ze}from"node:url";import{readFile as Be}from"node:fs/promises";async function Ve(e){let t;try{t=e===`-`?await He():await Be(e,`utf8`)}catch(t){return f(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return u(`No input provided`,null);let e=JSON.parse(t);return u(`Input parsed`,e)}catch(e){return f(`Input is not valid JSON: ${e.message}`)}}async function He(){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 k=`--content-type`;function Ue(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(k)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${k} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Ge(a)))}if(F(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>`,ve(r,r.requiredPath)).argParser(A(`--from-file`)))}let o=De(a).filter(e=>i(M(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Ee(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Ce(n),a.length>1?ke(n):ye(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Ae(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(We):T(i.name)||i.schemaType===`array`?o.argParser(Ke):o.argParser(A(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`)})}it(e,n,o)}function We(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Ge(e){return(t,r)=>{if(r!==void 0)throw new n(`${k} was already given; pass it once.`);let i=v(e,t);if(!i.ok)throw new n(i.summary);return t}}function Ke(e,t){return[...t??[],e]}function A(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 j(e,t){let n=ue(e,t),r=v(e.requestBody??[],n);if(!r.ok||r.data===null)return f(r.summary,r.warnings);let i=r.data;if(i===void 0)return u(`No body`,void 0);let a=qe(e,i,t);if(a!==null)return f(a);let o=xe(e.operationId,i,t);if(!o.ok)return f(o.summary,o.warnings);t=o.data;let s=Je(i,t);if(s!==null)return f(s);let c=await Qe(t);if(!c.ok)return f(c.summary,c.warnings);let l=Te(e.requestBody??[],i,c.data);if(l!==null)return f(l);let d=Ze(e.operationId,i,c.data);if(!d.ok)return d;let p=Se(e.operationId,i,c.data);if(p!==null)return f(p);let m=$e(e.operationId,i,t);if(!m.ok)return m;if(c.data===void 0&&m.data===void 0)return i.required?f(rt(e.operationId,i)):u(`No body`,void 0);let h=tt(e.operationId,i,c.data,m.data);if(!h.ok||h.data===void 0)return h;if(i.schemaType===`array`&&!Array.isArray(h.data))return f(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!O(h.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return f(`${e.operationId} requires a JSON object${t}.`)}let g=Xe(i,h.data);if(g.length>0)return f(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=O(_)?E(i).filter(e=>!D(_,e)):[];return y.length>0?f(Ye(e.operationId,i,y)):h}function qe(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`${M(t)} requires ${k} ${i.join(` or `)}.`}return null}function Je(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 Ye(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 Xe(e,t){return O(t)?e.parameter.filter(e=>e.required&&!D(t,e.name)).map(M):[]}function Ze(e,t,n){let r=_e(t,n);return r===null?u(`Body file paths validated`,null):f(`${e} --from-file contains ${r.message}`)}async function Qe(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return u(`No body file`,void 0);let n=await Ve(t);if(!n.ok)return f(n.summary,n.warnings);let r=d.safeParse(n.data);return r.success?u(`Input parsed`,r.data):f(`Input is not valid JSON value: ${r.error.message}`)}function $e(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=Ne(e,n[e.optionKey]);if(!a.ok||a.data===null)return f(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=et(t,n,r,e,o);if(!s.ok)return f(s.summary,s.warnings);i=!0}if(!i)return u(`No direct body options`,void 0);let a=we(e,t,n,r);return a===null?u(`Direct body options parsed`,r):a}function et(e,t,n,r,i){let a=Pe(r,i);if(a===null){let e=nt(r,i);return e.ok?Me(n,r.name,e.data,r.schemaType===`array`):f(e.summary,e.warnings)}if(a.plain.length>0)return f(`${M(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=Oe(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return f(`${M(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=P(r.name,r.itemSchemaType,e);if(!t.ok)return f(t.summary,t.warnings);i.push(t.data)}let a=be(n,r.name,e,i);if(!a.ok)return a}return u(`Body value assigned`,null)}var M=e=>e.flag.split(` `)[0]??e.name;function tt(e,t,n,r){if(n===void 0)return u(`Direct body parsed`,r);if(r===void 0)return u(`Input parsed`,n);if(O(n)&&O(r))try{return u(`Input parsed`,N(t,n,r))}catch(t){return f(`${e} ${t instanceof Error?t.message:String(t)}`)}return f(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function N(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(O(n)&&O(a))i[t]=N(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`:me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nt(e,t){if(typeof t==`boolean`)return u(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return P(e.name,e.schemaType,t??``);let n=[],r=T(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=P(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return u(`Body value parsed`,n)}function P(e,t,n){if(t===`boolean`)return n===`true`?u(`Body value parsed`,!0):n===`false`?u(`Body value parsed`,!1):f(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?f(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?f(`${e} must be an integer.`):u(`Body value parsed`,i)}return u(`Body value parsed`,n)}function rt(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(M).join(`, `)}`;let r=E(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(M).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function it(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:k,location:`body`}),F(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),je(e.options,r)}function F(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function at(e,t,n=a().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show full documentation for a command, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help ask <question>` or `help --ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new ot(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()});let i=lt(t);i!==void 0&&r.option(`--ask <question>`,i.summary),w(r),r.action(async function(r){let{emit:a}=await import(`./output-BNsJwKjV.js`),o=this.optsWithGlobals();if(o.help&&r.length===0){this.outputHelp();return}if(!o.help&&i!==void 0&&o.ask!==void 0){let e=S(o);if(r.length>0){a({mode:e},f(`Use either a command path or --ask, not both.`));return}a({mode:e},await dt(i,o.ask,o.environment,e));return}let s=V(e,r),c=t.find(t=>s!==void 0&&V(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let l=c===void 0?await ut(r,t):u(`Resolved by command path`,{operationId:c.operationId});if(l.ok&&l.data?.command!==void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),!l.ok||l.data===null){a({mode:S(o)},l);return}let{writeShowResult:d}=await import(`./operations-catalog-CZENTccq.js`);d({...o,...l.data},t,S(o,`text`),n)}),ct(e,t,n)}var ot=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))}},I=2,L=6,st={formatHelp(e,t){let n=n=>r.prototype.formatHelp.call(this,e,Object.assign(Object.create(t),n));if(t.visibleCommands(e).length===0)return n({});let i=t.padWidth(e,t),a={padWidth:()=>i,visibleOptions:()=>[],showGlobalOptions:!1},o=n({...a,visibleCommands:()=>[]}),s=n({padWidth:()=>i,visibleCommands:()=>[]}).slice(o.length);return n(a)+s},visibleCommands(e){let t=r.prototype.visibleCommands.call(this,e);return e.parent===null?t.filter(e=>!te.has(e.name())):t},subcommandTerm(e){let t=r.prototype.subcommandTerm.call(this,e);return e.commands.length>0&&e.registeredArguments.length===0?`${t} <command>`:t},formatItem(e,t,n,i){let a=i.helpWidth??80,o=a-t-4;return n===``||o>=i.minWidthToWrap?r.prototype.formatItem.call(i,e,t,n,i):`${` `.repeat(I)}${e}\n${R(n,a,i)}`}};function R(e,t,n){return n.boxWrap(e,t-L).replace(/^/gmu,` `.repeat(L))}function ct(e,t,n){for(let r of t){let i=V(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp(),a=i.configureOutput().getOutHelpWidth?.();e.prepareContext(a===void 0?{}:{helpWidth:a});let o=e.helpWidth??80,s=pe(r.operationId,t,n),c=z(he(r.header),o,e),l=z(ge(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
|
|
2
|
-
`)}\n`})}}function z(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>R(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(I)))]}function lt(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&H(e)!==void 0});return n.length===0?t:void 0}var B='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function ut(e,t){let[n=``,...r]=e.join(` `).trim().split(/\s+/u),[i,...a]=t.filter(e=>e.path===n);if(r.length===0&&i!==void 0)return a.length===0?u(`Resolved by route`,{operationId:i.operationId}):f(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[B]);let o=p.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return u(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=m(o),c=r.join(``),l=t.find(e=>e.method===s&&e.path===c);if(l!==void 0)return u(`Resolved by route template`,{operationId:l.operationId});let{resolveOpenApiOperationSelector:d}=await import(`./openapi-call-
|
|
3
|
-
`));let p=ae(t);for(let e of t.parameters)bt(u,e,i||e===p);Ue(u,t),g(t.intent)&&!u.options.some(e=>e.long===`--execute`)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),w(u),u.hook(`preAction`,e=>fe(e,t)),t.explain===!0&&u.option(`--explain`,`Print the search strategy and parsed constraints before the results`),p!==void 0&&u.argument(`[text...]`,p.description||`Same as ${ie(p.flag)}.`),u.action(async function(){let{emit:e,emitSearchExplanation:n}=await import(`./output-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./commander-DEj7N1b9.js";import{a}from"./package-CZBWjlYb.js";import{a as o,c as s,l as c,r as l}from"./env-nHz2oAQs.js";import{c as u,p as d,r as f}from"./result-envelope-Z0CGA1XZ.js";import{L as p,R as m,a as h,c as g,t as _,y as v}from"./tool-policy-k1J17TTM.js";import{i as y}from"./logging-CIPYkDwy.js";import{i as ee,n as te,t as ne}from"./cli-help-policy-D75ZUdf2.js";import{a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as b,r as le,s as ue,t as de,u as fe}from"./startup-auth-DHpDI6aM.js";import{_ as pe,h as me}from"./help-catalog-DZtXa25V.js";import{n as he,t as ge}from"./operations-metadata-DdYd95yO.js";import{t as x}from"./openapi-commands-gRHbvPjQ.js";import{i as S,r as C,t as w}from"./output-mode-DsofUHIa.js";import{S as _e,_ as T,a as ve,b as E,c as ye,d as be,f as xe,g as D,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as O,x as Ne,y as Pe}from"./generated-option-order-BaSooj4F.js";import{a as Fe,i as Ie,n as Le,r as Re}from"./payload-operand-guard-BwggGDk0.js";import{fileURLToPath as ze}from"node:url";import{readFile as Be}from"node:fs/promises";async function Ve(e){let t;try{t=e===`-`?await He():await Be(e,`utf8`)}catch(t){return f(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return u(`No input provided`,null);let e=JSON.parse(t);return u(`Input parsed`,e)}catch(e){return f(`Input is not valid JSON: ${e.message}`)}}async function He(){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 k=`--content-type`;function Ue(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(k)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${k} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Ge(a)))}if(F(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>`,ve(r,r.requiredPath)).argParser(A(`--from-file`)))}let o=De(a).filter(e=>i(M(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>Ee(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Ce(n),a.length>1?ke(n):ye(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Ae(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(We):T(i.name)||i.schemaType===`array`?o.argParser(Ke):o.argParser(A(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`)})}it(e,n,o)}function We(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Ge(e){return(t,r)=>{if(r!==void 0)throw new n(`${k} was already given; pass it once.`);let i=v(e,t);if(!i.ok)throw new n(i.summary);return t}}function Ke(e,t){return[...t??[],e]}function A(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 j(e,t){let n=ue(e,t),r=v(e.requestBody??[],n);if(!r.ok||r.data===null)return f(r.summary,r.warnings);let i=r.data;if(i===void 0)return u(`No body`,void 0);let a=qe(e,i,t);if(a!==null)return f(a);let o=xe(e.operationId,i,t);if(!o.ok)return f(o.summary,o.warnings);t=o.data;let s=Je(i,t);if(s!==null)return f(s);let c=await Qe(t);if(!c.ok)return f(c.summary,c.warnings);let l=Te(e.requestBody??[],i,c.data);if(l!==null)return f(l);let d=Ze(e.operationId,i,c.data);if(!d.ok)return d;let p=Se(e.operationId,i,c.data);if(p!==null)return f(p);let m=$e(e.operationId,i,t);if(!m.ok)return m;if(c.data===void 0&&m.data===void 0)return i.required?f(rt(e.operationId,i)):u(`No body`,void 0);let h=tt(e.operationId,i,c.data,m.data);if(!h.ok||h.data===void 0)return h;if(i.schemaType===`array`&&!Array.isArray(h.data))return f(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!O(h.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return f(`${e.operationId} requires a JSON object${t}.`)}let g=Xe(i,h.data);if(g.length>0)return f(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=O(_)?E(i).filter(e=>!D(_,e)):[];return y.length>0?f(Ye(e.operationId,i,y)):h}function qe(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`${M(t)} requires ${k} ${i.join(` or `)}.`}return null}function Je(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 Ye(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 Xe(e,t){return O(t)?e.parameter.filter(e=>e.required&&!D(t,e.name)).map(M):[]}function Ze(e,t,n){let r=_e(t,n);return r===null?u(`Body file paths validated`,null):f(`${e} --from-file contains ${r.message}`)}async function Qe(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return u(`No body file`,void 0);let n=await Ve(t);if(!n.ok)return f(n.summary,n.warnings);let r=d.safeParse(n.data);return r.success?u(`Input parsed`,r.data):f(`Input is not valid JSON value: ${r.error.message}`)}function $e(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=Ne(e,n[e.optionKey]);if(!a.ok||a.data===null)return f(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=et(t,n,r,e,o);if(!s.ok)return f(s.summary,s.warnings);i=!0}if(!i)return u(`No direct body options`,void 0);let a=we(e,t,n,r);return a===null?u(`Direct body options parsed`,r):a}function et(e,t,n,r,i){let a=Pe(r,i);if(a===null){let e=nt(r,i);return e.ok?Me(n,r.name,e.data,r.schemaType===`array`):f(e.summary,e.warnings)}if(a.plain.length>0)return f(`${M(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=Oe(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return f(`${M(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of a.rows){let i=[];for(let e of t){let t=P(r.name,r.itemSchemaType,e);if(!t.ok)return f(t.summary,t.warnings);i.push(t.data)}let a=be(n,r.name,e,i);if(!a.ok)return a}return u(`Body value assigned`,null)}var M=e=>e.flag.split(` `)[0]??e.name;function tt(e,t,n,r){if(n===void 0)return u(`Direct body parsed`,r);if(r===void 0)return u(`Input parsed`,n);if(O(n)&&O(r))try{return u(`Input parsed`,N(t,n,r))}catch(t){return f(`${e} ${t instanceof Error?t.message:String(t)}`)}return f(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function N(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(O(n)&&O(a))i[t]=N(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`:me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function nt(e,t){if(typeof t==`boolean`)return u(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return P(e.name,e.schemaType,t??``);let n=[],r=T(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=P(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return u(`Body value parsed`,n)}function P(e,t,n){if(t===`boolean`)return n===`true`?u(`Body value parsed`,!0):n===`false`?u(`Body value parsed`,!1):f(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?f(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?f(`${e} must be an integer.`):u(`Body value parsed`,i)}return u(`Body value parsed`,n)}function rt(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(M).join(`, `)}`;let r=E(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(M).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function it(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:k,location:`body`}),F(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),je(e.options,r)}function F(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function at(e,t,n=a().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show full documentation for a command, or ask a question`).description("Show a command's full documentation offline. Select it by command path,\noperationId, or `<METHOD> <path>`; `<command> --help` prints only its usage.\n`help ask <question>` or `help --ask <question>` answers a platform question.").argument(`[command...]`,"command path, operationId, or METHOD and path, e.g. `help entities get`"),r.addOption(new ot(r)),r.hook(`preSubcommand`,e=>{e.opts().help&&e.help()});let i=lt(t);i!==void 0&&r.option(`--ask <question>`,i.summary),w(r),r.action(async function(r){let{emit:a}=await import(`./output-Dcm50Eug.js`),o=this.optsWithGlobals();if(o.help&&r.length===0){this.outputHelp();return}if(!o.help&&i!==void 0&&o.ask!==void 0){let e=S(o);if(r.length>0){a({mode:e},f(`Use either a command path or --ask, not both.`));return}a({mode:e},await dt(i,o.ask,o.environment,e));return}let s=V(e,r),c=t.find(t=>s!==void 0&&V(e,t.cliPath)===s);if(o.help||s!==void 0&&c===void 0){s===void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),s.outputHelp();return}let l=c===void 0?await ut(r,t):u(`Resolved by command path`,{operationId:c.operationId});if(l.ok&&l.data?.command!==void 0&&this.error(`unknown command '${r.join(` `)}' (run \`${n} --help\` for the command tree)`),!l.ok||l.data===null){a({mode:S(o)},l);return}let{writeShowResult:d}=await import(`./operations-catalog-B-MYPCxX.js`);d({...o,...l.data},t,S(o,`text`),n)}),ct(e,t,n)}var ot=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))}},I=2,L=6,st={formatHelp(e,t){let n=n=>r.prototype.formatHelp.call(this,e,Object.assign(Object.create(t),n));if(t.visibleCommands(e).length===0)return n({});let i=t.padWidth(e,t),a={padWidth:()=>i,visibleOptions:()=>[],showGlobalOptions:!1},o=n({...a,visibleCommands:()=>[]}),s=n({padWidth:()=>i,visibleCommands:()=>[]}).slice(o.length);return n(a)+s},visibleCommands(e){let t=r.prototype.visibleCommands.call(this,e);return e.parent===null?t.filter(e=>!te.has(e.name())):t},subcommandTerm(e){let t=r.prototype.subcommandTerm.call(this,e);return e.commands.length>0&&e.registeredArguments.length===0?`${t} <command>`:t},formatItem(e,t,n,i){let a=i.helpWidth??80,o=a-t-4;return n===``||o>=i.minWidthToWrap?r.prototype.formatItem.call(i,e,t,n,i):`${` `.repeat(I)}${e}\n${R(n,a,i)}`}};function R(e,t,n){return n.boxWrap(e,t-L).replace(/^/gmu,` `.repeat(L))}function ct(e,t,n){for(let r of t){let i=V(e,r.cliPath);i!==void 0&&i.addHelpText(`after`,()=>{let e=i.createHelp(),a=i.configureOutput().getOutHelpWidth?.();e.prepareContext(a===void 0?{}:{helpWidth:a});let o=e.helpWidth??80,s=pe(r.operationId,t,n),c=z(he(r.header),o,e),l=z(ge(r.errorResponse),o,e);return`\n${[...s,...c,...l].join(`
|
|
2
|
+
`)}\n`})}}function z(e,t,n){let[r,...i]=e;return r===void 0?[]:[``,r,...i.map(e=>R(e.trimStart(),t,n).replace(/^ +/u,` `.repeat(I)))]}function lt(e){let[t,...n]=e.filter(e=>{let[t,n,...r]=e.cliPath;return t===`help`&&n!==void 0&&r.length===0&&H(e)!==void 0});return n.length===0?t:void 0}var B='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';async function ut(e,t){let[n=``,...r]=e.join(` `).trim().split(/\s+/u),[i,...a]=t.filter(e=>e.path===n);if(r.length===0&&i!==void 0)return a.length===0?u(`Resolved by route`,{operationId:i.operationId}):f(`${n} is served by ${[i,...a].map(({method:e})=>e).join(`, `)}; name the method, as in \`help ${i.method} ${n}\`.`,[B]);let o=p.find(e=>e===n.toLowerCase());if(o===void 0||r.length===0){let n=e.join(` `).trim();return u(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let s=m(o),c=r.join(``),l=t.find(e=>e.method===s&&e.path===c);if(l!==void 0)return u(`Resolved by route template`,{operationId:l.operationId});let{resolveOpenApiOperationSelector:d}=await import(`./openapi-call-BDiEG9bL.js`),h=d({method:s,path:c});return!h.ok||h.data===null?f(h.summary,[...h.warnings,B]):u(`Resolved by method and path`,{operationId:h.data.operation.operationId})}function V(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e||t.aliases().includes(e));if(t===void 0)return;n=t}return n}async function dt(e,t,n,r){let{buildOpenApiPath:i,runOpenApiCall:a}=await import(`./openapi-call-BDiEG9bL.js`),o=H(e);if(o===void 0)return f(`The \`${e.cliPath.join(` `)}\` operation no longer takes a single required text body; run it directly instead of \`help --ask\`.`);n!==void 0&&(process.env.API_ENV=n);let s=await j(e,{[o.optionKey]:t});return s.ok?await a({method:e.method,path:i(e.operationId,{}),searchParams:{},body:s.data,auth:e.auth,responseFormat:C(r)?`json`:`auto`}):s}function H(e){if(e.requestBody?.length!==1||e.parameters.some(e=>e.required))return;let t=(e.requestBody[0]?.parameter??[]).filter(e=>e.required);return t.length===1&&t[0]?.schemaType===`string`?t[0]:void 0}function ft(e,t,n){if(e.cliPath[0]!==`lookup`||!pt(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`),i=`no record for ${r.length===0?`the given input`:r.join(`, `)}`;return n.ok?f(i):f(i,[],{httpStatus:n.httpStatus,problem:n.problem})}function pt(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}function mt(e,t){if(e.deprecated!==!0)return t;let n=e.description.match(/^Deprecated:[^.]*\./u)?.[0]??`Deprecated; run \`help ${e.cliPath.join(` `)}\` for its replacement.`;return{...t,warnings:[n,...t.warnings]}}function ht(t,n,r,i){let a=gt(t),o=a instanceof e?[]:a,s=o[0],c=i.bin[0],l=[{selected:s===`auth`,register:async()=>{let{registerBuiltinAuthCommands:e}=await import(`./builtin-auth-Bw2VWw8a.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-BXnny7XB.js`);e(n,i)}},{selected:s===`batch`,register:async()=>{let{registerBuiltinBatchCommand:e}=await import(`./builtin-batch-DdGyCjlR.js`);e(n,r,c)}},{selected:s===`research-runs`,register:async()=>{let{registerBuiltinResearchRunWaitCommand:e}=await import(`./builtin-research-run-wait-DobIPz5h.js`);e(n)}},{selected:s===`completion`,register:async()=>{let{registerCompletionCommand:e}=await import(`./completion-BX0pcAoH.js`);e(n,r,c)}},{selected:s===`command-catalog`,register:async()=>{let{registerOperationsCommand:e}=await import(`./operations-C5DL5JhU.js`);e(n,r,c)}}],u=s===void 0||s===`help`||s===`completion`||s===`command-catalog`||!l.some(e=>e.selected)&&!r.some(e=>e.cliPath[0]===s),d=1;for(;d<o.length&&r.some(e=>o.slice(0,d+1).every((t,n)=>e.cliPath[n]===t));)d++;let f=o.slice(0,d),p=u?r:r.filter(e=>f.slice(0,e.cliPath.length).every((t,n)=>e.cliPath[n]===t)),m=new Set,h=async(e=!1)=>{for(let t of l)(e||u||t.selected)&&!m.has(t)&&(await t.register(),m.add(t))};return{generated:p,fullTree:u,registerBuiltin:h,async completeTree(e){e(n,r.filter(e=>!p.includes(e))),await h(!0)}}}function gt(n){try{return new i().exitOverride().configureOutput({writeErr:()=>void 0}).addOption(new t(`--environment <environment>`)).parseOptions([...n]).operands}catch(t){if(!(t instanceof e))throw t;return t}}var _t=new Set(x.map(e=>e.cliPath.join(` `)));function U(e,t){e.showHelpAfterError(!1).exitOverride(t(e)),e.commands.length===0?e.hook(`preAction`,Le):e.registeredArguments.length===0&&!_t.has(Fe(e).join(` `))&&e.addHelpOption(new Ie(e));for(let n of e.commands)U(n,t)}var W=a(ze(import.meta.url)),G=W.bin[0];async function K(e,t){let{BearerVerificationUnavailableError:n}=await import(`./openapi-call-BDiEG9bL.js`),{emitJson:r}=await import(`./output-Dcm50Eug.js`),i=e instanceof Error?e:Error(String(e));y({component:G,event:`fatal`,message:i.message,error:i}),process.stderr.write(`${G} fatal (${t}): ${i.stack??i.message}\n`);let a=i instanceof n?{httpStatus:i.problem.status,problem:i.problem}:{};r({...f(`${G} ${t}: ${i.message}`,[i.name||`Error`],a),counts:{exitCode:1}}),process.exit(1)}function q(e){return ne[ee(e,b)??`cli`]}function J(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:q(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=new Set(n.filter(e=>de(e.cliPath[0])).map(e=>e.cliPath[0]??``)),i=new Set,a=new Set;for(let{cliPath:e,deprecated:t}of n)for(let n=1;n<e.length;n++){let r=e.slice(0,n).join(` `);i.add(r),t!==!0&&a.add(r)}for(let t of n)vt(e,t,r,a,i.has(t.cliPath.join(` `)))}function vt(e,t,n,r,i){let a=t.cliPath,o=e,s=``,c=!n.has(a[0]??``);for(let e of a.slice(0,-1)){s=s===``?e:`${s} ${e}`;let t=c&&s===e||!r.has(s);o=yt(o,e,s,t)}let l=a.at(-1)??t.operationId,u=o.commands.find(e=>e.name()===l)??o.command(l,t.deprecated===!0?{hidden:!0}:{}),d=t.requestBody?.flatMap(({parameter:e})=>e)??[];u.summary(t.summary||t.operationId).description([`${t.method} ${t.path}.`,t.summary||t.description,`Full documentation: ${G} help ${t.cliPath.join(` `)}`,t.requestBody?.[0]?.kind===`json`||[...t.parameters,...d].some(e=>h(e.schemaType,e.itemSchemaType))?_:``].filter(Boolean).join(`
|
|
3
|
+
`));let p=ae(t);for(let e of t.parameters)bt(u,e,i||e===p);Ue(u,t),g(t.intent)&&!u.options.some(e=>e.long===`--execute`)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),w(u),u.hook(`preAction`,e=>fe(e,t)),t.explain===!0&&u.option(`--explain`,`Print the search strategy and parsed constraints before the results`),p!==void 0&&u.argument(`[text...]`,p.description||`Same as ${ie(p.flag)}.`),u.action(async function(){let{emit:e,emitSearchExplanation:n}=await import(`./output-Dcm50Eug.js`),r=this.optsWithGlobals(),i=S(r),a=r;if(p!==void 0){let t=oe(p,this.args,r);if(!t.ok||t.data===null)return e({mode:i},t);a=t.data}let o=se(t,a);if(o.length>0)return e({mode:i},f(`missing required options: ${o.join(`, `)}`));let s=await xt(t,a,i),c=ft(t,a,s);if(c!==null)return e({mode:i},c);r.explain===!0&&s.ok&&n(i,s.data),s.ok&&s.data instanceof Uint8Array?process.stdout.write(s.data):e({mode:i},s)})}function yt(e,t,n,r){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=b[n],o=e.command(t,r?{hidden:!0}:{}).helpCommand(!1);return a!==void 0&&o.summary(a.summary).description(a.summary),o}function bt(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 xt(e,t,n){let{buildOpenApiPath:r,runOpenApiCall:i}=await import(`./openapi-call-BDiEG9bL.js`),{pendingResult:a}=await import(`./output-Dcm50Eug.js`);if(t.environment!==void 0){let e=c(t.environment);if(e===null)return f(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${s().join(`, `)}`]);process.env.API_ENV=e}let o=await j(e,t);if(!o.ok)return o;let l=Object.fromEntries(e.parameters.filter(e=>e.location===`path`).map(e=>{let n=t[e.optionKey];if(Array.isArray(n))return[e.name,n.at(0)??``];if(n===void 0)throw Error(`Missing required option ${e.optionKey}`);return[e.name,String(n)]})),u=Object.fromEntries(e.parameters.filter(e=>e.location===`query`).flatMap(e=>{let n=t[e.optionKey];if(n===void 0||Array.isArray(n)&&n.length===0)return[];let r=Array.isArray(n)||typeof n==`boolean`?n:String(n);return[[e.name,r]]})),d=Object.fromEntries(e.parameters.filter(e=>e.location===`header`).flatMap(e=>{let n=t[e.optionKey];return n===void 0||Array.isArray(n)&&n.length===0?[]:[[e.name,Array.isArray(n)?n.join(`,`):String(n)]]}));return mt(e,await i({method:e.method,path:r(e.operationId,l),searchParams:u,headers:d,body:o.data,contentType:ue(e,t),auth:e.auth,responseFormat:C(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0,pendingResult:a}))}var St=e=>{if(e.code!==`EPIPE`)throw e;process.exit(0)};for(let e of[process.stdout,process.stderr])e.on(`error`,St);process.on(`uncaughtException`,e=>K(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>K(e,`unhandledRejection`));var Y=ce(process.argv.slice(2),x),X=Y===`required`?x:re(x),Z=new Re;Z.name(G).usage(`<command> [subcommand] [options]`).configureHelp(st).version(W.version).summary(`CLI for the aVenture API: companies, people, and news, with the funding, publications, and classifications attached to them`).description(`The aVenture research API from your terminal. Three records — companies,
|
|
4
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 tools execute through this same CLI.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${l})`).choices([...s()])).showHelpAfterError(`(run \`${G} --help\` for usage)`);var Q=ht(process.argv.slice(2),Z,X,W);J(Z,Q.generated),await Q.registerBuiltin(),at(Z,X,G);for(let e of Z.commands)e.helpGroup()||e.helpGroup(q(e.name()).heading);var $;if(U(Z,e=>t=>{throw $=(async()=>{!Q.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await Q.completeTree(J);let{commandExitHandler:n}=await import(`./parse-error-hint-
|
|
7
|
+
The aVenture MCP server tools execute through this same CLI.`).addOption(new t(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${l})`).choices([...s()])).showHelpAfterError(`(run \`${G} --help\` for usage)`);var Q=ht(process.argv.slice(2),Z,X,W);J(Z,Q.generated),await Q.registerBuiltin(),at(Z,X,G);for(let e of Z.commands)e.helpGroup()||e.helpGroup(q(e.name()).heading);var $;if(U(Z,e=>t=>{throw $=(async()=>{!Q.fullTree&&![`commander.helpDisplayed`,`commander.version`].includes(t.code)&&await Q.completeTree(J);let{commandExitHandler:n}=await import(`./parse-error-hint-CiFoBmYs.js`);try{n(e)(t)}catch(e){if(e!==t)throw e}})(),t}),Y===`required`){let e=[Z];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&await le(`required`)}))}}var Ct=new Set(Z.commands.filter(e=>[`entities`,`people`,`news`].includes(e.name())).flatMap(e=>e.commands.map(e=>e.name())));Z.addHelpText(`after`,[``,`Record subcommands under entities, people, and news:`,...[[`search`,` search Find many of that record from a plain-English query or a filter`],[`lookup`,` lookup Find one news article; companies and people use the root lookup`],[`get`,` get Read one record`],[`list`,` list Read many records`],[`create`,` create, update, delete Write; each needs a credential that permits it`]].flatMap(([e,t])=>Ct.has(e)?[t]:[]),``,`Authentication (every command that calls aVenture needs a credential):`,` Create one at ${o}/sign-up, then run: ${G} auth login`,` AUTH_TOKEN aVenture API key, for CI and other non-interactive shells`,` Check what this shell holds with: ${G} auth status\n`,`Output modes (per command):`,` --text compact lines, the terminal default; --json the full envelope`,` --data response data as JSON, the default when piped or non-TTY`,` --data-full uncapped, for bounded programs, never LLM agents`,` --all-fields --text plus the detail fields it hides by default
|
|
8
8
|
`,`Exit codes:`,` 0 envelope.ok === true
|
|
9
9
|
1 envelope.ok === false
|
|
10
10
|
`,`Examples:`,` $ ${G} auth login`,` $ ${G} lookup --name Stripe --url https://stripe.com`,` $ ${G} search "fintech companies in Austin"\n`,`Run \`${G} <command> --help\` for its subcommands and options,`,`or \`${G} help <command>\` for its full documentation.`].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./package-CZBWjlYb.js";import{c as e,r as t}from"./result-envelope-
|
|
1
|
+
import"./package-CZBWjlYb.js";import{c as e,r as t}from"./result-envelope-Z0CGA1XZ.js";import"./operations-metadata-DdYd95yO.js";import"node:path";import"node:fs";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-CZBWjlYb.js";import{a as n,f as r,t as i}from"./env-
|
|
2
|
-
`))).action(async function(e){let{emit:t}=await import(`./output-
|
|
3
|
-
`);return u.ok?a(d,u,{counts:c}):{...o(d,l,{counts:c}),data:u}}function b(e,t){return e.filter(e=>e.status===t).length}function x(e,t,n){return{name:e,status:t,message:n}}function S(){return p.find(e=>e.intent===`status`&&e.resource===`status`)}async function C(e){let{runUpdate:n}=await import(`./builtin-update-
|
|
1
|
+
import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-CZBWjlYb.js";import{a as n,f as r,t as i}from"./env-nHz2oAQs.js";import{c as a,r as o}from"./result-envelope-Z0CGA1XZ.js";import{r as s}from"./auth-resolver-DaWOD1kY.js";import{a as c,t as l}from"./credential-redaction-Dr4XN0Sl.js";import{n as u}from"./contract-CfjULX4P.js";import{t as d}from"./openapi-composites-B9JPhVYN.js";import{n as f,t as p}from"./openapi-commands-gRHbvPjQ.js";import{t as m}from"./output-vOa56eh-.js";import{i as h,t as g}from"./output-mode-DsofUHIa.js";var _=[{name:`cli-version`,purpose:`running CLI against the latest published release`},{name:`api-schemas`,purpose:`the installed @aventurevc/api-schemas contracts resolve`},{name:`api-host`,purpose:`the selected API host answers`},{name:`auth`,purpose:`which credential signs in, as which account and role, never secrets`},{name:`catalog`,purpose:`this CLI knows every operation the API serves`}];function v(e,n=t().bin[0]){g(e.command(`doctor`).summary(`One-call selftest: CLI version, schemas, API host, auth scope, command catalog`).description(["Run every environment check in one call and report `{ ok, check: [...] }`:",..._.map(e=>` - ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable) or a`,`warned one (the account read failed) does not fail the run. Each failing message names the command that fixes it.`,"--json always carries the report at `.data`; --data prints the report directly when",`every check passes and the result envelope when one fails, like every other command.`].join(`
|
|
2
|
+
`))).action(async function(e){let{emit:t}=await import(`./output-Dcm50Eug.js`),r=this.optsWithGlobals();r.environment!==void 0&&(process.env.API_ENV=r.environment),t({mode:h(e)},await y(n))})}async function y(e){let t=S(),n=await C(e),[r,i]=await Promise.all([w(e),T(t,e)]),s=[n.check,r,i.check,await D(e),P(t,i.servedFingerprint,n.upgradeAvailable,e)],c={pass:b(s,`pass`),warn:b(s,`warn`),fail:b(s,`fail`),skip:b(s,`skip`)},l=s.filter(e=>e.status===`fail`).map(e=>e.message),u={ok:l.length===0,check:s},d=[`doctor: ${c.pass} pass, ${c.warn} warn, ${c.fail} fail, ${c.skip} skip`,...s.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
|
|
3
|
+
`);return u.ok?a(d,u,{counts:c}):{...o(d,l,{counts:c}),data:u}}function b(e,t){return e.filter(e=>e.status===t).length}function x(e,t,n){return{name:e,status:t,message:n}}function S(){return p.find(e=>e.intent===`status`&&e.resource===`status`)}async function C(e){let{runUpdate:n}=await import(`./builtin-update-BXnny7XB.js`),r=t(),i=n(r,`check`);if(!i.ok||i.data===null)return{check:x(`cli-version`,`skip`,`Could not compare ${r.version} against the registry (${i.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:a,currentVersion:o,latestVersion:s,upgradeAvailable:c}=i.data;return{check:c?x(`cli-version`,`fail`,`Upgrade ${a} from ${o} to ${s}: run \`${e} update\`.`):x(`cli-version`,`pass`,`${a} ${o} matches the latest published release.`),upgradeAvailable:c}}async function w(e){try{let{EntityDetailSchema:e}=await import(`./detail-C8RvrFjE.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return x(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return x(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${l(t)}.`)}}async function T(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-BDiEG9bL.js`),i=e??{method:`GET`,path:`/info`,auth:`none`},a;try{a=r().host}catch(e){return{check:x(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${l(e)}.`),servedFingerprint:null}}let s=await n({method:i.method,path:i.path,auth:i.auth,responseFormat:`json`}).catch(e=>o(l(e)));return s.ok?{check:x(`api-host`,`pass`,`${i.method} ${i.path} answered at ${a}.`),servedFingerprint:e===void 0?null:E(s.data)}:{check:x(`api-host`,`fail`,s.httpStatus===401?`Replace or unset the credential ${a} rejected, or run \`${t} auth login\`, then rerun \`${t} auth doctor\` — ${i.method} ${i.path} returned ${s.summary}.`:`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${i.method} ${i.path} at ${a} returned ${s.summary}.`),servedFingerprint:null}}function E(e){if(typeof e!=`object`||!e||e instanceof Uint8Array)return null;let{response:t}=e;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.operationFingerprint;return typeof n==`string`&&n.length>0?n:null}async function D(e){let{isOAuthCredentialExpired:t}=await import(`./oauth-credential-DD0ptlS9.js`),n=s(),[r,a]=await Promise.all([k(),A()]);if(a.state===`unavailable`&&a.cause===`environment`)return x(`auth`,`fail`,`Fix the environment configuration first — ${a.summary}.`);let o=n.present,c=a.state===`found`&&a.stored.activation===`active`;if(!o&&r.state===`invalid`)return x(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${r.summary}.`);if(!o&&r.state===`found`&&t(r.stored.credential)&&r.stored.credential.tokens.refresh_token===void 0)return x(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`);if(!o&&!c&&r.state===`unavailable`)return x(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${i.authToken} through the environment — ${r.summary}.`);if(o||r.state===`found`||c){let t=await O(e,n);return x(`auth`,t.status,`Credential source available: ${await j(n,r,a)}; ${t.text}.`)}return a.state===`unavailable`?x(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${i.authToken} through the environment — ${a.summary}.`):x(`auth`,`fail`,`Run \`${e} auth login\` for OAuth or \`${e} auth login --key\` for an API key. For non-interactive use, set ${i.authToken} in the environment.`)}async function O(e,t){let{refreshCliCredentials:n}=await import(`./auth-status-render-D0Cn0OCZ.js`),{inspectPrivateLiveIdentity:i}=await import(`./private-live-identity-w8v84cKs.js`),a=c(r().host),o=await n(e),s=`credential=${t.present?t.source??`env`:o.materialized??`none`}`;try{if(o.failure!==null)throw Error(o.failure);let e=await i(`write`);if(e===null)return{status:`pass`,text:`${s} host=${a}`};let t=e.rbacRole.length===0?`none`:e.rbacRole.join(`,`);return{status:`pass`,text:`${s} account=${e.email??e.id} role=${t} host=${a}`}}catch(t){return{status:`warn`,text:`${s} account=unread host=${a} — GET /v1/auth/me returned ${l(t,[r().userBearerToken])}; run \`${e} auth status --verify write\``}}}async function k(){let{inspectOAuthCredentialStorage:e}=await import(`./oauth-credential-DD0ptlS9.js`),t;try{t=c(r().host)}catch(e){return{state:`unavailable`,summary:l(e)}}return await e(t)}async function A(){let{inspectApiKeyCredentialStorage:e}=await import(`./api-key-credential-Dw0P1YbH.js`),t;try{t=c(r().host)}catch(e){return{state:`unavailable`,summary:l(e),cause:`environment`}}try{return await e(t)}catch(e){return{state:`unavailable`,summary:l(e),cause:`storage`}}}async function j(e,t,n){let{summarizeCredential:r}=await import(`./auth-status-render-D0Cn0OCZ.js`);return[r(e),`oauth=${await N(t)}`,`api-key=${await M(n)}`].join(` `)}async function M(e){let{apiKeyExpiryQualifier:t}=await import(`./auth-status-render-D0Cn0OCZ.js`);if(e.state!==`found`)return e.state===`missing`?`unset`:`unavailable`;let n=c(r().host);return`${e.stored.activation}${t(n,e)}`}async function N(e){let{isOAuthCredentialExpired:t}=await import(`./oauth-credential-DD0ptlS9.js`);switch(e.state){case`found`:return t(e.stored.credential)?`expired`:`stored`;case`missing`:return`unset`;case`invalid`:return`invalid`;case`unavailable`:return`unavailable`;default:throw Error(`Unsupported OAuth credential state`)}}function P(e,t,n,r){let i=p.length;if(e===void 0)return x(`catalog`,`skip`,`The public catalog omits deployment-status metadata and holds ${i} operations.`);if(t===null)return x(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${f}.`);if(t===`49fd56f4b96be11a`)return x(`catalog`,`pass`,`${i} generated operations match the set the API serves (${f}).`);let a=`This catalog describes a different operation set than the API serves (${f} vs ${t})`;return n===!0?x(`catalog`,`fail`,`${a}: run \`${r} update\`.`):x(`catalog`,`skip`,n===!1?`${a}, and this CLI is already the latest published release: either the deployed API is older than this CLI, or a newer CLI has not been published yet.`:`${a}, and the registry did not answer, so it is unknown whether a newer release describes it: rerun \`${r} update\` with registry access.`)}var F=u(d,`oauth`),I=[u(d,`start`),u(d,`poll`),u(d,`acknowledge`)],L=u(d,`revoke`);function R(n,r=t().bin[0]){let a=H(n);v(a,r);let s=[`${F.description} Default method: OAuth in your browser.`,`With --key: ${I.map(({description:e})=>e).join(` `)}`].join(`
|
|
4
4
|
`);g(V(a,[F,...I],s)).action(z),g(V(a,[L],L.description)).action(B),g(a.command(`status`).summary(`Keep saved credentials current and report them`).description(`Runs the same credential materialization every command runs, then reports:
|
|
5
5
|
- auth: whether AUTH_TOKEN was already set in this shell's environment
|
|
6
6
|
- oauth: the saved OAuth identity and access-token expiry for the selected API host;
|
|
@@ -13,5 +13,5 @@ import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-CZBWjlY
|
|
|
13
13
|
Saved credentials are sent only to the selected API host and aVenture sign-in, never printed.
|
|
14
14
|
--verify read|write additionally runs a live permission probe for that scope; it does not
|
|
15
15
|
execute or authorize an arbitrary API operation.`).addOption(new e(`--verify <scope>`,`verify one permission-probe scope`).choices([`read`,`write`]))).action(async function(e){U(this),m({mode:h(e)},await W(r,e.verify))}),a.command(`token`).summary(`Print the bearer token the next command sends`).description([`Runs the same credential materialization every command runs, then prints the selected`,`bearer token alone on stdout: ${i.authToken} when set, otherwise the saved OAuth`,`access token (renewed when expired) or the saved aVenture API key.`,`Use it where another client needs this CLI's sign-in, such as an MCP client's header helper.`].join(`
|
|
16
|
-
`)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-
|
|
17
|
-
`))}function U(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function W(e,n){let{resolveAuthStatus:s}=await import(`./auth-resolver-
|
|
16
|
+
`)).action(async function(){let{refreshCliCredentials:e}=await import(`./auth-status-render-D0Cn0OCZ.js`);U(this);let t=await e(r),n=process.env[i.authToken]?.trim();t.failure===null&&n!==void 0&&n.length>0?process.stdout.write(`${n}\n`):m({mode:`text`},t.failure===null?Q(`auth token: no credentials resolved`,null,r,{oauth:!0,apiKey:!0}):o(`auth token: ${t.failure}`))})}async function z(e){U(this);let t=h(e);if(e.providers===!0){m({mode:t},await K());return}let n=e.key===!0?await(await import(`./api-key-login-DM_dS-Qm.js`)).loginApiKeyCredential({noBrowser:!e.browser,clientLabel:e.clientLabel}):await(await import(`./oauth-login-DU5UWOIH.js`)).loginOAuthCredential({noBrowser:!e.browser});m({mode:t},n)}async function B(e){let{logoutCliCredentials:t}=await import(`./logout-BF--2rxf.js`);U(this),m({mode:h(e)},await t({forgetLocal:e.forgetLocal===!0}))}function V(e,t,n){let[r]=t,i=e.command(r.command.slice(r.command.indexOf(` `)+1)).summary(r.summary).description(n),a=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])a.has(t.flag)||(a.add(t.flag),`required`in t&&t.required?i.requiredOption(t.flag,t.description):i.option(t.flag,t.description));return i}function H(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${F.command}\`: ${F.summary}; \`--key\` ${I[0].summary.toLowerCase()}.`,`\`${L.command}\`: ${L.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build metadata.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth token` prints the bearer token the next command sends."].join(`
|
|
17
|
+
`))}function U(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function W(e,n){let{resolveAuthStatus:s}=await import(`./auth-resolver-BtCY4bS9.js`),{inspectOAuthCredentialStorage:u}=await import(`./oauth-credential-DD0ptlS9.js`),{apiKeyCredentialDiagnostics:d,inspectLiveAuth:f,oauthCredentialDiagnostics:p,refreshCliCredentials:m,renderAuthStatus:h}=await import(`./auth-status-render-D0Cn0OCZ.js`),g;try{g=c(r().host)}catch(e){return o(`auth status: invalid API host — ${l(e)}`)}let _=s(),v=m(e),[y,b]=await Promise.all([Z(`/info`,`GET /info`),q()]),x=await v,[S,C]=await Promise.all([u(g),G(g)]),w=n===void 0?null:await f(n,S,C.inspection,x),T=t().version,E=d(g,C.inspection,C.verification),D=h({cliName:e,cliVersion:T,apiVersion:y.ok?await Y(y.data):null,oauth:S,apiKey:E,providers:b,resolved:_,refresh:x,live:w}),O={cli:{version:T},api:y.ok?y.data??null:null,auth:{[i.authToken]:_},selected:x.materialized,oauth:p(g,S),apiKey:E,providers:b,live:w,...y.ok?{}:{apiError:y.summary}};return x.failure===null?!y.ok&&y.httpStatus===401?{...o(`auth status: the API rejected the selected credential (401) | ${D}`,[`Replace or unset ${i.authToken}, or run \`${e} auth login\`.`]),data:O}:w!==null&&w.error!==null?{...o(`auth status: ${w.scope} permission probe failed — ${w.error}`,[w.error]),data:O}:w!==null||_.present||S.state===`found`||C.inspection.state===`found`?a(D,O):Q(`auth status: no credentials resolved | ${D}`,O,e,{oauth:S.state===`missing`,apiKey:C.inspection.state===`missing`}):{...o(`auth status: ${x.failure} | ${D}`,[x.failure]),data:O}}async function G(e){let{refreshStoredApiKeyCredential:t}=await import(`./api-key-credential-verification-DokhiwbQ.js`),n=await J(e);if(n.state!==`found`)return{inspection:n,verification:null};let{stored:r,verification:i}=await t(n.stored);return{inspection:{state:`found`,stored:r},verification:i}}async function K(){let e=await q();return e.state===`found`?a(`Sign-in providers for the selected API host`,e.catalog):o(`auth login --providers: ${e.summary}`)}async function q(){try{let{fetchAuthProviderCatalog:e}=await import(`./oauth-login-DU5UWOIH.js`);return{state:`found`,catalog:await e()}}catch(e){return{state:`unavailable`,summary:l(e)}}}async function J(e){try{let{inspectApiKeyCredentialStorage:t}=await import(`./api-key-credential-Dw0P1YbH.js`);return await t(e)}catch(e){return{state:`invalid`,summary:l(e)}}}async function Y(e){let{SystemBuildSchema:t}=await import(`./system-build-z_cn0X5C.js`);if(!X(e))return null;let n=t.safeParse(Reflect.get(e,`response`));if(!n.success)return null;let r=n.data.build.version?.trim();return r&&r.length>0?r:null}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Z(e,t){let{runOpenApiCall:n}=await import(`./openapi-call-BDiEG9bL.js`);return await n({method:`GET`,path:e,auth:`none`,responseFormat:`json`}).catch(e=>o(`${t} failed: ${e instanceof Error?e.message:String(e)}`))}function Q(e,t,r,a){return{...o(e,[...a.apiKey?[`For an API key (works over SSH), run \`${r} auth login --key\`.`]:[],...a.oauth?[`For OAuth, run \`${r} auth login\`; without a browser it prints a device code.`]:[],`For non-interactive use, set ${i.authToken} to an aVenture API key (create one at ${n}/settings/api-keys).`]),data:t}}export{R as registerBuiltinAuthCommands};
|
package/dist/chunks/{builtin-research-run-wait-B873mDeZ.js → builtin-research-run-wait-DobIPz5h.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,r as t}from"./result-envelope-
|
|
1
|
+
import{c as e,r as t}from"./result-envelope-Z0CGA1XZ.js";import{t as n}from"./output-vOa56eh-.js";import{i as r,t as i}from"./output-mode-DsofUHIa.js";var a=5e3,o=6e4,s=3e4,c=86400;function l(e){let t=e.commands.find(e=>e.name()===`research-runs`);if(t===void 0)return;let a=t.command(`wait`).summary(`Wait for one research run to finish, then report its outcome`).description("Polls `research-runs get` with backoff until the run is completed, failed, or stopped, then prints its status, error, failure class, spend, and last event time; a timeout reports the last event time so a stalled run shows. Exits nonzero when the run failed or stopped, or when --timeout passes first.").requiredOption(`--run-id <uuid>`,`Research run id`).option(`--timeout <seconds>`,`Total seconds to wait`,`1800`);i(a),a.action(async function(){let e=this.optsWithGlobals();n({mode:r(e)},await u(e))})}async function u(e){let{setTimeout:n}=await import(`node:timers/promises`),{buildOpenApiPath:r}=await import(`./openapi-call-BDiEG9bL.js`),{parseBoundedInt:i}=await import(`./batch-io-DtNypwHh.js`),s=i(`--timeout`,e.timeout,1,c);if(!s.ok||s.data===null)return t(s.summary);let l=Date.now()+s.data*1e3,u=r(`getResearchRun`,{runId:e.runId}),p=a,m=`not read yet`,h=(n=`after ${s.data}s`)=>t(`Run ${e.runId} is still ${m} ${n}`,[`Wait longer with --timeout, or read it with \`research-runs get --run-id ${e.runId}\`.`]);for(;;){if(l-Date.now()<=0)return h();let e=0,t=await f(u,l);if(t.kind===`deadline`)return h();if(t.kind===`refused`)return t.envelope;if(t.kind===`detail`){let{run:e}=t.detail;if(e.status===`completed`||e.status===`failed`||e.status===`stopped`)return await d(t.detail,l);m=`${e.status}, last event ${t.detail.lastEventAt??`none`}`}else m=`unread (${t.reason})`,e=(t.retryAfterSeconds??0)*1e3;let r=l-Date.now();if(r<=0||e>=r)return h(r<=0?`after ${s.data}s`:`and the API asks for ${e/1e3}s, past the ${s.data}s --timeout`);let i=Math.max(e,a+Math.random()*(p-a));await n(Math.min(i,r)),p=Math.min(p*2,o)}}async function d(t,n){let{readResearchRunSpend:r}=await import(`./research-run-spend-D9aXcq6b.js`),{run:i}=t,a=await r({runId:i.id,deadline:n}),o={runId:i.id,status:i.status,error:i.error??null,failureClass:i.failureClass??null,publicUrl:t.publicUrl??null,finishedAt:i.finishedAt??null,lastEventAt:t.lastEventAt??null,...a.costUsd===null?{}:{costUsd:a.costUsd}},s={warnings:a.warning===void 0?[]:[a.warning]},c=a.costUsd===null?``:`; spend $${a.costUsd.toFixed(4)}`;if(i.status===`completed`)return e(`Run ${i.id} completed${c}`,o,s);let l=i.failureClass?` (${i.failureClass})`:``,u=i.error?`: ${i.error}`:``;return{...e(`Run ${i.id} ${i.status}${l}${c}${u}`,o,s),ok:!1}}async function f(e,n){let{HarnessRunDetailSchema:r}=await import(`./run-detail-CIBpS8hz.js`),{runOpenApiCall:i}=await import(`./openapi-call-BDiEG9bL.js`),{isTransientRefusal:a,isTransportFailure:o}=await import(`./request-replay-C-Fy5fd4.js`),{retrySeconds:c}=await import(`./response-problem-CKX7pkpN.js`),l=n-Date.now();if(l<=0)return{kind:`deadline`};let u=AbortSignal.timeout(Math.min(s,l)),d;try{d=await i({method:`GET`,path:e,auth:`auto`,responseFormat:`json`,signal:u})}catch(e){if(o(e)||u.aborted&&e instanceof Error&&e.cause instanceof Error&&e.cause.name===`AbortError`&&e.cause.cause===u.reason)return{kind:`transient`,reason:String(e)};throw e}if(!d.ok){let{problem:n}=d;if(n!==void 0&&a(n.status,n)){let e=c(n.retryAfterSeconds);return{kind:`transient`,reason:d.summary,...e===void 0?{}:{retryAfterSeconds:e}}}return{kind:`refused`,envelope:t(`GET ${e} failed: ${d.summary}`,d.warnings,{problem:n})}}let f=d.data,p=r.safeParse(typeof f==`object`&&f&&`response`in f?f.response:void 0);return p.success?{kind:`detail`,detail:p.data}:{kind:`refused`,envelope:t(`${e} returned an unexpected body: ${p.error.message}`)}}export{l as registerBuiltinResearchRunWaitCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,n as t,r as n,t as r}from"./package-CZBWjlYb.js";import{c as i,r as a}from"./result-envelope-
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./package-CZBWjlYb.js";import{c as i,r as a}from"./result-envelope-Z0CGA1XZ.js";import{t as o}from"./output-vOa56eh-.js";import{i as s,t as c}from"./output-mode-DsofUHIa.js";import{t as l}from"./completion-setup-CwJt88xW.js";import{spawnSync as u}from"node:child_process";import{basename as d,dirname as f,relative as p,resolve as m,sep as h}from"node:path";import{existsSync as g,lstatSync as _,mkdirSync as v,mkdtempSync as y,readdirSync as b,readlinkSync as x,realpathSync as S,renameSync as C,symlinkSync as w}from"node:fs";import{randomUUID as T}from"node:crypto";var E=new Intl.Collator(void 0,{numeric:!0}),D=2e4,O=[`lib`,`aventurevc-releases`];function k(t,n=e()){let r=n.registry===``?`Requires npm authentication for @aventurevc packages.`:`Installs from npm.`;c(t.command(`update`).summary(`Check for or install the latest release`).description([`Compare the running CLI version against the latest published`,`release and install it into the active published bin prefix.`,``,`Refuses to install when the running binary is the working-tree build`,`(rebuild that checkout instead). ${r}`,`--execute is deprecated, accepted, and ignored; update executes by its verb.`].join(`
|
|
2
2
|
`)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1).option(`--release <version>`,`Install and activate exactly this version, not the latest.`)).action(e=>o({mode:s(e)},A(void 0,`apply`,e.release)))}function A(r,o=`apply`,s){let c=r;try{c??=e(process.argv[1])}catch(e){return a(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let l=c.name,u=c.version,f=c.registry===``?``:t,p=c.registry===``&&l===`@aventurevc/aventure-cli`,h=s;if(h===void 0){let e=j([`view`,f,`version`,`--silent`,`--global`],c,{timeout:D});if(!e.ok)return{...e,data:null};if(h=(e.data??``).trim(),h===``)return a(`npm view ${f} returned empty version`,[`empty_stdout`])}let _=s!==void 0||p||E.compare(u,h)<0,x={targetPackage:f,runningPackage:l,currentVersion:u,latestVersion:h,upgradeAvailable:_,upgradeInstalled:!1};if(o===`check`)return i(`${l}@${u} → ${f}@${h} (${_?`available`:`up to date`})`,x);if(c.workingTreeRoot!==null)return a(`Refusing to install over the working-tree build at ${c.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);try{let e=P(c),t=m(e,...O),r=d(f),a=m(t,`${r}-current`),o=f===``?[f,``]:[f,n],l=F(e,c),p=s??[h,l?.version??u].reduce((e,t)=>E.compare(e,t)<0?t:e,u);v(t,{recursive:!0});let _=[N(c),...g(a)?[S(a)]:[],...b(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>m(t,e.name))],C,w=null,T=!1;for(let t of new Set(_.filter(t=>t!==e))){let e=M(t,o,p,c.registry);if(e.ok&&e.data!==null){C=t,w=e.data;break}}if(C===void 0){C=y(m(t,`${r}-${encodeURIComponent(p)}-`));let e=j([`install`,`-g`,`--prefix`,C,...o.map(e=>`${e}@${p}`)],c,{stdio:[`ignore`,`inherit`,`inherit`]});if(!e.ok)return{...e,data:null};T=!0;let n=M(C,o,p,c.registry);if(!n.ok)return{...n,data:null};w=n.data}if(w===null)throw Error(`release verification produced no package`);let D=I(C,e,a,w,s),k=R();return i(`${f} active at ${D}`,{...x,upgradeInstalled:T||s!==void 0||l?.version!==D,installPrefix:e,verifiedVersion:D,completionRefreshed:k.refreshed,completionRefreshMessage:k.message})}catch(e){return a(`${f} update failed: ${L(e)}`,[`existing releases were preserved`])}}function j(e,t,n={}){let r={...process.env};t.registry===``?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let o=[...e,`--@aventurevc:registry=${t.registry}`],s=u(`npm`,o,{env:r,encoding:`utf8`,...n});if(s.error)return s.signal===`SIGTERM`&&n.timeout!==void 0?a(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):a(`npm ${e[0]??``} failed to start: ${s.error.message}`,[`spawn_error`]);if(s.status!==0){let t=(s.stderr??``).trim().split(`
|
|
3
3
|
`).slice(-3).join(` | `);return a(`npm ${e.join(` `)} exited ${s.status}`,[t||`no stderr`])}return i(`npm ok`,s.stdout??``)}function M(t,n,r,o){try{let a=n.map(n=>{let i=e(m(t,`lib`,`node_modules`,...n.split(`/`),`package.json`));if(i.name!==n||i.version!==r||i.registry!==o)throw Error(`${n} does not match ${r} from ${o}`);for(let e of i.bin)if(!S(m(t,`bin`,e)).startsWith(`${i.packageRoot}${h}`))throw Error(`${e} escapes ${i.packageRoot}`);return i});for(let e of a){let n=m(t,`bin`,e.bin[0]),i=u(process.execPath,[n,`--version`],{encoding:`utf8`,timeout:D});if(i.error)throw Error(`${e.name} verification failed: ${i.error.message}`);let a=(i.stdout??``).trim();if(i.status!==0||a!==r)throw Error(`${e.name} expected ${r} but reported ${a||`empty output`}`)}return i(`CLI and MCP release verified`,a)}catch(e){return a(`release verification failed: ${L(e)}`,[`release prefix: ${t}`])}}function N(e){let t=f(e.packageRoot),n=f(t),r=f(n);if(d(t)!==e.name.split(`/`)[0]||d(n)!==`node_modules`||d(r)!==`lib`)throw Error(`the running package is not in a verifiable global npm prefix; npm install was not run`);if(!e.entryPath.startsWith(`${e.packageRoot}${h}`))throw Error(`the running entry escapes its package root`);return f(r)}function P(e){let t=N(e),n=`${h}${O.join(h)}${h}`,r=t.lastIndexOf(n);return r<0?t:t.slice(0,r)}function F(t,n){let i=n.registry===``?d(``):r,a=m(t,`bin`,i);if(!g(a))return null;let o=e(a);if(o.registry!==n.registry)throw Error(`${a} belongs to another product`);return o}function I(t,n,r,i,a){let o=i[0];if(o===void 0)throw Error(`release contains no CLI`);let s=m(n,`bin`);v(s,{recursive:!0});let c=i.flatMap(t=>t.bin.filter((t,n)=>{let r=m(s,t);if(!g(r)||e(r).registry===o.registry)return!0;if(o.registry!==``&&n>0)return!1;throw Error(`${r} belongs to another product`)}));if(!g(r)){let e=y(m(f(r),`${d(r)}-seed-`));v(m(e,`bin`));for(let n of c){let r=m(s,n);w(S(g(r)?r:m(t,`bin`,n)),m(e,`bin`,n))}try{w(p(f(r),e),r)}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`EEXIST`))throw e}}if(!_(r).isSymbolicLink())throw Error(`${r} is not a release symlink`);for(let e of c){let t=p(s,m(r,`bin`,e)),n=m(s,`.${e}-${T()}`);w(t,n),C(n,m(s,e))}for(let e of c){let t=m(s,e);if(!_(t).isSymbolicLink()||m(s,x(t))!==m(r,`bin`,e))throw Error(`${t} does not follow the product current pointer`)}let l=F(n,o);if(a===void 0&&l!==null&&E.compare(l.version,o.version)>0)return l.version;let u=`${r}-${T()}`;return w(p(f(r),t),u),C(u,r),o.version}function L(e){return e instanceof Error?e.message:String(e)}function R(){try{return l()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}export{k as registerBuiltinUpdateCommand,A as runUpdate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e}from"./tool-policy-
|
|
1
|
+
import{d as e}from"./tool-policy-k1J17TTM.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return t?.[e]?.section??d[e]}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,directory:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,"research-runs":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
|