@aventurevc/mcp-server 0.8.239 → 0.8.241

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.
@@ -1 +1 @@
1
- import{d as e}from"./tool-policy-C37kGt8n.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return t?.[e]?.section??d[e]}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,directory:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,"research-runs":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
1
+ import{d as e}from"./tool-policy-NTXy68a8.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return t?.[e]?.section??d[e]}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,directory:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,"research-runs":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./commander-DEj7N1b9.js";import{o as t}from"./tool-policy-NTXy68a8.js";import{a as n,o as r}from"./cli-help-policy-BSkCikW7.js";import{n as i,t as a}from"./contract-parameter-DRNxhCKs.js";function o(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=d(t,i(e,t),n);if(t.legacyName===void 0)return r;let a=d(t,i(e,t,t.legacyName),n).flag;return a===r.flag?r:Object.assign(r,{legacyFlag:a})})}),n=e.requestBody?.map(n=>{let r=l(e,t,n),i=c(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`)),a=r?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,mutates:e.projection.mutates,errorResponse:e.errorResponse,successResponse:a,detailField:r?.detailField,header:r?.header,parameters:t}})}function s(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function c(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function l(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>u(e.name)-u(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=a(e,t,r);return r.add(n),[d(t,n,`body`)]})}function u(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function d(i,a,o){let s=i.itemSchemaEnum??i.schemaEnum,c=r(i.schemaType,i.itemSchemaType,i.schemaFormat,a),l=`${t(a)} ${i.schemaType===`boolean`?`[${c}]`:`<${c}>`}`;return{name:i.name,optionKey:new e(l).attributeName(),flag:l,required:i.required&&i.schemaDefault===void 0,description:n(i.description,s),schemaType:i.schemaType,schemaFormat:i.schemaFormat,itemSchemaType:i.itemSchemaType,defaultValue:f(i.schemaDefault),choices:s,...i.envName===void 0?{}:{envName:i.envName},...i.visibility&&{visibility:i.visibility},location:o}}var f=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{s as n,o as t};
@@ -1 +1 @@
1
- import"./tool-policy-C37kGt8n.js";function e(e,t,n=t.inputName){if(t.in===`body`)return n;let r=f.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?d(c(n!==`id`&&n!==`slug`?n:`${i(e.path)}${s(n)}`),t):r.inputName}function t(e,t,r=o(e)){return n(a(e,t),new Set(r))}function n(e,t){if(!t.has(e))return e;let n=`body${s(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function r(e,t,n){return`${e}[${t}].${n}`}function i(e){return p.find(([,t])=>t.test(e))?.[0]??`record`}function a(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=l(t);return d(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?c(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function o(t){return new Set(t.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(n=>e(t,n)))}function s(e){return e.replace(/^./u,e=>e.toUpperCase())}function c(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function l(e){let t=c(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?u(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function u(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function d(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var f=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],p=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];export{e as n,r,t};
1
+ import"./tool-policy-NTXy68a8.js";function e(e,t,n=t.inputName){if(t.in===`body`)return n;let r=f.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?d(c(n!==`id`&&n!==`slug`?n:`${i(e.path)}${s(n)}`),t):r.inputName}function t(e,t,r=o(e)){return n(a(e,t),new Set(r))}function n(e,t){if(!t.has(e))return e;let n=`body${s(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function r(e,t,n){return`${e}[${t}].${n}`}function i(e){return p.find(([,t])=>t.test(e))?.[0]??`record`}function a(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=l(t);return d(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?c(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function o(t){return new Set(t.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(n=>e(t,n)))}function s(e){return e.replace(/^./u,e=>e.toUpperCase())}function c(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function l(e){let t=c(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?u(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function u(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function d(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var f=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],p=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];export{e as n,r,t};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./package-CZBWjlYb.js";import{C as t,S as n,_ as r,c as i,d as a,g as o,i as s,s as c}from"./iso-l1vOidnb.js";import{c as l,f as u,l as d,o as ee,s as te,u as ne}from"./tool-policy-C37kGt8n.js";import{i as re,t as f}from"./human-text-cap-BcNmIPQA.js";import{n as ie,t as ae}from"./contract-parameter-zkhCaKUz.js";var p=2,oe=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function m(e,t){let n=v(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&m(e,`person`),h(e,se(n),n),h(e,ce(n),n))}function se(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=p&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;let n=e.endsWith(`es`)?e.slice(0,-2):``;if(n.length>=p&&n!==`us`&&/(?:s|ss|sh|ch|x|z)$/u.test(n))return n;if(e.length>p&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function ce(e){if(e===`person`)return`people`;if(e!==`new`&&e!==`news`&&e!==`status`&&e!==`us`){if(e.length>=p&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e))return`${e.slice(0,-1)}ies`;if(!(e.length>=p&&e.endsWith(`es`)))return e.length>=p&&/(?:s|ss|sh|ch|x|z)$/u.test(e)?`${e}es`:e.endsWith(`s`)?void 0:`${e}s`}}function h(e,t,n){t!==void 0&&t!==n&&t.length>=p&&/^[a-z]+$/u.test(t)&&e.add(t)}function g(e){let t=new Set(_(e)),n=Array.from(t);for(let e of n)m(t,e);return t}function le(e){return _(e).map(g)}function ue(e,t){if(e.length===0)return!1;let n=g(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function _(e){return v(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!oe.has(e))}function v(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}function y(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>b(e)),...n.flatMap(e=>e.parameter.map(t=>b(t,n.length>1?e.contentType:void 0))),...de(n)],i=[t,...e.cliPath].join(` `),a=e.mutates===!0||l(e.intent),o=u(e),s=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:te(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ne(e.path)||o===null?null:d(o),body:{hasBody:s!==void 0,kind:s?.kind??null,...s!==void 0&&n.length>1?{contentType:s.contentType}:{},required:s?.required??!1,description:s?.description??``,requiredPath:s?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function b(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function de(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function x(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var fe=[`-id`,`-slug`,`-url`],pe=[`--id`,`--slug`,`--url`],me=`/v1/lookup`,he=`--from-file "<path>"`;function ge(t,n,r=e().bin[0]){let i=y(n,r),a=i.find(e=>e.operationId===t);return a===void 0?[]:w(a,i)}function S(t,n,r=e().bin[0]){let i=n.find(e=>e.operationId===t),[a]=i===void 0?[]:y([i],r);return a&&C(a,E(a,!1))}function _e(t,n,r,i=e().bin[0]){let a=e=>{let t=e.findIndex((e,t)=>r[t]!==e);return t===-1?e.length:t},o=`${r[0]} get`,[s,c]=n.filter(({method:e,path:n,parameters:r,cliPath:i})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return e===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===t&&n.endsWith(`/{${c.name}}`)&&(a(i)>1||i.join(` `)===o)}).toSorted((e,t)=>a(t.cliPath)-a(e.cliPath));if(s!==void 0&&(c===void 0||a(c.cliPath)!==a(s.cliPath)))return S(s.operationId,n,i)}function C(e,t){return[e.cli.command,...t,`--data`].join(` `)}function w(e,t){return[`example: ${C(e,E(e))}`,...ve(e,t)]}function ve(e,t){return x(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${D(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===me),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${D(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var T=/(?:^|\.)text$/u;function E(e,t=!0){let n=x(e),r=n.filter(e=>e.required),i=e.body.kind===`json`&&n.some(e=>e.location===`body`&&T.test(e.wireName)&&(e.required||!e.wireName.includes(`.`))),a=i?r.filter(e=>e.location!==`body`):r,o=(r.length>0||!t?a:ye(e)).map(D);return i||(e.body.required||e.body.requiredPath.length>0)&&!a.some(e=>e.location===`body`)?[...o,he]:o}function ye(e){let t=new Set;m(t,e.resource);for(let n of fe)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of pe){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function D(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var O=s([`HIGH`,`MEDIUM`,`LOW`]),be=s([`PAID_PLAN`,`DAILY_ALLOWANCE`]),k=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),A=Object.assign(t([k,n()]),{enum:k.enum}),j=r({billingAccess:be.nullish(),excerpt:n(),sourceId:n(),sourceType:A,sourceVersion:n().nullish()}),xe=r({instruction:n(),operationId:n(),planTaskKey:c(n()).optional(),stepKey:n().optional()}),M=r({body:n(),expectation:n(),method:c(n()),override:n(),reject:c(n()),typeCatalog:n()}),Se=r({cliCommand:n(),mcpTool:n().nullish(),step:xe,writeGuidance:M.nullish()}),N=s([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Ce=Object.assign(t([N,n()]),{enum:N.enum}),we=r({allowedValue:n().nullish(),description:n(),key:n(),required:i().default(!0).optional(),type:Ce}),P=r({catalogRevision:a().optional(),gateId:c(n()).optional(),input:c(we),step:c(Se),taskKey:n().optional()}),F=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Te=r({candidate:c(j),operationId:n().nullish(),outcome:F,probability:o().nullish(),taskKey:n().nullish(),taskPlan:P.nullish()}),Ee=r({answer:n(),citation:c(j),confidence:O,resolution:Te.nullish()});function I(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>L(t,ie(e,t))),r=(t?.parameter??[]).map(t=>L(t,ae(e,t)));return{selector:n.filter(e=>e.location===`path`||R(e)),pagination:n.filter(z),filter:[...n.filter(B),...r.filter(B)],body:r.filter(e=>!B(e))}}function L(e,t){let{in:n,inputName:r,...i}=e;return{...i,flag:ee(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function R(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function z(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function B(e){return e.location!==`path`&&!R(e)&&!z(e)}function V(e){return{operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:U(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]}}function H(e,t){let n=e.requestBody?.[0],r=V(e),i=W(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:I(e)}:{...r,optionalInput:ke(e),arrayInput:Ae(e),...i===void 0?{}:{paidPlan:i}}}function De(e){let t=I(e),n=e=>e.filter(e=>e.required);return{...H(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function Oe(e){let{cli:t,scope:n,...r}=V(e),i=W(e);return{...r,...i===void 0?{}:{paidPlan:i},optionalDetailOmitted:!0}}function U(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function ke(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}function W(e){return e.response.find(({status:e})=>e===`402`)?.description}function Ae(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var G=160,K=`Operation catalog matches`,je=[`whole`,`described`,`requiredDescribed`,`optionalNamed`,`optionalGrouped`],q=e=>`${[K,...e].join(`
1
+ import{a as e}from"./package-CZBWjlYb.js";import{C as t,S as n,_ as r,c as i,d as a,g as o,i as s,s as c}from"./iso-l1vOidnb.js";import{c as l,f as u,l as d,o as ee,s as te,u as ne}from"./tool-policy-NTXy68a8.js";import{i as re,t as f}from"./human-text-cap-BcNmIPQA.js";import{n as ie,t as ae}from"./contract-parameter-DRNxhCKs.js";var p=2,oe=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function m(e,t){let n=v(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&m(e,`person`),h(e,se(n),n),h(e,ce(n),n))}function se(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=p&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;let n=e.endsWith(`es`)?e.slice(0,-2):``;if(n.length>=p&&n!==`us`&&/(?:s|ss|sh|ch|x|z)$/u.test(n))return n;if(e.length>p&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function ce(e){if(e===`person`)return`people`;if(e!==`new`&&e!==`news`&&e!==`status`&&e!==`us`){if(e.length>=p&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e))return`${e.slice(0,-1)}ies`;if(!(e.length>=p&&e.endsWith(`es`)))return e.length>=p&&/(?:s|ss|sh|ch|x|z)$/u.test(e)?`${e}es`:e.endsWith(`s`)?void 0:`${e}s`}}function h(e,t,n){t!==void 0&&t!==n&&t.length>=p&&/^[a-z]+$/u.test(t)&&e.add(t)}function g(e){let t=new Set(_(e)),n=Array.from(t);for(let e of n)m(t,e);return t}function le(e){return _(e).map(g)}function ue(e,t){if(e.length===0)return!1;let n=g(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function _(e){return v(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!oe.has(e))}function v(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}function y(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>b(e)),...n.flatMap(e=>e.parameter.map(t=>b(t,n.length>1?e.contentType:void 0))),...de(n)],i=[t,...e.cliPath].join(` `),a=e.mutates===!0||l(e.intent),o=u(e),s=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:te(e.method,e.intent),auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ne(e.path)||o===null?null:d(o),body:{hasBody:s!==void 0,kind:s?.kind??null,...s!==void 0&&n.length>1?{contentType:s.contentType}:{},required:s?.required??!1,description:s?.description??``,requiredPath:s?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,...e.successResponse===void 0?{}:{successResponse:e.successResponse},...e.header===void 0||e.header.length===0?{}:{header:e.header},summary:e.summary,description:e.description,...e.deprecated===void 0?{}:{deprecated:e.deprecated}}})}function b(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function de(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request body encoding, never an uploaded file's media type; omit for ${t[0]}.`,choices:t}]}function x(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var fe=[`-id`,`-slug`,`-url`],pe=[`--id`,`--slug`,`--url`],me=`/v1/lookup`,he=`--from-file "<path>"`;function ge(t,n,r=e().bin[0]){let i=y(n,r),a=i.find(e=>e.operationId===t);return a===void 0?[]:w(a,i)}function S(t,n,r=e().bin[0]){let i=n.find(e=>e.operationId===t),[a]=i===void 0?[]:y([i],r);return a&&C(a,E(a,!1))}function _e(t,n,r,i=e().bin[0]){let a=e=>{let t=e.findIndex((e,t)=>r[t]!==e);return t===-1?e.length:t},o=`${r[0]} get`,[s,c]=n.filter(({method:e,path:n,parameters:r,cliPath:i})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return e===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===t&&n.endsWith(`/{${c.name}}`)&&(a(i)>1||i.join(` `)===o)}).toSorted((e,t)=>a(t.cliPath)-a(e.cliPath));if(s!==void 0&&(c===void 0||a(c.cliPath)!==a(s.cliPath)))return S(s.operationId,n,i)}function C(e,t){return[e.cli.command,...t,`--data`].join(` `)}function w(e,t){return[`example: ${C(e,E(e))}`,...ve(e,t)]}function ve(e,t){return x(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${D(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===me),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${D(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var T=/(?:^|\.)text$/u;function E(e,t=!0){let n=x(e),r=n.filter(e=>e.required),i=e.body.kind===`json`&&n.some(e=>e.location===`body`&&T.test(e.wireName)&&(e.required||!e.wireName.includes(`.`))),a=i?r.filter(e=>e.location!==`body`):r,o=(r.length>0||!t?a:ye(e)).map(D);return i||(e.body.required||e.body.requiredPath.length>0)&&!a.some(e=>e.location===`body`)?[...o,he]:o}function ye(e){let t=new Set;m(t,e.resource);for(let n of fe)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of pe){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function D(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var O=s([`HIGH`,`MEDIUM`,`LOW`]),be=s([`PAID_PLAN`,`DAILY_ALLOWANCE`]),k=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),A=Object.assign(t([k,n()]),{enum:k.enum}),j=r({billingAccess:be.nullish(),excerpt:n(),sourceId:n(),sourceType:A,sourceVersion:n().nullish()}),xe=r({instruction:n(),operationId:n(),planTaskKey:c(n()).optional(),stepKey:n().optional()}),M=r({body:n(),expectation:n(),method:c(n()),override:n(),reject:c(n()),typeCatalog:n()}),Se=r({cliCommand:n(),mcpTool:n().nullish(),step:xe,writeGuidance:M.nullish()}),N=s([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Ce=Object.assign(t([N,n()]),{enum:N.enum}),we=r({allowedValue:n().nullish(),description:n(),key:n(),required:i().default(!0).optional(),type:Ce}),P=r({catalogRevision:a().optional(),gateId:c(n()).optional(),input:c(we),step:c(Se),taskKey:n().optional()}),F=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Te=r({candidate:c(j),operationId:n().nullish(),outcome:F,probability:o().nullish(),taskKey:n().nullish(),taskPlan:P.nullish()}),Ee=r({answer:n(),citation:c(j),confidence:O,resolution:Te.nullish()});function I(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>L(t,ie(e,t))),r=(t?.parameter??[]).map(t=>L(t,ae(e,t)));return{selector:n.filter(e=>e.location===`path`||R(e)),pagination:n.filter(z),filter:[...n.filter(B),...r.filter(B)],body:r.filter(e=>!B(e))}}function L(e,t){let{in:n,inputName:r,...i}=e;return{...i,flag:ee(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function R(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function z(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function B(e){return e.location!==`path`&&!R(e)&&!z(e)}function V(e){return{operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:U(e),responseContentType:[...new Set(e.response.filter(({status:e})=>e.startsWith(`2`)).flatMap(({contentType:e})=>e??[]))]}}function H(e,t){let n=e.requestBody?.[0],r=V(e),i=W(e);return t?{...r,...i===void 0?{}:{paidPlan:i},resource:e.resource,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:I(e)}:{...r,optionalInput:ke(e),arrayInput:Ae(e),...i===void 0?{}:{paidPlan:i}}}function De(e){let t=I(e),n=e=>e.filter(e=>e.required);return{...H(e,!1),optionalDetailOmitted:!0,argument:{selector:n(t.selector),pagination:n(t.pagination),filter:n(t.filter),body:n(t.body)}}}function Oe(e){let{cli:t,scope:n,...r}=V(e),i=W(e);return{...r,...i===void 0?{}:{paidPlan:i},optionalDetailOmitted:!0}}function U(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function ke(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}function W(e){return e.response.find(({status:e})=>e===`402`)?.description}function Ae(e){return[...e.parameter,...e.requestBody?.[0]?.parameter??[]].filter(({schemaType:e})=>e===`array`).map(({name:e})=>e)}var G=160,K=`Operation catalog matches`,je=[`whole`,`described`,`requiredDescribed`,`optionalNamed`,`optionalGrouped`],q=e=>`${[K,...e].join(`
2
2
  `)}\n`;function Me(e,t=[]){if(!Array.isArray(e)||e.length===0||!e.every(Fe))return null;let n=e,r=e=>re([K,...e,...t]);for(let e of je){let t=[...n.flatMap(t=>X(t,e)),...Y(n,e)];if(r(t))return q(t)}let i=e=>[...n.slice(0,e).flatMap(e=>X(e,`optionalGrouped`)),...Y(n.slice(0,e),`optionalGrouped`),...e>=n.length?[]:[`... ${n.length-e} more operations omitted to fit ${f} UTF-8 bytes: ${n.slice(e).map(({operationId:e})=>e).join(`, `)}; call aventure_help with q=<operationId> and limit=1 to read one.`]];return q(i([...n.keys()].findLast(e=>e>0&&r(i(e)))??1))}var J=`call aventure_help with q=<operationId> and limit=1; inspect structuredContent.data argument and optionalInput for the retained inputs`;function Y(e,t){let n=t===`optionalGrouped`&&e.some(e=>X(e,t).some(e=>e.includes(`.{`)))?[`... optional input names sharing a prefix are grouped: a.{b, c} names a.b and a.c.`]:[];return[...Ne(e,t),...n]}function Ne(e,t){let n=e.flatMap(e=>`argument`in e?Object.values(e.argument).flat():[]),r=t===`whole`?0:n.filter(e=>e.description.length>G&&(t===`described`||e.required)).length,i=r===0?[]:[`... ${r} argument descriptions shortened; inspect structuredContent.data[].argument for full descriptions.`];if(e.some(e=>`optionalDetailOmitted`in e))return[...i,e.some(e=>`argument`in e)?`... optional argument details omitted: the full list exceeds the result cap; ${J}.`:`... optional inputs omitted: the full list exceeds the result cap; call aventure_help with q=<operationId> and limit=1 to read one operation's inputs.`];if(t===`whole`||!e.some(e=>`argument`in e))return[];if(t===`described`)return i;let a=t===`requiredDescribed`?`optional argument descriptions`:`optional argument details`,o=n.filter(({required:e})=>!e).length;return[...i,`... ${o} ${a} omitted to fit ${f} UTF-8 bytes; structuredContent carries them, and ${J}.`]}function X(e,t){let n=`argument`in e?Object.values(e.argument).flat():[],r=n.filter(({required:e})=>!e).map(({name:e})=>e);return[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,` responseContentType: ${e.responseContentType.length===0?`none`:e.responseContentType.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,n])=>` optional ${e}: ${Z(n,t)}`):[],...`arrayInput`in e&&e.arrayInput.length>0?[` JSON array inputs: ${e.arrayInput.join(`, `)}`]:[],...`paidPlan`in e&&e.paidPlan!==void 0?[` paid plan: ${e.paidPlan}`]:[],...n.filter(({required:e})=>e||t!==`optionalNamed`&&t!==`optionalGrouped`).map(e=>Pe(e,e.required||t!==`requiredDescribed`,t)),...(t===`optionalNamed`||t===`optionalGrouped`)&&r.length>0?[` optional inputs: ${Z(r,t)}`]:[]]}function Z(e,t){if(t!==`optionalGrouped`)return e.join(`, `);let n=new Map;for(let t of e){let e=n,r=t.split(`.`);r.forEach((t,n)=>{let i=e.get(t)??{end:!1,child:new Map};e.set(t,i),n===r.length-1&&(i.end=!0),e=i.child})}let r=(e,t)=>{let n=[...t.child].flatMap(([n,i])=>t.child.size===1?r(`${e}.${n}`,i):r(n,i));return[...t.end?[e]:[],...t.child.size>1?[`${e}.{${n.join(`, `)}}`]:n]};return[...n].flatMap(([e,t])=>r(e,t)).join(`, `)}function Pe(e,t,n){let r=[e.location,e.required?`required`:void 0,e.schemaType,e.schemaFormat,e.schemaEnum===void 0?void 0:`choices: ${e.schemaEnum.join(`, `)}`,e.itemSchemaEnum===void 0?void 0:`item choices: ${e.itemSchemaEnum.join(`, `)}`,e.schemaDefault===void 0?void 0:`default: ${JSON.stringify(e.schemaDefault)}`,e.itemSchemaType===void 0?void 0:`items: ${e.itemSchemaType}${e.itemSchemaFormat===void 0?``:` (${e.itemSchemaFormat})`}`].filter(e=>e!==void 0).join(`, `),i=` ${e.name} (${r})`;return t?`${i}: ${n===`whole`||e.description.length<=G?e.description:`${e.description.slice(0,157)}...`}`:i}function Fe(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function Q(e){let t=t=>{let n=(`parameter`in e?e.parameter:e.parameters.map(e=>({...e,in:e.location,schemaDefault:e.defaultValue}))).filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(({name:e})=>[e,`<${e}>`]);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`);return{tool:d(e.intent),arguments:{operationId:e.operationId,...n===void 0?{}:{pathParams:n},...r===void 0?{}:{query:r},...e.requestBody===void 0?{}:{body:Le(e)}}}}var Ie=4;function Le(e){let t=e.requestBody?.[0];if(t===void 0)return{};if(t.requiredPath.length>0||e.intent!==`lookup`||t.schemaType===`array`)return Re(t.requiredPath);let n=t.parameter;return Object.fromEntries(n.flatMap(e=>{let{name:t,schemaType:n,schemaFormat:r}=e,i=`optionKey`in e?e.choices:e.schemaEnum;return t.includes(`.`)||n!==`string`||r!==void 0?[]:i===void 0?[[t,`<${t}>`]]:i.length>Ie?[]:[[t,`<${i.join(`|`)}>`]]}))}function Re(e){let t={},n=e.filter(t=>!e.some(e=>e.startsWith(`${t}.`)||e.startsWith(`${t}[]`)));for(let e of n){let n=e.split(`.`),r=n.slice(0,-1).reduce(ze,t);r[n.at(-1)??e]=`<${e}>`}return t}function ze(e,t){let n=t.replace(/\[\]$/u,``),r=e[n],i=Array.isArray(r)?r[0]:r;if(typeof i==`object`&&i&&!Array.isArray(i))return i;let a={};return e[n]=t.endsWith(`[]`)?[a]:a,a}function Be(e){let t=W(e);return{mcpCall:Q(e),...t===void 0?{}:{paidPlan:t}}}function Ve(e){let t=$(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function $(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}export{ue as C,le as D,v as E,m as S,_ as T,ge as _,Me as a,y as b,Oe as c,F as d,P as f,x as g,T as h,Be as i,De as l,O as m,$ as n,Q as o,A as p,Ve as r,H as s,K as t,Ee as u,_e as v,g as w,S as x,w as y};
@@ -1 +1 @@
1
- import{c as e,i as t,r as n}from"./result-envelope-DXFbrrkt.js";import{V as r,c as i,m as a,n as o}from"./tool-policy-C37kGt8n.js";import{t as s}from"./openapi-snapshot-DbUsUieG.js";import{C as c,D as l,E as u,S as d,T as f,c as p,i as m,l as h,n as g,o as _,r as v,s as y,t as b,u as x,w as S}from"./help-catalog-TLFLfBit.js";var C=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,w=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,T=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,E=250,D=40,O=100;function k(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(w,()=>(n.add(`uuid`),` `)).replace(C,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&T.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=T.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function A(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function j(e,t){let n=new Set;for(let r of e){let e=new Set;d(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function M(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(f(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>A(t,e,n.path))&&(i+=E,r.has(t)&&(i+=D));if(i===0)return 0;let a=new Set(f(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return d(t,e),[...t].some(e=>a.has(e))}))&&(i+=O),i}var N=40,P=4,F=3,I=1,L=new Map,R=new WeakMap;function z(e){let t=L.get(e);if(t!==void 0)return t;let n=s(),i=r(n.paths,e),o=i===null?new Map:a(n,i.operation.responses,F);return L.set(e,o),o}function B(e,t,n){let r=0,i=V(n);for(let[e,i]of n)t.has(e.toLowerCase())&&(r+=N*(4-i)/4);for(let t of e){let e=Math.min(...[...t].map(e=>i.get(e)??1/0));e<=I&&(r+=P*(2-e))}return r}function V(e){let t=R.get(e);if(t!==void 0)return t;let n=new Map;for(let[t,r]of e){if(r>I)continue;let e=new Set;for(let n of f(t))d(e,n);for(let t of e)n.set(t,Math.min(n.get(t)??r,r))}return R.set(e,n),n}var H=5,U=.5,W=15,G=30,K=2,ee=100,q=.5;function J(e,t,n){if(e.trim().length===0)return t.map(e=>({item:e,score:1}));let r=t.map(e=>({item:e,fields:n(e)})),i=k(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=j(i.urlPathWord,r.map(({fields:e})=>e)),o=u(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=S(o),c=l(o),d=new Set(i.text.toLowerCase().split(/[^a-z0-9]+/u));return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:$({normalizedQuery:o,tokens:s,termForm:c,queryWord:d},t))+M(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}var Y=new WeakMap;function X(e){let t=Y.get(e);if(t!==void 0)return t;let n=e.requestBody??[],r=[...e.parameter,...n.flatMap(e=>e.parameter)],i={...e,cliPath:e.projection.cliPath,enumParameter:r.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:r.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...r,...n].map(({description:e})=>e),responseFieldLevel:z(e.operationId)};return Y.set(e,i),i}function Z(n,r){let i=n.q?.trim()??``,a=J(i,r.filter(e=>Q(n,e)&&(i.length>0||e.deprecated!==!0)),X),o=(a[0]?.score??0)*U,s=a.filter(({score:e})=>e>=o),c=n.limit===void 0||!Number.isFinite(n.limit)?H:n.limit,l=Math.min(s.length,Math.max(0,Math.trunc(c))),u=s.slice(0,l).map(({item:e})=>e),d={totalOperations:r.length,matched:s.length,returned:u.length},f=u.length===1,m=u.map(e=>y(e,f)),g=e(b,m,{counts:d}),_=t(g),v=f?u.map(h):u.map(p);return{summary:b,data:_?m:v,counts:d}}function Q(e,t){let{root:n}=e;return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function $({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},a){let o=oe(a),s=ie(a),l=0;o.some(t=>t===e)&&(l+=100),o.some(t=>t.includes(e))&&(l+=40),l+=ae(e,o);let p=new Set(o.flatMap(f)),m=new Set(s.flatMap(f));for(let e of t)o.some(t=>t===e)?l+=20:m.has(e)?l+=8:p.has(e)&&(l+=K);for(let e of a.cliPath){let n=new Set;d(n,e),[...n].some(e=>t.has(e))&&(l+=W)}c(n,s)&&(l+=200),n.length>1&&s.some(t=>t.includes(e))&&(l+=ee),a.parameterName.some(t=>u(t)===e)&&(l+=G);let h=new Set(a.parameterDescription.flatMap(f));for(let e of t)h.has(e)&&(l+=K);return l+=ce(t,a.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(a.operationId)&&(l+=30),l+=B(n,r,a.responseFieldLevel),l-=se(e,t,a.description),i(a.intent)&&!re(r)?l*q:l}var te=`edit change set fix rename link unlink mark publish correct`.split(` `),ne=new Set([...Object.entries(o).filter(([,e])=>i(e)).map(([e])=>e),...te]);function re(e){return[...e].some(e=>ne.has(e))}function ie(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(u).filter(e=>e.length>0)}function ae(e,t){let n=f(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function oe(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,(g(e.description).useFor||e.description).slice(0,240)].map(u).filter(e=>e.length>0))]}function se(e,t,n){let r=u(g(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(f(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function ce(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>le(e,t))&&(n+=i?40:10);return n}function le(e,t){let n=f(t);return n.length>0&&n.every(t=>e.has(t))}function ue(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function de(t,r,i,a){let o=t.q?.trim()??``;if(o.length===0)return n(`Provide q to resolve a request to one operation.`);let s=i.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(s===void 0)return n(`This build ships no help resolve operation.`);let c=await a(s,{body:{question:o,resolve:!0,...t.scope===void 0?{}:{scope:t.scope===`read`?`READ`:`WRITE`}}});if(!c.ok)return{...c,data:null};let l=x.safeParse(ue(c));if(!l.success||l.data.resolution==null)return n(`The help resolve operation returned no resolution.`,c.warnings,{httpStatus:c.httpStatus});let{answer:u,resolution:d}=l.data,f=e=>r.find(t=>t.operationId===e),p=f(d.operationId),h=d.taskPlan??void 0,g=(h?.step??[]).map(({step:e})=>({step:e,contract:f(e.operationId)})),y=[...new Set([...d.operationId!=null&&p===void 0?[d.operationId]:[],...g.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return y.some(e=>!i.some(t=>t.operationId===e))?n(`No operation on this connection answers that request.`):e(y.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${y.join(`, `)}.`,{outcome:d.outcome,probability:d.probability,answer:u,candidate:d.candidate.filter(({sourceId:e})=>i.some(({operationId:t})=>t===e)).map(({sourceId:e})=>{let t=f(e);return t===void 0?{sourceId:e}:Object.assign({sourceId:e},m(t))}),...p===void 0?{}:{operation:{operationId:p.operationId,apiRoute:`${p.method} ${p.path}`,...v(p),...m(p)}},...(d.taskKey,{}),...h===void 0?{}:{taskPlan:{input:h.input,step:g.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{instruction:n,operationId:r}:{instruction:n,mcpCall:_(e)})}}},{warnings:y.map(e=>i.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}export{z as a,de as i,J as n,Z as r,X as t};
1
+ import{c as e,i as t,r as n}from"./result-envelope-DXFbrrkt.js";import{V as r,c as i,m as a,n as o}from"./tool-policy-NTXy68a8.js";import{t as s}from"./openapi-snapshot-DxZhAXyC.js";import{C as c,D as l,E as u,S as d,T as f,c as p,i as m,l as h,n as g,o as _,r as v,s as y,t as b,u as x,w as S}from"./help-catalog-tM-2mFr2.js";var C=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,w=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,T=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,E=250,D=40,O=100;function k(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(w,()=>(n.add(`uuid`),` `)).replace(C,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&T.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=T.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function A(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function j(e,t){let n=new Set;for(let r of e){let e=new Set;d(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function M(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(f(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>A(t,e,n.path))&&(i+=E,r.has(t)&&(i+=D));if(i===0)return 0;let a=new Set(f(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return d(t,e),[...t].some(e=>a.has(e))}))&&(i+=O),i}var N=40,P=4,F=3,I=1,L=new Map,R=new WeakMap;function z(e){let t=L.get(e);if(t!==void 0)return t;let n=s(),i=r(n.paths,e),o=i===null?new Map:a(n,i.operation.responses,F);return L.set(e,o),o}function B(e,t,n){let r=0,i=V(n);for(let[e,i]of n)t.has(e.toLowerCase())&&(r+=N*(4-i)/4);for(let t of e){let e=Math.min(...[...t].map(e=>i.get(e)??1/0));e<=I&&(r+=P*(2-e))}return r}function V(e){let t=R.get(e);if(t!==void 0)return t;let n=new Map;for(let[t,r]of e){if(r>I)continue;let e=new Set;for(let n of f(t))d(e,n);for(let t of e)n.set(t,Math.min(n.get(t)??r,r))}return R.set(e,n),n}var H=5,U=.5,W=15,G=30,K=2,ee=100,q=.5;function J(e,t,n){if(e.trim().length===0)return t.map(e=>({item:e,score:1}));let r=t.map(e=>({item:e,fields:n(e)})),i=k(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=j(i.urlPathWord,r.map(({fields:e})=>e)),o=u(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=S(o),c=l(o),d=new Set(i.text.toLowerCase().split(/[^a-z0-9]+/u));return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:$({normalizedQuery:o,tokens:s,termForm:c,queryWord:d},t))+M(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}var Y=new WeakMap;function X(e){let t=Y.get(e);if(t!==void 0)return t;let n=e.requestBody??[],r=[...e.parameter,...n.flatMap(e=>e.parameter)],i={...e,cliPath:e.projection.cliPath,enumParameter:r.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:r.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...r,...n].map(({description:e})=>e),responseFieldLevel:z(e.operationId)};return Y.set(e,i),i}function Z(n,r){let i=n.q?.trim()??``,a=J(i,r.filter(e=>Q(n,e)&&(i.length>0||e.deprecated!==!0)),X),o=(a[0]?.score??0)*U,s=a.filter(({score:e})=>e>=o),c=n.limit===void 0||!Number.isFinite(n.limit)?H:n.limit,l=Math.min(s.length,Math.max(0,Math.trunc(c))),u=s.slice(0,l).map(({item:e})=>e),d={totalOperations:r.length,matched:s.length,returned:u.length},f=u.length===1,m=u.map(e=>y(e,f)),g=e(b,m,{counts:d}),_=t(g),v=f?u.map(h):u.map(p);return{summary:b,data:_?m:v,counts:d}}function Q(e,t){let{root:n}=e;return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function $({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},a){let o=oe(a),s=ie(a),l=0;o.some(t=>t===e)&&(l+=100),o.some(t=>t.includes(e))&&(l+=40),l+=ae(e,o);let p=new Set(o.flatMap(f)),m=new Set(s.flatMap(f));for(let e of t)o.some(t=>t===e)?l+=20:m.has(e)?l+=8:p.has(e)&&(l+=K);for(let e of a.cliPath){let n=new Set;d(n,e),[...n].some(e=>t.has(e))&&(l+=W)}c(n,s)&&(l+=200),n.length>1&&s.some(t=>t.includes(e))&&(l+=ee),a.parameterName.some(t=>u(t)===e)&&(l+=G);let h=new Set(a.parameterDescription.flatMap(f));for(let e of t)h.has(e)&&(l+=K);return l+=ce(t,a.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(a.operationId)&&(l+=30),l+=B(n,r,a.responseFieldLevel),l-=se(e,t,a.description),i(a.intent)&&!re(r)?l*q:l}var te=`edit change set fix rename link unlink mark publish correct`.split(` `),ne=new Set([...Object.entries(o).filter(([,e])=>i(e)).map(([e])=>e),...te]);function re(e){return[...e].some(e=>ne.has(e))}function ie(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(u).filter(e=>e.length>0)}function ae(e,t){let n=f(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function oe(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,(g(e.description).useFor||e.description).slice(0,240)].map(u).filter(e=>e.length>0))]}function se(e,t,n){let r=u(g(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(f(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function ce(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>le(e,t))&&(n+=i?40:10);return n}function le(e,t){let n=f(t);return n.length>0&&n.every(t=>e.has(t))}function ue(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function de(t,r,i,a){let o=t.q?.trim()??``;if(o.length===0)return n(`Provide q to resolve a request to one operation.`);let s=i.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(s===void 0)return n(`This build ships no help resolve operation.`);let c=await a(s,{body:{question:o,resolve:!0,...t.scope===void 0?{}:{scope:t.scope===`read`?`READ`:`WRITE`}}});if(!c.ok)return{...c,data:null};let l=x.safeParse(ue(c));if(!l.success||l.data.resolution==null)return n(`The help resolve operation returned no resolution.`,c.warnings,{httpStatus:c.httpStatus});let{answer:u,resolution:d}=l.data,f=e=>r.find(t=>t.operationId===e),p=f(d.operationId),h=d.taskPlan??void 0,g=(h?.step??[]).map(({step:e})=>({step:e,contract:f(e.operationId)})),y=[...new Set([...d.operationId!=null&&p===void 0?[d.operationId]:[],...g.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return y.some(e=>!i.some(t=>t.operationId===e))?n(`No operation on this connection answers that request.`):e(y.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${y.join(`, `)}.`,{outcome:d.outcome,probability:d.probability,answer:u,candidate:d.candidate.filter(({sourceId:e})=>i.some(({operationId:t})=>t===e)).map(({sourceId:e})=>{let t=f(e);return t===void 0?{sourceId:e}:Object.assign({sourceId:e},m(t))}),...p===void 0?{}:{operation:{operationId:p.operationId,apiRoute:`${p.method} ${p.path}`,...v(p),...m(p)}},...(d.taskKey,{}),...h===void 0?{}:{taskPlan:{input:h.input,step:g.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{instruction:n,operationId:r}:{instruction:n,mcpCall:_(e)})}}},{warnings:y.map(e=>i.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}export{z as a,de as i,J as n,Z as r,X as t};