@gilangjavier/chrona 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.
@@ -0,0 +1,92 @@
1
+ import Database from 'better-sqlite3';
2
+
3
+ declare const memoryTypes: readonly ["decision", "preference", "fact", "incident", "constraint"];
4
+ declare const memoryScopes: readonly ["user", "project", "org", "shared"];
5
+ declare const sourceKinds: readonly ["tool", "session", "repo"];
6
+ type MemoryType = (typeof memoryTypes)[number];
7
+ type MemoryScope = (typeof memoryScopes)[number];
8
+ type SourceKind = (typeof sourceKinds)[number];
9
+ interface MemorySource {
10
+ kind: SourceKind;
11
+ value: string;
12
+ }
13
+ interface MemoryEntry {
14
+ id: string;
15
+ type: MemoryType;
16
+ text: string;
17
+ createdAt: string;
18
+ source: MemorySource;
19
+ confidence: number;
20
+ scope: MemoryScope;
21
+ tags: string[];
22
+ expiresAt?: string;
23
+ links?: string[];
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ interface AddMemoryInput {
27
+ id?: string;
28
+ type: MemoryType;
29
+ text: string;
30
+ createdAt?: string;
31
+ source: MemorySource;
32
+ confidence: number;
33
+ scope: MemoryScope;
34
+ tags: string[];
35
+ expiresAt?: string;
36
+ links?: string[];
37
+ metadata?: Record<string, unknown>;
38
+ }
39
+ interface QueryOptions {
40
+ scopes?: MemoryScope[];
41
+ types?: MemoryType[];
42
+ tags?: string[];
43
+ sourceKind?: SourceKind;
44
+ sourceValue?: string;
45
+ before?: string;
46
+ after?: string;
47
+ includeExpired?: boolean;
48
+ limit?: number;
49
+ }
50
+ interface SearchOptions extends QueryOptions {
51
+ query: string;
52
+ }
53
+ interface TimelineOptions extends QueryOptions {
54
+ order?: "asc" | "desc";
55
+ }
56
+ interface ExportOptions extends TimelineOptions {
57
+ }
58
+ interface ImportResult {
59
+ imported: number;
60
+ updated: number;
61
+ ids: string[];
62
+ }
63
+ interface GcResult {
64
+ deleted: number;
65
+ ids: string[];
66
+ now: string;
67
+ }
68
+
69
+ declare class ChromaStore {
70
+ readonly path: string;
71
+ readonly db: Database.Database;
72
+ constructor(path?: string);
73
+ init(): void;
74
+ close(): void;
75
+ add(input: AddMemoryInput): MemoryEntry;
76
+ get(id: string): MemoryEntry | null;
77
+ search(options: SearchOptions): MemoryEntry[];
78
+ timeline(options?: TimelineOptions): MemoryEntry[];
79
+ exportJsonl(options?: ExportOptions): string;
80
+ importJsonl(input: string): ImportResult;
81
+ gc(now?: string | Date): GcResult;
82
+ private buildQuery;
83
+ private toRow;
84
+ private fromRow;
85
+ }
86
+
87
+ declare function parseMemoryType(value: string): MemoryType;
88
+ declare function parseMemoryScope(value: string): MemoryScope;
89
+ declare function parseSourceKind(value: string): SourceKind;
90
+ declare function normalizeEntry(input: AddMemoryInput | MemoryEntry): MemoryEntry;
91
+
92
+ export { type AddMemoryInput, ChromaStore, type ExportOptions, type GcResult, type ImportResult, type MemoryEntry, type MemoryScope, type MemorySource, type MemoryType, type QueryOptions, type SearchOptions, type SourceKind, type TimelineOptions, memoryScopes, memoryTypes, normalizeEntry, parseMemoryScope, parseMemoryType, parseSourceKind, sourceKinds };
@@ -0,0 +1,92 @@
1
+ import Database from 'better-sqlite3';
2
+
3
+ declare const memoryTypes: readonly ["decision", "preference", "fact", "incident", "constraint"];
4
+ declare const memoryScopes: readonly ["user", "project", "org", "shared"];
5
+ declare const sourceKinds: readonly ["tool", "session", "repo"];
6
+ type MemoryType = (typeof memoryTypes)[number];
7
+ type MemoryScope = (typeof memoryScopes)[number];
8
+ type SourceKind = (typeof sourceKinds)[number];
9
+ interface MemorySource {
10
+ kind: SourceKind;
11
+ value: string;
12
+ }
13
+ interface MemoryEntry {
14
+ id: string;
15
+ type: MemoryType;
16
+ text: string;
17
+ createdAt: string;
18
+ source: MemorySource;
19
+ confidence: number;
20
+ scope: MemoryScope;
21
+ tags: string[];
22
+ expiresAt?: string;
23
+ links?: string[];
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ interface AddMemoryInput {
27
+ id?: string;
28
+ type: MemoryType;
29
+ text: string;
30
+ createdAt?: string;
31
+ source: MemorySource;
32
+ confidence: number;
33
+ scope: MemoryScope;
34
+ tags: string[];
35
+ expiresAt?: string;
36
+ links?: string[];
37
+ metadata?: Record<string, unknown>;
38
+ }
39
+ interface QueryOptions {
40
+ scopes?: MemoryScope[];
41
+ types?: MemoryType[];
42
+ tags?: string[];
43
+ sourceKind?: SourceKind;
44
+ sourceValue?: string;
45
+ before?: string;
46
+ after?: string;
47
+ includeExpired?: boolean;
48
+ limit?: number;
49
+ }
50
+ interface SearchOptions extends QueryOptions {
51
+ query: string;
52
+ }
53
+ interface TimelineOptions extends QueryOptions {
54
+ order?: "asc" | "desc";
55
+ }
56
+ interface ExportOptions extends TimelineOptions {
57
+ }
58
+ interface ImportResult {
59
+ imported: number;
60
+ updated: number;
61
+ ids: string[];
62
+ }
63
+ interface GcResult {
64
+ deleted: number;
65
+ ids: string[];
66
+ now: string;
67
+ }
68
+
69
+ declare class ChromaStore {
70
+ readonly path: string;
71
+ readonly db: Database.Database;
72
+ constructor(path?: string);
73
+ init(): void;
74
+ close(): void;
75
+ add(input: AddMemoryInput): MemoryEntry;
76
+ get(id: string): MemoryEntry | null;
77
+ search(options: SearchOptions): MemoryEntry[];
78
+ timeline(options?: TimelineOptions): MemoryEntry[];
79
+ exportJsonl(options?: ExportOptions): string;
80
+ importJsonl(input: string): ImportResult;
81
+ gc(now?: string | Date): GcResult;
82
+ private buildQuery;
83
+ private toRow;
84
+ private fromRow;
85
+ }
86
+
87
+ declare function parseMemoryType(value: string): MemoryType;
88
+ declare function parseMemoryScope(value: string): MemoryScope;
89
+ declare function parseSourceKind(value: string): SourceKind;
90
+ declare function normalizeEntry(input: AddMemoryInput | MemoryEntry): MemoryEntry;
91
+
92
+ export { type AddMemoryInput, ChromaStore, type ExportOptions, type GcResult, type ImportResult, type MemoryEntry, type MemoryScope, type MemorySource, type MemoryType, type QueryOptions, type SearchOptions, type SourceKind, type TimelineOptions, memoryScopes, memoryTypes, normalizeEntry, parseMemoryScope, parseMemoryType, parseSourceKind, sourceKinds };
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import {
2
+ ChromaStore,
3
+ memoryScopes,
4
+ memoryTypes,
5
+ normalizeEntry,
6
+ parseMemoryScope,
7
+ parseMemoryType,
8
+ parseSourceKind,
9
+ sourceKinds
10
+ } from "./chunk-PPAKIDJE.js";
11
+ export {
12
+ ChromaStore,
13
+ memoryScopes,
14
+ memoryTypes,
15
+ normalizeEntry,
16
+ parseMemoryScope,
17
+ parseMemoryType,
18
+ parseSourceKind,
19
+ sourceKinds
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@gilangjavier/chrona",
3
+ "version": "0.1.0",
4
+ "description": "Local-first, deterministic, time-aware memory store for agents with provenance and privacy scopes.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "bin": {
11
+ "chrona": "./dist/cli.js"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/gilangjavier/chrona.git"
34
+ },
35
+ "homepage": "https://github.com/gilangjavier/chrona#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/gilangjavier/chrona/issues"
38
+ },
39
+ "keywords": [
40
+ "memory",
41
+ "agent",
42
+ "sqlite",
43
+ "cli",
44
+ "timeline",
45
+ "deterministic",
46
+ "provenance",
47
+ "local-first"
48
+ ],
49
+ "scripts": {
50
+ "build": "tsup src/index.ts src/cli.ts --format esm,cjs --dts --clean --sourcemap",
51
+ "test": "vitest run",
52
+ "typecheck": "tsc --noEmit",
53
+ "check": "npm run typecheck && npm run test && npm run build",
54
+ "prepublishOnly": "npm run check"
55
+ },
56
+ "dependencies": {
57
+ "better-sqlite3": "^11.8.1",
58
+ "commander": "^14.0.1"
59
+ },
60
+ "devDependencies": {
61
+ "@types/better-sqlite3": "^7.6.12",
62
+ "@types/node": "^24.5.2",
63
+ "tsup": "^8.5.0",
64
+ "typescript": "^5.9.2",
65
+ "vitest": "^3.2.4"
66
+ }
67
+ }