@membank/core 0.9.4 → 0.11.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.cjs +60 -820
- package/dist/index.d.cts +345 -58
- package/dist/index.d.mts +345 -58
- package/dist/index.mjs +60 -764
- package/package.json +4 -2
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
import BetterSqlite3 from "better-sqlite3";
|
|
2
1
|
import { z } from "zod";
|
|
2
|
+
import BetterSqlite3 from "better-sqlite3";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
3
4
|
|
|
4
5
|
//#region src/config/loader.d.ts
|
|
5
6
|
declare function isSynthesisEnabled(): boolean;
|
|
6
7
|
//#endregion
|
|
7
|
-
//#region src/db/errors.d.ts
|
|
8
|
-
declare class MembankError extends Error {
|
|
9
|
-
constructor(message: string, options?: ErrorOptions);
|
|
10
|
-
}
|
|
11
|
-
declare class DatabaseError extends MembankError {
|
|
12
|
-
constructor(message: string, options?: ErrorOptions);
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/db/manager.d.ts
|
|
16
|
-
type VecLoader = (db: BetterSqlite3.Database) => void;
|
|
17
|
-
declare class DatabaseManager {
|
|
18
|
-
#private;
|
|
19
|
-
private constructor();
|
|
20
|
-
static open(dbPath?: string): DatabaseManager;
|
|
21
|
-
static openInMemory(): DatabaseManager;
|
|
22
|
-
/** For testing: inject a custom vec loader (e.g. a throwing stub). */
|
|
23
|
-
static _openInMemoryWithLoader(loader: VecLoader): DatabaseManager;
|
|
24
|
-
get db(): BetterSqlite3.Database;
|
|
25
|
-
close(): void;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
8
|
//#region src/schemas.d.ts
|
|
29
9
|
declare const MEMORY_TYPE_VALUES: readonly ["correction", "preference", "decision", "learning", "fact"];
|
|
30
10
|
declare const MemoryTypeSchema: z.ZodEnum<{
|
|
@@ -270,16 +250,133 @@ declare const ProjectRowSchema: z.ZodObject<{
|
|
|
270
250
|
}, z.core.$strip>;
|
|
271
251
|
type ProjectRow = z.infer<typeof ProjectRowSchema>;
|
|
272
252
|
//#endregion
|
|
273
|
-
//#region src/
|
|
253
|
+
//#region src/persistence/infrastructure/row-types.d.ts
|
|
274
254
|
declare function rowToMemory(row: MemoryRow, projects: Project[], reviewEvents?: ReviewEvent[]): Memory;
|
|
275
255
|
declare function rowToProject(row: ProjectRow): Project;
|
|
276
256
|
//#endregion
|
|
277
|
-
//#region src/
|
|
257
|
+
//#region src/db/errors.d.ts
|
|
258
|
+
declare class MembankError extends Error {
|
|
259
|
+
constructor(message: string, options?: ErrorOptions);
|
|
260
|
+
}
|
|
261
|
+
declare class DatabaseError extends MembankError {
|
|
262
|
+
constructor(message: string, options?: ErrorOptions);
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/db/manager.d.ts
|
|
266
|
+
type VecLoader = (db: BetterSqlite3.Database) => void;
|
|
267
|
+
declare class DatabaseManager {
|
|
268
|
+
#private;
|
|
269
|
+
private constructor();
|
|
270
|
+
static open(dbPath?: string): DatabaseManager;
|
|
271
|
+
static openInMemory(): DatabaseManager;
|
|
272
|
+
/** For testing: inject a custom vec loader (e.g. a throwing stub). */
|
|
273
|
+
static _openInMemoryWithLoader(loader: VecLoader): DatabaseManager;
|
|
274
|
+
get db(): BetterSqlite3.Database;
|
|
275
|
+
close(): void;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/embedding/infrastructure/model-downloader.d.ts
|
|
279
|
+
declare const MODEL_NAME = "Xenova/bge-small-en-v1.5";
|
|
280
|
+
interface DownloadProgress {
|
|
281
|
+
totalBytes: number;
|
|
282
|
+
downloadedBytes: number;
|
|
283
|
+
percentage: number;
|
|
284
|
+
estimatedSecondsRemaining: number;
|
|
285
|
+
}
|
|
286
|
+
interface DownloadResult {
|
|
287
|
+
skipped: boolean;
|
|
288
|
+
}
|
|
289
|
+
declare class ModelDownloadError extends Error {
|
|
290
|
+
constructor(message: string, options?: ErrorOptions);
|
|
291
|
+
}
|
|
292
|
+
declare class ModelDownloader extends EventEmitter {
|
|
293
|
+
private readonly modelPath;
|
|
294
|
+
constructor(modelPath?: string);
|
|
295
|
+
isAlreadyCached(): boolean;
|
|
296
|
+
get cachePath(): string;
|
|
297
|
+
download(): Promise<DownloadResult>;
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/memory/ports.d.ts
|
|
301
|
+
interface SimilarMemoryResult {
|
|
302
|
+
id: string;
|
|
303
|
+
similarity: number;
|
|
304
|
+
}
|
|
305
|
+
interface StatsResult {
|
|
306
|
+
byType: Record<MemoryType, number>;
|
|
307
|
+
total: number;
|
|
308
|
+
pinned: number;
|
|
309
|
+
needsReview: number;
|
|
310
|
+
pinBudgetChars: number;
|
|
311
|
+
}
|
|
312
|
+
interface MemoryExportRecord {
|
|
313
|
+
id: string;
|
|
314
|
+
content: string;
|
|
315
|
+
type: MemoryType;
|
|
316
|
+
tags: string[];
|
|
317
|
+
sourceHarness: string | null;
|
|
318
|
+
accessCount: number;
|
|
319
|
+
pinned: boolean;
|
|
320
|
+
createdAt: string;
|
|
321
|
+
updatedAt: string;
|
|
322
|
+
embedding: Float32Array | null;
|
|
323
|
+
}
|
|
324
|
+
interface CreateMemoryOpts {
|
|
325
|
+
id: string;
|
|
326
|
+
content: string;
|
|
327
|
+
type: MemoryType;
|
|
328
|
+
tags: string[];
|
|
329
|
+
sourceHarness: string | null;
|
|
330
|
+
embedding: Float32Array;
|
|
331
|
+
projectScope?: {
|
|
332
|
+
hash: string;
|
|
333
|
+
name: string;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
interface CreateReviewEventOpts {
|
|
337
|
+
memoryId: string;
|
|
338
|
+
conflictingMemoryId: string;
|
|
339
|
+
similarity: number;
|
|
340
|
+
conflictContentSnapshot: string;
|
|
341
|
+
}
|
|
342
|
+
interface MemoryRepository {
|
|
343
|
+
findById(id: string): Memory | undefined;
|
|
344
|
+
findSimilar(embedding: Float32Array, type: MemoryType, projectHash?: string): SimilarMemoryResult[];
|
|
345
|
+
list(opts?: {
|
|
346
|
+
type?: MemoryType;
|
|
347
|
+
pinned?: boolean;
|
|
348
|
+
needsReview?: boolean;
|
|
349
|
+
projectId?: string;
|
|
350
|
+
}): Memory[];
|
|
351
|
+
listPinnedGlobal(): Memory[];
|
|
352
|
+
listPinnedForProject(projectHash: string): Memory[];
|
|
353
|
+
listFlagged(): Memory[];
|
|
354
|
+
listReviewEvents(memoryId: string, opts?: {
|
|
355
|
+
unresolvedOnly?: boolean;
|
|
356
|
+
}): ReviewEvent[];
|
|
357
|
+
getPinnedCharCount(): number;
|
|
358
|
+
stats(): StatsResult;
|
|
359
|
+
create(opts: CreateMemoryOpts): Memory;
|
|
360
|
+
overwrite(id: string, content: string, embedding: Float32Array): Memory;
|
|
361
|
+
update(id: string, patch: MemoryPatch, embedding?: Float32Array): Memory;
|
|
362
|
+
delete(id: string): void;
|
|
363
|
+
createReviewEvent(opts: CreateReviewEventOpts): void;
|
|
364
|
+
resolveReviewEvents(memoryId: string): void;
|
|
365
|
+
setPin(id: string, pinned: boolean): Memory;
|
|
366
|
+
incrementAccessCount(id: string): void;
|
|
367
|
+
exportAll(): MemoryExportRecord[];
|
|
368
|
+
importAll(records: MemoryExportRecord[]): void;
|
|
369
|
+
}
|
|
370
|
+
interface Embedder {
|
|
371
|
+
embed(text: string): Promise<Float32Array>;
|
|
372
|
+
}
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/embedding/infrastructure/huggingface-embedding-service.d.ts
|
|
278
375
|
type ProgressCallback = (progress: {
|
|
279
376
|
status: string;
|
|
280
377
|
progress?: number;
|
|
281
378
|
}) => void;
|
|
282
|
-
declare class EmbeddingService {
|
|
379
|
+
declare class EmbeddingService implements Embedder {
|
|
283
380
|
private readonly modelCachePath;
|
|
284
381
|
private readonly onProgress;
|
|
285
382
|
private pipelineInstance;
|
|
@@ -288,10 +385,120 @@ declare class EmbeddingService {
|
|
|
288
385
|
embed(text: string): Promise<Float32Array>;
|
|
289
386
|
}
|
|
290
387
|
//#endregion
|
|
291
|
-
//#region src/
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
388
|
+
//#region src/extraction/ports.d.ts
|
|
389
|
+
interface ExtractionConfig {
|
|
390
|
+
/** Window after a run starts during which a duplicate run for the same session_id is skipped. */
|
|
391
|
+
inFlightTimeoutMs?: number;
|
|
392
|
+
/** Window after a successful run during which a repeated run for the same session_id is skipped. */
|
|
393
|
+
recentCompletionMs?: number;
|
|
394
|
+
}
|
|
395
|
+
interface ExtractionRunRecord {
|
|
396
|
+
sessionId: string;
|
|
397
|
+
startedAt: string;
|
|
398
|
+
completedAt: string | null;
|
|
399
|
+
status: "in_flight" | "completed" | "failed";
|
|
400
|
+
error: string | null;
|
|
401
|
+
}
|
|
402
|
+
interface ExtractionRunRepository {
|
|
403
|
+
/** Atomic claim: returns true if the caller should proceed, false if already in flight or recently completed. */
|
|
404
|
+
tryClaim(sessionId: string, now: Date, config: ExtractionConfig): boolean;
|
|
405
|
+
markCompleted(sessionId: string, now: Date): void;
|
|
406
|
+
markFailed(sessionId: string, now: Date, error: string): void;
|
|
407
|
+
get(sessionId: string): ExtractionRunRecord | undefined;
|
|
408
|
+
}
|
|
409
|
+
interface TranscriptReader {
|
|
410
|
+
/** Returns the recent transcript content (plain text) for the agent to inspect. */
|
|
411
|
+
read(transcriptPath: string): Promise<string>;
|
|
412
|
+
}
|
|
413
|
+
interface ExtractionAgentRunner {
|
|
414
|
+
/** Runs the extraction agent over the supplied transcript text and project hash. */
|
|
415
|
+
run(args: {
|
|
416
|
+
transcript: string;
|
|
417
|
+
projectHash: string;
|
|
418
|
+
sessionId: string;
|
|
419
|
+
}): Promise<void>;
|
|
420
|
+
}
|
|
421
|
+
interface ExtractionTools {
|
|
422
|
+
queryMemory: (args: {
|
|
423
|
+
query: string;
|
|
424
|
+
limit?: number;
|
|
425
|
+
global?: boolean;
|
|
426
|
+
projectHash?: string;
|
|
427
|
+
}) => Promise<string>;
|
|
428
|
+
saveMemory: (args: {
|
|
429
|
+
content: string;
|
|
430
|
+
type: string;
|
|
431
|
+
tags?: string[];
|
|
432
|
+
global?: boolean;
|
|
433
|
+
}) => Promise<string>;
|
|
434
|
+
updateMemory: (args: {
|
|
435
|
+
id: string;
|
|
436
|
+
content?: string;
|
|
437
|
+
type?: string;
|
|
438
|
+
tags?: string[];
|
|
439
|
+
}) => Promise<string>;
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/extraction/application/run-extraction.d.ts
|
|
443
|
+
interface RunExtractionInput {
|
|
444
|
+
sessionId: string;
|
|
445
|
+
transcriptPath: string;
|
|
446
|
+
projectHash: string;
|
|
447
|
+
}
|
|
448
|
+
type RunExtractionResult = {
|
|
449
|
+
status: "completed";
|
|
450
|
+
} | {
|
|
451
|
+
status: "skipped";
|
|
452
|
+
reason: "in_flight" | "recently_completed";
|
|
453
|
+
} | {
|
|
454
|
+
status: "failed";
|
|
455
|
+
error: string;
|
|
456
|
+
};
|
|
457
|
+
declare function runExtraction(input: RunExtractionInput, deps: {
|
|
458
|
+
repo: ExtractionRunRepository;
|
|
459
|
+
transcripts: TranscriptReader;
|
|
460
|
+
agent: ExtractionAgentRunner;
|
|
461
|
+
config: ExtractionConfig;
|
|
462
|
+
now?: () => Date;
|
|
463
|
+
}): Promise<RunExtractionResult>;
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/extraction/infrastructure/claude-agent-runner.d.ts
|
|
466
|
+
declare function createExtractionAgentRunner(tools: ExtractionTools): ExtractionAgentRunner;
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/extraction/infrastructure/sqlite-extraction-run-repository.d.ts
|
|
469
|
+
declare function createExtractionRunRepository(db: DatabaseManager): ExtractionRunRepository;
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region src/extraction/infrastructure/transcript-reader.d.ts
|
|
472
|
+
interface TranscriptReaderOptions {
|
|
473
|
+
maxTurns?: number;
|
|
474
|
+
maxChars?: number;
|
|
475
|
+
}
|
|
476
|
+
declare function createClaudeCodeTranscriptReader(opts?: TranscriptReaderOptions): TranscriptReader;
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/memory/application/delete-memory.d.ts
|
|
479
|
+
declare function deleteMemory(id: string, repo: MemoryRepository): Promise<void>;
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/memory/application/resolve-review.d.ts
|
|
482
|
+
declare function resolveReview(memoryId: string, repo: MemoryRepository): void;
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/memory/application/save-memory.d.ts
|
|
485
|
+
declare function saveMemory(opts: SaveOptions, deps: {
|
|
486
|
+
repo: MemoryRepository;
|
|
487
|
+
embedder: Embedder;
|
|
488
|
+
}): Promise<Memory>;
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/memory/application/update-memory.d.ts
|
|
491
|
+
declare function updateMemory(id: string, patch: MemoryPatch, deps: {
|
|
492
|
+
repo: MemoryRepository;
|
|
493
|
+
embedder: Embedder;
|
|
494
|
+
}): Promise<Memory>;
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/memory/domain/pin-budget.d.ts
|
|
497
|
+
declare const PIN_BUDGET_THRESHOLD = 8000;
|
|
498
|
+
declare function isOverBudget(pinnedCharCount: number): boolean;
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/project/ports.d.ts
|
|
501
|
+
interface ProjectRepository {
|
|
295
502
|
upsertByHash(hash: string, name: string): Project;
|
|
296
503
|
rename(id: string, name: string): Project;
|
|
297
504
|
list(): Project[];
|
|
@@ -303,34 +510,41 @@ declare class ProjectRepository {
|
|
|
303
510
|
getProjectsForMemories(memoryIds: string[]): Map<string, Project[]>;
|
|
304
511
|
}
|
|
305
512
|
//#endregion
|
|
306
|
-
//#region src/memory/repository.d.ts
|
|
307
|
-
declare
|
|
308
|
-
declare class MemoryRepository {
|
|
513
|
+
//#region src/memory/infrastructure/sqlite-memory-repository.d.ts
|
|
514
|
+
declare class SqliteMemoryRepository implements MemoryRepository {
|
|
309
515
|
#private;
|
|
310
|
-
constructor(db: DatabaseManager,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
516
|
+
constructor(db: DatabaseManager, projects: ProjectRepository);
|
|
517
|
+
findSimilar(embedding: Float32Array, type: MemoryType, projectHash?: string): SimilarMemoryResult[];
|
|
518
|
+
create(opts: CreateMemoryOpts): Memory;
|
|
519
|
+
overwrite(id: string, content: string, embedding: Float32Array): Memory;
|
|
520
|
+
findById(id: string): Memory | undefined;
|
|
521
|
+
update(id: string, patch: MemoryPatch, embedding?: Float32Array): Memory;
|
|
522
|
+
delete(id: string): void;
|
|
314
523
|
list(opts?: {
|
|
315
524
|
type?: MemoryType;
|
|
316
525
|
pinned?: boolean;
|
|
526
|
+
needsReview?: boolean;
|
|
527
|
+
projectId?: string;
|
|
317
528
|
}): Memory[];
|
|
529
|
+
listPinnedGlobal(): Memory[];
|
|
530
|
+
listPinnedForProject(projectHash: string): Memory[];
|
|
318
531
|
listFlagged(): Memory[];
|
|
319
532
|
listReviewEvents(memoryId: string, opts?: {
|
|
320
533
|
unresolvedOnly?: boolean;
|
|
321
534
|
}): ReviewEvent[];
|
|
535
|
+
createReviewEvent(opts: CreateReviewEventOpts): void;
|
|
322
536
|
resolveReviewEvents(memoryId: string): void;
|
|
323
537
|
getPinnedCharCount(): number;
|
|
324
|
-
stats():
|
|
325
|
-
byType: Record<MemoryType, number>;
|
|
326
|
-
total: number;
|
|
327
|
-
pinned: number;
|
|
328
|
-
needsReview: number;
|
|
329
|
-
pinBudgetChars: number;
|
|
330
|
-
};
|
|
538
|
+
stats(): StatsResult;
|
|
331
539
|
setPin(id: string, pinned: boolean): Memory;
|
|
332
540
|
incrementAccessCount(id: string): void;
|
|
541
|
+
exportAll(): MemoryExportRecord[];
|
|
542
|
+
importAll(records: MemoryExportRecord[]): void;
|
|
333
543
|
}
|
|
544
|
+
declare function createMemoryRepository(db: DatabaseManager, projects: ProjectRepository): MemoryRepository;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/project/infrastructure/sqlite-project-repository.d.ts
|
|
547
|
+
declare function createProjectRepository(db: DatabaseManager): ProjectRepository;
|
|
334
548
|
//#endregion
|
|
335
549
|
//#region src/migrations/index.d.ts
|
|
336
550
|
interface MigrationMeta {
|
|
@@ -346,13 +560,35 @@ interface ScopeToProjectsResult {
|
|
|
346
560
|
declare const MIGRATIONS: MigrationMeta[];
|
|
347
561
|
declare function runScopeToProjectsMigration(projects: ProjectRepository): Promise<ScopeToProjectsResult | null>;
|
|
348
562
|
//#endregion
|
|
563
|
+
//#region src/query/ports.d.ts
|
|
564
|
+
interface ScoredMemory extends Memory {
|
|
565
|
+
score: number;
|
|
566
|
+
}
|
|
567
|
+
interface QueryAdapter {
|
|
568
|
+
findByEmbedding(embedding: Buffer, opts: {
|
|
569
|
+
type?: MemoryType;
|
|
570
|
+
projectHash?: string;
|
|
571
|
+
includePinned?: boolean;
|
|
572
|
+
}): Array<Memory & {
|
|
573
|
+
cosineSim: number;
|
|
574
|
+
}>;
|
|
575
|
+
}
|
|
576
|
+
interface Querier {
|
|
577
|
+
query(opts: QueryOptions): Promise<ScoredMemory[]>;
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/query/application/query-memories.d.ts
|
|
581
|
+
declare function queryMemories(options: QueryOptions, deps: {
|
|
582
|
+
adapter: QueryAdapter;
|
|
583
|
+
repo: Pick<MemoryRepository, "incrementAccessCount">;
|
|
584
|
+
embedder: Embedder;
|
|
585
|
+
}): Promise<ScoredMemory[]>;
|
|
586
|
+
//#endregion
|
|
349
587
|
//#region src/query/engine.d.ts
|
|
350
|
-
declare class QueryEngine {
|
|
588
|
+
declare class QueryEngine implements Querier {
|
|
351
589
|
#private;
|
|
352
|
-
constructor(db: DatabaseManager, embeddingService:
|
|
353
|
-
query(options: QueryOptions): Promise<
|
|
354
|
-
score: number;
|
|
355
|
-
}>>;
|
|
590
|
+
constructor(db: DatabaseManager, embeddingService: Embedder, repo: MemoryRepository);
|
|
591
|
+
query(options: QueryOptions): Promise<ScoredMemory[]>;
|
|
356
592
|
}
|
|
357
593
|
//#endregion
|
|
358
594
|
//#region src/scope/resolver.d.ts
|
|
@@ -362,31 +598,82 @@ declare function resolveProject(): Promise<{
|
|
|
362
598
|
}>;
|
|
363
599
|
declare function resolveScope(): Promise<string>;
|
|
364
600
|
//#endregion
|
|
601
|
+
//#region src/session/application/get-session-context.d.ts
|
|
602
|
+
declare function getSessionContext(opts: {
|
|
603
|
+
projectHash: string;
|
|
604
|
+
synthesis?: string;
|
|
605
|
+
}, deps: {
|
|
606
|
+
repo: MemoryRepository;
|
|
607
|
+
}): SessionContext;
|
|
608
|
+
//#endregion
|
|
365
609
|
//#region src/session/builder.d.ts
|
|
366
610
|
declare function listMemoryTypes(): MemoryType[];
|
|
367
611
|
declare class SessionContextBuilder {
|
|
368
612
|
#private;
|
|
369
|
-
constructor(
|
|
613
|
+
constructor(repo: MemoryRepository);
|
|
370
614
|
getSessionContext(projectHash: string, synthesis?: string): SessionContext;
|
|
371
615
|
}
|
|
372
616
|
//#endregion
|
|
373
|
-
//#region src/synthesis/
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
617
|
+
//#region src/synthesis/domain/synthesis-job.d.ts
|
|
618
|
+
type ScopeStatus = "expired" | "dirty" | "missing";
|
|
619
|
+
interface DirtyScope {
|
|
620
|
+
scope: string;
|
|
621
|
+
reason: ScopeStatus;
|
|
622
|
+
}
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/synthesis/ports.d.ts
|
|
625
|
+
interface SynthesisConfig {
|
|
626
|
+
enabled: boolean;
|
|
627
|
+
maxTokensPerRun?: number;
|
|
628
|
+
debounceMs?: number;
|
|
629
|
+
stalenessDays?: number;
|
|
630
|
+
inFlightTimeoutMs?: number;
|
|
631
|
+
}
|
|
632
|
+
interface SynthesisTools {
|
|
633
|
+
queryMemory: (args: {
|
|
634
|
+
query: string;
|
|
635
|
+
limit?: number;
|
|
636
|
+
global?: boolean;
|
|
637
|
+
projectHash?: string;
|
|
638
|
+
}) => Promise<string>;
|
|
639
|
+
getMemorySummary: () => Promise<string>;
|
|
640
|
+
}
|
|
641
|
+
interface AgentRunner {
|
|
642
|
+
run(scope: string, projectHash?: string): Promise<string>;
|
|
643
|
+
}
|
|
644
|
+
interface SynthesisRepository {
|
|
377
645
|
saveSynthesis(scope: string, content: string, sourceHash: string): Synthesis;
|
|
378
646
|
getSynthesis(scope: string): Synthesis | undefined;
|
|
647
|
+
listAll(): Synthesis[];
|
|
379
648
|
markInFlight(scope: string): void;
|
|
380
649
|
clearInFlight(scope: string): void;
|
|
381
650
|
clearStaleInFlight(thresholdMs: number): void;
|
|
382
651
|
computeSourceMemoryHash(scope: string): string;
|
|
383
|
-
getExpiredOrDirtyScopes():
|
|
384
|
-
scope: string;
|
|
385
|
-
reason: "expired" | "dirty" | "missing";
|
|
386
|
-
}[];
|
|
652
|
+
getExpiredOrDirtyScopes(): DirtyScope[];
|
|
387
653
|
getAllActiveScopes(): string[];
|
|
388
654
|
expireStale(): void;
|
|
389
655
|
}
|
|
390
656
|
//#endregion
|
|
391
|
-
|
|
657
|
+
//#region src/synthesis/application/engine.d.ts
|
|
658
|
+
declare class SynthesisEngine {
|
|
659
|
+
#private;
|
|
660
|
+
constructor(synthRepo: SynthesisRepository, config: SynthesisConfig, agentRunner: AgentRunner);
|
|
661
|
+
init(): Promise<void>;
|
|
662
|
+
shutdown(): Promise<void>;
|
|
663
|
+
markDirty(scope: string): void;
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/synthesis/application/run-synthesis.d.ts
|
|
667
|
+
declare function runSynthesis(scope: string, deps: {
|
|
668
|
+
synthRepo: SynthesisRepository;
|
|
669
|
+
agentRunner: AgentRunner;
|
|
670
|
+
}): Promise<string>;
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region src/synthesis/infrastructure/claude-agent-runner.d.ts
|
|
673
|
+
declare function createSynthesisAgentRunner(tools: SynthesisTools, config: SynthesisConfig): AgentRunner;
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region src/synthesis/infrastructure/sqlite-synthesis-repository.d.ts
|
|
676
|
+
declare function createSynthesisRepository(db: DatabaseManager): SynthesisRepository;
|
|
677
|
+
//#endregion
|
|
678
|
+
export { type AgentRunner, type CreateMemoryOpts, type CreateReviewEventOpts, DatabaseError, DatabaseManager, type DownloadProgress, type DownloadResult, type Embedder, EmbeddingService, type ExtractionAgentRunner, type ExtractionConfig, type ExtractionRunRecord, type ExtractionRunRepository, type ExtractionTools, MEMORY_TYPE_VALUES, MIGRATIONS, MODEL_NAME, MembankError, type Memory, type MemoryExportRecord, type MemoryPatch, MemoryPatchSchema, type MemoryRepository, type MemoryRow, MemoryRowSchema, MemorySchema, type MemoryType, MemoryTypeSchema, MigrationMeta, ModelDownloadError, ModelDownloader, PIN_BUDGET_THRESHOLD, type ProgressCallback, Project, type ProjectRepository, ProjectRow, ProjectRowSchema, ProjectSchema, type Querier, type QueryAdapter, QueryEngine, QueryOptions, QueryOptionsSchema, type ReviewEvent, type ReviewEventRow, ReviewEventRowSchema, ReviewEventSchema, ReviewReason, ReviewReasonSchema, type RunExtractionInput, type RunExtractionResult, type SaveOptions, SaveOptionsSchema, ScopeToProjectsResult, type ScoredMemory, SessionContext, SessionContextBuilder, SessionContextSchema, type SimilarMemoryResult, SqliteMemoryRepository, type StatsResult, Synthesis, type SynthesisConfig, SynthesisEngine, type SynthesisRepository, SynthesisSchema, type SynthesisTools, TagsJsonSchema, type TranscriptReader, createClaudeCodeTranscriptReader, createExtractionAgentRunner, createExtractionRunRepository, createMemoryRepository, createProjectRepository, createSynthesisAgentRunner, createSynthesisRepository, deleteMemory, getSessionContext, isOverBudget, isSynthesisEnabled, listMemoryTypes, queryMemories, resolveProject, resolveReview, resolveScope, rowToMemory, rowToProject, runExtraction, runScopeToProjectsMigration, runSynthesis, saveMemory, updateMemory };
|
|
392
679
|
//# sourceMappingURL=index.d.mts.map
|