@aventurevc/aventure-cli 0.8.176 → 0.8.178
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 +2 -1
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +20 -18
- package/dist/chunks/api-key-bearer-credential-08YUx1xO.js +4 -0
- package/dist/chunks/api-key-bearer-credential-CbAZG3UK.js +1 -0
- package/dist/chunks/aventure-cli-D6orTgVa.js +67 -0
- package/dist/chunks/{cli-help-policy-ByZ5mejM.js → cli-help-policy-ClfxVVMO.js} +1 -1
- package/dist/chunks/contract-GiOkyoRw.js +24 -0
- package/dist/chunks/detail-BOnmc0l_.js +1 -0
- package/dist/chunks/detail-D_SP8d0A.js +1 -0
- package/dist/chunks/dist-B1L55tOm.js +96 -0
- package/dist/chunks/env-Casn05NX.js +1 -0
- package/dist/chunks/{logging-Bx9mH20G.js → logging-BkyFCiym.js} +1 -1
- package/dist/chunks/logging-SpDUtMAq.js +1 -0
- package/dist/chunks/mcp-generation-contract-57Ma8uaG.js +1 -0
- package/dist/chunks/mcp-generation-contract-qkSbgO9-.js +1 -0
- package/dist/chunks/oauth-bearer-credential-BsHm-4dT.js +8 -0
- package/dist/chunks/oauth-bearer-credential-CIV7XxZE.js +1 -0
- package/dist/chunks/{oauth-login-CjVJcnDO.js → oauth-login-B-Vq7gKd.js} +4 -4
- package/dist/chunks/oauth-login-DeimyZ6c.js +1 -0
- package/dist/chunks/openapi-commands-BQWRBrXR.js +1 -0
- package/dist/chunks/openapi-commands-EyRhLowQ.js +1 -0
- package/dist/chunks/{output-mode-BLiwt6mh.js → output-mode-Bl9hZ5Qe.js} +1 -1
- package/dist/chunks/output-mode-BszZ_T22.js +1 -0
- package/dist/chunks/output-spill-CjiBFqUS.js +1 -0
- package/dist/chunks/provider-catalog-_FzXfz3Z.js +1 -0
- package/dist/chunks/{response-problem-BgnzyNAt.js → response-problem-DpVA-CLe.js} +1 -1
- package/dist/chunks/result-envelope-CFE7wPAr.js +1 -0
- package/dist/chunks/startup-auth-DaJp5qea.js +1 -0
- package/dist/chunks/startup-auth-G6Utbedw.js +1 -0
- package/dist/chunks/tool-policy-DDfbFJCQ.js +1 -0
- package/package.json +3 -3
- package/scripts/install-zsh-completion-loader.mjs +1 -24
- package/dist/chunks/api-key-bearer-credential-DThHZp3d.js +0 -4
- package/dist/chunks/api-key-bearer-credential-cWA7xd54.js +0 -1
- package/dist/chunks/aventure-cli-CfMHNahL.js +0 -67
- package/dist/chunks/contract-COKFi5uU.js +0 -22
- package/dist/chunks/detail-BAQYsbcg.js +0 -1
- package/dist/chunks/detail-C-iboZcM.js +0 -1
- package/dist/chunks/dist--XnoGdAp.js +0 -96
- package/dist/chunks/env-DRmqwv5y.js +0 -1
- package/dist/chunks/logging-CLeIBtJe.js +0 -1
- package/dist/chunks/mcp-generation-contract-CMMwJ9SW.js +0 -1
- package/dist/chunks/mcp-generation-contract-Jv_ZOz3v.js +0 -1
- package/dist/chunks/oauth-bearer-credential-D0b7yl_z.js +0 -1
- package/dist/chunks/oauth-bearer-credential-DIXsQFrI.js +0 -8
- package/dist/chunks/oauth-login-B6g1mCCp.js +0 -1
- package/dist/chunks/openapi-commands-B682Bjqs.js +0 -1
- package/dist/chunks/openapi-commands-D-8KAlUF.js +0 -1
- package/dist/chunks/output-mode-72bOyh6u.js +0 -1
- package/dist/chunks/output-spill--GMJxYUn.js +0 -1
- package/dist/chunks/provider-catalog-89_L2xbt.js +0 -1
- package/dist/chunks/result-envelope-CBM70LIR.js +0 -1
- package/dist/chunks/startup-auth-B4_54-Hw.js +0 -1
- package/dist/chunks/startup-auth-Byk_MX8d.js +0 -1
- package/dist/chunks/tool-policy--3-tTAEm.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./openapi-commands-BQWRBrXR.js";export{e as GENERATED_OPENAPI_COMMAND_SPECS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./commander-BB7CDPLs.js";import{t}from"./result-envelope-
|
|
1
|
+
import{n as e}from"./commander-BB7CDPLs.js";import{t}from"./result-envelope-CFE7wPAr.js";import{t as n}from"./output-spill-CjiBFqUS.js";var r=`${t/1e3}KB`,i=[{flags:`--text`,description:`Print text (terminal default).`,conflicts:[`data`,`dataFull`,`json`]},{flags:`--data`,description:`Print data JSON (piped default); over ${r} prints a truncated envelope, not the payload; use --to-file.`,conflicts:[`text`,`dataFull`,`json`]},{flags:`--data-full`,description:`Print uncapped JSON for bounded programs; never LLM agents.`,conflicts:[`text`,`data`,`json`,`toFile`]},{flags:`--to-file <path>`,description:`Write the response to <path>; over ${r} the printed envelope carries a receipt instead.`,conflicts:[`dataFull`]},{flags:`--json`,description:`Print the stable JSON envelope (capped at ${r}).`,conflicts:[`text`,`data`,`dataFull`]},{flags:`--all-fields`,description:`Print text including the detail fields --text hides; --data and --json already carry every field.`,conflicts:[]}],a=new Intl.ListFormat(`en`,{type:`disjunction`});function o(t){let n=i.map(t=>({spec:t,option:new e(t.flags)}));for(let{spec:e,option:r}of n){let i=n.filter(({option:t})=>e.conflicts.some(e=>e===t.attributeName())).flatMap(({option:e})=>e.long??[]);r.description=i.length===0?e.description:`${e.description} Cannot combine with ${a.format(i)}.`,t.addOption(r.conflicts([...e.conflicts]))}return t}function s(e,t=`auto`){return d(e.toFile)&&n(e.toFile),e.json===!0?`json`:e.dataFull===!0?`data-full`:e.data===!0?`data`:e.text===!0||e.allFields===!0?`text`:u(e)||t===`auto`&&!process.stdout.isTTY?`data`:`text`}function c(e){if(e.includes(`--text`))return!1;let t=e.includes(`--json`)||e.includes(`--data`)||e.includes(`--data-full`);return e.includes(`--all-fields`)&&!t?!1:t||e.includes(`--agent-chassis`)&&e.includes(`--agent-model`)||!process.stdout.isTTY}function l(e){return e===`data`||e===`data-full`||e===`json`}function u(e){return d(e.agentChassis)&&d(e.agentModel)}function d(e){return typeof e==`string`&&e.trim().length>0}export{s as i,c as n,l as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./output-mode-Bl9hZ5Qe.js";export{e as cliMachineOutputSelected};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./result-envelope-CFE7wPAr.js";import{dirname as t}from"node:path";import{mkdirSync as n,writeFileSync as r}from"node:fs";import{Buffer as i}from"node:buffer";var a;function o(e){a=e}function s(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function c(o){let c=a;if(c===void 0)return o;a=void 0;let u=o.data,d=o.ok?u instanceof Uint8Array?u:typeof u==`string`?i.from(u,`utf8`):l(s(u)):l(o);try{n(t(c),{recursive:!0}),r(c,d)}catch(t){return e(`could not spill output to '${c}'`,[String(t)])}return!o.ok||d.byteLength<=5e4?o:typeof u!=`object`||!u||u instanceof Uint8Array?{...o,data:`spilled ${d.byteLength} bytes to '${c}'`}:{...o,data:{...u,response:{spilledTo:c,byteLength:d.byteLength}}}}function l(e){return i.from(JSON.stringify(e,null,2),`utf8`)}export{s as n,c as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as e,y as t}from"./person-owner-BJgNYLKX.js";import{zr as n}from"./dist-B1L55tOm.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,w as t}from"./person-owner-BJgNYLKX.js";import{d as n,u as r}from"./result-envelope-
|
|
1
|
+
import{S as e,w as t}from"./person-owner-BJgNYLKX.js";import{d as n,u as r}from"./result-envelope-CFE7wPAr.js";var i=/(?:authorization|api-key|secret|token)/iu,a=/^x-cli-[a-z0-9-]*secret$/iu;function o(r,i,a={}){let o=d(a);o.length>0&&(i=s(i,o));let l=e(t(),n).safeParse(i);if(!l.success)return{status:r,title:`HTTP ${r}`,type:`about:blank`,code:void 0,detail:typeof i==`string`?i:void 0};let u=c(l.data),f=typeof u.status==`number`?u.status:r;return{...u,status:f,title:typeof u.title==`string`?u.title:`HTTP ${f}`,type:typeof u.type==`string`?u.type:`about:blank`,detail:typeof u.detail==`string`?u.detail:void 0}}function s(e,t){return typeof e==`string`?f(e,t):typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>s(e,t)):Object.fromEntries(Object.entries(e).map(([e,n])=>[f(e,t),s(n,t)]))}function c(e){let t=r.safeParse(e);if(t.success)return e;let n=new Set(t.error.issues.map(e=>String(e.path[0])));return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function l(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`};let n=d(t),r={};for(let[t,i]of Object.entries(e))i!=null&&(r[t]=typeof i==`object`?JSON.stringify(s(i,n)):typeof i==`string`?f(i,n):i);return r}function u(e){return Object.keys(e).some(e=>a.test(e))}function d(e){let t=[];for(let[n,r]of Object.entries(e)){if(!i.test(n))continue;let e=r.trim();if(e.length===0)continue;t.push(e);let a=e.indexOf(` `);if(a>0){let n=e.slice(a+1).trim();n.length>0&&t.push(n)}}return t}function f(e,t){let n=e;for(let e of t)e!=null&&e.length>0&&(n=n.replaceAll(e,`<redacted>`));return n}function p(e,t){if(u(t))return{status:e.status,title:`CLI authorization broker request failed`,type:`about:blank`,detail:`Broker diagnostic text was suppressed at the CLI credential boundary.`,...h(e)};let n=d(t);if(n.length===0)return e;let r=t=>{let r=e[t];return typeof r==`string`?{[t]:f(r,n)}:{}},i=t=>{let r=e[t];return r==null?{}:{[t]:Object.fromEntries(Object.entries(r).map(([e,t])=>[f(e,n),f(t,n)]))}},a=t=>{let r=e[t];return Array.isArray(r)?{[t]:r.map(e=>f(e,n))}:{}};return{status:e.status,title:f(e.title,n),type:f(e.type,n),...r(`detail`),...r(`hint`),...r(`field`),...r(`suggestion`),...r(`requiredRole`),...r(`existingRecordId`),...i(`suggestions`),...i(`error`),...a(`unknownParameters`),...a(`validParameters`),...e.details===void 0?{}:{details:e.details},...e.resolution===void 0?{}:{resolution:e.resolution},...e.code===void 0?{}:{code:e.code},...Array.isArray(e.proseViolation)?{proseViolation:e.proseViolation.map(e=>({...e,passage:f(e.passage,n),reason:f(e.reason,n)}))}:{},...r(`traceId`),...r(`spanId`),...e.limitType===void 0?{}:{limitType:e.limitType},...e.allowanceType===void 0?{}:{allowanceType:e.allowanceType},...e.limit===void 0?{}:{limit:e.limit},...e.used===void 0?{}:{used:e.used},...e.remaining===void 0?{}:{remaining:e.remaining},...e.resetAt===void 0?{}:{resetAt:e.resetAt},...e.windowSeconds===void 0?{}:{windowSeconds:e.windowSeconds},...e.filedRunId?{filedRunId:e.filedRunId}:{},...h(e)}}function m(e,t){if(_(e.retryAfterSeconds)!==void 0)return e;let n=g(t.get(`retry-after`));return n===void 0?e:{...e,retryAfterSeconds:n}}function h(e){let t=_(e.retryAfterSeconds);return t===void 0?{}:{retryAfterSeconds:t}}function g(e){let t=e?.trim()??``;if(/^\d+$/u.test(t))return _(Number(t));let n=/[a-z]/iu.test(t)?new Date(t).getTime():NaN;return Number.isNaN(n)?void 0:_(Math.ceil((n-Date.now())/1e3))}function _(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}export{p as a,m as c,d as i,o as n,g as o,f as r,_ as s,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,O as t,S as n,T as r,h as i,i as a,l as o,n as s,o as c,p as l,s as u,t as d,u as f,v as p,w as m,y as h}from"./person-owner-BJgNYLKX.js";import{Buffer as g}from"node:buffer";var _=i(()=>r([m(),p(),f(),u(),o(_),n(m(),_)])),v=c([`URL_DUPLICATE`,`STRICT_URL_LOOKUP`,`DUPLICATE_CREATE_REVIEW`,`CLASSIFICATION_INACTIVE_TAG`,`NEWS_SOURCE_URL`]),y=Object.assign(r([v,m()]),{enum:v.enum}),ee=c([`REACTIVATE`,`ATTACH_INACTIVE`]),te=h({availableOverrides:o(ee),conflictType:y,slug:m(),tagId:l()}),ne=h({externalId:m().nullish(),id:l(),reason:o(m()),score:l(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish()}),re=h({externalId:m().nullish(),id:t(),name:m().nullish(),operatingStatus:m().nullish(),publicPath:m().nullish(),reason:o(m()),score:l().optional(),slug:m().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:s.nullish()}),ie=h({candidate:o(re).nullish(),conflictType:y,newsCandidate:o(ne).nullish(),overridePath:m().nullish(),threshold:l()}),ae=h({conflictingArticleId:l(),conflictingArticleSlug:m(),conflictingArticleTitle:m(),conflictType:y}),oe=h({candidateEntityId:o(t()),candidatePersonId:o(t()),conflictType:y,hint:m(),normalizedUrl:m().nullish(),url:m(),urlType:m().nullish()}),se=h({owner:d,urlId:l()}),ce=h({conflictType:y,existingJoin:o(se),fragmentIgnored:f(),guidance:m(),normalizedUrl:m().nullish(),requestedOwner:d,url:m(),urlType:m()}),b=r([ce,oe,ie,te,ae]),x=h({acceptedValue:o(m()).nullish(),action:c([`setField`,`setParameter`,`removeParameter`,`useEndpoint`,`reviewCandidates`,`authenticate`]),endpoint:m().nullish(),fieldPath:m().nullish(),parameter:m().nullish(),retryable:f().nullish()}),S=c([`source`,`record`,`disclaimer`,`voice`,`structured`,`temporal`,`factList`,`mojibake`,`unsupported`,`legalSource`,`textContract`]),le=Object.assign(r([S,m()]),{enum:S.enum}),C=h({overridable:f(),passage:m(),problem:le,reason:m()}),w=c([`entity`,`person`,`news`,`blog`,`content`]),T=h({deletedAt:a({offset:!0}).nullish(),id:m(),isHidden:f(),nameBrand:m().nullish(),resourceType:w,showOnSitemap:f(),slug:m()}),E=h({newUrl:m().nullish(),oldUrl:m(),targetCurrentSlug:m().nullish(),targetId:m().nullish(),targetResourceType:w.nullish()}),D=h({allowanceType:c([`COMPANY`,`PERSON`,`ENTITY_VIEW`,`ENTITY_BRAND`,`PERSON_VIEW`,`WEB_SEARCH`]).nullish(),circuitBreaker:m().nullish(),code:r([c(`not_authorized.rateLimited.rate_limited.subscription_required.subscription_canceled.subscription_past_due.subscription_paused.billing_allowance_exhausted.billing_additional_usage_cap_reached.billing_credit_checkout_closed.account_exists.origin_detail_capacity.origin_detail_shutdown.suspectedShellStrip.suspected_shell_strip.prose_rejected.url_surface_misclassification.JOBRUNR_DISABLED.jobrunr_disabled.task_plan_operation_unserved.JOBRUNR_STORAGE_UNAVAILABLE.jobrunr_storage_unavailable.rbac_lookup_unavailable.GEOCODE_PROVIDER_ERROR.geocode_provider_error.sentry_api_error.frontend_cache_epoch_mode_not_targeted.image_blocklist_match.image_monochrome.image_too_small.image_wrong_aspect.image_monogram.image_unreadable.image_processing_error.image_brand_mismatch.image_photographic.web_crawl_fetch_failed.source_document_fetch_busy.primary_website_missing.news_rss_feed_fetch_failed.news_rss_article_fetch_failed.callback_connection_refused.callback_timeout.callback_tls_error.callback_http_4xx.callback_http_5xx.callback_challenge_failed.news_subscription_limit.r2_fetch_failed.r2_delete_failed.r2_upload_failed.source_document_body_unavailable.source_document_capture_limit_exceeded.news_similarity_embedding_unavailable.search_provider_not_configured.search_provider_error.search_still_running.lookup_still_running.sec_edgar_fetch_failed.github_fetch_failed.INFERENCE_PROVIDER_ERROR.inference_provider_error.INFERENCE_PROVIDER_RESPONSE_EMPTY.inference_provider_response_empty.INFERENCE_PROVIDER_INVALID_JSON.inference_provider_invalid_json.INFERENCE_PROFILES_MISSING.inference_profiles_missing.INFERENCE_PROFILE_API_KEY_MISSING.inference_profile_api_key_missing`.split(`.`)),m().max(128)]).nullish(),conflictingRecord:T.nullish(),detail:m().optional(),details:b.nullish(),error:n(m(),m()).nullish(),existingRecordId:m().nullish(),existingRedirect:E.nullish(),feId:m().nullish(),field:m().nullish(),filedRunId:o(t()).nullish(),hammingDistance:p().int().nullish(),hint:m().nullish(),instance:m().optional(),limit:p().int().nullish(),limitType:r([c([`FORM`,`GLOBAL`,`SUBNET`,`IP`,`UNKNOWN`,`RESILIENCE4J`,`WEB_SEARCH`,`AGENT_HELP`,`NATURAL_SEARCH`,`BILLING_ALLOWANCE`,`BILLING_ADDITIONAL_USAGE`,`CLERK_PUBLIC_ADMISSION`,`CLERK_SCRIPT_LOAD`,`ORIGIN_DETAIL`,`INFERENCE_PROVIDER`]),m()]).nullish(),matchedBlocklistKey:m().nullish(),mediaType:m().nullish(),moderationReason:m().nullish(),parseError:m().nullish(),path:m().nullish(),properties:n(m(),_).optional(),proseViolation:o(C).nullish(),remaining:p().int().nullish(),requiredRole:m().nullish(),resetAt:a({offset:!0}).nullish(),resolution:x.nullish(),retryAfterSeconds:p().int().nullish(),spanId:m().nullish(),status:l().optional(),suggestion:m().nullish(),suggestions:n(m(),m()).nullish(),suspectedFragment:m().nullish(),title:m().optional(),traceId:m().nullish(),type:m().optional(),unknownParameters:o(m()).nullish(),used:p().int().nullish(),validParameters:o(m()).nullish(),value:m().nullish(),windowSeconds:p().int().nullish()}),O=e=>e>=500&&e<600,k=r([m(),p(),f()]),ue=h({number:p().optional(),size:p().optional(),numberOfElements:p().optional(),totalElements:p().optional(),totalPages:p().optional(),first:f().optional(),last:f().optional(),empty:f().optional()}),de=h({byteLength:p(),maxBytes:p(),omitted:o(m()),recovery:m()}),A=h({status:p(),title:m(),type:m()}).catchall(_.optional()).and(D);h({ok:f(),summary:m(),httpStatus:p().optional(),operationId:m().optional(),method:m().optional(),endpoint:m().optional(),format:c([`json`,`text`]).optional(),count:p().optional(),page:ue.optional(),filters:n(m(),r([k,o(k)])).optional(),truncated:f().optional(),truncation:de.optional(),omitted:o(m()).default([]),ids:o(m()).default([]),counts:n(m(),p()).default({}),references:o(m()).default([]),warnings:o(m()).default([]),problem:A.optional(),data:e()});var j=5e4,M=[50,25,10,5,1],N=320,P=[{arrayLimit:1/0,rowLimit:1/0,stringLimit:24e3},{arrayLimit:1/0,rowLimit:1/0,stringLimit:1e4},...M.map(e=>({arrayLimit:e,rowLimit:1/0}))],F=1e3,I=/^(?:bio|biography|body|content|description|evidence|fulltext|notes|snippet|summary|text)$/u,L=/(?:description|snippet|summary|text)$/u;function R(e){let t=Z(e)?e:null;if(t===null)return;let n={number:Q(t,`number`),size:Q(t,`size`),numberOfElements:Q(t,`numberOfElements`),totalElements:Q(t,`totalElements`),totalPages:Q(t,`totalPages`),first:$(t,`first`),last:$(t,`last`),empty:$(t,`empty`)};return Object.values(n).some(e=>e!==void 0)?n:void 0}function z(e,t){if(t?.numberOfElements!==void 0)return t.numberOfElements;if(Array.isArray(e))return e.length;let n=Z(e)?e.content:void 0;return Array.isArray(n)?n.length:void 0}function B(e,t,n={}){return{ok:!0,summary:e,...n,omitted:n.omitted??[],ids:n.ids??[],counts:n.counts??{},references:n.references??[],warnings:n.warnings??[],data:t}}function V(e,t=[],n={}){return{...B(e,null,{...n,warnings:t}),ok:!1}}function fe(e,t={}){let n=g.byteLength(JSON.stringify(e),`utf8`);if(n<=5e4)return e;let r=e.httpStatus??0;if(t.write===!0&&e.ok&&r>=200&&r<300)return pe(e,n,t.exactRecovery);let i=t.exactRecovery??`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`,a=_.safeParse(JSON.parse(JSON.stringify(e.data))),o=t=>{let r=a.success?q(a.data,`data`,n,t):{value:Y(n),omitted:[`data`]};return{...e,truncated:!0,truncation:J(n,r.omitted,i),warnings:[...e.warnings,...t.rowLimit===1/0?[]:[_e(t.rowLimit)],`response truncated (>50KB); read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`],data:r.value}},s=e;for(let e of P)if(s=o(e),W(s))return s;let c=0;for(let t=2**Math.floor(Math.log2(K(e.data)));t>=1;t/=2)W(o({arrayLimit:1,rowLimit:c+t}))&&(c+=t);return c>0?o({arrayLimit:1,rowLimit:c}):H({...s,truncation:J(n,[`data`],i),data:Y(n)},n,i,`response truncated (>50KB); metadata named in truncation.omitted was removed; read the section through its sub-resource operation, or request a smaller page, a compact projection where the operation offers one, or a narrower server-side filter`)}function pe(e,t,n=`Read the full result through the GET operation on ${e.endpoint??`this route`}.`){let r={...e.counts},i=(e,n)=>{let a={};for(let[o,s]of Object.entries(Z(e)?e:{}))Array.isArray(s)?r[`${n}${o}`]=s.length:typeof s==`string`?a[o]=G(s,t,N):typeof s!=`object`||!s?a[o]=s:n===``&&o===`response`&&(a[o]=i(s,`response.`));return a},a={...e,summary:`${e.method} succeeded (HTTP ${e.httpStatus}); response body omitted (${t} bytes, over the 50KB cap); do not retry the write`,truncated:!0,truncation:J(t,[`data`],n),counts:r,data:i(e.data,``)},o=a,s=[`data`],c={};for(let r of[`references`,`ids`,`warnings`]){if(W(o))return o;s.push(r),c[r]=[],o={...a,...c,omitted:[...e.omitted,...s.slice(1)],truncation:J(t,s,n)}}return W(o)?o:H({...o,data:Y(t),warnings:[`response truncated (>50KB); do not retry the write`]},t,n,`response truncated (>50KB); metadata named in truncation.omitted was removed; do not retry the write`)}function H(e,t,n,r){if(W(e))return e;let i=e.warnings.slice(0,-1),a=[`data`],o=e;if(o.problem!==void 0){let e=U(o.problem);if(JSON.stringify(e).length<JSON.stringify(o.problem).length&&(a.push(`problem`),o={...o,problem:e,truncation:J(t,a,n)},W(o)))return o}let s=[];if(e.filters!==void 0&&s.push(`filters`),e.omitted.length>0&&s.push(`omitted`),e.ids.length>0&&s.push(`ids`),Object.keys(e.counts).length>0&&s.push(`counts`),e.references.length>0&&s.push(`references`),a.push(...s),o={...o,filters:void 0,truncation:J(t,a,n),omitted:[],ids:[],counts:{},references:[],warnings:s.length===0?e.warnings:[...i,r]},W(o))return o;let c=e=>e===void 0?void 0:G(e,t),l={summary:G(o.summary,t),operationId:c(o.operationId),method:c(o.method),endpoint:c(o.endpoint),warnings:o.warnings.map(e=>G(e,t)),problem:o.problem&&U(o.problem,t)},u=new Map(Object.entries(o));for(let[e,t]of Object.entries(l))JSON.stringify(t)!==JSON.stringify(u.get(e))&&a.push(e);if(o={...o,...l,truncation:J(t,a,n)},W(o))return o;a.push(`warnings`),o.page!==void 0&&a.push(`page`);let d=G(o.summary,t,N);return d!==o.summary&&a.push(`summary`),{...o,summary:d,page:void 0,truncation:J(t,a,n),warnings:[r]}}function U(e,t){let n=e=>t===void 0?e:G(e,t);return{status:e.status,title:n(e.title),type:n(e.type),...e.detail===void 0?{}:{detail:n(e.detail)},...e.instance===void 0?{}:{instance:n(e.instance)},...e.code===void 0?{}:{code:typeof e.code==`string`?n(e.code):e.code},...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds}}}function W(e){return g.byteLength(JSON.stringify(e),`utf8`)<=j}function G(e,t,n=F){if(g.byteLength(JSON.stringify(e),`utf8`)<=n)return e;let r=X(t),i=``,a=g.byteLength(JSON.stringify(r),`utf8`);for(let t of e){let e=g.byteLength(JSON.stringify(t),`utf8`)-2;if(a+e>n)break;i+=t,a+=e}return`${i.trimEnd()}${r}`}function K(e){return Array.isArray(e)?e.length:Z(e)?Math.max(0,...Object.values(e).map(K)):0}function q(e,t,n,r){if(typeof e==`string`){let i=he(ve(t))||e.length>F,a=r.stringLimit??N;return!i||e.length<=a?{value:e,omitted:[]}:{value:`${e.slice(0,a).trimEnd()}${X(n)}`,omitted:[t]}}if(typeof e!=`object`||!e)return{value:e,omitted:[]};if(Array.isArray(e))return me(e,t,n,r);if(t===`data.response.entity.answer`||t===`data.response.answer`)return{value:e,omitted:[]};let i={},a=[];for(let[o,s]of Object.entries(e)){if(s===void 0)continue;let e=q(s,`${t}.${o}`,n,r);i[o]=e.value,a.push(...e.omitted)}return{value:i,omitted:a}}function me(e,t,n,r){let i=e.slice(0,r.rowLimit),a={...r,rowLimit:r.arrayLimit},o=i.map((e,r)=>q(e,`${t}[${r}]`,n,a)),s=o.flatMap(e=>e.omitted),c=`${t}[${i.length}..] (kept ${i.length} of ${e.length})`;return{value:o.map(e=>e.value),omitted:e.length>i.length?[...s,c]:s}}function he(e){let t=e.toLowerCase();return I.test(t)||L.test(t)}var ge=`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`;function J(e,t,n){return{byteLength:e,maxBytes:j,omitted:t.length===0?[`data`]:[...new Set(t)],recovery:G(n,e)}}function Y(e){return{truncated:!0,byteLength:e,maxBytes:j}}function X(e){return`\n[truncated byteLength=${e} maxBytes=${j}]`}var _e=e=>`kept the first ${e} whole rows of each list; read the rest ${e} at a time: rerun a paged read with --size ${e} and --page 1, 2, … (MCP: size, page), or a batch read with at most ${e} ids per call`;function ve(e){return(e.split(`.`).at(-1)??e).replace(/\[\d+\]$/,``)}var Z=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Q(e,t){return typeof e[t]==`number`?e[t]:void 0}function $(e,t){return typeof e[t]==`boolean`?e[t]:void 0}export{W as a,B as c,_ as d,V as i,O as l,ge as n,R as o,fe as r,z as s,j as t,D as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./commander-BB7CDPLs.js";import{o as r,u as i}from"./env-Casn05NX.js";import{c as a,i as o}from"./result-envelope-CFE7wPAr.js";import{g as s}from"./tool-policy-DDfbFJCQ.js";import{r as c}from"./cli-help-policy-ClfxVVMO.js";function l(e,t){return e.parameters.filter(e=>e.required&&t[e.optionKey]===void 0).map(e=>e.flag)}function u(e,t){return(e.requestBody?.length??0)>1&&typeof t.contentType==`string`?t.contentType:void 0}var d=e=>typeof e==`string`&&e.trim()===``;function f(e,t){let n=new Set([...t.parameters,...(t.requestBody??[]).flatMap(({parameter:e})=>e)].filter(e=>e.required).map(e=>e.optionKey));for(let t of e.options){let r=t.attributeName(),i=e.getOptionValue(r);if(!(Array.isArray(i)?i.some(d):d(i)))continue;let a=Array.isArray(i)?i.filter(e=>!d(e)):[];if(a.length>0){e.setOptionValue(r,a);continue}n.has(r)&&e.error(`error: option '${t.flags}' requires a value`),e.setOptionValue(r,void 0)}}function p(e){return e.split(` `)[0]??e}function m(e){if(e.requestBody===void 0||e.requestBody.length===0){let[t,n]=e.parameters.filter(e=>e.required);return n===void 0&&t?.schemaType===`string`?t:void 0}if(e.requestBody.length!==1||e.parameters.some(e=>e.required))return;let t=e.requestBody[0]?.parameter??[],n=t.filter(e=>e.required);if(n.length===1&&n[0]?.schemaType===`string`)return n[0];if(n.length!==0||e.intent!==`search`)return;let r=t.filter(e=>{let t=e.name.split(`.`).at(-1);return e.schemaType===`string`&&(t===`query`||t===`search`)});return r.length===1?r[0]:void 0}function h(e,t,n){let r=t.join(` `).trim();return r.length===0?a(`No positional text`,n):n[e.optionKey]===void 0?a(`Positional text parsed`,{...n,[e.optionKey]:r}):o(`Unexpected argument "${r}": ${p(e.flag)} already sets this value, and this command has no subcommand by that name. Drop "${r}".`)}var g={agents:{summary:`Deprecated: Answer a Natural-Language Platform Help Question`,section:`cli`},"agents help":{summary:`Deprecated: use help ask (POST /v1/help) with the same body`},auth:{summary:`Sign-in, session, API key, and CLI authorization endpoints`,section:`account`},"auth api-key":{summary:`Get Current API Key`},"auth me":{summary:`Current User Permissions`},"auth me permissions":{summary:`Returns the current caller's resolved roles and permissions`},"auth providers":{summary:`Get the Sign-In Options`},billing:{summary:`Plans, prices, subscription, usage, and upgrades`,section:`account`},"billing additional-usage":{summary:`Update Additional Usage Settings`},"billing ai-credits":{summary:`Read the Current AI Credit Allowance`},"billing checkout-sessions":{summary:`Create or Recover a Checkout Session`},"billing credit-purchases":{summary:`Read a Prepaid Credit Purchase Confirmation`},"billing plan-change-previews":{summary:`Preview a Subscription Plan Change`},"billing plan-changes":{summary:`Change the Subscription Plan`},"billing plans":{summary:`List Subscription Tiers and Plans`},"billing portal-sessions":{summary:`Create a Hosted Billing Portal Session`},"billing subscription":{summary:`Read the Current Billing Subscription`},"billing subscription next-charge":{summary:`Preview the Next Subscription Charge`},"billing subscription payment-profile":{summary:`Read Your Card on File and Introductory Offer`},enrichments:{summary:`Enrich Many Companies and People`,section:`researchData`},entities:{summary:`Companies and funds: people, funding, and news`,section:`researchData`},"entities acquisitions":{summary:`Acquisitions a company made or was part of`},"entities addresses":{summary:`A company's recorded office and headquarters addresses`},"entities blog-posts":{summary:`External blog and article links for entities and people`},"entities brand":{summary:`Get a Company's Names, Logos, Links, and Tags`},"entities classifications":{summary:`Classification tags on a company, and suggested tags`},"entities classifications catalog":{summary:`Get the Company Classification Taxonomy`},"entities classifications suggestions":{summary:`Suggest Classifications for a Company`},"entities classifications tags":{summary:`List Classification Tags`},"entities content":{summary:`Publications about one company or person, and platform-wide publication search`},"entities content facets":{summary:`Count a Company's Publications`},"entities employee-counts":{summary:`List a Company's Headcount Over Time`},"entities enrichments":{summary:`Enrich One Company, Product, or Service`},"entities filters":{summary:`Filter options for company listings: available values, refinement, and option search`},"entities fundraise-investor-joins":{summary:`List the Investors in a Funding Round`},"entities fundraise-rounds":{summary:`List a Company's Funding Rounds`},"entities investments":{summary:`List the Investments a Company Made`},"entities investor-activity":{summary:`Get Investor Activity`},"entities investors":{summary:`List a Company's Investors`},"entities logo":{summary:`Get a Company Logo`},"entities lookup-exact":{summary:`Read Full Entity Detail by aVenture Profile URL, Slug, Website, or Domain`},"entities people":{summary:`People linked to companies, and the role each one holds`},"entities person-investors":{summary:`List Person Investors`},"entities relationships":{summary:`Relationships between companies, investors, and other organizations`},"entities relationships types":{summary:`List Entity Relationship Types`},"entities repositories":{summary:`List a Company's GitHub Repositories`},"entities research":{summary:`Get the Research Gathered About a Company`},"entities research-details":{summary:`List Research Details`},"entities research-details types":{summary:`List the Accepted Research Detail Types`},"entities research-snippets":{summary:`List Research Snippets`},"entities research-snippets types":{summary:`List the Accepted Research Snippet Types`},"entities sec":{summary:`Get SEC EDGAR Facts for a Public Company`},"entities similar":{summary:`Similar companies and lean similar-company summaries by id`},"entities similar summary":{summary:`Get Similar Company Summaries by ID`},"entities slug":{summary:`Get a Company's Slug`},"entities texts":{summary:`Descriptions and other written text for companies and people`},"entities texts types":{summary:`List the Accepted Company Text Types`},"entities trending-news":{summary:`List Trending News About a Company`},"entities types":{summary:`List the Accepted typeRecord Values`},"entities unique-ids":{summary:`External identifiers and the records they name`},"entities urls":{summary:`Websites, social profiles, and other URLs for companies and people`},"entities valuations":{summary:`List a Company's Valuation Over Time`},help:{summary:`Answer a Natural-Language Platform Help Question`,section:`cli`},lookup:{summary:`Read a Company, Product, Service, or Person Identity Without Enrichment`,section:`researchData`},"lookup-from-file":{summary:`Identify a Company, Product, Service, or Person by Name, URL, or ID`,section:`researchData`},"lookup-jobs":{summary:`Async article and bulk name identification`,section:`researchData`},"lookup-mentions":{summary:`Identify Every Company and Person a Page or Screenshot Names`,section:`researchData`},metrics:{summary:`Get Platform Totals for Companies, Funding, and People`,section:`cli`},news:{summary:`News linked to the companies and people in it`,section:`researchData`},"news feedback":{summary:`Submit News Feedback`},"news related-entities":{summary:`List the Entities a News Article Is About`},"news subscriptions":{summary:`List Entity News Subscriptions`},"news subscriptions test-events":{summary:`Send a Test News Event`},"news thumbnail":{summary:`Get News Thumbnail`},people:{summary:`Founders and investors, and what they back`,section:`researchData`},"people addresses":{summary:`A person's recorded addresses`},"people blog-posts":{summary:`External blog and article links for entities and people`},"people content":{summary:`Publications about one company or person, and platform-wide publication search`},"people content facets":{summary:`Count a Person's Publications`},"people enrichments":{summary:`Enrich One Person`},"people entities":{summary:`People linked to companies, and the role each one holds`},"people filters":{summary:`Filter options for people listings and option search`},"people graph":{summary:`Get Person Graph`},"people investments":{summary:`List a Person's Investments`},"people investor-activity":{summary:`Get Person Investor Activity`},"people lookup-exact":{summary:`Read One Person's Full Detail by aVenture Profile URL, Slug, or URL`},"people photo":{summary:`Get Person Photo`},"people repositories":{summary:`List a Person's GitHub Repositories`},"people similar":{summary:`List People Similar to One Person`},"people texts":{summary:`Descriptions and other written text for companies and people`},"people texts types":{summary:`List the Accepted Person Text Types`},"people unique-ids":{summary:`External identifiers and the records they name`},"people urls":{summary:`Websites, social profiles, and other URLs for companies and people`},"research-runs":{summary:`Research requests you file for a company, Product, Service, or person, and their progress`,section:`researchData`},"research-runs presets":{summary:`List Research Presets`},resolve:{summary:`Deprecated: Resolve an Entity or Person by Identifier Token`,section:`researchData`},search:{summary:`Search Companies, People, and News Together`,section:`researchData`},"search link":{summary:`Search From a Page URL`},"search link jobs":{summary:`Get a Link Search Job`},"search natural":{summary:`Find companies and people in natural language`},"search shared":{summary:`Search companies, people, and news, or by URL`},"search shared slug":{summary:`Read a Shared Search by Slug`},"unique-ids":{summary:`External identifiers and the records they name`,section:`researchData`},"unique-ids types":{summary:`List the Accepted Unique Identifier Types`},"url-types":{summary:`List URL Types`,section:`researchData`},web:{summary:`Search companies, people, and news, or by URL`,section:`researchData`},"web searches":{summary:`Get an Async Web Search Job`},"web searches jobs":{summary:"Reads the web-search job a `Prefer: respond-async` search accepted"}};function _(e){return b(e,v())}function v(){return!!i().userBearerToken?.trim()}function y(e){return v()||!c(e,g)}function b(e,t){return t?e:e.filter(e=>!c(e.cliPath[0],g)||e.visibility!==`private`).map(x)}function x(e){let t=e.parameters.filter(S),n=e.requestBody?.map(e=>{let t=e.parameter.filter(S);return t.length===e.parameter.length?e:{...e,parameter:t}}),r=n?.every((t,n)=>t===e.requestBody?.[n]);return t.length===e.parameters.length&&r!==!1?e:{...e,parameters:t,requestBody:n}}var S=e=>e.visibility!==`private`;function C(i,a){let o=i.indexOf(`--`),l=i.slice(0,o===-1?i.length:o);if(l.some(e=>e===`--version`||e===`-V`))return`none`;let d=new n().exitOverride().configureOutput({writeErr:()=>void 0}).addOption(new e(`--environment <environment>`,`route all API calls to a mapped API environment`).choices([...r()])).addOption(new e(`--content-type <media-type>`)).addOption(new e(`--ask <question>`)),f=d.parseOptions([...i]).operands,p=d.opts().environment;p!==void 0&&(process.env.API_ENV=p);let m=a.find(e=>w(f,e.cliPath)),h=m===void 0?void 0:u(m,d.opts());if(m!==void 0&&h!==void 0){let e=s(m.requestBody??[],h);if(!e.ok)throw new t(e.summary)}let _=f.at(0);if(_===void 0)return`stored`;if(_===`update`||_===`auth`&&m===void 0)return`none`;let v=d.opts().ask;return l.some(e=>e===`--help`||e===`-h`)?(m??(_===`help`&&v===void 0?a.find(e=>w(f.slice(1),e.cliPath)):void 0))!==void 0||c(_,g)?`stored`:`none`:c(_,g)?`required`:_===`help`?m===void 0?v===void 0?`stored`:f.length===1?`required`:`none`:`required`:_===`agents`&&f[1]===`setup`?`required`:[`command-catalog`,`completion`].includes(_)?`optional`:_===`batch`?`required`:m===void 0?`optional`:`required`}function w(e,t){return t.every((t,n)=>e[n]===t)}export{g as a,l as c,h as d,_ as i,f as l,C as n,u as o,b as r,p as s,y as t,m as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./startup-auth-DaJp5qea.js";export{e as commandAuthMaterializationMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./commander-BB7CDPLs.js";import{C as t,S as n,T as r,g as i,h as a,l as o,o as s,u as c,v as l,w as u,y as d}from"./person-owner-BJgNYLKX.js";import{c as f,d as p,i as m}from"./result-envelope-CFE7wPAr.js";import{basename as h,extname as ee}from"node:path";import{AsyncLocalStorage as te}from"node:async_hooks";import{readFile as ne}from"node:fs/promises";function g(e){return new URL(e,`https://placeholder.invalid`).pathname}function _(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(re)?!1:n.every((e,t)=>v(e)||e===r[t])}function v(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function re(e){if(v(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var y=new te,b=()=>y.getStore()?.requestId,ie=()=>y.getStore()?.userBearerToken;function ae(e,t){return y.run({...y.getStore(),requestId:e},t)}function oe(e,t){return y.run({...y.getStore(),userBearerToken:e},t)}var x=[`get`,`post`,`put`,`patch`,`delete`],S={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},C=e=>S[e];function se(e){let t=e.toLowerCase(),n=x.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var ce=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],w=t({name:u().regex(/^[A-Z][A-Z0-9_]*$/u)}),T=r([i(`private`),d({scope:u().optional(),value:u().optional()})]),E=a(()=>d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),"x-aventure-parsed-enum":c().optional(),readOnly:c().optional(),items:E.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),properties:n(u(),E).optional(),required:o(u()).optional(),oneOf:o(E).optional(),anyOf:o(E).optional(),allOf:o(E).optional(),propertyNames:E.optional(),additionalProperties:r([E,c()]).optional(),"x-aventure-visibility":T.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":w.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-operation-only":o(u().min(1)).min(1).optional()})),le=d({in:u(),name:u(),required:c().optional(),description:u().optional(),schema:E.optional(),"x-aventure-visibility":T.optional(),"x-aventure-legacy-name":t({name:u().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),D=n(u(),d({schema:E.optional()})),ue=d({description:u().optional(),content:D.optional(),"x-aventure-standard-response":c().optional()}),O=d({description:u().optional(),required:c().optional(),content:D.optional()}),de=t({auth:s([`none`,`read`]).optional()}).optional(),k=r([i(``),u().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),A=t({readOperationId:u().min(1),writePointer:k,readPointer:k}),j=u().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),M=u().regex(/^[a-z][A-Za-z0-9]*$/u),N=u().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),P=t({command:j,role:s(ce),summary:u().trim().min(1).optional(),description:u().trim().min(1).optional(),bodyOption:o(M).min(1).optional(),localOption:o(t({optionKey:M,flag:N,description:u().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),F=d({operationId:u(),summary:u().optional(),description:u().optional(),tags:o(u()).optional(),deprecated:c().optional(),hidden:c().optional(),security:o(n(u(),o(u()))).optional(),parameters:o(le).optional(),requestBody:O.optional(),responses:n(u(),ue),"x-aventure-visibility":T.optional(),"x-aventure-tool":de,"x-aventure-mutation-readback":A.optional(),"x-aventure-cli-composite":P}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),I=d(Object.fromEntries(x.map(e=>[e,F.optional()]))),L=d({$ref:u().optional(),description:u().optional(),type:r([u(),o(u())]).optional(),format:u().optional(),default:p.optional(),enum:o(p).optional(),"x-extensible-enum":o(p).optional(),"x-aventure-parsed-enum":c().optional(),readOnly:c().optional(),items:E.optional(),minItems:l().int().nonnegative().optional(),maxItems:l().int().nonnegative().optional(),oneOf:o(E).optional(),anyOf:o(E).optional(),allOf:o(E).optional(),propertyNames:E.optional(),additionalProperties:r([E,c()]).optional(),properties:n(u(),E).optional(),required:o(u()).optional(),"x-aventure-visibility":T.optional(),"x-aventure-cli-conflicts":o(o(u().min(1)).min(2)).min(1).optional(),"x-aventure-env":w.optional(),"x-aventure-detail":i(!0).optional(),"x-aventure-noun":t({one:u().trim().min(1),other:u().trim().min(1)}).optional()});d({info:d({description:u().optional()}).optional(),tags:o(d({name:u(),description:u().optional()})).optional(),paths:n(u(),I),webhooks:n(u(),d({post:d({description:u(),requestBody:O})})).optional(),components:d({schemas:n(u(),L)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of x){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&B(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var R=new Set([`page`,`size`,`sort`]);function z(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function B(e,t){for(let[n,r]of Object.entries(e))for(let e of x){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function V(e,t,n){let r=g(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&_(n,r))return{method:t,template:n,operation:e}}return null}function H(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function fe(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function pe(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||R.has(r.name))continue;let e=t?.[r.name]??me(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function me(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}var U=3e4;async function he(e,t,n,r){let i=G(W(e.requestBody?.content),n);if(!i.ok||i.data===null)return m(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return m(`Request body is required.`);if(a?.kind===`multipart`)return await ve(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return f(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function ge(e){if(typeof e!=`string`)return f(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return f(`Request body unchanged`,e);try{let t=p.safeParse(JSON.parse(e));if(!t.success)throw t.error;return f(`Request body parsed`,t.data)}catch(e){return m(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function _e(e,t){let n=e?.schema;if(n===void 0)return!1;let r=z(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function W(e){let t=Object.entries(e??{});return[...t.flatMap(e=>Ee(e[0])?[K(e,`json`)]:[]),...t.flatMap(e=>De(e[0])?[K(e,`multipart`)]:[])]}function G(e,t){if(t===void 0)return f(`Default request content selected`,e[0]);let n=Z(t),r=e.find(e=>Z(e.contentType)===n);return r===void 0?m(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):f(`Explicit request content selected`,r)}function K(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function ve(e,t,n){if(!e&&n==null)return f(`Optional multipart body omitted`,{});let r=ye(n);if(!r.ok||r.data===null)return m(r.summary,r.warnings);let i=new FormData;for(let e of be(t)){let t=r.data[e.name];if(t==null){if(e.required)return m(`Multipart body requires '${e.name}'.`);continue}if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return m(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return m(`Multipart part '${e.name}' has too many entries.`);if(q(e.schema)||J(e.schema)){let n=J(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return m(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await Se(t);if(!n.ok||n.data===null)return m(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(xe(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=Y(i,e.name,t);if(!n.ok)return n}}return f(`Multipart body prepared`,{body:i})}function ye(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return f(`Multipart input parsed`,t)}return m(`Multipart request body must be a JSON object keyed by form part name.`)}function be(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function q(e){return e.type===`string`&&e.format===`binary`}function J(e){return e.type===`array`&&e.items!==void 0&&q(e.items)}function xe(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function Y(e,t,n){if(Array.isArray(n)){for(let r of n){let n=Y(e,t,r);if(!n.ok)return n}return f(`Multipart scalar array appended`,null)}return typeof n==`object`?m(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),f(`Multipart scalar appended`,null))}async function Se(e){return Te(e)?await Ce(e):b()===void 0?await we(e):m(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function Ce(e){let t=new AbortController,n=setTimeout(()=>t.abort(),U);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return m(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??X(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return f(`URL media fetched`,{blob:a,filename:h(n.pathname)||`upload`})}catch(e){return t.signal.aborted?m(`Failed to fetch media URL: timed out after ${U}ms.`):m(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function we(e){try{let t=X(e)??``,n=await ne(e);return f(`File media read`,{blob:new Blob([n],{type:t}),filename:h(e)})}catch(t){return m(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function Te(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function X(e){return Oe[ee(e).toLowerCase()]}function Ee(e){let t=Z(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function De(e){return Z(e)===`multipart/form-data`}var Z=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,Oe={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function ke(e,t,n){let r=new Map,i=(t,a,o)=>{let s=z(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=je(e,t);for(let e of[...l.items===void 0?[]:[l.items],...l.oneOf??[],...l.anyOf??[],...l.allOf??[]])i(e,a,c);for(let[e,t]of Object.entries(l.properties??{}))r.set(e,Math.min(r.get(e)??a,a)),i(t,a+1,c)};for(let[e,n]of Object.entries(t))e.startsWith(`2`)&&i(Ae(n.content),0,[]);return r}function Ae(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function je(e,t){let n=z(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function Me(e){return e===`write`||e===`delete`}function Ne(e,t){return e===`DELETE`||t===`delete`}var Pe=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function Fe(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}var Ie={add:`write`,answer:`search`,ask:`search`,attach:`write`,audit:`read`,batch:`lookup`,convert:`write`,create:`write`,delete:`delete`,enrich:`write`,filter:`search`,get:`read`,import:`write`,join:`write`,list:`read`,lookup:`lookup`,merge:`write`,preview:`lookup`,reconcile:`write`,remove:`delete`,replace:`write`,resolve:`lookup`,search:`search`,status:`read`,suggest:`read`,update:`write`,upload:`write`};function Q(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}function Le(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>Re(e.schema)))}function Re(e){return e?.format===`byte`||e?.format===`binary`}function ze(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Be=e=>`--${$(e)}`;export{g as A,pe as C,ie as D,b as E,ae as O,se as S,z as T,x as _,Be as a,fe as b,ze as c,ke as d,ge as f,G as g,_e as h,Fe as i,oe as k,Q as l,W as m,Ie as n,Ne as o,he as p,Le as r,Me as s,Pe as t,$ as u,C as v,V as w,B as x,H as y};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aventurevc/aventure-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.178",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Command-line access to aVenture research data on companies, people, funding, and news.",
|
|
6
6
|
"homepage": "https://docs.aventure.vc/cli",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
},
|
|
34
34
|
"aventurePublicApi": {
|
|
35
35
|
"repository": "aventurevc/aventure-docs",
|
|
36
|
-
"commit": "
|
|
36
|
+
"commit": "807825c8e3919f1ec71a069501e77bf1e6a0204f",
|
|
37
37
|
"openapiPath": "openapi/openapi.json",
|
|
38
|
-
"openapiSha256": "
|
|
38
|
+
"openapiSha256": "b29af193e5994972874220a0116a5084d87fac5912e480fa4a5e749423148c9e"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {}
|
|
41
41
|
}
|
|
@@ -21,11 +21,6 @@ const CLI_BIN_TARGET = "dist/aventure-cli/index.js";
|
|
|
21
21
|
const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
22
22
|
const PACKAGE_CLI_BIN = join(PACKAGE_ROOT, CLI_BIN_TARGET);
|
|
23
23
|
const PACKAGE_JSON = join(PACKAGE_ROOT, "package.json");
|
|
24
|
-
const GITHUB_PACKAGES_REGISTRY = "https://npm.pkg.github.com/";
|
|
25
|
-
// The private package renamed its command away from `aventure-cli`, and loaders are named
|
|
26
|
-
// after commands, so the old private package's managed loaders would outlive it. Only the private
|
|
27
|
-
// package retires them: the public package never shipped `aventure-cli`.
|
|
28
|
-
const RETIRED_PRIVATE_CLI_BINS = ["aventure-cli"];
|
|
29
24
|
|
|
30
25
|
/** @param {string | undefined} value */
|
|
31
26
|
function isTruthy(value) {
|
|
@@ -50,7 +45,6 @@ function resolveConfigHome(env) {
|
|
|
50
45
|
* @typedef {{
|
|
51
46
|
* bin?: Record<string, string>;
|
|
52
47
|
* aventurePublish?: { variants?: { cli?: { bin?: Record<string, string> } } };
|
|
53
|
-
* publishConfig?: { registry?: string };
|
|
54
48
|
* }} InstallerPackageJson
|
|
55
49
|
*/
|
|
56
50
|
|
|
@@ -67,19 +61,6 @@ function cliBins(packageJson) {
|
|
|
67
61
|
);
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
/**
|
|
71
|
-
* Retired bins this package no longer ships. A working tree has no publishConfig and builds the
|
|
72
|
-
* private package.
|
|
73
|
-
*
|
|
74
|
-
* @param {InstallerPackageJson} packageJson
|
|
75
|
-
* @param {readonly string[]} bins
|
|
76
|
-
*/
|
|
77
|
-
function retiredBins(packageJson, bins) {
|
|
78
|
-
const registry = packageJson.publishConfig?.registry ?? GITHUB_PACKAGES_REGISTRY;
|
|
79
|
-
if (registry !== GITHUB_PACKAGES_REGISTRY) return [];
|
|
80
|
-
return RETIRED_PRIVATE_CLI_BINS.filter((bin) => !bins.includes(bin));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
64
|
/** @param {string} value */
|
|
84
65
|
function shellSingleQuote(value) {
|
|
85
66
|
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
@@ -273,7 +254,6 @@ export function main(args = process.argv.slice(2), env = process.env, platformNa
|
|
|
273
254
|
const packageJson = readPackageJson();
|
|
274
255
|
const bins = cliBins(packageJson);
|
|
275
256
|
if (bins.length === 0) return;
|
|
276
|
-
const retired = allTargets(retiredBins(packageJson, bins), env);
|
|
277
257
|
if (args.includes("--status")) {
|
|
278
258
|
for (const target of allTargets(bins, env)) {
|
|
279
259
|
const state = !existsSync(target.file)
|
|
@@ -286,9 +266,7 @@ export function main(args = process.argv.slice(2), env = process.env, platformNa
|
|
|
286
266
|
return;
|
|
287
267
|
}
|
|
288
268
|
if (args.includes("--uninstall")) {
|
|
289
|
-
const removed =
|
|
290
|
-
removeLoader(target.file),
|
|
291
|
-
);
|
|
269
|
+
const removed = allTargets(bins, env).filter((target) => removeLoader(target.file));
|
|
292
270
|
console.log(
|
|
293
271
|
`removed completions: ${[...new Set(removed.map((target) => target.shell))].join(", ") || "none"}`,
|
|
294
272
|
);
|
|
@@ -299,7 +277,6 @@ export function main(args = process.argv.slice(2), env = process.env, platformNa
|
|
|
299
277
|
writeLoader(target.file, target.contents);
|
|
300
278
|
shells.add(target.shell);
|
|
301
279
|
}
|
|
302
|
-
for (const target of retired) removeLoader(target.file);
|
|
303
280
|
console.log(
|
|
304
281
|
`installed completions: ${[...shells].join(", ")} - remove with: ${bins[0]} completion uninstall`,
|
|
305
282
|
);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./logging-Bx9mH20G.js";import{i as n,l as r,o as i,w as a,y as o}from"./person-owner-BJgNYLKX.js";import{a as s,l as c,t as l}from"./env-DRmqwv5y.js";import{a as u}from"./package-DPDX5zmx.js";import{r as d}from"./response-problem-BgnzyNAt.js";import{execFile as f}from"node:child_process";import{dirname as p,join as m}from"node:path";import{homedir as h,platform as g}from"node:os";import{setTimeout as ee}from"node:timers/promises";import{randomUUID as _}from"node:crypto";import{AsyncLocalStorage as te}from"node:async_hooks";import{chmod as ne,mkdir as v,readFile as y,rename as b,rm as x,stat as re,writeFile as S}from"node:fs/promises";function C(e){let t=e.trim();if(t.length===0)throw Error(`API host must not be blank`);let n=new URL(E(t)?t:`${ae(t)}://${t}`),r=D(n.hostname);if(n.protocol!==`https:`&&n.protocol!==`http:`||n.username.length>0||n.password.length>0||n.pathname!==`/`&&n.pathname!==``||n.search.length>0||n.hash.length>0)throw Error(`API host must contain only an HTTP(S) host and optional port`);if(n.protocol===`http:`&&!r)throw Error(`stored credentials require HTTPS except for loopback API hosts`);return{host:n.host.toLowerCase(),origin:n.origin,isLoopback:r}}function w(e){let t=C(e);return t.isLoopback?C(s()).host:t.host}function T(e){return{...e,host:C(e.host).origin}}function ie(e){let t=C(e);if(t.isLoopback)return`http://localhost:3000`;if(t.host===`api.aventure.vc`)return`https://aventure.vc`;throw Error(`no first-party browser origin is configured for API host ${t.host}`)}function E(e){return/^[a-z][a-z\d+.-]*:\/\//iu.test(e)}function ae(e){let t=e.split(`/`,1)[0]?.toLowerCase()??``;try{return D(new URL(`http://${t}`).hostname)?`http`:`https`}catch{return`https`}}function D(e){let t=e.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`0.0.0.0`||t===`[::1]`}var O=o({createdAt:n({offset:!0}),description:a().nullish(),expiresAt:n({offset:!0}).nullish(),id:a().regex(/^ak_[0-9A-Fa-f]{32}$/),lastUsedAt:n({offset:!0}).nullish(),name:a(),revocationReason:a().nullish(),scopes:r(a()),status:i([`ACTIVE`,`REVOKED`,`EXPIRED`]),subject:a(),updatedAt:n({offset:!0})});function k(e,t=[]){let n=e instanceof Error?e.message:String(e);return d(n,t)}function oe(e,t=[]){let n=d(e.title,t),r=d(e.detail?.trim()??``,t);return`${e.status} ${n}${r?` — ${r}`:``}`}function se(){if(g()===`win32`){let e=process.env.APPDATA??m(h(),`AppData`,`Roaming`);return m(e,`aventure`,`config.json`)}let e=process.env.XDG_CONFIG_HOME??m(h(),`.config`);return m(e,`aventure`,`config.json`)}function ce(){let e=process.env[l.authToken];return typeof e==`string`&&e.length>0?{present:!0,source:`env`}:{present:!1,source:null}}function A(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}var le=2;function ue(e,t){return M(e,t).redactedUrl}async function de(e,t,n){let r=M(e,t);return await j(new URL(r.openerUrl),n)}async function j(e,t){let n=t.environment??process.env,r=t.operatingSystem??g(),i=N(t.noBrowser,n,r);if(i!==null)return{state:`skipped`,reason:i};let a=fe(r,e.toString());if(a===null)return{state:`failed`,reason:`unsupported browser-opening platform: ${r}`};try{return await pe(a.command,a.arguments),{state:`opened`,reason:null}}catch{return{state:`failed`,reason:`browser opener failed`}}}function M(e,t){let{id:n,verificationUrl:r,pollSecret:i}=e,a,o;try{a=new URL(r),o=new URL(t)}catch{throw Error(`broker returned an invalid browser verification URL`)}if(o.username.length>0||o.password.length>0||o.pathname!==`/`||o.search.length>0||o.hash.length>0)throw Error(`configured browser origin must contain only an origin`);let s=D(o.hostname);if(o.protocol!==`https:`&&!(o.protocol===`http:`&&s))throw Error(`configured browser origin must use HTTPS except for loopback development`);let c=new URLSearchParams(a.hash.slice(1)),l=[...c.keys()],u=c.getAll(`cliAuthorizationId`),d=c.getAll(`browserSecret`),f=d[0]??``;if(a.origin!==o.origin||a.protocol!==o.protocol||a.username.length>0||a.password.length>0||a.pathname!==`/settings/developer`||a.search.length>0||l.length!==le||u.length!==1||u[0]!==n||d.length!==1||f.length===0||i.length===0||f===i)throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let p;try{p=decodeURIComponent(r)}catch{throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`)}if(r.includes(i)||p.includes(i))throw Error(`broker returned a browser verification URL outside the configured first-party approval flow`);let m=new URL(a);return m.hash=new URLSearchParams({cliAuthorizationId:n,browserSecret:`<redacted>`}).toString(),{openerUrl:r,redactedUrl:m.toString()}}function N(e,t,n){return e?`--no-browser was set`:n===`darwin`&&t.CODEX_SESSION_ID?`macOS Codex browser process boundary`:t.SSH_CONNECTION||t.SSH_CLIENT||t.SSH_TTY?`SSH/headless session detected`:(n===`linux`||n===`freebsd`)&&!t.DISPLAY&&!t.WAYLAND_DISPLAY?`no graphical display detected`:null}function fe(e,t){return e===`darwin`?{command:`open`,arguments:[t]}:e===`win32`?{command:`rundll32.exe`,arguments:[`url.dll,FileProtocolHandler`,t]}:e===`linux`||e===`freebsd`?{command:`xdg-open`,arguments:[t]}:null}function pe(e,t){return new Promise((n,r)=>{f(e,[...t],{timeout:5e3,windowsHide:!0},e=>e?r(e):n())})}var me=100,he=3e4,ge=6e4,P=new te;function F(){return m(p(se()),`credentials.json`)}function I(e){return`OS keyring is unusable (${e}); the credential will be stored in ${F()} (mode 0600).\n`}async function L(e,t){let n=(await W())[e]?.[t];if(n!==void 0)return{record:{provider:`file`,value:n}};try{let n=await(await U(e,t)).getPassword()??void 0;return n===void 0?{}:{record:{provider:`keyring`,value:n}}}catch(e){return{keyringFailure:H(e)}}}async function R(e,t,n){if((await W())[e]?.[t]!==void 0)return await z(e,t,n,`file store holds this account`);let r;try{let i=await U(e,t);if(await i.setPassword(n),await i.getPassword()===n)return await q(e,t,void 0),`keyring`;r=`Error: keyring readback did not match`}catch(e){r=H(e,[n])}return await z(e,t,n,r)}async function z(e,t,n,r){if(await q(e,t,n),(await W())[e]?.[t]!==n)throw Error(`credential storage did not confirm a durable write (keyring: ${r}; file: readback did not match)`);return`file`}async function B(e,t){try{let n=await U(e,t),r;try{await n.deleteCredential()}catch(e){r=e}let i;try{i=await n.getPassword()??void 0}catch(e){throw Error(`OS keyring removal outcome is unknown (${H(r??e)})`,{cause:e})}if(i!==void 0)throw Error(`OS keyring did not confirm removal (${H(r)})`,r===void 0?void 0:{cause:r})}finally{await q(e,t,void 0)}}async function V(e,t){let n=`${t}:probe:${_()}`,r=`aventure-cli-credential-probe:${_()}`,i;try{let t=await U(e,n);await t.setPassword(r);let a=await(await U(e,n)).getPassword(),o=await t.deleteCredential(),s=await(await U(e,n)).getPassword()??void 0;if(a!==r)i=`Error: probe readback did not match`;else if(!o||s!==void 0)i=`Error: probe cleanup was not confirmed`;else return{provider:`keyring`}}catch(e){i=H(e,[r])}try{await K(async()=>{await q(e,n,r);let t=(await W())[e]?.[n];if(await q(e,n,void 0),t!==r)throw Error(`probe readback did not match`)})}catch(e){throw Error(`credential storage is unavailable (keyring: ${i}; file ${F()}: ${H(e,[r])})`,{cause:e})}return{provider:`file`,keyringFailure:i}}function H(e,t=[]){if(!(e instanceof Error))return`Error`;let n=e.name||`Error`,[r=``]=k(e,t).trim().split(`
|
|
2
|
-
`,1);return r&&r!==n?`${n}: ${r}`:n}async function U(e,t){let n=g(),r=n===`linux`||n===`freebsd`?N(!1,process.env,n):null;if(r!==null)throw Error(`OS keyring unlock prompt is unreachable (${r})`);let{AsyncEntry:i}=await import(`@napi-rs/keyring`);return new i(e,t)}async function W(){let e=F(),t;try{t=await y(e,`utf8`)}catch(e){if(A(e,`ENOENT`))return{};throw e}let n;try{n=JSON.parse(t)}catch(t){return await G(e,t)}return ve(n)?n:await G(e,void 0)}async function G(t,n){let r=`${t}.corrupt-${new Date().toISOString().replace(/[:.]/gu,`-`)}`;try{await b(t,r)}catch(e){if(A(e,`ENOENT`))return{};throw Error(`${t} is not a valid credential file and could not be moved aside`,{cause:e})}return e({component:u().bin[0],event:`credential_file_quarantined`,message:`${t} is not a valid credential file; moved it to ${r} and continuing with an empty file store`,...n===void 0?{}:{error:n}}),{}}async function K(e){if(P.getStore()===!0)return await e();let t=`${F()}.lock`;await v(p(t),{recursive:!0,mode:448});let n=Date.now()+he,r=_();for(;;){try{await S(t,r,{flag:`wx`,mode:384});break}catch(e){if(!A(e,`EEXIST`))throw e}if(await re(t).then(e=>Date.now()-e.mtimeMs,()=>0)>ge)await x(t,{force:!0});else if(Date.now()>n)throw Error(`credential store is locked by another CLI process (${t})`);else await ee(me)}try{return await P.run(!0,e)}finally{await y(t,`utf8`).catch(()=>``)===r&&await x(t,{force:!0})}}async function q(e,t,n){await K(async()=>await _e(e,t,n))}async function _e(e,t,n){let r=F(),i=await W(),a={...i[e]};if(n===void 0?delete a[t]:a[t]=n,Object.keys(a).length===0?delete i[e]:i[e]=a,Object.keys(i).length===0){await x(r,{force:!0});return}await v(p(r),{recursive:!0,mode:448});let o=`${r}.${_()}.tmp`;await S(o,`${JSON.stringify(i,null,2)}\n`,{mode:384}),await ne(o,384),await b(o,r)}function ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.values(e).every(e=>typeof e==`string`))}var J=`vc.aventure.aventure-cli`,Y=`aventure-cli-personal-v1`;async function ye(e,t,n){let r=w(e),i=Se(t,n),a;try{a=await R(J,r,i)}catch(e){throw Error(`${k(e,[i,t.secret])}; broker acknowledgment was withheld. Re-run auth status before retrying.`,{cause:e})}return{host:r,provider:a,activation:n,credential:t}}async function X(e){let t=w(e),n;try{n=await L(J,t)}catch(e){return Z(k(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,...Ce(r.value)}}}async function be(e){let t=await X(e);if(t.state!==`missing`)return t;try{let{keyringFailure:t}=await V(J,w(e));return t===void 0?{state:`missing`}:{state:`missing`,keyringFailure:t}}catch(e){return Z(k(e))}}async function xe(e){await B(J,w(e))}function Z(e){return{state:`unavailable`,summary:e,cause:`storage`}}function Se(e,t){return`${Y}:${t}\n${JSON.stringify(e.apiKey)}\n${e.secret}`}function Ce(e){let t=e.indexOf(`
|
|
3
|
-
`),n=t<0?-1:e.indexOf(`
|
|
4
|
-
`,t+1),r=t<0?e:e.slice(0,t),i=r===`${Y}:active`?`active`:`pending`;if(t<0||n<0||r!==`${Y}:pending`&&r!==`${Y}: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=O.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}}}async function we(n){if(Q())return;let r=w(c().host);try{let e=await X(r);if(e.state===`unavailable`){t($(`keyring`,Error(e.summary)));return}e.state===`found`&&e.stored.activation===`active`&&!Q()&&(process.env[l.authToken]=e.stored.credential.secret,n?.(`api-key`))}catch(t){e($(`parse`,t))}}function Q(){return(process.env[l.authToken]?.trim().length??0)>0}function $(e,t){return{component:u().bin[0],event:`api_key_materialization_unavailable`,message:`saved API key could not be loaded; continuing with environment auth`,fields:{source:e},error:t}}export{T as S,oe as _,ye as a,C as b,V as c,R as d,j as f,k as g,ce as h,X as i,L as l,ue as m,xe as n,B as o,de as p,be as r,I as s,we as t,K as u,O as v,w as x,ie as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./api-key-bearer-credential-DThHZp3d.js";export{e as materializeCliApiKeyBearerCredential};
|