swarm-mail 0.4.0 → 1.0.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.
Files changed (59) hide show
  1. package/README.md +121 -0
  2. package/bin/daemon-cli.ts +4 -4
  3. package/dist/beads/adapter.d.ts +38 -0
  4. package/dist/beads/adapter.d.ts.map +1 -0
  5. package/dist/beads/blocked-cache.d.ts +21 -0
  6. package/dist/beads/blocked-cache.d.ts.map +1 -0
  7. package/dist/beads/comments.d.ts +21 -0
  8. package/dist/beads/comments.d.ts.map +1 -0
  9. package/dist/beads/dependencies.d.ts +58 -0
  10. package/dist/beads/dependencies.d.ts.map +1 -0
  11. package/dist/beads/events.d.ts +163 -0
  12. package/dist/beads/events.d.ts.map +1 -0
  13. package/dist/beads/flush-manager.d.ts +71 -0
  14. package/dist/beads/flush-manager.d.ts.map +1 -0
  15. package/dist/beads/index.d.ts +25 -0
  16. package/dist/beads/index.d.ts.map +1 -0
  17. package/dist/beads/jsonl.d.ts +103 -0
  18. package/dist/beads/jsonl.d.ts.map +1 -0
  19. package/dist/beads/labels.d.ts +21 -0
  20. package/dist/beads/labels.d.ts.map +1 -0
  21. package/dist/beads/merge.d.ts +99 -0
  22. package/dist/beads/merge.d.ts.map +1 -0
  23. package/dist/beads/migrations.d.ts +41 -0
  24. package/dist/beads/migrations.d.ts.map +1 -0
  25. package/dist/beads/operations.d.ts +56 -0
  26. package/dist/beads/operations.d.ts.map +1 -0
  27. package/dist/beads/projections.d.ts +103 -0
  28. package/dist/beads/projections.d.ts.map +1 -0
  29. package/dist/beads/queries.d.ts +77 -0
  30. package/dist/beads/queries.d.ts.map +1 -0
  31. package/dist/beads/store.d.ts +98 -0
  32. package/dist/beads/store.d.ts.map +1 -0
  33. package/dist/beads/validation.d.ts +75 -0
  34. package/dist/beads/validation.d.ts.map +1 -0
  35. package/dist/index.d.ts +9 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +34994 -227
  38. package/dist/memory/adapter.d.ts +157 -0
  39. package/dist/memory/adapter.d.ts.map +1 -0
  40. package/dist/memory/index.d.ts +12 -0
  41. package/dist/memory/index.d.ts.map +1 -0
  42. package/dist/memory/migrate-legacy.d.ts +88 -0
  43. package/dist/memory/migrate-legacy.d.ts.map +1 -0
  44. package/dist/memory/migrations.d.ts +42 -0
  45. package/dist/memory/migrations.d.ts.map +1 -0
  46. package/dist/memory/ollama.d.ts +80 -0
  47. package/dist/memory/ollama.d.ts.map +1 -0
  48. package/dist/memory/store.d.ts +138 -0
  49. package/dist/memory/store.d.ts.map +1 -0
  50. package/dist/memory/sync.d.ts +93 -0
  51. package/dist/memory/sync.d.ts.map +1 -0
  52. package/dist/pglite.d.ts.map +1 -1
  53. package/dist/streams/events.d.ts +4 -0
  54. package/dist/streams/events.d.ts.map +1 -1
  55. package/dist/streams/index.d.ts.map +1 -1
  56. package/dist/streams/migrations.d.ts.map +1 -1
  57. package/dist/types/beads-adapter.d.ts +397 -0
  58. package/dist/types/beads-adapter.d.ts.map +1 -0
  59. package/package.json +7 -4
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Memory Adapter - High-level API for semantic memory
3
+ *
4
+ * Combines Ollama embeddings + MemoryStore into a simple API matching
5
+ * the semantic-memory MCP tool interface.
6
+ *
7
+ * ## Key Features
8
+ * - Automatic embedding generation via Ollama
9
+ * - Semantic search with vector similarity
10
+ * - FTS fallback when Ollama unavailable
11
+ * - Graceful degradation
12
+ * - Decay calculation (90-day half-life)
13
+ *
14
+ * ## Usage
15
+ * ```typescript
16
+ * import { createMemoryAdapter } from './adapter.js';
17
+ * import { wrapPGlite } from '../pglite.js';
18
+ * import { PGlite } from '@electric-sql/pglite';
19
+ *
20
+ * const pglite = await PGlite.create({ dataDir: './db' });
21
+ * const db = wrapPGlite(pglite);
22
+ * const config = {
23
+ * ollamaHost: 'http://localhost:11434',
24
+ * ollamaModel: 'mxbai-embed-large',
25
+ * };
26
+ *
27
+ * const adapter = createMemoryAdapter(db, config);
28
+ *
29
+ * // Store with automatic embedding
30
+ * const { id } = await adapter.store("OAuth tokens need refresh buffer", {
31
+ * tags: "auth,tokens",
32
+ * metadata: JSON.stringify({ priority: "high" })
33
+ * });
34
+ *
35
+ * // Semantic search
36
+ * const results = await adapter.find("token refresh");
37
+ *
38
+ * // FTS fallback when Ollama down
39
+ * const results = await adapter.find("token refresh", { fts: true });
40
+ * ```
41
+ */
42
+ import type { DatabaseAdapter } from "../types/database.js";
43
+ import { type Memory, type SearchResult } from "./store.js";
44
+ import { type MemoryConfig } from "./ollama.js";
45
+ export type { MemoryConfig } from "./ollama.js";
46
+ export type { Memory, SearchResult } from "./store.js";
47
+ /**
48
+ * Options for storing a memory
49
+ */
50
+ export interface StoreOptions {
51
+ /** Collection name (default: "default") */
52
+ readonly collection?: string;
53
+ /** Comma-separated tags (e.g., "auth,tokens,oauth") */
54
+ readonly tags?: string;
55
+ /** JSON string with additional metadata */
56
+ readonly metadata?: string;
57
+ /** Confidence level (0.0-1.0) affecting decay rate. Higher = slower decay. Default 0.7 */
58
+ readonly confidence?: number;
59
+ }
60
+ /**
61
+ * Options for searching memories
62
+ */
63
+ export interface FindOptions {
64
+ /** Maximum number of results (default: 10) */
65
+ readonly limit?: number;
66
+ /** Collection filter */
67
+ readonly collection?: string;
68
+ /** Return full content (default: false returns preview) */
69
+ readonly expand?: boolean;
70
+ /** Use full-text search instead of vector search (default: false) */
71
+ readonly fts?: boolean;
72
+ }
73
+ /**
74
+ * Health check result
75
+ */
76
+ export interface HealthStatus {
77
+ /** Whether Ollama is available */
78
+ readonly ollama: boolean;
79
+ /** Ollama model name (if available) */
80
+ readonly model?: string;
81
+ }
82
+ /**
83
+ * Create a memory adapter with high-level operations
84
+ *
85
+ * @param db - DatabaseAdapter for PGlite/PostgreSQL
86
+ * @param config - Ollama configuration
87
+ * @returns Memory adapter instance
88
+ */
89
+ export declare function createMemoryAdapter(db: DatabaseAdapter, config: MemoryConfig): {
90
+ /**
91
+ * Store a memory with automatic embedding generation
92
+ *
93
+ * @param information - Memory content
94
+ * @param options - Store options
95
+ * @returns Memory ID
96
+ * @throws Error if embedding generation fails or database operation fails
97
+ */
98
+ store(information: string, options?: StoreOptions): Promise<{
99
+ id: string;
100
+ }>;
101
+ /**
102
+ * Find memories by semantic similarity or full-text search
103
+ *
104
+ * @param query - Search query
105
+ * @param options - Search options
106
+ * @returns Search results with scores
107
+ */
108
+ find(query: string, options?: FindOptions): Promise<SearchResult[]>;
109
+ /**
110
+ * Get a specific memory by ID
111
+ *
112
+ * @param id - Memory ID
113
+ * @returns Memory or null if not found
114
+ */
115
+ get(id: string): Promise<Memory | null>;
116
+ /**
117
+ * Remove a memory
118
+ *
119
+ * @param id - Memory ID
120
+ */
121
+ remove(id: string): Promise<void>;
122
+ /**
123
+ * Validate/refresh a memory (reset decay timer)
124
+ *
125
+ * Updates the created_at timestamp to current time, effectively
126
+ * resetting the 90-day decay timer.
127
+ *
128
+ * @param id - Memory ID
129
+ * @throws Error if memory not found
130
+ */
131
+ validate(id: string): Promise<void>;
132
+ /**
133
+ * List all memories
134
+ *
135
+ * @param options - List options
136
+ * @returns Array of memories
137
+ */
138
+ list(options?: {
139
+ collection?: string;
140
+ }): Promise<Memory[]>;
141
+ /**
142
+ * Get database statistics
143
+ *
144
+ * @returns Memory and embedding counts
145
+ */
146
+ stats(): Promise<{
147
+ memories: number;
148
+ embeddings: number;
149
+ }>;
150
+ /**
151
+ * Check if Ollama is available
152
+ *
153
+ * @returns Health status
154
+ */
155
+ checkHealth(): Promise<HealthStatus>;
156
+ };
157
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/memory/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAqB,KAAK,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,OAAO,CAAC,YAAY,EAAE,CAAC;IA0C7E;;;;;OAKG;YACW,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7C;;;;OAIG;eACc,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;;;;;;;OAQG;iBACgB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAczC;;;;;OAKG;mBACiB;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpE;;;;OAIG;aACY,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhE;;;;OAIG;mBACkB,OAAO,CAAC,YAAY,CAAC;EAiB7C"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Memory Module - Semantic memory with vector embeddings
3
+ *
4
+ * Provides Ollama-based embedding generation and memory storage.
5
+ */
6
+ export { createMemoryAdapter, type FindOptions, type HealthStatus, type Memory, type MemoryConfig, type SearchResult, type StoreOptions, } from "./adapter.js";
7
+ export { getDefaultConfig, makeOllamaLive, Ollama, OllamaError, } from "./ollama.js";
8
+ export { createMemoryStore, EMBEDDING_DIM } from "./store.js";
9
+ export { memoryMigration, memoryMigrations } from "./migrations.js";
10
+ export { getDefaultLegacyPath, getMigrationStatus, legacyDatabaseExists, migrateLegacyMemories, type MigrationOptions, type MigrationResult, } from "./migrate-legacy.js";
11
+ export { exportMemories, importMemories, syncMemories, parseMemoryJSONL, serializeMemoryToJSONL, type ExportOptions as MemoryExportOptions, type ImportOptions as MemoryImportOptions, type MemoryExport, type MemoryImportResult, } from "./sync.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACN,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACN,gBAAgB,EAChB,cAAc,EACd,MAAM,EACN,WAAW,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,cAAc,EACd,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,aAAa,IAAI,mBAAmB,EACzC,KAAK,aAAa,IAAI,mBAAmB,EACzC,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACvB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Legacy Semantic Memory Migration Tool
3
+ *
4
+ * Migrates memories from the standalone semantic-memory MCP server
5
+ * (~/.semantic-memory/memory) to the consolidated swarm-mail database.
6
+ *
7
+ * ## Usage
8
+ *
9
+ * ```typescript
10
+ * import { migrateLegacyMemories } from 'swarm-mail';
11
+ *
12
+ * const result = await migrateLegacyMemories({
13
+ * legacyPath: '~/.semantic-memory/memory',
14
+ * targetAdapter: swarmMailAdapter,
15
+ * dryRun: false,
16
+ * });
17
+ *
18
+ * console.log(`Migrated ${result.migrated} memories`);
19
+ * ```
20
+ *
21
+ * ## What Gets Migrated
22
+ *
23
+ * - All memories from the `memories` table
24
+ * - All embeddings from the `memory_embeddings` table
25
+ * - Metadata, collections, and timestamps preserved
26
+ *
27
+ * ## Conflict Handling
28
+ *
29
+ * - Duplicate IDs are skipped (existing memories take precedence)
30
+ * - Migration is idempotent - safe to run multiple times
31
+ *
32
+ * @module memory/migrate-legacy
33
+ */
34
+ import type { DatabaseAdapter } from "../types/database.js";
35
+ /**
36
+ * Migration options
37
+ */
38
+ export interface MigrationOptions {
39
+ /** Path to legacy semantic-memory database directory */
40
+ legacyPath?: string;
41
+ /** Target database adapter (from swarm-mail) */
42
+ targetDb: DatabaseAdapter;
43
+ /** If true, only report what would be migrated without making changes */
44
+ dryRun?: boolean;
45
+ /** Callback for progress updates */
46
+ onProgress?: (message: string) => void;
47
+ }
48
+ /**
49
+ * Migration result
50
+ */
51
+ export interface MigrationResult {
52
+ /** Number of memories successfully migrated */
53
+ migrated: number;
54
+ /** Number of memories skipped (already exist) */
55
+ skipped: number;
56
+ /** Number of memories that failed to migrate */
57
+ failed: number;
58
+ /** Error messages for failed migrations */
59
+ errors: string[];
60
+ /** Whether this was a dry run */
61
+ dryRun: boolean;
62
+ }
63
+ /**
64
+ * Default path to legacy semantic-memory database
65
+ */
66
+ export declare function getDefaultLegacyPath(): string;
67
+ /**
68
+ * Check if legacy database exists
69
+ */
70
+ export declare function legacyDatabaseExists(path?: string): boolean;
71
+ /**
72
+ * Migrate memories from legacy semantic-memory database
73
+ *
74
+ * @param options - Migration options
75
+ * @returns Migration result with counts and errors
76
+ */
77
+ export declare function migrateLegacyMemories(options: MigrationOptions): Promise<MigrationResult>;
78
+ /**
79
+ * Get migration status without actually migrating
80
+ *
81
+ * @param legacyPath - Path to legacy database
82
+ * @returns Count of memories that would be migrated
83
+ */
84
+ export declare function getMigrationStatus(legacyPath?: string): Promise<{
85
+ total: number;
86
+ withEmbeddings: number;
87
+ } | null>;
88
+ //# sourceMappingURL=migrate-legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-legacy.d.ts","sourceRoot":"","sources":["../../src/memory/migrate-legacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,QAAQ,EAAE,eAAe,CAAC;IAC1B,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;CACjB;AAsBD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CA4I1B;AAwBD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAiC3D"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Memory Schema Migration
3
+ *
4
+ * Adds semantic memory tables to the shared PGLite database.
5
+ * This migration extends the existing swarm-mail schema.
6
+ *
7
+ * ## Migration Strategy
8
+ * - Migration v9 adds memory tables to existing swarm-mail schema (v0-v8)
9
+ * - Shares same PGLite database instance and migration system
10
+ * - Uses same schema_version table for tracking
11
+ *
12
+ * ## Tables Created
13
+ * - memories: Core memory records with content, metadata, collection
14
+ * - memory_embeddings: Vector embeddings for semantic search (pgvector)
15
+ *
16
+ * ## Indexes
17
+ * - HNSW index on embeddings for fast approximate nearest neighbor search
18
+ * - GIN index on content for full-text search
19
+ * - B-tree index on collection for filtering
20
+ *
21
+ * ## Design Notes
22
+ * - Uses TEXT for IDs (like hive/beads)
23
+ * - Uses TIMESTAMPTZ for timestamps (Postgres standard)
24
+ * - Uses JSONB for metadata (flexible key-value storage)
25
+ * - Uses vector(1024) for embeddings (mxbai-embed-large dimension)
26
+ * - CASCADE deletes for referential integrity
27
+ *
28
+ * @module memory/migrations
29
+ */
30
+ import type { Migration } from "../streams/migrations.js";
31
+ /**
32
+ * Migration v9: Add memory tables
33
+ *
34
+ * This migration is designed to be appended to the existing migrations array
35
+ * in src/streams/migrations.ts.
36
+ */
37
+ export declare const memoryMigration: Migration;
38
+ /**
39
+ * Export memory migrations array
40
+ */
41
+ export declare const memoryMigrations: Migration[];
42
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/memory/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAkD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,EAAsB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Ollama Embedding Service
3
+ *
4
+ * Provides embedding generation via local Ollama server.
5
+ * Uses Effect-TS patterns: Context.Tag for DI, Layer for instantiation.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { Ollama, makeOllamaLive } from './memory/ollama';
10
+ * import { Effect } from 'effect';
11
+ *
12
+ * const config = {
13
+ * ollamaHost: process.env.OLLAMA_HOST || 'http://localhost:11434',
14
+ * ollamaModel: process.env.OLLAMA_MODEL || 'mxbai-embed-large',
15
+ * };
16
+ *
17
+ * const program = Effect.gen(function* () {
18
+ * const ollama = yield* Ollama;
19
+ * const embedding = yield* ollama.embed("hello world");
20
+ * return embedding;
21
+ * });
22
+ *
23
+ * const layer = makeOllamaLive(config);
24
+ * const result = await Effect.runPromise(program.pipe(Effect.provide(layer)));
25
+ * ```
26
+ */
27
+ import { Context, Effect, Layer } from "effect";
28
+ import { Schema } from "effect";
29
+ /**
30
+ * Configuration for Ollama embedding service
31
+ */
32
+ export interface MemoryConfig {
33
+ /** Ollama server URL (default: http://localhost:11434) */
34
+ readonly ollamaHost: string;
35
+ /** Ollama model name (default: mxbai-embed-large) */
36
+ readonly ollamaModel: string;
37
+ }
38
+ declare const OllamaError_base: Schema.TaggedErrorClass<OllamaError, "OllamaError", {
39
+ readonly _tag: Schema.tag<"OllamaError">;
40
+ } & {
41
+ reason: typeof Schema.String;
42
+ }>;
43
+ /**
44
+ * Ollama operation failure
45
+ */
46
+ export declare class OllamaError extends OllamaError_base {
47
+ }
48
+ declare const Ollama_base: Context.TagClass<Ollama, "swarm-mail/Ollama", {
49
+ /** Generate embedding for a single text */
50
+ readonly embed: (text: string) => Effect.Effect<number[], OllamaError>;
51
+ /** Generate embeddings for multiple texts with controlled concurrency */
52
+ readonly embedBatch: (texts: string[], concurrency?: number) => Effect.Effect<number[][], OllamaError>;
53
+ /** Verify Ollama is running and model is available */
54
+ readonly checkHealth: () => Effect.Effect<void, OllamaError>;
55
+ }>;
56
+ /**
57
+ * Ollama service for generating embeddings from text.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const embedding = yield* Ollama.embed("hello world");
62
+ * // => number[] (1024 dims for mxbai-embed-large)
63
+ * ```
64
+ */
65
+ export declare class Ollama extends Ollama_base {
66
+ }
67
+ /**
68
+ * Create Ollama service layer from config.
69
+ *
70
+ * @param config - Memory configuration with ollamaHost and ollamaModel
71
+ * @returns Layer providing the Ollama service
72
+ */
73
+ export declare const makeOllamaLive: (config: MemoryConfig) => Layer.Layer<Ollama, never, never>;
74
+ /**
75
+ * Get default Ollama configuration from environment variables.
76
+ * Falls back to sensible defaults if env vars not set.
77
+ */
78
+ export declare const getDefaultConfig: () => MemoryConfig;
79
+ export {};
80
+ //# sourceMappingURL=ollama.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/memory/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAS,OAAO,EAAY,MAAM,EAAE,KAAK,EAAoB,MAAM,QAAQ,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;;;;;;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,gBAGhC;CAAG;;IAkBF,2CAA2C;oBAC3B,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC;IACtE,yEAAyE;yBACpD,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,CAAC,EAAE,MAAM,KAChB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,CAAC;IAC3C,sDAAsD;0BAChC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;;AApB9D;;;;;;;;GAQG;AACH,qBAAa,MAAO,SAAQ,WAazB;CAAG;AAcN;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,YAAY,sCA+FjD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,YAGlC,CAAC"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Memory Store - PGlite + pgvector operations
3
+ *
4
+ * Provides CRUD operations and semantic search for memories using
5
+ * an existing shared PGlite instance. Does NOT create its own database.
6
+ *
7
+ * ## Design Pattern
8
+ * - Accept DatabaseAdapter via factory parameter (dependency injection)
9
+ * - Share PGlite instance with other swarm-mail services
10
+ * - Schema migrations handled separately (by migrations task)
11
+ *
12
+ * ## Key Operations
13
+ * - store: Insert or update memory with embedding
14
+ * - search: Vector similarity search with threshold/limit/collection filters
15
+ * - ftsSearch: Full-text search with PostgreSQL FTS
16
+ * - list: List all memories, optionally filtered by collection
17
+ * - get: Retrieve single memory by ID
18
+ * - delete: Remove memory and its embedding
19
+ * - getStats: Memory and embedding counts
20
+ *
21
+ * ## Vector Search Query
22
+ * Uses pgvector's <=> operator for cosine distance, where:
23
+ * - 0 = identical vectors
24
+ * - 2 = opposite vectors
25
+ * - Score = 1 - distance (higher is more similar)
26
+ */
27
+ import type { DatabaseAdapter } from "../types/database.js";
28
+ /** Embedding dimension for mxbai-embed-large */
29
+ export declare const EMBEDDING_DIM = 1024;
30
+ /** Memory data structure */
31
+ export interface Memory {
32
+ readonly id: string;
33
+ readonly content: string;
34
+ readonly metadata: Record<string, unknown>;
35
+ readonly collection: string;
36
+ readonly createdAt: Date;
37
+ /** Confidence level (0.0-1.0) affecting decay rate. Higher = slower decay. Default 0.7 */
38
+ readonly confidence?: number;
39
+ }
40
+ /** Search result with similarity score */
41
+ export interface SearchResult {
42
+ readonly memory: Memory;
43
+ readonly score: number;
44
+ readonly matchType: "vector" | "fts";
45
+ }
46
+ /** Search options for queries */
47
+ export interface SearchOptions {
48
+ readonly limit?: number;
49
+ readonly threshold?: number;
50
+ readonly collection?: string;
51
+ }
52
+ /**
53
+ * Create a memory store using a shared DatabaseAdapter
54
+ *
55
+ * @param db - DatabaseAdapter instance (shared PGLite, SQLite, PostgreSQL, etc.)
56
+ * @returns Memory store operations
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * import { wrapPGlite } from '../pglite.js';
61
+ * import { PGlite } from '@electric-sql/pglite';
62
+ * import { vector } from '@electric-sql/pglite/vector';
63
+ *
64
+ * const pglite = await PGlite.create({ dataDir: './db', extensions: { vector } });
65
+ * const db = wrapPGlite(pglite);
66
+ * const store = createMemoryStore(db);
67
+ *
68
+ * await store.store(memory, embedding);
69
+ * const results = await store.search(queryEmbedding);
70
+ * ```
71
+ */
72
+ export declare function createMemoryStore(db: DatabaseAdapter): {
73
+ /**
74
+ * Store a memory with its embedding
75
+ *
76
+ * Uses UPSERT (INSERT ... ON CONFLICT DO UPDATE) to handle both
77
+ * new memories and updates to existing ones atomically.
78
+ *
79
+ * @param memory - Memory to store
80
+ * @param embedding - 1024-dimensional vector
81
+ * @throws Error if database operation fails
82
+ */
83
+ store(memory: Memory, embedding: number[]): Promise<void>;
84
+ /**
85
+ * Vector similarity search
86
+ *
87
+ * Finds memories with embeddings similar to the query embedding.
88
+ * Uses cosine distance (<=> operator) with HNSW index for performance.
89
+ *
90
+ * @param queryEmbedding - 1024-dimensional query vector
91
+ * @param options - Search options (limit, threshold, collection)
92
+ * @returns Array of search results sorted by similarity (highest first)
93
+ */
94
+ search(queryEmbedding: number[], options?: SearchOptions): Promise<SearchResult[]>;
95
+ /**
96
+ * Full-text search
97
+ *
98
+ * Searches memory content using PostgreSQL's full-text search.
99
+ * Uses GIN index on to_tsvector('english', content) for performance.
100
+ *
101
+ * @param searchQuery - Text query string
102
+ * @param options - Search options (limit, collection)
103
+ * @returns Array of search results ranked by ts_rank
104
+ */
105
+ ftsSearch(searchQuery: string, options?: SearchOptions): Promise<SearchResult[]>;
106
+ /**
107
+ * List memories
108
+ *
109
+ * @param collection - Optional collection filter
110
+ * @returns Array of memories sorted by created_at DESC
111
+ */
112
+ list(collection?: string): Promise<Memory[]>;
113
+ /**
114
+ * Get a single memory by ID
115
+ *
116
+ * @param id - Memory ID
117
+ * @returns Memory or null if not found
118
+ */
119
+ get(id: string): Promise<Memory | null>;
120
+ /**
121
+ * Delete a memory
122
+ *
123
+ * Cascade delete handles memory_embeddings automatically.
124
+ *
125
+ * @param id - Memory ID
126
+ */
127
+ delete(id: string): Promise<void>;
128
+ /**
129
+ * Get database statistics
130
+ *
131
+ * @returns Memory and embedding counts
132
+ */
133
+ getStats(): Promise<{
134
+ memories: number;
135
+ embeddings: number;
136
+ }>;
137
+ };
138
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,gDAAgD;AAChD,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC,4BAA4B;AAC5B,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;CACtC;AAED,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,eAAe;IAcjD;;;;;;;;;OASG;kBACiB,MAAM,aAAa,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAuC/D;;;;;;;;;OASG;2BAEe,MAAM,EAAE,YACf,aAAa,GACrB,OAAO,CAAC,YAAY,EAAE,CAAC;IAmD1B;;;;;;;;;OASG;2BAEY,MAAM,YACV,aAAa,GACrB,OAAO,CAAC,YAAY,EAAE,CAAC;IAqC1B;;;;;OAKG;sBACqB,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAelD;;;;;OAKG;YACW,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQ7C;;;;;;OAMG;eACc,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;;;OAIG;gBACe,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;EActE"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Memory Sync - JSONL Export/Import for Git Sync
3
+ *
4
+ * Implements git-synced memory persistence, similar to how hive syncs issues.jsonl.
5
+ * Memories travel with the repo so team members share learnings.
6
+ *
7
+ * ## Architecture
8
+ * ```
9
+ * .hive/
10
+ * issues.jsonl # existing
11
+ * memories.jsonl # NEW
12
+ * ```
13
+ *
14
+ * ## JSONL Format
15
+ * ```json
16
+ * {"id":"mem_abc123","information":"OAuth tokens need 5min buffer...","metadata":"auth,tokens","tags":"oauth,refresh","confidence":0.9,"created_at":"2024-12-19T00:00:00Z"}
17
+ * ```
18
+ *
19
+ * Note: Embeddings are NOT stored (too large). Regenerated on import if Ollama available.
20
+ *
21
+ * @module memory/sync
22
+ */
23
+ import type { DatabaseAdapter } from "../types/database.js";
24
+ /**
25
+ * JSONL export format for memories
26
+ *
27
+ * Embeddings are NOT included - they're too large and can be regenerated.
28
+ */
29
+ export interface MemoryExport {
30
+ id: string;
31
+ information: string;
32
+ metadata?: string;
33
+ tags?: string;
34
+ confidence?: number;
35
+ created_at: string;
36
+ }
37
+ export interface ExportOptions {
38
+ /** Filter by collection */
39
+ collection?: string;
40
+ }
41
+ export interface ImportOptions {
42
+ /** Skip existing memories (default: true) */
43
+ skipExisting?: boolean;
44
+ }
45
+ export interface MemoryImportResult {
46
+ created: number;
47
+ skipped: number;
48
+ errors: Array<{
49
+ memoryId: string;
50
+ error: string;
51
+ }>;
52
+ }
53
+ /**
54
+ * Serialize a memory to a JSONL line
55
+ */
56
+ export declare function serializeMemoryToJSONL(memory: MemoryExport): string;
57
+ /**
58
+ * Parse JSONL string to memory exports
59
+ *
60
+ * Skips empty lines. Throws on invalid JSON.
61
+ */
62
+ export declare function parseMemoryJSONL(jsonl: string): MemoryExport[];
63
+ /**
64
+ * Export all memories to JSONL string
65
+ *
66
+ * Embeddings are NOT included - they're too large for git sync.
67
+ * They can be regenerated on import if Ollama is available.
68
+ */
69
+ export declare function exportMemories(db: DatabaseAdapter, options?: ExportOptions): Promise<string>;
70
+ /**
71
+ * Import memories from JSONL string
72
+ *
73
+ * Features:
74
+ * - Creates new memories
75
+ * - Skips existing memories (by ID)
76
+ * - Embeddings NOT imported (regenerate with Ollama if needed)
77
+ */
78
+ export declare function importMemories(db: DatabaseAdapter, jsonl: string, options?: ImportOptions): Promise<MemoryImportResult>;
79
+ /**
80
+ * Bidirectional sync between database and .hive/memories.jsonl
81
+ *
82
+ * 1. Import from file (new memories only)
83
+ * 2. Export all to file (overwrites)
84
+ *
85
+ * This ensures:
86
+ * - Memories from git are imported
87
+ * - Local memories are exported for git commit
88
+ */
89
+ export declare function syncMemories(db: DatabaseAdapter, hivePath: string): Promise<{
90
+ imported: MemoryImportResult;
91
+ exported: number;
92
+ }>;
93
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","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,IAAI,OAAO,CAAC,IAAI,CAAC,CAUvD;AAGD,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -186,6 +186,8 @@ export declare const SubtaskOutcomeEventSchema: z.ZodObject<{
186
186
  error_count: z.ZodDefault<z.ZodNumber>;
187
187
  retry_count: z.ZodDefault<z.ZodNumber>;
188
188
  success: z.ZodBoolean;
189
+ scope_violation: z.ZodOptional<z.ZodBoolean>;
190
+ violation_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
189
191
  }, z.core.$strip>;
190
192
  export declare const HumanFeedbackEventSchema: z.ZodObject<{
191
193
  id: z.ZodOptional<z.ZodNumber>;
@@ -389,6 +391,8 @@ export declare const AgentEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
389
391
  error_count: z.ZodDefault<z.ZodNumber>;
390
392
  retry_count: z.ZodDefault<z.ZodNumber>;
391
393
  success: z.ZodBoolean;
394
+ scope_violation: z.ZodOptional<z.ZodBoolean>;
395
+ violation_files: z.ZodOptional<z.ZodArray<z.ZodString>>;
392
396
  }, z.core.$strip>, z.ZodObject<{
393
397
  id: z.ZodOptional<z.ZodNumber>;
394
398
  project_key: z.ZodString;