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,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transformers.js Local Embedding Provider
|
|
3
|
-
*
|
|
4
|
-
* Uses ONNX-based transformer models for high-quality local embeddings.
|
|
5
|
-
* Supports Hugging Face ONNX embedding models.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* Set SQUISH_EMBEDDINGS_PROVIDER=transformers
|
|
9
|
-
* Required: SQUISH_LOCAL_MODEL=<huggingface-onnx-model>
|
|
10
|
-
*
|
|
11
|
-
* Download models automatically on first use. Models cached in HuggingFace cache directory.
|
|
12
|
-
*/
|
|
13
|
-
export interface TransformersLocalConfig {
|
|
14
|
-
model: string;
|
|
15
|
-
device: 'cpu' | 'webgpu';
|
|
16
|
-
dtype: 'q8' | 'q4' | 'f16' | 'f32';
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Check if pipeline is loaded
|
|
20
|
-
*/
|
|
21
|
-
export declare function isReady(): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Get embedding dimension for current model
|
|
24
|
-
*/
|
|
25
|
-
export declare function getEmbeddingDimension(): number;
|
|
26
|
-
/**
|
|
27
|
-
* Generate embedding for a single text input
|
|
28
|
-
* Uses mean pooling + L2 normalization
|
|
29
|
-
*/
|
|
30
|
-
export declare function getEmbedding(text: string): Promise<number[] | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Generate embeddings for multiple texts in batch
|
|
33
|
-
* Processes efficiently with batching
|
|
34
|
-
*/
|
|
35
|
-
export declare function getBatchEmbeddings(texts: string[], batchSize?: number): Promise<Array<number[] | null>>;
|
|
36
|
-
/**
|
|
37
|
-
* Check health of the transformers provider
|
|
38
|
-
*/
|
|
39
|
-
export declare function checkHealth(): Promise<{
|
|
40
|
-
available: boolean;
|
|
41
|
-
latencyMs?: number;
|
|
42
|
-
error?: string;
|
|
43
|
-
model?: string;
|
|
44
|
-
dimension?: number;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Unload the pipeline (for testing or memory management)
|
|
48
|
-
*/
|
|
49
|
-
export declare function unload(): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Warm up the model with a test input
|
|
52
|
-
*/
|
|
53
|
-
export declare function warmup(): Promise<boolean>;
|
|
54
|
-
declare const _default: {
|
|
55
|
-
isReady: typeof isReady;
|
|
56
|
-
getEmbeddingDimension: typeof getEmbeddingDimension;
|
|
57
|
-
getEmbedding: typeof getEmbedding;
|
|
58
|
-
getBatchEmbeddings: typeof getBatchEmbeddings;
|
|
59
|
-
checkHealth: typeof checkHealth;
|
|
60
|
-
unload: typeof unload;
|
|
61
|
-
warmup: typeof warmup;
|
|
62
|
-
};
|
|
63
|
-
export default _default;
|
|
64
|
-
//# sourceMappingURL=transformers-local.d.ts.map
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transformers.js Local Embedding Provider
|
|
3
|
-
*
|
|
4
|
-
* Uses ONNX-based transformer models for high-quality local embeddings.
|
|
5
|
-
* Supports Hugging Face ONNX embedding models.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* Set SQUISH_EMBEDDINGS_PROVIDER=transformers
|
|
9
|
-
* Required: SQUISH_LOCAL_MODEL=<huggingface-onnx-model>
|
|
10
|
-
*
|
|
11
|
-
* Download models automatically on first use. Models cached in HuggingFace cache directory.
|
|
12
|
-
*/
|
|
13
|
-
import { pipeline } from '@huggingface/transformers';
|
|
14
|
-
import { logger } from '../logger.js';
|
|
15
|
-
import { config } from '../../config.js';
|
|
16
|
-
const DEFAULT_CONFIG = {
|
|
17
|
-
model: '',
|
|
18
|
-
device: 'cpu',
|
|
19
|
-
dtype: 'q8', // Quantized for smaller size + faster loading
|
|
20
|
-
};
|
|
21
|
-
// Singleton pipeline instance
|
|
22
|
-
let embeddingPipeline = null;
|
|
23
|
-
let isLoading = false;
|
|
24
|
-
let loadPromise = null;
|
|
25
|
-
/**
|
|
26
|
-
* Get or initialize the embedding pipeline (lazy loading)
|
|
27
|
-
*/
|
|
28
|
-
async function getPipeline() {
|
|
29
|
-
// Return existing pipeline
|
|
30
|
-
if (embeddingPipeline) {
|
|
31
|
-
return embeddingPipeline;
|
|
32
|
-
}
|
|
33
|
-
// Already loading - wait for it
|
|
34
|
-
if (isLoading && loadPromise) {
|
|
35
|
-
return loadPromise;
|
|
36
|
-
}
|
|
37
|
-
// Start loading
|
|
38
|
-
isLoading = true;
|
|
39
|
-
const model = config.transformersLocalModel;
|
|
40
|
-
if (!model) {
|
|
41
|
-
isLoading = false;
|
|
42
|
-
throw new Error('Transformers provider requires SQUISH_LOCAL_MODEL to be set');
|
|
43
|
-
}
|
|
44
|
-
logger.info(`Loading transformers local model: ${model}`);
|
|
45
|
-
loadPromise = (async () => {
|
|
46
|
-
try {
|
|
47
|
-
embeddingPipeline = await pipeline('feature-extraction', model, {
|
|
48
|
-
device: DEFAULT_CONFIG.device,
|
|
49
|
-
dtype: DEFAULT_CONFIG.dtype,
|
|
50
|
-
});
|
|
51
|
-
logger.info(`Transformers local model loaded: ${model}`);
|
|
52
|
-
return embeddingPipeline;
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
logger.error(`Failed to load transformers model: ${error}`);
|
|
56
|
-
embeddingPipeline = null;
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
finally {
|
|
60
|
-
isLoading = false;
|
|
61
|
-
loadPromise = null;
|
|
62
|
-
}
|
|
63
|
-
})();
|
|
64
|
-
return loadPromise;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Check if pipeline is loaded
|
|
68
|
-
*/
|
|
69
|
-
export function isReady() {
|
|
70
|
-
return embeddingPipeline !== null;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get embedding dimension for current model
|
|
74
|
-
*/
|
|
75
|
-
export function getEmbeddingDimension() {
|
|
76
|
-
return 0;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Generate embedding for a single text input
|
|
80
|
-
* Uses mean pooling + L2 normalization
|
|
81
|
-
*/
|
|
82
|
-
export async function getEmbedding(text) {
|
|
83
|
-
if (!text || typeof text !== 'string') {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
const pipeline = await getPipeline();
|
|
88
|
-
if (!pipeline) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
// Truncate to max sequence length (256 tokens)
|
|
92
|
-
const truncatedText = text.slice(0, 512);
|
|
93
|
-
// Run feature extraction with pooling
|
|
94
|
-
const output = await pipeline(truncatedText, {
|
|
95
|
-
pooling: 'mean',
|
|
96
|
-
normalize: true,
|
|
97
|
-
});
|
|
98
|
-
// Convert tensor to array
|
|
99
|
-
const embedding = Array.from(output.data);
|
|
100
|
-
return embedding;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
logger.warn(`Transformers embedding error: ${error}`);
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Generate embeddings for multiple texts in batch
|
|
109
|
-
* Processes efficiently with batching
|
|
110
|
-
*/
|
|
111
|
-
export async function getBatchEmbeddings(texts, batchSize = 8) {
|
|
112
|
-
if (texts.length === 0) {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
const results = new Array(texts.length).fill(null);
|
|
116
|
-
// Process in batches
|
|
117
|
-
for (let i = 0; i < texts.length; i += batchSize) {
|
|
118
|
-
const batchEnd = Math.min(i + batchSize, texts.length);
|
|
119
|
-
const batch = texts.slice(i, batchEnd);
|
|
120
|
-
const indices = [...Array(batch.length).keys()].map(j => i + j);
|
|
121
|
-
try {
|
|
122
|
-
const pipeline = await getPipeline();
|
|
123
|
-
if (!pipeline) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
// Truncate each text
|
|
127
|
-
const truncatedBatch = batch.map(t => t.slice(0, 512));
|
|
128
|
-
// Process batch
|
|
129
|
-
const outputs = await Promise.all(truncatedBatch.map(text => pipeline(text, { pooling: 'mean', normalize: true })));
|
|
130
|
-
// Store results
|
|
131
|
-
for (let j = 0; j < outputs.length; j++) {
|
|
132
|
-
results[indices[j]] = Array.from(outputs[j].data);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
logger.warn(`Transformers batch embedding error: ${error}`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return results;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Check health of the transformers provider
|
|
143
|
-
*/
|
|
144
|
-
export async function checkHealth() {
|
|
145
|
-
const model = config.transformersLocalModel;
|
|
146
|
-
if (!model) {
|
|
147
|
-
return {
|
|
148
|
-
available: false,
|
|
149
|
-
error: 'SQUISH_LOCAL_MODEL is not configured',
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
// Check if library is available
|
|
153
|
-
try {
|
|
154
|
-
await import('@huggingface/transformers');
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
return {
|
|
158
|
-
available: false,
|
|
159
|
-
error: '@huggingface/transformers not installed',
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
// Try quick embedding
|
|
163
|
-
const start = Date.now();
|
|
164
|
-
try {
|
|
165
|
-
const embedding = await getEmbedding('health check test');
|
|
166
|
-
const latency = Date.now() - start;
|
|
167
|
-
return {
|
|
168
|
-
available: embedding !== null && embedding.length > 0,
|
|
169
|
-
latencyMs: latency,
|
|
170
|
-
model,
|
|
171
|
-
dimension: embedding?.length || 0,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
return {
|
|
176
|
-
available: false,
|
|
177
|
-
error: error.message,
|
|
178
|
-
model,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Unload the pipeline (for testing or memory management)
|
|
184
|
-
*/
|
|
185
|
-
export async function unload() {
|
|
186
|
-
if (embeddingPipeline) {
|
|
187
|
-
// Pipeline doesn't have explicit cleanup, just release reference
|
|
188
|
-
embeddingPipeline = null;
|
|
189
|
-
logger.info('Transformers pipeline unloaded');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Warm up the model with a test input
|
|
194
|
-
*/
|
|
195
|
-
export async function warmup() {
|
|
196
|
-
try {
|
|
197
|
-
const result = await getEmbedding('warmup test');
|
|
198
|
-
return result !== null && result.length > 0;
|
|
199
|
-
}
|
|
200
|
-
catch {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
export default {
|
|
205
|
-
isReady,
|
|
206
|
-
getEmbeddingDimension,
|
|
207
|
-
getEmbedding,
|
|
208
|
-
getBatchEmbeddings,
|
|
209
|
-
checkHealth,
|
|
210
|
-
unload,
|
|
211
|
-
warmup,
|
|
212
|
-
};
|
|
213
|
-
//# sourceMappingURL=transformers-local.js.map
|
package/dist/core/embeddings.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified Error Handling System for Squish
|
|
3
|
-
* Provides standardized error handling across CLI, Web API, MCP server, and algorithm handlers
|
|
4
|
-
*/
|
|
5
|
-
import { isDatabaseUnavailableError } from './lib/utils.js';
|
|
6
|
-
export { isDatabaseUnavailableError };
|
|
7
|
-
/**
|
|
8
|
-
* Wraps database operations with standardized error handling
|
|
9
|
-
*/
|
|
10
|
-
export declare function withDbErrorHandling<T>(operation: () => Promise<T>, context: string): Promise<T>;
|
|
11
|
-
/**
|
|
12
|
-
* Formats errors for Web API responses
|
|
13
|
-
*/
|
|
14
|
-
export declare function formatApiError(error: any, defaultStatus?: number): {
|
|
15
|
-
status: number;
|
|
16
|
-
response: {
|
|
17
|
-
status: string;
|
|
18
|
-
message: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Formats errors for MCP tool responses
|
|
23
|
-
*/
|
|
24
|
-
export declare function formatMcpError(error: any, context?: string): never;
|
|
25
|
-
/**
|
|
26
|
-
* Formats errors for CLI commands
|
|
27
|
-
*/
|
|
28
|
-
export declare function formatCliError(error: any, exitCode?: number): never;
|
|
29
|
-
/**
|
|
30
|
-
* Formats errors for algorithm handlers
|
|
31
|
-
*/
|
|
32
|
-
export declare function formatAlgorithmError(error: any, context?: string): {
|
|
33
|
-
ok: false;
|
|
34
|
-
error: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Formats successful responses for algorithm handlers.
|
|
38
|
-
*
|
|
39
|
-
* @param data - The success data to return
|
|
40
|
-
* @param message - Optional success message
|
|
41
|
-
* @returns Object with ok: true, optional message, and data
|
|
42
|
-
*/
|
|
43
|
-
export declare function formatAlgorithmSuccess<T>(data: T, message?: string): {
|
|
44
|
-
ok: true;
|
|
45
|
-
data: T;
|
|
46
|
-
message?: string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Error thrown when validation fails
|
|
50
|
-
*/
|
|
51
|
-
export declare class ValidationError extends Error {
|
|
52
|
-
field?: string | undefined;
|
|
53
|
-
constructor(message: string, field?: string | undefined);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Error thrown when a requested resource is not found.
|
|
57
|
-
* Used for missing memories, projects, etc.
|
|
58
|
-
*/
|
|
59
|
-
export declare class NotFoundError extends Error {
|
|
60
|
-
resource?: string | undefined;
|
|
61
|
-
constructor(message: string, resource?: string | undefined);
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=error-handling.d.ts.map
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified Error Handling System for Squish
|
|
3
|
-
* Provides standardized error handling across CLI, Web API, MCP server, and algorithm handlers
|
|
4
|
-
*/
|
|
5
|
-
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import { isDatabaseUnavailableError } from './lib/utils.js';
|
|
7
|
-
export { isDatabaseUnavailableError };
|
|
8
|
-
// Database operation wrapper
|
|
9
|
-
/**
|
|
10
|
-
* Wraps database operations with standardized error handling
|
|
11
|
-
*/
|
|
12
|
-
export async function withDbErrorHandling(operation, context) {
|
|
13
|
-
try {
|
|
14
|
-
return await operation();
|
|
15
|
-
}
|
|
16
|
-
catch (dbError) {
|
|
17
|
-
if (isDatabaseUnavailableError(dbError)) {
|
|
18
|
-
throw new Error(`Database unavailable: ${context}. Please check your database connection.`);
|
|
19
|
-
}
|
|
20
|
-
throw dbError;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
// API Response Formatters
|
|
24
|
-
/**
|
|
25
|
-
* Formats errors for Web API responses
|
|
26
|
-
*/
|
|
27
|
-
export function formatApiError(error, defaultStatus = 500) {
|
|
28
|
-
let message;
|
|
29
|
-
if (typeof error === 'string') {
|
|
30
|
-
message = error;
|
|
31
|
-
}
|
|
32
|
-
else if (error instanceof Error) {
|
|
33
|
-
message = error.message;
|
|
34
|
-
}
|
|
35
|
-
else if (error && typeof error === 'object' && 'message' in error) {
|
|
36
|
-
message = String(error.message);
|
|
37
|
-
}
|
|
38
|
-
else if (error && typeof error === 'object') {
|
|
39
|
-
message = 'Unknown error';
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
message = 'Unknown error';
|
|
43
|
-
}
|
|
44
|
-
// Check if it's a database unavailable error
|
|
45
|
-
if (isDatabaseUnavailableError(error)) {
|
|
46
|
-
return {
|
|
47
|
-
status: 503,
|
|
48
|
-
response: {
|
|
49
|
-
status: 'error',
|
|
50
|
-
message: `Service unavailable: ${message}`
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
// Check for custom error classes with status hints
|
|
55
|
-
if (error.status) {
|
|
56
|
-
return {
|
|
57
|
-
status: error.status,
|
|
58
|
-
response: {
|
|
59
|
-
status: 'error',
|
|
60
|
-
message
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
status: defaultStatus,
|
|
66
|
-
response: {
|
|
67
|
-
status: 'error',
|
|
68
|
-
message
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
// MCP Error Formatter
|
|
73
|
-
/**
|
|
74
|
-
* Formats errors for MCP tool responses
|
|
75
|
-
*/
|
|
76
|
-
export function formatMcpError(error, context) {
|
|
77
|
-
const message = error?.message || error?.toString() || 'Unknown error';
|
|
78
|
-
const fullMessage = context ? `${context}: ${message}` : message;
|
|
79
|
-
// Determine appropriate error code
|
|
80
|
-
let code;
|
|
81
|
-
if (isDatabaseUnavailableError(error)) {
|
|
82
|
-
code = ErrorCode.InternalError; // -32603
|
|
83
|
-
}
|
|
84
|
-
else if (error instanceof ValidationError) {
|
|
85
|
-
code = ErrorCode.InvalidParams; // -32602
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
code = ErrorCode.InternalError;
|
|
89
|
-
}
|
|
90
|
-
throw new McpError(code, fullMessage);
|
|
91
|
-
}
|
|
92
|
-
// CLI Error Formatter
|
|
93
|
-
/**
|
|
94
|
-
* Formats errors for CLI commands
|
|
95
|
-
*/
|
|
96
|
-
export function formatCliError(error, exitCode = 1) {
|
|
97
|
-
let message;
|
|
98
|
-
if (typeof error === 'string') {
|
|
99
|
-
message = error;
|
|
100
|
-
}
|
|
101
|
-
else if (error instanceof Error) {
|
|
102
|
-
message = error.message;
|
|
103
|
-
}
|
|
104
|
-
else if (error && typeof error === 'object' && 'message' in error) {
|
|
105
|
-
message = String(error.message);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
message = 'Unknown error';
|
|
109
|
-
}
|
|
110
|
-
// Output JSON to stdout for CLI consumers
|
|
111
|
-
console.log(JSON.stringify({ ok: false, error: message }, null, 2));
|
|
112
|
-
process.exit(exitCode);
|
|
113
|
-
}
|
|
114
|
-
// Algorithm Handler Formatters
|
|
115
|
-
/**
|
|
116
|
-
* Formats errors for algorithm handlers
|
|
117
|
-
*/
|
|
118
|
-
export function formatAlgorithmError(error, context) {
|
|
119
|
-
let message;
|
|
120
|
-
if (typeof error === 'string') {
|
|
121
|
-
message = error;
|
|
122
|
-
}
|
|
123
|
-
else if (error instanceof Error) {
|
|
124
|
-
message = error.message;
|
|
125
|
-
}
|
|
126
|
-
else if (error && typeof error === 'object' && 'message' in error) {
|
|
127
|
-
message = String(error.message);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
message = 'Unknown error';
|
|
131
|
-
}
|
|
132
|
-
const fullMessage = context ? `${context}: ${message}` : message;
|
|
133
|
-
return { ok: false, error: fullMessage };
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Formats successful responses for algorithm handlers.
|
|
137
|
-
*
|
|
138
|
-
* @param data - The success data to return
|
|
139
|
-
* @param message - Optional success message
|
|
140
|
-
* @returns Object with ok: true, optional message, and data
|
|
141
|
-
*/
|
|
142
|
-
export function formatAlgorithmSuccess(data, message) {
|
|
143
|
-
const result = { ok: true, data };
|
|
144
|
-
if (message) {
|
|
145
|
-
result.message = message;
|
|
146
|
-
}
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
// Custom Error Classes
|
|
150
|
-
/**
|
|
151
|
-
* Error thrown when validation fails
|
|
152
|
-
*/
|
|
153
|
-
export class ValidationError extends Error {
|
|
154
|
-
field;
|
|
155
|
-
constructor(message, field) {
|
|
156
|
-
super(message);
|
|
157
|
-
this.field = field;
|
|
158
|
-
this.name = 'ValidationError';
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Error thrown when a requested resource is not found.
|
|
163
|
-
* Used for missing memories, projects, etc.
|
|
164
|
-
*/
|
|
165
|
-
export class NotFoundError extends Error {
|
|
166
|
-
resource;
|
|
167
|
-
constructor(message, resource) {
|
|
168
|
-
super(message);
|
|
169
|
-
this.resource = resource;
|
|
170
|
-
this.name = 'NotFoundError';
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
//# sourceMappingURL=error-handling.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entity Deduplicator
|
|
3
|
-
*
|
|
4
|
-
* Deduplicates entities using embedding similarity and string matching.
|
|
5
|
-
* Critical for knowledge graph - prevents duplicate nodes for aliases like "AWS" / "Amazon Web Services".
|
|
6
|
-
*/
|
|
7
|
-
export interface DeduplicationResult {
|
|
8
|
-
merged: number;
|
|
9
|
-
aliases: Array<{
|
|
10
|
-
from: string;
|
|
11
|
-
to: string;
|
|
12
|
-
similarity: number;
|
|
13
|
-
}>;
|
|
14
|
-
totalEntities: number;
|
|
15
|
-
uniqueEntities: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Find and merge duplicate entities in a project.
|
|
19
|
-
*/
|
|
20
|
-
export declare function deduplicateProjectEntities(projectId: string, options?: {
|
|
21
|
-
similarityThreshold?: number;
|
|
22
|
-
dryRun?: boolean;
|
|
23
|
-
}): Promise<DeduplicationResult>;
|
|
24
|
-
//# sourceMappingURL=entity-deduplicator.d.ts.map
|