@aventurevc/aventure-cli 0.8.68 → 0.8.70

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,6 +1,6 @@
1
- import{C as e,Di as t,Ei as n,Oi as r,x as i}from"./client-BaSoytnG.js";import{T as a,l as o,o as s,v as c,w as l,y as u}from"./person-owner-BJgNYLKX.js";import{a as d,i as f,n as p,t as m}from"./text-field-BYLoFndW.js";var h=s([`HIGH`,`MEDIUM`,`LOW`]),g=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`]),_=u({excerpt:l(),sourceId:l(),sourceType:g,sourceVersion:l().nullish()}),ee=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),te=u({candidate:o(_),operationId:l().nullish(),outcome:ee,probability:c().nullish(),taskKey:l().nullish()}),v=u({answer:l(),citation:o(_),confidence:h,resolution:te.nullish()});function y(e,t,n=t.inputName){if(t.in===`body`)return n;let r=ue.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?x(b(n!==`id`&&n!==`slug`?n:`${ie(e.path)}${se(n)}`),t):r.inputName}function ne(e,t,n=oe(e)){return re(ae(e,t),new Set(n))}function re(e,t){if(!t.has(e))return e;let n=`body${se(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function ie(e){return de.find(([,t])=>t.test(e))?.[0]??`record`}function ae(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=ce(t);return x(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?b(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function oe(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>y(e,t)))}function se(e){return e.replace(/^./u,e=>e.toUpperCase())}function b(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 ce(e){let t=b(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?le(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function le(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function x(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var ue=[{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`}],de=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function fe(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>S(t,y(e,t))),r=(t?.parameter??[]).map(t=>S(t,ne(e,t)));return{selector:n.filter(e=>e.location===`path`||C(e)),pagination:n.filter(w),filter:[...n.filter(T),...r.filter(T)],body:r.filter(e=>!T(e))}}function S(e,t){return{name:e.in===`body`?t:e.name,flag:i(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function C(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function w(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function T(e){return e.location!==`path`&&!C(e)&&!w(e)}function pe(e,t){let n=e.requestBody?.[0],r={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:me(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:fe(e)}:r}function me(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}var he=160;function ge(e){return!Array.isArray(e)||e.length===0||!e.every(_e)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${e.location}${e.required?`, required`:``}): ${e.description.length<=he?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
2
- `)}\n`}function _e(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 E(t){let n=e=>t.parameter.filter(t=>t.in===e&&t.required&&t.schemaDefault===void 0),r=[...new Set((t.requestBody?.[0]?.requiredPath??[]).map(e=>e.split(/[.[]/u)[0]))];return{tool:e(t.intent),operationId:t.operationId,pathParams:Object.fromEntries(n(`path`).map(D)),query:Object.fromEntries(n(`query`).map(D)),...t.requestBody===void 0?{}:{body:Object.fromEntries(r.map(e=>[e,`<${e}>`]))}}}function D(e){return[e.name,`<${e.name}>`]}function ve(e){let t=O(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function O(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var k=2,ye=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 A(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&A(e,`person`),j(e,be(n),n),j(e,xe(n),n))}function be(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=k&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>k&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function xe(e){return e===`person`?`people`:e.length>=k&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function j(e,t,n){t!==void 0&&t!==n&&t.length>=k&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)A(t,e);return t}function Se(e){return N(e).map(M)}function Ce(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!ye.has(e))}function P(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`)}var we=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,Te=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,F=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Ee=250,De=40,Oe=100;function ke(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(Te,()=>(n.add(`uuid`),` `)).replace(we,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&F.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=F.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 Ae(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function je(e,t){let n=new Set;for(let r of e){let e=new Set;A(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 Me(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Ae(t,e,n.path))&&(i+=Ee,r.has(t)&&(i+=De));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return A(t,e),[...t].some(e=>a.has(e))}))&&(i+=Oe),i}var Ne=5,Pe=.5,Fe=15,Ie=30,Le=2;function I(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=ke(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=je(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=Se(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Be(o,s,c,t))+Me(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}))}function Re(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function L(e,t){let n=I(e.q?.trim()??``,t.filter(t=>ze(e,t)),Re),r=(n[0]?.score??0)*Pe,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Ne:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>pe(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function ze(e,t){let n=e.root?.trim().toLowerCase();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 Be(e,t,n,r){let i=Ue(r),a=Ve(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=He(e,i);let s=new Set(i.flatMap(N));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;A(n,e),[...n].some(e=>t.has(e))&&(o+=Fe)}Ce(n,a)&&(o+=200),r.parameterName.some(t=>P(t)===e)&&(o+=Ie);let c=new Set(r.parameterDescription.flatMap(N));for(let e of t)c.has(e)&&(o+=Le);return o+=Ge(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=We(e,t,r.description),o}function Ve(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function He(e,t){let n=N(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 Ue(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,O(e.description).useFor||e.description].map(P).filter(e=>e.length>0))]}function We(e,t,n){let r=P(O(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ge(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Ke(e,t))&&(n+=i?40:10);return n}function Ke(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}var qe=3,Je=200;function Ye(e,t){let{operationId:r}=e;if(r===void 0||t.some(e=>e.operationId===r))return null;let i=L({q:[r,...Xe(e)].join(` `),limit:qe},t),a=i.summary===`Operation catalog matches`?i.data:[],o=a.map(e=>`${e.operationId} (${e.method} ${e.path})`);return n(`Operation ${r} is not in the MCP catalog.${o.length===0?``:` Closest operations: ${o.join(`, `)}.`}`,a.map(e=>`Use operationId ${e.operationId} with aventure_${e.intent}: ${e.method} ${e.path}; required inputs: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}.`))}function Xe(e){let t=e.body,n=typeof t==`object`&&t&&!Array.isArray(t)?Object.entries(t):[];return[...Object.entries(e.pathParams??{}),...Object.entries(e.query??{}),...n].flatMap(([e,t])=>typeof t==`string`&&t.length<=Je?[e,t]:[e])}var R=`getHarnessTaskPlan`;function z(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Ze(e,r,i,a){let o=e.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,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`}}});if(!c.ok)return{...c,data:null};let l=v.safeParse(z(c));if(!l.success||l.data.resolution==null)return n(`The help resolve operation returned no resolution.`);let{answer:u,resolution:d}=l.data,f=e=>r.find(t=>t.operationId===e),p=f(d.operationId),m=f(R),h;if(d.taskKey!=null&&m!==void 0){let e=await a(m,{pathParams:{taskKey:d.taskKey}});if(!e.ok)return{...e,data:null};if(h=(z(e),void 0),h===void 0)return n(`The plan read for task ${d.taskKey} failed.`)}let g=(h?.step??[]).map(({step:e})=>({...e,contract:f(e.operationId)})),_=[...d.operationId!=null&&p===void 0?[d.operationId]:[],...d.taskKey!=null&&m===void 0?[R]:[],...g.filter(({contract:e})=>e===void 0).map(e=>e.operationId)];return t(`Help resolution`,{outcome:d.outcome,probability:d.probability,answer:u,candidate:d.candidate.map(({sourceId:e})=>e),...p===void 0?{}:{operation:{operationId:p.operationId,apiRoute:`${p.method} ${p.path}`,...ve(p),bodySchemaName:p.requestBody?.[0]?.schemaName??null,mcpCall:E(p)}},...d.taskKey==null?{}:{taskKey:d.taskKey},...h===void 0?{}:{taskPlan:{taskKey:h.taskKey,catalogRevision:h.catalogRevision,input:h.input,step:g.map(({contract:e,...t})=>e===void 0?t:{...t,mcpCall:E(e)})}}},{warnings:_.map(e=>`Operation ${e} is not callable on this connection.`)})}var B=a([s([`auto`,`exact`,`keyword`,`semantic`,`natural`]),l()]),Qe=u({modeRequested:B,modeUsed:B}),V=120,$e=`aventure`,H=30,et=8,U=10,tt=2,nt=[`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`],rt=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),it=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`],at=new Map(d.map(({operationId:e,projection:t})=>[e,`${$e} ${t.cliPath.join(` `)}`]));function ot(e,t){if(typeof e==`string`)return e;let n=ge(e);if(n!==null)return n;let r=gt(e);if(r===null)return null;let{response:i,hiddenNote:a}=f(r.operationId,r.response),o={...r,response:i},s=vt(o.response);if(s!==null)return`${Tt(s).join(`
3
- `)}\n`;let c=o.summary??t??o.operationId??`OpenAPI call succeeded`,l=lt(o);return`${[...Tt([c,`${o.method} ${o.endpoint}`,...l].filter(e=>e.length>0)),...a].join(`
4
- `)}\n`}function st(e){let t=gt(e)?.response,n=t!==void 0&&X(t)?t.interpretation:void 0;if(n===void 0||!X(n))return null;let r=Qe.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=K(n.filter??null),{unsupported:s,fallbackUsed:c}=n;return`${[`strategy: requested=${i} used=${a}`,...o!==void 0&&X(o)?[`constraints:`,...Object.entries(o).map(([e,t])=>` ${e}: ${ct(t)}`)]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
5
- `)}\n`}var ct=e=>Z(e)?p(e):Array.isArray(e)&&e.every(Z)?e.map(e=>p(e)).join(`, `):JSON.stringify(e);function lt(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a,location:o}=e;if(t===void 0)return o!==void 0&&a!==void 0?[`status=${a} redirect=${o}`]:a===void 0?[]:[`status=${a} no response body`];let s=a===void 0||n===`GET`?``:`status=${a}`,c=X(t)&&!J(t)?yt(t):null,l=c===null?void 0:_t(c.context)?K(c.context):c.context,u=l!==void 0&&X(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(X)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...J(t)?ut(t,r,i):c===null?xt(t)?pt(t.filter,t.meta):St(t)?pt([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):Ct(t)?mt(t):W(t,``):[...ut(c.page,r,i),...Object.keys(p).length===0?[]:W(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(dt(t)))]].filter(Boolean)}function ut(e,t,n){let r=ht(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${$(n)}`,...dt(e.content)].filter(Boolean)}function dt(e){let t=e.filter(X);if(t.length===0)return e.length===0?[`(empty)`]:G(e,``);let n=ft(t);if(n.length===0)return G(e.slice(0,H),``);let r=t.slice(0,H).map(e=>{let t=q(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>wt(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>H&&s.push(`... ${t.length-H} more rows`),s}function ft(e){let t=new Set(e.flatMap(e=>Object.keys(q(e)))),n=nt.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,et-n.length);return[...n,...r].slice(0,et)}function pt(e,t){let n=t!==void 0&&X(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,U).forEach(e=>{i.push(` ${Q(t.filterKey)} ${$(e.value)}`)}),e>U&&i.push(` ... ${e-U} more shown`)}return i}function mt(e){let t=Q(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,U).map(e=>`${t} ${$(e)}`),e.result.length>U?`... ${e.result.length-U} more matches`:``].filter(Boolean)}function ht(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!rt.has(e)&&t.length>0).map(([e,t])=>`${Q(e)} ${$(t)}`)}function gt(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`method`),n=Reflect.get(e,`endpoint`);if(typeof t!=`string`||typeof n!=`string`)return null;let i=Reflect.get(e,`operationId`),a=Reflect.get(e,`summary`),o=Reflect.get(e,`httpStatus`),s=Reflect.get(e,`location`),c=Reflect.get(e,`nextCursor`),l=Reflect.get(e,`response`),u=l===void 0?void 0:r.safeParse(l);return u!==void 0&&!u.success?null:{method:t,endpoint:n,httpStatus:typeof o==`number`?o:void 0,location:typeof s==`string`?s:void 0,operationId:typeof i==`string`?i:void 0,summary:typeof a==`string`?a:void 0,nextCursor:typeof c==`string`&&c.length>0?c:void 0,response:u?.data}}function W(e,t,n){if(e===void 0)return[];if(Z(e))return[`${t}${m(e,n)}`];if(Array.isArray(e))return G(e,t,n);let r=[];for(let[n,i]of Object.entries(e)){if(Z(i)){r.push(`${t}${n}: ${m(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of W(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function G(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(Z(i)){r.push(`${t}- ${m(i,n)}`);continue}r.push(`${t}-`);for(let e of W(i,`${t} `))r.push(e)}return r}function _t(e){let t=e.interpretation;return t!==void 0&&X(t)}function K(e){if(Z(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=K(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=K(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...it.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!it.includes(e))])}function vt(e){let t=v.safeParse(e);if(!t.success)return null;let{answer:n,citation:r,confidence:i}=t.data,a=n.trimEnd().split(`
6
- `),o=new Set(r.flatMap(({sourceType:e,sourceId:t})=>{if(e!==g.enum.OPERATION)return[];let n=at.get(t);return n===void 0?[]:[n]}));return o.size>0&&a.push(``,`Commands:`,...[...o].map(e=>` ${e}`)),a.push(``,`Confidence: ${i}`),r.length===0?a:(a.push(`Sources (${r.length}):`),a.push(...r.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),a)}function q(e,t=``,n=0){return Z(e)?t.length===0?{}:{[t]:p(e,t)}:n>tt?{}:Array.isArray(e)?e.length===0?{}:q(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=t.length===0?e:`${t}.${e}`;return Z(r)?[[i,p(r,i)]]:Object.entries(q(r,i,n+1))}))}var J=e=>X(e)&&Array.isArray(e.content);function yt(e){let[t,...n]=Object.entries(e).filter(e=>J(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function bt(e){return X(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var xt=e=>X(e)&&Y(e.filter),St=e=>X(e)&&Y(e.arrayFilterEntry)&&Y(e.rangeFilterEntry),Y=e=>Array.isArray(e)&&e.every(bt),Ct=e=>X(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),X=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Z=e=>typeof e!=`object`||!e,Q=e=>`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,$=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,wt=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,Tt=e=>e.length<=V?e:[...e.slice(0,V),`... ${e.length-V} more lines: the record continues past this fold; read the omitted section through its sub-resource operation (aventure_help names it), or request responseFormat json for the whole record.`];export{L as a,P as c,I as i,st as n,Ze as o,Ye as r,A as s,ot as t};
1
+ import{C as e,Di as t,Ei as n,Oi as r,x as i}from"./client-CvdCB7pf.js";import{T as a,l as o,o as s,v as c,w as l,y as u}from"./person-owner-BJgNYLKX.js";import{a as d,i as f,n as p,t as m}from"./text-field-BKMUpKvF.js";var h=s([`HIGH`,`MEDIUM`,`LOW`]),g=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`]),_=u({excerpt:l(),sourceId:l(),sourceType:g,sourceVersion:l().nullish()}),v=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),ee=u({candidate:o(_),operationId:l().nullish(),outcome:v,probability:c().nullish(),taskKey:l().nullish()}),y=u({answer:l(),citation:o(_),confidence:h,resolution:ee.nullish()});function b(e,t,n=t.inputName){if(t.in===`body`)return n;let r=ue.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?le(x(n!==`id`&&n!==`slug`?n:`${re(e.path)}${oe(n)}`),t):r.inputName}function te(e,t,n=ae(e)){return ne(ie(e,t),new Set(n))}function ne(e,t){if(!t.has(e))return e;let n=`body${oe(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function re(e){return de.find(([,t])=>t.test(e))?.[0]??`record`}function ie(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=se(t);return le(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?x(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ae(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>b(e,t)))}function oe(e){return e.replace(/^./u,e=>e.toUpperCase())}function x(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 se(e){let t=x(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ce(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ce(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function le(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var ue=[{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`}],de=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function fe(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>S(t,b(e,t))),r=(t?.parameter??[]).map(t=>S(t,te(e,t)));return{selector:n.filter(e=>e.location===`path`||C(e)),pagination:n.filter(w),filter:[...n.filter(T),...r.filter(T)],body:r.filter(e=>!T(e))}}function S(e,t){return{name:e.in===`body`?t:e.name,flag:i(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function C(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function w(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function T(e){return e.location!==`path`&&!C(e)&&!w(e)}function pe(e,t){let n=e.requestBody?.[0],r={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:me(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:fe(e)}:r}function me(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}var he=160;function ge(e){return!Array.isArray(e)||e.length===0||!e.every(_e)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${e.location}${e.required?`, required`:``}): ${e.description.length<=he?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
2
+ `)}\n`}function _e(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 E(t){let n=e=>t.parameter.filter(t=>t.in===e&&t.required&&t.schemaDefault===void 0),r=[...new Set((t.requestBody?.[0]?.requiredPath??[]).map(e=>e.split(/[.[]/u)[0]))];return{tool:e(t.intent),operationId:t.operationId,pathParams:Object.fromEntries(n(`path`).map(D)),query:Object.fromEntries(n(`query`).map(D)),...t.requestBody===void 0?{}:{body:Object.fromEntries(r.map(e=>[e,`<${e}>`]))}}}function D(e){return[e.name,`<${e.name}>`]}function ve(e){let t=O(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function O(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var k=2,ye=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 A(e,t){let n=P(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&A(e,`person`),j(e,be(n),n),j(e,xe(n),n))}function be(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=k&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>k&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function xe(e){return e===`person`?`people`:e.length>=k&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function j(e,t,n){t!==void 0&&t!==n&&t.length>=k&&/^[a-z]+$/u.test(t)&&e.add(t)}function M(e){let t=new Set(N(e)),n=Array.from(t);for(let e of n)A(t,e);return t}function Se(e){return N(e).map(M)}function Ce(e,t){if(e.length===0)return!1;let n=M(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function N(e){return P(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!ye.has(e))}function P(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`)}var we=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,Te=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,F=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Ee=250,De=40,Oe=100;function ke(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(Te,()=>(n.add(`uuid`),` `)).replace(we,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&F.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=F.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 Ae(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function je(e,t){let n=new Set;for(let r of e){let e=new Set;A(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 Me(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(N(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Ae(t,e,n.path))&&(i+=Ee,r.has(t)&&(i+=De));if(i===0)return 0;let a=new Set(N(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return A(t,e),[...t].some(e=>a.has(e))}))&&(i+=Oe),i}var Ne=5,Pe=.5,Fe=15,Ie=30,Le=2;function I(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=ke(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=je(i.urlPathWord,r.map(({fields:e})=>e)),o=P(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=M(o),c=Se(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:Be(o,s,c,t))+Me(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}))}function Re(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function L(e,t){let n=I(e.q?.trim()??``,t.filter(t=>ze(e,t)),Re),r=(n[0]?.score??0)*Pe,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?Ne:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>pe(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function ze(e,t){let n=e.root?.trim().toLowerCase();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 Be(e,t,n,r){let i=Ue(r),a=Ve(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=He(e,i);let s=new Set(i.flatMap(N));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;A(n,e),[...n].some(e=>t.has(e))&&(o+=Fe)}Ce(n,a)&&(o+=200),r.parameterName.some(t=>P(t)===e)&&(o+=Ie);let c=new Set(r.parameterDescription.flatMap(N));for(let e of t)c.has(e)&&(o+=Le);return o+=Ge(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=We(e,t,r.description),o}function Ve(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(P).filter(e=>e.length>0)}function He(e,t){let n=N(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 Ue(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,O(e.description).useFor||e.description].map(P).filter(e=>e.length>0))]}function We(e,t,n){let r=P(O(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(N(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ge(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Ke(e,t))&&(n+=i?40:10);return n}function Ke(e,t){let n=N(t);return n.length>0&&n.every(t=>e.has(t))}var qe=3,Je=200;function Ye(e,t){let{operationId:r}=e;if(r===void 0||t.some(e=>e.operationId===r))return null;let i=L({q:[r,...Xe(e)].join(` `),limit:qe},t),a=i.summary===`Operation catalog matches`?i.data:[],o=a.map(e=>`${e.operationId} (${e.method} ${e.path})`);return n(`Operation ${r} is not in the MCP catalog.${o.length===0?``:` Closest operations: ${o.join(`, `)}.`}`,a.map(e=>`Use operationId ${e.operationId} with aventure_${e.intent}: ${e.method} ${e.path}; required inputs: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}.`))}function Xe(e){let t=e.body,n=typeof t==`object`&&t&&!Array.isArray(t)?Object.entries(t):[];return[...Object.entries(e.pathParams??{}),...Object.entries(e.query??{}),...n].flatMap(([e,t])=>typeof t==`string`&&t.length<=Je?[e,t]:[e])}var R=`getHarnessTaskPlan`;function z(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Ze(e,r,i,a){let o=e.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,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`}}});if(!c.ok)return{...c,data:null};let l=y.safeParse(z(c));if(!l.success||l.data.resolution==null)return n(`The help resolve operation returned no resolution.`);let{answer:u,resolution:d}=l.data,f=e=>r.find(t=>t.operationId===e),p=f(d.operationId),m=f(R),h,g=[];if(d.taskKey!=null&&m!==void 0){let e=await a(m,{pathParams:{taskKey:d.taskKey}});h=(e.ok&&z(e),void 0),h===void 0&&g.push(`The plan for task ${d.taskKey} is unreadable: ${e.summary}`)}let _=(h?.step??[]).map(({step:e})=>({...e,contract:f(e.operationId)})),v=[...d.operationId!=null&&p===void 0?[d.operationId]:[],...d.taskKey!=null&&m===void 0?[R]:[],..._.filter(({contract:e})=>e===void 0).map(e=>e.operationId)];return t(`Help resolution`,{outcome:d.outcome,probability:d.probability,answer:u,candidate:d.candidate.map(({sourceId:e})=>e),...p===void 0?{}:{operation:{operationId:p.operationId,apiRoute:`${p.method} ${p.path}`,...ve(p),bodySchemaName:p.requestBody?.[0]?.schemaName??null,mcpCall:E(p)}},...d.taskKey==null?{}:{taskKey:d.taskKey},...h===void 0?{}:{taskPlan:{taskKey:h.taskKey,catalogRevision:h.catalogRevision,input:h.input,step:_.map(({contract:e,...t})=>e===void 0?t:{...t,mcpCall:E(e)})}}},{warnings:[...v.map(e=>`Operation ${e} is not callable on this connection.`),...g]})}var Qe=a([s([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),l()]),$e=u({modeRequested:Qe,modeUsed:Qe}),B=120,et=`aventure`,V=30,tt=8,H=10,nt=2,rt=[`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`],it=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),at=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`],ot=new Map(d.map(({operationId:e,projection:t})=>[e,`${et} ${t.cliPath.join(` `)}`]));function st(e,t){if(typeof e==`string`)return e;let n=ge(e);if(n!==null)return n;let r=_t(e);if(r===null)return null;let{response:i,hiddenNote:a}=f(r.operationId,r.response),o={...r,response:i},s=yt(o.response);if(s!==null)return`${$(s).join(`
3
+ `)}\n`;let c=o.summary??t??o.operationId??`OpenAPI call succeeded`,l=ut(o);return`${[...$([c,`${o.method} ${o.endpoint}`,...l].filter(e=>e.length>0)),...a].join(`
4
+ `)}\n`}function ct(e){let t=_t(e)?.response,n=t!==void 0&&Y(t)?t.interpretation:void 0;if(n===void 0||!Y(n))return null;let r=$e.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=G(n.filter??null),{unsupported:s,fallbackUsed:c}=n;return`${[`strategy: requested=${i} used=${a}`,...o!==void 0&&Y(o)?[`constraints:`,...Object.entries(o).map(([e,t])=>` ${e}: ${lt(t)}`)]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
5
+ `)}\n`}var lt=e=>X(e)?p(e):Array.isArray(e)&&e.every(X)?e.map(e=>p(e)).join(`, `):JSON.stringify(e);function ut(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a,location:o}=e;if(t===void 0)return o!==void 0&&a!==void 0?[`status=${a} redirect=${o}`]:a===void 0?[]:[`status=${a} no response body`];let s=a===void 0||n===`GET`?``:`status=${a}`,c=Y(t)&&!q(t)?bt(t):null,l=c===null?void 0:vt(c.context)?G(c.context):c.context,u=l!==void 0&&Y(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(Y)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...q(t)?dt(t,r,i):c===null?St(t)?mt(t.filter,t.meta):Ct(t)?mt([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):wt(t)?ht(t):U(t,``):[...dt(c.page,r,i),...Object.keys(p).length===0?[]:U(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat(ft(t)))]].filter(Boolean)}function dt(e,t,n){let r=gt(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${Q(n)}`,...ft(e.content)].filter(Boolean)}function ft(e){let t=e.filter(Y);if(t.length===0)return e.length===0?[`(empty)`]:W(e,``);let n=pt(t);if(n.length===0)return W(e.slice(0,V),``);let r=t.slice(0,V).map(e=>{let t=K(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>Tt(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>V&&s.push(`... ${t.length-V} more rows`),s}function pt(e){let t=new Set(e.flatMap(e=>Object.keys(K(e)))),n=rt.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,tt-n.length);return[...n,...r].slice(0,tt)}function mt(e,t){let n=t!==void 0&&Y(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,H).forEach(e=>{i.push(` ${Z(t.filterKey)} ${Q(e.value)}`)}),e>H&&i.push(` ... ${e-H} more shown`)}return i}function ht(e){let t=Z(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,H).map(e=>`${t} ${Q(e)}`),e.result.length>H?`... ${e.result.length-H} more matches`:``].filter(Boolean)}function gt(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!it.has(e)&&t.length>0).map(([e,t])=>`${Z(e)} ${Q(t)}`)}function _t(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`method`),n=Reflect.get(e,`endpoint`);if(typeof t!=`string`||typeof n!=`string`)return null;let i=Reflect.get(e,`operationId`),a=Reflect.get(e,`summary`),o=Reflect.get(e,`httpStatus`),s=Reflect.get(e,`location`),c=Reflect.get(e,`nextCursor`),l=Reflect.get(e,`response`),u=l===void 0?void 0:r.safeParse(l);return u!==void 0&&!u.success?null:{method:t,endpoint:n,httpStatus:typeof o==`number`?o:void 0,location:typeof s==`string`?s:void 0,operationId:typeof i==`string`?i:void 0,summary:typeof a==`string`?a:void 0,nextCursor:typeof c==`string`&&c.length>0?c:void 0,response:u?.data}}function U(e,t,n){if(e===void 0)return[];if(X(e))return[`${t}${m(e,n)}`];if(Array.isArray(e))return W(e,t,n);let r=[];for(let[n,i]of Object.entries(e)){if(X(i)){r.push(`${t}${n}: ${m(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of U(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function W(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(X(i)){r.push(`${t}- ${m(i,n)}`);continue}r.push(`${t}-`);for(let e of U(i,`${t} `))r.push(e)}return r}function vt(e){let t=e.interpretation;return t!==void 0&&Y(t)}function G(e){if(X(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=G(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=G(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...at.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!at.includes(e))])}function yt(e){let t=y.safeParse(e);if(!t.success)return null;let{answer:n,citation:r,confidence:i}=t.data,a=n.trimEnd().split(`
6
+ `),o=new Set(r.flatMap(({sourceType:e,sourceId:t})=>{if(e!==g.enum.OPERATION)return[];let n=ot.get(t);return n===void 0?[]:[n]}));return o.size>0&&a.push(``,`Commands:`,...[...o].map(e=>` ${e}`)),a.push(``,`Confidence: ${i}`),r.length===0?a:(a.push(`Sources (${r.length}):`),a.push(...r.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),a)}function K(e,t=``,n=0){return X(e)?t.length===0?{}:{[t]:p(e,t)}:n>nt?{}:Array.isArray(e)?e.length===0?{}:K(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=t.length===0?e:`${t}.${e}`;return X(r)?[[i,p(r,i)]]:Object.entries(K(r,i,n+1))}))}var q=e=>Y(e)&&Array.isArray(e.content);function bt(e){let[t,...n]=Object.entries(e).filter(e=>q(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function xt(e){return Y(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var St=e=>Y(e)&&J(e.filter),Ct=e=>Y(e)&&J(e.arrayFilterEntry)&&J(e.rangeFilterEntry),J=e=>Array.isArray(e)&&e.every(xt),wt=e=>Y(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>typeof e!=`object`||!e,Z=e=>`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,Q=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,Tt=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,$=e=>e.length<=B?e:[...e.slice(0,B),`... ${e.length-B} more lines: the record continues past this fold; read the omitted section through its sub-resource operation (aventure_help names it), or request responseFormat json for the whole record.`];export{L as a,P as c,I as i,ct as n,Ze as o,Ye as r,A as s,st as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aventurevc/aventure-cli",
3
- "version": "0.8.68",
3
+ "version": "0.8.70",
4
4
  "private": false,
5
5
  "description": "Command-line access to aVenture research data on companies, people, funding, and news.",
6
6
  "homepage": "https://docs.aventure.vc/cli",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "aventurePublicApi": {
35
35
  "repository": "aventurevc/aventure-docs",
36
- "commit": "3a60a4775cc9e98c9e4b4a65a7a3be1a3c46a64f",
36
+ "commit": "27fc2bbd00197f8eab037f4af0e6e9f7c1ddc0cc",
37
37
  "openapiPath": "openapi/openapi.json",
38
- "openapiSha256": "011cd834e373114147fe16ad82e4fc70dc6fb663a7da07dc040da90f661189a0"
38
+ "openapiSha256": "0b6d828ca9f01550ec4b6364bba70b7c4d4b9ca6087e81f35d2cb9acab6337cb"
39
39
  },
40
40
  "scripts": {}
41
41
  }
@@ -1 +0,0 @@
1
- import{i as e}from"./oauth-login-emYgxHxY.js";export{e as renewOAuthTokens};