clementine-agent 1.18.20 → 1.18.21

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.
Files changed (37) hide show
  1. package/README.md +17 -0
  2. package/dist/agent/action-enforcer.d.ts +29 -0
  3. package/dist/agent/action-enforcer.js +120 -0
  4. package/dist/agent/assistant.d.ts +12 -0
  5. package/dist/agent/assistant.js +165 -31
  6. package/dist/agent/auto-update.js +46 -2
  7. package/dist/agent/local-turn.d.ts +16 -0
  8. package/dist/agent/local-turn.js +54 -1
  9. package/dist/agent/route-classifier.d.ts +1 -0
  10. package/dist/agent/route-classifier.js +30 -3
  11. package/dist/agent/toolsets.d.ts +14 -0
  12. package/dist/agent/toolsets.js +68 -0
  13. package/dist/brain/ingestion-pipeline.d.ts +7 -0
  14. package/dist/brain/ingestion-pipeline.js +107 -21
  15. package/dist/channels/discord.js +38 -7
  16. package/dist/channels/telegram.js +5 -6
  17. package/dist/cli/dashboard.js +56 -6
  18. package/dist/cli/index.js +174 -0
  19. package/dist/cli/ingest.js +8 -2
  20. package/dist/gateway/context-hygiene.d.ts +17 -0
  21. package/dist/gateway/context-hygiene.js +31 -0
  22. package/dist/gateway/heartbeat-scheduler.d.ts +20 -0
  23. package/dist/gateway/heartbeat-scheduler.js +27 -10
  24. package/dist/gateway/router.d.ts +7 -0
  25. package/dist/gateway/router.js +303 -9
  26. package/dist/gateway/turn-ledger.d.ts +32 -0
  27. package/dist/gateway/turn-ledger.js +55 -0
  28. package/dist/memory/embeddings.d.ts +2 -0
  29. package/dist/memory/embeddings.js +8 -1
  30. package/dist/memory/store.d.ts +88 -1
  31. package/dist/memory/store.js +349 -18
  32. package/dist/memory/write-queue.d.ts +16 -0
  33. package/dist/memory/write-queue.js +5 -0
  34. package/dist/tools/shared.d.ts +89 -0
  35. package/dist/types.d.ts +11 -0
  36. package/package.json +1 -1
  37. package/scripts/postinstall.js +56 -6
@@ -9,7 +9,7 @@
9
9
  * Concurrency: WAL mode allows concurrent readers. Writes are serialized
10
10
  * (single-user, one MCP subprocess handles all writes).
11
11
  */
12
- import type { Feedback, MemoryExtraction, SearchResult, SessionSummary, SyncStats, TranscriptTurn, WikilinkConnection } from '../types.js';
12
+ import type { Feedback, MemoryExtraction, SearchResult, SessionLineageEntry, SessionSummary, SyncStats, TranscriptTurn, WikilinkConnection } from '../types.js';
13
13
  import { HotCache } from './hot-cache.js';
14
14
  import { type WriteQueueOpts } from './write-queue.js';
15
15
  export type MemoryPromotionDecision = 'pending' | 'promoted' | 'rejected' | 'superseded';
@@ -54,6 +54,19 @@ export interface SearchContextOptions {
54
54
  /** Set false to keep retrieval on FTS/sparse/recency only even when dense is warm. */
55
55
  useDense?: boolean;
56
56
  }
