squish-memory 1.2.0 → 1.2.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.
Files changed (449) hide show
  1. package/bin/squish-mcp.mjs +40 -42
  2. package/core/scheduler/cron-scheduler.ts +10 -1
  3. package/core/worker.ts +10 -1
  4. package/package.json +119 -119
  5. package/packages/mcp/src/index.ts +99 -36
  6. package/dist/config.d.ts +0 -106
  7. package/dist/config.js +0 -194
  8. package/dist/core/adapters/config/claude-code.d.ts +0 -45
  9. package/dist/core/adapters/config/claude-code.js +0 -113
  10. package/dist/core/adapters/config/cursor.d.ts +0 -26
  11. package/dist/core/adapters/config/cursor.js +0 -74
  12. package/dist/core/adapters/config/opencode.d.ts +0 -23
  13. package/dist/core/adapters/config/opencode.js +0 -73
  14. package/dist/core/adapters/config/windsurf.d.ts +0 -26
  15. package/dist/core/adapters/config/windsurf.js +0 -74
  16. package/dist/core/adapters/index.d.ts +0 -45
  17. package/dist/core/adapters/index.js +0 -84
  18. package/dist/core/adapters/scripts/install-adapter.d.ts +0 -19
  19. package/dist/core/adapters/scripts/install-adapter.js +0 -149
  20. package/dist/core/adapters/timeline.d.ts +0 -23
  21. package/dist/core/adapters/timeline.js +0 -88
  22. package/dist/core/adapters/types.d.ts +0 -137
  23. package/dist/core/adapters/types.js +0 -50
  24. package/dist/core/agent-preferences.d.ts +0 -16
  25. package/dist/core/agent-preferences.js +0 -124
  26. package/dist/core/algorithms/analytics/token-estimator.d.ts +0 -50
  27. package/dist/core/algorithms/analytics/token-estimator.js +0 -154
  28. package/dist/core/algorithms/detection/hash-filters.d.ts +0 -47
  29. package/dist/core/algorithms/detection/hash-filters.js +0 -190
  30. package/dist/core/algorithms/detection/semantic-ranker.d.ts +0 -32
  31. package/dist/core/algorithms/detection/semantic-ranker.js +0 -118
  32. package/dist/core/algorithms/detection/two-stage-detector.d.ts +0 -52
  33. package/dist/core/algorithms/detection/two-stage-detector.js +0 -299
  34. package/dist/core/algorithms/handlers/approve-merge.d.ts +0 -22
  35. package/dist/core/algorithms/handlers/approve-merge.js +0 -179
  36. package/dist/core/algorithms/handlers/detect-duplicates.d.ts +0 -47
  37. package/dist/core/algorithms/handlers/detect-duplicates.js +0 -145
  38. package/dist/core/algorithms/handlers/get-stats.d.ts +0 -39
  39. package/dist/core/algorithms/handlers/get-stats.js +0 -88
  40. package/dist/core/algorithms/handlers/list-proposals.d.ts +0 -45
  41. package/dist/core/algorithms/handlers/list-proposals.js +0 -83
  42. package/dist/core/algorithms/handlers/preview-merge.d.ts +0 -39
  43. package/dist/core/algorithms/handlers/preview-merge.js +0 -93
  44. package/dist/core/algorithms/handlers/reject-merge.d.ts +0 -28
  45. package/dist/core/algorithms/handlers/reject-merge.js +0 -69
  46. package/dist/core/algorithms/handlers/reverse-merge.d.ts +0 -21
  47. package/dist/core/algorithms/handlers/reverse-merge.js +0 -121
  48. package/dist/core/algorithms/index.d.ts +0 -21
  49. package/dist/core/algorithms/index.js +0 -26
  50. package/dist/core/algorithms/operations/cache-maintenance.d.ts +0 -12
  51. package/dist/core/algorithms/operations/cache-maintenance.js +0 -157
  52. package/dist/core/algorithms/safety/safety-checks.d.ts +0 -18
  53. package/dist/core/algorithms/safety/safety-checks.js +0 -179
  54. package/dist/core/algorithms/strategies/merge-strategies.d.ts +0 -50
  55. package/dist/core/algorithms/strategies/merge-strategies.js +0 -288
  56. package/dist/core/algorithms/types.d.ts +0 -125
  57. package/dist/core/algorithms/types.js +0 -5
  58. package/dist/core/algorithms/utils/response-builder.d.ts +0 -28
  59. package/dist/core/algorithms/utils/response-builder.js +0 -37
  60. package/dist/core/associations.d.ts +0 -33
  61. package/dist/core/associations.js +0 -284
  62. package/dist/core/autosave.d.ts +0 -19
  63. package/dist/core/autosave.js +0 -16
  64. package/dist/core/beliefs/decay.d.ts +0 -27
  65. package/dist/core/beliefs/decay.js +0 -217
  66. package/dist/core/beliefs/extractor.d.ts +0 -9
  67. package/dist/core/beliefs/extractor.js +0 -113
  68. package/dist/core/beliefs/store.d.ts +0 -46
  69. package/dist/core/beliefs/store.js +0 -466
  70. package/dist/core/beliefs/types.d.ts +0 -28
  71. package/dist/core/beliefs/types.js +0 -2
  72. package/dist/core/commands/mcp-server.d.ts +0 -2
  73. package/dist/core/commands/mcp-server.js +0 -6
  74. package/dist/core/commands/remember.d.ts +0 -24
  75. package/dist/core/commands/remember.js +0 -144
  76. package/dist/core/compression.d.ts +0 -45
  77. package/dist/core/compression.js +0 -160
  78. package/dist/core/consolidation.d.ts +0 -37
  79. package/dist/core/consolidation.js +0 -248
  80. package/dist/core/context/agent-context.d.ts +0 -106
  81. package/dist/core/context/agent-context.js +0 -274
  82. package/dist/core/context/context-paging.d.ts +0 -80
  83. package/dist/core/context/context-paging.js +0 -328
  84. package/dist/core/context/context-window.d.ts +0 -40
  85. package/dist/core/context/context-window.js +0 -177
  86. package/dist/core/context/context.d.ts +0 -7
  87. package/dist/core/context/context.js +0 -22
  88. package/dist/core/embeddings/embeddings.d.ts +0 -29
  89. package/dist/core/embeddings/embeddings.js +0 -546
  90. package/dist/core/embeddings/google-multimodal.d.ts +0 -14
  91. package/dist/core/embeddings/google-multimodal.js +0 -146
  92. package/dist/core/embeddings/local-embeddings.d.ts +0 -11
  93. package/dist/core/embeddings/local-embeddings.js +0 -11
  94. package/dist/core/embeddings/qmd-client.d.ts +0 -136
  95. package/dist/core/embeddings/qmd-client.js +0 -403
  96. package/dist/core/embeddings/transformers-local.d.ts +0 -64
  97. package/dist/core/embeddings/transformers-local.js +0 -213
  98. package/dist/core/embeddings.d.ts +0 -2
  99. package/dist/core/embeddings.js +0 -3
  100. package/dist/core/error-handling.d.ts +0 -63
  101. package/dist/core/error-handling.js +0 -173
  102. package/dist/core/graph/entity-deduplicator.d.ts +0 -24
  103. package/dist/core/graph/entity-deduplicator.js +0 -183
  104. package/dist/core/graph/graph-builder.d.ts +0 -46
  105. package/dist/core/graph/graph-builder.js +0 -174
  106. package/dist/core/graph/graph-traversal.d.ts +0 -80
  107. package/dist/core/graph/graph-traversal.js +0 -315
  108. package/dist/core/graph/index.d.ts +0 -19
  109. package/dist/core/graph/index.js +0 -13
  110. package/dist/core/graph/llm-entity-extractor.d.ts +0 -49
  111. package/dist/core/graph/llm-entity-extractor.js +0 -313
  112. package/dist/core/graph/multi-hop-retrieval.d.ts +0 -48
  113. package/dist/core/graph/multi-hop-retrieval.js +0 -215
  114. package/dist/core/graph/relationship-extractor.d.ts +0 -48
  115. package/dist/core/graph/relationship-extractor.js +0 -351
  116. package/dist/core/hooks/agent-hooks.d.ts +0 -83
  117. package/dist/core/hooks/agent-hooks.js +0 -521
  118. package/dist/core/hooks/auto-tagger.d.ts +0 -19
  119. package/dist/core/hooks/auto-tagger.js +0 -155
  120. package/dist/core/hooks/capture-filter.d.ts +0 -41
  121. package/dist/core/hooks/capture-filter.js +0 -128
  122. package/dist/core/hot-cache.d.ts +0 -86
  123. package/dist/core/hot-cache.js +0 -285
  124. package/dist/core/index.d.ts +0 -10
  125. package/dist/core/index.js +0 -11
  126. package/dist/core/ingestion/agent-memory.d.ts +0 -22
  127. package/dist/core/ingestion/agent-memory.js +0 -109
  128. package/dist/core/ingestion/core-memory.d.ts +0 -78
  129. package/dist/core/ingestion/core-memory.js +0 -226
  130. package/dist/core/ingestion/learnings.d.ts +0 -57
  131. package/dist/core/ingestion/learnings.js +0 -205
  132. package/dist/core/ingestion/signal-engine.d.ts +0 -41
  133. package/dist/core/ingestion/signal-engine.js +0 -201
  134. package/dist/core/integrations/obsidian-vault.d.ts +0 -31
  135. package/dist/core/integrations/obsidian-vault.js +0 -156
  136. package/dist/core/layers/generator.d.ts +0 -25
  137. package/dist/core/layers/generator.js +0 -76
  138. package/dist/core/lib/db-client.d.ts +0 -114
  139. package/dist/core/lib/db-client.js +0 -130
  140. package/dist/core/lib/parse-embedding.d.ts +0 -9
  141. package/dist/core/lib/parse-embedding.js +0 -58
  142. package/dist/core/lib/schemas.d.ts +0 -132
  143. package/dist/core/lib/schemas.js +0 -87
  144. package/dist/core/lib/types.d.ts +0 -45
  145. package/dist/core/lib/types.js +0 -6
  146. package/dist/core/lib/utils.d.ts +0 -18
  147. package/dist/core/lib/utils.js +0 -145
  148. package/dist/core/lib/validation.d.ts +0 -38
  149. package/dist/core/lib/validation.js +0 -151
  150. package/dist/core/lifecycle.d.ts +0 -25
  151. package/dist/core/lifecycle.js +0 -292
  152. package/dist/core/logger.d.ts +0 -17
  153. package/dist/core/logger.js +0 -46
  154. package/dist/core/mcp/client.d.ts +0 -17
  155. package/dist/core/mcp/client.js +0 -101
  156. package/dist/core/mcp/index.d.ts +0 -6
  157. package/dist/core/mcp/index.js +0 -6
  158. package/dist/core/mcp/server.d.ts +0 -18
  159. package/dist/core/mcp/server.js +0 -157
  160. package/dist/core/mcp/standalone-server.d.ts +0 -13
  161. package/dist/core/mcp/standalone-server.js +0 -46
  162. package/dist/core/mcp/tools.d.ts +0 -7
  163. package/dist/core/mcp/tools.js +0 -278
  164. package/dist/core/mcp/types.d.ts +0 -87
  165. package/dist/core/mcp/types.js +0 -48
  166. package/dist/core/memory/bridge-discovery.d.ts +0 -50
  167. package/dist/core/memory/bridge-discovery.js +0 -291
  168. package/dist/core/memory/categorizer.d.ts +0 -27
  169. package/dist/core/memory/categorizer.js +0 -306
  170. package/dist/core/memory/conflict-detector.d.ts +0 -7
  171. package/dist/core/memory/conflict-detector.js +0 -43
  172. package/dist/core/memory/consolidation.d.ts +0 -42
  173. package/dist/core/memory/consolidation.js +0 -277
  174. package/dist/core/memory/context-collector.d.ts +0 -10
  175. package/dist/core/memory/context-collector.js +0 -56
  176. package/dist/core/memory/contradiction-resolver.d.ts +0 -40
  177. package/dist/core/memory/contradiction-resolver.js +0 -368
  178. package/dist/core/memory/edit-workflow.d.ts +0 -19
  179. package/dist/core/memory/edit-workflow.js +0 -120
  180. package/dist/core/memory/entity-extractor.d.ts +0 -37
  181. package/dist/core/memory/entity-extractor.js +0 -350
  182. package/dist/core/memory/entity-resolver.d.ts +0 -23
  183. package/dist/core/memory/entity-resolver.js +0 -64
  184. package/dist/core/memory/explain.d.ts +0 -18
  185. package/dist/core/memory/explain.js +0 -92
  186. package/dist/core/memory/fact-deriver.d.ts +0 -31
  187. package/dist/core/memory/fact-deriver.js +0 -236
  188. package/dist/core/memory/fact-extractor.d.ts +0 -24
  189. package/dist/core/memory/fact-extractor.js +0 -89
  190. package/dist/core/memory/feedback-tracker.d.ts +0 -12
  191. package/dist/core/memory/feedback-tracker.js +0 -155
  192. package/dist/core/memory/hooks.d.ts +0 -88
  193. package/dist/core/memory/hooks.js +0 -174
  194. package/dist/core/memory/hybrid-retrieval.d.ts +0 -27
  195. package/dist/core/memory/hybrid-retrieval.js +0 -37
  196. package/dist/core/memory/hybrid-scorer.d.ts +0 -40
  197. package/dist/core/memory/hybrid-scorer.js +0 -267
  198. package/dist/core/memory/hybrid-search.d.ts +0 -23
  199. package/dist/core/memory/hybrid-search.js +0 -596
  200. package/dist/core/memory/importance.d.ts +0 -46
  201. package/dist/core/memory/importance.js +0 -241
  202. package/dist/core/memory/index.d.ts +0 -9
  203. package/dist/core/memory/index.js +0 -11
  204. package/dist/core/memory/loader.d.ts +0 -31
  205. package/dist/core/memory/loader.js +0 -141
  206. package/dist/core/memory/markdown/markdown-storage.d.ts +0 -72
  207. package/dist/core/memory/markdown/markdown-storage.js +0 -243
  208. package/dist/core/memory/memories.d.ts +0 -43
  209. package/dist/core/memory/memories.js +0 -452
  210. package/dist/core/memory/memory-lifecycle.d.ts +0 -8
  211. package/dist/core/memory/memory-lifecycle.js +0 -47
  212. package/dist/core/memory/memory-manager.d.ts +0 -15
  213. package/dist/core/memory/memory-manager.js +0 -46
  214. package/dist/core/memory/migrate.d.ts +0 -21
  215. package/dist/core/memory/migrate.js +0 -134
  216. package/dist/core/memory/normalization.d.ts +0 -7
  217. package/dist/core/memory/normalization.js +0 -26
  218. package/dist/core/memory/path-strengthener.d.ts +0 -39
  219. package/dist/core/memory/path-strengthener.js +0 -150
  220. package/dist/core/memory/progressive-disclosure.d.ts +0 -43
  221. package/dist/core/memory/progressive-disclosure.js +0 -280
  222. package/dist/core/memory/query-processor.d.ts +0 -21
  223. package/dist/core/memory/query-processor.js +0 -106
  224. package/dist/core/memory/query-rewriter.d.ts +0 -13
  225. package/dist/core/memory/query-rewriter.js +0 -118
  226. package/dist/core/memory/response-analyzer.d.ts +0 -9
  227. package/dist/core/memory/response-analyzer.js +0 -61
  228. package/dist/core/memory/retrieval-feedback.d.ts +0 -70
  229. package/dist/core/memory/retrieval-feedback.js +0 -213
  230. package/dist/core/memory/serialization.d.ts +0 -10
  231. package/dist/core/memory/serialization.js +0 -84
  232. package/dist/core/memory/stale-cleaner.d.ts +0 -26
  233. package/dist/core/memory/stale-cleaner.js +0 -97
  234. package/dist/core/memory/stats.d.ts +0 -32
  235. package/dist/core/memory/stats.js +0 -143
  236. package/dist/core/memory/telemetry.d.ts +0 -69
  237. package/dist/core/memory/telemetry.js +0 -313
  238. package/dist/core/memory/temporal-facts.d.ts +0 -41
  239. package/dist/core/memory/temporal-facts.js +0 -283
  240. package/dist/core/memory/temporal-parser.d.ts +0 -32
  241. package/dist/core/memory/temporal-parser.js +0 -385
  242. package/dist/core/memory/trigger-detector.d.ts +0 -21
  243. package/dist/core/memory/trigger-detector.js +0 -79
  244. package/dist/core/memory/write-gate.d.ts +0 -54
  245. package/dist/core/memory/write-gate.js +0 -210
  246. package/dist/core/places/index.d.ts +0 -14
  247. package/dist/core/places/index.js +0 -14
  248. package/dist/core/places/memory-places.d.ts +0 -68
  249. package/dist/core/places/memory-places.js +0 -261
  250. package/dist/core/places/places.d.ts +0 -88
  251. package/dist/core/places/places.js +0 -314
  252. package/dist/core/places/rules.d.ts +0 -74
  253. package/dist/core/places/rules.js +0 -240
  254. package/dist/core/places/walking.d.ts +0 -56
  255. package/dist/core/places/walking.js +0 -121
  256. package/dist/core/projects.d.ts +0 -17
  257. package/dist/core/projects.js +0 -116
  258. package/dist/core/redis.d.ts +0 -11
  259. package/dist/core/redis.js +0 -69
  260. package/dist/core/responses.d.ts +0 -96
  261. package/dist/core/responses.js +0 -122
  262. package/dist/core/runtime/trust-report.d.ts +0 -102
  263. package/dist/core/runtime/trust-report.js +0 -107
  264. package/dist/core/runtime/trust-state.d.ts +0 -12
  265. package/dist/core/runtime/trust-state.js +0 -309
  266. package/dist/core/scheduler/cron-scheduler.d.ts +0 -32
  267. package/dist/core/scheduler/cron-scheduler.js +0 -493
  268. package/dist/core/scheduler/heartbeat.d.ts +0 -11
  269. package/dist/core/scheduler/heartbeat.js +0 -73
  270. package/dist/core/scheduler/index.d.ts +0 -8
  271. package/dist/core/scheduler/index.js +0 -8
  272. package/dist/core/scheduler/job-runner.d.ts +0 -11
  273. package/dist/core/scheduler/job-runner.js +0 -164
  274. package/dist/core/search/conversations.d.ts +0 -25
  275. package/dist/core/search/conversations.js +0 -110
  276. package/dist/core/search/entities.d.ts +0 -12
  277. package/dist/core/search/entities.js +0 -31
  278. package/dist/core/search/folder-context.d.ts +0 -25
  279. package/dist/core/search/folder-context.js +0 -119
  280. package/dist/core/search/graph-boost.d.ts +0 -7
  281. package/dist/core/search/graph-boost.js +0 -23
  282. package/dist/core/search/index.d.ts +0 -4
  283. package/dist/core/search/index.js +0 -5
  284. package/dist/core/search/qmd-wrapper.d.ts +0 -36
  285. package/dist/core/search/qmd-wrapper.js +0 -58
  286. package/dist/core/security/encrypt.d.ts +0 -6
  287. package/dist/core/security/encrypt.js +0 -47
  288. package/dist/core/security/governance.d.ts +0 -26
  289. package/dist/core/security/governance.js +0 -79
  290. package/dist/core/security/privacy.d.ts +0 -23
  291. package/dist/core/security/privacy.js +0 -82
  292. package/dist/core/security/secret-detector.d.ts +0 -32
  293. package/dist/core/security/secret-detector.js +0 -88
  294. package/dist/core/session/auto-load.d.ts +0 -6
  295. package/dist/core/session/auto-load.js +0 -144
  296. package/dist/core/session/entity-tracker.d.ts +0 -62
  297. package/dist/core/session/entity-tracker.js +0 -287
  298. package/dist/core/session/index.d.ts +0 -7
  299. package/dist/core/session/index.js +0 -7
  300. package/dist/core/session/reference-resolver.d.ts +0 -26
  301. package/dist/core/session/reference-resolver.js +0 -121
  302. package/dist/core/session/self-iteration-job.d.ts +0 -35
  303. package/dist/core/session/self-iteration-job.js +0 -387
  304. package/dist/core/session/session-hooks.d.ts +0 -18
  305. package/dist/core/session/session-hooks.js +0 -58
  306. package/dist/core/session/types.d.ts +0 -26
  307. package/dist/core/session/types.js +0 -10
  308. package/dist/core/session/working-set.d.ts +0 -50
  309. package/dist/core/session/working-set.js +0 -212
  310. package/dist/core/snapshots/cleanup.d.ts +0 -9
  311. package/dist/core/snapshots/cleanup.js +0 -12
  312. package/dist/core/snapshots/comparison.d.ts +0 -19
  313. package/dist/core/snapshots/comparison.js +0 -43
  314. package/dist/core/snapshots/creation.d.ts +0 -13
  315. package/dist/core/snapshots/creation.js +0 -117
  316. package/dist/core/snapshots/retrieval.d.ts +0 -7
  317. package/dist/core/snapshots/retrieval.js +0 -41
  318. package/dist/core/snapshots/stats.d.ts +0 -11
  319. package/dist/core/snapshots/stats.js +0 -52
  320. package/dist/core/storage/cache.d.ts +0 -13
  321. package/dist/core/storage/cache.js +0 -202
  322. package/dist/core/storage/database.d.ts +0 -12
  323. package/dist/core/storage/database.js +0 -12
  324. package/dist/core/summarization/cleanup.d.ts +0 -9
  325. package/dist/core/summarization/cleanup.js +0 -12
  326. package/dist/core/summarization/queries.d.ts +0 -9
  327. package/dist/core/summarization/queries.js +0 -28
  328. package/dist/core/summarization/stats.d.ts +0 -14
  329. package/dist/core/summarization/stats.js +0 -52
  330. package/dist/core/summarization/strategies.d.ts +0 -24
  331. package/dist/core/summarization/strategies.js +0 -28
  332. package/dist/core/summarization.d.ts +0 -37
  333. package/dist/core/summarization.js +0 -188
  334. package/dist/core/temporal-facts.d.ts +0 -54
  335. package/dist/core/temporal-facts.js +0 -193
  336. package/dist/core/tracing/collector.d.ts +0 -111
  337. package/dist/core/tracing/collector.js +0 -350
  338. package/dist/core/tracing/visualizer.d.ts +0 -32
  339. package/dist/core/tracing/visualizer.js +0 -165
  340. package/dist/core/utils/cleanup-operations.d.ts +0 -13
  341. package/dist/core/utils/cleanup-operations.js +0 -44
  342. package/dist/core/utils/content-extraction.d.ts +0 -19
  343. package/dist/core/utils/content-extraction.js +0 -75
  344. package/dist/core/utils/filter-builder.d.ts +0 -13
  345. package/dist/core/utils/filter-builder.js +0 -44
  346. package/dist/core/utils/history-traversal.d.ts +0 -13
  347. package/dist/core/utils/history-traversal.js +0 -50
  348. package/dist/core/utils/memory-operations.d.ts +0 -17
  349. package/dist/core/utils/memory-operations.js +0 -43
  350. package/dist/core/utils/query-operations.d.ts +0 -18
  351. package/dist/core/utils/query-operations.js +0 -65
  352. package/dist/core/utils/summarization-helpers.d.ts +0 -17
  353. package/dist/core/utils/summarization-helpers.js +0 -33
  354. package/dist/core/utils/temporal-queries.d.ts +0 -13
  355. package/dist/core/utils/temporal-queries.js +0 -27
  356. package/dist/core/utils/vector-operations.d.ts +0 -71
  357. package/dist/core/utils/vector-operations.js +0 -129
  358. package/dist/core/utils/version-management.d.ts +0 -9
  359. package/dist/core/utils/version-management.js +0 -61
  360. package/dist/core/worker.d.ts +0 -82
  361. package/dist/core/worker.js +0 -272
  362. package/dist/db/adapter.d.ts +0 -7
  363. package/dist/db/adapter.js +0 -175
  364. package/dist/db/bootstrap.d.ts +0 -11
  365. package/dist/db/bootstrap.js +0 -1034
  366. package/dist/db/drizzle/schema-sqlite.d.ts +0 -5538
  367. package/dist/db/drizzle/schema-sqlite.js +0 -763
  368. package/dist/db/drizzle/schema.d.ts +0 -4734
  369. package/dist/db/drizzle/schema.js +0 -859
  370. package/dist/db/drizzle.config.d.ts +0 -3
  371. package/dist/db/drizzle.config.js +0 -12
  372. package/dist/db/index.d.ts +0 -7
  373. package/dist/db/index.js +0 -89
  374. package/dist/db/migrations/associations.d.ts +0 -6
  375. package/dist/db/migrations/associations.js +0 -29
  376. package/dist/db/migrations/beliefs.d.ts +0 -10
  377. package/dist/db/migrations/beliefs.js +0 -76
  378. package/dist/db/migrations/core-memory.d.ts +0 -6
  379. package/dist/db/migrations/core-memory.js +0 -29
  380. package/dist/db/migrations/fts.d.ts +0 -6
  381. package/dist/db/migrations/fts.js +0 -52
  382. package/dist/db/migrations/index.d.ts +0 -25
  383. package/dist/db/migrations/index.js +0 -51
  384. package/dist/db/migrations/indexes.d.ts +0 -6
  385. package/dist/db/migrations/indexes.js +0 -30
  386. package/dist/db/migrations/learnings.d.ts +0 -7
  387. package/dist/db/migrations/learnings.js +0 -26
  388. package/dist/db/migrations/maintenance.d.ts +0 -6
  389. package/dist/db/migrations/maintenance.js +0 -61
  390. package/dist/db/migrations/memories.d.ts +0 -7
  391. package/dist/db/migrations/memories.js +0 -16
  392. package/dist/db/migrations/memory-places.d.ts +0 -6
  393. package/dist/db/migrations/memory-places.js +0 -29
  394. package/dist/db/migrations/places.d.ts +0 -6
  395. package/dist/db/migrations/places.js +0 -43
  396. package/dist/db/migrations/projects.d.ts +0 -3
  397. package/dist/db/migrations/projects.js +0 -13
  398. package/dist/db/migrations/tier-conversion.d.ts +0 -7
  399. package/dist/db/migrations/tier-conversion.js +0 -20
  400. package/dist/db/neon.d.ts +0 -8
  401. package/dist/db/neon.js +0 -20
  402. package/dist/db/schema/beliefs.d.ts +0 -9
  403. package/dist/db/schema/beliefs.js +0 -46
  404. package/dist/db/schema/generator.d.ts +0 -38
  405. package/dist/db/schema/generator.js +0 -108
  406. package/dist/db/schema/index.d.ts +0 -39
  407. package/dist/db/schema/index.js +0 -51
  408. package/dist/db/schema/learnings.d.ts +0 -7
  409. package/dist/db/schema/learnings.js +0 -30
  410. package/dist/db/schema/memories.d.ts +0 -7
  411. package/dist/db/schema/memories.js +0 -81
  412. package/dist/db/schema/projects.d.ts +0 -4
  413. package/dist/db/schema/projects.js +0 -31
  414. package/dist/db/schema/tables/context-sessions.d.ts +0 -9
  415. package/dist/db/schema/tables/context-sessions.js +0 -37
  416. package/dist/db/schema/tables/conversations.d.ts +0 -9
  417. package/dist/db/schema/tables/conversations.js +0 -47
  418. package/dist/db/schema/tables/core-memory.d.ts +0 -9
  419. package/dist/db/schema/tables/core-memory.js +0 -41
  420. package/dist/db/schema/tables/entities.d.ts +0 -9
  421. package/dist/db/schema/tables/entities.js +0 -39
  422. package/dist/db/schema/tables/entity-relations.d.ts +0 -9
  423. package/dist/db/schema/tables/entity-relations.js +0 -31
  424. package/dist/db/schema/tables/learnings.d.ts +0 -9
  425. package/dist/db/schema/tables/learnings.js +0 -66
  426. package/dist/db/schema/tables/memories.d.ts +0 -9
  427. package/dist/db/schema/tables/memories.js +0 -161
  428. package/dist/db/schema/tables/memory-associations.d.ts +0 -9
  429. package/dist/db/schema/tables/memory-associations.js +0 -39
  430. package/dist/db/schema/tables/memory-hash-cache.d.ts +0 -9
  431. package/dist/db/schema/tables/memory-hash-cache.js +0 -29
  432. package/dist/db/schema/tables/memory-merge-history.d.ts +0 -9
  433. package/dist/db/schema/tables/memory-merge-history.js +0 -33
  434. package/dist/db/schema/tables/memory-merge-proposals.d.ts +0 -9
  435. package/dist/db/schema/tables/memory-merge-proposals.js +0 -39
  436. package/dist/db/schema/tables/messages.d.ts +0 -9
  437. package/dist/db/schema/tables/messages.js +0 -41
  438. package/dist/db/schema/tables/namespaces.d.ts +0 -9
  439. package/dist/db/schema/tables/namespaces.js +0 -37
  440. package/dist/db/schema/tables/projects.d.ts +0 -9
  441. package/dist/db/schema/tables/projects.js +0 -31
  442. package/dist/db/schema/tables/users.d.ts +0 -9
  443. package/dist/db/schema/tables/users.js +0 -27
  444. package/dist/db/schema.d.ts +0 -3
  445. package/dist/db/schema.js +0 -11
  446. package/dist/db/supabase.d.ts +0 -9
  447. package/dist/db/supabase.js +0 -24
  448. package/dist/packages/mcp/src/index.d.ts +0 -3
  449. package/dist/packages/mcp/src/index.js +0 -733
