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,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capture Filter - Smart filtering of tool usage
|
|
3
|
-
*
|
|
4
|
-
* Don't capture everything - filter out noise.
|
|
5
|
-
* Only capture meaningful actions that warrant memory.
|
|
6
|
-
*/
|
|
7
|
-
/** Tool categories for capture */
|
|
8
|
-
export type ToolCategory = 'reading' | 'modification' | 'command' | 'commit' | 'testing' | 'search' | 'planning' | 'other';
|
|
9
|
-
/** Capture decision */
|
|
10
|
-
export interface CaptureDecision {
|
|
11
|
-
shouldCapture: boolean;
|
|
12
|
-
reason?: string;
|
|
13
|
-
priority: 'high' | 'medium' | 'low';
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Check if a tool should be captured
|
|
17
|
-
*
|
|
18
|
-
* Rules:
|
|
19
|
-
* - Write, Edit, MultiEdit → capture (modification)
|
|
20
|
-
* - Bash with commit → capture (commit)
|
|
21
|
-
* - Bash with test → capture (testing)
|
|
22
|
-
* - Task → capture (planning)
|
|
23
|
-
* - Read, Glob, grep → skip (reading - too noisy)
|
|
24
|
-
*/
|
|
25
|
-
export declare function shouldCaptureTool(toolName: string): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Get detailed capture decision
|
|
28
|
-
*/
|
|
29
|
-
export declare function getCaptureDecision(toolName: string): CaptureDecision;
|
|
30
|
-
/**
|
|
31
|
-
* Check if Bash command should be captured based on content
|
|
32
|
-
*/
|
|
33
|
-
export declare function shouldCaptureBashCommand(command: string): {
|
|
34
|
-
capture: boolean;
|
|
35
|
-
reason: string;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Categorize tool for tagging
|
|
39
|
-
*/
|
|
40
|
-
export declare function categorizeTool(toolName: string): ToolCategory;
|
|
41
|
-
//# sourceMappingURL=capture-filter.d.ts.map
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capture Filter - Smart filtering of tool usage
|
|
3
|
-
*
|
|
4
|
-
* Don't capture everything - filter out noise.
|
|
5
|
-
* Only capture meaningful actions that warrant memory.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Check if a tool should be captured
|
|
9
|
-
*
|
|
10
|
-
* Rules:
|
|
11
|
-
* - Write, Edit, MultiEdit → capture (modification)
|
|
12
|
-
* - Bash with commit → capture (commit)
|
|
13
|
-
* - Bash with test → capture (testing)
|
|
14
|
-
* - Task → capture (planning)
|
|
15
|
-
* - Read, Glob, grep → skip (reading - too noisy)
|
|
16
|
-
*/
|
|
17
|
-
export function shouldCaptureTool(toolName) {
|
|
18
|
-
const decision = getCaptureDecision(toolName);
|
|
19
|
-
return decision.shouldCapture;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get detailed capture decision
|
|
23
|
-
*/
|
|
24
|
-
export function getCaptureDecision(toolName) {
|
|
25
|
-
const tool = toolName.toLowerCase();
|
|
26
|
-
// High priority - always capture
|
|
27
|
-
if (['write', 'edit', 'multiedit'].includes(tool)) {
|
|
28
|
-
return {
|
|
29
|
-
shouldCapture: true,
|
|
30
|
-
reason: 'File modification',
|
|
31
|
-
priority: 'high',
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// Command with specific patterns
|
|
35
|
-
if (tool === 'bash') {
|
|
36
|
-
// Let the caller check the command for commit/test patterns
|
|
37
|
-
return {
|
|
38
|
-
shouldCapture: true, // Will be filtered by content check
|
|
39
|
-
reason: 'Command execution',
|
|
40
|
-
priority: 'medium',
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// Task operations
|
|
44
|
-
if (['task', 'todowrite'].includes(tool)) {
|
|
45
|
-
return {
|
|
46
|
-
shouldCapture: true,
|
|
47
|
-
reason: 'Task/planning activity',
|
|
48
|
-
priority: 'high',
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// Skip noisy tools
|
|
52
|
-
if (['read', 'glob', 'grep', 'websearch', 'webfetch', 'codesearch'].includes(tool)) {
|
|
53
|
-
return {
|
|
54
|
-
shouldCapture: false,
|
|
55
|
-
reason: 'Reading/search tool - too noisy',
|
|
56
|
-
priority: 'low',
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
// Skip other common noise
|
|
60
|
-
if (['bash'].includes(tool)) {
|
|
61
|
-
return {
|
|
62
|
-
shouldCapture: false, // Too noisy without filtering
|
|
63
|
-
reason: 'General command - filtered',
|
|
64
|
-
priority: 'low',
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// Default: don't capture unknown tools
|
|
68
|
-
return {
|
|
69
|
-
shouldCapture: false,
|
|
70
|
-
reason: 'Unknown tool',
|
|
71
|
-
priority: 'low',
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Check if Bash command should be captured based on content
|
|
76
|
-
*/
|
|
77
|
-
export function shouldCaptureBashCommand(command) {
|
|
78
|
-
const cmd = command.toLowerCase();
|
|
79
|
-
// Git commits - HIGH priority
|
|
80
|
-
if (cmd.includes('git commit') || cmd.includes('git add') && cmd.includes('git commit')) {
|
|
81
|
-
return { capture: true, reason: 'Git commit' };
|
|
82
|
-
}
|
|
83
|
-
// Tests - HIGH priority
|
|
84
|
-
if (cmd.includes('test') || cmd.includes('jest') || cmd.includes('vitest') ||
|
|
85
|
-
cmd.includes('pytest') || cmd.includes('bun test')) {
|
|
86
|
-
return { capture: true, reason: 'Test execution' };
|
|
87
|
-
}
|
|
88
|
-
// Build/compile - MEDIUM priority
|
|
89
|
-
if (cmd.includes('build') || cmd.includes('compile') || cmd.includes('tsc') ||
|
|
90
|
-
cmd.includes('bun build') || cmd.includes('npm run build')) {
|
|
91
|
-
return { capture: true, reason: 'Build/compile' };
|
|
92
|
-
}
|
|
93
|
-
// Installation - LOW priority
|
|
94
|
-
if (cmd.includes('npm install') || cmd.includes('bun install') ||
|
|
95
|
-
cmd.includes('pip install') || cmd.includes('yarn add')) {
|
|
96
|
-
return { capture: false, reason: 'Package installation - too noisy' };
|
|
97
|
-
}
|
|
98
|
-
// Git operations (non-commit) - LOW priority
|
|
99
|
-
if (cmd.includes('git') && !cmd.includes('commit')) {
|
|
100
|
-
return { capture: false, reason: 'Git operations - not commits' };
|
|
101
|
-
}
|
|
102
|
-
// File operations - MEDIUM priority
|
|
103
|
-
if (cmd.includes('mkdir') || cmd.includes('touch') || cmd.includes('rm ')) {
|
|
104
|
-
return { capture: true, reason: 'File operation' };
|
|
105
|
-
}
|
|
106
|
-
// Default - don't capture
|
|
107
|
-
return { capture: false, reason: 'General command' };
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Categorize tool for tagging
|
|
111
|
-
*/
|
|
112
|
-
export function categorizeTool(toolName) {
|
|
113
|
-
const tool = toolName.toLowerCase();
|
|
114
|
-
if (['write', 'edit', 'multiedit'].includes(tool)) {
|
|
115
|
-
return 'modification';
|
|
116
|
-
}
|
|
117
|
-
if (tool === 'bash') {
|
|
118
|
-
return 'command';
|
|
119
|
-
}
|
|
120
|
-
if (['read', 'glob', 'grep', 'websearch', 'webfetch'].includes(tool)) {
|
|
121
|
-
return 'reading';
|
|
122
|
-
}
|
|
123
|
-
if (['task', 'todowrite', 'todo-read'].includes(tool)) {
|
|
124
|
-
return 'planning';
|
|
125
|
-
}
|
|
126
|
-
return 'other';
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=capture-filter.js.map
|
package/dist/core/hot-cache.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hot Cache - Persistent session context (Karpathy-style)
|
|
3
|
-
*
|
|
4
|
-
* Implements the "hot.md" layer from LLM Wiki pattern:
|
|
5
|
-
* - ~500 words persistent session context
|
|
6
|
-
* - Survives restart (unlike session working set)
|
|
7
|
-
* - Auto-updates on session events
|
|
8
|
-
* - Deduplication and stale detection
|
|
9
|
-
*/
|
|
10
|
-
export interface HotCacheEntry {
|
|
11
|
-
id: string;
|
|
12
|
-
content: string;
|
|
13
|
-
hash: string;
|
|
14
|
-
createdAt: number;
|
|
15
|
-
lastReferencedAt: number;
|
|
16
|
-
referenceCount: number;
|
|
17
|
-
tags?: string[];
|
|
18
|
-
}
|
|
19
|
-
export interface HotCache {
|
|
20
|
-
version: string;
|
|
21
|
-
projectPath: string;
|
|
22
|
-
entries: HotCacheEntry[];
|
|
23
|
-
lastUpdated: number;
|
|
24
|
-
staleEntries: string[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Load hot cache from disk (or create new)
|
|
28
|
-
*/
|
|
29
|
-
export declare function loadHotCache(projectPath?: string): Promise<HotCache>;
|
|
30
|
-
/**
|
|
31
|
-
* Save hot cache to disk
|
|
32
|
-
*/
|
|
33
|
-
export declare function saveHotCache(cache: HotCache): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Add an entry to hot cache (with deduplication)
|
|
36
|
-
*/
|
|
37
|
-
export declare function addToHotCache(content: string, options?: {
|
|
38
|
-
projectPath?: string;
|
|
39
|
-
tags?: string[];
|
|
40
|
-
reference?: boolean;
|
|
41
|
-
}): Promise<HotCache>;
|
|
42
|
-
/**
|
|
43
|
-
* Get hot cache summary for context
|
|
44
|
-
* Returns markdown-formatted summary of recent entries
|
|
45
|
-
*/
|
|
46
|
-
export declare function getHotCacheSummary(options?: {
|
|
47
|
-
projectPath?: string;
|
|
48
|
-
maxEntries?: number;
|
|
49
|
-
}): Promise<string>;
|
|
50
|
-
/**
|
|
51
|
-
* Reference an existing hot cache entry (prevents staleness)
|
|
52
|
-
*/
|
|
53
|
-
export declare function referenceHotCacheEntry(entryId: string, projectPath?: string): Promise<boolean>;
|
|
54
|
-
/**
|
|
55
|
-
* Remove stale entries from hot cache
|
|
56
|
-
*/
|
|
57
|
-
export declare function cleanStaleEntries(projectPath?: string): Promise<number>;
|
|
58
|
-
/**
|
|
59
|
-
* Add session context to hot cache
|
|
60
|
-
* Called from session hooks with key session information
|
|
61
|
-
*/
|
|
62
|
-
export declare function addSessionContextToHotCache(sessionInfo: {
|
|
63
|
-
activeFiles?: string[];
|
|
64
|
-
commands?: string[];
|
|
65
|
-
failures?: string[];
|
|
66
|
-
decisions?: string[];
|
|
67
|
-
hypotheses?: string[];
|
|
68
|
-
}, projectPath?: string): Promise<HotCache>;
|
|
69
|
-
/**
|
|
70
|
-
* Get all hot cache entries (for advanced use)
|
|
71
|
-
*/
|
|
72
|
-
export declare function getHotCacheEntries(projectPath?: string): Promise<HotCacheEntry[]>;
|
|
73
|
-
/**
|
|
74
|
-
* Clear hot cache (dangerous - use with caution)
|
|
75
|
-
*/
|
|
76
|
-
export declare function clearHotCache(projectPath?: string): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Get hot cache statistics
|
|
79
|
-
*/
|
|
80
|
-
export declare function getHotCacheStats(projectPath?: string): Promise<{
|
|
81
|
-
entries: number;
|
|
82
|
-
staleEntries: number;
|
|
83
|
-
oldestEntry: number | null;
|
|
84
|
-
newestEntry: number | null;
|
|
85
|
-
}>;
|
|
86
|
-
//# sourceMappingURL=hot-cache.d.ts.map
|
package/dist/core/hot-cache.js
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hot Cache - Persistent session context (Karpathy-style)
|
|
3
|
-
*
|
|
4
|
-
* Implements the "hot.md" layer from LLM Wiki pattern:
|
|
5
|
-
* - ~500 words persistent session context
|
|
6
|
-
* - Survives restart (unlike session working set)
|
|
7
|
-
* - Auto-updates on session events
|
|
8
|
-
* - Deduplication and stale detection
|
|
9
|
-
*/
|
|
10
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
11
|
-
import { join } from 'path';
|
|
12
|
-
import { createHash } from 'crypto';
|
|
13
|
-
import { logger } from '../logger.js';
|
|
14
|
-
import { getProjectPath } from '../projects.js';
|
|
15
|
-
const HOT_CACHE_VERSION = '1.0.0';
|
|
16
|
-
const MAX_HOT_CACHE_SIZE = 500; // ~500 words max
|
|
17
|
-
const STALE_THRESHOLD_DAYS = 7; // Flag as stale after 7 days
|
|
18
|
-
const STALE_REFERENCE_COUNT = 3; // Minimum refs before considering stale
|
|
19
|
-
let hotCacheInstance = null;
|
|
20
|
-
/**
|
|
21
|
-
* Get the hot cache file path for a project
|
|
22
|
-
*/
|
|
23
|
-
function getHotCachePath(projectPath) {
|
|
24
|
-
return join(projectPath, '.squish', 'hot-cache.json');
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Ensure .squish directory exists
|
|
28
|
-
*/
|
|
29
|
-
async function ensureSquishDir(projectPath) {
|
|
30
|
-
const squishDir = join(projectPath, '.squish');
|
|
31
|
-
if (!existsSync(squishDir)) {
|
|
32
|
-
mkdirSync(squishDir, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
return squishDir;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create content hash for deduplication
|
|
38
|
-
*/
|
|
39
|
-
function hashContent(content) {
|
|
40
|
-
return createHash('sha256').update(content.trim()).digest('hex').slice(0, 12);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Load hot cache from disk (or create new)
|
|
44
|
-
*/
|
|
45
|
-
export async function loadHotCache(projectPath) {
|
|
46
|
-
const path = projectPath || await getProjectPath();
|
|
47
|
-
if (!path) {
|
|
48
|
-
return createEmptyHotCache('');
|
|
49
|
-
}
|
|
50
|
-
const cachePath = getHotCachePath(path);
|
|
51
|
-
try {
|
|
52
|
-
if (existsSync(cachePath)) {
|
|
53
|
-
const content = readFileSync(cachePath, 'utf-8');
|
|
54
|
-
const cache = JSON.parse(content);
|
|
55
|
-
// Clean stale entries on load
|
|
56
|
-
cache.staleEntries = identifyStaleEntries(cache.entries);
|
|
57
|
-
// Remove very stale entries (>14 days)
|
|
58
|
-
cache.entries = cache.entries.filter(entry => {
|
|
59
|
-
const ageDays = (Date.now() - entry.lastReferencedAt) / (24 * 60 * 60 * 1000);
|
|
60
|
-
return ageDays < 14;
|
|
61
|
-
});
|
|
62
|
-
logger.info('[HotCache] Loaded', { entries: cache.entries.length, path });
|
|
63
|
-
return cache;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
logger.warn('[HotCache] Load failed, creating new', { error });
|
|
68
|
-
}
|
|
69
|
-
return createEmptyHotCache(path);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Create empty hot cache
|
|
73
|
-
*/
|
|
74
|
-
function createEmptyHotCache(projectPath) {
|
|
75
|
-
return {
|
|
76
|
-
version: HOT_CACHE_VERSION,
|
|
77
|
-
projectPath,
|
|
78
|
-
entries: [],
|
|
79
|
-
lastUpdated: Date.now(),
|
|
80
|
-
staleEntries: [],
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Identify stale entries (>7 days without enough references)
|
|
85
|
-
*/
|
|
86
|
-
function identifyStaleEntries(entries) {
|
|
87
|
-
const stale = [];
|
|
88
|
-
const now = Date.now();
|
|
89
|
-
for (const entry of entries) {
|
|
90
|
-
const daysSinceRef = (now - entry.lastReferencedAt) / (24 * 60 * 60 * 1000);
|
|
91
|
-
if (daysSinceRef > STALE_THRESHOLD_DAYS && entry.referenceCount < STALE_REFERENCE_COUNT) {
|
|
92
|
-
stale.push(entry.id);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return stale;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Save hot cache to disk
|
|
99
|
-
*/
|
|
100
|
-
export async function saveHotCache(cache) {
|
|
101
|
-
const cachePath = getHotCachePath(cache.projectPath);
|
|
102
|
-
try {
|
|
103
|
-
await ensureSquishDir(cache.projectPath);
|
|
104
|
-
writeFileSync(cachePath, JSON.stringify(cache, null, 2), 'utf-8');
|
|
105
|
-
cache.lastUpdated = Date.now();
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
logger.error('[HotCache] Save failed', { error });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Add an entry to hot cache (with deduplication)
|
|
113
|
-
*/
|
|
114
|
-
export async function addToHotCache(content, options) {
|
|
115
|
-
const path = options?.projectPath || await getProjectPath();
|
|
116
|
-
if (!path) {
|
|
117
|
-
return createEmptyHotCache('');
|
|
118
|
-
}
|
|
119
|
-
const cache = await loadHotCache(path);
|
|
120
|
-
const contentHash = hashContent(content);
|
|
121
|
-
// Check for duplicate by hash
|
|
122
|
-
const existingIndex = cache.entries.findIndex(e => e.hash === contentHash);
|
|
123
|
-
if (existingIndex >= 0) {
|
|
124
|
-
// Update reference info for duplicate
|
|
125
|
-
cache.entries[existingIndex].lastReferencedAt = Date.now();
|
|
126
|
-
cache.entries[existingIndex].referenceCount++;
|
|
127
|
-
await saveHotCache(cache);
|
|
128
|
-
logger.debug('[HotCache] Updated existing entry reference', { hash: contentHash });
|
|
129
|
-
return cache;
|
|
130
|
-
}
|
|
131
|
-
// Add new entry
|
|
132
|
-
const newEntry = {
|
|
133
|
-
id: `hot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
134
|
-
content: content.slice(0, 500), // Limit individual entry size
|
|
135
|
-
hash: contentHash,
|
|
136
|
-
createdAt: Date.now(),
|
|
137
|
-
lastReferencedAt: Date.now(),
|
|
138
|
-
referenceCount: 1,
|
|
139
|
-
tags: options?.tags,
|
|
140
|
-
};
|
|
141
|
-
cache.entries.push(newEntry);
|
|
142
|
-
// Trim if over max size (remove oldest entries)
|
|
143
|
-
if (cache.entries.length > MAX_HOT_CACHE_SIZE) {
|
|
144
|
-
cache.entries = cache.entries
|
|
145
|
-
.sort((a, b) => b.lastReferencedAt - a.lastReferencedAt)
|
|
146
|
-
.slice(0, MAX_HOT_CACHE_SIZE);
|
|
147
|
-
}
|
|
148
|
-
await saveHotCache(cache);
|
|
149
|
-
logger.info('[HotCache] Added new entry', { entries: cache.entries.length });
|
|
150
|
-
return cache;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get hot cache summary for context
|
|
154
|
-
* Returns markdown-formatted summary of recent entries
|
|
155
|
-
*/
|
|
156
|
-
export async function getHotCacheSummary(options) {
|
|
157
|
-
const path = options?.projectPath || await getProjectPath();
|
|
158
|
-
if (!path)
|
|
159
|
-
return '';
|
|
160
|
-
const cache = await loadHotCache(path);
|
|
161
|
-
if (cache.entries.length === 0) {
|
|
162
|
-
return '## Hot Cache\n\nNo active hot memories yet.\n';
|
|
163
|
-
}
|
|
164
|
-
const maxEntries = options?.maxEntries || 10;
|
|
165
|
-
const recentEntries = cache.entries
|
|
166
|
-
.sort((a, b) => b.lastReferencedAt - a.lastReferencedAt)
|
|
167
|
-
.slice(0, maxEntries);
|
|
168
|
-
const lines = ['## Hot Cache\n'];
|
|
169
|
-
for (const entry of recentEntries) {
|
|
170
|
-
const date = new Date(entry.lastReferencedAt).toISOString().split('T')[0];
|
|
171
|
-
const stale = cache.staleEntries.includes(entry.id) ? ' [STALE]' : '';
|
|
172
|
-
lines.push(`- ${entry.content.slice(0, 100)}${entry.content.length > 100 ? '...' : ''}${stale} (${date})`);
|
|
173
|
-
}
|
|
174
|
-
if (cache.staleEntries.length > 0) {
|
|
175
|
-
lines.push(`\n* ${cache.staleEntries.length} entries flagged as stale (consider cleaning)*`);
|
|
176
|
-
}
|
|
177
|
-
return lines.join('\n');
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Reference an existing hot cache entry (prevents staleness)
|
|
181
|
-
*/
|
|
182
|
-
export async function referenceHotCacheEntry(entryId, projectPath) {
|
|
183
|
-
const path = projectPath || await getProjectPath();
|
|
184
|
-
if (!path)
|
|
185
|
-
return false;
|
|
186
|
-
const cache = await loadHotCache(path);
|
|
187
|
-
const entry = cache.entries.find(e => e.id === entryId);
|
|
188
|
-
if (entry) {
|
|
189
|
-
entry.lastReferencedAt = Date.now();
|
|
190
|
-
entry.referenceCount++;
|
|
191
|
-
await saveHotCache(cache);
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Remove stale entries from hot cache
|
|
198
|
-
*/
|
|
199
|
-
export async function cleanStaleEntries(projectPath) {
|
|
200
|
-
const path = projectPath || await getProjectPath();
|
|
201
|
-
if (!path)
|
|
202
|
-
return 0;
|
|
203
|
-
const cache = await loadHotCache(path);
|
|
204
|
-
const staleIdSet = new Set(cache.staleEntries);
|
|
205
|
-
const originalCount = cache.entries.length;
|
|
206
|
-
cache.entries = cache.entries.filter(e => !staleIdSet.has(e.id));
|
|
207
|
-
cache.staleEntries = [];
|
|
208
|
-
await saveHotCache(cache);
|
|
209
|
-
const removed = originalCount - cache.entries.length;
|
|
210
|
-
logger.info('[HotCache] Cleaned stale entries', { removed });
|
|
211
|
-
return removed;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Add session context to hot cache
|
|
215
|
-
* Called from session hooks with key session information
|
|
216
|
-
*/
|
|
217
|
-
export async function addSessionContextToHotCache(sessionInfo, projectPath) {
|
|
218
|
-
const path = projectPath || await getProjectPath();
|
|
219
|
-
if (!path)
|
|
220
|
-
return createEmptyHotCache('');
|
|
221
|
-
// Build context entries from session info
|
|
222
|
-
const entries = [];
|
|
223
|
-
if (sessionInfo.activeFiles?.length) {
|
|
224
|
-
entries.push(`Active files: ${sessionInfo.activeFiles.join(', ')}`);
|
|
225
|
-
}
|
|
226
|
-
if (sessionInfo.commands?.length) {
|
|
227
|
-
entries.push(`Recent commands: ${sessionInfo.commands.slice(-3).join('; ')}`);
|
|
228
|
-
}
|
|
229
|
-
if (sessionInfo.failures?.length) {
|
|
230
|
-
entries.push(`Recent failures: ${sessionInfo.failures.slice(-2).join('; ')}`);
|
|
231
|
-
}
|
|
232
|
-
if (sessionInfo.decisions?.length) {
|
|
233
|
-
entries.push(`Decisions: ${sessionInfo.decisions.join('; ')}`);
|
|
234
|
-
}
|
|
235
|
-
if (sessionInfo.hypotheses?.length) {
|
|
236
|
-
entries.push(`Hypotheses: ${sessionInfo.hypotheses.slice(-2).join('; ')}`);
|
|
237
|
-
}
|
|
238
|
-
// Add each entry to hot cache
|
|
239
|
-
let cache = await loadHotCache(path);
|
|
240
|
-
for (const entry of entries) {
|
|
241
|
-
cache = await addToHotCache(entry, { projectPath: path });
|
|
242
|
-
}
|
|
243
|
-
return cache;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Get all hot cache entries (for advanced use)
|
|
247
|
-
*/
|
|
248
|
-
export async function getHotCacheEntries(projectPath) {
|
|
249
|
-
const path = projectPath || await getProjectPath();
|
|
250
|
-
if (!path)
|
|
251
|
-
return [];
|
|
252
|
-
const cache = await loadHotCache(path);
|
|
253
|
-
return cache.entries;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Clear hot cache (dangerous - use with caution)
|
|
257
|
-
*/
|
|
258
|
-
export async function clearHotCache(projectPath) {
|
|
259
|
-
const path = projectPath || await getProjectPath();
|
|
260
|
-
if (!path)
|
|
261
|
-
return;
|
|
262
|
-
const cache = createEmptyHotCache(path);
|
|
263
|
-
await saveHotCache(cache);
|
|
264
|
-
logger.info('[HotCache] Cleared');
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Get hot cache statistics
|
|
268
|
-
*/
|
|
269
|
-
export async function getHotCacheStats(projectPath) {
|
|
270
|
-
const path = projectPath || await getProjectPath();
|
|
271
|
-
if (!path)
|
|
272
|
-
return { entries: 0, staleEntries: 0, oldestEntry: null, newestEntry: null };
|
|
273
|
-
const cache = await loadHotCache(path);
|
|
274
|
-
if (cache.entries.length === 0) {
|
|
275
|
-
return { entries: 0, staleEntries: 0, oldestEntry: null, newestEntry: null };
|
|
276
|
-
}
|
|
277
|
-
const timestamps = cache.entries.map(e => e.createdAt);
|
|
278
|
-
return {
|
|
279
|
-
entries: cache.entries.length,
|
|
280
|
-
staleEntries: cache.staleEntries.length,
|
|
281
|
-
oldestEntry: Math.min(...timestamps),
|
|
282
|
-
newestEntry: Math.max(...timestamps),
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
//# sourceMappingURL=hot-cache.js.map
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './storage/cache';
|
|
2
|
-
export * from './context/context';
|
|
3
|
-
export * from './storage/database';
|
|
4
|
-
export * from './embeddings';
|
|
5
|
-
export * from './ingestion/learnings';
|
|
6
|
-
export * from './security/privacy';
|
|
7
|
-
export * from './projects';
|
|
8
|
-
export * from './security/secret-detector';
|
|
9
|
-
export * from './worker';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Shared services - Core utilities and services
|
|
2
|
-
export * from './storage/cache';
|
|
3
|
-
export * from './context/context';
|
|
4
|
-
export * from './storage/database';
|
|
5
|
-
export * from './embeddings';
|
|
6
|
-
export * from './ingestion/learnings';
|
|
7
|
-
export * from './security/privacy';
|
|
8
|
-
export * from './projects';
|
|
9
|
-
export * from './security/secret-detector';
|
|
10
|
-
export * from './worker';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent-Aware Memory Management
|
|
3
|
-
* Provides agent isolation and visibility rules
|
|
4
|
-
*/
|
|
5
|
-
export type VisibilityScope = 'private' | 'project' | 'team' | 'global';
|
|
6
|
-
export interface AgentContext {
|
|
7
|
-
agentId: string;
|
|
8
|
-
agentRole?: string;
|
|
9
|
-
userId?: string;
|
|
10
|
-
projectId?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Store a memory with agent context
|
|
14
|
-
*/
|
|
15
|
-
export declare function storeAgentMemory(content: string, context: AgentContext, options?: {
|
|
16
|
-
type?: string;
|
|
17
|
-
sector?: string;
|
|
18
|
-
visibilityScope?: VisibilityScope;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
metadata?: Record<string, unknown>;
|
|
21
|
-
}): Promise<string>;
|
|
22
|
-
//# sourceMappingURL=agent-memory.d.ts.map
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent-Aware Memory Management
|
|
3
|
-
* Provides agent isolation and visibility rules
|
|
4
|
-
*/
|
|
5
|
-
import { and, eq } from 'drizzle-orm';
|
|
6
|
-
import { randomUUID } from 'crypto';
|
|
7
|
-
import { getDb } from '../../db/index.js';
|
|
8
|
-
import { getSchema } from '../../db/schema.js';
|
|
9
|
-
import { config } from '../../config.js';
|
|
10
|
-
import { getEmbedding } from '../embeddings.js';
|
|
11
|
-
import { logger } from '../logger.js';
|
|
12
|
-
/**
|
|
13
|
-
* Store a memory with agent context
|
|
14
|
-
*/
|
|
15
|
-
export async function storeAgentMemory(content, context, options = {}) {
|
|
16
|
-
if (!config.agentIsolationEnabled) {
|
|
17
|
-
// Fall back to standard memory storage
|
|
18
|
-
return await storeStandardMemory(content, options);
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const db = await getDb();
|
|
22
|
-
const schema = await getSchema();
|
|
23
|
-
const memoryId = randomUUID();
|
|
24
|
-
const embedding = await getEmbedding(content);
|
|
25
|
-
const visibilityScope = options.visibilityScope || config.defaultVisibilityScope;
|
|
26
|
-
// Determine scopes based on visibility
|
|
27
|
-
const readScope = calculateReadScope(context, visibilityScope);
|
|
28
|
-
const writeScope = [`agent:${context.agentId}`];
|
|
29
|
-
await db.insert(schema.memories).values({
|
|
30
|
-
id: memoryId,
|
|
31
|
-
content,
|
|
32
|
-
type: options.type || 'observation',
|
|
33
|
-
sector: options.sector || 'episodic',
|
|
34
|
-
agentId: context.agentId,
|
|
35
|
-
agentRole: context.agentRole || 'general',
|
|
36
|
-
userId: context.userId || null,
|
|
37
|
-
projectId: context.projectId || null,
|
|
38
|
-
visibilityScope,
|
|
39
|
-
writeScope,
|
|
40
|
-
readScope,
|
|
41
|
-
tags: options.tags || [],
|
|
42
|
-
metadata: options.metadata || null,
|
|
43
|
-
embedding: embedding || null,
|
|
44
|
-
confidence: 100,
|
|
45
|
-
relevanceScore: 50,
|
|
46
|
-
createdAt: new Date(),
|
|
47
|
-
updatedAt: new Date(),
|
|
48
|
-
});
|
|
49
|
-
return memoryId;
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
logger.error('Error storing agent memory', error);
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Helper Functions
|
|
57
|
-
function calculateReadScope(context, visibility) {
|
|
58
|
-
switch (visibility) {
|
|
59
|
-
case 'private':
|
|
60
|
-
return [`agent:${context.agentId}`];
|
|
61
|
-
case 'project':
|
|
62
|
-
return [`agent:${context.agentId}`, `project:${context.projectId || '*'}`];
|
|
63
|
-
case 'team':
|
|
64
|
-
return [`agent:${context.agentId}`, 'team:*'];
|
|
65
|
-
case 'global':
|
|
66
|
-
return ['*'];
|
|
67
|
-
default:
|
|
68
|
-
return [`agent:${context.agentId}`];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async function storeStandardMemory(content, options = {}) {
|
|
72
|
-
// Fallback to standard memory storage if agent isolation is disabled
|
|
73
|
-
const db = await getDb();
|
|
74
|
-
const schema = await getSchema();
|
|
75
|
-
const memoryId = randomUUID();
|
|
76
|
-
const embedding = await getEmbedding(content);
|
|
77
|
-
await db.insert(schema.memories).values({
|
|
78
|
-
id: memoryId,
|
|
79
|
-
content,
|
|
80
|
-
type: options.type || 'observation',
|
|
81
|
-
sector: options.sector || 'episodic',
|
|
82
|
-
tags: options.tags || [],
|
|
83
|
-
metadata: options.metadata || null,
|
|
84
|
-
embedding: embedding || null,
|
|
85
|
-
confidence: 100,
|
|
86
|
-
relevanceScore: 50,
|
|
87
|
-
createdAt: new Date(),
|
|
88
|
-
updatedAt: new Date(),
|
|
89
|
-
});
|
|
90
|
-
return memoryId;
|
|
91
|
-
}
|
|
92
|
-
async function searchStandardMemories(query, options = {}) {
|
|
93
|
-
// Fallback to standard memory search if agent isolation is disabled
|
|
94
|
-
const db = await getDb();
|
|
95
|
-
const schema = await getSchema();
|
|
96
|
-
const limit = Math.min(options.limit || 10, 100);
|
|
97
|
-
let where = undefined;
|
|
98
|
-
if (options.type) {
|
|
99
|
-
where = eq(schema.memories.type, options.type);
|
|
100
|
-
}
|
|
101
|
-
return await db
|
|
102
|
-
.select()
|
|
103
|
-
.from(schema.memories)
|
|
104
|
-
.where(where
|
|
105
|
-
? and(where, schema.memories.content.ilike(`%${query}%`))
|
|
106
|
-
: schema.memories.content.ilike(`%${query}%`))
|
|
107
|
-
.limit(limit);
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=agent-memory.js.map
|