@aventurevc/mcp-server 0.8.284 → 0.8.286

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.
Files changed (24) hide show
  1. package/dist/chunks/{cli-help-policy-tMe5BBlw.js → cli-help-policy-BB_tvwV5.js} +1 -1
  2. package/dist/chunks/{contract-CPpGo8Ro.js → contract-BIbN8zfH.js} +1 -1
  3. package/dist/chunks/{contract-parameter-NIOpC0He.js → contract-parameter-vSu_ZE57.js} +1 -1
  4. package/dist/chunks/{env-DiNizPjg.js → env-CXx2XZBl.js} +1 -1
  5. package/dist/chunks/{env-CrYASQ1v.js → env-D4lMZw-8.js} +1 -1
  6. package/dist/chunks/{help-catalog-D4kW0PxM.js → help-catalog-CvfEYwPL.js} +1 -1
  7. package/dist/chunks/{help-intent-Di40YmYo.js → help-intent-i4bvvWxC.js} +1 -1
  8. package/dist/chunks/{logging-DD34lxAA.js → logging-BFASdeBx.js} +1 -1
  9. package/dist/chunks/{logging-DFc_SC4o.js → logging-CD850a3X.js} +1 -1
  10. package/dist/chunks/{oauth-discovery-DJHuzqON.js → oauth-discovery-TFMijsxD.js} +1 -1
  11. package/dist/chunks/{openapi-call-CynmRaOR.js → openapi-call-CpON5wqD.js} +1 -1
  12. package/dist/chunks/openapi-snapshot.json +1 -1
  13. package/dist/chunks/{output-spill-CuxMluVh.js → output-spill-D9G-tWU9.js} +1 -1
  14. package/dist/chunks/{request-replay-DBuUqlOk.js → request-replay-CxaD7_FL.js} +1 -1
  15. package/dist/chunks/{response-problem-BgAZ5GyP.js → response-problem-TCwoXCAT.js} +1 -1
  16. package/dist/chunks/result-envelope-Dy-nSLrT.js +1 -0
  17. package/dist/chunks/{sentry-C6l5JpDi.js → sentry-CoBZwrPY.js} +1 -1
  18. package/dist/chunks/{sentry-CYGpefm8.js → sentry-DCq0eQ69.js} +1 -1
  19. package/dist/chunks/{streamable-http-DLrhql6w.js → streamable-http-BfelvD1R.js} +1 -1
  20. package/dist/chunks/{text-response-DnoN8rt_.js → text-response-rnWTbgBC.js} +1 -1
  21. package/dist/chunks/{tool-policy-RKAlV7ov.js → tool-policy-WURn1WGx.js} +1 -1
  22. package/dist/mcp-server/index.js +1 -1
  23. package/package.json +3 -3
  24. package/dist/chunks/result-envelope-DhrdupDO.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./result-envelope-DhrdupDO.js";import{dirname as t}from"node:path";import{mkdirSync as n,writeFileSync as r}from"node:fs";import{Buffer as i}from"node:buffer";var a;function o(e){a=e}function s(){return a}function c(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function l(o){let s=a;if(s===void 0)return o;a=void 0;let l=o.data,d=o.ok?l instanceof Uint8Array?l:typeof l==`string`?i.from(l,`utf8`):u(c(l)):u(o);try{n(t(s),{recursive:!0}),r(s,d)}catch(t){return e(`could not spill output to '${s}'`,[String(t)])}if(!o.ok)return o;if(typeof l!=`object`||!l||l instanceof Uint8Array||c(l)===l)return{...o,data:`spilled ${d.byteLength} bytes to '${s}'`};let f=c(l),p,m=!1;if(typeof f==`object`&&f&&!Array.isArray(f)&&!(`content`in f&&Array.isArray(f.content))&&!(`score`in f)&&!(`id`in f&&`core`in f)){m=`core`in f;let e=`core`in f?Object.hasOwn(f,`core`)?f.core:void 0:f;typeof e==`object`&&e&&!Array.isArray(e)&&`id`in e&&Object.hasOwn(e,`id`)&&(typeof e.id==`string`||typeof e.id==`number`&&Number.isSafeInteger(e.id))&&(p=e.id)}return{...o,data:{...l,response:{spilledTo:s,byteLength:d.byteLength,...o.httpStatus===void 0?{}:{httpStatus:o.httpStatus},...p===void 0?{}:m?{core:{id:p}}:{id:p}}}}}function u(e){return i.from(JSON.stringify(e,null,2),`utf8`)}export{l as i,s as n,c as r,o as t};
