@zokizuan/satori-mcp 1.0.2 → 3.0.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/README.md +98 -123
- package/dist/config.d.ts +11 -1
- package/dist/config.js +2 -2
- package/dist/core/call-graph.d.ts +116 -0
- package/dist/core/call-graph.js +608 -0
- package/dist/core/handlers.d.ts +97 -2
- package/dist/core/handlers.js +1075 -325
- package/dist/core/search-constants.d.ts +13 -0
- package/dist/core/search-constants.js +37 -0
- package/dist/core/search-types.d.ts +92 -0
- package/dist/core/search-types.js +2 -0
- package/dist/core/snapshot.d.ts +3 -1
- package/dist/core/snapshot.js +21 -0
- package/dist/core/sync.d.ts +23 -1
- package/dist/core/sync.js +48 -8
- package/dist/index.js +16 -1
- package/dist/telemetry/search.d.ts +1 -0
- package/dist/tools/call_graph.d.ts +3 -0
- package/dist/tools/call_graph.js +37 -0
- package/dist/tools/manage_index.js +7 -4
- package/dist/tools/registry.js +2 -0
- package/dist/tools/search_codebase.js +40 -315
- package/package.json +5 -4
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/ast_breadcrumbs.test.d.ts +0 -2
- package/dist/core/ast_breadcrumbs.test.d.ts.map +0 -1
- package/dist/core/ast_breadcrumbs.test.js +0 -72
- package/dist/core/ast_breadcrumbs.test.js.map +0 -1
- package/dist/core/capabilities.d.ts.map +0 -1
- package/dist/core/capabilities.js.map +0 -1
- package/dist/core/capabilities.test.d.ts +0 -2
- package/dist/core/capabilities.test.d.ts.map +0 -1
- package/dist/core/capabilities.test.js +0 -49
- package/dist/core/capabilities.test.js.map +0 -1
- package/dist/core/handlers.d.ts.map +0 -1
- package/dist/core/handlers.js.map +0 -1
- package/dist/core/handlers.scope.test.d.ts +0 -2
- package/dist/core/handlers.scope.test.d.ts.map +0 -1
- package/dist/core/handlers.scope.test.js +0 -122
- package/dist/core/handlers.scope.test.js.map +0 -1
- package/dist/core/snapshot.d.ts.map +0 -1
- package/dist/core/snapshot.js.map +0 -1
- package/dist/core/snapshot.test.d.ts +0 -2
- package/dist/core/snapshot.test.d.ts.map +0 -1
- package/dist/core/snapshot.test.js +0 -119
- package/dist/core/snapshot.test.js.map +0 -1
- package/dist/core/sync.d.ts.map +0 -1
- package/dist/core/sync.js.map +0 -1
- package/dist/core/sync.test.d.ts +0 -2
- package/dist/core/sync.test.d.ts.map +0 -1
- package/dist/core/sync.test.js +0 -101
- package/dist/core/sync.test.js.map +0 -1
- package/dist/embedding.d.ts.map +0 -1
- package/dist/embedding.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/telemetry/search.d.ts.map +0 -1
- package/dist/telemetry/search.js.map +0 -1
- package/dist/tools/list_codebases.d.ts.map +0 -1
- package/dist/tools/list_codebases.js.map +0 -1
- package/dist/tools/manage_index.d.ts.map +0 -1
- package/dist/tools/manage_index.js.map +0 -1
- package/dist/tools/read_file.d.ts.map +0 -1
- package/dist/tools/read_file.js.map +0 -1
- package/dist/tools/read_file.test.d.ts +0 -2
- package/dist/tools/read_file.test.d.ts.map +0 -1
- package/dist/tools/read_file.test.js +0 -96
- package/dist/tools/read_file.test.js.map +0 -1
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/registry.test.d.ts +0 -2
- package/dist/tools/registry.test.d.ts.map +0 -1
- package/dist/tools/registry.test.js +0 -58
- package/dist/tools/registry.test.js.map +0 -1
- package/dist/tools/search_codebase.d.ts.map +0 -1
- package/dist/tools/search_codebase.js.map +0 -1
- package/dist/tools/search_codebase.test.d.ts +0 -2
- package/dist/tools/search_codebase.test.d.ts.map +0 -1
- package/dist/tools/search_codebase.test.js +0 -269
- package/dist/tools/search_codebase.test.js.map +0 -1
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,130 +1,53 @@
|
|
|
1
1
|
# @zokizuan/satori-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for Satori.
|
|
4
|
-
Satori means "sudden insight"; this package turns core indexing/search into agent-safe MCP actions.
|
|
5
|
-
|
|
6
|
-
Maintained by: `ham-zax` (`@zokizuan`).
|
|
7
|
-
|
|
8
|
-
## Breaking Change (v1.0.0)
|
|
9
|
-
|
|
10
|
-
Tool surface is now hard-broken to 4 tools only:
|
|
11
|
-
|
|
12
|
-
- `manage_index`
|
|
13
|
-
- `search_codebase`
|
|
14
|
-
- `read_file`
|
|
15
|
-
- `list_codebases`
|
|
16
|
-
|
|
17
|
-
Removed tools from pre-1.0 releases are no longer routed.
|
|
3
|
+
MCP server for Satori — agent-safe semantic code search and indexing.
|
|
18
4
|
|
|
19
5
|
## Features
|
|
20
6
|
|
|
21
|
-
- Capability-driven execution via `CapabilityResolver
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Architecture Evolution
|
|
39
|
-
|
|
40
|
-
### Before (pre-v1.0.0)
|
|
41
|
-
|
|
42
|
-
- Monolithic routing and execution concentrated in `index.ts` + `handlers.ts`.
|
|
43
|
-
- Redundant tool surface (9 tools) increased agent/tool-selection ambiguity.
|
|
44
|
-
- Inline JSON schemas and docs drift risk.
|
|
45
|
-
- Environment checks leaked across runtime paths.
|
|
46
|
-
- Snapshot state lacked robust fingerprint protection for model/provider changes.
|
|
47
|
-
|
|
48
|
-
### After (v1.0.0+)
|
|
49
|
-
|
|
50
|
-
- Lightweight bootstrap in `index.ts` with registry-based tool routing.
|
|
51
|
-
- Hard-break 4-tool surface optimized for agent cognition.
|
|
52
|
-
- Modular tool execution in `src/tools/*.ts` with a shared `ToolContext`.
|
|
53
|
-
- Zod schemas as canonical source, converted to JSON Schema at runtime.
|
|
54
|
-
- Snapshot `v3` + fingerprint compatibility gates for safe multi-provider usage.
|
|
55
|
-
- Deterministic train-in-the-error messages for self-healing agent loops.
|
|
56
|
-
- Search observability via structured telemetry.
|
|
57
|
-
- `read_file` upgraded for context-density control (ranges + truncation guard).
|
|
58
|
-
|
|
59
|
-
### Architectural Shape (Current)
|
|
60
|
-
|
|
61
|
-
```text
|
|
7
|
+
- Capability-driven execution via `CapabilityResolver`
|
|
8
|
+
- Runtime-first `search_codebase` with explicit `scope`, `resultMode`, `groupBy`, and optional `debug` traces
|
|
9
|
+
- First-class `call_graph` tool with deterministic node/edge sorting and TS/Python support
|
|
10
|
+
- Snapshot v3 safety with index fingerprints and strict `requires_reindex` access gates
|
|
11
|
+
- Deterministic train-in-the-error responses for incompatible or legacy index states
|
|
12
|
+
- Query-time exclusion support with `.gitignore`-style matching
|
|
13
|
+
- Structured search telemetry logs (`[TELEMETRY]` JSON to `stderr`)
|
|
14
|
+
- Zod-first tool schemas converted to MCP JSON Schema for `ListTools`
|
|
15
|
+
- Auto-generated tool docs from live tool schemas
|
|
16
|
+
- `read_file` line-range retrieval with default large-file truncation guard
|
|
17
|
+
- Optional proactive sync watcher mode (debounced filesystem events)
|
|
18
|
+
- Index-time AST scope breadcrumbs (TS/JS/Python) rendered in search output as `🧬 Scope`
|
|
19
|
+
- Fingerprint schema `dense_v3`/`hybrid_v3` with hard gate for all pre-v3 indexes
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
```
|
|
62
24
|
[MCP Client]
|
|
63
25
|
-> [index.ts bootstrap + ListTools/CallTool]
|
|
64
26
|
-> [tool registry]
|
|
65
|
-
-> [manage_index | search_codebase | read_file | list_codebases]
|
|
27
|
+
-> [manage_index | search_codebase | call_graph | read_file | list_codebases]
|
|
66
28
|
-> [ToolContext DI]
|
|
67
29
|
-> [CapabilityResolver]
|
|
68
30
|
-> [SnapshotManager v3 + access gate]
|
|
69
31
|
-> [Context / Vector store / Embedding / Reranker adapters]
|
|
70
32
|
```
|
|
71
33
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- Phase 1 (state safety + API hard break):
|
|
75
|
-
- 9 tools -> 4 tools
|
|
76
|
-
- capability-driven behavior
|
|
77
|
-
- snapshot `v3` with index fingerprinting and strict reindex gating
|
|
78
|
-
- Phase 2 (modularization + observability):
|
|
79
|
-
- tool registry and modular `src/tools/*`
|
|
80
|
-
- Zod-first schemas and generated docs
|
|
81
|
-
- structured search telemetry
|
|
82
|
-
- Phase 3 (context density):
|
|
83
|
-
- `read_file` line-range semantics
|
|
84
|
-
- safe clamping for out-of-range requests
|
|
85
|
-
- `READ_FILE_MAX_LINES` truncation and continuation hints
|
|
86
|
-
- Phase 5A (advanced context density, search-first):
|
|
87
|
-
- index-time AST breadcrumbs stored in chunk metadata (`breadcrumbs`)
|
|
88
|
-
- `search_codebase` scope rendering (`🧬 Scope: outer > inner`) across standard and rerank views
|
|
89
|
-
- fingerprint schema version bump to `*_v2` requiring reindex for `*_v1` snapshots
|
|
34
|
+
Tool surface is hard-broken to 5 tools. This keeps routing explicit while exposing call-chain traversal as a first-class operation.
|
|
90
35
|
|
|
91
36
|
## read_file Behavior
|
|
92
37
|
|
|
93
|
-
- Supports optional `start_line` and `end_line` (1-based, inclusive)
|
|
94
|
-
- When no range is provided and file length exceeds `READ_FILE_MAX_LINES` (default `1000`), output is truncated and includes a continuation hint with `path` and next `start_line
|
|
38
|
+
- Supports optional `start_line` and `end_line` (1-based, inclusive)
|
|
39
|
+
- When no range is provided and file length exceeds `READ_FILE_MAX_LINES` (default `1000`), output is truncated and includes a continuation hint with `path` and next `start_line`
|
|
95
40
|
|
|
96
|
-
## Proactive Sync
|
|
41
|
+
## Proactive Sync
|
|
97
42
|
|
|
98
|
-
- Enabled by default. Set `MCP_ENABLE_WATCHER=false` to disable
|
|
99
|
-
- Debounce window via `MCP_WATCH_DEBOUNCE_MS` (default `5000`)
|
|
100
|
-
- Watch events reuse the same incremental sync pipeline (`reindexByChange`)
|
|
43
|
+
- Enabled by default. Set `MCP_ENABLE_WATCHER=false` to disable
|
|
44
|
+
- Debounce window via `MCP_WATCH_DEBOUNCE_MS` (default `5000`)
|
|
45
|
+
- Watch events reuse the same incremental sync pipeline (`reindexByChange`)
|
|
101
46
|
- Safety gates:
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
- On shutdown (`SIGINT`/`SIGTERM`), watchers are explicitly closed
|
|
106
|
-
|
|
107
|
-
## Future Plan
|
|
108
|
-
|
|
109
|
-
### 1) Agent Context Density
|
|
110
|
-
|
|
111
|
-
- Add optional `read_file` paging ergonomics beyond current line ranges (for very large files/workflows).
|
|
112
|
-
- Explore syntax-aware snippet shaping in `search_codebase` so results preserve function/class boundaries more reliably.
|
|
113
|
-
|
|
114
|
-
### 2) Proactive Sync
|
|
115
|
-
|
|
116
|
-
- Introduce optional filesystem watching with debounce for near-real-time incremental indexing.
|
|
117
|
-
- Keep manual `manage_index(action="sync")` as explicit fallback.
|
|
118
|
-
|
|
119
|
-
### 3) Provider Expansion
|
|
120
|
-
|
|
121
|
-
- Extend reranker adapters (for example, Cohere) behind the same capability model.
|
|
122
|
-
- Evaluate local vector-store adapters to support fully offline deployments.
|
|
123
|
-
|
|
124
|
-
### 4) Observability Productization
|
|
125
|
-
|
|
126
|
-
- Expand telemetry consumption into a local stats/report workflow (latency, reranker utilization, filter/drop rates).
|
|
127
|
-
- Keep CI fast with deterministic unit/in-memory tests; run provider-backed integration checks on scheduled/manual workflows.
|
|
47
|
+
- Watch-triggered sync only runs for `indexed`/`sync_completed` codebases
|
|
48
|
+
- Events are dropped for `indexing`, `indexfailed`, and `requires_reindex`
|
|
49
|
+
- Ignored/hidden paths are excluded (`node_modules`, `.git`, build artifacts, dotfiles)
|
|
50
|
+
- On shutdown (`SIGINT`/`SIGTERM`), watchers are explicitly closed
|
|
128
51
|
|
|
129
52
|
<!-- TOOLS_START -->
|
|
130
53
|
|
|
@@ -132,32 +55,43 @@ Removed tools from pre-1.0 releases are no longer routed.
|
|
|
132
55
|
|
|
133
56
|
### `manage_index`
|
|
134
57
|
|
|
135
|
-
Manage index lifecycle operations (create/sync/status/clear) for a codebase path.
|
|
58
|
+
Manage index lifecycle operations (create/reindex/sync/status/clear) for a codebase path.
|
|
136
59
|
|
|
137
60
|
| Parameter | Type | Required | Default | Description |
|
|
138
61
|
|---|---|---|---|---|
|
|
139
|
-
| `action` | enum("create", "sync", "status", "clear") | yes | | Required operation to run. |
|
|
62
|
+
| `action` | enum("create", "reindex", "sync", "status", "clear") | yes | | Required operation to run. |
|
|
140
63
|
| `path` | string | yes | | ABSOLUTE path to the target codebase. |
|
|
141
64
|
| `force` | boolean | no | | Only for action='create'. Force rebuild from scratch. |
|
|
142
65
|
| `splitter` | enum("ast", "langchain") | no | | Only for action='create'. Code splitter strategy. |
|
|
143
66
|
| `customExtensions` | array<string> | no | | Only for action='create'. Additional file extensions to include. |
|
|
144
67
|
| `ignorePatterns` | array<string> | no | | Only for action='create'. Additional ignore patterns to apply. |
|
|
68
|
+
| `zillizDropCollection` | string | no | | Only for action='create'. Zilliz-only: drop this Satori-managed collection before creating the new index. |
|
|
145
69
|
|
|
146
70
|
### `search_codebase`
|
|
147
71
|
|
|
148
|
-
Unified semantic search
|
|
72
|
+
Unified semantic search with runtime/docs scope control, grouped/raw output modes, deterministic ranking, and structured freshness decision.
|
|
149
73
|
|
|
150
74
|
| Parameter | Type | Required | Default | Description |
|
|
151
75
|
|---|---|---|---|---|
|
|
152
76
|
| `path` | string | yes | | ABSOLUTE path to an indexed codebase or subdirectory. |
|
|
153
77
|
| `query` | string | yes | | Natural-language query. |
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
|
|
160
|
-
|
|
78
|
+
| `scope` | enum("runtime", "mixed", "docs") | no | `"runtime"` | Search scope policy. runtime excludes docs/tests, docs returns docs/tests only, mixed includes all. |
|
|
79
|
+
| `resultMode` | enum("grouped", "raw") | no | `"grouped"` | Output mode. grouped returns merged search groups, raw returns chunk hits. |
|
|
80
|
+
| `groupBy` | enum("symbol", "file") | no | `"symbol"` | Grouping strategy in grouped mode. |
|
|
81
|
+
| `limit` | integer | no | `50` | Maximum groups (grouped mode) or chunks (raw mode). |
|
|
82
|
+
| `debug` | boolean | no | `false` | Optional debug payload toggle for score and fusion breakdowns. |
|
|
83
|
+
|
|
84
|
+
### `call_graph`
|
|
85
|
+
|
|
86
|
+
Traverse the prebuilt TS/Python call graph sidecar for callers/callees/bidirectional symbol relationships.
|
|
87
|
+
|
|
88
|
+
| Parameter | Type | Required | Default | Description |
|
|
89
|
+
|---|---|---|---|---|
|
|
90
|
+
| `path` | string | yes | | ABSOLUTE path to the indexed codebase root (or subdirectory). |
|
|
91
|
+
| `symbolRef` | object | yes | | Symbol reference from a grouped search result callGraphHint. |
|
|
92
|
+
| `direction` | enum("callers", "callees", "both") | no | `"both"` | Traversal direction from the starting symbol. |
|
|
93
|
+
| `depth` | integer | no | `1` | Traversal depth (max 3). |
|
|
94
|
+
| `limit` | integer | no | `20` | Maximum number of returned edges. |
|
|
161
95
|
|
|
162
96
|
### `read_file`
|
|
163
97
|
|
|
@@ -178,23 +112,56 @@ No parameters.
|
|
|
178
112
|
|
|
179
113
|
<!-- TOOLS_END -->
|
|
180
114
|
|
|
181
|
-
##
|
|
115
|
+
## MCP Config Examples
|
|
182
116
|
|
|
183
|
-
|
|
184
|
-
|
|
117
|
+
### JSON-style (Claude Desktop, Cursor)
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"satori": {
|
|
123
|
+
"command": "npx",
|
|
124
|
+
"args": ["-y", "@zokizuan/satori-mcp@latest"],
|
|
125
|
+
"timeout": 180000,
|
|
126
|
+
"env": {
|
|
127
|
+
"EMBEDDING_PROVIDER": "VoyageAI",
|
|
128
|
+
"EMBEDDING_MODEL": "voyage-4-large",
|
|
129
|
+
"EMBEDDING_OUTPUT_DIMENSION": "1024",
|
|
130
|
+
"VOYAGEAI_API_KEY": "your-api-key",
|
|
131
|
+
"VOYAGEAI_RERANKER_MODEL": "rerank-2.5",
|
|
132
|
+
"MILVUS_ADDRESS": "your-milvus-endpoint",
|
|
133
|
+
"MILVUS_TOKEN": "your-milvus-token"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### TOML-style (Claude Code CLI)
|
|
141
|
+
|
|
142
|
+
```toml
|
|
143
|
+
[mcp_servers.satori]
|
|
144
|
+
command = "npx"
|
|
145
|
+
args = ["-y", "@zokizuan/satori-mcp@latest"]
|
|
146
|
+
startup_timeout_ms = 180000
|
|
147
|
+
env = { EMBEDDING_PROVIDER = "VoyageAI", EMBEDDING_MODEL = "voyage-4-large", EMBEDDING_OUTPUT_DIMENSION = "1024", VOYAGEAI_API_KEY = "your-api-key", VOYAGEAI_RERANKER_MODEL = "rerank-2.5", MILVUS_ADDRESS = "your-milvus-endpoint", MILVUS_TOKEN = "your-milvus-token" }
|
|
185
148
|
```
|
|
186
149
|
|
|
187
|
-
|
|
150
|
+
### Local development (when working on this repo)
|
|
188
151
|
|
|
189
152
|
```json
|
|
190
153
|
{
|
|
191
154
|
"mcpServers": {
|
|
192
155
|
"satori": {
|
|
193
|
-
"command": "
|
|
194
|
-
"args": ["
|
|
156
|
+
"command": "node",
|
|
157
|
+
"args": ["/absolute/path/to/claude-context/packages/mcp/dist/index.js"],
|
|
158
|
+
"timeout": 180000,
|
|
195
159
|
"env": {
|
|
196
160
|
"EMBEDDING_PROVIDER": "VoyageAI",
|
|
161
|
+
"EMBEDDING_MODEL": "voyage-4-large",
|
|
162
|
+
"EMBEDDING_OUTPUT_DIMENSION": "1024",
|
|
197
163
|
"VOYAGEAI_API_KEY": "your-api-key",
|
|
164
|
+
"VOYAGEAI_RERANKER_MODEL": "rerank-2.5",
|
|
198
165
|
"MILVUS_ADDRESS": "your-milvus-endpoint",
|
|
199
166
|
"MILVUS_TOKEN": "your-milvus-token"
|
|
200
167
|
}
|
|
@@ -203,6 +170,14 @@ pnpm --filter @zokizuan/satori-mcp start
|
|
|
203
170
|
}
|
|
204
171
|
```
|
|
205
172
|
|
|
173
|
+
Never commit real API keys/tokens into repo config files.
|
|
174
|
+
|
|
175
|
+
## Run Locally
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pnpm --filter @zokizuan/satori-mcp start
|
|
179
|
+
```
|
|
180
|
+
|
|
206
181
|
## Development
|
|
207
182
|
|
|
208
183
|
```bash
|
package/dist/config.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface IndexFingerprint {
|
|
|
6
6
|
embeddingModel: string;
|
|
7
7
|
embeddingDimension: number;
|
|
8
8
|
vectorStoreProvider: VectorStoreProvider;
|
|
9
|
-
schemaVersion: '
|
|
9
|
+
schemaVersion: 'dense_v3' | 'hybrid_v3';
|
|
10
10
|
}
|
|
11
11
|
export interface ContextMcpConfig {
|
|
12
12
|
name: string;
|
|
@@ -28,6 +28,15 @@ export interface ContextMcpConfig {
|
|
|
28
28
|
watchSyncEnabled?: boolean;
|
|
29
29
|
watchDebounceMs?: number;
|
|
30
30
|
}
|
|
31
|
+
export interface CallGraphSidecarInfo {
|
|
32
|
+
version: 'v3';
|
|
33
|
+
sidecarPath: string;
|
|
34
|
+
builtAt: string;
|
|
35
|
+
nodeCount: number;
|
|
36
|
+
edgeCount: number;
|
|
37
|
+
noteCount: number;
|
|
38
|
+
fingerprint: IndexFingerprint;
|
|
39
|
+
}
|
|
31
40
|
export interface CodebaseSnapshotV1 {
|
|
32
41
|
indexedCodebases: string[];
|
|
33
42
|
indexingCodebases: string[] | Record<string, number>;
|
|
@@ -38,6 +47,7 @@ interface CodebaseInfoBase {
|
|
|
38
47
|
indexFingerprint?: IndexFingerprint;
|
|
39
48
|
fingerprintSource?: FingerprintSource;
|
|
40
49
|
reindexReason?: 'legacy_unverified_fingerprint' | 'fingerprint_mismatch' | 'missing_fingerprint';
|
|
50
|
+
callGraphSidecar?: CallGraphSidecarInfo;
|
|
41
51
|
}
|
|
42
52
|
export interface CodebaseInfoIndexing extends CodebaseInfoBase {
|
|
43
53
|
status: 'indexing';
|
package/dist/config.js
CHANGED
|
@@ -35,9 +35,9 @@ export function getEmbeddingModelForProvider(provider) {
|
|
|
35
35
|
function getSchemaVersionFromEnv() {
|
|
36
36
|
const hybridModeRaw = envManager.get('HYBRID_MODE');
|
|
37
37
|
if (!hybridModeRaw) {
|
|
38
|
-
return '
|
|
38
|
+
return 'hybrid_v3';
|
|
39
39
|
}
|
|
40
|
-
return hybridModeRaw.toLowerCase() === 'true' ? '
|
|
40
|
+
return hybridModeRaw.toLowerCase() === 'true' ? 'hybrid_v3' : 'dense_v3';
|
|
41
41
|
}
|
|
42
42
|
export function buildRuntimeIndexFingerprint(config, embeddingDimension) {
|
|
43
43
|
return {
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { CallGraphSidecarInfo, IndexFingerprint } from '../config.js';
|
|
2
|
+
export type CallGraphDirection = 'callers' | 'callees' | 'both';
|
|
3
|
+
export type CallGraphEdgeKind = 'call' | 'import' | 'dynamic';
|
|
4
|
+
export interface CallGraphSpan {
|
|
5
|
+
startLine: number;
|
|
6
|
+
endLine: number;
|
|
7
|
+
}
|
|
8
|
+
export interface CallGraphSymbolRef {
|
|
9
|
+
file: string;
|
|
10
|
+
symbolId: string;
|
|
11
|
+
symbolLabel?: string;
|
|
12
|
+
span?: CallGraphSpan;
|
|
13
|
+
}
|
|
14
|
+
export interface CallGraphNode {
|
|
15
|
+
symbolId: string;
|
|
16
|
+
symbolLabel?: string;
|
|
17
|
+
file: string;
|
|
18
|
+
language: string;
|
|
19
|
+
span: CallGraphSpan;
|
|
20
|
+
}
|
|
21
|
+
export interface CallGraphEdge {
|
|
22
|
+
srcSymbolId: string;
|
|
23
|
+
dstSymbolId: string;
|
|
24
|
+
kind: CallGraphEdgeKind;
|
|
25
|
+
site: {
|
|
26
|
+
file: string;
|
|
27
|
+
startLine: number;
|
|
28
|
+
endLine?: number;
|
|
29
|
+
};
|
|
30
|
+
confidence: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CallGraphNote {
|
|
33
|
+
type: 'unresolved_edge' | 'dynamic_edge' | 'missing_symbol_metadata';
|
|
34
|
+
file: string;
|
|
35
|
+
startLine: number;
|
|
36
|
+
symbolId?: string;
|
|
37
|
+
detail: string;
|
|
38
|
+
}
|
|
39
|
+
interface CallGraphSidecar {
|
|
40
|
+
formatVersion: 'v3';
|
|
41
|
+
codebasePath: string;
|
|
42
|
+
builtAt: string;
|
|
43
|
+
fingerprint: IndexFingerprint;
|
|
44
|
+
nodes: CallGraphNode[];
|
|
45
|
+
edges: CallGraphEdge[];
|
|
46
|
+
notes: CallGraphNote[];
|
|
47
|
+
}
|
|
48
|
+
export interface CallGraphResponseUnsupported {
|
|
49
|
+
supported: false;
|
|
50
|
+
reason: string;
|
|
51
|
+
hints?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
export interface CallGraphResponseSupported {
|
|
54
|
+
supported: true;
|
|
55
|
+
direction: CallGraphDirection;
|
|
56
|
+
depth: number;
|
|
57
|
+
limit: number;
|
|
58
|
+
nodes: CallGraphNode[];
|
|
59
|
+
edges: CallGraphEdge[];
|
|
60
|
+
notes: CallGraphNote[];
|
|
61
|
+
sidecar: {
|
|
62
|
+
builtAt: string;
|
|
63
|
+
nodeCount: number;
|
|
64
|
+
edgeCount: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export type CallGraphQueryResponse = CallGraphResponseSupported | CallGraphResponseUnsupported;
|
|
68
|
+
export interface CallGraphDeltaPolicy {
|
|
69
|
+
shouldRebuild(changedFiles: string[]): boolean;
|
|
70
|
+
}
|
|
71
|
+
export declare class SupportedSourceDeltaPolicy implements CallGraphDeltaPolicy {
|
|
72
|
+
shouldRebuild(changedFiles: string[]): boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare class CallGraphSidecarManager {
|
|
75
|
+
private readonly runtimeFingerprint;
|
|
76
|
+
private readonly splitter;
|
|
77
|
+
private readonly now;
|
|
78
|
+
private readonly deltaPolicy;
|
|
79
|
+
constructor(runtimeFingerprint: IndexFingerprint, options?: {
|
|
80
|
+
now?: () => number;
|
|
81
|
+
deltaPolicy?: CallGraphDeltaPolicy;
|
|
82
|
+
});
|
|
83
|
+
shouldRebuildForDelta(changedFiles: string[]): boolean;
|
|
84
|
+
loadSidecar(codebasePath: string): CallGraphSidecar | null;
|
|
85
|
+
rebuildForCodebase(codebasePath: string, ignorePatterns?: string[]): Promise<CallGraphSidecarInfo>;
|
|
86
|
+
rebuildIfSupportedDelta(codebasePath: string, changedFiles: string[], ignorePatterns?: string[]): Promise<CallGraphSidecarInfo | null>;
|
|
87
|
+
queryGraph(codebasePath: string, symbolRef: CallGraphSymbolRef, options: {
|
|
88
|
+
direction: CallGraphDirection;
|
|
89
|
+
depth: number;
|
|
90
|
+
limit: number;
|
|
91
|
+
}): CallGraphQueryResponse;
|
|
92
|
+
private buildGraph;
|
|
93
|
+
private buildSymbolIndex;
|
|
94
|
+
private resolveTargetNode;
|
|
95
|
+
private extractImportNames;
|
|
96
|
+
private extractCallSites;
|
|
97
|
+
private looksLikeDefinition;
|
|
98
|
+
private shouldScanNodeAsSource;
|
|
99
|
+
private extractSymbolNames;
|
|
100
|
+
private resolveConfidence;
|
|
101
|
+
private upsertNode;
|
|
102
|
+
private stripInlineComments;
|
|
103
|
+
private getSplitLanguage;
|
|
104
|
+
private isSupportedQueryLanguage;
|
|
105
|
+
private collectSourceFiles;
|
|
106
|
+
private getSidecarPath;
|
|
107
|
+
private toRelativePath;
|
|
108
|
+
private getEdgeKey;
|
|
109
|
+
private sortNodes;
|
|
110
|
+
private sortEdges;
|
|
111
|
+
private sortNotes;
|
|
112
|
+
private compareNullableNumbersAsc;
|
|
113
|
+
private compareNullableStringsAsc;
|
|
114
|
+
}
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=call-graph.d.ts.map
|