scai 0.1.178 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -267
- package/dist/__tests__/CommitSuggesterCmd.test.js +112 -0
- package/dist/__tests__/CommitSuggesterCmd.test.js.map +1 -0
- package/dist/__tests__/EvalReportCmd.test.js +645 -0
- package/dist/__tests__/EvalReportCmd.test.js.map +1 -0
- package/dist/__tests__/ModelCmd.test.js +64 -0
- package/dist/__tests__/ModelCmd.test.js.map +1 -0
- package/dist/__tests__/agents/agentActions.test.js +345 -0
- package/dist/__tests__/agents/agentActions.test.js.map +1 -0
- package/dist/__tests__/agents/agentFeedback.test.js +118 -0
- package/dist/__tests__/agents/agentFeedback.test.js.map +1 -0
- package/dist/__tests__/agents/agentGeneralScope.test.js +74 -0
- package/dist/__tests__/agents/agentGeneralScope.test.js.map +1 -0
- package/dist/__tests__/agents/agentLoop.test.js +1723 -0
- package/dist/__tests__/agents/agentLoop.test.js.map +1 -0
- package/dist/__tests__/agents/agentPolicyState.test.js +948 -0
- package/dist/__tests__/agents/agentPolicyState.test.js.map +1 -0
- package/dist/__tests__/agents/agentReadEvidence.test.js +170 -0
- package/dist/__tests__/agents/agentReadEvidence.test.js.map +1 -0
- package/dist/__tests__/agents/agentReadPersistence.test.js +129 -0
- package/dist/__tests__/agents/agentReadPersistence.test.js.map +1 -0
- package/dist/__tests__/agents/agentResumeCheckpoint.test.js +90 -0
- package/dist/__tests__/agents/agentResumeCheckpoint.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchBatchPlanner.test.js +289 -0
- package/dist/__tests__/agents/agentSearchBatchPlanner.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchOwnership.test.js +166 -0
- package/dist/__tests__/agents/agentSearchOwnership.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchRanking.test.js +139 -0
- package/dist/__tests__/agents/agentSearchRanking.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchRouting.test.js +584 -0
- package/dist/__tests__/agents/agentSearchRouting.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchScoring.test.js +23 -0
- package/dist/__tests__/agents/agentSearchScoring.test.js.map +1 -0
- package/dist/__tests__/agents/agentSearchShared.test.js +78 -0
- package/dist/__tests__/agents/agentSearchShared.test.js.map +1 -0
- package/dist/__tests__/agents/agentStateMachine.test.js +58 -0
- package/dist/__tests__/agents/agentStateMachine.test.js.map +1 -0
- package/dist/__tests__/agents/agentTaskPersistence.test.js +156 -0
- package/dist/__tests__/agents/agentTaskPersistence.test.js.map +1 -0
- package/dist/__tests__/agents/agentTools.test.js +69 -0
- package/dist/__tests__/agents/agentTools.test.js.map +1 -0
- package/dist/__tests__/agents/agentTransform.test.js +779 -0
- package/dist/__tests__/agents/agentTransform.test.js.map +1 -0
- package/dist/__tests__/agents/analysisPlanGenStep.test.js +157 -0
- package/dist/__tests__/agents/analysisPlanGenStep.test.js.map +1 -0
- package/dist/__tests__/agents/answerOnlyCompletion.test.js +75 -0
- package/dist/__tests__/agents/answerOnlyCompletion.test.js.map +1 -0
- package/dist/__tests__/agents/decideNextAction.test.js +1662 -0
- package/dist/__tests__/agents/decideNextAction.test.js.map +1 -0
- package/dist/__tests__/agents/deriveFocusFromSearchStep.test.js +258 -0
- package/dist/__tests__/agents/deriveFocusFromSearchStep.test.js.map +1 -0
- package/dist/__tests__/agents/evidenceVerifierStep.test.js +113 -0
- package/dist/__tests__/agents/evidenceVerifierStep.test.js.map +1 -0
- package/dist/__tests__/agents/executionPolicyResolver.test.js +208 -0
- package/dist/__tests__/agents/executionPolicyResolver.test.js.map +1 -0
- package/dist/__tests__/agents/fileCheckStep.test.js +299 -0
- package/dist/__tests__/agents/fileCheckStep.test.js.map +1 -0
- package/dist/__tests__/agents/giveUpEvaluatorStep.test.js +35 -0
- package/dist/__tests__/agents/giveUpEvaluatorStep.test.js.map +1 -0
- package/dist/__tests__/agents/guardState.test.js +297 -0
- package/dist/__tests__/agents/guardState.test.js.map +1 -0
- package/dist/__tests__/agents/mainAgentHeuristics.test.js +72 -0
- package/dist/__tests__/agents/mainAgentHeuristics.test.js.map +1 -0
- package/dist/__tests__/agents/objectiveEvaluatorStep.test.js +60 -0
- package/dist/__tests__/agents/objectiveEvaluatorStep.test.js.map +1 -0
- package/dist/__tests__/agents/outerLoopRecoveryEvaluator.test.js +207 -0
- package/dist/__tests__/agents/outerLoopRecoveryEvaluator.test.js.map +1 -0
- package/dist/__tests__/agents/prompting.test.js +363 -0
- package/dist/__tests__/agents/prompting.test.js.map +1 -0
- package/dist/__tests__/agents/readinessGateStep.test.js +180 -0
- package/dist/__tests__/agents/readinessGateStep.test.js.map +1 -0
- package/dist/__tests__/agents/reasonNextStep.test.js +56 -0
- package/dist/__tests__/agents/reasonNextStep.test.js.map +1 -0
- package/dist/__tests__/agents/reasonNextTaskStep.test.js +284 -0
- package/dist/__tests__/agents/reasonNextTaskStep.test.js.map +1 -0
- package/dist/__tests__/agents/resolveAgentTargetClassification.test.js +170 -0
- package/dist/__tests__/agents/resolveAgentTargetClassification.test.js.map +1 -0
- package/dist/__tests__/agents/resolveProgressState.test.js +526 -0
- package/dist/__tests__/agents/resolveProgressState.test.js.map +1 -0
- package/dist/__tests__/agents/resumeCheckpoint.test.js +50 -0
- package/dist/__tests__/agents/resumeCheckpoint.test.js.map +1 -0
- package/dist/__tests__/agents/routingDecisionStep.test.js +134 -0
- package/dist/__tests__/agents/routingDecisionStep.test.js.map +1 -0
- package/dist/__tests__/agents/scopeClassificationStep.test.js +118 -0
- package/dist/__tests__/agents/scopeClassificationStep.test.js.map +1 -0
- package/dist/__tests__/agents/searchContext.test.js +97 -0
- package/dist/__tests__/agents/searchContext.test.js.map +1 -0
- package/dist/__tests__/agents/selectRelevantSourcesStep.test.js +73 -0
- package/dist/__tests__/agents/selectRelevantSourcesStep.test.js.map +1 -0
- package/dist/__tests__/agents/structuredOutput.test.js +45 -0
- package/dist/__tests__/agents/structuredOutput.test.js.map +1 -0
- package/dist/__tests__/agents/transformPlanGenStep.fallback.test.js +59 -0
- package/dist/__tests__/agents/transformPlanGenStep.fallback.test.js.map +1 -0
- package/dist/__tests__/agents/transformPlanGenStep.test.js +92 -0
- package/dist/__tests__/agents/transformPlanGenStep.test.js.map +1 -0
- package/dist/__tests__/agents/understandIntentStep.test.js +237 -0
- package/dist/__tests__/agents/understandIntentStep.test.js.map +1 -0
- package/dist/__tests__/agents/understandResumeContext.test.js +65 -0
- package/dist/__tests__/agents/understandResumeContext.test.js.map +1 -0
- package/dist/__tests__/agents/understandScope.test.js +227 -0
- package/dist/__tests__/agents/understandScope.test.js.map +1 -0
- package/dist/__tests__/agents/validateChangesStep.test.js +52 -0
- package/dist/__tests__/agents/validateChangesStep.test.js.map +1 -0
- package/dist/__tests__/askCommandTaskBinding.test.js +176 -0
- package/dist/__tests__/askCommandTaskBinding.test.js.map +1 -0
- package/dist/__tests__/commandVisibility.test.js +25 -0
- package/dist/__tests__/commandVisibility.test.js.map +1 -0
- package/dist/__tests__/config.devOutput.test.js +82 -0
- package/dist/__tests__/config.devOutput.test.js.map +1 -0
- package/dist/__tests__/currentContext.test.js +43 -0
- package/dist/__tests__/currentContext.test.js.map +1 -0
- package/dist/__tests__/daemonWorker.test.js +51 -0
- package/dist/__tests__/daemonWorker.test.js.map +1 -0
- package/dist/__tests__/dialogState.test.js +113 -0
- package/dist/__tests__/dialogState.test.js.map +1 -0
- package/dist/__tests__/evalCommands.test.js +506 -0
- package/dist/__tests__/evalCommands.test.js.map +1 -0
- package/dist/__tests__/evalCommandsSummary.test.js +68 -0
- package/dist/__tests__/evalCommandsSummary.test.js.map +1 -0
- package/dist/__tests__/example.test.js +1 -0
- package/dist/__tests__/example.test.js.map +1 -0
- package/dist/__tests__/factory.commitCommand.test.js +45 -0
- package/dist/__tests__/factory.commitCommand.test.js.map +1 -0
- package/dist/__tests__/factory.devOutputCommand.test.js +122 -0
- package/dist/__tests__/factory.devOutputCommand.test.js.map +1 -0
- package/dist/__tests__/factory.evalCommands.test.js +38 -0
- package/dist/__tests__/factory.evalCommands.test.js.map +1 -0
- package/dist/__tests__/factory.planCommand.test.js +35 -0
- package/dist/__tests__/factory.planCommand.test.js.map +1 -0
- package/dist/__tests__/factory.setupCommand.test.js +34 -0
- package/dist/__tests__/factory.setupCommand.test.js.map +1 -0
- package/dist/__tests__/factory.statusCommand.test.js +54 -0
- package/dist/__tests__/factory.statusCommand.test.js.map +1 -0
- package/dist/__tests__/fileRules/queryTokenRules.test.js +35 -0
- package/dist/__tests__/fileRules/queryTokenRules.test.js.map +1 -0
- package/dist/__tests__/fileRules/searchPathClassification.test.js +57 -0
- package/dist/__tests__/fileRules/searchPathClassification.test.js.map +1 -0
- package/dist/__tests__/generate.ollamaRecovery.test.js +344 -0
- package/dist/__tests__/generate.ollamaRecovery.test.js.map +1 -0
- package/dist/__tests__/index.modelStartup.test.js +24 -0
- package/dist/__tests__/index.modelStartup.test.js.map +1 -0
- package/dist/__tests__/indexCmd.test.js +85 -0
- package/dist/__tests__/indexCmd.test.js.map +1 -0
- package/dist/__tests__/indexSlashCommand.test.js +50 -0
- package/dist/__tests__/indexSlashCommand.test.js.map +1 -0
- package/dist/__tests__/ollamaService.test.js +103 -0
- package/dist/__tests__/ollamaService.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/codeTransformModule.small-file.test.js +68 -0
- package/dist/__tests__/pipeline/modules/codeTransformModule.small-file.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/commitSuggesterModule.test.js +68 -0
- package/dist/__tests__/pipeline/modules/commitSuggesterModule.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/fileSearchModule.test.js +284 -0
- package/dist/__tests__/pipeline/modules/fileSearchModule.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/finalAnswerModule.test.js +1139 -0
- package/dist/__tests__/pipeline/modules/finalAnswerModule.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/readFileModule.test.js +146 -0
- package/dist/__tests__/pipeline/modules/readFileModule.test.js.map +1 -0
- package/dist/__tests__/pipeline/modules/semanticAnalysisModule.test.js +192 -0
- package/dist/__tests__/pipeline/modules/semanticAnalysisModule.test.js.map +1 -0
- package/dist/__tests__/repoIdentity.test.js +31 -0
- package/dist/__tests__/repoIdentity.test.js.map +1 -0
- package/dist/__tests__/resumeContext.test.js +87 -0
- package/dist/__tests__/resumeContext.test.js.map +1 -0
- package/dist/__tests__/resumeState.test.js +239 -0
- package/dist/__tests__/resumeState.test.js.map +1 -0
- package/dist/__tests__/search/SearchOrchestrator.test.js +836 -0
- package/dist/__tests__/search/SearchOrchestrator.test.js.map +1 -0
- package/dist/__tests__/shellDialogUi.test.js +52 -0
- package/dist/__tests__/shellDialogUi.test.js.map +1 -0
- package/dist/__tests__/shellSession.test.js +102 -0
- package/dist/__tests__/shellSession.test.js.map +1 -0
- package/dist/__tests__/statusOwner.test.js +215 -0
- package/dist/__tests__/statusOwner.test.js.map +1 -0
- package/dist/__tests__/testing/contextEval.test.js +244 -0
- package/dist/__tests__/testing/contextEval.test.js.map +1 -0
- package/dist/__tests__/testing/harnessArtifacts.test.js +124 -0
- package/dist/__tests__/testing/harnessArtifacts.test.js.map +1 -0
- package/dist/__tests__/testing/llmTraceSession.test.js +67 -0
- package/dist/__tests__/testing/llmTraceSession.test.js.map +1 -0
- package/dist/__tests__/testing/registerDevCliCommands.test.js +35 -0
- package/dist/__tests__/testing/registerDevCliCommands.test.js.map +1 -0
- package/dist/__tests__/testing/runDiagnosis.test.js +159 -0
- package/dist/__tests__/testing/runDiagnosis.test.js.map +1 -0
- package/dist/__tests__/testing/runtimeLogReader.test.js +66 -0
- package/dist/__tests__/testing/runtimeLogReader.test.js.map +1 -0
- package/dist/__tests__/testing/testCommands.test.js +53 -0
- package/dist/__tests__/testing/testCommands.test.js.map +1 -0
- package/dist/__tests__/utils/compileSearchQuery.test.js +38 -0
- package/dist/__tests__/utils/compileSearchQuery.test.js.map +1 -0
- package/dist/__tests__/utils/consolePresentation.test.js +105 -0
- package/dist/__tests__/utils/consolePresentation.test.js.map +1 -0
- package/dist/__tests__/utils/extractFileReferences.test.js +41 -0
- package/dist/__tests__/utils/extractFileReferences.test.js.map +1 -0
- package/dist/__tests__/utils/log.test.js +34 -0
- package/dist/__tests__/utils/log.test.js.map +1 -0
- package/dist/__tests__/utils/runtimeLogger.test.js +200 -0
- package/dist/__tests__/utils/runtimeLogger.test.js.map +1 -0
- package/dist/__tests__/utils/spinner.test.js +31 -0
- package/dist/__tests__/utils/spinner.test.js.map +1 -0
- package/dist/__tests__/utils/verifyFocusPreference.test.js +41 -0
- package/dist/__tests__/utils/verifyFocusPreference.test.js.map +1 -0
- package/dist/agent/actions/index.js +301 -0
- package/dist/agent/actions/index.js.map +1 -0
- package/dist/agent/actions/normalize.js +360 -0
- package/dist/agent/actions/normalize.js.map +1 -0
- package/dist/agent/actions/schemas.js +129 -0
- package/dist/agent/actions/schemas.js.map +1 -0
- package/dist/agent/evidence/index.js +320 -0
- package/dist/agent/evidence/index.js.map +1 -0
- package/dist/agent/feedback/index.js +187 -0
- package/dist/agent/feedback/index.js.map +1 -0
- package/dist/agent/finalization/index.js +35 -0
- package/dist/agent/finalization/index.js.map +1 -0
- package/dist/agent/index.js +126 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/logging/index.js +350 -0
- package/dist/agent/logging/index.js.map +1 -0
- package/dist/agent/persistence/boot.js +58 -0
- package/dist/agent/persistence/boot.js.map +1 -0
- package/dist/agent/persistence/currentTask.js +36 -0
- package/dist/agent/persistence/currentTask.js.map +1 -0
- package/dist/agent/persistence/hydrate.js +42 -0
- package/dist/agent/persistence/hydrate.js.map +1 -0
- package/dist/agent/persistence/index.js +15 -0
- package/dist/agent/persistence/index.js.map +1 -0
- package/dist/agent/persistence/snapshots.js +97 -0
- package/dist/agent/persistence/snapshots.js.map +1 -0
- package/dist/agent/persistence/steps.js +95 -0
- package/dist/agent/persistence/steps.js.map +1 -0
- package/dist/agent/persistence/tasks.js +195 -0
- package/dist/agent/persistence/tasks.js.map +1 -0
- package/dist/agent/persistence/turns.js +92 -0
- package/dist/agent/persistence/turns.js.map +1 -0
- package/dist/agent/policy/ambiguityResolution.js +226 -0
- package/dist/agent/policy/ambiguityResolution.js.map +1 -0
- package/dist/agent/policy/contracts.js +2 -0
- package/dist/agent/policy/contracts.js.map +1 -0
- package/dist/agent/policy/coveragePolicy.js +309 -0
- package/dist/agent/policy/coveragePolicy.js.map +1 -0
- package/dist/agent/policy/endDecisionPolicy.js +31 -0
- package/dist/agent/policy/endDecisionPolicy.js.map +1 -0
- package/dist/agent/policy/index.js +344 -0
- package/dist/agent/policy/index.js.map +1 -0
- package/dist/agent/policy/loopReview.js +778 -0
- package/dist/agent/policy/loopReview.js.map +1 -0
- package/dist/agent/policy/readinessPolicy.js +108 -0
- package/dist/agent/policy/readinessPolicy.js.map +1 -0
- package/dist/agent/policy/resolutionPipeline.js +356 -0
- package/dist/agent/policy/resolutionPipeline.js.map +1 -0
- package/dist/agent/policy/targetClassification.js +33 -0
- package/dist/agent/policy/targetClassification.js.map +1 -0
- package/dist/agent/prompting/actionChoice.js +90 -0
- package/dist/agent/prompting/actionChoice.js.map +1 -0
- package/dist/agent/prompting/finalAnswer.js +38 -0
- package/dist/agent/prompting/finalAnswer.js.map +1 -0
- package/dist/agent/prompting/index.js +14 -0
- package/dist/agent/prompting/index.js.map +1 -0
- package/dist/agent/prompting/plan.js +59 -0
- package/dist/agent/prompting/plan.js.map +1 -0
- package/dist/agent/prompting/transform.js +175 -0
- package/dist/agent/prompting/transform.js.map +1 -0
- package/dist/agent/prompting/understand.js +70 -0
- package/dist/agent/prompting/understand.js.map +1 -0
- package/dist/agent/read/freshness.js +29 -0
- package/dist/agent/read/freshness.js.map +1 -0
- package/dist/agent/read/fullReadPrompt.js +43 -0
- package/dist/agent/read/fullReadPrompt.js.map +1 -0
- package/dist/agent/read/index.js +140 -0
- package/dist/agent/read/index.js.map +1 -0
- package/dist/agent/read/persistence.js +88 -0
- package/dist/agent/read/persistence.js.map +1 -0
- package/dist/agent/read/summarizeReadEvidence.js +733 -0
- package/dist/agent/read/summarizeReadEvidence.js.map +1 -0
- package/dist/agent/read/targetResolution.js +126 -0
- package/dist/agent/read/targetResolution.js.map +1 -0
- package/dist/agent/resume/checkpoint.js +41 -0
- package/dist/agent/resume/checkpoint.js.map +1 -0
- package/dist/agent/runtime/lifecycle.js +67 -0
- package/dist/agent/runtime/lifecycle.js.map +1 -0
- package/dist/agent/runtime/progress.js +178 -0
- package/dist/agent/runtime/progress.js.map +1 -0
- package/dist/agent/runtime/runAgentLoop.js +402 -0
- package/dist/agent/runtime/runAgentLoop.js.map +1 -0
- package/dist/agent/runtime/runAgentPlanOnly.js +127 -0
- package/dist/agent/runtime/runAgentPlanOnly.js.map +1 -0
- package/dist/agent/runtime/understand.js +336 -0
- package/dist/agent/runtime/understand.js.map +1 -0
- package/dist/agent/search/batchPlanner.js +274 -0
- package/dist/agent/search/batchPlanner.js.map +1 -0
- package/dist/agent/search/candidateRetentionPolicy.js +184 -0
- package/dist/agent/search/candidateRetentionPolicy.js.map +1 -0
- package/dist/agent/search/directory.js +51 -0
- package/dist/agent/search/directory.js.map +1 -0
- package/dist/agent/search/exactTarget.js +151 -0
- package/dist/agent/search/exactTarget.js.map +1 -0
- package/dist/agent/search/fragment.js +110 -0
- package/dist/agent/search/fragment.js.map +1 -0
- package/dist/agent/search/index.js +166 -0
- package/dist/agent/search/index.js.map +1 -0
- package/dist/agent/search/laneClassifier.js +119 -0
- package/dist/agent/search/laneClassifier.js.map +1 -0
- package/dist/agent/search/limits.js +10 -0
- package/dist/agent/search/limits.js.map +1 -0
- package/dist/agent/search/ranking.js +22 -0
- package/dist/agent/search/ranking.js.map +1 -0
- package/dist/agent/search/regex.js +83 -0
- package/dist/agent/search/regex.js.map +1 -0
- package/dist/agent/search/routePolicy.js +11 -0
- package/dist/agent/search/routePolicy.js.map +1 -0
- package/dist/agent/search/searchContext.js +128 -0
- package/dist/agent/search/searchContext.js.map +1 -0
- package/dist/agent/search/semantic.js +113 -0
- package/dist/agent/search/semantic.js.map +1 -0
- package/dist/agent/search/semanticIndexSearch.js +202 -0
- package/dist/agent/search/semanticIndexSearch.js.map +1 -0
- package/dist/agent/search/shared.js +283 -0
- package/dist/agent/search/shared.js.map +1 -0
- package/dist/agent/search/shell.js +202 -0
- package/dist/agent/search/shell.js.map +1 -0
- package/dist/agent/search/snippetEvidence.js +57 -0
- package/dist/agent/search/snippetEvidence.js.map +1 -0
- package/dist/agent/search/types.js +2 -0
- package/dist/agent/search/types.js.map +1 -0
- package/dist/agent/state/index.js +99 -0
- package/dist/agent/state/index.js.map +1 -0
- package/dist/agent/state/memory.js +56 -0
- package/dist/agent/state/memory.js.map +1 -0
- package/dist/agent/structuredOutput/index.js +28 -0
- package/dist/agent/structuredOutput/index.js.map +1 -0
- package/dist/agent/tools/index.js +199 -0
- package/dist/agent/tools/index.js.map +1 -0
- package/dist/agent/transform/index.js +519 -0
- package/dist/agent/transform/index.js.map +1 -0
- package/dist/agent/transform/syntax.js +49 -0
- package/dist/agent/transform/syntax.js.map +1 -0
- package/dist/agent/types.js +20 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agents/actionRegistry.js +114 -0
- package/dist/agents/actionRegistry.js.map +1 -0
- package/dist/agents/agent.js +5 -0
- package/dist/agents/agent.js.map +1 -0
- package/dist/agents/agentActions.js +5 -0
- package/dist/agents/agentActions.js.map +1 -0
- package/dist/agents/agentEvidence.js +5 -0
- package/dist/agents/agentEvidence.js.map +1 -0
- package/dist/agents/agentFeedback.js +5 -0
- package/dist/agents/agentFeedback.js.map +1 -0
- package/dist/agents/agentLogging.js +5 -0
- package/dist/agents/agentLogging.js.map +1 -0
- package/dist/agents/agentLoop.js +5 -0
- package/dist/agents/agentLoop.js.map +1 -0
- package/dist/agents/agentMemory.js +5 -0
- package/dist/agents/agentMemory.js.map +1 -0
- package/dist/agents/agentPlanMode.js +5 -0
- package/dist/agents/agentPlanMode.js.map +1 -0
- package/dist/agents/agentPolicyState.js +5 -0
- package/dist/agents/agentPolicyState.js.map +1 -0
- package/dist/agents/agentProgress.js +93 -0
- package/dist/agents/agentProgress.js.map +1 -0
- package/dist/agents/agentSchemas.js +5 -0
- package/dist/agents/agentSchemas.js.map +1 -0
- package/dist/agents/agentSearchScoring.js +5 -0
- package/dist/agents/agentSearchScoring.js.map +1 -0
- package/dist/agents/agentStateMachine.js +5 -0
- package/dist/agents/agentStateMachine.js.map +1 -0
- package/dist/agents/agentTools.js +5 -0
- package/dist/agents/agentTools.js.map +1 -0
- package/dist/agents/agentTypes.js +5 -0
- package/dist/agents/agentTypes.js.map +1 -0
- package/dist/agents/agentUnderstand.js +5 -0
- package/dist/agents/agentUnderstand.js.map +1 -0
- package/dist/agents/analysisPlanGenStep.js +194 -17
- package/dist/agents/analysisPlanGenStep.js.map +1 -0
- package/dist/agents/answerOnlyCompletion.js +32 -0
- package/dist/agents/answerOnlyCompletion.js.map +1 -0
- package/dist/agents/collaboratorStep.js +1 -0
- package/dist/agents/collaboratorStep.js.map +1 -0
- package/dist/agents/decideNextAction.js +444 -0
- package/dist/agents/decideNextAction.js.map +1 -0
- package/dist/agents/deriveFocusFromSearchStep.js +83 -0
- package/dist/agents/deriveFocusFromSearchStep.js.map +1 -0
- package/dist/agents/evidenceVerifierStep.js +104 -13
- package/dist/agents/evidenceVerifierStep.js.map +1 -0
- package/dist/agents/fileCheckStep.js +381 -12
- package/dist/agents/fileCheckStep.js.map +1 -0
- package/dist/agents/giveUpEvaluatorStep.js +63 -0
- package/dist/agents/giveUpEvaluatorStep.js.map +1 -0
- package/dist/agents/guardPolicy.js +20 -0
- package/dist/agents/guardPolicy.js.map +1 -0
- package/dist/agents/guards/executionPolicyResolver.js +165 -0
- package/dist/agents/guards/executionPolicyResolver.js.map +1 -0
- package/dist/agents/guards/guardState.js +195 -0
- package/dist/agents/guards/guardState.js.map +1 -0
- package/dist/agents/guards/resolveProgressState.js +403 -0
- package/dist/agents/guards/resolveProgressState.js.map +1 -0
- package/dist/agents/infoPlanGenStep.js +66 -8
- package/dist/agents/infoPlanGenStep.js.map +1 -0
- package/dist/agents/integrateFeedbackStep.js +1 -0
- package/dist/agents/integrateFeedbackStep.js.map +1 -0
- package/dist/agents/iterationFileSelector.js +8 -7
- package/dist/agents/iterationFileSelector.js.map +1 -0
- package/dist/agents/mainAgentActivityLog.js +85 -0
- package/dist/agents/mainAgentActivityLog.js.map +1 -0
- package/dist/agents/mainAgentHeuristics.js +173 -0
- package/dist/agents/mainAgentHeuristics.js.map +1 -0
- package/dist/agents/mainAgentVerify.js +159 -0
- package/dist/agents/mainAgentVerify.js.map +1 -0
- package/dist/agents/objectiveEvaluatorStep.js +103 -0
- package/dist/agents/objectiveEvaluatorStep.js.map +1 -0
- package/dist/agents/outerLoopRecoveryEvaluator.js +108 -0
- package/dist/agents/outerLoopRecoveryEvaluator.js.map +1 -0
- package/dist/agents/readinessGateStep.js +95 -9
- package/dist/agents/readinessGateStep.js.map +1 -0
- package/dist/agents/reasonNextStep.js +9 -8
- package/dist/agents/reasonNextStep.js.map +1 -0
- package/dist/agents/reasonNextTaskStep.js +267 -144
- package/dist/agents/reasonNextTaskStep.js.map +1 -0
- package/dist/agents/researchPlanGenStep.js +61 -25
- package/dist/agents/researchPlanGenStep.js.map +1 -0
- package/dist/agents/resolveAgentTargetClassification.js +5 -0
- package/dist/agents/resolveAgentTargetClassification.js.map +1 -0
- package/dist/agents/resolveExecutionModeStep.js +1 -0
- package/dist/agents/resolveExecutionModeStep.js.map +1 -0
- package/dist/agents/resolveExplicitTargetsStep.js +74 -0
- package/dist/agents/resolveExplicitTargetsStep.js.map +1 -0
- package/dist/agents/routingDecisionStep.js +58 -11
- package/dist/agents/routingDecisionStep.js.map +1 -0
- package/dist/agents/scopeClassificationStep.js +66 -3
- package/dist/agents/scopeClassificationStep.js.map +1 -0
- package/dist/agents/selectRelevantSourcesStep.js +13 -5
- package/dist/agents/selectRelevantSourcesStep.js.map +1 -0
- package/dist/agents/structuralPreloadStep.js +3 -4
- package/dist/agents/structuralPreloadStep.js.map +1 -0
- package/dist/agents/transformPlanGenStep.js +105 -18
- package/dist/agents/transformPlanGenStep.js.map +1 -0
- package/dist/agents/understandIntentStep.js +237 -17
- package/dist/agents/understandIntentStep.js.map +1 -0
- package/dist/agents/validateChangesStep.js +16 -2
- package/dist/agents/validateChangesStep.js.map +1 -0
- package/dist/agents/writeFileStep.js +1 -0
- package/dist/agents/writeFileStep.js.map +1 -0
- package/dist/commands/AskCmd.js +139 -44
- package/dist/commands/AskCmd.js.map +1 -0
- package/dist/commands/BackupCmd.js +1 -0
- package/dist/commands/BackupCmd.js.map +1 -0
- package/dist/commands/ChangeLogUpdateCmd.js +1 -0
- package/dist/commands/ChangeLogUpdateCmd.js.map +1 -0
- package/dist/commands/CommitSuggesterCmd.js +55 -13
- package/dist/commands/CommitSuggesterCmd.js.map +1 -0
- package/dist/commands/DaemonCmd.js +52 -14
- package/dist/commands/DaemonCmd.js.map +1 -0
- package/dist/commands/DeleteIndex.js +1 -0
- package/dist/commands/DeleteIndex.js.map +1 -0
- package/dist/commands/EvalReportCmd.js +374 -0
- package/dist/commands/EvalReportCmd.js.map +1 -0
- package/dist/commands/FindCmd.js +1 -0
- package/dist/commands/FindCmd.js.map +1 -0
- package/dist/commands/GitCmd.js +1 -0
- package/dist/commands/GitCmd.js.map +1 -0
- package/dist/commands/IndexCmd.js +11 -79
- package/dist/commands/IndexCmd.js.map +1 -0
- package/dist/commands/InspectCmd.js +1 -0
- package/dist/commands/InspectCmd.js.map +1 -0
- package/dist/commands/ModelCmd.js +24 -0
- package/dist/commands/ModelCmd.js.map +1 -0
- package/dist/commands/ReadlineSingleton.js +1 -0
- package/dist/commands/ReadlineSingleton.js.map +1 -0
- package/dist/commands/ResetDbCmd.js +18 -1
- package/dist/commands/ResetDbCmd.js.map +1 -0
- package/dist/commands/ReviewCmd.js +1 -0
- package/dist/commands/ReviewCmd.js.map +1 -0
- package/dist/commands/StatusCmd.js +22 -0
- package/dist/commands/StatusCmd.js.map +1 -0
- package/dist/commands/StopDaemonCmd.js +1 -0
- package/dist/commands/StopDaemonCmd.js.map +1 -0
- package/dist/commands/SummaryCmd.js +1 -0
- package/dist/commands/SummaryCmd.js.map +1 -0
- package/dist/commands/SwitchCmd.js +9 -15
- package/dist/commands/SwitchCmd.js.map +1 -0
- package/dist/commands/TasksCmd.js +142 -57
- package/dist/commands/TasksCmd.js.map +1 -0
- package/dist/commands/TestCmd.js +66 -0
- package/dist/commands/TestCmd.js.map +1 -0
- package/dist/commands/WorkflowCmd.js +1 -0
- package/dist/commands/WorkflowCmd.js.map +1 -0
- package/dist/commands/commandVisibility.js +27 -0
- package/dist/commands/commandVisibility.js.map +1 -0
- package/dist/commands/evalCommands.js +1337 -0
- package/dist/commands/evalCommands.js.map +1 -0
- package/dist/commands/factory.js +206 -38
- package/dist/commands/factory.js.map +1 -0
- package/dist/config.js +62 -11
- package/dist/config.js.map +1 -0
- package/dist/constants.js +21 -3
- package/dist/constants.js.map +1 -0
- package/dist/context.js +33 -32
- package/dist/context.js.map +1 -0
- package/dist/daemon/daemonQueues.js +1 -20
- package/dist/daemon/daemonQueues.js.map +1 -0
- package/dist/daemon/daemonWorker.js +26 -37
- package/dist/daemon/daemonWorker.js.map +1 -0
- package/dist/daemon/generateSummaries.js +1 -0
- package/dist/daemon/generateSummaries.js.map +1 -0
- package/dist/daemon/runFolderCapsuleBatch.js +1 -0
- package/dist/daemon/runFolderCapsuleBatch.js.map +1 -0
- package/dist/daemon/runIndexingBatch.js +1 -0
- package/dist/daemon/runIndexingBatch.js.map +1 -0
- package/dist/daemon/runKgBatch.js +9 -1
- package/dist/daemon/runKgBatch.js.map +1 -0
- package/dist/db/backup.js +1 -0
- package/dist/db/backup.js.map +1 -0
- package/dist/db/client.js +18 -3
- package/dist/db/client.js.map +1 -0
- package/dist/db/fileIndex.js +110 -152
- package/dist/db/fileIndex.js.map +1 -0
- package/dist/db/functionExtractors/extractFromJava.js +1 -0
- package/dist/db/functionExtractors/extractFromJava.js.map +1 -0
- package/dist/db/functionExtractors/extractFromJs.js +1 -0
- package/dist/db/functionExtractors/extractFromJs.js.map +1 -0
- package/dist/db/functionExtractors/extractFromTs.js +1 -0
- package/dist/db/functionExtractors/extractFromTs.js.map +1 -0
- package/dist/db/functionExtractors/extractFromXML.js +1 -0
- package/dist/db/functionExtractors/extractFromXML.js.map +1 -0
- package/dist/db/functionExtractors/index.js +1 -0
- package/dist/db/functionExtractors/index.js.map +1 -0
- package/dist/db/functionIndex.js +9 -0
- package/dist/db/functionIndex.js.map +1 -0
- package/dist/db/schema.js +314 -99
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sqlTemplates.js +1 -0
- package/dist/db/sqlTemplates.js.map +1 -0
- package/dist/fileRules/builtins.js +1 -0
- package/dist/fileRules/builtins.js.map +1 -0
- package/dist/fileRules/classifyFile.js +1 -0
- package/dist/fileRules/classifyFile.js.map +1 -0
- package/dist/fileRules/codeAllowedExtensions.js +1 -0
- package/dist/fileRules/codeAllowedExtensions.js.map +1 -0
- package/dist/fileRules/detectFileType.js +1 -0
- package/dist/fileRules/detectFileType.js.map +1 -0
- package/dist/fileRules/fileClassifier.js +1 -0
- package/dist/fileRules/fileClassifier.js.map +1 -0
- package/dist/fileRules/fileExceptions.js +1 -0
- package/dist/fileRules/fileExceptions.js.map +1 -0
- package/dist/fileRules/ignoredExtensions.js +1 -0
- package/dist/fileRules/ignoredExtensions.js.map +1 -0
- package/dist/fileRules/ignoredPaths.js +48 -5
- package/dist/fileRules/ignoredPaths.js.map +1 -0
- package/dist/fileRules/queryTokenRules.js +176 -0
- package/dist/fileRules/queryTokenRules.js.map +1 -0
- package/dist/fileRules/searchPathClassification.js +58 -0
- package/dist/fileRules/searchPathClassification.js.map +1 -0
- package/dist/fileRules/shouldIgnoreFiles.js +1 -0
- package/dist/fileRules/shouldIgnoreFiles.js.map +1 -0
- package/dist/fileRules/stopWords.js +9 -0
- package/dist/fileRules/stopWords.js.map +1 -0
- package/dist/fileRules/wellKnownRepoFiles.js +1 -0
- package/dist/fileRules/wellKnownRepoFiles.js.map +1 -0
- package/dist/git/commitSummary.js +227 -0
- package/dist/git/commitSummary.js.map +1 -0
- package/dist/github/api.js +1 -0
- package/dist/github/api.js.map +1 -0
- package/dist/github/auth.js +1 -0
- package/dist/github/auth.js.map +1 -0
- package/dist/github/github.js +1 -0
- package/dist/github/github.js.map +1 -0
- package/dist/github/githubAuthCheck.js +1 -0
- package/dist/github/githubAuthCheck.js.map +1 -0
- package/dist/github/postComments.js +1 -0
- package/dist/github/postComments.js.map +1 -0
- package/dist/github/repo.js +15 -24
- package/dist/github/repo.js.map +1 -0
- package/dist/github/token.js +1 -0
- package/dist/github/token.js.map +1 -0
- package/dist/github/types.js +1 -0
- package/dist/github/types.js.map +1 -0
- package/dist/index.js +318 -37
- package/dist/index.js.map +1 -0
- package/dist/lib/generate.js +264 -20
- package/dist/lib/generate.js.map +1 -0
- package/dist/lib/generateFolderCapsules.js +1 -0
- package/dist/lib/generateFolderCapsules.js.map +1 -0
- package/dist/lib/ollamaModelPolicy.js +59 -0
- package/dist/lib/ollamaModelPolicy.js.map +1 -0
- package/dist/lib/spinner.js +29 -9
- package/dist/lib/spinner.js.map +1 -0
- package/dist/modelSetup.js +25 -78
- package/dist/modelSetup.js.map +1 -0
- package/dist/pipeline/modules/changeLogModule.js +10 -1
- package/dist/pipeline/modules/changeLogModule.js.map +1 -0
- package/dist/pipeline/modules/cleanupModule.js +1 -0
- package/dist/pipeline/modules/cleanupModule.js.map +1 -0
- package/dist/pipeline/modules/codeTransformModule.js +10 -16
- package/dist/pipeline/modules/codeTransformModule.js.map +1 -0
- package/dist/pipeline/modules/commentModule.js +12 -0
- package/dist/pipeline/modules/commentModule.js.map +1 -0
- package/dist/pipeline/modules/commitSuggesterModule.js +82 -12
- package/dist/pipeline/modules/commitSuggesterModule.js.map +1 -0
- package/dist/pipeline/modules/contextReviewModule.js +12 -1
- package/dist/pipeline/modules/contextReviewModule.js.map +1 -0
- package/dist/pipeline/modules/dialogAnswerModule.js +58 -0
- package/dist/pipeline/modules/dialogAnswerModule.js.map +1 -0
- package/dist/pipeline/modules/fileSearchModule.js +5 -143
- package/dist/pipeline/modules/fileSearchModule.js.map +1 -0
- package/dist/pipeline/modules/finalAnswerModule.js +1176 -151
- package/dist/pipeline/modules/finalAnswerModule.js.map +1 -0
- package/dist/pipeline/modules/kgModule.js +18 -1
- package/dist/pipeline/modules/kgModule.js.map +1 -0
- package/dist/pipeline/modules/planAnswerModule.js +99 -0
- package/dist/pipeline/modules/planAnswerModule.js.map +1 -0
- package/dist/pipeline/modules/readFileModule.js +300 -0
- package/dist/pipeline/modules/readFileModule.js.map +1 -0
- package/dist/pipeline/modules/reviewModule.js +10 -1
- package/dist/pipeline/modules/reviewModule.js.map +1 -0
- package/dist/pipeline/modules/searchDbModule.js +159 -0
- package/dist/pipeline/modules/searchDbModule.js.map +1 -0
- package/dist/pipeline/modules/searchListDirectoryModule.js +62 -0
- package/dist/pipeline/modules/searchListDirectoryModule.js.map +1 -0
- package/dist/pipeline/modules/searchModuleShared.js +71 -0
- package/dist/pipeline/modules/searchModuleShared.js.map +1 -0
- package/dist/pipeline/modules/searchRegexModule.js +59 -0
- package/dist/pipeline/modules/searchRegexModule.js.map +1 -0
- package/dist/pipeline/modules/semanticAnalysisModule.js +185 -28
- package/dist/pipeline/modules/semanticAnalysisModule.js.map +1 -0
- package/dist/pipeline/modules/summaryModule.js +11 -1
- package/dist/pipeline/modules/summaryModule.js.map +1 -0
- package/dist/pipeline/registry/moduleRegistry.js +9 -0
- package/dist/pipeline/registry/moduleRegistry.js.map +1 -0
- package/dist/pipeline/runModulePipeline.js +1 -0
- package/dist/pipeline/runModulePipeline.js.map +1 -0
- package/dist/scripts/dbScriptSupport.js +172 -0
- package/dist/scripts/dbScriptSupport.js.map +1 -0
- package/dist/scripts/dbcheck.js +173 -267
- package/dist/scripts/dbcheck.js.map +1 -0
- package/dist/scripts/dboverview.js +161 -0
- package/dist/scripts/dboverview.js.map +1 -0
- package/dist/scripts/migrateDb.js +1 -0
- package/dist/scripts/migrateDb.js.map +1 -0
- package/dist/search/SearchOrchestrator.js +928 -0
- package/dist/search/SearchOrchestrator.js.map +1 -0
- package/dist/search/sharedRankingPolicy.js +283 -0
- package/dist/search/sharedRankingPolicy.js.map +1 -0
- package/dist/setup/reindexOwner.js +97 -0
- package/dist/setup/reindexOwner.js.map +1 -0
- package/dist/setup/setupOwner.js +100 -0
- package/dist/setup/setupOwner.js.map +1 -0
- package/dist/shell/dialogUi.js +81 -0
- package/dist/shell/dialogUi.js.map +1 -0
- package/dist/shellSession.js +126 -0
- package/dist/shellSession.js.map +1 -0
- package/dist/status/statusOwner.js +239 -0
- package/dist/status/statusOwner.js.map +1 -0
- package/dist/testing/contextEval.js +514 -0
- package/dist/testing/contextEval.js.map +1 -0
- package/dist/testing/fixtures/transform/small-file.input.js +5 -0
- package/dist/testing/fixtures/transform/small-file.input.js.map +1 -0
- package/dist/testing/harnessArtifacts.js +112 -0
- package/dist/testing/harnessArtifacts.js.map +1 -0
- package/dist/testing/llmTraceSession.js +67 -0
- package/dist/testing/llmTraceSession.js.map +1 -0
- package/dist/testing/registerDevCliCommands.js +43 -0
- package/dist/testing/registerDevCliCommands.js.map +1 -0
- package/dist/testing/runDiagnosis.js +248 -0
- package/dist/testing/runDiagnosis.js.map +1 -0
- package/dist/testing/runtimeLogReader.js +144 -0
- package/dist/testing/runtimeLogReader.js.map +1 -0
- package/dist/testing/testCommands.js +35 -303
- package/dist/testing/testCommands.js.map +1 -0
- package/dist/testing/testRegistry.js +233 -0
- package/dist/testing/testRegistry.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buildContextualPrompt.js +26 -75
- package/dist/utils/buildContextualPrompt.js.map +1 -0
- package/dist/utils/changeLogPrompt.js +1 -0
- package/dist/utils/changeLogPrompt.js.map +1 -0
- package/dist/utils/checkModel.js +17 -92
- package/dist/utils/checkModel.js.map +1 -0
- package/dist/utils/commentMap.js +1 -0
- package/dist/utils/commentMap.js.map +1 -0
- package/dist/utils/compileSearchQuery.js +23 -9
- package/dist/utils/compileSearchQuery.js.map +1 -0
- package/dist/utils/consolePresentation.js +208 -0
- package/dist/utils/consolePresentation.js.map +1 -0
- package/dist/utils/contentUtils.js +17 -2
- package/dist/utils/contentUtils.js.map +1 -0
- package/dist/utils/debugContext.js +1 -0
- package/dist/utils/debugContext.js.map +1 -0
- package/dist/utils/dialogState.js +201 -0
- package/dist/utils/dialogState.js.map +1 -0
- package/dist/utils/editor.js +1 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/executionEvidence.js +50 -0
- package/dist/utils/executionEvidence.js.map +1 -0
- package/dist/utils/extractFileReferences.js +140 -6
- package/dist/utils/extractFileReferences.js.map +1 -0
- package/dist/utils/fileEvidenceCache.js +50 -0
- package/dist/utils/fileEvidenceCache.js.map +1 -0
- package/dist/utils/fileTree.js +1 -0
- package/dist/utils/fileTree.js.map +1 -0
- package/dist/utils/loadRelevantFolderCapsules.js +35 -5
- package/dist/utils/loadRelevantFolderCapsules.js.map +1 -0
- package/dist/utils/log.js +10 -1
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/normalizeData.js +1 -0
- package/dist/utils/normalizeData.js.map +1 -0
- package/dist/utils/ollamaModelStatus.js +28 -0
- package/dist/utils/ollamaModelStatus.js.map +1 -0
- package/dist/utils/ollamaService.js +294 -0
- package/dist/utils/ollamaService.js.map +1 -0
- package/dist/utils/outputFormatter.js +1 -0
- package/dist/utils/outputFormatter.js.map +1 -0
- package/dist/utils/parseTaggedContent.js +1 -0
- package/dist/utils/parseTaggedContent.js.map +1 -0
- package/dist/utils/planActions.js +27 -46
- package/dist/utils/planActions.js.map +1 -0
- package/dist/utils/promptBuilderHelper.js +1 -0
- package/dist/utils/promptBuilderHelper.js.map +1 -0
- package/dist/utils/promptLogHelper.js +29 -13
- package/dist/utils/promptLogHelper.js.map +1 -0
- package/dist/utils/queryAnchors.js +71 -0
- package/dist/utils/queryAnchors.js.map +1 -0
- package/dist/utils/repoIdentity.js +82 -0
- package/dist/utils/repoIdentity.js.map +1 -0
- package/dist/utils/repoKey.js +1 -0
- package/dist/utils/repoKey.js.map +1 -0
- package/dist/utils/resolveTargetsToFiles.js +1 -0
- package/dist/utils/resolveTargetsToFiles.js.map +1 -0
- package/dist/utils/resumeContext.js +219 -0
- package/dist/utils/resumeContext.js.map +1 -0
- package/dist/utils/resumeState.js +310 -0
- package/dist/utils/resumeState.js.map +1 -0
- package/dist/utils/rollingPlan.js +118 -0
- package/dist/utils/rollingPlan.js.map +1 -0
- package/dist/utils/runQueryWithDaemonControl.js +11 -3
- package/dist/utils/runQueryWithDaemonControl.js.map +1 -0
- package/dist/utils/runtimeLogger.js +252 -0
- package/dist/utils/runtimeLogger.js.map +1 -0
- package/dist/utils/sanitizeQuery.js +1 -0
- package/dist/utils/sanitizeQuery.js.map +1 -0
- package/dist/utils/sharedUtils.js +1 -0
- package/dist/utils/sharedUtils.js.map +1 -0
- package/dist/utils/sleep.js +1 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/splitCodeIntoChunk.js +1 -0
- package/dist/utils/splitCodeIntoChunk.js.map +1 -0
- package/dist/utils/time.js +66 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/verifyFocusPreference.js +107 -0
- package/dist/utils/verifyFocusPreference.js.map +1 -0
- package/dist/utils/vscode.js +1 -0
- package/dist/utils/vscode.js.map +1 -0
- package/dist/workflow/workflowResolver.js +1 -0
- package/dist/workflow/workflowResolver.js.map +1 -0
- package/dist/workflow/workflowRunner.js +1 -0
- package/dist/workflow/workflowRunner.js.map +1 -0
- package/package.json +3 -3
- package/dist/agents/MainAgent.js +0 -1886
- package/dist/agents/contextReviewStep.js +0 -101
- package/dist/agents/finalPlanGenStep.js +0 -107
- package/dist/agents/structuralAnalysisStep.js +0 -46
- package/dist/agents/validationAnalysisStep.js +0 -87
- package/dist/pipeline/modules/chunkManagerModule.js +0 -24
- package/dist/pipeline/modules/cleanGeneratedTestsModule.js +0 -33
- package/dist/pipeline/modules/fileReaderModule.js +0 -72
- package/dist/pipeline/modules/gatherInfoModule.js +0 -181
- package/dist/pipeline/modules/generateTestsModule.js +0 -68
- package/dist/pipeline/modules/preserveCodeModule.js +0 -195
- package/dist/pipeline/modules/refactorModule.js +0 -40
- package/dist/pipeline/modules/repairTestsModule.js +0 -48
- package/dist/pipeline/modules/runTestsModule.js +0 -37
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// File: src/modules/contextReviewStep.ts
|
|
2
|
-
import { generate } from "../lib/generate.js";
|
|
3
|
-
import { logInputOutput } from "../utils/promptLogHelper.js";
|
|
4
|
-
export async function contextReviewStep(context) {
|
|
5
|
-
const analysis = context.analysis;
|
|
6
|
-
if (!analysis) {
|
|
7
|
-
throw new Error("[contextReviewStep] No analysis state available.");
|
|
8
|
-
}
|
|
9
|
-
const intent = analysis.intent ?? {
|
|
10
|
-
intent: "",
|
|
11
|
-
intentCategory: "",
|
|
12
|
-
normalizedQuery: "",
|
|
13
|
-
confidence: 0,
|
|
14
|
-
};
|
|
15
|
-
const focus = analysis.focus ?? {
|
|
16
|
-
selectedFiles: [],
|
|
17
|
-
candidateFiles: [],
|
|
18
|
-
rationale: "",
|
|
19
|
-
};
|
|
20
|
-
const fileAnalysis = analysis.fileAnalysis ?? {};
|
|
21
|
-
const planDecision = analysis.planSuggestion?.plan
|
|
22
|
-
? "planExists"
|
|
23
|
-
: "needsPlan";
|
|
24
|
-
// ------------------------------
|
|
25
|
-
// Compress file-level analysis to high-signal summaries
|
|
26
|
-
// ------------------------------
|
|
27
|
-
const summarizedFiles = Object.entries(fileAnalysis)
|
|
28
|
-
.filter(([, fa]) => fa.intent === "relevant")
|
|
29
|
-
.map(([filePath, fa]) => ({
|
|
30
|
-
file: filePath,
|
|
31
|
-
role: fa.role ?? "unspecified",
|
|
32
|
-
relevance: fa.relevanceExplanation,
|
|
33
|
-
proposedChangeScope: fa.proposedChanges?.scope ?? "none",
|
|
34
|
-
excerptCount: fa.excerpts?.length ?? 0,
|
|
35
|
-
excerptTopics: fa.excerpts?.map(e => e.description).slice(0, 3),
|
|
36
|
-
}));
|
|
37
|
-
// ------------------------------
|
|
38
|
-
// Build prompt using distilled conclusions only
|
|
39
|
-
// ------------------------------
|
|
40
|
-
const prompt = `
|
|
41
|
-
You are a meta-reasoning agent.
|
|
42
|
-
|
|
43
|
-
Your job is to determine whether enough relevant information
|
|
44
|
-
has been collected to directly answer the user's intent,
|
|
45
|
-
or whether more data must be gathered first.
|
|
46
|
-
|
|
47
|
-
Decision meanings:
|
|
48
|
-
- "executeOnQuery": The collected analysis and files are sufficient to answer the user's question.
|
|
49
|
-
- "gatherData": The current analysis is insufficient; more files or analysis are required.
|
|
50
|
-
|
|
51
|
-
User Intent:
|
|
52
|
-
${JSON.stringify(intent, null, 2)}
|
|
53
|
-
|
|
54
|
-
Plan Suggestion Status: ${planDecision}
|
|
55
|
-
|
|
56
|
-
Relevant Files (paths only):
|
|
57
|
-
${JSON.stringify(focus.selectedFiles, null, 2)}
|
|
58
|
-
|
|
59
|
-
Missing Files:
|
|
60
|
-
${JSON.stringify(focus.candidateFiles, null, 2)}
|
|
61
|
-
|
|
62
|
-
Why these files were selected:
|
|
63
|
-
${focus.rationale ?? "No rationale provided."}
|
|
64
|
-
|
|
65
|
-
Relevant File Summaries (high-signal only):
|
|
66
|
-
${JSON.stringify(summarizedFiles, null, 2)}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Question:
|
|
70
|
-
Based on the above, is there enough information to answer the user's question directly?
|
|
71
|
-
|
|
72
|
-
Output STRICT JSON with shape:
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
"decision": "gatherData" | "executeOnQuery",
|
|
76
|
-
"reason": "concise explanation",
|
|
77
|
-
"missing": string[]
|
|
78
|
-
}
|
|
79
|
-
`.trim();
|
|
80
|
-
const ai = await generate({
|
|
81
|
-
query: context.initContext?.userQuery ?? "",
|
|
82
|
-
content: prompt,
|
|
83
|
-
});
|
|
84
|
-
const text = typeof ai.data === "string" ? ai.data : JSON.stringify(ai.data);
|
|
85
|
-
logInputOutput("contextReviewStep", "output", text);
|
|
86
|
-
// ------------------------------
|
|
87
|
-
// Parse JSON or fallback
|
|
88
|
-
// ------------------------------
|
|
89
|
-
try {
|
|
90
|
-
return JSON.parse(text);
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
return {
|
|
94
|
-
decision: text.toLowerCase().includes("gather")
|
|
95
|
-
? "gatherData"
|
|
96
|
-
: "executeOnQuery",
|
|
97
|
-
reason: text,
|
|
98
|
-
missing: [],
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// File: src/agents/finalPlanGenStep.ts
|
|
2
|
-
import { generate } from '../lib/generate.js';
|
|
3
|
-
import { PLAN_ACTIONS } from '../utils/planActions.js';
|
|
4
|
-
import { logInputOutput } from '../utils/promptLogHelper.js';
|
|
5
|
-
import { cleanupModule } from '../pipeline/modules/cleanupModule.js';
|
|
6
|
-
/**
|
|
7
|
-
* FINAL PLAN GENERATOR
|
|
8
|
-
* Generates a single finalization step to wrap up and produce user-facing results.
|
|
9
|
-
*/
|
|
10
|
-
export const finalPlanGenStep = {
|
|
11
|
-
name: 'finalPlanGen',
|
|
12
|
-
description: 'Generates a single finalization step for the workflow.',
|
|
13
|
-
requires: ['analysis.intent', 'analysis.focus'],
|
|
14
|
-
produces: ['analysis.planSuggestion'],
|
|
15
|
-
async run(context) {
|
|
16
|
-
context.analysis || (context.analysis = {});
|
|
17
|
-
// Clear previous final plan
|
|
18
|
-
delete context.analysis.planSuggestion;
|
|
19
|
-
// Restrict actions to FINALIZE only
|
|
20
|
-
const effectiveActions = PLAN_ACTIONS.filter(a => a.groups?.includes('finalize'));
|
|
21
|
-
if (!effectiveActions.length) {
|
|
22
|
-
context.analysis.planSuggestion = { plan: { steps: [] } };
|
|
23
|
-
logInputOutput('finalPlanGen', 'output', { steps: [] });
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const actionsJson = JSON.stringify(effectiveActions, null, 2);
|
|
27
|
-
const intentText = context.analysis.intent?.normalizedQuery ?? '';
|
|
28
|
-
const intentCategory = context.analysis.intent?.intentCategory ?? '';
|
|
29
|
-
const prompt = `
|
|
30
|
-
You are an autonomous coding agent.
|
|
31
|
-
|
|
32
|
-
Produce exactly one structured step to finalize the workflow and generate the user-facing output.
|
|
33
|
-
|
|
34
|
-
Intent / task description:
|
|
35
|
-
${intentText}
|
|
36
|
-
|
|
37
|
-
Task category:
|
|
38
|
-
${intentCategory}
|
|
39
|
-
|
|
40
|
-
Allowed actions (finalize only):
|
|
41
|
-
${actionsJson}
|
|
42
|
-
|
|
43
|
-
Rules:
|
|
44
|
-
- Only produce a single finalize step.
|
|
45
|
-
- Step must include: "action", "targetFile" (optional), "description", "metadata".
|
|
46
|
-
- Do NOT invent new actions.
|
|
47
|
-
- Always ensure a user-facing result is produced.
|
|
48
|
-
|
|
49
|
-
Return strictly valid JSON representing one step:
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
"action": "stepName",
|
|
53
|
-
"targetFile": "optional/path.ts",
|
|
54
|
-
"description": "Generate final user-facing output summarizing results.",
|
|
55
|
-
"metadata": {}
|
|
56
|
-
}
|
|
57
|
-
`.trim();
|
|
58
|
-
try {
|
|
59
|
-
const genInput = { query: intentText, content: prompt };
|
|
60
|
-
const genOutput = await generate(genInput);
|
|
61
|
-
const raw = typeof genOutput.data === 'string' ? genOutput.data : JSON.stringify(genOutput.data ?? '{}');
|
|
62
|
-
const cleaned = await cleanupModule.run({ query: intentText, content: raw });
|
|
63
|
-
const jsonString = typeof cleaned.content === 'string' ? cleaned.content : JSON.stringify(cleaned.content ?? '{}');
|
|
64
|
-
let step = JSON.parse(jsonString);
|
|
65
|
-
// Validate structure
|
|
66
|
-
if (!step || typeof step.action !== 'string') {
|
|
67
|
-
step = {
|
|
68
|
-
id: 'finalize',
|
|
69
|
-
action: 'finalAnswer',
|
|
70
|
-
description: 'Generate final user-facing response summarizing results.',
|
|
71
|
-
metadata: {}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// Map groups & metadata
|
|
75
|
-
const actionDef = PLAN_ACTIONS.find(a => a.action === step.action);
|
|
76
|
-
step.groups = actionDef?.groups ?? ['finalize'];
|
|
77
|
-
const confidence = context.analysis?.routingDecision?.confidence;
|
|
78
|
-
step.metadata = {
|
|
79
|
-
...step.metadata,
|
|
80
|
-
...(typeof confidence === 'number' && confidence > 0
|
|
81
|
-
? { routingConfidence: confidence }
|
|
82
|
-
: {})
|
|
83
|
-
};
|
|
84
|
-
// Save single step to context
|
|
85
|
-
context.analysis.planSuggestion = { plan: { steps: [step] } };
|
|
86
|
-
logInputOutput('finalPlanGen', 'output', step);
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
console.warn('⚠️ Failed to generate final step:', err);
|
|
90
|
-
// Fallback: always include finalAnswer
|
|
91
|
-
const confidence = context.analysis?.routingDecision?.confidence;
|
|
92
|
-
const step = {
|
|
93
|
-
id: 'finalize',
|
|
94
|
-
action: 'finalAnswer',
|
|
95
|
-
description: 'Generate final user-facing response summarizing results.',
|
|
96
|
-
metadata: {
|
|
97
|
-
...(typeof confidence === 'number' && confidence > 0
|
|
98
|
-
? { routingConfidence: confidence }
|
|
99
|
-
: {})
|
|
100
|
-
},
|
|
101
|
-
groups: ['finalize']
|
|
102
|
-
};
|
|
103
|
-
context.analysis.planSuggestion = { plan: { steps: [step] } };
|
|
104
|
-
logInputOutput('finalPlanGen', 'output', step);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { logInputOutput } from "../utils/promptLogHelper.js";
|
|
2
|
-
export const structuralAnalysisStep = {
|
|
3
|
-
name: "structuralAnalysis",
|
|
4
|
-
description: "Derive structural characteristics from workingFiles using existing metadata only. " +
|
|
5
|
-
"Produces a durable, machine-usable summary of file shape and relationships.",
|
|
6
|
-
groups: ["analysis"],
|
|
7
|
-
run: async (input) => {
|
|
8
|
-
const ctx = input.context;
|
|
9
|
-
if (!ctx) {
|
|
10
|
-
throw new Error("[structuralAnalysis] StructuredContext is required but was not provided.");
|
|
11
|
-
}
|
|
12
|
-
const workingFiles = ctx.workingFiles;
|
|
13
|
-
if (!Array.isArray(workingFiles) || workingFiles.length === 0) {
|
|
14
|
-
const output = {
|
|
15
|
-
query: input.query,
|
|
16
|
-
data: {
|
|
17
|
-
notes: "No workingFiles present; structural analysis skipped."
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
logInputOutput("structuralAnalysis", "output", output.data);
|
|
21
|
-
return output;
|
|
22
|
-
}
|
|
23
|
-
const files = workingFiles.map((file) => ({
|
|
24
|
-
path: file.path,
|
|
25
|
-
imports: file.imports ?? [],
|
|
26
|
-
exports: file.exports ?? [],
|
|
27
|
-
functions: file.functions?.length ?? 0,
|
|
28
|
-
classes: file.classes?.length ?? 0,
|
|
29
|
-
}));
|
|
30
|
-
// 🧠 Persist durable structural understanding
|
|
31
|
-
ctx.analysis ?? (ctx.analysis = {});
|
|
32
|
-
ctx.analysis.structure = {
|
|
33
|
-
files,
|
|
34
|
-
};
|
|
35
|
-
const output = {
|
|
36
|
-
query: input.query,
|
|
37
|
-
data: {
|
|
38
|
-
fileCount: files.length,
|
|
39
|
-
files,
|
|
40
|
-
notes: "Structural characteristics derived from loaded workingFiles.",
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
logInputOutput("structuralAnalysis", "output", output.data);
|
|
44
|
-
return output;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { logInputOutput } from "../utils/promptLogHelper.js";
|
|
2
|
-
export const validationAnalysisStep = {
|
|
3
|
-
name: "validationAnalysis",
|
|
4
|
-
description: "Validate semantic analysis results and verify that focused working files were correctly synced into plan.targetFiles.",
|
|
5
|
-
groups: ["analysis"],
|
|
6
|
-
run: async (input) => {
|
|
7
|
-
const ctx = input.context;
|
|
8
|
-
if (!ctx) {
|
|
9
|
-
throw new Error("[validationAnalysisStep] StructuredContext is required but was not provided.");
|
|
10
|
-
}
|
|
11
|
-
const notes = [];
|
|
12
|
-
const warnings = [];
|
|
13
|
-
// -----------------------------
|
|
14
|
-
// Focus validation
|
|
15
|
-
// -----------------------------
|
|
16
|
-
const focusFiles = ctx.analysis?.focus?.selectedFiles ?? [];
|
|
17
|
-
if (!focusFiles.length) {
|
|
18
|
-
warnings.push("No relevant files found in analysis.focus.");
|
|
19
|
-
}
|
|
20
|
-
// -----------------------------
|
|
21
|
-
// Semantic understanding validation
|
|
22
|
-
// -----------------------------
|
|
23
|
-
const understanding = ctx.analysis?.understanding;
|
|
24
|
-
if (!understanding) {
|
|
25
|
-
notes.push("No semantic understanding produced by analysis.");
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
if (!understanding.risks?.length) {
|
|
29
|
-
notes.push("No risks recorded in analysis.understanding.");
|
|
30
|
-
}
|
|
31
|
-
if (!understanding.assumptions?.length) {
|
|
32
|
-
notes.push("No assumptions recorded in analysis.understanding.");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// -----------------------------
|
|
36
|
-
// Intent presence & shape validation
|
|
37
|
-
// (Produced by understandIntent step)
|
|
38
|
-
// -----------------------------
|
|
39
|
-
const intent = ctx.analysis?.intent;
|
|
40
|
-
if (!intent) {
|
|
41
|
-
warnings.push("No intent found in context (expected from understandIntent step).");
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (!intent.intent || !intent.intentCategory) {
|
|
45
|
-
warnings.push("Intent is missing required fields (intent/intentCategory).");
|
|
46
|
-
}
|
|
47
|
-
if (typeof intent.confidence !== "number") {
|
|
48
|
-
warnings.push("Intent confidence not set or invalid.");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// -----------------------------
|
|
52
|
-
// Plan.targetFiles consistency validation
|
|
53
|
-
// -----------------------------
|
|
54
|
-
const plan = ctx.plan;
|
|
55
|
-
const workingFiles = new Set(ctx.workingFiles?.map(f => f.path) ?? []);
|
|
56
|
-
const targetFiles = new Set(plan?.targetFiles ?? []);
|
|
57
|
-
if (!plan) {
|
|
58
|
-
warnings.push("No plan found in context; target files were not validated.");
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// Only focused files that are also working files are expected to be in the plan
|
|
62
|
-
const expectedTargetFiles = focusFiles.filter(f => workingFiles.has(f));
|
|
63
|
-
const missing = expectedTargetFiles.filter(f => !targetFiles.has(f));
|
|
64
|
-
if (missing.length > 0) {
|
|
65
|
-
warnings.push(`Some focused working files were not added to plan.targetFiles: ${missing.join(", ")}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const output = {
|
|
69
|
-
query: input.query,
|
|
70
|
-
data: {
|
|
71
|
-
notes,
|
|
72
|
-
warnings,
|
|
73
|
-
summary: {
|
|
74
|
-
focusValid: focusFiles.length > 0,
|
|
75
|
-
semanticValid: !!understanding,
|
|
76
|
-
intentValid: !!intent,
|
|
77
|
-
planFilesValid: !!plan &&
|
|
78
|
-
focusFiles
|
|
79
|
-
.filter(f => workingFiles.has(f))
|
|
80
|
-
.every(f => targetFiles.has(f)),
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
logInputOutput("validationAnalysis", "output", output.data);
|
|
85
|
-
return output;
|
|
86
|
-
},
|
|
87
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/pipeline/modules/chunkManagerModule.ts
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { normalizePath } from '../../utils/contentUtils.js';
|
|
4
|
-
import { splitCodeIntoChunks } from '../../utils/splitCodeIntoChunk.js';
|
|
5
|
-
export const chunkManagerModule = {
|
|
6
|
-
name: "chunkManager",
|
|
7
|
-
description: "Splits large files into manageable chunks for processing.",
|
|
8
|
-
async run(input) {
|
|
9
|
-
const filepath = normalizePath(input.filepath ?? "");
|
|
10
|
-
const fileContent = fs.readFileSync(filepath, "utf-8");
|
|
11
|
-
const maxTokens = 1500;
|
|
12
|
-
const baseChunks = splitCodeIntoChunks(fileContent, maxTokens);
|
|
13
|
-
return {
|
|
14
|
-
content: fileContent,
|
|
15
|
-
data: {
|
|
16
|
-
baseChunks,
|
|
17
|
-
workingChunks: [...baseChunks],
|
|
18
|
-
chunkCount: baseChunks.length,
|
|
19
|
-
filepath,
|
|
20
|
-
},
|
|
21
|
-
filepath,
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { normalizeText, stripMarkdownFences, isCodeLike } from "../../utils/contentUtils.js";
|
|
2
|
-
export const cleanGeneratedTestsModule = {
|
|
3
|
-
name: "cleanGeneratedTestsModule",
|
|
4
|
-
description: "Removes markdown fences, prose, and explanations from generated test output, leaving only code",
|
|
5
|
-
async run(input) {
|
|
6
|
-
const { content, filepath } = input;
|
|
7
|
-
// normalize + strip markdown
|
|
8
|
-
const normalized = normalizeText(content);
|
|
9
|
-
const stripped = stripMarkdownFences(normalized);
|
|
10
|
-
// filter non-code lines, but keep blank ones
|
|
11
|
-
const lines = stripped.split("\n");
|
|
12
|
-
const codeLines = lines.filter(line => line.trim() === "" || isCodeLike(line));
|
|
13
|
-
// remove duplicate imports (normalize spacing/semicolon)
|
|
14
|
-
const seenImports = new Set();
|
|
15
|
-
const dedupedLines = codeLines.filter(line => {
|
|
16
|
-
if (line.trim().startsWith("import")) {
|
|
17
|
-
const key = line.trim().replace(/;$/, "");
|
|
18
|
-
if (seenImports.has(key)) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
seenImports.add(key);
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
});
|
|
25
|
-
const cleanedCode = dedupedLines.join("\n").trimEnd();
|
|
26
|
-
return {
|
|
27
|
-
originalContent: content,
|
|
28
|
-
content: cleanedCode,
|
|
29
|
-
filepath,
|
|
30
|
-
mode: "overwrite",
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs/promises";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { logInputOutput } from "../../utils/promptLogHelper.js";
|
|
4
|
-
import { getDbForRepo } from "../../db/client.js";
|
|
5
|
-
import { updateFileWithSummary, upsertFileFtsTemplate, } from "../../db/sqlTemplates.js";
|
|
6
|
-
export const fileReaderModule = {
|
|
7
|
-
name: "fileReader",
|
|
8
|
-
description: "Reads files from disk only if they are not available in the DB, updates DB and FTS.",
|
|
9
|
-
groups: ["analysis"],
|
|
10
|
-
run: async (input) => {
|
|
11
|
-
let filePaths = [];
|
|
12
|
-
logInputOutput('filereader', 'input', input.content);
|
|
13
|
-
if (Array.isArray(input.content)) {
|
|
14
|
-
filePaths = input.content;
|
|
15
|
-
}
|
|
16
|
-
else if (typeof input.content === "object" && input.content !== null) {
|
|
17
|
-
const obj = input.content;
|
|
18
|
-
if (Array.isArray(obj.filePaths))
|
|
19
|
-
filePaths = obj.filePaths;
|
|
20
|
-
}
|
|
21
|
-
if (filePaths.length === 0) {
|
|
22
|
-
const emptyOutput = {
|
|
23
|
-
query: input.query,
|
|
24
|
-
data: { files: [] },
|
|
25
|
-
};
|
|
26
|
-
logInputOutput("fileReader", "output", emptyOutput.data);
|
|
27
|
-
return emptyOutput;
|
|
28
|
-
}
|
|
29
|
-
const db = getDbForRepo();
|
|
30
|
-
const files = [];
|
|
31
|
-
for (const filePath of filePaths) {
|
|
32
|
-
const fullPath = path.resolve(filePath);
|
|
33
|
-
// 1️⃣ Check DB for existing summary/content
|
|
34
|
-
const row = db
|
|
35
|
-
.prepare("SELECT path, content_text, summary FROM files WHERE path = ?")
|
|
36
|
-
.get(fullPath);
|
|
37
|
-
if (row?.content_text) {
|
|
38
|
-
files.push({ filePath: fullPath, content: row.content_text });
|
|
39
|
-
continue; // already in DB, no need to read disk
|
|
40
|
-
}
|
|
41
|
-
// 2️⃣ Read file from disk
|
|
42
|
-
let content = "";
|
|
43
|
-
try {
|
|
44
|
-
content = await fs.readFile(fullPath, "utf-8");
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
content = `ERROR: ${err.message}`;
|
|
48
|
-
}
|
|
49
|
-
files.push({ filePath: fullPath, content });
|
|
50
|
-
// 3️⃣ Update DB and FTS if content successfully read
|
|
51
|
-
if (!content.startsWith("ERROR")) {
|
|
52
|
-
db.prepare(updateFileWithSummary).run({
|
|
53
|
-
path: fullPath,
|
|
54
|
-
summary: null, // optionally leave null; summary can be generated later
|
|
55
|
-
contentText: content,
|
|
56
|
-
});
|
|
57
|
-
db.prepare(upsertFileFtsTemplate).run({
|
|
58
|
-
path: fullPath,
|
|
59
|
-
filename: path.basename(fullPath),
|
|
60
|
-
summary: null,
|
|
61
|
-
contentText: content,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const output = {
|
|
66
|
-
query: input.query,
|
|
67
|
-
data: { files },
|
|
68
|
-
};
|
|
69
|
-
logInputOutput("fileReader", "output", output.data);
|
|
70
|
-
return output;
|
|
71
|
-
},
|
|
72
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
// src/pipeline/modules/gatherInfoModule.ts
|
|
2
|
-
import { getDbForRepo } from "../../db/client.js";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import { compileSearchQuery } from "../../utils/compileSearchQuery.js";
|
|
5
|
-
import { logInputOutput } from "../../utils/promptLogHelper.js"; // ✅ import logger
|
|
6
|
-
/** Escape % and _ for LIKE queries */
|
|
7
|
-
function sanitizeForLike(input) {
|
|
8
|
-
return input.replace(/[%_]/g, "\\$&");
|
|
9
|
-
}
|
|
10
|
-
/** ✅ Strip embeddings before logging */
|
|
11
|
-
function stripEmbeddings(output) {
|
|
12
|
-
if (output?.data?.files) {
|
|
13
|
-
output.data.files = output.data.files.map((f) => {
|
|
14
|
-
const { embedding, ...rest } = f;
|
|
15
|
-
return rest;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return output;
|
|
19
|
-
}
|
|
20
|
-
export const gatherInfoModule = {
|
|
21
|
-
name: "gatherInfo",
|
|
22
|
-
description: "Collects relevant code summaries, functions, classes, and related graph info for the current query.",
|
|
23
|
-
run: async function (input) {
|
|
24
|
-
const db = getDbForRepo();
|
|
25
|
-
const query = input.metadata?.query?.trim() ?? "";
|
|
26
|
-
const maxFiles = input.metadata?.maxFiles ?? 10;
|
|
27
|
-
if (!query) {
|
|
28
|
-
const emptyOutput = {
|
|
29
|
-
content: "⚠️ No query provided to gatherInfoModule.",
|
|
30
|
-
data: { files: [], functions: [], classes: [], summaries: [], tags: [] },
|
|
31
|
-
};
|
|
32
|
-
logInputOutput("gatherInfo", "output", stripEmbeddings(emptyOutput)); // ✅
|
|
33
|
-
return emptyOutput;
|
|
34
|
-
}
|
|
35
|
-
const compiled = compileSearchQuery({ query, mode: "fts" });
|
|
36
|
-
const sanitizedFts = compiled.fts.expression;
|
|
37
|
-
const likeQuery = `%${sanitizeForLike(query)}%`;
|
|
38
|
-
// 🩹 Handle legacy DBs that might not have `functions_extracted`
|
|
39
|
-
let files = [];
|
|
40
|
-
try {
|
|
41
|
-
if (sanitizedFts) {
|
|
42
|
-
files = db
|
|
43
|
-
.prepare(`
|
|
44
|
-
SELECT f.id, f.path, f.type, f.summary, f.embedding,
|
|
45
|
-
f.last_modified, f.indexed_at,
|
|
46
|
-
COALESCE(f.functions_extracted, 0) AS functions_extracted,
|
|
47
|
-
f.functions_extracted_at, f.processing_status
|
|
48
|
-
FROM files f
|
|
49
|
-
JOIN files_fts fts ON fts.rowid = f.id
|
|
50
|
-
WHERE files_fts MATCH '${sanitizedFts}'
|
|
51
|
-
ORDER BY f.path ASC
|
|
52
|
-
LIMIT ?;
|
|
53
|
-
`)
|
|
54
|
-
.all(maxFiles);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.warn(chalk.yellow("⚠️ 'functions_extracted' column missing in files table, running fallback query..."));
|
|
59
|
-
if (sanitizedFts) {
|
|
60
|
-
files = db
|
|
61
|
-
.prepare(`
|
|
62
|
-
SELECT f.id, f.path, f.type, f.summary, f.embedding,
|
|
63
|
-
f.last_modified, f.indexed_at, f.processing_status
|
|
64
|
-
FROM files f
|
|
65
|
-
JOIN files_fts fts ON fts.rowid = f.id
|
|
66
|
-
WHERE files_fts MATCH '${sanitizedFts}'
|
|
67
|
-
ORDER BY f.path ASC
|
|
68
|
-
LIMIT ?;
|
|
69
|
-
`)
|
|
70
|
-
.all(maxFiles);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const functions = db
|
|
74
|
-
.prepare(`
|
|
75
|
-
SELECT fn.id, fn.name, fn.start_line, fn.end_line,
|
|
76
|
-
substr(fn.content, 1, 400) AS content,
|
|
77
|
-
f.path AS file_path
|
|
78
|
-
FROM functions fn
|
|
79
|
-
JOIN files f ON f.id = fn.file_id
|
|
80
|
-
WHERE fn.name LIKE ? ESCAPE '\\'
|
|
81
|
-
OR fn.content LIKE ? ESCAPE '\\'
|
|
82
|
-
ORDER BY f.path ASC
|
|
83
|
-
LIMIT ?;
|
|
84
|
-
`)
|
|
85
|
-
.all(likeQuery, likeQuery, maxFiles);
|
|
86
|
-
const classes = db
|
|
87
|
-
.prepare(`
|
|
88
|
-
SELECT c.name, f.path AS file_path, substr(c.content, 1, 400) AS snippet
|
|
89
|
-
FROM graph_classes c
|
|
90
|
-
JOIN files f ON f.id = c.file_id
|
|
91
|
-
WHERE c.name LIKE ? ESCAPE '\\'
|
|
92
|
-
OR c.content LIKE ? ESCAPE '\\'
|
|
93
|
-
ORDER BY f.path ASC
|
|
94
|
-
LIMIT ?;
|
|
95
|
-
`)
|
|
96
|
-
.all(likeQuery, likeQuery, maxFiles);
|
|
97
|
-
const tagRows = db
|
|
98
|
-
.prepare(`
|
|
99
|
-
SELECT DISTINCT gtm.name
|
|
100
|
-
FROM graph_tags_master gtm
|
|
101
|
-
WHERE gtm.name LIKE ? ESCAPE '\\'
|
|
102
|
-
ORDER BY gtm.name ASC;
|
|
103
|
-
`)
|
|
104
|
-
.all(likeQuery);
|
|
105
|
-
const tags = tagRows.map((t) => t.name);
|
|
106
|
-
const summaries = db
|
|
107
|
-
.prepare(`
|
|
108
|
-
SELECT path, type, summary
|
|
109
|
-
FROM summaries
|
|
110
|
-
WHERE summary LIKE ? ESCAPE '\\'
|
|
111
|
-
ORDER BY CASE WHEN type='project' THEN 0 ELSE 1 END, path ASC
|
|
112
|
-
LIMIT 5;
|
|
113
|
-
`)
|
|
114
|
-
.all(likeQuery);
|
|
115
|
-
// --- Gather common project config files
|
|
116
|
-
let configFiles = [];
|
|
117
|
-
try {
|
|
118
|
-
configFiles = db
|
|
119
|
-
.prepare(`
|
|
120
|
-
SELECT f.id, f.path, f.type, f.summary, f.embedding,
|
|
121
|
-
f.last_modified, f.indexed_at,
|
|
122
|
-
COALESCE(f.functions_extracted, 0) AS functions_extracted,
|
|
123
|
-
f.functions_extracted_at, f.processing_status
|
|
124
|
-
FROM files f
|
|
125
|
-
WHERE path LIKE '%package.json%'
|
|
126
|
-
OR path LIKE '%tsconfig.json%'
|
|
127
|
-
OR path LIKE '%.eslintrc%'
|
|
128
|
-
OR path LIKE '%.env%'
|
|
129
|
-
OR path LIKE '%README.md%'
|
|
130
|
-
ORDER BY path ASC;
|
|
131
|
-
`)
|
|
132
|
-
.all();
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
configFiles = db
|
|
136
|
-
.prepare(`
|
|
137
|
-
SELECT f.id, f.path, f.type, f.summary, f.embedding,
|
|
138
|
-
f.last_modified, f.indexed_at, f.processing_status
|
|
139
|
-
FROM files f
|
|
140
|
-
WHERE path LIKE '%package.json%'
|
|
141
|
-
OR path LIKE '%tsconfig.json%'
|
|
142
|
-
OR path LIKE '%.eslintrc%'
|
|
143
|
-
OR path LIKE '%.env%'
|
|
144
|
-
OR path LIKE '%README.md%'
|
|
145
|
-
ORDER BY path ASC;
|
|
146
|
-
`)
|
|
147
|
-
.all();
|
|
148
|
-
}
|
|
149
|
-
// Merge & deduplicate
|
|
150
|
-
const uniqueFiles = [
|
|
151
|
-
...files,
|
|
152
|
-
...configFiles.filter((c) => !files.find((f) => f.path === c.path)),
|
|
153
|
-
];
|
|
154
|
-
if (!uniqueFiles.length &&
|
|
155
|
-
!functions.length &&
|
|
156
|
-
!classes.length &&
|
|
157
|
-
!summaries.length &&
|
|
158
|
-
!tags.length) {
|
|
159
|
-
const emptyOutput = {
|
|
160
|
-
content: `⚠️ No relevant information found for query: "${query}"`,
|
|
161
|
-
data: { files: [], functions: [], classes: [], summaries: [], tags: [] },
|
|
162
|
-
};
|
|
163
|
-
logInputOutput("gatherInfo", "output", stripEmbeddings(emptyOutput)); // ✅
|
|
164
|
-
return emptyOutput;
|
|
165
|
-
}
|
|
166
|
-
const output = {
|
|
167
|
-
content: `Gathered ${uniqueFiles.length} files, ${functions.length} functions, ${classes.length} classes, and ${summaries.length} summaries.`,
|
|
168
|
-
data: {
|
|
169
|
-
query, // ✅ ensure query passes forward
|
|
170
|
-
files: uniqueFiles,
|
|
171
|
-
functions,
|
|
172
|
-
classes,
|
|
173
|
-
summaries,
|
|
174
|
-
tags,
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
// ✅ Log sanitized module output (no embeddings)
|
|
178
|
-
logInputOutput("gatherInfo", "output", stripEmbeddings(output));
|
|
179
|
-
return output;
|
|
180
|
-
},
|
|
181
|
-
};
|