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
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Covers modular-agent search routing and candidate shaping behavior.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists:
|
|
5
|
+
* - search mode routing should stay local to `agent/search/*`
|
|
6
|
+
* - lane-specific retention should be proven without exercising the full runtime loop
|
|
7
|
+
*/
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import os from "os";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
12
|
+
import { createAgentMemory } from "../../agents/agentMemory.js";
|
|
13
|
+
import { finalizeLanePacket } from "../../agent/search/candidateRetentionPolicy.js";
|
|
14
|
+
import { runSearchAuto, runSearchDb } from "../../agent/search/index.js";
|
|
15
|
+
import { classifySearchLane } from "../../agent/search/laneClassifier.js";
|
|
16
|
+
import { chooseSearchRoute } from "../../agent/search/routePolicy.js";
|
|
17
|
+
import { buildSearchContext } from "../../agent/search/searchContext.js";
|
|
18
|
+
import { tokenizeSearchTerms } from "../../agent/search/shared.js";
|
|
19
|
+
const tempDirs = [];
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
while (tempDirs.length > 0) {
|
|
22
|
+
const dir = tempDirs.pop();
|
|
23
|
+
if (dir)
|
|
24
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
describe("runSearchAuto", () => {
|
|
28
|
+
it("routes directory-listing questions to the directory lane", async () => {
|
|
29
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-routing-"));
|
|
30
|
+
tempDirs.push(repoRoot);
|
|
31
|
+
fs.mkdirSync(path.join(repoRoot, "cli", "src"), { recursive: true });
|
|
32
|
+
fs.writeFileSync(path.join(repoRoot, "cli", "src", "index.ts"), "export const ok = true;\n", "utf8");
|
|
33
|
+
fs.writeFileSync(path.join(repoRoot, "README.md"), "# Repo\n", "utf8");
|
|
34
|
+
const memory = createAgentMemory("list files in cli/src", repoRoot, repoRoot);
|
|
35
|
+
memory.task.queryScope = "targeted";
|
|
36
|
+
memory.task.softHints = ["cli/src"];
|
|
37
|
+
const packet = await runSearchAuto(memory, "list files in cli/src");
|
|
38
|
+
expect(packet.lane).toBe("directory");
|
|
39
|
+
expect(packet.summary).toContain("Contents of");
|
|
40
|
+
expect(packet.directoryEntries?.some((entry) => entry.name === "index.ts")).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it("routes quoted snippet questions to the fragment lane", async () => {
|
|
43
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-fragment-"));
|
|
44
|
+
tempDirs.push(repoRoot);
|
|
45
|
+
const targetFile = path.join(repoRoot, "cli", "src", "sample.ts");
|
|
46
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
47
|
+
fs.writeFileSync(targetFile, "const currentQuestionId = task.currentQuestionId;\n", "utf8");
|
|
48
|
+
const memory = createAgentMemory("Find \"currentQuestionId = task.currentQuestionId\"", repoRoot, repoRoot);
|
|
49
|
+
memory.task.queryScope = "targeted";
|
|
50
|
+
memory.task.explicitTargets = ["currentQuestionId"];
|
|
51
|
+
const packet = await runSearchAuto(memory, "Find \"currentQuestionId = task.currentQuestionId\"");
|
|
52
|
+
expect(packet.lane).toBe("fragment");
|
|
53
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
54
|
+
expect(packet.matches).toEqual(expect.arrayContaining([
|
|
55
|
+
expect.objectContaining({
|
|
56
|
+
filePath: targetFile,
|
|
57
|
+
line: 1,
|
|
58
|
+
matchKind: "fragment-content",
|
|
59
|
+
}),
|
|
60
|
+
]));
|
|
61
|
+
});
|
|
62
|
+
it("keeps fragment search wide enough to retain concrete test files over docs", async () => {
|
|
63
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-fragment-width-"));
|
|
64
|
+
tempDirs.push(repoRoot);
|
|
65
|
+
const targetFile = path.join(repoRoot, "cli", "src", "__tests__", "search", "SearchOrchestrator.test.ts");
|
|
66
|
+
const evalFile = path.join(repoRoot, "cli", "src", "commands", "evalCommands.ts");
|
|
67
|
+
const registryFile = path.join(repoRoot, "cli", "src", "testing", "testRegistry.ts");
|
|
68
|
+
const docFile = path.join(repoRoot, "optimize.md");
|
|
69
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
70
|
+
fs.mkdirSync(path.dirname(evalFile), { recursive: true });
|
|
71
|
+
fs.mkdirSync(path.dirname(registryFile), { recursive: true });
|
|
72
|
+
const fragment = "returns raw operator-pattern matches without semantic guessing";
|
|
73
|
+
fs.writeFileSync(targetFile, `it("${fragment}", () => {});\n`, "utf8");
|
|
74
|
+
fs.writeFileSync(evalFile, `query: "\\"${fragment}\\"",\n`, "utf8");
|
|
75
|
+
fs.writeFileSync(registryFile, `testName: "${fragment}",\n`, "utf8");
|
|
76
|
+
fs.writeFileSync(docFile, `${fragment}\n`, "utf8");
|
|
77
|
+
const memory = createAgentMemory(`"${fragment}"`, repoRoot, repoRoot);
|
|
78
|
+
memory.task.queryScope = "targeted";
|
|
79
|
+
const packet = await runSearchAuto(memory, `"${fragment}"`);
|
|
80
|
+
expect(packet.lane).toBe("fragment");
|
|
81
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
82
|
+
expect(packet.topHits?.[0]?.filePath).toBe(targetFile);
|
|
83
|
+
expect(packet.topHits?.some((hit) => hit.filePath === docFile)).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
it("prefers direct test ownership over meta snippet fixtures in fragment ranking", async () => {
|
|
86
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-fragment-meta-"));
|
|
87
|
+
tempDirs.push(repoRoot);
|
|
88
|
+
const directOwner = path.join(repoRoot, "cli", "src", "__tests__", "search", "SearchOrchestrator.test.ts");
|
|
89
|
+
const metaFixture = path.join(repoRoot, "cli", "src", "__tests__", "agents", "agentSearchRouting.test.ts");
|
|
90
|
+
fs.mkdirSync(path.dirname(directOwner), { recursive: true });
|
|
91
|
+
fs.mkdirSync(path.dirname(metaFixture), { recursive: true });
|
|
92
|
+
const fragment = "returns raw operator-pattern matches without semantic guessing";
|
|
93
|
+
fs.writeFileSync(directOwner, `it("${fragment}", () => {});\n`, "utf8");
|
|
94
|
+
fs.writeFileSync(metaFixture, `const fragment = "${fragment}";\nquery: "\\"${fragment}\\"",\n`, "utf8");
|
|
95
|
+
const memory = createAgentMemory(`"${fragment}"`, repoRoot, repoRoot);
|
|
96
|
+
memory.task.queryScope = "targeted";
|
|
97
|
+
const packet = await runSearchAuto(memory, `"${fragment}"`);
|
|
98
|
+
expect(packet.lane).toBe("fragment");
|
|
99
|
+
expect(packet.topHits?.[0]?.filePath).toBe(directOwner);
|
|
100
|
+
});
|
|
101
|
+
it("excludes dist outputs, source maps, and harness mirrors from fragment search", async () => {
|
|
102
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-fragment-artifacts-"));
|
|
103
|
+
tempDirs.push(repoRoot);
|
|
104
|
+
const sourceFile = path.join(repoRoot, "cli", "src", "__tests__", "search", "SearchOrchestrator.test.ts");
|
|
105
|
+
const distFile = path.join(repoRoot, "cli", "dist", "__tests__", "search", "SearchOrchestrator.test.js");
|
|
106
|
+
const mapFile = `${distFile}.map`;
|
|
107
|
+
fs.mkdirSync(path.dirname(sourceFile), { recursive: true });
|
|
108
|
+
fs.mkdirSync(path.dirname(distFile), { recursive: true });
|
|
109
|
+
const fragment = "returns raw operator-pattern matches without semantic guessing";
|
|
110
|
+
fs.writeFileSync(sourceFile, `it("${fragment}", () => {});\n`, "utf8");
|
|
111
|
+
fs.writeFileSync(distFile, `it("${fragment}", () => {});\n`, "utf8");
|
|
112
|
+
fs.writeFileSync(mapFile, JSON.stringify({ version: 3, file: "SearchOrchestrator.test.js" }), "utf8");
|
|
113
|
+
const memory = createAgentMemory(`"${fragment}"`, repoRoot, repoRoot);
|
|
114
|
+
memory.task.queryScope = "targeted";
|
|
115
|
+
const packet = await runSearchAuto(memory, `"${fragment}"`);
|
|
116
|
+
expect(packet.lane).toBe("fragment");
|
|
117
|
+
expect(packet.filePaths).toContain(sourceFile);
|
|
118
|
+
expect(packet.filePaths).not.toContain(distFile);
|
|
119
|
+
expect(packet.filePaths).not.toContain(mapFile);
|
|
120
|
+
});
|
|
121
|
+
it("keeps explicit file targets on exact-target even when the query also includes a quoted snippet", async () => {
|
|
122
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-explicit-fragment-"));
|
|
123
|
+
tempDirs.push(repoRoot);
|
|
124
|
+
const targetFile = path.join(repoRoot, "cli", "src", "sample.ts");
|
|
125
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
126
|
+
fs.writeFileSync(targetFile, "const currentQuestionId = task.currentQuestionId;\n", "utf8");
|
|
127
|
+
const memory = createAgentMemory(`Explain sample.ts "currentQuestionId = task.currentQuestionId"`, repoRoot, repoRoot);
|
|
128
|
+
memory.task.queryScope = "targeted";
|
|
129
|
+
memory.task.explicitTargets = ["sample.ts"];
|
|
130
|
+
const packet = await runSearchAuto(memory, `Explain sample.ts "currentQuestionId = task.currentQuestionId"`);
|
|
131
|
+
expect(packet.lane).toBe("exact-target");
|
|
132
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
133
|
+
});
|
|
134
|
+
it("routes operator-pattern questions to the regex lane", async () => {
|
|
135
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-regex-"));
|
|
136
|
+
tempDirs.push(repoRoot);
|
|
137
|
+
const targetFile = path.join(repoRoot, "cli", "src", "search.ts");
|
|
138
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
139
|
+
fs.writeFileSync(targetFile, "function runSearch() {}\nfunction semanticSearchFiles() {}\n", "utf8");
|
|
140
|
+
const memory = createAgentMemory("runSearch|semanticSearchFiles", repoRoot, repoRoot);
|
|
141
|
+
memory.task.queryScope = "general";
|
|
142
|
+
const packet = await runSearchAuto(memory, "runSearch|semanticSearchFiles");
|
|
143
|
+
expect(packet.lane).toBe("regex");
|
|
144
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
145
|
+
expect(packet.matches).toEqual(expect.arrayContaining([
|
|
146
|
+
expect.objectContaining({
|
|
147
|
+
filePath: targetFile,
|
|
148
|
+
line: 2,
|
|
149
|
+
matchKind: "regex-content",
|
|
150
|
+
}),
|
|
151
|
+
]));
|
|
152
|
+
});
|
|
153
|
+
it("excludes dist outputs and source maps from regex search", async () => {
|
|
154
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-regex-artifacts-"));
|
|
155
|
+
tempDirs.push(repoRoot);
|
|
156
|
+
const sourceFile = path.join(repoRoot, "cli", "src", "search.ts");
|
|
157
|
+
const distFile = path.join(repoRoot, "cli", "dist", "search.js");
|
|
158
|
+
const mapFile = `${distFile}.map`;
|
|
159
|
+
fs.mkdirSync(path.dirname(sourceFile), { recursive: true });
|
|
160
|
+
fs.mkdirSync(path.dirname(distFile), { recursive: true });
|
|
161
|
+
fs.writeFileSync(sourceFile, "function runSearch() {}\nfunction semanticSearchFiles() {}\n", "utf8");
|
|
162
|
+
fs.writeFileSync(distFile, "function runSearch() {}\nfunction semanticSearchFiles() {}\n", "utf8");
|
|
163
|
+
fs.writeFileSync(mapFile, JSON.stringify({ version: 3, file: "search.js" }), "utf8");
|
|
164
|
+
const memory = createAgentMemory("runSearch|semanticSearchFiles", repoRoot, repoRoot);
|
|
165
|
+
memory.task.queryScope = "general";
|
|
166
|
+
const packet = await runSearchAuto(memory, "runSearch|semanticSearchFiles");
|
|
167
|
+
expect(packet.lane).toBe("regex");
|
|
168
|
+
expect(packet.filePaths).toContain(sourceFile);
|
|
169
|
+
expect(packet.filePaths).not.toContain(distFile);
|
|
170
|
+
expect(packet.filePaths).not.toContain(mapFile);
|
|
171
|
+
});
|
|
172
|
+
it("routes broad natural-language owner questions to the shell-content lane", async () => {
|
|
173
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-shell-"));
|
|
174
|
+
tempDirs.push(repoRoot);
|
|
175
|
+
const targetFile = path.join(repoRoot, "cli", "src", "agent", "state", "memory.ts");
|
|
176
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
177
|
+
fs.writeFileSync(targetFile, "export const config = { maxTurns: 12, turnCount: 0 };\n", "utf8");
|
|
178
|
+
const memory = createAgentMemory("where do I set the max count for how many loops the agent can run?", repoRoot, repoRoot);
|
|
179
|
+
memory.task.queryScope = "general";
|
|
180
|
+
const packet = await runSearchDb(memory, "where do I set the max count for how many loops the agent can run?");
|
|
181
|
+
expect(packet.lane).toBe("shell-content");
|
|
182
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
183
|
+
expect(packet.matches).toEqual(expect.arrayContaining([
|
|
184
|
+
expect.objectContaining({
|
|
185
|
+
filePath: targetFile,
|
|
186
|
+
matchKind: "shell-content",
|
|
187
|
+
}),
|
|
188
|
+
]));
|
|
189
|
+
});
|
|
190
|
+
it("keeps semantic search matches on weak-signal questions", async () => {
|
|
191
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-semantic-matches-"));
|
|
192
|
+
tempDirs.push(repoRoot);
|
|
193
|
+
const targetFile = path.join(repoRoot, "cli", "src", "agent", "state", "memory.ts");
|
|
194
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
195
|
+
fs.writeFileSync(targetFile, "export const config = { maxTurns: 12, turnCount: 0 };\n", "utf8");
|
|
196
|
+
const memory = createAgentMemory("agent loop limit configuration max count", repoRoot, repoRoot);
|
|
197
|
+
memory.task.queryScope = "general";
|
|
198
|
+
const packet = await runSearchAuto(memory, "agent loop limit configuration max count");
|
|
199
|
+
expect(packet.lane).toBe("semantic");
|
|
200
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
201
|
+
expect(packet.matches).toEqual(expect.arrayContaining([
|
|
202
|
+
expect.objectContaining({
|
|
203
|
+
filePath: targetFile,
|
|
204
|
+
line: 1,
|
|
205
|
+
matchKind: "semantic-content",
|
|
206
|
+
}),
|
|
207
|
+
]));
|
|
208
|
+
});
|
|
209
|
+
it("uses search term groups to continue semantic search when the base query is weak", async () => {
|
|
210
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-term-groups-"));
|
|
211
|
+
tempDirs.push(repoRoot);
|
|
212
|
+
const targetFile = path.join(repoRoot, "cli", "src", "testing", "registerDevCliCommands.ts");
|
|
213
|
+
const distractorFile = path.join(repoRoot, "cli", "src", "agent", "actions", "index.ts");
|
|
214
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
215
|
+
fs.mkdirSync(path.dirname(distractorFile), { recursive: true });
|
|
216
|
+
fs.writeFileSync(targetFile, [
|
|
217
|
+
"/**",
|
|
218
|
+
" * Registers dev CLI commands.",
|
|
219
|
+
" */",
|
|
220
|
+
"export function registerDevCliCommands() {}",
|
|
221
|
+
"export const testCommands = registerDevCliCommands;",
|
|
222
|
+
].join("\n"), "utf8");
|
|
223
|
+
fs.writeFileSync(distractorFile, [
|
|
224
|
+
"/**",
|
|
225
|
+
" * Generic action registry.",
|
|
226
|
+
" */",
|
|
227
|
+
"export function buildActionMenu() {}",
|
|
228
|
+
].join("\n"), "utf8");
|
|
229
|
+
const query = "Explain how test execution is wired";
|
|
230
|
+
const memory = createAgentMemory(query, repoRoot, repoRoot);
|
|
231
|
+
memory.task.queryScope = "general";
|
|
232
|
+
memory.task.searchTermGroups = [
|
|
233
|
+
{ kind: "generic", terms: ["repo", "test"] },
|
|
234
|
+
{ kind: "repo-anchor", terms: ["registerDevCliCommands", "testCommands", "register"] },
|
|
235
|
+
];
|
|
236
|
+
const packet = await runSearchDb(memory, query);
|
|
237
|
+
expect(packet.lane).toBe("semantic");
|
|
238
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
239
|
+
expect(packet.debug?.batchDebug).toEqual([
|
|
240
|
+
expect.objectContaining({
|
|
241
|
+
query,
|
|
242
|
+
continued: true,
|
|
243
|
+
strongReason: "evidence is still driven by weak semantic terms",
|
|
244
|
+
}),
|
|
245
|
+
expect.objectContaining({
|
|
246
|
+
query: "registerDevCliCommands testCommands register",
|
|
247
|
+
kind: "repo-anchor",
|
|
248
|
+
continued: false,
|
|
249
|
+
strongEnough: true,
|
|
250
|
+
}),
|
|
251
|
+
]);
|
|
252
|
+
});
|
|
253
|
+
it("filters shared stop words before shell-content ranking on repo test-entry queries", async () => {
|
|
254
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-shell-stopwords-"));
|
|
255
|
+
tempDirs.push(repoRoot);
|
|
256
|
+
const registerFile = path.join(repoRoot, "cli", "src", "testing", "registerDevCliCommands.ts");
|
|
257
|
+
const testCommandsFile = path.join(repoRoot, "cli", "src", "testing", "testCommands.ts");
|
|
258
|
+
const distractorFile = path.join(repoRoot, "cli", "src", "agent", "actions", "index.ts");
|
|
259
|
+
fs.mkdirSync(path.dirname(registerFile), { recursive: true });
|
|
260
|
+
fs.mkdirSync(path.dirname(distractorFile), { recursive: true });
|
|
261
|
+
fs.writeFileSync(registerFile, [
|
|
262
|
+
"/**",
|
|
263
|
+
" * Registers dev CLI commands for testing and eval work.",
|
|
264
|
+
" */",
|
|
265
|
+
"export function registerDevCliCommands() {}",
|
|
266
|
+
].join("\n"), "utf8");
|
|
267
|
+
fs.writeFileSync(testCommandsFile, [
|
|
268
|
+
"/**",
|
|
269
|
+
" * Defines test entry points and test command wiring.",
|
|
270
|
+
" */",
|
|
271
|
+
"export function registerTestingCommands() {}",
|
|
272
|
+
].join("\n"), "utf8");
|
|
273
|
+
fs.writeFileSync(distractorFile, [
|
|
274
|
+
"/**",
|
|
275
|
+
" * Why this file exists:",
|
|
276
|
+
" */",
|
|
277
|
+
"export function buildActionMenu() {}",
|
|
278
|
+
].join("\n"), "utf8");
|
|
279
|
+
const query = "How does this repo run tests and where are the test entry points configured?";
|
|
280
|
+
const memory = createAgentMemory(query, repoRoot, repoRoot);
|
|
281
|
+
memory.task.queryScope = "general";
|
|
282
|
+
expect(tokenizeSearchTerms(query)).toEqual(expect.arrayContaining(["repo", "tests", "test", "entry", "points", "configured"]));
|
|
283
|
+
expect(tokenizeSearchTerms(query)).not.toEqual(expect.arrayContaining(["this", "how", "does", "run"]));
|
|
284
|
+
const packet = await runSearchDb(memory, query);
|
|
285
|
+
expect(packet.lane).toBe("shell-content");
|
|
286
|
+
expect(packet.filePaths).toEqual(expect.arrayContaining([registerFile, testCommandsFile]));
|
|
287
|
+
expect(packet.topHits?.slice(0, 2).map((hit) => hit.filePath)).toEqual(expect.arrayContaining([registerFile, testCommandsFile]));
|
|
288
|
+
expect(packet.topHits?.[0]?.filePath).not.toBe(distractorFile);
|
|
289
|
+
expect(packet.matches?.some((match) => (match.reasons ?? []).includes("term:this"))).toBe(false);
|
|
290
|
+
});
|
|
291
|
+
it("falls back to semantic when shell-content only finds generic weak matches", async () => {
|
|
292
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-shell-fallback-"));
|
|
293
|
+
tempDirs.push(repoRoot);
|
|
294
|
+
const targetFile = path.join(repoRoot, "cli", "src", "agent", "runtime", "config.ts");
|
|
295
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
296
|
+
fs.writeFileSync(targetFile, [
|
|
297
|
+
"/**",
|
|
298
|
+
" * Generic runtime config holder.",
|
|
299
|
+
" */",
|
|
300
|
+
"export const runtimeConfig = { agent: true, config: true };",
|
|
301
|
+
].join("\n"), "utf8");
|
|
302
|
+
const query = "where is the agent config in this repo?";
|
|
303
|
+
const memory = createAgentMemory(query, repoRoot, repoRoot);
|
|
304
|
+
memory.task.queryScope = "general";
|
|
305
|
+
const packet = await runSearchDb(memory, query);
|
|
306
|
+
expect(packet.lane).toBe("semantic");
|
|
307
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
308
|
+
});
|
|
309
|
+
it("reranks a wider semantic frontier before returning the visible shortlist", () => {
|
|
310
|
+
const memory = createAgentMemory("where do I set the max count for how many loops the agent can run?", "/repo", "/repo");
|
|
311
|
+
memory.task.queryScope = "general";
|
|
312
|
+
const genericFiles = Array.from({ length: 11 }, (_, index) => `/repo/cli/src/agents/generic-${index}.ts`);
|
|
313
|
+
const memoryFile = "/repo/cli/src/agent/state/memory.ts";
|
|
314
|
+
const packet = finalizeLanePacket("semantic", memory, {
|
|
315
|
+
lane: "semantic",
|
|
316
|
+
query: "where do I set the max count for how many loops the agent can run?",
|
|
317
|
+
filePaths: [...genericFiles, memoryFile],
|
|
318
|
+
matches: [
|
|
319
|
+
{
|
|
320
|
+
filePath: genericFiles[0],
|
|
321
|
+
line: 1,
|
|
322
|
+
snippet: "export class MainAgent {}",
|
|
323
|
+
matchKind: "semantic-content",
|
|
324
|
+
reasons: ["term:agent"],
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
filePath: memoryFile,
|
|
328
|
+
line: 40,
|
|
329
|
+
snippet: " maxTurns: 12,",
|
|
330
|
+
matchKind: "semantic-content",
|
|
331
|
+
reasons: ["term:maxTurns", "term:turnCount"],
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
}, 8);
|
|
335
|
+
expect(packet.filePaths).toHaveLength(8);
|
|
336
|
+
expect(packet.filePaths[0]).toBe(memoryFile);
|
|
337
|
+
expect(packet.filePaths).toContain(memoryFile);
|
|
338
|
+
expect(packet.topHits?.[0]).toEqual(expect.objectContaining({
|
|
339
|
+
filePath: memoryFile,
|
|
340
|
+
}));
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
describe("chooseSearchRoute", () => {
|
|
344
|
+
it("routes resolved folder targets to the directory lane when listing wording is present", () => {
|
|
345
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-route-folder-"));
|
|
346
|
+
tempDirs.push(repoRoot);
|
|
347
|
+
const guardsDir = path.join(repoRoot, "cli", "src", "agents", "guards");
|
|
348
|
+
fs.mkdirSync(guardsDir, { recursive: true });
|
|
349
|
+
fs.writeFileSync(path.join(guardsDir, "executionPolicyResolver.ts"), "export const ok = true;\n", "utf8");
|
|
350
|
+
const memory = createAgentMemory("list files in cli/src/agents/guards", repoRoot, repoRoot);
|
|
351
|
+
memory.task.queryScope = "targeted";
|
|
352
|
+
memory.task.explicitTargets = [guardsDir];
|
|
353
|
+
const context = buildSearchContext(memory, "list files in cli/src/agents/guards", {
|
|
354
|
+
allowDirectoryLane: true,
|
|
355
|
+
});
|
|
356
|
+
const decision = classifySearchLane(context);
|
|
357
|
+
expect(decision).toEqual(expect.objectContaining({
|
|
358
|
+
lane: "directory",
|
|
359
|
+
resolvedTarget: guardsDir,
|
|
360
|
+
}));
|
|
361
|
+
expect(chooseSearchRoute(context)).toBe("directory");
|
|
362
|
+
});
|
|
363
|
+
it("prefers exact-target when explicit targets are present", () => {
|
|
364
|
+
const memory = createAgentMemory("Explain MainAgent.ts", "/repo", "/repo");
|
|
365
|
+
memory.task.queryScope = "targeted";
|
|
366
|
+
memory.task.explicitTargets = ["MainAgent.ts"];
|
|
367
|
+
const context = buildSearchContext(memory, "Explain the file", {
|
|
368
|
+
allowDirectoryLane: true,
|
|
369
|
+
allowRegexLane: true,
|
|
370
|
+
});
|
|
371
|
+
const decision = classifySearchLane(context);
|
|
372
|
+
expect(decision).toEqual(expect.objectContaining({
|
|
373
|
+
lane: "exact-target",
|
|
374
|
+
resolvedTarget: "MainAgent.ts",
|
|
375
|
+
}));
|
|
376
|
+
expect(chooseSearchRoute(context)).toBe("exact-target");
|
|
377
|
+
});
|
|
378
|
+
it("uses exact-target for unresolved explicit targets before semantic fallback", () => {
|
|
379
|
+
const memory = createAgentMemory("Explain guards", "/repo", "/repo");
|
|
380
|
+
memory.task.queryScope = "targeted";
|
|
381
|
+
memory.task.explicitTargets = ["guards"];
|
|
382
|
+
const context = buildSearchContext(memory, "Explain guards", {
|
|
383
|
+
allowDirectoryLane: true,
|
|
384
|
+
allowRegexLane: true,
|
|
385
|
+
});
|
|
386
|
+
const decision = classifySearchLane(context);
|
|
387
|
+
expect(decision).toEqual(expect.objectContaining({
|
|
388
|
+
lane: "exact-target",
|
|
389
|
+
resolvedTarget: "guards",
|
|
390
|
+
}));
|
|
391
|
+
expect(chooseSearchRoute(context)).toBe("exact-target");
|
|
392
|
+
});
|
|
393
|
+
it("does not route listing verbs to the directory lane when the hint is not folder-like", () => {
|
|
394
|
+
const memory = createAgentMemory("list files for retry policy", "/repo", "/repo");
|
|
395
|
+
memory.task.queryScope = "general";
|
|
396
|
+
memory.task.softHints = ["retry-policy"];
|
|
397
|
+
const context = buildSearchContext(memory, "list files for retry policy", {
|
|
398
|
+
allowDirectoryLane: true,
|
|
399
|
+
});
|
|
400
|
+
const decision = classifySearchLane(context);
|
|
401
|
+
expect(decision.lane).toBe("semantic");
|
|
402
|
+
expect(chooseSearchRoute(context)).toBe("semantic");
|
|
403
|
+
});
|
|
404
|
+
it("does not route file paths with listing wording to the directory lane", () => {
|
|
405
|
+
const memory = createAgentMemory("show contents of cli/src/agent/search/index.ts", "/repo", "/repo");
|
|
406
|
+
memory.task.queryScope = "targeted";
|
|
407
|
+
memory.task.explicitTargets = ["cli/src/agent/search/index.ts"];
|
|
408
|
+
const context = buildSearchContext(memory, "show contents of cli/src/agent/search/index.ts", {
|
|
409
|
+
allowDirectoryLane: true,
|
|
410
|
+
});
|
|
411
|
+
const decision = classifySearchLane(context);
|
|
412
|
+
expect(decision.lane).toBe("exact-target");
|
|
413
|
+
expect(chooseSearchRoute(context)).toBe("exact-target");
|
|
414
|
+
});
|
|
415
|
+
it("uses the regex lane for regex-like queries when enabled", () => {
|
|
416
|
+
const memory = createAgentMemory("runSearch|semanticSearchFiles", "/repo", "/repo");
|
|
417
|
+
memory.task.queryScope = "general";
|
|
418
|
+
const context = buildSearchContext(memory, "runSearch|semanticSearchFiles", {
|
|
419
|
+
allowDirectoryLane: true,
|
|
420
|
+
allowRegexLane: true,
|
|
421
|
+
});
|
|
422
|
+
const decision = classifySearchLane(context);
|
|
423
|
+
expect(decision.lane).toBe("regex");
|
|
424
|
+
expect(chooseSearchRoute(context)).toBe("regex");
|
|
425
|
+
});
|
|
426
|
+
it("uses the shell-content lane for broad owner questions", () => {
|
|
427
|
+
const memory = createAgentMemory("where do I set the max count for how many loops the agent can run?", "/repo", "/repo");
|
|
428
|
+
memory.task.queryScope = "general";
|
|
429
|
+
const context = buildSearchContext(memory, "where do I set the max count for how many loops the agent can run?", {
|
|
430
|
+
allowDirectoryLane: true,
|
|
431
|
+
allowRegexLane: true,
|
|
432
|
+
});
|
|
433
|
+
const decision = classifySearchLane(context);
|
|
434
|
+
expect(decision.lane).toBe("shell-content");
|
|
435
|
+
expect(chooseSearchRoute(context)).toBe("shell-content");
|
|
436
|
+
});
|
|
437
|
+
it("keeps broad architecture summaries on semantic instead of shell-content", () => {
|
|
438
|
+
const memory = createAgentMemory("summarize repo architecture and identify weak coupling points", "/repo", "/repo");
|
|
439
|
+
memory.task.queryScope = "broad-repo";
|
|
440
|
+
const context = buildSearchContext(memory, "summarize repo architecture and identify weak coupling points", {
|
|
441
|
+
allowDirectoryLane: true,
|
|
442
|
+
allowRegexLane: true,
|
|
443
|
+
});
|
|
444
|
+
const decision = classifySearchLane(context);
|
|
445
|
+
expect(decision.lane).toBe("semantic");
|
|
446
|
+
expect(chooseSearchRoute(context)).toBe("semantic");
|
|
447
|
+
});
|
|
448
|
+
it("uses the fragment lane for quoted snippets", () => {
|
|
449
|
+
const memory = createAgentMemory('Find "currentQuestionId = task.currentQuestionId"', "/repo", "/repo");
|
|
450
|
+
memory.task.queryScope = "targeted";
|
|
451
|
+
const context = buildSearchContext(memory, 'Find "currentQuestionId = task.currentQuestionId"', {
|
|
452
|
+
allowDirectoryLane: true,
|
|
453
|
+
allowRegexLane: true,
|
|
454
|
+
});
|
|
455
|
+
const decision = classifySearchLane(context);
|
|
456
|
+
expect(decision.lane).toBe("fragment");
|
|
457
|
+
expect(chooseSearchRoute(context)).toBe("fragment");
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
describe("runSearchDb", () => {
|
|
461
|
+
it("salvages concrete exact targets even when another target is ambiguous", async () => {
|
|
462
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-fallback-"));
|
|
463
|
+
tempDirs.push(repoRoot);
|
|
464
|
+
const cliIndex = path.join(repoRoot, "cli", "src", "index.ts");
|
|
465
|
+
const webIndex = path.join(repoRoot, "web", "src", "index.ts");
|
|
466
|
+
const factoryFile = path.join(repoRoot, "cli", "src", "commands", "factory.ts");
|
|
467
|
+
const daemonFile = path.join(repoRoot, "cli", "src", "runQueryWithDaemonControl.ts");
|
|
468
|
+
fs.mkdirSync(path.dirname(cliIndex), { recursive: true });
|
|
469
|
+
fs.mkdirSync(path.dirname(webIndex), { recursive: true });
|
|
470
|
+
fs.mkdirSync(path.dirname(factoryFile), { recursive: true });
|
|
471
|
+
fs.writeFileSync(cliIndex, "export const cli = true;\n", "utf8");
|
|
472
|
+
fs.writeFileSync(webIndex, "export const web = true;\n", "utf8");
|
|
473
|
+
fs.writeFileSync(factoryFile, "export const factory = true;\n", "utf8");
|
|
474
|
+
fs.writeFileSync(daemonFile, "export const daemon = true;\n", "utf8");
|
|
475
|
+
const memory = createAgentMemory("Summarize CLI architecture", repoRoot, repoRoot);
|
|
476
|
+
memory.task.queryScope = "multi-file";
|
|
477
|
+
memory.task.explicitTargets = ["index.ts", "commands/factory.ts", "runQueryWithDaemonControl.ts"];
|
|
478
|
+
const packet = await runSearchDb(memory, "Summarize CLI architecture", 5);
|
|
479
|
+
expect(packet.lane).toBe("exact-target");
|
|
480
|
+
expect(packet.filePaths).toContain(cliIndex);
|
|
481
|
+
expect(packet.filePaths).toContain(webIndex);
|
|
482
|
+
expect(packet.filePaths).toContain(factoryFile);
|
|
483
|
+
expect(packet.filePaths).toContain(daemonFile);
|
|
484
|
+
expect(packet.filePaths).not.toContain(path.join(repoRoot, "README.md"));
|
|
485
|
+
});
|
|
486
|
+
it("uses the fragment lane for quoted snippets without dispatching to regex or directory search", async () => {
|
|
487
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-db-fragment-"));
|
|
488
|
+
tempDirs.push(repoRoot);
|
|
489
|
+
const targetFile = path.join(repoRoot, "cli", "src", "sample.ts");
|
|
490
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
491
|
+
fs.writeFileSync(targetFile, "const currentQuestionId = task.currentQuestionId;\n", "utf8");
|
|
492
|
+
const memory = createAgentMemory("Find \"currentQuestionId = task.currentQuestionId\"", repoRoot, repoRoot);
|
|
493
|
+
memory.task.queryScope = "targeted";
|
|
494
|
+
const packet = await runSearchDb(memory, "Find \"currentQuestionId = task.currentQuestionId\"");
|
|
495
|
+
expect(packet.lane).toBe("fragment");
|
|
496
|
+
expect(packet.filePaths).toContain(targetFile);
|
|
497
|
+
});
|
|
498
|
+
it("does not read eval artifacts for quoted snippet matches", async () => {
|
|
499
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-ignore-artifacts-"));
|
|
500
|
+
tempDirs.push(repoRoot);
|
|
501
|
+
const sourceFile = path.join(repoRoot, "cli", "src", "sample.ts");
|
|
502
|
+
const traceFile = path.join(repoRoot, "artifacts", "evals", "case1", "llm_calls", "0001_agent.understand.json");
|
|
503
|
+
fs.mkdirSync(path.dirname(sourceFile), { recursive: true });
|
|
504
|
+
fs.mkdirSync(path.dirname(traceFile), { recursive: true });
|
|
505
|
+
fs.writeFileSync(sourceFile, "return \"returns raw operator-pattern matches without semantic guessing\";\n", "utf8");
|
|
506
|
+
fs.writeFileSync(traceFile, "{\"query\":\"returns raw operator-pattern matches without semantic guessing\"}\n", "utf8");
|
|
507
|
+
const memory = createAgentMemory("\"returns raw operator-pattern matches without semantic guessing\"", repoRoot, repoRoot);
|
|
508
|
+
memory.task.queryScope = "targeted";
|
|
509
|
+
const packet = await runSearchDb(memory, "\"returns raw operator-pattern matches without semantic guessing\"");
|
|
510
|
+
expect(packet.lane).toBe("fragment");
|
|
511
|
+
expect(packet.filePaths).toContain(sourceFile);
|
|
512
|
+
expect(packet.filePaths).not.toContain(traceFile);
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
describe("candidateRetentionPolicy", () => {
|
|
516
|
+
it("injects well-known repo files only for sparse semantic repo-wide retrieval", () => {
|
|
517
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-semantic-fallback-"));
|
|
518
|
+
tempDirs.push(repoRoot);
|
|
519
|
+
const loopFile = path.join(repoRoot, "cli", "src", "agent", "runtime", "runAgentLoop.ts");
|
|
520
|
+
fs.mkdirSync(path.dirname(loopFile), { recursive: true });
|
|
521
|
+
fs.writeFileSync(loopFile, "export const loop = true;\n", "utf8");
|
|
522
|
+
fs.writeFileSync(path.join(repoRoot, "README.md"), "# Repo\n", "utf8");
|
|
523
|
+
fs.writeFileSync(path.join(repoRoot, "package.json"), "{ \"name\": \"repo\" }\n", "utf8");
|
|
524
|
+
const memory = createAgentMemory("Explain the repo structure", repoRoot, repoRoot);
|
|
525
|
+
memory.task.queryScope = "broad-repo";
|
|
526
|
+
const packet = finalizeLanePacket("semantic", memory, {
|
|
527
|
+
lane: "semantic",
|
|
528
|
+
query: "Explain the repo structure",
|
|
529
|
+
filePaths: [loopFile],
|
|
530
|
+
}, 5);
|
|
531
|
+
expect(packet.filePaths).toContain(path.join(repoRoot, "README.md"));
|
|
532
|
+
});
|
|
533
|
+
it("does not inject repo defaults into exact-target results", () => {
|
|
534
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-exact-fallback-"));
|
|
535
|
+
tempDirs.push(repoRoot);
|
|
536
|
+
const targetFile = path.join(repoRoot, "cli", "src", "commands", "EvalReportCmd.ts");
|
|
537
|
+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
|
|
538
|
+
fs.writeFileSync(targetFile, "export const evalReport = true;\n", "utf8");
|
|
539
|
+
fs.writeFileSync(path.join(repoRoot, "README.md"), "# Repo\n", "utf8");
|
|
540
|
+
const memory = createAgentMemory("Explain EvalReportCmd.ts", repoRoot, repoRoot);
|
|
541
|
+
memory.task.queryScope = "targeted";
|
|
542
|
+
memory.task.explicitTargets = ["EvalReportCmd.ts"];
|
|
543
|
+
const packet = finalizeLanePacket("exact-target", memory, {
|
|
544
|
+
lane: "exact-target",
|
|
545
|
+
query: "Explain EvalReportCmd.ts",
|
|
546
|
+
filePaths: [targetFile],
|
|
547
|
+
}, 5);
|
|
548
|
+
expect(packet.filePaths).toEqual([targetFile]);
|
|
549
|
+
});
|
|
550
|
+
it("keeps all resolved exact-target matches instead of trimming them like semantic search", () => {
|
|
551
|
+
const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "scai-agent-search-exact-keep-"));
|
|
552
|
+
tempDirs.push(repoRoot);
|
|
553
|
+
const cliIndex = path.join(repoRoot, "cli", "src", "index.ts");
|
|
554
|
+
const factoryFile = path.join(repoRoot, "cli", "src", "commands", "factory.ts");
|
|
555
|
+
const daemonFile = path.join(repoRoot, "cli", "src", "runQueryWithDaemonControl.ts");
|
|
556
|
+
fs.mkdirSync(path.dirname(factoryFile), { recursive: true });
|
|
557
|
+
fs.writeFileSync(cliIndex, "export const cli = true;\n", "utf8");
|
|
558
|
+
fs.writeFileSync(factoryFile, "export const factory = true;\n", "utf8");
|
|
559
|
+
fs.writeFileSync(daemonFile, "export const daemon = true;\n", "utf8");
|
|
560
|
+
const memory = createAgentMemory("Summarize CLI architecture", repoRoot, repoRoot);
|
|
561
|
+
memory.task.queryScope = "multi-file";
|
|
562
|
+
memory.task.explicitTargets = ["index.ts", "commands/factory.ts", "runQueryWithDaemonControl.ts"];
|
|
563
|
+
const packet = finalizeLanePacket("exact-target", memory, {
|
|
564
|
+
lane: "exact-target",
|
|
565
|
+
query: "Summarize CLI architecture",
|
|
566
|
+
filePaths: [cliIndex, factoryFile, daemonFile],
|
|
567
|
+
}, 1);
|
|
568
|
+
expect(packet.filePaths).toEqual([cliIndex, factoryFile, daemonFile]);
|
|
569
|
+
});
|
|
570
|
+
it("prefers code and test files over markdown docs for fragment matches", () => {
|
|
571
|
+
const memory = createAgentMemory("\"alpha beta gamma\"", "/repo", "/repo");
|
|
572
|
+
memory.task.queryScope = "targeted";
|
|
573
|
+
const packet = finalizeLanePacket("fragment", memory, {
|
|
574
|
+
lane: "fragment",
|
|
575
|
+
query: "\"alpha beta gamma\"",
|
|
576
|
+
filePaths: [
|
|
577
|
+
"/repo/optimize.md",
|
|
578
|
+
"/repo/cli/src/__tests__/search/SearchOrchestrator.test.ts",
|
|
579
|
+
],
|
|
580
|
+
}, 5);
|
|
581
|
+
expect(packet.topHits?.[0]?.filePath).toBe("/repo/cli/src/__tests__/search/SearchOrchestrator.test.ts");
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
//# sourceMappingURL=agentSearchRouting.test.js.map
|