suture-mcp 0.1.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/LICENSE +21 -0
- package/README.md +246 -0
- package/dist/cli.cjs +3033 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +3006 -0
- package/dist/index.cjs +2908 -0
- package/dist/index.d.cts +634 -0
- package/dist/index.d.ts +634 -0
- package/dist/index.js +2841 -0
- package/package.json +74 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
import Database$1 from 'better-sqlite3';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Readable, Writable } from 'node:stream';
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
|
|
6
|
+
type StructuredMemory = {
|
|
7
|
+
kind: "summary";
|
|
8
|
+
text: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "event";
|
|
11
|
+
what: string;
|
|
12
|
+
when?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "insight";
|
|
15
|
+
claim: string;
|
|
16
|
+
confidence: number;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "decision";
|
|
19
|
+
choice: string;
|
|
20
|
+
rationale: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "entity";
|
|
23
|
+
name: string;
|
|
24
|
+
attributes: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
type EvidenceRef = {
|
|
27
|
+
kind: "file";
|
|
28
|
+
path: string;
|
|
29
|
+
lineStart?: number;
|
|
30
|
+
lineEnd?: number;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "package";
|
|
33
|
+
path: string;
|
|
34
|
+
key: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "github";
|
|
37
|
+
url: string;
|
|
38
|
+
refType?: "repo" | "commit" | "pull_request" | "issue" | "file";
|
|
39
|
+
} | {
|
|
40
|
+
kind: "agent";
|
|
41
|
+
source: string;
|
|
42
|
+
};
|
|
43
|
+
interface Provenance {
|
|
44
|
+
sourceType: "mcp" | "cli" | "discovery" | "github" | "import";
|
|
45
|
+
source: string;
|
|
46
|
+
evidence?: EvidenceRef[];
|
|
47
|
+
}
|
|
48
|
+
interface Entity {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
kind: string;
|
|
52
|
+
attributes: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
interface Relation {
|
|
55
|
+
fromId: string;
|
|
56
|
+
toId: string;
|
|
57
|
+
label: string;
|
|
58
|
+
validFrom: Date;
|
|
59
|
+
validTo: Date | null;
|
|
60
|
+
}
|
|
61
|
+
interface Episode {
|
|
62
|
+
id: string;
|
|
63
|
+
projectId?: string;
|
|
64
|
+
content: StructuredMemory;
|
|
65
|
+
entities: Entity[];
|
|
66
|
+
edges: Relation[];
|
|
67
|
+
validFrom: Date;
|
|
68
|
+
validTo: Date | null;
|
|
69
|
+
tier: "core" | "recall" | "archive";
|
|
70
|
+
rir: {
|
|
71
|
+
recency: number;
|
|
72
|
+
importance: number;
|
|
73
|
+
relevance: number;
|
|
74
|
+
};
|
|
75
|
+
source: string;
|
|
76
|
+
confidence?: number;
|
|
77
|
+
status?: "active" | "invalidated" | "blocked" | "stale" | "superseded";
|
|
78
|
+
visibility?: "local" | "team";
|
|
79
|
+
tags?: string[];
|
|
80
|
+
provenance?: Provenance;
|
|
81
|
+
curationReason?: string;
|
|
82
|
+
pinned?: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface CuratorProvider {
|
|
85
|
+
scoreImportance(content: StructuredMemory): Promise<number>;
|
|
86
|
+
extractEntities(content: StructuredMemory): Promise<Entity[]>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface EpisodeRow {
|
|
90
|
+
id: string;
|
|
91
|
+
projectId?: string | null;
|
|
92
|
+
content: string;
|
|
93
|
+
entities: string;
|
|
94
|
+
edges: string;
|
|
95
|
+
validFrom: number;
|
|
96
|
+
validTo: number | null;
|
|
97
|
+
tier: string;
|
|
98
|
+
rir: string;
|
|
99
|
+
source: string;
|
|
100
|
+
confidence?: number | null;
|
|
101
|
+
status?: string | null;
|
|
102
|
+
visibility?: string | null;
|
|
103
|
+
tags?: string | null;
|
|
104
|
+
provenance?: string | null;
|
|
105
|
+
curationReason?: string | null;
|
|
106
|
+
pinned?: number | null;
|
|
107
|
+
}
|
|
108
|
+
declare class SqliteSubstrate {
|
|
109
|
+
private db;
|
|
110
|
+
constructor(path: string);
|
|
111
|
+
private migrate;
|
|
112
|
+
upsert(episode: Episode): void;
|
|
113
|
+
invalidate(id: string, validTo: Date): void;
|
|
114
|
+
listByTier(tier: "core" | "recall" | "archive"): Episode[];
|
|
115
|
+
listAll(): Episode[];
|
|
116
|
+
listActiveByIds(ids: string[]): Episode[];
|
|
117
|
+
listAllRaw(): EpisodeRow[];
|
|
118
|
+
transaction<T>(fn: () => T): T;
|
|
119
|
+
raw(): Database$1.Database;
|
|
120
|
+
close(): void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare class SessionGate {
|
|
124
|
+
private readonly seen;
|
|
125
|
+
private readonly sentinel;
|
|
126
|
+
constructor(stateDir: string);
|
|
127
|
+
shouldInject(contentHash: string): boolean;
|
|
128
|
+
markInjected(contentHash: string): void;
|
|
129
|
+
forceReinject(): void;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare class Fts5Index {
|
|
133
|
+
private db;
|
|
134
|
+
constructor(db: Database$1.Database);
|
|
135
|
+
index(episode: Episode): void;
|
|
136
|
+
search(query: string, limit?: number): string[];
|
|
137
|
+
remove(id: string): void;
|
|
138
|
+
clear(): void;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type Database = Database$1.Database;
|
|
142
|
+
declare class MemoryGraph {
|
|
143
|
+
private db;
|
|
144
|
+
constructor(db: Database);
|
|
145
|
+
index(episode: Episode): void;
|
|
146
|
+
search(entityName: string, limit?: number): string[];
|
|
147
|
+
getRelations(entityId: string): Relation[];
|
|
148
|
+
remove(episodeId: string): void;
|
|
149
|
+
clear(): void;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface CodeSymbol {
|
|
153
|
+
name: string;
|
|
154
|
+
kind: "function" | "class" | "interface" | "type" | "variable";
|
|
155
|
+
filePath: string;
|
|
156
|
+
line: number;
|
|
157
|
+
}
|
|
158
|
+
declare class CodeGraph {
|
|
159
|
+
private db;
|
|
160
|
+
private parser;
|
|
161
|
+
constructor(db: Database$1.Database);
|
|
162
|
+
private ensureSchema;
|
|
163
|
+
indexFile(filePath: string, source: string): void;
|
|
164
|
+
search(query: string, limit?: number): CodeSymbol[];
|
|
165
|
+
countSymbolsForFile(filePath: string): number;
|
|
166
|
+
removeFile(filePath: string): void;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface SearchResult {
|
|
170
|
+
episodeIds: string[];
|
|
171
|
+
codeSymbols: CodeSymbol[];
|
|
172
|
+
source: "graph" | "code" | "fts5" | "combined";
|
|
173
|
+
}
|
|
174
|
+
declare class SearchRouter {
|
|
175
|
+
private memory;
|
|
176
|
+
private code;
|
|
177
|
+
private fts;
|
|
178
|
+
constructor(memory: MemoryGraph, code: CodeGraph, fts: Fts5Index);
|
|
179
|
+
search(query: string, limit?: number): SearchResult;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare class RirScorer {
|
|
183
|
+
recency(createdAt: Date): number;
|
|
184
|
+
importance(content: StructuredMemory): number;
|
|
185
|
+
relevance(content: StructuredMemory, goal?: string): number;
|
|
186
|
+
score(episode: Episode): {
|
|
187
|
+
recency: number;
|
|
188
|
+
importance: number;
|
|
189
|
+
relevance: number;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class SemanticCurator implements CuratorProvider {
|
|
194
|
+
scoreImportance(content: StructuredMemory): Promise<number>;
|
|
195
|
+
extractEntities(content: StructuredMemory): Promise<Entity[]>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare class AgentCurator implements CuratorProvider {
|
|
199
|
+
private provider;
|
|
200
|
+
private fallback;
|
|
201
|
+
constructor(provider: CuratorProvider, fallback: SemanticCurator);
|
|
202
|
+
scoreImportance(content: StructuredMemory): Promise<number>;
|
|
203
|
+
extractEntities(content: StructuredMemory): Promise<Entity[]>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class IndexManager {
|
|
207
|
+
private memory;
|
|
208
|
+
private code;
|
|
209
|
+
private fts;
|
|
210
|
+
constructor(memory: MemoryGraph, code: CodeGraph, fts: Fts5Index);
|
|
211
|
+
indexEpisode(episode: Episode): void;
|
|
212
|
+
removeEpisode(episodeId: string): void;
|
|
213
|
+
rebuildEpisodes(episodes: Episode[]): void;
|
|
214
|
+
indexCodeFile(filePath: string, source: string): void;
|
|
215
|
+
removeCodeFile(filePath: string): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
interface CurationSummary {
|
|
219
|
+
promoted: number;
|
|
220
|
+
retained: number;
|
|
221
|
+
archived: number;
|
|
222
|
+
deleted: number;
|
|
223
|
+
actions: Array<{
|
|
224
|
+
action: string;
|
|
225
|
+
detail: string;
|
|
226
|
+
projectId?: string;
|
|
227
|
+
}>;
|
|
228
|
+
}
|
|
229
|
+
declare class TierManager {
|
|
230
|
+
private substrate;
|
|
231
|
+
private scorer;
|
|
232
|
+
private curator;
|
|
233
|
+
private indexes?;
|
|
234
|
+
constructor(substrate: SqliteSubstrate, scorer: RirScorer, curator: CuratorProvider, indexes?: IndexManager | undefined);
|
|
235
|
+
runCuration(): Promise<CurationSummary>;
|
|
236
|
+
getCoreBlock(): string;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface SecurityScanResult {
|
|
240
|
+
blocked: boolean;
|
|
241
|
+
reasons: string[];
|
|
242
|
+
redactedText: string;
|
|
243
|
+
}
|
|
244
|
+
declare class SecurityScanner {
|
|
245
|
+
scanText(text: string): SecurityScanResult;
|
|
246
|
+
isIgnoredPath(filePath: string): boolean;
|
|
247
|
+
canExportTo(targetPath: string, stateDir: string): boolean;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type DiscoveryFindingType = "language" | "framework" | "package_manager" | "script" | "command" | "entrypoint" | "test_strategy" | "directory_role" | "key_module" | "convention" | "architecture_note" | "decision" | "risk" | "dependency" | "deployment_note";
|
|
251
|
+
type DiscoveryFindingStatus = "auto_accepted" | "queued" | "blocked" | "rejected" | "stale" | "superseded";
|
|
252
|
+
interface DiscoveryFindingInput {
|
|
253
|
+
type: DiscoveryFindingType;
|
|
254
|
+
claim: string;
|
|
255
|
+
payload?: Record<string, unknown>;
|
|
256
|
+
evidence?: EvidenceRef[];
|
|
257
|
+
confidence?: number;
|
|
258
|
+
source?: string;
|
|
259
|
+
freshness?: "fresh" | "unknown" | "stale";
|
|
260
|
+
}
|
|
261
|
+
interface DiscoveryFinding extends Required<DiscoveryFindingInput> {
|
|
262
|
+
id: string;
|
|
263
|
+
sessionId: string;
|
|
264
|
+
projectId: string;
|
|
265
|
+
risk: "low" | "medium" | "high";
|
|
266
|
+
status: DiscoveryFindingStatus;
|
|
267
|
+
createdAt: Date;
|
|
268
|
+
reason: string;
|
|
269
|
+
}
|
|
270
|
+
interface DiscoverySession {
|
|
271
|
+
id: string;
|
|
272
|
+
projectId: string;
|
|
273
|
+
rootPath: string;
|
|
274
|
+
startedBy: string;
|
|
275
|
+
startedAt: Date;
|
|
276
|
+
status: "active" | "applied" | "stale";
|
|
277
|
+
scanSummary: Record<string, unknown>;
|
|
278
|
+
coverage: DiscoveryCoverage;
|
|
279
|
+
policyVersion: string;
|
|
280
|
+
}
|
|
281
|
+
interface DiscoveryCoverage {
|
|
282
|
+
languages: number;
|
|
283
|
+
scripts: number;
|
|
284
|
+
entrypoints: number;
|
|
285
|
+
tests: number;
|
|
286
|
+
docs: number;
|
|
287
|
+
queued: number;
|
|
288
|
+
blocked: number;
|
|
289
|
+
accepted: number;
|
|
290
|
+
}
|
|
291
|
+
interface DiscoveryPolicyDecision {
|
|
292
|
+
status: DiscoveryFindingStatus;
|
|
293
|
+
risk: "low" | "medium" | "high";
|
|
294
|
+
reason: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare class DiscoveryPolicy {
|
|
298
|
+
private security;
|
|
299
|
+
readonly version = "2026-05-secure-project-map";
|
|
300
|
+
constructor(security?: SecurityScanner);
|
|
301
|
+
decide(input: DiscoveryFindingInput): DiscoveryPolicyDecision;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
declare class DiscoveryEngine {
|
|
305
|
+
private substrate;
|
|
306
|
+
private policy;
|
|
307
|
+
private security;
|
|
308
|
+
constructor(substrate: SqliteSubstrate, policy?: DiscoveryPolicy, security?: SecurityScanner);
|
|
309
|
+
start(rootPath: string, startedBy?: string, projectId?: string): DiscoverySession;
|
|
310
|
+
getSession(sessionId: string): DiscoverySession | null;
|
|
311
|
+
findings(sessionId: string): DiscoveryFinding[];
|
|
312
|
+
submit(sessionId: string, input: DiscoveryFindingInput): DiscoveryFinding;
|
|
313
|
+
scan(sessionId: string): DiscoveryFinding[];
|
|
314
|
+
status(sessionId: string): {
|
|
315
|
+
session: DiscoverySession;
|
|
316
|
+
findings: DiscoveryFinding[];
|
|
317
|
+
coverage: DiscoveryCoverage;
|
|
318
|
+
};
|
|
319
|
+
refresh(sessionId: string): DiscoverySession;
|
|
320
|
+
private updateCoverage;
|
|
321
|
+
private coverageFor;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare const CurationActionSchema: z.ZodObject<{
|
|
325
|
+
at: z.ZodString;
|
|
326
|
+
action: z.ZodString;
|
|
327
|
+
detail: z.ZodString;
|
|
328
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
declare const TelemetryStatsSchema: z.ZodObject<{
|
|
331
|
+
tokensSaved: z.ZodDefault<z.ZodNumber>;
|
|
332
|
+
contextRotationsAvoided: z.ZodDefault<z.ZodNumber>;
|
|
333
|
+
totalInjections: z.ZodDefault<z.ZodNumber>;
|
|
334
|
+
toolUsage: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
335
|
+
memoriesCreated: z.ZodDefault<z.ZodNumber>;
|
|
336
|
+
activeContextTokens: z.ZodDefault<z.ZodNumber>;
|
|
337
|
+
indexedFiles: z.ZodDefault<z.ZodNumber>;
|
|
338
|
+
skippedUnchangedFiles: z.ZodDefault<z.ZodNumber>;
|
|
339
|
+
codeSymbolsIndexed: z.ZodDefault<z.ZodNumber>;
|
|
340
|
+
projectFactsAccepted: z.ZodDefault<z.ZodNumber>;
|
|
341
|
+
projectFactsQueued: z.ZodDefault<z.ZodNumber>;
|
|
342
|
+
projectFactsRejected: z.ZodDefault<z.ZodNumber>;
|
|
343
|
+
projectFactsStale: z.ZodDefault<z.ZodNumber>;
|
|
344
|
+
projectFactsSuperseded: z.ZodDefault<z.ZodNumber>;
|
|
345
|
+
estimatedTokensCached: z.ZodDefault<z.ZodNumber>;
|
|
346
|
+
estimatedTokensAvoidedFromRereads: z.ZodDefault<z.ZodNumber>;
|
|
347
|
+
searchHitsServedFromSubstrate: z.ZodDefault<z.ZodNumber>;
|
|
348
|
+
skippedDuplicateInjections: z.ZodDefault<z.ZodNumber>;
|
|
349
|
+
recentTokenSavings: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
350
|
+
recentCurationActions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
351
|
+
at: z.ZodString;
|
|
352
|
+
action: z.ZodString;
|
|
353
|
+
detail: z.ZodString;
|
|
354
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
355
|
+
}, z.core.$strip>>>;
|
|
356
|
+
lastUpdate: z.ZodDefault<z.ZodString>;
|
|
357
|
+
}, z.core.$strip>;
|
|
358
|
+
type TelemetryStats = z.infer<typeof TelemetryStatsSchema>;
|
|
359
|
+
type CurationAction = z.infer<typeof CurationActionSchema>;
|
|
360
|
+
interface CostEstimate {
|
|
361
|
+
modelProfile: string;
|
|
362
|
+
inputCostPerMillion: number;
|
|
363
|
+
estimatedTokens: number;
|
|
364
|
+
estimatedUsd: number;
|
|
365
|
+
formula: string;
|
|
366
|
+
}
|
|
367
|
+
declare const MODEL_COST_PROFILES: Record<string, number>;
|
|
368
|
+
declare class TelemetryService {
|
|
369
|
+
private statePath?;
|
|
370
|
+
private stats;
|
|
371
|
+
constructor(statePath?: string | undefined);
|
|
372
|
+
private load;
|
|
373
|
+
save(): void;
|
|
374
|
+
recordToolUsage(toolName: string): void;
|
|
375
|
+
recordSavings(tokens: number): void;
|
|
376
|
+
recordMemoryCreated(): void;
|
|
377
|
+
recordInjection(tokens: number): void;
|
|
378
|
+
recordSkippedInjection(): void;
|
|
379
|
+
recordIndexing(summary: {
|
|
380
|
+
indexedFiles?: number;
|
|
381
|
+
skippedFiles?: number;
|
|
382
|
+
symbols?: number;
|
|
383
|
+
accepted?: number;
|
|
384
|
+
queued?: number;
|
|
385
|
+
rejected?: number;
|
|
386
|
+
stale?: number;
|
|
387
|
+
superseded?: number;
|
|
388
|
+
tokensCached?: number;
|
|
389
|
+
tokensAvoidedFromRereads?: number;
|
|
390
|
+
}): void;
|
|
391
|
+
recordSearchHits(count: number): void;
|
|
392
|
+
recordCurationAction(action: Omit<CurationAction, "at">): void;
|
|
393
|
+
getStats(): TelemetryStats;
|
|
394
|
+
estimateCostSavings(modelProfile?: string, inputCostPerMillion?: number): CostEstimate;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface RememberInput {
|
|
398
|
+
content: string;
|
|
399
|
+
kind?: StructuredMemory["kind"];
|
|
400
|
+
source?: string;
|
|
401
|
+
projectId?: string;
|
|
402
|
+
evidence?: EvidenceRef[];
|
|
403
|
+
tags?: string[];
|
|
404
|
+
confidence?: number;
|
|
405
|
+
sourceType?: Provenance["sourceType"];
|
|
406
|
+
}
|
|
407
|
+
interface HydratedSearchResult extends SearchResult {
|
|
408
|
+
episodes: Episode[];
|
|
409
|
+
warnings: string[];
|
|
410
|
+
}
|
|
411
|
+
declare class MemoryStore {
|
|
412
|
+
private substrate;
|
|
413
|
+
private indexes;
|
|
414
|
+
private router;
|
|
415
|
+
private curator;
|
|
416
|
+
private security;
|
|
417
|
+
private telemetry?;
|
|
418
|
+
constructor(substrate: SqliteSubstrate, indexes: IndexManager, router: SearchRouter, curator: CuratorProvider, security?: SecurityScanner, telemetry?: TelemetryService | undefined);
|
|
419
|
+
remember(input: RememberInput): Promise<Episode>;
|
|
420
|
+
forget(id: string): boolean;
|
|
421
|
+
search(query: string, limit?: number): HydratedSearchResult;
|
|
422
|
+
listActive(): Episode[];
|
|
423
|
+
exportActive(targetPath: string, stateDir: string): number;
|
|
424
|
+
indexCodeFile(filePath: string, source: string): void;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
type ToolResult = {
|
|
428
|
+
content: [{
|
|
429
|
+
type: "text";
|
|
430
|
+
text: string;
|
|
431
|
+
}];
|
|
432
|
+
};
|
|
433
|
+
interface ToolDef {
|
|
434
|
+
name: string;
|
|
435
|
+
description: string;
|
|
436
|
+
schema: z.ZodRawShape;
|
|
437
|
+
handler: (args: Record<string, unknown>) => Promise<ToolResult>;
|
|
438
|
+
}
|
|
439
|
+
interface ToolServices {
|
|
440
|
+
memoryStore?: MemoryStore;
|
|
441
|
+
discovery?: DiscoveryEngine;
|
|
442
|
+
curator?: CuratorProvider;
|
|
443
|
+
stateDir?: string;
|
|
444
|
+
telemetry?: TelemetryService;
|
|
445
|
+
}
|
|
446
|
+
declare function makeTools(substrate: SqliteSubstrate, gate: SessionGate, router: SearchRouter, tierManager: TierManager, memory: MemoryGraph, code: CodeGraph, fts: Fts5Index, services?: ToolServices): ToolDef[];
|
|
447
|
+
|
|
448
|
+
interface McpServerIo {
|
|
449
|
+
stdin?: Readable;
|
|
450
|
+
stdout?: Writable;
|
|
451
|
+
}
|
|
452
|
+
interface McpServerHandle {
|
|
453
|
+
close: () => Promise<void>;
|
|
454
|
+
}
|
|
455
|
+
declare function startMcpServer(stateDirInput: string, io?: McpServerIo): Promise<McpServerHandle>;
|
|
456
|
+
|
|
457
|
+
declare class VizServer {
|
|
458
|
+
private substrate;
|
|
459
|
+
private tierManager;
|
|
460
|
+
private router;
|
|
461
|
+
private port;
|
|
462
|
+
private server;
|
|
463
|
+
constructor(substrate: SqliteSubstrate, tierManager: TierManager, router: SearchRouter, port?: number);
|
|
464
|
+
listen(): void;
|
|
465
|
+
close(): void;
|
|
466
|
+
private route;
|
|
467
|
+
private memoryGraphData;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface ProjectIndexPlan {
|
|
471
|
+
projectId: string;
|
|
472
|
+
fingerprint: string;
|
|
473
|
+
identity: ProjectIdentity;
|
|
474
|
+
existingIndex: ExistingProjectIndex | null;
|
|
475
|
+
projectPath: string;
|
|
476
|
+
scanPatterns: string[];
|
|
477
|
+
ignoredPaths: string[];
|
|
478
|
+
manifestFiles: string[];
|
|
479
|
+
codeFiles: string[];
|
|
480
|
+
findings: DiscoveryFindingInput[];
|
|
481
|
+
estimatedTokensToCache: number;
|
|
482
|
+
estimatedTokensAvoidedFromRereads: number;
|
|
483
|
+
}
|
|
484
|
+
interface ProjectIdentity {
|
|
485
|
+
packageName?: string;
|
|
486
|
+
gitRemote?: string;
|
|
487
|
+
rootPath: string;
|
|
488
|
+
basis: string[];
|
|
489
|
+
}
|
|
490
|
+
interface ExistingProjectIndex {
|
|
491
|
+
projectId: string;
|
|
492
|
+
fingerprint: string;
|
|
493
|
+
rootPath: string;
|
|
494
|
+
packageName?: string;
|
|
495
|
+
gitRemote?: string;
|
|
496
|
+
indexedFiles: number;
|
|
497
|
+
codeSymbols: number;
|
|
498
|
+
lastIndexedAt: string;
|
|
499
|
+
sameRoot: boolean;
|
|
500
|
+
}
|
|
501
|
+
interface ProjectIndexResult {
|
|
502
|
+
projectId: string;
|
|
503
|
+
fingerprint: string;
|
|
504
|
+
existingIndex: ExistingProjectIndex | null;
|
|
505
|
+
projectPath: string;
|
|
506
|
+
sessionId: string;
|
|
507
|
+
accepted: number;
|
|
508
|
+
queued: number;
|
|
509
|
+
blocked: number;
|
|
510
|
+
applied: number;
|
|
511
|
+
skippedDuplicateFacts: number;
|
|
512
|
+
indexedFiles: number;
|
|
513
|
+
skippedFiles: number;
|
|
514
|
+
codeSymbolsIndexed: number;
|
|
515
|
+
estimatedTokensCached: number;
|
|
516
|
+
estimatedTokensAvoidedFromRereads: number;
|
|
517
|
+
curationActions: number;
|
|
518
|
+
findings: DiscoveryFinding[];
|
|
519
|
+
}
|
|
520
|
+
interface ProjectIndexApplyOptions {
|
|
521
|
+
enabledFindingIndexes?: number[];
|
|
522
|
+
}
|
|
523
|
+
declare class ProjectIndexer {
|
|
524
|
+
private substrate;
|
|
525
|
+
private memoryStore;
|
|
526
|
+
private codeGraph;
|
|
527
|
+
private tierManager;
|
|
528
|
+
private telemetry?;
|
|
529
|
+
private security;
|
|
530
|
+
constructor(substrate: SqliteSubstrate, memoryStore: MemoryStore, codeGraph: CodeGraph, tierManager: TierManager, telemetry?: TelemetryService | undefined, security?: SecurityScanner);
|
|
531
|
+
preview(projectPath: string): ProjectIndexPlan;
|
|
532
|
+
apply(projectPath: string, options?: ProjectIndexApplyOptions): Promise<ProjectIndexResult>;
|
|
533
|
+
private hasExistingFact;
|
|
534
|
+
private getExistingIndex;
|
|
535
|
+
private recordProjectIndex;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
declare function registerDiscoveryPrompts(server: McpServer): void;
|
|
539
|
+
|
|
540
|
+
interface SyncOperation {
|
|
541
|
+
id: string;
|
|
542
|
+
projectId: string;
|
|
543
|
+
kind: "remember" | "forget" | "discovery" | "curate";
|
|
544
|
+
createdAt: number;
|
|
545
|
+
payload: unknown;
|
|
546
|
+
}
|
|
547
|
+
interface EncryptedSyncRecord {
|
|
548
|
+
operationId: string;
|
|
549
|
+
projectId: string;
|
|
550
|
+
algorithm: "aes-256-gcm";
|
|
551
|
+
nonce: string;
|
|
552
|
+
ciphertext: string;
|
|
553
|
+
authTag: string;
|
|
554
|
+
createdAt: number;
|
|
555
|
+
}
|
|
556
|
+
declare class EncryptedSyncLog {
|
|
557
|
+
encrypt(operation: SyncOperation, key: Buffer): EncryptedSyncRecord;
|
|
558
|
+
decrypt(record: EncryptedSyncRecord, key: Buffer): SyncOperation;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
interface GitHubReference {
|
|
562
|
+
owner: string;
|
|
563
|
+
repo: string;
|
|
564
|
+
kind: "repo" | "commit" | "pull_request" | "issue" | "file";
|
|
565
|
+
value?: string | number;
|
|
566
|
+
path?: string;
|
|
567
|
+
}
|
|
568
|
+
declare function githubEvidence(ref: GitHubReference): EvidenceRef;
|
|
569
|
+
|
|
570
|
+
type HookDecisionKind = "inject_memory" | "inject_setup_signal" | "skip_unchanged" | "skip_empty";
|
|
571
|
+
interface HookSessionInput {
|
|
572
|
+
projectPath: string;
|
|
573
|
+
sessionId: string;
|
|
574
|
+
client?: string;
|
|
575
|
+
format?: "claude-json" | "json" | "text";
|
|
576
|
+
budget?: number;
|
|
577
|
+
}
|
|
578
|
+
interface HookDecision {
|
|
579
|
+
kind: HookDecisionKind;
|
|
580
|
+
projectId: string;
|
|
581
|
+
sessionId: string;
|
|
582
|
+
client: string;
|
|
583
|
+
hash: string;
|
|
584
|
+
content: string;
|
|
585
|
+
reason: string;
|
|
586
|
+
forced: boolean;
|
|
587
|
+
}
|
|
588
|
+
interface ClaudeHookOutput {
|
|
589
|
+
hookSpecificOutput: {
|
|
590
|
+
hookEventName: "SessionStart";
|
|
591
|
+
additionalContext?: string;
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
declare class HookService {
|
|
595
|
+
private substrate;
|
|
596
|
+
private tierManager;
|
|
597
|
+
private memoryStore;
|
|
598
|
+
constructor(substrate: SqliteSubstrate, tierManager: TierManager, memoryStore: MemoryStore);
|
|
599
|
+
decideSessionStart(input: HookSessionInput): HookDecision;
|
|
600
|
+
preCompact(input: HookSessionInput): {
|
|
601
|
+
projectId: string;
|
|
602
|
+
sessionId: string;
|
|
603
|
+
client: string;
|
|
604
|
+
flagged: true;
|
|
605
|
+
};
|
|
606
|
+
postCompact(input: HookSessionInput & {
|
|
607
|
+
summary?: string;
|
|
608
|
+
summaryFile?: string;
|
|
609
|
+
}): Promise<{
|
|
610
|
+
projectId: string;
|
|
611
|
+
sessionId: string;
|
|
612
|
+
client: string;
|
|
613
|
+
stored: boolean;
|
|
614
|
+
}>;
|
|
615
|
+
status(input: HookSessionInput): {
|
|
616
|
+
projectId: string;
|
|
617
|
+
sessionId: string;
|
|
618
|
+
client: string;
|
|
619
|
+
lastHash: string | null;
|
|
620
|
+
reinjectPending: boolean;
|
|
621
|
+
acceptedFindings: number;
|
|
622
|
+
};
|
|
623
|
+
formatDecision(decision: HookDecision, format?: "claude-json" | "json" | "text"): string;
|
|
624
|
+
private memoryBlock;
|
|
625
|
+
private acceptedFindings;
|
|
626
|
+
private lastHash;
|
|
627
|
+
private recordInjection;
|
|
628
|
+
private hasReinjectFlag;
|
|
629
|
+
private consumeReinjectFlag;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare const VERSION = "0.1.0";
|
|
633
|
+
|
|
634
|
+
export { AgentCurator, type ClaudeHookOutput, CodeGraph, type CodeSymbol, type CostEstimate, type CurationAction, type CuratorProvider, type DiscoveryCoverage, DiscoveryEngine, type DiscoveryFinding, type DiscoveryFindingInput, type DiscoveryFindingStatus, type DiscoveryFindingType, DiscoveryPolicy, type DiscoveryPolicyDecision, type DiscoverySession, EncryptedSyncLog, type EncryptedSyncRecord, type Entity, type Episode, type EvidenceRef, type ExistingProjectIndex, Fts5Index, type GitHubReference, type HookDecision, type HookDecisionKind, HookService, type HookSessionInput, type HydratedSearchResult, IndexManager, MODEL_COST_PROFILES, MemoryGraph, MemoryStore, type ProjectIdentity, type ProjectIndexApplyOptions, type ProjectIndexPlan, type ProjectIndexResult, ProjectIndexer, type Provenance, type Relation, type RememberInput, RirScorer, type SearchResult, SearchRouter, SecurityScanner, SemanticCurator, SessionGate, SqliteSubstrate, type StructuredMemory, type SyncOperation, TelemetryService, type TelemetryStats, TelemetryStatsSchema, TierManager, type ToolDef, VERSION, VizServer, githubEvidence, makeTools, registerDiscoveryPrompts, startMcpServer };
|