@stackmemoryai/stackmemory 0.5.58 → 0.5.61
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/README.md +105 -1
- package/dist/scripts/benchmark-performance.js +48 -0
- package/dist/scripts/benchmark-performance.js.map +7 -0
- package/dist/scripts/check-redis.js +42 -0
- package/dist/scripts/check-redis.js.map +7 -0
- package/dist/scripts/initialize.js +116 -0
- package/dist/scripts/initialize.js.map +7 -0
- package/dist/scripts/list-linear-tasks.js +124 -0
- package/dist/scripts/list-linear-tasks.js.map +7 -0
- package/dist/scripts/measure-handoff-impact.js +340 -0
- package/dist/scripts/measure-handoff-impact.js.map +7 -0
- package/dist/scripts/query-chromadb.js +160 -0
- package/dist/scripts/query-chromadb.js.map +7 -0
- package/dist/scripts/show-linear-summary.js +119 -0
- package/dist/scripts/show-linear-summary.js.map +7 -0
- package/dist/scripts/simple-swarm-demo.js +90 -0
- package/dist/scripts/simple-swarm-demo.js.map +7 -0
- package/dist/scripts/status.js +155 -0
- package/dist/scripts/status.js.map +7 -0
- package/dist/scripts/test-chromadb-sync.js +192 -0
- package/dist/scripts/test-chromadb-sync.js.map +7 -0
- package/dist/scripts/test-ralph-iteration-fix.js +86 -0
- package/dist/scripts/test-ralph-iteration-fix.js.map +7 -0
- package/dist/scripts/test-ralph-iterations.js +121 -0
- package/dist/scripts/test-ralph-iterations.js.map +7 -0
- package/dist/scripts/test-redis-storage.js +389 -0
- package/dist/scripts/test-redis-storage.js.map +7 -0
- package/dist/scripts/test-simple-ralph-state-sync.js +115 -0
- package/dist/scripts/test-simple-ralph-state-sync.js.map +7 -0
- package/dist/scripts/test-swarm-fixes.js +125 -0
- package/dist/scripts/test-swarm-fixes.js.map +7 -0
- package/dist/scripts/test-swarm-tui.js +23 -0
- package/dist/scripts/test-swarm-tui.js.map +7 -0
- package/dist/scripts/test-tui-shortcuts.js +52 -0
- package/dist/scripts/test-tui-shortcuts.js.map +7 -0
- package/dist/scripts/validate-tui-shortcuts.js +60 -0
- package/dist/scripts/validate-tui-shortcuts.js.map +7 -0
- package/dist/src/agents/core/agent-task-manager.js.map +7 -0
- package/dist/src/agents/verifiers/base-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/formatter-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/llm-judge.js.map +7 -0
- package/dist/src/cli/auto-detect.js.map +7 -0
- package/dist/src/cli/claude-sm-danger.js.map +7 -0
- package/dist/src/cli/claude-sm.js +1236 -0
- package/dist/src/cli/claude-sm.js.map +7 -0
- package/dist/src/cli/codex-sm-danger.js.map +7 -0
- package/dist/src/cli/codex-sm.js.map +7 -0
- package/dist/src/cli/commands/api.js.map +7 -0
- package/dist/src/cli/commands/auto-background.js.map +7 -0
- package/dist/src/cli/commands/cleanup-processes.js.map +7 -0
- package/dist/src/cli/commands/clear.js.map +7 -0
- package/dist/src/cli/commands/config.js.map +7 -0
- package/dist/src/cli/commands/context-rehydrate.js.map +7 -0
- package/dist/src/cli/commands/context.js.map +7 -0
- package/dist/src/cli/commands/daemon.js.map +7 -0
- package/dist/src/cli/commands/dashboard.js.map +7 -0
- package/dist/src/cli/commands/db.js.map +7 -0
- package/dist/src/cli/commands/decision.js.map +7 -0
- package/dist/src/cli/commands/discovery.js.map +7 -0
- package/dist/src/cli/commands/handoff.js.map +7 -0
- package/dist/src/cli/commands/hooks.js.map +7 -0
- package/dist/src/cli/commands/linear.js.map +7 -0
- package/dist/src/cli/commands/log.js.map +7 -0
- package/dist/src/cli/commands/login.js.map +7 -0
- package/dist/src/cli/commands/migrate.js.map +7 -0
- package/dist/src/cli/commands/model.js.map +7 -0
- package/dist/src/cli/commands/onboard.js.map +7 -0
- package/dist/src/cli/commands/projects.js.map +7 -0
- package/dist/src/cli/commands/ralph.js.map +7 -0
- package/dist/src/cli/commands/retrieval.js.map +7 -0
- package/dist/src/cli/commands/search.js +173 -0
- package/dist/src/cli/commands/search.js.map +7 -0
- package/dist/src/cli/commands/service.js.map +7 -0
- package/dist/src/cli/commands/session.js.map +7 -0
- package/dist/src/cli/commands/settings.js.map +7 -0
- package/dist/src/cli/commands/setup.js.map +7 -0
- package/dist/src/cli/commands/shell.js.map +7 -0
- package/dist/src/cli/commands/signup.js.map +7 -0
- package/dist/src/cli/commands/skills.js.map +7 -0
- package/dist/src/cli/commands/sms-notify.js.map +7 -0
- package/dist/src/cli/commands/storage-tier.js.map +7 -0
- package/dist/src/cli/commands/sweep.js.map +7 -0
- package/dist/src/cli/commands/tasks.js.map +7 -0
- package/dist/src/cli/commands/worktree.js.map +7 -0
- package/dist/src/cli/index.js +609 -0
- package/dist/src/cli/index.js.map +7 -0
- package/dist/src/cli/opencode-sm.js.map +7 -0
- package/dist/src/cli/utils/viewer.js.map +7 -0
- package/dist/src/core/config/config-manager.js.map +7 -0
- package/dist/src/core/config/feature-flags.js.map +7 -0
- package/dist/src/core/config/storage-config.js.map +7 -0
- package/dist/src/core/config/types.js.map +7 -0
- package/dist/src/core/context/auto-context.js.map +7 -0
- package/dist/src/core/context/dual-stack-manager.js.map +7 -0
- package/dist/src/core/context/enhanced-rehydration.js.map +7 -0
- package/dist/src/core/context/frame-database.js.map +7 -0
- package/dist/src/core/context/frame-digest.js.map +7 -0
- package/dist/src/core/context/frame-handoff-manager.js.map +7 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js.map +7 -0
- package/dist/src/core/context/frame-recovery.js.map +7 -0
- package/dist/src/core/context/frame-stack.js.map +7 -0
- package/dist/src/core/context/index.js.map +7 -0
- package/dist/src/core/context/permission-manager.js.map +7 -0
- package/dist/src/core/context/recursive-context-manager.js.map +7 -0
- package/dist/src/core/context/refactored-frame-manager.js.map +7 -0
- package/dist/src/core/context/shared-context-layer.js.map +7 -0
- package/dist/src/core/context/stack-merge-resolver.js.map +7 -0
- package/dist/src/core/context/validation.js.map +7 -0
- package/dist/src/core/database/batch-operations.js.map +7 -0
- package/dist/src/core/database/connection-pool.js.map +7 -0
- package/dist/src/core/database/database-adapter.js.map +7 -0
- package/dist/src/core/database/migration-manager.js.map +7 -0
- package/dist/src/core/database/query-cache.js.map +7 -0
- package/dist/src/core/database/query-router.js.map +7 -0
- package/dist/src/core/database/sqlite-adapter.js +738 -0
- package/dist/src/core/database/sqlite-adapter.js.map +7 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js.map +7 -0
- package/dist/src/core/digest/frame-digest-integration.js.map +7 -0
- package/dist/src/core/digest/hybrid-digest-generator.js.map +7 -0
- package/dist/src/core/digest/index.js.map +7 -0
- package/dist/src/core/digest/types.js.map +7 -0
- package/dist/src/core/errors/error-utils.js +208 -0
- package/dist/src/core/errors/error-utils.js.map +7 -0
- package/dist/src/core/errors/index.js +521 -0
- package/dist/src/core/errors/index.js.map +7 -0
- package/dist/src/core/errors/recovery.js.map +7 -0
- package/dist/src/core/execution/parallel-executor.js.map +7 -0
- package/dist/src/core/extensions/custom-tools.js +567 -0
- package/dist/src/core/extensions/custom-tools.js.map +7 -0
- package/dist/src/core/extensions/index.js +55 -0
- package/dist/src/core/extensions/index.js.map +7 -0
- package/dist/src/core/extensions/loader.js +709 -0
- package/dist/src/core/extensions/loader.js.map +7 -0
- package/dist/src/core/extensions/plugin-system.js +506 -0
- package/dist/src/core/extensions/plugin-system.js.map +7 -0
- package/dist/src/core/extensions/provider-adapter.js +617 -0
- package/dist/src/core/extensions/provider-adapter.js.map +7 -0
- package/dist/src/core/extensions/sandbox-runtime.js +664 -0
- package/dist/src/core/extensions/sandbox-runtime.js.map +7 -0
- package/dist/src/core/frame/workflow-templates.js.map +7 -0
- package/dist/src/core/merge/conflict-detector.js.map +7 -0
- package/dist/src/core/merge/index.js.map +7 -0
- package/dist/src/core/merge/resolution-engine.js.map +7 -0
- package/dist/src/core/merge/stack-diff.js.map +7 -0
- package/dist/src/core/merge/unified-merge-resolver.js +303 -0
- package/dist/src/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/src/core/models/fallback-monitor.js.map +7 -0
- package/dist/src/core/models/model-router.js.map +7 -0
- package/dist/src/core/monitoring/error-handler.js.map +7 -0
- package/dist/src/core/monitoring/logger.js +202 -0
- package/dist/src/core/monitoring/logger.js.map +7 -0
- package/dist/src/core/monitoring/metrics.js.map +7 -0
- package/dist/src/core/monitoring/progress-tracker.js.map +7 -0
- package/dist/src/core/monitoring/session-monitor.js.map +7 -0
- package/dist/src/core/performance/context-cache.js.map +7 -0
- package/dist/src/core/performance/index.js.map +7 -0
- package/dist/src/core/performance/lazy-context-loader.js.map +7 -0
- package/dist/src/core/performance/monitor.js.map +7 -0
- package/dist/src/core/performance/optimized-frame-context.js.map +7 -0
- package/dist/src/core/performance/performance-benchmark.js.map +7 -0
- package/dist/src/core/performance/performance-profiler.js.map +7 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js.map +7 -0
- package/dist/src/core/persistence/postgres-adapter.js.map +7 -0
- package/dist/src/core/projects/project-isolation.js.map +7 -0
- package/dist/src/core/projects/project-manager.js.map +7 -0
- package/dist/src/core/query/query-parser.js.map +7 -0
- package/dist/src/core/query/query-templates.js.map +7 -0
- package/dist/src/core/retrieval/context-retriever.js.map +7 -0
- package/dist/src/core/retrieval/index.js.map +7 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js.map +7 -0
- package/dist/src/core/retrieval/llm-provider.js.map +7 -0
- package/dist/src/core/retrieval/retrieval-audit.js.map +7 -0
- package/dist/src/core/retrieval/summary-generator.js.map +7 -0
- package/dist/src/core/retrieval/types.js.map +7 -0
- package/dist/src/core/security/index.js +35 -0
- package/dist/src/core/security/index.js.map +7 -0
- package/dist/src/core/security/input-sanitizer.js +321 -0
- package/dist/src/core/security/input-sanitizer.js.map +7 -0
- package/dist/src/core/session/clear-survival.js.map +7 -0
- package/dist/src/core/session/enhanced-handoff.js.map +7 -0
- package/dist/src/core/session/handoff-generator.js.map +7 -0
- package/dist/src/core/session/index.js.map +7 -0
- package/dist/src/core/session/session-manager.js.map +7 -0
- package/dist/src/core/skills/index.js.map +7 -0
- package/dist/src/core/skills/skill-storage.js.map +7 -0
- package/dist/src/core/skills/types.js.map +7 -0
- package/dist/src/core/storage/chromadb-adapter.js +380 -0
- package/dist/src/core/storage/chromadb-adapter.js.map +7 -0
- package/dist/src/core/storage/infinite-storage.js.map +7 -0
- package/dist/src/core/storage/remote-storage.js.map +7 -0
- package/dist/src/core/storage/two-tier-storage.js.map +7 -0
- package/dist/src/core/trace/cli-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/db-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/debug-trace.js.map +7 -0
- package/dist/src/core/trace/index.js.map +7 -0
- package/dist/src/core/trace/linear-api-wrapper.js.map +7 -0
- package/dist/src/core/trace/trace-detector.js.map +7 -0
- package/dist/src/core/trace/trace-store.js.map +7 -0
- package/dist/src/core/trace/types.js.map +7 -0
- package/dist/src/core/utils/async-mutex.js.map +7 -0
- package/dist/src/core/utils/compression.js.map +7 -0
- package/dist/src/core/utils/update-checker.js.map +7 -0
- package/dist/src/core/worktree/worktree-manager.js.map +7 -0
- package/dist/src/daemon/daemon-config.js.map +7 -0
- package/dist/src/daemon/services/context-service.js.map +7 -0
- package/dist/src/daemon/services/linear-service.js.map +7 -0
- package/dist/src/daemon/session-daemon.js.map +7 -0
- package/dist/src/daemon/unified-daemon.js.map +7 -0
- package/dist/src/features/analytics/api/analytics-api.js.map +7 -0
- package/dist/src/features/analytics/core/analytics-service.js.map +7 -0
- package/dist/src/features/analytics/index.js.map +7 -0
- package/dist/src/features/analytics/queries/metrics-queries.js.map +7 -0
- package/dist/src/features/browser/browser-mcp.js.map +7 -0
- package/dist/src/features/sweep/index.js.map +7 -0
- package/dist/src/features/sweep/prediction-client.js.map +7 -0
- package/dist/src/features/sweep/prompt-builder.js.map +7 -0
- package/dist/src/features/sweep/pty-wrapper.js.map +7 -0
- package/dist/src/features/sweep/state-watcher.js.map +7 -0
- package/dist/src/features/sweep/status-bar.js.map +7 -0
- package/dist/src/features/sweep/sweep-server-manager.js.map +7 -0
- package/dist/src/features/sweep/tab-interceptor.js.map +7 -0
- package/dist/src/features/sweep/types.js.map +7 -0
- package/dist/src/features/tasks/linear-task-manager.js.map +7 -0
- package/dist/src/features/tasks/task-aware-context.js.map +7 -0
- package/dist/src/features/tui/simple-monitor.js.map +7 -0
- package/dist/src/features/tui/swarm-monitor.js.map +7 -0
- package/dist/src/features/web/client/stores/task-store.js.map +7 -0
- package/dist/src/features/web/server/index.js.map +7 -0
- package/dist/src/hooks/auto-background.js.map +7 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js.map +7 -0
- package/dist/src/hooks/config.js.map +7 -0
- package/dist/src/hooks/daemon.js.map +7 -0
- package/dist/src/hooks/events.js.map +7 -0
- package/dist/src/hooks/index.js.map +7 -0
- package/dist/src/hooks/linear-task-picker.js.map +7 -0
- package/dist/src/hooks/schemas.js.map +7 -0
- package/dist/src/hooks/secure-fs.js.map +7 -0
- package/dist/src/hooks/security-logger.js.map +7 -0
- package/dist/src/hooks/session-summary.js.map +7 -0
- package/dist/src/hooks/sms-action-runner.js.map +7 -0
- package/dist/src/hooks/sms-notify.js.map +7 -0
- package/dist/src/hooks/sms-watcher.js.map +7 -0
- package/dist/src/hooks/sms-webhook.js.map +7 -0
- package/dist/src/hooks/whatsapp-commands.js.map +7 -0
- package/dist/src/hooks/whatsapp-scheduler.js.map +7 -0
- package/dist/src/hooks/whatsapp-sync.js.map +7 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/integrations/anthropic/client.js.map +7 -0
- package/dist/src/integrations/claude-code/agent-bridge.js.map +7 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client.js.map +7 -0
- package/dist/src/integrations/claude-code/task-coordinator.js.map +7 -0
- package/dist/src/integrations/linear/auth.js.map +7 -0
- package/dist/src/integrations/linear/auto-sync.js.map +7 -0
- package/dist/src/integrations/linear/client.js +634 -0
- package/dist/src/integrations/linear/client.js.map +7 -0
- package/dist/src/integrations/linear/config.js.map +7 -0
- package/dist/src/integrations/linear/migration.js.map +7 -0
- package/dist/src/integrations/linear/oauth-server.js.map +7 -0
- package/dist/src/integrations/linear/rest-client.js.map +7 -0
- package/dist/src/integrations/linear/sync-manager.js.map +7 -0
- package/dist/src/integrations/linear/sync-service.js.map +7 -0
- package/dist/src/integrations/linear/sync.js.map +7 -0
- package/dist/src/integrations/linear/unified-sync.js.map +7 -0
- package/dist/src/integrations/linear/webhook-handler.js.map +7 -0
- package/dist/src/integrations/linear/webhook-server.js.map +7 -0
- package/dist/src/integrations/linear/webhook.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/index.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/index.js.map +7 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js.map +7 -0
- package/dist/src/integrations/mcp/refactored-server.js.map +7 -0
- package/dist/src/integrations/mcp/remote-server.js +682 -0
- package/dist/src/integrations/mcp/remote-server.js.map +7 -0
- package/dist/src/integrations/mcp/schemas.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +1975 -0
- package/dist/src/integrations/mcp/server.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions.js.map +7 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js.map +7 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
- package/dist/src/integrations/ralph/index.js.map +7 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js.map +7 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js.map +7 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js.map +7 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
- package/dist/src/integrations/ralph/types.js +5 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
- package/dist/src/mcp/stackmemory-mcp-server.js.map +7 -0
- package/dist/src/middleware/exponential-rate-limiter.js.map +7 -0
- package/dist/src/models/user.model.js.map +7 -0
- package/dist/src/servers/production/auth-middleware.js.map +7 -0
- package/dist/src/services/config-service.js.map +7 -0
- package/dist/src/services/context-service.js.map +7 -0
- package/dist/src/skills/api-discovery.js.map +7 -0
- package/dist/src/skills/api-skill.js.map +7 -0
- package/dist/src/skills/claude-skills.js.map +7 -0
- package/dist/src/skills/dashboard-launcher.js.map +7 -0
- package/dist/src/skills/recursive-agent-orchestrator.js.map +7 -0
- package/dist/src/skills/repo-ingestion-skill.js +632 -0
- package/dist/src/skills/repo-ingestion-skill.js.map +7 -0
- package/dist/src/skills/unified-rlm-orchestrator.js.map +7 -0
- package/dist/src/types/task.js.map +7 -0
- package/dist/src/utils/env.js.map +7 -0
- package/dist/src/utils/formatting.js.map +7 -0
- package/dist/src/utils/process-cleanup.js.map +7 -0
- package/package.json +13 -9
- package/scripts/background-sync-manager.js +145 -83
- package/scripts/claude-sm-autostart.js +17 -12
- package/scripts/gepa/README.md +275 -0
- package/scripts/gepa/config.json +53 -0
- package/scripts/gepa/evals/coding-tasks.jsonl +5 -0
- package/scripts/gepa/evals/fixtures/buggy-loop.js +18 -0
- package/scripts/gepa/evals/fixtures/callback-hell.js +53 -0
- package/scripts/gepa/generations/gen-000/baseline.md +124 -0
- package/scripts/gepa/hooks/auto-optimize.js +494 -0
- package/scripts/gepa/hooks/eval-tracker.js +203 -0
- package/scripts/gepa/hooks/reflect.js +311 -0
- package/scripts/gepa/optimize.js +611 -0
- package/scripts/gepa/state.json +14 -0
- package/scripts/initialize.ts +16 -7
- package/scripts/install.sh +14 -62
- package/scripts/status.ts +111 -46
- package/scripts/test-pre-publish-quick.sh +1 -1
- package/dist/agents/core/agent-task-manager.js.map +0 -7
- package/dist/agents/testing-agent.js +0 -614
- package/dist/agents/testing-agent.js.map +0 -7
- package/dist/agents/verifiers/base-verifier.js.map +0 -7
- package/dist/agents/verifiers/formatter-verifier.js.map +0 -7
- package/dist/agents/verifiers/llm-judge.js.map +0 -7
- package/dist/cli/auto-detect.js.map +0 -7
- package/dist/cli/browser-test.js +0 -33
- package/dist/cli/browser-test.js.map +0 -7
- package/dist/cli/claude-sm-danger.js.map +0 -7
- package/dist/cli/claude-sm.js +0 -1156
- package/dist/cli/claude-sm.js.map +0 -7
- package/dist/cli/codex-sm-danger.js.map +0 -7
- package/dist/cli/codex-sm.js.map +0 -7
- package/dist/cli/commands/api.js.map +0 -7
- package/dist/cli/commands/auto-background.js.map +0 -7
- package/dist/cli/commands/cleanup-processes.js.map +0 -7
- package/dist/cli/commands/clear.js.map +0 -7
- package/dist/cli/commands/config.js.map +0 -7
- package/dist/cli/commands/context-rehydrate.js.map +0 -7
- package/dist/cli/commands/context.js.map +0 -7
- package/dist/cli/commands/daemon.js.map +0 -7
- package/dist/cli/commands/dashboard.js.map +0 -7
- package/dist/cli/commands/db.js.map +0 -7
- package/dist/cli/commands/decision.js.map +0 -7
- package/dist/cli/commands/discovery.js.map +0 -7
- package/dist/cli/commands/handoff.js.map +0 -7
- package/dist/cli/commands/hooks.js.map +0 -7
- package/dist/cli/commands/linear-unified.js +0 -353
- package/dist/cli/commands/linear-unified.js.map +0 -7
- package/dist/cli/commands/linear.js.map +0 -7
- package/dist/cli/commands/log.js.map +0 -7
- package/dist/cli/commands/login.js.map +0 -7
- package/dist/cli/commands/migrate.js.map +0 -7
- package/dist/cli/commands/model.js.map +0 -7
- package/dist/cli/commands/monitor.js +0 -313
- package/dist/cli/commands/monitor.js.map +0 -7
- package/dist/cli/commands/onboard.js.map +0 -7
- package/dist/cli/commands/projects.js.map +0 -7
- package/dist/cli/commands/quality.js +0 -413
- package/dist/cli/commands/quality.js.map +0 -7
- package/dist/cli/commands/ralph.js.map +0 -7
- package/dist/cli/commands/retrieval.js.map +0 -7
- package/dist/cli/commands/search.js +0 -156
- package/dist/cli/commands/search.js.map +0 -7
- package/dist/cli/commands/service.js.map +0 -7
- package/dist/cli/commands/session.js.map +0 -7
- package/dist/cli/commands/settings.js.map +0 -7
- package/dist/cli/commands/setup.js.map +0 -7
- package/dist/cli/commands/shell.js.map +0 -7
- package/dist/cli/commands/signup.js.map +0 -7
- package/dist/cli/commands/skills.js.map +0 -7
- package/dist/cli/commands/sms-notify.js.map +0 -7
- package/dist/cli/commands/storage-tier.js.map +0 -7
- package/dist/cli/commands/storage.js +0 -360
- package/dist/cli/commands/storage.js.map +0 -7
- package/dist/cli/commands/sweep.js.map +0 -7
- package/dist/cli/commands/tasks.js.map +0 -7
- package/dist/cli/commands/test.js +0 -286
- package/dist/cli/commands/test.js.map +0 -7
- package/dist/cli/commands/workflow.js +0 -142
- package/dist/cli/commands/workflow.js.map +0 -7
- package/dist/cli/commands/worktree.js.map +0 -7
- package/dist/cli/index.js +0 -594
- package/dist/cli/index.js.map +0 -7
- package/dist/cli/opencode-sm.js.map +0 -7
- package/dist/cli/utils/viewer.js.map +0 -7
- package/dist/core/analytics/team-analytics.js +0 -378
- package/dist/core/analytics/team-analytics.js.map +0 -7
- package/dist/core/config/config-manager.js.map +0 -7
- package/dist/core/config/feature-flags.js.map +0 -7
- package/dist/core/config/storage-config.js.map +0 -7
- package/dist/core/config/types.js.map +0 -7
- package/dist/core/context/auto-context.js.map +0 -7
- package/dist/core/context/dual-stack-manager.js.map +0 -7
- package/dist/core/context/enhanced-rehydration.js.map +0 -7
- package/dist/core/context/frame-database.js.map +0 -7
- package/dist/core/context/frame-digest.js.map +0 -7
- package/dist/core/context/frame-handoff-manager.js.map +0 -7
- package/dist/core/context/frame-lifecycle-hooks.js.map +0 -7
- package/dist/core/context/frame-manager.js +0 -1069
- package/dist/core/context/frame-manager.js.map +0 -7
- package/dist/core/context/frame-recovery.js.map +0 -7
- package/dist/core/context/frame-stack.js.map +0 -7
- package/dist/core/context/incremental-gc.js +0 -290
- package/dist/core/context/incremental-gc.js.map +0 -7
- package/dist/core/context/index.js.map +0 -7
- package/dist/core/context/model-aware-compaction.js +0 -623
- package/dist/core/context/model-aware-compaction.js.map +0 -7
- package/dist/core/context/permission-manager.js.map +0 -7
- package/dist/core/context/recursive-context-manager.js.map +0 -7
- package/dist/core/context/refactored-frame-manager.js.map +0 -7
- package/dist/core/context/shared-context-layer.js.map +0 -7
- package/dist/core/context/stack-merge-resolver.js.map +0 -7
- package/dist/core/context/validation.js.map +0 -7
- package/dist/core/database/batch-operations.js.map +0 -7
- package/dist/core/database/connection-pool.js.map +0 -7
- package/dist/core/database/database-adapter.js.map +0 -7
- package/dist/core/database/migration-manager.js.map +0 -7
- package/dist/core/database/paradedb-adapter.js +0 -990
- package/dist/core/database/paradedb-adapter.js.map +0 -7
- package/dist/core/database/query-cache.js.map +0 -7
- package/dist/core/database/query-router.js.map +0 -7
- package/dist/core/database/sqlite-adapter.js +0 -728
- package/dist/core/database/sqlite-adapter.js.map +0 -7
- package/dist/core/digest/enhanced-hybrid-digest.js.map +0 -7
- package/dist/core/digest/frame-digest-integration.js.map +0 -7
- package/dist/core/digest/hybrid-digest-generator.js.map +0 -7
- package/dist/core/digest/index.js.map +0 -7
- package/dist/core/digest/types.js.map +0 -7
- package/dist/core/errors/index.js +0 -512
- package/dist/core/errors/index.js.map +0 -7
- package/dist/core/errors/recovery.js.map +0 -7
- package/dist/core/execution/parallel-executor.js.map +0 -7
- package/dist/core/frame/workflow-templates.js.map +0 -7
- package/dist/core/merge/conflict-detector.js.map +0 -7
- package/dist/core/merge/index.js.map +0 -7
- package/dist/core/merge/resolution-engine.js.map +0 -7
- package/dist/core/merge/stack-diff.js.map +0 -7
- package/dist/core/models/fallback-monitor.js.map +0 -7
- package/dist/core/models/model-router.js.map +0 -7
- package/dist/core/monitoring/error-handler.js.map +0 -7
- package/dist/core/monitoring/logger.js +0 -150
- package/dist/core/monitoring/logger.js.map +0 -7
- package/dist/core/monitoring/metrics.js.map +0 -7
- package/dist/core/monitoring/progress-tracker.js.map +0 -7
- package/dist/core/monitoring/session-monitor.js.map +0 -7
- package/dist/core/performance/context-cache.js.map +0 -7
- package/dist/core/performance/index.js.map +0 -7
- package/dist/core/performance/lazy-context-loader.js.map +0 -7
- package/dist/core/performance/monitor.js.map +0 -7
- package/dist/core/performance/optimized-frame-context.js.map +0 -7
- package/dist/core/performance/performance-benchmark.js.map +0 -7
- package/dist/core/performance/performance-profiler.js.map +0 -7
- package/dist/core/performance/streaming-jsonl-parser.js.map +0 -7
- package/dist/core/persistence/postgres-adapter.js.map +0 -7
- package/dist/core/projects/project-isolation.js.map +0 -7
- package/dist/core/projects/project-manager.js.map +0 -7
- package/dist/core/query/query-parser.js.map +0 -7
- package/dist/core/query/query-templates.js.map +0 -7
- package/dist/core/retrieval/context-retriever.js.map +0 -7
- package/dist/core/retrieval/graph-retrieval.js +0 -662
- package/dist/core/retrieval/graph-retrieval.js.map +0 -7
- package/dist/core/retrieval/hierarchical-retrieval.js +0 -656
- package/dist/core/retrieval/hierarchical-retrieval.js.map +0 -7
- package/dist/core/retrieval/index.js.map +0 -7
- package/dist/core/retrieval/llm-context-retrieval.js.map +0 -7
- package/dist/core/retrieval/llm-provider.js.map +0 -7
- package/dist/core/retrieval/retrieval-audit.js.map +0 -7
- package/dist/core/retrieval/retrieval-benchmarks.js +0 -521
- package/dist/core/retrieval/retrieval-benchmarks.js.map +0 -7
- package/dist/core/retrieval/summary-generator.js.map +0 -7
- package/dist/core/retrieval/types.js.map +0 -7
- package/dist/core/session/clear-survival.js.map +0 -7
- package/dist/core/session/enhanced-handoff.js.map +0 -7
- package/dist/core/session/handoff-generator.js.map +0 -7
- package/dist/core/session/index.js.map +0 -7
- package/dist/core/session/session-manager.js.map +0 -7
- package/dist/core/skills/index.js.map +0 -7
- package/dist/core/skills/skill-storage.js.map +0 -7
- package/dist/core/skills/types.js.map +0 -7
- package/dist/core/storage/chromadb-adapter.js +0 -354
- package/dist/core/storage/chromadb-adapter.js.map +0 -7
- package/dist/core/storage/infinite-storage.js.map +0 -7
- package/dist/core/storage/railway-optimized-storage.js +0 -591
- package/dist/core/storage/railway-optimized-storage.js.map +0 -7
- package/dist/core/storage/remote-storage.js.map +0 -7
- package/dist/core/storage/two-tier-storage.js.map +0 -7
- package/dist/core/trace/cli-trace-wrapper.js.map +0 -7
- package/dist/core/trace/db-trace-wrapper.js.map +0 -7
- package/dist/core/trace/debug-trace.js.map +0 -7
- package/dist/core/trace/index.js.map +0 -7
- package/dist/core/trace/linear-api-wrapper.js.map +0 -7
- package/dist/core/trace/trace-demo.js +0 -154
- package/dist/core/trace/trace-demo.js.map +0 -7
- package/dist/core/trace/trace-detector.demo.js +0 -142
- package/dist/core/trace/trace-detector.demo.js.map +0 -7
- package/dist/core/trace/trace-detector.js.map +0 -7
- package/dist/core/trace/trace-store.js.map +0 -7
- package/dist/core/trace/types.js.map +0 -7
- package/dist/core/utils/async-mutex.js.map +0 -7
- package/dist/core/utils/compression.js.map +0 -7
- package/dist/core/utils/update-checker.js.map +0 -7
- package/dist/core/worktree/worktree-manager.js.map +0 -7
- package/dist/daemon/daemon-config.js.map +0 -7
- package/dist/daemon/services/context-service.js.map +0 -7
- package/dist/daemon/services/linear-service.js.map +0 -7
- package/dist/daemon/session-daemon.js.map +0 -7
- package/dist/daemon/unified-daemon.js.map +0 -7
- package/dist/features/analytics/api/analytics-api.js.map +0 -7
- package/dist/features/analytics/core/analytics-service.js.map +0 -7
- package/dist/features/analytics/index.js.map +0 -7
- package/dist/features/analytics/queries/metrics-queries.js.map +0 -7
- package/dist/features/browser/browser-mcp.js.map +0 -7
- package/dist/features/sweep/index.js.map +0 -7
- package/dist/features/sweep/prediction-client.js.map +0 -7
- package/dist/features/sweep/prompt-builder.js.map +0 -7
- package/dist/features/sweep/pty-wrapper.js.map +0 -7
- package/dist/features/sweep/state-watcher.js.map +0 -7
- package/dist/features/sweep/status-bar.js.map +0 -7
- package/dist/features/sweep/sweep-server-manager.js.map +0 -7
- package/dist/features/sweep/tab-interceptor.js.map +0 -7
- package/dist/features/sweep/types.js.map +0 -7
- package/dist/features/tasks/linear-task-manager.js.map +0 -7
- package/dist/features/tasks/task-aware-context.js.map +0 -7
- package/dist/features/tui/simple-monitor.js.map +0 -7
- package/dist/features/tui/swarm-monitor.js.map +0 -7
- package/dist/features/web/client/stores/task-store.js.map +0 -7
- package/dist/features/web/server/index.js.map +0 -7
- package/dist/hooks/auto-background.js.map +0 -7
- package/dist/hooks/claude-code-whatsapp-hook.js.map +0 -7
- package/dist/hooks/config.js.map +0 -7
- package/dist/hooks/daemon.js.map +0 -7
- package/dist/hooks/events.js.map +0 -7
- package/dist/hooks/index.js.map +0 -7
- package/dist/hooks/linear-task-picker.js.map +0 -7
- package/dist/hooks/schemas.js.map +0 -7
- package/dist/hooks/secure-fs.js.map +0 -7
- package/dist/hooks/security-logger.js.map +0 -7
- package/dist/hooks/session-summary.js.map +0 -7
- package/dist/hooks/sms-action-runner.js.map +0 -7
- package/dist/hooks/sms-notify.js.map +0 -7
- package/dist/hooks/sms-watcher.js.map +0 -7
- package/dist/hooks/sms-webhook.js.map +0 -7
- package/dist/hooks/whatsapp-commands.js.map +0 -7
- package/dist/hooks/whatsapp-scheduler.js.map +0 -7
- package/dist/hooks/whatsapp-sync.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/integrations/anthropic/client.js.map +0 -7
- package/dist/integrations/claude-code/agent-bridge.js.map +0 -7
- package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js.map +0 -7
- package/dist/integrations/claude-code/lifecycle-hooks.js.map +0 -7
- package/dist/integrations/claude-code/post-task-hooks.js.map +0 -7
- package/dist/integrations/claude-code/subagent-client-stub.js.map +0 -7
- package/dist/integrations/claude-code/subagent-client.js.map +0 -7
- package/dist/integrations/claude-code/task-coordinator.js.map +0 -7
- package/dist/integrations/linear/auth.js.map +0 -7
- package/dist/integrations/linear/auto-sync.js.map +0 -7
- package/dist/integrations/linear/client.js +0 -630
- package/dist/integrations/linear/client.js.map +0 -7
- package/dist/integrations/linear/config.js.map +0 -7
- package/dist/integrations/linear/migration.js.map +0 -7
- package/dist/integrations/linear/oauth-server.js.map +0 -7
- package/dist/integrations/linear/rest-client.js.map +0 -7
- package/dist/integrations/linear/sync-manager.js.map +0 -7
- package/dist/integrations/linear/sync-service.js.map +0 -7
- package/dist/integrations/linear/sync.js.map +0 -7
- package/dist/integrations/linear/unified-sync.js.map +0 -7
- package/dist/integrations/linear/webhook-handler.js.map +0 -7
- package/dist/integrations/linear/webhook-server.js.map +0 -7
- package/dist/integrations/linear/webhook.js.map +0 -7
- package/dist/integrations/mcp/handlers/code-execution-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/context-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/discovery-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/index.js.map +0 -7
- package/dist/integrations/mcp/handlers/linear-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/skill-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/task-handlers.js.map +0 -7
- package/dist/integrations/mcp/handlers/trace-handlers.js.map +0 -7
- package/dist/integrations/mcp/index.js.map +0 -7
- package/dist/integrations/mcp/middleware/tool-scoring.js.map +0 -7
- package/dist/integrations/mcp/refactored-server.js.map +0 -7
- package/dist/integrations/mcp/remote-server.js +0 -691
- package/dist/integrations/mcp/remote-server.js.map +0 -7
- package/dist/integrations/mcp/schemas.js.map +0 -7
- package/dist/integrations/mcp/server.js +0 -1960
- package/dist/integrations/mcp/server.js.map +0 -7
- package/dist/integrations/mcp/tool-definitions-code.js.map +0 -7
- package/dist/integrations/mcp/tool-definitions.js.map +0 -7
- package/dist/integrations/mcp/trace-test.js +0 -48
- package/dist/integrations/mcp/trace-test.js.map +0 -7
- package/dist/integrations/pg-aiguide/embedding-provider.js +0 -189
- package/dist/integrations/pg-aiguide/embedding-provider.js.map +0 -7
- package/dist/integrations/pg-aiguide/semantic-search.js +0 -187
- package/dist/integrations/pg-aiguide/semantic-search.js.map +0 -7
- package/dist/integrations/pg-aiguide/timescale-analytics.js +0 -224
- package/dist/integrations/pg-aiguide/timescale-analytics.js.map +0 -7
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +0 -7
- package/dist/integrations/ralph/context/context-budget-manager.js.map +0 -7
- package/dist/integrations/ralph/context/stackmemory-context-loader.js.map +0 -7
- package/dist/integrations/ralph/coordination/enhanced-coordination.js.map +0 -7
- package/dist/integrations/ralph/index.js.map +0 -7
- package/dist/integrations/ralph/learning/pattern-learner.js.map +0 -7
- package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js.map +0 -7
- package/dist/integrations/ralph/monitoring/swarm-dashboard.js.map +0 -7
- package/dist/integrations/ralph/monitoring/swarm-registry.js.map +0 -7
- package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +0 -7
- package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js.map +0 -7
- package/dist/integrations/ralph/patterns/extended-coherence-sessions.js.map +0 -7
- package/dist/integrations/ralph/patterns/oracle-worker-pattern.js.map +0 -7
- package/dist/integrations/ralph/performance/performance-optimizer.js.map +0 -7
- package/dist/integrations/ralph/ralph-integration-demo.js +0 -182
- package/dist/integrations/ralph/ralph-integration-demo.js.map +0 -7
- package/dist/integrations/ralph/recovery/crash-recovery.js.map +0 -7
- package/dist/integrations/ralph/state/state-reconciler.js.map +0 -7
- package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +0 -7
- package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +0 -7
- package/dist/integrations/ralph/visualization/ralph-debugger.js.map +0 -7
- package/dist/mcp/stackmemory-mcp-server.js.map +0 -7
- package/dist/middleware/exponential-rate-limiter.js.map +0 -7
- package/dist/models/user.model.js.map +0 -7
- package/dist/servers/production/auth-middleware.js.map +0 -7
- package/dist/servers/railway/config.js +0 -55
- package/dist/servers/railway/config.js.map +0 -7
- package/dist/servers/railway/index-enhanced.js +0 -160
- package/dist/servers/railway/index-enhanced.js.map +0 -7
- package/dist/servers/railway/index.js +0 -1349
- package/dist/servers/railway/index.js.map +0 -7
- package/dist/servers/railway/simple.js +0 -64
- package/dist/servers/railway/simple.js.map +0 -7
- package/dist/servers/railway/storage-test.js +0 -459
- package/dist/servers/railway/storage-test.js.map +0 -7
- package/dist/services/config-service.js.map +0 -7
- package/dist/services/context-service.js.map +0 -7
- package/dist/skills/api-discovery.js.map +0 -7
- package/dist/skills/api-skill.js.map +0 -7
- package/dist/skills/claude-skills.js.map +0 -7
- package/dist/skills/dashboard-launcher.js.map +0 -7
- package/dist/skills/recursive-agent-orchestrator.js.map +0 -7
- package/dist/skills/repo-ingestion-skill.js +0 -609
- package/dist/skills/repo-ingestion-skill.js.map +0 -7
- package/dist/skills/security-secrets-scanner.js +0 -284
- package/dist/skills/security-secrets-scanner.js.map +0 -7
- package/dist/skills/unified-rlm-orchestrator.js.map +0 -7
- package/dist/utils/env.js.map +0 -7
- package/dist/utils/formatting.js.map +0 -7
- package/dist/utils/process-cleanup.js.map +0 -7
- package/dist/validation/schemas.js +0 -222
- package/dist/validation/schemas.js.map +0 -7
- /package/dist/{agents → src/agents}/core/agent-task-manager.js +0 -0
- /package/dist/{agents → src/agents}/verifiers/base-verifier.js +0 -0
- /package/dist/{agents → src/agents}/verifiers/formatter-verifier.js +0 -0
- /package/dist/{agents → src/agents}/verifiers/llm-judge.js +0 -0
- /package/dist/{cli → src/cli}/auto-detect.js +0 -0
- /package/dist/{cli → src/cli}/claude-sm-danger.js +0 -0
- /package/dist/{cli → src/cli}/codex-sm-danger.js +0 -0
- /package/dist/{cli → src/cli}/codex-sm.js +0 -0
- /package/dist/{cli → src/cli}/commands/api.js +0 -0
- /package/dist/{cli → src/cli}/commands/auto-background.js +0 -0
- /package/dist/{cli → src/cli}/commands/cleanup-processes.js +0 -0
- /package/dist/{cli → src/cli}/commands/clear.js +0 -0
- /package/dist/{cli → src/cli}/commands/config.js +0 -0
- /package/dist/{cli → src/cli}/commands/context-rehydrate.js +0 -0
- /package/dist/{cli → src/cli}/commands/context.js +0 -0
- /package/dist/{cli → src/cli}/commands/daemon.js +0 -0
- /package/dist/{cli → src/cli}/commands/dashboard.js +0 -0
- /package/dist/{cli → src/cli}/commands/db.js +0 -0
- /package/dist/{cli → src/cli}/commands/decision.js +0 -0
- /package/dist/{cli → src/cli}/commands/discovery.js +0 -0
- /package/dist/{cli → src/cli}/commands/handoff.js +0 -0
- /package/dist/{cli → src/cli}/commands/hooks.js +0 -0
- /package/dist/{cli → src/cli}/commands/linear.js +0 -0
- /package/dist/{cli → src/cli}/commands/log.js +0 -0
- /package/dist/{cli → src/cli}/commands/login.js +0 -0
- /package/dist/{cli → src/cli}/commands/migrate.js +0 -0
- /package/dist/{cli → src/cli}/commands/model.js +0 -0
- /package/dist/{cli → src/cli}/commands/onboard.js +0 -0
- /package/dist/{cli → src/cli}/commands/projects.js +0 -0
- /package/dist/{cli → src/cli}/commands/ralph.js +0 -0
- /package/dist/{cli → src/cli}/commands/retrieval.js +0 -0
- /package/dist/{cli → src/cli}/commands/service.js +0 -0
- /package/dist/{cli → src/cli}/commands/session.js +0 -0
- /package/dist/{cli → src/cli}/commands/settings.js +0 -0
- /package/dist/{cli → src/cli}/commands/setup.js +0 -0
- /package/dist/{cli → src/cli}/commands/shell.js +0 -0
- /package/dist/{cli → src/cli}/commands/signup.js +0 -0
- /package/dist/{cli → src/cli}/commands/skills.js +0 -0
- /package/dist/{cli → src/cli}/commands/sms-notify.js +0 -0
- /package/dist/{cli → src/cli}/commands/storage-tier.js +0 -0
- /package/dist/{cli → src/cli}/commands/sweep.js +0 -0
- /package/dist/{cli → src/cli}/commands/tasks.js +0 -0
- /package/dist/{cli → src/cli}/commands/worktree.js +0 -0
- /package/dist/{cli → src/cli}/opencode-sm.js +0 -0
- /package/dist/{cli → src/cli}/utils/viewer.js +0 -0
- /package/dist/{core → src/core}/config/config-manager.js +0 -0
- /package/dist/{core → src/core}/config/feature-flags.js +0 -0
- /package/dist/{core → src/core}/config/storage-config.js +0 -0
- /package/dist/{core → src/core}/config/types.js +0 -0
- /package/dist/{core → src/core}/context/auto-context.js +0 -0
- /package/dist/{core → src/core}/context/dual-stack-manager.js +0 -0
- /package/dist/{core → src/core}/context/enhanced-rehydration.js +0 -0
- /package/dist/{core → src/core}/context/frame-database.js +0 -0
- /package/dist/{core → src/core}/context/frame-digest.js +0 -0
- /package/dist/{core → src/core}/context/frame-handoff-manager.js +0 -0
- /package/dist/{core → src/core}/context/frame-lifecycle-hooks.js +0 -0
- /package/dist/{core → src/core}/context/frame-recovery.js +0 -0
- /package/dist/{core → src/core}/context/frame-stack.js +0 -0
- /package/dist/{core → src/core}/context/frame-types.js +0 -0
- /package/dist/{core → src/core}/context/frame-types.js.map +0 -0
- /package/dist/{core → src/core}/context/index.js +0 -0
- /package/dist/{core → src/core}/context/permission-manager.js +0 -0
- /package/dist/{core → src/core}/context/recursive-context-manager.js +0 -0
- /package/dist/{core → src/core}/context/refactored-frame-manager.js +0 -0
- /package/dist/{core → src/core}/context/shared-context-layer.js +0 -0
- /package/dist/{core → src/core}/context/stack-merge-resolver.js +0 -0
- /package/dist/{core → src/core}/context/validation.js +0 -0
- /package/dist/{core → src/core}/database/batch-operations.js +0 -0
- /package/dist/{core → src/core}/database/connection-pool.js +0 -0
- /package/dist/{core → src/core}/database/database-adapter.js +0 -0
- /package/dist/{core → src/core}/database/migration-manager.js +0 -0
- /package/dist/{core → src/core}/database/query-cache.js +0 -0
- /package/dist/{core → src/core}/database/query-router.js +0 -0
- /package/dist/{core → src/core}/digest/enhanced-hybrid-digest.js +0 -0
- /package/dist/{core → src/core}/digest/frame-digest-integration.js +0 -0
- /package/dist/{core → src/core}/digest/hybrid-digest-generator.js +0 -0
- /package/dist/{core → src/core}/digest/index.js +0 -0
- /package/dist/{core → src/core}/digest/types.js +0 -0
- /package/dist/{core → src/core}/errors/recovery.js +0 -0
- /package/dist/{core → src/core}/execution/parallel-executor.js +0 -0
- /package/dist/{core/merge → src/core/extensions}/types.js +0 -0
- /package/dist/{core/merge → src/core/extensions}/types.js.map +0 -0
- /package/dist/{core → src/core}/frame/workflow-templates.js +0 -0
- /package/dist/{core → src/core}/merge/conflict-detector.js +0 -0
- /package/dist/{core → src/core}/merge/index.js +0 -0
- /package/dist/{core → src/core}/merge/resolution-engine.js +0 -0
- /package/dist/{core → src/core}/merge/stack-diff.js +0 -0
- /package/dist/{core → src/core/merge}/types.js +0 -0
- /package/dist/{core → src/core/merge}/types.js.map +0 -0
- /package/dist/{core → src/core}/models/fallback-monitor.js +0 -0
- /package/dist/{core → src/core}/models/model-router.js +0 -0
- /package/dist/{core → src/core}/monitoring/error-handler.js +0 -0
- /package/dist/{core → src/core}/monitoring/metrics.js +0 -0
- /package/dist/{core → src/core}/monitoring/progress-tracker.js +0 -0
- /package/dist/{core → src/core}/monitoring/session-monitor.js +0 -0
- /package/dist/{core → src/core}/performance/context-cache.js +0 -0
- /package/dist/{core → src/core}/performance/index.js +0 -0
- /package/dist/{core → src/core}/performance/lazy-context-loader.js +0 -0
- /package/dist/{core → src/core}/performance/monitor.js +0 -0
- /package/dist/{core → src/core}/performance/optimized-frame-context.js +0 -0
- /package/dist/{core → src/core}/performance/performance-benchmark.js +0 -0
- /package/dist/{core → src/core}/performance/performance-profiler.js +0 -0
- /package/dist/{core → src/core}/performance/streaming-jsonl-parser.js +0 -0
- /package/dist/{core → src/core}/persistence/postgres-adapter.js +0 -0
- /package/dist/{core → src/core}/projects/project-isolation.js +0 -0
- /package/dist/{core → src/core}/projects/project-manager.js +0 -0
- /package/dist/{core → src/core}/query/query-parser.js +0 -0
- /package/dist/{core → src/core}/query/query-templates.js +0 -0
- /package/dist/{core → src/core}/retrieval/context-retriever.js +0 -0
- /package/dist/{core → src/core}/retrieval/index.js +0 -0
- /package/dist/{core → src/core}/retrieval/llm-context-retrieval.js +0 -0
- /package/dist/{core → src/core}/retrieval/llm-provider.js +0 -0
- /package/dist/{core → src/core}/retrieval/retrieval-audit.js +0 -0
- /package/dist/{core → src/core}/retrieval/summary-generator.js +0 -0
- /package/dist/{core → src/core}/retrieval/types.js +0 -0
- /package/dist/{core → src/core}/session/clear-survival.js +0 -0
- /package/dist/{core → src/core}/session/enhanced-handoff.js +0 -0
- /package/dist/{core → src/core}/session/handoff-generator.js +0 -0
- /package/dist/{core → src/core}/session/index.js +0 -0
- /package/dist/{core → src/core}/session/session-manager.js +0 -0
- /package/dist/{core → src/core}/skills/index.js +0 -0
- /package/dist/{core → src/core}/skills/skill-storage.js +0 -0
- /package/dist/{core → src/core}/skills/types.js +0 -0
- /package/dist/{core → src/core}/storage/infinite-storage.js +0 -0
- /package/dist/{core → src/core}/storage/remote-storage.js +0 -0
- /package/dist/{core → src/core}/storage/two-tier-storage.js +0 -0
- /package/dist/{core → src/core}/trace/cli-trace-wrapper.js +0 -0
- /package/dist/{core → src/core}/trace/db-trace-wrapper.js +0 -0
- /package/dist/{core → src/core}/trace/debug-trace.js +0 -0
- /package/dist/{core → src/core}/trace/index.js +0 -0
- /package/dist/{core → src/core}/trace/linear-api-wrapper.js +0 -0
- /package/dist/{core → src/core}/trace/trace-detector.js +0 -0
- /package/dist/{core → src/core}/trace/trace-store.js +0 -0
- /package/dist/{core → src/core}/trace/types.js +0 -0
- /package/dist/{integrations/linear → src/core}/types.js +0 -0
- /package/dist/{integrations/linear → src/core}/types.js.map +0 -0
- /package/dist/{core → src/core}/utils/async-mutex.js +0 -0
- /package/dist/{core → src/core}/utils/compression.js +0 -0
- /package/dist/{core → src/core}/utils/update-checker.js +0 -0
- /package/dist/{core → src/core}/worktree/worktree-manager.js +0 -0
- /package/dist/{daemon → src/daemon}/daemon-config.js +0 -0
- /package/dist/{daemon → src/daemon}/services/context-service.js +0 -0
- /package/dist/{daemon → src/daemon}/services/linear-service.js +0 -0
- /package/dist/{daemon → src/daemon}/session-daemon.js +0 -0
- /package/dist/{daemon → src/daemon}/unified-daemon.js +0 -0
- /package/dist/{features → src/features}/analytics/api/analytics-api.js +0 -0
- /package/dist/{features → src/features}/analytics/core/analytics-service.js +0 -0
- /package/dist/{features → src/features}/analytics/index.js +0 -0
- /package/dist/{features → src/features}/analytics/queries/metrics-queries.js +0 -0
- /package/dist/{features → src/features}/analytics/types/metrics.js +0 -0
- /package/dist/{features → src/features}/analytics/types/metrics.js.map +0 -0
- /package/dist/{features → src/features}/browser/browser-mcp.js +0 -0
- /package/dist/{features → src/features}/sweep/index.js +0 -0
- /package/dist/{features → src/features}/sweep/prediction-client.js +0 -0
- /package/dist/{features → src/features}/sweep/prompt-builder.js +0 -0
- /package/dist/{features → src/features}/sweep/pty-wrapper.js +0 -0
- /package/dist/{features → src/features}/sweep/state-watcher.js +0 -0
- /package/dist/{features → src/features}/sweep/status-bar.js +0 -0
- /package/dist/{features → src/features}/sweep/sweep-server-manager.js +0 -0
- /package/dist/{features → src/features}/sweep/tab-interceptor.js +0 -0
- /package/dist/{features → src/features}/sweep/types.js +0 -0
- /package/dist/{features → src/features}/tasks/linear-task-manager.js +0 -0
- /package/dist/{features → src/features}/tasks/task-aware-context.js +0 -0
- /package/dist/{features → src/features}/tui/simple-monitor.js +0 -0
- /package/dist/{features → src/features}/tui/swarm-monitor.js +0 -0
- /package/dist/{features → src/features}/web/client/stores/task-store.js +0 -0
- /package/dist/{features → src/features}/web/server/index.js +0 -0
- /package/dist/{hooks → src/hooks}/auto-background.js +0 -0
- /package/dist/{hooks → src/hooks}/claude-code-whatsapp-hook.js +0 -0
- /package/dist/{hooks → src/hooks}/config.js +0 -0
- /package/dist/{hooks → src/hooks}/daemon.js +0 -0
- /package/dist/{hooks → src/hooks}/events.js +0 -0
- /package/dist/{hooks → src/hooks}/index.js +0 -0
- /package/dist/{hooks → src/hooks}/linear-task-picker.js +0 -0
- /package/dist/{hooks → src/hooks}/schemas.js +0 -0
- /package/dist/{hooks → src/hooks}/secure-fs.js +0 -0
- /package/dist/{hooks → src/hooks}/security-logger.js +0 -0
- /package/dist/{hooks → src/hooks}/session-summary.js +0 -0
- /package/dist/{hooks → src/hooks}/sms-action-runner.js +0 -0
- /package/dist/{hooks → src/hooks}/sms-notify.js +0 -0
- /package/dist/{hooks → src/hooks}/sms-watcher.js +0 -0
- /package/dist/{hooks → src/hooks}/sms-webhook.js +0 -0
- /package/dist/{hooks → src/hooks}/whatsapp-commands.js +0 -0
- /package/dist/{hooks → src/hooks}/whatsapp-scheduler.js +0 -0
- /package/dist/{hooks → src/hooks}/whatsapp-sync.js +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{integrations → src/integrations}/anthropic/client.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/agent-bridge.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/enhanced-pre-clear-hooks.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/lifecycle-hooks.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/post-task-hooks.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/subagent-client-stub.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/subagent-client.js +0 -0
- /package/dist/{integrations → src/integrations}/claude-code/task-coordinator.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/auth.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/auto-sync.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/config.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/migration.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/oauth-server.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/rest-client.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/sync-manager.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/sync-service.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/sync.js +0 -0
- /package/dist/{integrations/ralph → src/integrations/linear}/types.js +0 -0
- /package/dist/{integrations/ralph → src/integrations/linear}/types.js.map +0 -0
- /package/dist/{integrations → src/integrations}/linear/unified-sync.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/webhook-handler.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/webhook-server.js +0 -0
- /package/dist/{integrations → src/integrations}/linear/webhook.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/code-execution-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/context-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/discovery-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/index.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/linear-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/skill-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/task-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/handlers/trace-handlers.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/index.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/middleware/tool-scoring.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/refactored-server.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/schemas.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/tool-definitions-code.js +0 -0
- /package/dist/{integrations → src/integrations}/mcp/tool-definitions.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/bridge/ralph-stackmemory-bridge.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/context/context-budget-manager.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/context/stackmemory-context-loader.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/coordination/enhanced-coordination.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/index.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/learning/pattern-learner.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/lifecycle/iteration-lifecycle.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/monitoring/swarm-dashboard.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/monitoring/swarm-registry.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/orchestration/multi-loop-orchestrator.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/patterns/compounding-engineering-pattern.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/patterns/extended-coherence-sessions.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/patterns/oracle-worker-pattern.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/performance/performance-optimizer.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/recovery/crash-recovery.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/state/state-reconciler.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/swarm/git-workflow-manager.js +0 -0
- /package/dist/{integrations → src/integrations}/ralph/swarm/swarm-coordinator.js +0 -0
- /package/dist/{types/task.js.map → src/integrations/ralph/types.js.map} +0 -0
- /package/dist/{integrations → src/integrations}/ralph/visualization/ralph-debugger.js +0 -0
- /package/dist/{mcp → src/mcp}/stackmemory-mcp-server.js +0 -0
- /package/dist/{middleware → src/middleware}/exponential-rate-limiter.js +0 -0
- /package/dist/{models → src/models}/user.model.js +0 -0
- /package/dist/{servers → src/servers}/production/auth-middleware.js +0 -0
- /package/dist/{services → src/services}/config-service.js +0 -0
- /package/dist/{services → src/services}/context-service.js +0 -0
- /package/dist/{skills → src/skills}/api-discovery.js +0 -0
- /package/dist/{skills → src/skills}/api-skill.js +0 -0
- /package/dist/{skills → src/skills}/claude-skills.js +0 -0
- /package/dist/{skills → src/skills}/dashboard-launcher.js +0 -0
- /package/dist/{skills → src/skills}/recursive-agent-orchestrator.js +0 -0
- /package/dist/{skills → src/skills}/unified-rlm-orchestrator.js +0 -0
- /package/dist/{types → src/types}/task.js +0 -0
- /package/dist/{utils → src/utils}/env.js +0 -0
- /package/dist/{utils → src/utils}/formatting.js +0 -0
- /package/dist/{utils → src/utils}/process-cleanup.js +0 -0
|
@@ -1,990 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
2
|
-
import { dirname as __pathDirname } from 'path';
|
|
3
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
4
|
-
const __dirname = __pathDirname(__filename);
|
|
5
|
-
import { Pool } from "pg";
|
|
6
|
-
import {
|
|
7
|
-
FeatureAwareDatabaseAdapter
|
|
8
|
-
} from "./database-adapter.js";
|
|
9
|
-
import { logger } from "../monitoring/logger.js";
|
|
10
|
-
import { DatabaseError, ErrorCode, ValidationError } from "../errors/index.js";
|
|
11
|
-
class ParadeDBAdapter extends FeatureAwareDatabaseAdapter {
|
|
12
|
-
pool = null;
|
|
13
|
-
activeClient = null;
|
|
14
|
-
constructor(projectId, config) {
|
|
15
|
-
super(projectId, config);
|
|
16
|
-
}
|
|
17
|
-
getFeatures() {
|
|
18
|
-
const config = this.config;
|
|
19
|
-
return {
|
|
20
|
-
supportsFullTextSearch: config.enableBM25 !== false,
|
|
21
|
-
supportsVectorSearch: config.enableVector !== false,
|
|
22
|
-
supportsPartitioning: true,
|
|
23
|
-
supportsAnalytics: config.enableAnalytics !== false,
|
|
24
|
-
supportsCompression: true,
|
|
25
|
-
supportsMaterializedViews: true,
|
|
26
|
-
supportsParallelQueries: true
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
async connect() {
|
|
30
|
-
if (this.pool) return;
|
|
31
|
-
const config = this.config;
|
|
32
|
-
this.pool = new Pool({
|
|
33
|
-
connectionString: config.connectionString,
|
|
34
|
-
host: config.host || "localhost",
|
|
35
|
-
port: config.port || 5432,
|
|
36
|
-
database: config.database || "stackmemory",
|
|
37
|
-
user: config.user,
|
|
38
|
-
password: config.password,
|
|
39
|
-
ssl: config.ssl,
|
|
40
|
-
max: config.max || 20,
|
|
41
|
-
idleTimeoutMillis: config.idleTimeoutMillis || 3e4,
|
|
42
|
-
connectionTimeoutMillis: config.connectionTimeoutMillis || 2e3,
|
|
43
|
-
statement_timeout: config.statementTimeout || 3e4
|
|
44
|
-
});
|
|
45
|
-
const client = await this.pool.connect();
|
|
46
|
-
try {
|
|
47
|
-
await client.query("SELECT 1");
|
|
48
|
-
logger.info("ParadeDB connected successfully");
|
|
49
|
-
} finally {
|
|
50
|
-
client.release();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async disconnect() {
|
|
54
|
-
if (!this.pool) return;
|
|
55
|
-
await this.pool.end();
|
|
56
|
-
this.pool = null;
|
|
57
|
-
logger.info("ParadeDB disconnected");
|
|
58
|
-
}
|
|
59
|
-
isConnected() {
|
|
60
|
-
return this.pool !== null && !this.pool.ended;
|
|
61
|
-
}
|
|
62
|
-
async ping() {
|
|
63
|
-
if (!this.pool) return false;
|
|
64
|
-
try {
|
|
65
|
-
const client = await this.pool.connect();
|
|
66
|
-
try {
|
|
67
|
-
await client.query("SELECT 1");
|
|
68
|
-
return true;
|
|
69
|
-
} finally {
|
|
70
|
-
client.release();
|
|
71
|
-
}
|
|
72
|
-
} catch {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async initializeSchema() {
|
|
77
|
-
const client = await this.getClient();
|
|
78
|
-
try {
|
|
79
|
-
await client.query("BEGIN");
|
|
80
|
-
await client.query(`
|
|
81
|
-
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
82
|
-
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
|
|
83
|
-
CREATE EXTENSION IF NOT EXISTS "btree_gin";
|
|
84
|
-
`);
|
|
85
|
-
const config = this.config;
|
|
86
|
-
if (config.enableBM25 !== false) {
|
|
87
|
-
await client.query("CREATE EXTENSION IF NOT EXISTS pg_search;");
|
|
88
|
-
}
|
|
89
|
-
if (config.enableVector !== false) {
|
|
90
|
-
await client.query("CREATE EXTENSION IF NOT EXISTS vector;");
|
|
91
|
-
}
|
|
92
|
-
if (config.enableAnalytics !== false) {
|
|
93
|
-
await client.query("CREATE EXTENSION IF NOT EXISTS pg_analytics;");
|
|
94
|
-
}
|
|
95
|
-
await client.query(`
|
|
96
|
-
-- Main frames table
|
|
97
|
-
CREATE TABLE IF NOT EXISTS frames (
|
|
98
|
-
frame_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
99
|
-
run_id UUID NOT NULL,
|
|
100
|
-
project_id TEXT NOT NULL,
|
|
101
|
-
parent_frame_id UUID REFERENCES frames(frame_id) ON DELETE CASCADE,
|
|
102
|
-
depth INTEGER NOT NULL DEFAULT 0,
|
|
103
|
-
type TEXT NOT NULL,
|
|
104
|
-
name TEXT NOT NULL,
|
|
105
|
-
state TEXT DEFAULT 'active',
|
|
106
|
-
score FLOAT DEFAULT 0.5,
|
|
107
|
-
inputs JSONB DEFAULT '{}',
|
|
108
|
-
outputs JSONB DEFAULT '{}',
|
|
109
|
-
metadata JSONB DEFAULT '{}',
|
|
110
|
-
digest_text TEXT,
|
|
111
|
-
digest_json JSONB DEFAULT '{}',
|
|
112
|
-
content TEXT, -- For full-text search
|
|
113
|
-
embedding vector(768), -- For vector search
|
|
114
|
-
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
115
|
-
closed_at TIMESTAMPTZ,
|
|
116
|
-
CONSTRAINT check_state CHECK (state IN ('active', 'closed', 'suspended'))
|
|
117
|
-
) PARTITION BY RANGE (created_at);
|
|
118
|
-
|
|
119
|
-
-- Create partitions for time-based data
|
|
120
|
-
CREATE TABLE IF NOT EXISTS frames_recent PARTITION OF frames
|
|
121
|
-
FOR VALUES FROM (NOW() - INTERVAL '30 days') TO (NOW() + INTERVAL '1 day');
|
|
122
|
-
|
|
123
|
-
CREATE TABLE IF NOT EXISTS frames_archive PARTITION OF frames
|
|
124
|
-
FOR VALUES FROM ('2020-01-01') TO (NOW() - INTERVAL '30 days');
|
|
125
|
-
|
|
126
|
-
-- Events table
|
|
127
|
-
CREATE TABLE IF NOT EXISTS events (
|
|
128
|
-
event_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
129
|
-
run_id UUID NOT NULL,
|
|
130
|
-
frame_id UUID NOT NULL REFERENCES frames(frame_id) ON DELETE CASCADE,
|
|
131
|
-
seq INTEGER NOT NULL,
|
|
132
|
-
event_type TEXT NOT NULL,
|
|
133
|
-
payload JSONB NOT NULL DEFAULT '{}',
|
|
134
|
-
ts TIMESTAMPTZ DEFAULT NOW()
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
-- Anchors table
|
|
138
|
-
CREATE TABLE IF NOT EXISTS anchors (
|
|
139
|
-
anchor_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
140
|
-
frame_id UUID NOT NULL REFERENCES frames(frame_id) ON DELETE CASCADE,
|
|
141
|
-
project_id TEXT NOT NULL,
|
|
142
|
-
type TEXT NOT NULL,
|
|
143
|
-
text TEXT NOT NULL,
|
|
144
|
-
priority INTEGER DEFAULT 0,
|
|
145
|
-
metadata JSONB DEFAULT '{}',
|
|
146
|
-
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
-- Schema version tracking
|
|
150
|
-
CREATE TABLE IF NOT EXISTS schema_version (
|
|
151
|
-
version INTEGER PRIMARY KEY,
|
|
152
|
-
applied_at TIMESTAMPTZ DEFAULT NOW(),
|
|
153
|
-
description TEXT
|
|
154
|
-
);
|
|
155
|
-
`);
|
|
156
|
-
await client.query(`
|
|
157
|
-
-- Standard B-tree indexes
|
|
158
|
-
CREATE INDEX IF NOT EXISTS idx_frames_run_id ON frames USING btree(run_id);
|
|
159
|
-
CREATE INDEX IF NOT EXISTS idx_frames_project_id ON frames USING btree(project_id);
|
|
160
|
-
CREATE INDEX IF NOT EXISTS idx_frames_parent ON frames USING btree(parent_frame_id);
|
|
161
|
-
CREATE INDEX IF NOT EXISTS idx_frames_state ON frames USING btree(state);
|
|
162
|
-
CREATE INDEX IF NOT EXISTS idx_frames_type ON frames USING btree(type);
|
|
163
|
-
CREATE INDEX IF NOT EXISTS idx_frames_created_at ON frames USING btree(created_at DESC);
|
|
164
|
-
CREATE INDEX IF NOT EXISTS idx_frames_score ON frames USING btree(score DESC);
|
|
165
|
-
|
|
166
|
-
-- GIN indexes for JSONB
|
|
167
|
-
CREATE INDEX IF NOT EXISTS idx_frames_inputs ON frames USING gin(inputs);
|
|
168
|
-
CREATE INDEX IF NOT EXISTS idx_frames_outputs ON frames USING gin(outputs);
|
|
169
|
-
CREATE INDEX IF NOT EXISTS idx_frames_metadata ON frames USING gin(metadata);
|
|
170
|
-
CREATE INDEX IF NOT EXISTS idx_frames_digest ON frames USING gin(digest_json);
|
|
171
|
-
|
|
172
|
-
-- Trigram index for fuzzy text search
|
|
173
|
-
CREATE INDEX IF NOT EXISTS idx_frames_name_trgm ON frames USING gin(name gin_trgm_ops);
|
|
174
|
-
CREATE INDEX IF NOT EXISTS idx_frames_content_trgm ON frames USING gin(content gin_trgm_ops);
|
|
175
|
-
|
|
176
|
-
-- Event indexes
|
|
177
|
-
CREATE INDEX IF NOT EXISTS idx_events_frame ON events USING btree(frame_id);
|
|
178
|
-
CREATE INDEX IF NOT EXISTS idx_events_seq ON events USING btree(frame_id, seq);
|
|
179
|
-
CREATE INDEX IF NOT EXISTS idx_events_type ON events USING btree(event_type);
|
|
180
|
-
CREATE INDEX IF NOT EXISTS idx_events_ts ON events USING btree(ts DESC);
|
|
181
|
-
|
|
182
|
-
-- Anchor indexes
|
|
183
|
-
CREATE INDEX IF NOT EXISTS idx_anchors_frame ON anchors USING btree(frame_id);
|
|
184
|
-
CREATE INDEX IF NOT EXISTS idx_anchors_type ON anchors USING btree(type);
|
|
185
|
-
CREATE INDEX IF NOT EXISTS idx_anchors_priority ON anchors USING btree(priority DESC);
|
|
186
|
-
`);
|
|
187
|
-
if (config.enableBM25 !== false) {
|
|
188
|
-
await client.query(`
|
|
189
|
-
-- Create BM25 index for full-text search
|
|
190
|
-
CALL paradedb.create_bm25_test_table(
|
|
191
|
-
index_name => 'frames_search_idx',
|
|
192
|
-
table_name => 'frames',
|
|
193
|
-
schema_name => 'public',
|
|
194
|
-
key_field => 'frame_id',
|
|
195
|
-
text_fields => paradedb.field('name') ||
|
|
196
|
-
paradedb.field('content') ||
|
|
197
|
-
paradedb.field('digest_text'),
|
|
198
|
-
numeric_fields => paradedb.field('score') ||
|
|
199
|
-
paradedb.field('depth'),
|
|
200
|
-
json_fields => paradedb.field('metadata', flatten => true),
|
|
201
|
-
datetime_fields => paradedb.field('created_at')
|
|
202
|
-
);
|
|
203
|
-
`);
|
|
204
|
-
}
|
|
205
|
-
if (config.enableVector !== false) {
|
|
206
|
-
await client.query(`
|
|
207
|
-
-- HNSW index for vector similarity search
|
|
208
|
-
CREATE INDEX IF NOT EXISTS idx_frames_embedding
|
|
209
|
-
ON frames USING hnsw (embedding vector_cosine_ops)
|
|
210
|
-
WITH (m = 16, ef_construction = 64);
|
|
211
|
-
`);
|
|
212
|
-
}
|
|
213
|
-
await client.query(`
|
|
214
|
-
CREATE MATERIALIZED VIEW IF NOT EXISTS pattern_summary AS
|
|
215
|
-
WITH pattern_extraction AS (
|
|
216
|
-
SELECT
|
|
217
|
-
project_id,
|
|
218
|
-
type as pattern_type,
|
|
219
|
-
metadata->>'error' as error_pattern,
|
|
220
|
-
COUNT(*) as frequency,
|
|
221
|
-
MAX(score) as max_score,
|
|
222
|
-
MAX(created_at) as last_seen,
|
|
223
|
-
MIN(created_at) as first_seen
|
|
224
|
-
FROM frames
|
|
225
|
-
WHERE created_at > NOW() - INTERVAL '30 days'
|
|
226
|
-
GROUP BY project_id, pattern_type, error_pattern
|
|
227
|
-
)
|
|
228
|
-
SELECT * FROM pattern_extraction
|
|
229
|
-
WHERE frequency > 3;
|
|
230
|
-
|
|
231
|
-
CREATE UNIQUE INDEX IF NOT EXISTS idx_pattern_summary_unique
|
|
232
|
-
ON pattern_summary(project_id, pattern_type, error_pattern);
|
|
233
|
-
`);
|
|
234
|
-
await client.query(`
|
|
235
|
-
INSERT INTO schema_version (version, description)
|
|
236
|
-
VALUES (1, 'Initial ParadeDB schema with search and analytics')
|
|
237
|
-
ON CONFLICT (version) DO NOTHING;
|
|
238
|
-
`);
|
|
239
|
-
await client.query("COMMIT");
|
|
240
|
-
logger.info("ParadeDB schema initialized successfully");
|
|
241
|
-
} catch (error) {
|
|
242
|
-
await client.query("ROLLBACK");
|
|
243
|
-
throw error;
|
|
244
|
-
} finally {
|
|
245
|
-
this.releaseClient(client);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
async migrateSchema(targetVersion) {
|
|
249
|
-
const client = await this.getClient();
|
|
250
|
-
try {
|
|
251
|
-
const result = await client.query(
|
|
252
|
-
"SELECT MAX(version) as version FROM schema_version"
|
|
253
|
-
);
|
|
254
|
-
const currentVersion = result.rows[0]?.version || 0;
|
|
255
|
-
if (currentVersion >= targetVersion) {
|
|
256
|
-
logger.info("Schema already at target version", {
|
|
257
|
-
currentVersion,
|
|
258
|
-
targetVersion
|
|
259
|
-
});
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
for (let v = currentVersion + 1; v <= targetVersion; v++) {
|
|
263
|
-
logger.info(`Applying migration to version ${v}`);
|
|
264
|
-
await client.query(
|
|
265
|
-
"INSERT INTO schema_version (version, description) VALUES ($1, $2)",
|
|
266
|
-
[v, `Migration to version ${v}`]
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
} finally {
|
|
270
|
-
this.releaseClient(client);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
async getSchemaVersion() {
|
|
274
|
-
const client = await this.getClient();
|
|
275
|
-
try {
|
|
276
|
-
const result = await client.query(
|
|
277
|
-
"SELECT MAX(version) as version FROM schema_version"
|
|
278
|
-
);
|
|
279
|
-
return result.rows[0]?.version || 0;
|
|
280
|
-
} finally {
|
|
281
|
-
this.releaseClient(client);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
// Frame operations
|
|
285
|
-
async createFrame(frame) {
|
|
286
|
-
const client = await this.getClient();
|
|
287
|
-
try {
|
|
288
|
-
const result = await client.query(
|
|
289
|
-
`
|
|
290
|
-
INSERT INTO frames (
|
|
291
|
-
frame_id, run_id, project_id, parent_frame_id, depth,
|
|
292
|
-
type, name, state, score, inputs, outputs, metadata,
|
|
293
|
-
digest_text, digest_json, content
|
|
294
|
-
) VALUES (
|
|
295
|
-
COALESCE($1::uuid, uuid_generate_v4()), $2, $3, $4, $5,
|
|
296
|
-
$6, $7, $8, $9, $10, $11, $12, $13, $14, $15
|
|
297
|
-
) RETURNING frame_id
|
|
298
|
-
`,
|
|
299
|
-
[
|
|
300
|
-
frame.frame_id || null,
|
|
301
|
-
frame.run_id,
|
|
302
|
-
frame.project_id || this.projectId,
|
|
303
|
-
frame.parent_frame_id || null,
|
|
304
|
-
frame.depth || 0,
|
|
305
|
-
frame.type,
|
|
306
|
-
frame.name,
|
|
307
|
-
frame.state || "active",
|
|
308
|
-
frame.score || 0.5,
|
|
309
|
-
JSON.stringify(frame.inputs || {}),
|
|
310
|
-
JSON.stringify(frame.outputs || {}),
|
|
311
|
-
JSON.stringify(frame.metadata || {}),
|
|
312
|
-
frame.digest_text || null,
|
|
313
|
-
JSON.stringify(frame.digest_json || {}),
|
|
314
|
-
frame.content || `${frame.name} ${frame.digest_text || ""}`
|
|
315
|
-
]
|
|
316
|
-
);
|
|
317
|
-
return result.rows[0].frame_id;
|
|
318
|
-
} finally {
|
|
319
|
-
this.releaseClient(client);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
async getFrame(frameId) {
|
|
323
|
-
const client = await this.getClient();
|
|
324
|
-
try {
|
|
325
|
-
const result = await client.query(
|
|
326
|
-
"SELECT * FROM frames WHERE frame_id = $1",
|
|
327
|
-
[frameId]
|
|
328
|
-
);
|
|
329
|
-
if (result.rows.length === 0) return null;
|
|
330
|
-
const row = result.rows[0];
|
|
331
|
-
return {
|
|
332
|
-
...row,
|
|
333
|
-
frame_id: row.frame_id,
|
|
334
|
-
run_id: row.run_id,
|
|
335
|
-
created_at: row.created_at.getTime(),
|
|
336
|
-
closed_at: row.closed_at?.getTime()
|
|
337
|
-
};
|
|
338
|
-
} finally {
|
|
339
|
-
this.releaseClient(client);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
async updateFrame(frameId, updates) {
|
|
343
|
-
const client = await this.getClient();
|
|
344
|
-
try {
|
|
345
|
-
const fields = [];
|
|
346
|
-
const values = [];
|
|
347
|
-
let paramCount = 1;
|
|
348
|
-
if (updates.state !== void 0) {
|
|
349
|
-
fields.push(`state = $${paramCount++}`);
|
|
350
|
-
values.push(updates.state);
|
|
351
|
-
}
|
|
352
|
-
if (updates.outputs !== void 0) {
|
|
353
|
-
fields.push(`outputs = $${paramCount++}`);
|
|
354
|
-
values.push(JSON.stringify(updates.outputs));
|
|
355
|
-
}
|
|
356
|
-
if (updates.score !== void 0) {
|
|
357
|
-
fields.push(`score = $${paramCount++}`);
|
|
358
|
-
values.push(updates.score);
|
|
359
|
-
}
|
|
360
|
-
if (updates.digest_text !== void 0) {
|
|
361
|
-
fields.push(`digest_text = $${paramCount++}`);
|
|
362
|
-
values.push(updates.digest_text);
|
|
363
|
-
}
|
|
364
|
-
if (updates.digest_json !== void 0) {
|
|
365
|
-
fields.push(`digest_json = $${paramCount++}`);
|
|
366
|
-
values.push(JSON.stringify(updates.digest_json));
|
|
367
|
-
}
|
|
368
|
-
if (updates.closed_at !== void 0) {
|
|
369
|
-
fields.push(`closed_at = $${paramCount++}`);
|
|
370
|
-
values.push(new Date(updates.closed_at));
|
|
371
|
-
}
|
|
372
|
-
if (fields.length === 0) return;
|
|
373
|
-
values.push(frameId);
|
|
374
|
-
await client.query(
|
|
375
|
-
`
|
|
376
|
-
UPDATE frames SET ${fields.join(", ")} WHERE frame_id = $${paramCount}
|
|
377
|
-
`,
|
|
378
|
-
values
|
|
379
|
-
);
|
|
380
|
-
} finally {
|
|
381
|
-
this.releaseClient(client);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
async deleteFrame(frameId) {
|
|
385
|
-
const client = await this.getClient();
|
|
386
|
-
try {
|
|
387
|
-
await client.query("DELETE FROM frames WHERE frame_id = $1", [frameId]);
|
|
388
|
-
} finally {
|
|
389
|
-
this.releaseClient(client);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
async getActiveFrames(runId) {
|
|
393
|
-
const client = await this.getClient();
|
|
394
|
-
try {
|
|
395
|
-
let query = "SELECT * FROM frames WHERE state = $1";
|
|
396
|
-
const params = ["active"];
|
|
397
|
-
if (runId) {
|
|
398
|
-
query += " AND run_id = $2";
|
|
399
|
-
params.push(runId);
|
|
400
|
-
}
|
|
401
|
-
query += " ORDER BY depth ASC, created_at ASC";
|
|
402
|
-
const result = await client.query(query, params);
|
|
403
|
-
return result.rows.map((row) => ({
|
|
404
|
-
...row,
|
|
405
|
-
created_at: row.created_at.getTime(),
|
|
406
|
-
closed_at: row.closed_at?.getTime()
|
|
407
|
-
}));
|
|
408
|
-
} finally {
|
|
409
|
-
this.releaseClient(client);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
async closeFrame(frameId, outputs) {
|
|
413
|
-
await this.updateFrame(frameId, {
|
|
414
|
-
state: "closed",
|
|
415
|
-
outputs,
|
|
416
|
-
closed_at: Date.now()
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
// Event operations
|
|
420
|
-
async createEvent(event) {
|
|
421
|
-
const client = await this.getClient();
|
|
422
|
-
try {
|
|
423
|
-
const result = await client.query(
|
|
424
|
-
`
|
|
425
|
-
INSERT INTO events (event_id, run_id, frame_id, seq, event_type, payload, ts)
|
|
426
|
-
VALUES (COALESCE($1::uuid, uuid_generate_v4()), $2, $3, $4, $5, $6, $7)
|
|
427
|
-
RETURNING event_id
|
|
428
|
-
`,
|
|
429
|
-
[
|
|
430
|
-
event.event_id || null,
|
|
431
|
-
event.run_id,
|
|
432
|
-
event.frame_id,
|
|
433
|
-
event.seq || 0,
|
|
434
|
-
event.event_type,
|
|
435
|
-
JSON.stringify(event.payload || {}),
|
|
436
|
-
event.ts ? new Date(event.ts) : /* @__PURE__ */ new Date()
|
|
437
|
-
]
|
|
438
|
-
);
|
|
439
|
-
return result.rows[0].event_id;
|
|
440
|
-
} finally {
|
|
441
|
-
this.releaseClient(client);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
async getFrameEvents(frameId, options) {
|
|
445
|
-
const client = await this.getClient();
|
|
446
|
-
try {
|
|
447
|
-
let query = "SELECT * FROM events WHERE frame_id = $1";
|
|
448
|
-
const params = [frameId];
|
|
449
|
-
query += this.buildOrderByClause(
|
|
450
|
-
options?.orderBy || "seq",
|
|
451
|
-
options?.orderDirection
|
|
452
|
-
);
|
|
453
|
-
query += this.buildLimitClause(options?.limit, options?.offset);
|
|
454
|
-
const result = await client.query(query, params);
|
|
455
|
-
return result.rows.map((row) => ({
|
|
456
|
-
...row,
|
|
457
|
-
ts: row.ts.getTime()
|
|
458
|
-
}));
|
|
459
|
-
} finally {
|
|
460
|
-
this.releaseClient(client);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
async deleteFrameEvents(frameId) {
|
|
464
|
-
const client = await this.getClient();
|
|
465
|
-
try {
|
|
466
|
-
await client.query("DELETE FROM events WHERE frame_id = $1", [frameId]);
|
|
467
|
-
} finally {
|
|
468
|
-
this.releaseClient(client);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
// Anchor operations
|
|
472
|
-
async createAnchor(anchor) {
|
|
473
|
-
const client = await this.getClient();
|
|
474
|
-
try {
|
|
475
|
-
const result = await client.query(
|
|
476
|
-
`
|
|
477
|
-
INSERT INTO anchors (anchor_id, frame_id, project_id, type, text, priority, metadata)
|
|
478
|
-
VALUES (COALESCE($1::uuid, uuid_generate_v4()), $2, $3, $4, $5, $6, $7)
|
|
479
|
-
RETURNING anchor_id
|
|
480
|
-
`,
|
|
481
|
-
[
|
|
482
|
-
anchor.anchor_id || null,
|
|
483
|
-
anchor.frame_id,
|
|
484
|
-
anchor.project_id || this.projectId,
|
|
485
|
-
anchor.type,
|
|
486
|
-
anchor.text,
|
|
487
|
-
anchor.priority || 0,
|
|
488
|
-
JSON.stringify(anchor.metadata || {})
|
|
489
|
-
]
|
|
490
|
-
);
|
|
491
|
-
return result.rows[0].anchor_id;
|
|
492
|
-
} finally {
|
|
493
|
-
this.releaseClient(client);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
async getFrameAnchors(frameId) {
|
|
497
|
-
const client = await this.getClient();
|
|
498
|
-
try {
|
|
499
|
-
const result = await client.query(
|
|
500
|
-
`
|
|
501
|
-
SELECT * FROM anchors WHERE frame_id = $1
|
|
502
|
-
ORDER BY priority DESC, created_at ASC
|
|
503
|
-
`,
|
|
504
|
-
[frameId]
|
|
505
|
-
);
|
|
506
|
-
return result.rows.map((row) => ({
|
|
507
|
-
...row,
|
|
508
|
-
created_at: row.created_at.getTime()
|
|
509
|
-
}));
|
|
510
|
-
} finally {
|
|
511
|
-
this.releaseClient(client);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
async deleteFrameAnchors(frameId) {
|
|
515
|
-
const client = await this.getClient();
|
|
516
|
-
try {
|
|
517
|
-
await client.query("DELETE FROM anchors WHERE frame_id = $1", [frameId]);
|
|
518
|
-
} finally {
|
|
519
|
-
this.releaseClient(client);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
// Advanced search with BM25
|
|
523
|
-
async search(options) {
|
|
524
|
-
const client = await this.getClient();
|
|
525
|
-
try {
|
|
526
|
-
const config = this.config;
|
|
527
|
-
if (config.enableBM25 !== false) {
|
|
528
|
-
const result = await client.query(
|
|
529
|
-
`
|
|
530
|
-
SELECT f.*, s.score_bm25 as score
|
|
531
|
-
FROM frames_search_idx.search(
|
|
532
|
-
query => $1,
|
|
533
|
-
limit_rows => $2,
|
|
534
|
-
offset_rows => $3
|
|
535
|
-
) s
|
|
536
|
-
JOIN frames f ON f.frame_id = s.frame_id
|
|
537
|
-
WHERE ($4::float IS NULL OR s.score_bm25 >= $4)
|
|
538
|
-
ORDER BY s.score_bm25 DESC
|
|
539
|
-
`,
|
|
540
|
-
[
|
|
541
|
-
options.query,
|
|
542
|
-
options.limit || 100,
|
|
543
|
-
options.offset || 0,
|
|
544
|
-
options.scoreThreshold || null
|
|
545
|
-
]
|
|
546
|
-
);
|
|
547
|
-
return result.rows.map((row) => ({
|
|
548
|
-
...row,
|
|
549
|
-
created_at: row.created_at.getTime(),
|
|
550
|
-
closed_at: row.closed_at?.getTime()
|
|
551
|
-
}));
|
|
552
|
-
} else {
|
|
553
|
-
const result = await client.query(
|
|
554
|
-
`
|
|
555
|
-
SELECT *,
|
|
556
|
-
ts_rank(
|
|
557
|
-
to_tsvector('english', COALESCE(name, '') || ' ' || COALESCE(content, '')),
|
|
558
|
-
plainto_tsquery('english', $1)
|
|
559
|
-
) as score
|
|
560
|
-
FROM frames
|
|
561
|
-
WHERE to_tsvector('english', COALESCE(name, '') || ' ' || COALESCE(content, ''))
|
|
562
|
-
@@ plainto_tsquery('english', $1)
|
|
563
|
-
ORDER BY score DESC
|
|
564
|
-
LIMIT $2 OFFSET $3
|
|
565
|
-
`,
|
|
566
|
-
[options.query, options.limit || 100, options.offset || 0]
|
|
567
|
-
);
|
|
568
|
-
return result.rows.map((row) => ({
|
|
569
|
-
...row,
|
|
570
|
-
created_at: row.created_at.getTime(),
|
|
571
|
-
closed_at: row.closed_at?.getTime()
|
|
572
|
-
}));
|
|
573
|
-
}
|
|
574
|
-
} finally {
|
|
575
|
-
this.releaseClient(client);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
// Vector similarity search
|
|
579
|
-
async searchByVector(embedding, options) {
|
|
580
|
-
const client = await this.getClient();
|
|
581
|
-
try {
|
|
582
|
-
const config = this.config;
|
|
583
|
-
if (config.enableVector === false) {
|
|
584
|
-
logger.warn("Vector search not enabled in ParadeDB configuration");
|
|
585
|
-
return [];
|
|
586
|
-
}
|
|
587
|
-
const result = await client.query(
|
|
588
|
-
`
|
|
589
|
-
SELECT *,
|
|
590
|
-
1 - (embedding <=> $1::vector) as similarity
|
|
591
|
-
FROM frames
|
|
592
|
-
WHERE embedding IS NOT NULL
|
|
593
|
-
ORDER BY embedding <=> $1::vector
|
|
594
|
-
LIMIT $2 OFFSET $3
|
|
595
|
-
`,
|
|
596
|
-
[
|
|
597
|
-
`[${embedding.join(",")}]`,
|
|
598
|
-
options?.limit || 100,
|
|
599
|
-
options?.offset || 0
|
|
600
|
-
]
|
|
601
|
-
);
|
|
602
|
-
return result.rows.map((row) => ({
|
|
603
|
-
...row,
|
|
604
|
-
created_at: row.created_at.getTime(),
|
|
605
|
-
closed_at: row.closed_at?.getTime()
|
|
606
|
-
}));
|
|
607
|
-
} finally {
|
|
608
|
-
this.releaseClient(client);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
// Hybrid search combining BM25 and vector
|
|
612
|
-
async searchHybrid(textQuery, embedding, weights) {
|
|
613
|
-
const client = await this.getClient();
|
|
614
|
-
try {
|
|
615
|
-
const textWeight = weights?.text || 0.6;
|
|
616
|
-
const vectorWeight = weights?.vector || 0.4;
|
|
617
|
-
const result = await client.query(
|
|
618
|
-
`
|
|
619
|
-
WITH bm25_results AS (
|
|
620
|
-
SELECT frame_id, score_bm25
|
|
621
|
-
FROM frames_search_idx.search(
|
|
622
|
-
query => $1,
|
|
623
|
-
limit_rows => 200
|
|
624
|
-
)
|
|
625
|
-
),
|
|
626
|
-
vector_results AS (
|
|
627
|
-
SELECT frame_id,
|
|
628
|
-
1 - (embedding <=> $2::vector) as score_vector
|
|
629
|
-
FROM frames
|
|
630
|
-
WHERE embedding IS NOT NULL
|
|
631
|
-
ORDER BY embedding <=> $2::vector
|
|
632
|
-
LIMIT 200
|
|
633
|
-
)
|
|
634
|
-
SELECT f.*,
|
|
635
|
-
(COALESCE(b.score_bm25, 0) * $3 +
|
|
636
|
-
COALESCE(v.score_vector, 0) * $4) as score
|
|
637
|
-
FROM frames f
|
|
638
|
-
LEFT JOIN bm25_results b ON f.frame_id = b.frame_id
|
|
639
|
-
LEFT JOIN vector_results v ON f.frame_id = v.frame_id
|
|
640
|
-
WHERE b.frame_id IS NOT NULL OR v.frame_id IS NOT NULL
|
|
641
|
-
ORDER BY score DESC
|
|
642
|
-
LIMIT $5
|
|
643
|
-
`,
|
|
644
|
-
[textQuery, `[${embedding.join(",")}]`, textWeight, vectorWeight, 100]
|
|
645
|
-
);
|
|
646
|
-
return result.rows.map((row) => ({
|
|
647
|
-
...row,
|
|
648
|
-
created_at: row.created_at.getTime(),
|
|
649
|
-
closed_at: row.closed_at?.getTime()
|
|
650
|
-
}));
|
|
651
|
-
} finally {
|
|
652
|
-
this.releaseClient(client);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
// Advanced aggregation
|
|
656
|
-
async aggregate(table, options) {
|
|
657
|
-
const client = await this.getClient();
|
|
658
|
-
try {
|
|
659
|
-
const metrics = options.metrics.map((m) => {
|
|
660
|
-
const alias = m.alias || `${m.operation}_${m.field}`;
|
|
661
|
-
return `${m.operation}(${m.field}) AS "${alias}"`;
|
|
662
|
-
}).join(", ");
|
|
663
|
-
let query = `
|
|
664
|
-
SELECT ${options.groupBy.map((g) => `"${g}"`).join(", ")}, ${metrics}
|
|
665
|
-
FROM ${table}
|
|
666
|
-
GROUP BY ${options.groupBy.map((g) => `"${g}"`).join(", ")}
|
|
667
|
-
`;
|
|
668
|
-
if (options.having) {
|
|
669
|
-
const havingClauses = Object.entries(options.having).map(
|
|
670
|
-
([key, value], i) => {
|
|
671
|
-
return `${key} ${typeof value === "object" ? value.op : "="} $${i + 1}`;
|
|
672
|
-
}
|
|
673
|
-
);
|
|
674
|
-
query += ` HAVING ${havingClauses.join(" AND ")}`;
|
|
675
|
-
}
|
|
676
|
-
const result = await client.query(
|
|
677
|
-
query,
|
|
678
|
-
Object.values(options.having || {})
|
|
679
|
-
);
|
|
680
|
-
return result.rows;
|
|
681
|
-
} finally {
|
|
682
|
-
this.releaseClient(client);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
// Pattern detection with analytics
|
|
686
|
-
async detectPatterns(timeRange) {
|
|
687
|
-
const client = await this.getClient();
|
|
688
|
-
try {
|
|
689
|
-
const result = await client.query(
|
|
690
|
-
`
|
|
691
|
-
SELECT
|
|
692
|
-
COALESCE(error_pattern, pattern_type) as pattern,
|
|
693
|
-
pattern_type as type,
|
|
694
|
-
frequency,
|
|
695
|
-
last_seen
|
|
696
|
-
FROM pattern_summary
|
|
697
|
-
WHERE project_id = $1
|
|
698
|
-
AND ($2::timestamptz IS NULL OR last_seen >= $2)
|
|
699
|
-
AND ($3::timestamptz IS NULL OR first_seen <= $3)
|
|
700
|
-
ORDER BY frequency DESC, last_seen DESC
|
|
701
|
-
LIMIT 100
|
|
702
|
-
`,
|
|
703
|
-
[this.projectId, timeRange?.start || null, timeRange?.end || null]
|
|
704
|
-
);
|
|
705
|
-
return result.rows.map((row) => ({
|
|
706
|
-
pattern: row.pattern,
|
|
707
|
-
type: row.type,
|
|
708
|
-
frequency: row.frequency,
|
|
709
|
-
lastSeen: row.last_seen
|
|
710
|
-
}));
|
|
711
|
-
} finally {
|
|
712
|
-
this.releaseClient(client);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
// Bulk operations
|
|
716
|
-
async executeBulk(operations) {
|
|
717
|
-
await this.inTransaction(async () => {
|
|
718
|
-
const client = this.activeClient;
|
|
719
|
-
for (const op of operations) {
|
|
720
|
-
switch (op.type) {
|
|
721
|
-
case "insert": {
|
|
722
|
-
const cols = Object.keys(op.data);
|
|
723
|
-
const values = Object.values(op.data);
|
|
724
|
-
const placeholders = values.map((_, i) => `$${i + 1}`).join(",");
|
|
725
|
-
await client.query(
|
|
726
|
-
`INSERT INTO ${op.table} (${cols.join(",")}) VALUES (${placeholders})`,
|
|
727
|
-
values
|
|
728
|
-
);
|
|
729
|
-
break;
|
|
730
|
-
}
|
|
731
|
-
case "update": {
|
|
732
|
-
const sets = Object.keys(op.data).map((k, i) => `${k} = $${i + 1}`).join(",");
|
|
733
|
-
const whereClause = this.buildWhereClausePostgres(
|
|
734
|
-
op.where || {},
|
|
735
|
-
Object.keys(op.data).length
|
|
736
|
-
);
|
|
737
|
-
const values = [
|
|
738
|
-
...Object.values(op.data),
|
|
739
|
-
...Object.values(op.where || {})
|
|
740
|
-
];
|
|
741
|
-
await client.query(
|
|
742
|
-
`UPDATE ${op.table} SET ${sets} ${whereClause}`,
|
|
743
|
-
values
|
|
744
|
-
);
|
|
745
|
-
break;
|
|
746
|
-
}
|
|
747
|
-
case "delete": {
|
|
748
|
-
const whereClause = this.buildWhereClausePostgres(
|
|
749
|
-
op.where || {},
|
|
750
|
-
0
|
|
751
|
-
);
|
|
752
|
-
await client.query(
|
|
753
|
-
`DELETE FROM ${op.table} ${whereClause}`,
|
|
754
|
-
Object.values(op.where || {})
|
|
755
|
-
);
|
|
756
|
-
break;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
async vacuum() {
|
|
763
|
-
const client = await this.getClient();
|
|
764
|
-
try {
|
|
765
|
-
await client.query("VACUUM ANALYZE frames");
|
|
766
|
-
await client.query("VACUUM ANALYZE events");
|
|
767
|
-
await client.query("VACUUM ANALYZE anchors");
|
|
768
|
-
await client.query(
|
|
769
|
-
"REFRESH MATERIALIZED VIEW CONCURRENTLY pattern_summary"
|
|
770
|
-
);
|
|
771
|
-
logger.info("ParadeDB vacuum and analyze completed");
|
|
772
|
-
} finally {
|
|
773
|
-
this.releaseClient(client);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
async analyze() {
|
|
777
|
-
const client = await this.getClient();
|
|
778
|
-
try {
|
|
779
|
-
await client.query("ANALYZE frames");
|
|
780
|
-
await client.query("ANALYZE events");
|
|
781
|
-
await client.query("ANALYZE anchors");
|
|
782
|
-
logger.info("ParadeDB analyze completed");
|
|
783
|
-
} finally {
|
|
784
|
-
this.releaseClient(client);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
// Statistics
|
|
788
|
-
async getStats() {
|
|
789
|
-
const client = await this.getClient();
|
|
790
|
-
try {
|
|
791
|
-
const result = await client.query(`
|
|
792
|
-
SELECT
|
|
793
|
-
(SELECT COUNT(*) FROM frames) as total_frames,
|
|
794
|
-
(SELECT COUNT(*) FROM frames WHERE state = 'active') as active_frames,
|
|
795
|
-
(SELECT COUNT(*) FROM events) as total_events,
|
|
796
|
-
(SELECT COUNT(*) FROM anchors) as total_anchors,
|
|
797
|
-
pg_database_size(current_database()) as disk_usage
|
|
798
|
-
`);
|
|
799
|
-
return {
|
|
800
|
-
totalFrames: parseInt(result.rows[0].total_frames),
|
|
801
|
-
activeFrames: parseInt(result.rows[0].active_frames),
|
|
802
|
-
totalEvents: parseInt(result.rows[0].total_events),
|
|
803
|
-
totalAnchors: parseInt(result.rows[0].total_anchors),
|
|
804
|
-
diskUsage: parseInt(result.rows[0].disk_usage)
|
|
805
|
-
};
|
|
806
|
-
} finally {
|
|
807
|
-
this.releaseClient(client);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
async getQueryStats() {
|
|
811
|
-
const client = await this.getClient();
|
|
812
|
-
try {
|
|
813
|
-
const result = await client.query(`
|
|
814
|
-
SELECT
|
|
815
|
-
query,
|
|
816
|
-
calls,
|
|
817
|
-
mean_exec_time as mean_time,
|
|
818
|
-
total_exec_time as total_time
|
|
819
|
-
FROM pg_stat_statements
|
|
820
|
-
WHERE query NOT LIKE '%pg_stat_statements%'
|
|
821
|
-
ORDER BY total_exec_time DESC
|
|
822
|
-
LIMIT 100
|
|
823
|
-
`);
|
|
824
|
-
return result.rows.map((row) => ({
|
|
825
|
-
query: row.query,
|
|
826
|
-
calls: parseInt(row.calls),
|
|
827
|
-
meanTime: parseFloat(row.mean_time),
|
|
828
|
-
totalTime: parseFloat(row.total_time)
|
|
829
|
-
}));
|
|
830
|
-
} catch (error) {
|
|
831
|
-
logger.warn("pg_stat_statements not available", error);
|
|
832
|
-
return [];
|
|
833
|
-
} finally {
|
|
834
|
-
this.releaseClient(client);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
// Transaction support
|
|
838
|
-
async beginTransaction() {
|
|
839
|
-
this.activeClient = await this.pool.connect();
|
|
840
|
-
await this.activeClient.query("BEGIN");
|
|
841
|
-
}
|
|
842
|
-
async commitTransaction() {
|
|
843
|
-
if (!this.activeClient)
|
|
844
|
-
throw new DatabaseError(
|
|
845
|
-
"No active transaction",
|
|
846
|
-
ErrorCode.DB_TRANSACTION_FAILED
|
|
847
|
-
);
|
|
848
|
-
await this.activeClient.query("COMMIT");
|
|
849
|
-
this.activeClient.release();
|
|
850
|
-
this.activeClient = null;
|
|
851
|
-
}
|
|
852
|
-
async rollbackTransaction() {
|
|
853
|
-
if (!this.activeClient)
|
|
854
|
-
throw new DatabaseError(
|
|
855
|
-
"No active transaction",
|
|
856
|
-
ErrorCode.DB_TRANSACTION_FAILED
|
|
857
|
-
);
|
|
858
|
-
await this.activeClient.query("ROLLBACK");
|
|
859
|
-
this.activeClient.release();
|
|
860
|
-
this.activeClient = null;
|
|
861
|
-
}
|
|
862
|
-
async inTransaction(callback) {
|
|
863
|
-
await this.beginTransaction();
|
|
864
|
-
try {
|
|
865
|
-
await callback(this);
|
|
866
|
-
await this.commitTransaction();
|
|
867
|
-
} catch (error) {
|
|
868
|
-
try {
|
|
869
|
-
await this.rollbackTransaction();
|
|
870
|
-
} catch (rollbackError) {
|
|
871
|
-
console.error("Transaction rollback failed:", rollbackError);
|
|
872
|
-
if (this.connectionPool) {
|
|
873
|
-
this.connectionPool.markConnectionAsBad(this.client);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
throw error;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
// Export/Import
|
|
880
|
-
async exportData(tables, format) {
|
|
881
|
-
const client = await this.getClient();
|
|
882
|
-
try {
|
|
883
|
-
if (format === "json") {
|
|
884
|
-
const data = {};
|
|
885
|
-
for (const table of tables) {
|
|
886
|
-
const result = await client.query(`SELECT * FROM ${table}`);
|
|
887
|
-
data[table] = result.rows;
|
|
888
|
-
}
|
|
889
|
-
return Buffer.from(JSON.stringify(data, null, 2));
|
|
890
|
-
} else if (format === "csv") {
|
|
891
|
-
const chunks = [];
|
|
892
|
-
for (const table of tables) {
|
|
893
|
-
const result = await client.query(`
|
|
894
|
-
COPY (SELECT * FROM ${table}) TO STDOUT WITH CSV HEADER
|
|
895
|
-
`);
|
|
896
|
-
chunks.push(result.toString());
|
|
897
|
-
}
|
|
898
|
-
return Buffer.from(chunks.join("\n\n"));
|
|
899
|
-
} else {
|
|
900
|
-
throw new ValidationError(
|
|
901
|
-
`Format ${format} not yet implemented for ParadeDB export`,
|
|
902
|
-
ErrorCode.VALIDATION_FAILED,
|
|
903
|
-
{ format, supportedFormats: ["json"] }
|
|
904
|
-
);
|
|
905
|
-
}
|
|
906
|
-
} finally {
|
|
907
|
-
this.releaseClient(client);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
async importData(data, format, options) {
|
|
911
|
-
const client = await this.getClient();
|
|
912
|
-
try {
|
|
913
|
-
if (format === "json") {
|
|
914
|
-
const parsed = JSON.parse(data.toString());
|
|
915
|
-
await client.query("BEGIN");
|
|
916
|
-
for (const [table, rows] of Object.entries(parsed)) {
|
|
917
|
-
if (options?.truncate) {
|
|
918
|
-
await client.query(`TRUNCATE TABLE ${table} CASCADE`);
|
|
919
|
-
}
|
|
920
|
-
for (const row of rows) {
|
|
921
|
-
const cols = Object.keys(row);
|
|
922
|
-
const values = Object.values(row);
|
|
923
|
-
const placeholders = values.map((_, i) => `$${i + 1}`).join(",");
|
|
924
|
-
if (options?.upsert) {
|
|
925
|
-
const updates = cols.map((c) => `${c} = EXCLUDED.${c}`).join(",");
|
|
926
|
-
await client.query(
|
|
927
|
-
`INSERT INTO ${table} (${cols.join(",")}) VALUES (${placeholders})
|
|
928
|
-
ON CONFLICT DO UPDATE SET ${updates}`,
|
|
929
|
-
values
|
|
930
|
-
);
|
|
931
|
-
} else {
|
|
932
|
-
await client.query(
|
|
933
|
-
`INSERT INTO ${table} (${cols.join(",")}) VALUES (${placeholders})`,
|
|
934
|
-
values
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
await client.query("COMMIT");
|
|
940
|
-
} else {
|
|
941
|
-
throw new ValidationError(
|
|
942
|
-
`Format ${format} not yet implemented for ParadeDB import`,
|
|
943
|
-
ErrorCode.VALIDATION_FAILED,
|
|
944
|
-
{ format, supportedFormats: ["json"] }
|
|
945
|
-
);
|
|
946
|
-
}
|
|
947
|
-
} catch (error) {
|
|
948
|
-
await client.query("ROLLBACK");
|
|
949
|
-
throw error;
|
|
950
|
-
} finally {
|
|
951
|
-
this.releaseClient(client);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
// Helper methods
|
|
955
|
-
async getClient() {
|
|
956
|
-
if (this.activeClient) {
|
|
957
|
-
return this.activeClient;
|
|
958
|
-
}
|
|
959
|
-
if (!this.pool) {
|
|
960
|
-
throw new DatabaseError(
|
|
961
|
-
"Database not connected",
|
|
962
|
-
ErrorCode.DB_CONNECTION_FAILED
|
|
963
|
-
);
|
|
964
|
-
}
|
|
965
|
-
return await this.pool.connect();
|
|
966
|
-
}
|
|
967
|
-
releaseClient(client) {
|
|
968
|
-
if (client !== this.activeClient) {
|
|
969
|
-
client.release();
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
buildWhereClausePostgres(conditions, startParam) {
|
|
973
|
-
const clauses = Object.entries(conditions).map(([key, value], i) => {
|
|
974
|
-
const paramNum = startParam + i + 1;
|
|
975
|
-
if (value === null) {
|
|
976
|
-
return `${key} IS NULL`;
|
|
977
|
-
} else if (Array.isArray(value)) {
|
|
978
|
-
const placeholders = value.map((_, j) => `$${paramNum + j}`).join(",");
|
|
979
|
-
return `${key} IN (${placeholders})`;
|
|
980
|
-
} else {
|
|
981
|
-
return `${key} = $${paramNum}`;
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
return clauses.length > 0 ? `WHERE ${clauses.join(" AND ")}` : "";
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
export {
|
|
988
|
-
ParadeDBAdapter
|
|
989
|
-
};
|
|
990
|
-
//# sourceMappingURL=paradedb-adapter.js.map
|