@hasna/mementos 0.3.7 → 0.4.1
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/dashboard/dist/assets/index-B1yiOEw3.js +290 -0
- package/dashboard/dist/assets/index-DnpbasSl.css +1 -0
- package/dashboard/dist/index.html +13 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +6985 -0
- package/dist/db/agents.d.ts +12 -0
- package/dist/db/agents.d.ts.map +1 -0
- package/dist/db/database.d.ts +10 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/entities.d.ts +17 -0
- package/dist/db/entities.d.ts.map +1 -0
- package/dist/db/entity-memories.d.ts +34 -0
- package/dist/db/entity-memories.d.ts.map +1 -0
- package/dist/db/memories.d.ts +19 -0
- package/dist/db/memories.d.ts.map +1 -0
- package/dist/db/projects.d.ts +6 -0
- package/dist/db/projects.d.ts.map +1 -0
- package/dist/db/relations.d.ts +29 -0
- package/dist/db/relations.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2427 -0
- package/dist/lib/config.d.ts +5 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/duration.d.ts +28 -0
- package/dist/lib/duration.d.ts.map +1 -0
- package/dist/lib/extractor.d.ts +9 -0
- package/dist/lib/extractor.d.ts.map +1 -0
- package/dist/lib/injector.d.ts +31 -0
- package/dist/lib/injector.d.ts.map +1 -0
- package/dist/lib/poll.d.ts +17 -0
- package/dist/lib/poll.d.ts.map +1 -0
- package/dist/lib/project-detect.d.ts +18 -0
- package/dist/lib/project-detect.d.ts.map +1 -0
- package/dist/lib/redact.d.ts +10 -0
- package/dist/lib/redact.d.ts.map +1 -0
- package/dist/lib/retention.d.ts +14 -0
- package/dist/lib/retention.d.ts.map +1 -0
- package/dist/lib/search.d.ts +22 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/sync.d.ts +10 -0
- package/dist/lib/sync.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6903 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +2616 -0
- package/dist/types/index.d.ts +237 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAM5E,eAAO,MAAM,cAAc,EAAE,cA2B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AAgDD,wBAAgB,SAAS,IAAI,MAAM,CA+BlC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable duration parsing and formatting.
|
|
3
|
+
*
|
|
4
|
+
* Supported formats:
|
|
5
|
+
* Ns — seconds
|
|
6
|
+
* Nm — minutes
|
|
7
|
+
* Nh — hours
|
|
8
|
+
* Nd — days
|
|
9
|
+
* Nw — weeks
|
|
10
|
+
* Combinations: 1d12h, 2h30m
|
|
11
|
+
* Plain numbers: treated as milliseconds (backwards compat)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Parse a human-readable duration string into milliseconds.
|
|
15
|
+
*
|
|
16
|
+
* @param input - Duration string (e.g. "1d12h", "30m", "500") or numeric ms
|
|
17
|
+
* @returns milliseconds
|
|
18
|
+
* @throws Error on invalid format
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseDuration(input: string | number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Format milliseconds into a human-readable duration string.
|
|
23
|
+
*
|
|
24
|
+
* @param ms - Duration in milliseconds
|
|
25
|
+
* @returns Human-readable string (e.g. "1d12h", "30m", "500ms")
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatDuration(ms: number): string;
|
|
28
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/lib/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAiC5D;AAWD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAoBjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { EntityType, Memory } from "../types/index.js";
|
|
3
|
+
export interface ExtractedEntity {
|
|
4
|
+
name: string;
|
|
5
|
+
type: EntityType;
|
|
6
|
+
confidence: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function extractEntities(memory: Memory, db?: Database): ExtractedEntity[];
|
|
9
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/lib/extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAuBD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,eAAe,EAAE,CA0EhF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { MemoryCategory, MementosConfig } from "../types/index.js";
|
|
3
|
+
export interface InjectionOptions {
|
|
4
|
+
agent_id?: string;
|
|
5
|
+
project_id?: string;
|
|
6
|
+
session_id?: string;
|
|
7
|
+
max_tokens?: number;
|
|
8
|
+
categories?: MemoryCategory[];
|
|
9
|
+
min_importance?: number;
|
|
10
|
+
db?: Database;
|
|
11
|
+
}
|
|
12
|
+
export declare class MemoryInjector {
|
|
13
|
+
private config;
|
|
14
|
+
private injectedIds;
|
|
15
|
+
constructor(config?: MementosConfig);
|
|
16
|
+
/**
|
|
17
|
+
* Get formatted injection context suitable for system prompt insertion.
|
|
18
|
+
* Produces structured output with Key Memories and Recent Context sections.
|
|
19
|
+
* Token-budget aware.
|
|
20
|
+
*/
|
|
21
|
+
getInjectionContext(options?: InjectionOptions): string;
|
|
22
|
+
/**
|
|
23
|
+
* Reset the deduplication window (call between refresh intervals)
|
|
24
|
+
*/
|
|
25
|
+
resetDedup(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get count of memories injected so far in this session
|
|
28
|
+
*/
|
|
29
|
+
getInjectedCount(): number;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=injector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injector.d.ts","sourceRoot":"","sources":["../../src/lib/injector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAU,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQhF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAA0B;gBAEjC,MAAM,CAAC,EAAE,cAAc;IAInC;;;;OAIG;IACH,mBAAmB,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM;IA0K3D;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,gBAAgB,IAAI,MAAM;CAG3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { Memory, MemoryScope, MemoryCategory } from "../types/index.js";
|
|
3
|
+
export interface PollOptions {
|
|
4
|
+
interval_ms?: number;
|
|
5
|
+
scope?: MemoryScope;
|
|
6
|
+
category?: MemoryCategory;
|
|
7
|
+
agent_id?: string;
|
|
8
|
+
project_id?: string;
|
|
9
|
+
on_memories: (memories: Memory[]) => void;
|
|
10
|
+
on_error?: (error: Error) => void;
|
|
11
|
+
db?: Database;
|
|
12
|
+
}
|
|
13
|
+
export interface PollHandle {
|
|
14
|
+
stop: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function startPolling(opts: PollOptions): PollHandle;
|
|
17
|
+
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../src/lib/poll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQ7E,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAMD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CA0F1D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { Project } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Auto-detect the current project from cwd's git root.
|
|
5
|
+
* - Finds the git root directory
|
|
6
|
+
* - Extracts the repo name from the directory basename
|
|
7
|
+
* - Checks if a project is already registered by path
|
|
8
|
+
* - If not, registers it automatically
|
|
9
|
+
* - Returns the Project object, or null if not in a git repo
|
|
10
|
+
*
|
|
11
|
+
* Results are cached for the lifetime of the process.
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectProject(db?: Database): Project | null;
|
|
14
|
+
/**
|
|
15
|
+
* Reset the cached project (useful for tests).
|
|
16
|
+
*/
|
|
17
|
+
export declare function resetProjectCache(): void;
|
|
18
|
+
//# sourceMappingURL=project-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-detect.d.ts","sourceRoot":"","sources":["../../src/lib/project-detect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAkBjD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CA0B3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect and redact secrets from text.
|
|
3
|
+
* Returns the text with secrets replaced by [REDACTED].
|
|
4
|
+
*/
|
|
5
|
+
export declare function redactSecrets(text: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Check if text contains any detectable secrets.
|
|
8
|
+
*/
|
|
9
|
+
export declare function containsSecrets(text: string): boolean;
|
|
10
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { MementosConfig } from "../types/index.js";
|
|
3
|
+
export declare function enforceQuotas(config: MementosConfig, db?: Database): number;
|
|
4
|
+
export declare function archiveStale(staleDays: number, db?: Database): number;
|
|
5
|
+
export declare function archiveUnused(days: number, db?: Database): number;
|
|
6
|
+
export declare function deprioritizeStale(days: number, db?: Database): number;
|
|
7
|
+
export declare function runCleanup(config: MementosConfig, db?: Database): {
|
|
8
|
+
expired: number;
|
|
9
|
+
evicted: number;
|
|
10
|
+
archived: number;
|
|
11
|
+
unused_archived: number;
|
|
12
|
+
deprioritized: number;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=retention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/lib/retention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,mBAAmB,CAAC;AAQrE,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CA0C3E;AAMD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAwBrE;AAMD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAoBjE;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CA2BrE;AAMD,wBAAgB,UAAU,CACxB,MAAM,EAAE,cAAc,EACtB,EAAE,CAAC,EAAE,QAAQ,GACZ;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAgBxG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { MemoryFilter, MemorySearchResult } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Search memories by query string with relevance scoring.
|
|
5
|
+
*
|
|
6
|
+
* Uses FTS5 full-text search when available, falling back to LIKE queries.
|
|
7
|
+
* Searches across key, value, summary, and tags. Results are scored,
|
|
8
|
+
* weighted by importance, filtered, and sorted by score DESC then
|
|
9
|
+
* importance DESC.
|
|
10
|
+
*/
|
|
11
|
+
export declare function searchMemories(query: string, filter?: MemoryFilter, db?: Database): MemorySearchResult[];
|
|
12
|
+
export declare function logSearchQuery(query: string, resultCount: number, agentId?: string, projectId?: string, db?: Database): void;
|
|
13
|
+
export declare function getSearchHistory(limit?: number, projectId?: string, db?: Database): {
|
|
14
|
+
query: string;
|
|
15
|
+
result_count: number;
|
|
16
|
+
created_at: string;
|
|
17
|
+
}[];
|
|
18
|
+
export declare function getPopularSearches(limit?: number, projectId?: string, db?: Database): {
|
|
19
|
+
query: string;
|
|
20
|
+
count: number;
|
|
21
|
+
}[];
|
|
22
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAU,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAyoBlF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,YAAY,EACrB,EAAE,CAAC,EAAE,QAAQ,GACZ,kBAAkB,EAAE,CAoDtB;AAMD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,EAAE,CAAC,EAAE,QAAQ,GACZ,IAAI,CAWN;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,GAAE,MAAW,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,EAAE,CAAC,EAAE,QAAQ,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,CAU/D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,GAAE,MAAW,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,EAAE,CAAC,EAAE,QAAQ,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAUpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import type { ConflictResolution, SyncDirection, SyncResult } from "../types/index.js";
|
|
3
|
+
export declare function syncMemories(agentName: string, direction?: SyncDirection, options?: {
|
|
4
|
+
agent_id?: string;
|
|
5
|
+
project_id?: string;
|
|
6
|
+
conflict_resolution?: ConflictResolution;
|
|
7
|
+
db?: Database;
|
|
8
|
+
}): SyncResult;
|
|
9
|
+
export declare const defaultSyncAgents: string[];
|
|
10
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/lib/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,KAAK,EACV,kBAAkB,EAElB,aAAa,EACb,UAAU,EACX,MAAM,mBAAmB,CAAC;AA6K3B,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,aAAsB,EACjC,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACV,GACL,UAAU,CAgCZ;AAED,eAAO,MAAM,iBAAiB,UAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":""}
|