@easbot/codebase 0.3.39 → 0.3.40
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.en.md +1 -1
- package/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +9 -9
package/README.en.md
CHANGED
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkP3IAXGOT_cjs=require('./chunks/chunk-P3IAXGOT.cjs'),chunkXGZDPIEP_cjs=require('./chunks/chunk-XGZDPIEP.cjs'),chunkY7JDLK56_cjs=require('./chunks/chunk-Y7JDLK56.cjs'),chunkJ7Z3MIR7_cjs=require('./chunks/chunk-J7Z3MIR7.cjs');require('./chunks/chunk-D5NDNAKA.cjs');var chunk3DAM6EZN_cjs=require('./chunks/chunk-3DAM6EZN.cjs'),chunkAARBEAIB_cjs=require('./chunks/chunk-AARBEAIB.cjs'),chunkW5SMGCKO_cjs=require('./chunks/chunk-W5SMGCKO.cjs'),chunkEH2QTB6S_cjs=require('./chunks/chunk-EH2QTB6S.cjs'),chunkVZCOLSBF_cjs=require('./chunks/chunk-VZCOLSBF.cjs'),chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),llm=require('@easbot/llm'),terminal=require('@easbot/terminal'),r=require('zod'),fs=require('fs'),plugin=require('@easbot/plugin'),W=require('fs/promises'),utils=require('@easbot/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var r__default=/*#__PURE__*/_interopDefault(r);var W__default=/*#__PURE__*/_interopDefault(W);var ne=utils.Log.create({service:"codebase.plugin.tool.knowledge-truncation"}),Ge=30,Ue=1500,I={codebase:1500},k={listPaths:["hits","callers","callees","references","directlyAffected","transitivelyAffected","files","entryPoints","entryPoints.*.symbols","edges","nodes"],fieldPaths:["hits.*.content","hits.*.snippet","hits.*.docstring","hits.*.sourceCode","references.*.snippet","directlyAffected.*.snippet","transitivelyAffected.*.snippet","files.*.summary","entryPoints.*.symbols.*.node.text","entryPoints.*.symbols.*.node.sourceCode"]};var ze=["hits","files","results","matches","nodes","edges"];function Ve(e,t){return !e||e.length===0?{items:[],truncated:false,dropped:0}:e.length<=t?{items:e.slice(),truncated:false,dropped:0}:{items:e.slice(0,t),truncated:true,dropped:e.length-t}}function Xe(e,t){if(e==null)return {value:"",truncated:false,droppedChars:0};if(typeof e!="string")return {value:String(e),truncated:false,droppedChars:0};if(e.length<=t)return {value:e,truncated:false,droppedChars:0};let o=e.length-t;return {value:`${e.slice(0,t)}\u2026(+${o} chars)`,truncated:true,droppedChars:o}}function Z(e,t){let o=0,i=false,n=(s,l)=>{if(s!=null){if(Array.isArray(s)){for(let c of t)D(c,l)&&(o+=s.length,i=true);for(let c=0;c<s.length;c++)n(s[c],[...l,String(c)]);return}if(typeof s=="object"){let a=s;for(let[c,E]of Object.entries(a))n(E,[...l,c]);}}};return n(e,[]),i?o:0}function D(e,t){let o=e.split(".");if(o.length!==t.length)return false;for(let i=0;i<o.length;i++){let n=o[i];if(n!=="*"&&n!==t[i])return false}return true}async function M(e,t){let o=t.listLimit??Ge,i=t.fieldMax??Ue,n=t.saveFull!==false,s=Math.max(Z(e,[...ze]),Z(e,t.paths.listPaths)),l;n&&(l=await Ye(e,t.toolName));let a=0,c=0,E=new WeakSet,f=(d,b)=>{if(d==null)return d;if(typeof d=="string"){for(let m of t.paths.fieldPaths??[])if(D(m,b)){let g=Xe(d,i);return g.truncated&&(c+=1),g.value}return d}if(Array.isArray(d)){let m=false;for(let g of t.paths.listPaths)if(D(g,b)){m=true;break}if(m){let g=Ve(d,o);return g.truncated&&(a+=g.dropped),g.items.map((S,O)=>f(S,[...b,String(O)]))}return d.map((g,S)=>f(g,[...b,String(S)]))}if(typeof d=="object"){if(E.has(d))return d;E.add(d);let m=d,g={};for(let[S,O]of Object.entries(m))g[S]=f(O,[...b,S]);return g}return d},y=f(e,[]),p=a>0||c>0;return p&&ne.debug("knowledge tool trimmed",{toolName:t.toolName,total:s,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}),{result:y,total:s,truncated:p,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}}async function Ye(e,t){try{let o=utils.Filesystem.join(chunkJ7Z3MIR7_cjs.h(),"tool-output");await W__default.default.mkdir(o,{recursive:!0}).catch(()=>{});let i=t.replace(/[^a-zA-Z0-9_-]/g,"_"),n=utils.Identifier.ascending("tool"),s=utils.Filesystem.join(o,`knowledge_${i}_${n}.json`);return await W__default.default.writeFile(s,JSON.stringify(e,null,2),"utf-8"),s}catch(o){ne.warn("knowledge truncation: persistFullResult failed",{toolName:t,error:utils.errorMeta(o)});return}}function w(e,t){if(!e.truncated
|
|
1
|
+
'use strict';var chunkP3IAXGOT_cjs=require('./chunks/chunk-P3IAXGOT.cjs'),chunkXGZDPIEP_cjs=require('./chunks/chunk-XGZDPIEP.cjs'),chunkY7JDLK56_cjs=require('./chunks/chunk-Y7JDLK56.cjs'),chunkJ7Z3MIR7_cjs=require('./chunks/chunk-J7Z3MIR7.cjs');require('./chunks/chunk-D5NDNAKA.cjs');var chunk3DAM6EZN_cjs=require('./chunks/chunk-3DAM6EZN.cjs'),chunkAARBEAIB_cjs=require('./chunks/chunk-AARBEAIB.cjs'),chunkW5SMGCKO_cjs=require('./chunks/chunk-W5SMGCKO.cjs'),chunkEH2QTB6S_cjs=require('./chunks/chunk-EH2QTB6S.cjs'),chunkVZCOLSBF_cjs=require('./chunks/chunk-VZCOLSBF.cjs'),chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),llm=require('@easbot/llm'),terminal=require('@easbot/terminal'),r=require('zod'),fs=require('fs'),plugin=require('@easbot/plugin'),W=require('fs/promises'),utils=require('@easbot/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var r__default=/*#__PURE__*/_interopDefault(r);var W__default=/*#__PURE__*/_interopDefault(W);var ne=utils.Log.create({service:"codebase.plugin.tool.knowledge-truncation"}),Ge=30,Ue=1500,I={codebase:1500},k={listPaths:["hits","callers","callees","references","directlyAffected","transitivelyAffected","files","entryPoints","entryPoints.*.symbols","edges","nodes"],fieldPaths:["hits.*.content","hits.*.snippet","hits.*.docstring","hits.*.sourceCode","references.*.snippet","directlyAffected.*.snippet","transitivelyAffected.*.snippet","files.*.summary","entryPoints.*.symbols.*.node.text","entryPoints.*.symbols.*.node.sourceCode"]};var ze=["hits","files","results","matches","nodes","edges"];function Ve(e,t){return !e||e.length===0?{items:[],truncated:false,dropped:0}:e.length<=t?{items:e.slice(),truncated:false,dropped:0}:{items:e.slice(0,t),truncated:true,dropped:e.length-t}}function Xe(e,t){if(e==null)return {value:"",truncated:false,droppedChars:0};if(typeof e!="string")return {value:String(e),truncated:false,droppedChars:0};if(e.length<=t)return {value:e,truncated:false,droppedChars:0};let o=e.length-t;return {value:`${e.slice(0,t)}\u2026(+${o} chars)`,truncated:true,droppedChars:o}}function Z(e,t){let o=0,i=false,n=(s,l)=>{if(s!=null){if(Array.isArray(s)){for(let c of t)D(c,l)&&(o+=s.length,i=true);for(let c=0;c<s.length;c++)n(s[c],[...l,String(c)]);return}if(typeof s=="object"){let a=s;for(let[c,E]of Object.entries(a))n(E,[...l,c]);}}};return n(e,[]),i?o:0}function D(e,t){let o=e.split(".");if(o.length!==t.length)return false;for(let i=0;i<o.length;i++){let n=o[i];if(n!=="*"&&n!==t[i])return false}return true}async function M(e,t){let o=t.listLimit??Ge,i=t.fieldMax??Ue,n=t.saveFull!==false,s=Math.max(Z(e,[...ze]),Z(e,t.paths.listPaths)),l;n&&(l=await Ye(e,t.toolName));let a=0,c=0,E=new WeakSet,f=(d,b)=>{if(d==null)return d;if(typeof d=="string"){for(let m of t.paths.fieldPaths??[])if(D(m,b)){let g=Xe(d,i);return g.truncated&&(c+=1),g.value}return d}if(Array.isArray(d)){let m=false;for(let g of t.paths.listPaths)if(D(g,b)){m=true;break}if(m){let g=Ve(d,o);return g.truncated&&(a+=g.dropped),g.items.map((S,O)=>f(S,[...b,String(O)]))}return d.map((g,S)=>f(g,[...b,String(S)]))}if(typeof d=="object"){if(E.has(d))return d;E.add(d);let m=d,g={};for(let[S,O]of Object.entries(m))g[S]=f(O,[...b,S]);return g}return d},y=f(e,[]),p=a>0||c>0;return p&&ne.debug("knowledge tool trimmed",{toolName:t.toolName,total:s,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}),{result:y,total:s,truncated:p,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}}async function Ye(e,t){try{let o=utils.Filesystem.join(chunkJ7Z3MIR7_cjs.h(),"tool-output");await W__default.default.mkdir(o,{recursive:!0}).catch(()=>{});let i=t.replace(/[^a-zA-Z0-9_-]/g,"_"),n=utils.Identifier.ascending("tool"),s=utils.Filesystem.join(o,`knowledge_${i}_${n}.json`);return await W__default.default.writeFile(s,JSON.stringify(e,null,2),"utf-8"),s}catch(o){ne.warn("knowledge truncation: persistFullResult failed",{toolName:t,error:utils.errorMeta(o)});return}}function w(e,t){if(!e.truncated)return "";let o=[];return o.push("---"),o.push(`[${t} output truncated for context window]`),o.push(`- Total items: ${e.total}`),o.push(`- Items shown: ${e.total-e.trimmedListCount}`),o.push(`- Fields trimmed: ${e.trimmedFieldCount}`),e.outputPath&&(o.push(`- Full data saved to: ${e.outputPath}`),o.push("- To recover: use Grep to search this file, or Read with offset/limit."),o.push(`- To narrow: call ${t} again with a more specific query.`)),o.join(`
|
|
2
2
|
`)}var Je=["callers","callees","references","directlyAffected","transitivelyAffected","edges"];function ee(e){switch(e){case "CALLS":return 0;case "IMPORTS":return 1;case "TYPE_REFERENCES":return 2;case "EXTENDS":case "IMPLEMENTS":return 3;default:return 4}}function We(e,t,o){return e.filePath==="(unresolved)"?o==="callers"||o==="callees":!(t.rootFilePath&&e.filePath&&e.filePath!==t.rootFilePath&&!Qe(t.rootFilePath,e.filePath))}function te(e){let t=e.replace(/\\/g,"/"),o=[...t.matchAll(/(?:^|\/)(packages|apps|examples|src|tests|bin|scripts)\//g)];if(o.length>0){let i=o[o.length-1];if(i&&i.index!==void 0)return t.slice(i.index+(i[0].startsWith("/")?1:0))}return t}function Qe(e,t){let o=te(e),i=te(t),n=o.split("/")[0]??"",s=i.split("/")[0]??"";return !n||!s?true:n===s}function T(e,t={}){let o=t.maxEdgesPerList??15;if(e==null||typeof e!="object"||Array.isArray(e))return e;let i={...e};for(let s of Je){let l=i[s];if(!Array.isArray(l))continue;let a=l.filter(p=>p===null||typeof p!="object"?false:We(p,t,s)),c=new Set,f=a.filter(p=>{let d=p,b=`${d.filePath??""}:${d.startLine??0}:${d.name??""}`;return c.has(b)?false:(c.add(b),true)}).map((p,d)=>({edge:p,idx:d})).sort((p,d)=>{let b=ee(p.edge.relation),m=ee(d.edge.relation);return b!==m?b-m:p.idx-d.idx}).map(({edge:p})=>p),y=f.length>o?f.slice(0,o):f;i[s]=y;}let n=["hits","facts","chunks","nodes","files","results","matches","entryPoints"];for(let s of n){let l=i[s];Array.isArray(l)&&(i[s]=l.map(a=>a===null||typeof a!="object"?a:T(a,t)));}return Array.isArray(i.entryPoints)&&(i.entryPoints=i.entryPoints.map(s=>{if(s===null||typeof s!="object")return s;let l=s;return Array.isArray(l.symbols)?(l.symbols=l.symbols.map(a=>a===null||typeof a!="object"?a:T(a,t)),l):s})),i}var F=utils.Log.create({service:"codebase.plugin.tool"});var dt=utils.loadTextFile("./codebase.txt",chunkR32346OA_cjs.d),lt=dt(),x=r__default.default.enum(["function","method","class","interface","type","variable","route","component","const"]),ct=r__default.default.enum(["incoming","outgoing","both"]),N=utils.Schema.stringArray,ut=r__default.default.discriminatedUnion("operation",[r__default.default.object({operation:r__default.default.literal("search"),query:r__default.default.string().describe("Search query (symbol name / natural language / snippet)"),kind:x.optional().describe("Filter by node kind"),file:r__default.default.string().optional().describe("Filter by source file (substring match)"),language:r__default.default.string().optional().describe("Filter by programming language"),astType:r__default.default.string().optional().describe("Filter by AST type (finer than kind)"),intent:r__default.default.string().optional().describe("LLM task context (for ranking)"),maxResults:utils.Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per search hit (default 10; range [1, 100])"),includeContent:r__default.default.boolean().optional().default(false).describe("Include source content (default false)"),enableFts:r__default.default.boolean().optional().default(true).describe("Enable FTS search (default true)")}),r__default.default.object({operation:r__default.default.literal("node"),name:r__default.default.string().optional().describe("Node name (recommended; LLM workflow friendly)"),nodeId:r__default.default.string().optional().describe("Node ID (zero ambiguity)"),file:r__default.default.string().optional().describe("File path (disambiguation)"),kind:x.optional().describe("Kind (disambiguation)"),includeEdges:r__default.default.boolean().optional().default(false).describe("Include edges (default false)"),includeContent:r__default.default.boolean().optional().default(false).describe("Include source content (default false)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges to return (default 10; range [1, 100])")}),r__default.default.object({operation:r__default.default.literal("context"),name:r__default.default.string().optional().describe("Center node name"),nodeId:r__default.default.string().optional().describe("Center node ID (zero ambiguity)"),file:r__default.default.string().optional().describe("File path (disambiguation)"),kind:x.optional().describe("Kind (disambiguation)"),depth:utils.Schema.positiveInt.optional().default(2).describe("BFS depth (default 2, max 3)"),maxNodes:utils.Schema.positiveInt.optional().default(100).describe("Max nodes (default 100)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per direction per BFS level (default 10; range [1, 100])"),direction:ct.optional().default("both").describe("Edge direction (default both)"),relationTypes:N.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.')}),r__default.default.object({operation:r__default.default.literal("impact"),name:r__default.default.string().optional().describe("Center node name"),nodeId:r__default.default.string().optional().describe("Center node ID"),file:r__default.default.string().optional().describe("File path (disambiguation)"),kind:x.optional().describe("Kind (disambiguation)"),depth:utils.Schema.positiveInt.optional().default(2).describe("BFS depth (default 2, max 3)"),relationTypes:N.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:utils.Schema.positiveInt.optional().default(10).describe("Max affected nodes (default 10)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max incoming edges per BFS level (default 10; range [1, 100])")}),r__default.default.object({operation:r__default.default.literal("callers"),name:r__default.default.string().optional().describe("Target node name"),nodeId:r__default.default.string().optional().describe("Target node ID"),file:r__default.default.string().optional().describe("File path (disambiguation)"),kind:x.optional().describe("Kind (disambiguation)"),relationTypes:N.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:utils.Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max incoming edges (default 10; range [1, 100])")}),r__default.default.object({operation:r__default.default.literal("callees"),name:r__default.default.string().optional().describe("Target node name"),nodeId:r__default.default.string().optional().describe("Target node ID"),file:r__default.default.string().optional().describe("File path (disambiguation)"),kind:x.optional().describe("Kind (disambiguation)"),relationTypes:N.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:utils.Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max outgoing edges (default 10; range [1, 100])")}),r__default.default.object({operation:r__default.default.literal("explore"),query:r__default.default.string().describe("Entry query (symbol name or natural language, required)"),file:r__default.default.string().optional().describe("File path filter"),kind:x.optional().describe("Kind filter"),maxFiles:utils.Schema.positiveInt.optional().default(5).describe("Entry point count (default 5)"),maxSymbols:utils.Schema.positiveInt.optional().default(3).describe("Symbols per entry point (default 3)"),maxEdgesPerNode:utils.Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max caller/callee edges per symbol (default 10; range [1, 100])"),depth:utils.Schema.positiveInt.optional().default(1).describe("Neighbor depth (default 1)"),includeContent:r__default.default.boolean().optional().default(true).describe("Include source content (default true)"),intent:r__default.default.string().optional().describe("LLM task context")}),r__default.default.object({operation:r__default.default.literal("status")})]);function ft(e){return e.worktree??e.directory??utils.Instance.worktree??process.cwd()}async function pt(e){let t;try{t=chunk3DAM6EZN_cjs.c(e);}catch{return}if(!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`Codebase knowledge graph is not initialized at ${e} (db not found at ${t}).
|
|
3
3
|
Run \`easbot codebase index <workspaceDir>\` (one-time bootstrap) and retry. See eas-knowledge-using skill for details.`,operation:"codebase-init-required"})}function gt(e){return {workspaceDir:e,rootDir:e}}function bt(e){return e.map(t=>({nodeId:t.nodeId,name:t.name,kind:t.kind,filePath:t.filePath,startLine:t.startLine,endLine:t.endLine,edges:t.edges,source:t.source,score:t.score,snippet:t.snippet}))}var A=plugin.createTool({description:lt,args:ut,isEnabled:()=>chunkY7JDLK56_cjs.b.exists(),async execute(e,t){await t.ask({permission:"codebase",patterns:e.operation==="search"||e.operation==="explore"?[e.query]:e.operation==="node"||e.operation==="context"||e.operation==="impact"||e.operation==="callers"||e.operation==="callees"?[e.name??e.nodeId??"*"]:["*"],always:["*"],metadata:{operation:e.operation,...(e.operation==="search"||e.operation==="explore")&&{query:e.query},...(e.operation==="node"||e.operation==="context"||e.operation==="impact"||e.operation==="callers"||e.operation==="callees")&&{name:e.name,nodeId:e.nodeId}}});let o=ft(t);await pt(o),F.debug("codebase tool execute",{operation:e.operation,workspaceDir:o,...(e.operation==="search"||e.operation==="explore")&&{query:e.query}});try{let i=gt(o),n=await mt(e,i),s=await M(n,{toolName:`codebase_${e.operation}`,paths:k}),l=s.result.root,a=l?.file_path??l?.filePath??"",c=T(s.result,{rootFilePath:a||void 0}),E=await Et(e,c,i),f=await llm.Truncate.output(E,{contentType:"output",toolName:`codebase_${e.operation}`},{name:t.agent}),y=w(s,`codebase_${e.operation}`);return {output:f.truncated?`${f.content}
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export{d as handleCodebaseCli,a as renderBanner,b as renderHelp}from'./chunks/chunk-KUX25CUR.mjs';import {h as h$1,g,f,e,d,c,b as b$1,a,C as C$1,B,F as F$1,E,y}from'./chunks/chunk-OXF2UU4K.mjs';export{p as SECTION_END,o as SECTION_MARKER,f as callees,e as callers,c as context,u as defaultRiskLabel,i as doctor,n as emptyFormattedNode,g as explore,l as formatCodebaseEdge,k as formatCodebaseNode,m as formatCodebaseSearchHits,d as impact,j as initCodebase,b as node,C as renderCalleesFromResult,B as renderCallersFromResult,v as renderContext,A as renderContextFromQuery,F as renderExploreFromResult,t as renderImpact,z as renderImpactFromTuples,x as renderNeighborList,w as renderNode,E as renderNodeDetail,y as renderSearch,s as renderSearchResult,D as renderStatusFromResult,a as search,h as status,q as truncateAtSectionBoundary,r as truncateAtSectionBoundarySync}from'./chunks/chunk-OXF2UU4K.mjs';import {b}from'./chunks/chunk-ETCTXAXR.mjs';export{a as CODEBASE_JSON_REL_PATH,b as CodebaseCache}from'./chunks/chunk-ETCTXAXR.mjs';import {h as h$2}from'./chunks/chunk-H4VZF3ZQ.mjs';export{c as getGlobal,g as getHomeDir,f as getInstance,l as getProjectDirectory,k as getXdgCache,i as getXdgConfig,h as getXdgData,j as getXdgState,b as resetGlobalAdapter,e as resetInstanceAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-H4VZF3ZQ.mjs';import'./chunks/chunk-ECMVXJH2.mjs';import {c as c$1}from'./chunks/chunk-QZMJ5EUF.mjs';export{r as CodeBase,l as EdgeExtractor,f as FILE_EXTENSION_MAP,n as Indexer,j as NodeExtractor,g as ParserManager,p as QueryInterface,b as codebaseConfigPath,c as codebaseDbPath,s as createCodebase,m as createEdgeExtractor,o as createIndexer,k as createNodeExtractor,q as createQueryInterface,a as easbotDir,h as getParserManager,i as resetParserManager}from'./chunks/chunk-QZMJ5EUF.mjs';export{f as DatabaseManager}from'./chunks/chunk-EU2I2AMK.mjs';export{c as CODEBASE_BUSINESS_CODES,d as CODEBASE_BUSINESS_HINTS,b as CodebaseError,e as registerBusinessErrors}from'./chunks/chunk-KTSR5VPT.mjs';export{a as Llm,b as llm}from'./chunks/chunk-ESA2CL57.mjs';export{e as CodebaseJsonSchema,g as DEFAULT_CODEBASE_JSON,a as DEFAULT_EMBEDDING_CONFIG,b as DEFAULT_INDEXER_CONFIG,c as DEFAULT_PARSER_CONFIG,d as DEFAULT_TOKENIZER_CONFIG}from'./chunks/chunk-43WAI4Z7.mjs';import'./chunks/chunk-47LKNS74.mjs';import {Truncate}from'@easbot/llm';export{Truncate}from'@easbot/llm';import {renderKnowledgeStatus}from'@easbot/terminal';export{renderKnowledgeStatus}from'@easbot/terminal';import r from'zod';import {existsSync}from'fs';import {createTool}from'@easbot/plugin';import Q from'fs/promises';import {Log,loadTextFile,Schema,ServiceError,ServiceErrorBus,errorMeta,Instance,NameErrors,Filesystem,Identifier}from'@easbot/utils';var oe=Log.create({service:"codebase.plugin.tool.knowledge-truncation"}),Ue=30,ze=1500,N={codebase:1500},k={listPaths:["hits","callers","callees","references","directlyAffected","transitivelyAffected","files","entryPoints","entryPoints.*.symbols","edges","nodes"],fieldPaths:["hits.*.content","hits.*.snippet","hits.*.docstring","hits.*.sourceCode","references.*.snippet","directlyAffected.*.snippet","transitivelyAffected.*.snippet","files.*.summary","entryPoints.*.symbols.*.node.text","entryPoints.*.symbols.*.node.sourceCode"]};var Ve=["hits","files","results","matches","nodes","edges"];function Xe(e,t){return !e||e.length===0?{items:[],truncated:false,dropped:0}:e.length<=t?{items:e.slice(),truncated:false,dropped:0}:{items:e.slice(0,t),truncated:true,dropped:e.length-t}}function Ye(e,t){if(e==null)return {value:"",truncated:false,droppedChars:0};if(typeof e!="string")return {value:String(e),truncated:false,droppedChars:0};if(e.length<=t)return {value:e,truncated:false,droppedChars:0};let o=e.length-t;return {value:`${e.slice(0,t)}\u2026(+${o} chars)`,truncated:true,droppedChars:o}}function ee(e,t){let o=0,i=false,n=(s,l)=>{if(s!=null){if(Array.isArray(s)){for(let c of t)M(c,l)&&(o+=s.length,i=true);for(let c=0;c<s.length;c++)n(s[c],[...l,String(c)]);return}if(typeof s=="object"){let a=s;for(let[c,E]of Object.entries(a))n(E,[...l,c]);}}};return n(e,[]),i?o:0}function M(e,t){let o=e.split(".");if(o.length!==t.length)return false;for(let i=0;i<o.length;i++){let n=o[i];if(n!=="*"&&n!==t[i])return false}return true}async function w(e,t){let o=t.listLimit??Ue,i=t.fieldMax??ze,n=t.saveFull!==false,s=Math.max(ee(e,[...Ve]),ee(e,t.paths.listPaths)),l;n&&(l=await Je(e,t.toolName));let a=0,c=0,E=new WeakSet,f=(d,b)=>{if(d==null)return d;if(typeof d=="string"){for(let m of t.paths.fieldPaths??[])if(M(m,b)){let g=Ye(d,i);return g.truncated&&(c+=1),g.value}return d}if(Array.isArray(d)){let m=false;for(let g of t.paths.listPaths)if(M(g,b)){m=true;break}if(m){let g=Xe(d,o);return g.truncated&&(a+=g.dropped),g.items.map((y,R)=>f(y,[...b,String(R)]))}return d.map((g,y)=>f(g,[...b,String(y)]))}if(typeof d=="object"){if(E.has(d))return d;E.add(d);let m=d,g={};for(let[y,R]of Object.entries(m))g[y]=f(R,[...b,y]);return g}return d},x=f(e,[]),p=a>0||c>0;return p&&oe.debug("knowledge tool trimmed",{toolName:t.toolName,total:s,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}),{result:x,total:s,truncated:p,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}}async function Je(e,t){try{let o=Filesystem.join(h$2(),"tool-output");await Q.mkdir(o,{recursive:!0}).catch(()=>{});let i=t.replace(/[^a-zA-Z0-9_-]/g,"_"),n=Identifier.ascending("tool"),s=Filesystem.join(o,`knowledge_${i}_${n}.json`);return await Q.writeFile(s,JSON.stringify(e,null,2),"utf-8"),s}catch(o){oe.warn("knowledge truncation: persistFullResult failed",{toolName:t,error:errorMeta(o)});return}}function F(e,t){if(!e.truncated
|
|
1
|
+
export{d as handleCodebaseCli,a as renderBanner,b as renderHelp}from'./chunks/chunk-KUX25CUR.mjs';import {h as h$1,g,f,e,d,c,b as b$1,a,C as C$1,B,F as F$1,E,y}from'./chunks/chunk-OXF2UU4K.mjs';export{p as SECTION_END,o as SECTION_MARKER,f as callees,e as callers,c as context,u as defaultRiskLabel,i as doctor,n as emptyFormattedNode,g as explore,l as formatCodebaseEdge,k as formatCodebaseNode,m as formatCodebaseSearchHits,d as impact,j as initCodebase,b as node,C as renderCalleesFromResult,B as renderCallersFromResult,v as renderContext,A as renderContextFromQuery,F as renderExploreFromResult,t as renderImpact,z as renderImpactFromTuples,x as renderNeighborList,w as renderNode,E as renderNodeDetail,y as renderSearch,s as renderSearchResult,D as renderStatusFromResult,a as search,h as status,q as truncateAtSectionBoundary,r as truncateAtSectionBoundarySync}from'./chunks/chunk-OXF2UU4K.mjs';import {b}from'./chunks/chunk-ETCTXAXR.mjs';export{a as CODEBASE_JSON_REL_PATH,b as CodebaseCache}from'./chunks/chunk-ETCTXAXR.mjs';import {h as h$2}from'./chunks/chunk-H4VZF3ZQ.mjs';export{c as getGlobal,g as getHomeDir,f as getInstance,l as getProjectDirectory,k as getXdgCache,i as getXdgConfig,h as getXdgData,j as getXdgState,b as resetGlobalAdapter,e as resetInstanceAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-H4VZF3ZQ.mjs';import'./chunks/chunk-ECMVXJH2.mjs';import {c as c$1}from'./chunks/chunk-QZMJ5EUF.mjs';export{r as CodeBase,l as EdgeExtractor,f as FILE_EXTENSION_MAP,n as Indexer,j as NodeExtractor,g as ParserManager,p as QueryInterface,b as codebaseConfigPath,c as codebaseDbPath,s as createCodebase,m as createEdgeExtractor,o as createIndexer,k as createNodeExtractor,q as createQueryInterface,a as easbotDir,h as getParserManager,i as resetParserManager}from'./chunks/chunk-QZMJ5EUF.mjs';export{f as DatabaseManager}from'./chunks/chunk-EU2I2AMK.mjs';export{c as CODEBASE_BUSINESS_CODES,d as CODEBASE_BUSINESS_HINTS,b as CodebaseError,e as registerBusinessErrors}from'./chunks/chunk-KTSR5VPT.mjs';export{a as Llm,b as llm}from'./chunks/chunk-ESA2CL57.mjs';export{e as CodebaseJsonSchema,g as DEFAULT_CODEBASE_JSON,a as DEFAULT_EMBEDDING_CONFIG,b as DEFAULT_INDEXER_CONFIG,c as DEFAULT_PARSER_CONFIG,d as DEFAULT_TOKENIZER_CONFIG}from'./chunks/chunk-43WAI4Z7.mjs';import'./chunks/chunk-47LKNS74.mjs';import {Truncate}from'@easbot/llm';export{Truncate}from'@easbot/llm';import {renderKnowledgeStatus}from'@easbot/terminal';export{renderKnowledgeStatus}from'@easbot/terminal';import r from'zod';import {existsSync}from'fs';import {createTool}from'@easbot/plugin';import Q from'fs/promises';import {Log,loadTextFile,Schema,ServiceError,ServiceErrorBus,errorMeta,Instance,NameErrors,Filesystem,Identifier}from'@easbot/utils';var oe=Log.create({service:"codebase.plugin.tool.knowledge-truncation"}),Ue=30,ze=1500,N={codebase:1500},k={listPaths:["hits","callers","callees","references","directlyAffected","transitivelyAffected","files","entryPoints","entryPoints.*.symbols","edges","nodes"],fieldPaths:["hits.*.content","hits.*.snippet","hits.*.docstring","hits.*.sourceCode","references.*.snippet","directlyAffected.*.snippet","transitivelyAffected.*.snippet","files.*.summary","entryPoints.*.symbols.*.node.text","entryPoints.*.symbols.*.node.sourceCode"]};var Ve=["hits","files","results","matches","nodes","edges"];function Xe(e,t){return !e||e.length===0?{items:[],truncated:false,dropped:0}:e.length<=t?{items:e.slice(),truncated:false,dropped:0}:{items:e.slice(0,t),truncated:true,dropped:e.length-t}}function Ye(e,t){if(e==null)return {value:"",truncated:false,droppedChars:0};if(typeof e!="string")return {value:String(e),truncated:false,droppedChars:0};if(e.length<=t)return {value:e,truncated:false,droppedChars:0};let o=e.length-t;return {value:`${e.slice(0,t)}\u2026(+${o} chars)`,truncated:true,droppedChars:o}}function ee(e,t){let o=0,i=false,n=(s,l)=>{if(s!=null){if(Array.isArray(s)){for(let c of t)M(c,l)&&(o+=s.length,i=true);for(let c=0;c<s.length;c++)n(s[c],[...l,String(c)]);return}if(typeof s=="object"){let a=s;for(let[c,E]of Object.entries(a))n(E,[...l,c]);}}};return n(e,[]),i?o:0}function M(e,t){let o=e.split(".");if(o.length!==t.length)return false;for(let i=0;i<o.length;i++){let n=o[i];if(n!=="*"&&n!==t[i])return false}return true}async function w(e,t){let o=t.listLimit??Ue,i=t.fieldMax??ze,n=t.saveFull!==false,s=Math.max(ee(e,[...Ve]),ee(e,t.paths.listPaths)),l;n&&(l=await Je(e,t.toolName));let a=0,c=0,E=new WeakSet,f=(d,b)=>{if(d==null)return d;if(typeof d=="string"){for(let m of t.paths.fieldPaths??[])if(M(m,b)){let g=Ye(d,i);return g.truncated&&(c+=1),g.value}return d}if(Array.isArray(d)){let m=false;for(let g of t.paths.listPaths)if(M(g,b)){m=true;break}if(m){let g=Xe(d,o);return g.truncated&&(a+=g.dropped),g.items.map((y,R)=>f(y,[...b,String(R)]))}return d.map((g,y)=>f(g,[...b,String(y)]))}if(typeof d=="object"){if(E.has(d))return d;E.add(d);let m=d,g={};for(let[y,R]of Object.entries(m))g[y]=f(R,[...b,y]);return g}return d},x=f(e,[]),p=a>0||c>0;return p&&oe.debug("knowledge tool trimmed",{toolName:t.toolName,total:s,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}),{result:x,total:s,truncated:p,trimmedListCount:a,trimmedFieldCount:c,outputPath:l}}async function Je(e,t){try{let o=Filesystem.join(h$2(),"tool-output");await Q.mkdir(o,{recursive:!0}).catch(()=>{});let i=t.replace(/[^a-zA-Z0-9_-]/g,"_"),n=Identifier.ascending("tool"),s=Filesystem.join(o,`knowledge_${i}_${n}.json`);return await Q.writeFile(s,JSON.stringify(e,null,2),"utf-8"),s}catch(o){oe.warn("knowledge truncation: persistFullResult failed",{toolName:t,error:errorMeta(o)});return}}function F(e,t){if(!e.truncated)return "";let o=[];return o.push("---"),o.push(`[${t} output truncated for context window]`),o.push(`- Total items: ${e.total}`),o.push(`- Items shown: ${e.total-e.trimmedListCount}`),o.push(`- Fields trimmed: ${e.trimmedFieldCount}`),e.outputPath&&(o.push(`- Full data saved to: ${e.outputPath}`),o.push("- To recover: use Grep to search this file, or Read with offset/limit."),o.push(`- To narrow: call ${t} again with a more specific query.`)),o.join(`
|
|
2
2
|
`)}var We=["callers","callees","references","directlyAffected","transitivelyAffected","edges"];function te(e){switch(e){case "CALLS":return 0;case "IMPORTS":return 1;case "TYPE_REFERENCES":return 2;case "EXTENDS":case "IMPLEMENTS":return 3;default:return 4}}function Qe(e,t,o){return e.filePath==="(unresolved)"?o==="callers"||o==="callees":!(t.rootFilePath&&e.filePath&&e.filePath!==t.rootFilePath&&!Ze(t.rootFilePath,e.filePath))}function ne(e){let t=e.replace(/\\/g,"/"),o=[...t.matchAll(/(?:^|\/)(packages|apps|examples|src|tests|bin|scripts)\//g)];if(o.length>0){let i=o[o.length-1];if(i&&i.index!==void 0)return t.slice(i.index+(i[0].startsWith("/")?1:0))}return t}function Ze(e,t){let o=ne(e),i=ne(t),n=o.split("/")[0]??"",s=i.split("/")[0]??"";return !n||!s?true:n===s}function S(e,t={}){let o=t.maxEdgesPerList??15;if(e==null||typeof e!="object"||Array.isArray(e))return e;let i={...e};for(let s of We){let l=i[s];if(!Array.isArray(l))continue;let a=l.filter(p=>p===null||typeof p!="object"?false:Qe(p,t,s)),c=new Set,f=a.filter(p=>{let d=p,b=`${d.filePath??""}:${d.startLine??0}:${d.name??""}`;return c.has(b)?false:(c.add(b),true)}).map((p,d)=>({edge:p,idx:d})).sort((p,d)=>{let b=te(p.edge.relation),m=te(d.edge.relation);return b!==m?b-m:p.idx-d.idx}).map(({edge:p})=>p),x=f.length>o?f.slice(0,o):f;i[s]=x;}let n=["hits","facts","chunks","nodes","files","results","matches","entryPoints"];for(let s of n){let l=i[s];Array.isArray(l)&&(i[s]=l.map(a=>a===null||typeof a!="object"?a:S(a,t)));}return Array.isArray(i.entryPoints)&&(i.entryPoints=i.entryPoints.map(s=>{if(s===null||typeof s!="object")return s;let l=s;return Array.isArray(l.symbols)?(l.symbols=l.symbols.map(a=>a===null||typeof a!="object"?a:S(a,t)),l):s})),i}var v=Log.create({service:"codebase.plugin.tool"});var lt=loadTextFile("./codebase.txt",import.meta.url),ct=lt(),h=r.enum(["function","method","class","interface","type","variable","route","component","const"]),ut=r.enum(["incoming","outgoing","both"]),A=Schema.stringArray,ft=r.discriminatedUnion("operation",[r.object({operation:r.literal("search"),query:r.string().describe("Search query (symbol name / natural language / snippet)"),kind:h.optional().describe("Filter by node kind"),file:r.string().optional().describe("Filter by source file (substring match)"),language:r.string().optional().describe("Filter by programming language"),astType:r.string().optional().describe("Filter by AST type (finer than kind)"),intent:r.string().optional().describe("LLM task context (for ranking)"),maxResults:Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per search hit (default 10; range [1, 100])"),includeContent:r.boolean().optional().default(false).describe("Include source content (default false)"),enableFts:r.boolean().optional().default(true).describe("Enable FTS search (default true)")}),r.object({operation:r.literal("node"),name:r.string().optional().describe("Node name (recommended; LLM workflow friendly)"),nodeId:r.string().optional().describe("Node ID (zero ambiguity)"),file:r.string().optional().describe("File path (disambiguation)"),kind:h.optional().describe("Kind (disambiguation)"),includeEdges:r.boolean().optional().default(false).describe("Include edges (default false)"),includeContent:r.boolean().optional().default(false).describe("Include source content (default false)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges to return (default 10; range [1, 100])")}),r.object({operation:r.literal("context"),name:r.string().optional().describe("Center node name"),nodeId:r.string().optional().describe("Center node ID (zero ambiguity)"),file:r.string().optional().describe("File path (disambiguation)"),kind:h.optional().describe("Kind (disambiguation)"),depth:Schema.positiveInt.optional().default(2).describe("BFS depth (default 2, max 3)"),maxNodes:Schema.positiveInt.optional().default(100).describe("Max nodes (default 100)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per direction per BFS level (default 10; range [1, 100])"),direction:ut.optional().default("both").describe("Edge direction (default both)"),relationTypes:A.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.')}),r.object({operation:r.literal("impact"),name:r.string().optional().describe("Center node name"),nodeId:r.string().optional().describe("Center node ID"),file:r.string().optional().describe("File path (disambiguation)"),kind:h.optional().describe("Kind (disambiguation)"),depth:Schema.positiveInt.optional().default(2).describe("BFS depth (default 2, max 3)"),relationTypes:A.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:Schema.positiveInt.optional().default(10).describe("Max affected nodes (default 10)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max incoming edges per BFS level (default 10; range [1, 100])")}),r.object({operation:r.literal("callers"),name:r.string().optional().describe("Target node name"),nodeId:r.string().optional().describe("Target node ID"),file:r.string().optional().describe("File path (disambiguation)"),kind:h.optional().describe("Kind (disambiguation)"),relationTypes:A.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max incoming edges (default 10; range [1, 100])")}),r.object({operation:r.literal("callees"),name:r.string().optional().describe("Target node name"),nodeId:r.string().optional().describe("Target node ID"),file:r.string().optional().describe("File path (disambiguation)"),kind:h.optional().describe("Kind (disambiguation)"),relationTypes:A.optional().describe('Relation type filter (exact match against @easbot/codebase RelationType enum), e.g. `["CALLS","IMPORTS"]`. Valid values: CALLS / IMPORTS / TYPE_REFERENCES / ANNOTATES / EXTENDS / IMPLEMENTS / HAS_METHOD / HAS_PROPERTY / METHOD_OVERRIDES / CONTAINS.'),maxResults:Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max outgoing edges (default 10; range [1, 100])")}),r.object({operation:r.literal("explore"),query:r.string().describe("Entry query (symbol name or natural language, required)"),file:r.string().optional().describe("File path filter"),kind:h.optional().describe("Kind filter"),maxFiles:Schema.positiveInt.optional().default(5).describe("Entry point count (default 5)"),maxSymbols:Schema.positiveInt.optional().default(3).describe("Symbols per entry point (default 3)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max caller/callee edges per symbol (default 10; range [1, 100])"),depth:Schema.positiveInt.optional().default(1).describe("Neighbor depth (default 1)"),includeContent:r.boolean().optional().default(true).describe("Include source content (default true)"),intent:r.string().optional().describe("LLM task context")}),r.object({operation:r.literal("status")})]);function pt(e){return e.worktree??e.directory??Instance.worktree??process.cwd()}async function gt(e){let t;try{t=c$1(e);}catch{return}if(!existsSync(t))throw new NameErrors.OperationFailedError({message:`Codebase knowledge graph is not initialized at ${e} (db not found at ${t}).
|
|
3
3
|
Run \`easbot codebase index <workspaceDir>\` (one-time bootstrap) and retry. See eas-knowledge-using skill for details.`,operation:"codebase-init-required"})}function bt(e){return {workspaceDir:e,rootDir:e}}function mt(e){return e.map(t=>({nodeId:t.nodeId,name:t.name,kind:t.kind,filePath:t.filePath,startLine:t.startLine,endLine:t.endLine,edges:t.edges,source:t.source,score:t.score,snippet:t.snippet}))}var O=createTool({description:ct,args:ft,isEnabled:()=>b.exists(),async execute(e,t){await t.ask({permission:"codebase",patterns:e.operation==="search"||e.operation==="explore"?[e.query]:e.operation==="node"||e.operation==="context"||e.operation==="impact"||e.operation==="callers"||e.operation==="callees"?[e.name??e.nodeId??"*"]:["*"],always:["*"],metadata:{operation:e.operation,...(e.operation==="search"||e.operation==="explore")&&{query:e.query},...(e.operation==="node"||e.operation==="context"||e.operation==="impact"||e.operation==="callers"||e.operation==="callees")&&{name:e.name,nodeId:e.nodeId}}});let o=pt(t);await gt(o),v.debug("codebase tool execute",{operation:e.operation,workspaceDir:o,...(e.operation==="search"||e.operation==="explore")&&{query:e.query}});try{let i=bt(o),n=await Et(e,i),s=await w(n,{toolName:`codebase_${e.operation}`,paths:k}),l=s.result.root,a=l?.file_path??l?.filePath??"",c=S(s.result,{rootFilePath:a||void 0}),E=await ht(e,c,i),f=await Truncate.output(E,{contentType:"output",toolName:`codebase_${e.operation}`},{name:t.agent}),x=F(s,`codebase_${e.operation}`);return {output:f.truncated?`${f.content}
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/codebase",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.40",
|
|
4
4
|
"description": "Code Knowledge Graph SDK for EASBot - Property Graph model for code indexing and querying with Tree-sitter parsing, FTS hybrid search, and incremental updates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"tree-sitter-typescript": "^0.23.2",
|
|
73
73
|
"web-tree-sitter": "^0.26.12",
|
|
74
74
|
"zod": "^4.6.7",
|
|
75
|
-
"@easbot/database": "0.3.
|
|
76
|
-
"@easbot/
|
|
77
|
-
"@easbot/local-model-sdk": "0.3.
|
|
78
|
-
"@easbot/
|
|
79
|
-
"@easbot/plugin": "0.3.
|
|
80
|
-
"@easbot/terminal": "0.3.
|
|
81
|
-
"@easbot/types": "0.3.
|
|
82
|
-
"@easbot/utils": "0.3.
|
|
75
|
+
"@easbot/database": "0.3.40",
|
|
76
|
+
"@easbot/mcp": "0.3.40",
|
|
77
|
+
"@easbot/local-model-sdk": "0.3.40",
|
|
78
|
+
"@easbot/llm": "0.3.40",
|
|
79
|
+
"@easbot/plugin": "0.3.40",
|
|
80
|
+
"@easbot/terminal": "0.3.40",
|
|
81
|
+
"@easbot/types": "0.3.40",
|
|
82
|
+
"@easbot/utils": "0.3.40"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/node": "^25.9.5",
|