@aventurevc/aventure-cli 0.7.302 → 0.7.328
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/README.md +6 -4
- package/dist/aventure-cli/command-catalog.compact.txt +121 -106
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +914 -1420
- package/dist/chunks/auth-B_0cUOPk.js +114 -0
- package/dist/chunks/aventure-cli-DaJTB05k.js +74 -0
- package/dist/chunks/detail-D4XYLrLh.js +1 -0
- package/dist/chunks/index.node-Dqukns1W.js +1 -0
- package/dist/chunks/oauth-bearer-credential-C-EZmWvX.js +4 -0
- package/dist/chunks/oauth-login-C3Cr4IJb.js +1 -0
- package/dist/chunks/oauth-login-qlqzOJeW.js +6 -0
- package/dist/chunks/openapi-commands-C70h-zCn.js +1 -0
- package/dist/chunks/{person-owner-ChqQWHII.js → person-owner-BqBLyw4S.js} +5 -4
- package/dist/chunks/text-field-_7ZvrzAF.js +1 -0
- package/dist/chunks/text-response-DDwkjRpA.js +5 -0
- package/package.json +3 -3
- package/scripts/install-zsh-completion-loader.mjs +37 -4
- package/dist/chunks/auth-BSlYTFnP.js +0 -114
- package/dist/chunks/aventure-cli-CTuT5oFj.js +0 -73
- package/dist/chunks/detail-DeMsv_6C.js +0 -1
- package/dist/chunks/index.node-BLqj0Ipp.js +0 -1
- package/dist/chunks/mcp-generation-contract-BAgQo1bp.js +0 -4
- package/dist/chunks/oauth-credential-BnJutDiR.js +0 -2
- package/dist/chunks/oauth-login-BVlbsAdy.js +0 -1
- package/dist/chunks/oauth-login-ZPvGlkQO.js +0 -5
- package/dist/chunks/openapi-commands-BekuCdC5.js +0 -3
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import{C as e,D as t,_ as n,a as r,k as i,v as a,x as o}from"./person-owner-ChqQWHII.js";import{$ as s,A as c,B as l,C as u,Ct as d,D as f,E as p,F as m,J as h,M as g,N as ee,P as te,Q as ne,R as re,S as ie,T as ae,W as _,X as v,Y as oe,Z as se,b as ce,c as le,et as ue,f as de,g as fe,h as pe,it as y,k as me,l as b,m as he,nt as ge,o as _e,p as ve,rt as x,s as ye,tt as S,v as be,x as xe}from"./auth-BSlYTFnP.js";import{E as Se,T as C,_ as Ce,a as we,c as Te,f as Ee,i as De,l as Oe,m as ke,o as Ae,r as je,t as Me,w as Ne,x as Pe}from"./oauth-credential-BnJutDiR.js";import{C as Fe,S as Ie,_ as Le,a as Re,b as ze,c as Be,d as Ve,f as He,g as Ue,h as We,l as Ge,m as Ke,n as qe,o as w,p as Je,r as T,s as Ye,t as E,u as Xe,v as Ze,x as Qe,y as $e}from"./openapi-commands-BekuCdC5.js";import{a as et,f as tt,i as nt,l as rt,n as it,r as at,s as ot,t as st}from"./mcp-generation-contract-BAgQo1bp.js";import{a as ct,n as lt,o as ut,r as dt,t as ft}from"./oauth-login-ZPvGlkQO.js";import{spawnSync as pt}from"node:child_process";import{createHash as mt,webcrypto as ht}from"node:crypto";import{readFile as gt}from"node:fs/promises";import{homedir as _t,hostname as vt,platform as yt}from"node:os";import{basename as bt,dirname as D,join as O,resolve as k,sep as xt}from"node:path";import A,{stderr as j,stdin as St}from"node:process";import{appendFileSync as Ct,copyFileSync as wt,existsSync as M,lstatSync as Tt,mkdirSync as Et,mkdtempSync as Dt,readFileSync as N,readlinkSync as Ot,realpathSync as kt,renameSync as At,rmSync as jt,rmdirSync as Mt,unlinkSync as Nt,writeFileSync as P}from"node:fs";import{fileURLToPath as Pt}from"node:url";import{TextDecoder as Ft,inspect as It}from"node:util";import{setTimeout as Lt}from"node:timers/promises";import{createInterface as Rt}from"node:readline/promises";function zt(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{...x(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return y(`Environment-bound options applied`,r)}function Bt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!en(n,r.name))continue;let a=$t(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function Vt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function Ht(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return an(e,t,n);for(let[r,i]of n.entries()){let n=an(e,t,i,r);if(!n.ok)return n}return y(`Body value assigned`,null)}function Ut(e,t,n,r){return an(e,t,r,n)}function Wt(e){let t=[];for(let n of e.split(`.`)){let e=sn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Gt(e,t){let n=Wt(t);if(n===null)return null;let r=Qt(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:Zt(r)}:null}function Kt(e,t){if(F(e.name)||e.schemaType===`array`)return y(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return y(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?y(`Scalar body option selected`,t[0]):x(`${n} was already given; pass it once.`)}var qt=/^(?<row>\d+):(?<item>.*)$/su;function Jt(e,t){let n=Wt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=qt.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function Yt(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Wt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function Xt(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=Gt(r,i.name);if(a===null)continue;if(a.firstHole!==null)return x(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||Jt(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return x(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function Zt(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function Qt(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function $t(e,t){if(!F(t))return Qt(e,t.split(`.`))}function en(e,t){return nn(e,t.split(`.`))}function tn(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&en(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function nn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=sn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>nn(e,r)):nn(a,r)}function F(e){return e.split(`.`).some(e=>sn(e).isArray)}function rn(e,t){return e.parameter.length===0||!I(t)?null:ln(t,[],cn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function an(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=sn(o),c=e===i.length-1,l=on(a,s,t,c,n,r);if(!l.ok||l.data===null)return x(l.summary,l.warnings);if(c)return y(`Body value assigned`,null);a=l.data}return x(`${t} is not a valid body option path.`)}function on(e,t,n,r,i,a){let o=()=>x(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,y(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,y(`Body path created`,e)}return I(c)?y(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,y(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,y(`Body path created`,n)}return I(s)?y(`Body path stepped`,s):o()}function sn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function cn(e){let t=new Set,n=new Set,r=new Map;for(let i of e){let e=`${i.name}${i.schemaType===`array`?`[]`:``}`;t.add(e),r.set(e,i.flag.split(` `)[0]??i.name);let a=e.split(`.`);for(let e=1;e<a.length;e+=1)n.add(a.slice(0,e).join(`.`))}return{leaf:t,prefix:n,flagByLeaf:r}}function ln(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=ln(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!un(a,n)){if(!dn(e))continue;return{path:a,suggestion:fn(e,n)}}let o=ln(i,e,n);if(o!==null)return o}return null}function un(e,t){return t.prefix.has(e)||t.leaf.has(e)}function dn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function fn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``,[i]=[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:pn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path));if(i!==void 0)return{path:i.path,flag:t.flagByLeaf.get(i.path)??i.path}}function pn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function mn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&t.helpGroup(Je(e))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?Sn(r,i):r===void 0?i===void 0?0:1:-1})}function hn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function gn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function _n(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:bn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function vn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function yn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?Ke(n):`${Ke(n)} Required JSON paths: ${r.join(`, `)}.`}function bn(e,t){return`${Ve(t.description,void 0)}${e.kind!==`multipart`&&F(t.name)?` Repeat to add another value.`:``}${xn(e,t)}`}function xn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Wt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function Sn(e,t){return He(e)-He(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Cn(e){let t;try{t=e===`-`?await wn():await gt(e,`utf8`)}catch(t){return x(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return y(`No input provided`,null);let e=JSON.parse(t);return y(`Input parsed`,e)}catch(e){return x(`Input is not valid JSON: ${e.message}`)}}async function wn(){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 Tn=`--content-type`;function En(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(Tn)){let t=i.map(({contentType:e})=>e);e.addOption(new f(`${Tn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(On(i)))}if(qn(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new f(`--from-file <path>`,yn(n,n.requiredPath)).argParser(An(`--from-file`)))}let a=hn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>Sn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new f(gn(t),i.length>1?_n(t):bn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?vn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Dn):F(r.name)||r.schemaType===`array`?a.argParser(kn):a.argParser(An(r.flag)),e.addOption(a)}Kn(e,t,a)}function Dn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function On(e){return(t,n)=>{if(n!==void 0)throw new me(`${Tn} was already given; pass it once.`);let r=ae(e,t);if(!r.ok)throw new me(r.summary);return t}}function kn(e,t){return[...t??[],e]}function An(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new me(`${t} was already given; pass it once.`);return e}}async function jn(e,t){let n=typeof t.contentType==`string`?t.contentType:void 0,r=ae(e.requestBody??[],n);if(!r.ok||r.data===null)return x(r.summary,r.warnings);let i=r.data;if(i===void 0)return y(`No body`,void 0);let a=Mn(e,i,t);if(a!==null)return x(a);let o=zt(e.operationId,i,t);if(!o.ok)return x(o.summary,o.warnings);t=o.data;let s=Nn(i,t);if(s!==null)return x(s);let c=await Ln(t);if(!c.ok)return x(c.summary,c.warnings);let l=tn(e.requestBody??[],i,c.data);if(l!==null)return x(l);let u=In(e.operationId,i,c.data);if(!u.ok)return u;let d=Bt(e.operationId,i,c.data);if(d!==null)return x(d);let f=Rn(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?x(Gn(e.operationId,i)):y(`No body`,void 0);let p=Bn(e.operationId,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return x(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return x(`${e.operationId} requires a JSON object${t}.`)}let m=Fn(i,p.data);if(m.length>0)return x(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,g=I(h)?Vt(i).filter(e=>!en(h,e)):[];return g.length>0?x(Pn(e.operationId,i,g)):p}function Mn(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`${L(t)} requires ${Tn} ${i.join(` or `)}.`}return null}function Nn(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 Pn(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 Fn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!en(t,e.name)).map(L):[]}function In(e,t,n){let r=rn(t,n);if(r===null)return y(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion.path} (${r.suggestion.flag}).`;return x(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Ln(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return y(`No body file`,void 0);let n=await Cn(t);if(!n.ok)return x(n.summary,n.warnings);let r=d.safeParse(n.data);return r.success?y(`Input parsed`,r.data):x(`Input is not valid JSON value: ${r.error.message}`)}function Rn(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=Kt(e,n[e.optionKey]);if(!a.ok||a.data===null)return x(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=zn(t,n,r,e,o);if(!s.ok)return x(s.summary,s.warnings);i=!0}if(!i)return y(`No direct body options`,void 0);let a=Xt(e,t,n,r);return a===null?y(`Direct body options parsed`,r):a}function zn(e,t,n,r,i){let a=Jt(r,i);if(a===null){let e=Un(r,i);return e.ok?Ht(n,r.name,e.data,r.schemaType===`array`):x(e.summary,e.warnings)}if(a.plain.length>0)return x(`${L(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=Yt(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return x(`${L(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=Wn(r.name,r.itemSchemaType,e);if(!t.ok)return x(t.summary,t.warnings);i.push(t.data)}let a=Ut(n,r.name,e,i);if(!a.ok)return a}return y(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function Bn(e,t,n){if(t===void 0)return y(`Direct body parsed`,n);if(n===void 0)return y(`Input parsed`,t);if(I(t)&&I(n))try{return y(`Input parsed`,Vn(t,n))}catch(t){return x(`${e} ${t.message}`)}return x(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function Vn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&Hn(t)!==Hn(r))throw Error(`cannot combine --from-file ${Hn(t)} '${e}' with ${Hn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=I(t)&&I(r)?Vn(t,r):r}return n}function Hn(e){return Array.isArray(e)?`array`:I(e)?`object`:`scalar`}function Un(e,t){if(typeof t==`boolean`)return y(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Wn(e.name,e.schemaType,t??``);let n=[],r=F(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Wn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return y(`Body value parsed`,n)}function Wn(e,t,n){if(t===`boolean`)return n===`true`?y(`Body value parsed`,!0):n===`false`?y(`Body value parsed`,!1):x(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?x(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?x(`${e} must be an integer.`):y(`Body value parsed`,i)}return y(`Body value parsed`,n)}function Gn(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(L).join(`, `)}`;let r=Vt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Kn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Tn,location:`body`}),qn(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),mn(e.options,r)}function qn(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function Jn(e){let t=ge(e);return tr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function Yn(e){tr(e);let t=it(e.data,e.summary);if(e.ok&&t!==null){process.stdout.write(t.endsWith(`
|
|
2
|
-
`)?t:`${t}\n`),Xn(e);return}let n=e.ok?`OK`:`FAIL`;process.stdout.write(`[${n}] ${e.summary}\n`),!e.ok&&e.problem!==void 0&&Qn(e.problem),Xn(e)}function Xn(e){e.ids.length>0&&process.stdout.write(` ids: ${e.ids.join(`, `)}\n`);for(let[t,n]of Object.entries(e.counts))process.stdout.write(` ${t}: ${n}\n`);for(let t of e.references)process.stdout.write(` ref: ${t}\n`);if(e.truncation!==void 0){let t=e.truncation.omitted.join(`, `);process.stdout.write(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${t}\n`),process.stdout.write(` recovery: ${e.truncation.recovery}\n`)}for(let t of e.warnings)process.stdout.write(` warn: ${t}\n`)}function R(e,t){if(e.mode===`data`||e.mode===`data-full`){let n=e.mode===`data`?ge(t):t;tr(n),process.stdout.write(`${JSON.stringify(n.ok&&n.truncated!==!0?Zn(n.data):n)}\n`),n.ok||(process.exitCode=1);return}let n=e.mode===`json`?Jn(t):t;e.mode===`text`&&Yn(n),n.ok||(process.exitCode=1)}function Zn(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 Qn(e){typeof e.code==`string`&&process.stdout.write(` code: ${e.code}\n`),typeof e.detail==`string`&&process.stdout.write(` detail: ${e.detail}\n`),typeof e.hint==`string`&&process.stdout.write(` hint: ${e.hint}\n`),typeof e.suggestion==`string`&&process.stdout.write(` suggestion: ${e.suggestion}\n`);let t=Object.entries(e.suggestions??{});if(t.length>0){let e=t.map(([e,t])=>`${e}=${t}`).join(`; `);process.stdout.write(` suggestions: ${e}\n`)}$n(`unknownParameters`,e.unknownParameters),$n(`validParameters`,e.validParameters),er(e.resolution)}function $n(e,t){t!=null&&t.length>0&&process.stdout.write(` ${e}: ${t.join(`, `)}\n`)}function er(e){if(e==null)return;let t=[`action=${e.action}`];typeof e.parameter==`string`&&t.push(`parameter=${e.parameter}`),typeof e.fieldPath==`string`&&t.push(`fieldPath=${e.fieldPath}`),typeof e.endpoint==`string`&&t.push(`endpoint=${e.endpoint}`),e.acceptedValue!==null&&e.acceptedValue!==void 0&&e.acceptedValue.length>0&&t.push(`acceptedValue=${e.acceptedValue.join(`, `)}`),typeof e.retryable==`boolean`&&t.push(`retryable=${e.retryable}`),process.stdout.write(` resolution: ${t.join(` `)}\n`)}function tr(e){e.ok&&e.warnings.length===0||l({component:`aventure-cli`,event:e.ok?`command_warning`:`command_failed`,message:e.warnings.length>0?e.warnings.join(` | `):e.summary,fields:{warningCount:e.warnings.length,summary:e.summary}})}function nr(e,t,n=h().bin[0]){let r=t.length,i=ot(e.q?.trim()??``),a=et(i),o=rt(i),s=ar(t,n).filter(t=>lr(t,e)).map(e=>({operation:e,score:dr(i,a,o,e)})).filter(({score:e})=>i===``||e>0).toSorted((e,t)=>t.score-e.score||e.operation.cli.command.localeCompare(t.operation.cli.command)||e.operation.operationId.localeCompare(t.operation.operationId)).map(({operation:e})=>e),c=gr(e.limit,s.length),l=s.slice(0,c);return y(`Operation catalog matches`,{operation:l,count:{totalOperations:r,matched:s.length,returned:l.length}})}function rr(e,t,n=h().bin[0]){let r=ar(t,n),i=e.operationId===void 0?ir(r,e.command):r.find(t=>t.operationId===e.operationId);return i===void 0?x(`Generated operation not found`,[`List candidates with \`${n} command-catalog search "<text>"\`.`]):y(`Generated operation detail`,{operation:i,usage:_r(i)})}function ir(e,t){if(t===void 0)return;let n=Er(t);return e.find(e=>Er(e.cli.command)===n||e.cli.alias!==null&&Er(e.cli.alias)===n)}function ar(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>or(e)),...n.flatMap(e=>e.parameter.map(t=>or(t,n.length>1?e.contentType:void 0))),...sr(n)],i=[t,...e.cliPath,...e.mode?[xe(e.mode)]:[]].join(` `),a=e.cliAliasPath===void 0?null:`${t} ${e.cliAliasPath.join(` `)}`,o=ie(e.intent),s=e.method===`DELETE`||e.intent===`delete`,c=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:o,destructive:s,auth:e.auth,cli:{command:i,path:e.cliPath,alias:a,aliasPath:e.cliAliasPath??null},mcpTool:e.binaryResponse?null:u(e.intent),body:{hasBody:c!==void 0,kind:c?.kind??null,...c!==void 0&&n.length>1?{contentType:c.contentType}:{},required:c?.required??!1,description:c?.description??``,requiredPath:c?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,summary:e.summary,description:e.description}})}function or(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function sr(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request content type; omit for ${t[0]}.`,choices:t}]}function cr(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}function lr(e,t){return!(t.root!==void 0&&!ur(e,t.root)||t.scope!==void 0&&t.scope!==`all`&&t.scope!==e.scope||t.mutates!==void 0&&t.mutates!==`any`&&t.mutates===`true`!==e.mutates||t.destructive!==void 0&&t.destructive!==`any`&&t.destructive===`true`!==e.destructive||t.intent!==void 0&&t.intent!==`all`&&t.intent!==e.intent||t.method!==void 0&&t.method!==`all`&&t.method!==e.method)}function ur(e,t){let n=ot(t);return n.length===0||ot(e.cli.path.at(0)??``)===n||ot(e.cli.aliasPath?.at(0)??``)===n}function dr(e,t,n,r){if(e.length===0)return 1;let i=pr(r),a=fr(e,t,i,{exactQuery:120,partialQuery:60,exactToken:18,partialToken:6})+fr(e,t,mr(r),{exactQuery:12,partialQuery:6,exactToken:2,partialToken:1});nt(n,i)&&(a+=200);for(let e of r.cli.path){let n=new Set;at(n,e),[...n].some(e=>t.has(e))&&(a+=15)}return ot(r.cli.command).endsWith(e)&&(a+=40),a}function fr(e,t,n,r){let i=0;n.includes(e)&&(i+=r.exactQuery),n.some(t=>t.includes(e))&&(i+=r.partialQuery);for(let e of t)n.includes(e)?i+=r.exactToken:n.some(t=>t.includes(e))&&(i+=r.partialToken);return i}function pr(e){return hr([e.operationId,e.cli.command,e.cli.alias??``,e.summary])}function mr(e){return hr([e.method,e.path,e.resource,e.intent,e.scope,e.mutates?`mutates mutation write`:`read only no mutation`,e.destructive?`destructive delete`:`non destructive`,e.mcpTool??``,e.body.kind??``,e.body.description,e.body.requiredPath.join(` `),e.description,...e.flags.flatMap(e=>[e.name,e.optionKey,e.wireName,e.description,e.choices.join(` `)])])}function hr(e){return e.map(ot).filter(e=>e.length>0)}function gr(e,t){if(e===void 0)return t;let n=Number(e);return Number.isFinite(n)?Math.max(0,Math.trunc(n)):t}function _r(e){let t=cr(e),n=t.filter(e=>e.required),r=t.filter(e=>!e.required);return[`cli: ${e.cli.command}`,e.cli.alias===null?``:`alias: ${e.cli.alias}`,`${e.method} ${e.path}`,`operationId: ${e.operationId}`,`resource: ${e.resource}`,`intent: ${e.intent}`,`scope: ${e.scope}`,`mutates: ${e.mutates}`,`destructive: ${e.destructive}`,`mcpTool: ${e.mcpTool??`unavailable (binary CLI operation)`}`,e.body.hasBody?`body: kind=${e.body.kind??`unknown`} required=${e.body.required} requiredPath=${e.body.requiredPath.join(`,`)}`:`body: none`,z(`required path flags`,n,`path`),z(`required query flags`,n,`query`),z(`required header flags`,n,`header`),z(`required body flags`,n,`body`),z(`optional path flags`,r,`path`),z(`optional query flags`,r,`query`),z(`optional header flags`,r,`header`),z(`optional body flags`,r,`body`),...Sr(e),...vr(e.errorResponse),``,e.summary,e.description].filter(e=>e.length>0).join(`
|
|
3
|
-
`)}function vr(e){return e.length===0?[]:[`Errors:`,...e.map(({status:e,description:t})=>` ${e} ${t}`)]}var yr=[`-id`,`-slug`,`-url`],br=[`--id`,`--slug`,`--url`],xr=`--from-file "<path>"`;function Sr(e){return[`example: ${[e.cli.command,...Cr(e),`--data`].join(` `)}`]}function Cr(e){let t=cr(e).filter(e=>e.required),n=(t.length>0?t:wr(e)).map(Tr);return(e.body.required||e.body.requiredPath.length>0)&&!t.some(e=>e.location===`body`)?[...n,xr]:n}function wr(e){let t=new Set;at(t,e.resource);for(let n of yr)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of br){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function Tr(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}function z(e,t,n){let r=t.filter(e=>e.location===n);return`${e}: ${r.length===0?`none`:r.map(e=>e.name).join(` `)}`}function Er(e){return e.trim().replace(/^aventure(?:-cli)?\s+/u,``).replaceAll(/\s+/gu,` `)}function Dr(e,t,n=h().bin[0]){e.helpCommand(!1);let r=e.commands.find(e=>e.name()===`help`)??e.command(`help`);r.summary(`Show command help, or ask a grounded question`).description([`Show local --help output for a command path (deterministic, offline),`,`or answer a natural-language platform question with --ask via the grounded`,"help operation (the same generated operation as `help ask`)."].join(`
|
|
4
|
-
`)).argument(`[command...]`,"command path to show help for, e.g. `help search entities`"),r.addOption(new Or(r));let i=Ar(t);i!==void 0&&r.option(`--ask <question>`,i.summary),T(r),r.action(async function(t){let r=this.optsWithGlobals();if(r.help&&t.length===0){this.outputHelp();return}if(!r.help&&i!==void 0&&r.ask!==void 0){let e=w(r);if(t.length>0){R({mode:e},x(`Use either a command path or --ask, not both.`));return}R({mode:e},await Mr(i,r.ask,r.environment,e));return}let a=jr(e,t);a===void 0&&this.error(`unknown command '${t.join(` `)}' (run \`${n} --help\` for the command tree)`),a.outputHelp()}),kr(e,t)}var Or=class extends f{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))}};function kr(e,t){let n=new Set;for(let r of t){let t=vr(r.errorResponse);if(t.length!==0)for(let i of[r.cliPath,r.cliAliasPath]){let r=i===void 0?void 0:jr(e,i);r===void 0||n.has(r)||(n.add(r),r.addHelpText(`after`,`\n${t.join(`
|
|
5
|
-
`)}\n`))}}}function Ar(e){let[t,...n]=e.filter(e=>{let[t,n,r]=e.cliPath;return t===`help`&&n!==void 0&&r===void 0&&Nr(e)!==void 0});return n.length===0?t:void 0}function jr(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 Mr(e,t,n,r){let i=Nr(e);if(i===void 0)return x(`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 a=await jn(e,{[i.optionKey]:t});return a.ok?await b({method:e.method,path:_e(e.operationId,{}),searchParams:{},body:a.data,auth:e.auth,responseFormat:Re(r)?`json`:`auto`}):a}function Nr(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 Pr(e){let t=new Map;for(let n of e){if(n.mode===void 0)continue;let e=n.cliPath.join(` `);t.set(e,[...t.get(e)??[],n])}return t}function Fr(e,t){for(let n of t){if(n.mode===void 0)continue;let t=Lr(n,n.mode);e.addOption(new f(t?.flag??xe(n.mode),n.summary||n.operationId))}}function Ir(e,t,n,r=!1){let i=n.flatMap(t=>t.mode!==void 0&&e.getOptionValueSource(t.mode)===`cli`?[{spec:t,flag:xe(t.mode)}]:[]),[a,o]=i;if(o!==void 0)return x(`Use one of ${i.map(({flag:e})=>e).join(`, `)}, not more than one.`);let s=a?.spec??(r?Yr(t,n):t);return y(s===t?`Base operation`:`Folded operation`,s)}function Lr(e,t){return[...e.parameters,...e.requestBody?.flatMap(({parameter:e})=>e)??[]].find(e=>e.optionKey===t)}function Rr(e){return new Set(e.map(e=>e.mode??``))}function zr(e){return e.map(e=>qr(Lr(e,e.mode??``)?.flag??xe(e.mode??``)))}function Br(e){return new Set(e.flatMap(e=>(e.requestBody??[]).flatMap(({parameter:e})=>e.filter(e=>e.schemaType===`array`||F(e.name)).map(e=>qr(e.flag)))))}function Vr(e,t){let n=Rr(t),r=new Set;return[e,...t].flatMap(e=>e.parameters.filter(e=>{if(n.has(e.optionKey))return!1;let t=qr(e.flag);return!r.has(t)&&(r.add(t),!0)}))}function Hr(e,t){return e.parameters.filter(e=>e.required&&t[e.optionKey]===void 0).map(e=>e.flag)}function Ur(e,t,n){let r=n[e];if(r===void 0||Gr(t).has(e))return n;let[i,a]=Kr(t).filter(e=>n[e.optionKey]===void 0);return i===void 0||a!==void 0?n:{...n,[e]:void 0,[i.optionKey]:r}}function Wr(e,t){let n=t.mode===void 0?``:` ${xe(t.mode)}`;return`hint: '${e.join(` `)}' is the retired spelling; use '${t.cliPath.join(` `)}${n}' (retired paths run for one release train).`}function Gr(e){return new Set([...e.parameters,...e.requestBody?.flatMap(({parameter:e})=>e)??[]].map(e=>e.optionKey))}function Kr(e){return[...e.parameters,...e.requestBody?.flatMap(({parameter:e})=>e)??[]].filter(e=>e.required&&(e.schemaType===void 0||e.schemaType===`string`))}function qr(e){return e.split(` `)[0]??e}function Jr(e,t=[]){return Zr(Yr(e,t))}function Yr(e,t){if(e.intent!==`search`)return e;let[n,r]=t.filter(e=>e.intent===`search`&&Xr(e)!==void 0);return r===void 0&&n!==void 0?n:e}function Xr(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 Zr(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 Qr(e,t,n){let r=t.join(` `).trim();return r.length===0?y(`No positional text`,n):n[e.optionKey]===void 0?y(`Positional text parsed`,{...n,[e.optionKey]:r}):x(`Use either the positional argument or ${qr(e.flag)}, not both.`)}function $r(e,t,n){if(e.cliPath[0]!==`lookup`||!ei(n))return null;let r=e.parameters.filter(e=>t[e.optionKey]!==void 0).map(e=>`${e.name}=${String(t[e.optionKey])}`);return x(`no record for ${r.length===0?`the given input`:r.join(`, `)}`)}function ei(e){return e.ok?Array.isArray(e.data)&&e.data.length===0:e.httpStatus===404}var ti=a({artifact:e().nullish(),group:e().nullish(),name:e().nullish(),revision:e().nullish(),time:i({offset:!0}).nullish(),version:e().nullish()}),ni=a({build:ti});function B(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}var ri=r([`MACOS`,`LINUX`,`WINDOWS`,`OTHER`]),ii=r([`RSA_OAEP_256_A256_GCM_V1`]),ai=a({clientLabel:e().regex(/.*\S.*/).min(1).max(120).nullish(),clientPlatform:ri.nullish(),encryptionAlgorithm:ii.nullish(),encryptionPublicKey:e().min(344).max(12e3).nullish()}),oi=32;async function si(){let e=await ht.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`encrypt`,`decrypt`]),t=await ht.subtle.exportKey(`spki`,e.publicKey);return{publicKey:Buffer.from(t).toString(`base64`),privateKey:e.privateKey}}async function ci(e,t){let{wrappedKey:n,nonce:r,ciphertext:i,authenticationTag:a}=t,o=li(n,`wrapped key`,128,1024),s=li(r,`nonce`,12,12),c=li(i,`ciphertext`,1,65536),l=li(a,`authentication tag`,16,16),u;try{u=await ht.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!==oi)throw Error(`broker credential used an invalid AES-256 key`);let e=await ht.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 ht.subtle.decrypt({name:`AES-GCM`,iv:s,tagLength:128},e,t)}catch{throw Error(`broker credential payload failed authentication`)}let r=new Ft(`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 li(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 ui=r([`PENDING`,`ISSUING`,`KEY_READY`,`REVOKING`,`CONSUMED`,`REVOKED`,`DENIED`,`EXPIRED`,`FAILED`]),di=r([`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`,`Personal API-key quota reached`,`Credential issuance lost its database claim`,`Credential delivery encryption failed`,`Credential issuance finalization was lost`]),fi=a({approvedAt:i({offset:!0}).nullish(),clientLabel:e(),clientPlatform:ri,comparisonCode:e(),consumedAt:i({offset:!0}).nullish(),createdAt:i({offset:!0}),expiresAt:i({offset:!0}),id:t(),intervalSeconds:n().int().min(1),keyReadyAt:i({offset:!0}).nullish(),status:ui,terminalAt:i({offset:!0}).nullish(),terminalReason:di.nullish(),updatedAt:i({offset:!0})}),pi=a({algorithm:ii,authenticationTag:e(),ciphertext:e(),nonce:e(),wrappedKey:e()}),mi=a({delivery:pi.nullish(),expiresAt:i({offset:!0}),status:ui,terminalReason:di.nullish()}),hi=a({comparisonCode:e(),expiresAt:i({offset:!0}),id:t(),intervalSeconds:n().int().min(1),pollSecret:e(),verificationUrl:e()}),V=[{command:`auth login`,role:`oauth`,summary:`Sign in through your browser`,description:`Sign in through your browser and save verified CLI access in the credential store.`,operationId:`getAuthProviderCatalog`,method:`GET`,path:`/v1/auth/providers`,bodyOption:[],localOption:[{optionKey:`browser`,flag:`--no-browser`,description:`Print the sign-in URL without opening a browser.`},{optionKey:`providers`,flag:`--providers`,description:`Print the sign-in providers and CLI OAuth client, then exit without signing in.`}]},{command:`auth login`,role:`start`,summary:`Sign in with a browser-approved personal API key`,description:`Creates a short-lived browser approval request and returns its poll credential once.`,operationId:`createCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations`,bodyOption:[{name:`clientLabel`,optionKey:`clientLabel`,flag:`--client-label <client-label>`,required:!1,description:`Label for this CLI installation.`}],localOption:[{optionKey:`key`,flag:`--key`,description:`Sign in with a browser-approved personal API key instead of OAuth; the approval URL opens on any device.`},{optionKey:`browser`,flag:`--no-browser`,description:`Print the sign-in URL without opening a browser.`}]},{command:`auth login`,role:`poll`,summary:`Poll CLI authorization`,description:`Returns pending state, a terminal state, or an encrypted one-time credential delivery.`,operationId:`pollCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/poll`,bodyOption:[],localOption:[]},{command:`auth login`,role:`acknowledge`,summary:`Acknowledge CLI credential delivery`,description:`Confirms the CLI stored the delivered personal key in its credential store and clears transient delivery material.`,operationId:`acknowledgeCliAuthorization`,method:`POST`,path:`/v1/auth/cli-authorizations/{cliAuthorizationId}/acknowledge`,bodyOption:[],localOption:[]},{command:`auth logout`,role:`revoke`,summary:`Sign out: revoke the personal key and forget stored OAuth`,description:`Revokes the stored personal key and returns provider metadata so the CLI can confirm remote revocation before removing local bytes.`,operationId:`revokeCurrentPersonalApiKey`,method:`DELETE`,path:`/v1/auth/personal-api-key`,bodyOption:[],localOption:[{optionKey:`forgetLocal`,flag:`--forget-local`,description:`Remove local bytes even when remote revocation cannot be confirmed.`}]}],gi=B(V,`start`),_i=B(V,`poll`),vi=B(V,`acknowledge`),yi=class extends Error{httpStatus;retryAfterSeconds;retryable;constructor(e,t,n=[]){super(`CLI authorization ${e} failed: ${Se(t,n)}`),this.name=`CliAuthorizationRequestError`,this.httpStatus=t.status,this.retryAfterSeconds=Ti(t.retryAfterSeconds),this.retryable=t.status>=500||t.status===429}},bi=class extends Error{constructor(e,t,n=[]){super(`CLI authorization ${e} transport failed: ${C(t,n)}`,{cause:t}),this.name=`CliAuthorizationTransportError`}};async function xi(e){let t=await pe(Ne(S()),{method:gi.method,path:ve(gi.path,{},gi.operationId),headers:{},contentType:`application/json`,body:e},hi);if(!t.ok)throw new yi(`start`,t.problem);return Ei(t.data)}async function Si(e,t){let n=ye(_i.operationId),r=await pe(Ne(S()),{method:_i.method,path:ve(_i.path,{cliAuthorizationId:e},_i.operationId),headers:{[n]:t}},mi);if(!r.ok)throw new yi(`poll`,r.problem,[t]);return{authorization:r.data,retryAfterSeconds:wi(r.headers[`retry-after`])}}async function Ci(e,t){let n=ye(vi.operationId),r;try{r=await pe(Ne(S()),{method:vi.method,path:ve(vi.path,{cliAuthorizationId:e},vi.operationId),headers:{[n]:t}},fi)}catch(e){throw new bi(`acknowledge`,e,[t])}if(!r.ok)throw new yi(`acknowledge`,r.problem,[t]);return r.data}function wi(e){if(e===void 0)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null}function Ti(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function Ei(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())})`},[It.custom]:{enumerable:!1,value:a}})}async function Di(e){let t=Ne(S()),n;try{n=await pe(t,{method:`GET`,path:_e(`getCurrentPersonalApiKey`,{}),headers:{Authorization:`Bearer ${e}`}},Ie)}catch(t){return{state:`unavailable`,summary:`identity verification failed before an HTTP response — ${C(t,[e])}`}}return n.ok?n.data.status===`ACTIVE`?{state:`verified`,summary:`personal API-key metadata verified`,apiKey:n.data}:{state:`invalid`,summary:`personal API-key self metadata is not active`}:{state:n.problem.status===401||n.problem.status===403?`invalid`:`unavailable`,summary:`identity verification: ${Se(n.problem,[e])}`}}var Oi=B(V,`revoke`);async function ki(e){let t;try{t=Le(S().host)}catch(e){return x(`auth logout: invalid API host — ${C(e)}`)}let[n,r]=await Promise.all([Ai(t),Ni(t,e)]),i=n.state===`failed`?[`OAuth credential could not be removed — ${n.summary}`]:n.state===`forgotten`&&!n.revoked?[`OAuth refresh token was not revoked remotely — ${n.summary??`no revocation endpoint`}`]:[],a={host:t,revoked:!1,forgotten:!1,oauth:n};return r===null?n.state===`missing`?y(`No CLI credential is stored for this API host.`,a):n.state===`failed`?{...x(`auth logout: ${i[0]}`),data:a}:y(n.revoked?`OAuth credential revoked remotely and removed locally.`:`OAuth credential removed locally.`,a,{warnings:i}):{...r,data:{...r.data??a,oauth:n},warnings:[...r.warnings,...i]}}async function Ai(e){let t=await De(e);if(t.state===`missing`)return{state:`missing`};let n=t.state===`found`?await Mi(t.stored):{revoked:!1};try{await je(e)}catch(e){return{state:`failed`,summary:C(e)}}return{state:`forgotten`,...n}}async function ji(e){let t=Reflect.get(await ft(e),`revocation_endpoint`);return typeof t==`string`?ke(t,`revocation endpoint`,!0):void 0}async function Mi(e){let{client:t,tokens:n}=e.credential,r=n.refresh_token??n.access_token;try{let e=await ji(t);if(e===void 0)return{revoked:!1};let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:r,client_id:Oe(t)})});return n.ok?{revoked:!0}:{revoked:!1,summary:`revocation endpoint answered ${n.status}`}}catch(e){return{revoked:!1,summary:C(e,Ee(n))}}}async function Ni(e,t){let n;try{n=await ze(e)}catch(e){return x(`auth logout: stored credential could not be read — ${C(e)}`)}if(n.state===`unavailable`)return{...x(`auth logout: ${n.summary}`),data:{host:e,revoked:!1,forgotten:!1}};if(n.state===`missing`)return null;let r=n.stored,i=await Pi(r),a=i.outcome===`revoked`,o=r.activation===`pending`&&i.outcome===`rejected`;if(!a&&!o&&!t.forgetLocal)return{...x(`auth logout: remote revocation was not confirmed; local credential preserved — ${i.summary}`,[`Retry when the API is available. If an earlier response was lost after revocation, the retry can be unauthorized because revoked keys cannot authenticate.`,"Use `--forget-local` only to remove local bytes while accepting that the remote key may remain active."]),data:Fi(r,!1,!1)};try{await Ze(r.host)}catch(e){return{...x(`auth logout: local credential removal failed — ${C(e,[r.credential.secret])}`,[a?"The remote key is revoked. Re-run with `--forget-local` to retry local cleanup.":`Remote revocation was not confirmed; inspect auth status before retrying.`]),data:Fi(r,a,!1)}}return y(a?`Personal CLI credential revoked remotely and removed locally.`:o?`Stale pending CLI credential removed; its remote key can no longer authenticate and unacknowledged keys expire at the authorization deadline.`:`Personal CLI credential removed locally without confirmed remote revocation.`,Fi(r,a,!0),{ids:[r.credential.apiKey.id],warnings:a||o?[]:[`Remote revocation was not confirmed; the personal key may remain active.`]})}async function Pi(e){let t=Ne(S());try{let n=await pe(t,{method:Oi.method,path:ve(Oi.path,{},Oi.operationId),headers:{Authorization:`Bearer ${e.credential.secret}`}},Ie);return n.ok?n.data.id!==e.credential.apiKey.id||n.data.subject!==e.credential.apiKey.subject?{outcome:`unconfirmed`,summary:`remote response did not match the stored personal key identity`}:n.data.status===`REVOKED`?{outcome:`revoked`,summary:`remote key revocation confirmed`}:{outcome:`unconfirmed`,summary:`remote response did not confirm REVOKED status`}:{outcome:n.problem.status===401&&n.problem.type!==`about:blank`?`rejected`:`unconfirmed`,summary:Se(n.problem,[e.credential.secret])}}catch(t){return{outcome:`unconfirmed`,summary:C(t,[e.credential.secret])}}}function Fi(e,t,n){return{host:e.host,personalApiKeyId:e.credential.apiKey.id,activation:e.activation,revoked:t,forgotten:n}}var Ii=`RSA_OAEP_256_A256_GCM_V1`,Li=1,Ri=30,zi=h().bin[0],Bi=`The local record remains pending and unavailable to ordinary commands. Re-run \`${zi} auth login --key\`; it recovers the credential when the broker acknowledged it, and otherwise clears the stale record.`;async function Vi(e){if(!St.isTTY)return x(`${zi} auth login --key requires an interactive TTY on stdin`,[`For non-interactive automation, inject CLIENT_SECRET, ADMIN_API_KEY, or AUTH_TOKEN through the environment or configured Doppler source.`]);let t,n;try{let e=S().host;t=Le(e),n=Pe(e)}catch(e){return x(`auth login --key: invalid environment configuration — ${C(e)}`)}for(;;){let e;try{e=await $e(t)}catch(e){return x(`auth login --key: credential storage could not be inspected — ${C(e)}`)}if(e.state===`unavailable`)return x(`auth login --key: ${e.summary}`,[`Make the OS keyring or the CLI config directory writable, or use CLIENT_SECRET, ADMIN_API_KEY, or AUTH_TOKEN from the environment.`]);if(e.state===`missing`){e.keyringFailure!==void 0&&j.write(Ce(e.keyringFailure));break}let n=await Hi(e.stored);if(n!==null)return n}let r;try{r=await si()}catch(e){return x(`auth login --key: ephemeral encryption key could not be created — ${C(e)}`)}let i=ai.safeParse({clientLabel:e.clientLabel?.trim()||(vt().trim()||`aventure-cli`).slice(0,120),clientPlatform:Ki(),encryptionAlgorithm:Ii,encryptionPublicKey:r.publicKey});if(!i.success)return x(`auth login --key: local authorization input is invalid`);let a;try{a=await xi(i.data)}catch(e){return x(`auth login --key: could not start browser authorization — ${C(e)}`)}let o;try{o=ut(a,n)}catch(e){return x(`auth login --key: unsafe browser authorization URL rejected — ${C(e)}`)}if(!Gi(await ct(a,n,{noBrowser:e.noBrowser}),a,o))return x(`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:[o]});let s;try{s=await Wi(a)}catch(e){return x(`auth login --key: authorization did not complete — ${C(e)}`,[],{references:[o]})}if(s.algorithm!==Ii)return x(`auth login --key: broker selected an unsupported encryption algorithm`);let c;try{c=await ci(r.privateKey,s)}catch(e){return x(`auth login --key: encrypted credential could not be opened — ${C(e)}`)}let l=await Di(c);if(l.state!==`verified`)return x(`auth login --key: decrypted credential was neither stored nor acknowledged — ${l.summary}`);let u;try{u=await Qe(t,{apiKey:l.apiKey,secret:c},`pending`)}catch(e){return x(`auth login --key: credential could not be durably stored — ${C(e)}`)}let d;try{d=await Ui(a)}catch(e){return H(u,!0,`auth login --key: credential was stored and verified, but broker acknowledgment was not confirmed — ${C(e,[a.pollSecret])}`,Bi)}if(d.status!==`CONSUMED`)return H(u,!0,`auth login --key: broker returned ${d.status} after acknowledgment`,Bi);let f=await Di(c);if(f.state!==`verified`||!Xi(f.apiKey,u.credential.apiKey))return H(u,!0,`auth login --key: broker acknowledgment succeeded, but refreshed credential metadata could not prove the granted lifetime — ${f.summary}`,Bi);try{let e=await Qe(t,{apiKey:f.apiKey,secret:c},`active`);return y(`Personal CLI credential stored; authenticated identity and broker acknowledgment verified.`,Yi(e,!0),{ids:[e.credential.apiKey.id]})}catch(e){return H(u,!0,`auth login --key: remote acknowledgment succeeded, but local activation could not be confirmed — ${C(e)}`,Bi)}}async function Hi(e){let t=await Di(e.credential.secret);if(e.activation!==`pending`)return t.state===`verified`?y(`Personal CLI credential is already stored and its authenticated identity was verified.`,Yi(e,!0),{ids:[e.credential.apiKey.id]}):H(e,!1,`auth login --key: stored credential ${t.state} — ${t.summary}`,`Run \`${zi} auth logout\` to revoke/remove it before authorizing a replacement.`);if(t.state===`verified`&&Xi(t.apiKey,e.credential.apiKey))try{let n=await Qe(e.host,{apiKey:t.apiKey,secret:e.credential.secret},`active`);return y(`Recovered pending CLI credential: broker acknowledgment had succeeded.`,Yi(n,!0),{ids:[n.credential.apiKey.id]})}catch(t){return H(e,!0,`auth login --key: credential is valid but could not be promoted locally — ${C(t,[e.credential.secret])}`,`The remote key remains valid. Re-run \`${zi} 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 H(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 \`${zi} auth login --key\` when the API is reachable; it recovers an acknowledged credential and clears an unacknowledged one.`);let n=await Pi(e);if(n.outcome===`unconfirmed`)return H(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 Ze(e.host)}catch(t){return H(e,!1,`auth login --key: stale pending credential could not be removed — ${C(t,[e.credential.secret])}`)}return j.write(n.outcome===`revoked`?`Revoked and cleared a stale pending CLI credential; starting a fresh browser authorization.
|
|
6
|
-
`:`Cleared a stale pending CLI credential whose remote key can no longer authenticate; starting a fresh browser authorization.
|
|
7
|
-
`),null}async function Ui(e){let t=new Date(e.expiresAt).getTime(),n=qi(e.intervalSeconds);for(;;)try{return await Ci(e.id,e.pollSecret)}catch(e){if(e instanceof yi){if(!e.retryable)throw e;n=qi(e.retryAfterSeconds??n)}else if(!(e instanceof bi))throw e;if(Date.now()>=t)throw e;j.write(`Broker acknowledgment was interrupted; retrying.
|
|
8
|
-
`),await Ji(n,t)}}async function Wi(e){let t=new Date(e.expiresAt).getTime(),n=qi(e.intervalSeconds),r;for(j.write(`Waiting for browser approval...
|
|
9
|
-
`);Date.now()<t;){let i;try{i=await Si(e.id,e.pollSecret)}catch(e){if(e instanceof yi){if(!e.retryable)throw e;n=qi(e.retryAfterSeconds??n)}r=e,j.write(`Authorization poll was interrupted; retrying.
|
|
10
|
-
`),await Ji(n,t);continue}r=void 0;let a=i.authorization;switch(a.status){case`PENDING`:case`ISSUING`:case`REVOKING`:n=qi(i.retryAfterSeconds??n),await Ji(n,t);break;case`KEY_READY`:if(a.delivery===null||a.delivery===void 0)throw Error(`broker returned KEY_READY without an encrypted delivery`);return a.delivery;case`DENIED`:case`EXPIRED`:case`FAILED`:throw Error(fe(a.terminalReason?.trim()??``,[e.pollSecret])||`broker entered terminal state ${a.status}`);case`CONSUMED`:throw Error(`broker credential was already consumed; restart login`)}}throw Error(r===void 0?`browser authorization expired before approval completed`:`browser authorization expired after a retryable broker failure: ${C(r,[e.pollSecret])}`)}function Gi(e,t,n){let r=e.state===`opened`;return!r&&!j.isTTY?!1:(j.write([r?`Browser approval opened for this request.`:`Browser not opened automatically (${e.reason}).`,...j.isTTY?[`Open this one-time approval URL in your browser:`,t.verificationUrl]:[`Approval reference: ${n}`],`Comparison code: ${t.comparisonCode}`,`Confirm that the browser shows the same code before approving.`,``].join(`
|
|
11
|
-
`)),!0)}function Ki(){switch(yt()){case`darwin`:return`MACOS`;case`linux`:return`LINUX`;case`win32`:return`WINDOWS`;default:return`OTHER`}}function qi(e){return Math.min(Ri,Math.max(Li,e))}async function Ji(e,t){let n=t-Date.now();n>0&&await Lt(Math.min(e*1e3,n))}function Yi(e,t){return{host:e.host,provider:e.provider,personalApiKeyId:e.credential.apiKey.id,name:fe(e.credential.apiKey.name,[e.credential.secret]),activation:e.activation,verified:t}}function H(e,t,n,r){return{...x(n,r===void 0?[]:[r]),data:Yi(e,t)}}function Xi(e,t){return e.expiresAt===null||e.expiresAt===void 0||t.expiresAt===null||t.expiresAt===void 0?!1:new Date(e.expiresAt)>new Date(t.expiresAt)}function Zi(e,t){let n=t.state===`found`?t.stored:void 0,r=n?.credential.apiKey.expiresAt??null;return{host:e,present:n!==void 0,provider:n?.provider??null,activation:n?.activation??null,apiKeyId:n?.credential.apiKey.id??null,subject:n?.credential.apiKey.subject??null,scope:n?.credential.apiKey.scopes??[],name:n===void 0?null:fe(n.credential.apiKey.name,[n.credential.secret]),status:n?.credential.apiKey.status??null,expiresAt:r,metadataSource:n===void 0?null:`store-cache`,expiresInDay:$i(r),storageFailure:t.state===`unavailable`?t.summary:null,keyringFailure:t.state===`missing`?t.keyringFailure??null:null,error:t.state===`invalid`?t.summary:null}}var Qi=864e5;function $i(e){if(e===null)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:Math.round((t-Date.now())/Qi)}var ea=7;function ta(e){return e===null?`none`:e.length<=11?e:`${e.slice(0,ea)}\u2026${e.slice(-4)}`}var na=13,ra=14;function ia(e){return[``,`${e.cliName} ${e.cliVersion} \u2192 ${e.personal.host}`+(e.apiVersion===null?` (api unreachable)`:` (api ${e.apiVersion})`),``,...aa(e.oauth,e.cliName),...oa(e.personal,e.oauth,e.cliName),``,U(`Providers`,la(e.providers)),...ua(e.resolved,e.config),...e.systemOk?[]:[U(`System`,`uptime read failed`)]].join(`
|
|
12
|
-
`)}function U(e,t){return` ${e.padEnd(na)}${t}`}function W(e){return` ${``.padEnd(na)}${e}`}function aa(e,t){switch(e.state){case`found`:return[U(`OAuth`,`stored via ${e.stored.provider}; identity is not cached`),W(Ae(e.stored.credential)?e.stored.credential.tokens.refresh_token===void 0?`access token expired — run \`${t} auth login\``:`access token expired — the next command renews it with the refresh token`:`cached expiry ${e.stored.credential.expiresAt}`)];case`missing`:return[U(`OAuth`,`none stored`),...e.keyringFailure===void 0?[]:[W(`OS keyring unusable — login stores to file: ${e.keyringFailure}`)]];case`unavailable`:return[U(`OAuth`,`storage unavailable: ${e.summary}`)];case`invalid`:return[U(`OAuth`,`stored credential invalid: ${e.summary}`)];default:throw Error(`Unsupported OAuth credential state`)}}function oa(e,t,n){if(!e.present){if(t.state===`found`)return[];let r=e.storageFailure??(t.state===`unavailable`?t.summary:null);return r===null?[U(`Signed in`,`no \u2014 run \`${n} auth login\``),...e.error===null?[]:[W(`stored credential invalid: ${e.error}`)]]:[U(`Signed in`,`credential storage unavailable`),W(r)]}return[U(t.state===`found`?`Personal key`:`Signed in`,e.subject??`unknown subject`),W(`via ${e.provider??`unknown store`}`),U(`Key`,`${e.name??`unnamed`} ${ta(e.apiKeyId)}`),...sa(e,n),U(`Scopes`,e.scope.length===0?`none`:e.scope.join(`, `))]}function sa(e,t){let n=`${e.status??`unknown`} when stored`,r=e.expiresInDay,i=e.expiresAt===null?null:e.expiresAt.slice(0,10);return[U(`Key state`,n),...i===null||r===null?[W(`no expiry recorded`)]:[W(ca(i,r))],W(`Clerk owns the live verdict \u2014 \`${t} auth login --key\` refreshes this cache`)]}function ca(e,t){return t<0?`cached expiry ${e} passed ${Math.abs(t)}d ago`:t<=ra?`cached expiry ${e}, ${t}d away`:`cached expiry ${e}`}function la(e){if(e.state===`unavailable`)return`unavailable: ${e.summary}`;let t=e.catalog.oauthClient;return[e.catalog.clerkPublishableKey?`clerk browser sign-in`:`no browser sign-in`,t?`oauth ${Te(t).host} client ${t.clientId}`:`no OAuth CLI client`].join(`; `)}function ua(e,t){return[U(`Secrets`,v.map(t=>fa(t,e)).join(` `)),U(`Config`,t===null?`none`:`doppler ${t.project}/${t.config}`)]}function da(e){return v.map(t=>fa(t,e)).join(` `)}function fa(e,t){let n=t[e];return n.present?`${e}=${n.source??`resolved`}`:`${e}=${n.source===`config`?`config (unresolved)`:`unset`}`}var pa=r([`PROMPT`,`SKILL`,`AGENT`]),ma=a({kind:pa,name:e(),version:e()}),ha=a({content:e(),core:ma}),ga=a({key:e(),version:e()}),_a=a({agent:o(e(),ga),prompt:o(e(),ga),skill:o(e(),ga)}),G=`aventure`,va=`SKILL.md`,ya=`.aventure-skills.json`,ba=`claude`,xa=2e4,Sa=2,Ca=[{name:`claude-code`,base:`home`,detect:[`.claude`],skill:[`.claude`,`skills`],mcp:{shape:`claude-cli`,file:[`.claude.json`],key:`mcpServers`}},{name:`codex`,base:`home`,detect:[`.codex`],skill:[`.agents`,`skills`],mcp:{shape:`toml`,file:[`.codex`,`config.toml`]}},{name:`cursor`,base:`home`,detect:[`.cursor`],skill:null,mcp:{shape:`json`,file:[`.cursor`,`mcp.json`],key:`mcpServers`,entry:e=>({type:`http`,url:e})}},{name:`opencode`,base:`config`,detect:[`opencode`],skill:[`opencode`,`skills`],mcp:{shape:`json`,file:[`opencode`,`opencode.json`],key:`mcp`,entry:e=>({type:`remote`,url:e,enabled:!0})}}];function wa(e){return M(Ta(e))}function Ta(e){return O(Oa(e),...e.detect)}function Ea(e){return e.skill===null?null:O(Oa(e),...e.skill)}function Da(e){return O(Oa(e),...e.mcp.file)}function Oa(e){return e.base===`home`?Aa(`HOME`)??_t():ka()}function ka(){return Aa(`XDG_CONFIG_HOME`)??O(Aa(`HOME`)??_t(),`.config`)}function Aa(e){let t=process.env[e]?.trim();return t===void 0||t.length===0?void 0:t}function ja(e){return O(D(e),ya)}function Ma(e){if(!M(e))return{};try{let t=_a.safeParse(JSON.parse(N(e,`utf8`)));return t.success?t.data.skill:{}}catch{return{}}}function Na(e,t,n){let r=ja(e),i={...Ma(r)};for(let e of n){let n=t.skill[e];n!==void 0&&(i[e]=n)}return Fa(r,`${JSON.stringify({prompt:{},skill:i,agent:{}},null,Sa)}\n`)}function Pa(e,t,n){let r=O(e,t,va);return D(D(r))===e?Fa(r,n):`refusing to install ${t}: it does not name one directory inside ${e}`}function Fa(e,t){try{Ia(e,t)}catch(t){return`cannot write ${e}: ${C(t)}`}return null}function Ia(e,t){Et(D(e),{recursive:!0});let n=`${e}.aventure-tmp`;try{P(n,t,`utf8`),At(n,e)}finally{jt(n,{force:!0})}}var La=RegExp(`^[ \\t]*\\[[ \\t]*mcp_servers[ \\t]*\\.[ \\t]*"?${G}"?[ \\t]*\\]`),Ra=/^[ \t]*mcp_servers[ \t]*=/m;function za(e){let t=Da(e);if(!M(t))return null;try{let n=N(t,`utf8`);if(e.mcp.shape===`toml`)return Va(n);let r=Ka(n)?.[e.mcp.key],i=(r!==void 0&&qa(r)?r:void 0)?.[G];return i===void 0||!qa(i)?null:typeof i.url==`string`?i.url:Ba}catch{return null}}var Ba=`unknown`;function Va(e){let t=e.split(`
|
|
13
|
-
`),n=t.findIndex(e=>La.test(e));if(n<0)return null;for(let e of t.slice(n+1)){if(e.trimStart().startsWith(`[`))break;let t=/^[ \t]*url[ \t]*=[ \t]*"([^"]*)"/.exec(e);if(t?.[1]!==void 0)return t[1]}return Ba}function Ha(e,t){let n=e.mcp,r=Da(e);if(n.shape===`claude-cli`)return Ga(t);try{if(n.shape===`toml`)return Ua(r,t);Wa(r,n.key,n.entry(t))}catch(e){return`cannot write ${r}: ${C(e)}`}return null}function Ua(e,t){let n=M(e)?N(e,`utf8`):``,r=`[mcp_servers.${G}]\nurl = "${t}"\n`;return Ra.test(n)?`${e} declares mcp_servers as an inline table, which this command cannot extend; add by hand:\n${r}`:Fa(e,`${n}${n.length===0||n.endsWith(`
|
|
14
|
-
`)?``:`
|
|
15
|
-
`}\n${r}`)}function Wa(e,t,n){let r=Ka(M(e)?N(e,`utf8`):`{}`);if(r===null)throw Error(`${e} is not a JSON object`);let i={...r},a=i[t];i[t]={...a!==void 0&&qa(a)?a:{},[G]:n},Ia(e,`${JSON.stringify(i,null,Sa)}\n`)}function Ga(e){let t=[`mcp`,`add`,`--transport`,`http`,`-s`,`user`,G,e],n=pt(ba,t,{encoding:`utf8`,timeout:xa}),r=`${ba} ${t.join(` `)}`;if(n.error!==void 0)return`run \`${r}\`: ${n.error.message}`;if(n.status!==0){let e=(n.stderr??``).trim().split(`
|
|
16
|
-
`).slice(-2).join(` | `);return`\`${r}\` exited ${n.status}: ${e||`no stderr`}`}return null}function Ka(e){let t=d.safeParse(JSON.parse(e));return t.success&&qa(t.data)?t.data:null}function qa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ja=`aventure`;function Ya(e,t=h().bin[0]){T(Xa(e).command(`setup`).summary(`Install the aventure skill bundle and MCP server into your agent runtimes`).description([`Detect the agent runtimes installed for this user (${Ca.map(e=>e.name).join(`, `)}),`,`install or refresh the published ${Ja}* skill bundle into each runtime's own`,`skill directory, and register the ${G} MCP server in each runtime's own config.`,``,` ${t} agents setup # write the skills and the MCP registration`,` ${t} agents setup --status # compare what is installed; exit 1 on drift`,`--execute is deprecated, accepted, and ignored; setup executes by its verb.`].join(`
|
|
17
|
-
`)).addOption(new f(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`).default(!1)).addOption(new f(`--status`,`report installed skill versions against the manifest and exit 1 on drift; compares recorded versions, not file content, and writes nothing`).default(!1))).action(async function(e){let t=this.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment),R({mode:w(e)},await Za(e))})}function Xa(e){let t=`agents`,n=e.commands.find(e=>e.name()===t);if(n!==void 0)return n;let r=We[t]?.summary??t;return e.command(t).summary(r).description(r)}async function Za(e){let t=lo();if(!t.ok||t.data===null)return{...t,data:null};let n=await so(`getAgentInstructionManifest`,_a);if(!n.ok||n.data===null)return{...n,data:null};let r=n.data,i=t.data,a=Object.keys(r.skill).filter(e=>e.startsWith(Ja)).toSorted();if(a.length===0)return x(`The agent instruction manifest carries no ${Ja}* skill; nothing to install.`);let o=Ca.map(e=>to(e,r,a,i));return Qa({runtime:e.status===!0?o:await ro(o,r,i)},e,i)}function Qa(e,t,n){let r=e.runtime.filter(e=>e.detected),i=r.flatMap(e=>e.action.filter(e=>e.state!==`current`)),a=i.filter(e=>e.state===`failed`),o={runtimeDetected:r.length,actionPending:i.length,actionFailed:a.length},s=[`agents setup: ${r.length} runtime detected, ${i.length} action pending, mcp ${n}`,...e.runtime.map($a)].join(`
|
|
18
|
-
`);if(r.length===0){let t=Ca.map(e=>`${e.name}: no ${Ta(e)}`);return{...x(s,t,{counts:o}),data:e}}let c=a.length>0?a:t.status===!0?i:[];return c.length===0?y(s,e,{counts:o}):{...x(s,c.map(eo),{counts:o}),data:e}}function $a(e){if(!e.detected)return` ${e.name} not installed`;let t=e.action.filter(e=>e.state!==`current`);return t.length===0?` ${e.name} current (${e.action.length} item)`:` ${e.name} ${t.length} pending — ${t.map(eo).join(`; `)}`}function eo(e){return`${e.kind} ${e.name} ${e.state}: ${e.detail}`}function K(e,t,n,r){return{kind:e,name:t,state:n,detail:r}}function to(e,t,n,r){let i=Ea(e),a=Da(e),o={name:e.name,skillDir:i,mcpConfig:a};if(!wa(e))return{...o,detected:!1,action:[]};let s=za(e),c=s===null?K(`mcp`,G,`install`,`register ${r} in ${a}`):K(`mcp`,G,`current`,`${s} in ${a}`);return{...o,detected:!0,action:[...i===null?[]:no(i,t,n),c]}}function no(e,t,n){let r=Ma(ja(e));return n.map(n=>{let i=t.skill[n]?.version??``,a=r[n]?.version,o=O(e,n,va);return a===void 0||!M(o)?K(`skill`,n,`install`,`write ${o} at version ${i}`):a===i?K(`skill`,n,`current`,`${o} at version ${i}`):K(`skill`,n,`update`,`${o} ${a} -> ${i}`)})}async function ro(e,t,n){let r=e.flatMap(e=>e.action.filter(e=>e.kind===`skill`&&e.state!==`current`).map(e=>e.name)),i=new Map;for(let e of[...new Set(r)].toSorted())i.set(e,await oo(e));return e.map(e=>{let r=Ca.find(t=>t.name===e.name);if(!e.detected||r===void 0)return e;let a=[],o=e.action.map(t=>{if(t.state===`current`)return t;if(t.kind===`mcp`)return io(r,e.mcpConfig,n);let o=ao(e.skillDir,t.name,i.get(t.name));return o.state===`current`&&a.push(t.name),o}),s=e.skillDir===null||a.length===0?null:Na(e.skillDir,t,a),c=s===null?[]:[K(`skill`,ya,`failed`,s)];return{...e,action:[...o,...c]}})}function io(e,t,n){let r=Ha(e,n);return r===null?K(`mcp`,G,`current`,`registered ${n} in ${t}`):K(`mcp`,G,`failed`,r)}function ao(e,t,n){if(e===null||n===void 0||!n.ok||n.data===null)return K(`skill`,t,`failed`,n?.summary??`no document fetched for ${t}`);let r=Pa(e,t,n.data.content);return r===null?K(`skill`,t,`current`,`${O(e,t,va)} at version ${n.data.core.version}`):K(`skill`,t,`failed`,r)}async function oo(e){return await so(`getAgentInstruction`,ha,{kind:pa.enum.SKILL,name:e})}async function so(e,t,n={}){let r=co(e);if(r===void 0)return x(`The generated command catalog carries no ${e} operation; regenerate it with \`make mcp-generate-contracts\` and reinstall.`);let i;try{i=_e(r.operationId,n)}catch(t){return x(`Cannot address ${e}: ${C(t)}`)}let a=await b({method:r.method,path:i,auth:r.auth,responseFormat:`json`}).catch(e=>x(C(e)));if(!a.ok)return{...a,summary:`${r.method} ${i} failed: ${a.summary}`,data:null};let o=a.data,s=t.safeParse(typeof o==`object`&&o&&`response`in o?o.response:void 0);return s.success?y(`${r.method} ${i} answered`,s.data):x(`${i} returned an unexpected body: ${s.error.message}`)}function co(e){return E.find(t=>t.operationId===e)}function lo(){try{return y(`MCP host derived`,tt(S().host,`/mcp`).href)}catch(e){return x(`Correct API_ENV or pass \`--environment <name>\` — ${C(e)}.`)}}var uo=`# >>> aventure-cli completion setup (managed by aventure-cli) >>>`,fo=`# <<< aventure-cli completion setup (managed by aventure-cli) <<<`,po=`.aventure-cli-completion.bak`;function mo(e,t){e.command(`install`).summary(`install shell completion loaders`).description(`Install managed shell completion loaders for supported shells.`).action(()=>xo([])),e.command(`uninstall`).summary(`remove shell completion loaders`).description(`Remove managed shell completion loaders installed by ${t}.`).action(()=>xo([`--uninstall`]))}function ho(e,t){e.command(`setup`).summary(`configure zsh completion startup`).description(`Configure ~/.zshrc so zsh loads ${t} completion loaders.`).option(`--dry-run`,`print the managed zshrc block without writing`).option(`--yes`,`apply without prompting`).option(`--uninstall`,`remove the managed zshrc block`).action(async e=>{let t=yo(),n=await vo({rcFile:k(_t(),`.zshrc`),installerPath:t,mode:e.uninstall?`uninstall`:`install`,dryRun:e.dryRun,prompter:e.yes||e.dryRun?void 0:Mo});A.stdout.write(`${n.message}\n`),!n.cancelled&&!e.dryRun&&xo(e.uninstall?[`--uninstall`]:[])})}function go(e,t=`fpath-only`){return[uo,`# installer: ${e}`,'fpath=("${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions" $fpath)',...t===`fpath-and-compinit`?[`autoload -Uz compinit`,`compinit`]:[],fo].join(`
|
|
19
|
-
`)}function _o(){let e=xo([`--status`],`pipe`);if(e.status!==0)return{refreshed:!1,message:`completion status exited ${e.status??1}`};if(!So(e.stdout??``))return{refreshed:!1,message:`no managed shell completions found`};let t=xo([],`pipe`);return t.status===0?{refreshed:!0,message:(t.stdout??``).trim()||`shell completions refreshed`}:{refreshed:!1,message:`completion refresh exited ${t.status??1}`}}async function vo({rcFile:e,installerPath:t,mode:n,dryRun:r=!1,prompter:i}){let a=Co(e),o=a.length===0?[]:a.split(`
|
|
20
|
-
`),s=wo(o,e);if(n===`uninstall`&&s===null)return{changed:!1,cancelled:!1,message:`${e}: already up-to-date`,content:a};let c=n===`install`?To(o,s,t,e):Eo(o,s);return c===a?{changed:!1,cancelled:!1,message:`${e}: already up-to-date`,content:c}:r?{changed:!0,cancelled:!1,message:c,content:c}:i!==void 0&&!await i(`Update ${e}?`)?{changed:!0,cancelled:!0,message:`${e}: cancelled`,content:a}:(ko(e,c),{changed:!0,cancelled:!1,message:`${e}: updated`,content:c})}function yo(e=A.argv[1]){let t=e===void 0?``:bo(e),n=k(D(t),`..`,`..`,`scripts`,`install-zsh-completion-loader.mjs`);return M(n)?n:k(D(t),`..`,`scripts`,`install-zsh-completion-loader.mjs`)}function bo(e){try{return kt(e)}catch{return k(e)}}function xo(e,t=`inherit`){let n=pt(A.execPath,[yo(),...e],{encoding:t===`pipe`?`utf8`:void 0,stdio:t});if(n.error!==void 0)throw n.error;if(t===`inherit`){n.status!==0&&(A.exitCode=n.status??1);return}return{stdout:n.stdout?.toString(),stderr:n.stderr?.toString(),status:n.status}}function So(e){return e.split(/\r?\n/u).some(e=>e.trim().endsWith(`: managed`))}function Co(e){return M(e)?(Ao(e),N(e,`utf8`)):``}function wo(e,t){let n=Do(e,uo),r=Do(e,fo);if(n.length===0&&r.length===0)return null;if(n.length!==1||r.length!==1||n[0]>=r[0])throw Error(`${t} has malformed managed completion setup markers; fix manually before retrying.`);return[n[0],r[0]]}function To(e,t,n,r){let i=t===null?[...e]:[...e.slice(0,t[0]),...e.slice(t[1]+1)],a=Oo(i),o=go(n,a===-1?`fpath-and-compinit`:`fpath-only`).split(`
|
|
21
|
-
`),s=t===null?a:t[0],c=s===-1?i.length:s;if(t!==null&&a!==-1&&a<c)throw Error(`${r} runs compinit before the managed block; move the block above compinit manually.`);return jo([...i.slice(0,c),...o,...i.slice(c)])}function Eo(e,t){return jo(t===null?e:[...e.slice(0,t[0]),...e.slice(t[1]+1)])}function Do(e,t){return e.flatMap((e,n)=>e===t?[n]:[])}function Oo(e){return e.findIndex(e=>/^\s*(autoload\s+.*\bcompinit\b|compinit(?:\s|$))/.test(e))}function ko(e,t){Et(D(e),{recursive:!0}),M(e)&&(Ao(e),Ao(`${e}${po}`),wt(e,`${e}${po}`));let n=k(D(e),`.${bt(e)}.${A.pid}.tmp`);Ao(n),P(n,t,{mode:420}),At(n,e)}function Ao(e){if(M(e)&&Tt(e).isSymbolicLink())throw Error(`refusing to write symlink: ${e}`)}function jo(e){let t=e.join(`
|
|
22
|
-
`);return t.length===0||t.endsWith(`
|
|
23
|
-
`)?t:`${t}\n`}async function Mo(e){let t=Rt({input:A.stdin,output:A.stdout});try{let n=await t.question(`${e} [y/N] `);return/^(y|yes)$/i.test(n.trim())}finally{t.close()}}var No=new Intl.Collator(void 0,{numeric:!0}),Po=2e4;function Fo(e,t=h()){let n=t.registry===`https://npm.pkg.github.com/`?`Requires npm authentication for @aventurevc packages.`:`Installs from the public npm registry; no credential required.`;T(e.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`,`(use \`make\` to rebuild that). ${n}`,`--execute is deprecated, accepted, and ignored; update executes by its verb.`].join(`
|
|
24
|
-
`)).option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1)).action(e=>R({mode:w(e)},Io()))}function Io(e,t=`apply`){let n=e;try{n??=h(process.argv[1])}catch(e){return x(e instanceof Error?e.message:String(e),[`invalid_package_metadata`])}let r=n.name,i=n.version,a=Lo([`view`,_,`version`,`--silent`,`--global`],n,{timeout:Po});if(!a.ok)return{...a,data:null};let o=(a.data??``).trim();if(o===``)return x(`npm view ${_} returned empty version`,[`empty_stdout`]);let s=No.compare(i,o)<0,c={targetPackage:_,runningPackage:r,currentVersion:i,latestVersion:o,upgradeAvailable:s,upgradeInstalled:!1};if(t===`check`)return y(`${r}@${i} → ${_}@${o} (${s?`available`:`up to date`})`,c);if(!s)return y(`${r}@${i} already matches ${_}@${o}`,c);if(n.workingTreeRoot!==null)return x(`Refusing to install over the working-tree build at ${n.workingTreeRoot}; rebuild via make instead`,["running CLI is npm-linked from the back-end checkout — `update` is for published bins"]);let l=zo(n),u;try{u=Bo(n,l)}catch(e){return x(`Cannot prepare MCP-owned CLI bins: ${Uo(e)}`,[`npm install was not run`])}let d=[`install`,`-g`];l!==null&&d.push(`--prefix`,l.installPrefix),d.push(`${_}@${o}`);let f=Lo(d,n,{stdio:[`ignore`,`inherit`,`inherit`]});if(!f.ok){let e=Vo(u,l?.installPrefix??null);return e===null?{...f,data:null}:x(`${f.summary}; MCP-owned CLI bin restoration failed`,[...f.warnings,e])}let p=l===null?void 0:Ro(l.entryPath,o);if(p?.ok===!1){let e=Vo(u,l?.installPrefix??null);return e===null?{...p,data:null}:x(`${p.summary}; MCP-owned CLI bin restoration failed`,[...p.warnings,e])}let m=Ho(u);if(m!==null)return x(`${_} upgraded but MCP CLI bin backup cleanup failed`,[m]);let g=Wo();return y(`${_} upgraded to ${o}`,{...c,upgradeInstalled:!0,installPrefix:l?.installPrefix,verifiedVersion:p?.data??void 0,completionRefreshed:g.refreshed,completionRefreshMessage:g.message})}function Lo(e,t,n={}){let r={...process.env};t.registry===`https://npm.pkg.github.com/`?r.NODE_AUTH_TOKEN??=r.GH_PACKAGES_TOKEN:delete r.GH_PACKAGES_TOKEN;let i=[...e,`--@aventurevc:registry=${t.registry}`],a=pt(`npm`,i,{env:r,encoding:`utf8`,...n});if(a.error)return a.signal===`SIGTERM`&&n.timeout!==void 0?x(`npm ${e[0]??``} did not answer within ${n.timeout}ms`,[`timeout`]):x(`npm ${e[0]??``} failed to start: ${a.error.message}`,[`spawn_error`]);if(a.status!==0){let t=(a.stderr??``).trim().split(`
|
|
25
|
-
`).slice(-3).join(` | `);return x(`npm ${e.join(` `)} exited ${a.status}`,[t||`no stderr`])}return y(`npm ok`,a.stdout??``)}function Ro(e,t){let n=pt(process.execPath,[e,`--version`],{encoding:`utf8`});if(n.error)return x(`updated ${_} verification failed: ${n.error.message}`,[`spawn_error`]);let r=(n.stdout??``).trim();if(n.status!==0||r!==t){let i=(n.stderr??``).trim().split(`
|
|
26
|
-
`).slice(-3).join(` | `);return x(`updated ${_} verification expected ${t} but active bin reported ${r||`empty output`}`,[i||`active bin: ${e}`])}return y(`active CLI version verified`,r)}function zo(e){let t=`${xt}lib${xt}node_modules${xt}${e.name.replace(`/`,xt)}`,n=e.packageRoot.lastIndexOf(t),r=e.bin.includes(`aventure-cli`)?`aventure-cli`:e.bin[0];return n<0?null:{entryPath:k(e.packageRoot.slice(0,n),`bin`,r),installPrefix:e.packageRoot.slice(0,n)}}function Bo(e,t){if(e.name!==`@aventurevc/mcp-server`)return{backup:[],backupDirectory:null};if(t===null)throw Error(`the running MCP package is not in a verifiable global npm prefix`);if(!e.entryPath.startsWith(`${e.packageRoot}${xt}`))throw Error(`the running CLI entry is outside the MCP package root`);let n=e.bin.filter(e=>e===`aventure`||e===`aventure-cli`).flatMap(n=>{let r=k(t.installPrefix,`bin`,n),i=Tt(r,{throwIfNoEntry:!1});if(i===void 0)return[];if(!i.isSymbolicLink())throw Error(`${r} is not a symlink`);let a;try{a=kt(r)}catch(e){throw Error(`${r} has a missing target`,{cause:e})}if(a!==e.entryPath)throw Error(`${r} is not owned by the running MCP CLI`);return{binPath:r,linkTarget:Ot(r)}});if(n.length===0)return{backup:[],backupDirectory:null};let r=Dt(k(t.installPrefix,`bin`,`.aventure-cli-update-`)),i=n.map(({binPath:e,linkTarget:t})=>({backupPath:k(r,bt(e)),binPath:e,linkTarget:t})),a=[];try{for(let e of i)if(At(e.binPath,e.backupPath),a.push(e),Ot(e.backupPath)!==e.linkTarget)throw Error(`${e.binPath} changed ownership while preparing the update`)}catch(e){let t=Vo({backup:a,backupDirectory:r},null);throw Error(`could not displace verified MCP CLI bins${t===null?``:`; restoration failed: ${t}`}`,{cause:e})}return{backup:a,backupDirectory:r}}function Vo(e,t){let n=t===null?null:k(t,`lib`,`node_modules`,..._.split(`/`)),r=[];for(let t of e.backup.toReversed())try{let e=Tt(t.binPath,{throwIfNoEntry:!1});if(e!==void 0){if(!e.isSymbolicLink())throw Error(`${t.binPath} is not a symlink`);let r=k(D(t.binPath),Ot(t.binPath));if(n===null||r!==n&&!r.startsWith(`${n}${xt}`))throw Error(`${t.binPath} is not owned by the standalone CLI package`);Nt(t.binPath)}At(t.backupPath,t.binPath)}catch(e){r.push(Uo(e))}if(e.backupDirectory!==null)try{Mt(e.backupDirectory)}catch(e){r.push(Uo(e))}return r.length===0?null:r.join(`; `)}function Ho(e){let t=[];for(let n of e.backup)try{Nt(n.backupPath)}catch(e){t.push(Uo(e))}if(e.backupDirectory!==null)try{Mt(e.backupDirectory)}catch(e){t.push(Uo(e))}return t.length===0?null:t.join(`; `)}function Uo(e){return e instanceof Error?e.message:String(e)}function Wo(){try{return _o()}catch(e){return{refreshed:!1,message:e instanceof Error?e.message:String(e)}}}var Go=[{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 its generated status operation`},{name:`auth`,purpose:`which credential scope materialized locally, never the secret`},{name:`catalog`,purpose:`this catalog was generated from the operation set the API serves`}],Ko=`operationFingerprint`;function qo(e,t=h().bin[0]){T(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: [...] }`:",...Go.map(e=>` - ${e.name}: ${e.purpose}`),``,`Exit code is 0 only when no check failed; a skipped check (no registry reachable)`,`does not fail the run. Each failing message names the command that fixes it.`,"--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(`
|
|
27
|
-
`))).action(async function(e){let n=this.optsWithGlobals();n.environment!==void 0&&(process.env.API_ENV=n.environment),R({mode:w(e)},await Jo(t))})}async function Jo(e){let t=Xo(),n=Zo(e),[r,i]=await Promise.all([Qo(e),$o(t,e)]),a=[n.check,r,i.check,await ts(e),cs(t,i.servedFingerprint,n.upgradeAvailable,e)],o={pass:Yo(a,`pass`),fail:Yo(a,`fail`),skip:Yo(a,`skip`)},s=a.filter(e=>e.status===`fail`).map(e=>e.message),c={ok:s.length===0,check:a},l=[`doctor: ${o.pass} pass, ${o.fail} fail, ${o.skip} skip`,...a.map(e=>` ${e.name} ${e.status} — ${e.message}`)].join(`
|
|
28
|
-
`);return c.ok?y(l,c,{counts:o}):{...x(l,s,{counts:o}),data:c}}function Yo(e,t){return e.filter(e=>e.status===t).length}function q(e,t,n){return{name:e,status:t,message:n}}function Xo(){return E.find(e=>e.intent===`status`&&e.resource===`status`)}function Zo(e){let t=h(),n=Io(t,`check`);if(!n.ok||n.data===null)return{check:q(`cli-version`,`skip`,`Could not compare ${t.version} against the registry (${n.summary}); rerun \`${e} update\` with registry access.`),upgradeAvailable:null};let{targetPackage:r,currentVersion:i,latestVersion:a,upgradeAvailable:o}=n.data;return{check:o?q(`cli-version`,`fail`,`Upgrade ${r} from ${i} to ${a}: run \`${e} update\`.`):q(`cli-version`,`pass`,`${r} ${i} matches the latest published release.`),upgradeAvailable:o}}async function Qo(e){try{let{EntityDetailSchema:e}=await import(`./detail-DeMsv_6C.js`);if(typeof e.safeParse!=`function`)throw Error(`EntityDetailSchema does not expose a Zod parser`);return q(`api-schemas`,`pass`,`Installed @aventurevc/api-schemas contracts resolve beyond the CLI startup path.`)}catch(t){return q(`api-schemas`,`fail`,`Reinstall the CLI: run \`${e} update\` — ${C(t)}.`)}}async function $o(e,t){if(e===void 0)return{check:q(`api-host`,`skip`,`No status operation resolved from the generated catalog; fix the catalog check first.`),servedFingerprint:null};let n;try{n=S().host}catch(e){return{check:q(`api-host`,`fail`,`Correct API_ENV or pass \`--environment <name>\` — ${C(e)}.`),servedFingerprint:null}}let r=await b({method:e.method,path:e.path,auth:e.auth,responseFormat:`json`}).catch(e=>x(C(e)));return r.ok?{check:q(`api-host`,`pass`,`${e.method} ${e.path} answered at ${n}.`),servedFingerprint:es(r.data)}:{check:q(`api-host`,`fail`,`Point the CLI at a reachable API host with \`--environment <name>\` or API_URL, then rerun \`${t} auth doctor\` — ${e.method} ${e.path} at ${n} returned ${r.summary}.`),servedFingerprint:null}}function es(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[Ko];return typeof n==`string`&&n.length>0?n:null}async function ts(e){await g();let t;try{t=te(await ee())}catch(t){return q(`auth`,`fail`,`Repair or remove ${c()} and run \`${e} auth init\` — ${C(t)}.`)}let[n,r]=await Promise.all([ns(),rs()]);if(r.state===`unavailable`&&r.cause===`environment`)return q(`auth`,`fail`,`Fix the environment configuration first — ${r.summary}.`);let i=t[oe.authToken].present,a=v.some(e=>t[e].present);return!i&&n.state===`invalid`?q(`auth`,`fail`,`Saved OAuth credential is invalid; run \`${e} auth login\` to sign in again after verification — ${n.summary}.`):!i&&n.state===`found`&&Ae(n.stored.credential)&&n.stored.credential.tokens.refresh_token===void 0?q(`auth`,`fail`,`Saved OAuth access token is expired without a refresh token; run \`${e} auth login\` to sign in again.`):!a&&r.state!==`found`&&n.state===`unavailable`?q(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login\`, or inject ${oe.authToken} through the environment — ${n.summary}.`):a||n.state===`found`||r.state===`found`?q(`auth`,`pass`,`Credential source available: ${is(t,n,r)}.`):r.state===`unavailable`?q(`auth`,`fail`,`Make the OS keyring or the CLI config directory usable before \`${e} auth login --key\`, or inject ${v.join(`/`)} through the environment — ${r.summary}.`):v.some(e=>t[e].source===`config`)?q(`auth`,`fail`,`The Doppler source in ${c()} resolved no credential: confirm your access to that project and config, or inject ${v.join(`/`)} through the environment.`):q(`auth`,`fail`,`Run \`${e} auth login\` for OAuth, \`${e} auth login --key\` for a personal credential, or \`${e} auth init\` to select a Doppler source.`)}async function ns(){let e;try{e=Me(S().host)}catch(e){return{state:`unavailable`,summary:C(e)}}return await we(e)}async function rs(){let e;try{e=Le(S().host)}catch(e){return{state:`unavailable`,summary:C(e),cause:`environment`}}try{return await $e(e)}catch(e){return{state:`unavailable`,summary:C(e),cause:`storage`}}}function is(e,t,n){return[...v.map(t=>`${t}=${as(e,t)}`),`oauth=${ss(t)}`,`personal=${os(n)}`].join(` `)}function as(e,t){let n=e[t];return n.present?n.source??`resolved`:n.source===`config`?`config (unresolved)`:`unset`}function os(e){return e.state===`found`?e.stored.activation:e.state===`missing`?`unset`:`unavailable`}function ss(e){switch(e.state){case`found`:return Ae(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 cs(e,t,n,r){let i=E.length;if(e===void 0)return q(`catalog`,`fail`,`Regenerate the command catalog with \`make mcp-generate-contracts\` and reinstall: none of its ${i} operations is the status operation.`);if(t===null)return q(`catalog`,`skip`,`Could not read the served operation fingerprint, so drift is unproven; this catalog holds ${i} operations at ${qe}.`);if(t===`e2c601b4e859c89d`)return q(`catalog`,`pass`,`${i} generated operations match the set the API serves (${qe}).`);let a=`This catalog describes a different operation set than the API serves (${qe} vs ${t})`;return n===!0?q(`catalog`,`fail`,`${a}: run \`${r} update\`.`):q(`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 ls=B(V,`oauth`),us=[B(V,`start`),B(V,`poll`),B(V,`acknowledge`)],ds=B(V,`revoke`),fs=`personal-login`,ps=`personal-logout`;function ms(e,t=h().bin[0]){let n=gs(e);qo(n,t),Ya(e,t);let r=[`${ls.description} Default method: OAuth in your browser.`,`With --key: ${us.map(({description:e})=>e).join(` `)}`].join(`
|
|
29
|
-
`),i=async function(e){_s(this);let n=w(e);if(e.providers===!0){R({mode:n},await bs());return}R({mode:n},e.key===!0?await Vi({noBrowser:!e.browser,clientLabel:e.clientLabel}):await dt({noBrowser:!e.browser},t))};T(hs(n,[ls,...us],r)).action(i),T(hs(n,[...us],r,fs)).action(async function(e){await i.call(this,{...e,key:!0})});let a=async function(e){_s(this),R({mode:w(e)},await ki({forgetLocal:e.forgetLocal===!0}))};T(hs(n,[ds],ds.description)).action(a),T(hs(n,[ds],ds.description,ps)).action(a),T(n.command(`init`).summary(`Interactive credential setup`).description([`Interactively record the Doppler project/config used by ${t} + the MCP server.`,`Credentials resolve from the injected environment first, then Doppler; auth init never writes credentials to disk.`,``,`Prompts go to stderr so stdout stays reserved for the result envelope.`].join(`
|
|
30
|
-
`))).action(async function(e){_s(this),R({mode:w(e)},await Es(t))}),T(n.command(`status`).summary(`Local credential provenance, API build, and server uptime`).description([`Reports local credentials plus two independent remote health signals:`,` - auth: per-credential local provenance (env vs ~/.config/aventure/config.json vs unset)`,` - oauth: stored OAuth access-token metadata for the selected API host, without the token`,` - personal: stored personal-key metadata for the selected API host, without the secret`,` - providers: GET /v1/auth/providers (Clerk instance and the CLI OAuth client)`,` - api: running CLI package version plus GET /info build metadata`,` - system: GET /v1/status response (Better Stack uptime SLA)`,``,`No headers are sent to the server. Credential provenance is computed locally; this`,`answers whether service credentials, OAuth, or a personal CLI credential are wired without exposing them.`,`To prove a credential survives transit, call any real endpoint that requires it.`].join(`
|
|
31
|
-
`))).action(async function(e){_s(this),R({mode:w(e)},await vs(t))})}function hs(e,t,n,r){let[i]=t,a=e.command(r??i.command.slice(i.command.indexOf(` `)+1),{hidden:r!==void 0}).summary(i.summary).description(n),o=new Set;for(let e of t)for(let t of[...e.bodyOption,...e.localOption])o.has(t.flag)||(o.add(t.flag),`required`in t&&t.required?a.requiredOption(t.flag,t.description):a.option(t.flag,t.description));return a}function gs(e){return(e.commands.find(e=>e.name()===`auth`)??e.command(`auth`)).summary(`Sign in, sign out, and check credentials`).description([`\`${ls.command}\`: ${ls.summary}; \`--key\` ${us[0].summary.toLowerCase()}.`,`\`${ds.command}\`: ${ds.summary}.`,"`auth status` reports local credential provenance, sign-in providers, and CLI/API build and uptime.","`auth doctor` runs the one-call selftest and prints `{ ok, check: [...] }`.","`auth init` configures the local Doppler source used by generated API commands."].join(`
|
|
32
|
-
`))}function _s(e){let t=e.optsWithGlobals();t.environment!==void 0&&(process.env.API_ENV=t.environment)}async function vs(e){let t;try{t=await ee()}catch(t){return x(`auth status: cannot read ${c()} — ${t instanceof Error?t.message:String(t)}`,[`configPath=${c()}`,`errorName=${t instanceof Error?t.name:`Error`}`,...Fs(e)])}let n;try{n=Me(S().host)}catch(e){return x(`auth status: invalid API host — ${C(e)}`)}let[r,i,a,o,s]=await Promise.all([Ts(`/v1/status`,`GET /v1/status`),Ts(`/info`,`GET /info`),we(n),Ss(n),xs()]),l=te(t),u=h().version,d=Zi(n,o),f=ia({cliName:e,cliVersion:u,apiVersion:i.ok?Cs(i.data):null,oauth:a,personal:d,providers:s,resolved:l,config:t,systemOk:r.ok}),p={cli:{version:u},api:i.ok?i.data??null:null,auth:As(t,l),oauth:ys(n,a),personal:d,providers:s,system:r.ok?r.data??null:null,...i.ok?{}:{apiError:i.summary},...r.ok?{}:{systemError:r.summary}};return js(l)||a.state===`found`||o.state===`found`?y(f,p):Ms(`auth status: no credentials resolved | ${f}`,p,e,{oauth:a.state===`missing`,personal:o.state===`missing`})}function ys(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:Ae(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}}async function bs(){let e=await xs();return e.state===`found`?y(`Sign-in providers for the selected API host`,e.catalog):x(`auth login --providers: ${e.summary}`)}async function xs(){try{return{state:`found`,catalog:await lt()}}catch(e){return{state:`unavailable`,summary:C(e)}}}async function Ss(e){try{return await $e(e)}catch(e){return{state:`invalid`,summary:C(e)}}}function Cs(e){if(!ws(e))return null;let t=ni.safeParse(Reflect.get(e,`response`));if(!t.success)return null;let n=t.data.build.version?.trim();return n&&n.length>0?n:null}function ws(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Ts(e,t){return await b({method:`GET`,path:e,auth:`none`,responseFormat:`json`}).catch(e=>x(`${t} failed: ${e instanceof Error?e.message:String(e)}`))}async function Es(e){if(!St.isTTY)return x(`${e} auth init requires an interactive TTY on stdin`,["non-interactive caller: hand-write `~/.config/aventure/config.json` directly",...Fs(e)]);let t=Rt({input:St,output:j});try{j.write(`${e} auth init\n\n`);let n=await Ds(t);try{await m(n)}catch(t){return x(`auth init: cannot write ${c()} — ${t instanceof Error?t.message:String(t)}`,[`configPath=${c()}`,`errorName=${t instanceof Error?t.name:`Error`}`,...Fs(e)])}return await g(),ks(`saved`,n,e)}finally{t.close()}}async function Ds(e){return{source:`doppler`,project:await Os(e,`Doppler project: `),config:await Os(e,`Doppler config (e.g. staging): `)}}async function Os(e,t){for(;;){let n=(await e.question(t)).trim();if(n.length>0)return n;j.write(` required
|
|
33
|
-
`)}}function ks(e,t,n){let r=te(t),i=`${Ps(e,t,r)} | ${Ns()}`,a=As(t,r);return js(r)?y(i,a):Ms(`no credentials resolved | ${i}`,a,n)}function As(e,t){return{configPath:c(),configSource:e?.source??null,...e?.source===`doppler`?{configProject:e.project,configConfig:e.config}:{},resolved:t}}function js(e){return v.some(t=>e[t].present)}function Ms(e,t,n,r={oauth:!0,personal:!0}){return{...x(e,[...r.personal?[`For a personal key (works over SSH), run \`${n} auth login --key\`.`]:[],...r.oauth?[`For OAuth, run \`${n} auth login\` in an interactive terminal.`]:[],h().registry===`https://registry.npmjs.org/`?`For non-interactive use, set AUTH_TOKEN to a personal API key in the environment.`:`Run \`${n} auth init\` to select Doppler, or inject credentials through the environment.`]),data:t}}function Ns(){return`read=${ue(`read`).ok?`available`:`unavailable`} write=${ue(`write`).ok?`available`:`unavailable`}`}function Ps(e,t,n){return`${e}: ${da(n)} | ${t===null?`no config`:`doppler ${t.project}/${t.config}`}`}function Fs(e){return[`no config at the path above — run \`${e} auth init\` in an interactive terminal, or write a non-secret Doppler source config:`,` {"auth":{"source":"doppler","project":"<project>","config":"<config>"}}`,`legacy inline configs are rejected; move credentials to Doppler or the environment before replacing the config.`]}function Is(e,t,n=h().bin[0]){let r=Er(t),i=e.find(e=>e.cliPath.join(` `)===r||e.cliAliasPath?.join(` `)===r||e.operationId===r);return i===void 0?x(`No generated operation matches "${t}"`,[`Resolve the exact command with \`${n} command-catalog search "<query>"\`.`]):y(`Resolved ${i.operationId}`,i)}function Ls(e){return e.parameters.some(e=>e.location===`path`)?x(`${e.operationId} has path parameters and cannot be batch-driven`,[e.path]):y(`no path parameters`,null)}function Rs(e){let t={};for(let n of e){let e=n.indexOf(`=`);if(e<=0)return x(`--query expects key=value, got "${n}"`);t[n.slice(0,e)]=n.slice(e+1)}return y(`query parsed`,t)}function zs(e,t,n,r){let i=Number(t);return!Number.isInteger(i)||i<n||i>r?x(`${e} must be an integer between ${n} and ${r}, got "${t}"`):y(`${e} parsed`,i)}function Bs(e){let t=d.safeParse(e);return t.success?t.data:void 0}function Vs(e,t){let n=Bs(e);for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n))return;n=n[e]}return n}function Hs(e){let t=Bs(e);return typeof t!=`object`||!t||Array.isArray(t)?null:t}function Us(e){return typeof e==`object`&&e&&`response`in e?Bs(e.response):Bs(e)}function Ws(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function Gs(e){if(!M(e))return x(`--input file not found: ${e}`);let t=N(e,`utf8`),n=[],r=t.split(`
|
|
34
|
-
`);for(let[e,t]of r.entries()){if(t.trim()===``)continue;let r=d.safeParse(Ys(t));if(!r.success)return x(`--input line ${e+1} is not valid JSON`,[t.slice(0,120)]);n.push(r.data)}return n.length===0?x(`--input has no NDJSON rows: ${e}`):y(`input parsed`,{row:n,digest:Xs(t)})}function Ks(e,t,n){let r={inputDigest:t,chunkSize:n,completedChunk:[]};if(e===void 0||!M(e))return y(`no checkpoint`,r);let i=Ys(N(e,`utf8`));if(i===void 0)return x(`--checkpoint file is not valid JSON: ${e}`);let a=Vs(i,`inputDigest`),o=Vs(i,`chunkSize`),s=Vs(i,`completedChunk`);if(a!==t||o!==n)return x(`--checkpoint ${e} was written for different input or chunk size`,[`Delete the checkpoint to start over, or restore the original input file.`]);if(!Array.isArray(s))return x(`--checkpoint ${e} has an invalid completedChunk list`);let c=s.filter(e=>Number.isInteger(e));return c.length===s.length?y(`checkpoint loaded`,{inputDigest:t,chunkSize:n,completedChunk:c}):x(`--checkpoint ${e} has an invalid completedChunk list`)}function qs(e,t,n,r){if(e===void 0)return;let i={inputDigest:t,chunkSize:n,completedChunk:[...r].toSorted((e,t)=>e-t)};P(e,`${JSON.stringify(i)}\n`)}function Js(e,t){return[...t,e]}function Ys(e){try{return JSON.parse(e)}catch{return}}function Xs(e){return mt(`sha256`).update(e).digest(`hex`)}function Zs(e,t,n=h().bin[0]){let r=e.command(`batch`).summary(`Export reads and run bulk writes as NDJSON`).description(`batch export pages a cursor read into an NDJSON file; batch preview reports a chunk plan; batch run sends chunked NDJSON writes with bounded concurrency and checkpoint/resume. Resolve targets with command-catalog search|show first.`);Qs(r,t,n),$s(r,t,`preview`,n),$s(r,t,`run`,n)}function Qs(e,t,n){let r=e.command(`export`).summary(`Page a cursor read operation into an NDJSON row file`).description([`Repeatedly call one generated cursor-paginated read operation and append`,`every returned row to --out as NDJSON while stdout stays a compact summary.`,` ${n} batch export --command "<resource> <area> <operation>" \\`,` --from-file filter.json --query size=200 --out rows.ndjson`].join(`
|
|
35
|
-
`)).requiredOption(`--command <command>`,`Generated CLI command path or operationId`).option(`--from-file <path>`,`JSON request body sent on every page`).option(`--query <key=value>`,`Query parameter, repeatable`,Js,[]).requiredOption(`--out <path>`,`NDJSON output file; overwritten at start`).option(`--cursor <cursor>`,`Starting cursor value`).option(`--cursor-param <name>`,`Cursor query parameter name`,`cursor`).option(`--rows-path <path>`,`Dot path to the row array in the response`,`row`).option(`--next-cursor-path <path>`,`Dot path to the next cursor in the response`,`nextCursor`).option(`--max-pages <count>`,`Safety cap on pages fetched`,`1000`);T(r),r.action(async function(){let e=this.optsWithGlobals();R({mode:w(e)},await ec(t,e,n))})}function $s(e,t,n,r){let i=e.command(n).summary(n===`run`?`Send NDJSON rows through a batched write operation`:`Preview one batched write operation without sending rows`).description(n===`run`?[`Chunk NDJSON rows into batched request bodies for one generated write`,`operation and send them with bounded concurrency. Every chunk response is`,`appended to --out as NDJSON; --checkpoint records completed chunks so an`,`interrupted run resumes without resending them.`,`Use batch preview to inspect the chunk plan before sending rows.`,`--execute is deprecated, accepted, and ignored; run executes by its verb.`].join(`
|
|
36
|
-
`):`Build the same chunk plan as batch run without sending rows or writing --out.`).requiredOption(`--command <command>`,`Generated CLI command path or operationId`).requiredOption(`--input <path>`,`NDJSON file; each line is one batch row`).requiredOption(`--array-field <name>`,`Body field receiving each chunk of rows`).option(`--base <path>`,`JSON file with fixed body fields merged into every chunk`).option(`--query <key=value>`,`Query parameter, repeatable`,Js,[]).requiredOption(`--out <path>`,`NDJSON file receiving one response line per chunk`).option(`--chunk-size <count>`,`Rows per request body`,`25`).option(`--concurrency <count>`,`Concurrent requests, 1-8`,`2`).option(`--checkpoint <path>`,`JSON checkpoint file for resume`).addOption(new f(`--no-halt-on-failure`,`keep sending remaining chunks after a failed chunk`));n===`run`&&i.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),T(i),i.action(async function(){let e=this.optsWithGlobals();R({mode:w(e)},await tc(t,e,n,r))})}async function ec(e,t,n){let r=Is(e,t.command,n);if(!r.ok||r.data===null)return r;if(ie(r.data.intent))return x(`${t.command} is a write operation; use \`batch run\``,[r.data.path]);let i=Ls(r.data);if(!i.ok)return i;let a=Rs(t.query??[]);if(!a.ok||a.data===null)return a;let o=zs(`--max-pages`,t.maxPages,1,1e6);if(!o.ok||o.data===null)return o;let s=t.fromFile===void 0?void 0:await Cn(t.fromFile);if(s!==void 0&&!s.ok)return s;let c=s===void 0?void 0:Hs(s.data);if(s!==void 0&&c===null)return x(`--from-file must contain a JSON object`,[t.fromFile??``]);P(t.out,``);let l=t.cursor,u=0,d=0,f=!1;for(;u<o.data;){let e={...a.data,...l===void 0?{}:{[t.cursorParam]:l}},n=await b({method:r.data.method,path:r.data.path,searchParams:e,body:c??void 0,auth:r.data.auth,responseFormat:`json`});if(!n.ok)return x(`page ${u+1} failed: ${n.summary}`,[`rows already written to ${t.out}: ${d}`,...l===void 0?[]:[`resume with --cursor "${l}"`]]);let i=Us(n.data),o=Vs(i,t.rowsPath);if(!Array.isArray(o))return x(`response has no array at --rows-path "${t.rowsPath}"`,[`page ${u+1}`]);Ct(t.out,o.map(e=>`${JSON.stringify(e)}\n`).join(``)),u+=1,d+=o.length;let s=Vs(i,t.nextCursorPath);if(typeof s!=`string`||s===``||s===l){f=!0;break}l=s}return y(`${d} rows across ${u} pages written to ${t.out}${f?``:`; PARTIAL export — hit --max-pages ${o.data}, resume with --cursor "${l}"`}`,{outPath:t.out,exhausted:f,lastCursor:l},{counts:{pageCount:u,rowCount:d}})}async function tc(e,t,n,r){let i=Is(e,t.command,r);if(!i.ok||i.data===null)return i;if(!ie(i.data.intent))return x(`${t.command} is not a write operation; use \`batch export\``,[i.data.path]);let a=Ls(i.data);if(!a.ok)return a;let o=Rs(t.query??[]);if(!o.ok||o.data===null)return o;let s=zs(`--chunk-size`,t.chunkSize,1,1e4);if(!s.ok||s.data===null)return s;let c=zs(`--concurrency`,t.concurrency,1,8);if(!c.ok||c.data===null)return c;let l=t.base===void 0?void 0:await Cn(t.base);if(l!==void 0&&!l.ok)return l;let u=Hs(l?.data??{});if(u===null)return x(`--base must contain a JSON object`,[t.base??``]);let d=Gs(t.input);if(!d.ok||d.data===null)return d;let f=Ws(d.data.row,s.data),p=Ks(t.checkpoint,d.data.digest,s.data);if(!p.ok||p.data===null)return p;let m=new Set(p.data.completedChunk),h=[...f.keys()].filter(e=>!m.has(e));if(n===`preview`)return y(`PREVIEW — nothing sent. ${h.length} of ${f.length} chunks (${d.data.row.length} rows) would ${i.data.method} ${i.data.path}. Run ${r} batch run to send.`,{mode:`preview`,method:i.data.method,endpoint:i.data.path,arrayField:t.arrayField,outPath:t.out},{counts:{rowCount:d.data.row.length,chunkCount:f.length,pendingChunkCount:h.length,skippedChunkCount:m.size}});P(t.out,``,{flag:m.size>0?`a`:`w`});let g=i.data,ee=o.data,te=d.data.digest,ne=s.data,re=[],ae=!1,_=0,v=async e=>{let n=f[e]??[],r={...u,[t.arrayField]:n},i=await b({method:g.method,path:g.path,searchParams:ee,body:r,auth:g.auth,responseFormat:`json`}),a=i.ok?Us(i.data):null;return Ct(t.out,`${JSON.stringify({chunk:e,rowCount:n.length,ok:i.ok,summary:i.summary,response:a??i.data??null})}\n`),i.ok?(m.add(e),qs(t.checkpoint,te,ne,m),!0):(re.push(e),!1)};await Promise.all(Array.from({length:c.data},async()=>{for(;!ae;){let e=h[_];if(_+=1,e===void 0)return;!await v(e)&&t.haltOnFailure&&(ae=!0)}}));let oe={rowCount:d.data.row.length,chunkCount:f.length,completedChunkCount:m.size,failedChunkCount:re.length,remainingChunkCount:f.length-m.size-re.length},se={outPath:t.out,checkpointPath:t.checkpoint,failedChunk:re,halted:ae};return re.length>0?x(`${re.length} chunk(s) failed; responses in ${t.out}${t.checkpoint===void 0?``:`, resume via --checkpoint ${t.checkpoint}`}`,[JSON.stringify({...se,...oe})]):y(`${m.size}/${f.length} chunks sent; responses in ${t.out}`,se,{counts:oe})}function nc(e,t=E,n=h().bin[0]){let r=e.command(`completion`).summary(`Generate shell completion scripts`).description(`Generate shell completion scripts for the aVenture CLI.`);for(let i of[`bash`,`fish`,`zsh`])r.command(i).summary(`Print ${i} shell completions`).description(`Print ${i} completion definitions for ${n}.`).action(()=>{A.stdout.write(ic(e,i,t))});mo(r,n),ho(r,n)}function rc(){return h().bin}function ic(e,t,n=E,r=rc()){let i=pc(n);return t===`fish`?[`# fish completions for ${r.join(`, `)}`,...oc(e),...r.map(e=>`complete -c ${J(e)} -e`),`${Ec(r)} -f`,...sc(e,r),...cc(e,i,r),``].join(`
|
|
37
|
-
`):ac(e,t,i,r)}function ac(e,t,n,r){let i=t===`zsh`?`typeset -ga `:``,a=`complete -F _aventure_cli ${r.map(e=>e.replaceAll(`'`,`'\\''`)).join(` `)}`,[o,s,c]=gc(e,n);return[...t===`zsh`?[`#compdef ${r.join(` `)}`]:[],`# ${t} completions for ${r.join(`, `)}`,`${i}_aventure_cli_commands=(`,...o.map(e=>` ${e}`),`)`,`${i}_aventure_cli_options=(`,...s.map(e=>` ${e}`),`)`,`${i}_aventure_cli_values=(`,...c.map(e=>` ${e}`),`)`,``,...yc(t),...t===`bash`?[a,``]:[``]].join(`
|
|
38
|
-
`)}function oc(e){return[`function __aventure_cli_command_path\n set -l global_value_options ${lc(e).filter(e=>e.required||e.optional).flatMap(e=>Sc(e)??[]).map(J).join(` `)}\n set -l tokens (commandline -xpc)\n if test (count $tokens) -gt 0\n set -e tokens[1]\n end\n set -l path\n set -l skip_next 0\n for token in $tokens\n if test $skip_next -eq 1\n set skip_next 0\n continue\n end\n if string match -q -- '--*=*' $token\n set -l name (string replace -r '^--([^=]+)=.*$' '$1' -- $token)\n contains -- $name $global_value_options; and continue\n end\n if string match -q -- '--*' $token\n set -l name (string replace -r '^--' '' -- $token)\n if contains -- $name $global_value_options\n set skip_next 1\n continue\n end\n break\n end\n if string match -q -- '-*' $token\n break\n end\n set -a path $token\n end\n printf '%s\\n' $path\nend\n`,`function __aventure_cli_path_is
|
|
39
|
-
set -l expected $argv
|
|
40
|
-
set -l actual (__aventure_cli_command_path)
|
|
41
|
-
if test (count $actual) -ne (count $expected)
|
|
42
|
-
return 1
|
|
43
|
-
end
|
|
44
|
-
if test (count $expected) -eq 0
|
|
45
|
-
return 0
|
|
46
|
-
end
|
|
47
|
-
for index in (seq (count $expected))
|
|
48
|
-
if test $actual[$index] != $expected[$index]
|
|
49
|
-
return 1
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
return 0
|
|
53
|
-
end
|
|
54
|
-
`].flatMap(e=>e.split(`
|
|
55
|
-
`))}function sc(e,t){return hc(e).map(e=>`${Ec(t)} -f -n ${J(Dc(e.parentPath))} -a ${J(e.name)} -d ${J(e.description)}`).toSorted((e,t)=>e.localeCompare(t))}function cc(e,t,n){return Cc(e).flatMap(e=>{let r=Tc(e),i=r.length===0?void 0:Dc(r);return lc(e).flatMap(e=>{let a=t.get(mc(r,e));return vc(a)?uc(e,i,a,n):[]})}).toSorted((e,t)=>e.localeCompare(t))}function lc(e){return e.parent===null?e.createHelp().visibleOptions(e):e.options}function uc(e,t,n,r){let i=Sc(e);if(i===void 0)return[];let a=e.argChoices??_c(n),o=[`-l ${J(i)}`,e.short===void 0?``:`${e.short.startsWith(`--`)?`-l`:`-s`} ${J(e.short.replace(/^-+/,``))}`].filter(Boolean),s=t===void 0?``:` -n ${J(t)}`,c=e.required||e.optional?dc(a,fc(i,n)):`-f`,l=`${Ec(r)}${s} ${o.join(` `)} ${c}`;return a===void 0||a.length===0?[`${l} -d ${J(Oc(e.description))}`]:a.map(t=>`${l} -a ${J(t)} -d ${J(Oc(e.description))}`)}function dc(e,t){return e!==void 0&&e.length>0?`-x`:t?`-r -F`:`-r -f`}function fc(e,t){return e===`from-file`?!0:t===void 0||t.some(({location:e})=>e!==`body`)?!1:t.every(({schemaFormat:e})=>e===`binary`)?!0:t.length===1&&[`file`,`path`].includes(e.split(`-`).at(-1)??``)}function pc(e){return new Map(e.flatMap(e=>[...e.parameters.map(e=>[e]),...hn(e.requestBody??[]).map(({variant:e})=>e.map(({parameter:e})=>e))].flatMap(t=>{let n=t[0];if(n===void 0)throw Error(`Generated CLI option has no parameter`);let r=e.cliAliasPath===void 0?[]:[e.cliAliasPath];return[e.cliPath,...r].map(e=>[mc(e,n),t])})))}function mc(e,t){let n=`flag`in t?t.flag.split(/\s+/)[0]?.replace(/^--/,``):Sc(t);if(`flag`in t&&(n===void 0||n.length===0||n===t.flag))throw Error(`Cannot render completion for option flag: ${t.flag}`);return`${e.join(`\0`)}\u0000${n??``}`}function hc(e){return Cc(e).flatMap(e=>e.commands.map(t=>({parentPath:Tc(e),name:t.name(),description:Oc(t.summary()||t.description()||t.name())})))}function gc(e,t){let n=[],r=[];for(let i of Cc(e)){let e=Tc(i);for(let a of lc(i)){let i=Sc(a);if(i===void 0)continue;let o=t.get(mc(e,a));if(!vc(o))continue;let s=a.argChoices??_c(o),c=`none`;(a.required||a.optional)&&(c=s!==void 0&&s.length>0?`choice`:`scalar`,c===`scalar`&&fc(i,o)&&(c=`file`)),n.push(bc([e.join(` `),`--${i}`,a.short??``,a.description,c]));for(let t of s??[])r.push(bc([e.join(` `),`--${i}`,t,a.description]))}}return[hc(e).map(e=>bc([e.parentPath.join(` `),e.name,e.description])).toSorted((e,t)=>e.localeCompare(t)),n.toSorted((e,t)=>e.localeCompare(t)),r.toSorted((e,t)=>e.localeCompare(t))]}function _c(e){let t=e?.[0]?.choices;if(e!==void 0&&t!==void 0)return e.every(e=>e.choices?.length===t.length&&e.choices.every((e,n)=>e===t[n]))?t:void 0}function vc(e){return e?.some(({visibility:e})=>e!==`private`)??!0}function yc(e){let t=e===`bash`,n=t?`COMP_WORDS`:`words`,r=t?`COMP_CWORD`:`CURRENT`,i=t?"${path[*]}":"${(j: :)path}",a=t?'"${_aventure_cli_options[@]}"':`$_aventure_cli_options`,o=t?'"${_aventure_cli_values[@]}"':`$_aventure_cli_values`,s=t?'"${_aventure_cli_commands[@]}"':`$_aventure_cli_commands`;return[`function _aventure_cli {`,` local current="\${${n}[${r}]}" previous="\${${n}[${r}-1]}" row row_path long short description mode name value option token key prefix candidate file_current`,...t?[` COMPREPLY=()`]:[],` local index=${t?1:2} skip_next=0; local -a path names descriptions`,` while (( index < ${r} )); do`,` token="\${${n}[index]}"; (( skip_next )) && { skip_next=0; (( index++ )); continue; }`,` if [[ "$token" == -* && "$token" != "-" && "$token" != "--" ]]; then`,` option="\${token%%=*}"; key="${i}"; mode=''`,` for row in ${a}; do IFS='|' read -r row_path long short description mode <<< "$row"; [[ "$row_path" == "$key" && ( "$long" == "$option" || "$short" == "$option" ) ]] && break; mode=''; done`,` [[ -n "$mode" && "$mode" != none && "$token" != *=* ]] && skip_next=1`,` elif [[ "$token" != -* ]]; then path+=("$token"); fi`,` (( index++ ))`,` done`,` key="${i}"`,` if [[ "$current" == --*=* || ( "$previous" == -* && "$current" != -* ) ]]; then`,` option="$previous"; prefix=''; file_current="$current"; [[ "$current" == --*=* ]] && { option="\${current%%=*}"; prefix="$option="; file_current="\${current#*=}"; }`,` for row in ${a}; do IFS='|' read -r row_path long short description mode <<< "$row"; [[ "$row_path" == "$key" && ( "$long" == "$option" || "$short" == "$option" ) ]] && { option="$long"; break; }; mode=''; done`,t?` [[ "$mode" == file ]] && { while IFS= read -r candidate; do COMPREPLY+=("$prefix$candidate"); done < <(compgen -f -- "$file_current"); return 0; }`:` [[ "$mode" == file ]] && { _files; return 0; }`,t?` [[ "$mode" == choice ]] && for row in ${o}; do IFS='|' read -r row_path long value description <<< "$row"; [[ "$row_path" == "$key" && "$long" == "$option" ]] && { candidate="$prefix$value"; [[ "$candidate" == "$current"* ]] && COMPREPLY+=("$candidate"); }; done`:` [[ "$mode" == choice ]] && for row in ${o}; do IFS='|' read -r row_path long value description <<< "$row"; [[ "$row_path" == "$key" && "$long" == "$option" ]] && { names+=("$prefix$value"); descriptions+=("$description"); }; done`,` elif [[ "$current" == -* ]]; then`,` for row in ${a}; do`,` IFS='|' read -r row_path long short description mode <<< "$row"`,t?` [[ "$row_path" == "$key" ]] && { [[ "$long" == "$current"* ]] && COMPREPLY+=("$long"); [[ -n "$short" && "$short" == "$current"* ]] && COMPREPLY+=("$short"); }`:` [[ "$row_path" == "$key" ]] && { names+=("$long"); descriptions+=("$description"); [[ -n "$short" ]] && { names+=("$short"); descriptions+=("$description"); }; }`,` done`,` elif [[ "$previous" != -* ]]; then`,` for row in ${s}; do`,` IFS='|' read -r row_path name description <<< "$row"`,t?` [[ "$row_path" == "$key" ]] && { [[ "$name" == "$current"* ]] && COMPREPLY+=("$name"); }`:` [[ "$row_path" == "$key" ]] && { names+=("$name"); descriptions+=("$description"); }`,` done`,` fi`,...t?[]:[" (( ${#names} )) && compadd -d descriptions -a names"],` return 0`,`}`,...t?[]:[`_aventure_cli "$@"`]]}function bc(e){return`$'${e.map(xc).join(`|`)}'`}function xc(e){return Oc(e).replaceAll(`\\`,`\\\\`).replaceAll(`'`,`\\'`).replaceAll(`|`,` `)}function Sc(e){return e.long?.replace(/^--/,``)}function Cc(e){return[e,...e.commands.filter(wc).flatMap(e=>Cc(e))]}var wc=e=>e.parent?.createHelp().visibleCommands(e.parent).includes(e)??!0;function Tc(e){let t=[];for(let n=e;n?.parent!==null;n=n.parent)t.unshift(n.name());return t}function Ec(e){return`complete ${e.map(e=>`-c ${J(e)}`).join(` `)}`}function Dc(e){return[`__aventure_cli_path_is`,...e.map(J)].join(` `)}function Oc(e){return e.replace(/\s+/g,` `).trim()}function J(e){return`'${e.replace(/[\r\n\t]/g,` `).replaceAll(`\\`,`\\\\`).replaceAll(`'`,`\\'`)}'`}function kc(e,t){if(e!==t)return;let n=Ac(t);n!==void 0&&t.error(`error: ${Mc(t)} takes text input, not a JSON object.\n${n}`,{code:`aventure.payloadOperand`})}function Ac(e){if(!process.argv.includes(`--`)&&e.args.some(jc))return`hint: use the command's named options instead of a JSON payload; run --help to list them.`}function jc(e){if(!e.startsWith(`{`))return!1;try{return typeof JSON.parse(e)==`object`}catch{return!1}}function Mc(e){let t=[];for(let n=e;n?.parent;n=n.parent)t.unshift(n.name());return t.join(` `)}function Nc(e){return e.message.match(/required option '([^']+)' not specified/iu)?.[1]?.split(/\s+/u)[0]}function Pc(e){return e.message.match(/unknown option '([^']+)'/iu)?.[1]}function Fc(e){return e.message.match(/unknown command '([^']+)'/iu)?.[1]}function Ic(e){return e.flags.split(` `)[0]??e.flags}function Lc(e,t){let n=Nc(t);if(n===void 0)return;let r=e.options.findIndex(e=>Ic(e)===n);if(r<0)return;let i=e.options.slice(r+1).filter(e=>e.mandatory).map(t=>[Ic(t),e.getOptionValue(t.attributeName())]).find(([,e])=>typeof e==`string`&&e.length>0)?.[0];if(i!==void 0)return`hint: ${n} is still required for this nested command; supplied child selector ${i} does not replace the parent selector.`}function Y(e){let t=[];for(let n=e;n!==null&&n.parent!==null;n=n.parent)t.unshift(n.name());return t}function Rc(e){return e.commands.length===0?[e]:e.commands.flatMap(Rc)}function zc(e,t){return Y(t).slice(Y(e).length)}function X(e){let t=e;for(;t.parent!==null;)t=t.parent;return t}function Bc(e,t){return t.toSorted((t,n)=>{let r=zc(e,t),i=zc(e,n),a=r.at(-1)===`get`?0:1,o=i.at(-1)===`get`?0:1;return r.length-i.length||a-o})[0]}function Vc(e){return/^[A-Za-z0-9_./:=@+-]+$/u.test(e)?e:`'${e.replaceAll(`'`,`'"'"'`)}'`}function Hc(e,t){let n=Y(e),r=process.argv.slice(2+n.length);return[X(e).name(),...n,...zc(e,t),...r].map(Vc).join(` `)}function Uc(e,t){let n=Pc(t);if(n===void 0||e.commands.length===0)return;let r=Bc(e,Rc(e).filter(e=>e.options.some(e=>Ic(e)===n)));if(r!==void 0)return`hint: run: ${Hc(e,r)}`}function Wc(e){return e!==void 0&&Object.hasOwn(We,e)}function Gc(e,t){let n=e;for(let e of t){let t=n.commands.find(t=>t.name()===e);if(t===void 0)return;n=t}return n}function Kc(e,t){let n=Y(e),r=[...n.slice(1),t];if(!Wc(n.at(0))||!Wc(r.at(0)))return;let i=Gc(X(e),r);if(i===void 0)return;let a=i;for(let e of process.argv.slice(2+n.length+1)){if(e.startsWith(`-`))break;let t=a.commands.find(t=>t.name()===e);if(t===void 0)break;r.push(e),a=t}return r}function qc(e,t){let[n]=Y(e);if(!Wc(n))return;let r=[n,t];return Gc(X(e),r)?.commands.length===0?r:void 0}function Jc(e){let[t,...n]=e.args;if(t===void 0)return[];let r=Rc(X(e)).map(Y),i=n.findIndex((e,t)=>{let i=[...n.slice(0,t),e];return!r.some(e=>e.some((t,n)=>t===i[0]&&i.every((t,r)=>e[n+r]===t)))});return[t,...i<0?n:n.slice(0,i)]}function Yc(e,t){let n=Y(e),r=process.argv.slice(2+n.length);if(t.length===0||t.some((e,t)=>r[t]!==e))return;let i=Be(E).map(e=>e.cliPath).filter(e=>e[0]!==n[0]&&e.length>=t.length&&t.every((n,r)=>e[e.length-t.length+r]===n)),a=i.find(e=>e.length===t.length&&e.every((e,n)=>e===t[n]))??(i.length===1?i[0]:void 0);if(a!==void 0)return`hint: run: ${[X(e).name(),...a].map(Vc).join(` `)}`}function Xc(e,t,n){if(!Qc(t))return;let r=e.args.slice(n.length),i=r.findIndex(e=>e.startsWith(`-`));return`hint: Did you mean: ${[X(e).name(),...t,...i<0?[]:r.slice(i)].map(Vc).join(` `)}`}function Zc(e){let t=Y(e);if(t.at(1)!==void 0&&Wc(t.at(0)))return`hint: inspect generated command group: ${[X(e).name(),...t,`--help`].map(Vc).join(` `)}`}function Qc(e,t){let n=e.join(` `);return E.some(e=>{let r=`cliAliasPath`in e?e.cliAliasPath:void 0;return e.cliPath.join(` `)!==n&&r?.join(` `)!==n?!1:t===void 0||ie(e.intent)===t})}function $c(e){let t=Y(e);if(Wc(t.at(0))&&Qc(t))return`hint: inspect generated command: ${[X(e).name(),...t,`--help`].map(Vc).join(` `)}`}function el(e){let t=new Set,n=[];for(let r of E){let i=Gc(e,r.cliPath);if(i===void 0)continue;let a=i.options.map(Ic);if(ie(r.intent))n.push(a);else for(let e of a)t.add(e)}let[r=[],...i]=n;return new Set(r.filter(e=>!t.has(e)&&i.every(t=>t.includes(e))))}function tl(e,t){let n=Y(e);if(Qc(n,!1)&&el(X(e)).has(t))return`hint: ${n.join(` `)} is a read operation; ${t} is a deprecated compatibility option only on mutation commands`}function nl(e,t,n=!0){let r=X(e),i=r.commands.find(e=>e.name()===`command-catalog`),a=i?.commands.find(e=>e.name()===`search`);if(i===void 0||a===void 0)return;let o=[r.name(),i.name(),a.name(),t],s=Y(e).at(0),c=a.options.find(e=>Ic(e)===`--root`);return n&&s!==void 0&&c!==void 0&&Wc(s)&&o.push(Ic(c),s),`hint: search generated commands: ${o.map(Vc).join(` `)}`}function rl(e,t){let n=Fc(t);if(n===void 0||t.message.includes(`
|
|
56
|
-
(Did you mean `))return;let r=Jc(e),i=Yc(e,r);if(i!==void 0)return i;let a=Kc(e,n);if(a!==void 0)return nl(e,a.join(` `),!1);let o=qc(e,n);if(o!==void 0)return Xc(e,o,r)??nl(e,o.join(` `),!1);let s=r.join(` `)||n;return Zc(e)??nl(e,s)}function il(e){return t=>{if(t.code===`commander.missingMandatoryOptionValue`){let n=e.options.filter(t=>t.mandatory&&e.getOptionValue(t.attributeName())===void 0);if(n.length>1){let e=n.map(e=>e.flags.split(`, `).at(-1)??e.flags);process.stderr.write(`error: missing required options: ${e.join(`, `)}\n`)}for(let n of[Ac(e),Lc(e,t)])n!==void 0&&process.stderr.write(`${n}\n`)}else if(t.code===`commander.excessArguments`){let t=Ac(e)??$c(e);t!==void 0&&process.stderr.write(`${t}\n`)}else if(t.code===`commander.unknownOption`){let n=Pc(t),r=Uc(e,t)??(n!==void 0&&!t.message.includes(`
|
|
57
|
-
(Did you mean `)?tl(e,n)??nl(e,n.replace(/^--/u,``)):void 0);r!==void 0&&process.stderr.write(`${r}\n`)}else if(t.code===`commander.unknownCommand`){let n=rl(e,t);n!==void 0&&process.stderr.write(`${n}\n`)}process.exit(t.exitCode)}}var al=class extends f{group;constructor(e){super(`-h, --help`,`display help for command`),this.group=e}is(e){if(e!==this.short&&e!==this.long)return!1;let t=this.group.args.at(0);return t===void 0||t.startsWith(`-`)?!0:this.group.commands.some(e=>e.name()===t||e.aliases().includes(t))}};function ol(e){e.showHelpAfterError(!1).exitOverride(il(e)),e.commands.length===0?e.hook(`preAction`,kc):e.addHelpOption(new al(e));for(let t of e.commands)ol(t)}var sl=`dist/aventure-cli/command-catalog.compact.txt`,cl=` · `,ll=`-`;function ul(e=h().bin[0]){return k(dl(D(Pt(import.meta.url)),e),sl)}function dl(e,t){let n=e;for(;;){if(M(k(n,`package.json`)))return n;let r=D(n);if(r===n)throw Error(`No package.json above ${e}; ${t} is not in a package layout.`);n=r}}function fl(e,t){let n=t.join(` `).trim();return n.length===0?e:{...e,q:e.q===void 0?n:`${e.q} ${n}`}}function pl(e,t,n,r=h().bin[0]){let i=nr(e,t,r);if(!i.ok){R({mode:n},i);return}hl({opts:e,mode:n,data:i.data,defaultFormat:`lines`,rendered:_l(i.data,gl(e.format,`lines`)),summary:`Generated operation matches`})}function ml(e,t,n,r=h().bin[0]){let i=rr(e,t,r);if(!i.ok||i.data===null){R({mode:n},i);return}hl({opts:e,mode:n,data:i.data,defaultFormat:`usage`,rendered:vl(i.data,gl(e.format,`usage`)),summary:`Generated operation detail`})}function hl(e){let t=e.mode,n=e.rendered.endsWith(`
|
|
58
|
-
`)?e.rendered:`${e.rendered}\n`;if(e.opts.output!==void 0){P(e.opts.output,n),R({mode:t},y(e.summary,{outputPath:e.opts.output,byteLength:Buffer.byteLength(n,`utf8`),format:gl(e.opts.format,e.defaultFormat)},{counts:Cl(e.data)}));return}if(t===`text`){process.stdout.write(n);return}R({mode:t},y(e.summary,e.data,{counts:Cl(e.data)}))}function gl(e,t){return e??t}function _l(e,t){return t===`json`?JSON.stringify(e,null,2):t===`ndjson`?e.operation.map(e=>JSON.stringify(e)).join(`
|
|
59
|
-
`):t===`text`?xl(e.operation):t===`compact`?e.operation.map(yl).join(`
|
|
60
|
-
`):e.operation.map(Sl).join(`
|
|
61
|
-
`)}function vl(e,t){return t===`json`?JSON.stringify(e,null,2):t===`ndjson`?JSON.stringify(e.operation):t===`lines`?Sl(e.operation):t===`compact`?yl(e.operation):e.usage}function yl(e){let t=bl(e);return[e.cli.command,e.summary,t.length===0?ll:t.join(` `)].join(cl)}function bl(e){return e.flags.filter(t=>t.required&&(t.contentType===void 0||t.contentType===e.body.contentType)).map(e=>e.name)}function xl(e){return e.map(e=>`${e.cli.command}\n ${Sl(e)}`).join(`
|
|
62
|
-
`)}function Sl(e){let t=bl(e);return[Z(`operationId`,e.operationId),Z(`scope`,e.scope),Z(`mutates`,String(e.mutates)),Z(`destructive`,String(e.destructive)),Z(`intent`,e.intent),Z(`resource`,e.resource),Z(`cli`,e.cli.command),e.cli.alias===null?``:Z(`alias`,e.cli.alias),e.mcpTool===null?``:Z(`mcpTool`,e.mcpTool),Z(`method`,e.method),Z(`path`,e.path),Z(`auth`,e.auth),Z(`flags`,[...new Set(e.flags.map(e=>e.name))].join(` `)),Z(`requiredFlags`,t.join(` `)),Z(`bodyKind`,e.body.kind??``),Z(`bodyRequired`,String(e.body.required)),Z(`summary`,e.summary)].filter(e=>e.length>0).join(` `)}function Z(e,t){return t.length===0?``:`${e}=${JSON.stringify(t)}`}function Cl(e){return`count`in e?e.count:{returned:1}}function wl(e,t=new Date){let n=Dl(e);return{schemaVersion:1,generatedFrom:`MCP_GENERATION_CONTRACT`,generatedAt:t.toISOString(),totalOperations:n.length,note:`Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.`,operations:n}}function Tl(e){return`${JSON.stringify(e,null,2)}\n`}function El(e,t){let n=k(e),r=Tl(t);return Et(D(n),{recursive:!0}),P(n,r),{target:n,byteLength:Buffer.byteLength(r,`utf8`),totalOperations:t.totalOperations}}function Dl(e){return e.map(e=>({operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliCommand:e.projection.cliPath.join(` `),cliPath:e.projection.cliPath,cliAliasCommand:e.projection.cliAliasPath?.join(` `)??null,cliAliasPath:e.projection.cliAliasPath??null,mcpTool:u(e.intent),bodySchemaName:e.requestBody?.[0]?.schemaName??null,bodySchemaImport:e.requestBody?.[0]?.schemaImport??null,auth:e.projection.auth,scope:e.projection.scope,destructive:e.projection.destructive})).toSorted((e,t)=>e.path.localeCompare(t.path)||e.method.localeCompare(t.method)||e.operationId.localeCompare(t.operationId))}var Ol=`Match only the first canonical or CLI-alias command segment`;function kl(e,t,n=h().bin[0]){jl(e,t,n);let r=e.command(`command-catalog`).summary(`LLM agent only: search generated CLI metadata`).description([`LLM agent only: search and dump generated ${n} command metadata.`,`This is read-only command metadata derived from the generated OpenAPI command specs.`,`Use --format lines for rg/grep/ag/ack and --format ndjson|json for ast-grep/sg/parsers.`,"Use --format compact for one `cli · summary · requiredFlags` row per operation."].join(`
|
|
63
|
-
`));r.addHelpText(`after`,()=>`\nShipped compact catalog, greppable without running this CLI:\n ${ul(n)}\n`),Al(r,t,n),Pl(r,t,n),Fl(r,t,n),Il(r)}function Al(e,t,n){let r=e.command(`search`).summary(`Search generated operations`).description(`Search generated operation metadata without calling the API.`).argument(`[query...]`,`Search query; same as --q.`).option(`--q <query>`,`Search generated command metadata`).option(`--root <root>`,Ol).addOption(new f(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new f(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new f(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new f(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new f(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`,`20`).addOption(new f(`--format <format>`,`Text/file render format`).choices([`text`,`lines`,`compact`,`json`,`ndjson`]).default(`lines`)).option(`--output <path>`,`Write rendered output to a file`);T(r),r.action(function(e){let r=this.optsWithGlobals(),i=w(r,`text`),a=r.limit?.trim()??``,o=a===``?NaN:Number(a);if(!Number.isInteger(o)||o<0){R({mode:i},x(`Invalid --limit value: ${JSON.stringify(r.limit)} (expected a non-negative integer)`,["Pass a non-negative integer, e.g. `--limit 20`; omit the flag for the default of 20."]));return}pl(fl(r,e),t,i,n)})}function jl(e,t,n){let r=e.command(`docs`).summary(`Look up generated API documentation offline`).description(`Print generated operation documentation without calling the API.`).command(`api`).summary(`Show documentation for one operation`).description([`Print one operation's summary, description, flags, example, and error contract.`,"Select it by `<METHOD> <path>` (route template or concrete path), by operationId,",`or by CLI command path, e.g. "entities get".`].join(`
|
|
64
|
-
`)).argument(`<selector...>`,`METHOD and path, an operationId, or a CLI command path`);T(r),r.action(function(e){let r=this.optsWithGlobals(),i=w(r),a=Nl(e,t);if(!a.ok||a.data===null){R({mode:i},a);return}ml({...r,...a.data},t,i,n)})}var Ml='Accepted selectors: `<METHOD> <route template or concrete path>`, an operationId, or a CLI command path such as "entities get".';function Nl(e,t){let[n,...r]=e,i=de.find(e=>e===n?.toLowerCase());if(i===void 0||r.length===0){let n=e.join(` `).trim();return y(`Resolved by name`,t.some(e=>e.operationId===n)?{operationId:n}:{command:n})}let a=he(i),o=r.join(``),s=t.find(e=>e.method===a&&e.path===o);if(s!==void 0)return y(`Resolved by route template`,{operationId:s.operationId});let c=le({method:a,path:o});return!c.ok||c.data===null?x(c.summary,[...c.warnings,Ml]):y(`Resolved by method and path`,{operationId:c.data.operation.operationId})}function Pl(e,t,n){let r=e.command(`show`).summary(`Show one generated operation`).description(`Show one generated operation by command path or operationId.`).option(`--command <command>`,`CLI command path, with or without ${n} prefix`).option(`--operation-id <operationId>`,`Generated OpenAPI operationId`).addOption(new f(`--format <format>`,`Text/file render format`).choices([`usage`,`lines`,`compact`,`json`,`ndjson`]).default(`usage`)).option(`--output <path>`,`Write rendered output to a file`);T(r),r.action(function(){let e=this.optsWithGlobals();ml(e,t,w(e,`text`),n)})}function Fl(e,t,n){let r=e.command(`dump`).summary(`Dump generated operations`).description(`Dump generated operations for rg/grep/ag/ack or JSON/NDJSON tooling.`).option(`--root <root>`,Ol).addOption(new f(`--scope <scope>`,`Filter by required auth scope`).choices([`read`,`write`,`all`]).default(`all`)).addOption(new f(`--mutates <mutates>`,`Filter mutating operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new f(`--destructive <destructive>`,`Filter destructive operations`).choices([`true`,`false`,`any`]).default(`any`)).addOption(new f(`--intent <intent>`,`Filter by operation intent`).choices([`read`,`lookup`,`search`,`write`,`delete`,`status`,`all`]).default(`all`)).addOption(new f(`--method <method>`,`Filter by HTTP method`).choices([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`all`]).default(`all`)).option(`--limit <count>`,`Maximum rows to return`).addOption(new f(`--format <format>`,`Text/file render format`).choices([`text`,`lines`,`compact`,`json`,`ndjson`]).default(`lines`)).option(`--output <path>`,`Write rendered output to a file`);T(r),r.action(function(){let e=this.optsWithGlobals();pl(e,t,w(e,`text`),n)})}function Il(e){let t=e.command(`unified`).summary(`Dump unified CLI/API/MCP operation JSON`).description(`Dump the flat unified operations JSON projected from MCP_GENERATION_CONTRACT.`).option(`--output <path>`,`Write unified operations JSON to a file`);T(t),t.action(function(){let e=this.optsWithGlobals(),t=w(e,`text`),n=wl(st);if(e.output!==void 0){let r=El(e.output,n);R({mode:t},y(`Unified operations JSON written`,{outputPath:r.target,byteLength:r.byteLength,schemaVersion:n.schemaVersion},{counts:{totalOperations:r.totalOperations}}));return}if(t===`text`){process.stdout.write(Tl(n));return}R({mode:t},y(`Unified operations JSON`,n,{counts:{totalOperations:n.totalOperations}}))})}var Ll=h(Pt(import.meta.url)),Q=Ll.bin[0];function Rl(e,t){re({component:`aventure-cli`,event:`fatal`,message:e.message,error:e}),process.stderr.write(`${Q} fatal (${t}): ${e.stack??e.message}\n`),Jn({...x(`${Q} ${t}: ${e.message}`,[e.name||`Error`]),counts:{exitCode:1}}),process.exit(1)}function zl(e){return Ge[Xe(e)??`cli`]}function Bl(e,t){let n=t.map(e=>{let t=e.cliPath[0]??``;return{spec:e,top:t,rank:zl(t).rank}}).toSorted((e,t)=>e.rank-t.rank||e.top.localeCompare(t.top)).map(e=>e.spec),r=Pr(n),i=new Set(n.filter(e=>e.mode===void 0).map(e=>e.cliPath[0]??``));for(let t of n){if(t.mode!==void 0){t.cliAliasPath!==void 0&&t.cliAliasPath.join(` `)!==t.cliPath.join(` `)&&Vl(e,t,t.cliAliasPath,[],!0,i);continue}let n=r.get(t.cliPath.join(` `))??[];Vl(e,t,t.cliPath,n),t.cliAliasPath!==void 0&&t.cliAliasPath.join(` `)!==t.cliPath.join(` `)&&Vl(e,t,t.cliAliasPath,n,!0,i)}}function Vl(e,t,n,r,i=!1,a){let o=e,s=``,c=a?.has(n[0]??``)===!1;for(let e of n.slice(0,-1))s=s===``?e:`${s} ${e}`,o=Hl(o,e,s,c);let l=n.at(-1)??t.operationId,u=o.commands.find(e=>e.name()===l)??o.command(l),d=i?Wr(n,t):void 0,f=t.requestBody?.flatMap(({parameter:e})=>e)??[];u.summary(t.summary||t.operationId).description([`${t.method} ${t.path}.`,t.summary||t.description,`Full API documentation: ${Q} docs api ${t.operationId}`,t.requestBody?.[0]?.kind===`json`||[...t.parameters,...f].some(e=>ce(e.schemaType,e.itemSchemaType))?be:``].filter(Boolean).join(`
|
|
65
|
-
`));let p=Jr(t,r);if(r.length===0){for(let e of t.parameters)Ul(u,e,e===p);En(u,t)}else{let e=[t,...r],n=Br(e),i=Vr(t,r).filter(e=>!n.has(qr(e.flag)));for(let e of i)Ul(u,e,!0);let a=new Set([...zr(r),...i.map(e=>qr(e.flag))]);for(let t of e.toSorted((e,t)=>Number(Br([t]).size)-Number(Br([e]).size)))En(u,t,a)}if(ie(t.intent)&&u.option(`--execute`,`Deprecated; accepted and ignored. This command executes by its verb.`,!1),Fr(u,r),T(u),p!==void 0){u.argument(`[text...]`,p.description||`Same as ${qr(p.flag)}.`),u.action(async function(e){let n=this.optsWithGlobals(),i=w(n);d!==void 0&&process.stderr.write(`${d}\n`);let a=Qr(p,e,n);if(!a.ok||a.data===null)return R({mode:i},a);let o=Ir(this,t,r,e.length>0);if(!o.ok||o.data===null)return R({mode:i},o);let s=Ur(p.optionKey,o.data,a.data),c=Hr(o.data,s);if(c.length>0)return R({mode:i},x(`missing required options: ${c.join(`, `)}`));let l=await Wl(o.data,s,i),u=$r(o.data,s,l);if(u!==null)return R({mode:i},u);l.ok&&l.data instanceof Uint8Array?process.stdout.write(l.data):R({mode:i},l)});return}u.action(async function(){let e=this.optsWithGlobals(),n=w(e);d!==void 0&&process.stderr.write(`${d}\n`);let i=Ir(this,t,r);if(!i.ok||i.data===null)return R({mode:n},i);let a=Hr(i.data,e);if(a.length>0)return R({mode:n},x(`missing required options: ${a.join(`, `)}`));let o=await Wl(i.data,e,n),s=$r(i.data,e,o);if(s!==null)return R({mode:n},s);o.ok&&o.data instanceof Uint8Array?process.stdout.write(o.data):R({mode:n},o)})}function Hl(e,t,n,r=!1){let i=e.commands.find(e=>e.name()===t);if(i!==void 0)return i;let a=We[n],o=e.command(t,r&&n===t?{hidden:!0}:{});return a!==void 0&&o.summary(a.summary).description(a.summary),o}function Ul(e,t,n=!1){let r=t.description||`${t.name} ${t.location} parameter`,i=t.defaultValue===void 0?void 0:typeof t.defaultValue==`string`||typeof t.defaultValue==`boolean`?t.defaultValue:[...t.defaultValue];if(t.legacyFlag!==void 0){let a=new f(t.flag,r);i!==void 0&&a.default(i);let o=new f(t.legacyFlag,r).conflicts(t.optionKey);e.addOption(a).addOption(o),e.hook(`preAction`,e=>{let r=e.opts(),i=r[t.optionKey],s=r[o.attributeName()];if(s!==void 0){(i===void 0||e.getOptionValueSource(t.optionKey)==="default")&&e.setOptionValueWithSource(t.optionKey,s,`cli`);return}!n&&t.required&&i===void 0&&e.error(`error: required option '${a.flags}' not specified`,{code:`commander.missingMandatoryOptionValue`})});return}if(i!==void 0){e.option(t.flag,r,i);return}if(t.required&&!n){e.requiredOption(t.flag,r);return}e.option(t.flag,r)}async function Wl(e,t,n){if(t.environment!==void 0){let e=s(t.environment);if(e===null)return x(`Unknown aVenture environment '${t.environment}'`,[`Use one of: ${ne().join(`, `)}`]);process.env.API_ENV=e}let r=await jn(e,t);if(!r.ok)return r;let i=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)]})),a=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]]})),o=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 await b({method:e.method,path:_e(e.operationId,i),searchParams:a,headers:o,body:r.data,contentType:typeof t.contentType==`string`?t.contentType:void 0,auth:e.auth,responseFormat:Re(n)?`json`:`auto`,responseBytes:e.binaryResponse===!0})}process.on(`uncaughtException`,e=>Rl(e,`uncaughtException`)),process.on(`unhandledRejection`,e=>Rl(e instanceof Error?e:Error(String(e)),`unhandledRejection`));var Gl=Ye(process.argv.slice(2),E),Kl=Gl===`required`?E:Be(E),$=new p;$.name(Q).configureHelp({helpWidth:1/0}).version(Ll.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,`,`people, and news — carry everything else: funding, publications, and tags.
|
|
66
|
-
`,` Sign in: ${Q} auth login`,` Search: ${Q} entities search --query "fintech companies in Austin"\n`,`Mutations execute directly; --execute is a deprecated no-op.
|
|
67
|
-
The aventure-mcp-server tools execute through this same CLI.`].join(`
|
|
68
|
-
`)).addOption(new f(`--environment <environment>`,`route all API calls to a mapped API environment (default: API_URL host, else API_ENV, else ${se})`).choices([...ne()])).showHelpAfterError(`(run \`${Q} --help\` for usage)`),Bl($,Kl),ms($,Q),Fo($,Ll),Zs($,Kl,Q),nc($,Kl,Q),kl($,Kl,Q),Dr($,Kl,Q);for(let e of $.commands)e.helpGroup()||e.helpGroup(zl(e.name()).heading);if(ol($),Gl===`required`){let e=[$];for(;e.length>0;){let t=e.pop();t!==void 0&&(e.push(...t.commands),t.hook(`preAction`,async(e,t)=>{e===t&&(await g(),await Fe(),await Ue())}))}}$.addHelpText(`after`,[``,`Verbs, the same on every record:`,` search Find many from a plain-English query or a filter`,` lookup Resolve a name, URL, slug, ticker, or id to its record`,` get Read one record`,` list Read many records`,` suggest Read proposed values for a field`,` create, update, delete Write; each needs a credential that permits it
|
|
69
|
-
`,`Environment (credentials by command group):`,` CLIENT_SECRET client access to authenticated reads, search, and lookups`,` ADMIN_API_KEY admin and write commands (mutations, media, jobs, harness)`,` AUTH_TOKEN signed-in session or personal API key; reads and writes`,` Public reads work with no credential; a saved sign-in is used when present.`,` Check what this shell holds with: ${Q} 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
|
|
70
|
-
`,`Exit codes:`,` 0 envelope.ok === true
|
|
71
|
-
1 envelope.ok === false
|
|
72
|
-
`,`Examples:`,` $ ${Q} auth login`,` $ ${Q} entities search --query "fintech companies in Austin"`,` $ ${Q} entities get --entity-slug stripe`,` $ ${Q} entities investors list --entity-slug stripe`].join(`
|
|
73
|
-
`));try{await $.parseAsync()}catch(e){Rl(e instanceof Error?e:Error(String(e)),`parseAsync`)}export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,D as t,O as n,_ as r,a as i,c as a,f as o,k as s,l as c,n as l,p as u,t as d,v as f}from"./person-owner-ChqQWHII.js";var ee=i([`domicile`,`dominant`,`origin`]),p=f({endDate:n().nullish(),id:o(),isCurrent:c(),role:ee.nullish(),startDate:n().nullish()}),m=f({id:o().nullish(),name:e()}),h=f({countryCodeChar2:e().nullish(),countryCodeChar3:e().nullish(),id:o().nullish(),name:e(),unRegion:e().nullish(),unSubregion:e().nullish()}),g=f({id:o().nullish(),name:e(),stateAbbrev:e().nullish()}),_=f({address:o().nullish(),addressLine1:e().nullish(),addressLine2:e().nullish(),association:a(p).optional(),city:m.nullish(),country:h.nullish(),countryAbbrev:e().nullish(),createdAt:s({offset:!0}).nullish(),fullAddress:e().nullish(),id:o().nullish(),isCurrent:c().nullish(),isHq:c().nullish(),isPrimary:c().nullish(),latitude:r().nullish(),longitude:r().nullish(),postalCode:e().nullish(),state:g.nullish(),stateAbbrev:e().nullish(),street:e().nullish(),updatedAt:s({offset:!0}).nullish()}),v=f({creatable:c(),isCurrent:c().nullish(),isPrimary:c().nullish(),name:e().max(255),writable:c()}),y=u(v,f({bucket:e().nullish(),classificationId:o().nullish(),creatable:c(),createdAt:s({offset:!0}).nullish(),id:o(),isCurrent:c().nullish(),isPrimary:c().nullish(),name:e().max(255),slug:e().regex(/^[a-z0-9_-]+$/).max(255).nullish(),type:e(),updatedAt:s({offset:!0}).nullish(),writable:c()})),b=u(v,f({category:e(),code:o().nullish(),creatable:c(),createdAt:s({offset:!0}).nullish(),entityClassificationId:o().nullish(),id:o(),isCurrent:c().nullish(),isPrimary:c().nullish(),level:o().nullish(),name:e().max(255),updatedAt:s({offset:!0}).nullish(),writable:c()})),x=f({geoLocationExposure:a(y).default([]).optional(),industry:a(y).default([]).optional(),mainProduct:a(y).default([]).optional(),standardizedClassification:a(b).default([]).optional(),tag:a(y).default([]).optional(),typeCustomer:a(y).default([]).optional(),typeModel:a(y).default([]).optional(),typeOwnership:a(y).default([]).optional(),typeRevenue:a(y).default([]).optional(),typeTechnologyUsed:a(y).default([]).optional()}),S=i(`Angel.Pre-Seed.Seed.Series A.Series B.Series C.Series D.Series E.Series F.Series G.Series H.Series I.Series J.Series K.Series L.Series M.Series N.Series O.Series P.Series Q.Series R.Series S.Series T.Series U.Series V.Series W.Series X.Series Y.Series Z.Investment Firm.Fund.Nonprofit.Government.Public.Acquired.Acquired Subsidiary`.split(`.`)),C=f({fundingRoundCount:o(),investorCount:o(),latestValuation:r().nullish(),mostRecentAmount:r().nullish(),mostRecentDate:n().nullish(),stage:S.nullish(),totalRaised:r()}),w=f({expanded:e().nullish(),generatedDescription:e().nullish(),short:e().nullish()}),te=i([`cloudflare`,`akamai`,`fastly`,`awsCloudfront`,`vercel`,`netlify`,`sucuri`,`incapsula`,`bunny`,`keycdn`,`cdn77`,`gcore`,`cdnetworks`,`azureCdn`,`leaseweb`,`digitalocean`,`stackpath`,`googlecloudCdn`,`none`,`unknown`]),ne=i([`static`,`jsRequired`,`jsEnhanced`]),T=i(`website.linkedin.twitter.github.facebook.instagram.tiktok.youtube.subreddit.forum.documentation.support.statuspage.changelog.roadmap.discord.crunchbase.wellfound.angellist.glassdoor.theorg.ycombinator.wikipedia.pitchbook.morningstar.bloomberg.nyse.nasdaq.g2.producthunt.trustpilot.alternativeto.gartnerpeerinsights.getapp.sourceforge.appstore.googleplay.capterra.trustradius.hubspotmarketplace.slackappdirectory.awsmarketplace.salesforceappexchange.chromewebstore.vscodemarketplace.npm.pypi.maven.dockerhub.homebrew.crates.huggingface`.split(`.`)),E=f({crawlCdnProvider:te.nullish(),crawlRenderMode:ne.nullish(),createdAt:s({offset:!0}).nullish(),id:o().nullish(),isCurrent:c().nullish(),isPrimary:c().nullish(),owner:d.nullish(),sourceId:e().nullish(),status:e().nullish(),statusChecked:s({offset:!0}).nullish(),updatedAt:s({offset:!0}).nullish(),url:e(),urlType:T}),D=f({address:a(_),classification:x,fundingDetail:C.nullish(),text:w,urlLink:a(E)}),O=f({isMonogram:c(),logo:e().nullish(),logoSquare:e().nullish()}),k=i([`alternativeDba`,`relatedLegal`]),A=f({displayable:c().nullish(),name:e(),type:k.nullish()}),j=f({hasAcquisitions:c().default(!1).optional(),hasAnalysis:c(),hasEmployees:c(),hasFundraising:c(),hasNews:c(),productServiceSlug:a(e())}),M=f({createdAt:s({offset:!0}).nullish(),defaultCurrency:e().nullish(),foundedYear:o().nullish(),id:t(),image:O,lastModifiedAt:s({offset:!0}).nullish(),nameAlias:a(A),nameBrand:e(),nameLegal:e().nullish(),operatingStatus:e().nullish(),publicId:e().regex(/^e[0-9A-Za-z]{11}$/).nullish(),publicUrl:e().nullish(),sitemap:j.nullish(),slug:e().regex(/^[a-z0-9_-]+$/).max(255),typeRecord:l.nullish(),updatedAt:s({offset:!0}).nullish()}),N=f({core:M,fundingDetail:C.nullish()}),P=i([`High`,`Medium`,`Low`,`Verified`]),F=i([`direct`,`managedFund`]),I=f({round:e()}),L=f({amountInvested:r().nullish(),attributionType:F,beneficialEntityId:t().nullish(),fundManagerRelationshipId:o().nullish(),joinId:t(),leadInvestor:c(),recordedEntityId:t().nullish(),round:I.nullish(),transactionId:t()}),R=f({amountRaised:r().int().nullish(),createdAt:s({offset:!0}).nullish(),currency:e().nullish(),dataConfidence:P.nullish(),dateAnnounced:s({offset:!0}).nullish(),dateFundingComplete:s({offset:!0}).nullish(),dateInvestorExit:s({offset:!0}).nullish(),entity:N.nullish(),id:t(),investorAttribution:L.nullish(),investorCount:o().nullish(),round:e().nullish(),sourceAttribution:a(L),updatedAt:s({offset:!0}).nullish(),valuationPostMoney:r().int().nullish(),valuationPreMoney:r().int().nullish()}),z=f({fundingStage:S.nullish(),ownership:a(e()),pricingModel:a(e()),sellsTo:a(e()),totalRaised:r().nullish(),website:e().nullish()}),B=f({asOf:n().nullish(),comparisonSignals:z.nullish(),createdAt:s({offset:!0}).nullish(),detail:e().nullish(),entity:M,id:o().nullish(),isCurrent:c().nullish(),isPrimary:c().nullish(),get relationship(){return a(B)},relationshipType:e(),source:e().nullish(),sourceEntityId:t().nullish(),targetEntityId:t().nullish(),updatedAt:s({offset:!0}).nullish()}),V=B,H=f({accelerator:M,acceleratorName:e(),asOfDate:s({offset:!0}),batch:e().nullish(),id:e(),program:e().nullish(),status:e().nullish()}),U=i([`text`,`numeric`,`monetary`,`percentage`,`date`]),W=i([`low`,`medium`,`high`]),re=i([`pastDue`,`withinThreeMonths`,`threeToSixMonths`,`sixToTwelveMonths`,`twelveToTwentyFourMonths`,`beyondTwoYears`]),G=f({asOfDate:s({offset:!0}),bucket:re,monthsFromNow:o(),targetDate:s({offset:!0})}),K=f({asOfDate:s({offset:!0}).nullish(),createdAt:s({offset:!0}).nullish(),creator:e().nullish(),dataConfidence:W.nullish(),derivedRange:G.nullish(),discreteValue:r().nullish(),entityId:t(),id:o(),textValue:e().nullish(),typeResearchDetail:e(),updatedAt:s({offset:!0}).nullish(),valueResearchDetail:e().nullish(),valueType:U}),q=f({characterCount:o(),meetsRequirements:c(),violation:a(e()),wordCount:o()}),J=f({compliance:q.nullish(),createdAt:s({offset:!0}).nullish(),entityId:t(),id:o(),isCurrent:c(),isPrimary:c(),text:e(),textType:e(),updatedAt:s({offset:!0}).nullish(),visible:c()}),Y=f({acceleratorParticipation:a(H),detail:a(K),snippet:a(J)}),X=f({author:e().nullish(),category:e().nullish(),createdAt:s({offset:!0}).nullish(),excerpt:e().nullish(),externalNewsArticle:c().nullish(),id:o(),newsImageThumbnail:e().nullish(),newsUrlOriginal:e().nullish(),pendingApproval:o().nullish(),publication:e().nullish(),publishedAt:s({offset:!0}).nullish(),slug:e().regex(/^[a-z0-9_-]+$/).max(255).nullish(),title:e(),updatedAt:s({offset:!0}).nullish()}),ie=i([`nickname`,`maidenName`,`formerName`,`stageName`]),Z=f({displayable:c().nullish(),name:e(),type:ie.nullish()}),Q=f({isMonogram:c(),picture:e().nullish()}),ae=f({associationId:o(),createdAt:s({offset:!0}).nullish(),creator:e().nullish(),endDate:s({offset:!0}).nullish(),entityAddress:a(_),entityId:t(),entityLogo:O,entityName:e().nullish(),entityOperatingStatus:e().nullish(),entitySlug:e().regex(/^[a-z0-9_-]+$/).max(255),entityType:l.nullish(),entityUrlLink:a(E),isCurrent:c().nullish(),personAddress:a(_),personId:t(),personImage:Q,personName:e(),personSlug:e().regex(/^[a-z0-9_-]+$/).max(255),personUrlLink:a(E),score:o().nullish(),startDate:s({offset:!0}).nullish(),titleFunction:e().nullish(),titleId:o().nullish(),titleLevel:e().nullish(),titleName:e().nullish(),updatedAt:s({offset:!0}).nullish()}),oe=f({address:a(_),urlLink:a(E)}),se=f({amountRaised:r().nullish(),dateAnnounced:s({offset:!0}).nullish(),id:t(),image:O,investorCount:o().nullish(),nameBrand:e(),round:e().nullish(),status:e().nullish(),valuationPostMoney:r().nullish()}),ce=f({entity:M}),le=f({amount:r().nullish(),company:ce,date:s({offset:!0}).nullish(),fundraiseTransaction:se.nullish(),fundraiseTransactionId:t(),id:e(),investmentDate:s({offset:!0}),investorAttribution:L.nullish(),round:e().nullish()}),$=i([`entity`,`person`,`newsArticle`,`blogPost`,`text`,`classificationTag`,`classificationCode`,`product`,`service`,`agentHelpDoc`]),ue=f({computedAt:s({offset:!0}),cosineDistance:r(),cosineScore:r(),modelVersion:e(),rank:o(),sourceHash:e(),sourceId:e(),sourceJson:e(),sourceText:e(),sourceType:$}),de=f({changedAt:s({offset:!0}).nullish(),dataSourceUpdatedAt:s({offset:!0}).nullish(),detail:e().nullish(),kind:e().nullish(),pendingApproval:o().nullish(),sourceId:e().nullish(),status:e().nullish()}),fe=f({createdAt:s({offset:!0}).nullish(),gender:e().nullish(),id:t(),image:Q,lastModifiedAt:s({offset:!0}).nullish(),nameAlias:a(Z),nameFirst:e().nullish(),nameFull:e(),nameLast:e().nullish(),nameMiddle:e().nullish(),nickname:e().nullish(),publicId:e().regex(/^p[0-9A-Za-z]{12}$/).nullish(),semanticMatch:ue.nullish(),slug:e().regex(/^[a-z0-9_-]+$/).max(255),source:de,suffix:e().nullish(),text:w,updatedAt:s({offset:!0}).nullish()}),pe=f({articleCount:o().nullish(),association:a(ae),core:fe,enrichment:oe,investment:a(le),nameAlias:a(Z),pendingApproval:o().nullish()}),me=i([`ein`,`secCik`,`ticker`,`lei`,`duns`,`isin`,`cusip`,`crd`,`orcid`]),he=f({createdAt:s({offset:!0}),id:o(),identifier:e(),idType:me,owner:d,source:e().nullish(),updatedAt:s({offset:!0})}),ge=f({core:M,enrichment:D,fundraiseRound:a(R),newsArticle:a(X),person:a(pe),publicUrl:e().nullish(),relationship:a(V),research:Y,sitemap:j,uniqueId:a(he)});export{ge as EntityDetailSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,T as t,_ as n,a as r,b as ee,c as i,d as te,g as a,h as o,k as ne,l as s,o as re,p as ie,u as ae,v as c,w as l,x as u,y as d}from"./person-owner-ChqQWHII.js";import{a as oe}from"./auth-BSlYTFnP.js";var se=c({clerkPublishableKey:e().nullish(),oauthClient:oe.nullish()}),ce=`2025-11-25`,le=`2025-03-26`,ue=[ce,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],de=`io.modelcontextprotocol/related-task`,f=ae(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),fe=l([e(),n().int()]),pe=e();a({ttl:n().optional(),pollInterval:n().optional()});var me=c({ttl:n().optional()}),he=c({taskId:e()}),p=a({progressToken:fe.optional(),[de]:he.optional()}),m=c({_meta:p.optional()}),h=m.extend({task:me.optional()}),ge=e=>h.safeParse(e).success,g=c({method:e(),params:m.loose().optional()}),_=c({_meta:p.optional()}),v=c({method:e(),params:_.loose().optional()}),y=a({_meta:p.optional()}),b=l([e(),n().int()]),_e=c({jsonrpc:o(`2.0`),id:b,...g.shape}).strict(),ve=e=>_e.safeParse(e).success,ye=c({jsonrpc:o(`2.0`),...v.shape}).strict(),be=e=>ye.safeParse(e).success,x=c({jsonrpc:o(`2.0`),id:b,result:y}).strict(),xe=e=>x.safeParse(e).success,S;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(S||={});var Se=c({jsonrpc:o(`2.0`),id:b.optional(),error:c({code:n().int(),message:e(),data:t().optional()})}).strict(),Ce=e=>Se.safeParse(e).success,we=l([_e,ye,x,Se]);l([x,Se]);var C=y.strict(),Te=_.extend({requestId:b.optional(),reason:e().optional()}),w=v.extend({method:o(`notifications/cancelled`),params:Te}),Ee=c({src:e(),mimeType:e().optional(),sizes:i(e()).optional(),theme:r([`light`,`dark`]).optional()}),T=c({icons:i(Ee).optional()}),E=c({name:e(),title:e().optional()}),De=E.extend({...E.shape,...T.shape,version:e(),websiteUrl:e().optional(),description:e().optional()}),Oe=ie(c({applyDefaults:s().optional()}),u(e(),t())),ke=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ie(c({form:Oe.optional(),url:f.optional()}),u(e(),t()).optional())),Ae=a({list:f.optional(),cancel:f.optional(),requests:a({sampling:a({createMessage:f.optional()}).optional(),elicitation:a({create:f.optional()}).optional()}).optional()}),je=a({list:f.optional(),cancel:f.optional(),requests:a({tools:a({call:f.optional()}).optional()}).optional()}),Me=c({experimental:u(e(),f).optional(),sampling:c({context:f.optional(),tools:f.optional()}).optional(),elicitation:ke.optional(),roots:c({listChanged:s().optional()}).optional(),tasks:Ae.optional(),extensions:u(e(),f).optional()}),Ne=m.extend({protocolVersion:e(),capabilities:Me,clientInfo:De}),D=g.extend({method:o(`initialize`),params:Ne}),Pe=e=>D.safeParse(e).success,Fe=c({experimental:u(e(),f).optional(),logging:f.optional(),completions:f.optional(),prompts:c({listChanged:s().optional()}).optional(),resources:c({subscribe:s().optional(),listChanged:s().optional()}).optional(),tools:c({listChanged:s().optional()}).optional(),tasks:je.optional(),extensions:u(e(),f).optional()}),Ie=y.extend({protocolVersion:e(),capabilities:Fe,serverInfo:De,instructions:e().optional()}),Le=v.extend({method:o(`notifications/initialized`),params:_.optional()}),O=g.extend({method:o(`ping`),params:m.optional()}),Re=c({progress:n(),total:d(n()),message:d(e())}),ze=c({..._.shape,...Re.shape,progressToken:fe}),Be=v.extend({method:o(`notifications/progress`),params:ze}),Ve=m.extend({cursor:pe.optional()}),k=g.extend({params:Ve.optional()}),A=y.extend({nextCursor:pe.optional()}),He=r([`working`,`input_required`,`completed`,`failed`,`cancelled`]),j=c({taskId:e(),status:He,ttl:l([n(),re()]),createdAt:e(),lastUpdatedAt:e(),pollInterval:d(n()),statusMessage:d(e())}),M=y.extend({task:j}),Ue=_.merge(j),N=v.extend({method:o(`notifications/tasks/status`),params:Ue}),P=g.extend({method:o(`tasks/get`),params:m.extend({taskId:e()})}),F=y.merge(j),I=g.extend({method:o(`tasks/result`),params:m.extend({taskId:e()})});y.loose();var L=k.extend({method:o(`tasks/list`)}),R=A.extend({tasks:i(j)}),z=g.extend({method:o(`tasks/cancel`),params:m.extend({taskId:e()})}),We=y.merge(j),Ge=c({uri:e(),mimeType:d(e()),_meta:u(e(),t()).optional()}),Ke=Ge.extend({text:e()}),B=e().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),qe=Ge.extend({blob:B}),V=r([`user`,`assistant`]),H=c({audience:i(V).optional(),priority:n().min(0).max(1).optional(),lastModified:ne({offset:!0}).optional()}),Je=c({...E.shape,...T.shape,uri:e(),description:d(e()),mimeType:d(e()),size:d(n()),annotations:H.optional(),_meta:d(a({}))}),Ye=c({...E.shape,...T.shape,uriTemplate:e(),description:d(e()),mimeType:d(e()),annotations:H.optional(),_meta:d(a({}))}),Xe=k.extend({method:o(`resources/list`)}),Ze=A.extend({resources:i(Je)}),Qe=k.extend({method:o(`resources/templates/list`)}),$e=A.extend({resourceTemplates:i(Ye)}),U=m.extend({uri:e()}),et=U,tt=g.extend({method:o(`resources/read`),params:et}),nt=y.extend({contents:i(l([Ke,qe]))}),rt=v.extend({method:o(`notifications/resources/list_changed`),params:_.optional()}),it=U,at=g.extend({method:o(`resources/subscribe`),params:it}),ot=U,st=g.extend({method:o(`resources/unsubscribe`),params:ot}),ct=_.extend({uri:e()}),lt=v.extend({method:o(`notifications/resources/updated`),params:ct}),ut=c({name:e(),description:d(e()),required:d(s())}),dt=c({...E.shape,...T.shape,description:d(e()),arguments:d(i(ut)),_meta:d(a({}))}),ft=k.extend({method:o(`prompts/list`)}),pt=A.extend({prompts:i(dt)}),mt=m.extend({name:e(),arguments:u(e(),e()).optional()}),ht=g.extend({method:o(`prompts/get`),params:mt}),W=c({type:o(`text`),text:e(),annotations:H.optional(),_meta:u(e(),t()).optional()}),G=c({type:o(`image`),data:B,mimeType:e(),annotations:H.optional(),_meta:u(e(),t()).optional()}),gt=c({type:o(`audio`),data:B,mimeType:e(),annotations:H.optional(),_meta:u(e(),t()).optional()}),_t=c({type:o(`tool_use`),name:e(),id:e(),input:u(e(),t()),_meta:u(e(),t()).optional()}),vt=c({type:o(`resource`),resource:l([Ke,qe]),annotations:H.optional(),_meta:u(e(),t()).optional()}),yt=Je.extend({type:o(`resource_link`)}),K=l([W,G,gt,yt,vt]),bt=c({role:V,content:K}),xt=y.extend({description:e().optional(),messages:i(bt)}),St=v.extend({method:o(`notifications/prompts/list_changed`),params:_.optional()}),Ct=c({title:e().optional(),readOnlyHint:s().optional(),destructiveHint:s().optional(),idempotentHint:s().optional(),openWorldHint:s().optional()}),wt=c({taskSupport:r([`required`,`optional`,`forbidden`]).optional()}),Tt=c({...E.shape,...T.shape,description:e().optional(),inputSchema:c({type:o(`object`),properties:u(e(),f).optional(),required:i(e()).optional()}).catchall(t()),outputSchema:c({type:o(`object`),properties:u(e(),f).optional(),required:i(e()).optional()}).catchall(t()).optional(),annotations:Ct.optional(),execution:wt.optional(),_meta:u(e(),t()).optional()}),Et=k.extend({method:o(`tools/list`)}),Dt=A.extend({tools:i(Tt)}),q=y.extend({content:i(K).default([]),structuredContent:u(e(),t()).optional(),isError:s().optional()});q.or(y.extend({toolResult:t()}));var Ot=h.extend({name:e(),arguments:u(e(),t()).optional()}),kt=g.extend({method:o(`tools/call`),params:Ot}),At=v.extend({method:o(`notifications/tools/list_changed`),params:_.optional()});c({autoRefresh:s().default(!0),debounceMs:n().int().nonnegative().default(300)});var J=r([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),jt=m.extend({level:J}),Mt=g.extend({method:o(`logging/setLevel`),params:jt}),Nt=_.extend({level:J,logger:e().optional(),data:t()}),Pt=v.extend({method:o(`notifications/message`),params:Nt}),Ft=c({name:e().optional()}),It=c({hints:i(Ft).optional(),costPriority:n().min(0).max(1).optional(),speedPriority:n().min(0).max(1).optional(),intelligencePriority:n().min(0).max(1).optional()}),Lt=c({mode:r([`auto`,`required`,`none`]).optional()}),Rt=c({type:o(`tool_result`),toolUseId:e().describe(`The unique identifier for the corresponding tool call.`),content:i(K).default([]),structuredContent:c({}).loose().optional(),isError:s().optional(),_meta:u(e(),t()).optional()}),zt=te(`type`,[W,G,gt]),Y=te(`type`,[W,G,gt,_t,Rt]),Bt=c({role:V,content:l([Y,i(Y)]),_meta:u(e(),t()).optional()}),Vt=h.extend({messages:i(Bt),modelPreferences:It.optional(),systemPrompt:e().optional(),includeContext:r([`none`,`thisServer`,`allServers`]).optional(),temperature:n().optional(),maxTokens:n().int(),stopSequences:i(e()).optional(),metadata:f.optional(),tools:i(Tt).optional(),toolChoice:Lt.optional()}),Ht=g.extend({method:o(`sampling/createMessage`),params:Vt}),Ut=y.extend({model:e(),stopReason:d(r([`endTurn`,`stopSequence`,`maxTokens`]).or(e())),role:V,content:zt}),Wt=y.extend({model:e(),stopReason:d(r([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(e())),role:V,content:l([Y,i(Y)])}),Gt=c({type:o(`boolean`),title:e().optional(),description:e().optional(),default:s().optional()}),Kt=c({type:o(`string`),title:e().optional(),description:e().optional(),minLength:n().optional(),maxLength:n().optional(),format:r([`email`,`uri`,`date`,`date-time`]).optional(),default:e().optional()}),qt=c({type:r([`number`,`integer`]),title:e().optional(),description:e().optional(),minimum:n().optional(),maximum:n().optional(),default:n().optional()}),Jt=c({type:o(`string`),title:e().optional(),description:e().optional(),enum:i(e()),default:e().optional()}),Yt=c({type:o(`string`),title:e().optional(),description:e().optional(),oneOf:i(c({const:e(),title:e()})),default:e().optional()}),Xt=c({type:o(`string`),title:e().optional(),description:e().optional(),enum:i(e()),enumNames:i(e()).optional(),default:e().optional()}),Zt=l([Jt,Yt]),Qt=c({type:o(`array`),title:e().optional(),description:e().optional(),minItems:n().optional(),maxItems:n().optional(),items:c({type:o(`string`),enum:i(e())}),default:i(e()).optional()}),$t=c({type:o(`array`),title:e().optional(),description:e().optional(),minItems:n().optional(),maxItems:n().optional(),items:c({anyOf:i(c({const:e(),title:e()}))}),default:i(e()).optional()}),en=l([Qt,$t]),tn=l([Xt,Zt,en]),nn=l([tn,Gt,Kt,qt]),rn=h.extend({mode:o(`form`).optional(),message:e(),requestedSchema:c({type:o(`object`),properties:u(e(),nn),required:i(e()).optional()})}),an=h.extend({mode:o(`url`),message:e(),elicitationId:e(),url:e().url()}),on=l([rn,an]),sn=g.extend({method:o(`elicitation/create`),params:on}),cn=_.extend({elicitationId:e()}),ln=v.extend({method:o(`notifications/elicitation/complete`),params:cn}),un=y.extend({action:r([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,u(e(),l([e(),n(),s(),i(e())])).optional())}),dn=c({type:o(`ref/resource`),uri:e()}),fn=c({type:o(`ref/prompt`),name:e()}),pn=m.extend({ref:l([fn,dn]),argument:c({name:e(),value:e()}),context:c({arguments:u(e(),e()).optional()}).optional()}),mn=g.extend({method:o(`completion/complete`),params:pn});function hn(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function gn(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var _n=y.extend({completion:a({values:i(e()).max(100),total:d(n().int()),hasMore:d(s())})}),vn=c({uri:e().startsWith(`file://`),name:e().optional(),_meta:u(e(),t()).optional()}),yn=g.extend({method:o(`roots/list`),params:m.optional()}),bn=y.extend({roots:i(vn)}),xn=v.extend({method:o(`notifications/roots/list_changed`),params:_.optional()});l([O,D,mn,Mt,ht,ft,Xe,Qe,tt,at,st,kt,Et,P,I,L,z]),l([w,Be,Le,xn,N]),l([C,Ut,Wt,un,bn,F,R,M]),l([O,Ht,sn,yn,P,I,L,z]),l([w,Be,Pt,lt,rt,At,St,N,ln]),l([C,Ie,_n,xt,pt,Ze,$e,nt,q,Dt,F,R,M]);var Sn=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===S.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Cn(e.elicitations,n)}return new e(t,n,r)}},Cn=class extends Sn{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(S.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},X=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Z=class extends X{};Z.errorCode=`invalid_request`;var wn=class extends X{};wn.errorCode=`invalid_client`;var Tn=class extends X{};Tn.errorCode=`invalid_grant`;var En=class extends X{};En.errorCode=`unauthorized_client`;var Dn=class extends X{};Dn.errorCode=`unsupported_grant_type`;var On=class extends X{};On.errorCode=`invalid_scope`;var Q=class extends X{};Q.errorCode=`access_denied`;var $=class extends X{};$.errorCode=`server_error`;var kn=class extends X{};kn.errorCode=`temporarily_unavailable`;var An=class extends X{};An.errorCode=`unsupported_response_type`;var jn=class extends X{};jn.errorCode=`unsupported_token_type`;var Mn=class extends X{};Mn.errorCode=`invalid_token`;var Nn=class extends X{};Nn.errorCode=`method_not_allowed`;var Pn=class extends X{};Pn.errorCode=`too_many_requests`;var Fn=class extends X{};Fn.errorCode=`invalid_client_metadata`;var In=class extends X{};In.errorCode=`insufficient_scope`;var Ln=class extends X{};Ln.errorCode=`invalid_target`;var Rn={[Z.errorCode]:Z,[wn.errorCode]:wn,[Tn.errorCode]:Tn,[En.errorCode]:En,[Dn.errorCode]:Dn,[On.errorCode]:On,[Q.errorCode]:Q,[$.errorCode]:$,[kn.errorCode]:kn,[An.errorCode]:An,[jn.errorCode]:jn,[Mn.errorCode]:Mn,[Nn.errorCode]:Nn,[Pn.errorCode]:Pn,[Fn.errorCode]:Fn,[In.errorCode]:In,[Ln.errorCode]:Ln},zn=globalThis.crypto?.webcrypto??globalThis.crypto??import(`node:crypto`).then(e=>e.webcrypto);async function Bn(e){return(await zn).getRandomValues(new Uint8Array(e))}async function Vn(e){let t=``;for(;t.length<e;){let n=await Bn(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function Hn(e){return await Vn(e)}async function Un(e){let t=await(await zn).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Wn(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Hn(e);return{code_verifier:t,code_challenge:await Un(t)}}export{R as A,N as B,we as C,Xe as D,Qe as E,Be as F,be as G,gn as H,de as I,ge as J,ve as K,tt as L,J as M,Sn as N,bn as O,O as P,ue as R,Le as S,ft as T,Pe as U,hn as V,Ce as W,se as Y,ht as _,q as a,F as b,w as c,Wt as d,M as f,S as g,C as h,kt as i,Et as j,L as k,mn as l,un as m,Rn as n,z as o,le as p,xe as q,$ as r,We as s,Wn as t,Ut as u,I as v,ce as w,D as x,P as y,Mt as z};
|