57
+ export type RecallBackendCounts = {
58
+ fts: number;
59
+ vector: number;
60
+ graph: number;
61
+ recency: number;
62
+ };
63
+ export interface RecallEvidence {
64
+ chunkId: number;
65
+ matchType: string;
66
+ score: number;
67
+ sourceFile?: string;
68
+ section?: string;
69
+ }
57
70
  export declare class MemoryStore {
58
71
  private dbPath;
59
72
  private vaultDir;
@@ -65,6 +78,8 @@ export declare class MemoryStore {
65
78
  private writeQueue;
66
79
  constructor(dbPath: string, vaultDir: string);
67
80
  private static confidenceMultiplier;
81
+ private static formatBytes;
82
+ private static dirSizeBytes;
68
83
  /**
69
84
  * Create the database and schema if needed.
70
85
  */
@@ -311,6 +326,11 @@ export declare class MemoryStore {
311
326
  scores: number[];
312
327
  agentSlug?: string | null;
313
328
  matchTypes?: string[];
329
+ backendCounts?: RecallBackendCounts | null;
330
+ evidence?: RecallEvidence[];
331
+ confidence?: number | null;
332
+ emptyReason?: string | null;
333
+ allowEmpty?: boolean;
314
334
  }): void;
315
335
  /** Internal sync recall_trace insert. Called by the WriteQueue. */
316
336
  _logRecallTraceSync(opts: {
@@ -321,6 +341,11 @@ export declare class MemoryStore {
321
341
  scores: number[];
322
342
  agentSlug?: string | null;
323
343
  matchTypes?: string[];
344
+ backendCounts?: RecallBackendCounts | null;
345
+ evidence?: RecallEvidence[];
346
+ confidence?: number | null;
347
+ emptyReason?: string | null;
348
+ allowEmpty?: boolean;
324
349
  }): void;
325
350
  /**
326
351
  * Fetch recent recall traces for a session, newest first.
@@ -332,6 +357,10 @@ export declare class MemoryStore {
332
357
  query: string;
333
358
  chunkIds: number[];
334
359
  scores: number[];
360
+ backendCounts: RecallBackendCounts | null;
361
+ evidence: RecallEvidence[];
362
+ confidence: number | null;
363
+ emptyReason: string | null;
335
364
  retrievedAt: string;
336
365
  }>;
337
366
  /**
@@ -344,6 +373,10 @@ export declare class MemoryStore {
344
373
  messageId: string | null;
345
374
  query: string;
346
375
  retrievedAt: string;
376
+ backendCounts: RecallBackendCounts | null;
377
+ evidence: RecallEvidence[];
378
+ confidence: number | null;
379
+ emptyReason: string | null;
347
380
  chunks: Array<{
348
381
  id: number;
349
382
  sourceFile: string;
@@ -393,6 +426,7 @@ export declare class MemoryStore {
393
426
  /** Drop the whole cache — fullSync and similar bulk operations call this. */
394
427
  clearChunkCache(): void;
395
428
  private _parseJsonArray;
429
+ private _parseJsonObject;
396
430
  /** The fixed slot vocabulary. Adding new slots is a code change so the
397
431
  * agent doesn't sprawl into ad-hoc namespaces. */
398
432
  static readonly USER_MODEL_SLOTS: readonly ["user_facts", "goals", "relationships", "agent_persona"];
@@ -537,6 +571,19 @@ export declare class MemoryStore {
537
571
  * Get the most recent session summaries.
538
572
  */
539
573
  getRecentSummaries(limit?: number): SessionSummary[];
574
+ /**
575
+ * Get recent session summaries scoped to one conversation.
576
+ */
577
+ getRecentSummariesForSession(sessionKey: string, limit?: number): SessionSummary[];
578
+ recordSessionLineage(input: {
579
+ sessionKey: string;
580
+ parentSessionId?: string | null;
581
+ childSessionId?: string | null;
582
+ reason: string;
583
+ summary: string;
584
+ exchangeCount?: number;
585
+ }): void;
586
+ getSessionLineage(sessionKey: string, limit?: number): SessionLineageEntry[];
540
587
  /**
541
588
  * Record that chunks were accessed (retrieved/displayed). Routes through
542
589
  * the write queue when enabled.
@@ -619,6 +666,22 @@ export declare class MemoryStore {
619
666
  sessionKey?: string | null;
620
667
  agentSlug?: string | null;
621
668
  }): number;
669
+ recordMemoryEvent(input: {
670
+ sourceType: string;
671
+ sourceId?: number | null;
672
+ sessionKey?: string | null;
673
+ agentSlug?: string | null;
674
+ content: string;
675
+ indexed?: boolean;
676
+ }): void;
677
+ getMemoryEventStats(): {
678
+ total: number;
679
+ indexed: number;
680
+ bySourceType: Array<{
681
+ sourceType: string;
682
+ count: number;
683
+ }>;
684
+ };
622
685
  /**
623
686
  * Search artifacts via FTS over summary + content + tool_name + tags.
624
687
  * Returns metadata only — use getArtifact(id) to pull the full blob.
@@ -697,6 +760,8 @@ export declare class MemoryStore {
697
760
  recordsWritten?: number;
698
761
  recordsSkipped?: number;
699
762
  recordsFailed?: number;
763
+ recordsUnchanged?: number;
764
+ recallCheckStatus?: string | null;
700
765
  overviewNotePath?: string | null;
701
766
  errorsJson?: string | null;
702
767
  status?: 'running' | 'ok' | 'error' | 'partial';
@@ -711,6 +776,8 @@ export declare class MemoryStore {
711
776
  recordsWritten: number;
712
777
  recordsSkipped: number;
713
778
  recordsFailed: number;
779
+ recordsUnchanged: number;
780
+ recallCheckStatus: string | null;
714
781
  overviewNotePath: string | null;
715
782
  errorsJson: string | null;
716
783
  status: string;
@@ -773,6 +840,7 @@ export declare class MemoryStore {
773
840
  transcriptRetentionDays?: number;
774
841
  behavioralRetentionDays?: number;
775
842
  recallTraceRetentionDays?: number;
843
+ memoryEventRetentionDays?: number;
776
844
  }): {
777
845
  episodicPruned: number;
778
846
  accessLogPruned: number;
@@ -782,6 +850,7 @@ export declare class MemoryStore {
782
850
  reflectionsPruned: number;
783
851
  usageLogPruned: number;
784
852
  recallTracesPruned: number;
853
+ memoryEventsPruned: number;
785
854
  };
786
855
  /**
787
856
  * User-model slots whose `updated_at` is older than maxAgeDays. These are
@@ -1330,6 +1399,19 @@ export declare class MemoryStore {
1330
1399
  recallTracesLast30d: number;
1331
1400
  extractionSkipsLast30d: number;
1332
1401
  };
1402
+ retrievalProof: {
1403
+ tracesLast7d: number;
1404
+ emptyTracesLast7d: number;
1405
+ tracedChunksLast7d: number;
1406
+ };
1407
+ memoryEvents: {
1408
+ total: number;
1409
+ indexed: number;
1410
+ bySourceType: Array<{
1411
+ sourceType: string;
1412
+ count: number;
1413
+ }>;
1414
+ };
1333
1415
  topCitedLast30d: Array<{
1334
1416
  chunkId: number;
1335
1417
  sourceFile: string;
@@ -1378,6 +1460,11 @@ export declare class MemoryStore {
1378
1460
  }>;
1379
1461
  currentModel: string;
1380
1462
  ready: boolean;
1463
+ cacheDir: string;
1464
+ cacheExists: boolean;
1465
+ cacheBytes: number;
1466
+ cacheSize: string;
1467
+ installed: boolean;
1381
1468
  };
1382
1469
  };
1383
1470
  /**