swarm-mail 0.3.4 → 0.5.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/README.md CHANGED
@@ -47,6 +47,9 @@ Event sourcing primitives for multi-agent coordination. Local-first, no external
47
47
  │ ├── DurableCursor - Checkpointed stream reader │
48
48
  │ └── DurableDeferred - Distributed promise │
49
49
  │ │
50
+ │ MEMORY │
51
+ │ └── Semantic Memory - Vector embeddings (pgvector/Ollama) │
52
+ │ │
50
53
  │ STORAGE │
51
54
  │ └── PGLite (Embedded Postgres) + Migrations │
52
55
  └─────────────────────────────────────────────────────────────┘
@@ -183,12 +186,46 @@ Materialized views derived from events:
183
186
  | `swarm_contexts` | Checkpoint state for recovery |
184
187
  | `eval_records` | Outcome data for learning |
185
188
 
189
+ ### Semantic Memory
190
+
191
+ Persistent, searchable storage for agent learnings:
192
+
193
+ ```typescript
194
+ import { createMemoryAdapter } from 'swarm-mail/memory'
195
+
196
+ const swarmMail = await getSwarmMail('/my/project')
197
+ const db = await swarmMail.getDatabase()
198
+ const memory = await createMemoryAdapter(db)
199
+
200
+ // Store a learning
201
+ const { id } = await memory.store(
202
+ "OAuth refresh tokens need 5min buffer before expiry...",
203
+ { tags: "auth,tokens,debugging" }
204
+ )
205
+
206
+ // Search by meaning (vector similarity)
207
+ const results = await memory.find("token refresh issues")
208
+
209
+ // Check Ollama health
210
+ const health = await memory.checkHealth()
211
+ // { ollama: true, model: "mxbai-embed-large" }
212
+ ```
213
+
214
+ > **Note:** Requires [Ollama](https://ollama.ai/) for vector embeddings. Falls back to full-text search if unavailable.
215
+ >
216
+ > ```bash
217
+ > ollama pull mxbai-embed-large
218
+ > ```
219
+
220
+ > **Deprecation Notice:** The standalone [semantic-memory MCP server](https://github.com/joelhooks/semantic-memory) is deprecated. Use the embedded memory in swarm-mail instead - same API, single PGLite instance, no separate process.
221
+
186
222
  ## Architecture
187
223
 
188
224
  - **Append-only log** - Events are immutable, projections are derived
189
225
  - **Local-first** - PGLite embedded Postgres, no external servers
190
226
  - **Effect-TS** - Type-safe, composable, testable
191
227
  - **Exactly-once** - DurableCursor checkpoints position
228
+ - **Semantic memory** - Vector embeddings with pgvector + Ollama
192
229
 
193
230
  ## API Reference
194
231
 
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/hive/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA6B5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,GACjB,WAAW,CA6iBb"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/hive/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA+B5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,eAAe,EACnB,UAAU,EAAE,MAAM,GACjB,WAAW,CA6iBb"}
package/dist/index.d.ts CHANGED
@@ -24,4 +24,11 @@ export * from "./streams";
24
24
  export * from "./hive";
25
25
  export { startDaemon, stopDaemon, isDaemonRunning, healthCheck, getPidFilePath, } from "./daemon";
26
26
  export type { DaemonOptions, DaemonInfo } from "./daemon";
27
+ export { createMemoryStore, EMBEDDING_DIM, } from "./memory/store";
28
+ export type { Memory, SearchResult, SearchOptions, } from "./memory/store";
29
+ export { Ollama, OllamaError, getDefaultConfig, makeOllamaLive, } from "./memory/ollama";
30
+ export type { MemoryConfig } from "./memory/ollama";
31
+ export { memoryMigration, memoryMigrations, } from "./memory/migrations";
32
+ export { legacyDatabaseExists, migrateLegacyMemories, getMigrationStatus, getDefaultLegacyPath, } from "./memory/migrate-legacy";
33
+ export type { MigrationOptions, MigrationResult, } from "./memory/migrate-legacy";
27
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAM1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,SAAS,CAAC;AAMjB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,MAAM,GACP,MAAM,UAAU,CAAC;AAMlB,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,cAAc,WAAW,CAAC;AAM1B,cAAc,QAAQ,CAAC;AAMvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAM1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EACV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