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,201 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'crypto';
|
|
2
|
-
function normalizeContent(toolResult) {
|
|
3
|
-
if (typeof toolResult === 'string')
|
|
4
|
-
return toolResult;
|
|
5
|
-
if (toolResult == null)
|
|
6
|
-
return '';
|
|
7
|
-
if (typeof toolResult === 'object') {
|
|
8
|
-
try {
|
|
9
|
-
return JSON.stringify(toolResult, null, 2);
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return String(toolResult);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return String(toolResult);
|
|
16
|
-
}
|
|
17
|
-
function estimateNoiseSavings(raw, distilled) {
|
|
18
|
-
return Math.max(0, raw.length - distilled.length);
|
|
19
|
-
}
|
|
20
|
-
function extractEntityTerms(content) {
|
|
21
|
-
const matches = content.match(/\b([A-Z][A-Za-z0-9]+|[a-z]+(?:\.[a-z0-9_-]+)+|[A-Za-z0-9_-]+\.ts)\b/g) ?? [];
|
|
22
|
-
return [...new Set(matches.filter((term) => term.length > 2))].slice(0, 6);
|
|
23
|
-
}
|
|
24
|
-
function inferPlaceHint(toolName, normalized) {
|
|
25
|
-
if (['write', 'edit', 'multiedit'].includes(toolName.toLowerCase()) || /\b(fix|bug|implement|refactor|edited|wrote)\b/.test(normalized)) {
|
|
26
|
-
return { placeType: 'wip', confidence: 0.88 };
|
|
27
|
-
}
|
|
28
|
-
if (/\b(test|assertionerror|traceback|exception|experiment|verify)\b/.test(normalized)) {
|
|
29
|
-
return { placeType: 'sandbox', confidence: 0.92 };
|
|
30
|
-
}
|
|
31
|
-
if (/\b(hypothesis|plan|decided|roadmap|task|todo|investigate)\b/.test(normalized)) {
|
|
32
|
-
return { placeType: 'board', confidence: 0.74 };
|
|
33
|
-
}
|
|
34
|
-
if (/\b(research|docs|pattern|reference|api|architecture)\b/.test(normalized)) {
|
|
35
|
-
return { placeType: 'ref', confidence: 0.72 };
|
|
36
|
-
}
|
|
37
|
-
if (/\b(idea|explore|future|concept)\b/.test(normalized)) {
|
|
38
|
-
return { placeType: 'sparks', confidence: 0.68 };
|
|
39
|
-
}
|
|
40
|
-
return { placeType: null, confidence: 0 };
|
|
41
|
-
}
|
|
42
|
-
function inferGraphHint(normalized, content, classification) {
|
|
43
|
-
if (classification === 'discard' || classification === 'session-only') {
|
|
44
|
-
return { shouldEnrich: false, entityTerms: [], reason: 'non-durable signal' };
|
|
45
|
-
}
|
|
46
|
-
const entityTerms = extractEntityTerms(content);
|
|
47
|
-
const hasStructuredSignal = entityTerms.length > 0 || /\b(fix|decision|preference|error|graph|ranking|entity|relationship)\b/.test(normalized);
|
|
48
|
-
if (!hasStructuredSignal) {
|
|
49
|
-
return { shouldEnrich: false, entityTerms: [], reason: 'no graph-worthy entities' };
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
shouldEnrich: true,
|
|
53
|
-
entityTerms,
|
|
54
|
-
reason: 'durable signal with identifiable entities',
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function hashSignalContent(content) {
|
|
58
|
-
return createHash('sha1').update(content).digest('hex');
|
|
59
|
-
}
|
|
60
|
-
export function classifySignalEvent(input) {
|
|
61
|
-
const toolName = input.toolName;
|
|
62
|
-
const command = String(input.toolInput?.command ?? input.toolInput?.cmd ?? '');
|
|
63
|
-
const content = normalizeContent(input.toolResult);
|
|
64
|
-
const normalized = `${command}\n${content}`.toLowerCase();
|
|
65
|
-
const reasons = [];
|
|
66
|
-
const noisyCommand = /\b(npm|bun|pnpm|yarn)\s+(install|add)\b/.test(normalized) ||
|
|
67
|
-
/\bdownload(ed|ing)?\b|\bfetch(ed|ing)?\b|\bprogress\b|\bresolved\b/.test(normalized);
|
|
68
|
-
if (noisyCommand) {
|
|
69
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
70
|
-
reasons.push('noise filtered from install/build output');
|
|
71
|
-
return {
|
|
72
|
-
classification: 'discard',
|
|
73
|
-
reasons,
|
|
74
|
-
storeRaw: false,
|
|
75
|
-
importance: 'low',
|
|
76
|
-
wakeUpPriority: 'low',
|
|
77
|
-
placeHint,
|
|
78
|
-
graphHint: inferGraphHint(normalized, content, 'discard'),
|
|
79
|
-
content,
|
|
80
|
-
contentHash: hashSignalContent(normalized),
|
|
81
|
-
estimatedSavings: content.length,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
if (/\b(current hypothesis|hypothesis:|investigate|trying next)\b/.test(normalized)) {
|
|
85
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
86
|
-
reasons.push('active session hypothesis');
|
|
87
|
-
return {
|
|
88
|
-
classification: 'session-only',
|
|
89
|
-
reasons,
|
|
90
|
-
storeRaw: false,
|
|
91
|
-
importance: 'medium',
|
|
92
|
-
wakeUpPriority: 'high',
|
|
93
|
-
placeHint,
|
|
94
|
-
graphHint: inferGraphHint(normalized, content, 'session-only'),
|
|
95
|
-
content,
|
|
96
|
-
contentHash: hashSignalContent(normalized),
|
|
97
|
-
estimatedSavings: 0,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
if (/\bcorrection:|actually\b|\binstead of\b|\bprefer(s)?\b/.test(normalized)) {
|
|
101
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
102
|
-
reasons.push('correction or preference worth durable retention');
|
|
103
|
-
return {
|
|
104
|
-
classification: 'durable-distilled',
|
|
105
|
-
reasons,
|
|
106
|
-
storeRaw: false,
|
|
107
|
-
importance: 'high',
|
|
108
|
-
wakeUpPriority: 'high',
|
|
109
|
-
placeHint,
|
|
110
|
-
graphHint: inferGraphHint(normalized, content, 'durable-distilled'),
|
|
111
|
-
content,
|
|
112
|
-
contentHash: hashSignalContent(normalized),
|
|
113
|
-
estimatedSavings: estimateNoiseSavings(content, distillSignalEvent({
|
|
114
|
-
toolName,
|
|
115
|
-
command,
|
|
116
|
-
content,
|
|
117
|
-
classification: 'durable-distilled',
|
|
118
|
-
})),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (/\b(fail|failed|failing|assertionerror|stack trace|traceback|exception)\b/.test(normalized) ||
|
|
122
|
-
/\b(test|pytest|vitest|jest|bun test)\b/.test(normalized)) {
|
|
123
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
124
|
-
reasons.push('test or debugging signal with nuance-sensitive output');
|
|
125
|
-
return {
|
|
126
|
-
classification: 'durable-raw+distilled',
|
|
127
|
-
reasons,
|
|
128
|
-
storeRaw: true,
|
|
129
|
-
importance: 'high',
|
|
130
|
-
wakeUpPriority: 'high',
|
|
131
|
-
placeHint,
|
|
132
|
-
graphHint: inferGraphHint(normalized, content, 'durable-raw+distilled'),
|
|
133
|
-
content,
|
|
134
|
-
contentHash: hashSignalContent(normalized),
|
|
135
|
-
estimatedSavings: estimateNoiseSavings(content, distillSignalEvent({
|
|
136
|
-
toolName,
|
|
137
|
-
command,
|
|
138
|
-
content,
|
|
139
|
-
classification: 'durable-raw+distilled',
|
|
140
|
-
})),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
if (['write', 'edit', 'multiedit'].includes(toolName.toLowerCase())) {
|
|
144
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
145
|
-
reasons.push('meaningful file modification');
|
|
146
|
-
return {
|
|
147
|
-
classification: 'durable-distilled',
|
|
148
|
-
reasons,
|
|
149
|
-
storeRaw: false,
|
|
150
|
-
importance: 'medium',
|
|
151
|
-
wakeUpPriority: 'medium',
|
|
152
|
-
placeHint,
|
|
153
|
-
graphHint: inferGraphHint(normalized, content, 'durable-distilled'),
|
|
154
|
-
content,
|
|
155
|
-
contentHash: hashSignalContent(normalized),
|
|
156
|
-
estimatedSavings: estimateNoiseSavings(content, distillSignalEvent({
|
|
157
|
-
toolName,
|
|
158
|
-
command,
|
|
159
|
-
content,
|
|
160
|
-
classification: 'durable-distilled',
|
|
161
|
-
})),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
reasons.push('session-scoped operational context');
|
|
165
|
-
const placeHint = inferPlaceHint(toolName, normalized);
|
|
166
|
-
return {
|
|
167
|
-
classification: 'session-only',
|
|
168
|
-
reasons,
|
|
169
|
-
storeRaw: false,
|
|
170
|
-
importance: 'low',
|
|
171
|
-
wakeUpPriority: 'low',
|
|
172
|
-
placeHint,
|
|
173
|
-
graphHint: inferGraphHint(normalized, content, 'session-only'),
|
|
174
|
-
content,
|
|
175
|
-
contentHash: hashSignalContent(normalized),
|
|
176
|
-
estimatedSavings: 0,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
export function distillSignalEvent(input) {
|
|
180
|
-
const lines = input.content
|
|
181
|
-
.split(/\r?\n/)
|
|
182
|
-
.map((line) => line.trim())
|
|
183
|
-
.filter(Boolean);
|
|
184
|
-
const important = lines.filter((line) => /\b(fail|error|exception|traceback|assert|stack|correction|prefer|decision|fix|edited|wrote)\b/i.test(line));
|
|
185
|
-
const selected = important.length > 0 ? important : lines.slice(0, 4);
|
|
186
|
-
const cleaned = selected.filter((line) => !/\b(pass(ing)?|resolved|download(ed|ing)?|progress|packages? added)\b/i.test(line));
|
|
187
|
-
if (/assertionerror|traceback|exception|stack/i.test(input.content) && !cleaned.some((line) => /assertionerror|traceback|exception|stack/i.test(line))) {
|
|
188
|
-
const extra = lines.find((line) => /assertionerror|traceback|exception|stack/i.test(line));
|
|
189
|
-
if (extra)
|
|
190
|
-
cleaned.push(extra);
|
|
191
|
-
}
|
|
192
|
-
return cleaned.slice(0, 6).join('\n');
|
|
193
|
-
}
|
|
194
|
-
export function shouldReturnRawFallback(input) {
|
|
195
|
-
if (!input.hasRawFallback)
|
|
196
|
-
return false;
|
|
197
|
-
if (input.nuanceSuppressed)
|
|
198
|
-
return true;
|
|
199
|
-
return /\b(raw|original|full|stack trace|traceback|stderr|stdout|rewind)\b/i.test(input.query);
|
|
200
|
-
}
|
|
201
|
-
//# sourceMappingURL=signal-engine.js.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** Obsidian Vault Integration
|
|
2
|
-
*
|
|
3
|
-
* Appends hot memories to Obsidian daily notes
|
|
4
|
-
* Format: YYYY-MM-DD.md with memory blocks
|
|
5
|
-
*/
|
|
6
|
-
export interface ObsidianMemoryInput {
|
|
7
|
-
content: string;
|
|
8
|
-
id: string;
|
|
9
|
-
type: string;
|
|
10
|
-
tags: string[];
|
|
11
|
-
reasoning?: string;
|
|
12
|
-
memoryContext?: string;
|
|
13
|
-
examples?: string;
|
|
14
|
-
exceptions?: string;
|
|
15
|
-
source?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Append a memory to the daily note in Obsidian vault
|
|
19
|
-
* Creates YYYY-MM-DD.md file if it doesn't exist
|
|
20
|
-
*/
|
|
21
|
-
export declare function appendToObsidianVault(memory: ObsidianMemoryInput, vaultPath: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Check if Obsidian vault is connected and accessible
|
|
24
|
-
*/
|
|
25
|
-
export declare function isObsidianConnected(vaultPath: string): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Read existing memories from Obsidian vault (for import feature)
|
|
28
|
-
* Scans vault for .md files and extracts memory blocks
|
|
29
|
-
*/
|
|
30
|
-
export declare function readFromVault(vaultPath: string): Promise<ObsidianMemoryInput[]>;
|
|
31
|
-
//# sourceMappingURL=obsidian-vault.d.ts.map
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/** Obsidian Vault Integration
|
|
2
|
-
*
|
|
3
|
-
* Appends hot memories to Obsidian daily notes
|
|
4
|
-
* Format: YYYY-MM-DD.md with memory blocks
|
|
5
|
-
*/
|
|
6
|
-
import { existsSync, mkdirSync, appendFileSync, readFileSync, readdirSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import { randomUUID } from 'crypto';
|
|
9
|
-
import { logger } from '../logger.js';
|
|
10
|
-
/**
|
|
11
|
-
* Append a memory to the daily note in Obsidian vault
|
|
12
|
-
* Creates YYYY-MM-DD.md file if it doesn't exist
|
|
13
|
-
*/
|
|
14
|
-
export async function appendToObsidianVault(memory, vaultPath) {
|
|
15
|
-
const today = new Date();
|
|
16
|
-
const year = today.getFullYear();
|
|
17
|
-
const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
18
|
-
const day = String(today.getDate()).padStart(2, '0');
|
|
19
|
-
const dateStr = `${year}-${month}-${day}`;
|
|
20
|
-
const dailyNotePath = join(vaultPath, `${dateStr}.md`);
|
|
21
|
-
// Ensure vault directory exists
|
|
22
|
-
if (!existsSync(vaultPath)) {
|
|
23
|
-
mkdirSync(vaultPath, { recursive: true });
|
|
24
|
-
logger.info(`[Obsidian] Created vault directory: ${vaultPath}`);
|
|
25
|
-
}
|
|
26
|
-
// Build memory block content
|
|
27
|
-
const memoryBlock = formatMemoryAsBlock(memory);
|
|
28
|
-
// Check if daily note exists, if not create with header
|
|
29
|
-
if (!existsSync(dailyNotePath)) {
|
|
30
|
-
const header = `# ${dateStr}\n\n## Squish Memories\n\n`;
|
|
31
|
-
appendFileSync(dailyNotePath, header, 'utf-8');
|
|
32
|
-
logger.info(`[Obsidian] Created daily note: ${dailyNotePath}`);
|
|
33
|
-
}
|
|
34
|
-
// Append memory block
|
|
35
|
-
appendFileSync(dailyNotePath, memoryBlock + '\n\n', 'utf-8');
|
|
36
|
-
logger.info(`[Obsidian] Appended memory to ${dateStr}.md`);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Format memory as Obsidian-compatible block
|
|
40
|
-
*/
|
|
41
|
-
function formatMemoryAsBlock(memory) {
|
|
42
|
-
const lines = [];
|
|
43
|
-
// Memory content as checkbox (can be toggled in Obsidian)
|
|
44
|
-
lines.push(`- [ ] "${memory.content}"`);
|
|
45
|
-
// Add ID reference for linking
|
|
46
|
-
lines.push(` - **id:** \`${memory.id}\``);
|
|
47
|
-
// Type and tags
|
|
48
|
-
if (memory.type) {
|
|
49
|
-
lines.push(` - **type:** ${memory.type}`);
|
|
50
|
-
}
|
|
51
|
-
if (memory.tags && memory.tags.length > 0) {
|
|
52
|
-
const tagList = memory.tags.map(t => `#${t.replace(/\s+/g, '-')}`).join(' ');
|
|
53
|
-
lines.push(` - **tags:** ${tagList}`);
|
|
54
|
-
}
|
|
55
|
-
// Rich context fields
|
|
56
|
-
if (memory.source) {
|
|
57
|
-
lines.push(` - **source:** ${memory.source}`);
|
|
58
|
-
}
|
|
59
|
-
if (memory.reasoning) {
|
|
60
|
-
lines.push(` - **reasoning:** ${memory.reasoning}`);
|
|
61
|
-
}
|
|
62
|
-
if (memory.memoryContext) {
|
|
63
|
-
lines.push(` - **context:** ${memory.memoryContext}`);
|
|
64
|
-
}
|
|
65
|
-
if (memory.examples) {
|
|
66
|
-
lines.push(` - **examples:** ${memory.examples}`);
|
|
67
|
-
}
|
|
68
|
-
if (memory.exceptions) {
|
|
69
|
-
lines.push(` - **exceptions:** ${memory.exceptions}`);
|
|
70
|
-
}
|
|
71
|
-
return lines.join('\n');
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Check if Obsidian vault is connected and accessible
|
|
75
|
-
*/
|
|
76
|
-
export function isObsidianConnected(vaultPath) {
|
|
77
|
-
if (!vaultPath || vaultPath === '') {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
// Check if path exists or can be created
|
|
81
|
-
const parentDir = vaultPath.includes('/')
|
|
82
|
-
? vaultPath.split('/').slice(0, -1).join('/')
|
|
83
|
-
: vaultPath.split('\\').slice(0, -1).join('\\');
|
|
84
|
-
return existsSync(parentDir) || true; // Assume creatable if parent exists
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Read existing memories from Obsidian vault (for import feature)
|
|
88
|
-
* Scans vault for .md files and extracts memory blocks
|
|
89
|
-
*/
|
|
90
|
-
export async function readFromVault(vaultPath) {
|
|
91
|
-
if (!existsSync(vaultPath)) {
|
|
92
|
-
logger.warn(`[Obsidian] Vault path does not exist: ${vaultPath}`);
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
|
-
const memories = [];
|
|
96
|
-
// Recursively find all .md files
|
|
97
|
-
const mdFiles = await findMarkdownFiles(vaultPath);
|
|
98
|
-
for (const filePath of mdFiles) {
|
|
99
|
-
try {
|
|
100
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
101
|
-
const filename = filePath.split(/[/\\]/).pop() || '';
|
|
102
|
-
// Extract frontmatter if present
|
|
103
|
-
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
104
|
-
let tags = [];
|
|
105
|
-
if (frontmatterMatch) {
|
|
106
|
-
const tagMatch = frontmatterMatch[1].match(/tags:\s*\[([^\]]*)\]/);
|
|
107
|
-
if (tagMatch) {
|
|
108
|
-
tags = tagMatch[1].split(',').map((t) => t.trim()).filter(Boolean);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// Extract content after frontmatter
|
|
112
|
-
const body = frontmatterMatch ? content.slice(frontmatterMatch[0].length).trim() : content;
|
|
113
|
-
// Skip empty files or very short ones
|
|
114
|
-
if (body.length < 10)
|
|
115
|
-
continue;
|
|
116
|
-
memories.push({
|
|
117
|
-
id: randomUUID(),
|
|
118
|
-
content: body,
|
|
119
|
-
tags,
|
|
120
|
-
type: 'observation'
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
logger.warn(`[Obsidian] Failed to read file ${filePath}: ${error}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
logger.info(`[Obsidian] Found ${memories.length} memories in vault`);
|
|
128
|
-
return memories;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Recursively find all markdown files in a directory
|
|
132
|
-
*/
|
|
133
|
-
async function findMarkdownFiles(dir) {
|
|
134
|
-
const files = [];
|
|
135
|
-
try {
|
|
136
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
137
|
-
for (const entry of entries) {
|
|
138
|
-
const fullPath = join(dir, entry.name);
|
|
139
|
-
if (entry.isDirectory()) {
|
|
140
|
-
// Skip hidden directories
|
|
141
|
-
if (!entry.name.startsWith('.')) {
|
|
142
|
-
const subFiles = await findMarkdownFiles(fullPath);
|
|
143
|
-
files.push(...subFiles);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
147
|
-
files.push(fullPath);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
logger.warn(`[Obsidian] Failed to read directory ${dir}: ${error}`);
|
|
153
|
-
}
|
|
154
|
-
return files;
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=obsidian-vault.js.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Layer Extractor - Creates L0/L1 truncated layers for token-efficient hierarchical retrieval */
|
|
2
|
-
export interface LayerGenerationConfig {
|
|
3
|
-
l0MaxLength?: number;
|
|
4
|
-
l1MaxLength?: number;
|
|
5
|
-
autoGenerate?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface LayerGenerationResult {
|
|
8
|
-
l0?: string;
|
|
9
|
-
l1?: string;
|
|
10
|
-
l2?: string;
|
|
11
|
-
tokenCounts: {
|
|
12
|
-
l0: number;
|
|
13
|
-
l1: number;
|
|
14
|
-
l2: number;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Extract L0/L1/L2 layers for content via truncation
|
|
19
|
-
*/
|
|
20
|
-
export declare function extractLayers(content: string, config?: LayerGenerationConfig): Promise<LayerGenerationResult>;
|
|
21
|
-
/**
|
|
22
|
-
* Check if content should have layers auto-extracted
|
|
23
|
-
*/
|
|
24
|
-
export declare function shouldAutoGenerate(contentLength: number): boolean;
|
|
25
|
-
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/** Layer Extractor - Creates L0/L1 truncated layers for token-efficient hierarchical retrieval */
|
|
2
|
-
const DEFAULT_CONFIG = {
|
|
3
|
-
l0MaxLength: 50,
|
|
4
|
-
l1MaxLength: 300,
|
|
5
|
-
autoGenerate: true,
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Extract L0/L1/L2 layers for content via truncation
|
|
9
|
-
*/
|
|
10
|
-
export async function extractLayers(content, config = {}) {
|
|
11
|
-
const l0MaxLength = config.l0MaxLength ?? DEFAULT_CONFIG.l0MaxLength;
|
|
12
|
-
const l1MaxLength = config.l1MaxLength ?? DEFAULT_CONFIG.l1MaxLength;
|
|
13
|
-
// Extract L0 and L1 in parallel
|
|
14
|
-
const [l0, l1] = await Promise.all([
|
|
15
|
-
extractL0Truncation(content, l0MaxLength),
|
|
16
|
-
extractL1Truncation(content, l1MaxLength),
|
|
17
|
-
]);
|
|
18
|
-
const l2Tokens = countTokens(content);
|
|
19
|
-
const l0Tokens = countTokens(l0 || '');
|
|
20
|
-
const l1Tokens = countTokens(l1 || '');
|
|
21
|
-
return {
|
|
22
|
-
l0: l0 ?? '',
|
|
23
|
-
l1: l1 ?? '',
|
|
24
|
-
l2: content,
|
|
25
|
-
tokenCounts: {
|
|
26
|
-
l0: l0Tokens,
|
|
27
|
-
l1: l1Tokens,
|
|
28
|
-
l2: l2Tokens,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Extract L0: Ultra-short truncated preview (first sentence or chars)
|
|
34
|
-
*/
|
|
35
|
-
async function extractL0Truncation(content, maxLength) {
|
|
36
|
-
// Simple truncation for L0 (first sentence or chars)
|
|
37
|
-
const trimmed = content.trim();
|
|
38
|
-
const sentences = trimmed.split(/[.!?]/).filter(s => s.trim().length > 0);
|
|
39
|
-
// Take first non-empty sentence and truncate if needed
|
|
40
|
-
let result = sentences.length > 0 ? sentences[0] : trimmed.substring(0, maxLength);
|
|
41
|
-
if (result.length > maxLength) {
|
|
42
|
-
result = result.substring(0, maxLength - 3) + '...';
|
|
43
|
-
}
|
|
44
|
-
return result.trim();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Extract L1: Short truncated preview (first 2 meaningful sentences)
|
|
48
|
-
*/
|
|
49
|
-
async function extractL1Truncation(content, maxLength) {
|
|
50
|
-
// Simple truncation for L1 (first 2 meaningful sentences)
|
|
51
|
-
const trimmed = content.trim();
|
|
52
|
-
const sentences = trimmed.split(/[.!?]/).filter(s => s.trim().length > 10);
|
|
53
|
-
// Take first meaningful sentences and truncate if needed
|
|
54
|
-
let result = sentences.length > 0
|
|
55
|
-
? sentences.slice(0, 2).join(' ').trim()
|
|
56
|
-
: trimmed.substring(0, maxLength);
|
|
57
|
-
if (result.length > maxLength) {
|
|
58
|
-
result = result.substring(0, maxLength - 3) + '...';
|
|
59
|
-
}
|
|
60
|
-
return result.trim();
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Count tokens (approximate, 4 chars = 1 token for English)
|
|
64
|
-
*/
|
|
65
|
-
function countTokens(text) {
|
|
66
|
-
// Simple approximation: 4 chars per token
|
|
67
|
-
return Math.ceil(text.length / 4);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Check if content should have layers auto-extracted
|
|
71
|
-
*/
|
|
72
|
-
export function shouldAutoGenerate(contentLength) {
|
|
73
|
-
const threshold = 500;
|
|
74
|
-
return contentLength > threshold;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=generator.js.map
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database Client & Schema Loading Abstraction
|
|
3
|
-
*
|
|
4
|
-
* Provides a unified interface for accessing both the database client and schema
|
|
5
|
-
* in a single call, eliminating repetitive patterns of:
|
|
6
|
-
* `const db = createDatabaseClient(await getDb()); const schema = await getSchema();`
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Single async call to get both db and schema
|
|
10
|
-
* - Consistent error handling with clear messages
|
|
11
|
-
* - Preserves schema caching
|
|
12
|
-
* - Provides raw connection for special cases
|
|
13
|
-
* - Helper `withDbClient` for functional programming patterns
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // Old pattern (repetitive)
|
|
18
|
-
* const db = createDatabaseClient(await getDb());
|
|
19
|
-
* const schema = await getSchema();
|
|
20
|
-
*
|
|
21
|
-
* // New pattern (unified)
|
|
22
|
-
* const { db, schema } = await getDbClient();
|
|
23
|
-
*
|
|
24
|
-
* // With helper
|
|
25
|
-
* const result = await withDbClient(async (client) => {
|
|
26
|
-
* return await client.db.select().from(client.schema.memories);
|
|
27
|
-
* });
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
import type { DatabaseClient } from '../storage/database.js';
|
|
31
|
-
import type { SchemaModule } from '../../db/schema.js';
|
|
32
|
-
/**
|
|
33
|
-
* Unified database client interface combining:
|
|
34
|
-
* - `db`: Wrapped database client with select/insert/update/delete methods
|
|
35
|
-
* - `schema`: Drizzle schema module with table definitions
|
|
36
|
-
* - `raw`: Raw underlying connection for special cases (mcp-server, index, etc.)
|
|
37
|
-
*/
|
|
38
|
-
export interface DbClient {
|
|
39
|
-
/**
|
|
40
|
-
* Wrapped database client with unified API
|
|
41
|
-
* Provides select(), insert(), update(), delete() methods
|
|
42
|
-
*/
|
|
43
|
-
db: DatabaseClient;
|
|
44
|
-
/**
|
|
45
|
-
* Schema module containing table definitions
|
|
46
|
-
* Access tables via schema.tableName (e.g., schema.memories, schema.users)
|
|
47
|
-
*/
|
|
48
|
-
schema: SchemaModule;
|
|
49
|
-
/**
|
|
50
|
-
* Raw underlying database connection
|
|
51
|
-
* Use for special cases that require direct access to the native driver
|
|
52
|
-
* (e.g., raw SQL queries, specific driver features)
|
|
53
|
-
*/
|
|
54
|
-
raw: any;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get a unified database client with both db and schema.
|
|
58
|
-
*
|
|
59
|
-
* This function:
|
|
60
|
-
* 1. Calls getDb() to initialize/retrieve the database connection
|
|
61
|
-
* 2. Calls getSchema() to get the appropriate schema (with caching)
|
|
62
|
-
* 3. Wraps the db with createDatabaseClient() for unified API
|
|
63
|
-
* 4. Returns all three as a single DbClient object
|
|
64
|
-
*
|
|
65
|
-
* Error handling:
|
|
66
|
-
* - Wraps any database initialization errors with a clear message
|
|
67
|
-
* - Preserves the original error as `cause` property
|
|
68
|
-
*
|
|
69
|
-
* Schema caching:
|
|
70
|
-
* - Uses the same caching mechanism as getSchema()
|
|
71
|
-
* - Multiple calls to getDbClient() will return the same schema reference
|
|
72
|
-
*
|
|
73
|
-
* @returns Promise<DbClient> Unified client with db, schema, and raw
|
|
74
|
-
* @throws {Error} When database initialization fails, with cause attached
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* const { db, schema, raw } = await getDbClient();
|
|
79
|
-
*
|
|
80
|
-
* // Use db for queries
|
|
81
|
-
* const memories = await db.select().from(schema.memories).limit(10);
|
|
82
|
-
*
|
|
83
|
-
* // Use raw for special cases
|
|
84
|
-
* const client = (raw as any).$client;
|
|
85
|
-
* if (client && typeof client.exec === 'function') {
|
|
86
|
-
* client.exec('VACUUM');
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function getDbClient(): Promise<DbClient>;
|
|
91
|
-
/**
|
|
92
|
-
* Execute an operation with a unified database client.
|
|
93
|
-
*
|
|
94
|
-
* Convenience wrapper that:
|
|
95
|
-
* 1. Calls getDbClient() to obtain client
|
|
96
|
-
* 2. Executes the provided operation
|
|
97
|
-
* 3. Ensures proper cleanup if needed (no-op currently, for future extension)
|
|
98
|
-
*
|
|
99
|
-
* @param operation - Async function that receives the DbClient and returns a result
|
|
100
|
-
* @returns Promise<T> The result returned by the operation
|
|
101
|
-
* @throws {Error} When database initialization or operation fails
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const count = await withDbClient(async (client) => {
|
|
106
|
-
* const result = await client.db
|
|
107
|
-
* .select({ count: sql`count(*)` })
|
|
108
|
-
* .from(client.schema.memories);
|
|
109
|
-
* return result[0].count;
|
|
110
|
-
* });
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare function withDbClient<T>(operation: (client: DbClient) => Promise<T>): Promise<T>;
|
|
114
|
-
//# sourceMappingURL=db-client.d.ts.map
|