specmem-hardwicksoftware 3.5.99
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/CHANGELOG.md +299 -0
- package/LICENSE.md +6406 -0
- package/README.md +539 -0
- package/bin/AegisTheme.cjs +1022 -0
- package/bin/AnsiRenderer.cjs +1055 -0
- package/bin/BoxRenderer.cjs +605 -0
- package/bin/ClaudeLiveScreen.cjs +1299 -0
- package/bin/DashboardModules.cjs +733 -0
- package/bin/LiveScreenCapture.cjs +1012 -0
- package/bin/MemoryBrowserScreen.cjs +1595 -0
- package/bin/TabManager.cjs +1414 -0
- package/bin/checkAgentStatus-fix.patch +30 -0
- package/bin/mcp-socket-client.cjs +462 -0
- package/bin/screen-utils.cjs +106 -0
- package/bin/specmem-autoclaude.cjs +663 -0
- package/bin/specmem-cleanup.cjs +421 -0
- package/bin/specmem-cli.cjs +794 -0
- package/bin/specmem-console-teamcomms-class.cjs +428 -0
- package/bin/specmem-console.cjs +8104 -0
- package/bin/specmem-statusbar.cjs +530 -0
- package/bootstrap.cjs +5065 -0
- package/claude-hooks/agent-chooser-hook.js +179 -0
- package/claude-hooks/agent-chooser-inject.js +121 -0
- package/claude-hooks/agent-loading-hook.js +990 -0
- package/claude-hooks/agent-output-fader.cjs +542 -0
- package/claude-hooks/agent-output-interceptor.js +193 -0
- package/claude-hooks/agent-type-matcher.js +419 -0
- package/claude-hooks/auto-bypass.py +74 -0
- package/claude-hooks/background-completion-silencer.js +134 -0
- package/claude-hooks/bash-auto-background.js +182 -0
- package/claude-hooks/build-cedict-dictionary.mjs +167 -0
- package/claude-hooks/bullshit-radar.cjs +323 -0
- package/claude-hooks/cedict-codes.json +270 -0
- package/claude-hooks/cedict-extracted.json +22632 -0
- package/claude-hooks/claude-watchdog.sh +401 -0
- package/claude-hooks/context-dedup.cjs +144 -0
- package/claude-hooks/context-yeeter.cjs +244 -0
- package/claude-hooks/debug-suffix.cjs +15 -0
- package/claude-hooks/debug2.cjs +7 -0
- package/claude-hooks/drilldown-enforcer.js +242 -0
- package/claude-hooks/english-morphology-standalone.cjs +149 -0
- package/claude-hooks/english-morphology.cjs +152 -0
- package/claude-hooks/extract-translations.mjs +193 -0
- package/claude-hooks/file-claim-enforcer.cjs +293 -0
- package/claude-hooks/file-claim-enforcer.js +293 -0
- package/claude-hooks/find-collisions.cjs +39 -0
- package/claude-hooks/fix-abbreviations.cjs +60 -0
- package/claude-hooks/fix-collisions.cjs +60 -0
- package/claude-hooks/fix-decompressor.cjs +79 -0
- package/claude-hooks/fix-suffixes.cjs +66 -0
- package/claude-hooks/grammar-engine.cjs +159 -0
- package/claude-hooks/input-aware-improver.js +231 -0
- package/claude-hooks/is-agent.cjs +64 -0
- package/claude-hooks/mega-test.cjs +213 -0
- package/claude-hooks/merge-dictionaries.mjs +207 -0
- package/claude-hooks/merged-codes.cjs +22675 -0
- package/claude-hooks/merged-codes.json +22676 -0
- package/claude-hooks/output-cleaner.cjs +388 -0
- package/claude-hooks/post-write-memory-hook.cjs +430 -0
- package/claude-hooks/quick-test.cjs +24 -0
- package/claude-hooks/quick-test2.cjs +24 -0
- package/claude-hooks/remove-bad-codes.cjs +23 -0
- package/claude-hooks/search-reminder-hook.js +90 -0
- package/claude-hooks/semantic-test.cjs +93 -0
- package/claude-hooks/settings.json +445 -0
- package/claude-hooks/smart-context-hook.cjs +547 -0
- package/claude-hooks/smart-context-hook.js +539 -0
- package/claude-hooks/smart-search-interceptor.js +364 -0
- package/claude-hooks/socket-connect-helper.cjs +235 -0
- package/claude-hooks/specmem/sockets/session-start.lock +1 -0
- package/claude-hooks/specmem-context-hook.cjs +357 -0
- package/claude-hooks/specmem-context-hook.js +357 -0
- package/claude-hooks/specmem-drilldown-hook.cjs +480 -0
- package/claude-hooks/specmem-drilldown-hook.js +480 -0
- package/claude-hooks/specmem-drilldown-setter.js +210 -0
- package/claude-hooks/specmem-paths.cjs +213 -0
- package/claude-hooks/specmem-precompact.js +183 -0
- package/claude-hooks/specmem-session-init.sh +33 -0
- package/claude-hooks/specmem-session-start.cjs +498 -0
- package/claude-hooks/specmem-stop-hook.cjs +73 -0
- package/claude-hooks/specmem-stop-hook.js +5 -0
- package/claude-hooks/specmem-team-comms.cjs +434 -0
- package/claude-hooks/specmem-team-member-inject.js +271 -0
- package/claude-hooks/specmem-unified-hook.py +670 -0
- package/claude-hooks/subagent-loading-hook.js +194 -0
- package/claude-hooks/sysprompt-squisher.cjs +167 -0
- package/claude-hooks/task-progress-hook.js +204 -0
- package/claude-hooks/team-comms-enforcer.cjs +585 -0
- package/claude-hooks/test-accuracy.cjs +27 -0
- package/claude-hooks/test-big.cjs +28 -0
- package/claude-hooks/test-inflectors.cjs +39 -0
- package/claude-hooks/test-pluralize.cjs +37 -0
- package/claude-hooks/test-quick.cjs +8 -0
- package/claude-hooks/test-wink.cjs +20 -0
- package/claude-hooks/token-compressor.cjs +940 -0
- package/claude-hooks/use-code-pointers.cjs +279 -0
- package/commands/COMMAND_TOOL_MAP.md +299 -0
- package/commands/specmem-agents.md +412 -0
- package/commands/specmem-autoclaude.md +295 -0
- package/commands/specmem-changes.md +247 -0
- package/commands/specmem-code.md +103 -0
- package/commands/specmem-configteammembercomms.md +322 -0
- package/commands/specmem-drilldown.md +208 -0
- package/commands/specmem-find.md +195 -0
- package/commands/specmem-getdashboard.md +243 -0
- package/commands/specmem-hooks.md +219 -0
- package/commands/specmem-pointers.md +149 -0
- package/commands/specmem-progress.md +287 -0
- package/commands/specmem-remember.md +123 -0
- package/commands/specmem-service.md +349 -0
- package/commands/specmem-stats.md +189 -0
- package/commands/specmem-team-member.md +409 -0
- package/commands/specmem-webdev.md +583 -0
- package/commands/specmem.md +363 -0
- package/dist/autoStart/index.d.ts +214 -0
- package/dist/autoStart/index.d.ts.map +1 -0
- package/dist/autoStart/index.js +883 -0
- package/dist/autoStart/index.js.map +1 -0
- package/dist/claude-sessions/contextRestorationParser.d.ts +74 -0
- package/dist/claude-sessions/contextRestorationParser.d.ts.map +1 -0
- package/dist/claude-sessions/contextRestorationParser.js +570 -0
- package/dist/claude-sessions/contextRestorationParser.js.map +1 -0
- package/dist/claude-sessions/index.d.ts +13 -0
- package/dist/claude-sessions/index.d.ts.map +1 -0
- package/dist/claude-sessions/index.js +11 -0
- package/dist/claude-sessions/index.js.map +1 -0
- package/dist/claude-sessions/sessionIntegration.d.ts +48 -0
- package/dist/claude-sessions/sessionIntegration.d.ts.map +1 -0
- package/dist/claude-sessions/sessionIntegration.js +146 -0
- package/dist/claude-sessions/sessionIntegration.js.map +1 -0
- package/dist/claude-sessions/sessionParser.d.ts +293 -0
- package/dist/claude-sessions/sessionParser.d.ts.map +1 -0
- package/dist/claude-sessions/sessionParser.js +1028 -0
- package/dist/claude-sessions/sessionParser.js.map +1 -0
- package/dist/claude-sessions/sessionWatcher.d.ts +139 -0
- package/dist/claude-sessions/sessionWatcher.d.ts.map +1 -0
- package/dist/claude-sessions/sessionWatcher.js +722 -0
- package/dist/claude-sessions/sessionWatcher.js.map +1 -0
- package/dist/cli/deploy-to-claude.d.ts +56 -0
- package/dist/cli/deploy-to-claude.d.ts.map +1 -0
- package/dist/cli/deploy-to-claude.js +576 -0
- package/dist/cli/deploy-to-claude.js.map +1 -0
- package/dist/code-explanations/explainCode.d.ts +86 -0
- package/dist/code-explanations/explainCode.d.ts.map +1 -0
- package/dist/code-explanations/explainCode.js +286 -0
- package/dist/code-explanations/explainCode.js.map +1 -0
- package/dist/code-explanations/feedback.d.ts +87 -0
- package/dist/code-explanations/feedback.d.ts.map +1 -0
- package/dist/code-explanations/feedback.js +212 -0
- package/dist/code-explanations/feedback.js.map +1 -0
- package/dist/code-explanations/getRelatedCode.d.ts +80 -0
- package/dist/code-explanations/getRelatedCode.d.ts.map +1 -0
- package/dist/code-explanations/getRelatedCode.js +262 -0
- package/dist/code-explanations/getRelatedCode.js.map +1 -0
- package/dist/code-explanations/index.d.ts +284 -0
- package/dist/code-explanations/index.d.ts.map +1 -0
- package/dist/code-explanations/index.js +249 -0
- package/dist/code-explanations/index.js.map +1 -0
- package/dist/code-explanations/linkCodeToPrompt.d.ts +79 -0
- package/dist/code-explanations/linkCodeToPrompt.d.ts.map +1 -0
- package/dist/code-explanations/linkCodeToPrompt.js +213 -0
- package/dist/code-explanations/linkCodeToPrompt.js.map +1 -0
- package/dist/code-explanations/recallExplanation.d.ts +88 -0
- package/dist/code-explanations/recallExplanation.d.ts.map +1 -0
- package/dist/code-explanations/recallExplanation.js +218 -0
- package/dist/code-explanations/recallExplanation.js.map +1 -0
- package/dist/code-explanations/schema.d.ts +32 -0
- package/dist/code-explanations/schema.d.ts.map +1 -0
- package/dist/code-explanations/schema.js +221 -0
- package/dist/code-explanations/schema.js.map +1 -0
- package/dist/code-explanations/semanticSearch.d.ts +75 -0
- package/dist/code-explanations/semanticSearch.d.ts.map +1 -0
- package/dist/code-explanations/semanticSearch.js +203 -0
- package/dist/code-explanations/semanticSearch.js.map +1 -0
- package/dist/code-explanations/types.d.ts +328 -0
- package/dist/code-explanations/types.d.ts.map +1 -0
- package/dist/code-explanations/types.js +122 -0
- package/dist/code-explanations/types.js.map +1 -0
- package/dist/codebase/codeAnalyzer.d.ts +272 -0
- package/dist/codebase/codeAnalyzer.d.ts.map +1 -0
- package/dist/codebase/codeAnalyzer.js +1353 -0
- package/dist/codebase/codeAnalyzer.js.map +1 -0
- package/dist/codebase/codebaseIndexer.d.ts +360 -0
- package/dist/codebase/codebaseIndexer.d.ts.map +1 -0
- package/dist/codebase/codebaseIndexer.js +1735 -0
- package/dist/codebase/codebaseIndexer.js.map +1 -0
- package/dist/codebase/codebaseTools.d.ts +853 -0
- package/dist/codebase/codebaseTools.d.ts.map +1 -0
- package/dist/codebase/codebaseTools.js +1279 -0
- package/dist/codebase/codebaseTools.js.map +1 -0
- package/dist/codebase/exclusions.d.ts +111 -0
- package/dist/codebase/exclusions.d.ts.map +1 -0
- package/dist/codebase/exclusions.js +771 -0
- package/dist/codebase/exclusions.js.map +1 -0
- package/dist/codebase/fileWatcher.d.ts +135 -0
- package/dist/codebase/fileWatcher.d.ts.map +1 -0
- package/dist/codebase/fileWatcher.js +309 -0
- package/dist/codebase/fileWatcher.js.map +1 -0
- package/dist/codebase/index.d.ts +33 -0
- package/dist/codebase/index.d.ts.map +1 -0
- package/dist/codebase/index.js +77 -0
- package/dist/codebase/index.js.map +1 -0
- package/dist/codebase/ingestion.d.ts +177 -0
- package/dist/codebase/ingestion.d.ts.map +1 -0
- package/dist/codebase/ingestion.js +690 -0
- package/dist/codebase/ingestion.js.map +1 -0
- package/dist/codebase/languageDetection.d.ts +75 -0
- package/dist/codebase/languageDetection.d.ts.map +1 -0
- package/dist/codebase/languageDetection.js +768 -0
- package/dist/codebase/languageDetection.js.map +1 -0
- package/dist/commands/codebaseCommands.d.ts +101 -0
- package/dist/commands/codebaseCommands.d.ts.map +1 -0
- package/dist/commands/codebaseCommands.js +911 -0
- package/dist/commands/codebaseCommands.js.map +1 -0
- package/dist/commands/commandHandler.d.ts +126 -0
- package/dist/commands/commandHandler.d.ts.map +1 -0
- package/dist/commands/commandHandler.js +296 -0
- package/dist/commands/commandHandler.js.map +1 -0
- package/dist/commands/commandLoader.d.ts +103 -0
- package/dist/commands/commandLoader.d.ts.map +1 -0
- package/dist/commands/commandLoader.js +223 -0
- package/dist/commands/commandLoader.js.map +1 -0
- package/dist/commands/contextCommands.d.ts +83 -0
- package/dist/commands/contextCommands.d.ts.map +1 -0
- package/dist/commands/contextCommands.js +512 -0
- package/dist/commands/contextCommands.js.map +1 -0
- package/dist/commands/index.d.ts +24 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +28 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/mcpResources.d.ts +50 -0
- package/dist/commands/mcpResources.d.ts.map +1 -0
- package/dist/commands/mcpResources.js +372 -0
- package/dist/commands/mcpResources.js.map +1 -0
- package/dist/commands/memoryCommands.d.ts +74 -0
- package/dist/commands/memoryCommands.d.ts.map +1 -0
- package/dist/commands/memoryCommands.js +609 -0
- package/dist/commands/memoryCommands.js.map +1 -0
- package/dist/commands/promptCommands.d.ts +91 -0
- package/dist/commands/promptCommands.d.ts.map +1 -0
- package/dist/commands/promptCommands.js +801 -0
- package/dist/commands/promptCommands.js.map +1 -0
- package/dist/commands/teamMemberCommands.d.ts +21 -0
- package/dist/commands/teamMemberCommands.d.ts.map +1 -0
- package/dist/commands/teamMemberCommands.js +137 -0
- package/dist/commands/teamMemberCommands.js.map +1 -0
- package/dist/comms/fileCommsTransport.d.ts +91 -0
- package/dist/comms/fileCommsTransport.d.ts.map +1 -0
- package/dist/comms/fileCommsTransport.js +244 -0
- package/dist/comms/fileCommsTransport.js.map +1 -0
- package/dist/comms/index.d.ts +7 -0
- package/dist/comms/index.d.ts.map +1 -0
- package/dist/comms/index.js +7 -0
- package/dist/comms/index.js.map +1 -0
- package/dist/config/apiKeyDetection.d.ts +41 -0
- package/dist/config/apiKeyDetection.d.ts.map +1 -0
- package/dist/config/apiKeyDetection.js +211 -0
- package/dist/config/apiKeyDetection.js.map +1 -0
- package/dist/config/autoConfig.d.ts +188 -0
- package/dist/config/autoConfig.d.ts.map +1 -0
- package/dist/config/autoConfig.js +850 -0
- package/dist/config/autoConfig.js.map +1 -0
- package/dist/config/configSync.d.ts +119 -0
- package/dist/config/configSync.d.ts.map +1 -0
- package/dist/config/configSync.js +878 -0
- package/dist/config/configSync.js.map +1 -0
- package/dist/config/embeddingTimeouts.d.ts +145 -0
- package/dist/config/embeddingTimeouts.d.ts.map +1 -0
- package/dist/config/embeddingTimeouts.js +255 -0
- package/dist/config/embeddingTimeouts.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/languageConfig.d.ts +68 -0
- package/dist/config/languageConfig.d.ts.map +1 -0
- package/dist/config/languageConfig.js +473 -0
- package/dist/config/languageConfig.js.map +1 -0
- package/dist/config/password.d.ts +145 -0
- package/dist/config/password.d.ts.map +1 -0
- package/dist/config/password.js +428 -0
- package/dist/config/password.js.map +1 -0
- package/dist/config.d.ts +338 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1177 -0
- package/dist/config.js.map +1 -0
- package/dist/consolidation.d.ts +44 -0
- package/dist/consolidation.d.ts.map +1 -0
- package/dist/consolidation.js +447 -0
- package/dist/consolidation.js.map +1 -0
- package/dist/constants.d.ts +371 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +552 -0
- package/dist/constants.js.map +1 -0
- package/dist/coordination/TeamMemberRegistry.d.ts +192 -0
- package/dist/coordination/TeamMemberRegistry.d.ts.map +1 -0
- package/dist/coordination/TeamMemberRegistry.js +415 -0
- package/dist/coordination/TeamMemberRegistry.js.map +1 -0
- package/dist/coordination/events.d.ts +369 -0
- package/dist/coordination/events.d.ts.map +1 -0
- package/dist/coordination/events.js +232 -0
- package/dist/coordination/events.js.map +1 -0
- package/dist/coordination/handlers.d.ts +116 -0
- package/dist/coordination/handlers.d.ts.map +1 -0
- package/dist/coordination/handlers.js +400 -0
- package/dist/coordination/handlers.js.map +1 -0
- package/dist/coordination/index.d.ts +14 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +31 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/integration.d.ts +260 -0
- package/dist/coordination/integration.d.ts.map +1 -0
- package/dist/coordination/integration.js +472 -0
- package/dist/coordination/integration.js.map +1 -0
- package/dist/coordination/server.d.ts +266 -0
- package/dist/coordination/server.d.ts.map +1 -0
- package/dist/coordination/server.js +995 -0
- package/dist/coordination/server.js.map +1 -0
- package/dist/coordination/serviceProvider.d.ts +70 -0
- package/dist/coordination/serviceProvider.d.ts.map +1 -0
- package/dist/coordination/serviceProvider.js +273 -0
- package/dist/coordination/serviceProvider.js.map +1 -0
- package/dist/dashboard/api/claudeControl.d.ts +44 -0
- package/dist/dashboard/api/claudeControl.d.ts.map +1 -0
- package/dist/dashboard/api/claudeControl.js +650 -0
- package/dist/dashboard/api/claudeControl.js.map +1 -0
- package/dist/dashboard/api/claudeHistory.d.ts +4 -0
- package/dist/dashboard/api/claudeHistory.d.ts.map +1 -0
- package/dist/dashboard/api/claudeHistory.js +319 -0
- package/dist/dashboard/api/claudeHistory.js.map +1 -0
- package/dist/dashboard/api/dataExport.d.ts +23 -0
- package/dist/dashboard/api/dataExport.d.ts.map +1 -0
- package/dist/dashboard/api/dataExport.js +509 -0
- package/dist/dashboard/api/dataExport.js.map +1 -0
- package/dist/dashboard/api/fileManager.d.ts +39 -0
- package/dist/dashboard/api/fileManager.d.ts.map +1 -0
- package/dist/dashboard/api/fileManager.js +814 -0
- package/dist/dashboard/api/fileManager.js.map +1 -0
- package/dist/dashboard/api/hooks.d.ts +16 -0
- package/dist/dashboard/api/hooks.d.ts.map +1 -0
- package/dist/dashboard/api/hooks.js +342 -0
- package/dist/dashboard/api/hooks.js.map +1 -0
- package/dist/dashboard/api/hotReload.d.ts +14 -0
- package/dist/dashboard/api/hotReload.d.ts.map +1 -0
- package/dist/dashboard/api/hotReload.js +219 -0
- package/dist/dashboard/api/hotReload.js.map +1 -0
- package/dist/dashboard/api/liveSessionStream.d.ts +19 -0
- package/dist/dashboard/api/liveSessionStream.d.ts.map +1 -0
- package/dist/dashboard/api/liveSessionStream.js +430 -0
- package/dist/dashboard/api/liveSessionStream.js.map +1 -0
- package/dist/dashboard/api/memoryRecall.d.ts +20 -0
- package/dist/dashboard/api/memoryRecall.d.ts.map +1 -0
- package/dist/dashboard/api/memoryRecall.js +524 -0
- package/dist/dashboard/api/memoryRecall.js.map +1 -0
- package/dist/dashboard/api/promptSend.d.ts +33 -0
- package/dist/dashboard/api/promptSend.d.ts.map +1 -0
- package/dist/dashboard/api/promptSend.js +544 -0
- package/dist/dashboard/api/promptSend.js.map +1 -0
- package/dist/dashboard/api/settings.d.ts +10 -0
- package/dist/dashboard/api/settings.d.ts.map +1 -0
- package/dist/dashboard/api/settings.js +656 -0
- package/dist/dashboard/api/settings.js.map +1 -0
- package/dist/dashboard/api/setup.d.ts +21 -0
- package/dist/dashboard/api/setup.d.ts.map +1 -0
- package/dist/dashboard/api/setup.js +663 -0
- package/dist/dashboard/api/setup.js.map +1 -0
- package/dist/dashboard/api/specmemTools.d.ts +14 -0
- package/dist/dashboard/api/specmemTools.d.ts.map +1 -0
- package/dist/dashboard/api/specmemTools.js +1059 -0
- package/dist/dashboard/api/specmemTools.js.map +1 -0
- package/dist/dashboard/api/taskTeamMembers.d.ts +8 -0
- package/dist/dashboard/api/taskTeamMembers.d.ts.map +1 -0
- package/dist/dashboard/api/taskTeamMembers.js +136 -0
- package/dist/dashboard/api/taskTeamMembers.js.map +1 -0
- package/dist/dashboard/api/teamMemberDeploy.d.ts +15 -0
- package/dist/dashboard/api/teamMemberDeploy.d.ts.map +1 -0
- package/dist/dashboard/api/teamMemberDeploy.js +421 -0
- package/dist/dashboard/api/teamMemberDeploy.js.map +1 -0
- package/dist/dashboard/api/teamMemberHistory.d.ts +38 -0
- package/dist/dashboard/api/teamMemberHistory.d.ts.map +1 -0
- package/dist/dashboard/api/teamMemberHistory.js +583 -0
- package/dist/dashboard/api/teamMemberHistory.js.map +1 -0
- package/dist/dashboard/api/terminal.d.ts +12 -0
- package/dist/dashboard/api/terminal.d.ts.map +1 -0
- package/dist/dashboard/api/terminal.js +344 -0
- package/dist/dashboard/api/terminal.js.map +1 -0
- package/dist/dashboard/api/terminalInject.d.ts +17 -0
- package/dist/dashboard/api/terminalInject.d.ts.map +1 -0
- package/dist/dashboard/api/terminalInject.js +322 -0
- package/dist/dashboard/api/terminalInject.js.map +1 -0
- package/dist/dashboard/api/terminalStream.d.ts +12 -0
- package/dist/dashboard/api/terminalStream.d.ts.map +1 -0
- package/dist/dashboard/api/terminalStream.js +482 -0
- package/dist/dashboard/api/terminalStream.js.map +1 -0
- package/dist/dashboard/index.d.ts +7 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +7 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/dashboard/ptyStreamer.d.ts +173 -0
- package/dist/dashboard/ptyStreamer.d.ts.map +1 -0
- package/dist/dashboard/ptyStreamer.js +661 -0
- package/dist/dashboard/ptyStreamer.js.map +1 -0
- package/dist/dashboard/public/DASHBOARD-README.md +378 -0
- package/dist/dashboard/public/INTEGRATION-GUIDE.md +395 -0
- package/dist/dashboard/public/codebase-config.html +1247 -0
- package/dist/dashboard/public/dashboard-v2.html +1942 -0
- package/dist/dashboard/public/data-export.html +819 -0
- package/dist/dashboard/public/example-page.html +164 -0
- package/dist/dashboard/public/file-explorer.html +1023 -0
- package/dist/dashboard/public/hooks.html +1103 -0
- package/dist/dashboard/public/index-improvements.css +499 -0
- package/dist/dashboard/public/index.html +5534 -0
- package/dist/dashboard/public/memory-controls.html +1959 -0
- package/dist/dashboard/public/memory-recall.html +1495 -0
- package/dist/dashboard/public/previews/skeleton-memory-graph.html +361 -0
- package/dist/dashboard/public/previews/skeleton-memory-list.html +366 -0
- package/dist/dashboard/public/previews/skeleton-search-results.html +609 -0
- package/dist/dashboard/public/previews/skeleton-stats-dashboard.html +556 -0
- package/dist/dashboard/public/prompt-console.html +2763 -0
- package/dist/dashboard/public/react-dist/assets/index-CkjobT5B.js +871 -0
- package/dist/dashboard/public/react-dist/assets/index-iRclxMst.css +1 -0
- package/dist/dashboard/public/react-dist/index.html +16 -0
- package/dist/dashboard/public/shared-header.js +325 -0
- package/dist/dashboard/public/shared-language-selector.js +626 -0
- package/dist/dashboard/public/shared-logger.js +66 -0
- package/dist/dashboard/public/shared-nav.js +325 -0
- package/dist/dashboard/public/shared-theme-blue.css +331 -0
- package/dist/dashboard/public/shared-theme.css +813 -0
- package/dist/dashboard/public/shared-toast.js +415 -0
- package/dist/dashboard/public/team-member-history.html +1291 -0
- package/dist/dashboard/public/team-member-spy.html +1199 -0
- package/dist/dashboard/public/team-members.html +3756 -0
- package/dist/dashboard/public/terminal-output.html +1013 -0
- package/dist/dashboard/public/terminal.html +372 -0
- package/dist/dashboard/sessionStore.d.ts +86 -0
- package/dist/dashboard/sessionStore.d.ts.map +1 -0
- package/dist/dashboard/sessionStore.js +262 -0
- package/dist/dashboard/sessionStore.js.map +1 -0
- package/dist/dashboard/standalone.d.ts +27 -0
- package/dist/dashboard/standalone.d.ts.map +1 -0
- package/dist/dashboard/standalone.js +380 -0
- package/dist/dashboard/standalone.js.map +1 -0
- package/dist/dashboard/webServer.d.ts +390 -0
- package/dist/dashboard/webServer.d.ts.map +1 -0
- package/dist/dashboard/webServer.js +4297 -0
- package/dist/dashboard/webServer.js.map +1 -0
- package/dist/dashboard/websocket/teamMemberStream.d.ts +87 -0
- package/dist/dashboard/websocket/teamMemberStream.d.ts.map +1 -0
- package/dist/dashboard/websocket/teamMemberStream.js +366 -0
- package/dist/dashboard/websocket/teamMemberStream.js.map +1 -0
- package/dist/dashboard/websocket/terminalStream.d.ts +130 -0
- package/dist/dashboard/websocket/terminalStream.d.ts.map +1 -0
- package/dist/dashboard/websocket/terminalStream.js +456 -0
- package/dist/dashboard/websocket/terminalStream.js.map +1 -0
- package/dist/database/embeddedPostgres.d.ts +187 -0
- package/dist/database/embeddedPostgres.d.ts.map +1 -0
- package/dist/database/embeddedPostgres.js +763 -0
- package/dist/database/embeddedPostgres.js.map +1 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +20 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/initEmbeddedPostgres.d.ts +124 -0
- package/dist/database/initEmbeddedPostgres.d.ts.map +1 -0
- package/dist/database/initEmbeddedPostgres.js +855 -0
- package/dist/database/initEmbeddedPostgres.js.map +1 -0
- package/dist/database.d.ts +256 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +1209 -0
- package/dist/database.js.map +1 -0
- package/dist/db/apiDataManager.d.ts +334 -0
- package/dist/db/apiDataManager.d.ts.map +1 -0
- package/dist/db/apiDataManager.js +631 -0
- package/dist/db/apiDataManager.js.map +1 -0
- package/dist/db/batchOperations.d.ts +154 -0
- package/dist/db/batchOperations.d.ts.map +1 -0
- package/dist/db/batchOperations.js +564 -0
- package/dist/db/batchOperations.js.map +1 -0
- package/dist/db/bigBrainMigrations.d.ts +48 -0
- package/dist/db/bigBrainMigrations.d.ts.map +1 -0
- package/dist/db/bigBrainMigrations.js +4266 -0
- package/dist/db/bigBrainMigrations.js.map +1 -0
- package/dist/db/connectionPoolGoBrrr.d.ts +94 -0
- package/dist/db/connectionPoolGoBrrr.d.ts.map +1 -0
- package/dist/db/connectionPoolGoBrrr.js +548 -0
- package/dist/db/connectionPoolGoBrrr.js.map +1 -0
- package/dist/db/dashboardQueries.d.ts +182 -0
- package/dist/db/dashboardQueries.d.ts.map +1 -0
- package/dist/db/dashboardQueries.js +821 -0
- package/dist/db/dashboardQueries.js.map +1 -0
- package/dist/db/deploymentBootstrap.d.ts +43 -0
- package/dist/db/deploymentBootstrap.d.ts.map +1 -0
- package/dist/db/deploymentBootstrap.js +329 -0
- package/dist/db/deploymentBootstrap.js.map +1 -0
- package/dist/db/dimensionService.d.ts +140 -0
- package/dist/db/dimensionService.d.ts.map +1 -0
- package/dist/db/dimensionService.js +261 -0
- package/dist/db/dimensionService.js.map +1 -0
- package/dist/db/embeddingOverflow.d.ts +69 -0
- package/dist/db/embeddingOverflow.d.ts.map +1 -0
- package/dist/db/embeddingOverflow.js +332 -0
- package/dist/db/embeddingOverflow.js.map +1 -0
- package/dist/db/embeddingOverflow.sql +221 -0
- package/dist/db/findThatShit.d.ts +145 -0
- package/dist/db/findThatShit.d.ts.map +1 -0
- package/dist/db/findThatShit.js +782 -0
- package/dist/db/findThatShit.js.map +1 -0
- package/dist/db/hotPathManager.d.ts +187 -0
- package/dist/db/hotPathManager.d.ts.map +1 -0
- package/dist/db/hotPathManager.js +504 -0
- package/dist/db/hotPathManager.js.map +1 -0
- package/dist/db/index.d.ts +85 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +219 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/memoryDrilldown.sql +99 -0
- package/dist/db/migrate.d.ts +3 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +97 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/migrateJsonToPostgres.d.ts +43 -0
- package/dist/db/migrateJsonToPostgres.d.ts.map +1 -0
- package/dist/db/migrateJsonToPostgres.js +465 -0
- package/dist/db/migrateJsonToPostgres.js.map +1 -0
- package/dist/db/nukeFromOrbit.d.ts +63 -0
- package/dist/db/nukeFromOrbit.d.ts.map +1 -0
- package/dist/db/nukeFromOrbit.js +499 -0
- package/dist/db/nukeFromOrbit.js.map +1 -0
- package/dist/db/processedTraining.sql +60 -0
- package/dist/db/projectNamespacing.d.ts +258 -0
- package/dist/db/projectNamespacing.d.ts.map +1 -0
- package/dist/db/projectNamespacing.js +920 -0
- package/dist/db/projectNamespacing.js.map +1 -0
- package/dist/db/projectNamespacing.sql +374 -0
- package/dist/db/projectSchemaInit.sql +271 -0
- package/dist/db/spatialMemory.d.ts +296 -0
- package/dist/db/spatialMemory.d.ts.map +1 -0
- package/dist/db/spatialMemory.js +818 -0
- package/dist/db/spatialMemory.js.map +1 -0
- package/dist/db/streamingQuery.d.ts +143 -0
- package/dist/db/streamingQuery.d.ts.map +1 -0
- package/dist/db/streamingQuery.js +350 -0
- package/dist/db/streamingQuery.js.map +1 -0
- package/dist/db/teamComms.sql +224 -0
- package/dist/db/yeetStuffInDb.d.ts +72 -0
- package/dist/db/yeetStuffInDb.d.ts.map +1 -0
- package/dist/db/yeetStuffInDb.js +473 -0
- package/dist/db/yeetStuffInDb.js.map +1 -0
- package/dist/embedding-providers/index.d.ts +10 -0
- package/dist/embedding-providers/index.d.ts.map +1 -0
- package/dist/embedding-providers/index.js +12 -0
- package/dist/embedding-providers/index.js.map +1 -0
- package/dist/embeddings/projectionLayer.d.ts +114 -0
- package/dist/embeddings/projectionLayer.d.ts.map +1 -0
- package/dist/embeddings/projectionLayer.js +345 -0
- package/dist/embeddings/projectionLayer.js.map +1 -0
- package/dist/events/Publisher.d.ts +193 -0
- package/dist/events/Publisher.d.ts.map +1 -0
- package/dist/events/Publisher.js +439 -0
- package/dist/events/Publisher.js.map +1 -0
- package/dist/events/config.d.ts +139 -0
- package/dist/events/config.d.ts.map +1 -0
- package/dist/events/config.js +266 -0
- package/dist/events/config.js.map +1 -0
- package/dist/events/index.d.ts +19 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +31 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/integration.d.ts +206 -0
- package/dist/events/integration.d.ts.map +1 -0
- package/dist/events/integration.js +348 -0
- package/dist/events/integration.js.map +1 -0
- package/dist/events/metrics.d.ts +147 -0
- package/dist/events/metrics.d.ts.map +1 -0
- package/dist/events/metrics.js +343 -0
- package/dist/events/metrics.js.map +1 -0
- package/dist/hooks/cli.d.ts +28 -0
- package/dist/hooks/cli.d.ts.map +1 -0
- package/dist/hooks/cli.js +118 -0
- package/dist/hooks/cli.js.map +1 -0
- package/dist/hooks/contextInjectionHook.d.ts +60 -0
- package/dist/hooks/contextInjectionHook.d.ts.map +1 -0
- package/dist/hooks/contextInjectionHook.js +294 -0
- package/dist/hooks/contextInjectionHook.js.map +1 -0
- package/dist/hooks/drilldownHook.d.ts +125 -0
- package/dist/hooks/drilldownHook.d.ts.map +1 -0
- package/dist/hooks/drilldownHook.js +181 -0
- package/dist/hooks/drilldownHook.js.map +1 -0
- package/dist/hooks/hookManager.d.ts +180 -0
- package/dist/hooks/hookManager.d.ts.map +1 -0
- package/dist/hooks/hookManager.js +782 -0
- package/dist/hooks/hookManager.js.map +1 -0
- package/dist/hooks/index.d.ts +62 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +66 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/lowContextHook.d.ts +71 -0
- package/dist/hooks/lowContextHook.d.ts.map +1 -0
- package/dist/hooks/lowContextHook.js +258 -0
- package/dist/hooks/lowContextHook.js.map +1 -0
- package/dist/hooks/simpleContextHook.d.ts +65 -0
- package/dist/hooks/simpleContextHook.d.ts.map +1 -0
- package/dist/hooks/simpleContextHook.js +194 -0
- package/dist/hooks/simpleContextHook.js.map +1 -0
- package/dist/hooks/teamFramingCli.d.ts +56 -0
- package/dist/hooks/teamFramingCli.d.ts.map +1 -0
- package/dist/hooks/teamFramingCli.js +264 -0
- package/dist/hooks/teamFramingCli.js.map +1 -0
- package/dist/hooks/teamMemberPrepromptHook.d.ts +150 -0
- package/dist/hooks/teamMemberPrepromptHook.d.ts.map +1 -0
- package/dist/hooks/teamMemberPrepromptHook.js +308 -0
- package/dist/hooks/teamMemberPrepromptHook.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4433 -0
- package/dist/index.js.map +1 -0
- package/dist/init/claudeConfigInjector.d.ts +116 -0
- package/dist/init/claudeConfigInjector.d.ts.map +1 -0
- package/dist/init/claudeConfigInjector.js +1154 -0
- package/dist/init/claudeConfigInjector.js.map +1 -0
- package/dist/installer/autoInstall.d.ts +72 -0
- package/dist/installer/autoInstall.d.ts.map +1 -0
- package/dist/installer/autoInstall.js +617 -0
- package/dist/installer/autoInstall.js.map +1 -0
- package/dist/installer/dbSetup.d.ts +84 -0
- package/dist/installer/dbSetup.d.ts.map +1 -0
- package/dist/installer/dbSetup.js +350 -0
- package/dist/installer/dbSetup.js.map +1 -0
- package/dist/installer/firstRun.d.ts +49 -0
- package/dist/installer/firstRun.d.ts.map +1 -0
- package/dist/installer/firstRun.js +207 -0
- package/dist/installer/firstRun.js.map +1 -0
- package/dist/installer/index.d.ts +10 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +10 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/silentAutoInstall.d.ts +99 -0
- package/dist/installer/silentAutoInstall.d.ts.map +1 -0
- package/dist/installer/silentAutoInstall.js +491 -0
- package/dist/installer/silentAutoInstall.js.map +1 -0
- package/dist/installer/systemDeps.d.ts +54 -0
- package/dist/installer/systemDeps.d.ts.map +1 -0
- package/dist/installer/systemDeps.js +322 -0
- package/dist/installer/systemDeps.js.map +1 -0
- package/dist/mcp/cliNotifications.d.ts +133 -0
- package/dist/mcp/cliNotifications.d.ts.map +1 -0
- package/dist/mcp/cliNotifications.js +289 -0
- package/dist/mcp/cliNotifications.js.map +1 -0
- package/dist/mcp/embeddingServerManager.d.ts +307 -0
- package/dist/mcp/embeddingServerManager.d.ts.map +1 -0
- package/dist/mcp/embeddingServerManager.js +2081 -0
- package/dist/mcp/embeddingServerManager.js.map +1 -0
- package/dist/mcp/healthMonitor.d.ts +196 -0
- package/dist/mcp/healthMonitor.d.ts.map +1 -0
- package/dist/mcp/healthMonitor.js +685 -0
- package/dist/mcp/healthMonitor.js.map +1 -0
- package/dist/mcp/hotReloadManager.d.ts +101 -0
- package/dist/mcp/hotReloadManager.d.ts.map +1 -0
- package/dist/mcp/hotReloadManager.js +251 -0
- package/dist/mcp/hotReloadManager.js.map +1 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +22 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/mcpProtocolHandler.d.ts +64 -0
- package/dist/mcp/mcpProtocolHandler.d.ts.map +1 -0
- package/dist/mcp/mcpProtocolHandler.js +253 -0
- package/dist/mcp/mcpProtocolHandler.js.map +1 -0
- package/dist/mcp/miniCOTServerManager.d.ts +336 -0
- package/dist/mcp/miniCOTServerManager.d.ts.map +1 -0
- package/dist/mcp/miniCOTServerManager.js +1384 -0
- package/dist/mcp/miniCOTServerManager.js.map +1 -0
- package/dist/mcp/promptExecutor.d.ts +188 -0
- package/dist/mcp/promptExecutor.d.ts.map +1 -0
- package/dist/mcp/promptExecutor.js +469 -0
- package/dist/mcp/promptExecutor.js.map +1 -0
- package/dist/mcp/reloadBroadcast.d.ts +127 -0
- package/dist/mcp/reloadBroadcast.d.ts.map +1 -0
- package/dist/mcp/reloadBroadcast.js +275 -0
- package/dist/mcp/reloadBroadcast.js.map +1 -0
- package/dist/mcp/resilientTransport.d.ts +249 -0
- package/dist/mcp/resilientTransport.d.ts.map +1 -0
- package/dist/mcp/resilientTransport.js +931 -0
- package/dist/mcp/resilientTransport.js.map +1 -0
- package/dist/mcp/samplingHandler.d.ts +129 -0
- package/dist/mcp/samplingHandler.d.ts.map +1 -0
- package/dist/mcp/samplingHandler.js +276 -0
- package/dist/mcp/samplingHandler.js.map +1 -0
- package/dist/mcp/specMemServer.d.ts +305 -0
- package/dist/mcp/specMemServer.d.ts.map +1 -0
- package/dist/mcp/specMemServer.js +2048 -0
- package/dist/mcp/specMemServer.js.map +1 -0
- package/dist/mcp/toolRegistry.d.ts +122 -0
- package/dist/mcp/toolRegistry.d.ts.map +1 -0
- package/dist/mcp/toolRegistry.js +609 -0
- package/dist/mcp/toolRegistry.js.map +1 -0
- package/dist/mcp/tools/embeddingControl.d.ts +114 -0
- package/dist/mcp/tools/embeddingControl.d.ts.map +1 -0
- package/dist/mcp/tools/embeddingControl.js +222 -0
- package/dist/mcp/tools/embeddingControl.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +10 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +17 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/teamComms.d.ts +444 -0
- package/dist/mcp/tools/teamComms.d.ts.map +1 -0
- package/dist/mcp/tools/teamComms.js +1953 -0
- package/dist/mcp/tools/teamComms.js.map +1 -0
- package/dist/mcp/triggerSystem.d.ts +129 -0
- package/dist/mcp/triggerSystem.d.ts.map +1 -0
- package/dist/mcp/triggerSystem.js +363 -0
- package/dist/mcp/triggerSystem.js.map +1 -0
- package/dist/mcp/watcherIntegration.d.ts +77 -0
- package/dist/mcp/watcherIntegration.d.ts.map +1 -0
- package/dist/mcp/watcherIntegration.js +428 -0
- package/dist/mcp/watcherIntegration.js.map +1 -0
- package/dist/mcp/watcherToolWrappers.d.ts +89 -0
- package/dist/mcp/watcherToolWrappers.d.ts.map +1 -0
- package/dist/mcp/watcherToolWrappers.js +91 -0
- package/dist/mcp/watcherToolWrappers.js.map +1 -0
- package/dist/memorization/claudeCodeMigration.d.ts +34 -0
- package/dist/memorization/claudeCodeMigration.d.ts.map +1 -0
- package/dist/memorization/claudeCodeMigration.js +210 -0
- package/dist/memorization/claudeCodeMigration.js.map +1 -0
- package/dist/memorization/claudeCodeTracker.d.ts +147 -0
- package/dist/memorization/claudeCodeTracker.d.ts.map +1 -0
- package/dist/memorization/claudeCodeTracker.js +424 -0
- package/dist/memorization/claudeCodeTracker.js.map +1 -0
- package/dist/memorization/codeMemorizer.d.ts +158 -0
- package/dist/memorization/codeMemorizer.d.ts.map +1 -0
- package/dist/memorization/codeMemorizer.js +357 -0
- package/dist/memorization/codeMemorizer.js.map +1 -0
- package/dist/memorization/codeRecall.d.ts +156 -0
- package/dist/memorization/codeRecall.d.ts.map +1 -0
- package/dist/memorization/codeRecall.js +499 -0
- package/dist/memorization/codeRecall.js.map +1 -0
- package/dist/memorization/index.d.ts +55 -0
- package/dist/memorization/index.d.ts.map +1 -0
- package/dist/memorization/index.js +64 -0
- package/dist/memorization/index.js.map +1 -0
- package/dist/memorization/memorizationTools.d.ts +413 -0
- package/dist/memorization/memorizationTools.d.ts.map +1 -0
- package/dist/memorization/memorizationTools.js +513 -0
- package/dist/memorization/memorizationTools.js.map +1 -0
- package/dist/memorization/watcherIntegration.d.ts +100 -0
- package/dist/memorization/watcherIntegration.d.ts.map +1 -0
- package/dist/memorization/watcherIntegration.js +196 -0
- package/dist/memorization/watcherIntegration.js.map +1 -0
- package/dist/memory/humanLikeMemory.d.ts +206 -0
- package/dist/memory/humanLikeMemory.d.ts.map +1 -0
- package/dist/memory/humanLikeMemory.js +603 -0
- package/dist/memory/humanLikeMemory.js.map +1 -0
- package/dist/memory/index.d.ts +22 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +24 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/memoryEvolutionMigration.d.ts +36 -0
- package/dist/memory/memoryEvolutionMigration.d.ts.map +1 -0
- package/dist/memory/memoryEvolutionMigration.js +371 -0
- package/dist/memory/memoryEvolutionMigration.js.map +1 -0
- package/dist/memory/quadrantSearch.d.ts +221 -0
- package/dist/memory/quadrantSearch.d.ts.map +1 -0
- package/dist/memory/quadrantSearch.js +897 -0
- package/dist/memory/quadrantSearch.js.map +1 -0
- package/dist/middleware/apiVersioning.d.ts +83 -0
- package/dist/middleware/apiVersioning.d.ts.map +1 -0
- package/dist/middleware/apiVersioning.js +152 -0
- package/dist/middleware/apiVersioning.js.map +1 -0
- package/dist/middleware/compression.d.ts +48 -0
- package/dist/middleware/compression.d.ts.map +1 -0
- package/dist/middleware/compression.js +240 -0
- package/dist/middleware/compression.js.map +1 -0
- package/dist/middleware/csrf.d.ts +118 -0
- package/dist/middleware/csrf.d.ts.map +1 -0
- package/dist/middleware/csrf.js +300 -0
- package/dist/middleware/csrf.js.map +1 -0
- package/dist/middleware/index.d.ts +13 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +17 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/wsRateLimiter.d.ts +129 -0
- package/dist/middleware/wsRateLimiter.d.ts.map +1 -0
- package/dist/middleware/wsRateLimiter.js +279 -0
- package/dist/middleware/wsRateLimiter.js.map +1 -0
- package/dist/migrations/run.d.ts +2 -0
- package/dist/migrations/run.d.ts.map +1 -0
- package/dist/migrations/run.js +25 -0
- package/dist/migrations/run.js.map +1 -0
- package/dist/migrations/syncDimensions.d.ts +24 -0
- package/dist/migrations/syncDimensions.d.ts.map +1 -0
- package/dist/migrations/syncDimensions.js +140 -0
- package/dist/migrations/syncDimensions.js.map +1 -0
- package/dist/migrations/teamComms.d.ts +16 -0
- package/dist/migrations/teamComms.d.ts.map +1 -0
- package/dist/migrations/teamComms.js +210 -0
- package/dist/migrations/teamComms.js.map +1 -0
- package/dist/openapi/index.d.ts +10 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +10 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/openapi/spec.d.ts +902 -0
- package/dist/openapi/spec.d.ts.map +1 -0
- package/dist/openapi/spec.js +733 -0
- package/dist/openapi/spec.js.map +1 -0
- package/dist/packages/dependencyHistory.d.ts +113 -0
- package/dist/packages/dependencyHistory.d.ts.map +1 -0
- package/dist/packages/dependencyHistory.js +360 -0
- package/dist/packages/dependencyHistory.js.map +1 -0
- package/dist/packages/index.d.ts +30 -0
- package/dist/packages/index.d.ts.map +1 -0
- package/dist/packages/index.js +65 -0
- package/dist/packages/index.js.map +1 -0
- package/dist/packages/packageTools.d.ts +255 -0
- package/dist/packages/packageTools.d.ts.map +1 -0
- package/dist/packages/packageTools.js +242 -0
- package/dist/packages/packageTools.js.map +1 -0
- package/dist/packages/packageTracker.d.ts +98 -0
- package/dist/packages/packageTracker.d.ts.map +1 -0
- package/dist/packages/packageTracker.js +268 -0
- package/dist/packages/packageTracker.js.map +1 -0
- package/dist/packages/packageWatcher.d.ts +62 -0
- package/dist/packages/packageWatcher.d.ts.map +1 -0
- package/dist/packages/packageWatcher.js +146 -0
- package/dist/packages/packageWatcher.js.map +1 -0
- package/dist/providers/MiniCOTProvider.d.ts +48 -0
- package/dist/providers/MiniCOTProvider.d.ts.map +1 -0
- package/dist/providers/MiniCOTProvider.js +98 -0
- package/dist/providers/MiniCOTProvider.js.map +1 -0
- package/dist/reminders/index.d.ts +5 -0
- package/dist/reminders/index.d.ts.map +1 -0
- package/dist/reminders/index.js +5 -0
- package/dist/reminders/index.js.map +1 -0
- package/dist/reminders/skillReminder.d.ts +131 -0
- package/dist/reminders/skillReminder.d.ts.map +1 -0
- package/dist/reminders/skillReminder.js +386 -0
- package/dist/reminders/skillReminder.js.map +1 -0
- package/dist/search.d.ts +35 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +574 -0
- package/dist/search.js.map +1 -0
- package/dist/security/localhostOnly.d.ts +36 -0
- package/dist/security/localhostOnly.d.ts.map +1 -0
- package/dist/security/localhostOnly.js +101 -0
- package/dist/security/localhostOnly.js.map +1 -0
- package/dist/services/CameraZoomSearch.d.ts +206 -0
- package/dist/services/CameraZoomSearch.d.ts.map +1 -0
- package/dist/services/CameraZoomSearch.js +669 -0
- package/dist/services/CameraZoomSearch.js.map +1 -0
- package/dist/services/DataFlowPipeline.d.ts +111 -0
- package/dist/services/DataFlowPipeline.d.ts.map +1 -0
- package/dist/services/DataFlowPipeline.js +379 -0
- package/dist/services/DataFlowPipeline.js.map +1 -0
- package/dist/services/DimensionAdapter.d.ts +194 -0
- package/dist/services/DimensionAdapter.d.ts.map +1 -0
- package/dist/services/DimensionAdapter.js +566 -0
- package/dist/services/DimensionAdapter.js.map +1 -0
- package/dist/services/DimensionService.d.ts +252 -0
- package/dist/services/DimensionService.d.ts.map +1 -0
- package/dist/services/DimensionService.js +564 -0
- package/dist/services/DimensionService.js.map +1 -0
- package/dist/services/EmbeddingQueue.d.ts +71 -0
- package/dist/services/EmbeddingQueue.d.ts.map +1 -0
- package/dist/services/EmbeddingQueue.js +258 -0
- package/dist/services/EmbeddingQueue.js.map +1 -0
- package/dist/services/MemoryDrilldown.d.ts +226 -0
- package/dist/services/MemoryDrilldown.d.ts.map +1 -0
- package/dist/services/MemoryDrilldown.js +479 -0
- package/dist/services/MemoryDrilldown.js.map +1 -0
- package/dist/services/MiniCOTScorer.d.ts +140 -0
- package/dist/services/MiniCOTScorer.d.ts.map +1 -0
- package/dist/services/MiniCOTScorer.js +292 -0
- package/dist/services/MiniCOTScorer.js.map +1 -0
- package/dist/services/ProjectContext.d.ts +342 -0
- package/dist/services/ProjectContext.d.ts.map +1 -0
- package/dist/services/ProjectContext.js +667 -0
- package/dist/services/ProjectContext.js.map +1 -0
- package/dist/services/ResponseCompactor.d.ts +135 -0
- package/dist/services/ResponseCompactor.d.ts.map +1 -0
- package/dist/services/ResponseCompactor.js +501 -0
- package/dist/services/ResponseCompactor.js.map +1 -0
- package/dist/services/TeamCommsDbService.d.ts +202 -0
- package/dist/services/TeamCommsDbService.d.ts.map +1 -0
- package/dist/services/TeamCommsDbService.js +526 -0
- package/dist/services/TeamCommsDbService.js.map +1 -0
- package/dist/services/UnifiedPasswordService.d.ts +166 -0
- package/dist/services/UnifiedPasswordService.d.ts.map +1 -0
- package/dist/services/UnifiedPasswordService.js +587 -0
- package/dist/services/UnifiedPasswordService.js.map +1 -0
- package/dist/services/adaptiveSearchConfig.d.ts +64 -0
- package/dist/services/adaptiveSearchConfig.d.ts.map +1 -0
- package/dist/services/adaptiveSearchConfig.js +187 -0
- package/dist/services/adaptiveSearchConfig.js.map +1 -0
- package/dist/skills/index.d.ts +8 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +8 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/skillScanner.d.ts +203 -0
- package/dist/skills/skillScanner.d.ts.map +1 -0
- package/dist/skills/skillScanner.js +559 -0
- package/dist/skills/skillScanner.js.map +1 -0
- package/dist/skills/skillsResource.d.ts +69 -0
- package/dist/skills/skillsResource.d.ts.map +1 -0
- package/dist/skills/skillsResource.js +257 -0
- package/dist/skills/skillsResource.js.map +1 -0
- package/dist/startup/index.d.ts +9 -0
- package/dist/startup/index.d.ts.map +1 -0
- package/dist/startup/index.js +12 -0
- package/dist/startup/index.js.map +1 -0
- package/dist/startup/startupIndexing.d.ts +80 -0
- package/dist/startup/startupIndexing.d.ts.map +1 -0
- package/dist/startup/startupIndexing.js +463 -0
- package/dist/startup/startupIndexing.js.map +1 -0
- package/dist/startup/validation.d.ts +89 -0
- package/dist/startup/validation.d.ts.map +1 -0
- package/dist/startup/validation.js +590 -0
- package/dist/startup/validation.js.map +1 -0
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +4 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/overflowManager.d.ts +80 -0
- package/dist/storage/overflowManager.d.ts.map +1 -0
- package/dist/storage/overflowManager.js +317 -0
- package/dist/storage/overflowManager.js.map +1 -0
- package/dist/storage/overflowStorage.d.ts +69 -0
- package/dist/storage/overflowStorage.d.ts.map +1 -0
- package/dist/storage/overflowStorage.js +379 -0
- package/dist/storage/overflowStorage.js.map +1 -0
- package/dist/storage/toonFormat.d.ts +50 -0
- package/dist/storage/toonFormat.d.ts.map +1 -0
- package/dist/storage/toonFormat.js +224 -0
- package/dist/storage/toonFormat.js.map +1 -0
- package/dist/team-members/communication.d.ts +237 -0
- package/dist/team-members/communication.d.ts.map +1 -0
- package/dist/team-members/communication.js +650 -0
- package/dist/team-members/communication.js.map +1 -0
- package/dist/team-members/index.d.ts +14 -0
- package/dist/team-members/index.d.ts.map +1 -0
- package/dist/team-members/index.js +22 -0
- package/dist/team-members/index.js.map +1 -0
- package/dist/team-members/taskOrchestrator.d.ts +224 -0
- package/dist/team-members/taskOrchestrator.d.ts.map +1 -0
- package/dist/team-members/taskOrchestrator.js +574 -0
- package/dist/team-members/taskOrchestrator.js.map +1 -0
- package/dist/team-members/taskTeamMemberLogger.d.ts +157 -0
- package/dist/team-members/taskTeamMemberLogger.d.ts.map +1 -0
- package/dist/team-members/taskTeamMemberLogger.js +478 -0
- package/dist/team-members/taskTeamMemberLogger.js.map +1 -0
- package/dist/team-members/teamCommsService.d.ts +221 -0
- package/dist/team-members/teamCommsService.d.ts.map +1 -0
- package/dist/team-members/teamCommsService.js +628 -0
- package/dist/team-members/teamCommsService.js.map +1 -0
- package/dist/team-members/teamMemberChannels.d.ts +217 -0
- package/dist/team-members/teamMemberChannels.d.ts.map +1 -0
- package/dist/team-members/teamMemberChannels.js +687 -0
- package/dist/team-members/teamMemberChannels.js.map +1 -0
- package/dist/team-members/teamMemberDashboard.d.ts +222 -0
- package/dist/team-members/teamMemberDashboard.d.ts.map +1 -0
- package/dist/team-members/teamMemberDashboard.js +610 -0
- package/dist/team-members/teamMemberDashboard.js.map +1 -0
- package/dist/team-members/teamMemberDeployment.d.ts +60 -0
- package/dist/team-members/teamMemberDeployment.d.ts.map +1 -0
- package/dist/team-members/teamMemberDeployment.js +429 -0
- package/dist/team-members/teamMemberDeployment.js.map +1 -0
- package/dist/team-members/teamMemberDiscovery.d.ts +178 -0
- package/dist/team-members/teamMemberDiscovery.d.ts.map +1 -0
- package/dist/team-members/teamMemberDiscovery.js +446 -0
- package/dist/team-members/teamMemberDiscovery.js.map +1 -0
- package/dist/team-members/teamMemberHistory.d.ts +80 -0
- package/dist/team-members/teamMemberHistory.d.ts.map +1 -0
- package/dist/team-members/teamMemberHistory.js +426 -0
- package/dist/team-members/teamMemberHistory.js.map +1 -0
- package/dist/team-members/teamMemberLimits.d.ts +66 -0
- package/dist/team-members/teamMemberLimits.d.ts.map +1 -0
- package/dist/team-members/teamMemberLimits.js +259 -0
- package/dist/team-members/teamMemberLimits.js.map +1 -0
- package/dist/team-members/teamMemberRegistry.d.ts +199 -0
- package/dist/team-members/teamMemberRegistry.d.ts.map +1 -0
- package/dist/team-members/teamMemberRegistry.js +572 -0
- package/dist/team-members/teamMemberRegistry.js.map +1 -0
- package/dist/team-members/teamMemberTracker.d.ts +148 -0
- package/dist/team-members/teamMemberTracker.d.ts.map +1 -0
- package/dist/team-members/teamMemberTracker.js +828 -0
- package/dist/team-members/teamMemberTracker.js.map +1 -0
- package/dist/team-members/workers/aiWorker.d.ts +53 -0
- package/dist/team-members/workers/aiWorker.d.ts.map +1 -0
- package/dist/team-members/workers/aiWorker.js +322 -0
- package/dist/team-members/workers/aiWorker.js.map +1 -0
- package/dist/team-members/workers/baseWorker.d.ts +101 -0
- package/dist/team-members/workers/baseWorker.d.ts.map +1 -0
- package/dist/team-members/workers/baseWorker.js +179 -0
- package/dist/team-members/workers/baseWorker.js.map +1 -0
- package/dist/team-members/workers/codeReviewWorker.d.ts +3 -0
- package/dist/team-members/workers/codeReviewWorker.d.ts.map +1 -0
- package/dist/team-members/workers/codeReviewWorker.js +144 -0
- package/dist/team-members/workers/codeReviewWorker.js.map +1 -0
- package/dist/team-members/workers/index.d.ts +7 -0
- package/dist/team-members/workers/index.d.ts.map +1 -0
- package/dist/team-members/workers/index.js +7 -0
- package/dist/team-members/workers/index.js.map +1 -0
- package/dist/team-members/workers/repairWorker.d.ts +9 -0
- package/dist/team-members/workers/repairWorker.d.ts.map +1 -0
- package/dist/team-members/workers/repairWorker.js +102 -0
- package/dist/team-members/workers/repairWorker.js.map +1 -0
- package/dist/team-members/workers/sendToTeamMemberB.d.ts +9 -0
- package/dist/team-members/workers/sendToTeamMemberB.d.ts.map +1 -0
- package/dist/team-members/workers/sendToTeamMemberB.js +105 -0
- package/dist/team-members/workers/sendToTeamMemberB.js.map +1 -0
- package/dist/team-members/workers/specmemClient.d.ts +179 -0
- package/dist/team-members/workers/specmemClient.d.ts.map +1 -0
- package/dist/team-members/workers/specmemClient.js +421 -0
- package/dist/team-members/workers/specmemClient.js.map +1 -0
- package/dist/team-members/workers/testCommunication.d.ts +8 -0
- package/dist/team-members/workers/testCommunication.d.ts.map +1 -0
- package/dist/team-members/workers/testCommunication.js +136 -0
- package/dist/team-members/workers/testCommunication.js.map +1 -0
- package/dist/team-members/workers/testCommunicationSuite.d.ts +26 -0
- package/dist/team-members/workers/testCommunicationSuite.d.ts.map +1 -0
- package/dist/team-members/workers/testCommunicationSuite.js +415 -0
- package/dist/team-members/workers/testCommunicationSuite.js.map +1 -0
- package/dist/team-members/workers/testWorker.d.ts +9 -0
- package/dist/team-members/workers/testWorker.d.ts.map +1 -0
- package/dist/team-members/workers/testWorker.js +107 -0
- package/dist/team-members/workers/testWorker.js.map +1 -0
- package/dist/tools/agentDefinitions.d.ts +30 -0
- package/dist/tools/agentDefinitions.d.ts.map +1 -0
- package/dist/tools/agentDefinitions.js +166 -0
- package/dist/tools/agentDefinitions.js.map +1 -0
- package/dist/tools/goofy/checkSyncStatus.d.ts +68 -0
- package/dist/tools/goofy/checkSyncStatus.d.ts.map +1 -0
- package/dist/tools/goofy/checkSyncStatus.js +112 -0
- package/dist/tools/goofy/checkSyncStatus.js.map +1 -0
- package/dist/tools/goofy/codeMemoryLink.d.ts +82 -0
- package/dist/tools/goofy/codeMemoryLink.d.ts.map +1 -0
- package/dist/tools/goofy/codeMemoryLink.js +212 -0
- package/dist/tools/goofy/codeMemoryLink.js.map +1 -0
- package/dist/tools/goofy/compareInstanceMemory.d.ts +97 -0
- package/dist/tools/goofy/compareInstanceMemory.d.ts.map +1 -0
- package/dist/tools/goofy/compareInstanceMemory.js +218 -0
- package/dist/tools/goofy/compareInstanceMemory.js.map +1 -0
- package/dist/tools/goofy/createReasoningChain.d.ts +135 -0
- package/dist/tools/goofy/createReasoningChain.d.ts.map +1 -0
- package/dist/tools/goofy/createReasoningChain.js +257 -0
- package/dist/tools/goofy/createReasoningChain.js.map +1 -0
- package/dist/tools/goofy/deployTeamMember.d.ts +63 -0
- package/dist/tools/goofy/deployTeamMember.d.ts.map +1 -0
- package/dist/tools/goofy/deployTeamMember.js +103 -0
- package/dist/tools/goofy/deployTeamMember.js.map +1 -0
- package/dist/tools/goofy/drillDown.d.ts +143 -0
- package/dist/tools/goofy/drillDown.d.ts.map +1 -0
- package/dist/tools/goofy/drillDown.js +288 -0
- package/dist/tools/goofy/drillDown.js.map +1 -0
- package/dist/tools/goofy/extractClaudeSessions.d.ts +90 -0
- package/dist/tools/goofy/extractClaudeSessions.d.ts.map +1 -0
- package/dist/tools/goofy/extractClaudeSessions.js +277 -0
- package/dist/tools/goofy/extractClaudeSessions.js.map +1 -0
- package/dist/tools/goofy/extractContextRestorations.d.ts +70 -0
- package/dist/tools/goofy/extractContextRestorations.d.ts.map +1 -0
- package/dist/tools/goofy/extractContextRestorations.js +100 -0
- package/dist/tools/goofy/extractContextRestorations.js.map +1 -0
- package/dist/tools/goofy/findCodePointers.d.ts +364 -0
- package/dist/tools/goofy/findCodePointers.d.ts.map +1 -0
- package/dist/tools/goofy/findCodePointers.js +1764 -0
- package/dist/tools/goofy/findCodePointers.js.map +1 -0
- package/dist/tools/goofy/findMemoryGallery.d.ts +40 -0
- package/dist/tools/goofy/findMemoryGallery.d.ts.map +1 -0
- package/dist/tools/goofy/findMemoryGallery.js +66 -0
- package/dist/tools/goofy/findMemoryGallery.js.map +1 -0
- package/dist/tools/goofy/findWhatISaid.d.ts +300 -0
- package/dist/tools/goofy/findWhatISaid.d.ts.map +1 -0
- package/dist/tools/goofy/findWhatISaid.js +2547 -0
- package/dist/tools/goofy/findWhatISaid.js.map +1 -0
- package/dist/tools/goofy/forceResync.d.ts +57 -0
- package/dist/tools/goofy/forceResync.d.ts.map +1 -0
- package/dist/tools/goofy/forceResync.js +100 -0
- package/dist/tools/goofy/forceResync.js.map +1 -0
- package/dist/tools/goofy/getActiveTeamMembers.d.ts +48 -0
- package/dist/tools/goofy/getActiveTeamMembers.d.ts.map +1 -0
- package/dist/tools/goofy/getActiveTeamMembers.js +136 -0
- package/dist/tools/goofy/getActiveTeamMembers.js.map +1 -0
- package/dist/tools/goofy/getMemoryFull.d.ts +34 -0
- package/dist/tools/goofy/getMemoryFull.d.ts.map +1 -0
- package/dist/tools/goofy/getMemoryFull.js +58 -0
- package/dist/tools/goofy/getMemoryFull.js.map +1 -0
- package/dist/tools/goofy/getSessionWatcherStatus.d.ts +43 -0
- package/dist/tools/goofy/getSessionWatcherStatus.d.ts.map +1 -0
- package/dist/tools/goofy/getSessionWatcherStatus.js +92 -0
- package/dist/tools/goofy/getSessionWatcherStatus.js.map +1 -0
- package/dist/tools/goofy/getTeamMemberOutput.d.ts +35 -0
- package/dist/tools/goofy/getTeamMemberOutput.d.ts.map +1 -0
- package/dist/tools/goofy/getTeamMemberOutput.js +62 -0
- package/dist/tools/goofy/getTeamMemberOutput.js.map +1 -0
- package/dist/tools/goofy/getTeamMemberScreen.d.ts +28 -0
- package/dist/tools/goofy/getTeamMemberScreen.d.ts.map +1 -0
- package/dist/tools/goofy/getTeamMemberScreen.js +59 -0
- package/dist/tools/goofy/getTeamMemberScreen.js.map +1 -0
- package/dist/tools/goofy/getTeamMemberStatus.d.ts +33 -0
- package/dist/tools/goofy/getTeamMemberStatus.d.ts.map +1 -0
- package/dist/tools/goofy/getTeamMemberStatus.js +56 -0
- package/dist/tools/goofy/getTeamMemberStatus.js.map +1 -0
- package/dist/tools/goofy/index.d.ts +39 -0
- package/dist/tools/goofy/index.d.ts.map +1 -0
- package/dist/tools/goofy/index.js +51 -0
- package/dist/tools/goofy/index.js.map +1 -0
- package/dist/tools/goofy/interveneTeamMember.d.ts +33 -0
- package/dist/tools/goofy/interveneTeamMember.d.ts.map +1 -0
- package/dist/tools/goofy/interveneTeamMember.js +69 -0
- package/dist/tools/goofy/interveneTeamMember.js.map +1 -0
- package/dist/tools/goofy/killDeployedTeamMember.d.ts +29 -0
- package/dist/tools/goofy/killDeployedTeamMember.d.ts.map +1 -0
- package/dist/tools/goofy/killDeployedTeamMember.js +56 -0
- package/dist/tools/goofy/killDeployedTeamMember.js.map +1 -0
- package/dist/tools/goofy/linkTheVibes.d.ts +125 -0
- package/dist/tools/goofy/linkTheVibes.d.ts.map +1 -0
- package/dist/tools/goofy/linkTheVibes.js +354 -0
- package/dist/tools/goofy/linkTheVibes.js.map +1 -0
- package/dist/tools/goofy/listDeployedTeamMembers.d.ts +26 -0
- package/dist/tools/goofy/listDeployedTeamMembers.d.ts.map +1 -0
- package/dist/tools/goofy/listDeployedTeamMembers.js +52 -0
- package/dist/tools/goofy/listDeployedTeamMembers.js.map +1 -0
- package/dist/tools/goofy/listenForMessages.d.ts +56 -0
- package/dist/tools/goofy/listenForMessages.d.ts.map +1 -0
- package/dist/tools/goofy/listenForMessages.js +122 -0
- package/dist/tools/goofy/listenForMessages.js.map +1 -0
- package/dist/tools/goofy/memoryHealthCheck.d.ts +159 -0
- package/dist/tools/goofy/memoryHealthCheck.d.ts.map +1 -0
- package/dist/tools/goofy/memoryHealthCheck.js +443 -0
- package/dist/tools/goofy/memoryHealthCheck.js.map +1 -0
- package/dist/tools/goofy/rememberThisShit.d.ts +103 -0
- package/dist/tools/goofy/rememberThisShit.d.ts.map +1 -0
- package/dist/tools/goofy/rememberThisShit.js +291 -0
- package/dist/tools/goofy/rememberThisShit.js.map +1 -0
- package/dist/tools/goofy/sayToTeamMember.d.ts +55 -0
- package/dist/tools/goofy/sayToTeamMember.d.ts.map +1 -0
- package/dist/tools/goofy/sayToTeamMember.js +116 -0
- package/dist/tools/goofy/sayToTeamMember.js.map +1 -0
- package/dist/tools/goofy/selfMessage.d.ts +54 -0
- package/dist/tools/goofy/selfMessage.d.ts.map +1 -0
- package/dist/tools/goofy/selfMessage.js +111 -0
- package/dist/tools/goofy/selfMessage.js.map +1 -0
- package/dist/tools/goofy/sendHeartbeat.d.ts +53 -0
- package/dist/tools/goofy/sendHeartbeat.d.ts.map +1 -0
- package/dist/tools/goofy/sendHeartbeat.js +119 -0
- package/dist/tools/goofy/sendHeartbeat.js.map +1 -0
- package/dist/tools/goofy/showMeTheStats.d.ts +216 -0
- package/dist/tools/goofy/showMeTheStats.d.ts.map +1 -0
- package/dist/tools/goofy/showMeTheStats.js +535 -0
- package/dist/tools/goofy/showMeTheStats.js.map +1 -0
- package/dist/tools/goofy/smartRecall.d.ts +136 -0
- package/dist/tools/goofy/smartRecall.d.ts.map +1 -0
- package/dist/tools/goofy/smartRecall.js +286 -0
- package/dist/tools/goofy/smartRecall.js.map +1 -0
- package/dist/tools/goofy/smartSearch.d.ts +64 -0
- package/dist/tools/goofy/smartSearch.d.ts.map +1 -0
- package/dist/tools/goofy/smartSearch.js +89 -0
- package/dist/tools/goofy/smartSearch.js.map +1 -0
- package/dist/tools/goofy/smushMemoriesTogether.d.ts +128 -0
- package/dist/tools/goofy/smushMemoriesTogether.d.ts.map +1 -0
- package/dist/tools/goofy/smushMemoriesTogether.js +536 -0
- package/dist/tools/goofy/smushMemoriesTogether.js.map +1 -0
- package/dist/tools/goofy/spatialSearch.d.ts +198 -0
- package/dist/tools/goofy/spatialSearch.d.ts.map +1 -0
- package/dist/tools/goofy/spatialSearch.js +551 -0
- package/dist/tools/goofy/spatialSearch.js.map +1 -0
- package/dist/tools/goofy/spawnResearchTeamMember.d.ts +104 -0
- package/dist/tools/goofy/spawnResearchTeamMember.d.ts.map +1 -0
- package/dist/tools/goofy/spawnResearchTeamMember.js +290 -0
- package/dist/tools/goofy/spawnResearchTeamMember.js.map +1 -0
- package/dist/tools/goofy/spawnResearchTeamMemberTool.d.ts +121 -0
- package/dist/tools/goofy/spawnResearchTeamMemberTool.d.ts.map +1 -0
- package/dist/tools/goofy/spawnResearchTeamMemberTool.js +215 -0
- package/dist/tools/goofy/spawnResearchTeamMemberTool.js.map +1 -0
- package/dist/tools/goofy/startWatchingTheFiles.d.ts +81 -0
- package/dist/tools/goofy/startWatchingTheFiles.d.ts.map +1 -0
- package/dist/tools/goofy/startWatchingTheFiles.js +161 -0
- package/dist/tools/goofy/startWatchingTheFiles.js.map +1 -0
- package/dist/tools/goofy/stopWatchingTheFiles.d.ts +50 -0
- package/dist/tools/goofy/stopWatchingTheFiles.d.ts.map +1 -0
- package/dist/tools/goofy/stopWatchingTheFiles.js +81 -0
- package/dist/tools/goofy/stopWatchingTheFiles.js.map +1 -0
- package/dist/tools/goofy/whatDidIMean.d.ts +113 -0
- package/dist/tools/goofy/whatDidIMean.d.ts.map +1 -0
- package/dist/tools/goofy/whatDidIMean.js +401 -0
- package/dist/tools/goofy/whatDidIMean.js.map +1 -0
- package/dist/tools/goofy/yeahNahDeleteThat.d.ts +109 -0
- package/dist/tools/goofy/yeahNahDeleteThat.d.ts.map +1 -0
- package/dist/tools/goofy/yeahNahDeleteThat.js +319 -0
- package/dist/tools/goofy/yeahNahDeleteThat.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +9 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/teamMemberDeployer.d.ts +117 -0
- package/dist/tools/teamMemberDeployer.d.ts.map +1 -0
- package/dist/tools/teamMemberDeployer.js +613 -0
- package/dist/tools/teamMemberDeployer.js.map +1 -0
- package/dist/trace/index.d.ts +14 -0
- package/dist/trace/index.d.ts.map +1 -0
- package/dist/trace/index.js +16 -0
- package/dist/trace/index.js.map +1 -0
- package/dist/trace/tools/analyzeImpact.d.ts +90 -0
- package/dist/trace/tools/analyzeImpact.d.ts.map +1 -0
- package/dist/trace/tools/analyzeImpact.js +240 -0
- package/dist/trace/tools/analyzeImpact.js.map +1 -0
- package/dist/trace/tools/exploreDependencies.d.ts +81 -0
- package/dist/trace/tools/exploreDependencies.d.ts.map +1 -0
- package/dist/trace/tools/exploreDependencies.js +161 -0
- package/dist/trace/tools/exploreDependencies.js.map +1 -0
- package/dist/trace/tools/findSimilarBugs.d.ts +112 -0
- package/dist/trace/tools/findSimilarBugs.d.ts.map +1 -0
- package/dist/trace/tools/findSimilarBugs.js +216 -0
- package/dist/trace/tools/findSimilarBugs.js.map +1 -0
- package/dist/trace/tools/index.d.ts +22 -0
- package/dist/trace/tools/index.d.ts.map +1 -0
- package/dist/trace/tools/index.js +39 -0
- package/dist/trace/tools/index.js.map +1 -0
- package/dist/trace/tools/smartExplore.d.ts +126 -0
- package/dist/trace/tools/smartExplore.d.ts.map +1 -0
- package/dist/trace/tools/smartExplore.js +303 -0
- package/dist/trace/tools/smartExplore.js.map +1 -0
- package/dist/trace/tools/traceError.d.ts +101 -0
- package/dist/trace/tools/traceError.d.ts.map +1 -0
- package/dist/trace/tools/traceError.js +175 -0
- package/dist/trace/tools/traceError.js.map +1 -0
- package/dist/trace/traceExploreSystem.d.ts +271 -0
- package/dist/trace/traceExploreSystem.d.ts.map +1 -0
- package/dist/trace/traceExploreSystem.js +789 -0
- package/dist/trace/traceExploreSystem.js.map +1 -0
- package/dist/types/index.d.ts +421 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +118 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/circuitBreaker.d.ts +195 -0
- package/dist/utils/circuitBreaker.d.ts.map +1 -0
- package/dist/utils/circuitBreaker.js +374 -0
- package/dist/utils/circuitBreaker.js.map +1 -0
- package/dist/utils/cleanupHandler.d.ts +108 -0
- package/dist/utils/cleanupHandler.d.ts.map +1 -0
- package/dist/utils/cleanupHandler.js +203 -0
- package/dist/utils/cleanupHandler.js.map +1 -0
- package/dist/utils/compactXmlResponse.d.ts +60 -0
- package/dist/utils/compactXmlResponse.d.ts.map +1 -0
- package/dist/utils/compactXmlResponse.js +209 -0
- package/dist/utils/compactXmlResponse.js.map +1 -0
- package/dist/utils/cotBroadcast.d.ts +56 -0
- package/dist/utils/cotBroadcast.d.ts.map +1 -0
- package/dist/utils/cotBroadcast.js +157 -0
- package/dist/utils/cotBroadcast.js.map +1 -0
- package/dist/utils/debugLogger.d.ts +95 -0
- package/dist/utils/debugLogger.d.ts.map +1 -0
- package/dist/utils/debugLogger.js +610 -0
- package/dist/utils/debugLogger.js.map +1 -0
- package/dist/utils/fileProcessingQueue.d.ts +259 -0
- package/dist/utils/fileProcessingQueue.d.ts.map +1 -0
- package/dist/utils/fileProcessingQueue.js +714 -0
- package/dist/utils/fileProcessingQueue.js.map +1 -0
- package/dist/utils/humanReadableOutput.d.ts +124 -0
- package/dist/utils/humanReadableOutput.d.ts.map +1 -0
- package/dist/utils/humanReadableOutput.js +340 -0
- package/dist/utils/humanReadableOutput.js.map +1 -0
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +71 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/instanceManager.d.ts +530 -0
- package/dist/utils/instanceManager.d.ts.map +1 -0
- package/dist/utils/instanceManager.js +1784 -0
- package/dist/utils/instanceManager.js.map +1 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +49 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mapCleanup.d.ts +58 -0
- package/dist/utils/mapCleanup.d.ts.map +1 -0
- package/dist/utils/mapCleanup.js +150 -0
- package/dist/utils/mapCleanup.js.map +1 -0
- package/dist/utils/memoryManager.d.ts +349 -0
- package/dist/utils/memoryManager.d.ts.map +1 -0
- package/dist/utils/memoryManager.js +799 -0
- package/dist/utils/memoryManager.js.map +1 -0
- package/dist/utils/metrics.d.ts +160 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +558 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/pathValidator.d.ts +96 -0
- package/dist/utils/pathValidator.d.ts.map +1 -0
- package/dist/utils/pathValidator.js +320 -0
- package/dist/utils/pathValidator.js.map +1 -0
- package/dist/utils/portAllocator.d.ts +296 -0
- package/dist/utils/portAllocator.d.ts.map +1 -0
- package/dist/utils/portAllocator.js +768 -0
- package/dist/utils/portAllocator.js.map +1 -0
- package/dist/utils/portUtils.d.ts +97 -0
- package/dist/utils/portUtils.d.ts.map +1 -0
- package/dist/utils/portUtils.js +285 -0
- package/dist/utils/portUtils.js.map +1 -0
- package/dist/utils/postgresAutoSetup.d.ts +55 -0
- package/dist/utils/postgresAutoSetup.d.ts.map +1 -0
- package/dist/utils/postgresAutoSetup.js +406 -0
- package/dist/utils/postgresAutoSetup.js.map +1 -0
- package/dist/utils/processHealthCheck.d.ts +61 -0
- package/dist/utils/processHealthCheck.d.ts.map +1 -0
- package/dist/utils/processHealthCheck.js +313 -0
- package/dist/utils/processHealthCheck.js.map +1 -0
- package/dist/utils/progressReporter.d.ts +151 -0
- package/dist/utils/progressReporter.d.ts.map +1 -0
- package/dist/utils/progressReporter.js +345 -0
- package/dist/utils/progressReporter.js.map +1 -0
- package/dist/utils/projectEnv.d.ts +73 -0
- package/dist/utils/projectEnv.d.ts.map +1 -0
- package/dist/utils/projectEnv.js +137 -0
- package/dist/utils/projectEnv.js.map +1 -0
- package/dist/utils/qoms.d.ts +122 -0
- package/dist/utils/qoms.d.ts.map +1 -0
- package/dist/utils/qoms.js +650 -0
- package/dist/utils/qoms.js.map +1 -0
- package/dist/utils/retryHelper.d.ts +122 -0
- package/dist/utils/retryHelper.d.ts.map +1 -0
- package/dist/utils/retryHelper.js +272 -0
- package/dist/utils/retryHelper.js.map +1 -0
- package/dist/utils/safeProcessTermination.d.ts +206 -0
- package/dist/utils/safeProcessTermination.d.ts.map +1 -0
- package/dist/utils/safeProcessTermination.js +552 -0
- package/dist/utils/safeProcessTermination.js.map +1 -0
- package/dist/utils/sessionInjector.d.ts +68 -0
- package/dist/utils/sessionInjector.d.ts.map +1 -0
- package/dist/utils/sessionInjector.js +189 -0
- package/dist/utils/sessionInjector.js.map +1 -0
- package/dist/utils/statsCache.d.ts +134 -0
- package/dist/utils/statsCache.d.ts.map +1 -0
- package/dist/utils/statsCache.js +285 -0
- package/dist/utils/statsCache.js.map +1 -0
- package/dist/utils/timeoutMiddleware.d.ts +81 -0
- package/dist/utils/timeoutMiddleware.d.ts.map +1 -0
- package/dist/utils/timeoutMiddleware.js +155 -0
- package/dist/utils/timeoutMiddleware.js.map +1 -0
- package/dist/utils/timerRegistry.d.ts +91 -0
- package/dist/utils/timerRegistry.d.ts.map +1 -0
- package/dist/utils/timerRegistry.js +187 -0
- package/dist/utils/timerRegistry.js.map +1 -0
- package/dist/utils/tokenCompressor.d.ts +332 -0
- package/dist/utils/tokenCompressor.d.ts.map +1 -0
- package/dist/utils/tokenCompressor.js +1306 -0
- package/dist/utils/tokenCompressor.js.map +1 -0
- package/dist/utils/tracing.d.ts +236 -0
- package/dist/utils/tracing.d.ts.map +1 -0
- package/dist/utils/tracing.js +378 -0
- package/dist/utils/tracing.js.map +1 -0
- package/dist/watcher/changeHandler.d.ts +123 -0
- package/dist/watcher/changeHandler.d.ts.map +1 -0
- package/dist/watcher/changeHandler.js +623 -0
- package/dist/watcher/changeHandler.js.map +1 -0
- package/dist/watcher/changeQueue.d.ts +133 -0
- package/dist/watcher/changeQueue.d.ts.map +1 -0
- package/dist/watcher/changeQueue.js +355 -0
- package/dist/watcher/changeQueue.js.map +1 -0
- package/dist/watcher/fileWatcher.d.ts +121 -0
- package/dist/watcher/fileWatcher.d.ts.map +1 -0
- package/dist/watcher/fileWatcher.js +531 -0
- package/dist/watcher/fileWatcher.js.map +1 -0
- package/dist/watcher/index.d.ts +94 -0
- package/dist/watcher/index.d.ts.map +1 -0
- package/dist/watcher/index.js +235 -0
- package/dist/watcher/index.js.map +1 -0
- package/dist/watcher/syncChecker.d.ts +93 -0
- package/dist/watcher/syncChecker.d.ts.map +1 -0
- package/dist/watcher/syncChecker.js +401 -0
- package/dist/watcher/syncChecker.js.map +1 -0
- package/dist/watcher/tsCompiler.d.ts +88 -0
- package/dist/watcher/tsCompiler.d.ts.map +1 -0
- package/dist/watcher/tsCompiler.js +212 -0
- package/dist/watcher/tsCompiler.js.map +1 -0
- package/embedding-sandbox/Dockerfile +77 -0
- package/embedding-sandbox/Dockerfile.frankenstein +91 -0
- package/embedding-sandbox/README.md +193 -0
- package/embedding-sandbox/__pycache__/frankenstein-embeddings.cpython-312.pyc +0 -0
- package/embedding-sandbox/__pycache__/frankenstein-embeddings.cpython-313.pyc +0 -0
- package/embedding-sandbox/__pycache__/qqms_v2.cpython-312.pyc +0 -0
- package/embedding-sandbox/__pycache__/qqms_v2.cpython-313.pyc +0 -0
- package/embedding-sandbox/add_js_docs.py +684 -0
- package/embedding-sandbox/build_docs_db.py +239 -0
- package/embedding-sandbox/client.cjs +376 -0
- package/embedding-sandbox/client.ts +913 -0
- package/embedding-sandbox/deploy-frankenstein.sh +240 -0
- package/embedding-sandbox/docker-compose.yml +60 -0
- package/embedding-sandbox/docker-manager.py +325 -0
- package/embedding-sandbox/docs/python_docs.db +0 -0
- package/embedding-sandbox/download-model.mjs +79 -0
- package/embedding-sandbox/download-model.py +28 -0
- package/embedding-sandbox/embedding-supervisor.sh +164 -0
- package/embedding-sandbox/frankenstein-embeddings.py +3940 -0
- package/embedding-sandbox/manage-services.sh +354 -0
- package/embedding-sandbox/overflow_queue.py +345 -0
- package/embedding-sandbox/package.json +17 -0
- package/embedding-sandbox/project_isolation.py +292 -0
- package/embedding-sandbox/qqms_v2.py +967 -0
- package/embedding-sandbox/ram-manager.sh +311 -0
- package/embedding-sandbox/requirements-frankenstein.txt +7 -0
- package/embedding-sandbox/run_js_docs.py +59 -0
- package/embedding-sandbox/seed_docs.py +885 -0
- package/embedding-sandbox/server-batch.mjs +228 -0
- package/embedding-sandbox/server.mjs +389 -0
- package/embedding-sandbox/specmem/sockets/claude-input-state.json +1 -0
- package/embedding-sandbox/specmem/sockets/embedding-death-reason.txt +3 -0
- package/embedding-sandbox/specmem/sockets/seen-sessions.json +1 -0
- package/embedding-sandbox/specmem/sockets/session-start.lock +1 -0
- package/embedding-sandbox/specmem/sockets/session-stops.log +7 -0
- package/embedding-sandbox/start-frankenstein-throttled.sh +98 -0
- package/embedding-sandbox/start-on-demand.sh +116 -0
- package/embedding-sandbox/start-sandbox.sh +237 -0
- package/embedding-sandbox/start-supervised.sh +11 -0
- package/embedding-sandbox/stop-sandbox.sh +51 -0
- package/embedding-sandbox/test-socket.mjs +61 -0
- package/embedding-sandbox/warm-start.sh +353 -0
- package/embedding-sandbox/warm_start_feeder.py +660 -0
- package/legal/README.md +31 -0
- package/legal/anthropic-privacy-center-screenshot-2026-01-30.png +0 -0
- package/legal/anthropic-tos-screenshot-2026-01-30.png +0 -0
- package/lib/codebase-bridge.cjs +308 -0
- package/package.json +136 -0
- package/plugins/specmem-agents/agents/bug-hunter.md +79 -0
- package/plugins/specmem-agents/agents/memory-explorer.md +57 -0
- package/plugins/specmem-agents/agents/team-coordinator.md +82 -0
- package/scripts/auto-updater.cjs +399 -0
- package/scripts/backfill-code-definition-embeddings.ts +440 -0
- package/scripts/backfill-code-embeddings.ts +206 -0
- package/scripts/capture-tos-screenshots.cjs +94 -0
- package/scripts/check-global-install.cjs +67 -0
- package/scripts/cleanup-embedding-servers.sh +25 -0
- package/scripts/dashboard-standalone.sh +369 -0
- package/scripts/deploy-hooks.cjs +1451 -0
- package/scripts/deploy.sh +106 -0
- package/scripts/docker-project-down.sh +83 -0
- package/scripts/docker-project-list.sh +40 -0
- package/scripts/docker-project-up.sh +79 -0
- package/scripts/fast-backfill-embeddings.ts +173 -0
- package/scripts/fast-batch-embedder.cjs +334 -0
- package/scripts/first-run-model-setup.cjs +849 -0
- package/scripts/global-postinstall.cjs +1957 -0
- package/scripts/index-codebase.js +72 -0
- package/scripts/migrate-fix-embeddings.py +110 -0
- package/scripts/migrate-to-project-schemas.ts +525 -0
- package/scripts/optimize-embedding-model.py +324 -0
- package/scripts/optimize-instructions.cjs +530 -0
- package/scripts/pack-docker-images.sh +68 -0
- package/scripts/pack-for-testing.sh +130 -0
- package/scripts/postinstall.cjs +54 -0
- package/scripts/project-env.sh +51 -0
- package/scripts/reset-db.sh +30 -0
- package/scripts/run-indexer.ts +69 -0
- package/scripts/run-migrations.js +47 -0
- package/scripts/setup-db.sh +34 -0
- package/scripts/setup-minimal-schema.sql +143 -0
- package/scripts/skills/code-review.md +44 -0
- package/scripts/skills/debugging.md +56 -0
- package/scripts/skills/specmem-deployteam.md +239 -0
- package/scripts/skills/teammemberskills/EFFICIENT_GREP.md +171 -0
- package/scripts/skills/teammemberskills/task-planning.md +67 -0
- package/scripts/specmem/sockets/session-start.lock +1 -0
- package/scripts/specmem/sockets/session-stops.log +1 -0
- package/scripts/specmem-health.sh +382 -0
- package/scripts/specmem-init.cjs +6935 -0
- package/scripts/strip-debug-logs.cjs +43 -0
- package/scripts/test-mcp-standalone.sh +365 -0
- package/scripts/test-optimized-models.py +166 -0
- package/scripts/verify-embedding-fix.sh +148 -0
- package/skills/code-review.md +44 -0
- package/skills/debugging.md +56 -0
- package/skills/specmem-deployteam.md +239 -0
- package/skills/teammemberskills/EFFICIENT_GREP.md +171 -0
- package/skills/teammemberskills/task-planning.md +67 -0
- package/specmem-health.cjs +522 -0
- package/specmem.env +216 -0
|
@@ -0,0 +1,1764 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* findCodePointers - semantic code search with tracebacks
|
|
3
|
+
*
|
|
4
|
+
* Searches codebase using embeddings to find code by meaning
|
|
5
|
+
* Shows tracebacks: who imports/calls this code
|
|
6
|
+
* Uses gallery mode with Mini COT for analysis
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* find_code_pointers({ query: "admin login authentication" })
|
|
10
|
+
* find_code_pointers({ query: "database connection", galleryMode: true })
|
|
11
|
+
*/
|
|
12
|
+
import { logger } from '../../utils/logger.js';
|
|
13
|
+
import { getEmbeddingSocketPath, getSocketSearchInfo } from '../../config.js';
|
|
14
|
+
import { getEmbeddingTimeout } from '../../config/embeddingTimeouts.js';
|
|
15
|
+
import { smartCompress } from '../../utils/tokenCompressor.js';
|
|
16
|
+
import { compactResponse } from '../../services/ResponseCompactor.js';
|
|
17
|
+
import { MiniCOTProvider } from '../../providers/MiniCOTProvider.js';
|
|
18
|
+
import { getDimensionService } from '../../services/DimensionService.js';
|
|
19
|
+
import { getProjectContext } from '../../services/ProjectContext.js';
|
|
20
|
+
// XML output removed - human readable only
|
|
21
|
+
import { formatHumanReadable } from '../../utils/humanReadableOutput.js';
|
|
22
|
+
import { drilldownRegistry, formatAsCameraRollResponse, thresholdToZoomLevel, ZOOM_CONFIGS } from '../../services/CameraZoomSearch.js';
|
|
23
|
+
import { getMiniCOTScorer, extractAttribution } from '../../services/MiniCOTScorer.js';
|
|
24
|
+
import { getCodeMemoryLinkService } from './codeMemoryLink.js';
|
|
25
|
+
import { cotStart, cotResult, cotError } from '../../utils/cotBroadcast.js';
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// TIMEOUT & RETRY CONFIGURATION
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Get code search timeout using unified configuration
|
|
31
|
+
* UNIFIED TIMEOUT: Set SPECMEM_EMBEDDING_TIMEOUT (seconds) to control ALL timeouts
|
|
32
|
+
* Or use SPECMEM_CODE_SEARCH_TIMEOUT for specific override
|
|
33
|
+
* See src/config/embeddingTimeouts.ts for full documentation
|
|
34
|
+
*/
|
|
35
|
+
function getCodeSearchTimeout() {
|
|
36
|
+
return getEmbeddingTimeout('codeSearch');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get max retry attempts from environment variable or use default
|
|
40
|
+
*/
|
|
41
|
+
function getMaxRetries() {
|
|
42
|
+
const envVal = process.env['SPECMEM_CODE_SEARCH_RETRIES'];
|
|
43
|
+
if (envVal) {
|
|
44
|
+
const retries = parseInt(envVal, 10);
|
|
45
|
+
if (!isNaN(retries) && retries >= 0) {
|
|
46
|
+
return retries;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Default: 2 retries (3 total attempts)
|
|
50
|
+
return 2;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Retry delay with exponential backoff
|
|
54
|
+
*/
|
|
55
|
+
function getRetryDelay(attempt) {
|
|
56
|
+
// 1s, 2s, 4s exponential backoff
|
|
57
|
+
return Math.min(1000 * Math.pow(2, attempt), 8000);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if an error is transient (worth retrying)
|
|
61
|
+
*/
|
|
62
|
+
function isTransientError(error) {
|
|
63
|
+
if (!(error instanceof Error))
|
|
64
|
+
return false;
|
|
65
|
+
const msg = error.message.toLowerCase();
|
|
66
|
+
// Transient errors that may succeed on retry
|
|
67
|
+
return (msg.includes('timeout') ||
|
|
68
|
+
msg.includes('econnreset') ||
|
|
69
|
+
msg.includes('econnrefused') ||
|
|
70
|
+
msg.includes('socket hang up') ||
|
|
71
|
+
msg.includes('aborted') ||
|
|
72
|
+
msg.includes('etimedout') ||
|
|
73
|
+
msg.includes('qoms') ||
|
|
74
|
+
msg.includes('resource') ||
|
|
75
|
+
msg.includes('busy'));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Execute an async operation with timeout
|
|
79
|
+
* FIXER AGENT 8: Added proper timeout handling
|
|
80
|
+
*/
|
|
81
|
+
async function withTimeout(operation, timeoutMs, operationName) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
// SELF-HEALING: Ensure timeout is reasonable (min 10s)
|
|
84
|
+
const safeTimeout = Math.max(10000, timeoutMs);
|
|
85
|
+
const timeoutId = setTimeout(() => {
|
|
86
|
+
// SELF-HEALING: Return graceful error instead of crashing
|
|
87
|
+
const err = new Error(`[CodePointers] ${operationName} deadline exceeded (${Math.round(safeTimeout/1000)}s remaining). ` +
|
|
88
|
+
`Increase SPECMEM_CODE_SEARCH_TIMEOUT env var (default: 60s) or check embedding service health.`);
|
|
89
|
+
err.isTimeout = true;
|
|
90
|
+
reject(err);
|
|
91
|
+
}, safeTimeout);
|
|
92
|
+
// SELF-HEALING: Wrap operation in try/catch to prevent unhandled rejections
|
|
93
|
+
Promise.resolve().then(() => operation())
|
|
94
|
+
.then(result => {
|
|
95
|
+
clearTimeout(timeoutId);
|
|
96
|
+
resolve(result);
|
|
97
|
+
})
|
|
98
|
+
.catch(error => {
|
|
99
|
+
clearTimeout(timeoutId);
|
|
100
|
+
// Mark as handled to prevent unhandled rejection
|
|
101
|
+
if (error && typeof error === 'object') {
|
|
102
|
+
error.handled = true;
|
|
103
|
+
}
|
|
104
|
+
reject(error);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Execute an operation with retry logic for transient failures
|
|
110
|
+
* FIXER AGENT 8: Added retry logic
|
|
111
|
+
*/
|
|
112
|
+
async function withRetry(operation, operationName, maxRetries = getMaxRetries()) {
|
|
113
|
+
let lastError = null;
|
|
114
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
115
|
+
try {
|
|
116
|
+
return await operation();
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
120
|
+
// Log retry attempt
|
|
121
|
+
if (attempt < maxRetries && isTransientError(error)) {
|
|
122
|
+
const delay = getRetryDelay(attempt);
|
|
123
|
+
logger.warn({
|
|
124
|
+
operationName,
|
|
125
|
+
attempt: attempt + 1,
|
|
126
|
+
maxRetries: maxRetries + 1,
|
|
127
|
+
error: lastError.message,
|
|
128
|
+
retryInMs: delay
|
|
129
|
+
}, `[CodePointers] ${operationName} failed, retrying in ${delay}ms`);
|
|
130
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Non-transient error or final attempt - don't retry
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// All retries exhausted
|
|
139
|
+
throw new Error(`[CodePointers] ${operationName} failed after ${maxRetries + 1} attempts. ` +
|
|
140
|
+
`Last error: ${lastError?.message || 'Unknown error'}. ` +
|
|
141
|
+
`Set SPECMEM_CODE_SEARCH_RETRIES env var to adjust retry count.`);
|
|
142
|
+
}
|
|
143
|
+
// ============================================================================
|
|
144
|
+
// HELP OUTPUT - shown when no query provided
|
|
145
|
+
// ============================================================================
|
|
146
|
+
const HELP_OUTPUT = `
|
|
147
|
+
# SpecMem Code Pointers - Semantic Code Search
|
|
148
|
+
|
|
149
|
+
Search your codebase using natural language and see tracebacks (who uses what).
|
|
150
|
+
|
|
151
|
+
## Usage
|
|
152
|
+
|
|
153
|
+
\`\`\`
|
|
154
|
+
find_code_pointers({ query: "your search" })
|
|
155
|
+
find_code_pointers({ query: "authentication", galleryMode: true })
|
|
156
|
+
find_code_pointers({ query: "database", language: "typescript" })
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
## Parameters
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Default | Description |
|
|
162
|
+
|-----------|------|---------|-------------|
|
|
163
|
+
| query | string | required | Natural language search query |
|
|
164
|
+
| limit | number | 10 | Max results to return |
|
|
165
|
+
| threshold | number | 0.1 | Min similarity score (0-1) |
|
|
166
|
+
| language | string | - | Filter by language (typescript, javascript, python, etc.) |
|
|
167
|
+
| filePattern | string | - | Filter by file path pattern (e.g., "routes/*.ts") |
|
|
168
|
+
| definitionTypes | string[] | - | Filter by type: function, class, method, interface, etc. |
|
|
169
|
+
| includeTracebacks | boolean | true | Show who imports/calls this code |
|
|
170
|
+
| galleryMode | boolean | false | Use Mini COT for deep analysis |
|
|
171
|
+
| summarize | boolean | false | Truncate content (default: show full content) |
|
|
172
|
+
| zoom | number | 50 | Zoom level 0-100: 0=signature only, 100=full context |
|
|
173
|
+
|
|
174
|
+
## Examples
|
|
175
|
+
|
|
176
|
+
### Find authentication code
|
|
177
|
+
\`\`\`json
|
|
178
|
+
{
|
|
179
|
+
"query": "admin login authentication",
|
|
180
|
+
"includeTracebacks": true
|
|
181
|
+
}
|
|
182
|
+
\`\`\`
|
|
183
|
+
|
|
184
|
+
### Find all database functions
|
|
185
|
+
\`\`\`json
|
|
186
|
+
{
|
|
187
|
+
"query": "database query connection pool",
|
|
188
|
+
"definitionTypes": ["function", "method"],
|
|
189
|
+
"language": "typescript"
|
|
190
|
+
}
|
|
191
|
+
\`\`\`
|
|
192
|
+
|
|
193
|
+
### Deep analysis with Mini COT
|
|
194
|
+
\`\`\`json
|
|
195
|
+
{
|
|
196
|
+
"query": "websocket handler",
|
|
197
|
+
"galleryMode": true
|
|
198
|
+
}
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
## Drill-Down
|
|
202
|
+
|
|
203
|
+
Results include a \`_drill\` field with the command to get full details:
|
|
204
|
+
- Use \`get_memory({ id: "..." })\` for full file content
|
|
205
|
+
- Use \`Read\` tool for the file path directly
|
|
206
|
+
|
|
207
|
+
## Tracebacks
|
|
208
|
+
|
|
209
|
+
When \`includeTracebacks: true\`, results show:
|
|
210
|
+
- **callers**: Files that import/require this file
|
|
211
|
+
- **callees**: Files that this file imports/requires
|
|
212
|
+
|
|
213
|
+
This helps you understand code dependencies and impact of changes.
|
|
214
|
+
`;
|
|
215
|
+
// Attribution for clean output
|
|
216
|
+
const SPECMEM_ATTRIBUTION = 'SpecMem Code Pointers';
|
|
217
|
+
// ============================================================================
|
|
218
|
+
// MAIN TOOL
|
|
219
|
+
// ============================================================================
|
|
220
|
+
export class FindCodePointers {
|
|
221
|
+
db;
|
|
222
|
+
embeddingProvider;
|
|
223
|
+
name = 'find_code_pointers';
|
|
224
|
+
description = 'Semantic code search with tracebacks - finds code by meaning and shows who uses it. Use for: finding functions, understanding dependencies, tracing imports. ZOOM CONTROL: Use zoom param (0-100) to control detail level. zoom=0 (signature only), zoom=50 (balanced), zoom=100 (full context). Start with zoom=0 for overview, increase to zoom in on specific results.';
|
|
225
|
+
inputSchema = {
|
|
226
|
+
type: 'object',
|
|
227
|
+
properties: {
|
|
228
|
+
query: {
|
|
229
|
+
type: 'string',
|
|
230
|
+
description: 'Natural language search - describe what code you\'re looking for. Leave empty for help.'
|
|
231
|
+
},
|
|
232
|
+
limit: {
|
|
233
|
+
type: 'number',
|
|
234
|
+
default: 10,
|
|
235
|
+
minimum: 1,
|
|
236
|
+
maximum: 100,
|
|
237
|
+
description: 'Max results to return'
|
|
238
|
+
},
|
|
239
|
+
threshold: {
|
|
240
|
+
type: 'number',
|
|
241
|
+
default: 0.25,
|
|
242
|
+
minimum: 0,
|
|
243
|
+
maximum: 1,
|
|
244
|
+
description: 'Min similarity score (0-1). Default 0.25 filters garbage. Local embeddings: 0.2-0.5 typical for real matches.'
|
|
245
|
+
},
|
|
246
|
+
language: {
|
|
247
|
+
type: 'string',
|
|
248
|
+
description: 'Filter by language: typescript, javascript, python, go, rust, etc.'
|
|
249
|
+
},
|
|
250
|
+
filePattern: {
|
|
251
|
+
type: 'string',
|
|
252
|
+
description: 'Filter by file path pattern (e.g., "routes/*.ts", "src/api/**")'
|
|
253
|
+
},
|
|
254
|
+
definitionTypes: {
|
|
255
|
+
type: 'array',
|
|
256
|
+
items: {
|
|
257
|
+
type: 'string',
|
|
258
|
+
enum: ['function', 'method', 'class', 'interface', 'type', 'enum', 'variable', 'constant', 'constructor']
|
|
259
|
+
},
|
|
260
|
+
description: 'Filter by definition type'
|
|
261
|
+
},
|
|
262
|
+
includeTracebacks: {
|
|
263
|
+
type: 'boolean',
|
|
264
|
+
default: true,
|
|
265
|
+
description: 'Include callers/callees (who uses this code)'
|
|
266
|
+
},
|
|
267
|
+
galleryMode: {
|
|
268
|
+
oneOf: [
|
|
269
|
+
{ type: 'boolean' },
|
|
270
|
+
{ type: 'string', enum: ['ask'] }
|
|
271
|
+
],
|
|
272
|
+
default: false,
|
|
273
|
+
description: 'true=Mini COT analysis (slower), false=basic semantic search (default). Gallery mode falls back to basic semantic on failure.'
|
|
274
|
+
},
|
|
275
|
+
maxContentLength: {
|
|
276
|
+
type: 'number',
|
|
277
|
+
default: 0,
|
|
278
|
+
description: 'Truncate content to this many chars (0 = full content, no truncation)'
|
|
279
|
+
},
|
|
280
|
+
summarize: {
|
|
281
|
+
type: 'boolean',
|
|
282
|
+
default: false,
|
|
283
|
+
description: 'Truncate content for compact view. Default false = full content.'
|
|
284
|
+
},
|
|
285
|
+
zoom: {
|
|
286
|
+
type: 'number',
|
|
287
|
+
default: 50,
|
|
288
|
+
minimum: 0,
|
|
289
|
+
maximum: 100,
|
|
290
|
+
description: 'Zoom level 0-100: 0=signature only (minimal), 50=balanced, 100=full context. Low zoom shows less content, high zoom shows more.'
|
|
291
|
+
},
|
|
292
|
+
zoomLevel: {
|
|
293
|
+
type: 'string',
|
|
294
|
+
enum: ['ultra-wide', 'wide', 'normal', 'close', 'macro'],
|
|
295
|
+
description: 'Camera roll zoom level: ultra-wide (50 results, 15% threshold), wide (25, 25%), normal (15, 40%), close (10, 60%), macro (5, 80%)'
|
|
296
|
+
},
|
|
297
|
+
cameraRollMode: {
|
|
298
|
+
type: 'boolean',
|
|
299
|
+
default: true,
|
|
300
|
+
description: 'Camera roll response format with drilldownIDs (default: enabled). Use drill_down(ID) to explore further.'
|
|
301
|
+
},
|
|
302
|
+
useCotScoring: {
|
|
303
|
+
type: 'boolean',
|
|
304
|
+
default: false,
|
|
305
|
+
description: 'Enable Mini COT scoring to analyze code-memory relevance. Returns cotRelevance, cotReasoning, and combinedScore for each result.'
|
|
306
|
+
},
|
|
307
|
+
includeAttribution: {
|
|
308
|
+
type: 'boolean',
|
|
309
|
+
default: false,
|
|
310
|
+
description: 'Add user/claude attribution based on memory role. Returns attribution (user/assistant/unknown) and attributionNote for each result.'
|
|
311
|
+
},
|
|
312
|
+
includeMemoryLinks: {
|
|
313
|
+
type: 'boolean',
|
|
314
|
+
default: true,
|
|
315
|
+
description: 'Link code to related memories with attribution. Shows "requested by user" or "implemented by assistant" for each code result. Default: true.'
|
|
316
|
+
},
|
|
317
|
+
// I5 FIX: New parameters for better search coverage
|
|
318
|
+
keywordFallback: {
|
|
319
|
+
type: 'boolean',
|
|
320
|
+
default: true,
|
|
321
|
+
description: 'If embedding search returns no/low results, fallback to keyword (ILIKE) search on file paths and content.'
|
|
322
|
+
},
|
|
323
|
+
includeRecent: {
|
|
324
|
+
type: 'number',
|
|
325
|
+
default: 0,
|
|
326
|
+
minimum: 0,
|
|
327
|
+
maximum: 20,
|
|
328
|
+
description: 'Force include the last N most recently modified files regardless of similarity.'
|
|
329
|
+
},
|
|
330
|
+
projectPath: {
|
|
331
|
+
type: 'string',
|
|
332
|
+
description: 'Search code from a specific project path instead of current project. Use absolute path like "/home/user/my-other-project"'
|
|
333
|
+
},
|
|
334
|
+
allProjects: {
|
|
335
|
+
type: 'boolean',
|
|
336
|
+
default: false,
|
|
337
|
+
description: 'Search ALL projects instead of just current project. Useful for finding similar code patterns across repos.'
|
|
338
|
+
},
|
|
339
|
+
// humanReadable is always true - removed as configurable option per user request
|
|
340
|
+
},
|
|
341
|
+
required: [] // query is not required - empty shows help
|
|
342
|
+
};
|
|
343
|
+
dimensionService = null;
|
|
344
|
+
constructor(db, embeddingProvider) {
|
|
345
|
+
this.db = db;
|
|
346
|
+
this.embeddingProvider = embeddingProvider;
|
|
347
|
+
try {
|
|
348
|
+
this.dimensionService = getDimensionService(db, embeddingProvider);
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
// Will initialize when needed
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Get DimensionService (lazy initialization)
|
|
356
|
+
*/
|
|
357
|
+
getDimService() {
|
|
358
|
+
if (!this.dimensionService) {
|
|
359
|
+
this.dimensionService = getDimensionService(this.db, this.embeddingProvider);
|
|
360
|
+
}
|
|
361
|
+
return this.dimensionService;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Get project path for queries - supports cross-project search
|
|
365
|
+
* Returns null if allProjects=true (skip project filtering)
|
|
366
|
+
*/
|
|
367
|
+
getTargetProject(params) {
|
|
368
|
+
if (params.allProjects) {
|
|
369
|
+
return null; // No project filtering
|
|
370
|
+
}
|
|
371
|
+
return params.projectPath || getProjectContext().getProjectPath();
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Build project condition for SQL queries
|
|
375
|
+
* Returns empty string if searching all projects
|
|
376
|
+
*/
|
|
377
|
+
buildProjectClause(params, paramIndex) {
|
|
378
|
+
const projectPath = this.getTargetProject(params);
|
|
379
|
+
if (!projectPath) {
|
|
380
|
+
return { clause: '', param: null };
|
|
381
|
+
}
|
|
382
|
+
return { clause: `project_path = $${paramIndex}`, param: projectPath };
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Validate and prepare embedding for search
|
|
386
|
+
*/
|
|
387
|
+
async prepareEmbedding(embedding, tableName, originalQuery) {
|
|
388
|
+
const dimService = this.getDimService();
|
|
389
|
+
const prepared = await dimService.validateAndPrepare(tableName, embedding, originalQuery);
|
|
390
|
+
if (prepared.wasModified) {
|
|
391
|
+
logger.debug({ action: prepared.action, tableName }, 'Adjusted embedding dimension for code search');
|
|
392
|
+
}
|
|
393
|
+
return prepared.embedding;
|
|
394
|
+
}
|
|
395
|
+
async execute(params) {
|
|
396
|
+
const startTime = Date.now();
|
|
397
|
+
// HELP MODE: No query = show help
|
|
398
|
+
if (!params.query || params.query.trim() === '' || params.query.toLowerCase() === 'help') {
|
|
399
|
+
logger.info({}, '[CodePointers] Showing help - no query provided');
|
|
400
|
+
return {
|
|
401
|
+
results: [{
|
|
402
|
+
type: 'file',
|
|
403
|
+
file_path: 'HELP',
|
|
404
|
+
content_preview: HELP_OUTPUT,
|
|
405
|
+
similarity: 1.0
|
|
406
|
+
}],
|
|
407
|
+
query: 'help',
|
|
408
|
+
total_found: 0,
|
|
409
|
+
search_type: 'semantic',
|
|
410
|
+
attribution: SPECMEM_ATTRIBUTION
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
// MODE SELECTION: Return options if user wants to choose
|
|
414
|
+
if (params.galleryMode === 'ask') {
|
|
415
|
+
return this.returnModeOptions(params.query);
|
|
416
|
+
}
|
|
417
|
+
const limit = Math.min(params.limit ?? 10, 100);
|
|
418
|
+
const threshold = params.threshold ?? 0.35; // Raised to filter low-quality matches
|
|
419
|
+
const includeTracebacks = params.includeTracebacks !== false;
|
|
420
|
+
// Broadcast COT start to dashboard
|
|
421
|
+
cotStart('find_code', params.query);
|
|
422
|
+
// FIXER AGENT 8: Get configurable timeout (default 30s)
|
|
423
|
+
const timeoutMs = getCodeSearchTimeout();
|
|
424
|
+
// FIX: Deadline-based timeout to prevent compounding (was worst-case 390s!)
|
|
425
|
+
// All operations share single deadline instead of stacking individual timeouts
|
|
426
|
+
const deadline = Date.now() + timeoutMs;
|
|
427
|
+
// Min 10s to allow embedding server to respond even when slow
|
|
428
|
+
const remainingTime = () => Math.max(10000, deadline - Date.now());
|
|
429
|
+
// FIXER AGENT 7: Log socket path for debugging (same detection as find_memory)
|
|
430
|
+
const socketPath = getEmbeddingSocketPath();
|
|
431
|
+
if (process.env['SPECMEM_DEBUG']) {
|
|
432
|
+
const socketInfo = getSocketSearchInfo();
|
|
433
|
+
logger.debug({
|
|
434
|
+
socketPath,
|
|
435
|
+
socketFound: socketInfo.foundSocket,
|
|
436
|
+
projectDirName: socketInfo.projectDirName,
|
|
437
|
+
searchedLocations: socketInfo.searchedLocations.filter(l => l.isSocket).map(l => l.path)
|
|
438
|
+
}, '[CodePointers] SPECMEM_DEBUG: Socket detection info');
|
|
439
|
+
}
|
|
440
|
+
try {
|
|
441
|
+
// Generate embedding for query with timeout and retry
|
|
442
|
+
// FIXER AGENT 7 & 8: Added timeout wrapper, retry logic, and socket path logging
|
|
443
|
+
logger.info({
|
|
444
|
+
query: params.query,
|
|
445
|
+
timeoutMs,
|
|
446
|
+
maxRetries: getMaxRetries(),
|
|
447
|
+
socketPath // FIXER AGENT 7: Include socket path in logs
|
|
448
|
+
}, '[CodePointers] Generating embedding for query');
|
|
449
|
+
const rawEmbedding = await withRetry(() => withTimeout(() => this.embeddingProvider.generateEmbedding(params.query), remainingTime(), 'Embedding generation'), 'Embedding generation');
|
|
450
|
+
// Validate and prepare embeddings for each table (may have different dimensions)
|
|
451
|
+
// FIXER AGENT 8: Added timeout wrapper for dimension preparation
|
|
452
|
+
const [queryEmbeddingFiles, queryEmbeddingDefs] = await withTimeout(() => Promise.all([
|
|
453
|
+
this.prepareEmbedding(rawEmbedding, 'codebase_files', params.query),
|
|
454
|
+
this.prepareEmbedding(rawEmbedding, 'code_definitions', params.query)
|
|
455
|
+
]), remainingTime(), 'Embedding dimension preparation');
|
|
456
|
+
// Search both files and definitions with appropriate embeddings
|
|
457
|
+
// FIXER AGENT 8: Added timeout wrapper for database searches
|
|
458
|
+
const [fileResults, definitionResults] = await withTimeout(() => Promise.all([
|
|
459
|
+
this.searchFiles(queryEmbeddingFiles, params, limit, threshold),
|
|
460
|
+
this.searchDefinitions(queryEmbeddingDefs, params, limit, threshold)
|
|
461
|
+
]), remainingTime(), 'Database search');
|
|
462
|
+
// Combine and sort by similarity
|
|
463
|
+
let results = [
|
|
464
|
+
...fileResults.map(f => this.fileToResult(f, params)),
|
|
465
|
+
...definitionResults.map(d => this.definitionToResult(d, params))
|
|
466
|
+
];
|
|
467
|
+
// AUTO-DEDUPE: Remove duplicates by file name (keeps shortest path = canonical version)
|
|
468
|
+
// This handles cases where same file is indexed from different paths (e.g., mcp/specmem/src/foo.ts vs src/foo.ts)
|
|
469
|
+
results = this.dedupeResults(results);
|
|
470
|
+
// Sort by similarity descending
|
|
471
|
+
results.sort((a, b) => b.similarity - a.similarity);
|
|
472
|
+
// Take top N
|
|
473
|
+
results = results.slice(0, limit);
|
|
474
|
+
// ============================================================================
|
|
475
|
+
// I5 FIX: APPLY KEYWORD FALLBACK AND RECENT FILES
|
|
476
|
+
// ============================================================================
|
|
477
|
+
const useKeywordFallback = params.keywordFallback !== false; // Default true
|
|
478
|
+
const includeRecentCount = params.includeRecent ?? 0;
|
|
479
|
+
logger.info({
|
|
480
|
+
query: params.query,
|
|
481
|
+
semanticResultCount: results.length,
|
|
482
|
+
keywordFallback: useKeywordFallback,
|
|
483
|
+
includeRecent: includeRecentCount
|
|
484
|
+
}, '[I5 FIX] Code search phase 1 complete');
|
|
485
|
+
// I5 FIX: Keyword fallback if semantic returned nothing good
|
|
486
|
+
// FIXER AGENT 8: Added timeout wrapper for keyword fallback
|
|
487
|
+
let keywordResults = [];
|
|
488
|
+
const hasGoodSemanticResults = results.length > 0 && results[0]?.similarity >= 0.15;
|
|
489
|
+
if (useKeywordFallback && !hasGoodSemanticResults) {
|
|
490
|
+
logger.info({
|
|
491
|
+
query: params.query,
|
|
492
|
+
semanticResults: results.length,
|
|
493
|
+
topSimilarity: results[0]?.similarity
|
|
494
|
+
}, '[I5 FIX] Low/no semantic results, triggering keyword fallback');
|
|
495
|
+
try {
|
|
496
|
+
keywordResults = await withTimeout(() => this.keywordSearchFiles(params.query, params), remainingTime(), 'Keyword fallback search');
|
|
497
|
+
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
// Log but don't fail - keyword fallback is optional
|
|
500
|
+
logger.warn({ error: err }, '[I5 FIX] Keyword fallback timed out, continuing without');
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
// I5 FIX: Get recent files if requested
|
|
504
|
+
// FIXER AGENT 8: Added timeout wrapper for recent files
|
|
505
|
+
let recentResults = [];
|
|
506
|
+
if (includeRecentCount > 0) {
|
|
507
|
+
try {
|
|
508
|
+
recentResults = await withTimeout(() => this.getRecentCodeFiles(includeRecentCount, params), remainingTime(), 'Recent files lookup');
|
|
509
|
+
logger.info({
|
|
510
|
+
recentRequested: includeRecentCount,
|
|
511
|
+
recentFound: recentResults.length
|
|
512
|
+
}, '[I5 FIX] Recent code files retrieved');
|
|
513
|
+
}
|
|
514
|
+
catch (err) {
|
|
515
|
+
// Log but don't fail - recent files is optional
|
|
516
|
+
logger.warn({ error: err }, '[I5 FIX] Recent files lookup timed out, continuing without');
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
// I5 FIX: Merge all results if we have additional sources
|
|
520
|
+
if (recentResults.length > 0 || keywordResults.length > 0) {
|
|
521
|
+
const originalCount = results.length;
|
|
522
|
+
results = this.mergeCodeResults(results, recentResults, keywordResults, limit);
|
|
523
|
+
logger.info({
|
|
524
|
+
originalSemanticCount: originalCount,
|
|
525
|
+
recentCount: recentResults.length,
|
|
526
|
+
keywordCount: keywordResults.length,
|
|
527
|
+
mergedCount: results.length
|
|
528
|
+
}, '[I5 FIX] Code results merged from multiple sources');
|
|
529
|
+
}
|
|
530
|
+
// Add tracebacks if requested
|
|
531
|
+
// FIXER AGENT 8: Added timeout wrapper for tracebacks
|
|
532
|
+
// ZOOM FIX: Use zoom-based traceback depth in camera roll mode
|
|
533
|
+
const zoom = params.zoom ?? 50;
|
|
534
|
+
const tracebackDepth = this.zoomToTracebackDepth(zoom);
|
|
535
|
+
// For non-camera-roll mode: use includeTracebacks boolean (default true)
|
|
536
|
+
// For camera-roll mode: always include but depth controlled by zoom
|
|
537
|
+
const cameraRollModeCheck = params.cameraRollMode === true ||
|
|
538
|
+
params.cameraRollMode === 'true' ||
|
|
539
|
+
params.zoomLevel;
|
|
540
|
+
const shouldIncludeTracebacks = cameraRollModeCheck
|
|
541
|
+
? tracebackDepth.include // Camera roll: zoom controls inclusion
|
|
542
|
+
: includeTracebacks; // Default: use boolean param (default true)
|
|
543
|
+
if (shouldIncludeTracebacks && results.length > 0) {
|
|
544
|
+
try {
|
|
545
|
+
// Pass traceback depth for zoom-based limiting
|
|
546
|
+
const depth = cameraRollModeCheck
|
|
547
|
+
? { maxCallers: tracebackDepth.maxCallers, maxCallees: tracebackDepth.maxCallees }
|
|
548
|
+
: undefined; // Default mode uses default (3, 3)
|
|
549
|
+
await withTimeout(() => this.addTracebacks(results, depth), remainingTime(), 'Traceback lookup');
|
|
550
|
+
}
|
|
551
|
+
catch (err) {
|
|
552
|
+
// Log but don't fail - tracebacks are optional enrichment
|
|
553
|
+
logger.warn({ error: err }, '[CodePointers] Traceback lookup timed out, continuing without');
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
// Add memory links with attribution (default: enabled)
|
|
557
|
+
// This correlates code with related memories and shows "requested by user" or "implemented by assistant"
|
|
558
|
+
// FIXER AGENT 8: Added timeout wrapper for memory links
|
|
559
|
+
const includeMemoryLinks = params.includeMemoryLinks !== false;
|
|
560
|
+
if (includeMemoryLinks && results.length > 0) {
|
|
561
|
+
try {
|
|
562
|
+
const memoryLinkService = getCodeMemoryLinkService(this.db);
|
|
563
|
+
await withTimeout(() => memoryLinkService.addMemoryLinks(results), remainingTime(), 'Memory link lookup');
|
|
564
|
+
}
|
|
565
|
+
catch (err) {
|
|
566
|
+
// Log but don't fail - memory links are optional enrichment
|
|
567
|
+
logger.warn({ error: err }, '[CodePointers] Memory link lookup timed out, continuing without');
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const duration = Date.now() - startTime;
|
|
571
|
+
logger.info({
|
|
572
|
+
query: params.query,
|
|
573
|
+
resultCount: results.length,
|
|
574
|
+
duration,
|
|
575
|
+
usedKeywordFallback: keywordResults.length > 0,
|
|
576
|
+
usedRecentFiles: recentResults.length > 0
|
|
577
|
+
}, '[CodePointers] Search complete with I5 fixes');
|
|
578
|
+
// ============================================================================
|
|
579
|
+
// MINI COT SCORING & ATTRIBUTION
|
|
580
|
+
// Score code-memory relevance using Mini COT and add user/claude attribution
|
|
581
|
+
// FIXER AGENT 8: Added timeout wrapper for COT scoring
|
|
582
|
+
// ============================================================================
|
|
583
|
+
if ((params.useCotScoring || params.includeAttribution) && results.length > 0) {
|
|
584
|
+
try {
|
|
585
|
+
// COT scoring can be slow - use 1.5x timeout
|
|
586
|
+
const cotTimeout = Math.round(timeoutMs * 1.5);
|
|
587
|
+
results = await withTimeout(() => this.applyCotScoringAndAttribution(params.query, results, params.useCotScoring ?? false, params.includeAttribution ?? false), cotTimeout, 'COT scoring and attribution');
|
|
588
|
+
// Re-sort by combined score if COT scoring was applied
|
|
589
|
+
if (params.useCotScoring) {
|
|
590
|
+
results.sort((a, b) => (b.combinedScore ?? b.similarity) - (a.combinedScore ?? a.similarity));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
catch (err) {
|
|
594
|
+
// Log but don't fail - COT scoring is optional enrichment
|
|
595
|
+
logger.warn({ error: err }, '[CodePointers] COT scoring timed out, continuing without');
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
// GALLERY MODE: Send to Mini COT for analysis
|
|
599
|
+
// FIXER AGENT 8: Added timeout wrapper for gallery mode (uses longer timeout)
|
|
600
|
+
if (params.galleryMode === true && results.length > 0) {
|
|
601
|
+
// Gallery mode uses Mini COT which is slower - use 2x timeout
|
|
602
|
+
const galleryTimeout = timeoutMs * 2;
|
|
603
|
+
return await withTimeout(() => this.processGalleryMode(params.query, results), galleryTimeout, 'Gallery mode processing');
|
|
604
|
+
}
|
|
605
|
+
// ============================================================================
|
|
606
|
+
// CAMERA ROLL MODE - Default enabled, human-readable output with drilldownIDs
|
|
607
|
+
// ============================================================================
|
|
608
|
+
// Default: cameraRollMode is TRUE (enabled) unless explicitly set to false
|
|
609
|
+
const cameraRollModeRaw = params.cameraRollMode;
|
|
610
|
+
const cameraRollMode = cameraRollModeRaw !== false && cameraRollModeRaw !== 'false' && cameraRollModeRaw !== 0;
|
|
611
|
+
const zoomLevelParam = params.zoomLevel;
|
|
612
|
+
if (cameraRollMode || zoomLevelParam) {
|
|
613
|
+
// Determine zoom level from parameter or threshold
|
|
614
|
+
const zoomLevel = zoomLevelParam || thresholdToZoomLevel(params.threshold ?? 0.25); // MED-36 FIX: Standardized to 0.25
|
|
615
|
+
const zoomConfig = ZOOM_CONFIGS[zoomLevel];
|
|
616
|
+
logger.info({
|
|
617
|
+
query: params.query,
|
|
618
|
+
zoomLevel,
|
|
619
|
+
resultCount: results.length,
|
|
620
|
+
threshold: zoomConfig.threshold
|
|
621
|
+
}, '[CodePointers] Camera roll mode enabled');
|
|
622
|
+
// Convert results to camera roll format
|
|
623
|
+
const cameraRollItems = results.map(result => {
|
|
624
|
+
// Register in drilldown registry
|
|
625
|
+
const codeId = result.file_path + (result.name ? `:${result.name}` : '');
|
|
626
|
+
const drilldownID = drilldownRegistry.register(codeId, 'code');
|
|
627
|
+
// Truncate content based on zoom level
|
|
628
|
+
let content = result.content_preview;
|
|
629
|
+
if (content.length > zoomConfig.contentPreview) {
|
|
630
|
+
content = content.substring(0, zoomConfig.contentPreview) + '...';
|
|
631
|
+
}
|
|
632
|
+
// Apply ROUND-TRIP VERIFIED compression based on zoom level
|
|
633
|
+
// User feedback: "English that couldn't be preserved stays as English"
|
|
634
|
+
if (zoomConfig.compression === 'full') {
|
|
635
|
+
const compressed = smartCompress(content, { threshold: 0.75 });
|
|
636
|
+
content = compressed.result;
|
|
637
|
+
}
|
|
638
|
+
else if (zoomConfig.compression === 'light') {
|
|
639
|
+
const compressed = smartCompress(content, { threshold: 0.85 });
|
|
640
|
+
content = compressed.result;
|
|
641
|
+
}
|
|
642
|
+
// CLEAN OUTPUT: Essential fields + tracebacks for code navigation
|
|
643
|
+
return {
|
|
644
|
+
content,
|
|
645
|
+
drilldownID,
|
|
646
|
+
memoryID: codeId,
|
|
647
|
+
similarity: Math.round(result.similarity * 100) / 100,
|
|
648
|
+
role: 'code',
|
|
649
|
+
// Include tracebacks (callers/callees) for code navigation
|
|
650
|
+
callers: result.callers?.map(c => c.source_file_path) || [],
|
|
651
|
+
callees: result.callees?.map(c => c.target_path) || []
|
|
652
|
+
};
|
|
653
|
+
});
|
|
654
|
+
// Format as camera roll response - CLEAN, no extra fields
|
|
655
|
+
const cameraRollResponse = formatAsCameraRollResponse(cameraRollItems, params.query, zoomLevel, 'code');
|
|
656
|
+
// Return directly - no extra zoom/attribution bloat
|
|
657
|
+
return cameraRollResponse;
|
|
658
|
+
}
|
|
659
|
+
// ALWAYS use humanReadable mode - never use XML
|
|
660
|
+
// Hook-style output with [SPECMEM-FIND-CODE-POINTERS] tags matching smart-context-hook format
|
|
661
|
+
// humanReadable parameter is ignored - always true for consistency
|
|
662
|
+
if (true) {
|
|
663
|
+
const humanReadableData = results.map(r => ({
|
|
664
|
+
file: r.file_path,
|
|
665
|
+
line: r.line_range?.start || 0,
|
|
666
|
+
name: r.name,
|
|
667
|
+
definitionType: r.definition_type,
|
|
668
|
+
language: r.language,
|
|
669
|
+
signature: r.signature,
|
|
670
|
+
content: r.content_preview,
|
|
671
|
+
similarity: r.similarity,
|
|
672
|
+
drilldownID: r.drilldownID,
|
|
673
|
+
// Include tracebacks for zoom-based display
|
|
674
|
+
callers: r.callers?.map(c => c.source_file_path) || [],
|
|
675
|
+
callees: r.callees?.map(c => c.target_path) || []
|
|
676
|
+
}));
|
|
677
|
+
return formatHumanReadable('find_code_pointers', humanReadableData, {
|
|
678
|
+
grey: true,
|
|
679
|
+
showSimilarity: true,
|
|
680
|
+
maxContentLength: params.maxContentLength || 300,
|
|
681
|
+
query: params.query, // Pass query for header display
|
|
682
|
+
showTracebacks: shouldIncludeTracebacks // Show tracebacks based on zoom
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
// Broadcast COT result to dashboard
|
|
686
|
+
cotResult('find_code', `Found ${results.length} code pointers`, results.length);
|
|
687
|
+
// Human readable output always returned above - this is unreachable
|
|
688
|
+
// (kept for type safety, but if (true) block above always returns)
|
|
689
|
+
return { results: [], query: params.query, total_found: 0 };
|
|
690
|
+
}
|
|
691
|
+
catch (error) {
|
|
692
|
+
// Broadcast COT error to dashboard
|
|
693
|
+
cotError('find_code', error?.message?.slice(0, 100) || 'Unknown error');
|
|
694
|
+
// FIXER AGENT 7 & 8: Improved error handling with socket path logging and better timeout messages
|
|
695
|
+
const duration = Date.now() - startTime;
|
|
696
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
697
|
+
// FIXER AGENT 7: Get socket info for debugging - same detection as find_memory
|
|
698
|
+
const socketPath = getEmbeddingSocketPath();
|
|
699
|
+
const socketInfo = getSocketSearchInfo();
|
|
700
|
+
// Determine error type for better messaging
|
|
701
|
+
const isTimeout = errorMessage.toLowerCase().includes('timeout') ||
|
|
702
|
+
errorMessage.toLowerCase().includes('timed out');
|
|
703
|
+
const isConnection = errorMessage.toLowerCase().includes('econnrefused') ||
|
|
704
|
+
errorMessage.toLowerCase().includes('econnreset') ||
|
|
705
|
+
errorMessage.toLowerCase().includes('socket');
|
|
706
|
+
const isQoms = errorMessage.toLowerCase().includes('qoms');
|
|
707
|
+
let enhancedMessage = errorMessage;
|
|
708
|
+
let troubleshooting = '';
|
|
709
|
+
// FIXER AGENT 7: Use dynamic socket path instead of hardcoded path
|
|
710
|
+
if (isTimeout) {
|
|
711
|
+
troubleshooting = `
|
|
712
|
+
Troubleshooting timeout:
|
|
713
|
+
Socket path: ${socketPath}
|
|
714
|
+
Socket found: ${socketInfo.foundSocket ? 'YES' : 'NO'}
|
|
715
|
+
1. Check if embedding service is running: ps aux | grep frankenstein
|
|
716
|
+
2. Check socket exists: ls -la ${socketPath}
|
|
717
|
+
3. Increase timeout: export SPECMEM_CODE_SEARCH_TIMEOUT=60000 (60s)
|
|
718
|
+
4. Increase retries: export SPECMEM_CODE_SEARCH_RETRIES=3`;
|
|
719
|
+
}
|
|
720
|
+
else if (isConnection) {
|
|
721
|
+
troubleshooting = `
|
|
722
|
+
Troubleshooting connection error:
|
|
723
|
+
Socket path: ${socketPath}
|
|
724
|
+
Socket found: ${socketInfo.foundSocket ? 'YES' : 'NO'}
|
|
725
|
+
Searched locations: ${socketInfo.searchedLocations.map(l => l.path).join(', ')}
|
|
726
|
+
1. Restart embedding service: ./start-sandbox.sh
|
|
727
|
+
2. Check Docker is running: docker ps
|
|
728
|
+
3. Verify socket permissions: ls -la ${socketPath}`;
|
|
729
|
+
}
|
|
730
|
+
else if (isQoms) {
|
|
731
|
+
troubleshooting = `
|
|
732
|
+
Troubleshooting QOMS resource error:
|
|
733
|
+
1. System may be under heavy load - wait and retry
|
|
734
|
+
2. Increase max wait: export SPECMEM_MAX_WAIT_MS=60000
|
|
735
|
+
3. Check system resources: top -bn1 | head -20`;
|
|
736
|
+
}
|
|
737
|
+
// FIXER AGENT 7: Enhanced error logging with socket path info
|
|
738
|
+
logger.error({
|
|
739
|
+
error: errorMessage,
|
|
740
|
+
query: params.query,
|
|
741
|
+
duration,
|
|
742
|
+
timeoutMs,
|
|
743
|
+
isTimeout,
|
|
744
|
+
isConnection,
|
|
745
|
+
isQoms,
|
|
746
|
+
socketPath,
|
|
747
|
+
socketFound: socketInfo.foundSocket,
|
|
748
|
+
projectDirName: socketInfo.projectDirName
|
|
749
|
+
}, `[CodePointers] Search failed after ${duration}ms${troubleshooting ? ' - see logs for troubleshooting' : ''}`);
|
|
750
|
+
// SPECMEM_DEBUG: Log all searched socket locations for debugging
|
|
751
|
+
if (process.env['SPECMEM_DEBUG']) {
|
|
752
|
+
logger.debug({
|
|
753
|
+
searchedLocations: socketInfo.searchedLocations,
|
|
754
|
+
projectHash: socketInfo.projectHash,
|
|
755
|
+
specmemRoot: socketInfo.specmemRoot,
|
|
756
|
+
specmemHome: socketInfo.specmemHome
|
|
757
|
+
}, '[CodePointers] SPECMEM_DEBUG: Socket search details');
|
|
758
|
+
}
|
|
759
|
+
// Re-throw with enhanced message
|
|
760
|
+
if (troubleshooting) {
|
|
761
|
+
const enhancedError = new Error(`[CodePointers] Search failed: ${errorMessage}\n${troubleshooting}`);
|
|
762
|
+
enhancedError.originalError = error;
|
|
763
|
+
throw enhancedError;
|
|
764
|
+
}
|
|
765
|
+
throw error;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
// ============================================================================
|
|
769
|
+
// SEARCH METHODS
|
|
770
|
+
// ============================================================================
|
|
771
|
+
async searchFiles(embedding, params, limit, threshold) {
|
|
772
|
+
const conditions = ['embedding IS NOT NULL'];
|
|
773
|
+
const queryParams = [];
|
|
774
|
+
let paramIndex = 1;
|
|
775
|
+
// Embedding for similarity
|
|
776
|
+
queryParams.push(`[${embedding.join(',')}]`);
|
|
777
|
+
paramIndex++;
|
|
778
|
+
// CROSS-PROJECT SUPPORT: Project filtering (skipped if allProjects=true)
|
|
779
|
+
const projectFilter = this.buildProjectClause(params, paramIndex);
|
|
780
|
+
if (projectFilter.param) {
|
|
781
|
+
conditions.push(projectFilter.clause);
|
|
782
|
+
queryParams.push(projectFilter.param);
|
|
783
|
+
paramIndex++;
|
|
784
|
+
}
|
|
785
|
+
// EXCLUDE data directories and nested copies - only search actual code
|
|
786
|
+
conditions.push(`file_path NOT LIKE '%data/%'`); // Any data directory
|
|
787
|
+
conditions.push(`file_path NOT LIKE '%/backups/%'`);
|
|
788
|
+
conditions.push(`file_path NOT LIKE '%/node_modules/%'`);
|
|
789
|
+
conditions.push(`file_path NOT LIKE '%.json'`); // Exclude JSON data files
|
|
790
|
+
conditions.push(`file_path NOT LIKE '%.txt'`); // Exclude text files (prompts, logs)
|
|
791
|
+
conditions.push(`file_path NOT LIKE '%.log'`); // Exclude log files
|
|
792
|
+
conditions.push(`file_path NOT LIKE '%.md'`); // Exclude markdown (docs)
|
|
793
|
+
conditions.push(`file_path NOT LIKE '%/dist/%'`); // Exclude compiled output
|
|
794
|
+
// FIX: Exclude nested mcp/ directories (contain duplicate copies of codebase)
|
|
795
|
+
conditions.push(`file_path NOT LIKE 'mcp/%'`); // Nested mcp server copies
|
|
796
|
+
conditions.push(`file_path NOT LIKE '%SpecmemcSrc-%'`); // Backup copies
|
|
797
|
+
// Language filter
|
|
798
|
+
if (params.language) {
|
|
799
|
+
conditions.push(`LOWER(language_name) = LOWER($${paramIndex})`);
|
|
800
|
+
queryParams.push(params.language);
|
|
801
|
+
paramIndex++;
|
|
802
|
+
}
|
|
803
|
+
// File pattern filter
|
|
804
|
+
if (params.filePattern) {
|
|
805
|
+
conditions.push(`file_path LIKE $${paramIndex}`);
|
|
806
|
+
queryParams.push(params.filePattern.replace(/\*/g, '%'));
|
|
807
|
+
paramIndex++;
|
|
808
|
+
}
|
|
809
|
+
// Threshold
|
|
810
|
+
queryParams.push(threshold);
|
|
811
|
+
const thresholdParam = paramIndex++;
|
|
812
|
+
// Limit
|
|
813
|
+
queryParams.push(limit);
|
|
814
|
+
const limitParam = paramIndex;
|
|
815
|
+
const query = `
|
|
816
|
+
SELECT
|
|
817
|
+
id, file_path, file_name, language_name, content, line_count,
|
|
818
|
+
1 - (embedding <=> $1::vector) AS similarity
|
|
819
|
+
FROM codebase_files
|
|
820
|
+
WHERE ${conditions.join(' AND ')}
|
|
821
|
+
AND 1 - (embedding <=> $1::vector) >= $${thresholdParam}
|
|
822
|
+
ORDER BY similarity DESC
|
|
823
|
+
LIMIT $${limitParam}
|
|
824
|
+
`;
|
|
825
|
+
const result = await this.db.query(query, queryParams);
|
|
826
|
+
return result.rows;
|
|
827
|
+
}
|
|
828
|
+
async searchDefinitions(embedding, params, limit, threshold) {
|
|
829
|
+
const conditions = ['embedding IS NOT NULL'];
|
|
830
|
+
const queryParams = [];
|
|
831
|
+
let paramIndex = 1;
|
|
832
|
+
// Embedding for similarity
|
|
833
|
+
queryParams.push(`[${embedding.join(',')}]`);
|
|
834
|
+
paramIndex++;
|
|
835
|
+
// CROSS-PROJECT SUPPORT: Project filtering (skipped if allProjects=true)
|
|
836
|
+
const projectFilter = this.buildProjectClause(params, paramIndex);
|
|
837
|
+
if (projectFilter.param) {
|
|
838
|
+
conditions.push(projectFilter.clause);
|
|
839
|
+
queryParams.push(projectFilter.param);
|
|
840
|
+
paramIndex++;
|
|
841
|
+
}
|
|
842
|
+
// FIX: Exclude nested copies and data directories
|
|
843
|
+
conditions.push(`file_path NOT LIKE 'mcp/%'`); // Nested mcp server copies
|
|
844
|
+
conditions.push(`file_path NOT LIKE '%SpecmemcSrc-%'`); // Backup copies
|
|
845
|
+
conditions.push(`file_path NOT LIKE '%/dist/%'`); // Compiled output
|
|
846
|
+
// Language filter
|
|
847
|
+
if (params.language) {
|
|
848
|
+
conditions.push(`LOWER(language) = LOWER($${paramIndex})`);
|
|
849
|
+
queryParams.push(params.language);
|
|
850
|
+
paramIndex++;
|
|
851
|
+
}
|
|
852
|
+
// Definition type filter
|
|
853
|
+
if (params.definitionTypes?.length) {
|
|
854
|
+
conditions.push(`definition_type = ANY($${paramIndex}::text[])`);
|
|
855
|
+
queryParams.push(params.definitionTypes);
|
|
856
|
+
paramIndex++;
|
|
857
|
+
}
|
|
858
|
+
// File pattern filter
|
|
859
|
+
if (params.filePattern) {
|
|
860
|
+
conditions.push(`file_path LIKE $${paramIndex}`);
|
|
861
|
+
queryParams.push(params.filePattern.replace(/\*/g, '%'));
|
|
862
|
+
paramIndex++;
|
|
863
|
+
}
|
|
864
|
+
// Threshold
|
|
865
|
+
queryParams.push(threshold);
|
|
866
|
+
const thresholdParam = paramIndex++;
|
|
867
|
+
// Limit
|
|
868
|
+
queryParams.push(limit);
|
|
869
|
+
const limitParam = paramIndex;
|
|
870
|
+
const query = `
|
|
871
|
+
SELECT
|
|
872
|
+
id, file_path, name, qualified_name, definition_type,
|
|
873
|
+
start_line, end_line, signature, docstring,
|
|
874
|
+
1 - (embedding <=> $1::vector) AS similarity
|
|
875
|
+
FROM code_definitions
|
|
876
|
+
WHERE ${conditions.join(' AND ')}
|
|
877
|
+
AND 1 - (embedding <=> $1::vector) >= $${thresholdParam}
|
|
878
|
+
ORDER BY similarity DESC
|
|
879
|
+
LIMIT $${limitParam}
|
|
880
|
+
`;
|
|
881
|
+
const result = await this.db.query(query, queryParams);
|
|
882
|
+
return result.rows;
|
|
883
|
+
}
|
|
884
|
+
// ============================================================================
|
|
885
|
+
// TRACEBACK METHODS
|
|
886
|
+
// ============================================================================
|
|
887
|
+
/**
|
|
888
|
+
* Add traceback information to results
|
|
889
|
+
* @param results - Code search results to enrich
|
|
890
|
+
* @param depth - Traceback depth config from zoomToTracebackDepth()
|
|
891
|
+
* If not provided, uses default (3 callers, 3 callees)
|
|
892
|
+
*/
|
|
893
|
+
async addTracebacks(results, depth) {
|
|
894
|
+
const filePaths = [...new Set(results.map(r => r.file_path))];
|
|
895
|
+
if (filePaths.length === 0)
|
|
896
|
+
return;
|
|
897
|
+
// Use provided depth or default to 3 each
|
|
898
|
+
const maxCallers = depth?.maxCallers ?? 3;
|
|
899
|
+
const maxCallees = depth?.maxCallees ?? 3;
|
|
900
|
+
// Get project path for filtering
|
|
901
|
+
const projectPath = getProjectContext().getProjectPath();
|
|
902
|
+
try {
|
|
903
|
+
// Get callers (who imports these files) - filtered by project
|
|
904
|
+
const callersQuery = `
|
|
905
|
+
SELECT source_file_path, target_path, import_type, imported_names, line_number
|
|
906
|
+
FROM code_dependencies
|
|
907
|
+
WHERE (resolved_path = ANY($1::text[])
|
|
908
|
+
OR target_path = ANY($1::text[]))
|
|
909
|
+
AND project_path = $2
|
|
910
|
+
ORDER BY source_file_path
|
|
911
|
+
`;
|
|
912
|
+
const callersResult = await this.db.query(callersQuery, [filePaths, projectPath]);
|
|
913
|
+
// Get callees (what these files import) - filtered by project
|
|
914
|
+
const calleesQuery = `
|
|
915
|
+
SELECT source_file_path, target_path, import_type, imported_names, line_number
|
|
916
|
+
FROM code_dependencies
|
|
917
|
+
WHERE source_file_path = ANY($1::text[])
|
|
918
|
+
AND project_path = $2
|
|
919
|
+
ORDER BY target_path
|
|
920
|
+
`;
|
|
921
|
+
const calleesResult = await this.db.query(calleesQuery, [filePaths, projectPath]);
|
|
922
|
+
// Map back to results - DEDUPLICATE by source_file_path to avoid repeated imports
|
|
923
|
+
const callersMap = new Map();
|
|
924
|
+
const calleesMap = new Map();
|
|
925
|
+
// Track seen source paths for deduplication
|
|
926
|
+
const seenCallers = new Map();
|
|
927
|
+
const seenCallees = new Map();
|
|
928
|
+
for (const row of callersResult.rows) {
|
|
929
|
+
const key = row.target_path;
|
|
930
|
+
if (!callersMap.has(key)) {
|
|
931
|
+
callersMap.set(key, []);
|
|
932
|
+
seenCallers.set(key, new Set());
|
|
933
|
+
}
|
|
934
|
+
// DEDUPE: Only add if we haven't seen this source_file_path before
|
|
935
|
+
if (!seenCallers.get(key).has(row.source_file_path)) {
|
|
936
|
+
seenCallers.get(key).add(row.source_file_path);
|
|
937
|
+
callersMap.get(key).push(row);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
for (const row of calleesResult.rows) {
|
|
941
|
+
const key = row.source_file_path;
|
|
942
|
+
if (!calleesMap.has(key)) {
|
|
943
|
+
calleesMap.set(key, []);
|
|
944
|
+
seenCallees.set(key, new Set());
|
|
945
|
+
}
|
|
946
|
+
// DEDUPE: Only add if we haven't seen this target_path before
|
|
947
|
+
if (!seenCallees.get(key).has(row.target_path)) {
|
|
948
|
+
seenCallees.get(key).add(row.target_path);
|
|
949
|
+
calleesMap.get(key).push(row);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
// Attach to results - use zoom-based depth limits
|
|
953
|
+
for (const result of results) {
|
|
954
|
+
result.callers = (callersMap.get(result.file_path) || []).slice(0, maxCallers);
|
|
955
|
+
result.callees = (calleesMap.get(result.file_path) || []).slice(0, maxCallees);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
catch (error) {
|
|
959
|
+
logger.warn({ error }, '[CodePointers] Failed to get tracebacks');
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
// ============================================================================
|
|
963
|
+
// I5 FIX: KEYWORD FALLBACK AND RECENT FILES
|
|
964
|
+
// ============================================================================
|
|
965
|
+
/**
|
|
966
|
+
* I5 FIX: Keyword fallback search for code files
|
|
967
|
+
* When embeddings return nothing, do ILIKE search on file paths and content
|
|
968
|
+
*/
|
|
969
|
+
async keywordSearchFiles(query, params) {
|
|
970
|
+
logger.info({ query, allProjects: params.allProjects }, '[I5 FIX] Performing keyword fallback search for code');
|
|
971
|
+
const limit = params.limit ?? 10;
|
|
972
|
+
// Extract keywords from query
|
|
973
|
+
const keywords = query.toLowerCase()
|
|
974
|
+
.split(/\s+/)
|
|
975
|
+
.filter(w => w.length >= 3)
|
|
976
|
+
.slice(0, 5);
|
|
977
|
+
if (keywords.length === 0) {
|
|
978
|
+
return [];
|
|
979
|
+
}
|
|
980
|
+
// CROSS-PROJECT SUPPORT: Build conditions with optional project filter
|
|
981
|
+
const conditions = [];
|
|
982
|
+
const queryParams = [];
|
|
983
|
+
let paramIndex = 1;
|
|
984
|
+
const projectFilter = this.buildProjectClause(params, paramIndex);
|
|
985
|
+
if (projectFilter.param) {
|
|
986
|
+
conditions.push(projectFilter.clause);
|
|
987
|
+
queryParams.push(projectFilter.param);
|
|
988
|
+
paramIndex++;
|
|
989
|
+
}
|
|
990
|
+
// FIX: Exclude nested copies and data directories
|
|
991
|
+
conditions.push(`file_path NOT LIKE 'mcp/%'`);
|
|
992
|
+
conditions.push(`file_path NOT LIKE '%SpecmemcSrc-%'`);
|
|
993
|
+
conditions.push(`file_path NOT LIKE '%/dist/%'`);
|
|
994
|
+
conditions.push(`file_path NOT LIKE '%data/%'`);
|
|
995
|
+
// Search in both file_path and content
|
|
996
|
+
const keywordConditions = keywords.map((kw, idx) => {
|
|
997
|
+
queryParams.push(`%${kw}%`);
|
|
998
|
+
const pIdx = paramIndex + idx;
|
|
999
|
+
return `(file_path ILIKE $${pIdx} OR content ILIKE $${pIdx})`;
|
|
1000
|
+
});
|
|
1001
|
+
conditions.push(`(${keywordConditions.join(' OR ')})`);
|
|
1002
|
+
paramIndex += keywords.length;
|
|
1003
|
+
// Language filter
|
|
1004
|
+
if (params.language) {
|
|
1005
|
+
conditions.push(`LOWER(language_name) = LOWER($${paramIndex})`);
|
|
1006
|
+
queryParams.push(params.language);
|
|
1007
|
+
paramIndex++;
|
|
1008
|
+
}
|
|
1009
|
+
queryParams.push(limit);
|
|
1010
|
+
const limitParam = paramIndex;
|
|
1011
|
+
const searchQuery = `
|
|
1012
|
+
SELECT
|
|
1013
|
+
id, file_path, file_name, language_name, content, line_count,
|
|
1014
|
+
0.25 AS similarity -- Fixed similarity for keyword matches
|
|
1015
|
+
FROM codebase_files
|
|
1016
|
+
WHERE ${conditions.join(' AND ')}
|
|
1017
|
+
ORDER BY updated_at DESC
|
|
1018
|
+
LIMIT $${limitParam}
|
|
1019
|
+
`;
|
|
1020
|
+
try {
|
|
1021
|
+
const result = await this.db.query(searchQuery, queryParams);
|
|
1022
|
+
logger.info({
|
|
1023
|
+
keywords,
|
|
1024
|
+
resultsFound: result.rows.length
|
|
1025
|
+
}, '[I5 FIX] Code keyword fallback complete');
|
|
1026
|
+
return result.rows.map(f => this.fileToResult(f, params));
|
|
1027
|
+
}
|
|
1028
|
+
catch (error) {
|
|
1029
|
+
logger.error({ error, keywords }, '[I5 FIX] Code keyword fallback failed');
|
|
1030
|
+
return [];
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* I5 FIX: Get recently modified code files
|
|
1035
|
+
*/
|
|
1036
|
+
async getRecentCodeFiles(count, params) {
|
|
1037
|
+
if (count <= 0)
|
|
1038
|
+
return [];
|
|
1039
|
+
logger.info({ count, allProjects: params.allProjects }, '[I5 FIX] Fetching recent code files');
|
|
1040
|
+
// CROSS-PROJECT SUPPORT: Build conditions with optional project filter
|
|
1041
|
+
const conditions = [];
|
|
1042
|
+
const queryParams = [];
|
|
1043
|
+
let paramIndex = 1;
|
|
1044
|
+
const projectFilter = this.buildProjectClause(params, paramIndex);
|
|
1045
|
+
if (projectFilter.param) {
|
|
1046
|
+
conditions.push(projectFilter.clause);
|
|
1047
|
+
queryParams.push(projectFilter.param);
|
|
1048
|
+
paramIndex++;
|
|
1049
|
+
}
|
|
1050
|
+
// FIX: Exclude nested copies and data directories
|
|
1051
|
+
conditions.push(`file_path NOT LIKE 'mcp/%'`);
|
|
1052
|
+
conditions.push(`file_path NOT LIKE '%SpecmemcSrc-%'`);
|
|
1053
|
+
conditions.push(`file_path NOT LIKE '%/dist/%'`);
|
|
1054
|
+
conditions.push(`file_path NOT LIKE '%data/%'`);
|
|
1055
|
+
// Language filter
|
|
1056
|
+
if (params.language) {
|
|
1057
|
+
conditions.push(`LOWER(language_name) = LOWER($${paramIndex})`);
|
|
1058
|
+
queryParams.push(params.language);
|
|
1059
|
+
paramIndex++;
|
|
1060
|
+
}
|
|
1061
|
+
queryParams.push(count);
|
|
1062
|
+
const limitParam = paramIndex;
|
|
1063
|
+
const query = `
|
|
1064
|
+
SELECT
|
|
1065
|
+
id, file_path, file_name, language_name, content, line_count,
|
|
1066
|
+
0.4 AS similarity -- Fixed similarity for recent files
|
|
1067
|
+
FROM codebase_files
|
|
1068
|
+
WHERE ${conditions.join(' AND ')}
|
|
1069
|
+
ORDER BY updated_at DESC
|
|
1070
|
+
LIMIT $${limitParam}
|
|
1071
|
+
`;
|
|
1072
|
+
try {
|
|
1073
|
+
const result = await this.db.query(query, queryParams);
|
|
1074
|
+
logger.info({
|
|
1075
|
+
recentFound: result.rows.length
|
|
1076
|
+
}, '[I5 FIX] Recent code files retrieved');
|
|
1077
|
+
return result.rows.map(f => this.fileToResult(f, params));
|
|
1078
|
+
}
|
|
1079
|
+
catch (error) {
|
|
1080
|
+
logger.error({ error }, '[I5 FIX] Failed to get recent code files');
|
|
1081
|
+
return [];
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* I5 FIX: Merge and dedupe code search results
|
|
1086
|
+
*/
|
|
1087
|
+
mergeCodeResults(semanticResults, recentResults, keywordResults, limit) {
|
|
1088
|
+
const seenPaths = new Set();
|
|
1089
|
+
const merged = [];
|
|
1090
|
+
// Add semantic results first
|
|
1091
|
+
for (const result of semanticResults) {
|
|
1092
|
+
const key = result.file_path + (result.name || '');
|
|
1093
|
+
if (!seenPaths.has(key)) {
|
|
1094
|
+
seenPaths.add(key);
|
|
1095
|
+
merged.push(result);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
// Add recent results
|
|
1099
|
+
for (const result of recentResults) {
|
|
1100
|
+
const key = result.file_path + (result.name || '');
|
|
1101
|
+
if (!seenPaths.has(key)) {
|
|
1102
|
+
seenPaths.add(key);
|
|
1103
|
+
merged.push({ ...result, _source: 'recent' });
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
// Add keyword results
|
|
1107
|
+
for (const result of keywordResults) {
|
|
1108
|
+
const key = result.file_path + (result.name || '');
|
|
1109
|
+
if (!seenPaths.has(key)) {
|
|
1110
|
+
seenPaths.add(key);
|
|
1111
|
+
merged.push({ ...result, _source: 'keyword' });
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return merged
|
|
1115
|
+
.sort((a, b) => b.similarity - a.similarity)
|
|
1116
|
+
.slice(0, limit);
|
|
1117
|
+
}
|
|
1118
|
+
// ============================================================================
|
|
1119
|
+
// AUTO-DEDUPLICATION
|
|
1120
|
+
// ============================================================================
|
|
1121
|
+
/**
|
|
1122
|
+
* Remove duplicate results by file name, keeping the shortest path (canonical version)
|
|
1123
|
+
* This handles cases where the same file is indexed from multiple paths:
|
|
1124
|
+
* - src/db/foo.ts (canonical - shortest)
|
|
1125
|
+
* - mcp/specmem/src/db/foo.ts (duplicate - longer path)
|
|
1126
|
+
* - mcp/specmem/backup/src/db/foo.ts (duplicate - even longer)
|
|
1127
|
+
*/
|
|
1128
|
+
dedupeResults(results) {
|
|
1129
|
+
const byFileName = new Map();
|
|
1130
|
+
for (const result of results) {
|
|
1131
|
+
// Extract just the filename from the path
|
|
1132
|
+
const fileName = result.file_path.split('/').pop() || result.file_path;
|
|
1133
|
+
// For definitions, include the name to avoid deduping different functions in same-named files
|
|
1134
|
+
const key = result.type === 'definition'
|
|
1135
|
+
? `${fileName}:${result.name || ''}`
|
|
1136
|
+
: fileName;
|
|
1137
|
+
const existing = byFileName.get(key);
|
|
1138
|
+
if (!existing) {
|
|
1139
|
+
byFileName.set(key, result);
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
// Keep the one with shorter path (more canonical) or higher similarity
|
|
1143
|
+
const existingPathLen = existing.file_path.length;
|
|
1144
|
+
const newPathLen = result.file_path.length;
|
|
1145
|
+
if (newPathLen < existingPathLen ||
|
|
1146
|
+
(newPathLen === existingPathLen && result.similarity > existing.similarity)) {
|
|
1147
|
+
byFileName.set(key, result);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return Array.from(byFileName.values());
|
|
1152
|
+
}
|
|
1153
|
+
// ============================================================================
|
|
1154
|
+
// RESULT FORMATTING
|
|
1155
|
+
// ============================================================================
|
|
1156
|
+
/**
|
|
1157
|
+
* Calculate content length from zoom parameter (0-100)
|
|
1158
|
+
*
|
|
1159
|
+
* Zoom 0 = signature only (100 chars)
|
|
1160
|
+
* Zoom 25 = minimal (300 chars)
|
|
1161
|
+
* Zoom 50 = balanced (800 chars) - default
|
|
1162
|
+
* Zoom 75 = detailed (1500 chars)
|
|
1163
|
+
* Zoom 100 = full context (unlimited)
|
|
1164
|
+
*
|
|
1165
|
+
* User asked for MORE content, not less - so we're generous here.
|
|
1166
|
+
*/
|
|
1167
|
+
zoomToContentLength(zoom) {
|
|
1168
|
+
// Clamp zoom to 0-100 range
|
|
1169
|
+
const clampedZoom = Math.max(0, Math.min(100, zoom));
|
|
1170
|
+
// At max zoom, no truncation
|
|
1171
|
+
if (clampedZoom >= 100) {
|
|
1172
|
+
return Infinity;
|
|
1173
|
+
}
|
|
1174
|
+
// Linear scaling for predictability: 100 + (zoom * 20)
|
|
1175
|
+
// This gives us: 0->100, 25->600, 50->1100, 75->1600, 99->2080
|
|
1176
|
+
return 100 + (clampedZoom * 20);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Check if zoom level is low enough to show signature only
|
|
1180
|
+
* Signature-only mode kicks in at zoom < 20
|
|
1181
|
+
*/
|
|
1182
|
+
isSignatureOnlyZoom(zoom) {
|
|
1183
|
+
return zoom < 20;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Convert numeric zoom (0-100) to descriptive label
|
|
1187
|
+
*/
|
|
1188
|
+
getZoomLabel(zoom) {
|
|
1189
|
+
if (zoom <= 10)
|
|
1190
|
+
return 'macro'; // Very zoomed in, minimal results
|
|
1191
|
+
if (zoom <= 30)
|
|
1192
|
+
return 'close'; // Close-up view
|
|
1193
|
+
if (zoom <= 60)
|
|
1194
|
+
return 'normal'; // Standard view
|
|
1195
|
+
if (zoom <= 80)
|
|
1196
|
+
return 'wide'; // Wide view, more results
|
|
1197
|
+
return 'ultra-wide'; // Panoramic, maximum results
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Convert zoom level to traceback depth configuration
|
|
1201
|
+
*
|
|
1202
|
+
* Camera Roll / Gallery Mode traceback control:
|
|
1203
|
+
* - zoom 0-25: NO tracebacks (signature only view)
|
|
1204
|
+
* - zoom 25-50: minimal tracebacks (1 caller, 1 callee)
|
|
1205
|
+
* - zoom 50-75: summary tracebacks (3 callers, 3 callees)
|
|
1206
|
+
* - zoom 75-100: FULL tracebacks (all callers, all callees)
|
|
1207
|
+
*
|
|
1208
|
+
* @returns { include: boolean, maxCallers: number, maxCallees: number }
|
|
1209
|
+
*/
|
|
1210
|
+
zoomToTracebackDepth(zoom) {
|
|
1211
|
+
const clampedZoom = Math.max(0, Math.min(100, zoom));
|
|
1212
|
+
if (clampedZoom < 25) {
|
|
1213
|
+
// zoom 0-25: NO tracebacks
|
|
1214
|
+
return { include: false, maxCallers: 0, maxCallees: 0 };
|
|
1215
|
+
}
|
|
1216
|
+
else if (clampedZoom < 50) {
|
|
1217
|
+
// zoom 25-50: minimal tracebacks
|
|
1218
|
+
return { include: true, maxCallers: 1, maxCallees: 1 };
|
|
1219
|
+
}
|
|
1220
|
+
else if (clampedZoom < 75) {
|
|
1221
|
+
// zoom 50-75: summary tracebacks
|
|
1222
|
+
return { include: true, maxCallers: 3, maxCallees: 3 };
|
|
1223
|
+
}
|
|
1224
|
+
else {
|
|
1225
|
+
// zoom 75-100: FULL tracebacks
|
|
1226
|
+
return { include: true, maxCallers: 10, maxCallees: 10 };
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
fileToResult(file, params) {
|
|
1230
|
+
// Use zoom parameter to determine content length (default zoom=50 -> 500 chars)
|
|
1231
|
+
const zoom = params.zoom ?? 50;
|
|
1232
|
+
const zoomBasedMaxLen = this.zoomToContentLength(zoom);
|
|
1233
|
+
// maxContentLength overrides zoom if explicitly set
|
|
1234
|
+
const maxLen = params.maxContentLength && params.maxContentLength > 0
|
|
1235
|
+
? params.maxContentLength
|
|
1236
|
+
: zoomBasedMaxLen;
|
|
1237
|
+
let content = file.content;
|
|
1238
|
+
// Apply zoom-based truncation
|
|
1239
|
+
if (maxLen !== Infinity && content.length > maxLen) {
|
|
1240
|
+
content = content.substring(0, maxLen) + '...';
|
|
1241
|
+
}
|
|
1242
|
+
return {
|
|
1243
|
+
type: 'file',
|
|
1244
|
+
file_path: file.file_path,
|
|
1245
|
+
content_preview: content,
|
|
1246
|
+
similarity: Math.round(file.similarity * 100) / 100
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
definitionToResult(def, params) {
|
|
1250
|
+
// Use zoom parameter to determine content length (default zoom=50 -> 500 chars)
|
|
1251
|
+
const zoom = params.zoom ?? 50;
|
|
1252
|
+
const signatureOnly = this.isSignatureOnlyZoom(zoom);
|
|
1253
|
+
const zoomBasedMaxLen = this.zoomToContentLength(zoom);
|
|
1254
|
+
// maxContentLength overrides zoom if explicitly set
|
|
1255
|
+
const maxLen = params.maxContentLength && params.maxContentLength > 0
|
|
1256
|
+
? params.maxContentLength
|
|
1257
|
+
: zoomBasedMaxLen;
|
|
1258
|
+
// Build content preview from signature + docstring
|
|
1259
|
+
let content = '';
|
|
1260
|
+
// At low zoom (< 20), only show signature
|
|
1261
|
+
if (signatureOnly) {
|
|
1262
|
+
content = def.signature || `${def.definition_type} ${def.name}`;
|
|
1263
|
+
}
|
|
1264
|
+
else {
|
|
1265
|
+
// HIGH ZOOM (>= 20): Try to read actual code from file
|
|
1266
|
+
// This makes find_code_pointers self-sufficient - no drill_down needed!
|
|
1267
|
+
if (zoom >= 60 && def.file_path && def.start_line && def.end_line) {
|
|
1268
|
+
try {
|
|
1269
|
+
const fs = require('fs');
|
|
1270
|
+
const path = require('path');
|
|
1271
|
+
const projectPath = process.env.SPECMEM_PROJECT_PATH || process.cwd();
|
|
1272
|
+
const fullPath = path.isAbsolute(def.file_path)
|
|
1273
|
+
? def.file_path
|
|
1274
|
+
: path.join(projectPath, def.file_path);
|
|
1275
|
+
if (fs.existsSync(fullPath)) {
|
|
1276
|
+
const fileContent = fs.readFileSync(fullPath, 'utf8');
|
|
1277
|
+
const lines = fileContent.split('\n');
|
|
1278
|
+
// Get lines from start to end (1-indexed in DB, 0-indexed in array)
|
|
1279
|
+
const startIdx = Math.max(0, def.start_line - 1);
|
|
1280
|
+
const endIdx = Math.min(lines.length, def.end_line);
|
|
1281
|
+
content = lines.slice(startIdx, endIdx).join('\n');
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
catch (e) {
|
|
1285
|
+
// Fall back to signature if file read fails
|
|
1286
|
+
logger.debug({ error: e, file: def.file_path }, 'Failed to read file for high-zoom code content');
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
// Fallback to signature + docstring if no file content
|
|
1290
|
+
if (!content) {
|
|
1291
|
+
if (def.signature) {
|
|
1292
|
+
content = def.signature;
|
|
1293
|
+
}
|
|
1294
|
+
if (def.docstring) {
|
|
1295
|
+
content += content ? '\n\n' + def.docstring : def.docstring;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
// Apply zoom-based truncation
|
|
1300
|
+
if (maxLen !== Infinity && content.length > maxLen) {
|
|
1301
|
+
content = content.substring(0, maxLen) + '...';
|
|
1302
|
+
}
|
|
1303
|
+
return {
|
|
1304
|
+
type: 'definition',
|
|
1305
|
+
file_path: def.file_path,
|
|
1306
|
+
name: def.qualified_name || def.name,
|
|
1307
|
+
definition_type: def.definition_type,
|
|
1308
|
+
content_preview: content || `${def.definition_type} ${def.name}`,
|
|
1309
|
+
similarity: Math.round(def.similarity * 100) / 100,
|
|
1310
|
+
line_range: { start: def.start_line, end: def.end_line }
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
// ============================================================================
|
|
1314
|
+
// GALLERY MODE
|
|
1315
|
+
// ============================================================================
|
|
1316
|
+
returnModeOptions(query) {
|
|
1317
|
+
const modeHelp = `
|
|
1318
|
+
# Search Mode Selection
|
|
1319
|
+
|
|
1320
|
+
Query: "${query}"
|
|
1321
|
+
|
|
1322
|
+
## ⚡ Basic Search (Recommended for quick lookups)
|
|
1323
|
+
- **Speed**: Fast (~100-500ms)
|
|
1324
|
+
- **Features**: Semantic similarity, tracebacks, file filtering
|
|
1325
|
+
- **Best for**: Finding specific code, understanding imports
|
|
1326
|
+
|
|
1327
|
+
## 🎨 Gallery Mode (Deep analysis)
|
|
1328
|
+
- **Speed**: Slower (~5-15s)
|
|
1329
|
+
- **Features**: Mini COT Chain-of-Thought analysis, relevance explanations
|
|
1330
|
+
- **Best for**: Understanding complex code, research synthesis
|
|
1331
|
+
|
|
1332
|
+
**To proceed, call find_code_pointers again with:**
|
|
1333
|
+
- \`galleryMode: false\` for Basic Search
|
|
1334
|
+
- \`galleryMode: true\` for Gallery Mode
|
|
1335
|
+
`;
|
|
1336
|
+
return {
|
|
1337
|
+
results: [{
|
|
1338
|
+
type: 'file',
|
|
1339
|
+
file_path: 'MODE_SELECTOR',
|
|
1340
|
+
content_preview: modeHelp,
|
|
1341
|
+
similarity: 1.0
|
|
1342
|
+
}],
|
|
1343
|
+
query,
|
|
1344
|
+
total_found: 0,
|
|
1345
|
+
search_type: 'semantic',
|
|
1346
|
+
attribution: SPECMEM_ATTRIBUTION
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
async processGalleryMode(query, results) {
|
|
1350
|
+
logger.info({ query, resultCount: results.length }, '[CodePointers] Gallery mode - sending to Mini COT');
|
|
1351
|
+
try {
|
|
1352
|
+
const miniCOT = new MiniCOTProvider();
|
|
1353
|
+
// Prepare for gallery - NO compression on keywords (Mini COT expects English input)
|
|
1354
|
+
const memoriesForGallery = results.map(r => ({
|
|
1355
|
+
id: r.file_path + (r.name ? `:${r.name}` : ''),
|
|
1356
|
+
keywords: [
|
|
1357
|
+
r.type,
|
|
1358
|
+
r.definition_type || '',
|
|
1359
|
+
r.file_path.split('/').pop() || ''
|
|
1360
|
+
].filter(Boolean).join(' '),
|
|
1361
|
+
snippet: r.content_preview.slice(0, 200)
|
|
1362
|
+
}));
|
|
1363
|
+
const gallery = await miniCOT.createGallery(query, memoriesForGallery);
|
|
1364
|
+
logger.info({
|
|
1365
|
+
query,
|
|
1366
|
+
galleryItems: gallery.gallery.length
|
|
1367
|
+
}, '[CodePointers] Gallery created');
|
|
1368
|
+
// Return with Chinese compactor applied
|
|
1369
|
+
return compactResponse(gallery, 'search');
|
|
1370
|
+
}
|
|
1371
|
+
catch (error) {
|
|
1372
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
1373
|
+
logger.error({ error: errMsg, stack: error instanceof Error ? error.stack : undefined }, '[CodePointers] Mini COT gallery failed - returning basic results');
|
|
1374
|
+
return {
|
|
1375
|
+
results,
|
|
1376
|
+
query,
|
|
1377
|
+
total_found: results.length,
|
|
1378
|
+
search_type: 'semantic',
|
|
1379
|
+
zoom: 'normal',
|
|
1380
|
+
attribution: SPECMEM_ATTRIBUTION
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
// ============================================================================
|
|
1385
|
+
// DRILLDOWN SUGGESTIONS
|
|
1386
|
+
// ============================================================================
|
|
1387
|
+
generateDrilldown(results, query) {
|
|
1388
|
+
const count = results.length;
|
|
1389
|
+
const topSim = results[0]?.similarity ?? 0;
|
|
1390
|
+
if (count === 0) {
|
|
1391
|
+
return {
|
|
1392
|
+
prompt: `🔍 No code found for "${query}" | Try: different keywords, check spelling, or use WebSearch`,
|
|
1393
|
+
action: 'research:web',
|
|
1394
|
+
needsResearch: true
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
if (topSim < 0.15) {
|
|
1398
|
+
return {
|
|
1399
|
+
prompt: `⚠️ Low relevance (${Math.round(topSim * 100)}%) | Found ${count} results but may not match intent. Try more specific query.`,
|
|
1400
|
+
action: 'drilldown:refine',
|
|
1401
|
+
needsResearch: false
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
if (count < 3) {
|
|
1405
|
+
return {
|
|
1406
|
+
prompt: `📊 Found ${count} results (${Math.round(topSim * 100)}% match) | May need broader search`,
|
|
1407
|
+
action: 'drilldown:broader',
|
|
1408
|
+
needsResearch: false
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
// Good results
|
|
1412
|
+
const hasTracebacks = results.some(r => (r.callers?.length || 0) > 0 || (r.callees?.length || 0) > 0);
|
|
1413
|
+
const tracebackHint = hasTracebacks ? ' | Tracebacks included' : '';
|
|
1414
|
+
return {
|
|
1415
|
+
prompt: `✅ Found ${count} code matches (${Math.round(topSim * 100)}% top similarity)${tracebackHint} | Use _drill to get full content`,
|
|
1416
|
+
action: 'none',
|
|
1417
|
+
needsResearch: false
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
// ============================================================================
|
|
1421
|
+
// MINI COT SCORING & ATTRIBUTION
|
|
1422
|
+
// ============================================================================
|
|
1423
|
+
/**
|
|
1424
|
+
* Apply Mini COT scoring and/or attribution to code search results
|
|
1425
|
+
*
|
|
1426
|
+
* This method:
|
|
1427
|
+
* 1. Calls MiniCOTScorer to score code-memory relevance (if useCotScoring=true)
|
|
1428
|
+
* 2. Extracts user/claude attribution based on memory role (if includeAttribution=true)
|
|
1429
|
+
* 3. Returns enriched results with scoring and attribution fields
|
|
1430
|
+
*/
|
|
1431
|
+
async applyCotScoringAndAttribution(query, results, useCotScoring, includeAttribution) {
|
|
1432
|
+
logger.info({
|
|
1433
|
+
query,
|
|
1434
|
+
resultCount: results.length,
|
|
1435
|
+
useCotScoring,
|
|
1436
|
+
includeAttribution
|
|
1437
|
+
}, '[CodePointers] Applying COT scoring and attribution');
|
|
1438
|
+
try {
|
|
1439
|
+
// If only attribution is needed (no COT scoring), use fast path
|
|
1440
|
+
if (!useCotScoring && includeAttribution) {
|
|
1441
|
+
return this.applyAttributionOnly(results);
|
|
1442
|
+
}
|
|
1443
|
+
// Full COT scoring path
|
|
1444
|
+
const scorer = getMiniCOTScorer();
|
|
1445
|
+
// Convert results to CodePointerWithMemory format
|
|
1446
|
+
const pointersWithMemory = results.map(result => ({
|
|
1447
|
+
file_path: result.file_path,
|
|
1448
|
+
name: result.name,
|
|
1449
|
+
definition_type: result.definition_type,
|
|
1450
|
+
content_preview: result.content_preview,
|
|
1451
|
+
line_range: result.line_range,
|
|
1452
|
+
similarity: result.similarity,
|
|
1453
|
+
// Try to find associated memory (would come from code_pointers table)
|
|
1454
|
+
memoryId: result.memoryId,
|
|
1455
|
+
memoryRole: undefined, // Will be looked up if memoryId is present
|
|
1456
|
+
memoryTags: undefined // Will be looked up if memoryId is present
|
|
1457
|
+
}));
|
|
1458
|
+
// Score batch
|
|
1459
|
+
const scoringResult = await scorer.scoreBatch({
|
|
1460
|
+
query,
|
|
1461
|
+
codePointers: pointersWithMemory,
|
|
1462
|
+
options: {
|
|
1463
|
+
includeReasoning: true,
|
|
1464
|
+
compressOutput: true
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
logger.info({
|
|
1468
|
+
query,
|
|
1469
|
+
scoredCount: scoringResult.totalScored,
|
|
1470
|
+
avgCotRelevance: scoringResult.avgCotRelevance,
|
|
1471
|
+
scoringMethod: scoringResult.scoringMethod,
|
|
1472
|
+
attributionBreakdown: scoringResult.attributionBreakdown
|
|
1473
|
+
}, '[CodePointers] COT scoring complete');
|
|
1474
|
+
// Map scored results back to CodeSearchResult
|
|
1475
|
+
return results.map((result, idx) => {
|
|
1476
|
+
const scored = scoringResult.scoredPointers[idx];
|
|
1477
|
+
if (!scored)
|
|
1478
|
+
return result;
|
|
1479
|
+
const enrichedResult = {
|
|
1480
|
+
...result
|
|
1481
|
+
};
|
|
1482
|
+
// Add COT scoring fields if scoring was used
|
|
1483
|
+
if (useCotScoring) {
|
|
1484
|
+
enrichedResult.cotRelevance = scored.cotRelevance;
|
|
1485
|
+
enrichedResult.cotReasoning = scored.cotReasoning;
|
|
1486
|
+
enrichedResult.combinedScore = scored.combinedScore;
|
|
1487
|
+
}
|
|
1488
|
+
// Add attribution fields if attribution was requested
|
|
1489
|
+
if (includeAttribution) {
|
|
1490
|
+
enrichedResult.attribution = scored.attribution;
|
|
1491
|
+
enrichedResult.attributionNote = scored.attributionNote;
|
|
1492
|
+
enrichedResult.memoryId = scored.memoryId;
|
|
1493
|
+
}
|
|
1494
|
+
return enrichedResult;
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
catch (error) {
|
|
1498
|
+
logger.warn({ error, query }, '[CodePointers] COT scoring/attribution failed, returning original results');
|
|
1499
|
+
// Fall back to attribution-only if COT fails but attribution was requested
|
|
1500
|
+
if (includeAttribution) {
|
|
1501
|
+
return this.applyAttributionOnly(results);
|
|
1502
|
+
}
|
|
1503
|
+
return results;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Fast path for attribution-only (no COT scoring)
|
|
1508
|
+
* Uses extractAttribution utility to determine user/claude attribution
|
|
1509
|
+
*/
|
|
1510
|
+
applyAttributionOnly(results) {
|
|
1511
|
+
return results.map(result => {
|
|
1512
|
+
// Extract attribution based on any associated memory metadata
|
|
1513
|
+
// Since we don't have memory context here, we mark as unknown
|
|
1514
|
+
// unless there's embedded information in the result
|
|
1515
|
+
const { attribution, note } = extractAttribution(undefined, undefined);
|
|
1516
|
+
return {
|
|
1517
|
+
...result,
|
|
1518
|
+
attribution,
|
|
1519
|
+
attributionNote: note
|
|
1520
|
+
};
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Look up memory information for a code pointer
|
|
1525
|
+
* Used to get role/tags for attribution
|
|
1526
|
+
*/
|
|
1527
|
+
async lookupMemoryInfo(codeId) {
|
|
1528
|
+
try {
|
|
1529
|
+
// Get project path for filtering
|
|
1530
|
+
const projectPath = getProjectContext().getProjectPath();
|
|
1531
|
+
// Query codebase_pointers table for memory associations - filtered by project
|
|
1532
|
+
const result = await this.db.query(`
|
|
1533
|
+
SELECT cp.memory_id, m.metadata->>'role' as role, m.tags
|
|
1534
|
+
FROM codebase_pointers cp
|
|
1535
|
+
JOIN memories m ON cp.memory_id = m.id
|
|
1536
|
+
WHERE cp.file_path = $1
|
|
1537
|
+
AND cp.project_path = $2
|
|
1538
|
+
LIMIT 1
|
|
1539
|
+
`, [codeId, projectPath]);
|
|
1540
|
+
if (result.rows.length > 0) {
|
|
1541
|
+
const row = result.rows[0];
|
|
1542
|
+
return {
|
|
1543
|
+
memoryId: row.memory_id,
|
|
1544
|
+
memoryRole: row.role,
|
|
1545
|
+
memoryTags: row.tags
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
catch {
|
|
1550
|
+
// Table may not exist or query failed
|
|
1551
|
+
}
|
|
1552
|
+
return {};
|
|
1553
|
+
}
|
|
1554
|
+
// ============================================================================
|
|
1555
|
+
// CODE TRACING - Recursive caller/callee dependency tree
|
|
1556
|
+
// ============================================================================
|
|
1557
|
+
/**
|
|
1558
|
+
* traceCode - Build a full dependency tree for a given file
|
|
1559
|
+
*
|
|
1560
|
+
* Performs recursive caller/callee lookup to map out the complete
|
|
1561
|
+
* dependency graph for understanding code impact and relationships.
|
|
1562
|
+
*
|
|
1563
|
+
* @param params - TraceCodeParams with filePath, maxDepth, direction
|
|
1564
|
+
* @returns TraceCodeResult with tree, flat lists, and analysis
|
|
1565
|
+
*/
|
|
1566
|
+
async traceCode(params) {
|
|
1567
|
+
const { filePath, definitionName, maxDepth = 5, direction = 'both', includeExternal = false } = params;
|
|
1568
|
+
logger.info({ filePath, definitionName, maxDepth, direction }, '[CodePointers] Starting code trace');
|
|
1569
|
+
// Get project path for filtering
|
|
1570
|
+
const projectPath = getProjectContext().getProjectPath();
|
|
1571
|
+
// Track visited nodes to detect circular dependencies
|
|
1572
|
+
const visited = new Set();
|
|
1573
|
+
const circularDeps = [];
|
|
1574
|
+
const flatCallers = [];
|
|
1575
|
+
const flatCallees = [];
|
|
1576
|
+
const nodeFrequency = new Map(); // Track hotspots
|
|
1577
|
+
// Build root node
|
|
1578
|
+
const root = {
|
|
1579
|
+
filePath,
|
|
1580
|
+
name: definitionName,
|
|
1581
|
+
depth: 0,
|
|
1582
|
+
direction: 'root',
|
|
1583
|
+
children: []
|
|
1584
|
+
};
|
|
1585
|
+
// Recursive function to build caller tree
|
|
1586
|
+
const buildCallerTree = async (node, currentPath) => {
|
|
1587
|
+
if (node.depth >= maxDepth)
|
|
1588
|
+
return;
|
|
1589
|
+
const nodeKey = node.filePath + (node.name ? `:${node.name}` : '');
|
|
1590
|
+
// Detect circular dependency
|
|
1591
|
+
if (currentPath.includes(nodeKey)) {
|
|
1592
|
+
circularDeps.push([...currentPath, nodeKey]);
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
if (visited.has(nodeKey))
|
|
1596
|
+
return;
|
|
1597
|
+
visited.add(nodeKey);
|
|
1598
|
+
try {
|
|
1599
|
+
// Query for files that import this file - filtered by project
|
|
1600
|
+
const query = `
|
|
1601
|
+
SELECT DISTINCT source_file_path, import_type, imported_names, line_number
|
|
1602
|
+
FROM code_dependencies
|
|
1603
|
+
WHERE (resolved_path = $1 OR target_path = $1)
|
|
1604
|
+
AND project_path = $2
|
|
1605
|
+
${!includeExternal ? "AND source_file_path NOT LIKE 'node_modules%'" : ''}
|
|
1606
|
+
ORDER BY source_file_path
|
|
1607
|
+
LIMIT 50
|
|
1608
|
+
`;
|
|
1609
|
+
const result = await this.db.query(query, [node.filePath, projectPath]);
|
|
1610
|
+
for (const row of result.rows) {
|
|
1611
|
+
// Track frequency for hotspot detection
|
|
1612
|
+
const callerKey = row.source_file_path;
|
|
1613
|
+
nodeFrequency.set(callerKey, (nodeFrequency.get(callerKey) || 0) + 1);
|
|
1614
|
+
if (!flatCallers.includes(callerKey)) {
|
|
1615
|
+
flatCallers.push(callerKey);
|
|
1616
|
+
}
|
|
1617
|
+
const childNode = {
|
|
1618
|
+
filePath: row.source_file_path,
|
|
1619
|
+
depth: node.depth + 1,
|
|
1620
|
+
direction: 'caller',
|
|
1621
|
+
importType: row.import_type,
|
|
1622
|
+
importedNames: row.imported_names,
|
|
1623
|
+
lineNumber: row.line_number,
|
|
1624
|
+
children: []
|
|
1625
|
+
};
|
|
1626
|
+
node.children.push(childNode);
|
|
1627
|
+
// Recurse
|
|
1628
|
+
await buildCallerTree(childNode, [...currentPath, nodeKey]);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
catch (error) {
|
|
1632
|
+
logger.warn({ error, filePath: node.filePath }, '[CodePointers] Failed to query callers');
|
|
1633
|
+
}
|
|
1634
|
+
};
|
|
1635
|
+
// Recursive function to build callee tree
|
|
1636
|
+
const buildCalleeTree = async (node, currentPath) => {
|
|
1637
|
+
if (node.depth >= maxDepth)
|
|
1638
|
+
return;
|
|
1639
|
+
const nodeKey = node.filePath + (node.name ? `:${node.name}` : '');
|
|
1640
|
+
// Detect circular dependency
|
|
1641
|
+
if (currentPath.includes(nodeKey)) {
|
|
1642
|
+
circularDeps.push([...currentPath, nodeKey]);
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
// Use separate visited set for callees to allow bidirectional traversal
|
|
1646
|
+
const calleeVisitedKey = `callee:${nodeKey}`;
|
|
1647
|
+
if (visited.has(calleeVisitedKey))
|
|
1648
|
+
return;
|
|
1649
|
+
visited.add(calleeVisitedKey);
|
|
1650
|
+
try {
|
|
1651
|
+
// Query for files that this file imports - filtered by project
|
|
1652
|
+
const query = `
|
|
1653
|
+
SELECT DISTINCT target_path, resolved_path, import_type, imported_names, line_number
|
|
1654
|
+
FROM code_dependencies
|
|
1655
|
+
WHERE source_file_path = $1
|
|
1656
|
+
AND project_path = $2
|
|
1657
|
+
${!includeExternal ? "AND target_path NOT LIKE 'node_modules%' AND (resolved_path IS NULL OR resolved_path NOT LIKE 'node_modules%')" : ''}
|
|
1658
|
+
ORDER BY target_path
|
|
1659
|
+
LIMIT 50
|
|
1660
|
+
`;
|
|
1661
|
+
const result = await this.db.query(query, [node.filePath, projectPath]);
|
|
1662
|
+
for (const row of result.rows) {
|
|
1663
|
+
const targetPath = row.resolved_path || row.target_path;
|
|
1664
|
+
// Track frequency for hotspot detection
|
|
1665
|
+
nodeFrequency.set(targetPath, (nodeFrequency.get(targetPath) || 0) + 1);
|
|
1666
|
+
if (!flatCallees.includes(targetPath)) {
|
|
1667
|
+
flatCallees.push(targetPath);
|
|
1668
|
+
}
|
|
1669
|
+
const childNode = {
|
|
1670
|
+
filePath: targetPath,
|
|
1671
|
+
depth: node.depth + 1,
|
|
1672
|
+
direction: 'callee',
|
|
1673
|
+
importType: row.import_type,
|
|
1674
|
+
importedNames: row.imported_names,
|
|
1675
|
+
lineNumber: row.line_number,
|
|
1676
|
+
children: []
|
|
1677
|
+
};
|
|
1678
|
+
node.children.push(childNode);
|
|
1679
|
+
// Recurse
|
|
1680
|
+
await buildCalleeTree(childNode, [...currentPath, nodeKey]);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
catch (error) {
|
|
1684
|
+
logger.warn({ error, filePath: node.filePath }, '[CodePointers] Failed to query callees');
|
|
1685
|
+
}
|
|
1686
|
+
};
|
|
1687
|
+
// Build trees based on direction
|
|
1688
|
+
if (direction === 'callers' || direction === 'both') {
|
|
1689
|
+
await buildCallerTree(root, []);
|
|
1690
|
+
}
|
|
1691
|
+
// Reset visited for callee traversal if doing both
|
|
1692
|
+
if (direction === 'both') {
|
|
1693
|
+
visited.clear();
|
|
1694
|
+
}
|
|
1695
|
+
if (direction === 'callees' || direction === 'both') {
|
|
1696
|
+
await buildCalleeTree(root, []);
|
|
1697
|
+
}
|
|
1698
|
+
// Count nodes recursively
|
|
1699
|
+
const countNodes = (node) => {
|
|
1700
|
+
return 1 + node.children.reduce((sum, child) => sum + countNodes(child), 0);
|
|
1701
|
+
};
|
|
1702
|
+
// Find max depth recursively
|
|
1703
|
+
const findMaxDepth = (node) => {
|
|
1704
|
+
if (node.children.length === 0)
|
|
1705
|
+
return node.depth;
|
|
1706
|
+
return Math.max(...node.children.map(findMaxDepth));
|
|
1707
|
+
};
|
|
1708
|
+
// Identify hotspots (files referenced more than once)
|
|
1709
|
+
const hotspots = Array.from(nodeFrequency.entries())
|
|
1710
|
+
.filter(([_, count]) => count > 1)
|
|
1711
|
+
.sort((a, b) => b[1] - a[1])
|
|
1712
|
+
.slice(0, 10)
|
|
1713
|
+
.map(([path]) => path);
|
|
1714
|
+
// Calculate impact score (0-100)
|
|
1715
|
+
// Based on: total nodes, caller count, whether this is a widely-used module
|
|
1716
|
+
const totalNodes = countNodes(root);
|
|
1717
|
+
const impactScore = Math.min(100, Math.round((flatCallers.length * 5) + // Each caller adds 5 points
|
|
1718
|
+
(hotspots.length * 10) + // Each hotspot adds 10 points
|
|
1719
|
+
(circularDeps.length > 0 ? 20 : 0) // Circular deps indicate tight coupling
|
|
1720
|
+
));
|
|
1721
|
+
const tree = {
|
|
1722
|
+
root,
|
|
1723
|
+
totalNodes,
|
|
1724
|
+
maxDepth: findMaxDepth(root),
|
|
1725
|
+
callerCount: flatCallers.length,
|
|
1726
|
+
calleeCount: flatCallees.length
|
|
1727
|
+
};
|
|
1728
|
+
// Generate hint for user
|
|
1729
|
+
const hintParts = [];
|
|
1730
|
+
if (flatCallers.length > 0) {
|
|
1731
|
+
hintParts.push(`${flatCallers.length} callers`);
|
|
1732
|
+
}
|
|
1733
|
+
if (flatCallees.length > 0) {
|
|
1734
|
+
hintParts.push(`${flatCallees.length} dependencies`);
|
|
1735
|
+
}
|
|
1736
|
+
if (circularDeps.length > 0) {
|
|
1737
|
+
hintParts.push(`${circularDeps.length} circular deps detected`);
|
|
1738
|
+
}
|
|
1739
|
+
if (hotspots.length > 0) {
|
|
1740
|
+
hintParts.push(`hotspots: ${hotspots.slice(0, 3).map(h => h.split('/').pop()).join(', ')}`);
|
|
1741
|
+
}
|
|
1742
|
+
const hint = hintParts.length > 0
|
|
1743
|
+
? `Impact: ${impactScore}/100 | ${hintParts.join(' | ')}`
|
|
1744
|
+
: 'No dependencies found';
|
|
1745
|
+
logger.info({
|
|
1746
|
+
filePath,
|
|
1747
|
+
totalNodes,
|
|
1748
|
+
callerCount: flatCallers.length,
|
|
1749
|
+
calleeCount: flatCallees.length,
|
|
1750
|
+
circularCount: circularDeps.length,
|
|
1751
|
+
impactScore
|
|
1752
|
+
}, '[CodePointers] Code trace complete');
|
|
1753
|
+
return {
|
|
1754
|
+
tree,
|
|
1755
|
+
flatCallers,
|
|
1756
|
+
flatCallees,
|
|
1757
|
+
impactScore,
|
|
1758
|
+
circularDependencies: circularDeps,
|
|
1759
|
+
hotspots,
|
|
1760
|
+
_hint: hint
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
//# sourceMappingURL=findCodePointers.js.map
|