@aventurevc/mcp-server 0.8.232 → 0.8.233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{cli-help-policy-BfaoryK2.js → cli-help-policy-DdcHm_F7.js} +1 -1
- package/dist/chunks/contract-BEa-OAos.js +1 -0
- package/dist/chunks/dist-CGgP_Pxz.js +1 -0
- package/dist/chunks/esm-Df1PEaVo.js +222 -0
- package/dist/chunks/help-intent-Dtkz55rC.js +1 -0
- package/dist/chunks/human-text-cap-BcNmIPQA.js +16 -0
- package/dist/chunks/{logging-D2cJNH4n.js → logging-BnHashoK.js} +1 -1
- package/dist/chunks/openapi-call-CrfewEHX.js +96 -0
- package/dist/chunks/openapi-snapshot-DD4lwuez.js +1 -0
- package/dist/chunks/operation-invocation-fkSqlOfs.js +2 -0
- package/dist/chunks/{package-DPDX5zmx.js → package-CZBWjlYb.js} +1 -1
- package/dist/chunks/private-readback-DX42Bf2b.js +1 -0
- package/dist/chunks/provider-catalog-Dy5L5Zvr.js +1 -0
- package/dist/chunks/reference-recovery-BIxVJJpL.js +15 -0
- package/dist/chunks/runtime-identity-Cme_U1eh.js +1 -0
- package/dist/chunks/{tool-policy-BjOSkLem.js → tool-policy-TAT9-UP4.js} +1 -1
- package/dist/mcp-server/index.js +10 -10
- package/package.json +3 -3
- package/dist/chunks/contract-BMHAMOPG.js +0 -16
- package/dist/chunks/dist-Dr9VgZFR.js +0 -111
- package/dist/chunks/esm-745ZojFI.js +0 -222
- package/dist/chunks/provider-catalog-SgEjcFVp.js +0 -1
- package/dist/chunks/runtime-identity-DWyecGw5.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as e,f as t,l as n,o as r,s as i,u as a}from"./tool-policy-TAT9-UP4.js";import{T as o,l as s,o as c,p as l,u,v as d,w as f,y as p}from"./person-owner-C0YuWKvY.js";import{a as m}from"./package-CZBWjlYb.js";import{i as ee,t as h}from"./human-text-cap-BcNmIPQA.js";var g=c([`HIGH`,`MEDIUM`,`LOW`]),te=c([`PAID_PLAN`,`DAILY_ALLOWANCE`]),_=c([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),v=Object.assign(o([_,f()]),{enum:_.enum}),y=p({billingAccess:te.nullish(),excerpt:f(),sourceId:f(),sourceType:v,sourceVersion:f().nullish()}),ne=p({instruction:f(),operationId:f(),planTaskKey:s(f()).optional(),stepKey:f().optional()}),re=p({body:f(),expectation:f(),method:s(f()),override:f(),reject:s(f()),typeCatalog:f()}),ie=p({cliCommand:f(),mcpTool:f().nullish(),step:ne,writeGuidance:re.nullish()}),b=c([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),ae=Object.assign(o([b,f()]),{enum:b.enum}),oe=p({allowedValue:f().nullish(),description:f(),key:f(),required:u().default(!0).optional(),type:ae}),x=p({catalogRevision:l().optional(),gateId:s(f()).optional(),input:s(oe),step:s(ie),taskKey:f().optional()}),se=c([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),ce=p({candidate:s(y),operationId:f().nullish(),outcome:se,probability:d().nullish(),taskKey:f().nullish(),taskPlan:x.nullish()}),le=p({answer:f(),citation:s(y),confidence:g,resolution:ce.nullish()});function S(e,t,n=t.inputName){if(t.in===`body`)return n;let r=_e.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?E(T(n!==`id`&&n!==`slug`?n:`${fe(e.path)}${w(n)}`),t):r.inputName}function C(e,t,n=me(e)){return ue(pe(e,t),new Set(n))}function ue(e,t){if(!t.has(e))return e;let n=`body${w(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function de(e,t,n){return`${e}[${t}].${n}`}function fe(e){return ve.find(([,t])=>t.test(e))?.[0]??`record`}function pe(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=he(t);return E(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?T(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function me(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>S(e,t)))}function w(e){return e.replace(/^./u,e=>e.toUpperCase())}function T(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function he(e){let t=T(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ge(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ge(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function E(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var _e=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],ve=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function D(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>O(t,S(e,t))),r=(t?.parameter??[]).map(t=>O(t,C(e,t)));return{selector:n.filter(e=>e.location===`path`||k(e)),pagination:n.filter(A),filter:[...n.filter(j),...r.filter(j)],body:r.filter(e=>!j(e))}}function O(e,t){let{in:n,inputName:i,...a}=e;return{...a,flag:r(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function k(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function A(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function j(e){return e.location!==`path`&&!k(e)&&!A(e)}function M(e){return{operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:xe(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]}}function N(e,t){let n=e.requestBody?.[0],r=M(e),i=P(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:D(e)}:{...r,optionalInput:Se(e),arrayInput:Ce(e),...i===void 0?{}:{paidPlan:i}}}function ye(e){let t=D(e),n=e=>e.filter(e=>e.required);return{...N(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function be(e){let{cli:t,scope:n,...r}=M(e),i=P(e);return{...r,...i===void 0?{}:{paidPlan:i},optionalDetailOmitted:!0}}function xe(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function Se(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}function P(e){return e.response.find(({status:e})=>e===`402`)?.description}function Ce(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var F=160,I=`Operation catalog matches`,we=[`whole`,`described`,`requiredDescribed`,`optionalNamed`],L=e=>`${[I,...e].join(`
|
|
2
|
+
`)}\n`;function Te(e,t=[]){if(!Array.isArray(e)||e.length===0||!e.every(De))return null;let n=e,r=e=>ee([I,...e,...t]);for(let e of we){let t=[...n.flatMap(t=>B(t,e)),...z(n,e)];if(r(t))return L(t)}let i=e=>[...n.slice(0,e).flatMap(e=>B(e,`optionalNamed`)),...z(n.slice(0,e),`optionalNamed`),`... ${n.length-e} more operations omitted to fit ${h} UTF-8 bytes: ${n.slice(e).map(({operationId:e})=>e).join(`, `)}; call aventure_help with q=<operationId> and limit=1 to read one.`];return L(i([...n.keys()].findLast(e=>e>0&&r(i(e)))??1))}var R=`call aventure_help with q=<operationId> and limit=1; inspect structuredContent.data argument and optionalInput for the retained inputs`;function z(e,t){let n=e.flatMap(e=>`argument`in e?Object.values(e.argument).flat():[]),r=t===`whole`?0:n.filter(e=>e.description.length>F&&(t===`described`||e.required)).length,i=r===0?[]:[`... ${r} argument descriptions shortened; inspect structuredContent.data[].argument for full descriptions.`];if(e.some(e=>`optionalDetailOmitted`in e))return[...i,e.some(e=>`argument`in e)?`... optional argument details omitted: the full list exceeds the result cap; ${R}.`:`... optional inputs omitted: the full list exceeds the result cap; call aventure_help with q=<operationId> and limit=1 to read one operation's inputs.`];if(t===`whole`||!e.some(e=>`argument`in e))return[];if(t===`described`)return i;let a=t===`requiredDescribed`?`optional argument descriptions`:`optional argument details`,o=n.filter(({required:e})=>!e).length;return[...i,`... ${o} ${a} omitted to fit ${h} UTF-8 bytes; structuredContent carries them, and ${R}.`]}function B(e,t){let n=`argument`in e?Object.values(e.argument).flat():[],r=n.filter(({required:e})=>!e).map(({name:e})=>e);return[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,` responseContentType: ${e.responseContentType.length===0?`none`:e.responseContentType.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`arrayInput`in e&&e.arrayInput.length>0?[` JSON array inputs: ${e.arrayInput.join(`, `)}`]:[],...`paidPlan`in e&&e.paidPlan!==void 0?[` paid plan: ${e.paidPlan}`]:[],...n.filter(({required:e})=>e||t!==`optionalNamed`).map(e=>Ee(e,e.required||t!==`requiredDescribed`,t)),...t===`optionalNamed`&&r.length>0?[` optional inputs: ${r.join(`, `)}`]:[]]}function Ee(e,t,n){let r=[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.schemaEnum===void 0?void 0:`choices: ${e.schemaEnum.join(`, `)}`,e.itemSchemaEnum===void 0?void 0:`item choices: ${e.itemSchemaEnum.join(`, `)}`,e.schemaDefault===void 0?void 0:`default: ${JSON.stringify(e.schemaDefault)}`,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `),i=` ${e.name} (${r})`;return t?`${i}: ${n===`whole`||e.description.length<=F?e.description:`${e.description.slice(0,157)}...`}`:i}function De(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function V(e){let t=t=>{let n=(`parameter`in e?e.parameter:e.parameters.map(e=>({...e,in:e.location,schemaDefault:e.defaultValue}))).filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(({name:e})=>[e,`<${e}>`]);return n.length===0?void 0:Object.fromEntries(n)},r=t(`path`),i=t(`query`);return{tool:n(e.intent),arguments:{operationId:e.operationId,...r===void 0?{}:{pathParams:r},...i===void 0?{}:{query:i},...e.requestBody===void 0?{}:{body:ke(e)}}}}var Oe=4;function ke(e){let t=e.requestBody?.[0];if(t===void 0)return{};if(t.requiredPath.length>0||e.intent!==`lookup`||t.schemaType===`array`)return Ae(t.requiredPath);let n=t.parameter;return Object.fromEntries(n.flatMap(e=>{let{name:t,schemaType:n,schemaFormat:r}=e,i=`optionKey`in e?e.choices:e.schemaEnum;return t.includes(`.`)||n!==`string`||r!==void 0?[]:i===void 0?[[t,`<${t}>`]]:i.length>Oe?[]:[[t,`<${i.join(`|`)}>`]]}))}function Ae(e){let t={},n=e.filter(t=>!e.some(e=>e.startsWith(`${t}.`)||e.startsWith(`${t}[]`)));for(let e of n){let n=e.split(`.`),r=n.slice(0,-1).reduce(je,t);r[n.at(-1)??e]=`<${e}>`}return t}function je(e,t){let n=t.replace(/\[\]$/u,``),r=e[n],i=Array.isArray(r)?r[0]:r;if(typeof i==`object`&&i&&!Array.isArray(i))return i;let a={};return e[n]=t.endsWith(`[]`)?[a]:a,a}function Me(e){let t=P(e);return{mcpCall:V(e),...t===void 0?{}:{paidPlan:t}}}function Ne(e){let t=H(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function H(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var U=2,Pe=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function W(e,t){let n=J(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&W(e,`person`),G(e,Fe(n),n),G(e,Ie(n),n))}function Fe(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=U&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;let n=e.endsWith(`es`)?e.slice(0,-2):``;if(n.length>=U&&n!==`us`&&/(?:s|ss|sh|ch|x|z)$/u.test(n))return n;if(e.length>U&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function Ie(e){if(e===`person`)return`people`;if(e!==`new`&&e!==`news`&&e!==`status`&&e!==`us`){if(e.length>=U&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e))return`${e.slice(0,-1)}ies`;if(!(e.length>=U&&e.endsWith(`es`)))return e.length>=U&&/(?:s|ss|sh|ch|x|z)$/u.test(e)?`${e}es`:e.endsWith(`s`)?void 0:`${e}s`}}function G(e,t,n){t!==void 0&&t!==n&&t.length>=U&&/^[a-z]+$/u.test(t)&&e.add(t)}function K(e){let t=new Set(q(e)),n=Array.from(t);for(let e of n)W(t,e);return t}function Le(e){return q(e).map(K)}function Re(e,t){if(e.length===0)return!1;let n=K(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function q(e){return J(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!Pe.has(e))}function J(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}function Y(r,o){return r.map(r=>{let s=r.requestBody??[],c=[...r.parameters.map(e=>X(e)),...s.flatMap(e=>e.parameter.map(t=>X(t,s.length>1?e.contentType:void 0))),...ze(s)],l=[o,...r.cliPath].join(` `),u=r.mutates===!0||e(r.intent),d=t(r),f=s[0];return{operationId:r.operationId,method:r.method,path:r.path,resource:r.resource,intent:r.intent,scope:r.scope,mutates:u,destructive:i(r.method,r.intent),auth:r.auth,cli:{command:l,path:r.cliPath},mcpTool:r.binaryResponse||!a(r.path)||d===null?null:n(d),body:{hasBody:f!==void 0,kind:f?.kind??null,...f!==void 0&&s.length>1?{contentType:f.contentType}:{},required:f?.required??!1,description:f?.description??``,requiredPath:f?.requiredPath??[]},flags:c,errorResponse:r.errorResponse,...r.successResponse===void 0?{}:{successResponse:r.successResponse},summary:r.summary,description:r.description,...r.deprecated===void 0?{}:{deprecated:r.deprecated}}})}function X(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 ze(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 body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function Z(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var Be=[`-id`,`-slug`,`-url`],Ve=[`--id`,`--slug`,`--url`],He=`/v1/lookup`,Ue=`--from-file "<path>"`;function We(e,t,n=m().bin[0]){let r=Y(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:qe(i,r)}function Q(e,t,n=m().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:Y([r],n);return i&&Ke(i,Xe(i,!1))}function Ge(e,t,n,r=m().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return Q(o.operationId,t,r)}function Ke(e,t){return[e.cli.command,...t,`--data`].join(` `)}function qe(e,t){return[`example: ${Ke(e,Xe(e))}`,...Je(e,t)]}function Je(e,t){return Z(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${$(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===He),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${$(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Ye=/(?:^|\.)text$/u;function Xe(e,t=!0){let n=Z(e),r=n.filter(e=>e.required),i=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Ye.test(e.wireName)&&(e.required||!e.wireName.includes(`.`))),a=i?r.filter(e=>e.location!==`body`):r,o=(r.length>0||!t?a:Ze(e)).map($);return i||(e.body.required||e.body.requiredPath.length>0)&&!a.some(e=>e.location===`body`)?[...o,Ue]:o}function Ze(e){let t=new Set;W(t,e.resource);for(let n of Be)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 Ve){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function $(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}export{g as A,C,se as D,le as E,x as O,ye as S,de as T,Me as _,qe as a,N as b,W as c,q as d,J as f,Ne as g,H as h,Ge as i,v as k,Re as l,I as m,Z as n,Y as o,Le as p,We as r,Q as s,Ye as t,K as u,Te as v,S as w,be as x,V as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n,t as r}from"./runtime-identity-
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./runtime-identity-Cme_U1eh.js";import{resolve as i}from"node:path";import{existsSync as a}from"node:fs";var o=`@aventurevc/aventure-cli`,s=`@aventurevc/mcp-server`,c=`aventure`,l=`https://registry.npmjs.org/`,u=[o,s,``,``];function d(e){let{entryPath:n,manifest:r,manifestPath:i,packageRoot:a}=t(e);return f(r,i,a,n)}function f(t,r,o,s){let c=Reflect.get(t,`name`);if(!p(c))throw n(`${r} has unsupported package name ${String(c)}`);let l=e(t,`version`,r),u=a(i(o,`aventure-cli`,`index.ts`))?o:null,d=_(Reflect.get(t,`bin`),`${r} bin`);return{bin:v(m(t,r,o,s)??d,r),entryPath:s,name:c,packageRoot:o,registry:y(t,r,u!==null),version:l,workingTreeRoot:u}}function p(e){return u.some(t=>t===e)}function m(e,t,i,a){let o=Reflect.get(e,`aventurePublish`);if(o===void 0)return;if(!r(o))throw n(`${t} aventurePublish must be an object`);let s=Reflect.get(o,`variants`);if(!r(s))throw n(`${t} aventurePublish.variants is required`);let c=new Set(a.slice(i.length).split(/[\\/]/u));for(let e of Object.keys(s)){let n=h(s,e,t),r=Reflect.get(n,`directory`);if(typeof r==`string`&&c.has(r))return g(n,e,t)}return g(h(s,`cli`,t),`cli`,t)}function h(e,t,i){let a=Reflect.get(e,t);if(!r(a))throw n(`${i} aventurePublish.variants.${t} is required`);return a}function g(e,t,r){let i=_(Reflect.get(e,`bin`),`${r} aventurePublish.variants.${t}.bin`);if(i===void 0)throw n(`${r} aventurePublish.variants.${t}.bin is required`);return i}function _(e,t){if(e!==void 0){if(!r(e))throw n(`${t} must be an object`);return Object.entries(e).map(([e,r])=>{if(typeof r!=`string`)throw n(`${t}.${e} must be a string`);return[e,r]})}}function v(e,t){let[r,...i]=(e??[]).map(([e])=>e);if(r===void 0)throw n(`${t} defines no bin`);return[r,...i]}function y(e,t,i){let a=Reflect.get(e,`publishConfig`);if(a===void 0){if(i)return``;throw n(`${t} publishConfig.registry is required outside a working tree`)}if(!r(a))throw n(`${t} publishConfig must be an object`);let o=Reflect.get(a,`registry`);if(o!==``&&o!==`https://registry.npmjs.org/`)throw n(`${t} has unsupported publishConfig.registry ${String(o)}`);return o}export{d as a,l as i,o as n,s as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,r){return s(t?.includePrivate)||s(a(r))?`required`:o(e,n)?`preferred`:`none`}function t(e,t,n,i){return t?.scheduleEnrichment===void 0&&o(e,r)?{...t,scheduleEnrichment:!1}:t}var n=`includePrivate`,r=`scheduleEnrichment`;function i(e,t){let n=t.hasParseDefault||t.location!==`query`?void 0:t.optionKey===r?`This client sends false when omitted; pass true to queue research.`:void 0;return n===void 0||e.endsWith(n)?e:`${e} ${n}`}var a=e=>typeof e==`object`&&e&&!Array.isArray(e)?e.includePrivate:void 0,o=(e,t)=>(e.parameters??[]).some(e=>e.in===`query`&&e.name===t);function s(e){return e===null||typeof e==`object`?Array.isArray(e)&&e.some(s):e===!0||e===1||typeof e==`string`&&/^(true|on|yes|1)$/i.test(e.trim())}export{e as n,t as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as e,y as t}from"./person-owner-C0YuWKvY.js";import{kr as n}from"./dist-CGgP_Pxz.js";var r=t({clerkPublishableKey:e().nullish(),oauthClient:n.nullish()});export{r as t};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{i as e,l as t}from"./tool-policy-TAT9-UP4.js";import{C as n,O as r,T as i,i as a,l as o,n as s,o as c,p as l,t as u,u as d,v as f,w as p,y as m}from"./person-owner-C0YuWKvY.js";import{p as h}from"./result-envelope-BKQSGfkH.js";import{a as g,c as ee,i as te,l as ne,n as _,r as v,s as y,t as re}from"./text-field-jFKOGMzr.js";import{a as ie,n as ae,o as oe,r as se,s as b,t as ce}from"./human-text-cap-BcNmIPQA.js";import{A as x,D as S,E as le,O as ue,k as de,s as fe,v as pe,y as me}from"./operation-invocation-fkSqlOfs.js";import{A as he,C as ge,D as _e,E as ve,O as ye,S as be,T as C,_ as xe,a as Se,b as Ce,c as we,d as Te,f as Ee,g as De,h as Oe,i as ke,j as Ae,k as je,l as Me,m as Ne,n as Pe,o as Fe,p as Ie,r as w,s as Le,t as T,u as Re,v as ze,w as Be,x as Ve,y as E}from"./detail-BTjlqGmV.js";import{Buffer as He}from"node:buffer";var Ue=m({detail:p(),field:p().nullish(),scope:c([`entity`,`person`,`news`])}),We=c([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),Ge=Object.assign(i([We,p()]),{enum:We.enum}),D=m({modeRequested:Ge,modeUsed:Ge}),Ke=m({answerUnavailable:d(),entity:D,news:D,person:D,rejection:o(Ue),unavailable:o(c([`entity`,`person`,`news`]))}),qe=m({acceleratorParticipation:o(De),detail:o(Oe)}),O=m({core:C,enrichment:ve,fundraiseRound:o(E),provider:ze.nullish(),research:qe,semanticMatch:Fe.nullish()}),Je=c([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),Ye=m({compositeScore:f().nullish(),cosineScore:f().nullish(),curatedAsOf:p().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),curatedRelationshipType:p().nullish(),curatedSource:p().nullish(),derivedFromEntityId:r().nullish(),matchedSectionWeight:f().nullish(),origin:Je,rank:l(),sharedSectionCount:l().nullish()}),Xe=m({entity:O,similarity:Ye}),Ze=m({fundraiseInvestorJoin:d(),fundraiseTransaction:d(),operatingStatus:d(),relationship:d()}),Qe=c([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),$e=c([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),et=m({acquiredEntity:C,acquirerEntity:C,amount:f().int().nullish(),announcedAt:p().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),asOf:p().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),completedAt:p().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/).nullish(),createdAt:a({offset:!0}).nullish(),currency:p().nullish(),dataConfidence:be.nullish(),evidence:Ze,fundraiseTransactionId:r().nullish(),investorJoinId:r().nullish(),isCurrent:d().nullish(),publicSource:ge.nullish(),relationshipId:l(),status:Qe,transactionStatus:$e.nullish(),updatedAt:a({offset:!0}).nullish()}),tt=m({entity:T,investorAttribution:o(Ce),round:o(Ve),roundCount:l()}),nt=m({core:C,fundingDetail:je.nullish(),similarity:Ye,urlLink:o(_e)}),rt=m({compliance:Ne.nullish(),createdAt:a({offset:!0}).nullish(),id:l(),isCurrent:d().nullish(),isPrimary:d().nullish(),language:p().nullish(),owner:u,text:p(),textName:p().nullish(),textType:p(),updatedAt:a({offset:!0}).nullish()}),it=c([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),at=c([`fundraiseRound`,`researchDetail`]),ot=c([`preMoney`,`postMoney`,`reported`]),st=m({amountRaised:f().int().nullish(),asOfDate:p().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-](?:(?:0[0-9]|1[0-7]):[0-5][0-9]|18:00)))?)?)?$/),confidence:Me,currency:p(),declaredBasis:ot,derivation:it,detailId:l().nullish(),label:p().nullish(),source:at,sourceRef:p(),valuationPostMoney:f().int().nullish(),valuationPreMoney:f().int().nullish()}),ct=m({createdAt:a({offset:!0}).nullish(),description:p().nullish(),forkCount:l(),githubId:f().int(),homepageUrl:p().nullish(),id:f().int(),isArchived:d(),isFork:d(),language:p().nullish(),license:p().nullish(),name:p(),ownerLogin:p(),repoCreatedAt:a({offset:!0}).nullish(),repoPushedAt:a({offset:!0}).nullish(),stargazerCount:l(),topic:o(p()),updatedAt:a({offset:!0}).nullish(),url:p()}),k=m({empty:d().optional(),sorted:d().optional(),unsorted:d().optional()}),A=m({offset:f().int().optional(),paged:d().optional(),pageNumber:l().optional(),pageSize:l().optional(),sort:k.optional(),unpaged:d().optional()}),lt=m({investorAttribution:o(Ce),person:w,round:o(Ve),roundCount:l()}),ut=c([`by`,`about`]),dt=c([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),ft=m({canonicalUrl:p().nullish(),contentId:p(),contentType:dt,createdAt:a({offset:!0}).nullish(),publishedAt:a({offset:!0}).nullish(),relation:ut.nullish(),sourceDomain:p().nullish(),sourceName:p().nullish(),summary:p().nullish(),title:p(),topic:p().nullish(),updatedAt:a({offset:!0}).nullish(),url:p().nullish(),year:l().nullish()});m({content:o(Te).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(i([Ae,he])).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(we).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(C).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(et).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(T).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Be).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(E).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(tt).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(O).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Re).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(xe).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Oe).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Ie).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Xe).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(nt).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(rt).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(_e).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(st).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(ct).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Ee).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Se).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(w).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(Le).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(lt).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(ke).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()}),m({content:o(ft).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()});var pt=m({content:o(O),number:l(),size:l(),totalElements:f().int(),totalPages:l()}),mt=m({content:o(Ee),number:l(),size:l(),totalElements:f().int(),totalPages:l()}),ht=m({content:o(Se),number:l(),size:l(),totalElements:f().int(),totalPages:l()});m({content:o(Pe).optional(),empty:d().optional(),first:d().optional(),last:d().optional(),number:l().optional(),numberOfElements:l().optional(),pageable:A.optional(),size:l().optional(),sort:k.optional(),totalElements:f().int().optional(),totalPages:l().optional()});var gt=c([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`,`webProfile`]),_t=Object.assign(i([gt,p()]),{enum:gt.enum}),vt=m({entityId:r(),source:_t,sourceId:p()}),yt=m({citation:o(vt),text:p(),topic:p().nullish()}),bt=m({citation:o(vt),confidence:x,description:p().nullish(),heading:p().nullish(),paragraph:o(yt),relatedQuery:o(p()),shareable:d(),text:p(),title:p().nullish()}),xt=m({enrichmentRunId:r().nullish(),entityId:r()}),St=m({sortPriority:c([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Ct=m({max:a({offset:!0}).nullish(),min:a({offset:!0}).nullish()}),j=m({max:f().nullish(),min:f().nullish()}),M=m({max:l().nullish(),min:l().nullish()}),wt=m({averageAmountInvestedUsdRange:o(j).optional(),largestAmountInvestedUsdRange:o(j).optional(),smallestAmountInvestedUsdRange:o(j).optional(),totalAmountInvestedUsdRange:o(j).optional(),totalInvestmentRange:o(M).optional()}),N=m({amountInvestedRange:o(j).optional(),amountRaisedRange:o(j).optional(),dateAnnouncedRange:Ct.nullish(),investedCompanyName:o(p()).optional(),investedCountry:o(p()).optional(),investedIndustry:o(p()).optional(),investedRound:o(p()).optional(),investorActivity:wt.optional(),investorName:o(p()).optional(),lastRoundYearRange:o(M).optional(),rankByInvestmentActivity:d().nullish(),round:o(p()).optional(),totalRaisedRange:o(j).optional(),valuationRange:o(j).optional()}),P=c([`NONE`,`COMPANY_LISTING_READY`]),F=c([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),I=c([`hostPath`,`domain`]),Tt=n({acceleratorBrand:o(p()).optional(),acceleratorCohort:o(p()).optional(),acceleratorName:o(p()).optional(),acceleratorStatus:o(p()).optional(),affinity:o(p()).optional(),closedLast:d().optional(),employeeCountRange:o(M).optional(),entityId:o(r()).optional(),entityName:o(p()).optional(),featured:d().nullish(),fundraiseActivity:N.optional(),hasFundraising:d().nullish(),headquartersCity:o(p()).optional(),headquartersCountry:o(p()).optional(),headquartersState:o(p()).optional(),industry:o(p()).optional(),letter:p().nullish(),location:o(p()).optional(),logoOption:St.optional(),mainProduct:o(p()).optional(),operatingStatus:o(F).optional(),originCountry:o(p()).optional(),person:o(p()).optional(),portfolioHeadquartersCity:o(p()).optional(),portfolioHeadquartersCountry:o(p()).optional(),portfolioHeadquartersState:o(p()).optional(),qualityGate:P.optional(),rankByProminence:d().nullish(),semanticQuery:p().nullish(),slug:o(p().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:o(p()).optional(),suppressLateStage:d().nullish(),suppressNonOperating:d().nullish(),suppressZeroTotalRaised:d().nullish(),tag:o(p()).optional(),textSearch:p().nullish(),typeCustomer:o(p()).optional(),typeModel:o(p()).optional(),typeOwnership:o(p()).optional(),typeRecord:o(s).optional(),typeRevenue:o(p()).optional(),typeTechnologyUsed:o(p()).optional(),url:p().nullish(),urlDomain:p().nullish(),urlMatchMode:I.nullish(),urlType:ye.nullish(),yearFoundedRange:o(M).optional()}),Et=c([`discovery`,`profile`,`peer`,`comparison`]),Dt=c([`keyword`,`semantic`]),Ot=c([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),kt=Object.assign(i([Ot,p()]),{enum:Ot.enum}),At=m({descending:d(),field:kt,sortKey:p().nullish()}),jt=m({order:o(At),relevance:Dt.nullish()}),Mt=m({confidence:x,execution:D,fallbackUsed:d(),filter:Tt,intent:Et,interpretation:p(),sort:jt,subjectEntityName:o(p()),unsupported:p().nullish()}),L=m({changedAt:a({offset:!0}).nullish(),dataSourceUpdatedAt:a({offset:!0}).nullish(),pendingApproval:l().nullish(),sourceId:p().nullish(),status:p().nullish()}),Nt=m({fundManagerRelationshipSource:L.nullish(),fundraiseTransaction:E,fundraiseTransactionSource:L.nullish(),investorJoinSource:L.nullish()}),R=m({evidence:Nt,investor:u,semanticMatch:Fe.nullish()}),Pt=m({entityId:r(),matchedOffering:C.nullish(),probability:f(),webUrl:o(p())}),Ft=m({entityId:r(),label:p(),publishedAt:a({offset:!0}).nullish(),score:f(),source:_t,sourceId:p(),text:p(),url:p().nullish()}),It=m({answer:bt.nullish(),filing:o(xt).nullish(),interpretation:Mt,investment:o(R),judgment:o(Pt),passage:o(Ft),peer:o(Xe),pendingWebQuery:o(p()),personLead:d(),result:pt,searchRequestId:r().nullish(),subject:o(O)}),Lt=c([`auto-match`,`needs-review`,`approved`,`rejected`]),Rt=m({createdAt:a({offset:!0}),entityId:r(),href:p().nullish(),internal:d(),matchStatus:Lt.nullish(),mention:p().nullish(),slug:p().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:s.nullish(),updatedAt:a({offset:!0})}),zt=m({entity:o(Rt),newsId:l()}),Bt=n({acceleratorBrand:o(p()).optional(),acceleratorCohort:o(p()).optional(),acceleratorName:o(p()).optional(),acceleratorStatus:o(p()).optional(),affinity:o(p()).optional(),closedLast:d().optional(),employeeCountRange:o(M).optional(),entityId:o(r()).optional(),entityName:o(p()).optional(),featured:d().nullish(),fundraiseActivity:N.optional(),hasFundraising:d().nullish(),headquartersCity:o(p()).optional(),headquartersCountry:o(p()).optional(),headquartersState:o(p()).optional(),industry:o(p()).optional(),letter:p().nullish(),location:o(p()).optional(),logoOption:St.optional(),mainProduct:o(p()).optional(),operatingStatus:o(F).optional(),originCountry:o(p()).optional(),person:o(p()).optional(),portfolioHeadquartersCity:o(p()).optional(),portfolioHeadquartersCountry:o(p()).optional(),portfolioHeadquartersState:o(p()).optional(),qualityGate:P.optional(),rankByProminence:d().nullish(),slug:o(p().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:o(p()).optional(),suppressLateStage:d().nullish(),suppressNonOperating:d().nullish(),suppressZeroTotalRaised:d().nullish(),tag:o(p()).optional(),textSearch:p().nullish(),typeCustomer:o(p()).optional(),typeModel:o(p()).optional(),typeOwnership:o(p()).optional(),typeRecord:o(s).optional(),typeRevenue:o(p()).optional(),typeTechnologyUsed:o(p()).optional(),url:p().nullish(),urlDomain:p().nullish(),urlMatchMode:I.nullish(),urlType:ye.nullish(),yearFoundedRange:o(M).optional()}),Vt=m({amountInvestedRange:o(j).nullish(),amountRaisedRange:o(j).nullish(),entityName:o(p()).nullish(),investedCompany:o(p()).nullish(),personTitle:o(p()).nullish(),round:o(p()).nullish(),totalInvestmentCount:o(M).nullish(),typeRecord:o(s).nullish()}),Ht=m({arrayFilter:Vt.optional(),entityFilter:Bt.optional(),entityId:r().nullish(),entitySlug:p().nullish(),firstName:p().nullish(),includeAddress:d().nullish(),includeUrl:d().nullish(),investorActivity:wt.optional(),isCurrent:d().nullish(),lastName:p().nullish(),letter:p().nullish(),personId:o(r()).max(200).optional(),personName:o(p()).optional(),role:p().nullish(),search:p().nullish(),semanticQuery:p().nullish(),status:p().nullish()}),Ut=m({descending:d(),field:c([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:p().nullish()}),Wt=m({order:o(Ut),relevance:Dt.nullish()}),Gt=m({confidence:x,execution:D,fallbackUsed:d(),filter:Ht,interpretation:p(),sort:Wt,unsupported:p().nullish()}),Kt=m({currentCompany:p().nullish(),headline:p().nullish(),id:r(),location:p().nullish(),name:p(),named:p(),organizationEvidence:c([`headline`,`profile`,`none`]).nullish(),photoUrl:p().nullish(),profileUrl:p(),slug:p().regex(/^[a-z0-9_-]+$/).max(255)}),qt=m({interpretation:Gt,investment:o(R),personLead:d(),profile:o(Kt),result:ht,searchRequestId:r().nullish()}),Jt=m({label:p(),query:p()}),Yt=m({key:p(),option:o(Jt),prompt:p()}),Xt=m({entity:It,entityDetail:o(T),news:mt,newsEntityMention:o(zt),person:qt,personDetail:o(w),personLead:d(),provenance:Ke,qualifier:Yt.nullish(),section:o(c([`person`,`company`,`productService`,`investor`])).optional()}),Zt=`aventure`;function z(e,t,n=`cli`){let r=t.find(t=>t.operationId===e);if(n===`mcp`&&r!==void 0){let e=me(r);return`${e.tool} ${JSON.stringify(e.arguments)}`}let i=r?.cliPath;return i===void 0?void 0:`${Zt} ${i.join(` `)}`}function Qt(e,t,n=e,r=`cli`){return r===`mcp`?z(e,t,r)??e:fe(e,t,`aventure`)??n}function $t(e,t,n=`cli`){let r=le.safeParse(e);if(!r.success)return null;let{answer:i,citation:a,confidence:o,resolution:s}=r.data;if(s!=null)return en(i,s,t,n);let c=i.trimEnd().split(`
|
|
2
|
+
`),l=new Set(a.flatMap(({sourceType:e,sourceId:r})=>{if(e!==de.options[0].enum.OPERATION)return[];let i=z(r,t,n);return i===void 0?[]:[i]}));return l.size>0&&c.push(``,n===`mcp`?`MCP calls:`:`Commands:`,...[...l].map(e=>` ${e}`)),c.push(``,`Confidence: ${o}`),a.length===0||(c.push(`Sources (${a.length}):`),c.push(...a.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`}))),c}function en(e,t,n,r){let{outcome:i,operationId:a,probability:o,candidate:s,taskKey:c,taskPlan:l}=t,u=[l==null?e.trimEnd():nn(l)],d=[``,`Outcome: ${i}${o==null?``:` (probability ${o.toFixed(2)})`}`];switch(i){case S.enum.TASK_PLAN:return[...u,...l==null?[]:rn(l,n,r),...d];case S.enum.OPERATION_ADVICE:{let e=s.filter(({sourceId:e})=>e!==a);return[...u,...a==null?[]:[``,r===`mcp`?`MCP call:`:`Command:`,` ${Qt(a,n,a,r)}`],...d,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case S.enum.CLARIFY:return[...u,...c==null?[]:[``,`Leading catalog task: ${c}`],...on(`Candidates:`,s,n,r),...d];case S.enum.ABSTAIN:return[...u,...on(`Nearest operations:`,s,n,r),...d];default:throw Error(`Unhandled help resolution outcome ${String(i)}`)}}function tn(e,t,n=`cli`){let r=ue.safeParse(e);return r.success?[nn(r.data),...rn(r.data,t,n)]:null}var nn=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function rn(e,t,n){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n,required:r})=>` ${e} (${t}, ${r===!1?`optional`:`required`}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:r,cliCommand:i,writeGuidance:a},o)=>[` ${o+1}. ${r.stepKey===void 0?``:`${r.stepKey}: `}${Qt(r.operationId,t,i,n)}`,` ${r.instruction}`,...an(e,o,a)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function an(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function on(e,t,n,r){if(t.length===0)return[];let i=t.map(({sourceId:e,excerpt:t})=>({command:z(e,n,r)??e,excerpt:t})),a=Math.max(...i.map(({command:e})=>e.length));return[``,e,...i.map(({command:e,excerpt:t})=>` ${e.padEnd(a)} # ${t}`)]}var B=30,sn=8,V=10,cn=2,ln=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],un=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]);function dn(e,t,n,{transport:r=`cli`,trailer:i=[]}={}){if(typeof t==`string`)return oe(t,r,i);let a=pe(t,i);if(a!==null)return se(a,i,r);let o=Sn(t);if(o===null)return null;let s=e.find(({operationId:e})=>e===o.operationId),c=ne(s?.detailField,o.response),l=[...c.hiddenNote,...i],u=(e,t)=>ae([e.trimEnd(),...t].join(`
|
|
3
|
+
`),{appendNewline:!0,preservedTrailerLines:t.length>0?t.length:void 0,transport:r}),d=s?.parameters??[],f={...o,response:c.response,parameters:d,transport:r},p=$t(f.response,e,r)??tn(f.response,e,r);if(p!==null)return u(p.join(`
|
|
4
|
+
`),i);let m=fn(f);if(m!==null)return u(m.join(`
|
|
5
|
+
`),l);let h=[f.summary??n??f.operationId??`OpenAPI call succeeded`,`${f.method} ${f.endpoint}`],g=ie(gn(f),117-l.length,ce-He.byteLength(`${[...h,...l].join(`
|
|
6
|
+
`)}\n`,`utf8`),r);return u([...h,...g].filter(Boolean).join(`
|
|
7
|
+
`),l)}function fn({response:e,...t}){if(e===void 0||!Y(e)||!(`entity`in e&&`person`in e&&`news`in e))return null;let n=Xt.safeParse(e);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?pn(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>g(`${e} rejected: ${t}`)),[`entities:`,...H(r.result,t)].join(`
|
|
8
|
+
`),[`people:`,...H(i.result,t)].join(`
|
|
9
|
+
`),[`news:`,...H(a,t)].join(`
|
|
10
|
+
`)]}function pn(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${g(e)}`).join(`
|
|
11
|
+
`)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>g(` - ${e}:${t} entity=${n}`)).join(`
|
|
12
|
+
`)}`;return[`answer:\n ${te(e.text).replaceAll(`
|
|
13
|
+
`,`
|
|
14
|
+
`)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function mn(e){let t=Sn(e)?.response,n=Y(t)?t.interpretation:void 0;if(!Y(n))return null;let r=D.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=re(n.filter),{unsupported:s,fallbackUsed:c}=n,l=[`strategy: requested=${i} used=${a}`,...Y(o)?[`constraints:`,...Object.entries(o).flatMap(([e,t])=>t===void 0?[]:[` ${e}: ${hn(t)}`])]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``];return ae(l.filter(Boolean).join(`
|
|
15
|
+
`),{appendNewline:!0})}var hn=e=>X(e)?g(e):Array.isArray(e)&&e.every(X)?e.map(e=>g(e)).join(`, `):JSON.stringify(e);function gn(e){let{response:t,method:n,nextCursor:r,httpStatus:i,location:a,transport:o}=e;if(t===void 0)return a!==void 0&&i!==void 0?[`status=${i} redirect=${a}`]:i===void 0?[]:[`status=${i} no response body`];let s=i===void 0||n===`GET`?``:`status=${i}`,c=Y(t)&&!q(t)?Cn(t):null,l=c===null?void 0:Y(c.context.interpretation)?re(c.context):c.context,u=l!==void 0&&Y(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Y)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...q(t)?H(t,e,r):c===null?Tn(t)?yn(t,[`filter`],t.meta,o):En(t)?yn(t,[`arrayFilterEntry`,`rangeFilterEntry`],t.filtersMeta,o):Dn(t)?bn(t,o):U(t,``):[...H(c.page,e,r),...Object.keys(p).length===0?[]:U(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(_n(t,o)))]].filter(Boolean)}function H(e,t,n){let r=xn(t),i=e.numberOfElements??e.content.length,a=Math.min(e.content.length,B),o=Math.max(1,a),s=(e.number??0)*(e.size??i),c=(e.totalElements??0)-s-i,l=e.number===void 0?``:` page=${e.number}`,u=e.size===void 0?``:` size=${e.size}`,d=e.totalElements===void 0?``:` total=${e.totalElements}`,f=e.totalPages===void 0?``:` totalPages=${e.totalPages}`,p=(e.number??0)+1,m=e.totalPages===void 0||p<e.totalPages,h=_(`page`,t.parameters);return[`rows=${i}${l}${u}${d}${f}`,a>=i?``:`page rows omitted: ${i-a} (${a}/${i} shown); ${e.content.length>a?b(t.transport,`.content`):`reread with ${_(`size`,t.parameters)} ${o} and ${h} ${Math.floor((s+a)/o)} through ${Math.floor((s+i-1)/o)} (MCP: size, page); pages start at 0`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${y(n)}`,c<=0||n!==void 0?``:m&&i===e.size?`more: ${c} rows not shown; use ${h} or ${_(`size`,t.parameters)} to see them`:`more: ${c} more matched but this response returns only these ${i}; narrow the query to reach them${m?` (${h} ${p} starts after this page)`:``}`,..._n(e.content.slice(0,a),t.transport)].filter(Boolean)}function _n(e,t){if(!e.every(Y))return W(e,``);let n=e.filter(Y);if(n.length===0)return e.length===0?[`(empty)`]:W(e,``);let r=vn(n);if(r.length===0)return W(e,``);let i=n.slice(0,B).map(e=>{let t=G(e);return r.map(e=>t[e]??``)}),a=r.map(e=>e.split(`.`).at(-1)??e),o=a.map((e,t)=>{let n=i.map(e=>e[t]??``),r=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?r:Math.min(32,r)}),s=e=>e.map((e,t)=>ee(e,o[t]??12).padEnd(o[t]??12)).join(` `),c=[s(a),s(o.map(e=>`-`.repeat(e)))];return i.forEach(e=>c.push(s(e))),n.length>B&&c.push(`... ${n.length-B} more rows omitted; ${b(t)}`),c}function vn(e){let t=e.map(e=>G(e)),n=new Set(t.flatMap(e=>Object.keys(e))),r=ln.filter(e=>n.has(e)),i=new Set(r.map(K)),a=[...n].filter(e=>{let n=t.every(t=>/^-?\d+(?:\.\d+)?$/u.test(t[e]??`0`));return!e.includes(`.`)||/id$/iu.test(e)||i.has(K(e))?!1:(n&&i.add(K(e)),n)}),o=[...n].filter(e=>/(?:^|\.)id$/u.test(e)).slice(0,1),s=[...new Set([...r,...o,...a])],c=[...n].filter(e=>!s.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,sn-s.length);return[...s,...c].slice(0,sn)}function yn(e,t,n,r){let i=t.flatMap(t=>e[t].map((e,n)=>({...e,path:`.${t}[${n}].choiceOption`}))),a=n!==void 0&&Y(n)?n:{},o=[`total`,`limit`].flatMap(e=>typeof a[e]==`number`?[` ${e}=${a[e]}`]:[]).join(``),s=[`filters=${i.length}${o}`];for(let e of i){let t=e.choiceOption.length,n=e.choiceOptionTotal===null?`unknown (degraded)`:e.choiceOptionTotal??t,i=e.choiceOptionTruncated===!0?` truncated`:``;s.push(`- ${e.filterKey} (${e.label}): choices ${t}/${n}${i}`),e.choiceOption.slice(0,V).forEach(t=>{s.push(` ${_(e.filterKey)} ${y(t.value)}`)}),t>V&&s.push(` ... ${t-V} choices omitted for ${e.filterKey}; ${b(r,e.path)}`)}return s}function bn(e,t){let n=_(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,V).map(e=>`${n} ${y(e)}`),e.result.length>V?`... ${e.result.length-V} matches omitted; ${b(t,`.result`)}`:``].filter(Boolean)}function xn({endpoint:e,parameters:t}){let n=e.indexOf(`?`);return n<0?[]:[...new URLSearchParams(e.slice(n+1)).entries()].filter(([e,t])=>!un.has(e)&&t.length>0).map(([e,n])=>`${_(e,t)} ${y(n)}`)}function Sn(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=t=>{let n=Reflect.get(e,t);return typeof n==`string`?n:void 0},[n,r,i]=[t(`method`),t(`endpoint`),t(`nextCursor`)];if(n===void 0||r===void 0)return null;let a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`response`),s=o===void 0?void 0:h.safeParse(o);return s!==void 0&&!s.success?null:{method:n,endpoint:r,httpStatus:typeof a==`number`?a:void 0,location:t(`location`),operationId:t(`operationId`),summary:t(`summary`),nextCursor:i===``?void 0:i,response:s?.data}}function U(e,t,n){if(e===void 0)return[];if(X(e))return[`${t}${v(e,n)}`];if(Array.isArray(e))return W(e,t,n);let r=[];for(let[n,i]of Object.entries(e))if(i!==void 0){if(X(i))r.push(`${t}${n}: ${v(i,n)}`);else{r.push(`${t}${n}:`);for(let e of U(i,`${t} `,n))r.push(e)}}return r.length===0?[`${t}(empty)`]:r}function W(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e)if(X(i))r.push(`${t}- ${v(i,n)}`);else{r.push(`${t}-`);for(let e of U(i,`${t} `))r.push(e)}return r}function G(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:g(e,t)}:n>cn?{}:Array.isArray(e)?e[0]===void 0?{}:G(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{if(r===void 0)return[];let i=t.length===0?e:`${t}.${e}`;return X(r)?[[i,g(r,i)]]:Object.entries(G(r,i,n+1))}))}var K=e=>e.split(`.`,1)[0],q=e=>Y(e)&&Array.isArray(e.content);function Cn(e){let[t,...n]=Object.entries(e).filter(e=>q(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function wn(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var Tn=e=>Y(e)&&J(e.filter),En=e=>Y(e)&&J(e.arrayFilterEntry)&&J(e.rangeFilterEntry),J=e=>Array.isArray(e)&&e.every(wn),Dn=e=>Y(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>typeof e!=`object`||!e,Z=/\{([^}]+)\}/gu;function On(t,n,r=`cli`){let i=n.filter(e=>e.method===`GET`&&(r===`cli`||e.binaryResponse!==!0)),a=e=>t.endpoint!==void 0&&e.endsWith(t.endpoint),o=n.find(e=>e.operationId===t.operationId),s=t.ok&&o!==void 0&&e(o.intent),c=[...s&&t.endpoint!==void 0?Mn(t.endpoint.split(`?`)[0]??``,i,!1,r).map(e=>r===`mcp`?e:`${e} --data --to-file <path>`):[],...t.references.filter(e=>!a(e)).flatMap(jn).flatMap(e=>Mn(e.pathname,i,!0,r)),...t.references.filter(a).flatMap(jn).flatMap(e=>Nn(e,i,r))],l=r===`mcp`?kn:void 0;return c.length===0?{write:s,narrowerRead:l}:{exactRecovery:`Read the full result ${c.join(`; `)}.`,write:s,narrowerRead:l}}var kn=`Refetch a narrower result: call aventure_help with q set to the read intent, then call aventure_read with its operationId and declared query or pathParams, using ids/references, filters, or smaller query.page/query.size windows.`;function An(t,n){let r=n.find(e=>e.operationId===t.operationId);if(!t.ok||r?.method!==`GET`||r.mutates===!0||e(r.intent)||t.endpoint===void 0)return;let i=new URL(t.endpoint,`https://localhost`),a=[...r.path.matchAll(Z)].map(([,e])=>e),o=RegExp(`^${r.path.replace(Z,`([^/]+)`)}$`,`u`).exec(i.pathname);if(o===null)return;let s=r.parameters.find(e=>e.location===`query`&&e.name===`compact`&&e.schemaType===`boolean`);s!==void 0&&i.searchParams.set(s.name,`true`);let c=[];for(let e of r.parameters){let t=e.location===`path`?[decodeURIComponent(o[a.indexOf(e.name)+1]??``)]:e.location===`query`?i.searchParams.getAll(e.name):[];if(e.required&&t.length===0)return;t.length>0&&c.push($(e),...t.map(In))}return`Run: \`${Q(r,[...c,`--data`,`--to-file`,`./aventure-output.json`])}\`. On success, the spill file contains the bare payload (top-level keys as returned), not the result envelope or a data.response wrapper.`}function jn(e){return URL.canParse(e)?[new URL(e)]:[]}function Mn(e,t,n,r){return t.flatMap(t=>{let i=[...t.path.matchAll(Z)].map(([,e])=>e),a=RegExp(`^${t.path.replace(Z,`([^/]+)`)}$`,`u`),o=n&&i.length===0?null:a.exec(e);if(o===null)return[];if(r===`mcp`)return[Pn(t,{pathParams:Object.fromEntries(i.map((e,t)=>[e??``,decodeURIComponent(o[t+1]??``)]))})];let s=i.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[$(r),o[n+1]??``]});return[`${Fn(t)}, ${Q(t,s)}`]})}function Nn(e,t,n){let r=t.find(t=>t.path===e.pathname);return r===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${r.path}/`))return[];let i=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),a=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(i===void 0||a===void 0)return[];if(n===`mcp`)return[`in windows: ${Pn(t,{query:{...Object.fromEntries([...e.searchParams].filter(([e])=>t.parameters.some(t=>t.location===`query`&&t.name===e))),[i.name]:`<offset>`,[a.name]:`<limit>`}})}, advancing query.${i.name} until a window returns fewer than query.${a.name} units`];let o=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[$(t),In(n)]}),s=[$(i),`<n>`,$(a),`<n>`];return[`${Fn(t)}, in windows: ${Q(t,[...o,...s])}, advancing ${$(i)} until a window returns fewer than ${$(a)} units`]})}function Pn(e,n){return`${t(e.intent)} ${JSON.stringify({operationId:e.operationId,...n})}`}function Fn(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function Q(e,t){return[Zt,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function In(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}export{mn as i,On as n,dn as r,An as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fileURLToPath as e}from"node:url";import{dirname as t,resolve as n,sep as r}from"node:path";import{existsSync as i,readFileSync as a,realpathSync as o}from"node:fs";var s=[],c=8,l=e(import.meta.url),u=`aventure-`,d=new Set([``,``]),f,p;function m(){return f??=h(_()),f}function h({manifest:e,manifestPath:t}){return`${g(y(e,`name`,t))}/${y(e,`version`,t)} (${process.platform}; ${process.arch}) Node.js/${process.versions.node}`}function g(e){let t=e.slice(e.lastIndexOf(`/`)+1);return t.startsWith(u)||d.has(e)?t:`${u}${t}`}function _(e=l){if(e===l&&p)return p;let a;try{a=o(e)}catch(t){throw x(`cannot resolve ${e}`,t instanceof Error?t:void 0)}let s=t(a);for(let u=0;u<c;u+=1){let c=n(s,`package.json`);if(i(c)){let t={entryPath:a,manifest:v(c),manifestPath:c,packageRoot:s};return e===l?p=t:!p&&l.startsWith(`${s}${r}`)&&(p={...t,entryPath:o(l)}),t}let u=t(s);if(u===s)break;s=u}throw x(`no package.json found above ${e}`)}function v(e){let t;try{t=JSON.parse(a(e,`utf8`))}catch(t){throw x(`cannot parse ${e}`,t instanceof Error?t:void 0)}if(!b(t))throw x(`${e} must contain a JSON object`);return t}function y(e,t,n){let r=Reflect.get(e,t);if(typeof r!=`string`||r===``||r.trim()!==r)throw x(`${n} ${t} must be a non-empty, unpadded string`);return r}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x(e,t){return Error(`aventure package metadata: ${e}`,{cause:t})}export{g as a,s as c,y as i,_ as n,m as o,x as r,h as s,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,O as t,S as n,_ as r,b as i,d as a,h as o,i as s,l as c,n as l,p as u,w as d,x as ee}from"./esm-BVGNzX-8.js";import{n as te}from"./commander-DEj7N1b9.js";import{$ as f,A as p,B as ne,C as re,D as ie,E as m,F as h,G as ae,L as oe,N as se,O as ce,U as le,V as ue,W as de,X as fe,Y as pe,Z as g,_t as me,at as he,ct as ge,gt as _e,it as ve,j as ye,k as _,mt as v,nt as be,pt as xe,rt as Se,s as Ce,st as y,tt as we,ut as b,vt as Te,w as Ee}from"./logging-D2cJNH4n.js";import{C as x,S,T as C,g as w,h as De,l as T,o as E,u as D,v as O,w as k,y as A}from"./person-owner-C0YuWKvY.js";import{c as j,p as M,r as N}from"./result-envelope-BKQSGfkH.js";import{a as Oe}from"./package-DPDX5zmx.js";import{basename as ke,extname as Ae}from"node:path";import{AsyncLocalStorage as je}from"node:async_hooks";import{readFile as Me}from"node:fs/promises";var Ne={name:`span`,countItems:e=>e.length},Pe=256,Fe=512;function Ie(e,t){let n=e&255|Pe;return t&&(n|=Fe),n}function Le(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:_(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ze(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Re(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ie(n.traceFlags,e.parentSpanContext?.isRemote)}}function Re(e,t){return{attributes:e.attributes?_(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ie(e.context.traceFlags,e.context.isRemote)}}function ze(e,t){return{attributes:e.attributes?_(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Be(e,t){return{resourceSpans:He(e,t)}}function Ve(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function He(e,t){let n=Ve(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Le(e,t));o.push({scope:ie(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ce(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}l();var Ue={serializeRequest:e=>{let t=Be(e,m);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return c.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};we(),h(),p();function We(e){return new URL(e,`https://placeholder.invalid`).pathname}function Ge(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(qe)?!1:n.every((e,t)=>Ke(e)||e===r[t])}function Ke(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function qe(e){if(Ke(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var Je=`otlp_http_span_exporter`,Ye=class extends Te{constructor(e={}){super(Ee(re(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),Ue,Je,Ne,e.selfObsMeterProvider))}},Xe=`exception`,Ze=Symbol.for(`nodejs.util.inspect.custom`);function Qe(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function $e(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}l();var et=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:u.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=f.now(),this._performanceOffset=t-(this._performanceStartTime+f.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return c.warn(`Invalid attribute key: ${e}`),this;if(!xe(t))return c.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return c.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&c.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),pe(t)&&(pe(n)||(n=t),t=void 0);let i=v(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,l=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&l>=a?s++:(o[e]=this._truncateToSize(t),l++)}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&c.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=v(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];n!==void 0&&o>=n?a++:(i[e]=this._truncateToSize(t),o++)}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===u.UNSET||this.status.code===u.OK)return this;let t={code:e.code};return e.code===u.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&c.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?c.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=ae(this.startTime,this.endTime),this._duration[0]<0&&(c.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){if(typeof e==`number`&&e<=f.now())return de(e+this._performanceOffset);if(typeof e==`number`)return g(e);if(e instanceof Date)return g(e.getTime());if(fe(e))return e;if(this._startTimeProvided)return g(Date.now());let t=f.now()-this._performanceStartTime;return le(this.startTime,g(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Se]=e:e&&(e.code?n[he]=e.code.toString():e.name&&(n[he]=e.name),e.message&&(n[Se]=e.message),e.stack&&(n[ve]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Xe,n,t):c.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(c.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Ze](e,t,n){return $e(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Qe(this.resource)}},e,t,n)}},P;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(P||={});var tt=`otel.component.name`,nt=`otel.component.type`,rt=`otel.span.parent.origin`,it=`otel.span.sampling_result`,at=`otel.sdk.processor.span.processed`,ot=`otel.sdk.processor.span.queue.capacity`,st=`otel.sdk.processor.span.queue.size`,ct=`otel.sdk.span.live`,lt=`otel.sdk.span.started`,ut=`batching_span_processor`,dt=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(lt,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ct,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pt(t);if(this.startedSpans.add(1,{[rt]:ft(e),[it]:n}),t===P.NOT_RECORD)return()=>{};let r={[it]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ft(e){return e?e.isRemote?`remote`:`local`:`none`}function pt(e){switch(e){case P.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case P.RECORD:return`RECORD_ONLY`;case P.NOT_RECORD:return`DROP`}}var mt=`2.11.0`;l(),h();var ht=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,mt);this._tracerMetrics=new dt(n)}startSpan(e,t={},i=a.active()){t.root&&(i=s.deleteSpan(i));let l=s.getSpan(i);if(_e(i))return c.debug(`Instrumentation suppressed, returning Noop Span`),s.wrapSpanContext(n);let u=l?.spanContext(),ee=this._idGenerator.generateSpanId(),te,f,p;!u||!s.isSpanContextValid(u)?f=this._idGenerator.generateTraceId():(f=u.traceId,p=u.traceState,te=u);let ne=t.kind??o.INTERNAL,re=(t.links??[]).map(e=>({context:e.context,attributes:v(e.attributes)})),ie=v(t.attributes),m=this._sampler.shouldSample(i,f,e,ne,ie,re),h=this._tracerMetrics.startSpan(u,m.decision);p=m.traceState??p;let ae=m.decision===r.RECORD_AND_SAMPLED?d.SAMPLED:d.NONE,oe={traceId:f,spanId:ee,traceFlags:ae,traceState:p};if(m.decision===r.NOT_RECORD)return c.debug(`Recording is off, propagating context in a non-recording span`),s.wrapSpanContext(oe);let se=v(Object.assign(ie,m.attributes));return new et({resource:this._resource,scope:this.instrumentationScope,context:i,spanContext:oe,name:e,kind:ne,links:re,parentSpanContext:te,attributes:se,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,t,n,r){let i,o,c;if(arguments.length<2)return;arguments.length===2?c=t:arguments.length===3?(i=t,c=n):(i=t,o=n,c=r);let l=o??a.active(),u=this.startSpan(e,i,l),d=s.setSpan(l,u);return a.with(d,c,void 0,u)}[Ze](e,t,n){return $e(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Qe(this._resource)},spanLimits:this._spanLimits},e,t,n)}};h();var gt=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{b(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},F=class{shouldSample(){return{decision:P.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},I=class{shouldSample(){return{decision:P.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};l(),h();var L=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(b(Error(`ParentBasedSampler must have a root sampler configured`)),new I),this._remoteParentSampled=e.remoteParentSampled??new I,this._remoteParentNotSampled=e.remoteParentNotSampled??new F,this._localParentSampled=e.localParentSampled??new I,this._localParentNotSampled=e.localParentNotSampled??new F}shouldSample(e,t,n,r,a,o){let c=s.getSpanContext(e);return!c||!i(c)?this._root.shouldSample(e,t,n,r,a,o):c.isRemote?c.traceFlags&d.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,a,o):this._remoteParentNotSampled.shouldSample(e,t,n,r,a,o):c.traceFlags&d.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,a,o):this._localParentNotSampled.shouldSample(e,t,n,r,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};we();var _t=new Map,vt=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=_t.get(e)??0;if(_t.set(e,r+1),this.standardAttrs={[nt]:e,[tt]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[be]:`queue_full`},this.processedSpans=t.createCounter(at,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(ot,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(st,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[be]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};l(),h();var yt=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new oe(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let n=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):t();this._metrics=new vt(ut,n,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&d.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(this._droppedSpansCount===0&&c.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1)):(this._droppedSpansCount>0&&(c.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);a.with(me(a.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===ue.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{b(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,b(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},bt=class extends yt{onShutdown(){}},xt=8,St=16,Ct=class{generateTraceId=wt(St);generateSpanId=wt(xt)},R=Buffer.allocUnsafe(St);function wt(e){return function(){for(let t=0;t<e/4;t++)R.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(R[t]>0);t++)t===e-1&&(R[e-1]=1);return R.toString(`hex`,0,e)}}l();var z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(z||={});var Tt=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??ye();let n=e.spanProcessors??[];this._activeSpanProcessor=new gt(n),this._tracerOptions={resource:this._resource,sampler:e.sampler??new L({root:new I}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Ct,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return t()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new ht({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=z.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==z.timeout&&(r=z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=z.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==z.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ze](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return $e(`TracerProvider`,{resource:{attributes:Qe(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};l();var Et=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ee(t)&&this._accumulate(t)<this._upperBound?P.RECORD_AND_SAMPLED:P.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};l(),h();var B;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(B||={});var V=1;function Dt(){return{sampler:Ot(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:y(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:y(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:y(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:y(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:y(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:y(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:y(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:y(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Ot(){let e=ge(`OTEL_TRACES_SAMPLER`)??B.ParentBasedAlwaysOn;switch(e){case B.AlwaysOn:return new I;case B.AlwaysOff:return new F;case B.ParentBasedAlwaysOn:return new L({root:new I});case B.ParentBasedAlwaysOff:return new L({root:new F});case B.TraceIdRatio:return new Et(kt());case B.ParentBasedTraceIdRatio:return new L({root:new Et(kt())});default:return c.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${B.ParentBasedAlwaysOn}".`),new L({root:new I})}}function kt(){let e=y(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(c.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${V}.`),V):e<0||e>1?(c.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${V}.`),V):e}h();function At(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??y(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??y(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??y(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??y(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}h();var jt=class extends Tt{constructor(e={}){let t=ne({},Dt(),At(e));delete t.generalLimits,super(t)}};h();var Mt=class extends bt{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=y(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};l(),p();var Nt=`aventure-mcp-server`,Pt=`aventure=mcp`,Ft=`langfuse.session.id`,It=`/api/public/otel/v1/traces`,Lt=5e3,Rt=new Set([`langfuse.observation.input`,`langfuse.observation.output`,`langfuse.observation.status_message`]),zt=[`OTEL_EXPORTER_OTLP_HEADERS`,`OTEL_EXPORTER_OTLP_TRACES_HEADERS`],H,U;function W(e){return e?.trim()||void 0}function Bt(){return W(process.env.GIT_SHA)??W(process.env.SENTRY_RELEASE)??Oe().version}function Vt(){let e=W(process.env.LANGFUSE_BASE_URL),t=W(process.env.LANGFUSE_PUBLIC_KEY),n=W(process.env.LANGFUSE_SECRET_KEY);if(e!==void 0&&t!==void 0&&n!==void 0){for(let e of zt){let t=(process.env[e]??``).split(`,`).map(e=>e.split(`=`,1)[0]?.trim().toLowerCase()??``).filter(e=>e!==``&&e!==`authorization`);if(t.length>0)throw Error(`${e} sets ${t.join(`, `)}, which the Langfuse trace exporter would forward`)}return new Ye({url:new URL(It,e).href,headers:{Authorization:`Basic ${Buffer.from(`${t}:${n}`).toString(`base64`)}`,"x-langfuse-ingestion-version":`4`},timeoutMillis:Lt})}}function Ht(e){let t={};for(let[n,r]of Object.entries(e.attributes))Rt.has(n)||(t[n]=r);return{name:e.name,kind:e.kind,spanContext:()=>e.spanContext(),...e.parentSpanContext===void 0?{}:{parentSpanContext:e.parentSpanContext},startTime:e.startTime,endTime:e.endTime,status:e.status,attributes:t,links:e.links,events:e.events,duration:e.duration,ended:e.ended,resource:e.resource,instrumentationScope:e.instrumentationScope,droppedAttributesCount:e.droppedAttributesCount,droppedEventsCount:e.droppedEventsCount,droppedLinksCount:e.droppedLinksCount}}function Ut(e){return{export:(t,n)=>e.export(t.map(Ht),n),shutdown:()=>e.shutdown(),forceFlush:()=>e.forceFlush?.()??Promise.resolve()}}function Wt(){if(H!==void 0)return U;let e=W(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),t=[...e===void 0?[]:[Ut(new Ye({url:e,timeoutMillis:Lt}))],...[Vt()].filter(e=>e!==void 0)];return H=new jt({sampler:new I,resource:se({...Ce(),"service.version":Bt()}),spanProcessors:t.map(e=>new Mt(e,{exportTimeoutMillis:Lt}))}),U=t.length===0?void 0:H.getTracer(Nt),U}function Gt(){Wt()}var Kt=/^00-(?<traceId>[0-9a-f]{32})-(?<spanId>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})$/u,qt=/[13579bdf]$/u;function Jt(t,n,r){let i=Wt();if(i===void 0)return;let a=Kt.exec(r??``)?.groups,c=a?.traceId===void 0||a.spanId===void 0?e:s.setSpanContext(e,{traceId:a.traceId,spanId:a.spanId,traceFlags:qt.test(a.flags??``)?d.SAMPLED:d.NONE,isRemote:!0});return i.startSpan(t,{kind:o.SERVER,attributes:{"langfuse.trace.name":t,...n,"langfuse.environment":Ce()[`deployment.environment.name`],"langfuse.release":Bt()}},c)}function Yt(e){let{traceId:t,spanId:n,traceFlags:r}=e.spanContext();return`00-${t}-${n}-${(r&d.SAMPLED)===0?`00`:`01`}`}function Xt(e,t,n){e.setAttributes(t),e.setStatus({code:n?u.ERROR:u.OK}),e.end()}async function Zt(){let e=H;H=void 0,U=void 0,await e?.shutdown()}var G=new je,Qt=()=>G.getStore()?.requestId,$t=()=>G.getStore()?.userBearerToken;function en(){let e=G.getStore(),t=[...e?.sessionId===void 0?[]:[`${Ft}=${encodeURIComponent(e.sessionId)}`],...e?.traceName===void 0?[]:[`langfuse.trace.name=${encodeURIComponent(e.traceName)}`],...e?.traceTag===void 0?[]:[`langfuse.trace.tags=${encodeURIComponent(e.traceTag.map(encodeURIComponent).join(`,`))}`]].join(`,`);return{...e?.requestId===void 0?{}:{"X-Client-Request-Id":e.requestId},...e?.traceparent===void 0?{}:{traceparent:e.traceparent,tracestate:Pt,...t.length===0?{}:{baggage:t}}}}function tn(e,t){return G.run({...G.getStore(),requestId:e},t)}function nn(e,t){return G.run({...G.getStore(),userBearerToken:e},t)}function rn(e,t){return G.run({...G.getStore(),...e},t)}A({bodyPath:k(),valueField:T(A({path:T(k().nullable()).readonly(),type:E([`object`,`array`,`string`,`number`,`integer`,`boolean`]),nullable:D()})).readonly()});var K=C([w(``),k().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),an=x({readOperationId:k().min(1),writePointer:K,readPointer:K,readParameter:k().min(1).optional(),submittedMap:T(x({bodyPointer:K,readPointer:K,identityPointer:K})).min(1).optional()}),q=[`get`,`post`,`put`,`patch`,`delete`],on={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},sn=e=>on[e];function cn(e){let t=e.toLowerCase(),n=q.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var ln=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],un=x({name:k().regex(/^[A-Z][A-Z0-9_]*$/u)}),J=C([w(`private`),A({scope:k().optional(),value:k().optional()})]),Y=De(()=>A({$ref:k().optional(),description:k().optional(),type:C([k(),T(k())]).optional(),format:k().optional(),default:M.optional(),enum:T(M).optional(),"x-extensible-enum":T(M).optional(),"x-aventure-parsed-enum":D().optional(),readOnly:D().optional(),items:Y.optional(),minItems:O().int().nonnegative().optional(),maxItems:O().int().nonnegative().optional(),properties:S(k(),Y).optional(),required:T(k()).optional(),oneOf:T(Y).optional(),anyOf:T(Y).optional(),allOf:T(Y).optional(),propertyNames:Y.optional(),additionalProperties:C([Y,D()]).optional(),"x-aventure-visibility":J.optional(),"x-aventure-cli-conflicts":T(T(k().min(1)).min(2)).min(1).optional(),"x-aventure-env":un.optional(),"x-aventure-detail":w(!0).optional(),"x-aventure-operation-only":T(k().min(1)).min(1).optional()})),dn=A({in:k(),name:k(),required:D().optional(),description:k().optional(),schema:Y.optional(),"x-aventure-visibility":J.optional(),"x-aventure-legacy-name":x({name:k().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),fn=S(k(),A({schema:Y.optional()})),pn=A({description:k().optional(),content:fn.optional(),"x-aventure-standard-response":D().optional()}),mn=A({description:k().optional(),required:D().optional(),content:fn.optional()}),hn=x({auth:E([`none`,`read`]).optional(),mutates:D().optional()}).optional(),gn=k().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),_n=k().regex(/^[a-z][A-Za-z0-9]*$/u),vn=k().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),yn=x({command:gn,role:E(ln),summary:k().trim().min(1).optional(),description:k().trim().min(1).optional(),bodyOption:T(_n).min(1).optional(),localOption:T(x({optionKey:_n,flag:vn,description:k().trim().min(1)})).min(1).optional()}).superRefine((e,t)=>{let n=[e.bodyOption??[],(e.localOption??[]).map(e=>e.optionKey),(e.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),r=(e.localOption??[]).some(e=>new te(e.flag).attributeName()!==e.optionKey);(n||r)&&t.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),bn=A({operationId:k(),summary:k().optional(),description:k().optional(),tags:T(k()).optional(),deprecated:D().optional(),hidden:D().optional(),security:T(S(k(),T(k()))).optional(),parameters:T(dn).optional(),requestBody:mn.optional(),responses:S(k(),pn),"x-aventure-visibility":J.optional(),"x-aventure-tool":hn,"x-aventure-mutation-readback":an.optional(),"x-aventure-cli-composite":yn}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),xn=A(Object.fromEntries(q.map(e=>[e,bn.optional()]))),Sn=A({$ref:k().optional(),description:k().optional(),type:C([k(),T(k())]).optional(),format:k().optional(),default:M.optional(),enum:T(M).optional(),"x-extensible-enum":T(M).optional(),"x-aventure-parsed-enum":D().optional(),readOnly:D().optional(),items:Y.optional(),minItems:O().int().nonnegative().optional(),maxItems:O().int().nonnegative().optional(),oneOf:T(Y).optional(),anyOf:T(Y).optional(),allOf:T(Y).optional(),propertyNames:Y.optional(),additionalProperties:C([Y,D()]).optional(),properties:S(k(),Y).optional(),required:T(k()).optional(),"x-aventure-visibility":J.optional(),"x-aventure-cli-conflicts":T(T(k().min(1)).min(2)).min(1).optional(),"x-aventure-env":un.optional(),"x-aventure-detail":w(!0).optional(),"x-aventure-noun":x({one:k().trim().min(1),other:k().trim().min(1)}).optional()});A({info:A({description:k().optional()}).optional(),tags:T(A({name:k(),description:k().optional(),"x-aventure-cli":x({section:E([`researchData`,`account`,`administration`,`cli`])}).optional()})).optional(),paths:S(k(),xn),webhooks:S(k(),A({post:A({description:k(),requestBody:mn})})).optional(),components:A({schemas:S(k(),Sn)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of q){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&wn(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var Cn=new Set([`page`,`size`,`sort`]);function X(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function wn(e,t){for(let[n,r]of Object.entries(e))for(let e of q){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function Tn(e,t,n){let r=We(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&Ge(n,r))return{method:t,template:n,operation:e}}return null}function En(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function Dn(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function On(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||Cn.has(r.name))continue;let e=t?.[r.name]??kn(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function kn(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}var An=3e4;async function jn(e,t,n,r){let i=In(Z(e.requestBody?.content),n);if(!i.ok||i.data===null)return N(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return N(`Request body is required.`);if(a?.kind===`multipart`)return await Rn(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return j(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function Mn(e){if(typeof e!=`string`)return j(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return j(`Request body unchanged`,e);try{let t=M.safeParse(JSON.parse(e));if(!t.success)throw t.error;return j(`Request body parsed`,t.data)}catch(e){return N(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function Nn(e,t){let n=e?.schema;if(n===void 0)return!1;let r=X(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function Pn(e){return Z(e)[0]?.kind??`json`}function Fn(e){return e===void 0||Object.keys(e).length===0||Z(e).length>0}function Z(e){let t=Object.entries(e??{});return[...t.flatMap(e=>Xn(e[0])?[Ln(e,`json`)]:[]),...t.flatMap(e=>Zn(e[0])?[Ln(e,`multipart`)]:[])]}function In(e,t){if(t===void 0)return j(`Default request content selected`,e[0]);let n=Q(t),r=e.find(e=>Q(e.contentType)===n);return r===void 0?N(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):j(`Explicit request content selected`,r)}function Ln(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function Rn(e,t,n){if(!e&&n==null)return j(`Optional multipart body omitted`,{});let r=zn(n);if(!r.ok||r.data===null)return N(r.summary,r.warnings);let i=new FormData;for(let e of Bn(t)){let t=r.data[e.name];if(t==null){if(e.required)return N(`Multipart body requires '${e.name}'.`)}else{if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return N(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return N(`Multipart part '${e.name}' has too many entries.`);if(Vn(e.schema)||Hn(e.schema)){let n=Hn(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return N(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await Gn(t);if(!n.ok||n.data===null)return N(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(Un(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=Wn(i,e.name,t);if(!n.ok)return n}}}return j(`Multipart body prepared`,{body:i})}function zn(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return j(`Multipart input parsed`,t)}return N(`Multipart request body must be a JSON object keyed by form part name.`)}function Bn(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function Vn(e){return e.type===`string`&&e.format===`binary`}function Hn(e){return e.type===`array`&&e.items!==void 0&&Vn(e.items)}function Un(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function Wn(e,t,n){if(Array.isArray(n)){for(let r of n){let n=Wn(e,t,r);if(!n.ok)return n}return j(`Multipart scalar array appended`,null)}return typeof n==`object`?N(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),j(`Multipart scalar appended`,null))}async function Gn(e){return Jn(e)?Qt()===void 0?await Kn(e):N(`MCP media URL fetching is disabled. Pass the page as sourceUrl in the JSON body instead.`):Qt()===void 0?await qn(e):N(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function Kn(e){let t=new AbortController,n=setTimeout(()=>t.abort(),An);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return N(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??Yn(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return j(`URL media fetched`,{blob:a,filename:ke(n.pathname)||`upload`})}catch(e){return t.signal.aborted?N(`Failed to fetch media URL: timed out after ${An}ms.`):N(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function qn(e){try{let t=Yn(e)??``,n=await Me(e);return j(`File media read`,{blob:new Blob([n],{type:t}),filename:ke(e)})}catch(t){return N(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function Jn(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function Yn(e){return Qn[Ae(e).toLowerCase()]}function Xn(e){let t=Q(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function Zn(e){return Q(e)===`multipart/form-data`}var Q=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,Qn={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function $n(e,t,n){let r=new Map,i=(t,a,o)=>{let s=X(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=tr(e,t);for(let e of[...l.items===void 0?[]:[l.items],...l.oneOf??[],...l.anyOf??[],...l.allOf??[]])i(e,a,c);for(let[e,t]of Object.entries(l.properties??{}))r.set(e,Math.min(r.get(e)??a,a)),i(t,a+1,c)};for(let[e,n]of Object.entries(t))e.startsWith(`2`)&&i(er(n.content),0,[]);return r}function er(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function tr(e,t){let n=X(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function nr(e){if(e===`private`||typeof e==`object`&&(e.scope===`private`||e.value===`private`))return`private`}function rr(e){return e===`write`||e===`delete`}function ir(e){return rr(e)||e===`job`}function ar(e,t){return e===`DELETE`||t===`delete`}var or=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function sr(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function cr(e){let t=e.operation[`x-aventure-tool`];if(!mr(e.path,e.operation,e.method===`GET`&&t?.auth===`none`,e.includeBinary===!0))return null;let n=pr(e.operation.operationId),r=Tr(e.path,n),i=fr(r,n,e.method),a=lr(e.method,e.operation);if(a===null)return null;let o=t?.auth===`read`&&i===`write`?`lookup`:i,s=e.method===`GET`||a===`read`||a===`none`;return{resource:Er(e.path),intent:o,cliPath:r,scope:s&&!rr(o)?`read`:`write`,auth:a,visibility:nr(e.operation[`x-aventure-visibility`]),mutates:t?.mutates===!0||void 0,stdinBody:e.operation.requestBody!==void 0&&Pn(e.operation.requestBody.content)===`json`,destructive:ar(e.method,o)}}function lr(e,t){let n=t[`x-aventure-tool`]?.auth;if(n===`none`)return`none`;if(n===`read`)return`read`;if(e===`GET`&&(t.security?.length??0)===0)return`none`;let r=!1,i=!1,a=!1;for(let e of t.security??[]){let t=Object.keys(e);t.includes(`clientSecretAuth`)&&(r=!0),t.includes(`adminApiKeyAuth`)&&(a=!0),(t.includes(`bearerAuth`)||t.includes(`clerkApiKeyAuth`))&&(i=!0)}return e===`GET`&&r||r&&!a&&!i?`read`:a?`write`:i?`bearer`:e===`GET`?`read`:null}var ur={add:`write`,answer:`search`,ask:`search`,attach:`write`,audit:`read`,batch:`lookup`,convert:`write`,create:`write`,delete:`delete`,enrich:`write`,filter:`search`,get:`read`,import:`write`,join:`write`,list:`read`,lookup:`lookup`,merge:`write`,preview:`lookup`,reconcile:`write`,remove:`delete`,replace:`write`,resolve:`lookup`,search:`search`,status:`read`,suggest:`read`,update:`write`,upload:`write`},dr=`status`;function fr(e,t,n){if(e.length===1&&e[0]===dr)return`status`;let r=Object.hasOwn(ur,t)?ur[t]:void 0;return r===void 0?n===`GET`?`read`:n===`DELETE`?`delete`:`write`:r}function pr(e){let t=/^[a-z]+/u.exec(e)?.[0];if(t===void 0)throw Error(`operationId '${e}' has no verb`);return t}function mr(e,t,n,r){return hr(e)&&t.hidden!==!0&&(n||!gr.some(t=>t.test(e)))&&Fn(t.requestBody?.content)&&(xr(t.responses)||r&&br(t))}function hr(e){return e.startsWith(`/v1/`)||e.startsWith(`/v2/`)}var gr=[/^\/v1\/auth\/(?:session|login|ui|registrations|password-resets|cli-authorizations)(?:\/|$)/u,/^\/v1\/addresses\/locations(?:\/|$)/u,/^\/v1\/entities\/\{entityId\}\/sites$/u,/^\/v1\/(?:chat\/completions|embeddings)$/u,/^\/v1\/observability(?:\/|$)/u,/^\/v1\/media\/identicons(?:\/|$)/u];function _r(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}var vr=/(?:^|-)(?:runs|jobs)$/u;function yr(e){switch(e.intent){case`read`:case`lookup`:case`search`:case`status`:case`job`:return e.intent;case`write`:{let t=pr(e.operationId);return t===`enrich`||t===`create`&&vr.test(e.cliPath.at(-2)??``)?`job`:null}case`delete`:return null;default:{let t=e.intent;throw Error(`No public MCP intent for ${String(t)}`)}}}function br(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>wr(e.schema)))}function xr(e){return Object.entries(e).filter(([e])=>e.startsWith(`2`)).every(([,e])=>Sr(e.content))}function Sr(e){if(e===void 0)return!0;let t=Object.entries(e);return t.length===0||t.some(([e,t])=>Cr(e)&&!wr(t.schema))}function Cr(e){return e===`*/*`||e===`application/json`||e.endsWith(`+json`)}function wr(e){return e?.format===`byte`||e?.format===`binary`}function Tr(e,t){let n=kr(e).map($),r=n.length===1&&t===`get`&&!e.includes(`{`),i=n.some(e=>e.split(`-`).includes(t));return r||i?n:[...n,t]}function Er(e){return $(kr(e).at(0)??`system`)}function Dr(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Or=e=>`--${$(e)}`;function kr(e){return Ar(e).filter(e=>!jr(e)&&!Mr(e))}function Ar(e){return e.split(`/`).filter(e=>e.length>0)}function jr(e){return/^v\d+$/u.test(e)}function Mr(e){return e.startsWith(`{`)&&e.endsWith(`}`)}export{en as A,Yt as B,Dn as C,Tn as D,On as E,Ft as F,Xt as I,Zt as L,tn as M,rn as N,X as O,nn as P,Jt as R,En as S,cn as T,We as V,Z as _,sr as a,q as b,rr as c,$ as d,yr as f,jn as g,Mn as h,ir as i,$t as j,Qt as k,Dr as l,$n as m,ur as n,Or as o,cr as p,br as r,ar as s,or as t,_r as u,Nn as v,wn as w,sn as x,In as y,Gt as z};
|
|
1
|
+
import{A as e,O as t,S as n,_ as r,b as i,d as a,h as o,i as s,l as c,n as l,p as u,w as d,x as ee}from"./esm-BVGNzX-8.js";import{n as te}from"./commander-DEj7N1b9.js";import{$ as f,A as p,B as ne,C as re,D as ie,E as m,F as h,G as ae,L as oe,N as se,O as ce,U as le,V as ue,W as de,X as fe,Y as pe,Z as g,_t as me,at as he,ct as ge,gt as _e,it as ve,j as ye,k as _,mt as v,nt as be,pt as xe,rt as Se,s as Ce,st as y,tt as we,ut as b,vt as Te,w as Ee}from"./logging-BnHashoK.js";import{C as x,S,T as C,g as w,h as De,l as T,o as E,u as D,v as O,w as k,y as A}from"./person-owner-C0YuWKvY.js";import{c as j,p as M,r as N}from"./result-envelope-BKQSGfkH.js";import{a as Oe}from"./package-CZBWjlYb.js";import{basename as ke,extname as Ae}from"node:path";import{AsyncLocalStorage as je}from"node:async_hooks";import{readFile as Me}from"node:fs/promises";var Ne={name:`span`,countItems:e=>e.length},Pe=256,Fe=512;function Ie(e,t){let n=e&255|Pe;return t&&(n|=Fe),n}function Le(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:_(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ze(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Re(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ie(n.traceFlags,e.parentSpanContext?.isRemote)}}function Re(e,t){return{attributes:e.attributes?_(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ie(e.context.traceFlags,e.context.isRemote)}}function ze(e,t){return{attributes:e.attributes?_(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Be(e,t){return{resourceSpans:He(e,t)}}function Ve(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function He(e,t){let n=Ve(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Le(e,t));o.push({scope:ie(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ce(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}l();var Ue={serializeRequest:e=>{let t=Be(e,m);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return c.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};we(),h(),p();function We(e){return new URL(e,`https://placeholder.invalid`).pathname}function Ge(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(qe)?!1:n.every((e,t)=>Ke(e)||e===r[t])}function Ke(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function qe(e){if(Ke(e))return!0;let t=e.toLowerCase(),n=e.slice(3,-3);return t.startsWith(`%7b`)&&t.endsWith(`%7d`)&&n.length>0&&!n.includes(`/`)&&!n.includes(`%`)&&!n.includes(`{`)&&!n.includes(`}`)}var Je=`otlp_http_span_exporter`,Ye=class extends Te{constructor(e={}){super(Ee(re(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),Ue,Je,Ne,e.selfObsMeterProvider))}},Xe=`exception`,Ze=Symbol.for(`nodejs.util.inspect.custom`);function Qe(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function $e(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}l();var et=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:u.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=f.now(),this._performanceOffset=t-(this._performanceStartTime+f.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return c.warn(`Invalid attribute key: ${e}`),this;if(!xe(t))return c.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return c.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&c.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),pe(t)&&(pe(n)||(n=t),t=void 0);let i=v(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,l=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&l>=a?s++:(o[e]=this._truncateToSize(t),l++)}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&c.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=v(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];n!==void 0&&o>=n?a++:(i[e]=this._truncateToSize(t),o++)}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===u.UNSET||this.status.code===u.OK)return this;let t={code:e.code};return e.code===u.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&c.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?c.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=ae(this.startTime,this.endTime),this._duration[0]<0&&(c.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&c.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&c.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){if(typeof e==`number`&&e<=f.now())return de(e+this._performanceOffset);if(typeof e==`number`)return g(e);if(e instanceof Date)return g(e.getTime());if(fe(e))return e;if(this._startTimeProvided)return g(Date.now());let t=f.now()-this._performanceStartTime;return le(this.startTime,g(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Se]=e:e&&(e.code?n[he]=e.code.toString():e.name&&(n[he]=e.name),e.message&&(n[Se]=e.message),e.stack&&(n[ve]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Xe,n,t):c.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);c.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(c.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Ze](e,t,n){return $e(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Qe(this.resource)}},e,t,n)}},P;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(P||={});var tt=`otel.component.name`,nt=`otel.component.type`,rt=`otel.span.parent.origin`,it=`otel.span.sampling_result`,at=`otel.sdk.processor.span.processed`,ot=`otel.sdk.processor.span.queue.capacity`,st=`otel.sdk.processor.span.queue.size`,ct=`otel.sdk.span.live`,lt=`otel.sdk.span.started`,ut=`batching_span_processor`,dt=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(lt,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ct,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pt(t);if(this.startedSpans.add(1,{[rt]:ft(e),[it]:n}),t===P.NOT_RECORD)return()=>{};let r={[it]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ft(e){return e?e.isRemote?`remote`:`local`:`none`}function pt(e){switch(e){case P.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case P.RECORD:return`RECORD_ONLY`;case P.NOT_RECORD:return`DROP`}}var mt=`2.11.0`;l(),h();var ht=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,mt);this._tracerMetrics=new dt(n)}startSpan(e,t={},i=a.active()){t.root&&(i=s.deleteSpan(i));let l=s.getSpan(i);if(_e(i))return c.debug(`Instrumentation suppressed, returning Noop Span`),s.wrapSpanContext(n);let u=l?.spanContext(),ee=this._idGenerator.generateSpanId(),te,f,p;!u||!s.isSpanContextValid(u)?f=this._idGenerator.generateTraceId():(f=u.traceId,p=u.traceState,te=u);let ne=t.kind??o.INTERNAL,re=(t.links??[]).map(e=>({context:e.context,attributes:v(e.attributes)})),ie=v(t.attributes),m=this._sampler.shouldSample(i,f,e,ne,ie,re),h=this._tracerMetrics.startSpan(u,m.decision);p=m.traceState??p;let ae=m.decision===r.RECORD_AND_SAMPLED?d.SAMPLED:d.NONE,oe={traceId:f,spanId:ee,traceFlags:ae,traceState:p};if(m.decision===r.NOT_RECORD)return c.debug(`Recording is off, propagating context in a non-recording span`),s.wrapSpanContext(oe);let se=v(Object.assign(ie,m.attributes));return new et({resource:this._resource,scope:this.instrumentationScope,context:i,spanContext:oe,name:e,kind:ne,links:re,parentSpanContext:te,attributes:se,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,t,n,r){let i,o,c;if(arguments.length<2)return;arguments.length===2?c=t:arguments.length===3?(i=t,c=n):(i=t,o=n,c=r);let l=o??a.active(),u=this.startSpan(e,i,l),d=s.setSpan(l,u);return a.with(d,c,void 0,u)}[Ze](e,t,n){return $e(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Qe(this._resource)},spanLimits:this._spanLimits},e,t,n)}};h();var gt=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{b(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},F=class{shouldSample(){return{decision:P.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},I=class{shouldSample(){return{decision:P.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};l(),h();var L=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(b(Error(`ParentBasedSampler must have a root sampler configured`)),new I),this._remoteParentSampled=e.remoteParentSampled??new I,this._remoteParentNotSampled=e.remoteParentNotSampled??new F,this._localParentSampled=e.localParentSampled??new I,this._localParentNotSampled=e.localParentNotSampled??new F}shouldSample(e,t,n,r,a,o){let c=s.getSpanContext(e);return!c||!i(c)?this._root.shouldSample(e,t,n,r,a,o):c.isRemote?c.traceFlags&d.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,a,o):this._remoteParentNotSampled.shouldSample(e,t,n,r,a,o):c.traceFlags&d.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,a,o):this._localParentNotSampled.shouldSample(e,t,n,r,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};we();var _t=new Map,vt=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=_t.get(e)??0;if(_t.set(e,r+1),this.standardAttrs={[nt]:e,[tt]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[be]:`queue_full`},this.processedSpans=t.createCounter(at,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(ot,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(st,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[be]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};l(),h();var yt=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new oe(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(c.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let n=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):t();this._metrics=new vt(ut,n,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&d.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(this._droppedSpansCount===0&&c.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1)):(this._droppedSpansCount>0&&(c.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);a.with(me(a.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===ue.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{b(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,b(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},bt=class extends yt{onShutdown(){}},xt=8,St=16,Ct=class{generateTraceId=wt(St);generateSpanId=wt(xt)},R=Buffer.allocUnsafe(St);function wt(e){return function(){for(let t=0;t<e/4;t++)R.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(R[t]>0);t++)t===e-1&&(R[e-1]=1);return R.toString(`hex`,0,e)}}l();var z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(z||={});var Tt=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??ye();let n=e.spanProcessors??[];this._activeSpanProcessor=new gt(n),this._tracerOptions={resource:this._resource,sampler:e.sampler??new L({root:new I}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Ct,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return t()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new ht({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(e){let t=e?.timeoutMillis??this._forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${t} ms`)),r=z.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==z.timeout&&(r=z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=z.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==z.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ze](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return $e(`TracerProvider`,{resource:{attributes:Qe(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};l();var Et=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ee(t)&&this._accumulate(t)<this._upperBound?P.RECORD_AND_SAMPLED:P.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};l(),h();var B;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(B||={});var V=1;function Dt(){return{sampler:Ot(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:y(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:y(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:y(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:y(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:y(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:y(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:y(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:y(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Ot(){let e=ge(`OTEL_TRACES_SAMPLER`)??B.ParentBasedAlwaysOn;switch(e){case B.AlwaysOn:return new I;case B.AlwaysOff:return new F;case B.ParentBasedAlwaysOn:return new L({root:new I});case B.ParentBasedAlwaysOff:return new L({root:new F});case B.TraceIdRatio:return new Et(kt());case B.ParentBasedTraceIdRatio:return new L({root:new Et(kt())});default:return c.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${B.ParentBasedAlwaysOn}".`),new L({root:new I})}}function kt(){let e=y(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(c.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${V}.`),V):e<0||e>1?(c.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${V}.`),V):e}h();function At(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??y(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??y(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??y(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??y(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}h();var jt=class extends Tt{constructor(e={}){let t=ne({},Dt(),At(e));delete t.generalLimits,super(t)}};h();var Mt=class extends bt{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=y(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};l(),p();var Nt=`aventure-mcp-server`,Pt=`aventure=mcp`,Ft=`langfuse.session.id`,It=`/api/public/otel/v1/traces`,Lt=5e3,Rt=new Set([`langfuse.observation.input`,`langfuse.observation.output`,`langfuse.observation.status_message`]),zt=[`OTEL_EXPORTER_OTLP_HEADERS`,`OTEL_EXPORTER_OTLP_TRACES_HEADERS`],H,U;function W(e){return e?.trim()||void 0}function Bt(){return W(process.env.GIT_SHA)??W(process.env.SENTRY_RELEASE)??Oe().version}function Vt(){let e=W(process.env.LANGFUSE_BASE_URL),t=W(process.env.LANGFUSE_PUBLIC_KEY),n=W(process.env.LANGFUSE_SECRET_KEY);if(e!==void 0&&t!==void 0&&n!==void 0){for(let e of zt){let t=(process.env[e]??``).split(`,`).map(e=>e.split(`=`,1)[0]?.trim().toLowerCase()??``).filter(e=>e!==``&&e!==`authorization`);if(t.length>0)throw Error(`${e} sets ${t.join(`, `)}, which the Langfuse trace exporter would forward`)}return new Ye({url:new URL(It,e).href,headers:{Authorization:`Basic ${Buffer.from(`${t}:${n}`).toString(`base64`)}`,"x-langfuse-ingestion-version":`4`},timeoutMillis:Lt})}}function Ht(e){let t={};for(let[n,r]of Object.entries(e.attributes))Rt.has(n)||(t[n]=r);return{name:e.name,kind:e.kind,spanContext:()=>e.spanContext(),...e.parentSpanContext===void 0?{}:{parentSpanContext:e.parentSpanContext},startTime:e.startTime,endTime:e.endTime,status:e.status,attributes:t,links:e.links,events:e.events,duration:e.duration,ended:e.ended,resource:e.resource,instrumentationScope:e.instrumentationScope,droppedAttributesCount:e.droppedAttributesCount,droppedEventsCount:e.droppedEventsCount,droppedLinksCount:e.droppedLinksCount}}function Ut(e){return{export:(t,n)=>e.export(t.map(Ht),n),shutdown:()=>e.shutdown(),forceFlush:()=>e.forceFlush?.()??Promise.resolve()}}function Wt(){if(H!==void 0)return U;let e=W(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),t=[...e===void 0?[]:[Ut(new Ye({url:e,timeoutMillis:Lt}))],...[Vt()].filter(e=>e!==void 0)];return H=new jt({sampler:new I,resource:se({...Ce(),"service.version":Bt()}),spanProcessors:t.map(e=>new Mt(e,{exportTimeoutMillis:Lt}))}),U=t.length===0?void 0:H.getTracer(Nt),U}function Gt(){Wt()}var Kt=/^00-(?<traceId>[0-9a-f]{32})-(?<spanId>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})$/u,qt=/[13579bdf]$/u;function Jt(t,n,r){let i=Wt();if(i===void 0)return;let a=Kt.exec(r??``)?.groups,c=a?.traceId===void 0||a.spanId===void 0?e:s.setSpanContext(e,{traceId:a.traceId,spanId:a.spanId,traceFlags:qt.test(a.flags??``)?d.SAMPLED:d.NONE,isRemote:!0});return i.startSpan(t,{kind:o.SERVER,attributes:{"langfuse.trace.name":t,...n,"langfuse.environment":Ce()[`deployment.environment.name`],"langfuse.release":Bt()}},c)}function Yt(e){let{traceId:t,spanId:n,traceFlags:r}=e.spanContext();return`00-${t}-${n}-${(r&d.SAMPLED)===0?`00`:`01`}`}function Xt(e,t,n){e.setAttributes(t),e.setStatus({code:n?u.ERROR:u.OK}),e.end()}async function Zt(){let e=H;H=void 0,U=void 0,await e?.shutdown()}var G=new je,Qt=()=>G.getStore()?.requestId,$t=()=>G.getStore()?.userBearerToken;function en(){let e=G.getStore(),t=[...e?.sessionId===void 0?[]:[`${Ft}=${encodeURIComponent(e.sessionId)}`],...e?.traceName===void 0?[]:[`langfuse.trace.name=${encodeURIComponent(e.traceName)}`],...e?.traceTag===void 0?[]:[`langfuse.trace.tags=${encodeURIComponent(e.traceTag.map(encodeURIComponent).join(`,`))}`]].join(`,`);return{...e?.requestId===void 0?{}:{"X-Client-Request-Id":e.requestId},...e?.traceparent===void 0?{}:{traceparent:e.traceparent,tracestate:Pt,...t.length===0?{}:{baggage:t}}}}function tn(e,t){return G.run({...G.getStore(),requestId:e},t)}function nn(e,t){return G.run({...G.getStore(),userBearerToken:e},t)}function rn(e,t){return G.run({...G.getStore(),...e},t)}A({bodyPath:k(),valueField:T(A({path:T(k().nullable()).readonly(),type:E([`object`,`array`,`string`,`number`,`integer`,`boolean`]),nullable:D()})).readonly()});var K=C([w(``),k().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),an=x({readOperationId:k().min(1),writePointer:K,readPointer:K,readParameter:k().min(1).optional(),submittedMap:T(x({bodyPointer:K,readPointer:K,identityPointer:K})).min(1).optional()}),q=[`get`,`post`,`put`,`patch`,`delete`],on={get:`GET`,post:`POST`,put:`PUT`,patch:`PATCH`,delete:`DELETE`},sn=e=>on[e];function cn(e){let t=e.toLowerCase(),n=q.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var ln=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],un=x({name:k().regex(/^[A-Z][A-Z0-9_]*$/u)}),J=C([w(`private`),A({scope:k().optional(),value:k().optional()})]),Y=De(()=>A({$ref:k().optional(),description:k().optional(),type:C([k(),T(k())]).optional(),format:k().optional(),default:M.optional(),enum:T(M).optional(),"x-extensible-enum":T(M).optional(),"x-aventure-parsed-enum":D().optional(),readOnly:D().optional(),items:Y.optional(),minItems:O().int().nonnegative().optional(),maxItems:O().int().nonnegative().optional(),properties:S(k(),Y).optional(),required:T(k()).optional(),oneOf:T(Y).optional(),anyOf:T(Y).optional(),allOf:T(Y).optional(),propertyNames:Y.optional(),additionalProperties:C([Y,D()]).optional(),"x-aventure-visibility":J.optional(),"x-aventure-cli-conflicts":T(T(k().min(1)).min(2)).min(1).optional(),"x-aventure-env":un.optional(),"x-aventure-detail":w(!0).optional(),"x-aventure-operation-only":T(k().min(1)).min(1).optional()})),dn=A({in:k(),name:k(),required:D().optional(),description:k().optional(),schema:Y.optional(),"x-aventure-visibility":J.optional(),"x-aventure-legacy-name":x({name:k().trim().min(1)}).optional()}).superRefine((e,t)=>{let n=e[`x-aventure-legacy-name`]?.name;n!==void 0&&(e.in!==`path`&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`],message:`x-aventure-legacy-name is valid only for path parameters`}),n===e.name&&t.addIssue({code:`custom`,path:[`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name must differ from its canonical name`}))}),fn=S(k(),A({schema:Y.optional()})),pn=A({description:k().optional(),content:fn.optional(),"x-aventure-standard-response":D().optional()}),mn=A({description:k().optional(),required:D().optional(),content:fn.optional()}),hn=x({auth:E([`none`,`read`]).optional(),mutates:D().optional()}).optional(),gn=k().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),_n=k().regex(/^[a-z][A-Za-z0-9]*$/u),vn=k().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),yn=x({command:gn,role:E(ln),summary:k().trim().min(1).optional(),description:k().trim().min(1).optional(),bodyOption:T(_n).min(1).optional(),localOption:T(x({optionKey:_n,flag:vn,description:k().trim().min(1)})).min(1).optional()}).superRefine((e,t)=>{let n=[e.bodyOption??[],(e.localOption??[]).map(e=>e.optionKey),(e.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),r=(e.localOption??[]).some(e=>new te(e.flag).attributeName()!==e.optionKey);(n||r)&&t.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),bn=A({operationId:k(),summary:k().optional(),description:k().optional(),tags:T(k()).optional(),deprecated:D().optional(),hidden:D().optional(),security:T(S(k(),T(k()))).optional(),parameters:T(dn).optional(),requestBody:mn.optional(),responses:S(k(),pn),"x-aventure-visibility":J.optional(),"x-aventure-tool":hn,"x-aventure-mutation-readback":an.optional(),"x-aventure-cli-composite":yn}).superRefine((e,t)=>{let n=e.parameters??[];for(let[e,r]of n.entries()){let i=r[`x-aventure-legacy-name`]?.name;r.in===`path`&&i!==void 0&&n.some((t,n)=>n!==e&&t.in===`path`&&(t.name===i||t[`x-aventure-legacy-name`]?.name===i))&&t.addIssue({code:`custom`,path:[`parameters`,e,`x-aventure-legacy-name`,`name`],message:`Legacy path parameter name '${i}' collides with another declared path parameter`})}}),xn=A(Object.fromEntries(q.map(e=>[e,bn.optional()]))),Sn=A({$ref:k().optional(),description:k().optional(),type:C([k(),T(k())]).optional(),format:k().optional(),default:M.optional(),enum:T(M).optional(),"x-extensible-enum":T(M).optional(),"x-aventure-parsed-enum":D().optional(),readOnly:D().optional(),items:Y.optional(),minItems:O().int().nonnegative().optional(),maxItems:O().int().nonnegative().optional(),oneOf:T(Y).optional(),anyOf:T(Y).optional(),allOf:T(Y).optional(),propertyNames:Y.optional(),additionalProperties:C([Y,D()]).optional(),properties:S(k(),Y).optional(),required:T(k()).optional(),"x-aventure-visibility":J.optional(),"x-aventure-cli-conflicts":T(T(k().min(1)).min(2)).min(1).optional(),"x-aventure-env":un.optional(),"x-aventure-detail":w(!0).optional(),"x-aventure-noun":x({one:k().trim().min(1),other:k().trim().min(1)}).optional()});A({info:A({description:k().optional()}).optional(),tags:T(A({name:k(),description:k().optional(),"x-aventure-cli":x({section:E([`researchData`,`account`,`administration`,`cli`])}).optional()})).optional(),paths:S(k(),xn),webhooks:S(k(),A({post:A({description:k(),requestBody:mn})})).optional(),components:A({schemas:S(k(),Sn)})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of q){let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&wn(e.paths,a.readOperationId)===null&&t.addIssue({code:`custom`,path:[`paths`,n,i,`x-aventure-mutation-readback`,`readOperationId`],message:`mutation readback names '${a.readOperationId}', which no operation in this document emits`})}});var Cn=new Set([`page`,`size`,`sort`]);function X(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0?e.$ref.slice(21):void 0}function wn(e,t){for(let[n,r]of Object.entries(e))for(let e of q){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function Tn(e,t,n){let r=We(n),i=e[r]?.[t];if(i)return{method:t,template:r,operation:i};for(let[n,i]of Object.entries(e)){let e=i[t];if(e&&Ge(n,r))return{method:t,template:n,operation:e}}return null}function En(e,t,n=e){return e.replace(/\{([^}]+)}/g,(...e)=>{let r=e[1],i=t[r];if(i==null)throw Error(`Missing path parameter '${r}' for ${n}`);return encodeURIComponent(String(i))})}function Dn(e,t,n){let r=t;for(let i of e.parameters??[]){let e=i[`x-aventure-legacy-name`]?.name;if(i.in!==`path`||e===void 0)continue;let a=t[e];if(Object.hasOwn(t,e)&&a!==void 0){if(Object.hasOwn(t,i.name))throw Error(`Path parameters '${i.name}' and legacy alias '${e}' were both supplied for ${n}`);r===t&&(r={...t}),r[i.name]=a,delete r[e]}}return r}function On(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||Cn.has(r.name))continue;let e=t?.[r.name]??kn(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}function kn(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||Array.isArray(e)&&e.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return e}var An=3e4;async function jn(e,t,n,r){let i=In(Z(e.requestBody?.content),n);if(!i.ok||i.data===null)return N(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return N(`Request body is required.`);if(a?.kind===`multipart`)return await Rn(e.requestBody?.required===!0,a.schema,t);let o=a?.contentType??r;return j(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function Mn(e){if(typeof e!=`string`)return j(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return j(`Request body unchanged`,e);try{let t=M.safeParse(JSON.parse(e));if(!t.success)throw t.error;return j(`Request body parsed`,t.data)}catch(e){return N(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function Nn(e,t){let n=e?.schema;if(n===void 0)return!1;let r=X(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function Pn(e){return Z(e)[0]?.kind??`json`}function Fn(e){return e===void 0||Object.keys(e).length===0||Z(e).length>0}function Z(e){let t=Object.entries(e??{});return[...t.flatMap(e=>Xn(e[0])?[Ln(e,`json`)]:[]),...t.flatMap(e=>Zn(e[0])?[Ln(e,`multipart`)]:[])]}function In(e,t){if(t===void 0)return j(`Default request content selected`,e[0]);let n=Q(t),r=e.find(e=>Q(e.contentType)===n);return r===void 0?N(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):j(`Explicit request content selected`,r)}function Ln(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function Rn(e,t,n){if(!e&&n==null)return j(`Optional multipart body omitted`,{});let r=zn(n);if(!r.ok||r.data===null)return N(r.summary,r.warnings);let i=new FormData;for(let e of Bn(t)){let t=r.data[e.name];if(t==null){if(e.required)return N(`Multipart body requires '${e.name}'.`)}else{if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return N(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return N(`Multipart part '${e.name}' has too many entries.`);if(Vn(e.schema)||Hn(e.schema)){let n=Hn(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return N(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await Gn(t);if(!n.ok||n.data===null)return N(n.summary,n.warnings);i.append(e.name,n.data.blob,n.data.filename)}}else if(Un(e.schema,t)){let n=JSON.stringify(t);i.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=Wn(i,e.name,t);if(!n.ok)return n}}}return j(`Multipart body prepared`,{body:i})}function zn(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return j(`Multipart input parsed`,t)}return N(`Multipart request body must be a JSON object keyed by form part name.`)}function Bn(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function Vn(e){return e.type===`string`&&e.format===`binary`}function Hn(e){return e.type===`array`&&e.items!==void 0&&Vn(e.items)}function Un(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function Wn(e,t,n){if(Array.isArray(n)){for(let r of n){let n=Wn(e,t,r);if(!n.ok)return n}return j(`Multipart scalar array appended`,null)}return typeof n==`object`?N(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),j(`Multipart scalar appended`,null))}async function Gn(e){return Jn(e)?Qt()===void 0?await Kn(e):N(`MCP media URL fetching is disabled. Pass the page as sourceUrl in the JSON body instead.`):Qt()===void 0?await qn(e):N(`MCP callers cannot upload local files: pass an http(s) URL as the multipart part, or send media by sourceUrl in a JSON body. Local file paths are CLI-only.`)}async function Kn(e){let t=new AbortController,n=setTimeout(()=>t.abort(),An);try{let n=new URL(e),r=await fetch(e,{signal:t.signal});if(!r.ok)return N(`Failed to fetch media URL: ${r.status} ${r.statusText}`);let i=r.headers.get(`content-type`)?.split(`;`)[0]?.trim()??Yn(n.pathname)??``,a=new Blob([await r.arrayBuffer()],{type:i});return j(`URL media fetched`,{blob:a,filename:ke(n.pathname)||`upload`})}catch(e){return t.signal.aborted?N(`Failed to fetch media URL: timed out after ${An}ms.`):N(`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`)}finally{clearTimeout(n)}}async function qn(e){try{let t=Yn(e)??``,n=await Me(e);return j(`File media read`,{blob:new Blob([n],{type:t}),filename:ke(e)})}catch(t){return N(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function Jn(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function Yn(e){return Qn[Ae(e).toLowerCase()]}function Xn(e){let t=Q(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function Zn(e){return Q(e)===`multipart/form-data`}var Q=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,Qn={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function $n(e,t,n){let r=new Map,i=(t,a,o)=>{let s=X(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=tr(e,t);for(let e of[...l.items===void 0?[]:[l.items],...l.oneOf??[],...l.anyOf??[],...l.allOf??[]])i(e,a,c);for(let[e,t]of Object.entries(l.properties??{}))r.set(e,Math.min(r.get(e)??a,a)),i(t,a+1,c)};for(let[e,n]of Object.entries(t))e.startsWith(`2`)&&i(er(n.content),0,[]);return r}function er(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function tr(e,t){let n=X(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function nr(e){if(e===`private`||typeof e==`object`&&(e.scope===`private`||e.value===`private`))return`private`}function rr(e){return e===`write`||e===`delete`}function ir(e){return rr(e)||e===`job`}function ar(e,t){return e===`DELETE`||t===`delete`}var or=`Shell-safe input: single-quote string flag values that contain $; use --from-file or stdin for JSON bodies, multiline text, and free text with currency amounts.`;function sr(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function cr(e){let t=e.operation[`x-aventure-tool`];if(!mr(e.path,e.operation,e.method===`GET`&&t?.auth===`none`,e.includeBinary===!0))return null;let n=pr(e.operation.operationId),r=Tr(e.path,n),i=fr(r,n,e.method),a=lr(e.method,e.operation);if(a===null)return null;let o=t?.auth===`read`&&i===`write`?`lookup`:i,s=e.method===`GET`||a===`read`||a===`none`;return{resource:Er(e.path),intent:o,cliPath:r,scope:s&&!rr(o)?`read`:`write`,auth:a,visibility:nr(e.operation[`x-aventure-visibility`]),mutates:t?.mutates===!0||void 0,stdinBody:e.operation.requestBody!==void 0&&Pn(e.operation.requestBody.content)===`json`,destructive:ar(e.method,o)}}function lr(e,t){let n=t[`x-aventure-tool`]?.auth;if(n===`none`)return`none`;if(n===`read`)return`read`;if(e===`GET`&&(t.security?.length??0)===0)return`none`;let r=!1,i=!1,a=!1;for(let e of t.security??[]){let t=Object.keys(e);t.includes(`clientSecretAuth`)&&(r=!0),t.includes(`adminApiKeyAuth`)&&(a=!0),(t.includes(`bearerAuth`)||t.includes(`clerkApiKeyAuth`))&&(i=!0)}return e===`GET`&&r||r&&!a&&!i?`read`:a?`write`:i?`bearer`:e===`GET`?`read`:null}var ur={add:`write`,answer:`search`,ask:`search`,attach:`write`,audit:`read`,batch:`lookup`,convert:`write`,create:`write`,delete:`delete`,enrich:`write`,filter:`search`,get:`read`,import:`write`,join:`write`,list:`read`,lookup:`lookup`,merge:`write`,preview:`lookup`,reconcile:`write`,remove:`delete`,replace:`write`,resolve:`lookup`,search:`search`,status:`read`,suggest:`read`,update:`write`,upload:`write`},dr=`status`;function fr(e,t,n){if(e.length===1&&e[0]===dr)return`status`;let r=Object.hasOwn(ur,t)?ur[t]:void 0;return r===void 0?n===`GET`?`read`:n===`DELETE`?`delete`:`write`:r}function pr(e){let t=/^[a-z]+/u.exec(e)?.[0];if(t===void 0)throw Error(`operationId '${e}' has no verb`);return t}function mr(e,t,n,r){return hr(e)&&t.hidden!==!0&&(n||!gr.some(t=>t.test(e)))&&Fn(t.requestBody?.content)&&(xr(t.responses)||r&&br(t))}function hr(e){return e.startsWith(`/v1/`)||e.startsWith(`/v2/`)}var gr=[/^\/v1\/auth\/(?:session|login|ui|registrations|password-resets|cli-authorizations)(?:\/|$)/u,/^\/v1\/addresses\/locations(?:\/|$)/u,/^\/v1\/entities\/\{entityId\}\/sites$/u,/^\/v1\/(?:chat\/completions|embeddings)$/u,/^\/v1\/observability(?:\/|$)/u,/^\/v1\/media\/identicons(?:\/|$)/u];function _r(e){return e!==`/v1/auth/api-key`&&!/^\/v1\/sitemap(?:\/|$)/u.test(e)}var vr=/(?:^|-)(?:runs|jobs)$/u;function yr(e){switch(e.intent){case`read`:case`lookup`:case`search`:case`status`:case`job`:return e.intent;case`write`:{let t=pr(e.operationId);return t===`enrich`||t===`create`&&vr.test(e.cliPath.at(-2)??``)?`job`:null}case`delete`:return null;default:{let t=e.intent;throw Error(`No public MCP intent for ${String(t)}`)}}}function br(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>Object.values(e.content??{}).some(e=>wr(e.schema)))}function xr(e){return Object.entries(e).filter(([e])=>e.startsWith(`2`)).every(([,e])=>Sr(e.content))}function Sr(e){if(e===void 0)return!0;let t=Object.entries(e);return t.length===0||t.some(([e,t])=>Cr(e)&&!wr(t.schema))}function Cr(e){return e===`*/*`||e===`application/json`||e.endsWith(`+json`)}function wr(e){return e?.format===`byte`||e?.format===`binary`}function Tr(e,t){let n=kr(e).map($),r=n.length===1&&t===`get`&&!e.includes(`{`),i=n.some(e=>e.split(`-`).includes(t));return r||i?n:[...n,t]}function Er(e){return $(kr(e).at(0)??`system`)}function Dr(e){return`aventure_${e}`}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Or=e=>`--${$(e)}`;function kr(e){return Ar(e).filter(e=>!jr(e)&&!Mr(e))}function Ar(e){return e.split(`/`).filter(e=>e.length>0)}function jr(e){return/^v\d+$/u.test(e)}function Mr(e){return e.startsWith(`{`)&&e.endsWith(`}`)}export{en as A,Yt as B,Dn as C,Tn as D,On as E,Ft as F,Xt as I,Zt as L,tn as M,rn as N,X as O,nn as P,Jt as R,En as S,cn as T,We as V,Z as _,sr as a,q as b,rr as c,$ as d,yr as f,jn as g,Mn as h,ir as i,$t as j,Qt as k,Dr as l,$n as m,ur as n,Or as o,cr as p,br as r,ar as s,or as t,_r as u,Nn as v,wn as w,sn as x,In as y,Gt as z};
|