@vohongtho.infotech/code-intel 0.3.1 → 0.5.0

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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as web_tree_sitter from 'web-tree-sitter';
2
2
  import { Language as Language$1, Parser, Node, Tree } from 'web-tree-sitter';
3
3
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
+ import { Server as Server$1 } from 'node:http';
4
5
  import express from 'express';
5
6
 
6
7
  declare enum Language {
@@ -186,6 +187,20 @@ declare function computeMRO(classId: string, parentMap: Map<string, string[]>, s
186
187
 
187
188
  declare function detectOverrides(graph: KnowledgeGraph): CodeEdge[];
188
189
 
190
+ interface LLMConfig {
191
+ /** Which provider to use. Default: 'ollama'. */
192
+ provider?: 'openai' | 'anthropic' | 'ollama';
193
+ /** Model name / ID passed to the provider. Each provider has its own default. */
194
+ model?: string;
195
+ /** Max concurrent LLM calls per batch. Default: 20. */
196
+ batchSize?: number;
197
+ /**
198
+ * Cost guard: stop after summarising this many nodes per run.
199
+ * Undefined = no limit.
200
+ */
201
+ maxNodesPerRun?: number;
202
+ }
203
+
189
204
  type PipelinePhaseStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
190
205
  interface PhaseResult {
191
206
  status: PipelinePhaseStatus;
@@ -210,6 +225,13 @@ interface PipelineContext {
210
225
  verbose?: boolean;
211
226
  /** Set by parse-phase after execution: which parser was used */
212
227
  parserUsed?: 'tree-sitter' | 'regex';
228
+ /**
229
+ * v0.4.0 — opt-in summarize phase.
230
+ * Set to true via `--summarize` flag or `analysis.summarizeOnAnalyze: true` config.
231
+ */
232
+ summarize?: boolean;
233
+ /** LLM provider config used by the summarize phase. */
234
+ llmConfig?: LLMConfig;
213
235
  }
214
236
  interface Phase {
215
237
  name: string;
@@ -290,6 +312,54 @@ interface SearchResult {
290
312
  declare function textSearch(graph: KnowledgeGraph, query: string, limit?: number): SearchResult[];
291
313
  declare function reciprocalRankFusion(...rankings: SearchResult[][]): SearchResult[];
292
314
 
315
+ declare function createMcpServer(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string): Server;
316
+ declare function startMcpStdio(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string): Promise<void>;
317
+
318
+ /**
319
+ * WsServer — WebSocket push server for live graph-update notifications.
320
+ *
321
+ * Attaches to an existing Node.js HTTP server (same port as Express).
322
+ * Auth: checks the `code_intel_session` cookie, `Authorization: Bearer <token>`,
323
+ * or `?token=<token>` query param via the existing websocket-auth module.
324
+ *
325
+ * On file change: caller calls broadcast() to push a `graph:updated` message
326
+ * to all authenticated connected clients.
327
+ *
328
+ * Client auto-reconnect is the client's responsibility.
329
+ */
330
+
331
+ interface GraphUpdatedMessage {
332
+ type: 'graph:updated';
333
+ indexVersion: string;
334
+ stats: {
335
+ nodes: number;
336
+ edges: number;
337
+ };
338
+ changedFiles: string[];
339
+ timestamp: string;
340
+ }
341
+ declare class WsServer {
342
+ private readonly wss;
343
+ private readonly clients;
344
+ constructor(httpServer: Server$1);
345
+ /** Broadcast a message to all authenticated connected clients. */
346
+ broadcast(msg: GraphUpdatedMessage): void;
347
+ get clientCount(): number;
348
+ close(): void;
349
+ }
350
+
351
+ declare function createApp(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string, watcherState?: {
352
+ watching: boolean;
353
+ lastEventAt: number | null;
354
+ }): express.Application;
355
+ interface HttpServerInstance {
356
+ wsServer: WsServer | null;
357
+ }
358
+ declare function startHttpServer(graph: KnowledgeGraph, repoName: string, port?: number, workspaceRoot?: string, watcherState?: {
359
+ watching: boolean;
360
+ lastEventAt: number | null;
361
+ }): Promise<HttpServerInstance>;
362
+
293
363
  declare class DbManager {
294
364
  private db;
295
365
  private conn;
@@ -302,12 +372,6 @@ declare class DbManager {
302
372
  get isOpen(): boolean;
303
373
  }
304
374
 
305
- declare function createMcpServer(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string): Server;
306
- declare function startMcpStdio(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string): Promise<void>;
307
-
308
- declare function createApp(graph: KnowledgeGraph, repoName: string, workspaceRoot?: string): express.Application;
309
- declare function startHttpServer(graph: KnowledgeGraph, repoName: string, port?: number, workspaceRoot?: string): void;
310
-
311
375
  /**
312
376
  * Load graph into DB using bulk CSV COPY — dramatically faster than
313
377
  * individual CREATE statements (10-100× speedup for large repos).