1
+ import{r as e}from"./result-envelope-Dy-nSLrT.js";import{dirname as t}from"node:path";import{mkdirSync as n,writeFileSync as r}from"node:fs";import{Buffer as i}from"node:buffer";var a;function o(e){a=e}function s(){return a}function c(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function l(o){let s=a;if(s===void 0)return o;a=void 0;let l=o.data,d=o.ok?l instanceof Uint8Array?l:typeof l==`string`?i.from(l,`utf8`):u(c(l)):u(o);try{n(t(s),{recursive:!0}),r(s,d)}catch(t){return e(`could not spill output to '${s}'`,[String(t)])}if(!o.ok)return o;if(typeof l!=`object`||!l||l instanceof Uint8Array||c(l)===l)return{...o,data:`spilled ${d.byteLength} bytes to '${s}'`};let f=c(l),p,m=!1;if(typeof f==`object`&&f&&!Array.isArray(f)&&!(`content`in f&&Array.isArray(f.content))&&!(`score`in f)&&!(`id`in f&&`core`in f)){m=`core`in f;let e=`core`in f?Object.hasOwn(f,`core`)?f.core:void 0:f;typeof e==`object`&&e&&!Array.isArray(e)&&`id`in e&&Object.hasOwn(e,`id`)&&(typeof e.id==`string`||typeof e.id==`number`&&Number.isSafeInteger(e.id))&&(p=e.id)}return{...o,data:{...l,response:{spilledTo:s,byteLength:d.byteLength,...o.httpStatus===void 0?{}:{httpStatus:o.httpStatus},...p===void 0?{}:m?{core:{id:p}}:{id:p}}}}}function u(e){return i.from(JSON.stringify(e,null,2),`utf8`)}export{l as i,s as n,c as r,o as t};
@@ -1 +1 @@
1
- import{l as e}from"./response-problem-BgAZ5GyP.js";var t=new Set([408,429,502,503,504]),n=250,r=`source_grounding_at_capacity`;function i(e,t){return e===503&&t?.code===r}function a(e,n){return!t.has(e)||n.disposition===`TERMINAL`?!1:n.resetAt===void 0||n.resetAt===null}function o(e){let t=e instanceof Error?e.cause:void 0;return t instanceof TypeError||t instanceof Error&&t.name===`TimeoutError`}function s(){return n*(1+Math.random())}function c(t,n,r,o=!0){let c=e(n.retryAfterSeconds),l=c===void 0?void 0:c*1e3;if(i(t,n))return l;if(r&&a(t,n))return t===429?!o||n.detail===`Too many Clerk credential verification attempts`||l===void 0?void 0:l+s():l??s()}export{c as i,o as n,s as r,a as t};
1
+ import{l as e}from"./response-problem-TCwoXCAT.js";var t=new Set([408,429,502,503,504]),n=250,r=`source_grounding_at_capacity`;function i(e,t){return e===503&&t?.code===r}function a(e,n){return!t.has(e)||n.disposition===`TERMINAL`?!1:n.resetAt===void 0||n.resetAt===null}function o(e){let t=e instanceof Error?e.cause:void 0;return t instanceof TypeError||t instanceof Error&&t.name===`TimeoutError`}function s(){return n*(1+Math.random())}function c(t,n,r,o=!0){let c=e(n.retryAfterSeconds),l=c===void 0?void 0:c*1e3;if(i(t,n))return l;if(r&&a(t,n))return t===429?!o||n.detail===`Too many Clerk credential verification attempts`||l===void 0?void 0:l+s():l??s()}export{c as i,o as n,s as r,a as t};
@@ -1 +1 @@
1
- import{S as e,b as t}from"./iso-l1vOidnb.js";import{f as n,p as r,r as i}from"./result-envelope-DhrdupDO.js";function a(e,t,n=[]){return i(`${e}: ${t.status} ${t.title}`,[...n],{httpStatus:t.status,problem:t})}function o(e){let t=[],n=[];for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();(e===`warning`||e.startsWith(`x-contract-warning-`))&&(t.push(`${s(e)}: ${i}`),e===`x-contract-warning-key`&&n.push(i))}return{warnings:t,omitted:n}}function s(e){return e.split(`-`).map(e=>e===`x`?`X`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(`-`)}var c=/(?:authorization|api-key|secret|token)/iu,l=/^x-cli-[a-z0-9-]*secret$/iu;function u(n,i,a={}){let o=h(a);o.length>0&&(i=d(i,o));let s=t(e(),r).safeParse(i);if(!s.success)return{status:n,title:`HTTP ${n}`,type:`about:blank`,code:void 0,detail:typeof i==`string`?i:void 0};let c=f(s.data),l=typeof c.status==`number`?c.status:n;return{...c,status:l,title:typeof c.title==`string`?c.title:`HTTP ${l}`,type:typeof c.type==`string`?c.type:`about:blank`,detail:typeof c.detail==`string`?c.detail:void 0}}function d(e,t){return typeof e==`string`?g(e,t):typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>d(e,t)):Object.fromEntries(Object.entries(e).map(([e,n])=>[g(e,t),d(n,t)]))}function f(e){let t=n.safeParse(e);if(t.success)return e;let r=new Set(t.error.issues.map(e=>String(e.path[0])));return Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)))}function p(e,t){if(m(t))return{status:e.status,title:`CLI authorization broker request failed`};let n=h(t),r={};for(let[t,i]of Object.entries(e))i!=null&&(r[t]=typeof i==`object`?JSON.stringify(d(i,n)):typeof i==`string`?g(i,n):i);return r}function m(e){return Object.keys(e).some(e=>l.test(e))}function h(e){let t=[];for(let[n,r]of Object.entries(e)){if(!c.test(n))continue;let e=r.trim();if(e.length===0)continue;t.push(e);let i=e.indexOf(` `);if(i>0){let n=e.slice(i+1).trim();n.length>0&&t.push(n)}}return t}function g(e,t){let n=e;for(let e of t)e!=null&&e.length>0&&(n=n.replaceAll(e,`<redacted>`));return n}function _(e,t){if(m(t))return{status:e.status,title:`CLI authorization broker request failed`,type:`about:blank`,detail:`Broker diagnostic text was suppressed at the CLI credential boundary.`,...y(e)};let n=h(t);if(n.length===0)return e;let r=t=>{let r=e[t];return typeof r==`string`?{[t]:g(r,n)}:{}},i=t=>{let r=e[t];return r==null?{}:{[t]:Object.fromEntries(Object.entries(r).map(([e,t])=>[g(e,n),g(t,n)]))}},a=t=>{let r=e[t];return Array.isArray(r)?{[t]:r.map(e=>g(e,n))}:{}};return{status:e.status,title:g(e.title,n),type:g(e.type,n),...r(`detail`),...r(`hint`),...r(`field`),...r(`suggestion`),...r(`requiredRole`),...r(`existingRecordId`),...i(`suggestions`),...i(`error`),...a(`unknownParameters`),...a(`validParameters`),...e.details===void 0?{}:{details:e.details},...e.resolution===void 0?{}:{resolution:e.resolution},...e.code===void 0?{}:{code:e.code},...e.disposition==null?{}:{disposition:e.disposition},...Array.isArray(e.proseViolation)?{proseViolation:e.proseViolation.map(e=>({...e,passage:g(e.passage,n),reason:g(e.reason,n)}))}:{},...r(`traceId`),...r(`spanId`),...e.limitType===void 0?{}:{limitType:e.limitType},...e.allowanceType===void 0?{}:{allowanceType:e.allowanceType},...e.limit===void 0?{}:{limit:e.limit},...e.used===void 0?{}:{used:e.used},...e.remaining===void 0?{}:{remaining:e.remaining},...e.resetAt===void 0?{}:{resetAt:e.resetAt},...e.windowSeconds===void 0?{}:{windowSeconds:e.windowSeconds},...e.filedRunId?{filedRunId:e.filedRunId}:{},...y(e)}}function v(e,t){if(x(e.retryAfterSeconds)!==void 0)return e;let n=b(t.get(`retry-after`));return n===void 0?e:{...e,retryAfterSeconds:n}}function y(e){let t=x(e.retryAfterSeconds);return t===void 0?{}:{retryAfterSeconds:t}}function b(e){let t=e?.trim()??``;if(/^\d+$/u.test(t))return x(Number(t));let n=/[a-z]/iu.test(t)?new Date(t).getTime():NaN;return Number.isNaN(n)?void 0:x(Math.ceil((n-Date.now())/1e3))}function x(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}export{h as a,b as c,g as i,x as l,u as n,_ as o,a as r,o as s,p as t,v as u};
1
+ import{S as e,b as t}from"./iso-l1vOidnb.js";import{f as n,p as r,r as i}from"./result-envelope-Dy-nSLrT.js";function a(e,t,n=[]){return i(`${e}: ${t.status} ${t.title}`,[...n],{httpStatus:t.status,problem:t})}function o(e){let t=[],n=[];for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();(e===`warning`||e.startsWith(`x-contract-warning-`))&&(t.push(`${s(e)}: ${i}`),e===`x-contract-warning-key`&&n.push(i))}return{warnings:t,omitted:n}}function s(e){return e.split(`-`).map(e=>e===`x`?`X`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(`-`)}var c=/(?:authorization|api-key|secret|token)/iu,l=/^x-cli-[a-z0-9-]*secret$/iu;function u(n,i,a={}){let o=h(a);o.length>0&&(i=d(i,o));let s=t(e(),r).safeParse(i);if(!s.success)return{status:n,title:`HTTP ${n}`,type:`about:blank`,code:void 0,detail:typeof i==`string`?i:void 0};let c=f(s.data),l=typeof c.status==`number`?c.status:n;return{...c,status:l,title:typeof c.title==`string`?c.title:`HTTP ${l}`,type:typeof c.type==`string`?c.type:`about:blank`,detail:typeof c.detail==`string`?c.detail:void 0}}function d(e,t){return typeof e==`string`?g(e,t):typeof e!=`object`||!e?e:Array.isArray(e)?e.map(e=>d(e,t)):Object.fromEntries(Object.entries(e).map(([e,n])=>[g(e,t),d(n,t)]))}function f(e){let t=n.safeParse(e);if(t.success)return e;let r=new Set(t.error.issues.map(e=>String(e.path[0])));return Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)))}function p(e,t){if(m(t))return{status:e.status,title:`CLI authorization broker request failed`};let n=h(t),r={};for(let[t,i]of Object.entries(e))i!=null&&(r[t]=typeof i==`object`?JSON.stringify(d(i,n)):typeof i==`string`?g(i,n):i);return r}function m(e){return Object.keys(e).some(e=>l.test(e))}function h(e){let t=[];for(let[n,r]of Object.entries(e)){if(!c.test(n))continue;let e=r.trim();if(e.length===0)continue;t.push(e);let i=e.indexOf(` `);if(i>0){let n=e.slice(i+1).trim();n.length>0&&t.push(n)}}return t}function g(e,t){let n=e;for(let e of t)e!=null&&e.length>0&&(n=n.replaceAll(e,`<redacted>`));return n}function _(e,t){if(m(t))return{status:e.status,title:`CLI authorization broker request failed`,type:`about:blank`,detail:`Broker diagnostic text was suppressed at the CLI credential boundary.`,...y(e)};let n=h(t);if(n.length===0)return e;let r=t=>{let r=e[t];return typeof r==`string`?{[t]:g(r,n)}:{}},i=t=>{let r=e[t];return r==null?{}:{[t]:Object.fromEntries(Object.entries(r).map(([e,t])=>[g(e,n),g(t,n)]))}},a=t=>{let r=e[t];return Array.isArray(r)?{[t]:r.map(e=>g(e,n))}:{}};return{status:e.status,title:g(e.title,n),type:g(e.type,n),...r(`detail`),...r(`hint`),...r(`field`),...r(`suggestion`),...r(`requiredRole`),...r(`existingRecordId`),...i(`suggestions`),...i(`error`),...a(`unknownParameters`),...a(`validParameters`),...e.details===void 0?{}:{details:e.details},...e.resolution===void 0?{}:{resolution:e.resolution},...e.code===void 0?{}:{code:e.code},...e.disposition==null?{}:{disposition:e.disposition},...Array.isArray(e.proseViolation)?{proseViolation:e.proseViolation.map(e=>({...e,passage:g(e.passage,n),reason:g(e.reason,n)}))}:{},...r(`traceId`),...r(`spanId`),...e.limitType===void 0?{}:{limitType:e.limitType},...e.allowanceType===void 0?{}:{allowanceType:e.allowanceType},...e.limit===void 0?{}:{limit:e.limit},...e.used===void 0?{}:{used:e.used},...e.remaining===void 0?{}:{remaining:e.remaining},...e.resetAt===void 0?{}:{resetAt:e.resetAt},...e.windowSeconds===void 0?{}:{windowSeconds:e.windowSeconds},...e.filedRunId?{filedRunId:e.filedRunId}:{},...y(e)}}function v(e,t){if(x(e.retryAfterSeconds)!==void 0)return e;let n=b(t.get(`retry-after`));return n===void 0?e:{...e,retryAfterSeconds:n}}function y(e){let t=x(e.retryAfterSeconds);return t===void 0?{}:{retryAfterSeconds:t}}function b(e){let t=e?.trim()??``;if(/^\d+$/u.test(t))return x(Number(t));let n=/[a-z]/iu.test(t)?new Date(t).getTime():NaN;return Number.isNaN(n)?void 0:x(Math.ceil((n-Date.now())/1e3))}function x(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:void 0}export{h as a,b as c,g as i,x as l,u as n,_ as o,a as r,o as s,p as t,v as u};
@@ -0,0 +1 @@
1
+ import{C as e,E as t,S as n,_ as r,a as i,b as a,c as o,d as s,g as c,i as l,n as u,p as d,s as f,w as p}from"./iso-l1vOidnb.js";import{t as m}from"./person-owner-BRGa5Dee.js";import{t as h}from"./type-C0VR7LD-.js";import{t as ee}from"./allowance-type-COW05L2h.js";import{Buffer as g}from"node:buffer";var _=d(()=>e([n(),c(),o(),i(),f(_),a(n(),_)])),v=l([`URL_DUPLICATE`,`STRICT_URL_LOOKUP`,`DUPLICATE_CREATE_REVIEW`,`CLASSIFICATION_INACTIVE_TAG`,`NEWS_SOURCE_URL`]),y=Object.assign(e([v,n()]),{enum:v.enum}),te=l([`REACTIVATE`,`ATTACH_INACTIVE`]),ne=r({availableOverrides:f(te),conflictType:y,slug:n(),tagId:s()}),b=r({externalId:n().nullish(),id:s(),publicationScore:s(),reason:f(n()),score:s(),slug:n().regex(/^[a-z0-9_-]+$/).max(255).nullish()}),x=r({externalId:n().nullish(),id:t(),name:n().nullish(),operatingStatus:n().nullish(),publicPath:n().nullish(),reason:f(n()),score:s().optional(),slug:n().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:h.nullish()}),S=r({candidate:f(x).nullish(),conflictType:y,newsCandidate:f(b).nullish(),overridePath:n().nullish(),threshold:s()}),C=r({conflictingArticleId:s(),conflictingArticleSlug:n(),conflictingArticleTitle:n(),conflictType:y}),w=r({candidateEntityId:f(t()),candidatePersonId:f(t()),conflictType:y,hint:n(),normalizedUrl:n().nullish(),url:n(),urlType:n().nullish()}),T=r({owner:m,urlId:s()}),re=r({conflictType:y,existingJoin:f(T),fragmentIgnored:o(),guidance:n(),normalizedUrl:n().nullish(),requestedOwner:m,url:n(),urlType:n()}),ie=e([re,w,S,ne,C]),ae=r({acceptedValue:f(n()).nullish(),action:l([`setField`,`setParameter`,`removeParameter`,`useEndpoint`,`reviewCandidates`,`authenticate`]),endpoint:n().nullish(),fieldPath:n().nullish(),parameter:n().nullish(),retryable:o().nullish()}),E=l([`source`,`record`,`disclaimer`,`voice`,`marketing`,`chained`,`structured`,`tense`,`temporal`,`factList`,`mojibake`,`markup`,`unsupported`,`legalSource`,`textContract`,`evidenceAuthority`,`internalRepetition`,`analysis`]),oe=Object.assign(e([E,n()]),{enum:E.enum}),se=r({overridable:o(),passage:n(),problem:oe,reason:n()}),D=l([`entity`,`person`,`news`,`blog`,`content`]),ce=r({deletedAt:u({offset:!0}).nullish(),id:n(),isHidden:o(),nameBrand:n().nullish(),resourceType:D,showOnSitemap:o(),slug:n()}),le=r({newUrl:n().nullish(),oldUrl:n(),targetCurrentSlug:n().nullish(),targetId:n().nullish(),targetResourceType:D.nullish()}),O=r({allowanceType:ee.nullish(),circuitBreaker:n().nullish(),code:e([l(`async_lookup_sign_in_required.not_authorized.rateLimited.rate_limited.subscription_required.subscription_canceled.subscription_past_due.subscription_paused.billing_allowance_exhausted.billing_additional_usage_cap_reached.billing_credit_checkout_closed.account_exists.origin_detail_capacity.origin_detail_shutdown.query_deadline_shed.suspectedShellStrip.suspected_shell_strip.prose_rejected.cvc_inherited_headcount.source_grounding_at_capacity.url_surface_misclassification.JOBRUNR_DISABLED.jobrunr_disabled.task_plan_operation_unserved.JOBRUNR_STORAGE_UNAVAILABLE.jobrunr_storage_unavailable.rbac_lookup_unavailable.GEOCODE_PROVIDER_ERROR.geocode_provider_error.sentry_api_error.frontend_cache_epoch_mode_not_targeted.image_blocklist_match.image_monochrome.image_too_small.image_wrong_aspect.image_monogram.image_unreadable.image_processing_error.image_brand_mismatch.image_reference_unavailable.logo_first_party_missing.logo_source_dead.image_photographic.web_crawl_fetch_failed.source_document_fetch_busy.primary_website_missing.news_rss_feed_fetch_failed.news_rss_article_fetch_failed.callback_connection_refused.callback_timeout.callback_tls_error.callback_http_4xx.callback_http_5xx.callback_challenge_failed.news_subscription_limit.r2_fetch_failed.r2_delete_failed.r2_upload_failed.source_document_body_unavailable.source_document_capture_limit_exceeded.news_similarity_embedding_unavailable.search_provider_not_configured.search_provider_error.search_still_running.lookup_still_running.sec_edgar_fetch_failed.github_fetch_failed.INFERENCE_PROVIDER_ERROR.inference_provider_error.INFERENCE_PROVIDER_RESPONSE_EMPTY.inference_provider_response_empty.INFERENCE_PROVIDER_INVALID_JSON.inference_provider_invalid_json.INFERENCE_PROFILES_MISSING.inference_profiles_missing.INFERENCE_PROFILE_API_KEY_MISSING.inference_profile_api_key_missing`.split(`.`)),n().max(128)]).nullish(),conflictingRecord:ce.nullish(),detail:n().optional(),details:ie.nullish(),disposition:l([`TRANSIENT`,`TERMINAL`]).nullish(),error:a(n(),n()).nullish(),existingRecordId:n().nullish(),existingRedirect:le.nullish(),feId:n().nullish(),field:n().nullish(),filedRunId:f(t()).nullish(),hammingDistance:c().int().nullish(),hint:n().nullish(),instance:n().optional(),limit:c().int().nullish(),limitType:e([l([`FORM`,`GLOBAL`,`SUBNET`,`IP`,`UNKNOWN`,`RESILIENCE4J`,`WEB_SEARCH`,`AGENT_HELP`,`NATURAL_SEARCH`,`BILLING_ALLOWANCE`,`BILLING_ADDITIONAL_USAGE`,`CLERK_PUBLIC_ADMISSION`,`CLERK_SCRIPT_LOAD`,`ORIGIN_DETAIL`,`INFERENCE_PROVIDER`]),n()]).nullish(),matchedBlocklistKey:n().nullish(),mediaType:n().nullish(),moderationReason:n().nullish(),path:n().nullish(),properties:a(n(),_).optional(),proseViolation:f(se).nullish(),remaining:c().int().nullish(),requiredRole:n().nullish(),resetAt:u({offset:!0}).nullish(),resolution:ae.nullish(),retryAfterSeconds:c().int().nullish(),spanId:n().nullish(),status:s().optional(),suggestion:n().nullish(),suggestions:a(n(),n()).nullish(),suspectedFragment:n().nullish(),title:n().optional(),traceId:n().nullish(),type:n().optional(),unknownParameters:f(n()).nullish(),used:c().int().nullish(),validParameters:f(n()).nullish(),value:n().nullish(),windowSeconds:c().int().nullish()}),ue=e=>e>=400&&e<500,de=e=>e>=500&&e<600,fe=1048576;function k(e){return e.ok&&e.operationId===`searchFederated`}function A(e,t=fe){if(!k(e))return;let n=`Search exceeds the ${t}-byte transport budget; the full result was retained without trimming.`;return e.warnings.includes(n)||g.byteLength(JSON.stringify(e),`utf8`)<=t?e:{...e,warnings:[...e.warnings,n]}}var j=e([n(),c(),o()]),M=r({number:c().optional(),size:c().optional(),numberOfElements:c().optional(),totalElements:c().optional(),totalPages:c().optional(),first:o().optional(),last:o().optional(),empty:o().optional()}),N=r({byteLength:c(),maxBytes:c(),omitted:f(n()),recovery:n()}),P=r({status:c(),title:n(),type:n()}).catchall(_.optional()).and(O),F=r({ok:o(),summary:n(),httpStatus:c().optional(),operationId:n().optional(),method:n().optional(),endpoint:n().optional(),format:l([`json`,`text`]).optional(),count:c().optional(),page:M.optional(),filters:a(n(),e([j,f(j)])).optional(),truncated:o().optional(),trimmed:f(n()).optional(),truncation:N.optional(),omitted:f(n()).default([]),ids:f(n()).default([]),counts:a(n(),c()).default({}),references:f(n()).default([]),warnings:f(n()).default([]),problem:P.optional(),data:p()}),I=5e4,L=[50,25,10,5,1],R=320,z=`data (kept the first row of each list)`,B=[{arrayLimit:1/0,rowLimit:1/0,stringLimit:24e3},{arrayLimit:1/0,rowLimit:1/0,stringLimit:1e4},...L.map(e=>({arrayLimit:e,rowLimit:1/0})),{arrayLimit:1,rowLimit:1/0,foldRows:!0}],V=1e3,pe=/^(?:bio|biography|body|content|description|evidence|fulltext|notes|snippet|summary|text)$/u,me=/(?:description|snippet|summary|text)$/u;function he(e){let t=F.safeParse(e);return t.success?t.data:null}function ge(e){let t=M.safeParse(e);return t.success&&Object.values(t.data).some(e=>e!==void 0)?t.data:void 0}function _e(e,t){if(t?.numberOfElements!==void 0)return t.numberOfElements;if(Array.isArray(e))return e.length;let n=$(e)?e.content:void 0;return Array.isArray(n)?n.length:void 0}function H(e,t,n={}){return{ok:!0,summary:e,...n,omitted:n.omitted??[],ids:n.ids??[],counts:n.counts??{},references:n.references??[],warnings:n.warnings??[],data:t}}function ve(e,t=[],n={}){return{...H(e,null,{...n,warnings:t}),ok:!1}}function ye(e,t={}){let n=A(e);if(n!==void 0)return n;let r=t.maxBytes??5e4;if(G(e,r))return e;let i={byteLength:g.byteLength(JSON.stringify(e),`utf8`),maxBytes:r},a=e.httpStatus??0;if(t.write===!0&&e.ok&&a>=200&&a<300)return be(e,i,t.exactRecovery);let o=e.ok?Se:`Refetch a narrower result through read operations using ids/references or filters; do not retry the failed operation.`,s=t.exactRecovery??t.narrowerRead??o,c=_.safeParse(JSON.parse(JSON.stringify(e.data))),l=t=>{let n=c.success?J(c.data,`data`,i,t):{value:Z(i),omitted:[`data`]};return{...e,truncated:!0,truncation:X(i,n.omitted,s),warnings:[...e.warnings,...t.rowLimit===1/0?[]:[Ce(t,s)],`response truncated (caps); follow truncation.recovery for the full result`],data:n.value}},u=t.foldRows!==!1,d=e;for(let e of B.filter(e=>u||e.foldRows!==!0))if(d=l(e),G(d,i.maxBytes))return d;let f=0;for(let t=2**Math.floor(Math.log2(q(e.data)));t>=1;t/=2)G(l({arrayLimit:1,rowLimit:f+t,foldRows:u}),i.maxBytes)&&(f+=t);if(f>0)return l({arrayLimit:1,rowLimit:f,foldRows:u});let p=(e,t=`data`)=>U(e,i,s,`response truncated (caps); metadata named in truncation.omitted was removed; follow truncation.recovery for the full result`,[t]),m=p(l({arrayLimit:1,rowLimit:1,foldRows:u}),z);if(q(e.data)>0&&G(m,i.maxBytes))return m;let h=Z(i);return p({...d,truncation:X(i,[`data`],s),data:h})}function be(e,t,n=`Read the full result through the GET operation on ${e.endpoint??`this route`}.`){let r={...e.counts},i=(e,n)=>{let a={};for(let[o,s]of Object.entries($(e)?e:{}))Array.isArray(s)?r[`${n}${o}`]=s.length:typeof s==`string`?a[o]=K(s,t,R):typeof s!=`object`||!s?a[o]=s:n===``&&o===`response`?a[o]=i(s,`response.`):o===`core`&&$(s)&&(a[o]={id:s.id});return a},a={...e,summary:`${e.method} succeeded (HTTP ${e.httpStatus}); response body omitted (${t.byteLength} bytes, over caps); do not retry the write`,truncated:!0,truncation:X(t,[`data`],n),counts:r,data:i(e.data,``)},o=[`data`];for(let r of[`references`,`ids`,`warnings`]){if(G(a,t.maxBytes))return a;o.push(r),Object.assign(a,{[r]:[],omitted:[...e.omitted,...o.slice(1)],truncation:X(t,o,n)})}return G(a,t.maxBytes)?a:U({...a,data:Z(t),warnings:[`response truncated (caps); do not retry the write`]},t,n,`response truncated (caps); metadata named in truncation.omitted was removed; do not retry the write`)}function U(e,t,n,r,i=[`data`]){if(G(e,t.maxBytes))return e;let a=e.warnings.slice(0,-1),o=e;if(o.problem!==void 0){let e=W(o.problem);if(JSON.stringify(e).length<JSON.stringify(o.problem).length&&(i.push(`problem`),o={...o,problem:e,truncation:X(t,i,n)},G(o,t.maxBytes)))return o}let s=[`filters`,`omitted`,`ids`,`counts`,`references`].filter(t=>Object.keys(e[t]??{}).length>0);if(i.push(...s),o={...o,filters:void 0,truncation:X(t,i,n),omitted:[],ids:[],counts:{},references:[],warnings:s.length===0?e.warnings:[...a,r]},G(o,t.maxBytes))return o;let c=e=>e===void 0?void 0:K(e,t),l={summary:K(o.summary,t),operationId:c(o.operationId),method:c(o.method),endpoint:c(o.endpoint),warnings:o.warnings.map(e=>K(e,t)),problem:o.problem&&W(o.problem,t)},u=new Map(Object.entries(o));for(let[e,t]of Object.entries(l))JSON.stringify(t)!==JSON.stringify(u.get(e))&&i.push(e);if(o={...o,...l,truncation:X(t,i,n)},G(o,t.maxBytes))return o;i.push(`warnings`),o.page!==void 0&&i.push(`page`);let d=K(o.summary,t,R);return d!==o.summary&&i.push(`summary`),{...o,summary:d,page:void 0,truncation:X(t,i,n),warnings:[r]}}function W(e,t){let n=e=>t===void 0?e:K(e,t);return{status:e.status,title:n(e.title),type:n(e.type),...e.detail===void 0?{}:{detail:n(e.detail)},...e.instance===void 0?{}:{instance:n(e.instance)},...e.code===void 0?{}:{code:typeof e.code==`string`?n(e.code):e.code},...e.retryAfterSeconds===void 0?{}:{retryAfterSeconds:e.retryAfterSeconds},...e.disposition==null?{}:{disposition:e.disposition},...e.resetAt===void 0?{}:{resetAt:e.resetAt}}}function G(e,t=I){let n=JSON.stringify(e);return n.length<3e4&&g.byteLength(n,`utf8`)<=t}function K(e,t,n=V){if(g.byteLength(JSON.stringify(e),`utf8`)<=n)return e;let r=Q(t),i=``,a=g.byteLength(JSON.stringify(r),`utf8`);for(let t of e){let e=g.byteLength(JSON.stringify(t),`utf8`)-2;if(a+e>n)break;i+=t,a+=e}return`${i.trimEnd()}${r}`}function q(e){return Array.isArray(e)?e.length:$(e)?Math.max(0,...Object.values(e).map(q)):0}function J(e,t,n,r){if(typeof e==`string`){let i=xe(we(t))||e.length>V,a=r.stringLimit??R;return!i||e.length<=a?{value:e,omitted:[]}:{value:`${e.slice(0,a).trimEnd()}${Q(n)}`,omitted:[t]}}if(typeof e!=`object`||!e)return{value:e,omitted:[]};if(Array.isArray(e))return Y(e,t,n,r);if(t===`data.response.entity.answer`||t===`data.response.answer`)return{value:e,omitted:[]};let i={},a=[],{foldDepth:o}=r;for(let[s,c]of Object.entries(e)){if(c===void 0)continue;let e=typeof c==`object`&&!!c;if(e&&o!==void 0&&(o===0||Array.isArray(c))){a.push(`${t.replaceAll(/\[\d+\]/gu,`[]`)}.${s} (folded)`);continue}let l=e&&o!==void 0?{...r,foldDepth:o-1}:r,u=J(c,`${t}.${s}`,n,l);i[s]=u.value,a.push(...u.omitted)}return{value:i,omitted:a}}function Y(e,t,n,r){let i=e.slice(0,r.rowLimit),a=r.foldRows===!0?1:r.foldDepth,o={...r,rowLimit:r.arrayLimit,foldDepth:a},s=i.map((e,r)=>J(e,`${t}[${r}]`,n,o)),c=s.flatMap(e=>e.omitted),l=`${t}[${i.length}..] (kept ${i.length} of ${e.length})`;return{value:s.map(e=>e.value),omitted:e.length>i.length?[...c,l]:c}}function xe(e){let t=e.toLowerCase();return pe.test(t)||me.test(t)}var Se=`Save the full response with --to-file <path>, then inspect the needed section; use narrower reads, filters, or pagination only where the operation supports them.`,X=(e,t,n)=>({...e,omitted:t.length===0?[`data`]:[...new Set(t)],recovery:K(n,e)}),Z=e=>({truncated:!0,...e}),Q=e=>`\n[truncated byteLength=${e.byteLength} maxBytes=${e.maxBytes}]`,Ce=({rowLimit:e,foldRows:t},n)=>`kept the first ${e} ${t===!0?`rows of each list with nested sections folded`:`whole rows of each list`}; ${n}`,we=e=>(e.split(`.`).at(-1)??e).replace(/\[\d+\]$/,``),$=e=>typeof e==`object`&&!!e&&!Array.isArray(e);export{ge as a,H as c,de as d,O as f,G as i,k as l,ye as n,he as o,_ as p,ve as r,_e as s,I as t,ue as u};
@@ -1 +1 @@
1
- import{s as e}from"./logging-DD34lxAA.js";var t=2e3,n={userInfo:!1,cookies:!1,httpHeaders:{request:!1,response:!1},httpBodies:[],urlQueryParams:!1,graphQL:{document:!1,variables:!1},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!1,frameContextLines:0},r;async function i(){let t=s(process.env.SENTRY_DSN),i=s(process.env.SENTRY_RELEASE);if(t===void 0||i===void 0)return;let a=await import(`./esm-BB5k_Epe.js`);a.init({dsn:t,environment:e()[`deployment.environment.name`],release:i,dataCollection:n,beforeBreadcrumb:()=>null,beforeSend:e=>{let t=e.tags?.failure;return delete e.request,delete e.user,delete e.breadcrumbs,delete e.contexts,delete e.extra,delete e.transaction,delete e.tags,(t===`authentication_unavailable`||t===`server_start_failed`||t===`transport_error`)&&(e.tags={failure:t}),e}}),r=a}function a(e,t){return r?.captureException(e,{tags:{failure:t}})}async function o(){let e=r;r=void 0,e!==void 0&&await e.close(t)}function s(e){return e?.trim()||void 0}export{i as n,o as r,a as t};
1
+ import{s as e}from"./logging-BFASdeBx.js";var t=2e3,n={userInfo:!1,cookies:!1,httpHeaders:{request:!1,response:!1},httpBodies:[],urlQueryParams:!1,graphQL:{document:!1,variables:!1},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!1,frameContextLines:0},r;async function i(){let t=s(process.env.SENTRY_DSN),i=s(process.env.SENTRY_RELEASE);if(t===void 0||i===void 0)return;let a=await import(`./esm-BB5k_Epe.js`);a.init({dsn:t,environment:e()[`deployment.environment.name`],release:i,dataCollection:n,beforeBreadcrumb:()=>null,beforeSend:e=>{let t=e.tags?.failure;return delete e.request,delete e.user,delete e.breadcrumbs,delete e.contexts,delete e.extra,delete e.transaction,delete e.tags,(t===`authentication_unavailable`||t===`server_start_failed`||t===`transport_error`)&&(e.tags={failure:t}),e}}),r=a}function a(e,t){return r?.captureException(e,{tags:{failure:t}})}async function o(){let e=r;r=void 0,e!==void 0&&await e.close(t)}function s(e){return e?.trim()||void 0}export{i as n,o as r,a as t};
@@ -1 +1 @@
1
- export{t as captureSentryException,n as initializeSentry,r as shutdownSentry}from"./sentry-C6l5JpDi.js";
1
+ export{t as captureSentryException,n as initializeSentry,r as shutdownSentry}from"./sentry-CoBZwrPY.js";
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-B09viugM.js";import{a as o}from"./package-DEeHDoOT.js";import{C as s,D as c,O as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,s as E,t as D,u as O,v as k,w as A,x as j,y as M}from"./iso-l1vOidnb.js";import{$ as N,$n as P,$t as F,A as I,An as L,At as R,B as z,Bn as ee,Bt as B,C as te,Cn as ne,Cr as re,Ct as ie,D as ae,Dn as V,Dr as oe,Dt as se,E as ce,En as le,Er as H,Et as ue,F as de,Fn as fe,Ft as pe,G as me,Gn as he,Gt as ge,H as _e,Hn as ve,Ht as ye,I as be,In as xe,It as Se,J as Ce,Jn as we,Jt as Te,K as Ee,Kn as De,Kt as Oe,L as ke,Ln as Ae,Lt as je,Mn as Me,Mt as Ne,N as Pe,Nn as Fe,Nt as Ie,O as Le,On as Re,Ot as ze,P as Be,Pn as Ve,Pt as He,Q as Ue,Qn as We,Qt as Ge,R as Ke,Rn as qe,Rt as Je,S as Ye,Sn as Xe,Sr as Ze,St as Qe,T as $e,Tn as et,Tr as tt,Tt as nt,U as rt,Un as it,Ut as at,V as ot,Vn as st,Vt as ct,W as lt,Wn as ut,Wt as dt,X as ft,Xn as pt,Xt as mt,Y as ht,Yn as gt,Yt as _t,Z as vt,Zn as yt,Zt as bt,_ as xt,_n as St,_r as Ct,_t as wt,a as Tt,an as Et,ar as Dt,at as Ot,b as kt,bn as At,br as jt,bt as Mt,c as Nt,cn as Pt,cr as Ft,ct as It,d as Lt,dn as Rt,dr as zt,dt as Bt,en as Vt,er as Ht,et as Ut,f as Wt,fn as Gt,fr as Kt,ft as qt,g as Jt,gn as Yt,gr as Xt,h as Zt,hn as Qt,hr as $t,ht as en,i as tn,in as nn,ir as rn,it as an,j as on,jn as sn,jt as cn,k as ln,kn as un,kt as dn,l as fn,ln as pn,lr as mn,lt as hn,m as gn,mn as _n,mr as vn,mt as yn,n as bn,nn as xn,nr as Sn,nt as Cn,o as wn,on as Tn,or as En,ot as Dn,p as On,pr as kn,pt as An,q as jn,qn as Mn,qt as Nn,r as Pn,rn as Fn,rr as In,rt as Ln,s as Rn,sn as zn,sr as Bn,st as Vn,t as Hn,tn as Un,tr as Wn,tt as Gn,u as Kn,un as qn,ur as Jn,ut as Yn,v as Xn,vn as Zn,vr as Qn,vt as $n,w as er,wn as tr,wr as nr,wt as rr,x as ir,xn as ar,xr as or,xt as sr,y as cr,yn as lr,yr as ur,yt as dr,z as fr,zn as pr,zt as mr}from"./auth-BNDyLTqp-GYAzJXBe.js";import{a as hr,l as gr}from"./env-CrYASQ1v.js";import{c as _r,d as vr,l as yr,n as br,o as xr,p as Sr,r as Cr,u as wr}from"./result-envelope-DhrdupDO.js";import{A as Tr,D as Er,F as Dr,G as Or,H as kr,I as Ar,M as jr,N as Mr,O as Nr,P as Pr,R as Fr,T as Ir,V as Lr,j as Rr,k as zr,r as Br,s as Vr,u as Hr,w as Ur,y as Wr,z as Gr}from"./tool-policy-RKAlV7ov.js";import{E as Kr,O as qr,c as Jr,d as Yr,l as U,n as W,t as Xr}from"./esm-lPyPa01D.js";import{C as Zr,F as Qr,H as $r,M as ei,N as ti,P as ni,Q as ri,S as ii,U as ai,X as oi,_ as si,a as ci,d as li,f as ui,g as di,h as fi,i as pi,k as mi,m as hi,o as gi,ot as _i,p as vi,s as yi,t as bi,v as xi,w as Si,x as Ci,y as wi,z as Ti}from"./logging-DD34lxAA.js";import{a as Ei,i as Di,n as Oi,o as ki,r as Ai,t as ji}from"./openapi-call-CynmRaOR.js";import{t as Mi}from"./openapi-snapshot-C3NgiUZo.js";import{r as Ni}from"./output-spill-CuxMluVh.js";import{c as Pi,l as Fi,t as Ii}from"./human-text-cap-dR2SJQJC.js";import{R as Li,i as Ri}from"./webapi-B2JTupyg.js";import{l as zi}from"./response-problem-BgAZ5GyP.js";import{n as Bi,t as Vi}from"./request-replay-DBuUqlOk.js";import{r as Hi}from"./contract-parameter-NIOpC0He.js";import{t as Ui}from"./contract-CPpGo8Ro.js";import"./dist-DaW7WEqw.js";import"./internal-DaW7WEqw.js";import{n as Wi,t as Gi}from"./http-credentials-BUPEQD7v.js";import{E as Ki,T as qi,s as Ji,w as Yi}from"./help-catalog-D4kW0PxM.js";import{i as Xi,n as Zi,r as Qi,t as $i}from"./help-intent-Di40YmYo.js";import{a as ea,i as ta,t as na}from"./text-response-DnoN8rt_.js";import{t as ra}from"./sentry-C6l5JpDi.js";import{n as ia,t as aa}from"./mcp-generation-contract-C87Be-u9.js";import{existsSync as oa,readFileSync as sa}from"node:fs";import{Buffer as ca}from"node:buffer";import la from"crypto";import{Readable as ua}from"stream";import{BlockList as da,isIP as fa,isIPv4 as pa,isIPv6 as ma}from"node:net";import{createHash as ha,randomUUID as ga,timingSafeEqual as _a}from"node:crypto";var va={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},ya,ba=n((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(ya||={})})),G,xa,Sa=n((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(G||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(xa||={})}));function Ca(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function wa(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function Ta(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new ka(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Ea(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Da(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Oa(e,t){return e.toLowerCase()===t.toLowerCase()}var ka,Aa=n((()=>{ka=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),ja,Ma=n((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(ja||={})})),Na,Pa=n((()=>{Ma(),Na=class{kind=ja.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function Fa(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Ia,La,Ra=n((()=>{Ma(),Sa(),Aa(),Ia=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=Fa(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Da(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},La=class{kind=ja.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Ia(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new Ia(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new Ia(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:xa.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===G.GAUGE||e.type===G.UP_DOWN_COUNTER||e.type===G.OBSERVABLE_GAUGE||e.type===G.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),za,Ba,Va=n((()=>{za=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new Ba,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},Ba=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function Ha(e){return Za.setFloat64(0,e),{hi:Za.getUint32(0),lo:Za.getUint32(4)}}function Ua(e){let{hi:t}=Ha(e);return((t&Ga)>>20)-qa}function Wa(e){let{hi:t,lo:n}=Ha(e);return(t&Ka)===0&&n===0}var Ga,Ka,qa,Ja,Ya,Xa,Za,Qa=n((()=>{Ga=2146435072,Ka=1048575,qa=1023,Ja=-1022,Ya=qa,Xa=2**-1022,Za=new DataView(new ArrayBuffer(8))}));function $a(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function eo(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var to=n((()=>{})),no,ro=n((()=>{no=class extends Error{}})),io,ao=n((()=>{Qa(),to(),ro(),io=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<Xa?this._minNormalLowerBoundaryIndex():Ua(e)+(Wa(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new no(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new no(`overflow: ${e} is > maximum lower boundary: ${n}`);return $a(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Ja>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ya>>this._shift}}})),oo,so=n((()=>{Qa(),to(),ro(),oo=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=$a(Math.LOG2E,e),this._inverseFactor=$a(Math.LN2,-e)}mapToIndex(e){if(e<=Xa)return this._minNormalLowerBoundaryIndex()-1;if(Wa(e))return(Ua(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new no(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Xa;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new no(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Ja<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ya+1<<this._scale)-1}}}));function co(e){if(e>uo||e<lo)throw new no(`expected scale >= ${lo} && <= ${uo}, got: ${e}`);return fo[e+10]}var lo,uo,fo,po=n((()=>{ao(),so(),ro(),lo=-10,uo=20,fo=Array.from({length:31},(e,t)=>t>10?new oo(t-10):new io(t-10))})),mo,ho,go,_o,vo,yo,bo=n((()=>{Ma(),Sa(),W(),Va(),po(),to(),mo=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},ho=20,go=160,_o=2,vo=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=go,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new za,l=new za,u=co(ho)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<_o&&(U.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-B09viugM.js";import{a as o}from"./package-DEeHDoOT.js";import{C as s,D as c,O as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,s as E,t as D,u as O,v as k,w as A,x as j,y as M}from"./iso-l1vOidnb.js";import{$ as N,$n as P,$t as F,A as I,An as L,At as R,B as z,Bn as ee,Bt as B,C as te,Cn as ne,Cr as re,Ct as ie,D as ae,Dn as V,Dr as oe,Dt as se,E as ce,En as le,Er as H,Et as ue,F as de,Fn as fe,Ft as pe,G as me,Gn as he,Gt as ge,H as _e,Hn as ve,Ht as ye,I as be,In as xe,It as Se,J as Ce,Jn as we,Jt as Te,K as Ee,Kn as De,Kt as Oe,L as ke,Ln as Ae,Lt as je,Mn as Me,Mt as Ne,N as Pe,Nn as Fe,Nt as Ie,O as Le,On as Re,Ot as ze,P as Be,Pn as Ve,Pt as He,Q as Ue,Qn as We,Qt as Ge,R as Ke,Rn as qe,Rt as Je,S as Ye,Sn as Xe,Sr as Ze,St as Qe,T as $e,Tn as et,Tr as tt,Tt as nt,U as rt,Un as it,Ut as at,V as ot,Vn as st,Vt as ct,W as lt,Wn as ut,Wt as dt,X as ft,Xn as pt,Xt as mt,Y as ht,Yn as gt,Yt as _t,Z as vt,Zn as yt,Zt as bt,_ as xt,_n as St,_r as Ct,_t as wt,a as Tt,an as Et,ar as Dt,at as Ot,b as kt,bn as At,br as jt,bt as Mt,c as Nt,cn as Pt,cr as Ft,ct as It,d as Lt,dn as Rt,dr as zt,dt as Bt,en as Vt,er as Ht,et as Ut,f as Wt,fn as Gt,fr as Kt,ft as qt,g as Jt,gn as Yt,gr as Xt,h as Zt,hn as Qt,hr as $t,ht as en,i as tn,in as nn,ir as rn,it as an,j as on,jn as sn,jt as cn,k as ln,kn as un,kt as dn,l as fn,ln as pn,lr as mn,lt as hn,m as gn,mn as _n,mr as vn,mt as yn,n as bn,nn as xn,nr as Sn,nt as Cn,o as wn,on as Tn,or as En,ot as Dn,p as On,pr as kn,pt as An,q as jn,qn as Mn,qt as Nn,r as Pn,rn as Fn,rr as In,rt as Ln,s as Rn,sn as zn,sr as Bn,st as Vn,t as Hn,tn as Un,tr as Wn,tt as Gn,u as Kn,un as qn,ur as Jn,ut as Yn,v as Xn,vn as Zn,vr as Qn,vt as $n,w as er,wn as tr,wr as nr,wt as rr,x as ir,xn as ar,xr as or,xt as sr,y as cr,yn as lr,yr as ur,yt as dr,z as fr,zn as pr,zt as mr}from"./auth-BNDyLTqp-GYAzJXBe.js";import{a as hr,l as gr}from"./env-D4lMZw-8.js";import{c as _r,d as vr,l as yr,n as br,o as xr,p as Sr,r as Cr,u as wr}from"./result-envelope-Dy-nSLrT.js";import{A as Tr,D as Er,F as Dr,G as Or,H as kr,I as Ar,M as jr,N as Mr,O as Nr,P as Pr,R as Fr,T as Ir,V as Lr,j as Rr,k as zr,r as Br,s as Vr,u as Hr,w as Ur,y as Wr,z as Gr}from"./tool-policy-WURn1WGx.js";import{E as Kr,O as qr,c as Jr,d as Yr,l as U,n as W,t as Xr}from"./esm-lPyPa01D.js";import{C as Zr,F as Qr,H as $r,M as ei,N as ti,P as ni,Q as ri,S as ii,U as ai,X as oi,_ as si,a as ci,d as li,f as ui,g as di,h as fi,i as pi,k as mi,m as hi,o as gi,ot as _i,p as vi,s as yi,t as bi,v as xi,w as Si,x as Ci,y as wi,z as Ti}from"./logging-BFASdeBx.js";import{a as Ei,i as Di,n as Oi,o as ki,r as Ai,t as ji}from"./openapi-call-CpON5wqD.js";import{t as Mi}from"./openapi-snapshot-C3NgiUZo.js";import{r as Ni}from"./output-spill-D9G-tWU9.js";import{c as Pi,l as Fi,t as Ii}from"./human-text-cap-dR2SJQJC.js";import{R as Li,i as Ri}from"./webapi-B2JTupyg.js";import{l as zi}from"./response-problem-TCwoXCAT.js";import{n as Bi,t as Vi}from"./request-replay-CxaD7_FL.js";import{r as Hi}from"./contract-parameter-vSu_ZE57.js";import{t as Ui}from"./contract-BIbN8zfH.js";import"./dist-DaW7WEqw.js";import"./internal-DaW7WEqw.js";import{n as Wi,t as Gi}from"./http-credentials-BUPEQD7v.js";import{E as Ki,T as qi,s as Ji,w as Yi}from"./help-catalog-CvfEYwPL.js";import{i as Xi,n as Zi,r as Qi,t as $i}from"./help-intent-i4bvvWxC.js";import{a as ea,i as ta,t as na}from"./text-response-rnWTbgBC.js";import{t as ra}from"./sentry-CoBZwrPY.js";import{n as ia,t as aa}from"./mcp-generation-contract-C87Be-u9.js";import{existsSync as oa,readFileSync as sa}from"node:fs";import{Buffer as ca}from"node:buffer";import la from"crypto";import{Readable as ua}from"stream";import{BlockList as da,isIP as fa,isIPv4 as pa,isIPv6 as ma}from"node:net";import{createHash as ha,randomUUID as ga,timingSafeEqual as _a}from"node:crypto";var va={name:`metric_data_point`,countItems:e=>{let t=0;for(let n of e.scopeMetrics)for(let e of n.metrics)t+=e.dataPoints.length;return t}},ya,ba=n((()=>{(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(ya||={})})),G,xa,Sa=n((()=>{(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(G||={}),(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(xa||={})}));function Ca(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function wa(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}function Ta(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new ka(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Ea(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Da(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Oa(e,t){return e.toLowerCase()===t.toLowerCase()}var ka,Aa=n((()=>{ka=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),ja,Ma=n((()=>{(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(ja||={})})),Na,Pa=n((()=>{Ma(),Na=class{kind=ja.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}}}));function Fa(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Ia,La,Ra=n((()=>{Ma(),Sa(),Aa(),Ia=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,n=!0,r=Fa(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Da(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},La=class{kind=ja.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Ia(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new Ia(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new Ia(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:xa.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===G.GAUGE||e.type===G.UP_DOWN_COUNTER||e.type===G.OBSERVABLE_GAUGE||e.type===G.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}}})),za,Ba,Va=n((()=>{za=class e{backing;indexBase;indexStart;indexEnd;constructor(e=new Ba,t=0,n=0,r=0){this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},Ba=class e{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}}}));function Ha(e){return Za.setFloat64(0,e),{hi:Za.getUint32(0),lo:Za.getUint32(4)}}function Ua(e){let{hi:t}=Ha(e);return((t&Ga)>>20)-qa}function Wa(e){let{hi:t,lo:n}=Ha(e);return(t&Ka)===0&&n===0}var Ga,Ka,qa,Ja,Ya,Xa,Za,Qa=n((()=>{Ga=2146435072,Ka=1048575,qa=1023,Ja=-1022,Ya=qa,Xa=2**-1022,Za=new DataView(new ArrayBuffer(8))}));function $a(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function eo(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var to=n((()=>{})),no,ro=n((()=>{no=class extends Error{}})),io,ao=n((()=>{Qa(),to(),ro(),io=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<Xa?this._minNormalLowerBoundaryIndex():Ua(e)+(Wa(e)?-1:0)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new no(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new no(`overflow: ${e} is > maximum lower boundary: ${n}`);return $a(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Ja>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return Ya>>this._shift}}})),oo,so=n((()=>{Qa(),to(),ro(),oo=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=$a(Math.LOG2E,e),this._inverseFactor=$a(Math.LN2,-e)}mapToIndex(e){if(e<=Xa)return this._minNormalLowerBoundaryIndex()-1;if(Wa(e))return(Ua(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new no(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return Xa;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new no(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return Ja<<this._scale}_maxNormalLowerBoundaryIndex(){return(Ya+1<<this._scale)-1}}}));function co(e){if(e>uo||e<lo)throw new no(`expected scale >= ${lo} && <= ${uo}, got: ${e}`);return fo[e+10]}var lo,uo,fo,po=n((()=>{ao(),so(),ro(),lo=-10,uo=20,fo=Array.from({length:31},(e,t)=>t>10?new oo(t-10):new io(t-10))})),mo,ho,go,_o,vo,yo,bo=n((()=>{Ma(),Sa(),W(),Va(),po(),to(),mo=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}low;high;constructor(e,t){this.low=e,this.high=t}},ho=20,go=160,_o=2,vo=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=go,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new za,l=new za,u=co(ho)){this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<_o&&(U.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
2
  changing to the minimum size of: ${_o}`),this._maxSize=_o)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){Number.isFinite(e)&&(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0?this._zeroCount+=t:(this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)))}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=eo(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=co(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=mo.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=mo.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new mo(0,-1);let r=t-n;return new mo(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},yo=class{kind=ja.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new vo(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:xa.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===G.GAUGE||e.type===G.UP_DOWN_COUNTER||e.type===G.OBSERVABLE_GAUGE||e.type===G.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}}})),xo,So,Co=n((()=>{Ma(),Zr(),Sa(),xo=class{startTime;_current;sampleTime;constructor(e,t=0,n=[0,0]){this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=Ti(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},So=class{kind=ja.LAST_VALUE;createAccumulation(e){return new xo(e)}merge(e,t){let n=ni(t.sampleTime)>=ni(e.sampleTime)?t:e;return new xo(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=ni(t.sampleTime)>=ni(e.sampleTime)?t:e;return new xo(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:xa.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}}})),wo,To,Eo=n((()=>{Ma(),Sa(),wo=class{startTime;monotonic;_current;reset;constructor(e,t,n=0,r=!1){this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},To=class{kind=ja.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new wo(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new wo(t.startTime,this.monotonic,r,t.reset):new wo(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new wo(t.startTime,this.monotonic,r,!0):new wo(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:xa.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}}})),Do=n((()=>{Pa(),Ra(),bo(),Co(),Eo()})),Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo=n((()=>{W(),Do(),Sa(),Oo=class e{static DEFAULT_INSTANCE=new Na;createAggregator(t){return e.DEFAULT_INSTANCE}},ko=class e{static MONOTONIC_INSTANCE=new To(!0);static NON_MONOTONIC_INSTANCE=new To(!1);createAggregator(t){switch(t.type){case G.COUNTER:case G.OBSERVABLE_COUNTER:case G.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}},Ao=class e{static DEFAULT_INSTANCE=new So;createAggregator(t){return e.DEFAULT_INSTANCE}},jo=class e{static DEFAULT_INSTANCE=new La([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}},Mo=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new La(this._boundaries,this._recordMinMax)}},No=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new yo(this._maxSize,this._recordMinMax)}},Po=class{_resolve(e){switch(e.type){case G.COUNTER:case G.UP_DOWN_COUNTER:case G.OBSERVABLE_COUNTER:case G.OBSERVABLE_UP_DOWN_COUNTER:return Io;case G.GAUGE:case G.OBSERVABLE_GAUGE:return Lo;case G.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Mo(e.advice.explicitBucketBoundaries):Ro}return U.warn(`Unable to recognize instrument type: ${e.type}`),Fo}createAggregator(e){return this._resolve(e).createAggregator(e)}},Fo=new Oo,Io=new ko,Lo=new Ao,Ro=new jo,new No,zo=new Po}));function Vo(e){switch(e.type){case Ho.DEFAULT:return zo;case Ho.DROP:return Fo;case Ho.SUM:return Io;case Ho.LAST_VALUE:return Lo;case Ho.EXPONENTIAL_HISTOGRAM:{let t=e;return new No(t.options?.maxSize,t.options?.recordMinMax)}case Ho.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Ro:new Mo(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Ho,Uo=n((()=>{Bo(),(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ho||={})})),Wo,Go,Ko=n((()=>{ba(),Uo(),Wo=e=>({type:Ho.DEFAULT}),Go=e=>ya.CUMULATIVE})),qo,Jo,Yo,Xo,Zo,Qo=n((()=>{qo=`otel.component.name`,Jo=`otel.component.type`,Yo=`periodic_metric_reader`,Xo=`otel.sdk.metric_reader.collection.duration`,Zo=`error.type`})),$o,es,ts=n((()=>{Qo(),$o=new Map,es=class{collectionDuration;standardAttrs;constructor(e,t){let n=$o.get(e)??0;$o.set(e,n+1),this.standardAttrs={[Jo]:e,[qo]:`${e}/${n}`},this.collectionDuration=t.createHistogram(Xo,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Zo]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}}})),ns,rs=n((()=>{ns=`2.11.0`})),is,as=n((()=>{W(),Aa(),Ko(),ts(),rs(),Zr(),is=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??Wo,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??Go,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new es(this._otelComponentType,qr())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,ns);this._selfObsMetrics=new es(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=ei(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=ei(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=Qr(ti(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){this._shutdown?U.error(`Cannot call shutdown twice.`):(e?.timeoutMillis==null?await this.onShutdown():await Ta(this.onShutdown(),e.timeoutMillis),this._shutdown=!0)}async forceFlush(e){this._shutdown?U.warn(`Cannot forceFlush on already shutdown MetricReader.`):e?.timeoutMillis==null?await this.onForceFlush():await Ta(this.onForceFlush(),e.timeoutMillis)}}}));function os(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}var ss=n((()=>{})),cs,ls=n((()=>{W(),Zr(),as(),Aa(),Sa(),ss(),Qo(),cs=class extends is{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:i,maxExportBatchSize:a}=e,{exportTimeoutMillis:o=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:Yo,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...i};switch(e){case G.COUNTER:return t.counter??t.default;case G.GAUGE:return t.gauge??t.default;case G.HISTOGRAM:return t.histogram??t.default;case G.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case G.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case G.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case G.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(o<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<o){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);U.info(`Timeout of ${o} exceeds the interval of ${n}. Clamping timeout to interval duration.`),o=n}this._exportInterval=n,this._exportTimeout=o,this._exporter=t,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(e){ri(e)}}async _doRun(){if(this._ongoingExportPromise){U.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&U.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){U.debug(`Error while resolving async portion of resource: `,e),ri(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?os(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await Ta(Si._export(this._exporter,e),this._exportTimeout);t.code!==mi.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof ka){U.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}U.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){U.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}})),us,ds=n((()=>{Zr(),us=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(e){this._aggregationTemporality=e}export(e,t){this._shutdown?setTimeout(()=>t({code:mi.FAILED}),0):(this._metrics.push(e),setTimeout(()=>t({code:mi.SUCCESS}),0))}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(e){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}})),fs,ps=n((()=>{Zr(),Ko(),fs=class e{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??Go}export(t,n){if(this._shutdown)n({code:mi.FAILED});else return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:mi.SUCCESS})}}})),ms,hs=n((()=>{ms=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}}}));function gs(e,t,n){return ys(e)||U.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??Kr.DOUBLE,advice:n?.advice??{}}}function _s(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function vs(e,t){return Oa(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}function ys(e){return bs.test(e)}var bs,xs=n((()=>{W(),Aa(),bs=/^[a-z][a-z0-9_.\-/]{0,254}$/i}));function Ss(e){return e instanceof Os}var Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms=n((()=>{W(),Cs=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){typeof e==`number`?this._descriptor.valueType===Kr.INT&&!Number.isInteger(e)&&(U.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now()):U.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`)}},ws=class extends Cs{add(e,t,n){this._record(e,t,n)}},Ts=class extends Cs{add(e,t,n){e<0?U.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`):this._record(e,t,n)}},Es=class extends Cs{record(e,t,n){this._record(e,t,n)}},Ds=class extends Cs{record(e,t,n){e<0?U.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`):this._record(e,t,n)}},Os=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,n){this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},ks=class extends Os{},As=class extends Os{},js=class extends Os{}})),Ns,Ps=n((()=>{xs(),Ms(),Sa(),Ns=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let n=gs(e,G.GAUGE,t),r=this._meterSharedState.registerMetricStorage(n);return new Es(r,n)}createHistogram(e,t){let n=gs(e,G.HISTOGRAM,t),r=this._meterSharedState.registerMetricStorage(n);return new Ds(r,n)}createCounter(e,t){let n=gs(e,G.COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new Ts(r,n)}createUpDownCounter(e,t){let n=gs(e,G.UP_DOWN_COUNTER,t),r=this._meterSharedState.registerMetricStorage(n);return new ws(r,n)}createObservableGauge(e,t){let n=gs(e,G.OBSERVABLE_GAUGE,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new As(n,r,this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=gs(e,G.OBSERVABLE_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new ks(n,r,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=gs(e,G.OBSERVABLE_UP_DOWN_COUNTER,t),r=this._meterSharedState.registerAsyncMetricStorage(n);return new js(n,r,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}}})),Fs,Is=n((()=>{xs(),Fs=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=gs(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}})),Ls,Rs,zs=n((()=>{Aa(),Ls=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??=this._hash(e),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},Rs=class extends Ls{constructor(){super(Ca)}}})),Bs,Vs=n((()=>{Zr(),Aa(),zs(),Bs=class{_activeCollectionStorage=new Rs;_cumulativeMemoStorage=new Rs;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Ca(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=Ti(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new Rs,e}}}));function Hs(e){return Array.from(e.entries())}var Us,Ws=n((()=>{ba(),zs(),Us=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===ya.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Hs(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new Rs,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}}})),Gs,Ks=n((()=>{Is(),Vs(),Ws(),zs(),Gs=class extends Fs{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,n,r,i){super(e),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Bs(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Us(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new Rs;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}}}));function qs(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Js(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ys(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Xs(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Zs(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
3
3
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
4
4
  \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function Qs(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Zs(e,t):Xs(e,t):Ys(e,t):Js(e,t)}var $s=n((()=>{})),ec,tc=n((()=>{xs(),W(),$s(),ec=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);r===void 0?t.set(n.name,[e]):r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();vs(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),U.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
@@ -1,4 +1,4 @@
1
- import{A as e,C as t,E as n,S as r,_ as i,c as a,d as o,g as s,i as c,n as l,s as u,x as d}from"./iso-l1vOidnb.js";import{A as f,C as p,D as m,E as h,M as g,O as _,S as v,T as ee,_ as te,a as ne,b as re,c as ie,d as ae,f as oe,g as se,h as ce,i as le,j as ue,k as de,l as fe,m as pe,n as me,o as he,p as ge,r as y,s as _e,t as b,u as ve,v as ye,w as be,x,y as xe}from"./detail-B6bqZMpp.js";import{t as Se}from"./person-owner-BRGa5Dee.js";import{t as S}from"./entity-BtU2r6nM.js";import{t as C}from"./type-C0VR7LD-.js";import{t as Ce}from"./run-Cev2CSf9.js";import{p as we}from"./result-envelope-DhrdupDO.js";import{a as Te,s as Ee}from"./tool-policy-RKAlV7ov.js";import{a as w,c as De,i as Oe,l as ke,n as T,r as E,s as D,t as Ae}from"./text-field-jFKOGMzr.js";import{a as je,n as Me,o as Ne,r as Pe,s as O,t as Fe}from"./human-text-cap-dR2SJQJC.js";import{a as Ie,d as k,f as Le,m as A,o as Re,p as ze,u as Be,x as Ve}from"./help-catalog-D4kW0PxM.js";import{Buffer as He}from"node:buffer";function Ue(e){if(typeof e==`object`&&e&&!Array.isArray(e)&&Array.isArray(e.column)&&e.column.every(e=>typeof e==`string`)&&Array.isArray(e.row)&&e.row.every(e=>Array.isArray(e))){let t=e.column;return{column:t,record:e.row.map(e=>new Map(t.map((t,n)=>[t,We(e[n]??null)])))}}let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:typeof e==`object`&&e&&Array.isArray(e.row)?e.row:[e],n=new Set,r=t.map(e=>{let t=new Map,r=(e,n)=>{if(Array.isArray(e))t.set(n,e.some(e=>typeof e==`object`&&!!e)?JSON.stringify(e):e.map(We).join(`; `));else if(typeof e==`object`&&e)for(let[t,i]of Object.entries(e))i!==void 0&&r(i,n===``?t:`${n}.${t}`);else t.set(n||`value`,e===null?``:String(e))};r(e,``);for(let e of t.keys())n.add(e);return t});return{column:[...n],record:r}}function We(e){return e===null?``:typeof e==`string`?e:JSON.stringify(e)}function j(e){return e.map(e=>{let t=/^[=+\-@\t\r]/u.test(e)?`'${e}`:e;return/[",\r\n]/u.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}).join(`,`)+`\r
1
+ import{A as e,C as t,E as n,S as r,_ as i,c as a,d as o,g as s,i as c,n as l,s as u,x as d}from"./iso-l1vOidnb.js";import{A as f,C as p,D as m,E as h,M as g,O as _,S as v,T as ee,_ as te,a as ne,b as re,c as ie,d as ae,f as oe,g as se,h as ce,i as le,j as ue,k as de,l as fe,m as pe,n as me,o as he,p as ge,r as y,s as _e,t as b,u as ve,v as ye,w as be,x,y as xe}from"./detail-B6bqZMpp.js";import{t as Se}from"./person-owner-BRGa5Dee.js";import{t as S}from"./entity-BtU2r6nM.js";import{t as C}from"./type-C0VR7LD-.js";import{t as Ce}from"./run-Cev2CSf9.js";import{p as we}from"./result-envelope-Dy-nSLrT.js";import{a as Te,s as Ee}from"./tool-policy-WURn1WGx.js";import{a as w,c as De,i as Oe,l as ke,n as T,r as E,s as D,t as Ae}from"./text-field-jFKOGMzr.js";import{a as je,n as Me,o as Ne,r as Pe,s as O,t as Fe}from"./human-text-cap-dR2SJQJC.js";import{a as Ie,d as k,f as Le,m as A,o as Re,p as ze,u as Be,x as Ve}from"./help-catalog-CvfEYwPL.js";import{Buffer as He}from"node:buffer";function Ue(e){if(typeof e==`object`&&e&&!Array.isArray(e)&&Array.isArray(e.column)&&e.column.every(e=>typeof e==`string`)&&Array.isArray(e.row)&&e.row.every(e=>Array.isArray(e))){let t=e.column;return{column:t,record:e.row.map(e=>new Map(t.map((t,n)=>[t,We(e[n]??null)])))}}let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:typeof e==`object`&&e&&Array.isArray(e.row)?e.row:[e],n=new Set,r=t.map(e=>{let t=new Map,r=(e,n)=>{if(Array.isArray(e))t.set(n,e.some(e=>typeof e==`object`&&!!e)?JSON.stringify(e):e.map(We).join(`; `));else if(typeof e==`object`&&e)for(let[t,i]of Object.entries(e))i!==void 0&&r(i,n===``?t:`${n}.${t}`);else t.set(n||`value`,e===null?``:String(e))};r(e,``);for(let e of t.keys())n.add(e);return t});return{column:[...n],record:r}}function We(e){return e===null?``:typeof e==`string`?e:JSON.stringify(e)}function j(e){return e.map(e=>{let t=/^[=+\-@\t\r]/u.test(e)?`'${e}`:e;return/[",\r\n]/u.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}).join(`,`)+`\r
2
2
  `}function Ge(e){let{column:t,record:n}=Ue(e);return t.length===0?``:j(t)+n.map(e=>j(t.map(t=>e.get(t)??``))).join(``)}function Ke(t){let n=we.safeParse(JSON.parse(JSON.stringify(t??null)));if(!n.success)throw Error(`Response is not JSON, so it cannot be written as CSV: ${e(n.error)}`);return Ge(n.data)}var M=`aventure`;function N(e,t,n=`cli`){let r=t.find(t=>t.operationId===e);if(n===`mcp`&&r?.tool!==void 0){let e=Re(r);return`${e.tool} ${JSON.stringify(e.arguments)}`}let i=r?.cliPath;return i===void 0?void 0:`${M} ${i.join(` `)}`}function qe(e,t,n=e,r=`cli`){return r===`mcp`?N(e,t,r)??e:Ve(e,t,`aventure`)??n}function Je(e,t,n=`cli`){let r=Be.safeParse(e);if(!r.success)return null;let{answer:i,citation:a,confidence:o,resolution:s}=r.data;if(s!=null)return Ye(i,s,t,n);let c=i.trimEnd().split(`
3
3
  `),l=new Set(a.flatMap(({sourceType:e,sourceId:r})=>{if(e!==ze.options[0].enum.OPERATION)return[];let i=N(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 Ye(e,t,n,r){let{outcome:i,operationId:a,probability:o,candidate:s,taskKey:c,taskPlan:l}=t,u=[l==null?e.trimEnd():Ze(l)],d=[``,`Outcome: ${i}${o==null?``:` (probability ${o.toFixed(2)})`}`];switch(i){case k.enum.TASK_PLAN:return[...u,...l==null?[]:Qe(l,n,r),...d];case k.enum.OPERATION_ADVICE:{let e=s.filter(({sourceId:e})=>e!==a);return[...u,...a==null?[]:[``,r===`mcp`?`MCP call:`:`Command:`,` ${qe(a,n,a,r)}`],...d,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case k.enum.CLARIFY:return[...u,...c==null?[]:[``,`Leading catalog task: ${c}`],...et(`Candidates:`,s,n,r),...d];case k.enum.ABSTAIN:return[...u,...et(`Nearest operations:`,s,n,r),...d];default:throw Error(`Unhandled help resolution outcome ${String(i)}`)}}function Xe(e,t,n=`cli`){let r=Le.safeParse(e);return r.success?[Ze(r.data),...Qe(r.data,t,n)]:null}var Ze=({taskKey:e,catalogRevision:t})=>e===void 0?`Run these steps in order.`:`Run catalog task ${e}${t===void 0?``:` (catalog revision ${t})`}.`;function Qe(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}: `}${qe(r.operationId,t,i,n)}`,` ${r.instruction}`,...$e(e,o,a)]),...e.gateId?.length?[``,`Completion gates: ${e.gateId.join(`, `)}`]:[]]}function $e(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 et(e,t,n,r){if(t.length===0)return[];let i=t.map(({sourceId:e,excerpt:t})=>({command:N(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 tt=/\{([^}]+)\}/gu,nt=/(?:^r|R)evision$/u;function rt(e,t,n=`cli`){let r=t.filter(e=>e.method===`GET`&&(n===`cli`||e.binaryResponse!==!0)),i=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),a=t.find(t=>t.operationId===e.operationId),o=e.ok&&a!==void 0&&Te(a.intent),s=[...o&&e.endpoint!==void 0?ct(e.endpoint.split(`?`)[0]??``,r,!1,n,ot(e.data)).map(e=>n===`mcp`?e:`${e} --data --to-file <path>`):[],...e.references.filter(e=>!i(e)).flatMap(st).flatMap(e=>ct(e.pathname,r,!0,n)),...e.references.filter(i).flatMap(st).flatMap(e=>lt(e,r,n))],c=n===`mcp`?it:void 0;return s.length===0?{write:o,narrowerRead:c}:{exactRecovery:`Read the full result ${s.join(`; `)}.`,write:o,narrowerRead:c}}var it=`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 at(e){return`Inline output is truncated; full payload written to ${e}; read it with your file tool.`}function ot(e){let t=typeof e==`object`&&e&&`response`in e?e.response:null;return typeof t==`object`&&t?new Map(Object.entries(t).flatMap(([e,t])=>Number.isInteger(t)&&nt.test(e)?[[e,String(t)]]:[])):new Map}function st(e){return URL.canParse(e)?[new URL(e)]:[]}function ct(e,t,n,r,i=new Map){let a=t.filter(t=>t.path===e);return(a.length>0?a:t).flatMap(t=>{let a=[...t.path.matchAll(tt)].map(([,e])=>e),o=RegExp(`^${t.path.replace(tt,`([^/]+)`)}$`,`u`),s=n&&a.length===0?null:o.exec(e);if(s===null)return[];let c=t.parameters.flatMap(e=>{let t=e.location===`query`?i.get(e.name):void 0;return t===void 0?[]:[{parameter:e,pin:t}]});if(r===`mcp`)return[ut(t,{pathParams:Object.fromEntries(a.map((e,t)=>[e??``,decodeURIComponent(s[t+1]??``)])),...c.length===0?{}:{query:Object.fromEntries(c.map(({parameter:e,pin:t})=>[e.name,t]))}})];let l=a.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[P(r),s[n+1]??``]}),u=c.flatMap(({parameter:e,pin:t})=>[P(e),t]);return[`${dt(t)}, ${ft(t,[...l,...u])}`]})}function lt(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: ${ut(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?[]:[P(t),pt(n)]}),s=[P(i),`<n>`,P(a),`<n>`];return[`${dt(t)}, in windows: ${ft(t,[...o,...s])}, advancing ${P(i)} until a window returns fewer than ${P(a)} units`]})}function ut(e,t){return`${Ee(e)} ${JSON.stringify({operationId:e.operationId,...t})}`}function dt(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function ft(e,t){return[M,...e.cliPath,...t].join(` `)}function P(e){return e.flag.split(/\s+/u)[0]??e.flag}function pt(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}var mt=i({detail:r(),field:r().nullish(),scope:c([`entity`,`person`,`news`])}),ht=c([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),gt=Object.assign(t([ht,r()]),{enum:ht.enum}),F=i({modeRequested:gt,modeUsed:gt}),_t=i({answerUnavailable:a(),entity:F,incompleteScope:u(c([`entity`,`person`,`news`])).optional(),news:F,person:F,rejection:u(mt),unavailable:u(c([`entity`,`person`,`news`]))}),vt=i({acceleratorParticipation:u(te),detail:u(se)}),I=i({core:S,enrichment:m,fundraiseRound:u(x),profileStatus:re.optional(),provider:xe.nullish(),research:vt,semanticMatch:he.nullish()}),yt=c([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),bt=i({compositeScore:s().nullish(),cosineScore:s().nullish(),curatedAsOf:r().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:r().nullish(),curatedSource:r().nullish(),derivedFromEntityId:n().nullish(),matchedSectionWeight:s().nullish(),origin:yt,rank:o(),sharedSectionCount:o().nullish()}),xt=i({entity:I,similarity:bt}),St=i({fundraiseInvestorJoin:a(),fundraiseTransaction:a(),operatingStatus:a(),relationship:a()}),Ct=c([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),wt=c([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),Tt=i({acquiredEntity:S,acquirerEntity:S,amount:s().int().nullish(),announcedAt:r().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:r().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:r().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:l({offset:!0}).nullish(),currency:r().nullish(),dataConfidence:be.nullish(),evidence:St,fundraiseTransactionId:n().nullish(),investorJoinId:n().nullish(),isCurrent:a().nullish(),publicSource:ee.nullish(),relationshipId:o(),status:Ct,transactionStatus:wt.nullish(),updatedAt:l({offset:!0}).nullish()}),Et=i({entity:b,investorAttribution:u(v),round:u(p),roundCount:o()}),Dt=i({core:S,fundingDetail:f.nullish(),similarity:bt,urlLink:u(_)}),Ot=i({compliance:ce.nullish(),createdAt:l({offset:!0}).nullish(),get expandedText(){return Ot.nullish()},expandedTextId:o().nullish(),id:o(),isCurrent:a().nullish(),isPrimary:a().nullish(),language:r().nullish(),owner:Se,text:r(),textName:r().nullish(),textType:r(),updatedAt:l({offset:!0}).nullish()}),kt=Ot,At=c([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),jt=c([`fundraiseRound`,`researchDetail`]),Mt=c([`preMoney`,`postMoney`,`reported`]),Nt=i({amountRaised:s().int().nullish(),asOfDate:r().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:fe,currency:r(),declaredBasis:Mt,derivation:At,detailId:o().nullish(),label:r().nullish(),source:jt,sourceRef:r(),valuationPostMoney:s().int().nullish(),valuationPreMoney:s().int().nullish()}),Pt=i({createdAt:l({offset:!0}).nullish(),description:r().nullish(),forkCount:o(),githubId:s().int(),homepageUrl:r().nullish(),id:s().int(),isArchived:a(),isFork:a(),language:r().nullish(),license:r().nullish(),name:r(),ownerLogin:r(),repoCreatedAt:l({offset:!0}).nullish(),repoPushedAt:l({offset:!0}).nullish(),stargazerCount:o(),topic:u(r()),updatedAt:l({offset:!0}).nullish(),url:r()}),L=i({empty:a().optional(),sorted:a().optional(),unsorted:a().optional()}),R=i({offset:s().int().optional(),paged:a().optional(),pageNumber:o().optional(),pageSize:o().optional(),sort:L.optional(),unpaged:a().optional()}),Ft=i({investorAttribution:u(v),person:y,round:u(p),roundCount:o()}),It=c([`by`,`about`]),Lt=c([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),Rt=i({canonicalUrl:r().nullish(),contentId:r(),contentType:Lt,createdAt:l({offset:!0}).nullish(),publishedAt:l({offset:!0}).nullish(),relation:It.nullish(),sourceDomain:r().nullish(),sourceName:r().nullish(),summary:r().nullish(),title:r(),topic:r().nullish(),updatedAt:l({offset:!0}).nullish(),url:r().nullish(),year:o().nullish()});i({content:u(ae).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(t([g,ue])).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(ie).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(S).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Tt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(b).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(h).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(x).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Et).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(I).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(ve).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(ye).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(se).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(pe).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(xt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Dt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(kt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(_).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Nt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Pt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Ce).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(oe).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(ne).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(y).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(_e).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Ft).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(le).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()}),i({content:u(Rt).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()});var zt=i({content:u(I),number:o(),size:o(),totalElements:s().int(),totalPages:o()}),Bt=i({content:u(oe),number:o(),size:o(),totalElements:s().int(),totalPages:o()}),Vt=i({content:u(ne),number:o(),size:o(),totalElements:s().int(),totalPages:o()});i({content:u(me).optional(),empty:a().optional(),first:a().optional(),last:a().optional(),number:o().optional(),numberOfElements:o().optional(),pageable:R.optional(),size:o().optional(),sort:L.optional(),totalElements:s().int().optional(),totalPages:o().optional()});var Ht=c([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`,`webProfile`]),Ut=Object.assign(t([Ht,r()]),{enum:Ht.enum}),Wt=i({entityId:n(),source:Ut,sourceId:r()}),Gt=i({title:r(),url:r()}),Kt=i({citation:u(Wt),text:r(),topic:r().nullish(),webSource:u(Gt).optional()}),qt=i({citation:u(Wt),confidence:A,description:r().nullish(),heading:r().nullish(),paragraph:u(Kt),relatedQuery:u(r()),shareable:a(),text:r(),title:r().nullish()}),Jt=i({enrichmentRunId:n().nullish(),entityId:n()}),Yt=i({sortPriority:c([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Xt=i({max:l({offset:!0}).nullish(),min:l({offset:!0}).nullish()}),z=i({max:s().nullish(),min:s().nullish()}),B=i({max:o().nullish(),min:o().nullish()}),Zt=i({averageAmountInvestedUsdRange:u(z).optional(),largestAmountInvestedUsdRange:u(z).optional(),smallestAmountInvestedUsdRange:u(z).optional(),totalAmountInvestedUsdRange:u(z).optional(),totalInvestmentRange:u(B).optional()}),Qt=c([`any`,`every`]),$t=i({amountInvestedRange:u(z).optional(),amountRaisedRange:u(z).optional(),dateAnnouncedRange:Xt.nullish(),investedAmountRaisedRange:u(z).optional(),investedCompanyName:u(r()).optional(),investedCountry:u(r()).optional(),investedIndustry:u(r()).optional(),investedRound:u(r()).optional(),investorActivity:Zt.optional(),investorName:u(r()).optional(),investorNameMatch:Qt.nullish(),lastRoundYearRange:u(B).optional(),rankByInvestmentActivity:a().nullish(),round:u(r()).optional(),totalRaisedRange:u(z).optional(),valuationRange:u(z).optional()}),en=c([`NONE`,`COMPANY_LISTING_READY`]),tn=c([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),nn=c([`hostPath`,`domain`]),rn=d({acceleratorBrand:u(r()).optional(),acceleratorCohort:u(r()).optional(),acceleratorName:u(r()).optional(),acceleratorStatus:u(r()).optional(),affinity:u(r()).optional(),closedLast:a().optional(),employeeCountRange:u(B).optional(),entityId:u(n()).optional(),entityName:u(r()).optional(),featured:a().nullish(),fundraiseActivity:$t.optional(),hasFundraising:a().nullish(),headquartersCity:u(r()).optional(),headquartersCountry:u(r()).optional(),headquartersState:u(r()).optional(),industry:u(r()).optional(),letter:r().nullish(),location:u(r()).optional(),logoOption:Yt.optional(),mainProduct:u(r()).optional(),noteworthyOnly:a().optional(),operatingStatus:u(tn).optional(),originCountry:u(r()).optional(),person:u(r()).optional(),portfolioHeadquartersCity:u(r()).optional(),portfolioHeadquartersCountry:u(r()).optional(),portfolioHeadquartersState:u(r()).optional(),qualityGate:en.optional(),rankByProminence:a().nullish(),semanticQuery:r().nullish(),slug:u(r().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:u(r()).optional(),suppressLateStage:a().nullish(),suppressNonOperating:a().nullish(),suppressZeroTotalRaised:a().nullish(),tag:u(r()).optional(),textSearch:r().nullish(),typeCustomer:u(r()).optional(),typeModel:u(r()).optional(),typeOwnership:u(r()).optional(),typeRecord:u(C).optional(),typeRevenue:u(r()).optional(),typeTechnologyUsed:u(r()).optional(),url:r().nullish(),urlDomain:r().nullish(),urlMatchMode:nn.nullish(),urlType:de.nullish(),yearFoundedRange:u(B).optional()}),an=d({acceleratorBrand:u(r()).optional(),acceleratorCohort:u(r()).optional(),acceleratorName:u(r()).optional(),acceleratorStatus:u(r()).optional(),affinity:u(r()).optional(),closedLast:a().optional(),employeeCountRange:u(B).optional(),entityId:u(n()).optional(),entityName:u(r()).optional(),featured:a().nullish(),fundraiseActivity:$t.optional(),hasFundraising:a().nullish(),headquartersCity:u(r()).optional(),headquartersCountry:u(r()).optional(),headquartersState:u(r()).optional(),industry:u(r()).optional(),letter:r().nullish(),location:u(r()).optional(),logoOption:Yt.optional(),mainProduct:u(r()).optional(),noteworthyOnly:a().optional(),operatingStatus:u(tn).optional(),originCountry:u(r()).optional(),person:u(r()).optional(),portfolioHeadquartersCity:u(r()).optional(),portfolioHeadquartersCountry:u(r()).optional(),portfolioHeadquartersState:u(r()).optional(),qualityGate:en.optional(),rankByProminence:a().nullish(),slug:u(r().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:u(r()).optional(),suppressLateStage:a().nullish(),suppressNonOperating:a().nullish(),suppressZeroTotalRaised:a().nullish(),tag:u(r()).optional(),textSearch:r().nullish(),typeCustomer:u(r()).optional(),typeModel:u(r()).optional(),typeOwnership:u(r()).optional(),typeRecord:u(C).optional(),typeRevenue:u(r()).optional(),typeTechnologyUsed:u(r()).optional(),url:r().nullish(),urlDomain:r().nullish(),urlMatchMode:nn.nullish(),urlType:de.nullish(),yearFoundedRange:u(B).optional()}),on=i({entityFilter:an.nullish(),isCurrent:a().nullish(),personTitle:u(r()).optional()}),sn=c([`CURRENT`,`PAST`,`ANY`]),cn=i({amountInvestedRange:u(z).nullish(),amountRaisedRange:u(z).nullish(),entityName:u(r()).nullish(),investedCompany:u(r()).nullish(),personTitle:u(r()).nullish(),round:u(r()).nullish(),totalInvestmentCount:u(B).nullish(),typeRecord:u(C).nullish()}),ln=i({additionalAssociation:on.nullish(),arrayFilter:cn.optional(),entityFilter:an.optional(),entityId:n().nullish(),entitySlug:r().nullish(),firstName:r().nullish(),includeAddress:a().nullish(),includeUrl:a().nullish(),investorActivity:Zt.optional(),isCurrent:a().nullish(),lastName:r().nullish(),letter:r().nullish(),nameQuery:r().nullish(),personId:u(n()).max(200).optional(),personName:u(r()).optional(),rankByEmployer:a().nullish(),role:r().nullish(),search:r().nullish(),semanticQuery:r().nullish(),status:r().nullish(),tenure:sn.nullish()}),un=c([`discovery`,`profile`,`peer`,`comparison`]),dn=c([`keyword`,`semantic`]),fn=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`,`NOTABLE_ACTIVITY_AT`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),pn=Object.assign(t([fn,r()]),{enum:fn.enum}),mn=i({descending:a(),field:pn,sortKey:r().nullish()}),hn=i({order:u(mn),relevance:dn.nullish()}),gn=i({confidence:A,execution:F,fallbackUsed:a(),filter:rn,intent:un,interpretation:r(),personAssociation:ln.nullish(),sort:hn,subjectEntityName:u(r()),unsupported:r().nullish()}),V=i({changedAt:l({offset:!0}).nullish(),dataSourceUpdatedAt:l({offset:!0}).nullish(),pendingApproval:o().nullish(),sourceId:r().nullish(),status:r().nullish()}),_n=i({fundManagerRelationshipSource:V.nullish(),fundraiseTransaction:x,fundraiseTransactionSource:V.nullish(),investorJoinSource:V.nullish()}),vn=i({evidence:_n,investor:Se,semanticMatch:he.nullish()}),yn=i({entityId:n(),matchedOffering:S.nullish(),probability:s(),webUrl:u(r())}),bn=i({entityId:n(),label:r(),publishedAt:l({offset:!0}).nullish(),score:s(),source:Ut,sourceId:r(),text:r(),url:r().nullish()}),xn=i({answer:qt.nullish(),filing:u(Jt).nullish(),interpretation:gn,investment:u(vn),judgment:u(yn),passage:u(bn),peer:u(xt),pendingWebQuery:u(r()),personLead:a(),result:zt,searchRequestId:n().nullish(),subject:u(I)}),Sn=i({entity:u(ge),newsId:o()}),Cn=i({descending:a(),field:c([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:r().nullish()}),wn=i({order:u(Cn),relevance:dn.nullish()}),Tn=i({confidence:A,employerSemanticQuery:r().nullish(),execution:F,fallbackUsed:a(),filter:ln,interpretation:r(),sort:wn,unsupported:r().nullish()}),En=i({currentCompany:r().nullish(),headline:r().nullish(),id:n(),location:r().nullish(),name:r(),named:r(),organizationEvidence:c([`headline`,`profile`,`none`]).nullish(),photoUrl:r().nullish(),profileUrl:r(),slug:r().regex(/^[a-z0-9_-]+$/).max(255)}),Dn=i({interpretation:Tn,investment:u(vn),personLead:a(),profile:u(En),result:Vt,searchRequestId:n().nullish()}),On=i({label:r(),query:r()}),kn=i({key:r(),option:u(On),prompt:r()}),An=i({entity:xn,entityDetail:u(b),news:Bt,newsEntityMention:u(Sn),person:Dn,personDetail:u(y),personLead:a(),provenance:_t,qualifier:kn.nullish(),section:u(c([`person`,`company`,`productService`,`investor`])).optional()}),H=30,U=8,W=10,jn=2,Mn=[`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`],Nn=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]);function Pn(e,t,n,{trailer:r=[],...i}={}){let a=i.transport??`cli`;if(typeof t==`string`)return Ne(t,i,r);let o=Ie(t,r,a);if(o!==null)return Pe(o,r,i);let s=Gn(t);if(s===null)return null;let c=e.find(({operationId:e})=>e===s.operationId),l=ke(c?.detailField,s.response),u=[...l.hiddenNote,...r],d=(e,t)=>Me([e.trimEnd(),...t].join(`
4
4
  `),{appendNewline:!0,preservedTrailerLines:t.length>0?t.length:void 0,...i}),f=c?.parameters??[],p={...s,response:l.response,parameters:f,transport:a},m=Je(p.response,e,a)??Xe(p.response,e,a);if(m!==null)return d(m.join(`
@@ -1 +1 @@
1
- import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{C as n,S as r,_ as i,b as a,c as o,g as s,i as c,m as l,p as u,s as d,x as f}from"./iso-l1vOidnb.js";import{c as p,p as m,r as h}from"./result-envelope-DhrdupDO.js";import{A as ee,O as te,S as ne,_ as re,b as ie,d as g,h as ae,i as _,l as v,n as y,p as b,w as x,x as oe}from"./esm-lPyPa01D.js";import{C as S,G as se,K as ce,L as le,M as ue,N as de,O as fe,Q as C,R as pe,T as me,U as he,V as w,W as ge,X as _e,Y as T,_ as ve,at as ye,d as be,f as xe,g as Se,h as Ce,it as we,j as Te,k as Ee,m as De,nt as E,ot as Oe,q as ke,s as Ae,tt as je,v as Me,x as Ne,y as Pe,z as D}from"./logging-DD34lxAA.js";import{basename as Fe,extname as Ie}from"node:path";import{readFile as Le}from"node:fs/promises";import{AsyncLocalStorage as Re}from"node:async_hooks";i({bodyPath:r(),valueField:d(i({path:d(r().nullable()).readonly(),type:c([`object`,`array`,`string`,`number`,`integer`,`boolean`]),nullable:o()})).readonly()});var O=n([l(``),r().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),ze=f({readOperationId:r().min(1),writePointer:O,readPointer:O,readParameter:r().min(1).optional(),submittedMap:d(f({bodyPointer:O,readPointer:O,identityPointer:O})).min(1).optional(),fallback:f({writePointer:O,readPointer:O,readQueryName:r().min(1),readQueryValue:r().min(1)}).optional()}),Be=c([`QUEUED`,`STARTED`,`SEARCH`,`READ`,`CHECK`,`WRITE`,`FINISHED`]),k=Object.assign(n([Be,r()]),{enum:Be.enum});function Ve(e){return new URL(e,`https://placeholder.invalid`).pathname}function He(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(We)?!1:n.every((e,t)=>Ue(e)||e===r[t])}function Ue(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function We(e){if(Ue(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 A=[`get`,`post`,`put`,`patch`,`delete`],Ge=c([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);function Ke(e){let t=Ge.safeParse(e.toUpperCase());if(!t.success)throw Error(`Unsupported OpenAPI method: ${e}`);return t.data}function qe(e){let t=e.toLowerCase(),n=A.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var Je=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],Ye=f({name:r().regex(/^[A-Z][A-Z0-9_]*$/u)}),j=n([l(`private`),i({scope:r().optional(),value:r().optional()})]),Xe=()=>({$ref:r().optional(),description:r().optional(),type:n([r(),d(r())]).optional(),format:r().optional(),default:m.optional(),enum:d(m).optional(),"x-extensible-enum":d(m).optional(),"x-aventure-parsed-enum":o().optional(),readOnly:o().optional(),items:M.optional(),minItems:s().int().nonnegative().optional(),maxItems:s().int().nonnegative().optional(),properties:a(r(),M).optional(),required:d(r()).optional(),oneOf:d(M).optional(),anyOf:d(M).optional(),allOf:d(M).optional(),propertyNames:M.optional(),additionalProperties:n([M,o()]).optional(),"x-aventure-visibility":j.optional(),"x-aventure-cli-conflicts":d(d(r().min(1)).min(2)).min(1).optional(),"x-aventure-env":Ye.optional(),"x-aventure-detail":l(!0).optional(),"x-aventure-operation-only":d(r().min(1)).min(1).optional()}),M=u(()=>i(Xe())),Ze=i({in:r(),name:r(),required:o().optional(),description:r().optional(),schema:M.optional(),"x-aventure-visibility":j.optional(),"x-aventure-legacy-name":f({name:r().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`}))}),Qe=a(r(),i({schema:M.optional()})),$e=i({$ref:r().optional(),description:r().optional(),required:o().optional(),schema:M.optional(),"x-aventure-visibility":j.optional()}),et=i({description:r().optional(),headers:a(r(),$e).optional(),content:Qe.optional(),"x-aventure-standard-response":o().optional()}),tt=i({description:r().optional(),required:o().optional(),content:Qe.optional()}),nt=f({auth:c([`none`,`read`]).optional(),mutates:o().optional()}).optional(),rt=r().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),it=r().regex(/^[a-z][A-Za-z0-9]*$/u),at=r().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),ot=f({command:rt,role:c(Je),summary:r().trim().min(1).optional(),description:r().trim().min(1).optional(),bodyOption:d(it).min(1).optional(),localOption:d(f({optionKey:it,flag:at,description:r().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),st=i({operationId:r(),summary:r().optional(),description:r().optional(),tags:d(r()).optional(),deprecated:o().optional(),hidden:o().optional(),security:d(a(r(),d(r()))).optional(),parameters:d(Ze).optional(),requestBody:tt.optional(),responses:a(r(),et),"x-aventure-visibility":j.optional(),"x-aventure-tool":nt,"x-aventure-mutation-readback":ze.optional(),"x-aventure-completion-evidence":l(`response`).optional(),"x-aventure-run-activity":c([k.enum.SEARCH,k.enum.READ,k.enum.CHECK,k.enum.WRITE]).optional(),"x-aventure-cli-composite":ot,"x-aventure-cli":f({listed:l(!1)}).optional()}).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`})}}),ct=i(Object.fromEntries(A.map(e=>[e,st.optional()]))),lt=i({...Xe(),"x-aventure-noun":f({one:r().trim().min(1),other:r().trim().min(1)}).optional()});i({info:i({description:r().optional()}).optional(),tags:d(i({name:r(),description:r().optional(),"x-aventure-cli":f({section:c([`researchData`,`account`,`administration`,`cli`])}).optional()})).optional(),paths:a(r(),ct),webhooks:a(r(),i({post:i({description:r(),requestBody:tt})})).optional(),components:i({schemas:a(r(),lt),headers:a(r(),$e).optional()})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of A){for(let[a,o]of Object.entries(r[i]?.responses??{}))for(let[r,s]of Object.entries(o.headers??{}))ft(e,s)||t.addIssue({code:`custom`,path:[`paths`,n,i,`responses`,a,`headers`,r,`$ref`],message:`response header '${r}' has an unresolved or malformed $ref`});let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&pt(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 ut=new Set([`page`,`size`,`sort`]);function N(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0&&e.$ref.slice(21)||void 0}function dt(e){return e?.$ref?.startsWith(`#/components/headers/`)===!0&&e.$ref.slice(21)||void 0}function ft(e,t){let n=dt(t);if(t.$ref!==void 0&&n===void 0)return!1;let r=n===void 0?t:e.components.headers?.[n];if(r===void 0||r.$ref!==void 0)return!1;let i=N(r.schema);return r.schema?.$ref===void 0||!!(i&&e.components.schemas[i])}function pt(e,t){for(let[n,r]of Object.entries(e))for(let e of A){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function mt(e,t,n){let r=Ve(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&&He(n,r))return{method:t,template:n,operation:e}}return null}function ht(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 gt(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 _t(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||ut.has(r.name))continue;let e=t?.[r.name]??yt(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}var vt=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`;function yt(e){return vt(e)||Array.isArray(e)&&e.every(vt)?e:void 0}var bt={name:`span`,countItems:e=>e.length},xt=256,St=512;function Ct(e,t){let n=e&255|xt;return t&&(n|=St),n}function wt(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:ve(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Et(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Tt(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ct(n.traceFlags,e.parentSpanContext?.isRemote)}}function Tt(e,t){return{attributes:e.attributes?ve(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:Ct(e.context.traceFlags,e.context.isRemote)}}function Et(e,t){return{attributes:e.attributes?ve(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Dt(e,t){return{resourceSpans:kt(e,t)}}function Ot(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 kt(e,t){let n=Ot(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=>wt(e,t));o.push({scope:Ce(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Se(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}y();var At={serializeRequest:e=>{let t=Dt(e,De);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 v.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},jt=`otlp_http_span_exporter`,Mt=class extends Oe{constructor(e={}){super(xe(be(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),At,jt,bt,e.selfObsMeterProvider))}};he(),S(),Me();var Nt=`exception`,P=Symbol.for(`nodejs.util.inspect.custom`);function F(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function Pt(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})}`}y();var Ft=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:b.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=w.now(),this._performanceOffset=t-(this._performanceStartTime+w.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 v.warn(`Invalid attribute key: ${e}`),this;if(!je(t))return v.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 v.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&v.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),le(t)&&(le(n)||(n=t),t=void 0);let i=E(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&c>=a?s++:(o[e]=this._truncateToSize(t),c++)}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&&v.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=E(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===b.UNSET||this.status.code===b.OK)return this;let t={code:e.code};return e.code===b.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&v.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()?v.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=de(this.startTime,this.endTime),this._duration[0]<0&&(v.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&&v.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&v.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<=w.now())return ue(e+this._performanceOffset);if(typeof e==`number`)return D(e);if(e instanceof Date)return D(e.getTime());if(pe(e))return e;if(this._startTimeProvided)return D(Date.now());let t=w.now()-this._performanceStartTime;return Te(this.startTime,D(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[se]=e:e&&(e.code?n[ke]=e.code.toString():e.name&&(n[ke]=e.name),e.message&&(n[se]=e.message),e.stack&&(n[ce]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Nt,n,t):v.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}}`);v.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?(v.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}[P](e,t,n){return Pt(`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:F(this.resource)}},e,t,n)}},I;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(I||={});var It=`otel.component.name`,Lt=`otel.component.type`,Rt=`otel.span.parent.origin`,zt=`otel.span.sampling_result`,Bt=`otel.sdk.processor.span.processed`,Vt=`otel.sdk.processor.span.queue.capacity`,Ht=`otel.sdk.processor.span.queue.size`,Ut=`otel.sdk.span.live`,Wt=`otel.sdk.span.started`,Gt=`batching_span_processor`,Kt=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Wt,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Ut,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Jt(t);if(this.startedSpans.add(1,{[Rt]:qt(e),[zt]:n}),t===I.NOT_RECORD)return()=>{};let r={[zt]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function qt(e){return e?e.isRemote?`remote`:`local`:`none`}function Jt(e){switch(e){case I.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case I.RECORD:return`RECORD_ONLY`;case I.NOT_RECORD:return`DROP`}}var Yt=`2.11.0`;y(),S();var Xt=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`,Yt);this._tracerMetrics=new Kt(n)}startSpan(e,t={},n=g.active()){t.root&&(n=_.deleteSpan(n));let r=_.getSpan(n);if(we(n))return v.debug(`Instrumentation suppressed, returning Noop Span`),_.wrapSpanContext(ne);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!_.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??ae.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:E(e.attributes)})),d=E(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===re.RECORD_AND_SAMPLED?x.SAMPLED:x.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===re.NOT_RECORD)return v.debug(`Recording is off, propagating context in a non-recording span`),_.wrapSpanContext(h);let ee=E(Object.assign(d,f.attributes));return new Ft({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??g.active(),c=this.startSpan(e,i,s),l=_.setSpan(s,c);return g.with(l,o,void 0,c)}[P](e,t,n){return Pt(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:F(this._resource)},spanLimits:this._spanLimits},e,t,n)}};S();var Zt=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=>{C(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)})}},L=class{shouldSample(){return{decision:I.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},R=class{shouldSample(){return{decision:I.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};y(),S();var z=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(C(Error(`ParentBasedSampler must have a root sampler configured`)),new R),this._remoteParentSampled=e.remoteParentSampled??new R,this._remoteParentNotSampled=e.remoteParentNotSampled??new L,this._localParentSampled=e.localParentSampled??new R,this._localParentNotSampled=e.localParentNotSampled??new L}shouldSample(e,t,n,r,i,a){let o=_.getSpanContext(e);return!o||!ie(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&x.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&x.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};he();var Qt=new Map,$t=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=Qt.get(e)??0;if(Qt.set(e,r+1),this.standardAttrs={[Lt]:e,[It]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[ge]:`queue_full`},this.processedSpans=t.createCounter(Bt,{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(Vt,{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(Ht,{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,[ge]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};y(),S();var en=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 me(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(v.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):te();this._metrics=new $t(Gt,t,{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&x.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&&v.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1)):(this._droppedSpansCount>0&&(v.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);g.with(ye(g.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===Ee.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=>{C(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,C(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)}},tn=class extends en{onShutdown(){}},nn=8,rn=16,an=class{generateTraceId=on(rn);generateSpanId=on(nn)},B=Buffer.allocUnsafe(rn);function on(e){return function(){for(let t=0;t<e/4;t++)B.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(B[t]>0);t++)t===e-1&&(B[e-1]=1);return B.toString(`hex`,0,e)}}y();var V;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(V||={});var sn=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Pe();let t=e.spanProcessors??[];this._activeSpanProcessor=new Zt(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new z({root:new R}),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 an,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return te()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Xt({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=V.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==V.timeout&&(r=V.resolved,n(r))}).catch(e=>{clearTimeout(i),r=V.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==V.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[P](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Pt(`TracerProvider`,{resource:{attributes:F(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};y();var cn=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:oe(t)&&this._accumulate(t)<this._upperBound?I.RECORD_AND_SAMPLED:I.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}};y(),S();var H;(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`})(H||={});var U=1;function ln(){return{sampler:un(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:T(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:T(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function un(){let e=_e(`OTEL_TRACES_SAMPLER`)??H.ParentBasedAlwaysOn;switch(e){case H.AlwaysOn:return new R;case H.AlwaysOff:return new L;case H.ParentBasedAlwaysOn:return new z({root:new R});case H.ParentBasedAlwaysOff:return new z({root:new L});case H.TraceIdRatio:return new cn(dn());case H.ParentBasedTraceIdRatio:return new z({root:new cn(dn())});default:return v.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${H.ParentBasedAlwaysOn}".`),new z({root:new R})}}function dn(){let e=T(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(v.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${U}.`),U):e<0||e>1?(v.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${U}.`),U):e}S();function fn(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}S();var pn=class extends sn{constructor(e={}){let t=fe({},ln(),fn(e));delete t.generalLimits,super(t)}};S();var mn=class extends tn{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=T(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};y(),Me();var hn=`aventure-mcp-server`,gn=`aventure=mcp`,_n=`langfuse.session.id`,vn=`/api/public/otel/v1/traces`,yn=5e3,bn=new Set([`langfuse.observation.input`,`langfuse.observation.output`,`langfuse.observation.status_message`]),xn=[`OTEL_EXPORTER_OTLP_HEADERS`,`OTEL_EXPORTER_OTLP_TRACES_HEADERS`],W,G;function K(e){return e?.trim()||void 0}function Sn(){return K(process.env.GIT_SHA)??K(process.env.SENTRY_RELEASE)??t().version}function Cn(){let e=K(process.env.LANGFUSE_BASE_URL),t=K(process.env.LANGFUSE_PUBLIC_KEY),n=K(process.env.LANGFUSE_SECRET_KEY);if(e!==void 0&&t!==void 0&&n!==void 0){for(let e of xn){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 Mt({url:new URL(vn,e).href,headers:{Authorization:`Basic ${Buffer.from(`${t}:${n}`).toString(`base64`)}`,"x-langfuse-ingestion-version":`4`},timeoutMillis:yn})}}function wn(e){let t={};for(let[n,r]of Object.entries(e.attributes))bn.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 Tn(e){return{export:(t,n)=>e.export(t.map(wn),n),shutdown:()=>e.shutdown(),forceFlush:()=>e.forceFlush?.()??Promise.resolve()}}function En(){if(W!==void 0)return G;let e=K(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),t=[...e===void 0?[]:[Tn(new Mt({url:e,timeoutMillis:yn}))],...[Cn()].filter(e=>e!==void 0)];return W=new pn({sampler:new R,resource:Ne({...Ae(),"service.version":Sn()}),spanProcessors:t.map(e=>new mn(e,{exportTimeoutMillis:yn}))}),G=t.length===0?void 0:W.getTracer(hn),G}function Dn(){En()}var On=/^00-(?<traceId>[0-9a-f]{32})-(?<spanId>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})$/u,kn=/[13579bdf]$/u;function An(e,t,n){let r=En();if(r===void 0)return;let i=On.exec(n??``)?.groups,a=i?.traceId===void 0||i.spanId===void 0?ee:_.setSpanContext(ee,{traceId:i.traceId,spanId:i.spanId,traceFlags:kn.test(i.flags??``)?x.SAMPLED:x.NONE,isRemote:!0});return r.startSpan(e,{kind:ae.SERVER,attributes:{"langfuse.trace.name":e,...t,"langfuse.environment":Ae()[`deployment.environment.name`],"langfuse.release":Sn()}},a)}function jn(e){let{traceId:t,spanId:n,traceFlags:r}=e.spanContext();return`00-${t}-${n}-${(r&x.SAMPLED)===0?`00`:`01`}`}function Mn(e,t,n){e.setAttributes(t),e.setStatus({code:n?b.ERROR:b.OK}),e.end()}async function Nn(){let e=W;W=void 0,G=void 0,await e?.shutdown()}var q=new Re,Pn=`X-Client-Request-Id`,Fn=()=>q.getStore()?.requestId,In=()=>q.getStore()?.toolApiCall,Ln=()=>q.getStore()?.userBearerToken;function Rn(){let e=q.getStore(),t=[...e?.sessionId===void 0?[]:[`${_n}=${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?{}:{[Pn]:e.requestId},...e?.traceparent===void 0?{}:{traceparent:e.traceparent,tracestate:gn,...t.length===0?{}:{baggage:t}}}}function zn(e,t){return q.run({...q.getStore(),requestId:e,toolApiCall:{failed:!1}},t)}function Bn(e,t){return q.run({...q.getStore(),userBearerToken:e},t)}function Vn(e,t){return q.run({...q.getStore(),...e},t)}var Hn=Object.freeze({total:8,perOrigin:2,originLimit:64,failureThreshold:3,cooldownMs:3e4,idleMs:3e4,halfOpenProbes:1}),Un=Object.freeze({total:128,perOrigin:64,originLimit:64,failureThreshold:5,cooldownMs:15e3,idleMs:3e5,halfOpenProbes:1}),Wn=new WeakMap,J=class extends Error{reason;constructor(e){super(e===`capacity`?`Origin capacity exceeded; try again later.`:`Origin circuit is open; try again later.`),this.reason=e}};function Gn(e,t){let n=Date.now(),r=Wn.get(t);r===void 0&&(r={active:0,origin:new Map},Wn.set(t,r));for(let[i,a]of r.origin)i!==e&&a.active===0&&a.updatedAt+t.idleMs<=n&&r.origin.delete(i);let i=r.origin.get(e);if(i===void 0){if(r.origin.size>=t.originLimit)throw new J(`capacity`);i={active:0,failures:0,openUntil:0,updatedAt:n},r.origin.set(e,i)}if(i.openUntil>n||i.failures>=t.failureThreshold&&i.active>=t.halfOpenProbes)throw new J(`circuit`);if(r.active>=t.total||i.active>=t.perOrigin)throw new J(`capacity`);return i.active++,r.active++,{finish:Kn(r,i,t)}}function Kn(e,t,n){let r=!1;return i=>{r||(r=!0,t.active--,e.active--,t.updatedAt=Date.now(),i===`failure`?(t.failures++,t.failures>=n.failureThreshold&&(t.openUntil=t.updatedAt+n.cooldownMs)):i===`success`&&(t.failures=0,t.openUntil=0))}}var qn=3e4,Jn=20,Y=52428800;async function Yn(e,t,n,r={}){let i=er(X(e.requestBody?.content),n);if(!i.ok||i.data===null)return h(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return h(`Request body is required.`);if(a?.kind===`multipart`)return await nr(e.requestBody?.required===!0,a.schema,t,r);let o=a?.contentType??r.defaultContentType;return p(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function Xn(e){if(typeof e!=`string`)return p(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return p(`Request body unchanged`,e);try{let t=m.safeParse(JSON.parse(e));if(!t.success)throw t.error;return p(`Request body parsed`,t.data)}catch(e){return h(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function Zn(e,t){let n=e?.schema;if(n===void 0)return!1;let r=N(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function Qn(e){return X(e)[0]?.kind??`json`}function $n(e){return e===void 0||Object.keys(e).length===0||X(e).length>0}function X(e){let t=Object.entries(e??{});return[...t.flatMap(e=>hr(e[0])?[tr(e,`json`)]:[]),...t.flatMap(e=>gr(e[0])?[tr(e,`multipart`)]:[])]}function er(e,t){if(t===void 0)return p(`Default request content selected`,e[0]);let n=Q(t),r=e.find(e=>Q(e.contentType)===n);return r===void 0?h(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):p(`Explicit request content selected`,r)}function tr(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function nr(e,t,n,r){if(!e&&n==null)return p(`Optional multipart body omitted`,{});let i=rr(n);if(!i.ok||i.data===null)return h(i.summary,i.warnings);let a=new FormData;for(let e of ir(t)){let t=i.data[e.name];if(t==null){if(e.required)return h(`Multipart body requires '${e.name}'.`)}else{if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return h(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return h(`Multipart part '${e.name}' has too many entries.`);if(ar(e.schema)||or(e.schema)){let n=or(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return h(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await lr(t,r);if(!n.ok||n.data===null)return h(n.summary,n.warnings,{httpStatus:n.httpStatus});a.append(e.name,n.data.blob,n.data.filename)}}else if(sr(e.schema,t)){let n=JSON.stringify(t);a.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=cr(a,e.name,t);if(!n.ok)return n}}}return p(`Multipart body prepared`,{body:a})}function rr(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return p(`Multipart input parsed`,t)}return h(`Multipart request body must be a JSON object keyed by form part name.`)}function ir(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function ar(e){return e.type===`string`&&e.format===`binary`}function or(e){return e.type===`array`&&e.items!==void 0&&ar(e.items)}function sr(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function cr(e,t,n){if(Array.isArray(n)){for(let r of n){let n=cr(e,t,r);if(!n.ok)return n}return p(`Multipart scalar array appended`,null)}return typeof n==`object`?h(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),p(`Multipart scalar appended`,null))}async function lr(e,t){if(t.signal?.aborted||(t.deadline??1/0)<=Date.now()){let e=In();return e!==void 0&&!Z(t.signal)&&(e.failed=!0),h(`Media preparation canceled or invocation deadline exceeded.`)}return pr(e)?Fn()===void 0?await ur(e,t):h(`MCP media URL fetching is disabled. Pass the page as sourceUrl in the JSON body instead.`):Fn()===void 0?await fr(e,t.signal):h(`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 ur(e,t){let n=new AbortController,r=Math.min(qn,(t.deadline??1/0)-Date.now()),i=setTimeout(()=>n.abort(),Math.max(r,1)),a=t.signal?AbortSignal.any([n.signal,t.signal]):n.signal,o,s,c=`neutral`;try{if(a.throwIfAborted(),r<=0)throw Error(`Invocation deadline exceeded.`);let t=new URL(e),n=t;for(let e=0;;e++){a.throwIfAborted(),o=Gn(n.origin,Hn),c=`failure`,s=await fetch(n.href,{signal:a,redirect:`manual`});let t=s.headers.get(`location`);if(![301,302,303,307,308].includes(s.status)||t===null)break;if(await s.body?.cancel(),e>=Jn)throw Error(`Media URL exceeded the redirect limit.`);let r=new URL(t,n);o.finish(`success`),o=void 0,s=void 0,n=r}if(c=s.status===429||s.status>=500?`failure`:`success`,!s.ok)return await s.body?.cancel(),h(`Failed to fetch media URL: ${s.status} ${s.statusText}`,[],{httpStatus:s.status});c=`failure`;let i=s.headers.get(`content-type`)?.split(`;`)[0]?.trim()??mr(t.pathname)??``,l=await dr(s,{type:i,signal:a});return c=`success`,p(`URL media fetched`,{blob:l,filename:Fe(t.pathname)||`upload`})}catch(e){(e instanceof J||a.aborted||r<=0)&&(c=`failure`),e instanceof RangeError&&(c=`success`),Z(t.signal)&&(c=`neutral`),s?.body&&!s.body.locked&&!s.bodyUsed&&await s.body.cancel();let i=Z(t.signal)?`Failed to fetch media URL: canceled.`:t.signal?.aborted?`Failed to fetch media URL: invocation deadline exceeded.`:n.signal.aborted?`Failed to fetch media URL: timed out after ${r}ms.`:`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`;return h(i,[],{httpStatus:e instanceof RangeError?void 0:s?.status})}finally{clearTimeout(i);let e=In();e!==void 0&&c===`failure`&&!Z(t.signal)&&(e.failed=!0),o?.finish(c)}}function Z(e){return e?.aborted===!0&&!(e.reason instanceof DOMException&&e.reason.name===`TimeoutError`)}async function dr(e,{type:t,signal:n}){let r=e.body?.getReader();if(r===void 0)throw Error(`Media URL returned no body.`);let i=[],a=0,o=!1,s,c=new Promise(e=>{s=()=>e({done:!0,value:void 0}),n.addEventListener(`abort`,s,{once:!0})});try{if(Number(e.headers.get(`content-length`))>Y)throw RangeError(`Media exceeds the ${Y}-byte upload limit.`);for(;;){n.throwIfAborted();let e=await Promise.race([r.read(),c]);if(n.throwIfAborted(),e.done)break;if(a+=e.value.byteLength,a>Y)throw RangeError(`Media exceeds the ${Y}-byte upload limit.`);i.push(new Blob([e.value.slice()]))}return o=!0,new Blob(i,{type:t})}finally{s&&n.removeEventListener(`abort`,s),o||await r.cancel(),r.releaseLock()}}async function fr(e,t){try{let n=mr(e)??``,r=await Le(e,{signal:t});return p(`File media read`,{blob:new Blob([r],{type:n}),filename:Fe(e)})}catch(t){return h(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function pr(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function mr(e){return _r[Ie(e).toLowerCase()]}function hr(e){let t=Q(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function gr(e){return Q(e)===`multipart/form-data`}var Q=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,_r={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function vr(e,t,n){let r=new Map,i=(t,a,o)=>{let s=N(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=br(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(yr(n.content),0,[]);return r}function yr(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function br(e,t){let n=N(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function xr(e){if(e===`private`||typeof e==`object`&&(e.scope===`private`||e.value===`private`))return`private`}var Sr=`format`;function Cr(e){return e===`write`||e===`delete`}function wr(e){return Cr(e)||e===`job`}function Tr(e,t){return e===`DELETE`||t===`delete`}var Er=`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 Dr(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function Or(e){let t=e.operation[`x-aventure-tool`];if(!Fr(e.path,e.operation,e.method===`GET`&&t?.auth===`none`,e.includeBinary===!0))return null;let n=Pr(e.operation.operationId),r=Gr(e.path,n),i=Nr(r,n,e.method),a=Ar(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:Kr(e.path),intent:o,cliPath:r,scope:s&&!Cr(o)?`read`:`write`,auth:a,visibility:xr(e.operation[`x-aventure-visibility`]),mutates:t?.mutates===!0||void 0,selfCredential:kr(e.operation)||void 0,stdinBody:e.operation.requestBody!==void 0&&Qn(e.operation.requestBody.content)===`json`,destructive:Tr(e.method,o)}}function kr(e){let t=e.security??[];return t.length>0&&t.every(e=>Object.keys(e).every(e=>e===`clerkApiKeyAuth`))}function Ar(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 jr={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`},Mr=`status`;function Nr(e,t,n){if(e.length===1&&e[0]===Mr)return`status`;let r=Object.hasOwn(jr,t)?jr[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 Fr(e,t,n,r){return Ir(e)&&t.hidden!==!0&&(n||!Lr.some(t=>t.test(e)))&&$n(t.requestBody?.content)&&(Vr(t.responses)||r&&Br(t))}function Ir(e){return e.startsWith(`/v1/`)||e.startsWith(`/v2/`)}var Lr=[/^\/v1\/auth\/(?:session|login|ui|registrations|password-resets|cli-authorizations|linkedin)(?:\/|$)/u,/^\/v1\/addresses\/locations(?:\/|$)/u,/^\/v1\/(?:chat\/completions|embeddings)$/u,/^\/v1\/observability(?:\/|$)/u,/^\/v1\/media\/identicons(?:\/|$)/u],Rr=/(?:^|-)(?:runs|jobs|turns)$/u;function zr(e,t){let{intent:n,method:r,mutates:i}=e;if(e.selfCredential===!0||e.deprecated===!0)return null;if(!wr(n)&&i!==!0&&r!==`PUT`&&r!==`PATCH`)return`aventure_read`;if(t===`private`)return n===`delete`?`aventure_delete`:`aventure_write`;if(n===`job`||i===!0)return`aventure_job`;let a=Pr(e.operationId),o=a===`enrich`||a===`create`&&Rr.test(e.cliPath.at(-2)??``);return n===`write`&&o?`aventure_job`:null}function Br(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>{let t=Object.values(e.content??{});return t.length>0&&t.every(e=>Wr(e.schema))})}function Vr(e){return Object.entries(e).filter(([e])=>e.startsWith(`2`)).every(([,e])=>Hr(e.content))}function Hr(e){if(e===void 0)return!0;let t=Object.entries(e);return t.length===0||t.some(([e,t])=>Ur(e)&&!Wr(t.schema))}function Ur(e){return e===`*/*`||e===`application/json`||e.endsWith(`+json`)}function Wr(e){return e?.format===`byte`||e?.format===`binary`}function Gr(e,t){let n=Yr(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 Kr(e){return $(Yr(e).at(0)??`system`)}function qr({operationId:e,tool:t}){if(t===void 0)throw Error(`Operation ${e} is not in the MCP catalog.`);return t}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Jr=e=>`--${$(e)}`;function Yr(e){return Xr(e).filter(e=>!Zr(e)&&!Qr(e))}function Xr(e){return e.split(`/`).filter(e=>e.length>0)}function Zr(e){return/^v\d+$/u.test(e)}function Qr(e){return e.startsWith(`{`)&&e.endsWith(`}`)}export{Bn as A,gt as B,Pn as C,Ln as D,Rn as E,Dn as F,N as G,qe as H,jn as I,Ve as K,A as L,Mn as M,Nn as N,zn as O,An as P,Ke as R,Gn as S,In as T,_t as U,pt as V,mt as W,X as _,wr as a,Un as b,Jr as c,zr as d,$ as f,Yn as g,Xn as h,Br as i,_n as j,Vn as k,Tr as l,vr as m,jr as n,Dr as o,Or as p,Sr as r,qr as s,Er as t,Cr as u,Zn as v,Fn as w,J as x,er as y,ht as z};
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{a as t}from"./package-DEeHDoOT.js";import{C as n,S as r,_ as i,b as a,c as o,g as s,i as c,m as l,p as u,s as d,x as f}from"./iso-l1vOidnb.js";import{c as p,p as m,r as h}from"./result-envelope-Dy-nSLrT.js";import{A as ee,O as te,S as ne,_ as re,b as ie,d as g,h as ae,i as _,l as v,n as y,p as b,w as x,x as oe}from"./esm-lPyPa01D.js";import{C as S,G as se,K as ce,L as le,M as ue,N as de,O as fe,Q as C,R as pe,T as me,U as he,V as w,W as ge,X as _e,Y as T,_ as ve,at as ye,d as be,f as xe,g as Se,h as Ce,it as we,j as Te,k as Ee,m as De,nt as E,ot as Oe,q as ke,s as Ae,tt as je,v as Me,x as Ne,y as Pe,z as D}from"./logging-BFASdeBx.js";import{basename as Fe,extname as Ie}from"node:path";import{readFile as Le}from"node:fs/promises";import{AsyncLocalStorage as Re}from"node:async_hooks";i({bodyPath:r(),valueField:d(i({path:d(r().nullable()).readonly(),type:c([`object`,`array`,`string`,`number`,`integer`,`boolean`]),nullable:o()})).readonly()});var O=n([l(``),r().regex(/^(?:\/(?:[^~/]|~[01])*)+$/)]),ze=f({readOperationId:r().min(1),writePointer:O,readPointer:O,readParameter:r().min(1).optional(),submittedMap:d(f({bodyPointer:O,readPointer:O,identityPointer:O})).min(1).optional(),fallback:f({writePointer:O,readPointer:O,readQueryName:r().min(1),readQueryValue:r().min(1)}).optional()}),Be=c([`QUEUED`,`STARTED`,`SEARCH`,`READ`,`CHECK`,`WRITE`,`FINISHED`]),k=Object.assign(n([Be,r()]),{enum:Be.enum});function Ve(e){return new URL(e,`https://placeholder.invalid`).pathname}function He(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean);return n.length!==r.length||r.some(We)?!1:n.every((e,t)=>Ue(e)||e===r[t])}function Ue(e){let t=e.slice(1,-1);return e.startsWith(`{`)&&e.endsWith(`}`)&&t.length>0&&!t.includes(`/`)&&!t.includes(`{`)&&!t.includes(`}`)}function We(e){if(Ue(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 A=[`get`,`post`,`put`,`patch`,`delete`],Ge=c([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`]);function Ke(e){let t=Ge.safeParse(e.toUpperCase());if(!t.success)throw Error(`Unsupported OpenAPI method: ${e}`);return t.data}function qe(e){let t=e.toLowerCase(),n=A.find(e=>e===t);if(n===void 0)throw Error(`Unsupported OpenAPI method: ${e}`);return n}var Je=[`oauth`,`start`,`poll`,`acknowledge`,`revoke`],Ye=f({name:r().regex(/^[A-Z][A-Z0-9_]*$/u)}),j=n([l(`private`),i({scope:r().optional(),value:r().optional()})]),Xe=()=>({$ref:r().optional(),description:r().optional(),type:n([r(),d(r())]).optional(),format:r().optional(),default:m.optional(),enum:d(m).optional(),"x-extensible-enum":d(m).optional(),"x-aventure-parsed-enum":o().optional(),readOnly:o().optional(),items:M.optional(),minItems:s().int().nonnegative().optional(),maxItems:s().int().nonnegative().optional(),properties:a(r(),M).optional(),required:d(r()).optional(),oneOf:d(M).optional(),anyOf:d(M).optional(),allOf:d(M).optional(),propertyNames:M.optional(),additionalProperties:n([M,o()]).optional(),"x-aventure-visibility":j.optional(),"x-aventure-cli-conflicts":d(d(r().min(1)).min(2)).min(1).optional(),"x-aventure-env":Ye.optional(),"x-aventure-detail":l(!0).optional(),"x-aventure-operation-only":d(r().min(1)).min(1).optional()}),M=u(()=>i(Xe())),Ze=i({in:r(),name:r(),required:o().optional(),description:r().optional(),schema:M.optional(),"x-aventure-visibility":j.optional(),"x-aventure-legacy-name":f({name:r().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`}))}),Qe=a(r(),i({schema:M.optional()})),$e=i({$ref:r().optional(),description:r().optional(),required:o().optional(),schema:M.optional(),"x-aventure-visibility":j.optional()}),et=i({description:r().optional(),headers:a(r(),$e).optional(),content:Qe.optional(),"x-aventure-standard-response":o().optional()}),tt=i({description:r().optional(),required:o().optional(),content:Qe.optional()}),nt=f({auth:c([`none`,`read`]).optional(),mutates:o().optional()}).optional(),rt=r().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)* [a-z0-9]+(?:-[a-z0-9]+)*$/u),it=r().regex(/^[a-z][A-Za-z0-9]*$/u),at=r().regex(/^--(?:no-)?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u),ot=f({command:rt,role:c(Je),summary:r().trim().min(1).optional(),description:r().trim().min(1).optional(),bodyOption:d(it).min(1).optional(),localOption:d(f({optionKey:it,flag:at,description:r().trim().min(1)})).min(1).optional()}).superRefine((t,n)=>{let r=[t.bodyOption??[],(t.localOption??[]).map(e=>e.optionKey),(t.localOption??[]).map(e=>e.flag)].some(e=>new Set(e).size!==e.length),i=(t.localOption??[]).some(t=>new e(t.flag).attributeName()!==t.optionKey);(r||i)&&n.addIssue({code:`custom`,message:`Composite CLI options must be unique and match their local flags`})}).optional(),st=i({operationId:r(),summary:r().optional(),description:r().optional(),tags:d(r()).optional(),deprecated:o().optional(),hidden:o().optional(),security:d(a(r(),d(r()))).optional(),parameters:d(Ze).optional(),requestBody:tt.optional(),responses:a(r(),et),"x-aventure-visibility":j.optional(),"x-aventure-tool":nt,"x-aventure-mutation-readback":ze.optional(),"x-aventure-completion-evidence":l(`response`).optional(),"x-aventure-run-activity":c([k.enum.SEARCH,k.enum.READ,k.enum.CHECK,k.enum.WRITE]).optional(),"x-aventure-cli-composite":ot,"x-aventure-cli":f({listed:l(!1)}).optional()}).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`})}}),ct=i(Object.fromEntries(A.map(e=>[e,st.optional()]))),lt=i({...Xe(),"x-aventure-noun":f({one:r().trim().min(1),other:r().trim().min(1)}).optional()});i({info:i({description:r().optional()}).optional(),tags:d(i({name:r(),description:r().optional(),"x-aventure-cli":f({section:c([`researchData`,`account`,`administration`,`cli`])}).optional()})).optional(),paths:a(r(),ct),webhooks:a(r(),i({post:i({description:r(),requestBody:tt})})).optional(),components:i({schemas:a(r(),lt),headers:a(r(),$e).optional()})}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.paths))for(let i of A){for(let[a,o]of Object.entries(r[i]?.responses??{}))for(let[r,s]of Object.entries(o.headers??{}))ft(e,s)||t.addIssue({code:`custom`,path:[`paths`,n,i,`responses`,a,`headers`,r,`$ref`],message:`response header '${r}' has an unresolved or malformed $ref`});let a=r[i]?.[`x-aventure-mutation-readback`];a!==void 0&&pt(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 ut=new Set([`page`,`size`,`sort`]);function N(e){return e?.$ref?.startsWith(`#/components/schemas/`)===!0&&e.$ref.slice(21)||void 0}function dt(e){return e?.$ref?.startsWith(`#/components/headers/`)===!0&&e.$ref.slice(21)||void 0}function ft(e,t){let n=dt(t);if(t.$ref!==void 0&&n===void 0)return!1;let r=n===void 0?t:e.components.headers?.[n];if(r===void 0||r.$ref!==void 0)return!1;let i=N(r.schema);return r.schema?.$ref===void 0||!!(i&&e.components.schemas[i])}function pt(e,t){for(let[n,r]of Object.entries(e))for(let e of A){let i=r[e];if(i?.operationId===t)return{method:e,template:n,operation:i}}return null}function mt(e,t,n){let r=Ve(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&&He(n,r))return{method:t,template:n,operation:e}}return null}function ht(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 gt(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 _t(e,t){let n={};for(let r of e.parameters??[]){if(r.in!==`query`||ut.has(r.name))continue;let e=t?.[r.name]??yt(r.schema?.default);e!==void 0&&(n[r.name]=e)}return Object.keys(n).length===0?void 0:n}var vt=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`;function yt(e){return vt(e)||Array.isArray(e)&&e.every(vt)?e:void 0}var bt={name:`span`,countItems:e=>e.length},xt=256,St=512;function Ct(e,t){let n=e&255|xt;return t&&(n|=St),n}function wt(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:ve(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Et(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Tt(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ct(n.traceFlags,e.parentSpanContext?.isRemote)}}function Tt(e,t){return{attributes:e.attributes?ve(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:Ct(e.context.traceFlags,e.context.isRemote)}}function Et(e,t){return{attributes:e.attributes?ve(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Dt(e,t){return{resourceSpans:kt(e,t)}}function Ot(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 kt(e,t){let n=Ot(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=>wt(e,t));o.push({scope:Ce(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Se(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}y();var At={serializeRequest:e=>{let t=Dt(e,De);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 v.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},jt=`otlp_http_span_exporter`,Mt=class extends Oe{constructor(e={}){super(xe(be(e,`TRACES`,`v1/traces`,{"Content-Type":`application/json`}),At,jt,bt,e.selfObsMeterProvider))}};he(),S(),Me();var Nt=`exception`,P=Symbol.for(`nodejs.util.inspect.custom`);function F(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function Pt(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})}`}y();var Ft=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:b.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=w.now(),this._performanceOffset=t-(this._performanceStartTime+w.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 v.warn(`Invalid attribute key: ${e}`),this;if(!je(t))return v.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 v.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&v.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),le(t)&&(le(n)||(n=t),t=void 0);let i=E(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];a!==void 0&&c>=a?s++:(o[e]=this._truncateToSize(t),c++)}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&&v.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=E(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===b.UNSET||this.status.code===b.OK)return this;let t={code:e.code};return e.code===b.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&v.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()?v.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=de(this.startTime,this.endTime),this._duration[0]<0&&(v.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&&v.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&v.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<=w.now())return ue(e+this._performanceOffset);if(typeof e==`number`)return D(e);if(e instanceof Date)return D(e.getTime());if(pe(e))return e;if(this._startTimeProvided)return D(Date.now());let t=w.now()-this._performanceStartTime;return Te(this.startTime,D(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[se]=e:e&&(e.code?n[ke]=e.code.toString():e.name&&(n[ke]=e.name),e.message&&(n[se]=e.message),e.stack&&(n[ce]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Nt,n,t):v.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}}`);v.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?(v.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}[P](e,t,n){return Pt(`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:F(this.resource)}},e,t,n)}},I;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(I||={});var It=`otel.component.name`,Lt=`otel.component.type`,Rt=`otel.span.parent.origin`,zt=`otel.span.sampling_result`,Bt=`otel.sdk.processor.span.processed`,Vt=`otel.sdk.processor.span.queue.capacity`,Ht=`otel.sdk.processor.span.queue.size`,Ut=`otel.sdk.span.live`,Wt=`otel.sdk.span.started`,Gt=`batching_span_processor`,Kt=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Wt,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Ut,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Jt(t);if(this.startedSpans.add(1,{[Rt]:qt(e),[zt]:n}),t===I.NOT_RECORD)return()=>{};let r={[zt]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function qt(e){return e?e.isRemote?`remote`:`local`:`none`}function Jt(e){switch(e){case I.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case I.RECORD:return`RECORD_ONLY`;case I.NOT_RECORD:return`DROP`}}var Yt=`2.11.0`;y(),S();var Xt=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`,Yt);this._tracerMetrics=new Kt(n)}startSpan(e,t={},n=g.active()){t.root&&(n=_.deleteSpan(n));let r=_.getSpan(n);if(we(n))return v.debug(`Instrumentation suppressed, returning Noop Span`),_.wrapSpanContext(ne);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!_.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??ae.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:E(e.attributes)})),d=E(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===re.RECORD_AND_SAMPLED?x.SAMPLED:x.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===re.NOT_RECORD)return v.debug(`Recording is off, propagating context in a non-recording span`),_.wrapSpanContext(h);let ee=E(Object.assign(d,f.attributes));return new Ft({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??g.active(),c=this.startSpan(e,i,s),l=_.setSpan(s,c);return g.with(l,o,void 0,c)}[P](e,t,n){return Pt(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:F(this._resource)},spanLimits:this._spanLimits},e,t,n)}};S();var Zt=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=>{C(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)})}},L=class{shouldSample(){return{decision:I.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},R=class{shouldSample(){return{decision:I.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};y(),S();var z=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(C(Error(`ParentBasedSampler must have a root sampler configured`)),new R),this._remoteParentSampled=e.remoteParentSampled??new R,this._remoteParentNotSampled=e.remoteParentNotSampled??new L,this._localParentSampled=e.localParentSampled??new R,this._localParentNotSampled=e.localParentNotSampled??new L}shouldSample(e,t,n,r,i,a){let o=_.getSpanContext(e);return!o||!ie(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&x.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&x.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};he();var Qt=new Map,$t=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=Qt.get(e)??0;if(Qt.set(e,r+1),this.standardAttrs={[Lt]:e,[It]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[ge]:`queue_full`},this.processedSpans=t.createCounter(Bt,{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(Vt,{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(Ht,{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,[ge]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};y(),S();var en=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 me(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(v.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):te();this._metrics=new $t(Gt,t,{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&x.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&&v.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1)):(this._droppedSpansCount>0&&(v.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);g.with(ye(g.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===Ee.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=>{C(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,C(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)}},tn=class extends en{onShutdown(){}},nn=8,rn=16,an=class{generateTraceId=on(rn);generateSpanId=on(nn)},B=Buffer.allocUnsafe(rn);function on(e){return function(){for(let t=0;t<e/4;t++)B.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(B[t]>0);t++)t===e-1&&(B[e-1]=1);return B.toString(`hex`,0,e)}}y();var V;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(V||={});var sn=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Pe();let t=e.spanProcessors??[];this._activeSpanProcessor=new Zt(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new z({root:new R}),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 an,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return te()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Xt({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=V.timeout},t);e.forceFlush().then(()=>{clearTimeout(i),r!==V.timeout&&(r=V.resolved,n(r))}).catch(e=>{clearTimeout(i),r=V.error,n(e)})}));return new Promise((e,t)=>{Promise.all(n).then(n=>{let r=n.filter(e=>e!==V.resolved);r.length>0?t(r):e()}).catch(e=>t([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[P](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Pt(`TracerProvider`,{resource:{attributes:F(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};y();var cn=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:oe(t)&&this._accumulate(t)<this._upperBound?I.RECORD_AND_SAMPLED:I.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}};y(),S();var H;(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`})(H||={});var U=1;function ln(){return{sampler:un(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:T(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:T(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function un(){let e=_e(`OTEL_TRACES_SAMPLER`)??H.ParentBasedAlwaysOn;switch(e){case H.AlwaysOn:return new R;case H.AlwaysOff:return new L;case H.ParentBasedAlwaysOn:return new z({root:new R});case H.ParentBasedAlwaysOff:return new z({root:new L});case H.TraceIdRatio:return new cn(dn());case H.ParentBasedTraceIdRatio:return new z({root:new cn(dn())});default:return v.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${H.ParentBasedAlwaysOn}".`),new z({root:new R})}}function dn(){let e=T(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(v.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${U}.`),U):e<0||e>1?(v.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${U}.`),U):e}S();function fn(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}S();var pn=class extends sn{constructor(e={}){let t=fe({},ln(),fn(e));delete t.generalLimits,super(t)}};S();var mn=class extends tn{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=T(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};y(),Me();var hn=`aventure-mcp-server`,gn=`aventure=mcp`,_n=`langfuse.session.id`,vn=`/api/public/otel/v1/traces`,yn=5e3,bn=new Set([`langfuse.observation.input`,`langfuse.observation.output`,`langfuse.observation.status_message`]),xn=[`OTEL_EXPORTER_OTLP_HEADERS`,`OTEL_EXPORTER_OTLP_TRACES_HEADERS`],W,G;function K(e){return e?.trim()||void 0}function Sn(){return K(process.env.GIT_SHA)??K(process.env.SENTRY_RELEASE)??t().version}function Cn(){let e=K(process.env.LANGFUSE_BASE_URL),t=K(process.env.LANGFUSE_PUBLIC_KEY),n=K(process.env.LANGFUSE_SECRET_KEY);if(e!==void 0&&t!==void 0&&n!==void 0){for(let e of xn){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 Mt({url:new URL(vn,e).href,headers:{Authorization:`Basic ${Buffer.from(`${t}:${n}`).toString(`base64`)}`,"x-langfuse-ingestion-version":`4`},timeoutMillis:yn})}}function wn(e){let t={};for(let[n,r]of Object.entries(e.attributes))bn.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 Tn(e){return{export:(t,n)=>e.export(t.map(wn),n),shutdown:()=>e.shutdown(),forceFlush:()=>e.forceFlush?.()??Promise.resolve()}}function En(){if(W!==void 0)return G;let e=K(process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),t=[...e===void 0?[]:[Tn(new Mt({url:e,timeoutMillis:yn}))],...[Cn()].filter(e=>e!==void 0)];return W=new pn({sampler:new R,resource:Ne({...Ae(),"service.version":Sn()}),spanProcessors:t.map(e=>new mn(e,{exportTimeoutMillis:yn}))}),G=t.length===0?void 0:W.getTracer(hn),G}function Dn(){En()}var On=/^00-(?<traceId>[0-9a-f]{32})-(?<spanId>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})$/u,kn=/[13579bdf]$/u;function An(e,t,n){let r=En();if(r===void 0)return;let i=On.exec(n??``)?.groups,a=i?.traceId===void 0||i.spanId===void 0?ee:_.setSpanContext(ee,{traceId:i.traceId,spanId:i.spanId,traceFlags:kn.test(i.flags??``)?x.SAMPLED:x.NONE,isRemote:!0});return r.startSpan(e,{kind:ae.SERVER,attributes:{"langfuse.trace.name":e,...t,"langfuse.environment":Ae()[`deployment.environment.name`],"langfuse.release":Sn()}},a)}function jn(e){let{traceId:t,spanId:n,traceFlags:r}=e.spanContext();return`00-${t}-${n}-${(r&x.SAMPLED)===0?`00`:`01`}`}function Mn(e,t,n){e.setAttributes(t),e.setStatus({code:n?b.ERROR:b.OK}),e.end()}async function Nn(){let e=W;W=void 0,G=void 0,await e?.shutdown()}var q=new Re,Pn=`X-Client-Request-Id`,Fn=()=>q.getStore()?.requestId,In=()=>q.getStore()?.toolApiCall,Ln=()=>q.getStore()?.userBearerToken;function Rn(){let e=q.getStore(),t=[...e?.sessionId===void 0?[]:[`${_n}=${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?{}:{[Pn]:e.requestId},...e?.traceparent===void 0?{}:{traceparent:e.traceparent,tracestate:gn,...t.length===0?{}:{baggage:t}}}}function zn(e,t){return q.run({...q.getStore(),requestId:e,toolApiCall:{failed:!1}},t)}function Bn(e,t){return q.run({...q.getStore(),userBearerToken:e},t)}function Vn(e,t){return q.run({...q.getStore(),...e},t)}var Hn=Object.freeze({total:8,perOrigin:2,originLimit:64,failureThreshold:3,cooldownMs:3e4,idleMs:3e4,halfOpenProbes:1}),Un=Object.freeze({total:128,perOrigin:64,originLimit:64,failureThreshold:5,cooldownMs:15e3,idleMs:3e5,halfOpenProbes:1}),Wn=new WeakMap,J=class extends Error{reason;constructor(e){super(e===`capacity`?`Origin capacity exceeded; try again later.`:`Origin circuit is open; try again later.`),this.reason=e}};function Gn(e,t){let n=Date.now(),r=Wn.get(t);r===void 0&&(r={active:0,origin:new Map},Wn.set(t,r));for(let[i,a]of r.origin)i!==e&&a.active===0&&a.updatedAt+t.idleMs<=n&&r.origin.delete(i);let i=r.origin.get(e);if(i===void 0){if(r.origin.size>=t.originLimit)throw new J(`capacity`);i={active:0,failures:0,openUntil:0,updatedAt:n},r.origin.set(e,i)}if(i.openUntil>n||i.failures>=t.failureThreshold&&i.active>=t.halfOpenProbes)throw new J(`circuit`);if(r.active>=t.total||i.active>=t.perOrigin)throw new J(`capacity`);return i.active++,r.active++,{finish:Kn(r,i,t)}}function Kn(e,t,n){let r=!1;return i=>{r||(r=!0,t.active--,e.active--,t.updatedAt=Date.now(),i===`failure`?(t.failures++,t.failures>=n.failureThreshold&&(t.openUntil=t.updatedAt+n.cooldownMs)):i===`success`&&(t.failures=0,t.openUntil=0))}}var qn=3e4,Jn=20,Y=52428800;async function Yn(e,t,n,r={}){let i=er(X(e.requestBody?.content),n);if(!i.ok||i.data===null)return h(i.summary,i.warnings);let a=i.data;if(e.requestBody?.required===!0&&t===void 0&&a?.kind!==`multipart`)return h(`Request body is required.`);if(a?.kind===`multipart`)return await nr(e.requestBody?.required===!0,a.schema,t,r);let o=a?.contentType??r.defaultContentType;return p(`Request body prepared`,{...t===void 0?{}:{body:t},...o===void 0?{}:{contentType:o}})}function Xn(e){if(typeof e!=`string`)return p(`Request body unchanged`,e);let t=e.trimStart().slice(0,1);if(t!==`{`&&t!==`[`)return p(`Request body unchanged`,e);try{let t=m.safeParse(JSON.parse(e));if(!t.success)throw t.error;return p(`Request body parsed`,t.data)}catch(e){return h(`Request body string must be valid JSON: ${e instanceof Error?e.message:String(e)}`)}}function Zn(e,t){let n=e?.schema;if(n===void 0)return!1;let r=N(n),i=n.type??(r===void 0?void 0:t[r]?.type);return Array.isArray(i)?i.includes(`array`):i===`array`}function Qn(e){return X(e)[0]?.kind??`json`}function $n(e){return e===void 0||Object.keys(e).length===0||X(e).length>0}function X(e){let t=Object.entries(e??{});return[...t.flatMap(e=>hr(e[0])?[tr(e,`json`)]:[]),...t.flatMap(e=>gr(e[0])?[tr(e,`multipart`)]:[])]}function er(e,t){if(t===void 0)return p(`Default request content selected`,e[0]);let n=Q(t),r=e.find(e=>Q(e.contentType)===n);return r===void 0?h(`Request Content-Type '${t}' is not supported. Supported choices: ${e.map(({contentType:e})=>e).join(`, `)||`none`}.`):p(`Explicit request content selected`,r)}function tr(e,t){let n=e[1].schema;return{contentType:e[0],kind:t,...n===void 0?{}:{schema:n}}}async function nr(e,t,n,r){if(!e&&n==null)return p(`Optional multipart body omitted`,{});let i=rr(n);if(!i.ok||i.data===null)return h(i.summary,i.warnings);let a=new FormData;for(let e of ir(t)){let t=i.data[e.name];if(t==null){if(e.required)return h(`Multipart body requires '${e.name}'.`)}else{if(Array.isArray(t)&&t.length<(e.schema.minItems??0))return h(`Multipart part '${e.name}' requires more entries.`);if(Array.isArray(t)&&t.length>(e.schema.maxItems??2**53-1))return h(`Multipart part '${e.name}' has too many entries.`);if(ar(e.schema)||or(e.schema)){let n=or(e.schema)?t:[t];if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))return h(`Multipart part '${e.name}' must contain file paths or URLs.`);for(let t of n){if(typeof t!=`string`)continue;let n=await lr(t,r);if(!n.ok||n.data===null)return h(n.summary,n.warnings,{httpStatus:n.httpStatus});a.append(e.name,n.data.blob,n.data.filename)}}else if(sr(e.schema,t)){let n=JSON.stringify(t);a.append(e.name,new Blob([n],{type:`application/json`}),`${e.name}.json`)}else{let n=cr(a,e.name,t);if(!n.ok)return n}}}return p(`Multipart body prepared`,{body:a})}function rr(e){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=Object.fromEntries(Object.entries(e));return p(`Multipart input parsed`,t)}return h(`Multipart request body must be a JSON object keyed by form part name.`)}function ir(e){let t=new Set(e?.required??[]);return Object.entries(e?.properties??{}).map(([e,n])=>({name:e,schema:n,required:t.has(e)}))}function ar(e){return e.type===`string`&&e.format===`binary`}function or(e){return e.type===`array`&&e.items!==void 0&&ar(e.items)}function sr(e,t){return typeof t!=`object`||!t||Array.isArray(t)?!1:e.type===`object`||typeof e.$ref==`string`&&e.$ref.length>0}function cr(e,t,n){if(Array.isArray(n)){for(let r of n){let n=cr(e,t,r);if(!n.ok)return n}return p(`Multipart scalar array appended`,null)}return typeof n==`object`?h(`Multipart part '${t}' must be scalar.`):(e.append(t,String(n)),p(`Multipart scalar appended`,null))}async function lr(e,t){if(t.signal?.aborted||(t.deadline??1/0)<=Date.now()){let e=In();return e!==void 0&&!Z(t.signal)&&(e.failed=!0),h(`Media preparation canceled or invocation deadline exceeded.`)}return pr(e)?Fn()===void 0?await ur(e,t):h(`MCP media URL fetching is disabled. Pass the page as sourceUrl in the JSON body instead.`):Fn()===void 0?await fr(e,t.signal):h(`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 ur(e,t){let n=new AbortController,r=Math.min(qn,(t.deadline??1/0)-Date.now()),i=setTimeout(()=>n.abort(),Math.max(r,1)),a=t.signal?AbortSignal.any([n.signal,t.signal]):n.signal,o,s,c=`neutral`;try{if(a.throwIfAborted(),r<=0)throw Error(`Invocation deadline exceeded.`);let t=new URL(e),n=t;for(let e=0;;e++){a.throwIfAborted(),o=Gn(n.origin,Hn),c=`failure`,s=await fetch(n.href,{signal:a,redirect:`manual`});let t=s.headers.get(`location`);if(![301,302,303,307,308].includes(s.status)||t===null)break;if(await s.body?.cancel(),e>=Jn)throw Error(`Media URL exceeded the redirect limit.`);let r=new URL(t,n);o.finish(`success`),o=void 0,s=void 0,n=r}if(c=s.status===429||s.status>=500?`failure`:`success`,!s.ok)return await s.body?.cancel(),h(`Failed to fetch media URL: ${s.status} ${s.statusText}`,[],{httpStatus:s.status});c=`failure`;let i=s.headers.get(`content-type`)?.split(`;`)[0]?.trim()??mr(t.pathname)??``,l=await dr(s,{type:i,signal:a});return c=`success`,p(`URL media fetched`,{blob:l,filename:Fe(t.pathname)||`upload`})}catch(e){(e instanceof J||a.aborted||r<=0)&&(c=`failure`),e instanceof RangeError&&(c=`success`),Z(t.signal)&&(c=`neutral`),s?.body&&!s.body.locked&&!s.bodyUsed&&await s.body.cancel();let i=Z(t.signal)?`Failed to fetch media URL: canceled.`:t.signal?.aborted?`Failed to fetch media URL: invocation deadline exceeded.`:n.signal.aborted?`Failed to fetch media URL: timed out after ${r}ms.`:`Failed to fetch media URL: ${e instanceof Error?e.message:String(e)}`;return h(i,[],{httpStatus:e instanceof RangeError?void 0:s?.status})}finally{clearTimeout(i);let e=In();e!==void 0&&c===`failure`&&!Z(t.signal)&&(e.failed=!0),o?.finish(c)}}function Z(e){return e?.aborted===!0&&!(e.reason instanceof DOMException&&e.reason.name===`TimeoutError`)}async function dr(e,{type:t,signal:n}){let r=e.body?.getReader();if(r===void 0)throw Error(`Media URL returned no body.`);let i=[],a=0,o=!1,s,c=new Promise(e=>{s=()=>e({done:!0,value:void 0}),n.addEventListener(`abort`,s,{once:!0})});try{if(Number(e.headers.get(`content-length`))>Y)throw RangeError(`Media exceeds the ${Y}-byte upload limit.`);for(;;){n.throwIfAborted();let e=await Promise.race([r.read(),c]);if(n.throwIfAborted(),e.done)break;if(a+=e.value.byteLength,a>Y)throw RangeError(`Media exceeds the ${Y}-byte upload limit.`);i.push(new Blob([e.value.slice()]))}return o=!0,new Blob(i,{type:t})}finally{s&&n.removeEventListener(`abort`,s),o||await r.cancel(),r.releaseLock()}}async function fr(e,t){try{let n=mr(e)??``,r=await Le(e,{signal:t});return p(`File media read`,{blob:new Blob([r],{type:n}),filename:Fe(e)})}catch(t){return h(`Failed to read media file '${e}': ${t instanceof Error?t.message:String(t)}`)}}function pr(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function mr(e){return _r[Ie(e).toLowerCase()]}function hr(e){let t=Q(e);return t===`*/*`||t===`application/json`||t.endsWith(`+json`)}function gr(e){return Q(e)===`multipart/form-data`}var Q=e=>e.split(`;`)[0]?.trim().toLowerCase()??``,_r={".gif":`image/gif`,".heic":`image/heic`,".heif":`image/heif`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".png":`image/png`,".webp":`image/webp`};function vr(e,t,n){let r=new Map,i=(t,a,o)=>{let s=N(t);if(a>n||s!==void 0&&o.includes(s))return;let c=s===void 0?o:[...o,s],l=br(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(yr(n.content),0,[]);return r}function yr(e){return e?.[`application/json`]?.schema??Object.values(e??{}).find(e=>e.schema!==void 0)?.schema}function br(e,t){let n=N(t);return{...n===void 0?void 0:e.components.schemas[n],...t}}function xr(e){if(e===`private`||typeof e==`object`&&(e.scope===`private`||e.value===`private`))return`private`}var Sr=`format`;function Cr(e){return e===`write`||e===`delete`}function wr(e){return Cr(e)||e===`job`}function Tr(e,t){return e===`DELETE`||t===`delete`}var Er=`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 Dr(e,t){let n=e===`array`?t:e;return n===void 0||n===`string`}function Or(e){let t=e.operation[`x-aventure-tool`];if(!Fr(e.path,e.operation,e.method===`GET`&&t?.auth===`none`,e.includeBinary===!0))return null;let n=Pr(e.operation.operationId),r=Gr(e.path,n),i=Nr(r,n,e.method),a=Ar(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:Kr(e.path),intent:o,cliPath:r,scope:s&&!Cr(o)?`read`:`write`,auth:a,visibility:xr(e.operation[`x-aventure-visibility`]),mutates:t?.mutates===!0||void 0,selfCredential:kr(e.operation)||void 0,stdinBody:e.operation.requestBody!==void 0&&Qn(e.operation.requestBody.content)===`json`,destructive:Tr(e.method,o)}}function kr(e){let t=e.security??[];return t.length>0&&t.every(e=>Object.keys(e).every(e=>e===`clerkApiKeyAuth`))}function Ar(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 jr={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`},Mr=`status`;function Nr(e,t,n){if(e.length===1&&e[0]===Mr)return`status`;let r=Object.hasOwn(jr,t)?jr[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 Fr(e,t,n,r){return Ir(e)&&t.hidden!==!0&&(n||!Lr.some(t=>t.test(e)))&&$n(t.requestBody?.content)&&(Vr(t.responses)||r&&Br(t))}function Ir(e){return e.startsWith(`/v1/`)||e.startsWith(`/v2/`)}var Lr=[/^\/v1\/auth\/(?:session|login|ui|registrations|password-resets|cli-authorizations|linkedin)(?:\/|$)/u,/^\/v1\/addresses\/locations(?:\/|$)/u,/^\/v1\/(?:chat\/completions|embeddings)$/u,/^\/v1\/observability(?:\/|$)/u,/^\/v1\/media\/identicons(?:\/|$)/u],Rr=/(?:^|-)(?:runs|jobs|turns)$/u;function zr(e,t){let{intent:n,method:r,mutates:i}=e;if(e.selfCredential===!0||e.deprecated===!0)return null;if(!wr(n)&&i!==!0&&r!==`PUT`&&r!==`PATCH`)return`aventure_read`;if(t===`private`)return n===`delete`?`aventure_delete`:`aventure_write`;if(n===`job`||i===!0)return`aventure_job`;let a=Pr(e.operationId),o=a===`enrich`||a===`create`&&Rr.test(e.cliPath.at(-2)??``);return n===`write`&&o?`aventure_job`:null}function Br(e){let t=Object.entries(e.responses).filter(([e])=>e.startsWith(`2`));return t.length>0&&t.every(([,e])=>{let t=Object.values(e.content??{});return t.length>0&&t.every(e=>Wr(e.schema))})}function Vr(e){return Object.entries(e).filter(([e])=>e.startsWith(`2`)).every(([,e])=>Hr(e.content))}function Hr(e){if(e===void 0)return!0;let t=Object.entries(e);return t.length===0||t.some(([e,t])=>Ur(e)&&!Wr(t.schema))}function Ur(e){return e===`*/*`||e===`application/json`||e.endsWith(`+json`)}function Wr(e){return e?.format===`byte`||e?.format===`binary`}function Gr(e,t){let n=Yr(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 Kr(e){return $(Yr(e).at(0)??`system`)}function qr({operationId:e,tool:t}){if(t===void 0)throw Error(`Operation ${e} is not in the MCP catalog.`);return t}function $(e){return e.replace(/([a-z0-9])([A-Z])/gu,`$1-$2`).replace(/[^A-Za-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).toLowerCase()}var Jr=e=>`--${$(e)}`;function Yr(e){return Xr(e).filter(e=>!Zr(e)&&!Qr(e))}function Xr(e){return e.split(`/`).filter(e=>e.length>0)}function Zr(e){return/^v\d+$/u.test(e)}function Qr(e){return e.startsWith(`{`)&&e.endsWith(`}`)}export{Bn as A,gt as B,Pn as C,Ln as D,Rn as E,Dn as F,N as G,qe as H,jn as I,Ve as K,A as L,Mn as M,Nn as N,zn as O,An as P,Ke as R,Gn as S,In as T,_t as U,pt as V,mt as W,X as _,wr as a,Un as b,Jr as c,zr as d,$ as f,Yn as g,Xn as h,Br as i,_n as j,Vn as k,Tr as l,vr as m,jr as n,Dr as o,Or as p,Sr as r,qr as s,Er as t,Cr as u,Zn as v,Fn as w,J as x,er as y,ht as z};
@@ -11,4 +11,4 @@ Environment:
11
11
  AVENTURE_MCP_PORT Select the HTTP listening port.
12
12
  AVENTURE_MCP_PATH Select the MCP route.
13
13
  AVENTURE_MCP_JSON_LIMIT Limit request body size.
14
- `).parseAsync()).opts(),[{describeError:o,logError:s,logInfo:c,shutdownLogging:l,useServerProcessLogging:u},{AUTH_SECRET_NAME:d},{metricsScrapeSecretFromEnvironment:f},{catalogOAuthDiscovery:p},{captureSentryException:m,initializeSentry:h,shutdownSentry:g},{HOSTED_REQUEST_DEADLINE_MS:_,startStreamableHttpServer:v}]=await Promise.all([import(`../chunks/logging-DFc_SC4o.js`),import(`../chunks/env-DiNizPjg.js`),import(`../chunks/private-telemetry-credential-DbamSREI.js`),import(`../chunks/oauth-discovery-DJHuzqON.js`),import(`../chunks/sentry-CYGpefm8.js`),import(`../chunks/streamable-http-DLrhql6w.js`)]),y=_+5e3;u(),await h(),delete process.env[d.authToken];var b=E(),x=process.env.AVENTURE_MCP_PATH??`/mcp`,S=process.env.AVENTURE_MCP_JSON_LIMIT??`10mb`,C=f()||void 0,w=!1;function T(e){Promise.allSettled([l(),g()]).then(e=>{for(let t of e){if(t.status!==`rejected`)continue;let e=o(t.reason);process.stderr.write(`${i.bin[0]} telemetry shutdown failed: ${e}\n`)}}).catch(e=>{let t=o(e);process.stderr.write(`${i.bin[0]} telemetry shutdown failed: ${t}\n`)}).finally(()=>process.exit(e))}v({port:b,host:a,path:x,resolveOAuthDiscovery:p(),jsonBodyLimit:S,metricsScrapeSecret:C}).then(e=>{c({component:`aventure-mcp-server`,event:`server_listening`,fields:{port:b,path:x}}),process.stdout.write(`${i.bin[0]} listening at http://localhost:${b}${x}\n`);let t=t=>{if(w)return;w=!0,c({component:`aventure-mcp-server`,event:`server_shutdown_started`,fields:{signal:t}});let n=setTimeout(()=>{s({component:`aventure-mcp-server`,event:`server_shutdown_timeout`,message:`MCP server did not drain before the platform forced-shutdown window`,fields:{signal:t,forceExitMs:y}}),T(1)},y);n.unref(),e.close().then(()=>{clearTimeout(n),c({component:`aventure-mcp-server`,event:`server_shutdown_completed`,fields:{signal:t}}),T(0)}).catch(e=>{let r=o(e);clearTimeout(n),s({component:`aventure-mcp-server`,event:`server_shutdown_failed`,message:r,fields:{signal:t},error:e}),T(1)})};for(let e of[`SIGTERM`,`SIGINT`])process.on(e,t)},async e=>{let t=o(e);m(e,`server_start_failed`),s({component:`aventure-mcp-server`,event:`server_start_failed`,message:t,error:e}),process.stderr.write(`${i.bin[0]} failed to start: ${t}\n`),T(1)});function E(){let e=process.env.AVENTURE_MCP_PORT??process.env.PORT??`3333`,t=Number(e);if(!Number.isInteger(t)||t<1||t>r)throw Error(`Invalid MCP server port: ${e}`);return t}export{};
14
+ `).parseAsync()).opts(),[{describeError:o,logError:s,logInfo:c,shutdownLogging:l,useServerProcessLogging:u},{AUTH_SECRET_NAME:d},{metricsScrapeSecretFromEnvironment:f},{catalogOAuthDiscovery:p},{captureSentryException:m,initializeSentry:h,shutdownSentry:g},{HOSTED_REQUEST_DEADLINE_MS:_,startStreamableHttpServer:v}]=await Promise.all([import(`../chunks/logging-CD850a3X.js`),import(`../chunks/env-CXx2XZBl.js`),import(`../chunks/private-telemetry-credential-DbamSREI.js`),import(`../chunks/oauth-discovery-TFMijsxD.js`),import(`../chunks/sentry-DCq0eQ69.js`),import(`../chunks/streamable-http-BfelvD1R.js`)]),y=_+5e3;u(),await h(),delete process.env[d.authToken];var b=E(),x=process.env.AVENTURE_MCP_PATH??`/mcp`,S=process.env.AVENTURE_MCP_JSON_LIMIT??`10mb`,C=f()||void 0,w=!1;function T(e){Promise.allSettled([l(),g()]).then(e=>{for(let t of e){if(t.status!==`rejected`)continue;let e=o(t.reason);process.stderr.write(`${i.bin[0]} telemetry shutdown failed: ${e}\n`)}}).catch(e=>{let t=o(e);process.stderr.write(`${i.bin[0]} telemetry shutdown failed: ${t}\n`)}).finally(()=>process.exit(e))}v({port:b,host:a,path:x,resolveOAuthDiscovery:p(),jsonBodyLimit:S,metricsScrapeSecret:C}).then(e=>{c({component:`aventure-mcp-server`,event:`server_listening`,fields:{port:b,path:x}}),process.stdout.write(`${i.bin[0]} listening at http://localhost:${b}${x}\n`);let t=t=>{if(w)return;w=!0,c({component:`aventure-mcp-server`,event:`server_shutdown_started`,fields:{signal:t}});let n=setTimeout(()=>{s({component:`aventure-mcp-server`,event:`server_shutdown_timeout`,message:`MCP server did not drain before the platform forced-shutdown window`,fields:{signal:t,forceExitMs:y}}),T(1)},y);n.unref(),e.close().then(()=>{clearTimeout(n),c({component:`aventure-mcp-server`,event:`server_shutdown_completed`,fields:{signal:t}}),T(0)}).catch(e=>{let r=o(e);clearTimeout(n),s({component:`aventure-mcp-server`,event:`server_shutdown_failed`,message:r,fields:{signal:t},error:e}),T(1)})};for(let e of[`SIGTERM`,`SIGINT`])process.on(e,t)},async e=>{let t=o(e);m(e,`server_start_failed`),s({component:`aventure-mcp-server`,event:`server_start_failed`,message:t,error:e}),process.stderr.write(`${i.bin[0]} failed to start: ${t}\n`),T(1)});function E(){let e=process.env.AVENTURE_MCP_PORT??process.env.PORT??`3333`,t=Number(e);if(!Number.isInteger(t)||t<1||t>r)throw Error(`Invalid MCP server port: ${e}`);return t}export{};