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
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { randomBytes, pbkdf2Sync, createCipheriv, createDecipheriv } from 'crypto';
|
|
2
|
-
import { config } from '../../config.js';
|
|
3
|
-
const ITERATIONS = 100_000;
|
|
4
|
-
const KEY_LEN = 32; // 256-bit
|
|
5
|
-
const DIGEST = 'sha256';
|
|
6
|
-
const ALGO = 'aes-256-gcm';
|
|
7
|
-
const NONCE_LEN = 12;
|
|
8
|
-
/**
|
|
9
|
-
* Derive a symmetric key from the passphrase and a salt.
|
|
10
|
-
* The salt is stored in `.squish/salt` (plain text) and is generated once.
|
|
11
|
-
*/
|
|
12
|
-
function getSalt() {
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
const saltPath = path.join(config.dataDir, 'salt');
|
|
16
|
-
if (!fs.existsSync(saltPath)) {
|
|
17
|
-
const salt = randomBytes(16).toString('hex');
|
|
18
|
-
fs.writeFileSync(saltPath, salt);
|
|
19
|
-
return Buffer.from(salt, 'hex');
|
|
20
|
-
}
|
|
21
|
-
return Buffer.from(fs.readFileSync(saltPath, 'utf-8'), 'hex');
|
|
22
|
-
}
|
|
23
|
-
function deriveKey(passphrase) {
|
|
24
|
-
const salt = getSalt();
|
|
25
|
-
return pbkdf2Sync(passphrase, salt, ITERATIONS, KEY_LEN, DIGEST);
|
|
26
|
-
}
|
|
27
|
-
export function encrypt(plain, passphrase) {
|
|
28
|
-
const key = deriveKey(passphrase || config.encryptionPassphrase);
|
|
29
|
-
const nonce = randomBytes(NONCE_LEN);
|
|
30
|
-
const cipher = createCipheriv(ALGO, key, nonce);
|
|
31
|
-
const encrypted = Buffer.concat([cipher.update(plain, 'utf8'), cipher.final()]);
|
|
32
|
-
const tag = cipher.getAuthTag();
|
|
33
|
-
const ciphertext = Buffer.concat([encrypted, tag]).toString('base64');
|
|
34
|
-
return { ciphertext, nonce: nonce.toString('base64') };
|
|
35
|
-
}
|
|
36
|
-
export function decrypt(ciphertext, nonceB64, passphrase) {
|
|
37
|
-
const key = deriveKey(passphrase || config.encryptionPassphrase);
|
|
38
|
-
const nonce = Buffer.from(nonceB64, 'base64');
|
|
39
|
-
const data = Buffer.from(ciphertext, 'base64');
|
|
40
|
-
const tag = data.slice(data.length - 16);
|
|
41
|
-
const encrypted = data.slice(0, data.length - 16);
|
|
42
|
-
const decipher = createDecipheriv(ALGO, key, nonce);
|
|
43
|
-
decipher.setAuthTag(tag);
|
|
44
|
-
const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
|
|
45
|
-
return decrypted.toString('utf8');
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=encrypt.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Governance
|
|
3
|
-
* Implements protection, pinning, and immutability rules
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Mark a memory as protected (cannot be evicted)
|
|
7
|
-
*/
|
|
8
|
-
export declare function protectMemory(memoryId: string, reason: string): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* Pin a memory for automatic injection into context
|
|
11
|
-
*/
|
|
12
|
-
export declare function pinMemory(memoryId: string): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Unpin a memory
|
|
15
|
-
*/
|
|
16
|
-
export declare function unpinMemory(memoryId: string): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Get all pinned memories for auto-injection into context
|
|
19
|
-
* Works regardless of governance settings - pinned memories should always be accessible
|
|
20
|
-
*/
|
|
21
|
-
export declare function getPinnedMemories(projectId?: string): Promise<any[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Get pinned memories formatted for context injection
|
|
24
|
-
*/
|
|
25
|
-
export declare function getPinnedMemoriesForContext(projectId?: string): Promise<string[]>;
|
|
26
|
-
//# sourceMappingURL=governance.d.ts.map
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Governance
|
|
3
|
-
* Implements protection, pinning, and immutability rules
|
|
4
|
-
*/
|
|
5
|
-
import { eq } from 'drizzle-orm';
|
|
6
|
-
import { getDb } from '../../db/index.js';
|
|
7
|
-
import { getSchema } from '../../db/schema.js';
|
|
8
|
-
import { performMemoryOperation } from '../utils/memory-operations.js';
|
|
9
|
-
import { logger } from '../logger.js';
|
|
10
|
-
import { createDatabaseClient } from '../storage/database.js';
|
|
11
|
-
/**
|
|
12
|
-
* Mark a memory as protected (cannot be evicted)
|
|
13
|
-
*/
|
|
14
|
-
export async function protectMemory(memoryId, reason) {
|
|
15
|
-
await performMemoryOperation(memoryId, {
|
|
16
|
-
name: 'protecting memory',
|
|
17
|
-
updates: {
|
|
18
|
-
isProtected: true,
|
|
19
|
-
metadata: { protectionReason: reason, protectedAt: new Date().toISOString() },
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Pin a memory for automatic injection into context
|
|
25
|
-
*/
|
|
26
|
-
export async function pinMemory(memoryId) {
|
|
27
|
-
const db = createDatabaseClient(await getDb());
|
|
28
|
-
const schema = await getSchema();
|
|
29
|
-
await db
|
|
30
|
-
.update(schema.memories)
|
|
31
|
-
.set({
|
|
32
|
-
isPinned: true,
|
|
33
|
-
importanceScore: 100,
|
|
34
|
-
lastImportanceRecalc: new Date(),
|
|
35
|
-
})
|
|
36
|
-
.where(eq(schema.memories.id, memoryId));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Unpin a memory
|
|
40
|
-
*/
|
|
41
|
-
export async function unpinMemory(memoryId) {
|
|
42
|
-
const db = createDatabaseClient(await getDb());
|
|
43
|
-
const schema = await getSchema();
|
|
44
|
-
await db
|
|
45
|
-
.update(schema.memories)
|
|
46
|
-
.set({
|
|
47
|
-
isPinned: false,
|
|
48
|
-
lastImportanceRecalc: new Date(),
|
|
49
|
-
})
|
|
50
|
-
.where(eq(schema.memories.id, memoryId));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get all pinned memories for auto-injection into context
|
|
54
|
-
* Works regardless of governance settings - pinned memories should always be accessible
|
|
55
|
-
*/
|
|
56
|
-
export async function getPinnedMemories(projectId) {
|
|
57
|
-
try {
|
|
58
|
-
const db = await getDb();
|
|
59
|
-
const schema = await getSchema();
|
|
60
|
-
let query = db
|
|
61
|
-
.select()
|
|
62
|
-
.from(schema.memories)
|
|
63
|
-
.where(eq(schema.memories.isPinned, true))
|
|
64
|
-
.limit(50);
|
|
65
|
-
return await query;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
logger.error('Error retrieving pinned memories', error);
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get pinned memories formatted for context injection
|
|
74
|
-
*/
|
|
75
|
-
export async function getPinnedMemoriesForContext(projectId) {
|
|
76
|
-
const pinned = await getPinnedMemories(projectId);
|
|
77
|
-
return pinned.map(m => `[Pinned] ${m.content?.substring(0, 500) || '(no content)'}`);
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=governance.js.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Privacy System
|
|
3
|
-
* Handles private tag filtering, secret detection, and path-based exclusions
|
|
4
|
-
*/
|
|
5
|
-
type PrivacyMode = 'strict' | 'moderate' | 'off';
|
|
6
|
-
export declare function hasPrivateTags(content: string): boolean;
|
|
7
|
-
export declare function stripPrivateTags(content: string): string;
|
|
8
|
-
export declare function shouldStore(content: string, filePath?: string, privacyMode?: PrivacyMode): Promise<boolean>;
|
|
9
|
-
export declare function applyPrivacyFilters<T extends {
|
|
10
|
-
content?: string;
|
|
11
|
-
details?: Record<string, unknown>;
|
|
12
|
-
}>(items: T[]): Promise<T[]>;
|
|
13
|
-
export declare function sanitizeForStorage(content: string, privacyMode: PrivacyMode): string;
|
|
14
|
-
export interface PrivacyReport {
|
|
15
|
-
isPrivate: boolean;
|
|
16
|
-
hasSecrets: boolean;
|
|
17
|
-
secretCount: number;
|
|
18
|
-
secretTypes: string[];
|
|
19
|
-
shouldStore: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function analyzePrivacy(content: string, filePath?: string): Promise<PrivacyReport>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=privacy.d.ts.map
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Privacy System
|
|
3
|
-
* Handles private tag filtering, secret detection, and path-based exclusions
|
|
4
|
-
*/
|
|
5
|
-
import { detectSecrets } from './secret-detector.js';
|
|
6
|
-
const DENY_PATTERNS = [
|
|
7
|
-
'.env', '.env.local', '.env.*.local',
|
|
8
|
-
'*.key', '*.pem',
|
|
9
|
-
'secrets.json', 'credentials.json',
|
|
10
|
-
'.aws', '.ssh', 'node_modules/.env'
|
|
11
|
-
];
|
|
12
|
-
const PRIVATE_TAG_REGEX = /<(private|secret)>[\s\S]*?<\/\1>/gi;
|
|
13
|
-
export function hasPrivateTags(content) {
|
|
14
|
-
return PRIVATE_TAG_REGEX.test(content);
|
|
15
|
-
}
|
|
16
|
-
export function stripPrivateTags(content) {
|
|
17
|
-
return content.replace(/<private>[\s\S]*?<\/private>/gi, '[PRIVATE]')
|
|
18
|
-
.replace(/<secret>[\s\S]*?<\/secret>/gi, '[SECRET]');
|
|
19
|
-
}
|
|
20
|
-
function isInDenyList(filePath) {
|
|
21
|
-
const normalized = filePath.toLowerCase().replace(/\\/g, '/');
|
|
22
|
-
for (const pattern of DENY_PATTERNS) {
|
|
23
|
-
if (normalized === pattern)
|
|
24
|
-
return true;
|
|
25
|
-
if (pattern.startsWith('*.') && normalized.endsWith(pattern.substring(1)))
|
|
26
|
-
return true;
|
|
27
|
-
if (pattern.endsWith('/*')) {
|
|
28
|
-
const dir = pattern.slice(0, -2);
|
|
29
|
-
if (normalized.includes(`/${dir}/`) || normalized.startsWith(`${dir}/`))
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
if (normalized.includes(pattern))
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
export async function shouldStore(content, filePath, privacyMode = 'moderate') {
|
|
38
|
-
if (privacyMode === 'off')
|
|
39
|
-
return true;
|
|
40
|
-
if (hasPrivateTags(content))
|
|
41
|
-
return false;
|
|
42
|
-
if (filePath && isInDenyList(filePath))
|
|
43
|
-
return false;
|
|
44
|
-
if (detectSecrets(content).length > 0)
|
|
45
|
-
return false;
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
export async function applyPrivacyFilters(items) {
|
|
49
|
-
const results = [];
|
|
50
|
-
for (const item of items) {
|
|
51
|
-
const content = item.content || JSON.stringify(item.details || '');
|
|
52
|
-
if (await shouldStore(content)) {
|
|
53
|
-
results.push(item);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return results;
|
|
57
|
-
}
|
|
58
|
-
export function sanitizeForStorage(content, privacyMode) {
|
|
59
|
-
let sanitized = stripPrivateTags(content);
|
|
60
|
-
if (privacyMode !== 'off') {
|
|
61
|
-
const secrets = detectSecrets(sanitized);
|
|
62
|
-
for (let i = secrets.length - 1; i >= 0; i--) {
|
|
63
|
-
const secret = secrets[i];
|
|
64
|
-
sanitized = sanitized.substring(0, secret.start) + '[REDACTED]' + sanitized.substring(secret.end);
|
|
65
|
-
}
|
|
66
|
-
sanitized = sanitized
|
|
67
|
-
.replace(/([a-zA-Z0-9_-]*[Aa]pi[_-]?[Kk]ey|Bearer\s+[^\s]+)/g, '[API_KEY]')
|
|
68
|
-
.replace(/(token|jwt|bearer)[\s=:]+[^\s,]+/gi, '[TOKEN]');
|
|
69
|
-
}
|
|
70
|
-
return sanitized;
|
|
71
|
-
}
|
|
72
|
-
export async function analyzePrivacy(content, filePath) {
|
|
73
|
-
const secrets = detectSecrets(content);
|
|
74
|
-
return {
|
|
75
|
-
isPrivate: hasPrivateTags(content),
|
|
76
|
-
hasSecrets: secrets.length > 0,
|
|
77
|
-
secretCount: secrets.length,
|
|
78
|
-
secretTypes: [...new Set(secrets.map(s => s.type))],
|
|
79
|
-
shouldStore: await shouldStore(content, filePath)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=privacy.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secret Detector
|
|
3
|
-
* Pattern-based detection of API keys, tokens, and credentials
|
|
4
|
-
*/
|
|
5
|
-
export interface SecretMatch {
|
|
6
|
-
type: string;
|
|
7
|
-
pattern: string;
|
|
8
|
-
value: string;
|
|
9
|
-
start: number;
|
|
10
|
-
end: number;
|
|
11
|
-
confidence: 'high' | 'medium' | 'low';
|
|
12
|
-
}
|
|
13
|
-
type Confidence = SecretMatch['confidence'];
|
|
14
|
-
interface PatternConfig {
|
|
15
|
-
pattern: RegExp;
|
|
16
|
-
type: string;
|
|
17
|
-
confidence: Confidence;
|
|
18
|
-
}
|
|
19
|
-
export declare function detectSecrets(text: string, minConfidence?: Confidence): SecretMatch[];
|
|
20
|
-
export declare function likelyContainsSecrets(text: string): boolean;
|
|
21
|
-
export declare function getSecretSummary(text: string): {
|
|
22
|
-
count: number;
|
|
23
|
-
types: string[];
|
|
24
|
-
};
|
|
25
|
-
export declare function redactSecrets(text: string, replacement?: string): string;
|
|
26
|
-
export declare const SECRET_PATTERNS: {
|
|
27
|
-
high: PatternConfig[];
|
|
28
|
-
medium: PatternConfig[];
|
|
29
|
-
low: PatternConfig[];
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=secret-detector.d.ts.map
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secret Detector
|
|
3
|
-
* Pattern-based detection of API keys, tokens, and credentials
|
|
4
|
-
*/
|
|
5
|
-
const HIGH_CONFIDENCE_PATTERNS = [
|
|
6
|
-
{ pattern: /(?:AKIA|ASIA)[0-9A-Z]{16}/g, type: 'aws_access_key', confidence: 'high' },
|
|
7
|
-
{ pattern: /aws_secret_access_key\s*=\s*[^\s]+/gi, type: 'aws_secret_key', confidence: 'high' },
|
|
8
|
-
{ pattern: /-----BEGIN (?:RSA|OPENSSH|PRIVATE) KEY-----/g, type: 'ssh_private_key', confidence: 'high' },
|
|
9
|
-
{ pattern: /-----BEGIN PGP PRIVATE KEY BLOCK-----/g, type: 'gpg_private_key', confidence: 'high' },
|
|
10
|
-
{ pattern: /AIza[0-9A-Za-z\-_]{35}/g, type: 'google_api_key', confidence: 'high' },
|
|
11
|
-
{ pattern: /gh[pousr]_[A-Za-z0-9_]{36,255}/g, type: 'github_token', confidence: 'high' },
|
|
12
|
-
{ pattern: /xox[baprs]-[0-9]{10,13}-[0-9]{10,13}-[A-Za-z0-9_-]{24,34}/g, type: 'slack_token', confidence: 'high' },
|
|
13
|
-
{ pattern: /sk_live_[0-9a-zA-Z]{20,}/g, type: 'stripe_api_key', confidence: 'high' },
|
|
14
|
-
{ pattern: /(mongodb|postgres|mysql|redis|cassandra):\/\/[^\s]+@[^\s]+/gi, type: 'database_url', confidence: 'high' }
|
|
15
|
-
];
|
|
16
|
-
const MEDIUM_CONFIDENCE_PATTERNS = [
|
|
17
|
-
{ pattern: /(?:api[_-]?key|apikey|api_secret|secret_key)\s*[:=]\s*['""`]?[A-Za-z0-9_-]{20,}['""`]?/gi, type: 'api_key', confidence: 'medium' },
|
|
18
|
-
{ pattern: /bearer\s+[A-Za-z0-9._-]+/gi, type: 'bearer_token', confidence: 'medium' },
|
|
19
|
-
{ pattern: /eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g, type: 'jwt_token', confidence: 'medium' },
|
|
20
|
-
{ pattern: /basic\s+[A-Za-z0-9+/=]+/gi, type: 'basic_auth', confidence: 'medium' },
|
|
21
|
-
{ pattern: /(?:password|passwd|pwd)\s*[:=]\s*['""`]?[^\s'""`]+['""`]?/gi, type: 'password', confidence: 'medium' },
|
|
22
|
-
{ pattern: /(?:connection_string|connstr|conn_string)\s*[:=]\s*['""`][^'""`]+['""`]/gi, type: 'connection_string', confidence: 'medium' }
|
|
23
|
-
];
|
|
24
|
-
const LOW_CONFIDENCE_PATTERNS = [
|
|
25
|
-
{ pattern: /\b(?:token|auth_token|access_token|refresh_token)\b/gi, type: 'token_reference', confidence: 'low' },
|
|
26
|
-
{ pattern: /\b(?:secret|secret_key|api_secret|client_secret)\b/gi, type: 'secret_reference', confidence: 'low' },
|
|
27
|
-
{ pattern: /\b(?:credential|cred|credentials)\b/gi, type: 'credential_reference', confidence: 'low' }
|
|
28
|
-
];
|
|
29
|
-
const CONFIDENCE_LEVELS = { high: 3, medium: 2, low: 1 };
|
|
30
|
-
function findMatches(text, config) {
|
|
31
|
-
const regex = new RegExp(config.pattern.source, config.pattern.flags);
|
|
32
|
-
const matches = [];
|
|
33
|
-
let match;
|
|
34
|
-
while ((match = regex.exec(text)) !== null) {
|
|
35
|
-
matches.push({
|
|
36
|
-
type: config.type,
|
|
37
|
-
pattern: config.pattern.source,
|
|
38
|
-
value: match[0],
|
|
39
|
-
start: match.index,
|
|
40
|
-
end: match.index + match[0].length,
|
|
41
|
-
confidence: config.confidence
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return matches;
|
|
45
|
-
}
|
|
46
|
-
export function detectSecrets(text, minConfidence = 'medium') {
|
|
47
|
-
const minLevel = CONFIDENCE_LEVELS[minConfidence];
|
|
48
|
-
const matches = [];
|
|
49
|
-
for (const config of HIGH_CONFIDENCE_PATTERNS) {
|
|
50
|
-
matches.push(...findMatches(text, config));
|
|
51
|
-
}
|
|
52
|
-
if (minLevel <= 2) {
|
|
53
|
-
for (const config of MEDIUM_CONFIDENCE_PATTERNS) {
|
|
54
|
-
matches.push(...findMatches(text, config));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (minLevel <= 1) {
|
|
58
|
-
for (const config of LOW_CONFIDENCE_PATTERNS) {
|
|
59
|
-
matches.push(...findMatches(text, config));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return matches;
|
|
63
|
-
}
|
|
64
|
-
export function likelyContainsSecrets(text) {
|
|
65
|
-
return detectSecrets(text, 'high').length > 0;
|
|
66
|
-
}
|
|
67
|
-
export function getSecretSummary(text) {
|
|
68
|
-
const secrets = detectSecrets(text);
|
|
69
|
-
return {
|
|
70
|
-
count: secrets.length,
|
|
71
|
-
types: [...new Set(secrets.map(s => s.type))]
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
export function redactSecrets(text, replacement = '[REDACTED]') {
|
|
75
|
-
const secrets = detectSecrets(text, 'high');
|
|
76
|
-
let result = text;
|
|
77
|
-
const sorted = [...secrets].sort((a, b) => b.start - a.start);
|
|
78
|
-
for (const secret of sorted) {
|
|
79
|
-
result = result.substring(0, secret.start) + replacement + result.substring(secret.end);
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
export const SECRET_PATTERNS = {
|
|
84
|
-
high: HIGH_CONFIDENCE_PATTERNS,
|
|
85
|
-
medium: MEDIUM_CONFIDENCE_PATTERNS,
|
|
86
|
-
low: LOW_CONFIDENCE_PATTERNS
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=secret-detector.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Session Auto-Load - Automatically load context when MCP session initializes */
|
|
2
|
-
import { AutoLoadConfig, AutoLoadResult } from './types.js';
|
|
3
|
-
export declare function performAutoLoad(projectPath: string, customConfig?: Partial<AutoLoadConfig>): Promise<AutoLoadResult>;
|
|
4
|
-
export declare function getAutoLoadConfig(): AutoLoadConfig;
|
|
5
|
-
export declare function shouldAutoLoad(): boolean;
|
|
6
|
-
//# sourceMappingURL=auto-load.d.ts.map
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/** Session Auto-Load - Automatically load context when MCP session initializes */
|
|
2
|
-
import { logger } from '../logger.js';
|
|
3
|
-
import { config } from '../../config.js';
|
|
4
|
-
import { initializeCoreMemory, getCoreMemory } from '../ingestion/core-memory.js';
|
|
5
|
-
import { search } from '../memory/memories.js';
|
|
6
|
-
import { getProjectContext } from '../context/context.js';
|
|
7
|
-
import { getOrCreateProject } from '../projects.js';
|
|
8
|
-
import { DEFAULT_AUTO_LOAD_CONFIG } from './types.js';
|
|
9
|
-
import { estimateTokens } from '../context/context-window.js';
|
|
10
|
-
import { getLatestProjectWorkingSetSummary } from './working-set.js';
|
|
11
|
-
import { getHotCacheSummary } from '../hot-cache.js';
|
|
12
|
-
export async function performAutoLoad(projectPath, customConfig) {
|
|
13
|
-
const startTime = Date.now();
|
|
14
|
-
const cfg = { ...DEFAULT_AUTO_LOAD_CONFIG, ...customConfig };
|
|
15
|
-
const result = {
|
|
16
|
-
coreMemoryLoaded: false,
|
|
17
|
-
memoriesLoaded: 0,
|
|
18
|
-
projectContextLoaded: false,
|
|
19
|
-
tokensUsed: 0,
|
|
20
|
-
duration: 0,
|
|
21
|
-
warnings: [],
|
|
22
|
-
};
|
|
23
|
-
if (!cfg.enabled) {
|
|
24
|
-
result.warnings.push('Auto-load disabled by configuration');
|
|
25
|
-
result.duration = Date.now() - startTime;
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const project = await getOrCreateProject(projectPath);
|
|
30
|
-
if (!project) {
|
|
31
|
-
result.warnings.push(`Failed to create/find project: ${projectPath}`);
|
|
32
|
-
result.duration = Date.now() - startTime;
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
const projectId = project.id;
|
|
36
|
-
try {
|
|
37
|
-
const workingSetSummary = await getLatestProjectWorkingSetSummary(projectPath);
|
|
38
|
-
if (workingSetSummary) {
|
|
39
|
-
result.tokensUsed += estimateTokens(workingSetSummary);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
44
|
-
result.warnings.push(`Failed to load session working set: ${msg}`);
|
|
45
|
-
}
|
|
46
|
-
// NEW: Load persistent hot cache (Karpathy-style, survives restart)
|
|
47
|
-
if (cfg.includeCoreMemory) {
|
|
48
|
-
try {
|
|
49
|
-
const hotCacheSummary = await getHotCacheSummary({ projectPath, maxEntries: 5 });
|
|
50
|
-
if (hotCacheSummary) {
|
|
51
|
-
result.tokensUsed += estimateTokens(hotCacheSummary);
|
|
52
|
-
logger.info('[AutoLoad] Hot cache loaded from persistent storage');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
57
|
-
result.warnings.push(`Failed to load hot cache: ${msg}`);
|
|
58
|
-
logger.warn(`[AutoLoad] Failed to load hot cache: ${msg}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (cfg.includeCoreMemory) {
|
|
62
|
-
try {
|
|
63
|
-
await initializeCoreMemory(projectId);
|
|
64
|
-
const coreMemory = await getCoreMemory(projectId);
|
|
65
|
-
if (coreMemory) {
|
|
66
|
-
result.coreMemoryLoaded = true;
|
|
67
|
-
const coreMemoryText = Object.values(coreMemory).join('\n');
|
|
68
|
-
result.tokensUsed += estimateTokens(coreMemoryText);
|
|
69
|
-
logger.info(`[AutoLoad] Core memory loaded for project ${projectId}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
74
|
-
result.warnings.push(`Failed to load core memory: ${msg}`);
|
|
75
|
-
logger.warn(`[AutoLoad] Failed to load core memory: ${msg}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
if (cfg.includeRecentMemories && cfg.recentMemoryCount > 0) {
|
|
79
|
-
try {
|
|
80
|
-
const recentMemories = await search({
|
|
81
|
-
query: '',
|
|
82
|
-
project: projectPath,
|
|
83
|
-
limit: cfg.recentMemoryCount,
|
|
84
|
-
});
|
|
85
|
-
if (recentMemories && recentMemories.length > 0) {
|
|
86
|
-
const importantMemories = recentMemories.filter((m) => (m.importanceScore ?? 50) >= cfg.importanceThreshold);
|
|
87
|
-
result.memoriesLoaded = importantMemories.length;
|
|
88
|
-
for (const memory of importantMemories) {
|
|
89
|
-
result.tokensUsed += estimateTokens(memory.content || '');
|
|
90
|
-
}
|
|
91
|
-
logger.info(`[AutoLoad] Loaded ${result.memoriesLoaded} high-importance memories`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
96
|
-
result.warnings.push(`Failed to load recent memories: ${msg}`);
|
|
97
|
-
logger.warn(`[AutoLoad] Failed to load recent memories: ${msg}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (cfg.includeProjectContext) {
|
|
101
|
-
try {
|
|
102
|
-
const context = await getProjectContext({
|
|
103
|
-
project: projectPath,
|
|
104
|
-
include: ['memories', 'observations'],
|
|
105
|
-
limit: 5,
|
|
106
|
-
});
|
|
107
|
-
if (context) {
|
|
108
|
-
result.projectContextLoaded = true;
|
|
109
|
-
result.tokensUsed += estimateTokens(JSON.stringify(context));
|
|
110
|
-
logger.info('[AutoLoad] Project context loaded');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
115
|
-
result.warnings.push(`Failed to load project context: ${msg}`);
|
|
116
|
-
logger.warn(`[AutoLoad] Failed to load project context: ${msg}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
result.duration = Date.now() - startTime;
|
|
120
|
-
logger.info(`[AutoLoad] Complete: ${result.memoriesLoaded} memories, ${result.tokensUsed} tokens, ${result.duration}ms`);
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
125
|
-
result.warnings.push(`Auto-load failed: ${msg}`);
|
|
126
|
-
result.duration = Date.now() - startTime;
|
|
127
|
-
logger.error(`[AutoLoad] Failed: ${msg}`);
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
export function getAutoLoadConfig() {
|
|
132
|
-
return {
|
|
133
|
-
enabled: config.sessionAutoLoadEnabled,
|
|
134
|
-
includeCoreMemory: true,
|
|
135
|
-
includeRecentMemories: true,
|
|
136
|
-
recentMemoryCount: config.sessionAutoLoadRecentCount,
|
|
137
|
-
importanceThreshold: config.sessionAutoLoadImportanceThreshold,
|
|
138
|
-
includeProjectContext: true,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
export function shouldAutoLoad() {
|
|
142
|
-
return config.sessionAutoLoadEnabled;
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=auto-load.js.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Entity Tracker
|
|
3
|
-
*
|
|
4
|
-
* Tracks "active" entities in conversation sessions to enable
|
|
5
|
-
* reference resolution (e.g., resolving "she" to "Alice").
|
|
6
|
-
*/
|
|
7
|
-
export interface SessionEntity {
|
|
8
|
-
entityId: string;
|
|
9
|
-
entityName: string;
|
|
10
|
-
entityType: string;
|
|
11
|
-
mentionCount: number;
|
|
12
|
-
lastMentionedAt: Date;
|
|
13
|
-
salience: number;
|
|
14
|
-
}
|
|
15
|
-
export interface SessionEntityMap {
|
|
16
|
-
sessionId: string;
|
|
17
|
-
entities: Map<string, SessionEntity>;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Track an entity mention in a session.
|
|
22
|
-
* Updates salience based on recency and frequency.
|
|
23
|
-
*/
|
|
24
|
-
export declare function trackEntityInSession(sessionId: string, entityId: string, entityName: string, entityType: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Get active entities for a session, sorted by salience.
|
|
27
|
-
* Applies time-based decay to salience scores.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getActiveSessionEntities(sessionId: string, options?: {
|
|
30
|
-
limit?: number;
|
|
31
|
-
minSalience?: number;
|
|
32
|
-
entityTypes?: string[];
|
|
33
|
-
}): SessionEntity[];
|
|
34
|
-
/**
|
|
35
|
-
* Resolve a reference (pronoun, definite reference) to an entity in the session.
|
|
36
|
-
* Returns the most salient entity matching the reference type.
|
|
37
|
-
*/
|
|
38
|
-
export declare function resolveReference(sessionId: string, reference: string): SessionEntity | null;
|
|
39
|
-
/**
|
|
40
|
-
* Clear session entities (e.g., when a session ends).
|
|
41
|
-
*/
|
|
42
|
-
export declare function clearSessionEntities(sessionId: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Get all active sessions.
|
|
45
|
-
*/
|
|
46
|
-
export declare function getActiveSessions(): string[];
|
|
47
|
-
/**
|
|
48
|
-
* Decay all session entities (call periodically).
|
|
49
|
-
* Reduces salience of all entities across all sessions.
|
|
50
|
-
*/
|
|
51
|
-
export declare function decayAllSessionEntities(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Persist session entities to the database for durability.
|
|
54
|
-
* Called periodically or on session end.
|
|
55
|
-
*/
|
|
56
|
-
export declare function persistSessionEntities(sessionId: string): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Load session entities from the database.
|
|
59
|
-
* Called when a session starts.
|
|
60
|
-
*/
|
|
61
|
-
export declare function loadSessionEntities(sessionId: string): Promise<void>;
|
|
62
|
-
//# sourceMappingURL=entity-tracker.d.ts.map
|