@@ -1,3 +0,0 @@
1
- declare const _default: import("drizzle-kit").Config;
2
- export default _default;
3
- //# sourceMappingURL=drizzle.config.d.ts.map
@@ -1,12 +0,0 @@
1
- import { defineConfig } from 'drizzle-kit';
2
- export default defineConfig({
3
- schema: './drizzle/schema.ts',
4
- out: './drizzle/migrations',
5
- dialect: 'postgresql',
6
- dbCredentials: {
7
- url: process.env.DATABASE_URL || 'postgres://squish:squish_dev@localhost:5432/squish',
8
- },
9
- verbose: true,
10
- strict: true,
11
- });
12
- //# sourceMappingURL=drizzle.config.js.map
@@ -1,7 +0,0 @@
1
- import { createDb } from './adapter.js';
2
- import { config } from '../config.js';
3
- export declare function getDb(): Promise<any>;
4
- export declare function checkDatabaseHealth(): Promise<boolean>;
5
- export { config };
6
- export { createDb };
7
- //# sourceMappingURL=index.d.ts.map
package/dist/db/index.js DELETED
@@ -1,89 +0,0 @@
1
- import { createDb } from './adapter.js';
2
- import { config } from '../config.js';
3
- import { logger } from '../core/logger.js';
4
- import { isDatabaseUnavailableError } from '../core/lib/utils.js';
5
- // Use any for db to avoid type conflicts between different drivers
6
- // The actual type will be determined at runtime based on mode
7
- let db = null;
8
- let dbError = null;
9
- export async function getDb() {
10
- if (dbError) {
11
- throw new Error(dbError);
12
- }
13
- if (!db) {
14
- try {
15
- // Priority: remote (user's Supabase/Neon) > team (PostgreSQL) > local (SQLite)
16
- if (config.isRemoteMode) {
17
- if (config.remoteBackend === 'neon' && config.neonProjectId && config.neonServiceKey) {
18
- const { createNeonClient } = await import('./neon.js');
19
- db = await createNeonClient();
20
- }
21
- else if (config.supabaseUrl && config.supabaseKey) {
22
- const { createSupabaseClient } = await import('./supabase.js');
23
- db = await createSupabaseClient();
24
- }
25
- else {
26
- throw new Error('Remote backend not configured (need SUPABASE_URL or NEON_PROJECT_ID)');
27
- }
28
- }
29
- else if (config.isTeamMode) {
30
- // Team mode: PostgreSQL (or Supabase/Neon if explicitly configured)
31
- if (config.teamBackend === 'supabase' && config.supabaseUrl && config.supabaseKey) {
32
- const { createSupabaseClient } = await import('./supabase.js');
33
- db = await createSupabaseClient();
34
- }
35
- else if (config.teamBackend === 'neon' && config.neonProjectId && config.neonServiceKey) {
36
- const { createNeonClient } = await import('./neon.js');
37
- db = await createNeonClient();
38
- }
39
- else {
40
- db = await createDb();
41
- }
42
- }
43
- else {
44
- // Local mode: SQLite
45
- db = await createDb();
46
- }
47
- }
48
- catch (error) {
49
- dbError = error instanceof Error ? error.message : 'Database initialization failed';
50
- throw new Error(dbError);
51
- }
52
- }
53
- return db;
54
- }
55
- export async function checkDatabaseHealth() {
56
- try {
57
- const database = await getDb();
58
- const dbClient = database.$client ?? database;
59
- if (dbClient && typeof dbClient.query === 'function') {
60
- await dbClient.query('SELECT 1');
61
- }
62
- else if (dbClient && typeof dbClient.exec === 'function') {
63
- dbClient.exec('SELECT 1');
64
- }
65
- else if (dbClient && typeof dbClient.prepare === 'function') {
66
- const statement = dbClient.prepare('SELECT 1');
67
- if (typeof statement.get === 'function') {
68
- statement.get();
69
- }
70
- else if (typeof statement.step === 'function') {
71
- statement.step();
72
- }
73
- if (typeof statement.free === 'function') {
74
- statement.free();
75
- }
76
- }
77
- return true;
78
- }
79
- catch (error) {
80
- if (isDatabaseUnavailableError(error)) {
81
- return false;
82
- }
83
- logger.error('Database health check failed', error);
84
- return false;
85
- }
86
- }
87
- export { config };
88
- export { createDb };
89
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Memory associations table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runAssociationsMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=associations.d.ts.map
@@ -1,29 +0,0 @@
1
- /**
2
- * Memory associations table migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runAssociationsMigrations(sqlite) {
6
- const associationsTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memory_associations'").get();
7
- if (!associationsTableCheck)
8
- return;
9
- const associationsInfo = sqlite.prepare("PRAGMA table_info(memory_associations)").all();
10
- const existingAssociationsColumns = new Set(associationsInfo.map(col => col.name));
11
- const associationsMigrations = [
12
- { col: 'metadata', sql: 'ALTER TABLE memory_associations ADD COLUMN metadata TEXT' },
13
- ];
14
- for (const migration of associationsMigrations) {
15
- if (!existingAssociationsColumns.has(migration.col)) {
16
- try {
17
- sqlite.exec(migration.sql);
18
- logger.info(`Migration: Added column ${migration.col} to memory_associations table`);
19
- }
20
- catch (error) {
21
- const msg = error instanceof Error ? error.message : String(error);
22
- if (!msg.includes('duplicate column name')) {
23
- throw new Error(`Migration failed for memory_associations.${migration.col}: ${msg}`);
24
- }
25
- }
26
- }
27
- }
28
- }
29
- //# sourceMappingURL=associations.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * Beliefs table migrations
3
- * Uses schema definitions to generate migrations
4
- *
5
- * For existing databases without beliefs table (pre-v1.2.0), creates the table.
6
- * Then runs column migrations for all belief-related tables.
7
- */
8
- import type { Database } from 'better-sqlite3';
9
- export declare function runBeliefMigrations(sqlite: Database): Promise<void>;
10
- //# sourceMappingURL=beliefs.d.ts.map
@@ -1,76 +0,0 @@
1
- /**
2
- * Beliefs table migrations
3
- * Uses schema definitions to generate migrations
4
- *
5
- * For existing databases without beliefs table (pre-v1.2.0), creates the table.
6
- * Then runs column migrations for all belief-related tables.
7
- */
8
- import { migrateTable } from '../schema/generator.js';
9
- import { beliefsSchema, beliefMemorySourcesSchema, beliefEdgesSchema } from '../schema/beliefs.js';
10
- import { logger } from '../../core/logger.js';
11
- export async function runBeliefMigrations(sqlite) {
12
- // Check if beliefs table exists at all (for existing databases pre-v1.2.0)
13
- const beliefsCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='beliefs'").get();
14
- if (!beliefsCheck) {
15
- // Create beliefs table for existing databases upgrading to v1.2.0
16
- logger.info('Migration: Creating beliefs table for existing database');
17
- try {
18
- sqlite.exec(`
19
- CREATE TABLE IF NOT EXISTS beliefs (
20
- id TEXT PRIMARY KEY,
21
- project_id TEXT,
22
- belief_type TEXT NOT NULL,
23
- statement TEXT NOT NULL,
24
- normalized_key TEXT NOT NULL,
25
- confidence REAL DEFAULT 0.5,
26
- belief_decay_rate INTEGER DEFAULT 30,
27
- last_confirmed_at INTEGER,
28
- source_count INTEGER DEFAULT 1,
29
- status TEXT DEFAULT 'active',
30
- reason TEXT,
31
- context TEXT,
32
- evidence_summary TEXT,
33
- metadata TEXT,
34
- created_at INTEGER,
35
- updated_at INTEGER,
36
- UNIQUE(project_id, normalized_key)
37
- )
38
- `);
39
- }
40
- catch (error) {
41
- const msg = error instanceof Error ? error.message : String(error);
42
- logger.warn(`Migration: Could not create beliefs table: ${msg}`);
43
- }
44
- }
45
- const beliefSourcesCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='belief_memory_sources'").get();
46
- if (!beliefSourcesCheck) {
47
- sqlite.exec(`
48
- CREATE TABLE IF NOT EXISTS belief_memory_sources (
49
- id TEXT PRIMARY KEY,
50
- belief_id TEXT,
51
- memory_id TEXT,
52
- created_at INTEGER,
53
- UNIQUE(belief_id, memory_id)
54
- )
55
- `);
56
- }
57
- const beliefEdgesCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='belief_edges'").get();
58
- if (!beliefEdgesCheck) {
59
- sqlite.exec(`
60
- CREATE TABLE IF NOT EXISTS belief_edges (
61
- id TEXT PRIMARY KEY,
62
- from_belief_id TEXT,
63
- to_belief_id TEXT,
64
- edge_type TEXT NOT NULL,
65
- metadata TEXT,
66
- created_at INTEGER,
67
- UNIQUE(from_belief_id, to_belief_id, edge_type)
68
- )
69
- `);
70
- }
71
- // Run column migrations - adds missing columns to existing tables
72
- await migrateTable(sqlite, beliefsSchema);
73
- await migrateTable(sqlite, beliefMemorySourcesSchema);
74
- await migrateTable(sqlite, beliefEdgesSchema);
75
- }
76
- //# sourceMappingURL=beliefs.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Core memory table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runCoreMemoryMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=core-memory.d.ts.map
@@ -1,29 +0,0 @@
1
- /**
2
- * Core memory table migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runCoreMemoryMigrations(sqlite) {
6
- const coreMemoryTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='core_memory'").get();
7
- if (!coreMemoryTableCheck)
8
- return;
9
- const coreMemoryInfo = sqlite.prepare("PRAGMA table_info(core_memory)").all();
10
- const existingCoreMemoryColumns = new Set(coreMemoryInfo.map(col => col.name));
11
- const coreMemoryMigrations = [
12
- { col: 'tokens_estimate', sql: 'ALTER TABLE core_memory ADD COLUMN tokens_estimate INTEGER DEFAULT 0 NOT NULL' },
13
- ];
14
- for (const migration of coreMemoryMigrations) {
15
- if (!existingCoreMemoryColumns.has(migration.col)) {
16
- try {
17
- sqlite.exec(migration.sql);
18
- logger.info(`Migration: Added column ${migration.col} to core_memory table`);
19
- }
20
- catch (error) {
21
- const msg = error instanceof Error ? error.message : String(error);
22
- if (!msg.includes('duplicate column name')) {
23
- throw new Error(`Migration failed for core_memory.${migration.col}: ${msg}`);
24
- }
25
- }
26
- }
27
- }
28
- }
29
- //# sourceMappingURL=core-memory.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * FTS (Full-Text Search) table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runFtsMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=fts.d.ts.map
@@ -1,52 +0,0 @@
1
- /**
2
- * FTS (Full-Text Search) table migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runFtsMigrations(sqlite) {
6
- const ftsTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories_fts'").get();
7
- if (!ftsTableCheck)
8
- return;
9
- const ftsInfo = sqlite.prepare("PRAGMA table_info(memories_fts)").all();
10
- const existingFtsColumns = new Set(ftsInfo.map(col => col.name));
11
- if (!existingFtsColumns.has('summary') && existingFtsColumns.has('tags')) {
12
- logger.info('Migration: Recreating memories_fts table to add summary column...');
13
- try {
14
- sqlite.exec('DROP TRIGGER IF EXISTS memories_ai');
15
- sqlite.exec('DROP TRIGGER IF EXISTS memories_ad');
16
- sqlite.exec('DROP TRIGGER IF EXISTS memories_au');
17
- sqlite.exec('DROP TABLE IF EXISTS memories_fts');
18
- sqlite.exec(`
19
- CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
20
- content,
21
- tags,
22
- summary,
23
- content='memories',
24
- content_rowid='rowid'
25
- );
26
-
27
- CREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN
28
- INSERT INTO memories_fts(rowid, content, tags, summary)
29
- VALUES (new.rowid, new.content, COALESCE(new.tags, ''), COALESCE(new.summary, ''));
30
- END;
31
-
32
- CREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN
33
- INSERT INTO memories_fts(memories_fts, rowid, content, tags, summary)
34
- VALUES ('delete', old.rowid, old.content, COALESCE(old.tags, ''), COALESCE(old.summary, ''));
35
- END;
36
-
37
- CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN
38
- INSERT INTO memories_fts(memories_fts, rowid, content, tags, summary)
39
- VALUES ('delete', old.rowid, old.content, COALESCE(old.tags, ''), COALESCE(old.summary, ''));
40
- INSERT INTO memories_fts(rowid, content, tags, summary)
41
- VALUES (new.rowid, new.content, COALESCE(new.tags, ''), COALESCE(new.summary, ''));
42
- END;
43
- `);
44
- logger.info('Migration: Recreated memories_fts table with summary column');
45
- }
46
- catch (error) {
47
- const msg = error instanceof Error ? error.message : String(error);
48
- logger.warn(`Migration: Could not recreate memories_fts table: ${msg}`);
49
- }
50
- }
51
- }
52
- //# sourceMappingURL=fts.js.map
@@ -1,25 +0,0 @@
1
- /**
2
- * Migration runner - imports and runs all migrations
3
- *
4
- * Usage:
5
- * import { runAllMigrations } from './migrations/index.js';
6
- * await runAllMigrations(sqlite);
7
- */
8
- import type { Database } from 'better-sqlite3';
9
- /**
10
- * Run all v1.2.0 migrations in order
11
- */
12
- export declare function runAllMigrations(sqlite: Database): Promise<void>;
13
- export { runPlacesMigrations } from './places.js';
14
- export { runProjectMigrations } from './projects.js';
15
- export { runMemoriesMigrations } from './memories.js';
16
- export { runLearningsMigrations } from './learnings.js';
17
- export { runCoreMemoryMigrations } from './core-memory.js';
18
- export { runAssociationsMigrations } from './associations.js';
19
- export { runMemoryPlacesMigrations } from './memory-places.js';
20
- export { runIndexMigrations } from './indexes.js';
21
- export { runFtsMigrations } from './fts.js';
22
- export { runMaintenanceMigrations } from './maintenance.js';
23
- export { runBeliefMigrations } from './beliefs.js';
24
- export { runTierConversion } from './tier-conversion.js';
25
- //# sourceMappingURL=index.d.ts.map
@@ -1,51 +0,0 @@
1
- /**
2
- * Migration runner - imports and runs all migrations
3
- *
4
- * Usage:
5
- * import { runAllMigrations } from './migrations/index.js';
6
- * await runAllMigrations(sqlite);
7
- */
8
- import { runPlacesMigrations } from './places.js';
9
- import { runProjectMigrations } from './projects.js';
10
- import { runMemoriesMigrations } from './memories.js';
11
- import { runLearningsMigrations } from './learnings.js';
12
- import { runCoreMemoryMigrations } from './core-memory.js';
13
- import { runAssociationsMigrations } from './associations.js';
14
- import { runMemoryPlacesMigrations } from './memory-places.js';
15
- import { runIndexMigrations } from './indexes.js';
16
- import { runFtsMigrations } from './fts.js';
17
- import { runMaintenanceMigrations } from './maintenance.js';
18
- import { runBeliefMigrations } from './beliefs.js';
19
- import { runTierConversion } from './tier-conversion.js';
20
- /**
21
- * Run all v1.2.0 migrations in order
22
- */
23
- export async function runAllMigrations(sqlite) {
24
- // Run each migration in dependency order
25
- await runProjectMigrations(sqlite);
26
- await runPlacesMigrations(sqlite);
27
- await runMemoriesMigrations(sqlite);
28
- await runLearningsMigrations(sqlite);
29
- await runCoreMemoryMigrations(sqlite);
30
- await runAssociationsMigrations(sqlite);
31
- await runMemoryPlacesMigrations(sqlite);
32
- await runIndexMigrations(sqlite);
33
- await runFtsMigrations(sqlite);
34
- await runMaintenanceMigrations(sqlite);
35
- await runBeliefMigrations(sqlite);
36
- await runTierConversion(sqlite);
37
- }
38
- // Re-export for direct usage if needed
39
- export { runPlacesMigrations } from './places.js';
40
- export { runProjectMigrations } from './projects.js';
41
- export { runMemoriesMigrations } from './memories.js';
42
- export { runLearningsMigrations } from './learnings.js';
43
- export { runCoreMemoryMigrations } from './core-memory.js';
44
- export { runAssociationsMigrations } from './associations.js';
45
- export { runMemoryPlacesMigrations } from './memory-places.js';
46
- export { runIndexMigrations } from './indexes.js';
47
- export { runFtsMigrations } from './fts.js';
48
- export { runMaintenanceMigrations } from './maintenance.js';
49
- export { runBeliefMigrations } from './beliefs.js';
50
- export { runTierConversion } from './tier-conversion.js';
51
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Learnings index migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runIndexMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=indexes.d.ts.map
@@ -1,30 +0,0 @@
1
- /**
2
- * Learnings index migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runIndexMigrations(sqlite) {
6
- const learningsTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='learnings'").get();
7
- if (!learningsTableCheck)
8
- return;
9
- const existingIndexes = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='learnings'").all();
10
- const existingIndexNames = new Set(existingIndexes.map(idx => idx.name));
11
- const indexMigrations = [
12
- { name: 'learnings_folder_idx', sql: 'CREATE INDEX IF NOT EXISTS learnings_folder_idx ON learnings(folder_path)' },
13
- { name: 'learnings_relevance_idx', sql: 'CREATE INDEX IF NOT EXISTS learnings_relevance_idx ON learnings(relevance_score)' },
14
- { name: 'learnings_private_idx', sql: 'CREATE INDEX IF NOT EXISTS learnings_private_idx ON learnings(is_private)' },
15
- { name: 'learnings_memory_idx', sql: 'CREATE INDEX IF NOT EXISTS learnings_memory_idx ON learnings(memory_id)' },
16
- ];
17
- for (const idx of indexMigrations) {
18
- if (!existingIndexNames.has(idx.name)) {
19
- try {
20
- sqlite.exec(idx.sql);
21
- logger.info(`Migration: Added index ${idx.name} to learnings table`);
22
- }
23
- catch (error) {
24
- const msg = error instanceof Error ? error.message : String(error);
25
- logger.warn(`Index migration note for ${idx.name}: ${msg}`);
26
- }
27
- }
28
- }
29
- }
30
- //# sourceMappingURL=indexes.js.map
@@ -1,7 +0,0 @@
1
- /**
2
- * Learnings table migrations
3
- * Uses schema definitions to generate migrations
4
- */
5
- import type { Database } from 'better-sqlite3';
6
- export declare function runLearningsMigrations(sqlite: Database): Promise<void>;
7
- //# sourceMappingURL=learnings.d.ts.map
@@ -1,26 +0,0 @@
1
- /**
2
- * Learnings table migrations
3
- * Uses schema definitions to generate migrations
4
- */
5
- import { migrateTable } from '../schema/generator.js';
6
- import { learningsSchema } from '../schema/learnings.js';
7
- import { logger } from '../../core/logger.js';
8
- export async function runLearningsMigrations(sqlite) {
9
- // Handle table rename: observations -> learnings
10
- const observationsCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='observations'").get();
11
- const learningsCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='learnings'").get();
12
- if (observationsCheck && !learningsCheck) {
13
- try {
14
- sqlite.exec("ALTER TABLE observations RENAME TO learnings");
15
- logger.info('Migration: Renamed observations table to learnings');
16
- }
17
- catch (error) {
18
- const msg = error instanceof Error ? error.message : String(error);
19
- logger.warn(`Migration: Could not rename observations to learnings: ${msg}`);
20
- }
21
- }
22
- if (!learningsCheck)
23
- return;
24
- await migrateTable(sqlite, learningsSchema);
25
- }
26
- //# sourceMappingURL=learnings.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Maintenance jobs table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runMaintenanceMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=maintenance.d.ts.map
@@ -1,61 +0,0 @@
1
- /**
2
- * Maintenance jobs table migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runMaintenanceMigrations(sqlite) {
6
- const maintenanceJobsTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='maintenance_jobs'").get();
7
- if (!maintenanceJobsTableCheck)
8
- return;
9
- const maintenanceJobsInfo = sqlite.prepare("PRAGMA table_info(maintenance_jobs)").all();
10
- const existingMaintenanceJobsColumns = new Set(maintenanceJobsInfo.map(col => col.name));
11
- // Check if table has wrong schema (camelCase columns from bug in earlier version)
12
- const hasCamelCaseColumns = existingMaintenanceJobsColumns.has('jobName') ||
13
- existingMaintenanceJobsColumns.has('jobType') ||
14
- existingMaintenanceJobsColumns.has('cronExpression');
15
- if (hasCamelCaseColumns) {
16
- logger.warn('Maintenance jobs table has incorrect schema (camelCase columns). Recreating...');
17
- try {
18
- sqlite.exec('DROP TABLE IF EXISTS maintenance_jobs');
19
- logger.info('Dropped malformed maintenance_jobs table. It will be recreated with correct schema.');
20
- }
21
- catch (error) {
22
- logger.error('Failed to recreate maintenance_jobs table:', error);
23
- }
24
- return;
25
- }
26
- const maintenanceJobsMigrations = [
27
- { col: 'schedule', sql: 'ALTER TABLE maintenance_jobs DROP COLUMN schedule' },
28
- { col: 'cron_expression', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN cron_expression TEXT' },
29
- { col: 'last_run_at', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN last_run_at INTEGER' },
30
- { col: 'last_run_duration', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN last_run_duration INTEGER' },
31
- { col: 'last_run_status', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN last_run_status TEXT' },
32
- { col: 'last_run_error', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN last_run_error TEXT' },
33
- { col: 'total_runs', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN total_runs INTEGER DEFAULT 0' },
34
- { col: 'success_count', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN success_count INTEGER DEFAULT 0' },
35
- { col: 'failure_count', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN failure_count INTEGER DEFAULT 0' },
36
- { col: 'job_config', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN job_config TEXT' },
37
- { col: 'next_run_at', sql: 'ALTER TABLE maintenance_jobs ADD COLUMN next_run_at INTEGER' },
38
- { col: 'run_count', sql: 'ALTER TABLE maintenance_jobs DROP COLUMN run_count' },
39
- ];
40
- for (const migration of maintenanceJobsMigrations) {
41
- const shouldRun = migration.sql.startsWith('ALTER TABLE maintenance_jobs DROP COLUMN')
42
- ? existingMaintenanceJobsColumns.has(migration.col)
43
- : !existingMaintenanceJobsColumns.has(migration.col);
44
- if (shouldRun) {
45
- try {
46
- sqlite.exec(migration.sql);
47
- logger.info(`Migration: ${migration.col} on maintenance_jobs table`);
48
- }
49
- catch (error) {
50
- const msg = error instanceof Error ? error.message : String(error);
51
- if (msg.includes('duplicate column name') || msg.includes('no such column')) {
52
- logger.debug(`Migration skipped for ${migration.col}: ${msg.includes('duplicate column name') ? 'column already exists' : 'column does not exist'}`);
53
- }
54
- else {
55
- throw new Error(`Migration failed for maintenance_jobs.${migration.col}: ${msg}`);
56
- }
57
- }
58
- }
59
- }
60
- }
61
- //# sourceMappingURL=maintenance.js.map
@@ -1,7 +0,0 @@
1
- /**
2
- * Memories table migrations
3
- * Uses schema definitions to generate migrations
4
- */
5
- import type { Database } from 'better-sqlite3';
6
- export declare function runMemoriesMigrations(sqlite: Database): Promise<void>;
7
- //# sourceMappingURL=memories.d.ts.map
@@ -1,16 +0,0 @@
1
- /**
2
- * Memories table migrations
3
- * Uses schema definitions to generate migrations
4
- */
5
- import { migrateTable } from '../schema/generator.js';
6
- import { memoriesSchema } from '../schema/memories.js';
7
- import { logger } from '../../core/logger.js';
8
- export async function runMemoriesMigrations(sqlite) {
9
- const tableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories'").get();
10
- if (!tableCheck) {
11
- logger.debug('Memories table does not exist yet, skipping migrations');
12
- return;
13
- }
14
- await migrateTable(sqlite, memoriesSchema);
15
- }
16
- //# sourceMappingURL=memories.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Memory places table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runMemoryPlacesMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=memory-places.d.ts.map
@@ -1,29 +0,0 @@
1
- /**
2
- * Memory places table migrations
3
- */
4
- import { logger } from '../../core/logger.js';
5
- export async function runMemoryPlacesMigrations(sqlite) {
6
- const memoryPlacesTableCheck = sqlite.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memory_places'").get();
7
- if (!memoryPlacesTableCheck)
8
- return;
9
- const memoryPlacesInfo = sqlite.prepare("PRAGMA table_info(memory_places)").all();
10
- const existingMemoryPlacesColumns = new Set(memoryPlacesInfo.map(col => col.name));
11
- const memoryPlacesMigrations = [
12
- { col: 'place_sort_order', sql: 'ALTER TABLE memory_places ADD COLUMN place_sort_order INTEGER DEFAULT 0' },
13
- ];
14
- for (const migration of memoryPlacesMigrations) {
15
- if (!existingMemoryPlacesColumns.has(migration.col)) {
16
- try {
17
- sqlite.exec(migration.sql);
18
- logger.info(`Migration: Added column ${migration.col} to memory_places table`);
19
- }
20
- catch (error) {
21
- const msg = error instanceof Error ? error.message : String(error);
22
- if (!msg.includes('duplicate column name')) {
23
- logger.warn(`Migration note for memory_places.${migration.col}: ${msg}`);
24
- }
25
- }
26
- }
27
- }
28
- }
29
- //# sourceMappingURL=memory-places.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Places table migrations
3
- */
4
- import type { Database } from 'better-sqlite3';
5
- export declare function runPlacesMigrations(sqlite: Database): Promise<void>;
6
- //# sourceMappingURL=places.d.ts.map