@octocodeai/octocode-tools-core 16.6.0 → 16.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -248
- package/dist/direct.js +34 -35
- package/dist/errors/localToolErrors.d.ts +1 -0
- package/dist/index.js +39 -40
- package/dist/oql/adapters/local.d.ts +1 -0
- package/dist/oql/envelope.d.ts +2 -0
- package/dist/oql/index.d.ts +2 -1
- package/dist/oql/index.js +34 -34
- package/dist/oql/schemeText.d.ts +16 -0
- package/dist/oql/types.d.ts +7 -0
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +2 -1
- package/dist/shared/config/index.js +2 -2
- package/dist/shared/config/runtimeSurface.d.ts +5 -4
- package/dist/shared/credentials/envTokens.d.ts +1 -1
- package/dist/shared/credentials/index.js +1 -1
- package/dist/shared/credentials/types.d.ts +1 -1
- package/dist/shared/paths.d.ts +2 -1
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -1
- package/dist/tools/directToolCatalog.meta.d.ts +1 -0
- package/dist/tools/github_fetch_content/scheme.d.ts +0 -82
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +0 -4
- package/dist/tools/lsp/semantic_content/scheme.d.ts +0 -14
- package/dist/tools/lsp/shared/semanticTypes.d.ts +2 -2
- package/dist/tools/package_search/execution.d.ts +23 -0
- package/dist/tools/package_search/scheme.d.ts +8 -0
- package/dist/tools/toolNames.d.ts +1 -1
- package/dist/types/server.d.ts +1 -1
- package/package.json +6 -3
|
@@ -5,4 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{randomUUID as pt}from"node:crypto";import{existsSync as J,readFileSync as ye,writeFileSync as st,unlinkSync as nt,renameSync as ot}from"node:fs";function h(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function P(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function z(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var E=new Map,Ae=300*1e3;function we(e){let t=h(e),r=E.get(t);return!r||Date.now()-r.cachedAt>=Ae?!1:r.credentials?!P(r.credentials):!0}function ee(e){e?E.delete(h(e)):E.clear()}function te(e){let t=h(e);if(we(t))return E.get(t).credentials}function re(e,t){let r=h(e);E.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as oe,readFileSync as ie,writeFileSync as ae,unlinkSync as Xt,statSync as je,chmodSync as Ue}from"node:fs";import{createCipheriv as Me,createDecipheriv as Be,randomBytes as ce}from"node:crypto";import{existsSync as He,mkdirSync as De}from"node:fs";import{join as c}from"node:path";import _ from"node:os";import Oe from"node:path";var I=_.platform()==="win32",W=_.platform()==="darwin",Le=_.platform()==="linux",T=_.homedir();function K(){return I?process.env.APPDATA||Oe.join(T,"AppData","Roaming"):T}var V=".octocode",Fe=448;function _e(e){let t=process.env[e];return t&&t.trim().length>0?t:void 0}function Ie(){return I?c(K(),V):W?c(T,V):c(_e("XDG_CONFIG_HOME")??c(T,".config"),V)}var u=Ie(),f={home:u,config:c(u,".octocoderc"),credentials:c(u,"credentials.json"),key:c(u,".key"),session:c(u,"session.json"),stats:c(u,"stats.json"),tmp:c(u,"tmp"),clone:c(u,"tmp","clone"),tree:c(u,"tmp","tree"),binary:c(u,"tmp","binary"),repos:c(u,"tmp","clone"),unzip:c(u,"tmp","unzip"),cliConfig:c(u,"config.json"),lspConfig:c(u,"lsp-servers.json")};function se(){He(f.home)||De(f.home,{recursive:!0,mode:Fe})}import{z as a}from"zod";var Ne=a.object({token:a.string(),tokenType:a.literal("oauth"),scopes:a.array(a.string()).optional(),refreshToken:a.string().optional(),expiresAt:a.string().optional(),refreshTokenExpiresAt:a.string().optional()}),Ge=a.object({hostname:a.string(),username:a.string(),token:Ne,gitProtocol:a.enum(["ssh","https"]),createdAt:a.string(),updatedAt:a.string()}),ne=a.object({version:a.number(),credentials:a.record(a.string(),Ge)});var ze=f.home,N=f.credentials,k=f.key,ue="aes-256-gcm",We=16;function x(){se()}function le(){if(x(),oe(k))return je(k).mode&511&63&&Ue(k,384),Buffer.from(ie(k,"utf8"),"hex");let e=ce(32);return ae(k,e.toString("hex"),{mode:384}),e}function fe(e){let t=le(),r=ce(We),s=Me(ue,t,r),n=s.update(e,"utf8","hex");n+=s.final("hex");let i=s.getAuthTag();return`${r.toString("hex")}:${i.toString("hex")}:${n}`}function pe(e){let t=le(),[r,s,n]=e.split(":");if(!r||!s||!n)throw new Error("Invalid encrypted data format");let i=Buffer.from(r,"hex"),C=Buffer.from(s,"hex"),m=Be(ue,t,i);m.setAuthTag(C);let Q=m.update(n,"hex","utf8");return Q+=m.final("utf8"),Q}function $(){if(x(),!oe(N))return{version:1,credentials:{}};try{let e=ie(N,"utf8"),t=pe(e),r=JSON.parse(t),s=ne.safeParse(r);return s.success?s.data:{version:1,credentials:{}}}catch{return{version:1,credentials:{}}}}function de(e){x();let t=fe(JSON.stringify(e,null,2));ae(N,t,{mode:384})}import{refreshToken as Ke}from"@octokit/oauth-methods";import{request as Ve}from"@octokit/request";var G="178c6fc778ccc68e1d6a",A="github.com";function $e(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function Je(e){return e==="github.com"||e===A?"https://api.github.com":`https://${e}/api/v3`}async function me(e,t=A,r=G){let s=await e.getCredentials(t);if(!s)return{success:!1,error:`Not logged in to ${t}`};if(!s.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(z(s))return{success:!1,error:"Refresh token has expired. Please login again."};try{let n=await Ke({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:s.token.refreshToken,request:Ve.defaults({baseUrl:Je(t)})}),i={token:n.authentication.token,tokenType:"oauth",refreshToken:n.authentication.refreshToken,expiresAt:n.authentication.expiresAt,refreshTokenExpiresAt:n.authentication.refreshTokenExpiresAt};return await e.updateToken(t,i),{success:!0,username:s.username,hostname:t}}catch(n){return{success:!1,error:n instanceof Error?$e(n.message):"Token refresh failed"}}}async function he(e,t=A,r=G){let s=await e.getCredentials(t);if(!s||!s.token)return{token:null,source:"none"};if(!P(s))return{token:s.token.token,source:"stored",username:s.username};if(s.token.refreshToken){let n=await me(e,t,r);if(n.success){let i=await e.getCredentials(t);if(i?.token.token)return{token:i.token.token,source:"refreshed",username:i.username}}return{token:null,source:"none",refreshError:n.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}import{execFile as fr}from"child_process";var qe=null;function Se(e){qe=e}async function Ye(e){let t=h(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let s=$();return s.credentials[t]=r,de(s),ee(t),{success:!0}}catch{throw new Error("Failed to store credentials")}}async function ge(e="github.com",t){let r=h(e);if(!t?.bypassCache){let i=te(r);if(i!==void 0)return i}let n=$().credentials[r]||null;return re(r,n),n}async function Ze(e,t){let r=await ge(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await Ye(r),!0):!1}async function Xe(e,t){return he({getCredentials:ge,updateToken:Ze},e,t)}Se({getTokenWithRefresh:Xe});import{z as o}from"zod";var Qe=o.object({rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),calls:o.number()}),et=o.object({hits:o.record(o.string(),o.number()).default({}),rateLimits:o.number().default(0)}),j=o.record(o.string(),o.number()).default({}),tt=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:j,rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),charSavingsCalls:o.number(),githubCacheHits:o.number(),githubCacheRateLimits:o.number(),packageRegistryFailures:o.number().default(0),packageRegistryFailuresByRegistry:j}),U=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:j,charsSavedByTool:o.record(o.string(),Qe).default({}),githubCacheHits:et.default({hits:{},rateLimits:0}),packageRegistryFailures:j,totalUsage:tt.optional()}),Ce=o.object({version:o.literal(1),sessionId:o.string(),createdAt:o.string(),lastActiveAt:o.string(),stats:U.optional()}),Te=o.object({version:o.literal(1),stats:U});function ke(e){return Object.values(e).reduce((t,r)=>t+r,0)}function rt(e){let t=e.charsSavedByTool??{},r=e.githubCacheHits??{hits:{},rateLimits:0},s=e.rateLimitsByProvider??{},n=e.packageRegistryFailures??{},i=Object.values(t).reduce((C,m)=>({rawChars:C.rawChars+m.rawChars,responseChars:C.responseChars+m.responseChars,savedChars:C.savedChars+m.savedChars,charSavingsCalls:C.charSavingsCalls+m.calls}),{rawChars:0,responseChars:0,savedChars:0,charSavingsCalls:0});return{toolCalls:e.toolCalls,errors:e.errors,rateLimits:e.rateLimits,rateLimitsByProvider:s,...i,githubCacheHits:ke(r.hits),githubCacheRateLimits:r.rateLimits,packageRegistryFailures:ke(n),packageRegistryFailuresByRegistry:n}}function p(e){let t={...e,rateLimitsByProvider:e.rateLimitsByProvider??{},charsSavedByTool:e.charsSavedByTool??{},githubCacheHits:e.githubCacheHits??{hits:{},rateLimits:0},packageRegistryFailures:e.packageRegistryFailures??{}};return{...t,totalUsage:rt(t)}}function w(){return p({toolCalls:0,errors:0,rateLimits:0,rateLimitsByProvider:{},charsSavedByTool:{},githubCacheHits:{hits:{},rateLimits:0},packageRegistryFailures:{}})}var y=f.session,v=f.stats;function xe(e,t){let r=`${e}.tmp`;st(r,JSON.stringify(t,null,2),{mode:384}),ot(r,e)}function it(e){let{stats:t,...r}=e;return r}function at(e){let t=JSON.parse(e),r=Te.safeParse(t);if(r.success)return p(r.data.stats);let s=U.safeParse(t);return s.success?p(s.data):null}function ct(e){let t=e?p(e):w();if(!J(v))return t;try{let r=ye(v,"utf8"),s=at(r);return s||t}catch{return t}}function M(e){x(),xe(v,{version:e.version,stats:p(e.stats)}),xe(y,it(e))}function ve(){if(!J(y))return null;try{let e=ye(y,"utf8"),t=JSON.parse(e),r=Ce.safeParse(t);return r.success?{...r.data,stats:ct(r.data.stats)}:null}catch{return null}}function Re(){let e=!1;for(let t of[y,v])if(J(t))try{nt(t),e=!0}catch{return!1}return e}var ut=6e4,l=null,S=!1,R=null,q=!1,O=null,L=null,H=null,B=!1;function lt(){q||(q=!0,O=()=>{D()},L=()=>{D()},H=()=>{D()},process.on("exit",O),process.on("SIGINT",L),process.on("SIGTERM",H))}function Y(){O&&(process.removeListener("exit",O),O=null),L&&(process.removeListener("SIGINT",L),L=null),H&&(process.removeListener("SIGTERM",H),H=null),q=!1}function ft(){R||(R=setInterval(()=>{S&&l&&(M(l),S=!1)},ut),R.unref())}function Z(){R&&(clearInterval(R),R=null)}function b(){if(l)return l;let e=ve();return e&&(l=e),e}function g(e){l=e,S=!0,lt(),ft()}function F(){S&&l&&(M(l),S=!1)}function D(){if(!B&&S&&l){B=!0;try{M(l),S=!1}catch{}finally{B=!1}}}function X(){l=null,S=!1,B=!1}function be(){X(),Z(),Y()}var dt=1;function mt(e){return p(e)}function ht(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t)){let i=r[s]??{rawChars:0,responseChars:0,savedChars:0,calls:0};r[s]={rawChars:i.rawChars+n.rawChars,responseChars:i.responseChars+n.responseChars,savedChars:i.savedChars+n.savedChars,calls:i.calls+n.calls}}return r}function Pe(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t))r[s]=(r[s]??0)+n;return r}function St(e,t){if(!t)return e;let r={...e.hits};for(let[s,n]of Object.entries(t.hits??{}))r[s]=(r[s]??0)+n;return{hits:r,rateLimits:e.rateLimits+(t.rateLimits??0)}}function Ee(){let e=new Date().toISOString();return{version:dt,sessionId:pt(),createdAt:e,lastActiveAt:e,stats:w()}}function gt(){return b()}function Ct(e){g(e)}function Tt(){F()}function kt(){D()}function xt(e){if(e?.forceNew){let s=Ee();return g(s),F(),s}let t=b();if(t){let s={...t,lastActiveAt:new Date().toISOString()};return g(s),F(),s}let r=Ee();return g(r),F(),r}function yt(){return b()?.sessionId??null}function d(e){let t=b();if(!t)return{success:!1,session:null};let r=mt(t.stats),s=p({toolCalls:r.toolCalls+(e.toolCalls??0),errors:r.errors+(e.errors??0),rateLimits:r.rateLimits+(e.rateLimits??0),rateLimitsByProvider:Pe(r.rateLimitsByProvider,e.rateLimitsByProvider),charsSavedByTool:ht(r.charsSavedByTool,e.charsSavedByTool),githubCacheHits:St(r.githubCacheHits,e.githubCacheHits),packageRegistryFailures:Pe(r.packageRegistryFailures,e.packageRegistryFailures)}),n={...t,lastActiveAt:new Date().toISOString(),stats:s};return g(n),{success:!0,session:n}}function vt(e=1){return d({toolCalls:e})}function Rt(e=1){return d({errors:e})}function bt(e=1){return d({rateLimits:e})}function Pt(e,t=1){return d({rateLimits:t,rateLimitsByProvider:{[e]:t}})}function Et(e,t,r){let s=Number.isFinite(t)?Math.max(0,t):0,n=Number.isFinite(r)?Math.max(0,r):0;return d({charsSavedByTool:{[e]:{rawChars:s,responseChars:n,savedChars:Math.max(0,s-n),calls:1}}})}function At(e,t=1){return d({githubCacheHits:{hits:{[e]:t},rateLimits:0}})}function wt(e=1){return d({githubCacheHits:{hits:{},rateLimits:e}})}function Ot(e,t=1){return d({packageRegistryFailures:{[e]:t}})}function Lt(){let e=b();if(!e)return{success:!1,session:null};let t={...e,lastActiveAt:new Date().toISOString(),stats:w()};return g(t),{success:!0,session:t}}function Ht(){return X(),Z(),Y(),Re()}function Dt(){be()}export{y as SESSION_FILE,v as STATS_FILE,Dt as _resetSessionState,Ht as deleteSession,Tt as flushSession,kt as flushSessionSync,xt as getOrCreateSession,yt as getSessionId,Rt as incrementErrors,At as incrementGitHubCacheHits,wt as incrementGitHubCacheRateLimits,Ot as incrementPackageRegistryFailures,Pt as incrementRateLimitByProvider,bt as incrementRateLimits,vt as incrementToolCalls,Et as incrementToolCharSavings,gt as readSession,Lt as resetSessionStats,d as updateSessionStats,Ct as writeSession};
|
|
8
|
+
import{randomUUID as dt}from"node:crypto";import{existsSync as J,readFileSync as ve,writeFileSync as nt,unlinkSync as ot,renameSync as it}from"node:fs";function h(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function E(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function z(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var P=new Map,we=300*1e3;function Oe(e){let t=h(e),r=P.get(t);return!r||Date.now()-r.cachedAt>=we?!1:r.credentials?!E(r.credentials):!0}function ee(e){e?P.delete(h(e)):P.clear()}function te(e){let t=h(e);if(Oe(t))return P.get(t).credentials}function re(e,t){let r=h(e);P.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as ie,readFileSync as ae,writeFileSync as ce,unlinkSync as Qt,statSync as je,chmodSync as Me}from"node:fs";import{createCipheriv as Be,createDecipheriv as ze,randomBytes as ue}from"node:crypto";import{existsSync as De,mkdirSync as Fe}from"node:fs";import{join as c,resolve as _e}from"node:path";import _ from"node:os";import Le from"node:path";var I=_.platform()==="win32",W=_.platform()==="darwin",He=_.platform()==="linux",T=_.homedir();function K(){return I?process.env.APPDATA||Le.join(T,"AppData","Roaming"):T}var V=".octocode",Ie=448;function se(e){let t=process.env[e];return t&&t.trim().length>0?t:void 0}function Ne(){let e=se("OCTOCODE_HOME");return e?_e(e):I?c(K(),V):W?c(T,V):c(se("XDG_CONFIG_HOME")??c(T,".config"),V)}var u=Ne(),f={home:u,config:c(u,".octocoderc"),credentials:c(u,"credentials.json"),key:c(u,".key"),session:c(u,"session.json"),stats:c(u,"stats.json"),tmp:c(u,"tmp"),clone:c(u,"tmp","clone"),tree:c(u,"tmp","tree"),binary:c(u,"tmp","binary"),repos:c(u,"tmp","clone"),unzip:c(u,"tmp","unzip"),cliConfig:c(u,"config.json"),lspConfig:c(u,"lsp-servers.json")};function ne(){De(f.home)||Fe(f.home,{recursive:!0,mode:Ie})}import{z as a}from"zod";var Ge=a.object({token:a.string(),tokenType:a.literal("oauth"),scopes:a.array(a.string()).optional(),refreshToken:a.string().optional(),expiresAt:a.string().optional(),refreshTokenExpiresAt:a.string().optional()}),Ue=a.object({hostname:a.string(),username:a.string(),token:Ge,gitProtocol:a.enum(["ssh","https"]),createdAt:a.string(),updatedAt:a.string()}),oe=a.object({version:a.number(),credentials:a.record(a.string(),Ue)});var We=f.home,N=f.credentials,k=f.key,le="aes-256-gcm",Ke=16;function x(){ne()}function fe(){if(x(),ie(k))return je(k).mode&511&63&&Me(k,384),Buffer.from(ae(k,"utf8"),"hex");let e=ue(32);return ce(k,e.toString("hex"),{mode:384}),e}function pe(e){let t=fe(),r=ue(Ke),s=Be(le,t,r),n=s.update(e,"utf8","hex");n+=s.final("hex");let i=s.getAuthTag();return`${r.toString("hex")}:${i.toString("hex")}:${n}`}function de(e){let t=fe(),[r,s,n]=e.split(":");if(!r||!s||!n)throw new Error("Invalid encrypted data format");let i=Buffer.from(r,"hex"),C=Buffer.from(s,"hex"),m=ze(le,t,i);m.setAuthTag(C);let Q=m.update(n,"hex","utf8");return Q+=m.final("utf8"),Q}function $(){if(x(),!ie(N))return{version:1,credentials:{}};try{let e=ae(N,"utf8"),t=de(e),r=JSON.parse(t),s=oe.safeParse(r);return s.success?s.data:{version:1,credentials:{}}}catch{return{version:1,credentials:{}}}}function me(e){x();let t=pe(JSON.stringify(e,null,2));ce(N,t,{mode:384})}import{refreshToken as Ve}from"@octokit/oauth-methods";import{request as $e}from"@octokit/request";var G="178c6fc778ccc68e1d6a",A="github.com";function Je(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function qe(e){return e==="github.com"||e===A?"https://api.github.com":`https://${e}/api/v3`}async function he(e,t=A,r=G){let s=await e.getCredentials(t);if(!s)return{success:!1,error:`Not logged in to ${t}`};if(!s.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(z(s))return{success:!1,error:"Refresh token has expired. Please login again."};try{let n=await Ve({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:s.token.refreshToken,request:$e.defaults({baseUrl:qe(t)})}),i={token:n.authentication.token,tokenType:"oauth",refreshToken:n.authentication.refreshToken,expiresAt:n.authentication.expiresAt,refreshTokenExpiresAt:n.authentication.refreshTokenExpiresAt};return await e.updateToken(t,i),{success:!0,username:s.username,hostname:t}}catch(n){return{success:!1,error:n instanceof Error?Je(n.message):"Token refresh failed"}}}async function Se(e,t=A,r=G){let s=await e.getCredentials(t);if(!s||!s.token)return{token:null,source:"none"};if(!E(s))return{token:s.token.token,source:"stored",username:s.username};if(s.token.refreshToken){let n=await he(e,t,r);if(n.success){let i=await e.getCredentials(t);if(i?.token.token)return{token:i.token.token,source:"refreshed",username:i.username}}return{token:null,source:"none",refreshError:n.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}import{execFile as pr}from"child_process";var Ye=null;function ge(e){Ye=e}async function Ze(e){let t=h(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let s=$();return s.credentials[t]=r,me(s),ee(t),{success:!0}}catch{throw new Error("Failed to store credentials")}}async function Ce(e="github.com",t){let r=h(e);if(!t?.bypassCache){let i=te(r);if(i!==void 0)return i}let n=$().credentials[r]||null;return re(r,n),n}async function Xe(e,t){let r=await Ce(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await Ze(r),!0):!1}async function Qe(e,t){return Se({getCredentials:Ce,updateToken:Xe},e,t)}ge({getTokenWithRefresh:Qe});import{z as o}from"zod";var et=o.object({rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),calls:o.number()}),tt=o.object({hits:o.record(o.string(),o.number()).default({}),rateLimits:o.number().default(0)}),U=o.record(o.string(),o.number()).default({}),rt=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:U,rawChars:o.number(),responseChars:o.number(),savedChars:o.number(),charSavingsCalls:o.number(),githubCacheHits:o.number(),githubCacheRateLimits:o.number(),packageRegistryFailures:o.number().default(0),packageRegistryFailuresByRegistry:U}),j=o.object({toolCalls:o.number(),errors:o.number(),rateLimits:o.number(),rateLimitsByProvider:U,charsSavedByTool:o.record(o.string(),et).default({}),githubCacheHits:tt.default({hits:{},rateLimits:0}),packageRegistryFailures:U,totalUsage:rt.optional()}),Te=o.object({version:o.literal(1),sessionId:o.string(),createdAt:o.string(),lastActiveAt:o.string(),stats:j.optional()}),ke=o.object({version:o.literal(1),stats:j});function xe(e){return Object.values(e).reduce((t,r)=>t+r,0)}function st(e){let t=e.charsSavedByTool??{},r=e.githubCacheHits??{hits:{},rateLimits:0},s=e.rateLimitsByProvider??{},n=e.packageRegistryFailures??{},i=Object.values(t).reduce((C,m)=>({rawChars:C.rawChars+m.rawChars,responseChars:C.responseChars+m.responseChars,savedChars:C.savedChars+m.savedChars,charSavingsCalls:C.charSavingsCalls+m.calls}),{rawChars:0,responseChars:0,savedChars:0,charSavingsCalls:0});return{toolCalls:e.toolCalls,errors:e.errors,rateLimits:e.rateLimits,rateLimitsByProvider:s,...i,githubCacheHits:xe(r.hits),githubCacheRateLimits:r.rateLimits,packageRegistryFailures:xe(n),packageRegistryFailuresByRegistry:n}}function p(e){let t={...e,rateLimitsByProvider:e.rateLimitsByProvider??{},charsSavedByTool:e.charsSavedByTool??{},githubCacheHits:e.githubCacheHits??{hits:{},rateLimits:0},packageRegistryFailures:e.packageRegistryFailures??{}};return{...t,totalUsage:st(t)}}function w(){return p({toolCalls:0,errors:0,rateLimits:0,rateLimitsByProvider:{},charsSavedByTool:{},githubCacheHits:{hits:{},rateLimits:0},packageRegistryFailures:{}})}var y=f.session,v=f.stats;function ye(e,t){let r=`${e}.tmp`;nt(r,JSON.stringify(t,null,2),{mode:384}),it(r,e)}function at(e){let{stats:t,...r}=e;return r}function ct(e){let t=JSON.parse(e),r=ke.safeParse(t);if(r.success)return p(r.data.stats);let s=j.safeParse(t);return s.success?p(s.data):null}function ut(e){let t=e?p(e):w();if(!J(v))return t;try{let r=ve(v,"utf8"),s=ct(r);return s||t}catch{return t}}function M(e){x(),ye(v,{version:e.version,stats:p(e.stats)}),ye(y,at(e))}function Re(){if(!J(y))return null;try{let e=ve(y,"utf8"),t=JSON.parse(e),r=Te.safeParse(t);return r.success?{...r.data,stats:ut(r.data.stats)}:null}catch{return null}}function be(){let e=!1;for(let t of[y,v])if(J(t))try{ot(t),e=!0}catch{return!1}return e}var lt=6e4,l=null,S=!1,R=null,q=!1,O=null,L=null,H=null,B=!1;function ft(){q||(q=!0,O=()=>{D()},L=()=>{D()},H=()=>{D()},process.on("exit",O),process.on("SIGINT",L),process.on("SIGTERM",H))}function Y(){O&&(process.removeListener("exit",O),O=null),L&&(process.removeListener("SIGINT",L),L=null),H&&(process.removeListener("SIGTERM",H),H=null),q=!1}function pt(){R||(R=setInterval(()=>{S&&l&&(M(l),S=!1)},lt),R.unref())}function Z(){R&&(clearInterval(R),R=null)}function b(){if(l)return l;let e=Re();return e&&(l=e),e}function g(e){l=e,S=!0,ft(),pt()}function F(){S&&l&&(M(l),S=!1)}function D(){if(!B&&S&&l){B=!0;try{M(l),S=!1}catch{}finally{B=!1}}}function X(){l=null,S=!1,B=!1}function Ee(){X(),Z(),Y()}var mt=1;function ht(e){return p(e)}function St(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t)){let i=r[s]??{rawChars:0,responseChars:0,savedChars:0,calls:0};r[s]={rawChars:i.rawChars+n.rawChars,responseChars:i.responseChars+n.responseChars,savedChars:i.savedChars+n.savedChars,calls:i.calls+n.calls}}return r}function Pe(e,t){if(!t)return e;let r={...e};for(let[s,n]of Object.entries(t))r[s]=(r[s]??0)+n;return r}function gt(e,t){if(!t)return e;let r={...e.hits};for(let[s,n]of Object.entries(t.hits??{}))r[s]=(r[s]??0)+n;return{hits:r,rateLimits:e.rateLimits+(t.rateLimits??0)}}function Ae(){let e=new Date().toISOString();return{version:mt,sessionId:dt(),createdAt:e,lastActiveAt:e,stats:w()}}function Ct(){return b()}function Tt(e){g(e)}function kt(){F()}function xt(){D()}function yt(e){if(e?.forceNew){let s=Ae();return g(s),F(),s}let t=b();if(t){let s={...t,lastActiveAt:new Date().toISOString()};return g(s),F(),s}let r=Ae();return g(r),F(),r}function vt(){return b()?.sessionId??null}function d(e){let t=b();if(!t)return{success:!1,session:null};let r=ht(t.stats),s=p({toolCalls:r.toolCalls+(e.toolCalls??0),errors:r.errors+(e.errors??0),rateLimits:r.rateLimits+(e.rateLimits??0),rateLimitsByProvider:Pe(r.rateLimitsByProvider,e.rateLimitsByProvider),charsSavedByTool:St(r.charsSavedByTool,e.charsSavedByTool),githubCacheHits:gt(r.githubCacheHits,e.githubCacheHits),packageRegistryFailures:Pe(r.packageRegistryFailures,e.packageRegistryFailures)}),n={...t,lastActiveAt:new Date().toISOString(),stats:s};return g(n),{success:!0,session:n}}function Rt(e=1){return d({toolCalls:e})}function bt(e=1){return d({errors:e})}function Et(e=1){return d({rateLimits:e})}function Pt(e,t=1){return d({rateLimits:t,rateLimitsByProvider:{[e]:t}})}function At(e,t,r){let s=Number.isFinite(t)?Math.max(0,t):0,n=Number.isFinite(r)?Math.max(0,r):0;return d({charsSavedByTool:{[e]:{rawChars:s,responseChars:n,savedChars:Math.max(0,s-n),calls:1}}})}function wt(e,t=1){return d({githubCacheHits:{hits:{[e]:t},rateLimits:0}})}function Ot(e=1){return d({githubCacheHits:{hits:{},rateLimits:e}})}function Lt(e,t=1){return d({packageRegistryFailures:{[e]:t}})}function Ht(){let e=b();if(!e)return{success:!1,session:null};let t={...e,lastActiveAt:new Date().toISOString(),stats:w()};return g(t),{success:!0,session:t}}function Dt(){return X(),Z(),Y(),be()}function Ft(){Ee()}export{y as SESSION_FILE,v as STATS_FILE,Ft as _resetSessionState,Dt as deleteSession,kt as flushSession,xt as flushSessionSync,yt as getOrCreateSession,vt as getSessionId,bt as incrementErrors,wt as incrementGitHubCacheHits,Ot as incrementGitHubCacheRateLimits,Lt as incrementPackageRegistryFailures,Pt as incrementRateLimitByProvider,Et as incrementRateLimits,Rt as incrementToolCalls,At as incrementToolCharSavings,Ct as readSession,Ht as resetSessionStats,d as updateSessionStats,Tt as writeSession};
|
|
@@ -52,6 +52,7 @@ export interface DirectToolMetadata {
|
|
|
52
52
|
}
|
|
53
53
|
export interface PrepareDirectToolInputOptions {
|
|
54
54
|
sourceLabel?: string;
|
|
55
|
+
rejectUnknownFields?: boolean;
|
|
55
56
|
onUnknownFields?: (unknownFields: string[], queryIndex: number) => void;
|
|
56
57
|
}
|
|
57
58
|
export declare class DirectToolInputError extends Error {
|
|
@@ -50,88 +50,6 @@ export declare const GitHubFetchContentOutputLocalSchema: z.ZodObject<{
|
|
|
50
50
|
}, z.core.$strip>>;
|
|
51
51
|
results: z.ZodArray<z.ZodObject<{
|
|
52
52
|
id: z.ZodString;
|
|
53
|
-
owner: z.ZodString;
|
|
54
|
-
repo: z.ZodString;
|
|
55
|
-
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
56
|
-
path: z.ZodString;
|
|
57
|
-
content: z.ZodString;
|
|
58
|
-
localPath: z.ZodOptional<z.ZodString>;
|
|
59
|
-
repoRoot: z.ZodOptional<z.ZodString>;
|
|
60
|
-
contentView: z.ZodOptional<z.ZodEnum<{
|
|
61
|
-
none: "none";
|
|
62
|
-
standard: "standard";
|
|
63
|
-
symbols: "symbols";
|
|
64
|
-
}>>;
|
|
65
|
-
isSkeleton: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
-
totalLines: z.ZodOptional<z.ZodNumber>;
|
|
67
|
-
sourceChars: z.ZodOptional<z.ZodNumber>;
|
|
68
|
-
sourceBytes: z.ZodOptional<z.ZodNumber>;
|
|
69
|
-
resolvedBranch: z.ZodOptional<z.ZodString>;
|
|
70
|
-
pagination: z.ZodOptional<z.ZodObject<{
|
|
71
|
-
currentPage: z.ZodNumber;
|
|
72
|
-
totalPages: z.ZodNumber;
|
|
73
|
-
hasMore: z.ZodBoolean;
|
|
74
|
-
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
75
|
-
nextMatchPage: z.ZodOptional<z.ZodNumber>;
|
|
76
|
-
charOffset: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
charLength: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
totalChars: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
nextCharOffset: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
filesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
81
|
-
totalFiles: z.ZodOptional<z.ZodNumber>;
|
|
82
|
-
entriesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
83
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
matchesPerPage: z.ZodOptional<z.ZodNumber>;
|
|
85
|
-
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
86
|
-
}, z.core.$strip>>;
|
|
87
|
-
isPartial: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
-
startLine: z.ZodOptional<z.ZodNumber>;
|
|
89
|
-
endLine: z.ZodOptional<z.ZodNumber>;
|
|
90
|
-
matchRanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
|
-
start: z.ZodNumber;
|
|
92
|
-
end: z.ZodNumber;
|
|
93
|
-
}, z.core.$strip>>>;
|
|
94
|
-
lastModified: z.ZodOptional<z.ZodString>;
|
|
95
|
-
lastModifiedBy: z.ZodOptional<z.ZodString>;
|
|
96
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
|
-
matchNotFound: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
-
searchedFor: z.ZodOptional<z.ZodString>;
|
|
99
|
-
cached: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
-
}, z.core.$strip>>>;
|
|
101
|
-
directories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
|
-
path: z.ZodString;
|
|
103
|
-
localPath: z.ZodString;
|
|
104
|
-
repoRoot: z.ZodOptional<z.ZodString>;
|
|
105
|
-
fileCount: z.ZodNumber;
|
|
106
|
-
totalSize: z.ZodNumber;
|
|
107
|
-
complete: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
-
directoryEntryCount: z.ZodOptional<z.ZodNumber>;
|
|
109
|
-
eligibleFileCount: z.ZodOptional<z.ZodNumber>;
|
|
110
|
-
savedFileCount: z.ZodOptional<z.ZodNumber>;
|
|
111
|
-
skipped: z.ZodOptional<z.ZodObject<{
|
|
112
|
-
nonFile: z.ZodNumber;
|
|
113
|
-
missingDownloadUrl: z.ZodNumber;
|
|
114
|
-
oversized: z.ZodNumber;
|
|
115
|
-
binary: z.ZodNumber;
|
|
116
|
-
fileLimit: z.ZodNumber;
|
|
117
|
-
fetchFailed: z.ZodNumber;
|
|
118
|
-
totalSizeLimit: z.ZodNumber;
|
|
119
|
-
pathTraversal: z.ZodNumber;
|
|
120
|
-
}, z.core.$strip>>;
|
|
121
|
-
limits: z.ZodOptional<z.ZodObject<{
|
|
122
|
-
maxDirectoryFiles: z.ZodNumber;
|
|
123
|
-
maxTotalSize: z.ZodNumber;
|
|
124
|
-
maxFileSize: z.ZodNumber;
|
|
125
|
-
}, z.core.$strip>>;
|
|
126
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
-
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
-
path: z.ZodString;
|
|
129
|
-
size: z.ZodNumber;
|
|
130
|
-
type: z.ZodString;
|
|
131
|
-
}, z.core.$strip>>>;
|
|
132
|
-
cached: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
-
resolvedBranch: z.ZodOptional<z.ZodString>;
|
|
134
|
-
}, z.core.$strip>>>;
|
|
135
53
|
data: z.ZodOptional<z.ZodObject<{
|
|
136
54
|
owner: z.ZodString;
|
|
137
55
|
repo: z.ZodString;
|
|
@@ -37,7 +37,6 @@ export declare function inspectBinary(query: BinaryInspectQuery): Promise<import
|
|
|
37
37
|
totalPages: number;
|
|
38
38
|
hasMore: boolean;
|
|
39
39
|
entriesPerPage: number;
|
|
40
|
-
totalEntries: number;
|
|
41
40
|
};
|
|
42
41
|
status: "success";
|
|
43
42
|
mode: "list";
|
|
@@ -54,7 +53,6 @@ export declare function inspectBinary(query: BinaryInspectQuery): Promise<import
|
|
|
54
53
|
backend: string;
|
|
55
54
|
localPath: string;
|
|
56
55
|
content: string;
|
|
57
|
-
contentLength: number;
|
|
58
56
|
isPartial: boolean;
|
|
59
57
|
} | {
|
|
60
58
|
pagination?: ContentCharPagination;
|
|
@@ -65,13 +63,11 @@ export declare function inspectBinary(query: BinaryInspectQuery): Promise<import
|
|
|
65
63
|
backend: string;
|
|
66
64
|
localPath: string;
|
|
67
65
|
content: string;
|
|
68
|
-
contentLength: number;
|
|
69
66
|
isPartial: boolean;
|
|
70
67
|
} | {
|
|
71
68
|
nextScanOffset?: number;
|
|
72
69
|
scanOffset: number;
|
|
73
70
|
pagination?: ContentCharPagination;
|
|
74
|
-
contentLength: number;
|
|
75
71
|
totalFound: number;
|
|
76
72
|
isPartial: boolean;
|
|
77
73
|
localPath?: string;
|
|
@@ -156,7 +156,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
156
156
|
totalFiles: z.ZodNumber;
|
|
157
157
|
empty: z.ZodOptional<z.ZodObject<{
|
|
158
158
|
category: z.ZodEnum<{
|
|
159
|
-
serverUnavailable: "serverUnavailable";
|
|
160
159
|
unsupportedOperation: "unsupportedOperation";
|
|
161
160
|
symbolNotFound: "symbolNotFound";
|
|
162
161
|
anchorFailed: "anchorFailed";
|
|
@@ -218,7 +217,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
218
217
|
}, z.core.$strip>;
|
|
219
218
|
empty: z.ZodOptional<z.ZodObject<{
|
|
220
219
|
category: z.ZodEnum<{
|
|
221
|
-
serverUnavailable: "serverUnavailable";
|
|
222
220
|
unsupportedOperation: "unsupportedOperation";
|
|
223
221
|
symbolNotFound: "symbolNotFound";
|
|
224
222
|
anchorFailed: "anchorFailed";
|
|
@@ -261,7 +259,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
261
259
|
topLevelSymbols: z.ZodOptional<z.ZodNumber>;
|
|
262
260
|
empty: z.ZodOptional<z.ZodObject<{
|
|
263
261
|
category: z.ZodEnum<{
|
|
264
|
-
serverUnavailable: "serverUnavailable";
|
|
265
262
|
unsupportedOperation: "unsupportedOperation";
|
|
266
263
|
symbolNotFound: "symbolNotFound";
|
|
267
264
|
anchorFailed: "anchorFailed";
|
|
@@ -282,7 +279,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
282
279
|
totalSymbols: z.ZodNumber;
|
|
283
280
|
empty: z.ZodOptional<z.ZodObject<{
|
|
284
281
|
category: z.ZodEnum<{
|
|
285
|
-
serverUnavailable: "serverUnavailable";
|
|
286
282
|
unsupportedOperation: "unsupportedOperation";
|
|
287
283
|
symbolNotFound: "symbolNotFound";
|
|
288
284
|
anchorFailed: "anchorFailed";
|
|
@@ -307,7 +303,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
307
303
|
totalItems: z.ZodNumber;
|
|
308
304
|
empty: z.ZodOptional<z.ZodObject<{
|
|
309
305
|
category: z.ZodEnum<{
|
|
310
|
-
serverUnavailable: "serverUnavailable";
|
|
311
306
|
unsupportedOperation: "unsupportedOperation";
|
|
312
307
|
symbolNotFound: "symbolNotFound";
|
|
313
308
|
anchorFailed: "anchorFailed";
|
|
@@ -329,7 +324,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
329
324
|
warningCount: z.ZodNumber;
|
|
330
325
|
empty: z.ZodOptional<z.ZodObject<{
|
|
331
326
|
category: z.ZodEnum<{
|
|
332
|
-
serverUnavailable: "serverUnavailable";
|
|
333
327
|
unsupportedOperation: "unsupportedOperation";
|
|
334
328
|
symbolNotFound: "symbolNotFound";
|
|
335
329
|
anchorFailed: "anchorFailed";
|
|
@@ -346,7 +340,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
346
340
|
}, z.core.$strip>, z.ZodObject<{
|
|
347
341
|
kind: z.ZodLiteral<"empty">;
|
|
348
342
|
category: z.ZodEnum<{
|
|
349
|
-
serverUnavailable: "serverUnavailable";
|
|
350
343
|
unsupportedOperation: "unsupportedOperation";
|
|
351
344
|
symbolNotFound: "symbolNotFound";
|
|
352
345
|
anchorFailed: "anchorFailed";
|
|
@@ -454,7 +447,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
454
447
|
totalFiles: z.ZodNumber;
|
|
455
448
|
empty: z.ZodOptional<z.ZodObject<{
|
|
456
449
|
category: z.ZodEnum<{
|
|
457
|
-
serverUnavailable: "serverUnavailable";
|
|
458
450
|
unsupportedOperation: "unsupportedOperation";
|
|
459
451
|
symbolNotFound: "symbolNotFound";
|
|
460
452
|
anchorFailed: "anchorFailed";
|
|
@@ -516,7 +508,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
516
508
|
}, z.core.$strip>;
|
|
517
509
|
empty: z.ZodOptional<z.ZodObject<{
|
|
518
510
|
category: z.ZodEnum<{
|
|
519
|
-
serverUnavailable: "serverUnavailable";
|
|
520
511
|
unsupportedOperation: "unsupportedOperation";
|
|
521
512
|
symbolNotFound: "symbolNotFound";
|
|
522
513
|
anchorFailed: "anchorFailed";
|
|
@@ -559,7 +550,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
559
550
|
topLevelSymbols: z.ZodOptional<z.ZodNumber>;
|
|
560
551
|
empty: z.ZodOptional<z.ZodObject<{
|
|
561
552
|
category: z.ZodEnum<{
|
|
562
|
-
serverUnavailable: "serverUnavailable";
|
|
563
553
|
unsupportedOperation: "unsupportedOperation";
|
|
564
554
|
symbolNotFound: "symbolNotFound";
|
|
565
555
|
anchorFailed: "anchorFailed";
|
|
@@ -580,7 +570,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
580
570
|
totalSymbols: z.ZodNumber;
|
|
581
571
|
empty: z.ZodOptional<z.ZodObject<{
|
|
582
572
|
category: z.ZodEnum<{
|
|
583
|
-
serverUnavailable: "serverUnavailable";
|
|
584
573
|
unsupportedOperation: "unsupportedOperation";
|
|
585
574
|
symbolNotFound: "symbolNotFound";
|
|
586
575
|
anchorFailed: "anchorFailed";
|
|
@@ -605,7 +594,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
605
594
|
totalItems: z.ZodNumber;
|
|
606
595
|
empty: z.ZodOptional<z.ZodObject<{
|
|
607
596
|
category: z.ZodEnum<{
|
|
608
|
-
serverUnavailable: "serverUnavailable";
|
|
609
597
|
unsupportedOperation: "unsupportedOperation";
|
|
610
598
|
symbolNotFound: "symbolNotFound";
|
|
611
599
|
anchorFailed: "anchorFailed";
|
|
@@ -627,7 +615,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
627
615
|
warningCount: z.ZodNumber;
|
|
628
616
|
empty: z.ZodOptional<z.ZodObject<{
|
|
629
617
|
category: z.ZodEnum<{
|
|
630
|
-
serverUnavailable: "serverUnavailable";
|
|
631
618
|
unsupportedOperation: "unsupportedOperation";
|
|
632
619
|
symbolNotFound: "symbolNotFound";
|
|
633
620
|
anchorFailed: "anchorFailed";
|
|
@@ -644,7 +631,6 @@ export declare const LspGetSemanticsOutputSchema: z.ZodObject<{
|
|
|
644
631
|
}, z.core.$strip>, z.ZodObject<{
|
|
645
632
|
kind: z.ZodLiteral<"empty">;
|
|
646
633
|
category: z.ZodEnum<{
|
|
647
|
-
serverUnavailable: "serverUnavailable";
|
|
648
634
|
unsupportedOperation: "unsupportedOperation";
|
|
649
635
|
symbolNotFound: "symbolNotFound";
|
|
650
636
|
anchorFailed: "anchorFailed";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExactPosition, LSPRange } from '@octocodeai/octocode-engine/lsp/types';
|
|
2
|
-
export {
|
|
2
|
+
export { LSP_GET_SEMANTICS_TOOL_NAME } from '../../toolNames.js';
|
|
3
3
|
export declare const SEMANTIC_CONTENT_TYPES: readonly ["definition", "references", "callers", "callees", "callHierarchy", "hover", "documentSymbols", "typeDefinition", "implementation", "workspaceSymbol", "supertypes", "subtypes", "diagnostic"];
|
|
4
4
|
export type SemanticContentType = (typeof SEMANTIC_CONTENT_TYPES)[number];
|
|
5
5
|
export type SemanticOutputFormat = 'structured' | 'compact';
|
|
@@ -74,7 +74,7 @@ export declare function compactLocation(snippet: {
|
|
|
74
74
|
};
|
|
75
75
|
isDefinition?: boolean;
|
|
76
76
|
}): CompactLocation;
|
|
77
|
-
export type SemanticEmptyCategory = '
|
|
77
|
+
export type SemanticEmptyCategory = 'unsupportedOperation' | 'symbolNotFound' | 'anchorFailed' | 'noLocations' | 'noReferences' | 'noHover' | 'noCalls' | 'noWorkspaceSymbols' | 'noTypeHierarchy' | 'noDiagnostics';
|
|
78
78
|
export type SemanticEmptyState = {
|
|
79
79
|
category: SemanticEmptyCategory;
|
|
80
80
|
reason: string;
|
|
@@ -3,6 +3,29 @@ import type { z } from 'zod';
|
|
|
3
3
|
import type { NpmPackageQuerySchema } from '@octocodeai/octocode-core/schemas';
|
|
4
4
|
type NpmSearchQuery = z.input<typeof NpmPackageQuerySchema>;
|
|
5
5
|
import type { ToolExecutionArgs } from '../../types/execution.js';
|
|
6
|
+
type PackageData = {
|
|
7
|
+
name: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
license?: string;
|
|
11
|
+
downloads?: number;
|
|
12
|
+
repository?: string;
|
|
13
|
+
repositoryDirectory?: string;
|
|
14
|
+
repositoryId?: string;
|
|
15
|
+
next?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
type PackageRepositoryData = {
|
|
18
|
+
repository: string;
|
|
19
|
+
owner: string;
|
|
20
|
+
repo: string;
|
|
21
|
+
repositoryDirectory?: string;
|
|
22
|
+
next: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
type CompactPackageData = {
|
|
25
|
+
packages: PackageData[];
|
|
26
|
+
repositories?: Record<string, PackageRepositoryData>;
|
|
27
|
+
};
|
|
28
|
+
export declare function compactPackageRepositories(packages: PackageData[]): CompactPackageData;
|
|
6
29
|
type PackagePagination = {
|
|
7
30
|
currentPage: number;
|
|
8
31
|
totalPages: number;
|
|
@@ -24,8 +24,16 @@ export declare const NpmSearchOutputLocalSchema: z.ZodObject<{
|
|
|
24
24
|
downloads: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
repository: z.ZodOptional<z.ZodString>;
|
|
26
26
|
repositoryDirectory: z.ZodOptional<z.ZodString>;
|
|
27
|
+
repositoryId: z.ZodOptional<z.ZodString>;
|
|
27
28
|
next: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
29
|
}, z.core.$loose>>>;
|
|
30
|
+
repositories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
31
|
+
repository: z.ZodString;
|
|
32
|
+
owner: z.ZodString;
|
|
33
|
+
repo: z.ZodString;
|
|
34
|
+
repositoryDirectory: z.ZodOptional<z.ZodString>;
|
|
35
|
+
next: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
36
|
+
}, z.core.$loose>>>;
|
|
29
37
|
pagination: z.ZodOptional<z.ZodObject<{
|
|
30
38
|
currentPage: z.ZodNumber;
|
|
31
39
|
totalPages: z.ZodNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const STATIC_TOOL_NAMES: import("@octocodeai/octocode-core/types").ToolNames;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const LSP_GET_SEMANTICS_TOOL_NAME: "lspGetSemantics";
|
|
3
3
|
export declare const OQL_SEARCH_TOOL_NAME = "oqlSearch";
|
|
4
4
|
export declare function isLocalTool(toolName: string): boolean;
|
package/dist/types/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TokenSourceType = 'env:OCTOCODE_TOKEN' | 'env:GH_TOKEN' | 'env:GITHUB_TOKEN' | 'gh-cli' | 'octocode-storage' | 'none';
|
|
1
|
+
export type TokenSourceType = 'env:OCTOCODE_TOKEN' | 'env:GH_TOKEN' | 'env:GITHUB_TOKEN' | 'env:GITHUB_PERSONAL_ACCESS_TOKEN' | 'gh-cli' | 'octocode-storage' | 'none';
|
|
2
2
|
export interface ServerConfig {
|
|
3
3
|
version: string;
|
|
4
4
|
githubApiUrl: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octocodeai/octocode-tools-core",
|
|
3
|
-
"version": "16.6.
|
|
3
|
+
"version": "16.6.2",
|
|
4
4
|
"description": "Core tool implementations for Octocode: GitHub, local filesystem, LSP, and package search tools.",
|
|
5
5
|
"author": "Guy Bary <bgauryy@octocodeai.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
8
11
|
"main": "dist/index.js",
|
|
9
12
|
"types": "dist/index.d.ts",
|
|
10
13
|
"exports": {
|
|
@@ -80,8 +83,8 @@
|
|
|
80
83
|
},
|
|
81
84
|
"dependencies": {
|
|
82
85
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
83
|
-
"@octocodeai/octocode-core": "^16.
|
|
84
|
-
"@octocodeai/octocode-engine": "^16.6.
|
|
86
|
+
"@octocodeai/octocode-core": "^16.6.1",
|
|
87
|
+
"@octocodeai/octocode-engine": "^16.6.2",
|
|
85
88
|
"@octokit/oauth-methods": "^6.0.2",
|
|
86
89
|
"@octokit/plugin-throttling": "^11.0.3",
|
|
87
90
|
"@octokit/request": "^10.0.10",
|