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.
- package/bin/squish-mcp.mjs +40 -42
- package/core/scheduler/cron-scheduler.ts +10 -1
- package/core/worker.ts +10 -1
- package/package.json +119 -119
- package/packages/mcp/src/index.ts +99 -36
- package/dist/config.d.ts +0 -106
- package/dist/config.js +0 -194
- package/dist/core/adapters/config/claude-code.d.ts +0 -45
- package/dist/core/adapters/config/claude-code.js +0 -113
- package/dist/core/adapters/config/cursor.d.ts +0 -26
- package/dist/core/adapters/config/cursor.js +0 -74
- package/dist/core/adapters/config/opencode.d.ts +0 -23
- package/dist/core/adapters/config/opencode.js +0 -73
- package/dist/core/adapters/config/windsurf.d.ts +0 -26
- package/dist/core/adapters/config/windsurf.js +0 -74
- package/dist/core/adapters/index.d.ts +0 -45
- package/dist/core/adapters/index.js +0 -84
- package/dist/core/adapters/scripts/install-adapter.d.ts +0 -19
- package/dist/core/adapters/scripts/install-adapter.js +0 -149
- package/dist/core/adapters/timeline.d.ts +0 -23
- package/dist/core/adapters/timeline.js +0 -88
- package/dist/core/adapters/types.d.ts +0 -137
- package/dist/core/adapters/types.js +0 -50
- package/dist/core/agent-preferences.d.ts +0 -16
- package/dist/core/agent-preferences.js +0 -124
- package/dist/core/algorithms/analytics/token-estimator.d.ts +0 -50
- package/dist/core/algorithms/analytics/token-estimator.js +0 -154
- package/dist/core/algorithms/detection/hash-filters.d.ts +0 -47
- package/dist/core/algorithms/detection/hash-filters.js +0 -190
- package/dist/core/algorithms/detection/semantic-ranker.d.ts +0 -32
- package/dist/core/algorithms/detection/semantic-ranker.js +0 -118
- package/dist/core/algorithms/detection/two-stage-detector.d.ts +0 -52
- package/dist/core/algorithms/detection/two-stage-detector.js +0 -299
- package/dist/core/algorithms/handlers/approve-merge.d.ts +0 -22
- package/dist/core/algorithms/handlers/approve-merge.js +0 -179
- package/dist/core/algorithms/handlers/detect-duplicates.d.ts +0 -47
- package/dist/core/algorithms/handlers/detect-duplicates.js +0 -145
- package/dist/core/algorithms/handlers/get-stats.d.ts +0 -39
- package/dist/core/algorithms/handlers/get-stats.js +0 -88
- package/dist/core/algorithms/handlers/list-proposals.d.ts +0 -45
- package/dist/core/algorithms/handlers/list-proposals.js +0 -83
- package/dist/core/algorithms/handlers/preview-merge.d.ts +0 -39
- package/dist/core/algorithms/handlers/preview-merge.js +0 -93
- package/dist/core/algorithms/handlers/reject-merge.d.ts +0 -28
- package/dist/core/algorithms/handlers/reject-merge.js +0 -69
- package/dist/core/algorithms/handlers/reverse-merge.d.ts +0 -21
- package/dist/core/algorithms/handlers/reverse-merge.js +0 -121
- package/dist/core/algorithms/index.d.ts +0 -21
- package/dist/core/algorithms/index.js +0 -26
- package/dist/core/algorithms/operations/cache-maintenance.d.ts +0 -12
- package/dist/core/algorithms/operations/cache-maintenance.js +0 -157
- package/dist/core/algorithms/safety/safety-checks.d.ts +0 -18
- package/dist/core/algorithms/safety/safety-checks.js +0 -179
- package/dist/core/algorithms/strategies/merge-strategies.d.ts +0 -50
- package/dist/core/algorithms/strategies/merge-strategies.js +0 -288
- package/dist/core/algorithms/types.d.ts +0 -125
- package/dist/core/algorithms/types.js +0 -5
- package/dist/core/algorithms/utils/response-builder.d.ts +0 -28
- package/dist/core/algorithms/utils/response-builder.js +0 -37
- package/dist/core/associations.d.ts +0 -33
- package/dist/core/associations.js +0 -284
- package/dist/core/autosave.d.ts +0 -19
- package/dist/core/autosave.js +0 -16
- package/dist/core/beliefs/decay.d.ts +0 -27
- package/dist/core/beliefs/decay.js +0 -217
- package/dist/core/beliefs/extractor.d.ts +0 -9
- package/dist/core/beliefs/extractor.js +0 -113
- package/dist/core/beliefs/store.d.ts +0 -46
- package/dist/core/beliefs/store.js +0 -466
- package/dist/core/beliefs/types.d.ts +0 -28
- package/dist/core/beliefs/types.js +0 -2
- package/dist/core/commands/mcp-server.d.ts +0 -2
- package/dist/core/commands/mcp-server.js +0 -6
- package/dist/core/commands/remember.d.ts +0 -24
- package/dist/core/commands/remember.js +0 -144
- package/dist/core/compression.d.ts +0 -45
- package/dist/core/compression.js +0 -160
- package/dist/core/consolidation.d.ts +0 -37
- package/dist/core/consolidation.js +0 -248
- package/dist/core/context/agent-context.d.ts +0 -106
- package/dist/core/context/agent-context.js +0 -274
- package/dist/core/context/context-paging.d.ts +0 -80
- package/dist/core/context/context-paging.js +0 -328
- package/dist/core/context/context-window.d.ts +0 -40
- package/dist/core/context/context-window.js +0 -177
- package/dist/core/context/context.d.ts +0 -7
- package/dist/core/context/context.js +0 -22
- package/dist/core/embeddings/embeddings.d.ts +0 -29
- package/dist/core/embeddings/embeddings.js +0 -546
- package/dist/core/embeddings/google-multimodal.d.ts +0 -14
- package/dist/core/embeddings/google-multimodal.js +0 -146
- package/dist/core/embeddings/local-embeddings.d.ts +0 -11
- package/dist/core/embeddings/local-embeddings.js +0 -11
- package/dist/core/embeddings/qmd-client.d.ts +0 -136
- package/dist/core/embeddings/qmd-client.js +0 -403
- package/dist/core/embeddings/transformers-local.d.ts +0 -64
- package/dist/core/embeddings/transformers-local.js +0 -213
- package/dist/core/embeddings.d.ts +0 -2
- package/dist/core/embeddings.js +0 -3
- package/dist/core/error-handling.d.ts +0 -63
- package/dist/core/error-handling.js +0 -173
- package/dist/core/graph/entity-deduplicator.d.ts +0 -24
- package/dist/core/graph/entity-deduplicator.js +0 -183
- package/dist/core/graph/graph-builder.d.ts +0 -46
- package/dist/core/graph/graph-builder.js +0 -174
- package/dist/core/graph/graph-traversal.d.ts +0 -80
- package/dist/core/graph/graph-traversal.js +0 -315
- package/dist/core/graph/index.d.ts +0 -19
- package/dist/core/graph/index.js +0 -13
- package/dist/core/graph/llm-entity-extractor.d.ts +0 -49
- package/dist/core/graph/llm-entity-extractor.js +0 -313
- package/dist/core/graph/multi-hop-retrieval.d.ts +0 -48
- package/dist/core/graph/multi-hop-retrieval.js +0 -215
- package/dist/core/graph/relationship-extractor.d.ts +0 -48
- package/dist/core/graph/relationship-extractor.js +0 -351
- package/dist/core/hooks/agent-hooks.d.ts +0 -83
- package/dist/core/hooks/agent-hooks.js +0 -521
- package/dist/core/hooks/auto-tagger.d.ts +0 -19
- package/dist/core/hooks/auto-tagger.js +0 -155
- package/dist/core/hooks/capture-filter.d.ts +0 -41
- package/dist/core/hooks/capture-filter.js +0 -128
- package/dist/core/hot-cache.d.ts +0 -86
- package/dist/core/hot-cache.js +0 -285
- package/dist/core/index.d.ts +0 -10
- package/dist/core/index.js +0 -11
- package/dist/core/ingestion/agent-memory.d.ts +0 -22
- package/dist/core/ingestion/agent-memory.js +0 -109
- package/dist/core/ingestion/core-memory.d.ts +0 -78
- package/dist/core/ingestion/core-memory.js +0 -226
- package/dist/core/ingestion/learnings.d.ts +0 -57
- package/dist/core/ingestion/learnings.js +0 -205
- package/dist/core/ingestion/signal-engine.d.ts +0 -41
- package/dist/core/ingestion/signal-engine.js +0 -201
- package/dist/core/integrations/obsidian-vault.d.ts +0 -31
- package/dist/core/integrations/obsidian-vault.js +0 -156
- package/dist/core/layers/generator.d.ts +0 -25
- package/dist/core/layers/generator.js +0 -76
- package/dist/core/lib/db-client.d.ts +0 -114
- package/dist/core/lib/db-client.js +0 -130
- package/dist/core/lib/parse-embedding.d.ts +0 -9
- package/dist/core/lib/parse-embedding.js +0 -58
- package/dist/core/lib/schemas.d.ts +0 -132
- package/dist/core/lib/schemas.js +0 -87
- package/dist/core/lib/types.d.ts +0 -45
- package/dist/core/lib/types.js +0 -6
- package/dist/core/lib/utils.d.ts +0 -18
- package/dist/core/lib/utils.js +0 -145
- package/dist/core/lib/validation.d.ts +0 -38
- package/dist/core/lib/validation.js +0 -151
- package/dist/core/lifecycle.d.ts +0 -25
- package/dist/core/lifecycle.js +0 -292
- package/dist/core/logger.d.ts +0 -17
- package/dist/core/logger.js +0 -46
- package/dist/core/mcp/client.d.ts +0 -17
- package/dist/core/mcp/client.js +0 -101
- package/dist/core/mcp/index.d.ts +0 -6
- package/dist/core/mcp/index.js +0 -6
- package/dist/core/mcp/server.d.ts +0 -18
- package/dist/core/mcp/server.js +0 -157
- package/dist/core/mcp/standalone-server.d.ts +0 -13
- package/dist/core/mcp/standalone-server.js +0 -46
- package/dist/core/mcp/tools.d.ts +0 -7
- package/dist/core/mcp/tools.js +0 -278
- package/dist/core/mcp/types.d.ts +0 -87
- package/dist/core/mcp/types.js +0 -48
- package/dist/core/memory/bridge-discovery.d.ts +0 -50
- package/dist/core/memory/bridge-discovery.js +0 -291
- package/dist/core/memory/categorizer.d.ts +0 -27
- package/dist/core/memory/categorizer.js +0 -306
- package/dist/core/memory/conflict-detector.d.ts +0 -7
- package/dist/core/memory/conflict-detector.js +0 -43
- package/dist/core/memory/consolidation.d.ts +0 -42
- package/dist/core/memory/consolidation.js +0 -277
- package/dist/core/memory/context-collector.d.ts +0 -10
- package/dist/core/memory/context-collector.js +0 -56
- package/dist/core/memory/contradiction-resolver.d.ts +0 -40
- package/dist/core/memory/contradiction-resolver.js +0 -368
- package/dist/core/memory/edit-workflow.d.ts +0 -19
- package/dist/core/memory/edit-workflow.js +0 -120
- package/dist/core/memory/entity-extractor.d.ts +0 -37
- package/dist/core/memory/entity-extractor.js +0 -350
- package/dist/core/memory/entity-resolver.d.ts +0 -23
- package/dist/core/memory/entity-resolver.js +0 -64
- package/dist/core/memory/explain.d.ts +0 -18
- package/dist/core/memory/explain.js +0 -92
- package/dist/core/memory/fact-deriver.d.ts +0 -31
- package/dist/core/memory/fact-deriver.js +0 -236
- package/dist/core/memory/fact-extractor.d.ts +0 -24
- package/dist/core/memory/fact-extractor.js +0 -89
- package/dist/core/memory/feedback-tracker.d.ts +0 -12
- package/dist/core/memory/feedback-tracker.js +0 -155
- package/dist/core/memory/hooks.d.ts +0 -88
- package/dist/core/memory/hooks.js +0 -174
- package/dist/core/memory/hybrid-retrieval.d.ts +0 -27
- package/dist/core/memory/hybrid-retrieval.js +0 -37
- package/dist/core/memory/hybrid-scorer.d.ts +0 -40
- package/dist/core/memory/hybrid-scorer.js +0 -267
- package/dist/core/memory/hybrid-search.d.ts +0 -23
- package/dist/core/memory/hybrid-search.js +0 -596
- package/dist/core/memory/importance.d.ts +0 -46
- package/dist/core/memory/importance.js +0 -241
- package/dist/core/memory/index.d.ts +0 -9
- package/dist/core/memory/index.js +0 -11
- package/dist/core/memory/loader.d.ts +0 -31
- package/dist/core/memory/loader.js +0 -141
- package/dist/core/memory/markdown/markdown-storage.d.ts +0 -72
- package/dist/core/memory/markdown/markdown-storage.js +0 -243
- package/dist/core/memory/memories.d.ts +0 -43
- package/dist/core/memory/memories.js +0 -452
- package/dist/core/memory/memory-lifecycle.d.ts +0 -8
- package/dist/core/memory/memory-lifecycle.js +0 -47
- package/dist/core/memory/memory-manager.d.ts +0 -15
- package/dist/core/memory/memory-manager.js +0 -46
- package/dist/core/memory/migrate.d.ts +0 -21
- package/dist/core/memory/migrate.js +0 -134
- package/dist/core/memory/normalization.d.ts +0 -7
- package/dist/core/memory/normalization.js +0 -26
- package/dist/core/memory/path-strengthener.d.ts +0 -39
- package/dist/core/memory/path-strengthener.js +0 -150
- package/dist/core/memory/progressive-disclosure.d.ts +0 -43
- package/dist/core/memory/progressive-disclosure.js +0 -280
- package/dist/core/memory/query-processor.d.ts +0 -21
- package/dist/core/memory/query-processor.js +0 -106
- package/dist/core/memory/query-rewriter.d.ts +0 -13
- package/dist/core/memory/query-rewriter.js +0 -118
- package/dist/core/memory/response-analyzer.d.ts +0 -9
- package/dist/core/memory/response-analyzer.js +0 -61
- package/dist/core/memory/retrieval-feedback.d.ts +0 -70
- package/dist/core/memory/retrieval-feedback.js +0 -213
- package/dist/core/memory/serialization.d.ts +0 -10
- package/dist/core/memory/serialization.js +0 -84
- package/dist/core/memory/stale-cleaner.d.ts +0 -26
- package/dist/core/memory/stale-cleaner.js +0 -97
- package/dist/core/memory/stats.d.ts +0 -32
- package/dist/core/memory/stats.js +0 -143
- package/dist/core/memory/telemetry.d.ts +0 -69
- package/dist/core/memory/telemetry.js +0 -313
- package/dist/core/memory/temporal-facts.d.ts +0 -41
- package/dist/core/memory/temporal-facts.js +0 -283
- package/dist/core/memory/temporal-parser.d.ts +0 -32
- package/dist/core/memory/temporal-parser.js +0 -385
- package/dist/core/memory/trigger-detector.d.ts +0 -21
- package/dist/core/memory/trigger-detector.js +0 -79
- package/dist/core/memory/write-gate.d.ts +0 -54
- package/dist/core/memory/write-gate.js +0 -210
- package/dist/core/places/index.d.ts +0 -14
- package/dist/core/places/index.js +0 -14
- package/dist/core/places/memory-places.d.ts +0 -68
- package/dist/core/places/memory-places.js +0 -261
- package/dist/core/places/places.d.ts +0 -88
- package/dist/core/places/places.js +0 -314
- package/dist/core/places/rules.d.ts +0 -74
- package/dist/core/places/rules.js +0 -240
- package/dist/core/places/walking.d.ts +0 -56
- package/dist/core/places/walking.js +0 -121
- package/dist/core/projects.d.ts +0 -17
- package/dist/core/projects.js +0 -116
- package/dist/core/redis.d.ts +0 -11
- package/dist/core/redis.js +0 -69
- package/dist/core/responses.d.ts +0 -96
- package/dist/core/responses.js +0 -122
- package/dist/core/runtime/trust-report.d.ts +0 -102
- package/dist/core/runtime/trust-report.js +0 -107
- package/dist/core/runtime/trust-state.d.ts +0 -12
- package/dist/core/runtime/trust-state.js +0 -309
- package/dist/core/scheduler/cron-scheduler.d.ts +0 -32
- package/dist/core/scheduler/cron-scheduler.js +0 -493
- package/dist/core/scheduler/heartbeat.d.ts +0 -11
- package/dist/core/scheduler/heartbeat.js +0 -73
- package/dist/core/scheduler/index.d.ts +0 -8
- package/dist/core/scheduler/index.js +0 -8
- package/dist/core/scheduler/job-runner.d.ts +0 -11
- package/dist/core/scheduler/job-runner.js +0 -164
- package/dist/core/search/conversations.d.ts +0 -25
- package/dist/core/search/conversations.js +0 -110
- package/dist/core/search/entities.d.ts +0 -12
- package/dist/core/search/entities.js +0 -31
- package/dist/core/search/folder-context.d.ts +0 -25
- package/dist/core/search/folder-context.js +0 -119
- package/dist/core/search/graph-boost.d.ts +0 -7
- package/dist/core/search/graph-boost.js +0 -23
- package/dist/core/search/index.d.ts +0 -4
- package/dist/core/search/index.js +0 -5
- package/dist/core/search/qmd-wrapper.d.ts +0 -36
- package/dist/core/search/qmd-wrapper.js +0 -58
- package/dist/core/security/encrypt.d.ts +0 -6
- package/dist/core/security/encrypt.js +0 -47
- package/dist/core/security/governance.d.ts +0 -26
- package/dist/core/security/governance.js +0 -79
- package/dist/core/security/privacy.d.ts +0 -23
- package/dist/core/security/privacy.js +0 -82
- package/dist/core/security/secret-detector.d.ts +0 -32
- package/dist/core/security/secret-detector.js +0 -88
- package/dist/core/session/auto-load.d.ts +0 -6
- package/dist/core/session/auto-load.js +0 -144
- package/dist/core/session/entity-tracker.d.ts +0 -62
- package/dist/core/session/entity-tracker.js +0 -287
- package/dist/core/session/index.d.ts +0 -7
- package/dist/core/session/index.js +0 -7
- package/dist/core/session/reference-resolver.d.ts +0 -26
- package/dist/core/session/reference-resolver.js +0 -121
- package/dist/core/session/self-iteration-job.d.ts +0 -35
- package/dist/core/session/self-iteration-job.js +0 -387
- package/dist/core/session/session-hooks.d.ts +0 -18
- package/dist/core/session/session-hooks.js +0 -58
- package/dist/core/session/types.d.ts +0 -26
- package/dist/core/session/types.js +0 -10
- package/dist/core/session/working-set.d.ts +0 -50
- package/dist/core/session/working-set.js +0 -212
- package/dist/core/snapshots/cleanup.d.ts +0 -9
- package/dist/core/snapshots/cleanup.js +0 -12
- package/dist/core/snapshots/comparison.d.ts +0 -19
- package/dist/core/snapshots/comparison.js +0 -43
- package/dist/core/snapshots/creation.d.ts +0 -13
- package/dist/core/snapshots/creation.js +0 -117
- package/dist/core/snapshots/retrieval.d.ts +0 -7
- package/dist/core/snapshots/retrieval.js +0 -41
- package/dist/core/snapshots/stats.d.ts +0 -11
- package/dist/core/snapshots/stats.js +0 -52
- package/dist/core/storage/cache.d.ts +0 -13
- package/dist/core/storage/cache.js +0 -202
- package/dist/core/storage/database.d.ts +0 -12
- package/dist/core/storage/database.js +0 -12
- package/dist/core/summarization/cleanup.d.ts +0 -9
- package/dist/core/summarization/cleanup.js +0 -12
- package/dist/core/summarization/queries.d.ts +0 -9
- package/dist/core/summarization/queries.js +0 -28
- package/dist/core/summarization/stats.d.ts +0 -14
- package/dist/core/summarization/stats.js +0 -52
- package/dist/core/summarization/strategies.d.ts +0 -24
- package/dist/core/summarization/strategies.js +0 -28
- package/dist/core/summarization.d.ts +0 -37
- package/dist/core/summarization.js +0 -188
- package/dist/core/temporal-facts.d.ts +0 -54
- package/dist/core/temporal-facts.js +0 -193
- package/dist/core/tracing/collector.d.ts +0 -111
- package/dist/core/tracing/collector.js +0 -350
- package/dist/core/tracing/visualizer.d.ts +0 -32
- package/dist/core/tracing/visualizer.js +0 -165
- package/dist/core/utils/cleanup-operations.d.ts +0 -13
- package/dist/core/utils/cleanup-operations.js +0 -44
- package/dist/core/utils/content-extraction.d.ts +0 -19
- package/dist/core/utils/content-extraction.js +0 -75
- package/dist/core/utils/filter-builder.d.ts +0 -13
- package/dist/core/utils/filter-builder.js +0 -44
- package/dist/core/utils/history-traversal.d.ts +0 -13
- package/dist/core/utils/history-traversal.js +0 -50
- package/dist/core/utils/memory-operations.d.ts +0 -17
- package/dist/core/utils/memory-operations.js +0 -43
- package/dist/core/utils/query-operations.d.ts +0 -18
- package/dist/core/utils/query-operations.js +0 -65
- package/dist/core/utils/summarization-helpers.d.ts +0 -17
- package/dist/core/utils/summarization-helpers.js +0 -33
- package/dist/core/utils/temporal-queries.d.ts +0 -13
- package/dist/core/utils/temporal-queries.js +0 -27
- package/dist/core/utils/vector-operations.d.ts +0 -71
- package/dist/core/utils/vector-operations.js +0 -129
- package/dist/core/utils/version-management.d.ts +0 -9
- package/dist/core/utils/version-management.js +0 -61
- package/dist/core/worker.d.ts +0 -82
- package/dist/core/worker.js +0 -272
- package/dist/db/adapter.d.ts +0 -7
- package/dist/db/adapter.js +0 -175
- package/dist/db/bootstrap.d.ts +0 -11
- package/dist/db/bootstrap.js +0 -1034
- package/dist/db/drizzle/schema-sqlite.d.ts +0 -5538
- package/dist/db/drizzle/schema-sqlite.js +0 -763
- package/dist/db/drizzle/schema.d.ts +0 -4734
- package/dist/db/drizzle/schema.js +0 -859
- package/dist/db/drizzle.config.d.ts +0 -3
- package/dist/db/drizzle.config.js +0 -12
- package/dist/db/index.d.ts +0 -7
- package/dist/db/index.js +0 -89
- package/dist/db/migrations/associations.d.ts +0 -6
- package/dist/db/migrations/associations.js +0 -29
- package/dist/db/migrations/beliefs.d.ts +0 -10
- package/dist/db/migrations/beliefs.js +0 -76
- package/dist/db/migrations/core-memory.d.ts +0 -6
- package/dist/db/migrations/core-memory.js +0 -29
- package/dist/db/migrations/fts.d.ts +0 -6
- package/dist/db/migrations/fts.js +0 -52
- package/dist/db/migrations/index.d.ts +0 -25
- package/dist/db/migrations/index.js +0 -51
- package/dist/db/migrations/indexes.d.ts +0 -6
- package/dist/db/migrations/indexes.js +0 -30
- package/dist/db/migrations/learnings.d.ts +0 -7
- package/dist/db/migrations/learnings.js +0 -26
- package/dist/db/migrations/maintenance.d.ts +0 -6
- package/dist/db/migrations/maintenance.js +0 -61
- package/dist/db/migrations/memories.d.ts +0 -7
- package/dist/db/migrations/memories.js +0 -16
- package/dist/db/migrations/memory-places.d.ts +0 -6
- package/dist/db/migrations/memory-places.js +0 -29
- package/dist/db/migrations/places.d.ts +0 -6
- package/dist/db/migrations/places.js +0 -43
- package/dist/db/migrations/projects.d.ts +0 -3
- package/dist/db/migrations/projects.js +0 -13
- package/dist/db/migrations/tier-conversion.d.ts +0 -7
- package/dist/db/migrations/tier-conversion.js +0 -20
- package/dist/db/neon.d.ts +0 -8
- package/dist/db/neon.js +0 -20
- package/dist/db/schema/beliefs.d.ts +0 -9
- package/dist/db/schema/beliefs.js +0 -46
- package/dist/db/schema/generator.d.ts +0 -38
- package/dist/db/schema/generator.js +0 -108
- package/dist/db/schema/index.d.ts +0 -39
- package/dist/db/schema/index.js +0 -51
- package/dist/db/schema/learnings.d.ts +0 -7
- package/dist/db/schema/learnings.js +0 -30
- package/dist/db/schema/memories.d.ts +0 -7
- package/dist/db/schema/memories.js +0 -81
- package/dist/db/schema/projects.d.ts +0 -4
- package/dist/db/schema/projects.js +0 -31
- package/dist/db/schema/tables/context-sessions.d.ts +0 -9
- package/dist/db/schema/tables/context-sessions.js +0 -37
- package/dist/db/schema/tables/conversations.d.ts +0 -9
- package/dist/db/schema/tables/conversations.js +0 -47
- package/dist/db/schema/tables/core-memory.d.ts +0 -9
- package/dist/db/schema/tables/core-memory.js +0 -41
- package/dist/db/schema/tables/entities.d.ts +0 -9
- package/dist/db/schema/tables/entities.js +0 -39
- package/dist/db/schema/tables/entity-relations.d.ts +0 -9
- package/dist/db/schema/tables/entity-relations.js +0 -31
- package/dist/db/schema/tables/learnings.d.ts +0 -9
- package/dist/db/schema/tables/learnings.js +0 -66
- package/dist/db/schema/tables/memories.d.ts +0 -9
- package/dist/db/schema/tables/memories.js +0 -161
- package/dist/db/schema/tables/memory-associations.d.ts +0 -9
- package/dist/db/schema/tables/memory-associations.js +0 -39
- package/dist/db/schema/tables/memory-hash-cache.d.ts +0 -9
- package/dist/db/schema/tables/memory-hash-cache.js +0 -29
- package/dist/db/schema/tables/memory-merge-history.d.ts +0 -9
- package/dist/db/schema/tables/memory-merge-history.js +0 -33
- package/dist/db/schema/tables/memory-merge-proposals.d.ts +0 -9
- package/dist/db/schema/tables/memory-merge-proposals.js +0 -39
- package/dist/db/schema/tables/messages.d.ts +0 -9
- package/dist/db/schema/tables/messages.js +0 -41
- package/dist/db/schema/tables/namespaces.d.ts +0 -9
- package/dist/db/schema/tables/namespaces.js +0 -37
- package/dist/db/schema/tables/projects.d.ts +0 -9
- package/dist/db/schema/tables/projects.js +0 -31
- package/dist/db/schema/tables/users.d.ts +0 -9
- package/dist/db/schema/tables/users.js +0 -27
- package/dist/db/schema.d.ts +0 -3
- package/dist/db/schema.js +0 -11
- package/dist/db/supabase.d.ts +0 -9
- package/dist/db/supabase.js +0 -24
- package/dist/packages/mcp/src/index.d.ts +0 -3
- package/dist/packages/mcp/src/index.js +0 -733
package/bin/squish-mcp.mjs
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Squish MCP Server Entry Point
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* squish-mcp
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Squish MCP Server Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Uses spawn to run MCP - passes env vars to child process for MCP mode
|
|
7
|
+
* This fixes initialization timing issue in OpenCode/Claude Code
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* squish-mcp # STDIO mode (default)
|
|
11
|
+
* squish-mcp --http # HTTP mode
|
|
12
|
+
* squish-mcp --port 8765 # Custom port
|
|
13
|
+
* squish-mcp --health # Health check mode
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { spawn } from 'node:child_process';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
import { dirname, join } from 'node:path';
|
|
19
|
+
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
const packageRoot = join(__dirname, '..');
|
|
23
|
+
|
|
24
|
+
// Set MCP mode - pass to child process to skip heavy background jobs at startup
|
|
25
|
+
const mcpEnv = {
|
|
26
|
+
...process.env,
|
|
27
|
+
SQUISH_MCP_NO_WORKER: 'true', // Skip worker startup for fast init
|
|
28
|
+
SQUISH_QUIET: 'true', // Suppress logs for clean JSON-RPC
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// MCP TypeScript file path
|
|
32
|
+
const mcpPath = join(packageRoot, 'packages/mcp/src/index.ts');
|
|
33
|
+
|
|
34
|
+
// Pass through any command line arguments
|
|
21
35
|
const args = process.argv.slice(2);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const port = portIndex >= 0 ? parseInt(args[portIndex + 1]) : 8765;
|
|
26
|
-
|
|
27
|
-
// Use bun to run the MCP server
|
|
28
|
-
const bunPath = process.env.BUN?.replace(/\\/g, '/') || 'bun';
|
|
29
|
-
const mcpPath = join(__dirname, '..', 'packages', 'mcp', 'src', 'index.ts');
|
|
30
|
-
|
|
31
|
-
const mcpArgs = [];
|
|
32
|
-
|
|
33
|
-
if (isHttp) {
|
|
34
|
-
mcpArgs.push('--http', '--port', port.toString());
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isHealth) {
|
|
38
|
-
mcpArgs.push('--health');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const child = spawn(bunPath, [mcpPath, ...mcpArgs], {
|
|
36
|
+
|
|
37
|
+
// Spawn bun to run MCP with env vars passed to child
|
|
38
|
+
const proc = spawn('bun', [mcpPath, ...args], {
|
|
42
39
|
stdio: 'inherit',
|
|
43
|
-
|
|
40
|
+
env: mcpEnv,
|
|
41
|
+
cwd: process.cwd(),
|
|
44
42
|
});
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
proc.on('exit', (code) => process.exit(code || 0));
|
|
@@ -36,6 +36,9 @@ export type JobHandler = (context: JobExecutionContext) => Promise<{ recordsProc
|
|
|
36
36
|
const jobHandlers = new Map<string, JobHandler>();
|
|
37
37
|
const activeTasks = new Map<string, any>(); // node-cron ScheduledTask type
|
|
38
38
|
|
|
39
|
+
// Flag to defer logging until explicit init (for MCP silent mode)
|
|
40
|
+
let schedulerInitialized = false;
|
|
41
|
+
|
|
39
42
|
// Job interval by type (in ms) - used for catch-up detection
|
|
40
43
|
const JOB_INTERVALS: Record<JobType, number> = {
|
|
41
44
|
hourly: 60 * 60 * 1000, // 1 hour
|
|
@@ -46,7 +49,10 @@ const JOB_INTERVALS: Record<JobType, number> = {
|
|
|
46
49
|
|
|
47
50
|
export function registerJobHandler(jobName: string, handler: JobHandler): void {
|
|
48
51
|
jobHandlers.set(jobName, handler);
|
|
49
|
-
|
|
52
|
+
// Only log after explicit init (not at import time) - enables silent mode for MCP
|
|
53
|
+
if (schedulerInitialized || process.env.SQUISH_FORCE_LOG === 'true') {
|
|
54
|
+
logger.info(`[Scheduler] Registered handler for job: ${jobName}`);
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
// Register self-iteration job handler
|
|
@@ -144,6 +150,9 @@ const autoCleanHandler = async (context: JobExecutionContext) => {
|
|
|
144
150
|
registerJobHandler('auto_clean', autoCleanHandler);
|
|
145
151
|
|
|
146
152
|
export async function initializeScheduler(): Promise<void> {
|
|
153
|
+
// Mark as initialized - enables logging from now on
|
|
154
|
+
schedulerInitialized = true;
|
|
155
|
+
|
|
147
156
|
if (!config.cronEnabled) {
|
|
148
157
|
logger.info('[Scheduler] Cron scheduling disabled, using heartbeat fallback');
|
|
149
158
|
return;
|
package/core/worker.ts
CHANGED
|
@@ -10,6 +10,9 @@ import { pruneOldSummaries, getSummarizationStats } from './summarization.js';
|
|
|
10
10
|
import { runFullConsolidationJob, getDeduplicationStats } from './consolidation.js';
|
|
11
11
|
import { logger } from './logger.js';
|
|
12
12
|
|
|
13
|
+
// Skip worker initialization in MCP mode
|
|
14
|
+
const MCP_MODE = process.env.SQUISH_MCP_NO_WORKER === 'true' || process.argv.includes('--mcp');
|
|
15
|
+
|
|
13
16
|
interface WorkerConfig {
|
|
14
17
|
lifecycleInterval: number;
|
|
15
18
|
pruningInterval: number;
|
|
@@ -60,7 +63,13 @@ class SquishWorker {
|
|
|
60
63
|
logger.warn('Worker already running');
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
|
|
67
|
+
// Skip in MCP mode for faster startup
|
|
68
|
+
if (MCP_MODE) {
|
|
69
|
+
logger.info('Background worker skipped (MCP mode)');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
this.isRunning = true;
|
|
65
74
|
logger.info('Starting background worker');
|
|
66
75
|
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "squish-memory",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Universal memory for AI agents: QMD fast file search + SQLite/Postgres + Belief System + Persistent Hot Cache. Works out-of-the-box.",
|
|
1
|
+
{
|
|
2
|
+
"name": "squish-memory",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Universal memory for AI agents: QMD fast file search + SQLite/Postgres + Belief System + Persistent Hot Cache. Works out-of-the-box.",
|
|
5
5
|
"main": "core/index.ts",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"squish": "bin/squish.mjs",
|
|
9
|
-
"squish-mcp": "bin/squish-mcp.mjs"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"clean": "rm -rf dist && rm -f *.log",
|
|
13
|
-
"build": "echo 'No build needed - runs TypeScript directly with bun. Use bun run start or bun run mcp instead.'",
|
|
14
|
-
"start": "bun run core/index.ts 2>/dev/null || npx tsx core/index.ts",
|
|
15
|
-
"mcp": "bun run packages/mcp/src/index.ts 2>/dev/null || npx tsx packages/mcp/src/index.ts",
|
|
16
|
-
"dev": "bun --hot core/index.ts 2>/dev/null || npx tsx --watch core/index.ts",
|
|
17
|
-
"dev:mcp": "bun --hot packages/mcp/src/index.ts 2>/dev/null || npx tsx --watch packages/mcp/src/index.ts",
|
|
18
|
-
"test": "bun test ./tests/ 2>/dev/null || npx vitest",
|
|
19
|
-
"verify:mcp": "bun run packages/mcp/src/index.ts --health 2>/dev/null || npx tsx packages/mcp/src/index.ts --health",
|
|
20
|
-
"bench": "bun benchmark/memory.ts 2>/dev/null || npx tsx --cwd . benchmark/memory.ts",
|
|
21
|
-
"bench:db": "bun benchmark/run.ts 2>/dev/null || npx tsx --cwd . benchmark/run.ts",
|
|
22
|
-
"bench:locomo": "bun benchmark/locomo-full.ts"
|
|
23
|
-
},
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "https://github.com/michielhdoteth/squish.git"
|
|
27
|
-
},
|
|
28
|
-
"homepage": "https://github.com/michielhdoteth/squish#readme",
|
|
29
|
-
"funding": {
|
|
30
|
-
"type": "github",
|
|
31
|
-
"url": "https://github.com/sponsors/michielhdoteth"
|
|
32
|
-
},
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/michielhdoteth/squish/issues"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
"ai-agent",
|
|
38
|
-
"memory",
|
|
39
|
-
"persistent-memory",
|
|
40
|
-
"universal-memory",
|
|
41
|
-
"mcp-server",
|
|
42
|
-
"mcp-client",
|
|
43
|
-
"model-context-protocol",
|
|
44
|
-
"claude-code",
|
|
45
|
-
"openclaw",
|
|
46
|
-
"opencode",
|
|
47
|
-
"codex",
|
|
48
|
-
"cursor",
|
|
49
|
-
"windsurf",
|
|
50
|
-
"vscode",
|
|
51
|
-
"plugin",
|
|
52
|
-
"plugin-architecture",
|
|
53
|
-
"qmd",
|
|
54
|
-
"sqlite",
|
|
55
|
-
"postgres",
|
|
56
|
-
"hybrid-search",
|
|
57
|
-
"context-management",
|
|
58
|
-
"semantic-search",
|
|
59
|
-
"local-first",
|
|
60
|
-
"privacy",
|
|
61
|
-
"agent-framework",
|
|
62
|
-
"agent-memory",
|
|
63
|
-
"ai-memory",
|
|
64
|
-
"agentic",
|
|
65
|
-
"context-window",
|
|
66
|
-
"long-term-memory",
|
|
67
|
-
"rag",
|
|
68
|
-
"vector-embeddings",
|
|
69
|
-
"session-persistence"
|
|
70
|
-
],
|
|
71
|
-
"files": [
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"squish": "bin/squish.mjs",
|
|
9
|
+
"squish-mcp": "bin/squish-mcp.mjs"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"clean": "rm -rf dist && rm -f *.log",
|
|
13
|
+
"build": "echo 'No build needed - runs TypeScript directly with bun. Use bun run start or bun run mcp instead.'",
|
|
14
|
+
"start": "bun run core/index.ts 2>/dev/null || npx tsx core/index.ts",
|
|
15
|
+
"mcp": "bun run packages/mcp/src/index.ts 2>/dev/null || npx tsx packages/mcp/src/index.ts",
|
|
16
|
+
"dev": "bun --hot core/index.ts 2>/dev/null || npx tsx --watch core/index.ts",
|
|
17
|
+
"dev:mcp": "bun --hot packages/mcp/src/index.ts 2>/dev/null || npx tsx --watch packages/mcp/src/index.ts",
|
|
18
|
+
"test": "bun test ./tests/ 2>/dev/null || npx vitest",
|
|
19
|
+
"verify:mcp": "bun run packages/mcp/src/index.ts --health 2>/dev/null || npx tsx packages/mcp/src/index.ts --health",
|
|
20
|
+
"bench": "bun benchmark/memory.ts 2>/dev/null || npx tsx --cwd . benchmark/memory.ts",
|
|
21
|
+
"bench:db": "bun benchmark/run.ts 2>/dev/null || npx tsx --cwd . benchmark/run.ts",
|
|
22
|
+
"bench:locomo": "bun benchmark/locomo-full.ts"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/michielhdoteth/squish.git"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/michielhdoteth/squish#readme",
|
|
29
|
+
"funding": {
|
|
30
|
+
"type": "github",
|
|
31
|
+
"url": "https://github.com/sponsors/michielhdoteth"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/michielhdoteth/squish/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"ai-agent",
|
|
38
|
+
"memory",
|
|
39
|
+
"persistent-memory",
|
|
40
|
+
"universal-memory",
|
|
41
|
+
"mcp-server",
|
|
42
|
+
"mcp-client",
|
|
43
|
+
"model-context-protocol",
|
|
44
|
+
"claude-code",
|
|
45
|
+
"openclaw",
|
|
46
|
+
"opencode",
|
|
47
|
+
"codex",
|
|
48
|
+
"cursor",
|
|
49
|
+
"windsurf",
|
|
50
|
+
"vscode",
|
|
51
|
+
"plugin",
|
|
52
|
+
"plugin-architecture",
|
|
53
|
+
"qmd",
|
|
54
|
+
"sqlite",
|
|
55
|
+
"postgres",
|
|
56
|
+
"hybrid-search",
|
|
57
|
+
"context-management",
|
|
58
|
+
"semantic-search",
|
|
59
|
+
"local-first",
|
|
60
|
+
"privacy",
|
|
61
|
+
"agent-framework",
|
|
62
|
+
"agent-memory",
|
|
63
|
+
"ai-memory",
|
|
64
|
+
"agentic",
|
|
65
|
+
"context-window",
|
|
66
|
+
"long-term-memory",
|
|
67
|
+
"rag",
|
|
68
|
+
"vector-embeddings",
|
|
69
|
+
"session-persistence"
|
|
70
|
+
],
|
|
71
|
+
"files": [
|
|
72
72
|
"dist/**/*.js",
|
|
73
73
|
"dist/**/*.d.ts",
|
|
74
74
|
"dist/**/*.cjs",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"!dist/**/*.test.js",
|
|
77
77
|
"!dist/**/*.test.d.ts",
|
|
78
78
|
"scripts",
|
|
79
|
-
"!scripts/init-dirs.ts",
|
|
79
|
+
"!scripts/init-dirs.ts",
|
|
80
80
|
"skills",
|
|
81
81
|
"config",
|
|
82
82
|
"config.js",
|
|
@@ -90,51 +90,51 @@
|
|
|
90
90
|
"!packages/**/*.test.ts",
|
|
91
91
|
"!packages/**/*.test.js",
|
|
92
92
|
"generated",
|
|
93
|
-
"mcp.json.example",
|
|
94
|
-
".env.example",
|
|
95
|
-
"LICENSE",
|
|
96
|
-
"README.md",
|
|
97
|
-
"CHANGELOG.md"
|
|
98
|
-
],
|
|
99
|
-
"author": "michielhdoteth <michiel@4mlabs.io>",
|
|
100
|
-
"license": "MIT",
|
|
101
|
-
"engines": {
|
|
102
|
-
"node": ">=18.0.0",
|
|
103
|
-
"bun": ">=1.0.0"
|
|
104
|
-
},
|
|
105
|
-
"dependencies": {
|
|
106
|
-
"@clack/prompts": "^1.2.0",
|
|
107
|
-
"@huggingface/transformers": "^4.1.0",
|
|
108
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
109
|
-
"@neondatabase/serverless": "^1.0.2",
|
|
110
|
-
"better-sqlite3": "12.9.0",
|
|
111
|
-
"@tobilu/qmd": "^2.1.0",
|
|
112
|
-
"commander": "^14.0.3",
|
|
113
|
-
"cors": "2.8.6",
|
|
114
|
-
"dotenv": "^17.4.2",
|
|
115
|
-
"drizzle-orm": "^0.45.2",
|
|
116
|
-
"express": "^5.2.1",
|
|
117
|
-
"express-rate-limit": "^8.3.2",
|
|
118
|
-
"node-cron": "^4.2.1",
|
|
119
|
-
"pg": "^8.20.0",
|
|
120
|
-
"pgvector": "^0.2.0",
|
|
121
|
-
"redis": "^5.11.0",
|
|
122
|
-
"sql.js": "^1.14.1",
|
|
123
|
-
"zod": "^4.3.6"
|
|
124
|
-
},
|
|
125
|
-
"devDependencies": {
|
|
126
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
127
|
-
"@types/cors": "^2.8.17",
|
|
128
|
-
"@types/express": "^5.0.0",
|
|
129
|
-
"@types/node": "^25.6.0",
|
|
130
|
-
"@types/node-cron": "^3.0.11",
|
|
131
|
-
"@types/pg": "^8.20.0",
|
|
132
|
-
"drizzle-kit": "^0.31.10",
|
|
133
|
-
"esbuild": "^0.28.0",
|
|
134
|
-
"picocolors": "^1.0.0",
|
|
135
|
-
"pkg": "^5.8.1",
|
|
136
|
-
"tsx": "^4.21.0",
|
|
137
|
-
"typescript": "^6.0.2",
|
|
138
|
-
"vitest": "^3.0.0"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
93
|
+
"mcp.json.example",
|
|
94
|
+
".env.example",
|
|
95
|
+
"LICENSE",
|
|
96
|
+
"README.md",
|
|
97
|
+
"CHANGELOG.md"
|
|
98
|
+
],
|
|
99
|
+
"author": "michielhdoteth <michiel@4mlabs.io>",
|
|
100
|
+
"license": "MIT",
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=18.0.0",
|
|
103
|
+
"bun": ">=1.0.0"
|
|
104
|
+
},
|
|
105
|
+
"dependencies": {
|
|
106
|
+
"@clack/prompts": "^1.2.0",
|
|
107
|
+
"@huggingface/transformers": "^4.1.0",
|
|
108
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
109
|
+
"@neondatabase/serverless": "^1.0.2",
|
|
110
|
+
"better-sqlite3": "12.9.0",
|
|
111
|
+
"@tobilu/qmd": "^2.1.0",
|
|
112
|
+
"commander": "^14.0.3",
|
|
113
|
+
"cors": "2.8.6",
|
|
114
|
+
"dotenv": "^17.4.2",
|
|
115
|
+
"drizzle-orm": "^0.45.2",
|
|
116
|
+
"express": "^5.2.1",
|
|
117
|
+
"express-rate-limit": "^8.3.2",
|
|
118
|
+
"node-cron": "^4.2.1",
|
|
119
|
+
"pg": "^8.20.0",
|
|
120
|
+
"pgvector": "^0.2.0",
|
|
121
|
+
"redis": "^5.11.0",
|
|
122
|
+
"sql.js": "^1.14.1",
|
|
123
|
+
"zod": "^4.3.6"
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
127
|
+
"@types/cors": "^2.8.17",
|
|
128
|
+
"@types/express": "^5.0.0",
|
|
129
|
+
"@types/node": "^25.6.0",
|
|
130
|
+
"@types/node-cron": "^3.0.11",
|
|
131
|
+
"@types/pg": "^8.20.0",
|
|
132
|
+
"drizzle-kit": "^0.31.10",
|
|
133
|
+
"esbuild": "^0.28.0",
|
|
134
|
+
"picocolors": "^1.0.0",
|
|
135
|
+
"pkg": "^5.8.1",
|
|
136
|
+
"tsx": "^4.21.0",
|
|
137
|
+
"typescript": "^6.0.2",
|
|
138
|
+
"vitest": "^3.0.0"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
console.log = console.error;
|
|
6
6
|
console.info = console.error;
|
|
7
7
|
|
|
8
|
+
// Check for silent mode BEFORE any imports to prevent log spam during module load
|
|
9
|
+
const EARLY_SILENT = process.argv.includes('--silent') || process.env.SQUISH_MCP_SILENT === 'true';
|
|
10
|
+
if (EARLY_SILENT) {
|
|
11
|
+
// Suppress scheduler spam during module load
|
|
12
|
+
// We'll restore AFTER imports are done
|
|
13
|
+
process.env.SQUISH_QUIET = 'true';
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
18
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
@@ -14,7 +22,9 @@ import { config } from "../../../config.js";
|
|
|
14
22
|
import { getDb } from "../../../db/index.js";
|
|
15
23
|
import { getSchema } from "../../../db/schema.js";
|
|
16
24
|
import { eq } from "drizzle-orm";
|
|
17
|
-
|
|
25
|
+
export function startWorker() {
|
|
26
|
+
throw new Error('[DEBUG] startWorker called - need to find where!');
|
|
27
|
+
}
|
|
18
28
|
import { initializeScheduler } from "../../../core/scheduler/cron-scheduler.js";
|
|
19
29
|
import { parseDate, filterByDateRange } from "../../../core/lib/utils.js";
|
|
20
30
|
import {
|
|
@@ -34,9 +44,20 @@ import { logger } from "../../../core/logger.js";
|
|
|
34
44
|
const SERVER_NAME = "squish-memory";
|
|
35
45
|
const SERVER_VERSION = "1.2.0";
|
|
36
46
|
|
|
37
|
-
// Create server
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
// Create server lazily (only when needed) - avoids init overhead during module load
|
|
48
|
+
let SQUISH_SERVER: McpServer | null = null;
|
|
49
|
+
let SQUISH_TOOL_COUNT = 0;
|
|
50
|
+
|
|
51
|
+
function getSquishServer(): { server: McpServer; toolCount: number } {
|
|
52
|
+
if (!SQUISH_SERVER) {
|
|
53
|
+
const result = createSquishServer();
|
|
54
|
+
SQUISH_SERVER = result.server;
|
|
55
|
+
SQUISH_TOOL_COUNT = result.toolCount;
|
|
56
|
+
const silent = process.env.SQUISH_MCP_SILENT === 'true';
|
|
57
|
+
if (!silent) console.error(`[MCP] Server created with ${SQUISH_TOOL_COUNT} tools`);
|
|
58
|
+
}
|
|
59
|
+
return { server: SQUISH_SERVER!, toolCount: SQUISH_TOOL_COUNT };
|
|
60
|
+
}
|
|
40
61
|
|
|
41
62
|
function parseArgs(): { mode: "stdio" | "http"; port: number; health: boolean } {
|
|
42
63
|
const args = process.argv.slice(2);
|
|
@@ -626,16 +647,20 @@ function createSquishServer(): { server: McpServer; toolCount: number } {
|
|
|
626
647
|
return { server, toolCount };
|
|
627
648
|
}
|
|
628
649
|
|
|
629
|
-
async function runStdio(server: McpServer, toolCount: number): Promise<void> {
|
|
630
|
-
|
|
650
|
+
async function runStdio(server: McpServer, toolCount: number, lazyHooks?: { startWorkerIfNeeded: () => Promise<void>; startSchedulerIfNeeded: () => Promise<void> }): Promise<void> {
|
|
651
|
+
// Don't start worker/scheduler here - only start on first actual tool call
|
|
652
|
+
// This fixes MCP stdio initialization timing
|
|
653
|
+
|
|
654
|
+
const silent = process.env.SQUISH_MCP_SILENT === 'true';
|
|
655
|
+
if (!silent) console.error(`[MCP] Starting in STDIO mode...`);
|
|
631
656
|
const transport = new StdioServerTransport();
|
|
632
657
|
|
|
633
658
|
transport.onclose = () => {
|
|
634
|
-
console.error(`[MCP] STDIO transport closed`);
|
|
659
|
+
if (!silent) console.error(`[MCP] STDIO transport closed`);
|
|
635
660
|
};
|
|
636
661
|
|
|
637
662
|
await server.connect(transport);
|
|
638
|
-
console.error(`[MCP] Connected via stdio. ${toolCount} tools available.`);
|
|
663
|
+
if (!silent) console.error(`[MCP] Connected via stdio. ${toolCount} tools available.`);
|
|
639
664
|
|
|
640
665
|
// Keep process alive - wait for stdin to close or process signals
|
|
641
666
|
await new Promise<void>((resolve) => {
|
|
@@ -656,8 +681,11 @@ async function runStdio(server: McpServer, toolCount: number): Promise<void> {
|
|
|
656
681
|
});
|
|
657
682
|
}
|
|
658
683
|
|
|
659
|
-
async function runHttp(server: McpServer, port: number): Promise<void> {
|
|
660
|
-
|
|
684
|
+
async function runHttp(server: McpServer, port: number, lazyHooks?: { startWorkerIfNeeded: () => Promise<void>; startSchedulerIfNeeded: () => Promise<void> }): Promise<void> {
|
|
685
|
+
// Don't start worker/scheduler here - only when tools are called
|
|
686
|
+
|
|
687
|
+
const silent = process.env.SQUISH_MCP_SILENT === 'true';
|
|
688
|
+
if (!silent) console.error(`[MCP] Starting in Streamable HTTP mode on port ${port}...`);
|
|
661
689
|
|
|
662
690
|
const app = express();
|
|
663
691
|
app.use(express.json({ strict: false }));
|
|
@@ -805,11 +833,13 @@ async function runHttp(server: McpServer, port: number): Promise<void> {
|
|
|
805
833
|
}
|
|
806
834
|
|
|
807
835
|
async function runHealthCheck(): Promise<void> {
|
|
808
|
-
|
|
836
|
+
const silent = process.env.SQUISH_MCP_SILENT === 'true';
|
|
837
|
+
|
|
838
|
+
if (!silent) console.error(`[MCP] Running health check...`);
|
|
809
839
|
|
|
810
840
|
try {
|
|
811
841
|
const { server, toolCount } = createSquishServer();
|
|
812
|
-
console.error(`[MCP] Health check passed. Server initialized with ${toolCount} tools.`);
|
|
842
|
+
if (!silent) console.error(`[MCP] Health check passed. Server initialized with ${toolCount} tools.`);
|
|
813
843
|
process.exit(0);
|
|
814
844
|
} catch (error) {
|
|
815
845
|
console.error(`[MCP] Health check failed:`, error);
|
|
@@ -819,40 +849,71 @@ async function runHealthCheck(): Promise<void> {
|
|
|
819
849
|
|
|
820
850
|
async function main(): Promise<void> {
|
|
821
851
|
try {
|
|
822
|
-
console.error(`[${SERVER_NAME}] v${SERVER_VERSION} initializing...`);
|
|
823
|
-
console.error(`[${SERVER_NAME}] Mode: ${config.isManagedMode ? "managed" : "local"}`);
|
|
824
|
-
console.error(`[${SERVER_NAME}] Embeddings: ${config.embeddingsProvider}`);
|
|
825
|
-
|
|
826
852
|
const { mode, port, health } = parseArgs();
|
|
827
853
|
|
|
854
|
+
// Check for silent mode - minimal output for MCP stdio
|
|
855
|
+
const silent = process.argv.includes('--silent') || process.env.SQUISH_MCP_SILENT === 'true';
|
|
856
|
+
|
|
857
|
+
if (!silent) {
|
|
858
|
+
console.error(`[${SERVER_NAME}] v${SERVER_VERSION} initializing...`);
|
|
859
|
+
console.error(`[${SERVER_NAME}] Mode: ${config.isManagedMode ? "managed" : "local"}`);
|
|
860
|
+
console.error(`[${SERVER_NAME}] Embeddings: ${config.embeddingsProvider}`);
|
|
861
|
+
}
|
|
862
|
+
|
|
828
863
|
if (health) {
|
|
829
864
|
await runHealthCheck();
|
|
830
865
|
return;
|
|
831
866
|
}
|
|
832
867
|
|
|
833
|
-
// Start background worker
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
868
|
+
// DEFERRED: Start background worker only when actually needed
|
|
869
|
+
// This speeds up MCP startup significantly for MCP use cases
|
|
870
|
+
// Workers can be started lazily on first actual operation
|
|
871
|
+
const noWorker = process.env.SQUISH_MCP_NO_WORKER === 'true' || process.argv.includes('--no-worker');
|
|
872
|
+
const workerStarted = { current: false };
|
|
873
|
+
|
|
874
|
+
const startWorkerIfNeeded = async () => {
|
|
875
|
+
if (!workerStarted.current && !noWorker) {
|
|
876
|
+
try {
|
|
877
|
+
await startWorker();
|
|
878
|
+
if (!silent) console.error(`[${SERVER_NAME}] Background worker started`);
|
|
879
|
+
} catch (error) {
|
|
880
|
+
// Silently fail - worker is optional for MCP
|
|
881
|
+
}
|
|
882
|
+
workerStarted.current = true;
|
|
883
|
+
}
|
|
884
|
+
};
|
|
840
885
|
|
|
841
|
-
//
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
886
|
+
// DEFERRED: Scheduler - only initialize lazily
|
|
887
|
+
const schedulerStarted = { current: false };
|
|
888
|
+
|
|
889
|
+
const startSchedulerIfNeeded = async () => {
|
|
890
|
+
if (!schedulerStarted.current) {
|
|
891
|
+
try {
|
|
892
|
+
await initializeScheduler();
|
|
893
|
+
if (!silent) console.error(`[${SERVER_NAME}] Cron scheduler initialized`);
|
|
894
|
+
} catch (error) {
|
|
895
|
+
// Silently fail - scheduler is optional
|
|
896
|
+
}
|
|
897
|
+
schedulerStarted.current = true;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
// Hook into server operations to lazy-start worker/scheduler
|
|
902
|
+
// This keeps MCP fast but ensures services start when needed
|
|
903
|
+
const lazyHooks = {
|
|
904
|
+
startWorkerIfNeeded,
|
|
905
|
+
startSchedulerIfNeeded
|
|
906
|
+
};
|
|
848
907
|
|
|
849
908
|
const shutdown = async () => {
|
|
850
|
-
console.error(`[${SERVER_NAME}] Shutting down...`);
|
|
909
|
+
if (!silent) console.error(`[${SERVER_NAME}] Shutting down...`);
|
|
851
910
|
try {
|
|
852
|
-
|
|
853
|
-
|
|
911
|
+
if (workerStarted.current) {
|
|
912
|
+
await stopWorker();
|
|
913
|
+
if (!silent) console.error(`[${SERVER_NAME}] Background worker stopped`);
|
|
914
|
+
}
|
|
854
915
|
} catch (error) {
|
|
855
|
-
|
|
916
|
+
// Ignore shutdown errors
|
|
856
917
|
}
|
|
857
918
|
process.exit(0);
|
|
858
919
|
};
|
|
@@ -860,10 +921,12 @@ async function main(): Promise<void> {
|
|
|
860
921
|
process.on("SIGINT", shutdown);
|
|
861
922
|
process.on("SIGTERM", shutdown);
|
|
862
923
|
|
|
924
|
+
const { server, toolCount } = getSquishServer();
|
|
925
|
+
|
|
863
926
|
if (mode === "stdio") {
|
|
864
|
-
await runStdio(
|
|
927
|
+
await runStdio(server, toolCount, lazyHooks);
|
|
865
928
|
} else {
|
|
866
|
-
await runHttp(
|
|
929
|
+
await runHttp(server, port, lazyHooks);
|
|
867
930
|
}
|
|
868
931
|
} catch (error) {
|
|
869
932
|
console.error(`[${SERVER_NAME}] Fatal error:`, error);
|